/*!
*
* antd v6.3.7
*
* Copyright 2015-present, Alipay, Inc.
* All rights reserved.
*
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"), require("react-dom"), require("dayjs"));
else if(typeof define === 'function' && define.amd)
define(["react", "react-dom", "dayjs"], factory);
else if(typeof exports === 'object')
exports["antd"] = factory(require("react"), require("react-dom"), require("dayjs"));
else
root["antd"] = factory(root["React"], root["ReactDOM"], root["dayjs"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_react__, __WEBPACK_EXTERNAL_MODULE_react_dom__, __WEBPACK_EXTERNAL_MODULE_dayjs__) {
return /******/ (function() { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./components sync recursive ^\\.\\/[^_][\\w-]+\\/style\\/index\\.tsx?$":
/*!***************************************************************!*\
!*** ./components/ sync ^\.\/[^_][\w-]+\/style\/index\.tsx?$ ***!
\***************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var map = {
"./affix/style/index.ts": "./components/affix/style/index.ts",
"./alert/style/index.ts": "./components/alert/style/index.ts",
"./anchor/style/index.ts": "./components/anchor/style/index.ts",
"./app/style/index.ts": "./components/app/style/index.ts",
"./avatar/style/index.ts": "./components/avatar/style/index.ts",
"./back-top/style/index.ts": "./components/back-top/style/index.ts",
"./badge/style/index.ts": "./components/badge/style/index.ts",
"./breadcrumb/style/index.ts": "./components/breadcrumb/style/index.ts",
"./button/style/index.ts": "./components/button/style/index.ts",
"./calendar/style/index.ts": "./components/calendar/style/index.ts",
"./card/style/index.ts": "./components/card/style/index.ts",
"./carousel/style/index.ts": "./components/carousel/style/index.ts",
"./cascader/style/index.ts": "./components/cascader/style/index.ts",
"./checkbox/style/index.ts": "./components/checkbox/style/index.ts",
"./col/style/index.ts": "./components/col/style/index.ts",
"./collapse/style/index.ts": "./components/collapse/style/index.ts",
"./color-picker/style/index.ts": "./components/color-picker/style/index.ts",
"./config-provider/style/index.ts": "./components/config-provider/style/index.ts",
"./date-picker/style/index.ts": "./components/date-picker/style/index.ts",
"./descriptions/style/index.ts": "./components/descriptions/style/index.ts",
"./divider/style/index.ts": "./components/divider/style/index.ts",
"./drawer/style/index.ts": "./components/drawer/style/index.ts",
"./dropdown/style/index.ts": "./components/dropdown/style/index.ts",
"./empty/style/index.ts": "./components/empty/style/index.ts",
"./flex/style/index.ts": "./components/flex/style/index.ts",
"./float-button/style/index.ts": "./components/float-button/style/index.ts",
"./form/style/index.ts": "./components/form/style/index.ts",
"./grid/style/index.ts": "./components/grid/style/index.ts",
"./image/style/index.ts": "./components/image/style/index.ts",
"./input-number/style/index.ts": "./components/input-number/style/index.ts",
"./input/style/index.ts": "./components/input/style/index.ts",
"./layout/style/index.ts": "./components/layout/style/index.ts",
"./list/style/index.ts": "./components/list/style/index.ts",
"./masonry/style/index.ts": "./components/masonry/style/index.ts",
"./mentions/style/index.ts": "./components/mentions/style/index.ts",
"./menu/style/index.ts": "./components/menu/style/index.ts",
"./message/style/index.ts": "./components/message/style/index.ts",
"./modal/style/index.ts": "./components/modal/style/index.ts",
"./notification/style/index.ts": "./components/notification/style/index.ts",
"./pagination/style/index.ts": "./components/pagination/style/index.ts",
"./popconfirm/style/index.ts": "./components/popconfirm/style/index.ts",
"./popover/style/index.ts": "./components/popover/style/index.ts",
"./progress/style/index.ts": "./components/progress/style/index.ts",
"./qr-code/style/index.ts": "./components/qr-code/style/index.ts",
"./qrcode/style/index.ts": "./components/qrcode/style/index.ts",
"./radio/style/index.ts": "./components/radio/style/index.ts",
"./rate/style/index.ts": "./components/rate/style/index.ts",
"./result/style/index.ts": "./components/result/style/index.ts",
"./row/style/index.ts": "./components/row/style/index.ts",
"./segmented/style/index.ts": "./components/segmented/style/index.ts",
"./select/style/index.ts": "./components/select/style/index.ts",
"./skeleton/style/index.ts": "./components/skeleton/style/index.ts",
"./slider/style/index.ts": "./components/slider/style/index.ts",
"./space/style/index.ts": "./components/space/style/index.ts",
"./spin/style/index.ts": "./components/spin/style/index.ts",
"./splitter/style/index.ts": "./components/splitter/style/index.ts",
"./statistic/style/index.ts": "./components/statistic/style/index.ts",
"./steps/style/index.ts": "./components/steps/style/index.ts",
"./switch/style/index.ts": "./components/switch/style/index.ts",
"./table/style/index.ts": "./components/table/style/index.ts",
"./tabs/style/index.ts": "./components/tabs/style/index.ts",
"./tag/style/index.ts": "./components/tag/style/index.ts",
"./timeline/style/index.ts": "./components/timeline/style/index.ts",
"./tooltip/style/index.ts": "./components/tooltip/style/index.ts",
"./tour/style/index.ts": "./components/tour/style/index.ts",
"./transfer/style/index.ts": "./components/transfer/style/index.ts",
"./tree-select/style/index.ts": "./components/tree-select/style/index.ts",
"./tree/style/index.ts": "./components/tree/style/index.ts",
"./typography/style/index.ts": "./components/typography/style/index.ts",
"./upload/style/index.ts": "./components/upload/style/index.ts"
};
function webpackContext(req) {
var id = webpackContextResolve(req);
return __webpack_require__(id);
}
function webpackContextResolve(req) {
if(!__webpack_require__.o(map, req)) {
var e = new Error("Cannot find module '" + req + "'");
e.code = 'MODULE_NOT_FOUND';
throw e;
}
return map[req];
}
webpackContext.keys = function webpackContextKeys() {
return Object.keys(map);
};
webpackContext.resolve = webpackContextResolve;
module.exports = webpackContext;
webpackContext.id = "./components sync recursive ^\\.\\/[^_][\\w-]+\\/style\\/index\\.tsx?$";
/***/ }),
/***/ "./node_modules/@ant-design/colors/es/index.js":
/*!*****************************************************************!*\
!*** ./node_modules/@ant-design/colors/es/index.js + 2 modules ***!
\*****************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
blue: function() { return /* reexport */ blue; },
generate: function() { return /* reexport */ generate; },
gold: function() { return /* reexport */ gold; },
presetPalettes: function() { return /* reexport */ presetPalettes; },
presetPrimaryColors: function() { return /* reexport */ presetPrimaryColors; }
});
// UNUSED EXPORTS: blueDark, cyan, cyanDark, geekblue, geekblueDark, goldDark, gray, green, greenDark, grey, greyDark, lime, limeDark, magenta, magentaDark, orange, orangeDark, presetDarkPalettes, purple, purpleDark, red, redDark, volcano, volcanoDark, yellow, yellowDark
// EXTERNAL MODULE: ./node_modules/@ant-design/fast-color/es/index.js + 3 modules
var es = __webpack_require__("./node_modules/@ant-design/fast-color/es/index.js");
;// ./node_modules/@ant-design/colors/es/generate.js
const hueStep = 2; // 色相阶梯
const saturationStep = 0.16; // 饱和度阶梯,浅色部分
const saturationStep2 = 0.05; // 饱和度阶梯,深色部分
const brightnessStep1 = 0.05; // 亮度阶梯,浅色部分
const brightnessStep2 = 0.15; // 亮度阶梯,深色部分
const lightColorCount = 5; // 浅色数量,主色上
const darkColorCount = 4; // 深色数量,主色下
// 暗色主题颜色映射关系表
const darkColorMap = [{
index: 7,
amount: 15
}, {
index: 6,
amount: 25
}, {
index: 5,
amount: 30
}, {
index: 5,
amount: 45
}, {
index: 5,
amount: 65
}, {
index: 5,
amount: 85
}, {
index: 4,
amount: 90
}, {
index: 3,
amount: 95
}, {
index: 2,
amount: 97
}, {
index: 1,
amount: 98
}];
function getHue(hsv, i, light) {
let hue;
// 根据色相不同,色相转向不同
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
} else {
hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
}
if (hue < 0) {
hue += 360;
} else if (hue >= 360) {
hue -= 360;
}
return hue;
}
function getSaturation(hsv, i, light) {
// grey color don't change saturation
if (hsv.h === 0 && hsv.s === 0) {
return hsv.s;
}
let saturation;
if (light) {
saturation = hsv.s - saturationStep * i;
} else if (i === darkColorCount) {
saturation = hsv.s + saturationStep;
} else {
saturation = hsv.s + saturationStep2 * i;
}
// 边界值修正
if (saturation > 1) {
saturation = 1;
}
// 第一格的 s 限制在 0.06-0.1 之间
if (light && i === lightColorCount && saturation > 0.1) {
saturation = 0.1;
}
if (saturation < 0.06) {
saturation = 0.06;
}
return Math.round(saturation * 100) / 100;
}
function getValue(hsv, i, light) {
let value;
if (light) {
value = hsv.v + brightnessStep1 * i;
} else {
value = hsv.v - brightnessStep2 * i;
}
// Clamp value between 0 and 1
value = Math.max(0, Math.min(1, value));
return Math.round(value * 100) / 100;
}
function generate(color, opts = {}) {
const patterns = [];
const pColor = new es.FastColor(color);
const hsv = pColor.toHsv();
for (let i = lightColorCount; i > 0; i -= 1) {
const c = new es.FastColor({
h: getHue(hsv, i, true),
s: getSaturation(hsv, i, true),
v: getValue(hsv, i, true)
});
patterns.push(c);
}
patterns.push(pColor);
for (let i = 1; i <= darkColorCount; i += 1) {
const c = new es.FastColor({
h: getHue(hsv, i),
s: getSaturation(hsv, i),
v: getValue(hsv, i)
});
patterns.push(c);
}
// dark theme patterns
if (opts.theme === 'dark') {
return darkColorMap.map(({
index,
amount
}) => new es.FastColor(opts.backgroundColor || '#141414').mix(patterns[index], amount).toHexString());
}
return patterns.map(c => c.toHexString());
}
;// ./node_modules/@ant-design/colors/es/presets.js
// Generated by script. Do NOT modify!
const presetPrimaryColors = {
"red": "#F5222D",
"volcano": "#FA541C",
"orange": "#FA8C16",
"gold": "#FAAD14",
"yellow": "#FADB14",
"lime": "#A0D911",
"green": "#52C41A",
"cyan": "#13C2C2",
"blue": "#1677FF",
"geekblue": "#2F54EB",
"purple": "#722ED1",
"magenta": "#EB2F96",
"grey": "#666666"
};
const red = ["#fff1f0", "#ffccc7", "#ffa39e", "#ff7875", "#ff4d4f", "#f5222d", "#cf1322", "#a8071a", "#820014", "#5c0011"];
red.primary = red[5];
const volcano = ["#fff2e8", "#ffd8bf", "#ffbb96", "#ff9c6e", "#ff7a45", "#fa541c", "#d4380d", "#ad2102", "#871400", "#610b00"];
volcano.primary = volcano[5];
const orange = ["#fff7e6", "#ffe7ba", "#ffd591", "#ffc069", "#ffa940", "#fa8c16", "#d46b08", "#ad4e00", "#873800", "#612500"];
orange.primary = orange[5];
const gold = ["#fffbe6", "#fff1b8", "#ffe58f", "#ffd666", "#ffc53d", "#faad14", "#d48806", "#ad6800", "#874d00", "#613400"];
gold.primary = gold[5];
const yellow = ["#feffe6", "#ffffb8", "#fffb8f", "#fff566", "#ffec3d", "#fadb14", "#d4b106", "#ad8b00", "#876800", "#614700"];
yellow.primary = yellow[5];
const lime = ["#fcffe6", "#f4ffb8", "#eaff8f", "#d3f261", "#bae637", "#a0d911", "#7cb305", "#5b8c00", "#3f6600", "#254000"];
lime.primary = lime[5];
const green = ["#f6ffed", "#d9f7be", "#b7eb8f", "#95de64", "#73d13d", "#52c41a", "#389e0d", "#237804", "#135200", "#092b00"];
green.primary = green[5];
const cyan = ["#e6fffb", "#b5f5ec", "#87e8de", "#5cdbd3", "#36cfc9", "#13c2c2", "#08979c", "#006d75", "#00474f", "#002329"];
cyan.primary = cyan[5];
const blue = ["#e6f4ff", "#bae0ff", "#91caff", "#69b1ff", "#4096ff", "#1677ff", "#0958d9", "#003eb3", "#002c8c", "#001d66"];
blue.primary = blue[5];
const geekblue = ["#f0f5ff", "#d6e4ff", "#adc6ff", "#85a5ff", "#597ef7", "#2f54eb", "#1d39c4", "#10239e", "#061178", "#030852"];
geekblue.primary = geekblue[5];
const purple = ["#f9f0ff", "#efdbff", "#d3adf7", "#b37feb", "#9254de", "#722ed1", "#531dab", "#391085", "#22075e", "#120338"];
purple.primary = purple[5];
const magenta = ["#fff0f6", "#ffd6e7", "#ffadd2", "#ff85c0", "#f759ab", "#eb2f96", "#c41d7f", "#9e1068", "#780650", "#520339"];
magenta.primary = magenta[5];
const grey = ["#a6a6a6", "#999999", "#8c8c8c", "#808080", "#737373", "#666666", "#404040", "#1a1a1a", "#000000", "#000000"];
grey.primary = grey[5];
const gray = grey;
const presetPalettes = {
red,
volcano,
orange,
gold,
yellow,
lime,
green,
cyan,
blue,
geekblue,
purple,
magenta,
grey
};
const redDark = ["#2a1215", "#431418", "#58181c", "#791a1f", "#a61d24", "#d32029", "#e84749", "#f37370", "#f89f9a", "#fac8c3"];
redDark.primary = redDark[5];
const volcanoDark = ["#2b1611", "#441d12", "#592716", "#7c3118", "#aa3e19", "#d84a1b", "#e87040", "#f3956a", "#f8b692", "#fad4bc"];
volcanoDark.primary = volcanoDark[5];
const orangeDark = ["#2b1d11", "#442a11", "#593815", "#7c4a15", "#aa6215", "#d87a16", "#e89a3c", "#f3b765", "#f8cf8d", "#fae3b7"];
orangeDark.primary = orangeDark[5];
const goldDark = ["#2b2111", "#443111", "#594214", "#7c5914", "#aa7714", "#d89614", "#e8b339", "#f3cc62", "#f8df8b", "#faedb5"];
goldDark.primary = goldDark[5];
const yellowDark = ["#2b2611", "#443b11", "#595014", "#7c6e14", "#aa9514", "#d8bd14", "#e8d639", "#f3ea62", "#f8f48b", "#fafab5"];
yellowDark.primary = yellowDark[5];
const limeDark = ["#1f2611", "#2e3c10", "#3e4f13", "#536d13", "#6f9412", "#8bbb11", "#a9d134", "#c9e75d", "#e4f88b", "#f0fab5"];
limeDark.primary = limeDark[5];
const greenDark = ["#162312", "#1d3712", "#274916", "#306317", "#3c8618", "#49aa19", "#6abe39", "#8fd460", "#b2e58b", "#d5f2bb"];
greenDark.primary = greenDark[5];
const cyanDark = ["#112123", "#113536", "#144848", "#146262", "#138585", "#13a8a8", "#33bcb7", "#58d1c9", "#84e2d8", "#b2f1e8"];
cyanDark.primary = cyanDark[5];
const blueDark = ["#111a2c", "#112545", "#15325b", "#15417e", "#1554ad", "#1668dc", "#3c89e8", "#65a9f3", "#8dc5f8", "#b7dcfa"];
blueDark.primary = blueDark[5];
const geekblueDark = ["#131629", "#161d40", "#1c2755", "#203175", "#263ea0", "#2b4acb", "#5273e0", "#7f9ef3", "#a8c1f8", "#d2e0fa"];
geekblueDark.primary = geekblueDark[5];
const purpleDark = ["#1a1325", "#24163a", "#301c4d", "#3e2069", "#51258f", "#642ab5", "#854eca", "#ab7ae0", "#cda8f0", "#ebd7fa"];
purpleDark.primary = purpleDark[5];
const magentaDark = ["#291321", "#40162f", "#551c3b", "#75204f", "#a02669", "#cb2b83", "#e0529c", "#f37fb7", "#f8a8cc", "#fad2e3"];
magentaDark.primary = magentaDark[5];
const greyDark = ["#151515", "#1f1f1f", "#2d2d2d", "#393939", "#494949", "#5a5a5a", "#6a6a6a", "#7b7b7b", "#888888", "#969696"];
greyDark.primary = greyDark[5];
const presetDarkPalettes = {
red: redDark,
volcano: volcanoDark,
orange: orangeDark,
gold: goldDark,
yellow: yellowDark,
lime: limeDark,
green: greenDark,
cyan: cyanDark,
blue: blueDark,
geekblue: geekblueDark,
purple: purpleDark,
magenta: magentaDark,
grey: greyDark
};
;// ./node_modules/@ant-design/colors/es/index.js
/***/ }),
/***/ "./node_modules/@ant-design/cssinjs-utils/es/index.js":
/*!*************************************************************************!*\
!*** ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules ***!
\*************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
genStyleUtils: function() { return /* reexport */ util_genStyleUtils; },
mergeToken: function() { return /* reexport */ merge; }
});
// UNUSED EXPORTS: genCalc, statistic, statisticToken
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
var esm_typeof = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/typeof.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 3 modules
var slicedToArray = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 3 modules
var toConsumableArray = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
var defineProperty = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
var objectSpread2 = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/objectSpread2.js");
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__("react");
var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
var classCallCheck = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
var createClass = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/createClass.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
var assertThisInitialized = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
var inherits = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/inherits.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createSuper.js
var createSuper = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/createSuper.js");
;// ./node_modules/@ant-design/cssinjs-utils/es/util/calc/calculator.js
var AbstractCalculator = /*#__PURE__*/(0,createClass["default"])(function AbstractCalculator() {
(0,classCallCheck["default"])(this, AbstractCalculator);
});
/* harmony default export */ var calculator = (AbstractCalculator);
;// ./node_modules/@ant-design/cssinjs-utils/es/util/calc/CSSCalculator.js
var CALC_UNIT = 'CALC_UNIT';
var regexp = new RegExp(CALC_UNIT, 'g');
function unit(value) {
if (typeof value === 'number') {
return "".concat(value).concat(CALC_UNIT);
}
return value;
}
var CSSCalculator = /*#__PURE__*/function (_AbstractCalculator) {
(0,inherits["default"])(CSSCalculator, _AbstractCalculator);
var _super = (0,createSuper["default"])(CSSCalculator);
function CSSCalculator(num, unitlessCssVar) {
var _this;
(0,classCallCheck["default"])(this, CSSCalculator);
_this = _super.call(this);
(0,defineProperty["default"])((0,assertThisInitialized["default"])(_this), "result", '');
(0,defineProperty["default"])((0,assertThisInitialized["default"])(_this), "unitlessCssVar", void 0);
(0,defineProperty["default"])((0,assertThisInitialized["default"])(_this), "lowPriority", void 0);
var numType = (0,esm_typeof["default"])(num);
_this.unitlessCssVar = unitlessCssVar;
if (num instanceof CSSCalculator) {
_this.result = "(".concat(num.result, ")");
} else if (numType === 'number') {
_this.result = unit(num);
} else if (numType === 'string') {
_this.result = num;
}
return _this;
}
(0,createClass["default"])(CSSCalculator, [{
key: "add",
value: function add(num) {
if (num instanceof CSSCalculator) {
this.result = "".concat(this.result, " + ").concat(num.getResult());
} else if (typeof num === 'number' || typeof num === 'string') {
this.result = "".concat(this.result, " + ").concat(unit(num));
}
this.lowPriority = true;
return this;
}
}, {
key: "sub",
value: function sub(num) {
if (num instanceof CSSCalculator) {
this.result = "".concat(this.result, " - ").concat(num.getResult());
} else if (typeof num === 'number' || typeof num === 'string') {
this.result = "".concat(this.result, " - ").concat(unit(num));
}
this.lowPriority = true;
return this;
}
}, {
key: "mul",
value: function mul(num) {
if (this.lowPriority) {
this.result = "(".concat(this.result, ")");
}
if (num instanceof CSSCalculator) {
this.result = "".concat(this.result, " * ").concat(num.getResult(true));
} else if (typeof num === 'number' || typeof num === 'string') {
this.result = "".concat(this.result, " * ").concat(num);
}
this.lowPriority = false;
return this;
}
}, {
key: "div",
value: function div(num) {
if (this.lowPriority) {
this.result = "(".concat(this.result, ")");
}
if (num instanceof CSSCalculator) {
this.result = "".concat(this.result, " / ").concat(num.getResult(true));
} else if (typeof num === 'number' || typeof num === 'string') {
this.result = "".concat(this.result, " / ").concat(num);
}
this.lowPriority = false;
return this;
}
}, {
key: "getResult",
value: function getResult(force) {
return this.lowPriority || force ? "(".concat(this.result, ")") : this.result;
}
}, {
key: "equal",
value: function equal(options) {
var _this2 = this;
var _ref = options || {},
cssUnit = _ref.unit;
var mergedUnit = true;
if (typeof cssUnit === 'boolean') {
mergedUnit = cssUnit;
} else if (Array.from(this.unitlessCssVar).some(function (cssVar) {
return _this2.result.includes(cssVar);
})) {
mergedUnit = false;
}
this.result = this.result.replace(regexp, mergedUnit ? 'px' : '');
if (typeof this.lowPriority !== 'undefined') {
return "calc(".concat(this.result, ")");
}
return this.result;
}
}]);
return CSSCalculator;
}(calculator);
;// ./node_modules/@ant-design/cssinjs-utils/es/util/calc/NumCalculator.js
var NumCalculator = /*#__PURE__*/function (_AbstractCalculator) {
(0,inherits["default"])(NumCalculator, _AbstractCalculator);
var _super = (0,createSuper["default"])(NumCalculator);
function NumCalculator(num) {
var _this;
(0,classCallCheck["default"])(this, NumCalculator);
_this = _super.call(this);
(0,defineProperty["default"])((0,assertThisInitialized["default"])(_this), "result", 0);
if (num instanceof NumCalculator) {
_this.result = num.result;
} else if (typeof num === 'number') {
_this.result = num;
}
return _this;
}
(0,createClass["default"])(NumCalculator, [{
key: "add",
value: function add(num) {
if (num instanceof NumCalculator) {
this.result += num.result;
} else if (typeof num === 'number') {
this.result += num;
}
return this;
}
}, {
key: "sub",
value: function sub(num) {
if (num instanceof NumCalculator) {
this.result -= num.result;
} else if (typeof num === 'number') {
this.result -= num;
}
return this;
}
}, {
key: "mul",
value: function mul(num) {
if (num instanceof NumCalculator) {
this.result *= num.result;
} else if (typeof num === 'number') {
this.result *= num;
}
return this;
}
}, {
key: "div",
value: function div(num) {
if (num instanceof NumCalculator) {
this.result /= num.result;
} else if (typeof num === 'number') {
this.result /= num;
}
return this;
}
}, {
key: "equal",
value: function equal() {
return this.result;
}
}]);
return NumCalculator;
}(calculator);
/* harmony default export */ var calc_NumCalculator = (NumCalculator);
;// ./node_modules/@ant-design/cssinjs-utils/es/util/calc/index.js
var genCalc = function genCalc(type, unitlessCssVar) {
var Calculator = type === 'css' ? CSSCalculator : calc_NumCalculator;
return function (num) {
return new Calculator(num, unitlessCssVar);
};
};
/* harmony default export */ var util_calc = (genCalc);
;// ./node_modules/@ant-design/cssinjs-utils/es/util/getCompVarPrefix.js
var getCompVarPrefix = function getCompVarPrefix(component, prefix) {
return "".concat([prefix, component.replace(/([A-Z]+)([A-Z][a-z]+)/g, '$1-$2').replace(/([a-z])([A-Z])/g, '$1-$2')].filter(Boolean).join('-'));
};
/* harmony default export */ var util_getCompVarPrefix = (getCompVarPrefix);
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/index.js + 2 modules
var es = __webpack_require__("./node_modules/@rc-component/util/es/index.js");
;// ./node_modules/@ant-design/cssinjs-utils/es/util/getComponentToken.js
function getComponentToken(component, token, defaultToken, options) {
var customToken = (0,objectSpread2["default"])({}, token[component]);
if (options !== null && options !== void 0 && options.deprecatedTokens) {
var deprecatedTokens = options.deprecatedTokens;
deprecatedTokens.forEach(function (_ref) {
var _ref2 = (0,slicedToArray["default"])(_ref, 2),
oldTokenKey = _ref2[0],
newTokenKey = _ref2[1];
if (true) {
(0,es.warning)(!(customToken !== null && customToken !== void 0 && customToken[oldTokenKey]), "Component Token `".concat(String(oldTokenKey), "` of ").concat(String(component), " is deprecated. Please use `").concat(String(newTokenKey), "` instead."));
}
// Should wrap with `if` clause, or there will be `undefined` in object.
if (customToken !== null && customToken !== void 0 && customToken[oldTokenKey] || customToken !== null && customToken !== void 0 && customToken[newTokenKey]) {
var _customToken$newToken;
(_customToken$newToken = customToken[newTokenKey]) !== null && _customToken$newToken !== void 0 ? _customToken$newToken : customToken[newTokenKey] = customToken === null || customToken === void 0 ? void 0 : customToken[oldTokenKey];
}
});
}
var mergedToken = (0,objectSpread2["default"])((0,objectSpread2["default"])({}, defaultToken), customToken);
// Remove same value as global token to minimize size
Object.keys(mergedToken).forEach(function (key) {
if (mergedToken[key] === token[key]) {
delete mergedToken[key];
}
});
return mergedToken;
}
/* harmony default export */ var util_getComponentToken = (getComponentToken);
;// ./node_modules/@ant-design/cssinjs-utils/es/util/statistic.js
var enableStatistic = true || 0;
var recording = true;
/**
* This function will do as `Object.assign` in production. But will use Object.defineProperty:get to
* pass all value access in development. To support statistic field usage with alias token.
*/
function merge() {
for (var _len = arguments.length, objs = new Array(_len), _key = 0; _key < _len; _key++) {
objs[_key] = arguments[_key];
}
/* istanbul ignore next */
if (!enableStatistic) {
return Object.assign.apply(Object, [{}].concat(objs));
}
recording = false;
var ret = {};
objs.forEach(function (obj) {
if ((0,esm_typeof["default"])(obj) !== 'object') {
return;
}
var keys = Object.keys(obj);
keys.forEach(function (key) {
Object.defineProperty(ret, key, {
configurable: true,
enumerable: true,
get: function get() {
return obj[key];
}
});
});
});
recording = true;
return ret;
}
/** @internal Internal Usage. Not use in your production. */
var statistic = {};
/** @internal Internal Usage. Not use in your production. */
var _statistic_build_ = {};
/* istanbul ignore next */
function noop() {}
/** Statistic token usage case. Should use `merge` function if you do not want spread record. */
var statisticToken = function statisticToken(token) {
var tokenKeys;
var proxy = token;
var flush = noop;
if (enableStatistic && typeof Proxy !== 'undefined') {
tokenKeys = new Set();
proxy = new Proxy(token, {
get: function get(obj, prop) {
if (recording) {
var _tokenKeys;
(_tokenKeys = tokenKeys) === null || _tokenKeys === void 0 || _tokenKeys.add(prop);
}
return obj[prop];
}
});
flush = function flush(componentName, componentToken) {
var _statistic$componentN;
statistic[componentName] = {
global: Array.from(tokenKeys),
component: (0,objectSpread2["default"])((0,objectSpread2["default"])({}, (_statistic$componentN = statistic[componentName]) === null || _statistic$componentN === void 0 ? void 0 : _statistic$componentN.component), componentToken)
};
};
}
return {
token: proxy,
keys: tokenKeys,
flush: flush
};
};
/* harmony default export */ var util_statistic = (statisticToken);
;// ./node_modules/@ant-design/cssinjs-utils/es/util/getDefaultComponentToken.js
function getDefaultComponentToken(component, token, getDefaultToken) {
if (typeof getDefaultToken === 'function') {
var _token$component;
return getDefaultToken(merge(token, (_token$component = token[component]) !== null && _token$component !== void 0 ? _token$component : {}));
}
return getDefaultToken !== null && getDefaultToken !== void 0 ? getDefaultToken : {};
}
/* harmony default export */ var util_getDefaultComponentToken = (getDefaultComponentToken);
;// ./node_modules/@ant-design/cssinjs-utils/es/util/maxmin.js
function genMaxMin(type) {
if (type === 'js') {
return {
max: Math.max,
min: Math.min
};
}
return {
max: function max() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return "max(".concat(args.map(function (value) {
return (0,cssinjs.unit)(value);
}).join(','), ")");
},
min: function min() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return "min(".concat(args.map(function (value) {
return (0,cssinjs.unit)(value);
}).join(','), ")");
}
};
}
/* harmony default export */ var maxmin = (genMaxMin);
;// ./node_modules/@ant-design/cssinjs-utils/es/_util/hooks/useUniqueMemo.js
var BEAT_LIMIT = 1000 * 60 * 10;
/**
* A helper class to map keys to values.
* It supports both primitive keys and object keys.
*/
var ArrayKeyMap = /*#__PURE__*/function () {
function ArrayKeyMap() {
(0,classCallCheck["default"])(this, ArrayKeyMap);
(0,defineProperty["default"])(this, "map", new Map());
// Use WeakMap to avoid memory leak
(0,defineProperty["default"])(this, "objectIDMap", new WeakMap());
(0,defineProperty["default"])(this, "nextID", 0);
(0,defineProperty["default"])(this, "lastAccessBeat", new Map());
// We will clean up the cache when reach the limit
(0,defineProperty["default"])(this, "accessBeat", 0);
}
(0,createClass["default"])(ArrayKeyMap, [{
key: "set",
value: function set(keys, value) {
// New set will trigger clear
this.clear();
// Set logic
var compositeKey = this.getCompositeKey(keys);
this.map.set(compositeKey, value);
this.lastAccessBeat.set(compositeKey, Date.now());
}
}, {
key: "get",
value: function get(keys) {
var compositeKey = this.getCompositeKey(keys);
var cache = this.map.get(compositeKey);
this.lastAccessBeat.set(compositeKey, Date.now());
this.accessBeat += 1;
return cache;
}
}, {
key: "getCompositeKey",
value: function getCompositeKey(keys) {
var _this = this;
var ids = keys.map(function (key) {
if (key && (0,esm_typeof["default"])(key) === 'object') {
return "obj_".concat(_this.getObjectID(key));
}
return "".concat((0,esm_typeof["default"])(key), "_").concat(key);
});
return ids.join('|');
}
}, {
key: "getObjectID",
value: function getObjectID(obj) {
if (this.objectIDMap.has(obj)) {
return this.objectIDMap.get(obj);
}
var id = this.nextID;
this.objectIDMap.set(obj, id);
this.nextID += 1;
return id;
}
}, {
key: "clear",
value: function clear() {
var _this2 = this;
if (this.accessBeat > 10000) {
var now = Date.now();
this.lastAccessBeat.forEach(function (beat, key) {
if (now - beat > BEAT_LIMIT) {
_this2.map.delete(key);
_this2.lastAccessBeat.delete(key);
}
});
this.accessBeat = 0;
}
}
}]);
return ArrayKeyMap;
}();
var uniqueMap = new ArrayKeyMap();
/**
* Like `useMemo`, but this hook result will be shared across all instances.
*/
function useUniqueMemo(memoFn, deps) {
return external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(function () {
var cachedValue = uniqueMap.get(deps);
if (cachedValue) {
return cachedValue;
}
var newValue = memoFn();
uniqueMap.set(deps, newValue);
return newValue;
}, deps);
}
/* harmony default export */ var hooks_useUniqueMemo = (useUniqueMemo);
;// ./node_modules/@ant-design/cssinjs-utils/es/hooks/useCSP.js
/**
* Provide a default hook since not everyone needs to config this.
*/
var useDefaultCSP = function useDefaultCSP() {
return {};
};
/* harmony default export */ var hooks_useCSP = (useDefaultCSP);
;// ./node_modules/@ant-design/cssinjs-utils/es/util/genStyleUtils.js
function genStyleUtils(config) {
// Dependency inversion for preparing basic config.
var _config$useCSP = config.useCSP,
useCSP = _config$useCSP === void 0 ? hooks_useCSP : _config$useCSP,
useToken = config.useToken,
usePrefix = config.usePrefix,
getResetStyles = config.getResetStyles,
getCommonStyle = config.getCommonStyle,
getCompUnitless = config.getCompUnitless;
function genStyleHooks(component, styleFn, getDefaultToken, options) {
var componentName = Array.isArray(component) ? component[0] : component;
function prefixToken(key) {
return "".concat(String(componentName)).concat(key.slice(0, 1).toUpperCase()).concat(key.slice(1));
}
// Fill unitless
var originUnitless = (options === null || options === void 0 ? void 0 : options.unitless) || {};
var originCompUnitless = typeof getCompUnitless === 'function' ? getCompUnitless(component) : {};
var compUnitless = (0,objectSpread2["default"])((0,objectSpread2["default"])({}, originCompUnitless), {}, (0,defineProperty["default"])({}, prefixToken('zIndexPopup'), true));
Object.keys(originUnitless).forEach(function (key) {
compUnitless[prefixToken(key)] = originUnitless[key];
});
// Options
var mergedOptions = (0,objectSpread2["default"])((0,objectSpread2["default"])({}, options), {}, {
unitless: compUnitless,
prefixToken: prefixToken
});
// Hooks
var useStyle = genComponentStyleHook(component, styleFn, getDefaultToken, mergedOptions);
var useCSSVar = genCSSVarRegister(componentName, getDefaultToken, mergedOptions);
return function (prefixCls) {
var rootCls = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : prefixCls;
var hashId = useStyle(prefixCls, rootCls);
// Resolve function type to get dynamic extra prefix
var extraPrefixCls = options === null || options === void 0 ? void 0 : options.extraCssVarPrefixCls;
var resolvedExtraPrefixCls = typeof extraPrefixCls === 'function' ? extraPrefixCls({
prefixCls: prefixCls,
rootCls: rootCls
}) : extraPrefixCls;
var cssVarCls = useCSSVar(resolvedExtraPrefixCls !== null && resolvedExtraPrefixCls !== void 0 && resolvedExtraPrefixCls.length ? [rootCls].concat((0,toConsumableArray["default"])(resolvedExtraPrefixCls)) : rootCls);
return [hashId, cssVarCls];
};
}
function genCSSVarRegister(component, getDefaultToken, options) {
var compUnitless = options.unitless,
prefixToken = options.prefixToken,
ignore = options.ignore;
return function (rootCls) {
var _useToken = useToken(),
cssVar = _useToken.cssVar,
realToken = _useToken.realToken;
var csp = useCSP();
(0,cssinjs.useCSSVarRegister)({
path: [component],
prefix: cssVar.prefix,
key: cssVar.key,
unitless: compUnitless,
ignore: ignore,
token: realToken,
scope: rootCls,
nonce: function nonce() {
return csp.nonce;
}
}, function () {
var defaultToken = util_getDefaultComponentToken(component, realToken, getDefaultToken);
var componentToken = util_getComponentToken(component, realToken, defaultToken, {
deprecatedTokens: options === null || options === void 0 ? void 0 : options.deprecatedTokens
});
if (defaultToken) {
Object.keys(defaultToken).forEach(function (key) {
componentToken[prefixToken(key)] = componentToken[key];
delete componentToken[key];
});
}
return componentToken;
});
return cssVar === null || cssVar === void 0 ? void 0 : cssVar.key;
};
}
function genComponentStyleHook(componentName, styleFn, getDefaultToken) {
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var cells = Array.isArray(componentName) ? componentName : [componentName, componentName];
var _cells = (0,slicedToArray["default"])(cells, 1),
component = _cells[0];
var concatComponent = cells.join('-');
var mergedLayer = config.layer || {
name: 'antd'
};
// Return new style hook
return function (prefixCls) {
var rootCls = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : prefixCls;
var _useToken2 = useToken(),
theme = _useToken2.theme,
realToken = _useToken2.realToken,
hashId = _useToken2.hashId,
token = _useToken2.token,
cssVar = _useToken2.cssVar,
zeroRuntime = _useToken2.zeroRuntime;
// Update of `disabledRuntimeStyle` would cause React hook error, so memoized it and never update.
var memoizedZeroRuntime = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
return zeroRuntime;
}, []);
if (memoizedZeroRuntime) {
return hashId;
}
var _usePrefix = usePrefix(),
rootPrefixCls = _usePrefix.rootPrefixCls,
iconPrefixCls = _usePrefix.iconPrefixCls;
var csp = useCSP();
var type = 'css';
// Use unique memo to share the result across all instances
var calc = hooks_useUniqueMemo(function () {
var unitlessCssVar = new Set();
Object.keys(options.unitless || {}).forEach(function (key) {
// Some component proxy the AliasToken (e.g. Image) and some not (e.g. Modal)
// We should both pass in `unitlessCssVar` to make sure the CSSVar can be unitless.
unitlessCssVar.add((0,cssinjs.token2CSSVar)(key, cssVar.prefix));
unitlessCssVar.add((0,cssinjs.token2CSSVar)(key, util_getCompVarPrefix(component, cssVar.prefix)));
});
return util_calc(type, unitlessCssVar);
}, [type, component, cssVar === null || cssVar === void 0 ? void 0 : cssVar.prefix]);
var _genMaxMin = maxmin(type),
max = _genMaxMin.max,
min = _genMaxMin.min;
// Shared config
var sharedConfig = {
theme: theme,
token: token,
hashId: hashId,
nonce: function nonce() {
return csp.nonce;
},
clientOnly: options.clientOnly,
layer: mergedLayer,
// antd is always at top of styles
order: options.order || -999
};
// This if statement is safe, as it will only be used if the generator has the function. It's not dynamic.
if (typeof getResetStyles === 'function') {
// Generate style for all need reset tags.
(0,cssinjs.useStyleRegister)((0,objectSpread2["default"])((0,objectSpread2["default"])({}, sharedConfig), {}, {
clientOnly: false,
path: ['Shared', rootPrefixCls]
}), function () {
return getResetStyles(token, {
prefix: {
rootPrefixCls: rootPrefixCls,
iconPrefixCls: iconPrefixCls
},
csp: csp
});
});
}
(0,cssinjs.useStyleRegister)((0,objectSpread2["default"])((0,objectSpread2["default"])({}, sharedConfig), {}, {
path: [concatComponent, prefixCls, iconPrefixCls]
}), function () {
if (options.injectStyle === false) {
return [];
}
var _statisticToken = util_statistic(token),
proxyToken = _statisticToken.token,
flush = _statisticToken.flush;
var defaultComponentToken = util_getDefaultComponentToken(component, realToken, getDefaultToken);
var componentCls = ".".concat(prefixCls);
var componentToken = util_getComponentToken(component, realToken, defaultComponentToken, {
deprecatedTokens: options.deprecatedTokens
});
if (defaultComponentToken && (0,esm_typeof["default"])(defaultComponentToken) === 'object') {
Object.keys(defaultComponentToken).forEach(function (key) {
defaultComponentToken[key] = "var(".concat((0,cssinjs.token2CSSVar)(key, util_getCompVarPrefix(component, cssVar.prefix)), ")");
});
}
var mergedToken = merge(proxyToken, {
componentCls: componentCls,
prefixCls: prefixCls,
iconCls: ".".concat(iconPrefixCls),
antCls: ".".concat(rootPrefixCls),
calc: calc,
max: max,
min: min
}, defaultComponentToken);
var styleInterpolation = styleFn(mergedToken, {
hashId: hashId,
prefixCls: prefixCls,
rootPrefixCls: rootPrefixCls,
iconPrefixCls: iconPrefixCls
});
flush(component, componentToken);
var commonStyle = typeof getCommonStyle === 'function' ? getCommonStyle(mergedToken, prefixCls, rootCls, options.resetFont) : null;
return [options.resetStyle === false ? null : commonStyle, styleInterpolation];
});
return hashId;
};
}
function genSubStyleComponent(componentName, styleFn, getDefaultToken) {
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var useStyle = genComponentStyleHook(componentName, styleFn, getDefaultToken, (0,objectSpread2["default"])({
resetStyle: false,
// Sub Style should default after root one
order: -998
}, options));
var StyledComponent = function StyledComponent(_ref) {
var prefixCls = _ref.prefixCls,
_ref$rootCls = _ref.rootCls,
rootCls = _ref$rootCls === void 0 ? prefixCls : _ref$rootCls;
useStyle(prefixCls, rootCls);
return null;
};
if (true) {
StyledComponent.displayName = "SubStyle_".concat(String(Array.isArray(componentName) ? componentName.join('.') : componentName));
}
return StyledComponent;
}
return {
genStyleHooks: genStyleHooks,
genSubStyleComponent: genSubStyleComponent,
genComponentStyleHook: genComponentStyleHook
};
}
/* harmony default export */ var util_genStyleUtils = (genStyleUtils);
;// ./node_modules/@ant-design/cssinjs-utils/es/index.js
/***/ }),
/***/ "./node_modules/@ant-design/cssinjs/es/hooks/useHMR.js":
/*!*************************************************************!*\
!*** ./node_modules/@ant-design/cssinjs/es/hooks/useHMR.js ***!
\*************************************************************/
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* module decorator */ module = __webpack_require__.hmd(module);
function useProdHMR() {
return false;
}
let webpackHMR = false;
function useDevHMR() {
return webpackHMR;
}
/* harmony default export */ __webpack_exports__["default"] = ( false ? 0 : useDevHMR);
// Webpack `module.hot.accept` do not support any deps update trigger
// We have to hack handler to force mark as HRM
if ( true && module && module.hot && 0) // removed by dead control flow
{}
/***/ }),
/***/ "./node_modules/@ant-design/cssinjs/es/index.js":
/*!*******************************************************************!*\
!*** ./node_modules/@ant-design/cssinjs/es/index.js + 39 modules ***!
\*******************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Keyframes: function() { return /* reexport */ Keyframes; },
NaNLinter: function() { return /* reexport */ NaNLinter; },
StyleContext: function() { return /* reexport */ es_StyleContext; },
StyleProvider: function() { return /* reexport */ StyleProvider; },
Theme: function() { return /* reexport */ Theme; },
_experimental: function() { return /* binding */ _experimental; },
autoPrefixTransformer: function() { return /* reexport */ autoPrefix; },
createCache: function() { return /* reexport */ createCache; },
createTheme: function() { return /* reexport */ createTheme; },
extractStyle: function() { return /* reexport */ extractStyle; },
genCalc: function() { return /* reexport */ calc; },
getComputedToken: function() { return /* reexport */ getComputedToken; },
legacyLogicalPropertiesTransformer: function() { return /* reexport */ legacyLogicalProperties; },
legacyNotSelectorLinter: function() { return /* reexport */ legacyNotSelectorLinter; },
logicalPropertiesLinter: function() { return /* reexport */ logicalPropertiesLinter; },
parentSelectorLinter: function() { return /* reexport */ parentSelectorLinter; },
px2remTransformer: function() { return /* reexport */ px2rem; },
token2CSSVar: function() { return /* reexport */ token2CSSVar; },
unit: function() { return /* reexport */ util_unit; },
useCSSVarRegister: function() { return /* reexport */ hooks_useCSSVarRegister; },
useCacheToken: function() { return /* reexport */ useCacheToken; },
useStyleRegister: function() { return /* reexport */ useStyleRegister; }
});
;// ./node_modules/@emotion/hash/dist/hash.browser.esm.js
/* 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);
}
/* harmony default export */ var hash_browser_esm = (murmur2);
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/Dom/dynamicCSS.js
var dynamicCSS = __webpack_require__("./node_modules/@rc-component/util/es/Dom/dynamicCSS.js");
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__("react");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/hooks/useMemo.js
var useMemo = __webpack_require__("./node_modules/@rc-component/util/es/hooks/useMemo.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/isEqual.js
var isEqual = __webpack_require__("./node_modules/@rc-component/util/es/isEqual.js");
;// ./node_modules/@ant-design/cssinjs/es/Cache.js
// [times, realValue]
const SPLIT = '%';
/** Connect key with `SPLIT` */
function pathKey(keys) {
return keys.join(SPLIT);
}
/** Record update id for extract static style order. */
let updateId = 0;
class Entity {
instanceId;
constructor(instanceId) {
this.instanceId = instanceId;
}
/** @private Internal cache map. Do not access this directly */
cache = new Map();
/** @private Record update times for each key */
updateTimes = new Map();
extracted = new Set();
get(keys) {
return this.opGet(pathKey(keys));
}
/** A fast get cache with `get` concat. */
opGet(keyPathStr) {
return this.cache.get(keyPathStr) || null;
}
update(keys, valueFn) {
return this.opUpdate(pathKey(keys), valueFn);
}
/** A fast get cache with `get` concat. */
opUpdate(keyPathStr, valueFn) {
const prevValue = this.cache.get(keyPathStr);
const nextValue = valueFn(prevValue);
if (nextValue === null) {
this.cache.delete(keyPathStr);
this.updateTimes.delete(keyPathStr);
} else {
this.cache.set(keyPathStr, nextValue);
this.updateTimes.set(keyPathStr, updateId);
updateId += 1;
}
}
}
/* harmony default export */ var Cache = (Entity);
;// ./node_modules/@ant-design/cssinjs/es/transformers/autoPrefix.js
const AUTO_PREFIX = {};
const transform = AUTO_PREFIX;
/* harmony default export */ var autoPrefix = (transform);
;// ./node_modules/@ant-design/cssinjs/es/StyleContext.js
const ATTR_TOKEN = 'data-token-hash';
const ATTR_MARK = 'data-css-hash';
const ATTR_CACHE_PATH = 'data-cache-path';
// Mark css-in-js instance in style element
const CSS_IN_JS_INSTANCE = '__cssinjs_instance__';
function createCache() {
const cssinjsInstanceId = Math.random().toString(12).slice(2);
// Tricky SSR: Move all inline style to the head.
// PS: We do not recommend tricky mode.
if (typeof document !== 'undefined' && document.head && document.body) {
const styles = document.body.querySelectorAll(`style[${ATTR_MARK}]`) || [];
const {
firstChild
} = document.head;
Array.from(styles).forEach(style => {
style[CSS_IN_JS_INSTANCE] ||= cssinjsInstanceId;
// Not force move if no head
if (style[CSS_IN_JS_INSTANCE] === cssinjsInstanceId) {
document.head.insertBefore(style, firstChild);
}
});
// Deduplicate of moved styles
const styleHash = {};
Array.from(document.querySelectorAll(`style[${ATTR_MARK}]`)).forEach(style => {
const hash = style.getAttribute(ATTR_MARK);
if (styleHash[hash]) {
if (style[CSS_IN_JS_INSTANCE] === cssinjsInstanceId) {
style.parentNode?.removeChild(style);
}
} else {
styleHash[hash] = true;
}
});
}
return new Cache(cssinjsInstanceId);
}
const StyleContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({
hashPriority: 'low',
cache: createCache(),
defaultCache: true,
autoPrefix: false
});
const StyleProvider = props => {
const {
children,
...restProps
} = props;
const parentContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(StyleContext);
const context = (0,useMemo["default"])(() => {
const mergedContext = {
...parentContext
};
Object.keys(restProps).forEach(key => {
const value = restProps[key];
if (restProps[key] !== undefined) {
mergedContext[key] = value;
}
});
const {
cache,
transformers = []
} = restProps;
mergedContext.cache = mergedContext.cache || createCache();
mergedContext.defaultCache = !cache && parentContext.defaultCache;
// autoPrefix
if (transformers.includes(AUTO_PREFIX)) {
mergedContext.autoPrefix = true;
}
return mergedContext;
}, [parentContext, restProps], (prev, next) => !(0,isEqual["default"])(prev[0], next[0], true) || !(0,isEqual["default"])(prev[1], next[1], true));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(StyleContext.Provider, {
value: context
}, children);
};
/* harmony default export */ var es_StyleContext = (StyleContext);
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/Dom/canUseDom.js
var canUseDom = __webpack_require__("./node_modules/@rc-component/util/es/Dom/canUseDom.js");
;// ./node_modules/@ant-design/cssinjs/es/theme/calc/calculator.js
class AbstractCalculator {}
/* harmony default export */ var calculator = (AbstractCalculator);
;// ./node_modules/@ant-design/cssinjs/es/theme/calc/CSSCalculator.js
const CALC_UNIT = 'CALC_UNIT';
const regexp = new RegExp(CALC_UNIT, 'g');
function unit(value) {
if (typeof value === 'number') {
return `${value}${CALC_UNIT}`;
}
return value;
}
class CSSCalculator extends calculator {
result = '';
unitlessCssVar;
lowPriority;
constructor(num, unitlessCssVar) {
super();
const numType = typeof num;
this.unitlessCssVar = unitlessCssVar;
if (num instanceof CSSCalculator) {
this.result = `(${num.result})`;
} else if (numType === 'number') {
this.result = unit(num);
} else if (numType === 'string') {
this.result = num;
}
}
add(num) {
if (num instanceof CSSCalculator) {
this.result = `${this.result} + ${num.getResult()}`;
} else if (typeof num === 'number' || typeof num === 'string') {
this.result = `${this.result} + ${unit(num)}`;
}
this.lowPriority = true;
return this;
}
sub(num) {
if (num instanceof CSSCalculator) {
this.result = `${this.result} - ${num.getResult()}`;
} else if (typeof num === 'number' || typeof num === 'string') {
this.result = `${this.result} - ${unit(num)}`;
}
this.lowPriority = true;
return this;
}
mul(num) {
if (this.lowPriority) {
this.result = `(${this.result})`;
}
if (num instanceof CSSCalculator) {
this.result = `${this.result} * ${num.getResult(true)}`;
} else if (typeof num === 'number' || typeof num === 'string') {
this.result = `${this.result} * ${num}`;
}
this.lowPriority = false;
return this;
}
div(num) {
if (this.lowPriority) {
this.result = `(${this.result})`;
}
if (num instanceof CSSCalculator) {
this.result = `${this.result} / ${num.getResult(true)}`;
} else if (typeof num === 'number' || typeof num === 'string') {
this.result = `${this.result} / ${num}`;
}
this.lowPriority = false;
return this;
}
getResult(force) {
return this.lowPriority || force ? `(${this.result})` : this.result;
}
equal(options) {
const {
unit: cssUnit
} = options || {};
let mergedUnit = true;
if (typeof cssUnit === 'boolean') {
mergedUnit = cssUnit;
} else if (Array.from(this.unitlessCssVar).some(cssVar => this.result.includes(cssVar))) {
mergedUnit = false;
}
this.result = this.result.replace(regexp, mergedUnit ? 'px' : '');
if (typeof this.lowPriority !== 'undefined') {
return `calc(${this.result})`;
}
return this.result;
}
}
;// ./node_modules/@ant-design/cssinjs/es/theme/calc/NumCalculator.js
class NumCalculator extends calculator {
result = 0;
constructor(num) {
super();
if (num instanceof NumCalculator) {
this.result = num.result;
} else if (typeof num === 'number') {
this.result = num;
}
}
add(num) {
if (num instanceof NumCalculator) {
this.result += num.result;
} else if (typeof num === 'number') {
this.result += num;
}
return this;
}
sub(num) {
if (num instanceof NumCalculator) {
this.result -= num.result;
} else if (typeof num === 'number') {
this.result -= num;
}
return this;
}
mul(num) {
if (num instanceof NumCalculator) {
this.result *= num.result;
} else if (typeof num === 'number') {
this.result *= num;
}
return this;
}
div(num) {
if (num instanceof NumCalculator) {
this.result /= num.result;
} else if (typeof num === 'number') {
this.result /= num;
}
return this;
}
equal() {
return this.result;
}
}
;// ./node_modules/@ant-design/cssinjs/es/theme/calc/index.js
const genCalc = (type, unitlessCssVar) => {
const Calculator = type === 'css' ? CSSCalculator : NumCalculator;
return num => new Calculator(num, unitlessCssVar);
};
/* harmony default export */ var calc = (genCalc);
;// ./node_modules/@ant-design/cssinjs/es/theme/ThemeCache.js
// ================================== Cache ==================================
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 {
static MAX_CACHE_SIZE = 20;
static MAX_CACHE_OFFSET = 5;
cache;
keys;
cacheCallTimes;
constructor() {
this.cache = new Map();
this.keys = [];
this.cacheCallTimes = 0;
}
size() {
return this.keys.length;
}
internalGet(derivativeOption, updateCallTimes = false) {
let cache = {
map: this.cache
};
derivativeOption.forEach(derivative => {
if (!cache) {
cache = undefined;
} else {
cache = cache?.map?.get(derivative);
}
});
if (cache?.value && updateCallTimes) {
cache.value[1] = this.cacheCallTimes++;
}
return cache?.value;
}
get(derivativeOption) {
return this.internalGet(derivativeOption, true)?.[0];
}
has(derivativeOption) {
return !!this.internalGet(derivativeOption);
}
set(derivativeOption, value) {
// New cache
if (!this.has(derivativeOption)) {
if (this.size() + 1 > ThemeCache.MAX_CACHE_SIZE + ThemeCache.MAX_CACHE_OFFSET) {
const [targetKey] = this.keys.reduce((result, key) => {
const [, callTimes] = result;
if (this.internalGet(key)[1] < callTimes) {
return [key, this.internalGet(key)[1]];
}
return result;
}, [this.keys[0], this.cacheCallTimes]);
this.delete(targetKey);
}
this.keys.push(derivativeOption);
}
let cache = this.cache;
derivativeOption.forEach((derivative, index) => {
if (index === derivativeOption.length - 1) {
cache.set(derivative, {
value: [value, this.cacheCallTimes++]
});
} else {
const cacheValue = cache.get(derivative);
if (!cacheValue) {
cache.set(derivative, {
map: new Map()
});
} else if (!cacheValue.map) {
cacheValue.map = new Map();
}
cache = cache.get(derivative).map;
}
});
}
deleteByPath(currentCache, derivatives) {
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 cache.value?.[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 cache exists
if (this.has(derivativeOption)) {
this.keys = this.keys.filter(item => !sameDerivativeOption(item, derivativeOption));
return this.deleteByPath(this.cache, derivativeOption);
}
return undefined;
}
}
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/warning.js
var warning = __webpack_require__("./node_modules/@rc-component/util/es/warning.js");
;// ./node_modules/@ant-design/cssinjs/es/theme/Theme.js
let uuid = 0;
/**
* Theme with algorithms to derive tokens from design tokens.
* Use `createTheme` first which will help to manage the theme instance cache.
*/
class Theme {
derivatives;
id;
constructor(derivatives) {
this.derivatives = Array.isArray(derivatives) ? derivatives : [derivatives];
this.id = uuid;
if (derivatives.length === 0) {
(0,warning.warning)(derivatives.length > 0, '[Ant Design CSS-in-JS] Theme should have at least one derivative function.');
}
uuid += 1;
}
getDerivativeToken(token) {
return this.derivatives.reduce((result, derivative) => derivative(token, result), undefined);
}
}
;// ./node_modules/@ant-design/cssinjs/es/theme/createTheme.js
const cacheThemes = new ThemeCache();
/**
* Same as new Theme, but will always return same one if `derivative` not changed.
*/
function createTheme(derivatives) {
const derivativeArr = Array.isArray(derivatives) ? derivatives : [derivatives];
// Create new theme if not exist
if (!cacheThemes.has(derivativeArr)) {
cacheThemes.set(derivativeArr, new Theme(derivativeArr));
}
// Get theme from cache and return
return cacheThemes.get(derivativeArr);
}
;// ./node_modules/@ant-design/cssinjs/es/theme/index.js
;// ./node_modules/@ant-design/cssinjs/es/util/index.js
// Create a cache for memo concat
const resultCache = new WeakMap();
const RESULT_VALUE = {};
function memoResult(callback, deps) {
let current = resultCache;
for (let i = 0; i < deps.length; i += 1) {
const dep = deps[i];
if (!current.has(dep)) {
current.set(dep, new WeakMap());
}
current = current.get(dep);
}
if (!current.has(RESULT_VALUE)) {
current.set(RESULT_VALUE, callback());
}
return current.get(RESULT_VALUE);
}
// Create a cache here to avoid always loop generate
const flattenTokenCache = new WeakMap();
/**
* Flatten token to string, this will auto cache the result when token not change
*/
function flattenToken(token) {
let str = flattenTokenCache.get(token) || '';
if (!str) {
Object.keys(token).forEach(key => {
const value = token[key];
str += key;
if (value instanceof Theme) {
str += value.id;
} else if (value && typeof value === 'object') {
str += flattenToken(value);
} else {
str += value;
}
});
// https://github.com/ant-design/ant-design/issues/48386
// Should hash the string to avoid style tag name too long
str = hash_browser_esm(str);
// Put in cache
flattenTokenCache.set(token, str);
}
return str;
}
/**
* Convert derivative token to key string
*/
function token2key(token, salt) {
return hash_browser_esm(`${salt}_${flattenToken(token)}`);
}
const randomSelectorKey = `random-${Date.now()}-${Math.random()}`.replace(/\./g, '');
// Magic `content` for detect selector support
const checkContent = '_bAmBoO_';
function supportSelector(styleStr, handleElement, supportCheck) {
if ((0,canUseDom["default"])()) {
(0,dynamicCSS.updateCSS)(styleStr, randomSelectorKey);
const ele = document.createElement('div');
ele.style.position = 'fixed';
ele.style.left = '0';
ele.style.top = '0';
handleElement?.(ele);
document.body.appendChild(ele);
if (true) {
ele.innerHTML = 'Test';
ele.style.zIndex = '9999999';
}
const support = supportCheck ? supportCheck(ele) : getComputedStyle(ele).content?.includes(checkContent);
ele.parentNode?.removeChild(ele);
(0,dynamicCSS.removeCSS)(randomSelectorKey);
return support;
}
return false;
}
let canLayer = undefined;
function supportLayer() {
if (canLayer === undefined) {
canLayer = supportSelector(`@layer ${randomSelectorKey} { .${randomSelectorKey} { content: "${checkContent}"!important; } }`, ele => {
ele.className = randomSelectorKey;
});
}
return canLayer;
}
let canWhere = undefined;
function supportWhere() {
if (canWhere === undefined) {
canWhere = supportSelector(`:where(.${randomSelectorKey}) { content: "${checkContent}"!important; }`, ele => {
ele.className = randomSelectorKey;
});
}
return canWhere;
}
let canLogic = undefined;
function supportLogicProps() {
if (canLogic === undefined) {
canLogic = supportSelector(`.${randomSelectorKey} { inset-block: 93px !important; }`, ele => {
ele.className = randomSelectorKey;
}, ele => getComputedStyle(ele).bottom === '93px');
}
return canLogic;
}
const isClientSide = (0,canUseDom["default"])();
function util_unit(num) {
if (typeof num === 'number') {
return `${num}px`;
}
return num;
}
function toStyleStr(style, tokenKey, styleId, customizeAttrs = {}, plain = false) {
if (plain) {
return style;
}
const attrs = {
...customizeAttrs,
[ATTR_TOKEN]: tokenKey,
[ATTR_MARK]: styleId
};
const attrStr = Object.keys(attrs).map(attr => {
const val = attrs[attr];
return val ? `${attr}="${val}"` : null;
}).filter(v => v).join(' ');
return ``;
}
function where(options) {
const {
hashCls,
hashPriority = 'low'
} = options || {};
if (!hashCls) {
return '';
}
const hashSelector = `.${hashCls}`;
return hashPriority === 'low' ? `:where(${hashSelector})` : hashSelector;
}
const isNonNullable = val => {
return val !== undefined && val !== null;
};
/**
* Get nonce value and inject it into CSS config if available.
*/
function injectCSPNonce(config, nonce) {
const nonceStr = typeof nonce === 'function' ? nonce() : nonce;
if (nonceStr) {
return {
...config,
csp: {
...config.csp,
nonce: nonceStr
}
};
}
return config;
}
;// ./node_modules/@ant-design/cssinjs/es/util/css-variables.js
const token2CSSVar = (token, prefix = '') => {
return `--${prefix ? `${prefix}-` : ''}${token}`.replace(/([a-z0-9])([A-Z])/g, '$1-$2').replace(/([A-Z]+)([A-Z][a-z0-9]+)/g, '$1-$2').replace(/([a-z])([A-Z0-9])/g, '$1-$2').toLowerCase();
};
const serializeCSSVar = (cssVars, hashId, options) => {
const {
hashCls,
hashPriority = 'low',
scope
} = options || {};
if (!Object.keys(cssVars).length) {
return '';
}
const baseSelector = `${where({
hashCls,
hashPriority
})}.${hashId}`;
const scopes = [scope].flat().filter(Boolean);
const selector = scopes.length ? scopes.map(s => `${baseSelector}.${s}`).join(', ') : baseSelector;
return `${selector}{${Object.entries(cssVars).map(([key, value]) => `${key}:${value};`).join('')}}`;
};
const transformToken = (token, themeKey, config) => {
const {
hashCls,
hashPriority = 'low',
prefix,
unitless,
ignore,
preserve
} = config || {};
const cssVars = {};
const result = {};
Object.entries(token).forEach(([key, value]) => {
if (preserve?.[key]) {
result[key] = value;
} else if ((typeof value === 'string' || typeof value === 'number') && !ignore?.[key]) {
const cssVar = token2CSSVar(key, prefix);
cssVars[cssVar] = typeof value === 'number' && !unitless?.[key] ? `${value}px` : String(value);
result[key] = `var(${cssVar})`;
}
});
return [result, serializeCSSVar(cssVars, themeKey, {
scope: config?.scope,
hashCls,
hashPriority
})];
};
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs/es/hooks/useHMR.js
var useHMR = __webpack_require__("./node_modules/@ant-design/cssinjs/es/hooks/useHMR.js");
;// ./node_modules/@ant-design/cssinjs/es/hooks/useGlobalCache.js
const effectMap = new Map();
function useGlobalCache(prefix, keyPath, cacheFn, onCacheRemove,
// Add additional effect trigger by `useInsertionEffect`
onCacheEffect) {
const {
cache: globalCache
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(es_StyleContext);
const fullPath = [prefix, ...keyPath];
const fullPathStr = pathKey(fullPath);
const HMRUpdate = (0,useHMR["default"])();
const buildCache = updater => {
globalCache.opUpdate(fullPathStr, prevCache => {
const [times = 0, cache] = prevCache || [undefined, undefined];
// HMR should always ignore cache since developer may change it
let tmpCache = cache;
if ( true && cache && HMRUpdate) {
onCacheRemove?.(tmpCache, HMRUpdate);
tmpCache = null;
}
const mergedCache = tmpCache || cacheFn();
const data = [times, mergedCache];
// Call updater if need additional logic
return updater ? updater(data) : data;
});
};
// Create cache
external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
buildCache();
}, /* eslint-disable react-hooks/exhaustive-deps */
[fullPathStr]
/* eslint-enable */);
let cacheEntity = globalCache.opGet(fullPathStr);
// HMR clean the cache but not trigger `useMemo` again
// Let's fallback of this
// ref https://github.com/ant-design/cssinjs/issues/127
if ( true && !cacheEntity) {
buildCache();
cacheEntity = globalCache.opGet(fullPathStr);
}
const cacheContent = cacheEntity[1];
// Remove if no need anymore
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useInsertionEffect)(() => {
buildCache(([times, cache]) => [times + 1, cache]);
if (!effectMap.has(fullPathStr)) {
onCacheEffect?.(cacheContent);
effectMap.set(fullPathStr, true);
// 微任务清理缓存,可以认为是单次 batch render 中只触发一次 effect
Promise.resolve().then(() => {
effectMap.delete(fullPathStr);
});
}
return () => {
globalCache.opUpdate(fullPathStr, prevCache => {
const [times = 0, cache] = prevCache || [];
const nextCount = times - 1;
if (nextCount === 0) {
onCacheRemove?.(cache, false);
effectMap.delete(fullPathStr);
return null;
}
return [times - 1, cache];
});
};
}, [fullPathStr]);
return cacheContent;
}
;// ./node_modules/@ant-design/cssinjs/es/hooks/useCacheToken.js
const EMPTY_OVERRIDE = {};
// Generate different prefix to make user selector break in production env.
// This helps developer not to do style override directly on the hash id.
const hashPrefix = true ? 'css-dev-only-do-not-override' : 0;
const tokenKeys = new Map();
function recordCleanToken(tokenKey) {
tokenKeys.set(tokenKey, (tokenKeys.get(tokenKey) || 0) + 1);
}
function removeStyleTags(key, instanceId) {
if (typeof document !== 'undefined') {
const styles = document.querySelectorAll(`style[${ATTR_TOKEN}="${key}"]`);
styles.forEach(style => {
if (style[CSS_IN_JS_INSTANCE] === instanceId) {
style.parentNode?.removeChild(style);
}
});
}
}
const TOKEN_THRESHOLD = -1;
// Remove will check current keys first
function cleanTokenStyle(tokenKey, instanceId) {
tokenKeys.set(tokenKey, (tokenKeys.get(tokenKey) || 0) - 1);
const cleanableKeyList = new Set();
tokenKeys.forEach((value, key) => {
if (value <= 0) cleanableKeyList.add(key);
});
// Should keep tokens under threshold for not to insert style too often
if (tokenKeys.size - cleanableKeyList.size > TOKEN_THRESHOLD) {
cleanableKeyList.forEach(key => {
removeStyleTags(key, instanceId);
tokenKeys.delete(key);
});
}
}
const getComputedToken = (originToken, overrideToken, theme, format) => {
const derivativeToken = theme.getDerivativeToken(originToken);
// Merge with override
let mergedDerivativeToken = {
...derivativeToken,
...overrideToken
};
// Format if needed
if (format) {
mergedDerivativeToken = format(mergedDerivativeToken);
}
return mergedDerivativeToken;
};
const TOKEN_PREFIX = 'token';
/**
* Cache theme derivative token as global shared one
* @param theme Theme entity
* @param tokens List of tokens, used for cache. Please do not dynamic generate object directly
* @param option Additional config
* @returns Call Theme.getDerivativeToken(tokenObject) to get token
*/
function useCacheToken(theme, tokens, option) {
const {
cache: {
instanceId
},
container,
hashPriority
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(es_StyleContext);
const {
salt = '',
override = EMPTY_OVERRIDE,
formatToken,
getComputedToken: compute,
cssVar,
nonce
} = option;
// Basic - We do basic cache here
const mergedToken = memoResult(() => Object.assign({}, ...tokens), tokens);
const tokenStr = flattenToken(mergedToken);
const overrideTokenStr = flattenToken(override);
const cssVarStr = flattenToken(cssVar);
const cachedToken = useGlobalCache(TOKEN_PREFIX, [salt, theme.id, tokenStr, overrideTokenStr, cssVarStr], () => {
const mergedDerivativeToken = compute ? compute(mergedToken, override, theme) : getComputedToken(mergedToken, override, theme, formatToken);
const actualToken = {
...mergedDerivativeToken
};
// Optimize for `useStyleRegister` performance
const mergedSalt = `${salt}_${cssVar.prefix}`;
const hashId = hash_browser_esm(mergedSalt);
const hashCls = `${hashPrefix}-${hashId}`;
actualToken._tokenKey = token2key(actualToken, mergedSalt);
// Replace token value with css variables
const [tokenWithCssVar, cssVarsStr] = transformToken(mergedDerivativeToken, cssVar.key, {
prefix: cssVar.prefix,
ignore: cssVar.ignore,
unitless: cssVar.unitless,
preserve: cssVar.preserve,
hashPriority,
hashCls: cssVar.hashed ? hashCls : undefined
});
tokenWithCssVar._hashId = hashId;
recordCleanToken(cssVar.key);
return [tokenWithCssVar, hashCls, actualToken, cssVarsStr, cssVar.key];
}, ([,,,, themeKey]) => {
// Remove token will remove all related style
cleanTokenStyle(themeKey, instanceId);
}, ([,,, cssVarsStr, themeKey]) => {
if (!cssVarsStr) {
return;
}
let mergedCSSConfig = {
mark: ATTR_MARK,
prepend: 'queue',
attachTo: container,
priority: -999
};
mergedCSSConfig = injectCSPNonce(mergedCSSConfig, nonce);
const style = (0,dynamicCSS.updateCSS)(cssVarsStr, hash_browser_esm(`css-var-${themeKey}`), mergedCSSConfig);
style[CSS_IN_JS_INSTANCE] = instanceId;
// Used for `useCacheToken` to remove on batch when token removed
style.setAttribute(ATTR_TOKEN, themeKey);
});
return cachedToken;
}
const extract = (cache, effectStyles, options) => {
const [,, realToken, styleStr, cssVarKey] = cache;
const {
plain
} = options || {};
if (!styleStr) {
return null;
}
const styleId = realToken._tokenKey;
const order = -999;
// ====================== Style ======================
// Used for @rc-component/util
const sharedAttrs = {
'data-rc-order': 'prependQueue',
'data-rc-priority': `${order}`
};
const styleText = toStyleStr(styleStr, cssVarKey, styleId, sharedAttrs, plain);
return [order, styleId, styleText];
};
;// ./node_modules/@emotion/unitless/dist/unitless.browser.esm.js
var unitlessKeys = {
animationIterationCount: 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
};
/* harmony default export */ var unitless_browser_esm = (unitlessKeys);
;// ./node_modules/stylis/src/Enum.js
var MS = '-ms-'
var MOZ = '-moz-'
var WEBKIT = '-webkit-'
var COMMENT = 'comm'
var RULESET = 'rule'
var DECLARATION = 'decl'
var PAGE = '@page'
var MEDIA = '@media'
var IMPORT = '@import'
var CHARSET = '@charset'
var VIEWPORT = '@viewport'
var SUPPORTS = '@supports'
var DOCUMENT = '@document'
var NAMESPACE = '@namespace'
var KEYFRAMES = '@keyframes'
var FONT_FACE = '@font-face'
var COUNTER_STYLE = '@counter-style'
var FONT_FEATURE_VALUES = '@font-feature-values'
var LAYER = '@layer'
var SCOPE = '@scope'
;// ./node_modules/stylis/src/Utility.js
/**
* @param {number}
* @return {number}
*/
var abs = Math.abs
/**
* @param {number}
* @return {string}
*/
var from = String.fromCharCode
/**
* @param {object}
* @return {object}
*/
var Utility_assign = Object.assign
/**
* @param {string} value
* @param {number} length
* @return {number}
*/
function hash (value, length) {
return charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0
}
/**
* @param {string} value
* @return {string}
*/
function trim (value) {
return value.trim()
}
/**
* @param {string} value
* @param {RegExp} pattern
* @return {string?}
*/
function match (value, pattern) {
return (value = pattern.exec(value)) ? value[0] : value
}
/**
* @param {string} value
* @param {(string|RegExp)} pattern
* @param {string} replacement
* @return {string}
*/
function replace (value, pattern, replacement) {
return value.replace(pattern, replacement)
}
/**
* @param {string} value
* @param {string} search
* @return {number}
*/
function indexof (value, search) {
return value.indexOf(search)
}
/**
* @param {string} value
* @param {number} index
* @return {number}
*/
function charat (value, index) {
return value.charCodeAt(index) | 0
}
/**
* @param {string} value
* @param {number} begin
* @param {number} end
* @return {string}
*/
function substr (value, begin, end) {
return value.slice(begin, end)
}
/**
* @param {string} value
* @return {number}
*/
function strlen (value) {
return value.length
}
/**
* @param {any[]} value
* @return {number}
*/
function sizeof (value) {
return value.length
}
/**
* @param {any} value
* @param {any[]} array
* @return {any}
*/
function append (value, array) {
return array.push(value), value
}
/**
* @param {string[]} array
* @param {function} callback
* @return {string}
*/
function combine (array, callback) {
return array.map(callback).join('')
}
/**
* @param {string[]} array
* @param {RegExp} pattern
* @return {string[]}
*/
function filter (array, pattern) {
return array.filter(function (value) { return !match(value, pattern) })
}
;// ./node_modules/stylis/src/Serializer.js
/**
* @param {object[]} children
* @param {function} callback
* @return {string}
*/
function serialize (children, callback) {
var output = ''
for (var i = 0; i < children.length; i++)
output += callback(children[i], i, children, callback) || ''
return output
}
/**
* @param {object} element
* @param {number} index
* @param {object[]} children
* @param {function} callback
* @return {string}
*/
function stringify (element, index, children, callback) {
switch (element.type) {
case LAYER: if (element.children.length) break
case IMPORT: case NAMESPACE: case DECLARATION: return element.return = element.return || element.value
case COMMENT: return ''
case KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'
case RULESET: if (!strlen(element.value = element.props.join(','))) return ''
}
return strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''
}
;// ./node_modules/stylis/src/Tokenizer.js
var line = 1
var column = 1
var Tokenizer_length = 0
var position = 0
var character = 0
var characters = ''
/**
* @param {string} value
* @param {object | null} root
* @param {object | null} parent
* @param {string} type
* @param {string[] | string} props
* @param {object[] | string} children
* @param {object[]} siblings
* @param {number} length
*/
function node (value, root, parent, type, props, children, length, siblings) {
return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: '', siblings: siblings}
}
/**
* @param {object} root
* @param {object} props
* @return {object}
*/
function copy (root, props) {
return Utility_assign(node('', null, null, '', null, null, 0, root.siblings), root, {length: -root.length}, props)
}
/**
* @param {object} root
*/
function lift (root) {
while (root.root)
root = copy(root.root, {children: [root]})
append(root, root.siblings)
}
/**
* @return {number}
*/
function Tokenizer_char () {
return character
}
/**
* @return {number}
*/
function prev () {
character = position > 0 ? charat(characters, --position) : 0
if (column--, character === 10)
column = 1, line--
return character
}
/**
* @return {number}
*/
function next () {
character = position < Tokenizer_length ? charat(characters, position++) : 0
if (column++, character === 10)
column = 1, line++
return character
}
/**
* @return {number}
*/
function peek () {
return charat(characters, position)
}
/**
* @return {number}
*/
function caret () {
return position
}
/**
* @param {number} begin
* @param {number} end
* @return {string}
*/
function slice (begin, end) {
return substr(characters, begin, end)
}
/**
* @param {number} type
* @return {number}
*/
function token (type) {
switch (type) {
// \0 \t \n \r \s whitespace token
case 0: case 9: case 10: case 13: case 32:
return 5
// ! + , / > @ ~ isolate token
case 33: case 43: case 44: case 47: case 62: case 64: case 126:
// ; { } breakpoint token
case 59: case 123: case 125:
return 4
// : accompanied token
case 58:
return 3
// " ' ( [ opening delimit token
case 34: case 39: case 40: case 91:
return 2
// ) ] closing delimit token
case 41: case 93:
return 1
}
return 0
}
/**
* @param {string} value
* @return {any[]}
*/
function alloc (value) {
return line = column = 1, Tokenizer_length = strlen(characters = value), position = 0, []
}
/**
* @param {any} value
* @return {any}
*/
function dealloc (value) {
return characters = '', value
}
/**
* @param {number} type
* @return {string}
*/
function delimit (type) {
return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))
}
/**
* @param {string} value
* @return {string[]}
*/
function tokenize (value) {
return dealloc(tokenizer(alloc(value)))
}
/**
* @param {number} type
* @return {string}
*/
function whitespace (type) {
while (character = peek())
if (character < 33)
next()
else
break
return token(type) > 2 || token(character) > 3 ? '' : ' '
}
/**
* @param {string[]} children
* @return {string[]}
*/
function tokenizer (children) {
while (next())
switch (token(character)) {
case 0: append(identifier(position - 1), children)
break
case 2: append(delimit(character), children)
break
default: append(from(character), children)
}
return children
}
/**
* @param {number} index
* @param {number} count
* @return {string}
*/
function escaping (index, count) {
while (--count && next())
// not 0-9 A-F a-f
if (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))
break
return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))
}
/**
* @param {number} type
* @return {number}
*/
function delimiter (type) {
while (next())
switch (character) {
// ] ) " '
case type:
return position
// " '
case 34: case 39:
if (type !== 34 && type !== 39)
delimiter(character)
break
// (
case 40:
if (type === 41)
delimiter(type)
break
// \
case 92:
next()
break
}
return position
}
/**
* @param {number} type
* @param {number} index
* @return {number}
*/
function commenter (type, index) {
while (next())
// //
if (type + character === 47 + 10)
break
// /*
else if (type + character === 42 + 42 && peek() === 47)
break
return '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())
}
/**
* @param {number} index
* @return {string}
*/
function identifier (index) {
while (!token(peek()))
next()
return slice(index, position)
}
;// ./node_modules/stylis/src/Parser.js
/**
* @param {string} value
* @return {object[]}
*/
function compile (value) {
return dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))
}
/**
* @param {string} value
* @param {object} root
* @param {object?} parent
* @param {string[]} rule
* @param {string[]} rules
* @param {string[]} rulesets
* @param {number[]} pseudo
* @param {number[]} points
* @param {string[]} declarations
* @return {object}
*/
function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
var index = 0
var offset = 0
var length = pseudo
var atrule = 0
var property = 0
var previous = 0
var variable = 1
var scanning = 1
var ampersand = 1
var parens = 0
var character = 0
var type = ''
var props = rules
var children = rulesets
var reference = rule
var characters = type
while (scanning)
switch (previous = character, character = next()) {
// (
case 40:
if (previous != 108 && charat(characters, length - 1) == 58) parens++, characters += '('
else characters += delimit(character)
break
// )
case 41:
parens--, characters += ')'
break
// " ' [
case 34: case 39: case 91:
characters += delimit(character)
break
// \t \n \r \s
case 9: case 10: case 13: case 32:
if (parens > 0) {
characters += from(character)
break
}
characters += whitespace(previous)
break
// \
case 92:
characters += escaping(caret() - 1, 7)
continue
// /
case 47:
switch (peek()) {
case 42: case 47:
append(comment(commenter(next(), caret()), root, parent, declarations), declarations)
if ((token(previous || 1) == 5 || token(peek() || 1) == 5) && strlen(characters) && substr(characters, -1, void 0) !== ' ') characters += ' '
break
default:
characters += '/'
}
break
// {
case 123 * variable:
points[index++] = strlen(characters) * ampersand
// } ; \0
case 125 * variable: case 59: case 0:
if (parens > 0 && character) {
characters += from(character)
break
}
switch (character) {
// \0 }
case 0: case 125: scanning = 0
// ;
case 59 + offset: if (ampersand == -1) characters = replace(characters, /\f/g, '')
if (property > 0 && (strlen(characters) - length || variable === 0))
append(property > 32 ? declaration(characters + ';', rule, parent, length - 1, declarations) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2, declarations), declarations)
break
// @ ;
case 59: characters += ';'
// { rule/at-rule
default:
append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length, rulesets), rulesets)
if (character === 123)
if (offset === 0)
parse(characters, root, reference, reference, props, rulesets, length, points, children)
else {
switch (atrule) {
// c(ontainer)
case 99:
if (charat(characters, 3) === 110) break
// l(ayer)
case 108:
if (charat(characters, 2) === 97) break
default:
offset = 0
// d(ocument) m(edia) s(upports)
case 100: case 109: case 115:
}
if (offset) parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length, children), children), rules, children, length, points, rule ? props : children)
else parse(characters, reference, reference, reference, [''], children, 0, points, children)
}
}
index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo
break
// :
case 58:
length = 1 + strlen(characters), property = previous
default:
if (variable < 1)
if (character == 123)
--variable
else if (character == 125 && variable++ == 0 && prev() == 125)
continue
switch (characters += from(character), character * variable) {
// &
case 38:
ampersand = offset > 0 ? 1 : (characters += '\f', -1)
break
// ,
case 44:
if (parens > 0) break
points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1
break
// @
case 64:
// -
if (peek() === 45)
characters += delimit(next())
atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++
break
// -
case 45:
if (previous === 45 && strlen(characters) == 2)
variable = 0
}
}
return rulesets
}
/**
* @param {string} value
* @param {object} root
* @param {object?} parent
* @param {number} index
* @param {number} offset
* @param {string[]} rules
* @param {number[]} points
* @param {string} type
* @param {string[]} props
* @param {string[]} children
* @param {number} length
* @param {object[]} siblings
* @return {object}
*/
function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length, siblings) {
var post = offset - 1
var rule = offset === 0 ? rules : ['']
var size = sizeof(rule)
for (var i = 0, j = 0, k = 0; i < index; ++i)
for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)
if (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\f/g, rule[x])))
props[k++] = z
return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length, siblings)
}
/**
* @param {number} value
* @param {object} root
* @param {object?} parent
* @param {object[]} siblings
* @return {object}
*/
function comment (value, root, parent, siblings) {
return node(value, root, parent, COMMENT, from(Tokenizer_char()), substr(value, 2, -2), 0, siblings)
}
/**
* @param {string} value
* @param {object} root
* @param {object?} parent
* @param {number} length
* @param {object[]} siblings
* @return {object}
*/
function declaration (value, root, parent, length, siblings) {
return node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length, siblings)
}
;// ./node_modules/stylis/src/Prefixer.js
/**
* @param {string} value
* @param {number} length
* @param {object[]} children
* @return {string}
*/
function prefix (value, length, children) {
switch (hash(value, length)) {
// color-adjust
case 5103:
return WEBKIT + 'print-' + value + value
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921:
// text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
case 5572: case 6356: case 5844: case 3191: case 6645: case 3005:
// background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
case 4215: case 6389: case 5109: case 5365: case 5621: case 3829:
// mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position
case 6391: case 5879: case 5623: case 6135: case 4599:
return WEBKIT + value + value
// mask-composite
case 4855:
return WEBKIT + value.replace('add', 'source-over').replace('substract', 'source-out').replace('intersect', 'source-in').replace('exclude', 'xor') + value
// tab-size
case 4789:
return MOZ + value + value
// appearance, user-select, transform, hyphens, text-size-adjust
case 5349: case 4246: case 4810: case 6968: case 2756:
return WEBKIT + value + MOZ + value + MS + value + value
// writing-mode
case 5936:
switch (charat(value, length + 11)) {
// vertical-l(r)
case 114:
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value
// vertical-r(l)
case 108:
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value
// horizontal(-)tb
case 45:
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value
// default: fallthrough to below
}
// flex, flex-direction, scroll-snap-type, writing-mode
case 6828: case 4268: case 2903:
return WEBKIT + value + MS + value + value
// order
case 6165:
return WEBKIT + value + MS + 'flex-' + value + value
// align-items
case 5187:
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value
// align-self
case 5443:
return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/g, '') + (!match(value, /flex-|baseline/) ? MS + 'grid-row-' + replace(value, /flex-|-self/g, '') : '') + value
// align-content
case 4675:
return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/g, '') + value
// flex-shrink
case 5548:
return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value
// flex-basis
case 5292:
return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value
// flex-grow
case 6060:
return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value
// transition
case 4554:
return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value
// cursor
case 6187:
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value
// background, background-image
case 5495: case 3959:
return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1')
// justify-content
case 4968:
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /space-between/, 'justify') + WEBKIT + value + value
// justify-self
case 4200:
if (!match(value, /flex-|baseline/)) return MS + 'grid-column-align' + substr(value, length) + value
break
// grid-template-(columns|rows)
case 2592: case 3360:
return MS + replace(value, 'template-', '') + value
// grid-(row|column)-start
case 4384: case 3616:
if (children && children.some(function (element, index) { return length = index, match(element.props, /grid-\w+-end/) })) {
return ~indexof(value + (children = children[length].value), 'span') ? value : (MS + replace(value, '-start', '') + value + MS + 'grid-row-span:' + (~indexof(children, 'span') ? match(children, /\d+/) : +match(children, /\d+/) - +match(value, /\d+/)) + ';')
}
return MS + replace(value, '-start', '') + value
// grid-(row|column)-end
case 4896: case 4128:
return (children && children.some(function (element) { return match(element.props, /grid-\w+-start/) })) ? value : MS + replace(replace(value, '-end', '-span'), 'span ', '') + value
// (margin|padding)-inline-(start|end)
case 4095: case 3583: case 4068: case 2532:
return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value
// (min|max)?(width|height|inline-size|block-size)
case 8116: case 7059: case 5753: case 5535:
case 5445: case 5701: case 4933: case 4677:
case 5533: case 5789: case 5021: case 4765:
// stretch, max-content, min-content, fill-available
if (strlen(value) - 1 - length > 6)
switch (charat(value, length + 1)) {
// (m)ax-content, (m)in-content
case 109:
// -
if (charat(value, length + 4) !== 45)
break
// (f)ill-available, (f)it-content
case 102:
return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value
// (s)tretch
case 115:
return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length, children) + value : value
}
break
// grid-(column|row)
case 5152: case 5920:
return replace(value, /(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/, function (_, a, b, c, d, e, f) { return (MS + a + ':' + b + f) + (c ? (MS + a + '-span:' + (d ? e : +e - +b)) + f : '') + value })
// position: sticky
case 4949:
// stick(y)?
if (charat(value, length + 6) === 121)
return replace(value, ':', ':' + WEBKIT) + value
break
// display: (flex|inline-flex|grid|inline-grid)
case 6444:
switch (charat(value, charat(value, 14) === 45 ? 18 : 11)) {
// (inline-)?fle(x)
case 120:
return replace(value, /(.+:)([^;\s!]+)(;|(\s+)?!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value
// (inline-)?gri(d)
case 100:
return replace(value, ':', ':' + MS) + value
}
break
// scroll-margin, scroll-margin-(top|right|bottom|left)
case 5719: case 2647: case 2135: case 3927: case 2391:
return replace(value, 'scroll-', 'scroll-snap-') + value
}
return value
}
;// ./node_modules/stylis/src/Middleware.js
/**
* @param {function[]} collection
* @return {function}
*/
function middleware (collection) {
var length = sizeof(collection)
return function (element, index, children, callback) {
var output = ''
for (var i = 0; i < length; i++)
output += collection[i](element, index, children, callback) || ''
return output
}
}
/**
* @param {function} callback
* @return {function}
*/
function rulesheet (callback) {
return function (element) {
if (!element.root)
if (element = element.return)
callback(element)
}
}
/**
* @param {object} element
* @param {number} index
* @param {object[]} children
* @param {function} callback
*/
function prefixer (element, index, children, callback) {
if (element.length > -1)
if (!element.return)
switch (element.type) {
case DECLARATION: element.return = prefix(element.value, element.length, children)
return
case KEYFRAMES:
return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)
case RULESET:
if (element.length)
return combine(children = element.props, function (value) {
switch (match(value, callback = /(::plac\w+|:read-\w+)/)) {
// :read-(only|write)
case ':read-only': case ':read-write':
lift(copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]}))
lift(copy(element, {props: [value]}))
Utility_assign(element, {props: filter(children, callback)})
break
// :placeholder
case '::placeholder':
lift(copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}))
lift(copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}))
lift(copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]}))
lift(copy(element, {props: [value]}))
Utility_assign(element, {props: filter(children, callback)})
break
}
return ''
})
}
}
/**
* @param {object} element
* @param {number} index
* @param {object[]} children
*/
function namespace (element) {
switch (element.type) {
case RULESET:
element.props = element.props.map(function (value) {
return combine(tokenize(value), function (value, index, children) {
switch (charat(value, 0)) {
// \f
case 12:
return substr(value, 1, strlen(value))
// \0 ( + > ~
case 0: case 40: case 43: case 62: case 126:
return value
// :
case 58:
if (children[++index] === 'global')
children[index] = '', children[++index] = '\f' + substr(children[index], index = 1, -1)
// \s
case 32:
return index === 1 ? '' : value
default:
switch (index) {
case 0: element = value
return sizeof(children) > 1 ? '' : value
case index = sizeof(children) - 1: case 2:
return index === 2 ? value + element + element : value + element
default:
return value
}
}
})
})
}
}
;// ./node_modules/@ant-design/cssinjs/es/linters/utils.js
function lintWarning(message, info) {
const {
path,
parentSelectors
} = info;
(0,warning["default"])(false, `[Ant Design CSS-in-JS] ${path ? `Error in ${path}: ` : ''}${message}${parentSelectors.length ? ` Selector: ${parentSelectors.join(' | ')}` : ''}`);
}
;// ./node_modules/@ant-design/cssinjs/es/linters/contentQuotesLinter.js
const linter = (key, value, info) => {
if (key === 'content') {
// From emotion: https://github.com/emotion-js/emotion/blob/main/packages/serialize/src/index.js#L63
const contentValuePattern = /(attr|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;
const contentValues = ['normal', 'none', 'initial', 'inherit', 'unset'];
if (typeof value !== 'string' || contentValues.indexOf(value) === -1 && !contentValuePattern.test(value) && !value.startsWith('var(') && (value.charAt(0) !== value.charAt(value.length - 1) || value.charAt(0) !== '"' && value.charAt(0) !== "'")) {
lintWarning(`You seem to be using a value for 'content' without quotes, try replacing it with \`content: '"${value}"'\`.`, info);
}
}
};
/* harmony default export */ var contentQuotesLinter = (linter);
;// ./node_modules/@ant-design/cssinjs/es/linters/hashedAnimationLinter.js
const hashedAnimationLinter_linter = (key, value, info) => {
if (key === 'animation') {
if (info.hashId && value !== 'none') {
lintWarning(`You seem to be using hashed animation '${value}', in which case 'animationName' with Keyframe as value is recommended.`, info);
}
}
};
/* harmony default export */ var hashedAnimationLinter = (hashedAnimationLinter_linter);
;// ./node_modules/@ant-design/cssinjs/es/linters/legacyNotSelectorLinter.js
function isConcatSelector(selector) {
const notContent = selector.match(/:not\(([^)]*)\)/)?.[1] || '';
// split selector. e.g.
// `h1#a.b` => ['h1', #a', '.b']
const splitCells = notContent.split(/(\[[^[]*])|(?=[.#])/).filter(str => str);
return splitCells.length > 1;
}
function parsePath(info) {
return info.parentSelectors.reduce((prev, cur) => {
if (!prev) {
return cur;
}
return cur.includes('&') ? cur.replace(/&/g, prev) : `${prev} ${cur}`;
}, '');
}
const legacyNotSelectorLinter_linter = (key, value, info) => {
const parentSelectorPath = parsePath(info);
const notList = parentSelectorPath.match(/:not\([^)]*\)/g) || [];
if (notList.length > 0 && notList.some(isConcatSelector)) {
lintWarning(`Concat ':not' selector not support in legacy browsers.`, info);
}
};
/* harmony default export */ var legacyNotSelectorLinter = (legacyNotSelectorLinter_linter);
;// ./node_modules/@ant-design/cssinjs/es/linters/logicalPropertiesLinter.js
const logicalPropertiesLinter_linter = (key, value, info) => {
switch (key) {
case 'marginLeft':
case 'marginRight':
case 'paddingLeft':
case 'paddingRight':
case 'left':
case 'right':
case 'borderLeft':
case 'borderLeftWidth':
case 'borderLeftStyle':
case 'borderLeftColor':
case 'borderRight':
case 'borderRightWidth':
case 'borderRightStyle':
case 'borderRightColor':
case 'borderTopLeftRadius':
case 'borderTopRightRadius':
case 'borderBottomLeftRadius':
case 'borderBottomRightRadius':
lintWarning(`You seem to be using non-logical property '${key}' which is not compatible with RTL mode. Please use logical properties and values instead. For more information: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties.`, info);
return;
case 'margin':
case 'padding':
case 'borderWidth':
case 'borderStyle':
// case 'borderColor':
if (typeof value === 'string') {
const valueArr = value.split(' ').map(item => item.trim());
if (valueArr.length === 4 && valueArr[1] !== valueArr[3]) {
lintWarning(`You seem to be using '${key}' property with different left ${key} and right ${key}, which is not compatible with RTL mode. Please use logical properties and values instead. For more information: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties.`, info);
}
}
return;
case 'clear':
case 'textAlign':
if (value === 'left' || value === 'right') {
lintWarning(`You seem to be using non-logical value '${value}' of ${key}, which is not compatible with RTL mode. Please use logical properties and values instead. For more information: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties.`, info);
}
return;
case 'borderRadius':
if (typeof value === 'string') {
const radiusGroups = value.split('/').map(item => item.trim());
const invalid = radiusGroups.reduce((result, group) => {
if (result) {
return result;
}
const radiusArr = group.split(' ').map(item => item.trim());
// borderRadius: '2px 4px'
if (radiusArr.length >= 2 && radiusArr[0] !== radiusArr[1]) {
return true;
}
// borderRadius: '4px 4px 2px'
if (radiusArr.length === 3 && radiusArr[1] !== radiusArr[2]) {
return true;
}
// borderRadius: '4px 4px 2px 4px'
if (radiusArr.length === 4 && radiusArr[2] !== radiusArr[3]) {
return true;
}
return result;
}, false);
if (invalid) {
lintWarning(`You seem to be using non-logical value '${value}' of ${key}, which is not compatible with RTL mode. Please use logical properties and values instead. For more information: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties.`, info);
}
}
return;
default:
}
};
/* harmony default export */ var logicalPropertiesLinter = (logicalPropertiesLinter_linter);
;// ./node_modules/@ant-design/cssinjs/es/linters/NaNLinter.js
const NaNLinter_linter = (key, value, info) => {
if (typeof value === 'string' && /NaN/g.test(value) || Number.isNaN(value)) {
lintWarning(`Unexpected 'NaN' in property '${key}: ${value}'.`, info);
}
};
/* harmony default export */ var NaNLinter = (NaNLinter_linter);
;// ./node_modules/@ant-design/cssinjs/es/linters/parentSelectorLinter.js
const parentSelectorLinter_linter = (key, value, info) => {
if (info.parentSelectors.some(selector => {
const selectors = selector.split(',');
return selectors.some(item => item.split('&').length > 2);
})) {
lintWarning('Should not use more than one `&` in a selector.', info);
}
};
/* harmony default export */ var parentSelectorLinter = (parentSelectorLinter_linter);
;// ./node_modules/@ant-design/cssinjs/es/linters/index.js
;// ./node_modules/@ant-design/cssinjs/es/util/cacheMapUtil.js
const ATTR_CACHE_MAP = 'data-ant-cssinjs-cache-path';
/**
* This marks style from the css file.
* Which means not exist in `` tag.
*/
const CSS_FILE_STYLE = '_FILE_STYLE__';
function cacheMapUtil_serialize(cachePathMap) {
return Object.keys(cachePathMap).map(path => {
const hash = cachePathMap[path];
return `${path}:${hash}`;
}).join(';');
}
let cachePathMap;
let fromCSSFile = true;
/**
* @private Test usage only. Can save remove if no need.
*/
function cacheMapUtil_reset(mockCache, fromFile = true) {
cachePathMap = mockCache;
fromCSSFile = fromFile;
}
function prepare() {
if (!cachePathMap) {
cachePathMap = {};
if ((0,canUseDom["default"])()) {
const div = document.createElement('div');
div.className = ATTR_CACHE_MAP;
div.style.position = 'fixed';
div.style.visibility = 'hidden';
div.style.top = '-9999px';
document.body.appendChild(div);
let content = getComputedStyle(div).content || '';
content = content.replace(/^"/, '').replace(/"$/, '');
// Fill data
content.split(';').forEach(item => {
const [path, hash] = item.split(':');
cachePathMap[path] = hash;
});
// Remove inline record style
const inlineMapStyle = document.querySelector(`style[${ATTR_CACHE_MAP}]`);
if (inlineMapStyle) {
fromCSSFile = false;
inlineMapStyle.parentNode?.removeChild(inlineMapStyle);
}
document.body.removeChild(div);
}
}
}
function existPath(path) {
prepare();
return !!cachePathMap[path];
}
function getStyleAndHash(path) {
const hash = cachePathMap[path];
let styleStr = null;
if (hash && (0,canUseDom["default"])()) {
if (fromCSSFile) {
styleStr = CSS_FILE_STYLE;
} else {
const style = document.querySelector(`style[${ATTR_MARK}="${cachePathMap[path]}"]`);
if (style) {
styleStr = style.innerHTML;
} else {
// Clean up since not exist anymore
delete cachePathMap[path];
}
}
}
return [styleStr, hash];
}
;// ./node_modules/@ant-design/cssinjs/es/hooks/useStyleRegister.js
// @ts-ignore
const SKIP_CHECK = '_skip_check_';
const MULTI_VALUE = '_multi_value_';
// ============================================================================
// == Parser ==
// ============================================================================
// Preprocessor style content to browser support one
function normalizeStyle(styleStr, autoPrefix) {
const serialized = autoPrefix ? serialize(compile(styleStr), middleware([prefixer, stringify])) : serialize(compile(styleStr), stringify);
return serialized.replace(/\{%%%\:[^;];}/g, ';');
}
function isCompoundCSSProperty(value) {
return typeof value === 'object' && value && (SKIP_CHECK in value || MULTI_VALUE in value);
}
// 注入 hash 值
function injectSelectorHash(key, hashId, hashPriority = 'high') {
if (!hashId) {
return key;
}
const hashSelector = where({
hashCls: hashId,
hashPriority
});
// 注入 hashId
const keys = key.split(',').map(k => {
const fullPath = k.trim().split(/\s+/);
// 如果 Selector 第一个是 HTML Element,那我们就插到它的后面。反之,就插到最前面。
let firstPath = fullPath[0] || '';
const htmlElement = firstPath.match(/^\w+/)?.[0] || '';
firstPath = `${htmlElement}${hashSelector}${firstPath.slice(htmlElement.length)}`;
return [firstPath, ...fullPath.slice(1)].join(' ');
});
return keys.join(',');
}
// Parse CSSObject to style content
const parseStyle = (interpolation, config = {}, {
root,
injectHash,
parentSelectors
} = {
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, fullList = []) {
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 => {
// Only root level can use raw string
const style = typeof originStyle === 'string' && !root ? {} : originStyle;
if (typeof style === 'string') {
styleStr += `${style}\n`;
} else if (style._keyframe) {
// Keyframe
parseKeyframes(style);
} else {
const mergedStyle = transformers.reduce((prev, trans) => trans?.visit?.(prev) || prev, style);
// Normal CSSObject
Object.keys(mergedStyle).forEach(key => {
const value = mergedStyle[key];
if (typeof value === 'object' && value && (key !== 'animationName' || !value._keyframe) && !isCompoundCSSProperty(value)) {
let subInjectHash = false;
// 当成嵌套对象来处理
let mergedKey = key.trim();
// Whether treat child as root. In most case it is false.
let nextRoot = false;
// 拆分多个选择器
if ((root || injectHash) && hashId) {
if (mergedKey.startsWith('@')) {
// 略过媒体查询,交给子节点继续插入 hashId
subInjectHash = true;
} else if (mergedKey === '&') {
// 抹掉 root selector 上的单个 &
mergedKey = injectSelectorHash('', hashId, hashPriority);
} else {
// 注入 hashId
mergedKey = injectSelectorHash(key, hashId, hashPriority);
}
} else if (root && !hashId && (mergedKey === '&' || mergedKey === '')) {
// In case of `{ '&': { a: { color: 'red' } } }` or `{ '': { a: { color: 'red' } } }` without hashId,
// we will get `&{a:{color:red;}}` or `{a:{color:red;}}` string for stylis to compile.
// But it does not conform to stylis syntax,
// and finally we will get `{color:red;}` as css, which is wrong.
// So we need to remove key in root, and treat child `{ a: { color: 'red' } }` as root.
mergedKey = '';
nextRoot = true;
}
const [parsedStr, childEffectStyle] = parseStyle(value, config, {
root: nextRoot,
injectHash: subInjectHash,
parentSelectors: [...parentSelectors, mergedKey]
});
effectStyle = {
...effectStyle,
...childEffectStyle
};
styleStr += `${mergedKey}${parsedStr}`;
} else {
function appendStyle(cssKey, cssValue) {
if ( true && (typeof value !== 'object' || !value?.[SKIP_CHECK])) {
[contentQuotesLinter, hashedAnimationLinter, ...linters].forEach(linter => linter(cssKey, cssValue, {
path,
hashId,
parentSelectors
}));
}
// 如果是样式则直接插入
const styleName = cssKey.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`);
// Auto suffix with px
let formatValue = cssValue;
if (!unitless_browser_esm[cssKey] && typeof formatValue === 'number' && formatValue !== 0) {
formatValue = `${formatValue}px`;
}
// handle animationName & Keyframe value
if (cssKey === 'animationName' && cssValue?._keyframe) {
parseKeyframes(cssValue);
formatValue = cssValue.getName(hashId);
}
styleStr += `${styleName}:${formatValue};`;
}
const actualValue = value?.value ?? value;
if (typeof value === 'object' && value?.[MULTI_VALUE] && Array.isArray(actualValue)) {
actualValue.forEach(item => {
appendStyle(key, item);
});
} else {
if (isNonNullable(actualValue)) {
appendStyle(key, actualValue);
}
}
}
});
}
});
if (!root) {
styleStr = `{${styleStr}}`;
} else if (layer) {
// fixme: https://github.com/thysultan/stylis/pull/339
if (styleStr) {
styleStr = `@layer ${layer.name} {${styleStr}}`;
}
if (layer.dependencies) {
effectStyle[`@layer ${layer.name}`] = layer.dependencies.map(deps => `@layer ${deps}, ${layer.name};`).join('\n');
}
}
return [styleStr, effectStyle];
};
// ============================================================================
// == Register ==
// ============================================================================
function uniqueHash(path, styleStr) {
return hash_browser_esm(`${path.join('%')}${styleStr}`);
}
const STYLE_PREFIX = 'style';
/**
* Register a style to the global style sheet.
*/
function useStyleRegister(info, styleFn) {
const {
path,
hashId,
layer,
nonce,
clientOnly,
order = 0
} = info;
const {
mock,
hashPriority,
container,
transformers,
linters,
cache,
layer: enableLayer,
autoPrefix
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(es_StyleContext);
const fullPath = [hashId || ''];
if (enableLayer) {
fullPath.push('layer');
}
fullPath.push(...path);
// Check if need insert style
let isMergedClientSide = isClientSide;
if ( true && mock !== undefined) {
isMergedClientSide = mock === 'client';
}
useGlobalCache(STYLE_PREFIX, fullPath,
// Create cache if needed
() => {
const cachePath = fullPath.join('|');
// Get style from SSR inline style directly
if (existPath(cachePath)) {
const [inlineCacheStyleStr, styleHash] = getStyleAndHash(cachePath);
if (inlineCacheStyleStr) {
return [inlineCacheStyleStr, styleHash, {}, clientOnly, order];
}
}
// Generate style
const styleObj = styleFn();
const [parsedStyle, effectStyle] = parseStyle(styleObj, {
hashId,
hashPriority,
layer: enableLayer ? layer : undefined,
path: path.join('-'),
transformers,
linters
});
const styleStr = normalizeStyle(parsedStyle, autoPrefix || false);
const styleId = uniqueHash(fullPath, styleStr);
return [styleStr, styleId, effectStyle, clientOnly, order];
},
// Remove cache if no need
(cacheValue, fromHMR) => {
const [, styleId] = cacheValue;
if (fromHMR && isClientSide) {
(0,dynamicCSS.removeCSS)(styleId, {
mark: ATTR_MARK,
attachTo: container
});
}
},
// Effect: Inject style here
cacheValue => {
const [styleStr, styleId, effectStyle,, priority] = cacheValue;
if (isMergedClientSide && styleStr !== CSS_FILE_STYLE) {
let mergedCSSConfig = {
mark: ATTR_MARK,
prepend: enableLayer ? false : 'queue',
attachTo: container,
priority
};
mergedCSSConfig = injectCSPNonce(mergedCSSConfig, nonce);
// ================= Split Effect Style =================
// We will split effectStyle here since @layer should be at the top level
const effectLayerKeys = [];
const effectRestKeys = [];
Object.keys(effectStyle).forEach(key => {
if (key.startsWith('@layer')) {
effectLayerKeys.push(key);
} else {
effectRestKeys.push(key);
}
});
// ================= Inject Layer Style =================
// Inject layer style
effectLayerKeys.forEach(effectKey => {
(0,dynamicCSS.updateCSS)(normalizeStyle(effectStyle[effectKey], autoPrefix || false), `_layer-${effectKey}`, {
...mergedCSSConfig,
prepend: true
});
});
// ==================== Inject Style ====================
// Inject style
const style = (0,dynamicCSS.updateCSS)(styleStr, styleId, mergedCSSConfig);
style[CSS_IN_JS_INSTANCE] = cache.instanceId;
// Debug usage. Dev only
if (true) {
style.setAttribute(ATTR_CACHE_PATH, fullPath.join('|'));
}
// ================ Inject Effect Style =================
// Inject client side effect style
effectRestKeys.forEach(effectKey => {
(0,dynamicCSS.updateCSS)(normalizeStyle(effectStyle[effectKey], autoPrefix || false), `_effect-${effectKey}`, mergedCSSConfig);
});
}
});
}
const useStyleRegister_extract = (cache, effectStyles, options) => {
const [styleStr, styleId, effectStyle, clientOnly, order] = cache;
const {
plain,
autoPrefix
} = options || {};
// Skip client only style
if (clientOnly) {
return null;
}
let keyStyleText = styleStr;
// ====================== Share ======================
// Used for @rc-component/util
const sharedAttrs = {
'data-rc-order': 'prependQueue',
'data-rc-priority': `${order}`
};
// ====================== Style ======================
keyStyleText = toStyleStr(styleStr, undefined, styleId, sharedAttrs, plain);
// =============== Create effect style ===============
if (effectStyle) {
Object.keys(effectStyle).forEach(effectKey => {
// Effect style can be reused
if (!effectStyles[effectKey]) {
effectStyles[effectKey] = true;
const effectStyleStr = normalizeStyle(effectStyle[effectKey], autoPrefix || false);
const effectStyleHTML = toStyleStr(effectStyleStr, undefined, `_effect-${effectKey}`, sharedAttrs, plain);
if (effectKey.startsWith('@layer')) {
keyStyleText = effectStyleHTML + keyStyleText;
} else {
keyStyleText += effectStyleHTML;
}
}
});
}
return [order, styleId, keyStyleText];
};
;// ./node_modules/@ant-design/cssinjs/es/hooks/useCSSVarRegister.js
const CSS_VAR_PREFIX = 'cssVar';
const useCSSVarRegister = (config, fn) => {
const {
key,
prefix,
unitless,
ignore,
token,
hashId,
scope,
nonce
} = config;
const {
cache: {
instanceId
},
container,
hashPriority
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(es_StyleContext);
const {
_tokenKey: tokenKey
} = token;
const scopeKey = Array.isArray(scope) ? scope.join('@@') : scope;
const stylePath = [...config.path, key, scopeKey, tokenKey];
const cache = useGlobalCache(CSS_VAR_PREFIX, stylePath, () => {
const originToken = fn();
const [mergedToken, cssVarsStr] = transformToken(originToken, key, {
prefix,
unitless,
ignore,
scope,
hashPriority,
hashCls: hashId
});
const styleId = uniqueHash(stylePath, cssVarsStr);
return [mergedToken, cssVarsStr, styleId, key];
}, ([,, styleId]) => {
if (isClientSide) {
(0,dynamicCSS.removeCSS)(styleId, {
mark: ATTR_MARK,
attachTo: container
});
}
}, ([, cssVarsStr, styleId]) => {
if (!cssVarsStr) {
return;
}
let mergedCSSConfig = {
mark: ATTR_MARK,
prepend: 'queue',
attachTo: container,
priority: -999
};
mergedCSSConfig = injectCSPNonce(mergedCSSConfig, nonce);
const style = (0,dynamicCSS.updateCSS)(cssVarsStr, styleId, mergedCSSConfig);
style[CSS_IN_JS_INSTANCE] = instanceId;
// Used for `useCacheToken` to remove on batch when token removed
style.setAttribute(ATTR_TOKEN, key);
});
return cache;
};
const useCSSVarRegister_extract = (cache, effectStyles, options) => {
const [, styleStr, styleId, cssVarKey] = cache;
const {
plain
} = options || {};
if (!styleStr) {
return null;
}
const order = -999;
// ====================== Style ======================
// Used for @rc-component/util
const sharedAttrs = {
'data-rc-order': 'prependQueue',
'data-rc-priority': `${order}`
};
const styleText = toStyleStr(styleStr, cssVarKey, styleId, sharedAttrs, plain);
return [order, styleId, styleText];
};
/* harmony default export */ var hooks_useCSSVarRegister = (useCSSVarRegister);
;// ./node_modules/@ant-design/cssinjs/es/extractStyle.js
const ExtractStyleFns = {
[STYLE_PREFIX]: useStyleRegister_extract,
[TOKEN_PREFIX]: extract,
[CSS_VAR_PREFIX]: useCSSVarRegister_extract
};
function isNotNull(value) {
return value !== null;
}
function extractStyle(cache, options) {
const {
plain = false,
types = ['style', 'token', 'cssVar'],
once = false
} = typeof options === 'boolean' ? {
plain: options
} : options || {};
const matchPrefixRegexp = new RegExp(`^(${(typeof types === 'string' ? [types] : types).join('|')})%`);
// prefix with `style` is used for `useStyleRegister` to cache style context
const styleKeys = Array.from(cache.cache.keys()).filter(key => matchPrefixRegexp.test(key));
// Common effect styles like animation
const effectStyles = {};
// Mapping of cachePath to style hash
const cachePathMap = {};
let styleText = '';
styleKeys.map(key => {
if (once && cache.extracted.has(key)) {
return null; // Skip if already extracted
}
const cachePath = key.replace(matchPrefixRegexp, '').replace(/%/g, '|');
const [prefix] = key.split('%');
const extractFn = ExtractStyleFns[prefix];
const extractedStyle = extractFn(cache.cache.get(key)[1], effectStyles, {
plain
});
if (!extractedStyle) {
return null;
}
const updateTime = cache.updateTimes.get(key) || 0;
const [order, styleId, styleStr] = extractedStyle;
if (key.startsWith('style')) {
cachePathMap[cachePath] = styleId;
}
// record that this style has been extracted
cache.extracted.add(key);
return [order, styleStr, updateTime];
}).filter(isNotNull).sort(([o1,, u1], [o2,, u2]) => {
if (o1 !== o2) {
return o1 - o2;
}
return u1 - u2;
}).forEach(([, style]) => {
styleText += style;
});
// ==================== Fill Cache Path ====================
styleText += toStyleStr(`.${ATTR_CACHE_MAP}{content:"${cacheMapUtil_serialize(cachePathMap)}";}`, undefined, undefined, {
[ATTR_CACHE_MAP]: ATTR_CACHE_MAP
}, plain);
return styleText;
}
;// ./node_modules/@ant-design/cssinjs/es/Keyframes.js
class Keyframe {
name;
style;
constructor(name, style) {
this.name = name;
this.style = style;
}
getName(hashId = '') {
return hashId ? `${hashId}-${this.name}` : this.name;
}
_keyframe = true;
}
/* harmony default export */ var Keyframes = (Keyframe);
;// ./node_modules/@ant-design/cssinjs/es/transformers/legacyLogicalProperties.js
function splitValues(value) {
if (typeof value === 'number') {
return [[value], false];
}
const rawStyle = String(value).trim();
const importantCells = rawStyle.match(/(.*)(!important)/);
const splitStyle = (importantCells ? importantCells[1] : rawStyle).trim().split(/\s+/);
// Combine styles split in brackets, like `calc(1px + 2px)`
let temp = [];
let brackets = 0;
return [splitStyle.reduce((list, item) => {
if (item.includes('(') || item.includes(')')) {
const left = item.split('(').length - 1;
const right = item.split(')').length - 1;
brackets += left - right;
}
if (brackets >= 0) temp.push(item);
if (brackets === 0) {
list.push(temp.join(' '));
temp = [];
}
return list;
}, []), !!importantCells];
}
function noSplit(list) {
list.notSplit = true;
return list;
}
const keyMap = {
// Inset
inset: ['top', 'right', 'bottom', 'left'],
insetBlock: ['top', 'bottom'],
insetBlockStart: ['top'],
insetBlockEnd: ['bottom'],
insetInline: ['left', 'right'],
insetInlineStart: ['left'],
insetInlineEnd: ['right'],
// Margin
marginBlock: ['marginTop', 'marginBottom'],
marginBlockStart: ['marginTop'],
marginBlockEnd: ['marginBottom'],
marginInline: ['marginLeft', 'marginRight'],
marginInlineStart: ['marginLeft'],
marginInlineEnd: ['marginRight'],
// Padding
paddingBlock: ['paddingTop', 'paddingBottom'],
paddingBlockStart: ['paddingTop'],
paddingBlockEnd: ['paddingBottom'],
paddingInline: ['paddingLeft', 'paddingRight'],
paddingInlineStart: ['paddingLeft'],
paddingInlineEnd: ['paddingRight'],
// Border
borderBlock: noSplit(['borderTop', 'borderBottom']),
borderBlockStart: noSplit(['borderTop']),
borderBlockEnd: noSplit(['borderBottom']),
borderInline: noSplit(['borderLeft', 'borderRight']),
borderInlineStart: noSplit(['borderLeft']),
borderInlineEnd: noSplit(['borderRight']),
// Border width
borderBlockWidth: ['borderTopWidth', 'borderBottomWidth'],
borderBlockStartWidth: ['borderTopWidth'],
borderBlockEndWidth: ['borderBottomWidth'],
borderInlineWidth: ['borderLeftWidth', 'borderRightWidth'],
borderInlineStartWidth: ['borderLeftWidth'],
borderInlineEndWidth: ['borderRightWidth'],
// Border style
borderBlockStyle: ['borderTopStyle', 'borderBottomStyle'],
borderBlockStartStyle: ['borderTopStyle'],
borderBlockEndStyle: ['borderBottomStyle'],
borderInlineStyle: ['borderLeftStyle', 'borderRightStyle'],
borderInlineStartStyle: ['borderLeftStyle'],
borderInlineEndStyle: ['borderRightStyle'],
// Border color
borderBlockColor: ['borderTopColor', 'borderBottomColor'],
borderBlockStartColor: ['borderTopColor'],
borderBlockEndColor: ['borderBottomColor'],
borderInlineColor: ['borderLeftColor', 'borderRightColor'],
borderInlineStartColor: ['borderLeftColor'],
borderInlineEndColor: ['borderRightColor'],
// Border radius
borderStartStartRadius: ['borderTopLeftRadius'],
borderStartEndRadius: ['borderTopRightRadius'],
borderEndStartRadius: ['borderBottomLeftRadius'],
borderEndEndRadius: ['borderBottomRightRadius']
};
function wrapImportantAndSkipCheck(value, important) {
let parsedValue = value;
if (important) {
parsedValue = `${parsedValue} !important`;
}
return {
_skip_check_: true,
value: parsedValue
};
}
/**
* Convert css logical properties to legacy properties.
* Such as: `margin-block-start` to `margin-top`.
* Transform list:
* - inset
* - margin
* - padding
* - border
*/
const legacyLogicalProperties_transform = {
visit: cssObj => {
const clone = {};
Object.keys(cssObj).forEach(key => {
const value = cssObj[key];
const matchValue = keyMap[key];
if (matchValue && (typeof value === 'number' || typeof value === 'string')) {
const [values, important] = splitValues(value);
if (matchValue.length && matchValue.notSplit) {
// not split means always give same value like border
matchValue.forEach(matchKey => {
clone[matchKey] = wrapImportantAndSkipCheck(value, important);
});
} else if (matchValue.length === 1) {
// Handle like `marginBlockStart` => `marginTop`
clone[matchValue[0]] = wrapImportantAndSkipCheck(values[0], important);
} else if (matchValue.length === 2) {
// Handle like `marginBlock` => `marginTop` & `marginBottom`
matchValue.forEach((matchKey, index) => {
clone[matchKey] = wrapImportantAndSkipCheck(values[index] ?? values[0], important);
});
} else if (matchValue.length === 4) {
// Handle like `inset` => `top` & `right` & `bottom` & `left`
matchValue.forEach((matchKey, index) => {
clone[matchKey] = wrapImportantAndSkipCheck(values[index] ?? values[index - 2] ?? values[0], important);
});
} else {
clone[key] = value;
}
} else {
clone[key] = value;
}
});
return clone;
}
};
/* harmony default export */ var legacyLogicalProperties = (legacyLogicalProperties_transform);
;// ./node_modules/@ant-design/cssinjs/es/transformers/px2rem.js
/**
* respect https://github.com/cuth/postcss-pxtorem
*/
// @ts-ignore
const pxRegex = /url\([^)]+\)|var\([^)]+\)|(\d*\.?\d+)px/g;
function toFixed(number, precision) {
const multiplier = Math.pow(10, precision + 1),
wholeNumber = Math.floor(number * multiplier);
return Math.round(wholeNumber / 10) * 10 / multiplier;
}
const px2rem_transform = (options = {}) => {
const {
rootValue = 16,
precision = 5,
mediaQuery = false
} = options;
const pxReplace = (m, $1) => {
if (!$1) return m;
const pixels = parseFloat($1);
// covenant: pixels <= 1, not transform to rem @zombieJ
if (pixels <= 1) return m;
const fixedVal = toFixed(pixels / rootValue, precision);
return `${fixedVal}rem`;
};
const visit = cssObj => {
const clone = {
...cssObj
};
Object.entries(cssObj).forEach(([key, value]) => {
if (typeof value === 'string' && value.includes('px')) {
const newValue = value.replace(pxRegex, pxReplace);
clone[key] = newValue;
}
// no unit
if (!unitless_browser_esm[key] && typeof value === 'number' && value !== 0) {
clone[key] = `${value}px`.replace(pxRegex, pxReplace);
}
// Media queries
const mergedKey = key.trim();
if (mergedKey.startsWith('@') && mergedKey.includes('px') && mediaQuery) {
const newKey = key.replace(pxRegex, pxReplace);
clone[newKey] = clone[key];
delete clone[key];
}
});
return clone;
};
return {
visit
};
};
/* harmony default export */ var px2rem = (px2rem_transform);
;// ./node_modules/@ant-design/cssinjs/es/index.js
const _experimental = {
supportModernCSS: () => supportWhere() && supportLogicProps()
};
/***/ }),
/***/ "./node_modules/@ant-design/fast-color/es/index.js":
/*!*********************************************************************!*\
!*** ./node_modules/@ant-design/fast-color/es/index.js + 3 modules ***!
\*********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
FastColor: function() { return /* reexport */ FastColor; }
});
;// ./node_modules/@ant-design/fast-color/es/presetColors.js
// 36 Hex to reduce the size of the file
/* harmony default export */ var presetColors = ({
aliceblue: '9ehhb',
antiquewhite: '9sgk7',
aqua: '1ekf',
aquamarine: '4zsno',
azure: '9eiv3',
beige: '9lhp8',
bisque: '9zg04',
black: '0',
blanchedalmond: '9zhe5',
blue: '73',
blueviolet: '5e31e',
brown: '6g016',
burlywood: '8ouiv',
cadetblue: '3qba8',
chartreuse: '4zshs',
chocolate: '87k0u',
coral: '9yvyo',
cornflowerblue: '3xael',
cornsilk: '9zjz0',
crimson: '8l4xo',
cyan: '1ekf',
darkblue: '3v',
darkcyan: 'rkb',
darkgoldenrod: '776yz',
darkgray: '6mbhl',
darkgreen: 'jr4',
darkgrey: '6mbhl',
darkkhaki: '7ehkb',
darkmagenta: '5f91n',
darkolivegreen: '3bzfz',
darkorange: '9yygw',
darkorchid: '5z6x8',
darkred: '5f8xs',
darksalmon: '9441m',
darkseagreen: '5lwgf',
darkslateblue: '2th1n',
darkslategray: '1ugcv',
darkslategrey: '1ugcv',
darkturquoise: '14up',
darkviolet: '5rw7n',
deeppink: '9yavn',
deepskyblue: '11xb',
dimgray: '442g9',
dimgrey: '442g9',
dodgerblue: '16xof',
firebrick: '6y7tu',
floralwhite: '9zkds',
forestgreen: '1cisi',
fuchsia: '9y70f',
gainsboro: '8m8kc',
ghostwhite: '9pq0v',
goldenrod: '8j4f4',
gold: '9zda8',
gray: '50i2o',
green: 'pa8',
greenyellow: '6senj',
grey: '50i2o',
honeydew: '9eiuo',
hotpink: '9yrp0',
indianred: '80gnw',
indigo: '2xcoy',
ivory: '9zldc',
khaki: '9edu4',
lavenderblush: '9ziet',
lavender: '90c8q',
lawngreen: '4vk74',
lemonchiffon: '9zkct',
lightblue: '6s73a',
lightcoral: '9dtog',
lightcyan: '8s1rz',
lightgoldenrodyellow: '9sjiq',
lightgray: '89jo3',
lightgreen: '5nkwg',
lightgrey: '89jo3',
lightpink: '9z6wx',
lightsalmon: '9z2ii',
lightseagreen: '19xgq',
lightskyblue: '5arju',
lightslategray: '4nwk9',
lightslategrey: '4nwk9',
lightsteelblue: '6wau6',
lightyellow: '9zlcw',
lime: '1edc',
limegreen: '1zcxe',
linen: '9shk6',
magenta: '9y70f',
maroon: '4zsow',
mediumaquamarine: '40eju',
mediumblue: '5p',
mediumorchid: '79qkz',
mediumpurple: '5r3rv',
mediumseagreen: '2d9ip',
mediumslateblue: '4tcku',
mediumspringgreen: '1di2',
mediumturquoise: '2uabw',
mediumvioletred: '7rn9h',
midnightblue: 'z980',
mintcream: '9ljp6',
mistyrose: '9zg0x',
moccasin: '9zfzp',
navajowhite: '9zest',
navy: '3k',
oldlace: '9wq92',
olive: '50hz4',
olivedrab: '472ub',
orange: '9z3eo',
orangered: '9ykg0',
orchid: '8iu3a',
palegoldenrod: '9bl4a',
palegreen: '5yw0o',
paleturquoise: '6v4ku',
palevioletred: '8k8lv',
papayawhip: '9zi6t',
peachpuff: '9ze0p',
peru: '80oqn',
pink: '9z8wb',
plum: '8nba5',
powderblue: '6wgdi',
purple: '4zssg',
rebeccapurple: '3zk49',
red: '9y6tc',
rosybrown: '7cv4f',
royalblue: '2jvtt',
saddlebrown: '5fmkz',
salmon: '9rvci',
sandybrown: '9jn1c',
seagreen: '1tdnb',
seashell: '9zje6',
sienna: '6973h',
silver: '7ir40',
skyblue: '5arjf',
slateblue: '45e4t',
slategray: '4e100',
slategrey: '4e100',
snow: '9zke2',
springgreen: '1egv',
steelblue: '2r1kk',
tan: '87yx8',
teal: 'pds',
thistle: '8ggk8',
tomato: '9yqfb',
turquoise: '2j4r4',
violet: '9b10u',
wheat: '9ld4j',
white: '9zldr',
whitesmoke: '9lhpx',
yellow: '9zl6o',
yellowgreen: '61fzm'
});
;// ./node_modules/@ant-design/fast-color/es/FastColor.js
const round = Math.round;
/**
* Support format, alpha unit will check the % mark:
* - rgba(102, 204, 255, .5) -> [102, 204, 255, 0.5]
* - rgb(102 204 255 / .5) -> [102, 204, 255, 0.5]
* - rgb(100%, 50%, 0% / 50%) -> [255, 128, 0, 0.5]
* - hsl(270, 60, 40, .5) -> [270, 60, 40, 0.5]
* - hsl(270deg 60% 40% / 50%) -> [270, 60, 40, 0.5]
*
* When `base` is provided, the percentage value will be divided by `base`.
*/
function splitColorStr(str, parseNum) {
const match = str
// Remove str before `(`
.replace(/^[^(]*\((.*)/, '$1')
// Remove str after `)`
.replace(/\).*/, '').match(/\d*\.?\d+%?/g) || [];
const numList = match.map(item => parseFloat(item));
for (let i = 0; i < 3; i += 1) {
numList[i] = parseNum(numList[i] || 0, match[i] || '', i);
}
// For alpha. 50% should be 0.5
if (match[3]) {
numList[3] = match[3].includes('%') ? numList[3] / 100 : numList[3];
} else {
// By default, alpha is 1
numList[3] = 1;
}
return numList;
}
const parseHSVorHSL = (num, _, index) => index === 0 ? num : num / 100;
/** round and limit number to integer between 0-255 */
function limitRange(value, max) {
const mergedMax = max || 255;
if (value > mergedMax) {
return mergedMax;
}
if (value < 0) {
return 0;
}
return value;
}
class FastColor {
/**
* All FastColor objects are valid. So isValid is always true. This property is kept to be compatible with TinyColor.
*/
isValid = true;
/**
* Red, R in RGB
*/
r = 0;
/**
* Green, G in RGB
*/
g = 0;
/**
* Blue, B in RGB
*/
b = 0;
/**
* Alpha/Opacity, A in RGBA/HSLA
*/
a = 1;
// HSV privates
_h;
_hsl_s;
_hsv_s;
_l;
_v;
// intermediate variables to calculate HSL/HSV
_max;
_min;
_brightness;
constructor(input) {
/**
* Always check 3 char in the object to determine the format.
* We not use function in check to save bundle size.
* e.g. 'rgb' -> { r: 0, g: 0, b: 0 }.
*/
function matchFormat(str) {
return str[0] in input && str[1] in input && str[2] in input;
}
if (!input) {
// Do nothing since already initialized
} else if (typeof input === 'string') {
const trimStr = input.trim();
function matchPrefix(prefix) {
return trimStr.startsWith(prefix);
}
if (/^#?[A-F\d]{3,8}$/i.test(trimStr)) {
this.fromHexString(trimStr);
} else if (matchPrefix('rgb')) {
this.fromRgbString(trimStr);
} else if (matchPrefix('hsl')) {
this.fromHslString(trimStr);
} else if (matchPrefix('hsv') || matchPrefix('hsb')) {
this.fromHsvString(trimStr);
} else {
// From preset color
const presetColor = presetColors[trimStr.toLowerCase()];
if (presetColor) {
this.fromHexString(
// Convert 36 hex to 16 hex
parseInt(presetColor, 36).toString(16).padStart(6, '0'));
}
}
} else if (input instanceof FastColor) {
this.r = input.r;
this.g = input.g;
this.b = input.b;
this.a = input.a;
this._h = input._h;
this._hsl_s = input._hsl_s;
this._hsv_s = input._hsv_s;
this._l = input._l;
this._v = input._v;
} else if (matchFormat('rgb')) {
this.r = limitRange(input.r);
this.g = limitRange(input.g);
this.b = limitRange(input.b);
this.a = typeof input.a === 'number' ? limitRange(input.a, 1) : 1;
} else if (matchFormat('hsl')) {
this.fromHsl(input);
} else if (matchFormat('hsv')) {
this.fromHsv(input);
} else {
throw new Error('@ant-design/fast-color: unsupported input ' + JSON.stringify(input));
}
}
// ======================= Setter =======================
setR(value) {
return this._sc('r', value);
}
setG(value) {
return this._sc('g', value);
}
setB(value) {
return this._sc('b', value);
}
setA(value) {
return this._sc('a', value, 1);
}
setHue(value) {
const hsv = this.toHsv();
hsv.h = value;
return this._c(hsv);
}
// ======================= Getter =======================
/**
* Returns the perceived luminance of a color, from 0-1.
* @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
*/
getLuminance() {
function adjustGamma(raw) {
const val = raw / 255;
return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
}
const R = adjustGamma(this.r);
const G = adjustGamma(this.g);
const B = adjustGamma(this.b);
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
}
getHue() {
if (typeof this._h === 'undefined') {
const delta = this.getMax() - this.getMin();
if (delta === 0) {
this._h = 0;
} else {
this._h = round(60 * (this.r === this.getMax() ? (this.g - this.b) / delta + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / delta + 2 : (this.r - this.g) / delta + 4));
}
}
return this._h;
}
/**
* @deprecated should use getHSVSaturation or getHSLSaturation instead
*/
getSaturation() {
return this.getHSVSaturation();
}
getHSVSaturation() {
if (typeof this._hsv_s === 'undefined') {
const delta = this.getMax() - this.getMin();
if (delta === 0) {
this._hsv_s = 0;
} else {
this._hsv_s = delta / this.getMax();
}
}
return this._hsv_s;
}
getHSLSaturation() {
if (typeof this._hsl_s === 'undefined') {
const delta = this.getMax() - this.getMin();
if (delta === 0) {
this._hsl_s = 0;
} else {
const l = this.getLightness();
this._hsl_s = delta / 255 / (1 - Math.abs(2 * l - 1));
}
}
return this._hsl_s;
}
getLightness() {
if (typeof this._l === 'undefined') {
this._l = (this.getMax() + this.getMin()) / 510;
}
return this._l;
}
getValue() {
if (typeof this._v === 'undefined') {
this._v = this.getMax() / 255;
}
return this._v;
}
/**
* Returns the perceived brightness of the color, from 0-255.
* Note: this is not the b of HSB
* @see http://www.w3.org/TR/AERT#color-contrast
*/
getBrightness() {
if (typeof this._brightness === 'undefined') {
this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1000;
}
return this._brightness;
}
// ======================== Func ========================
darken(amount = 10) {
const h = this.getHue();
const s = this.getSaturation();
let l = this.getLightness() - amount / 100;
if (l < 0) {
l = 0;
}
return this._c({
h,
s,
l,
a: this.a
});
}
lighten(amount = 10) {
const h = this.getHue();
const s = this.getSaturation();
let l = this.getLightness() + amount / 100;
if (l > 1) {
l = 1;
}
return this._c({
h,
s,
l,
a: this.a
});
}
/**
* Mix the current color a given amount with another color, from 0 to 100.
* 0 means no mixing (return current color).
*/
mix(input, amount = 50) {
const color = this._c(input);
const p = amount / 100;
const calc = key => (color[key] - this[key]) * p + this[key];
const rgba = {
r: round(calc('r')),
g: round(calc('g')),
b: round(calc('b')),
a: round(calc('a') * 100) / 100
};
return this._c(rgba);
}
/**
* Mix the color with pure white, from 0 to 100.
* Providing 0 will do nothing, providing 100 will always return white.
*/
tint(amount = 10) {
return this.mix({
r: 255,
g: 255,
b: 255,
a: 1
}, amount);
}
/**
* Mix the color with pure black, from 0 to 100.
* Providing 0 will do nothing, providing 100 will always return black.
*/
shade(amount = 10) {
return this.mix({
r: 0,
g: 0,
b: 0,
a: 1
}, amount);
}
onBackground(background) {
const bg = this._c(background);
const alpha = this.a + bg.a * (1 - this.a);
const calc = key => {
return round((this[key] * this.a + bg[key] * bg.a * (1 - this.a)) / alpha);
};
return this._c({
r: calc('r'),
g: calc('g'),
b: calc('b'),
a: alpha
});
}
// ======================= Status =======================
isDark() {
return this.getBrightness() < 128;
}
isLight() {
return this.getBrightness() >= 128;
}
// ======================== MISC ========================
equals(other) {
return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
}
clone() {
return this._c(this);
}
// ======================= Format =======================
toHexString() {
let hex = '#';
const rHex = (this.r || 0).toString(16);
hex += rHex.length === 2 ? rHex : '0' + rHex;
const gHex = (this.g || 0).toString(16);
hex += gHex.length === 2 ? gHex : '0' + gHex;
const bHex = (this.b || 0).toString(16);
hex += bHex.length === 2 ? bHex : '0' + bHex;
if (typeof this.a === 'number' && this.a >= 0 && this.a < 1) {
const aHex = round(this.a * 255).toString(16);
hex += aHex.length === 2 ? aHex : '0' + aHex;
}
return hex;
}
/** CSS support color pattern */
toHsl() {
return {
h: this.getHue(),
s: this.getHSLSaturation(),
l: this.getLightness(),
a: this.a
};
}
/** CSS support color pattern */
toHslString() {
const h = this.getHue();
const s = round(this.getHSLSaturation() * 100);
const l = round(this.getLightness() * 100);
return this.a !== 1 ? `hsla(${h},${s}%,${l}%,${this.a})` : `hsl(${h},${s}%,${l}%)`;
}
/** Same as toHsb */
toHsv() {
return {
h: this.getHue(),
s: this.getHSVSaturation(),
v: this.getValue(),
a: this.a
};
}
toRgb() {
return {
r: this.r,
g: this.g,
b: this.b,
a: this.a
};
}
toRgbString() {
return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
}
toString() {
return this.toRgbString();
}
// ====================== Privates ======================
/** Return a new FastColor object with one channel changed */
_sc(rgb, value, max) {
const clone = this.clone();
clone[rgb] = limitRange(value, max);
return clone;
}
_c(input) {
return new this.constructor(input);
}
getMax() {
if (typeof this._max === 'undefined') {
this._max = Math.max(this.r, this.g, this.b);
}
return this._max;
}
getMin() {
if (typeof this._min === 'undefined') {
this._min = Math.min(this.r, this.g, this.b);
}
return this._min;
}
fromHexString(trimStr) {
const withoutPrefix = trimStr.replace('#', '');
function connectNum(index1, index2) {
return parseInt(withoutPrefix[index1] + withoutPrefix[index2 || index1], 16);
}
if (withoutPrefix.length < 6) {
// #rgb or #rgba
this.r = connectNum(0);
this.g = connectNum(1);
this.b = connectNum(2);
this.a = withoutPrefix[3] ? connectNum(3) / 255 : 1;
} else {
// #rrggbb or #rrggbbaa
this.r = connectNum(0, 1);
this.g = connectNum(2, 3);
this.b = connectNum(4, 5);
this.a = withoutPrefix[6] ? connectNum(6, 7) / 255 : 1;
}
}
fromHsl({
h: _h,
s,
l,
a
}) {
const h = (_h % 360 + 360) % 360;
this._h = h;
this._hsl_s = s;
this._l = l;
this.a = typeof a === 'number' ? a : 1;
if (s <= 0) {
const rgb = round(l * 255);
this.r = rgb;
this.g = rgb;
this.b = rgb;
return;
}
let r = 0,
g = 0,
b = 0;
const huePrime = h / 60;
const chroma = (1 - Math.abs(2 * l - 1)) * s;
const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
if (huePrime >= 0 && huePrime < 1) {
r = chroma;
g = secondComponent;
} else if (huePrime >= 1 && huePrime < 2) {
r = secondComponent;
g = chroma;
} else if (huePrime >= 2 && huePrime < 3) {
g = chroma;
b = secondComponent;
} else if (huePrime >= 3 && huePrime < 4) {
g = secondComponent;
b = chroma;
} else if (huePrime >= 4 && huePrime < 5) {
r = secondComponent;
b = chroma;
} else if (huePrime >= 5 && huePrime < 6) {
r = chroma;
b = secondComponent;
}
const lightnessModification = l - chroma / 2;
this.r = round((r + lightnessModification) * 255);
this.g = round((g + lightnessModification) * 255);
this.b = round((b + lightnessModification) * 255);
}
fromHsv({
h: _h,
s,
v,
a
}) {
const h = (_h % 360 + 360) % 360;
this._h = h;
this._hsv_s = s;
this._v = v;
this.a = typeof a === 'number' ? a : 1;
const vv = round(v * 255);
this.r = vv;
this.g = vv;
this.b = vv;
if (s <= 0) {
return;
}
const hh = h / 60;
const i = Math.floor(hh);
const ff = hh - i;
const p = round(v * (1.0 - s) * 255);
const q = round(v * (1.0 - s * ff) * 255);
const t = round(v * (1.0 - s * (1.0 - ff)) * 255);
switch (i) {
case 0:
this.g = t;
this.b = p;
break;
case 1:
this.r = q;
this.b = p;
break;
case 2:
this.r = p;
this.b = t;
break;
case 3:
this.r = p;
this.g = q;
break;
case 4:
this.r = t;
this.g = p;
break;
case 5:
default:
this.g = p;
this.b = q;
break;
}
}
fromHsvString(trimStr) {
const cells = splitColorStr(trimStr, parseHSVorHSL);
this.fromHsv({
h: cells[0],
s: cells[1],
v: cells[2],
a: cells[3]
});
}
fromHslString(trimStr) {
const cells = splitColorStr(trimStr, parseHSVorHSL);
this.fromHsl({
h: cells[0],
s: cells[1],
l: cells[2],
a: cells[3]
});
}
fromRgbString(trimStr) {
const cells = splitColorStr(trimStr, (num, txt) =>
// Convert percentage to number. e.g. 50% -> 128
txt.includes('%') ? round(num / 100 * 255) : num);
this.r = cells[0];
this.g = cells[1];
this.b = cells[2];
this.a = cells[3];
}
}
;// ./node_modules/@ant-design/fast-color/es/types.js
;// ./node_modules/@ant-design/fast-color/es/index.js
/***/ }),
/***/ "./node_modules/@ant-design/icons/es/components/AntdIcon.js":
/*!******************************************************************************!*\
!*** ./node_modules/@ant-design/icons/es/components/AntdIcon.js + 3 modules ***!
\******************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ AntdIcon; }
});
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__("react");
var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
// EXTERNAL MODULE: ./node_modules/clsx/dist/clsx.mjs
var clsx = __webpack_require__("./node_modules/clsx/dist/clsx.mjs");
// EXTERNAL MODULE: ./node_modules/@ant-design/colors/es/index.js + 2 modules
var es = __webpack_require__("./node_modules/@ant-design/colors/es/index.js");
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/components/Context.js
var Context = __webpack_require__("./node_modules/@ant-design/icons/es/components/Context.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/Dom/dynamicCSS.js
var dynamicCSS = __webpack_require__("./node_modules/@rc-component/util/es/Dom/dynamicCSS.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/Dom/shadow.js
var shadow = __webpack_require__("./node_modules/@rc-component/util/es/Dom/shadow.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/warning.js
var warning = __webpack_require__("./node_modules/@rc-component/util/es/warning.js");
;// ./node_modules/@ant-design/icons/es/utils.js
function camelCase(input) {
return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
}
function utils_warning(valid, message) {
(0,warning.warningOnce)(valid, `[@ant-design/icons] ${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 normalizeAttrs(attrs = {}) {
return Object.keys(attrs).reduce((acc, key) => {
const val = attrs[key];
switch (key) {
case 'class':
acc.className = val;
delete acc.class;
break;
default:
delete acc[key];
acc[camelCase(key)] = val;
}
return acc;
}, {});
}
function generate(node, key, rootProps) {
if (!rootProps) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(node.tag, {
key,
...normalizeAttrs(node.attrs)
}, (node.children || []).map((child, index) => generate(child, `${key}-${node.tag}-${index}`)));
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(node.tag, {
key,
...normalizeAttrs(node.attrs),
...rootProps
}, (node.children || []).map((child, index) => generate(child, `${key}-${node.tag}-${index}`)));
}
function getSecondaryColor(primaryColor) {
// choose the second color
return (0,es.generate)(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.
// Reference: https://blog.prototypr.io/align-svg-icons-to-text-and-say-goodbye-to-font-icons-d44b3d7b26b4
const svgBaseProps = {
width: '1em',
height: '1em',
fill: 'currentColor',
'aria-hidden': 'true',
focusable: 'false'
};
const iconStyles = `
.anticon {
display: inline-flex;
align-items: center;
color: inherit;
font-style: normal;
line-height: 0;
text-align: center;
text-transform: none;
vertical-align: -0.125em;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.anticon > * {
line-height: 1;
}
.anticon svg {
display: inline-block;
vertical-align: inherit;
}
.anticon::before {
display: none;
}
.anticon .anticon-icon {
display: block;
}
.anticon[tabindex] {
cursor: pointer;
}
.anticon-spin {
-webkit-animation: loadingCircle 1s infinite linear;
animation: loadingCircle 1s infinite linear;
}
@-webkit-keyframes loadingCircle {
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes loadingCircle {
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
`;
const useInsertStyles = eleRef => {
const {
csp,
prefixCls,
layer
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(Context["default"]);
let mergedStyleStr = iconStyles;
if (prefixCls) {
mergedStyleStr = mergedStyleStr.replace(/anticon/g, prefixCls);
}
if (layer) {
mergedStyleStr = `@layer ${layer} {\n${mergedStyleStr}\n}`;
}
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
const ele = eleRef.current;
const shadowRoot = (0,shadow.getShadowRoot)(ele);
(0,dynamicCSS.updateCSS)(mergedStyleStr, '@ant-design-icons', {
prepend: !layer,
csp,
attachTo: shadowRoot
});
}, []);
};
;// ./node_modules/@ant-design/icons/es/components/IconBase.js
const twoToneColorPalette = {
primaryColor: '#333',
secondaryColor: '#E6E6E6',
calculated: false
};
function setTwoToneColors({
primaryColor,
secondaryColor
}) {
twoToneColorPalette.primaryColor = primaryColor;
twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
twoToneColorPalette.calculated = !!secondaryColor;
}
function getTwoToneColors() {
return {
...twoToneColorPalette
};
}
const IconBase = props => {
const {
icon,
className,
onClick,
style,
primaryColor,
secondaryColor,
...restProps
} = props;
const svgRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
let colors = twoToneColorPalette;
if (primaryColor) {
colors = {
primaryColor,
secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
};
}
useInsertStyles(svgRef);
utils_warning(isIconDefinition(icon), `icon should be icon definiton, but got ${icon}`);
if (!isIconDefinition(icon)) {
return null;
}
let target = icon;
if (target && typeof target.icon === 'function') {
target = {
...target,
icon: target.icon(colors.primaryColor, colors.secondaryColor)
};
}
return generate(target.icon, `svg-${target.name}`, {
className,
onClick,
style,
'data-icon': target.name,
width: '1em',
height: '1em',
fill: 'currentColor',
'aria-hidden': 'true',
...restProps,
ref: svgRef
});
};
IconBase.displayName = 'IconReact';
IconBase.getTwoToneColors = getTwoToneColors;
IconBase.setTwoToneColors = setTwoToneColors;
/* harmony default export */ var components_IconBase = (IconBase);
;// ./node_modules/@ant-design/icons/es/components/twoTonePrimaryColor.js
function setTwoToneColor(twoToneColor) {
const [primaryColor, secondaryColor] = normalizeTwoToneColors(twoToneColor);
return components_IconBase.setTwoToneColors({
primaryColor,
secondaryColor
});
}
function getTwoToneColor() {
const colors = components_IconBase.getTwoToneColors();
if (!colors.calculated) {
return colors.primaryColor;
}
return [colors.primaryColor, colors.secondaryColor];
}
;// ./node_modules/@ant-design/icons/es/components/AntdIcon.js
'use client';
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
// Initial setting
// should move it to antd main repo?
setTwoToneColor(es.blue.primary);
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34757#issuecomment-488848720
const Icon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
// affect outter ...
className,
// affect inner
icon,
spin,
rotate,
tabIndex,
onClick,
// other
twoToneColor,
...restProps
} = props;
const {
prefixCls = 'anticon',
rootClassName
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(Context["default"]);
const classString = (0,clsx.clsx)(rootClassName, prefixCls, {
[`${prefixCls}-${icon.name}`]: !!icon.name,
[`${prefixCls}-spin`]: !!spin || icon.name === 'loading'
}, className);
let iconTabIndex = tabIndex;
if (iconTabIndex === undefined && onClick) {
iconTabIndex = -1;
}
const svgStyle = rotate ? {
msTransform: `rotate(${rotate}deg)`,
transform: `rotate(${rotate}deg)`
} : undefined;
const [primaryColor, secondaryColor] = normalizeTwoToneColors(twoToneColor);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", _extends({
role: "img",
"aria-label": icon.name
}, restProps, {
ref: ref,
tabIndex: iconTabIndex,
onClick: onClick,
className: classString
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_IconBase, {
icon: icon,
primaryColor: primaryColor,
secondaryColor: secondaryColor,
style: svgStyle
}));
});
Icon.getTwoToneColor = getTwoToneColor;
Icon.setTwoToneColor = setTwoToneColor;
if (true) {
Icon.displayName = 'AntdIcon';
}
/* harmony default export */ var AntdIcon = (Icon);
/***/ }),
/***/ "./node_modules/@ant-design/icons/es/components/Context.js":
/*!*****************************************************************!*\
!*** ./node_modules/@ant-design/icons/es/components/Context.js ***!
\*****************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
const IconContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)({});
/* harmony default export */ __webpack_exports__["default"] = (IconContext);
/***/ }),
/***/ "./node_modules/@ant-design/icons/es/icons/RightOutlined.js":
/*!******************************************************************************!*\
!*** ./node_modules/@ant-design/icons/es/icons/RightOutlined.js + 1 modules ***!
\******************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ icons_RightOutlined; }
});
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__("react");
;// ./node_modules/@ant-design/icons-svg/es/asn/RightOutlined.js
// This icon file is generated automatically.
var RightOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z" } }] }, "name": "right", "theme": "outlined" };
/* harmony default export */ var asn_RightOutlined = (RightOutlined);
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/components/AntdIcon.js + 3 modules
var AntdIcon = __webpack_require__("./node_modules/@ant-design/icons/es/components/AntdIcon.js");
;// ./node_modules/@ant-design/icons/es/icons/RightOutlined.js
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const RightOutlined_RightOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], _extends({}, props, {
ref: ref,
icon: asn_RightOutlined
}));
/** */
const RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(RightOutlined_RightOutlined);
if (true) {
RefIcon.displayName = 'RightOutlined';
}
/* harmony default export */ var icons_RightOutlined = (RefIcon);
/***/ }),
/***/ "./node_modules/@rc-component/color-picker/es/index.js":
/*!**************************************************************************!*\
!*** ./node_modules/@rc-component/color-picker/es/index.js + 14 modules ***!
\**************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Color: function() { return /* reexport */ Color; },
ColorBlock: function() { return /* reexport */ components_ColorBlock; },
"default": function() { return /* binding */ color_picker_es; }
});
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__("react");
var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
// EXTERNAL MODULE: ./node_modules/@ant-design/fast-color/es/index.js + 3 modules
var es = __webpack_require__("./node_modules/@ant-design/fast-color/es/index.js");
;// ./node_modules/@rc-component/color-picker/es/color.js
const getRoundNumber = value => Math.round(Number(value || 0));
const convertHsb2Hsv = color => {
if (color instanceof es.FastColor) {
return color;
}
if (color && typeof color === 'object' && 'h' in color && 'b' in color) {
const {
b,
...resets
} = color;
return {
...resets,
v: b
};
}
if (typeof color === 'string' && /hsb/.test(color)) {
return color.replace(/hsb/, 'hsv');
}
return color;
};
class Color extends es.FastColor {
constructor(color) {
super(convertHsb2Hsv(color));
}
toHsbString() {
const hsb = this.toHsb();
const saturation = getRoundNumber(hsb.s * 100);
const lightness = getRoundNumber(hsb.b * 100);
const hue = getRoundNumber(hsb.h);
const alpha = hsb.a;
const hsbString = `hsb(${hue}, ${saturation}%, ${lightness}%)`;
const hsbaString = `hsba(${hue}, ${saturation}%, ${lightness}%, ${alpha.toFixed(alpha === 0 ? 0 : 2)})`;
return alpha === 1 ? hsbString : hsbaString;
}
toHsb() {
const {
v,
...resets
} = this.toHsv();
return {
...resets,
b: v,
a: this.a
};
}
}
;// ./node_modules/@rc-component/color-picker/es/util.js
const ColorPickerPrefixCls = 'rc-color-picker';
const generateColor = color => {
if (color instanceof Color) {
return color;
}
return new Color(color);
};
const defaultColor = generateColor('#1677ff');
const calculateColor = props => {
const {
offset,
targetRef,
containerRef,
color,
type
} = props;
const {
width,
height
} = containerRef.current.getBoundingClientRect();
const {
width: targetWidth,
height: targetHeight
} = targetRef.current.getBoundingClientRect();
const centerOffsetX = targetWidth / 2;
const centerOffsetY = targetHeight / 2;
const saturation = (offset.x + centerOffsetX) / width;
const bright = 1 - (offset.y + centerOffsetY) / height;
const hsb = color.toHsb();
const alphaOffset = saturation;
const hueOffset = (offset.x + centerOffsetX) / width * 360;
if (type) {
switch (type) {
case 'hue':
return generateColor({
...hsb,
h: hueOffset <= 0 ? 0 : hueOffset
});
case 'alpha':
return generateColor({
...hsb,
a: alphaOffset <= 0 ? 0 : alphaOffset
});
}
}
return generateColor({
h: hsb.h,
s: saturation <= 0 ? 0 : saturation,
b: bright >= 1 ? 1 : bright,
a: hsb.a
});
};
const calcOffset = (color, type) => {
const hsb = color.toHsb();
switch (type) {
case 'hue':
return {
x: hsb.h / 360 * 100,
y: 50
};
case 'alpha':
return {
x: color.a * 100,
y: 50
};
// Picker panel
default:
return {
x: hsb.s * 100,
y: (1 - hsb.b) * 100
};
}
};
// EXTERNAL MODULE: ./node_modules/clsx/dist/clsx.mjs
var clsx = __webpack_require__("./node_modules/clsx/dist/clsx.mjs");
;// ./node_modules/@rc-component/color-picker/es/components/ColorBlock.js
const ColorBlock = ({
color,
prefixCls,
className,
style,
innerClassName,
innerStyle,
onClick
}) => {
const colorBlockCls = `${prefixCls}-color-block`;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(colorBlockCls, className),
style: style,
onClick: onClick
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${colorBlockCls}-inner`, innerClassName),
style: {
background: color,
...innerStyle
}
}));
};
/* harmony default export */ var components_ColorBlock = (ColorBlock);
;// ./node_modules/@rc-component/color-picker/es/hooks/useColorDrag.js
function getPosition(e) {
const obj = 'touches' in e ? e.touches[0] : e;
const scrollXOffset = document.documentElement.scrollLeft || document.body.scrollLeft || window.pageXOffset;
const scrollYOffset = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset;
return {
pageX: obj.pageX - scrollXOffset,
pageY: obj.pageY - scrollYOffset
};
}
function useColorDrag(props) {
const {
targetRef,
containerRef,
direction,
onDragChange,
onDragChangeComplete,
calculate,
color,
disabledDrag
} = props;
const [offsetValue, setOffsetValue] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
x: 0,
y: 0
});
const mouseMoveRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const mouseUpRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
// Always get position from `color`
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
setOffsetValue(calculate());
}, [color]);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => () => {
document.removeEventListener('mousemove', mouseMoveRef.current);
document.removeEventListener('mouseup', mouseUpRef.current);
document.removeEventListener('touchmove', mouseMoveRef.current);
document.removeEventListener('touchend', mouseUpRef.current);
mouseMoveRef.current = null;
mouseUpRef.current = null;
}, []);
const updateOffset = e => {
const {
pageX,
pageY
} = getPosition(e);
const {
x: rectX,
y: rectY,
width,
height
} = containerRef.current.getBoundingClientRect();
const {
width: targetWidth,
height: targetHeight
} = targetRef.current.getBoundingClientRect();
const centerOffsetX = targetWidth / 2;
const centerOffsetY = targetHeight / 2;
const offsetX = Math.max(0, Math.min(pageX - rectX, width)) - centerOffsetX;
const offsetY = Math.max(0, Math.min(pageY - rectY, height)) - centerOffsetY;
const calcOffset = {
x: offsetX,
y: direction === 'x' ? offsetValue.y : offsetY
};
// Exclusion of boundary cases
if (targetWidth === 0 && targetHeight === 0 || targetWidth !== targetHeight) {
return false;
}
onDragChange?.(calcOffset);
};
const onDragMove = e => {
e.preventDefault();
updateOffset(e);
};
const onDragStop = e => {
e.preventDefault();
document.removeEventListener('mousemove', mouseMoveRef.current);
document.removeEventListener('mouseup', mouseUpRef.current);
document.removeEventListener('touchmove', mouseMoveRef.current);
document.removeEventListener('touchend', mouseUpRef.current);
mouseMoveRef.current = null;
mouseUpRef.current = null;
onDragChangeComplete?.();
};
const onDragStart = e => {
// https://github.com/ant-design/ant-design/issues/43529
document.removeEventListener('mousemove', mouseMoveRef.current);
document.removeEventListener('mouseup', mouseUpRef.current);
if (disabledDrag) {
return;
}
updateOffset(e);
document.addEventListener('mousemove', onDragMove);
document.addEventListener('mouseup', onDragStop);
document.addEventListener('touchmove', onDragMove);
document.addEventListener('touchend', onDragStop);
mouseMoveRef.current = onDragMove;
mouseUpRef.current = onDragStop;
};
return [offsetValue, onDragStart];
}
/* harmony default export */ var hooks_useColorDrag = (useColorDrag);
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/index.js + 2 modules
var util_es = __webpack_require__("./node_modules/@rc-component/util/es/index.js");
;// ./node_modules/@rc-component/color-picker/es/components/Handler.js
const Handler = ({
size = 'default',
color,
prefixCls
}) => {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-handler`, {
[`${prefixCls}-handler-sm`]: size === 'small'
}),
style: {
backgroundColor: color
}
});
};
/* harmony default export */ var components_Handler = (Handler);
;// ./node_modules/@rc-component/color-picker/es/components/Palette.js
const Palette = ({
children,
style,
prefixCls
}) => {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${prefixCls}-palette`,
style: {
position: 'relative',
...style
}
}, children);
};
/* harmony default export */ var components_Palette = (Palette);
;// ./node_modules/@rc-component/color-picker/es/components/Transform.js
const Transform = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((props, ref) => {
const {
children,
x,
y
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
ref: ref,
style: {
position: 'absolute',
left: `${x}%`,
top: `${y}%`,
zIndex: 1,
transform: 'translate(-50%, -50%)'
}
}, children);
});
/* harmony default export */ var components_Transform = (Transform);
;// ./node_modules/@rc-component/color-picker/es/components/Picker.js
const Picker = ({
color,
onChange,
prefixCls,
onChangeComplete,
disabled
}) => {
const pickerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
const transformRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
const colorRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(color);
const onDragChange = (0,util_es.useEvent)(offsetValue => {
const calcColor = calculateColor({
offset: offsetValue,
targetRef: transformRef,
containerRef: pickerRef,
color
});
colorRef.current = calcColor;
onChange(calcColor);
});
const [offset, dragStartHandle] = hooks_useColorDrag({
color,
containerRef: pickerRef,
targetRef: transformRef,
calculate: () => calcOffset(color),
onDragChange,
onDragChangeComplete: () => onChangeComplete?.(colorRef.current),
disabledDrag: disabled
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
ref: pickerRef,
className: `${prefixCls}-select`,
onMouseDown: dragStartHandle,
onTouchStart: dragStartHandle
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_Palette, {
prefixCls: prefixCls
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_Transform, {
x: offset.x,
y: offset.y,
ref: transformRef
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_Handler, {
color: color.toRgbString(),
prefixCls: prefixCls
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${prefixCls}-saturation`,
style: {
backgroundColor: `hsl(${color.toHsb().h},100%, 50%)`,
backgroundImage: 'linear-gradient(0deg, #000, transparent),linear-gradient(90deg, #fff, hsla(0, 0%, 100%, 0))'
}
})));
};
/* harmony default export */ var components_Picker = (Picker);
;// ./node_modules/@rc-component/color-picker/es/hooks/useColorState.js
const useColorState = (defaultValue, value) => {
const [mergedValue, setValue] = (0,util_es.useControlledState)(defaultValue, value);
const color = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => generateColor(mergedValue), [mergedValue]);
return [color, setValue];
};
/* harmony default export */ var hooks_useColorState = (useColorState);
;// ./node_modules/@rc-component/color-picker/es/components/Gradient.js
const Gradient = ({
colors,
children,
direction = 'to right',
type,
prefixCls
}) => {
const gradientColors = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => colors.map((color, idx) => {
let result = generateColor(color);
if (type === 'alpha' && idx === colors.length - 1) {
result = new Color(result.setA(1));
}
return result.toRgbString();
}).join(','), [colors, type]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${prefixCls}-gradient`,
style: {
position: 'absolute',
inset: 0,
background: `linear-gradient(${direction}, ${gradientColors})`
}
}, children);
};
/* harmony default export */ var components_Gradient = (Gradient);
;// ./node_modules/@rc-component/color-picker/es/components/Slider.js
const Slider = props => {
const {
prefixCls,
colors,
disabled,
onChange,
onChangeComplete,
color,
type
} = props;
const sliderRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const transformRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const colorRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(color);
const getValue = c => {
return type === 'hue' ? c.getHue() : c.a * 100;
};
const onDragChange = (0,util_es.useEvent)(offsetValue => {
const calcColor = calculateColor({
offset: offsetValue,
targetRef: transformRef,
containerRef: sliderRef,
color,
type
});
colorRef.current = calcColor;
onChange(getValue(calcColor));
});
const [offset, dragStartHandle] = hooks_useColorDrag({
color,
targetRef: transformRef,
containerRef: sliderRef,
calculate: () => calcOffset(color, type),
onDragChange,
onDragChangeComplete() {
onChangeComplete(getValue(colorRef.current));
},
direction: 'x',
disabledDrag: disabled
});
const handleColor = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
if (type === 'hue') {
const hsb = color.toHsb();
hsb.s = 1;
hsb.b = 1;
hsb.a = 1;
const lightColor = new Color(hsb);
return lightColor;
}
return color;
}, [color, type]);
// ========================= Gradient =========================
const gradientList = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => colors.map(info => `${info.color} ${info.percent}%`), [colors]);
// ========================== Render ==========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
ref: sliderRef,
className: (0,clsx.clsx)(`${prefixCls}-slider`, `${prefixCls}-slider-${type}`),
onMouseDown: dragStartHandle,
onTouchStart: dragStartHandle
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_Palette, {
prefixCls: prefixCls
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_Transform, {
x: offset.x,
y: offset.y,
ref: transformRef
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_Handler, {
size: "small",
color: handleColor.toHexString(),
prefixCls: prefixCls
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_Gradient, {
colors: gradientList,
type: type,
prefixCls: prefixCls
})));
};
/* harmony default export */ var components_Slider = (Slider);
;// ./node_modules/@rc-component/color-picker/es/hooks/useComponent.js
function useComponent(components) {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const {
slider
} = components || {};
return [slider || components_Slider];
}, [components]);
}
;// ./node_modules/@rc-component/color-picker/es/ColorPicker.js
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
const HUE_COLORS = [{
color: 'rgb(255, 0, 0)',
percent: 0
}, {
color: 'rgb(255, 255, 0)',
percent: 17
}, {
color: 'rgb(0, 255, 0)',
percent: 33
}, {
color: 'rgb(0, 255, 255)',
percent: 50
}, {
color: 'rgb(0, 0, 255)',
percent: 67
}, {
color: 'rgb(255, 0, 255)',
percent: 83
}, {
color: 'rgb(255, 0, 0)',
percent: 100
}];
const ColorPicker = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((props, ref) => {
const {
value,
defaultValue,
prefixCls = ColorPickerPrefixCls,
onChange,
onChangeComplete,
className,
style,
panelRender,
disabledAlpha = false,
disabled = false,
components
} = props;
// ========================== Components ==========================
const [Slider] = useComponent(components);
// ============================ Color =============================
const [colorValue, setColorValue] = hooks_useColorState(defaultValue || defaultColor, value);
const alphaColor = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => colorValue.setA(1).toRgbString(), [colorValue]);
// ============================ Events ============================
const handleChange = (data, type) => {
if (!value) {
setColorValue(data);
}
onChange?.(data, type);
};
// Convert
const getHueColor = hue => new Color(colorValue.setHue(hue));
const getAlphaColor = alpha => new Color(colorValue.setA(alpha / 100));
// Slider change
const onHueChange = hue => {
handleChange(getHueColor(hue), {
type: 'hue',
value: hue
});
};
const onAlphaChange = alpha => {
handleChange(getAlphaColor(alpha), {
type: 'alpha',
value: alpha
});
};
// Complete
const onHueChangeComplete = hue => {
if (onChangeComplete) {
onChangeComplete(getHueColor(hue));
}
};
const onAlphaChangeComplete = alpha => {
if (onChangeComplete) {
onChangeComplete(getAlphaColor(alpha));
}
};
// ============================ Render ============================
const mergeCls = (0,clsx.clsx)(`${prefixCls}-panel`, className, {
[`${prefixCls}-panel-disabled`]: disabled
});
const sharedSliderProps = {
prefixCls,
disabled,
color: colorValue
};
const defaultPanel = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_Picker, _extends({
onChange: handleChange
}, sharedSliderProps, {
onChangeComplete: onChangeComplete
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${prefixCls}-slider-container`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-slider-group`, {
[`${prefixCls}-slider-group-disabled-alpha`]: disabledAlpha
})
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Slider, _extends({}, sharedSliderProps, {
type: "hue",
colors: HUE_COLORS,
min: 0,
max: 359,
value: colorValue.getHue(),
onChange: onHueChange,
onChangeComplete: onHueChangeComplete
})), !disabledAlpha && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Slider, _extends({}, sharedSliderProps, {
type: "alpha",
colors: [{
percent: 0,
color: 'rgba(255, 0, 4, 0)'
}, {
percent: 100,
color: alphaColor
}],
min: 0,
max: 100,
value: colorValue.a * 100,
onChange: onAlphaChange,
onChangeComplete: onAlphaChangeComplete
}))), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_ColorBlock, {
color: colorValue.toRgbString(),
prefixCls: prefixCls
})));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: mergeCls,
style: style,
ref: ref
}, typeof panelRender === 'function' ? panelRender(defaultPanel) : defaultPanel);
});
if (true) {
ColorPicker.displayName = 'ColorPicker';
}
/* harmony default export */ var es_ColorPicker = (ColorPicker);
;// ./node_modules/@rc-component/color-picker/es/interface.js
;// ./node_modules/@rc-component/color-picker/es/index.js
/* harmony default export */ var color_picker_es = (es_ColorPicker);
/***/ }),
/***/ "./node_modules/@rc-component/motion/es/index.js":
/*!********************************************************************!*\
!*** ./node_modules/@rc-component/motion/es/index.js + 12 modules ***!
\********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
CSSMotionList: function() { return /* reexport */ CSSMotionList; },
Provider: function() { return /* reexport */ context; },
"default": function() { return /* binding */ motion_es; }
});
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/Dom/findDOMNode.js
var findDOMNode = __webpack_require__("./node_modules/@rc-component/util/es/Dom/findDOMNode.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/ref.js
var es_ref = __webpack_require__("./node_modules/@rc-component/util/es/ref.js");
// EXTERNAL MODULE: ./node_modules/clsx/dist/clsx.mjs
var clsx = __webpack_require__("./node_modules/clsx/dist/clsx.mjs");
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__("react");
;// ./node_modules/@rc-component/motion/es/context.js
const Context = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({});
const MotionProvider = props => {
const {
children,
...rest
} = props;
const memoizedValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
return {
motion: rest.motion
};
}, [rest.motion]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Context.Provider, {
value: memoizedValue
}, children);
};
/* harmony default export */ var context = (MotionProvider);
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/index.js + 2 modules
var es = __webpack_require__("./node_modules/@rc-component/util/es/index.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/hooks/useEvent.js
var useEvent = __webpack_require__("./node_modules/@rc-component/util/es/hooks/useEvent.js");
;// ./node_modules/@rc-component/util/es/hooks/useSyncState.js
/**
* Same as React.useState but will always get latest state.
* This is useful when React merge multiple state updates into one.
* e.g. onTransitionEnd trigger multiple event at once will be merged state update in React.
*/
function useSyncState(defaultValue) {
const [, forceUpdate] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useReducer(x => x + 1, 0);
const currentValueRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(defaultValue);
const getValue = (0,useEvent["default"])(() => {
return currentValueRef.current;
});
const setValue = (0,useEvent["default"])(updater => {
currentValueRef.current = typeof updater === 'function' ? updater(currentValueRef.current) : updater;
forceUpdate();
});
return [getValue, setValue];
}
/* harmony default export */ var hooks_useSyncState = (useSyncState);
;// ./node_modules/@rc-component/motion/es/interface.js
const STATUS_NONE = 'none';
const STATUS_APPEAR = 'appear';
const STATUS_ENTER = 'enter';
const STATUS_LEAVE = 'leave';
const STEP_NONE = 'none';
const STEP_PREPARE = 'prepare';
const STEP_START = 'start';
const STEP_ACTIVE = 'active';
const STEP_ACTIVATED = 'end';
/**
* Used for disabled motion case.
* Prepare stage will still work but start & active will be skipped.
*/
const STEP_PREPARED = 'prepared';
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/Dom/canUseDom.js
var canUseDom = __webpack_require__("./node_modules/@rc-component/util/es/Dom/canUseDom.js");
;// ./node_modules/@rc-component/motion/es/util/motion.js
// ================= Transition =================
// Event wrapper. Copy from react source code
function makePrefixMap(styleProp, eventName) {
const prefixes = {};
prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
prefixes[`Webkit${styleProp}`] = `webkit${eventName}`;
prefixes[`Moz${styleProp}`] = `moz${eventName}`;
prefixes[`ms${styleProp}`] = `MS${eventName}`;
prefixes[`O${styleProp}`] = `o${eventName.toLowerCase()}`;
return prefixes;
}
function getVendorPrefixes(domSupport, win) {
const prefixes = {
animationend: makePrefixMap('Animation', 'AnimationEnd'),
transitionend: makePrefixMap('Transition', 'TransitionEnd')
};
if (domSupport) {
if (!('AnimationEvent' in win)) {
delete prefixes.animationend.animation;
}
if (!('TransitionEvent' in win)) {
delete prefixes.transitionend.transition;
}
}
return prefixes;
}
const vendorPrefixes = getVendorPrefixes((0,canUseDom["default"])(), typeof window !== 'undefined' ? window : {});
let style = {};
if ((0,canUseDom["default"])()) {
({
style
} = document.createElement('div'));
}
const prefixedEventNames = {};
function getVendorPrefixedEventName(eventName) {
if (prefixedEventNames[eventName]) {
return prefixedEventNames[eventName];
}
const prefixMap = vendorPrefixes[eventName];
if (prefixMap) {
const stylePropList = Object.keys(prefixMap);
const len = stylePropList.length;
for (let i = 0; i < len; i += 1) {
const styleProp = stylePropList[i];
if (Object.prototype.hasOwnProperty.call(prefixMap, styleProp) && styleProp in style) {
prefixedEventNames[eventName] = prefixMap[styleProp];
return prefixedEventNames[eventName];
}
}
}
return '';
}
const internalAnimationEndName = getVendorPrefixedEventName('animationend');
const internalTransitionEndName = getVendorPrefixedEventName('transitionend');
const supportTransition = !!(internalAnimationEndName && internalTransitionEndName);
const animationEndName = internalAnimationEndName || 'animationend';
const transitionEndName = internalTransitionEndName || 'transitionend';
function getTransitionName(transitionName, transitionType) {
if (!transitionName) return null;
if (typeof transitionName === 'object') {
const type = transitionType.replace(/-\w/g, match => match[1].toUpperCase());
return transitionName[type];
}
return `${transitionName}-${transitionType}`;
}
;// ./node_modules/@rc-component/motion/es/hooks/useDomMotionEvents.js
/* harmony default export */ var useDomMotionEvents = (onInternalMotionEnd => {
const cacheElementRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
// Remove events
function removeMotionEvents(element) {
if (element) {
element.removeEventListener(transitionEndName, onInternalMotionEnd);
element.removeEventListener(animationEndName, onInternalMotionEnd);
}
}
// Patch events
function patchMotionEvents(element) {
if (cacheElementRef.current && cacheElementRef.current !== element) {
removeMotionEvents(cacheElementRef.current);
}
if (element && element !== cacheElementRef.current) {
element.addEventListener(transitionEndName, onInternalMotionEnd);
element.addEventListener(animationEndName, onInternalMotionEnd);
// Save as cache in case dom removed trigger by `motionDeadline`
cacheElementRef.current = element;
}
}
// Clean up when removed
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => () => {
removeMotionEvents(cacheElementRef.current);
cacheElementRef.current = null;
}, []);
return [patchMotionEvents, removeMotionEvents];
});
(Object.getOwnPropertyDescriptor(useDomMotionEvents, "name") || {}).writable || Object.defineProperty(useDomMotionEvents, "name", { value: "default", configurable: true });
;// ./node_modules/@rc-component/motion/es/hooks/useIsomorphicLayoutEffect.js
// It's safe to use `useLayoutEffect` but the warning is annoying
const useIsomorphicLayoutEffect = (0,canUseDom["default"])() ? external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect : external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect;
/* harmony default export */ var hooks_useIsomorphicLayoutEffect = (useIsomorphicLayoutEffect);
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/hooks/useState.js
var useState = __webpack_require__("./node_modules/@rc-component/util/es/hooks/useState.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/raf.js
var raf = __webpack_require__("./node_modules/@rc-component/util/es/raf.js");
;// ./node_modules/@rc-component/motion/es/hooks/useNextFrame.js
/* harmony default export */ var useNextFrame = (() => {
const nextFrameRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
function cancelNextFrame() {
raf["default"].cancel(nextFrameRef.current);
}
function nextFrame(callback, delay = 2) {
cancelNextFrame();
const nextFrameId = (0,raf["default"])(() => {
if (delay <= 1) {
callback({
isCanceled: () => nextFrameId !== nextFrameRef.current
});
} else {
nextFrame(callback, delay - 1);
}
});
nextFrameRef.current = nextFrameId;
}
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => () => {
cancelNextFrame();
}, []);
return [nextFrame, cancelNextFrame];
});
(Object.getOwnPropertyDescriptor(useNextFrame, "name") || {}).writable || Object.defineProperty(useNextFrame, "name", { value: "default", configurable: true });
;// ./node_modules/@rc-component/motion/es/hooks/useStepQueue.js
const FULL_STEP_QUEUE = [STEP_PREPARE, STEP_START, STEP_ACTIVE, STEP_ACTIVATED];
const SIMPLE_STEP_QUEUE = [STEP_PREPARE, STEP_PREPARED];
/** Skip current step */
const SkipStep = false;
/** Current step should be update in */
const DoStep = true;
function isActive(step) {
return step === STEP_ACTIVE || step === STEP_ACTIVATED;
}
/* harmony default export */ var useStepQueue = ((status, prepareOnly, callback) => {
const [step, setStep] = (0,useState["default"])(STEP_NONE);
const [nextFrame, cancelNextFrame] = useNextFrame();
function startQueue() {
setStep(STEP_PREPARE, true);
}
const STEP_QUEUE = prepareOnly ? SIMPLE_STEP_QUEUE : FULL_STEP_QUEUE;
hooks_useIsomorphicLayoutEffect(() => {
if (step !== STEP_NONE && step !== STEP_ACTIVATED) {
const index = STEP_QUEUE.indexOf(step);
const nextStep = STEP_QUEUE[index + 1];
const result = callback(step);
if (result === SkipStep) {
// Skip when no needed
setStep(nextStep, true);
} else if (nextStep) {
// Do as frame for step update
nextFrame(info => {
function doNext() {
// Skip since current queue is ood
if (info.isCanceled()) return;
setStep(nextStep, true);
}
if (result === true) {
doNext();
} else {
// Only promise should be async
Promise.resolve(result).then(doNext);
}
});
}
}
}, [status, step]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => () => {
cancelNextFrame();
}, []);
return [startQueue, step];
});
(Object.getOwnPropertyDescriptor(useStepQueue, "name") || {}).writable || Object.defineProperty(useStepQueue, "name", { value: "default", configurable: true });
;// ./node_modules/@rc-component/motion/es/hooks/useStatus.js
function useStatus(supportMotion, visible, getElement, {
motionEnter = true,
motionAppear = true,
motionLeave = true,
motionDeadline,
motionLeaveImmediately,
onAppearPrepare,
onEnterPrepare,
onLeavePrepare,
onAppearStart,
onEnterStart,
onLeaveStart,
onAppearActive,
onEnterActive,
onLeaveActive,
onAppearEnd,
onEnterEnd,
onLeaveEnd,
onVisibleChanged
}) {
// Used for outer render usage to avoid `visible: false & status: none` to render nothing
const [asyncVisible, setAsyncVisible] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState();
const [getStatus, setStatus] = hooks_useSyncState(STATUS_NONE);
const [style, setStyle] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([null, null]);
const currentStatus = getStatus();
const mountedRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
const deadlineRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
// =========================== Dom Node ===========================
function getDomElement() {
return getElement();
}
// ========================== Motion End ==========================
const activeRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
/**
* Clean up status & style
*/
function updateMotionEndStatus() {
setStatus(STATUS_NONE);
setStyle([null, null]);
}
const onInternalMotionEnd = (0,es.useEvent)(event => {
const status = getStatus();
// Do nothing since not in any transition status.
// This may happen when `motionDeadline` trigger.
if (status === STATUS_NONE) {
return;
}
const element = getDomElement();
if (event && !event.deadline && event.target !== element) {
// event exists
// not initiated by deadline
// transitionEnd not fired by inner elements
return;
}
const currentActive = activeRef.current;
let canEnd;
if (status === STATUS_APPEAR && currentActive) {
canEnd = onAppearEnd?.(element, event);
} else if (status === STATUS_ENTER && currentActive) {
canEnd = onEnterEnd?.(element, event);
} else if (status === STATUS_LEAVE && currentActive) {
canEnd = onLeaveEnd?.(element, event);
}
// Only update status when `canEnd` and not destroyed
if (currentActive && canEnd !== false) {
updateMotionEndStatus();
}
});
const [patchMotionEvents] = useDomMotionEvents(onInternalMotionEnd);
// ============================= Step =============================
const getEventHandlers = targetStatus => {
switch (targetStatus) {
case STATUS_APPEAR:
return {
[STEP_PREPARE]: onAppearPrepare,
[STEP_START]: onAppearStart,
[STEP_ACTIVE]: onAppearActive
};
case STATUS_ENTER:
return {
[STEP_PREPARE]: onEnterPrepare,
[STEP_START]: onEnterStart,
[STEP_ACTIVE]: onEnterActive
};
case STATUS_LEAVE:
return {
[STEP_PREPARE]: onLeavePrepare,
[STEP_START]: onLeaveStart,
[STEP_ACTIVE]: onLeaveActive
};
default:
return {};
}
};
const eventHandlers = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => getEventHandlers(currentStatus), [currentStatus]);
const [startStep, step] = useStepQueue(currentStatus, !supportMotion, newStep => {
// Only prepare step can be skip
if (newStep === STEP_PREPARE) {
const onPrepare = eventHandlers[STEP_PREPARE];
if (!onPrepare) {
return SkipStep;
}
return onPrepare(getDomElement());
}
// Rest step is sync update
if (newStep in eventHandlers) {
setStyle([eventHandlers[newStep]?.(getDomElement(), null) || null, newStep]);
}
if (newStep === STEP_ACTIVE && currentStatus !== STATUS_NONE) {
// Patch events when motion needed
patchMotionEvents(getDomElement());
if (motionDeadline > 0) {
clearTimeout(deadlineRef.current);
deadlineRef.current = setTimeout(() => {
onInternalMotionEnd({
deadline: true
});
}, motionDeadline);
}
}
if (newStep === STEP_PREPARED) {
updateMotionEndStatus();
}
return DoStep;
});
const active = isActive(step);
activeRef.current = active;
// ============================ Status ============================
const visibleRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
// Update with new status
hooks_useIsomorphicLayoutEffect(() => {
// When use Suspense, the `visible` will repeat trigger,
// But not real change of the `visible`, we need to skip it.
// https://github.com/ant-design/ant-design/issues/44379
if (mountedRef.current && visibleRef.current === visible) {
return;
}
setAsyncVisible(visible);
const isMounted = mountedRef.current;
mountedRef.current = true;
// if (!supportMotion) {
// return;
// }
let nextStatus;
// Appear
if (!isMounted && visible && motionAppear) {
nextStatus = STATUS_APPEAR;
}
// Enter
if (isMounted && visible && motionEnter) {
nextStatus = STATUS_ENTER;
}
// Leave
if (isMounted && !visible && motionLeave || !isMounted && motionLeaveImmediately && !visible && motionLeave) {
nextStatus = STATUS_LEAVE;
}
const nextEventHandlers = getEventHandlers(nextStatus);
// Update to next status
if (nextStatus && (supportMotion || nextEventHandlers[STEP_PREPARE])) {
setStatus(nextStatus);
startStep();
} else {
// Set back in case no motion but prev status has prepare step
setStatus(STATUS_NONE);
}
visibleRef.current = visible;
}, [visible]);
// ============================ Effect ============================
// Reset when motion changed
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (
// Cancel appear
currentStatus === STATUS_APPEAR && !motionAppear ||
// Cancel enter
currentStatus === STATUS_ENTER && !motionEnter ||
// Cancel leave
currentStatus === STATUS_LEAVE && !motionLeave) {
setStatus(STATUS_NONE);
}
}, [motionAppear, motionEnter, motionLeave]);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => () => {
mountedRef.current = false;
clearTimeout(deadlineRef.current);
}, []);
// Trigger `onVisibleChanged`
const firstMountChangeRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
// [visible & motion not end] => [!visible & motion end] still need trigger onVisibleChanged
if (asyncVisible) {
firstMountChangeRef.current = true;
}
if (asyncVisible !== undefined && currentStatus === STATUS_NONE) {
// Skip first render is invisible since it's nothing changed
if (firstMountChangeRef.current || asyncVisible) {
onVisibleChanged?.(asyncVisible);
}
firstMountChangeRef.current = true;
}
}, [asyncVisible, currentStatus]);
// ============================ Styles ============================
let mergedStyle = style[0];
if (eventHandlers[STEP_PREPARE] && step === STEP_START) {
mergedStyle = {
transition: 'none',
...mergedStyle
};
}
const styleStep = style[1];
return [getStatus, step, mergedStyle, asyncVisible ?? visible,
// Appear Check
!mountedRef.current && currentStatus === STATUS_NONE && supportMotion && motionAppear ? 'NONE' :
// Enter or Leave check
step === STEP_START || step === STEP_ACTIVE ? styleStep === step : true];
}
;// ./node_modules/@rc-component/motion/es/CSSMotion.js
/* eslint-disable react/default-props-match-prop-types, react/no-multi-comp, react/prop-types */
function isRefNotConsumed(children) {
return children?.length < 2;
}
/**
* `transitionSupport` is used for none transition test case.
* Default we use browser transition event support check.
*/
function genCSSMotion(config) {
let transitionSupport = config;
if (typeof config === 'object') {
({
transitionSupport
} = config);
}
function isSupportTransition(props, contextMotion) {
return !!(props.motionName && transitionSupport && contextMotion !== false);
}
const CSSMotion = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
// Default config
visible = true,
removeOnLeave = true,
forceRender,
children,
motionName,
leavedClassName,
eventProps
} = props;
const {
motion: contextMotion
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(Context);
const supportMotion = isSupportTransition(props, contextMotion);
// Ref to the react node, it may be a HTMLElement
const nodeRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
function getDomElement() {
return (0,findDOMNode.getDOM)(nodeRef.current);
}
const [getStatus, statusStep, statusStyle, mergedVisible, styleReady] = useStatus(supportMotion, visible, getDomElement, props);
const status = getStatus();
// Record whether content has rendered
// Will return null for un-rendered even when `removeOnLeave={false}`
const renderedRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(mergedVisible);
if (mergedVisible) {
renderedRef.current = true;
}
// ====================== Refs ======================
const refObj = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const obj = {};
Object.defineProperties(obj, {
nativeElement: {
enumerable: true,
get: getDomElement
},
inMotion: {
enumerable: true,
get: () => () => getStatus() !== STATUS_NONE
},
enableMotion: {
enumerable: true,
get: () => () => supportMotion
}
});
return obj;
}, []);
// We lock `deps` here since function return object
// will repeat trigger ref from `refConfig` -> `null` -> `refConfig`
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => refObj, []);
// ===================== Render =====================
// return motionChildren as React.ReactElement;
const idRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(0);
if (styleReady) {
idRef.current += 1;
}
// We should render children when motionStyle is sync with stepStatus
const returnNode = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (styleReady === 'NONE') {
return null;
}
let motionChildren;
const mergedProps = {
...eventProps,
visible
};
if (!children) {
// No children
motionChildren = null;
} else if (status === STATUS_NONE) {
// Stable children
if (mergedVisible) {
motionChildren = children({
...mergedProps
}, nodeRef);
} else if (!removeOnLeave && renderedRef.current && leavedClassName) {
motionChildren = children({
...mergedProps,
className: leavedClassName
}, nodeRef);
} else if (forceRender || !removeOnLeave && !leavedClassName) {
motionChildren = children({
...mergedProps,
style: {
display: 'none'
}
}, nodeRef);
} else {
motionChildren = null;
}
} else {
// In motion
let statusSuffix;
if (statusStep === STEP_PREPARE) {
statusSuffix = 'prepare';
} else if (isActive(statusStep)) {
statusSuffix = 'active';
} else if (statusStep === STEP_START) {
statusSuffix = 'start';
}
const motionCls = getTransitionName(motionName, `${status}-${statusSuffix}`);
motionChildren = children({
...mergedProps,
className: (0,clsx.clsx)(getTransitionName(motionName, status), {
[motionCls]: motionCls && statusSuffix,
[motionName]: typeof motionName === 'string'
}),
style: statusStyle
}, nodeRef);
}
return motionChildren;
}, [idRef.current]);
if (isRefNotConsumed(children) && (0,es_ref.supportNodeRef)(returnNode)) {
const originNodeRef = (0,es_ref.getNodeRef)(returnNode);
if (originNodeRef !== nodeRef) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement(returnNode, {
ref: (0,es_ref.composeRef)(originNodeRef, nodeRef)
});
}
}
return returnNode;
});
CSSMotion.displayName = 'CSSMotion';
return CSSMotion;
}
/* harmony default export */ var es_CSSMotion = (genCSSMotion(supportTransition));
;// ./node_modules/@rc-component/motion/es/util/diff.js
const STATUS_ADD = 'add';
const STATUS_KEEP = 'keep';
const STATUS_REMOVE = 'remove';
const STATUS_REMOVED = 'removed';
function wrapKeyToObject(key) {
let keyObj;
if (key && typeof key === 'object' && 'key' in key) {
keyObj = key;
} else {
keyObj = {
key: key
};
}
return {
...keyObj,
key: String(keyObj.key)
};
}
function parseKeys(keys = []) {
return keys.map(wrapKeyToObject);
}
function diffKeys(prevKeys = [], currentKeys = []) {
let list = [];
let currentIndex = 0;
const currentLen = currentKeys.length;
const prevKeyObjects = parseKeys(prevKeys);
const currentKeyObjects = parseKeys(currentKeys);
// Check prev keys to insert or keep
prevKeyObjects.forEach(keyObj => {
let hit = false;
for (let i = currentIndex; i < currentLen; i += 1) {
const currentKeyObj = currentKeyObjects[i];
if (currentKeyObj.key === keyObj.key) {
// New added keys should add before current key
if (currentIndex < i) {
list = list.concat(currentKeyObjects.slice(currentIndex, i).map(obj => ({
...obj,
status: STATUS_ADD
})));
currentIndex = i;
}
list.push({
...currentKeyObj,
status: STATUS_KEEP
});
currentIndex += 1;
hit = true;
break;
}
}
// If not hit, it means key is removed
if (!hit) {
list.push({
...keyObj,
status: STATUS_REMOVE
});
}
});
// Add rest to the list
if (currentIndex < currentLen) {
list = list.concat(currentKeyObjects.slice(currentIndex).map(obj => ({
...obj,
status: STATUS_ADD
})));
}
/**
* Merge same key when it remove and add again:
* [1 - add, 2 - keep, 1 - remove] -> [1 - keep, 2 - keep]
*/
const keys = {};
list.forEach(({
key
}) => {
keys[key] = (keys[key] || 0) + 1;
});
const duplicatedKeys = Object.keys(keys).filter(key => keys[key] > 1);
duplicatedKeys.forEach(matchKey => {
// Remove `STATUS_REMOVE` node.
list = list.filter(({
key,
status
}) => key !== matchKey || status !== STATUS_REMOVE);
// Update `STATUS_ADD` to `STATUS_KEEP`
list.forEach(node => {
if (node.key === matchKey) {
// eslint-disable-next-line no-param-reassign
node.status = STATUS_KEEP;
}
});
});
return list;
}
;// ./node_modules/@rc-component/motion/es/CSSMotionList.js
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
/* eslint react/prop-types: 0 */
const MOTION_PROP_NAMES = ['eventProps', 'visible', 'children', 'motionName', 'motionAppear', 'motionEnter', 'motionLeave', 'motionLeaveImmediately', 'motionDeadline', 'removeOnLeave', 'leavedClassName', 'onAppearPrepare', 'onAppearStart', 'onAppearActive', 'onAppearEnd', 'onEnterStart', 'onEnterActive', 'onEnterEnd', 'onLeaveStart', 'onLeaveActive', 'onLeaveEnd'];
/**
* Generate a CSSMotionList component with config
* @param transitionSupport No need since CSSMotionList no longer depends on transition support
* @param CSSMotion CSSMotion component
*/
function genCSSMotionList(transitionSupport, CSSMotion = es_CSSMotion) {
class CSSMotionList extends external_root_React_commonjs2_react_commonjs_react_amd_react_.Component {
static defaultProps = {
component: 'div'
};
state = {
keyEntities: []
};
static getDerivedStateFromProps({
keys
}, {
keyEntities
}) {
const parsedKeyObjects = parseKeys(keys);
const mixedKeyEntities = diffKeys(keyEntities, parsedKeyObjects);
return {
keyEntities: mixedKeyEntities.filter(entity => {
const prevEntity = keyEntities.find(({
key
}) => entity.key === key);
// Remove if already mark as removed
if (prevEntity && prevEntity.status === STATUS_REMOVED && entity.status === STATUS_REMOVE) {
return false;
}
return true;
})
};
}
// ZombieJ: Return the count of rest keys. It's safe to refactor if need more info.
removeKey = removeKey => {
this.setState(prevState => {
const nextKeyEntities = prevState.keyEntities.map(entity => {
if (entity.key !== removeKey) return entity;
return {
...entity,
status: STATUS_REMOVED
};
});
return {
keyEntities: nextKeyEntities
};
}, () => {
const {
keyEntities
} = this.state;
const restKeysCount = keyEntities.filter(({
status
}) => status !== STATUS_REMOVED).length;
if (restKeysCount === 0 && this.props.onAllRemoved) {
this.props.onAllRemoved();
}
});
};
render() {
const {
keyEntities
} = this.state;
const {
component,
children,
onVisibleChanged,
onAllRemoved,
...restProps
} = this.props;
const Component = component || external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment;
const motionProps = {};
MOTION_PROP_NAMES.forEach(prop => {
motionProps[prop] = restProps[prop];
delete restProps[prop];
});
delete restProps.keys;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, restProps, keyEntities.map(({
status,
...eventProps
}, index) => {
const visible = status === STATUS_ADD || status === STATUS_KEEP;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(CSSMotion, _extends({}, motionProps, {
key: eventProps.key,
visible: visible,
eventProps: eventProps,
onVisibleChanged: changedVisible => {
onVisibleChanged?.(changedVisible, {
key: eventProps.key
});
if (!changedVisible) {
this.removeKey(eventProps.key);
}
}
}), isRefNotConsumed(children) ? props => children({
...props,
index
}) : (props, ref) => children({
...props,
index
}, ref));
}));
}
}
return CSSMotionList;
}
/* harmony default export */ var CSSMotionList = (genCSSMotionList(supportTransition));
;// ./node_modules/@rc-component/motion/es/index.js
/* harmony default export */ var motion_es = (es_CSSMotion);
/***/ }),
/***/ "./node_modules/@rc-component/pagination/es/locale/en_US.js":
/*!******************************************************************!*\
!*** ./node_modules/@rc-component/pagination/es/locale/en_US.js ***!
\******************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__) {
"use strict";
const locale = {
// Options
items_per_page: '/ page',
jump_to: 'Go to',
jump_to_confirm: 'confirm',
page: 'Page',
// Pagination
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',
page_size: 'Page Size'
};
/* harmony default export */ __webpack_exports__["default"] = (locale);
/***/ }),
/***/ "./node_modules/@rc-component/pagination/es/locale/zh_CN.js":
/*!******************************************************************!*\
!*** ./node_modules/@rc-component/pagination/es/locale/zh_CN.js ***!
\******************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__) {
"use strict";
const locale = {
// Options
items_per_page: '条/页',
jump_to: '跳至',
jump_to_confirm: '确定',
page: '页',
// Pagination
prev_page: '上一页',
next_page: '下一页',
prev_5: '向前 5 页',
next_5: '向后 5 页',
prev_3: '向前 3 页',
next_3: '向后 3 页',
page_size: '页码'
};
/* harmony default export */ __webpack_exports__["default"] = (locale);
/***/ }),
/***/ "./node_modules/@rc-component/picker/es/locale/common.js":
/*!***************************************************************!*\
!*** ./node_modules/@rc-component/picker/es/locale/common.js ***!
\***************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ commonLocale: function() { return /* binding */ commonLocale; }
/* harmony export */ });
var commonLocale = {
yearFormat: 'YYYY',
dayFormat: 'D',
cellMeridiemFormat: 'A',
monthBeforeYear: true
};
/***/ }),
/***/ "./node_modules/@rc-component/util/es/Children/toArray.js":
/*!****************************************************************!*\
!*** ./node_modules/@rc-component/util/es/Children/toArray.js ***!
\****************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ toArray; }
/* harmony export */ });
/* harmony import */ var _React_isFragment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../React/isFragment */ "./node_modules/@rc-component/util/es/React/isFragment.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
function toArray(children, option = {}) {
let ret = [];
react__WEBPACK_IMPORTED_MODULE_1___default().Children.forEach(children, child => {
if ((child === undefined || child === null) && !option.keepEmpty) {
return;
}
if (Array.isArray(child)) {
ret = ret.concat(toArray(child));
} else if ((0,_React_isFragment__WEBPACK_IMPORTED_MODULE_0__["default"])(child) && child.props) {
ret = ret.concat(toArray(child.props.children, option));
} else {
ret.push(child);
}
});
return ret;
}
/***/ }),
/***/ "./node_modules/@rc-component/util/es/Dom/canUseDom.js":
/*!*************************************************************!*\
!*** ./node_modules/@rc-component/util/es/Dom/canUseDom.js ***!
\*************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ canUseDom; }
/* harmony export */ });
function canUseDom() {
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
}
/***/ }),
/***/ "./node_modules/@rc-component/util/es/Dom/contains.js":
/*!************************************************************!*\
!*** ./node_modules/@rc-component/util/es/Dom/contains.js ***!
\************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ contains; }
/* harmony export */ });
function contains(root, n) {
if (!root) {
return false;
}
// Use native if support
if (root.contains) {
return root.contains(n);
}
// `document.contains` not support with IE11
let node = n;
while (node) {
if (node === root) {
return true;
}
node = node.parentNode;
}
return false;
}
/***/ }),
/***/ "./node_modules/@rc-component/util/es/Dom/dynamicCSS.js":
/*!**************************************************************!*\
!*** ./node_modules/@rc-component/util/es/Dom/dynamicCSS.js ***!
\**************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ removeCSS: function() { return /* binding */ removeCSS; },
/* harmony export */ updateCSS: function() { return /* binding */ updateCSS; }
/* harmony export */ });
/* unused harmony exports injectCSS, clearContainerCache */
/* harmony import */ var _canUseDom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./canUseDom */ "./node_modules/@rc-component/util/es/Dom/canUseDom.js");
/* harmony import */ var _contains__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./contains */ "./node_modules/@rc-component/util/es/Dom/contains.js");
const APPEND_ORDER = 'data-rc-order';
const APPEND_PRIORITY = 'data-rc-priority';
const MARK_KEY = `rc-util-key`;
const containerCache = new Map();
function getMark({
mark
} = {}) {
if (mark) {
return mark.startsWith('data-') ? mark : `data-${mark}`;
}
return MARK_KEY;
}
function getContainer(option) {
if (option.attachTo) {
return option.attachTo;
}
const head = document.querySelector('head');
return head || document.body;
}
function getOrder(prepend) {
if (prepend === 'queue') {
return 'prependQueue';
}
return prepend ? 'prepend' : 'append';
}
/**
* Find style which inject by rc-util
*/
function findStyles(container) {
return Array.from((containerCache.get(container) || container).children).filter(node => node.tagName === 'STYLE');
}
function injectCSS(css, option = {}) {
if (!(0,_canUseDom__WEBPACK_IMPORTED_MODULE_0__["default"])()) {
return null;
}
const {
csp,
prepend,
priority = 0
} = option;
const mergedOrder = getOrder(prepend);
const isPrependQueue = mergedOrder === 'prependQueue';
const styleNode = document.createElement('style');
styleNode.setAttribute(APPEND_ORDER, mergedOrder);
if (isPrependQueue && priority) {
styleNode.setAttribute(APPEND_PRIORITY, `${priority}`);
}
if (csp?.nonce) {
styleNode.nonce = csp?.nonce;
}
styleNode.innerHTML = css;
const container = getContainer(option);
const {
firstChild
} = container;
if (prepend) {
// If is queue `prepend`, it will prepend first style and then append rest style
if (isPrependQueue) {
const existStyle = (option.styles || findStyles(container)).filter(node => {
// Ignore style which not injected by rc-util with prepend
if (!['prepend', 'prependQueue'].includes(node.getAttribute(APPEND_ORDER))) {
return false;
}
// Ignore style which priority less then new style
const nodePriority = Number(node.getAttribute(APPEND_PRIORITY) || 0);
return priority >= nodePriority;
});
if (existStyle.length) {
container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
return styleNode;
}
}
// Use `insertBefore` as `prepend`
container.insertBefore(styleNode, firstChild);
} else {
container.appendChild(styleNode);
}
return styleNode;
}
function findExistNode(key, option = {}) {
let {
styles
} = option;
styles ||= findStyles(getContainer(option));
return styles.find(node => node.getAttribute(getMark(option)) === key);
}
function removeCSS(key, option = {}) {
const existNode = findExistNode(key, option);
if (existNode) {
const container = getContainer(option);
container.removeChild(existNode);
}
}
/**
* qiankun will inject `appendChild` to insert into other
*/
function syncRealContainer(container, option) {
const cachedRealContainer = containerCache.get(container);
// Find real container when not cached or cached container removed
if (!cachedRealContainer || !(0,_contains__WEBPACK_IMPORTED_MODULE_1__["default"])(document, cachedRealContainer)) {
const placeholderStyle = injectCSS('', option);
const {
parentNode
} = placeholderStyle;
containerCache.set(container, parentNode);
container.removeChild(placeholderStyle);
}
}
/**
* manually clear container cache to avoid global cache in unit testes
*/
function clearContainerCache() {
containerCache.clear();
}
function updateCSS(css, key, originOption = {}) {
const container = getContainer(originOption);
const styles = findStyles(container);
const option = {
...originOption,
styles
};
// Sync real parent
syncRealContainer(container, option);
const existNode = findExistNode(key, option);
if (existNode) {
if (option.csp?.nonce && existNode.nonce !== option.csp?.nonce) {
existNode.nonce = option.csp?.nonce;
}
if (existNode.innerHTML !== css) {
existNode.innerHTML = css;
}
return existNode;
}
const newNode = injectCSS(css, option);
newNode.setAttribute(getMark(option), key);
return newNode;
}
/***/ }),
/***/ "./node_modules/@rc-component/util/es/Dom/findDOMNode.js":
/*!***************************************************************!*\
!*** ./node_modules/@rc-component/util/es/Dom/findDOMNode.js ***!
\***************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ getDOM: function() { return /* binding */ getDOM; },
/* harmony export */ isDOM: function() { return /* binding */ isDOM; }
/* harmony export */ });
/* unused harmony export default */
function isDOM(node) {
// https://developer.mozilla.org/en-US/docs/Web/API/Element
// Since XULElement is also subclass of Element, we only need HTMLElement and SVGElement
return node instanceof HTMLElement || node instanceof SVGElement;
}
/**
* Retrieves a DOM node via a ref, and does not invoke `findDOMNode`.
*/
function getDOM(node) {
if (node && typeof node === 'object' && isDOM(node.nativeElement)) {
return node.nativeElement;
}
if (isDOM(node)) {
return node;
}
return null;
}
/**
* Return if a node is a DOM node. Else will return by `findDOMNode`
*/
function findDOMNode(node) {
const domNode = getDOM(node);
if (domNode) {
return domNode;
}
if (node && typeof node === 'object' && 'current' in node) {
const refDomNode = getDOM(node.current);
if (refDomNode) {
return refDomNode;
}
}
return null;
}
/***/ }),
/***/ "./node_modules/@rc-component/util/es/Dom/shadow.js":
/*!**********************************************************!*\
!*** ./node_modules/@rc-component/util/es/Dom/shadow.js ***!
\**********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ getShadowRoot: function() { return /* binding */ getShadowRoot; }
/* harmony export */ });
/* unused harmony export inShadow */
function getRoot(ele) {
return ele?.getRootNode?.();
}
/**
* Check if is in shadowRoot
*/
function inShadow(ele) {
return getRoot(ele) instanceof ShadowRoot;
}
/**
* Return shadowRoot if possible
*/
function getShadowRoot(ele) {
return inShadow(ele) ? getRoot(ele) : null;
}
/***/ }),
/***/ "./node_modules/@rc-component/util/es/KeyCode.js":
/*!*******************************************************!*\
!*** ./node_modules/@rc-component/util/es/KeyCode.js ***!
\*******************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__) {
"use strict";
/**
* @ignore
* some key-codes definition and utils from closure-library
* @author yiminghe@gmail.com
*/
const KeyCode = {
/**
* MAC_ENTER
*/
MAC_ENTER: 3,
/**
* BACKSPACE
*/
BACKSPACE: 8,
/**
* TAB
*/
TAB: 9,
/**
* NUMLOCK on FF/Safari Mac
*/
NUM_CENTER: 12,
// NUMLOCK on FF/Safari Mac
/**
* ENTER
*/
ENTER: 13,
/**
* SHIFT
*/
SHIFT: 16,
/**
* CTRL
*/
CTRL: 17,
/**
* ALT
*/
ALT: 18,
/**
* PAUSE
*/
PAUSE: 19,
/**
* CAPS_LOCK
*/
CAPS_LOCK: 20,
/**
* ESC
*/
ESC: 27,
/**
* SPACE
*/
SPACE: 32,
/**
* PAGE_UP
*/
PAGE_UP: 33,
// also NUM_NORTH_EAST
/**
* PAGE_DOWN
*/
PAGE_DOWN: 34,
// also NUM_SOUTH_EAST
/**
* END
*/
END: 35,
// also NUM_SOUTH_WEST
/**
* HOME
*/
HOME: 36,
// also NUM_NORTH_WEST
/**
* LEFT
*/
LEFT: 37,
// also NUM_WEST
/**
* UP
*/
UP: 38,
// also NUM_NORTH
/**
* RIGHT
*/
RIGHT: 39,
// also NUM_EAST
/**
* DOWN
*/
DOWN: 40,
// also NUM_SOUTH
/**
* PRINT_SCREEN
*/
PRINT_SCREEN: 44,
/**
* INSERT
*/
INSERT: 45,
// also NUM_INSERT
/**
* DELETE
*/
DELETE: 46,
// also NUM_DELETE
/**
* ZERO
*/
ZERO: 48,
/**
* ONE
*/
ONE: 49,
/**
* TWO
*/
TWO: 50,
/**
* THREE
*/
THREE: 51,
/**
* FOUR
*/
FOUR: 52,
/**
* FIVE
*/
FIVE: 53,
/**
* SIX
*/
SIX: 54,
/**
* SEVEN
*/
SEVEN: 55,
/**
* EIGHT
*/
EIGHT: 56,
/**
* NINE
*/
NINE: 57,
/**
* QUESTION_MARK
*/
QUESTION_MARK: 63,
// needs localization
/**
* A
*/
A: 65,
/**
* B
*/
B: 66,
/**
* C
*/
C: 67,
/**
* D
*/
D: 68,
/**
* E
*/
E: 69,
/**
* F
*/
F: 70,
/**
* G
*/
G: 71,
/**
* H
*/
H: 72,
/**
* I
*/
I: 73,
/**
* J
*/
J: 74,
/**
* K
*/
K: 75,
/**
* L
*/
L: 76,
/**
* M
*/
M: 77,
/**
* N
*/
N: 78,
/**
* O
*/
O: 79,
/**
* P
*/
P: 80,
/**
* Q
*/
Q: 81,
/**
* R
*/
R: 82,
/**
* S
*/
S: 83,
/**
* T
*/
T: 84,
/**
* U
*/
U: 85,
/**
* V
*/
V: 86,
/**
* W
*/
W: 87,
/**
* X
*/
X: 88,
/**
* Y
*/
Y: 89,
/**
* Z
*/
Z: 90,
/**
* META
*/
META: 91,
// WIN_KEY_LEFT
/**
* WIN_KEY_RIGHT
*/
WIN_KEY_RIGHT: 92,
/**
* CONTEXT_MENU
*/
CONTEXT_MENU: 93,
/**
* NUM_ZERO
*/
NUM_ZERO: 96,
/**
* NUM_ONE
*/
NUM_ONE: 97,
/**
* NUM_TWO
*/
NUM_TWO: 98,
/**
* NUM_THREE
*/
NUM_THREE: 99,
/**
* NUM_FOUR
*/
NUM_FOUR: 100,
/**
* NUM_FIVE
*/
NUM_FIVE: 101,
/**
* NUM_SIX
*/
NUM_SIX: 102,
/**
* NUM_SEVEN
*/
NUM_SEVEN: 103,
/**
* NUM_EIGHT
*/
NUM_EIGHT: 104,
/**
* NUM_NINE
*/
NUM_NINE: 105,
/**
* NUM_MULTIPLY
*/
NUM_MULTIPLY: 106,
/**
* NUM_PLUS
*/
NUM_PLUS: 107,
/**
* NUM_MINUS
*/
NUM_MINUS: 109,
/**
* NUM_PERIOD
*/
NUM_PERIOD: 110,
/**
* NUM_DIVISION
*/
NUM_DIVISION: 111,
/**
* 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,
/**
* NUMLOCK
*/
NUMLOCK: 144,
/**
* SEMICOLON
*/
SEMICOLON: 186,
// needs localization
/**
* DASH
*/
DASH: 189,
// needs localization
/**
* EQUALS
*/
EQUALS: 187,
// needs localization
/**
* COMMA
*/
COMMA: 188,
// needs localization
/**
* PERIOD
*/
PERIOD: 190,
// needs localization
/**
* SLASH
*/
SLASH: 191,
// needs localization
/**
* APOSTROPHE
*/
APOSTROPHE: 192,
// needs localization
/**
* SINGLE_QUOTE
*/
SINGLE_QUOTE: 222,
// needs localization
/**
* OPEN_SQUARE_BRACKET
*/
OPEN_SQUARE_BRACKET: 219,
// needs localization
/**
* BACKSLASH
*/
BACKSLASH: 220,
// needs localization
/**
* CLOSE_SQUARE_BRACKET
*/
CLOSE_SQUARE_BRACKET: 221,
// needs localization
/**
* WIN_KEY
*/
WIN_KEY: 224,
/**
* MAC_FF_META
*/
MAC_FF_META: 224,
// Firefox (Gecko) fires this for the meta key instead of 91
/**
* WIN_IME
*/
WIN_IME: 229,
// ======================== Function ========================
/**
* whether text and modified key is entered at the same time.
*/
isTextModifyingKeyEvent: function isTextModifyingKeyEvent(e) {
const {
keyCode
} = e;
if (e.altKey && !e.ctrlKey || e.metaKey ||
// Function keys don't generate text
keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) {
return false;
}
// The following keys are quite harmless, even in combination with
// CTRL, ALT or SHIFT.
switch (keyCode) {
case KeyCode.ALT:
case KeyCode.CAPS_LOCK:
case KeyCode.CONTEXT_MENU:
case KeyCode.CTRL:
case KeyCode.DOWN:
case KeyCode.END:
case KeyCode.ESC:
case KeyCode.HOME:
case KeyCode.INSERT:
case KeyCode.LEFT:
case KeyCode.MAC_FF_META:
case KeyCode.META:
case KeyCode.NUMLOCK:
case KeyCode.NUM_CENTER:
case KeyCode.PAGE_DOWN:
case KeyCode.PAGE_UP:
case KeyCode.PAUSE:
case KeyCode.PRINT_SCREEN:
case KeyCode.RIGHT:
case KeyCode.SHIFT:
case KeyCode.UP:
case KeyCode.WIN_KEY:
case KeyCode.WIN_KEY_RIGHT:
return false;
default:
return true;
}
},
/**
* whether character is entered.
*/
isCharacterKey: function isCharacterKey(keyCode) {
if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) {
return true;
}
if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) {
return true;
}
if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) {
return true;
}
// Safari sends zero key code for non-latin characters.
if (window.navigator.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) {
return true;
}
switch (keyCode) {
case KeyCode.SPACE:
case KeyCode.QUESTION_MARK:
case KeyCode.NUM_PLUS:
case KeyCode.NUM_MINUS:
case KeyCode.NUM_PERIOD:
case KeyCode.NUM_DIVISION:
case KeyCode.SEMICOLON:
case KeyCode.DASH:
case KeyCode.EQUALS:
case KeyCode.COMMA:
case KeyCode.PERIOD:
case KeyCode.SLASH:
case KeyCode.APOSTROPHE:
case KeyCode.SINGLE_QUOTE:
case KeyCode.OPEN_SQUARE_BRACKET:
case KeyCode.BACKSLASH:
case KeyCode.CLOSE_SQUARE_BRACKET:
return true;
default:
return false;
}
},
isEditableTarget: function isEditableTarget(e) {
const target = e.target;
if (!(target instanceof HTMLElement)) {
return false;
}
const tagName = target.tagName;
if (tagName === 'INPUT' || tagName === 'TEXTAREA' || tagName === 'SELECT' || target.isContentEditable) {
return true;
}
return false;
}
};
/* harmony default export */ __webpack_exports__["default"] = (KeyCode);
/***/ }),
/***/ "./node_modules/@rc-component/util/es/React/isFragment.js":
/*!****************************************************************!*\
!*** ./node_modules/@rc-component/util/es/React/isFragment.js ***!
\****************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ isFragment; }
/* harmony export */ });
const REACT_ELEMENT_TYPE_18 = Symbol.for('react.element');
const REACT_ELEMENT_TYPE_19 = Symbol.for('react.transitional.element');
const REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
/**
* Compatible with React 18 or 19 to check if node is a Fragment.
*/
function isFragment(object) {
return (
// Base object type
object && typeof object === 'object' && (
// React Element type
object.$$typeof === REACT_ELEMENT_TYPE_18 || object.$$typeof === REACT_ELEMENT_TYPE_19) &&
// React Fragment type
object.type === REACT_FRAGMENT_TYPE
);
}
/***/ }),
/***/ "./node_modules/@rc-component/util/es/hooks/useControlledState.js":
/*!************************************************************************!*\
!*** ./node_modules/@rc-component/util/es/hooks/useControlledState.js ***!
\************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ useControlledState; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _useLayoutEffect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./useLayoutEffect */ "./node_modules/@rc-component/util/es/hooks/useLayoutEffect.js");
/**
* Similar to `useState` but will use props value if provided.
* From React 18, we do not need safe `useState` since it will not throw for unmounted update.
* This hooks remove the `onChange` & `postState` logic since we only need basic merged state logic.
*/
function useControlledState(defaultStateValue, value) {
const [innerValue, setInnerValue] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(defaultStateValue);
const mergedValue = value !== undefined ? value : innerValue;
(0,_useLayoutEffect__WEBPACK_IMPORTED_MODULE_1__["default"])(mount => {
if (!mount) {
setInnerValue(value);
}
}, [value]);
return [
// Value
mergedValue,
// Update function
setInnerValue];
}
/***/ }),
/***/ "./node_modules/@rc-component/util/es/hooks/useEvent.js":
/*!**************************************************************!*\
!*** ./node_modules/@rc-component/util/es/hooks/useEvent.js ***!
\**************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
const useEvent = callback => {
const fnRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(callback);
fnRef.current = callback;
const memoFn = react__WEBPACK_IMPORTED_MODULE_0__.useCallback((...args) => fnRef.current?.(...args), []);
return memoFn;
};
/* harmony default export */ __webpack_exports__["default"] = (useEvent);
/***/ }),
/***/ "./node_modules/@rc-component/util/es/hooks/useLayoutEffect.js":
/*!*********************************************************************!*\
!*** ./node_modules/@rc-component/util/es/hooks/useLayoutEffect.js ***!
\*********************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ useLayoutUpdateEffect: function() { return /* binding */ useLayoutUpdateEffect; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _Dom_canUseDom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Dom/canUseDom */ "./node_modules/@rc-component/util/es/Dom/canUseDom.js");
/**
* Wrap `React.useLayoutEffect` which will not throw warning message in test env
*/
const useInternalLayoutEffect = true && (0,_Dom_canUseDom__WEBPACK_IMPORTED_MODULE_1__["default"])() ? react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect : react__WEBPACK_IMPORTED_MODULE_0__.useEffect;
const useLayoutEffect = (callback, deps) => {
const firstMountRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(true);
useInternalLayoutEffect(() => {
return callback(firstMountRef.current);
}, deps);
// We tell react that first mount has passed
useInternalLayoutEffect(() => {
firstMountRef.current = false;
return () => {
firstMountRef.current = true;
};
}, []);
};
const useLayoutUpdateEffect = (callback, deps) => {
useLayoutEffect(firstMount => {
if (!firstMount) {
return callback();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, deps);
};
/* harmony default export */ __webpack_exports__["default"] = (useLayoutEffect);
/***/ }),
/***/ "./node_modules/@rc-component/util/es/hooks/useMemo.js":
/*!*************************************************************!*\
!*** ./node_modules/@rc-component/util/es/hooks/useMemo.js ***!
\*************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ useMemo; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
function useMemo(getValue, condition, shouldUpdate) {
const cacheRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef({});
if (!('value' in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
cacheRef.current.value = getValue();
cacheRef.current.condition = condition;
}
return cacheRef.current.value;
}
/***/ }),
/***/ "./node_modules/@rc-component/util/es/hooks/useState.js":
/*!**************************************************************!*\
!*** ./node_modules/@rc-component/util/es/hooks/useState.js ***!
\**************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/**
* Same as React.useState but `setState` accept `ignoreDestroy` param to not to setState after destroyed.
* We do not make this auto is to avoid real memory leak.
* Developer should confirm it's safe to ignore themselves.
*/
const useSafeState = defaultValue => {
const destroyRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(false);
const [value, setValue] = react__WEBPACK_IMPORTED_MODULE_0__.useState(defaultValue);
react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => {
destroyRef.current = false;
return () => {
destroyRef.current = true;
};
}, []);
function safeSetState(updater, ignoreDestroy) {
if (ignoreDestroy && destroyRef.current) {
return;
}
setValue(updater);
}
return [value, safeSetState];
};
/* harmony default export */ __webpack_exports__["default"] = (useSafeState);
/***/ }),
/***/ "./node_modules/@rc-component/util/es/index.js":
/*!*****************************************************************!*\
!*** ./node_modules/@rc-component/util/es/index.js + 2 modules ***!
\*****************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
get: function() { return /* reexport */ get["default"]; },
merge: function() { return /* reexport */ set.merge; },
omit: function() { return /* reexport */ omit["default"]; },
set: function() { return /* reexport */ set["default"]; },
supportRef: function() { return /* reexport */ ref.supportRef; },
toArray: function() { return /* reexport */ toArray["default"]; },
useComposeRef: function() { return /* reexport */ ref.useComposeRef; },
useControlledState: function() { return /* reexport */ useControlledState["default"]; },
useEvent: function() { return /* reexport */ useEvent["default"]; },
warning: function() { return /* reexport */ warning["default"]; }
});
// UNUSED EXPORTS: mergeProps, mergeWith, noteOnce, supportNodeRef, useMergedState
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/hooks/useEvent.js
var useEvent = __webpack_require__("./node_modules/@rc-component/util/es/hooks/useEvent.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/hooks/useLayoutEffect.js
var useLayoutEffect = __webpack_require__("./node_modules/@rc-component/util/es/hooks/useLayoutEffect.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/hooks/useState.js
var useState = __webpack_require__("./node_modules/@rc-component/util/es/hooks/useState.js");
;// ./node_modules/@rc-component/util/es/hooks/useMergedState.js
/** We only think `undefined` is empty */
function hasValue(value) {
return value !== undefined;
}
/**
* @deprecated Please use `useControlledState` instead if not need support < React 18.
* Similar to `useState` but will use props value if provided.
* Note that internal use rc-util `useState` hook.
*/
function useMergedState(defaultStateValue, option) {
const {
defaultValue,
value,
onChange,
postState
} = option || {};
// ======================= Init =======================
const [innerValue, setInnerValue] = (0,useState["default"])(() => {
if (hasValue(value)) {
return value;
} else if (hasValue(defaultValue)) {
return typeof defaultValue === 'function' ? defaultValue() : defaultValue;
} else {
return typeof defaultStateValue === 'function' ? defaultStateValue() : defaultStateValue;
}
});
const mergedValue = value !== undefined ? value : innerValue;
const postMergedValue = postState ? postState(mergedValue) : mergedValue;
// ====================== Change ======================
const onChangeFn = (0,useEvent["default"])(onChange);
const [prevValue, setPrevValue] = (0,useState["default"])([mergedValue]);
(0,useLayoutEffect.useLayoutUpdateEffect)(() => {
const prev = prevValue[0];
if (innerValue !== prev) {
onChangeFn(innerValue, prev);
}
}, [prevValue]);
// Sync value back to `undefined` when it from control to un-control
(0,useLayoutEffect.useLayoutUpdateEffect)(() => {
if (!hasValue(value)) {
setInnerValue(value);
}
}, [value]);
// ====================== Update ======================
const triggerChange = (0,useEvent["default"])((updater, ignoreDestroy) => {
setInnerValue(updater, ignoreDestroy);
setPrevValue([mergedValue], ignoreDestroy);
});
return [postMergedValue, triggerChange];
}
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/hooks/useControlledState.js
var useControlledState = __webpack_require__("./node_modules/@rc-component/util/es/hooks/useControlledState.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/ref.js
var ref = __webpack_require__("./node_modules/@rc-component/util/es/ref.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/utils/get.js
var get = __webpack_require__("./node_modules/@rc-component/util/es/utils/get.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/utils/set.js
var set = __webpack_require__("./node_modules/@rc-component/util/es/utils/set.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/warning.js
var warning = __webpack_require__("./node_modules/@rc-component/util/es/warning.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/omit.js
var omit = __webpack_require__("./node_modules/@rc-component/util/es/omit.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/Children/toArray.js
var toArray = __webpack_require__("./node_modules/@rc-component/util/es/Children/toArray.js");
;// ./node_modules/@rc-component/util/es/mergeProps.js
/**
* Merges multiple props objects into one. Unlike `Object.assign()` or `{ ...a, ...b }`, it skips
* properties whose value is explicitly set to `undefined`.
*/
function mergeProps(...items) {
const ret = {};
for (const item of items) {
if (item) {
for (const key of Object.keys(item)) {
if (item[key] !== undefined) {
ret[key] = item[key];
}
}
}
}
return ret;
}
/* harmony default export */ var es_mergeProps = (mergeProps);
;// ./node_modules/@rc-component/util/es/index.js
/***/ }),
/***/ "./node_modules/@rc-component/util/es/isEqual.js":
/*!*******************************************************!*\
!*** ./node_modules/@rc-component/util/es/isEqual.js ***!
\*******************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./warning */ "./node_modules/@rc-component/util/es/warning.js");
/**
* Deeply compares two object literals.
* @param obj1 object 1
* @param obj2 object 2
* @param shallow shallow compare
* @returns
*/
function isEqual(obj1, obj2, shallow = false) {
// https://github.com/mapbox/mapbox-gl-js/pull/5979/files#diff-fde7145050c47cc3a306856efd5f9c3016e86e859de9afbd02c879be5067e58f
const refSet = new Set();
function deepEqual(a, b, level = 1) {
const circular = refSet.has(a);
(0,_warning__WEBPACK_IMPORTED_MODULE_0__["default"])(!circular, 'Warning: There may be circular references');
if (circular) {
return false;
}
if (a === b) {
return true;
}
if (shallow && level > 1) {
return false;
}
refSet.add(a);
const newLevel = level + 1;
if (Array.isArray(a)) {
if (!Array.isArray(b) || a.length !== b.length) {
return false;
}
for (let i = 0; i < a.length; i++) {
if (!deepEqual(a[i], b[i], newLevel)) {
return false;
}
}
return true;
}
if (a && b && typeof a === 'object' && typeof b === 'object') {
const keys = Object.keys(a);
if (keys.length !== Object.keys(b).length) {
return false;
}
return keys.every(key => deepEqual(a[key], b[key], newLevel));
}
// other
return false;
}
return deepEqual(obj1, obj2);
}
/* harmony default export */ __webpack_exports__["default"] = (isEqual);
/***/ }),
/***/ "./node_modules/@rc-component/util/es/omit.js":
/*!****************************************************!*\
!*** ./node_modules/@rc-component/util/es/omit.js ***!
\****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ omit; }
/* harmony export */ });
function omit(obj, fields) {
const clone = Object.assign({}, obj);
if (Array.isArray(fields)) {
fields.forEach(key => {
delete clone[key];
});
}
return clone;
}
/***/ }),
/***/ "./node_modules/@rc-component/util/es/pickAttrs.js":
/*!*********************************************************!*\
!*** ./node_modules/@rc-component/util/es/pickAttrs.js ***!
\*********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ pickAttrs; }
/* harmony export */ });
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 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
onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown
onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel
onTouchEnd onTouchMove onTouchStart 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]+/);
/* eslint-enable max-len */
const ariaPrefix = 'aria-';
const dataPrefix = 'data-';
function match(key, prefix) {
return key.indexOf(prefix) === 0;
}
/**
* Picker props from exist props with filter
* @param props Passed props
* @param ariaOnly boolean | { aria?: boolean; data?: boolean; attr?: boolean; } filter config
*/
function pickAttrs(props, ariaOnly = false) {
let mergedConfig;
if (ariaOnly === false) {
mergedConfig = {
aria: true,
data: true,
attr: true
};
} else if (ariaOnly === true) {
mergedConfig = {
aria: true
};
} else {
mergedConfig = {
...ariaOnly
};
}
const attrs = {};
Object.keys(props).forEach(key => {
if (
// Aria
mergedConfig.aria && (key === 'role' || match(key, ariaPrefix)) ||
// Data
mergedConfig.data && match(key, dataPrefix) ||
// Attr
mergedConfig.attr && propList.includes(key)) {
attrs[key] = props[key];
}
});
return attrs;
}
/***/ }),
/***/ "./node_modules/@rc-component/util/es/raf.js":
/*!***************************************************!*\
!*** ./node_modules/@rc-component/util/es/raf.js ***!
\***************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__) {
"use strict";
let raf = callback => +setTimeout(callback, 16);
let caf = num => clearTimeout(num);
if (typeof window !== 'undefined' && 'requestAnimationFrame' in window) {
raf = callback => window.requestAnimationFrame(callback);
caf = handle => window.cancelAnimationFrame(handle);
}
let rafUUID = 0;
const rafIds = new Map();
function cleanup(id) {
rafIds.delete(id);
}
const wrapperRaf = (callback, times = 1) => {
rafUUID += 1;
const id = rafUUID;
function callRef(leftTimes) {
if (leftTimes === 0) {
// Clean up
cleanup(id);
// Trigger
callback();
} else {
// Next raf
const realId = raf(() => {
callRef(leftTimes - 1);
});
// Bind real raf id
rafIds.set(id, realId);
}
}
callRef(times);
return id;
};
wrapperRaf.cancel = id => {
const realId = rafIds.get(id);
cleanup(id);
return caf(realId);
};
if (true) {
wrapperRaf.ids = () => rafIds;
}
/* harmony default export */ __webpack_exports__["default"] = (wrapperRaf);
/***/ }),
/***/ "./node_modules/@rc-component/util/es/ref.js":
/*!***************************************************!*\
!*** ./node_modules/@rc-component/util/es/ref.js ***!
\***************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ composeRef: function() { return /* binding */ composeRef; },
/* harmony export */ fillRef: function() { return /* binding */ fillRef; },
/* harmony export */ getNodeRef: function() { return /* binding */ getNodeRef; },
/* harmony export */ supportNodeRef: function() { return /* binding */ supportNodeRef; },
/* harmony export */ supportRef: function() { return /* binding */ supportRef; },
/* harmony export */ useComposeRef: function() { return /* binding */ useComposeRef; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_is__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-is */ "./node_modules/@rc-component/util/node_modules/react-is/index.js");
/* harmony import */ var _hooks_useMemo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hooks/useMemo */ "./node_modules/@rc-component/util/es/hooks/useMemo.js");
/* harmony import */ var _React_isFragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./React/isFragment */ "./node_modules/@rc-component/util/es/React/isFragment.js");
const ReactMajorVersion = Number(react__WEBPACK_IMPORTED_MODULE_0__.version.split('.')[0]);
const fillRef = (ref, node) => {
if (typeof ref === 'function') {
ref(node);
} else if (typeof ref === 'object' && ref && 'current' in ref) {
ref.current = node;
}
};
/**
* Merge refs into one ref function to support ref passing.
*/
const composeRef = (...refs) => {
const refList = refs.filter(Boolean);
if (refList.length <= 1) {
return refList[0];
}
return node => {
refs.forEach(ref => {
fillRef(ref, node);
});
};
};
const useComposeRef = (...refs) => {
return (0,_hooks_useMemo__WEBPACK_IMPORTED_MODULE_2__["default"])(() => composeRef(...refs),
// eslint-disable-next-line react-hooks/exhaustive-deps
refs, (prev, next) => prev.length !== next.length || prev.every((ref, i) => ref !== next[i]));
};
const supportRef = nodeOrComponent => {
if (!nodeOrComponent) {
return false;
}
// React 19 no need `forwardRef` anymore. So just pass if is a React element.
if (isReactElement(nodeOrComponent) && ReactMajorVersion >= 19) {
return true;
}
const type = (0,react_is__WEBPACK_IMPORTED_MODULE_1__.isMemo)(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type;
// Function component node
if (typeof type === 'function' && !type.prototype?.render && type.$$typeof !== react_is__WEBPACK_IMPORTED_MODULE_1__.ForwardRef) {
return false;
}
// Class component
if (typeof nodeOrComponent === 'function' && !nodeOrComponent.prototype?.render && nodeOrComponent.$$typeof !== react_is__WEBPACK_IMPORTED_MODULE_1__.ForwardRef) {
return false;
}
return true;
};
function isReactElement(node) {
return /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.isValidElement)(node) && !(0,_React_isFragment__WEBPACK_IMPORTED_MODULE_3__["default"])(node);
}
const supportNodeRef = node => {
return isReactElement(node) && supportRef(node);
};
/**
* In React 19. `ref` is not a property from node.
* But a property from `props.ref`.
* To check if `props.ref` exist or fallback to `ref`.
*/
const getNodeRef = node => {
if (node && isReactElement(node)) {
const ele = node;
// Source from:
// https://github.com/mui/material-ui/blob/master/packages/mui-utils/src/getReactNodeRef/getReactNodeRef.ts
return ele.props.propertyIsEnumerable('ref') ? ele.props.ref : ele.ref;
}
return null;
};
/***/ }),
/***/ "./node_modules/@rc-component/util/es/utils/get.js":
/*!*********************************************************!*\
!*** ./node_modules/@rc-component/util/es/utils/get.js ***!
\*********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ get; }
/* harmony export */ });
function get(entity, path) {
let current = entity;
for (let i = 0; i < path.length; i += 1) {
if (current === null || current === undefined) {
return undefined;
}
current = current[path[i]];
}
return current;
}
/***/ }),
/***/ "./node_modules/@rc-component/util/es/utils/set.js":
/*!*********************************************************!*\
!*** ./node_modules/@rc-component/util/es/utils/set.js ***!
\*********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ set; },
/* harmony export */ merge: function() { return /* binding */ merge; }
/* harmony export */ });
/* unused harmony export mergeWith */
/* harmony import */ var _get__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./get */ "./node_modules/@rc-component/util/es/utils/get.js");
function internalSet(entity, paths, value, removeIfUndefined) {
if (!paths.length) {
return value;
}
const [path, ...restPath] = paths;
let clone;
if (!entity && typeof path === 'number') {
clone = [];
} else if (Array.isArray(entity)) {
clone = [...entity];
} else {
clone = {
...entity
};
}
// Delete prop if `removeIfUndefined` and value is undefined
if (removeIfUndefined && value === undefined && restPath.length === 1) {
delete clone[path][restPath[0]];
} else {
clone[path] = internalSet(clone[path], restPath, value, removeIfUndefined);
}
return clone;
}
function set(entity, paths, value, removeIfUndefined = false) {
// Do nothing if `removeIfUndefined` and parent object not exist
if (paths.length && removeIfUndefined && value === undefined && !(0,_get__WEBPACK_IMPORTED_MODULE_0__["default"])(entity, paths.slice(0, -1))) {
return entity;
}
return internalSet(entity, paths, value, removeIfUndefined);
}
function isObject(obj) {
return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === Object.prototype;
}
function createEmpty(source) {
return Array.isArray(source) ? [] : {};
}
const keys = typeof Reflect === 'undefined' ? Object.keys : Reflect.ownKeys;
// ================================ Merge ================================
/**
* Merge multiple objects. Support custom merge logic.
* @param sources object sources
* @param config.prepareArray Customize array prepare function.
* It will return empty [] by default.
* So when match array, it will auto be override with next array in sources.
*/
function mergeWith(sources, config = {}) {
const {
prepareArray
} = config;
const finalPrepareArray = prepareArray || (() => []);
let clone = createEmpty(sources[0]);
sources.forEach(src => {
function internalMerge(path, parentLoopSet) {
const loopSet = new Set(parentLoopSet);
const value = (0,_get__WEBPACK_IMPORTED_MODULE_0__["default"])(src, path);
const isArr = Array.isArray(value);
if (isArr || isObject(value)) {
// Only add not loop obj
if (!loopSet.has(value)) {
loopSet.add(value);
const originValue = (0,_get__WEBPACK_IMPORTED_MODULE_0__["default"])(clone, path);
if (isArr) {
// Array will always be override
clone = set(clone, path, finalPrepareArray(originValue, value));
} else if (!originValue || typeof originValue !== 'object') {
// Init container if not exist
clone = set(clone, path, createEmpty(value));
}
keys(value).forEach(key => {
if (Object.getOwnPropertyDescriptor(value, key).enumerable) {
internalMerge([...path, key], loopSet);
}
});
}
} else {
clone = set(clone, path, value);
}
}
internalMerge([]);
});
return clone;
}
/**
* Merge multiple objects into a new single object.
* Arrays will be replaced by default.
*/
function merge(...sources) {
return mergeWith(sources);
}
/***/ }),
/***/ "./node_modules/@rc-component/util/es/warning.js":
/*!*******************************************************!*\
!*** ./node_modules/@rc-component/util/es/warning.js ***!
\*******************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ noteOnce: function() { return /* binding */ noteOnce; },
/* harmony export */ warning: function() { return /* binding */ warning; },
/* harmony export */ warningOnce: function() { return /* binding */ warningOnce; }
/* harmony export */ });
/* unused harmony exports preMessage, note, resetWarned, call */
/* eslint-disable no-console */
let warned = {};
const preWarningFns = [];
/**
* Pre warning enable you to parse content before console.error.
* Modify to null will prevent warning.
*/
const preMessage = fn => {
preWarningFns.push(fn);
};
/**
* Warning if condition not match.
* @param valid Condition
* @param message Warning message
* @example
* ```js
* warning(false, 'some error'); // print some error
* warning(true, 'some error'); // print nothing
* warning(1 === 2, 'some error'); // print some error
* ```
*/
function warning(valid, message) {
if ( true && !valid && console !== undefined) {
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? '', 'warning'), message);
if (finalMessage) {
console.error(`Warning: ${finalMessage}`);
}
}
}
/** @see Similar to {@link warning} */
function note(valid, message) {
if ( true && !valid && console !== undefined) {
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? '', 'note'), message);
if (finalMessage) {
console.warn(`Note: ${finalMessage}`);
}
}
}
function resetWarned() {
warned = {};
}
function call(method, valid, message) {
if (!valid && !warned[message]) {
method(false, message);
warned[message] = true;
}
}
/** @see Same as {@link warning}, but only warn once for the same message */
function warningOnce(valid, message) {
call(warning, valid, message);
}
/** @see Same as {@link warning}, but only warn once for the same message */
function noteOnce(valid, message) {
call(note, valid, message);
}
warningOnce.preMessage = preMessage;
warningOnce.resetWarned = resetWarned;
warningOnce.noteOnce = noteOnce;
/* harmony default export */ __webpack_exports__["default"] = (warningOnce);
/***/ }),
/***/ "./node_modules/@rc-component/util/node_modules/react-is/cjs/react-is.development.js":
/*!*******************************************************************************************!*\
!*** ./node_modules/@rc-component/util/node_modules/react-is/cjs/react-is.development.js ***!
\*******************************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
"use strict";
var __webpack_unused_export__;
/**
* @license React
* react-is.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (true) {
(function() {
'use strict';
// ATTENTION
// When adding new symbols to this file,
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
// The Symbol used to tag the ReactElement-like types.
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
var REACT_MEMO_TYPE = Symbol.for('react.memo');
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
// -----------------------------------------------------------------------------
var enableScopeAPI = false; // Experimental Create Event Handle API.
var enableCacheElement = false;
var enableTransitionTracing = false; // No known bugs, but needs performance testing
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
// stuff. Intended to enable React core members to more easily debug scheduling
// issues in DEV builds.
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
var REACT_MODULE_REFERENCE;
{
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
}
function isValidElementType(type) {
if (typeof type === 'string' || typeof type === 'function') {
return true;
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
return true;
}
if (typeof type === 'object' && type !== null) {
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
return true;
}
}
return false;
}
function typeOf(object) {
if (typeof object === 'object' && object !== null) {
var $$typeof = object.$$typeof;
switch ($$typeof) {
case REACT_ELEMENT_TYPE:
var type = object.type;
switch (type) {
case REACT_FRAGMENT_TYPE:
case REACT_PROFILER_TYPE:
case REACT_STRICT_MODE_TYPE:
case REACT_SUSPENSE_TYPE:
case REACT_SUSPENSE_LIST_TYPE:
return type;
default:
var $$typeofType = type && type.$$typeof;
switch ($$typeofType) {
case REACT_SERVER_CONTEXT_TYPE:
case REACT_CONTEXT_TYPE:
case REACT_FORWARD_REF_TYPE:
case REACT_LAZY_TYPE:
case REACT_MEMO_TYPE:
case REACT_PROVIDER_TYPE:
return $$typeofType;
default:
return $$typeof;
}
}
case REACT_PORTAL_TYPE:
return $$typeof;
}
}
return undefined;
}
var ContextConsumer = REACT_CONTEXT_TYPE;
var ContextProvider = REACT_PROVIDER_TYPE;
var Element = REACT_ELEMENT_TYPE;
var ForwardRef = REACT_FORWARD_REF_TYPE;
var Fragment = REACT_FRAGMENT_TYPE;
var Lazy = REACT_LAZY_TYPE;
var Memo = REACT_MEMO_TYPE;
var Portal = REACT_PORTAL_TYPE;
var Profiler = REACT_PROFILER_TYPE;
var StrictMode = REACT_STRICT_MODE_TYPE;
var Suspense = REACT_SUSPENSE_TYPE;
var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
var hasWarnedAboutDeprecatedIsAsyncMode = false;
var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
function isAsyncMode(object) {
{
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
}
}
return false;
}
function isConcurrentMode(object) {
{
if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
}
}
return false;
}
function isContextConsumer(object) {
return typeOf(object) === REACT_CONTEXT_TYPE;
}
function isContextProvider(object) {
return typeOf(object) === REACT_PROVIDER_TYPE;
}
function isElement(object) {
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
}
function isForwardRef(object) {
return typeOf(object) === REACT_FORWARD_REF_TYPE;
}
function isFragment(object) {
return typeOf(object) === REACT_FRAGMENT_TYPE;
}
function isLazy(object) {
return typeOf(object) === REACT_LAZY_TYPE;
}
function isMemo(object) {
return typeOf(object) === REACT_MEMO_TYPE;
}
function isPortal(object) {
return typeOf(object) === REACT_PORTAL_TYPE;
}
function isProfiler(object) {
return typeOf(object) === REACT_PROFILER_TYPE;
}
function isStrictMode(object) {
return typeOf(object) === REACT_STRICT_MODE_TYPE;
}
function isSuspense(object) {
return typeOf(object) === REACT_SUSPENSE_TYPE;
}
function isSuspenseList(object) {
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
}
__webpack_unused_export__ = ContextConsumer;
__webpack_unused_export__ = ContextProvider;
__webpack_unused_export__ = Element;
exports.ForwardRef = ForwardRef;
__webpack_unused_export__ = Fragment;
__webpack_unused_export__ = Lazy;
__webpack_unused_export__ = Memo;
__webpack_unused_export__ = Portal;
__webpack_unused_export__ = Profiler;
__webpack_unused_export__ = StrictMode;
__webpack_unused_export__ = Suspense;
__webpack_unused_export__ = SuspenseList;
__webpack_unused_export__ = isAsyncMode;
__webpack_unused_export__ = isConcurrentMode;
__webpack_unused_export__ = isContextConsumer;
__webpack_unused_export__ = isContextProvider;
__webpack_unused_export__ = isElement;
__webpack_unused_export__ = isForwardRef;
__webpack_unused_export__ = isFragment;
__webpack_unused_export__ = isLazy;
exports.isMemo = isMemo;
__webpack_unused_export__ = isPortal;
__webpack_unused_export__ = isProfiler;
__webpack_unused_export__ = isStrictMode;
__webpack_unused_export__ = isSuspense;
__webpack_unused_export__ = isSuspenseList;
__webpack_unused_export__ = isValidElementType;
__webpack_unused_export__ = typeOf;
})();
}
/***/ }),
/***/ "./node_modules/@rc-component/util/node_modules/react-is/index.js":
/*!************************************************************************!*\
!*** ./node_modules/@rc-component/util/node_modules/react-is/index.js ***!
\************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
"use strict";
if (false) // removed by dead control flow
{} else {
module.exports = __webpack_require__(/*! ./cjs/react-is.development.js */ "./node_modules/@rc-component/util/node_modules/react-is/cjs/react-is.development.js");
}
/***/ }),
/***/ "./alias/cssinjs.js":
/*!**************************!*\
!*** ./alias/cssinjs.js ***!
\**************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
/* eslint-disable no-restricted-globals */
// This is a alias proxy, which will use global `@ant-design/cssinjs` first.
// Use local if global not found.
let cssinjs;
if (typeof window !== 'undefined' && window.antdCssinjs) {
// Use window UMD version
cssinjs = window.antdCssinjs;
} else if (typeof __webpack_require__.g !== 'undefined' && __webpack_require__.g.antdCssinjs) {
// Use global UMD version
cssinjs = __webpack_require__.g.antdCssinjs;
} else {
// Use local version.
// Use relative path since webpack will also replace module here.
// eslint-disable-next-line antfu/no-import-node-modules-by-path
cssinjs = __webpack_require__(/*! ../node_modules/@ant-design/cssinjs */ "./node_modules/@ant-design/cssinjs/es/index.js");
}
module.exports = cssinjs;
/***/ }),
/***/ "./index-style-only.js":
/*!*****************************!*\
!*** ./index-style-only.js ***!
\*****************************/
/***/ (function(module, exports, __webpack_require__) {
function pascalCase(name) {
return name.charAt(0).toUpperCase() + name.slice(1).replace(/-(\w)/g, (_m, n) => n.toUpperCase());
}
// Just import style for https://github.com/ant-design/ant-design/issues/3745
const req = __webpack_require__("./components sync recursive ^\\.\\/[^_][\\w-]+\\/style\\/index\\.tsx?$");
req.keys().forEach(mod => {
let v = req(mod);
if (v?.default) {
v = v.default;
}
const match = mod.match(/^\.\/([^_][\w-]+)\/index\.tsx?$/);
if (match?.[1]) {
if (match[1] === 'message' || match[1] === 'notification') {
// message & notification should not be capitalized
exports[match[1]] = v;
} else {
exports[pascalCase(match[1])] = v;
}
}
});
module.exports = exports;
/***/ }),
/***/ "./index.js":
/*!******************!*\
!*** ./index.js ***!
\******************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
__webpack_require__(/*! ./index-style-only */ "./index-style-only.js");
module.exports = __webpack_require__(/*! ./components */ "./components/index.ts");
/***/ }),
/***/ "./components/_util/hooks/useMergeSemantic.ts":
/*!****************************************************!*\
!*** ./components/_util/hooks/useMergeSemantic.ts ***!
\****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ mergeClassNames: function() { return /* binding */ mergeClassNames; },
/* harmony export */ mergeStyles: function() { return /* binding */ mergeStyles; },
/* harmony export */ resolveStyleOrClass: function() { return /* binding */ resolveStyleOrClass; },
/* harmony export */ useMergeSemantic: function() { return /* binding */ useMergeSemantic; }
/* harmony export */ });
/* harmony import */ var _babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/toConsumableArray */ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! clsx */ "./node_modules/clsx/dist/clsx.mjs");
/* harmony import */ var _is__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../is */ "./components/_util/is.ts");
// ========================= ClassNames =========================
const mergeClassNames = (schema, ...classNames) => {
const mergedSchema = schema || {};
return classNames.filter(Boolean).reduce((acc, cur) => {
// Loop keys of the current classNames
Object.keys(cur || {}).forEach(key => {
const keySchema = mergedSchema[key];
const curVal = cur[key];
if ((0,_is__WEBPACK_IMPORTED_MODULE_3__.isPlainObject)(keySchema)) {
if ((0,_is__WEBPACK_IMPORTED_MODULE_3__.isPlainObject)(curVal)) {
// Loop fill
acc[key] = mergeClassNames(keySchema, acc[key], curVal);
} else {
// Covert string to object structure
const {
_default: defaultField
} = keySchema;
if (defaultField) {
acc[key] = acc[key] || {};
acc[key][defaultField] = (0,clsx__WEBPACK_IMPORTED_MODULE_2__.clsx)(acc[key][defaultField], curVal);
}
}
} else {
// Flatten fill
acc[key] = (0,clsx__WEBPACK_IMPORTED_MODULE_2__.clsx)(acc[key], curVal);
}
});
return acc;
}, {});
};
const useSemanticClassNames = (schema, ...classNames) => {
return react__WEBPACK_IMPORTED_MODULE_1__.useMemo(() => mergeClassNames.apply(void 0, [schema].concat(classNames)), [schema].concat(classNames));
};
// =========================== Styles ===========================
const mergeStyles = (...styles) => {
return styles.filter(Boolean).reduce((acc, cur = {}) => {
Object.keys(cur).forEach(key => {
acc[key] = {
...acc[key],
...cur[key]
};
});
return acc;
}, {});
};
const useSemanticStyles = (...styles) => {
return react__WEBPACK_IMPORTED_MODULE_1__.useMemo(() => mergeStyles.apply(void 0, styles), [].concat(styles));
};
// =========================== Export ===========================
const fillObjectBySchema = (obj, schema) => {
const newObj = {
...obj
};
Object.keys(schema).forEach(key => {
if (key !== '_default') {
const nestSchema = schema[key];
const nextValue = newObj[key] || {};
newObj[key] = nestSchema ? fillObjectBySchema(nextValue, nestSchema) : nextValue;
}
});
return newObj;
};
const resolveStyleOrClass = (value, info) => {
return typeof value === 'function' ? value(info) : value;
};
/**
* @desc Merge classNames and styles from multiple sources. When `schema` is provided, it **must** provide the nest object structure.
* @descZH 合并来自多个来源的 classNames 和 styles,当提供了 `schema` 时,必须提供嵌套的对象结构。
*/
const useMergeSemantic = (classNamesList, stylesList, info, schema) => {
const resolvedClassNamesList = classNamesList.map(classNames => classNames ? resolveStyleOrClass(classNames, info) : undefined);
const resolvedStylesList = stylesList.map(styles => styles ? resolveStyleOrClass(styles, info) : undefined);
const mergedClassNames = useSemanticClassNames.apply(void 0, [schema].concat((0,_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__["default"])(resolvedClassNamesList)));
const mergedStyles = useSemanticStyles.apply(void 0, (0,_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__["default"])(resolvedStylesList));
return react__WEBPACK_IMPORTED_MODULE_1__.useMemo(() => {
if (!schema) {
return [mergedClassNames, mergedStyles];
}
return [fillObjectBySchema(mergedClassNames, schema), fillObjectBySchema(mergedStyles, schema)];
}, [mergedClassNames, mergedStyles, schema]);
};
/***/ }),
/***/ "./components/_util/hooks/useZIndex.ts":
/*!*********************************************!*\
!*** ./components/_util/hooks/useZIndex.ts ***!
\*********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ CONTAINER_MAX_OFFSET: function() { return /* binding */ CONTAINER_MAX_OFFSET; },
/* harmony export */ useZIndex: function() { return /* binding */ useZIndex; }
/* harmony export */ });
/* unused harmony exports containerBaseZIndexOffset, consumerBaseZIndexOffset */
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _theme_useToken__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../theme/useToken */ "./components/theme/useToken.ts");
/* harmony import */ var _warning__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../warning */ "./components/_util/warning.ts");
/* harmony import */ var _zindexContext__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../zindexContext */ "./components/_util/zindexContext.ts");
// Z-Index control range
// Container: 1000 + offset 100 (max base + 10 * offset = 2000)
// Popover: offset 50
// Notification: Container Max zIndex + componentOffset
const CONTAINER_OFFSET = 100;
const CONTAINER_OFFSET_MAX_COUNT = 10;
const CONTAINER_MAX_OFFSET = CONTAINER_OFFSET * CONTAINER_OFFSET_MAX_COUNT;
/**
* Static function will default be the `CONTAINER_MAX_OFFSET`.
* But it still may have children component like Select, Dropdown.
* So the warning zIndex should exceed the `CONTAINER_MAX_OFFSET`.
*/
const CONTAINER_MAX_OFFSET_WITH_CHILDREN = CONTAINER_MAX_OFFSET + CONTAINER_OFFSET;
const containerBaseZIndexOffset = {
Modal: CONTAINER_OFFSET,
Drawer: CONTAINER_OFFSET,
Popover: CONTAINER_OFFSET,
Popconfirm: CONTAINER_OFFSET,
Tooltip: CONTAINER_OFFSET,
Tour: CONTAINER_OFFSET,
FloatButton: CONTAINER_OFFSET
};
const consumerBaseZIndexOffset = {
SelectLike: 50,
Dropdown: 50,
DatePicker: 50,
Menu: 50,
ImagePreview: 1
};
const isContainerType = type => {
return type in containerBaseZIndexOffset;
};
const useZIndex = (componentType, customZIndex) => {
const [, token] = (0,_theme_useToken__WEBPACK_IMPORTED_MODULE_1__["default"])();
const parentZIndex = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(_zindexContext__WEBPACK_IMPORTED_MODULE_3__["default"]);
const isContainer = isContainerType(componentType);
let result;
if (customZIndex !== undefined) {
result = [customZIndex, customZIndex];
} else {
let zIndex = parentZIndex ?? 0;
if (isContainer) {
zIndex +=
// Use preset token zIndex by default but not stack when has parent container
(parentZIndex ? 0 : token.zIndexPopupBase) +
// Container offset
containerBaseZIndexOffset[componentType];
} else {
zIndex += consumerBaseZIndexOffset[componentType];
}
result = [parentZIndex === undefined ? customZIndex : zIndex, zIndex];
}
if (true) {
const warning = (0,_warning__WEBPACK_IMPORTED_MODULE_2__.devUseWarning)(componentType);
const maxZIndex = token.zIndexPopupBase + CONTAINER_MAX_OFFSET_WITH_CHILDREN;
const currentZIndex = result[0] || 0;
true ? warning(customZIndex !== undefined || currentZIndex <= maxZIndex, 'usage', '`zIndex` is over design token `zIndexPopupBase` too much. It may cause unexpected override.') : 0;
}
return result;
};
/***/ }),
/***/ "./components/_util/is.ts":
/*!********************************!*\
!*** ./components/_util/is.ts ***!
\********************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ isFunction: function() { return /* binding */ isFunction; },
/* harmony export */ isNonNullable: function() { return /* binding */ isNonNullable; },
/* harmony export */ isNumber: function() { return /* binding */ isNumber; },
/* harmony export */ isPlainObject: function() { return /* binding */ isPlainObject; },
/* harmony export */ isPrimitive: function() { return /* binding */ isPrimitive; },
/* harmony export */ isString: function() { return /* binding */ isString; },
/* harmony export */ isThenable: function() { return /* binding */ isThenable; }
/* harmony export */ });
const isNonNullable = val => {
return val !== undefined && val !== null;
};
const isNumber = val => {
return typeof val === 'number' && !Number.isNaN(val);
};
const isString = val => {
return typeof val === 'string';
};
const isPlainObject = val => {
return val !== null && typeof val === 'object';
};
const isFunction = val => {
return typeof val === 'function';
};
const isThenable = val => {
return isNonNullable(val) && isFunction(val.then);
};
const isPrimitive = val => {
return typeof val !== 'object' && !isFunction(val) || val === null;
};
/***/ }),
/***/ "./components/_util/motion.ts":
/*!************************************!*\
!*** ./components/_util/motion.ts ***!
\************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ getTransitionName: function() { return /* binding */ getTransitionName; }
/* harmony export */ });
/* harmony import */ var _config_provider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../config-provider */ "./components/config-provider/context.ts");
/* harmony import */ var _is__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is */ "./components/_util/is.ts");
// ================== Collapse Motion ==================
const getCollapsedHeight = () => ({
height: 0,
opacity: 0
});
const getRealHeight = node => ({
height: node?.scrollHeight ?? 0,
opacity: node ? 1 : 0
});
const getCurrentHeight = node => ({
height: node?.offsetHeight ?? 0
});
const isTransitionEvent = event => {
return (0,_is__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(event) && 'propertyName' in event;
};
const skipOpacityTransition = (_, event) => {
return event?.deadline === true || (isTransitionEvent(event) ? event.propertyName === 'height' : false);
};
const initCollapseMotion = (rootCls = _config_provider__WEBPACK_IMPORTED_MODULE_0__.defaultPrefixCls) => ({
motionName: `${rootCls}-motion-collapse`,
onAppearStart: getCollapsedHeight,
onEnterStart: getCollapsedHeight,
onAppearActive: getRealHeight,
onEnterActive: getRealHeight,
onLeaveStart: getCurrentHeight,
onLeaveActive: getCollapsedHeight,
onAppearEnd: skipOpacityTransition,
onEnterEnd: skipOpacityTransition,
onLeaveEnd: skipOpacityTransition,
motionDeadline: 500
});
const _SelectPlacements = ['bottomLeft', 'bottomRight', 'topLeft', 'topRight'];
const getTransitionName = (rootPrefixCls, motion, transitionName) => {
if (transitionName !== undefined) {
return transitionName;
}
return `${rootPrefixCls}-${motion}`;
};
/* harmony default export */ __webpack_exports__["default"] = (initCollapseMotion);
/***/ }),
/***/ "./components/_util/reactNode.ts":
/*!***************************************!*\
!*** ./components/_util/reactNode.ts ***!
\***************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ cloneElement: function() { return /* binding */ cloneElement; },
/* harmony export */ isFragment: function() { return /* binding */ isFragment; },
/* harmony export */ replaceElement: function() { return /* binding */ replaceElement; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _is__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is */ "./components/_util/is.ts");
function isFragment(child) {
return child && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().isValidElement(child) && child.type === (react__WEBPACK_IMPORTED_MODULE_0___default().Fragment);
}
const replaceElement = (element, replacement, props) => {
if (! /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().isValidElement(element)) {
return replacement;
}
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(element, (0,_is__WEBPACK_IMPORTED_MODULE_1__.isFunction)(props) ? props(element.props || {}) : props);
};
function cloneElement(element, props) {
return replaceElement(element, element, props);
}
/***/ }),
/***/ "./components/_util/warning.ts":
/*!*************************************!*\
!*** ./components/_util/warning.ts ***!
\*************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ WarningContext: function() { return /* binding */ WarningContext; },
/* harmony export */ devUseWarning: function() { return /* binding */ devUseWarning; }
/* harmony export */ });
/* unused harmony exports noop, resetWarned */
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _rc_component_util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @rc-component/util */ "./node_modules/@rc-component/util/es/index.js");
function noop() {}
const {
resetWarned: rcResetWarned
} = _rc_component_util__WEBPACK_IMPORTED_MODULE_1__.warning;
let deprecatedWarnList = null;
function resetWarned() {
deprecatedWarnList = null;
rcResetWarned();
}
let _warning = noop;
if (true) {
_warning = (valid, component, message) => {
(0,_rc_component_util__WEBPACK_IMPORTED_MODULE_1__.warning)(valid, `[antd: ${component}] ${message}`);
// StrictMode will inject console which will not throw warning in React 17.
if (false) // removed by dead control flow
{}
};
}
const warning = _warning;
const WarningContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createContext({});
/**
* This is a hook but we not named as `useWarning`
* since this is only used in development.
* We should always wrap this in `if (process.env.NODE_ENV !== 'production')` condition
*/
const devUseWarning = true ? component => {
const {
strict
} = react__WEBPACK_IMPORTED_MODULE_0__.useContext(WarningContext);
const typeWarning = (valid, type, message) => {
if (!valid) {
if (strict === false && type === 'deprecated') {
const existWarning = deprecatedWarnList;
if (!deprecatedWarnList) {
deprecatedWarnList = {};
}
deprecatedWarnList[component] = deprecatedWarnList[component] || [];
if (!deprecatedWarnList[component].includes(message || '')) {
deprecatedWarnList[component].push(message || '');
}
// Warning for the first time
if (!existWarning) {
console.warn('[antd] There exists deprecated usage in your code:', deprecatedWarnList);
}
} else {
true ? warning(valid, component, message) : 0;
}
}
};
typeWarning.deprecated = (valid, oldProp, newProp, message = '') => {
typeWarning(valid, 'deprecated', `\`${oldProp}\` is deprecated. Please use \`${newProp}\` instead.${message ? ` ${message}` : ''}`);
};
return typeWarning;
} : 0;
/* harmony default export */ __webpack_exports__["default"] = (warning);
/***/ }),
/***/ "./components/_util/zindexContext.ts":
/*!*******************************************!*\
!*** ./components/_util/zindexContext.ts ***!
\*******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
const ZIndexContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined);
if (true) {
ZIndexContext.displayName = 'ZIndexContext';
}
/* harmony default export */ __webpack_exports__["default"] = (ZIndexContext);
/***/ }),
/***/ "./components/affix/style/index.ts":
/*!*****************************************!*\
!*** ./components/affix/style/index.ts ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
// ============================== Shared ==============================
const genSharedAffixStyle = token => {
const {
componentCls
} = token;
return {
[componentCls]: {
position: 'fixed',
zIndex: token.zIndexPopup
}
};
};
const prepareComponentToken = token => ({
zIndexPopup: token.zIndexBase + 10
});
// ============================== Export ==============================
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_0__.genStyleHooks)('Affix', genSharedAffixStyle, prepareComponentToken));
/***/ }),
/***/ "./components/alert/style/index.ts":
/*!*****************************************!*\
!*** ./components/alert/style/index.ts ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ genActionStyle: function() { return /* binding */ genActionStyle; },
/* harmony export */ genBaseStyle: function() { return /* binding */ genBaseStyle; },
/* harmony export */ genTypeStyle: function() { return /* binding */ genTypeStyle; },
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const genAlertTypeStyle = (bgColor, borderColor, iconColor, token, alertCls) => ({
background: bgColor,
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${borderColor}`,
[`${alertCls}-icon`]: {
color: iconColor
}
});
const genBaseStyle = token => {
const {
componentCls,
motionDurationSlow: duration,
marginXS,
marginSM,
fontSize,
fontSizeLG,
lineHeight,
borderRadiusLG: borderRadius,
motionEaseInOutCirc,
withDescriptionIconSize,
colorText,
colorTextHeading,
withDescriptionPadding,
defaultPadding
} = token;
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
position: 'relative',
display: 'flex',
alignItems: 'center',
padding: defaultPadding,
wordWrap: 'break-word',
borderRadius,
[`&${componentCls}-rtl`]: {
direction: 'rtl'
},
[`${componentCls}-section`]: {
flex: 1,
minWidth: 0
},
[`${componentCls}-icon`]: {
marginInlineEnd: marginXS,
lineHeight: 0
},
'&-description': {
display: 'none',
fontSize,
lineHeight
},
'&-title': {
color: colorTextHeading
},
[`&${componentCls}-motion-leave`]: {
overflow: 'hidden',
opacity: 1,
transition: [`max-height`, `opacity`, `padding-top`, `padding-bottom`, `margin-bottom`].map(prop => `${prop} ${duration} ${motionEaseInOutCirc}`).join(', ')
},
[`&${componentCls}-motion-leave-active`]: {
maxHeight: 0,
marginBottom: '0 !important',
paddingTop: 0,
paddingBottom: 0,
opacity: 0
}
},
[`${componentCls}-with-description`]: {
alignItems: 'flex-start',
padding: withDescriptionPadding,
[`${componentCls}-icon`]: {
marginInlineEnd: marginSM,
fontSize: withDescriptionIconSize,
lineHeight: 0
},
[`${componentCls}-title`]: {
display: 'block',
marginBottom: marginXS,
color: colorTextHeading,
fontSize: fontSizeLG
},
[`${componentCls}-description`]: {
display: 'block',
color: colorText
}
},
[`${componentCls}-banner`]: {
marginBottom: 0,
border: '0 !important',
borderRadius: 0
}
};
};
const genTypeStyle = token => {
const {
componentCls,
colorSuccess,
colorSuccessBorder,
colorSuccessBg,
colorWarning,
colorWarningBorder,
colorWarningBg,
colorError,
colorErrorBorder,
colorErrorBg,
colorInfo,
colorInfoBorder,
colorInfoBg
} = token;
return {
[componentCls]: {
'&-success': genAlertTypeStyle(colorSuccessBg, colorSuccessBorder, colorSuccess, token, componentCls),
'&-info': genAlertTypeStyle(colorInfoBg, colorInfoBorder, colorInfo, token, componentCls),
'&-warning': genAlertTypeStyle(colorWarningBg, colorWarningBorder, colorWarning, token, componentCls),
'&-error': {
...genAlertTypeStyle(colorErrorBg, colorErrorBorder, colorError, token, componentCls),
[`${componentCls}-description > pre`]: {
margin: 0,
padding: 0
}
}
}
};
};
const genActionStyle = token => {
const {
componentCls,
iconCls,
motionDurationMid,
marginXS,
fontSizeIcon,
colorIcon,
colorIconHover
} = token;
return {
[componentCls]: {
'&-actions': {
marginInlineStart: marginXS
},
[`${componentCls}-close-icon`]: {
marginInlineStart: marginXS,
padding: 0,
overflow: 'hidden',
fontSize: fontSizeIcon,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(fontSizeIcon),
backgroundColor: 'transparent',
border: 'none',
cursor: 'pointer',
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.genFocusStyle)(token),
[`${iconCls}-close`]: {
color: colorIcon,
transition: `color ${motionDurationMid}`,
'&:hover': {
color: colorIconHover
}
}
},
'&-close-text': {
color: colorIcon,
transition: `color ${motionDurationMid}`,
'&:hover': {
color: colorIconHover
}
}
}
};
};
const prepareComponentToken = token => {
const paddingHorizontal = 12; // Fixed value here.
return {
withDescriptionIconSize: token.fontSizeHeading3,
defaultPadding: `${token.paddingContentVerticalSM}px ${paddingHorizontal}px`,
withDescriptionPadding: `${token.paddingMD}px ${token.paddingContentHorizontalLG}px`
};
};
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.genStyleHooks)('Alert', token => [genBaseStyle(token), genTypeStyle(token), genActionStyle(token)], prepareComponentToken));
/***/ }),
/***/ "./components/anchor/style/index.ts":
/*!******************************************!*\
!*** ./components/anchor/style/index.ts ***!
\******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
// ============================== Shared ==============================
const genSharedAnchorStyle = token => {
const {
componentCls,
holderOffsetBlock,
motionDurationSlow,
lineWidthBold,
colorPrimary,
lineType,
colorSplit,
calc
} = token;
return {
[`${componentCls}-wrapper`]: {
marginBlockStart: calc(holderOffsetBlock).mul(-1).equal(),
paddingBlockStart: holderOffsetBlock,
// delete overflow: auto
// overflow: 'auto',
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
position: 'relative',
paddingInlineStart: lineWidthBold,
[`${componentCls}-link`]: {
paddingBlock: token.linkPaddingBlock,
paddingInline: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.linkPaddingInlineStart)} 0`,
'&-title': {
..._style__WEBPACK_IMPORTED_MODULE_1__.textEllipsis,
position: 'relative',
display: 'block',
marginBlockEnd: token.anchorTitleBlock,
color: token.colorText,
transition: `all ${token.motionDurationSlow}`,
'&:only-child': {
marginBlockEnd: 0
}
},
[`&-active > ${componentCls}-link-title`]: {
color: token.colorPrimary
},
// link link
[`${componentCls}-link`]: {
paddingBlock: token.anchorPaddingBlockSecondary
}
}
},
[`&:not(${componentCls}-wrapper-horizontal)`]: {
[componentCls]: {
'&::before': {
position: 'absolute',
insetInlineStart: 0,
top: 0,
height: '100%',
borderInlineStart: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidthBold)} ${lineType} ${colorSplit}`,
content: '" "'
},
[`${componentCls}-ink`]: {
position: 'absolute',
insetInlineStart: 0,
display: 'none',
transform: 'translateY(-50%)',
transition: `top ${motionDurationSlow} ease-in-out`,
width: lineWidthBold,
backgroundColor: colorPrimary,
[`&${componentCls}-ink-visible`]: {
display: 'inline-block'
}
}
}
},
[`${componentCls}-fixed ${componentCls}-ink ${componentCls}-ink`]: {
display: 'none'
}
}
};
};
const genSharedAnchorHorizontalStyle = token => {
const {
componentCls,
motionDurationSlow,
lineWidthBold,
colorPrimary
} = token;
return {
[`${componentCls}-wrapper-horizontal`]: {
position: 'relative',
'&::before': {
position: 'absolute',
left: {
_skip_check_: true,
value: 0
},
right: {
_skip_check_: true,
value: 0
},
bottom: 0,
borderBottom: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
content: '" "'
},
[componentCls]: {
overflowX: 'scroll',
position: 'relative',
display: 'flex',
scrollbarWidth: 'none' /* Firefox */,
'&::-webkit-scrollbar': {
display: 'none' /* Safari and Chrome */
},
[`${componentCls}-link:first-of-type`]: {
paddingInline: 0
},
[`${componentCls}-ink`]: {
position: 'absolute',
bottom: 0,
transition: [`left`, `width`].map(prop => `${prop} ${motionDurationSlow} ease-in-out`).join(', '),
height: lineWidthBold,
backgroundColor: colorPrimary
}
}
}
};
};
const prepareComponentToken = token => ({
linkPaddingBlock: token.paddingXXS,
linkPaddingInlineStart: token.padding
});
// ============================== Export ==============================
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genStyleHooks)('Anchor', token => {
const {
fontSize,
fontSizeLG,
paddingXXS,
calc
} = token;
const anchorToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token, {
holderOffsetBlock: paddingXXS,
anchorPaddingBlockSecondary: calc(paddingXXS).div(2).equal(),
anchorTitleBlock: calc(fontSize).div(14).mul(3).equal(),
anchorBallSize: calc(fontSizeLG).div(2).equal()
});
return [genSharedAnchorStyle(anchorToken), genSharedAnchorHorizontalStyle(anchorToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/app/style/index.ts":
/*!***************************************!*\
!*** ./components/app/style/index.ts ***!
\***************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
// =============================== Base ===============================
const genBaseStyle = token => {
const {
componentCls,
colorText,
fontSize,
lineHeight,
fontFamily
} = token;
return {
[componentCls]: {
color: colorText,
fontSize,
lineHeight,
fontFamily,
[`&${componentCls}-rtl`]: {
direction: 'rtl'
}
}
};
};
const prepareComponentToken = () => ({});
// ============================== Export ==============================
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_0__.genStyleHooks)('App', genBaseStyle, prepareComponentToken));
/***/ }),
/***/ "./components/avatar/style/index.ts":
/*!******************************************!*\
!*** ./components/avatar/style/index.ts ***!
\******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const genBaseStyle = token => {
const {
antCls,
componentCls,
iconCls,
avatarBg,
avatarColor,
containerSize,
containerSizeLG,
containerSizeSM,
textFontSize,
textFontSizeLG,
textFontSizeSM,
iconFontSize,
iconFontSizeLG,
iconFontSizeSM,
borderRadius,
borderRadiusLG,
borderRadiusSM,
lineWidth,
lineType
} = token;
// Avatar size style
const avatarSizeStyle = (size, fontSize, iconFontSize, radius) => ({
width: size,
height: size,
borderRadius: '50%',
fontSize,
[`&${componentCls}-square`]: {
borderRadius: radius
},
[`&${componentCls}-icon`]: {
fontSize: iconFontSize,
[`> ${iconCls}`]: {
margin: 0
}
}
});
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
position: 'relative',
display: 'inline-flex',
justifyContent: 'center',
alignItems: 'center',
overflow: 'hidden',
color: avatarColor,
whiteSpace: 'nowrap',
textAlign: 'center',
verticalAlign: 'middle',
background: avatarBg,
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${lineType} transparent`,
'&-image': {
background: 'transparent'
},
[`${antCls}-image-img`]: {
display: 'block'
},
...avatarSizeStyle(containerSize, textFontSize, iconFontSize, borderRadius),
'&-lg': {
...avatarSizeStyle(containerSizeLG, textFontSizeLG, iconFontSizeLG, borderRadiusLG)
},
'&-sm': {
...avatarSizeStyle(containerSizeSM, textFontSizeSM, iconFontSizeSM, borderRadiusSM)
},
'> img': {
display: 'block',
width: '100%',
height: '100%',
objectFit: 'cover'
}
}
};
};
const genGroupStyle = token => {
const {
componentCls,
groupBorderColor,
groupOverlapping,
groupSpace
} = token;
return {
[`${componentCls}-group`]: {
display: 'inline-flex',
[componentCls]: {
borderColor: groupBorderColor
},
'> *:not(:first-child)': {
marginInlineStart: groupOverlapping
}
},
[`${componentCls}-group-popover`]: {
[`${componentCls} + ${componentCls}`]: {
marginInlineStart: groupSpace
}
}
};
};
const prepareComponentToken = token => {
const {
controlHeight,
controlHeightLG,
controlHeightSM,
fontSize,
fontSizeLG,
fontSizeXL,
fontSizeHeading3,
marginXS,
marginXXS,
colorBorderBg
} = token;
return {
containerSize: controlHeight,
containerSizeLG: controlHeightLG,
containerSizeSM: controlHeightSM,
textFontSize: fontSize,
textFontSizeLG: fontSize,
textFontSizeSM: fontSize,
iconFontSize: Math.round((fontSizeLG + fontSizeXL) / 2),
iconFontSizeLG: fontSizeHeading3,
iconFontSizeSM: fontSize,
groupSpace: marginXXS,
groupOverlapping: -marginXS,
groupBorderColor: colorBorderBg
};
};
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genStyleHooks)('Avatar', token => {
const {
colorTextLightSolid,
colorTextPlaceholder
} = token;
const avatarToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token, {
avatarBg: colorTextPlaceholder,
avatarColor: colorTextLightSolid
});
return [genBaseStyle(avatarToken), genGroupStyle(avatarToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/back-top/style/index.ts":
/*!********************************************!*\
!*** ./components/back-top/style/index.ts ***!
\********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
// ============================== Shared ==============================
const genSharedBackTopStyle = token => {
const {
componentCls,
backTopFontSize,
backTopSize,
zIndexPopup
} = token;
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
position: 'fixed',
insetInlineEnd: token.backTopInlineEnd,
insetBlockEnd: token.backTopBlockEnd,
zIndex: zIndexPopup,
width: 40,
height: 40,
cursor: 'pointer',
'&:empty': {
display: 'none'
},
[`${componentCls}-content`]: {
width: backTopSize,
height: backTopSize,
overflow: 'hidden',
color: token.backTopColor,
textAlign: 'center',
backgroundColor: token.backTopBackground,
borderRadius: backTopSize,
transition: `all ${token.motionDurationMid}`,
'&:hover': {
backgroundColor: token.backTopHoverBackground,
transition: `all ${token.motionDurationMid}`
}
},
// change to .backtop .backtop-icon
[`${componentCls}-icon`]: {
fontSize: backTopFontSize,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(backTopSize)
}
}
};
};
const genMediaBackTopStyle = token => {
const {
componentCls,
screenMD,
screenXS,
backTopInlineEndMD,
backTopInlineEndXS
} = token;
return {
[`@media (max-width: ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(screenMD)})`]: {
[componentCls]: {
insetInlineEnd: backTopInlineEndMD
}
},
[`@media (max-width: ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(screenXS)})`]: {
[componentCls]: {
insetInlineEnd: backTopInlineEndXS
}
}
};
};
const prepareComponentToken = token => ({
zIndexPopup: token.zIndexBase + 10
});
// ============================== Export ==============================
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genStyleHooks)('BackTop', token => {
const {
fontSizeHeading3,
colorTextDescription,
colorTextLightSolid,
colorText,
controlHeightLG,
calc
} = token;
const backTopToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token, {
backTopBackground: colorTextDescription,
backTopColor: colorTextLightSolid,
backTopHoverBackground: colorText,
backTopFontSize: fontSizeHeading3,
backTopSize: controlHeightLG,
backTopBlockEnd: calc(controlHeightLG).mul(1.25).equal(),
backTopInlineEnd: calc(controlHeightLG).mul(2.5).equal(),
backTopInlineEndMD: calc(controlHeightLG).mul(1.5).equal(),
backTopInlineEndXS: calc(controlHeightLG).mul(0.5).equal()
});
return [genSharedBackTopStyle(backTopToken), genMediaBackTopStyle(backTopToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/badge/style/index.ts":
/*!*****************************************!*\
!*** ./components/badge/style/index.ts ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; },
/* harmony export */ prepareToken: function() { return /* binding */ prepareToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genPresetColor.ts");
const antStatusProcessing = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antStatusProcessing', {
'0%': {
transform: 'scale(0.8)',
opacity: 0.5
},
'100%': {
transform: 'scale(2.4)',
opacity: 0
}
});
const antZoomBadgeIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antZoomBadgeIn', {
'0%': {
transform: 'scale(0) translate(50%, -50%)',
opacity: 0
},
'100%': {
transform: 'scale(1) translate(50%, -50%)'
}
});
const antZoomBadgeOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antZoomBadgeOut', {
'0%': {
transform: 'scale(1) translate(50%, -50%)'
},
'100%': {
transform: 'scale(0) translate(50%, -50%)',
opacity: 0
}
});
const antNoWrapperZoomBadgeIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antNoWrapperZoomBadgeIn', {
'0%': {
transform: 'scale(0)',
opacity: 0
},
'100%': {
transform: 'scale(1)'
}
});
const antNoWrapperZoomBadgeOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antNoWrapperZoomBadgeOut', {
'0%': {
transform: 'scale(1)'
},
'100%': {
transform: 'scale(0)',
opacity: 0
}
});
const antBadgeLoadingCircle = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antBadgeLoadingCircle', {
'0%': {
transformOrigin: '50%'
},
'100%': {
transform: 'translate(50%, -50%) rotate(360deg)',
transformOrigin: '50%'
}
});
const genSharedBadgeStyle = token => {
const {
componentCls,
iconCls,
antCls,
badgeShadowSize,
textFontSize,
textFontSizeSM,
statusSize,
dotSize,
textFontWeight,
indicatorHeight,
indicatorHeightSM,
marginXS,
calc
} = token;
const numberPrefixCls = `${antCls}-scroll-number`;
const colorPreset = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_4__["default"])(token, (colorKey, {
darkColor
}) => ({
[`&${componentCls} ${componentCls}-color-${colorKey}`]: {
background: darkColor,
[`&:not(${componentCls}-count)`]: {
color: darkColor
},
'a:hover &': {
background: darkColor
}
}
}));
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
position: 'relative',
display: 'inline-block',
width: 'fit-content',
lineHeight: 1,
[`${componentCls}-count`]: {
display: 'inline-flex',
justifyContent: 'center',
zIndex: token.indicatorZIndex,
minWidth: indicatorHeight,
height: indicatorHeight,
color: token.badgeTextColor,
fontWeight: textFontWeight,
fontSize: textFontSize,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(indicatorHeight),
whiteSpace: 'nowrap',
textAlign: 'center',
background: token.badgeColor,
borderRadius: calc(indicatorHeight).div(2).equal(),
boxShadow: `0 0 0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(badgeShadowSize)} ${token.badgeShadowColor}`,
transition: `background-color ${token.motionDurationMid}`,
a: {
color: token.badgeTextColor
},
'a:hover': {
color: token.badgeTextColor
},
'a:hover &': {
background: token.badgeColorHover
}
},
[`${componentCls}-count-sm`]: {
minWidth: indicatorHeightSM,
height: indicatorHeightSM,
fontSize: textFontSizeSM,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(indicatorHeightSM),
borderRadius: calc(indicatorHeightSM).div(2).equal()
},
[`${componentCls}-multiple-words`]: {
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingXS)}`,
bdi: {
unicodeBidi: 'plaintext'
}
},
[`${componentCls}-dot`]: {
zIndex: token.indicatorZIndex,
width: dotSize,
minWidth: dotSize,
height: dotSize,
background: token.badgeColor,
borderRadius: '100%',
boxShadow: `0 0 0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(badgeShadowSize)} ${token.badgeShadowColor}`
},
[`${componentCls}-count, ${componentCls}-dot, ${numberPrefixCls}-custom-component`]: {
position: 'absolute',
top: 0,
insetInlineEnd: 0,
transform: 'translate(50%, -50%)',
transformOrigin: '100% 0%',
[`&${iconCls}-spin`]: {
animationName: antBadgeLoadingCircle,
animationDuration: '1s',
animationIterationCount: 'infinite',
animationTimingFunction: 'linear'
}
},
[`&${componentCls}-status`]: {
lineHeight: 'inherit',
verticalAlign: 'baseline',
[`${componentCls}-status-dot`]: {
position: 'relative',
top: -1,
// Magic number, but seems better experience
display: 'inline-block',
width: statusSize,
height: statusSize,
verticalAlign: 'middle',
borderRadius: '50%'
},
[`${componentCls}-status-success`]: {
backgroundColor: token.colorSuccess
},
[`${componentCls}-status-processing`]: {
overflow: 'visible',
color: token.colorInfo,
backgroundColor: token.colorInfo,
borderColor: 'currentcolor',
'&::after': {
position: 'absolute',
top: 0,
insetInlineStart: 0,
width: '100%',
height: '100%',
borderWidth: badgeShadowSize,
borderStyle: 'solid',
borderColor: 'inherit',
borderRadius: '50%',
animationName: antStatusProcessing,
animationDuration: token.badgeProcessingDuration,
animationIterationCount: 'infinite',
animationTimingFunction: 'ease-in-out',
content: '""'
}
},
[`${componentCls}-status-default`]: {
backgroundColor: token.colorTextPlaceholder
},
[`${componentCls}-status-error`]: {
backgroundColor: token.colorError
},
[`${componentCls}-status-warning`]: {
backgroundColor: token.colorWarning
},
[`${componentCls}-status-text`]: {
marginInlineStart: marginXS,
color: token.colorText,
fontSize: token.fontSize
}
},
...colorPreset,
[`${componentCls}-zoom-appear, ${componentCls}-zoom-enter`]: {
animationName: antZoomBadgeIn,
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseOutBack,
animationFillMode: 'both'
},
[`${componentCls}-zoom-leave`]: {
animationName: antZoomBadgeOut,
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseOutBack,
animationFillMode: 'both'
},
[`&${componentCls}-not-a-wrapper`]: {
[`${componentCls}-zoom-appear, ${componentCls}-zoom-enter`]: {
animationName: antNoWrapperZoomBadgeIn,
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseOutBack
},
[`${componentCls}-zoom-leave`]: {
animationName: antNoWrapperZoomBadgeOut,
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseOutBack
},
[`&:not(${componentCls}-status)`]: {
verticalAlign: 'middle'
},
[`${numberPrefixCls}-custom-component, ${componentCls}-count`]: {
transform: 'none'
},
[`${numberPrefixCls}-custom-component, ${numberPrefixCls}`]: {
position: 'relative',
top: 'auto',
display: 'block',
transformOrigin: '50% 50%'
}
},
[numberPrefixCls]: {
overflow: 'hidden',
transition: `all ${token.motionDurationMid} ${token.motionEaseOutBack}`,
[`${numberPrefixCls}-only`]: {
position: 'relative',
display: 'inline-block',
height: indicatorHeight,
transition: `all ${token.motionDurationSlow} ${token.motionEaseOutBack}`,
WebkitTransformStyle: 'preserve-3d',
WebkitBackfaceVisibility: 'hidden',
[`> p${numberPrefixCls}-only-unit`]: {
height: indicatorHeight,
margin: 0,
WebkitTransformStyle: 'preserve-3d',
WebkitBackfaceVisibility: 'hidden'
}
},
[`${numberPrefixCls}-symbol`]: {
verticalAlign: 'top'
}
},
// ====================== RTL =======================
'&-rtl': {
direction: 'rtl',
[`${componentCls}-count, ${componentCls}-dot, ${numberPrefixCls}-custom-component`]: {
transform: 'translate(-50%, -50%)'
}
}
}
};
};
// ============================== Export ==============================
const prepareToken = token => {
const {
fontHeight,
lineWidth,
marginXS,
colorBorderBg
} = token;
const badgeFontHeight = fontHeight;
const badgeShadowSize = lineWidth;
const badgeTextColor = token.colorTextLightSolid;
const badgeColor = token.colorError;
const badgeColorHover = token.colorErrorHover;
const badgeToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token, {
badgeFontHeight,
badgeShadowSize,
badgeTextColor,
badgeColor,
badgeColorHover,
badgeShadowColor: colorBorderBg,
badgeProcessingDuration: '1.2s',
badgeRibbonOffset: marginXS,
// Follow token just by Design. Not related with token
badgeRibbonCornerTransform: 'scaleY(0.75)',
badgeRibbonCornerFilter: `brightness(75%)`
});
return badgeToken;
};
const prepareComponentToken = token => {
const {
fontSize,
lineHeight,
fontSizeSM,
lineWidth
} = token;
return {
indicatorZIndex: 'auto',
indicatorHeight: Math.round(fontSize * lineHeight) - 2 * lineWidth,
indicatorHeightSM: fontSize,
dotSize: fontSizeSM / 2,
textFontSize: fontSizeSM,
textFontSizeSM: fontSizeSM,
textFontWeight: 'normal',
statusSize: fontSizeSM / 2
};
};
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genStyleHooks)('Badge', token => {
const badgeToken = prepareToken(token);
return genSharedBadgeStyle(badgeToken);
}, prepareComponentToken));
/***/ }),
/***/ "./components/breadcrumb/style/index.ts":
/*!**********************************************!*\
!*** ./components/breadcrumb/style/index.ts ***!
\**********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const genBreadcrumbStyle = token => {
const {
componentCls,
iconCls,
calc
} = token;
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
color: token.itemColor,
fontSize: token.fontSize,
[iconCls]: {
fontSize: token.iconFontSize
},
ol: {
display: 'flex',
flexWrap: 'wrap',
margin: 0,
padding: 0,
listStyle: 'none'
},
[`${componentCls}-item a`]: {
color: token.linkColor,
transition: `color ${token.motionDurationMid}`,
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingXXS)}`,
borderRadius: token.borderRadiusSM,
height: token.fontHeight,
display: 'inline-block',
marginInline: calc(token.marginXXS).mul(-1).equal(),
'&:hover': {
color: token.linkHoverColor,
backgroundColor: token.colorBgTextHover
},
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.genFocusStyle)(token)
},
[`${componentCls}-item:last-child`]: {
color: token.lastItemColor
},
[`${componentCls}-separator`]: {
marginInline: token.separatorMargin,
color: token.separatorColor
},
[`${componentCls}-link`]: {
[`
> ${iconCls} + span,
> ${iconCls} + a
`]: {
marginInlineStart: token.marginXXS
}
},
[`${componentCls}-overlay-link`]: {
borderRadius: token.borderRadiusSM,
height: token.fontHeight,
display: 'inline-block',
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingXXS)}`,
marginInline: calc(token.marginXXS).mul(-1).equal(),
[`> ${iconCls}`]: {
marginInlineStart: token.marginXXS,
fontSize: token.fontSizeIcon
},
'&:hover': {
color: token.linkHoverColor,
backgroundColor: token.colorBgTextHover,
a: {
color: token.linkHoverColor
}
},
a: {
'&:hover': {
backgroundColor: 'transparent'
}
}
},
// rtl style
[`&${token.componentCls}-rtl`]: {
direction: 'rtl'
}
}
};
};
const prepareComponentToken = token => ({
itemColor: token.colorTextDescription,
lastItemColor: token.colorText,
iconFontSize: token.fontSize,
linkColor: token.colorTextDescription,
linkHoverColor: token.colorText,
separatorColor: token.colorTextDescription,
separatorMargin: token.marginXS
});
// ============================== Export ==============================
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genStyleHooks)('Breadcrumb', token => {
const breadcrumbToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token, {});
return genBreadcrumbStyle(breadcrumbToken);
}, prepareComponentToken));
/***/ }),
/***/ "./components/button/style/index.ts":
/*!******************************************************!*\
!*** ./components/button/style/index.ts + 2 modules ***!
\******************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ button_style; }
});
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
// EXTERNAL MODULE: ./components/style/index.tsx
var style = __webpack_require__("./components/style/index.tsx");
// EXTERNAL MODULE: ./components/style/motion/util.ts
var util = __webpack_require__("./components/style/motion/util.ts");
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
;// ./components/button/style/group.ts
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,
groupBorderColor,
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: token.calc(lineWidth).mul(-1).equal(),
[`&, & > ${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`, groupBorderColor), genButtonBorderStyle(`${componentCls}-danger`, colorErrorHover)]
};
};
/* harmony default export */ var group = (genGroupStyle);
// EXTERNAL MODULE: ./components/button/style/token.ts
var style_token = __webpack_require__("./components/button/style/token.ts");
// EXTERNAL MODULE: ./components/theme/interface/presetColors.ts
var presetColors = __webpack_require__("./components/theme/interface/presetColors.ts");
;// ./components/button/style/variant.ts
const genVariantStyle = token => {
const {
componentCls,
antCls,
lineWidth
} = token;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'btn');
return {
[componentCls]: [
// ==============================================================
// == Variable ==
// ==============================================================
{
// Border
[varName('border-width')]: lineWidth,
[varName('border-color')]: '#000',
[varName('border-color-hover')]: varRef('border-color'),
[varName('border-color-active')]: varRef('border-color'),
[varName('border-color-disabled')]: varRef('border-color'),
[varName('border-style')]: 'solid',
// Text
[varName('text-color')]: '#000',
[varName('text-color-hover')]: varRef('text-color'),
[varName('text-color-active')]: varRef('text-color'),
[varName('text-color-disabled')]: varRef('text-color'),
// Background
[varName('bg-color')]: '#ddd',
[varName('bg-color-hover')]: varRef('bg-color'),
[varName('bg-color-active')]: varRef('bg-color'),
[varName('bg-color-disabled')]: token.colorBgContainerDisabled,
[varName('bg-color-container')]: token.colorBgContainer,
// Shadow
[varName('shadow')]: 'none'
},
// ==============================================================
// == Template ==
// ==============================================================
{
// Basic
border: [varRef('border-width'), varRef('border-style'), varRef('border-color')].join(' '),
color: varRef('text-color'),
backgroundColor: varRef('bg-color'),
// Status
[`&:not(:disabled):not(${componentCls}-disabled)`]: {
// Hover
'&:hover': {
border: [varRef('border-width'), varRef('border-style'), varRef('border-color-hover')].join(' '),
color: varRef('text-color-hover'),
backgroundColor: varRef('bg-color-hover')
},
// Active
'&:active': {
border: [varRef('border-width'), varRef('border-style'), varRef('border-color-active')].join(' '),
color: varRef('text-color-active'),
backgroundColor: varRef('bg-color-active')
}
}
},
// ==============================================================
// == Variants ==
// ==============================================================
{
// >>>>> Solid
[`&${componentCls}-variant-solid`]: {
// Solid Variables
[varName('solid-bg-color')]: varRef('color-base'),
[varName('solid-bg-color-hover')]: varRef('color-hover'),
[varName('solid-bg-color-active')]: varRef('color-active'),
// Variables
[varName('border-color')]: 'transparent',
[varName('text-color')]: token.colorTextLightSolid,
[varName('bg-color')]: varRef('solid-bg-color'),
[varName('bg-color-hover')]: varRef('solid-bg-color-hover'),
[varName('bg-color-active')]: varRef('solid-bg-color-active'),
// Box Shadow
boxShadow: varRef('shadow')
},
// >>>>> Outlined & Dashed
[`&${componentCls}-variant-outlined, &${componentCls}-variant-dashed`]: {
[varName('border-color')]: varRef('color-base'),
[varName('border-color-hover')]: varRef('color-hover'),
[varName('border-color-active')]: varRef('color-active'),
[varName('bg-color')]: varRef('bg-color-container'),
[varName('text-color')]: varRef('color-base'),
[varName('text-color-hover')]: varRef('color-hover'),
[varName('text-color-active')]: varRef('color-active'),
// Box Shadow
boxShadow: varRef('shadow')
},
// >>>>> Dashed
[`&${componentCls}-variant-dashed`]: {
[varName('border-style')]: 'dashed',
[varName('bg-color-disabled')]: token.dashedBgDisabled
},
// >>>>> Filled
[`&${componentCls}-variant-filled`]: {
[varName('border-color')]: 'transparent',
[varName('text-color')]: varRef('color-base'),
[varName('bg-color')]: varRef('color-light'),
[varName('bg-color-hover')]: varRef('color-light-hover'),
[varName('bg-color-active')]: varRef('color-light-active')
},
// >>>>> Text & Link
[`&${componentCls}-variant-text, &${componentCls}-variant-link`]: {
[varName('border-color')]: 'transparent',
[varName('text-color')]: varRef('color-base'),
[varName('text-color-hover')]: varRef('color-hover'),
[varName('text-color-active')]: varRef('color-active'),
[varName('bg-color')]: 'transparent',
[varName('bg-color-hover')]: 'transparent',
[varName('bg-color-active')]: 'transparent',
[`&:disabled, &${token.componentCls}-disabled`]: {
background: 'transparent',
borderColor: 'transparent'
}
},
// >>>>> Text
[`&${componentCls}-variant-text`]: {
[varName('bg-color-hover')]: varRef('color-light'),
[varName('bg-color-active')]: varRef('color-light-active')
}
},
// ==============================================================
// == Colors ==
// ==============================================================
{
// ======================== By Default ========================
// >>>>> Link
[`&${componentCls}-variant-link`]: {
[varName('color-base')]: token.colorLink,
[varName('color-hover')]: token.colorLinkHover,
[varName('color-active')]: token.colorLinkActive,
[varName('bg-color-hover')]: token.linkHoverBg
},
// ======================== Compatible ========================
// >>>>> Primary
[`&${componentCls}-color-primary`]: {
[varName('color-base')]: token.colorPrimary,
[varName('color-hover')]: token.colorPrimaryHover,
[varName('color-active')]: token.colorPrimaryActive,
[varName('color-light')]: token.colorPrimaryBg,
[varName('color-light-hover')]: token.colorPrimaryBgHover,
[varName('color-light-active')]: token.colorPrimaryBorder,
[varName('shadow')]: token.primaryShadow,
[`&${componentCls}-variant-solid`]: {
[varName('text-color')]: token.primaryColor,
[varName('text-color-hover')]: varRef('text-color'),
[varName('text-color-active')]: varRef('text-color')
}
},
// >>>>> Danger
[`&${componentCls}-color-dangerous`]: {
[varName('color-base')]: token.colorError,
[varName('color-hover')]: token.colorErrorHover,
[varName('color-active')]: token.colorErrorActive,
[varName('color-light')]: token.colorErrorBg,
[varName('color-light-hover')]: token.colorErrorBgFilledHover,
[varName('color-light-active')]: token.colorErrorBgActive,
[varName('shadow')]: token.dangerShadow,
[`&${componentCls}-variant-solid`]: {
[varName('text-color')]: token.dangerColor,
[varName('text-color-hover')]: varRef('text-color'),
[varName('text-color-active')]: varRef('text-color')
}
},
// >>>>> Default
[`&${componentCls}-color-default`]: {
[varName('solid-bg-color')]: token.colorBgSolid,
[varName('solid-bg-color-hover')]: token.colorBgSolidHover,
[varName('solid-bg-color-active')]: token.colorBgSolidActive,
[varName('color-base')]: token.defaultBorderColor,
[varName('color-hover')]: token.defaultHoverBorderColor,
[varName('color-active')]: token.defaultActiveBorderColor,
[varName('color-light')]: token.colorFillTertiary,
[varName('color-light-hover')]: token.colorFillSecondary,
[varName('color-light-active')]: token.colorFill,
[varName('text-color')]: token.defaultColor,
[varName('text-color-hover')]: token.defaultHoverColor,
[varName('text-color-active')]: token.defaultActiveColor,
[varName('shadow')]: token.defaultShadow,
[`&${componentCls}-variant-outlined`]: {
[varName('bg-color-disabled')]: token.defaultBgDisabled
},
[`&${componentCls}-variant-solid`]: {
[varName('text-color')]: token.solidTextColor,
[varName('text-color-hover')]: varRef('text-color'),
[varName('text-color-active')]: varRef('text-color')
},
[`&${componentCls}-variant-filled, &${componentCls}-variant-text`]: {
[varName('text-color-hover')]: varRef('text-color'),
[varName('text-color-active')]: varRef('text-color')
},
[`&${componentCls}-variant-outlined, &${componentCls}-variant-dashed`]: {
[varName('text-color')]: token.defaultColor,
[varName('text-color-hover')]: token.defaultHoverColor,
[varName('text-color-active')]: token.defaultActiveColor,
[varName('bg-color-container')]: token.defaultBg,
[varName('bg-color-hover')]: token.defaultHoverBg,
[varName('bg-color-active')]: token.defaultActiveBg
},
[`&${componentCls}-variant-text`]: {
[varName('text-color')]: token.textTextColor,
[varName('text-color-hover')]: token.textTextHoverColor,
[varName('text-color-active')]: token.textTextActiveColor,
[varName('bg-color-hover')]: token.textHoverBg
},
[`&${componentCls}-background-ghost`]: {
[`&${componentCls}-variant-outlined, &${componentCls}-variant-dashed`]: {
[varName('text-color')]: token.defaultGhostColor,
[varName('border-color')]: token.defaultGhostBorderColor
}
}
}
},
// >>>>> Preset Colors
presetColors.PresetColors.map(colorKey => {
const darkColor = token[`${colorKey}6`];
const lightColor = token[`${colorKey}1`];
const hoverColor = token[`${colorKey}Hover`];
const lightHoverColor = token[`${colorKey}2`];
const lightActiveColor = token[`${colorKey}3`];
const activeColor = token[`${colorKey}Active`];
const shadowColor = token[`${colorKey}ShadowColor`];
return {
[`&${componentCls}-color-${colorKey}`]: {
[varName('color-base')]: darkColor,
[varName('color-hover')]: hoverColor,
[varName('color-active')]: activeColor,
[varName('color-light')]: lightColor,
[varName('color-light-hover')]: lightHoverColor,
[varName('color-light-active')]: lightActiveColor,
[varName('shadow')]: shadowColor
}
};
}),
// ==============================================================
// == Disabled ==
// ==============================================================
{
// Disabled
[`&:disabled, &${token.componentCls}-disabled`]: {
cursor: 'not-allowed',
borderColor: token.colorBorderDisabled,
background: varRef('bg-color-disabled'),
color: token.colorTextDisabled,
boxShadow: 'none'
}
},
// ==============================================================
// == Ghost ==
// ==============================================================
{
// Ghost
[`&${componentCls}-background-ghost`]: {
[varName('bg-color')]: token.ghostBg,
[varName('bg-color-hover')]: token.ghostBg,
[varName('bg-color-active')]: token.ghostBg,
[varName('shadow')]: 'none',
[`&${componentCls}-variant-outlined, &${componentCls}-variant-dashed`]: {
[varName('bg-color-hover')]: token.ghostBg,
[varName('bg-color-active')]: token.ghostBg
}
}
}]
};
};
/* harmony default export */ var variant = (genVariantStyle);
;// ./components/button/style/index.ts
// ============================== Shared ==============================
const genSharedButtonStyle = token => {
const {
componentCls,
iconCls,
fontWeight,
opacityLoading,
motionDurationSlow,
motionEaseInOut,
iconGap,
calc
} = token;
return {
[componentCls]: {
outline: 'none',
position: 'relative',
display: 'inline-flex',
gap: iconGap,
alignItems: 'center',
justifyContent: 'center',
fontWeight,
whiteSpace: 'nowrap',
textAlign: 'center',
backgroundImage: 'none',
cursor: 'pointer',
transition: `all ${token.motionDurationMid} ${token.motionEaseInOut}`,
userSelect: 'none',
touchAction: 'manipulation',
...(0,util.genNoMotionStyle)(),
'&:disabled > *': {
pointerEvents: 'none'
},
// https://github.com/ant-design/ant-design/issues/51380
[`${componentCls}-icon > svg`]: (0,style.resetIcon)(),
'> a': {
color: 'currentColor'
},
'&:not(:disabled)': (0,style.genFocusStyle)(token),
[`&${componentCls}-two-chinese-chars::first-letter`]: {
letterSpacing: '0.34em'
},
[`&${componentCls}-two-chinese-chars > *:not(${iconCls})`]: {
marginInlineEnd: '-0.34em',
letterSpacing: '0.34em'
},
[`&${componentCls}-icon-only`]: {
paddingInline: 0,
// make `btn-icon-only` not too narrow
[`&${componentCls}-compact-item`]: {
flex: 'none'
}
},
// Loading
[`&${componentCls}-loading`]: {
opacity: opacityLoading,
cursor: 'default'
},
[`${componentCls}-loading-icon`]: {
transition: ['width', 'opacity', 'margin'].map(prop => `${prop} ${motionDurationSlow} ${motionEaseInOut}`).join(',')
},
// iconPlacement
[`&:not(${componentCls}-icon-end)`]: {
[`${componentCls}-loading-icon-motion`]: {
'&-appear-start, &-enter-start': {
marginInlineEnd: calc(iconGap).mul(-1).equal()
},
'&-appear-active, &-enter-active': {
marginInlineEnd: 0
},
'&-leave-start': {
marginInlineEnd: 0
},
'&-leave-active': {
marginInlineEnd: calc(iconGap).mul(-1).equal()
}
}
},
'&-icon-end': {
flexDirection: 'row-reverse',
[`${componentCls}-loading-icon-motion`]: {
'&-appear-start, &-enter-start': {
marginInlineStart: calc(iconGap).mul(-1).equal()
},
'&-appear-active, &-enter-active': {
marginInlineStart: 0
},
'&-leave-start': {
marginInlineStart: 0
},
'&-leave-active': {
marginInlineStart: calc(iconGap).mul(-1).equal()
}
}
}
}
};
};
// ============================== Shape ===============================
const genCircleButtonStyle = token => ({
minWidth: token.controlHeight,
paddingInline: 0,
borderRadius: '50%'
});
// =============================== Size ===============================
const genButtonStyle = (token, prefixCls = '') => {
const {
componentCls,
controlHeight,
fontSize,
borderRadius,
buttonPaddingHorizontal,
iconCls,
buttonPaddingVertical,
buttonIconOnlyFontSize
} = token;
return [{
[prefixCls]: {
fontSize,
height: controlHeight,
padding: `${(0,cssinjs.unit)(buttonPaddingVertical)} ${(0,cssinjs.unit)(buttonPaddingHorizontal)}`,
borderRadius,
[`&${componentCls}-icon-only`]: {
width: controlHeight,
[iconCls]: {
fontSize: buttonIconOnlyFontSize
}
}
}
},
// Shape - patch prefixCls again to override solid border radius style
{
[`${componentCls}${componentCls}-circle${prefixCls}`]: genCircleButtonStyle(token)
}, {
[`${componentCls}${componentCls}-round${prefixCls}`]: {
borderRadius: token.controlHeight,
[`&:not(${componentCls}-icon-only)`]: {
paddingInline: token.buttonPaddingHorizontal
}
}
}];
};
const genSizeBaseButtonStyle = token => {
const baseToken = (0,es.mergeToken)(token, {
fontSize: token.contentFontSize
});
return genButtonStyle(baseToken, token.componentCls);
};
const genSizeSmallButtonStyle = token => {
const smallToken = (0,es.mergeToken)(token, {
controlHeight: token.controlHeightSM,
fontSize: token.contentFontSizeSM,
padding: token.paddingXS,
buttonPaddingHorizontal: token.paddingInlineSM,
buttonPaddingVertical: 0,
borderRadius: token.borderRadiusSM,
buttonIconOnlyFontSize: token.onlyIconSizeSM
});
return genButtonStyle(smallToken, `${token.componentCls}-sm`);
};
const genSizeLargeButtonStyle = token => {
const largeToken = (0,es.mergeToken)(token, {
controlHeight: token.controlHeightLG,
fontSize: token.contentFontSizeLG,
buttonPaddingHorizontal: token.paddingInlineLG,
buttonPaddingVertical: 0,
borderRadius: token.borderRadiusLG,
buttonIconOnlyFontSize: token.onlyIconSizeLG
});
return genButtonStyle(largeToken, `${token.componentCls}-lg`);
};
const genBlockButtonStyle = token => {
const {
componentCls
} = token;
return {
[componentCls]: {
[`&${componentCls}-block`]: {
width: '100%'
}
}
};
};
// ============================== Export ==============================
/* harmony default export */ var button_style = ((0,genStyleUtils.genStyleHooks)('Button', token => {
const buttonToken = (0,style_token.prepareToken)(token);
return [
// Shared
genSharedButtonStyle(buttonToken),
// Size
genSizeBaseButtonStyle(buttonToken), genSizeSmallButtonStyle(buttonToken), genSizeLargeButtonStyle(buttonToken),
// Block
genBlockButtonStyle(buttonToken),
// Variant
variant(buttonToken),
// Button Group
group(buttonToken)];
}, style_token.prepareComponentToken, {
unitless: {
fontWeight: true,
contentLineHeight: true,
contentLineHeightSM: true,
contentLineHeightLG: true
}
}));
/***/ }),
/***/ "./components/button/style/token.ts":
/*!******************************************!*\
!*** ./components/button/style/token.ts ***!
\******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; },
/* harmony export */ prepareToken: function() { return /* binding */ prepareToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _color_picker_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../color-picker/color */ "./components/color-picker/color.ts");
/* harmony import */ var _color_picker_components_ColorPresets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../color-picker/components/ColorPresets */ "./components/color-picker/components/ColorPresets.tsx");
/* harmony import */ var _theme_interface__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/interface */ "./components/theme/interface/presetColors.ts");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/themes/shared/genFontSizes.ts");
/* harmony import */ var _theme_util_getAlphaColor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../theme/util/getAlphaColor */ "./components/theme/util/getAlphaColor.ts");
const prepareToken = token => {
const {
paddingInline,
onlyIconSize,
borderColorDisabled
} = token;
const buttonToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_4__.mergeToken)(token, {
buttonPaddingHorizontal: paddingInline,
buttonPaddingVertical: 0,
buttonIconOnlyFontSize: onlyIconSize,
colorBorderDisabled: borderColorDisabled
});
return buttonToken;
};
const prepareComponentToken = token => {
const contentFontSize = token.contentFontSize ?? token.fontSize;
const contentFontSizeSM = token.contentFontSizeSM ?? token.fontSize;
const contentFontSizeLG = token.contentFontSizeLG ?? token.fontSizeLG;
const contentLineHeight = token.contentLineHeight ?? (0,_theme_internal__WEBPACK_IMPORTED_MODULE_5__.getLineHeight)(contentFontSize);
const contentLineHeightSM = token.contentLineHeightSM ?? (0,_theme_internal__WEBPACK_IMPORTED_MODULE_5__.getLineHeight)(contentFontSizeSM);
const contentLineHeightLG = token.contentLineHeightLG ?? (0,_theme_internal__WEBPACK_IMPORTED_MODULE_5__.getLineHeight)(contentFontSizeLG);
const solidTextColor = (0,_color_picker_components_ColorPresets__WEBPACK_IMPORTED_MODULE_2__.isBright)(new _color_picker_color__WEBPACK_IMPORTED_MODULE_1__.AggregationColor(token.colorBgSolid), '#fff') ? '#000' : '#fff';
const shadowColorTokens = _theme_interface__WEBPACK_IMPORTED_MODULE_3__.PresetColors.reduce((prev, colorKey) => ({
...prev,
[`${colorKey}ShadowColor`]: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.controlOutlineWidth)} 0 ${(0,_theme_util_getAlphaColor__WEBPACK_IMPORTED_MODULE_6__["default"])(token[`${colorKey}1`], token.colorBgContainer)}`
}), {});
const defaultBgDisabled = token.colorBgContainerDisabled;
const dashedBgDisabled = token.colorBgContainerDisabled;
return {
...shadowColorTokens,
fontWeight: 400,
iconGap: token.marginXS,
defaultShadow: `0 ${token.controlOutlineWidth}px 0 ${token.controlTmpOutline}`,
primaryShadow: `0 ${token.controlOutlineWidth}px 0 ${token.controlOutline}`,
dangerShadow: `0 ${token.controlOutlineWidth}px 0 ${token.colorErrorOutline}`,
primaryColor: token.colorTextLightSolid,
dangerColor: token.colorTextLightSolid,
borderColorDisabled: token.colorBorderDisabled,
defaultGhostColor: token.colorBgContainer,
ghostBg: 'transparent',
defaultGhostBorderColor: token.colorBgContainer,
paddingInline: token.paddingContentHorizontal - token.lineWidth,
paddingInlineLG: token.paddingContentHorizontal - token.lineWidth,
paddingInlineSM: 8 - token.lineWidth,
onlyIconSize: 'inherit',
onlyIconSizeSM: 'inherit',
onlyIconSizeLG: 'inherit',
groupBorderColor: token.colorPrimaryHover,
linkHoverBg: 'transparent',
textTextColor: token.colorText,
textTextHoverColor: token.colorText,
textTextActiveColor: token.colorText,
textHoverBg: token.colorFillTertiary,
defaultColor: token.colorText,
defaultBg: token.colorBgContainer,
defaultBorderColor: token.colorBorder,
defaultBorderColorDisabled: token.colorBorder,
defaultHoverBg: token.colorBgContainer,
defaultHoverColor: token.colorPrimaryHover,
defaultHoverBorderColor: token.colorPrimaryHover,
defaultActiveBg: token.colorBgContainer,
defaultActiveColor: token.colorPrimaryActive,
defaultActiveBorderColor: token.colorPrimaryActive,
solidTextColor,
contentFontSize,
contentFontSizeSM,
contentFontSizeLG,
contentLineHeight,
contentLineHeightSM,
contentLineHeightLG,
paddingBlock: Math.max((token.controlHeight - contentFontSize * contentLineHeight) / 2 - token.lineWidth, 0),
paddingBlockSM: Math.max((token.controlHeightSM - contentFontSizeSM * contentLineHeightSM) / 2 - token.lineWidth, 0),
paddingBlockLG: Math.max((token.controlHeightLG - contentFontSizeLG * contentLineHeightLG) / 2 - token.lineWidth, 0),
defaultBgDisabled,
dashedBgDisabled
};
};
/***/ }),
/***/ "./components/calendar/locale/en_US.ts":
/*!*********************************************!*\
!*** ./components/calendar/locale/en_US.ts ***!
\*********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _date_picker_locale_en_US__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../date-picker/locale/en_US */ "./components/date-picker/locale/en_US.ts");
/* harmony default export */ __webpack_exports__["default"] = (_date_picker_locale_en_US__WEBPACK_IMPORTED_MODULE_0__["default"]);
/***/ }),
/***/ "./components/calendar/style/index.ts":
/*!********************************************!*\
!*** ./components/calendar/style/index.ts ***!
\********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ genCalendarStyles: function() { return /* binding */ genCalendarStyles; },
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _date_picker_style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../date-picker/style */ "./components/date-picker/style/panel.ts");
/* harmony import */ var _date_picker_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../date-picker/style */ "./components/date-picker/style/token.ts");
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const genCalendarStyles = token => {
const {
calendarCls,
componentCls,
fullBg,
fullPanelBg,
itemActiveBg
} = token;
return {
[calendarCls]: {
...(0,_date_picker_style__WEBPACK_IMPORTED_MODULE_1__.genPanelStyle)(token),
...(0,_style__WEBPACK_IMPORTED_MODULE_3__.resetComponent)(token),
background: fullBg,
'&-rtl': {
direction: 'rtl'
},
[`${calendarCls}-header`]: {
display: 'flex',
justifyContent: 'flex-end',
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingSM)} 0`,
[`${calendarCls}-year-select`]: {
minWidth: token.yearControlWidth
},
[`${calendarCls}-month-select`]: {
minWidth: token.monthControlWidth,
marginInlineStart: token.marginXS
},
[`${calendarCls}-mode-switch`]: {
marginInlineStart: token.marginXS
}
}
},
[`${calendarCls} ${componentCls}-panel`]: {
background: fullPanelBg,
border: 0,
borderTop: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
borderRadius: 0,
[`${componentCls}-month-panel, ${componentCls}-date-panel`]: {
width: 'auto'
},
[`${componentCls}-body`]: {
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingXS)} 0`
},
[`${componentCls}-content`]: {
width: '100%'
}
},
[`${calendarCls}-mini`]: {
borderRadius: token.borderRadiusLG,
[`${calendarCls}-header`]: {
paddingInlineEnd: token.paddingXS,
paddingInlineStart: token.paddingXS
},
[`${componentCls}-panel`]: {
borderRadius: `0 0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.borderRadiusLG)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.borderRadiusLG)}`
},
[`${componentCls}-content`]: {
height: token.miniContentHeight,
th: {
height: 'auto',
padding: 0,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.weekHeight)
}
},
[`${componentCls}-cell::before`]: {
pointerEvents: 'none'
}
},
[`${calendarCls}${calendarCls}-full`]: {
[`${componentCls}-panel`]: {
display: 'block',
width: '100%',
textAlign: 'end',
background: fullBg,
border: 0,
[`${componentCls}-body`]: {
'th, td': {
padding: 0
},
th: {
height: 'auto',
paddingInlineEnd: token.paddingSM,
paddingBottom: token.paddingXXS,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.weekHeight)
}
}
},
[`${componentCls}-cell-week ${componentCls}-cell-inner`]: {
display: 'block',
borderRadius: 0,
borderTop: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidthBold)} ${token.lineType} ${token.colorSplit}`,
width: '100%',
height: token.calc(token.dateValueHeight).add(token.dateContentHeight).add(token.calc(token.paddingXS).div(2)).add(token.lineWidthBold).equal()
},
[`${componentCls}-cell`]: {
'&::before': {
display: 'none'
},
'&:hover': {
[`${calendarCls}-date`]: {
background: token.controlItemBgHover
}
},
[`${calendarCls}-date-today::before`]: {
display: 'none'
},
// >>> Selected
[`&-in-view${componentCls}-cell-selected`]: {
[`${calendarCls}-date, ${calendarCls}-date-today`]: {
background: itemActiveBg
}
},
'&-selected, &-selected:hover': {
[`${calendarCls}-date, ${calendarCls}-date-today`]: {
[`${calendarCls}-date-value`]: {
color: token.colorPrimary
}
}
}
},
[`${calendarCls}-date`]: {
display: 'block',
width: 'auto',
height: 'auto',
margin: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(token.marginXS).div(2).equal())}`,
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(token.paddingXS).div(2).equal())} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingXS)} 0`,
border: 0,
borderTop: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidthBold)} ${token.lineType} ${token.colorSplit}`,
borderRadius: 0,
transition: `background-color ${token.motionDurationSlow}`,
'&-value': {
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.dateValueHeight),
transition: `color ${token.motionDurationSlow}`
},
'&-content': {
position: 'static',
width: 'auto',
height: token.dateContentHeight,
overflowY: 'auto',
color: token.colorText,
lineHeight: token.lineHeight,
textAlign: 'start'
},
'&-today': {
borderColor: token.colorPrimary,
[`${calendarCls}-date-value`]: {
color: token.colorText
}
}
}
},
[`@media only screen and (max-width: ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.screenXS)}) `]: {
[calendarCls]: {
[`${calendarCls}-header`]: {
display: 'block',
[`${calendarCls}-year-select`]: {
width: '50%'
},
[`${calendarCls}-month-select`]: {
width: `calc(50% - ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingXS)})`
},
[`${calendarCls}-mode-switch`]: {
width: '100%',
marginTop: token.marginXS,
marginInlineStart: 0,
'> label': {
width: '50%',
textAlign: 'center'
}
}
}
}
}
};
};
const prepareComponentToken = token => ({
fullBg: token.colorBgContainer,
fullPanelBg: token.colorBgContainer,
itemActiveBg: token.controlItemBgActive,
yearControlWidth: 80,
monthControlWidth: 70,
miniContentHeight: 256,
...(0,_date_picker_style__WEBPACK_IMPORTED_MODULE_2__.initPanelComponentToken)(token)
});
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_5__.genStyleHooks)('Calendar', token => {
const calendarCls = `${token.componentCls}-calendar`;
const calendarToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_4__.mergeToken)(token, (0,_date_picker_style__WEBPACK_IMPORTED_MODULE_2__.initPickerPanelToken)(token), {
calendarCls,
pickerCellInnerCls: `${token.componentCls}-cell-inner`,
dateValueHeight: token.controlHeightSM,
weekHeight: token.calc(token.controlHeightSM).mul(0.75).equal(),
dateContentHeight: token.calc(token.calc(token.fontHeightSM).add(token.marginXS)).mul(3).add(token.calc(token.lineWidth).mul(2)).equal()
});
return genCalendarStyles(calendarToken);
}, prepareComponentToken));
/***/ }),
/***/ "./components/card/style/index.ts":
/*!****************************************!*\
!*** ./components/card/style/index.ts ***!
\****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
// ============================== Styles ==============================
// ============================== Head ==============================
const genCardHeadStyle = token => {
const {
antCls,
componentCls,
headerHeight,
headerPadding,
tabsMarginBottom
} = token;
return {
display: 'flex',
justifyContent: 'center',
flexDirection: 'column',
minHeight: headerHeight,
marginBottom: -1,
// Fix card grid overflow bug: https://gw.alipayobjects.com/zos/rmsportal/XonYxBikwpgbqIQBeuhk.png
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(headerPadding)}`,
color: token.colorTextHeading,
fontWeight: token.fontWeightStrong,
fontSize: token.headerFontSize,
background: token.headerBg,
borderBottom: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorderSecondary}`,
borderRadius: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.borderRadiusLG)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.borderRadiusLG)} 0 0`,
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.clearFix)(),
'&-wrapper': {
width: '100%',
display: 'flex',
alignItems: 'center'
},
'&-title': {
display: 'inline-block',
flex: 1,
..._style__WEBPACK_IMPORTED_MODULE_1__.textEllipsis,
[`
> ${componentCls}-typography,
> ${componentCls}-typography-edit-content
`]: {
insetInlineStart: 0,
marginTop: 0,
marginBottom: 0
}
},
[`${antCls}-tabs-top`]: {
clear: 'both',
marginBottom: tabsMarginBottom,
color: token.colorText,
fontWeight: 'normal',
fontSize: token.fontSize,
'&-bar': {
borderBottom: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorderSecondary}`
}
}
};
};
// ============================== Grid ==============================
const genCardGridStyle = token => {
const {
cardPaddingBase,
colorBorderSecondary,
cardShadow,
lineWidth
} = token;
return {
width: '33.33%',
padding: cardPaddingBase,
border: 0,
borderRadius: 0,
boxShadow: `
${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} 0 0 0 ${colorBorderSecondary},
0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} 0 0 ${colorBorderSecondary},
${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} 0 0 ${colorBorderSecondary},
${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} 0 0 0 ${colorBorderSecondary} inset,
0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} 0 0 ${colorBorderSecondary} inset;
`,
transition: `all ${token.motionDurationMid}`,
'&-hoverable:hover': {
position: 'relative',
zIndex: 1,
boxShadow: cardShadow
}
};
};
// ============================== Actions ==============================
const genCardActionsStyle = token => {
const {
componentCls,
iconCls,
actionsLiMargin,
cardActionsIconSize,
colorBorderSecondary,
actionsBg
} = token;
return {
margin: 0,
padding: 0,
listStyle: 'none',
background: actionsBg,
borderTop: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${colorBorderSecondary}`,
display: 'flex',
borderRadius: `0 0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.borderRadiusLG)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.borderRadiusLG)}`,
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.clearFix)(),
'& > li': {
margin: actionsLiMargin,
color: token.colorTextDescription,
textAlign: 'center',
'> span': {
position: 'relative',
display: 'block',
minWidth: token.calc(token.cardActionsIconSize).mul(2).equal(),
fontSize: token.fontSize,
lineHeight: token.lineHeight,
cursor: 'pointer',
'&:hover': {
color: token.colorPrimary,
transition: `color ${token.motionDurationMid}`
},
[`a:not(${componentCls}-btn), > ${iconCls}`]: {
display: 'inline-block',
width: '100%',
color: token.colorIcon,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.fontHeight),
transition: `color ${token.motionDurationMid}`,
'&:hover': {
color: token.colorPrimary
}
},
[`> ${iconCls}`]: {
fontSize: cardActionsIconSize,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(cardActionsIconSize).mul(token.lineHeight).equal())
}
},
'&:not(:last-child)': {
borderInlineEnd: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${colorBorderSecondary}`
}
}
};
};
// ============================== Meta ==============================
const genCardMetaStyle = token => ({
margin: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(token.marginXXS).mul(-1).equal())} 0`,
display: 'flex',
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.clearFix)(),
'&-avatar': {
paddingInlineEnd: token.padding
},
'&-section': {
overflow: 'hidden',
flex: 1,
'> div:not(:last-child)': {
marginBottom: token.marginXS
}
},
'&-title': {
color: token.colorTextHeading,
fontWeight: token.fontWeightStrong,
fontSize: token.fontSizeLG,
..._style__WEBPACK_IMPORTED_MODULE_1__.textEllipsis
},
'&-description': {
color: token.colorTextDescription
}
});
// ============================== Inner ==============================
const genCardTypeInnerStyle = token => {
const {
componentCls,
colorFillAlter,
headerPadding,
bodyPadding
} = token;
return {
[`${componentCls}-head`]: {
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(headerPadding)}`,
background: colorFillAlter,
'&-title': {
fontSize: token.fontSize
}
},
[`${componentCls}-body`]: {
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.padding)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(bodyPadding)}`
}
};
};
// ============================== Loading ==============================
const genCardLoadingStyle = token => {
const {
componentCls
} = token;
return {
overflow: 'hidden',
[`${componentCls}-body`]: {
userSelect: 'none'
}
};
};
// ============================== Basic ==============================
const genCardStyle = token => {
const {
componentCls,
cardShadow,
cardHeadPadding,
colorBorderSecondary,
boxShadowTertiary,
bodyPadding,
extraColor,
motionDurationMid
} = token;
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
position: 'relative',
background: token.colorBgContainer,
borderRadius: token.borderRadiusLG,
[`&:not(${componentCls}-bordered)`]: {
boxShadow: boxShadowTertiary
},
[`${componentCls}-head`]: genCardHeadStyle(token),
[`${componentCls}-extra`]: {
// https://stackoverflow.com/a/22429853/3040605
marginInlineStart: 'auto',
color: extraColor,
fontWeight: 'normal',
fontSize: token.fontSize
},
[`${componentCls}-body`]: {
padding: bodyPadding,
borderRadius: `0 0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.borderRadiusLG)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.borderRadiusLG)}`,
'&:first-child': {
borderStartStartRadius: token.borderRadiusLG,
borderStartEndRadius: token.borderRadiusLG
},
'&:not(:last-child)': {
borderEndStartRadius: 0,
borderEndEndRadius: 0
}
},
[`${componentCls}-grid`]: genCardGridStyle(token),
[`${componentCls}-cover`]: {
'> *': {
display: 'block',
width: '100%',
borderRadius: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.borderRadiusLG)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.borderRadiusLG)} 0 0`
}
},
[`${componentCls}-actions`]: genCardActionsStyle(token),
[`${componentCls}-meta`]: genCardMetaStyle(token)
},
[`${componentCls}-bordered`]: {
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${colorBorderSecondary}`,
[`${componentCls}-cover`]: {
marginTop: -1,
marginInlineStart: -1,
marginInlineEnd: -1
}
},
[`${componentCls}-hoverable`]: {
cursor: 'pointer',
transition: [`box-shadow`, `border-color`].map(prop => `${prop} ${motionDurationMid}`).join(', '),
'&:hover': {
borderColor: 'transparent',
boxShadow: cardShadow
}
},
[`${componentCls}-contain-grid`]: {
borderRadius: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.borderRadiusLG)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.borderRadiusLG)} 0 0 `,
// Reset border radius when no head exists
[`&:not(:has(> ${componentCls}-head))`]: {
borderRadius: 0
},
[`${componentCls}-body`]: {
display: 'flex',
flexWrap: 'wrap'
},
[`&:not(${componentCls}-loading) ${componentCls}-body`]: {
marginBlockStart: token.calc(token.lineWidth).mul(-1).equal(),
marginInlineStart: token.calc(token.lineWidth).mul(-1).equal(),
padding: 0
}
},
[`${componentCls}-contain-tabs`]: {
[`> div${componentCls}-head`]: {
minHeight: 0,
[`${componentCls}-head-title, ${componentCls}-extra`]: {
paddingTop: cardHeadPadding
}
}
},
[`${componentCls}-type-inner`]: genCardTypeInnerStyle(token),
[`${componentCls}-loading`]: genCardLoadingStyle(token),
[`${componentCls}-rtl`]: {
direction: 'rtl'
}
};
};
// ============================== Size ==============================
const genCardSizeStyle = token => {
const {
componentCls,
bodyPaddingSM,
headerPaddingSM,
headerHeightSM,
headerFontSizeSM
} = token;
return {
[`${componentCls}-small`]: {
[`> ${componentCls}-head`]: {
minHeight: headerHeightSM,
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(headerPaddingSM)}`,
fontSize: headerFontSizeSM,
[`> ${componentCls}-head-wrapper`]: {
[`> ${componentCls}-extra`]: {
fontSize: token.fontSize
}
}
},
[`> ${componentCls}-body`]: {
padding: bodyPaddingSM
}
},
[`${componentCls}-small${componentCls}-contain-tabs`]: {
[`> ${componentCls}-head`]: {
[`${componentCls}-head-title, ${componentCls}-extra`]: {
paddingTop: 0,
display: 'flex',
alignItems: 'center'
}
}
}
};
};
const prepareComponentToken = token => ({
headerBg: 'transparent',
headerFontSize: token.fontSizeLG,
headerFontSizeSM: token.fontSize,
headerHeight: token.fontSizeLG * token.lineHeightLG + token.padding * 2,
headerHeightSM: token.fontSize * token.lineHeight + token.paddingXS * 2,
actionsBg: token.colorBgContainer,
actionsLiMargin: `${token.paddingSM}px 0`,
tabsMarginBottom: -token.padding - token.lineWidth,
extraColor: token.colorText,
bodyPaddingSM: 12,
// Fixed padding.
headerPaddingSM: 12,
bodyPadding: token.bodyPadding ?? token.paddingLG,
headerPadding: token.headerPadding ?? token.paddingLG
});
// ============================== Export ==============================
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genStyleHooks)('Card', token => {
const cardToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token, {
cardShadow: token.boxShadowCard,
cardHeadPadding: token.padding,
cardPaddingBase: token.paddingLG,
cardActionsIconSize: token.fontSize
});
return [
// Style
genCardStyle(cardToken),
// Size
genCardSizeStyle(cardToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/carousel/style/index.ts":
/*!********************************************!*\
!*** ./components/carousel/style/index.ts ***!
\********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ DotDuration: function() { return /* binding */ DotDuration; },
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const DotDuration = '--dot-duration';
const genCarouselStyle = token => {
const {
componentCls,
antCls
} = token;
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
'.slick-slider': {
position: 'relative',
display: 'block',
boxSizing: 'border-box',
touchAction: 'pan-y',
WebkitTouchCallout: 'none',
WebkitTapHighlightColor: 'transparent',
'.slick-track, .slick-list': {
transform: 'translate3d(0, 0, 0)',
touchAction: 'pan-y'
}
},
'.slick-list': {
position: 'relative',
display: 'block',
margin: 0,
padding: 0,
overflow: 'hidden',
'&:focus': {
outline: 'none'
},
'&.dragging': {
cursor: 'pointer'
},
'.slick-slide': {
pointerEvents: 'none',
// https://github.com/ant-design/ant-design/issues/23294
[`input${antCls}-radio-input, input${antCls}-checkbox-input`]: {
visibility: 'hidden'
},
'&.slick-active': {
pointerEvents: 'auto',
[`input${antCls}-radio-input, input${antCls}-checkbox-input`]: {
visibility: 'visible'
}
},
// fix Carousel content height not match parent node
// when children is empty node
// https://github.com/ant-design/ant-design/issues/25878
'> div > div': {
verticalAlign: 'bottom'
}
}
},
'.slick-track': {
position: 'relative',
top: 0,
insetInlineStart: 0,
display: 'block',
'&::before, &::after': {
display: 'table',
content: '""'
},
'&::after': {
clear: 'both'
}
},
'.slick-slide': {
display: 'none',
float: 'left',
height: '100%',
minHeight: 1,
img: {
display: 'block'
},
'&.dragging img': {
pointerEvents: 'none'
}
},
'.slick-initialized .slick-slide': {
display: 'block'
},
'.slick-vertical .slick-slide': {
display: 'block',
height: 'auto'
}
}
};
};
const genArrowsStyle = token => {
const {
componentCls,
motionDurationSlow,
arrowSize,
arrowOffset
} = token;
const arrowLength = token.calc(arrowSize).div(Math.SQRT2).equal();
return {
[componentCls]: {
// Arrows
'.slick-prev, .slick-next': {
position: 'absolute',
top: '50%',
width: arrowSize,
height: arrowSize,
transform: 'translateY(-50%)',
color: '#fff',
opacity: 0.4,
background: 'transparent',
padding: 0,
lineHeight: 0,
border: 0,
outline: 'none',
cursor: 'pointer',
zIndex: 1,
transition: `opacity ${motionDurationSlow}`,
'&:hover, &:focus': {
opacity: 1
},
'&.slick-disabled': {
pointerEvents: 'none',
opacity: 0
},
'&::after': {
boxSizing: 'border-box',
position: 'absolute',
top: token.calc(arrowSize).sub(arrowLength).div(2).equal(),
insetInlineStart: token.calc(arrowSize).sub(arrowLength).div(2).equal(),
display: 'inline-block',
width: arrowLength,
height: arrowLength,
border: `0 solid currentcolor`,
borderInlineStartWidth: 2,
borderBlockStartWidth: 2,
borderRadius: 1,
content: '""'
}
},
'.slick-prev': {
insetInlineStart: arrowOffset,
'&::after': {
transform: 'rotate(-45deg)'
}
},
'.slick-next': {
insetInlineEnd: arrowOffset,
'&::after': {
transform: 'rotate(135deg)'
}
}
}
};
};
const genDotsStyle = token => {
const {
componentCls,
dotOffset,
dotWidth,
dotHeight,
dotGap,
colorBgContainer,
motionDurationSlow
} = token;
const animation = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes(`${token.prefixCls}-dot-animation`, {
from: {
width: 0
},
to: {
width: token.dotActiveWidth
}
});
return {
[componentCls]: {
'.slick-dots': {
position: 'absolute',
insetInlineEnd: 0,
bottom: 0,
insetInlineStart: 0,
zIndex: 15,
display: 'flex !important',
justifyContent: 'center',
paddingInlineStart: 0,
margin: 0,
listStyle: 'none',
'&-bottom': {
bottom: dotOffset
},
'&-top': {
top: dotOffset,
bottom: 'auto'
},
li: {
position: 'relative',
display: 'inline-block',
flex: '0 1 auto',
boxSizing: 'content-box',
width: dotWidth,
height: dotHeight,
marginInline: dotGap,
padding: 0,
textAlign: 'center',
textIndent: -999,
verticalAlign: 'top',
transition: `all ${motionDurationSlow}`,
borderRadius: dotHeight,
overflow: 'hidden',
'&::after': {
display: 'block',
position: 'absolute',
top: 0,
insetInlineStart: 0,
width: 0,
height: dotHeight,
content: '""',
background: 'transparent',
borderRadius: dotHeight,
opacity: 1,
outline: 'none',
cursor: 'pointer',
overflow: 'hidden'
},
button: {
position: 'relative',
display: 'block',
width: '100%',
height: dotHeight,
padding: 0,
color: 'transparent',
fontSize: 0,
background: colorBgContainer,
border: 0,
borderRadius: dotHeight,
outline: 'none',
cursor: 'pointer',
opacity: 0.2,
transition: `all ${motionDurationSlow}`,
overflow: 'hidden',
'&:hover': {
opacity: 0.75
},
'&::after': {
position: 'absolute',
inset: token.calc(dotGap).mul(-1).equal(),
content: '""'
}
},
'&.slick-active': {
width: token.dotActiveWidth,
position: 'relative',
'&:hover': {
opacity: 1
},
'&::after': {
background: colorBgContainer,
animationName: animation,
animationDuration: `var(${DotDuration})`,
animationTimingFunction: 'ease-out',
animationFillMode: 'forwards'
}
}
}
}
}
};
};
const genCarouselVerticalStyle = token => {
const {
componentCls,
dotOffset,
arrowOffset,
marginXXS
} = token;
const animation = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes(`${token.prefixCls}-dot-vertical-animation`, {
from: {
height: 0
},
to: {
height: token.dotActiveWidth
}
});
const reverseSizeOfDot = {
width: token.dotHeight,
height: token.dotWidth
};
return {
[`${componentCls}-vertical`]: {
'.slick-prev, .slick-next': {
insetInlineStart: '50%',
marginBlockStart: 'unset',
transform: 'translateX(-50%)'
},
'.slick-prev': {
insetBlockStart: arrowOffset,
insetInlineStart: '50%',
'&::after': {
transform: 'rotate(45deg)'
}
},
'.slick-next': {
insetBlockStart: 'auto',
insetBlockEnd: arrowOffset,
'&::after': {
transform: 'rotate(-135deg)'
}
},
'.slick-dots': {
top: '50%',
bottom: 'auto',
flexDirection: 'column',
width: token.dotHeight,
height: 'auto',
margin: 0,
transform: 'translateY(-50%)',
'&-start': {
insetInlineEnd: 'auto',
insetInlineStart: dotOffset
},
'&-end': {
insetInlineEnd: dotOffset,
insetInlineStart: 'auto'
},
li: {
// reverse width and height in vertical situation
...reverseSizeOfDot,
margin: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(marginXXS)} 0`,
verticalAlign: 'baseline',
button: reverseSizeOfDot,
'&::after': {
...reverseSizeOfDot,
height: 0
},
'&.slick-active': {
...reverseSizeOfDot,
height: token.dotActiveWidth,
button: {
...reverseSizeOfDot,
height: token.dotActiveWidth
},
'&::after': {
...reverseSizeOfDot,
animationName: animation,
animationDuration: `var(${DotDuration})`,
animationTimingFunction: 'ease-out',
animationFillMode: 'forwards'
}
}
}
}
}
};
};
const genCarouselRtlStyle = token => {
const {
componentCls
} = token;
return [{
[`${componentCls}-rtl`]: {
direction: 'rtl'
}
}, {
[`${componentCls}-vertical`]: {
'.slick-dots': {
[`${componentCls}-rtl&`]: {
flexDirection: 'column'
}
}
}
}];
};
const prepareComponentToken = token => {
const dotActiveWidth = 24;
return {
arrowSize: 16,
arrowOffset: token.marginXS,
dotWidth: 16,
dotHeight: 3,
dotGap: token.marginXXS,
dotOffset: 12,
dotWidthActive: dotActiveWidth,
dotActiveWidth
};
};
// ============================== Export ==============================
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.genStyleHooks)('Carousel', token => [genCarouselStyle(token), genArrowsStyle(token), genDotsStyle(token), genCarouselVerticalStyle(token), genCarouselRtlStyle(token)], prepareComponentToken, {
deprecatedTokens: [['dotWidthActive', 'dotActiveWidth']]
}));
/***/ }),
/***/ "./components/cascader/style/columns.ts":
/*!**********************************************!*\
!*** ./components/cascader/style/columns.ts ***!
\**********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _checkbox_style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../checkbox/style */ "./components/checkbox/style/index.ts");
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
const getColumnsStyle = token => {
const {
prefixCls,
componentCls
} = token;
const cascaderMenuItemCls = `${componentCls}-menu-item`;
const iconCls = `
&${cascaderMenuItemCls}-expand ${cascaderMenuItemCls}-expand-icon,
${cascaderMenuItemCls}-loading-icon
`;
return [
// ==================== Checkbox ====================
(0,_checkbox_style__WEBPACK_IMPORTED_MODULE_1__.getStyle)(`${prefixCls}-checkbox`, token), {
[componentCls]: {
// ================== Checkbox ==================
'&-checkbox': {
top: 0,
marginInlineEnd: token.paddingXS,
pointerEvents: 'unset'
},
// ==================== Menu ====================
// >>> Menus
'&-menus': {
display: 'flex',
flexWrap: 'nowrap',
alignItems: 'flex-start',
[`&${componentCls}-menu-empty`]: {
[`${componentCls}-menu`]: {
width: '100%',
height: 'auto',
[cascaderMenuItemCls]: {
color: token.colorTextDisabled
}
}
}
},
// >>> Menu
'&-menu': {
flexGrow: 1,
flexShrink: 0,
minWidth: token.controlItemWidth,
height: token.dropdownHeight,
margin: 0,
padding: token.menuPadding,
overflow: 'auto',
verticalAlign: 'top',
listStyle: 'none',
'-ms-overflow-style': '-ms-autohiding-scrollbar',
// https://github.com/ant-design/ant-design/issues/11857
'&:not(:last-child)': {
borderInlineEnd: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}`
},
'&-item': {
display: 'flex',
maxWidth: 400,
flexWrap: 'nowrap',
alignItems: 'center',
padding: token.optionPadding,
lineHeight: token.lineHeight,
cursor: 'pointer',
transition: `all ${token.motionDurationMid}`,
borderRadius: token.borderRadiusSM,
'&:hover': {
background: token.controlItemBgHover
},
'&-disabled': {
color: token.colorTextDisabled,
cursor: 'not-allowed',
'&:hover': {
background: 'transparent'
},
[iconCls]: {
color: token.colorTextDisabled
}
},
[`&-active:not(${cascaderMenuItemCls}-disabled)`]: {
'&, &:hover': {
color: token.optionSelectedColor,
fontWeight: token.optionSelectedFontWeight,
backgroundColor: token.optionSelectedBg
}
},
'&-content': {
flex: 'auto',
minWidth: 0,
..._style__WEBPACK_IMPORTED_MODULE_2__.textEllipsis
},
[iconCls]: {
marginInlineStart: token.paddingXXS,
color: token.colorIcon,
fontSize: token.fontSizeIcon
},
'&-keyword': {
color: token.colorHighlight
}
}
}
}
}];
};
/* harmony default export */ __webpack_exports__["default"] = (getColumnsStyle);
/***/ }),
/***/ "./components/cascader/style/index.ts":
/*!********************************************!*\
!*** ./components/cascader/style/index.ts ***!
\********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _style_compact_item__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../style/compact-item */ "./components/style/compact-item.ts");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
/* harmony import */ var _columns__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./columns */ "./components/cascader/style/columns.ts");
// =============================== Base ===============================
const genBaseStyle = token => {
const {
componentCls,
antCls
} = token;
return [
// =====================================================
// == Control ==
// =====================================================
{
[componentCls]: {
width: token.controlWidth
}
},
// =====================================================
// == Popup ==
// =====================================================
{
[`${componentCls}-dropdown`]: [{
[`&${antCls}-select-dropdown`]: {
padding: 0
}
}, (0,_columns__WEBPACK_IMPORTED_MODULE_2__["default"])(token)]
},
// =====================================================
// == RTL ==
// =====================================================
{
[`${componentCls}-dropdown-rtl`]: {
direction: 'rtl'
}
},
// =====================================================
// == Space Compact ==
// =====================================================
(0,_style_compact_item__WEBPACK_IMPORTED_MODULE_0__.genCompactItemStyle)(token)];
};
// ============================== Export ==============================
const prepareComponentToken = token => {
const itemPaddingVertical = Math.round((token.controlHeight - token.fontSize * token.lineHeight) / 2);
return {
controlWidth: 184,
controlItemWidth: 111,
dropdownHeight: 180,
optionSelectedBg: token.controlItemBgActive,
optionSelectedFontWeight: token.fontWeightStrong,
optionPadding: `${itemPaddingVertical}px ${token.paddingSM}px`,
menuPadding: token.paddingXXS,
optionSelectedColor: token.colorText
};
};
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_1__.genStyleHooks)('Cascader', genBaseStyle, prepareComponentToken, {
resetFont: false,
unitless: {
optionSelectedFontWeight: true
}
}));
/***/ }),
/***/ "./components/checkbox/style/index.ts":
/*!********************************************!*\
!*** ./components/checkbox/style/index.ts ***!
\********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ genCheckboxStyle: function() { return /* binding */ genCheckboxStyle; },
/* harmony export */ getStyle: function() { return /* binding */ getStyle; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _style_motion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../style/motion */ "./components/style/motion/util.ts");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
// ============================== Styles ==============================
const genCheckboxStyle = token => {
const {
checkboxCls,
checkboxSize,
lineWidth
} = token;
const wrapperCls = `${checkboxCls}-wrapper`;
return [
// ===================== Basic =====================
{
// Group
[`${checkboxCls}-group`]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
display: 'inline-flex',
flexWrap: 'wrap',
columnGap: token.marginXS,
// Group > Grid
[`> ${token.antCls}-row`]: {
flex: 1
}
},
// Wrapper
[wrapperCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
display: 'inline-flex',
alignItems: 'baseline',
cursor: 'pointer',
// Fix checkbox & radio in flex align #30260
'&:after': {
display: 'inline-block',
width: 0,
overflow: 'hidden',
content: "'\\a0'"
},
// Checkbox near checkbox
[`& + ${wrapperCls}`]: {
marginInlineStart: 0
},
[`&${wrapperCls}-in-form-item`]: {
'input[type="checkbox"]': {
width: 14,
// FIXME: magic
height: 14 // FIXME: magic
}
}
},
// Wrapper > Checkbox
[checkboxCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
position: 'relative',
whiteSpace: 'nowrap',
lineHeight: 1,
cursor: 'pointer',
// To make alignment right when `controlHeight` is changed
// Ref: https://github.com/ant-design/ant-design/issues/41564
alignSelf: 'center',
// Styles moved from inner
boxSizing: 'border-box',
display: 'block',
width: checkboxSize,
height: checkboxSize,
direction: 'ltr',
backgroundColor: token.colorBgContainer,
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${token.lineType} ${token.colorBorder}`,
borderRadius: token.borderRadiusSM,
borderCollapse: 'separate',
transition: `all ${token.motionDurationSlow}`,
flex: 'none',
...(0,_style_motion__WEBPACK_IMPORTED_MODULE_2__.genNoMotionStyle)(),
// Checkmark
'&:after': {
boxSizing: 'border-box',
position: 'absolute',
top: `calc(${checkboxSize} / 2 - ${lineWidth})`,
insetInlineStart: `calc(${checkboxSize} / 4 - ${lineWidth})`,
display: 'table',
width: token.calc(checkboxSize).div(14).mul(5).equal(),
height: token.calc(checkboxSize).div(14).mul(8).equal(),
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidthBold)} solid ${token.colorWhite}`,
borderTop: 0,
borderInlineStart: 0,
transform: 'rotate(45deg) scale(0) translate(-50%,-50%)',
opacity: 0,
content: '""',
transition: `all ${token.motionDurationFast} ${token.motionEaseInBack}, opacity ${token.motionDurationFast}`,
...(0,_style_motion__WEBPACK_IMPORTED_MODULE_2__.genNoMotionStyle)()
},
// Wrapper > Checkbox > input
[`${checkboxCls}-input`]: {
position: 'absolute',
// Since baseline align will get additional space offset,
// we need to move input to top to make it align with text.
// Ref: https://github.com/ant-design/ant-design/issues/38926#issuecomment-1486137799
inset: `calc(-1 * (${lineWidth}))`,
zIndex: 1,
cursor: 'pointer',
opacity: 0,
margin: 0
},
// Focus outline on checkbox when input is focus-visible
[`&:has(${checkboxCls}-input:focus-visible)`]: (0,_style__WEBPACK_IMPORTED_MODULE_1__.genFocusOutline)(token),
// Wrapper > Checkbox + Text
'& + span': {
paddingInlineStart: token.paddingXS,
paddingInlineEnd: token.paddingXS
}
}
},
// ===================== Hover =====================
{
// Wrapper & Wrapper > Checkbox
[`
${wrapperCls}:not(${wrapperCls}-disabled),
${checkboxCls}:not(${checkboxCls}-disabled)
`]: {
[`&:hover ${checkboxCls}`]: {
borderColor: token.colorPrimary
}
},
[`${wrapperCls}:not(${wrapperCls}-disabled)`]: {
[`&:hover ${checkboxCls}-checked:not(${checkboxCls}-disabled)`]: {
backgroundColor: token.colorPrimaryHover,
borderColor: 'transparent'
}
}
},
// ==================== Checked ====================
{
// Wrapper > Checkbox
[`${checkboxCls}-checked`]: {
backgroundColor: token.colorPrimary,
borderColor: token.colorPrimary,
'&:after': {
opacity: 1,
transform: 'rotate(45deg) scale(1) translate(-50%,-50%)',
transition: `all ${token.motionDurationMid} ${token.motionEaseOutBack} ${token.motionDurationFast}`,
...(0,_style_motion__WEBPACK_IMPORTED_MODULE_2__.genNoMotionStyle)()
},
// Hover on checked checkbox directly
[`&:not(${checkboxCls}-disabled):hover`]: {
backgroundColor: token.colorPrimaryHover,
borderColor: 'transparent'
}
}
},
// ================= Indeterminate =================
{
[checkboxCls]: {
'&-indeterminate': {
backgroundColor: token.colorBgContainer,
borderColor: token.colorBorder,
'&:after': {
top: '50%',
insetInlineStart: '50%',
width: token.calc(token.fontSizeLG).div(2).equal(),
height: token.calc(token.fontSizeLG).div(2).equal(),
backgroundColor: token.colorPrimary,
border: 0,
transform: 'translate(-50%, -50%) scale(1)',
opacity: 1,
content: '""'
},
// https://github.com/ant-design/ant-design/issues/50074
'&:hover': {
backgroundColor: token.colorBgContainer,
borderColor: token.colorPrimary
}
}
}
},
// ==================== Disable ====================
{
// Wrapper
[`${wrapperCls}-disabled`]: {
cursor: 'not-allowed'
},
// Wrapper > Checkbox
[`${checkboxCls}-disabled`]: {
// Wrapper > Checkbox > input
[`&, ${checkboxCls}-input`]: {
cursor: 'not-allowed',
// Disabled for native input to enable Tooltip event handler
// ref: https://github.com/ant-design/ant-design/issues/39822#issuecomment-1365075901
pointerEvents: 'none'
},
// Disabled checkbox styles
background: token.colorBgContainerDisabled,
borderColor: token.colorBorder,
'&:after': {
borderColor: token.colorTextDisabled
},
'& + span': {
color: token.colorTextDisabled
},
[`&${checkboxCls}-indeterminate::after`]: {
background: token.colorTextDisabled
}
}
}];
};
// ============================== Export ==============================
function getStyle(prefixCls, token) {
const checkboxToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.mergeToken)(token, {
checkboxCls: `.${prefixCls}`,
checkboxSize: token.controlInteractiveSize
});
return genCheckboxStyle(checkboxToken);
}
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_4__.genStyleHooks)('Checkbox', (token, {
prefixCls
}) => [getStyle(prefixCls, token)]));
/***/ }),
/***/ "./components/col/style/index.ts":
/*!***************************************!*\
!*** ./components/col/style/index.ts ***!
\***************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// Compatible for babel-plugin-import
/* istanbul ignore next */
/* harmony default export */ __webpack_exports__["default"] = ({});
/***/ }),
/***/ "./components/collapse/index.tsx":
/*!***************************************************!*\
!*** ./components/collapse/index.tsx + 7 modules ***!
\***************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ collapse; }
});
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__("react");
var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/RightOutlined.js + 1 modules
var RightOutlined = __webpack_require__("./node_modules/@ant-design/icons/es/icons/RightOutlined.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/extends.js");
// EXTERNAL MODULE: ./node_modules/clsx/dist/clsx.mjs
var clsx = __webpack_require__("./node_modules/clsx/dist/clsx.mjs");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/index.js + 2 modules
var es = __webpack_require__("./node_modules/@rc-component/util/es/index.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/warning.js
var warning = __webpack_require__("./node_modules/@rc-component/util/es/warning.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/Children/toArray.js
var toArray = __webpack_require__("./node_modules/@rc-component/util/es/Children/toArray.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/motion/es/index.js + 12 modules
var motion_es = __webpack_require__("./node_modules/@rc-component/motion/es/index.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/KeyCode.js
var KeyCode = __webpack_require__("./node_modules/@rc-component/util/es/KeyCode.js");
;// ./node_modules/@rc-component/collapse/es/PanelContent.js
const PanelContent = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
prefixCls,
forceRender,
className,
style,
children,
isActive,
role,
classNames: customizeClassNames,
styles
} = props;
const [rendered, setRendered] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(isActive || forceRender);
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(() => {
if (forceRender || isActive) {
setRendered(true);
}
}, [forceRender, isActive]);
if (!rendered) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
ref: ref,
className: (0,clsx.clsx)(`${prefixCls}-panel`, {
[`${prefixCls}-panel-active`]: isActive,
[`${prefixCls}-panel-inactive`]: !isActive
}, className),
style: style,
role: role
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-body`, customizeClassNames?.body),
style: styles?.body
}, children));
});
if (true) {
PanelContent.displayName = 'PanelContent';
}
/* harmony default export */ var es_PanelContent = (PanelContent);
;// ./node_modules/@rc-component/collapse/es/Panel.js
const CollapsePanel = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
showArrow = true,
headerClass,
isActive,
onItemClick,
forceRender,
className,
classNames: customizeClassNames = {},
styles = {},
prefixCls,
collapsible,
accordion,
panelKey,
extra,
header,
expandIcon,
openMotion,
destroyOnHidden,
children,
...resetProps
} = props;
const disabled = collapsible === 'disabled';
const ifExtraExist = extra !== null && extra !== undefined && typeof extra !== 'boolean';
const collapsibleProps = {
onClick: () => {
onItemClick?.(panelKey);
},
onKeyDown: e => {
if (e.key === 'Enter' || e.keyCode === KeyCode["default"].ENTER || e.which === KeyCode["default"].ENTER) {
onItemClick?.(panelKey);
}
},
role: accordion ? 'tab' : 'button',
['aria-expanded']: isActive,
['aria-disabled']: disabled,
tabIndex: disabled ? -1 : 0
};
// ======================== Icon ========================
const iconNodeInner = typeof expandIcon === 'function' ? expandIcon(props) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("i", {
className: "arrow"
});
const iconNode = iconNodeInner && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", (0,esm_extends["default"])({
className: (0,clsx.clsx)(`${prefixCls}-expand-icon`, customizeClassNames?.icon),
style: styles?.icon
}, ['header', 'icon'].includes(collapsible) ? collapsibleProps : {}), iconNodeInner);
const collapsePanelClassNames = (0,clsx.clsx)(`${prefixCls}-item`, {
[`${prefixCls}-item-active`]: isActive,
[`${prefixCls}-item-disabled`]: disabled
}, className);
const headerClassName = (0,clsx.clsx)(headerClass, `${prefixCls}-header`, {
[`${prefixCls}-collapsible-${collapsible}`]: !!collapsible
}, customizeClassNames?.header);
// ======================== HeaderProps ========================
const headerProps = {
className: headerClassName,
style: styles?.header,
...(['header', 'icon'].includes(collapsible) ? {} : collapsibleProps)
};
// ======================== Render ========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", (0,esm_extends["default"])({}, resetProps, {
ref: ref,
className: collapsePanelClassNames
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", headerProps, showArrow && iconNode, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", (0,esm_extends["default"])({
className: (0,clsx.clsx)(`${prefixCls}-title`, customizeClassNames?.title),
style: styles?.title
}, collapsible === 'header' ? collapsibleProps : {}), header), ifExtraExist && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${prefixCls}-extra`
}, extra)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(motion_es["default"], (0,esm_extends["default"])({
visible: isActive,
leavedClassName: `${prefixCls}-panel-hidden`
}, openMotion, {
forceRender: forceRender,
removeOnLeave: destroyOnHidden
}), ({
className: motionClassName,
style: motionStyle
}, motionRef) => {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_PanelContent, {
ref: motionRef,
prefixCls: prefixCls,
className: motionClassName,
classNames: customizeClassNames,
style: motionStyle,
styles: styles,
isActive: isActive,
forceRender: forceRender,
role: accordion ? 'tabpanel' : undefined
}, children);
}));
});
/* harmony default export */ var Panel = (CollapsePanel);
;// ./node_modules/@rc-component/collapse/es/hooks/useItems.js
function mergeSemantic(src, tgt, mergeFn) {
if (!src || !tgt) {
return src || tgt;
}
const keys = Array.from(new Set([...Object.keys(src), ...Object.keys(tgt)]));
const result = {};
keys.forEach(key => {
result[key] = mergeFn(src[key], tgt[key]);
});
return result;
}
function mergeSemanticClassNames(src, tgt) {
return mergeSemantic(src, tgt, (a, b) => (0,clsx["default"])(a, b));
}
function mergeSemanticStyles(src, tgt) {
return mergeSemantic(src, tgt, (a, b) => ({
...a,
...b
}));
}
const convertItemsToNodes = (items, props) => {
const {
prefixCls,
accordion,
collapsible,
destroyOnHidden,
onItemClick,
activeKey,
openMotion,
expandIcon,
classNames: collapseClassNames,
styles: collapseStyles
} = props;
return items.map((item, index) => {
const {
children,
label,
key: rawKey,
collapsible: rawCollapsible,
onItemClick: rawOnItemClick,
destroyOnHidden: rawDestroyOnHidden,
classNames,
styles,
...restProps
} = item;
// You may be puzzled why you want to convert them all into strings, me too.
// Maybe: https://github.com/react-component/collapse/blob/aac303a8b6ff30e35060b4f8fecde6f4556fcbe2/src/Collapse.tsx#L15
const key = String(rawKey ?? index);
const mergeCollapsible = rawCollapsible ?? collapsible;
const mergedDestroyOnHidden = rawDestroyOnHidden ?? destroyOnHidden;
const handleItemClick = value => {
if (mergeCollapsible === 'disabled') {
return;
}
onItemClick(value);
rawOnItemClick?.(value);
};
let isActive = false;
if (accordion) {
isActive = activeKey[0] === key;
} else {
isActive = activeKey.indexOf(key) > -1;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Panel, (0,esm_extends["default"])({}, restProps, {
classNames: mergeSemanticClassNames(collapseClassNames, classNames),
styles: mergeSemanticStyles(collapseStyles, styles),
prefixCls: prefixCls,
key: key,
panelKey: key,
isActive: isActive,
accordion: accordion,
openMotion: openMotion,
expandIcon: expandIcon,
header: label,
collapsible: mergeCollapsible,
onItemClick: handleItemClick,
destroyOnHidden: mergedDestroyOnHidden
}), children);
});
};
/**
* @deprecated The next major version will be removed
*/
const getNewChild = (child, index, props) => {
if (!child) {
return null;
}
const {
prefixCls,
accordion,
collapsible,
destroyOnHidden,
onItemClick,
activeKey,
openMotion,
expandIcon,
classNames: collapseClassNames,
styles
} = props;
const key = child.key || String(index);
const {
header,
headerClass,
destroyOnHidden: childDestroyOnHidden,
collapsible: childCollapsible,
onItemClick: childOnItemClick
} = child.props;
let isActive = false;
if (accordion) {
isActive = activeKey[0] === key;
} else {
isActive = activeKey.indexOf(key) > -1;
}
const mergeCollapsible = childCollapsible ?? collapsible;
const handleItemClick = value => {
if (mergeCollapsible === 'disabled') {
return;
}
onItemClick(value);
childOnItemClick?.(value);
};
const childProps = {
key,
panelKey: key,
header,
headerClass,
classNames: collapseClassNames,
styles,
isActive,
prefixCls,
destroyOnHidden: childDestroyOnHidden ?? destroyOnHidden,
openMotion,
accordion,
children: child.props.children,
onItemClick: handleItemClick,
expandIcon,
collapsible: mergeCollapsible
};
// https://github.com/ant-design/ant-design/issues/20479
if (typeof child.type === 'string') {
return child;
}
Object.keys(childProps).forEach(propName => {
if (typeof childProps[propName] === 'undefined') {
delete childProps[propName];
}
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(child, childProps);
};
function useItems(items, rawChildren, props) {
if (Array.isArray(items)) {
return convertItemsToNodes(items, props);
}
return (0,toArray["default"])(rawChildren).map((child, index) => getNewChild(child, index, props));
}
/* harmony default export */ var hooks_useItems = (useItems);
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/pickAttrs.js
var pickAttrs = __webpack_require__("./node_modules/@rc-component/util/es/pickAttrs.js");
;// ./node_modules/@rc-component/collapse/es/Collapse.js
function getActiveKeysArray(activeKey) {
let currentActiveKey = activeKey;
if (!Array.isArray(currentActiveKey)) {
const activeKeyType = typeof currentActiveKey;
currentActiveKey = activeKeyType === 'number' || activeKeyType === 'string' ? [currentActiveKey] : [];
}
return currentActiveKey.map(key => String(key));
}
const Collapse = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
prefixCls = 'rc-collapse',
destroyOnHidden = false,
style,
accordion,
className,
children,
collapsible,
openMotion,
expandIcon,
activeKey: rawActiveKey,
defaultActiveKey,
onChange,
items,
classNames: customizeClassNames,
styles
} = props;
const collapseClassName = (0,clsx.clsx)(prefixCls, className);
const [internalActiveKey, setActiveKey] = (0,es.useControlledState)(defaultActiveKey, rawActiveKey);
const activeKey = getActiveKeysArray(internalActiveKey);
const triggerActiveKey = (0,es.useEvent)(next => {
const nextKeys = getActiveKeysArray(next);
setActiveKey(nextKeys);
onChange?.(nextKeys);
});
const onItemClick = key => {
if (accordion) {
triggerActiveKey(activeKey[0] === key ? [] : [key]);
} else {
triggerActiveKey(activeKey.includes(key) ? activeKey.filter(item => item !== key) : [...activeKey, key]);
}
};
// ======================== Children ========================
(0,warning["default"])(!children, '[rc-collapse] `children` will be removed in next major version. Please use `items` instead.');
const mergedChildren = hooks_useItems(items, children, {
prefixCls,
accordion,
openMotion,
expandIcon,
collapsible,
destroyOnHidden,
onItemClick,
activeKey,
classNames: customizeClassNames,
styles
});
// ======================== Render ========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", (0,esm_extends["default"])({
ref: ref,
className: collapseClassName,
style: style,
role: accordion ? 'tablist' : undefined
}, (0,pickAttrs["default"])(props, {
aria: true,
data: true
})), mergedChildren);
});
/* harmony default export */ var es_Collapse = (Object.assign(Collapse, {
/**
* @deprecated use `items` instead, will be removed in `v4.0.0`
*/
Panel: Panel
}));
;// ./node_modules/@rc-component/collapse/es/index.js
/* harmony default export */ var collapse_es = (es_Collapse);
/**
* @deprecated use `items` instead, will be removed in `v4.0.0`
*/
const {
Panel: es_Panel
} = es_Collapse;
// EXTERNAL MODULE: ./components/_util/hooks/useMergeSemantic.ts
var useMergeSemantic = __webpack_require__("./components/_util/hooks/useMergeSemantic.ts");
// EXTERNAL MODULE: ./components/_util/motion.ts
var motion = __webpack_require__("./components/_util/motion.ts");
// EXTERNAL MODULE: ./components/_util/reactNode.ts
var reactNode = __webpack_require__("./components/_util/reactNode.ts");
// EXTERNAL MODULE: ./components/_util/warning.ts
var _util_warning = __webpack_require__("./components/_util/warning.ts");
// EXTERNAL MODULE: ./components/config-provider/context.ts
var context = __webpack_require__("./components/config-provider/context.ts");
// EXTERNAL MODULE: ./components/config-provider/hooks/useSize.ts
var useSize = __webpack_require__("./components/config-provider/hooks/useSize.ts");
;// ./components/collapse/CollapsePanel.tsx
const CollapsePanel_CollapsePanel = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
if (true) {
const warning = (0,_util_warning.devUseWarning)('Collapse.Panel');
warning.deprecated(!('disabled' in props), 'disabled', 'collapsible="disabled"');
}
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(context.ConfigContext);
const {
prefixCls: customizePrefixCls,
className,
showArrow = true
} = props;
const prefixCls = getPrefixCls('collapse', customizePrefixCls);
const collapsePanelClassName = (0,clsx.clsx)({
[`${prefixCls}-no-arrow`]: !showArrow
}, className);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(collapse_es.Panel, {
ref: ref,
...props,
prefixCls: prefixCls,
className: collapsePanelClassName
});
});
/* harmony default export */ var collapse_CollapsePanel = (CollapsePanel_CollapsePanel);
// EXTERNAL MODULE: ./components/collapse/style/index.ts
var collapse_style = __webpack_require__("./components/collapse/style/index.ts");
;// ./components/collapse/Collapse.tsx
const Collapse_Collapse = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
getPrefixCls,
direction,
expandIcon: contextExpandIcon,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,context.useComponentConfig)('collapse');
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
style,
bordered = true,
ghost,
size: customizeSize,
expandIconPlacement,
expandIconPosition,
children,
destroyInactivePanel,
destroyOnHidden,
expandIcon,
classNames,
styles
} = props;
const mergedSize = (0,useSize["default"])(ctx => customizeSize ?? ctx ?? 'middle');
const prefixCls = getPrefixCls('collapse', customizePrefixCls);
const rootPrefixCls = getPrefixCls();
const [hashId, cssVarCls] = (0,collapse_style["default"])(prefixCls);
const mergedPlacement = expandIconPlacement ?? expandIconPosition ?? 'start';
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
size: mergedSize,
bordered,
expandIconPlacement: mergedPlacement
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const mergedExpandIcon = expandIcon ?? contextExpandIcon;
if (true) {
const warning = (0,_util_warning.devUseWarning)('Collapse');
[['destroyInactivePanel', 'destroyOnHidden'], ['expandIconPosition', 'expandIconPlacement']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
}
const renderExpandIcon = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback((panelProps = {}) => {
const icon = typeof mergedExpandIcon === 'function' ? mergedExpandIcon(panelProps) : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RightOutlined["default"], {
rotate: panelProps.isActive ? direction === 'rtl' ? -90 : 90 : undefined,
"aria-label": panelProps.isActive ? 'expanded' : 'collapsed'
}));
return (0,reactNode.cloneElement)(icon, oriProps => ({
className: (0,clsx.clsx)(oriProps.className, `${prefixCls}-arrow`)
}));
}, [mergedExpandIcon, prefixCls, direction]);
const collapseClassName = (0,clsx.clsx)(`${prefixCls}-icon-placement-${mergedPlacement}`, {
[`${prefixCls}-borderless`]: !bordered,
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-ghost`]: !!ghost,
[`${prefixCls}-large`]: mergedSize === 'large',
[`${prefixCls}-small`]: mergedSize === 'small'
}, contextClassName, className, rootClassName, hashId, cssVarCls, mergedClassNames.root);
const openMotion = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
...(0,motion["default"])(rootPrefixCls),
motionAppear: false,
leavedClassName: `${prefixCls}-panel-hidden`
}), [rootPrefixCls, prefixCls]);
const items = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (children) {
return (0,es.toArray)(children).map(child => child);
}
return null;
}, [children]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(collapse_es, {
ref: ref,
openMotion: openMotion,
...(0,es.omit)(props, ['rootClassName']),
expandIcon: renderExpandIcon,
prefixCls: prefixCls,
className: collapseClassName,
style: {
...mergedStyles.root,
...contextStyle,
...style
},
classNames: mergedClassNames,
styles: mergedStyles,
destroyOnHidden: destroyOnHidden ?? destroyInactivePanel
}, items);
});
if (true) {
Collapse_Collapse.displayName = 'Collapse';
}
/* harmony default export */ var collapse_Collapse = (Object.assign(Collapse_Collapse, {
Panel: collapse_CollapsePanel
}));
;// ./components/collapse/index.tsx
/* harmony default export */ var collapse = (collapse_Collapse);
/***/ }),
/***/ "./components/collapse/style/index.ts":
/*!********************************************!*\
!*** ./components/collapse/style/index.ts ***!
\********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ genBaseStyle: function() { return /* binding */ genBaseStyle; },
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _style_motion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../style/motion */ "./components/style/motion/collapse.ts");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const genBaseStyle = token => {
const {
componentCls,
contentBg,
padding,
headerBg,
headerPadding,
collapseHeaderPaddingSM,
collapseHeaderPaddingLG,
collapsePanelBorderRadius,
lineWidth,
lineType,
colorBorder,
colorText,
colorTextHeading,
colorTextDisabled,
fontSizeLG,
lineHeight,
lineHeightLG,
marginSM,
paddingSM,
paddingLG,
paddingXS,
motionDurationSlow,
fontSizeIcon,
contentPadding,
fontHeight,
fontHeightLG
} = token;
const borderBase = `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${lineType} ${colorBorder}`;
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
backgroundColor: headerBg,
border: borderBase,
borderRadius: collapsePanelBorderRadius,
'&-rtl': {
direction: 'rtl'
},
[`& > ${componentCls}-item`]: {
borderBottom: borderBase,
'&:first-child': {
[`
&,
& > ${componentCls}-header`]: {
borderRadius: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(collapsePanelBorderRadius)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(collapsePanelBorderRadius)} 0 0`
}
},
'&:last-child': {
[`
&,
& > ${componentCls}-header`]: {
borderRadius: `0 0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(collapsePanelBorderRadius)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(collapsePanelBorderRadius)}`
}
},
[`> ${componentCls}-header`]: {
position: 'relative',
// Compatible with old version of antd, should remove in next version
display: 'flex',
flexWrap: 'nowrap',
alignItems: 'flex-start',
padding: headerPadding,
color: colorTextHeading,
lineHeight,
cursor: 'pointer',
transition: `all ${motionDurationSlow}, visibility 0s`,
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.genFocusStyle)(token),
[`> ${componentCls}-title`]: {
flex: 'auto'
},
// >>>>> Arrow
[`${componentCls}-expand-icon`]: {
height: fontHeight,
display: 'flex',
alignItems: 'center',
marginInlineEnd: marginSM
},
[`${componentCls}-arrow`]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetIcon)(),
fontSize: fontSizeIcon,
// when `transform: rotate()` is applied to icon's root element
transition: `transform ${motionDurationSlow}`,
// when `transform: rotate()` is applied to icon's child element
svg: {
transition: `transform ${motionDurationSlow}`
}
},
// >>>>> Text
[`${componentCls}-title`]: {
marginInlineEnd: 'auto'
}
},
[`${componentCls}-collapsible-header`]: {
cursor: 'default',
[`${componentCls}-title`]: {
flex: 'none',
cursor: 'pointer'
},
[`${componentCls}-expand-icon`]: {
cursor: 'pointer'
}
},
[`${componentCls}-collapsible-icon`]: {
cursor: 'unset',
[`${componentCls}-expand-icon`]: {
cursor: 'pointer'
}
}
},
[`${componentCls}-panel`]: {
color: colorText,
backgroundColor: contentBg,
borderTop: borderBase,
[`& > ${componentCls}-body`]: {
padding: contentPadding
},
'&-hidden': {
display: 'none'
}
},
'&-small': {
[`> ${componentCls}-item`]: {
[`> ${componentCls}-header`]: {
padding: collapseHeaderPaddingSM,
paddingInlineStart: paddingXS,
[`> ${componentCls}-expand-icon`]: {
// Arrow offset
marginInlineStart: token.calc(paddingSM).sub(paddingXS).equal()
}
},
[`> ${componentCls}-panel > ${componentCls}-body`]: {
padding: paddingSM
}
}
},
'&-large': {
[`> ${componentCls}-item`]: {
fontSize: fontSizeLG,
lineHeight: lineHeightLG,
[`> ${componentCls}-header`]: {
padding: collapseHeaderPaddingLG,
paddingInlineStart: padding,
[`> ${componentCls}-expand-icon`]: {
height: fontHeightLG,
// Arrow offset
marginInlineStart: token.calc(paddingLG).sub(padding).equal()
}
},
[`> ${componentCls}-panel > ${componentCls}-body`]: {
padding: paddingLG
}
}
},
[`${componentCls}-item:last-child`]: {
borderBottom: 0,
[`> ${componentCls}-panel`]: {
borderRadius: `0 0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(collapsePanelBorderRadius)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(collapsePanelBorderRadius)}`
}
},
[`& ${componentCls}-item-disabled > ${componentCls}-header`]: {
'&, & > .arrow': {
color: colorTextDisabled,
cursor: 'not-allowed'
}
},
// ========================== Icon Placement ==========================
[`&${componentCls}-icon-placement-end`]: {
[`& > ${componentCls}-item`]: {
[`> ${componentCls}-header`]: {
[`${componentCls}-expand-icon`]: {
order: 1,
marginInlineEnd: 0,
marginInlineStart: marginSM
}
}
}
}
}
};
};
const genArrowStyle = token => {
const {
componentCls
} = token;
const fixedSelector = `> ${componentCls}-item > ${componentCls}-header ${componentCls}-arrow`;
return {
[`${componentCls}-rtl`]: {
[fixedSelector]: {
transform: `rotate(180deg)`
}
}
};
};
const genBorderlessStyle = token => {
const {
componentCls,
headerBg,
borderlessContentPadding,
borderlessContentBg,
colorBorder
} = token;
return {
[`${componentCls}-borderless`]: {
backgroundColor: headerBg,
border: 0,
[`> ${componentCls}-item`]: {
borderBottom: `1px solid ${colorBorder}`
},
[`
> ${componentCls}-item:last-child,
> ${componentCls}-item:last-child ${componentCls}-header
`]: {
borderRadius: 0
},
[`> ${componentCls}-item:last-child`]: {
borderBottom: 0
},
[`> ${componentCls}-item > ${componentCls}-panel`]: {
backgroundColor: borderlessContentBg,
borderTop: 0
},
[`> ${componentCls}-item > ${componentCls}-panel > ${componentCls}-body`]: {
padding: borderlessContentPadding
}
}
};
};
const genGhostStyle = token => {
const {
componentCls,
paddingSM
} = token;
return {
[`${componentCls}-ghost`]: {
backgroundColor: 'transparent',
border: 0,
[`> ${componentCls}-item`]: {
borderBottom: 0,
[`> ${componentCls}-panel`]: {
backgroundColor: 'transparent',
border: 0,
[`> ${componentCls}-body`]: {
paddingBlock: paddingSM
}
}
}
}
};
};
const prepareComponentToken = token => ({
headerPadding: `${token.paddingSM}px ${token.padding}px`,
headerBg: token.colorFillAlter,
contentPadding: `${token.padding}px 16px`,
// Fixed Value
contentBg: token.colorBgContainer,
borderlessContentPadding: `${token.paddingXXS}px 16px ${token.padding}px`,
borderlessContentBg: 'transparent'
});
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_4__.genStyleHooks)('Collapse', token => {
const collapseToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.mergeToken)(token, {
collapseHeaderPaddingSM: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingXS)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingSM)}`,
collapseHeaderPaddingLG: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.padding)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingLG)}`,
collapsePanelBorderRadius: token.borderRadiusLG
});
return [genBaseStyle(collapseToken), genBorderlessStyle(collapseToken), genGhostStyle(collapseToken), genArrowStyle(collapseToken), (0,_style_motion__WEBPACK_IMPORTED_MODULE_2__["default"])(collapseToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/color-picker/color.ts":
/*!******************************************!*\
!*** ./components/color-picker/color.ts ***!
\******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ AggregationColor: function() { return /* binding */ AggregationColor; },
/* harmony export */ toHexFormat: function() { return /* binding */ toHexFormat; }
/* harmony export */ });
/* unused harmony export getHex */
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js");
/* harmony import */ var _rc_component_color_picker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @rc-component/color-picker */ "./node_modules/@rc-component/color-picker/es/index.js");
const toHexFormat = (value, alpha) => value?.replace(/[^0-9a-f]/gi, '').slice(0, alpha ? 8 : 6) || '';
const getHex = (value, alpha) => value ? toHexFormat(value, alpha) : '';
let AggregationColor = /*#__PURE__*/function () {
function AggregationColor(color) {
(0,_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, AggregationColor);
this.cleared = false;
// Clone from another AggregationColor
if (color instanceof AggregationColor) {
this.metaColor = color.metaColor.clone();
this.colors = color.colors?.map(info => ({
color: new AggregationColor(info.color),
percent: info.percent
}));
this.cleared = color.cleared;
return;
}
const isArray = Array.isArray(color);
if (isArray && color.length) {
this.colors = color.map(({
color: c,
percent
}) => ({
color: new AggregationColor(c),
percent
}));
this.metaColor = new _rc_component_color_picker__WEBPACK_IMPORTED_MODULE_2__.Color(this.colors[0].color.metaColor);
} else {
this.metaColor = new _rc_component_color_picker__WEBPACK_IMPORTED_MODULE_2__.Color(isArray ? '' : color);
}
if (!color || isArray && !this.colors) {
this.metaColor = this.metaColor.setA(0);
this.cleared = true;
}
}
return (0,_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(AggregationColor, [{
key: "toHsb",
value: function toHsb() {
return this.metaColor.toHsb();
}
}, {
key: "toHsbString",
value: function toHsbString() {
return this.metaColor.toHsbString();
}
}, {
key: "toHex",
value: function toHex() {
return getHex(this.toHexString(), this.metaColor.a < 1);
}
}, {
key: "toHexString",
value: function toHexString() {
return this.metaColor.toHexString();
}
}, {
key: "toRgb",
value: function toRgb() {
return this.metaColor.toRgb();
}
}, {
key: "toRgbString",
value: function toRgbString() {
return this.metaColor.toRgbString();
}
}, {
key: "isGradient",
value: function isGradient() {
return !!this.colors && !this.cleared;
}
}, {
key: "getColors",
value: function getColors() {
return this.colors || [{
color: this,
percent: 0
}];
}
}, {
key: "toCssString",
value: function toCssString() {
const {
colors
} = this;
// CSS line-gradient
if (colors) {
const colorsStr = colors.map(c => `${c.color.toRgbString()} ${c.percent}%`).join(', ');
return `linear-gradient(90deg, ${colorsStr})`;
}
return this.metaColor.toRgbString();
}
}, {
key: "equals",
value: function equals(color) {
if (!color || this.isGradient() !== color.isGradient()) {
return false;
}
if (!this.isGradient()) {
return this.toHexString() === color.toHexString();
}
return this.colors.length === color.colors.length && this.colors.every((c, i) => {
const target = color.colors[i];
return c.percent === target.percent && c.color.equals(target.color);
});
}
}]);
}();
/***/ }),
/***/ "./components/color-picker/components/ColorPresets.tsx":
/*!*************************************************************!*\
!*** ./components/color-picker/components/ColorPresets.tsx ***!
\*************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ isBright: function() { return /* binding */ isBright; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _rc_component_color_picker__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @rc-component/color-picker */ "./node_modules/@rc-component/color-picker/es/index.js");
/* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! clsx */ "./node_modules/clsx/dist/clsx.mjs");
/* harmony import */ var _collapse__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../collapse */ "./components/collapse/index.tsx");
/* harmony import */ var _locale__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../locale */ "./components/locale/useLocale.ts");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/useToken.ts");
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../util */ "./components/color-picker/util.ts");
const genPresetColor = list => list.map(value => {
value.colors = value.colors.map(_util__WEBPACK_IMPORTED_MODULE_6__.generateColor);
return value;
});
const isBright = (value, bgColorToken) => {
const {
r,
g,
b,
a
} = value.toRgb();
const hsv = new _rc_component_color_picker__WEBPACK_IMPORTED_MODULE_1__.Color(value.toRgbString()).onBackground(bgColorToken).toHsv();
if (a <= 0.5) {
// Adapted to dark mode
return hsv.v > 0.5;
}
return r * 0.299 + g * 0.587 + b * 0.114 > 192;
};
const genCollapsePanelKey = (preset, index) => {
const mergedKey = preset.key ?? index;
return `panel-${mergedKey}`;
};
const ColorPresets = ({
prefixCls,
presets,
value: color,
onChange
}) => {
const [locale] = (0,_locale__WEBPACK_IMPORTED_MODULE_4__["default"])('ColorPicker');
const [, token] = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_5__["default"])();
const presetsValue = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => genPresetColor(presets), [presets]);
const colorPresetsPrefixCls = `${prefixCls}-presets`;
const activeKeys = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => presetsValue.reduce((acc, preset, index) => {
const {
defaultOpen = true
} = preset;
if (defaultOpen) {
acc.push(genCollapsePanelKey(preset, index));
}
return acc;
}, []), [presetsValue]);
const handleClick = colorValue => {
onChange?.(colorValue);
};
const items = presetsValue.map((preset, index) => ({
key: genCollapsePanelKey(preset, index),
label: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
className: `${colorPresetsPrefixCls}-label`
}, preset?.label),
children: (/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
className: `${colorPresetsPrefixCls}-items`
}, Array.isArray(preset?.colors) && preset.colors?.length > 0 ? preset.colors.map((presetColor, index) => {
const colorInst = (0,_util__WEBPACK_IMPORTED_MODULE_6__.generateColor)(presetColor);
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_rc_component_color_picker__WEBPACK_IMPORTED_MODULE_1__.ColorBlock
// eslint-disable-next-line react/no-array-index-key
, {
// eslint-disable-next-line react/no-array-index-key
key: `preset-${index}-${presetColor.toHexString()}`,
color: colorInst.toCssString(),
prefixCls: prefixCls,
className: (0,clsx__WEBPACK_IMPORTED_MODULE_2__.clsx)(`${colorPresetsPrefixCls}-color`, {
[`${colorPresetsPrefixCls}-color-checked`]: presetColor.toCssString() === color?.toCssString(),
[`${colorPresetsPrefixCls}-color-bright`]: isBright(presetColor, token.colorBgElevated)
}),
onClick: () => handleClick(presetColor)
});
}) : (/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
className: `${colorPresetsPrefixCls}-empty`
}, locale.presetEmpty))))
}));
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
className: colorPresetsPrefixCls
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_collapse__WEBPACK_IMPORTED_MODULE_3__["default"], {
defaultActiveKey: activeKeys,
ghost: true,
items: items
}));
};
/* harmony default export */ __webpack_exports__["default"] = (ColorPresets);
/***/ }),
/***/ "./components/color-picker/style/index.ts":
/*!************************************************************!*\
!*** ./components/color-picker/style/index.ts + 5 modules ***!
\************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ style; },
genActiveStyle: function() { return /* binding */ genActiveStyle; }
});
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
// EXTERNAL MODULE: ./components/style/compact-item.ts
var compact_item = __webpack_require__("./components/style/compact-item.ts");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
;// ./components/color-picker/style/color-block.ts
/**
* @private Internal usage only
* see: https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/conic-gradient#checkerboard
*/
const getTransBg = (size, colorFill) => ({
backgroundImage: `conic-gradient(${colorFill} 25%, transparent 25% 50%, ${colorFill} 50% 75%, transparent 75% 100%)`,
backgroundSize: `${size} ${size}`
});
const genColorBlockStyle = (token, size) => {
const {
componentCls,
borderRadiusSM,
colorPickerInsetShadow,
lineWidth,
colorFillSecondary
} = token;
return {
[`${componentCls}-color-block`]: {
position: 'relative',
borderRadius: borderRadiusSM,
width: size,
height: size,
boxShadow: colorPickerInsetShadow,
flex: 'none',
...getTransBg('50%', token.colorFillSecondary),
[`${componentCls}-color-block-inner`]: {
width: '100%',
height: '100%',
boxShadow: `inset 0 0 0 ${(0,cssinjs.unit)(lineWidth)} ${colorFillSecondary}`,
borderRadius: 'inherit'
}
}
};
};
/* harmony default export */ var color_block = (genColorBlockStyle);
;// ./components/color-picker/style/input.ts
const genInputStyle = token => {
const {
componentCls,
antCls,
fontSizeSM,
lineHeightSM,
colorPickerAlphaInputWidth,
marginXXS,
paddingXXS,
controlHeightSM,
marginXS,
fontSizeIcon,
paddingXS,
colorTextPlaceholder,
colorPickerInputNumberHandleWidth,
lineWidth
} = token;
return {
[`${componentCls}-input-container`]: {
display: 'flex',
[`${componentCls}-steppers${antCls}-input-number`]: {
fontSize: fontSizeSM,
lineHeight: lineHeightSM,
padding: 0,
[`${antCls}-input-number-input`]: {
paddingInlineStart: paddingXXS,
paddingInlineEnd: 0
},
[`${antCls}-input-number-handler-wrap`]: {
width: colorPickerInputNumberHandleWidth
}
},
[`${componentCls}-steppers${componentCls}-alpha-input`]: {
flex: `0 0 ${(0,cssinjs.unit)(colorPickerAlphaInputWidth)}`,
marginInlineStart: marginXXS
},
[`${componentCls}-format-select${antCls}-select`]: {
marginInlineEnd: marginXS,
width: 'auto',
'&-single': {
[`${antCls}-select-selector`]: {
padding: 0,
border: 0
},
[`${antCls}-select-arrow`]: {
insetInlineEnd: 0
},
[`${antCls}-select-selection-item`]: {
paddingInlineEnd: token.calc(fontSizeIcon).add(marginXXS).equal(),
fontSize: fontSizeSM,
lineHeight: (0,cssinjs.unit)(controlHeightSM)
},
[`${antCls}-select-item-option-content`]: {
fontSize: fontSizeSM,
lineHeight: lineHeightSM
},
[`${antCls}-select-dropdown`]: {
[`${antCls}-select-item`]: {
minHeight: 'auto'
}
}
}
},
[`${componentCls}-input`]: {
gap: marginXXS,
alignItems: 'center',
flex: 1,
width: 0,
[`${componentCls}-hsb-input,${componentCls}-rgb-input`]: {
height: controlHeightSM,
display: 'flex',
gap: marginXXS,
alignItems: 'center'
},
[`${componentCls}-steppers`]: {
flex: 1
},
[`${componentCls}-hex-input${antCls}-input-affix-wrapper`]: {
flex: 1,
padding: `0 ${(0,cssinjs.unit)(paddingXS)}`,
[`${antCls}-input`]: {
fontSize: fontSizeSM,
textTransform: 'uppercase',
lineHeight: (0,cssinjs.unit)(token.calc(controlHeightSM).sub(token.calc(lineWidth).mul(2)).equal())
},
[`${antCls}-input-prefix`]: {
color: colorTextPlaceholder
}
}
}
}
};
};
/* harmony default export */ var input = (genInputStyle);
;// ./components/color-picker/style/picker.ts
const genPickerStyle = token => {
const {
componentCls,
controlHeightLG,
borderRadiusSM,
colorPickerInsetShadow,
marginSM,
colorBgElevated,
colorFillSecondary,
lineWidthBold,
colorPickerHandlerSize
} = token;
return {
userSelect: 'none',
[`${componentCls}-select`]: {
[`${componentCls}-palette`]: {
minHeight: token.calc(controlHeightLG).mul(4).equal(),
overflow: 'hidden',
borderRadius: borderRadiusSM
},
[`${componentCls}-saturation`]: {
position: 'absolute',
borderRadius: 'inherit',
boxShadow: colorPickerInsetShadow,
inset: 0
},
marginBottom: marginSM
},
// ======================== Panel =========================
[`${componentCls}-handler`]: {
width: colorPickerHandlerSize,
height: colorPickerHandlerSize,
border: `${(0,cssinjs.unit)(lineWidthBold)} solid ${colorBgElevated}`,
position: 'relative',
borderRadius: '50%',
cursor: 'pointer',
boxShadow: `${colorPickerInsetShadow}, 0 0 0 1px ${colorFillSecondary}`
}
};
};
/* harmony default export */ var picker = (genPickerStyle);
;// ./components/color-picker/style/presets.ts
const genPresetsStyle = token => {
const {
componentCls,
antCls,
colorTextQuaternary,
paddingXXS,
colorPickerPresetColorSize,
fontSizeSM,
colorText,
lineHeightSM,
lineWidth,
borderRadius,
colorFill,
colorWhite,
marginXXS,
paddingXS,
fontHeightSM
} = token;
return {
[`${componentCls}-presets`]: {
[`${antCls}-collapse-item > ${antCls}-collapse-header`]: {
padding: 0,
[`${antCls}-collapse-expand-icon`]: {
height: fontHeightSM,
color: colorTextQuaternary,
paddingInlineEnd: paddingXXS
}
},
[`${antCls}-collapse`]: {
display: 'flex',
flexDirection: 'column',
gap: marginXXS
},
[`${antCls}-collapse-item > ${antCls}-collapse-panel > ${antCls}-collapse-body`]: {
padding: `${(0,cssinjs.unit)(paddingXS)} 0`
},
'&-label': {
fontSize: fontSizeSM,
color: colorText,
lineHeight: lineHeightSM
},
'&-items': {
display: 'flex',
flexWrap: 'wrap',
gap: token.calc(marginXXS).mul(1.5).equal(),
[`${componentCls}-presets-color`]: {
position: 'relative',
cursor: 'pointer',
width: colorPickerPresetColorSize,
height: colorPickerPresetColorSize,
'&::before': {
content: '""',
pointerEvents: 'none',
width: token.calc(colorPickerPresetColorSize).add(token.calc(lineWidth).mul(4)).equal(),
height: token.calc(colorPickerPresetColorSize).add(token.calc(lineWidth).mul(4)).equal(),
position: 'absolute',
top: token.calc(lineWidth).mul(-2).equal(),
insetInlineStart: token.calc(lineWidth).mul(-2).equal(),
borderRadius,
border: `${(0,cssinjs.unit)(lineWidth)} solid transparent`,
transition: `border-color ${token.motionDurationMid} ${token.motionEaseInBack}`
},
'&:hover::before': {
borderColor: colorFill
},
'&::after': {
boxSizing: 'border-box',
position: 'absolute',
top: '50%',
insetInlineStart: '21.5%',
display: 'table',
width: token.calc(colorPickerPresetColorSize).div(13).mul(5).equal(),
height: token.calc(colorPickerPresetColorSize).div(13).mul(8).equal(),
border: `${(0,cssinjs.unit)(token.lineWidthBold)} solid ${token.colorWhite}`,
borderTop: 0,
borderInlineStart: 0,
transform: 'rotate(45deg) scale(0) translate(-50%,-50%)',
opacity: 0,
content: '""',
transition: `all ${token.motionDurationFast} ${token.motionEaseInBack}, opacity ${token.motionDurationFast}`
},
[`&${componentCls}-presets-color-checked`]: {
'&::after': {
opacity: 1,
borderColor: colorWhite,
transform: 'rotate(45deg) scale(1) translate(-50%,-50%)',
transition: `transform ${token.motionDurationMid} ${token.motionEaseOutBack} ${token.motionDurationFast}`
},
[`&${componentCls}-presets-color-bright`]: {
'&::after': {
borderColor: 'rgba(0, 0, 0, 0.45)'
}
}
}
}
},
'&-empty': {
fontSize: fontSizeSM,
color: colorTextQuaternary
}
}
};
};
/* harmony default export */ var presets = (genPresetsStyle);
;// ./components/color-picker/style/slider.ts
const genSliderStyle = token => {
const {
componentCls,
colorPickerInsetShadow,
colorBgElevated,
colorFillSecondary,
lineWidthBold,
colorPickerHandlerSizeSM,
colorPickerSliderHeight,
marginSM,
marginXS
} = token;
const handleInnerSize = token.calc(colorPickerHandlerSizeSM).sub(token.calc(lineWidthBold).mul(2).equal()).equal();
const handleHoverSize = token.calc(colorPickerHandlerSizeSM).add(token.calc(lineWidthBold).mul(2).equal()).equal();
const activeHandleStyle = {
'&:after': {
transform: 'scale(1)',
boxShadow: `${colorPickerInsetShadow}, 0 0 0 1px ${token.colorPrimaryActive}`
}
};
return {
// ======================== Slider ========================
[`${componentCls}-slider`]: [getTransBg((0,cssinjs.unit)(colorPickerSliderHeight), token.colorFillSecondary), {
margin: 0,
padding: 0,
height: colorPickerSliderHeight,
borderRadius: token.calc(colorPickerSliderHeight).div(2).equal(),
'&-rail': {
height: colorPickerSliderHeight,
borderRadius: token.calc(colorPickerSliderHeight).div(2).equal(),
boxShadow: colorPickerInsetShadow
},
[`& ${componentCls}-slider-handle`]: {
width: handleInnerSize,
height: handleInnerSize,
top: 0,
borderRadius: '100%',
'&:before': {
display: 'block',
position: 'absolute',
background: 'transparent',
left: {
_skip_check_: true,
value: '50%'
},
top: '50%',
transform: 'translate(-50%, -50%)',
width: handleHoverSize,
height: handleHoverSize,
borderRadius: '100%'
},
'&:after': {
width: colorPickerHandlerSizeSM,
height: colorPickerHandlerSizeSM,
border: `${(0,cssinjs.unit)(lineWidthBold)} solid ${colorBgElevated}`,
boxShadow: `${colorPickerInsetShadow}, 0 0 0 1px ${colorFillSecondary}`,
outline: 'none',
insetInlineStart: token.calc(lineWidthBold).mul(-1).equal(),
top: token.calc(lineWidthBold).mul(-1).equal(),
background: 'transparent',
transition: 'none'
},
'&:focus': activeHandleStyle
}
}],
// ======================== Layout ========================
[`${componentCls}-slider-container`]: {
display: 'flex',
gap: marginSM,
marginBottom: marginSM,
// Group
[`${componentCls}-slider-group`]: {
flex: 1,
flexDirection: 'column',
justifyContent: 'space-between',
display: 'flex',
'&-disabled-alpha': {
justifyContent: 'center'
}
}
},
[`${componentCls}-gradient-slider`]: {
marginBottom: marginXS,
[`& ${componentCls}-slider-handle`]: {
'&:after': {
transform: 'scale(0.8)'
},
'&-active, &:focus': activeHandleStyle
}
}
};
};
/* harmony default export */ var slider = (genSliderStyle);
;// ./components/color-picker/style/index.ts
const genActiveStyle = (token, borderColor, outlineColor) => ({
borderInlineEndWidth: token.lineWidth,
borderColor,
boxShadow: `0 0 0 ${(0,cssinjs.unit)(token.controlOutlineWidth)} ${outlineColor}`,
outline: 0
});
const genRtlStyle = token => {
const {
componentCls
} = token;
return {
'&-rtl': {
[`${componentCls}-presets-color`]: {
'&::after': {
direction: 'ltr'
}
},
[`${componentCls}-clear`]: {
'&::after': {
direction: 'ltr'
}
}
}
};
};
const genClearStyle = (token, size, extraStyle) => {
const {
componentCls,
borderRadiusSM,
lineWidth,
colorSplit,
colorBorder,
red6
} = token;
return {
[`${componentCls}-clear`]: {
width: size,
height: size,
borderRadius: borderRadiusSM,
border: `${(0,cssinjs.unit)(lineWidth)} solid ${colorSplit}`,
position: 'relative',
overflow: 'hidden',
cursor: 'inherit',
transition: `all ${token.motionDurationFast}`,
...extraStyle,
'&::after': {
content: '""',
position: 'absolute',
insetInlineEnd: token.calc(lineWidth).mul(-1).equal(),
top: token.calc(lineWidth).mul(-1).equal(),
display: 'block',
width: 40,
// maximum
height: 2,
// fixed
transformOrigin: `calc(100% - 1px) 1px`,
transform: 'rotate(-45deg)',
backgroundColor: red6
},
'&:hover': {
borderColor: colorBorder
}
}
};
};
const genStatusStyle = token => {
const {
componentCls,
colorError,
colorWarning,
colorErrorHover,
colorWarningHover,
colorErrorOutline,
colorWarningOutline
} = token;
return {
[`&${componentCls}-status-error`]: {
borderColor: colorError,
'&:hover': {
borderColor: colorErrorHover
},
[`&${componentCls}-trigger-active`]: {
...genActiveStyle(token, colorError, colorErrorOutline)
}
},
[`&${componentCls}-status-warning`]: {
borderColor: colorWarning,
'&:hover': {
borderColor: colorWarningHover
},
[`&${componentCls}-trigger-active`]: {
...genActiveStyle(token, colorWarning, colorWarningOutline)
}
}
};
};
const genSizeStyle = token => {
const {
componentCls,
controlHeightLG,
controlHeightSM,
controlHeight,
controlHeightXS,
borderRadius,
borderRadiusSM,
borderRadiusXS,
borderRadiusLG,
fontSizeLG
} = token;
return {
[`&${componentCls}-lg`]: {
minWidth: controlHeightLG,
minHeight: controlHeightLG,
borderRadius: borderRadiusLG,
[`${componentCls}-color-block, ${componentCls}-clear`]: {
width: controlHeight,
height: controlHeight,
borderRadius
},
[`${componentCls}-trigger-text`]: {
fontSize: fontSizeLG
}
},
[`&${componentCls}-sm`]: {
minWidth: controlHeightSM,
minHeight: controlHeightSM,
borderRadius: borderRadiusSM,
[`${componentCls}-color-block, ${componentCls}-clear`]: {
width: controlHeightXS,
height: controlHeightXS,
borderRadius: borderRadiusXS
},
[`${componentCls}-trigger-text`]: {
lineHeight: (0,cssinjs.unit)(controlHeightXS)
}
}
};
};
const genColorPickerStyle = token => {
const {
antCls,
componentCls,
colorPickerWidth,
colorPrimary,
motionDurationMid,
colorBgElevated,
colorTextDisabled,
colorText,
colorBgContainerDisabled,
borderRadius,
marginXS,
marginSM,
controlHeight,
controlHeightSM,
colorBgTextActive,
colorPickerPresetColorSize,
colorPickerPreviewSize,
lineWidth,
colorBorder,
paddingXXS,
fontSize,
colorPrimaryHover,
controlOutline
} = token;
return [{
[componentCls]: {
[`${componentCls}-inner`]: {
'&-content': {
display: 'flex',
flexDirection: 'column',
width: colorPickerWidth,
[`& > ${antCls}-divider`]: {
margin: `${(0,cssinjs.unit)(marginSM)} 0 ${(0,cssinjs.unit)(marginXS)}`
}
},
[`${componentCls}-panel`]: {
...picker(token)
},
...slider(token),
...color_block(token, colorPickerPreviewSize),
...input(token),
...presets(token),
...genClearStyle(token, colorPickerPresetColorSize, {
marginInlineStart: 'auto'
}),
// Operation bar
[`${componentCls}-operation`]: {
display: 'flex',
justifyContent: 'space-between',
marginBottom: marginXS
}
},
'&-trigger': {
minWidth: controlHeight,
minHeight: controlHeight,
borderRadius,
border: `${(0,cssinjs.unit)(lineWidth)} solid ${colorBorder}`,
cursor: 'pointer',
display: 'inline-flex',
alignItems: 'flex-start',
justifyContent: 'center',
transition: `all ${motionDurationMid}`,
background: colorBgElevated,
padding: token.calc(paddingXXS).sub(lineWidth).equal(),
[`${componentCls}-trigger-text`]: {
marginInlineStart: marginXS,
marginInlineEnd: token.calc(marginXS).sub(token.calc(paddingXXS).sub(lineWidth)).equal(),
fontSize,
color: colorText,
alignSelf: 'center',
'&-cell': {
'&:not(:last-child):after': {
content: '", "'
},
'&-inactive': {
color: colorTextDisabled
}
}
},
'&:hover': {
borderColor: colorPrimaryHover
},
[`&${componentCls}-trigger-active`]: {
...genActiveStyle(token, colorPrimary, controlOutline)
},
'&-disabled': {
color: colorTextDisabled,
background: colorBgContainerDisabled,
cursor: 'not-allowed',
'&:hover': {
borderColor: colorBgTextActive
},
[`${componentCls}-trigger-text`]: {
color: colorTextDisabled
}
},
...genClearStyle(token, controlHeightSM),
...color_block(token, controlHeightSM),
...genStatusStyle(token),
...genSizeStyle(token)
},
...genRtlStyle(token)
}
}, (0,compact_item.genCompactItemStyle)(token, {
focusElCls: `${componentCls}-trigger-active`
})];
};
/* harmony default export */ var style = ((0,genStyleUtils.genStyleHooks)('ColorPicker', token => {
const {
colorTextQuaternary,
marginSM
} = token;
const colorPickerSliderHeight = 8;
const colorPickerToken = (0,es.mergeToken)(token, {
colorPickerWidth: 234,
colorPickerHandlerSize: 16,
colorPickerHandlerSizeSM: 12,
colorPickerAlphaInputWidth: 44,
colorPickerInputNumberHandleWidth: 16,
colorPickerPresetColorSize: 24,
colorPickerInsetShadow: `inset 0 0 1px 0 ${colorTextQuaternary}`,
colorPickerSliderHeight,
colorPickerPreviewSize: token.calc(colorPickerSliderHeight).mul(2).add(marginSM).equal()
});
return genColorPickerStyle(colorPickerToken);
}));
/***/ }),
/***/ "./components/color-picker/util.ts":
/*!*****************************************!*\
!*** ./components/color-picker/util.ts ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ genAlphaColor: function() { return /* binding */ genAlphaColor; },
/* harmony export */ generateColor: function() { return /* binding */ generateColor; },
/* harmony export */ getColorAlpha: function() { return /* binding */ getColorAlpha; },
/* harmony export */ getGradientPercentColor: function() { return /* binding */ getGradientPercentColor; },
/* harmony export */ getRoundNumber: function() { return /* binding */ getRoundNumber; }
/* harmony export */ });
/* harmony import */ var _babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/toConsumableArray */ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js");
/* harmony import */ var _rc_component_color_picker__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @rc-component/color-picker */ "./node_modules/@rc-component/color-picker/es/index.js");
/* harmony import */ var _color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./color */ "./components/color-picker/color.ts");
const generateColor = color => {
if (color instanceof _color__WEBPACK_IMPORTED_MODULE_2__.AggregationColor) {
return color;
}
return new _color__WEBPACK_IMPORTED_MODULE_2__.AggregationColor(color);
};
const getRoundNumber = value => Math.round(Number(value || 0));
const getColorAlpha = color => getRoundNumber(color.toHsb().a * 100);
/** Return the color whose `alpha` is 1 */
const genAlphaColor = (color, alpha) => {
const rgba = color.toRgb();
// Color from hsb input may get `rgb` is (0/0/0) when `hsb.b` is 0
// So if rgb is empty, we should get from hsb
if (!rgba.r && !rgba.g && !rgba.b) {
const hsba = color.toHsb();
hsba.a = alpha || 1;
return generateColor(hsba);
}
rgba.a = alpha || 1;
return generateColor(rgba);
};
/**
* Get percent position color. e.g. [10%-#fff, 20%-#000], 15% => #888
*/
const getGradientPercentColor = (colors, percent) => {
const filledColors = [{
percent: 0,
color: colors[0].color
}].concat((0,_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__["default"])(colors), [{
percent: 100,
color: colors[colors.length - 1].color
}]);
for (let i = 0; i < filledColors.length - 1; i += 1) {
const startPtg = filledColors[i].percent;
const endPtg = filledColors[i + 1].percent;
const startColor = filledColors[i].color;
const endColor = filledColors[i + 1].color;
if (startPtg <= percent && percent <= endPtg) {
const dist = endPtg - startPtg;
if (dist === 0) {
return startColor;
}
const ratio = (percent - startPtg) / dist * 100;
const startRcColor = new _rc_component_color_picker__WEBPACK_IMPORTED_MODULE_1__.Color(startColor);
const endRcColor = new _rc_component_color_picker__WEBPACK_IMPORTED_MODULE_1__.Color(endColor);
return startRcColor.mix(endRcColor, ratio).toRgbString();
}
}
// This will never reach
/* istanbul ignore next */
return '';
};
/***/ }),
/***/ "./components/config-provider/SizeContext.tsx":
/*!****************************************************!*\
!*** ./components/config-provider/SizeContext.tsx ***!
\****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ SizeContextProvider: function() { return /* binding */ SizeContextProvider; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
const SizeContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createContext(undefined);
const SizeContextProvider = ({
children,
size
}) => {
const originSize = react__WEBPACK_IMPORTED_MODULE_0__.useContext(SizeContext);
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(SizeContext.Provider, {
value: size || originSize
}, children);
};
/* harmony default export */ __webpack_exports__["default"] = (SizeContext);
/***/ }),
/***/ "./components/config-provider/context.ts":
/*!***********************************************!*\
!*** ./components/config-provider/context.ts ***!
\***********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ ConfigContext: function() { return /* binding */ ConfigContext; },
/* harmony export */ Variants: function() { return /* binding */ Variants; },
/* harmony export */ defaultIconPrefixCls: function() { return /* binding */ defaultIconPrefixCls; },
/* harmony export */ defaultPrefixCls: function() { return /* binding */ defaultPrefixCls; },
/* harmony export */ useComponentConfig: function() { return /* binding */ useComponentConfig; }
/* harmony export */ });
/* unused harmony export ConfigConsumer */
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
const defaultPrefixCls = 'ant';
const defaultIconPrefixCls = 'anticon';
const Variants = ['outlined', 'borderless', 'filled', 'underlined'];
const defaultGetPrefixCls = (suffixCls, customizePrefixCls) => {
if (customizePrefixCls) {
return customizePrefixCls;
}
return suffixCls ? `${defaultPrefixCls}-${suffixCls}` : defaultPrefixCls;
};
// zombieJ: 🚨 Do not pass `defaultRenderEmpty` here since it will cause circular dependency.
const ConfigContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createContext({
// We provide a default function for Context without provider
getPrefixCls: defaultGetPrefixCls,
iconPrefixCls: defaultIconPrefixCls
});
const {
Consumer: ConfigConsumer
} = ConfigContext;
const EMPTY_OBJECT = {};
/**
* Get ConfigProvider configured component props.
* This help to reduce bundle size for saving `?.` operator.
* Do not use as `useMemo` deps since we do not cache the object here.
*
* NOTE: not refactor this with `useMemo` since memo will cost another memory space,
* which will waste both compare calculation & memory.
*/
function useComponentConfig(propName) {
const context = react__WEBPACK_IMPORTED_MODULE_0__.useContext(ConfigContext);
const {
getPrefixCls,
direction,
getPopupContainer,
renderEmpty
} = context;
const propValue = context[propName];
return {
classNames: EMPTY_OBJECT,
styles: EMPTY_OBJECT,
...propValue,
getPrefixCls,
direction,
getPopupContainer,
renderEmpty
};
}
/***/ }),
/***/ "./components/config-provider/hooks/useSize.ts":
/*!*****************************************************!*\
!*** ./components/config-provider/hooks/useSize.ts ***!
\*****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _SizeContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../SizeContext */ "./components/config-provider/SizeContext.tsx");
const useSize = customSize => {
const size = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(_SizeContext__WEBPACK_IMPORTED_MODULE_1__["default"]);
const mergedSize = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => {
if (!customSize) {
return size;
}
if (typeof customSize === 'string') {
return customSize ?? size;
}
if (typeof customSize === 'function') {
return customSize(size);
}
return size;
}, [customSize, size]);
return mergedSize;
};
/* harmony default export */ __webpack_exports__["default"] = (useSize);
/***/ }),
/***/ "./components/config-provider/style/index.ts":
/*!***************************************************!*\
!*** ./components/config-provider/style/index.ts ***!
\***************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* reexport safe */ _theme_internal__WEBPACK_IMPORTED_MODULE_0__["default"]; }
/* harmony export */ });
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/useResetIconStyle.ts");
/***/ }),
/***/ "./components/date-picker/locale/en_US.ts":
/*!************************************************************!*\
!*** ./components/date-picker/locale/en_US.ts + 1 modules ***!
\************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ date_picker_locale_en_US; }
});
// EXTERNAL MODULE: ./node_modules/@rc-component/picker/es/locale/common.js
var common = __webpack_require__("./node_modules/@rc-component/picker/es/locale/common.js");
;// ./node_modules/@rc-component/picker/es/locale/en_US.js
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var locale = _objectSpread(_objectSpread({}, common.commonLocale), {}, {
locale: 'en_US',
today: 'Today',
now: 'Now',
backToToday: 'Back to today',
ok: 'OK',
clear: 'Clear',
week: 'Week',
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',
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'
});
/* harmony default export */ var en_US = (locale);
// EXTERNAL MODULE: ./components/time-picker/locale/en_US.ts
var locale_en_US = __webpack_require__("./components/time-picker/locale/en_US.ts");
;// ./components/date-picker/locale/en_US.ts
// Merge into a locale object
const en_US_locale = {
lang: {
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'],
...en_US
},
timePickerLocale: {
...locale_en_US["default"]
}
};
// All settings at:
// https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json
/* harmony default export */ var date_picker_locale_en_US = (en_US_locale);
/***/ }),
/***/ "./components/date-picker/style/index.ts":
/*!***********************************************************!*\
!*** ./components/date-picker/style/index.ts + 3 modules ***!
\***********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ date_picker_style; },
genPanelStyle: function() { return /* reexport */ panel.genPanelStyle; },
initPanelComponentToken: function() { return /* reexport */ date_picker_style_token.initPanelComponentToken; },
initPickerPanelToken: function() { return /* reexport */ date_picker_style_token.initPickerPanelToken; }
});
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
// EXTERNAL MODULE: ./components/input/style/index.ts
var style = __webpack_require__("./components/input/style/index.ts");
// EXTERNAL MODULE: ./components/input/style/token.ts
var style_token = __webpack_require__("./components/input/style/token.ts");
// EXTERNAL MODULE: ./components/style/index.tsx
var components_style = __webpack_require__("./components/style/index.tsx");
// EXTERNAL MODULE: ./components/style/compact-item.ts
var compact_item = __webpack_require__("./components/style/compact-item.ts");
// EXTERNAL MODULE: ./components/style/motion/slide.ts
var slide = __webpack_require__("./components/style/motion/slide.ts");
// EXTERNAL MODULE: ./components/style/motion/move.ts
var move = __webpack_require__("./components/style/motion/move.ts");
// EXTERNAL MODULE: ./components/style/roundedArrow.ts
var roundedArrow = __webpack_require__("./components/style/roundedArrow.ts");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
;// ./components/date-picker/style/util.ts
/**
* Get multiple selector needed style. The calculation:
*
* ContainerPadding = BasePadding - ItemMargin
*
* Border: ╔═══════════════════════════╗ ┬
* ContainerPadding: ║ ║ │
* ╟───────────────────────────╢ ┬ │
* Item Margin: ║ ║ │ │
* ║ ┌──────────┐ ║ │ │
* Item(multipleItemHeight): ║ BasePadding │ Item │ ║ Overflow Container(ControlHeight)
* ║ └──────────┘ ║ │ │
* Item Margin: ║ ║ │ │
* ╟───────────────────────────╢ ┴ │
* ContainerPadding: ║ ║ │
* Border: ╚═══════════════════════════╝ ┴
*/
const getMultipleSelectorUnit = token => {
const {
multipleSelectItemHeight,
paddingXXS,
lineWidth,
INTERNAL_FIXED_ITEM_MARGIN
} = token;
const basePadding = token.max(token.calc(paddingXXS).sub(lineWidth).equal(), 0);
const containerPadding = token.max(token.calc(basePadding).sub(INTERNAL_FIXED_ITEM_MARGIN).equal(), 0);
return {
basePadding,
containerPadding,
itemHeight: (0,cssinjs.unit)(multipleSelectItemHeight),
itemLineHeight: (0,cssinjs.unit)(token.calc(multipleSelectItemHeight).sub(token.calc(token.lineWidth).mul(2)).equal())
};
};
/**
* Get the `@rc-component/overflow` needed style.
* It's a share style which means not affected by `size`.
*/
const genOverflowStyle = token => {
const {
componentCls,
iconCls,
borderRadiusSM,
motionDurationSlow,
paddingXS,
multipleItemColorDisabled,
multipleItemBorderColorDisabled,
colorIcon,
colorIconHover,
INTERNAL_FIXED_ITEM_MARGIN
} = token;
const selectOverflowPrefixCls = `${componentCls}-selection-overflow`;
return {
/**
* Do not merge `height` & `line-height` under style with `selection` & `search`, since chrome
* may update to redesign with its align logic.
*/
// =========================== Overflow ===========================
[selectOverflowPrefixCls]: {
position: 'relative',
display: 'flex',
flex: 'auto',
flexWrap: 'wrap',
maxWidth: '100%',
'&-item': {
flex: 'none',
alignSelf: 'center',
// https://github.com/ant-design/ant-design/issues/54179
maxWidth: 'calc(100% - 4px)',
display: 'inline-flex'
},
// ======================== Selections ==========================
[`${componentCls}-selection-item`]: {
display: 'flex',
alignSelf: 'center',
flex: 'none',
boxSizing: 'border-box',
maxWidth: '100%',
marginBlock: INTERNAL_FIXED_ITEM_MARGIN,
borderRadius: borderRadiusSM,
cursor: 'default',
transition: [`font-size`, `line-height`, `height`].map(prop => `${prop} ${motionDurationSlow}`).join(', '),
marginInlineEnd: token.calc(INTERNAL_FIXED_ITEM_MARGIN).mul(2).equal(),
paddingInlineStart: paddingXS,
paddingInlineEnd: token.calc(paddingXS).div(2).equal(),
[`${componentCls}-disabled&`]: {
color: multipleItemColorDisabled,
borderColor: multipleItemBorderColorDisabled,
cursor: 'not-allowed'
},
// It's ok not to do this, but 24px makes bottom narrow in view should adjust
'&-content': {
display: 'inline-block',
marginInlineEnd: token.calc(paddingXS).div(2).equal(),
overflow: 'hidden',
whiteSpace: 'pre',
// fix whitespace wrapping. custom tags display all whitespace within.
textOverflow: 'ellipsis'
},
'&-remove': {
...(0,components_style.resetIcon)(),
display: 'inline-flex',
alignItems: 'center',
color: colorIcon,
fontWeight: 'bold',
fontSize: 10,
lineHeight: 'inherit',
cursor: 'pointer',
[`> ${iconCls}`]: {
verticalAlign: '-0.2em'
},
'&:hover': {
color: colorIconHover
}
}
}
}
};
};
;// ./components/date-picker/style/multiple.ts
const genSize = (token, suffix) => {
const {
componentCls,
controlHeight
} = token;
const suffixCls = suffix ? `${componentCls}-${suffix}` : '';
const multipleSelectorUnit = getMultipleSelectorUnit(token);
return [
// genSelectionStyle(token, suffix),
{
[`${componentCls}-multiple${suffixCls}`]: {
paddingBlock: multipleSelectorUnit.containerPadding,
paddingInlineStart: multipleSelectorUnit.basePadding,
minHeight: controlHeight,
// ======================== Selections ========================
[`${componentCls}-selection-item`]: {
height: multipleSelectorUnit.itemHeight,
lineHeight: (0,cssinjs.unit)(multipleSelectorUnit.itemLineHeight)
}
}
}];
};
const genPickerMultipleStyle = token => {
const {
componentCls,
calc,
lineWidth
} = token;
const smallToken = (0,es.mergeToken)(token, {
fontHeight: token.fontSize,
selectHeight: token.controlHeightSM,
multipleSelectItemHeight: token.multipleItemHeightSM,
borderRadius: token.borderRadiusSM,
borderRadiusSM: token.borderRadiusXS,
controlHeight: token.controlHeightSM
});
const largeToken = (0,es.mergeToken)(token, {
fontHeight: calc(token.multipleItemHeightLG).sub(calc(lineWidth).mul(2).equal()).equal(),
fontSize: token.fontSizeLG,
selectHeight: token.controlHeightLG,
multipleSelectItemHeight: token.multipleItemHeightLG,
borderRadius: token.borderRadiusLG,
borderRadiusSM: token.borderRadius,
controlHeight: token.controlHeightLG
});
return [
// ======================== Size ========================
genSize(smallToken, 'small'), genSize(token), genSize(largeToken, 'large'),
// ====================== Selection ======================
{
[`${componentCls}${componentCls}-multiple`]: {
width: '100%',
cursor: 'text',
// ==================== Selector =====================
[`${componentCls}-selector`]: {
flex: 'auto',
padding: 0,
position: 'relative',
'&:after': {
margin: 0
},
// ================== placeholder ==================
[`${componentCls}-selection-placeholder`]: {
position: 'absolute',
top: '50%',
insetInlineStart: token.inputPaddingHorizontalBase,
insetInlineEnd: 0,
transform: 'translateY(-50%)',
transition: `all ${token.motionDurationSlow}`,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
flex: 1,
color: token.colorTextPlaceholder,
pointerEvents: 'none'
}
},
// ===================== Overflow ====================
...genOverflowStyle(token),
// ====================== Input ======================
// Input is `readonly`, which is used for a11y only
[`${componentCls}-multiple-input`]: {
width: 0,
height: 0,
border: 0,
visibility: 'hidden',
position: 'absolute',
zIndex: -1
}
}
}];
};
/* harmony default export */ var multiple = (genPickerMultipleStyle);
// EXTERNAL MODULE: ./components/date-picker/style/panel.ts
var panel = __webpack_require__("./components/date-picker/style/panel.ts");
// EXTERNAL MODULE: ./components/date-picker/style/token.ts
var date_picker_style_token = __webpack_require__("./components/date-picker/style/token.ts");
// EXTERNAL MODULE: ./components/input/style/variants.ts
var variants = __webpack_require__("./components/input/style/variants.ts");
;// ./components/date-picker/style/variants.ts
const genVariantsStyle = token => {
const {
componentCls
} = token;
return {
[componentCls]: [{
...(0,variants.genOutlinedStyle)(token),
...(0,variants.genUnderlinedStyle)(token),
...(0,variants.genFilledStyle)(token),
...(0,variants.genBorderlessStyle)(token)
},
// ========================= Multiple =========================
{
'&-outlined': {
[`&${componentCls}-multiple ${componentCls}-selection-item`]: {
background: token.multipleItemBg,
border: `${(0,cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.multipleItemBorderColor}`
}
},
'&-filled': {
[`&${componentCls}-multiple ${componentCls}-selection-item`]: {
background: token.colorBgContainer,
border: `${(0,cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}`
}
},
'&-borderless': {
[`&${componentCls}-multiple ${componentCls}-selection-item`]: {
background: token.multipleItemBg,
border: `${(0,cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.multipleItemBorderColor}`
}
},
'&-underlined': {
[`&${componentCls}-multiple ${componentCls}-selection-item`]: {
background: token.multipleItemBg,
border: `${(0,cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.multipleItemBorderColor}`
}
}
}]
};
};
/* harmony default export */ var style_variants = (genVariantsStyle);
;// ./components/date-picker/style/index.ts
const genPickerPadding = (paddingBlock, paddingInline) => {
return {
padding: `${(0,cssinjs.unit)(paddingBlock)} ${(0,cssinjs.unit)(paddingInline)}`
};
};
const genPickerStatusStyle = token => {
const {
componentCls,
colorError,
colorWarning
} = token;
return {
[`${componentCls}:not(${componentCls}-disabled):not([disabled])`]: {
[`&${componentCls}-status-error`]: {
[`${componentCls}-active-bar`]: {
background: colorError
}
},
[`&${componentCls}-status-warning`]: {
[`${componentCls}-active-bar`]: {
background: colorWarning
}
}
}
};
};
const genPickerStyle = token => {
const {
componentCls,
antCls,
paddingInline,
lineWidth,
lineType,
colorBorder,
borderRadius,
motionDurationMid,
colorTextDisabled,
colorTextPlaceholder,
colorTextQuaternary,
fontSizeLG,
inputFontSizeLG,
fontSizeSM,
inputFontSizeSM,
controlHeightSM,
paddingInlineSM,
paddingXS,
marginXS,
colorIcon,
lineWidthBold,
colorPrimary,
motionDurationSlow,
zIndexPopup,
paddingXXS,
sizePopupArrow,
colorBgElevated,
borderRadiusLG,
boxShadowSecondary,
borderRadiusSM,
colorSplit,
cellHoverBg,
presetsWidth,
presetsMaxWidth,
boxShadowPopoverArrow,
fontHeight,
lineHeightLG
} = token;
return [{
[componentCls]: {
...(0,components_style.resetComponent)(token),
...genPickerPadding(token.paddingBlock, token.paddingInline),
position: 'relative',
display: 'inline-flex',
alignItems: 'center',
lineHeight: 1,
borderRadius,
transition: [`border`, `box-shadow`, `background-color`].map(prop => `${prop} ${motionDurationMid}`).join(', '),
[`${componentCls}-prefix`]: {
flex: '0 0 auto',
marginInlineEnd: token.inputAffixPadding
},
// ======================== Input =========================
[`${componentCls}-input`]: {
position: 'relative',
display: 'inline-flex',
alignItems: 'center',
width: '100%',
'> input': {
position: 'relative',
display: 'inline-block',
width: '100%',
color: 'inherit',
fontSize: token.inputFontSize ?? token.fontSize,
lineHeight: token.lineHeight,
transition: `all ${motionDurationMid}`,
...(0,style.genPlaceholderStyle)(colorTextPlaceholder),
flex: 'auto',
// Fix Firefox flex not correct:
// https://github.com/ant-design/ant-design/pull/20023#issuecomment-564389553
minWidth: 1,
height: 'auto',
padding: 0,
background: 'transparent',
border: 0,
fontFamily: 'inherit',
'&:focus': {
boxShadow: 'none',
outline: 0
},
'&[disabled]': {
background: 'transparent',
color: colorTextDisabled,
cursor: 'not-allowed'
}
},
'&-placeholder': {
'> input': {
color: colorTextPlaceholder
}
}
},
// Size
'&-large': {
...genPickerPadding(token.paddingBlockLG, token.paddingInlineLG),
borderRadius: token.borderRadiusLG,
[`${componentCls}-input > input`]: {
fontSize: inputFontSizeLG ?? fontSizeLG,
lineHeight: lineHeightLG
}
},
'&-small': {
...genPickerPadding(token.paddingBlockSM, token.paddingInlineSM),
borderRadius: token.borderRadiusSM,
[`${componentCls}-input > input`]: {
fontSize: inputFontSizeSM ?? fontSizeSM
}
},
[`${componentCls}-suffix`]: {
display: 'flex',
flex: 'none',
alignSelf: 'center',
marginInlineStart: token.calc(paddingXS).div(2).equal(),
color: colorTextQuaternary,
lineHeight: 1,
pointerEvents: 'none',
transition: ['opacity', 'color'].map(prop => `${prop} ${motionDurationMid}`).join(', '),
'> *': {
verticalAlign: 'top',
'&:not(:last-child)': {
marginInlineEnd: marginXS
}
}
},
[`${componentCls}-clear`]: {
position: 'absolute',
top: '50%',
insetInlineEnd: 0,
color: colorTextQuaternary,
lineHeight: 1,
transform: 'translateY(-50%)',
cursor: 'pointer',
opacity: 0,
transition: ['opacity', 'color'].map(prop => `${prop} ${motionDurationMid}`).join(', '),
'> *': {
verticalAlign: 'top'
},
'&:hover': {
color: colorIcon
}
},
'&:hover': {
[`${componentCls}-clear`]: {
opacity: 1
},
// Should use the following selector, but since `:has` has poor compatibility,
// we use `:not(:last-child)` instead, which may cause some problems in some cases.
// [`${componentCls}-suffix:has(+ ${componentCls}-clear)`]: {
[`${componentCls}-suffix:not(:last-child)`]: {
opacity: 0
}
},
[`${componentCls}-separator`]: {
position: 'relative',
display: 'inline-block',
width: '1em',
height: fontSizeLG,
color: colorTextQuaternary,
fontSize: fontSizeLG,
verticalAlign: 'top',
cursor: 'default',
[`${componentCls}-focused &`]: {
color: colorIcon
},
[`${componentCls}-range-separator &`]: {
[`${componentCls}-disabled &`]: {
cursor: 'not-allowed'
}
}
},
// ======================== Range =========================
'&-range': {
position: 'relative',
display: 'inline-flex',
// Active bar
[`${componentCls}-active-bar`]: {
bottom: token.calc(lineWidth).mul(-1).equal(),
height: lineWidthBold,
background: colorPrimary,
opacity: 0,
transition: `all ${motionDurationSlow} ease-out`,
pointerEvents: 'none'
},
[`&${componentCls}-focused`]: {
[`${componentCls}-active-bar`]: {
opacity: 1
}
},
[`${componentCls}-range-separator`]: {
alignItems: 'center',
padding: `0 ${(0,cssinjs.unit)(paddingXS)}`,
lineHeight: 1
}
},
// ======================== Clear =========================
'&-range, &-multiple': {
// Clear
[`${componentCls}-clear`]: {
insetInlineEnd: paddingInline
},
[`&${componentCls}-small`]: {
[`${componentCls}-clear`]: {
insetInlineEnd: paddingInlineSM
}
}
},
// ======================= Dropdown =======================
'&-dropdown': {
...(0,components_style.resetComponent)(token),
...(0,panel.genPanelStyle)(token),
pointerEvents: 'none',
position: 'absolute',
// Fix incorrect position of picker popup
// https://github.com/ant-design/ant-design/issues/35590
top: -9999,
left: {
_skip_check_: true,
value: -9999
},
zIndex: zIndexPopup,
[`&${componentCls}-dropdown-hidden`]: {
display: 'none'
},
'&-rtl': {
direction: 'rtl'
},
[`&${componentCls}-dropdown-placement-bottomLeft,
&${componentCls}-dropdown-placement-bottomRight`]: {
[`${componentCls}-range-arrow`]: {
top: 0,
display: 'block',
transform: 'translateY(-100%)'
}
},
[`&${componentCls}-dropdown-placement-topLeft,
&${componentCls}-dropdown-placement-topRight`]: {
[`${componentCls}-range-arrow`]: {
bottom: 0,
display: 'block',
transform: 'translateY(100%) rotate(180deg)'
}
},
[`&${antCls}-slide-up-appear, &${antCls}-slide-up-enter`]: {
[`${componentCls}-range-arrow${componentCls}-range-arrow`]: {
transition: 'none'
}
},
[`&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-dropdown-placement-topLeft,
&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-dropdown-placement-topRight,
&${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-dropdown-placement-topLeft,
&${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-dropdown-placement-topRight`]: {
animationName: slide.slideDownIn
},
[`&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-dropdown-placement-bottomLeft,
&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-dropdown-placement-bottomRight,
&${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-dropdown-placement-bottomLeft,
&${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-dropdown-placement-bottomRight`]: {
animationName: slide.slideUpIn
},
// https://github.com/ant-design/ant-design/issues/48727
[`&${antCls}-slide-up-leave ${componentCls}-panel-container`]: {
pointerEvents: 'none'
},
[`&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-dropdown-placement-topLeft,
&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-dropdown-placement-topRight`]: {
animationName: slide.slideDownOut
},
[`&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-dropdown-placement-bottomLeft,
&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-dropdown-placement-bottomRight`]: {
animationName: slide.slideUpOut
},
// Time picker with additional style
[`${componentCls}-panel > ${componentCls}-time-panel`]: {
paddingTop: paddingXXS
},
// ======================== Ranges ========================
[`${componentCls}-range-wrapper`]: {
display: 'flex',
position: 'relative'
},
[`${componentCls}-range-arrow`]: {
position: 'absolute',
zIndex: 1,
display: 'none',
paddingInline: token.calc(paddingInline).mul(1.5).equal(),
boxSizing: 'content-box',
transition: `all ${motionDurationSlow} ease-out`,
...(0,roundedArrow.genRoundedArrow)(token, colorBgElevated, boxShadowPopoverArrow),
'&:before': {
insetInlineStart: token.calc(paddingInline).mul(1.5).equal()
}
},
[`${componentCls}-panel-container`]: {
overflow: 'hidden',
verticalAlign: 'top',
background: colorBgElevated,
borderRadius: borderRadiusLG,
boxShadow: boxShadowSecondary,
transition: `margin ${motionDurationSlow}`,
display: 'inline-block',
pointerEvents: 'auto',
// ======================== Layout ========================
[`${componentCls}-panel-layout`]: {
display: 'flex',
flexWrap: 'nowrap',
alignItems: 'stretch'
},
// ======================== Preset ========================
[`${componentCls}-presets`]: {
display: 'flex',
flexDirection: 'column',
minWidth: presetsWidth,
maxWidth: presetsMaxWidth,
ul: {
height: 0,
flex: 'auto',
listStyle: 'none',
overflow: 'auto',
margin: 0,
padding: paddingXS,
borderInlineEnd: `${(0,cssinjs.unit)(lineWidth)} ${lineType} ${colorSplit}`,
li: {
...components_style.textEllipsis,
borderRadius: borderRadiusSM,
paddingInline: paddingXS,
paddingBlock: token.calc(controlHeightSM).sub(fontHeight).div(2).equal(),
cursor: 'pointer',
transition: `all ${motionDurationSlow}`,
'+ li': {
marginTop: marginXS
},
'&:hover': {
background: cellHoverBg
}
}
}
},
// ======================== Panels ========================
[`${componentCls}-panels`]: {
display: 'inline-flex',
flexWrap: 'nowrap',
// [`${componentCls}-panel`]: {
// borderWidth: `0 0 ${unit(lineWidth)}`,
// },
'&:last-child': {
[`${componentCls}-panel`]: {
borderWidth: 0
}
}
},
[`${componentCls}-panel`]: {
verticalAlign: 'top',
background: 'transparent',
borderRadius: 0,
borderWidth: 0,
[`${componentCls}-content, table`]: {
textAlign: 'center'
},
'&-focused': {
borderColor: colorBorder
}
}
}
},
'&-dropdown-range': {
padding: `${(0,cssinjs.unit)(token.calc(sizePopupArrow).mul(2).div(3).equal())} 0`,
'&-hidden': {
display: 'none'
}
},
'&-rtl': {
direction: 'rtl',
[`${componentCls}-separator`]: {
transform: 'scale(-1, 1)'
},
[`${componentCls}-footer`]: {
'&-extra': {
direction: 'rtl'
}
}
}
}
},
// Follow code may reuse in other components
(0,slide.initSlideMotion)(token, 'slide-up'), (0,slide.initSlideMotion)(token, 'slide-down'), (0,move.initMoveMotion)(token, 'move-up'), (0,move.initMoveMotion)(token, 'move-down')];
};
// ============================== Export ==============================
/* harmony default export */ var date_picker_style = ((0,genStyleUtils.genStyleHooks)('DatePicker', token => {
const pickerToken = (0,es.mergeToken)((0,style_token.initInputToken)(token), (0,date_picker_style_token.initPickerPanelToken)(token), {
inputPaddingHorizontalBase: token.calc(token.paddingSM).sub(1).equal(),
multipleSelectItemHeight: token.multipleItemHeight,
selectHeight: token.controlHeight
});
return [(0,panel["default"])(pickerToken), genPickerStyle(pickerToken), style_variants(pickerToken), genPickerStatusStyle(pickerToken), multiple(pickerToken),
// =====================================================
// == Space Compact ==
// =====================================================
(0,compact_item.genCompactItemStyle)(token, {
focusElCls: `${token.componentCls}-focused`
})];
}, date_picker_style_token.prepareComponentToken));
/***/ }),
/***/ "./components/date-picker/style/panel.ts":
/*!***********************************************!*\
!*** ./components/date-picker/style/panel.ts ***!
\***********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ genPanelStyle: function() { return /* binding */ genPanelStyle; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ant-design/fast-color */ "./node_modules/@ant-design/fast-color/es/index.js");
const genPickerCellInnerStyle = token => {
const {
pickerCellCls,
pickerCellInnerCls,
cellHeight,
borderRadiusSM,
motionDurationMid,
cellHoverBg,
lineWidth,
lineType,
colorPrimary,
cellActiveWithRangeBg,
colorTextLightSolid,
colorTextDisabled,
cellBgDisabled,
colorFillSecondary
} = token;
return {
'&::before': {
position: 'absolute',
top: '50%',
insetInlineStart: 0,
insetInlineEnd: 0,
zIndex: 1,
height: cellHeight,
transform: 'translateY(-50%)',
content: '""',
pointerEvents: 'none'
},
// >>> Default
[pickerCellInnerCls]: {
position: 'relative',
zIndex: 2,
display: 'inline-block',
minWidth: cellHeight,
height: cellHeight,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(cellHeight),
borderRadius: borderRadiusSM,
transition: `background-color ${motionDurationMid}`
},
// >>> Hover
[`&:hover:not(${pickerCellCls}-in-view):not(${pickerCellCls}-disabled),
&:hover:not(${pickerCellCls}-selected):not(${pickerCellCls}-range-start):not(${pickerCellCls}-range-end):not(${pickerCellCls}-disabled)`]: {
[pickerCellInnerCls]: {
background: cellHoverBg
}
},
// >>> Today
[`&-in-view${pickerCellCls}-today ${pickerCellInnerCls}`]: {
'&::before': {
position: 'absolute',
top: 0,
insetInlineEnd: 0,
bottom: 0,
insetInlineStart: 0,
zIndex: 1,
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${lineType} ${colorPrimary}`,
borderRadius: borderRadiusSM,
content: '""'
}
},
// >>> In Range
[`&-in-view${pickerCellCls}-in-range,
&-in-view${pickerCellCls}-range-start,
&-in-view${pickerCellCls}-range-end`]: {
position: 'relative',
[`&:not(${pickerCellCls}-disabled):before`]: {
background: cellActiveWithRangeBg
}
},
// >>> Selected
[`&-in-view${pickerCellCls}-selected,
&-in-view${pickerCellCls}-range-start,
&-in-view${pickerCellCls}-range-end`]: {
[`&:not(${pickerCellCls}-disabled) ${pickerCellInnerCls}`]: {
color: colorTextLightSolid,
background: colorPrimary
},
[`&${pickerCellCls}-disabled ${pickerCellInnerCls}`]: {
background: colorFillSecondary
}
},
[`&-in-view${pickerCellCls}-range-start:not(${pickerCellCls}-disabled):before`]: {
insetInlineStart: '50%'
},
[`&-in-view${pickerCellCls}-range-end:not(${pickerCellCls}-disabled):before`]: {
insetInlineEnd: '50%'
},
// range start border-radius
[`&-in-view${pickerCellCls}-range-start:not(${pickerCellCls}-range-end) ${pickerCellInnerCls}`]: {
borderStartStartRadius: borderRadiusSM,
borderEndStartRadius: borderRadiusSM,
borderStartEndRadius: 0,
borderEndEndRadius: 0
},
// range end border-radius
[`&-in-view${pickerCellCls}-range-end:not(${pickerCellCls}-range-start) ${pickerCellInnerCls}`]: {
borderStartStartRadius: 0,
borderEndStartRadius: 0,
borderStartEndRadius: borderRadiusSM,
borderEndEndRadius: borderRadiusSM
},
// >>> Disabled
'&-disabled': {
color: colorTextDisabled,
cursor: 'not-allowed',
[pickerCellInnerCls]: {
background: 'transparent'
},
'&::before': {
background: cellBgDisabled
}
},
[`&-disabled${pickerCellCls}-today ${pickerCellInnerCls}::before`]: {
borderColor: colorTextDisabled
}
};
};
const genPanelStyle = token => {
const {
componentCls,
pickerCellCls,
pickerCellInnerCls,
pickerYearMonthCellWidth,
pickerControlIconSize,
cellWidth,
paddingSM,
paddingXS,
paddingXXS,
colorBgContainer,
lineWidth,
lineType,
borderRadiusLG,
colorPrimary,
colorTextHeading,
colorSplit,
pickerControlIconBorderWidth,
colorIcon,
textHeight,
motionDurationMid,
colorIconHover,
fontWeightStrong,
cellHeight,
pickerCellPaddingVertical,
colorTextDisabled,
colorText,
fontSize,
motionDurationSlow,
withoutTimeCellHeight,
pickerQuarterPanelContentHeight,
borderRadiusSM,
colorTextLightSolid,
cellHoverBg,
timeColumnHeight,
timeColumnWidth,
timeCellHeight,
controlItemBgActive,
marginXXS,
pickerDatePanelPaddingHorizontal,
pickerControlIconMargin
} = token;
const pickerPanelWidth = token.calc(cellWidth).mul(7).add(token.calc(pickerDatePanelPaddingHorizontal).mul(2)).equal();
return {
[componentCls]: {
'&-panel': {
display: 'inline-flex',
flexDirection: 'column',
textAlign: 'center',
background: colorBgContainer,
borderRadius: borderRadiusLG,
outline: 'none',
'&-focused': {
borderColor: colorPrimary
},
'&-rtl': {
[`${componentCls}-prev-icon,
${componentCls}-super-prev-icon`]: {
transform: 'rotate(45deg)'
},
[`${componentCls}-next-icon,
${componentCls}-super-next-icon`]: {
transform: 'rotate(-135deg)'
},
[`${componentCls}-time-panel`]: {
[`${componentCls}-content`]: {
direction: 'ltr',
'> *': {
direction: 'rtl'
}
}
}
}
},
// ========================================================
// = Shared Panel =
// ========================================================
'&-decade-panel, &-year-panel, &-quarter-panel, &-month-panel, &-week-panel, &-date-panel, &-time-panel': {
display: 'flex',
flexDirection: 'column',
width: pickerPanelWidth
},
// ======================= Header =======================
'&-header': {
display: 'flex',
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingXS)}`,
color: colorTextHeading,
borderBottom: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${lineType} ${colorSplit}`,
'> *': {
flex: 'none'
},
button: {
padding: 0,
color: colorIcon,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(textHeight),
background: 'transparent',
border: 0,
cursor: 'pointer',
transition: `color ${motionDurationMid}`,
fontSize: 'inherit',
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
'&:empty': {
display: 'none'
}
},
'> button': {
minWidth: '1.6em',
fontSize,
'&:hover': {
color: colorIconHover
},
'&:disabled': {
opacity: 0.25,
pointerEvents: 'none'
}
},
'&-view': {
flex: 'auto',
fontWeight: fontWeightStrong,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(textHeight),
'> button': {
color: 'inherit',
fontWeight: 'inherit',
verticalAlign: 'top',
'&:not(:first-child)': {
marginInlineStart: paddingXS
},
'&:hover': {
color: colorPrimary
}
}
}
},
// Arrow button
'&-prev-icon, &-next-icon, &-super-prev-icon, &-super-next-icon': {
position: 'relative',
width: pickerControlIconSize,
height: pickerControlIconSize,
'&::before': {
position: 'absolute',
top: 0,
insetInlineStart: 0,
width: pickerControlIconSize,
height: pickerControlIconSize,
border: `0 solid currentcolor`,
borderBlockStartWidth: pickerControlIconBorderWidth,
borderInlineStartWidth: pickerControlIconBorderWidth,
content: '""'
}
},
'&-super-prev-icon, &-super-next-icon': {
'&::after': {
position: 'absolute',
top: pickerControlIconMargin,
insetInlineStart: pickerControlIconMargin,
display: 'inline-block',
width: pickerControlIconSize,
height: pickerControlIconSize,
border: '0 solid currentcolor',
borderBlockStartWidth: pickerControlIconBorderWidth,
borderInlineStartWidth: pickerControlIconBorderWidth,
content: '""'
}
},
'&-prev-icon, &-super-prev-icon': {
transform: 'rotate(-45deg)'
},
'&-next-icon, &-super-next-icon': {
transform: 'rotate(135deg)'
},
// ======================== Body ========================
'&-content': {
width: '100%',
tableLayout: 'fixed',
borderCollapse: 'collapse',
'th, td': {
position: 'relative',
minWidth: cellHeight,
fontWeight: 'normal'
},
th: {
height: token.calc(cellHeight).add(token.calc(pickerCellPaddingVertical).mul(2)).equal(),
color: colorText,
verticalAlign: 'middle'
}
},
'&-cell': {
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(pickerCellPaddingVertical)} 0`,
color: colorTextDisabled,
cursor: 'pointer',
// In view
'&-in-view': {
color: colorText
},
...genPickerCellInnerStyle(token)
},
'&-decade-panel, &-year-panel, &-quarter-panel, &-month-panel': {
[`${componentCls}-content`]: {
height: token.calc(withoutTimeCellHeight).mul(4).equal()
},
[pickerCellInnerCls]: {
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingXS)}`
}
},
'&-quarter-panel': {
[`${componentCls}-content`]: {
height: pickerQuarterPanelContentHeight
}
},
// ========================================================
// = Special =
// ========================================================
// ===================== Decade Panel =====================
'&-decade-panel': {
[pickerCellInnerCls]: {
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(paddingXS).div(2).equal())}`
},
[`${componentCls}-cell::before`]: {
display: 'none'
}
},
// ============= Year & Quarter & Month Panel =============
'&-year-panel, &-quarter-panel, &-month-panel': {
[`${componentCls}-body`]: {
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingXS)}`
},
[pickerCellInnerCls]: {
width: pickerYearMonthCellWidth
}
},
// ====================== Date Panel ======================
'&-date-panel': {
[`${componentCls}-body`]: {
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingXS)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(pickerDatePanelPaddingHorizontal)}`
},
[`${componentCls}-content th`]: {
boxSizing: 'border-box',
padding: 0
}
},
// ====================== Week Panel ======================
'&-week-panel-row': {
td: {
'&:before': {
transition: `background-color ${motionDurationMid}`
},
'&:first-child:before': {
borderStartStartRadius: borderRadiusSM,
borderEndStartRadius: borderRadiusSM
},
'&:last-child:before': {
borderStartEndRadius: borderRadiusSM,
borderEndEndRadius: borderRadiusSM
}
},
'&:hover td:before': {
background: cellHoverBg
},
'&-range-start td, &-range-end td, &-selected td, &-hover td': {
// Rise priority to override hover style
[`&${pickerCellCls}`]: {
'&:before': {
background: colorPrimary
},
[`&${componentCls}-cell-week`]: {
color: new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__.FastColor(colorTextLightSolid).setA(0.5).toHexString()
},
[pickerCellInnerCls]: {
color: colorTextLightSolid
}
}
},
'&-range-hover td:before': {
background: controlItemBgActive
}
},
// >>> ShowWeek
'&-week-panel, &-date-panel-show-week': {
[`${componentCls}-body`]: {
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingXS)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingSM)}`
},
[`${componentCls}-content th`]: {
width: 'auto'
}
},
// ==================== Datetime Panel ====================
'&-datetime-panel': {
display: 'flex',
[`${componentCls}-time-panel`]: {
borderInlineStart: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${lineType} ${colorSplit}`
},
[`${componentCls}-date-panel,
${componentCls}-time-panel`]: {
transition: `opacity ${motionDurationSlow}`
},
// Keyboard
'&-active': {
[`${componentCls}-date-panel,
${componentCls}-time-panel`]: {
opacity: 0.3,
'&-active': {
opacity: 1
}
}
}
},
// ====================== Time Panel ======================
'&-time-panel': {
width: 'auto',
minWidth: 'auto',
[`${componentCls}-content`]: {
display: 'flex',
flex: 'auto',
height: timeColumnHeight
},
'&-column': {
flex: '1 0 auto',
width: timeColumnWidth,
margin: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingXXS)} 0`,
padding: 0,
overflowY: 'auto',
textAlign: 'start',
listStyle: 'none',
transition: `background-color ${motionDurationMid}`,
overflowX: 'hidden',
'&::-webkit-scrollbar': {
width: 8,
backgroundColor: 'transparent'
},
'&::-webkit-scrollbar-thumb': {
backgroundColor: token.colorTextTertiary,
borderRadius: token.borderRadiusSM
},
// For Firefox
'&': {
scrollbarWidth: 'thin',
scrollbarColor: `${token.colorTextTertiary} transparent`
},
'&::after': {
display: 'block',
height: `calc(100% - ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(timeCellHeight)})`,
content: '""'
},
'&:not(:first-child)': {
borderInlineStart: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${lineType} ${colorSplit}`
},
'&-active': {
background: new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__.FastColor(controlItemBgActive).setA(0.2).toHexString()
},
'> li': {
margin: 0,
padding: 0,
[`&${componentCls}-time-panel-cell`]: {
marginInline: marginXXS,
[`${componentCls}-time-panel-cell-inner`]: {
display: 'block',
width: token.calc(timeColumnWidth).sub(token.calc(marginXXS).mul(2)).equal(),
height: timeCellHeight,
margin: 0,
paddingBlock: 0,
paddingInlineEnd: 0,
paddingInlineStart: token.calc(timeColumnWidth).sub(timeCellHeight).div(2).equal(),
color: colorText,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(timeCellHeight),
borderRadius: borderRadiusSM,
cursor: 'pointer',
transition: `background-color ${motionDurationMid}`,
'&:hover': {
background: cellHoverBg
}
},
'&-selected': {
[`${componentCls}-time-panel-cell-inner`]: {
background: controlItemBgActive
}
},
'&-disabled': {
[`${componentCls}-time-panel-cell-inner`]: {
color: colorTextDisabled,
background: 'transparent',
cursor: 'not-allowed'
}
}
}
}
}
}
}
};
};
const genPickerPanelStyle = token => {
const {
componentCls,
textHeight,
lineWidth,
paddingSM,
antCls,
colorPrimary,
cellActiveWithRangeBg,
colorPrimaryBorder,
lineType,
colorSplit
} = token;
return {
[`${componentCls}-dropdown`]: {
// ======================== Footer ========================
[`${componentCls}-footer`]: {
borderTop: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${lineType} ${colorSplit}`,
'&-extra': {
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingSM)}`,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(textHeight).sub(token.calc(lineWidth).mul(2)).equal()),
textAlign: 'start',
'&:not(:last-child)': {
borderBottom: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${lineType} ${colorSplit}`
}
}
},
// ==================== Footer > Ranges ===================
[`${componentCls}-panels + ${componentCls}-footer ${componentCls}-ranges`]: {
justifyContent: 'space-between'
},
[`${componentCls}-ranges`]: {
marginBlock: 0,
paddingInline: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingSM),
overflow: 'hidden',
textAlign: 'start',
listStyle: 'none',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
'> li': {
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(textHeight).sub(token.calc(lineWidth).mul(2)).equal()),
display: 'inline-block'
},
[`${componentCls}-now-btn-disabled`]: {
pointerEvents: 'none',
color: token.colorTextDisabled
},
// https://github.com/ant-design/ant-design/issues/23687
[`${componentCls}-preset > ${antCls}-tag-blue`]: {
color: colorPrimary,
background: cellActiveWithRangeBg,
borderColor: colorPrimaryBorder,
cursor: 'pointer'
},
[`${componentCls}-ok`]: {
paddingBlock: token.calc(lineWidth).mul(2).equal(),
marginInlineStart: 'auto'
}
}
}
};
};
/* harmony default export */ __webpack_exports__["default"] = (genPickerPanelStyle);
/***/ }),
/***/ "./components/date-picker/style/token.ts":
/*!***********************************************!*\
!*** ./components/date-picker/style/token.ts ***!
\***********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ initPanelComponentToken: function() { return /* binding */ initPanelComponentToken; },
/* harmony export */ initPickerPanelToken: function() { return /* binding */ initPickerPanelToken; },
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/fast-color */ "./node_modules/@ant-design/fast-color/es/index.js");
/* harmony import */ var _input_style_token__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../input/style/token */ "./components/input/style/token.ts");
/* harmony import */ var _style_roundedArrow__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../style/roundedArrow */ "./components/style/roundedArrow.ts");
const initPickerPanelToken = token => {
const {
componentCls,
controlHeightLG,
paddingXXS,
padding
} = token;
return {
pickerCellCls: `${componentCls}-cell`,
pickerCellInnerCls: `${componentCls}-cell-inner`,
pickerYearMonthCellWidth: token.calc(controlHeightLG).mul(1.5).equal(),
pickerQuarterPanelContentHeight: token.calc(controlHeightLG).mul(1.4).equal(),
pickerCellPaddingVertical: token.calc(paddingXXS).add(token.calc(paddingXXS).div(2)).equal(),
pickerCellBorderGap: 2,
// Magic for gap between cells
pickerControlIconSize: 7,
pickerControlIconMargin: 4,
pickerControlIconBorderWidth: 1.5,
pickerDatePanelPaddingHorizontal: token.calc(padding).add(token.calc(paddingXXS).div(2)).equal() // 18 in normal
};
};
const initPanelComponentToken = token => {
const {
colorBgContainerDisabled,
controlHeight,
controlHeightSM,
controlHeightLG,
paddingXXS,
lineWidth
} = token;
// Item height default use `controlHeight - 2 * paddingXXS`,
// but some case `paddingXXS=0`.
// Let's fallback it.
const dblPaddingXXS = paddingXXS * 2;
const dblLineWidth = lineWidth * 2;
const multipleItemHeight = Math.min(controlHeight - dblPaddingXXS, controlHeight - dblLineWidth);
const multipleItemHeightSM = Math.min(controlHeightSM - dblPaddingXXS, controlHeightSM - dblLineWidth);
const multipleItemHeightLG = Math.min(controlHeightLG - dblPaddingXXS, controlHeightLG - dblLineWidth);
// FIXED_ITEM_MARGIN is a hardcode calculation since calc not support rounding
const INTERNAL_FIXED_ITEM_MARGIN = Math.floor(paddingXXS / 2);
const filledToken = {
INTERNAL_FIXED_ITEM_MARGIN,
cellHoverBg: token.controlItemBgHover,
cellActiveWithRangeBg: token.controlItemBgActive,
cellHoverWithRangeBg: new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_0__.FastColor(token.colorPrimary).lighten(35).toHexString(),
cellRangeBorderColor: new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_0__.FastColor(token.colorPrimary).lighten(20).toHexString(),
cellBgDisabled: colorBgContainerDisabled,
timeColumnWidth: controlHeightLG * 1.4,
timeColumnHeight: 28 * 8,
timeCellHeight: 28,
cellWidth: controlHeightSM * 1.5,
cellHeight: controlHeightSM,
textHeight: controlHeightLG,
withoutTimeCellHeight: controlHeightLG * 1.65,
multipleItemBg: token.colorFillSecondary,
multipleItemBorderColor: 'transparent',
multipleItemHeight,
multipleItemHeightSM,
multipleItemHeightLG,
multipleSelectorBgDisabled: colorBgContainerDisabled,
multipleItemColorDisabled: token.colorTextDisabled,
multipleItemBorderColorDisabled: 'transparent'
};
return filledToken;
};
const prepareComponentToken = token => ({
...(0,_input_style_token__WEBPACK_IMPORTED_MODULE_1__.initComponentToken)(token),
...initPanelComponentToken(token),
...(0,_style_roundedArrow__WEBPACK_IMPORTED_MODULE_2__.getArrowToken)(token),
presetsWidth: 120,
presetsMaxWidth: 200,
zIndexPopup: token.zIndexPopupBase + 50
});
/***/ }),
/***/ "./components/descriptions/style/index.ts":
/*!************************************************!*\
!*** ./components/descriptions/style/index.ts ***!
\************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const genBorderedStyle = token => {
const {
componentCls,
labelBg
} = token;
return {
[`&${componentCls}-bordered`]: {
[`> ${componentCls}-view`]: {
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
'> table': {
tableLayout: 'auto'
},
[`${componentCls}-row`]: {
borderBottom: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
'&:first-child': {
'> th:first-child, > td:first-child': {
borderStartStartRadius: token.borderRadiusLG
}
},
'&:last-child': {
borderBottom: 'none',
'> th:first-child, > td:first-child': {
borderEndStartRadius: token.borderRadiusLG
}
},
[`> ${componentCls}-item-label, > ${componentCls}-item-content`]: {
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.padding)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingLG)}`,
borderInlineEnd: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
'&:last-child': {
borderInlineEnd: 'none'
}
},
[`> ${componentCls}-item-label`]: {
color: token.colorTextSecondary,
backgroundColor: labelBg,
'&::after': {
display: 'none'
}
}
}
},
[`&${componentCls}-medium`]: {
[`${componentCls}-row`]: {
[`> ${componentCls}-item-label, > ${componentCls}-item-content`]: {
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingSM)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingLG)}`
}
}
},
[`&${componentCls}-small`]: {
[`${componentCls}-row`]: {
[`> ${componentCls}-item-label, > ${componentCls}-item-content`]: {
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingXS)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.padding)}`
}
}
}
}
};
};
const genDescriptionStyles = token => {
const {
componentCls,
extraColor,
itemPaddingBottom,
itemPaddingEnd,
colonMarginRight,
colonMarginLeft,
titleMarginBottom
} = token;
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
...genBorderedStyle(token),
'&-rtl': {
direction: 'rtl'
},
[`${componentCls}-header`]: {
display: 'flex',
alignItems: 'center',
marginBottom: titleMarginBottom
},
[`${componentCls}-title`]: {
..._style__WEBPACK_IMPORTED_MODULE_1__.textEllipsis,
flex: 'auto',
color: token.titleColor,
fontWeight: token.fontWeightStrong,
fontSize: token.fontSizeLG,
lineHeight: token.lineHeightLG
},
[`${componentCls}-extra`]: {
marginInlineStart: 'auto',
color: extraColor,
fontSize: token.fontSize
},
[`${componentCls}-view`]: {
width: '100%',
borderRadius: token.borderRadiusLG,
table: {
width: '100%',
tableLayout: 'fixed',
borderCollapse: 'collapse'
}
},
[`${componentCls}-row`]: {
'> th, > td': {
paddingBottom: itemPaddingBottom,
paddingInlineEnd: itemPaddingEnd
},
'> th:last-child, > td:last-child': {
paddingInlineEnd: 0
},
'&:last-child': {
borderBottom: 'none',
'> th, > td': {
paddingBottom: 0
}
}
},
[`${componentCls}-item-label`]: {
color: token.labelColor,
fontWeight: 'normal',
fontSize: token.fontSize,
lineHeight: token.lineHeight,
textAlign: 'start',
'&::after': {
content: '":"',
position: 'relative',
top: -0.5,
// magic for position
marginInline: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(colonMarginLeft)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(colonMarginRight)}`
},
[`&${componentCls}-item-no-colon::after`]: {
content: '""'
}
},
[`${componentCls}-item-no-label`]: {
'&::after': {
margin: 0,
content: '""'
}
},
[`${componentCls}-item-content`]: {
display: 'table-cell',
flex: 1,
color: token.contentColor,
fontSize: token.fontSize,
lineHeight: token.lineHeight,
wordBreak: 'break-word',
overflowWrap: 'break-word'
},
[`${componentCls}-item`]: {
paddingBottom: 0,
verticalAlign: 'top',
'&-container': {
display: 'flex',
[`${componentCls}-item-label`]: {
display: 'inline-flex',
alignItems: 'baseline'
},
[`${componentCls}-item-content`]: {
display: 'inline-flex',
alignItems: 'baseline',
minWidth: '1em'
}
}
},
'&-medium': {
[`${componentCls}-row`]: {
'> th, > td': {
paddingBottom: token.paddingSM
}
}
},
'&-small': {
[`${componentCls}-row`]: {
'> th, > td': {
paddingBottom: token.paddingXS
}
}
}
}
};
};
const prepareComponentToken = token => ({
labelBg: token.colorFillAlter,
labelColor: token.colorTextTertiary,
titleColor: token.colorText,
titleMarginBottom: token.fontSizeSM * token.lineHeightSM,
itemPaddingBottom: token.padding,
itemPaddingEnd: token.padding,
colonMarginRight: token.marginXS,
colonMarginLeft: token.marginXXS / 2,
contentColor: token.colorText,
extraColor: token.colorText
});
// ============================== Export ==============================
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genStyleHooks)('Descriptions', token => {
const descriptionToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token, {});
return genDescriptionStyles(descriptionToken);
}, prepareComponentToken));
/***/ }),
/***/ "./components/divider/style/index.ts":
/*!*******************************************!*\
!*** ./components/divider/style/index.ts ***!
\*******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
// ============================== Size ================================
const genSizeDividerStyle = token => {
const {
componentCls
} = token;
return {
[componentCls]: {
'&-horizontal': {
[`&${componentCls}`]: {
'&-sm': {
marginBlock: token.marginXS
},
'&-md': {
marginBlock: token.margin
}
}
}
}
};
};
// ============================== Shared ==============================
const genSharedDividerStyle = token => {
const {
componentCls,
sizePaddingEdgeHorizontal,
colorSplit,
lineWidth,
textPaddingInline,
orientationMargin,
verticalMarginInline
} = token;
const railCls = `${componentCls}-rail`;
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
borderBlockStart: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} solid ${colorSplit}`,
[railCls]: {
borderBlockStart: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} solid ${colorSplit}`
},
// vertical
'&-vertical': {
position: 'relative',
top: '-0.06em',
display: 'inline-block',
height: '0.9em',
marginInline: verticalMarginInline,
marginBlock: 0,
verticalAlign: 'middle',
borderTop: 0,
borderInlineStart: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} solid ${colorSplit}`
},
'&-horizontal': {
display: 'flex',
clear: 'both',
width: '100%',
minWidth: '100%',
// Fix https://github.com/ant-design/ant-design/issues/10914
margin: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.marginLG)} 0`
},
[`&-horizontal${componentCls}-with-text`]: {
display: 'flex',
alignItems: 'center',
margin: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.dividerHorizontalWithTextGutterMargin)} 0`,
color: token.colorTextHeading,
fontWeight: 500,
fontSize: token.fontSizeLG,
whiteSpace: 'nowrap',
textAlign: 'center',
borderBlockStart: `0 ${colorSplit}`,
[`${railCls}-start, ${railCls}-end`]: {
width: '50%',
// Chrome not accept `inherit` in `border-top`
borderBlockStartColor: 'inherit',
borderBlockEnd: 0,
content: "''"
}
},
[`&-horizontal${componentCls}-with-text-start`]: {
[`${railCls}-start`]: {
width: `calc(${orientationMargin} * 100%)`
},
[`${railCls}-end`]: {
width: `calc(100% - ${orientationMargin} * 100%)`
}
},
[`&-horizontal${componentCls}-with-text-end`]: {
[`${railCls}-start`]: {
width: `calc(100% - ${orientationMargin} * 100%)`
},
[`${railCls}-end`]: {
width: `calc(${orientationMargin} * 100%)`
}
},
[`${componentCls}-inner-text`]: {
display: 'inline-block',
paddingBlock: 0,
paddingInline: textPaddingInline
},
'&-dashed': {
background: 'none',
borderColor: colorSplit,
borderStyle: 'dashed',
borderWidth: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} 0 0`,
[railCls]: {
borderBlockStart: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} dashed ${colorSplit}`
}
},
[`&-horizontal${componentCls}-with-text${componentCls}-dashed`]: {
[`${railCls}-start, ${railCls}-end`]: {
borderStyle: 'dashed none none'
}
},
[`&-vertical${componentCls}-dashed`]: {
borderInlineStartWidth: lineWidth,
borderInlineEnd: 0,
borderBlockStart: 0,
borderBlockEnd: 0
},
'&-dotted': {
background: 'none',
borderColor: colorSplit,
borderStyle: 'dotted',
borderWidth: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} 0 0`,
[railCls]: {
borderBlockStart: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} dotted ${colorSplit}`
}
},
[`&-horizontal${componentCls}-with-text${componentCls}-dotted`]: {
'&::before, &::after': {
borderStyle: 'dotted none none'
}
},
[`&-vertical${componentCls}-dotted`]: {
borderInlineStartWidth: lineWidth,
borderInlineEnd: 0,
borderBlockStart: 0,
borderBlockEnd: 0
},
[`&-plain${componentCls}-with-text`]: {
color: token.colorText,
fontWeight: 'normal',
fontSize: token.fontSize
},
[`&-horizontal${componentCls}-with-text-start${componentCls}-no-default-orientation-margin-start`]: {
[`${railCls}-start`]: {
width: 0
},
[`${railCls}-end`]: {
width: '100%'
},
[`${componentCls}-inner-text`]: {
paddingInlineStart: sizePaddingEdgeHorizontal
}
},
[`&-horizontal${componentCls}-with-text-end${componentCls}-no-default-orientation-margin-end`]: {
[`${railCls}-start`]: {
width: '100%'
},
[`${railCls}-end`]: {
width: 0
},
[`${componentCls}-inner-text`]: {
paddingInlineEnd: sizePaddingEdgeHorizontal
}
}
}
};
};
const prepareComponentToken = token => ({
textPaddingInline: '1em',
orientationMargin: 0.05,
verticalMarginInline: token.marginXS
});
// ============================== Export ==============================
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genStyleHooks)('Divider', token => {
const dividerToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token, {
dividerHorizontalWithTextGutterMargin: token.margin,
sizePaddingEdgeHorizontal: 0
});
return [genSharedDividerStyle(dividerToken), genSizeDividerStyle(dividerToken)];
}, prepareComponentToken, {
unitless: {
orientationMargin: true
}
}));
/***/ }),
/***/ "./components/drawer/style/index.ts":
/*!******************************************************!*\
!*** ./components/drawer/style/index.ts + 1 modules ***!
\******************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ drawer_style; },
prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
});
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
// EXTERNAL MODULE: ./components/style/index.tsx
var style = __webpack_require__("./components/style/index.tsx");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
;// ./components/drawer/style/motion.ts
const getMoveTranslate = direction => {
const value = '100%';
return {
left: `translateX(-${value})`,
right: `translateX(${value})`,
top: `translateY(-${value})`,
bottom: `translateY(${value})`
}[direction];
};
const getEnterLeaveStyle = (startStyle, endStyle) => ({
'&-enter, &-appear': {
...startStyle,
'&-active': endStyle
},
'&-leave': {
...endStyle,
'&-active': startStyle
}
});
const getFadeStyle = (from, duration) => ({
'&-enter, &-appear, &-leave': {
'&-start': {
transition: 'none'
},
'&-active': {
transition: `all ${duration}`
}
},
...getEnterLeaveStyle({
opacity: from
}, {
opacity: 1
})
});
const getPanelMotionStyles = (direction, duration) => [getFadeStyle(0.7, duration), getEnterLeaveStyle({
transform: getMoveTranslate(direction)
}, {
transform: 'none'
})];
const genMotionStyle = token => {
const {
componentCls,
motionDurationSlow
} = token;
return {
[componentCls]: {
// ======================== Mask ========================
[`${componentCls}-mask-motion`]: getFadeStyle(0, motionDurationSlow),
// ======================= Panel ========================
[`${componentCls}-panel-motion`]: ['left', 'right', 'top', 'bottom'].reduce((obj, direction) => {
return {
...obj,
[`&-${direction}`]: getPanelMotionStyles(direction, motionDurationSlow)
};
}, {})
}
};
};
/* harmony default export */ var motion = (genMotionStyle);
;// ./components/drawer/style/index.ts
// =============================== Base ===============================
const genDrawerStyle = token => {
const {
borderRadiusSM,
componentCls,
zIndexPopup,
colorBgMask,
colorBgElevated,
motionDurationSlow,
motionDurationMid,
paddingXS,
padding,
paddingLG,
fontSizeLG,
lineHeightLG,
lineWidth,
lineType,
colorSplit,
marginXS,
colorIcon,
colorIconHover,
colorBgTextHover,
colorBgTextActive,
colorText,
fontWeightStrong,
footerPaddingBlock,
footerPaddingInline,
draggerSize,
calc
} = token;
const wrapperCls = `${componentCls}-content-wrapper`;
const draggerCls = `${componentCls}-resizable-dragger`;
return {
[componentCls]: {
position: 'fixed',
inset: 0,
zIndex: zIndexPopup,
pointerEvents: 'none',
color: colorText,
'&-pure': {
position: 'relative',
background: colorBgElevated,
display: 'flex',
flexDirection: 'column',
pointerEvents: 'auto',
[`&${componentCls}-left`]: {
boxShadow: token.boxShadowDrawerLeft
},
[`&${componentCls}-right`]: {
boxShadow: token.boxShadowDrawerRight
},
[`&${componentCls}-top`]: {
boxShadow: token.boxShadowDrawerUp
},
[`&${componentCls}-bottom`]: {
boxShadow: token.boxShadowDrawerDown
}
},
'&-inline': {
position: 'absolute'
},
// ====================== Mask ======================
[`${componentCls}-mask`]: {
position: 'absolute',
inset: 0,
zIndex: zIndexPopup,
background: colorBgMask,
pointerEvents: 'auto',
[`&${componentCls}-mask-blur`]: {
backdropFilter: 'blur(4px)'
}
},
// ==================== Content =====================
[wrapperCls]: {
position: 'absolute',
zIndex: zIndexPopup,
maxWidth: '100vw',
transition: `all ${motionDurationSlow}`,
'&-hidden': {
display: 'none'
}
},
// Placement
[`&-left > ${wrapperCls}`]: {
top: 0,
bottom: 0,
left: {
_skip_check_: true,
value: 0
},
boxShadow: token.boxShadowDrawerLeft
},
[`&-right > ${wrapperCls}`]: {
top: 0,
right: {
_skip_check_: true,
value: 0
},
bottom: 0,
boxShadow: token.boxShadowDrawerRight
},
[`&-top > ${wrapperCls}`]: {
top: 0,
insetInline: 0,
boxShadow: token.boxShadowDrawerUp
},
[`&-bottom > ${wrapperCls}`]: {
bottom: 0,
insetInline: 0,
boxShadow: token.boxShadowDrawerDown
},
[`${componentCls}-section`]: {
display: 'flex',
flexDirection: 'column',
width: '100%',
height: '100%',
overflow: 'auto',
background: colorBgElevated,
pointerEvents: 'auto'
},
// Header
[`${componentCls}-header`]: {
display: 'flex',
flex: 0,
alignItems: 'center',
padding: `${(0,cssinjs.unit)(padding)} ${(0,cssinjs.unit)(paddingLG)}`,
fontSize: fontSizeLG,
lineHeight: lineHeightLG,
borderBottom: `${(0,cssinjs.unit)(lineWidth)} ${lineType} ${colorSplit}`,
'&-title': {
display: 'flex',
flex: 1,
alignItems: 'center',
minWidth: 0,
minHeight: 0
}
},
[`${componentCls}-extra`]: {
flex: 'none'
},
[`${componentCls}-close`]: {
display: 'inline-flex',
width: calc(fontSizeLG).add(paddingXS).equal(),
height: calc(fontSizeLG).add(paddingXS).equal(),
borderRadius: borderRadiusSM,
justifyContent: 'center',
alignItems: 'center',
color: colorIcon,
fontWeight: fontWeightStrong,
fontSize: fontSizeLG,
fontStyle: 'normal',
lineHeight: 1,
textAlign: 'center',
textTransform: 'none',
textDecoration: 'none',
background: 'transparent',
border: 0,
cursor: 'pointer',
transition: `all ${motionDurationMid}`,
textRendering: 'auto',
[`&${componentCls}-close-end`]: {
marginInlineStart: marginXS
},
[`&:not(${componentCls}-close-end)`]: {
marginInlineEnd: marginXS
},
'&:hover': {
color: colorIconHover,
backgroundColor: colorBgTextHover,
textDecoration: 'none'
},
'&:active': {
backgroundColor: colorBgTextActive
},
...(0,style.genFocusStyle)(token)
},
[`${componentCls}-title`]: {
flex: 1,
margin: 0,
fontWeight: token.fontWeightStrong,
fontSize: fontSizeLG,
lineHeight: lineHeightLG
},
// Body
[`${componentCls}-body`]: {
flex: 1,
minWidth: 0,
minHeight: 0,
padding: paddingLG,
overflow: 'auto',
[`${componentCls}-body-skeleton`]: {
width: '100%',
height: '100%',
display: 'flex',
justifyContent: 'center'
}
},
// Footer
[`${componentCls}-footer`]: {
flexShrink: 0,
padding: `${(0,cssinjs.unit)(footerPaddingBlock)} ${(0,cssinjs.unit)(footerPaddingInline)}`,
borderTop: `${(0,cssinjs.unit)(lineWidth)} ${lineType} ${colorSplit}`
},
// ==================== Resizable ===================
[draggerCls]: {
position: 'absolute',
zIndex: 1,
backgroundColor: 'transparent',
userSelect: 'none',
pointerEvents: 'auto',
'&:hover': {
backgroundColor: token.colorPrimary,
opacity: 0.2
},
'&-dragging': {
backgroundColor: token.colorPrimary,
opacity: 0.3
}
},
[`${draggerCls}-left`]: {
top: 0,
bottom: 0,
right: {
_skip_check_: true,
value: 0
},
width: draggerSize,
cursor: 'col-resize'
},
[`${draggerCls}-right`]: {
top: 0,
bottom: 0,
left: {
_skip_check_: true,
value: 0
},
width: draggerSize,
cursor: 'col-resize'
},
[`${draggerCls}-top`]: {
insetInline: 0,
bottom: 0,
height: draggerSize,
cursor: 'row-resize'
},
[`${draggerCls}-bottom`]: {
insetInline: 0,
top: 0,
height: draggerSize,
cursor: 'row-resize'
},
// Wrapper dragging state - disable transitions for smooth dragging
[`${wrapperCls}-dragging`]: {
userSelect: 'none',
transition: 'none',
willChange: 'width, height',
[`${componentCls}-content`]: {
pointerEvents: 'none'
},
[`${componentCls}-section`]: {
pointerEvents: 'none'
}
},
// ====================== RTL =======================
'&-rtl': {
direction: 'rtl'
}
}
};
};
const prepareComponentToken = token => ({
zIndexPopup: token.zIndexPopupBase,
footerPaddingBlock: token.paddingXS,
footerPaddingInline: token.padding,
draggerSize: 4
});
// ============================== Export ==============================
/* harmony default export */ var drawer_style = ((0,genStyleUtils.genStyleHooks)('Drawer', token => {
const drawerToken = (0,es.mergeToken)(token, {});
return [genDrawerStyle(drawerToken), motion(drawerToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/dropdown/style/index.ts":
/*!********************************************************!*\
!*** ./components/dropdown/style/index.ts + 1 modules ***!
\********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ dropdown_style; },
prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
});
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
// EXTERNAL MODULE: ./components/style/index.tsx
var style = __webpack_require__("./components/style/index.tsx");
// EXTERNAL MODULE: ./components/style/motion/slide.ts
var slide = __webpack_require__("./components/style/motion/slide.ts");
// EXTERNAL MODULE: ./components/style/motion/move.ts
var move = __webpack_require__("./components/style/motion/move.ts");
// EXTERNAL MODULE: ./components/style/motion/zoom.ts
var zoom = __webpack_require__("./components/style/motion/zoom.ts");
// EXTERNAL MODULE: ./components/style/placementArrow.ts
var placementArrow = __webpack_require__("./components/style/placementArrow.ts");
// EXTERNAL MODULE: ./components/style/roundedArrow.ts
var roundedArrow = __webpack_require__("./components/style/roundedArrow.ts");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
;// ./components/dropdown/style/status.ts
const genStatusStyle = token => {
const {
componentCls,
menuCls,
colorError,
colorTextLightSolid
} = token;
const itemCls = `${menuCls}-item`;
return {
[`${componentCls}, ${componentCls}-menu-submenu`]: {
[`${menuCls} ${itemCls}`]: {
[`&${itemCls}-danger:not(${itemCls}-disabled)`]: {
color: colorError,
'&:hover': {
color: colorTextLightSolid,
backgroundColor: colorError
}
}
}
}
};
};
/* harmony default export */ var style_status = (genStatusStyle);
;// ./components/dropdown/style/index.ts
// =============================== Base ===============================
const genBaseStyle = token => {
const {
componentCls,
menuCls,
zIndexPopup,
dropdownArrowDistance,
sizePopupArrow,
antCls,
iconCls,
motionDurationMid,
paddingBlock,
fontSize,
dropdownEdgeChildPadding,
colorTextDisabled,
fontSizeIcon,
controlPaddingHorizontal,
colorBgElevated
} = token;
return [{
[componentCls]: {
position: 'absolute',
top: -9999,
left: {
_skip_check_: true,
value: -9999
},
zIndex: zIndexPopup,
display: 'block',
// A placeholder out of dropdown visible range to avoid close when user moving
'&::before': {
position: 'absolute',
insetBlock: token.calc(sizePopupArrow).div(2).sub(dropdownArrowDistance).equal(),
// insetInlineStart: -7, // FIXME: Seems not work for hidden element
zIndex: -9999,
opacity: 0.0001,
content: '""'
},
// Makes vertical dropdowns have a scrollbar once they become taller than the viewport.
'&-menu-vertical': {
maxHeight: '100vh',
overflowY: 'auto'
},
[`&-trigger${antCls}-btn`]: {
[`& > ${iconCls}-down, & > ${antCls}-btn-icon > ${iconCls}-down`]: {
fontSize: fontSizeIcon
}
},
[`${componentCls}-wrap`]: {
position: 'relative',
[`${antCls}-btn > ${iconCls}-down`]: {
fontSize: fontSizeIcon
},
[`${iconCls}-down::before`]: {
transition: `transform ${motionDurationMid}`
}
},
[`${componentCls}-wrap-open`]: {
[`${iconCls}-down::before`]: {
transform: `rotate(180deg)`
}
},
'&-hidden, &-menu-hidden, &-menu-submenu-hidden': {
display: 'none'
},
// =============================================================
// == Motion ==
// =============================================================
// When position is not enough for dropdown, the placement will revert.
// We will handle this with revert motion name.
[`&${antCls}-slide-down-enter${antCls}-slide-down-enter-active${componentCls}-placement-bottomLeft,
&${antCls}-slide-down-appear${antCls}-slide-down-appear-active${componentCls}-placement-bottomLeft,
&${antCls}-slide-down-enter${antCls}-slide-down-enter-active${componentCls}-placement-bottom,
&${antCls}-slide-down-appear${antCls}-slide-down-appear-active${componentCls}-placement-bottom,
&${antCls}-slide-down-enter${antCls}-slide-down-enter-active${componentCls}-placement-bottomRight,
&${antCls}-slide-down-appear${antCls}-slide-down-appear-active${componentCls}-placement-bottomRight`]: {
animationName: slide.slideUpIn
},
[`&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-placement-topLeft,
&${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-placement-topLeft,
&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-placement-top,
&${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-placement-top,
&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-placement-topRight,
&${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-placement-topRight`]: {
animationName: slide.slideDownIn
},
[`&${antCls}-slide-down-leave${antCls}-slide-down-leave-active${componentCls}-placement-bottomLeft,
&${antCls}-slide-down-leave${antCls}-slide-down-leave-active${componentCls}-placement-bottom,
&${antCls}-slide-down-leave${antCls}-slide-down-leave-active${componentCls}-placement-bottomRight`]: {
animationName: slide.slideUpOut
},
[`&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-placement-topLeft,
&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-placement-top,
&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-placement-topRight`]: {
animationName: slide.slideDownOut
}
}
},
// =============================================================
// == Arrow style ==
// =============================================================
(0,placementArrow["default"])(token, colorBgElevated, {
arrowPlacement: {
top: true,
bottom: true
}
}), {
// =============================================================
// == Menu ==
// =============================================================
[`${componentCls} ${menuCls}`]: {
position: 'relative',
margin: 0
},
[`${menuCls}-submenu-popup`]: {
position: 'absolute',
zIndex: zIndexPopup,
background: 'transparent',
boxShadow: 'none',
transformOrigin: '0 0',
'ul, li': {
listStyle: 'none',
margin: 0
}
},
[`${componentCls}, ${componentCls}-menu-submenu`]: {
...(0,style.resetComponent)(token),
[menuCls]: {
padding: dropdownEdgeChildPadding,
listStyleType: 'none',
backgroundColor: colorBgElevated,
backgroundClip: 'padding-box',
borderRadius: token.borderRadiusLG,
outline: 'none',
boxShadow: token.boxShadowSecondary,
...(0,style.genFocusStyle)(token),
'&:empty': {
padding: 0,
boxShadow: 'none'
},
[`${menuCls}-item-group-title`]: {
padding: `${(0,cssinjs.unit)(paddingBlock)} ${(0,cssinjs.unit)(controlPaddingHorizontal)}`,
color: token.colorTextDescription,
transition: `all ${motionDurationMid}`
},
// ======================= Item Content =======================
[`${menuCls}-item`]: {
position: 'relative',
display: 'flex',
alignItems: 'center'
},
[`${menuCls}-item-icon`]: {
minWidth: fontSize,
marginInlineEnd: token.marginXS,
fontSize: token.fontSizeSM
},
[`${menuCls}-title-content`]: {
flex: 'auto',
'&-with-extra': {
display: 'inline-flex',
alignItems: 'center',
width: '100%'
},
'> a': {
color: 'inherit',
transition: `all ${motionDurationMid}`,
'&:hover': {
color: 'inherit'
},
'&::after': {
position: 'absolute',
inset: 0,
content: '""'
}
},
[`${menuCls}-item-extra`]: {
paddingInlineStart: token.padding,
marginInlineStart: 'auto',
fontSize: token.fontSizeSM,
color: token.colorTextDescription
}
},
// =========================== Item ===========================
[`${menuCls}-item, ${menuCls}-submenu-title`]: {
display: 'flex',
margin: 0,
padding: `${(0,cssinjs.unit)(paddingBlock)} ${(0,cssinjs.unit)(controlPaddingHorizontal)}`,
color: token.colorText,
fontWeight: 'normal',
fontSize,
lineHeight: token.lineHeight,
cursor: 'pointer',
transition: `all ${motionDurationMid}`,
borderRadius: token.borderRadiusSM,
'&:hover, &-active': {
backgroundColor: token.controlItemBgHover
},
...(0,style.genFocusStyle)(token),
'&-selected': {
color: token.colorPrimary,
backgroundColor: token.controlItemBgActive,
'&:hover, &-active': {
backgroundColor: token.controlItemBgActiveHover
}
},
'&-disabled': {
color: colorTextDisabled,
cursor: 'not-allowed',
'&:hover': {
color: colorTextDisabled,
backgroundColor: colorBgElevated,
cursor: 'not-allowed'
},
a: {
pointerEvents: 'none'
}
},
'&-divider': {
height: 1,
// By design
margin: `${(0,cssinjs.unit)(token.marginXXS)} 0`,
overflow: 'hidden',
lineHeight: 0,
backgroundColor: token.colorSplit
},
[`${componentCls}-menu-submenu-expand-icon`]: {
position: 'absolute',
insetInlineEnd: token.paddingXS,
[`${componentCls}-menu-submenu-arrow-icon`]: {
marginInlineEnd: '0 !important',
color: token.colorIcon,
fontSize: fontSizeIcon,
fontStyle: 'normal'
}
}
},
[`${menuCls}-item-group-list`]: {
margin: `0 ${(0,cssinjs.unit)(token.marginXS)}`,
padding: 0,
listStyle: 'none'
},
[`${menuCls}-submenu-title`]: {
paddingInlineEnd: token.calc(controlPaddingHorizontal).add(token.fontSizeSM).equal()
},
[`${menuCls}-submenu-vertical`]: {
position: 'relative'
},
[`${menuCls}-submenu${menuCls}-submenu-disabled ${componentCls}-menu-submenu-title`]: {
[`&, ${componentCls}-menu-submenu-arrow-icon`]: {
color: colorTextDisabled,
backgroundColor: colorBgElevated,
cursor: 'not-allowed'
}
},
// https://github.com/ant-design/ant-design/issues/19264
[`${menuCls}-submenu-selected ${componentCls}-menu-submenu-title`]: {
color: token.colorPrimary
}
}
}
},
// Follow code may reuse in other components
[(0,slide.initSlideMotion)(token, 'slide-up'), (0,slide.initSlideMotion)(token, 'slide-down'), (0,move.initMoveMotion)(token, 'move-up'), (0,move.initMoveMotion)(token, 'move-down'), (0,zoom.initZoomMotion)(token, 'zoom-big')]];
};
// ============================== Export ==============================
const prepareComponentToken = token => ({
zIndexPopup: token.zIndexPopupBase + 50,
paddingBlock: (token.controlHeight - token.fontSize * token.lineHeight) / 2,
...(0,placementArrow.getArrowOffsetToken)({
contentRadius: token.borderRadiusLG,
limitVerticalRadius: true
}),
...(0,roundedArrow.getArrowToken)(token)
});
/* harmony default export */ var dropdown_style = ((0,genStyleUtils.genStyleHooks)('Dropdown', token => {
const {
marginXXS,
sizePopupArrow,
paddingXXS,
componentCls
} = token;
const dropdownToken = (0,es.mergeToken)(token, {
menuCls: `${componentCls}-menu`,
dropdownArrowDistance: token.calc(sizePopupArrow).div(2).add(marginXXS).equal(),
dropdownEdgeChildPadding: paddingXXS
});
return [genBaseStyle(dropdownToken), style_status(dropdownToken)];
}, prepareComponentToken, {
resetStyle: false
}));
/***/ }),
/***/ "./components/empty/style/index.ts":
/*!*****************************************!*\
!*** ./components/empty/style/index.ts ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
// ============================== Shared ==============================
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: {
maxWidth: '100%',
height: '100%',
margin: 'auto'
}
},
[`${componentCls}-description`]: {
color: token.colorTextDescription
},
// 原来 &-footer 没有父子结构,现在为了外层承担我们的 hashId,改成父子结构
[`${componentCls}-footer`]: {
marginTop: margin
},
'&-normal': {
marginBlock: marginXL,
color: token.colorTextDescription,
[`${componentCls}-description`]: {
color: token.colorTextDescription
},
[`${componentCls}-image`]: {
height: token.emptyImgHeightMD
}
},
'&-small': {
marginBlock: marginXS,
color: token.colorTextDescription,
[`${componentCls}-image`]: {
height: token.emptyImgHeightSM
}
}
}
};
};
// ============================== Export ==============================
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_1__.genStyleHooks)('Empty', token => {
const {
componentCls,
controlHeightLG,
calc
} = token;
const emptyToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_0__.mergeToken)(token, {
emptyImgCls: `${componentCls}-img`,
emptyImgHeight: calc(controlHeightLG).mul(2.5).equal(),
emptyImgHeightMD: controlHeightLG,
emptyImgHeightSM: calc(controlHeightLG).mul(0.875).equal()
});
return genSharedEmptyStyle(emptyToken);
}));
/***/ }),
/***/ "./components/flex/style/index.ts":
/*!****************************************!*\
!*** ./components/flex/style/index.ts ***!
\****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils */ "./components/flex/utils.ts");
const genFlexStyle = token => {
const {
componentCls
} = token;
return {
[componentCls]: {
display: 'flex',
margin: 0,
padding: 0,
'&-vertical': {
flexDirection: 'column'
},
'&-rtl': {
direction: 'rtl'
},
'&:empty': {
display: 'none'
}
}
};
};
const genFlexGapStyle = token => {
const {
componentCls
} = token;
return {
[componentCls]: {
'&-gap-small': {
gap: token.flexGapSM
},
'&-gap-medium, &-gap-middle': {
gap: token.flexGap
},
'&-gap-large': {
gap: token.flexGapLG
}
}
};
};
const genFlexWrapStyle = token => {
const {
componentCls
} = token;
const wrapStyle = {};
_utils__WEBPACK_IMPORTED_MODULE_2__.flexWrapValues.forEach(value => {
wrapStyle[`${componentCls}-wrap-${value}`] = {
flexWrap: value
};
});
return wrapStyle;
};
const genAlignItemsStyle = token => {
const {
componentCls
} = token;
const alignStyle = {};
_utils__WEBPACK_IMPORTED_MODULE_2__.alignItemsValues.forEach(value => {
alignStyle[`${componentCls}-align-${value}`] = {
alignItems: value
};
});
return alignStyle;
};
const genJustifyContentStyle = token => {
const {
componentCls
} = token;
const justifyStyle = {};
_utils__WEBPACK_IMPORTED_MODULE_2__.justifyContentValues.forEach(value => {
justifyStyle[`${componentCls}-justify-${value}`] = {
justifyContent: value
};
});
return justifyStyle;
};
const prepareComponentToken = () => ({});
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_1__.genStyleHooks)('Flex', token => {
const {
paddingXS,
padding,
paddingLG
} = token;
const flexToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_0__.mergeToken)(token, {
flexGapSM: paddingXS,
flexGap: padding,
flexGapLG: paddingLG
});
return [genFlexStyle(flexToken), genFlexGapStyle(flexToken), genFlexWrapStyle(flexToken), genAlignItemsStyle(flexToken), genJustifyContentStyle(flexToken)];
}, prepareComponentToken, {
// Flex component don't apply extra font style
// https://github.com/ant-design/ant-design/issues/46403
resetStyle: false
}));
/***/ }),
/***/ "./components/flex/utils.ts":
/*!**********************************!*\
!*** ./components/flex/utils.ts ***!
\**********************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ alignItemsValues: function() { return /* binding */ alignItemsValues; },
/* harmony export */ flexWrapValues: function() { return /* binding */ flexWrapValues; },
/* harmony export */ justifyContentValues: function() { return /* binding */ justifyContentValues; }
/* harmony export */ });
/* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! clsx */ "./node_modules/clsx/dist/clsx.mjs");
const flexWrapValues = ['wrap', 'nowrap', 'wrap-reverse'];
const justifyContentValues = ['flex-start', 'flex-end', 'start', 'end', 'center', 'space-between', 'space-around', 'space-evenly', 'stretch', 'normal', 'left', 'right'];
const alignItemsValues = ['center', 'start', 'end', 'flex-start', 'flex-end', 'self-start', 'self-end', 'baseline', 'normal', 'stretch'];
const genClsWrap = (prefixCls, props) => {
const wrap = props.wrap === true ? 'wrap' : props.wrap;
return {
[`${prefixCls}-wrap-${wrap}`]: wrap && flexWrapValues.includes(wrap)
};
};
const genClsAlign = (prefixCls, props) => {
const alignCls = {};
alignItemsValues.forEach(cssKey => {
alignCls[`${prefixCls}-align-${cssKey}`] = props.align === cssKey;
});
alignCls[`${prefixCls}-align-stretch`] = !props.align && !!props.vertical;
return alignCls;
};
const genClsJustify = (prefixCls, props) => {
const justifyCls = {};
justifyContentValues.forEach(cssKey => {
justifyCls[`${prefixCls}-justify-${cssKey}`] = props.justify === cssKey;
});
return justifyCls;
};
const createFlexClassNames = (prefixCls, props) => {
return (0,clsx__WEBPACK_IMPORTED_MODULE_0__.clsx)({
...genClsWrap(prefixCls, props),
...genClsAlign(prefixCls, props),
...genClsJustify(prefixCls, props)
});
};
/* harmony default export */ __webpack_exports__["default"] = (createFlexClassNames);
/***/ }),
/***/ "./components/float-button/style/index.ts":
/*!************************************************************!*\
!*** ./components/float-button/style/index.ts + 2 modules ***!
\************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ float_button_style; },
prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
});
// EXTERNAL MODULE: ./components/style/motion/fade.ts
var fade = __webpack_require__("./components/style/motion/fade.ts");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
;// ./components/float-button/style/button.ts
const genFloatButtonStyle = token => {
const {
componentCls,
floatButtonSize,
iconCls,
antCls,
floatButtonIconSize
} = token;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'float-btn');
const badgeCls = `${componentCls}-badge`;
const R = Math.SQRT2;
const offsetR = (R - 1) / R;
const offsetSquare = token.calc(token.borderRadius).mul(offsetR).equal();
const offsetCircle = token.calc(token.controlHeight).div(2).mul(offsetR).equal();
return {
[componentCls]: [
// ==============================================================
// == Variable ==
// ==============================================================
{
[varName('size')]: (0,cssinjs.unit)(floatButtonSize)
},
// ==============================================================
// == Template ==
// ==============================================================
{
flexDirection: 'column',
margin: 0,
padding: `${(0,cssinjs.unit)(token.paddingXXS)} 0`,
width: varRef('size'),
minHeight: varRef('size'),
height: 'auto',
wordBreak: 'break-word',
whiteSpace: 'normal',
gap: token.calc(token.paddingXXS).div(2).equal(),
'&-rtl': {
direction: 'rtl'
},
// ======================== Individual ========================
// Not in group
[`&${componentCls}-individual`]: {
position: 'fixed',
zIndex: token.zIndexPopupBase,
insetInlineEnd: token.floatButtonInsetInlineEnd,
bottom: token.floatButtonInsetBlockEnd,
boxShadow: token.boxShadowSecondary
},
// =========================== Pure ===========================
[`&${componentCls}-pure`]: {
position: 'relative',
inset: 'auto'
},
// ========================== Empty ===========================
'&:empty': {
display: 'none'
},
// =========================== Icon ===========================
[`${componentCls}-icon`]: {
lineHeight: 1
},
// Icon Only will has large icon Size
[`&${componentCls}-icon-only`]: {
[iconCls]: {
fontSize: floatButtonIconSize
}
},
// =========================== Desc ===========================
[`${componentCls}-content`]: {
fontSize: token.fontSizeSM
},
// ========================== Badge ===========================
[badgeCls]: {
position: 'absolute',
top: 0,
insetInlineEnd: 0,
[`&:not(${badgeCls}-dot)`]: {
transform: 'translate(50%, -50%)'
}
},
// RTL
[`&-rtl ${badgeCls}:not(${badgeCls}-dot)`]: {
transform: 'translate(-50%, -50%)'
},
// Shape: square
'&-square': {
[`${badgeCls}-dot`]: {
marginTop: offsetSquare,
marginInlineEnd: offsetSquare
}
},
// Shape: circle
'&-circle': {
[badgeCls]: {
marginTop: offsetCircle,
marginInlineEnd: offsetCircle
}
}
}]
};
};
/* harmony default export */ var style_button = (genFloatButtonStyle);
// EXTERNAL MODULE: ./components/style/index.tsx
var style = __webpack_require__("./components/style/index.tsx");
;// ./components/float-button/style/group.ts
const genGroupStyle = token => {
const {
componentCls,
antCls,
floatButtonSize,
padding
} = token;
const groupCls = `${componentCls}-group`;
const listCls = `${groupCls}-list`;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'float-btn');
return {
[groupCls]: [
// ==============================================================
// == Variable ==
// ==============================================================
{
[varName('list-transform-start')]: `translate(0,${(0,cssinjs.unit)(floatButtonSize)})`,
[varName('list-trigger-offset')]: `calc(${(0,cssinjs.unit)(floatButtonSize)} + ${(0,cssinjs.unit)(padding)})`
},
// ==============================================================
// == Template ==
// ==============================================================
{
...(0,style.resetComponent)(token),
position: 'fixed',
zIndex: token.zIndexPopupBase,
insetInlineEnd: token.floatButtonInsetInlineEnd,
bottom: token.floatButtonInsetBlockEnd,
gap: padding,
'&-rtl': {
direction: 'rtl'
},
// =========================== Pure ===========================
[`&${componentCls}-pure`]: {
position: 'relative',
inset: 'auto'
},
// ========================== Button ==========================
[componentCls]: {
position: 'relative',
inset: 'auto'
}
},
// ==============================================================
// == List ==
// ==============================================================
{
// ======================== Individual ========================
// Not in group
[`&:not(${groupCls}-individual) ${listCls}`]: {
boxShadow: token.boxShadowSecondary
},
[`&${groupCls}-individual ${listCls}`]: {
gap: padding
},
// =========================== Menu ===========================
[`&-menu-mode ${listCls}`]: {
position: 'absolute'
},
// ========================== Motion ==========================
[listCls]: {
borderRadius: token.borderRadiusLG,
'&-motion': {
transition: `all ${token.motionDurationSlow}`,
'&-enter, &-appear': {
opacity: 0,
transform: varRef('list-transform-start'),
'&-active': {
opacity: 1,
transform: `translate(0, 0)`
}
},
'&-leave': {
'&-active': {
opacity: 0,
transform: varRef('list-transform-start')
}
}
}
},
// ======================== Placements ========================
'&-top': {
[listCls]: {
bottom: varRef('list-trigger-offset')
}
},
'&-bottom': {
[listCls]: {
[varName('list-transform-start')]: `translate(0, calc(${(0,cssinjs.unit)(floatButtonSize)} * -1))`,
top: varRef('list-trigger-offset')
}
},
'&-left': {
[listCls]: {
[varName('list-transform-start')]: `translate(${(0,cssinjs.unit)(floatButtonSize)}, 0)`,
right: varRef('list-trigger-offset')
}
},
'&-right': {
[listCls]: {
[varName('list-transform-start')]: `translate(calc(${(0,cssinjs.unit)(floatButtonSize)} * -1), 0)`,
left: varRef('list-trigger-offset')
}
}
}]
};
};
/* harmony default export */ var group = (genGroupStyle);
;// ./components/float-button/style/index.ts
// ============================== Export ==============================
const prepareComponentToken = () => ({});
/* harmony default export */ var float_button_style = ((0,genStyleUtils.genStyleHooks)('FloatButton', token => {
const {
controlHeightLG,
marginXXL,
marginLG,
fontSizeIcon,
calc
} = token;
const floatButtonToken = (0,es.mergeToken)(token, {
floatButtonIconSize: calc(fontSizeIcon).mul(1.5).equal(),
floatButtonSize: controlHeightLG,
floatButtonInsetBlockEnd: marginXXL,
floatButtonInsetInlineEnd: marginLG
});
return [style_button(floatButtonToken), group(floatButtonToken), (0,fade.initFadeMotion)(token)];
}, prepareComponentToken, {
// Should be higher than Button (-999)
order: -998
}));
/***/ }),
/***/ "./components/form/style/index.ts":
/*!****************************************************!*\
!*** ./components/form/style/index.ts + 1 modules ***!
\****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ form_style; },
prepareComponentToken: function() { return /* binding */ prepareComponentToken; },
prepareToken: function() { return /* binding */ prepareToken; }
});
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
// EXTERNAL MODULE: ./components/style/index.tsx
var style = __webpack_require__("./components/style/index.tsx");
// EXTERNAL MODULE: ./components/style/motion/zoom.ts
var zoom = __webpack_require__("./components/style/motion/zoom.ts");
// EXTERNAL MODULE: ./components/style/motion/collapse.ts
var collapse = __webpack_require__("./components/style/motion/collapse.ts");
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
;// ./components/form/style/explain.ts
const genFormValidateMotionStyle = token => {
const {
componentCls,
motionDurationFast,
motionEaseInOut
} = token;
const helpCls = `${componentCls}-show-help`;
const helpItemCls = `${componentCls}-show-help-item`;
return {
[helpCls]: {
// Explain holder
transition: `opacity ${motionDurationFast} ${motionEaseInOut}`,
'&-appear, &-enter': {
opacity: 0,
'&-active': {
opacity: 1
}
},
'&-leave': {
opacity: 1,
'&-active': {
opacity: 0
}
},
// Explain
[helpItemCls]: {
overflow: 'hidden',
transition: `${['height', 'opacity', 'transform'].map(prop => `${prop} ${motionDurationFast} ${motionEaseInOut}`).join(', ')} !important`,
[`&${helpItemCls}-appear, &${helpItemCls}-enter`]: {
transform: `translateY(-5px)`,
opacity: 0,
'&-active': {
transform: 'translateY(0)',
opacity: 1
}
},
[`&${helpItemCls}-leave-active`]: {
transform: `translateY(-5px)`
}
}
}
};
};
/* harmony default export */ var explain = (genFormValidateMotionStyle);
;// ./components/form/style/index.ts
const resetForm = token => ({
legend: {
display: 'block',
width: '100%',
marginBottom: token.marginLG,
padding: 0,
color: token.colorTextDescription,
fontSize: token.fontSizeLG,
lineHeight: 'inherit',
border: 0,
borderBottom: `${(0,cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`
},
'input[type="search"]': {
boxSizing: 'border-box'
},
// Position radios and checkboxes better
'input[type="radio"], input[type="checkbox"]': {
lineHeight: 'normal'
},
'input[type="file"]': {
display: 'block'
},
// Make range inputs behave like textual form controls
'input[type="range"]': {
display: 'block',
width: '100%'
},
// Make multiple select elements height not fixed
'select[multiple], select[size]': {
height: 'auto'
},
// Focus for file, radio, and checkbox
"input[type='file']:focus, input[type='radio']:focus, input[type='checkbox']:focus": {
outline: 0,
boxShadow: `0 0 0 ${(0,cssinjs.unit)(token.controlOutlineWidth)} ${token.controlOutline}`
},
// Adjust output element
output: {
display: 'block',
paddingTop: 15,
color: token.colorText,
fontSize: token.fontSize,
lineHeight: token.lineHeight
}
});
const genFormSize = (token, height) => {
const {
formItemCls
} = token;
return {
[formItemCls]: {
[`${formItemCls}-label > label`]: {
height
},
[`${formItemCls}-control-input`]: {
minHeight: height
}
}
};
};
const genFormStyle = token => {
const {
componentCls
} = token;
return {
[componentCls]: {
...(0,style.resetComponent)(token),
...resetForm(token),
[`${componentCls}-text`]: {
display: 'inline-block',
paddingInlineEnd: token.paddingSM
},
// ================================================================
// = Size =
// ================================================================
'&-small': {
...genFormSize(token, token.controlHeightSM)
},
'&-large': {
...genFormSize(token, token.controlHeightLG)
}
}
};
};
const genFormItemStyle = token => {
const {
formItemCls,
iconCls,
rootPrefixCls,
antCls,
labelRequiredMarkColor,
labelColor,
labelFontSize,
labelHeight,
labelColonMarginInlineStart,
labelColonMarginInlineEnd,
itemMarginBottom
} = token;
const [varName] = (0,genStyleUtils.genCssVar)(antCls, 'grid');
return {
[formItemCls]: {
...(0,style.resetComponent)(token),
marginBottom: itemMarginBottom,
verticalAlign: 'top',
'&-with-help': {
transition: 'none'
},
[`&-hidden,
&-hidden${antCls}-row`]: {
// https://github.com/ant-design/ant-design/issues/26141
display: 'none'
},
'&-has-warning': {
[`${formItemCls}-split`]: {
color: token.colorError
}
},
'&-has-error': {
[`${formItemCls}-split`]: {
color: token.colorWarning
}
},
// ==============================================================
// = Label =
// ==============================================================
[`${formItemCls}-label`]: {
flexGrow: 0,
overflow: 'hidden',
whiteSpace: 'nowrap',
textAlign: 'end',
verticalAlign: 'middle',
'&-left': {
textAlign: 'start'
},
'&-wrap': {
overflow: 'unset',
lineHeight: token.lineHeight,
whiteSpace: 'unset',
'> label': {
verticalAlign: 'middle',
textWrap: 'balance'
}
},
'> label': {
position: 'relative',
display: 'inline-flex',
alignItems: 'center',
maxWidth: '100%',
height: labelHeight,
color: labelColor,
fontSize: labelFontSize,
[`> ${iconCls}`]: {
fontSize: token.fontSize,
verticalAlign: 'top'
},
[`&${formItemCls}-required`]: {
'&::before': {
display: 'inline-block',
marginInlineEnd: token.marginXXS,
color: labelRequiredMarkColor,
fontSize: token.fontSize,
fontFamily: 'sans-serif',
lineHeight: 1,
content: '"*"'
},
[`&${formItemCls}-required-mark-hidden, &${formItemCls}-required-mark-optional`]: {
'&::before': {
display: 'none'
}
}
},
// Optional mark
[`${formItemCls}-optional`]: {
display: 'inline-block',
marginInlineStart: token.marginXXS,
color: token.colorTextDescription,
[`&${formItemCls}-required-mark-hidden`]: {
display: 'none'
}
},
// Optional mark
[`${formItemCls}-tooltip`]: {
color: token.colorTextDescription,
cursor: 'help',
writingMode: 'horizontal-tb',
marginInlineStart: token.marginXXS
},
'&::after': {
content: '":"',
position: 'relative',
marginBlock: 0,
marginInlineStart: labelColonMarginInlineStart,
marginInlineEnd: labelColonMarginInlineEnd
},
[`&${formItemCls}-no-colon::after`]: {
content: '"\\a0"'
}
}
},
// ==============================================================
// = Input =
// ==============================================================
[`${formItemCls}-control`]: {
[varName('display')]: 'flex',
flexDirection: 'column',
flexGrow: 1,
[`&:first-child:not([class^="'${rootPrefixCls}-col-'"]):not([class*="' ${rootPrefixCls}-col-'"])`]: {
width: '100%'
},
'&-input': {
position: 'relative',
display: 'flex',
alignItems: 'center',
minHeight: token.controlHeight,
'&-content': {
flex: 'auto',
maxWidth: '100%',
// Fix https://github.com/ant-design/ant-design/issues/54042
// Remove impact of whitespaces
[`&:has(> ${antCls}-switch:only-child, > ${antCls}-rate:only-child)`]: {
display: 'flex',
alignItems: 'center'
}
}
}
},
// ==============================================================
// = Explain =
// ==============================================================
[formItemCls]: {
'&-additional': {
display: 'flex',
flexDirection: 'column'
},
'&-explain, &-extra': {
clear: 'both',
color: token.colorTextDescription,
fontSize: token.fontSize,
lineHeight: token.lineHeight
},
'&-explain-connected': {
width: '100%'
},
'&-extra': {
minHeight: token.controlHeightSM,
transition: `color ${token.motionDurationMid} ${token.motionEaseOut}` // sync input color transition
},
'&-explain': {
'&-error': {
color: token.colorError
},
'&-warning': {
color: token.colorWarning
}
}
},
[`&-with-help ${formItemCls}-explain`]: {
height: 'auto',
opacity: 1
},
// ==============================================================
// = Feedback Icon =
// ==============================================================
[`${formItemCls}-feedback-icon`]: {
fontSize: token.fontSize,
textAlign: 'center',
visibility: 'visible',
animationName: zoom.zoomIn,
animationDuration: token.motionDurationMid,
animationTimingFunction: token.motionEaseOutBack,
pointerEvents: 'none',
'&-success': {
color: token.colorSuccess
},
'&-error': {
color: token.colorError
},
'&-warning': {
color: token.colorWarning
},
'&-validating': {
color: token.colorPrimary
}
}
}
};
};
const makeVerticalLayoutLabel = token => ({
padding: token.verticalLabelPadding,
margin: token.verticalLabelMargin,
whiteSpace: 'initial',
textAlign: 'start',
'> label': {
margin: 0,
'&::after': {
// https://github.com/ant-design/ant-design/issues/43538
visibility: 'hidden'
}
}
});
const genHorizontalStyle = token => {
const {
antCls,
formItemCls
} = token;
return {
[`${formItemCls}-horizontal`]: {
[`${formItemCls}-label`]: {
flexGrow: 0
},
[`${formItemCls}-control`]: {
flex: '1 1 0',
// https://github.com/ant-design/ant-design/issues/32777
// https://github.com/ant-design/ant-design/issues/33773
minWidth: 0
},
// Do not change this to `ant-col-24`! `-24` match all the responsive rules
// https://github.com/ant-design/ant-design/issues/32980
// https://github.com/ant-design/ant-design/issues/34903
// https://github.com/ant-design/ant-design/issues/44538
[`${formItemCls}-label[class$='-24'], ${formItemCls}-label[class*='-24 ']`]: {
[`& + ${formItemCls}-control`]: {
minWidth: 'unset'
}
},
[`${antCls}-col-24${formItemCls}-label,
${antCls}-col-xl-24${formItemCls}-label`]: makeVerticalLayoutLabel(token)
}
};
};
const genInlineStyle = token => {
const {
componentCls,
formItemCls,
inlineItemMarginBottom
} = token;
return {
[`${componentCls}-inline`]: {
display: 'flex',
flexWrap: 'wrap',
[`${formItemCls}-inline`]: {
flex: 'none',
marginInlineEnd: token.margin,
marginBottom: inlineItemMarginBottom,
'&-row': {
flexWrap: 'nowrap'
},
[`> ${formItemCls}-label,
> ${formItemCls}-control`]: {
display: 'inline-block',
verticalAlign: 'top'
},
[`> ${formItemCls}-label`]: {
flex: 'none'
},
[`${componentCls}-text`]: {
display: 'inline-block'
},
[`${formItemCls}-has-feedback`]: {
display: 'inline-block'
}
}
}
};
};
const makeVerticalLayout = token => {
const {
componentCls,
formItemCls,
rootPrefixCls
} = token;
return {
[`${formItemCls} ${formItemCls}-label`]: makeVerticalLayoutLabel(token),
// ref: https://github.com/ant-design/ant-design/issues/45122
[`${componentCls}:not(${componentCls}-inline)`]: {
[formItemCls]: {
flexWrap: 'wrap',
[`${formItemCls}-label, ${formItemCls}-control`]: {
// When developer pass `xs: { span }`,
// It should follow the `xs` screen config
// ref: https://github.com/ant-design/ant-design/issues/44386
[`&:not([class*=" ${rootPrefixCls}-col-xs"])`]: {
flex: '0 0 100%',
maxWidth: '100%'
}
}
}
}
};
};
const genVerticalStyle = token => {
const {
componentCls,
formItemCls,
antCls
} = token;
return {
[`${formItemCls}-vertical`]: {
[`${formItemCls}-row`]: {
flexDirection: 'column'
},
[`${formItemCls}-label > label`]: {
height: 'auto'
},
[`${formItemCls}-control`]: {
width: '100%'
},
[`${formItemCls}-label,
${antCls}-col-24${formItemCls}-label,
${antCls}-col-xl-24${formItemCls}-label`]: makeVerticalLayoutLabel(token)
},
[`@media (max-width: ${(0,cssinjs.unit)(token.screenXSMax)})`]: [makeVerticalLayout(token), {
[componentCls]: {
[`${formItemCls}:not(${formItemCls}-horizontal)`]: {
[`${antCls}-col-xs-24${formItemCls}-label`]: makeVerticalLayoutLabel(token)
}
}
}],
[`@media (max-width: ${(0,cssinjs.unit)(token.screenSMMax)})`]: {
[componentCls]: {
[`${formItemCls}:not(${formItemCls}-horizontal)`]: {
[`${antCls}-col-sm-24${formItemCls}-label`]: makeVerticalLayoutLabel(token)
}
}
},
[`@media (max-width: ${(0,cssinjs.unit)(token.screenMDMax)})`]: {
[componentCls]: {
[`${formItemCls}:not(${formItemCls}-horizontal)`]: {
[`${antCls}-col-md-24${formItemCls}-label`]: makeVerticalLayoutLabel(token)
}
}
},
[`@media (max-width: ${(0,cssinjs.unit)(token.screenLGMax)})`]: {
[componentCls]: {
[`${formItemCls}:not(${formItemCls}-horizontal)`]: {
[`${antCls}-col-lg-24${formItemCls}-label`]: makeVerticalLayoutLabel(token)
}
}
}
};
};
// ============================== Export ==============================
const prepareComponentToken = token => ({
labelRequiredMarkColor: token.colorError,
labelColor: token.colorTextHeading,
labelFontSize: token.fontSize,
labelHeight: token.controlHeight,
labelColonMarginInlineStart: token.marginXXS / 2,
labelColonMarginInlineEnd: token.marginXS,
itemMarginBottom: token.marginLG,
verticalLabelPadding: `0 0 ${token.paddingXS}px`,
verticalLabelMargin: 0,
inlineItemMarginBottom: 0
});
const prepareToken = (token, rootPrefixCls) => {
const formToken = (0,es.mergeToken)(token, {
formItemCls: `${token.componentCls}-item`,
rootPrefixCls
});
return formToken;
};
/* harmony default export */ var form_style = ((0,genStyleUtils.genStyleHooks)('Form', (token, {
rootPrefixCls
}) => {
const formToken = prepareToken(token, rootPrefixCls);
return [genFormStyle(formToken), genFormItemStyle(formToken), explain(formToken), genHorizontalStyle(formToken), genInlineStyle(formToken), genVerticalStyle(formToken), (0,collapse["default"])(formToken), zoom.zoomIn];
}, prepareComponentToken, {
// Let From style before the Grid
// ref https://github.com/ant-design/ant-design/issues/44386
order: -1000
}));
/***/ }),
/***/ "./components/grid/style/index.ts":
/*!****************************************!*\
!*** ./components/grid/style/index.ts ***!
\****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ getMediaSize: function() { return /* binding */ getMediaSize; },
/* harmony export */ prepareColComponentToken: function() { return /* binding */ prepareColComponentToken; },
/* harmony export */ prepareRowComponentToken: function() { return /* binding */ prepareRowComponentToken; },
/* harmony export */ useColStyle: function() { return /* binding */ useColStyle; },
/* harmony export */ useRowStyle: function() { return /* binding */ useRowStyle; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/util/genStyleUtils */ "./components/theme/util/genStyleUtils.ts");
// ============================== Row-Shared ==============================
const genGridRowStyle = token => {
const {
componentCls
} = token;
return {
// Grid system
[componentCls]: {
display: 'flex',
flexFlow: 'row wrap',
minWidth: 0,
'&::before, &::after': {
display: 'flex'
},
'&-no-wrap': {
flexWrap: 'nowrap'
},
// The origin of the X-axis
'&-start': {
justifyContent: 'flex-start'
},
// The center of the X-axis
'&-center': {
justifyContent: 'center'
},
// The opposite of the X-axis
'&-end': {
justifyContent: 'flex-end'
},
'&-space-between': {
justifyContent: 'space-between'
},
'&-space-around': {
justifyContent: 'space-around'
},
'&-space-evenly': {
justifyContent: 'space-evenly'
},
// Align at the top
'&-top': {
alignItems: 'flex-start'
},
// Align at the center
'&-middle': {
alignItems: 'center'
},
'&-bottom': {
alignItems: 'flex-end'
}
}
};
};
// ============================== Col-Shared ==============================
const genGridColStyle = token => {
const {
componentCls
} = token;
return {
// Grid system
[componentCls]: {
position: 'relative',
maxWidth: '100%',
// Prevent columns from collapsing when empty
minHeight: 1
}
};
};
const genLoopGridColumnsStyle = (token, sizeCls) => {
const {
componentCls,
gridColumns,
antCls
} = token;
const [gridVarName, gridVarRef] = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.genCssVar)(antCls, 'grid');
const [, colVarRef] = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.genCssVar)(antCls, 'col');
const gridColumnsStyle = {};
for (let i = gridColumns; i >= 0; i--) {
if (i === 0) {
gridColumnsStyle[`${componentCls}${sizeCls}-${i}`] = {
display: 'none'
};
gridColumnsStyle[`${componentCls}-push-${i}`] = {
insetInlineStart: 'auto'
};
gridColumnsStyle[`${componentCls}-pull-${i}`] = {
insetInlineEnd: 'auto'
};
gridColumnsStyle[`${componentCls}${sizeCls}-push-${i}`] = {
insetInlineStart: 'auto'
};
gridColumnsStyle[`${componentCls}${sizeCls}-pull-${i}`] = {
insetInlineEnd: 'auto'
};
gridColumnsStyle[`${componentCls}${sizeCls}-offset-${i}`] = {
marginInlineStart: 0
};
gridColumnsStyle[`${componentCls}${sizeCls}-order-${i}`] = {
order: 0
};
} else {
gridColumnsStyle[`${componentCls}${sizeCls}-${i}`] = [
// https://github.com/ant-design/ant-design/issues/44456
// Form set `display: flex` on Col which will override `display: block`.
// Let's get it from css variable to support override.
{
[gridVarName('display')]: 'block',
// Fallback to display if variable not support
display: 'block'
}, {
display: gridVarRef('display'),
flex: `0 0 ${i / gridColumns * 100}%`,
maxWidth: `${i / gridColumns * 100}%`
}];
gridColumnsStyle[`${componentCls}${sizeCls}-push-${i}`] = {
insetInlineStart: `${i / gridColumns * 100}%`
};
gridColumnsStyle[`${componentCls}${sizeCls}-pull-${i}`] = {
insetInlineEnd: `${i / gridColumns * 100}%`
};
gridColumnsStyle[`${componentCls}${sizeCls}-offset-${i}`] = {
marginInlineStart: `${i / gridColumns * 100}%`
};
gridColumnsStyle[`${componentCls}${sizeCls}-order-${i}`] = {
order: i
};
}
}
// Flex CSS Var
gridColumnsStyle[`${componentCls}${sizeCls}-flex`] = {
flex: colVarRef(`${sizeCls.replace(/-/, '')}-flex`)
};
return gridColumnsStyle;
};
const genGridStyle = (token, sizeCls) => genLoopGridColumnsStyle(token, sizeCls);
const genGridMediaStyle = (token, screenSize, sizeCls) => ({
[`@media (min-width: ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(screenSize)})`]: {
...genGridStyle(token, sizeCls)
}
});
const prepareRowComponentToken = () => ({});
const prepareColComponentToken = () => ({});
// ============================== Export ==============================
const useRowStyle = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.genStyleHooks)('Grid', genGridRowStyle, prepareRowComponentToken);
const getMediaSize = token => {
const mediaSizesMap = {
xs: token.screenXSMin,
sm: token.screenSMMin,
md: token.screenMDMin,
lg: token.screenLGMin,
xl: token.screenXLMin,
xxl: token.screenXXLMin,
xxxl: token.screenXXXLMin
};
return mediaSizesMap;
};
const useColStyle = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.genStyleHooks)('Grid', token => {
const gridToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_1__.mergeToken)(token, {
gridColumns: 24 // Row is divided into 24 parts in Grid
});
const gridMediaSizesMap = getMediaSize(gridToken);
delete gridMediaSizesMap.xs;
return [genGridColStyle(gridToken), genGridStyle(gridToken, ''), genGridStyle(gridToken, '-xs'), Object.keys(gridMediaSizesMap).map(key => genGridMediaStyle(gridToken, gridMediaSizesMap[key], `-${key}`)).reduce((pre, cur) => ({
...pre,
...cur
}), {})];
}, prepareColComponentToken);
/***/ }),
/***/ "./components/image/style/index.ts":
/*!*****************************************!*\
!*** ./components/image/style/index.ts ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ genBoxStyle: function() { return /* binding */ genBoxStyle; },
/* harmony export */ genImageCoverStyle: function() { return /* binding */ genImageCoverStyle; },
/* harmony export */ genImagePreviewStyle: function() { return /* binding */ genImagePreviewStyle; },
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ant-design/fast-color */ "./node_modules/@ant-design/fast-color/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
const genBoxStyle = position => ({
position: position || 'absolute',
inset: 0
});
const genImageCoverStyle = token => {
const {
componentCls,
motionDurationSlow,
colorTextLightSolid
} = token;
return {
[componentCls]: {
[`${componentCls}-cover`]: {
position: 'absolute',
inset: 0,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: colorTextLightSolid,
background: new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__.FastColor('#000').setA(0.3).toRgbString(),
cursor: 'pointer',
opacity: 0,
transition: `opacity ${motionDurationSlow}`
},
'&:hover, &:focus-visible': {
[`${componentCls}-cover`]: {
opacity: 1
}
},
[`${componentCls}-cover-top`]: {
inset: '0 0 auto 0',
justifyContent: 'center'
},
[`${componentCls}-cover-bottom`]: {
inset: 'auto 0 0 0',
justifyContent: 'center'
}
}
};
};
const genImagePreviewStyle = token => {
const {
motionEaseOut,
previewCls,
motionDurationSlow,
componentCls,
colorBgMask,
marginXL,
marginSM,
margin,
colorTextLightSolid,
paddingSM,
paddingLG,
previewOperationHoverColor,
previewOperationColorDisabled,
previewOperationSize,
zIndexPopup
} = token;
const operationBg = new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__.FastColor(colorBgMask).setA(0.1);
const operationBgHover = operationBg.clone().setA(0.2);
const singleBtn = {
position: 'absolute',
color: colorTextLightSolid,
backgroundColor: operationBg.toRgbString(),
borderRadius: '50%',
padding: paddingSM,
outline: 0,
border: 0,
cursor: 'pointer',
transition: `all ${motionDurationSlow}`,
display: 'flex',
fontSize: previewOperationSize,
'&:hover': {
backgroundColor: operationBgHover.toRgbString()
},
'&:active': {
backgroundColor: operationBg.toRgbString()
},
'&:focus-visible': (0,_style__WEBPACK_IMPORTED_MODULE_4__.genFocusOutline)(token)
};
return {
[`${componentCls}-preview`]: {
textAlign: 'center',
inset: 0,
position: 'fixed',
userSelect: 'none',
zIndex: zIndexPopup,
// ================= Mask =================
[`${previewCls}-mask`]: {
inset: 0,
position: 'absolute',
background: colorBgMask,
backdropFilter: 'blur(0px)',
transition: `backdrop-filter ${motionDurationSlow}`,
[`&${componentCls}-preview-mask-blur`]: {
backdropFilter: 'blur(4px)'
},
[`&${componentCls}-preview-mask-hidden`]: {
display: 'none'
}
},
// ================= Body =================
[`${previewCls}-body`]: {
...genBoxStyle(),
'pointer-events': 'none',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
'> *': {
pointerEvents: 'auto'
}
},
// Body > Image
[`${previewCls}-img`]: {
maxWidth: '100%',
maxHeight: '70%',
verticalAlign: 'middle',
transform: 'scale3d(1, 1, 1)',
transition: `transform ${motionDurationSlow} ${motionEaseOut} 0s`
},
[`&-movable ${previewCls}-img`]: {
cursor: 'grab'
},
[`&-moving ${previewCls}-img`]: {
cursor: 'grabbing'
},
// =============== CloseBtn ===============
[`${previewCls}-close`]: {
// Shared style
...singleBtn,
top: marginSM,
insetInlineEnd: marginSM
},
// ================ Switch ================
[`${previewCls}-switch`]: {
...singleBtn,
top: '50%',
transform: `translateY(-50%)`,
'&-disabled': {
'&, &:hover, &:active': {
color: previewOperationColorDisabled,
background: 'transparent',
cursor: 'not-allowed'
}
},
'&-prev': {
insetInlineStart: marginSM
},
'&-next': {
insetInlineEnd: marginSM
}
},
// ================ Footer ================
[`${previewCls}-footer`]: {
position: 'absolute',
bottom: marginXL,
left: {
_skip_check_: true,
value: '50%'
},
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
color: token.previewOperationColor,
transform: 'translateX(-50%)',
gap: margin
},
// =============== Actions ================
[`${previewCls}-actions`]: {
display: 'flex',
gap: paddingSM,
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingLG)}`,
backgroundColor: operationBg.toRgbString(),
borderRadius: 100,
fontSize: previewOperationSize,
'&-action': {
color: 'inherit',
background: 'transparent',
border: 0,
font: 'inherit',
padding: paddingSM,
cursor: 'pointer',
transition: `all ${motionDurationSlow}`,
display: 'flex',
[`&:not(${previewCls}-actions-action-disabled):hover`]: {
color: previewOperationHoverColor
},
'&:focus-visible': (0,_style__WEBPACK_IMPORTED_MODULE_4__.genFocusOutline)(token),
'&-disabled': {
color: previewOperationColorDisabled,
cursor: 'not-allowed'
}
}
}
}
};
};
const genImageStyle = token => {
const {
componentCls
} = token;
return {
// ============================== image ==============================
[componentCls]: {
position: 'relative',
display: 'inline-block',
...(0,_style__WEBPACK_IMPORTED_MODULE_4__.genFocusStyle)(token),
[`${componentCls}-img`]: {
width: '100%',
height: 'auto',
verticalAlign: 'middle'
},
[`${componentCls}-img-placeholder`]: {
backgroundColor: token.colorBgContainerDisabled,
backgroundImage: "url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",
backgroundRepeat: 'no-repeat',
backgroundPosition: 'center center',
backgroundSize: '30%'
},
[`${componentCls}-placeholder`]: {
...genBoxStyle()
}
}
};
};
const genPreviewMotion = token => {
const {
previewCls,
motionDurationSlow
} = token;
return {
[previewCls]: {
'&-fade': {
transition: `opacity ${motionDurationSlow}`,
'&-enter, &-appear': {
opacity: 0,
[`${previewCls}-body`]: {
transform: 'scale(0)'
},
'&-active': {
opacity: 1,
[`${previewCls}-body`]: {
transform: 'scale(1)',
transition: `transform ${motionDurationSlow}`
}
}
},
'&-leave': {
opacity: 1,
'&-active': {
opacity: 0,
[`${previewCls}-body`]: {
transform: 'scale(0)',
transition: `transform ${motionDurationSlow}`
}
}
}
}
}
};
};
// ============================== Export ==============================
const prepareComponentToken = token => ({
zIndexPopup: token.zIndexPopupBase + 80,
previewOperationColor: new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__.FastColor(token.colorTextLightSolid).setA(0.65).toRgbString(),
previewOperationHoverColor: new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__.FastColor(token.colorTextLightSolid).setA(0.85).toRgbString(),
previewOperationColorDisabled: new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__.FastColor(token.colorTextLightSolid).setA(0.25).toRgbString(),
previewOperationSize: token.fontSizeIcon * 1.5 // FIXME: fontSizeIconLG
});
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genStyleHooks)('Image', token => {
const previewCls = `${token.componentCls}-preview`;
const imageToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token, {
previewCls,
imagePreviewSwitchSize: token.controlHeightLG
});
return [genImageStyle(imageToken), genImageCoverStyle(imageToken), genImagePreviewStyle(imageToken), genPreviewMotion(imageToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/index.ts":
/*!********************************************!*\
!*** ./components/index.ts + 1049 modules ***!
\********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Affix: function() { return /* reexport */ components_affix; },
Alert: function() { return /* reexport */ components_alert; },
Anchor: function() { return /* reexport */ components_anchor; },
App: function() { return /* reexport */ app; },
AutoComplete: function() { return /* reexport */ auto_complete; },
Avatar: function() { return /* reexport */ avatar; },
BackTop: function() { return /* reexport */ back_top; },
Badge: function() { return /* reexport */ components_badge; },
Breadcrumb: function() { return /* reexport */ breadcrumb; },
Button: function() { return /* reexport */ components_button; },
Calendar: function() { return /* reexport */ calendar; },
Card: function() { return /* reexport */ card; },
Carousel: function() { return /* reexport */ carousel; },
Cascader: function() { return /* reexport */ cascader; },
Checkbox: function() { return /* reexport */ components_checkbox; },
Col: function() { return /* reexport */ components_col; },
Collapse: function() { return /* reexport */ collapse["default"]; },
ColorPicker: function() { return /* reexport */ color_picker; },
ConfigProvider: function() { return /* reexport */ config_provider; },
DatePicker: function() { return /* reexport */ date_picker; },
Descriptions: function() { return /* reexport */ descriptions; },
Divider: function() { return /* reexport */ divider; },
Drawer: function() { return /* reexport */ drawer; },
Dropdown: function() { return /* reexport */ components_dropdown; },
Empty: function() { return /* reexport */ components_empty; },
Flex: function() { return /* reexport */ flex; },
FloatButton: function() { return /* reexport */ float_button; },
Form: function() { return /* reexport */ components_form; },
Grid: function() { return /* reexport */ grid; },
Image: function() { return /* reexport */ components_image; },
Input: function() { return /* reexport */ input; },
InputNumber: function() { return /* reexport */ input_number; },
Layout: function() { return /* reexport */ components_layout; },
List: function() { return /* reexport */ list; },
Masonry: function() { return /* reexport */ masonry; },
Mentions: function() { return /* reexport */ mentions; },
Menu: function() { return /* reexport */ components_menu; },
Modal: function() { return /* reexport */ modal; },
Pagination: function() { return /* reexport */ components_pagination; },
Popconfirm: function() { return /* reexport */ popconfirm; },
Popover: function() { return /* reexport */ popover; },
Progress: function() { return /* reexport */ components_progress; },
QRCode: function() { return /* reexport */ qr_code; },
Radio: function() { return /* reexport */ components_radio; },
Rate: function() { return /* reexport */ rate; },
Result: function() { return /* reexport */ result; },
Row: function() { return /* reexport */ components_row; },
Segmented: function() { return /* reexport */ segmented; },
Select: function() { return /* reexport */ components_select; },
Skeleton: function() { return /* reexport */ skeleton; },
Slider: function() { return /* reexport */ slider; },
Space: function() { return /* reexport */ space; },
Spin: function() { return /* reexport */ spin; },
Splitter: function() { return /* reexport */ splitter; },
Statistic: function() { return /* reexport */ statistic; },
Steps: function() { return /* reexport */ steps; },
Switch: function() { return /* reexport */ components_switch; },
Table: function() { return /* reexport */ table; },
Tabs: function() { return /* reexport */ components_tabs; },
Tag: function() { return /* reexport */ tag; },
TimePicker: function() { return /* reexport */ time_picker; },
Timeline: function() { return /* reexport */ timeline; },
Tooltip: function() { return /* reexport */ components_tooltip; },
Tour: function() { return /* reexport */ tour; },
Transfer: function() { return /* reexport */ transfer; },
Tree: function() { return /* reexport */ tree; },
TreeSelect: function() { return /* reexport */ tree_select; },
Typography: function() { return /* reexport */ typography; },
Upload: function() { return /* reexport */ components_upload; },
Watermark: function() { return /* reexport */ watermark; },
message: function() { return /* reexport */ components_message; },
notification: function() { return /* reexport */ components_notification; },
theme: function() { return /* reexport */ theme; },
unstableSetRender: function() { return /* binding */ unstableSetRender; },
version: function() { return /* reexport */ version["default"]; }
});
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__("react");
var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
;// ./components/_util/getReactMajorVersionCanDelMe.ts
// ZombieJ: This is only warn for React 17 not support.
// But Jest mock React 17 will cause many issues in testing,
// Can be safe to remove in next major version.
function getReactMajorVersion() {
const majorVersion = Number.parseInt(external_root_React_commonjs2_react_commonjs_react_amd_react_.version.split('.')[0], 10);
return majorVersion;
}
// EXTERNAL MODULE: ./components/_util/warning.ts
var _util_warning = __webpack_require__("./components/_util/warning.ts");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/Children/toArray.js
var toArray = __webpack_require__("./node_modules/@rc-component/util/es/Children/toArray.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/warning.js
var warning = __webpack_require__("./node_modules/@rc-component/util/es/warning.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/Dom/findDOMNode.js
var findDOMNode = __webpack_require__("./node_modules/@rc-component/util/es/Dom/findDOMNode.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/ref.js
var es_ref = __webpack_require__("./node_modules/@rc-component/util/es/ref.js");
;// ./node_modules/@rc-component/resize-observer/es/Collection.js
const CollectionContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
/**
* Collect all the resize event from children ResizeObserver
*/
function Collection({
children,
onBatchResize
}) {
const resizeIdRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(0);
const resizeInfosRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef([]);
const onCollectionResize = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(CollectionContext);
const onResize = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback((size, element, data) => {
resizeIdRef.current += 1;
const currentId = resizeIdRef.current;
resizeInfosRef.current.push({
size,
element,
data
});
Promise.resolve().then(() => {
if (currentId === resizeIdRef.current) {
onBatchResize?.(resizeInfosRef.current);
resizeInfosRef.current = [];
}
});
// Continue bubbling if parent exist
onCollectionResize?.(size, element, data);
}, [onBatchResize, onCollectionResize]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(CollectionContext.Provider, {
value: onResize
}, children);
}
;// ./node_modules/@rc-component/resize-observer/es/utils/observerUtil.js
// =============================== Const ===============================
const elementListeners = new Map();
function onResize(entities) {
entities.forEach(entity => {
const {
target
} = entity;
elementListeners.get(target)?.forEach(listener => listener(target));
});
}
// Delay create ResizeObserver since it's not supported in server side
let observer;
function ensureResizeObserver() {
if (!observer) {
observer = new ResizeObserver(onResize);
}
return observer;
}
// Dev env only
const _el = true ? elementListeners : 0; // eslint-disable-line
const _rs = true ? onResize : 0; // eslint-disable-line
// ============================== Observe ==============================
function observe(element, callback) {
if (!elementListeners.has(element)) {
elementListeners.set(element, new Set());
ensureResizeObserver().observe(element);
}
elementListeners.get(element).add(callback);
}
function unobserve(element, callback) {
if (elementListeners.has(element)) {
elementListeners.get(element).delete(callback);
if (!elementListeners.get(element).size) {
ensureResizeObserver().unobserve(element);
elementListeners.delete(element);
}
}
}
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/index.js + 2 modules
var es = __webpack_require__("./node_modules/@rc-component/util/es/index.js");
;// ./node_modules/@rc-component/resize-observer/es/useResizeObserver.js
function useResizeObserver(enabled, getTarget, onDelayResize, onSyncResize) {
// ============================= Size =============================
const sizeRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({
width: -1,
height: -1,
offsetWidth: -1,
offsetHeight: -1
});
// =========================== Observe ============================
// Handler
const onInternalResize = (0,es.useEvent)(target => {
const {
width,
height
} = target.getBoundingClientRect();
const {
offsetWidth,
offsetHeight
} = target;
/**
* Resize observer trigger when content size changed.
* In most case we just care about element size,
* let's use `boundary` instead of `contentRect` here to avoid shaking.
*/
const fixedWidth = Math.floor(width);
const fixedHeight = Math.floor(height);
if (sizeRef.current.width !== fixedWidth || sizeRef.current.height !== fixedHeight || sizeRef.current.offsetWidth !== offsetWidth || sizeRef.current.offsetHeight !== offsetHeight) {
const size = {
width: fixedWidth,
height: fixedHeight,
offsetWidth,
offsetHeight
};
sizeRef.current = size;
// IE is strange, right?
const mergedOffsetWidth = offsetWidth === Math.round(width) ? width : offsetWidth;
const mergedOffsetHeight = offsetHeight === Math.round(height) ? height : offsetHeight;
const sizeInfo = {
...size,
offsetWidth: mergedOffsetWidth,
offsetHeight: mergedOffsetHeight
};
// Call the callback immediately, let the caller decide whether to defer
// onResize(sizeInfo, target);
onSyncResize?.(sizeInfo, target);
// defer the callback but not defer to next frame
Promise.resolve().then(() => {
onDelayResize?.(sizeInfo, target);
});
}
});
// Dynamic observe
const isFuncTarget = typeof getTarget === 'function';
const funcTargetIdRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(0);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
const target = isFuncTarget ? getTarget() : getTarget;
if (target && enabled) {
observe(target, onInternalResize);
} else if (enabled && isFuncTarget) {
funcTargetIdRef.current += 1;
}
return () => {
if (target) {
unobserve(target, onInternalResize);
}
};
}, [enabled,
// If function target resolves after a parent render, the bumped ref value
// lets the next render re-run this effect without watching the function identity.
isFuncTarget ? funcTargetIdRef.current : getTarget]);
}
;// ./node_modules/@rc-component/resize-observer/es/SingleObserver/index.js
function SingleObserver(props, ref) {
const {
children,
disabled,
onResize,
data
} = props;
const elementRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const onCollectionResize = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(CollectionContext);
// =========================== Children ===========================
const isRenderProps = typeof children === 'function';
const mergedChildren = isRenderProps ? children(elementRef) : children;
// ============================= Ref ==============================
const canRef = !isRenderProps && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(mergedChildren) && (0,es_ref.supportRef)(mergedChildren);
const originRef = canRef ? (0,es_ref.getNodeRef)(mergedChildren) : null;
const mergedRef = (0,es_ref.useComposeRef)(originRef, elementRef);
const getDomElement = () => {
return (0,findDOMNode.getDOM)(elementRef.current);
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => getDomElement());
// =========================== Observe ============================
useResizeObserver(!disabled, getDomElement, onResize, (sizeInfo, target) => {
onCollectionResize?.(sizeInfo, target, data);
});
// ============================ Render ============================
return canRef ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement(mergedChildren, {
ref: mergedRef
}) : mergedChildren;
}
const RefSingleObserver = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(SingleObserver);
if (true) {
RefSingleObserver.displayName = 'SingleObserver';
}
/* harmony default export */ var es_SingleObserver = (RefSingleObserver);
;// ./node_modules/@rc-component/resize-observer/es/index.js
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
const INTERNAL_PREFIX_KEY = 'rc-observer-key';
function es_ResizeObserver(props, ref) {
const {
children
} = props;
const childNodes = typeof children === 'function' ? [children] : (0,toArray["default"])(children);
if (true) {
if (childNodes.length > 1) {
(0,warning.warning)(false, 'Find more than one child node with `children` in ResizeObserver. Please use ResizeObserver.Collection instead.');
} else if (childNodes.length === 0) {
(0,warning.warning)(false, '`children` of ResizeObserver is empty. Nothing is in observe.');
}
}
return childNodes.map((child, index) => {
const key = child?.key || `${INTERNAL_PREFIX_KEY}-${index}`;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_SingleObserver, _extends({}, props, {
key: key,
ref: index === 0 ? ref : undefined
}), child);
});
}
const RefResizeObserver = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(es_ResizeObserver);
if (true) {
RefResizeObserver.displayName = 'ResizeObserver';
}
RefResizeObserver.Collection = Collection;
/* harmony default export */ var resize_observer_es = (RefResizeObserver);
// EXTERNAL MODULE: ./node_modules/clsx/dist/clsx.mjs
var clsx = __webpack_require__("./node_modules/clsx/dist/clsx.mjs");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 3 modules
var toConsumableArray = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/raf.js
var raf = __webpack_require__("./node_modules/@rc-component/util/es/raf.js");
;// ./components/_util/throttleByAnimationFrame.ts
function throttleByAnimationFrame(fn) {
let requestId = null;
const later = args => () => {
requestId = null;
fn.apply(void 0, (0,toConsumableArray["default"])(args));
};
const throttled = (...args) => {
if (requestId === null) {
requestId = (0,raf["default"])(later(args));
}
};
throttled.cancel = () => {
raf["default"].cancel(requestId);
requestId = null;
};
return throttled;
}
/* harmony default export */ var _util_throttleByAnimationFrame = (throttleByAnimationFrame);
// EXTERNAL MODULE: ./components/config-provider/context.ts
var config_provider_context = __webpack_require__("./components/config-provider/context.ts");
// EXTERNAL MODULE: ./components/affix/style/index.ts
var affix_style = __webpack_require__("./components/affix/style/index.ts");
;// ./components/affix/utils.ts
function getTargetRect(target) {
return target !== window ? target.getBoundingClientRect() : {
top: 0,
bottom: window.innerHeight
};
}
function getFixedTop(placeholderRect, targetRect, offsetTop) {
if (offsetTop !== undefined && Math.round(targetRect.top) > Math.round(placeholderRect.top) - offsetTop) {
return offsetTop + targetRect.top;
}
return undefined;
}
function getFixedBottom(placeholderRect, targetRect, offsetBottom) {
if (offsetBottom !== undefined && Math.round(targetRect.bottom) < Math.round(placeholderRect.bottom) + offsetBottom) {
const targetBottomOffset = window.innerHeight - targetRect.bottom;
return offsetBottom + targetBottomOffset;
}
return undefined;
}
;// ./components/affix/index.tsx
const TRIGGER_EVENTS = ['resize', 'scroll', 'touchstart', 'touchmove', 'touchend', 'pageshow', 'load'];
const getDefaultTarget = () => {
return typeof window !== 'undefined' ? window : null;
};
const AFFIX_STATUS_NONE = 0;
const AFFIX_STATUS_PREPARE = 1;
const Affix = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
style,
offsetTop,
offsetBottom,
prefixCls,
className,
rootClassName,
children,
target,
onChange,
onTestUpdatePosition,
...restProps
} = props;
const {
getPrefixCls,
className: contextClassName,
style: contextStyle
} = (0,config_provider_context.useComponentConfig)('affix');
const {
getTargetContainer
} = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(config_provider_context.ConfigContext);
const affixPrefixCls = getPrefixCls('affix', prefixCls);
const [lastAffix, setLastAffix] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(false);
const [affixStyle, setAffixStyle] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState();
const [placeholderStyle, setPlaceholderStyle] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState();
const statusRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(AFFIX_STATUS_NONE);
const prevTargetRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
const prevListenerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
const placeholderNodeRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
const fixedNodeRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
const timerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
const targetFunc = target ?? getTargetContainer ?? getDefaultTarget;
const internalOffsetTop = offsetBottom === undefined && offsetTop === undefined ? 0 : offsetTop;
// =================== Measure ===================
const measure = () => {
if (statusRef.current !== AFFIX_STATUS_PREPARE || !fixedNodeRef.current || !placeholderNodeRef.current || !targetFunc) {
return;
}
const targetNode = targetFunc();
if (targetNode) {
const newState = {
status: AFFIX_STATUS_NONE
};
const placeholderRect = getTargetRect(placeholderNodeRef.current);
if (placeholderRect.top === 0 && placeholderRect.left === 0 && placeholderRect.width === 0 && placeholderRect.height === 0) {
return;
}
const targetRect = getTargetRect(targetNode);
const fixedTop = getFixedTop(placeholderRect, targetRect, internalOffsetTop);
const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom);
if (fixedTop !== undefined) {
newState.affixStyle = {
position: 'fixed',
top: fixedTop,
width: placeholderRect.width,
height: placeholderRect.height
};
newState.placeholderStyle = {
width: placeholderRect.width,
height: placeholderRect.height
};
} else if (fixedBottom !== undefined) {
newState.affixStyle = {
position: 'fixed',
bottom: fixedBottom,
width: placeholderRect.width,
height: placeholderRect.height
};
newState.placeholderStyle = {
width: placeholderRect.width,
height: placeholderRect.height
};
}
newState.lastAffix = !!newState.affixStyle;
if (lastAffix !== newState.lastAffix) {
onChange?.(newState.lastAffix);
}
statusRef.current = newState.status;
setAffixStyle(newState.affixStyle);
setPlaceholderStyle(newState.placeholderStyle);
setLastAffix(newState.lastAffix);
}
};
const prepareMeasure = () => {
statusRef.current = AFFIX_STATUS_PREPARE;
measure();
if (false) // removed by dead control flow
{}
};
const updatePosition = _util_throttleByAnimationFrame(() => {
prepareMeasure();
});
const lazyUpdatePosition = _util_throttleByAnimationFrame(() => {
// Check position change before measure to make Safari smooth
if (targetFunc && affixStyle) {
const targetNode = targetFunc();
if (targetNode && placeholderNodeRef.current) {
const targetRect = getTargetRect(targetNode);
const placeholderRect = getTargetRect(placeholderNodeRef.current);
const fixedTop = getFixedTop(placeholderRect, targetRect, internalOffsetTop);
const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom);
if (fixedTop !== undefined && affixStyle.top === fixedTop || fixedBottom !== undefined && affixStyle.bottom === fixedBottom) {
return;
}
}
}
// Directly call prepare measure since it's already throttled.
prepareMeasure();
});
const addListeners = () => {
const listenerTarget = targetFunc?.();
if (!listenerTarget) {
return;
}
TRIGGER_EVENTS.forEach(eventName => {
if (prevListenerRef.current) {
prevTargetRef.current?.removeEventListener(eventName, prevListenerRef.current);
}
listenerTarget?.addEventListener(eventName, lazyUpdatePosition);
});
prevTargetRef.current = listenerTarget;
prevListenerRef.current = lazyUpdatePosition;
};
const removeListeners = () => {
const newTarget = targetFunc?.();
TRIGGER_EVENTS.forEach(eventName => {
newTarget?.removeEventListener(eventName, lazyUpdatePosition);
if (prevListenerRef.current) {
prevTargetRef.current?.removeEventListener(eventName, prevListenerRef.current);
}
});
updatePosition.cancel();
lazyUpdatePosition.cancel();
};
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useImperativeHandle(ref, () => ({
updatePosition
}));
// mount & unmount
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(() => {
// [Legacy] Wait for parent component ref has its value.
// We should use target as directly element instead of function which makes element check hard.
timerRef.current = setTimeout(addListeners);
return () => {
if (timerRef.current) {
clearTimeout(timerRef.current);
timerRef.current = null;
}
removeListeners();
};
}, []);
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(() => {
addListeners();
return () => removeListeners();
}, [target, affixStyle, lastAffix, offsetTop, offsetBottom]);
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(() => {
updatePosition();
}, [target, offsetTop, offsetBottom]);
const [hashId, cssVarCls] = (0,affix_style["default"])(affixPrefixCls);
const rootCls = (0,clsx.clsx)(rootClassName, hashId, affixPrefixCls, cssVarCls);
const mergedCls = (0,clsx.clsx)({
[rootCls]: affixStyle
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(resize_observer_es, {
onResize: updatePosition
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
style: {
...contextStyle,
...style
},
className: (0,clsx.clsx)(className, contextClassName),
ref: placeholderNodeRef,
...restProps
}, affixStyle && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
style: placeholderStyle,
"aria-hidden": "true"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: mergedCls,
ref: fixedNodeRef,
style: affixStyle
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(resize_observer_es, {
onResize: updatePosition
}, children))));
});
if (true) {
Affix.displayName = 'Affix';
}
/* harmony default export */ var components_affix = (Affix);
;// ./node_modules/@ant-design/icons-svg/es/asn/CheckCircleFilled.js
// This icon file is generated automatically.
var CheckCircleFilled = { "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" };
/* harmony default export */ var asn_CheckCircleFilled = (CheckCircleFilled);
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/components/AntdIcon.js + 3 modules
var AntdIcon = __webpack_require__("./node_modules/@ant-design/icons/es/components/AntdIcon.js");
;// ./node_modules/@ant-design/icons/es/icons/CheckCircleFilled.js
function CheckCircleFilled_extends() { CheckCircleFilled_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return CheckCircleFilled_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const CheckCircleFilled_CheckCircleFilled = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], CheckCircleFilled_extends({}, props, {
ref: ref,
icon: asn_CheckCircleFilled
}));
/** */
const RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(CheckCircleFilled_CheckCircleFilled);
if (true) {
RefIcon.displayName = 'CheckCircleFilled';
}
/* harmony default export */ var icons_CheckCircleFilled = (RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/CloseCircleFilled.js
// This icon file is generated automatically.
var CloseCircleFilled = { "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" };
/* harmony default export */ var asn_CloseCircleFilled = (CloseCircleFilled);
;// ./node_modules/@ant-design/icons/es/icons/CloseCircleFilled.js
function CloseCircleFilled_extends() { CloseCircleFilled_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return CloseCircleFilled_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const CloseCircleFilled_CloseCircleFilled = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], CloseCircleFilled_extends({}, props, {
ref: ref,
icon: asn_CloseCircleFilled
}));
/** */
const CloseCircleFilled_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(CloseCircleFilled_CloseCircleFilled);
if (true) {
CloseCircleFilled_RefIcon.displayName = 'CloseCircleFilled';
}
/* harmony default export */ var icons_CloseCircleFilled = (CloseCircleFilled_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/CloseOutlined.js
// This icon file is generated automatically.
var CloseOutlined = { "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" };
/* harmony default export */ var asn_CloseOutlined = (CloseOutlined);
;// ./node_modules/@ant-design/icons/es/icons/CloseOutlined.js
function CloseOutlined_extends() { CloseOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return CloseOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const CloseOutlined_CloseOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], CloseOutlined_extends({}, props, {
ref: ref,
icon: asn_CloseOutlined
}));
/** */
const CloseOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(CloseOutlined_CloseOutlined);
if (true) {
CloseOutlined_RefIcon.displayName = 'CloseOutlined';
}
/* harmony default export */ var icons_CloseOutlined = (CloseOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/ExclamationCircleFilled.js
// This icon file is generated automatically.
var ExclamationCircleFilled = { "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" };
/* harmony default export */ var asn_ExclamationCircleFilled = (ExclamationCircleFilled);
;// ./node_modules/@ant-design/icons/es/icons/ExclamationCircleFilled.js
function ExclamationCircleFilled_extends() { ExclamationCircleFilled_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return ExclamationCircleFilled_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const ExclamationCircleFilled_ExclamationCircleFilled = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], ExclamationCircleFilled_extends({}, props, {
ref: ref,
icon: asn_ExclamationCircleFilled
}));
/** */
const ExclamationCircleFilled_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(ExclamationCircleFilled_ExclamationCircleFilled);
if (true) {
ExclamationCircleFilled_RefIcon.displayName = 'ExclamationCircleFilled';
}
/* harmony default export */ var icons_ExclamationCircleFilled = (ExclamationCircleFilled_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/InfoCircleFilled.js
// This icon file is generated automatically.
var InfoCircleFilled = { "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" };
/* harmony default export */ var asn_InfoCircleFilled = (InfoCircleFilled);
;// ./node_modules/@ant-design/icons/es/icons/InfoCircleFilled.js
function InfoCircleFilled_extends() { InfoCircleFilled_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return InfoCircleFilled_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const InfoCircleFilled_InfoCircleFilled = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], InfoCircleFilled_extends({}, props, {
ref: ref,
icon: asn_InfoCircleFilled
}));
/** */
const InfoCircleFilled_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(InfoCircleFilled_InfoCircleFilled);
if (true) {
InfoCircleFilled_RefIcon.displayName = 'InfoCircleFilled';
}
/* harmony default export */ var icons_InfoCircleFilled = (InfoCircleFilled_RefIcon);
// EXTERNAL MODULE: ./node_modules/@rc-component/motion/es/index.js + 12 modules
var motion_es = __webpack_require__("./node_modules/@rc-component/motion/es/index.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/pickAttrs.js
var pickAttrs = __webpack_require__("./node_modules/@rc-component/util/es/pickAttrs.js");
// EXTERNAL MODULE: ./components/_util/hooks/useMergeSemantic.ts
var useMergeSemantic = __webpack_require__("./components/_util/hooks/useMergeSemantic.ts");
// EXTERNAL MODULE: ./components/_util/is.ts
var is = __webpack_require__("./components/_util/is.ts");
// EXTERNAL MODULE: ./components/alert/style/index.ts
var alert_style = __webpack_require__("./components/alert/style/index.ts");
;// ./components/alert/Alert.tsx
const IconNode = props => {
const {
icon,
type,
className,
style,
successIcon,
infoIcon,
warningIcon,
errorIcon
} = props;
const iconMapFilled = {
success: successIcon ?? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CheckCircleFilled, null),
info: infoIcon ?? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_InfoCircleFilled, null),
error: errorIcon ?? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CloseCircleFilled, null),
warning: warningIcon ?? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_ExclamationCircleFilled, null)
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: className,
style: style
}, icon ?? iconMapFilled[type]);
};
const CloseIconNode = props => {
const {
isClosable,
prefixCls,
closeIcon,
handleClose,
ariaProps,
className,
style
} = props;
const mergedCloseIcon = closeIcon === true || closeIcon === undefined ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CloseOutlined, null) : closeIcon;
return isClosable ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
onClick: handleClose,
className: (0,clsx.clsx)(`${prefixCls}-close-icon`, className),
tabIndex: 0,
style: style,
...ariaProps
}, mergedCloseIcon)) : null;
};
const Alert = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
description,
prefixCls: customizePrefixCls,
message,
title,
banner,
className,
rootClassName,
style,
onMouseEnter,
onMouseLeave,
onClick,
afterClose,
showIcon,
closable,
closeText,
closeIcon,
action,
id,
styles,
classNames,
...otherProps
} = props;
const mergedTitle = title ?? message;
const [closed, setClosed] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
if (true) {
const warning = (0,_util_warning.devUseWarning)('Alert');
[['closeText', 'closable.closeIcon'], ['message', 'title']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
}
const internalRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
nativeElement: internalRef.current
}));
const {
getPrefixCls,
direction,
closable: contextClosable,
closeIcon: contextCloseIcon,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles,
successIcon,
infoIcon,
warningIcon,
errorIcon
} = (0,config_provider_context.useComponentConfig)('alert');
const prefixCls = getPrefixCls('alert', customizePrefixCls);
const [hashId, cssVarCls] = (0,alert_style["default"])(prefixCls);
const {
onClose: closableOnClose,
afterClose: closableAfterClose
} = (0,is.isPlainObject)(closable) ? closable : {};
const handleClose = e => {
setClosed(true);
(closableOnClose ?? props.onClose)?.(e);
};
const type = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (props.type !== undefined) {
return props.type;
}
// banner mode defaults to 'warning'
return banner ? 'warning' : 'info';
}, [props.type, banner]);
// closeable when closeText or closeIcon is assigned
const isClosable = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if ((0,is.isPlainObject)(closable) && closable.closeIcon) {
return true;
}
if (closeText) {
return true;
}
if (typeof closable === 'boolean') {
return closable;
}
// should be true when closeIcon is 0 or ''
if (closeIcon !== false && (0,is.isNonNullable)(closeIcon)) {
return true;
}
return !!contextClosable;
}, [closeText, closeIcon, closable, contextClosable]);
// banner mode defaults to Icon
const isShowIcon = banner && showIcon === undefined ? true : showIcon;
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
prefixCls,
type,
showIcon: isShowIcon,
closable: isClosable
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const alertCls = (0,clsx.clsx)(prefixCls, `${prefixCls}-${type}`, {
[`${prefixCls}-with-description`]: !!description,
[`${prefixCls}-no-icon`]: !isShowIcon,
[`${prefixCls}-banner`]: !!banner,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, contextClassName, className, rootClassName, mergedClassNames.root, cssVarCls, hashId);
const restProps = (0,pickAttrs["default"])(otherProps, {
aria: true,
data: true
});
const mergedCloseIcon = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if ((0,is.isPlainObject)(closable) && closable.closeIcon) {
return closable.closeIcon;
}
if (closeText) {
return closeText;
}
if (closeIcon !== undefined) {
return closeIcon;
}
if ((0,is.isPlainObject)(contextClosable) && contextClosable.closeIcon) {
return contextClosable.closeIcon;
}
return contextCloseIcon;
}, [closeIcon, closable, contextClosable, closeText, contextCloseIcon]);
const mergedAriaProps = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const merged = closable ?? contextClosable;
if ((0,is.isPlainObject)(merged)) {
return (0,pickAttrs["default"])(merged, {
data: true,
aria: true
});
}
return {};
}, [closable, contextClosable]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es["default"], {
visible: !closed,
motionName: `${prefixCls}-motion`,
motionAppear: false,
motionEnter: false,
onLeaveStart: node => ({
maxHeight: node.offsetHeight
}),
onLeaveEnd: closableAfterClose ?? afterClose
}, ({
className: motionClassName,
style: motionStyle
}, setRef) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
id: id,
ref: (0,es_ref.composeRef)(internalRef, setRef),
"data-show": !closed,
className: (0,clsx.clsx)(alertCls, motionClassName),
style: {
...mergedStyles.root,
...contextStyle,
...style,
...motionStyle
},
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
onClick: onClick,
role: "alert",
...restProps
}, isShowIcon ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(IconNode, {
className: (0,clsx.clsx)(`${prefixCls}-icon`, mergedClassNames.icon),
style: mergedStyles.icon,
description: description,
icon: props.icon,
prefixCls: prefixCls,
type: type,
successIcon: successIcon,
infoIcon: infoIcon,
warningIcon: warningIcon,
errorIcon: errorIcon
})) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-section`, mergedClassNames.section),
style: mergedStyles.section
}, mergedTitle ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-title`, mergedClassNames.title),
style: mergedStyles.title
}, mergedTitle)) : null, description ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-description`, mergedClassNames.description),
style: mergedStyles.description
}, description)) : null), action ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-actions`, mergedClassNames.actions),
style: mergedStyles.actions
}, action)) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(CloseIconNode, {
className: mergedClassNames.close,
style: mergedStyles.close,
isClosable: isClosable,
prefixCls: prefixCls,
closeIcon: mergedCloseIcon,
handleClose: handleClose,
ariaProps: mergedAriaProps
}))));
});
if (true) {
Alert.displayName = 'Alert';
}
/* harmony default export */ var alert_Alert = (Alert);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
var classCallCheck = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
var createClass = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/createClass.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
var getPrototypeOf = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js
var isNativeReflectConstruct = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
var possibleConstructorReturn = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js");
;// ./node_modules/@babel/runtime/helpers/esm/callSuper.js
function _callSuper(t, o, e) {
return o = (0,getPrototypeOf["default"])(o), (0,possibleConstructorReturn["default"])(t, (0,isNativeReflectConstruct["default"])() ? Reflect.construct(o, e || [], (0,getPrototypeOf["default"])(t).constructor) : o.apply(t, e));
}
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
var inherits = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/inherits.js");
;// ./components/alert/ErrorBoundary.tsx
let ErrorBoundary = /*#__PURE__*/function (_React$PureComponent) {
function ErrorBoundary() {
var _this;
(0,classCallCheck["default"])(this, ErrorBoundary);
_this = _callSuper(this, ErrorBoundary, arguments);
_this.state = {
error: undefined,
info: {}
};
return _this;
}
(0,inherits["default"])(ErrorBoundary, _React$PureComponent);
return (0,createClass["default"])(ErrorBoundary, [{
key: "componentDidCatch",
value: function componentDidCatch(error, info) {
this.setState({
error,
info
});
}
}, {
key: "render",
value: function render() {
const {
message,
title,
description,
id,
children
} = this.props;
const {
error,
info
} = this.state;
const mergedTitle = title ?? message;
const componentStack = info?.componentStack || null;
const errorMessage = (0,is.isNonNullable)(mergedTitle) ? mergedTitle : error?.toString();
const errorDescription = (0,is.isNonNullable)(description) ? description : componentStack;
if (error) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(alert_Alert, {
id: id,
type: "error",
title: errorMessage,
description: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("pre", {
style: {
fontSize: '0.9em',
overflowX: 'auto'
}
}, errorDescription)
});
}
return children;
}
}]);
}(external_root_React_commonjs2_react_commonjs_react_amd_react_.PureComponent);
/* harmony default export */ var alert_ErrorBoundary = (ErrorBoundary);
;// ./components/alert/index.tsx
const components_alert_Alert = alert_Alert;
components_alert_Alert.ErrorBoundary = alert_ErrorBoundary;
/* harmony default export */ var components_alert = (components_alert_Alert);
;// ./node_modules/compute-scroll-into-view/dist/index.js
const t=t=>"object"==typeof t&&null!=t&&1===t.nodeType,e=(t,e)=>(!e||"hidden"!==t)&&("visible"!==t&&"clip"!==t),n=(t,n)=>{if(t.clientHeight{const e=(t=>{if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}})(t);return!!e&&(e.clientHeightre||r>t&&i=e&&s>=n?r-t-o:i>e&&sn?i-e+l:0,l=t=>{const e=t.parentElement;return null==e?t.getRootNode().host||null:e},dist_r=(e,r)=>{var i,s,d,h;if("undefined"==typeof document)return[];const{scrollMode:c,block:f,inline:u,boundary:a,skipOverflowHiddenElements:g}=r,p="function"==typeof a?a:t=>t!==a;if(!t(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,w=[];let W=e;for(;t(W)&&p(W);){if(W=l(W),W===m){w.push(W);break}null!=W&&W===document.body&&n(W)&&!n(document.documentElement)||null!=W&&n(W,g)&&w.push(W)}const b=null!=(s=null==(i=window.visualViewport)?void 0:i.width)?s:innerWidth,H=null!=(h=null==(d=window.visualViewport)?void 0:d.height)?h:innerHeight,{scrollX:y,scrollY:M}=window,{height:v,width:E,top:x,right:C,bottom:I,left:R}=e.getBoundingClientRect(),{top:T,right:B,bottom:F,left:V}=(t=>{const e=window.getComputedStyle(t);return{top:parseFloat(e.scrollMarginTop)||0,right:parseFloat(e.scrollMarginRight)||0,bottom:parseFloat(e.scrollMarginBottom)||0,left:parseFloat(e.scrollMarginLeft)||0}})(e);let k="start"===f||"nearest"===f?x-T:"end"===f?I+F:x+v/2-T+F,D="center"===u?R+E/2-V+B:"end"===u?C+B:R-V;const L=[];for(let t=0;t=0&&R>=0&&I<=H&&C<=b&&(e===m&&!n(e)||x>=i&&I<=d&&R>=h&&C<=s))return L;const a=getComputedStyle(e),g=parseInt(a.borderLeftWidth,10),p=parseInt(a.borderTopWidth,10),W=parseInt(a.borderRightWidth,10),T=parseInt(a.borderBottomWidth,10);let B=0,F=0;const V="offsetWidth"in e?e.offsetWidth-e.clientWidth-g-W:0,S="offsetHeight"in e?e.offsetHeight-e.clientHeight-p-T:0,X="offsetWidth"in e?0===e.offsetWidth?0:r/e.offsetWidth:0,Y="offsetHeight"in e?0===e.offsetHeight?0:l/e.offsetHeight:0;if(m===e)B="start"===f?k:"end"===f?k-H:"nearest"===f?o(M,M+H,H,p,T,M+k,M+k+v,v):k-H/2,F="start"===u?D:"center"===u?D-b/2:"end"===u?D-b:o(y,y+b,b,g,W,y+D,y+D+E,E),B=Math.max(0,B+M),F=Math.max(0,F+y);else{B="start"===f?k-i-p:"end"===f?k-d+T+S:"nearest"===f?o(i,d,l,p,T+S,k,k+v,v):k-(i+l/2)+S/2,F="start"===u?D-h-g:"center"===u?D-(h+r/2)+V/2:"end"===u?D-s+W+V:o(h,s,r,g,W+V,D,D+E,E);const{scrollLeft:t,scrollTop:n}=e;B=0===Y?0:Math.max(0,Math.min(n+B/Y,e.scrollHeight-l/Y+S)),F=0===X?0:Math.max(0,Math.min(t+F/X,e.scrollWidth-r/X+V)),k+=n-B,D+=t-F}L.push({el:e,top:B,left:F})}return L};//# sourceMappingURL=index.js.map
;// ./node_modules/scroll-into-view-if-needed/dist/index.js
const dist_o=t=>!1===t?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&0!==Object.keys(t).length)(t)?t:{block:"start",inline:"nearest"};function dist_e(e,r){if(!e.isConnected||!(t=>{let o=t;for(;o&&o.parentNode;){if(o.parentNode===document)return!0;o=o.parentNode instanceof ShadowRoot?o.parentNode.host:o.parentNode}return!1})(e))return;const n=(t=>{const o=window.getComputedStyle(t);return{top:parseFloat(o.scrollMarginTop)||0,right:parseFloat(o.scrollMarginRight)||0,bottom:parseFloat(o.scrollMarginBottom)||0,left:parseFloat(o.scrollMarginLeft)||0}})(e);if((t=>"object"==typeof t&&"function"==typeof t.behavior)(r))return r.behavior(dist_r(e,r));const l="boolean"==typeof r||null==r?void 0:r.behavior;for(const{el:a,top:i,left:s}of dist_r(e,dist_o(r))){const t=i-n.top+n.bottom,o=s-n.left+n.right;a.scroll({top:t,left:o,behavior:l})}}//# sourceMappingURL=index.js.map
;// ./components/_util/getScroll.ts
const isWindow = obj => {
return (0,is.isNonNullable)(obj) && obj === obj.window;
};
const getScroll = target => {
if (typeof window === 'undefined') {
/* istanbul ignore next */
return 0;
}
let result = 0;
if (isWindow(target)) {
result = target.pageYOffset;
} else if (target instanceof Document) {
result = target.documentElement.scrollTop;
} else if (target instanceof HTMLElement) {
result = target.scrollTop;
} else if (target) {
// According to the type inference, the `target` is `never` type.
// Since we configured the loose mode type checking, and supports mocking the target with such shape below::
// `{ documentElement: { scrollLeft: 200, scrollTop: 400 } }`,
// the program may falls into this branch.
// Check the corresponding tests for details. Don't sure what is the real scenario this happens.
/* biome-ignore lint/complexity/useLiteralKeys: target is a never type */ /* eslint-disable-next-line dot-notation */
result = target['scrollTop'];
}
if (target && !isWindow(target) && typeof result !== 'number') {
result = (target.ownerDocument ?? target).documentElement?.scrollTop;
}
return result;
};
/* harmony default export */ var _util_getScroll = (getScroll);
;// ./components/_util/easings.ts
function easeInOutCubic(t, b, c, d) {
const cc = c - b;
t /= d / 2;
if (t < 1) {
return cc / 2 * t * t * t + b;
}
// biome-ignore lint: it is a common easing function
return cc / 2 * ((t -= 2) * t * t + 2) + b;
}
;// ./components/_util/scrollTo.ts
function scrollTo(y, options = {}) {
const {
getContainer = () => window,
callback,
duration = 450
} = options;
const container = getContainer();
const scrollTop = _util_getScroll(container);
const startTime = Date.now();
let rafId;
const frameFunc = () => {
const timestamp = Date.now();
const time = timestamp - startTime;
const nextScrollTop = easeInOutCubic(time > duration ? duration : time, scrollTop, y, duration);
if (isWindow(container)) {
container.scrollTo(window.pageXOffset, nextScrollTop);
} else if (container instanceof Document || container.constructor.name === 'HTMLDocument') {
container.documentElement.scrollTop = nextScrollTop;
} else {
container.scrollTop = nextScrollTop;
}
if (time < duration) {
rafId = (0,raf["default"])(frameFunc);
} else if (typeof callback === 'function') {
callback();
}
};
rafId = (0,raf["default"])(frameFunc);
return () => {
raf["default"].cancel(rafId);
};
}
;// ./components/config-provider/hooks/useCSSVarCls.ts
/**
* This hook is only for cssVar to add root className for components.
* If root ClassName is needed, this hook could be refactored with `-root`
* @param prefixCls
*/
const useCSSVarCls = prefixCls => `${prefixCls}-css-var`;
/* harmony default export */ var hooks_useCSSVarCls = (useCSSVarCls);
;// ./components/anchor/context.ts
const AnchorContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(undefined);
/* harmony default export */ var anchor_context = (AnchorContext);
;// ./components/anchor/AnchorLink.tsx
const AnchorLink = props => {
const {
href,
title,
prefixCls: customizePrefixCls,
children,
className,
target,
replace
} = props;
const context = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(anchor_context);
const {
registerLink,
unregisterLink,
scrollTo,
onClick,
activeLink,
direction,
classNames: mergedClassNames,
styles: mergedStyles
} = context || {};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
registerLink?.(href);
return () => {
unregisterLink?.(href);
};
}, [href]);
const handleClick = e => {
onClick?.(e, {
title,
href
});
scrollTo?.(href);
// Support clicking on an anchor does not record history.
if (e.defaultPrevented) {
return;
}
const isExternalLink = href.startsWith('http://') || href.startsWith('https://');
// Support external link
if (isExternalLink) {
if (replace) {
e.preventDefault();
window.location.replace(href);
}
return;
}
// Handling internal anchor link
e.preventDefault();
const historyMethod = replace ? 'replaceState' : 'pushState';
window.history[historyMethod](null, '', href);
};
// =================== Warning =====================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Anchor.Link');
true ? warning(!children || direction !== 'horizontal', 'usage', '`Anchor.Link children` is not supported when `Anchor` direction is horizontal') : 0;
}
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('anchor', customizePrefixCls);
const active = activeLink === href;
const wrapperClassName = (0,clsx.clsx)(`${prefixCls}-link`, className, mergedClassNames?.item, {
[`${prefixCls}-link-active`]: active
});
const titleClassName = (0,clsx.clsx)(`${prefixCls}-link-title`, mergedClassNames?.itemTitle, {
[`${prefixCls}-link-title-active`]: active
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: wrapperClassName,
style: mergedStyles?.item
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("a", {
className: titleClassName,
style: mergedStyles?.itemTitle,
href: href,
title: typeof title === 'string' ? title : '',
target: target,
onClick: handleClick
}, title), direction !== 'horizontal' ? children : null);
};
/* harmony default export */ var anchor_AnchorLink = (AnchorLink);
// EXTERNAL MODULE: ./components/anchor/style/index.ts
var anchor_style = __webpack_require__("./components/anchor/style/index.ts");
;// ./components/anchor/Anchor.tsx
function getDefaultContainer() {
return window;
}
function getOffsetTop(element, container) {
if (!element.getClientRects().length) {
return 0;
}
const rect = element.getBoundingClientRect();
if (rect.width || rect.height) {
if (container === window) {
return rect.top - element.ownerDocument.documentElement.clientTop;
}
return rect.top - container.getBoundingClientRect().top;
}
return rect.top;
}
const sharpMatcherRegex = /#([\S ]+)$/;
const Anchor = props => {
const {
rootClassName,
prefixCls: customPrefixCls,
className,
style,
offsetTop,
affix = true,
showInkInFixed = false,
children,
items,
direction: anchorDirection = 'vertical',
bounds,
targetOffset,
onClick,
onChange,
getContainer,
getCurrentAnchor,
replace,
classNames,
styles
} = props;
// =================== Warning =====================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Anchor');
warning.deprecated(!children, 'Anchor children', 'items');
true ? warning(!(anchorDirection === 'horizontal' && items?.some(n => 'children' in n)), 'usage', '`Anchor items#children` is not supported when `Anchor` direction is horizontal.') : 0;
}
const [links, setLinks] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([]);
const [activeLink, setActiveLink] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
const activeLinkRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(activeLink);
const wrapperRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const spanLinkNodeRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const animatingRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
const scrollRequestIdRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const {
direction,
getPrefixCls,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('anchor');
const {
getTargetContainer
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('anchor', customPrefixCls);
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,anchor_style["default"])(prefixCls, rootCls);
const getCurrentContainer = getContainer ?? getTargetContainer ?? getDefaultContainer;
const dependencyListItem = JSON.stringify(links);
const registerLink = (0,es.useEvent)(link => {
if (!links.includes(link)) {
setLinks(prev => [].concat((0,toConsumableArray["default"])(prev), [link]));
}
});
const unregisterLink = (0,es.useEvent)(link => {
if (links.includes(link)) {
setLinks(prev => prev.filter(i => i !== link));
}
});
const updateInk = () => {
const linkNode = wrapperRef.current?.querySelector(`.${prefixCls}-link-title-active`);
if (linkNode && spanLinkNodeRef.current) {
const {
style: inkStyle
} = spanLinkNodeRef.current;
const horizontalAnchor = anchorDirection === 'horizontal';
inkStyle.top = horizontalAnchor ? '' : `${linkNode.offsetTop + linkNode.clientHeight / 2}px`;
inkStyle.height = horizontalAnchor ? '' : `${linkNode.clientHeight}px`;
inkStyle.left = horizontalAnchor ? `${linkNode.offsetLeft}px` : '';
inkStyle.width = horizontalAnchor ? `${linkNode.clientWidth}px` : '';
if (horizontalAnchor) {
dist_e(linkNode, {
scrollMode: 'if-needed',
block: 'nearest'
});
}
}
};
const getInternalCurrentAnchor = (_links, _offsetTop = 0, _bounds = 5) => {
const linkSections = [];
const container = getCurrentContainer();
_links.forEach(link => {
const sharpLinkMatch = sharpMatcherRegex.exec(link?.toString());
if (!sharpLinkMatch) {
return;
}
const target = document.getElementById(sharpLinkMatch[1]);
if (target) {
const top = getOffsetTop(target, container);
if (top <= _offsetTop + _bounds) {
linkSections.push({
link,
top
});
}
}
});
if (linkSections.length) {
const maxSection = linkSections.reduce((prev, curr) => curr.top > prev.top ? curr : prev);
return maxSection.link;
}
return '';
};
const setCurrentActiveLink = (0,es.useEvent)(link => {
// FIXME: Seems a bug since this compare is not equals
// `activeLinkRef` is parsed value which will always trigger `onChange` event.
if (activeLinkRef.current === link) {
return;
}
// https://github.com/ant-design/ant-design/issues/30584
const newLink = typeof getCurrentAnchor === 'function' ? getCurrentAnchor(link) : link;
setActiveLink(newLink);
activeLinkRef.current = newLink;
// onChange should respect the original link (which may caused by
// window scroll or user click), not the new link
onChange?.(link);
});
const handleScroll = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(() => {
if (animatingRef.current) {
return;
}
const currentActiveLink = getInternalCurrentAnchor(links, targetOffset !== undefined ? targetOffset : offsetTop || 0, bounds);
setCurrentActiveLink(currentActiveLink);
}, [links, targetOffset, offsetTop, bounds]);
const handleScrollTo = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(link => {
const previousActiveLink = activeLinkRef.current;
setCurrentActiveLink(link);
const sharpLinkMatch = sharpMatcherRegex.exec(link);
if (!sharpLinkMatch) {
return;
}
const targetElement = document.getElementById(sharpLinkMatch[1]);
if (!targetElement) {
return;
}
if (animatingRef.current) {
if (previousActiveLink === link) {
return;
}
scrollRequestIdRef.current?.();
}
const container = getCurrentContainer();
const scrollTop = _util_getScroll(container);
const eleOffsetTop = getOffsetTop(targetElement, container);
let y = scrollTop + eleOffsetTop;
y -= targetOffset !== undefined ? targetOffset : offsetTop || 0;
animatingRef.current = true;
scrollRequestIdRef.current = scrollTo(y, {
getContainer: getCurrentContainer,
callback() {
animatingRef.current = false;
}
});
}, [targetOffset, offsetTop]);
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
direction: anchorDirection
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const wrapperClass = (0,clsx.clsx)(hashId, cssVarCls, rootCls, rootClassName, `${prefixCls}-wrapper`, {
[`${prefixCls}-wrapper-horizontal`]: anchorDirection === 'horizontal',
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, contextClassName, mergedClassNames.root);
const anchorClass = (0,clsx.clsx)(prefixCls, {
[`${prefixCls}-fixed`]: !affix && !showInkInFixed
});
const inkClass = (0,clsx.clsx)(`${prefixCls}-ink`, mergedClassNames.indicator, {
[`${prefixCls}-ink-visible`]: activeLink
});
const wrapperStyle = {
maxHeight: offsetTop ? `calc(100vh - ${offsetTop}px)` : '100vh',
...mergedStyles.root,
...contextStyle,
...style
};
const createNestedLink = options => Array.isArray(options) ? options.map(item => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(anchor_AnchorLink, {
replace: replace,
...item,
key: item.key
}, anchorDirection === 'vertical' && createNestedLink(item.children)))) : null;
const anchorContent = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: wrapperRef,
className: wrapperClass,
style: wrapperStyle
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: anchorClass
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: inkClass,
ref: spanLinkNodeRef,
style: mergedStyles.indicator
}), 'items' in props ? createNestedLink(items) : children));
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
const scrollContainer = getCurrentContainer();
handleScroll();
scrollContainer?.addEventListener('scroll', handleScroll);
return () => {
scrollContainer?.removeEventListener('scroll', handleScroll);
};
}, [dependencyListItem]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (typeof getCurrentAnchor === 'function') {
setCurrentActiveLink(getCurrentAnchor(activeLinkRef.current || ''));
}
}, [getCurrentAnchor]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
updateInk();
}, [anchorDirection, getCurrentAnchor, dependencyListItem, activeLink]);
const memoizedContextValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
registerLink,
unregisterLink,
scrollTo: handleScrollTo,
activeLink,
onClick,
direction: anchorDirection,
classNames: mergedClassNames,
styles: mergedStyles
}), [activeLink, onClick, handleScrollTo, anchorDirection, mergedStyles, mergedClassNames]);
const affixProps = (0,is.isPlainObject)(affix) ? affix : undefined;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(anchor_context.Provider, {
value: memoizedContextValue
}, affix ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_affix, {
offsetTop: offsetTop,
target: getCurrentContainer,
...affixProps
}, anchorContent)) : anchorContent);
};
if (true) {
Anchor.displayName = 'Anchor';
}
/* harmony default export */ var anchor_Anchor = (Anchor);
;// ./components/anchor/index.tsx
const components_anchor_Anchor = anchor_Anchor;
components_anchor_Anchor.Link = anchor_AnchorLink;
/* harmony default export */ var components_anchor = (components_anchor_Anchor);
// EXTERNAL MODULE: external {"root":"ReactDOM","commonjs2":"react-dom","commonjs":"react-dom","amd":"react-dom"}
var external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_ = __webpack_require__("react-dom");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/KeyCode.js
var KeyCode = __webpack_require__("./node_modules/@rc-component/util/es/KeyCode.js");
;// ./node_modules/@rc-component/notification/es/Notice.js
function Notice_extends() { Notice_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Notice_extends.apply(this, arguments); }
const Notify = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls,
style,
className,
duration = 4.5,
showProgress,
pauseOnHover = true,
eventKey,
content,
closable,
props: divProps,
onClick,
onNoticeClose,
times,
hovering: forcedHovering
} = props;
const [hovering, setHovering] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const [percent, setPercent] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const [spentTime, setSpentTime] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const mergedHovering = forcedHovering || hovering;
const mergedDuration = typeof duration === 'number' ? duration : 0;
const mergedShowProgress = mergedDuration > 0 && showProgress;
// ======================== Close =========================
const onInternalClose = () => {
onNoticeClose(eventKey);
};
const onCloseKeyDown = e => {
if (e.key === 'Enter' || e.code === 'Enter' || e.keyCode === KeyCode["default"].ENTER) {
onInternalClose();
}
};
// ======================== Effect ========================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (!mergedHovering && mergedDuration > 0) {
const start = Date.now() - spentTime;
const timeout = setTimeout(() => {
onInternalClose();
}, mergedDuration * 1000 - spentTime);
return () => {
if (pauseOnHover) {
clearTimeout(timeout);
}
setSpentTime(Date.now() - start);
};
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [mergedDuration, mergedHovering, times]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (!mergedHovering && mergedShowProgress && (pauseOnHover || spentTime === 0)) {
const start = performance.now();
let animationFrame;
const calculate = () => {
cancelAnimationFrame(animationFrame);
animationFrame = requestAnimationFrame(timestamp => {
const runtime = timestamp + spentTime - start;
const progress = Math.min(runtime / (mergedDuration * 1000), 1);
setPercent(progress * 100);
if (progress < 1) {
calculate();
}
});
};
calculate();
return () => {
if (pauseOnHover) {
cancelAnimationFrame(animationFrame);
}
};
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [mergedDuration, spentTime, mergedHovering, mergedShowProgress, times]);
// ======================== Closable ========================
const closableObj = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (typeof closable === 'object' && closable !== null) {
return closable;
}
return {};
}, [closable]);
const ariaProps = (0,pickAttrs["default"])(closableObj, true);
// ======================== Progress ========================
const validPercent = 100 - (!percent || percent < 0 ? 0 : percent > 100 ? 100 : percent);
// ======================== Render ========================
const noticePrefixCls = `${prefixCls}-notice`;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", Notice_extends({}, divProps, {
ref: ref,
className: (0,clsx.clsx)(noticePrefixCls, className, {
[`${noticePrefixCls}-closable`]: closable
}),
style: style,
onMouseEnter: e => {
setHovering(true);
divProps?.onMouseEnter?.(e);
},
onMouseLeave: e => {
setHovering(false);
divProps?.onMouseLeave?.(e);
},
onClick: onClick
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${noticePrefixCls}-content`
}, content), closable && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", Notice_extends({
className: `${noticePrefixCls}-close`,
onKeyDown: onCloseKeyDown,
"aria-label": "Close"
}, ariaProps, {
onClick: e => {
e.preventDefault();
e.stopPropagation();
onInternalClose();
}
}), closableObj.closeIcon ?? 'x'), mergedShowProgress && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("progress", {
className: `${noticePrefixCls}-progress`,
max: "100",
value: validPercent
}, validPercent + '%'));
});
/* harmony default export */ var Notice = (Notify);
;// ./node_modules/@rc-component/notification/es/NotificationProvider.js
const NotificationContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createContext({});
const NotificationProvider = ({
children,
classNames
}) => {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(NotificationContext.Provider, {
value: {
classNames
}
}, children);
};
/* harmony default export */ var es_NotificationProvider = (NotificationProvider);
;// ./node_modules/@rc-component/notification/es/hooks/useStack.js
const DEFAULT_OFFSET = 8;
const DEFAULT_THRESHOLD = 3;
const DEFAULT_GAP = 16;
const useStack = config => {
const result = {
offset: DEFAULT_OFFSET,
threshold: DEFAULT_THRESHOLD,
gap: DEFAULT_GAP
};
if (config && typeof config === 'object') {
result.offset = config.offset ?? DEFAULT_OFFSET;
result.threshold = config.threshold ?? DEFAULT_THRESHOLD;
result.gap = config.gap ?? DEFAULT_GAP;
}
return [!!config, result];
};
/* harmony default export */ var hooks_useStack = (useStack);
;// ./node_modules/@rc-component/notification/es/NoticeList.js
function NoticeList_extends() { NoticeList_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return NoticeList_extends.apply(this, arguments); }
const NoticeList = props => {
const {
configList,
placement,
prefixCls,
className,
style,
motion,
onAllNoticeRemoved,
onNoticeClose,
stack: stackConfig
} = props;
const {
classNames: ctxCls
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(NotificationContext);
const dictRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({});
const [latestNotice, setLatestNotice] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null);
const [hoverKeys, setHoverKeys] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]);
const keys = configList.map(config => ({
config,
key: String(config.key)
}));
const [stack, {
offset,
threshold,
gap
}] = hooks_useStack(stackConfig);
const expanded = stack && (hoverKeys.length > 0 || keys.length <= threshold);
const placementMotion = typeof motion === 'function' ? motion(placement) : motion;
// Clean hover key
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (stack && hoverKeys.length > 1) {
setHoverKeys(prev => prev.filter(key => keys.some(({
key: dataKey
}) => key === dataKey)));
}
}, [hoverKeys, keys, stack]);
// Force update latest notice
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (stack && dictRef.current[keys[keys.length - 1]?.key]) {
setLatestNotice(dictRef.current[keys[keys.length - 1]?.key]);
}
}, [keys, stack]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(motion_es.CSSMotionList, NoticeList_extends({
key: placement,
className: (0,clsx.clsx)(prefixCls, `${prefixCls}-${placement}`, ctxCls?.list, className, {
[`${prefixCls}-stack`]: !!stack,
[`${prefixCls}-stack-expanded`]: expanded
}),
style: style,
keys: keys,
motionAppear: true
}, placementMotion, {
onAllRemoved: () => {
onAllNoticeRemoved(placement);
}
}), ({
config,
className: motionClassName,
style: motionStyle,
index: motionIndex
}, nodeRef) => {
const {
key,
times
} = config;
const strKey = String(key);
const {
className: configClassName,
style: configStyle,
classNames: configClassNames,
styles: configStyles,
...restConfig
} = config;
const dataIndex = keys.findIndex(item => item.key === strKey);
// If dataIndex is -1, that means this notice has been removed in data, but still in dom
// Should minus (motionIndex - 1) to get the correct index because keys.length is not the same as dom length
const stackStyle = {};
if (stack) {
const index = keys.length - 1 - (dataIndex > -1 ? dataIndex : motionIndex - 1);
const transformX = placement === 'top' || placement === 'bottom' ? '-50%' : '0';
if (index > 0) {
stackStyle.height = expanded ? dictRef.current[strKey]?.offsetHeight : latestNotice?.offsetHeight;
// Transform
let verticalOffset = 0;
for (let i = 0; i < index; i++) {
verticalOffset += dictRef.current[keys[keys.length - 1 - i].key]?.offsetHeight + gap;
}
const transformY = (expanded ? verticalOffset : index * offset) * (placement.startsWith('top') ? 1 : -1);
const scaleX = !expanded && latestNotice?.offsetWidth && dictRef.current[strKey]?.offsetWidth ? (latestNotice?.offsetWidth - offset * 2 * (index < 3 ? index : 3)) / dictRef.current[strKey]?.offsetWidth : 1;
stackStyle.transform = `translate3d(${transformX}, ${transformY}px, 0) scaleX(${scaleX})`;
} else {
stackStyle.transform = `translate3d(${transformX}, 0, 0)`;
}
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
ref: nodeRef,
className: (0,clsx.clsx)(`${prefixCls}-notice-wrapper`, motionClassName, configClassNames?.wrapper),
style: {
...motionStyle,
...stackStyle,
...configStyles?.wrapper
},
onMouseEnter: () => setHoverKeys(prev => prev.includes(strKey) ? prev : [...prev, strKey]),
onMouseLeave: () => setHoverKeys(prev => prev.filter(k => k !== strKey))
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Notice, NoticeList_extends({}, restConfig, {
ref: node => {
if (dataIndex > -1) {
dictRef.current[strKey] = node;
} else {
delete dictRef.current[strKey];
}
},
prefixCls: prefixCls,
classNames: configClassNames,
styles: configStyles,
className: (0,clsx.clsx)(configClassName, ctxCls?.notice),
style: configStyle,
times: times,
key: key,
eventKey: key,
onNoticeClose: onNoticeClose,
hovering: stack && hoverKeys.length > 0
})));
});
};
if (true) {
NoticeList.displayName = 'NoticeList';
}
/* harmony default export */ var es_NoticeList = (NoticeList);
;// ./node_modules/@rc-component/notification/es/Notifications.js
// ant-notification ant-notification-topRight
const Notifications = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls = 'rc-notification',
container,
motion,
maxCount,
className,
style,
onAllRemoved,
stack,
renderNotifications
} = props;
const [configList, setConfigList] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([]);
// ======================== Close =========================
const onNoticeClose = key => {
// Trigger close event
const config = configList.find(item => item.key === key);
const closable = config?.closable;
const closableObj = closable && typeof closable === 'object' ? closable : {};
const {
onClose: closableOnClose
} = closableObj;
closableOnClose?.();
config?.onClose?.();
setConfigList(list => list.filter(item => item.key !== key));
};
// ========================= Refs =========================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
open: config => {
setConfigList(list => {
let clone = [...list];
// Replace if exist
const index = clone.findIndex(item => item.key === config.key);
const innerConfig = {
...config
};
if (index >= 0) {
innerConfig.times = (list[index]?.times || 0) + 1;
clone[index] = innerConfig;
} else {
innerConfig.times = 0;
clone.push(innerConfig);
}
if (maxCount > 0 && clone.length > maxCount) {
clone = clone.slice(-maxCount);
}
return clone;
});
},
close: key => {
onNoticeClose(key);
},
destroy: () => {
setConfigList([]);
}
}));
// ====================== Placements ======================
const [placements, setPlacements] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState({});
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
const nextPlacements = {};
configList.forEach(config => {
const {
placement = 'topRight'
} = config;
if (placement) {
nextPlacements[placement] = nextPlacements[placement] || [];
nextPlacements[placement].push(config);
}
});
// Fill exist placements to avoid empty list causing remove without motion
Object.keys(placements).forEach(placement => {
nextPlacements[placement] = nextPlacements[placement] || [];
});
setPlacements(nextPlacements);
}, [configList]);
// Clean up container if all notices fade out
const onAllNoticeRemoved = placement => {
setPlacements(originPlacements => {
const clone = {
...originPlacements
};
const list = clone[placement] || [];
if (!list.length) {
delete clone[placement];
}
return clone;
});
};
// Effect tell that placements is empty now
const emptyRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (Object.keys(placements).length > 0) {
emptyRef.current = true;
} else if (emptyRef.current) {
// Trigger only when from exist to empty
onAllRemoved?.();
emptyRef.current = false;
}
}, [placements]);
// ======================== Render ========================
if (!container) {
return null;
}
const placementList = Object.keys(placements);
return /*#__PURE__*/(0,external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_.createPortal)( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, placementList.map(placement => {
const placementConfigList = placements[placement];
const list = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_NoticeList, {
key: placement,
configList: placementConfigList,
placement: placement,
prefixCls: prefixCls,
className: className?.(placement),
style: style?.(placement),
motion: motion,
onNoticeClose: onNoticeClose,
onAllNoticeRemoved: onAllNoticeRemoved,
stack: stack
});
return renderNotifications ? renderNotifications(list, {
prefixCls,
key: placement
}) : list;
})), container);
});
if (true) {
Notifications.displayName = 'Notifications';
}
/* harmony default export */ var es_Notifications = (Notifications);
;// ./node_modules/@rc-component/notification/es/hooks/useNotification.js
const defaultGetContainer = () => document.body;
let uniqueKey = 0;
function mergeConfig(...objList) {
const clone = {};
objList.forEach(obj => {
if (obj) {
Object.keys(obj).forEach(key => {
const val = obj[key];
if (val !== undefined) {
clone[key] = val;
}
});
}
});
return clone;
}
function useNotification(rootConfig = {}) {
const {
getContainer = defaultGetContainer,
motion,
prefixCls,
maxCount,
className,
style,
onAllRemoved,
stack,
renderNotifications,
...shareConfig
} = rootConfig;
const [container, setContainer] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState();
const notificationsRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
const contextHolder = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Notifications, {
container: container,
ref: notificationsRef,
prefixCls: prefixCls,
motion: motion,
maxCount: maxCount,
className: className,
style: style,
onAllRemoved: onAllRemoved,
stack: stack,
renderNotifications: renderNotifications
});
const [taskQueue, setTaskQueue] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([]);
const open = (0,es.useEvent)(config => {
const mergedConfig = mergeConfig(shareConfig, config);
if (mergedConfig.key === null || mergedConfig.key === undefined) {
mergedConfig.key = `rc-notification-${uniqueKey}`;
uniqueKey += 1;
}
setTaskQueue(queue => [...queue, {
type: 'open',
config: mergedConfig
}]);
});
// ========================= Refs =========================
const api = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
open: open,
close: key => {
setTaskQueue(queue => [...queue, {
type: 'close',
key
}]);
},
destroy: () => {
setTaskQueue(queue => [...queue, {
type: 'destroy'
}]);
}
}), []);
// ======================= Container ======================
// React 18 should all in effect that we will check container in each render
// Which means getContainer should be stable.
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
setContainer(getContainer());
});
// ======================== Effect ========================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
// Flush task when node ready
if (notificationsRef.current && taskQueue.length) {
taskQueue.forEach(task => {
switch (task.type) {
case 'open':
notificationsRef.current.open(task.config);
break;
case 'close':
notificationsRef.current.close(task.key);
break;
case 'destroy':
notificationsRef.current.destroy();
break;
}
});
// https://github.com/ant-design/ant-design/issues/52590
// React `startTransition` will run once `useEffect` but many times `setState`,
// So `setTaskQueue` with filtered array will cause infinite loop.
// We cache the first match queue instead.
let oriTaskQueue;
let tgtTaskQueue;
// React 17 will mix order of effect & setState in async
// - open: setState[0]
// - effect[0]
// - open: setState[1]
// - effect setState([]) * here will clean up [0, 1] in React 17
setTaskQueue(oriQueue => {
if (oriTaskQueue !== oriQueue || !tgtTaskQueue) {
oriTaskQueue = oriQueue;
tgtTaskQueue = oriQueue.filter(task => !taskQueue.includes(task));
}
return tgtTaskQueue;
});
}
}, [taskQueue]);
// ======================== Return ========================
return [api, contextHolder];
}
;// ./node_modules/@rc-component/notification/es/index.js
;// ./node_modules/@ant-design/icons-svg/es/asn/LoadingOutlined.js
// This icon file is generated automatically.
var LoadingOutlined = { "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" };
/* harmony default export */ var asn_LoadingOutlined = (LoadingOutlined);
;// ./node_modules/@ant-design/icons/es/icons/LoadingOutlined.js
function LoadingOutlined_extends() { LoadingOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return LoadingOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const LoadingOutlined_LoadingOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], LoadingOutlined_extends({}, props, {
ref: ref,
icon: asn_LoadingOutlined
}));
/** */
const LoadingOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(LoadingOutlined_LoadingOutlined);
if (true) {
LoadingOutlined_RefIcon.displayName = 'LoadingOutlined';
}
/* harmony default export */ var icons_LoadingOutlined = (LoadingOutlined_RefIcon);
// EXTERNAL MODULE: ./components/_util/reactNode.ts
var reactNode = __webpack_require__("./components/_util/reactNode.ts");
// EXTERNAL MODULE: ./components/message/style/index.ts
var message_style = __webpack_require__("./components/message/style/index.ts");
;// ./components/message/PurePanel.tsx
const TypeIcon = {
info: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_InfoCircleFilled, null),
success: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CheckCircleFilled, null),
error: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CloseCircleFilled, null),
warning: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_ExclamationCircleFilled, null),
loading: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LoadingOutlined, null)
};
const PureContent = props => {
const {
prefixCls,
type,
icon,
children,
classNames: pureContentClassNames,
styles
} = props;
const iconElement = icon || type && TypeIcon[type];
const iconNode = (0,reactNode.cloneElement)(iconElement, currentProps => {
const mergedStyle = {
...currentProps?.style,
...styles?.icon
};
return {
className: (0,clsx.clsx)(currentProps.className, pureContentClassNames?.icon),
style: mergedStyle
};
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-custom-content`, `${prefixCls}-${type}`)
}, iconNode, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: pureContentClassNames?.content,
style: styles?.content
}, children));
};
/** @private Internal Component. Do not use in your production. */
const PurePanel = props => {
const {
prefixCls: staticPrefixCls,
className,
style,
type,
icon,
content,
classNames: messageClassNames,
styles,
...restProps
} = props;
const {
getPrefixCls,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('message');
const prefixCls = staticPrefixCls || getPrefixCls('message');
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,message_style["default"])(prefixCls, rootCls);
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, messageClassNames], [contextStyles, styles], {
props
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Notice, {
...restProps,
prefixCls: prefixCls,
className: (0,clsx.clsx)(contextClassName, mergedClassNames.root, className, hashId, `${prefixCls}-notice-pure-panel`, cssVarCls, rootCls),
style: {
...mergedStyles.root,
...contextStyle,
...style
},
eventKey: "pure",
duration: null,
content: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PureContent, {
prefixCls: prefixCls,
type: type,
icon: icon,
classNames: mergedClassNames,
styles: mergedStyles
}, content)
});
};
/* harmony default export */ var message_PurePanel = (PurePanel);
;// ./components/message/util.ts
function getMotion(prefixCls, transitionName) {
return {
motionName: transitionName ?? `${prefixCls}-move-up`
};
}
/** Wrap message open with promise like function */
function wrapPromiseFn(openFn) {
let closeFn;
const closePromise = new Promise(resolve => {
closeFn = openFn(() => {
resolve(true);
});
});
const result = () => {
closeFn?.();
};
result.then = (filled, rejected) => closePromise.then(filled, rejected);
result.promise = closePromise;
return result;
}
;// ./components/message/useMessage.tsx
const useMessage_DEFAULT_OFFSET = 8;
const DEFAULT_DURATION = 3;
const Wrapper = ({
children,
prefixCls
}) => {
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,message_style["default"])(prefixCls, rootCls);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_NotificationProvider, {
classNames: {
list: (0,clsx.clsx)(hashId, cssVarCls, rootCls)
}
}, children);
};
const renderNotifications = (node, {
prefixCls,
key
}) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Wrapper, {
prefixCls: prefixCls,
key: key
}, node));
const Holder = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
top,
prefixCls: staticPrefixCls,
getContainer: staticGetContainer,
maxCount,
duration = DEFAULT_DURATION,
rtl,
transitionName,
onAllRemoved,
pauseOnHover = true
} = props;
const {
getPrefixCls,
direction,
getPopupContainer
} = (0,config_provider_context.useComponentConfig)('message');
const {
message
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = staticPrefixCls || getPrefixCls('message');
// =============================== Style ===============================
const getStyle = () => ({
left: '50%',
transform: 'translateX(-50%)',
top: top ?? useMessage_DEFAULT_OFFSET
});
const getClassName = () => (0,clsx.clsx)({
[`${prefixCls}-rtl`]: rtl ?? direction === 'rtl'
});
// ============================== Motion ===============================
const getNotificationMotion = () => getMotion(prefixCls, transitionName);
// Use useMergeSemantic to merge classNames and styles
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([props?.classNames, message?.classNames], [props?.styles, message?.styles], {
props
});
// ============================== Origin ===============================
const [api, holder] = useNotification({
prefixCls,
style: getStyle,
className: getClassName,
motion: getNotificationMotion,
// closable=false requires-no closeIcon
closable: false,
duration,
getContainer: () => staticGetContainer?.() || getPopupContainer?.() || document.body,
maxCount,
onAllRemoved,
renderNotifications,
pauseOnHover
});
// ================================ Ref ================================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
...api,
prefixCls,
message,
classNames: mergedClassNames,
styles: mergedStyles
}));
return holder;
});
// ==============================================================================
// == Hook ==
// ==============================================================================
let keyIndex = 0;
function useInternalMessage(messageConfig) {
const holderRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const warning = (0,_util_warning.devUseWarning)('Message');
// ================================ API ================================
const wrapAPI = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
// Wrap with notification content
// >>> close
const close = key => {
holderRef.current?.close(key);
};
// >>> Open
const open = config => {
if (!holderRef.current) {
true ? warning(false, 'usage', 'You are calling notice in render which will break in React 18 concurrent mode. Please trigger in effect instead.') : 0;
const fakeResult = () => {};
fakeResult.then = () => {};
return fakeResult;
}
const {
open: originOpen,
prefixCls,
message,
classNames: originClassNames,
styles: originStyles
} = holderRef.current;
const contextClassName = message?.className || {};
const contextStyle = message?.style || {};
const rawContextClassNames = message?.classNames || {};
const rawContextStyles = message?.styles || {};
const noticePrefixCls = `${prefixCls}-notice`;
const {
content,
icon,
type,
key,
className,
style,
onClose,
classNames: configClassNames = {},
styles = {},
...restConfig
} = config;
let mergedKey = key;
if (!(0,is.isNonNullable)(mergedKey)) {
keyIndex += 1;
mergedKey = `antd-message-${keyIndex}`;
}
const contextConfig = {
...messageConfig,
...config
};
const contextClassNames = (0,useMergeSemantic.resolveStyleOrClass)(rawContextClassNames, {
props: contextConfig
});
const semanticClassNames = (0,useMergeSemantic.resolveStyleOrClass)(configClassNames, {
props: contextConfig
});
const contextStyles = (0,useMergeSemantic.resolveStyleOrClass)(rawContextStyles, {
props: contextConfig
});
const semanticStyles = (0,useMergeSemantic.resolveStyleOrClass)(styles, {
props: contextConfig
});
const mergedClassNames = (0,useMergeSemantic.mergeClassNames)(undefined, contextClassNames, semanticClassNames, originClassNames);
const mergedStyles = (0,useMergeSemantic.mergeStyles)(contextStyles, semanticStyles, originStyles);
return wrapPromiseFn(resolve => {
originOpen({
...restConfig,
key: mergedKey,
content: (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PureContent, {
prefixCls: prefixCls,
type: type,
icon: icon,
classNames: mergedClassNames,
styles: mergedStyles
}, content)),
placement: 'top',
className: (0,clsx.clsx)({
[`${noticePrefixCls}-${type}`]: type
}, className, contextClassName, mergedClassNames.root),
style: {
...mergedStyles.root,
...contextStyle,
...style
},
onClose: () => {
onClose?.();
resolve();
}
});
// Return close function
return () => {
close(mergedKey);
};
});
};
// >>> destroy
const destroy = key => {
if (key !== undefined) {
close(key);
} else {
holderRef.current?.destroy();
}
};
const clone = {
open,
destroy
};
const keys = ['info', 'success', 'warning', 'error', 'loading'];
keys.forEach(type => {
const typeOpen = (jointContent, duration, onClose) => {
let config;
if ((0,is.isPlainObject)(jointContent) && 'content' in jointContent) {
config = jointContent;
} else {
config = {
content: jointContent
};
}
// Params
let mergedDuration;
let mergedOnClose;
if (typeof duration === 'function') {
mergedOnClose = duration;
} else {
mergedDuration = duration;
mergedOnClose = onClose;
}
const mergedConfig = {
onClose: mergedOnClose,
duration: mergedDuration,
...config,
type
};
return open(mergedConfig);
};
clone[type] = typeOpen;
});
return clone;
}, []);
// ============================== Return ===============================
return [wrapAPI, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Holder, {
key: "message-holder",
...messageConfig,
ref: holderRef
})];
}
function useMessage(messageConfig) {
return useInternalMessage(messageConfig);
}
;// ./components/_util/hooks/usePatchElement.ts
const usePatchElement = () => {
const [elements, setElements] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([]);
const patchElement = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(element => {
// append a new element to elements (and create a new ref)
setElements(originElements => [].concat((0,toConsumableArray["default"])(originElements), [element]));
// return a function that removes the new element out of elements (and create a new ref)
// it works a little like useEffect
return () => {
setElements(originElements => originElements.filter(ele => ele !== element));
};
}, []);
return [elements, patchElement];
};
// EXTERNAL MODULE: ./node_modules/react-dom/client.js
var client = __webpack_require__("./node_modules/react-dom/client.js");
;// ./node_modules/@rc-component/util/es/React/render.js
const MARK = '__rc_react_root__';
// ========================== Render ==========================
function render(node, container) {
const root = container[MARK] || (0,client.createRoot)(container);
root.render(node);
container[MARK] = root;
}
// ========================= Unmount ==========================
async function unmount(container) {
// Delay to unmount to avoid React 18 sync warning
return Promise.resolve().then(() => {
container[MARK]?.unmount();
delete container[MARK];
});
}
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/components/Context.js
var Context = __webpack_require__("./node_modules/@ant-design/icons/es/components/Context.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/hooks/useMemo.js
var useMemo = __webpack_require__("./node_modules/@rc-component/util/es/hooks/useMemo.js");
;// ./components/form/validateMessagesContext.tsx
// ZombieJ: We export single file here since
// ConfigProvider use this which will make loop deps
// to import whole `rc-component/form`
/* harmony default export */ var validateMessagesContext = (/*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext)(undefined));
// EXTERNAL MODULE: ./components/locale/en_US.ts
var en_US = __webpack_require__("./components/locale/en_US.ts");
;// ./components/modal/locale.ts
let runtimeLocale = {
...en_US["default"].Modal
};
let localeList = [];
const generateLocale = () => localeList.reduce((merged, locale) => ({
...merged,
...locale
}), en_US["default"].Modal);
function changeConfirmLocale(newLocale) {
if (newLocale) {
const cloneLocale = {
...newLocale
};
localeList.push(cloneLocale);
runtimeLocale = generateLocale();
return () => {
localeList = localeList.filter(locale => locale !== cloneLocale);
runtimeLocale = generateLocale();
};
}
runtimeLocale = {
...en_US["default"].Modal
};
}
function getConfirmLocale() {
return runtimeLocale;
}
// EXTERNAL MODULE: ./components/locale/context.ts
var locale_context = __webpack_require__("./components/locale/context.ts");
;// ./components/locale/index.tsx
const ANT_MARK = 'internalMark';
const LocaleProvider = props => {
const {
locale = {},
children,
_ANT_MARK__
} = props;
if (true) {
const warning = (0,_util_warning.devUseWarning)('LocaleProvider');
true ? warning(_ANT_MARK__ === ANT_MARK, 'deprecated', '`LocaleProvider` is deprecated. Please use `locale` with `ConfigProvider` instead: http://u.ant.design/locale') : 0;
}
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
const clearLocale = changeConfirmLocale(locale?.Modal);
return clearLocale;
}, [locale]);
const getMemoizedContextValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
...locale,
exist: true
}), [locale]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(locale_context["default"].Provider, {
value: getMemoizedContextValue
}, children);
};
if (true) {
LocaleProvider.displayName = 'LocaleProvider';
}
/* harmony default export */ var components_locale = (LocaleProvider);
// EXTERNAL MODULE: ./components/theme/themes/default/theme.ts
var default_theme = __webpack_require__("./components/theme/themes/default/theme.ts");
// EXTERNAL MODULE: ./components/theme/context.ts
var context = __webpack_require__("./components/theme/context.ts");
// EXTERNAL MODULE: ./components/theme/themes/seed.ts
var seed = __webpack_require__("./components/theme/themes/seed.ts");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/Dom/canUseDom.js
var canUseDom = __webpack_require__("./node_modules/@rc-component/util/es/Dom/canUseDom.js");
;// ./node_modules/@rc-component/portal/es/Context.js
const OrderContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
/* harmony default export */ var es_Context = (OrderContext);
;// ./node_modules/@rc-component/portal/es/mock.js
let inline = false;
function inlineMock(nextInline) {
if (typeof nextInline === 'boolean') {
inline = nextInline;
}
return inline;
}
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/hooks/useLayoutEffect.js
var useLayoutEffect = __webpack_require__("./node_modules/@rc-component/util/es/hooks/useLayoutEffect.js");
;// ./node_modules/@rc-component/portal/es/useDom.js
const EMPTY_LIST = [];
/**
* Will add `div` to document. Nest call will keep order
* @param render Render DOM in document
*/
function useDom(render, debug) {
const [ele] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(() => {
if (!(0,canUseDom["default"])()) {
return null;
}
const defaultEle = document.createElement('div');
if ( true && debug) {
defaultEle.setAttribute('data-debug', debug);
}
return defaultEle;
});
// ========================== Order ==========================
const appendedRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
const queueCreate = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(es_Context);
const [queue, setQueue] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(EMPTY_LIST);
const mergedQueueCreate = queueCreate || (appendedRef.current ? undefined : appendFn => {
setQueue(origin => {
const newQueue = [appendFn, ...origin];
return newQueue;
});
});
// =========================== DOM ===========================
function append() {
if (!ele.parentElement) {
document.body.appendChild(ele);
}
appendedRef.current = true;
}
function cleanup() {
ele.parentElement?.removeChild(ele);
appendedRef.current = false;
}
(0,useLayoutEffect["default"])(() => {
if (render) {
if (queueCreate) {
queueCreate(append);
} else {
append();
}
} else {
cleanup();
}
return cleanup;
}, [render]);
(0,useLayoutEffect["default"])(() => {
if (queue.length) {
queue.forEach(appendFn => appendFn());
setQueue(EMPTY_LIST);
}
}, [queue]);
return [ele, mergedQueueCreate];
}
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/Dom/dynamicCSS.js
var dynamicCSS = __webpack_require__("./node_modules/@rc-component/util/es/Dom/dynamicCSS.js");
;// ./node_modules/@rc-component/util/es/getScrollBarSize.js
/* eslint-disable no-param-reassign */
let cached;
function measureScrollbarSize(ele) {
const randomId = `rc-scrollbar-measure-${Math.random().toString(36).substring(7)}`;
const measureEle = document.createElement('div');
measureEle.id = randomId;
// Create Style
const measureStyle = measureEle.style;
measureStyle.position = 'absolute';
measureStyle.left = '0';
measureStyle.top = '0';
measureStyle.width = '100px';
measureStyle.height = '100px';
measureStyle.overflow = 'scroll';
// Clone Style if needed
let fallbackWidth;
let fallbackHeight;
if (ele) {
const targetStyle = getComputedStyle(ele);
measureStyle.scrollbarColor = targetStyle.scrollbarColor;
measureStyle.scrollbarWidth = targetStyle.scrollbarWidth;
// Set Webkit style
const webkitScrollbarStyle = getComputedStyle(ele, '::-webkit-scrollbar');
const width = parseInt(webkitScrollbarStyle.width, 10);
const height = parseInt(webkitScrollbarStyle.height, 10);
// Try wrap to handle CSP case
try {
const widthStyle = width ? `width: ${webkitScrollbarStyle.width};` : '';
const heightStyle = height ? `height: ${webkitScrollbarStyle.height};` : '';
(0,dynamicCSS.updateCSS)(`
#${randomId}::-webkit-scrollbar {
${widthStyle}
${heightStyle}
}`, randomId);
} catch (e) {
// Can't wrap, just log error
console.error(e);
// Get from style directly
fallbackWidth = width;
fallbackHeight = height;
}
}
document.body.appendChild(measureEle);
// Measure. Get fallback style if provided
const scrollWidth = ele && fallbackWidth && !Number.isNaN(fallbackWidth) ? fallbackWidth : measureEle.offsetWidth - measureEle.clientWidth;
const scrollHeight = ele && fallbackHeight && !Number.isNaN(fallbackHeight) ? fallbackHeight : measureEle.offsetHeight - measureEle.clientHeight;
// Clean up
document.body.removeChild(measureEle);
(0,dynamicCSS.removeCSS)(randomId);
return {
width: scrollWidth,
height: scrollHeight
};
}
function getScrollBarSize(fresh) {
if (typeof document === 'undefined') {
return 0;
}
if (fresh || cached === undefined) {
cached = measureScrollbarSize();
}
return cached.width;
}
function getTargetScrollBarSize(target) {
if (typeof document === 'undefined' || !target || !(target instanceof Element)) {
return {
width: 0,
height: 0
};
}
return measureScrollbarSize(target);
}
;// ./node_modules/@rc-component/portal/es/util.js
/**
* Test usage export. Do not use in your production
*/
function isBodyOverflowing() {
return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth;
}
;// ./node_modules/@rc-component/portal/es/useScrollLocker.js
const UNIQUE_ID = `rc-util-locker-${Date.now()}`;
let uuid = 0;
function useScrollLocker(lock) {
const mergedLock = !!lock;
const [id] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(() => {
uuid += 1;
return `${UNIQUE_ID}_${uuid}`;
});
(0,useLayoutEffect["default"])(() => {
if (mergedLock) {
const scrollbarSize = getTargetScrollBarSize(document.body).width;
const isOverflow = isBodyOverflowing();
(0,dynamicCSS.updateCSS)(`
html body {
overflow-y: hidden;
${isOverflow ? `width: calc(100% - ${scrollbarSize}px);` : ''}
}`, id);
} else {
(0,dynamicCSS.removeCSS)(id);
}
return () => {
(0,dynamicCSS.removeCSS)(id);
};
}, [mergedLock, id]);
}
;// ./node_modules/@rc-component/util/es/hooks/useId.js
function getUseId() {
// We need fully clone React function here to avoid webpack warning React 17 do not export `useId`
const fullClone = {
...external_root_React_commonjs2_react_commonjs_react_amd_react_
};
return fullClone.useId;
}
let useId_uuid = 0;
/** @private Note only worked in develop env. Not work in production. */
function resetUuid() {
if (true) {
useId_uuid = 0;
}
}
/**
* Generate a valid HTML id from prefix and key.
* Sanitizes the key by replacing invalid characters with hyphens.
* @param prefix - The prefix for the id
* @param key - The key from React element, may contain spaces or invalid characters
* @returns A valid HTML id string
*/
function getId(prefix, key) {
// React.Key can be string | number, convert to string first
const keyStr = String(key);
// Valid id characters: letters, digits, hyphen, underscore, colon, period
// Replace all invalid characters (including spaces) with hyphens to preserve length
const sanitizedKey = keyStr.replace(/[^a-zA-Z0-9_.:-]/g, '-');
return `${prefix}-${sanitizedKey}`;
}
const useOriginId = getUseId();
/* harmony default export */ var useId = (useOriginId ?
// Use React `useId`
function useId(id) {
const reactId = useOriginId();
// Developer passed id is single source of truth
if (id) {
return id;
}
// Test env always return mock id
if (false) // removed by dead control flow
{}
return reactId;
} :
// Use compatible of `useId`
function useCompatId(id) {
// Inner id for accessibility usage. Only work in client side
const [innerId, setInnerId] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState('ssr-id');
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
const nextId = useId_uuid;
useId_uuid += 1;
setInnerId(`rc_unique_${nextId}`);
}, []);
// Developer passed id is single source of truth
if (id) {
return id;
}
// Test env always return mock id
if (false) // removed by dead control flow
{}
// Return react native id or inner id
return innerId;
});
;// ./node_modules/@rc-component/portal/es/useEscKeyDown.js
let stack = [];
const IME_LOCK_DURATION = 200;
let lastCompositionEndTime = 0;
// Export for testing
const _test = false ? 0 : null;
// Global event handlers
const onGlobalKeyDown = event => {
if (event.key === 'Escape' && !event.isComposing) {
const now = Date.now();
if (now - lastCompositionEndTime < IME_LOCK_DURATION) {
return;
}
const len = stack.length;
for (let i = len - 1; i >= 0; i -= 1) {
stack[i].onEsc({
top: i === len - 1,
event
});
}
}
};
const onGlobalCompositionEnd = () => {
lastCompositionEndTime = Date.now();
};
function attachGlobalEventListeners() {
window.addEventListener('keydown', onGlobalKeyDown);
window.addEventListener('compositionend', onGlobalCompositionEnd);
}
function detachGlobalEventListeners() {
if (stack.length === 0) {
window.removeEventListener('keydown', onGlobalKeyDown);
window.removeEventListener('compositionend', onGlobalCompositionEnd);
}
}
function useEscKeyDown(open, onEsc) {
const id = useId();
const onEventEsc = (0,es.useEvent)(onEsc);
const ensure = () => {
if (!stack.find(item => item.id === id)) {
stack.push({
id,
onEsc: onEventEsc
});
}
};
const clear = () => {
stack = stack.filter(item => item.id !== id);
};
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (open) {
ensure();
} else if (!open) {
clear();
}
}, [open]);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (open) {
ensure();
// Attach global event listeners
attachGlobalEventListeners();
return () => {
clear();
// Remove global event listeners if instances is empty
detachGlobalEventListeners();
};
}
}, [open]);
}
;// ./node_modules/@rc-component/portal/es/Portal.js
const getPortalContainer = getContainer => {
if (getContainer === false) {
return false;
}
if (!(0,canUseDom["default"])() || !getContainer) {
return null;
}
if (typeof getContainer === 'string') {
return document.querySelector(getContainer);
}
if (typeof getContainer === 'function') {
return getContainer();
}
return getContainer;
};
const Portal = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
open,
autoLock,
getContainer,
debug,
autoDestroy = true,
children,
onEsc
} = props;
const [shouldRender, setShouldRender] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(open);
const mergedRender = shouldRender || open;
// ========================= Warning =========================
if (true) {
(0,warning["default"])((0,canUseDom["default"])() || !open, `Portal only work in client side. Please call 'useEffect' to show Portal instead default render in SSR.`);
}
// ====================== Should Render ======================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (autoDestroy || open) {
setShouldRender(open);
}
}, [open, autoDestroy]);
// ======================== Container ========================
const [innerContainer, setInnerContainer] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(() => getPortalContainer(getContainer));
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
const customizeContainer = getPortalContainer(getContainer);
// Tell component that we check this in effect which is safe to be `null`
setInnerContainer(() =>
// React do the state update even the value is the same,
// Use function call to force React to compare update
customizeContainer ?? null);
});
const [defaultContainer, queueCreate] = useDom(mergedRender && !innerContainer, debug);
const mergedContainer = innerContainer ?? defaultContainer;
// ========================= Locker ==========================
useScrollLocker(autoLock && open && (0,canUseDom["default"])() && (mergedContainer === defaultContainer || mergedContainer === document.body));
// ========================= Esc Keydown ==========================
useEscKeyDown(open, onEsc);
// =========================== Ref ===========================
let childRef = null;
if (children && (0,es_ref.supportRef)(children) && ref) {
childRef = (0,es_ref.getNodeRef)(children);
}
const mergedRef = (0,es_ref.useComposeRef)(childRef, ref);
// ========================= Render ==========================
// Do not render when nothing need render
// When innerContainer is `undefined`, it may not ready since user use ref in the same render
if (!mergedRender || !(0,canUseDom["default"])() || innerContainer === undefined) {
return null;
}
// Render inline
const renderInline = mergedContainer === false || inlineMock();
let reffedChildren = children;
if (ref) {
reffedChildren = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement(children, {
ref: mergedRef
});
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Context.Provider, {
value: queueCreate
}, renderInline ? reffedChildren : /*#__PURE__*/(0,external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_.createPortal)(reffedChildren, mergedContainer));
});
if (true) {
Portal.displayName = 'Portal';
}
/* harmony default export */ var es_Portal = (Portal);
;// ./node_modules/@rc-component/portal/es/index.js
/* harmony default export */ var portal_es = (es_Portal);
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/Dom/shadow.js
var shadow = __webpack_require__("./node_modules/@rc-component/util/es/Dom/shadow.js");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/hooks/useEvent.js
var useEvent = __webpack_require__("./node_modules/@rc-component/util/es/hooks/useEvent.js");
;// ./node_modules/@rc-component/trigger/es/Popup/Arrow.js
function Arrow(props) {
const {
prefixCls,
align,
arrow,
arrowPos
} = props;
const {
className,
content,
style
} = arrow || {};
const {
x = 0,
y = 0
} = arrowPos;
const arrowRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
// Skip if no align
if (!align || !align.points) {
return null;
}
const alignStyle = {
position: 'absolute'
};
// Skip if no need to align
if (align.autoArrow !== false) {
const popupPoints = align.points[0];
const targetPoints = align.points[1];
const popupTB = popupPoints[0];
const popupLR = popupPoints[1];
const targetTB = targetPoints[0];
const targetLR = targetPoints[1];
// Top & Bottom
if (popupTB === targetTB || !['t', 'b'].includes(popupTB)) {
alignStyle.top = y;
} else if (popupTB === 't') {
alignStyle.top = 0;
} else {
alignStyle.bottom = 0;
}
// Left & Right
if (popupLR === targetLR || !['l', 'r'].includes(popupLR)) {
alignStyle.left = x;
} else if (popupLR === 'l') {
alignStyle.left = 0;
} else {
alignStyle.right = 0;
}
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: arrowRef,
className: (0,clsx.clsx)(`${prefixCls}-arrow`, className),
style: {
...alignStyle,
...style
}
}, content);
}
;// ./node_modules/@rc-component/trigger/es/Popup/Mask.js
function Mask_extends() { Mask_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Mask_extends.apply(this, arguments); }
function Mask(props) {
const {
prefixCls,
open,
zIndex,
mask,
motion,
mobile
} = props;
if (!mask) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es["default"], Mask_extends({}, motion, {
motionAppear: true,
visible: open,
removeOnLeave: true
}), ({
className
}) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
style: {
zIndex
},
className: (0,clsx.clsx)(`${prefixCls}-mask`, mobile && `${prefixCls}-mobile-mask`, className)
}));
}
;// ./node_modules/@rc-component/trigger/es/Popup/PopupContent.js
const PopupContent = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo(({
children
}) => children, (_, next) => next.cache);
if (true) {
PopupContent.displayName = 'PopupContent';
}
/* harmony default export */ var Popup_PopupContent = (PopupContent);
;// ./node_modules/@rc-component/trigger/es/hooks/useOffsetStyle.js
function useOffsetStyle(isMobile, ready, open, align, offsetR, offsetB, offsetX, offsetY) {
// >>>>> Offset
const AUTO = 'auto';
const offsetStyle = isMobile ? {} : {
left: '-1000vw',
top: '-1000vh',
right: AUTO,
bottom: AUTO
};
// Set align style
if (!isMobile && (ready || !open)) {
const {
points
} = align;
const dynamicInset = align.dynamicInset || align._experimental?.dynamicInset;
const alignRight = dynamicInset && points[0][1] === 'r';
const alignBottom = dynamicInset && points[0][0] === 'b';
if (alignRight) {
offsetStyle.right = offsetR;
offsetStyle.left = AUTO;
} else {
offsetStyle.left = offsetX;
offsetStyle.right = AUTO;
}
if (alignBottom) {
offsetStyle.bottom = offsetB;
offsetStyle.top = AUTO;
} else {
offsetStyle.top = offsetY;
offsetStyle.bottom = AUTO;
}
}
return offsetStyle;
}
;// ./node_modules/@rc-component/trigger/es/Popup/index.js
function Popup_extends() { Popup_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Popup_extends.apply(this, arguments); }
const Popup = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
onEsc,
popup,
className,
prefixCls,
style,
target,
onVisibleChanged,
// Open
open,
keepDom,
fresh,
// Click
onClick,
// Mask
mask,
// Arrow
arrow,
arrowPos,
align,
// Motion
motion,
maskMotion,
// Mobile
mobile,
// Portal
forceRender,
getPopupContainer,
autoDestroy,
portal: Portal,
children,
zIndex,
onMouseEnter,
onMouseLeave,
onPointerEnter,
onPointerDownCapture,
ready,
offsetX,
offsetY,
offsetR,
offsetB,
onAlign,
onPrepare,
// Resize
onResize,
stretch,
targetWidth,
targetHeight
} = props;
const popupContent = typeof popup === 'function' ? popup() : popup;
// We can not remove holder only when motion finished.
const isNodeVisible = open || keepDom;
// ========================= Mobile =========================
const isMobile = !!mobile;
// ========================== Mask ==========================
const [mergedMask, mergedMaskMotion, mergedPopupMotion] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (mobile) {
return [mobile.mask, mobile.maskMotion, mobile.motion];
}
return [mask, maskMotion, motion];
}, [mobile, mask, maskMotion, motion]);
// ======================= Container ========================
const getPopupContainerNeedParams = getPopupContainer?.length > 0;
const [show, setShow] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(!getPopupContainer || !getPopupContainerNeedParams);
// Delay to show since `getPopupContainer` need target element
(0,useLayoutEffect["default"])(() => {
if (!show && getPopupContainerNeedParams && target) {
setShow(true);
}
}, [show, getPopupContainerNeedParams, target]);
// ========================= Resize =========================
const onInternalResize = (0,es.useEvent)((size, ele) => {
onResize?.(size, ele);
onAlign();
});
// ========================= Styles =========================
const offsetStyle = useOffsetStyle(isMobile, ready, open, align, offsetR, offsetB, offsetX, offsetY);
// ========================= Render =========================
if (!show) {
return null;
}
// >>>>> Misc
const miscStyle = {};
if (stretch) {
if (stretch.includes('height') && targetHeight) {
miscStyle.height = targetHeight;
} else if (stretch.includes('minHeight') && targetHeight) {
miscStyle.minHeight = targetHeight;
}
if (stretch.includes('width') && targetWidth) {
miscStyle.width = targetWidth;
} else if (stretch.includes('minWidth') && targetWidth) {
miscStyle.minWidth = targetWidth;
}
}
if (!open) {
miscStyle.pointerEvents = 'none';
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Portal, {
open: forceRender || isNodeVisible,
getContainer: getPopupContainer && (() => getPopupContainer(target)),
autoDestroy: autoDestroy,
onEsc: onEsc
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Mask, {
prefixCls: prefixCls,
open: open,
zIndex: zIndex,
mask: mergedMask,
motion: mergedMaskMotion,
mobile: isMobile
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(resize_observer_es, {
onResize: onInternalResize,
disabled: !open
}, resizeObserverRef => {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es["default"], Popup_extends({
motionAppear: true,
motionEnter: true,
motionLeave: true,
removeOnLeave: false,
forceRender: forceRender,
leavedClassName: `${prefixCls}-hidden`
}, mergedPopupMotion, {
onAppearPrepare: onPrepare,
onEnterPrepare: onPrepare,
visible: open,
onVisibleChanged: nextVisible => {
motion?.onVisibleChanged?.(nextVisible);
onVisibleChanged(nextVisible);
}
}), ({
className: motionClassName,
style: motionStyle
}, motionRef) => {
const cls = (0,clsx.clsx)(prefixCls, motionClassName, className, {
[`${prefixCls}-mobile`]: isMobile
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: (0,es_ref.composeRef)(resizeObserverRef, ref, motionRef),
className: cls,
style: {
'--arrow-x': `${arrowPos.x || 0}px`,
'--arrow-y': `${arrowPos.y || 0}px`,
...offsetStyle,
...miscStyle,
...motionStyle,
boxSizing: 'border-box',
zIndex,
...style
},
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
onPointerEnter: onPointerEnter,
onClick: onClick,
onPointerDownCapture: onPointerDownCapture
}, arrow && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Arrow, {
prefixCls: prefixCls,
arrow: arrow,
arrowPos: arrowPos,
align: align
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Popup_PopupContent, {
cache: !open && !fresh
}, popupContent));
});
}), children);
});
if (true) {
Popup.displayName = 'Popup';
}
/* harmony default export */ var es_Popup = (Popup);
;// ./node_modules/@rc-component/trigger/es/context.js
// ===================== Nest =====================
const TriggerContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
/* harmony default export */ var es_context = (TriggerContext);
// ==================== Unique ====================
const UniqueContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
;// ./node_modules/@rc-component/trigger/es/hooks/useAction.js
function useAction_toArray(val) {
return val ? Array.isArray(val) ? val : [val] : [];
}
function useAction(action, showAction, hideAction) {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const mergedShowAction = useAction_toArray(showAction ?? action);
const mergedHideAction = useAction_toArray(hideAction ?? action);
const showActionSet = new Set(mergedShowAction);
const hideActionSet = new Set(mergedHideAction);
if (showActionSet.has('hover') && !showActionSet.has('click')) {
showActionSet.add('touch');
}
if (hideActionSet.has('hover') && !hideActionSet.has('click')) {
hideActionSet.add('touch');
}
return [showActionSet, hideActionSet];
}, [action, showAction, hideAction]);
}
;// ./node_modules/@rc-component/util/es/Dom/isVisible.js
/* harmony default export */ var isVisible = (element => {
if (!element) {
return false;
}
if (element instanceof Element) {
if (element.offsetParent) {
return true;
}
if (element.getBBox) {
const {
width,
height
} = element.getBBox();
if (width || height) {
return true;
}
}
if (element.getBoundingClientRect) {
const {
width,
height
} = element.getBoundingClientRect();
if (width || height) {
return true;
}
}
}
return false;
});
(Object.getOwnPropertyDescriptor(isVisible, "name") || {}).writable || Object.defineProperty(isVisible, "name", { value: "default", configurable: true });
;// ./node_modules/@rc-component/trigger/es/util.js
function isPointsEq(a1 = [], a2 = [], isAlignPoint) {
const getVal = (a, index) => a[index] || '';
if (isAlignPoint) {
return getVal(a1, 0) === getVal(a2, 0);
}
return getVal(a1, 0) === getVal(a2, 0) && getVal(a1, 1) === getVal(a2, 1);
}
function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {
const {
points
} = align;
const placements = Object.keys(builtinPlacements);
for (let i = 0; i < placements.length; i += 1) {
const placement = placements[i];
if (isPointsEq(builtinPlacements[placement]?.points, points, isAlignPoint)) {
return `${prefixCls}-placement-${placement}`;
}
}
return '';
}
function getWin(ele) {
return ele.ownerDocument.defaultView;
}
/**
* Get all the scrollable parent elements of the element
* @param ele The element to be detected
* @param areaOnly Only return the parent which will cut visible area
*/
function collectScroller(ele) {
const scrollerList = [];
let current = ele?.parentElement;
const scrollStyle = ['hidden', 'scroll', 'clip', 'auto'];
while (current) {
const {
overflowX,
overflowY,
overflow
} = getWin(current).getComputedStyle(current);
if ([overflowX, overflowY, overflow].some(o => scrollStyle.includes(o))) {
scrollerList.push(current);
}
current = current.parentElement;
}
return scrollerList;
}
function toNum(num, defaultValue = 1) {
return Number.isNaN(num) ? defaultValue : num;
}
function getPxValue(val) {
return toNum(parseFloat(val), 0);
}
/**
*
*
* **************************************
* * Border *
* * ************************** *
* * * * * *
* * B * * S * B *
* * o * * c * o *
* * r * Content * r * r *
* * d * * o * d *
* * e * * l * e *
* * r ******************** l * r *
* * * Scroll * *
* * ************************** *
* * Border *
* **************************************
*
*/
/**
* Get visible area of element
*/
function getVisibleArea(initArea, scrollerList) {
const visibleArea = {
...initArea
};
(scrollerList || []).forEach(ele => {
if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) {
return;
}
// Skip if static position which will not affect visible area
const {
overflow,
overflowClipMargin,
borderTopWidth,
borderBottomWidth,
borderLeftWidth,
borderRightWidth
} = getWin(ele).getComputedStyle(ele);
const eleRect = ele.getBoundingClientRect();
const {
offsetHeight: eleOutHeight,
clientHeight: eleInnerHeight,
offsetWidth: eleOutWidth,
clientWidth: eleInnerWidth
} = ele;
const borderTopNum = getPxValue(borderTopWidth);
const borderBottomNum = getPxValue(borderBottomWidth);
const borderLeftNum = getPxValue(borderLeftWidth);
const borderRightNum = getPxValue(borderRightWidth);
const scaleX = toNum(Math.round(eleRect.width / eleOutWidth * 1000) / 1000);
const scaleY = toNum(Math.round(eleRect.height / eleOutHeight * 1000) / 1000);
// Original visible area
const eleScrollWidth = (eleOutWidth - eleInnerWidth - borderLeftNum - borderRightNum) * scaleX;
const eleScrollHeight = (eleOutHeight - eleInnerHeight - borderTopNum - borderBottomNum) * scaleY;
// Cut border size
const scaledBorderTopWidth = borderTopNum * scaleY;
const scaledBorderBottomWidth = borderBottomNum * scaleY;
const scaledBorderLeftWidth = borderLeftNum * scaleX;
const scaledBorderRightWidth = borderRightNum * scaleX;
// Clip margin
let clipMarginWidth = 0;
let clipMarginHeight = 0;
if (overflow === 'clip') {
const clipNum = getPxValue(overflowClipMargin);
clipMarginWidth = clipNum * scaleX;
clipMarginHeight = clipNum * scaleY;
}
// Region
const eleLeft = eleRect.x + scaledBorderLeftWidth - clipMarginWidth;
const eleTop = eleRect.y + scaledBorderTopWidth - clipMarginHeight;
const eleRight = eleLeft + eleRect.width + 2 * clipMarginWidth - scaledBorderLeftWidth - scaledBorderRightWidth - eleScrollWidth;
const eleBottom = eleTop + eleRect.height + 2 * clipMarginHeight - scaledBorderTopWidth - scaledBorderBottomWidth - eleScrollHeight;
visibleArea.left = Math.max(visibleArea.left, eleLeft);
visibleArea.top = Math.max(visibleArea.top, eleTop);
visibleArea.right = Math.min(visibleArea.right, eleRight);
visibleArea.bottom = Math.min(visibleArea.bottom, eleBottom);
});
return visibleArea;
}
;// ./node_modules/@rc-component/trigger/es/hooks/useAlign.js
function getUnitOffset(size, offset = 0) {
const offsetStr = `${offset}`;
const cells = offsetStr.match(/^(.*)\%$/);
if (cells) {
return size * (parseFloat(cells[1]) / 100);
}
return parseFloat(offsetStr);
}
function getNumberOffset(rect, offset) {
const [offsetX, offsetY] = offset || [];
return [getUnitOffset(rect.width, offsetX), getUnitOffset(rect.height, offsetY)];
}
function splitPoints(points = '') {
return [points[0], points[1]];
}
function getAlignPoint(rect, points) {
const topBottom = points[0];
const leftRight = points[1];
let x;
let y;
// Top & Bottom
if (topBottom === 't') {
y = rect.y;
} else if (topBottom === 'b') {
y = rect.y + rect.height;
} else {
y = rect.y + rect.height / 2;
}
// Left & Right
if (leftRight === 'l') {
x = rect.x;
} else if (leftRight === 'r') {
x = rect.x + rect.width;
} else {
x = rect.x + rect.width / 2;
}
return {
x,
y
};
}
function reversePoints(points, index) {
const reverseMap = {
t: 'b',
b: 't',
l: 'r',
r: 'l'
};
const clone = [...points];
clone[index] = reverseMap[points[index]] || 'c';
return clone;
}
function flatPoints(points) {
return points.join('');
}
function useAlign(open, popupEle, target, placement, builtinPlacements, popupAlign, onPopupAlign, mobile) {
const [offsetInfo, setOffsetInfo] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState({
ready: false,
offsetX: 0,
offsetY: 0,
offsetR: 0,
offsetB: 0,
arrowX: 0,
arrowY: 0,
scaleX: 1,
scaleY: 1,
align: builtinPlacements[placement] || {}
});
const alignCountRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(0);
const scrollerList = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!popupEle || mobile) {
return [];
}
return collectScroller(popupEle);
}, [popupEle]);
// ========================= Flip ==========================
// We will memo flip info.
// If size change to make flip, it will memo the flip info and use it in next align.
const prevFlipRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({});
const resetFlipCache = () => {
prevFlipRef.current = {};
};
if (!open) {
resetFlipCache();
}
// ========================= Align =========================
const onAlign = (0,useEvent["default"])(() => {
if (popupEle && target && open && !mobile) {
const popupElement = popupEle;
const doc = popupElement.ownerDocument;
const win = getWin(popupElement);
const {
position: popupPosition
} = win.getComputedStyle(popupElement);
const originLeft = popupElement.style.left;
const originTop = popupElement.style.top;
const originRight = popupElement.style.right;
const originBottom = popupElement.style.bottom;
const originOverflow = popupElement.style.overflow;
// Placement
const placementInfo = {
...builtinPlacements[placement],
...popupAlign
};
// placeholder element
const placeholderElement = doc.createElement('div');
popupElement.parentElement?.appendChild(placeholderElement);
placeholderElement.style.left = `${popupElement.offsetLeft}px`;
placeholderElement.style.top = `${popupElement.offsetTop}px`;
placeholderElement.style.position = popupPosition;
placeholderElement.style.height = `${popupElement.offsetHeight}px`;
placeholderElement.style.width = `${popupElement.offsetWidth}px`;
// Reset first
popupElement.style.left = '0';
popupElement.style.top = '0';
popupElement.style.right = 'auto';
popupElement.style.bottom = 'auto';
popupElement.style.overflow = 'hidden';
// Calculate align style, we should consider `transform` case
let targetRect;
if (Array.isArray(target)) {
targetRect = {
x: target[0],
y: target[1],
width: 0,
height: 0
};
} else {
const rect = target.getBoundingClientRect();
rect.x = rect.x ?? rect.left;
rect.y = rect.y ?? rect.top;
targetRect = {
x: rect.x,
y: rect.y,
width: rect.width,
height: rect.height
};
}
const popupRect = popupElement.getBoundingClientRect();
const {
height,
width
} = win.getComputedStyle(popupElement);
popupRect.x = popupRect.x ?? popupRect.left;
popupRect.y = popupRect.y ?? popupRect.top;
const {
clientWidth,
clientHeight,
scrollWidth,
scrollHeight,
scrollTop,
scrollLeft
} = doc.documentElement;
const popupHeight = popupRect.height;
const popupWidth = popupRect.width;
const targetHeight = targetRect.height;
const targetWidth = targetRect.width;
// Get bounding of visible area
const visibleRegion = {
left: 0,
top: 0,
right: clientWidth,
bottom: clientHeight
};
const scrollRegion = {
left: -scrollLeft,
top: -scrollTop,
right: scrollWidth - scrollLeft,
bottom: scrollHeight - scrollTop
};
let {
htmlRegion
} = placementInfo;
const VISIBLE = 'visible';
const VISIBLE_FIRST = 'visibleFirst';
if (htmlRegion !== 'scroll' && htmlRegion !== VISIBLE_FIRST) {
htmlRegion = VISIBLE;
}
const isVisibleFirst = htmlRegion === VISIBLE_FIRST;
const scrollRegionArea = getVisibleArea(scrollRegion, scrollerList);
const visibleRegionArea = getVisibleArea(visibleRegion, scrollerList);
const visibleArea = htmlRegion === VISIBLE ? visibleRegionArea : scrollRegionArea;
// When set to `visibleFirst`,
// the check `adjust` logic will use `visibleRegion` for check first.
const adjustCheckVisibleArea = isVisibleFirst ? visibleRegionArea : visibleArea;
// Record right & bottom align data
popupElement.style.left = 'auto';
popupElement.style.top = 'auto';
popupElement.style.right = '0';
popupElement.style.bottom = '0';
const popupMirrorRect = popupElement.getBoundingClientRect();
// Reset back
popupElement.style.left = originLeft;
popupElement.style.top = originTop;
popupElement.style.right = originRight;
popupElement.style.bottom = originBottom;
popupElement.style.overflow = originOverflow;
popupElement.parentElement?.removeChild(placeholderElement);
// Calculate scale
const scaleX = toNum(Math.round(popupWidth / parseFloat(width) * 1000) / 1000);
const scaleY = toNum(Math.round(popupHeight / parseFloat(height) * 1000) / 1000);
// No need to align since it's not visible in view
if (scaleX === 0 || scaleY === 0 || (0,findDOMNode.isDOM)(target) && !isVisible(target)) {
return;
}
// Offset
const {
offset,
targetOffset
} = placementInfo;
let [popupOffsetX, popupOffsetY] = getNumberOffset(popupRect, offset);
const [targetOffsetX, targetOffsetY] = getNumberOffset(targetRect, targetOffset);
targetRect.x -= targetOffsetX;
targetRect.y -= targetOffsetY;
// Points
const [popupPoint, targetPoint] = placementInfo.points || [];
const targetPoints = splitPoints(targetPoint);
const popupPoints = splitPoints(popupPoint);
const targetAlignPoint = getAlignPoint(targetRect, targetPoints);
const popupAlignPoint = getAlignPoint(popupRect, popupPoints);
// Real align info may not same as origin one
const nextAlignInfo = {
...placementInfo
};
let nextPoints = [popupPoints, targetPoints];
// Next Offset
let nextOffsetX = targetAlignPoint.x - popupAlignPoint.x + popupOffsetX;
let nextOffsetY = targetAlignPoint.y - popupAlignPoint.y + popupOffsetY;
// ============== Intersection ===============
// Get area by position. Used for check if flip area is better
function getIntersectionVisibleArea(offsetX, offsetY, area = visibleArea) {
const l = popupRect.x + offsetX;
const t = popupRect.y + offsetY;
const r = l + popupWidth;
const b = t + popupHeight;
const visibleL = Math.max(l, area.left);
const visibleT = Math.max(t, area.top);
const visibleR = Math.min(r, area.right);
const visibleB = Math.min(b, area.bottom);
return Math.max(0, (visibleR - visibleL) * (visibleB - visibleT));
}
const originIntersectionVisibleArea = getIntersectionVisibleArea(nextOffsetX, nextOffsetY);
// As `visibleFirst`, we prepare this for check
const originIntersectionRecommendArea = getIntersectionVisibleArea(nextOffsetX, nextOffsetY, visibleRegionArea);
// ========================== Overflow ===========================
const targetAlignPointTL = getAlignPoint(targetRect, ['t', 'l']);
const popupAlignPointTL = getAlignPoint(popupRect, ['t', 'l']);
const targetAlignPointBR = getAlignPoint(targetRect, ['b', 'r']);
const popupAlignPointBR = getAlignPoint(popupRect, ['b', 'r']);
const overflow = placementInfo.overflow || {};
const {
adjustX,
adjustY,
shiftX,
shiftY
} = overflow;
const supportAdjust = val => {
if (typeof val === 'boolean') {
return val;
}
return val >= 0;
};
// Prepare position
let nextPopupY;
let nextPopupBottom;
let nextPopupX;
let nextPopupRight;
function syncNextPopupPosition() {
nextPopupY = popupRect.y + nextOffsetY;
nextPopupBottom = nextPopupY + popupHeight;
nextPopupX = popupRect.x + nextOffsetX;
nextPopupRight = nextPopupX + popupWidth;
}
syncNextPopupPosition();
// >>>>>>>>>> Top & Bottom
const needAdjustY = supportAdjust(adjustY);
const sameTB = popupPoints[0] === targetPoints[0];
// Bottom to Top
if (needAdjustY && popupPoints[0] === 't' && (nextPopupBottom > adjustCheckVisibleArea.bottom || prevFlipRef.current.bt)) {
let tmpNextOffsetY = nextOffsetY;
if (sameTB) {
tmpNextOffsetY -= popupHeight - targetHeight;
} else {
tmpNextOffsetY = targetAlignPointTL.y - popupAlignPointBR.y - popupOffsetY;
}
const newVisibleArea = getIntersectionVisibleArea(nextOffsetX, tmpNextOffsetY);
const newVisibleRecommendArea = getIntersectionVisibleArea(nextOffsetX, tmpNextOffsetY, visibleRegionArea);
if (
// Of course use larger one
newVisibleArea > originIntersectionVisibleArea || newVisibleArea === originIntersectionVisibleArea && (!isVisibleFirst ||
// Choose recommend one
newVisibleRecommendArea >= originIntersectionRecommendArea)) {
prevFlipRef.current.bt = true;
nextOffsetY = tmpNextOffsetY;
popupOffsetY = -popupOffsetY;
nextPoints = [reversePoints(nextPoints[0], 0), reversePoints(nextPoints[1], 0)];
} else {
prevFlipRef.current.bt = false;
}
}
// Top to Bottom
if (needAdjustY && popupPoints[0] === 'b' && (nextPopupY < adjustCheckVisibleArea.top || prevFlipRef.current.tb)) {
let tmpNextOffsetY = nextOffsetY;
if (sameTB) {
tmpNextOffsetY += popupHeight - targetHeight;
} else {
tmpNextOffsetY = targetAlignPointBR.y - popupAlignPointTL.y - popupOffsetY;
}
const newVisibleArea = getIntersectionVisibleArea(nextOffsetX, tmpNextOffsetY);
const newVisibleRecommendArea = getIntersectionVisibleArea(nextOffsetX, tmpNextOffsetY, visibleRegionArea);
if (
// Of course use larger one
newVisibleArea > originIntersectionVisibleArea || newVisibleArea === originIntersectionVisibleArea && (!isVisibleFirst ||
// Choose recommend one
newVisibleRecommendArea >= originIntersectionRecommendArea)) {
prevFlipRef.current.tb = true;
nextOffsetY = tmpNextOffsetY;
popupOffsetY = -popupOffsetY;
nextPoints = [reversePoints(nextPoints[0], 0), reversePoints(nextPoints[1], 0)];
} else {
prevFlipRef.current.tb = false;
}
}
// >>>>>>>>>> Left & Right
const needAdjustX = supportAdjust(adjustX);
// >>>>> Flip
const sameLR = popupPoints[1] === targetPoints[1];
// Right to Left
if (needAdjustX && popupPoints[1] === 'l' && (nextPopupRight > adjustCheckVisibleArea.right || prevFlipRef.current.rl)) {
let tmpNextOffsetX = nextOffsetX;
if (sameLR) {
tmpNextOffsetX -= popupWidth - targetWidth;
} else {
tmpNextOffsetX = targetAlignPointTL.x - popupAlignPointBR.x - popupOffsetX;
}
const newVisibleArea = getIntersectionVisibleArea(tmpNextOffsetX, nextOffsetY);
const newVisibleRecommendArea = getIntersectionVisibleArea(tmpNextOffsetX, nextOffsetY, visibleRegionArea);
if (
// Of course use larger one
newVisibleArea > originIntersectionVisibleArea || newVisibleArea === originIntersectionVisibleArea && (!isVisibleFirst ||
// Choose recommend one
newVisibleRecommendArea >= originIntersectionRecommendArea)) {
prevFlipRef.current.rl = true;
nextOffsetX = tmpNextOffsetX;
popupOffsetX = -popupOffsetX;
nextPoints = [reversePoints(nextPoints[0], 1), reversePoints(nextPoints[1], 1)];
} else {
prevFlipRef.current.rl = false;
}
}
// Left to Right
if (needAdjustX && popupPoints[1] === 'r' && (nextPopupX < adjustCheckVisibleArea.left || prevFlipRef.current.lr)) {
let tmpNextOffsetX = nextOffsetX;
if (sameLR) {
tmpNextOffsetX += popupWidth - targetWidth;
} else {
tmpNextOffsetX = targetAlignPointBR.x - popupAlignPointTL.x - popupOffsetX;
}
const newVisibleArea = getIntersectionVisibleArea(tmpNextOffsetX, nextOffsetY);
const newVisibleRecommendArea = getIntersectionVisibleArea(tmpNextOffsetX, nextOffsetY, visibleRegionArea);
if (
// Of course use larger one
newVisibleArea > originIntersectionVisibleArea || newVisibleArea === originIntersectionVisibleArea && (!isVisibleFirst ||
// Choose recommend one
newVisibleRecommendArea >= originIntersectionRecommendArea)) {
prevFlipRef.current.lr = true;
nextOffsetX = tmpNextOffsetX;
popupOffsetX = -popupOffsetX;
nextPoints = [reversePoints(nextPoints[0], 1), reversePoints(nextPoints[1], 1)];
} else {
prevFlipRef.current.lr = false;
}
}
nextAlignInfo.points = [flatPoints(nextPoints[0]), flatPoints(nextPoints[1])];
// ============================ Shift ============================
syncNextPopupPosition();
const numShiftX = shiftX === true ? 0 : shiftX;
if (typeof numShiftX === 'number') {
// Left
if (nextPopupX < visibleRegionArea.left) {
nextOffsetX -= nextPopupX - visibleRegionArea.left - popupOffsetX;
if (targetRect.x + targetWidth < visibleRegionArea.left + numShiftX) {
nextOffsetX += targetRect.x - visibleRegionArea.left + targetWidth - numShiftX;
}
}
// Right
if (nextPopupRight > visibleRegionArea.right) {
nextOffsetX -= nextPopupRight - visibleRegionArea.right - popupOffsetX;
if (targetRect.x > visibleRegionArea.right - numShiftX) {
nextOffsetX += targetRect.x - visibleRegionArea.right + numShiftX;
}
}
}
const numShiftY = shiftY === true ? 0 : shiftY;
if (typeof numShiftY === 'number') {
// Top
if (nextPopupY < visibleRegionArea.top) {
nextOffsetY -= nextPopupY - visibleRegionArea.top - popupOffsetY;
// When target if far away from visible area
// Stop shift
if (targetRect.y + targetHeight < visibleRegionArea.top + numShiftY) {
nextOffsetY += targetRect.y - visibleRegionArea.top + targetHeight - numShiftY;
}
}
// Bottom
if (nextPopupBottom > visibleRegionArea.bottom) {
nextOffsetY -= nextPopupBottom - visibleRegionArea.bottom - popupOffsetY;
if (targetRect.y > visibleRegionArea.bottom - numShiftY) {
nextOffsetY += targetRect.y - visibleRegionArea.bottom + numShiftY;
}
}
}
// ============================ Arrow ============================
// Arrow center align
const popupLeft = popupRect.x + nextOffsetX;
const popupRight = popupLeft + popupWidth;
const popupTop = popupRect.y + nextOffsetY;
const popupBottom = popupTop + popupHeight;
const targetLeft = targetRect.x;
const targetRight = targetLeft + targetWidth;
const targetTop = targetRect.y;
const targetBottom = targetTop + targetHeight;
/** Max left of the popup and target element */
const maxLeft = Math.max(popupLeft, targetLeft);
/** Min right of the popup and target element */
const minRight = Math.min(popupRight, targetRight);
/** The center X of popup & target cross area */
const xCenter = (maxLeft + minRight) / 2;
/** Arrow X of popup offset */
const nextArrowX = xCenter - popupLeft;
const maxTop = Math.max(popupTop, targetTop);
const minBottom = Math.min(popupBottom, targetBottom);
const yCenter = (maxTop + minBottom) / 2;
const nextArrowY = yCenter - popupTop;
onPopupAlign?.(popupEle, nextAlignInfo);
// Additional calculate right & bottom position
let offsetX4Right = popupMirrorRect.right - popupRect.x - (nextOffsetX + popupRect.width);
let offsetY4Bottom = popupMirrorRect.bottom - popupRect.y - (nextOffsetY + popupRect.height);
if (scaleX === 1) {
nextOffsetX = Math.floor(nextOffsetX);
offsetX4Right = Math.floor(offsetX4Right);
}
if (scaleY === 1) {
nextOffsetY = Math.floor(nextOffsetY);
offsetY4Bottom = Math.floor(offsetY4Bottom);
}
const nextOffsetInfo = {
ready: true,
offsetX: nextOffsetX / scaleX,
offsetY: nextOffsetY / scaleY,
offsetR: offsetX4Right / scaleX,
offsetB: offsetY4Bottom / scaleY,
arrowX: nextArrowX / scaleX,
arrowY: nextArrowY / scaleY,
scaleX,
scaleY,
align: nextAlignInfo
};
setOffsetInfo(nextOffsetInfo);
}
});
const triggerAlign = () => {
alignCountRef.current += 1;
const id = alignCountRef.current;
// Merge all align requirement into one frame
Promise.resolve().then(() => {
if (alignCountRef.current === id) {
onAlign();
}
});
};
// Reset ready status when placement & open changed
const resetReady = () => {
setOffsetInfo(ori => ({
...ori,
ready: false
}));
};
(0,useLayoutEffect["default"])(resetReady, [placement]);
(0,useLayoutEffect["default"])(() => {
if (!open) {
resetReady();
}
}, [open]);
return [offsetInfo.ready, offsetInfo.offsetX, offsetInfo.offsetY, offsetInfo.offsetR, offsetInfo.offsetB, offsetInfo.arrowX, offsetInfo.arrowY, offsetInfo.scaleX, offsetInfo.scaleY, offsetInfo.align, triggerAlign];
}
;// ./node_modules/@rc-component/trigger/es/hooks/useDelay.js
function useDelay() {
const delayRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const clearDelay = () => {
if (delayRef.current) {
clearTimeout(delayRef.current);
delayRef.current = null;
}
};
const delayInvoke = (callback, delay) => {
clearDelay();
if (delay === 0) {
callback();
} else {
delayRef.current = setTimeout(() => {
callback();
}, delay * 1000);
}
};
// Clean up on unmount
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
return () => {
clearDelay();
};
}, []);
return delayInvoke;
}
;// ./node_modules/@rc-component/trigger/es/hooks/useWatch.js
function useWatch(open, target, popup, onAlign, onScroll) {
(0,useLayoutEffect["default"])(() => {
if (open && target && popup) {
const targetElement = target;
const popupElement = popup;
const targetScrollList = collectScroller(targetElement);
const popupScrollList = collectScroller(popupElement);
const win = getWin(popupElement);
const mergedList = new Set([win, ...targetScrollList, ...popupScrollList]);
function notifyScroll() {
onAlign();
onScroll();
}
mergedList.forEach(scroller => {
scroller.addEventListener('scroll', notifyScroll, {
passive: true
});
});
win.addEventListener('resize', notifyScroll, {
passive: true
});
// First time always do align
onAlign();
return () => {
mergedList.forEach(scroller => {
scroller.removeEventListener('scroll', notifyScroll);
win.removeEventListener('resize', notifyScroll);
});
};
}
}, [open, target, popup]);
}
;// ./node_modules/@rc-component/trigger/es/hooks/useWinClick.js
/**
* Close if click on the window.
* Return the function that click on the Popup element.
*/
function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen) {
const openRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(open);
openRef.current = open;
const popupPointerDownRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
// Click to hide is special action since click popup element should not hide
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (clickToHide && popupEle && (!mask || maskClosable)) {
const onPointerDown = () => {
popupPointerDownRef.current = false;
};
const onTriggerClose = e => {
if (openRef.current && !inPopupOrChild(e.composedPath?.()?.[0] || e.target) && !popupPointerDownRef.current) {
triggerOpen(false);
}
};
const win = getWin(popupEle);
win.addEventListener('pointerdown', onPointerDown, true);
win.addEventListener('mousedown', onTriggerClose, true);
win.addEventListener('contextmenu', onTriggerClose, true);
// shadow root
const targetShadowRoot = (0,shadow.getShadowRoot)(targetEle);
if (targetShadowRoot) {
targetShadowRoot.addEventListener('mousedown', onTriggerClose, true);
targetShadowRoot.addEventListener('contextmenu', onTriggerClose, true);
}
// Warning if target and popup not in same root
if ( true && targetEle) {
const targetRoot = targetEle.getRootNode?.();
const popupRoot = popupEle.getRootNode?.();
(0,warning.warning)(targetRoot === popupRoot, `trigger element and popup element should in same shadow root.`);
}
return () => {
win.removeEventListener('pointerdown', onPointerDown, true);
win.removeEventListener('mousedown', onTriggerClose, true);
win.removeEventListener('contextmenu', onTriggerClose, true);
if (targetShadowRoot) {
targetShadowRoot.removeEventListener('mousedown', onTriggerClose, true);
targetShadowRoot.removeEventListener('contextmenu', onTriggerClose, true);
}
};
}
}, [clickToHide, targetEle, popupEle, mask, maskClosable]);
function onPopupPointerDown() {
popupPointerDownRef.current = true;
}
return onPopupPointerDown;
}
;// ./node_modules/@rc-component/trigger/es/UniqueProvider/useTargetState.js
/**
* Control the state of popup bind target:
* 1. When set `target`. Do show the popup.
* 2. When `target` is removed. Do hide the popup.
* 3. When `target` change to another one:
* a. We wait motion finish of previous popup.
* b. Then we set new target and show the popup.
* 4. During appear/enter animation, cache new options and apply after animation completes.
*/
function useTargetState() {
const [options, setOptions] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(null);
const [open, setOpen] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(false);
const [isAnimating, setIsAnimating] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(false);
const pendingOptionsRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
const trigger = (0,es.useEvent)(nextOptions => {
if (nextOptions === false) {
// Clear pending options when hiding
pendingOptionsRef.current = null;
setOpen(false);
} else {
if (isAnimating && open) {
// If animating (appear or enter), cache new options
pendingOptionsRef.current = nextOptions;
} else {
setOpen(true);
// Set new options
setOptions(nextOptions);
pendingOptionsRef.current = null;
// Only mark as animating when transitioning from closed to open
if (!open) {
setIsAnimating(true);
}
}
}
});
const onVisibleChanged = (0,es.useEvent)(visible => {
if (visible) {
// Animation enter completed, check if there are pending options
setIsAnimating(false);
if (pendingOptionsRef.current) {
// Apply pending options
setOptions(pendingOptionsRef.current);
pendingOptionsRef.current = null;
}
} else {
// Animation leave completed
setIsAnimating(false);
pendingOptionsRef.current = null;
}
});
return [trigger, open, options, onVisibleChanged];
}
;// ./node_modules/@rc-component/trigger/es/UniqueProvider/UniqueContainer.js
function UniqueContainer_extends() { UniqueContainer_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return UniqueContainer_extends.apply(this, arguments); }
const UniqueContainer = props => {
const {
prefixCls,
isMobile,
ready,
open,
align,
offsetR,
offsetB,
offsetX,
offsetY,
arrowPos,
popupSize,
motion,
uniqueContainerClassName,
uniqueContainerStyle
} = props;
const containerCls = `${prefixCls}-unique-container`;
const [motionVisible, setMotionVisible] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(false);
// ========================= Styles =========================
const offsetStyle = useOffsetStyle(isMobile, ready, open, align, offsetR, offsetB, offsetX, offsetY);
// Cache for offsetStyle when ready is true
const cachedOffsetStyleRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(offsetStyle);
// Update cached offset style when ready is true
if (ready) {
cachedOffsetStyleRef.current = offsetStyle;
}
// Apply popup size if available
const sizeStyle = {};
if (popupSize) {
sizeStyle.width = popupSize.width;
sizeStyle.height = popupSize.height;
}
// ========================= Render =========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(motion_es["default"], UniqueContainer_extends({
motionAppear: true,
motionEnter: true,
motionLeave: true,
removeOnLeave: false,
leavedClassName: `${containerCls}-hidden`
}, motion, {
visible: open,
onVisibleChanged: nextVisible => {
setMotionVisible(nextVisible);
}
}), ({
className: motionClassName,
style: motionStyle
}) => {
const cls = (0,clsx.clsx)(containerCls, motionClassName, uniqueContainerClassName, {
[`${containerCls}-visible`]: motionVisible
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: cls,
style: {
'--arrow-x': `${arrowPos?.x || 0}px`,
'--arrow-y': `${arrowPos?.y || 0}px`,
...cachedOffsetStyleRef.current,
...sizeStyle,
...motionStyle,
...uniqueContainerStyle
}
});
});
};
/* harmony default export */ var UniqueProvider_UniqueContainer = (UniqueContainer);
;// ./node_modules/@rc-component/trigger/es/UniqueProvider/index.js
const UniqueProvider = ({
children,
postTriggerProps
}) => {
const [trigger, open, options, onTargetVisibleChanged] = useTargetState();
// ========================== Options ===========================
const mergedOptions = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!options || !postTriggerProps) {
return options;
}
return postTriggerProps(options);
}, [options, postTriggerProps]);
// =========================== Popup ============================
const [popupEle, setPopupEle] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
const [popupSize, setPopupSize] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
// Used for forwardRef popup. Not use internal
const externalPopupRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const setPopupRef = (0,es.useEvent)(node => {
externalPopupRef.current = node;
if ((0,findDOMNode.isDOM)(node) && popupEle !== node) {
setPopupEle(node);
}
});
// ========================== Register ==========================
// Store the isOpen function from the latest show call
const isOpenRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const delayInvoke = useDelay();
const show = (0,es.useEvent)((showOptions, isOpen) => {
// Store the isOpen function for later use in hide
isOpenRef.current = isOpen;
delayInvoke(() => {
trigger(showOptions);
}, showOptions.delay);
});
const hide = delay => {
delayInvoke(() => {
// Check if we should still hide by calling the isOpen function
// If isOpen returns true, it means another trigger wants to keep it open
if (isOpenRef.current?.()) {
return; // Don't hide if something else wants it open
}
trigger(false);
// Don't clear target, currentNode, options immediately, wait until animation completes
}, delay);
};
// Callback after animation completes
const onVisibleChanged = (0,es.useEvent)(visible => {
// Call useTargetState callback to handle animation state
onTargetVisibleChanged(visible);
});
// =========================== Align ============================
const [ready, offsetX, offsetY, offsetR, offsetB, arrowX, arrowY,
// scaleX - not used in UniqueProvider
,,
// scaleY - not used in UniqueProvider
alignInfo, onAlign] = useAlign(open, popupEle, mergedOptions?.target, mergedOptions?.popupPlacement, mergedOptions?.builtinPlacements || {}, mergedOptions?.popupAlign, undefined,
// onPopupAlign
false // isMobile
);
const alignedClassName = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!mergedOptions) {
return '';
}
const baseClassName = getAlignPopupClassName(mergedOptions.builtinPlacements || {}, mergedOptions.prefixCls || '', alignInfo, false // alignPoint is false for UniqueProvider
);
return (0,clsx.clsx)(baseClassName, mergedOptions.getPopupClassNameFromAlign?.(alignInfo));
}, [alignInfo, mergedOptions?.getPopupClassNameFromAlign, mergedOptions?.builtinPlacements, mergedOptions?.prefixCls]);
const contextValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
show,
hide
}), []);
// =========================== Align ============================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
onAlign();
}, [mergedOptions?.target]);
// =========================== Motion ===========================
const onPrepare = (0,es.useEvent)(() => {
onAlign();
return Promise.resolve();
});
// ======================== Trigger Context =====================
const subPopupElements = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({});
const parentContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(es_context);
const triggerContextValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
registerSubPopup: (id, subPopupEle) => {
subPopupElements.current[id] = subPopupEle;
parentContext?.registerSubPopup(id, subPopupEle);
}
}), [parentContext]);
// =========================== Render ===========================
const prefixCls = mergedOptions?.prefixCls;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(UniqueContext.Provider, {
value: contextValue
}, children, mergedOptions && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_context.Provider, {
value: triggerContextValue
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Popup, {
ref: setPopupRef,
portal: portal_es,
onEsc: mergedOptions.onEsc,
prefixCls: prefixCls,
popup: mergedOptions.popup,
className: (0,clsx.clsx)(mergedOptions.popupClassName, alignedClassName, `${prefixCls}-unique-controlled`),
style: mergedOptions.popupStyle,
target: mergedOptions.target,
open: open,
keepDom: true,
fresh: true,
autoDestroy: false,
onVisibleChanged: onVisibleChanged,
ready: ready,
offsetX: offsetX,
offsetY: offsetY,
offsetR: offsetR,
offsetB: offsetB,
onAlign: onAlign,
onPrepare: onPrepare,
onResize: size => setPopupSize({
width: size.offsetWidth,
height: size.offsetHeight
}),
arrowPos: {
x: arrowX,
y: arrowY
},
align: alignInfo,
zIndex: mergedOptions.zIndex,
mask: mergedOptions.mask,
arrow: mergedOptions.arrow,
motion: mergedOptions.popupMotion,
maskMotion: mergedOptions.maskMotion,
getPopupContainer: mergedOptions.getPopupContainer
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(UniqueProvider_UniqueContainer, {
prefixCls: prefixCls,
isMobile: false,
ready: ready,
open: open,
align: alignInfo,
offsetR: offsetR,
offsetB: offsetB,
offsetX: offsetX,
offsetY: offsetY,
arrowPos: {
x: arrowX,
y: arrowY
},
popupSize: popupSize,
motion: mergedOptions.popupMotion,
uniqueContainerClassName: (0,clsx.clsx)(mergedOptions.uniqueContainerClassName, alignedClassName),
uniqueContainerStyle: mergedOptions.uniqueContainerStyle
}))));
};
/* harmony default export */ var es_UniqueProvider = (UniqueProvider);
;// ./node_modules/@rc-component/trigger/es/index.js
// Removed Props List
// Seems this can be auto
// getDocument?: (element?: HTMLElement) => Document;
// New version will not wrap popup with `rc-trigger-popup-content` when multiple children
function generateTrigger(PortalComponent = portal_es) {
const Trigger = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls = 'rc-trigger-popup',
children,
// Action
action = 'hover',
showAction,
hideAction,
// Open
popupVisible,
defaultPopupVisible,
onOpenChange,
afterOpenChange,
onPopupVisibleChange,
afterPopupVisibleChange,
// Delay
mouseEnterDelay,
mouseLeaveDelay = 0.1,
focusDelay,
blurDelay,
// Mask
mask,
maskClosable = true,
// Portal
getPopupContainer,
forceRender,
autoDestroy,
// Popup
popup,
popupClassName,
uniqueContainerClassName,
uniqueContainerStyle,
popupStyle,
popupPlacement,
builtinPlacements = {},
popupAlign,
zIndex,
stretch,
getPopupClassNameFromAlign,
fresh,
unique,
alignPoint,
onPopupClick,
onPopupAlign,
// Arrow
arrow,
// Motion
popupMotion,
maskMotion,
// Private
mobile,
...restProps
} = props;
const mergedAutoDestroy = autoDestroy || false;
const openUncontrolled = popupVisible === undefined;
// =========================== Mobile ===========================
const isMobile = !!mobile;
// ========================== Context ===========================
const subPopupElements = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({});
const parentContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(es_context);
const context = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
return {
registerSubPopup: (id, subPopupEle) => {
subPopupElements.current[id] = subPopupEle;
parentContext?.registerSubPopup(id, subPopupEle);
}
};
}, [parentContext]);
// ======================== UniqueContext =========================
const uniqueContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(UniqueContext);
// =========================== Popup ============================
const id = useId();
const [popupEle, setPopupEle] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
// Used for forwardRef popup. Not use internal
const externalPopupRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const setPopupRef = (0,useEvent["default"])(node => {
externalPopupRef.current = node;
if ((0,findDOMNode.isDOM)(node) && popupEle !== node) {
setPopupEle(node);
}
parentContext?.registerSubPopup(id, node);
});
// =========================== Target ===========================
// Use state to control here since `useRef` update not trigger render
const [targetEle, setTargetEle] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
// Used for forwardRef target. Not use internal
const externalForwardRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const setTargetRef = (0,useEvent["default"])(node => {
const domNode = (0,findDOMNode.getDOM)(node);
if ((0,findDOMNode.isDOM)(domNode) && targetEle !== domNode) {
setTargetEle(domNode);
externalForwardRef.current = domNode;
}
});
const cloneProps = {};
const inPopupOrChild = (0,useEvent["default"])(ele => {
const childDOM = targetEle;
return childDOM?.contains(ele) || (0,shadow.getShadowRoot)(childDOM)?.host === ele || ele === childDOM || popupEle?.contains(ele) || (0,shadow.getShadowRoot)(popupEle)?.host === ele || ele === popupEle || Object.values(subPopupElements.current).some(subPopupEle => subPopupEle?.contains(ele) || ele === subPopupEle);
});
// =========================== Arrow ============================
const innerArrow = arrow ? {
// true and Object likely
...(arrow !== true ? arrow : {})
} : null;
// ============================ Open ============================
const [internalOpen, setInternalOpen] = (0,es.useControlledState)(defaultPopupVisible || false, popupVisible);
const mergedOpen = internalOpen || false;
// ========================== Children ==========================
const child = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const nextChild = typeof children === 'function' ? children({
open: mergedOpen
}) : children;
return external_root_React_commonjs2_react_commonjs_react_amd_react_.Children.only(nextChild);
}, [children, mergedOpen]);
const originChildProps = child?.props || {};
// Support ref
const isOpen = (0,useEvent["default"])(() => mergedOpen);
// Extract common options for UniqueProvider
const getUniqueOptions = (0,useEvent["default"])((delay = 0) => ({
popup,
target: targetEle,
delay,
prefixCls,
popupClassName,
uniqueContainerClassName,
uniqueContainerStyle,
popupStyle,
popupPlacement,
builtinPlacements,
popupAlign,
zIndex,
mask,
maskClosable,
popupMotion,
maskMotion,
arrow: innerArrow,
getPopupContainer,
getPopupClassNameFromAlign,
id,
onEsc
}));
// Handle controlled state changes for UniqueProvider
// Only sync to UniqueProvider when it's controlled mode
// If there is a parentContext, don't call uniqueContext methods
(0,useLayoutEffect["default"])(() => {
if (uniqueContext && unique && targetEle && !openUncontrolled && !parentContext) {
if (mergedOpen) {
uniqueContext.show(getUniqueOptions(mouseEnterDelay), isOpen);
} else {
uniqueContext.hide(mouseLeaveDelay);
}
}
}, [mergedOpen, targetEle]);
const openRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(mergedOpen);
openRef.current = mergedOpen;
const internalTriggerOpen = (0,useEvent["default"])(nextOpen => {
(0,external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_.flushSync)(() => {
if (mergedOpen !== nextOpen) {
setInternalOpen(nextOpen);
onOpenChange?.(nextOpen);
onPopupVisibleChange?.(nextOpen);
}
});
});
// Trigger for delay
const delayInvoke = useDelay();
const triggerOpen = (nextOpen, delay = 0) => {
// If it's controlled mode, always use internal trigger logic
// UniqueProvider will be synced through useLayoutEffect
if (popupVisible !== undefined) {
delayInvoke(() => {
internalTriggerOpen(nextOpen);
}, delay);
return;
}
// If UniqueContext exists and not controlled, pass delay to Provider instead of handling it internally
// If there is a parentContext, don't call uniqueContext methods
if (uniqueContext && unique && openUncontrolled && !parentContext) {
if (nextOpen) {
uniqueContext.show(getUniqueOptions(delay), isOpen);
} else {
uniqueContext.hide(delay);
}
return;
}
delayInvoke(() => {
internalTriggerOpen(nextOpen);
}, delay);
};
function onEsc({
top
}) {
if (top) {
triggerOpen(false);
}
}
// ========================== Motion ============================
const [inMotion, setInMotion] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
(0,useLayoutEffect["default"])(firstMount => {
if (!firstMount || mergedOpen) {
setInMotion(true);
}
}, [mergedOpen]);
const [motionPrepareResolve, setMotionPrepareResolve] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
// =========================== Align ============================
const [mousePos, setMousePos] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
const setMousePosByEvent = event => {
setMousePos([event.clientX, event.clientY]);
};
const [ready, offsetX, offsetY, offsetR, offsetB, arrowX, arrowY, scaleX, scaleY, alignInfo, onAlign] = useAlign(mergedOpen, popupEle, alignPoint && mousePos !== null ? mousePos : targetEle, popupPlacement, builtinPlacements, popupAlign, onPopupAlign, isMobile);
const [showActions, hideActions] = useAction(action, showAction, hideAction);
const clickToShow = showActions.has('click');
const clickToHide = hideActions.has('click') || hideActions.has('contextMenu');
const triggerAlign = (0,useEvent["default"])(() => {
if (!inMotion) {
onAlign();
}
});
const onScroll = () => {
if (openRef.current && alignPoint && clickToHide) {
triggerOpen(false);
}
};
useWatch(mergedOpen, targetEle, popupEle, triggerAlign, onScroll);
(0,useLayoutEffect["default"])(() => {
triggerAlign();
}, [mousePos, popupPlacement]);
// When no builtinPlacements and popupAlign changed
(0,useLayoutEffect["default"])(() => {
if (mergedOpen && !builtinPlacements?.[popupPlacement]) {
triggerAlign();
}
}, [JSON.stringify(popupAlign)]);
const alignedClassName = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const baseClassName = getAlignPopupClassName(builtinPlacements, prefixCls, alignInfo, alignPoint);
return (0,clsx.clsx)(baseClassName, getPopupClassNameFromAlign?.(alignInfo));
}, [alignInfo, getPopupClassNameFromAlign, builtinPlacements, prefixCls, alignPoint]);
// ============================ Refs ============================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
nativeElement: externalForwardRef.current,
popupElement: externalPopupRef.current,
forceAlign: triggerAlign
}));
// ========================== Stretch ===========================
const [targetWidth, setTargetWidth] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const [targetHeight, setTargetHeight] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const syncTargetSize = () => {
if (stretch && targetEle) {
const rect = targetEle.getBoundingClientRect();
setTargetWidth(rect.width);
setTargetHeight(rect.height);
}
};
const onTargetResize = () => {
syncTargetSize();
triggerAlign();
};
// ========================== Motion ============================
const onVisibleChanged = visible => {
setInMotion(false);
onAlign();
afterOpenChange?.(visible);
afterPopupVisibleChange?.(visible);
};
// We will trigger align when motion is in prepare
const onPrepare = () => new Promise(resolve => {
syncTargetSize();
setMotionPrepareResolve(() => resolve);
});
(0,useLayoutEffect["default"])(() => {
if (motionPrepareResolve) {
onAlign();
motionPrepareResolve();
setMotionPrepareResolve(null);
}
}, [motionPrepareResolve]);
// =========================== Action ===========================
/**
* Util wrapper for trigger action
* @param eventName Listen event name
* @param nextOpen Next open state after trigger
* @param delay Delay to trigger open change
* @param callback Callback if current event need additional action
* @param ignoreCheck Ignore current event if check return true
*/
function wrapperAction(eventName, nextOpen, delay, callback, ignoreCheck) {
cloneProps[eventName] = (event, ...args) => {
if (!ignoreCheck || !ignoreCheck()) {
callback?.(event);
triggerOpen(nextOpen, delay);
}
// Pass to origin
originChildProps[eventName]?.(event, ...args);
};
}
// ======================= Action: Touch ========================
const touchToShow = showActions.has('touch');
const touchToHide = hideActions.has('touch');
/** Used for prevent `hover` event conflict with mobile env */
const touchedRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
if (touchToShow || touchToHide) {
cloneProps.onTouchStart = (...args) => {
touchedRef.current = true;
if (openRef.current && touchToHide) {
triggerOpen(false);
} else if (!openRef.current && touchToShow) {
triggerOpen(true);
}
// Pass to origin
originChildProps.onTouchStart?.(...args);
};
}
// ======================= Action: Click ========================
if (clickToShow || clickToHide) {
cloneProps.onClick = (event, ...args) => {
if (openRef.current && clickToHide) {
triggerOpen(false);
} else if (!openRef.current && clickToShow) {
setMousePosByEvent(event);
triggerOpen(true);
}
// Pass to origin
originChildProps.onClick?.(event, ...args);
touchedRef.current = false;
};
}
// Click to hide is special action since click popup element should not hide
const onPopupPointerDown = useWinClick(mergedOpen, clickToHide || touchToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen);
// ======================= Action: Hover ========================
const hoverToShow = showActions.has('hover');
const hoverToHide = hideActions.has('hover');
let onPopupMouseEnter;
let onPopupMouseLeave;
const ignoreMouseTrigger = () => {
return touchedRef.current;
};
if (hoverToShow) {
const onMouseEnterCallback = event => {
setMousePosByEvent(event);
};
// Compatible with old browser which not support pointer event
wrapperAction('onMouseEnter', true, mouseEnterDelay, onMouseEnterCallback, ignoreMouseTrigger);
wrapperAction('onPointerEnter', true, mouseEnterDelay, onMouseEnterCallback, ignoreMouseTrigger);
onPopupMouseEnter = event => {
// Only trigger re-open when popup is visible
if ((mergedOpen || inMotion) && popupEle?.contains(event.target)) {
triggerOpen(true, mouseEnterDelay);
}
};
// Align Point
if (alignPoint) {
cloneProps.onMouseMove = event => {
originChildProps.onMouseMove?.(event);
};
}
}
if (hoverToHide) {
wrapperAction('onMouseLeave', false, mouseLeaveDelay, undefined, ignoreMouseTrigger);
wrapperAction('onPointerLeave', false, mouseLeaveDelay, undefined, ignoreMouseTrigger);
onPopupMouseLeave = () => {
triggerOpen(false, mouseLeaveDelay);
};
}
// ======================= Action: Focus ========================
if (showActions.has('focus')) {
wrapperAction('onFocus', true, focusDelay);
}
if (hideActions.has('focus')) {
wrapperAction('onBlur', false, blurDelay);
}
// ==================== Action: ContextMenu =====================
if (showActions.has('contextMenu')) {
cloneProps.onContextMenu = (event, ...args) => {
if (openRef.current && hideActions.has('contextMenu')) {
triggerOpen(false);
} else {
setMousePosByEvent(event);
triggerOpen(true);
}
event.preventDefault();
// Pass to origin
originChildProps.onContextMenu?.(event, ...args);
};
}
// ============================ Perf ============================
const rendedRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
rendedRef.current ||= forceRender || mergedOpen || inMotion;
// =========================== Render ===========================
const mergedChildrenProps = {
...originChildProps,
...cloneProps
};
// Pass props into cloneProps for nest usage
const passedProps = {};
const passedEventList = ['onContextMenu', 'onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur'];
passedEventList.forEach(eventName => {
if (restProps[eventName]) {
passedProps[eventName] = (...args) => {
mergedChildrenProps[eventName]?.(...args);
restProps[eventName](...args);
};
}
});
const arrowPos = {
x: arrowX,
y: arrowY
};
// =================== Resize Observer ===================
// Use hook to observe target element resize
// Pass targetEle directly instead of a function so the hook will re-observe when target changes
useResizeObserver(mergedOpen, targetEle, onTargetResize);
// Compose refs
const mergedRef = (0,es_ref.useComposeRef)(setTargetRef, (0,es_ref.getNodeRef)(child));
// Child Node
const triggerNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement(child, {
...mergedChildrenProps,
...passedProps,
ref: mergedRef
});
// Render
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, triggerNode, rendedRef.current && (!uniqueContext || !unique) && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_context.Provider, {
value: context
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Popup, {
portal: PortalComponent,
ref: setPopupRef,
prefixCls: prefixCls,
popup: popup,
className: (0,clsx.clsx)(popupClassName, !isMobile && alignedClassName),
style: popupStyle,
target: targetEle,
onMouseEnter: onPopupMouseEnter,
onMouseLeave: onPopupMouseLeave
// https://github.com/ant-design/ant-design/issues/43924
,
onPointerEnter: onPopupMouseEnter,
zIndex: zIndex
// Open
,
open: mergedOpen,
keepDom: inMotion,
fresh: fresh
// Click
,
onClick: onPopupClick,
onPointerDownCapture: onPopupPointerDown
// Mask
,
mask: mask
// Motion
,
motion: popupMotion,
maskMotion: maskMotion,
onVisibleChanged: onVisibleChanged,
onPrepare: onPrepare
// Portal
,
forceRender: forceRender,
autoDestroy: mergedAutoDestroy,
getPopupContainer: getPopupContainer,
onEsc: onEsc
// Arrow
,
align: alignInfo,
arrow: innerArrow,
arrowPos: arrowPos
// Align
,
ready: ready,
offsetX: offsetX,
offsetY: offsetY,
offsetR: offsetR,
offsetB: offsetB,
onAlign: triggerAlign
// Stretch
,
stretch: stretch,
targetWidth: targetWidth / scaleX,
targetHeight: targetHeight / scaleY
// Mobile
,
mobile: mobile
})));
});
if (true) {
Trigger.displayName = 'Trigger';
}
return Trigger;
}
/* harmony default export */ var trigger_es = (generateTrigger(portal_es));
;// ./components/tooltip/UniqueProvider/MotionContent.tsx
const MotionContent = ({
children
}) => {
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(config_provider_context.ConfigContext);
const rootPrefixCls = getPrefixCls();
// This will never reach since we will not render this when no children
/* istanbul ignore next */
if (! /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(children)) {
return children;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(motion_es["default"], {
visible: true,
motionName: `${rootPrefixCls}-fade`,
motionAppear: true,
motionEnter: true,
motionLeave: false,
removeOnLeave: false
}, ({
style: motionStyle,
className: motionClassName
}) => {
return (0,reactNode.cloneElement)(children, oriProps => ({
className: (0,clsx.clsx)(oriProps.className, motionClassName),
style: {
...oriProps.style,
...motionStyle
}
}));
});
};
/* harmony default export */ var UniqueProvider_MotionContent = (MotionContent);
;// ./components/tooltip/UniqueProvider/index.tsx
const cachedPlacements = [null, null];
function uniqueBuiltinPlacements(ori) {
if (cachedPlacements[0] !== ori) {
const target = {};
Object.keys(ori).forEach(placement => {
target[placement] = {
...ori[placement],
dynamicInset: false
};
});
cachedPlacements[0] = ori;
cachedPlacements[1] = target;
}
return cachedPlacements[1];
}
const UniqueProvider_UniqueProvider = ({
children
}) => {
const renderPopup = options => {
const {
id,
builtinPlacements,
popup
} = options;
const popupEle = typeof popup === 'function' ? popup() : popup;
const parsedPlacements = uniqueBuiltinPlacements(builtinPlacements);
return {
...options,
getPopupContainer: null,
arrow: false,
popup: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(UniqueProvider_MotionContent, {
key: id
}, popupEle),
builtinPlacements: parsedPlacements
};
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_UniqueProvider, {
postTriggerProps: renderPopup
}, children);
};
/* harmony default export */ var tooltip_UniqueProvider = (UniqueProvider_UniqueProvider);
;// ./components/config-provider/DisabledContext.tsx
const DisabledContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(false);
const DisabledContextProvider = ({
children,
disabled
}) => {
const originDisabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(DisabledContext);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(DisabledContext.Provider, {
value: disabled ?? originDisabled
}, children);
};
/* harmony default export */ var config_provider_DisabledContext = (DisabledContext);
// EXTERNAL MODULE: ./components/config-provider/SizeContext.tsx
var SizeContext = __webpack_require__("./components/config-provider/SizeContext.tsx");
;// ./components/config-provider/hooks/useConfig.ts
function useConfig() {
const componentDisabled = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(config_provider_DisabledContext);
const componentSize = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(SizeContext["default"]);
return {
componentDisabled,
componentSize
};
}
/* harmony default export */ var hooks_useConfig = (useConfig);
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/isEqual.js
var isEqual = __webpack_require__("./node_modules/@rc-component/util/es/isEqual.js");
;// ./components/config-provider/hooks/useTheme.ts
function useTheme(theme, parentTheme, config) {
const warning = (0,_util_warning.devUseWarning)('ConfigProvider');
const themeConfig = theme || {};
const parentThemeConfig = themeConfig.inherit === false || !parentTheme ? {
...context.defaultConfig,
hashed: parentTheme?.hashed ?? context.defaultConfig.hashed,
cssVar: parentTheme?.cssVar
} : parentTheme;
// Generate a unique key for cssVar
const themeKey = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useId)();
if (true) {
const cssVarEnabled = themeConfig.cssVar || parentThemeConfig.cssVar;
const validKey = !!((0,is.isPlainObject)(themeConfig.cssVar) && themeConfig.cssVar?.key || themeKey);
true ? warning(!cssVarEnabled || validKey, 'breaking', 'Missing key in `cssVar` config. Please upgrade to React 18 or set `cssVar.key` manually in each ConfigProvider inside `cssVar` enabled ConfigProvider.') : 0;
}
return (0,useMemo["default"])(() => {
if (!theme) {
return parentTheme;
}
// Override
const mergedComponents = {
...parentThemeConfig.components
};
Object.keys(theme.components || {}).forEach(componentName => {
mergedComponents[componentName] = {
...mergedComponents[componentName],
...theme.components[componentName]
};
});
const cssVarKey = `css-var-${themeKey.replace(/:/g, '')}`;
const mergedCssVar = {
prefix: config?.prefixCls,
// Same as prefixCls by default
...parentThemeConfig.cssVar,
...themeConfig.cssVar,
key: themeConfig.cssVar?.key || cssVarKey
};
// Base token
return {
...parentThemeConfig,
...themeConfig,
token: {
...parentThemeConfig.token,
...themeConfig.token
},
components: mergedComponents,
cssVar: mergedCssVar
};
}, [themeConfig, parentThemeConfig], (prev, next) => prev.some((prevTheme, index) => {
const nextTheme = next[index];
return !(0,isEqual["default"])(prevTheme, nextTheme, true);
}));
}
// EXTERNAL MODULE: ./components/theme/useToken.ts
var useToken = __webpack_require__("./components/theme/useToken.ts");
;// ./components/config-provider/MotionWrapper.tsx
const MotionCacheContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(true);
if (true) {
MotionCacheContext.displayName = 'MotionCacheContext';
}
function MotionWrapper(props) {
const parentMotion = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(MotionCacheContext);
const {
children
} = props;
const [, token] = (0,useToken["default"])();
const {
motion
} = token;
const needWrapMotionProviderRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
needWrapMotionProviderRef.current || (needWrapMotionProviderRef.current = parentMotion !== motion);
if (needWrapMotionProviderRef.current) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(MotionCacheContext.Provider, {
value: motion
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es.Provider, {
motion: motion
}, children));
}
return children;
}
;// ./components/config-provider/PropWarning.tsx
/**
* Warning for ConfigProviderProps.
* This will be empty function in production.
*/
const PropWarning = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo(props => {
const {
dropdownMatchSelectWidth
} = props;
const warning = (0,_util_warning.devUseWarning)('ConfigProvider');
warning.deprecated(dropdownMatchSelectWidth === undefined, 'dropdownMatchSelectWidth', 'popupMatchSelectWidth');
return null;
});
if (true) {
PropWarning.displayName = 'PropWarning';
}
/* harmony default export */ var config_provider_PropWarning = ( true ? PropWarning : 0);
// EXTERNAL MODULE: ./components/theme/util/useResetIconStyle.ts
var useResetIconStyle = __webpack_require__("./components/theme/util/useResetIconStyle.ts");
;// ./components/config-provider/index.tsx
/**
* This component registers icon styles inside the DesignTokenContext.Provider
* so that CSS variables use the correct cssVar key from the theme config.
*/
const IconStyle = ({
iconPrefixCls,
csp
}) => {
(0,useResetIconStyle["default"])(iconPrefixCls, csp);
return null;
};
/**
* Since too many feedback using static method like `Modal.confirm` not getting theme, we record the
* theme register info here to help developer get warning info.
*/
let existThemeConfig = false;
const warnContext = true ? componentName => {
true ? (0,_util_warning["default"])(!existThemeConfig, componentName, `Static function can not consume context like dynamic theme. Please use 'App' component instead.`) : 0;
} : /* istanbul ignore next */
0;
const configConsumerProps = ['getTargetContainer', 'getPopupContainer', 'rootPrefixCls', 'getPrefixCls', 'renderEmpty', 'csp', 'autoInsertSpaceInButton', 'locale'];
// These props is used by `useContext` directly in sub component
const PASSED_PROPS = ['getTargetContainer', 'getPopupContainer', 'renderEmpty', 'input', 'pagination', 'form', 'select', 'button'];
let globalPrefixCls;
let globalIconPrefixCls;
let globalTheme;
let globalHolderRender;
function getGlobalPrefixCls() {
return globalPrefixCls || config_provider_context.defaultPrefixCls;
}
function getGlobalIconPrefixCls() {
return globalIconPrefixCls || config_provider_context.defaultIconPrefixCls;
}
const setGlobalConfig = props => {
const {
prefixCls,
iconPrefixCls,
theme,
holderRender
} = props;
if (prefixCls !== undefined) {
globalPrefixCls = prefixCls;
}
if (iconPrefixCls !== undefined) {
globalIconPrefixCls = iconPrefixCls;
}
if ('holderRender' in props) {
globalHolderRender = holderRender;
}
if (theme) {
globalTheme = theme;
}
};
const globalConfig = () => ({
getPrefixCls: (suffixCls, customizePrefixCls) => {
if (customizePrefixCls) {
return customizePrefixCls;
}
return suffixCls ? `${getGlobalPrefixCls()}-${suffixCls}` : getGlobalPrefixCls();
},
getIconPrefixCls: getGlobalIconPrefixCls,
getRootPrefixCls: () => {
// If Global prefixCls provided, use this
if (globalPrefixCls) {
return globalPrefixCls;
}
// Fallback to default prefixCls
return getGlobalPrefixCls();
},
getTheme: () => globalTheme,
holderRender: globalHolderRender
});
const ProviderChildren = props => {
const {
children,
csp: customCsp,
autoInsertSpaceInButton,
alert,
affix,
anchor,
app,
form,
locale: rawLocale,
componentSize,
direction,
space,
splitter,
virtual,
dropdownMatchSelectWidth,
popupMatchSelectWidth,
popupOverflow,
legacyLocale,
parentContext,
iconPrefixCls: customIconPrefixCls,
theme,
componentDisabled,
segmented,
statistic,
spin,
calendar,
carousel,
cascader,
collapse,
typography,
checkbox,
descriptions,
divider,
drawer,
skeleton,
steps,
image,
layout,
list,
mentions,
modal,
progress,
result,
slider,
breadcrumb,
masonry,
menu,
pagination,
input,
textArea,
otp,
empty,
badge,
radio,
rate,
ribbon,
switch: SWITCH,
transfer,
avatar,
message,
tag,
table,
card,
cardMeta,
tabs,
timeline,
timePicker,
upload,
notification,
tree,
colorPicker,
datePicker,
rangePicker,
flex,
wave,
dropdown,
warning: warningConfig,
tour,
tooltip,
popover,
popconfirm,
qrcode,
floatButton,
floatButtonGroup,
variant,
inputNumber,
treeSelect,
watermark
} = props;
// https://github.com/ant-design/ant-design/issues/57295
const locale = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if ((0,is.isPlainObject)(rawLocale) && Object.prototype.hasOwnProperty.call(rawLocale, 'default') && rawLocale.default?.locale) {
return rawLocale.default;
}
return rawLocale;
}, [rawLocale]);
// =================================== Context ===================================
const getPrefixCls = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback((suffixCls, customizePrefixCls) => {
const {
prefixCls
} = props;
if (customizePrefixCls) {
return customizePrefixCls;
}
const mergedPrefixCls = prefixCls || parentContext.getPrefixCls('');
return suffixCls ? `${mergedPrefixCls}-${suffixCls}` : mergedPrefixCls;
}, [parentContext.getPrefixCls, props.prefixCls]);
const iconPrefixCls = customIconPrefixCls || parentContext.iconPrefixCls || config_provider_context.defaultIconPrefixCls;
const csp = customCsp || parentContext.csp;
const mergedTheme = useTheme(theme, parentContext.theme, {
prefixCls: getPrefixCls('')
});
if (true) {
existThemeConfig = existThemeConfig || !!mergedTheme;
}
const baseConfig = {
csp,
autoInsertSpaceInButton,
alert,
affix,
anchor,
app,
locale: locale || legacyLocale,
direction,
space,
splitter,
virtual,
popupMatchSelectWidth: popupMatchSelectWidth ?? dropdownMatchSelectWidth,
popupOverflow,
getPrefixCls,
iconPrefixCls,
theme: mergedTheme,
segmented,
statistic,
spin,
calendar,
carousel,
cascader,
collapse,
typography,
checkbox,
descriptions,
divider,
drawer,
skeleton,
steps,
image,
input,
textArea,
otp,
layout,
list,
mentions,
modal,
progress,
result,
slider,
breadcrumb,
masonry,
menu,
pagination,
empty,
badge,
radio,
rate,
ribbon,
switch: SWITCH,
transfer,
avatar,
message,
tag,
table,
card,
cardMeta,
tabs,
timeline,
timePicker,
upload,
notification,
tree,
colorPicker,
datePicker,
rangePicker,
flex,
wave,
dropdown,
warning: warningConfig,
tour,
tooltip,
popover,
popconfirm,
qrcode,
floatButton,
floatButtonGroup,
variant,
inputNumber,
treeSelect,
watermark
};
if (true) {
const warningFn = (0,_util_warning.devUseWarning)('ConfigProvider');
warningFn(!('autoInsertSpaceInButton' in props), 'deprecated', '`autoInsertSpaceInButton` is deprecated. Please use `{ button: { autoInsertSpace: boolean }}` instead.');
}
const config = {
...parentContext
};
Object.keys(baseConfig).forEach(key => {
if (baseConfig[key] !== undefined) {
config[key] = baseConfig[key];
}
});
// Pass the props used by `useContext` directly with child component.
// These props should merged into `config`.
PASSED_PROPS.forEach(propName => {
const propValue = props[propName];
if (propValue) {
config[propName] = propValue;
}
});
if (typeof autoInsertSpaceInButton !== 'undefined') {
// merge deprecated api
config.button = {
autoInsertSpace: autoInsertSpaceInButton,
...config.button
};
}
// https://github.com/ant-design/ant-design/issues/27617
const memoedConfig = (0,useMemo["default"])(() => config, config, (prevConfig, currentConfig) => {
const prevKeys = Object.keys(prevConfig);
const currentKeys = Object.keys(currentConfig);
return prevKeys.length !== currentKeys.length || prevKeys.some(key => prevConfig[key] !== currentConfig[key]);
});
const {
layer
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(cssinjs.StyleContext);
const memoIconContextValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
prefixCls: iconPrefixCls,
csp,
layer: layer ? 'antd' : undefined
}), [iconPrefixCls, csp, layer]);
let childNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(IconStyle, {
iconPrefixCls: iconPrefixCls,
csp: csp
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(config_provider_PropWarning, {
dropdownMatchSelectWidth: dropdownMatchSelectWidth
}), children);
const validateMessages = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => (0,es.merge)(en_US["default"].Form?.defaultValidateMessages || {}, memoedConfig.locale?.Form?.defaultValidateMessages || {}, memoedConfig.form?.validateMessages || {}, form?.validateMessages || {}), [memoedConfig, form?.validateMessages]);
if (Object.keys(validateMessages).length > 0) {
childNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(validateMessagesContext.Provider, {
value: validateMessages
}, childNode);
}
if (locale) {
childNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_locale, {
locale: locale,
_ANT_MARK__: ANT_MARK
}, childNode);
}
if (iconPrefixCls || csp) {
childNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Context["default"].Provider, {
value: memoIconContextValue
}, childNode);
}
if (componentSize) {
childNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(SizeContext.SizeContextProvider, {
size: componentSize
}, childNode);
}
// =================================== Motion ===================================
childNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(MotionWrapper, null, childNode);
// ================================ Tooltip Unique ===============================
if (tooltip?.unique) {
childNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(tooltip_UniqueProvider, null, childNode);
}
// ================================ Dynamic theme ================================
const memoTheme = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const {
algorithm,
token,
components,
cssVar,
...rest
} = mergedTheme || {};
const themeObj = algorithm && (!Array.isArray(algorithm) || algorithm.length > 0) ? (0,cssinjs.createTheme)(algorithm) : default_theme["default"];
const parsedComponents = {};
Object.entries(components || {}).forEach(([componentName, componentToken]) => {
const parsedToken = {
...componentToken
};
if ('algorithm' in parsedToken) {
if (parsedToken.algorithm === true) {
parsedToken.theme = themeObj;
} else if (Array.isArray(parsedToken.algorithm) || typeof parsedToken.algorithm === 'function') {
parsedToken.theme = (0,cssinjs.createTheme)(parsedToken.algorithm);
}
delete parsedToken.algorithm;
}
parsedComponents[componentName] = parsedToken;
});
const mergedToken = {
...seed["default"],
...token
};
return {
...rest,
theme: themeObj,
token: mergedToken,
components: parsedComponents,
override: {
override: mergedToken,
...parsedComponents
},
cssVar
};
}, [mergedTheme]);
if (theme) {
childNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(context.DesignTokenContext.Provider, {
value: memoTheme
}, childNode);
}
// ================================== Warning ===================================
if (memoedConfig.warning) {
childNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(_util_warning.WarningContext.Provider, {
value: memoedConfig.warning
}, childNode);
}
// =================================== Render ===================================
if (componentDisabled !== undefined) {
childNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(DisabledContextProvider, {
disabled: componentDisabled
}, childNode);
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(config_provider_context.ConfigContext.Provider, {
value: memoedConfig
}, childNode);
};
const ConfigProvider = props => {
const context = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const antLocale = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(locale_context["default"]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(ProviderChildren, {
parentContext: context,
legacyLocale: antLocale,
...props
});
};
ConfigProvider.ConfigContext = config_provider_context.ConfigContext;
ConfigProvider.SizeContext = SizeContext["default"];
ConfigProvider.config = setGlobalConfig;
ConfigProvider.useConfig = hooks_useConfig;
Object.defineProperty(ConfigProvider, 'SizeContext', {
get: () => {
true ? (0,_util_warning["default"])(false, 'ConfigProvider', 'ConfigProvider.SizeContext is deprecated. Please use `ConfigProvider.useConfig().componentSize` instead.') : 0;
return SizeContext["default"];
}
});
if (true) {
ConfigProvider.displayName = 'ConfigProvider';
}
/* harmony default export */ var config_provider = (ConfigProvider);
;// ./components/_util/hooks/useMergedMask.ts
const normalizeMaskConfig = (mask, maskClosable) => {
let maskConfig = {};
if ((0,is.isPlainObject)(mask)) {
maskConfig = mask;
}
if (typeof mask === 'boolean') {
maskConfig = {
enabled: mask
};
}
if (maskConfig.closable === undefined && maskClosable !== undefined) {
maskConfig.closable = maskClosable;
}
return maskConfig;
};
const useMergedMask = (mask, contextMask, prefixCls, maskClosable) => {
return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
const maskConfig = normalizeMaskConfig(mask, maskClosable);
const contextMaskConfig = normalizeMaskConfig(contextMask);
const mergedConfig = {
blur: false,
...contextMaskConfig,
...maskConfig,
closable: maskConfig.closable ?? maskClosable ?? contextMaskConfig.closable ?? true
};
const className = mergedConfig.blur ? `${prefixCls}-mask-blur` : undefined;
return [mergedConfig.enabled !== false, {
mask: className
}, !!mergedConfig.closable];
}, [mask, contextMask, prefixCls, maskClosable]);
};
// EXTERNAL MODULE: ./components/_util/hooks/useZIndex.ts
var useZIndex = __webpack_require__("./components/_util/hooks/useZIndex.ts");
// EXTERNAL MODULE: ./components/_util/motion.ts
var _util_motion = __webpack_require__("./components/_util/motion.ts");
// EXTERNAL MODULE: ./components/locale/useLocale.ts
var useLocale = __webpack_require__("./components/locale/useLocale.ts");
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/hooks/useState.js
var useState = __webpack_require__("./node_modules/@rc-component/util/es/hooks/useState.js");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
;// ./components/_util/wave/style.ts
const genWaveStyle = token => {
const {
componentCls,
colorPrimary,
motionDurationSlow,
motionEaseInOut,
motionEaseOutCirc,
antCls
} = token;
const [, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'wave');
return {
[componentCls]: {
position: 'absolute',
background: 'transparent',
pointerEvents: 'none',
boxSizing: 'border-box',
color: varRef('color', colorPrimary),
boxShadow: `0 0 0 0 currentcolor`,
opacity: 0.2,
// =================== Motion ===================
'&.wave-motion-appear': {
transition: [`box-shadow 0.4s`, `opacity 2s`].map(prop => `${prop} ${motionEaseOutCirc}`).join(','),
'&-active': {
boxShadow: `0 0 0 6px currentcolor`,
opacity: 0
},
'&.wave-quick': {
transition: [`box-shadow`, `opacity`].map(prop => `${prop} ${motionDurationSlow} ${motionEaseInOut}`).join(',')
}
}
}
};
};
/* harmony default export */ var style = ((0,genStyleUtils.genComponentStyleHook)('Wave', genWaveStyle));
;// ./components/_util/wave/interface.ts
const TARGET_CLS = `${config_provider_context.defaultPrefixCls}-wave-target`;
;// ./components/_util/wave/util.ts
function isValidWaveColor(color) {
return color && typeof color === 'string' && color !== '#fff' && color !== '#ffffff' && color !== 'rgb(255, 255, 255)' && color !== 'rgba(255, 255, 255, 1)' && !/rgba\((?:\d*, ){3}0\)/.test(color) &&
// any transparent rgba color
color !== 'transparent' && color !== 'canvastext';
}
function getTargetWaveColor(node, colorSource = null) {
const style = getComputedStyle(node);
const {
borderTopColor,
borderColor,
backgroundColor
} = style;
if (colorSource && isValidWaveColor(style[colorSource])) {
return style[colorSource];
}
return [borderTopColor, borderColor, backgroundColor].find(isValidWaveColor) ?? null;
}
;// ./components/_util/wave/WaveEffect.tsx
function validateNum(value) {
return Number.isNaN(value) ? 0 : value;
}
const WaveEffect = props => {
const {
className,
target,
component,
colorSource
} = props;
const divRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const rootPrefixCls = getPrefixCls();
const [varName] = (0,genStyleUtils.genCssVar)(rootPrefixCls, 'wave');
// ===================== Effect =====================
const [waveColor, setWaveColor] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
const [borderRadius, setBorderRadius] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([]);
const [left, setLeft] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const [top, setTop] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const [width, setWidth] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const [height, setHeight] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const [enabled, setEnabled] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const waveStyle = {
left,
top,
width,
height,
borderRadius: borderRadius.map(radius => `${radius}px`).join(' ')
};
if (waveColor) {
waveStyle[varName('color')] = waveColor;
}
function syncPos() {
const nodeStyle = getComputedStyle(target);
// Get wave color from target
setWaveColor(getTargetWaveColor(target, colorSource));
const isStatic = nodeStyle.position === 'static';
// Rect
const {
borderLeftWidth,
borderTopWidth
} = nodeStyle;
setLeft(isStatic ? target.offsetLeft : validateNum(-Number.parseFloat(borderLeftWidth)));
setTop(isStatic ? target.offsetTop : validateNum(-Number.parseFloat(borderTopWidth)));
setWidth(target.offsetWidth);
setHeight(target.offsetHeight);
// Get border radius
const {
borderTopLeftRadius,
borderTopRightRadius,
borderBottomLeftRadius,
borderBottomRightRadius
} = nodeStyle;
setBorderRadius([borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius, borderBottomLeftRadius].map(radius => validateNum(Number.parseFloat(radius))));
}
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (target) {
// We need delay to check position here
// since UI may change after click
const id = (0,raf["default"])(() => {
syncPos();
setEnabled(true);
});
// Add resize observer to follow size
let resizeObserver;
if (typeof ResizeObserver !== 'undefined') {
resizeObserver = new ResizeObserver(syncPos);
resizeObserver.observe(target);
}
return () => {
raf["default"].cancel(id);
resizeObserver?.disconnect();
};
}
}, [target]);
if (!enabled) {
return null;
}
const isSmallComponent = (component === 'Checkbox' || component === 'Radio') && target?.classList.contains(TARGET_CLS);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es["default"], {
visible: true,
motionAppear: true,
motionName: "wave-motion",
motionDeadline: 5000,
onAppearEnd: (_, event) => {
if (event.deadline || event.propertyName === 'opacity') {
const holder = divRef.current?.parentElement;
unmount(holder).then(() => {
holder?.remove();
});
}
return false;
}
}, ({
className: motionClassName
}, ref) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: (0,es_ref.composeRef)(divRef, ref),
className: (0,clsx.clsx)(className, motionClassName, {
'wave-quick': isSmallComponent
}),
style: waveStyle
})));
};
const showWaveEffect = (target, info) => {
const {
component
} = info;
// Skip for unchecked checkbox
if (component === 'Checkbox' && !target.querySelector('input')?.checked) {
return;
}
// Create holder
const holder = document.createElement('div');
holder.style.position = 'absolute';
holder.style.left = '0px';
holder.style.top = '0px';
target?.insertBefore(holder, target?.firstChild);
render(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(WaveEffect, {
...info,
target: target
}), holder);
};
/* harmony default export */ var wave_WaveEffect = (showWaveEffect);
;// ./components/_util/wave/useWave.ts
const useWave = (nodeRef, className, component, colorSource) => {
const {
wave
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const [, token, hashId] = (0,useToken["default"])();
const showWave = (0,es.useEvent)(event => {
const node = nodeRef.current;
if (wave?.disabled || !node) {
return;
}
const targetNode = node.querySelector(`.${TARGET_CLS}`) || node;
const {
showEffect
} = wave || {};
// Customize wave effect
(showEffect || wave_WaveEffect)(targetNode, {
className,
token,
component,
event,
hashId,
colorSource
});
});
const rafIdRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
// Clean up RAF on unmount to prevent memory leaks and stale callbacks
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => () => {
raf["default"].cancel(rafIdRef.current);
}, []);
// Merge trigger event into one for each frame
const showDebounceWave = event => {
raf["default"].cancel(rafIdRef.current);
rafIdRef.current = (0,raf["default"])(() => {
showWave(event);
});
};
return showDebounceWave;
};
/* harmony default export */ var wave_useWave = (useWave);
;// ./components/_util/wave/index.ts
const Wave = props => {
const {
children,
disabled,
component,
colorSource
} = props;
const {
getPrefixCls
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(config_provider_context.ConfigContext);
const containerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
// ============================== Style ===============================
const prefixCls = getPrefixCls('wave');
const hashId = style(prefixCls);
// =============================== Wave ===============================
const showWave = wave_useWave(containerRef, (0,clsx.clsx)(prefixCls, hashId), component, colorSource);
// ============================== Effect ==============================
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(() => {
const node = containerRef.current;
if (!node || node.nodeType !== window.Node.ELEMENT_NODE || disabled) {
return;
}
// Click handler
const onClick = e => {
// Fix radio button click twice
if (!isVisible(e.target) ||
// No need wave
!node.getAttribute || node.getAttribute('disabled') || node.disabled || node.className.includes('disabled') && !node.className.includes('disabled:') || node.getAttribute('aria-disabled') === 'true' || node.className.includes('-leave')) {
return;
}
showWave(e);
};
// Bind events
node.addEventListener('click', onClick, true);
return () => {
node.removeEventListener('click', onClick, true);
};
}, [disabled]);
// ============================== Render ==============================
if (! /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(children)) {
return children ?? null;
}
const ref = (0,es_ref.supportRef)(children) ? (0,es_ref.composeRef)((0,es_ref.getNodeRef)(children), containerRef) : containerRef;
return (0,reactNode.cloneElement)(children, {
ref
});
};
if (true) {
Wave.displayName = 'Wave';
}
/* harmony default export */ var wave = (Wave);
// EXTERNAL MODULE: ./components/config-provider/hooks/useSize.ts
var useSize = __webpack_require__("./components/config-provider/hooks/useSize.ts");
;// ./components/_util/hooks/useOrientation.ts
const isValidOrientation = orientation => {
return orientation === 'horizontal' || orientation === 'vertical';
};
const useOrientation = (orientation, vertical, legacyDirection) => {
return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
const validOrientation = isValidOrientation(orientation);
let mergedOrientation;
if (validOrientation) {
mergedOrientation = orientation;
} else if (typeof vertical === 'boolean') {
mergedOrientation = vertical ? 'vertical' : 'horizontal';
} else {
const validLegacyDirection = isValidOrientation(legacyDirection);
mergedOrientation = validLegacyDirection ? legacyDirection : 'horizontal';
}
return [mergedOrientation, mergedOrientation === 'vertical'];
}, [legacyDirection, orientation, vertical]);
};
;// ./components/space/style/compact.ts
const genSpaceCompactStyle = token => {
const {
componentCls
} = token;
return {
[componentCls]: {
display: 'inline-flex',
'&-block': {
display: 'flex',
width: '100%'
},
'&-vertical': {
flexDirection: 'column'
},
'&-rtl': {
direction: 'rtl'
}
}
};
};
// ============================== Export ==============================
/* harmony default export */ var compact = ((0,genStyleUtils.genStyleHooks)(['Space', 'Compact'], genSpaceCompactStyle, () => ({}), {
// Space component don't apply extra font style
// https://github.com/ant-design/ant-design/issues/40315
resetStyle: false
}));
;// ./components/space/Compact.tsx
const SpaceCompactItemContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
const useCompactItemContext = (prefixCls, direction) => {
const compactItemContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(SpaceCompactItemContext);
const compactItemClassnames = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!compactItemContext) {
return '';
}
const {
compactDirection,
isFirstItem,
isLastItem
} = compactItemContext;
const separator = compactDirection === 'vertical' ? '-vertical-' : '-';
return (0,clsx.clsx)(`${prefixCls}-compact${separator}item`, {
[`${prefixCls}-compact${separator}first-item`]: isFirstItem,
[`${prefixCls}-compact${separator}last-item`]: isLastItem,
[`${prefixCls}-compact${separator}item-rtl`]: direction === 'rtl'
});
}, [prefixCls, direction, compactItemContext]);
return {
compactSize: compactItemContext?.compactSize,
compactDirection: compactItemContext?.compactDirection,
compactItemClassnames
};
};
const NoCompactStyle = props => {
const {
children
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(SpaceCompactItemContext.Provider, {
value: null
}, children);
};
const CompactItem = props => {
const {
children,
...others
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(SpaceCompactItemContext.Provider, {
value: external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => others, [others])
}, children);
};
const Compact = props => {
const {
getPrefixCls,
direction: directionConfig
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const {
size,
direction,
orientation,
block,
prefixCls: customizePrefixCls,
className,
rootClassName,
children,
vertical,
...restProps
} = props;
// ======================== Warning ==========================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Space.Compact');
warning.deprecated(!direction, 'direction', 'orientation');
}
const [mergedOrientation, mergedVertical] = useOrientation(orientation, vertical, direction);
const mergedSize = (0,useSize["default"])(ctx => size ?? ctx);
const prefixCls = getPrefixCls('space-compact', customizePrefixCls);
const [hashId] = compact(prefixCls);
const clx = (0,clsx.clsx)(prefixCls, hashId, {
[`${prefixCls}-rtl`]: directionConfig === 'rtl',
[`${prefixCls}-block`]: block,
[`${prefixCls}-vertical`]: mergedVertical
}, className, rootClassName);
const compactItemContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(SpaceCompactItemContext);
const childNodes = (0,es.toArray)(children);
const nodes = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => childNodes.map((child, i) => {
const key = child?.key || `${prefixCls}-item-${i}`;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(CompactItem, {
key: key,
compactSize: mergedSize,
compactDirection: mergedOrientation,
isFirstItem: i === 0 && (!compactItemContext || compactItemContext?.isFirstItem),
isLastItem: i === childNodes.length - 1 && (!compactItemContext || compactItemContext?.isLastItem)
}, child);
}), [childNodes, compactItemContext, mergedOrientation, mergedSize, prefixCls]);
// =========================== Render ===========================
if (childNodes.length === 0) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: clx,
...restProps
}, nodes);
};
/* harmony default export */ var space_Compact = (Compact);
;// ./components/button/ButtonGroup.tsx
const GroupSizeContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(undefined);
const ButtonGroup = props => {
const {
getPrefixCls,
direction
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const {
prefixCls: customizePrefixCls,
size,
className,
...others
} = props;
const prefixCls = getPrefixCls('btn-group', customizePrefixCls);
const [,, hashId] = (0,useToken["default"])();
const sizeCls = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
switch (size) {
case 'large':
return 'lg';
case 'small':
return 'sm';
default:
return '';
}
}, [size]);
if (true) {
const warning = (0,_util_warning.devUseWarning)('Button.Group');
warning.deprecated(false, 'Button.Group', 'Space.Compact');
true ? warning(!size || ['large', 'medium', 'small'].includes(size), 'usage', 'Invalid prop `size`.') : 0;
}
const classes = (0,clsx.clsx)(prefixCls, {
[`${prefixCls}-${sizeCls}`]: sizeCls,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, hashId);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(GroupSizeContext.Provider, {
value: size
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
...others,
className: classes
}));
};
/* harmony default export */ var button_ButtonGroup = (ButtonGroup);
// EXTERNAL MODULE: ./components/theme/interface/presetColors.ts
var presetColors = __webpack_require__("./components/theme/interface/presetColors.ts");
;// ./components/button/buttonHelpers.tsx
const rxTwoCNChar = /^[\u4E00-\u9FA5]{2}$/;
const isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar);
function convertLegacyProps(type) {
if (type === 'danger') {
return {
danger: true
};
}
return {
type
};
}
function isUnBorderedButtonVariant(type) {
return type === 'text' || type === 'link';
}
function splitCNCharsBySpace(child, needInserted, style, className) {
if (!(0,is.isNonNullable)(child) || child === '') {
return;
}
const SPACE = needInserted ? ' ' : '';
if (typeof child !== 'string' && typeof child !== 'number' && (0,is.isString)(child.type) && isTwoCNChar(child.props.children)) {
return (0,reactNode.cloneElement)(child, oriProps => {
const mergedCls = (0,clsx.clsx)(oriProps.className, className) || undefined;
const mergedStyle = {
...style,
...oriProps.style
};
return {
...oriProps,
children: oriProps.children.split('').join(SPACE),
className: mergedCls,
style: mergedStyle
};
});
}
if ((0,is.isString)(child)) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: className,
style: style
}, isTwoCNChar(child) ? child.split('').join(SPACE) : child);
}
if ((0,reactNode.isFragment)(child)) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: className,
style: style
}, child);
}
return (0,reactNode.cloneElement)(child, oriProps => ({
...oriProps,
className: (0,clsx.clsx)(oriProps.className, className) || undefined,
style: {
...oriProps.style,
...style
}
}));
}
function spaceChildren(children, needInserted, style, className) {
let isPrevChildPure = false;
const childList = [];
external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.forEach(children, child => {
const type = typeof child;
const isCurrentChildPure = type === 'string' || type === 'number';
if (isPrevChildPure && isCurrentChildPure) {
const lastIndex = childList.length - 1;
const lastChild = childList[lastIndex];
childList[lastIndex] = `${lastChild}${child}`;
} else {
childList.push(child);
}
isPrevChildPure = isCurrentChildPure;
});
return external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.map(childList, child => splitCNCharsBySpace(child, needInserted, style, className));
}
const _ButtonTypes = ['default', 'primary', 'dashed', 'link', 'text'];
const _ButtonShapes = ['default', 'circle', 'round', 'square'];
const _ButtonHTMLTypes = ['submit', 'button', 'reset'];
const _ButtonVariantTypes = ['outlined', 'dashed', 'solid', 'filled', 'text', 'link'];
const _ButtonColorTypes = ['default', 'primary', 'danger'].concat((0,toConsumableArray["default"])(presetColors.PresetColors));
;// ./components/button/IconWrapper.tsx
const IconWrapper = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((props, ref) => {
const {
className,
style,
children,
prefixCls
} = props;
const iconWrapperCls = (0,clsx.clsx)(`${prefixCls}-icon`, className);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
ref: ref,
className: iconWrapperCls,
style: style
}, children);
});
/* harmony default export */ var button_IconWrapper = (IconWrapper);
;// ./components/button/DefaultLoadingIcon.tsx
const InnerLoadingIcon = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((props, ref) => {
const {
prefixCls,
className,
style,
iconClassName
} = props;
const mergedIconCls = (0,clsx.clsx)(`${prefixCls}-loading-icon`, className);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(button_IconWrapper, {
prefixCls: prefixCls,
className: mergedIconCls,
style: style,
ref: ref
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_LoadingOutlined, {
className: iconClassName
}));
});
const getCollapsedWidth = () => ({
width: 0,
opacity: 0,
transform: 'scale(0)'
});
const getRealWidth = node => ({
width: node.scrollWidth,
opacity: 1,
transform: 'scale(1)'
});
const DefaultLoadingIcon = props => {
const {
prefixCls,
loading,
existIcon,
className,
style,
mount
} = props;
const visible = !!loading;
if (existIcon) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(InnerLoadingIcon, {
prefixCls: prefixCls,
className: className,
style: style
});
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(motion_es["default"], {
visible: visible,
// Used for minus flex gap style only
motionName: `${prefixCls}-loading-icon-motion`,
motionAppear: !mount,
motionEnter: !mount,
motionLeave: !mount,
removeOnLeave: true,
onAppearStart: getCollapsedWidth,
onAppearActive: getRealWidth,
onEnterStart: getCollapsedWidth,
onEnterActive: getRealWidth,
onLeaveStart: getRealWidth,
onLeaveActive: getCollapsedWidth
}, ({
className: motionCls,
style: motionStyle
}, ref) => {
const mergedStyle = {
...style,
...motionStyle
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(InnerLoadingIcon, {
prefixCls: prefixCls,
className: (0,clsx.clsx)(className, motionCls),
style: mergedStyle,
ref: ref
});
});
};
/* harmony default export */ var button_DefaultLoadingIcon = (DefaultLoadingIcon);
// EXTERNAL MODULE: ./components/button/style/index.ts + 2 modules
var button_style = __webpack_require__("./components/button/style/index.ts");
// EXTERNAL MODULE: ./components/style/compact-item.ts
var compact_item = __webpack_require__("./components/style/compact-item.ts");
;// ./components/style/compact-item-vertical.ts
function compactItemVerticalBorder(token, parentCls, prefixCls) {
return {
// border collapse
[`&-item:not(${parentCls}-last-item)`]: {
marginBottom: token.calc(token.lineWidth).mul(-1).equal()
},
[`&-item:not(${prefixCls}-status-success)`]: {
zIndex: 2
},
'&-item': {
'&:hover,&:focus,&:active': {
zIndex: 3
},
'&[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]: {
...compactItemVerticalBorder(token, compactCls, token.componentCls),
...compactItemBorderVerticalRadius(token.componentCls, compactCls)
}
};
}
// EXTERNAL MODULE: ./components/button/style/token.ts
var style_token = __webpack_require__("./components/button/style/token.ts");
;// ./components/button/style/compact.ts
const genButtonCompactStyle = token => {
const {
antCls,
componentCls,
lineWidth,
calc,
colorBgContainer
} = token;
const solidSelector = `${componentCls}-variant-solid:not([disabled])`;
const insetOffset = calc(lineWidth).mul(-1).equal();
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'btn');
const getCompactBorderStyle = vertical => {
const itemCls = `${componentCls}-compact${vertical ? '-vertical' : ''}-item`;
return {
// TODO: Border color transition should be not cover when has color.
[itemCls]: {
[varName('compact-connect-border-color')]: varRef('bg-color-hover'),
[`&${solidSelector}`]: {
transition: `none`,
[`& + ${solidSelector}:before`]: [{
position: 'absolute',
backgroundColor: varRef('compact-connect-border-color'),
content: '""'
}, vertical ? {
top: insetOffset,
insetInline: insetOffset,
height: lineWidth
} : {
insetBlock: insetOffset,
insetInlineStart: insetOffset,
width: lineWidth
}],
'&:hover:before': {
display: 'none'
}
}
}
};
};
// Special styles for solid Button
return [getCompactBorderStyle(), getCompactBorderStyle(true), {
[`${solidSelector}${componentCls}-color-default`]: {
[varName('compact-connect-border-color')]: `color-mix(in srgb, ${varRef('bg-color-hover')} 75%, ${colorBgContainer})`
}
}];
};
// ============================== Export ==============================
/* harmony default export */ var style_compact = ((0,genStyleUtils.genSubStyleComponent)(['Button', 'compact'], token => {
const buttonToken = (0,style_token.prepareToken)(token);
return [
// Space Compact
(0,compact_item.genCompactItemStyle)(buttonToken), genCompactItemVerticalStyle(buttonToken), genButtonCompactStyle(buttonToken)];
}, style_token.prepareComponentToken));
;// ./components/button/Button.tsx
function getLoadingConfig(loading) {
if ((0,is.isPlainObject)(loading)) {
let delay = loading?.delay;
delay = (0,is.isNumber)(delay) ? delay : 0;
return {
loading: delay <= 0,
delay
};
}
return {
loading: !!loading,
delay: 0
};
}
const ButtonTypeMap = {
default: ['default', 'outlined'],
primary: ['primary', 'solid'],
dashed: ['default', 'dashed'],
// `link` is not a real color but we should compatible with it
link: ['link', 'link'],
text: ['default', 'text']
};
const InternalCompoundedButton = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
_skipSemantic,
loading = false,
prefixCls: customizePrefixCls,
color,
variant,
type,
danger = false,
shape: customizeShape,
size: customizeSize,
disabled: customDisabled,
className,
rootClassName,
children,
icon,
iconPosition,
iconPlacement,
ghost = false,
block = false,
// React does not recognize the `htmlType` prop on a DOM element. Here we pick it out of `rest`.
htmlType = 'button',
classNames,
styles,
style,
autoInsertSpace,
autoFocus,
...rest
} = props;
const childNodes = (0,es.toArray)(children);
// https://github.com/ant-design/ant-design/issues/47605
// Compatible with original `type` behavior
const mergedType = type || 'default';
const {
getPrefixCls,
direction,
autoInsertSpace: contextAutoInsertSpace,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles,
loadingIcon: contextLoadingIcon,
shape: contextShape,
color: contextColor,
variant: contextVariant
} = (0,config_provider_context.useComponentConfig)('button');
const mergedShape = customizeShape || contextShape || 'default';
const [parsedColor, parsedVariant] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
// >>>>> Local
// Color & Variant
if (color && variant) {
return [color, variant];
}
// Sugar syntax
if (type || danger) {
const colorVariantPair = ButtonTypeMap[mergedType] || [];
if (danger) {
return ['danger', colorVariantPair[1]];
}
return colorVariantPair;
}
// >>> Context fallback
if (contextColor && contextVariant) {
return [contextColor, contextVariant];
}
return ['default', 'outlined'];
}, [color, variant, type, danger, contextColor, contextVariant, mergedType]);
const [mergedColor, mergedVariant] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (ghost && parsedVariant === 'solid') {
return [parsedColor, 'outlined'];
}
return [parsedColor, parsedVariant];
}, [parsedColor, parsedVariant, ghost]);
const isDanger = mergedColor === 'danger';
const mergedColorText = isDanger ? 'dangerous' : mergedColor;
const mergedInsertSpace = autoInsertSpace ?? contextAutoInsertSpace ?? true;
const prefixCls = getPrefixCls('btn', customizePrefixCls);
const [hashId, cssVarCls] = (0,button_style["default"])(prefixCls);
const disabled = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(config_provider_DisabledContext);
const mergedDisabled = customDisabled ?? disabled;
const groupSize = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(GroupSizeContext);
const loadingOrDelay = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => getLoadingConfig(loading), [loading]);
const [innerLoading, setInnerLoading] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(loadingOrDelay.loading);
const [hasTwoCNChar, setHasTwoCNChar] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
const buttonRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const mergedRef = (0,es.useComposeRef)(ref, buttonRef);
const needInserted = childNodes.length === 1 && !icon && !isUnBorderedButtonVariant(mergedVariant);
// ========================= Mount ==========================
// Record for mount status.
// This will help to no to show the animation of loading on the first mount.
const isMountRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(true);
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(() => {
isMountRef.current = false;
return () => {
isMountRef.current = true;
};
}, []);
// ========================= Effect =========================
// Loading. Should use `useLayoutEffect` to avoid low perf multiple click issue.
// https://github.com/ant-design/ant-design/issues/51325
(0,useLayoutEffect["default"])(() => {
let delayTimer = null;
if (loadingOrDelay.delay > 0) {
delayTimer = setTimeout(() => {
delayTimer = null;
setInnerLoading(true);
}, loadingOrDelay.delay);
} else {
setInnerLoading(loadingOrDelay.loading);
}
function cleanupTimer() {
if (delayTimer) {
clearTimeout(delayTimer);
delayTimer = null;
}
}
return cleanupTimer;
}, [loadingOrDelay.delay, loadingOrDelay.loading]);
// Two chinese characters check
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
// FIXME: for HOC usage like
if (!buttonRef.current || !mergedInsertSpace) {
return;
}
const buttonText = buttonRef.current.textContent || '';
if (needInserted && isTwoCNChar(buttonText)) {
if (!hasTwoCNChar) {
setHasTwoCNChar(true);
}
} else if (hasTwoCNChar) {
setHasTwoCNChar(false);
}
});
// Auto focus
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (autoFocus && buttonRef.current) {
buttonRef.current.focus();
}
}, []);
// ========================= Events =========================
const handleClick = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useCallback(e => {
// FIXME: https://github.com/ant-design/ant-design/issues/30207
if (innerLoading || mergedDisabled) {
e.preventDefault();
return;
}
props.onClick?.('href' in props ? e : e);
}, [props.onClick, innerLoading, mergedDisabled]);
// ========================== Warn ==========================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Button');
true ? warning(!(typeof icon === 'string' && icon.length > 2), 'breaking', `\`icon\` is using ReactNode instead of string naming in v4. Please check \`${icon}\` at https://ant.design/components/icon`) : 0;
true ? warning(!(ghost && isUnBorderedButtonVariant(mergedVariant)), 'usage', "`link` or `text` button can't be a `ghost` button.") : 0;
warning.deprecated(!iconPosition, 'iconPosition', 'iconPlacement');
}
// ========================== Size ==========================
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
const sizeFullName = (0,useSize["default"])(ctxSize => customizeSize ?? compactSize ?? groupSize ?? ctxSize);
const iconType = innerLoading ? 'loading' : icon;
const mergedIconPlacement = iconPlacement ?? iconPosition ?? 'start';
const linkButtonRestProps = (0,es.omit)(rest, ['navigate']);
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
type: mergedType,
color: mergedColor,
variant: mergedVariant,
danger: isDanger,
shape: mergedShape,
size: sizeFullName,
disabled: mergedDisabled,
loading: innerLoading,
iconPlacement: mergedIconPlacement
};
// ========================= Style ==========================
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([_skipSemantic ? undefined : contextClassNames, classNames], [_skipSemantic ? undefined : contextStyles, styles], {
props: mergedProps
});
// ========================= Render =========================
const classes = (0,clsx.clsx)(prefixCls, hashId, cssVarCls, {
[`${prefixCls}-${mergedShape}`]: mergedShape !== 'default' && mergedShape !== 'square' && mergedShape,
// Compatible with versions earlier than 5.21.0
[`${prefixCls}-${mergedType}`]: mergedType,
[`${prefixCls}-dangerous`]: danger,
[`${prefixCls}-color-${mergedColorText}`]: mergedColorText,
[`${prefixCls}-variant-${mergedVariant}`]: mergedVariant,
[`${prefixCls}-lg`]: sizeFullName === 'large',
[`${prefixCls}-sm`]: sizeFullName === 'small',
[`${prefixCls}-icon-only`]: !children && children !== 0 && !!iconType,
[`${prefixCls}-background-ghost`]: ghost && !isUnBorderedButtonVariant(mergedVariant),
[`${prefixCls}-loading`]: innerLoading,
[`${prefixCls}-two-chinese-chars`]: hasTwoCNChar && mergedInsertSpace && !innerLoading,
[`${prefixCls}-block`]: block,
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-icon-end`]: mergedIconPlacement === 'end'
}, compactItemClassnames, className, rootClassName, contextClassName, mergedClassNames.root);
const fullStyle = {
...mergedStyles.root,
...contextStyle,
...style
};
const iconSharedProps = {
className: mergedClassNames.icon,
style: mergedStyles.icon
};
/**
* Extract icon node
* If there is a custom icon and not in loading state: show custom icon
*/
const iconWrapperElement = child => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(button_IconWrapper, {
prefixCls: prefixCls,
...iconSharedProps
}, child));
const defaultLoadingIconElement = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(button_DefaultLoadingIcon, {
existIcon: !!icon,
prefixCls: prefixCls,
loading: innerLoading,
mount: isMountRef.current,
...iconSharedProps
});
const mergedLoadingIcon = (0,is.isPlainObject)(loading) ? loading.icon || contextLoadingIcon : contextLoadingIcon;
/**
* Using if-else statements can improve code readability without affecting future expansion.
*/
let iconNode;
if (icon && !innerLoading) {
iconNode = iconWrapperElement(icon);
} else if (loading && mergedLoadingIcon) {
iconNode = iconWrapperElement(mergedLoadingIcon);
} else {
iconNode = defaultLoadingIconElement;
}
const contentNode = (0,is.isNonNullable)(children) ? spaceChildren(children, needInserted && mergedInsertSpace, mergedStyles.content, mergedClassNames.content) : null;
if (linkButtonRestProps.href !== undefined) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
...linkButtonRestProps,
className: (0,clsx.clsx)(classes, {
[`${prefixCls}-disabled`]: mergedDisabled
}),
href: mergedDisabled ? undefined : linkButtonRestProps.href,
style: fullStyle,
onClick: handleClick,
ref: mergedRef,
tabIndex: mergedDisabled ? -1 : 0,
"aria-disabled": mergedDisabled
}, iconNode, contentNode);
}
let buttonNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
...rest,
type: htmlType,
className: classes,
style: fullStyle,
onClick: handleClick,
disabled: mergedDisabled,
ref: mergedRef
}, iconNode, contentNode, compactItemClassnames && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(style_compact, {
prefixCls: prefixCls
}));
if (!isUnBorderedButtonVariant(mergedVariant)) {
buttonNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(wave, {
component: "Button",
disabled: innerLoading
}, buttonNode);
}
return buttonNode;
});
const Button = InternalCompoundedButton;
Button.Group = button_ButtonGroup;
Button.__ANT_BUTTON = true;
if (true) {
Button.displayName = 'Button';
}
/* harmony default export */ var button_Button = (Button);
;// ./components/_util/ActionButton.tsx
const ActionButton = props => {
const {
type,
children,
prefixCls,
buttonProps,
close,
autoFocus,
emitEvent,
isSilent,
quitOnNullishReturnValue,
actionFn
} = props;
const clickedRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
const buttonRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const [loading, setLoading] = (0,useState["default"])(false);
const onInternalClose = (...args) => {
close?.(...args);
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
let timeoutId = null;
if (autoFocus) {
timeoutId = setTimeout(() => {
buttonRef.current?.focus({
preventScroll: true
});
});
}
return () => {
if (timeoutId) {
clearTimeout(timeoutId);
}
};
}, [autoFocus]);
const handlePromiseOnOk = returnValueOfOnOk => {
if (!(0,is.isThenable)(returnValueOfOnOk)) {
return;
}
setLoading(true);
returnValueOfOnOk.then((...args) => {
setLoading(false, true);
onInternalClose.apply(void 0, args);
clickedRef.current = false;
}, e => {
// See: https://github.com/ant-design/ant-design/issues/6183
setLoading(false, true);
clickedRef.current = false;
// Do not throw if is `await` mode
if (isSilent?.()) {
return;
}
return Promise.reject(e);
});
};
const onClick = e => {
if (clickedRef.current) {
return;
}
clickedRef.current = true;
if (!actionFn) {
onInternalClose();
return;
}
let returnValueOfOnOk;
if (emitEvent) {
returnValueOfOnOk = actionFn(e);
if (quitOnNullishReturnValue && !(0,is.isThenable)(returnValueOfOnOk)) {
clickedRef.current = false;
onInternalClose(e);
return;
}
} else if (actionFn.length) {
returnValueOfOnOk = actionFn(close);
// https://github.com/ant-design/ant-design/issues/23358
clickedRef.current = false;
} else {
returnValueOfOnOk = actionFn();
if (!(0,is.isThenable)(returnValueOfOnOk)) {
onInternalClose();
return;
}
}
handlePromiseOnOk(returnValueOfOnOk);
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(button_Button, {
...convertLegacyProps(type),
onClick: onClick,
loading: loading,
prefixCls: prefixCls,
...buttonProps,
ref: buttonRef
}, children);
};
/* harmony default export */ var _util_ActionButton = (ActionButton);
;// ./components/modal/context.ts
const ModalContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createContext({});
const {
Provider: ModalContextProvider
} = ModalContext;
;// ./components/modal/components/ConfirmCancelBtn.tsx
const ConfirmCancelBtn = () => {
const {
autoFocusButton,
cancelButtonProps,
cancelTextLocale,
isSilent,
mergedOkCancel,
rootPrefixCls,
close,
onCancel,
onConfirm,
onClose
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(ModalContext);
return mergedOkCancel ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(_util_ActionButton, {
isSilent: isSilent,
actionFn: onCancel,
close: (...args) => {
close?.(...args);
onConfirm?.(false);
onClose?.();
},
autoFocus: autoFocusButton === 'cancel',
buttonProps: cancelButtonProps,
prefixCls: `${rootPrefixCls}-btn`
}, cancelTextLocale)) : null;
};
/* harmony default export */ var components_ConfirmCancelBtn = (ConfirmCancelBtn);
;// ./components/modal/components/ConfirmOkBtn.tsx
const ConfirmOkBtn = () => {
const {
autoFocusButton,
close,
isSilent,
okButtonProps,
rootPrefixCls,
okTextLocale,
okType,
onConfirm,
onOk,
onClose
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(ModalContext);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(_util_ActionButton, {
isSilent: isSilent,
type: okType || 'primary',
actionFn: onOk,
close: (...args) => {
close?.(...args);
onConfirm?.(true);
onClose?.();
},
autoFocus: autoFocusButton === 'ok',
buttonProps: okButtonProps,
prefixCls: `${rootPrefixCls}-btn`
}, okTextLocale);
};
/* harmony default export */ var components_ConfirmOkBtn = (ConfirmOkBtn);
;// ./node_modules/@rc-component/dialog/es/context.js
const RefContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({});
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/Dom/contains.js
var contains = __webpack_require__("./node_modules/@rc-component/util/es/Dom/contains.js");
;// ./node_modules/@rc-component/dialog/es/util.js
// =============================== Motion ===============================
function getMotionName(prefixCls, transitionName, animationName) {
let motionName = transitionName;
if (!motionName && animationName) {
motionName = `${prefixCls}-${animationName}`;
}
return motionName;
}
// =============================== Offset ===============================
function util_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 += util_getScroll(w);
pos.top += util_getScroll(w, true);
return pos;
}
;// ./node_modules/@rc-component/util/es/Dom/focus.js
function focusable(node, includePositive = false) {
if (isVisible(node)) {
const nodeName = node.nodeName.toLowerCase();
const isFocusableElement =
// Focusable element
['input', 'select', 'textarea', 'button'].includes(nodeName) ||
// Editable element
node.isContentEditable ||
// Anchor with href element
nodeName === 'a' && !!node.getAttribute('href');
// Get tabIndex
const tabIndexAttr = node.getAttribute('tabindex');
const tabIndexNum = Number(tabIndexAttr);
// Parse as number if validate
let tabIndex = null;
if (tabIndexAttr && !Number.isNaN(tabIndexNum)) {
tabIndex = tabIndexNum;
} else if (isFocusableElement && tabIndex === null) {
tabIndex = 0;
}
// Block focusable if disabled
if (isFocusableElement && node.disabled) {
tabIndex = null;
}
return tabIndex !== null && (tabIndex >= 0 || includePositive && tabIndex < 0);
}
return false;
}
function getFocusNodeList(node, includePositive = false) {
const res = [...node.querySelectorAll('*')].filter(child => {
return focusable(child, includePositive);
});
if (focusable(node, includePositive)) {
res.unshift(node);
}
return res;
}
// Used for `rc-input` `rc-textarea` `rc-input-number`
/**
* Focus element and set cursor position for input/textarea elements.
*/
function triggerFocus(element, option) {
if (!element) return;
element.focus(option);
// Selection content
const {
cursor
} = option || {};
if (cursor && (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement)) {
const len = element.value.length;
switch (cursor) {
case 'start':
element.setSelectionRange(0, 0);
break;
case 'end':
element.setSelectionRange(len, len);
break;
default:
element.setSelectionRange(0, len);
}
}
}
// ======================================================
// == Lock Focus ==
// ======================================================
let lastFocusElement = null;
let focusElements = [];
// Map stable ID to lock element
const idToElementMap = new Map();
// Map stable ID to ignored element
const ignoredElementMap = new Map();
function getLastElement() {
return focusElements[focusElements.length - 1];
}
function isIgnoredElement(element) {
const lastElement = getLastElement();
if (element && lastElement) {
// Find the ID that maps to the last element
let lockId;
for (const [id, ele] of idToElementMap.entries()) {
if (ele === lastElement) {
lockId = id;
break;
}
}
const ignoredEle = ignoredElementMap.get(lockId);
return !!ignoredEle && (ignoredEle === element || ignoredEle.contains(element));
}
return false;
}
function hasFocus(element) {
const {
activeElement
} = document;
return element === activeElement || element.contains(activeElement);
}
function syncFocus() {
const lastElement = getLastElement();
const {
activeElement
} = document;
// If current focus is on an ignored element, don't force it back
if (isIgnoredElement(activeElement)) {
return;
}
if (lastElement && !hasFocus(lastElement)) {
const focusableList = getFocusNodeList(lastElement);
const matchElement = focusableList.includes(lastFocusElement) ? lastFocusElement : focusableList[0];
matchElement?.focus({
preventScroll: true
});
} else {
lastFocusElement = activeElement;
}
}
function onWindowKeyDown(e) {
if (e.key === 'Tab') {
const {
activeElement
} = document;
const lastElement = getLastElement();
const focusableList = getFocusNodeList(lastElement);
const last = focusableList[focusableList.length - 1];
if (e.shiftKey && activeElement === focusableList[0]) {
// Tab backward on first focusable element
lastFocusElement = last;
} else if (!e.shiftKey && activeElement === last) {
// Tab forward on last focusable element
lastFocusElement = focusableList[0];
}
}
}
/**
* Lock focus in the element.
* It will force back to the first focusable element when focus leaves the element.
* @param id - A stable ID for this lock instance
*/
function lockFocus(element, id) {
if (element) {
// Store the mapping between ID and element
idToElementMap.set(id, element);
// Refresh focus elements
focusElements = focusElements.filter(ele => ele !== element);
focusElements.push(element);
// Just add event since it will de-duplicate
window.addEventListener('focusin', syncFocus);
window.addEventListener('keydown', onWindowKeyDown, true);
syncFocus();
}
// Always return unregister function
return () => {
lastFocusElement = null;
focusElements = focusElements.filter(ele => ele !== element);
idToElementMap.delete(id);
ignoredElementMap.delete(id);
if (focusElements.length === 0) {
window.removeEventListener('focusin', syncFocus);
window.removeEventListener('keydown', onWindowKeyDown, true);
}
};
}
/**
* Retry an effect until it reports ready.
* When `ready` is `false`, it will schedule one more effect cycle and call `func` again
* with the next `retryTimes`.
*/
function useRetryEffect(func, deps) {
/* eslint-disable react-hooks/exhaustive-deps */
const retryTimesRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(0);
const [retryMark, setRetryMark] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
retryTimesRef.current = 0;
}, deps);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
const [clearFn, ready] = func(retryTimesRef.current);
if (!ready) {
retryTimesRef.current += 1;
setRetryMark(count => count + 1);
}
return clearFn;
}, [...deps, retryMark]);
/* eslint-enable react-hooks/exhaustive-deps */
}
/**
* Lock focus within an element.
* When locked, focus will be restricted to focusable elements within the specified element.
* If multiple elements are locked, only the last locked element will be effective.
* @returns A function to mark an element as ignored, which will temporarily allow focus on that element even if it's outside the locked area.
*/
function useLockFocus(lock, getElement) {
const id = useId();
const getElementRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(getElement);
getElementRef.current = getElement;
const lockEffect = retryTimes => {
if (!lock) {
return [undefined, true];
}
const element = getElementRef.current();
if (element) {
return [lockFocus(element, id), true];
}
return [undefined, retryTimes >= 1];
};
useRetryEffect(lockEffect, [id, lock]);
const ignoreElement = ele => {
if (ele) {
// Set the ignored element using stable ID
ignoredElementMap.set(id, ele);
}
};
return [ignoreElement];
}
;// ./node_modules/@rc-component/dialog/es/Dialog/Content/MemoChildren.js
/* harmony default export */ var MemoChildren = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo(({
children
}) => children, (_, {
shouldUpdate
}) => !shouldUpdate));
;// ./node_modules/@rc-component/dialog/es/Dialog/Content/Panel.js
function Panel_extends() { Panel_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Panel_extends.apply(this, arguments); }
const Panel = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
prefixCls,
className,
style,
title,
ariaId,
footer,
closable,
closeIcon,
onClose,
children,
bodyStyle,
bodyProps,
modalRender,
onMouseDown,
onMouseUp,
holderRef,
visible,
forceRender,
width,
height,
classNames: modalClassNames,
styles: modalStyles,
isFixedPos,
focusTrap
} = props;
// ================================= Refs =================================
const {
panel: panelRef
} = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(RefContext);
const internalRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const mergedRef = (0,es_ref.useComposeRef)(holderRef, panelRef, internalRef);
const [ignoreElement] = useLockFocus(visible && isFixedPos && focusTrap !== false, () => internalRef.current);
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useImperativeHandle(ref, () => ({
focus: () => {
internalRef.current?.focus({
preventScroll: true
});
}
}));
// ================================ Style =================================
const contentStyle = {};
if (width !== undefined) {
contentStyle.width = width;
}
if (height !== undefined) {
contentStyle.height = height;
}
// ================================ Render ================================
const footerNode = footer ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-footer`, modalClassNames?.footer),
style: {
...modalStyles?.footer
}
}, footer) : null;
const headerNode = title ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-header`, modalClassNames?.header),
style: {
...modalStyles?.header
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-title`, modalClassNames?.title),
id: ariaId,
style: {
...modalStyles?.title
}
}, title)) : null;
const closableObj = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (typeof closable === 'object' && closable !== null) {
return closable;
}
if (closable) {
return {
closeIcon: closeIcon ?? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: `${prefixCls}-close-x`
})
};
}
return {};
}, [closable, closeIcon, prefixCls]);
const ariaProps = (0,pickAttrs["default"])(closableObj, true);
const closeBtnIsDisabled = typeof closable === 'object' && closable.disabled;
const closerNode = closable ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", Panel_extends({
type: "button",
onClick: onClose,
"aria-label": "Close"
}, ariaProps, {
className: `${prefixCls}-close`,
disabled: closeBtnIsDisabled
}), closableObj.closeIcon) : null;
const content = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-container`, modalClassNames?.container),
style: modalStyles?.container
}, closerNode, headerNode, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", Panel_extends({
className: (0,clsx.clsx)(`${prefixCls}-body`, modalClassNames?.body),
style: {
...bodyStyle,
...modalStyles?.body
}
}, bodyProps), children), footerNode);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
key: "dialog-element",
role: "dialog",
"aria-labelledby": title ? ariaId : null,
"aria-modal": "true",
ref: mergedRef,
style: {
...style,
...contentStyle
},
className: (0,clsx.clsx)(prefixCls, className),
onMouseDown: onMouseDown,
onMouseUp: onMouseUp,
tabIndex: -1,
onFocus: e => {
ignoreElement(e.target);
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(MemoChildren, {
shouldUpdate: visible || forceRender
}, modalRender ? modalRender(content) : content));
});
if (true) {
Panel.displayName = 'Panel';
}
/* harmony default export */ var Content_Panel = (Panel);
;// ./node_modules/@rc-component/dialog/es/Dialog/Content/index.js
function Content_extends() { Content_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Content_extends.apply(this, arguments); }
const Content = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls,
title,
style,
className,
visible,
forceRender,
destroyOnHidden,
motionName,
ariaId,
onVisibleChanged,
mousePosition
} = props;
const dialogRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const panelRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
// ============================== Refs ==============================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
...panelRef.current,
inMotion: dialogRef.current.inMotion,
enableMotion: dialogRef.current.enableMotion
}));
// ============================= Style ==============================
const [transformOrigin, setTransformOrigin] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState();
const contentStyle = {};
if (transformOrigin) {
contentStyle.transformOrigin = transformOrigin;
}
function onPrepare() {
if (!dialogRef.current?.nativeElement) {
return;
}
const elementOffset = offset(dialogRef.current.nativeElement);
setTransformOrigin(mousePosition && (mousePosition.x || mousePosition.y) ? `${mousePosition.x - elementOffset.left}px ${mousePosition.y - elementOffset.top}px` : '');
}
// ============================= Render =============================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es["default"], {
visible: visible,
onVisibleChanged: onVisibleChanged,
onAppearPrepare: onPrepare,
onEnterPrepare: onPrepare,
forceRender: forceRender,
motionName: motionName,
removeOnLeave: destroyOnHidden,
ref: dialogRef
}, ({
className: motionClassName,
style: motionStyle
}, motionRef) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Content_Panel, Content_extends({}, props, {
ref: panelRef,
title: title,
ariaId: ariaId,
prefixCls: prefixCls,
holderRef: motionRef,
style: {
...motionStyle,
...style,
...contentStyle
},
className: (0,clsx.clsx)(className, motionClassName)
})));
});
if (true) {
Content.displayName = 'Content';
}
/* harmony default export */ var Dialog_Content = (Content);
;// ./node_modules/@rc-component/dialog/es/Dialog/Mask.js
function Dialog_Mask_extends() { Dialog_Mask_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Dialog_Mask_extends.apply(this, arguments); }
const Mask_Mask = props => {
const {
prefixCls,
style,
visible,
maskProps,
motionName,
className
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es["default"], {
key: "mask",
visible: visible,
motionName: motionName,
leavedClassName: `${prefixCls}-mask-hidden`
}, ({
className: motionClassName,
style: motionStyle
}, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", Dialog_Mask_extends({
ref: ref,
style: {
...motionStyle,
...style
},
className: (0,clsx.clsx)(`${prefixCls}-mask`, motionClassName, className)
}, maskProps)));
};
/* harmony default export */ var Dialog_Mask = (Mask_Mask);
;// ./node_modules/@rc-component/dialog/es/Dialog/index.js
function Dialog_extends() { Dialog_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Dialog_extends.apply(this, arguments); }
const Dialog = props => {
const {
prefixCls = 'rc-dialog',
zIndex,
visible = false,
focusTriggerAfterClose = true,
wrapStyle,
wrapClassName,
wrapProps,
onClose,
afterOpenChange,
afterClose,
// Dialog
transitionName,
animation,
closable = true,
// Mask
mask = true,
maskTransitionName,
maskAnimation,
maskClosable = true,
maskStyle,
maskProps,
rootClassName,
rootStyle,
classNames: modalClassNames,
styles: modalStyles
} = props;
if (true) {
['wrapStyle', 'bodyStyle', 'maskStyle'].forEach(prop => {
(0,warning.warning)(!(prop in props), `${prop} is deprecated, please use styles instead.`);
});
if ('wrapClassName' in props) {
(0,warning.warning)(false, `wrapClassName is deprecated, please use classNames instead.`);
}
}
const lastOutSideActiveElementRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const wrapperRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const contentRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const [animatedVisible, setAnimatedVisible] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(visible);
const [isFixedPos, setIsFixedPos] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
// ========================== Init ==========================
const ariaId = useId();
function saveLastOutSideActiveElementRef() {
if (!(0,contains["default"])(wrapperRef.current, document.activeElement)) {
lastOutSideActiveElementRef.current = document.activeElement;
}
}
function focusDialogContent() {
if (!(0,contains["default"])(wrapperRef.current, document.activeElement)) {
contentRef.current?.focus();
}
}
// ========================= Events =========================
// Close action will trigger by:
// 1. When hide motion end
// 2. Controlled `open` to `false` immediately after set to `true` which will not trigger motion
function doClose() {
// Clean up scroll bar & focus back
setAnimatedVisible(false);
if (mask && lastOutSideActiveElementRef.current && focusTriggerAfterClose) {
try {
lastOutSideActiveElementRef.current.focus({
preventScroll: true
});
} catch (e) {
// Do nothing
}
lastOutSideActiveElementRef.current = null;
}
// Trigger afterClose only when change visible from true to false
if (animatedVisible) {
afterClose?.();
}
}
function onDialogVisibleChanged(newVisible) {
// Try to focus
if (newVisible) {
focusDialogContent();
} else {
doClose();
}
afterOpenChange?.(newVisible);
}
function onInternalClose(e) {
onClose?.(e);
}
// >>> Content
const mouseDownOnMaskRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
// >>> Wrapper
// Close only when element not on dialog
let onWrapperClick = null;
if (maskClosable) {
onWrapperClick = e => {
if (wrapperRef.current === e.target && mouseDownOnMaskRef.current) {
onInternalClose(e);
}
};
}
function onWrapperMouseDown(e) {
mouseDownOnMaskRef.current = e.target === wrapperRef.current;
}
// ========================= Effect =========================
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (visible) {
mouseDownOnMaskRef.current = false;
setAnimatedVisible(true);
saveLastOutSideActiveElementRef();
// Calc the position style
if (wrapperRef.current) {
const computedWrapStyle = getComputedStyle(wrapperRef.current);
setIsFixedPos(computedWrapStyle.position === 'fixed');
}
} else if (animatedVisible && contentRef.current.enableMotion() && !contentRef.current.inMotion()) {
doClose();
}
}, [visible]);
const mergedStyle = {
zIndex,
...wrapStyle,
...modalStyles?.wrapper,
display: !animatedVisible ? 'none' : null
};
// ========================= Render =========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", Dialog_extends({
className: (0,clsx.clsx)(`${prefixCls}-root`, rootClassName),
style: rootStyle
}, (0,pickAttrs["default"])(props, {
data: true
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Dialog_Mask, {
prefixCls: prefixCls,
visible: mask && visible,
motionName: getMotionName(prefixCls, maskTransitionName, maskAnimation),
style: {
zIndex,
...maskStyle,
...modalStyles?.mask
},
maskProps: maskProps,
className: modalClassNames?.mask
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", Dialog_extends({
className: (0,clsx.clsx)(`${prefixCls}-wrap`, wrapClassName, modalClassNames?.wrapper),
ref: wrapperRef,
onClick: onWrapperClick,
onMouseDown: onWrapperMouseDown,
style: mergedStyle
}, wrapProps), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Dialog_Content, Dialog_extends({}, props, {
isFixedPos: isFixedPos,
ref: contentRef,
closable: closable,
ariaId: ariaId,
prefixCls: prefixCls,
visible: visible && animatedVisible,
onClose: onInternalClose,
onVisibleChanged: onDialogVisibleChanged,
motionName: getMotionName(prefixCls, transitionName, animation)
}))));
};
/* harmony default export */ var es_Dialog = (Dialog);
;// ./node_modules/@rc-component/dialog/es/DialogWrap.js
function DialogWrap_extends() { DialogWrap_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return DialogWrap_extends.apply(this, arguments); }
// fix issue #10656
/*
* getContainer remarks
* Custom container should not be return, because in the Portal component, it will remove the
* return container element here, if the custom container is the only child of it's component,
* like issue #10656, It will has a conflict with removeChild method in react-dom.
* So here should add a child (div element) to custom container.
* */
const DialogWrap = props => {
const {
visible,
getContainer,
forceRender,
destroyOnHidden = false,
afterClose,
closable,
panelRef,
keyboard = true,
onClose
} = props;
const [animatedVisible, setAnimatedVisible] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(visible);
const refContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
panel: panelRef
}), [panelRef]);
const onEsc = ({
top,
event
}) => {
if (top && keyboard) {
event.stopPropagation();
onClose?.(event);
return;
}
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (visible) {
setAnimatedVisible(true);
}
}, [visible]);
// Destroy on close will remove wrapped div
if (!forceRender && destroyOnHidden && !animatedVisible) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RefContext.Provider, {
value: refContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(portal_es, {
open: visible || forceRender || animatedVisible,
onEsc: onEsc,
autoDestroy: false,
getContainer: getContainer,
autoLock: visible || animatedVisible
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Dialog, DialogWrap_extends({}, props, {
destroyOnHidden: destroyOnHidden,
afterClose: () => {
const closableObj = closable && typeof closable === 'object' ? closable : {};
const {
afterClose: closableAfterClose
} = closableObj || {};
closableAfterClose?.();
afterClose?.();
setAnimatedVisible(false);
}
}))));
};
if (true) {
DialogWrap.displayName = 'Dialog';
}
/* harmony default export */ var es_DialogWrap = (DialogWrap);
;// ./node_modules/@rc-component/dialog/es/index.js
/* harmony default export */ var dialog_es = (es_DialogWrap);
;// ./node_modules/@rc-component/form/es/FieldContext.js
const HOOK_MARK = 'RC_FORM_INTERNAL_HOOKS';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const warningFunc = () => {
(0,warning["default"])(false, 'Can not find FormContext. Please make sure you wrap Field under Form.');
};
const FieldContext_Context = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({
getFieldValue: warningFunc,
getFieldsValue: warningFunc,
getFieldError: warningFunc,
getFieldWarning: warningFunc,
getFieldsError: warningFunc,
isFieldsTouched: warningFunc,
isFieldTouched: warningFunc,
isFieldValidating: warningFunc,
isFieldsValidating: warningFunc,
resetFields: warningFunc,
setFields: warningFunc,
setFieldValue: warningFunc,
setFieldsValue: warningFunc,
validateFields: warningFunc,
submit: warningFunc,
getInternalHooks: () => {
warningFunc();
return {
dispatch: warningFunc,
initEntityValue: warningFunc,
registerField: warningFunc,
useSubscribe: warningFunc,
setInitialValues: warningFunc,
destroyForm: warningFunc,
setCallbacks: warningFunc,
registerWatch: warningFunc,
getFields: warningFunc,
setValidateMessages: warningFunc,
setPreserve: warningFunc,
getInitialValue: warningFunc
};
}
});
/* harmony default export */ var FieldContext = (FieldContext_Context);
;// ./node_modules/@rc-component/form/es/ListContext.js
const ListContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
/* harmony default export */ var es_ListContext = (ListContext);
;// ./node_modules/@rc-component/form/es/utils/typeUtil.js
function typeUtil_toArray(value) {
if (value === undefined || value === null) {
return [];
}
return Array.isArray(value) ? value : [value];
}
function isFormInstance(form) {
return form && !!form._init;
}
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
var objectSpread2 = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/objectSpread2.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
var esm_typeof = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/typeof.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
var defineProperty = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
;// ./node_modules/@rc-component/async-validator/es/messages.js
function newMessages() {
return {
default: 'Validation error on field %s',
required: '%s is required',
enum: '%s must be one of %s',
whitespace: '%s cannot be empty',
date: {
format: '%s date %s is invalid for format %s',
parse: '%s date could not be parsed, %s is invalid ',
invalid: '%s date %s is invalid'
},
types: {
string: '%s is not a %s',
method: '%s is not a %s (function)',
array: '%s is not an %s',
object: '%s is not an %s',
number: '%s is not a %s',
date: '%s is not a %s',
boolean: '%s is not a %s',
integer: '%s is not an %s',
float: '%s is not a %s',
regexp: '%s is not a valid %s',
email: '%s is not a valid %s',
tel: '%s is not a valid %s',
url: '%s is not a valid %s',
hex: '%s is not a valid %s'
},
string: {
len: '%s must be exactly %s characters',
min: '%s must be at least %s characters',
max: '%s cannot be longer than %s characters',
range: '%s must be between %s and %s characters'
},
number: {
len: '%s must equal %s',
min: '%s cannot be less than %s',
max: '%s cannot be greater than %s',
range: '%s must be between %s and %s'
},
array: {
len: '%s must be exactly %s in length',
min: '%s cannot be less than %s in length',
max: '%s cannot be greater than %s in length',
range: '%s must be between %s and %s in length'
},
pattern: {
mismatch: '%s value %s does not match pattern %s'
},
clone: function clone() {
var cloned = JSON.parse(JSON.stringify(this));
cloned.clone = this.clone;
return cloned;
}
};
}
var messages_messages = newMessages();
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
var assertThisInitialized = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createSuper.js
var createSuper = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/createSuper.js");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
var setPrototypeOf = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js");
;// ./node_modules/@babel/runtime/helpers/esm/isNativeFunction.js
function _isNativeFunction(t) {
try {
return -1 !== Function.toString.call(t).indexOf("[native code]");
} catch (n) {
return "function" == typeof t;
}
}
;// ./node_modules/@babel/runtime/helpers/esm/construct.js
function _construct(t, e, r) {
if ((0,isNativeReflectConstruct["default"])()) return Reflect.construct.apply(null, arguments);
var o = [null];
o.push.apply(o, e);
var p = new (t.bind.apply(t, o))();
return r && (0,setPrototypeOf["default"])(p, r.prototype), p;
}
;// ./node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
function _wrapNativeSuper(t) {
var r = "function" == typeof Map ? new Map() : void 0;
return _wrapNativeSuper = function _wrapNativeSuper(t) {
if (null === t || !_isNativeFunction(t)) return t;
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
if (void 0 !== r) {
if (r.has(t)) return r.get(t);
r.set(t, Wrapper);
}
function Wrapper() {
return _construct(t, arguments, (0,getPrototypeOf["default"])(this).constructor);
}
return Wrapper.prototype = Object.create(t.prototype, {
constructor: {
value: Wrapper,
enumerable: !1,
writable: !0,
configurable: !0
}
}), (0,setPrototypeOf["default"])(Wrapper, t);
}, _wrapNativeSuper(t);
}
;// ./node_modules/@rc-component/async-validator/es/util.js
/* eslint no-console:0 */
var formatRegExp = /%[sdj%]/g;
var util_warning = function warning() {};
// don't print warning message when in production env or node runtime
if (typeof process !== 'undefined' && process.env && "development" !== 'production' && typeof window !== 'undefined' && typeof document !== 'undefined') {
util_warning = function warning(type, errors) {
if (typeof console !== 'undefined' && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === 'undefined') {
if (errors.every(function (e) {
return typeof e === 'string';
})) {
console.warn(type, errors);
}
}
};
}
function convertFieldsError(errors) {
if (!errors || !errors.length) return null;
var fields = {};
errors.forEach(function (error) {
var field = error.field;
fields[field] = fields[field] || [];
fields[field].push(error);
});
return fields;
}
function format(template) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var i = 0;
var len = args.length;
if (typeof template === 'function') {
// eslint-disable-next-line prefer-spread
return template.apply(null, args);
}
if (typeof template === 'string') {
var str = template.replace(formatRegExp, function (x) {
if (x === '%%') {
return '%';
}
if (i >= len) {
return x;
}
switch (x) {
case '%s':
return String(args[i++]);
case '%d':
return Number(args[i++]);
case '%j':
try {
return JSON.stringify(args[i++]);
} catch (_) {
return '[Circular]';
}
// removed by dead control flow
default:
return x;
}
});
return str;
}
return template;
}
function isNativeStringType(type) {
return type === 'string' || type === 'url' || type === 'hex' || type === 'email' || type === 'date' || type === 'pattern' || type === 'tel';
}
function isEmptyValue(value, type) {
if (value === undefined || value === null) {
return true;
}
if (type === 'array' && Array.isArray(value) && !value.length) {
return true;
}
if (isNativeStringType(type) && typeof value === 'string' && !value) {
return true;
}
return false;
}
function isEmptyObject(obj) {
return Object.keys(obj).length === 0;
}
function asyncParallelArray(arr, func, callback) {
var results = [];
var total = 0;
var arrLength = arr.length;
function count(errors) {
results.push.apply(results, (0,toConsumableArray["default"])(errors || []));
total++;
if (total === arrLength) {
callback(results);
}
}
arr.forEach(function (a) {
func(a, count);
});
}
function asyncSerialArray(arr, func, callback) {
var index = 0;
var arrLength = arr.length;
function next(errors) {
if (errors && errors.length) {
callback(errors);
return;
}
var original = index;
index = index + 1;
if (original < arrLength) {
func(arr[original], next);
} else {
callback([]);
}
}
next([]);
}
function flattenObjArr(objArr) {
var ret = [];
Object.keys(objArr).forEach(function (k) {
ret.push.apply(ret, (0,toConsumableArray["default"])(objArr[k] || []));
});
return ret;
}
var AsyncValidationError = /*#__PURE__*/function (_Error) {
(0,inherits["default"])(AsyncValidationError, _Error);
var _super = (0,createSuper["default"])(AsyncValidationError);
function AsyncValidationError(errors, fields) {
var _this;
(0,classCallCheck["default"])(this, AsyncValidationError);
_this = _super.call(this, 'Async Validation Error');
(0,defineProperty["default"])((0,assertThisInitialized["default"])(_this), "errors", void 0);
(0,defineProperty["default"])((0,assertThisInitialized["default"])(_this), "fields", void 0);
_this.errors = errors;
_this.fields = fields;
return _this;
}
return (0,createClass["default"])(AsyncValidationError);
}( /*#__PURE__*/_wrapNativeSuper(Error));
function asyncMap(objArr, option, func, callback, source) {
if (option.first) {
var _pending = new Promise(function (resolve, reject) {
var next = function next(errors) {
callback(errors);
return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
};
var flattenArr = flattenObjArr(objArr);
asyncSerialArray(flattenArr, func, next);
});
_pending.catch(function (e) {
return e;
});
return _pending;
}
var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
var objArrKeys = Object.keys(objArr);
var objArrLength = objArrKeys.length;
var total = 0;
var results = [];
var pending = new Promise(function (resolve, reject) {
var next = function next(errors) {
// eslint-disable-next-line prefer-spread
results.push.apply(results, errors);
total++;
if (total === objArrLength) {
callback(results);
return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
}
};
if (!objArrKeys.length) {
callback(results);
resolve(source);
}
objArrKeys.forEach(function (key) {
var arr = objArr[key];
if (firstFields.indexOf(key) !== -1) {
asyncSerialArray(arr, func, next);
} else {
asyncParallelArray(arr, func, next);
}
});
});
pending.catch(function (e) {
return e;
});
return pending;
}
function isErrorObj(obj) {
return !!(obj && obj.message !== undefined);
}
function getValue(value, path) {
var v = value;
for (var i = 0; i < path.length; i++) {
if (v == undefined) {
return v;
}
v = v[path[i]];
}
return v;
}
function complementError(rule, source) {
return function (oe) {
var fieldValue;
if (rule.fullFields) {
fieldValue = getValue(source, rule.fullFields);
} else {
fieldValue = source[oe.field || rule.fullField];
}
if (isErrorObj(oe)) {
oe.field = oe.field || rule.fullField;
oe.fieldValue = fieldValue;
return oe;
}
return {
message: typeof oe === 'function' ? oe() : oe,
fieldValue: fieldValue,
field: oe.field || rule.fullField
};
};
}
function deepMerge(target, source) {
if (source) {
for (var s in source) {
if (source.hasOwnProperty(s)) {
var value = source[s];
if ((0,esm_typeof["default"])(value) === 'object' && (0,esm_typeof["default"])(target[s]) === 'object') {
target[s] = (0,objectSpread2["default"])((0,objectSpread2["default"])({}, target[s]), value);
} else {
target[s] = value;
}
}
}
}
return target;
}
;// ./node_modules/@rc-component/async-validator/es/rule/enum.js
var ENUM = 'enum';
var enumerable = function enumerable(rule, value, source, errors, options) {
rule[ENUM] = Array.isArray(rule[ENUM]) ? rule[ENUM] : [];
if (rule[ENUM].indexOf(value) === -1) {
errors.push(format(options.messages[ENUM], rule.fullField, rule[ENUM].join(', ')));
}
};
/* harmony default export */ var rule_enum = (enumerable);
;// ./node_modules/@rc-component/async-validator/es/rule/pattern.js
var pattern = function pattern(rule, value, source, errors, options) {
if (rule.pattern) {
if (rule.pattern instanceof RegExp) {
// if a RegExp instance is passed, reset `lastIndex` in case its `global`
// flag is accidentally set to `true`, which in a validation scenario
// is not necessary and the result might be misleading
rule.pattern.lastIndex = 0;
if (!rule.pattern.test(value)) {
errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
}
} else if (typeof rule.pattern === 'string') {
var _pattern = new RegExp(rule.pattern);
if (!_pattern.test(value)) {
errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
}
}
}
};
/* harmony default export */ var rule_pattern = (pattern);
;// ./node_modules/@rc-component/async-validator/es/rule/range.js
var range = function range(rule, value, source, errors, options) {
var len = typeof rule.len === 'number';
var min = typeof rule.min === 'number';
var max = typeof rule.max === 'number';
// 正则匹配码点范围从U+010000一直到U+10FFFF的文字(补充平面Supplementary Plane)
var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
var val = value;
var key = null;
var num = typeof value === 'number';
var str = typeof value === 'string';
var arr = Array.isArray(value);
if (num) {
key = 'number';
} else if (str) {
key = 'string';
} else if (arr) {
key = 'array';
}
// if the value is not of a supported type for range validation
// the validation rule rule should use the
// type property to also test for a particular type
if (!key) {
return false;
}
if (arr) {
val = value.length;
}
if (str) {
// 处理码点大于U+010000的文字length属性不准确的bug,如"𠮷𠮷𠮷".length !== 3
val = value.replace(spRegexp, '_').length;
}
if (len) {
if (val !== rule.len) {
errors.push(format(options.messages[key].len, rule.fullField, rule.len));
}
} else if (min && !max && val < rule.min) {
errors.push(format(options.messages[key].min, rule.fullField, rule.min));
} else if (max && !min && val > rule.max) {
errors.push(format(options.messages[key].max, rule.fullField, rule.max));
} else if (min && max && (val < rule.min || val > rule.max)) {
errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
}
};
/* harmony default export */ var rule_range = (range);
;// ./node_modules/@rc-component/async-validator/es/rule/required.js
var required = function required(rule, value, source, errors, options, type) {
if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type || rule.type))) {
errors.push(format(options.messages.required, rule.fullField));
}
};
/* harmony default export */ var rule_required = (required);
;// ./node_modules/@rc-component/async-validator/es/rule/url.js
// https://github.com/kevva/url-regex/blob/master/index.js
var urlReg;
/* harmony default export */ var rule_url = (function () {
if (urlReg) {
return urlReg;
}
var word = '[a-fA-F\\d:]';
var b = function b(options) {
return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=".concat(word, ")|(?<=").concat(word, ")(?=\\s|$))") : '';
};
var v4 = '(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}';
var v6seg = '[a-fA-F\\d]{1,4}';
var v6List = ["(?:".concat(v6seg, ":){7}(?:").concat(v6seg, "|:)"), // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
"(?:".concat(v6seg, ":){6}(?:").concat(v4, "|:").concat(v6seg, "|:)"), // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::
"(?:".concat(v6seg, ":){5}(?::").concat(v4, "|(?::").concat(v6seg, "){1,2}|:)"), // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::
"(?:".concat(v6seg, ":){4}(?:(?::").concat(v6seg, "){0,1}:").concat(v4, "|(?::").concat(v6seg, "){1,3}|:)"), // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::
"(?:".concat(v6seg, ":){3}(?:(?::").concat(v6seg, "){0,2}:").concat(v4, "|(?::").concat(v6seg, "){1,4}|:)"), // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::
"(?:".concat(v6seg, ":){2}(?:(?::").concat(v6seg, "){0,3}:").concat(v4, "|(?::").concat(v6seg, "){1,5}|:)"), // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::
"(?:".concat(v6seg, ":){1}(?:(?::").concat(v6seg, "){0,4}:").concat(v4, "|(?::").concat(v6seg, "){1,6}|:)"), // 1:: 1::3:4:5:6:7:8 1::8 1::
"(?::(?:(?::".concat(v6seg, "){0,5}:").concat(v4, "|(?::").concat(v6seg, "){1,7}|:))") // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::
];
var v6Eth0 = "(?:%[0-9a-zA-Z]{1,})?"; // %eth0 %1
var v6 = "(?:".concat(v6List.join('|'), ")").concat(v6Eth0);
// Pre-compile only the exact regexes because adding a global flag make regexes stateful
var v46Exact = new RegExp("(?:^".concat(v4, "$)|(?:^").concat(v6, "$)"));
var v4exact = new RegExp("^".concat(v4, "$"));
var v6exact = new RegExp("^".concat(v6, "$"));
var ip = function ip(options) {
return options && options.exact ? v46Exact : new RegExp("(?:".concat(b(options)).concat(v4).concat(b(options), ")|(?:").concat(b(options)).concat(v6).concat(b(options), ")"), 'g');
};
ip.v4 = function (options) {
return options && options.exact ? v4exact : new RegExp("".concat(b(options)).concat(v4).concat(b(options)), 'g');
};
ip.v6 = function (options) {
return options && options.exact ? v6exact : new RegExp("".concat(b(options)).concat(v6).concat(b(options)), 'g');
};
var protocol = "(?:(?:[a-z]+:)?//)";
var auth = '(?:\\S+(?::\\S*)?@)?';
var ipv4 = ip.v4().source;
var ipv6 = ip.v6().source;
var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
var port = '(?::\\d{2,5})?';
var path = '(?:[/?#][^\\s"]*)?';
var regex = "(?:".concat(protocol, "|www\\.)").concat(auth, "(?:localhost|").concat(ipv4, "|").concat(ipv6, "|").concat(host).concat(domain).concat(tld, ")").concat(port).concat(path);
urlReg = new RegExp("(?:^".concat(regex, "$)"), 'i');
return urlReg;
});
(Object.getOwnPropertyDescriptor(rule_url, "name") || {}).writable || Object.defineProperty(rule_url, "name", { value: "default", configurable: true });
;// ./node_modules/@rc-component/async-validator/es/rule/type.js
/* eslint max-len:0 */
var type_pattern = {
// http://emailregex.com/
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
// url: new RegExp(
// '^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$',
// 'i',
// ),
/**
* Phone number regex, support country code, brackets, spaces, and dashes (or non-breaking hyphen \u2011).
* @see https://regexr.com/3c53v
* @see https://ihateregex.io/expr/phone/
* @see https://developers.google.com/style/phone-numbers using non-breaking hyphen \u2011
*/
tel: /^(\+[0-9]{1,3}[-\s\u2011]?)?(\([0-9]{1,4}\)[-\s\u2011]?)?([0-9]+[-\s\u2011]?)*[0-9]+$/,
hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
};
var types = {
integer: function integer(value) {
return types.number(value) && parseInt(value, 10) === value;
},
float: function float(value) {
return types.number(value) && !types.integer(value);
},
array: function array(value) {
return Array.isArray(value);
},
regexp: function regexp(value) {
if (value instanceof RegExp) {
return true;
}
try {
return !!new RegExp(value);
} catch (e) {
return false;
}
},
date: function date(value) {
return typeof value.getTime === 'function' && typeof value.getMonth === 'function' && typeof value.getYear === 'function' && !isNaN(value.getTime());
},
number: function number(value) {
if (isNaN(value)) {
return false;
}
return typeof value === 'number';
},
object: function object(value) {
return (0,esm_typeof["default"])(value) === 'object' && !types.array(value);
},
method: function method(value) {
return typeof value === 'function';
},
email: function email(value) {
return typeof value === 'string' && value.length <= 320 && !!value.match(type_pattern.email);
},
tel: function tel(value) {
return typeof value === 'string' && value.length <= 32 && !!value.match(type_pattern.tel);
},
url: function url(value) {
return typeof value === 'string' && value.length <= 2048 && !!value.match(rule_url());
},
hex: function hex(value) {
return typeof value === 'string' && !!value.match(type_pattern.hex);
}
};
var type = function type(rule, value, source, errors, options) {
if (rule.required && value === undefined) {
rule_required(rule, value, source, errors, options);
return;
}
var custom = ['integer', 'float', 'array', 'regexp', 'object', 'method', 'email', 'tel', 'number', 'date', 'url', 'hex'];
var ruleType = rule.type;
if (custom.indexOf(ruleType) > -1) {
if (!types[ruleType](value)) {
errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
}
// straight typeof check
} else if (ruleType && (0,esm_typeof["default"])(value) !== rule.type) {
errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
}
};
/* harmony default export */ var rule_type = (type);
;// ./node_modules/@rc-component/async-validator/es/rule/whitespace.js
/**
* Rule for validating whitespace.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param source The source object being validated.
* @param errors An array of errors that this rule may add
* validation errors to.
* @param options The validation options.
* @param options.messages The validation messages.
*/
var whitespace = function whitespace(rule, value, source, errors, options) {
if (/^\s+$/.test(value) || value === '') {
errors.push(format(options.messages.whitespace, rule.fullField));
}
};
/* harmony default export */ var rule_whitespace = (whitespace);
;// ./node_modules/@rc-component/async-validator/es/rule/index.js
/* harmony default export */ var es_rule = ({
required: rule_required,
whitespace: rule_whitespace,
type: rule_type,
range: rule_range,
enum: rule_enum,
pattern: rule_pattern
});
;// ./node_modules/@rc-component/async-validator/es/validator/any.js
var any = function any(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if (isEmptyValue(value) && !rule.required) {
return callback();
}
es_rule.required(rule, value, source, errors, options);
}
callback(errors);
};
/* harmony default export */ var validator_any = (any);
;// ./node_modules/@rc-component/async-validator/es/validator/array.js
var array = function array(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if ((value === undefined || value === null) && !rule.required) {
return callback();
}
es_rule.required(rule, value, source, errors, options, 'array');
if (value !== undefined && value !== null) {
es_rule.type(rule, value, source, errors, options);
es_rule.range(rule, value, source, errors, options);
}
}
callback(errors);
};
/* harmony default export */ var validator_array = (array);
;// ./node_modules/@rc-component/async-validator/es/validator/boolean.js
var boolean_boolean = function boolean(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if (isEmptyValue(value) && !rule.required) {
return callback();
}
es_rule.required(rule, value, source, errors, options);
if (value !== undefined) {
es_rule.type(rule, value, source, errors, options);
}
}
callback(errors);
};
/* harmony default export */ var validator_boolean = (boolean_boolean);
;// ./node_modules/@rc-component/async-validator/es/validator/date.js
var date = function date(rule, value, callback, source, options) {
// console.log('integer rule called %j', rule);
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
// console.log('validate on %s value', value);
if (validate) {
if (isEmptyValue(value, 'date') && !rule.required) {
return callback();
}
es_rule.required(rule, value, source, errors, options);
if (!isEmptyValue(value, 'date')) {
var dateObject;
if (value instanceof Date) {
dateObject = value;
} else {
dateObject = new Date(value);
}
es_rule.type(rule, dateObject, source, errors, options);
if (dateObject) {
es_rule.range(rule, dateObject.getTime(), source, errors, options);
}
}
}
callback(errors);
};
/* harmony default export */ var validator_date = (date);
;// ./node_modules/@rc-component/async-validator/es/validator/enum.js
var enum_ENUM = 'enum';
var enum_enumerable = function enumerable(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if (isEmptyValue(value) && !rule.required) {
return callback();
}
es_rule.required(rule, value, source, errors, options);
if (value !== undefined) {
es_rule[enum_ENUM](rule, value, source, errors, options);
}
}
callback(errors);
};
/* harmony default export */ var validator_enum = (enum_enumerable);
;// ./node_modules/@rc-component/async-validator/es/validator/float.js
var floatFn = function floatFn(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if (isEmptyValue(value) && !rule.required) {
return callback();
}
es_rule.required(rule, value, source, errors, options);
if (value !== undefined) {
es_rule.type(rule, value, source, errors, options);
es_rule.range(rule, value, source, errors, options);
}
}
callback(errors);
};
/* harmony default export */ var validator_float = (floatFn);
;// ./node_modules/@rc-component/async-validator/es/validator/integer.js
var integer = function integer(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if (isEmptyValue(value) && !rule.required) {
return callback();
}
es_rule.required(rule, value, source, errors, options);
if (value !== undefined) {
es_rule.type(rule, value, source, errors, options);
es_rule.range(rule, value, source, errors, options);
}
}
callback(errors);
};
/* harmony default export */ var validator_integer = (integer);
;// ./node_modules/@rc-component/async-validator/es/validator/method.js
var method = function method(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if (isEmptyValue(value) && !rule.required) {
return callback();
}
es_rule.required(rule, value, source, errors, options);
if (value !== undefined) {
es_rule.type(rule, value, source, errors, options);
}
}
callback(errors);
};
/* harmony default export */ var validator_method = (method);
;// ./node_modules/@rc-component/async-validator/es/validator/number.js
var number = function number(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if (value === '') {
// eslint-disable-next-line no-param-reassign
value = undefined;
}
if (isEmptyValue(value) && !rule.required) {
return callback();
}
es_rule.required(rule, value, source, errors, options);
if (value !== undefined) {
es_rule.type(rule, value, source, errors, options);
es_rule.range(rule, value, source, errors, options);
}
}
callback(errors);
};
/* harmony default export */ var validator_number = (number);
;// ./node_modules/@rc-component/async-validator/es/validator/object.js
var object = function object(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if (isEmptyValue(value) && !rule.required) {
return callback();
}
es_rule.required(rule, value, source, errors, options);
if (value !== undefined) {
es_rule.type(rule, value, source, errors, options);
}
}
callback(errors);
};
/* harmony default export */ var validator_object = (object);
;// ./node_modules/@rc-component/async-validator/es/validator/pattern.js
var pattern_pattern = function pattern(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if (isEmptyValue(value, 'string') && !rule.required) {
return callback();
}
es_rule.required(rule, value, source, errors, options);
if (!isEmptyValue(value, 'string')) {
es_rule.pattern(rule, value, source, errors, options);
}
}
callback(errors);
};
/* harmony default export */ var validator_pattern = (pattern_pattern);
;// ./node_modules/@rc-component/async-validator/es/validator/regexp.js
var regexp = function regexp(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if (isEmptyValue(value) && !rule.required) {
return callback();
}
es_rule.required(rule, value, source, errors, options);
if (!isEmptyValue(value)) {
es_rule.type(rule, value, source, errors, options);
}
}
callback(errors);
};
/* harmony default export */ var validator_regexp = (regexp);
;// ./node_modules/@rc-component/async-validator/es/validator/required.js
var required_required = function required(rule, value, callback, source, options) {
var errors = [];
var type = Array.isArray(value) ? 'array' : (0,esm_typeof["default"])(value);
es_rule.required(rule, value, source, errors, options, type);
callback(errors);
};
/* harmony default export */ var validator_required = (required_required);
;// ./node_modules/@rc-component/async-validator/es/validator/string.js
var string = function string(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if (isEmptyValue(value, 'string') && !rule.required) {
return callback();
}
es_rule.required(rule, value, source, errors, options, 'string');
if (!isEmptyValue(value, 'string')) {
es_rule.type(rule, value, source, errors, options);
es_rule.range(rule, value, source, errors, options);
es_rule.pattern(rule, value, source, errors, options);
if (rule.whitespace === true) {
es_rule.whitespace(rule, value, source, errors, options);
}
}
}
callback(errors);
};
/* harmony default export */ var validator_string = (string);
;// ./node_modules/@rc-component/async-validator/es/validator/type.js
var type_type = function type(rule, value, callback, source, options) {
var ruleType = rule.type;
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if (isEmptyValue(value, ruleType) && !rule.required) {
return callback();
}
es_rule.required(rule, value, source, errors, options, ruleType);
if (!isEmptyValue(value, ruleType)) {
es_rule.type(rule, value, source, errors, options);
}
}
callback(errors);
};
/* harmony default export */ var validator_type = (type_type);
;// ./node_modules/@rc-component/async-validator/es/validator/index.js
/* harmony default export */ var es_validator = ({
string: validator_string,
method: validator_method,
number: validator_number,
boolean: validator_boolean,
regexp: validator_regexp,
integer: validator_integer,
float: validator_float,
array: validator_array,
object: validator_object,
enum: validator_enum,
pattern: validator_pattern,
date: validator_date,
url: validator_type,
hex: validator_type,
email: validator_type,
tel: validator_type,
required: validator_required,
any: validator_any
});
;// ./node_modules/@rc-component/async-validator/es/interface.js
;// ./node_modules/@rc-component/async-validator/es/index.js
/**
* Encapsulates a validation schema.
*
* @param descriptor An object declaring validation rules
* for this schema.
*/
var Schema = /*#__PURE__*/function () {
function Schema(descriptor) {
(0,classCallCheck["default"])(this, Schema);
// ======================== Instance ========================
(0,defineProperty["default"])(this, "rules", null);
(0,defineProperty["default"])(this, "_messages", messages_messages);
this.define(descriptor);
}
(0,createClass["default"])(Schema, [{
key: "define",
value: function define(rules) {
var _this = this;
if (!rules) {
throw new Error('Cannot configure a schema with no rules');
}
if ((0,esm_typeof["default"])(rules) !== 'object' || Array.isArray(rules)) {
throw new Error('Rules must be an object');
}
this.rules = {};
Object.keys(rules).forEach(function (name) {
var item = rules[name];
_this.rules[name] = Array.isArray(item) ? item : [item];
});
}
}, {
key: "messages",
value: function messages(_messages) {
if (_messages) {
this._messages = deepMerge(newMessages(), _messages);
}
return this._messages;
}
}, {
key: "validate",
value: function validate(source_) {
var _this2 = this;
var o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var oc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};
var source = source_;
var options = o;
var callback = oc;
if (typeof options === 'function') {
callback = options;
options = {};
}
if (!this.rules || Object.keys(this.rules).length === 0) {
if (callback) {
callback(null, source);
}
return Promise.resolve(source);
}
function complete(results) {
var errors = [];
var fields = {};
function add(e) {
if (Array.isArray(e)) {
var _errors;
errors = (_errors = errors).concat.apply(_errors, (0,toConsumableArray["default"])(e));
} else {
errors.push(e);
}
}
for (var i = 0; i < results.length; i++) {
add(results[i]);
}
if (!errors.length) {
callback(null, source);
} else {
fields = convertFieldsError(errors);
callback(errors, fields);
}
}
if (options.messages) {
var messages = this.messages();
if (messages === messages_messages) {
messages = newMessages();
}
deepMerge(messages, options.messages);
options.messages = messages;
} else {
options.messages = this.messages();
}
var series = {};
var keys = options.keys || Object.keys(this.rules);
keys.forEach(function (z) {
var arr = _this2.rules[z];
var value = source[z];
arr.forEach(function (r) {
var rule = r;
if (typeof rule.transform === 'function') {
if (source === source_) {
source = (0,objectSpread2["default"])({}, source);
}
value = source[z] = rule.transform(value);
if (value !== undefined && value !== null) {
rule.type = rule.type || (Array.isArray(value) ? 'array' : (0,esm_typeof["default"])(value));
}
}
if (typeof rule === 'function') {
rule = {
validator: rule
};
} else {
rule = (0,objectSpread2["default"])({}, rule);
}
// Fill validator. Skip if nothing need to validate
rule.validator = _this2.getValidationMethod(rule);
if (!rule.validator) {
return;
}
rule.field = z;
rule.fullField = rule.fullField || z;
rule.type = _this2.getType(rule);
series[z] = series[z] || [];
series[z].push({
rule: rule,
value: value,
source: source,
field: z
});
});
});
var errorFields = {};
return asyncMap(series, options, function (data, doIt) {
var rule = data.rule;
var deep = (rule.type === 'object' || rule.type === 'array') && ((0,esm_typeof["default"])(rule.fields) === 'object' || (0,esm_typeof["default"])(rule.defaultField) === 'object');
deep = deep && (rule.required || !rule.required && data.value);
rule.field = data.field;
function addFullField(key, schema) {
return (0,objectSpread2["default"])((0,objectSpread2["default"])({}, schema), {}, {
fullField: "".concat(rule.fullField, ".").concat(key),
fullFields: rule.fullFields ? [].concat((0,toConsumableArray["default"])(rule.fullFields), [key]) : [key]
});
}
function cb() {
var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var errorList = Array.isArray(e) ? e : [e];
if (!options.suppressWarning && errorList.length) {
Schema.warning('async-validator:', errorList);
}
if (errorList.length && rule.message !== undefined && rule.message !== null) {
errorList = [].concat(rule.message);
}
// Fill error info
var filledErrors = errorList.map(complementError(rule, source));
if (options.first && filledErrors.length) {
errorFields[rule.field] = 1;
return doIt(filledErrors);
}
if (!deep) {
doIt(filledErrors);
} else {
// if rule is required but the target object
// does not exist fail at the rule level and don't
// go deeper
if (rule.required && !data.value) {
if (rule.message !== undefined) {
filledErrors = [].concat(rule.message).map(complementError(rule, source));
} else if (options.error) {
filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
}
return doIt(filledErrors);
}
var fieldsSchema = {};
if (rule.defaultField) {
Object.keys(data.value).map(function (key) {
fieldsSchema[key] = rule.defaultField;
});
}
fieldsSchema = (0,objectSpread2["default"])((0,objectSpread2["default"])({}, fieldsSchema), data.rule.fields);
var paredFieldsSchema = {};
Object.keys(fieldsSchema).forEach(function (field) {
var fieldSchema = fieldsSchema[field];
var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
});
var schema = new Schema(paredFieldsSchema);
schema.messages(options.messages);
if (data.rule.options) {
data.rule.options.messages = options.messages;
data.rule.options.error = options.error;
}
schema.validate(data.value, data.rule.options || options, function (errs) {
var finalErrors = [];
if (filledErrors && filledErrors.length) {
finalErrors.push.apply(finalErrors, (0,toConsumableArray["default"])(filledErrors));
}
if (errs && errs.length) {
finalErrors.push.apply(finalErrors, (0,toConsumableArray["default"])(errs));
}
doIt(finalErrors.length ? finalErrors : null);
});
}
}
var res;
if (rule.asyncValidator) {
res = rule.asyncValidator(rule, data.value, cb, data.source, options);
} else if (rule.validator) {
try {
res = rule.validator(rule, data.value, cb, data.source, options);
} catch (error) {
var _console$error, _console;
(_console$error = (_console = console).error) === null || _console$error === void 0 || _console$error.call(_console, error);
// rethrow to report error
if (!options.suppressValidatorError) {
setTimeout(function () {
throw error;
}, 0);
}
cb(error.message);
}
if (res === true) {
cb();
} else if (res === false) {
cb(typeof rule.message === 'function' ? rule.message(rule.fullField || rule.field) : rule.message || "".concat(rule.fullField || rule.field, " fails"));
} else if (res instanceof Array) {
cb(res);
} else if (res instanceof Error) {
cb(res.message);
}
}
if (res && res.then) {
res.then(function () {
return cb();
}, function (e) {
return cb(e);
});
}
}, function (results) {
complete(results);
}, source);
}
}, {
key: "getType",
value: function getType(rule) {
if (rule.type === undefined && rule.pattern instanceof RegExp) {
rule.type = 'pattern';
}
if (typeof rule.validator !== 'function' && rule.type && !es_validator.hasOwnProperty(rule.type)) {
throw new Error(format('Unknown rule type %s', rule.type));
}
return rule.type || 'string';
}
}, {
key: "getValidationMethod",
value: function getValidationMethod(rule) {
if (typeof rule.validator === 'function') {
return rule.validator;
}
var keys = Object.keys(rule);
var messageIndex = keys.indexOf('message');
if (messageIndex !== -1) {
keys.splice(messageIndex, 1);
}
if (keys.length === 1 && keys[0] === 'required') {
return es_validator.required;
}
return es_validator[this.getType(rule)] || undefined;
}
}]);
return Schema;
}();
// ========================= Static =========================
(0,defineProperty["default"])(Schema, "register", function register(type, validator) {
if (typeof validator !== 'function') {
throw new Error('Cannot register a validator by type, validator is not a function');
}
es_validator[type] = validator;
});
(0,defineProperty["default"])(Schema, "warning", util_warning);
(0,defineProperty["default"])(Schema, "messages", messages_messages);
(0,defineProperty["default"])(Schema, "validators", es_validator);
/* harmony default export */ var async_validator_es = (Schema);
;// ./node_modules/@rc-component/form/es/utils/messages.js
const typeTemplate = "'${name}' is not a valid ${type}";
const defaultValidateMessages = {
default: "Validation error on field '${name}'",
required: "'${name}' is required",
enum: "'${name}' must be one of [${enum}]",
whitespace: "'${name}' cannot be empty",
date: {
format: "'${name}' is invalid for format date",
parse: "'${name}' could not be parsed as date",
invalid: "'${name}' is invalid date"
},
types: {
string: typeTemplate,
method: typeTemplate,
array: typeTemplate,
object: typeTemplate,
number: typeTemplate,
date: typeTemplate,
boolean: typeTemplate,
integer: typeTemplate,
float: typeTemplate,
regexp: typeTemplate,
email: typeTemplate,
tel: typeTemplate,
url: typeTemplate,
hex: typeTemplate
},
string: {
len: "'${name}' must be exactly ${len} characters",
min: "'${name}' must be at least ${min} characters",
max: "'${name}' cannot be longer than ${max} characters",
range: "'${name}' must be between ${min} and ${max} characters"
},
number: {
len: "'${name}' must equal ${len}",
min: "'${name}' cannot be less than ${min}",
max: "'${name}' cannot be greater than ${max}",
range: "'${name}' must be between ${min} and ${max}"
},
array: {
len: "'${name}' must be exactly ${len} in length",
min: "'${name}' cannot be less than ${min} in length",
max: "'${name}' cannot be greater than ${max} in length",
range: "'${name}' must be between ${min} and ${max} in length"
},
pattern: {
mismatch: "'${name}' does not match pattern ${pattern}"
}
};
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/utils/set.js
var set = __webpack_require__("./node_modules/@rc-component/util/es/utils/set.js");
;// ./node_modules/@rc-component/form/es/utils/validateUtil.js
// Remove incorrect original ts define
const AsyncValidator = async_validator_es;
/**
* Replace with template.
* `I'm ${name}` + { name: 'bamboo' } = I'm bamboo
*/
function replaceMessage(template, kv) {
return template.replace(/\\?\$\{\w+\}/g, str => {
if (str.startsWith('\\')) {
return str.slice(1);
}
const key = str.slice(2, -1);
return kv[key];
});
}
const CODE_LOGIC_ERROR = 'CODE_LOGIC_ERROR';
async function validateRule(name, value, rule, options, messageVariables) {
const cloneRule = {
...rule
};
// Bug of `async-validator`
// https://github.com/react-component/field-form/issues/316
// https://github.com/react-component/field-form/issues/313
delete cloneRule.ruleIndex;
// https://github.com/ant-design/ant-design/issues/40497#issuecomment-1422282378
AsyncValidator.warning = () => void 0;
if (cloneRule.validator) {
const originValidator = cloneRule.validator;
cloneRule.validator = (...args) => {
try {
return originValidator(...args);
} catch (error) {
console.error(error);
return Promise.reject(CODE_LOGIC_ERROR);
}
};
}
// We should special handle array validate
let subRuleField = null;
if (cloneRule && cloneRule.type === 'array' && cloneRule.defaultField) {
subRuleField = cloneRule.defaultField;
delete cloneRule.defaultField;
}
const validator = new AsyncValidator({
[name]: [cloneRule]
});
const messages = (0,set.merge)(defaultValidateMessages, options.validateMessages);
validator.messages(messages);
let result = [];
try {
await Promise.resolve(validator.validate({
[name]: value
}, {
...options
}));
} catch (errObj) {
if (errObj.errors) {
result = errObj.errors.map(({
message
}, index) => {
const mergedMessage = message === CODE_LOGIC_ERROR ? messages.default : message;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(mergedMessage) ?
/*#__PURE__*/
// Wrap ReactNode with `key`
external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement(mergedMessage, {
key: `error_${index}`
}) : mergedMessage;
});
}
}
if (!result.length && subRuleField && Array.isArray(value) && value.length > 0) {
const subResults = await Promise.all(value.map((subValue, i) => validateRule(`${name}.${i}`, subValue, subRuleField, options, messageVariables)));
return subResults.reduce((prev, errors) => [...prev, ...errors], []);
}
// Replace message with variables
const kv = {
...rule,
name,
enum: (rule.enum || []).join(', '),
...messageVariables
};
const fillVariableResult = result.map(error => {
if (typeof error === 'string') {
return replaceMessage(error, kv);
}
return error;
});
return fillVariableResult;
}
/**
* We use `async-validator` to validate the value.
* But only check one value in a time to avoid namePath validate issue.
*/
function validateRules(namePath, value, rules, options, validateFirst, messageVariables) {
const name = namePath.join('.');
// Fill rule with context
const filledRules = rules.map((currentRule, ruleIndex) => {
const originValidatorFunc = currentRule.validator;
const cloneRule = {
...currentRule,
ruleIndex
};
// Replace validator if needed
if (originValidatorFunc) {
cloneRule.validator = (rule, val, callback) => {
let hasPromise = false;
// Wrap callback only accept when promise not provided
const wrappedCallback = (...args) => {
// Wait a tick to make sure return type is a promise
Promise.resolve().then(() => {
(0,warning["default"])(!hasPromise, 'Your validator function has already return a promise. `callback` will be ignored.');
if (!hasPromise) {
callback(...args);
}
});
};
// Get promise
const promise = originValidatorFunc(rule, val, wrappedCallback);
hasPromise = promise && typeof promise.then === 'function' && typeof promise.catch === 'function';
/**
* 1. Use promise as the first priority.
* 2. If promise not exist, use callback with warning instead
*/
(0,warning["default"])(hasPromise, '`callback` is deprecated. Please return a promise instead.');
if (hasPromise) {
promise.then(() => {
callback();
}).catch(err => {
callback(err || ' ');
});
}
};
}
return cloneRule;
}).sort(({
warningOnly: w1,
ruleIndex: i1
}, {
warningOnly: w2,
ruleIndex: i2
}) => {
if (!!w1 === !!w2) {
// Let keep origin order
return i1 - i2;
}
if (w1) {
return 1;
}
return -1;
});
// Do validate rules
let summaryPromise;
if (validateFirst === true) {
// >>>>> Validate by serialization
summaryPromise = new Promise(async (resolve, reject) => {
/* eslint-disable no-await-in-loop */
for (let i = 0; i < filledRules.length; i += 1) {
const rule = filledRules[i];
const errors = await validateRule(name, value, rule, options, messageVariables);
if (errors.length) {
reject([{
errors,
rule
}]);
return;
}
}
/* eslint-enable */
resolve([]);
});
} else {
// >>>>> Validate by parallel
const rulePromises = filledRules.map(rule => validateRule(name, value, rule, options, messageVariables).then(errors => ({
errors,
rule
})));
summaryPromise = (validateFirst ? finishOnFirstFailed(rulePromises) : finishOnAllFailed(rulePromises)).then(errors => {
// Always change to rejection for Field to catch
return Promise.reject(errors);
});
}
// Internal catch error to avoid console error log.
summaryPromise.catch(e => e);
return summaryPromise;
}
async function finishOnAllFailed(rulePromises) {
return Promise.all(rulePromises).then(errorsList => {
const errors = [].concat(...errorsList);
return errors;
});
}
async function finishOnFirstFailed(rulePromises) {
let count = 0;
return new Promise(resolve => {
rulePromises.forEach(promise => {
promise.then(ruleError => {
if (ruleError.errors.length) {
resolve([ruleError]);
}
count += 1;
if (count === rulePromises.length) {
resolve([]);
}
});
});
});
}
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/utils/get.js
var get = __webpack_require__("./node_modules/@rc-component/util/es/utils/get.js");
;// ./node_modules/@rc-component/form/es/utils/valueUtil.js
/**
* Convert name to internal supported format.
* This function should keep since we still thinking if need support like `a.b.c` format.
* 'a' => ['a']
* 123 => [123]
* ['a', 123] => ['a', 123]
*/
function getNamePath(path) {
return typeUtil_toArray(path);
}
/**
* Create a new store object that contains only the values referenced by
* the provided list of name paths.
*/
function cloneByNamePathList(store, namePathList) {
let newStore = {};
namePathList.forEach(namePath => {
const value = (0,get["default"])(store, namePath);
newStore = (0,set["default"])(newStore, namePath, value);
});
return newStore;
}
/**
* Check if `namePathList` includes `namePath`.
* @param namePathList A list of `InternalNamePath[]`
* @param namePath Compare `InternalNamePath`
* @param partialMatch True will make `[a, b]` match `[a, b, c]`
*/
function containsNamePath(namePathList, namePath, partialMatch = false) {
return namePathList && namePathList.some(path => matchNamePath(namePath, path, partialMatch));
}
/**
* Check if `namePath` is super set or equal of `subNamePath`.
* @param namePath A list of `InternalNamePath[]`
* @param subNamePath Compare `InternalNamePath`
* @param partialMatch Default false. True will make `[a, b]` match `[a, b, c]`
*/
function matchNamePath(namePath, subNamePath, partialMatch = false) {
if (!namePath || !subNamePath) {
return false;
}
if (!partialMatch && namePath.length !== subNamePath.length) {
return false;
}
return subNamePath.every((nameUnit, i) => namePath[i] === nameUnit);
}
// Like `shallowEqual`, but we not check the data which may cause re-render
function isSimilar(source, target) {
if (source === target) {
return true;
}
if (!source && target || source && !target) {
return false;
}
if (!source || !target || typeof source !== 'object' || typeof target !== 'object') {
return false;
}
const sourceKeys = Object.keys(source);
const targetKeys = Object.keys(target);
const keys = new Set([...sourceKeys, ...targetKeys]);
return [...keys].every(key => {
const sourceValue = source[key];
const targetValue = target[key];
if (typeof sourceValue === 'function' && typeof targetValue === 'function') {
return true;
}
return sourceValue === targetValue;
});
}
function defaultGetValueFromEvent(valuePropName, ...args) {
const event = args[0];
if (event && event.target && typeof event.target === 'object' && valuePropName in event.target) {
return event.target[valuePropName];
}
return event;
}
/**
* Moves an array item from one position in an array to another.
*
* Note: This is a pure function so a new array will be returned, instead
* of altering the array argument.
*
* @param array Array in which to move an item. (required)
* @param moveIndex The index of the item to move. (required)
* @param toIndex The index to move item at moveIndex to. (required)
*/
function move(array, moveIndex, toIndex) {
const {
length
} = array;
if (moveIndex < 0 || moveIndex >= length || toIndex < 0 || toIndex >= length) {
return array;
}
const item = array[moveIndex];
const diff = moveIndex - toIndex;
if (diff > 0) {
// move left
return [...array.slice(0, toIndex), item, ...array.slice(toIndex, moveIndex), ...array.slice(moveIndex + 1, length)];
}
if (diff < 0) {
// move right
return [...array.slice(0, moveIndex), ...array.slice(moveIndex + 1, toIndex + 1), item, ...array.slice(toIndex + 1, length)];
}
return array;
}
;// ./node_modules/@rc-component/form/es/hooks/useNotifyWatch.js
/**
* Call action with delay in macro task.
*/
const macroTask = fn => {
const channel = new MessageChannel();
channel.port1.onmessage = fn;
channel.port2.postMessage(null);
};
class WatcherCenter {
namePathList = [];
taskId = 0;
watcherList = new Set();
form;
constructor(form) {
this.form = form;
}
register(callback) {
this.watcherList.add(callback);
return () => {
this.watcherList.delete(callback);
};
}
notify(namePath) {
// Insert with deduplication
namePath.forEach(path => {
if (this.namePathList.every(exist => !matchNamePath(exist, path))) {
this.namePathList.push(path);
}
});
this.doBatch();
}
doBatch() {
this.taskId += 1;
const currentId = this.taskId;
macroTask(() => {
if (currentId === this.taskId && this.watcherList.size) {
const formInst = this.form.getForm();
const values = formInst.getFieldsValue();
const allValues = formInst.getFieldsValue(true);
this.watcherList.forEach(callback => {
callback(values, allValues, this.namePathList);
});
this.namePathList = [];
}
});
}
}
;// ./node_modules/@rc-component/form/es/utils/delayUtil.js
async function delayFrame() {
return new Promise(resolve => {
macroTask(() => {
(0,raf["default"])(() => {
resolve();
});
});
});
}
;// ./node_modules/@rc-component/form/es/Field.js
function Field_extends() { Field_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Field_extends.apply(this, arguments); }
const EMPTY_ERRORS = [];
const EMPTY_WARNINGS = [];
function requireUpdate(shouldUpdate, prev, next, prevValue, nextValue, info) {
if (typeof shouldUpdate === 'function') {
return shouldUpdate(prev, next, 'source' in info ? {
source: info.source
} : {});
}
return prevValue !== nextValue;
}
// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
// We use Class instead of Hooks here since it will cost much code by using Hooks.
class Field extends external_root_React_commonjs2_react_commonjs_react_amd_react_.Component {
static contextType = FieldContext;
state = {
resetCount: 0
};
cancelRegisterFunc = null;
mounted = false;
/**
* Follow state should not management in State since it will async update by React.
* This makes first render of form can not get correct state value.
*/
touched = false;
/**
* Mark when touched & validated. Currently only used for `dependencies`.
* Note that we do not think field with `initialValue` is dirty
* but this will be by `isFieldDirty` func.
*/
dirty = false;
validatePromise;
prevValidating;
errors = EMPTY_ERRORS;
warnings = EMPTY_WARNINGS;
// ============================== Subscriptions ==============================
constructor(props) {
super(props);
// Register on init
if (props.fieldContext) {
const {
getInternalHooks
} = props.fieldContext;
const {
initEntityValue
} = getInternalHooks(HOOK_MARK);
initEntityValue(this);
}
}
componentDidMount() {
const {
shouldUpdate,
fieldContext
} = this.props;
this.mounted = true;
// Register on init
if (fieldContext) {
const {
getInternalHooks
} = fieldContext;
const {
registerField
} = getInternalHooks(HOOK_MARK);
this.cancelRegisterFunc = registerField(this);
}
// One more render for component in case fields not ready
if (shouldUpdate === true) {
this.reRender();
}
}
componentWillUnmount() {
this.cancelRegister();
this.triggerMetaEvent(true);
this.mounted = false;
}
cancelRegister = () => {
const {
preserve,
isListField,
name
} = this.props;
if (this.cancelRegisterFunc) {
this.cancelRegisterFunc(isListField, preserve, getNamePath(name));
}
this.cancelRegisterFunc = null;
};
// ================================== Utils ==================================
getNamePath = () => {
const {
name,
fieldContext
} = this.props;
const {
prefixName = []
} = fieldContext;
return name !== undefined ? [...prefixName, ...name] : [];
};
getRules = () => {
const {
rules = [],
fieldContext
} = this.props;
return rules.map(rule => {
if (typeof rule === 'function') {
return rule(fieldContext);
}
return rule;
});
};
reRender() {
if (!this.mounted) return;
this.forceUpdate();
}
refresh = () => {
if (!this.mounted) return;
/**
* Clean up current node.
*/
this.setState(({
resetCount
}) => ({
resetCount: resetCount + 1
}));
};
// Event should only trigger when meta changed
metaCache = null;
triggerMetaEvent = destroy => {
const {
onMetaChange
} = this.props;
if (onMetaChange) {
const meta = {
...this.getMeta(),
destroy
};
if (!(0,isEqual["default"])(this.metaCache, meta)) {
onMetaChange(meta);
}
this.metaCache = meta;
} else {
this.metaCache = null;
}
};
// ========================= Field Entity Interfaces =========================
// Trigger by store update. Check if need update the component
onStoreChange = (prevStore, namePathList, info) => {
const {
shouldUpdate,
dependencies = [],
onReset
} = this.props;
const {
store
} = info;
const namePath = this.getNamePath();
const prevValue = this.getValue(prevStore);
const curValue = this.getValue(store);
const namePathMatch = namePathList && containsNamePath(namePathList, namePath);
// `setFieldsValue` is a quick access to update related status
if (info.type === 'valueUpdate' && info.source === 'external' && !(0,isEqual["default"])(prevValue, curValue)) {
this.touched = true;
this.dirty = true;
this.validatePromise = null;
this.errors = EMPTY_ERRORS;
this.warnings = EMPTY_WARNINGS;
this.triggerMetaEvent();
}
switch (info.type) {
case 'reset':
if (!namePathList || namePathMatch) {
// Clean up state
this.touched = false;
this.dirty = false;
this.validatePromise = undefined;
this.errors = EMPTY_ERRORS;
this.warnings = EMPTY_WARNINGS;
this.triggerMetaEvent();
onReset?.();
this.refresh();
return;
}
break;
/**
* In case field with `preserve = false` nest deps like:
* - A = 1 => show B
* - B = 1 => show C
* - Reset A, need clean B, C
*/
case 'remove':
{
if (shouldUpdate && requireUpdate(shouldUpdate, prevStore, store, prevValue, curValue, info)) {
this.reRender();
return;
}
break;
}
case 'setField':
{
const {
data
} = info;
if (namePathMatch) {
if ('touched' in data) {
this.touched = data.touched;
}
if ('validating' in data && !('originRCField' in data)) {
this.validatePromise = data.validating ? Promise.resolve([]) : null;
}
if ('errors' in data) {
this.errors = data.errors || EMPTY_ERRORS;
}
if ('warnings' in data) {
this.warnings = data.warnings || EMPTY_WARNINGS;
}
this.dirty = true;
this.triggerMetaEvent();
this.reRender();
return;
} else if ('value' in data && containsNamePath(namePathList, namePath, true)) {
// Contains path with value should also check
this.reRender();
return;
}
// Handle update by `setField` with `shouldUpdate`
if (shouldUpdate && !namePath.length && requireUpdate(shouldUpdate, prevStore, store, prevValue, curValue, info)) {
this.reRender();
return;
}
break;
}
case 'dependenciesUpdate':
{
/**
* Trigger when marked `dependencies` updated. Related fields will all update
*/
const dependencyList = dependencies.map(getNamePath);
// No need for `namePathMath` check and `shouldUpdate` check, since `valueUpdate` will be
// emitted earlier and they will work there
// If set it may cause unnecessary twice rerendering
if (dependencyList.some(dependency => containsNamePath(info.relatedFields, dependency))) {
this.reRender();
return;
}
break;
}
default:
// 1. If `namePath` exists in `namePathList`, means it's related value and should update
// For example
// If `namePathList` is [['list']] (List value update), Field should be updated
// If `namePathList` is [['list', 0]] (Field value update), List shouldn't be updated
// 2.
// 2.1 If `dependencies` is set, `name` is not set and `shouldUpdate` is not set,
// don't use `shouldUpdate`. `dependencies` is view as a shortcut if `shouldUpdate`
// is not provided
// 2.2 If `shouldUpdate` provided, use customize logic to update the field
// else to check if value changed
if (namePathMatch || (!dependencies.length || namePath.length || shouldUpdate) && requireUpdate(shouldUpdate, prevStore, store, prevValue, curValue, info)) {
this.reRender();
return;
}
break;
}
if (shouldUpdate === true) {
this.reRender();
}
};
validateRules = options => {
// We should fixed namePath & value to avoid developer change then by form function
const namePath = this.getNamePath();
const currentValue = this.getValue();
const {
triggerName,
validateOnly = false,
delayFrame: showDelayFrame
} = options || {};
// Force change to async to avoid rule OOD under renderProps field
const rootPromise = Promise.resolve().then(async () => {
if (!this.mounted) {
return [];
}
const {
validateFirst = false,
messageVariables,
validateDebounce
} = this.props;
// Should wait for the frame render,
// since developer may `useWatch` value in the rules.
if (showDelayFrame) {
await delayFrame();
}
// Start validate
let filteredRules = this.getRules();
if (triggerName) {
filteredRules = filteredRules.filter(rule => rule).filter(rule => {
const {
validateTrigger
} = rule;
if (!validateTrigger) {
return true;
}
const triggerList = typeUtil_toArray(validateTrigger);
return triggerList.includes(triggerName);
});
}
// Wait for debounce. Skip if no `triggerName` since its from `validateFields / submit`
if (validateDebounce && triggerName) {
await new Promise(resolve => {
setTimeout(resolve, validateDebounce);
});
// Skip since out of date
if (this.validatePromise !== rootPromise) {
return [];
}
}
const promise = validateRules(namePath, currentValue, filteredRules, options, validateFirst, messageVariables);
promise.catch(e => e).then((ruleErrors = EMPTY_ERRORS) => {
if (this.validatePromise === rootPromise) {
this.validatePromise = null;
// Get errors & warnings
const nextErrors = [];
const nextWarnings = [];
ruleErrors.forEach?.(({
rule: {
warningOnly
},
errors = EMPTY_ERRORS
}) => {
if (warningOnly) {
nextWarnings.push(...errors);
} else {
nextErrors.push(...errors);
}
});
this.errors = nextErrors;
this.warnings = nextWarnings;
this.triggerMetaEvent();
this.reRender();
}
});
return promise;
});
if (validateOnly) {
return rootPromise;
}
this.validatePromise = rootPromise;
this.dirty = true;
this.errors = EMPTY_ERRORS;
this.warnings = EMPTY_WARNINGS;
this.triggerMetaEvent();
// Force trigger re-render since we need sync renderProps with new meta
this.reRender();
return rootPromise;
};
isFieldValidating = () => !!this.validatePromise;
isFieldTouched = () => this.touched;
isFieldDirty = () => {
// Touched or validate or has initialValue
if (this.dirty || this.props.initialValue !== undefined) {
return true;
}
// Form set initialValue
const {
fieldContext
} = this.props;
const {
getInitialValue
} = fieldContext.getInternalHooks(HOOK_MARK);
if (getInitialValue(this.getNamePath()) !== undefined) {
return true;
}
return false;
};
getErrors = () => this.errors;
getWarnings = () => this.warnings;
isListField = () => this.props.isListField;
isList = () => this.props.isList;
isPreserve = () => this.props.preserve;
// ============================= Child Component =============================
getMeta = () => {
// Make error & validating in cache to save perf
this.prevValidating = this.isFieldValidating();
const meta = {
touched: this.isFieldTouched(),
validating: this.prevValidating,
errors: this.errors,
warnings: this.warnings,
name: this.getNamePath(),
validated: this.validatePromise === null
};
return meta;
};
// Only return validate child node. If invalidate, will do nothing about field.
getOnlyChild = children => {
// Support render props
if (typeof children === 'function') {
const meta = this.getMeta();
return {
...this.getOnlyChild(children(this.getControlled(), meta, this.props.fieldContext)),
isFunction: true
};
}
// Filed element only
const childList = (0,toArray["default"])(children);
if (childList.length !== 1 || ! /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(childList[0])) {
return {
child: childList,
isFunction: false
};
}
return {
child: childList[0],
isFunction: false
};
};
// ============================== Field Control ==============================
getValue = store => {
const {
getFieldsValue
} = this.props.fieldContext;
const namePath = this.getNamePath();
return (0,get["default"])(store || getFieldsValue(true), namePath);
};
getControlled = (childProps = {}) => {
const {
name,
trigger = 'onChange',
validateTrigger,
getValueFromEvent,
normalize,
valuePropName = 'value',
getValueProps,
fieldContext
} = this.props;
const mergedValidateTrigger = validateTrigger !== undefined ? validateTrigger : fieldContext.validateTrigger;
const namePath = this.getNamePath();
const {
getInternalHooks,
getFieldsValue
} = fieldContext;
const {
dispatch
} = getInternalHooks(HOOK_MARK);
const value = this.getValue();
const mergedGetValueProps = getValueProps || (val => ({
[valuePropName]: val
}));
const originTriggerFunc = childProps[trigger];
const valueProps = name !== undefined ? mergedGetValueProps(value) : {};
// warning when prop value is function
if ( true && valueProps) {
Object.keys(valueProps).forEach(key => {
(0,warning["default"])(typeof valueProps[key] !== 'function', `It's not recommended to generate dynamic function prop by \`getValueProps\`. Please pass it to child component directly (prop: ${key})`);
});
}
const control = {
...childProps,
...valueProps
};
// Add trigger
control[trigger] = (...args) => {
// Mark as touched
this.touched = true;
this.dirty = true;
this.triggerMetaEvent();
let newValue;
if (getValueFromEvent) {
newValue = getValueFromEvent(...args);
} else {
newValue = defaultGetValueFromEvent(valuePropName, ...args);
}
if (normalize) {
newValue = normalize(newValue, value, getFieldsValue(true));
}
if (newValue !== value) {
dispatch({
type: 'updateValue',
namePath,
value: newValue
});
}
if (originTriggerFunc) {
originTriggerFunc(...args);
}
};
// Add validateTrigger
const validateTriggerList = typeUtil_toArray(mergedValidateTrigger || []);
validateTriggerList.forEach(triggerName => {
// Wrap additional function of component, so that we can get latest value from store
const originTrigger = control[triggerName];
control[triggerName] = (...args) => {
if (originTrigger) {
originTrigger(...args);
}
// Always use latest rules
const {
rules
} = this.props;
if (rules && rules.length) {
// We dispatch validate to root,
// since it will update related data with other field with same name
dispatch({
type: 'validateField',
namePath,
triggerName
});
}
};
});
return control;
};
render() {
const {
resetCount
} = this.state;
const {
children
} = this.props;
const {
child,
isFunction
} = this.getOnlyChild(children);
// Not need to `cloneElement` since user can handle this in render function self
let returnChildNode;
if (isFunction) {
returnChildNode = child;
} else if ( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(child)) {
returnChildNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement(child, this.getControlled(child.props));
} else {
(0,warning["default"])(!child, '`children` of Field is not validate ReactElement.');
returnChildNode = child;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
key: resetCount
}, returnChildNode);
}
}
function WrapperField({
name,
...restProps
}) {
const fieldContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FieldContext);
const listContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(es_ListContext);
const namePath = name !== undefined ? getNamePath(name) : undefined;
const isMergedListField = restProps.isListField ?? !!listContext;
let key = 'keep';
if (!isMergedListField) {
key = `_${(namePath || []).join('_')}`;
}
// Warning if it's a directly list field.
// We can still support multiple level field preserve.
if ( true && restProps.preserve === false && isMergedListField && namePath.length <= 1) {
(0,warning["default"])(false, '`preserve` should not apply on Form.List fields.');
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Field, Field_extends({
key: key,
name: namePath,
isListField: isMergedListField
}, restProps, {
fieldContext: fieldContext
}));
}
/* harmony default export */ var es_Field = (WrapperField);
;// ./node_modules/@rc-component/form/es/List.js
function List({
name,
initialValue,
children,
rules,
validateTrigger,
isListField
}) {
const context = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FieldContext);
const wrapperListContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(es_ListContext);
const keyRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({
keys: [],
id: 0
});
const keyManager = keyRef.current;
const prefixName = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const parentPrefixName = getNamePath(context.prefixName) || [];
return [...parentPrefixName, ...getNamePath(name)];
}, [context.prefixName, name]);
const fieldContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
...context,
prefixName
}), [context, prefixName]);
// List context
const listContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
getKey: namePath => {
const len = prefixName.length;
const pathName = namePath[len];
return [keyManager.keys[pathName], namePath.slice(len + 1)];
}
}), [keyManager, prefixName]);
// User should not pass `children` as other type.
if (typeof children !== 'function') {
(0,warning["default"])(false, 'Form.List only accepts function as children.');
return null;
}
const shouldUpdate = (prevValue, nextValue, {
source
}) => {
if (source === 'internal') {
return false;
}
return prevValue !== nextValue;
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_ListContext.Provider, {
value: listContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(FieldContext.Provider, {
value: fieldContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Field, {
name: [],
shouldUpdate: shouldUpdate,
rules: rules,
validateTrigger: validateTrigger,
initialValue: initialValue,
isList: true,
isListField: isListField ?? !!wrapperListContext
}, ({
value = [],
onChange
}, meta) => {
const {
getFieldValue
} = context;
const getNewValue = () => {
const values = getFieldValue(prefixName || []);
return values || [];
};
/**
* Always get latest value in case user update fields by `form` api.
*/
const operations = {
add: (defaultValue, index) => {
// Mapping keys
const newValue = getNewValue();
if (index >= 0 && index <= newValue.length) {
keyManager.keys = [...keyManager.keys.slice(0, index), keyManager.id, ...keyManager.keys.slice(index)];
onChange([...newValue.slice(0, index), defaultValue, ...newValue.slice(index)]);
} else {
if ( true && (index < 0 || index > newValue.length)) {
(0,warning["default"])(false, 'The second parameter of the add function should be a valid positive number.');
}
keyManager.keys = [...keyManager.keys, keyManager.id];
onChange([...newValue, defaultValue]);
}
keyManager.id += 1;
},
remove: index => {
const newValue = getNewValue();
const indexSet = new Set(Array.isArray(index) ? index : [index]);
if (indexSet.size <= 0) {
return;
}
keyManager.keys = keyManager.keys.filter((_, keysIndex) => !indexSet.has(keysIndex));
// Trigger store change
onChange(newValue.filter((_, valueIndex) => !indexSet.has(valueIndex)));
},
move(from, to) {
if (from === to) {
return;
}
const newValue = getNewValue();
// Do not handle out of range
if (from < 0 || from >= newValue.length || to < 0 || to >= newValue.length) {
return;
}
keyManager.keys = move(keyManager.keys, from, to);
// Trigger store change
onChange(move(newValue, from, to));
}
};
let listValue = value || [];
if (!Array.isArray(listValue)) {
listValue = [];
if (true) {
(0,warning["default"])(false, `Current value of '${prefixName.join(' > ')}' is not an array type.`);
}
}
return children(listValue.map((__, index) => {
let key = keyManager.keys[index];
if (key === undefined) {
keyManager.keys[index] = keyManager.id;
key = keyManager.keys[index];
keyManager.id += 1;
}
return {
name: index,
key,
isListField: true
};
}), operations, meta);
})));
}
/* harmony default export */ var es_List = (List);
;// ./node_modules/@rc-component/form/es/utils/asyncUtil.js
function allPromiseFinish(promiseList) {
let hasError = false;
let count = promiseList.length;
const results = [];
if (!promiseList.length) {
return Promise.resolve([]);
}
return new Promise((resolve, reject) => {
promiseList.forEach((promise, index) => {
promise.catch(e => {
hasError = true;
return e;
}).then(result => {
count -= 1;
results[index] = result;
if (count > 0) {
return;
}
if (hasError) {
reject(results);
}
resolve(results);
});
});
});
}
;// ./node_modules/@rc-component/form/es/utils/NameMap.js
const SPLIT = '__@field_split__';
/**
* Convert name path into string to fast the fetch speed of Map.
*/
function normalize(namePath) {
return namePath.map(cell => `${typeof cell}:${cell}`)
// Magic split
.join(SPLIT);
}
/**
* NameMap like a `Map` but accepts `string[]` as key.
*/
class NameMap {
kvs = new Map();
set(key, value) {
this.kvs.set(normalize(key), value);
}
get(key) {
return this.kvs.get(normalize(key));
}
getAsPrefix(key) {
const normalizedKey = normalize(key);
const normalizedPrefix = normalizedKey + SPLIT;
const results = [];
const current = this.kvs.get(normalizedKey);
if (current !== undefined) {
results.push(current);
}
this.kvs.forEach((value, itemNormalizedKey) => {
if (itemNormalizedKey.startsWith(normalizedPrefix)) {
results.push(value);
}
});
return results;
}
update(key, updater) {
const origin = this.get(key);
const next = updater(origin);
if (!next) {
this.delete(key);
} else {
this.set(key, next);
}
}
delete(key) {
this.kvs.delete(normalize(key));
}
// Since we only use this in test, let simply realize this
map(callback) {
return [...this.kvs.entries()].map(([key, value]) => {
const cells = key.split(SPLIT);
return callback({
key: cells.map(cell => {
const [, type, unit] = cell.match(/^([^:]*):(.*)$/);
return type === 'number' ? Number(unit) : unit;
}),
value
});
});
}
toJSON() {
const json = {};
this.map(({
key,
value
}) => {
json[key.join('.')] = value;
return null;
});
return json;
}
}
/* harmony default export */ var utils_NameMap = (NameMap);
;// ./node_modules/@rc-component/form/es/hooks/useForm.js
class FormStore {
formHooked = false;
forceRootUpdate;
subscribable = true;
store = {};
fieldEntities = [];
initialValues = {};
callbacks = {};
validateMessages = null;
preserve = null;
lastValidatePromise = null;
watcherCenter = new WatcherCenter(this);
constructor(forceRootUpdate) {
this.forceRootUpdate = forceRootUpdate;
}
getForm = () => ({
getFieldValue: this.getFieldValue,
getFieldsValue: this.getFieldsValue,
getFieldError: this.getFieldError,
getFieldWarning: this.getFieldWarning,
getFieldsError: this.getFieldsError,
isFieldsTouched: this.isFieldsTouched,
isFieldTouched: this.isFieldTouched,
isFieldValidating: this.isFieldValidating,
isFieldsValidating: this.isFieldsValidating,
resetFields: this.resetFields,
setFields: this.setFields,
setFieldValue: this.setFieldValue,
setFieldsValue: this.setFieldsValue,
validateFields: this.validateFields,
submit: this.submit,
_init: true,
getInternalHooks: this.getInternalHooks
});
// ======================== Internal Hooks ========================
getInternalHooks = key => {
if (key === HOOK_MARK) {
this.formHooked = true;
return {
dispatch: this.dispatch,
initEntityValue: this.initEntityValue,
registerField: this.registerField,
useSubscribe: this.useSubscribe,
setInitialValues: this.setInitialValues,
destroyForm: this.destroyForm,
setCallbacks: this.setCallbacks,
setValidateMessages: this.setValidateMessages,
getFields: this.getFields,
setPreserve: this.setPreserve,
getInitialValue: this.getInitialValue,
registerWatch: this.registerWatch
};
}
(0,warning["default"])(false, '`getInternalHooks` is internal usage. Should not call directly.');
return null;
};
useSubscribe = subscribable => {
this.subscribable = subscribable;
};
/**
* Record prev Form unmount fieldEntities which config preserve false.
* This need to be refill with initialValues instead of store value.
*/
prevWithoutPreserves = null;
/**
* First time `setInitialValues` should update store with initial value
*/
setInitialValues = (initialValues, init) => {
this.initialValues = initialValues || {};
if (init) {
let nextStore = (0,set.merge)(initialValues, this.store);
// We will take consider prev form unmount fields.
// When the field is not `preserve`, we need fill this with initialValues instead of store.
// eslint-disable-next-line array-callback-return
this.prevWithoutPreserves?.map(({
key: namePath
}) => {
nextStore = (0,set["default"])(nextStore, namePath, (0,get["default"])(initialValues, namePath));
});
this.prevWithoutPreserves = null;
this.updateStore(nextStore);
}
};
destroyForm = clearOnDestroy => {
if (clearOnDestroy) {
// destroy form reset store
this.updateStore({});
} else {
// Fill preserve fields
const prevWithoutPreserves = new utils_NameMap();
this.getFieldEntities(true).forEach(entity => {
if (!this.isMergedPreserve(entity.isPreserve())) {
prevWithoutPreserves.set(entity.getNamePath(), true);
}
});
this.prevWithoutPreserves = prevWithoutPreserves;
}
};
getInitialValue = namePath => {
const initValue = (0,get["default"])(this.initialValues, namePath);
// Not cloneDeep when without `namePath`
return namePath.length ? (0,set.merge)(initValue) : initValue;
};
setCallbacks = callbacks => {
this.callbacks = callbacks;
};
setValidateMessages = validateMessages => {
this.validateMessages = validateMessages;
};
setPreserve = preserve => {
this.preserve = preserve;
};
// ============================= Watch ============================
registerWatch = callback => {
return this.watcherCenter.register(callback);
};
notifyWatch = (namePath = []) => {
this.watcherCenter.notify(namePath);
};
// ========================== Dev Warning =========================
timeoutId = null;
warningUnhooked = () => {
if ( true && !this.timeoutId && typeof window !== 'undefined') {
this.timeoutId = setTimeout(() => {
this.timeoutId = null;
if (!this.formHooked) {
(0,warning["default"])(false, 'Instance created by `useForm` is not connected to any Form element. Forget to pass `form` prop?');
}
});
}
};
// ============================ Store =============================
updateStore = nextStore => {
this.store = nextStore;
};
// ============================ Fields ============================
/**
* Get registered field entities.
* @param pure Only return field which has a `name`. Default: false
*/
getFieldEntities = (pure = false) => {
if (!pure) {
return this.fieldEntities;
}
return this.fieldEntities.filter(field => field.getNamePath().length);
};
/**
* Get a map of registered field entities with their name path as the key.
* @param pure Only include fields which have a `name`. Default: false
* @returns A NameMap containing field entities indexed by their name paths
*/
getFieldsMap = (pure = false) => {
const cache = new utils_NameMap();
this.getFieldEntities(pure).forEach(field => {
const namePath = field.getNamePath();
cache.set(namePath, field);
});
return cache;
};
/**
* Get field entities based on a list of name paths.
* @param nameList - Array of name paths to search for. If not provided, returns all field entities with names.
* @param includesSubNamePath - Whether to include fields that have the given name path as a prefix.
*/
getFieldEntitiesForNamePathList = (nameList, includesSubNamePath = false) => {
if (!nameList) {
return this.getFieldEntities(true);
}
const cache = this.getFieldsMap(true);
if (!includesSubNamePath) {
return nameList.map(name => {
const namePath = getNamePath(name);
return cache.get(namePath) || {
INVALIDATE_NAME_PATH: getNamePath(name)
};
});
}
return nameList.flatMap(name => {
const namePath = getNamePath(name);
const fields = cache.getAsPrefix(namePath);
if (fields.length) {
return fields;
}
return [{
INVALIDATE_NAME_PATH: namePath
}];
});
};
getFieldsValue = (nameList, filterFunc) => {
this.warningUnhooked();
// Fill args
let mergedNameList;
let mergedFilterFunc;
if (nameList === true || Array.isArray(nameList)) {
mergedNameList = nameList;
mergedFilterFunc = filterFunc;
} else if (nameList && typeof nameList === 'object') {
mergedFilterFunc = nameList.filter;
}
if (mergedNameList === true && !mergedFilterFunc) {
return this.store;
}
const fieldEntities = this.getFieldEntitiesForNamePathList(Array.isArray(mergedNameList) ? mergedNameList : null, true);
const filteredNameList = [];
const listNamePaths = [];
fieldEntities.forEach(entity => {
const namePath = entity.INVALIDATE_NAME_PATH || entity.getNamePath();
// Ignore when it's a list item and not specific the namePath,
// since parent field is already take in count
if (entity.isList?.()) {
listNamePaths.push(namePath);
return;
}
if (!mergedFilterFunc) {
filteredNameList.push(namePath);
} else {
const meta = 'getMeta' in entity ? entity.getMeta() : null;
if (mergedFilterFunc(meta)) {
filteredNameList.push(namePath);
}
}
});
let mergedValues = cloneByNamePathList(this.store, filteredNameList.map(getNamePath));
// We need fill the list as [] if Form.List is empty
listNamePaths.forEach(namePath => {
if (!(0,get["default"])(mergedValues, namePath)) {
mergedValues = (0,set["default"])(mergedValues, namePath, []);
}
});
return mergedValues;
};
getFieldValue = name => {
this.warningUnhooked();
const namePath = getNamePath(name);
return (0,get["default"])(this.store, namePath);
};
getFieldsError = nameList => {
this.warningUnhooked();
const fieldEntities = this.getFieldEntitiesForNamePathList(nameList);
return fieldEntities.map((entity, index) => {
if (entity && !entity.INVALIDATE_NAME_PATH) {
return {
name: entity.getNamePath(),
errors: entity.getErrors(),
warnings: entity.getWarnings()
};
}
return {
name: getNamePath(nameList[index]),
errors: [],
warnings: []
};
});
};
getFieldError = name => {
this.warningUnhooked();
const namePath = getNamePath(name);
const fieldError = this.getFieldsError([namePath])[0];
return fieldError.errors;
};
getFieldWarning = name => {
this.warningUnhooked();
const namePath = getNamePath(name);
const fieldError = this.getFieldsError([namePath])[0];
return fieldError.warnings;
};
isFieldsTouched = (...args) => {
this.warningUnhooked();
const [arg0, arg1] = args;
let namePathList;
let isAllFieldsTouched = false;
if (args.length === 0) {
namePathList = null;
} else if (args.length === 1) {
if (Array.isArray(arg0)) {
namePathList = arg0.map(getNamePath);
isAllFieldsTouched = false;
} else {
namePathList = null;
isAllFieldsTouched = arg0;
}
} else {
namePathList = arg0.map(getNamePath);
isAllFieldsTouched = arg1;
}
const fieldEntities = this.getFieldEntities(true);
const isFieldTouched = field => field.isFieldTouched();
// ===== Will get fully compare when not config namePathList =====
if (!namePathList) {
return isAllFieldsTouched ? fieldEntities.every(entity => isFieldTouched(entity) || entity.isList()) : fieldEntities.some(isFieldTouched);
}
// Generate a nest tree for validate
const map = new utils_NameMap();
namePathList.forEach(shortNamePath => {
map.set(shortNamePath, []);
});
fieldEntities.forEach(field => {
const fieldNamePath = field.getNamePath();
// Find matched entity and put into list
namePathList.forEach(shortNamePath => {
if (shortNamePath.every((nameUnit, i) => fieldNamePath[i] === nameUnit)) {
map.update(shortNamePath, list => [...list, field]);
}
});
});
// Check if NameMap value is touched
const isNamePathListTouched = entities => entities.some(isFieldTouched);
const namePathListEntities = map.map(({
value
}) => value);
return isAllFieldsTouched ? namePathListEntities.every(isNamePathListTouched) : namePathListEntities.some(isNamePathListTouched);
};
isFieldTouched = name => {
this.warningUnhooked();
return this.isFieldsTouched([name]);
};
isFieldsValidating = nameList => {
this.warningUnhooked();
const fieldEntities = this.getFieldEntities();
if (!nameList) {
return fieldEntities.some(testField => testField.isFieldValidating());
}
const namePathList = nameList.map(getNamePath);
return fieldEntities.some(testField => {
const fieldNamePath = testField.getNamePath();
return containsNamePath(namePathList, fieldNamePath) && testField.isFieldValidating();
});
};
isFieldValidating = name => {
this.warningUnhooked();
return this.isFieldsValidating([name]);
};
/**
* Reset Field with field `initialValue` prop.
* Can pass `entities` or `namePathList` or just nothing.
*/
resetWithFieldInitialValue = (info = {}) => {
// Create cache
const cache = new utils_NameMap();
const fieldEntities = this.getFieldEntities(true);
fieldEntities.forEach(field => {
const {
initialValue
} = field.props;
const namePath = field.getNamePath();
// Record only if has `initialValue`
if (initialValue !== undefined) {
const records = cache.get(namePath) || new Set();
records.add({
entity: field,
value: initialValue
});
cache.set(namePath, records);
}
});
// Reset
const resetWithFields = entities => {
entities.forEach(field => {
const {
initialValue
} = field.props;
if (initialValue !== undefined) {
const namePath = field.getNamePath();
const formInitialValue = this.getInitialValue(namePath);
if (formInitialValue !== undefined) {
// Warning if conflict with form initialValues and do not modify value
(0,warning["default"])(false, `Form already set 'initialValues' with path '${namePath.join('.')}'. Field can not overwrite it.`);
} else {
const records = cache.get(namePath);
if (records && records.size > 1) {
// Warning if multiple field set `initialValue`and do not modify value
(0,warning["default"])(false, `Multiple Field with path '${namePath.join('.')}' set 'initialValue'. Can not decide which one to pick.`);
} else if (records) {
const originValue = this.getFieldValue(namePath);
const isListField = field.isListField();
// Set `initialValue`
if (!isListField && (!info.skipExist || originValue === undefined)) {
this.updateStore((0,set["default"])(this.store, namePath, [...records][0].value));
}
}
}
}
});
};
let requiredFieldEntities;
if (info.entities) {
requiredFieldEntities = info.entities;
} else if (info.namePathList) {
requiredFieldEntities = [];
info.namePathList.forEach(namePath => {
const records = cache.get(namePath);
if (records) {
requiredFieldEntities.push(...[...records].map(r => r.entity));
}
});
} else {
requiredFieldEntities = fieldEntities;
}
resetWithFields(requiredFieldEntities);
};
resetFields = nameList => {
this.warningUnhooked();
const prevStore = this.store;
if (!nameList) {
this.updateStore((0,set.merge)(this.initialValues));
this.resetWithFieldInitialValue();
this.notifyObservers(prevStore, null, {
type: 'reset'
});
this.notifyWatch();
return;
}
// Reset by `nameList`
const namePathList = nameList.map(getNamePath);
namePathList.forEach(namePath => {
const initialValue = this.getInitialValue(namePath);
this.updateStore((0,set["default"])(this.store, namePath, initialValue));
});
this.resetWithFieldInitialValue({
namePathList
});
this.notifyObservers(prevStore, namePathList, {
type: 'reset'
});
this.notifyWatch(namePathList);
};
setFields = fields => {
this.warningUnhooked();
const prevStore = this.store;
const namePathList = [];
fields.forEach(fieldData => {
const {
name,
...data
} = fieldData;
const namePath = getNamePath(name);
namePathList.push(namePath);
// Value
if ('value' in data) {
this.updateStore((0,set["default"])(this.store, namePath, data.value));
}
this.notifyObservers(prevStore, [namePath], {
type: 'setField',
data: fieldData
});
});
this.notifyWatch(namePathList);
};
getFields = () => {
const entities = this.getFieldEntities(true);
const fields = entities.map(field => {
const namePath = field.getNamePath();
const meta = field.getMeta();
const fieldData = {
...meta,
name: namePath,
value: this.getFieldValue(namePath)
};
Object.defineProperty(fieldData, 'originRCField', {
value: true
});
return fieldData;
});
return fields;
};
// =========================== Observer ===========================
/**
* This only trigger when a field is on constructor to avoid we get initialValue too late
*/
initEntityValue = entity => {
const {
initialValue
} = entity.props;
if (initialValue !== undefined) {
const namePath = entity.getNamePath();
const prevValue = (0,get["default"])(this.store, namePath);
if (prevValue === undefined) {
this.updateStore((0,set["default"])(this.store, namePath, initialValue));
}
}
};
isMergedPreserve = fieldPreserve => {
const mergedPreserve = fieldPreserve !== undefined ? fieldPreserve : this.preserve;
return mergedPreserve ?? true;
};
registerField = entity => {
this.fieldEntities.push(entity);
const namePath = entity.getNamePath();
this.notifyWatch([namePath]);
// Set initial values
if (entity.props.initialValue !== undefined) {
const prevStore = this.store;
this.resetWithFieldInitialValue({
entities: [entity],
skipExist: true
});
this.notifyObservers(prevStore, [entity.getNamePath()], {
type: 'valueUpdate',
source: 'internal'
});
}
// un-register field callback
return (isListField, preserve, subNamePath = []) => {
this.fieldEntities = this.fieldEntities.filter(item => item !== entity);
// Clean up store value if not preserve
if (!this.isMergedPreserve(preserve) && (!isListField || subNamePath.length > 1)) {
const defaultValue = isListField ? undefined : this.getInitialValue(namePath);
if (namePath.length && this.getFieldValue(namePath) !== defaultValue && this.fieldEntities.every(field =>
// Only reset when no namePath exist
!matchNamePath(field.getNamePath(), namePath))) {
const prevStore = this.store;
this.updateStore((0,set["default"])(prevStore, namePath, defaultValue, true));
// Notify that field is unmount
this.notifyObservers(prevStore, [namePath], {
type: 'remove'
});
// Dependencies update
this.triggerDependenciesUpdate(prevStore, namePath);
}
}
this.notifyWatch([namePath]);
};
};
dispatch = action => {
switch (action.type) {
case 'updateValue':
{
const {
namePath,
value
} = action;
this.updateValue(namePath, value);
break;
}
case 'validateField':
{
const {
namePath,
triggerName
} = action;
this.validateFields([namePath], {
triggerName
});
break;
}
default:
// Currently we don't have other action. Do nothing.
}
};
notifyObservers = (prevStore, namePathList, info) => {
if (this.subscribable) {
const mergedInfo = {
...info,
store: this.getFieldsValue(true)
};
this.getFieldEntities().forEach(({
onStoreChange
}) => {
onStoreChange(prevStore, namePathList, mergedInfo);
});
} else {
this.forceRootUpdate();
}
};
/**
* Notify dependencies children with parent update
* We need delay to trigger validate in case Field is under render props
*/
triggerDependenciesUpdate = (prevStore, namePath) => {
const childrenFields = this.getDependencyChildrenFields(namePath);
if (childrenFields.length) {
this.validateFields(childrenFields, {
// Delay to avoid `useWatch` dynamic adjust rules that deps not get latest one
delayFrame: true
});
}
this.notifyObservers(prevStore, childrenFields, {
type: 'dependenciesUpdate',
relatedFields: [namePath, ...childrenFields]
});
return childrenFields;
};
updateValue = (name, value) => {
const namePath = getNamePath(name);
const prevStore = this.store;
this.updateStore((0,set["default"])(this.store, namePath, value));
this.notifyObservers(prevStore, [namePath], {
type: 'valueUpdate',
source: 'internal'
});
this.notifyWatch([namePath]);
// Dependencies update
const childrenFields = this.triggerDependenciesUpdate(prevStore, namePath);
// trigger callback function
const {
onValuesChange
} = this.callbacks;
if (onValuesChange) {
const changedValues = cloneByNamePathList(this.store, [namePath]);
const allValues = this.getFieldsValue();
const mergedAllValues = (0,set["default"])(allValues, namePath, (0,get["default"])(changedValues, namePath));
onValuesChange(changedValues, mergedAllValues);
}
this.triggerOnFieldsChange([namePath, ...childrenFields]);
};
// Let all child Field get update.
setFieldsValue = store => {
this.warningUnhooked();
const prevStore = this.store;
if (store) {
const nextStore = (0,set.merge)(this.store, store);
this.updateStore(nextStore);
}
this.notifyObservers(prevStore, null, {
type: 'valueUpdate',
source: 'external'
});
this.notifyWatch();
};
setFieldValue = (name, value) => {
this.setFields([{
name,
value,
errors: [],
warnings: [],
touched: true
}]);
};
getDependencyChildrenFields = rootNamePath => {
const children = new Set();
const childrenFields = [];
const dependencies2fields = new utils_NameMap();
/**
* Generate maps
* Can use cache to save perf if user report performance issue with this
*/
this.getFieldEntities().forEach(field => {
const {
dependencies
} = field.props;
(dependencies || []).forEach(dependency => {
const dependencyNamePath = getNamePath(dependency);
dependencies2fields.update(dependencyNamePath, (fields = new Set()) => {
fields.add(field);
return fields;
});
});
});
const fillChildren = namePath => {
const fields = dependencies2fields.get(namePath) || new Set();
fields.forEach(field => {
if (!children.has(field)) {
children.add(field);
const fieldNamePath = field.getNamePath();
if (field.isFieldDirty() && fieldNamePath.length) {
childrenFields.push(fieldNamePath);
fillChildren(fieldNamePath);
}
}
});
};
fillChildren(rootNamePath);
return childrenFields;
};
triggerOnFieldsChange = (namePathList, filedErrors) => {
const {
onFieldsChange
} = this.callbacks;
if (onFieldsChange) {
const fields = this.getFields();
/**
* Fill errors since `fields` may be replaced by controlled fields
*/
if (filedErrors) {
const cache = new utils_NameMap();
filedErrors.forEach(({
name,
errors
}) => {
cache.set(name, errors);
});
fields.forEach(field => {
// eslint-disable-next-line no-param-reassign
field.errors = cache.get(field.name) || field.errors;
});
}
const changedFields = fields.filter(({
name: fieldName
}) => containsNamePath(namePathList, fieldName));
if (changedFields.length) {
onFieldsChange(changedFields, fields);
}
}
};
// =========================== Validate ===========================
validateFields = (arg1, arg2) => {
this.warningUnhooked();
let nameList;
let options;
if (Array.isArray(arg1) || typeof arg1 === 'string' || typeof arg2 === 'string') {
nameList = arg1;
options = arg2;
} else {
options = arg1;
}
const provideNameList = !!nameList;
const namePathList = provideNameList ? nameList.map(getNamePath) : [];
// Same namePathList, but does not include Form.List name
const finalValueNamePathList = [...namePathList];
// Collect result in promise list
const promiseList = [];
// We temp save the path which need trigger for `onFieldsChange`
const TMP_SPLIT = String(Date.now());
const validateNamePathList = new Set();
const {
recursive,
dirty
} = options || {};
this.getFieldEntities(true).forEach(field => {
const fieldNamePath = field.getNamePath();
// Add field if not provide `nameList`
if (!provideNameList) {
if (
// If is field, pass directly
!field.isList() ||
// If is list, do not add if already exist sub field in the namePathList
!namePathList.some(name => matchNamePath(name, fieldNamePath, true))) {
finalValueNamePathList.push(fieldNamePath);
}
namePathList.push(fieldNamePath);
}
// Skip if without rule
if (!field.props.rules || !field.props.rules.length) {
return;
}
// Skip if only validate dirty field
if (dirty && !field.isFieldDirty()) {
return;
}
validateNamePathList.add(fieldNamePath.join(TMP_SPLIT));
// Add field validate rule in to promise list
if (!provideNameList || containsNamePath(namePathList, fieldNamePath, recursive)) {
const promise = field.validateRules({
validateMessages: {
...defaultValidateMessages,
...this.validateMessages
},
...options
});
// Wrap promise with field
promiseList.push(promise.then(() => ({
name: fieldNamePath,
errors: [],
warnings: []
})).catch(ruleErrors => {
const mergedErrors = [];
const mergedWarnings = [];
ruleErrors.forEach?.(({
rule: {
warningOnly
},
errors
}) => {
if (warningOnly) {
mergedWarnings.push(...errors);
} else {
mergedErrors.push(...errors);
}
});
if (mergedErrors.length) {
return Promise.reject({
name: fieldNamePath,
errors: mergedErrors,
warnings: mergedWarnings
});
}
return {
name: fieldNamePath,
errors: mergedErrors,
warnings: mergedWarnings
};
}));
}
});
const summaryPromise = allPromiseFinish(promiseList);
this.lastValidatePromise = summaryPromise;
// Notify fields with rule that validate has finished and need update
summaryPromise.catch(results => results).then(results => {
const resultNamePathList = results.map(({
name
}) => name);
this.notifyObservers(this.store, resultNamePathList, {
type: 'validateFinish'
});
this.triggerOnFieldsChange(resultNamePathList, results);
});
const returnPromise = summaryPromise.then(() => {
if (this.lastValidatePromise === summaryPromise) {
return Promise.resolve(this.getFieldsValue(finalValueNamePathList));
}
return Promise.reject([]);
}).catch(results => {
const errorList = results.filter(result => result && result.errors.length);
const errorMessage = errorList[0]?.errors?.[0];
return Promise.reject({
message: errorMessage,
values: this.getFieldsValue(namePathList),
errorFields: errorList,
outOfDate: this.lastValidatePromise !== summaryPromise
});
});
// Do not throw in console
returnPromise.catch(e => e);
// `validating` changed. Trigger `onFieldsChange`
const triggerNamePathList = namePathList.filter(namePath => validateNamePathList.has(namePath.join(TMP_SPLIT)));
this.triggerOnFieldsChange(triggerNamePathList);
return returnPromise;
};
// ============================ Submit ============================
submit = () => {
this.warningUnhooked();
this.validateFields().then(values => {
const {
onFinish
} = this.callbacks;
if (onFinish) {
try {
onFinish(values);
} catch (err) {
// Should print error if user `onFinish` callback failed
console.error(err);
}
}
}).catch(e => {
const {
onFinishFailed
} = this.callbacks;
if (onFinishFailed) {
onFinishFailed(e);
}
});
};
}
function useForm(form) {
const formRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const [, forceUpdate] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState({});
// Create singleton FormStore
if (!formRef.current) {
if (form) {
formRef.current = form;
} else {
// Create a new FormStore if not provided
const forceReRender = () => {
forceUpdate({});
};
const formStore = new FormStore(forceReRender);
formRef.current = formStore.getForm();
}
}
return [formRef.current];
}
/* harmony default export */ var hooks_useForm = (useForm);
;// ./node_modules/@rc-component/form/es/FormContext.js
const FormContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({
triggerFormChange: () => {},
triggerFormFinish: () => {},
registerForm: () => {},
unregisterForm: () => {}
});
const FormProvider = ({
validateMessages,
onFormChange,
onFormFinish,
children
}) => {
const formContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FormContext);
const formsRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(FormContext.Provider, {
value: {
...formContext,
validateMessages: {
...formContext.validateMessages,
...validateMessages
},
// =========================================================
// = Global Form Control =
// =========================================================
triggerFormChange: (name, changedFields) => {
if (onFormChange) {
onFormChange(name, {
changedFields,
forms: formsRef.current
});
}
formContext.triggerFormChange(name, changedFields);
},
triggerFormFinish: (name, values) => {
if (onFormFinish) {
onFormFinish(name, {
values,
forms: formsRef.current
});
}
formContext.triggerFormFinish(name, values);
},
registerForm: (name, form) => {
if (name) {
formsRef.current = {
...formsRef.current,
[name]: form
};
}
formContext.registerForm(name, form);
},
unregisterForm: name => {
const newForms = {
...formsRef.current
};
delete newForms[name];
formsRef.current = newForms;
formContext.unregisterForm(name);
}
}
}, children);
};
/* harmony default export */ var es_FormContext = (FormContext);
;// ./node_modules/@rc-component/form/es/Form.js
function Form_extends() { Form_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Form_extends.apply(this, arguments); }
const Form = ({
name,
initialValues,
fields,
form,
preserve,
children,
component: Component = 'form',
validateMessages,
validateTrigger = 'onChange',
onValuesChange,
onFieldsChange,
onFinish,
onFinishFailed,
clearOnDestroy,
...restProps
}, ref) => {
const nativeElementRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const formContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(es_FormContext);
// We customize handle event since Context will makes all the consumer re-render:
// https://reactjs.org/docs/context.html#contextprovider
const [formInstance] = hooks_useForm(form);
const {
useSubscribe,
setInitialValues,
setCallbacks,
setValidateMessages,
setPreserve,
destroyForm
} = formInstance.getInternalHooks(HOOK_MARK);
// Pass ref with form instance
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
...formInstance,
nativeElement: nativeElementRef.current
}));
// Register form into Context
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
formContext.registerForm(name, formInstance);
return () => {
formContext.unregisterForm(name);
};
}, [formContext, formInstance, name]);
// Pass props to store
setValidateMessages({
...formContext.validateMessages,
...validateMessages
});
setCallbacks({
onValuesChange,
onFieldsChange: (changedFields, ...rest) => {
formContext.triggerFormChange(name, changedFields);
if (onFieldsChange) {
onFieldsChange(changedFields, ...rest);
}
},
onFinish: values => {
formContext.triggerFormFinish(name, values);
if (onFinish) {
onFinish(values);
}
},
onFinishFailed
});
setPreserve(preserve);
// Set initial value, init store value when first mount
const mountRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
setInitialValues(initialValues, !mountRef.current);
if (!mountRef.current) {
mountRef.current = true;
}
// ========================== Unmount ===========================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => () => destroyForm(clearOnDestroy),
// eslint-disable-next-line react-hooks/exhaustive-deps
[]);
// Prepare children by `children` type
let childrenNode;
const childrenRenderProps = typeof children === 'function';
if (childrenRenderProps) {
const values = formInstance.getFieldsValue(true);
childrenNode = children(values, formInstance);
} else {
childrenNode = children;
}
// Not use subscribe when using render props
useSubscribe(!childrenRenderProps);
// Listen if fields provided. We use ref to save prev data here to avoid additional render
const prevFieldsRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (!isSimilar(prevFieldsRef.current || [], fields || [])) {
formInstance.setFields(fields || []);
}
prevFieldsRef.current = fields;
}, [fields, formInstance]);
// =========================== Render ===========================
const formContextValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
...formInstance,
validateTrigger
}), [formInstance, validateTrigger]);
const wrapperNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_ListContext.Provider, {
value: null
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(FieldContext.Provider, {
value: formContextValue
}, childrenNode));
if (Component === false) {
return wrapperNode;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, Form_extends({}, restProps, {
ref: nativeElementRef,
onSubmit: event => {
event.preventDefault();
event.stopPropagation();
formInstance.submit();
},
onReset: event => {
event.preventDefault();
formInstance.resetFields();
restProps.onReset?.(event);
}
}), wrapperNode);
};
/* harmony default export */ var es_Form = (Form);
;// ./node_modules/@rc-component/form/es/hooks/useWatch.js
function stringify(value) {
try {
return JSON.stringify(value);
} catch {
return Math.random();
}
}
// ------- selector type -------
// ------- selector type end -------
function useWatch_useWatch(...args) {
const [dependencies, _form = {}] = args;
const options = isFormInstance(_form) ? {
form: _form
} : _form;
const form = options.form;
const [value, setValue] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(() => typeof dependencies === 'function' ? dependencies({}) : undefined);
const valueStr = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => stringify(value), [value]);
const valueStrRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(valueStr);
valueStrRef.current = valueStr;
const fieldContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(FieldContext);
const formInstance = form || fieldContext;
const isValidForm = formInstance && formInstance._init;
// Warning if not exist form instance
if (true) {
(0,warning["default"])(args.length === 2 ? form ? isValidForm : true : isValidForm, 'useWatch requires a form instance since it can not auto detect from context.');
}
// ============================== Form ==============================
const {
getFieldsValue,
getInternalHooks
} = formInstance;
const {
registerWatch
} = getInternalHooks(HOOK_MARK);
// ============================= Update =============================
const triggerUpdate = (0,es.useEvent)((values, allValues) => {
const watchValue = options.preserve ? allValues ?? getFieldsValue(true) : values ?? getFieldsValue();
const nextValue = typeof dependencies === 'function' ? dependencies(watchValue) : (0,get["default"])(watchValue, getNamePath(dependencies));
if (stringify(value) !== stringify(nextValue)) {
setValue(nextValue);
}
});
// ============================= Effect =============================
const flattenDeps = typeof dependencies === 'function' ? dependencies : JSON.stringify(dependencies);
// Deps changed
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
// Skip if not exist form instance
if (!isValidForm) {
return;
}
triggerUpdate();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isValidForm, flattenDeps]);
// Value changed
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
// Skip if not exist form instance
if (!isValidForm) {
return;
}
const cancelRegister = registerWatch((values, allValues) => {
triggerUpdate(values, allValues);
});
return cancelRegister;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isValidForm]);
return value;
}
/* harmony default export */ var hooks_useWatch = (useWatch_useWatch);
;// ./node_modules/@rc-component/form/es/index.js
const InternalForm = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(es_Form);
const RefForm = InternalForm;
RefForm.FormProvider = FormProvider;
RefForm.Field = es_Field;
RefForm.List = es_List;
RefForm.useForm = hooks_useForm;
RefForm.useWatch = hooks_useWatch;
/* harmony default export */ var form_es = (RefForm);
;// ./components/form/context.tsx
const context_FormContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({
labelAlign: 'right',
layout: 'horizontal',
itemRef: () => {}
});
const NoStyleItemContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
const context_FormProvider = props => {
const providerProps = (0,es.omit)(props, ['prefixCls']);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(FormProvider, {
...providerProps
});
};
const FormItemPrefixContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({
prefixCls: ''
});
const FormItemInputContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({});
if (true) {
FormItemInputContext.displayName = 'FormItemInputContext';
}
const NoFormStyle = ({
children,
status,
override
}) => {
const formItemInputContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FormItemInputContext);
const newFormItemInputContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const newContext = {
...formItemInputContext
};
if (override) {
delete newContext.isFormItemInput;
}
if (status) {
delete newContext.status;
delete newContext.hasFeedback;
delete newContext.feedbackIcon;
}
return newContext;
}, [status, override, formItemInputContext]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(FormItemInputContext.Provider, {
value: newFormItemInputContext
}, children);
};
const VariantContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(undefined);
;// ./components/_util/ContextIsolator.tsx
const ContextIsolator = props => {
const {
space,
form,
children
} = props;
if (!(0,is.isNonNullable)(children)) {
return null;
}
let result = children;
if (form) {
result = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(NoFormStyle, {
override: true,
status: true
}, result);
}
if (space) {
result = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(NoCompactStyle, null, result);
}
return result;
};
/* harmony default export */ var _util_ContextIsolator = (ContextIsolator);
;// ./components/_util/extendsObject.ts
function mergeProps(...items) {
const ret = {};
items.forEach(item => {
if (item) {
Object.keys(item).forEach(key => {
if (item[key] !== undefined) {
ret[key] = item[key];
}
});
}
});
return ret;
}
/* harmony default export */ var extendsObject = (mergeProps);
;// ./components/_util/hooks/useClosable.tsx
const pickClosable = context => {
if (!context) {
return undefined;
}
const {
closable,
closeIcon
} = context;
return {
closable,
closeIcon
};
};
const EmptyFallbackCloseCollection = {};
const computeClosableConfig = (closable, closeIcon) => {
if (!closable && (closable === false || closeIcon === false || closeIcon === null)) {
return false;
}
if (closable === undefined && closeIcon === undefined) {
return null;
}
let closableConfig = {
closeIcon: typeof closeIcon !== 'boolean' && closeIcon !== null ? closeIcon : undefined
};
if ((0,is.isPlainObject)(closable)) {
closableConfig = {
...closableConfig,
...closable
};
}
return closableConfig;
};
const mergeClosableConfigs = (propConfig, contextConfig, fallbackConfig) => {
if (propConfig === false) {
return false;
}
if (propConfig) {
return extendsObject(fallbackConfig, contextConfig, propConfig);
}
if (contextConfig === false) {
return false;
}
if (contextConfig) {
return extendsObject(fallbackConfig, contextConfig);
}
return fallbackConfig.closable ? fallbackConfig : false;
};
const computeCloseIcon = (mergedConfig, fallbackCloseCollection, closeLabel) => {
const {
closeIconRender
} = fallbackCloseCollection;
const {
closeIcon,
...restConfig
} = mergedConfig;
let finalCloseIcon = closeIcon;
const ariaOrDataProps = (0,pickAttrs["default"])(restConfig, true);
if ((0,is.isNonNullable)(finalCloseIcon)) {
if (closeIconRender) {
finalCloseIcon = closeIconRender(finalCloseIcon);
}
finalCloseIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(finalCloseIcon) ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(finalCloseIcon, {
'aria-label': closeLabel,
...finalCloseIcon.props,
...ariaOrDataProps
})) : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
"aria-label": closeLabel,
...ariaOrDataProps
}, finalCloseIcon));
}
return [finalCloseIcon, ariaOrDataProps];
};
const computeClosable = (propCloseCollection, contextCloseCollection, fallbackCloseCollection = EmptyFallbackCloseCollection, closeLabel = 'Close') => {
const propConfig = computeClosableConfig(propCloseCollection?.closable, propCloseCollection?.closeIcon);
const contextConfig = computeClosableConfig(contextCloseCollection?.closable, contextCloseCollection?.closeIcon);
const mergedFallback = {
closeIcon: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_CloseOutlined, null),
...fallbackCloseCollection
};
const mergedConfig = mergeClosableConfigs(propConfig, contextConfig, mergedFallback);
const closeBtnIsDisabled = typeof mergedConfig !== 'boolean' ? !!mergedConfig?.disabled : false;
if (mergedConfig === false) {
return [false, null, closeBtnIsDisabled, {}];
}
const [closeIcon, ariaProps] = computeCloseIcon(mergedConfig, mergedFallback, closeLabel);
return [true, closeIcon, closeBtnIsDisabled, ariaProps];
};
const useClosable = (propCloseCollection, contextCloseCollection, fallbackCloseCollection = EmptyFallbackCloseCollection) => {
const [contextLocale] = (0,useLocale["default"])('global', en_US["default"].global);
return external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
return computeClosable(propCloseCollection, contextCloseCollection, {
closeIcon: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_CloseOutlined, null),
...fallbackCloseCollection
}, contextLocale.close);
}, [propCloseCollection, contextCloseCollection, fallbackCloseCollection, contextLocale.close]);
};
;// ./node_modules/@rc-component/util/es/Dom/styleChecker.js
const isStyleNameSupport = styleName => {
if ((0,canUseDom["default"])() && window.document.documentElement) {
const styleNameList = Array.isArray(styleName) ? styleName : [styleName];
const {
documentElement
} = window.document;
return styleNameList.some(name => name in documentElement.style);
}
return false;
};
const isStyleValueSupport = (styleName, value) => {
if (!isStyleNameSupport(styleName)) {
return false;
}
const ele = document.createElement('div');
const origin = ele.style[styleName];
ele.style[styleName] = value;
return ele.style[styleName] !== origin;
};
function isStyleSupport(styleName, styleValue) {
if (!Array.isArray(styleName) && styleValue !== undefined) {
return isStyleValueSupport(styleName, styleValue);
}
return isStyleNameSupport(styleName);
}
;// ./components/_util/styleChecker.ts
const canUseDocElement = () => (0,canUseDom["default"])() && window.document.documentElement;
// EXTERNAL MODULE: ./components/_util/zindexContext.ts
var zindexContext = __webpack_require__("./components/_util/zindexContext.ts");
;// ./components/drawer/useFocusable.ts
function useFocusable(focusable, defaultTrap, legacyFocusTriggerAfterClose) {
return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
const ret = {
trap: defaultTrap ?? true,
focusTriggerAfterClose: legacyFocusTriggerAfterClose ?? true
};
return {
...ret,
...focusable
};
}, [focusable, defaultTrap, legacyFocusTriggerAfterClose]);
}
;// ./components/skeleton/Element.tsx
const Element_Element = props => {
const {
prefixCls,
className,
style,
size,
shape
} = props;
if (true) {
const warning = (0,_util_warning.devUseWarning)('Skeleton');
warning.deprecated(size !== 'default', 'size="default"', 'size="medium"');
}
const sizeCls = (0,clsx.clsx)({
[`${prefixCls}-lg`]: size === 'large',
[`${prefixCls}-sm`]: size === 'small'
});
const shapeCls = (0,clsx.clsx)({
[`${prefixCls}-circle`]: shape === 'circle',
[`${prefixCls}-square`]: shape === 'square',
[`${prefixCls}-round`]: shape === 'round'
});
const sizeStyle = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => (0,is.isNumber)(size) ? {
width: size,
height: size,
lineHeight: `${size}px`
} : {}, [size]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(prefixCls, sizeCls, shapeCls, className),
style: {
...sizeStyle,
...style
}
});
};
/* harmony default export */ var skeleton_Element = (Element_Element);
// EXTERNAL MODULE: ./components/skeleton/style/index.ts
var skeleton_style = __webpack_require__("./components/skeleton/style/index.ts");
;// ./components/skeleton/Avatar.tsx
const SkeletonAvatar = props => {
const {
prefixCls: customizePrefixCls,
className,
classNames,
rootClassName,
active,
style,
styles,
shape = 'circle',
size: customSize,
...rest
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('skeleton', customizePrefixCls);
const [hashId, cssVarCls] = (0,skeleton_style["default"])(prefixCls);
const mergedSize = (0,useSize["default"])(ctx => customSize ?? ctx);
const cls = (0,clsx.clsx)(prefixCls, `${prefixCls}-element`, {
[`${prefixCls}-active`]: active
}, classNames?.root, className, rootClassName, hashId, cssVarCls);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: cls,
style: styles?.root
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(skeleton_Element, {
prefixCls: `${prefixCls}-avatar`,
className: classNames?.content,
style: {
...styles?.content,
...style
},
shape: shape,
size: mergedSize,
...rest
}));
};
/* harmony default export */ var Avatar = (SkeletonAvatar);
;// ./components/skeleton/Button.tsx
const SkeletonButton = props => {
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
classNames,
active,
style,
styles,
block = false,
size: customSize,
...rest
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('skeleton', customizePrefixCls);
const [hashId, cssVarCls] = (0,skeleton_style["default"])(prefixCls);
const mergedSize = (0,useSize["default"])(ctx => customSize ?? ctx);
const cls = (0,clsx.clsx)(prefixCls, `${prefixCls}-element`, {
[`${prefixCls}-active`]: active,
[`${prefixCls}-block`]: block
}, classNames?.root, className, rootClassName, hashId, cssVarCls);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: cls,
style: styles?.root
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(skeleton_Element, {
prefixCls: `${prefixCls}-button`,
className: classNames?.content,
style: {
...styles?.content,
...style
},
size: mergedSize,
...rest
}));
};
/* harmony default export */ var skeleton_Button = (SkeletonButton);
;// ./components/skeleton/Node.tsx
const SkeletonNode = props => {
const {
prefixCls: customizePrefixCls,
className,
classNames,
rootClassName,
internalClassName,
style,
styles,
active,
children
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('skeleton', customizePrefixCls);
const [hashId, cssVarCls] = (0,skeleton_style["default"])(prefixCls);
const cls = (0,clsx.clsx)(prefixCls, `${prefixCls}-element`, {
[`${prefixCls}-active`]: active
}, hashId, classNames?.root, className, rootClassName, cssVarCls);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: cls,
style: styles?.root
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(classNames?.content, internalClassName || `${prefixCls}-node`),
style: {
...styles?.content,
...style
}
}, children));
};
/* harmony default export */ var Node = (SkeletonNode);
;// ./components/skeleton/Image.tsx
const SkeletonImage = props => {
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('skeleton', props.prefixCls);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Node, {
...props,
internalClassName: `${prefixCls}-image`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("svg", {
viewBox: "0 0 1098 1024",
xmlns: "http://www.w3.org/2000/svg",
className: `${prefixCls}-image-svg`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("title", null, "Image placeholder"), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
d: "M365.7 329.1q0 45.8-32 77.7t-77.7 32-77.7-32-32-77.7 32-77.6 77.7-32 77.7 32 32 77.6M951 548.6v256H146.3V694.9L329 512l91.5 91.4L713 311zm54.8-402.3H91.4q-7.4 0-12.8 5.4T73 164.6v694.8q0 7.5 5.5 12.9t12.8 5.4h914.3q7.5 0 12.9-5.4t5.4-12.9V164.6q0-7.5-5.4-12.9t-12.9-5.4m91.4 18.3v694.8q0 37.8-26.8 64.6t-64.6 26.9H91.4q-37.7 0-64.6-26.9T0 859.4V164.6q0-37.8 26.8-64.6T91.4 73h914.3q37.8 0 64.6 26.9t26.8 64.6",
className: `${prefixCls}-image-path`
})));
};
/* harmony default export */ var skeleton_Image = (SkeletonImage);
;// ./components/skeleton/Input.tsx
const SkeletonInput = props => {
const {
prefixCls: customizePrefixCls,
className,
classNames,
rootClassName,
active,
block,
style,
styles,
size: customSize,
...rest
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('skeleton', customizePrefixCls);
const [hashId, cssVarCls] = (0,skeleton_style["default"])(prefixCls);
const mergedSize = (0,useSize["default"])(ctx => customSize ?? ctx);
const cls = (0,clsx.clsx)(prefixCls, `${prefixCls}-element`, {
[`${prefixCls}-active`]: active,
[`${prefixCls}-block`]: block
}, classNames?.root, className, rootClassName, hashId, cssVarCls);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: cls,
style: styles?.root
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(skeleton_Element, {
prefixCls: `${prefixCls}-input`,
className: classNames?.content,
style: {
...styles?.content,
...style
},
size: mergedSize,
...rest
}));
};
/* harmony default export */ var Input = (SkeletonInput);
;// ./components/skeleton/Paragraph.tsx
const getWidth = (index, props) => {
const {
width,
rows = 2
} = props;
if (Array.isArray(width)) {
return width[index];
}
// last paragraph
if (rows - 1 === index) {
return width;
}
return undefined;
};
const Paragraph = props => {
const {
prefixCls,
className,
style,
rows = 0
} = props;
const rowList = Array.from({
length: rows
}).map((_, index) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("li", {
key: index,
style: {
width: getWidth(index, props)
}
})));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("ul", {
className: (0,clsx.clsx)(prefixCls, className),
style: style
}, rowList);
};
/* harmony default export */ var skeleton_Paragraph = (Paragraph);
;// ./components/skeleton/Title.tsx
/* eslint-disable jsx-a11y/heading-has-content */
const Title = ({
prefixCls,
className,
width,
style
}) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("h3", {
className: (0,clsx.clsx)(prefixCls, className),
style: {
width,
...style
}
}));
/* harmony default export */ var skeleton_Title = (Title);
;// ./components/skeleton/Skeleton.tsx
function getComponentProps(prop) {
if ((0,is.isPlainObject)(prop)) {
return prop;
}
return {};
}
function getAvatarBasicProps(hasTitle, hasParagraph) {
if (hasTitle && !hasParagraph) {
// Square avatar
return {
size: 'large',
shape: 'square'
};
}
return {
size: 'large',
shape: 'circle'
};
}
function getTitleBasicProps(hasAvatar, hasParagraph) {
if (!hasAvatar && hasParagraph) {
return {
width: '38%'
};
}
if (hasAvatar && hasParagraph) {
return {
width: '50%'
};
}
return {};
}
function getParagraphBasicProps(hasAvatar, hasTitle) {
const basicProps = {};
// Width
if (!hasAvatar || !hasTitle) {
basicProps.width = '61%';
}
// Rows
if (!hasAvatar && hasTitle) {
basicProps.rows = 3;
} else {
basicProps.rows = 2;
}
return basicProps;
}
// Tips: ctx.classNames.root < ctx.className < cpns.classNames.root < cpns.className < rootClassName
const Skeleton = props => {
const {
prefixCls: customizePrefixCls,
loading,
className,
rootClassName,
classNames,
style,
styles,
children,
avatar = false,
title = true,
paragraph = true,
active,
round
} = props;
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('skeleton');
const prefixCls = getPrefixCls('skeleton', customizePrefixCls);
const [hashId, cssVarCls] = (0,skeleton_style["default"])(prefixCls);
const mergedProps = {
...props,
avatar,
title,
paragraph
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
if (loading || !('loading' in props)) {
const hasAvatar = !!avatar;
const hasTitle = !!title;
const hasParagraph = !!paragraph;
// Avatar
let avatarNode;
if (hasAvatar) {
const avatarProps = {
className: mergedClassNames.avatar,
prefixCls: `${prefixCls}-avatar`,
...getAvatarBasicProps(hasTitle, hasParagraph),
...getComponentProps(avatar),
style: mergedStyles.avatar
};
// We direct use SkeletonElement as avatar in skeleton internal.
avatarNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(mergedClassNames.header, `${prefixCls}-header`),
style: mergedStyles.header
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(skeleton_Element, {
...avatarProps
}));
}
let contentNode;
if (hasTitle || hasParagraph) {
// Title
let $title;
if (hasTitle) {
const titleProps = {
className: mergedClassNames.title,
prefixCls: `${prefixCls}-title`,
...getTitleBasicProps(hasAvatar, hasParagraph),
...getComponentProps(title),
style: mergedStyles.title
};
$title = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(skeleton_Title, {
...titleProps
});
}
// Paragraph
let paragraphNode;
if (hasParagraph) {
const paragraphProps = {
className: mergedClassNames.paragraph,
prefixCls: `${prefixCls}-paragraph`,
...getParagraphBasicProps(hasAvatar, hasTitle),
...getComponentProps(paragraph),
style: mergedStyles.paragraph
};
paragraphNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(skeleton_Paragraph, {
...paragraphProps
});
}
contentNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(mergedClassNames.section, `${prefixCls}-section`),
style: mergedStyles.section
}, $title, paragraphNode);
}
const cls = (0,clsx.clsx)(prefixCls, {
[`${prefixCls}-with-avatar`]: hasAvatar,
[`${prefixCls}-active`]: active,
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-round`]: round
}, mergedClassNames.root, contextClassName, className, rootClassName, hashId, cssVarCls);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: cls,
style: {
...mergedStyles.root,
...contextStyle,
...style
}
}, avatarNode, contentNode);
}
return children ?? null;
};
Skeleton.Button = skeleton_Button;
Skeleton.Avatar = Avatar;
Skeleton.Input = Input;
Skeleton.Image = skeleton_Image;
Skeleton.Node = Node;
if (true) {
Skeleton.displayName = 'Skeleton';
}
/* harmony default export */ var skeleton_Skeleton = (Skeleton);
;// ./components/skeleton/index.tsx
/* harmony default export */ var skeleton = (skeleton_Skeleton);
;// ./components/watermark/context.ts
function voidFunc() {}
const WatermarkContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({
add: voidFunc,
remove: voidFunc
});
function usePanelRef(panelSelector) {
const watermark = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(WatermarkContext);
const panelEleRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const panelRef = (0,es.useEvent)(ele => {
if (ele) {
const innerContentEle = panelSelector ? ele.querySelector(panelSelector) : ele;
if (innerContentEle) {
watermark.add(innerContentEle);
panelEleRef.current = innerContentEle;
}
} else {
watermark.remove(panelEleRef.current);
}
});
return panelRef;
}
/* harmony default export */ var watermark_context = (WatermarkContext);
;// ./components/modal/components/NormalCancelBtn.tsx
const NormalCancelBtn = () => {
const {
cancelButtonProps,
cancelTextLocale,
onCancel
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(ModalContext);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(button_Button, {
onClick: onCancel,
...cancelButtonProps
}, cancelTextLocale);
};
/* harmony default export */ var components_NormalCancelBtn = (NormalCancelBtn);
;// ./components/modal/components/NormalOkBtn.tsx
const NormalOkBtn = () => {
const {
confirmLoading,
okButtonProps,
okType,
okTextLocale,
onOk
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(ModalContext);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(button_Button, {
...convertLegacyProps(okType),
loading: confirmLoading,
onClick: onOk,
...okButtonProps
}, okTextLocale);
};
/* harmony default export */ var components_NormalOkBtn = (NormalOkBtn);
;// ./components/modal/shared.tsx
function renderCloseIcon(prefixCls, closeIcon) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: `${prefixCls}-close-x`
}, closeIcon || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_CloseOutlined, {
className: `${prefixCls}-close-icon`
}));
}
const Footer = props => {
const {
okText,
okType = 'primary',
cancelText,
confirmLoading,
onOk,
onCancel,
okButtonProps,
cancelButtonProps,
footer
} = props;
const [locale] = (0,useLocale["default"])('Modal', getConfirmLocale());
// ================== Locale Text ==================
const okTextLocale = okText || locale?.okText;
const cancelTextLocale = cancelText || locale?.cancelText;
const memoizedValue = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
return {
confirmLoading,
okButtonProps,
cancelButtonProps,
okTextLocale,
cancelTextLocale,
okType,
onOk,
onCancel
};
}, [confirmLoading, okButtonProps, cancelButtonProps, okTextLocale, cancelTextLocale, okType, onOk, onCancel]);
let footerNode;
if (typeof footer === 'function' || typeof footer === 'undefined') {
footerNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_NormalCancelBtn, null), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_NormalOkBtn, null));
if (typeof footer === 'function') {
footerNode = footer(footerNode, {
OkBtn: components_NormalOkBtn,
CancelBtn: components_NormalCancelBtn
});
}
footerNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(ModalContextProvider, {
value: memoizedValue
}, footerNode);
} else {
footerNode = footer;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(DisabledContextProvider, {
disabled: false
}, footerNode);
};
// EXTERNAL MODULE: ./components/modal/style/index.ts
var modal_style = __webpack_require__("./components/modal/style/index.ts");
;// ./components/modal/Modal.tsx
let mousePosition;
// ref: https://github.com/ant-design/ant-design/issues/15795
const getClickPosition = e => {
mousePosition = {
x: e.pageX,
y: e.pageY
};
// 100ms 内发生过点击事件,则从点击位置动画展示
// 否则直接 zoom 展示
// 这样可以兼容非点击方式展开
setTimeout(() => {
mousePosition = null;
}, 100);
};
// 只有点击事件支持从鼠标位置动画展开
if (canUseDocElement()) {
document.documentElement.addEventListener('click', getClickPosition, true);
}
const Modal = props => {
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
open,
wrapClassName,
centered,
getContainer,
style,
width = 520,
footer,
classNames,
styles,
children,
loading,
confirmLoading,
zIndex: customizeZIndex,
mousePosition: customizeMousePosition,
onOk,
onCancel,
okButtonProps,
cancelButtonProps,
destroyOnHidden,
destroyOnClose,
panelRef = null,
closable,
mask: modalMask,
modalRender,
maskClosable,
// Focusable
focusTriggerAfterClose,
focusable,
...restProps
} = props;
const {
getPopupContainer: getContextPopupContainer,
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles,
centered: contextCentered,
cancelButtonProps: contextCancelButtonProps,
okButtonProps: contextOkButtonProps,
mask: contextMask
} = (0,config_provider_context.useComponentConfig)('modal');
const {
modal: modalContext
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const [closableAfterClose, onClose] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (typeof closable === 'boolean') {
return [undefined, undefined];
}
return [closable?.afterClose, closable?.onClose];
}, [closable]);
const prefixCls = getPrefixCls('modal', customizePrefixCls);
const rootPrefixCls = getPrefixCls();
// ============================ Mask ============================
const [mergedMask, maskBlurClassName, mergeMaskClosable] = useMergedMask(modalMask, contextMask, prefixCls, maskClosable);
// ========================== Focusable =========================
const mergedFocusable = useFocusable(focusable, mergedMask, focusTriggerAfterClose);
// ============================ Open ============================
const handleCancel = e => {
if (confirmLoading) {
return;
}
onCancel?.(e);
onClose?.();
};
const handleOk = e => {
onOk?.(e);
onClose?.();
};
if (true) {
const warning = (0,_util_warning.devUseWarning)('Modal');
[['bodyStyle', 'styles.body'], ['maskStyle', 'styles.mask'], ['destroyOnClose', 'destroyOnHidden'], ['autoFocusButton', 'focusable.autoFocusButton'], ['focusTriggerAfterClose', 'focusable.focusTriggerAfterClose'], ['maskClosable', 'mask.closable']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
}
// Style
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,modal_style["default"])(prefixCls, rootCls);
const wrapClassNameExtended = (0,clsx.clsx)(wrapClassName, {
[`${prefixCls}-centered`]: centered ?? contextCentered,
[`${prefixCls}-wrap-rtl`]: direction === 'rtl'
});
const dialogFooter = footer !== null && !loading ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Footer, {
...props,
okButtonProps: {
...contextOkButtonProps,
...okButtonProps
},
onOk: handleOk,
cancelButtonProps: {
...contextCancelButtonProps,
...cancelButtonProps
},
onCancel: handleCancel
})) : null;
const [rawClosable, mergedCloseIcon, closeBtnIsDisabled, ariaProps] = useClosable(pickClosable(props), pickClosable(modalContext), {
closable: true,
closeIcon: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CloseOutlined, {
className: `${prefixCls}-close-icon`
}),
closeIconRender: icon => renderCloseIcon(prefixCls, icon)
});
const mergedClosable = rawClosable ? {
disabled: closeBtnIsDisabled,
closeIcon: mergedCloseIcon,
afterClose: closableAfterClose,
...ariaProps
} : false;
// ============================ modalRender ============================
const mergedModalRender = modalRender ? node => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-render`
}, modalRender(node)) : undefined;
// ============================ Refs ============================
// Select `ant-modal-container` by `panelRef`
const panelClassName = `.${prefixCls}-${modalRender ? 'render' : 'container'}`;
const innerPanelRef = usePanelRef(panelClassName);
const mergedPanelRef = (0,es_ref.composeRef)(panelRef, innerPanelRef);
// ============================ zIndex ============================
const [zIndex, contextZIndex] = (0,useZIndex.useZIndex)('Modal', customizeZIndex);
const mergedProps = {
...props,
width,
panelRef,
focusTriggerAfterClose: mergedFocusable.focusTriggerAfterClose,
focusable: mergedFocusable,
mask: mergedMask,
maskClosable: mergeMaskClosable,
zIndex
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames, maskBlurClassName], [contextStyles, styles], {
props: mergedProps
});
// =========================== Width ============================
const [numWidth, responsiveWidth] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if ((0,is.isPlainObject)(width)) {
return [undefined, width];
}
return [width, undefined];
}, [width]);
const responsiveWidthVars = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const vars = {};
if (responsiveWidth) {
Object.keys(responsiveWidth).forEach(breakpoint => {
const breakpointWidth = responsiveWidth[breakpoint];
if ((0,is.isNonNullable)(breakpointWidth)) {
vars[`--${prefixCls}-${breakpoint}-width`] = (0,is.isNumber)(breakpointWidth) ? `${breakpointWidth}px` : breakpointWidth;
}
});
}
return vars;
}, [prefixCls, responsiveWidth]);
// =========================== Render ===========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(_util_ContextIsolator, {
form: true,
space: true
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(zindexContext["default"].Provider, {
value: contextZIndex
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(dialog_es, {
width: numWidth,
...restProps,
zIndex: zIndex,
getContainer: getContainer === undefined ? getContextPopupContainer : getContainer,
prefixCls: prefixCls,
rootClassName: (0,clsx.clsx)(hashId, rootClassName, cssVarCls, rootCls, mergedClassNames.root),
rootStyle: mergedStyles.root,
footer: dialogFooter,
visible: open,
mousePosition: customizeMousePosition ?? mousePosition,
onClose: handleCancel,
closable: mergedClosable,
closeIcon: mergedCloseIcon,
transitionName: (0,_util_motion.getTransitionName)(rootPrefixCls, 'zoom', props.transitionName),
maskTransitionName: (0,_util_motion.getTransitionName)(rootPrefixCls, 'fade', props.maskTransitionName),
mask: mergedMask,
maskClosable: mergeMaskClosable,
className: (0,clsx.clsx)(hashId, className, contextClassName),
style: {
...contextStyle,
...style,
...responsiveWidthVars
},
classNames: {
...mergedClassNames,
wrapper: (0,clsx.clsx)(mergedClassNames.wrapper, wrapClassNameExtended)
},
styles: mergedStyles,
panelRef: mergedPanelRef,
destroyOnHidden: destroyOnHidden ?? destroyOnClose,
modalRender: mergedModalRender,
// Focusable
focusTriggerAfterClose: mergedFocusable.focusTriggerAfterClose,
focusTrap: mergedFocusable.trap
}, loading ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(skeleton, {
active: true,
title: false,
paragraph: {
rows: 4
},
className: `${prefixCls}-body-skeleton`
})) : children)));
};
/* harmony default export */ var modal_Modal = (Modal);
// EXTERNAL MODULE: ./components/style/index.tsx
var components_style = __webpack_require__("./components/style/index.tsx");
;// ./components/modal/style/confirm.ts
// ============================= Confirm ==============================
const genModalConfirmStyle = token => {
const {
componentCls,
titleFontSize,
titleLineHeight,
modalConfirmIconSize,
fontSize,
lineHeight,
modalTitleHeight,
fontHeight,
confirmBodyPadding
} = token;
const confirmComponentCls = `${componentCls}-confirm`;
return {
[confirmComponentCls]: {
'&-rtl': {
direction: 'rtl'
},
[`${token.antCls}-modal-header`]: {
display: 'none'
},
[`${confirmComponentCls}-body-wrapper`]: {
...(0,components_style.clearFix)()
},
[`&${componentCls} ${componentCls}-body`]: {
padding: confirmBodyPadding
},
// ====================== Body ======================
[`${confirmComponentCls}-body`]: {
display: 'flex',
flexWrap: 'nowrap',
alignItems: 'start',
[`> ${token.iconCls}`]: {
flex: 'none',
fontSize: modalConfirmIconSize,
marginInlineEnd: token.confirmIconMarginInlineEnd,
marginTop: token.calc(token.calc(fontHeight).sub(modalConfirmIconSize).equal()).div(2).equal()
},
[`&-has-title > ${token.iconCls}`]: {
marginTop: token.calc(token.calc(modalTitleHeight).sub(modalConfirmIconSize).equal()).div(2).equal()
}
},
[`${confirmComponentCls}-paragraph`]: {
display: 'flex',
flexDirection: 'column',
flex: 'auto',
rowGap: token.marginXS,
// https://github.com/ant-design/ant-design/issues/51912
maxWidth: `calc(100% - ${(0,cssinjs.unit)(token.marginSM)})`
},
[`${confirmComponentCls}-body-no-icon ${confirmComponentCls}-paragraph`]: {
maxWidth: '100%'
},
// https://github.com/ant-design/ant-design/issues/48159
[`${token.iconCls} + ${confirmComponentCls}-paragraph`]: {
maxWidth: `calc(100% - ${(0,cssinjs.unit)(token.calc(token.modalConfirmIconSize).add(token.marginSM).equal())})`
},
[`${confirmComponentCls}-title`]: {
color: token.colorTextHeading,
fontWeight: token.fontWeightStrong,
fontSize: titleFontSize,
lineHeight: titleLineHeight
},
[`${confirmComponentCls}-container`]: {
color: token.colorText,
fontSize,
lineHeight
},
// ===================== Footer =====================
[`${confirmComponentCls}-btns`]: {
textAlign: 'end',
marginTop: token.confirmBtnsMarginTop,
[`${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
}
};
};
// ============================== Export ==============================
/* harmony default export */ var style_confirm = ((0,genStyleUtils.genSubStyleComponent)(['Modal', 'confirm'], token => {
const modalToken = (0,modal_style.prepareToken)(token);
return genModalConfirmStyle(modalToken);
}, modal_style.prepareComponentToken, {
// confirm is weak than modal since no conflict here
order: -1000
}));
;// ./components/modal/ConfirmDialog.tsx
const ConfirmContent = props => {
const {
prefixCls,
icon,
okText,
cancelText,
confirmPrefixCls,
type,
okCancel,
footer,
// Legacy for static function usage
locale: staticLocale,
autoFocusButton,
focusable,
...restProps
} = props;
if (true) {
const warning = (0,_util_warning.devUseWarning)('Modal');
true ? warning(!(typeof icon === 'string' && icon.length > 2), 'breaking', `\`icon\` is using ReactNode instead of string naming in v4. Please check \`${icon}\` at https://ant.design/components/icon`) : 0;
}
// Icon
let mergedIcon = icon;
// 支持传入{ icon: null }来隐藏`Modal.confirm`默认的Icon
if (!icon && icon !== null) {
switch (type) {
case 'info':
mergedIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_InfoCircleFilled, null);
break;
case 'success':
mergedIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CheckCircleFilled, null);
break;
case 'error':
mergedIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CloseCircleFilled, null);
break;
default:
mergedIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_ExclamationCircleFilled, null);
}
}
// 默认为 true,保持向下兼容
const mergedOkCancel = okCancel ?? type === 'confirm';
const mergedAutoFocusButton = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const base = focusable?.autoFocusButton || autoFocusButton;
return base || base === null ? base : 'ok';
}, [autoFocusButton, focusable?.autoFocusButton]);
const [locale] = (0,useLocale["default"])('Modal');
const mergedLocale = staticLocale || locale;
// ================== Locale Text ==================
const okTextLocale = okText || (mergedOkCancel ? mergedLocale?.okText : mergedLocale?.justOkText);
const cancelTextLocale = cancelText || mergedLocale?.cancelText;
// ================= Context Value =================
const {
closable
} = restProps;
const {
onClose
} = (0,is.isPlainObject)(closable) ? closable : {};
const memoizedValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
return {
autoFocusButton: mergedAutoFocusButton,
cancelTextLocale,
okTextLocale,
mergedOkCancel,
onClose,
...restProps
};
}, [mergedAutoFocusButton, cancelTextLocale, okTextLocale, mergedOkCancel, onClose, restProps]);
// ====================== Footer Origin Node ======================
const footerOriginNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_ConfirmCancelBtn, null), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_ConfirmOkBtn, null));
const hasTitle = (0,is.isNonNullable)(props.title) && props.title !== '';
const hasIcon = (0,is.isNonNullable)(mergedIcon);
const bodyCls = `${confirmPrefixCls}-body`;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${confirmPrefixCls}-body-wrapper`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(bodyCls, {
[`${bodyCls}-has-title`]: hasTitle,
[`${bodyCls}-no-icon`]: !hasIcon
})
}, mergedIcon, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${confirmPrefixCls}-paragraph`
}, hasTitle && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${confirmPrefixCls}-title`
}, props.title), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${confirmPrefixCls}-content`
}, props.content))), footer === undefined || typeof footer === 'function' ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(ModalContextProvider, {
value: memoizedValue
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${confirmPrefixCls}-btns`
}, typeof footer === 'function' ? footer(footerOriginNode, {
OkBtn: components_ConfirmOkBtn,
CancelBtn: components_ConfirmCancelBtn
}) : footerOriginNode))) : footer, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(style_confirm, {
prefixCls: prefixCls
}));
};
const ConfirmDialog = props => {
const {
close,
zIndex,
maskStyle,
direction,
prefixCls,
wrapClassName,
rootPrefixCls,
bodyStyle,
closable = false,
onConfirm,
styles,
title,
mask,
maskClosable,
okButtonProps,
cancelButtonProps
} = props;
const {
cancelButtonProps: contextCancelButtonProps,
okButtonProps: contextOkButtonProps
} = (0,config_provider_context.useComponentConfig)('modal');
if (true) {
const warning = (0,_util_warning.devUseWarning)('Modal');
[['bodyStyle', 'styles.body'], ['maskStyle', 'styles.mask']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
}
const confirmPrefixCls = `${prefixCls}-confirm`;
const width = props.width || 416;
const style = props.style || {};
const classString = (0,clsx.clsx)(confirmPrefixCls, `${confirmPrefixCls}-${props.type}`, {
[`${confirmPrefixCls}-rtl`]: direction === 'rtl'
}, props.className);
// ========================== Mask ==========================
// 默认为 false,保持旧版默认行为
const mergedMask = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const nextMaskConfig = normalizeMaskConfig(mask, maskClosable);
nextMaskConfig.closable ?? (nextMaskConfig.closable = false);
return nextMaskConfig;
}, [mask, maskClosable]);
// ========================= zIndex =========================
const [, token] = (0,useToken["default"])();
const mergedZIndex = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (zIndex !== undefined) {
return zIndex;
}
// Static always use max zIndex
return token.zIndexPopupBase + useZIndex.CONTAINER_MAX_OFFSET;
}, [zIndex, token]);
// ========================= Render =========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(modal_Modal, {
...props,
className: classString,
wrapClassName: (0,clsx.clsx)({
[`${confirmPrefixCls}-centered`]: !!props.centered
}, wrapClassName),
onCancel: () => {
close?.({
triggerCancel: true
});
onConfirm?.(false);
},
title: title,
footer: null,
transitionName: (0,_util_motion.getTransitionName)(rootPrefixCls || '', 'zoom', props.transitionName),
maskTransitionName: (0,_util_motion.getTransitionName)(rootPrefixCls || '', 'fade', props.maskTransitionName),
mask: mergedMask,
style: style,
styles: {
body: bodyStyle,
mask: maskStyle,
...styles
},
width: width,
zIndex: mergedZIndex,
closable: closable
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(ConfirmContent, {
...props,
confirmPrefixCls: confirmPrefixCls,
okButtonProps: {
...contextOkButtonProps,
...okButtonProps
},
cancelButtonProps: {
...contextCancelButtonProps,
...cancelButtonProps
}
}));
};
const ConfirmDialogWrapper = props => {
const {
rootPrefixCls,
iconPrefixCls,
direction,
theme
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(config_provider, {
prefixCls: rootPrefixCls,
iconPrefixCls: iconPrefixCls,
direction: direction,
theme: theme
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(ConfirmDialog, {
...props
}));
};
if (true) {
ConfirmDialog.displayName = 'ConfirmDialog';
ConfirmDialogWrapper.displayName = 'ConfirmDialogWrapper';
}
/* harmony default export */ var modal_ConfirmDialog = (ConfirmDialogWrapper);
;// ./components/modal/destroyFns.ts
const destroyFns = [];
/* harmony default export */ var modal_destroyFns = (destroyFns);
;// ./components/modal/confirm.tsx
let defaultRootPrefixCls = '';
function getRootPrefixCls() {
return defaultRootPrefixCls;
}
const confirm_ConfirmDialogWrapper = props => {
const {
prefixCls: customizePrefixCls,
getContainer,
direction
} = props;
const runtimeLocale = getConfirmLocale();
const config = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(config_provider_context.ConfigContext);
const rootPrefixCls = getRootPrefixCls() || config.getPrefixCls();
// because Modal.config set rootPrefixCls, which is different from other components
const prefixCls = customizePrefixCls || `${rootPrefixCls}-modal`;
let mergedGetContainer = getContainer;
if (mergedGetContainer === false) {
mergedGetContainer = undefined;
if (true) {
true ? (0,_util_warning["default"])(false, 'Modal', 'Static method not support `getContainer` to be `false` since it do not have context env.') : 0;
}
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(modal_ConfirmDialog, {
...props,
rootPrefixCls: rootPrefixCls,
prefixCls: prefixCls,
iconPrefixCls: config.iconPrefixCls,
theme: config.theme,
direction: direction ?? config.direction,
locale: config.locale?.Modal ?? runtimeLocale,
getContainer: mergedGetContainer
});
};
function confirm_confirm(config) {
const global = globalConfig();
if ( true && !global.holderRender) {
warnContext('Modal');
}
const container = document.createDocumentFragment();
let currentConfig = {
...config,
close,
open: true
};
let timeoutId;
function destroy(...args) {
const triggerCancel = args.some(param => param?.triggerCancel);
if (triggerCancel) {
config.onCancel?.(() => {}, ...args.slice(1));
}
for (let i = 0; i < modal_destroyFns.length; i++) {
const fn = modal_destroyFns[i];
if (fn === close) {
modal_destroyFns.splice(i, 1);
break;
}
}
unmount(container).then(() => {
// Do nothing
});
}
const scheduleRender = props => {
clearTimeout(timeoutId);
/**
* https://github.com/ant-design/ant-design/issues/23623
*
* Sync render blocks React event. Let's make this async.
*/
timeoutId = setTimeout(() => {
const rootPrefixCls = global.getPrefixCls(undefined, getRootPrefixCls());
const iconPrefixCls = global.getIconPrefixCls();
const theme = global.getTheme();
const dom = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(confirm_ConfirmDialogWrapper, {
...props
});
render(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(config_provider, {
prefixCls: rootPrefixCls,
iconPrefixCls: iconPrefixCls,
theme: theme
}, typeof global.holderRender === 'function' ? global.holderRender(dom) : dom), container);
});
};
function close(...args) {
currentConfig = {
...currentConfig,
open: false,
afterClose: () => {
if (typeof config.afterClose === 'function') {
config.afterClose();
}
// @ts-ignore
destroy.apply(this, args);
}
};
scheduleRender(currentConfig);
}
function update(configUpdate) {
if (typeof configUpdate === 'function') {
currentConfig = configUpdate(currentConfig);
} else {
currentConfig = {
...currentConfig,
...configUpdate
};
}
scheduleRender(currentConfig);
}
scheduleRender(currentConfig);
modal_destroyFns.push(close);
return {
destroy: close,
update
};
}
function withWarn(props) {
return {
...props,
type: 'warning'
};
}
function withInfo(props) {
return {
...props,
type: 'info'
};
}
function withSuccess(props) {
return {
...props,
type: 'success'
};
}
function withError(props) {
return {
...props,
type: 'error'
};
}
function withConfirm(props) {
return {
...props,
type: 'confirm'
};
}
function modalGlobalConfig({
rootPrefixCls
}) {
true ? (0,_util_warning["default"])(false, 'Modal', 'Modal.config is deprecated. Please use ConfigProvider.config instead.') : 0;
defaultRootPrefixCls = rootPrefixCls;
}
;// ./components/modal/useModal/HookModal.tsx
const HookModal = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
afterClose: hookAfterClose,
config,
...restProps
} = props;
const [open, setOpen] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(true);
const [innerConfig, setInnerConfig] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(config);
const {
direction,
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('modal');
const rootPrefixCls = getPrefixCls();
const afterClose = () => {
hookAfterClose();
innerConfig.afterClose?.();
};
const close = (...args) => {
setOpen(false);
const triggerCancel = args.some(param => param?.triggerCancel);
if (triggerCancel) {
innerConfig.onCancel?.(() => {}, ...args.slice(1));
}
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
destroy: close,
update: newConfig => {
setInnerConfig(originConfig => {
const nextConfig = typeof newConfig === 'function' ? newConfig(originConfig) : newConfig;
return {
...originConfig,
...nextConfig
};
});
}
}));
const mergedOkCancel = innerConfig.okCancel ?? innerConfig.type === 'confirm';
const [contextLocale] = (0,useLocale["default"])('Modal', en_US["default"].Modal);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(modal_ConfirmDialog, {
prefixCls: prefixCls,
rootPrefixCls: rootPrefixCls,
...innerConfig,
close: close,
open: open,
afterClose: afterClose,
okText: innerConfig.okText || (mergedOkCancel ? contextLocale?.okText : contextLocale?.justOkText),
direction: innerConfig.direction || direction,
cancelText: innerConfig.cancelText || contextLocale?.cancelText,
...restProps
});
});
/* harmony default export */ var useModal_HookModal = (HookModal);
;// ./components/modal/useModal/index.tsx
let useModal_uuid = 0;
const ElementsHolder = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((_props, ref) => {
const [elements, patchElement] = usePatchElement();
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
patchElement
}), [patchElement]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, elements);
}));
function useModal() {
const holderRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
// ========================== Effect ==========================
const [actionQueue, setActionQueue] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (actionQueue.length) {
const cloneQueue = (0,toConsumableArray["default"])(actionQueue);
cloneQueue.forEach(action => {
action();
});
setActionQueue([]);
}
}, [actionQueue]);
// =========================== Hook ===========================
const getConfirmFunc = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(withFunc => function hookConfirm(config) {
useModal_uuid += 1;
const modalRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createRef();
// Proxy to promise with `onClose`
let resolvePromise;
const promise = new Promise(resolve => {
resolvePromise = resolve;
});
let silent = false;
let closeFunc;
const modal = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(useModal_HookModal, {
key: `modal-${useModal_uuid}`,
config: withFunc(config),
ref: modalRef,
afterClose: () => {
closeFunc?.();
},
isSilent: () => silent,
onConfirm: confirmed => {
resolvePromise(confirmed);
}
});
closeFunc = holderRef.current?.patchElement(modal);
if (closeFunc) {
modal_destroyFns.push(closeFunc);
}
const instance = {
destroy: () => {
function destroyAction() {
modalRef.current?.destroy();
}
if (modalRef.current) {
destroyAction();
} else {
setActionQueue(prev => [].concat((0,toConsumableArray["default"])(prev), [destroyAction]));
}
},
update: newConfig => {
function updateAction() {
modalRef.current?.update(newConfig);
}
if (modalRef.current) {
updateAction();
} else {
setActionQueue(prev => [].concat((0,toConsumableArray["default"])(prev), [updateAction]));
}
},
then: resolve => {
silent = true;
return promise.then(resolve);
}
};
return instance;
}, []);
const fns = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
info: getConfirmFunc(withInfo),
success: getConfirmFunc(withSuccess),
error: getConfirmFunc(withError),
warning: getConfirmFunc(withWarn),
confirm: getConfirmFunc(withConfirm)
}), [getConfirmFunc]);
return [fns, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(ElementsHolder, {
key: "modal-holder",
ref: holderRef
})];
}
/* harmony default export */ var modal_useModal = (useModal);
// EXTERNAL MODULE: ./components/notification/style/index.ts + 3 modules
var notification_style = __webpack_require__("./components/notification/style/index.ts");
;// ./components/notification/style/pure-panel.ts
/* harmony default export */ var pure_panel = ((0,genStyleUtils.genSubStyleComponent)(['Notification', 'PurePanel'], token => {
const noticeCls = `${token.componentCls}-notice`;
const notificationToken = (0,notification_style.prepareNotificationToken)(token);
return {
[`${noticeCls}-pure-panel`]: {
...(0,notification_style.genNoticeStyle)(notificationToken),
width: notificationToken.width,
maxWidth: `calc(100vw - ${(0,cssinjs.unit)(token.calc(notificationToken.notificationMarginEdge).mul(2).equal())})`,
margin: 0
}
};
}, notification_style.prepareComponentToken));
;// ./components/notification/PurePanel.tsx
const PurePanel_TypeIcon = {
info: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_InfoCircleFilled, null),
success: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CheckCircleFilled, null),
error: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CloseCircleFilled, null),
warning: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_ExclamationCircleFilled, null),
loading: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LoadingOutlined, null)
};
function getCloseIcon(prefixCls, closeIcon) {
if (closeIcon === null || closeIcon === false) {
return null;
}
return closeIcon || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CloseOutlined, {
className: `${prefixCls}-close-icon`
});
}
const typeToIcon = {
success: icons_CheckCircleFilled,
info: icons_InfoCircleFilled,
error: icons_CloseCircleFilled,
warning: icons_ExclamationCircleFilled
};
const PurePanel_PureContent = props => {
const {
prefixCls,
icon,
type,
title,
description,
actions,
role = 'alert',
styles,
classNames: pureContentCls
} = props;
let iconNode = null;
if (icon) {
iconNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}-icon`, pureContentCls.icon),
style: styles.icon
}, icon);
} else if (type) {
iconNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(typeToIcon[type] || null, {
className: (0,clsx.clsx)(`${prefixCls}-icon`, pureContentCls.icon, `${prefixCls}-icon-${type}`),
style: styles.icon
});
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)({
[`${prefixCls}-with-icon`]: iconNode
}),
role: role
}, iconNode, title && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-title`, pureContentCls.title),
style: styles.title
}, title)), description && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-description`, pureContentCls.description),
style: styles.description
}, description)), actions && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-actions`, pureContentCls.actions),
style: styles.actions
}, actions)));
};
/** @private Internal Component. Do not use in your production. */
const PurePanel_PurePanel = props => {
const {
prefixCls: staticPrefixCls,
icon,
type,
message,
title,
description,
btn,
actions,
closeIcon: _closeIcon,
className: notificationClassName,
style,
styles,
classNames: notificationClassNames,
closable,
...restProps
} = props;
const {
getPrefixCls,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('notification');
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, notificationClassNames], [contextStyles, styles], {
props
});
const {
notification: notificationContext
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const mergedActions = actions ?? btn;
if (true) {
const warning = (0,_util_warning.devUseWarning)('Notification');
[['btn', 'actions'], ['message', 'title']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
}
const mergedTitle = title ?? message;
const prefixCls = staticPrefixCls || getPrefixCls('notification');
const noticePrefixCls = `${prefixCls}-notice`;
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,notification_style["default"])(prefixCls, rootCls);
const [rawClosable, mergedCloseIcon,, ariaProps] = useClosable(pickClosable(props), pickClosable(notificationContext), {
closable: true,
closeIcon: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CloseOutlined, {
className: `${prefixCls}-close-icon`
}),
closeIconRender: icon => getCloseIcon(prefixCls, icon)
});
const mergedClosable = rawClosable ? {
onClose: (0,is.isPlainObject)(closable) ? closable?.onClose : undefined,
closeIcon: mergedCloseIcon,
...ariaProps
} : false;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${noticePrefixCls}-pure-panel`, hashId, notificationClassName, cssVarCls, rootCls, mergedClassNames.root),
style: mergedStyles.root
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(pure_panel, {
prefixCls: prefixCls
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Notice, {
style: {
...contextStyle,
...style
},
...restProps,
prefixCls: prefixCls,
eventKey: "pure",
duration: null,
closable: mergedClosable,
className: (0,clsx.clsx)(notificationClassName, contextClassName),
content: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PurePanel_PureContent, {
classNames: mergedClassNames,
styles: mergedStyles,
prefixCls: noticePrefixCls,
icon: icon,
type: type,
title: mergedTitle,
description: description,
actions: mergedActions
})
}));
};
/* harmony default export */ var notification_PurePanel = (PurePanel_PurePanel);
;// ./components/notification/util.ts
function getPlacementStyle(placement, top, bottom) {
let style;
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 util_getMotion(prefixCls) {
return {
motionName: `${prefixCls}-fade`
};
}
function getCloseIconConfig(closeIcon, notificationConfig, notification) {
if (typeof closeIcon !== 'undefined') {
return closeIcon;
}
if (typeof notificationConfig?.closeIcon !== 'undefined') {
return notificationConfig.closeIcon;
}
return notification?.closeIcon;
}
;// ./components/notification/useNotification.tsx
const useNotification_DEFAULT_OFFSET = 24;
const useNotification_DEFAULT_DURATION = 4.5;
const DEFAULT_PLACEMENT = 'topRight';
const useNotification_Wrapper = ({
children,
prefixCls
}) => {
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,notification_style["default"])(prefixCls, rootCls);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_NotificationProvider, {
classNames: {
list: (0,clsx.clsx)(hashId, cssVarCls, rootCls)
}
}, children);
};
const useNotification_renderNotifications = (node, {
prefixCls,
key
}) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(useNotification_Wrapper, {
prefixCls: prefixCls,
key: key
}, node));
const useNotification_Holder = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
top,
bottom,
prefixCls: staticPrefixCls,
getContainer: staticGetContainer,
maxCount,
rtl,
onAllRemoved,
stack,
duration = useNotification_DEFAULT_DURATION,
pauseOnHover = true,
showProgress
} = props;
const {
getPrefixCls,
getPopupContainer,
direction
} = (0,config_provider_context.useComponentConfig)('notification');
const {
notification
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(config_provider_context.ConfigContext);
const [, token] = (0,useToken["default"])();
const prefixCls = staticPrefixCls || getPrefixCls('notification');
const mergedDuration = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => (0,is.isNumber)(duration) && duration > 0 ? duration : false, [duration]);
// =============================== Style ===============================
const getStyle = placement => getPlacementStyle(placement, top ?? useNotification_DEFAULT_OFFSET, bottom ?? useNotification_DEFAULT_OFFSET);
const getClassName = () => (0,clsx.clsx)({
[`${prefixCls}-rtl`]: rtl ?? direction === 'rtl'
});
// ============================== Motion ===============================
const getNotificationMotion = () => util_getMotion(prefixCls);
// ============================== Origin ===============================
const [api, holder] = useNotification({
prefixCls,
style: getStyle,
className: getClassName,
motion: getNotificationMotion,
closable: {
closeIcon: getCloseIcon(prefixCls)
},
duration: mergedDuration,
getContainer: () => staticGetContainer?.() || getPopupContainer?.() || document.body,
maxCount,
pauseOnHover,
showProgress,
onAllRemoved,
renderNotifications: useNotification_renderNotifications,
stack: stack === false ? false : {
threshold: (0,is.isPlainObject)(stack) ? stack?.threshold : undefined,
offset: 8,
gap: token.margin
}
});
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([notification?.classNames, props?.classNames], [notification?.styles, props?.styles], {
props
});
// ================================ Ref ================================
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useImperativeHandle(ref, () => ({
...api,
prefixCls,
notification,
classNames: mergedClassNames,
styles: mergedStyles
}));
return holder;
});
// ==============================================================================
// == Hook ==
// ==============================================================================
function useInternalNotification(notificationConfig) {
const holderRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
const warning = (0,_util_warning.devUseWarning)('Notification');
const {
notification: notificationContext
} = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(config_provider_context.ConfigContext);
// ================================ API ================================
const wrapAPI = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
// Wrap with notification content
// >>> Open
const open = config => {
if (!holderRef.current) {
true ? warning(false, 'usage', 'You are calling notice in render which will break in React 18 concurrent mode. Please trigger in effect instead.') : 0;
return;
}
const {
open: originOpen,
prefixCls,
notification,
classNames: originClassNames,
styles: originStyles
} = holderRef.current;
const contextClassName = notification?.className || {};
const contextStyle = notification?.style || {};
const noticePrefixCls = `${prefixCls}-notice`;
const {
title,
message,
description,
icon,
type,
btn,
actions,
className,
style,
role = 'alert',
closeIcon,
closable,
classNames: configClassNames = {},
styles = {},
...restConfig
} = config;
if (true) {
[['btn', 'actions'], ['message', 'title']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in config), deprecatedName, newName);
});
}
const mergedTitle = title ?? message;
const mergedActions = actions ?? btn;
const realCloseIcon = getCloseIcon(noticePrefixCls, getCloseIconConfig(closeIcon, notificationConfig, notification));
const [rawClosable, mergedCloseIcon,, ariaProps] = computeClosable(pickClosable({
...(notificationConfig || {}),
...config
}), pickClosable(notificationContext), {
closable: true,
closeIcon: realCloseIcon
});
const mergedClosable = rawClosable ? {
onClose: (0,is.isPlainObject)(closable) ? closable.onClose : undefined,
closeIcon: mergedCloseIcon,
...ariaProps
} : false;
const semanticClassNames = (0,useMergeSemantic.resolveStyleOrClass)(configClassNames, {
props: config
});
const semanticStyles = (0,useMergeSemantic.resolveStyleOrClass)(styles, {
props: config
});
const mergedClassNames = (0,useMergeSemantic.mergeClassNames)(undefined, originClassNames, semanticClassNames);
const mergedStyles = (0,useMergeSemantic.mergeStyles)(originStyles, semanticStyles);
return originOpen({
// use placement from props instead of hard-coding "topRight"
placement: notificationConfig?.placement ?? DEFAULT_PLACEMENT,
...restConfig,
content: (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(PurePanel_PureContent, {
prefixCls: noticePrefixCls,
icon: icon,
type: type,
title: mergedTitle,
description: description,
actions: mergedActions,
role: role,
classNames: mergedClassNames,
styles: mergedStyles
})),
className: (0,clsx.clsx)({
[`${noticePrefixCls}-${type}`]: type
}, className, contextClassName, mergedClassNames.root),
style: {
...contextStyle,
...mergedStyles.root,
...style
},
closable: mergedClosable
});
};
// >>> destroy
const destroy = key => {
if (key !== undefined) {
holderRef.current?.close(key);
} else {
holderRef.current?.destroy();
}
};
const clone = {
open,
destroy
};
const keys = ['success', 'info', 'warning', 'error'];
keys.forEach(type => {
clone[type] = config => open({
...config,
type
});
});
return clone;
}, [notificationConfig, notificationContext]);
// ============================== Return ===============================
return [wrapAPI, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(useNotification_Holder, {
key: "notification-holder",
...notificationConfig,
ref: holderRef
})];
}
function useNotification_useNotification(notificationConfig) {
return useInternalNotification(notificationConfig);
}
;// ./components/app/context.ts
const AppConfigContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createContext({});
const AppContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createContext({
message: {},
notification: {},
modal: {}
});
/* harmony default export */ var app_context = (AppContext);
// EXTERNAL MODULE: ./components/app/style/index.ts
var app_style = __webpack_require__("./components/app/style/index.ts");
;// ./components/app/App.tsx
const App = props => {
const {
prefixCls: customizePrefixCls,
children,
className,
rootClassName,
message,
notification,
style,
component = 'div'
} = props;
const {
direction,
getPrefixCls,
className: contextClassName,
style: contextStyle
} = (0,config_provider_context.useComponentConfig)('app');
const prefixCls = getPrefixCls('app', customizePrefixCls);
const [hashId, cssVarCls] = (0,app_style["default"])(prefixCls);
const customClassName = (0,clsx.clsx)(hashId, prefixCls, className, rootClassName, cssVarCls, {
[`${prefixCls}-rtl`]: direction === 'rtl'
});
const appConfig = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(AppConfigContext);
const mergedAppConfig = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => ({
message: {
...appConfig.message,
...message
},
notification: {
...appConfig.notification,
...notification
}
}), [message, notification, appConfig.message, appConfig.notification]);
const [messageApi, messageContextHolder] = useMessage(mergedAppConfig.message);
const [notificationApi, notificationContextHolder] = useNotification_useNotification(mergedAppConfig.notification);
const [ModalApi, ModalContextHolder] = modal_useModal();
const memoizedContextValue = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => ({
message: messageApi,
notification: notificationApi,
modal: ModalApi
}), [messageApi, notificationApi, ModalApi]);
// https://github.com/ant-design/ant-design/issues/48802#issuecomment-2097813526
(0,_util_warning.devUseWarning)('App')(!(cssVarCls && component === false), 'usage', 'When using cssVar, ensure `component` is assigned a valid React component string.');
// ============================ Render ============================
const Component = component === false ? (external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment : component;
const rootProps = {
className: (0,clsx.clsx)(contextClassName, customClassName),
style: {
...contextStyle,
...style
}
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(app_context.Provider, {
value: memoizedContextValue
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(AppConfigContext.Provider, {
value: mergedAppConfig
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Component, {
...(component === false ? undefined : rootProps)
}, ModalContextHolder, messageContextHolder, notificationContextHolder, children)));
};
if (true) {
App.displayName = 'App';
}
/* harmony default export */ var app_App = (App);
;// ./components/app/useApp.ts
const useApp = () => external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(app_context);
/* harmony default export */ var app_useApp = (useApp);
;// ./components/app/index.tsx
const components_app_App = app_App;
components_app_App.useApp = app_useApp;
/* harmony default export */ var app = (components_app_App);
;// ./components/_util/PurePanel.tsx
function withPureRenderTheme(Component) {
return props => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(config_provider, {
theme: {
token: {
motion: false,
zIndexPopupBase: 0
}
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, {
...props
})));
}
/* istanbul ignore next */
const genPurePanel = (Component, alignPropName, postProps, defaultPrefixCls, getDropdownCls) => {
const PurePanel = props => {
const {
prefixCls: customizePrefixCls,
style
} = props;
const holderRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const [popupHeight, setPopupHeight] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const [popupWidth, setPopupWidth] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const [open, setOpen] = (0,es.useControlledState)(false, props.open);
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls(defaultPrefixCls || 'select', customizePrefixCls);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
// We do not care about ssr
setOpen(true);
if (typeof ResizeObserver !== 'undefined') {
const resizeObserver = new ResizeObserver(entries => {
const element = entries[0].target;
setPopupHeight(element.offsetHeight + 8);
setPopupWidth(element.offsetWidth);
});
const interval = setInterval(() => {
const dropdownCls = getDropdownCls ? `.${getDropdownCls(prefixCls)}` : `.${prefixCls}-dropdown`;
const popup = holderRef.current?.querySelector(dropdownCls);
if (popup) {
clearInterval(interval);
resizeObserver.observe(popup);
}
}, 10);
return () => {
clearInterval(interval);
resizeObserver.disconnect();
};
}
}, [prefixCls]);
let mergedProps = {
...props,
style: {
...style,
margin: 0
},
open,
getPopupContainer: () => holderRef.current
};
if (postProps) {
mergedProps = postProps(mergedProps);
}
if (alignPropName) {
mergedProps = {
...mergedProps,
[alignPropName]: {
overflow: {
adjustX: false,
adjustY: false
}
}
};
}
const mergedStyle = {
paddingBottom: popupHeight,
position: 'relative',
minWidth: popupWidth
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: holderRef,
style: mergedStyle
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, {
...mergedProps
}));
};
return withPureRenderTheme(PurePanel);
};
/* harmony default export */ var _util_PurePanel = (genPurePanel);
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/hooks/useControlledState.js
var useControlledState = __webpack_require__("./node_modules/@rc-component/util/es/hooks/useControlledState.js");
;// ./node_modules/@rc-component/select/es/hooks/useAllowClear.js
const useAllowClear = (prefixCls, displayValues, allowClear, clearIcon, disabled = false, mergedSearchValue, mode) => {
// Convert boolean to object first
const allowClearConfig = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (typeof allowClear === 'boolean') {
return {
allowClear
};
}
if (allowClear && typeof allowClear === 'object') {
return allowClear;
}
return {
allowClear: false
};
}, [allowClear]);
return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
const mergedAllowClear = !disabled && allowClearConfig.allowClear !== false && (displayValues.length || mergedSearchValue) && !(mode === 'combobox' && mergedSearchValue === '');
return {
allowClear: mergedAllowClear,
clearIcon: mergedAllowClear ? allowClearConfig.clearIcon || clearIcon || '×' : null
};
}, [allowClearConfig, clearIcon, disabled, displayValues.length, mergedSearchValue, mode]);
};
;// ./node_modules/@rc-component/select/es/hooks/useBaseProps.js
/**
* BaseSelect provide some parsed data into context.
* You can use this hooks to get them.
*/
const BaseSelectContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
function useBaseProps() {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(BaseSelectContext);
}
;// ./node_modules/@rc-component/select/es/hooks/useLock.js
/**
* Locker return cached mark.
* If set to `true`, will return `true` in a short time even if set `false`.
* If set to `false` and then set to `true`, will change to `true`.
* And after time duration, it will back to `null` automatically.
*/
function useLock(duration = 250) {
const lockRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const timeoutRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
// Clean up
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => () => {
window.clearTimeout(timeoutRef.current);
}, []);
function doLock(locked) {
if (locked || lockRef.current === null) {
lockRef.current = locked;
}
window.clearTimeout(timeoutRef.current);
timeoutRef.current = window.setTimeout(() => {
lockRef.current = null;
}, duration);
}
return [() => lockRef.current, doLock];
}
;// ./node_modules/@rc-component/select/es/hooks/useSelectTriggerControl.js
function isInside(elements, target) {
return elements.filter(element => element).some(element => element.contains(target) || element === target);
}
function useSelectTriggerControl(elements, open, triggerOpen, customizedTrigger) {
const onGlobalMouseDown = (0,es.useEvent)(event => {
// If trigger is customized, Trigger will take control of popupVisible
if (customizedTrigger) {
return;
}
let target = event.target;
if (target.shadowRoot && event.composed) {
target = event.composedPath()[0] || target;
}
if (event._ori_target) {
target = event._ori_target;
}
if (open &&
// Marked by SelectInput mouseDown event
!isInside(elements(), target)) {
// Should trigger close
triggerOpen(false);
}
});
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
window.addEventListener('mousedown', onGlobalMouseDown);
return () => window.removeEventListener('mousedown', onGlobalMouseDown);
}, [onGlobalMouseDown]);
}
;// ./node_modules/@rc-component/select/es/SelectTrigger.js
function SelectTrigger_extends() { SelectTrigger_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return SelectTrigger_extends.apply(this, arguments); }
const getBuiltInPlacements = popupMatchSelectWidth => {
// Enable horizontal overflow auto-adjustment when a custom dropdown width is provided
const adjustX = popupMatchSelectWidth === true ? 0 : 1;
return {
bottomLeft: {
points: ['tl', 'bl'],
offset: [0, 4],
overflow: {
adjustX,
adjustY: 1
},
htmlRegion: 'scroll'
},
bottomRight: {
points: ['tr', 'br'],
offset: [0, 4],
overflow: {
adjustX,
adjustY: 1
},
htmlRegion: 'scroll'
},
topLeft: {
points: ['bl', 'tl'],
offset: [0, -4],
overflow: {
adjustX,
adjustY: 1
},
htmlRegion: 'scroll'
},
topRight: {
points: ['br', 'tr'],
offset: [0, -4],
overflow: {
adjustX,
adjustY: 1
},
htmlRegion: 'scroll'
}
};
};
const SelectTrigger = (props, ref) => {
const {
prefixCls,
disabled,
visible,
children,
popupElement,
animation,
transitionName,
popupStyle,
popupClassName,
direction = 'ltr',
placement,
builtinPlacements,
popupMatchSelectWidth,
popupRender,
popupAlign,
getPopupContainer,
empty,
onPopupVisibleChange,
onPopupMouseEnter,
onPopupMouseDown,
onPopupBlur,
...restProps
} = props;
// We still use `dropdown` className to keep compatibility
// This is used for:
// 1. Styles
// 2. Animation
// 3. Theme customization
// Please do not modify this since it's a breaking change
const popupPrefixCls = `${prefixCls}-dropdown`;
let popupNode = popupElement;
if (popupRender) {
popupNode = popupRender(popupElement);
}
const mergedBuiltinPlacements = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => builtinPlacements || getBuiltInPlacements(popupMatchSelectWidth), [builtinPlacements, popupMatchSelectWidth]);
// ===================== Motion ======================
const mergedTransitionName = animation ? `${popupPrefixCls}-${animation}` : transitionName;
// =================== Popup Width ===================
const isNumberPopupWidth = typeof popupMatchSelectWidth === 'number';
const stretch = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (isNumberPopupWidth) {
return null;
}
return popupMatchSelectWidth === false ? 'minWidth' : 'width';
}, [popupMatchSelectWidth, isNumberPopupWidth]);
let mergedPopupStyle = popupStyle;
if (isNumberPopupWidth) {
mergedPopupStyle = {
...popupStyle,
width: popupMatchSelectWidth
};
}
// ======================= Ref =======================
const triggerPopupRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
getPopupElement: () => triggerPopupRef.current?.popupElement
}));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(trigger_es, SelectTrigger_extends({}, restProps, {
showAction: onPopupVisibleChange ? ['click'] : [],
hideAction: onPopupVisibleChange ? ['click'] : [],
popupPlacement: placement || (direction === 'rtl' ? 'bottomRight' : 'bottomLeft'),
builtinPlacements: mergedBuiltinPlacements,
prefixCls: popupPrefixCls,
popupMotion: {
motionName: mergedTransitionName
},
popup: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
onMouseEnter: onPopupMouseEnter,
onMouseDown: onPopupMouseDown,
onBlur: onPopupBlur
}, popupNode),
ref: triggerPopupRef,
stretch: stretch,
popupAlign: popupAlign,
popupVisible: visible,
getPopupContainer: getPopupContainer,
popupClassName: (0,clsx.clsx)(popupClassName, {
[`${popupPrefixCls}-empty`]: empty
}),
popupStyle: mergedPopupStyle,
onPopupVisibleChange: onPopupVisibleChange
}), children);
};
const RefSelectTrigger = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(SelectTrigger);
if (true) {
RefSelectTrigger.displayName = 'SelectTrigger';
}
/* harmony default export */ var es_SelectTrigger = (RefSelectTrigger);
;// ./node_modules/@rc-component/select/es/utils/valueUtil.js
function getKey(data, index) {
const {
key
} = data;
let value;
if ('value' in data) {
({
value
} = data);
}
if (key !== null && key !== undefined) {
return key;
}
if (value !== undefined) {
return value;
}
return `rc-index-key-${index}`;
}
function isValidCount(value) {
return typeof value !== 'undefined' && !Number.isNaN(value);
}
function fillFieldNames(fieldNames, childrenAsData) {
const {
label,
value,
options,
groupLabel
} = fieldNames || {};
const mergedLabel = label || (childrenAsData ? 'children' : 'label');
return {
label: mergedLabel,
value: value || 'value',
options: options || 'options',
groupLabel: groupLabel || mergedLabel
};
}
/**
* Flat options into flatten list.
* We use `optionOnly` here is aim to avoid user use nested option group.
* Here is simply set `key` to the index if not provided.
*/
function flattenOptions(options, {
fieldNames,
childrenAsData
} = {}) {
const flattenList = [];
const {
label: fieldLabel,
value: fieldValue,
options: fieldOptions,
groupLabel
} = fillFieldNames(fieldNames, false);
function dig(list, isGroupOption) {
if (!Array.isArray(list)) {
return;
}
list.forEach(data => {
if (isGroupOption || !(fieldOptions in data)) {
const value = data[fieldValue];
// Option
flattenList.push({
key: getKey(data, flattenList.length),
groupOption: isGroupOption,
data,
label: data[fieldLabel],
value
});
} else {
let grpLabel = data[groupLabel];
if (grpLabel === undefined && childrenAsData) {
grpLabel = data.label;
}
// Option Group
flattenList.push({
key: getKey(data, flattenList.length),
group: true,
data,
label: grpLabel
});
dig(data[fieldOptions], true);
}
});
}
dig(options, false);
return flattenList;
}
/**
* Inject `props` into `option` for legacy usage
*/
function injectPropsWithOption(option) {
const newOption = {
...option
};
if (!('props' in newOption)) {
Object.defineProperty(newOption, 'props', {
get() {
(0,warning["default"])(false, 'Return type is option instead of Option instance. Please read value directly instead of reading from `props`.');
return newOption;
}
});
}
return newOption;
}
const getSeparatedContent = (text, tokens, end) => {
if (!tokens || !tokens.length) {
return null;
}
let match = false;
const separate = (str, [token, ...restTokens]) => {
if (!token) {
return [str];
}
const list = str.split(token);
match = match || list.length > 1;
return list.reduce((prevList, unitStr) => [...prevList, ...separate(unitStr, restTokens)], []).filter(Boolean);
};
const list = separate(text, tokens);
if (match) {
return typeof end !== 'undefined' ? list.slice(0, end) : list;
} else {
return null;
}
};
;// ./node_modules/@rc-component/select/es/BaseSelect/Polite.js
function Polite(props) {
const {
visible,
values
} = props;
if (!visible) {
return null;
}
// Only cut part of values since it's a screen reader
const MAX_COUNT = 50;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
"aria-live": "polite",
style: {
width: 0,
height: 0,
position: 'absolute',
overflow: 'hidden',
opacity: 0
}
}, `${values.slice(0, MAX_COUNT).map(({
label,
value
}) => ['number', 'string'].includes(typeof label) ? label : value).join(', ')}`, values.length > MAX_COUNT ? ', ...' : null);
}
;// ./node_modules/@rc-component/select/es/hooks/useOpen.js
const internalMacroTask = fn => {
const channel = new MessageChannel();
channel.port1.onmessage = fn;
channel.port2.postMessage(null);
};
const useOpen_macroTask = (fn, times = 1) => {
if (times <= 0) {
fn();
return;
}
internalMacroTask(() => {
useOpen_macroTask(fn, times - 1);
});
};
/**
* Trigger by latest open call, if nextOpen is undefined, means toggle.
* `weak` means this call can be ignored if previous call exists.
*/
/**
* When `open` is controlled, follow the controlled value;
* Otherwise use uncontrolled logic.
* Setting `open` takes effect immediately,
* but setting it to `false` is delayed via MessageChannel.
*
* SSR handling: During SSR, `open` is always false to avoid Portal issues.
* On client-side hydration, it syncs with the actual open state.
*/
function useOpen(defaultOpen, propOpen, onOpen, postOpen) {
// SSR not support Portal which means we need delay `open` for the first time render
const [rendered, setRendered] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
setRendered(true);
}, []);
const [stateOpen, internalSetOpen] = (0,es.useControlledState)(defaultOpen, propOpen);
// Lock for options update
const [lock, setLock] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
// During SSR, always return false for open state
const ssrSafeOpen = rendered ? stateOpen : false;
const mergedOpen = postOpen(ssrSafeOpen);
const taskIdRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(0);
const triggerEvent = (0,es.useEvent)(nextOpen => {
if (onOpen && mergedOpen !== nextOpen) {
onOpen(nextOpen);
}
internalSetOpen(nextOpen);
});
const toggleOpen = (0,es.useEvent)((nextOpen, config = {}) => {
const {
cancelFun
} = config;
taskIdRef.current += 1;
const id = taskIdRef.current;
const nextOpenVal = typeof nextOpen === 'boolean' ? nextOpen : !mergedOpen;
setLock(!nextOpenVal);
function triggerUpdate() {
if (
// Always check if id is match
id === taskIdRef.current &&
// Check if need to cancel
!cancelFun?.()) {
triggerEvent(nextOpenVal);
setLock(false);
}
}
// Weak update can be ignored
if (nextOpenVal) {
triggerUpdate();
} else {
useOpen_macroTask(() => {
triggerUpdate();
});
}
});
return [ssrSafeOpen, mergedOpen, toggleOpen, lock];
}
;// ./node_modules/@rc-component/select/es/SelectInput/Affix.js
// Affix is a simple wrapper which should not read context or logical props
function Affix_Affix(props) {
const {
children,
...restProps
} = props;
if (!children) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", restProps, children);
}
;// ./node_modules/@rc-component/select/es/SelectInput/context.js
const SelectInputContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
function useSelectInputContext() {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(SelectInputContext);
}
/* harmony default export */ var SelectInput_context = (SelectInputContext);
;// ./node_modules/@rc-component/select/es/SelectInput/Input.js
const Input_Input = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
onChange,
onKeyDown,
onBlur,
style,
syncWidth,
value,
className,
autoComplete,
...restProps
} = props;
const {
prefixCls,
mode,
onSearch,
onSearchSubmit,
onInputBlur,
autoFocus,
tokenWithEnter,
placeholder,
components: {
input: InputComponent = 'input'
}
} = useSelectInputContext();
const {
id,
classNames,
styles,
open,
activeDescendantId,
role,
disabled
} = useBaseProps() || {};
const inputCls = (0,clsx.clsx)(`${prefixCls}-input`, classNames?.input, className);
// Used to handle input method composition status
const compositionStatusRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
// Used to handle paste content, similar to original Selector implementation
const pastedTextRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
// ============================== Refs ==============================
const inputRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => inputRef.current);
// ============================== Data ==============================
// Handle input changes
const handleChange = event => {
let {
value: nextVal
} = event.target;
// Handle pasted text with tokenWithEnter, similar to original Selector implementation
if (tokenWithEnter && pastedTextRef.current && /[\r\n]/.test(pastedTextRef.current)) {
// CRLF will be treated as a single space for input element
const replacedText = pastedTextRef.current.replace(/[\r\n]+$/, '').replace(/\r\n/g, ' ').replace(/[\r\n]/g, ' ');
nextVal = nextVal.replace(replacedText, pastedTextRef.current);
}
// Reset pasted text reference
pastedTextRef.current = null;
// Call onSearch callback
if (onSearch) {
onSearch(nextVal, true, compositionStatusRef.current);
}
// Call original onChange callback
onChange?.(event);
};
// ============================ Keyboard ============================
// Handle keyboard events
const handleKeyDown = event => {
const {
key
} = event;
const {
value: nextVal
} = event.currentTarget;
// Handle Enter key submission - referencing Selector implementation
if (key === 'Enter' && mode === 'tags' && !open && !compositionStatusRef.current && onSearchSubmit) {
onSearchSubmit(nextVal);
}
// Call original onKeyDown callback
onKeyDown?.(event);
};
// Handle blur events
const handleBlur = event => {
// Call onInputBlur callback
onInputBlur?.();
// Call original onBlur callback
onBlur?.(event);
};
// Handle input method composition start
const handleCompositionStart = () => {
compositionStatusRef.current = true;
};
// Handle input method composition end
const handleCompositionEnd = event => {
compositionStatusRef.current = false;
// Trigger search when input method composition ends, similar to original Selector
if (mode !== 'combobox') {
const {
value: nextVal
} = event.currentTarget;
onSearch?.(nextVal, true, false);
}
};
// Handle paste events to track pasted content
const handlePaste = event => {
const {
clipboardData
} = event;
const pastedValue = clipboardData?.getData('text');
pastedTextRef.current = pastedValue || '';
};
// ============================= Width ==============================
const [widthCssVar, setWidthCssVar] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(undefined);
// When syncWidth is enabled, adjust input width based on content
(0,useLayoutEffect["default"])(() => {
const input = inputRef.current;
if (syncWidth && input) {
input.style.width = '0px';
const scrollWidth = input.scrollWidth;
setWidthCssVar(scrollWidth);
// Reset input style
input.style.width = '';
}
}, [syncWidth, value]);
// ============================= Render =============================
// Extract shared input props
const sharedInputProps = {
id,
type: mode === 'combobox' ? 'text' : 'search',
...restProps,
ref: inputRef,
style: {
...styles?.input,
...style,
'--select-input-width': widthCssVar
},
autoFocus,
autoComplete: autoComplete || 'off',
className: inputCls,
disabled,
value: value || '',
onChange: handleChange,
onKeyDown: handleKeyDown,
onBlur: handleBlur,
onPaste: handlePaste,
onCompositionStart: handleCompositionStart,
onCompositionEnd: handleCompositionEnd,
// Accessibility attributes
role: role || 'combobox',
'aria-expanded': open || false,
'aria-haspopup': 'listbox',
'aria-owns': open ? `${id}_list` : undefined,
'aria-autocomplete': 'list',
'aria-controls': open ? `${id}_list` : undefined,
'aria-activedescendant': open ? activeDescendantId : undefined
};
// Handle different InputComponent types
if ( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(InputComponent)) {
// If InputComponent is a ReactElement, use cloneElement with merged props
const existingProps = InputComponent.props || {};
// Start with shared props as base
const mergedProps = {
placeholder: props.placeholder || placeholder,
...sharedInputProps,
...existingProps
};
// Batch update function calls
Object.keys(existingProps).forEach(key => {
const existingValue = existingProps[key];
if (typeof existingValue === 'function') {
// Merge event handlers
mergedProps[key] = (...args) => {
existingValue(...args);
sharedInputProps[key]?.(...args);
};
}
});
// Update ref
mergedProps.ref = (0,es_ref.composeRef)(InputComponent.ref, sharedInputProps.ref);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement(InputComponent, mergedProps);
}
// If InputComponent is a component type, render normally
const Component = InputComponent;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, sharedInputProps);
});
/* harmony default export */ var SelectInput_Input = (Input_Input);
;// ./node_modules/@rc-component/select/es/SelectInput/Content/Placeholder.js
function Placeholder(props) {
const {
prefixCls,
placeholder,
displayValues
} = useSelectInputContext();
const {
classNames,
styles
} = useBaseProps();
const {
show = true
} = props;
if (displayValues.length) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-placeholder`, classNames?.placeholder),
style: {
visibility: show ? 'visible' : 'hidden',
...styles?.placeholder
}
}, placeholder);
}
;// ./node_modules/@rc-component/select/es/SelectContext.js
// Use any here since we do not get the type during compilation
/**
* SelectContext is only used for Select. BaseSelect should not consume this context.
*/
const SelectContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
/* harmony default export */ var es_SelectContext = (SelectContext);
;// ./node_modules/@rc-component/select/es/utils/commonUtil.js
function commonUtil_toArray(value) {
if (Array.isArray(value)) {
return value;
}
return value !== undefined ? [value] : [];
}
const isClient = typeof window !== 'undefined' && window.document && window.document.documentElement;
/** Is client side and not jsdom */
const isBrowserClient = true && isClient;
function hasValue(value) {
return value !== undefined && value !== null;
}
/** combo mode no value judgment function */
function isComboNoValue(value) {
return !value && value !== 0;
}
function isTitleType(title) {
return ['string', 'number'].includes(typeof title);
}
function getTitle(item) {
let title = undefined;
if (item) {
if (isTitleType(item.title)) {
title = item.title.toString();
} else if (isTitleType(item.label)) {
title = item.label.toString();
}
}
return title;
}
;// ./node_modules/@rc-component/select/es/SelectInput/Content/SingleContent.js
function SingleContent_extends() { SingleContent_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return SingleContent_extends.apply(this, arguments); }
const SingleContent = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(({
inputProps
}, ref) => {
const {
prefixCls,
searchValue,
activeValue,
displayValues,
maxLength,
mode,
components
} = useSelectInputContext();
const {
triggerOpen,
title: rootTitle,
showSearch,
classNames,
styles
} = useBaseProps();
const selectContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(es_SelectContext);
const [inputChanged, setInputChanged] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const combobox = mode === 'combobox';
const displayValue = displayValues[0];
// Implement the same logic as the old SingleSelector
const mergedSearchValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (combobox && activeValue && !inputChanged && triggerOpen) {
return activeValue;
}
return showSearch ? searchValue : '';
}, [combobox, activeValue, inputChanged, triggerOpen, searchValue, showSearch]);
const [optionClassName, optionStyle, optionTitle, hasOptionStyle] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
let className;
let style;
let titleValue;
if (displayValue && selectContext?.flattenOptions) {
const option = selectContext.flattenOptions.find(opt => opt.value === displayValue.value);
if (option?.data) {
className = option.data.className;
style = option.data.style;
titleValue = getTitle(option.data);
}
}
if (displayValue && !titleValue) {
titleValue = getTitle(displayValue);
}
if (rootTitle !== undefined) {
titleValue = rootTitle;
}
const nextHasStyle = !!className || !!style;
return [className, style, titleValue, nextHasStyle];
}, [displayValue, selectContext?.flattenOptions, rootTitle]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (combobox) {
setInputChanged(false);
}
}, [combobox, activeValue]);
// ========================== Render ==========================
const showHasValueCls = displayValue && displayValue.label !== null && displayValue.label !== undefined && String(displayValue.label).trim() !== '';
// Render value
// Only render value when not using custom input in combobox mode
const shouldRenderValue = !(combobox && components?.input);
const renderValue = shouldRenderValue ? displayValue ? hasOptionStyle ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-content-value`, optionClassName),
style: {
...(mergedSearchValue ? {
visibility: 'hidden'
} : {}),
...optionStyle
},
title: optionTitle
}, displayValue.label) : displayValue.label : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Placeholder, {
show: !mergedSearchValue
}) : null;
// Render
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-content`, showHasValueCls && `${prefixCls}-content-has-value`, mergedSearchValue && `${prefixCls}-content-has-search-value`, hasOptionStyle && `${prefixCls}-content-has-option-style`, classNames?.content),
style: styles?.content,
title: hasOptionStyle ? undefined : optionTitle
}, renderValue, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(SelectInput_Input, SingleContent_extends({
ref: ref
}, inputProps, {
value: mergedSearchValue,
maxLength: mode === 'combobox' ? maxLength : undefined,
onChange: e => {
setInputChanged(true);
inputProps.onChange?.(e);
}
})));
});
/* harmony default export */ var Content_SingleContent = (SingleContent);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/extends.js");
;// ./node_modules/@rc-component/overflow/es/Item.js
// Use shared variable to save bundle size
const UNDEFINED = undefined;
function InternalItem(props, ref) {
const {
prefixCls,
invalidate,
item,
renderItem,
responsive,
responsiveDisabled,
registerSize,
itemKey,
className,
style,
children,
display,
order,
component: Component = 'div',
...restProps
} = props;
const mergedHidden = responsive && !display;
// ================================ Effect ================================
function internalRegisterSize(width) {
registerSize(itemKey, width);
}
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => () => {
internalRegisterSize(null);
}, []);
// ================================ Render ================================
const childNode = renderItem && item !== UNDEFINED ? renderItem(item, {
index: order
}) : children;
let overflowStyle;
if (!invalidate) {
overflowStyle = {
opacity: mergedHidden ? 0 : 1,
height: mergedHidden ? 0 : UNDEFINED,
overflowY: mergedHidden ? 'hidden' : UNDEFINED,
order: responsive ? order : UNDEFINED,
pointerEvents: mergedHidden ? 'none' : UNDEFINED,
position: mergedHidden ? 'absolute' : UNDEFINED
};
}
const overflowProps = {};
if (mergedHidden) {
overflowProps['aria-hidden'] = true;
}
let itemNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, (0,esm_extends["default"])({
className: (0,clsx.clsx)(!invalidate && prefixCls, className),
style: {
...overflowStyle,
...style
}
}, overflowProps, restProps, {
ref: ref
}), childNode);
if (responsive) {
itemNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(resize_observer_es, {
onResize: ({
offsetWidth
}) => {
internalRegisterSize(offsetWidth);
},
disabled: responsiveDisabled
}, itemNode);
}
return itemNode;
}
const Item = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(InternalItem);
if (true) {
Item.displayName = 'Item';
}
/* harmony default export */ var es_Item = (Item);
;// ./node_modules/@rc-component/overflow/es/hooks/channelUpdate.js
function channelUpdate(callback) {
if (typeof MessageChannel === 'undefined') {
(0,raf["default"])(callback);
} else {
const channel = new MessageChannel();
channel.port1.onmessage = () => callback();
channel.port2.postMessage(undefined);
}
}
;// ./node_modules/@rc-component/overflow/es/hooks/useEffectState.js
/**
* Batcher for record any `useEffectState` need update.
*/
function useBatcher() {
// Updater Trigger
const updateFuncRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
// Notify update
const notifyEffectUpdate = callback => {
if (!updateFuncRef.current) {
updateFuncRef.current = [];
channelUpdate(() => {
(0,external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_.unstable_batchedUpdates)(() => {
updateFuncRef.current.forEach(fn => {
fn();
});
updateFuncRef.current = null;
});
});
}
updateFuncRef.current.push(callback);
};
return notifyEffectUpdate;
}
/**
* Trigger state update by `useLayoutEffect` to save perf.
*/
function useEffectState(notifyEffectUpdate, defaultValue) {
// Value
const [stateValue, setStateValue] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(defaultValue);
// Set State
const setEffectVal = (0,useEvent["default"])(nextValue => {
notifyEffectUpdate(() => {
setStateValue(nextValue);
});
});
return [stateValue, setEffectVal];
}
;// ./node_modules/@rc-component/overflow/es/context.js
const OverflowContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createContext(null);
;// ./node_modules/@rc-component/overflow/es/RawItem.js
const InternalRawItem = (props, ref) => {
const context = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(OverflowContext);
// Render directly when context not provided
if (!context) {
const {
component: Component = 'div',
...restProps
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, (0,esm_extends["default"])({}, restProps, {
ref: ref
}));
}
const {
className: contextClassName,
...restContext
} = context;
const {
className,
...restProps
} = props;
// Do not pass context to sub item to avoid multiple measure
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(OverflowContext.Provider, {
value: null
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Item, (0,esm_extends["default"])({
ref: ref,
className: (0,clsx.clsx)(contextClassName, className)
}, restContext, restProps)));
};
const RawItem = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(InternalRawItem);
if (true) {
RawItem.displayName = 'RawItem';
}
/* harmony default export */ var es_RawItem = (RawItem);
;// ./node_modules/@rc-component/overflow/es/Overflow.js
const RESPONSIVE = 'responsive';
const INVALIDATE = 'invalidate';
function defaultRenderRest(omittedItems) {
return `+ ${omittedItems.length} ...`;
}
function Overflow(props, ref) {
const {
prefixCls = 'rc-overflow',
data = [],
renderItem,
renderRawItem,
itemKey,
itemWidth = 10,
ssr,
style,
className,
maxCount,
renderRest,
renderRawRest,
prefix,
suffix,
component: Component = 'div',
itemComponent,
onVisibleChange,
...restProps
} = props;
const fullySSR = ssr === 'full';
const notifyEffectUpdate = useBatcher();
const [containerWidth, setContainerWidth] = useEffectState(notifyEffectUpdate, null);
const mergedContainerWidth = containerWidth || 0;
const [itemWidths, setItemWidths] = useEffectState(notifyEffectUpdate, new Map());
const [prevRestWidth, setPrevRestWidth] = useEffectState(notifyEffectUpdate, 0);
const [restWidth, setRestWidth] = useEffectState(notifyEffectUpdate, 0);
const [prefixWidth, setPrefixWidth] = useEffectState(notifyEffectUpdate, 0);
const [suffixWidth, setSuffixWidth] = useEffectState(notifyEffectUpdate, 0);
const [suffixFixedStart, setSuffixFixedStart] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null);
const [displayCount, setDisplayCount] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null);
const mergedDisplayCount = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (displayCount === null && fullySSR) {
return Number.MAX_SAFE_INTEGER;
}
return displayCount || 0;
}, [displayCount, containerWidth]);
const [restReady, setRestReady] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
const itemPrefixCls = `${prefixCls}-item`;
// Always use the max width to avoid blink
const mergedRestWidth = Math.max(prevRestWidth, restWidth);
// ================================= Data =================================
const isResponsive = maxCount === RESPONSIVE;
const shouldResponsive = data.length && isResponsive;
const invalidate = maxCount === INVALIDATE;
/**
* When is `responsive`, we will always render rest node to get the real width of it for calculation
*/
const showRest = shouldResponsive || typeof maxCount === 'number' && data.length > maxCount;
const mergedData = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
let items = data;
if (shouldResponsive) {
if (containerWidth === null && fullySSR) {
items = data;
} else {
items = data.slice(0, Math.min(data.length, mergedContainerWidth / itemWidth));
}
} else if (typeof maxCount === 'number') {
items = data.slice(0, maxCount);
}
return items;
}, [data, itemWidth, containerWidth, maxCount, shouldResponsive]);
const omittedItems = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (shouldResponsive) {
return data.slice(mergedDisplayCount + 1);
}
return data.slice(mergedData.length);
}, [data, mergedData, shouldResponsive, mergedDisplayCount]);
// ================================= Item =================================
const getKey = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)((item, index) => {
if (typeof itemKey === 'function') {
return itemKey(item);
}
return (itemKey && item?.[itemKey]) ?? index;
}, [itemKey]);
const mergedRenderItem = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(renderItem || (item => item), [renderItem]);
function updateDisplayCount(count, suffixFixedStartVal, notReady) {
// React 18 will sync render even when the value is same in some case.
// We take `mergedData` as deps which may cause dead loop if it's dynamic generate.
// ref: https://github.com/ant-design/ant-design/issues/36559
if (displayCount === count && (suffixFixedStartVal === undefined || suffixFixedStartVal === suffixFixedStart)) {
return;
}
setDisplayCount(count);
if (!notReady) {
setRestReady(count < data.length - 1);
onVisibleChange?.(count);
}
if (suffixFixedStartVal !== undefined) {
setSuffixFixedStart(suffixFixedStartVal);
}
}
// ================================= Size =================================
function onOverflowResize(_, element) {
setContainerWidth(element.clientWidth);
}
function registerSize(key, width) {
setItemWidths(origin => {
const clone = new Map(origin);
if (width === null) {
clone.delete(key);
} else {
clone.set(key, width);
}
return clone;
});
}
function registerOverflowSize(_, width) {
setRestWidth(width);
setPrevRestWidth(restWidth);
}
function registerPrefixSize(_, width) {
setPrefixWidth(width);
}
function registerSuffixSize(_, width) {
setSuffixWidth(width);
}
// ================================ Effect ================================
function getItemWidth(index) {
return itemWidths.get(getKey(mergedData[index], index));
}
(0,useLayoutEffect["default"])(() => {
if (mergedContainerWidth && typeof mergedRestWidth === 'number' && mergedData) {
let totalWidth = prefixWidth + suffixWidth;
const len = mergedData.length;
const lastIndex = len - 1;
// When data count change to 0, reset this since not loop will reach
if (!len) {
updateDisplayCount(0, null);
return;
}
for (let i = 0; i < len; i += 1) {
let currentItemWidth = getItemWidth(i);
// Fully will always render
if (fullySSR) {
currentItemWidth = currentItemWidth || 0;
}
// Break since data not ready
if (currentItemWidth === undefined) {
updateDisplayCount(i - 1, undefined, true);
break;
}
// Find best match
totalWidth += currentItemWidth;
if (
// Only one means `totalWidth` is the final width
lastIndex === 0 && totalWidth <= mergedContainerWidth ||
// Last two width will be the final width
i === lastIndex - 1 && totalWidth + getItemWidth(lastIndex) <= mergedContainerWidth) {
// Additional check if match the end
updateDisplayCount(lastIndex, null);
break;
} else if (totalWidth + mergedRestWidth > mergedContainerWidth) {
// Can not hold all the content to show rest
updateDisplayCount(i - 1, totalWidth - currentItemWidth - suffixWidth + restWidth);
break;
}
}
if (suffix && getItemWidth(0) + suffixWidth > mergedContainerWidth) {
setSuffixFixedStart(null);
}
}
}, [mergedContainerWidth, itemWidths, restWidth, prefixWidth, suffixWidth, getKey, mergedData]);
// ================================ Render ================================
const displayRest = restReady && !!omittedItems.length;
let suffixStyle = {};
if (suffixFixedStart !== null && shouldResponsive) {
suffixStyle = {
position: 'absolute',
top: 0,
insetInlineStart: suffixFixedStart
};
}
const itemSharedProps = {
prefixCls: itemPrefixCls,
responsive: shouldResponsive,
component: itemComponent,
invalidate
};
// >>>>> Choice render fun by `renderRawItem`
const internalRenderItemNode = renderRawItem ? (item, index) => {
const key = getKey(item, index);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(OverflowContext.Provider, {
key: key,
value: {
...itemSharedProps,
order: index,
item,
itemKey: key,
registerSize,
display: index <= mergedDisplayCount
}
}, renderRawItem(item, index));
} : (item, index) => {
const key = getKey(item, index);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Item, (0,esm_extends["default"])({}, itemSharedProps, {
order: index,
key: key,
item: item,
renderItem: mergedRenderItem,
itemKey: key,
registerSize: registerSize,
display: index <= mergedDisplayCount
}));
};
// >>>>> Rest node
const restContextProps = {
order: displayRest ? mergedDisplayCount : Number.MAX_SAFE_INTEGER,
className: `${itemPrefixCls}-rest`,
registerSize: registerOverflowSize,
display: displayRest
};
const mergedRenderRest = renderRest || defaultRenderRest;
const restNode = renderRawRest ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(OverflowContext.Provider, {
value: {
...itemSharedProps,
...restContextProps
}
}, renderRawRest(omittedItems)) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Item, (0,esm_extends["default"])({}, itemSharedProps, restContextProps), typeof mergedRenderRest === 'function' ? mergedRenderRest(omittedItems) : mergedRenderRest);
const overflowNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, (0,esm_extends["default"])({
className: (0,clsx.clsx)(!invalidate && prefixCls, className),
style: style,
ref: ref
}, restProps), prefix && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Item, (0,esm_extends["default"])({}, itemSharedProps, {
responsive: isResponsive,
responsiveDisabled: !shouldResponsive,
order: -1,
className: `${itemPrefixCls}-prefix`,
registerSize: registerPrefixSize,
display: true
}), prefix), mergedData.map(internalRenderItemNode), showRest ? restNode : null, suffix && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Item, (0,esm_extends["default"])({}, itemSharedProps, {
responsive: isResponsive,
responsiveDisabled: !shouldResponsive,
order: mergedDisplayCount,
className: `${itemPrefixCls}-suffix`,
registerSize: registerSuffixSize,
display: true,
style: suffixStyle
}), suffix));
return isResponsive ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(resize_observer_es, {
onResize: onOverflowResize,
disabled: !shouldResponsive
}, overflowNode) : overflowNode;
}
const ForwardOverflow = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(Overflow);
ForwardOverflow.Item = es_RawItem;
ForwardOverflow.RESPONSIVE = RESPONSIVE;
ForwardOverflow.INVALIDATE = INVALIDATE;
if (true) {
ForwardOverflow.displayName = 'Overflow';
}
// Convert to generic type
/* harmony default export */ var es_Overflow = (ForwardOverflow);
;// ./node_modules/@rc-component/overflow/es/index.js
/* harmony default export */ var overflow_es = (es_Overflow);
;// ./node_modules/@rc-component/select/es/TransBtn.js
/**
* Small wrapper for Select icons (clear/arrow/etc.).
* Prevents default mousedown to avoid blurring or caret moves, and
* renders a custom icon or a fallback icon span.
*
* DOM structure:
*
* { icon || {children} }
*
*/
const TransBtn = props => {
const {
className,
style,
customizeIcon,
customizeIconProps,
children,
onMouseDown,
onClick
} = props;
const icon = typeof customizeIcon === 'function' ? customizeIcon(customizeIconProps) : customizeIcon;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: className,
onMouseDown: event => {
event.preventDefault();
onMouseDown?.(event);
},
style: {
userSelect: 'none',
WebkitUserSelect: 'none',
...style
},
unselectable: "on",
onClick: onClick,
"aria-hidden": true
}, icon !== undefined ? icon : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(className.split(/\s+/).map(cls => `${cls}-icon`))
}, children));
};
/* harmony default export */ var es_TransBtn = (TransBtn);
;// ./node_modules/@rc-component/select/es/SelectInput/Content/MultipleContent.js
function MultipleContent_extends() { MultipleContent_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return MultipleContent_extends.apply(this, arguments); }
function itemKey(value) {
return value.key ?? value.value;
}
const onPreventMouseDown = event => {
event.preventDefault();
event.stopPropagation();
};
/* harmony default export */ var MultipleContent = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(function MultipleContent({
inputProps
}, ref) {
const {
prefixCls,
displayValues,
searchValue,
mode,
onSelectorRemove,
removeIcon: removeIconFromContext
} = useSelectInputContext();
const {
disabled,
showSearch,
triggerOpen,
rawOpen,
toggleOpen,
autoClearSearchValue,
tagRender: tagRenderFromContext,
maxTagPlaceholder: maxTagPlaceholderFromContext,
maxTagTextLength,
maxTagCount,
classNames,
styles
} = useBaseProps();
const selectionItemPrefixCls = `${prefixCls}-selection-item`;
// ===================== Search ======================
// Apply autoClearSearchValue logic: when dropdown is closed and autoClearSearchValue is not false (default true), clear search value
// Use rawOpen to avoid clearing search when emptyListContent blocks open
let computedSearchValue = searchValue;
if (!rawOpen && mode === 'multiple' && autoClearSearchValue !== false) {
computedSearchValue = '';
}
const inputValue = showSearch ? computedSearchValue || '' : '';
const inputEditable = showSearch && !disabled;
// Props from context with safe defaults
const removeIcon = removeIconFromContext ?? '×';
const maxTagPlaceholder = maxTagPlaceholderFromContext ?? (omittedValues => `+ ${omittedValues.length} ...`);
const tagRender = tagRenderFromContext;
const onToggleOpen = newOpen => {
toggleOpen(newOpen);
};
const onRemove = value => {
onSelectorRemove?.(value);
};
// ======================== Item ========================
// >>> Render Selector Node. Includes Item & Rest
const defaultRenderSelector = (item, content, itemDisabled, closable, onClose) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
title: getTitle(item),
className: (0,clsx.clsx)(selectionItemPrefixCls, {
[`${selectionItemPrefixCls}-disabled`]: itemDisabled
}, classNames?.item),
style: styles?.item
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(`${selectionItemPrefixCls}-content`, classNames?.itemContent),
style: styles?.itemContent
}, content), closable && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_TransBtn, {
className: (0,clsx.clsx)(`${selectionItemPrefixCls}-remove`, classNames?.itemRemove),
style: styles?.itemRemove,
onMouseDown: onPreventMouseDown,
onClick: onClose,
customizeIcon: removeIcon
}, "\xD7"));
const customizeRenderSelector = (value, content, itemDisabled, closable, onClose, isMaxTag, info) => {
const onMouseDown = e => {
onPreventMouseDown(e);
onToggleOpen(!triggerOpen);
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
onMouseDown: onMouseDown
}, tagRender({
label: content,
value,
index: info?.index,
disabled: itemDisabled,
closable,
onClose,
isMaxTag: !!isMaxTag
}));
};
// ====================== Overflow ======================
const renderItem = (valueItem, info) => {
const {
disabled: itemDisabled,
label,
value
} = valueItem;
const closable = !disabled && !itemDisabled;
let displayLabel = label;
if (typeof maxTagTextLength === 'number') {
if (typeof label === 'string' || typeof label === 'number') {
const strLabel = String(displayLabel);
if (strLabel.length > maxTagTextLength) {
displayLabel = `${strLabel.slice(0, maxTagTextLength)}...`;
}
}
}
const onClose = event => {
if (event) {
event.stopPropagation();
}
onRemove(valueItem);
};
return typeof tagRender === 'function' ? customizeRenderSelector(value, displayLabel, itemDisabled, closable, onClose, undefined, info) : defaultRenderSelector(valueItem, displayLabel, itemDisabled, closable, onClose);
};
const renderRest = omittedValues => {
// https://github.com/ant-design/ant-design/issues/48930
if (!displayValues.length) {
return null;
}
const content = typeof maxTagPlaceholder === 'function' ? maxTagPlaceholder(omittedValues) : maxTagPlaceholder;
return typeof tagRender === 'function' ? customizeRenderSelector(undefined, content, false, false, undefined, true) : defaultRenderSelector({
title: content
}, content, false);
};
// ======================= Render =======================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(overflow_es, {
prefixCls: `${prefixCls}-content`,
className: classNames?.content,
style: styles?.content,
prefix: !displayValues.length && !inputValue && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Placeholder, null),
data: displayValues,
renderItem: renderItem,
renderRest: renderRest,
suffix: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(SelectInput_Input, MultipleContent_extends({
ref: ref,
disabled: disabled,
readOnly: !inputEditable
}, inputProps, {
value: inputValue || '',
syncWidth: true
})),
itemKey: itemKey,
maxCount: maxTagCount
});
}));
;// ./node_modules/@rc-component/select/es/SelectInput/Content/index.js
const SelectContent = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(function SelectContent(_, ref) {
const {
multiple,
onInputKeyDown,
tabIndex
} = useSelectInputContext();
const baseProps = useBaseProps();
const {
showSearch
} = baseProps;
const ariaProps = (0,pickAttrs["default"])(baseProps, {
aria: true
});
const sharedInputProps = {
...ariaProps,
onKeyDown: onInputKeyDown,
readOnly: !showSearch,
tabIndex
};
if (multiple) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(MultipleContent, {
ref: ref,
inputProps: sharedInputProps
});
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Content_SingleContent, {
ref: ref,
inputProps: sharedInputProps
});
});
/* harmony default export */ var SelectInput_Content = (SelectContent);
;// ./node_modules/@rc-component/select/es/utils/keyUtil.js
/** keyCode Judgment function */
function isValidateOpenKey(currentKeyCode) {
return (
// Undefined for Edge bug:
// https://github.com/ant-design/ant-design/issues/51292
currentKeyCode &&
// Other keys
![
// System function button
KeyCode["default"].ESC, KeyCode["default"].SHIFT, KeyCode["default"].BACKSPACE, KeyCode["default"].TAB, KeyCode["default"].WIN_KEY, KeyCode["default"].ALT, KeyCode["default"].META, KeyCode["default"].WIN_KEY_RIGHT, KeyCode["default"].CTRL, KeyCode["default"].SEMICOLON, KeyCode["default"].EQUALS, KeyCode["default"].CAPS_LOCK, KeyCode["default"].CONTEXT_MENU,
// Arrow keys - should not trigger open when navigating in input
KeyCode["default"].UP,
// KeyCode.DOWN,
KeyCode["default"].LEFT, KeyCode["default"].RIGHT,
// F1-F12
KeyCode["default"].F1, KeyCode["default"].F2, KeyCode["default"].F3, KeyCode["default"].F4, KeyCode["default"].F5, KeyCode["default"].F6, KeyCode["default"].F7, KeyCode["default"].F8, KeyCode["default"].F9, KeyCode["default"].F10, KeyCode["default"].F11, KeyCode["default"].F12].includes(currentKeyCode)
);
}
;// ./node_modules/@rc-component/select/es/SelectInput/index.js
function SelectInput_extends() { SelectInput_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return SelectInput_extends.apply(this, arguments); }
const DEFAULT_OMIT_PROPS = ['value', 'onChange', 'removeIcon', 'placeholder', 'maxTagCount', 'maxTagTextLength', 'maxTagPlaceholder', 'choiceTransitionName', 'onInputKeyDown', 'onPopupScroll', 'tabIndex', 'activeValue', 'onSelectorRemove', 'focused'];
/* harmony default export */ var SelectInput = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(function SelectInput(props, ref) {
const {
// Style
prefixCls,
className,
style,
// UI
prefix,
suffix,
clearIcon,
children,
// Data
multiple,
displayValues,
placeholder,
mode,
// Search
searchValue,
onSearch,
onSearchSubmit,
onInputBlur,
// Input
maxLength,
autoFocus,
// Events
onMouseDown,
onClearMouseDown,
onInputKeyDown,
onSelectorRemove,
// Token handling
tokenWithEnter,
// Components
components,
...restProps
} = props;
const {
triggerOpen,
toggleOpen,
showSearch,
disabled,
loading,
classNames,
styles
} = useBaseProps();
const rootRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const inputRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
// Handle keyboard events similar to original Selector
const onInternalInputKeyDown = (0,es.useEvent)(event => {
const {
which
} = event;
// Compatible with multiple lines in TextArea
const isTextAreaElement = inputRef.current instanceof HTMLTextAreaElement;
// Prevent default behavior for up/down arrows when dropdown is open
if (!isTextAreaElement && triggerOpen && (which === KeyCode["default"].UP || which === KeyCode["default"].DOWN)) {
event.preventDefault();
}
// Call the original onInputKeyDown callback
if (onInputKeyDown) {
onInputKeyDown(event);
}
// Move within the text box for TextArea
if (isTextAreaElement && !triggerOpen && ~[KeyCode["default"].UP, KeyCode["default"].DOWN, KeyCode["default"].LEFT, KeyCode["default"].RIGHT].indexOf(which)) {
return;
}
// Open dropdown when a valid open key is pressed
const isModifier = event.ctrlKey || event.altKey || event.metaKey;
if (!isModifier && isValidateOpenKey(which)) {
toggleOpen(true);
}
});
// ====================== Refs ======================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => {
return {
focus: options => {
// Focus the inner input if available, otherwise fall back to root div.
(inputRef.current || rootRef.current).focus?.(options);
},
blur: () => {
(inputRef.current || rootRef.current).blur?.();
},
// Use getDOM to handle nested nativeElement structure (e.g., when RootComponent is antd Input)
nativeElement: (0,findDOMNode.getDOM)(rootRef.current)
};
});
// ====================== Open ======================
const onInternalMouseDown = (0,es.useEvent)(event => {
if (!disabled) {
const inputDOM = (0,findDOMNode.getDOM)(inputRef.current);
// https://github.com/ant-design/ant-design/issues/56002
// Tell `useSelectTriggerControl` to ignore this event
// When icon is dynamic render, the parentNode will miss
// so we need to mark the event directly
event.nativeEvent._ori_target = inputDOM;
const isClickOnInput = inputDOM === event.target || inputDOM?.contains(event.target);
if (inputDOM && !isClickOnInput) {
event.preventDefault();
}
// Check if we should prevent closing when clicking on selector
// Don't close if: open && not multiple && (combobox mode || showSearch)
const shouldPreventCloseOnSingle = triggerOpen && !multiple && (mode === 'combobox' || showSearch);
// Don't close if: open && multiple && click on input
const shouldPreventCloseOnMultipleInput = triggerOpen && multiple && isClickOnInput;
const shouldPreventClose = shouldPreventCloseOnSingle || shouldPreventCloseOnMultipleInput;
if (!event.nativeEvent._select_lazy) {
inputRef.current?.focus();
// Only toggle open if we should not prevent close
if (!shouldPreventClose) {
toggleOpen();
}
} else if (triggerOpen) {
// Lazy should also close when click clear icon
toggleOpen(false);
}
}
onMouseDown?.(event);
});
// =================== Components ===================
const {
root: RootComponent
} = components;
// ===================== Render =====================
const domProps = (0,es.omit)(restProps, DEFAULT_OMIT_PROPS);
const ariaProps = (0,pickAttrs["default"])(domProps, {
aria: true
});
const ariaKeys = Object.keys(ariaProps);
// Create context value with wrapped callbacks
const contextValue = {
...props,
onInputKeyDown: onInternalInputKeyDown
};
if (RootComponent) {
const originProps = RootComponent.props || {};
const mergedProps = {
...originProps,
...domProps
};
Object.keys(originProps).forEach(key => {
const originVal = originProps[key];
const domVal = domProps[key];
if (typeof originVal === 'function' && typeof domVal === 'function') {
mergedProps[key] = (...args) => {
domVal(...args);
originVal(...args);
};
}
});
if ( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(RootComponent)) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement(RootComponent, {
...mergedProps,
ref: (0,es_ref.composeRef)(RootComponent.ref, rootRef)
});
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RootComponent, SelectInput_extends({}, mergedProps, {
ref: rootRef
}));
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(SelectInput_context.Provider, {
value: contextValue
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", SelectInput_extends({}, (0,es.omit)(domProps, ariaKeys), {
// Style
ref: rootRef,
className: className,
style: style
// Mouse Events
,
onMouseDown: onInternalMouseDown
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Affix_Affix, {
className: (0,clsx.clsx)(`${prefixCls}-prefix`, classNames?.prefix),
style: styles?.prefix
}, prefix), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(SelectInput_Content, {
ref: inputRef
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Affix_Affix, {
className: (0,clsx.clsx)(`${prefixCls}-suffix`, {
[`${prefixCls}-suffix-loading`]: loading
}, classNames?.suffix),
style: styles?.suffix
}, suffix), clearIcon && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Affix_Affix, {
className: (0,clsx.clsx)(`${prefixCls}-clear`, classNames?.clear),
style: styles?.clear,
onMouseDown: e => {
// Mark to tell not trigger open or focus
e.nativeEvent._select_lazy = true;
onClearMouseDown?.(e);
}
}, clearIcon), children));
}));
;// ./node_modules/@rc-component/select/es/hooks/useComponents.js
function useComponents(components, getInputElement, getRawInputElement) {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
let {
root,
input
} = components || {};
// root: getRawInputElement
if (getRawInputElement) {
root = getRawInputElement();
}
// input: getInputElement
if (getInputElement) {
input = getInputElement();
}
return {
root,
input
};
}, [components, getInputElement, getRawInputElement]);
}
;// ./node_modules/@rc-component/select/es/BaseSelect/index.js
function BaseSelect_extends() { BaseSelect_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return BaseSelect_extends.apply(this, arguments); }
/**
* ZombieJ:
* We are currently refactoring the semantic structure of the component. Changelog:
* - Remove `suffixIcon` and change to `suffix`.
* - Add `components.root` for replacing response element.
* - Remove `getInputElement` and `getRawInputElement` since we can use `components.input` instead.
*/
const isMultiple = mode => mode === 'tags' || mode === 'multiple';
const BaseSelect = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
id,
prefixCls,
className,
styles,
classNames,
showSearch,
tagRender,
showScrollBar = 'optional',
direction,
omitDomProps,
// Value
displayValues,
onDisplayValuesChange,
emptyOptions,
notFoundContent = 'Not Found',
onClear,
maxCount,
placeholder,
// Mode
mode,
// Status
disabled,
loading,
// Customize Input
getInputElement,
getRawInputElement,
// Open
open,
defaultOpen,
onPopupVisibleChange,
// Active
activeValue,
onActiveValueChange,
activeDescendantId,
// Search
searchValue,
autoClearSearchValue,
onSearch,
onSearchSplit,
tokenSeparators,
// Icons
allowClear,
prefix,
suffix,
suffixIcon,
clearIcon,
// Dropdown
OptionList,
animation,
transitionName,
popupStyle,
popupClassName,
popupMatchSelectWidth,
popupRender,
popupAlign,
placement,
builtinPlacements,
getPopupContainer,
// Focus
showAction = [],
onFocus,
onBlur,
// Rest Events
onKeyUp,
onKeyDown,
onMouseDown,
// Components
components,
// Rest Props
...restProps
} = props;
// ============================== MISC ==============================
const multiple = isMultiple(mode);
// ============================== Refs ==============================
const containerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const triggerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const listRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
/** Used for component focused management */
const [focused, setFocused] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
// =========================== Imperative ===========================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
focus: containerRef.current?.focus,
blur: containerRef.current?.blur,
scrollTo: arg => listRef.current?.scrollTo(arg),
nativeElement: (0,findDOMNode.getDOM)(containerRef.current)
}));
// =========================== Components ===========================
const mergedComponents = useComponents(components, getInputElement, getRawInputElement);
// ========================== Search Value ==========================
const mergedSearchValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (mode !== 'combobox') {
return searchValue;
}
const val = displayValues[0]?.value;
return typeof val === 'string' || typeof val === 'number' ? String(val) : '';
}, [searchValue, mode, displayValues]);
// ========================== Custom Input ==========================
// Only works in `combobox`
const customizeInputElement = mode === 'combobox' && typeof getInputElement === 'function' && getInputElement() || null;
// ============================== Open ==============================
// Not trigger `open` when `notFoundContent` is empty
const emptyListContent = !notFoundContent && emptyOptions;
const [rawOpen, mergedOpen, triggerOpen, lockOptions] = useOpen(defaultOpen || false, open, onPopupVisibleChange, nextOpen => disabled || emptyListContent ? false : nextOpen);
// ============================= Search =============================
const tokenWithEnter = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => (tokenSeparators || []).some(tokenSeparator => ['\n', '\r\n'].includes(tokenSeparator)), [tokenSeparators]);
const onInternalSearch = (searchText, fromTyping, isCompositing) => {
if (multiple && isValidCount(maxCount) && displayValues.length >= maxCount) {
return;
}
let ret = true;
let newSearchText = searchText;
onActiveValueChange?.(null);
const separatedList = getSeparatedContent(searchText, tokenSeparators, isValidCount(maxCount) ? maxCount - displayValues.length : undefined);
// Check if match the `tokenSeparators`
const patchLabels = isCompositing ? null : separatedList;
// Ignore combobox since it's not split-able
if (mode !== 'combobox' && patchLabels) {
newSearchText = '';
onSearchSplit?.(patchLabels);
// Should close when paste finish
triggerOpen(false);
// Tell Selector that break next actions
ret = false;
}
if (onSearch && mergedSearchValue !== newSearchText) {
onSearch(newSearchText, {
source: fromTyping ? 'typing' : 'effect'
});
}
// Open if from typing
if (searchText && fromTyping && ret) {
triggerOpen(true);
}
return ret;
};
// Only triggered when menu is closed & mode is tags
// If menu is open, OptionList will take charge
// If mode isn't tags, press enter is not meaningful when you can't see any option
const onInternalSearchSubmit = searchText => {
// prevent empty tags from appearing when you click the Enter button
if (!searchText || !searchText.trim()) {
return;
}
onSearch(searchText, {
source: 'submit'
});
};
// Clean up search value when the dropdown is closed.
// We use `rawOpen` here to avoid clearing the search input when the dropdown is
// programmatically closed due to `notFoundContent={null}` and no matching options.
// This allows the user to continue typing their search query.
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (!rawOpen && !multiple && mode !== 'combobox') {
onInternalSearch('', false, false);
}
}, [rawOpen]);
// ============================ Disabled ============================
// Close dropdown & remove focus state when disabled change
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
// After onBlur is triggered, the focused does not need to be reset
if (disabled) {
triggerOpen(false);
setFocused(false);
}
}, [disabled, mergedOpen]);
// ============================ Keyboard ============================
/**
* We record input value here to check if can press to clean up by backspace
* - null: Key is not down, this is reset by key up
* - true: Search text is empty when first time backspace down
* - false: Search text is not empty when first time backspace down
*/
const [getClearLock, setClearLock] = useLock();
const keyLockRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
// KeyDown
const onInternalKeyDown = event => {
const clearLock = getClearLock();
const {
key
} = event;
const isEnterKey = key === 'Enter';
const isSpaceKey = key === ' ';
// Enter or Space opens dropdown (ARIA combobox: spacebar should open)
if (isEnterKey || isSpaceKey) {
// Do not submit form when type in the input; prevent Space from scrolling page
const isCombobox = mode === 'combobox';
const isEditable = isCombobox || showSearch;
if (isSpaceKey && !isEditable || isEnterKey && !isCombobox) {
event.preventDefault();
}
// We only manage open state here, close logic should handle by list component
if (!mergedOpen) {
triggerOpen(true);
}
}
setClearLock(!!mergedSearchValue);
// Remove value by `backspace`
if (key === 'Backspace' && !clearLock && multiple && !mergedSearchValue && displayValues.length) {
const cloneDisplayValues = [...displayValues];
let removedDisplayValue = null;
for (let i = cloneDisplayValues.length - 1; i >= 0; i -= 1) {
const current = cloneDisplayValues[i];
if (!current.disabled) {
cloneDisplayValues.splice(i, 1);
removedDisplayValue = current;
break;
}
}
if (removedDisplayValue) {
onDisplayValuesChange(cloneDisplayValues, {
type: 'remove',
values: [removedDisplayValue]
});
}
}
if (mergedOpen && (!isEnterKey || !keyLockRef.current) && !isSpaceKey) {
// Lock the Enter key after it is pressed to avoid repeated triggering of the onChange event.
if (isEnterKey) {
keyLockRef.current = true;
}
listRef.current?.onKeyDown(event);
}
onKeyDown?.(event);
};
// KeyUp
const onInternalKeyUp = (event, ...rest) => {
if (mergedOpen) {
listRef.current?.onKeyUp(event, ...rest);
}
if (event.key === 'Enter') {
keyLockRef.current = false;
}
onKeyUp?.(event, ...rest);
};
// ============================ Selector ============================
const onSelectorRemove = (0,es.useEvent)(val => {
const newValues = displayValues.filter(i => i !== val);
onDisplayValuesChange(newValues, {
type: 'remove',
values: [val]
});
});
const onInputBlur = () => {
// Unlock the Enter key after the input blur; otherwise, the Enter key needs to be pressed twice to trigger the correct effect.
keyLockRef.current = false;
};
// ========================== Focus / Blur ==========================
const getSelectElements = () => [(0,findDOMNode.getDOM)(containerRef.current), triggerRef.current?.getPopupElement()];
// Close when click on non-select element
useSelectTriggerControl(getSelectElements, mergedOpen, triggerOpen, !!mergedComponents.root);
// ========================== Focus / Blur ==========================
const internalMouseDownRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
const onInternalFocus = event => {
setFocused(true);
if (!disabled) {
// `showAction` should handle `focus` if set
if (showAction.includes('focus')) {
triggerOpen(true);
}
onFocus?.(event);
}
};
const onRootBlur = () => {
// Delay close should check the activeElement
if (mergedOpen && !internalMouseDownRef.current) {
triggerOpen(false, {
cancelFun: () => isInside(getSelectElements(), document.activeElement)
});
}
};
const onInternalBlur = event => {
setFocused(false);
if (mergedSearchValue) {
// `tags` mode should move `searchValue` into values
if (mode === 'tags') {
onSearch(mergedSearchValue, {
source: 'submit'
});
} else if (mode === 'multiple') {
// `multiple` mode only clean the search value but not trigger event
onSearch('', {
source: 'blur'
});
}
}
onRootBlur();
if (!disabled) {
onBlur?.(event);
}
};
const onRootMouseDown = (event, ...restArgs) => {
const {
target
} = event;
const popupElement = triggerRef.current?.getPopupElement();
// We should give focus back to selector if clicked item is not focusable
if (popupElement?.contains(target) && triggerOpen) {
// Tell `open` not to close since it's safe in the popup
triggerOpen(true);
}
onMouseDown?.(event, ...restArgs);
internalMouseDownRef.current = true;
useOpen_macroTask(() => {
internalMouseDownRef.current = false;
});
};
// ============================ Dropdown ============================
const [, forceUpdate] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState({});
// We need force update here since popup dom is render async
function onPopupMouseEnter() {
forceUpdate({});
}
// Used for raw custom input trigger
let onTriggerVisibleChange;
if (!!mergedComponents.root) {
onTriggerVisibleChange = newOpen => {
triggerOpen(newOpen);
};
}
// ============================ Context =============================
const baseSelectContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
...props,
notFoundContent,
open: mergedOpen,
triggerOpen: mergedOpen,
rawOpen,
id,
showSearch,
multiple,
toggleOpen: triggerOpen,
showScrollBar,
styles,
classNames,
lockOptions
}), [props, notFoundContent, triggerOpen, id, showSearch, multiple, mergedOpen, rawOpen, showScrollBar, styles, classNames, lockOptions]);
// ==================================================================
// == Render ==
// ==================================================================
// ============================= Suffix =============================
const mergedSuffixIcon = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const nextSuffix = suffix ?? suffixIcon;
if (typeof nextSuffix === 'function') {
return nextSuffix({
searchValue: mergedSearchValue,
open: mergedOpen,
focused,
showSearch,
loading
});
}
return nextSuffix;
}, [suffix, suffixIcon, mergedSearchValue, mergedOpen, focused, showSearch, loading]);
// ============================= Clear ==============================
const onClearMouseDown = () => {
onClear?.();
containerRef.current?.focus();
onDisplayValuesChange([], {
type: 'clear',
values: displayValues
});
onInternalSearch('', false, false);
};
const {
allowClear: mergedAllowClear,
clearIcon: clearNode
} = useAllowClear(prefixCls, displayValues, allowClear, clearIcon, disabled, mergedSearchValue, mode);
// =========================== OptionList ===========================
const optionList = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(OptionList, {
ref: listRef
});
// ============================= Select =============================
const mergedClassName = (0,clsx.clsx)(prefixCls, className, {
[`${prefixCls}-focused`]: focused,
[`${prefixCls}-multiple`]: multiple,
[`${prefixCls}-single`]: !multiple,
[`${prefixCls}-allow-clear`]: mergedAllowClear,
[`${prefixCls}-show-arrow`]: mergedSuffixIcon !== undefined && mergedSuffixIcon !== null,
[`${prefixCls}-disabled`]: disabled,
[`${prefixCls}-loading`]: loading,
[`${prefixCls}-open`]: mergedOpen,
[`${prefixCls}-customize-input`]: customizeInputElement,
[`${prefixCls}-show-search`]: showSearch
});
// >>> Render
let renderNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(SelectInput, BaseSelect_extends({}, restProps, {
// Ref
ref: containerRef
// Style
,
prefixCls: prefixCls,
className: mergedClassName
// Focus state
,
focused: focused
// UI
,
prefix: prefix,
suffix: mergedSuffixIcon,
clearIcon: clearNode
// Type or mode
,
multiple: multiple,
mode: mode
// Values
,
displayValues: displayValues,
placeholder: placeholder,
searchValue: mergedSearchValue,
activeValue: activeValue,
onSearch: onInternalSearch,
onSearchSubmit: onInternalSearchSubmit,
onInputBlur: onInputBlur,
onFocus: onInternalFocus,
onBlur: onInternalBlur,
onClearMouseDown: onClearMouseDown,
onKeyDown: onInternalKeyDown,
onKeyUp: onInternalKeyUp,
onSelectorRemove: onSelectorRemove
// Token handling
,
tokenWithEnter: tokenWithEnter
// Open
,
onMouseDown: onRootMouseDown
// Components
,
components: mergedComponents
}));
renderNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_SelectTrigger, {
ref: triggerRef,
disabled: disabled,
prefixCls: prefixCls,
visible: mergedOpen,
popupElement: optionList,
animation: animation,
transitionName: transitionName,
popupStyle: popupStyle,
popupClassName: popupClassName,
direction: direction,
popupMatchSelectWidth: popupMatchSelectWidth,
popupRender: popupRender,
popupAlign: popupAlign,
placement: placement,
builtinPlacements: builtinPlacements,
getPopupContainer: getPopupContainer,
empty: emptyOptions,
onPopupVisibleChange: onTriggerVisibleChange,
onPopupMouseEnter: onPopupMouseEnter,
onPopupMouseDown: onRootMouseDown,
onPopupBlur: onRootBlur
}, renderNode);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(BaseSelectContext.Provider, {
value: baseSelectContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Polite, {
visible: focused && !mergedOpen,
values: displayValues
}), renderNode);
});
// Set display name for dev
if (true) {
BaseSelect.displayName = 'BaseSelect';
}
/* harmony default export */ var es_BaseSelect = (BaseSelect);
;// ./node_modules/@rc-component/select/es/OptGroup.js
/* istanbul ignore file */
/** This is a placeholder, not real render in dom */
const OptGroup = () => null;
OptGroup.isSelectOptGroup = true;
/* harmony default export */ var es_OptGroup = (OptGroup);
;// ./node_modules/@rc-component/select/es/Option.js
/* istanbul ignore file */
/** This is a placeholder, not real render in dom */
const Option = () => null;
Option.isSelectOption = true;
/* harmony default export */ var es_Option = (Option);
// EXTERNAL MODULE: ./node_modules/@rc-component/util/es/omit.js
var omit = __webpack_require__("./node_modules/@rc-component/util/es/omit.js");
;// ./node_modules/@rc-component/virtual-list/es/Filler.js
/**
* Fill component to provided the scroll content real height.
*/
const Filler = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(({
height,
offsetY,
offsetX,
children,
prefixCls,
onInnerResize,
innerProps,
rtl,
extra
}, ref) => {
let outerStyle = {};
let innerStyle = {
display: 'flex',
flexDirection: 'column'
};
if (offsetY !== undefined) {
// Not set `width` since this will break `sticky: right`
outerStyle = {
height,
position: 'relative',
overflow: 'hidden'
};
innerStyle = {
...innerStyle,
transform: `translateY(${offsetY}px)`,
[rtl ? 'marginRight' : 'marginLeft']: -offsetX,
position: 'absolute',
left: 0,
right: 0,
top: 0
};
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
style: outerStyle
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(resize_observer_es, {
onResize: ({
offsetHeight
}) => {
if (offsetHeight && onInnerResize) {
onInnerResize();
}
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", (0,esm_extends["default"])({
style: innerStyle,
className: (0,clsx.clsx)({
[`${prefixCls}-holder-inner`]: prefixCls
}),
ref: ref
}, innerProps), children, extra)));
});
Filler.displayName = 'Filler';
/* harmony default export */ var es_Filler = (Filler);
;// ./node_modules/@rc-component/virtual-list/es/Item.js
function Item_Item({
children,
setRef
}) {
const refFunc = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(node => {
setRef(node);
}, []);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement(children, {
ref: refFunc
});
}
;// ./node_modules/@rc-component/virtual-list/es/hooks/useChildren.js
function useChildren(list, startIndex, endIndex, scrollWidth, offsetX, setNodeRef, renderFunc, {
getKey
}) {
return list.slice(startIndex, endIndex + 1).map((item, index) => {
const eleIndex = startIndex + index;
const node = renderFunc(item, eleIndex, {
style: {
width: scrollWidth
},
offsetX
});
const key = getKey(item);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Item_Item, {
key: key,
setRef: ele => setNodeRef(item, ele)
}, node);
});
}
;// ./node_modules/@rc-component/virtual-list/es/utils/algorithmUtil.js
/**
* Get index with specific start index one by one. e.g.
* min: 3, max: 9, start: 6
*
* Return index is:
* [0]: 6
* [1]: 7
* [2]: 5
* [3]: 8
* [4]: 4
* [5]: 9
* [6]: 3
*/
function getIndexByStartLoc(min, max, start, index) {
const beforeCount = start - min;
const afterCount = max - start;
const balanceCount = Math.min(beforeCount, afterCount) * 2;
// Balance
if (index <= balanceCount) {
const stepIndex = Math.floor(index / 2);
if (index % 2) {
return start + stepIndex + 1;
}
return start - stepIndex;
}
// One is out of range
if (beforeCount > afterCount) {
return start - (index - afterCount);
}
return start + (index - beforeCount);
}
/**
* We assume that 2 list has only 1 item diff and others keeping the order.
* So we can use dichotomy algorithm to find changed one.
*/
function findListDiffIndex(originList, targetList, getKey) {
const originLen = originList.length;
const targetLen = targetList.length;
let shortList;
let longList;
if (originLen === 0 && targetLen === 0) {
return null;
}
if (originLen < targetLen) {
shortList = originList;
longList = targetList;
} else {
shortList = targetList;
longList = originList;
}
const notExistKey = {
__EMPTY_ITEM__: true
};
function getItemKey(item) {
if (item !== undefined) {
return getKey(item);
}
return notExistKey;
}
// Loop to find diff one
let diffIndex = null;
let multiple = Math.abs(originLen - targetLen) !== 1;
for (let i = 0; i < longList.length; i += 1) {
const shortKey = getItemKey(shortList[i]);
const longKey = getItemKey(longList[i]);
if (shortKey !== longKey) {
diffIndex = i;
multiple = multiple || shortKey !== getItemKey(longList[i + 1]);
break;
}
}
return diffIndex === null ? null : {
index: diffIndex,
multiple
};
}
;// ./node_modules/@rc-component/virtual-list/es/hooks/useDiffItem.js
function useDiffItem(data, getKey, onDiff) {
const [prevData, setPrevData] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(data);
const [diffItem, setDiffItem] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
const diff = findListDiffIndex(prevData || [], data || [], getKey);
if (diff?.index !== undefined) {
onDiff?.(diff.index);
setDiffItem(data[diff.index]);
}
setPrevData(data);
}, [data]);
return [diffItem];
}
;// ./node_modules/@rc-component/virtual-list/es/utils/isFirefox.js
const isFF = typeof navigator === 'object' && /Firefox/i.test(navigator.userAgent);
/* harmony default export */ var isFirefox = (isFF);
;// ./node_modules/@rc-component/virtual-list/es/hooks/useOriginScroll.js
/* harmony default export */ var useOriginScroll = ((isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight) => {
// Do lock for a wheel when scrolling
const lockRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
const lockTimeoutRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
function lockScroll() {
clearTimeout(lockTimeoutRef.current);
lockRef.current = true;
lockTimeoutRef.current = setTimeout(() => {
lockRef.current = false;
}, 50);
}
// Pass to ref since global add is in closure
const scrollPingRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
top: isScrollAtTop,
bottom: isScrollAtBottom,
left: isScrollAtLeft,
right: isScrollAtRight
});
scrollPingRef.current.top = isScrollAtTop;
scrollPingRef.current.bottom = isScrollAtBottom;
scrollPingRef.current.left = isScrollAtLeft;
scrollPingRef.current.right = isScrollAtRight;
return (isHorizontal, delta, smoothOffset = false) => {
const originScroll = isHorizontal ?
// Pass origin wheel when on the left
delta < 0 && scrollPingRef.current.left ||
// Pass origin wheel when on the right
delta > 0 && scrollPingRef.current.right // Pass origin wheel when on the top
: delta < 0 && scrollPingRef.current.top ||
// Pass origin wheel when on the bottom
delta > 0 && scrollPingRef.current.bottom;
if (smoothOffset && originScroll) {
// No need lock anymore when it's smooth offset from touchMove interval
clearTimeout(lockTimeoutRef.current);
lockRef.current = false;
} else if (!originScroll || lockRef.current) {
lockScroll();
}
return !lockRef.current && originScroll;
};
});
(Object.getOwnPropertyDescriptor(useOriginScroll, "name") || {}).writable || Object.defineProperty(useOriginScroll, "name", { value: "default", configurable: true });
;// ./node_modules/@rc-component/virtual-list/es/hooks/useFrameWheel.js
function useFrameWheel(inVirtual, isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight, horizontalScroll,
/***
* Return `true` when you need to prevent default event
*/
onWheelDelta) {
const offsetRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(0);
const nextFrameRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
// Firefox patch
const wheelValueRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const isMouseScrollRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
// Scroll status sync
const originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight);
function onWheelY(e, deltaY) {
raf["default"].cancel(nextFrameRef.current);
// Do nothing when scroll at the edge, Skip check when is in scroll
if (originScroll(false, deltaY)) return;
// Skip if nest List has handled this event
const event = e;
if (!event._virtualHandled) {
event._virtualHandled = true;
} else {
return;
}
offsetRef.current += deltaY;
wheelValueRef.current = deltaY;
// Proxy of scroll events
if (!isFirefox) {
event.preventDefault();
}
nextFrameRef.current = (0,raf["default"])(() => {
// Patch a multiple for Firefox to fix wheel number too small
// ref: https://github.com/ant-design/ant-design/issues/26372#issuecomment-679460266
const patchMultiple = isMouseScrollRef.current ? 10 : 1;
onWheelDelta(offsetRef.current * patchMultiple, false);
offsetRef.current = 0;
});
}
function onWheelX(event, deltaX) {
onWheelDelta(deltaX, true);
if (!isFirefox) {
event.preventDefault();
}
}
// Check for which direction does wheel do. `sx` means `shift + wheel`
const wheelDirectionRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const wheelDirectionCleanRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
function onWheel(event) {
if (!inVirtual) return;
// Wait for 2 frame to clean direction
raf["default"].cancel(wheelDirectionCleanRef.current);
wheelDirectionCleanRef.current = (0,raf["default"])(() => {
wheelDirectionRef.current = null;
}, 2);
const {
deltaX,
deltaY,
shiftKey
} = event;
let mergedDeltaX = deltaX;
let mergedDeltaY = deltaY;
if (wheelDirectionRef.current === 'sx' || !wheelDirectionRef.current && (shiftKey || false) && deltaY && !deltaX) {
mergedDeltaX = deltaY;
mergedDeltaY = 0;
wheelDirectionRef.current = 'sx';
}
const absX = Math.abs(mergedDeltaX);
const absY = Math.abs(mergedDeltaY);
if (wheelDirectionRef.current === null) {
wheelDirectionRef.current = horizontalScroll && absX > absY ? 'x' : 'y';
}
if (wheelDirectionRef.current === 'y') {
onWheelY(event, mergedDeltaY);
} else {
onWheelX(event, mergedDeltaX);
}
}
// A patch for firefox
function onFireFoxScroll(event) {
if (!inVirtual) return;
isMouseScrollRef.current = event.detail === wheelValueRef.current;
}
return [onWheel, onFireFoxScroll];
}
;// ./node_modules/@rc-component/virtual-list/es/hooks/useGetSize.js
/**
* Size info need loop query for the `heights` which will has the perf issue.
* Let cache result for each render phase.
*/
function useGetSize(mergedData, getKey, heights, itemHeight) {
const [key2Index, bottomList] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => [new Map(), []], [mergedData, heights.id, itemHeight]);
const getSize = (startKey, endKey = startKey) => {
// Get from cache first
let startIndex = key2Index.get(startKey);
let endIndex = key2Index.get(endKey);
// Loop to fill the cache
if (startIndex === undefined || endIndex === undefined) {
const dataLen = mergedData.length;
for (let i = bottomList.length; i < dataLen; i += 1) {
const item = mergedData[i];
const key = getKey(item);
key2Index.set(key, i);
const cacheHeight = heights.get(key) ?? itemHeight;
bottomList[i] = (bottomList[i - 1] || 0) + cacheHeight;
if (key === startKey) {
startIndex = i;
}
if (key === endKey) {
endIndex = i;
}
if (startIndex !== undefined && endIndex !== undefined) {
break;
}
}
}
return {
top: bottomList[startIndex - 1] || 0,
bottom: bottomList[endIndex]
};
};
return getSize;
}
;// ./node_modules/@rc-component/virtual-list/es/utils/CacheMap.js
// Firefox has low performance of map.
class CacheMap {
maps;
// Used for cache key
// `useMemo` no need to update if `id` not change
id = 0;
diffRecords = new Map();
constructor() {
this.maps = Object.create(null);
}
set(key, value) {
// Record prev value
this.diffRecords.set(key, this.maps[key]);
this.maps[key] = value;
this.id += 1;
}
get(key) {
return this.maps[key];
}
/**
* CacheMap will record the key changed.
* To help to know what's update in the next render.
*/
resetRecord() {
this.diffRecords.clear();
}
getRecord() {
return this.diffRecords;
}
}
/* harmony default export */ var utils_CacheMap = (CacheMap);
;// ./node_modules/@rc-component/virtual-list/es/hooks/useHeights.js
function parseNumber(value) {
const num = parseFloat(value);
return isNaN(num) ? 0 : num;
}
function useHeights(getKey, onItemAdd, onItemRemove) {
const [updatedMark, setUpdatedMark] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const instanceRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(new Map());
const heightsRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(new utils_CacheMap());
const promiseIdRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(0);
function cancelRaf() {
promiseIdRef.current += 1;
}
function collectHeight(sync = false) {
cancelRaf();
const doCollect = () => {
let changed = false;
instanceRef.current.forEach((element, key) => {
if (element && element.offsetParent) {
const {
offsetHeight
} = element;
const {
marginTop,
marginBottom
} = getComputedStyle(element);
const marginTopNum = parseNumber(marginTop);
const marginBottomNum = parseNumber(marginBottom);
const totalHeight = offsetHeight + marginTopNum + marginBottomNum;
if (heightsRef.current.get(key) !== totalHeight) {
heightsRef.current.set(key, totalHeight);
changed = true;
}
}
});
// Always trigger update mark to tell parent that should re-calculate heights when resized
if (changed) {
setUpdatedMark(c => c + 1);
}
};
if (sync) {
doCollect();
} else {
promiseIdRef.current += 1;
const id = promiseIdRef.current;
Promise.resolve().then(() => {
if (id === promiseIdRef.current) {
doCollect();
}
});
}
}
function setInstanceRef(item, instance) {
const key = getKey(item);
const origin = instanceRef.current.get(key);
if (instance) {
instanceRef.current.set(key, instance);
collectHeight();
} else {
instanceRef.current.delete(key);
}
// Instance changed
if (!origin !== !instance) {
if (instance) {
onItemAdd?.(item);
} else {
onItemRemove?.(item);
}
}
}
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
return cancelRaf;
}, []);
return [setInstanceRef, collectHeight, heightsRef.current, updatedMark];
}
;// ./node_modules/@rc-component/virtual-list/es/hooks/useMobileTouchMove.js
const SMOOTH_PTG = 14 / 15;
function useMobileTouchMove(inVirtual, listRef, callback) {
const touchedRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
const touchXRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(0);
const touchYRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(0);
const elementRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
// Smooth scroll
const intervalRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
/* eslint-disable prefer-const */
let cleanUpEvents;
const onTouchMove = e => {
if (touchedRef.current) {
const currentX = Math.ceil(e.touches[0].pageX);
const currentY = Math.ceil(e.touches[0].pageY);
let offsetX = touchXRef.current - currentX;
let offsetY = touchYRef.current - currentY;
const isHorizontal = Math.abs(offsetX) > Math.abs(offsetY);
if (isHorizontal) {
touchXRef.current = currentX;
} else {
touchYRef.current = currentY;
}
const scrollHandled = callback(isHorizontal, isHorizontal ? offsetX : offsetY, false, e);
if (scrollHandled) {
e.preventDefault();
}
// Smooth interval
clearInterval(intervalRef.current);
if (scrollHandled) {
intervalRef.current = setInterval(() => {
if (isHorizontal) {
offsetX *= SMOOTH_PTG;
} else {
offsetY *= SMOOTH_PTG;
}
const offset = Math.floor(isHorizontal ? offsetX : offsetY);
if (!callback(isHorizontal, offset, true) || Math.abs(offset) <= 0.1) {
clearInterval(intervalRef.current);
}
}, 16);
}
}
};
const onTouchEnd = () => {
touchedRef.current = false;
cleanUpEvents();
};
const onTouchStart = e => {
cleanUpEvents();
if (e.touches.length === 1 && !touchedRef.current) {
touchedRef.current = true;
touchXRef.current = Math.ceil(e.touches[0].pageX);
touchYRef.current = Math.ceil(e.touches[0].pageY);
elementRef.current = e.target;
elementRef.current.addEventListener('touchmove', onTouchMove, {
passive: false
});
elementRef.current.addEventListener('touchend', onTouchEnd, {
passive: true
});
}
};
cleanUpEvents = () => {
if (elementRef.current) {
elementRef.current.removeEventListener('touchmove', onTouchMove);
elementRef.current.removeEventListener('touchend', onTouchEnd);
}
};
(0,useLayoutEffect["default"])(() => {
if (inVirtual) {
listRef.current.addEventListener('touchstart', onTouchStart, {
passive: true
});
}
return () => {
listRef.current?.removeEventListener('touchstart', onTouchStart);
cleanUpEvents();
clearInterval(intervalRef.current);
};
}, [inVirtual]);
}
;// ./node_modules/@rc-component/virtual-list/es/hooks/useScrollDrag.js
function smoothScrollOffset(offset) {
return Math.floor(offset ** 0.5);
}
function getPageXY(e, horizontal) {
const obj = 'touches' in e ? e.touches[0] : e;
return obj[horizontal ? 'pageX' : 'pageY'] - window[horizontal ? 'scrollX' : 'scrollY'];
}
function useScrollDrag(inVirtual, componentRef, onScrollOffset) {
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
const ele = componentRef.current;
if (inVirtual && ele) {
let mouseDownLock = false;
let rafId;
let offset;
const stopScroll = () => {
raf["default"].cancel(rafId);
};
const continueScroll = () => {
stopScroll();
rafId = (0,raf["default"])(() => {
onScrollOffset(offset);
continueScroll();
});
};
const clearDragState = () => {
mouseDownLock = false;
stopScroll();
};
const onMouseDown = e => {
// Skip if element set draggable
if (e.target.draggable || e.button !== 0) {
return;
}
// Skip if nest List has handled this event
const event = e;
if (!event._virtualHandled) {
event._virtualHandled = true;
mouseDownLock = true;
}
};
const onMouseMove = e => {
if (mouseDownLock) {
const mouseY = getPageXY(e, false);
const {
top,
bottom
} = ele.getBoundingClientRect();
if (mouseY <= top) {
const diff = top - mouseY;
offset = -smoothScrollOffset(diff);
continueScroll();
} else if (mouseY >= bottom) {
const diff = mouseY - bottom;
offset = smoothScrollOffset(diff);
continueScroll();
} else {
stopScroll();
}
}
};
ele.addEventListener('mousedown', onMouseDown);
ele.ownerDocument.addEventListener('mouseup', clearDragState);
ele.ownerDocument.addEventListener('mousemove', onMouseMove);
ele.ownerDocument.addEventListener('dragend', clearDragState);
return () => {
ele.removeEventListener('mousedown', onMouseDown);
ele.ownerDocument.removeEventListener('mouseup', clearDragState);
ele.ownerDocument.removeEventListener('mousemove', onMouseMove);
ele.ownerDocument.removeEventListener('dragend', clearDragState);
stopScroll();
};
}
}, [inVirtual]);
}
;// ./node_modules/@rc-component/virtual-list/es/hooks/useScrollTo.js
/* eslint-disable no-param-reassign */
const MAX_TIMES = 10;
function useScrollTo(containerRef, data, heights, itemHeight, getKey, collectHeight, syncScrollTop, triggerFlash) {
const scrollRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
const [syncState, setSyncState] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
// ========================== Sync Scroll ==========================
(0,useLayoutEffect["default"])(() => {
if (syncState && syncState.times < MAX_TIMES) {
// Never reach
if (!containerRef.current) {
setSyncState(ori => ({
...ori
}));
return;
}
collectHeight();
const {
targetAlign,
originAlign,
index,
offset
} = syncState;
const height = containerRef.current.clientHeight;
let needCollectHeight = false;
let newTargetAlign = targetAlign;
let targetTop = null;
// Go to next frame if height not exist
if (height) {
const mergedAlign = targetAlign || originAlign;
// Get top & bottom
let stackTop = 0;
let itemTop = 0;
let itemBottom = 0;
const maxLen = Math.min(data.length - 1, index);
for (let i = 0; i <= maxLen; i += 1) {
const key = getKey(data[i]);
itemTop = stackTop;
const cacheHeight = heights.get(key);
itemBottom = itemTop + (cacheHeight === undefined ? itemHeight : cacheHeight);
stackTop = itemBottom;
}
// Check if need sync height (visible range has item not record height)
let leftHeight = mergedAlign === 'top' ? offset : height - offset;
for (let i = maxLen; i >= 0; i -= 1) {
const key = getKey(data[i]);
const cacheHeight = heights.get(key);
if (cacheHeight === undefined) {
needCollectHeight = true;
break;
}
leftHeight -= cacheHeight;
if (leftHeight <= 0) {
break;
}
}
// Scroll to
switch (mergedAlign) {
case 'top':
targetTop = itemTop - offset;
break;
case 'bottom':
targetTop = itemBottom - height + offset;
break;
default:
{
const {
scrollTop
} = containerRef.current;
const scrollBottom = scrollTop + height;
if (itemTop < scrollTop) {
newTargetAlign = 'top';
} else if (itemBottom > scrollBottom) {
newTargetAlign = 'bottom';
}
}
}
if (targetTop !== null) {
syncScrollTop(targetTop);
}
// One more time for sync
if (targetTop !== syncState.lastTop) {
needCollectHeight = true;
}
}
// Trigger next effect
if (needCollectHeight) {
setSyncState({
...syncState,
times: syncState.times + 1,
targetAlign: newTargetAlign,
lastTop: targetTop
});
}
} else if ( true && syncState?.times === MAX_TIMES) {
(0,es.warning)(false, 'Seems `scrollTo` with `rc-virtual-list` reach the max limitation. Please fire issue for us. Thanks.');
}
}, [syncState, containerRef.current]);
// =========================== Scroll To ===========================
return arg => {
// When not argument provided, we think dev may want to show the scrollbar
if (arg === null || arg === undefined) {
triggerFlash();
return;
}
// Normal scroll logic
raf["default"].cancel(scrollRef.current);
if (typeof arg === 'number') {
syncScrollTop(arg);
} else if (arg && typeof arg === 'object') {
let index;
const {
align
} = arg;
if ('index' in arg) {
({
index
} = arg);
} else {
index = data.findIndex(item => getKey(item) === arg.key);
}
const {
offset = 0
} = arg;
setSyncState({
times: 0,
index,
offset,
originAlign: align
});
}
};
}
;// ./node_modules/@rc-component/virtual-list/es/ScrollBar.js
const ScrollBar = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls,
rtl,
scrollOffset,
scrollRange,
onStartMove,
onStopMove,
onScroll,
horizontal,
spinSize,
containerSize,
style,
thumbStyle: propsThumbStyle,
showScrollBar
} = props;
const [dragging, setDragging] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const [pageXY, setPageXY] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
const [startTop, setStartTop] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
const isLTR = !rtl;
// ========================= Refs =========================
const scrollbarRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
const thumbRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
// ======================= Visible ========================
const [visible, setVisible] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(showScrollBar);
const visibleTimeoutRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
const delayHidden = () => {
if (showScrollBar === true || showScrollBar === false) return;
clearTimeout(visibleTimeoutRef.current);
setVisible(true);
visibleTimeoutRef.current = setTimeout(() => {
setVisible(false);
}, 3000);
};
// ======================== Range =========================
const enableScrollRange = scrollRange - containerSize || 0;
const enableOffsetRange = containerSize - spinSize || 0;
// ========================= Top ==========================
const top = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (scrollOffset === 0 || enableScrollRange === 0) {
return 0;
}
const ptg = scrollOffset / enableScrollRange;
return ptg * enableOffsetRange;
}, [scrollOffset, enableScrollRange, enableOffsetRange]);
// ====================== Container =======================
const onContainerMouseDown = e => {
e.stopPropagation();
e.preventDefault();
};
// ======================== Thumb =========================
const stateRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({
top,
dragging,
pageY: pageXY,
startTop
});
stateRef.current = {
top,
dragging,
pageY: pageXY,
startTop
};
const onThumbMouseDown = e => {
setDragging(true);
setPageXY(getPageXY(e, horizontal));
setStartTop(stateRef.current.top);
onStartMove();
e.stopPropagation();
e.preventDefault();
};
// ======================== Effect ========================
// React make event as passive, but we need to preventDefault
// Add event on dom directly instead.
// ref: https://github.com/facebook/react/issues/9809
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
const onScrollbarTouchStart = e => {
e.preventDefault();
};
const scrollbarEle = scrollbarRef.current;
const thumbEle = thumbRef.current;
scrollbarEle.addEventListener('touchstart', onScrollbarTouchStart, {
passive: false
});
thumbEle.addEventListener('touchstart', onThumbMouseDown, {
passive: false
});
return () => {
scrollbarEle.removeEventListener('touchstart', onScrollbarTouchStart);
thumbEle.removeEventListener('touchstart', onThumbMouseDown);
};
}, []);
// Pass to effect
const enableScrollRangeRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
enableScrollRangeRef.current = enableScrollRange;
const enableOffsetRangeRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
enableOffsetRangeRef.current = enableOffsetRange;
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (dragging) {
let moveRafId;
const onMouseMove = e => {
const {
dragging: stateDragging,
pageY: statePageY,
startTop: stateStartTop
} = stateRef.current;
raf["default"].cancel(moveRafId);
const rect = scrollbarRef.current.getBoundingClientRect();
const scale = containerSize / (horizontal ? rect.width : rect.height);
if (stateDragging) {
const offset = (getPageXY(e, horizontal) - statePageY) * scale;
let newTop = stateStartTop;
if (!isLTR && horizontal) {
newTop -= offset;
} else {
newTop += offset;
}
const tmpEnableScrollRange = enableScrollRangeRef.current;
const tmpEnableOffsetRange = enableOffsetRangeRef.current;
const ptg = tmpEnableOffsetRange ? newTop / tmpEnableOffsetRange : 0;
let newScrollTop = Math.ceil(ptg * tmpEnableScrollRange);
newScrollTop = Math.max(newScrollTop, 0);
newScrollTop = Math.min(newScrollTop, tmpEnableScrollRange);
moveRafId = (0,raf["default"])(() => {
onScroll(newScrollTop, horizontal);
});
}
};
const onMouseUp = () => {
setDragging(false);
onStopMove();
};
window.addEventListener('mousemove', onMouseMove, {
passive: true
});
window.addEventListener('touchmove', onMouseMove, {
passive: true
});
window.addEventListener('mouseup', onMouseUp, {
passive: true
});
window.addEventListener('touchend', onMouseUp, {
passive: true
});
return () => {
window.removeEventListener('mousemove', onMouseMove);
window.removeEventListener('touchmove', onMouseMove);
window.removeEventListener('mouseup', onMouseUp);
window.removeEventListener('touchend', onMouseUp);
raf["default"].cancel(moveRafId);
};
}
}, [dragging]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
delayHidden();
return () => {
clearTimeout(visibleTimeoutRef.current);
};
}, [scrollOffset]);
// ====================== Imperative ======================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
delayHidden
}));
// ======================== Render ========================
const scrollbarPrefixCls = `${prefixCls}-scrollbar`;
const containerStyle = {
position: 'absolute',
visibility: visible ? null : 'hidden'
};
const thumbStyle = {
position: 'absolute',
borderRadius: 99,
background: 'var(--rc-virtual-list-scrollbar-bg, rgba(0, 0, 0, 0.5))',
cursor: 'pointer',
userSelect: 'none'
};
if (horizontal) {
Object.assign(containerStyle, {
height: 8,
left: 0,
right: 0,
bottom: 0
});
Object.assign(thumbStyle, {
height: '100%',
width: spinSize,
[isLTR ? 'left' : 'right']: top
});
} else {
Object.assign(containerStyle, {
width: 8,
top: 0,
bottom: 0,
[isLTR ? 'right' : 'left']: 0
});
Object.assign(thumbStyle, {
width: '100%',
height: spinSize,
top
});
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: scrollbarRef,
className: (0,clsx.clsx)(scrollbarPrefixCls, {
[`${scrollbarPrefixCls}-horizontal`]: horizontal,
[`${scrollbarPrefixCls}-vertical`]: !horizontal,
[`${scrollbarPrefixCls}-visible`]: visible
}),
style: {
...containerStyle,
...style
},
onMouseDown: onContainerMouseDown,
onMouseMove: delayHidden
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: thumbRef,
className: (0,clsx.clsx)(`${scrollbarPrefixCls}-thumb`, {
[`${scrollbarPrefixCls}-thumb-moving`]: dragging
}),
style: {
...thumbStyle,
...propsThumbStyle
},
onMouseDown: onThumbMouseDown
}));
});
if (true) {
ScrollBar.displayName = 'ScrollBar';
}
/* harmony default export */ var es_ScrollBar = (ScrollBar);
;// ./node_modules/@rc-component/virtual-list/es/utils/scrollbarUtil.js
const MIN_SIZE = 20;
function getSpinSize(containerSize = 0, scrollRange = 0) {
let baseSize = containerSize / scrollRange * containerSize;
if (isNaN(baseSize)) {
baseSize = 0;
}
baseSize = Math.max(baseSize, MIN_SIZE);
return Math.floor(baseSize);
}
;// ./node_modules/@rc-component/virtual-list/es/List.js
const EMPTY_DATA = [];
const ScrollStyle = {
overflowY: 'auto',
overflowAnchor: 'none'
};
function RawList(props, ref) {
const {
prefixCls = 'rc-virtual-list',
className,
height,
itemHeight,
fullHeight = true,
style,
data,
children,
itemKey,
virtual,
direction,
scrollWidth,
component: Component = 'div',
onScroll,
onVirtualScroll,
onVisibleChange,
innerProps,
extraRender,
styles,
showScrollBar = 'optional',
...restProps
} = props;
// =============================== Item Key ===============================
const getKey = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(item => {
if (typeof itemKey === 'function') {
return itemKey(item);
}
return item?.[itemKey];
}, [itemKey]);
// ================================ Height ================================
const [setInstanceRef, collectHeight, heights, heightUpdatedMark] = useHeights(getKey, null, null);
// ================================= MISC =================================
const useVirtual = !!(virtual !== false && height && itemHeight);
const containerHeight = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => Object.values(heights.maps).reduce((total, curr) => total + curr, 0), [heights.id, heights.maps]);
const inVirtual = useVirtual && data && (Math.max(itemHeight * data.length, containerHeight) > height || !!scrollWidth);
const isRTL = direction === 'rtl';
const mergedClassName = (0,clsx.clsx)(prefixCls, {
[`${prefixCls}-rtl`]: isRTL
}, className);
const mergedData = data || EMPTY_DATA;
const componentRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
const fillerInnerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
const containerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
// =============================== Item Key ===============================
const [offsetTop, setOffsetTop] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0);
const [offsetLeft, setOffsetLeft] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0);
const [scrollMoving, setScrollMoving] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
const onScrollbarStartMove = () => {
setScrollMoving(true);
};
const onScrollbarStopMove = () => {
setScrollMoving(false);
};
const sharedConfig = {
getKey
};
// ================================ Scroll ================================
function syncScrollTop(newTop) {
setOffsetTop(origin => {
let value;
if (typeof newTop === 'function') {
value = newTop(origin);
} else {
value = newTop;
}
const alignedTop = keepInRange(value);
componentRef.current.scrollTop = alignedTop;
return alignedTop;
});
}
// ================================ Legacy ================================
// Put ref here since the range is generate by follow
const rangeRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
start: 0,
end: mergedData.length
});
const diffItemRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
const [diffItem] = useDiffItem(mergedData, getKey);
diffItemRef.current = diffItem;
// ========================== Visible Calculation =========================
const {
scrollHeight,
start,
end,
offset: fillerOffset
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!useVirtual) {
return {
scrollHeight: undefined,
start: 0,
end: mergedData.length - 1,
offset: undefined
};
}
// Always use virtual scroll bar in avoid shaking
if (!inVirtual) {
return {
scrollHeight: fillerInnerRef.current?.offsetHeight || 0,
start: 0,
end: mergedData.length - 1,
offset: undefined
};
}
let itemTop = 0;
let startIndex;
let startOffset;
let endIndex;
const dataLen = mergedData.length;
for (let i = 0; i < dataLen; i += 1) {
const item = mergedData[i];
const key = getKey(item);
const cacheHeight = heights.get(key);
const currentItemBottom = itemTop + (cacheHeight === undefined ? itemHeight : cacheHeight);
// Check item top in the range
if (currentItemBottom >= offsetTop && startIndex === undefined) {
startIndex = i;
startOffset = itemTop;
}
// Check item bottom in the range. We will render additional one item for motion usage
if (currentItemBottom > offsetTop + height && endIndex === undefined) {
endIndex = i;
}
itemTop = currentItemBottom;
}
// When scrollTop at the end but data cut to small count will reach this
if (startIndex === undefined) {
startIndex = 0;
startOffset = 0;
endIndex = Math.ceil(height / itemHeight);
}
if (endIndex === undefined) {
endIndex = mergedData.length - 1;
}
// Give cache to improve scroll experience
endIndex = Math.min(endIndex + 1, mergedData.length - 1);
return {
scrollHeight: itemTop,
start: startIndex,
end: endIndex,
offset: startOffset
};
}, [inVirtual, useVirtual, offsetTop, mergedData, heightUpdatedMark, height]);
rangeRef.current.start = start;
rangeRef.current.end = end;
// When scroll up, first visible item get real height may not same as `itemHeight`,
// Which will make scroll jump.
// Let's sync scroll top to avoid jump
external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect(() => {
const changedRecord = heights.getRecord();
if (changedRecord.size === 1) {
const recordKey = Array.from(changedRecord.keys())[0];
const prevCacheHeight = changedRecord.get(recordKey);
// Quick switch data may cause `start` not in `mergedData` anymore
const startItem = mergedData[start];
if (startItem && prevCacheHeight === undefined) {
const startIndexKey = getKey(startItem);
if (startIndexKey === recordKey) {
const realStartHeight = heights.get(recordKey);
const diffHeight = realStartHeight - itemHeight;
syncScrollTop(ori => {
return ori + diffHeight;
});
}
}
}
heights.resetRecord();
}, [scrollHeight]);
// ================================= Size =================================
const [size, setSize] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState({
width: 0,
height
});
const onHolderResize = sizeInfo => {
setSize({
width: sizeInfo.offsetWidth,
height: sizeInfo.offsetHeight
});
};
// Hack on scrollbar to enable flash call
const verticalScrollBarRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
const horizontalScrollBarRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
const horizontalScrollBarSpinSize = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => getSpinSize(size.width, scrollWidth), [size.width, scrollWidth]);
const verticalScrollBarSpinSize = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => getSpinSize(size.height, scrollHeight), [size.height, scrollHeight]);
// =============================== In Range ===============================
const maxScrollHeight = scrollHeight - height;
const maxScrollHeightRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(maxScrollHeight);
maxScrollHeightRef.current = maxScrollHeight;
function keepInRange(newScrollTop) {
let newTop = newScrollTop;
if (!Number.isNaN(maxScrollHeightRef.current)) {
newTop = Math.min(newTop, maxScrollHeightRef.current);
}
newTop = Math.max(newTop, 0);
return newTop;
}
const isScrollAtTop = offsetTop <= 0;
const isScrollAtBottom = offsetTop >= maxScrollHeight;
const isScrollAtLeft = offsetLeft <= 0;
const isScrollAtRight = offsetLeft >= scrollWidth;
const originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight);
// ================================ Scroll ================================
const getVirtualScrollInfo = () => ({
x: isRTL ? -offsetLeft : offsetLeft,
y: offsetTop
});
const lastVirtualScrollInfoRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(getVirtualScrollInfo());
const triggerScroll = (0,es.useEvent)(params => {
if (onVirtualScroll) {
const nextInfo = {
...getVirtualScrollInfo(),
...params
};
// Trigger when offset changed
if (lastVirtualScrollInfoRef.current.x !== nextInfo.x || lastVirtualScrollInfoRef.current.y !== nextInfo.y) {
onVirtualScroll(nextInfo);
lastVirtualScrollInfoRef.current = nextInfo;
}
}
});
function onScrollBar(newScrollOffset, horizontal) {
const newOffset = newScrollOffset;
if (horizontal) {
(0,external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_.flushSync)(() => {
setOffsetLeft(newOffset);
});
triggerScroll();
} else {
syncScrollTop(newOffset);
}
}
// When data size reduce. It may trigger native scroll event back to fit scroll position
function onFallbackScroll(e) {
const {
scrollTop: newScrollTop
} = e.currentTarget;
if (newScrollTop !== offsetTop) {
syncScrollTop(newScrollTop);
}
// Trigger origin onScroll
onScroll?.(e);
triggerScroll();
}
const keepInHorizontalRange = nextOffsetLeft => {
let tmpOffsetLeft = nextOffsetLeft;
const max = !!scrollWidth ? scrollWidth - size.width : 0;
tmpOffsetLeft = Math.max(tmpOffsetLeft, 0);
tmpOffsetLeft = Math.min(tmpOffsetLeft, max);
return tmpOffsetLeft;
};
const onWheelDelta = (0,es.useEvent)((offsetXY, fromHorizontal) => {
if (fromHorizontal) {
(0,external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_.flushSync)(() => {
setOffsetLeft(left => {
const nextOffsetLeft = left + (isRTL ? -offsetXY : offsetXY);
return keepInHorizontalRange(nextOffsetLeft);
});
});
triggerScroll();
} else {
syncScrollTop(top => {
const newTop = top + offsetXY;
return newTop;
});
}
});
// Since this added in global,should use ref to keep update
const [onRawWheel, onFireFoxScroll] = useFrameWheel(useVirtual, isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight, !!scrollWidth, onWheelDelta);
// Mobile touch move
useMobileTouchMove(useVirtual, componentRef, (isHorizontal, delta, smoothOffset, e) => {
const event = e;
if (originScroll(isHorizontal, delta, smoothOffset)) {
return false;
}
// Fix nest List trigger TouchMove event
if (!event || !event._virtualHandled) {
if (event) {
event._virtualHandled = true;
}
onRawWheel({
preventDefault() {},
deltaX: isHorizontal ? delta : 0,
deltaY: isHorizontal ? 0 : delta
});
return true;
}
return false;
});
// MouseDown drag for scroll
useScrollDrag(inVirtual, componentRef, offset => {
syncScrollTop(top => top + offset);
});
(0,useLayoutEffect["default"])(() => {
// Firefox only
function onMozMousePixelScroll(e) {
// scrolling at top/bottom limit
const scrollingUpAtTop = isScrollAtTop && e.detail < 0;
const scrollingDownAtBottom = isScrollAtBottom && e.detail > 0;
if (useVirtual && !scrollingUpAtTop && !scrollingDownAtBottom) {
e.preventDefault();
}
}
const componentEle = componentRef.current;
componentEle.addEventListener('wheel', onRawWheel, {
passive: false
});
componentEle.addEventListener('DOMMouseScroll', onFireFoxScroll, {
passive: true
});
componentEle.addEventListener('MozMousePixelScroll', onMozMousePixelScroll, {
passive: false
});
return () => {
componentEle.removeEventListener('wheel', onRawWheel);
componentEle.removeEventListener('DOMMouseScroll', onFireFoxScroll);
componentEle.removeEventListener('MozMousePixelScroll', onMozMousePixelScroll);
};
}, [useVirtual, isScrollAtTop, isScrollAtBottom]);
// Sync scroll left
(0,useLayoutEffect["default"])(() => {
if (scrollWidth) {
const newOffsetLeft = keepInHorizontalRange(offsetLeft);
setOffsetLeft(newOffsetLeft);
triggerScroll({
x: newOffsetLeft
});
}
}, [size.width, scrollWidth]);
// ================================= Ref ==================================
const delayHideScrollBar = () => {
verticalScrollBarRef.current?.delayHidden();
horizontalScrollBarRef.current?.delayHidden();
};
const scrollTo = useScrollTo(componentRef, mergedData, heights, itemHeight, getKey, () => collectHeight(true), syncScrollTop, delayHideScrollBar);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
nativeElement: containerRef.current,
getScrollInfo: getVirtualScrollInfo,
scrollTo: config => {
function isPosScroll(arg) {
return arg && typeof arg === 'object' && ('left' in arg || 'top' in arg);
}
if (isPosScroll(config)) {
// Scroll X
if (config.left !== undefined) {
setOffsetLeft(keepInHorizontalRange(config.left));
}
// Scroll Y
scrollTo(config.top);
} else {
scrollTo(config);
}
}
}));
// ================================ Effect ================================
/** We need told outside that some list not rendered */
(0,useLayoutEffect["default"])(() => {
if (onVisibleChange) {
const renderList = mergedData.slice(start, end + 1);
onVisibleChange(renderList, mergedData);
}
}, [start, end, mergedData]);
// ================================ Extra =================================
const getSize = useGetSize(mergedData, getKey, heights, itemHeight);
const extraContent = extraRender?.({
start,
end,
virtual: inVirtual,
offsetX: offsetLeft,
offsetY: fillerOffset,
rtl: isRTL,
getSize
});
// ================================ Render ================================
const listChildren = useChildren(mergedData, start, end, scrollWidth, offsetLeft, setInstanceRef, children, sharedConfig);
let componentStyle = null;
if (height) {
componentStyle = {
[fullHeight ? 'height' : 'maxHeight']: height,
...ScrollStyle
};
if (useVirtual) {
componentStyle.overflowY = 'hidden';
if (scrollWidth) {
componentStyle.overflowX = 'hidden';
}
if (scrollMoving) {
componentStyle.pointerEvents = 'none';
}
}
}
const containerProps = {};
if (isRTL) {
containerProps.dir = 'rtl';
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", (0,esm_extends["default"])({
ref: containerRef,
style: {
...style,
position: 'relative'
},
className: mergedClassName
}, containerProps, restProps), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(resize_observer_es, {
onResize: onHolderResize
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, {
className: `${prefixCls}-holder`,
style: componentStyle,
ref: componentRef,
onScroll: onFallbackScroll,
onMouseEnter: delayHideScrollBar
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Filler, {
prefixCls: prefixCls,
height: scrollHeight,
offsetX: offsetLeft,
offsetY: fillerOffset,
scrollWidth: scrollWidth,
onInnerResize: collectHeight,
ref: fillerInnerRef,
innerProps: innerProps,
rtl: isRTL,
extra: extraContent
}, listChildren))), inVirtual && scrollHeight > height && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_ScrollBar, {
ref: verticalScrollBarRef,
prefixCls: prefixCls,
scrollOffset: offsetTop,
scrollRange: scrollHeight,
rtl: isRTL,
onScroll: onScrollBar,
onStartMove: onScrollbarStartMove,
onStopMove: onScrollbarStopMove,
spinSize: verticalScrollBarSpinSize,
containerSize: size.height,
style: styles?.verticalScrollBar,
thumbStyle: styles?.verticalScrollBarThumb,
showScrollBar: showScrollBar
}), inVirtual && scrollWidth > size.width && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_ScrollBar, {
ref: horizontalScrollBarRef,
prefixCls: prefixCls,
scrollOffset: offsetLeft,
scrollRange: scrollWidth,
rtl: isRTL,
onScroll: onScrollBar,
onStartMove: onScrollbarStartMove,
onStopMove: onScrollbarStopMove,
spinSize: horizontalScrollBarSpinSize,
containerSize: size.width,
horizontal: true,
style: styles?.horizontalScrollBar,
thumbStyle: styles?.horizontalScrollBarThumb,
showScrollBar: showScrollBar
}));
}
const List_List = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(RawList);
List_List.displayName = 'List';
/* harmony default export */ var virtual_list_es_List = (List_List);
;// ./node_modules/@rc-component/virtual-list/es/index.js
/* harmony default export */ var virtual_list_es = (virtual_list_es_List);
;// ./node_modules/@rc-component/select/es/utils/platformUtil.js
/* istanbul ignore file */
function isPlatformMac() {
return /(mac\sos|macintosh)/i.test(navigator.appVersion);
}
;// ./node_modules/@rc-component/select/es/OptionList.js
function OptionList_extends() { OptionList_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return OptionList_extends.apply(this, arguments); }
// export interface OptionListProps {
function OptionList_isTitleType(content) {
return typeof content === 'string' || typeof content === 'number';
}
/**
* Using virtual list of option display.
* Will fallback to dom if use customize render.
*/
const OptionList = (_, ref) => {
const {
prefixCls,
id,
open,
multiple,
mode,
searchValue,
toggleOpen,
notFoundContent,
onPopupScroll,
showScrollBar,
lockOptions
} = useBaseProps();
const {
maxCount,
flattenOptions,
onActiveValue,
defaultActiveFirstOption,
onSelect,
menuItemSelectedIcon,
rawValues,
fieldNames,
virtual,
direction,
listHeight,
listItemHeight,
optionRender,
classNames: contextClassNames,
styles: contextStyles
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(es_SelectContext);
const itemPrefixCls = `${prefixCls}-item`;
const memoFlattenOptions = (0,useMemo["default"])(() => flattenOptions, [open, lockOptions], (prev, next) => next[0] && !next[1]);
// =========================== List ===========================
const listRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const overMaxCount = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => multiple && isValidCount(maxCount) && rawValues?.size >= maxCount, [multiple, maxCount, rawValues?.size]);
const onListMouseDown = event => {
event.preventDefault();
};
const scrollIntoView = args => {
listRef.current?.scrollTo(typeof args === 'number' ? {
index: args
} : args);
};
// https://github.com/ant-design/ant-design/issues/34975
const isSelected = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(value => {
if (mode === 'combobox') {
return false;
}
return rawValues.has(value);
}, [mode, [...rawValues].toString(), rawValues.size]);
// ========================== Active ==========================
const getEnabledActiveIndex = (index, offset = 1) => {
const len = memoFlattenOptions.length;
for (let i = 0; i < len; i += 1) {
const current = (index + i * offset + len) % len;
const {
group,
data
} = memoFlattenOptions[current] || {};
if (!group && !data?.disabled && (isSelected(data.value) || !overMaxCount)) {
return current;
}
}
return -1;
};
const [activeIndex, setActiveIndex] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(() => getEnabledActiveIndex(0));
const setActive = (index, fromKeyboard = false) => {
setActiveIndex(index);
const info = {
source: fromKeyboard ? 'keyboard' : 'mouse'
};
// Trigger active event
const flattenItem = memoFlattenOptions[index];
if (!flattenItem) {
onActiveValue(null, -1, info);
return;
}
onActiveValue(flattenItem.value, index, info);
};
// Auto active first item when list length or searchValue changed
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
setActive(defaultActiveFirstOption !== false ? getEnabledActiveIndex(0) : -1);
}, [memoFlattenOptions.length, searchValue]);
// https://github.com/ant-design/ant-design/issues/48036
const isAriaSelected = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(value => {
if (mode === 'combobox') {
return String(value).toLowerCase() === searchValue.toLowerCase();
}
return rawValues.has(value);
}, [mode, searchValue, [...rawValues].toString(), rawValues.size]);
// Auto scroll to item position in single mode
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
/**
* React will skip `onChange` when component update.
* `setActive` function will call root accessibility state update which makes re-render.
* So we need to delay to let Input component trigger onChange first.
*/
let timeoutId;
if (!multiple && open && rawValues.size === 1) {
const value = Array.from(rawValues)[0];
// Scroll to the option closest to the searchValue if searching.
const index = memoFlattenOptions.findIndex(({
data
}) => searchValue ? String(data.value).startsWith(searchValue) : data.value === value);
if (index !== -1) {
setActive(index);
timeoutId = setTimeout(() => {
scrollIntoView(index);
});
}
}
// Force trigger scrollbar visible when open
if (open) {
listRef.current?.scrollTo(undefined);
}
return () => clearTimeout(timeoutId);
}, [open, searchValue]);
// ========================== Values ==========================
const onSelectValue = value => {
if (value !== undefined) {
onSelect(value, {
selected: !rawValues.has(value)
});
}
// Single mode should always close by select
if (!multiple) {
toggleOpen(false);
}
};
// ========================= Keyboard =========================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
onKeyDown: event => {
const {
which,
ctrlKey
} = event;
switch (which) {
// >>> Arrow keys & ctrl + n/p on Mac
case KeyCode["default"].N:
case KeyCode["default"].P:
case KeyCode["default"].UP:
case KeyCode["default"].DOWN:
{
let offset = 0;
if (which === KeyCode["default"].UP) {
offset = -1;
} else if (which === KeyCode["default"].DOWN) {
offset = 1;
} else if (isPlatformMac() && ctrlKey) {
if (which === KeyCode["default"].N) {
offset = 1;
} else if (which === KeyCode["default"].P) {
offset = -1;
}
}
if (offset !== 0) {
const nextActiveIndex = getEnabledActiveIndex(activeIndex + offset, offset);
scrollIntoView(nextActiveIndex);
setActive(nextActiveIndex, true);
}
break;
}
// >>> Select (Tab / Enter)
case KeyCode["default"].TAB:
case KeyCode["default"].ENTER:
{
// value
const item = memoFlattenOptions[activeIndex];
if (!item || item.data.disabled) {
return onSelectValue(undefined);
}
if (!overMaxCount || rawValues.has(item.value)) {
onSelectValue(item.value);
} else {
onSelectValue(undefined);
}
if (open) {
event.preventDefault();
}
break;
}
// >>> Close
case KeyCode["default"].ESC:
{
toggleOpen(false);
if (open) {
event.stopPropagation();
}
}
}
},
onKeyUp: () => {},
scrollTo: index => {
scrollIntoView(index);
}
}));
// ========================== Render ==========================
if (memoFlattenOptions.length === 0) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
role: "listbox",
id: `${id}_list`,
className: `${itemPrefixCls}-empty`,
onMouseDown: onListMouseDown
}, notFoundContent);
}
const omitFieldNameList = Object.keys(fieldNames).map(key => fieldNames[key]);
const getLabel = item => item.label;
function getItemAriaProps(item, index) {
const {
group
} = item;
return {
role: group ? 'presentation' : 'option',
id: `${id}_list_${index}`
};
}
const renderItem = index => {
const item = memoFlattenOptions[index];
if (!item) {
return null;
}
const itemData = item.data || {};
const {
value,
disabled
} = itemData;
const {
group
} = item;
const attrs = (0,pickAttrs["default"])(itemData, true);
const mergedLabel = getLabel(item);
return item ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", OptionList_extends({
"aria-label": typeof mergedLabel === 'string' && !group ? mergedLabel : null
}, attrs, {
key: index
}, getItemAriaProps(item, index), {
"aria-selected": isAriaSelected(value),
"aria-disabled": disabled
}), value) : null;
};
const a11yProps = {
role: 'listbox',
id: `${id}_list`
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, virtual && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", OptionList_extends({}, a11yProps, {
style: {
height: 0,
width: 0,
overflow: 'hidden'
}
}), renderItem(activeIndex - 1), renderItem(activeIndex), renderItem(activeIndex + 1)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(virtual_list_es, {
itemKey: "key",
ref: listRef,
data: memoFlattenOptions,
height: listHeight,
itemHeight: listItemHeight,
fullHeight: false,
onMouseDown: onListMouseDown,
onScroll: onPopupScroll,
virtual: virtual,
direction: direction,
innerProps: virtual ? null : a11yProps,
showScrollBar: showScrollBar,
className: contextClassNames?.popup?.list,
style: contextStyles?.popup?.list
}, (item, itemIndex) => {
const {
group,
groupOption,
data,
label,
value
} = item;
const {
key
} = data;
// Group
if (group) {
const groupTitle = data.title ?? (OptionList_isTitleType(label) ? label.toString() : undefined);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(itemPrefixCls, `${itemPrefixCls}-group`, data.className),
title: groupTitle
}, label !== undefined ? label : key);
}
const {
disabled,
title,
children,
style,
className,
...otherProps
} = data;
const passedProps = (0,omit["default"])(otherProps, omitFieldNameList);
// Option
const selected = isSelected(value);
const mergedDisabled = disabled || !selected && overMaxCount;
const optionPrefixCls = `${itemPrefixCls}-option`;
const optionClassName = (0,clsx.clsx)(itemPrefixCls, optionPrefixCls, className, contextClassNames?.popup?.listItem, {
[`${optionPrefixCls}-grouped`]: groupOption,
[`${optionPrefixCls}-active`]: activeIndex === itemIndex && !mergedDisabled,
[`${optionPrefixCls}-disabled`]: mergedDisabled,
[`${optionPrefixCls}-selected`]: selected
});
const mergedLabel = getLabel(item);
const iconVisible = !menuItemSelectedIcon || typeof menuItemSelectedIcon === 'function' || selected;
// https://github.com/ant-design/ant-design/issues/34145
const content = typeof mergedLabel === 'number' ? mergedLabel : mergedLabel || value;
// https://github.com/ant-design/ant-design/issues/26717
let optionTitle = OptionList_isTitleType(content) ? content.toString() : undefined;
if (title !== undefined) {
optionTitle = title;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", OptionList_extends({}, (0,pickAttrs["default"])(passedProps), !virtual ? getItemAriaProps(item, itemIndex) : {}, {
"aria-selected": virtual ? undefined : isAriaSelected(value),
"aria-disabled": mergedDisabled,
className: optionClassName,
title: optionTitle,
onMouseMove: () => {
if (activeIndex === itemIndex || mergedDisabled) {
return;
}
setActive(itemIndex);
},
onClick: () => {
if (!mergedDisabled) {
onSelectValue(value);
}
},
style: {
...contextStyles?.popup?.listItem,
...style
}
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${optionPrefixCls}-content`
}, typeof optionRender === 'function' ? optionRender(item, {
index: itemIndex
}) : content), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(menuItemSelectedIcon) || selected, iconVisible && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_TransBtn, {
className: `${itemPrefixCls}-option-state`,
customizeIcon: menuItemSelectedIcon,
customizeIconProps: {
value,
disabled: mergedDisabled,
isSelected: selected
}
}, selected ? '✓' : null));
}));
};
const RefOptionList = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(OptionList);
if (true) {
RefOptionList.displayName = 'OptionList';
}
/* harmony default export */ var es_OptionList = (RefOptionList);
;// ./node_modules/@rc-component/select/es/hooks/useCache.js
/**
* Cache `value` related LabeledValue & options.
*/
/* harmony default export */ var useCache = ((labeledValues, valueOptions) => {
const cacheRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({
values: new Map(),
options: new Map()
});
const filledLabeledValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const {
values: prevValueCache,
options: prevOptionCache
} = cacheRef.current;
// Fill label by cache
const patchedValues = labeledValues.map(item => {
if (item.label === undefined) {
return {
...item,
label: prevValueCache.get(item.value)?.label
};
}
return item;
});
// Refresh cache
const valueCache = new Map();
const optionCache = new Map();
patchedValues.forEach(item => {
valueCache.set(item.value, item);
optionCache.set(item.value, valueOptions.get(item.value) || prevOptionCache.get(item.value));
});
cacheRef.current.values = valueCache;
cacheRef.current.options = optionCache;
return patchedValues;
}, [labeledValues, valueOptions]);
const getOption = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(val => valueOptions.get(val) || cacheRef.current.options.get(val), [valueOptions]);
return [filledLabeledValues, getOption];
});
(Object.getOwnPropertyDescriptor(useCache, "name") || {}).writable || Object.defineProperty(useCache, "name", { value: "default", configurable: true });
;// ./node_modules/@rc-component/select/es/hooks/useFilterOptions.js
function includes(test, search) {
return commonUtil_toArray(test).join('').toUpperCase().includes(search);
}
/* harmony default export */ var useFilterOptions = ((options, fieldNames, searchValue, filterOption, optionFilterProp) => {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!searchValue || filterOption === false) {
return options;
}
const {
options: fieldOptions,
label: fieldLabel,
value: fieldValue
} = fieldNames;
const filteredOptions = [];
const customizeFilter = typeof filterOption === 'function';
const upperSearch = searchValue.toUpperCase();
const filterFunc = customizeFilter ? filterOption : (_, option) => {
// Use provided `optionFilterProp`
if (optionFilterProp && optionFilterProp.length) {
return optionFilterProp.some(prop => includes(option[prop], upperSearch));
}
// Auto select `label` or `value` by option type
if (option[fieldOptions]) {
// hack `fieldLabel` since `OptionGroup` children is not `label`
return includes(option[fieldLabel !== 'children' ? fieldLabel : 'label'], upperSearch);
}
return includes(option[fieldValue], upperSearch);
};
const wrapOption = customizeFilter ? opt => injectPropsWithOption(opt) : opt => opt;
options.forEach(item => {
// Group should check child options
if (item[fieldOptions]) {
// Check group first
const matchGroup = filterFunc(searchValue, wrapOption(item));
if (matchGroup) {
filteredOptions.push(item);
} else {
// Check option
const subOptions = item[fieldOptions].filter(subItem => filterFunc(searchValue, wrapOption(subItem)));
if (subOptions.length) {
filteredOptions.push({
...item,
[fieldOptions]: subOptions
});
}
}
return;
}
if (filterFunc(searchValue, wrapOption(item))) {
filteredOptions.push(item);
}
});
return filteredOptions;
}, [options, filterOption, optionFilterProp, searchValue, fieldNames]);
});
(Object.getOwnPropertyDescriptor(useFilterOptions, "name") || {}).writable || Object.defineProperty(useFilterOptions, "name", { value: "default", configurable: true });
;// ./node_modules/@rc-component/select/es/utils/legacyUtil.js
function convertNodeToOption(node) {
const {
key,
props: {
children,
value,
...restProps
}
} = node;
return {
key,
value: value !== undefined ? value : key,
children,
...restProps
};
}
function convertChildrenToData(nodes, optionOnly = false) {
return (0,toArray["default"])(nodes).map((node, index) => {
if (! /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(node) || !node.type) {
return null;
}
const {
type: {
isSelectOptGroup
},
key,
props: {
children,
...restProps
}
} = node;
if (optionOnly || !isSelectOptGroup) {
return convertNodeToOption(node);
}
return {
key: `__RC_SELECT_GRP__${key === null ? index : key}__`,
label: key,
...restProps,
options: convertChildrenToData(children)
};
}).filter(data => data);
}
;// ./node_modules/@rc-component/select/es/hooks/useOptions.js
/**
* Parse `children` to `options` if `options` is not provided.
* Then flatten the `options`.
*/
const useOptions = (options, children, fieldNames, optionFilterProp, optionLabelProp) => {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
let mergedOptions = options;
const childrenAsData = !options;
if (childrenAsData) {
mergedOptions = convertChildrenToData(children);
}
const valueOptions = new Map();
const labelOptions = new Map();
const setLabelOptions = (labelOptionsMap, option, key) => {
if (key && typeof key === 'string') {
labelOptionsMap.set(option[key], option);
}
};
const dig = (optionList, isChildren = false) => {
// for loop to speed up collection speed
for (let i = 0; i < optionList.length; i += 1) {
const option = optionList[i];
if (!option[fieldNames.options] || isChildren) {
valueOptions.set(option[fieldNames.value], option);
setLabelOptions(labelOptions, option, fieldNames.label);
// https://github.com/ant-design/ant-design/issues/35304
optionFilterProp.forEach(prop => {
setLabelOptions(labelOptions, option, prop);
});
setLabelOptions(labelOptions, option, optionLabelProp);
} else {
dig(option[fieldNames.options], true);
}
}
};
dig(mergedOptions);
return {
options: mergedOptions,
valueOptions,
labelOptions
};
}, [options, children, fieldNames, optionFilterProp, optionLabelProp]);
};
/* harmony default export */ var hooks_useOptions = (useOptions);
;// ./node_modules/@rc-component/select/es/hooks/useRefFunc.js
/**
* Same as `React.useCallback` but always return a memoized function
* but redirect to real function.
*/
function useRefFunc(callback) {
const funcRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
funcRef.current = callback;
const cacheFn = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback((...args) => {
return funcRef.current(...args);
}, []);
return cacheFn;
}
;// ./node_modules/@rc-component/select/es/utils/warningPropsUtil.js
function warningProps(props) {
const {
mode,
options,
children,
backfill,
allowClear,
placeholder,
getInputElement,
showSearch,
onSearch,
defaultOpen,
autoFocus,
labelInValue,
value,
optionLabelProp
} = props;
const multiple = isMultiple(mode);
const mergedShowSearch = showSearch !== undefined ? showSearch : multiple || mode === 'combobox';
const mergedOptions = options || convertChildrenToData(children);
// `tags` should not set option as disabled
(0,warning["default"])(mode !== 'tags' || mergedOptions.every(opt => !opt.disabled), 'Please avoid setting option to disabled in tags mode since user can always type text as tag.');
// `combobox` & `tags` should option be `string` type
if (mode === 'tags' || mode === 'combobox') {
const hasNumberValue = mergedOptions.some(item => {
if (item.options) {
return item.options.some(opt => typeof ('value' in opt ? opt.value : opt.key) === 'number');
}
return typeof ('value' in item ? item.value : item.key) === 'number';
});
(0,warning["default"])(!hasNumberValue, '`value` of Option should not use number type when `mode` is `tags` or `combobox`.');
}
// `combobox` should not use `optionLabelProp`
(0,warning["default"])(mode !== 'combobox' || !optionLabelProp, '`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly.');
// Only `combobox` support `backfill`
(0,warning["default"])(mode === 'combobox' || !backfill, '`backfill` only works with `combobox` mode.');
// Only `combobox` support `getInputElement`
(0,warning["default"])(mode === 'combobox' || !getInputElement, '`getInputElement` only work with `combobox` mode.');
// Customize `getInputElement` should not use `allowClear` & `placeholder`
(0,warning.noteOnce)(mode !== 'combobox' || !getInputElement || !allowClear || !placeholder, 'Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`.');
// `onSearch` should use in `combobox` or `showSearch`
if (onSearch && !mergedShowSearch && mode !== 'combobox' && mode !== 'tags') {
(0,warning["default"])(false, '`onSearch` should work with `showSearch` instead of use alone.');
}
(0,warning.noteOnce)(!defaultOpen || autoFocus, '`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed.');
if (value !== undefined && value !== null) {
const values = commonUtil_toArray(value);
(0,warning["default"])(!labelInValue || values.every(val => typeof val === 'object' && ('key' in val || 'value' in val)), '`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`');
(0,warning["default"])(!multiple || Array.isArray(value), '`value` should be array when `mode` is `multiple` or `tags`');
}
// Syntactic sugar should use correct children type
if (children) {
let invalidateChildType = null;
(0,toArray["default"])(children).some(node => {
if (! /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(node) || !node.type) {
return false;
}
const {
type
} = node;
if (type.isSelectOption) {
return false;
}
if (type.isSelectOptGroup) {
const allChildrenValid = (0,toArray["default"])(node.props.children).every(subNode => {
if (! /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(subNode) || !node.type || subNode.type.isSelectOption) {
return true;
}
invalidateChildType = subNode.type;
return false;
});
if (allChildrenValid) {
return false;
}
return true;
}
invalidateChildType = type;
return true;
});
if (invalidateChildType) {
(0,warning["default"])(false, `\`children\` should be \`Select.Option\` or \`Select.OptGroup\` instead of \`${invalidateChildType.displayName || invalidateChildType.name || invalidateChildType}\`.`);
}
}
}
// value in Select option should not be null
// note: OptGroup has options too
function warningNullOptions(options, fieldNames) {
if (options) {
const recursiveOptions = (optionsList, inGroup = false) => {
for (let i = 0; i < optionsList.length; i++) {
const option = optionsList[i];
if (option[fieldNames?.value] === null) {
(0,warning["default"])(false, '`value` in Select options should not be `null`.');
return true;
}
if (!inGroup && Array.isArray(option[fieldNames?.options]) && recursiveOptions(option[fieldNames?.options], true)) {
break;
}
}
};
recursiveOptions(options);
}
}
/* harmony default export */ var warningPropsUtil = (warningProps);
;// ./node_modules/@rc-component/select/es/hooks/useSearchConfig.js
// Convert `showSearch` to unique config
function useSearchConfig(showSearch, props, mode) {
const {
filterOption,
searchValue,
optionFilterProp,
filterSort,
onSearch,
autoClearSearchValue
} = props;
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const isObject = typeof showSearch === 'object';
const searchConfig = {
filterOption,
searchValue,
optionFilterProp,
filterSort,
onSearch,
autoClearSearchValue,
...(isObject ? showSearch : {})
};
return [isObject || mode === 'combobox' || mode === 'tags' || mode === 'multiple' && showSearch === undefined ? true : showSearch, searchConfig];
}, [mode, showSearch, filterOption, searchValue, optionFilterProp, filterSort, onSearch, autoClearSearchValue]);
}
;// ./node_modules/@rc-component/select/es/Select.js
function Select_extends() { Select_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Select_extends.apply(this, arguments); }
/**
* To match accessibility requirement, we always provide an input in the component.
* Other element will not set `tabIndex` to avoid `onBlur` sequence problem.
* For focused select, we set `aria-live="polite"` to update the accessibility content.
*
* ref:
* - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions
*
* New api:
* - listHeight
* - listItemHeight
* - component
*
* Remove deprecated api:
* - multiple
* - tags
* - combobox
* - firstActiveValue
* - dropdownMenuStyle
* - openClassName (Not list in api)
*
* Update:
* - `backfill` only support `combobox` mode
* - `combobox` mode not support `labelInValue` since it's meaningless
* - `getInputElement` only support `combobox` mode
* - `onChange` return OptionData instead of ReactNode
* - `filterOption` `onChange` `onSelect` accept OptionData instead of ReactNode
* - `combobox` mode trigger `onChange` will get `undefined` if no `value` match in Option
* - `combobox` mode not support `optionLabelProp`
*/
const OMIT_DOM_PROPS = ['inputValue'];
function isRawValue(value) {
return !value || typeof value !== 'object';
}
const Select = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
id,
mode,
prefixCls = 'rc-select',
backfill,
fieldNames,
// Search
showSearch,
searchValue: legacySearchValue,
onSearch: legacyOnSearch,
autoClearSearchValue: legacyAutoClearSearchValue,
filterOption: legacyFilterOption,
optionFilterProp: legacyOptionFilterProp,
filterSort: legacyFilterSort,
// Select
onSelect,
onDeselect,
onActive,
popupMatchSelectWidth = true,
optionLabelProp,
options,
optionRender,
children,
defaultActiveFirstOption,
menuItemSelectedIcon,
virtual,
direction,
listHeight = 200,
listItemHeight = 20,
labelRender,
// Value
value,
defaultValue,
labelInValue,
onChange,
maxCount,
classNames,
styles,
...restProps
} = props;
const searchProps = {
searchValue: legacySearchValue,
onSearch: legacyOnSearch,
autoClearSearchValue: legacyAutoClearSearchValue,
filterOption: legacyFilterOption,
optionFilterProp: legacyOptionFilterProp,
filterSort: legacyFilterSort
};
const [mergedShowSearch, searchConfig] = useSearchConfig(showSearch, searchProps, mode);
const {
filterOption,
searchValue,
optionFilterProp,
filterSort,
onSearch,
autoClearSearchValue = true
} = searchConfig;
const normalizedOptionFilterProp = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!optionFilterProp) return [];
return Array.isArray(optionFilterProp) ? optionFilterProp : [optionFilterProp];
}, [optionFilterProp]);
const mergedId = useId(id);
const multiple = isMultiple(mode);
const childrenAsData = !!(!options && children);
const mergedFilterOption = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (filterOption === undefined && mode === 'combobox') {
return false;
}
return filterOption;
}, [filterOption, mode]);
// ========================= FieldNames =========================
const mergedFieldNames = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => fillFieldNames(fieldNames, childrenAsData), /* eslint-disable react-hooks/exhaustive-deps */
[
// We stringify fieldNames to avoid unnecessary re-renders.
JSON.stringify(fieldNames), childrenAsData]
/* eslint-enable react-hooks/exhaustive-deps */);
// =========================== Search ===========================
const [internalSearchValue, setSearchValue] = (0,useControlledState["default"])('', searchValue);
const mergedSearchValue = internalSearchValue || '';
// =========================== Option ===========================
const parsedOptions = hooks_useOptions(options, children, mergedFieldNames, normalizedOptionFilterProp, optionLabelProp);
const {
valueOptions,
labelOptions,
options: mergedOptions
} = parsedOptions;
// ========================= Wrap Value =========================
const convert2LabelValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(draftValues => {
// Convert to array
const valueList = commonUtil_toArray(draftValues);
// Convert to labelInValue type
return valueList.map(val => {
let rawValue;
let rawLabel;
let rawDisabled;
let rawTitle;
// Fill label & value
if (isRawValue(val)) {
rawValue = val;
} else {
rawLabel = val.label;
rawValue = val.value;
}
const option = valueOptions.get(rawValue);
if (option) {
// Fill missing props
if (rawLabel === undefined) rawLabel = option?.[optionLabelProp || mergedFieldNames.label];
rawDisabled = option?.disabled;
rawTitle = option?.title;
// Warning if label not same as provided
if ( true && !optionLabelProp) {
const optionLabel = option?.[mergedFieldNames.label];
if (optionLabel !== undefined && ! /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(optionLabel) && ! /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(rawLabel) && optionLabel !== rawLabel) {
(0,warning["default"])(false, '`label` of `value` is not same as `label` in Select options.');
}
}
}
return {
label: rawLabel,
value: rawValue,
key: rawValue,
disabled: rawDisabled,
title: rawTitle
};
});
}, [mergedFieldNames, optionLabelProp, valueOptions]);
// =========================== Values ===========================
const [internalValue, setInternalValue] = (0,useControlledState["default"])(defaultValue, value);
// Merged value with LabelValueType
const rawLabeledValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const newInternalValue = multiple && internalValue === null ? [] : internalValue;
const values = convert2LabelValues(newInternalValue);
// combobox no need save value when it's no value (exclude value equal 0)
if (mode === 'combobox' && isComboNoValue(values[0]?.value)) {
return [];
}
return values;
}, [internalValue, convert2LabelValues, mode, multiple]);
// Fill label with cache to avoid option remove
const [mergedValues, getMixedOption] = useCache(rawLabeledValues, valueOptions);
const displayValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
// `null` need show as placeholder instead
// https://github.com/ant-design/ant-design/issues/25057
if (!mode && mergedValues.length === 1) {
const firstValue = mergedValues[0];
if (firstValue.value === null && (firstValue.label === null || firstValue.label === undefined)) {
return [];
}
}
return mergedValues.map(item => ({
...item,
label: (typeof labelRender === 'function' ? labelRender(item) : item.label) ?? item.value
}));
}, [mode, mergedValues, labelRender]);
/** Convert `displayValues` to raw value type set */
const rawValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => new Set(mergedValues.map(val => val.value)), [mergedValues]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (mode === 'combobox') {
const strValue = mergedValues[0]?.value;
setSearchValue(hasValue(strValue) ? String(strValue) : '');
}
}, [mergedValues]);
// ======================= Display Option =======================
// Create a placeholder item if not exist in `options`
const createTagOption = useRefFunc((val, label) => {
const mergedLabel = label ?? val;
return {
[mergedFieldNames.value]: val,
[mergedFieldNames.label]: mergedLabel
};
});
// Fill tag as option if mode is `tags`
const filledTagOptions = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (mode !== 'tags') {
return mergedOptions;
}
// >>> Tag mode
const cloneOptions = [...mergedOptions];
// Check if value exist in options (include new patch item)
const existOptions = val => valueOptions.has(val);
// Fill current value as option
[...mergedValues].sort((a, b) => a.value < b.value ? -1 : 1).forEach(item => {
const val = item.value;
if (!existOptions(val)) {
cloneOptions.push(createTagOption(val, item.label));
}
});
return cloneOptions;
}, [createTagOption, mergedOptions, valueOptions, mergedValues, mode]);
const filteredOptions = useFilterOptions(filledTagOptions, mergedFieldNames, mergedSearchValue, mergedFilterOption, normalizedOptionFilterProp);
// Fill options with search value if needed
const filledSearchOptions = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const hasItemMatchingSearch = item => {
if (normalizedOptionFilterProp.length) {
return normalizedOptionFilterProp.some(prop => item?.[prop] === mergedSearchValue);
}
return item?.value === mergedSearchValue;
};
if (mode !== 'tags' || !mergedSearchValue || filteredOptions.some(item => hasItemMatchingSearch(item))) {
return filteredOptions;
}
// ignore when search value equal select input value
if (filteredOptions.some(item => item[mergedFieldNames.value] === mergedSearchValue)) {
return filteredOptions;
}
// Fill search value as option
return [createTagOption(mergedSearchValue), ...filteredOptions];
}, [createTagOption, normalizedOptionFilterProp, mode, filteredOptions, mergedSearchValue, mergedFieldNames]);
const sorter = inputOptions => {
const sortedOptions = [...inputOptions].sort((a, b) => filterSort(a, b, {
searchValue: mergedSearchValue
}));
return sortedOptions.map(item => {
if (Array.isArray(item.options)) {
return {
...item,
options: item.options.length > 0 ? sorter(item.options) : item.options
};
}
return item;
});
};
const orderedFilteredOptions = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!filterSort) {
return filledSearchOptions;
}
return sorter(filledSearchOptions);
}, [filledSearchOptions, filterSort, mergedSearchValue]);
const displayOptions = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => flattenOptions(orderedFilteredOptions, {
fieldNames: mergedFieldNames,
childrenAsData
}), [orderedFilteredOptions, mergedFieldNames, childrenAsData]);
// =========================== Change ===========================
const triggerChange = values => {
const labeledValues = convert2LabelValues(values);
setInternalValue(labeledValues);
if (onChange && (
// Trigger event only when value changed
labeledValues.length !== mergedValues.length || labeledValues.some((newVal, index) => mergedValues[index]?.value !== newVal?.value))) {
const returnValues = labelInValue ? labeledValues.map(({
label: l,
value: v
}) => ({
label: l,
value: v
})) : labeledValues.map(v => v.value);
const returnOptions = labeledValues.map(v => injectPropsWithOption(getMixedOption(v.value)));
onChange(
// Value
multiple ? returnValues : returnValues[0],
// Option
multiple ? returnOptions : returnOptions[0]);
}
};
// ======================= Accessibility ========================
const [activeValue, setActiveValue] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
const [accessibilityIndex, setAccessibilityIndex] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const mergedDefaultActiveFirstOption = defaultActiveFirstOption !== undefined ? defaultActiveFirstOption : mode !== 'combobox';
const activeEventRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
const onActiveValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback((active, index, {
source = 'keyboard'
} = {}) => {
setAccessibilityIndex(index);
if (backfill && mode === 'combobox' && active !== null && source === 'keyboard') {
setActiveValue(String(active));
}
// Active will call multiple times.
// We only need trigger the last one.
const promise = Promise.resolve().then(() => {
if (activeEventRef.current === promise) {
onActive?.(active);
}
});
activeEventRef.current = promise;
}, [backfill, mode, onActive]);
// ========================= OptionList =========================
const triggerSelect = (val, selected, type) => {
const getSelectEnt = () => {
const option = getMixedOption(val);
return [labelInValue ? {
label: option?.[mergedFieldNames.label],
value: val
} : val, injectPropsWithOption(option)];
};
if (selected && onSelect) {
const [wrappedValue, option] = getSelectEnt();
onSelect(wrappedValue, option);
} else if (!selected && onDeselect && type !== 'clear') {
const [wrappedValue, option] = getSelectEnt();
onDeselect(wrappedValue, option);
}
};
// Used for OptionList selection
const onInternalSelect = useRefFunc((val, info) => {
let cloneValues;
// Single mode always trigger select only with option list
const mergedSelect = multiple ? info.selected : true;
if (mergedSelect) {
cloneValues = multiple ? [...mergedValues, val] : [val];
} else {
cloneValues = mergedValues.filter(v => v.value !== val);
}
triggerChange(cloneValues);
triggerSelect(val, mergedSelect);
// Clean search value if single or configured
if (mode === 'combobox') {
setActiveValue('');
} else if (!isMultiple || autoClearSearchValue) {
setSearchValue('');
setActiveValue('');
}
});
// ======================= Display Change =======================
// BaseSelect display values change
const onDisplayValuesChange = (nextValues, info) => {
triggerChange(nextValues);
const {
type,
values
} = info;
if (type === 'remove' || type === 'clear') {
values.forEach(item => {
triggerSelect(item.value, false, type);
});
}
};
// =========================== Search ===========================
const onInternalSearch = (searchText, info) => {
setSearchValue(searchText);
setActiveValue(null);
// [Submit] Tag mode should flush input
if (info.source === 'submit') {
const formatted = (searchText || '').trim();
// prevent empty tags from appearing when you click the Enter button
if (formatted) {
const newRawValues = Array.from(new Set([...rawValues, formatted]));
triggerChange(newRawValues);
triggerSelect(formatted, true);
setSearchValue('');
}
return;
}
if (info.source !== 'blur') {
if (mode === 'combobox') {
triggerChange(searchText);
}
onSearch?.(searchText);
}
};
const onInternalSearchSplit = words => {
let patchValues = words;
if (mode !== 'tags') {
patchValues = words.map(word => {
const opt = labelOptions.get(word);
return opt?.value;
}).filter(val => val !== undefined);
}
const newRawValues = Array.from(new Set([...rawValues, ...patchValues]));
triggerChange(newRawValues);
newRawValues.forEach(newRawValue => {
triggerSelect(newRawValue, true);
});
};
// ========================== Context ===========================
const selectContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const realVirtual = virtual !== false && popupMatchSelectWidth !== false;
return {
...parsedOptions,
flattenOptions: displayOptions,
onActiveValue,
defaultActiveFirstOption: mergedDefaultActiveFirstOption,
onSelect: onInternalSelect,
menuItemSelectedIcon,
rawValues,
fieldNames: mergedFieldNames,
virtual: realVirtual,
direction,
listHeight,
listItemHeight,
childrenAsData,
maxCount,
optionRender,
classNames,
styles
};
}, [maxCount, parsedOptions, displayOptions, onActiveValue, mergedDefaultActiveFirstOption, onInternalSelect, menuItemSelectedIcon, rawValues, mergedFieldNames, virtual, popupMatchSelectWidth, direction, listHeight, listItemHeight, childrenAsData, optionRender, classNames, styles]);
// ========================== Warning ===========================
if (true) {
warningPropsUtil(props);
warningNullOptions(mergedOptions, mergedFieldNames);
}
// ==============================================================
// == Render ==
// ==============================================================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_SelectContext.Provider, {
value: selectContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_BaseSelect, Select_extends({}, restProps, {
// >>> MISC
id: mergedId,
prefixCls: prefixCls,
ref: ref,
omitDomProps: OMIT_DOM_PROPS,
mode: mode
// >>> Style
,
classNames: classNames,
styles: styles
// >>> Values
,
displayValues: displayValues,
onDisplayValuesChange: onDisplayValuesChange,
maxCount: maxCount
// >>> Trigger
,
direction: direction
// >>> Search
,
showSearch: mergedShowSearch,
searchValue: mergedSearchValue,
onSearch: onInternalSearch,
autoClearSearchValue: autoClearSearchValue,
onSearchSplit: onInternalSearchSplit,
popupMatchSelectWidth: popupMatchSelectWidth
// >>> OptionList
,
OptionList: es_OptionList,
emptyOptions: !displayOptions.length
// >>> Accessibility
,
activeValue: activeValue,
activeDescendantId: `${mergedId}_list_${accessibilityIndex}`
})));
});
if (true) {
Select.displayName = 'Select';
}
const TypedSelect = Select;
TypedSelect.Option = es_Option;
TypedSelect.OptGroup = es_OptGroup;
/* harmony default export */ var es_Select = (TypedSelect);
;// ./node_modules/@rc-component/select/es/index.js
/* harmony default export */ var select_es = (es_Select);
;// ./components/_util/statusUtils.ts
const _InputStatuses = ['warning', 'error', '', 'success', 'validating'];
const getStatusClassNames = (prefixCls, status, hasFeedback) => {
return (0,clsx.clsx)({
[`${prefixCls}-status-success`]: status === 'success',
[`${prefixCls}-status-warning`]: status === 'warning',
[`${prefixCls}-status-error`]: status === 'error',
[`${prefixCls}-status-validating`]: status === 'validating',
[`${prefixCls}-has-feedback`]: hasFeedback
});
};
const getMergedStatus = (contextStatus, customStatus) => customStatus || contextStatus;
// EXTERNAL MODULE: ./node_modules/@ant-design/fast-color/es/index.js + 3 modules
var fast_color_es = __webpack_require__("./node_modules/@ant-design/fast-color/es/index.js");
;// ./components/empty/empty.tsx
const Empty = () => {
const [, token] = (0,useToken["default"])();
const [locale] = (0,useLocale["default"])('Empty');
const bgColor = new fast_color_es.FastColor(token.colorBgBase);
// Dark Theme need more dark of this
const themeStyle = bgColor.toHsl().l < 0.5 ? {
opacity: 0.65
} : {};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("svg", {
style: themeStyle,
width: "184",
height: "152",
viewBox: "0 0 184 152",
xmlns: "http://www.w3.org/2000/svg"
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("title", null, locale?.description || 'Empty'), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("g", {
fill: "none",
fillRule: "evenodd"
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("g", {
transform: "translate(24 31.7)"
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("ellipse", {
fillOpacity: ".8",
fill: "#F5F5F7",
cx: "67.8",
cy: "106.9",
rx: "67.8",
ry: "12.7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#aeb8c2",
d: "M122 69.7 98.1 40.2a6 6 0 0 0-4.6-2.2H42.1a6 6 0 0 0-4.6 2.2l-24 29.5V85H122z"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#f5f5f7",
d: "M33.8 0h68a4 4 0 0 1 4 4v93.3a4 4 0 0 1-4 4h-68a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#dce0e6",
d: "M42.7 10h50.2a2 2 0 0 1 2 2v25a2 2 0 0 1-2 2H42.7a2 2 0 0 1-2-2V12a2 2 0 0 1 2-2m.2 39.8h49.8a2.3 2.3 0 1 1 0 4.5H42.9a2.3 2.3 0 0 1 0-4.5m0 11.7h49.8a2.3 2.3 0 1 1 0 4.6H42.9a2.3 2.3 0 0 1 0-4.6m79 43.5a7 7 0 0 1-6.8 5.4H20.5a7 7 0 0 1-6.7-5.4l-.2-1.8V69.7h26.3c2.9 0 5.2 2.4 5.2 5.4s2.4 5.4 5.3 5.4h34.8c2.9 0 5.3-2.4 5.3-5.4s2.3-5.4 5.2-5.4H122v33.5q0 1-.2 1.8"
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#dce0e6",
d: "m149.1 33.3-6.8 2.6a1 1 0 0 1-1.3-1.2l2-6.2q-4.1-4.5-4.2-10.4c0-10 10.1-18.1 22.6-18.1S184 8.1 184 18.1s-10.1 18-22.6 18q-6.8 0-12.3-2.8"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("g", {
fill: "#fff",
transform: "translate(149.7 15.4)"
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("circle", {
cx: "20.7",
cy: "3.2",
r: "2.8"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
d: "M5.7 5.6H0L2.9.7zM9.3.7h5v5h-5z"
}))));
};
if (true) {
Empty.displayName = 'EmptyImage';
}
/* harmony default export */ var empty = (Empty);
;// ./components/empty/simple.tsx
const Simple = () => {
const [, token] = (0,useToken["default"])();
const [locale] = (0,useLocale["default"])('Empty');
const {
colorFill,
colorFillTertiary,
colorFillQuaternary,
colorBgContainer
} = token;
const {
borderColor,
shadowColor,
contentColor
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => ({
borderColor: new fast_color_es.FastColor(colorFill).onBackground(colorBgContainer).toHexString(),
shadowColor: new fast_color_es.FastColor(colorFillTertiary).onBackground(colorBgContainer).toHexString(),
contentColor: new fast_color_es.FastColor(colorFillQuaternary).onBackground(colorBgContainer).toHexString()
}), [colorFill, colorFillTertiary, colorFillQuaternary, colorBgContainer]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("svg", {
width: "64",
height: "41",
viewBox: "0 0 64 41",
xmlns: "http://www.w3.org/2000/svg"
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("title", null, locale?.description || 'Empty'), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("g", {
transform: "translate(0 1)",
fill: "none",
fillRule: "evenodd"
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("ellipse", {
fill: shadowColor,
cx: "32",
cy: "33",
rx: "32",
ry: "7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("g", {
fillRule: "nonzero",
stroke: borderColor
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
d: "M55 12.8 44.9 1.3Q44 0 42.9 0H21.1q-1.2 0-2 1.3L9 12.8V22h46z"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
d: "M41.6 16c0-1.7 1-3 2.2-3H55v18.1c0 2.2-1.3 3.9-3 3.9H12c-1.7 0-3-1.7-3-3.9V13h11.2c1.2 0 2.2 1.3 2.2 3s1 2.9 2.2 2.9h14.8c1.2 0 2.2-1.4 2.2-3",
fill: contentColor
}))));
};
if (true) {
Simple.displayName = 'SimpleImage';
}
/* harmony default export */ var simple = (Simple);
// EXTERNAL MODULE: ./components/empty/style/index.ts
var empty_style = __webpack_require__("./components/empty/style/index.ts");
;// ./components/empty/index.tsx
const defaultEmptyImg = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(empty, null);
const simpleEmptyImg = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(simple, null);
const empty_Empty = props => {
const {
className,
rootClassName,
prefixCls: customizePrefixCls,
image,
description,
children,
imageStyle,
style,
classNames,
styles,
...restProps
} = props;
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles,
image: contextImage
} = (0,config_provider_context.useComponentConfig)('empty');
const prefixCls = getPrefixCls('empty', customizePrefixCls);
const [hashId, cssVarCls] = (0,empty_style["default"])(prefixCls);
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props
});
const [locale] = (0,useLocale["default"])('Empty');
const des = typeof description !== 'undefined' ? description : locale?.description;
const alt = typeof des === 'string' ? des : 'empty';
const mergedImage = image ?? contextImage ?? defaultEmptyImg;
let imageNode = null;
if (typeof mergedImage === 'string') {
imageNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("img", {
draggable: false,
alt: alt,
src: mergedImage
});
} else {
imageNode = mergedImage;
}
// ============================= Warning ==============================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Empty');
[['imageStyle', 'styles.image']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(hashId, cssVarCls, prefixCls, contextClassName, {
[`${prefixCls}-normal`]: mergedImage === simpleEmptyImg,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, rootClassName, mergedClassNames.root),
style: {
...mergedStyles.root,
...contextStyle,
...style
},
...restProps
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-image`, mergedClassNames.image),
style: {
...imageStyle,
...mergedStyles.image
}
}, imageNode), des && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-description`, mergedClassNames.description),
style: mergedStyles.description
}, des)), children && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-footer`, mergedClassNames.footer),
style: mergedStyles.footer
}, children)));
};
empty_Empty.PRESENTED_IMAGE_DEFAULT = defaultEmptyImg;
empty_Empty.PRESENTED_IMAGE_SIMPLE = simpleEmptyImg;
if (true) {
empty_Empty.displayName = 'Empty';
}
/* harmony default export */ var components_empty = (empty_Empty);
;// ./components/config-provider/defaultRenderEmpty.tsx
const DefaultRenderEmpty = props => {
const {
componentName
} = props;
const {
getPrefixCls
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(config_provider_context.ConfigContext);
const prefix = getPrefixCls('empty');
switch (componentName) {
case 'Table':
case 'List':
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_empty, {
image: components_empty.PRESENTED_IMAGE_SIMPLE
});
case 'Select':
case 'TreeSelect':
case 'Cascader':
case 'Transfer':
case 'Mentions':
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_empty, {
image: components_empty.PRESENTED_IMAGE_SIMPLE,
className: `${prefix}-small`
});
/**
* This type of component should satisfy the nullish coalescing operator(??) on the left-hand side.
* to let the component itself implement the logic.
* For example `Table.filter`.
*/
case 'Table.filter':
// why `null`? legacy react16 node type `undefined` is not allowed.
return null;
default:
// Should never hit if we take all the component into consider.
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_empty, null);
}
};
/* harmony default export */ var defaultRenderEmpty = (DefaultRenderEmpty);
;// ./components/form/hooks/useVariants.ts
/**
* Compatible for legacy `bordered` prop.
*/
const useVariant = (component, variant, legacyBordered) => {
const {
variant: configVariant,
[component]: componentConfig
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const ctxVariant = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(VariantContext);
const configComponentVariant = componentConfig?.variant;
let mergedVariant;
if (typeof variant !== 'undefined') {
mergedVariant = variant;
} else if (legacyBordered === false) {
mergedVariant = 'borderless';
} else {
// form variant > component global variant > global variant
mergedVariant = ctxVariant ?? configComponentVariant ?? configVariant ?? 'outlined';
}
const enableVariantCls = config_provider_context.Variants.includes(mergedVariant);
return [mergedVariant, enableVariantCls];
};
/* harmony default export */ var useVariants = (useVariant);
;// ./components/select/mergedBuiltinPlacements.ts
const mergedBuiltinPlacements_getBuiltInPlacements = popupOverflow => {
const htmlRegion = popupOverflow === 'scroll' ? 'scroll' : 'visible';
const sharedConfig = {
overflow: {
adjustX: true,
adjustY: true,
shiftY: true
},
htmlRegion,
dynamicInset: true
};
return {
bottomLeft: {
...sharedConfig,
points: ['tl', 'bl'],
offset: [0, 4]
},
bottomRight: {
...sharedConfig,
points: ['tr', 'br'],
offset: [0, 4]
},
topLeft: {
...sharedConfig,
points: ['bl', 'tl'],
offset: [0, -4]
},
topRight: {
...sharedConfig,
points: ['br', 'tr'],
offset: [0, -4]
}
};
};
function mergedBuiltinPlacements(buildInPlacements, popupOverflow) {
return buildInPlacements || mergedBuiltinPlacements_getBuiltInPlacements(popupOverflow);
}
/* harmony default export */ var select_mergedBuiltinPlacements = (mergedBuiltinPlacements);
// EXTERNAL MODULE: ./components/select/style/index.ts + 5 modules
var select_style = __webpack_require__("./components/select/style/index.ts");
;// ./node_modules/@ant-design/icons-svg/es/asn/CheckOutlined.js
// This icon file is generated automatically.
var CheckOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z" } }] }, "name": "check", "theme": "outlined" };
/* harmony default export */ var asn_CheckOutlined = (CheckOutlined);
;// ./node_modules/@ant-design/icons/es/icons/CheckOutlined.js
function CheckOutlined_extends() { CheckOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return CheckOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const CheckOutlined_CheckOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], CheckOutlined_extends({}, props, {
ref: ref,
icon: asn_CheckOutlined
}));
/** */
const CheckOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(CheckOutlined_CheckOutlined);
if (true) {
CheckOutlined_RefIcon.displayName = 'CheckOutlined';
}
/* harmony default export */ var icons_CheckOutlined = (CheckOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/DownOutlined.js
// This icon file is generated automatically.
var DownOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" } }] }, "name": "down", "theme": "outlined" };
/* harmony default export */ var asn_DownOutlined = (DownOutlined);
;// ./node_modules/@ant-design/icons/es/icons/DownOutlined.js
function DownOutlined_extends() { DownOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return DownOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const DownOutlined_DownOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], DownOutlined_extends({}, props, {
ref: ref,
icon: asn_DownOutlined
}));
/** */
const DownOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(DownOutlined_DownOutlined);
if (true) {
DownOutlined_RefIcon.displayName = 'DownOutlined';
}
/* harmony default export */ var icons_DownOutlined = (DownOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/SearchOutlined.js
// This icon file is generated automatically.
var SearchOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z" } }] }, "name": "search", "theme": "outlined" };
/* harmony default export */ var asn_SearchOutlined = (SearchOutlined);
;// ./node_modules/@ant-design/icons/es/icons/SearchOutlined.js
function SearchOutlined_extends() { SearchOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return SearchOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const SearchOutlined_SearchOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], SearchOutlined_extends({}, props, {
ref: ref,
icon: asn_SearchOutlined
}));
/** */
const SearchOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(SearchOutlined_SearchOutlined);
if (true) {
SearchOutlined_RefIcon.displayName = 'SearchOutlined';
}
/* harmony default export */ var icons_SearchOutlined = (SearchOutlined_RefIcon);
;// ./components/select/useIcons.tsx
function useIcons({
suffixIcon,
clearIcon,
menuItemSelectedIcon,
removeIcon,
loading,
loadingIcon,
multiple,
hasFeedback,
showSuffixIcon,
feedbackIcon,
showArrow,
componentName
}) {
if (true) {
const warning = (0,_util_warning.devUseWarning)(componentName);
warning.deprecated(!clearIcon, 'clearIcon', 'allowClear={{ clearIcon: React.ReactNode }}');
}
// Clear Icon
const mergedClearIcon = clearIcon ?? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CloseCircleFilled, null);
// Validation Feedback Icon
const getSuffixIconNode = arrowIcon => {
if (suffixIcon === null && !hasFeedback && !showArrow) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, showSuffixIcon !== false && arrowIcon, hasFeedback && feedbackIcon);
};
// Arrow item icon
let mergedSuffixIcon = null;
if (suffixIcon !== undefined) {
mergedSuffixIcon = getSuffixIconNode(suffixIcon);
} else if (loading) {
mergedSuffixIcon = getSuffixIconNode(loadingIcon ?? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LoadingOutlined, {
spin: true
}));
} else {
mergedSuffixIcon = ({
open,
showSearch
}) => {
if (open && showSearch) {
return getSuffixIconNode(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_SearchOutlined, null));
}
return getSuffixIconNode(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_DownOutlined, null));
};
}
// Checked item icon
let mergedItemIcon = null;
if (menuItemSelectedIcon !== undefined) {
mergedItemIcon = menuItemSelectedIcon;
} else if (multiple) {
mergedItemIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CheckOutlined, null);
} else {
mergedItemIcon = null;
}
let mergedRemoveIcon = null;
if (removeIcon !== undefined) {
mergedRemoveIcon = removeIcon;
} else {
mergedRemoveIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CloseOutlined, null);
}
return {
// TODO: remove as when all the deps bumped
clearIcon: mergedClearIcon,
suffixIcon: mergedSuffixIcon,
itemIcon: mergedItemIcon,
removeIcon: mergedRemoveIcon
};
}
;// ./components/select/usePopupRender.tsx
function usePopupRender(renderFn) {
return external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
if (!renderFn) {
return undefined;
}
return (...args) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(_util_ContextIsolator, {
space: true
}, renderFn.apply(void 0, args));
}, [renderFn]);
}
/* harmony default export */ var select_usePopupRender = (usePopupRender);
;// ./components/select/useShowArrow.ts
/**
* Since Select, TreeSelect, Cascader is same Select like component.
* We just use same hook to handle this logic.
*
* If `suffixIcon` is not equal to `null`, always show it.
*/
function useShowArrow(suffixIcon, showArrow) {
return showArrow !== undefined ? showArrow : suffixIcon !== null;
}
;// ./components/select/index.tsx
// TODO: 4.0 - codemod should help to change `filterOption` to support node props.
const SECRET_COMBOBOX_MODE_DO_NOT_USE = 'SECRET_COMBOBOX_MODE_DO_NOT_USE';
const InternalSelect = (props, ref) => {
const {
prefixCls: customizePrefixCls,
bordered,
className,
rootClassName,
getPopupContainer,
popupClassName,
dropdownClassName,
listHeight = 256,
placement,
listItemHeight: customListItemHeight,
size: customizeSize,
disabled: customDisabled,
notFoundContent,
status: customStatus,
builtinPlacements,
dropdownMatchSelectWidth,
popupMatchSelectWidth,
direction: propDirection,
style,
allowClear,
variant: customizeVariant,
popupStyle,
dropdownStyle,
transitionName,
tagRender,
maxCount,
prefix,
dropdownRender,
/**
* @since 5.25.0
*/
popupRender,
onDropdownVisibleChange,
onOpenChange,
styles,
classNames,
...rest
} = props;
const {
getPopupContainer: getContextPopupContainer,
getPrefixCls,
renderEmpty,
direction: contextDirection,
virtual,
popupMatchSelectWidth: contextPopupMatchSelectWidth,
popupOverflow
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const {
showSearch,
style: contextStyle,
styles: contextStyles,
className: contextClassName,
classNames: contextClassNames
} = (0,config_provider_context.useComponentConfig)('select');
const [, token] = (0,useToken["default"])();
const listItemHeight = customListItemHeight ?? token?.controlHeight;
const prefixCls = getPrefixCls('select', customizePrefixCls);
const rootPrefixCls = getPrefixCls();
const direction = propDirection ?? contextDirection;
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
const [variant, enableVariantCls] = useVariants('select', customizeVariant, bordered);
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,select_style["default"])(prefixCls, rootCls);
const mode = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const {
mode: m
} = props;
if (m === 'combobox') {
return undefined;
}
if (m === SECRET_COMBOBOX_MODE_DO_NOT_USE) {
return 'combobox';
}
return m;
}, [props.mode]);
const isMultiple = mode === 'multiple' || mode === 'tags';
const showSuffixIcon = useShowArrow(props.suffixIcon, props.showArrow);
const mergedPopupMatchSelectWidth = popupMatchSelectWidth ?? dropdownMatchSelectWidth ?? contextPopupMatchSelectWidth;
const mergedPopupRender = select_usePopupRender(popupRender || dropdownRender);
const mergedOnOpenChange = onOpenChange || onDropdownVisibleChange;
// ===================== Form Status =====================
const {
status: contextStatus,
hasFeedback,
isFormItemInput,
feedbackIcon
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FormItemInputContext);
const mergedStatus = getMergedStatus(contextStatus, customStatus);
// ===================== Empty =====================
let mergedNotFound;
if (notFoundContent !== undefined) {
mergedNotFound = notFoundContent;
} else if (mode === 'combobox') {
mergedNotFound = null;
} else {
mergedNotFound = renderEmpty?.('Select') || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(defaultRenderEmpty, {
componentName: "Select"
});
}
// ===================== Icons =====================
const {
suffixIcon,
itemIcon,
removeIcon,
clearIcon
} = useIcons({
...rest,
multiple: isMultiple,
hasFeedback,
feedbackIcon,
showSuffixIcon,
prefixCls,
componentName: 'Select'
});
const mergedAllowClear = allowClear === true ? {
clearIcon
} : allowClear;
const selectProps = (0,es.omit)(rest, ['suffixIcon', 'itemIcon']);
const mergedSize = (0,useSize["default"])(ctx => customizeSize ?? compactSize ?? ctx);
// ===================== Disabled =====================
const disabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
const mergedDisabled = customDisabled ?? disabled;
// ========== Merged Props for Semantic ==================
const mergedProps = {
...props,
variant,
status: mergedStatus,
disabled: mergedDisabled,
size: mergedSize
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
}, {
popup: {
_default: 'root'
}
});
const mergedPopupClassName = (0,clsx.clsx)(mergedClassNames.popup?.root, popupClassName, dropdownClassName, {
[`${prefixCls}-dropdown-${direction}`]: direction === 'rtl'
}, rootClassName, cssVarCls, rootCls, hashId);
const mergedPopupStyle = {
...mergedStyles.popup?.root,
...(popupStyle ?? dropdownStyle)
};
const mergedClassName = (0,clsx.clsx)({
[`${prefixCls}-lg`]: mergedSize === 'large',
[`${prefixCls}-sm`]: mergedSize === 'small',
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-${variant}`]: enableVariantCls,
[`${prefixCls}-in-form-item`]: isFormItemInput
}, getStatusClassNames(prefixCls, mergedStatus, hasFeedback), compactItemClassnames, contextClassName, className, mergedClassNames.root, rootClassName, cssVarCls, rootCls, hashId);
// ===================== Placement =====================
const memoPlacement = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (placement !== undefined) {
return placement;
}
return direction === 'rtl' ? 'bottomRight' : 'bottomLeft';
}, [placement, direction]);
// ====================== Warning ======================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Select');
const deprecatedProps = {
dropdownMatchSelectWidth: 'popupMatchSelectWidth',
dropdownStyle: 'styles.popup.root',
dropdownClassName: 'classNames.popup.root',
popupClassName: 'classNames.popup.root',
dropdownRender: 'popupRender',
onDropdownVisibleChange: 'onOpenChange',
bordered: 'variant'
};
Object.entries(deprecatedProps).forEach(([oldProp, newProp]) => {
warning.deprecated(!(oldProp in props), oldProp, newProp);
});
true ? warning(!('showArrow' in props), 'deprecated', '`showArrow` is deprecated which will be removed in next major version. It will be a default behavior, you can hide it by setting `suffixIcon` to null.') : 0;
true ? warning(!(typeof maxCount !== 'undefined' && !isMultiple), 'usage', '`maxCount` only works with mode `multiple` or `tags`') : 0;
}
// ====================== zIndex =========================
const [zIndex] = (0,useZIndex.useZIndex)('SelectLike', mergedStyles.popup?.root?.zIndex ?? mergedPopupStyle?.zIndex);
// ====================== Render =======================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(select_es, {
ref: ref,
virtual: virtual,
classNames: mergedClassNames,
styles: mergedStyles,
showSearch: showSearch,
...selectProps,
style: {
...mergedStyles.root,
...contextStyle,
...style
},
popupMatchSelectWidth: mergedPopupMatchSelectWidth,
transitionName: (0,_util_motion.getTransitionName)(rootPrefixCls, 'slide-up', transitionName),
builtinPlacements: select_mergedBuiltinPlacements(builtinPlacements, popupOverflow),
listHeight: listHeight,
listItemHeight: listItemHeight,
mode: mode,
prefixCls: prefixCls,
placement: memoPlacement,
direction: direction,
prefix: prefix,
suffixIcon: suffixIcon,
menuItemSelectedIcon: itemIcon,
removeIcon: removeIcon,
allowClear: mergedAllowClear,
notFoundContent: mergedNotFound,
className: mergedClassName,
getPopupContainer: getPopupContainer || getContextPopupContainer,
popupClassName: mergedPopupClassName,
disabled: mergedDisabled,
popupStyle: {
...mergedStyles.popup?.root,
...mergedPopupStyle,
zIndex
},
maxCount: isMultiple ? maxCount : undefined,
tagRender: isMultiple ? tagRender : undefined,
popupRender: mergedPopupRender,
onPopupVisibleChange: mergedOnOpenChange
});
};
if (true) {
InternalSelect.displayName = 'Select';
}
const select_Select = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(InternalSelect);
// We don't care debug panel
/* istanbul ignore next */
const select_PurePanel = _util_PurePanel(select_Select, 'popupAlign');
select_Select.SECRET_COMBOBOX_MODE_DO_NOT_USE = SECRET_COMBOBOX_MODE_DO_NOT_USE;
select_Select.Option = es_Option;
select_Select.OptGroup = es_OptGroup;
select_Select._InternalPanelDoNotUseOrYouWillBeFired = select_PurePanel;
if (true) {
select_Select.displayName = 'Select';
}
/* harmony default export */ var components_select = (select_Select);
;// ./components/auto-complete/AutoComplete.tsx
const {
Option: AutoComplete_Option
} = components_select;
function isSelectOptionOrSelectOptGroup(child) {
return child?.type && (child.type.isSelectOption || child.type.isSelectOptGroup);
}
const AutoComplete = (props, ref) => {
const {
prefixCls: customizePrefixCls,
className,
style,
popupClassName,
dropdownClassName,
children,
dataSource,
rootClassName,
dropdownStyle,
dropdownRender,
popupRender,
onDropdownVisibleChange,
onOpenChange,
styles,
classNames,
popupMatchSelectWidth,
dropdownMatchSelectWidth
} = props;
const childNodes = (0,es.toArray)(children);
const mergedPopupRender = popupRender || dropdownRender;
const mergedOnOpenChange = onOpenChange || onDropdownVisibleChange;
const mergedPopupMatchSelectWidth = popupMatchSelectWidth ?? dropdownMatchSelectWidth;
// ============================= Input =============================
let customizeInput;
if (childNodes.length === 1 && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(childNodes[0]) && !isSelectOptionOrSelectOptGroup(childNodes[0])) {
[customizeInput] = childNodes;
}
const getInputElement = customizeInput ? () => customizeInput : undefined;
// ============================ Options ============================
let optionChildren;
// [Legacy] convert `children` or `dataSource` into option children
if (childNodes.length && isSelectOptionOrSelectOptGroup(childNodes[0])) {
optionChildren = children;
} else {
optionChildren = dataSource ? dataSource.map(item => {
if (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(item)) {
return item;
}
switch (typeof item) {
case 'string':
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AutoComplete_Option, {
key: item,
value: item
}, item);
case 'object':
{
const {
value: optionValue
} = item;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AutoComplete_Option, {
key: optionValue,
value: optionValue
}, item.text);
}
default:
return undefined;
}
}) : [];
}
// ====================== Warning ======================
if (true) {
const warning = (0,_util_warning.devUseWarning)('AutoComplete');
true ? warning(!customizeInput || !('size' in props), 'usage', 'You need to control style self instead of setting `size` when using customize input.') : 0;
const deprecatedProps = {
dropdownMatchSelectWidth: 'popupMatchSelectWidth',
dropdownStyle: 'styles.popup.root',
dropdownClassName: 'classNames.popup.root',
popupClassName: 'classNames.popup.root',
dropdownRender: 'popupRender',
onDropdownVisibleChange: 'onOpenChange',
dataSource: 'options'
};
Object.entries(deprecatedProps).forEach(([oldProp, newProp]) => {
warning.deprecated(!(oldProp in props), oldProp, newProp);
});
}
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('select', customizePrefixCls);
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
popupRender: mergedPopupRender,
onOpenChange: mergedOnOpenChange,
popupMatchSelectWidth: mergedPopupMatchSelectWidth
};
// ========================= Style ==========================
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([classNames], [styles], {
props: mergedProps
}, {
popup: {
_default: 'root'
}
});
const finalClassNames = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
root: (0,clsx.clsx)(`${prefixCls}-auto-complete`, className, rootClassName, mergedClassNames.root, {
[`${prefixCls}-customize`]: customizeInput
}),
prefix: mergedClassNames.prefix,
input: mergedClassNames.input,
placeholder: mergedClassNames.placeholder,
content: mergedClassNames.content,
popup: {
root: (0,clsx.clsx)(popupClassName, dropdownClassName, mergedClassNames.popup?.root),
list: mergedClassNames.popup?.list,
listItem: mergedClassNames.popup?.listItem
}
}), [prefixCls, className, rootClassName, mergedClassNames, popupClassName, dropdownClassName]);
const finalStyles = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
root: {
...mergedStyles.root,
...style
},
input: mergedStyles.input,
prefix: mergedStyles.prefix,
placeholder: mergedStyles.placeholder,
content: mergedStyles.content,
popup: {
root: {
...dropdownStyle,
...mergedStyles.popup?.root
},
list: mergedStyles.popup?.list,
listItem: mergedStyles.popup?.listItem
}
}), [mergedStyles, style, dropdownStyle]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_select, {
ref: ref,
suffixIcon: null,
...(0,es.omit)(props, ['dataSource', 'dropdownClassName', 'popupClassName']),
prefixCls: prefixCls,
classNames: finalClassNames,
styles: finalStyles,
mode: components_select.SECRET_COMBOBOX_MODE_DO_NOT_USE,
popupRender: mergedPopupRender,
onPopupVisibleChange: mergedOnOpenChange,
popupMatchSelectWidth: mergedPopupMatchSelectWidth,
// Internal api
getInputElement
}, optionChildren);
};
const RefAutoComplete = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(AutoComplete);
if (true) {
RefAutoComplete.displayName = 'AutoComplete';
}
/* harmony default export */ var auto_complete_AutoComplete = (RefAutoComplete);
;// ./components/auto-complete/index.tsx
const {
Option: auto_complete_Option
} = components_select;
// We don't care debug panel
/* istanbul ignore next */
const auto_complete_PurePanel = _util_PurePanel(auto_complete_AutoComplete, 'popupAlign', props => (0,es.omit)(props, ['visible']));
const components_auto_complete_AutoComplete = auto_complete_AutoComplete;
components_auto_complete_AutoComplete.Option = auto_complete_Option;
components_auto_complete_AutoComplete._InternalPanelDoNotUseOrYouWillBeFired = auto_complete_PurePanel;
/* harmony default export */ var auto_complete = (components_auto_complete_AutoComplete);
;// ./components/_util/responsiveObserver.ts
const responsiveArray = ['xxxl', 'xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
const responsiveArrayReversed = [].concat(responsiveArray).reverse();
const getResponsiveMap = token => ({
xs: `(max-width: ${token.screenXSMax}px)`,
sm: `(min-width: ${token.screenSM}px)`,
md: `(min-width: ${token.screenMD}px)`,
lg: `(min-width: ${token.screenLG}px)`,
xl: `(min-width: ${token.screenXL}px)`,
xxl: `(min-width: ${token.screenXXL}px)`,
xxxl: `(min-width: ${token.screenXXXL}px)`
});
/**
* Ensures that the breakpoints token are valid, in good order
* For each breakpoint : screenMin <= screen <= screenMax and screenMax <= nextScreenMin
*/
const validateBreakpoints = token => {
const indexableToken = token;
const revBreakpoints = [].concat(responsiveArray).reverse();
revBreakpoints.forEach((breakpoint, i) => {
const breakpointUpper = breakpoint.toUpperCase();
const screenMin = `screen${breakpointUpper}Min`;
const screen = `screen${breakpointUpper}`;
if (!(indexableToken[screenMin] <= indexableToken[screen])) {
throw new Error(`${screenMin}<=${screen} fails : !(${indexableToken[screenMin]}<=${indexableToken[screen]})`);
}
if (i < revBreakpoints.length - 1) {
const screenMax = `screen${breakpointUpper}Max`;
if (!(indexableToken[screen] <= indexableToken[screenMax])) {
throw new Error(`${screen}<=${screenMax} fails : !(${indexableToken[screen]}<=${indexableToken[screenMax]})`);
}
const nextBreakpointUpperMin = revBreakpoints[i + 1].toUpperCase();
const nextScreenMin = `screen${nextBreakpointUpperMin}Min`;
if (!(indexableToken[screenMax] <= indexableToken[nextScreenMin])) {
throw new Error(`${screenMax}<=${nextScreenMin} fails : !(${indexableToken[screenMax]}<=${indexableToken[nextScreenMin]})`);
}
}
});
return token;
};
const matchScreen = (screens, screenSizes) => {
if (!screenSizes) {
return;
}
for (const breakpoint of responsiveArray) {
if (screens[breakpoint] && screenSizes?.[breakpoint] !== undefined) {
return screenSizes[breakpoint];
}
}
};
const useResponsiveObserver = () => {
const [, token] = (0,useToken["default"])();
const responsiveMap = getResponsiveMap(validateBreakpoints(token));
// To avoid repeat create instance, we add `useMemo` here.
return external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
const subscribers = new Map();
let subUid = -1;
let screens = {};
return {
responsiveMap,
matchHandlers: {},
dispatch(pointMap) {
screens = pointMap;
subscribers.forEach(func => {
func(screens);
});
return subscribers.size >= 1;
},
subscribe(func) {
if (!subscribers.size) {
this.register();
}
subUid += 1;
subscribers.set(subUid, func);
func(screens);
return subUid;
},
unsubscribe(paramToken) {
subscribers.delete(paramToken);
if (!subscribers.size) {
this.unregister();
}
},
register() {
Object.entries(responsiveMap).forEach(([screen, mediaQuery]) => {
const listener = ({
matches
}) => {
this.dispatch({
...screens,
[screen]: matches
});
};
const mql = window.matchMedia(mediaQuery);
if (typeof mql?.addEventListener === 'function') {
mql.addEventListener('change', listener);
}
this.matchHandlers[mediaQuery] = {
mql,
listener
};
listener(mql);
});
},
unregister() {
Object.values(responsiveMap).forEach(mediaQuery => {
const handler = this.matchHandlers[mediaQuery];
if (typeof handler?.mql?.removeEventListener === 'function') {
handler.mql.removeEventListener('change', handler?.listener);
}
});
subscribers.clear();
}
};
}, [responsiveMap]);
};
/* harmony default export */ var _util_responsiveObserver = (useResponsiveObserver);
;// ./components/_util/hooks/useForceUpdate.ts
const useForceUpdate = () => {
return external_root_React_commonjs2_react_commonjs_react_amd_react_default().useReducer(ori => ori + 1, 0);
};
;// ./components/grid/hooks/useBreakpoint.tsx
function useBreakpoint(refreshOnChange = true, defaultScreens = {}) {
const screensRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(defaultScreens);
const [, forceUpdate] = useForceUpdate();
const responsiveObserver = _util_responsiveObserver();
(0,useLayoutEffect["default"])(() => {
const token = responsiveObserver.subscribe(supportScreens => {
screensRef.current = supportScreens;
if (refreshOnChange) {
forceUpdate();
}
});
return () => responsiveObserver.unsubscribe(token);
}, []);
return screensRef.current;
}
/* harmony default export */ var hooks_useBreakpoint = (useBreakpoint);
;// ./components/avatar/AvatarContext.ts
const AvatarContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({});
/* harmony default export */ var avatar_AvatarContext = (AvatarContext);
// EXTERNAL MODULE: ./components/avatar/style/index.ts
var avatar_style = __webpack_require__("./components/avatar/style/index.ts");
;// ./components/avatar/Avatar.tsx
const Avatar_Avatar = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
shape,
size: customSize,
src,
srcSet,
icon,
className,
rootClassName,
style,
alt,
draggable,
children,
crossOrigin,
gap = 4,
onError,
...others
} = props;
const [scale, setScale] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(1);
const [mounted, setMounted] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const [isImgExist, setIsImgExist] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(true);
const avatarNodeRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const avatarChildrenRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const avatarNodeMergedRef = (0,es_ref.composeRef)(ref, avatarNodeRef);
const {
getPrefixCls,
className: contextClassName,
style: contextStyle
} = (0,config_provider_context.useComponentConfig)('avatar');
const avatarCtx = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(avatar_AvatarContext);
const setScaleParam = () => {
if (!avatarChildrenRef.current || !avatarNodeRef.current) {
return;
}
const childrenWidth = avatarChildrenRef.current.offsetWidth; // offsetWidth avoid affecting be transform scale
const nodeWidth = avatarNodeRef.current.offsetWidth;
// denominator is 0 is no meaning
if (childrenWidth !== 0 && nodeWidth !== 0) {
if (gap * 2 < nodeWidth) {
setScale(nodeWidth - gap * 2 < childrenWidth ? (nodeWidth - gap * 2) / childrenWidth : 1);
}
}
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
setMounted(true);
}, []);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
setIsImgExist(true);
setScale(1);
}, [src]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(setScaleParam, [gap]);
const handleImgLoadError = () => {
const errorFlag = onError?.();
if (errorFlag !== false) {
setIsImgExist(false);
}
};
const size = (0,useSize["default"])(ctxSize => customSize ?? avatarCtx?.size ?? ctxSize ?? 'medium');
const needResponsive = Object.keys((0,is.isPlainObject)(size) ? size || {} : {}).some(key => responsiveArray.includes(key));
const screens = hooks_useBreakpoint(needResponsive);
const responsiveSizeStyle = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!(0,is.isPlainObject)(size)) {
return {};
}
const currentBreakpoint = responsiveArray.find(screen => screens[screen]);
const currentSize = size[currentBreakpoint];
return currentSize ? {
width: currentSize,
height: currentSize,
fontSize: currentSize && (icon || children) ? currentSize / 2 : 18
} : {};
}, [screens, size, icon, children]);
if (true) {
const warning = (0,_util_warning.devUseWarning)('Avatar');
true ? warning(!(typeof icon === 'string' && icon.length > 2), 'breaking', `\`icon\` is using ReactNode instead of string naming in v4. Please check \`${icon}\` at https://ant.design/components/icon`) : 0;
}
const prefixCls = getPrefixCls('avatar', customizePrefixCls);
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,avatar_style["default"])(prefixCls, rootCls);
const sizeCls = (0,clsx.clsx)({
[`${prefixCls}-lg`]: size === 'large',
[`${prefixCls}-sm`]: size === 'small'
});
const hasImageElement = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(src);
const mergedShape = shape || avatarCtx?.shape || 'circle';
const classString = (0,clsx.clsx)(prefixCls, sizeCls, contextClassName, `${prefixCls}-${mergedShape}`, {
[`${prefixCls}-image`]: hasImageElement || src && isImgExist,
[`${prefixCls}-icon`]: !!icon
}, cssVarCls, rootCls, className, rootClassName, hashId);
const sizeStyle = (0,is.isNumber)(size) ? {
width: size,
height: size,
fontSize: icon ? size / 2 : 18
} : {};
let childrenToRender;
if (typeof src === 'string' && isImgExist) {
childrenToRender = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("img", {
src: src,
draggable: draggable,
srcSet: srcSet,
onError: handleImgLoadError,
alt: alt,
crossOrigin: crossOrigin
});
} else if (hasImageElement) {
childrenToRender = src;
} else if (icon) {
childrenToRender = icon;
} else if (mounted || scale !== 1) {
const transformString = `scale(${scale})`;
const childrenStyle = {
msTransform: transformString,
WebkitTransform: transformString,
transform: transformString
};
childrenToRender = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(resize_observer_es, {
onResize: setScaleParam
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-string`,
ref: avatarChildrenRef,
style: childrenStyle
}, children));
} else {
childrenToRender = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-string`,
style: {
opacity: 0
},
ref: avatarChildrenRef
}, children);
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
...others,
style: {
...sizeStyle,
...responsiveSizeStyle,
...contextStyle,
...style
},
className: classString,
ref: avatarNodeMergedRef
}, childrenToRender);
});
if (true) {
Avatar_Avatar.displayName = 'Avatar';
}
/* harmony default export */ var avatar_Avatar = (Avatar_Avatar);
;// ./components/_util/getRenderPropValue.ts
const getRenderPropValue = propValue => {
if (!propValue) {
return null;
}
return typeof propValue === 'function' ? propValue() : propValue;
};
;// ./node_modules/@rc-component/tooltip/es/Popup.js
const Popup_Popup = props => {
const {
children,
prefixCls,
id,
classNames,
styles,
className,
style
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
id: id,
className: (0,clsx.clsx)(`${prefixCls}-container`, classNames?.container, className),
style: {
...styles?.container,
...style
},
role: "tooltip"
}, typeof children === 'function' ? children() : children);
};
/* harmony default export */ var tooltip_es_Popup = (Popup_Popup);
;// ./node_modules/@rc-component/tooltip/es/placements.js
const autoAdjustOverflowTopBottom = {
shiftX: 64,
adjustY: 1
};
const autoAdjustOverflowLeftRight = {
adjustX: 1,
shiftY: true
};
const targetOffset = [0, 0];
const placements = {
left: {
points: ['cr', 'cl'],
overflow: autoAdjustOverflowLeftRight,
offset: [-4, 0],
targetOffset
},
right: {
points: ['cl', 'cr'],
overflow: autoAdjustOverflowLeftRight,
offset: [4, 0],
targetOffset
},
top: {
points: ['bc', 'tc'],
overflow: autoAdjustOverflowTopBottom,
offset: [0, -4],
targetOffset
},
bottom: {
points: ['tc', 'bc'],
overflow: autoAdjustOverflowTopBottom,
offset: [0, 4],
targetOffset
},
topLeft: {
points: ['bl', 'tl'],
overflow: autoAdjustOverflowTopBottom,
offset: [0, -4],
targetOffset
},
leftTop: {
points: ['tr', 'tl'],
overflow: autoAdjustOverflowLeftRight,
offset: [-4, 0],
targetOffset
},
topRight: {
points: ['br', 'tr'],
overflow: autoAdjustOverflowTopBottom,
offset: [0, -4],
targetOffset
},
rightTop: {
points: ['tl', 'tr'],
overflow: autoAdjustOverflowLeftRight,
offset: [4, 0],
targetOffset
},
bottomRight: {
points: ['tr', 'br'],
overflow: autoAdjustOverflowTopBottom,
offset: [0, 4],
targetOffset
},
rightBottom: {
points: ['bl', 'br'],
overflow: autoAdjustOverflowLeftRight,
offset: [4, 0],
targetOffset
},
bottomLeft: {
points: ['tl', 'bl'],
overflow: autoAdjustOverflowTopBottom,
offset: [0, 4],
targetOffset
},
leftBottom: {
points: ['br', 'bl'],
overflow: autoAdjustOverflowLeftRight,
offset: [-4, 0],
targetOffset
}
};
/* harmony default export */ var es_placements = (placements);
;// ./node_modules/@rc-component/tooltip/es/Tooltip.js
function Tooltip_extends() { Tooltip_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Tooltip_extends.apply(this, arguments); }
const Tooltip = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
trigger = ['hover'],
mouseEnterDelay = 0,
mouseLeaveDelay = 0.1,
prefixCls = 'rc-tooltip',
children,
onVisibleChange,
afterVisibleChange,
motion,
placement = 'right',
align = {},
destroyOnHidden = false,
defaultVisible,
getTooltipContainer,
arrowContent,
overlay,
id,
showArrow = true,
classNames,
styles,
...restProps
} = props;
const mergedId = useId(id);
const triggerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref, () => triggerRef.current);
const extraProps = {
...restProps
};
if ('visible' in props) {
extraProps.popupVisible = props.visible;
}
// ========================= Arrow ==========================
// Process arrow configuration
const mergedArrow = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!showArrow) {
return false;
}
// Convert true to object for unified processing
const arrowConfig = showArrow === true ? {} : showArrow;
// Apply semantic styles with unified logic
return {
...arrowConfig,
className: (0,clsx.clsx)(arrowConfig.className, classNames?.arrow),
style: {
...arrowConfig.style,
...styles?.arrow
},
content: arrowConfig.content ?? arrowContent
};
}, [showArrow, classNames?.arrow, styles?.arrow, arrowContent]);
// ======================== Children ========================
const getChildren = ({
open
}) => {
const child = external_root_React_commonjs2_react_commonjs_react_amd_react_.Children.only(children);
const ariaProps = {
'aria-describedby': overlay && open ? mergedId : undefined
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement(child, ariaProps);
};
// ========================= Render =========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(trigger_es, Tooltip_extends({
popupClassName: classNames?.root,
prefixCls: prefixCls,
popup: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(tooltip_es_Popup, {
key: "content",
prefixCls: prefixCls,
id: mergedId,
classNames: classNames,
styles: styles
}, overlay),
action: trigger,
builtinPlacements: placements,
popupPlacement: placement,
ref: triggerRef,
popupAlign: align,
getPopupContainer: getTooltipContainer,
onOpenChange: onVisibleChange,
afterOpenChange: afterVisibleChange,
popupMotion: motion,
defaultPopupVisible: defaultVisible,
autoDestroy: destroyOnHidden,
mouseLeaveDelay: mouseLeaveDelay,
popupStyle: styles?.root,
mouseEnterDelay: mouseEnterDelay,
arrow: mergedArrow,
uniqueContainerClassName: classNames?.uniqueContainer,
uniqueContainerStyle: styles?.uniqueContainer
}, extraProps), getChildren);
});
/* harmony default export */ var es_Tooltip = (Tooltip);
;// ./node_modules/@rc-component/tooltip/es/index.js
/* harmony default export */ var tooltip_es = (es_Tooltip);
// EXTERNAL MODULE: ./components/style/placementArrow.ts
var placementArrow = __webpack_require__("./components/style/placementArrow.ts");
;// ./components/_util/placements.ts
function getOverflowOptions(placement, arrowOffset, arrowWidth, autoAdjustOverflow) {
if (autoAdjustOverflow === false) {
return {
adjustX: false,
adjustY: false
};
}
const overflow = (0,is.isPlainObject)(autoAdjustOverflow) ? autoAdjustOverflow : {};
const baseOverflow = {};
switch (placement) {
case 'top':
case 'bottom':
baseOverflow.shiftX = arrowOffset.arrowOffsetHorizontal * 2 + arrowWidth;
baseOverflow.shiftY = true;
baseOverflow.adjustY = true;
break;
case 'left':
case 'right':
baseOverflow.shiftY = arrowOffset.arrowOffsetVertical * 2 + arrowWidth;
baseOverflow.shiftX = true;
baseOverflow.adjustX = true;
break;
}
const mergedOverflow = {
...baseOverflow,
...overflow
};
// Support auto shift
if (!mergedOverflow.shiftX) {
mergedOverflow.adjustX = true;
}
if (!mergedOverflow.shiftY) {
mergedOverflow.adjustY = true;
}
return mergedOverflow;
}
const PlacementAlignMap = {
left: {
points: ['cr', 'cl']
},
right: {
points: ['cl', 'cr']
},
top: {
points: ['bc', 'tc']
},
bottom: {
points: ['tc', 'bc']
},
topLeft: {
points: ['bl', 'tl']
},
leftTop: {
points: ['tr', 'tl']
},
topRight: {
points: ['br', 'tr']
},
rightTop: {
points: ['tl', 'tr']
},
bottomRight: {
points: ['tr', 'br']
},
rightBottom: {
points: ['bl', 'br']
},
bottomLeft: {
points: ['tl', 'bl']
},
leftBottom: {
points: ['br', 'bl']
}
};
const ArrowCenterPlacementAlignMap = {
topLeft: {
points: ['bl', 'tc']
},
leftTop: {
points: ['tr', 'cl']
},
topRight: {
points: ['br', 'tc']
},
rightTop: {
points: ['tl', 'cr']
},
bottomRight: {
points: ['tr', 'bc']
},
rightBottom: {
points: ['bl', 'cr']
},
bottomLeft: {
points: ['tl', 'bc']
},
leftBottom: {
points: ['br', 'cl']
}
};
const DisableAutoArrowList = new Set(['topLeft', 'topRight', 'bottomLeft', 'bottomRight', 'leftTop', 'leftBottom', 'rightTop', 'rightBottom']);
function getPlacements(config) {
const {
arrowWidth,
autoAdjustOverflow,
arrowPointAtCenter,
offset,
borderRadius,
visibleFirst
} = config;
const halfArrowWidth = arrowWidth / 2;
const placementMap = {};
// Dynamic offset
const arrowOffset = (0,placementArrow.getArrowOffsetToken)({
contentRadius: borderRadius,
limitVerticalRadius: true
});
Object.keys(PlacementAlignMap).forEach(key => {
const template = arrowPointAtCenter && ArrowCenterPlacementAlignMap[key] || PlacementAlignMap[key];
const placementInfo = {
...template,
offset: [0, 0],
dynamicInset: true
};
placementMap[key] = placementInfo;
// Disable autoArrow since design is fixed position
if (DisableAutoArrowList.has(key)) {
placementInfo.autoArrow = false;
}
// Static offset
switch (key) {
case 'top':
case 'topLeft':
case 'topRight':
placementInfo.offset[1] = -halfArrowWidth - offset;
break;
case 'bottom':
case 'bottomLeft':
case 'bottomRight':
placementInfo.offset[1] = halfArrowWidth + offset;
break;
case 'left':
case 'leftTop':
case 'leftBottom':
placementInfo.offset[0] = -halfArrowWidth - offset;
break;
case 'right':
case 'rightTop':
case 'rightBottom':
placementInfo.offset[0] = halfArrowWidth + offset;
break;
}
if (arrowPointAtCenter) {
switch (key) {
case 'topLeft':
case 'bottomLeft':
placementInfo.offset[0] = -arrowOffset.arrowOffsetHorizontal - halfArrowWidth;
break;
case 'topRight':
case 'bottomRight':
placementInfo.offset[0] = arrowOffset.arrowOffsetHorizontal + halfArrowWidth;
break;
case 'leftTop':
case 'rightTop':
placementInfo.offset[1] = -arrowOffset.arrowOffsetHorizontal * 2 + halfArrowWidth;
break;
case 'leftBottom':
case 'rightBottom':
placementInfo.offset[1] = arrowOffset.arrowOffsetHorizontal * 2 - halfArrowWidth;
break;
}
}
// Overflow
placementInfo.overflow = getOverflowOptions(key, arrowOffset, arrowWidth, autoAdjustOverflow);
// VisibleFirst
if (visibleFirst) {
placementInfo.htmlRegion = 'visibleFirst';
}
});
return placementMap;
}
;// ./components/table/TableMeasureRowContext.ts
const TableMeasureRowContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createContext(false);
/* harmony default export */ var table_TableMeasureRowContext = (TableMeasureRowContext);
;// ./components/tooltip/hook/useMergedArrow.ts
const useMergedArrow = (providedArrow, providedContextArrow) => {
const toConfig = arrow => typeof arrow === 'boolean' ? {
show: arrow
} : arrow || {};
return external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
const arrowConfig = toConfig(providedArrow);
const contextArrowConfig = toConfig(providedContextArrow);
return {
...contextArrowConfig,
...arrowConfig,
show: arrowConfig.show ?? contextArrowConfig.show ?? true
};
}, [providedArrow, providedContextArrow]);
};
/* harmony default export */ var hook_useMergedArrow = (useMergedArrow);
// EXTERNAL MODULE: ./components/tooltip/style/index.ts
var tooltip_style = __webpack_require__("./components/tooltip/style/index.ts");
;// ./components/_util/colors.ts
const inverseColors = presetColors.PresetColors.map(color => `${color}-inverse`);
const PresetStatusColors = ['success', 'processing', 'error', 'default', 'warning'];
/**
* determine if the color keyword belongs to the `Ant Design` {@link PresetColors}.
* @param color color to be judged
* @param includeInverse whether to include reversed colors
*/
function isPresetColor(color, includeInverse = true) {
if (includeInverse) {
return [].concat((0,toConsumableArray["default"])(inverseColors), (0,toConsumableArray["default"])(presetColors.PresetColors)).includes(color);
}
return presetColors.PresetColors.includes(color);
}
function isPresetStatusColor(color) {
return PresetStatusColors.includes(color);
}
// EXTERNAL MODULE: ./components/color-picker/util.ts
var util = __webpack_require__("./components/color-picker/util.ts");
;// ./components/tooltip/util.ts
const parseColor = (rootPrefixCls, prefixCls, color) => {
const isInternalColor = isPresetColor(color);
const [varName] = (0,genStyleUtils.genCssVar)(rootPrefixCls, 'tooltip');
const className = (0,clsx.clsx)({
[`${prefixCls}-${color}`]: color && isInternalColor
});
const overlayStyle = {};
const arrowStyle = {};
const rgb = (0,util.generateColor)(color).toRgb();
const luminance = (0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.b) / 255;
const textColor = luminance < 0.5 ? '#FFF' : '#000';
if (color && !isInternalColor) {
overlayStyle.background = color;
overlayStyle[varName('overlay-color')] = textColor;
arrowStyle[varName('arrow-background-color')] = color;
}
return {
className,
overlayStyle,
arrowStyle
};
};
;// ./components/tooltip/PurePanel.tsx
/** @private Internal Component. Do not use in your production. */
const tooltip_PurePanel_PurePanel = props => {
const {
prefixCls: customizePrefixCls,
className,
placement = 'top',
title,
color,
overlayInnerStyle,
classNames,
styles
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('tooltip', customizePrefixCls);
const rootPrefixCls = getPrefixCls();
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,tooltip_style["default"])(prefixCls, rootCls);
// Color
const colorInfo = parseColor(rootPrefixCls, prefixCls, color);
const arrowContentStyle = colorInfo.arrowStyle;
const innerStyles = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const mergedStyle = {
...overlayInnerStyle,
...colorInfo.overlayStyle
};
return {
container: mergedStyle
};
}, [overlayInnerStyle, colorInfo.overlayStyle]);
const mergedProps = {
...props,
placement
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([classNames], [innerStyles, styles], {
props: mergedProps
});
const rootClassName = (0,clsx.clsx)(rootCls, hashId, cssVarCls, prefixCls, `${prefixCls}-pure`, `${prefixCls}-placement-${placement}`, className, colorInfo.className);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: rootClassName,
style: arrowContentStyle
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-arrow`
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(tooltip_es_Popup, {
...props,
className: hashId,
prefixCls: prefixCls,
classNames: mergedClassNames,
styles: mergedStyles
}, title));
};
/* harmony default export */ var tooltip_PurePanel = (tooltip_PurePanel_PurePanel);
;// ./components/tooltip/index.tsx
const InternalTooltip = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
openClassName,
getTooltipContainer,
color,
children,
afterOpenChange,
arrow: tooltipArrow,
destroyTooltipOnHide,
destroyOnHidden,
title,
overlay,
trigger,
builtinPlacements,
autoAdjustOverflow = true,
motion,
getPopupContainer,
placement = 'top',
mouseEnterDelay = 0.1,
mouseLeaveDelay = 0.1,
rootClassName,
styles,
classNames,
onOpenChange,
// Legacy
overlayInnerStyle,
overlayStyle,
overlayClassName,
...restProps
} = props;
const [, token] = (0,useToken["default"])();
const injectFromPopover = props['data-popover-inject'];
const {
getPopupContainer: getContextPopupContainer,
getPrefixCls,
direction,
...semanticConfig
} = (0,config_provider_context.useComponentConfig)('tooltip');
// When injected from Popover/Popconfirm, skip tooltip-specific semantic config
// to prevent ConfigProvider tooltip config from leaking into those components
const {
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles,
arrow: contextArrow,
trigger: contextTrigger
} = injectFromPopover ? {} : semanticConfig;
const mergedArrow = hook_useMergedArrow(tooltipArrow, contextArrow);
const mergedShowArrow = mergedArrow.show;
const mergedTrigger = trigger || contextTrigger || 'hover';
const mergedGetPopupContainer = getPopupContainer || getContextPopupContainer;
const mergedDestroyOnHidden = destroyOnHidden ?? !!destroyTooltipOnHide;
const inTableMeasureRow = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(table_TableMeasureRowContext);
// ============================== Ref ===============================
const warning = (0,_util_warning.devUseWarning)('Tooltip');
const tooltipRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const forceAlign = () => {
tooltipRef.current?.forceAlign();
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
forceAlign,
nativeElement: tooltipRef.current?.nativeElement,
popupElement: tooltipRef.current?.popupElement
}));
// ============================== Warn ==============================
if (true) {
[['overlayStyle', 'styles.root'], ['overlayInnerStyle', 'styles.container'], ['overlayClassName', 'classNames.root'], ['destroyTooltipOnHide', 'destroyOnHidden']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
true ? warning(!destroyTooltipOnHide || typeof destroyTooltipOnHide === 'boolean', 'usage', '`destroyTooltipOnHide` no need config `keepParent` anymore. Please use `boolean` value directly.') : 0;
}
// ============================== Open ==============================
const [open, setOpen] = (0,es.useControlledState)(props.defaultOpen ?? false, props.open);
const noTitle = !title && !overlay && title !== 0; // overlay for old version compatibility
const onInternalOpenChange = vis => {
setOpen(noTitle ? false : vis);
if (!noTitle && onOpenChange) {
onOpenChange(vis);
}
};
const tooltipPlacements = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
return builtinPlacements || getPlacements({
arrowPointAtCenter: mergedArrow?.pointAtCenter ?? false,
autoAdjustOverflow,
arrowWidth: mergedShowArrow ? token.sizePopupArrow : 0,
borderRadius: token.borderRadius,
offset: token.marginXXS,
visibleFirst: true
});
}, [mergedArrow, builtinPlacements, token, mergedShowArrow, autoAdjustOverflow]);
const memoOverlay = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (title === 0) {
return title;
}
return overlay || title || '';
}, [overlay, title]);
const memoOverlayWrapper = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(_util_ContextIsolator, {
space: true,
form: true
}, typeof memoOverlay === 'function' ? memoOverlay() : memoOverlay);
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
trigger: mergedTrigger,
builtinPlacements: tooltipPlacements,
getPopupContainer: mergedGetPopupContainer,
destroyOnHidden: mergedDestroyOnHidden
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const prefixCls = getPrefixCls('tooltip', customizePrefixCls);
const rootPrefixCls = getPrefixCls();
let tempOpen = open;
// Hide tooltip when there is no title or in table measure row
if (!('open' in props) && noTitle || inTableMeasureRow) {
tempOpen = false;
}
// ============================= Render =============================
const child = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(children) && !(0,reactNode.isFragment)(children) ? children : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", null, children);
const childProps = child.props;
const childCls = !childProps.className || typeof childProps.className === 'string' ? (0,clsx.clsx)(childProps.className, openClassName || `${prefixCls}-open`) : childProps.className;
// Style
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,tooltip_style["default"])(prefixCls, rootCls, !injectFromPopover);
// Color
const colorInfo = parseColor(rootPrefixCls, prefixCls, color);
const arrowContentStyle = colorInfo.arrowStyle;
const themeCls = (0,clsx.clsx)(rootCls, hashId, cssVarCls);
const rootClassNames = (0,clsx.clsx)(overlayClassName, {
[`${prefixCls}-rtl`]: direction === 'rtl'
}, colorInfo.className, rootClassName, themeCls, contextClassName, mergedClassNames.root);
// ============================ zIndex ============================
const [zIndex, contextZIndex] = (0,useZIndex.useZIndex)('Tooltip', restProps.zIndex);
const containerStyle = {
...mergedStyles.container,
...overlayInnerStyle,
...colorInfo.overlayStyle
};
const content = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(tooltip_es, {
unique: true,
...restProps,
zIndex: zIndex,
showArrow: mergedShowArrow,
placement: placement,
mouseEnterDelay: mouseEnterDelay,
mouseLeaveDelay: mouseLeaveDelay,
prefixCls: prefixCls,
classNames: {
root: rootClassNames,
container: mergedClassNames.container,
arrow: mergedClassNames.arrow,
uniqueContainer: (0,clsx.clsx)(themeCls, mergedClassNames.container)
},
styles: {
root: {
...arrowContentStyle,
...mergedStyles.root,
...contextStyle,
...overlayStyle
},
container: containerStyle,
uniqueContainer: containerStyle,
arrow: mergedStyles.arrow
},
ref: tooltipRef,
overlay: memoOverlayWrapper,
visible: tempOpen,
onVisibleChange: onInternalOpenChange,
afterVisibleChange: afterOpenChange,
arrowContent: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-arrow-content`
}),
motion: {
motionName: (0,_util_motion.getTransitionName)(rootPrefixCls, 'zoom-big-fast', typeof motion?.motionName === 'string' ? motion?.motionName : undefined),
motionDeadline: 1000
},
trigger: mergedTrigger,
builtinPlacements: tooltipPlacements,
getTooltipContainer: mergedGetPopupContainer,
destroyOnHidden: mergedDestroyOnHidden
}, tempOpen ? (0,reactNode.cloneElement)(child, {
className: childCls
}) : child);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(zindexContext["default"].Provider, {
value: contextZIndex
}, content);
});
const tooltip_Tooltip = InternalTooltip;
if (true) {
tooltip_Tooltip.displayName = 'Tooltip';
}
tooltip_Tooltip._InternalPanelDoNotUseOrYouWillBeFired = tooltip_PurePanel;
tooltip_Tooltip.UniqueProvider = tooltip_UniqueProvider;
/* harmony default export */ var components_tooltip = (tooltip_Tooltip);
// EXTERNAL MODULE: ./components/popover/style/index.ts
var popover_style = __webpack_require__("./components/popover/style/index.ts");
;// ./components/popover/PurePanel.tsx
const Overlay = props => {
const {
title,
content,
prefixCls,
classNames,
styles
} = props;
if (!title && !content) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, title && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-title`, classNames?.title),
style: styles?.title
}, title)), content && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-content`, classNames?.content),
style: styles?.content
}, content)));
};
const RawPurePanel = props => {
const {
hashId,
prefixCls,
className,
style,
placement = 'top',
title,
content,
children,
classNames,
styles
} = props;
const titleNode = getRenderPropValue(title);
const contentNode = getRenderPropValue(content);
const mergedProps = {
...props,
placement
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([classNames], [styles], {
props: mergedProps
});
const rootClassName = (0,clsx.clsx)(hashId, prefixCls, `${prefixCls}-pure`, `${prefixCls}-placement-${placement}`, className);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: rootClassName,
style: style
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-arrow`
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(tooltip_es_Popup, {
...props,
className: hashId,
prefixCls: prefixCls,
classNames: mergedClassNames,
styles: mergedStyles
}, children || (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Overlay, {
prefixCls: prefixCls,
title: titleNode,
content: contentNode,
classNames: mergedClassNames,
styles: mergedStyles
}))));
};
const popover_PurePanel_PurePanel = props => {
const {
prefixCls: customizePrefixCls,
className,
...restProps
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('popover', customizePrefixCls);
const [hashId, cssVarCls] = (0,popover_style["default"])(prefixCls);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RawPurePanel, {
...restProps,
prefixCls: prefixCls,
hashId: hashId,
className: (0,clsx.clsx)(className, cssVarCls)
});
};
/* harmony default export */ var popover_PurePanel = (popover_PurePanel_PurePanel);
;// ./components/popover/index.tsx
// CSSINJS
const InternalPopover = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
title,
content,
overlayClassName,
placement = 'top',
trigger,
children,
mouseEnterDelay = 0.1,
mouseLeaveDelay = 0.1,
onOpenChange,
overlayStyle = {},
styles,
classNames,
motion,
arrow: popoverArrow,
...restProps
} = props;
const {
getPrefixCls,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles,
arrow: contextArrow,
trigger: contextTrigger
} = (0,config_provider_context.useComponentConfig)('popover');
const prefixCls = getPrefixCls('popover', customizePrefixCls);
const [hashId, cssVarCls] = (0,popover_style["default"])(prefixCls);
const rootPrefixCls = getPrefixCls();
const mergedArrow = hook_useMergedArrow(popoverArrow, contextArrow);
const mergedTrigger = trigger || contextTrigger || 'hover';
// ========================== Warning ===========================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Popover');
true ? warning(!onOpenChange || onOpenChange.length <= 1, 'usage', 'The second `onOpenChange` parameter is internal and unsupported. Please lock to a previous version if needed.') : 0;
}
// ============================= Styles =============================
const mergedProps = {
...props,
placement,
trigger: mergedTrigger,
mouseEnterDelay,
mouseLeaveDelay,
overlayStyle,
styles,
classNames
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const rootClassNames = (0,clsx.clsx)(overlayClassName, hashId, cssVarCls, contextClassName, mergedClassNames.root);
const [open, setOpen] = (0,es.useControlledState)(props.defaultOpen ?? false, props.open);
const settingOpen = value => {
setOpen(value);
onOpenChange?.(value);
};
const titleNode = getRenderPropValue(title);
const contentNode = getRenderPropValue(content);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_tooltip, {
unique: false,
arrow: mergedArrow,
placement: placement,
trigger: mergedTrigger,
mouseEnterDelay: mouseEnterDelay,
mouseLeaveDelay: mouseLeaveDelay,
...restProps,
prefixCls: prefixCls,
classNames: {
root: rootClassNames,
container: mergedClassNames.container,
arrow: mergedClassNames.arrow
},
styles: {
root: {
...mergedStyles.root,
...contextStyle,
...overlayStyle
},
container: mergedStyles.container,
arrow: mergedStyles.arrow
},
ref: ref,
open: open,
onOpenChange: settingOpen,
overlay: titleNode || contentNode ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Overlay, {
prefixCls: prefixCls,
title: titleNode,
content: contentNode,
classNames: mergedClassNames,
styles: mergedStyles
})) : null,
motion: {
motionName: (0,_util_motion.getTransitionName)(rootPrefixCls, 'zoom-big', typeof motion?.motionName === 'string' ? motion?.motionName : undefined)
},
"data-popover-inject": true
}, children);
});
const Popover = InternalPopover;
Popover._InternalPanelDoNotUseOrYouWillBeFired = popover_PurePanel;
if (true) {
Popover.displayName = 'Popover';
}
/* harmony default export */ var popover = (Popover);
;// ./components/avatar/AvatarGroup.tsx
const AvatarContextProvider = props => {
const {
size,
shape
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(avatar_AvatarContext);
const avatarContextValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
size: props.size || size,
shape: props.shape || shape
}), [props.size, props.shape, size, shape]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(avatar_AvatarContext.Provider, {
value: avatarContextValue
}, props.children);
};
const AvatarGroup = props => {
const {
getPrefixCls,
direction
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
style,
maxCount,
maxStyle,
size,
shape,
maxPopoverPlacement,
maxPopoverTrigger,
children,
max
} = props;
if (true) {
const warning = (0,_util_warning.devUseWarning)('Avatar.Group');
[['maxCount', 'max={{ count: number }}'], ['maxStyle', 'max={{ style: CSSProperties }}'], ['maxPopoverPlacement', 'max={{ popover: PopoverProps }}'], ['maxPopoverTrigger', 'max={{ popover: PopoverProps }}']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
}
const prefixCls = getPrefixCls('avatar', customizePrefixCls);
const groupPrefixCls = `${prefixCls}-group`;
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,avatar_style["default"])(prefixCls, rootCls);
const cls = (0,clsx.clsx)(groupPrefixCls, {
[`${groupPrefixCls}-rtl`]: direction === 'rtl'
}, cssVarCls, rootCls, className, rootClassName, hashId);
const childrenWithProps = (0,es.toArray)(children).map((child, index) => (0,reactNode.cloneElement)(child, {
// eslint-disable-next-line react/no-array-index-key
key: `avatar-key-${index}`
}));
const mergeCount = max?.count || maxCount;
const numOfChildren = childrenWithProps.length;
if (mergeCount && mergeCount < numOfChildren) {
const childrenShow = childrenWithProps.slice(0, mergeCount);
const childrenHidden = childrenWithProps.slice(mergeCount, numOfChildren);
const mergeStyle = max?.style || maxStyle;
const mergePopoverTrigger = max?.popover?.trigger || maxPopoverTrigger || 'hover';
const mergePopoverPlacement = max?.popover?.placement || maxPopoverPlacement || 'top';
const popoverProps = {
content: childrenHidden,
...max?.popover,
placement: mergePopoverPlacement,
trigger: mergePopoverTrigger,
rootClassName: (0,clsx.clsx)(`${groupPrefixCls}-popover`, max?.popover?.rootClassName)
};
childrenShow.push(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(popover, {
key: "avatar-popover-key",
destroyOnHidden: true,
...popoverProps
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(avatar_Avatar, {
style: mergeStyle
}, `+${numOfChildren - mergeCount}`)));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AvatarContextProvider, {
shape: shape,
size: size
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: cls,
style: style
}, childrenShow));
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AvatarContextProvider, {
shape: shape,
size: size
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: cls,
style: style
}, childrenWithProps));
};
/* harmony default export */ var avatar_AvatarGroup = (AvatarGroup);
;// ./components/avatar/index.tsx
const components_avatar_Avatar = avatar_Avatar;
components_avatar_Avatar.Group = avatar_AvatarGroup;
/* harmony default export */ var avatar = (components_avatar_Avatar);
;// ./node_modules/@ant-design/icons-svg/es/asn/VerticalAlignTopOutlined.js
// This icon file is generated automatically.
var VerticalAlignTopOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M859.9 168H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM518.3 355a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V848c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V509.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 355z" } }] }, "name": "vertical-align-top", "theme": "outlined" };
/* harmony default export */ var asn_VerticalAlignTopOutlined = (VerticalAlignTopOutlined);
;// ./node_modules/@ant-design/icons/es/icons/VerticalAlignTopOutlined.js
function VerticalAlignTopOutlined_extends() { VerticalAlignTopOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return VerticalAlignTopOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const VerticalAlignTopOutlined_VerticalAlignTopOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], VerticalAlignTopOutlined_extends({}, props, {
ref: ref,
icon: asn_VerticalAlignTopOutlined
}));
/** */
const VerticalAlignTopOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(VerticalAlignTopOutlined_VerticalAlignTopOutlined);
if (true) {
VerticalAlignTopOutlined_RefIcon.displayName = 'VerticalAlignTopOutlined';
}
/* harmony default export */ var icons_VerticalAlignTopOutlined = (VerticalAlignTopOutlined_RefIcon);
// EXTERNAL MODULE: ./components/back-top/style/index.ts
var back_top_style = __webpack_require__("./components/back-top/style/index.ts");
;// ./components/back-top/index.tsx
/**
* @deprecated Please use `FloatButton.BackTop` instead.
*/
const BackTop = props => {
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
visibilityHeight = 400,
target,
onClick,
duration = 450,
children
} = props;
const [visible, setVisible] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(visibilityHeight === 0);
const ref = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
const getDefaultTarget = () => ref.current?.ownerDocument || window;
const handleScroll = _util_throttleByAnimationFrame(e => {
const scrollTop = _util_getScroll(e.target);
setVisible(scrollTop >= visibilityHeight);
});
if (true) {
const warning = (0,_util_warning.devUseWarning)('BackTop');
warning.deprecated(false, 'BackTop', 'FloatButton.BackTop');
}
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(() => {
const getTarget = target || getDefaultTarget;
const container = getTarget();
handleScroll({
target: container
});
container?.addEventListener('scroll', handleScroll);
return () => {
handleScroll.cancel();
container?.removeEventListener('scroll', handleScroll);
};
}, [target]);
const scrollToTop = e => {
scrollTo(0, {
getContainer: target || getDefaultTarget,
duration
});
onClick?.(e);
};
const {
getPrefixCls,
direction
} = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('back-top', customizePrefixCls);
const rootPrefixCls = getPrefixCls();
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,back_top_style["default"])(prefixCls, rootCls);
const classString = (0,clsx.clsx)(hashId, cssVarCls, prefixCls, {
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, rootClassName);
// fix https://fb.me/react-unknown-prop
const divProps = (0,omit["default"])(props, ['prefixCls', 'className', 'rootClassName', 'children', 'visibilityHeight', 'target']);
const defaultElement = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${prefixCls}-content`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${prefixCls}-icon`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_VerticalAlignTopOutlined, null)));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
...divProps,
className: classString,
onClick: scrollToTop,
ref: ref
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(motion_es["default"], {
visible: visible,
motionName: `${rootPrefixCls}-fade`
}, ({
className: motionClassName
}) => (0,reactNode.cloneElement)(children || defaultElement, ({
className: cloneCls
}) => ({
className: (0,clsx.clsx)(motionClassName, cloneCls)
}))));
};
if (true) {
BackTop.displayName = 'Deprecated.BackTop';
}
/* harmony default export */ var back_top = (BackTop);
;// ./components/badge/SingleNumber.tsx
const UnitNumber = props => {
const {
prefixCls,
value,
current,
offset = 0
} = props;
let style;
if (offset) {
style = {
position: 'absolute',
top: `${offset}00%`,
left: 0
};
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
style: style,
className: (0,clsx.clsx)(`${prefixCls}-only-unit`, {
current
})
}, value);
};
function getOffset(start, end, unit) {
let index = start;
let offset = 0;
while ((index + 10) % 10 !== end) {
index += unit;
offset += unit;
}
return offset;
}
const SingleNumber = props => {
const {
prefixCls,
count: originCount,
value: originValue
} = props;
const value = Number(originValue);
const count = Math.abs(originCount);
const [prevValue, setPrevValue] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(value);
const [prevCount, setPrevCount] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(count);
// ============================= Events =============================
const onTransitionEnd = () => {
setPrevValue(value);
setPrevCount(count);
};
// Fallback if transition events are not supported
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
const timer = setTimeout(onTransitionEnd, 1000);
return () => clearTimeout(timer);
}, [value]);
// ============================= Render =============================
// Render unit list
let unitNodes;
let offsetStyle;
if (prevValue === value || Number.isNaN(value) || Number.isNaN(prevValue)) {
// Nothing to change
unitNodes = [/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(UnitNumber, {
...props,
key: value,
current: true
})];
offsetStyle = {
transition: 'none'
};
} else {
unitNodes = [];
// Fill basic number units
const end = value + 10;
const unitNumberList = [];
for (let index = value; index <= end; index += 1) {
unitNumberList.push(index);
}
const unit = prevCount < count ? 1 : -1;
// Fill with number unit nodes
const prevIndex = unitNumberList.findIndex(n => n % 10 === prevValue);
// Cut list
const cutUnitNumberList = unit < 0 ? unitNumberList.slice(0, prevIndex + 1) : unitNumberList.slice(prevIndex);
unitNodes = cutUnitNumberList.map((n, index) => {
const singleUnit = n % 10;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(UnitNumber, {
...props,
key: n,
value: singleUnit,
offset: unit < 0 ? index - prevIndex : index,
current: index === prevIndex
});
});
// Calculate container offset value
offsetStyle = {
transform: `translateY(${-getOffset(prevValue, value, unit)}00%)`
};
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-only`,
style: offsetStyle,
onTransitionEnd: onTransitionEnd
}, unitNodes);
};
/* harmony default export */ var badge_SingleNumber = (SingleNumber);
;// ./components/badge/ScrollNumber.tsx
const ScrollNumber = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
count,
className,
motionClassName,
style,
title,
show,
component: Component = 'sup',
children,
...restProps
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('scroll-number', customizePrefixCls);
// ============================ Render ============================
const newProps = {
...restProps,
'data-show': show,
style,
className: (0,clsx.clsx)(prefixCls, className, motionClassName),
title: title
};
// Only integer need motion
let numberNodes = count;
if (count && Number(count) % 1 === 0) {
const numberList = String(count).split('');
numberNodes = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("bdi", null, numberList.map((num, i) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(badge_SingleNumber, {
prefixCls: prefixCls,
count: Number(count),
value: num,
// eslint-disable-next-line react/no-array-index-key
key: numberList.length - i
}))));
}
// allow specify the border
// mock border-color by box-shadow for compatible with old usage:
//
if (style?.borderColor) {
newProps.style = {
...style,
boxShadow: `0 0 0 1px ${style.borderColor} inset`
};
}
if (children) {
return (0,reactNode.cloneElement)(children, oriProps => ({
className: (0,clsx.clsx)(`${prefixCls}-custom-component`, oriProps?.className, motionClassName)
}));
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, {
...newProps,
ref: ref
}, numberNodes);
});
/* harmony default export */ var badge_ScrollNumber = (ScrollNumber);
// EXTERNAL MODULE: ./components/badge/style/index.ts
var badge_style = __webpack_require__("./components/badge/style/index.ts");
;// ./components/badge/Badge.tsx
const Badge = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
scrollNumberPrefixCls: customizeScrollNumberPrefixCls,
children,
status,
text,
color,
count = null,
overflowCount = 99,
dot = false,
size = 'medium',
title,
offset,
style,
className,
rootClassName,
classNames,
styles,
showZero = false,
...restProps
} = props;
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('badge');
const prefixCls = getPrefixCls('badge', customizePrefixCls);
const [hashId, cssVarCls] = (0,badge_style["default"])(prefixCls);
if (true) {
const warning = (0,_util_warning.devUseWarning)('Badge');
warning.deprecated(size !== 'default', 'size="default"', 'size="medium"');
}
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
overflowCount,
size,
dot,
showZero
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
// ================================ Misc ================================
const numberedDisplayCount = count > overflowCount ? `${overflowCount}+` : count;
const isZero = numberedDisplayCount === '0' || numberedDisplayCount === 0 || text === '0' || text === 0;
const ignoreCount = count === null || isZero && !showZero;
const hasStatus = ((0,is.isNonNullable)(status) || (0,is.isNonNullable)(color)) && ignoreCount;
const hasStatusValue = (0,is.isNonNullable)(status) || !isZero;
const showAsDot = dot && !isZero;
const mergedCount = showAsDot ? '' : numberedDisplayCount;
const isHidden = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
const isEmpty = (!(0,is.isNonNullable)(mergedCount) || mergedCount === '') && (!(0,is.isNonNullable)(text) || text === '');
return (isEmpty || isZero && !showZero) && !showAsDot;
}, [mergedCount, isZero, showZero, showAsDot, text]);
// Count should be cache in case hidden change it
const countRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(count);
if (!isHidden) {
countRef.current = count;
}
const livingCount = countRef.current;
// We need cache count since remove motion should not change count display
const displayCountRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(mergedCount);
if (!isHidden) {
displayCountRef.current = mergedCount;
}
const displayCount = displayCountRef.current;
// We will cache the dot status to avoid shaking on leaved motion
const isDotRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(showAsDot);
if (!isHidden) {
isDotRef.current = showAsDot;
}
// =============================== Styles ===============================
const mergedStyle = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (!offset) {
return {
...contextStyle,
...style
};
}
const horizontalOffset = Number.parseInt(offset[0], 10);
const offsetStyle = {
marginTop: offset[1],
insetInlineEnd: -horizontalOffset
};
return {
...offsetStyle,
...contextStyle,
...style
};
}, [offset, style, contextStyle]);
// =============================== Render ===============================
// >>> Title
const titleNode = title ?? (typeof livingCount === 'string' || (0,is.isNumber)(livingCount) ? livingCount : undefined);
// >>> Status Text
const showStatusTextNode = !isHidden && (text === 0 ? showZero : !!text && text !== true);
const statusTextNode = !showStatusTextNode ? null : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-status-text`
}, text));
// >>> Display Component
const displayNode = (0,is.isPlainObject)(livingCount) ? (0,reactNode.cloneElement)(livingCount, oriProps => ({
style: {
...mergedStyle,
...oriProps.style
}
})) : undefined;
// InternalColor
const isInternalColor = isPresetColor(color, false);
// Shared styles
const statusCls = (0,clsx.clsx)(mergedClassNames.indicator, {
[`${prefixCls}-status-dot`]: hasStatus,
[`${prefixCls}-status-${status}`]: !!status,
[`${prefixCls}-color-${color}`]: isInternalColor
});
const statusStyle = {};
if (color && !isInternalColor) {
statusStyle.color = color;
statusStyle.background = color;
}
const badgeClassName = (0,clsx.clsx)(prefixCls, {
[`${prefixCls}-status`]: hasStatus,
[`${prefixCls}-not-a-wrapper`]: !children,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, rootClassName, contextClassName, mergedClassNames.root, hashId, cssVarCls);
//
if (!children && hasStatus && (text || hasStatusValue || !ignoreCount)) {
const statusTextColor = mergedStyle.color;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
ref: ref,
...restProps,
className: badgeClassName,
style: {
...mergedStyles.root,
...mergedStyle
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: statusCls,
style: {
...mergedStyles.indicator,
...statusStyle
}
}), showStatusTextNode && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
style: {
color: statusTextColor
},
className: `${prefixCls}-status-text`
}, text)));
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
ref: ref,
...restProps,
className: badgeClassName,
style: mergedStyles.root
}, children, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es["default"], {
visible: !isHidden,
motionName: `${prefixCls}-zoom`,
motionAppear: false,
motionDeadline: 1000
}, ({
className: motionClassName
}) => {
const scrollNumberPrefixCls = getPrefixCls('scroll-number', customizeScrollNumberPrefixCls);
const isDot = isDotRef.current;
const scrollNumberCls = (0,clsx.clsx)(mergedClassNames.indicator, {
[`${prefixCls}-dot`]: isDot,
[`${prefixCls}-count`]: !isDot,
[`${prefixCls}-count-sm`]: size === 'small',
[`${prefixCls}-multiple-words`]: !isDot && displayCount && displayCount.toString().length > 1,
[`${prefixCls}-status-${status}`]: !!status,
[`${prefixCls}-color-${color}`]: isInternalColor
});
let scrollNumberStyle = {
...mergedStyles.indicator,
...mergedStyle
};
if (color && !isInternalColor) {
scrollNumberStyle = scrollNumberStyle || {};
scrollNumberStyle.background = color;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(badge_ScrollNumber, {
prefixCls: scrollNumberPrefixCls,
show: !isHidden,
motionClassName: motionClassName,
className: scrollNumberCls,
count: displayCount,
title: titleNode,
style: scrollNumberStyle,
key: "scrollNumber"
}, displayNode);
}), statusTextNode);
});
if (true) {
Badge.displayName = 'Badge';
}
/* harmony default export */ var badge_Badge = (Badge);
// EXTERNAL MODULE: ./components/theme/util/genPresetColor.ts
var genPresetColor = __webpack_require__("./components/theme/util/genPresetColor.ts");
;// ./components/badge/style/ribbon.ts
// ============================== Ribbon ==============================
const genRibbonStyle = token => {
const {
antCls,
badgeFontHeight,
marginXS,
badgeRibbonOffset,
calc
} = token;
const ribbonPrefixCls = `${antCls}-ribbon`;
const ribbonWrapperPrefixCls = `${antCls}-ribbon-wrapper`;
const statusRibbonPreset = (0,genPresetColor["default"])(token, (colorKey, {
darkColor
}) => ({
[`&${ribbonPrefixCls}-color-${colorKey}`]: {
background: darkColor,
color: darkColor
}
}));
return {
[ribbonWrapperPrefixCls]: {
position: 'relative'
},
[ribbonPrefixCls]: {
...(0,components_style.resetComponent)(token),
position: 'absolute',
top: marginXS,
padding: `0 ${(0,cssinjs.unit)(token.paddingXS)}`,
color: token.colorPrimary,
lineHeight: (0,cssinjs.unit)(badgeFontHeight),
whiteSpace: 'nowrap',
backgroundColor: token.colorPrimary,
borderRadius: token.borderRadiusSM,
[`${ribbonPrefixCls}-content`]: {
color: token.badgeTextColor
},
[`${ribbonPrefixCls}-corner`]: {
position: 'absolute',
top: '100%',
width: badgeRibbonOffset,
height: badgeRibbonOffset,
color: 'currentcolor',
border: `${(0,cssinjs.unit)(calc(badgeRibbonOffset).div(2).equal())} solid`,
transform: token.badgeRibbonCornerTransform,
transformOrigin: 'top',
filter: token.badgeRibbonCornerFilter
},
...statusRibbonPreset,
[`&${ribbonPrefixCls}-placement-end`]: {
insetInlineEnd: calc(badgeRibbonOffset).mul(-1).equal(),
borderEndEndRadius: 0,
[`${ribbonPrefixCls}-corner`]: {
insetInlineEnd: 0,
borderInlineEndColor: 'transparent',
borderBlockEndColor: 'transparent'
}
},
[`&${ribbonPrefixCls}-placement-start`]: {
insetInlineStart: calc(badgeRibbonOffset).mul(-1).equal(),
borderEndStartRadius: 0,
[`${ribbonPrefixCls}-corner`]: {
insetInlineStart: 0,
borderBlockEndColor: 'transparent',
borderInlineStartColor: 'transparent'
}
},
// ====================== RTL =======================
'&-rtl': {
direction: 'rtl'
}
}
};
};
// ============================== Export ==============================
/* harmony default export */ var ribbon = ((0,genStyleUtils.genStyleHooks)(['Badge', 'Ribbon'], token => {
const badgeToken = (0,badge_style.prepareToken)(token);
return genRibbonStyle(badgeToken);
}, badge_style.prepareComponentToken));
;// ./components/badge/Ribbon.tsx
const Ribbon = props => {
const {
className,
prefixCls: customizePrefixCls,
style,
color,
children,
text,
placement = 'end',
rootClassName,
styles,
classNames: ribbonClassNames
} = props;
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('ribbon');
const prefixCls = getPrefixCls('ribbon', customizePrefixCls);
const wrapperCls = `${prefixCls}-wrapper`;
const [hashId, cssVarCls] = ribbon(prefixCls, wrapperCls);
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
placement
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, ribbonClassNames], [contextStyles, styles], {
props: mergedProps
});
const colorInPreset = isPresetColor(color, false);
const ribbonCls = (0,clsx.clsx)(prefixCls, `${prefixCls}-placement-${placement}`, {
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-color-${color}`]: colorInPreset
}, className, contextClassName, mergedClassNames.indicator);
const colorStyle = {};
const cornerColorStyle = {};
if (color && !colorInPreset) {
colorStyle.background = color;
cornerColorStyle.color = color;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(wrapperCls, rootClassName, hashId, cssVarCls, mergedClassNames.root),
style: mergedStyles.root
}, children, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(ribbonCls, hashId),
style: {
...colorStyle,
...mergedStyles.indicator,
...contextStyle,
...style
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}-content`, mergedClassNames.content),
style: mergedStyles.content
}, text), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-corner`,
style: cornerColorStyle
})));
};
if (true) {
Ribbon.displayName = 'Ribbon';
}
/* harmony default export */ var badge_Ribbon = (Ribbon);
;// ./components/badge/index.tsx
const components_badge_Badge = badge_Badge;
components_badge_Badge.Ribbon = badge_Ribbon;
/* harmony default export */ var components_badge = (components_badge_Badge);
;// ./components/breadcrumb/BreadcrumbContext.ts
const BreadcrumbContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createContext({});
/* harmony default export */ var breadcrumb_BreadcrumbContext = (BreadcrumbContext);
;// ./node_modules/@ant-design/icons-svg/es/asn/LeftOutlined.js
// This icon file is generated automatically.
var LeftOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z" } }] }, "name": "left", "theme": "outlined" };
/* harmony default export */ var asn_LeftOutlined = (LeftOutlined);
;// ./node_modules/@ant-design/icons/es/icons/LeftOutlined.js
function LeftOutlined_extends() { LeftOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return LeftOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const LeftOutlined_LeftOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], LeftOutlined_extends({}, props, {
ref: ref,
icon: asn_LeftOutlined
}));
/** */
const LeftOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(LeftOutlined_LeftOutlined);
if (true) {
LeftOutlined_RefIcon.displayName = 'LeftOutlined';
}
/* harmony default export */ var icons_LeftOutlined = (LeftOutlined_RefIcon);
// EXTERNAL MODULE: ./node_modules/@ant-design/icons/es/icons/RightOutlined.js + 1 modules
var RightOutlined = __webpack_require__("./node_modules/@ant-design/icons/es/icons/RightOutlined.js");
;// ./node_modules/@rc-component/dropdown/es/hooks/useAccessibility.js
const {
ESC,
TAB
} = KeyCode["default"];
function useAccessibility({
visible,
triggerRef,
onVisibleChange,
autoFocus,
overlayRef
}) {
const focusMenuRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
const handleCloseMenuAndReturnFocus = () => {
if (visible) {
triggerRef.current?.focus?.();
onVisibleChange?.(false);
}
};
const focusMenu = () => {
if (overlayRef.current?.focus) {
overlayRef.current.focus();
focusMenuRef.current = true;
return true;
}
return false;
};
const handleKeyDown = event => {
switch (event.keyCode) {
case ESC:
handleCloseMenuAndReturnFocus();
break;
case TAB:
{
let focusResult = false;
if (!focusMenuRef.current) {
focusResult = focusMenu();
}
if (focusResult) {
event.preventDefault();
} else {
handleCloseMenuAndReturnFocus();
}
break;
}
}
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (visible) {
window.addEventListener('keydown', handleKeyDown);
if (autoFocus) {
// FIXME: hack with raf
(0,raf["default"])(focusMenu, 3);
}
return () => {
window.removeEventListener('keydown', handleKeyDown);
focusMenuRef.current = false;
};
}
return () => {
focusMenuRef.current = false;
};
}, [visible]); // eslint-disable-line react-hooks/exhaustive-deps
}
;// ./node_modules/@rc-component/dropdown/es/Overlay.js
const Overlay_Overlay = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((props, ref) => {
const {
overlay,
arrow,
prefixCls
} = props;
const overlayNode = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
let overlayElement;
if (typeof overlay === 'function') {
overlayElement = overlay();
} else {
overlayElement = overlay;
}
return overlayElement;
}, [overlay]);
const composedRef = (0,es_ref.composeRef)(ref, (0,es_ref.getNodeRef)(overlayNode));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, arrow && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${prefixCls}-arrow`
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(overlayNode, {
ref: (0,es_ref.supportRef)(overlayNode) ? composedRef : undefined
}));
});
/* harmony default export */ var es_Overlay = (Overlay_Overlay);
;// ./node_modules/@rc-component/dropdown/es/placements.js
const autoAdjustOverflow = {
adjustX: 1,
adjustY: 1
};
const placements_targetOffset = [0, 0];
const placements_placements = {
topLeft: {
points: ['bl', 'tl'],
overflow: autoAdjustOverflow,
offset: [0, -4],
targetOffset: placements_targetOffset
},
top: {
points: ['bc', 'tc'],
overflow: autoAdjustOverflow,
offset: [0, -4],
targetOffset: placements_targetOffset
},
topRight: {
points: ['br', 'tr'],
overflow: autoAdjustOverflow,
offset: [0, -4],
targetOffset: placements_targetOffset
},
bottomLeft: {
points: ['tl', 'bl'],
overflow: autoAdjustOverflow,
offset: [0, 4],
targetOffset: placements_targetOffset
},
bottom: {
points: ['tc', 'bc'],
overflow: autoAdjustOverflow,
offset: [0, 4],
targetOffset: placements_targetOffset
},
bottomRight: {
points: ['tr', 'br'],
overflow: autoAdjustOverflow,
offset: [0, 4],
targetOffset: placements_targetOffset
}
};
/* harmony default export */ var dropdown_es_placements = (placements_placements);
;// ./node_modules/@rc-component/dropdown/es/Dropdown.js
function Dropdown_extends() { Dropdown_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Dropdown_extends.apply(this, arguments); }
const Dropdown = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
arrow = false,
prefixCls = 'rc-dropdown',
transitionName,
animation,
align,
placement = 'bottomLeft',
placements = dropdown_es_placements,
getPopupContainer,
showAction,
hideAction,
overlayClassName,
overlayStyle,
visible,
trigger = ['hover'],
autoFocus,
overlay,
children,
onVisibleChange,
...otherProps
} = props;
const [triggerVisible, setTriggerVisible] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState();
const mergedVisible = 'visible' in props ? visible : triggerVisible;
const mergedMotionName = animation ? `${prefixCls}-${animation}` : transitionName;
const triggerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
const overlayRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
const childRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useImperativeHandle(ref, () => triggerRef.current);
const handleVisibleChange = newVisible => {
setTriggerVisible(newVisible);
onVisibleChange?.(newVisible);
};
useAccessibility({
visible: mergedVisible,
triggerRef: childRef,
onVisibleChange: handleVisibleChange,
autoFocus,
overlayRef
});
const onClick = e => {
const {
onOverlayClick
} = props;
setTriggerVisible(false);
if (onOverlayClick) {
onOverlayClick(e);
}
};
const getMenuElement = () => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_Overlay, {
ref: overlayRef,
overlay: overlay,
prefixCls: prefixCls,
arrow: arrow
});
const getMenuElementOrLambda = () => {
if (typeof overlay === 'function') {
return getMenuElement;
}
return getMenuElement();
};
const getMinOverlayWidthMatchTrigger = () => {
const {
minOverlayWidthMatchTrigger,
alignPoint
} = props;
if ('minOverlayWidthMatchTrigger' in props) {
return minOverlayWidthMatchTrigger;
}
return !alignPoint;
};
const getOpenClassName = () => {
const {
openClassName
} = props;
if (openClassName !== undefined) {
return openClassName;
}
return `${prefixCls}-open`;
};
const childrenNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(children, {
className: (0,clsx.clsx)(children.props?.className, mergedVisible && getOpenClassName()),
ref: (0,es_ref.supportRef)(children) ? (0,es_ref.composeRef)(childRef, (0,es_ref.getNodeRef)(children)) : undefined
});
let triggerHideAction = hideAction;
if (!triggerHideAction && trigger.indexOf('contextMenu') !== -1) {
triggerHideAction = ['click'];
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(trigger_es, Dropdown_extends({
builtinPlacements: placements
}, otherProps, {
prefixCls: prefixCls,
ref: triggerRef,
popupClassName: (0,clsx.clsx)(overlayClassName, {
[`${prefixCls}-show-arrow`]: arrow
}),
popupStyle: overlayStyle,
action: trigger,
showAction: showAction,
hideAction: triggerHideAction,
popupPlacement: placement,
popupAlign: align,
popupMotion: {
motionName: mergedMotionName
},
popupVisible: mergedVisible,
stretch: getMinOverlayWidthMatchTrigger() ? 'minWidth' : '',
popup: getMenuElementOrLambda(),
onOpenChange: handleVisibleChange,
onPopupClick: onClick,
getPopupContainer: getPopupContainer
}), childrenNode);
});
/* harmony default export */ var es_Dropdown = (Dropdown);
;// ./node_modules/@rc-component/dropdown/es/index.js
/* harmony default export */ var dropdown_es = (es_Dropdown);
;// ./node_modules/@rc-component/menu/es/context/IdContext.js
const IdContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
function getMenuId(uuid, eventKey) {
return `${uuid}-${eventKey}`;
}
/**
* Get `data-menu-id`
*/
function useMenuId(eventKey) {
const id = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(IdContext);
return getMenuId(id, eventKey);
}
;// ./node_modules/@rc-component/menu/es/context/MenuContext.js
const MenuContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
function MenuContext_mergeProps(origin, target) {
const clone = {
...origin
};
Object.keys(target).forEach(key => {
const value = target[key];
if (value !== undefined) {
clone[key] = value;
}
});
return clone;
}
function InheritableContextProvider({
children,
locked,
...restProps
}) {
const context = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(MenuContext);
const inheritableContext = (0,useMemo["default"])(() => MenuContext_mergeProps(context, restProps), [context, restProps], (prev, next) => !locked && (prev[0] !== next[0] || !(0,isEqual["default"])(prev[1], next[1], true)));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(MenuContext.Provider, {
value: inheritableContext
}, children);
}
;// ./node_modules/@rc-component/menu/es/context/PathContext.js
const EmptyList = [];
// ========================= Path Register =========================
const PathRegisterContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
function useMeasure() {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PathRegisterContext);
}
// ========================= Path Tracker ==========================
const PathTrackerContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(EmptyList);
function useFullPath(eventKey) {
const parentKeyPath = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PathTrackerContext);
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => eventKey !== undefined ? [...parentKeyPath, eventKey] : parentKeyPath, [parentKeyPath, eventKey]);
}
// =========================== Path User ===========================
const PathUserContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
;// ./node_modules/@rc-component/menu/es/context/PrivateContext.js
const PrivateContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({});
/* harmony default export */ var context_PrivateContext = (PrivateContext);
;// ./node_modules/@rc-component/menu/es/hooks/useAccessibility.js
// destruct to reduce minify size
const {
LEFT,
RIGHT,
UP,
DOWN,
ENTER,
ESC: useAccessibility_ESC,
HOME,
END
} = KeyCode["default"];
const ArrowKeys = [UP, DOWN, LEFT, RIGHT];
function useAccessibility_getOffset(mode, isRootLevel, isRtl, which) {
const prev = 'prev';
const next = 'next';
const children = 'children';
const parent = 'parent';
// Inline enter is special that we use unique operation
if (mode === 'inline' && which === ENTER) {
return {
inlineTrigger: true
};
}
const inline = {
[UP]: prev,
[DOWN]: next
};
const horizontal = {
[LEFT]: isRtl ? next : prev,
[RIGHT]: isRtl ? prev : next,
[DOWN]: children,
[ENTER]: children
};
const vertical = {
[UP]: prev,
[DOWN]: next,
[ENTER]: children,
[useAccessibility_ESC]: parent,
[LEFT]: isRtl ? children : parent,
[RIGHT]: isRtl ? parent : children
};
const offsets = {
inline,
horizontal,
vertical,
inlineSub: inline,
horizontalSub: vertical,
verticalSub: vertical
};
const type = offsets[`${mode}${isRootLevel ? '' : 'Sub'}`]?.[which];
switch (type) {
case prev:
return {
offset: -1,
sibling: true
};
case next:
return {
offset: 1,
sibling: true
};
case parent:
return {
offset: -1,
sibling: false
};
case children:
return {
offset: 1,
sibling: false
};
default:
return null;
}
}
function findContainerUL(element) {
let current = element;
while (current) {
if (current.getAttribute('data-menu-list')) {
return current;
}
current = current.parentElement;
}
// Normally should not reach this line
/* istanbul ignore next */
return null;
}
/**
* Find focused element within element set provided
*/
function getFocusElement(activeElement, elements) {
let current = activeElement || document.activeElement;
while (current) {
if (elements.has(current)) {
return current;
}
current = current.parentElement;
}
return null;
}
/**
* Get focusable elements from the element set under provided container
*/
function getFocusableElements(container, elements) {
const list = getFocusNodeList(container, true);
return list.filter(ele => elements.has(ele));
}
function getNextFocusElement(parentQueryContainer, elements, focusMenuElement, offset = 1) {
// Key on the menu item will not get validate parent container
if (!parentQueryContainer) {
return null;
}
// List current level menu item elements
const sameLevelFocusableMenuElementList = getFocusableElements(parentQueryContainer, elements);
// Find next focus index
const count = sameLevelFocusableMenuElementList.length;
let focusIndex = sameLevelFocusableMenuElementList.findIndex(ele => focusMenuElement === ele);
if (offset < 0) {
if (focusIndex === -1) {
focusIndex = count - 1;
} else {
focusIndex -= 1;
}
} else if (offset > 0) {
focusIndex += 1;
}
focusIndex = (focusIndex + count) % count;
// Focus menu item
return sameLevelFocusableMenuElementList[focusIndex];
}
const refreshElements = (keys, id) => {
const elements = new Set();
const key2element = new Map();
const element2key = new Map();
keys.forEach(key => {
const element = document.querySelector(`[data-menu-id='${getMenuId(id, key)}']`);
if (element) {
elements.add(element);
element2key.set(element, key);
key2element.set(key, element);
}
});
return {
elements,
key2element,
element2key
};
};
function useAccessibility_useAccessibility(mode, activeKey, isRtl, id, containerRef, getKeys, getKeyPath, triggerActiveKey, triggerAccessibilityOpen, originOnKeyDown) {
const rafRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
const activeRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
activeRef.current = activeKey;
const cleanRaf = () => {
raf["default"].cancel(rafRef.current);
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => () => {
cleanRaf();
}, []);
return e => {
const {
which
} = e;
if ([...ArrowKeys, ENTER, useAccessibility_ESC, HOME, END].includes(which)) {
const keys = getKeys();
let refreshedElements = refreshElements(keys, id);
const {
elements,
key2element,
element2key
} = refreshedElements;
// First we should find current focused MenuItem/SubMenu element
const activeElement = key2element.get(activeKey);
const focusMenuElement = getFocusElement(activeElement, elements);
const focusMenuKey = element2key.get(focusMenuElement);
const offsetObj = useAccessibility_getOffset(mode, getKeyPath(focusMenuKey, true).length === 1, isRtl, which);
// Some mode do not have fully arrow operation like inline
if (!offsetObj && which !== HOME && which !== END) {
return;
}
// Arrow prevent default to avoid page scroll
if (ArrowKeys.includes(which) || [HOME, END].includes(which)) {
e.preventDefault();
}
const tryFocus = menuElement => {
if (menuElement) {
let focusTargetElement = menuElement;
// Focus to link instead of menu item if possible
const link = menuElement.querySelector('a');
if (link?.getAttribute('href')) {
focusTargetElement = link;
}
const targetKey = element2key.get(menuElement);
triggerActiveKey(targetKey);
/**
* Do not `useEffect` here since `tryFocus` may trigger async
* which makes React sync update the `activeKey`
* that force render before `useRef` set the next activeKey
*/
cleanRaf();
rafRef.current = (0,raf["default"])(() => {
if (activeRef.current === targetKey) {
focusTargetElement.focus();
}
});
}
};
if ([HOME, END].includes(which) || offsetObj.sibling || !focusMenuElement) {
// ========================== Sibling ==========================
// Find walkable focus menu element container
let parentQueryContainer;
if (!focusMenuElement || mode === 'inline') {
parentQueryContainer = containerRef.current;
} else {
parentQueryContainer = findContainerUL(focusMenuElement);
}
// Get next focus element
let targetElement;
const focusableElements = getFocusableElements(parentQueryContainer, elements);
if (which === HOME) {
targetElement = focusableElements[0];
} else if (which === END) {
targetElement = focusableElements[focusableElements.length - 1];
} else {
targetElement = getNextFocusElement(parentQueryContainer, elements, focusMenuElement, offsetObj.offset);
}
// Focus menu item
tryFocus(targetElement);
// ======================= InlineTrigger =======================
} else if (offsetObj.inlineTrigger) {
// Inline trigger no need switch to sub menu item
triggerAccessibilityOpen(focusMenuKey);
// =========================== Level ===========================
} else if (offsetObj.offset > 0) {
triggerAccessibilityOpen(focusMenuKey, true);
cleanRaf();
rafRef.current = (0,raf["default"])(() => {
// Async should resync elements
refreshedElements = refreshElements(keys, id);
const controlId = focusMenuElement.getAttribute('aria-controls');
const subQueryContainer = document.getElementById(controlId);
// Get sub focusable menu item
const targetElement = getNextFocusElement(subQueryContainer, refreshedElements.elements);
// Focus menu item
tryFocus(targetElement);
}, 5);
} else if (offsetObj.offset < 0) {
const keyPath = getKeyPath(focusMenuKey, true);
const parentKey = keyPath[keyPath.length - 2];
const parentMenuElement = key2element.get(parentKey);
// Focus menu item
triggerAccessibilityOpen(parentKey, false);
tryFocus(parentMenuElement);
}
}
// Pass origin key down event
originOnKeyDown?.(e);
};
}
;// ./node_modules/@rc-component/menu/es/utils/timeUtil.js
function nextSlice(callback) {
/* istanbul ignore next */
Promise.resolve().then(callback);
}
;// ./node_modules/@rc-component/menu/es/hooks/useKeyRecords.js
const PATH_SPLIT = '__RC_UTIL_PATH_SPLIT__';
const getPathStr = keyPath => keyPath.join(PATH_SPLIT);
const getPathKeys = keyPathStr => keyPathStr.split(PATH_SPLIT);
const OVERFLOW_KEY = 'rc-menu-more';
function useKeyRecords() {
const [, internalForceUpdate] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState({});
const key2pathRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(new Map());
const path2keyRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(new Map());
const [overflowKeys, setOverflowKeys] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([]);
const updateRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(0);
const destroyRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
const forceUpdate = () => {
if (!destroyRef.current) {
internalForceUpdate({});
}
};
const registerPath = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)((key, keyPath) => {
// Warning for invalidate or duplicated `key`
if (true) {
(0,warning["default"])(!key2pathRef.current.has(key), `Duplicated key '${key}' used in Menu by path [${keyPath.join(' > ')}]`);
}
// Fill map
const connectedPath = getPathStr(keyPath);
path2keyRef.current.set(connectedPath, key);
key2pathRef.current.set(key, connectedPath);
updateRef.current += 1;
const id = updateRef.current;
nextSlice(() => {
if (id === updateRef.current) {
forceUpdate();
}
});
}, []);
const unregisterPath = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)((key, keyPath) => {
const connectedPath = getPathStr(keyPath);
path2keyRef.current.delete(connectedPath);
key2pathRef.current.delete(key);
}, []);
const refreshOverflowKeys = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(keys => {
setOverflowKeys(keys);
}, []);
const getKeyPath = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)((eventKey, includeOverflow) => {
const fullPath = key2pathRef.current.get(eventKey) || '';
const keys = getPathKeys(fullPath);
if (includeOverflow && overflowKeys.includes(keys[0])) {
keys.unshift(OVERFLOW_KEY);
}
return keys;
}, [overflowKeys]);
const isSubPathKey = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)((pathKeys, eventKey) => pathKeys.filter(item => item !== undefined).some(pathKey => {
const pathKeyList = getKeyPath(pathKey, true);
return pathKeyList.includes(eventKey);
}), [getKeyPath]);
const getKeys = () => {
const keys = [...key2pathRef.current.keys()];
if (overflowKeys.length) {
keys.push(OVERFLOW_KEY);
}
return keys;
};
/**
* Find current key related child path keys
*/
const getSubPathKeys = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(key => {
const connectedPath = `${key2pathRef.current.get(key)}${PATH_SPLIT}`;
const pathKeys = new Set();
[...path2keyRef.current.keys()].forEach(pathKey => {
if (pathKey.startsWith(connectedPath)) {
pathKeys.add(path2keyRef.current.get(pathKey));
}
});
return pathKeys;
}, []);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => () => {
destroyRef.current = true;
}, []);
return {
// Register
registerPath,
unregisterPath,
refreshOverflowKeys,
// Util
isSubPathKey,
getKeyPath,
getKeys,
getSubPathKeys
};
}
;// ./node_modules/@rc-component/menu/es/hooks/useMemoCallback.js
/**
* Cache callback function that always return same ref instead.
* This is used for context optimization.
*/
function useMemoCallback(func) {
const funRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(func);
funRef.current = func;
const callback = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback((...args) => funRef.current?.(...args), []);
return func ? callback : undefined;
}
;// ./node_modules/@rc-component/menu/es/hooks/useActive.js
function useActive(eventKey, disabled, onMouseEnter, onMouseLeave) {
const {
// Active
activeKey,
onActive,
onInactive
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(MenuContext);
const ret = {
active: activeKey === eventKey
};
// Skip when disabled
if (!disabled) {
ret.onMouseEnter = domEvent => {
onMouseEnter?.({
key: eventKey,
domEvent
});
onActive(eventKey);
};
ret.onMouseLeave = domEvent => {
onMouseLeave?.({
key: eventKey,
domEvent
});
onInactive(eventKey);
};
}
return ret;
}
;// ./node_modules/@rc-component/menu/es/hooks/useDirectionStyle.js
function useDirectionStyle(level) {
const {
mode,
rtl,
inlineIndent
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(MenuContext);
if (mode !== 'inline') {
return null;
}
const len = level;
return rtl ? {
paddingRight: len * inlineIndent
} : {
paddingLeft: len * inlineIndent
};
}
;// ./node_modules/@rc-component/menu/es/Icon.js
function Icon({
icon,
props,
children
}) {
let iconNode;
if (icon === null || icon === false) {
return null;
}
if (typeof icon === 'function') {
iconNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icon, {
...props
});
} else if (typeof icon !== "boolean") {
// Compatible for origin definition
iconNode = icon;
}
return iconNode || children || null;
}
;// ./node_modules/@rc-component/menu/es/utils/warnUtil.js
/**
* `onClick` event return `info.item` which point to react node directly.
* We should warning this since it will not work on FC.
*/
function warnItemProp({
item,
...restInfo
}) {
Object.defineProperty(restInfo, 'item', {
get: () => {
(0,warning["default"])(false, '`info.item` is deprecated since we will move to function component that not provides React Node instance in future.');
return item;
}
});
return restInfo;
}
;// ./node_modules/@rc-component/menu/es/MenuItem.js
function MenuItem_extends() { MenuItem_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return MenuItem_extends.apply(this, arguments); }
// Since Menu event provide the `info.item` which point to the MenuItem node instance.
// We have to use class component here.
// This should be removed from doc & api in future.
class LegacyMenuItem extends external_root_React_commonjs2_react_commonjs_react_amd_react_.Component {
render() {
const {
title,
attribute,
elementRef,
...restProps
} = this.props;
// Here the props are eventually passed to the DOM element.
// React does not recognize non-standard attributes.
// Therefore, remove the props that is not used here.
// ref: https://github.com/ant-design/ant-design/issues/41395
const passedProps = (0,omit["default"])(restProps, ['eventKey', 'popupClassName', 'popupOffset', 'onTitleClick']);
(0,warning["default"])(!attribute, '`attribute` of Menu.Item is deprecated. Please pass attribute directly.');
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(overflow_es.Item, MenuItem_extends({}, attribute, {
title: typeof title === 'string' ? title : undefined
}, passedProps, {
ref: elementRef
}));
}
}
/**
* Real Menu Item component
*/
const InternalMenuItem = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
style,
className,
eventKey,
warnKey,
disabled,
itemIcon,
children,
// Aria
role,
// Active
onMouseEnter,
onMouseLeave,
onClick,
onKeyDown,
onFocus,
...restProps
} = props;
const domDataId = useMenuId(eventKey);
const {
prefixCls,
onItemClick,
disabled: contextDisabled,
overflowDisabled,
// Icon
itemIcon: contextItemIcon,
// Select
selectedKeys,
// Active
onActive
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(MenuContext);
const {
_internalRenderMenuItem
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(context_PrivateContext);
const itemCls = `${prefixCls}-item`;
const legacyMenuItemRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
const elementRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
const mergedDisabled = contextDisabled || disabled;
const mergedEleRef = (0,es_ref.useComposeRef)(ref, elementRef);
const connectedKeys = useFullPath(eventKey);
// ================================ Warn ================================
if ( true && warnKey) {
(0,warning["default"])(false, 'MenuItem should not leave undefined `key`.');
}
// ============================= Info =============================
const getEventInfo = e => {
return {
key: eventKey,
// Note: For legacy code is reversed which not like other antd component
keyPath: [...connectedKeys].reverse(),
item: legacyMenuItemRef.current,
domEvent: e
};
};
// ============================= Icon =============================
const mergedItemIcon = itemIcon || contextItemIcon;
// ============================ Active ============================
const {
active,
...activeProps
} = useActive(eventKey, mergedDisabled, onMouseEnter, onMouseLeave);
// ============================ Select ============================
const selected = selectedKeys.includes(eventKey);
// ======================== DirectionStyle ========================
const directionStyle = useDirectionStyle(connectedKeys.length);
// ============================ Events ============================
const onInternalClick = e => {
if (mergedDisabled) {
return;
}
const info = getEventInfo(e);
onClick?.(warnItemProp(info));
onItemClick(info);
};
const onInternalKeyDown = e => {
onKeyDown?.(e);
if (e.which === KeyCode["default"].ENTER) {
const info = getEventInfo(e);
// Legacy. Key will also trigger click event
onClick?.(warnItemProp(info));
onItemClick(info);
}
};
/**
* Used for accessibility. Helper will focus element without key board.
* We should manually trigger an active
*/
const onInternalFocus = e => {
onActive(eventKey);
onFocus?.(e);
};
// ============================ Render ============================
const optionRoleProps = {};
if (props.role === 'option') {
optionRoleProps['aria-selected'] = selected;
}
let renderNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(LegacyMenuItem, MenuItem_extends({
ref: legacyMenuItemRef,
elementRef: mergedEleRef,
role: role === null ? 'none' : role || 'menuitem',
tabIndex: disabled ? null : -1,
"data-menu-id": overflowDisabled && domDataId ? null : domDataId
}, (0,omit["default"])(restProps, ['extra']), activeProps, optionRoleProps, {
component: "li",
"aria-disabled": disabled,
style: {
...directionStyle,
...style
},
className: (0,clsx.clsx)(itemCls, {
[`${itemCls}-active`]: active,
[`${itemCls}-selected`]: selected,
[`${itemCls}-disabled`]: mergedDisabled
}, className),
onClick: onInternalClick,
onKeyDown: onInternalKeyDown,
onFocus: onInternalFocus
}), children, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Icon, {
props: {
...props,
isSelected: selected
},
icon: mergedItemIcon
}));
if (_internalRenderMenuItem) {
renderNode = _internalRenderMenuItem(renderNode, props, {
selected
});
}
return renderNode;
});
function MenuItem(props, ref) {
const {
eventKey
} = props;
// ==================== Record KeyPath ====================
const measure = useMeasure();
const connectedKeyPath = useFullPath(eventKey);
// eslint-disable-next-line consistent-return
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (measure) {
measure.registerPath(eventKey, connectedKeyPath);
return () => {
measure.unregisterPath(eventKey, connectedKeyPath);
};
}
}, [connectedKeyPath]);
if (measure) {
return null;
}
// ======================== Render ========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(InternalMenuItem, MenuItem_extends({}, props, {
ref: ref
}));
}
/* harmony default export */ var es_MenuItem = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(MenuItem));
;// ./node_modules/@rc-component/menu/es/SubMenu/SubMenuList.js
function SubMenuList_extends() { SubMenuList_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return SubMenuList_extends.apply(this, arguments); }
const InternalSubMenuList = ({
className,
children,
...restProps
}, ref) => {
const {
prefixCls,
mode,
rtl
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(MenuContext);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("ul", SubMenuList_extends({
className: (0,clsx.clsx)(prefixCls, rtl && `${prefixCls}-rtl`, `${prefixCls}-sub`, `${prefixCls}-${mode === 'inline' ? 'inline' : 'vertical'}`, className),
role: "menu"
}, restProps, {
"data-menu-list": true,
ref: ref
}), children);
};
const SubMenuList = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(InternalSubMenuList);
if (true) {
SubMenuList.displayName = 'SubMenuList';
}
/* harmony default export */ var SubMenu_SubMenuList = (SubMenuList);
;// ./node_modules/@rc-component/menu/es/utils/commonUtil.js
function parseChildren(children, keyPath) {
return (0,toArray["default"])(children).map((child, index) => {
if ( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(child)) {
const {
key
} = child;
let eventKey = child.props?.eventKey ?? key;
const emptyKey = eventKey === null || eventKey === undefined;
if (emptyKey) {
eventKey = `tmp_key-${[...keyPath, index].join('-')}`;
}
const cloneProps = {
key: eventKey,
eventKey
};
if ( true && emptyKey) {
cloneProps.warnKey = true;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement(child, cloneProps);
}
return child;
});
}
;// ./node_modules/@rc-component/menu/es/placements.js
const placements_autoAdjustOverflow = {
adjustX: 1,
adjustY: 1
};
const es_placements_placements = {
topLeft: {
points: ['bl', 'tl'],
overflow: placements_autoAdjustOverflow
},
topRight: {
points: ['br', 'tr'],
overflow: placements_autoAdjustOverflow
},
bottomLeft: {
points: ['tl', 'bl'],
overflow: placements_autoAdjustOverflow
},
bottomRight: {
points: ['tr', 'br'],
overflow: placements_autoAdjustOverflow
},
leftTop: {
points: ['tr', 'tl'],
overflow: placements_autoAdjustOverflow
},
leftBottom: {
points: ['br', 'bl'],
overflow: placements_autoAdjustOverflow
},
rightTop: {
points: ['tl', 'tr'],
overflow: placements_autoAdjustOverflow
},
rightBottom: {
points: ['bl', 'br'],
overflow: placements_autoAdjustOverflow
}
};
const placementsRtl = {
topLeft: {
points: ['bl', 'tl'],
overflow: placements_autoAdjustOverflow
},
topRight: {
points: ['br', 'tr'],
overflow: placements_autoAdjustOverflow
},
bottomLeft: {
points: ['tl', 'bl'],
overflow: placements_autoAdjustOverflow
},
bottomRight: {
points: ['tr', 'br'],
overflow: placements_autoAdjustOverflow
},
rightTop: {
points: ['tr', 'tl'],
overflow: placements_autoAdjustOverflow
},
rightBottom: {
points: ['br', 'bl'],
overflow: placements_autoAdjustOverflow
},
leftTop: {
points: ['tl', 'tr'],
overflow: placements_autoAdjustOverflow
},
leftBottom: {
points: ['bl', 'br'],
overflow: placements_autoAdjustOverflow
}
};
/* harmony default export */ var menu_es_placements = (es_placements_placements);
;// ./node_modules/@rc-component/menu/es/utils/motionUtil.js
function motionUtil_getMotion(mode, motion, defaultMotions) {
if (motion) {
return motion;
}
if (defaultMotions) {
return defaultMotions[mode] || defaultMotions.other;
}
return undefined;
}
;// ./node_modules/@rc-component/menu/es/SubMenu/PopupTrigger.js
const popupPlacementMap = {
horizontal: 'bottomLeft',
vertical: 'rightTop',
'vertical-left': 'rightTop',
'vertical-right': 'leftTop'
};
function PopupTrigger({
prefixCls,
visible,
children,
popup,
popupStyle,
popupClassName,
popupOffset,
disabled,
mode,
onVisibleChange
}) {
const {
getPopupContainer,
rtl,
subMenuOpenDelay,
subMenuCloseDelay,
builtinPlacements,
triggerSubMenuAction,
forceSubMenuRender,
rootClassName,
// Motion
motion,
defaultMotions
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(MenuContext);
const [innerVisible, setInnerVisible] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const placement = rtl ? {
...placementsRtl,
...builtinPlacements
} : {
...es_placements_placements,
...builtinPlacements
};
const popupPlacement = popupPlacementMap[mode];
const targetMotion = motionUtil_getMotion(mode, motion, defaultMotions);
const targetMotionRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(targetMotion);
if (mode !== 'inline') {
/**
* PopupTrigger is only used for vertical and horizontal types.
* When collapsed is unfolded, the inline animation will destroy the vertical animation.
*/
targetMotionRef.current = targetMotion;
}
const mergedMotion = {
...targetMotionRef.current,
leavedClassName: `${prefixCls}-hidden`,
removeOnLeave: false,
motionAppear: true
};
// Delay to change visible
const visibleRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
visibleRef.current = (0,raf["default"])(() => {
setInnerVisible(visible);
});
return () => {
raf["default"].cancel(visibleRef.current);
};
}, [visible]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(trigger_es, {
prefixCls: prefixCls,
popupClassName: (0,clsx.clsx)(`${prefixCls}-popup`, {
[`${prefixCls}-rtl`]: rtl
}, popupClassName, rootClassName),
stretch: mode === 'horizontal' ? 'minWidth' : null,
getPopupContainer: getPopupContainer,
builtinPlacements: placement,
popupPlacement: popupPlacement,
popupVisible: innerVisible,
popup: popup,
popupStyle: popupStyle,
popupAlign: popupOffset && {
offset: popupOffset
},
action: disabled ? [] : [triggerSubMenuAction],
mouseEnterDelay: subMenuOpenDelay,
mouseLeaveDelay: subMenuCloseDelay,
onPopupVisibleChange: onVisibleChange,
forceRender: forceSubMenuRender,
popupMotion: mergedMotion,
fresh: true
}, children);
}
;// ./node_modules/@rc-component/menu/es/SubMenu/InlineSubMenuList.js
function InlineSubMenuList_extends() { InlineSubMenuList_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return InlineSubMenuList_extends.apply(this, arguments); }
function InlineSubMenuList({
id,
open,
keyPath,
children
}) {
const fixedMode = 'inline';
const {
prefixCls,
forceSubMenuRender,
motion,
defaultMotions,
mode
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(MenuContext);
// Always use latest mode check
const sameModeRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
sameModeRef.current = mode === fixedMode;
// We record `destroy` mark here since when mode change from `inline` to others.
// The inline list should remove when motion end.
const [destroy, setDestroy] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(!sameModeRef.current);
const mergedOpen = sameModeRef.current ? open : false;
// ================================= Effect =================================
// Reset destroy state when mode change back
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (sameModeRef.current) {
setDestroy(false);
}
}, [mode]);
// ================================= Render =================================
const mergedMotion = {
...motionUtil_getMotion(fixedMode, motion, defaultMotions)
};
// No need appear since nest inlineCollapse changed
if (keyPath.length > 1) {
mergedMotion.motionAppear = false;
}
// Hide inline list when mode changed and motion end
const originOnVisibleChanged = mergedMotion.onVisibleChanged;
mergedMotion.onVisibleChanged = newVisible => {
if (!sameModeRef.current && !newVisible) {
setDestroy(true);
}
return originOnVisibleChanged?.(newVisible);
};
if (destroy) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(InheritableContextProvider, {
mode: fixedMode,
locked: !sameModeRef.current
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es["default"], InlineSubMenuList_extends({
visible: mergedOpen
}, mergedMotion, {
forceRender: forceSubMenuRender,
removeOnLeave: false,
leavedClassName: `${prefixCls}-hidden`
}), ({
className: motionClassName,
style: motionStyle
}) => {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(SubMenu_SubMenuList, {
id: id,
className: motionClassName,
style: motionStyle
}, children);
}));
}
;// ./node_modules/@rc-component/menu/es/SubMenu/index.js
function SubMenu_extends() { SubMenu_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return SubMenu_extends.apply(this, arguments); }
const InternalSubMenu = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
style,
className,
styles,
classNames: menuClassNames,
title,
eventKey,
warnKey,
disabled,
internalPopupClose,
children,
// Icons
itemIcon,
expandIcon,
// Popup
popupClassName,
popupOffset,
popupStyle,
// Events
onClick,
onMouseEnter,
onMouseLeave,
onTitleClick,
onTitleMouseEnter,
onTitleMouseLeave,
popupRender: propsPopupRender,
...restProps
} = props;
const domDataId = useMenuId(eventKey);
const {
prefixCls,
mode,
openKeys,
// Disabled
disabled: contextDisabled,
overflowDisabled,
// ActiveKey
activeKey,
// SelectKey
selectedKeys,
// Icon
itemIcon: contextItemIcon,
expandIcon: contextExpandIcon,
// Events
onItemClick,
onOpenChange,
onActive,
popupRender: contextPopupRender
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(MenuContext);
const {
_internalRenderSubMenuItem
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(context_PrivateContext);
const {
isSubPathKey
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PathUserContext);
const connectedPath = useFullPath();
const subMenuPrefixCls = `${prefixCls}-submenu`;
const mergedDisabled = contextDisabled || disabled;
const elementRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
const popupRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
// ================================ Warn ================================
if ( true && warnKey) {
(0,warning["default"])(false, 'SubMenu should not leave undefined `key`.');
}
// ================================ Icon ================================
const mergedItemIcon = itemIcon ?? contextItemIcon;
const mergedExpandIcon = expandIcon ?? contextExpandIcon;
// ================================ Open ================================
const originOpen = openKeys.includes(eventKey);
const open = !overflowDisabled && originOpen;
// =============================== Select ===============================
const childrenSelected = isSubPathKey(selectedKeys, eventKey);
// =============================== Active ===============================
const {
active,
...activeProps
} = useActive(eventKey, mergedDisabled, onTitleMouseEnter, onTitleMouseLeave);
// Fallback of active check to avoid hover on menu title or disabled item
const [childrenActive, setChildrenActive] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const triggerChildrenActive = newActive => {
if (!mergedDisabled) {
setChildrenActive(newActive);
}
};
const onInternalMouseEnter = domEvent => {
triggerChildrenActive(true);
onMouseEnter?.({
key: eventKey,
domEvent
});
};
const onInternalMouseLeave = domEvent => {
triggerChildrenActive(false);
onMouseLeave?.({
key: eventKey,
domEvent
});
};
const mergedActive = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (active) {
return active;
}
if (mode !== 'inline') {
return childrenActive || isSubPathKey([activeKey], eventKey);
}
return false;
}, [mode, active, activeKey, childrenActive, eventKey, isSubPathKey]);
// ========================== DirectionStyle ==========================
const directionStyle = useDirectionStyle(connectedPath.length);
// =============================== Events ===============================
// >>>> Title click
const onInternalTitleClick = e => {
// Skip if disabled
if (mergedDisabled) {
return;
}
onTitleClick?.({
key: eventKey,
domEvent: e
});
// Trigger open by click when mode is `inline`
if (mode === 'inline') {
onOpenChange(eventKey, !originOpen);
}
};
// >>>> Context for children click
const onMergedItemClick = useMemoCallback(info => {
onClick?.(warnItemProp(info));
onItemClick(info);
});
// >>>>> Visible change
const onPopupVisibleChange = newVisible => {
if (mode !== 'inline') {
onOpenChange(eventKey, newVisible);
}
};
/**
* Used for accessibility. Helper will focus element without key board.
* We should manually trigger an active
*/
const onInternalFocus = () => {
onActive(eventKey);
};
// =============================== Render ===============================
const popupId = domDataId && `${domDataId}-popup`;
const expandIconNode = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Icon, {
icon: mode !== 'horizontal' ? mergedExpandIcon : undefined,
props: {
...props,
isOpen: open,
// [Legacy] Not sure why need this mark
isSubMenu: true
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("i", {
className: `${subMenuPrefixCls}-arrow`
})), [mode, mergedExpandIcon, props, open, subMenuPrefixCls]);
// >>>>> Title
let titleNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", SubMenu_extends({
role: "menuitem",
style: directionStyle,
className: `${subMenuPrefixCls}-title`,
tabIndex: mergedDisabled ? null : -1,
ref: elementRef,
title: typeof title === 'string' ? title : null,
"data-menu-id": overflowDisabled && domDataId ? null : domDataId,
"aria-expanded": open,
"aria-haspopup": true,
"aria-controls": popupId,
"aria-disabled": mergedDisabled,
onClick: onInternalTitleClick,
onFocus: onInternalFocus
}, activeProps), title, expandIconNode);
// Cache mode if it change to `inline` which do not have popup motion
const triggerModeRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(mode);
if (mode !== 'inline' && connectedPath.length > 1) {
triggerModeRef.current = 'vertical';
} else {
triggerModeRef.current = mode;
}
const popupContentTriggerMode = triggerModeRef.current;
const renderPopupContent = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const originNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(InheritableContextProvider, {
classNames: menuClassNames,
styles: styles,
mode: popupContentTriggerMode === 'horizontal' ? 'vertical' : popupContentTriggerMode
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(SubMenu_SubMenuList, {
id: popupId,
ref: popupRef
}, children));
const mergedPopupRender = propsPopupRender || contextPopupRender;
if (mergedPopupRender) {
const node = mergedPopupRender(originNode, {
item: props,
keys: connectedPath
});
return node;
}
return originNode;
}, [propsPopupRender, contextPopupRender, connectedPath, popupId, children, props, popupContentTriggerMode]);
if (!overflowDisabled) {
const triggerMode = triggerModeRef.current;
// Still wrap with Trigger here since we need avoid react re-mount dom node
// Which makes motion failed
titleNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PopupTrigger, {
mode: triggerMode,
prefixCls: subMenuPrefixCls,
visible: !internalPopupClose && open && mode !== 'inline',
popupClassName: popupClassName,
popupOffset: popupOffset,
popupStyle: popupStyle,
popup: renderPopupContent,
disabled: mergedDisabled,
onVisibleChange: onPopupVisibleChange
}, titleNode);
}
// >>>>> List node
let listNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(overflow_es.Item, SubMenu_extends({
ref: ref,
role: "none"
}, restProps, {
component: "li",
style: style,
className: (0,clsx.clsx)(subMenuPrefixCls, `${subMenuPrefixCls}-${mode}`, className, {
[`${subMenuPrefixCls}-open`]: open,
[`${subMenuPrefixCls}-active`]: mergedActive,
[`${subMenuPrefixCls}-selected`]: childrenSelected,
[`${subMenuPrefixCls}-disabled`]: mergedDisabled
}),
onMouseEnter: onInternalMouseEnter,
onMouseLeave: onInternalMouseLeave
}), titleNode, !overflowDisabled && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(InlineSubMenuList, {
id: popupId,
open: open,
keyPath: connectedPath
}, children));
if (_internalRenderSubMenuItem) {
listNode = _internalRenderSubMenuItem(listNode, props, {
selected: childrenSelected,
active: mergedActive,
open,
disabled: mergedDisabled
});
}
// >>>>> Render
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(InheritableContextProvider, {
classNames: menuClassNames,
styles: styles,
onItemClick: onMergedItemClick,
mode: mode === 'horizontal' ? 'vertical' : mode,
itemIcon: mergedItemIcon,
expandIcon: mergedExpandIcon
}, listNode);
});
const SubMenu = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
eventKey,
children
} = props;
const connectedKeyPath = useFullPath(eventKey);
const childList = parseChildren(children, connectedKeyPath);
// ==================== Record KeyPath ====================
const measure = useMeasure();
// eslint-disable-next-line consistent-return
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (measure) {
measure.registerPath(eventKey, connectedKeyPath);
return () => {
measure.unregisterPath(eventKey, connectedKeyPath);
};
}
}, [connectedKeyPath]);
let renderNode;
// ======================== Render ========================
if (measure) {
renderNode = childList;
} else {
renderNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(InternalSubMenu, SubMenu_extends({
ref: ref
}, props), childList);
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PathTrackerContext.Provider, {
value: connectedKeyPath
}, renderNode);
});
if (true) {
SubMenu.displayName = 'SubMenu';
}
/* harmony default export */ var es_SubMenu = (SubMenu);
;// ./node_modules/@rc-component/menu/es/Divider.js
function Divider({
className,
style
}) {
const {
prefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(MenuContext);
const measure = useMeasure();
if (measure) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("li", {
role: "separator",
className: (0,clsx.clsx)(`${prefixCls}-item-divider`, className),
style: style
});
}
;// ./node_modules/@rc-component/menu/es/MenuItemGroup.js
function MenuItemGroup_extends() { MenuItemGroup_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return MenuItemGroup_extends.apply(this, arguments); }
const InternalMenuItemGroup = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
className,
title,
eventKey,
children,
...restProps
} = props;
const {
prefixCls,
classNames: menuClassNames,
styles
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(MenuContext);
const groupPrefixCls = `${prefixCls}-item-group`;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("li", MenuItemGroup_extends({
ref: ref,
role: "presentation"
}, restProps, {
onClick: e => e.stopPropagation(),
className: (0,clsx.clsx)(groupPrefixCls, className)
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
role: "presentation",
className: (0,clsx.clsx)(`${groupPrefixCls}-title`, menuClassNames?.listTitle),
style: styles?.listTitle,
title: typeof title === 'string' ? title : undefined
}, title), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("ul", {
role: "group",
className: (0,clsx.clsx)(`${groupPrefixCls}-list`, menuClassNames?.list),
style: styles?.list
}, children));
});
const MenuItemGroup = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
eventKey,
children
} = props;
const connectedKeyPath = useFullPath(eventKey);
const childList = parseChildren(children, connectedKeyPath);
const measure = useMeasure();
if (measure) {
return childList;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(InternalMenuItemGroup, MenuItemGroup_extends({
ref: ref
}, (0,omit["default"])(props, ['warnKey'])), childList);
});
if (true) {
MenuItemGroup.displayName = 'MenuItemGroup';
}
/* harmony default export */ var es_MenuItemGroup = (MenuItemGroup);
;// ./node_modules/@rc-component/menu/es/utils/nodeUtil.js
function nodeUtil_extends() { nodeUtil_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return nodeUtil_extends.apply(this, arguments); }
function convertItemsToNodes(list, components, prefixCls) {
const {
item: MergedMenuItem,
group: MergedMenuItemGroup,
submenu: MergedSubMenu,
divider: MergedDivider
} = components;
return (list || []).map((opt, index) => {
if (opt && typeof opt === 'object') {
const {
label,
children,
key,
type,
extra,
...restProps
} = opt;
const mergedKey = key ?? `tmp-${index}`;
// MenuItemGroup & SubMenuItem
if (children || type === 'group') {
if (type === 'group') {
// Group
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(MergedMenuItemGroup, nodeUtil_extends({
key: mergedKey
}, restProps, {
title: label
}), convertItemsToNodes(children, components, prefixCls));
}
// Sub Menu
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(MergedSubMenu, nodeUtil_extends({
key: mergedKey
}, restProps, {
title: label
}), convertItemsToNodes(children, components, prefixCls));
}
// MenuItem & Divider
if (type === 'divider') {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(MergedDivider, nodeUtil_extends({
key: mergedKey
}, restProps));
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(MergedMenuItem, nodeUtil_extends({
key: mergedKey
}, restProps, {
extra: extra
}), label, (!!extra || extra === 0) && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-item-extra`
}, extra));
}
return null;
}).filter(opt => opt);
}
function parseItems(children, items, keyPath, components, prefixCls) {
let childNodes = children;
const mergedComponents = {
divider: Divider,
item: es_MenuItem,
group: es_MenuItemGroup,
submenu: es_SubMenu,
...components
};
if (items) {
childNodes = convertItemsToNodes(items, mergedComponents, prefixCls);
}
return parseChildren(childNodes, keyPath);
}
;// ./node_modules/@rc-component/menu/es/Menu.js
function Menu_extends() { Menu_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Menu_extends.apply(this, arguments); }
/**
* Menu modify after refactor:
* ## Add
* - disabled
*
* ## Remove
* - openTransitionName
* - openAnimation
* - onDestroy
* - siderCollapsed: Seems antd do not use this prop (Need test in antd)
* - collapsedWidth: Seems this logic should be handle by antd Layout.Sider
*/
// optimize for render
const Menu_EMPTY_LIST = [];
const Menu = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls = 'rc-menu',
rootClassName,
style,
className,
styles,
classNames: menuClassNames,
tabIndex = 0,
items,
children,
direction,
id,
// Mode
mode = 'vertical',
inlineCollapsed,
// Disabled
disabled,
disabledOverflow,
// Open
subMenuOpenDelay = 0.1,
subMenuCloseDelay = 0.1,
forceSubMenuRender,
defaultOpenKeys,
openKeys,
// Active
activeKey,
defaultActiveFirst,
// Selection
selectable = true,
multiple = false,
defaultSelectedKeys,
selectedKeys,
onSelect,
onDeselect,
// Level
inlineIndent = 24,
// Motion
motion,
defaultMotions,
// Popup
triggerSubMenuAction = 'hover',
builtinPlacements,
// Icon
itemIcon,
expandIcon,
overflowedIndicator = '...',
overflowedIndicatorPopupClassName,
// Function
getPopupContainer,
// Events
onClick,
onOpenChange,
onKeyDown,
// Deprecated
openAnimation,
openTransitionName,
// Internal
_internalRenderMenuItem,
_internalRenderSubMenuItem,
_internalComponents,
popupRender,
...restProps
} = props;
const [childList, measureChildList] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => [parseItems(children, items, Menu_EMPTY_LIST, _internalComponents, prefixCls), parseItems(children, items, Menu_EMPTY_LIST, {}, prefixCls)], [children, items, _internalComponents]);
const [mounted, setMounted] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const containerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
const uuid = useId(id ? `rc-menu-uuid-${id}` : 'rc-menu-uuid');
const isRtl = direction === 'rtl';
// ========================= Warn =========================
if (true) {
(0,warning["default"])(!openAnimation && !openTransitionName, '`openAnimation` and `openTransitionName` is removed. Please use `motion` or `defaultMotion` instead.');
}
// ========================= Open =========================
const [innerOpenKeys, setMergedOpenKeys] = (0,useControlledState["default"])(defaultOpenKeys, openKeys);
const mergedOpenKeys = innerOpenKeys || Menu_EMPTY_LIST;
// React 18 will merge mouse event which means we open key will not sync
// ref: https://github.com/ant-design/ant-design/issues/38818
const triggerOpenKeys = (keys, forceFlush = false) => {
function doUpdate() {
setMergedOpenKeys(keys);
onOpenChange?.(keys);
}
if (forceFlush) {
(0,external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_.flushSync)(doUpdate);
} else {
doUpdate();
}
};
// >>>>> Cache & Reset open keys when inlineCollapsed changed
const [inlineCacheOpenKeys, setInlineCacheOpenKeys] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(mergedOpenKeys);
const mountRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
// ========================= Mode =========================
const [mergedMode, mergedInlineCollapsed] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if ((mode === 'inline' || mode === 'vertical') && inlineCollapsed) {
return ['vertical', inlineCollapsed];
}
return [mode, false];
}, [mode, inlineCollapsed]);
const isInlineMode = mergedMode === 'inline';
const [internalMode, setInternalMode] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(mergedMode);
const [internalInlineCollapsed, setInternalInlineCollapsed] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(mergedInlineCollapsed);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
setInternalMode(mergedMode);
setInternalInlineCollapsed(mergedInlineCollapsed);
if (!mountRef.current) {
return;
}
// Synchronously update MergedOpenKeys
if (isInlineMode) {
setMergedOpenKeys(inlineCacheOpenKeys);
} else {
// Trigger open event in case its in control
triggerOpenKeys(Menu_EMPTY_LIST);
}
}, [mergedMode, mergedInlineCollapsed]);
// ====================== Responsive ======================
const [lastVisibleIndex, setLastVisibleIndex] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const allVisible = lastVisibleIndex >= childList.length - 1 || internalMode !== 'horizontal' || disabledOverflow;
// Cache
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (isInlineMode) {
setInlineCacheOpenKeys(mergedOpenKeys);
}
}, [mergedOpenKeys]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
mountRef.current = true;
return () => {
mountRef.current = false;
};
}, []);
// ========================= Path =========================
const {
registerPath,
unregisterPath,
refreshOverflowKeys,
isSubPathKey,
getKeyPath,
getKeys,
getSubPathKeys
} = useKeyRecords();
const registerPathContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
registerPath,
unregisterPath
}), [registerPath, unregisterPath]);
const pathUserContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
isSubPathKey
}), [isSubPathKey]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
refreshOverflowKeys(allVisible ? Menu_EMPTY_LIST : childList.slice(lastVisibleIndex + 1).map(child => child.key));
}, [lastVisibleIndex, allVisible]);
// ======================== Active ========================
const [mergedActiveKey, setMergedActiveKey] = (0,useControlledState["default"])(activeKey || defaultActiveFirst && childList[0]?.key, activeKey);
const onActive = useMemoCallback(key => {
setMergedActiveKey(key);
});
const onInactive = useMemoCallback(() => {
setMergedActiveKey(undefined);
});
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref, () => {
return {
list: containerRef.current,
focus: options => {
const keys = getKeys();
const {
elements,
key2element,
element2key
} = refreshElements(keys, uuid);
const focusableElements = getFocusableElements(containerRef.current, elements);
let shouldFocusKey;
if (mergedActiveKey && keys.includes(mergedActiveKey)) {
shouldFocusKey = mergedActiveKey;
} else {
shouldFocusKey = focusableElements[0] ? element2key.get(focusableElements[0]) : childList.find(node => !node.props.disabled)?.key;
}
const elementToFocus = key2element.get(shouldFocusKey);
if (shouldFocusKey && elementToFocus) {
elementToFocus?.focus?.(options);
}
},
findItem: ({
key: itemKey
}) => {
const keys = getKeys();
const {
key2element
} = refreshElements(keys, uuid);
return key2element.get(itemKey) || null;
}
};
});
// ======================== Select ========================
// >>>>> Select keys
const [internalSelectKeys, setMergedSelectKeys] = (0,useControlledState["default"])(defaultSelectedKeys || [], selectedKeys);
const mergedSelectKeys = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (Array.isArray(internalSelectKeys)) {
return internalSelectKeys;
}
if (internalSelectKeys === null || internalSelectKeys === undefined) {
return Menu_EMPTY_LIST;
}
return [internalSelectKeys];
}, [internalSelectKeys]);
// >>>>> Trigger select
const triggerSelection = info => {
if (selectable) {
// Insert or Remove
const {
key: targetKey
} = info;
const exist = mergedSelectKeys.includes(targetKey);
let newSelectKeys;
if (multiple) {
if (exist) {
newSelectKeys = mergedSelectKeys.filter(key => key !== targetKey);
} else {
newSelectKeys = [...mergedSelectKeys, targetKey];
}
} else {
newSelectKeys = [targetKey];
}
setMergedSelectKeys(newSelectKeys);
// Trigger event
const selectInfo = {
...info,
selectedKeys: newSelectKeys
};
if (exist) {
onDeselect?.(selectInfo);
} else {
onSelect?.(selectInfo);
}
}
// Whatever selectable, always close it
if (!multiple && mergedOpenKeys.length && internalMode !== 'inline') {
triggerOpenKeys(Menu_EMPTY_LIST);
}
};
// ========================= Open =========================
/**
* Click for item. SubMenu do not have selection status
*/
const onInternalClick = useMemoCallback(info => {
onClick?.(warnItemProp(info));
triggerSelection(info);
});
const onInternalOpenChange = useMemoCallback((key, open) => {
let newOpenKeys = mergedOpenKeys.filter(k => k !== key);
if (open) {
newOpenKeys.push(key);
} else if (internalMode !== 'inline') {
// We need find all related popup to close
const subPathKeys = getSubPathKeys(key);
newOpenKeys = newOpenKeys.filter(k => !subPathKeys.has(k));
}
if (!(0,isEqual["default"])(mergedOpenKeys, newOpenKeys, true)) {
triggerOpenKeys(newOpenKeys, true);
}
});
// ==================== Accessibility =====================
const triggerAccessibilityOpen = (key, open) => {
const nextOpen = open ?? !mergedOpenKeys.includes(key);
onInternalOpenChange(key, nextOpen);
};
const onInternalKeyDown = useAccessibility_useAccessibility(internalMode, mergedActiveKey, isRtl, uuid, containerRef, getKeys, getKeyPath, setMergedActiveKey, triggerAccessibilityOpen, onKeyDown);
// ======================== Effect ========================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
setMounted(true);
}, []);
// ======================= Context ========================
const privateContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
_internalRenderMenuItem,
_internalRenderSubMenuItem
}), [_internalRenderMenuItem, _internalRenderSubMenuItem]);
// ======================== Render ========================
// >>>>> Children
const wrappedChildList = internalMode !== 'horizontal' || disabledOverflow ? childList :
// Need wrap for overflow dropdown that do not response for open
childList.map((child, index) =>
/*#__PURE__*/
// Always wrap provider to avoid sub node re-mount
external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(InheritableContextProvider, {
key: child.key,
overflowDisabled: index > lastVisibleIndex,
classNames: menuClassNames,
styles: styles
}, child));
// >>>>> Container
const container = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(overflow_es, Menu_extends({
id: id,
ref: containerRef,
prefixCls: `${prefixCls}-overflow`,
component: "ul",
itemComponent: es_MenuItem,
className: (0,clsx.clsx)(prefixCls, `${prefixCls}-root`, `${prefixCls}-${internalMode}`, className, {
[`${prefixCls}-inline-collapsed`]: internalInlineCollapsed,
[`${prefixCls}-rtl`]: isRtl
}, rootClassName),
dir: direction,
style: style,
role: "menu",
tabIndex: tabIndex,
data: wrappedChildList,
renderRawItem: node => node,
renderRawRest: omitItems => {
// We use origin list since wrapped list use context to prevent open
const len = omitItems.length;
const originOmitItems = len ? childList.slice(-len) : null;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_SubMenu, {
eventKey: OVERFLOW_KEY,
title: overflowedIndicator,
disabled: allVisible,
internalPopupClose: len === 0,
popupClassName: overflowedIndicatorPopupClassName
}, originOmitItems);
},
maxCount: internalMode !== 'horizontal' || disabledOverflow ? overflow_es.INVALIDATE : overflow_es.RESPONSIVE,
ssr: "full",
"data-menu-list": true,
onVisibleChange: newLastIndex => {
setLastVisibleIndex(newLastIndex);
},
onKeyDown: onInternalKeyDown
}, restProps));
// >>>>> Render
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(context_PrivateContext.Provider, {
value: privateContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(IdContext.Provider, {
value: uuid
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(InheritableContextProvider, {
prefixCls: prefixCls,
rootClassName: rootClassName,
classNames: menuClassNames,
styles: styles,
mode: internalMode,
openKeys: mergedOpenKeys,
rtl: isRtl
// Disabled
,
disabled: disabled
// Motion
,
motion: mounted ? motion : null,
defaultMotions: mounted ? defaultMotions : null
// Active
,
activeKey: mergedActiveKey,
onActive: onActive,
onInactive: onInactive
// Selection
,
selectedKeys: mergedSelectKeys
// Level
,
inlineIndent: inlineIndent
// Popup
,
subMenuOpenDelay: subMenuOpenDelay,
subMenuCloseDelay: subMenuCloseDelay,
forceSubMenuRender: forceSubMenuRender,
builtinPlacements: builtinPlacements,
triggerSubMenuAction: triggerSubMenuAction,
getPopupContainer: getPopupContainer
// Icon
,
itemIcon: itemIcon,
expandIcon: expandIcon
// Events
,
onItemClick: onInternalClick,
onOpenChange: onInternalOpenChange,
popupRender: popupRender
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PathUserContext.Provider, {
value: pathUserContext
}, container), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
style: {
display: 'none'
},
"aria-hidden": true
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PathRegisterContext.Provider, {
value: registerPathContext
}, measureChildList)))));
});
/* harmony default export */ var es_Menu = (Menu);
;// ./node_modules/@rc-component/menu/es/index.js
const ExportMenu = es_Menu;
ExportMenu.Item = es_MenuItem;
ExportMenu.SubMenu = es_SubMenu;
ExportMenu.ItemGroup = es_MenuItemGroup;
ExportMenu.Divider = Divider;
/* harmony default export */ var menu_es = (ExportMenu);
;// ./node_modules/@ant-design/icons-svg/es/asn/BarsOutlined.js
// This icon file is generated automatically.
var BarsOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, "name": "bars", "theme": "outlined" };
/* harmony default export */ var asn_BarsOutlined = (BarsOutlined);
;// ./node_modules/@ant-design/icons/es/icons/BarsOutlined.js
function BarsOutlined_extends() { BarsOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return BarsOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const BarsOutlined_BarsOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], BarsOutlined_extends({}, props, {
ref: ref,
icon: asn_BarsOutlined
}));
/** */
const BarsOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(BarsOutlined_BarsOutlined);
if (true) {
BarsOutlined_RefIcon.displayName = 'BarsOutlined';
}
/* harmony default export */ var icons_BarsOutlined = (BarsOutlined_RefIcon);
;// ./components/layout/context.ts
const LayoutContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({
siderHook: {
addSider: () => null,
removeSider: () => null
}
});
// EXTERNAL MODULE: ./components/layout/style/index.ts
var layout_style = __webpack_require__("./components/layout/style/index.ts");
;// ./components/layout/style/sider.ts
const genSiderStyle = token => {
const {
componentCls,
siderBg,
motionDurationMid,
motionDurationSlow,
antCls,
triggerHeight,
triggerColor,
triggerBg,
headerHeight,
zeroTriggerWidth,
zeroTriggerHeight,
borderRadiusLG,
lightSiderBg,
lightTriggerColor,
lightTriggerBg,
bodyBg
} = token;
return {
[componentCls]: {
position: 'relative',
// fix firefox can't set width smaller than content on flex item
minWidth: 0,
background: siderBg,
transition: `all ${motionDurationMid}, background 0s`,
'&-has-trigger': {
paddingBottom: triggerHeight
},
'&-right': {
order: 1
},
[`${componentCls}-children`]: {
height: '100%',
// Hack for fixing margin collapse bug
// https://github.com/ant-design/ant-design/issues/7967
// solution from https://stackoverflow.com/a/33132624/3040605
marginTop: -0.1,
paddingTop: 0.1,
[`${antCls}-menu${antCls}-menu-inline-collapsed`]: {
width: 'auto'
}
},
[`&-zero-width ${componentCls}-children`]: {
overflow: 'hidden'
},
[`${componentCls}-trigger`]: {
position: 'fixed',
bottom: 0,
zIndex: 1,
height: triggerHeight,
color: triggerColor,
lineHeight: (0,cssinjs.unit)(triggerHeight),
textAlign: 'center',
background: triggerBg,
cursor: 'pointer',
transition: `all ${motionDurationMid}`
},
[`${componentCls}-zero-width-trigger`]: {
position: 'absolute',
top: headerHeight,
insetInlineEnd: token.calc(zeroTriggerWidth).mul(-1).equal(),
zIndex: 1,
width: zeroTriggerWidth,
height: zeroTriggerHeight,
color: triggerColor,
fontSize: token.fontSizeXL,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
background: siderBg,
borderRadius: `0 ${(0,cssinjs.unit)(borderRadiusLG)} ${(0,cssinjs.unit)(borderRadiusLG)} 0`,
cursor: 'pointer',
transition: `background-color ${motionDurationSlow} ease`,
'&::after': {
position: 'absolute',
inset: 0,
background: 'transparent',
transition: `all ${motionDurationSlow}`,
content: '""'
},
'&:hover::after': {
background: `rgba(255, 255, 255, 0.2)`
},
'&-right': {
insetInlineStart: token.calc(zeroTriggerWidth).mul(-1).equal(),
borderRadius: `${(0,cssinjs.unit)(borderRadiusLG)} 0 0 ${(0,cssinjs.unit)(borderRadiusLG)}`
}
},
// Light
'&-light': {
background: lightSiderBg,
[`${componentCls}-trigger`]: {
color: lightTriggerColor,
background: lightTriggerBg
},
[`${componentCls}-zero-width-trigger`]: {
color: lightTriggerColor,
background: lightTriggerBg,
border: `1px solid ${bodyBg}`,
// Safe to modify to any other color
borderInlineStart: 0
}
}
}
};
};
/* harmony default export */ var sider = ((0,genStyleUtils.genStyleHooks)(['Layout', 'Sider'], genSiderStyle, layout_style.prepareComponentToken, {
deprecatedTokens: layout_style.DEPRECATED_TOKENS
}));
;// ./components/layout/Sider.tsx
const dimensionMaxMap = {
xs: '479.98px',
sm: '575.98px',
md: '767.98px',
lg: '991.98px',
xl: '1199.98px',
xxl: '1599.98px',
xxxl: `1839.98px`
};
const isNumeric = val => !Number.isNaN(Number.parseFloat(val)) && Number.isFinite(Number(val));
const SiderContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({});
const generateId = (() => {
let i = 0;
return (prefix = '') => {
i += 1;
return `${prefix}${i}`;
};
})();
const Sider = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
className,
trigger,
children,
defaultCollapsed = false,
theme = 'dark',
style = {},
collapsible = false,
reverseArrow = false,
width = 200,
collapsedWidth = 80,
zeroWidthTriggerStyle,
breakpoint,
onCollapse,
onBreakpoint,
...otherProps
} = props;
const {
siderHook
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(LayoutContext);
const [collapsed, setCollapsed] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)('collapsed' in props ? props.collapsed : defaultCollapsed);
const [below, setBelow] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if ('collapsed' in props) {
setCollapsed(props.collapsed);
}
}, [props.collapsed]);
const handleSetCollapsed = (value, type) => {
if (!('collapsed' in props)) {
setCollapsed(value);
}
onCollapse?.(value, type);
};
// =========================== Prefix ===========================
const {
getPrefixCls,
direction
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('layout-sider', customizePrefixCls);
const [hashId, cssVarCls] = sider(prefixCls);
// ========================= Responsive =========================
const responsiveHandlerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
responsiveHandlerRef.current = mql => {
setBelow(mql.matches);
onBreakpoint?.(mql.matches);
if (collapsed !== mql.matches) {
handleSetCollapsed(mql.matches, 'responsive');
}
};
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
function responsiveHandler(mql) {
return responsiveHandlerRef.current?.(mql);
}
let mql;
if (typeof window?.matchMedia !== 'undefined' && breakpoint && breakpoint in dimensionMaxMap) {
mql = window.matchMedia(`screen and (max-width: ${dimensionMaxMap[breakpoint]})`);
if (typeof mql?.addEventListener === 'function') {
mql.addEventListener('change', responsiveHandler);
}
responsiveHandler(mql);
}
return () => {
if (typeof mql?.removeEventListener === 'function') {
mql.removeEventListener('change', responsiveHandler);
}
};
}, [breakpoint]); // in order to accept dynamic 'breakpoint' property, we need to add 'breakpoint' into dependency array.
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
const uniqueId = generateId('ant-sider-');
siderHook.addSider(uniqueId);
return () => siderHook.removeSider(uniqueId);
}, []);
const toggle = () => {
handleSetCollapsed(!collapsed, 'clickTrigger');
};
const divProps = (0,es.omit)(otherProps, ['collapsed']);
const rawWidth = collapsed ? collapsedWidth : width;
// use "px" as fallback unit for width
const siderWidth = isNumeric(rawWidth) ? `${rawWidth}px` : String(rawWidth);
// special trigger when collapsedWidth == 0
const zeroWidthTrigger = Number.parseFloat(String(collapsedWidth || 0)) === 0 ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
onClick: toggle,
className: (0,clsx.clsx)(`${prefixCls}-zero-width-trigger`, `${prefixCls}-zero-width-trigger-${reverseArrow ? 'right' : 'left'}`),
style: zeroWidthTriggerStyle
}, trigger || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_BarsOutlined, null))) : null;
const reverseIcon = direction === 'rtl' === !reverseArrow;
const iconObj = {
expanded: reverseIcon ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RightOutlined["default"], null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LeftOutlined, null),
collapsed: reverseIcon ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LeftOutlined, null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RightOutlined["default"], null)
};
const status = collapsed ? 'collapsed' : 'expanded';
const defaultTrigger = iconObj[status];
const triggerDom = trigger !== null ? zeroWidthTrigger || (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-trigger`,
onClick: toggle,
style: {
width: siderWidth
}
}, trigger || defaultTrigger)) : null;
const divStyle = {
...style,
flex: `0 0 ${siderWidth}`,
maxWidth: siderWidth,
// Fix width transition bug in IE11
minWidth: siderWidth,
// https://github.com/ant-design/ant-design/issues/6349
width: siderWidth
};
const siderCls = (0,clsx.clsx)(prefixCls, `${prefixCls}-${theme}`, {
[`${prefixCls}-collapsed`]: !!collapsed,
[`${prefixCls}-has-trigger`]: collapsible && trigger !== null && !zeroWidthTrigger,
[`${prefixCls}-below`]: !!below,
[`${prefixCls}-zero-width`]: Number.parseFloat(siderWidth) === 0
}, className, hashId, cssVarCls);
const contextValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
siderCollapsed: collapsed
}), [collapsed]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(SiderContext.Provider, {
value: contextValue
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("aside", {
className: siderCls,
...divProps,
style: divStyle,
ref: ref
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-children`
}, children), collapsible || below && zeroWidthTrigger ? triggerDom : null));
});
if (true) {
Sider.displayName = 'Sider';
}
/* harmony default export */ var layout_Sider = (Sider);
;// ./node_modules/@ant-design/icons-svg/es/asn/EllipsisOutlined.js
// This icon file is generated automatically.
var EllipsisOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, "name": "ellipsis", "theme": "outlined" };
/* harmony default export */ var asn_EllipsisOutlined = (EllipsisOutlined);
;// ./node_modules/@ant-design/icons/es/icons/EllipsisOutlined.js
function EllipsisOutlined_extends() { EllipsisOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return EllipsisOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const EllipsisOutlined_EllipsisOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], EllipsisOutlined_extends({}, props, {
ref: ref,
icon: asn_EllipsisOutlined
}));
/** */
const EllipsisOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(EllipsisOutlined_EllipsisOutlined);
if (true) {
EllipsisOutlined_RefIcon.displayName = 'EllipsisOutlined';
}
/* harmony default export */ var icons_EllipsisOutlined = (EllipsisOutlined_RefIcon);
;// ./components/menu/MenuContext.tsx
const MenuContext_MenuContext = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext)({
prefixCls: '',
firstLevel: true,
inlineCollapsed: false,
styles: null,
classNames: null
});
/* harmony default export */ var menu_MenuContext = (MenuContext_MenuContext);
;// ./components/menu/MenuDivider.tsx
const MenuDivider = props => {
const {
prefixCls: customizePrefixCls,
className,
dashed,
...restProps
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('menu', customizePrefixCls);
const classString = (0,clsx.clsx)({
[`${prefixCls}-item-divider-dashed`]: !!dashed
}, className);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Divider, {
className: classString,
...restProps
});
};
/* harmony default export */ var menu_MenuDivider = (MenuDivider);
;// ./components/menu/MenuItem.tsx
const MenuItem_MenuItem = props => {
const {
className,
children,
icon,
title,
danger,
extra
} = props;
const {
prefixCls,
firstLevel,
direction,
disableMenuItemTitleTooltip,
tooltip,
inlineCollapsed: isInlineCollapsed,
styles,
classNames
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(menu_MenuContext);
const renderItemChildren = inlineCollapsed => {
const label = children?.[0];
const wrapNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}-title-content`, firstLevel ? classNames?.itemContent : classNames?.subMenu?.itemContent, {
[`${prefixCls}-title-content-with-extra`]: !!extra || extra === 0
}),
style: firstLevel ? styles?.itemContent : styles?.subMenu?.itemContent
}, children);
// inline-collapsed.md demo 依赖 span 来隐藏文字,有 icon 属性,则内部包裹一个 span
// ref: https://github.com/ant-design/ant-design/pull/23456
if (!icon || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(children) && children.type === 'span') {
if (children && inlineCollapsed && firstLevel && typeof label === 'string') {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-inline-collapsed-noicon`
}, label.charAt(0));
}
}
return wrapNode;
};
const {
siderCollapsed
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(SiderContext);
let tooltipTitle = title;
if (typeof title === 'undefined') {
tooltipTitle = firstLevel ? children : '';
} else if (title === false) {
tooltipTitle = '';
}
const tooltipConfig = tooltip === false ? undefined : tooltip;
const mergedTooltipTitle = tooltipConfig && tooltipConfig.title !== undefined ? tooltipConfig.title : tooltipTitle;
const tooltipProps = {
...(tooltipConfig ?? null),
title: mergedTooltipTitle
};
if (!siderCollapsed && !isInlineCollapsed) {
tooltipProps.title = null;
// Reset `open` to fix control mode tooltip display not correct
// ref: https://github.com/ant-design/ant-design/issues/16742
tooltipProps.open = false;
}
const childrenLength = (0,es.toArray)(children).length;
let returnNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_MenuItem, {
...(0,es.omit)(props, ['title', 'icon', 'danger']),
className: (0,clsx.clsx)(firstLevel ? classNames?.item : classNames?.subMenu?.item, {
[`${prefixCls}-item-danger`]: danger,
[`${prefixCls}-item-only-child`]: (icon ? childrenLength + 1 : childrenLength) === 1
}, className),
style: {
...(firstLevel ? styles?.item : styles?.subMenu?.item),
...props.style
},
title: typeof title === 'string' ? title : undefined
}, (0,reactNode.cloneElement)(icon, oriProps => ({
className: (0,clsx.clsx)(`${prefixCls}-item-icon`, firstLevel ? classNames?.itemIcon : classNames?.subMenu?.itemIcon, oriProps.className),
style: {
...(firstLevel ? styles?.itemIcon : styles?.subMenu?.itemIcon),
...oriProps.style
}
})), renderItemChildren(isInlineCollapsed));
if (!disableMenuItemTitleTooltip && tooltip !== false) {
const mergedTooltipPlacement = tooltipConfig && tooltipConfig.placement ? tooltipConfig.placement : direction === 'rtl' ? 'left' : 'right';
const baseTooltipClassName = `${prefixCls}-inline-collapsed-tooltip`;
const mergeTooltipRootClassName = classNames => ({
...classNames,
root: (0,clsx.clsx)(baseTooltipClassName, classNames?.root)
});
const mergedTooltipClassNames = tooltipConfig && typeof tooltipConfig.classNames === 'function' ? info => {
const resolvedClassNames = tooltipConfig.classNames(info);
return mergeTooltipRootClassName(resolvedClassNames);
} : mergeTooltipRootClassName(tooltipConfig?.classNames);
returnNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_tooltip, {
...tooltipProps,
placement: mergedTooltipPlacement,
classNames: mergedTooltipClassNames
}, returnNode);
}
return returnNode;
};
/* harmony default export */ var menu_MenuItem = (MenuItem_MenuItem);
;// ./components/menu/OverrideContext.tsx
const OverrideContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
/** @internal Only used for Dropdown component. Do not use this in your production. */
const OverrideProvider = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
children,
...restProps
} = props;
const override = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(OverrideContext);
const context = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
...override,
...restProps
}), [override, restProps.prefixCls,
// restProps.expandIcon, Not mark as deps since this is a ReactNode
restProps.mode, restProps.selectable, restProps.rootClassName
// restProps.validator, Not mark as deps since this is a function
]);
const canRef = (0,es_ref.supportNodeRef)(children);
const mergedRef = (0,es_ref.useComposeRef)(ref, canRef ? (0,es_ref.getNodeRef)(children) : null);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(OverrideContext.Provider, {
value: context
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(_util_ContextIsolator, {
space: true
}, canRef ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement(children, {
ref: mergedRef
}) : children));
});
/** @internal Only used for Dropdown component. Do not use this in your production. */
/* harmony default export */ var menu_OverrideContext = (OverrideContext);
// EXTERNAL MODULE: ./components/menu/style/index.ts + 4 modules
var menu_style = __webpack_require__("./components/menu/style/index.ts");
;// ./components/menu/SubMenu.tsx
const SubMenu_SubMenu = props => {
const {
popupClassName,
icon,
title,
theme: customTheme
} = props;
const context = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(menu_MenuContext);
const {
prefixCls,
inlineCollapsed,
theme: contextTheme,
classNames,
styles
} = context;
const parentPath = useFullPath();
let titleNode;
if (!icon) {
titleNode = inlineCollapsed && !parentPath.length && title && typeof title === 'string' ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-inline-collapsed-noicon`
}, title.charAt(0))) : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-title-content`
}, title));
} else {
// inline-collapsed.md demo 依赖 span 来隐藏文字,有 icon 属性,则内部包裹一个 span
// ref: https://github.com/ant-design/ant-design/pull/23456
const titleIsSpan = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(title) && title.type === 'span';
titleNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, (0,reactNode.cloneElement)(icon, oriProps => ({
className: (0,clsx.clsx)(oriProps.className, `${prefixCls}-item-icon`, classNames?.itemIcon),
style: {
...oriProps.style,
...styles?.itemIcon
}
})), titleIsSpan ? title : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-title-content`
}, title));
}
const contextValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
...context,
firstLevel: false
}), [context]);
// ============================ zIndex ============================
const [zIndex] = (0,useZIndex.useZIndex)('Menu');
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(menu_MenuContext.Provider, {
value: contextValue
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_SubMenu, {
...(0,es.omit)(props, ['icon']),
title: titleNode,
classNames: {
list: classNames?.subMenu?.list,
listTitle: classNames?.subMenu?.itemTitle
},
styles: {
list: styles?.subMenu?.list,
listTitle: styles?.subMenu?.itemTitle
},
popupClassName: (0,clsx.clsx)(prefixCls, popupClassName, classNames?.popup?.root, `${prefixCls}-${customTheme || contextTheme}`),
popupStyle: {
zIndex,
// fix: https://github.com/ant-design/ant-design/issues/47826#issuecomment-2360737237
...props.popupStyle,
...styles?.popup?.root
}
}));
};
/* harmony default export */ var menu_SubMenu = (SubMenu_SubMenu);
;// ./components/menu/menu.tsx
function isEmptyIcon(icon) {
return icon === null || icon === false;
}
const MENU_COMPONENTS = {
item: menu_MenuItem,
submenu: menu_SubMenu,
divider: menu_MenuDivider
};
const InternalMenu = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((props, ref) => {
const override = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(menu_OverrideContext);
const overrideObj = override || {};
const {
prefixCls: customizePrefixCls,
className,
style,
theme = 'light',
expandIcon,
_internalDisableMenuItemTitleTooltip,
tooltip,
inlineCollapsed,
siderCollapsed,
rootClassName,
mode,
selectable,
onClick,
overflowedIndicatorPopupClassName,
classNames,
styles,
...restProps
} = props;
const {
menu
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const {
getPrefixCls,
getPopupContainer,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('menu');
const rootPrefixCls = getPrefixCls();
const passedProps = (0,es.omit)(restProps, ['collapsedWidth']);
// ======================== Warning ==========================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Menu');
true ? warning(!('inlineCollapsed' in props && mode !== 'inline'), 'usage', '`inlineCollapsed` should only be used when `mode` is inline.') : 0;
warning.deprecated('items' in props && !props.children, 'children', 'items');
}
overrideObj.validator?.({
mode
});
// ========================== Click ==========================
// Tell dropdown that item clicked
const onItemClick = (0,es.useEvent)((...args) => {
onClick?.(...args);
overrideObj.onClick?.();
});
// ========================== Mode ===========================
const mergedMode = overrideObj.mode || mode;
// ======================= Selectable ========================
const mergedSelectable = selectable ?? overrideObj.selectable;
// ======================== Collapsed ========================
// Inline Collapsed
const mergedInlineCollapsed = inlineCollapsed ?? siderCollapsed;
// ================ Merged Props for Semantic ================
const mergedProps = {
...props,
mode: mergedMode,
inlineCollapsed: mergedInlineCollapsed,
selectable: mergedSelectable,
theme
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
}, {
popup: {
_default: 'root'
},
subMenu: {
_default: 'item'
}
});
const defaultMotions = {
horizontal: {
motionName: `${rootPrefixCls}-slide-up`
},
inline: (0,_util_motion["default"])(rootPrefixCls),
other: {
motionName: `${rootPrefixCls}-zoom-big`
}
};
const prefixCls = getPrefixCls('menu', customizePrefixCls || overrideObj.prefixCls);
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,menu_style["default"])(prefixCls, rootCls, !override);
const menuClassName = (0,clsx.clsx)(`${prefixCls}-${theme}`, contextClassName, className);
// ====================== ExpandIcon ========================
const mergedExpandIcon = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (typeof expandIcon === 'function' || isEmptyIcon(expandIcon)) {
return expandIcon || null;
}
if (typeof overrideObj.expandIcon === 'function' || isEmptyIcon(overrideObj.expandIcon)) {
return overrideObj.expandIcon || null;
}
if (typeof menu?.expandIcon === 'function' || isEmptyIcon(menu?.expandIcon)) {
return menu?.expandIcon || null;
}
const mergedIcon = expandIcon ?? overrideObj?.expandIcon ?? menu?.expandIcon;
return (0,reactNode.cloneElement)(mergedIcon, {
className: (0,clsx.clsx)(`${prefixCls}-submenu-expand-icon`, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(mergedIcon) ? mergedIcon.props?.className : undefined)
});
}, [expandIcon, overrideObj?.expandIcon, menu?.expandIcon, prefixCls]);
// ======================== Context ==========================
const contextValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
prefixCls,
inlineCollapsed: mergedInlineCollapsed || false,
direction,
firstLevel: true,
theme,
mode: mergedMode,
disableMenuItemTitleTooltip: _internalDisableMenuItemTitleTooltip,
tooltip,
classNames: mergedClassNames,
styles: mergedStyles
}), [prefixCls, mergedInlineCollapsed, direction, _internalDisableMenuItemTitleTooltip, theme, mergedMode, mergedClassNames, mergedStyles, tooltip]);
// ========================= Render ==========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(menu_OverrideContext.Provider, {
value: null
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(menu_MenuContext.Provider, {
value: contextValue
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(menu_es, {
getPopupContainer: getPopupContainer,
overflowedIndicator: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_EllipsisOutlined, null),
overflowedIndicatorPopupClassName: (0,clsx.clsx)(prefixCls, `${prefixCls}-${theme}`, overflowedIndicatorPopupClassName),
classNames: {
list: mergedClassNames.list,
listTitle: mergedClassNames.itemTitle
},
styles: {
list: mergedStyles.list,
listTitle: mergedStyles.itemTitle
},
mode: mergedMode,
selectable: mergedSelectable,
onClick: onItemClick,
...passedProps,
inlineCollapsed: mergedInlineCollapsed,
style: {
...mergedStyles.root,
...contextStyle,
...style
},
className: menuClassName,
prefixCls: prefixCls,
direction: direction,
defaultMotions: defaultMotions,
expandIcon: mergedExpandIcon,
ref: ref,
rootClassName: (0,clsx.clsx)(rootClassName, hashId, overrideObj.rootClassName, cssVarCls, rootCls, mergedClassNames.root),
_internalComponents: MENU_COMPONENTS
})));
});
/* harmony default export */ var menu = (InternalMenu);
;// ./components/menu/index.tsx
const menu_Menu = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((props, ref) => {
const menuRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const context = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(SiderContext);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref, () => ({
menu: menuRef.current,
focus: options => {
menuRef.current?.focus(options);
}
}));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(menu, {
ref: menuRef,
...props,
...context
});
});
menu_Menu.Item = menu_MenuItem;
menu_Menu.SubMenu = menu_SubMenu;
menu_Menu.Divider = menu_MenuDivider;
menu_Menu.ItemGroup = es_MenuItemGroup;
if (true) {
menu_Menu.displayName = 'Menu';
}
/* harmony default export */ var components_menu = (menu_Menu);
// EXTERNAL MODULE: ./components/dropdown/style/index.ts + 1 modules
var dropdown_style = __webpack_require__("./components/dropdown/style/index.ts");
;// ./components/dropdown/dropdown.tsx
const _Placements = ['topLeft', 'topCenter', 'topRight', 'bottomLeft', 'bottomCenter', 'bottomRight', 'top', 'bottom'];
const dropdown_Dropdown = props => {
const {
menu,
arrow,
prefixCls: customizePrefixCls,
children,
trigger,
disabled,
dropdownRender,
popupRender,
getPopupContainer,
overlayClassName,
rootClassName,
overlayStyle,
open,
onOpenChange,
mouseEnterDelay = 0.15,
mouseLeaveDelay = 0.1,
autoAdjustOverflow = true,
placement = '',
transitionName,
classNames,
styles,
destroyPopupOnHide,
destroyOnHidden
} = props;
const {
getPrefixCls,
direction,
getPopupContainer: getContextPopupContainer,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('dropdown');
const mergedProps = {
...props,
mouseEnterDelay,
mouseLeaveDelay,
autoAdjustOverflow
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const mergedRootStyles = {
...contextStyle,
...overlayStyle,
...mergedStyles.root
};
const mergedPopupRender = popupRender || dropdownRender;
// =================== Warning =====================
const warning = (0,_util_warning.devUseWarning)('Dropdown');
if (true) {
const deprecatedProps = {
dropdownRender: 'popupRender',
destroyPopupOnHide: 'destroyOnHidden',
overlayClassName: 'classNames.root',
overlayStyle: 'styles.root'
};
Object.entries(deprecatedProps).forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
if (placement.includes('Center')) {
warning.deprecated(!placement.includes('Center'), `placement: ${placement}`, `placement: ${placement.slice(0, placement.indexOf('Center'))}`);
}
}
const memoTransitionName = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const rootPrefixCls = getPrefixCls();
if (transitionName !== undefined) {
return transitionName;
}
if (placement.includes('top')) {
return `${rootPrefixCls}-slide-down`;
}
return `${rootPrefixCls}-slide-up`;
}, [getPrefixCls, placement, transitionName]);
const memoPlacement = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!placement) {
return direction === 'rtl' ? 'bottomRight' : 'bottomLeft';
}
if (placement.includes('Center')) {
return placement.slice(0, placement.indexOf('Center'));
}
return placement;
}, [placement, direction]);
const prefixCls = getPrefixCls('dropdown', customizePrefixCls);
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,dropdown_style["default"])(prefixCls, rootCls);
const [, token] = (0,useToken["default"])();
const child = external_root_React_commonjs2_react_commonjs_react_amd_react_.Children.only((0,is.isPrimitive)(children) ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", null, children) : children);
const popupTrigger = (0,reactNode.cloneElement)(child, {
className: (0,clsx.clsx)(`${prefixCls}-trigger`, {
[`${prefixCls}-rtl`]: direction === 'rtl'
}, child.props.className),
disabled: child.props.disabled ?? disabled
});
const triggerActions = disabled ? [] : trigger;
const alignPoint = !!triggerActions?.includes('contextMenu');
// =========================== Open ============================
const [mergedOpen, setOpen] = (0,es.useControlledState)(false, open);
const onInnerOpenChange = (0,es.useEvent)(nextOpen => {
onOpenChange?.(nextOpen, {
source: 'trigger'
});
setOpen(nextOpen);
});
// =========================== Overlay ============================
const overlayClassNameCustomized = (0,clsx.clsx)(overlayClassName, rootClassName, hashId, cssVarCls, rootCls, contextClassName, mergedClassNames.root, {
[`${prefixCls}-rtl`]: direction === 'rtl'
});
const builtinPlacements = getPlacements({
arrowPointAtCenter: (0,is.isPlainObject)(arrow) && arrow.pointAtCenter,
autoAdjustOverflow,
offset: token.marginXXS,
arrowWidth: arrow ? token.sizePopupArrow : 0,
borderRadius: token.borderRadius
});
const onMenuClick = (0,es.useEvent)(() => {
if (menu?.selectable && menu?.multiple) {
return;
}
onOpenChange?.(false, {
source: 'menu'
});
setOpen(false);
});
const renderOverlay = () => {
// @rc-component/dropdown already can process the function of overlay, but we have check logic here.
// So we need render the element to check and pass back to @rc-component/dropdown.
const menuClassNames = (0,es.omit)(mergedClassNames, ['root']);
const menuStyles = (0,es.omit)(mergedStyles, ['root']);
let overlayNode;
if (menu?.items) {
overlayNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_menu, {
...menu,
classNames: {
...menuClassNames,
subMenu: {
...menuClassNames
}
},
styles: {
...menuStyles,
subMenu: {
...menuStyles
}
}
});
}
if (mergedPopupRender) {
overlayNode = mergedPopupRender(overlayNode);
}
overlayNode = external_root_React_commonjs2_react_commonjs_react_amd_react_.Children.only(typeof overlayNode === 'string' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", null, overlayNode) : overlayNode);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(OverrideProvider, {
prefixCls: `${prefixCls}-menu`,
rootClassName: (0,clsx.clsx)(cssVarCls, rootCls),
expandIcon: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-menu-submenu-arrow`
}, direction === 'rtl' ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LeftOutlined, {
className: `${prefixCls}-menu-submenu-arrow-icon`
})) : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RightOutlined["default"], {
className: `${prefixCls}-menu-submenu-arrow-icon`
}))),
mode: "vertical",
selectable: false,
onClick: onMenuClick,
validator: ({
mode
}) => {
// Warning if use other mode
true ? warning(!mode || mode === 'vertical', 'usage', `mode="${mode}" is not supported for Dropdown's Menu.`) : 0;
}
}, overlayNode);
};
// =========================== zIndex ============================
const [zIndex, contextZIndex] = (0,useZIndex.useZIndex)('Dropdown', mergedRootStyles.zIndex);
// ============================ Render ============================
let renderNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(dropdown_es, {
alignPoint: alignPoint,
...(0,es.omit)(props, ['rootClassName', 'onOpenChange']),
mouseEnterDelay: mouseEnterDelay,
mouseLeaveDelay: mouseLeaveDelay,
visible: mergedOpen,
builtinPlacements: builtinPlacements,
arrow: !!arrow,
overlayClassName: overlayClassNameCustomized,
prefixCls: prefixCls,
getPopupContainer: getPopupContainer || getContextPopupContainer,
transitionName: memoTransitionName,
trigger: triggerActions,
overlay: renderOverlay,
placement: memoPlacement,
onVisibleChange: onInnerOpenChange,
overlayStyle: {
...mergedRootStyles,
zIndex
},
autoDestroy: destroyOnHidden ?? destroyPopupOnHide
}, popupTrigger);
if (zIndex) {
renderNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(zindexContext["default"].Provider, {
value: contextZIndex
}, renderNode);
}
return renderNode;
};
// We don't care debug panel
const dropdown_PurePanel = _util_PurePanel(dropdown_Dropdown, 'align', undefined, 'dropdown', prefixCls => prefixCls);
/* istanbul ignore next */
const WrapPurePanel = props => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(dropdown_PurePanel, {
...props
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", null)));
dropdown_Dropdown._InternalPanelDoNotUseOrYouWillBeFired = WrapPurePanel;
if (true) {
dropdown_Dropdown.displayName = 'Dropdown';
}
/* harmony default export */ var dropdown = (dropdown_Dropdown);
;// ./components/breadcrumb/BreadcrumbSeparator.tsx
const BreadcrumbSeparator = ({
children
}) => {
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('breadcrumb');
const breadcrumbContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(breadcrumb_BreadcrumbContext);
const {
classNames: mergedClassNames,
styles: mergedStyles
} = breadcrumbContext;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("li", {
className: (0,clsx.clsx)(`${prefixCls}-separator`, mergedClassNames?.separator),
style: mergedStyles?.separator,
"aria-hidden": "true"
}, children === '' ? children : children || '/');
};
BreadcrumbSeparator.__ANT_BREADCRUMB_SEPARATOR = true;
/* harmony default export */ var breadcrumb_BreadcrumbSeparator = (BreadcrumbSeparator);
;// ./components/breadcrumb/useItemRender.tsx
function getBreadcrumbName(route, params) {
if (!(0,is.isNonNullable)(route.title)) {
return null;
}
const paramsKeys = Object.keys(params).join('|');
return (0,is.isPlainObject)(route.title) ? route.title : String(route.title).replace(new RegExp(`:(${paramsKeys})`, 'g'), (replacement, key) => params[key] || replacement);
}
function renderItem(prefixCls, item, children, href) {
if (!(0,is.isNonNullable)(children)) {
return null;
}
const {
className,
onClick,
...restItem
} = item;
const passedProps = {
...(0,pickAttrs["default"])(restItem, {
data: true,
aria: true
}),
onClick
};
if (href !== undefined) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("a", {
...passedProps,
className: (0,clsx.clsx)(`${prefixCls}-link`, className),
href: href
}, children);
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
...passedProps,
className: (0,clsx.clsx)(`${prefixCls}-link`, className)
}, children);
}
function useItemRender(prefixCls, itemRender) {
const mergedItemRender = (item, params, routes, path, href) => {
if (itemRender) {
return itemRender(item, params, routes, path);
}
const name = getBreadcrumbName(item, params);
return renderItem(prefixCls, item, name, href);
};
return mergedItemRender;
}
;// ./components/breadcrumb/BreadcrumbItem.tsx
const InternalBreadcrumbItem = props => {
const {
prefixCls,
separator = '/',
children,
menu,
dropdownProps,
href,
dropdownIcon
} = props;
const breadcrumbContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(breadcrumb_BreadcrumbContext);
const {
classNames: mergedClassNames,
styles: mergedStyles
} = breadcrumbContext;
/** If overlay is have Wrap a Dropdown */
const renderBreadcrumbNode = breadcrumbItem => {
if (menu) {
const mergeDropDownProps = {
...dropdownProps
};
if (menu) {
const {
items,
...menuProps
} = menu || {};
mergeDropDownProps.menu = {
...menuProps,
items: items?.map(({
key,
title,
label,
path,
...itemProps
}, index) => {
let mergedLabel = label ?? title;
if (path) {
mergedLabel = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("a", {
href: `${href}${path}`
}, mergedLabel);
}
return {
...itemProps,
key: key ?? index,
label: mergedLabel
};
})
};
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(dropdown, {
placement: "bottom",
...mergeDropDownProps
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-overlay-link`
}, breadcrumbItem, dropdownIcon));
}
return breadcrumbItem;
};
// wrap to dropDown
const link = renderBreadcrumbNode(children);
if ((0,is.isNonNullable)(link)) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("li", {
className: (0,clsx.clsx)(`${prefixCls}-item`, mergedClassNames?.item),
style: mergedStyles?.item
}, link), separator && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(breadcrumb_BreadcrumbSeparator, null, separator));
}
return null;
};
const BreadcrumbItem = props => {
const {
prefixCls: customizePrefixCls,
children,
href,
...restProps
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('breadcrumb', customizePrefixCls);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(InternalBreadcrumbItem, {
...restProps,
prefixCls: prefixCls
}, renderItem(prefixCls, restProps, children, href));
};
BreadcrumbItem.__ANT_BREADCRUMB_ITEM = true;
/* harmony default export */ var breadcrumb_BreadcrumbItem = (BreadcrumbItem);
// EXTERNAL MODULE: ./components/breadcrumb/style/index.ts
var breadcrumb_style = __webpack_require__("./components/breadcrumb/style/index.ts");
;// ./components/breadcrumb/useItems.ts
function route2item(route) {
const {
breadcrumbName,
children,
...rest
} = route;
const clone = {
title: breadcrumbName,
...rest
};
if (children) {
clone.menu = {
items: children.map(({
breadcrumbName: itemBreadcrumbName,
...itemProps
}) => ({
...itemProps,
title: itemBreadcrumbName
}))
};
}
return clone;
}
function useItems(items, routes) {
return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (items) {
return items;
}
if (routes) {
return routes.map(route2item);
}
return null;
}, [items, routes]);
}
;// ./components/breadcrumb/Breadcrumb.tsx
const getPath = (params, path) => {
if (path === undefined) {
return path;
}
let mergedPath = (path || '').replace(/^\//, '');
Object.keys(params).forEach(key => {
mergedPath = mergedPath.replace(`:${key}`, params[key]);
});
return mergedPath;
};
const Breadcrumb = props => {
const {
prefixCls: customizePrefixCls,
separator,
style,
className,
rootClassName,
routes: legacyRoutes,
items,
children,
itemRender,
params = {},
classNames,
styles,
dropdownIcon,
...restProps
} = props;
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles,
separator: contextSeparator,
dropdownIcon: contextDropdownIcon
} = (0,config_provider_context.useComponentConfig)('breadcrumb');
const mergedSeparator = separator ?? contextSeparator ?? '/';
const mergedDropdownIcon = dropdownIcon ?? contextDropdownIcon ?? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_DownOutlined, null);
let crumbs;
const prefixCls = getPrefixCls('breadcrumb', customizePrefixCls);
const [hashId, cssVarCls] = (0,breadcrumb_style["default"])(prefixCls);
const mergedItems = useItems(items, legacyRoutes);
// =========== Merged Props for Semantic ==========
const mergedProps = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
return {
...props,
separator: mergedSeparator
};
}, [props, mergedSeparator]);
// ========================= Style ==========================
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
if (true) {
const warning = (0,_util_warning.devUseWarning)('Breadcrumb');
warning.deprecated(!legacyRoutes, 'routes', 'items');
// Deprecated warning for breadcrumb children
if (!mergedItems || mergedItems.length === 0) {
const childList = (0,es.toArray)(children);
warning.deprecated(childList.length === 0, 'Breadcrumb.Item and Breadcrumb.Separator', 'items');
childList.forEach(element => {
if (element) {
true ? warning(element.type && (element.type.__ANT_BREADCRUMB_ITEM === true || element.type.__ANT_BREADCRUMB_SEPARATOR === true), 'usage', "Only accepts Breadcrumb.Item and Breadcrumb.Separator as it's children") : 0;
}
});
}
}
const mergedItemRender = useItemRender(prefixCls, itemRender);
if (mergedItems && mergedItems.length > 0) {
// generated by route
const paths = [];
const itemRenderRoutes = items || legacyRoutes;
crumbs = mergedItems.map((item, index) => {
const {
path,
key,
type,
menu,
onClick,
className: itemClassName,
style,
separator: itemSeparator,
dropdownProps
} = item;
const mergedPath = getPath(params, path);
if (mergedPath !== undefined) {
paths.push(mergedPath);
}
const mergedKey = key ?? index;
if (type === 'separator') {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(breadcrumb_BreadcrumbSeparator, {
key: mergedKey
}, itemSeparator);
}
const itemProps = {};
const isLastItem = index === mergedItems.length - 1;
if (menu) {
itemProps.menu = menu;
}
let {
href
} = item;
if (paths.length && mergedPath !== undefined) {
href = `#/${paths.join('/')}`;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(InternalBreadcrumbItem, {
key: mergedKey,
...itemProps,
...(0,pickAttrs["default"])(item, {
data: true,
aria: true
}),
className: itemClassName,
style: style,
dropdownProps: dropdownProps,
dropdownIcon: mergedDropdownIcon,
href: href,
separator: isLastItem ? '' : mergedSeparator,
onClick: onClick,
prefixCls: prefixCls
}, mergedItemRender(item, params, itemRenderRoutes, paths, href));
});
} else if (children) {
const childrenLength = (0,es.toArray)(children).length;
crumbs = (0,es.toArray)(children).map((element, index) => {
if (!element) {
return element;
}
const isLastItem = index === childrenLength - 1;
return (0,reactNode.cloneElement)(element, {
separator: isLastItem ? '' : mergedSeparator,
// eslint-disable-next-line react/no-array-index-key
key: index
});
});
}
const breadcrumbClassName = (0,clsx.clsx)(prefixCls, contextClassName, {
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, rootClassName, mergedClassNames.root, hashId, cssVarCls);
const mergedStyle = {
...mergedStyles.root,
...contextStyle,
...style
};
const memoizedValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
classNames: mergedClassNames,
styles: mergedStyles
}), [mergedClassNames, mergedStyles]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(breadcrumb_BreadcrumbContext.Provider, {
value: memoizedValue
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("nav", {
className: breadcrumbClassName,
style: mergedStyle,
...restProps
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("ol", null, crumbs)));
};
if (true) {
Breadcrumb.displayName = 'Breadcrumb';
}
/* harmony default export */ var breadcrumb_Breadcrumb = (Breadcrumb);
;// ./components/breadcrumb/index.tsx
const components_breadcrumb_Breadcrumb = breadcrumb_Breadcrumb;
components_breadcrumb_Breadcrumb.Item = breadcrumb_BreadcrumbItem;
components_breadcrumb_Breadcrumb.Separator = breadcrumb_BreadcrumbSeparator;
/* harmony default export */ var breadcrumb = (components_breadcrumb_Breadcrumb);
;// ./components/button/index.tsx
/* harmony default export */ var components_button = (button_Button);
// EXTERNAL MODULE: external {"root":"dayjs","commonjs2":"dayjs","commonjs":"dayjs","amd":"dayjs"}
var external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_ = __webpack_require__("dayjs");
var external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default = /*#__PURE__*/__webpack_require__.n(external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_);
// EXTERNAL MODULE: ./node_modules/dayjs/plugin/weekday.js
var weekday = __webpack_require__("./node_modules/dayjs/plugin/weekday.js");
var weekday_default = /*#__PURE__*/__webpack_require__.n(weekday);
// EXTERNAL MODULE: ./node_modules/dayjs/plugin/localeData.js
var localeData = __webpack_require__("./node_modules/dayjs/plugin/localeData.js");
var localeData_default = /*#__PURE__*/__webpack_require__.n(localeData);
// EXTERNAL MODULE: ./node_modules/dayjs/plugin/weekOfYear.js
var weekOfYear = __webpack_require__("./node_modules/dayjs/plugin/weekOfYear.js");
var weekOfYear_default = /*#__PURE__*/__webpack_require__.n(weekOfYear);
// EXTERNAL MODULE: ./node_modules/dayjs/plugin/weekYear.js
var weekYear = __webpack_require__("./node_modules/dayjs/plugin/weekYear.js");
var weekYear_default = /*#__PURE__*/__webpack_require__.n(weekYear);
// EXTERNAL MODULE: ./node_modules/dayjs/plugin/advancedFormat.js
var advancedFormat = __webpack_require__("./node_modules/dayjs/plugin/advancedFormat.js");
var advancedFormat_default = /*#__PURE__*/__webpack_require__.n(advancedFormat);
// EXTERNAL MODULE: ./node_modules/dayjs/plugin/customParseFormat.js
var customParseFormat = __webpack_require__("./node_modules/dayjs/plugin/customParseFormat.js");
var customParseFormat_default = /*#__PURE__*/__webpack_require__.n(customParseFormat);
;// ./node_modules/@rc-component/picker/es/generate/dayjs.js
external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default().extend((customParseFormat_default()));
external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default().extend((advancedFormat_default()));
external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default().extend((weekday_default()));
external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default().extend((localeData_default()));
external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default().extend((weekOfYear_default()));
external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default().extend((weekYear_default()));
external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default().extend(function (o, c) {
// todo support Wo (ISO week)
var proto = c.prototype;
var oldFormat = proto.format;
proto.format = function f(formatStr) {
var str = (formatStr || '').replace('Wo', 'wo');
return oldFormat.bind(this)(str);
};
});
var localeMap = {
// ar_EG:
// az_AZ:
// bg_BG:
bn_BD: 'bn-bd',
by_BY: 'be',
// ca_ES:
// cs_CZ:
// da_DK:
// de_DE:
// el_GR:
en_GB: 'en-gb',
en_US: 'en',
// es_ES:
// et_EE:
// fa_IR:
// fi_FI:
fr_BE: 'fr',
// todo: dayjs has no fr_BE locale, use fr at present
fr_CA: 'fr-ca',
// fr_FR:
// ga_IE:
// gl_ES:
// he_IL:
// hi_IN:
// hr_HR:
// hu_HU:
hy_AM: 'hy-am',
// id_ID:
// is_IS:
// it_IT:
// ja_JP:
// ka_GE:
// kk_KZ:
// km_KH:
kmr_IQ: 'ku',
// kn_IN:
// ko_KR:
// ku_IQ: // previous ku in antd
// lt_LT:
// lv_LV:
// mk_MK:
// ml_IN:
// mn_MN:
// ms_MY:
// nb_NO:
// ne_NP:
nl_BE: 'nl-be',
// nl_NL:
// pl_PL:
pt_BR: 'pt-br',
// pt_PT:
// ro_RO:
// ru_RU:
// sk_SK:
// sl_SI:
// sr_RS:
// sv_SE:
// ta_IN:
// th_TH:
// tr_TR:
// uk_UA:
// ur_PK:
// vi_VN:
zh_CN: 'zh-cn',
zh_HK: 'zh-hk',
zh_TW: 'zh-tw'
};
var parseLocale = function parseLocale(locale) {
var mapLocale = localeMap[locale];
return mapLocale || locale.split('_')[0];
};
/* istanbul ignore next */
var parseNoMatchNotice = function parseNoMatchNotice() {
// zombieJ:
// When user typing, its always miss match format.
// This check is meaningless.
// https://github.com/ant-design/ant-design/issues/51839
// noteOnce(false, 'Not match any format. Please help to fire a issue about this.');
};
// Use internal dayjs instance to avoid implicit dependency on plugins extended by external dayjs versions
var getUDayjs = function getUDayjs(value) {
if (!external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default().isDayjs(value) || value instanceof (external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default())) {
return value;
}
return external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default()(value.valueOf());
};
var generateConfig = {
// get
getNow: function getNow() {
var now = external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default()();
// https://github.com/ant-design/ant-design/discussions/50934
if (typeof now.tz === 'function') {
return now.tz(); // use default timezone
}
return now;
},
getFixedDate: function getFixedDate(string) {
return external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default()(string, ['YYYY-M-DD', 'YYYY-MM-DD']);
},
getEndDate: function getEndDate(date) {
return getUDayjs(date).endOf('month');
},
getWeekDay: function getWeekDay(date) {
var clone = getUDayjs(date).locale('en');
return clone.weekday() + clone.localeData().firstDayOfWeek();
},
getYear: function getYear(date) {
return getUDayjs(date).year();
},
getMonth: function getMonth(date) {
return getUDayjs(date).month();
},
getDate: function getDate(date) {
return getUDayjs(date).date();
},
getHour: function getHour(date) {
return getUDayjs(date).hour();
},
getMinute: function getMinute(date) {
return getUDayjs(date).minute();
},
getSecond: function getSecond(date) {
return getUDayjs(date).second();
},
getMillisecond: function getMillisecond(date) {
return getUDayjs(date).millisecond();
},
// set
addYear: function addYear(date, diff) {
return getUDayjs(date).add(diff, 'year');
},
addMonth: function addMonth(date, diff) {
return getUDayjs(date).add(diff, 'month');
},
addDate: function addDate(date, diff) {
return getUDayjs(date).add(diff, 'day');
},
setYear: function setYear(date, year) {
return getUDayjs(date).year(year);
},
setMonth: function setMonth(date, month) {
return getUDayjs(date).month(month);
},
setDate: function setDate(date, num) {
return getUDayjs(date).date(num);
},
setHour: function setHour(date, hour) {
return getUDayjs(date).hour(hour);
},
setMinute: function setMinute(date, minute) {
return getUDayjs(date).minute(minute);
},
setSecond: function setSecond(date, second) {
return getUDayjs(date).second(second);
},
setMillisecond: function setMillisecond(date, milliseconds) {
return getUDayjs(date).millisecond(milliseconds);
},
// Compare
isAfter: function isAfter(date1, date2) {
return getUDayjs(date1).isAfter(getUDayjs(date2));
},
isValidate: function isValidate(date) {
return getUDayjs(date).isValid();
},
locale: {
getWeekFirstDay: function getWeekFirstDay(locale) {
return external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default()().locale(parseLocale(locale)).localeData().firstDayOfWeek();
},
getWeekFirstDate: function getWeekFirstDate(locale, date) {
return getUDayjs(date).locale(parseLocale(locale)).weekday(0);
},
getWeek: function getWeek(locale, date) {
return getUDayjs(date).locale(parseLocale(locale)).week();
},
getShortWeekDays: function getShortWeekDays(locale) {
return external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default()().locale(parseLocale(locale)).localeData().weekdaysMin();
},
getShortMonths: function getShortMonths(locale) {
return external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default()().locale(parseLocale(locale)).localeData().monthsShort();
},
format: function format(locale, date, _format) {
return getUDayjs(date).locale(parseLocale(locale)).format(_format);
},
parse: function parse(locale, text, formats) {
var localeStr = parseLocale(locale);
for (var i = 0; i < formats.length; i += 1) {
var format = formats[i];
var formatText = text;
if (format.includes('wo') || format.includes('Wo')) {
// parse Wo
var year = formatText.split('-')[0];
var weekStr = formatText.split('-')[1];
var firstWeek = external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default()(year, 'YYYY').startOf('year').locale(localeStr);
for (var j = 0; j <= 52; j += 1) {
var nextWeek = firstWeek.add(j, 'week');
if (nextWeek.format('Wo') === weekStr) {
return nextWeek;
}
}
parseNoMatchNotice();
return null;
}
var date = external_root_dayjs_commonjs2_dayjs_commonjs_dayjs_amd_dayjs_default()(formatText, format, true).locale(localeStr);
if (date.isValid()) {
return date;
}
}
if (text) {
parseNoMatchNotice();
}
return null;
}
}
};
/* harmony default export */ var dayjs = (generateConfig);
;// ./node_modules/@rc-component/picker/es/utils/uiUtil.js
// ====================== Mode ======================
function getRealPlacement(placement, rtl) {
if (placement !== undefined) {
return placement;
}
return rtl ? 'bottomRight' : 'bottomLeft';
}
;// ./node_modules/@rc-component/picker/es/PickerInput/context.js
var PickerContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
/* harmony default export */ var PickerInput_context = (PickerContext);
;// ./node_modules/@rc-component/picker/es/PickerTrigger/index.js
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var BUILT_IN_PLACEMENTS = {
bottomLeft: {
points: ['tl', 'bl'],
offset: [0, 4],
overflow: {
adjustX: 1,
adjustY: 1
}
},
bottomRight: {
points: ['tr', 'br'],
offset: [0, 4],
overflow: {
adjustX: 1,
adjustY: 1
}
},
topLeft: {
points: ['bl', 'tl'],
offset: [0, -4],
overflow: {
adjustX: 0,
adjustY: 1
}
},
topRight: {
points: ['br', 'tr'],
offset: [0, -4],
overflow: {
adjustX: 0,
adjustY: 1
}
}
};
function PickerTrigger(_ref) {
var popupElement = _ref.popupElement,
popupStyle = _ref.popupStyle,
popupClassName = _ref.popupClassName,
popupAlign = _ref.popupAlign,
transitionName = _ref.transitionName,
getPopupContainer = _ref.getPopupContainer,
children = _ref.children,
range = _ref.range,
placement = _ref.placement,
_ref$builtinPlacement = _ref.builtinPlacements,
builtinPlacements = _ref$builtinPlacement === void 0 ? BUILT_IN_PLACEMENTS : _ref$builtinPlacement,
direction = _ref.direction,
visible = _ref.visible,
onClose = _ref.onClose;
var _React$useContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PickerInput_context),
prefixCls = _React$useContext.prefixCls;
var dropdownPrefixCls = "".concat(prefixCls, "-dropdown");
var realPlacement = getRealPlacement(placement, direction === 'rtl');
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(trigger_es, {
showAction: [],
hideAction: ['click'],
popupPlacement: realPlacement,
builtinPlacements: builtinPlacements,
prefixCls: dropdownPrefixCls,
popupMotion: {
motionName: transitionName
},
popup: popupElement,
popupAlign: popupAlign,
popupVisible: visible,
popupClassName: (0,clsx.clsx)(popupClassName, _defineProperty(_defineProperty({}, "".concat(dropdownPrefixCls, "-range"), range), "".concat(dropdownPrefixCls, "-rtl"), direction === 'rtl')),
popupStyle: popupStyle,
stretch: "minWidth",
getPopupContainer: getPopupContainer,
onPopupVisibleChange: function onPopupVisibleChange(nextVisible) {
if (!nextVisible) {
onClose();
}
}
}, children);
}
/* harmony default export */ var es_PickerTrigger = (PickerTrigger);
;// ./node_modules/@rc-component/picker/es/utils/miscUtil.js
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
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 leftPad(str, length) {
var fill = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '0';
var current = String(str);
while (current.length < length) {
current = "".concat(fill).concat(current);
}
return current;
}
/**
* Convert `value` to array. Will provide `[]` if is null or undefined.
*/
function miscUtil_toArray(val) {
if (val === null || val === undefined) {
return [];
}
return Array.isArray(val) ? val : [val];
}
function fillIndex(ori, index, value) {
var clone = _toConsumableArray(ori);
clone[index] = value;
return clone;
}
/** Pick props from the key list. Will filter empty value */
function pickProps(props, keys) {
var clone = {};
var mergedKeys = keys || Object.keys(props);
mergedKeys.forEach(function (key) {
if (props[key] !== undefined) {
clone[key] = props[key];
}
});
return clone;
}
function getRowFormat(picker, locale, format) {
if (format) {
return format;
}
switch (picker) {
// All from the `locale.fieldXXXFormat` first
case 'time':
return locale.fieldTimeFormat;
case 'datetime':
return locale.fieldDateTimeFormat;
case 'month':
return locale.fieldMonthFormat;
case 'year':
return locale.fieldYearFormat;
case 'quarter':
return locale.fieldQuarterFormat;
case 'week':
return locale.fieldWeekFormat;
default:
return locale.fieldDateFormat;
}
}
function getFromDate(calendarValues, activeIndexList, activeIndex) {
var mergedActiveIndex = activeIndex !== undefined ? activeIndex : activeIndexList[activeIndexList.length - 1];
var firstValuedIndex = activeIndexList.find(function (index) {
return calendarValues[index];
});
return mergedActiveIndex !== firstValuedIndex ? calendarValues[firstValuedIndex] : undefined;
}
;// ./node_modules/@rc-component/picker/es/PickerTrigger/util.js
function pickTriggerProps(props) {
return pickProps(props, ['placement', 'builtinPlacements', 'popupAlign', 'getPopupContainer', 'transitionName', 'direction']);
}
;// ./node_modules/@rc-component/picker/es/PickerInput/hooks/useCellRender.js
function useCellRender_typeof(o) { "@babel/helpers - typeof"; return useCellRender_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, useCellRender_typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { useCellRender_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function useCellRender_defineProperty(obj, key, value) { key = useCellRender_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function useCellRender_toPropertyKey(t) { var i = useCellRender_toPrimitive(t, "string"); return "symbol" == useCellRender_typeof(i) ? i : String(i); }
function useCellRender_toPrimitive(t, r) { if ("object" != useCellRender_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != useCellRender_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function useCellRender(cellRender, dateRender, monthCellRender, range) {
// ========================= Warn =========================
if (true) {
(0,es.warning)(!dateRender, "'dateRender' is deprecated. Please use 'cellRender' instead.");
(0,es.warning)(!monthCellRender, "'monthCellRender' is deprecated. Please use 'cellRender' instead.");
}
// ======================== Render ========================
// Merged render
var mergedCellRender = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
if (cellRender) {
return cellRender;
}
return function (current, info) {
var date = current;
if (dateRender && info.type === 'date') {
return dateRender(date, info.today);
}
if (monthCellRender && info.type === 'month') {
return monthCellRender(date, info.locale);
}
return info.originNode;
};
}, [cellRender, monthCellRender, dateRender]);
// Cell render
var onInternalCellRender = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(function (date, info) {
return mergedCellRender(date, _objectSpread(_objectSpread({}, info), {}, {
range: range
}));
}, [mergedCellRender, range]);
return onInternalCellRender;
}
;// ./node_modules/@rc-component/picker/es/PickerInput/hooks/useFieldsInvalidate.js
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || useFieldsInvalidate_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 useFieldsInvalidate_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return useFieldsInvalidate_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 useFieldsInvalidate_arrayLikeToArray(o, minLen); }
function useFieldsInvalidate_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(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
/**
* Used to control each fields invalidate status
*/
function useFieldsInvalidate(calendarValue, isInvalidateDate) {
var allowEmpty = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
var _React$useState = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([false, false]),
_React$useState2 = _slicedToArray(_React$useState, 2),
fieldsInvalidates = _React$useState2[0],
setFieldsInvalidates = _React$useState2[1];
var onSelectorInvalid = function onSelectorInvalid(invalid, index) {
setFieldsInvalidates(function (ori) {
return fillIndex(ori, index, invalid);
});
};
/**
* For the Selector Input to mark as `aria-disabled`
*/
var submitInvalidates = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return fieldsInvalidates.map(function (invalid, index) {
// If typing invalidate
if (invalid) {
return true;
}
var current = calendarValue[index];
// Not check if all empty
if (!current) {
return false;
}
// Not allow empty
if (!allowEmpty[index] && !current) {
return true;
}
// Invalidate
if (current && isInvalidateDate(current, {
activeIndex: index
})) {
return true;
}
return false;
});
}, [calendarValue, fieldsInvalidates, isInvalidateDate, allowEmpty]);
return [submitInvalidates, onSelectorInvalid];
}
;// ./node_modules/@rc-component/picker/es/hooks/useLocale.js
function useLocale_typeof(o) { "@babel/helpers - typeof"; return useLocale_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, useLocale_typeof(o); }
function useLocale_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function useLocale_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? useLocale_ownKeys(Object(t), !0).forEach(function (r) { useLocale_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : useLocale_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function useLocale_defineProperty(obj, key, value) { key = useLocale_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function useLocale_toPropertyKey(t) { var i = useLocale_toPrimitive(t, "string"); return "symbol" == useLocale_typeof(i) ? i : String(i); }
function useLocale_toPrimitive(t, r) { if ("object" != useLocale_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != useLocale_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function fillTimeFormat(showHour, showMinute, showSecond, showMillisecond, showMeridiem) {
var timeFormat = '';
// Base HH:mm:ss
var cells = [];
if (showHour) {
cells.push(showMeridiem ? 'hh' : 'HH');
}
if (showMinute) {
cells.push('mm');
}
if (showSecond) {
cells.push('ss');
}
timeFormat = cells.join(':');
// Millisecond
if (showMillisecond) {
timeFormat += '.SSS';
}
// Meridiem
if (showMeridiem) {
timeFormat += ' A';
}
return timeFormat;
}
/**
* Used for `useFilledProps` since it already in the React.useMemo
*/
function fillLocale(locale, showHour, showMinute, showSecond, showMillisecond, use12Hours) {
// Not fill `monthFormat` since `locale.shortMonths` handle this
// Not fill `cellMeridiemFormat` since AM & PM by default
var fieldDateTimeFormat = locale.fieldDateTimeFormat,
fieldDateFormat = locale.fieldDateFormat,
fieldTimeFormat = locale.fieldTimeFormat,
fieldMonthFormat = locale.fieldMonthFormat,
fieldYearFormat = locale.fieldYearFormat,
fieldWeekFormat = locale.fieldWeekFormat,
fieldQuarterFormat = locale.fieldQuarterFormat,
yearFormat = locale.yearFormat,
cellYearFormat = locale.cellYearFormat,
cellQuarterFormat = locale.cellQuarterFormat,
dayFormat = locale.dayFormat,
cellDateFormat = locale.cellDateFormat;
var timeFormat = fillTimeFormat(showHour, showMinute, showSecond, showMillisecond, use12Hours);
return useLocale_objectSpread(useLocale_objectSpread({}, locale), {}, {
fieldDateTimeFormat: fieldDateTimeFormat || "YYYY-MM-DD ".concat(timeFormat),
fieldDateFormat: fieldDateFormat || 'YYYY-MM-DD',
fieldTimeFormat: fieldTimeFormat || timeFormat,
fieldMonthFormat: fieldMonthFormat || 'YYYY-MM',
fieldYearFormat: fieldYearFormat || 'YYYY',
fieldWeekFormat: fieldWeekFormat || 'gggg-wo',
fieldQuarterFormat: fieldQuarterFormat || 'YYYY-[Q]Q',
yearFormat: yearFormat || 'YYYY',
cellYearFormat: cellYearFormat || 'YYYY',
cellQuarterFormat: cellQuarterFormat || '[Q]Q',
cellDateFormat: cellDateFormat || dayFormat || 'D'
});
}
/**
* Fill locale format as start up
*/
function useLocale_useLocale(locale, showProps) {
var showHour = showProps.showHour,
showMinute = showProps.showMinute,
showSecond = showProps.showSecond,
showMillisecond = showProps.showMillisecond,
use12Hours = showProps.use12Hours;
return external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(function () {
return fillLocale(locale, showHour, showMinute, showSecond, showMillisecond, use12Hours);
}, [locale, showHour, showMinute, showSecond, showMillisecond, use12Hours]);
}
;// ./node_modules/@rc-component/picker/es/hooks/useTimeConfig.js
function useTimeConfig_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function useTimeConfig_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? useTimeConfig_ownKeys(Object(t), !0).forEach(function (r) { useTimeConfig_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : useTimeConfig_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function useTimeConfig_defineProperty(obj, key, value) { key = useTimeConfig_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function useTimeConfig_toPropertyKey(t) { var i = useTimeConfig_toPrimitive(t, "string"); return "symbol" == useTimeConfig_typeof(i) ? i : String(i); }
function useTimeConfig_toPrimitive(t, r) { if ("object" != useTimeConfig_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != useTimeConfig_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function useTimeConfig_slicedToArray(arr, i) { return useTimeConfig_arrayWithHoles(arr) || useTimeConfig_iterableToArrayLimit(arr, i) || useTimeConfig_unsupportedIterableToArray(arr, i) || useTimeConfig_nonIterableRest(); }
function useTimeConfig_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 useTimeConfig_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return useTimeConfig_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 useTimeConfig_arrayLikeToArray(o, minLen); }
function useTimeConfig_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 useTimeConfig_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function useTimeConfig_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function useTimeConfig_typeof(o) { "@babel/helpers - typeof"; return useTimeConfig_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, useTimeConfig_typeof(o); }
function checkShow(format, keywords, show) {
return show !== null && show !== void 0 ? show : keywords.some(function (keyword) {
return format.includes(keyword);
});
}
var showTimeKeys = [
// 'format',
'showNow', 'showHour', 'showMinute', 'showSecond', 'showMillisecond', 'use12Hours', 'hourStep', 'minuteStep', 'secondStep', 'millisecondStep', 'hideDisabledOptions', 'defaultValue', 'disabledHours', 'disabledMinutes', 'disabledSeconds', 'disabledMilliseconds', 'disabledTime', 'changeOnScroll', 'defaultOpenValue'];
/**
* Get SharedTimeProps from props.
*/
function pickTimeProps(props) {
var timeProps = pickProps(props, showTimeKeys);
var format = props.format,
picker = props.picker;
var propFormat = null;
if (format) {
propFormat = format;
if (Array.isArray(propFormat)) {
propFormat = propFormat[0];
}
propFormat = useTimeConfig_typeof(propFormat) === 'object' ? propFormat.format : propFormat;
}
if (picker === 'time') {
timeProps.format = propFormat;
}
return [timeProps, propFormat];
}
function isStringFormat(format) {
return format && typeof format === 'string';
}
/** Check if all the showXXX is `undefined` */
function existShowConfig(showHour, showMinute, showSecond, showMillisecond) {
return [showHour, showMinute, showSecond, showMillisecond].some(function (show) {
return show !== undefined;
});
}
/** Fill the showXXX if needed */
function fillShowConfig(hasShowConfig, showHour, showMinute, showSecond, showMillisecond) {
var parsedShowHour = showHour;
var parsedShowMinute = showMinute;
var parsedShowSecond = showSecond;
if (!hasShowConfig && !parsedShowHour && !parsedShowMinute && !parsedShowSecond && !showMillisecond) {
parsedShowHour = true;
parsedShowMinute = true;
parsedShowSecond = true;
} else if (hasShowConfig) {
var _parsedShowHour, _parsedShowMinute, _parsedShowSecond;
var existFalse = [parsedShowHour, parsedShowMinute, parsedShowSecond].some(function (show) {
return show === false;
});
var existTrue = [parsedShowHour, parsedShowMinute, parsedShowSecond].some(function (show) {
return show === true;
});
var defaultShow = existFalse ? true : !existTrue;
parsedShowHour = (_parsedShowHour = parsedShowHour) !== null && _parsedShowHour !== void 0 ? _parsedShowHour : defaultShow;
parsedShowMinute = (_parsedShowMinute = parsedShowMinute) !== null && _parsedShowMinute !== void 0 ? _parsedShowMinute : defaultShow;
parsedShowSecond = (_parsedShowSecond = parsedShowSecond) !== null && _parsedShowSecond !== void 0 ? _parsedShowSecond : defaultShow;
}
return [parsedShowHour, parsedShowMinute, parsedShowSecond, showMillisecond];
}
/**
* Get `showHour`, `showMinute`, `showSecond` or other from the props.
* This is pure function, will not get `showXXX` from the `format` prop.
*/
function getTimeProps(componentProps) {
var showTime = componentProps.showTime;
var _pickTimeProps = pickTimeProps(componentProps),
_pickTimeProps2 = useTimeConfig_slicedToArray(_pickTimeProps, 2),
pickedProps = _pickTimeProps2[0],
propFormat = _pickTimeProps2[1];
var showTimeConfig = showTime && useTimeConfig_typeof(showTime) === 'object' ? showTime : {};
var timeConfig = useTimeConfig_objectSpread(useTimeConfig_objectSpread({
defaultOpenValue: showTimeConfig.defaultOpenValue || showTimeConfig.defaultValue
}, pickedProps), showTimeConfig);
var showMillisecond = timeConfig.showMillisecond;
var showHour = timeConfig.showHour,
showMinute = timeConfig.showMinute,
showSecond = timeConfig.showSecond;
var hasShowConfig = existShowConfig(showHour, showMinute, showSecond, showMillisecond);
var _fillShowConfig = fillShowConfig(hasShowConfig, showHour, showMinute, showSecond, showMillisecond);
var _fillShowConfig2 = useTimeConfig_slicedToArray(_fillShowConfig, 3);
showHour = _fillShowConfig2[0];
showMinute = _fillShowConfig2[1];
showSecond = _fillShowConfig2[2];
return [timeConfig, useTimeConfig_objectSpread(useTimeConfig_objectSpread({}, timeConfig), {}, {
showHour: showHour,
showMinute: showMinute,
showSecond: showSecond,
showMillisecond: showMillisecond
}), timeConfig.format, propFormat];
}
function fillShowTimeConfig(picker, showTimeFormat, propFormat, timeConfig, locale) {
var isTimePicker = picker === 'time';
if (picker === 'datetime' || isTimePicker) {
var pickedProps = timeConfig;
// ====================== BaseFormat ======================
var defaultLocaleFormat = getRowFormat(picker, locale, null);
var baselineFormat = defaultLocaleFormat;
var formatList = [showTimeFormat, propFormat];
for (var i = 0; i < formatList.length; i += 1) {
var format = miscUtil_toArray(formatList[i])[0];
if (isStringFormat(format)) {
baselineFormat = format;
break;
}
}
// ========================= Show =========================
var showHour = pickedProps.showHour,
showMinute = pickedProps.showMinute,
showSecond = pickedProps.showSecond,
showMillisecond = pickedProps.showMillisecond;
var use12Hours = pickedProps.use12Hours;
var showMeridiem = checkShow(baselineFormat, ['a', 'A', 'LT', 'LLL', 'LTS'], use12Hours);
var hasShowConfig = existShowConfig(showHour, showMinute, showSecond, showMillisecond);
// Fill with format, if needed
if (!hasShowConfig) {
showHour = checkShow(baselineFormat, ['H', 'h', 'k', 'LT', 'LLL']);
showMinute = checkShow(baselineFormat, ['m', 'LT', 'LLL']);
showSecond = checkShow(baselineFormat, ['s', 'LTS']);
showMillisecond = checkShow(baselineFormat, ['SSS']);
}
// Fallback if all can not see
// ======================== Format ========================
var _fillShowConfig3 = fillShowConfig(hasShowConfig, showHour, showMinute, showSecond, showMillisecond);
var _fillShowConfig4 = useTimeConfig_slicedToArray(_fillShowConfig3, 3);
showHour = _fillShowConfig4[0];
showMinute = _fillShowConfig4[1];
showSecond = _fillShowConfig4[2];
var timeFormat = showTimeFormat || fillTimeFormat(showHour, showMinute, showSecond, showMillisecond, showMeridiem);
// ======================== Props =========================
return useTimeConfig_objectSpread(useTimeConfig_objectSpread({}, pickedProps), {}, {
// Format
format: timeFormat,
// Show Config
showHour: showHour,
showMinute: showMinute,
showSecond: showSecond,
showMillisecond: showMillisecond,
use12Hours: showMeridiem
});
}
return null;
}
;// ./node_modules/@rc-component/picker/es/PickerInput/Selector/hooks/useClearIcon.js
function useClearIcon_typeof(o) { "@babel/helpers - typeof"; return useClearIcon_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, useClearIcon_typeof(o); }
/**
* Used for `useFilledProps` since it already in the React.useMemo
*/
function fillClearIcon(prefixCls, allowClear, clearIcon) {
if ( true && clearIcon) {
(0,warning["default"])(false, '`clearIcon` will be removed in future. Please use `allowClear` instead.');
}
if (allowClear === false) {
return null;
}
var config = allowClear && useClearIcon_typeof(allowClear) === 'object' ? allowClear : {};
return config.clearIcon || clearIcon || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: "".concat(prefixCls, "-clear-btn")
});
}
;// ./node_modules/@rc-component/picker/es/utils/dateUtil.js
var WEEK_DAY_COUNT = 7;
/**
* Wrap the compare logic.
* This will compare the each of value is empty first.
* 1. All is empty, return true.
* 2. One is empty, return false.
* 3. return customize compare logic.
*/
function nullableCompare(value1, value2, oriCompareFn) {
if (!value1 && !value2 || value1 === value2) {
return true;
}
if (!value1 || !value2) {
return false;
}
return oriCompareFn();
}
function isSameDecade(generateConfig, decade1, decade2) {
return nullableCompare(decade1, decade2, function () {
var num1 = Math.floor(generateConfig.getYear(decade1) / 10);
var num2 = Math.floor(generateConfig.getYear(decade2) / 10);
return num1 === num2;
});
}
function isSameYear(generateConfig, year1, year2) {
return nullableCompare(year1, year2, function () {
return generateConfig.getYear(year1) === generateConfig.getYear(year2);
});
}
function getQuarter(generateConfig, date) {
var quota = Math.floor(generateConfig.getMonth(date) / 3);
return quota + 1;
}
function isSameQuarter(generateConfig, quarter1, quarter2) {
return nullableCompare(quarter1, quarter2, function () {
return isSameYear(generateConfig, quarter1, quarter2) && getQuarter(generateConfig, quarter1) === getQuarter(generateConfig, quarter2);
});
}
function isSameMonth(generateConfig, month1, month2) {
return nullableCompare(month1, month2, function () {
return isSameYear(generateConfig, month1, month2) && generateConfig.getMonth(month1) === generateConfig.getMonth(month2);
});
}
function isSameDate(generateConfig, date1, date2) {
return nullableCompare(date1, date2, function () {
return isSameYear(generateConfig, date1, date2) && isSameMonth(generateConfig, date1, date2) && generateConfig.getDate(date1) === generateConfig.getDate(date2);
});
}
function isSameTime(generateConfig, time1, time2) {
return nullableCompare(time1, time2, function () {
return generateConfig.getHour(time1) === generateConfig.getHour(time2) && generateConfig.getMinute(time1) === generateConfig.getMinute(time2) && generateConfig.getSecond(time1) === generateConfig.getSecond(time2);
});
}
/**
* Check if the Date is all the same of timestamp
*/
function isSameTimestamp(generateConfig, time1, time2) {
return nullableCompare(time1, time2, function () {
return isSameDate(generateConfig, time1, time2) && isSameTime(generateConfig, time1, time2) && generateConfig.getMillisecond(time1) === generateConfig.getMillisecond(time2);
});
}
function isSameWeek(generateConfig, locale, date1, date2) {
return nullableCompare(date1, date2, function () {
var weekStartDate1 = generateConfig.locale.getWeekFirstDate(locale, date1);
var weekStartDate2 = generateConfig.locale.getWeekFirstDate(locale, date2);
return isSameYear(generateConfig, weekStartDate1, weekStartDate2) && generateConfig.locale.getWeek(locale, date1) === generateConfig.locale.getWeek(locale, date2);
});
}
function isSame(generateConfig, locale, source, target, type) {
switch (type) {
case 'date':
return isSameDate(generateConfig, source, target);
case 'week':
return isSameWeek(generateConfig, locale.locale, source, target);
case 'month':
return isSameMonth(generateConfig, source, target);
case 'quarter':
return isSameQuarter(generateConfig, source, target);
case 'year':
return isSameYear(generateConfig, source, target);
case 'decade':
return isSameDecade(generateConfig, source, target);
case 'time':
return isSameTime(generateConfig, source, target);
default:
return isSameTimestamp(generateConfig, source, target);
}
}
/** Between in date but not equal of date */
function isInRange(generateConfig, startDate, endDate, current) {
if (!startDate || !endDate || !current) {
return false;
}
return generateConfig.isAfter(current, startDate) && generateConfig.isAfter(endDate, current);
}
function isSameOrAfter(generateConfig, locale, date1, date2, type) {
if (isSame(generateConfig, locale, date1, date2, type)) {
return true;
}
return generateConfig.isAfter(date1, date2);
}
function getWeekStartDate(locale, generateConfig, value) {
var weekFirstDay = generateConfig.locale.getWeekFirstDay(locale);
var monthStartDate = generateConfig.setDate(value, 1);
var startDateWeekDay = generateConfig.getWeekDay(monthStartDate);
var alignStartDate = generateConfig.addDate(monthStartDate, weekFirstDay - startDateWeekDay);
if (generateConfig.getMonth(alignStartDate) === generateConfig.getMonth(value) && generateConfig.getDate(alignStartDate) > 1) {
alignStartDate = generateConfig.addDate(alignStartDate, -7);
}
return alignStartDate;
}
function formatValue(value, _ref) {
var generateConfig = _ref.generateConfig,
locale = _ref.locale,
format = _ref.format;
if (!value) {
return '';
}
return typeof format === 'function' ? format(value) : generateConfig.locale.format(locale.locale, value, format);
}
/**
* Fill the time info into Date if provided.
*/
function fillTime(generateConfig, date, time) {
var tmpDate = date;
var getFn = ['getHour', 'getMinute', 'getSecond', 'getMillisecond'];
var setFn = ['setHour', 'setMinute', 'setSecond', 'setMillisecond'];
setFn.forEach(function (fn, index) {
if (time) {
tmpDate = generateConfig[fn](tmpDate, generateConfig[getFn[index]](time));
} else {
tmpDate = generateConfig[fn](tmpDate, 0);
}
});
return tmpDate;
}
;// ./node_modules/@rc-component/picker/es/PickerInput/hooks/useDisabledBoundary.js
/**
* Merge `disabledDate` with `minDate` & `maxDate`.
*/
function useDisabledBoundary(generateConfig, locale, disabledDate, minDate, maxDate) {
var mergedDisabledDate = (0,es.useEvent)(function (date, info) {
if (disabledDate && disabledDate(date, info)) {
return true;
}
if (minDate && generateConfig.isAfter(minDate, date) && !isSame(generateConfig, locale, minDate, date, info.type)) {
return true;
}
if (maxDate && generateConfig.isAfter(date, maxDate) && !isSame(generateConfig, locale, maxDate, date, info.type)) {
return true;
}
return false;
});
return mergedDisabledDate;
}
;// ./node_modules/@rc-component/picker/es/PickerInput/hooks/useFieldFormat.js
function useFieldFormat_typeof(o) { "@babel/helpers - typeof"; return useFieldFormat_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, useFieldFormat_typeof(o); }
function useFieldFormat(picker, locale, format) {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
var rawFormat = getRowFormat(picker, locale, format);
var formatList = miscUtil_toArray(rawFormat);
var firstFormat = formatList[0];
var maskFormat = useFieldFormat_typeof(firstFormat) === 'object' && firstFormat.type === 'mask' ? firstFormat.format : null;
return [
// Format list
formatList.map(function (config) {
return typeof config === 'string' || typeof config === 'function' ? config : config.format;
}),
// Mask Format
maskFormat];
}, [picker, locale, format]);
}
;// ./node_modules/@rc-component/picker/es/PickerInput/hooks/useInputReadOnly.js
function useInputReadOnly(formatList, inputReadOnly, multiple) {
if (typeof formatList[0] === 'function' || multiple) {
return true;
}
return inputReadOnly;
}
;// ./node_modules/@rc-component/picker/es/PickerInput/hooks/useInvalidate.js
function useInvalidate_typeof(o) { "@babel/helpers - typeof"; return useInvalidate_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, useInvalidate_typeof(o); }
function useInvalidate_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function useInvalidate_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? useInvalidate_ownKeys(Object(t), !0).forEach(function (r) { useInvalidate_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : useInvalidate_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function useInvalidate_defineProperty(obj, key, value) { key = useInvalidate_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function useInvalidate_toPropertyKey(t) { var i = useInvalidate_toPrimitive(t, "string"); return "symbol" == useInvalidate_typeof(i) ? i : String(i); }
function useInvalidate_toPrimitive(t, r) { if ("object" != useInvalidate_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != useInvalidate_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
/**
* Check if provided date is valid for the `disabledDate` & `showTime.disabledTime`.
*/
function useInvalidate(generateConfig, picker, disabledDate, showTime) {
// Check disabled date
var isInvalidate = (0,es.useEvent)(function (date, info) {
var outsideInfo = useInvalidate_objectSpread({
type: picker
}, info);
delete outsideInfo.activeIndex;
if (
// Date object is invalid
!generateConfig.isValidate(date) ||
// Date is disabled by `disabledDate`
disabledDate && disabledDate(date, outsideInfo)) {
return true;
}
if ((picker === 'date' || picker === 'time') && showTime) {
var _showTime$disabledTim;
var range = info && info.activeIndex === 1 ? 'end' : 'start';
var _ref = ((_showTime$disabledTim = showTime.disabledTime) === null || _showTime$disabledTim === void 0 ? void 0 : _showTime$disabledTim.call(showTime, date, range, {
from: outsideInfo.from
})) || {},
disabledHours = _ref.disabledHours,
disabledMinutes = _ref.disabledMinutes,
disabledSeconds = _ref.disabledSeconds,
disabledMilliseconds = _ref.disabledMilliseconds;
var legacyDisabledHours = showTime.disabledHours,
legacyDisabledMinutes = showTime.disabledMinutes,
legacyDisabledSeconds = showTime.disabledSeconds;
var mergedDisabledHours = disabledHours || legacyDisabledHours;
var mergedDisabledMinutes = disabledMinutes || legacyDisabledMinutes;
var mergedDisabledSeconds = disabledSeconds || legacyDisabledSeconds;
var hour = generateConfig.getHour(date);
var minute = generateConfig.getMinute(date);
var second = generateConfig.getSecond(date);
var millisecond = generateConfig.getMillisecond(date);
if (mergedDisabledHours && mergedDisabledHours().includes(hour)) {
return true;
}
if (mergedDisabledMinutes && mergedDisabledMinutes(hour).includes(minute)) {
return true;
}
if (mergedDisabledSeconds && mergedDisabledSeconds(hour, minute).includes(second)) {
return true;
}
if (disabledMilliseconds && disabledMilliseconds(hour, minute, second).includes(millisecond)) {
return true;
}
}
return false;
});
return isInvalidate;
}
;// ./node_modules/@rc-component/picker/es/PickerInput/hooks/useFilledProps.js
function useFilledProps_typeof(o) { "@babel/helpers - typeof"; return useFilledProps_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, useFilledProps_typeof(o); }
function useFilledProps_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function useFilledProps_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? useFilledProps_ownKeys(Object(t), !0).forEach(function (r) { useFilledProps_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : useFilledProps_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function useFilledProps_defineProperty(obj, key, value) { key = useFilledProps_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function useFilledProps_toPropertyKey(t) { var i = useFilledProps_toPrimitive(t, "string"); return "symbol" == useFilledProps_typeof(i) ? i : String(i); }
function useFilledProps_toPrimitive(t, r) { if ("object" != useFilledProps_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != useFilledProps_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function useFilledProps_slicedToArray(arr, i) { return useFilledProps_arrayWithHoles(arr) || useFilledProps_iterableToArrayLimit(arr, i) || useFilledProps_unsupportedIterableToArray(arr, i) || useFilledProps_nonIterableRest(); }
function useFilledProps_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 useFilledProps_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return useFilledProps_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 useFilledProps_arrayLikeToArray(o, minLen); }
function useFilledProps_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 useFilledProps_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function useFilledProps_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function useList(value) {
var fillMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var values = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
var list = value ? miscUtil_toArray(value) : value;
if (fillMode && list) {
list[1] = list[1] || list[0];
}
return list;
}, [value, fillMode]);
return values;
}
/**
* Align the outer props with unique typed and fill undefined props.
* This is shared with both RangePicker and Picker. This will do:
* - Convert `value` & `defaultValue` to array
* - handle the legacy props fill like `clearIcon` + `allowClear` = `clearIcon`
*/
function useFilledProps(props, updater) {
var generateConfig = props.generateConfig,
locale = props.locale,
_props$picker = props.picker,
picker = _props$picker === void 0 ? 'date' : _props$picker,
_props$prefixCls = props.prefixCls,
prefixCls = _props$prefixCls === void 0 ? 'rc-picker' : _props$prefixCls,
_props$previewValue = props.previewValue,
previewValue = _props$previewValue === void 0 ? 'hover' : _props$previewValue,
_props$styles = props.styles,
styles = _props$styles === void 0 ? {} : _props$styles,
_props$classNames = props.classNames,
classNames = _props$classNames === void 0 ? {} : _props$classNames,
_props$order = props.order,
order = _props$order === void 0 ? true : _props$order,
_props$components = props.components,
components = _props$components === void 0 ? {} : _props$components,
inputRender = props.inputRender,
allowClear = props.allowClear,
clearIcon = props.clearIcon,
needConfirm = props.needConfirm,
multiple = props.multiple,
format = props.format,
inputReadOnly = props.inputReadOnly,
disabledDate = props.disabledDate,
minDate = props.minDate,
maxDate = props.maxDate,
showTime = props.showTime,
value = props.value,
defaultValue = props.defaultValue,
pickerValue = props.pickerValue,
defaultPickerValue = props.defaultPickerValue;
var values = useList(value);
var defaultValues = useList(defaultValue);
var pickerValues = useList(pickerValue);
var defaultPickerValues = useList(defaultPickerValue);
// ======================== Picker ========================
/** Almost same as `picker`, but add `datetime` for `date` with `showTime` */
var internalPicker = picker === 'date' && showTime ? 'datetime' : picker;
/** The picker is `datetime` or `time` */
var multipleInteractivePicker = internalPicker === 'time' || internalPicker === 'datetime';
var complexPicker = multipleInteractivePicker || multiple;
var mergedNeedConfirm = needConfirm !== null && needConfirm !== void 0 ? needConfirm : multipleInteractivePicker;
// ========================== Time ==========================
// Auto `format` need to check `showTime.showXXX` first.
// And then merge the `locale` into `mergedShowTime`.
var _getTimeProps = getTimeProps(props),
_getTimeProps2 = useFilledProps_slicedToArray(_getTimeProps, 4),
timeProps = _getTimeProps2[0],
localeTimeProps = _getTimeProps2[1],
showTimeFormat = _getTimeProps2[2],
propFormat = _getTimeProps2[3];
// ======================= Locales ========================
var mergedLocale = useLocale_useLocale(locale, localeTimeProps);
var mergedShowTime = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return fillShowTimeConfig(internalPicker, showTimeFormat, propFormat, timeProps, mergedLocale);
}, [internalPicker, showTimeFormat, propFormat, timeProps, mergedLocale]);
// ======================= Warning ========================
if ( true && picker === 'time') {
if (['disabledHours', 'disabledMinutes', 'disabledSeconds'].some(function (key) {
return props[key];
})) {
(0,es.warning)(false, "'disabledHours', 'disabledMinutes', 'disabledSeconds' will be removed in the next major version, please use 'disabledTime' instead.");
}
}
// ======================== Props =========================
var filledProps = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return useFilledProps_objectSpread(useFilledProps_objectSpread({}, props), {}, {
previewValue: previewValue,
prefixCls: prefixCls,
locale: mergedLocale,
picker: picker,
styles: styles,
classNames: classNames,
order: order,
components: useFilledProps_objectSpread({
input: inputRender
}, components),
clearIcon: fillClearIcon(prefixCls, allowClear, clearIcon),
showTime: mergedShowTime,
value: values,
defaultValue: defaultValues,
pickerValue: pickerValues,
defaultPickerValue: defaultPickerValues
}, updater === null || updater === void 0 ? void 0 : updater());
}, [props]);
// ======================== Format ========================
var _useFieldFormat = useFieldFormat(internalPicker, mergedLocale, format),
_useFieldFormat2 = useFilledProps_slicedToArray(_useFieldFormat, 2),
formatList = _useFieldFormat2[0],
maskFormat = _useFieldFormat2[1];
// ======================= ReadOnly =======================
var mergedInputReadOnly = useInputReadOnly(formatList, inputReadOnly, multiple);
// ======================= Boundary =======================
var disabledBoundaryDate = useDisabledBoundary(generateConfig, locale, disabledDate, minDate, maxDate);
// ====================== Invalidate ======================
var isInvalidateDate = useInvalidate(generateConfig, picker, disabledBoundaryDate, mergedShowTime);
// ======================== Merged ========================
var mergedProps = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return useFilledProps_objectSpread(useFilledProps_objectSpread({}, filledProps), {}, {
needConfirm: mergedNeedConfirm,
inputReadOnly: mergedInputReadOnly,
disabledDate: disabledBoundaryDate
});
}, [filledProps, mergedNeedConfirm, mergedInputReadOnly, disabledBoundaryDate]);
return [mergedProps, internalPicker, complexPicker, formatList, maskFormat, isInvalidateDate];
}
;// ./node_modules/@rc-component/picker/es/PickerInput/hooks/useDelayState.js
function useDelayState_slicedToArray(arr, i) { return useDelayState_arrayWithHoles(arr) || useDelayState_iterableToArrayLimit(arr, i) || useDelayState_unsupportedIterableToArray(arr, i) || useDelayState_nonIterableRest(); }
function useDelayState_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 useDelayState_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return useDelayState_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 useDelayState_arrayLikeToArray(o, minLen); }
function useDelayState_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 useDelayState_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function useDelayState_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
/**
* Will be `true` immediately for next effect.
* But will be `false` for a delay of effect.
*/
function useDelayState(value, defaultValue, onChange) {
var _useControlledState = (0,es.useControlledState)(defaultValue, value),
_useControlledState2 = useDelayState_slicedToArray(_useControlledState, 2),
state = _useControlledState2[0],
setState = _useControlledState2[1];
// Need force update to ensure React re-render
var _React$useState = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState({}),
_React$useState2 = useDelayState_slicedToArray(_React$useState, 2),
forceUpdate = _React$useState2[1];
var triggerUpdate = (0,es.useEvent)(function (nextState) {
setState(nextState);
forceUpdate({});
});
var nextValueRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(value);
// ============================= Update =============================
var rafRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef();
var cancelRaf = function cancelRaf() {
raf["default"].cancel(rafRef.current);
};
var doUpdate = (0,es.useEvent)(function () {
triggerUpdate(nextValueRef.current);
if (onChange && state !== nextValueRef.current) {
onChange(nextValueRef.current);
}
});
var updateValue = (0,es.useEvent)(function (next, immediately) {
cancelRaf();
nextValueRef.current = next;
if (next || immediately) {
doUpdate();
} else {
rafRef.current = (0,raf["default"])(doUpdate);
}
});
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(function () {
return cancelRaf;
}, []);
return [state, updateValue];
}
;// ./node_modules/@rc-component/picker/es/PickerInput/hooks/useOpen.js
function useOpen_slicedToArray(arr, i) { return useOpen_arrayWithHoles(arr) || useOpen_iterableToArrayLimit(arr, i) || useOpen_unsupportedIterableToArray(arr, i) || useOpen_nonIterableRest(); }
function useOpen_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 useOpen_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return useOpen_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 useOpen_arrayLikeToArray(o, minLen); }
function useOpen_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 useOpen_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function useOpen_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
/**
* Control the open state.
* Will not close if activeElement is on the popup.
*/
function useOpen_useOpen(open, defaultOpen) {
var disabledList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
var onOpenChange = arguments.length > 3 ? arguments[3] : undefined;
var mergedOpen = disabledList.every(function (disabled) {
return disabled;
}) ? false : open;
// Delay for handle the open state, in case fast shift from `open` -> `close` -> `open`
// const [rafOpen, setRafOpen] = useLockState(open, defaultOpen || false, onOpenChange);
var _useDelayState = useDelayState(mergedOpen, defaultOpen || false, onOpenChange),
_useDelayState2 = useOpen_slicedToArray(_useDelayState, 2),
rafOpen = _useDelayState2[0],
setRafOpen = _useDelayState2[1];
function setOpen(next) {
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (!config.inherit || rafOpen) {
setRafOpen(next, config.force);
}
}
return [rafOpen, setOpen];
}
;// ./node_modules/@rc-component/picker/es/PickerInput/hooks/usePickerRef.js
function usePickerRef(ref) {
var selectorRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, function () {
var _selectorRef$current;
return {
nativeElement: (_selectorRef$current = selectorRef.current) === null || _selectorRef$current === void 0 ? void 0 : _selectorRef$current.nativeElement,
focus: function focus(options) {
var _selectorRef$current2;
(_selectorRef$current2 = selectorRef.current) === null || _selectorRef$current2 === void 0 || _selectorRef$current2.focus(options);
},
blur: function blur() {
var _selectorRef$current3;
(_selectorRef$current3 = selectorRef.current) === null || _selectorRef$current3 === void 0 || _selectorRef$current3.blur();
}
};
});
return selectorRef;
}
;// ./node_modules/@rc-component/picker/es/PickerInput/hooks/usePresets.js
function usePresets_slicedToArray(arr, i) { return usePresets_arrayWithHoles(arr) || usePresets_iterableToArrayLimit(arr, i) || usePresets_unsupportedIterableToArray(arr, i) || usePresets_nonIterableRest(); }
function usePresets_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 usePresets_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return usePresets_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 usePresets_arrayLikeToArray(o, minLen); }
function usePresets_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 usePresets_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function usePresets_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function usePresets(presets, legacyRanges) {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
if (presets) {
return presets;
}
if (legacyRanges) {
(0,warning["default"])(false, '`ranges` is deprecated. Please use `presets` instead.');
return Object.entries(legacyRanges).map(function (_ref) {
var _ref2 = usePresets_slicedToArray(_ref, 2),
label = _ref2[0],
value = _ref2[1];
return {
label: label,
value: value
};
});
}
return [];
}, [presets, legacyRanges]);
}
;// ./node_modules/@rc-component/picker/es/PickerInput/hooks/useLockEffect.js
/**
* Trigger `callback` immediately when `condition` is `true`.
* But trigger `callback` in next frame when `condition` is `false`.
*/
function useLockEffect(condition, callback) {
var delayFrames = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var callbackRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(callback);
callbackRef.current = callback;
(0,useLayoutEffect.useLayoutUpdateEffect)(function () {
if (condition) {
callbackRef.current(condition);
} else {
var id = (0,raf["default"])(function () {
callbackRef.current(condition);
}, delayFrames);
return function () {
raf["default"].cancel(id);
};
}
}, [condition]);
}
;// ./node_modules/@rc-component/picker/es/PickerInput/hooks/useRangeActive.js
function useRangeActive_slicedToArray(arr, i) { return useRangeActive_arrayWithHoles(arr) || useRangeActive_iterableToArrayLimit(arr, i) || useRangeActive_unsupportedIterableToArray(arr, i) || useRangeActive_nonIterableRest(); }
function useRangeActive_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 useRangeActive_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return useRangeActive_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 useRangeActive_arrayLikeToArray(o, minLen); }
function useRangeActive_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 useRangeActive_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function useRangeActive_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
/**
* When user first focus one input, any submit will trigger focus another one.
* When second time focus one input, submit will not trigger focus again.
* When click outside to close the panel, trigger event if it can trigger onChange.
*/
function useRangeActive(disabled) {
var empty = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var mergedOpen = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var _React$useState = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0),
_React$useState2 = useRangeActive_slicedToArray(_React$useState, 2),
activeIndex = _React$useState2[0],
setActiveIndex = _React$useState2[1];
var _React$useState3 = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false),
_React$useState4 = useRangeActive_slicedToArray(_React$useState3, 2),
focused = _React$useState4[0],
setFocused = _React$useState4[1];
var activeListRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef([]);
var submitIndexRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
var lastOperationRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
var updateSubmitIndex = function updateSubmitIndex(index) {
submitIndexRef.current = index;
};
var hasActiveSubmitValue = function hasActiveSubmitValue(index) {
return submitIndexRef.current === index;
};
var triggerFocus = function triggerFocus(nextFocus) {
setFocused(nextFocus);
};
// ============================= Record =============================
var lastOperation = function lastOperation(type) {
if (type) {
lastOperationRef.current = type;
}
return lastOperationRef.current;
};
// ============================ Strategy ============================
// Trigger when input enter or input blur or panel close
var nextActiveIndex = function nextActiveIndex(nextValue) {
var list = activeListRef.current;
var filledActiveSet = new Set(list.filter(function (index) {
return nextValue[index] || empty[index];
}));
var nextIndex = list[list.length - 1] === 0 ? 1 : 0;
if (filledActiveSet.size >= 2 || disabled[nextIndex]) {
return null;
}
return nextIndex;
};
// ============================= Effect =============================
// Wait in case it's from the click outside to blur
useLockEffect(focused || mergedOpen, function () {
if (!focused) {
activeListRef.current = [];
updateSubmitIndex(null);
}
});
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(function () {
if (focused) {
activeListRef.current.push(activeIndex);
}
}, [focused, activeIndex]);
return [focused, triggerFocus, lastOperation, activeIndex, setActiveIndex, nextActiveIndex, activeListRef.current, updateSubmitIndex, hasActiveSubmitValue];
}
;// ./node_modules/@rc-component/picker/es/PickerInput/hooks/useRangeDisabledDate.js
function useRangeDisabledDate_typeof(o) { "@babel/helpers - typeof"; return useRangeDisabledDate_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, useRangeDisabledDate_typeof(o); }
function useRangeDisabledDate_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function useRangeDisabledDate_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? useRangeDisabledDate_ownKeys(Object(t), !0).forEach(function (r) { useRangeDisabledDate_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : useRangeDisabledDate_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function useRangeDisabledDate_defineProperty(obj, key, value) { key = useRangeDisabledDate_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function useRangeDisabledDate_toPropertyKey(t) { var i = useRangeDisabledDate_toPrimitive(t, "string"); return "symbol" == useRangeDisabledDate_typeof(i) ? i : String(i); }
function useRangeDisabledDate_toPrimitive(t, r) { if ("object" != useRangeDisabledDate_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != useRangeDisabledDate_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function useRangeDisabledDate_slicedToArray(arr, i) { return useRangeDisabledDate_arrayWithHoles(arr) || useRangeDisabledDate_iterableToArrayLimit(arr, i) || useRangeDisabledDate_unsupportedIterableToArray(arr, i) || useRangeDisabledDate_nonIterableRest(); }
function useRangeDisabledDate_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 useRangeDisabledDate_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return useRangeDisabledDate_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 useRangeDisabledDate_arrayLikeToArray(o, minLen); }
function useRangeDisabledDate_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 useRangeDisabledDate_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function useRangeDisabledDate_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
/**
* RangePicker need additional logic to handle the `disabled` case. e.g.
* [disabled, enabled] should end date not before start date
*/
function useRangeDisabledDate(values, disabled, activeIndexList, generateConfig, locale, disabledDate) {
var activeIndex = activeIndexList[activeIndexList.length - 1];
var rangeDisabledDate = function rangeDisabledDate(date, info) {
var _values = useRangeDisabledDate_slicedToArray(values, 2),
start = _values[0],
end = _values[1];
var mergedInfo = useRangeDisabledDate_objectSpread(useRangeDisabledDate_objectSpread({}, info), {}, {
from: getFromDate(values, activeIndexList)
});
// ============================ Disabled ============================
// Should not select days before the start date
if (activeIndex === 1 && disabled[0] && start &&
// Same date isOK
!isSame(generateConfig, locale, start, date, mergedInfo.type) &&
// Before start date
generateConfig.isAfter(start, date)) {
return true;
}
// Should not select days after the end date
if (activeIndex === 0 && disabled[1] && end &&
// Same date isOK
!isSame(generateConfig, locale, end, date, mergedInfo.type) &&
// After end date
generateConfig.isAfter(date, end)) {
return true;
}
// ============================= Origin =============================
return disabledDate === null || disabledDate === void 0 ? void 0 : disabledDate(date, mergedInfo);
};
return rangeDisabledDate;
}
;// ./node_modules/@rc-component/picker/es/PickerInput/hooks/useRangePickerValue.js
function useRangePickerValue_slicedToArray(arr, i) { return useRangePickerValue_arrayWithHoles(arr) || useRangePickerValue_iterableToArrayLimit(arr, i) || useRangePickerValue_unsupportedIterableToArray(arr, i) || useRangePickerValue_nonIterableRest(); }
function useRangePickerValue_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 useRangePickerValue_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return useRangePickerValue_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 useRangePickerValue_arrayLikeToArray(o, minLen); }
function useRangePickerValue_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 useRangePickerValue_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function useRangePickerValue_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function offsetPanelDate(generateConfig, picker, date, offset) {
switch (picker) {
case 'date':
case 'week':
return generateConfig.addMonth(date, offset);
case 'month':
case 'quarter':
return generateConfig.addYear(date, offset);
case 'year':
return generateConfig.addYear(date, offset * 10);
case 'decade':
return generateConfig.addYear(date, offset * 100);
default:
return date;
}
}
var useRangePickerValue_EMPTY_LIST = [];
function useRangePickerValue(generateConfig, locale, calendarValue, modes, open, activeIndex, pickerMode, multiplePanel) {
var defaultPickerValue = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : useRangePickerValue_EMPTY_LIST;
var pickerValue = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : useRangePickerValue_EMPTY_LIST;
var timeDefaultValue = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : useRangePickerValue_EMPTY_LIST;
var onPickerValueChange = arguments.length > 11 ? arguments[11] : undefined;
var minDate = arguments.length > 12 ? arguments[12] : undefined;
var maxDate = arguments.length > 13 ? arguments[13] : undefined;
var isTimePicker = pickerMode === 'time';
// ======================== Active ========================
// `activeIndex` must be valid to avoid getting empty `pickerValue`
var mergedActiveIndex = activeIndex || 0;
// ===================== Picker Value =====================
var getDefaultPickerValue = function getDefaultPickerValue(index) {
var now = generateConfig.getNow();
if (isTimePicker) {
now = fillTime(generateConfig, now);
}
return defaultPickerValue[index] || calendarValue[index] || now;
};
// Align `pickerValue` with `showTime.defaultValue`
var _pickerValue = useRangePickerValue_slicedToArray(pickerValue, 2),
startPickerValue = _pickerValue[0],
endPickerValue = _pickerValue[1];
// PickerValue state
var _useControlledState = (0,es.useControlledState)(function () {
return getDefaultPickerValue(0);
}, startPickerValue),
_useControlledState2 = useRangePickerValue_slicedToArray(_useControlledState, 2),
mergedStartPickerValue = _useControlledState2[0],
setStartPickerValue = _useControlledState2[1];
var _useControlledState3 = (0,es.useControlledState)(function () {
return getDefaultPickerValue(1);
}, endPickerValue),
_useControlledState4 = useRangePickerValue_slicedToArray(_useControlledState3, 2),
mergedEndPickerValue = _useControlledState4[0],
setEndPickerValue = _useControlledState4[1];
// Current PickerValue
var currentPickerValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
var current = [mergedStartPickerValue, mergedEndPickerValue][mergedActiveIndex];
// Merge the `showTime.defaultValue` into `pickerValue`
return isTimePicker ? current : fillTime(generateConfig, current, timeDefaultValue[mergedActiveIndex]);
}, [isTimePicker, mergedStartPickerValue, mergedEndPickerValue, mergedActiveIndex, generateConfig, timeDefaultValue]);
var setCurrentPickerValue = function setCurrentPickerValue(nextPickerValue) {
var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'panel';
var updater = [setStartPickerValue, setEndPickerValue][mergedActiveIndex];
updater(nextPickerValue);
var clone = [mergedStartPickerValue, mergedEndPickerValue];
clone[mergedActiveIndex] = nextPickerValue;
if (onPickerValueChange && (!isSame(generateConfig, locale, mergedStartPickerValue, clone[0], pickerMode) || !isSame(generateConfig, locale, mergedEndPickerValue, clone[1], pickerMode))) {
onPickerValueChange(clone, {
source: source,
range: mergedActiveIndex === 1 ? 'end' : 'start',
mode: modes
});
}
};
// ======================== Effect ========================
/**
* EndDate pickerValue is little different. It should be:
* - If date picker (without time), endDate is not same year & month as startDate
* - pickerValue minus one month
* - Else pass directly
*/
var getEndDatePickerValue = function getEndDatePickerValue(startDate, endDate) {
if (multiplePanel) {
// Basic offset
var SAME_CHECKER = {
date: 'month',
week: 'month',
month: 'year',
quarter: 'year'
};
var mode = SAME_CHECKER[pickerMode];
if (mode && !isSame(generateConfig, locale, startDate, endDate, mode)) {
return offsetPanelDate(generateConfig, pickerMode, endDate, -1);
}
// Year offset
if (pickerMode === 'year' && startDate) {
var srcYear = Math.floor(generateConfig.getYear(startDate) / 10);
var tgtYear = Math.floor(generateConfig.getYear(endDate) / 10);
if (srcYear !== tgtYear) {
return offsetPanelDate(generateConfig, pickerMode, endDate, -1);
}
}
}
return endDate;
};
// >>> When switch field, reset the picker value as prev field picker value
var prevActiveIndexRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
(0,useLayoutEffect["default"])(function () {
if (open) {
if (!defaultPickerValue[mergedActiveIndex]) {
var nextPickerValue = isTimePicker ? null : generateConfig.getNow();
/**
* 1. If has prevActiveIndex, use it to avoid panel jump
* 2. If current field has value
* - If `activeIndex` is 1 and `calendarValue[0]` is not same panel as `calendarValue[1]`,
* offset `calendarValue[1]` and set it
* - Else use `calendarValue[activeIndex]`
* 3. If current field has no value but another field has value, use another field value
* 4. Else use now (not any `calendarValue` can ref)
*/
if (prevActiveIndexRef.current !== null && prevActiveIndexRef.current !== mergedActiveIndex) {
// If from another field, not jump picker value
nextPickerValue = [mergedStartPickerValue, mergedEndPickerValue][mergedActiveIndex ^ 1];
} else if (calendarValue[mergedActiveIndex]) {
// Current field has value
nextPickerValue = mergedActiveIndex === 0 ? calendarValue[0] : getEndDatePickerValue(calendarValue[0], calendarValue[1]);
} else if (calendarValue[mergedActiveIndex ^ 1]) {
// Current field has no value but another field has value
nextPickerValue = calendarValue[mergedActiveIndex ^ 1];
}
// Only sync when has value, this will sync in the `min-max` logic
if (nextPickerValue) {
// nextPickerValue < minDate
if (minDate && generateConfig.isAfter(minDate, nextPickerValue)) {
nextPickerValue = minDate;
}
// maxDate < nextPickerValue
var offsetPickerValue = multiplePanel ? offsetPanelDate(generateConfig, pickerMode, nextPickerValue, 1) : nextPickerValue;
if (maxDate && generateConfig.isAfter(offsetPickerValue, maxDate)) {
nextPickerValue = multiplePanel ? offsetPanelDate(generateConfig, pickerMode, maxDate, -1) : maxDate;
}
setCurrentPickerValue(nextPickerValue, 'reset');
}
}
}
}, [open, mergedActiveIndex, calendarValue[mergedActiveIndex]]);
// >>> Reset prevActiveIndex when panel closed
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(function () {
if (open) {
prevActiveIndexRef.current = mergedActiveIndex;
} else {
prevActiveIndexRef.current = null;
}
}, [open, mergedActiveIndex]);
// >>> defaultPickerValue: Resync to `defaultPickerValue` for each panel focused
(0,useLayoutEffect["default"])(function () {
if (open && defaultPickerValue) {
if (defaultPickerValue[mergedActiveIndex]) {
setCurrentPickerValue(defaultPickerValue[mergedActiveIndex], 'reset');
}
}
}, [open, mergedActiveIndex]);
return [currentPickerValue, setCurrentPickerValue];
}
;// ./node_modules/@rc-component/picker/es/hooks/useSyncState.js
function useSyncState_slicedToArray(arr, i) { return useSyncState_arrayWithHoles(arr) || useSyncState_iterableToArrayLimit(arr, i) || useSyncState_unsupportedIterableToArray(arr, i) || useSyncState_nonIterableRest(); }
function useSyncState_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 useSyncState_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return useSyncState_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 useSyncState_arrayLikeToArray(o, minLen); }
function useSyncState_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 useSyncState_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function useSyncState_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
/**
* Sync value with state.
* This should only used for internal which not affect outside calculation.
* Since it's not safe for suspense.
*/
function useSyncState(defaultValue, controlledValue) {
var valueRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(defaultValue);
var _React$useState = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState({}),
_React$useState2 = useSyncState_slicedToArray(_React$useState, 2),
forceUpdate = _React$useState2[1];
var getter = function getter(useControlledValueFirst) {
return useControlledValueFirst && controlledValue !== undefined ? controlledValue : valueRef.current;
};
var setter = function setter(nextValue) {
valueRef.current = nextValue;
forceUpdate({});
};
return [getter, setter, getter(true)];
}
;// ./node_modules/@rc-component/picker/es/PickerInput/hooks/useRangeValue.js
function useRangeValue_slicedToArray(arr, i) { return useRangeValue_arrayWithHoles(arr) || useRangeValue_iterableToArrayLimit(arr, i) || useRangeValue_unsupportedIterableToArray(arr, i) || useRangeValue_nonIterableRest(); }
function useRangeValue_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 useRangeValue_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function useRangeValue_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function useRangeValue_toConsumableArray(arr) { return useRangeValue_arrayWithoutHoles(arr) || useRangeValue_iterableToArray(arr) || useRangeValue_unsupportedIterableToArray(arr) || useRangeValue_nonIterableSpread(); }
function useRangeValue_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function useRangeValue_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return useRangeValue_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 useRangeValue_arrayLikeToArray(o, minLen); }
function useRangeValue_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function useRangeValue_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return useRangeValue_arrayLikeToArray(arr); }
function useRangeValue_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; }
var EMPTY_VALUE = [];
// Submit Logic:
// * ✅ Value:
// * merged value using controlled value, if not, use stateValue
// * When merged value change, [1] resync calendar value and submit value
// * ✅ Calender Value:
// * 💻 When user typing is validate, change the calendar value
// * 🌅 When user click on the panel, change the calendar value
// * Submit Value:
// * 💻 When user blur the input, flush calendar value to submit value
// * 🌅 When user click on the panel is no needConfirm, flush calendar value to submit value
// * 🌅 When user click on the panel is needConfirm and click OK, flush calendar value to submit value
// * Blur logic & close logic:
// * ✅ For value, always try flush submit
// * ✅ If `needConfirm`, reset as [1]
// * Else (`!needConfirm`)
// * If has another index field, active another index
// * ✅ Flush submit:
// * If all the start & end field is confirmed or all blur or panel closed
// * Update `needSubmit` mark to true
// * trigger onChange by `needSubmit` and update stateValue
function useUtil(generateConfig, locale, formatList) {
var getDateTexts = function getDateTexts(dates) {
return dates.map(function (date) {
return formatValue(date, {
generateConfig: generateConfig,
locale: locale,
format: formatList[0]
});
});
};
var isSameDates = function isSameDates(source, target) {
var maxLen = Math.max(source.length, target.length);
var diffIndex = -1;
for (var i = 0; i < maxLen; i += 1) {
var prev = source[i] || null;
var next = target[i] || null;
if (prev !== next && !isSameTimestamp(generateConfig, prev, next)) {
diffIndex = i;
break;
}
}
return [diffIndex < 0, diffIndex !== 0];
};
return [getDateTexts, isSameDates];
}
function orderDates(dates, generateConfig) {
return useRangeValue_toConsumableArray(dates).sort(function (a, b) {
return generateConfig.isAfter(a, b) ? 1 : -1;
});
}
/**
* Used for internal value management.
* It should always use `mergedValue` in render logic
*/
function useCalendarValue(mergedValue) {
var _useSyncState = useSyncState(mergedValue),
_useSyncState2 = useRangeValue_slicedToArray(_useSyncState, 2),
calendarValue = _useSyncState2[0],
setCalendarValue = _useSyncState2[1];
/** Sync calendarValue & submitValue back with value */
var syncWithValue = (0,es.useEvent)(function () {
setCalendarValue(mergedValue);
});
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(function () {
syncWithValue();
}, [mergedValue]);
return [calendarValue, setCalendarValue];
}
/**
* Control the internal `value` align with prop `value` and provide a temp `calendarValue` for ui.
* `calendarValue` will be reset when blur & focus & open.
*/
function useInnerValue(generateConfig, locale, formatList, /** Used for RangePicker. `true` means [DateType, DateType] or will be DateType[] */
rangeValue,
/**
* Trigger order when trigger calendar value change.
* This should only used in SinglePicker with `multiple` mode.
* So when `rangeValue` is `true`, order will be ignored.
*/
order, defaultValue, value, onCalendarChange, onOk) {
// This is the root value which will sync with controlled or uncontrolled value
var _useControlledState = (0,es.useControlledState)(defaultValue, value),
_useControlledState2 = useRangeValue_slicedToArray(_useControlledState, 2),
innerValue = _useControlledState2[0],
setInnerValue = _useControlledState2[1];
var mergedValue = innerValue || EMPTY_VALUE;
// ========================= Inner Values =========================
var _useCalendarValue = useCalendarValue(mergedValue),
_useCalendarValue2 = useRangeValue_slicedToArray(_useCalendarValue, 2),
calendarValue = _useCalendarValue2[0],
setCalendarValue = _useCalendarValue2[1];
// ============================ Change ============================
var _useUtil = useUtil(generateConfig, locale, formatList),
_useUtil2 = useRangeValue_slicedToArray(_useUtil, 2),
getDateTexts = _useUtil2[0],
isSameDates = _useUtil2[1];
var triggerCalendarChange = (0,es.useEvent)(function (nextCalendarValues) {
var clone = useRangeValue_toConsumableArray(nextCalendarValues);
if (rangeValue) {
for (var i = 0; i < 2; i += 1) {
clone[i] = clone[i] || null;
}
} else if (order) {
clone = orderDates(clone.filter(function (date) {
return date;
}), generateConfig);
}
// Update merged value
var _isSameDates = isSameDates(calendarValue(), clone),
_isSameDates2 = useRangeValue_slicedToArray(_isSameDates, 2),
isSameMergedDates = _isSameDates2[0],
isSameStart = _isSameDates2[1];
if (!isSameMergedDates) {
setCalendarValue(clone);
// Trigger calendar change event
if (onCalendarChange) {
var cellTexts = getDateTexts(clone);
onCalendarChange(clone, cellTexts, {
range: isSameStart ? 'end' : 'start'
});
}
}
});
var triggerOk = function triggerOk() {
if (onOk) {
onOk(calendarValue());
}
};
return [mergedValue, setInnerValue, calendarValue, triggerCalendarChange, triggerOk];
}
function useRangeValue(info, mergedValue, setInnerValue, getCalendarValue, triggerCalendarChange, disabled, formatList, focused, open, isInvalidateDate) {
var generateConfig = info.generateConfig,
locale = info.locale,
picker = info.picker,
onChange = info.onChange,
allowEmpty = info.allowEmpty,
order = info.order;
var orderOnChange = disabled.some(function (d) {
return d;
}) ? false : order;
// ============================= Util =============================
var _useUtil3 = useUtil(generateConfig, locale, formatList),
_useUtil4 = useRangeValue_slicedToArray(_useUtil3, 2),
getDateTexts = _useUtil4[0],
isSameDates = _useUtil4[1];
// ============================ Values ============================
// Used for trigger `onChange` event.
// Record current value which is wait for submit.
var _useSyncState3 = useSyncState(mergedValue),
_useSyncState4 = useRangeValue_slicedToArray(_useSyncState3, 2),
submitValue = _useSyncState4[0],
setSubmitValue = _useSyncState4[1];
/** Sync calendarValue & submitValue back with value */
var syncWithValue = (0,es.useEvent)(function () {
setSubmitValue(mergedValue);
});
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(function () {
syncWithValue();
}, [mergedValue]);
// ============================ Submit ============================
var triggerSubmit = (0,es.useEvent)(function (nextValue) {
var isNullValue = nextValue === null;
var clone = useRangeValue_toConsumableArray(nextValue || submitValue());
// Fill null value
if (isNullValue) {
var maxLen = Math.max(disabled.length, clone.length);
for (var i = 0; i < maxLen; i += 1) {
if (!disabled[i]) {
clone[i] = null;
}
}
}
// Only when exist value to sort
if (orderOnChange && clone[0] && clone[1]) {
clone = orderDates(clone, generateConfig);
}
// Sync `calendarValue`
triggerCalendarChange(clone);
// ========= Validate check =========
var _clone = clone,
_clone2 = useRangeValue_slicedToArray(_clone, 2),
start = _clone2[0],
end = _clone2[1];
// >>> Empty
var startEmpty = !start;
var endEmpty = !end;
var validateEmptyDateRange = allowEmpty ?
// Validate empty start
(!startEmpty || allowEmpty[0]) && (
// Validate empty end
!endEmpty || allowEmpty[1]) : true;
// >>> Order
var validateOrder = !order || startEmpty || endEmpty || isSame(generateConfig, locale, start, end, picker) || generateConfig.isAfter(end, start);
// >>> Invalid
var validateDates =
// Validate start
(disabled[0] || !start || !isInvalidateDate(start, {
activeIndex: 0
})) && (
// Validate end
disabled[1] || !end || !isInvalidateDate(end, {
from: start,
activeIndex: 1
}));
// >>> Result
var allPassed =
// Null value is from clear button
isNullValue ||
// Normal check
validateEmptyDateRange && validateOrder && validateDates;
if (allPassed) {
// Sync value with submit value
setInnerValue(clone);
var _isSameDates3 = isSameDates(clone, mergedValue),
_isSameDates4 = useRangeValue_slicedToArray(_isSameDates3, 1),
isSameMergedDates = _isSameDates4[0];
// Trigger `onChange` if needed
if (onChange && !isSameMergedDates) {
var everyEmpty = clone.every(function (val) {
return !val;
});
onChange(
// Return null directly if all date are empty
isNullValue && everyEmpty ? null : clone, everyEmpty ? null : getDateTexts(clone));
}
}
return allPassed;
});
// ========================= Flush Submit =========================
var flushSubmit = (0,es.useEvent)(function (index, needTriggerChange) {
var nextSubmitValue = fillIndex(submitValue(), index, getCalendarValue()[index]);
setSubmitValue(nextSubmitValue);
if (needTriggerChange) {
triggerSubmit();
}
});
// ============================ Effect ============================
// All finished action trigger after 2 frames
var interactiveFinished = !focused && !open;
useLockEffect(!interactiveFinished, function () {
if (interactiveFinished) {
// Always try to trigger submit first
triggerSubmit();
// Trigger calendar change since this is a effect reset
// https://github.com/ant-design/ant-design/issues/22351
triggerCalendarChange(mergedValue);
// Sync with value anyway
syncWithValue();
}
}, 2);
// ============================ Return ============================
return [flushSubmit, triggerSubmit];
}
;// ./node_modules/@rc-component/picker/es/PickerInput/hooks/useShowNow.js
function useShowNow(picker, mode, showNow, showToday, rangePicker) {
if (mode !== 'date' && mode !== 'time') {
return false;
}
if (showNow !== undefined) {
return showNow;
}
// Compatible with old version `showToday`
if (showToday !== undefined) {
return showToday;
}
return !rangePicker && (picker === 'date' || picker === 'time');
}
;// ./node_modules/@rc-component/picker/es/PickerPanel/TimePanel/TimePanelBody/util.js
function util_toConsumableArray(arr) { return util_arrayWithoutHoles(arr) || util_iterableToArray(arr) || util_unsupportedIterableToArray(arr) || util_nonIterableSpread(); }
function util_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function util_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return util_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 util_arrayLikeToArray(o, minLen); }
function util_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function util_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return util_arrayLikeToArray(arr); }
function util_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 findValidateTime(date, getHourUnits, getMinuteUnits, getSecondUnits, getMillisecondUnits, generateConfig) {
var nextDate = date;
function alignValidate(getUnitValue, setUnitValue, units) {
var nextValue = generateConfig[getUnitValue](nextDate);
var nextUnit = units.find(function (unit) {
return unit.value === nextValue;
});
if (!nextUnit || nextUnit.disabled) {
// Find most closest unit
var validateUnits = units.filter(function (unit) {
return !unit.disabled;
});
var reverseEnabledUnits = util_toConsumableArray(validateUnits).reverse();
var validateUnit = reverseEnabledUnits.find(function (unit) {
return unit.value <= nextValue;
}) || validateUnits[0];
if (validateUnit) {
nextValue = validateUnit.value;
nextDate = generateConfig[setUnitValue](nextDate, nextValue);
}
}
return nextValue;
}
// Find validate hour
var nextHour = alignValidate('getHour', 'setHour', getHourUnits());
// Find validate minute
var nextMinute = alignValidate('getMinute', 'setMinute', getMinuteUnits(nextHour));
// Find validate second
var nextSecond = alignValidate('getSecond', 'setSecond', getSecondUnits(nextHour, nextMinute));
// Find validate millisecond
alignValidate('getMillisecond', 'setMillisecond', getMillisecondUnits(nextHour, nextMinute, nextSecond));
return nextDate;
}
;// ./node_modules/@rc-component/picker/es/hooks/useTimeInfo.js
function useTimeInfo_typeof(o) { "@babel/helpers - typeof"; return useTimeInfo_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, useTimeInfo_typeof(o); }
function useTimeInfo_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function useTimeInfo_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? useTimeInfo_ownKeys(Object(t), !0).forEach(function (r) { useTimeInfo_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : useTimeInfo_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function useTimeInfo_defineProperty(obj, key, value) { key = useTimeInfo_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function useTimeInfo_toPropertyKey(t) { var i = useTimeInfo_toPrimitive(t, "string"); return "symbol" == useTimeInfo_typeof(i) ? i : String(i); }
function useTimeInfo_toPrimitive(t, r) { if ("object" != useTimeInfo_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != useTimeInfo_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function useTimeInfo_slicedToArray(arr, i) { return useTimeInfo_arrayWithHoles(arr) || useTimeInfo_iterableToArrayLimit(arr, i) || useTimeInfo_unsupportedIterableToArray(arr, i) || useTimeInfo_nonIterableRest(); }
function useTimeInfo_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 useTimeInfo_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return useTimeInfo_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 useTimeInfo_arrayLikeToArray(o, minLen); }
function useTimeInfo_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 useTimeInfo_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function useTimeInfo_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function emptyDisabled() {
return [];
}
function generateUnits(start, end) {
var step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var hideDisabledOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var disabledUnits = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
var pad = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 2;
var units = [];
var integerStep = step >= 1 ? step | 0 : 1;
for (var i = start; i <= end; i += integerStep) {
var disabled = disabledUnits.includes(i);
if (!disabled || !hideDisabledOptions) {
units.push({
label: leftPad(i, pad),
value: i,
disabled: disabled
});
}
}
return units;
}
/**
* Parse time props to get util info
*/
function useTimeInfo(generateConfig) {
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var date = arguments.length > 2 ? arguments[2] : undefined;
var _ref = props || {},
use12Hours = _ref.use12Hours,
_ref$hourStep = _ref.hourStep,
hourStep = _ref$hourStep === void 0 ? 1 : _ref$hourStep,
_ref$minuteStep = _ref.minuteStep,
minuteStep = _ref$minuteStep === void 0 ? 1 : _ref$minuteStep,
_ref$secondStep = _ref.secondStep,
secondStep = _ref$secondStep === void 0 ? 1 : _ref$secondStep,
_ref$millisecondStep = _ref.millisecondStep,
millisecondStep = _ref$millisecondStep === void 0 ? 100 : _ref$millisecondStep,
hideDisabledOptions = _ref.hideDisabledOptions,
disabledTime = _ref.disabledTime,
disabledHours = _ref.disabledHours,
disabledMinutes = _ref.disabledMinutes,
disabledSeconds = _ref.disabledSeconds;
var mergedDate = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return date || generateConfig.getNow();
}, [date, generateConfig]);
// ======================== Warnings ========================
if (true) {
var isHourStepValid = 24 % hourStep === 0;
var isMinuteStepValid = 60 % minuteStep === 0;
var isSecondStepValid = 60 % secondStep === 0;
(0,es.warning)(isHourStepValid, "`hourStep` ".concat(hourStep, " is invalid. It should be a factor of 24."));
(0,es.warning)(isMinuteStepValid, "`minuteStep` ".concat(minuteStep, " is invalid. It should be a factor of 60."));
(0,es.warning)(isSecondStepValid, "`secondStep` ".concat(secondStep, " is invalid. It should be a factor of 60."));
}
// ======================== Disabled ========================
var getDisabledTimes = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(function (targetDate) {
var disabledConfig = (disabledTime === null || disabledTime === void 0 ? void 0 : disabledTime(targetDate)) || {};
return [disabledConfig.disabledHours || disabledHours || emptyDisabled, disabledConfig.disabledMinutes || disabledMinutes || emptyDisabled, disabledConfig.disabledSeconds || disabledSeconds || emptyDisabled, disabledConfig.disabledMilliseconds || emptyDisabled];
}, [disabledTime, disabledHours, disabledMinutes, disabledSeconds]);
var _React$useMemo = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return getDisabledTimes(mergedDate);
}, [mergedDate, getDisabledTimes]),
_React$useMemo2 = useTimeInfo_slicedToArray(_React$useMemo, 4),
mergedDisabledHours = _React$useMemo2[0],
mergedDisabledMinutes = _React$useMemo2[1],
mergedDisabledSeconds = _React$useMemo2[2],
mergedDisabledMilliseconds = _React$useMemo2[3];
// ========================= Column =========================
var getAllUnits = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(function (getDisabledHours, getDisabledMinutes, getDisabledSeconds, getDisabledMilliseconds) {
var hours = generateUnits(0, 23, hourStep, hideDisabledOptions, getDisabledHours());
// Hours
var rowHourUnits = use12Hours ? hours.map(function (unit) {
return useTimeInfo_objectSpread(useTimeInfo_objectSpread({}, unit), {}, {
label: leftPad(unit.value % 12 || 12, 2)
});
}) : hours;
// Minutes
var getMinuteUnits = function getMinuteUnits(nextHour) {
return generateUnits(0, 59, minuteStep, hideDisabledOptions, getDisabledMinutes(nextHour));
};
// Seconds
var getSecondUnits = function getSecondUnits(nextHour, nextMinute) {
return generateUnits(0, 59, secondStep, hideDisabledOptions, getDisabledSeconds(nextHour, nextMinute));
};
// Milliseconds
var getMillisecondUnits = function getMillisecondUnits(nextHour, nextMinute, nextSecond) {
return generateUnits(0, 999, millisecondStep, hideDisabledOptions, getDisabledMilliseconds(nextHour, nextMinute, nextSecond), 3);
};
return [rowHourUnits, getMinuteUnits, getSecondUnits, getMillisecondUnits];
}, [hideDisabledOptions, hourStep, use12Hours, millisecondStep, minuteStep, secondStep]);
var _React$useMemo3 = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return getAllUnits(mergedDisabledHours, mergedDisabledMinutes, mergedDisabledSeconds, mergedDisabledMilliseconds);
}, [getAllUnits, mergedDisabledHours, mergedDisabledMinutes, mergedDisabledSeconds, mergedDisabledMilliseconds]),
_React$useMemo4 = useTimeInfo_slicedToArray(_React$useMemo3, 4),
rowHourUnits = _React$useMemo4[0],
getMinuteUnits = _React$useMemo4[1],
getSecondUnits = _React$useMemo4[2],
getMillisecondUnits = _React$useMemo4[3];
// ======================== Validate ========================
/**
* Get validate time with `disabledTime`, `certainDate` to specific the date need to check
*/
var getValidTime = function getValidTime(nextTime, certainDate) {
var getCheckHourUnits = function getCheckHourUnits() {
return rowHourUnits;
};
var getCheckMinuteUnits = getMinuteUnits;
var getCheckSecondUnits = getSecondUnits;
var getCheckMillisecondUnits = getMillisecondUnits;
if (certainDate) {
var _getDisabledTimes = getDisabledTimes(certainDate),
_getDisabledTimes2 = useTimeInfo_slicedToArray(_getDisabledTimes, 4),
targetDisabledHours = _getDisabledTimes2[0],
targetDisabledMinutes = _getDisabledTimes2[1],
targetDisabledSeconds = _getDisabledTimes2[2],
targetDisabledMilliseconds = _getDisabledTimes2[3];
var _getAllUnits = getAllUnits(targetDisabledHours, targetDisabledMinutes, targetDisabledSeconds, targetDisabledMilliseconds),
_getAllUnits2 = useTimeInfo_slicedToArray(_getAllUnits, 4),
targetRowHourUnits = _getAllUnits2[0],
targetGetMinuteUnits = _getAllUnits2[1],
targetGetSecondUnits = _getAllUnits2[2],
targetGetMillisecondUnits = _getAllUnits2[3];
getCheckHourUnits = function getCheckHourUnits() {
return targetRowHourUnits;
};
getCheckMinuteUnits = targetGetMinuteUnits;
getCheckSecondUnits = targetGetSecondUnits;
getCheckMillisecondUnits = targetGetMillisecondUnits;
}
var validateDate = findValidateTime(nextTime, getCheckHourUnits, getCheckMinuteUnits, getCheckSecondUnits, getCheckMillisecondUnits, generateConfig);
return validateDate;
};
return [
// getValidTime
getValidTime,
// Units
rowHourUnits, getMinuteUnits, getSecondUnits, getMillisecondUnits];
}
;// ./node_modules/@rc-component/picker/es/PickerInput/Popup/Footer.js
function Footer_slicedToArray(arr, i) { return Footer_arrayWithHoles(arr) || Footer_iterableToArrayLimit(arr, i) || Footer_unsupportedIterableToArray(arr, i) || Footer_nonIterableRest(); }
function Footer_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 Footer_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Footer_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 Footer_arrayLikeToArray(o, minLen); }
function Footer_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 Footer_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function Footer_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function Footer_Footer(props) {
var mode = props.mode,
internalMode = props.internalMode,
renderExtraFooter = props.renderExtraFooter,
showNow = props.showNow,
showTime = props.showTime,
onSubmit = props.onSubmit,
onNow = props.onNow,
invalid = props.invalid,
needConfirm = props.needConfirm,
generateConfig = props.generateConfig,
disabledDate = props.disabledDate;
var _React$useContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PickerInput_context),
prefixCls = _React$useContext.prefixCls,
locale = _React$useContext.locale,
_React$useContext$but = _React$useContext.button,
Button = _React$useContext$but === void 0 ? 'button' : _React$useContext$but,
classNames = _React$useContext.classNames,
styles = _React$useContext.styles;
// >>> Now
var now = generateConfig.getNow();
var _useTimeInfo = useTimeInfo(generateConfig, showTime, now),
_useTimeInfo2 = Footer_slicedToArray(_useTimeInfo, 1),
getValidTime = _useTimeInfo2[0];
// ======================== Extra =========================
var extraNode = renderExtraFooter === null || renderExtraFooter === void 0 ? void 0 : renderExtraFooter(mode);
// ======================== Ranges ========================
var nowDisabled = disabledDate(now, {
type: mode
});
var onInternalNow = function onInternalNow() {
if (!nowDisabled) {
var validateNow = getValidTime(now);
onNow(validateNow);
}
};
var nowPrefixCls = "".concat(prefixCls, "-now");
var nowBtnPrefixCls = "".concat(nowPrefixCls, "-btn");
var presetNode = showNow && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("li", {
className: nowPrefixCls
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("a", {
className: (0,clsx.clsx)(nowBtnPrefixCls, nowDisabled && "".concat(nowBtnPrefixCls, "-disabled")),
"aria-disabled": nowDisabled,
onClick: onInternalNow
}, internalMode === 'date' ? locale.today : locale.now));
// >>> OK
var okNode = needConfirm && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("li", {
className: "".concat(prefixCls, "-ok")
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Button, {
disabled: invalid,
onClick: onSubmit
}, locale.ok));
var rangeNode = (presetNode || okNode) && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("ul", {
className: "".concat(prefixCls, "-ranges")
}, presetNode, okNode);
// ======================== Render ========================
if (!extraNode && !rangeNode) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)("".concat(prefixCls, "-footer"), classNames.popup.footer),
style: styles.popup.footer
}, extraNode && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: "".concat(prefixCls, "-footer-extra")
}, extraNode), rangeNode);
}
;// ./node_modules/@rc-component/picker/es/hooks/useToggleDates.js
function useToggleDates_toConsumableArray(arr) { return useToggleDates_arrayWithoutHoles(arr) || useToggleDates_iterableToArray(arr) || useToggleDates_unsupportedIterableToArray(arr) || useToggleDates_nonIterableSpread(); }
function useToggleDates_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function useToggleDates_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return useToggleDates_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 useToggleDates_arrayLikeToArray(o, minLen); }
function useToggleDates_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function useToggleDates_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return useToggleDates_arrayLikeToArray(arr); }
function useToggleDates_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; }
/**
* Toggles the presence of a value in an array.
* If the value exists in the array, removed it.
* Else add it.
*/
function useToggleDates(generateConfig, locale, panelMode) {
function toggleDates(list, target) {
var index = list.findIndex(function (date) {
return isSame(generateConfig, locale, date, target, panelMode);
});
if (index === -1) {
return [].concat(useToggleDates_toConsumableArray(list), [target]);
}
var sliceList = useToggleDates_toConsumableArray(list);
sliceList.splice(index, 1);
return sliceList;
}
return toggleDates;
}
;// ./node_modules/@rc-component/picker/es/PickerPanel/context.js
var SharedPanelContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
/** Used for each single Panel. e.g. DatePanel */
var PanelContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
function usePanelContext() {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PanelContext);
}
/**
* Get shared props for the SharedPanelProps interface.
*/
function useInfo(props, panelType) {
// TODO: this is not good to get from each props.
// Should move to `SharedPanelContext` instead.
var prefixCls = props.prefixCls,
generateConfig = props.generateConfig,
locale = props.locale,
disabledDate = props.disabledDate,
minDate = props.minDate,
maxDate = props.maxDate,
cellRender = props.cellRender,
hoverValue = props.hoverValue,
hoverRangeValue = props.hoverRangeValue,
onHover = props.onHover,
values = props.values,
pickerValue = props.pickerValue,
onSelect = props.onSelect,
prevIcon = props.prevIcon,
nextIcon = props.nextIcon,
superPrevIcon = props.superPrevIcon,
superNextIcon = props.superNextIcon;
// ======================= Context ========================
var _React$useContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(SharedPanelContext),
classNames = _React$useContext.classNames,
styles = _React$useContext.styles;
// ========================= MISC =========================
var now = generateConfig.getNow();
// ========================= Info =========================
var info = {
now: now,
values: values,
pickerValue: pickerValue,
prefixCls: prefixCls,
classNames: classNames,
styles: styles,
disabledDate: disabledDate,
minDate: minDate,
maxDate: maxDate,
cellRender: cellRender,
hoverValue: hoverValue,
hoverRangeValue: hoverRangeValue,
onHover: onHover,
locale: locale,
generateConfig: generateConfig,
onSelect: onSelect,
panelType: panelType,
// Icons
prevIcon: prevIcon,
nextIcon: nextIcon,
superPrevIcon: superPrevIcon,
superNextIcon: superNextIcon
};
return [info, now];
}
// ============================== Internal ==============================
/**
* Internal usage for RangePicker to not to show the operation arrow
*/
var PickerHackContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({});
if (true) {
PickerHackContext.displayName = 'PickerHackContext';
}
;// ./node_modules/@rc-component/picker/es/PickerPanel/PanelBody.js
function PanelBody_typeof(o) { "@babel/helpers - typeof"; return PanelBody_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, PanelBody_typeof(o); }
function PanelBody_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function PanelBody_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? PanelBody_ownKeys(Object(t), !0).forEach(function (r) { PanelBody_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : PanelBody_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function PanelBody_defineProperty(obj, key, value) { key = PanelBody_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function PanelBody_toPropertyKey(t) { var i = PanelBody_toPrimitive(t, "string"); return "symbol" == PanelBody_typeof(i) ? i : String(i); }
function PanelBody_toPrimitive(t, r) { if ("object" != PanelBody_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != PanelBody_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function PanelBody_slicedToArray(arr, i) { return PanelBody_arrayWithHoles(arr) || PanelBody_iterableToArrayLimit(arr, i) || PanelBody_unsupportedIterableToArray(arr, i) || PanelBody_nonIterableRest(); }
function PanelBody_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 PanelBody_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return PanelBody_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 PanelBody_arrayLikeToArray(o, minLen); }
function PanelBody_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 PanelBody_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function PanelBody_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function PanelBody(props) {
var rowNum = props.rowNum,
colNum = props.colNum,
baseDate = props.baseDate,
getCellDate = props.getCellDate,
prefixColumn = props.prefixColumn,
rowClassName = props.rowClassName,
titleFormat = props.titleFormat,
getCellText = props.getCellText,
getCellClassName = props.getCellClassName,
headerCells = props.headerCells,
_props$cellSelection = props.cellSelection,
cellSelection = _props$cellSelection === void 0 ? true : _props$cellSelection,
disabledDate = props.disabledDate;
var _usePanelContext = usePanelContext(),
prefixCls = _usePanelContext.prefixCls,
classNames = _usePanelContext.classNames,
styles = _usePanelContext.styles,
type = _usePanelContext.panelType,
now = _usePanelContext.now,
contextDisabledDate = _usePanelContext.disabledDate,
cellRender = _usePanelContext.cellRender,
onHover = _usePanelContext.onHover,
hoverValue = _usePanelContext.hoverValue,
hoverRangeValue = _usePanelContext.hoverRangeValue,
generateConfig = _usePanelContext.generateConfig,
values = _usePanelContext.values,
locale = _usePanelContext.locale,
onSelect = _usePanelContext.onSelect;
var mergedDisabledDate = disabledDate || contextDisabledDate;
var cellPrefixCls = "".concat(prefixCls, "-cell");
// ============================= Context ==============================
var _React$useContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PickerHackContext),
onCellDblClick = _React$useContext.onCellDblClick;
// ============================== Value ===============================
var matchValues = function matchValues(date) {
return values.some(function (singleValue) {
return singleValue && isSame(generateConfig, locale, date, singleValue, type);
});
};
// =============================== Body ===============================
var rows = [];
for (var row = 0; row < rowNum; row += 1) {
var rowNode = [];
var rowStartDate = void 0;
var _loop = function _loop() {
var offset = row * colNum + col;
var currentDate = getCellDate(baseDate, offset);
var disabled = mergedDisabledDate === null || mergedDisabledDate === void 0 ? void 0 : mergedDisabledDate(currentDate, {
type: type
});
// Row Start Cell
if (col === 0) {
rowStartDate = currentDate;
if (prefixColumn) {
rowNode.push(prefixColumn(rowStartDate));
}
}
// Range
var inRange = false;
var rangeStart = false;
var rangeEnd = false;
if (cellSelection && hoverRangeValue) {
var _hoverRangeValue = PanelBody_slicedToArray(hoverRangeValue, 2),
hoverStart = _hoverRangeValue[0],
hoverEnd = _hoverRangeValue[1];
inRange = isInRange(generateConfig, hoverStart, hoverEnd, currentDate);
rangeStart = isSame(generateConfig, locale, currentDate, hoverStart, type);
rangeEnd = isSame(generateConfig, locale, currentDate, hoverEnd, type);
}
// Title
var title = titleFormat ? formatValue(currentDate, {
locale: locale,
format: titleFormat,
generateConfig: generateConfig
}) : undefined;
// Render
var inner = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: "".concat(cellPrefixCls, "-inner")
}, getCellText(currentDate));
rowNode.push( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("td", {
key: col,
title: title,
className: (0,clsx.clsx)(cellPrefixCls, classNames.item, PanelBody_objectSpread(PanelBody_defineProperty(PanelBody_defineProperty(PanelBody_defineProperty(PanelBody_defineProperty(PanelBody_defineProperty(PanelBody_defineProperty({}, "".concat(cellPrefixCls, "-disabled"), disabled), "".concat(cellPrefixCls, "-hover"), (hoverValue || []).some(function (date) {
return isSame(generateConfig, locale, currentDate, date, type);
})), "".concat(cellPrefixCls, "-in-range"), inRange && !rangeStart && !rangeEnd), "".concat(cellPrefixCls, "-range-start"), rangeStart), "".concat(cellPrefixCls, "-range-end"), rangeEnd), "".concat(prefixCls, "-cell-selected"), !hoverRangeValue &&
// WeekPicker use row instead
type !== 'week' && matchValues(currentDate)), getCellClassName(currentDate))),
style: styles.item,
onClick: function onClick() {
if (!disabled) {
onSelect(currentDate);
}
},
onDoubleClick: function onDoubleClick() {
if (!disabled && onCellDblClick) {
onCellDblClick();
}
},
onMouseEnter: function onMouseEnter() {
if (!disabled) {
onHover === null || onHover === void 0 || onHover(currentDate);
}
},
onMouseLeave: function onMouseLeave() {
if (!disabled) {
onHover === null || onHover === void 0 || onHover(null);
}
}
}, cellRender ? cellRender(currentDate, {
prefixCls: prefixCls,
originNode: inner,
today: now,
type: type,
locale: locale
}) : inner));
};
for (var col = 0; col < colNum; col += 1) {
_loop();
}
rows.push( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("tr", {
key: row,
className: rowClassName === null || rowClassName === void 0 ? void 0 : rowClassName(rowStartDate)
}, rowNode));
}
// ============================== Render ==============================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)("".concat(prefixCls, "-body"), classNames.body),
style: styles.body
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("table", {
className: (0,clsx.clsx)("".concat(prefixCls, "-content"), classNames.content),
style: styles.content
}, headerCells && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("thead", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("tr", null, headerCells)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("tbody", null, rows)));
}
;// ./node_modules/@rc-component/picker/es/PickerPanel/PanelHeader.js
var HIDDEN_STYLE = {
visibility: 'hidden'
};
function PanelHeader(props) {
var offset = props.offset,
superOffset = props.superOffset,
onChange = props.onChange,
getStart = props.getStart,
getEnd = props.getEnd,
children = props.children;
var _usePanelContext = usePanelContext(),
prefixCls = _usePanelContext.prefixCls,
classNames = _usePanelContext.classNames,
styles = _usePanelContext.styles,
_usePanelContext$prev = _usePanelContext.prevIcon,
prevIcon = _usePanelContext$prev === void 0 ? "\u2039" : _usePanelContext$prev,
_usePanelContext$next = _usePanelContext.nextIcon,
nextIcon = _usePanelContext$next === void 0 ? "\u203A" : _usePanelContext$next,
_usePanelContext$supe = _usePanelContext.superPrevIcon,
superPrevIcon = _usePanelContext$supe === void 0 ? "\xAB" : _usePanelContext$supe,
_usePanelContext$supe2 = _usePanelContext.superNextIcon,
superNextIcon = _usePanelContext$supe2 === void 0 ? "\xBB" : _usePanelContext$supe2,
minDate = _usePanelContext.minDate,
maxDate = _usePanelContext.maxDate,
generateConfig = _usePanelContext.generateConfig,
locale = _usePanelContext.locale,
pickerValue = _usePanelContext.pickerValue,
type = _usePanelContext.panelType;
var headerPrefixCls = "".concat(prefixCls, "-header");
var _React$useContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PickerHackContext),
hidePrev = _React$useContext.hidePrev,
hideNext = _React$useContext.hideNext,
hideHeader = _React$useContext.hideHeader;
// ======================= Limitation =======================
var disabledOffsetPrev = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
if (!minDate || !offset || !getEnd) {
return false;
}
var prevPanelLimitDate = getEnd(offset(-1, pickerValue));
return !isSameOrAfter(generateConfig, locale, prevPanelLimitDate, minDate, type);
}, [minDate, offset, pickerValue, getEnd, generateConfig, locale, type]);
var disabledSuperOffsetPrev = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
if (!minDate || !superOffset || !getEnd) {
return false;
}
var prevPanelLimitDate = getEnd(superOffset(-1, pickerValue));
return !isSameOrAfter(generateConfig, locale, prevPanelLimitDate, minDate, type);
}, [minDate, superOffset, pickerValue, getEnd, generateConfig, locale, type]);
var disabledOffsetNext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
if (!maxDate || !offset || !getStart) {
return false;
}
var nextPanelLimitDate = getStart(offset(1, pickerValue));
return !isSameOrAfter(generateConfig, locale, maxDate, nextPanelLimitDate, type);
}, [maxDate, offset, pickerValue, getStart, generateConfig, locale, type]);
var disabledSuperOffsetNext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
if (!maxDate || !superOffset || !getStart) {
return false;
}
var nextPanelLimitDate = getStart(superOffset(1, pickerValue));
return !isSameOrAfter(generateConfig, locale, maxDate, nextPanelLimitDate, type);
}, [maxDate, superOffset, pickerValue, getStart, generateConfig, locale, type]);
// ========================= Offset =========================
var onOffset = function onOffset(distance) {
if (offset) {
onChange(offset(distance, pickerValue));
}
};
var onSuperOffset = function onSuperOffset(distance) {
if (superOffset) {
onChange(superOffset(distance, pickerValue));
}
};
// ========================= Render =========================
if (hideHeader) {
return null;
}
var prevBtnCls = "".concat(headerPrefixCls, "-prev-btn");
var nextBtnCls = "".concat(headerPrefixCls, "-next-btn");
var superPrevBtnCls = "".concat(headerPrefixCls, "-super-prev-btn");
var superNextBtnCls = "".concat(headerPrefixCls, "-super-next-btn");
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(headerPrefixCls, classNames.header),
style: styles.header
}, superOffset && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
"aria-label": locale.previousYear,
onClick: function onClick() {
return onSuperOffset(-1);
},
tabIndex: -1,
className: (0,clsx.clsx)(superPrevBtnCls, disabledSuperOffsetPrev && "".concat(superPrevBtnCls, "-disabled")),
disabled: disabledSuperOffsetPrev,
style: hidePrev ? HIDDEN_STYLE : {}
}, superPrevIcon), offset && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
"aria-label": locale.previousMonth,
onClick: function onClick() {
return onOffset(-1);
},
tabIndex: -1,
className: (0,clsx.clsx)(prevBtnCls, disabledOffsetPrev && "".concat(prevBtnCls, "-disabled")),
disabled: disabledOffsetPrev,
style: hidePrev ? HIDDEN_STYLE : {}
}, prevIcon), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: "".concat(headerPrefixCls, "-view")
}, children), offset && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
"aria-label": locale.nextMonth,
onClick: function onClick() {
return onOffset(1);
},
tabIndex: -1,
className: (0,clsx.clsx)(nextBtnCls, disabledOffsetNext && "".concat(nextBtnCls, "-disabled")),
disabled: disabledOffsetNext,
style: hideNext ? HIDDEN_STYLE : {}
}, nextIcon), superOffset && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
"aria-label": locale.nextYear,
onClick: function onClick() {
return onSuperOffset(1);
},
tabIndex: -1,
className: (0,clsx.clsx)(superNextBtnCls, disabledSuperOffsetNext && "".concat(superNextBtnCls, "-disabled")),
disabled: disabledSuperOffsetNext,
style: hideNext ? HIDDEN_STYLE : {}
}, superNextIcon));
}
/* harmony default export */ var PickerPanel_PanelHeader = (PanelHeader);
;// ./node_modules/@rc-component/picker/es/PickerPanel/DatePanel/index.js
function DatePanel_typeof(o) { "@babel/helpers - typeof"; return DatePanel_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, DatePanel_typeof(o); }
function DatePanel_extends() { DatePanel_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return DatePanel_extends.apply(this, arguments); }
function DatePanel_defineProperty(obj, key, value) { key = DatePanel_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function DatePanel_toPropertyKey(t) { var i = DatePanel_toPrimitive(t, "string"); return "symbol" == DatePanel_typeof(i) ? i : String(i); }
function DatePanel_toPrimitive(t, r) { if ("object" != DatePanel_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != DatePanel_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function DatePanel_slicedToArray(arr, i) { return DatePanel_arrayWithHoles(arr) || DatePanel_iterableToArrayLimit(arr, i) || DatePanel_unsupportedIterableToArray(arr, i) || DatePanel_nonIterableRest(); }
function DatePanel_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 DatePanel_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return DatePanel_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 DatePanel_arrayLikeToArray(o, minLen); }
function DatePanel_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 DatePanel_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function DatePanel_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function DatePanel(props) {
var prefixCls = props.prefixCls,
_props$panelName = props.panelName,
panelName = _props$panelName === void 0 ? 'date' : _props$panelName,
locale = props.locale,
generateConfig = props.generateConfig,
pickerValue = props.pickerValue,
onPickerValueChange = props.onPickerValueChange,
onModeChange = props.onModeChange,
_props$mode = props.mode,
mode = _props$mode === void 0 ? 'date' : _props$mode,
disabledDate = props.disabledDate,
onSelect = props.onSelect,
onHover = props.onHover,
showWeek = props.showWeek;
var panelPrefixCls = "".concat(prefixCls, "-").concat(panelName, "-panel");
var cellPrefixCls = "".concat(prefixCls, "-cell");
var isWeek = mode === 'week';
// ========================== Base ==========================
var _useInfo = useInfo(props, mode),
_useInfo2 = DatePanel_slicedToArray(_useInfo, 2),
info = _useInfo2[0],
now = _useInfo2[1];
var weekFirstDay = generateConfig.locale.getWeekFirstDay(locale.locale);
var monthStartDate = generateConfig.setDate(pickerValue, 1);
var baseDate = getWeekStartDate(locale.locale, generateConfig, monthStartDate);
var month = generateConfig.getMonth(pickerValue);
// =========================== PrefixColumn ===========================
var showPrefixColumn = showWeek === undefined ? isWeek : showWeek;
var prefixColumn = showPrefixColumn ? function (date) {
// >>> Additional check for disabled
var disabled = disabledDate === null || disabledDate === void 0 ? void 0 : disabledDate(date, {
type: 'week'
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("td", {
key: "week",
className: (0,clsx.clsx)(cellPrefixCls, "".concat(cellPrefixCls, "-week"), DatePanel_defineProperty({}, "".concat(cellPrefixCls, "-disabled"), disabled))
// Operation: Same as code in PanelBody
,
onClick: function onClick() {
if (!disabled) {
onSelect(date);
}
},
onMouseEnter: function onMouseEnter() {
if (!disabled) {
onHover === null || onHover === void 0 || onHover(date);
}
},
onMouseLeave: function onMouseLeave() {
if (!disabled) {
onHover === null || onHover === void 0 || onHover(null);
}
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: "".concat(cellPrefixCls, "-inner")
}, generateConfig.locale.getWeek(locale.locale, date)));
} : null;
// ========================= Cells ==========================
// >>> Header Cells
var headerCells = [];
var weekDaysLocale = locale.shortWeekDays || (generateConfig.locale.getShortWeekDays ? generateConfig.locale.getShortWeekDays(locale.locale) : []);
if (prefixColumn) {
headerCells.push( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("th", {
key: "empty"
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
style: {
width: 0,
height: 0,
position: 'absolute',
overflow: 'hidden',
opacity: 0
}
}, locale.week)));
}
for (var i = 0; i < WEEK_DAY_COUNT; i += 1) {
headerCells.push( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("th", {
key: i
}, weekDaysLocale[(i + weekFirstDay) % WEEK_DAY_COUNT]));
}
// >>> Body Cells
var getCellDate = function getCellDate(date, offset) {
return generateConfig.addDate(date, offset);
};
var getCellText = function getCellText(date) {
return formatValue(date, {
locale: locale,
format: locale.cellDateFormat,
generateConfig: generateConfig
});
};
var getCellClassName = function getCellClassName(date) {
var classObj = DatePanel_defineProperty(DatePanel_defineProperty({}, "".concat(prefixCls, "-cell-in-view"), isSameMonth(generateConfig, date, pickerValue)), "".concat(prefixCls, "-cell-today"), isSameDate(generateConfig, date, now));
return classObj;
};
// ========================= Header =========================
var monthsLocale = locale.shortMonths || (generateConfig.locale.getShortMonths ? generateConfig.locale.getShortMonths(locale.locale) : []);
var yearNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
"aria-label": locale.yearSelect,
key: "year",
onClick: function onClick() {
onModeChange('year', pickerValue);
},
tabIndex: -1,
className: "".concat(prefixCls, "-year-btn")
}, formatValue(pickerValue, {
locale: locale,
format: locale.yearFormat,
generateConfig: generateConfig
}));
var monthNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
"aria-label": locale.monthSelect,
key: "month",
onClick: function onClick() {
onModeChange('month', pickerValue);
},
tabIndex: -1,
className: "".concat(prefixCls, "-month-btn")
}, locale.monthFormat ? formatValue(pickerValue, {
locale: locale,
format: locale.monthFormat,
generateConfig: generateConfig
}) : monthsLocale[month]);
var monthYearNodes = locale.monthBeforeYear ? [monthNode, yearNode] : [yearNode, monthNode];
// ========================= Render =========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PanelContext.Provider, {
value: info
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(panelPrefixCls, showWeek && "".concat(panelPrefixCls, "-show-week"))
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PickerPanel_PanelHeader, {
offset: function offset(distance) {
return generateConfig.addMonth(pickerValue, distance);
},
superOffset: function superOffset(distance) {
return generateConfig.addYear(pickerValue, distance);
},
onChange: onPickerValueChange
// Limitation
,
getStart: function getStart(date) {
return generateConfig.setDate(date, 1);
},
getEnd: function getEnd(date) {
var clone = generateConfig.setDate(date, 1);
clone = generateConfig.addMonth(clone, 1);
return generateConfig.addDate(clone, -1);
}
}, monthYearNodes), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PanelBody, DatePanel_extends({
titleFormat: locale.fieldDateFormat
}, props, {
colNum: WEEK_DAY_COUNT,
rowNum: 6,
baseDate: baseDate
// Header
,
headerCells: headerCells
// Body
,
getCellDate: getCellDate,
getCellText: getCellText,
getCellClassName: getCellClassName,
prefixColumn: prefixColumn,
cellSelection: !isWeek
}))));
}
;// ./node_modules/@rc-component/picker/es/PickerPanel/TimePanel/TimePanelBody/useScrollTo.js
var SPEED_PTG = 1 / 3;
function useScrollTo_useScrollTo(ulRef, value) {
// ========================= Scroll =========================
var scrollingRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
var scrollRafRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
var scrollDistRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
var isScrolling = function isScrolling() {
return scrollingRef.current;
};
var stopScroll = function stopScroll() {
raf["default"].cancel(scrollRafRef.current);
scrollingRef.current = false;
};
var scrollRafTimesRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
var startScroll = function startScroll() {
var ul = ulRef.current;
scrollDistRef.current = null;
scrollRafTimesRef.current = 0;
if (ul) {
var targetLi = ul.querySelector("[data-value=\"".concat(value, "\"]"));
var firstLi = ul.querySelector("li");
var doScroll = function doScroll() {
stopScroll();
scrollingRef.current = true;
scrollRafTimesRef.current += 1;
var currentTop = ul.scrollTop;
var firstLiTop = firstLi.offsetTop;
var targetLiTop = targetLi.offsetTop;
var targetTop = targetLiTop - firstLiTop;
// Wait for element exist. 5 frames is enough
if (targetLiTop === 0 && targetLi !== firstLi || !isVisible(ul)) {
if (scrollRafTimesRef.current <= 5) {
scrollRafRef.current = (0,raf["default"])(doScroll);
}
return;
}
var nextTop = currentTop + (targetTop - currentTop) * SPEED_PTG;
var dist = Math.abs(targetTop - nextTop);
// Break if dist get larger, which means user is scrolling
if (scrollDistRef.current !== null && scrollDistRef.current < dist) {
stopScroll();
return;
}
scrollDistRef.current = dist;
// Stop when dist is less than 1
if (dist <= 1) {
ul.scrollTop = targetTop;
stopScroll();
return;
}
// IE not support `scrollTo`
ul.scrollTop = nextTop;
scrollRafRef.current = (0,raf["default"])(doScroll);
};
if (targetLi && firstLi) {
doScroll();
}
}
};
// ======================== Trigger =========================
var syncScroll = (0,es.useEvent)(startScroll);
return [syncScroll, stopScroll, isScrolling];
}
;// ./node_modules/@rc-component/picker/es/PickerPanel/TimePanel/TimePanelBody/TimeColumn.js
function TimeColumn_typeof(o) { "@babel/helpers - typeof"; return TimeColumn_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, TimeColumn_typeof(o); }
function TimeColumn_defineProperty(obj, key, value) { key = TimeColumn_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function TimeColumn_toPropertyKey(t) { var i = TimeColumn_toPrimitive(t, "string"); return "symbol" == TimeColumn_typeof(i) ? i : String(i); }
function TimeColumn_toPrimitive(t, r) { if ("object" != TimeColumn_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != TimeColumn_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function TimeColumn_toConsumableArray(arr) { return TimeColumn_arrayWithoutHoles(arr) || TimeColumn_iterableToArray(arr) || TimeColumn_unsupportedIterableToArray(arr) || TimeColumn_nonIterableSpread(); }
function TimeColumn_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function TimeColumn_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function TimeColumn_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return TimeColumn_arrayLikeToArray(arr); }
function TimeColumn_slicedToArray(arr, i) { return TimeColumn_arrayWithHoles(arr) || TimeColumn_iterableToArrayLimit(arr, i) || TimeColumn_unsupportedIterableToArray(arr, i) || TimeColumn_nonIterableRest(); }
function TimeColumn_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 TimeColumn_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return TimeColumn_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 TimeColumn_arrayLikeToArray(o, minLen); }
function TimeColumn_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 TimeColumn_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function TimeColumn_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
var SCROLL_DELAY = 300;
// Not use JSON.stringify to avoid dead loop
function flattenUnits(units) {
return units.map(function (_ref) {
var value = _ref.value,
label = _ref.label,
disabled = _ref.disabled;
return [value, label, disabled].join(',');
}).join(';');
}
function TimeColumn(props) {
var units = props.units,
value = props.value,
optionalValue = props.optionalValue,
type = props.type,
onChange = props.onChange,
onHover = props.onHover,
onDblClick = props.onDblClick,
changeOnScroll = props.changeOnScroll;
var _usePanelContext = usePanelContext(),
prefixCls = _usePanelContext.prefixCls,
cellRender = _usePanelContext.cellRender,
now = _usePanelContext.now,
locale = _usePanelContext.locale,
classNames = _usePanelContext.classNames,
styles = _usePanelContext.styles;
var panelPrefixCls = "".concat(prefixCls, "-time-panel");
var cellPrefixCls = "".concat(prefixCls, "-time-panel-cell");
// ========================== Refs ==========================
var ulRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
// ========================= Scroll =========================
var checkDelayRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
var clearDelayCheck = function clearDelayCheck() {
clearTimeout(checkDelayRef.current);
};
// ========================== Sync ==========================
var _useScrollTo = useScrollTo_useScrollTo(ulRef, value !== null && value !== void 0 ? value : optionalValue),
_useScrollTo2 = TimeColumn_slicedToArray(_useScrollTo, 3),
syncScroll = _useScrollTo2[0],
stopScroll = _useScrollTo2[1],
isScrolling = _useScrollTo2[2];
// Effect sync value scroll
(0,useLayoutEffect["default"])(function () {
syncScroll();
clearDelayCheck();
return function () {
stopScroll();
clearDelayCheck();
};
}, [value, optionalValue, flattenUnits(units)]);
// ========================= Change =========================
// Scroll event if sync onScroll
var onInternalScroll = function onInternalScroll(event) {
clearDelayCheck();
var target = event.target;
if (!isScrolling() && changeOnScroll) {
checkDelayRef.current = setTimeout(function () {
var ul = ulRef.current;
var firstLiTop = ul.querySelector("li").offsetTop;
var liList = Array.from(ul.querySelectorAll("li"));
var liTopList = liList.map(function (li) {
return li.offsetTop - firstLiTop;
});
var liDistList = liTopList.map(function (top, index) {
if (units[index].disabled) {
return Number.MAX_SAFE_INTEGER;
}
return Math.abs(top - target.scrollTop);
});
// Find min distance index
var minDist = Math.min.apply(Math, TimeColumn_toConsumableArray(liDistList));
var minDistIndex = liDistList.findIndex(function (dist) {
return dist === minDist;
});
var targetUnit = units[minDistIndex];
if (targetUnit && !targetUnit.disabled) {
onChange(targetUnit.value);
}
}, SCROLL_DELAY);
}
};
// ========================= Render =========================
var columnPrefixCls = "".concat(panelPrefixCls, "-column");
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("ul", {
className: columnPrefixCls,
ref: ulRef,
"data-type": type,
onScroll: onInternalScroll
}, units.map(function (_ref2) {
var label = _ref2.label,
unitValue = _ref2.value,
disabled = _ref2.disabled;
var inner = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: "".concat(cellPrefixCls, "-inner")
}, label);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("li", {
key: unitValue,
style: styles.item,
className: (0,clsx.clsx)(cellPrefixCls, classNames.item, TimeColumn_defineProperty(TimeColumn_defineProperty({}, "".concat(cellPrefixCls, "-selected"), value === unitValue), "".concat(cellPrefixCls, "-disabled"), disabled)),
onClick: function onClick() {
if (!disabled) {
onChange(unitValue);
}
},
onDoubleClick: function onDoubleClick() {
if (!disabled && onDblClick) {
onDblClick();
}
},
onMouseEnter: function onMouseEnter() {
onHover(unitValue);
},
onMouseLeave: function onMouseLeave() {
onHover(null);
},
"data-value": unitValue
}, cellRender ? cellRender(unitValue, {
prefixCls: prefixCls,
originNode: inner,
today: now,
type: 'time',
subType: type,
locale: locale
}) : inner);
}));
}
;// ./node_modules/@rc-component/picker/es/PickerPanel/TimePanel/TimePanelBody/index.js
function TimePanelBody_extends() { TimePanelBody_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return TimePanelBody_extends.apply(this, arguments); }
function TimePanelBody_slicedToArray(arr, i) { return TimePanelBody_arrayWithHoles(arr) || TimePanelBody_iterableToArrayLimit(arr, i) || TimePanelBody_unsupportedIterableToArray(arr, i) || TimePanelBody_nonIterableRest(); }
function TimePanelBody_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 TimePanelBody_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return TimePanelBody_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 TimePanelBody_arrayLikeToArray(o, minLen); }
function TimePanelBody_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 TimePanelBody_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function TimePanelBody_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function isAM(hour) {
return hour < 12;
}
function TimePanelBody(props) {
var showHour = props.showHour,
showMinute = props.showMinute,
showSecond = props.showSecond,
showMillisecond = props.showMillisecond,
showMeridiem = props.use12Hours,
changeOnScroll = props.changeOnScroll;
var _usePanelContext = usePanelContext(),
prefixCls = _usePanelContext.prefixCls,
classNames = _usePanelContext.classNames,
styles = _usePanelContext.styles,
values = _usePanelContext.values,
generateConfig = _usePanelContext.generateConfig,
locale = _usePanelContext.locale,
onSelect = _usePanelContext.onSelect,
_usePanelContext$onHo = _usePanelContext.onHover,
onHover = _usePanelContext$onHo === void 0 ? function () {} : _usePanelContext$onHo,
pickerValue = _usePanelContext.pickerValue;
var value = (values === null || values === void 0 ? void 0 : values[0]) || null;
var _React$useContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PickerHackContext),
onCellDblClick = _React$useContext.onCellDblClick;
// ========================== Info ==========================
var _useTimeInfo = useTimeInfo(generateConfig, props, value),
_useTimeInfo2 = TimePanelBody_slicedToArray(_useTimeInfo, 5),
getValidTime = _useTimeInfo2[0],
rowHourUnits = _useTimeInfo2[1],
getMinuteUnits = _useTimeInfo2[2],
getSecondUnits = _useTimeInfo2[3],
getMillisecondUnits = _useTimeInfo2[4];
// ========================= Value ==========================
// PickerValue will tell which one to align on the top
var getUnitValue = function getUnitValue(func) {
var valueUnitVal = value && generateConfig[func](value);
var pickerUnitValue = pickerValue && generateConfig[func](pickerValue);
return [valueUnitVal, pickerUnitValue];
};
var _getUnitValue = getUnitValue('getHour'),
_getUnitValue2 = TimePanelBody_slicedToArray(_getUnitValue, 2),
hour = _getUnitValue2[0],
pickerHour = _getUnitValue2[1];
var _getUnitValue3 = getUnitValue('getMinute'),
_getUnitValue4 = TimePanelBody_slicedToArray(_getUnitValue3, 2),
minute = _getUnitValue4[0],
pickerMinute = _getUnitValue4[1];
var _getUnitValue5 = getUnitValue('getSecond'),
_getUnitValue6 = TimePanelBody_slicedToArray(_getUnitValue5, 2),
second = _getUnitValue6[0],
pickerSecond = _getUnitValue6[1];
var _getUnitValue7 = getUnitValue('getMillisecond'),
_getUnitValue8 = TimePanelBody_slicedToArray(_getUnitValue7, 2),
millisecond = _getUnitValue8[0],
pickerMillisecond = _getUnitValue8[1];
var meridiem = hour === null ? null : isAM(hour) ? 'am' : 'pm';
// ========================= Column =========================
// Hours
var hourUnits = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
if (!showMeridiem) {
return rowHourUnits;
}
return isAM(hour) ? rowHourUnits.filter(function (h) {
return isAM(h.value);
}) : rowHourUnits.filter(function (h) {
return !isAM(h.value);
});
}, [hour, rowHourUnits, showMeridiem]);
// >>> Pick Fallback
var getEnabled = function getEnabled(units, val) {
var _enabledUnits$;
var enabledUnits = units.filter(function (unit) {
return !unit.disabled;
});
return val !== null && val !== void 0 ? val : // Fallback to enabled value
enabledUnits === null || enabledUnits === void 0 || (_enabledUnits$ = enabledUnits[0]) === null || _enabledUnits$ === void 0 ? void 0 : _enabledUnits$.value;
};
// >>> Minutes
var validHour = getEnabled(rowHourUnits, hour);
var minuteUnits = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return getMinuteUnits(validHour);
}, [getMinuteUnits, validHour]);
// >>> Seconds
var validMinute = getEnabled(minuteUnits, minute);
var secondUnits = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return getSecondUnits(validHour, validMinute);
}, [getSecondUnits, validHour, validMinute]);
// >>> Milliseconds
var validSecond = getEnabled(secondUnits, second);
var millisecondUnits = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return getMillisecondUnits(validHour, validMinute, validSecond);
}, [getMillisecondUnits, validHour, validMinute, validSecond]);
var validMillisecond = getEnabled(millisecondUnits, millisecond);
// Meridiem
var meridiemUnits = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
if (!showMeridiem) {
return [];
}
var base = generateConfig.getNow();
var amDate = generateConfig.setHour(base, 6);
var pmDate = generateConfig.setHour(base, 18);
var formatMeridiem = function formatMeridiem(date, defaultLabel) {
var cellMeridiemFormat = locale.cellMeridiemFormat;
return cellMeridiemFormat ? formatValue(date, {
generateConfig: generateConfig,
locale: locale,
format: cellMeridiemFormat
}) : defaultLabel;
};
return [{
label: formatMeridiem(amDate, 'AM'),
value: 'am',
disabled: rowHourUnits.every(function (h) {
return h.disabled || !isAM(h.value);
})
}, {
label: formatMeridiem(pmDate, 'PM'),
value: 'pm',
disabled: rowHourUnits.every(function (h) {
return h.disabled || isAM(h.value);
})
}];
}, [rowHourUnits, showMeridiem, generateConfig, locale]);
// ========================= Change =========================
/**
* Check if time is validate or will match to validate one
*/
var triggerChange = function triggerChange(nextDate) {
var validateDate = getValidTime(nextDate);
onSelect(validateDate);
};
// ========================= Column =========================
// Create a template date for the trigger change event
var triggerDateTmpl = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
var tmpl = value || pickerValue || generateConfig.getNow();
var isNotNull = function isNotNull(num) {
return num !== null && num !== undefined;
};
if (isNotNull(hour)) {
tmpl = generateConfig.setHour(tmpl, hour);
tmpl = generateConfig.setMinute(tmpl, minute);
tmpl = generateConfig.setSecond(tmpl, second);
tmpl = generateConfig.setMillisecond(tmpl, millisecond);
} else if (isNotNull(pickerHour)) {
tmpl = generateConfig.setHour(tmpl, pickerHour);
tmpl = generateConfig.setMinute(tmpl, pickerMinute);
tmpl = generateConfig.setSecond(tmpl, pickerSecond);
tmpl = generateConfig.setMillisecond(tmpl, pickerMillisecond);
} else if (isNotNull(validHour)) {
tmpl = generateConfig.setHour(tmpl, validHour);
tmpl = generateConfig.setMinute(tmpl, validMinute);
tmpl = generateConfig.setSecond(tmpl, validSecond);
tmpl = generateConfig.setMillisecond(tmpl, validMillisecond);
}
return tmpl;
}, [value, pickerValue, hour, minute, second, millisecond, validHour, validMinute, validSecond, validMillisecond, pickerHour, pickerMinute, pickerSecond, pickerMillisecond, generateConfig]);
// ===================== Columns Change =====================
var fillColumnValue = function fillColumnValue(val, func) {
if (val === null) {
return null;
}
return generateConfig[func](triggerDateTmpl, val);
};
var getNextHourTime = function getNextHourTime(val) {
return fillColumnValue(val, 'setHour');
};
var getNextMinuteTime = function getNextMinuteTime(val) {
return fillColumnValue(val, 'setMinute');
};
var getNextSecondTime = function getNextSecondTime(val) {
return fillColumnValue(val, 'setSecond');
};
var getNextMillisecondTime = function getNextMillisecondTime(val) {
return fillColumnValue(val, 'setMillisecond');
};
var getMeridiemTime = function getMeridiemTime(val) {
if (val === null) {
return null;
}
if (val === 'am' && !isAM(hour)) {
return generateConfig.setHour(triggerDateTmpl, hour - 12);
} else if (val === 'pm' && isAM(hour)) {
return generateConfig.setHour(triggerDateTmpl, hour + 12);
}
return triggerDateTmpl;
};
var onHourChange = function onHourChange(val) {
triggerChange(getNextHourTime(val));
};
var onMinuteChange = function onMinuteChange(val) {
triggerChange(getNextMinuteTime(val));
};
var onSecondChange = function onSecondChange(val) {
triggerChange(getNextSecondTime(val));
};
var onMillisecondChange = function onMillisecondChange(val) {
triggerChange(getNextMillisecondTime(val));
};
var onMeridiemChange = function onMeridiemChange(val) {
triggerChange(getMeridiemTime(val));
};
// ====================== Column Hover ======================
var onHourHover = function onHourHover(val) {
onHover(getNextHourTime(val));
};
var onMinuteHover = function onMinuteHover(val) {
onHover(getNextMinuteTime(val));
};
var onSecondHover = function onSecondHover(val) {
onHover(getNextSecondTime(val));
};
var onMillisecondHover = function onMillisecondHover(val) {
onHover(getNextMillisecondTime(val));
};
var onMeridiemHover = function onMeridiemHover(val) {
onHover(getMeridiemTime(val));
};
// ========================= Render =========================
var sharedColumnProps = {
onDblClick: onCellDblClick,
changeOnScroll: changeOnScroll
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)("".concat(prefixCls, "-content"), classNames.content),
style: styles.content
}, showHour && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TimeColumn, TimePanelBody_extends({
units: hourUnits,
value: hour,
optionalValue: pickerHour,
type: "hour",
onChange: onHourChange,
onHover: onHourHover
}, sharedColumnProps)), showMinute && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TimeColumn, TimePanelBody_extends({
units: minuteUnits,
value: minute,
optionalValue: pickerMinute,
type: "minute",
onChange: onMinuteChange,
onHover: onMinuteHover
}, sharedColumnProps)), showSecond && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TimeColumn, TimePanelBody_extends({
units: secondUnits,
value: second,
optionalValue: pickerSecond,
type: "second",
onChange: onSecondChange,
onHover: onSecondHover
}, sharedColumnProps)), showMillisecond && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TimeColumn, TimePanelBody_extends({
units: millisecondUnits,
value: millisecond,
optionalValue: pickerMillisecond,
type: "millisecond",
onChange: onMillisecondChange,
onHover: onMillisecondHover
}, sharedColumnProps)), showMeridiem && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TimeColumn, TimePanelBody_extends({
units: meridiemUnits,
value: meridiem,
type: "meridiem",
onChange: onMeridiemChange,
onHover: onMeridiemHover
}, sharedColumnProps)));
}
;// ./node_modules/@rc-component/picker/es/PickerPanel/TimePanel/index.js
function TimePanel_slicedToArray(arr, i) { return TimePanel_arrayWithHoles(arr) || TimePanel_iterableToArrayLimit(arr, i) || TimePanel_unsupportedIterableToArray(arr, i) || TimePanel_nonIterableRest(); }
function TimePanel_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 TimePanel_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return TimePanel_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 TimePanel_arrayLikeToArray(o, minLen); }
function TimePanel_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 TimePanel_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function TimePanel_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function TimePanel(props) {
var prefixCls = props.prefixCls,
value = props.value,
locale = props.locale,
generateConfig = props.generateConfig,
showTime = props.showTime;
var _ref = showTime || {},
format = _ref.format;
var panelPrefixCls = "".concat(prefixCls, "-time-panel");
// ========================== Base ==========================
var _useInfo = useInfo(props, 'time'),
_useInfo2 = TimePanel_slicedToArray(_useInfo, 1),
info = _useInfo2[0];
// ========================= Render =========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PanelContext.Provider, {
value: info
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(panelPrefixCls)
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PickerPanel_PanelHeader, null, value ? formatValue(value, {
locale: locale,
format: format,
generateConfig: generateConfig
}) : "\xA0"), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TimePanelBody, showTime)));
}
;// ./node_modules/@rc-component/picker/es/PickerPanel/DateTimePanel/index.js
function DateTimePanel_extends() { DateTimePanel_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return DateTimePanel_extends.apply(this, arguments); }
function DateTimePanel_slicedToArray(arr, i) { return DateTimePanel_arrayWithHoles(arr) || DateTimePanel_iterableToArrayLimit(arr, i) || DateTimePanel_unsupportedIterableToArray(arr, i) || DateTimePanel_nonIterableRest(); }
function DateTimePanel_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 DateTimePanel_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return DateTimePanel_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 DateTimePanel_arrayLikeToArray(o, minLen); }
function DateTimePanel_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 DateTimePanel_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function DateTimePanel_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function DateTimePanel(props) {
var prefixCls = props.prefixCls,
generateConfig = props.generateConfig,
showTime = props.showTime,
onSelect = props.onSelect,
value = props.value,
pickerValue = props.pickerValue,
onHover = props.onHover;
var panelPrefixCls = "".concat(prefixCls, "-datetime-panel");
// =============================== Time ===============================
var _useTimeInfo = useTimeInfo(generateConfig, showTime),
_useTimeInfo2 = DateTimePanel_slicedToArray(_useTimeInfo, 1),
getValidTime = _useTimeInfo2[0];
// Merge the time info from `value` or `pickerValue`
var mergeTime = function mergeTime(date) {
if (value) {
return fillTime(generateConfig, date, value);
}
return fillTime(generateConfig, date, pickerValue);
};
// ============================== Hover ===============================
var onDateHover = function onDateHover(date) {
onHover === null || onHover === void 0 || onHover(date ? mergeTime(date) : date);
};
// ============================== Select ==============================
var onDateSelect = function onDateSelect(date) {
// Merge with current time
var cloneDate = mergeTime(date);
onSelect(getValidTime(cloneDate, cloneDate));
};
// ============================== Render ==============================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: panelPrefixCls
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(DatePanel, DateTimePanel_extends({}, props, {
onSelect: onDateSelect,
onHover: onDateHover
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TimePanel, props));
}
;// ./node_modules/@rc-component/picker/es/PickerPanel/DecadePanel/index.js
function DecadePanel_typeof(o) { "@babel/helpers - typeof"; return DecadePanel_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, DecadePanel_typeof(o); }
function DecadePanel_extends() { DecadePanel_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return DecadePanel_extends.apply(this, arguments); }
function DecadePanel_defineProperty(obj, key, value) { key = DecadePanel_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function DecadePanel_toPropertyKey(t) { var i = DecadePanel_toPrimitive(t, "string"); return "symbol" == DecadePanel_typeof(i) ? i : String(i); }
function DecadePanel_toPrimitive(t, r) { if ("object" != DecadePanel_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != DecadePanel_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function DecadePanel_slicedToArray(arr, i) { return DecadePanel_arrayWithHoles(arr) || DecadePanel_iterableToArrayLimit(arr, i) || DecadePanel_unsupportedIterableToArray(arr, i) || DecadePanel_nonIterableRest(); }
function DecadePanel_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 DecadePanel_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return DecadePanel_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 DecadePanel_arrayLikeToArray(o, minLen); }
function DecadePanel_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 DecadePanel_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function DecadePanel_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function DecadePanel(props) {
var prefixCls = props.prefixCls,
locale = props.locale,
generateConfig = props.generateConfig,
pickerValue = props.pickerValue,
disabledDate = props.disabledDate,
onPickerValueChange = props.onPickerValueChange;
var panelPrefixCls = "".concat(prefixCls, "-decade-panel");
// ========================== Base ==========================
var _useInfo = useInfo(props, 'decade'),
_useInfo2 = DecadePanel_slicedToArray(_useInfo, 1),
info = _useInfo2[0];
var getStartYear = function getStartYear(date) {
var startYear = Math.floor(generateConfig.getYear(date) / 100) * 100;
return generateConfig.setYear(date, startYear);
};
var getEndYear = function getEndYear(date) {
var startYear = getStartYear(date);
return generateConfig.addYear(startYear, 99);
};
var startYearDate = getStartYear(pickerValue);
var endYearDate = getEndYear(pickerValue);
var baseDate = generateConfig.addYear(startYearDate, -10);
// ========================= Cells ==========================
var getCellDate = function getCellDate(date, offset) {
return generateConfig.addYear(date, offset * 10);
};
var getCellText = function getCellText(date) {
var cellYearFormat = locale.cellYearFormat;
var startYearStr = formatValue(date, {
locale: locale,
format: cellYearFormat,
generateConfig: generateConfig
});
var endYearStr = formatValue(generateConfig.addYear(date, 9), {
locale: locale,
format: cellYearFormat,
generateConfig: generateConfig
});
return "".concat(startYearStr, "-").concat(endYearStr);
};
var getCellClassName = function getCellClassName(date) {
return DecadePanel_defineProperty({}, "".concat(prefixCls, "-cell-in-view"), isSameDecade(generateConfig, date, startYearDate) || isSameDecade(generateConfig, date, endYearDate) || isInRange(generateConfig, startYearDate, endYearDate, date));
};
// ======================== Disabled ========================
var mergedDisabledDate = disabledDate ? function (currentDate, disabledInfo) {
// Start
var baseStartDate = generateConfig.setDate(currentDate, 1);
var baseStartMonth = generateConfig.setMonth(baseStartDate, 0);
var baseStartYear = generateConfig.setYear(baseStartMonth, Math.floor(generateConfig.getYear(baseStartMonth) / 10) * 10);
// End
var baseEndYear = generateConfig.addYear(baseStartYear, 10);
var baseEndDate = generateConfig.addDate(baseEndYear, -1);
return disabledDate(baseStartYear, disabledInfo) && disabledDate(baseEndDate, disabledInfo);
} : null;
// ========================= Header =========================
var yearNode = "".concat(formatValue(startYearDate, {
locale: locale,
format: locale.yearFormat,
generateConfig: generateConfig
}), "-").concat(formatValue(endYearDate, {
locale: locale,
format: locale.yearFormat,
generateConfig: generateConfig
}));
// ========================= Render =========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PanelContext.Provider, {
value: info
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: panelPrefixCls
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PickerPanel_PanelHeader, {
superOffset: function superOffset(distance) {
return generateConfig.addYear(pickerValue, distance * 100);
},
onChange: onPickerValueChange
// Limitation
,
getStart: getStartYear,
getEnd: getEndYear
}, yearNode), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PanelBody, DecadePanel_extends({}, props, {
disabledDate: mergedDisabledDate,
colNum: 3,
rowNum: 4,
baseDate: baseDate
// Body
,
getCellDate: getCellDate,
getCellText: getCellText,
getCellClassName: getCellClassName
}))));
}
;// ./node_modules/@rc-component/picker/es/PickerPanel/MonthPanel/index.js
function MonthPanel_typeof(o) { "@babel/helpers - typeof"; return MonthPanel_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, MonthPanel_typeof(o); }
function MonthPanel_extends() { MonthPanel_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return MonthPanel_extends.apply(this, arguments); }
function MonthPanel_defineProperty(obj, key, value) { key = MonthPanel_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function MonthPanel_toPropertyKey(t) { var i = MonthPanel_toPrimitive(t, "string"); return "symbol" == MonthPanel_typeof(i) ? i : String(i); }
function MonthPanel_toPrimitive(t, r) { if ("object" != MonthPanel_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != MonthPanel_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function MonthPanel_slicedToArray(arr, i) { return MonthPanel_arrayWithHoles(arr) || MonthPanel_iterableToArrayLimit(arr, i) || MonthPanel_unsupportedIterableToArray(arr, i) || MonthPanel_nonIterableRest(); }
function MonthPanel_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 MonthPanel_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return MonthPanel_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 MonthPanel_arrayLikeToArray(o, minLen); }
function MonthPanel_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 MonthPanel_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function MonthPanel_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function MonthPanel(props) {
var prefixCls = props.prefixCls,
locale = props.locale,
generateConfig = props.generateConfig,
pickerValue = props.pickerValue,
disabledDate = props.disabledDate,
onPickerValueChange = props.onPickerValueChange,
onModeChange = props.onModeChange;
var panelPrefixCls = "".concat(prefixCls, "-month-panel");
// ========================== Base ==========================
var _useInfo = useInfo(props, 'month'),
_useInfo2 = MonthPanel_slicedToArray(_useInfo, 1),
info = _useInfo2[0];
var baseDate = generateConfig.setMonth(pickerValue, 0);
// ========================= Month ==========================
var monthsLocale = locale.shortMonths || (generateConfig.locale.getShortMonths ? generateConfig.locale.getShortMonths(locale.locale) : []);
// ========================= Cells ==========================
var getCellDate = function getCellDate(date, offset) {
return generateConfig.addMonth(date, offset);
};
var getCellText = function getCellText(date) {
var month = generateConfig.getMonth(date);
return locale.monthFormat ? formatValue(date, {
locale: locale,
format: locale.monthFormat,
generateConfig: generateConfig
}) : monthsLocale[month];
};
var getCellClassName = function getCellClassName() {
return MonthPanel_defineProperty({}, "".concat(prefixCls, "-cell-in-view"), true);
};
// ======================== Disabled ========================
var mergedDisabledDate = disabledDate ? function (currentDate, disabledInfo) {
var startDate = generateConfig.setDate(currentDate, 1);
var nextMonthStartDate = generateConfig.setMonth(startDate, generateConfig.getMonth(startDate) + 1);
var endDate = generateConfig.addDate(nextMonthStartDate, -1);
return disabledDate(startDate, disabledInfo) && disabledDate(endDate, disabledInfo);
} : null;
// ========================= Header =========================
var yearNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
key: "year",
"aria-label": locale.yearSelect,
onClick: function onClick() {
onModeChange('year');
},
tabIndex: -1,
className: "".concat(prefixCls, "-year-btn")
}, formatValue(pickerValue, {
locale: locale,
format: locale.yearFormat,
generateConfig: generateConfig
}));
// ========================= Render =========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PanelContext.Provider, {
value: info
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: panelPrefixCls
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PickerPanel_PanelHeader, {
superOffset: function superOffset(distance) {
return generateConfig.addYear(pickerValue, distance);
},
onChange: onPickerValueChange
// Limitation
,
getStart: function getStart(date) {
return generateConfig.setMonth(date, 0);
},
getEnd: function getEnd(date) {
return generateConfig.setMonth(date, 11);
}
}, yearNode), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PanelBody, MonthPanel_extends({}, props, {
disabledDate: mergedDisabledDate,
titleFormat: locale.fieldMonthFormat,
colNum: 3,
rowNum: 4,
baseDate: baseDate
// Body
,
getCellDate: getCellDate,
getCellText: getCellText,
getCellClassName: getCellClassName
}))));
}
;// ./node_modules/@rc-component/picker/es/PickerPanel/QuarterPanel/index.js
function QuarterPanel_typeof(o) { "@babel/helpers - typeof"; return QuarterPanel_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, QuarterPanel_typeof(o); }
function QuarterPanel_extends() { QuarterPanel_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return QuarterPanel_extends.apply(this, arguments); }
function QuarterPanel_defineProperty(obj, key, value) { key = QuarterPanel_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function QuarterPanel_toPropertyKey(t) { var i = QuarterPanel_toPrimitive(t, "string"); return "symbol" == QuarterPanel_typeof(i) ? i : String(i); }
function QuarterPanel_toPrimitive(t, r) { if ("object" != QuarterPanel_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != QuarterPanel_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function QuarterPanel_slicedToArray(arr, i) { return QuarterPanel_arrayWithHoles(arr) || QuarterPanel_iterableToArrayLimit(arr, i) || QuarterPanel_unsupportedIterableToArray(arr, i) || QuarterPanel_nonIterableRest(); }
function QuarterPanel_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 QuarterPanel_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return QuarterPanel_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 QuarterPanel_arrayLikeToArray(o, minLen); }
function QuarterPanel_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 QuarterPanel_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function QuarterPanel_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function QuarterPanel(props) {
var prefixCls = props.prefixCls,
locale = props.locale,
generateConfig = props.generateConfig,
pickerValue = props.pickerValue,
onPickerValueChange = props.onPickerValueChange,
onModeChange = props.onModeChange;
var panelPrefixCls = "".concat(prefixCls, "-quarter-panel");
// ========================== Base ==========================
var _useInfo = useInfo(props, 'quarter'),
_useInfo2 = QuarterPanel_slicedToArray(_useInfo, 1),
info = _useInfo2[0];
var baseDate = generateConfig.setMonth(pickerValue, 0);
// ========================= Cells ==========================
var getCellDate = function getCellDate(date, offset) {
return generateConfig.addMonth(date, offset * 3);
};
var getCellText = function getCellText(date) {
return formatValue(date, {
locale: locale,
format: locale.cellQuarterFormat,
generateConfig: generateConfig
});
};
var getCellClassName = function getCellClassName() {
return QuarterPanel_defineProperty({}, "".concat(prefixCls, "-cell-in-view"), true);
};
// ========================= Header =========================
var yearNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
key: "year",
"aria-label": locale.yearSelect,
onClick: function onClick() {
onModeChange('year');
},
tabIndex: -1,
className: "".concat(prefixCls, "-year-btn")
}, formatValue(pickerValue, {
locale: locale,
format: locale.yearFormat,
generateConfig: generateConfig
}));
// ========================= Render =========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PanelContext.Provider, {
value: info
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: panelPrefixCls
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PickerPanel_PanelHeader, {
superOffset: function superOffset(distance) {
return generateConfig.addYear(pickerValue, distance);
},
onChange: onPickerValueChange
// Limitation
,
getStart: function getStart(date) {
return generateConfig.setMonth(date, 0);
},
getEnd: function getEnd(date) {
return generateConfig.setMonth(date, 11);
}
}, yearNode), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PanelBody, QuarterPanel_extends({}, props, {
titleFormat: locale.fieldQuarterFormat,
colNum: 4,
rowNum: 1,
baseDate: baseDate
// Body
,
getCellDate: getCellDate,
getCellText: getCellText,
getCellClassName: getCellClassName
}))));
}
;// ./node_modules/@rc-component/picker/es/PickerPanel/WeekPanel/index.js
function WeekPanel_typeof(o) { "@babel/helpers - typeof"; return WeekPanel_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, WeekPanel_typeof(o); }
function WeekPanel_extends() { WeekPanel_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return WeekPanel_extends.apply(this, arguments); }
function WeekPanel_defineProperty(obj, key, value) { key = WeekPanel_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function WeekPanel_toPropertyKey(t) { var i = WeekPanel_toPrimitive(t, "string"); return "symbol" == WeekPanel_typeof(i) ? i : String(i); }
function WeekPanel_toPrimitive(t, r) { if ("object" != WeekPanel_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != WeekPanel_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function WeekPanel_slicedToArray(arr, i) { return WeekPanel_arrayWithHoles(arr) || WeekPanel_iterableToArrayLimit(arr, i) || WeekPanel_unsupportedIterableToArray(arr, i) || WeekPanel_nonIterableRest(); }
function WeekPanel_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 WeekPanel_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return WeekPanel_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 WeekPanel_arrayLikeToArray(o, minLen); }
function WeekPanel_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 WeekPanel_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function WeekPanel_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function WeekPanel(props) {
var prefixCls = props.prefixCls,
generateConfig = props.generateConfig,
locale = props.locale,
value = props.value,
hoverValue = props.hoverValue,
hoverRangeValue = props.hoverRangeValue;
// =============================== Row ================================
var localeName = locale.locale;
var rowPrefixCls = "".concat(prefixCls, "-week-panel-row");
var rowClassName = function rowClassName(currentDate) {
var rangeCls = {};
if (hoverRangeValue) {
var _hoverRangeValue = WeekPanel_slicedToArray(hoverRangeValue, 2),
rangeStart = _hoverRangeValue[0],
rangeEnd = _hoverRangeValue[1];
var isRangeStart = isSameWeek(generateConfig, localeName, rangeStart, currentDate);
var isRangeEnd = isSameWeek(generateConfig, localeName, rangeEnd, currentDate);
rangeCls["".concat(rowPrefixCls, "-range-start")] = isRangeStart;
rangeCls["".concat(rowPrefixCls, "-range-end")] = isRangeEnd;
rangeCls["".concat(rowPrefixCls, "-range-hover")] = !isRangeStart && !isRangeEnd && isInRange(generateConfig, rangeStart, rangeEnd, currentDate);
}
if (hoverValue) {
rangeCls["".concat(rowPrefixCls, "-hover")] = hoverValue.some(function (date) {
return isSameWeek(generateConfig, localeName, currentDate, date);
});
}
return (0,clsx.clsx)(rowPrefixCls, WeekPanel_defineProperty({}, "".concat(rowPrefixCls, "-selected"), !hoverRangeValue && isSameWeek(generateConfig, localeName, value, currentDate)),
// Patch for hover range
rangeCls);
};
// ============================== Render ==============================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(DatePanel, WeekPanel_extends({}, props, {
mode: "week",
panelName: "week",
rowClassName: rowClassName
}));
}
;// ./node_modules/@rc-component/picker/es/PickerPanel/YearPanel/index.js
function YearPanel_typeof(o) { "@babel/helpers - typeof"; return YearPanel_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, YearPanel_typeof(o); }
function YearPanel_extends() { YearPanel_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return YearPanel_extends.apply(this, arguments); }
function YearPanel_defineProperty(obj, key, value) { key = YearPanel_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function YearPanel_toPropertyKey(t) { var i = YearPanel_toPrimitive(t, "string"); return "symbol" == YearPanel_typeof(i) ? i : String(i); }
function YearPanel_toPrimitive(t, r) { if ("object" != YearPanel_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != YearPanel_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function YearPanel_slicedToArray(arr, i) { return YearPanel_arrayWithHoles(arr) || YearPanel_iterableToArrayLimit(arr, i) || YearPanel_unsupportedIterableToArray(arr, i) || YearPanel_nonIterableRest(); }
function YearPanel_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 YearPanel_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return YearPanel_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 YearPanel_arrayLikeToArray(o, minLen); }
function YearPanel_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 YearPanel_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function YearPanel_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function YearPanel(props) {
var prefixCls = props.prefixCls,
locale = props.locale,
generateConfig = props.generateConfig,
pickerValue = props.pickerValue,
disabledDate = props.disabledDate,
onPickerValueChange = props.onPickerValueChange,
onModeChange = props.onModeChange;
var panelPrefixCls = "".concat(prefixCls, "-year-panel");
// ========================== Base ==========================
var _useInfo = useInfo(props, 'year'),
_useInfo2 = YearPanel_slicedToArray(_useInfo, 1),
info = _useInfo2[0];
var getStartYear = function getStartYear(date) {
var startYear = Math.floor(generateConfig.getYear(date) / 10) * 10;
return generateConfig.setYear(date, startYear);
};
var getEndYear = function getEndYear(date) {
var startYear = getStartYear(date);
return generateConfig.addYear(startYear, 9);
};
var startYearDate = getStartYear(pickerValue);
var endYearDate = getEndYear(pickerValue);
var baseDate = generateConfig.addYear(startYearDate, -1);
// ========================= Cells ==========================
var getCellDate = function getCellDate(date, offset) {
return generateConfig.addYear(date, offset);
};
var getCellText = function getCellText(date) {
return formatValue(date, {
locale: locale,
format: locale.cellYearFormat,
generateConfig: generateConfig
});
};
var getCellClassName = function getCellClassName(date) {
return YearPanel_defineProperty({}, "".concat(prefixCls, "-cell-in-view"), isSameYear(generateConfig, date, startYearDate) || isSameYear(generateConfig, date, endYearDate) || isInRange(generateConfig, startYearDate, endYearDate, date));
};
// ======================== Disabled ========================
var mergedDisabledDate = disabledDate ? function (currentDate, disabledInfo) {
// Start
var startMonth = generateConfig.setMonth(currentDate, 0);
var startDate = generateConfig.setDate(startMonth, 1);
// End
var endMonth = generateConfig.addYear(startDate, 1);
var endDate = generateConfig.addDate(endMonth, -1);
return disabledDate(startDate, disabledInfo) && disabledDate(endDate, disabledInfo);
} : null;
// ========================= Header =========================
var yearNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
key: "decade",
"aria-label": locale.decadeSelect,
onClick: function onClick() {
onModeChange('decade');
},
tabIndex: -1,
className: "".concat(prefixCls, "-decade-btn")
}, formatValue(startYearDate, {
locale: locale,
format: locale.yearFormat,
generateConfig: generateConfig
}), "-", formatValue(endYearDate, {
locale: locale,
format: locale.yearFormat,
generateConfig: generateConfig
}));
// ========================= Render =========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PanelContext.Provider, {
value: info
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: panelPrefixCls
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PickerPanel_PanelHeader, {
superOffset: function superOffset(distance) {
return generateConfig.addYear(pickerValue, distance * 10);
},
onChange: onPickerValueChange
// Limitation
,
getStart: getStartYear,
getEnd: getEndYear
}, yearNode), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PanelBody, YearPanel_extends({}, props, {
disabledDate: mergedDisabledDate,
titleFormat: locale.fieldYearFormat,
colNum: 3,
rowNum: 4,
baseDate: baseDate
// Body
,
getCellDate: getCellDate,
getCellText: getCellText,
getCellClassName: getCellClassName
}))));
}
;// ./node_modules/@rc-component/picker/es/PickerPanel/index.js
function PickerPanel_typeof(o) { "@babel/helpers - typeof"; return PickerPanel_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, PickerPanel_typeof(o); }
function PickerPanel_extends() { PickerPanel_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return PickerPanel_extends.apply(this, arguments); }
function PickerPanel_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function PickerPanel_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? PickerPanel_ownKeys(Object(t), !0).forEach(function (r) { PickerPanel_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : PickerPanel_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function PickerPanel_defineProperty(obj, key, value) { key = PickerPanel_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function PickerPanel_toPropertyKey(t) { var i = PickerPanel_toPrimitive(t, "string"); return "symbol" == PickerPanel_typeof(i) ? i : String(i); }
function PickerPanel_toPrimitive(t, r) { if ("object" != PickerPanel_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != PickerPanel_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function PickerPanel_toConsumableArray(arr) { return PickerPanel_arrayWithoutHoles(arr) || PickerPanel_iterableToArray(arr) || PickerPanel_unsupportedIterableToArray(arr) || PickerPanel_nonIterableSpread(); }
function PickerPanel_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function PickerPanel_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function PickerPanel_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return PickerPanel_arrayLikeToArray(arr); }
function PickerPanel_slicedToArray(arr, i) { return PickerPanel_arrayWithHoles(arr) || PickerPanel_iterableToArrayLimit(arr, i) || PickerPanel_unsupportedIterableToArray(arr, i) || PickerPanel_nonIterableRest(); }
function PickerPanel_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 PickerPanel_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return PickerPanel_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 PickerPanel_arrayLikeToArray(o, minLen); }
function PickerPanel_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 PickerPanel_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function PickerPanel_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
var DefaultComponents = {
date: DatePanel,
datetime: DateTimePanel,
week: WeekPanel,
month: MonthPanel,
quarter: QuarterPanel,
year: YearPanel,
decade: DecadePanel,
time: TimePanel
};
function PickerPanel(props, ref) {
var panelClassNames = props.classNames,
panelStyles = props.styles,
locale = props.locale,
generateConfig = props.generateConfig,
direction = props.direction,
prefixCls = props.prefixCls,
_props$tabIndex = props.tabIndex,
tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex,
multiple = props.multiple,
defaultValue = props.defaultValue,
value = props.value,
onChange = props.onChange,
onSelect = props.onSelect,
defaultPickerValue = props.defaultPickerValue,
pickerValue = props.pickerValue,
onPickerValueChange = props.onPickerValueChange,
mode = props.mode,
onPanelChange = props.onPanelChange,
_props$picker = props.picker,
picker = _props$picker === void 0 ? 'date' : _props$picker,
showTime = props.showTime,
hoverValue = props.hoverValue,
hoverRangeValue = props.hoverRangeValue,
cellRender = props.cellRender,
dateRender = props.dateRender,
monthCellRender = props.monthCellRender,
_props$components = props.components,
components = _props$components === void 0 ? {} : _props$components,
hideHeader = props.hideHeader;
// ======================== Context ========================
var _ref = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PickerInput_context) || {},
contextPrefixCls = _ref.prefixCls,
pickerClassNames = _ref.classNames,
pickerStyles = _ref.styles;
// ======================== prefixCls ========================
var mergedPrefixCls = contextPrefixCls || prefixCls || 'rc-picker';
// ========================== Refs ==========================
var rootRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, function () {
return {
nativeElement: rootRef.current
};
});
// ========================== Time ==========================
// Auto `format` need to check `showTime.showXXX` first.
// And then merge the `locale` into `mergedShowTime`.
var _getTimeProps = getTimeProps(props),
_getTimeProps2 = PickerPanel_slicedToArray(_getTimeProps, 4),
timeProps = _getTimeProps2[0],
localeTimeProps = _getTimeProps2[1],
showTimeFormat = _getTimeProps2[2],
propFormat = _getTimeProps2[3];
// ========================= Locale =========================
var filledLocale = useLocale_useLocale(locale, localeTimeProps);
// ========================= Picker =========================
var internalPicker = picker === 'date' && showTime ? 'datetime' : picker;
// ======================== ShowTime ========================
var mergedShowTime = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return fillShowTimeConfig(internalPicker, showTimeFormat, propFormat, timeProps, filledLocale);
}, [internalPicker, showTimeFormat, propFormat, timeProps, filledLocale]);
// ========================== Now ===========================
var now = generateConfig.getNow();
// ========================== Mode ==========================
var _useControlledState = (0,es.useControlledState)(picker || 'date', mode),
_useControlledState2 = PickerPanel_slicedToArray(_useControlledState, 2),
mergedMode = _useControlledState2[0],
setMergedMode = _useControlledState2[1];
var internalMode = mergedMode === 'date' && mergedShowTime ? 'datetime' : mergedMode;
// ========================= Toggle =========================
var toggleDates = useToggleDates(generateConfig, locale, internalPicker);
// ========================= Value ==========================
// >>> Real value
// Interactive with `onChange` event which only trigger when the `mode` is `picker`
var _useControlledState3 = (0,es.useControlledState)(defaultValue, value),
_useControlledState4 = PickerPanel_slicedToArray(_useControlledState3, 2),
innerValue = _useControlledState4[0],
setMergedValue = _useControlledState4[1];
var mergedValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
// Clean up `[null]`
var values = miscUtil_toArray(innerValue).filter(function (val) {
return val;
});
return multiple ? values : values.slice(0, 1);
}, [innerValue, multiple]);
// Sync value and only trigger onChange event when changed
var triggerChange = (0,es.useEvent)(function (nextValue) {
setMergedValue(nextValue);
if (onChange && (nextValue === null || mergedValue.length !== nextValue.length || mergedValue.some(function (ori, index) {
return !isSame(generateConfig, locale, ori, nextValue[index], internalPicker);
}))) {
onChange === null || onChange === void 0 || onChange(multiple ? nextValue : nextValue[0]);
}
});
// >>> CalendarValue
// CalendarValue is a temp value for user operation
// which will only trigger `onCalendarChange` but not `onChange`
var onInternalSelect = (0,es.useEvent)(function (newDate) {
onSelect === null || onSelect === void 0 || onSelect(newDate);
if (mergedMode === picker) {
var nextValues = multiple ? toggleDates(mergedValue, newDate) : [newDate];
triggerChange(nextValues);
}
});
// >>> PickerValue
// PickerValue is used to control the current displaying panel
var _useControlledState5 = (0,es.useControlledState)(defaultPickerValue || mergedValue[0] || now, pickerValue),
_useControlledState6 = PickerPanel_slicedToArray(_useControlledState5, 2),
mergedPickerValue = _useControlledState6[0],
setInternalPickerValue = _useControlledState6[1];
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(function () {
if (mergedValue[0] && !pickerValue) {
setInternalPickerValue(mergedValue[0]);
}
}, [mergedValue[0]]);
// Both trigger when manually pickerValue or mode change
var triggerPanelChange = function triggerPanelChange(viewDate, nextMode) {
onPanelChange === null || onPanelChange === void 0 || onPanelChange(viewDate || pickerValue, nextMode || mergedMode);
};
var setPickerValue = function setPickerValue(nextPickerValue) {
var triggerPanelEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
setInternalPickerValue(nextPickerValue);
onPickerValueChange === null || onPickerValueChange === void 0 || onPickerValueChange(nextPickerValue);
if (triggerPanelEvent) {
triggerPanelChange(nextPickerValue);
}
};
var triggerModeChange = function triggerModeChange(nextMode, viewDate) {
setMergedMode(nextMode);
if (viewDate) {
setPickerValue(viewDate);
}
triggerPanelChange(viewDate, nextMode);
};
var onPanelValueSelect = function onPanelValueSelect(nextValue) {
onInternalSelect(nextValue);
setPickerValue(nextValue);
// Update mode if needed
if (mergedMode !== picker) {
var decadeYearQueue = ['decade', 'year'];
var decadeYearMonthQueue = [].concat(decadeYearQueue, ['month']);
var pickerQueue = {
quarter: [].concat(decadeYearQueue, ['quarter']),
week: [].concat(PickerPanel_toConsumableArray(decadeYearMonthQueue), ['week']),
date: [].concat(PickerPanel_toConsumableArray(decadeYearMonthQueue), ['date'])
};
var queue = pickerQueue[picker] || decadeYearMonthQueue;
var index = queue.indexOf(mergedMode);
var nextMode = queue[index + 1];
if (nextMode) {
triggerModeChange(nextMode, nextValue);
}
}
};
// ======================= Hover Date =======================
var hoverRangeDate = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
var start;
var end;
if (Array.isArray(hoverRangeValue)) {
var _hoverRangeValue = PickerPanel_slicedToArray(hoverRangeValue, 2);
start = _hoverRangeValue[0];
end = _hoverRangeValue[1];
} else {
start = hoverRangeValue;
}
// Return for not exist
if (!start && !end) {
return null;
}
// Fill if has empty
start = start || end;
end = end || start;
return generateConfig.isAfter(start, end) ? [end, start] : [start, end];
}, [hoverRangeValue, generateConfig]);
// ======================= Components =======================
// >>> cellRender
var onInternalCellRender = useCellRender(cellRender, dateRender, monthCellRender);
// ======================= Components =======================
var PanelComponent = components[internalMode] || DefaultComponents[internalMode] || DatePanel;
// ======================== Context =========================
var sharedPanelContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
var _ref2, _pickerClassNames$pop, _ref3, _pickerStyles$popup;
return {
classNames: (_ref2 = (_pickerClassNames$pop = pickerClassNames === null || pickerClassNames === void 0 ? void 0 : pickerClassNames.popup) !== null && _pickerClassNames$pop !== void 0 ? _pickerClassNames$pop : panelClassNames) !== null && _ref2 !== void 0 ? _ref2 : {},
styles: (_ref3 = (_pickerStyles$popup = pickerStyles === null || pickerStyles === void 0 ? void 0 : pickerStyles.popup) !== null && _pickerStyles$popup !== void 0 ? _pickerStyles$popup : panelStyles) !== null && _ref3 !== void 0 ? _ref3 : {}
};
}, [pickerClassNames, panelClassNames, pickerStyles, panelStyles]);
var parentHackContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PickerHackContext);
var pickerPanelContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return PickerPanel_objectSpread(PickerPanel_objectSpread({}, parentHackContext), {}, {
hideHeader: hideHeader
});
}, [parentHackContext, hideHeader]);
// ======================== Warnings ========================
if (true) {
(0,es.warning)(!mergedValue || mergedValue.every(function (val) {
return generateConfig.isValidate(val);
}), 'Invalidate date pass to `value` or `defaultValue`.');
}
// ========================= Render =========================
var panelCls = "".concat(mergedPrefixCls, "-panel");
var panelProps = pickProps(props, [
// Week
'showWeek',
// Icons
'prevIcon', 'nextIcon', 'superPrevIcon', 'superNextIcon',
// Disabled
'disabledDate', 'minDate', 'maxDate',
// Hover
'onHover']);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(SharedPanelContext.Provider, {
value: sharedPanelContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PickerHackContext.Provider, {
value: pickerPanelContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: rootRef,
tabIndex: tabIndex,
className: (0,clsx.clsx)(panelCls, PickerPanel_defineProperty({}, "".concat(panelCls, "-rtl"), direction === 'rtl'))
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PanelComponent, PickerPanel_extends({}, panelProps, {
// Time
showTime: mergedShowTime
// MISC
,
prefixCls: mergedPrefixCls,
locale: filledLocale,
generateConfig: generateConfig
// Mode
,
onModeChange: triggerModeChange
// Value
,
pickerValue: mergedPickerValue,
onPickerValueChange: function onPickerValueChange(nextPickerValue) {
setPickerValue(nextPickerValue, true);
},
value: mergedValue[0],
onSelect: onPanelValueSelect,
values: mergedValue
// Render
,
cellRender: onInternalCellRender
// Hover
,
hoverRangeValue: hoverRangeDate,
hoverValue: hoverValue
})))));
}
var RefPanelPicker = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(PickerPanel));
if (true) {
RefPanelPicker.displayName = 'PanelPicker';
}
// Make support generic
/* harmony default export */ var es_PickerPanel = (RefPanelPicker);
;// ./node_modules/@rc-component/picker/es/PickerInput/Popup/PopupPanel.js
function PopupPanel_typeof(o) { "@babel/helpers - typeof"; return PopupPanel_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, PopupPanel_typeof(o); }
function PopupPanel_extends() { PopupPanel_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return PopupPanel_extends.apply(this, arguments); }
function PopupPanel_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function PopupPanel_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? PopupPanel_ownKeys(Object(t), !0).forEach(function (r) { PopupPanel_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : PopupPanel_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function PopupPanel_defineProperty(obj, key, value) { key = PopupPanel_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function PopupPanel_toPropertyKey(t) { var i = PopupPanel_toPrimitive(t, "string"); return "symbol" == PopupPanel_typeof(i) ? i : String(i); }
function PopupPanel_toPrimitive(t, r) { if ("object" != PopupPanel_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != PopupPanel_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function PopupPanel(props) {
var picker = props.picker,
multiplePanel = props.multiplePanel,
pickerValue = props.pickerValue,
onPickerValueChange = props.onPickerValueChange,
needConfirm = props.needConfirm,
onSubmit = props.onSubmit,
range = props.range,
hoverValue = props.hoverValue;
var _React$useContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PickerInput_context),
prefixCls = _React$useContext.prefixCls,
generateConfig = _React$useContext.generateConfig;
// ======================== Offset ========================
var internalOffsetDate = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(function (date, offset) {
return offsetPanelDate(generateConfig, picker, date, offset);
}, [generateConfig, picker]);
var nextPickerValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return internalOffsetDate(pickerValue, 1);
}, [pickerValue, internalOffsetDate]);
// Outside
var onSecondPickerValueChange = function onSecondPickerValueChange(nextDate) {
onPickerValueChange(internalOffsetDate(nextDate, -1));
};
// ======================= Context ========================
var sharedContext = {
onCellDblClick: function onCellDblClick() {
if (needConfirm) {
onSubmit();
}
}
};
var hideHeader = picker === 'time';
// ======================== Props =========================
var pickerProps = PopupPanel_objectSpread(PopupPanel_objectSpread({}, props), {}, {
hoverValue: null,
hoverRangeValue: null,
hideHeader: hideHeader
});
if (range) {
pickerProps.hoverRangeValue = hoverValue;
} else {
pickerProps.hoverValue = hoverValue;
}
// ======================== Render ========================
// Multiple
if (multiplePanel) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: "".concat(prefixCls, "-panels")
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PickerHackContext.Provider, {
value: PopupPanel_objectSpread(PopupPanel_objectSpread({}, sharedContext), {}, {
hideNext: true
})
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_PickerPanel, pickerProps)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PickerHackContext.Provider, {
value: PopupPanel_objectSpread(PopupPanel_objectSpread({}, sharedContext), {}, {
hidePrev: true
})
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_PickerPanel, PopupPanel_extends({}, pickerProps, {
pickerValue: nextPickerValue,
onPickerValueChange: onSecondPickerValueChange
}))));
}
// Single
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PickerHackContext.Provider, {
value: PopupPanel_objectSpread({}, sharedContext)
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_PickerPanel, pickerProps));
}
;// ./node_modules/@rc-component/picker/es/PickerInput/Popup/PresetPanel.js
function executeValue(value) {
return typeof value === 'function' ? value() : value;
}
function PresetPanel(props) {
var prefixCls = props.prefixCls,
presets = props.presets,
_onClick = props.onClick,
onHover = props.onHover;
if (!presets.length) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: "".concat(prefixCls, "-presets")
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("ul", null, presets.map(function (_ref, index) {
var label = _ref.label,
value = _ref.value;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("li", {
key: index,
onClick: function onClick() {
_onClick(executeValue(value));
},
onMouseEnter: function onMouseEnter() {
onHover(executeValue(value));
},
onMouseLeave: function onMouseLeave() {
onHover(null);
}
}, label);
})));
}
;// ./node_modules/@rc-component/picker/es/PickerInput/Popup/index.js
function Popup_typeof(o) { "@babel/helpers - typeof"; return Popup_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, Popup_typeof(o); }
function Popup_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function Popup_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? Popup_ownKeys(Object(t), !0).forEach(function (r) { Popup_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Popup_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function Popup_defineProperty(obj, key, value) { key = Popup_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function Popup_toPropertyKey(t) { var i = Popup_toPrimitive(t, "string"); return "symbol" == Popup_typeof(i) ? i : String(i); }
function Popup_toPrimitive(t, r) { if ("object" != Popup_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != Popup_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function PickerInput_Popup_extends() { PickerInput_Popup_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return PickerInput_Popup_extends.apply(this, arguments); }
function Popup_slicedToArray(arr, i) { return Popup_arrayWithHoles(arr) || Popup_iterableToArrayLimit(arr, i) || Popup_unsupportedIterableToArray(arr, i) || Popup_nonIterableRest(); }
function Popup_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 Popup_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Popup_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 Popup_arrayLikeToArray(o, minLen); }
function Popup_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 Popup_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function Popup_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function PickerInput_Popup_Popup(props) {
var _classNames$popup, _styles$popup;
var panelRender = props.panelRender,
internalMode = props.internalMode,
picker = props.picker,
showNow = props.showNow,
range = props.range,
multiple = props.multiple,
_props$activeInfo = props.activeInfo,
activeInfo = _props$activeInfo === void 0 ? [0, 0, 0] : _props$activeInfo,
presets = props.presets,
onPresetHover = props.onPresetHover,
onPresetSubmit = props.onPresetSubmit,
onFocus = props.onFocus,
onBlur = props.onBlur,
onPanelMouseDown = props.onPanelMouseDown,
direction = props.direction,
value = props.value,
onSelect = props.onSelect,
isInvalid = props.isInvalid,
defaultOpenValue = props.defaultOpenValue,
onOk = props.onOk,
onSubmit = props.onSubmit,
classNames = props.classNames,
styles = props.styles;
var _React$useContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PickerInput_context),
prefixCls = _React$useContext.prefixCls;
var panelPrefixCls = "".concat(prefixCls, "-panel");
var rtl = direction === 'rtl';
// ========================= Refs =========================
var arrowRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
var wrapperRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
// ======================== Offset ========================
var _React$useState = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0),
_React$useState2 = Popup_slicedToArray(_React$useState, 2),
containerWidth = _React$useState2[0],
setContainerWidth = _React$useState2[1];
var _React$useState3 = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0),
_React$useState4 = Popup_slicedToArray(_React$useState3, 2),
containerOffset = _React$useState4[0],
setContainerOffset = _React$useState4[1];
var _React$useState5 = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0),
_React$useState6 = Popup_slicedToArray(_React$useState5, 2),
arrowOffset = _React$useState6[0],
setArrowOffset = _React$useState6[1];
var onResize = function onResize(info) {
if (info.width) {
setContainerWidth(info.width);
}
};
var _activeInfo = Popup_slicedToArray(activeInfo, 3),
activeInputLeft = _activeInfo[0],
activeInputRight = _activeInfo[1],
selectorWidth = _activeInfo[2];
var _React$useState7 = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0),
_React$useState8 = Popup_slicedToArray(_React$useState7, 2),
retryTimes = _React$useState8[0],
setRetryTimes = _React$useState8[1];
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(function () {
setRetryTimes(10);
}, [activeInputLeft]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(function () {
// `activeOffset` is always align with the active input element
// So we need only check container contains the `activeOffset`
if (range && wrapperRef.current) {
var _arrowRef$current;
// Offset in case container has border radius
var arrowWidth = ((_arrowRef$current = arrowRef.current) === null || _arrowRef$current === void 0 ? void 0 : _arrowRef$current.offsetWidth) || 0;
// Arrow Offset
var wrapperRect = wrapperRef.current.getBoundingClientRect();
if (!wrapperRect.height || wrapperRect.right < 0) {
setRetryTimes(function (times) {
return Math.max(0, times - 1);
});
return;
}
var nextArrowOffset = (rtl ? activeInputRight - arrowWidth : activeInputLeft) - wrapperRect.left;
setArrowOffset(nextArrowOffset);
// Container Offset
if (containerWidth && containerWidth < selectorWidth) {
var offset = rtl ? wrapperRect.right - (activeInputRight - arrowWidth + containerWidth) : activeInputLeft + arrowWidth - wrapperRect.left - containerWidth;
var safeOffset = Math.max(0, offset);
setContainerOffset(safeOffset);
} else {
setContainerOffset(0);
}
}
}, [retryTimes, rtl, containerWidth, activeInputLeft, activeInputRight, selectorWidth, range]);
// ======================== Custom ========================
function filterEmpty(list) {
return list.filter(function (item) {
return item;
});
}
var valueList = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return filterEmpty(miscUtil_toArray(value));
}, [value]);
var isTimePickerEmptyValue = picker === 'time' && !valueList.length;
var footerSubmitValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
if (isTimePickerEmptyValue) {
return filterEmpty([defaultOpenValue]);
}
return valueList;
}, [isTimePickerEmptyValue, valueList, defaultOpenValue]);
var popupPanelValue = isTimePickerEmptyValue ? defaultOpenValue : valueList;
var disableSubmit = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
// Empty is invalid
if (!footerSubmitValue.length) {
return true;
}
return footerSubmitValue.some(function (val) {
return isInvalid(val);
});
}, [footerSubmitValue, isInvalid]);
var onFooterSubmit = function onFooterSubmit() {
// For TimePicker, we will additional trigger the value update
if (isTimePickerEmptyValue) {
onSelect(defaultOpenValue);
}
onOk();
onSubmit();
};
var mergedNodes = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: "".concat(prefixCls, "-panel-layout")
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PresetPanel, {
prefixCls: prefixCls,
presets: presets,
onClick: onPresetSubmit,
onHover: onPresetHover
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PopupPanel, PickerInput_Popup_extends({}, props, {
value: popupPanelValue
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Footer_Footer, PickerInput_Popup_extends({}, props, {
showNow: multiple ? false : showNow,
invalid: disableSubmit,
onSubmit: onFooterSubmit
}))));
if (panelRender) {
mergedNodes = panelRender(mergedNodes);
}
// ======================== Render ========================
var containerPrefixCls = "".concat(panelPrefixCls, "-container");
var marginLeft = 'marginLeft';
var marginRight = 'marginRight';
// Container
var renderNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
onMouseDown: onPanelMouseDown,
tabIndex: -1,
className: (0,clsx.clsx)(containerPrefixCls, // Used for Today Button style, safe to remove if no need
"".concat(prefixCls, "-").concat(internalMode, "-panel-container"), classNames === null || classNames === void 0 || (_classNames$popup = classNames.popup) === null || _classNames$popup === void 0 ? void 0 : _classNames$popup.container),
style: Popup_objectSpread(Popup_defineProperty(Popup_defineProperty({}, rtl ? marginRight : marginLeft, containerOffset), rtl ? marginLeft : marginRight, 'auto'), styles === null || styles === void 0 || (_styles$popup = styles.popup) === null || _styles$popup === void 0 ? void 0 : _styles$popup.container)
// Still wish not to lose focus on mouse down
// onMouseDown={(e) => {
// // e.preventDefault();
// }}
,
onFocus: onFocus,
onBlur: onBlur
}, mergedNodes);
if (range) {
renderNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
onMouseDown: onPanelMouseDown,
ref: wrapperRef,
className: (0,clsx.clsx)("".concat(prefixCls, "-range-wrapper"), "".concat(prefixCls, "-").concat(picker, "-range-wrapper"))
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: arrowRef,
className: "".concat(prefixCls, "-range-arrow"),
style: {
left: arrowOffset
}
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(resize_observer_es, {
onResize: onResize
}, renderNode));
}
return renderNode;
}
;// ./node_modules/@rc-component/picker/es/PickerInput/Selector/hooks/useInputProps.js
function useInputProps_typeof(o) { "@babel/helpers - typeof"; return useInputProps_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, useInputProps_typeof(o); }
function useInputProps_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function useInputProps_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? useInputProps_ownKeys(Object(t), !0).forEach(function (r) { useInputProps_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : useInputProps_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function useInputProps_defineProperty(obj, key, value) { key = useInputProps_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function useInputProps_toPropertyKey(t) { var i = useInputProps_toPrimitive(t, "string"); return "symbol" == useInputProps_typeof(i) ? i : String(i); }
function useInputProps_toPrimitive(t, r) { if ("object" != useInputProps_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != useInputProps_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function useInputProps(props, /** Used for SinglePicker */
postProps) {
var format = props.format,
maskFormat = props.maskFormat,
generateConfig = props.generateConfig,
locale = props.locale,
preserveInvalidOnBlur = props.preserveInvalidOnBlur,
inputReadOnly = props.inputReadOnly,
required = props.required,
ariaRequired = props['aria-required'],
onSubmit = props.onSubmit,
_onFocus = props.onFocus,
_onBlur = props.onBlur,
onInputChange = props.onInputChange,
onInvalid = props.onInvalid,
open = props.open,
onOpenChange = props.onOpenChange,
_onKeyDown = props.onKeyDown,
_onChange = props.onChange,
activeHelp = props.activeHelp,
name = props.name,
autoComplete = props.autoComplete,
id = props.id,
value = props.value,
invalid = props.invalid,
placeholder = props.placeholder,
disabled = props.disabled,
activeIndex = props.activeIndex,
allHelp = props.allHelp,
picker = props.picker;
// ======================== Parser ========================
var parseDate = function parseDate(str, formatStr) {
var parsed = generateConfig.locale.parse(locale.locale, str, [formatStr]);
return parsed && generateConfig.isValidate(parsed) ? parsed : null;
};
// ========================= Text =========================
var firstFormat = format[0];
var getText = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(function (date) {
return formatValue(date, {
locale: locale,
format: firstFormat,
generateConfig: generateConfig
});
}, [locale, generateConfig, firstFormat]);
var valueTexts = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return value.map(getText);
}, [value, getText]);
// ========================= Size =========================
var size = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
var defaultSize = picker === 'time' ? 8 : 10;
var length = typeof firstFormat === 'function' ? firstFormat(generateConfig.getNow()).length : firstFormat.length;
return Math.max(defaultSize, length) + 2;
}, [firstFormat, picker, generateConfig]);
// ======================= Validate =======================
var _validateFormat = function validateFormat(text) {
for (var i = 0; i < format.length; i += 1) {
var singleFormat = format[i];
// Only support string type
if (typeof singleFormat === 'string') {
var parsed = parseDate(text, singleFormat);
if (parsed) {
return parsed;
}
}
}
return false;
};
// ======================== Input =========================
var getInputProps = function getInputProps(index) {
function getProp(propValue) {
return index !== undefined ? propValue[index] : propValue;
}
var pickedAttrs = (0,pickAttrs["default"])(props, {
aria: true,
data: true
});
var inputProps = useInputProps_objectSpread(useInputProps_objectSpread({}, pickedAttrs), {}, {
// ============== Shared ==============
format: maskFormat,
validateFormat: function validateFormat(text) {
return !!_validateFormat(text);
},
preserveInvalidOnBlur: preserveInvalidOnBlur,
readOnly: inputReadOnly,
required: required,
'aria-required': ariaRequired,
name: name,
autoComplete: autoComplete,
size: size,
// ============= By Index =============
id: getProp(id),
value: getProp(valueTexts) || '',
invalid: getProp(invalid),
placeholder: getProp(placeholder),
active: activeIndex === index,
helped: allHelp || activeHelp && activeIndex === index,
disabled: getProp(disabled),
onFocus: function onFocus(event) {
_onFocus(event, index);
},
onBlur: function onBlur(event) {
// Blur do not trigger close
// Since it may focus to the popup panel
_onBlur(event, index);
},
onSubmit: onSubmit,
// Get validate text value
onChange: function onChange(text) {
onInputChange();
var parsed = _validateFormat(text);
if (parsed) {
onInvalid(false, index);
_onChange(parsed, index);
return;
}
// Tell outer that the value typed is invalid.
// If text is empty, it means valid.
onInvalid(!!text, index);
},
onHelp: function onHelp() {
onOpenChange(true, {
index: index
});
},
onKeyDown: function onKeyDown(event) {
var prevented = false;
_onKeyDown === null || _onKeyDown === void 0 || _onKeyDown(event, function () {
if (true) {
(0,es.warning)(false, '`preventDefault` callback is deprecated. Please call `event.preventDefault` directly.');
}
prevented = true;
});
if (!event.defaultPrevented && !prevented) {
switch (event.key) {
case 'Escape':
onOpenChange(false, {
index: index
});
break;
case 'Enter':
if (!open) {
onOpenChange(true);
}
break;
}
}
}
}, postProps === null || postProps === void 0 ? void 0 : postProps({
valueTexts: valueTexts
}));
// ============== Clean Up ==============
Object.keys(inputProps).forEach(function (key) {
if (inputProps[key] === undefined) {
delete inputProps[key];
}
});
return inputProps;
};
return [getInputProps, getText];
}
;// ./node_modules/@rc-component/picker/es/PickerInput/Selector/hooks/useRootProps.js
var propNames = ['onMouseEnter', 'onMouseLeave'];
function useRootProps(props) {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return pickProps(props, propNames);
}, [props]);
}
;// ./node_modules/@rc-component/picker/es/PickerInput/Selector/Icon.js
var _excluded = ["icon", "type"],
_excluded2 = ["onClear"];
function Icon_extends() { Icon_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Icon_extends.apply(this, arguments); }
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; }
function Icon_Icon(props) {
var icon = props.icon,
type = props.type,
restProps = _objectWithoutProperties(props, _excluded);
var _React$useContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PickerInput_context),
prefixCls = _React$useContext.prefixCls,
classNames = _React$useContext.classNames,
styles = _React$useContext.styles;
return icon ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", Icon_extends({
className: (0,clsx.clsx)("".concat(prefixCls, "-").concat(type), classNames.suffix),
style: styles.suffix
}, restProps), icon) : null;
}
function ClearIcon(_ref) {
var onClear = _ref.onClear,
restProps = _objectWithoutProperties(_ref, _excluded2);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Icon_Icon, Icon_extends({}, restProps, {
type: "clear",
role: "button",
onMouseDown: function onMouseDown(e) {
e.preventDefault();
},
onClick: function onClick(e) {
e.stopPropagation();
onClear();
}
}));
}
;// ./node_modules/@rc-component/picker/es/PickerInput/Selector/MaskFormat.js
function MaskFormat_typeof(o) { "@babel/helpers - typeof"; return MaskFormat_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, MaskFormat_typeof(o); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, MaskFormat_toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function MaskFormat_defineProperty(obj, key, value) { key = MaskFormat_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function MaskFormat_toPropertyKey(t) { var i = MaskFormat_toPrimitive(t, "string"); return "symbol" == MaskFormat_typeof(i) ? i : String(i); }
function MaskFormat_toPrimitive(t, r) { if ("object" != MaskFormat_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != MaskFormat_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var FORMAT_KEYS = ['YYYY', 'MM', 'DD', 'HH', 'mm', 'ss', 'SSS'];
// Use Chinese character to avoid conflict with the mask format
var REPLACE_KEY = '顧';
var MaskFormat = /*#__PURE__*/function () {
function MaskFormat(format) {
_classCallCheck(this, MaskFormat);
MaskFormat_defineProperty(this, "format", void 0);
MaskFormat_defineProperty(this, "maskFormat", void 0);
MaskFormat_defineProperty(this, "cells", void 0);
MaskFormat_defineProperty(this, "maskCells", void 0);
this.format = format;
// Generate mask format
var replaceKeys = FORMAT_KEYS.map(function (key) {
return "(".concat(key, ")");
}).join('|');
var replaceReg = new RegExp(replaceKeys, 'g');
this.maskFormat = format.replace(replaceReg,
// Use Chinese character to avoid user use it in format
function (key) {
return REPLACE_KEY.repeat(key.length);
});
// Generate cells
var cellReg = new RegExp("(".concat(FORMAT_KEYS.join('|'), ")"));
var strCells = (format.split(cellReg) || []).filter(function (str) {
return str;
});
var offset = 0;
this.cells = strCells.map(function (text) {
var mask = FORMAT_KEYS.includes(text);
var start = offset;
var end = offset + text.length;
offset = end;
return {
text: text,
mask: mask,
start: start,
end: end
};
});
// Mask cells
this.maskCells = this.cells.filter(function (cell) {
return cell.mask;
});
}
_createClass(MaskFormat, [{
key: "getSelection",
value: function getSelection(maskCellIndex) {
var _ref = this.maskCells[maskCellIndex] || {},
start = _ref.start,
end = _ref.end;
return [start || 0, end || 0];
}
/** Check given text match format */
}, {
key: "match",
value: function match(text) {
for (var i = 0; i < this.maskFormat.length; i += 1) {
var maskChar = this.maskFormat[i];
var textChar = text[i];
if (!textChar || maskChar !== REPLACE_KEY && maskChar !== textChar) {
return false;
}
}
return true;
}
/** Get mask cell count */
}, {
key: "size",
value: function size() {
return this.maskCells.length;
}
}, {
key: "getMaskCellIndex",
value: function getMaskCellIndex(anchorIndex) {
var closetDist = Number.MAX_SAFE_INTEGER;
var closetIndex = 0;
for (var i = 0; i < this.maskCells.length; i += 1) {
var _this$maskCells$i = this.maskCells[i],
start = _this$maskCells$i.start,
end = _this$maskCells$i.end;
if (anchorIndex >= start && anchorIndex <= end) {
return i;
}
var dist = Math.min(Math.abs(anchorIndex - start), Math.abs(anchorIndex - end));
if (dist < closetDist) {
closetDist = dist;
closetIndex = i;
}
}
return closetIndex;
}
}]);
return MaskFormat;
}();
;// ./node_modules/@rc-component/picker/es/PickerInput/Selector/util.js
function getMaskRange(key) {
var PresetRange = {
YYYY: [0, 9999, new Date().getFullYear()],
MM: [1, 12],
DD: [1, 31],
HH: [0, 23],
mm: [0, 59],
ss: [0, 59],
SSS: [0, 999]
};
return PresetRange[key];
}
;// ./node_modules/@rc-component/picker/es/PickerInput/Selector/Input.js
function Input_typeof(o) { "@babel/helpers - typeof"; return Input_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, Input_typeof(o); }
var Input_excluded = ["className", "active", "showActiveCls", "suffixIcon", "format", "validateFormat", "onChange", "onInput", "helped", "onHelp", "onSubmit", "onKeyDown", "preserveInvalidOnBlur", "invalid", "clearIcon"];
function Input_extends() { Input_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Input_extends.apply(this, arguments); }
function Input_defineProperty(obj, key, value) { key = Input_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function Input_toPropertyKey(t) { var i = Input_toPrimitive(t, "string"); return "symbol" == Input_typeof(i) ? i : String(i); }
function Input_toPrimitive(t, r) { if ("object" != Input_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != Input_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function Input_slicedToArray(arr, i) { return Input_arrayWithHoles(arr) || Input_iterableToArrayLimit(arr, i) || Input_unsupportedIterableToArray(arr, i) || Input_nonIterableRest(); }
function Input_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 Input_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Input_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 Input_arrayLikeToArray(o, minLen); }
function Input_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 Input_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function Input_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function Input_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = Input_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 Input_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; }
// Format logic
//
// First time on focus:
// 1. check if the text is valid, if not fill with format
// 2. set highlight cell to the first cell
// Cells
// 1. Selection the index cell, set inner `cacheValue` to ''
// 2. Key input filter non-number char, patch after the `cacheValue`
// 1. Replace the `cacheValue` with input align the cell length
// 2. Re-selection the mask cell
// 3. If `cacheValue` match the limit length or cell format (like 1 ~ 12 month), go to next cell
var Selector_Input_Input = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(function (props, ref) {
var className = props.className,
active = props.active,
_props$showActiveCls = props.showActiveCls,
showActiveCls = _props$showActiveCls === void 0 ? true : _props$showActiveCls,
suffixIcon = props.suffixIcon,
format = props.format,
validateFormat = props.validateFormat,
onChange = props.onChange,
onInput = props.onInput,
helped = props.helped,
onHelp = props.onHelp,
onSubmit = props.onSubmit,
onKeyDown = props.onKeyDown,
_props$preserveInvali = props.preserveInvalidOnBlur,
preserveInvalidOnBlur = _props$preserveInvali === void 0 ? false : _props$preserveInvali,
invalid = props.invalid,
clearIcon = props.clearIcon,
restProps = Input_objectWithoutProperties(props, Input_excluded);
var value = props.value,
onFocus = props.onFocus,
onBlur = props.onBlur,
onMouseUp = props.onMouseUp;
var _React$useContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PickerInput_context),
prefixCls = _React$useContext.prefixCls,
_React$useContext$inp = _React$useContext.input,
Component = _React$useContext$inp === void 0 ? 'input' : _React$useContext$inp,
classNames = _React$useContext.classNames,
styles = _React$useContext.styles;
var inputPrefixCls = "".concat(prefixCls, "-input");
// ======================== Value =========================
var _React$useState = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false),
_React$useState2 = Input_slicedToArray(_React$useState, 2),
focused = _React$useState2[0],
setFocused = _React$useState2[1];
var _React$useState3 = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(value),
_React$useState4 = Input_slicedToArray(_React$useState3, 2),
internalInputValue = _React$useState4[0],
setInputValue = _React$useState4[1];
var _React$useState5 = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(''),
_React$useState6 = Input_slicedToArray(_React$useState5, 2),
focusCellText = _React$useState6[0],
setFocusCellText = _React$useState6[1];
var _React$useState7 = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null),
_React$useState8 = Input_slicedToArray(_React$useState7, 2),
focusCellIndex = _React$useState8[0],
setFocusCellIndex = _React$useState8[1];
var _React$useState9 = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null),
_React$useState10 = Input_slicedToArray(_React$useState9, 2),
forceSelectionSyncMark = _React$useState10[0],
forceSelectionSync = _React$useState10[1];
var inputValue = internalInputValue || '';
// Sync value if needed
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(function () {
setInputValue(value);
}, [value]);
// ========================= Refs =========================
var holderRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
var inputRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
// When mousedown get focus, defer selection to mouseUp so click position is used
var mouseDownRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, function () {
return {
nativeElement: holderRef.current,
inputElement: inputRef.current,
focus: function focus(options) {
inputRef.current.focus(options);
},
blur: function blur() {
inputRef.current.blur();
}
};
});
// ======================== Format ========================
var maskFormat = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return new MaskFormat(format || '');
}, [format]);
var _React$useMemo = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
if (helped) {
return [0, 0];
}
return maskFormat.getSelection(focusCellIndex);
}, [maskFormat, focusCellIndex, helped]),
_React$useMemo2 = Input_slicedToArray(_React$useMemo, 2),
selectionStart = _React$useMemo2[0],
selectionEnd = _React$useMemo2[1];
// ======================== Modify ========================
// When input modify content, trigger `onHelp` if is not the format
var onModify = function onModify(text) {
if (text && text !== format && text !== value) {
onHelp();
}
};
// ======================== Change ========================
/**
* Triggered by paste, keyDown and focus to show format
*/
var triggerInputChange = (0,es.useEvent)(function (text) {
if (validateFormat(text)) {
onChange(text);
}
setInputValue(text);
onModify(text);
});
// Directly trigger `onChange` if `format` is empty
var onInternalChange = function onInternalChange(event) {
// Hack `onChange` with format to do nothing
if (!format) {
var text = event.target.value;
onModify(text);
setInputValue(text);
onChange(text);
}
};
var onFormatPaste = function onFormatPaste(event) {
// Block paste until selection is set (after mouseUp when focus was by mousedown)
if (mouseDownRef.current) {
event.preventDefault();
return;
}
// Get paste text
var pasteText = event.clipboardData.getData('text');
if (validateFormat(pasteText)) {
triggerInputChange(pasteText);
}
};
// ======================== Mouse =========================
// When `mouseDown` get focus, it's better to not to change the selection
// Since the up position maybe not is the first cell
var onFormatMouseDown = function onFormatMouseDown() {
mouseDownRef.current = true;
};
var onFormatMouseUp = function onFormatMouseUp(event) {
var _ref = event.target,
start = _ref.selectionStart;
var closeMaskIndex = maskFormat.getMaskCellIndex(start);
setFocusCellIndex(closeMaskIndex);
// Force update the selection
forceSelectionSync({});
onMouseUp === null || onMouseUp === void 0 || onMouseUp(event);
mouseDownRef.current = false;
};
// ====================== Focus Blur ======================
var onFormatFocus = function onFormatFocus(event) {
setFocused(true);
setFocusCellIndex(0);
setFocusCellText('');
onFocus(event);
};
var onSharedBlur = function onSharedBlur(event) {
onBlur(event);
};
var onFormatBlur = function onFormatBlur(event) {
setFocused(false);
onSharedBlur(event);
};
// ======================== Active ========================
// Check if blur need reset input value
useLockEffect(active, function () {
if (!active && !preserveInvalidOnBlur) {
setInputValue(value);
}
});
// ======================= Keyboard =======================
var onSharedKeyDown = function onSharedKeyDown(event) {
if (event.key === 'Enter' && validateFormat(inputValue)) {
onSubmit();
}
onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
};
var onFormatKeyDown = function onFormatKeyDown(event) {
// Block key input until selection is set (after mouseUp when focus was by mousedown)
if (mouseDownRef.current) {
event.preventDefault();
return;
}
onSharedKeyDown(event);
var key = event.key;
// Save the cache with cell text
var nextCellText = null;
// Fill in the input
var nextFillText = null;
var maskCellLen = selectionEnd - selectionStart;
var cellFormat = format.slice(selectionStart, selectionEnd);
// Cell Index
var offsetCellIndex = function offsetCellIndex(offset) {
setFocusCellIndex(function (idx) {
var nextIndex = idx + offset;
nextIndex = Math.max(nextIndex, 0);
nextIndex = Math.min(nextIndex, maskFormat.size() - 1);
return nextIndex;
});
};
// Range
var offsetCellValue = function offsetCellValue(offset) {
var _getMaskRange = getMaskRange(cellFormat),
_getMaskRange2 = Input_slicedToArray(_getMaskRange, 3),
rangeStart = _getMaskRange2[0],
rangeEnd = _getMaskRange2[1],
rangeDefault = _getMaskRange2[2];
var currentText = inputValue.slice(selectionStart, selectionEnd);
var currentTextNum = Number(currentText);
if (isNaN(currentTextNum)) {
return String(rangeDefault ? rangeDefault : offset > 0 ? rangeStart : rangeEnd);
}
var num = currentTextNum + offset;
var range = rangeEnd - rangeStart + 1;
return String(rangeStart + (range + num - rangeStart) % range);
};
switch (key) {
// =============== Remove ===============
case 'Backspace':
case 'Delete':
nextCellText = '';
nextFillText = cellFormat;
break;
// =============== Arrows ===============
// Left key
case 'ArrowLeft':
nextCellText = '';
offsetCellIndex(-1);
break;
// Right key
case 'ArrowRight':
nextCellText = '';
offsetCellIndex(1);
break;
// Up key
case 'ArrowUp':
nextCellText = '';
nextFillText = offsetCellValue(1);
break;
// Down key
case 'ArrowDown':
nextCellText = '';
nextFillText = offsetCellValue(-1);
break;
// =============== Number ===============
default:
if (!isNaN(Number(key))) {
nextCellText = focusCellText + key;
nextFillText = nextCellText;
}
break;
}
// Update cell text
if (nextCellText !== null) {
setFocusCellText(nextCellText);
if (nextCellText.length >= maskCellLen) {
// Go to next cell
offsetCellIndex(1);
setFocusCellText('');
}
}
// Update the input text
if (nextFillText !== null) {
// Replace selection range with `nextCellText`
var nextFocusValue =
// before
inputValue.slice(0, selectionStart) +
// replace
leftPad(nextFillText, maskCellLen) +
// after
inputValue.slice(selectionEnd);
triggerInputChange(nextFocusValue.slice(0, format.length));
}
// Always trigger selection sync after key down
forceSelectionSync({});
};
// ======================== Format ========================
var rafRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
(0,useLayoutEffect["default"])(function () {
if (!focused || !format || mouseDownRef.current) {
return;
}
// Reset with format if not match
if (!maskFormat.match(inputValue)) {
triggerInputChange(format);
return;
}
// Match the selection range
inputRef.current.setSelectionRange(selectionStart, selectionEnd);
// Chrome has the bug anchor position looks not correct but actually correct
rafRef.current = (0,raf["default"])(function () {
inputRef.current.setSelectionRange(selectionStart, selectionEnd);
});
return function () {
raf["default"].cancel(rafRef.current);
};
}, [maskFormat, format, focused, inputValue, focusCellIndex, selectionStart, selectionEnd, forceSelectionSyncMark, triggerInputChange]);
// ======================== Render ========================
// Input props for format
var inputProps = format ? {
onFocus: onFormatFocus,
onBlur: onFormatBlur,
onKeyDown: onFormatKeyDown,
onMouseDown: onFormatMouseDown,
onMouseUp: onFormatMouseUp,
onPaste: onFormatPaste
} : {};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: holderRef,
className: (0,clsx.clsx)(inputPrefixCls, Input_defineProperty(Input_defineProperty({}, "".concat(inputPrefixCls, "-active"), active && showActiveCls), "".concat(inputPrefixCls, "-placeholder"), helped), className)
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, Input_extends({
ref: inputRef,
"aria-invalid": invalid,
autoComplete: "off"
}, restProps, {
onKeyDown: onSharedKeyDown,
onBlur: onSharedBlur
// Replace with format
}, inputProps, {
// Value
value: inputValue,
onChange: onInternalChange,
className: classNames.input,
style: styles.input
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Icon_Icon, {
type: "suffix",
icon: suffixIcon
}), clearIcon);
});
if (true) {
Selector_Input_Input.displayName = 'Input';
}
/* harmony default export */ var Selector_Input = (Selector_Input_Input);
;// ./node_modules/@rc-component/picker/es/PickerInput/Selector/RangeSelector.js
var RangeSelector_excluded = ["id", "prefix", "clearIcon", "suffixIcon", "separator", "activeIndex", "activeHelp", "allHelp", "focused", "onFocus", "onBlur", "onKeyDown", "locale", "generateConfig", "placeholder", "className", "style", "onClick", "onClear", "value", "onChange", "onSubmit", "onInputChange", "format", "maskFormat", "preserveInvalidOnBlur", "onInvalid", "disabled", "invalid", "inputReadOnly", "direction", "onOpenChange", "onActiveInfo", "placement", "onMouseDown", "required", "aria-required", "autoFocus", "tabIndex"],
RangeSelector_excluded2 = ["index"];
function RangeSelector_extends() { RangeSelector_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return RangeSelector_extends.apply(this, arguments); }
function RangeSelector_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function RangeSelector_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? RangeSelector_ownKeys(Object(t), !0).forEach(function (r) { RangeSelector_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : RangeSelector_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function RangeSelector_defineProperty(obj, key, value) { key = RangeSelector_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function RangeSelector_toPropertyKey(t) { var i = RangeSelector_toPrimitive(t, "string"); return "symbol" == RangeSelector_typeof(i) ? i : String(i); }
function RangeSelector_toPrimitive(t, r) { if ("object" != RangeSelector_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != RangeSelector_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function RangeSelector_slicedToArray(arr, i) { return RangeSelector_arrayWithHoles(arr) || RangeSelector_iterableToArrayLimit(arr, i) || RangeSelector_unsupportedIterableToArray(arr, i) || RangeSelector_nonIterableRest(); }
function RangeSelector_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 RangeSelector_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return RangeSelector_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 RangeSelector_arrayLikeToArray(o, minLen); }
function RangeSelector_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 RangeSelector_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function RangeSelector_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function RangeSelector_typeof(o) { "@babel/helpers - typeof"; return RangeSelector_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, RangeSelector_typeof(o); }
function RangeSelector_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = RangeSelector_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 RangeSelector_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; }
function RangeSelector(props, ref) {
var id = props.id,
prefix = props.prefix,
clearIcon = props.clearIcon,
suffixIcon = props.suffixIcon,
_props$separator = props.separator,
separator = _props$separator === void 0 ? '~' : _props$separator,
activeIndex = props.activeIndex,
activeHelp = props.activeHelp,
allHelp = props.allHelp,
focused = props.focused,
onFocus = props.onFocus,
onBlur = props.onBlur,
onKeyDown = props.onKeyDown,
locale = props.locale,
generateConfig = props.generateConfig,
placeholder = props.placeholder,
className = props.className,
style = props.style,
onClick = props.onClick,
onClear = props.onClear,
value = props.value,
onChange = props.onChange,
onSubmit = props.onSubmit,
onInputChange = props.onInputChange,
format = props.format,
maskFormat = props.maskFormat,
preserveInvalidOnBlur = props.preserveInvalidOnBlur,
onInvalid = props.onInvalid,
disabled = props.disabled,
invalid = props.invalid,
inputReadOnly = props.inputReadOnly,
direction = props.direction,
onOpenChange = props.onOpenChange,
onActiveInfo = props.onActiveInfo,
placement = props.placement,
_onMouseDown = props.onMouseDown,
required = props.required,
ariaRequired = props['aria-required'],
autoFocus = props.autoFocus,
tabIndex = props.tabIndex,
restProps = RangeSelector_objectWithoutProperties(props, RangeSelector_excluded);
var rtl = direction === 'rtl';
// ======================== Prefix ========================
var _React$useContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PickerInput_context),
prefixCls = _React$useContext.prefixCls,
classNames = _React$useContext.classNames,
styles = _React$useContext.styles;
// ========================== Id ==========================
var ids = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
if (typeof id === 'string') {
return [id];
}
var mergedId = id || {};
return [mergedId.start, mergedId.end];
}, [id]);
// ========================= Refs =========================
var rootRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
var inputStartRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
var inputEndRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
var getInput = function getInput(index) {
var _index;
return (_index = [inputStartRef, inputEndRef][index]) === null || _index === void 0 ? void 0 : _index.current;
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, function () {
return {
nativeElement: rootRef.current,
focus: function focus(options) {
if (RangeSelector_typeof(options) === 'object') {
var _getInput;
var _ref = options || {},
_ref$index = _ref.index,
_index2 = _ref$index === void 0 ? 0 : _ref$index,
rest = RangeSelector_objectWithoutProperties(_ref, RangeSelector_excluded2);
(_getInput = getInput(_index2)) === null || _getInput === void 0 || _getInput.focus(rest);
} else {
var _getInput2;
(_getInput2 = getInput(options !== null && options !== void 0 ? options : 0)) === null || _getInput2 === void 0 || _getInput2.focus();
}
},
blur: function blur() {
var _getInput3, _getInput4;
(_getInput3 = getInput(0)) === null || _getInput3 === void 0 || _getInput3.blur();
(_getInput4 = getInput(1)) === null || _getInput4 === void 0 || _getInput4.blur();
}
};
});
// ======================== Props =========================
var rootProps = useRootProps(restProps);
// ===================== Placeholder ======================
var mergedPlaceholder = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return Array.isArray(placeholder) ? placeholder : [placeholder, placeholder];
}, [placeholder]);
// ======================== Inputs ========================
var _useInputProps = useInputProps(RangeSelector_objectSpread(RangeSelector_objectSpread({}, props), {}, {
id: ids,
placeholder: mergedPlaceholder
})),
_useInputProps2 = RangeSelector_slicedToArray(_useInputProps, 1),
getInputProps = _useInputProps2[0];
// ====================== ActiveBar =======================
var _React$useState = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState({
position: 'absolute',
width: 0
}),
_React$useState2 = RangeSelector_slicedToArray(_React$useState, 2),
activeBarStyle = _React$useState2[0],
setActiveBarStyle = _React$useState2[1];
var syncActiveOffset = (0,es.useEvent)(function () {
var input = getInput(activeIndex);
if (input) {
var inputRect = input.nativeElement.getBoundingClientRect();
var parentRect = rootRef.current.getBoundingClientRect();
var rectOffset = inputRect.left - parentRect.left;
setActiveBarStyle(function (ori) {
return RangeSelector_objectSpread(RangeSelector_objectSpread({}, ori), {}, {
width: inputRect.width,
left: rectOffset
});
});
onActiveInfo([inputRect.left, inputRect.right, parentRect.width]);
}
});
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(function () {
syncActiveOffset();
}, [activeIndex]);
// ======================== Clear =========================
var showClear = clearIcon && (value[0] && !disabled[0] || value[1] && !disabled[1]);
// ======================= Disabled =======================
var startAutoFocus = autoFocus && !disabled[0];
var endAutoFocus = autoFocus && !startAutoFocus && !disabled[1];
// ======================== Render ========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(resize_observer_es, {
onResize: syncActiveOffset
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", RangeSelector_extends({}, rootProps, {
className: (0,clsx.clsx)(prefixCls, "".concat(prefixCls, "-range"), RangeSelector_defineProperty(RangeSelector_defineProperty(RangeSelector_defineProperty(RangeSelector_defineProperty({}, "".concat(prefixCls, "-focused"), focused), "".concat(prefixCls, "-disabled"), disabled.every(function (i) {
return i;
})), "".concat(prefixCls, "-invalid"), invalid.some(function (i) {
return i;
})), "".concat(prefixCls, "-rtl"), rtl), className),
style: style,
ref: rootRef,
onClick: onClick
// Not lose current input focus
,
onMouseDown: function onMouseDown(e) {
var target = e.target;
if (target !== inputStartRef.current.inputElement && target !== inputEndRef.current.inputElement) {
e.preventDefault();
}
_onMouseDown === null || _onMouseDown === void 0 || _onMouseDown(e);
}
}), prefix && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)("".concat(prefixCls, "-prefix"), classNames.prefix),
style: styles.prefix
}, prefix), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Selector_Input, RangeSelector_extends({
ref: inputStartRef
}, getInputProps(0), {
className: "".concat(prefixCls, "-input-start"),
autoFocus: startAutoFocus,
tabIndex: tabIndex,
"date-range": "start"
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: "".concat(prefixCls, "-range-separator")
}, separator), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Selector_Input, RangeSelector_extends({
ref: inputEndRef
}, getInputProps(1), {
className: "".concat(prefixCls, "-input-end"),
autoFocus: endAutoFocus,
tabIndex: tabIndex,
"date-range": "end"
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: "".concat(prefixCls, "-active-bar"),
style: activeBarStyle
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Icon_Icon, {
type: "suffix",
icon: suffixIcon
}), showClear && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(ClearIcon, {
icon: clearIcon,
onClear: onClear
})));
}
var RefRangeSelector = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(RangeSelector);
if (true) {
RefRangeSelector.displayName = 'RangeSelector';
}
/* harmony default export */ var Selector_RangeSelector = (RefRangeSelector);
;// ./node_modules/@rc-component/picker/es/hooks/useSemantic.js
function useSemantic_typeof(o) { "@babel/helpers - typeof"; return useSemantic_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, useSemantic_typeof(o); }
function useSemantic_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function useSemantic_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? useSemantic_ownKeys(Object(t), !0).forEach(function (r) { useSemantic_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : useSemantic_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function useSemantic_defineProperty(obj, key, value) { key = useSemantic_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function useSemantic_toPropertyKey(t) { var i = useSemantic_toPrimitive(t, "string"); return "symbol" == useSemantic_typeof(i) ? i : String(i); }
function useSemantic_toPrimitive(t, r) { if ("object" != useSemantic_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != useSemantic_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
/**
* Convert `classNames` & `styles` to a fully filled object
*/
function useSemantic(classNames, styles) {
return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
var mergedClassNames = useSemantic_objectSpread(useSemantic_objectSpread({}, classNames), {}, {
popup: (classNames === null || classNames === void 0 ? void 0 : classNames.popup) || {}
});
var mergedStyles = useSemantic_objectSpread(useSemantic_objectSpread({}, styles), {}, {
popup: (styles === null || styles === void 0 ? void 0 : styles.popup) || {}
});
return [mergedClassNames, mergedStyles];
}, [classNames, styles]);
}
;// ./node_modules/@rc-component/picker/es/PickerInput/RangePicker.js
function RangePicker_typeof(o) { "@babel/helpers - typeof"; return RangePicker_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, RangePicker_typeof(o); }
function RangePicker_extends() { RangePicker_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return RangePicker_extends.apply(this, arguments); }
function RangePicker_toConsumableArray(arr) { return RangePicker_arrayWithoutHoles(arr) || RangePicker_iterableToArray(arr) || RangePicker_unsupportedIterableToArray(arr) || RangePicker_nonIterableSpread(); }
function RangePicker_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function RangePicker_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function RangePicker_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return RangePicker_arrayLikeToArray(arr); }
function RangePicker_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function RangePicker_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? RangePicker_ownKeys(Object(t), !0).forEach(function (r) { RangePicker_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : RangePicker_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function RangePicker_defineProperty(obj, key, value) { key = RangePicker_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function RangePicker_toPropertyKey(t) { var i = RangePicker_toPrimitive(t, "string"); return "symbol" == RangePicker_typeof(i) ? i : String(i); }
function RangePicker_toPrimitive(t, r) { if ("object" != RangePicker_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != RangePicker_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function RangePicker_slicedToArray(arr, i) { return RangePicker_arrayWithHoles(arr) || RangePicker_iterableToArrayLimit(arr, i) || RangePicker_unsupportedIterableToArray(arr, i) || RangePicker_nonIterableRest(); }
function RangePicker_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 RangePicker_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return RangePicker_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 RangePicker_arrayLikeToArray(o, minLen); }
function RangePicker_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 RangePicker_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function RangePicker_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function separateConfig(config, defaultConfig) {
var singleConfig = config !== null && config !== void 0 ? config : defaultConfig;
if (Array.isArray(singleConfig)) {
return singleConfig;
}
return [singleConfig, singleConfig];
}
/** Used for change event, it should always be not undefined */
function getActiveRange(activeIndex) {
return activeIndex === 1 ? 'end' : 'start';
}
function RangePicker(props, ref) {
// ========================= Prop =========================
var _useFilledProps = useFilledProps(props, function () {
var disabled = props.disabled,
allowEmpty = props.allowEmpty;
var mergedDisabled = separateConfig(disabled, false);
var mergedAllowEmpty = separateConfig(allowEmpty, false);
return {
disabled: mergedDisabled,
allowEmpty: mergedAllowEmpty
};
}),
_useFilledProps2 = RangePicker_slicedToArray(_useFilledProps, 6),
filledProps = _useFilledProps2[0],
internalPicker = _useFilledProps2[1],
complexPicker = _useFilledProps2[2],
formatList = _useFilledProps2[3],
maskFormat = _useFilledProps2[4],
isInvalidateDate = _useFilledProps2[5];
var prefixCls = filledProps.prefixCls,
rootClassName = filledProps.rootClassName,
propStyles = filledProps.styles,
propClassNames = filledProps.classNames,
previewValue = filledProps.previewValue,
defaultValue = filledProps.defaultValue,
value = filledProps.value,
needConfirm = filledProps.needConfirm,
onKeyDown = filledProps.onKeyDown,
disabled = filledProps.disabled,
allowEmpty = filledProps.allowEmpty,
disabledDate = filledProps.disabledDate,
minDate = filledProps.minDate,
maxDate = filledProps.maxDate,
defaultOpen = filledProps.defaultOpen,
open = filledProps.open,
onOpenChange = filledProps.onOpenChange,
locale = filledProps.locale,
generateConfig = filledProps.generateConfig,
picker = filledProps.picker,
showNow = filledProps.showNow,
showToday = filledProps.showToday,
showTime = filledProps.showTime,
mode = filledProps.mode,
onPanelChange = filledProps.onPanelChange,
onCalendarChange = filledProps.onCalendarChange,
onOk = filledProps.onOk,
defaultPickerValue = filledProps.defaultPickerValue,
pickerValue = filledProps.pickerValue,
onPickerValueChange = filledProps.onPickerValueChange,
inputReadOnly = filledProps.inputReadOnly,
suffixIcon = filledProps.suffixIcon,
onFocus = filledProps.onFocus,
onBlur = filledProps.onBlur,
presets = filledProps.presets,
ranges = filledProps.ranges,
components = filledProps.components,
cellRender = filledProps.cellRender,
dateRender = filledProps.dateRender,
monthCellRender = filledProps.monthCellRender,
onClick = filledProps.onClick;
// ========================= Refs =========================
var selectorRef = usePickerRef(ref);
// ======================= Semantic =======================
var _useSemantic = useSemantic(propClassNames, propStyles),
_useSemantic2 = RangePicker_slicedToArray(_useSemantic, 2),
mergedClassNames = _useSemantic2[0],
mergedStyles = _useSemantic2[1];
// ========================= Open =========================
var _useOpen = useOpen_useOpen(open, defaultOpen, disabled, onOpenChange),
_useOpen2 = RangePicker_slicedToArray(_useOpen, 2),
mergedOpen = _useOpen2[0],
setMergeOpen = _useOpen2[1];
var triggerOpen = function triggerOpen(nextOpen, config) {
// No need to open if all disabled
if (disabled.some(function (fieldDisabled) {
return !fieldDisabled;
}) || !nextOpen) {
setMergeOpen(nextOpen, config);
}
};
// ======================== Values ========================
var _useInnerValue = useInnerValue(generateConfig, locale, formatList, true, false, defaultValue, value, onCalendarChange, onOk),
_useInnerValue2 = RangePicker_slicedToArray(_useInnerValue, 5),
mergedValue = _useInnerValue2[0],
setInnerValue = _useInnerValue2[1],
getCalendarValue = _useInnerValue2[2],
triggerCalendarChange = _useInnerValue2[3],
triggerOk = _useInnerValue2[4];
var calendarValue = getCalendarValue();
// ======================== Active ========================
var _useRangeActive = useRangeActive(disabled, allowEmpty, mergedOpen),
_useRangeActive2 = RangePicker_slicedToArray(_useRangeActive, 9),
focused = _useRangeActive2[0],
triggerFocus = _useRangeActive2[1],
lastOperation = _useRangeActive2[2],
activeIndex = _useRangeActive2[3],
setActiveIndex = _useRangeActive2[4],
nextActiveIndex = _useRangeActive2[5],
activeIndexList = _useRangeActive2[6],
updateSubmitIndex = _useRangeActive2[7],
hasActiveSubmitValue = _useRangeActive2[8];
var onSharedFocus = function onSharedFocus(event, index) {
triggerFocus(true);
onFocus === null || onFocus === void 0 || onFocus(event, {
range: getActiveRange(index !== null && index !== void 0 ? index : activeIndex)
});
};
var onSharedBlur = function onSharedBlur(event, index) {
triggerFocus(false);
onBlur === null || onBlur === void 0 || onBlur(event, {
range: getActiveRange(index !== null && index !== void 0 ? index : activeIndex)
});
};
// ======================= ShowTime =======================
/** Used for Popup panel */
var mergedShowTime = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
if (!showTime) {
return null;
}
var disabledTime = showTime.disabledTime;
var proxyDisabledTime = disabledTime ? function (date) {
var range = getActiveRange(activeIndex);
var fromDate = getFromDate(calendarValue, activeIndexList, activeIndex);
return disabledTime(date, range, {
from: fromDate
});
} : undefined;
return RangePicker_objectSpread(RangePicker_objectSpread({}, showTime), {}, {
disabledTime: proxyDisabledTime
});
}, [showTime, activeIndex, calendarValue, activeIndexList]);
// ========================= Mode =========================
var _useControlledState = (0,es.useControlledState)([picker, picker], mode),
_useControlledState2 = RangePicker_slicedToArray(_useControlledState, 2),
modes = _useControlledState2[0],
setModes = _useControlledState2[1];
var mergedMode = modes[activeIndex] || picker;
/** Extends from `mergedMode` to patch `datetime` mode */
var internalMode = mergedMode === 'date' && mergedShowTime ? 'datetime' : mergedMode;
// ====================== PanelCount ======================
var multiplePanel = internalMode === picker && internalMode !== 'time';
// ======================= Show Now =======================
var mergedShowNow = useShowNow(picker, mergedMode, showNow, showToday, true);
// ======================== Value =========================
var _useRangeValue = useRangeValue(filledProps, mergedValue, setInnerValue, getCalendarValue, triggerCalendarChange, disabled, formatList, focused, mergedOpen, isInvalidateDate),
_useRangeValue2 = RangePicker_slicedToArray(_useRangeValue, 2),
/** Trigger `onChange` by check `disabledDate` */
flushSubmit = _useRangeValue2[0],
/** Trigger `onChange` directly without check `disabledDate` */
triggerSubmitChange = _useRangeValue2[1];
// ===================== DisabledDate =====================
var mergedDisabledDate = useRangeDisabledDate(calendarValue, disabled, activeIndexList, generateConfig, locale, disabledDate);
// ======================= Validate =======================
var _useFieldsInvalidate = useFieldsInvalidate(calendarValue, isInvalidateDate, allowEmpty),
_useFieldsInvalidate2 = RangePicker_slicedToArray(_useFieldsInvalidate, 2),
submitInvalidates = _useFieldsInvalidate2[0],
onSelectorInvalid = _useFieldsInvalidate2[1];
// ===================== Picker Value =====================
var _useRangePickerValue = useRangePickerValue(generateConfig, locale, calendarValue, modes, mergedOpen, activeIndex, internalPicker, multiplePanel, defaultPickerValue, pickerValue, mergedShowTime === null || mergedShowTime === void 0 ? void 0 : mergedShowTime.defaultOpenValue, onPickerValueChange, minDate, maxDate),
_useRangePickerValue2 = RangePicker_slicedToArray(_useRangePickerValue, 2),
currentPickerValue = _useRangePickerValue2[0],
setCurrentPickerValue = _useRangePickerValue2[1];
// >>> Mode need wait for `pickerValue`
var triggerModeChange = (0,es.useEvent)(function (nextPickerValue, nextMode, triggerEvent) {
var clone = fillIndex(modes, activeIndex, nextMode);
if (clone[0] !== modes[0] || clone[1] !== modes[1]) {
setModes(clone);
}
// Compatible with `onPanelChange`
if (onPanelChange && triggerEvent !== false) {
var clonePickerValue = RangePicker_toConsumableArray(calendarValue);
if (nextPickerValue) {
clonePickerValue[activeIndex] = nextPickerValue;
}
onPanelChange(clonePickerValue, clone);
}
});
// ======================== Change ========================
var fillCalendarValue = function fillCalendarValue(date, index) {
return (
// Trigger change only when date changed
fillIndex(calendarValue, index, date)
);
};
// ======================== Submit ========================
/**
* Trigger by confirm operation.
* This function has already handle the `needConfirm` check logic.
* - Selector: enter key
* - Panel: OK button
*/
var triggerPartConfirm = function triggerPartConfirm(date, skipFocus) {
var nextValue = calendarValue;
if (date) {
nextValue = fillCalendarValue(date, activeIndex);
}
updateSubmitIndex(activeIndex);
// Get next focus index
var nextIndex = nextActiveIndex(nextValue);
// Change calendar value and tell flush it
triggerCalendarChange(nextValue);
flushSubmit(activeIndex, nextIndex === null);
if (nextIndex === null) {
triggerOpen(false, {
force: true
});
} else if (!skipFocus) {
selectorRef.current.focus({
index: nextIndex
});
}
};
// ======================== Click =========================
var onSelectorClick = function onSelectorClick(event) {
var _activeElement;
var rootNode = event.target.getRootNode();
if (!selectorRef.current.nativeElement.contains((_activeElement = rootNode.activeElement) !== null && _activeElement !== void 0 ? _activeElement : document.activeElement)) {
// Click to focus the enabled input
var enabledIndex = disabled.findIndex(function (d) {
return !d;
});
if (enabledIndex >= 0) {
selectorRef.current.focus({
index: enabledIndex
});
}
}
triggerOpen(true);
onClick === null || onClick === void 0 || onClick(event);
};
var onSelectorClear = function onSelectorClear() {
triggerSubmitChange(null);
triggerOpen(false, {
force: true
});
};
// ======================== Hover =========================
var _React$useState = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null),
_React$useState2 = RangePicker_slicedToArray(_React$useState, 2),
hoverSource = _React$useState2[0],
setHoverSource = _React$useState2[1];
var _React$useState3 = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null),
_React$useState4 = RangePicker_slicedToArray(_React$useState3, 2),
internalHoverValues = _React$useState4[0],
setInternalHoverValues = _React$useState4[1];
var hoverValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return internalHoverValues || calendarValue;
}, [calendarValue, internalHoverValues]);
// Clean up `internalHoverValues` when closed
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(function () {
if (!mergedOpen) {
setInternalHoverValues(null);
}
}, [mergedOpen]);
// ========================================================
// == Panels ==
// ========================================================
// Save the offset with active bar position
// const [activeOffset, setActiveOffset] = React.useState(0);
var _React$useState5 = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([0, 0, 0]),
_React$useState6 = RangePicker_slicedToArray(_React$useState5, 2),
activeInfo = _React$useState6[0],
setActiveInfo = _React$useState6[1];
var onSetHover = function onSetHover(date, source) {
if (previewValue !== 'hover') {
return;
}
setInternalHoverValues(date);
setHoverSource(source);
};
// ======================= Presets ========================
var presetList = usePresets(presets, ranges);
var onPresetHover = function onPresetHover(nextValues) {
onSetHover(nextValues, 'preset');
};
var onPresetSubmit = function onPresetSubmit(nextValues) {
var passed = triggerSubmitChange(nextValues);
if (passed) {
lastOperation('preset-click');
triggerOpen(false, {
force: true
});
}
};
var onNow = function onNow(now) {
triggerPartConfirm(now);
};
// ======================== Panel =========================
var onPanelHover = function onPanelHover(date) {
onSetHover(date ? fillCalendarValue(date, activeIndex) : null, 'cell');
};
// >>> Focus
var onPanelFocus = function onPanelFocus(event) {
triggerOpen(true);
onSharedFocus(event);
};
// >>> MouseDown
var onPanelMouseDown = function onPanelMouseDown() {
lastOperation('panel');
};
// >>> Calendar
var onPanelSelect = function onPanelSelect(date) {
var clone = fillIndex(calendarValue, activeIndex, date);
// Only trigger calendar event but not update internal `calendarValue` state
triggerCalendarChange(clone);
// >>> Trigger next active if !needConfirm
// Fully logic check `useRangeValue` hook
if (!needConfirm && !complexPicker && internalPicker === internalMode) {
triggerPartConfirm(date);
}
};
// >>> Close
var onPopupClose = function onPopupClose() {
// Close popup
triggerOpen(false);
};
// >>> cellRender
var onInternalCellRender = useCellRender(cellRender, dateRender, monthCellRender, getActiveRange(activeIndex));
// >>> Value
var panelValue = calendarValue[activeIndex] || null;
// >>> invalid
var isPopupInvalidateDate = (0,es.useEvent)(function (date) {
return isInvalidateDate(date, {
activeIndex: activeIndex
});
});
var panelProps = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
var domProps = (0,pickAttrs["default"])(filledProps, false);
var restProps = (0,omit["default"])(filledProps, [].concat(RangePicker_toConsumableArray(Object.keys(domProps)), ['onChange', 'onCalendarChange', 'style', 'className', 'onPanelChange', 'disabledTime', 'classNames', 'styles']));
return restProps;
}, [filledProps]);
// >>> Render
var panel = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PickerInput_Popup_Popup, RangePicker_extends({}, panelProps, {
showNow: mergedShowNow,
showTime: mergedShowTime
// Range
,
range: true,
multiplePanel: multiplePanel,
activeInfo: activeInfo
// Disabled
,
disabledDate: mergedDisabledDate
// Focus
,
onFocus: onPanelFocus,
onBlur: onSharedBlur,
onPanelMouseDown: onPanelMouseDown
// Mode
,
picker: picker,
mode: mergedMode,
internalMode: internalMode,
onPanelChange: triggerModeChange
// Value
,
format: maskFormat,
value: panelValue,
isInvalid: isPopupInvalidateDate,
onChange: null,
onSelect: onPanelSelect
// PickerValue
,
pickerValue: currentPickerValue,
defaultOpenValue: miscUtil_toArray(showTime === null || showTime === void 0 ? void 0 : showTime.defaultOpenValue)[activeIndex],
onPickerValueChange: setCurrentPickerValue
// Hover
,
hoverValue: hoverValues,
onHover: onPanelHover
// Submit
,
needConfirm: needConfirm,
onSubmit: triggerPartConfirm,
onOk: triggerOk
// Preset
,
presets: presetList,
onPresetHover: onPresetHover,
onPresetSubmit: onPresetSubmit
// Now
,
onNow: onNow
// Render
,
cellRender: onInternalCellRender
// Styles
,
classNames: mergedClassNames,
styles: mergedStyles
}));
// ========================================================
// == Selector ==
// ========================================================
// ======================== Change ========================
var onSelectorChange = function onSelectorChange(date, index) {
var clone = fillCalendarValue(date, index);
triggerCalendarChange(clone);
};
var onSelectorInputChange = function onSelectorInputChange() {
lastOperation('input');
};
// ======================= Selector =======================
var onSelectorFocus = function onSelectorFocus(event, index) {
// Check if `needConfirm` but user not submit yet
var activeListLen = activeIndexList.length;
var lastActiveIndex = activeIndexList[activeListLen - 1];
if (activeListLen && lastActiveIndex !== index && needConfirm &&
// Not change index if is not filled
!allowEmpty[lastActiveIndex] && !hasActiveSubmitValue(lastActiveIndex) && calendarValue[lastActiveIndex]) {
selectorRef.current.focus({
index: lastActiveIndex
});
return;
}
lastOperation('input');
triggerOpen(true, {
inherit: true
});
// When click input to switch the field, it will not trigger close.
// Which means it will lose the part confirm and we need fill back.
// ref: https://github.com/ant-design/ant-design/issues/49512
if (activeIndex !== index && mergedOpen && !needConfirm && complexPicker) {
triggerPartConfirm(null, true);
}
setActiveIndex(index);
onSharedFocus(event, index);
};
var onSelectorBlur = function onSelectorBlur(event, index) {
triggerOpen(false);
if (!needConfirm && lastOperation() === 'input') {
var nextIndex = nextActiveIndex(calendarValue);
flushSubmit(activeIndex, nextIndex === null);
}
onSharedBlur(event, index);
};
var onSelectorKeyDown = function onSelectorKeyDown(event, preventDefault) {
if (event.key === 'Tab') {
triggerPartConfirm(null, true);
}
onKeyDown === null || onKeyDown === void 0 || onKeyDown(event, preventDefault);
};
// ======================= Context ========================
var context = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return {
prefixCls: prefixCls,
locale: locale,
generateConfig: generateConfig,
button: components.button,
input: components.input,
classNames: mergedClassNames,
styles: mergedStyles
};
}, [prefixCls, locale, generateConfig, components.button, components.input, mergedClassNames, mergedStyles]);
// ======================== Effect ========================
// >>> Mode
// Reset for every active
(0,useLayoutEffect["default"])(function () {
if (mergedOpen && activeIndex !== undefined) {
// Legacy compatible. This effect update should not trigger `onPanelChange`
triggerModeChange(null, picker, false);
}
}, [mergedOpen, activeIndex, picker]);
// >>> For complex picker, we need check if need to focus next one
(0,useLayoutEffect["default"])(function () {
var lastOp = lastOperation();
// Trade as confirm on field leave
if (!mergedOpen && lastOp === 'input') {
triggerOpen(false);
triggerPartConfirm(null, true);
}
// Submit with complex picker
if (!mergedOpen && complexPicker && !needConfirm && lastOp === 'panel') {
triggerOpen(true);
triggerPartConfirm();
}
}, [mergedOpen]);
// ====================== DevWarning ======================
if (true) {
var isIndexEmpty = function isIndexEmpty(index) {
return (
// Value is empty
!(value !== null && value !== void 0 && value[index]) &&
// DefaultValue is empty
!(defaultValue !== null && defaultValue !== void 0 && defaultValue[index])
);
};
if (disabled.some(function (fieldDisabled, index) {
return fieldDisabled && isIndexEmpty(index) && !allowEmpty[index];
})) {
(0,warning["default"])(false, '`disabled` should not set with empty `value`. You should set `allowEmpty` or `value` instead.');
}
}
// ======================== Render ========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PickerInput_context.Provider, {
value: context
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_PickerTrigger, RangePicker_extends({}, pickTriggerProps(filledProps), {
popupElement: panel,
popupStyle: mergedStyles.popup.root,
popupClassName: (0,clsx.clsx)(rootClassName, mergedClassNames.popup.root)
// Visible
,
visible: mergedOpen,
onClose: onPopupClose
// Range
,
range: true
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Selector_RangeSelector
// Shared
, RangePicker_extends({}, filledProps, {
// Ref
ref: selectorRef
// Style
,
className: (0,clsx.clsx)(filledProps.className, rootClassName, mergedClassNames.root),
style: RangePicker_objectSpread(RangePicker_objectSpread({}, mergedStyles.root), filledProps.style)
// Icon
,
suffixIcon: suffixIcon
// Active
,
activeIndex: focused || mergedOpen ? activeIndex : null,
activeHelp: !!internalHoverValues,
allHelp: !!internalHoverValues && hoverSource === 'preset',
focused: focused,
onFocus: onSelectorFocus,
onBlur: onSelectorBlur,
onKeyDown: onSelectorKeyDown,
onSubmit: triggerPartConfirm
// Change
,
value: hoverValues,
maskFormat: maskFormat,
onChange: onSelectorChange,
onInputChange: onSelectorInputChange
// Format
,
format: formatList,
inputReadOnly: inputReadOnly
// Disabled
,
disabled: disabled
// Open
,
open: mergedOpen,
onOpenChange: triggerOpen
// Click
,
onClick: onSelectorClick,
onClear: onSelectorClear
// Invalid
,
invalid: submitInvalidates,
onInvalid: onSelectorInvalid
// Offset
,
onActiveInfo: setActiveInfo
}))));
}
var RefRangePicker = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(RangePicker);
if (true) {
RefRangePicker.displayName = 'RefRangePicker';
}
/* harmony default export */ var PickerInput_RangePicker = (RefRangePicker);
;// ./node_modules/@rc-component/picker/es/PickerInput/Selector/SingleSelector/MultipleDates.js
function MultipleDates(props) {
var prefixCls = props.prefixCls,
value = props.value,
onRemove = props.onRemove,
_props$removeIcon = props.removeIcon,
removeIcon = _props$removeIcon === void 0 ? '×' : _props$removeIcon,
formatDate = props.formatDate,
disabled = props.disabled,
maxTagCount = props.maxTagCount,
placeholder = props.placeholder;
var selectorCls = "".concat(prefixCls, "-selector");
var selectionCls = "".concat(prefixCls, "-selection");
var overflowCls = "".concat(selectionCls, "-overflow");
// ========================= Item =========================
function renderSelector(content, onClose) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)("".concat(selectionCls, "-item")),
title: typeof content === 'string' ? content : null
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: "".concat(selectionCls, "-item-content")
}, content), !disabled && onClose && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
onMouseDown: function onMouseDown(e) {
e.preventDefault();
},
onClick: onClose,
className: "".concat(selectionCls, "-item-remove")
}, removeIcon));
}
function renderItem(date) {
var displayLabel = formatDate(date);
var onClose = function onClose(event) {
if (event) event.stopPropagation();
onRemove(date);
};
return renderSelector(displayLabel, onClose);
}
// ========================= Rest =========================
function renderRest(omittedValues) {
var content = "+ ".concat(omittedValues.length, " ...");
return renderSelector(content);
}
// ======================== Render ========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: selectorCls
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(overflow_es, {
prefixCls: overflowCls,
data: value,
renderItem: renderItem,
renderRest: renderRest
// suffix={inputNode}
,
itemKey: function itemKey(date) {
return formatDate(date);
},
maxCount: maxTagCount
}), !value.length && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: "".concat(prefixCls, "-selection-placeholder")
}, placeholder));
}
;// ./node_modules/@rc-component/picker/es/PickerInput/Selector/SingleSelector/index.js
function SingleSelector_typeof(o) { "@babel/helpers - typeof"; return SingleSelector_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, SingleSelector_typeof(o); }
var SingleSelector_excluded = ["id", "open", "prefix", "clearIcon", "suffixIcon", "activeHelp", "allHelp", "focused", "onFocus", "onBlur", "onKeyDown", "locale", "generateConfig", "placeholder", "className", "style", "onClick", "onClear", "internalPicker", "value", "onChange", "onSubmit", "onInputChange", "multiple", "maxTagCount", "format", "maskFormat", "preserveInvalidOnBlur", "onInvalid", "disabled", "invalid", "inputReadOnly", "direction", "onOpenChange", "onMouseDown", "required", "aria-required", "autoFocus", "tabIndex", "removeIcon"];
function SingleSelector_extends() { SingleSelector_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return SingleSelector_extends.apply(this, arguments); }
function SingleSelector_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function SingleSelector_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? SingleSelector_ownKeys(Object(t), !0).forEach(function (r) { SingleSelector_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : SingleSelector_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function SingleSelector_defineProperty(obj, key, value) { key = SingleSelector_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function SingleSelector_toPropertyKey(t) { var i = SingleSelector_toPrimitive(t, "string"); return "symbol" == SingleSelector_typeof(i) ? i : String(i); }
function SingleSelector_toPrimitive(t, r) { if ("object" != SingleSelector_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != SingleSelector_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function SingleSelector_slicedToArray(arr, i) { return SingleSelector_arrayWithHoles(arr) || SingleSelector_iterableToArrayLimit(arr, i) || SingleSelector_unsupportedIterableToArray(arr, i) || SingleSelector_nonIterableRest(); }
function SingleSelector_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 SingleSelector_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return SingleSelector_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 SingleSelector_arrayLikeToArray(o, minLen); }
function SingleSelector_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 SingleSelector_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function SingleSelector_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function SingleSelector_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = SingleSelector_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 SingleSelector_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; }
function SingleSelector(props, ref) {
var id = props.id,
open = props.open,
prefix = props.prefix,
clearIcon = props.clearIcon,
suffixIcon = props.suffixIcon,
activeHelp = props.activeHelp,
allHelp = props.allHelp,
focused = props.focused,
onFocus = props.onFocus,
onBlur = props.onBlur,
onKeyDown = props.onKeyDown,
locale = props.locale,
generateConfig = props.generateConfig,
placeholder = props.placeholder,
className = props.className,
style = props.style,
onClick = props.onClick,
onClear = props.onClear,
internalPicker = props.internalPicker,
value = props.value,
onChange = props.onChange,
onSubmit = props.onSubmit,
onInputChange = props.onInputChange,
multiple = props.multiple,
maxTagCount = props.maxTagCount,
format = props.format,
maskFormat = props.maskFormat,
preserveInvalidOnBlur = props.preserveInvalidOnBlur,
onInvalid = props.onInvalid,
disabled = props.disabled,
invalid = props.invalid,
inputReadOnly = props.inputReadOnly,
direction = props.direction,
onOpenChange = props.onOpenChange,
_onMouseDown = props.onMouseDown,
required = props.required,
ariaRequired = props['aria-required'],
autoFocus = props.autoFocus,
tabIndex = props.tabIndex,
removeIcon = props.removeIcon,
restProps = SingleSelector_objectWithoutProperties(props, SingleSelector_excluded);
var rtl = direction === 'rtl';
// ======================== Prefix ========================
var _React$useContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PickerInput_context),
prefixCls = _React$useContext.prefixCls,
classNames = _React$useContext.classNames,
styles = _React$useContext.styles;
// ========================= Refs =========================
var rootRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
var inputRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, function () {
return {
nativeElement: rootRef.current,
focus: function focus(options) {
var _inputRef$current;
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus(options);
},
blur: function blur() {
var _inputRef$current2;
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.blur();
}
};
});
// ======================== Props =========================
var rootProps = useRootProps(restProps);
// ======================== Change ========================
var onSingleChange = function onSingleChange(date) {
onChange([date]);
};
var onMultipleRemove = function onMultipleRemove(date) {
var nextValues = value.filter(function (oriDate) {
return oriDate && !isSame(generateConfig, locale, oriDate, date, internalPicker);
});
onChange(nextValues);
// When `open`, it means user is operating the
if (!open) {
onSubmit();
}
};
// ======================== Inputs ========================
var _useInputProps = useInputProps(SingleSelector_objectSpread(SingleSelector_objectSpread({}, props), {}, {
onChange: onSingleChange
}), function (_ref) {
var valueTexts = _ref.valueTexts;
return {
value: valueTexts[0] || '',
active: focused
};
}),
_useInputProps2 = SingleSelector_slicedToArray(_useInputProps, 2),
getInputProps = _useInputProps2[0],
getText = _useInputProps2[1];
// ======================== Clear =========================
var showClear = !!(clearIcon && value.length && !disabled);
// ======================= Multiple =======================
var selectorNode = multiple ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(MultipleDates, {
prefixCls: prefixCls,
value: value,
onRemove: onMultipleRemove,
formatDate: getText,
maxTagCount: maxTagCount,
disabled: disabled,
removeIcon: removeIcon,
placeholder: placeholder
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("input", {
className: "".concat(prefixCls, "-multiple-input"),
value: value.map(getText).join(','),
ref: inputRef,
readOnly: true,
autoFocus: autoFocus,
tabIndex: tabIndex
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Icon_Icon, {
type: "suffix",
icon: suffixIcon
}), showClear && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(ClearIcon, {
icon: clearIcon,
onClear: onClear
})) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Selector_Input, SingleSelector_extends({
ref: inputRef
}, getInputProps(), {
autoFocus: autoFocus,
tabIndex: tabIndex,
suffixIcon: suffixIcon,
clearIcon: showClear && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(ClearIcon, {
icon: clearIcon,
onClear: onClear
}),
showActiveCls: false
}));
// ======================== Render ========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", SingleSelector_extends({}, rootProps, {
className: (0,clsx.clsx)(prefixCls, SingleSelector_defineProperty(SingleSelector_defineProperty(SingleSelector_defineProperty(SingleSelector_defineProperty(SingleSelector_defineProperty({}, "".concat(prefixCls, "-multiple"), multiple), "".concat(prefixCls, "-focused"), focused), "".concat(prefixCls, "-disabled"), disabled), "".concat(prefixCls, "-invalid"), invalid), "".concat(prefixCls, "-rtl"), rtl), className),
style: style,
ref: rootRef,
onClick: onClick
// Not lose current input focus
,
onMouseDown: function onMouseDown(e) {
var _inputRef$current3;
var target = e.target;
if (target !== ((_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.inputElement)) {
e.preventDefault();
}
_onMouseDown === null || _onMouseDown === void 0 || _onMouseDown(e);
}
}), prefix && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)("".concat(prefixCls, "-prefix"), classNames.prefix),
style: styles.prefix
}, prefix), selectorNode);
}
var RefSingleSelector = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(SingleSelector);
if (true) {
RefSingleSelector.displayName = 'SingleSelector';
}
/* harmony default export */ var Selector_SingleSelector = (RefSingleSelector);
;// ./node_modules/@rc-component/picker/es/PickerInput/SinglePicker.js
function SinglePicker_typeof(o) { "@babel/helpers - typeof"; return SinglePicker_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, SinglePicker_typeof(o); }
function SinglePicker_extends() { SinglePicker_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return SinglePicker_extends.apply(this, arguments); }
function SinglePicker_toConsumableArray(arr) { return SinglePicker_arrayWithoutHoles(arr) || SinglePicker_iterableToArray(arr) || SinglePicker_unsupportedIterableToArray(arr) || SinglePicker_nonIterableSpread(); }
function SinglePicker_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function SinglePicker_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function SinglePicker_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return SinglePicker_arrayLikeToArray(arr); }
function SinglePicker_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function SinglePicker_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? SinglePicker_ownKeys(Object(t), !0).forEach(function (r) { SinglePicker_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : SinglePicker_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function SinglePicker_defineProperty(obj, key, value) { key = SinglePicker_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function SinglePicker_toPropertyKey(t) { var i = SinglePicker_toPrimitive(t, "string"); return "symbol" == SinglePicker_typeof(i) ? i : String(i); }
function SinglePicker_toPrimitive(t, r) { if ("object" != SinglePicker_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != SinglePicker_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function SinglePicker_slicedToArray(arr, i) { return SinglePicker_arrayWithHoles(arr) || SinglePicker_iterableToArrayLimit(arr, i) || SinglePicker_unsupportedIterableToArray(arr, i) || SinglePicker_nonIterableRest(); }
function SinglePicker_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 SinglePicker_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return SinglePicker_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 SinglePicker_arrayLikeToArray(o, minLen); }
function SinglePicker_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 SinglePicker_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function SinglePicker_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
// TODO: isInvalidateDate with showTime.disabledTime should not provide `range` prop
/** Internal usage. For cross function get same aligned props */
function Picker(props, ref) {
// ========================= Prop =========================
var _useFilledProps = useFilledProps(props),
_useFilledProps2 = SinglePicker_slicedToArray(_useFilledProps, 6),
filledProps = _useFilledProps2[0],
internalPicker = _useFilledProps2[1],
complexPicker = _useFilledProps2[2],
formatList = _useFilledProps2[3],
maskFormat = _useFilledProps2[4],
isInvalidateDate = _useFilledProps2[5];
var _ref = filledProps,
prefixCls = _ref.prefixCls,
rootClassName = _ref.rootClassName,
propStyles = _ref.styles,
propClassNames = _ref.classNames,
previewValue = _ref.previewValue,
order = _ref.order,
defaultValue = _ref.defaultValue,
value = _ref.value,
needConfirm = _ref.needConfirm,
onChange = _ref.onChange,
onKeyDown = _ref.onKeyDown,
disabled = _ref.disabled,
disabledDate = _ref.disabledDate,
minDate = _ref.minDate,
maxDate = _ref.maxDate,
defaultOpen = _ref.defaultOpen,
open = _ref.open,
onOpenChange = _ref.onOpenChange,
locale = _ref.locale,
generateConfig = _ref.generateConfig,
picker = _ref.picker,
showNow = _ref.showNow,
showToday = _ref.showToday,
showTime = _ref.showTime,
mode = _ref.mode,
onPanelChange = _ref.onPanelChange,
onCalendarChange = _ref.onCalendarChange,
onOk = _ref.onOk,
multiple = _ref.multiple,
defaultPickerValue = _ref.defaultPickerValue,
pickerValue = _ref.pickerValue,
onPickerValueChange = _ref.onPickerValueChange,
inputReadOnly = _ref.inputReadOnly,
suffixIcon = _ref.suffixIcon,
removeIcon = _ref.removeIcon,
onFocus = _ref.onFocus,
onBlur = _ref.onBlur,
presets = _ref.presets,
components = _ref.components,
cellRender = _ref.cellRender,
dateRender = _ref.dateRender,
monthCellRender = _ref.monthCellRender,
onClick = _ref.onClick;
// ========================= Refs =========================
var selectorRef = usePickerRef(ref);
// ========================= Util =========================
function pickerParam(values) {
if (values === null) {
return null;
}
return multiple ? values : values[0];
}
var toggleDates = useToggleDates(generateConfig, locale, internalPicker);
// ======================= Semantic =======================
var _useSemantic = useSemantic(propClassNames, propStyles),
_useSemantic2 = SinglePicker_slicedToArray(_useSemantic, 2),
mergedClassNames = _useSemantic2[0],
mergedStyles = _useSemantic2[1];
// ========================= Open =========================
var _useOpen = useOpen_useOpen(open, defaultOpen, [disabled], onOpenChange),
_useOpen2 = SinglePicker_slicedToArray(_useOpen, 2),
mergedOpen = _useOpen2[0],
triggerOpen = _useOpen2[1];
// ======================= Calendar =======================
var onInternalCalendarChange = function onInternalCalendarChange(dates, dateStrings, info) {
if (onCalendarChange) {
var filteredInfo = SinglePicker_objectSpread({}, info);
delete filteredInfo.range;
onCalendarChange(pickerParam(dates), pickerParam(dateStrings), filteredInfo);
}
};
var onInternalOk = function onInternalOk(dates) {
onOk === null || onOk === void 0 || onOk(pickerParam(dates));
};
// ======================== Values ========================
var _useInnerValue = useInnerValue(generateConfig, locale, formatList, false, order, defaultValue, value, onInternalCalendarChange, onInternalOk),
_useInnerValue2 = SinglePicker_slicedToArray(_useInnerValue, 5),
mergedValue = _useInnerValue2[0],
setInnerValue = _useInnerValue2[1],
getCalendarValue = _useInnerValue2[2],
triggerCalendarChange = _useInnerValue2[3],
triggerOk = _useInnerValue2[4];
var calendarValue = getCalendarValue();
// ======================== Active ========================
// In SinglePicker, we will always get `activeIndex` is 0.
var _useRangeActive = useRangeActive([disabled]),
_useRangeActive2 = SinglePicker_slicedToArray(_useRangeActive, 4),
focused = _useRangeActive2[0],
triggerFocus = _useRangeActive2[1],
lastOperation = _useRangeActive2[2],
activeIndex = _useRangeActive2[3];
var onSharedFocus = function onSharedFocus(event) {
triggerFocus(true);
onFocus === null || onFocus === void 0 || onFocus(event, {});
};
var onSharedBlur = function onSharedBlur(event) {
triggerFocus(false);
onBlur === null || onBlur === void 0 || onBlur(event, {});
};
// ========================= Mode =========================
var _useControlledState = (0,es.useControlledState)(picker, mode),
_useControlledState2 = SinglePicker_slicedToArray(_useControlledState, 2),
mergedMode = _useControlledState2[0],
setMode = _useControlledState2[1];
/** Extends from `mergedMode` to patch `datetime` mode */
var internalMode = mergedMode === 'date' && showTime ? 'datetime' : mergedMode;
// ======================= Show Now =======================
var mergedShowNow = useShowNow(picker, mergedMode, showNow, showToday);
// ======================== Value =========================
var onInternalChange = onChange && function (dates, dateStrings) {
onChange(pickerParam(dates), pickerParam(dateStrings));
};
var _useRangeValue = useRangeValue(SinglePicker_objectSpread(SinglePicker_objectSpread({}, filledProps), {}, {
onChange: onInternalChange
}), mergedValue, setInnerValue, getCalendarValue, triggerCalendarChange, [],
//disabled,
formatList, focused, mergedOpen, isInvalidateDate),
_useRangeValue2 = SinglePicker_slicedToArray(_useRangeValue, 2),
/** Trigger `onChange` directly without check `disabledDate` */
triggerSubmitChange = _useRangeValue2[1];
// ======================= Validate =======================
var _useFieldsInvalidate = useFieldsInvalidate(calendarValue, isInvalidateDate),
_useFieldsInvalidate2 = SinglePicker_slicedToArray(_useFieldsInvalidate, 2),
submitInvalidates = _useFieldsInvalidate2[0],
onSelectorInvalid = _useFieldsInvalidate2[1];
var submitInvalidate = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return submitInvalidates.some(function (invalidated) {
return invalidated;
});
}, [submitInvalidates]);
// ===================== Picker Value =====================
// Proxy to single pickerValue
var onInternalPickerValueChange = function onInternalPickerValueChange(dates, info) {
if (onPickerValueChange) {
var cleanInfo = SinglePicker_objectSpread(SinglePicker_objectSpread({}, info), {}, {
mode: info.mode[0]
});
delete cleanInfo.range;
onPickerValueChange(dates[0], cleanInfo);
}
};
var _useRangePickerValue = useRangePickerValue(generateConfig, locale, calendarValue, [mergedMode], mergedOpen, activeIndex, internalPicker, false,
// multiplePanel,
defaultPickerValue, pickerValue, miscUtil_toArray(showTime === null || showTime === void 0 ? void 0 : showTime.defaultOpenValue), onInternalPickerValueChange, minDate, maxDate),
_useRangePickerValue2 = SinglePicker_slicedToArray(_useRangePickerValue, 2),
currentPickerValue = _useRangePickerValue2[0],
setCurrentPickerValue = _useRangePickerValue2[1];
// >>> Mode need wait for `pickerValue`
var triggerModeChange = (0,es.useEvent)(function (nextPickerValue, nextMode, triggerEvent) {
setMode(nextMode);
// Compatible with `onPanelChange`
if (onPanelChange && triggerEvent !== false) {
var lastPickerValue = nextPickerValue || calendarValue[calendarValue.length - 1];
onPanelChange(lastPickerValue, nextMode);
}
});
// ======================== Submit ========================
/**
* Different with RangePicker, confirm should check `multiple` logic.
* This will never provide `date` instead.
*/
var triggerConfirm = function triggerConfirm() {
triggerSubmitChange(getCalendarValue());
triggerOpen(false, {
force: true
});
};
// ======================== Click =========================
var onSelectorClick = function onSelectorClick(event) {
if (!disabled && !selectorRef.current.nativeElement.contains(document.activeElement)) {
// Click to focus the enabled input
selectorRef.current.focus();
}
triggerOpen(true);
onClick === null || onClick === void 0 || onClick(event);
};
var onSelectorClear = function onSelectorClear() {
triggerSubmitChange(null);
triggerOpen(false, {
force: true
});
};
// ======================== Hover =========================
var _React$useState = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null),
_React$useState2 = SinglePicker_slicedToArray(_React$useState, 2),
hoverSource = _React$useState2[0],
setHoverSource = _React$useState2[1];
var _React$useState3 = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null),
_React$useState4 = SinglePicker_slicedToArray(_React$useState3, 2),
internalHoverValue = _React$useState4[0],
setInternalHoverValue = _React$useState4[1];
var hoverValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
var values = [internalHoverValue].concat(SinglePicker_toConsumableArray(calendarValue)).filter(function (date) {
return date;
});
return multiple ? values : values.slice(0, 1);
}, [calendarValue, internalHoverValue, multiple]);
// Selector values is different with RangePicker
// which can not use `hoverValue` directly
var selectorValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
if (!multiple && internalHoverValue) {
return [internalHoverValue];
}
return calendarValue.filter(function (date) {
return date;
});
}, [calendarValue, internalHoverValue, multiple]);
// Clean up `internalHoverValues` when closed
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(function () {
if (!mergedOpen) {
setInternalHoverValue(null);
}
}, [mergedOpen]);
var onSetHover = function onSetHover(date, source) {
if (previewValue !== 'hover') {
return;
}
setInternalHoverValue(date);
setHoverSource(source);
};
// ========================================================
// == Panels ==
// ========================================================
// ======================= Presets ========================
var presetList = usePresets(presets);
var onPresetHover = function onPresetHover(nextValue) {
onSetHover(nextValue, 'preset');
};
// TODO: handle this
var onPresetSubmit = function onPresetSubmit(nextValue) {
var nextCalendarValues = multiple ? toggleDates(getCalendarValue(), nextValue) : [nextValue];
var passed = triggerSubmitChange(nextCalendarValues);
if (passed && !multiple) {
triggerOpen(false, {
force: true
});
}
};
var onNow = function onNow(now) {
onPresetSubmit(now);
};
// ======================== Panel =========================
var onPanelHover = function onPanelHover(date) {
onSetHover(date, 'cell');
};
// >>> Focus
var onPanelFocus = function onPanelFocus(event) {
triggerOpen(true);
onSharedFocus(event);
};
// >>> Calendar
var onPanelSelect = function onPanelSelect(date) {
lastOperation('panel');
// Not change values if multiple and current panel is to match with picker
if (multiple && internalMode !== picker) {
return;
}
var nextValues = multiple ? toggleDates(getCalendarValue(), date) : [date];
// Only trigger calendar event but not update internal `calendarValue` state
triggerCalendarChange(nextValues);
// >>> Trigger next active if !needConfirm
// Fully logic check `useRangeValue` hook
if (!needConfirm && !complexPicker && internalPicker === internalMode) {
triggerConfirm();
}
};
// >>> Close
var onPopupClose = function onPopupClose() {
// Close popup
triggerOpen(false);
};
// >>> cellRender
var onInternalCellRender = useCellRender(cellRender, dateRender, monthCellRender);
// >>> invalid
var panelProps = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
var domProps = (0,pickAttrs["default"])(filledProps, false);
var restProps = (0,omit["default"])(filledProps, [].concat(SinglePicker_toConsumableArray(Object.keys(domProps)), ['onChange', 'onCalendarChange', 'style', 'className', 'onPanelChange', 'classNames', 'styles']));
return SinglePicker_objectSpread(SinglePicker_objectSpread({}, restProps), {}, {
multiple: filledProps.multiple
});
}, [filledProps]);
// >>> Render
var panel = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PickerInput_Popup_Popup, SinglePicker_extends({}, panelProps, {
showNow: mergedShowNow,
showTime: showTime
// Disabled
,
disabledDate: disabledDate
// Focus
,
onFocus: onPanelFocus,
onBlur: onSharedBlur
// Mode
,
picker: picker,
mode: mergedMode,
internalMode: internalMode,
onPanelChange: triggerModeChange
// Value
,
format: maskFormat,
value: calendarValue,
isInvalid: isInvalidateDate,
onChange: null,
onSelect: onPanelSelect
// PickerValue
,
pickerValue: currentPickerValue,
defaultOpenValue: showTime === null || showTime === void 0 ? void 0 : showTime.defaultOpenValue,
onPickerValueChange: setCurrentPickerValue
// Hover
,
hoverValue: hoverValues,
onHover: onPanelHover
// Submit
,
needConfirm: needConfirm,
onSubmit: triggerConfirm,
onOk: triggerOk
// Preset
,
presets: presetList,
onPresetHover: onPresetHover,
onPresetSubmit: onPresetSubmit,
onNow: onNow
// Render
,
cellRender: onInternalCellRender
// Styles
,
classNames: mergedClassNames,
styles: mergedStyles
}));
// ========================================================
// == Selector ==
// ========================================================
// ======================== Change ========================
var onSelectorChange = function onSelectorChange(date) {
triggerCalendarChange(date);
};
var onSelectorInputChange = function onSelectorInputChange() {
lastOperation('input');
};
// ======================= Selector =======================
var onSelectorFocus = function onSelectorFocus(event) {
lastOperation('input');
triggerOpen(true, {
inherit: true
});
// setActiveIndex(index);
onSharedFocus(event);
};
var onSelectorBlur = function onSelectorBlur(event) {
triggerOpen(false);
onSharedBlur(event);
};
var onSelectorKeyDown = function onSelectorKeyDown(event, preventDefault) {
if (event.key === 'Tab') {
triggerConfirm();
}
onKeyDown === null || onKeyDown === void 0 || onKeyDown(event, preventDefault);
};
// ======================= Context ========================
var context = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(function () {
return {
prefixCls: prefixCls,
locale: locale,
generateConfig: generateConfig,
button: components.button,
input: components.input,
classNames: mergedClassNames,
styles: mergedStyles
};
}, [prefixCls, locale, generateConfig, components.button, components.input, mergedClassNames, mergedStyles]);
// ======================== Effect ========================
// >>> Mode
// Reset for every active
(0,useLayoutEffect["default"])(function () {
if (mergedOpen && activeIndex !== undefined) {
// Legacy compatible. This effect update should not trigger `onPanelChange`
triggerModeChange(null, picker, false);
}
}, [mergedOpen, activeIndex, picker]);
// >>> For complex picker, we need check if need to focus next one
(0,useLayoutEffect["default"])(function () {
var lastOp = lastOperation();
// Trade as confirm on field leave
if (!mergedOpen && lastOp === 'input') {
triggerOpen(false);
triggerConfirm();
}
// Submit with complex picker
if (!mergedOpen && complexPicker && !needConfirm && lastOp === 'panel') {
triggerConfirm();
}
}, [mergedOpen]);
// ======================== Render ========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PickerInput_context.Provider, {
value: context
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_PickerTrigger, SinglePicker_extends({}, pickTriggerProps(filledProps), {
popupElement: panel,
popupStyle: mergedStyles.popup.root,
popupClassName: (0,clsx.clsx)(rootClassName, mergedClassNames.popup.root)
// Visible
,
visible: mergedOpen,
onClose: onPopupClose
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Selector_SingleSelector
// Shared
, SinglePicker_extends({}, filledProps, {
// Ref
ref: selectorRef
// Style
,
className: (0,clsx.clsx)(filledProps.className, rootClassName, mergedClassNames.root),
style: SinglePicker_objectSpread(SinglePicker_objectSpread({}, mergedStyles.root), filledProps.style)
// Icon
,
suffixIcon: suffixIcon,
removeIcon: removeIcon
// Active
,
activeHelp: !!internalHoverValue,
allHelp: !!internalHoverValue && hoverSource === 'preset',
focused: focused,
onFocus: onSelectorFocus,
onBlur: onSelectorBlur,
onKeyDown: onSelectorKeyDown,
onSubmit: triggerConfirm
// Change
,
value: selectorValues,
maskFormat: maskFormat,
onChange: onSelectorChange,
onInputChange: onSelectorInputChange,
internalPicker: internalPicker
// Format
,
format: formatList,
inputReadOnly: inputReadOnly
// Disabled
,
disabled: disabled
// Open
,
open: mergedOpen,
onOpenChange: triggerOpen
// Click
,
onClick: onSelectorClick,
onClear: onSelectorClear
// Invalid
,
invalid: submitInvalidate,
onInvalid: function onInvalid(invalid) {
// Only `single` mode support type date.
// `multiple` mode can not typing.
onSelectorInvalid(invalid, 0);
}
}))));
}
var RefPicker = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(Picker);
if (true) {
RefPicker.displayName = 'RefPicker';
}
/* harmony default export */ var SinglePicker = (RefPicker);
;// ./node_modules/@rc-component/picker/es/index.js
/**
* What's new?
* - Common
* - [Break] Support special year format, all the year will follow the locale config.
* - Blur all of field will trigger `onChange` if validate
* - Support `preserveInvalidOnBlur` to not to clean input if invalid and remove `changeOnBlur`
* - `pickerValue` is now full controlled
* - `defaultPickerValue` will take effect on every field active with popup opening.
* - [Break] clear button return the event with `onClick`
*
* - Locale
* - Remove `dateFormat` since it's never used
* - Remove `dateTimeFormat` since it's never used
*
* - Picker
* - TimePicker support `changeOnScroll`
* - TimePicker support `millisecond`
* - Support cellMeridiemFormat for AM/PM
* - Get correct `disabledHours` when set `use12Hours`
* - Support `showWeek`
*
* - RangePicker
* - [Break] RangePicker is now not limit the range of clicked field.
* - Trigger `onCalendarChange` when type correct
* - [Break] Not order `value` if given `value` is wrong order.
* - Hover `presets` will show date in input field.
* - [Break] RangePicker go to end field, `pickerValue` will follow the start field if not controlled.
*/
/* harmony default export */ var picker_es = (SinglePicker);
;// ./components/form/util.ts
// form item name black list. in form ,you can use form.id get the form item element.
// use object hasOwnProperty will get better performance if black list is longer.
const formItemNameBlackList = ['parentNode'];
// default form item id prefix.
const defaultItemNamePrefixCls = 'form_item';
function util_toArray(candidate) {
if (candidate === undefined || candidate === false) {
return [];
}
return Array.isArray(candidate) ? candidate : [candidate];
}
function getFieldId(namePath, formName) {
if (!namePath.length) {
return undefined;
}
const mergedId = namePath.join('_');
if (formName) {
return `${formName}_${mergedId}`;
}
const isIllegalName = formItemNameBlackList.includes(mergedId);
return isIllegalName ? `${defaultItemNamePrefixCls}_${mergedId}` : mergedId;
}
/**
* Get merged status by meta or passed `validateStatus`.
*/
function getStatus(errors, warnings, meta, defaultValidateStatus, hasFeedback, validateStatus) {
let status = defaultValidateStatus;
if (validateStatus !== undefined) {
status = validateStatus;
} else if (meta.validating) {
status = 'validating';
} else if (errors.length) {
status = 'error';
} else if (warnings.length) {
status = 'warning';
} else if (meta.touched || hasFeedback && meta.validated) {
// success feedback should display when pass hasFeedback prop and current value is valid value
status = 'success';
}
return status;
}
;// ./components/form/hooks/useForm.ts
function toNamePathStr(name) {
const namePath = util_toArray(name);
return namePath.join('_');
}
function getFieldDOMNode(name, wrapForm) {
const field = wrapForm.getFieldInstance(name);
const fieldDom = (0,findDOMNode.getDOM)(field);
if (fieldDom) {
return fieldDom;
}
const fieldId = getFieldId(util_toArray(name), wrapForm.__INTERNAL__.name);
if (fieldId) {
return document.getElementById(fieldId);
}
}
function useForm_useForm(form) {
const [rcForm] = hooks_useForm();
const itemsRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({});
const wrapForm = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => form ?? {
...rcForm,
__INTERNAL__: {
itemRef: name => node => {
const namePathStr = toNamePathStr(name);
if (node) {
itemsRef.current[namePathStr] = node;
} else {
delete itemsRef.current[namePathStr];
}
}
},
scrollToField: (name, options = {}) => {
const {
focus,
...restOpt
} = options;
const node = getFieldDOMNode(name, wrapForm);
if (node) {
dist_e(node, {
scrollMode: 'if-needed',
block: 'nearest',
...restOpt
});
// Focus if scroll success
if (focus) {
wrapForm.focusField(name);
}
}
},
focusField: name => {
const itemRef = wrapForm.getFieldInstance(name);
if (typeof itemRef?.focus === 'function') {
itemRef.focus();
} else {
getFieldDOMNode(name, wrapForm)?.focus?.();
}
},
getFieldInstance: name => {
const namePathStr = toNamePathStr(name);
return itemsRef.current[namePathStr];
}
}, [form, rcForm]);
return [wrapForm];
}
;// ./components/radio/context.ts
const RadioGroupContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(undefined);
const RadioGroupContextProvider = RadioGroupContext.Provider;
/* harmony default export */ var radio_context = (RadioGroupContext);
const RadioOptionTypeContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(undefined);
const RadioOptionTypeContextProvider = RadioOptionTypeContext.Provider;
;// ./node_modules/@rc-component/checkbox/es/index.js
function es_extends() { es_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return es_extends.apply(this, arguments); }
const Checkbox = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((props, ref) => {
const {
prefixCls = 'rc-checkbox',
className,
style,
checked,
disabled,
defaultChecked = false,
type = 'checkbox',
title,
onChange,
...inputProps
} = props;
const inputRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const holderRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const [rawValue, setRawValue] = (0,useControlledState["default"])(defaultChecked, checked);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref, () => ({
focus: options => {
inputRef.current?.focus(options);
},
blur: () => {
inputRef.current?.blur();
},
input: inputRef.current,
nativeElement: holderRef.current
}));
const classString = (0,clsx.clsx)(prefixCls, className, {
[`${prefixCls}-checked`]: rawValue,
[`${prefixCls}-disabled`]: disabled
});
const handleChange = e => {
if (disabled) {
return;
}
if (!('checked' in props)) {
setRawValue(e.target.checked);
}
onChange?.({
target: {
...props,
type,
checked: e.target.checked
},
stopPropagation() {
e.stopPropagation();
},
preventDefault() {
e.preventDefault();
},
nativeEvent: e.nativeEvent
});
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: classString,
title: title,
style: style,
ref: holderRef
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("input", es_extends({}, inputProps, {
className: `${prefixCls}-input`,
ref: inputRef,
onChange: handleChange,
disabled: disabled,
checked: !!rawValue,
type: type
})));
});
/* harmony default export */ var checkbox_es = (Checkbox);
;// ./components/checkbox/useBubbleLock.ts
/**
* When click on the label,
* the event will be stopped to prevent the label from being clicked twice.
* label click -> input click -> label click again
*/
function useBubbleLock(onOriginInputClick) {
const labelClickLockRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
const clearLock = () => {
raf["default"].cancel(labelClickLockRef.current);
labelClickLockRef.current = null;
};
const onLabelClick = () => {
clearLock();
labelClickLockRef.current = (0,raf["default"])(() => {
labelClickLockRef.current = null;
});
};
const onInputClick = e => {
if (labelClickLockRef.current) {
e.stopPropagation();
clearLock();
}
onOriginInputClick?.(e);
};
return [onLabelClick, onInputClick];
}
// EXTERNAL MODULE: ./components/radio/style/index.ts
var radio_style = __webpack_require__("./components/radio/style/index.ts");
;// ./components/radio/radio.tsx
const InternalRadio = (props, ref) => {
const groupContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(radio_context);
const radioOptionTypeContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(RadioOptionTypeContext);
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('radio');
const innerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const mergedRef = (0,es_ref.composeRef)(ref, innerRef);
const {
isFormItemInput
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FormItemInputContext);
if (true) {
const warning = (0,_util_warning.devUseWarning)('Radio');
true ? warning(!('optionType' in props), 'usage', '`optionType` is only support in Radio.Group.') : 0;
}
const onChange = e => {
props.onChange?.(e);
groupContext?.onChange?.(e);
};
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
children,
style,
title,
classNames,
styles,
...restProps
} = props;
const radioPrefixCls = getPrefixCls('radio', customizePrefixCls);
const isButtonType = (groupContext?.optionType || radioOptionTypeContext) === 'button';
const prefixCls = isButtonType ? `${radioPrefixCls}-button` : radioPrefixCls;
// Style
const rootCls = hooks_useCSSVarCls(radioPrefixCls);
const [hashId, cssVarCls] = (0,radio_style["default"])(radioPrefixCls, rootCls);
const radioProps = {
...restProps
};
// ===================== Disabled =====================
const disabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
// ====================== Checked ======================
let mergedChecked = radioProps.checked;
if (groupContext) {
radioProps.name = groupContext.name;
radioProps.onChange = onChange;
mergedChecked = props.value === groupContext.value;
radioProps.disabled = radioProps.disabled ?? groupContext.disabled;
}
radioProps.disabled = radioProps.disabled ?? disabled;
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
...radioProps,
checked: mergedChecked
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const wrapperClassString = (0,clsx.clsx)(`${prefixCls}-wrapper`, {
[`${prefixCls}-wrapper-checked`]: mergedChecked,
[`${prefixCls}-wrapper-disabled`]: radioProps.disabled,
[`${prefixCls}-wrapper-rtl`]: direction === 'rtl',
[`${prefixCls}-wrapper-in-form-item`]: isFormItemInput,
[`${prefixCls}-wrapper-block`]: !!groupContext?.block
}, contextClassName, className, rootClassName, mergedClassNames.root, hashId, cssVarCls, rootCls);
// ============================ Event Lock ============================
const [onLabelClick, onInputClick] = useBubbleLock(radioProps.onClick);
// ============================== Render ==============================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(wave, {
component: "Radio",
disabled: radioProps.disabled
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("label", {
className: wrapperClassString,
style: {
...mergedStyles.root,
...contextStyle,
...style
},
onMouseEnter: props.onMouseEnter,
onMouseLeave: props.onMouseLeave,
title: title,
onClick: onLabelClick
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(checkbox_es, {
...radioProps,
checked: mergedChecked,
className: (0,clsx.clsx)(mergedClassNames.icon, {
[TARGET_CLS]: !isButtonType
}),
style: mergedStyles.icon,
type: "radio",
prefixCls: prefixCls,
ref: mergedRef,
onClick: onInputClick
}), children !== undefined ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}-label`, mergedClassNames.label),
style: mergedStyles.label
}, children)) : null));
};
const Radio = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(InternalRadio);
if (true) {
Radio.displayName = 'Radio';
}
/* harmony default export */ var radio_radio = (Radio);
;// ./components/radio/group.tsx
const RadioGroup = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
getPrefixCls,
direction
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const {
name: formItemName
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FormItemInputContext);
const defaultName = useId(toNamePathStr(formItemName));
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
options,
buttonStyle = 'outline',
disabled,
children,
size: customizeSize,
style,
id,
optionType,
name = defaultName,
defaultValue,
value: customizedValue,
block = false,
onChange,
onMouseEnter,
onMouseLeave,
onFocus,
onBlur,
orientation,
vertical,
role = 'radiogroup'
} = props;
const [value, setValue] = (0,es.useControlledState)(defaultValue, customizedValue);
const onRadioChange = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(event => {
const lastValue = value;
const val = event.target.value;
if (!('value' in props)) {
setValue(val);
}
if (val !== lastValue) {
onChange?.(event);
}
}, [value, setValue, onChange]);
const prefixCls = getPrefixCls('radio', customizePrefixCls);
const groupPrefixCls = `${prefixCls}-group`;
// Style
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,radio_style["default"])(prefixCls, rootCls);
let childrenToRender = children;
// 如果存在 options, 优先使用
if (options && options.length > 0) {
childrenToRender = options.map(option => {
if (typeof option === 'string' || (0,is.isNumber)(option)) {
// 此处类型自动推导为 string
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(radio_radio, {
key: option.toString(),
prefixCls: prefixCls,
disabled: disabled,
value: option,
checked: value === option
}, option);
}
// 此处类型自动推导为 { label: string value: string }
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(radio_radio, {
key: `radio-group-value-options-${option.value}`,
prefixCls: prefixCls,
disabled: option.disabled || disabled,
value: option.value,
checked: value === option.value,
title: option.title,
style: option.style,
className: option.className,
id: option.id,
required: option.required
}, option.label);
});
}
const mergedSize = (0,useSize["default"])(customizeSize);
const [, mergedVertical] = useOrientation(orientation, vertical);
const classString = (0,clsx.clsx)(groupPrefixCls, `${groupPrefixCls}-${buttonStyle}`, {
[`${groupPrefixCls}-large`]: mergedSize === 'large',
[`${groupPrefixCls}-small`]: mergedSize === 'small',
[`${groupPrefixCls}-rtl`]: direction === 'rtl',
[`${groupPrefixCls}-block`]: block
}, className, rootClassName, hashId, cssVarCls, rootCls);
const memoizedValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
onChange: onRadioChange,
value,
disabled,
name,
optionType,
block
}), [onRadioChange, value, disabled, name, optionType, block]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
...(0,pickAttrs["default"])(props, {
aria: true,
data: true
}),
role: role,
className: (0,clsx.clsx)(classString, {
[`${prefixCls}-group-vertical`]: mergedVertical
}),
style: style,
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
onFocus: onFocus,
onBlur: onBlur,
id: id,
ref: ref
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RadioGroupContextProvider, {
value: memoizedValue
}, childrenToRender));
});
/* harmony default export */ var group = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo(RadioGroup));
;// ./components/radio/radioButton.tsx
const RadioButton = (props, ref) => {
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const {
prefixCls: customizePrefixCls,
...radioProps
} = props;
const prefixCls = getPrefixCls('radio', customizePrefixCls);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RadioOptionTypeContextProvider, {
value: "button"
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(radio_radio, {
prefixCls: prefixCls,
...radioProps,
type: "radio",
ref: ref
}));
};
/* harmony default export */ var radioButton = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(RadioButton));
;// ./components/calendar/Header.tsx
const YEAR_SELECT_OFFSET = 10;
const YEAR_SELECT_TOTAL = 20;
function YearSelect(props) {
const {
fullscreen,
validRange,
generateConfig,
locale,
prefixCls,
value,
onChange,
divRef
} = props;
const year = generateConfig.getYear(value || generateConfig.getNow());
let start = year - YEAR_SELECT_OFFSET;
let end = start + YEAR_SELECT_TOTAL;
if (validRange) {
start = generateConfig.getYear(validRange[0]);
end = generateConfig.getYear(validRange[1]) + 1;
}
const suffix = locale && locale.year === '年' ? '年' : '';
const options = [];
for (let index = start; index < end; index++) {
options.push({
label: `${index}${suffix}`,
value: index
});
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_select, {
size: fullscreen ? undefined : 'small',
options: options,
value: year,
className: `${prefixCls}-year-select`,
onChange: numYear => {
let newDate = generateConfig.setYear(value, numYear);
if (validRange) {
const [startDate, endDate] = validRange;
const newYear = generateConfig.getYear(newDate);
const newMonth = generateConfig.getMonth(newDate);
if (newYear === generateConfig.getYear(endDate) && newMonth > generateConfig.getMonth(endDate)) {
newDate = generateConfig.setMonth(newDate, generateConfig.getMonth(endDate));
}
if (newYear === generateConfig.getYear(startDate) && newMonth < generateConfig.getMonth(startDate)) {
newDate = generateConfig.setMonth(newDate, generateConfig.getMonth(startDate));
}
}
onChange(newDate);
},
getPopupContainer: () => divRef.current
});
}
function MonthSelect(props) {
const {
prefixCls,
fullscreen,
validRange,
value,
generateConfig,
locale,
onChange,
divRef
} = props;
const month = generateConfig.getMonth(value || generateConfig.getNow());
let start = 0;
let end = 11;
if (validRange) {
const [rangeStart, rangeEnd] = validRange;
const currentYear = generateConfig.getYear(value);
if (generateConfig.getYear(rangeEnd) === currentYear) {
end = generateConfig.getMonth(rangeEnd);
}
if (generateConfig.getYear(rangeStart) === currentYear) {
start = generateConfig.getMonth(rangeStart);
}
}
const months = locale.shortMonths || generateConfig.locale.getShortMonths(locale.locale);
const options = [];
for (let index = start; index <= end; index += 1) {
options.push({
label: months[index],
value: index
});
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_select, {
size: fullscreen ? undefined : 'small',
className: `${prefixCls}-month-select`,
value: month,
options: options,
onChange: newMonth => {
onChange(generateConfig.setMonth(value, newMonth));
},
getPopupContainer: () => divRef.current
});
}
function ModeSwitch(props) {
const {
prefixCls,
locale,
mode,
fullscreen,
onModeChange
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(group, {
onChange: ({
target: {
value
}
}) => {
onModeChange(value);
},
value: mode,
size: fullscreen ? undefined : 'small',
className: `${prefixCls}-mode-switch`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(radioButton, {
value: "month"
}, locale.month), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(radioButton, {
value: "year"
}, locale.year));
}
function CalendarHeader(props) {
const {
prefixCls,
fullscreen,
mode,
onChange,
onModeChange,
className,
style
} = props;
const divRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const formItemInputContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(FormItemInputContext);
const mergedFormItemInputContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => ({
...formItemInputContext,
isFormItemInput: false
}), [formItemInputContext]);
const sharedProps = {
...props,
fullscreen,
divRef
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-header`, className),
style: style,
ref: divRef
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(FormItemInputContext.Provider, {
value: mergedFormItemInputContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(YearSelect, {
...sharedProps,
onChange: v => {
onChange(v, 'year');
}
}), mode === 'month' && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(MonthSelect, {
...sharedProps,
onChange: v => {
onChange(v, 'month');
}
}))), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(ModeSwitch, {
...sharedProps,
onModeChange: onModeChange
}));
}
/* harmony default export */ var Header = (CalendarHeader);
// EXTERNAL MODULE: ./components/calendar/locale/en_US.ts
var locale_en_US = __webpack_require__("./components/calendar/locale/en_US.ts");
// EXTERNAL MODULE: ./components/calendar/style/index.ts
var calendar_style = __webpack_require__("./components/calendar/style/index.ts");
;// ./components/calendar/generateCalendar.tsx
const generateCalendar_isSameYear = (date1, date2, config) => {
const {
getYear
} = config;
return date1 && date2 && getYear(date1) === getYear(date2);
};
const generateCalendar_isSameMonth = (date1, date2, config) => {
const {
getMonth
} = config;
return generateCalendar_isSameYear(date1, date2, config) && getMonth(date1) === getMonth(date2);
};
const generateCalendar_isSameDate = (date1, date2, config) => {
const {
getDate
} = config;
return generateCalendar_isSameMonth(date1, date2, config) && getDate(date1) === getDate(date2);
};
const generateCalendar = generateConfig => {
const Calendar = props => {
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
style,
dateFullCellRender,
dateCellRender,
monthFullCellRender,
monthCellRender,
cellRender,
fullCellRender,
headerRender,
value,
defaultValue,
disabledDate,
mode,
validRange,
fullscreen = true,
showWeek,
onChange,
onPanelChange,
onSelect,
styles,
classNames
} = props;
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('calendar');
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
mode,
fullscreen,
showWeek
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const [rootCls, headerCls, panelClassNames, rootStyle, headerStyle, panelStyles] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const {
root: nextRootClassName,
header: nextHeaderClassName,
...nextPanelClassNames
} = mergedClassNames;
const {
root: nextRootStyle,
header: nextHeaderStyle,
...nextPanelStyles
} = mergedStyles;
return [nextRootClassName, nextHeaderClassName, nextPanelClassNames, nextRootStyle, nextHeaderStyle, nextPanelStyles];
}, [mergedClassNames, mergedStyles]);
const prefixCls = getPrefixCls('picker', customizePrefixCls);
const calendarPrefixCls = `${prefixCls}-calendar`;
const [hashId, cssVarCls] = (0,calendar_style["default"])(prefixCls, calendarPrefixCls);
const today = generateConfig.getNow();
// ====================== Warning =======================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Calendar');
[['dateFullCellRender', 'fullCellRender'], ['dateCellRender', 'cellRender'], ['monthFullCellRender', 'fullCellRender'], ['monthCellRender', 'cellRender']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
}
// ====================== State =======================
// Value
const [mergedValue, setMergedValue] = (0,es.useControlledState)(() => defaultValue || generateConfig.getNow(), value);
// Mode
const [mergedMode, setMergedMode] = (0,es.useControlledState)('month', mode);
const panelMode = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => mergedMode === 'year' ? 'month' : 'date', [mergedMode]);
// Disabled Date
const mergedDisabledDate = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(date => {
const notInRange = validRange ? generateConfig.isAfter(validRange[0], date) || generateConfig.isAfter(date, validRange[1]) : false;
return notInRange || !!disabledDate?.(date);
}, [disabledDate, validRange]);
// ====================== Events ======================
const triggerPanelChange = (date, newMode) => {
onPanelChange?.(date, newMode);
};
const triggerChange = date => {
setMergedValue(date);
if (!generateCalendar_isSameDate(date, mergedValue, generateConfig)) {
// Trigger when month panel switch month
if (panelMode === 'date' && !generateCalendar_isSameMonth(date, mergedValue, generateConfig) || panelMode === 'month' && !generateCalendar_isSameYear(date, mergedValue, generateConfig)) {
triggerPanelChange(date, mergedMode);
}
onChange?.(date);
}
};
const triggerModeChange = newMode => {
setMergedMode(newMode);
triggerPanelChange(mergedValue, newMode);
};
const onInternalSelect = (date, source) => {
triggerChange(date);
onSelect?.(date, {
source
});
};
// ====================== Render ======================
const dateRender = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback((date, info) => {
if (fullCellRender) {
return fullCellRender(date, info);
}
if (dateFullCellRender) {
return dateFullCellRender(date);
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-cell-inner`, `${calendarPrefixCls}-date`, {
[`${calendarPrefixCls}-date-today`]: generateCalendar_isSameDate(today, date, generateConfig)
})
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${calendarPrefixCls}-date-value`
}, String(generateConfig.getDate(date)).padStart(2, '0')), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${calendarPrefixCls}-date-content`
}, typeof cellRender === 'function' ? cellRender(date, info) : dateCellRender?.(date)));
}, [today, prefixCls, calendarPrefixCls, fullCellRender, dateFullCellRender, cellRender, dateCellRender]);
const monthRender = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback((date, info) => {
if (fullCellRender) {
return fullCellRender(date, info);
}
if (monthFullCellRender) {
return monthFullCellRender(date);
}
const months = info.locale.shortMonths || generateConfig.locale.getShortMonths(info.locale.locale);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-cell-inner`, `${calendarPrefixCls}-date`, {
[`${calendarPrefixCls}-date-today`]: generateCalendar_isSameMonth(today, date, generateConfig)
})
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${calendarPrefixCls}-date-value`
}, months[generateConfig.getMonth(date)]), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${calendarPrefixCls}-date-content`
}, typeof cellRender === 'function' ? cellRender(date, info) : monthCellRender?.(date)));
}, [today, prefixCls, calendarPrefixCls, fullCellRender, monthFullCellRender, cellRender, monthCellRender]);
const [contextLocale] = (0,useLocale["default"])('Calendar', locale_en_US["default"]);
const locale = (0,es.merge)(contextLocale, props.locale || {});
const mergedCellRender = (current, info) => {
if (info.type === 'date') {
return dateRender(current, info);
}
if (info.type === 'month') {
return monthRender(current, {
...info,
locale: locale?.lang
});
}
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(calendarPrefixCls, {
[`${calendarPrefixCls}-full`]: fullscreen,
[`${calendarPrefixCls}-mini`]: !fullscreen,
[`${calendarPrefixCls}-rtl`]: direction === 'rtl'
}, contextClassName, className, rootClassName, rootCls, hashId, cssVarCls),
style: {
...rootStyle,
...contextStyle,
...style
}
}, headerRender ? headerRender({
value: mergedValue,
type: mergedMode,
onChange: nextDate => {
onInternalSelect(nextDate, 'customize');
},
onTypeChange: triggerModeChange
}) : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Header, {
className: headerCls,
style: headerStyle,
prefixCls: calendarPrefixCls,
value: mergedValue,
generateConfig: generateConfig,
mode: mergedMode,
fullscreen: fullscreen,
locale: locale?.lang,
validRange: validRange,
onChange: onInternalSelect,
onModeChange: triggerModeChange
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_PickerPanel, {
classNames: panelClassNames,
styles: panelStyles,
value: mergedValue,
prefixCls: prefixCls,
locale: locale?.lang,
generateConfig: generateConfig,
cellRender: mergedCellRender,
onSelect: nextDate => {
onInternalSelect(nextDate, panelMode);
},
mode: panelMode,
picker: panelMode,
disabledDate: mergedDisabledDate,
hideHeader: true,
showWeek: showWeek
}));
};
if (true) {
Calendar.displayName = 'Calendar';
}
return Calendar;
};
/* harmony default export */ var calendar_generateCalendar = (generateCalendar);
;// ./components/calendar/index.tsx
const Calendar = calendar_generateCalendar(dayjs);
Calendar.generateCalendar = calendar_generateCalendar;
/* harmony default export */ var calendar = (Calendar);
;// ./node_modules/@ant-design/icons-svg/es/asn/PlusOutlined.js
// This icon file is generated automatically.
var PlusOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z" } }, { "tag": "path", "attrs": { "d": "M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z" } }] }, "name": "plus", "theme": "outlined" };
/* harmony default export */ var asn_PlusOutlined = (PlusOutlined);
;// ./node_modules/@ant-design/icons/es/icons/PlusOutlined.js
function PlusOutlined_extends() { PlusOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return PlusOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const PlusOutlined_PlusOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], PlusOutlined_extends({}, props, {
ref: ref,
icon: asn_PlusOutlined
}));
/** */
const PlusOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(PlusOutlined_PlusOutlined);
if (true) {
PlusOutlined_RefIcon.displayName = 'PlusOutlined';
}
/* harmony default export */ var icons_PlusOutlined = (PlusOutlined_RefIcon);
// EXTERNAL MODULE: ./node_modules/is-mobile/index.js
var is_mobile = __webpack_require__("./node_modules/is-mobile/index.js");
var is_mobile_default = /*#__PURE__*/__webpack_require__.n(is_mobile);
;// ./node_modules/@rc-component/util/es/isMobile.js
let isMobile_cached;
const getIsMobile = () => {
if (typeof isMobile_cached === 'undefined') {
isMobile_cached = is_mobile_default()();
}
return isMobile_cached;
};
/* harmony default export */ var isMobile = (getIsMobile);
;// ./node_modules/@rc-component/tabs/es/TabContext.js
/* harmony default export */ var TabContext = (/*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext)(null));
;// ./node_modules/@rc-component/tabs/es/hooks/useIndicator.js
const useIndicator = options => {
const {
activeTabOffset,
horizontal,
rtl,
indicator = {}
} = options;
const {
size,
align = 'center'
} = indicator;
const [inkStyle, setInkStyle] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)();
const inkBarRafRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
const getLength = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useCallback(origin => {
if (typeof size === 'function') {
return size(origin);
}
if (typeof size === 'number') {
return size;
}
return origin;
}, [size]);
// Delay set ink style to avoid remove tab blink
function cleanInkBarRaf() {
raf["default"].cancel(inkBarRafRef.current);
}
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
const newInkStyle = {};
if (activeTabOffset) {
if (horizontal) {
newInkStyle.width = getLength(activeTabOffset.width);
const key = rtl ? 'right' : 'left';
if (align === 'start') {
newInkStyle[key] = activeTabOffset[key];
}
if (align === 'center') {
newInkStyle[key] = activeTabOffset[key] + activeTabOffset.width / 2;
newInkStyle.transform = rtl ? 'translateX(50%)' : 'translateX(-50%)';
}
if (align === 'end') {
newInkStyle[key] = activeTabOffset[key] + activeTabOffset.width;
newInkStyle.transform = 'translateX(-100%)';
}
} else {
newInkStyle.height = getLength(activeTabOffset.height);
if (align === 'start') {
newInkStyle.top = activeTabOffset.top;
}
if (align === 'center') {
newInkStyle.top = activeTabOffset.top + activeTabOffset.height / 2;
newInkStyle.transform = 'translateY(-50%)';
}
if (align === 'end') {
newInkStyle.top = activeTabOffset.top + activeTabOffset.height;
newInkStyle.transform = 'translateY(-100%)';
}
}
}
cleanInkBarRaf();
inkBarRafRef.current = (0,raf["default"])(() => {
// Avoid jitter caused by tiny numerical differences
// fix https://github.com/ant-design/ant-design/issues/53378
const isEqual = inkStyle && newInkStyle && Object.keys(newInkStyle).every(key => {
const newValue = newInkStyle[key];
const oldValue = inkStyle[key];
return typeof newValue === 'number' && typeof oldValue === 'number' ? Math.round(newValue) === Math.round(oldValue) : newValue === oldValue;
});
if (!isEqual) {
setInkStyle(newInkStyle);
}
});
return cleanInkBarRaf;
}, [JSON.stringify(activeTabOffset), horizontal, rtl, align, getLength]);
return {
style: inkStyle
};
};
/* harmony default export */ var hooks_useIndicator = (useIndicator);
;// ./node_modules/@rc-component/tabs/es/hooks/useOffsets.js
const DEFAULT_SIZE = {
width: 0,
height: 0,
left: 0,
top: 0
};
function useOffsets(tabs, tabSizes, holderScrollWidth) {
return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
const map = new Map();
const lastOffset = tabSizes.get(tabs[0]?.key) || DEFAULT_SIZE;
const rightOffset = lastOffset.left + lastOffset.width;
for (let i = 0; i < tabs.length; i += 1) {
const {
key
} = tabs[i];
let data = tabSizes.get(key);
// Reuse last one when not exist yet
if (!data) {
data = tabSizes.get(tabs[i - 1]?.key) || DEFAULT_SIZE;
}
const entity = map.get(key) || {
...data
};
// Right
entity.right = rightOffset - entity.left - entity.width;
// Update entity
map.set(key, entity);
}
return map;
}, [tabs.map(tab => tab.key).join('_'), tabSizes, holderScrollWidth]);
}
;// ./node_modules/@rc-component/tabs/es/hooks/useSyncState.js
function useSyncState_useSyncState(defaultState, onChange) {
const stateRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(defaultState);
const [, forceUpdate] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState({});
function setState(updater) {
const newValue = typeof updater === 'function' ? updater(stateRef.current) : updater;
if (newValue !== stateRef.current) {
onChange(newValue, stateRef.current);
}
stateRef.current = newValue;
forceUpdate({});
}
return [stateRef.current, setState];
}
;// ./node_modules/@rc-component/tabs/es/hooks/useTouchMove.js
const MIN_SWIPE_DISTANCE = 0.1;
const STOP_SWIPE_DISTANCE = 0.01;
const REFRESH_INTERVAL = 20;
const SPEED_OFF_MULTIPLE = 0.995 ** REFRESH_INTERVAL;
// ================================= Hook =================================
function useTouchMove(ref, onOffset) {
const [touchPosition, setTouchPosition] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)();
const [lastTimestamp, setLastTimestamp] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0);
const [lastTimeDiff, setLastTimeDiff] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0);
const [lastOffset, setLastOffset] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)();
const motionRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
// ========================= Events =========================
// >>> Touch events
function onTouchStart(e) {
const {
screenX,
screenY
} = e.touches[0];
setTouchPosition({
x: screenX,
y: screenY
});
window.clearInterval(motionRef.current);
}
function onTouchMove(e) {
if (!touchPosition) return;
// e.preventDefault();
const {
screenX,
screenY
} = e.touches[0];
setTouchPosition({
x: screenX,
y: screenY
});
const offsetX = screenX - touchPosition.x;
const offsetY = screenY - touchPosition.y;
onOffset(offsetX, offsetY);
const now = Date.now();
setLastTimestamp(now);
setLastTimeDiff(now - lastTimestamp);
setLastOffset({
x: offsetX,
y: offsetY
});
}
function onTouchEnd() {
if (!touchPosition) return;
setTouchPosition(null);
setLastOffset(null);
// Swipe if needed
if (lastOffset) {
const distanceX = lastOffset.x / lastTimeDiff;
const distanceY = lastOffset.y / lastTimeDiff;
const absX = Math.abs(distanceX);
const absY = Math.abs(distanceY);
// Skip swipe if low distance
if (Math.max(absX, absY) < MIN_SWIPE_DISTANCE) return;
let currentX = distanceX;
let currentY = distanceY;
motionRef.current = window.setInterval(() => {
if (Math.abs(currentX) < STOP_SWIPE_DISTANCE && Math.abs(currentY) < STOP_SWIPE_DISTANCE) {
window.clearInterval(motionRef.current);
return;
}
currentX *= SPEED_OFF_MULTIPLE;
currentY *= SPEED_OFF_MULTIPLE;
onOffset(currentX * REFRESH_INTERVAL, currentY * REFRESH_INTERVAL);
}, REFRESH_INTERVAL);
}
}
// >>> Wheel event
const lastWheelDirectionRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
function onWheel(e) {
const {
deltaX,
deltaY
} = e;
// Convert both to x & y since wheel only happened on PC
let mixed = 0;
const absX = Math.abs(deltaX);
const absY = Math.abs(deltaY);
if (absX === absY) {
mixed = lastWheelDirectionRef.current === 'x' ? deltaX : deltaY;
} else if (absX > absY) {
mixed = deltaX;
lastWheelDirectionRef.current = 'x';
} else {
mixed = deltaY;
lastWheelDirectionRef.current = 'y';
}
if (onOffset(-mixed, -mixed)) {
e.preventDefault();
}
}
// ========================= Effect =========================
const touchEventsRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
touchEventsRef.current = {
onTouchStart,
onTouchMove,
onTouchEnd,
onWheel
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
function onProxyTouchStart(e) {
touchEventsRef.current.onTouchStart(e);
}
function onProxyTouchMove(e) {
touchEventsRef.current.onTouchMove(e);
}
function onProxyTouchEnd(e) {
touchEventsRef.current.onTouchEnd(e);
}
function onProxyWheel(e) {
touchEventsRef.current.onWheel(e);
}
document.addEventListener('touchmove', onProxyTouchMove, {
passive: false
});
document.addEventListener('touchend', onProxyTouchEnd, {
passive: true
});
// No need to clean up since element removed
ref.current.addEventListener('touchstart', onProxyTouchStart, {
passive: true
});
ref.current.addEventListener('wheel', onProxyWheel, {
passive: false
});
return () => {
document.removeEventListener('touchmove', onProxyTouchMove);
document.removeEventListener('touchend', onProxyTouchEnd);
};
}, []);
}
;// ./node_modules/@rc-component/tabs/es/hooks/useUpdate.js
/**
* Help to merge callback with `useLayoutEffect`.
* One time will only trigger once.
*/
function useUpdate(callback) {
const [count, setCount] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0);
const effectRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(0);
const callbackRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
callbackRef.current = callback;
// Trigger on `useLayoutEffect`
(0,useLayoutEffect.useLayoutUpdateEffect)(() => {
callbackRef.current?.();
}, [count]);
// Trigger to update count
return () => {
if (effectRef.current !== count) {
return;
}
effectRef.current += 1;
setCount(effectRef.current);
};
}
function useUpdateState(defaultState) {
const batchRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)([]);
const [, forceUpdate] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({});
const state = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(typeof defaultState === 'function' ? defaultState() : defaultState);
const flushUpdate = useUpdate(() => {
let current = state.current;
batchRef.current.forEach(callback => {
current = callback(current);
});
batchRef.current = [];
state.current = current;
forceUpdate({});
});
function updater(callback) {
batchRef.current.push(callback);
flushUpdate();
}
return [state.current, updater];
}
;// ./node_modules/@rc-component/tabs/es/hooks/useVisibleRange.js
const useVisibleRange_DEFAULT_SIZE = {
width: 0,
height: 0,
left: 0,
top: 0,
right: 0
};
function useVisibleRange(tabOffsets, visibleTabContentValue, transform, tabContentSizeValue, addNodeSizeValue, operationNodeSizeValue, {
tabs,
tabPosition,
rtl
}) {
let charUnit;
let position;
let transformSize;
if (['top', 'bottom'].includes(tabPosition)) {
charUnit = 'width';
position = rtl ? 'right' : 'left';
transformSize = Math.abs(transform);
} else {
charUnit = 'height';
position = 'top';
transformSize = -transform;
}
return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (!tabs.length) {
return [0, 0];
}
const len = tabs.length;
let endIndex = len;
for (let i = 0; i < len; i += 1) {
const offset = tabOffsets.get(tabs[i].key) || useVisibleRange_DEFAULT_SIZE;
if (Math.floor(offset[position] + offset[charUnit]) > Math.floor(transformSize + visibleTabContentValue)) {
endIndex = i - 1;
break;
}
}
let startIndex = 0;
for (let i = len - 1; i >= 0; i -= 1) {
const offset = tabOffsets.get(tabs[i].key) || useVisibleRange_DEFAULT_SIZE;
if (offset[position] < transformSize) {
startIndex = i + 1;
break;
}
}
return startIndex > endIndex ? [0, -1] : [startIndex, endIndex];
}, [tabOffsets, visibleTabContentValue, tabContentSizeValue, addNodeSizeValue, operationNodeSizeValue, transformSize, tabPosition, tabs.map(tab => tab.key).join('_'), rtl]);
}
;// ./node_modules/@rc-component/tabs/es/util.js
/**
* We trade Map as deps which may change with same value but different ref object.
* We should make it as hash for deps
* */
function util_stringify(obj) {
let tgt;
if (obj instanceof Map) {
tgt = {};
obj.forEach((v, k) => {
tgt[k] = v;
});
} else {
tgt = obj;
}
return JSON.stringify(tgt);
}
const RC_TABS_DOUBLE_QUOTE = 'TABS_DQ';
function genDataNodeKey(key) {
return String(key).replace(/"/g, RC_TABS_DOUBLE_QUOTE);
}
function getRemovable(closable, closeIcon, editable, disabled) {
if (
// Only editable tabs can be removed
!editable ||
// Tabs cannot be removed when disabled
disabled ||
// closable is false
closable === false ||
// If closable is undefined, the remove button should be hidden when closeIcon is null or false
closable === undefined && (closeIcon === false || closeIcon === null)) {
return false;
}
return true;
}
;// ./node_modules/@rc-component/tabs/es/TabNavList/AddButton.js
const AddButton = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls,
editable,
locale,
style
} = props;
if (!editable || editable.showAdd === false) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
ref: ref,
type: "button",
className: `${prefixCls}-nav-add`,
style: style,
"aria-label": locale?.addAriaLabel || 'Add tab',
onClick: event => {
editable.onEdit('add', {
event
});
}
}, editable.addIcon || '+');
});
/* harmony default export */ var TabNavList_AddButton = (AddButton);
;// ./node_modules/@rc-component/tabs/es/TabNavList/ExtraContent.js
const ExtraContent = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
position,
prefixCls,
extra
} = props;
if (!extra) {
return null;
}
let content;
// Parse extra
let assertExtra = {};
if (typeof extra === 'object' && ! /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(extra)) {
assertExtra = extra;
} else {
assertExtra.right = extra;
}
if (position === 'right') {
content = assertExtra.right;
}
if (position === 'left') {
content = assertExtra.left;
}
return content ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-extra-content`,
ref: ref
}, content) : null;
});
if (true) {
ExtraContent.displayName = 'ExtraContent';
}
/* harmony default export */ var TabNavList_ExtraContent = (ExtraContent);
;// ./node_modules/@rc-component/tabs/es/TabNavList/OperationNode.js
function OperationNode_extends() { OperationNode_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return OperationNode_extends.apply(this, arguments); }
const OperationNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls,
id,
tabs,
locale,
mobile,
more: moreProps = {},
style,
className,
editable,
tabBarGutter,
rtl,
removeAriaLabel,
onTabClick,
getPopupContainer,
popupClassName,
popupStyle
} = props;
// ======================== Dropdown ========================
const [open, setOpen] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
const [selectedKey, setSelectedKey] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null);
const {
icon: moreIcon = 'More'
} = moreProps;
const popupId = `${id}-more-popup`;
const dropdownPrefix = `${prefixCls}-dropdown`;
const selectedItemId = selectedKey !== null ? `${popupId}-${selectedKey}` : null;
const dropdownAriaLabel = locale?.dropdownAriaLabel;
function onRemoveTab(event, key) {
event.preventDefault();
event.stopPropagation();
editable.onEdit('remove', {
key,
event
});
}
const menu = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(menu_es, {
onClick: ({
key,
domEvent
}) => {
onTabClick(key, domEvent);
setOpen(false);
},
prefixCls: `${dropdownPrefix}-menu`,
id: popupId,
tabIndex: -1,
role: "listbox",
"aria-activedescendant": selectedItemId,
selectedKeys: [selectedKey],
"aria-label": dropdownAriaLabel !== undefined ? dropdownAriaLabel : 'expanded dropdown'
}, tabs.map(tab => {
const {
closable,
disabled,
closeIcon,
key,
label
} = tab;
const removable = getRemovable(closable, closeIcon, editable, disabled);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_MenuItem, {
key: key,
id: `${popupId}-${key}`,
role: "option",
"aria-controls": id && `${id}-panel-${key}`,
disabled: disabled
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", null, label), removable && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
"aria-label": removeAriaLabel || 'remove',
tabIndex: 0,
className: `${dropdownPrefix}-menu-item-remove`,
onClick: e => {
e.stopPropagation();
onRemoveTab(e, key);
}
}, closeIcon || editable.removeIcon || '×'));
}));
function selectOffset(offset) {
const enabledTabs = tabs.filter(tab => !tab.disabled);
let selectedIndex = enabledTabs.findIndex(tab => tab.key === selectedKey) || 0;
const len = enabledTabs.length;
for (let i = 0; i < len; i += 1) {
selectedIndex = (selectedIndex + offset + len) % len;
const tab = enabledTabs[selectedIndex];
if (!tab.disabled) {
setSelectedKey(tab.key);
return;
}
}
}
function onKeyDown(e) {
const {
which
} = e;
if (!open) {
if ([KeyCode["default"].DOWN, KeyCode["default"].SPACE, KeyCode["default"].ENTER].includes(which)) {
setOpen(true);
e.preventDefault();
}
return;
}
switch (which) {
case KeyCode["default"].UP:
selectOffset(-1);
e.preventDefault();
break;
case KeyCode["default"].DOWN:
selectOffset(1);
e.preventDefault();
break;
case KeyCode["default"].ESC:
setOpen(false);
break;
case KeyCode["default"].SPACE:
case KeyCode["default"].ENTER:
if (selectedKey !== null) {
onTabClick(selectedKey, e);
}
break;
}
}
// ========================= Effect =========================
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
// We use query element here to avoid React strict warning
const ele = document.getElementById(selectedItemId);
if (ele?.scrollIntoView) {
ele.scrollIntoView(false);
}
}, [selectedItemId, selectedKey]);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (!open) {
setSelectedKey(null);
}
}, [open]);
// ========================= Render =========================
const moreStyle = {
marginInlineStart: tabBarGutter
};
if (!tabs.length) {
moreStyle.visibility = 'hidden';
moreStyle.order = 1;
}
const overlayClassName = (0,clsx.clsx)(popupClassName, {
[`${dropdownPrefix}-rtl`]: rtl
});
const moreNode = mobile ? null : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(dropdown_es, OperationNode_extends({
prefixCls: dropdownPrefix,
overlay: menu,
visible: tabs.length ? open : false,
onVisibleChange: setOpen,
overlayClassName: overlayClassName,
overlayStyle: popupStyle,
mouseEnterDelay: 0.1,
mouseLeaveDelay: 0.1,
getPopupContainer: getPopupContainer
}, moreProps), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
className: `${prefixCls}-nav-more`,
style: moreStyle,
"aria-haspopup": "listbox",
"aria-controls": popupId,
id: `${id}-more`,
"aria-expanded": open,
onKeyDown: onKeyDown
}, moreIcon));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-nav-operations`, className),
style: style,
ref: ref
}, moreNode, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TabNavList_AddButton, {
prefixCls: prefixCls,
locale: locale,
editable: editable
}));
});
/* harmony default export */ var TabNavList_OperationNode = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo(OperationNode, (_, next) =>
// https://github.com/ant-design/ant-design/issues/32544
// We'd better remove syntactic sugar in `rc-menu` since this has perf issue
next.tabMoving));
;// ./node_modules/@rc-component/tabs/es/TabNavList/TabNode.js
const TabNode = props => {
const {
prefixCls,
id,
active,
focus,
tab: {
key,
label,
disabled,
closeIcon,
icon
},
closable,
renderWrapper,
removeAriaLabel,
editable,
onClick,
onFocus,
onBlur,
onKeyDown,
onMouseDown,
onMouseUp,
style,
className,
tabCount,
currentPosition
} = props;
const tabPrefix = `${prefixCls}-tab`;
const removable = getRemovable(closable, closeIcon, editable, disabled);
function onInternalClick(e) {
if (disabled) {
return;
}
onClick(e);
}
function onRemoveTab(event) {
event.preventDefault();
event.stopPropagation();
editable.onEdit('remove', {
key,
event
});
}
const labelNode = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => icon && typeof label === 'string' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", null, label) : label, [label, icon]);
const btnRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (focus && btnRef.current) {
btnRef.current.focus();
}
}, [focus]);
const node = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
key: key,
"data-node-key": genDataNodeKey(key),
className: (0,clsx.clsx)(tabPrefix, className, {
[`${tabPrefix}-with-remove`]: removable,
[`${tabPrefix}-active`]: active,
[`${tabPrefix}-disabled`]: disabled,
[`${tabPrefix}-focus`]: focus
}),
style: style,
onClick: onInternalClick
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: btnRef,
role: "tab",
"aria-selected": active,
id: id && `${id}-tab-${key}`,
className: `${tabPrefix}-btn`,
"aria-controls": id && `${id}-panel-${key}`,
"aria-disabled": disabled,
tabIndex: disabled ? null : active ? 0 : -1,
onClick: e => {
e.stopPropagation();
onInternalClick(e);
},
onKeyDown: onKeyDown,
onMouseDown: onMouseDown,
onMouseUp: onMouseUp,
onFocus: onFocus,
onBlur: onBlur
}, focus && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
"aria-live": "polite",
style: {
width: 0,
height: 0,
position: 'absolute',
overflow: 'hidden',
opacity: 0
}
}, `Tab ${currentPosition} of ${tabCount}`), icon && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${tabPrefix}-icon`
}, icon), label && labelNode), removable && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
"aria-label": removeAriaLabel || 'remove',
tabIndex: active ? 0 : -1,
className: `${tabPrefix}-remove`,
onClick: e => {
e.stopPropagation();
onRemoveTab(e);
}
}, closeIcon || editable.removeIcon || '×'));
return renderWrapper ? renderWrapper(node) : node;
};
/* harmony default export */ var TabNavList_TabNode = (TabNode);
;// ./node_modules/@rc-component/tabs/es/TabNavList/index.js
function TabNavList_extends() { TabNavList_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return TabNavList_extends.apply(this, arguments); }
const getTabSize = (tab, containerRect) => {
// tabListRef
const {
offsetWidth,
offsetHeight,
offsetTop,
offsetLeft
} = tab;
const {
width,
height,
left,
top
} = tab.getBoundingClientRect();
// Use getBoundingClientRect to avoid decimal inaccuracy
if (Math.abs(width - offsetWidth) < 1) {
return [width, height, left - containerRect.left, top - containerRect.top];
}
return [offsetWidth, offsetHeight, offsetLeft, offsetTop];
};
const getSize = refObj => {
const {
offsetWidth = 0,
offsetHeight = 0
} = refObj.current || {};
// Use getBoundingClientRect to avoid decimal inaccuracy
if (refObj.current) {
const {
width,
height
} = refObj.current.getBoundingClientRect();
if (Math.abs(width - offsetWidth) < 1) {
return [width, height];
}
}
return [offsetWidth, offsetHeight];
};
/**
* Convert `SizeInfo` to unit value. Such as [123, 456] with `top` position get `123`
*/
const getUnitValue = (size, tabPositionTopOrBottom) => {
return size[tabPositionTopOrBottom ? 0 : 1];
};
const TabNavList = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
className,
style,
id,
animated,
activeKey,
rtl,
extra,
editable,
locale,
tabPosition,
tabBarGutter,
children,
onTabClick,
onTabScroll,
indicator,
classNames: tabsClassNames,
styles
} = props;
const {
prefixCls,
tabs
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(TabContext);
const containerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const extraLeftRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const extraRightRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const tabsWrapperRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const tabListRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const operationsRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const innerAddButtonRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const tabPositionTopOrBottom = tabPosition === 'top' || tabPosition === 'bottom';
const [transformLeft, setTransformLeft] = useSyncState_useSyncState(0, (next, prev) => {
if (tabPositionTopOrBottom && onTabScroll) {
onTabScroll({
direction: next > prev ? 'left' : 'right'
});
}
});
const [transformTop, setTransformTop] = useSyncState_useSyncState(0, (next, prev) => {
if (!tabPositionTopOrBottom && onTabScroll) {
onTabScroll({
direction: next > prev ? 'top' : 'bottom'
});
}
});
const [containerExcludeExtraSize, setContainerExcludeExtraSize] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([0, 0]);
const [tabContentSize, setTabContentSize] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([0, 0]);
const [addSize, setAddSize] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([0, 0]);
const [operationSize, setOperationSize] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([0, 0]);
const [tabSizes, setTabSizes] = useUpdateState(new Map());
const tabOffsets = useOffsets(tabs, tabSizes, tabContentSize[0]);
// ========================== Unit =========================
const containerExcludeExtraSizeValue = getUnitValue(containerExcludeExtraSize, tabPositionTopOrBottom);
const tabContentSizeValue = getUnitValue(tabContentSize, tabPositionTopOrBottom);
const addSizeValue = getUnitValue(addSize, tabPositionTopOrBottom);
const operationSizeValue = getUnitValue(operationSize, tabPositionTopOrBottom);
const needScroll = Math.floor(containerExcludeExtraSizeValue) < Math.floor(tabContentSizeValue + addSizeValue);
const visibleTabContentValue = needScroll ? containerExcludeExtraSizeValue - operationSizeValue : containerExcludeExtraSizeValue - addSizeValue;
// ========================== Util =========================
const operationsHiddenClassName = `${prefixCls}-nav-operations-hidden`;
let transformMin = 0;
let transformMax = 0;
if (!tabPositionTopOrBottom) {
transformMin = Math.min(0, visibleTabContentValue - tabContentSizeValue);
transformMax = 0;
} else if (rtl) {
transformMin = 0;
transformMax = Math.max(0, tabContentSizeValue - visibleTabContentValue);
} else {
transformMin = Math.min(0, visibleTabContentValue - tabContentSizeValue);
transformMax = 0;
}
function alignInRange(value) {
if (value < transformMin) {
return transformMin;
}
if (value > transformMax) {
return transformMax;
}
return value;
}
// ========================= Mobile ========================
const touchMovingRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const [lockAnimation, setLockAnimation] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)();
function doLockAnimation() {
setLockAnimation(Date.now());
}
function clearTouchMoving() {
if (touchMovingRef.current) {
clearTimeout(touchMovingRef.current);
}
}
useTouchMove(tabsWrapperRef, (offsetX, offsetY) => {
function doMove(setState, offset) {
setState(value => {
const newValue = alignInRange(value + offset);
return newValue;
});
}
// Skip scroll if place is enough
if (!needScroll) {
return false;
}
if (tabPositionTopOrBottom) {
doMove(setTransformLeft, offsetX);
} else {
doMove(setTransformTop, offsetY);
}
clearTouchMoving();
doLockAnimation();
return true;
});
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
clearTouchMoving();
if (lockAnimation) {
touchMovingRef.current = setTimeout(() => {
setLockAnimation(0);
}, 100);
}
return clearTouchMoving;
}, [lockAnimation]);
// ===================== Visible Range =====================
// Render tab node & collect tab offset
const [visibleStart, visibleEnd] = useVisibleRange(tabOffsets,
// Container
visibleTabContentValue,
// Transform
tabPositionTopOrBottom ? transformLeft : transformTop,
// Tabs
tabContentSizeValue,
// Add
addSizeValue,
// Operation
operationSizeValue, {
...props,
tabs
});
// ========================= Scroll ========================
const scrollToTab = (0,useEvent["default"])((key = activeKey) => {
const tabOffset = tabOffsets.get(key) || {
width: 0,
height: 0,
left: 0,
right: 0,
top: 0
};
if (tabPositionTopOrBottom) {
// ============ Align with top & bottom ============
let newTransform = transformLeft;
// RTL
if (rtl) {
if (tabOffset.right < transformLeft) {
newTransform = tabOffset.right;
} else if (tabOffset.right + tabOffset.width > transformLeft + visibleTabContentValue) {
newTransform = tabOffset.right + tabOffset.width - visibleTabContentValue;
}
}
// LTR
else if (tabOffset.left < -transformLeft) {
newTransform = -tabOffset.left;
} else if (tabOffset.left + tabOffset.width > -transformLeft + visibleTabContentValue) {
newTransform = -(tabOffset.left + tabOffset.width - visibleTabContentValue);
}
setTransformTop(0);
setTransformLeft(alignInRange(newTransform));
} else {
// ============ Align with left & right ============
let newTransform = transformTop;
if (tabOffset.top < -transformTop) {
newTransform = -tabOffset.top;
} else if (tabOffset.top + tabOffset.height > -transformTop + visibleTabContentValue) {
newTransform = -(tabOffset.top + tabOffset.height - visibleTabContentValue);
}
setTransformLeft(0);
setTransformTop(alignInRange(newTransform));
}
});
// ========================= Focus =========================
const [focusKey, setFocusKey] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)();
const [isMouse, setIsMouse] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
const enabledTabs = tabs.filter(tab => !tab.disabled).map(tab => tab.key);
const onOffset = offset => {
const currentIndex = enabledTabs.indexOf(focusKey || activeKey);
const len = enabledTabs.length;
const nextIndex = (currentIndex + offset + len) % len;
const newKey = enabledTabs[nextIndex];
setFocusKey(newKey);
};
const handleRemoveTab = (removalTabKey, e) => {
const removeIndex = enabledTabs.indexOf(removalTabKey);
const removeTab = tabs.find(tab => tab.key === removalTabKey);
const removable = getRemovable(removeTab?.closable, removeTab?.closeIcon, editable, removeTab?.disabled);
if (removable) {
e.preventDefault();
e.stopPropagation();
editable.onEdit('remove', {
key: removalTabKey,
event: e
});
// when remove last tab, focus previous tab
if (removeIndex === enabledTabs.length - 1) {
onOffset(-1);
} else {
onOffset(1);
}
}
};
const handleMouseDown = (key, e) => {
setIsMouse(true);
// Middle mouse button
if (e.button === 1) {
handleRemoveTab(key, e);
}
};
const handleKeyDown = e => {
const {
code
} = e;
const isRTL = rtl && tabPositionTopOrBottom;
const firstEnabledTab = enabledTabs[0];
const lastEnabledTab = enabledTabs[enabledTabs.length - 1];
switch (code) {
// LEFT
case 'ArrowLeft':
{
if (tabPositionTopOrBottom) {
onOffset(isRTL ? 1 : -1);
}
break;
}
// RIGHT
case 'ArrowRight':
{
if (tabPositionTopOrBottom) {
onOffset(isRTL ? -1 : 1);
}
break;
}
// UP
case 'ArrowUp':
{
e.preventDefault();
if (!tabPositionTopOrBottom) {
onOffset(-1);
}
break;
}
// DOWN
case 'ArrowDown':
{
e.preventDefault();
if (!tabPositionTopOrBottom) {
onOffset(1);
}
break;
}
// HOME
case 'Home':
{
e.preventDefault();
setFocusKey(firstEnabledTab);
break;
}
// END
case 'End':
{
e.preventDefault();
setFocusKey(lastEnabledTab);
break;
}
// Enter & Space
case 'Enter':
case 'Space':
{
e.preventDefault();
onTabClick(focusKey ?? activeKey, e);
break;
}
// Backspace
case 'Backspace':
case 'Delete':
{
handleRemoveTab(focusKey, e);
break;
}
}
};
// ========================== Tab ==========================
const tabNodeStyle = {};
if (tabPositionTopOrBottom) {
tabNodeStyle.marginInlineStart = tabBarGutter;
} else {
tabNodeStyle.marginTop = tabBarGutter;
}
const tabNodes = tabs.map((tab, i) => {
const {
key
} = tab;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TabNavList_TabNode, {
id: id,
prefixCls: prefixCls,
key: key,
tab: tab,
className: tabsClassNames?.item
/* first node should not have margin left */,
style: i === 0 ? styles?.item : {
...tabNodeStyle,
...styles?.item
},
closable: tab.closable,
editable: editable,
active: key === activeKey,
focus: key === focusKey,
renderWrapper: children,
removeAriaLabel: locale?.removeAriaLabel,
tabCount: enabledTabs.length,
currentPosition: i + 1,
onClick: e => {
onTabClick(key, e);
},
onKeyDown: handleKeyDown,
onFocus: () => {
if (!isMouse) {
setFocusKey(key);
}
scrollToTab(key);
doLockAnimation();
if (!tabsWrapperRef.current) {
return;
}
// Focus element will make scrollLeft change which we should reset back
if (!rtl) {
tabsWrapperRef.current.scrollLeft = 0;
}
tabsWrapperRef.current.scrollTop = 0;
},
onBlur: () => {
setFocusKey(undefined);
},
onMouseDown: e => handleMouseDown(key, e),
onMouseUp: () => {
setIsMouse(false);
}
});
});
// Update buttons records
const updateTabSizes = () => setTabSizes(() => {
const newSizes = new Map();
const listRect = tabListRef.current?.getBoundingClientRect();
tabs.forEach(({
key
}) => {
const btnNode = tabListRef.current?.querySelector(`[data-node-key="${genDataNodeKey(key)}"]`);
if (btnNode) {
const [width, height, left, top] = getTabSize(btnNode, listRect);
newSizes.set(key, {
width,
height,
left,
top
});
}
});
return newSizes;
});
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
updateTabSizes();
}, [tabs.map(tab => tab.key).join('_')]);
const onListHolderResize = useUpdate(() => {
// Update wrapper records
const containerSize = getSize(containerRef);
const extraLeftSize = getSize(extraLeftRef);
const extraRightSize = getSize(extraRightRef);
setContainerExcludeExtraSize([containerSize[0] - extraLeftSize[0] - extraRightSize[0], containerSize[1] - extraLeftSize[1] - extraRightSize[1]]);
const newAddSize = getSize(innerAddButtonRef);
setAddSize(newAddSize);
const newOperationSize = getSize(operationsRef);
setOperationSize(newOperationSize);
// Which includes add button size
const tabContentFullSize = getSize(tabListRef);
setTabContentSize([tabContentFullSize[0] - newAddSize[0], tabContentFullSize[1] - newAddSize[1]]);
// Update buttons records
updateTabSizes();
});
// ======================== Dropdown =======================
const startHiddenTabs = tabs.slice(0, visibleStart);
const endHiddenTabs = tabs.slice(visibleEnd + 1);
const hiddenTabs = [...startHiddenTabs, ...endHiddenTabs];
// =================== Link & Operations ===================
const activeTabOffset = tabOffsets.get(activeKey);
const {
style: indicatorStyle
} = hooks_useIndicator({
activeTabOffset,
horizontal: tabPositionTopOrBottom,
indicator,
rtl
});
// ========================= Effect ========================
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
scrollToTab();
}, [activeKey, transformMin, transformMax, util_stringify(activeTabOffset), util_stringify(tabOffsets), tabPositionTopOrBottom]);
// Should recalculate when rtl changed
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
onListHolderResize();
// eslint-disable-next-line
}, [rtl]);
// ========================= Render ========================
const hasDropdown = !!hiddenTabs.length;
const wrapPrefix = `${prefixCls}-nav-wrap`;
let pingLeft;
let pingRight;
let pingTop;
let pingBottom;
if (tabPositionTopOrBottom) {
if (rtl) {
pingRight = transformLeft > 0;
pingLeft = transformLeft !== transformMax;
} else {
pingLeft = transformLeft < 0;
pingRight = transformLeft !== transformMin;
}
} else {
pingTop = transformTop < 0;
pingBottom = transformTop !== transformMin;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(resize_observer_es, {
onResize: onListHolderResize
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: (0,es_ref.useComposeRef)(ref, containerRef),
role: "tablist",
"aria-orientation": tabPositionTopOrBottom ? 'horizontal' : 'vertical',
className: (0,clsx.clsx)(`${prefixCls}-nav`, className, tabsClassNames?.header),
style: {
...styles?.header,
...style
},
onKeyDown: () => {
// No need animation when use keyboard
doLockAnimation();
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TabNavList_ExtraContent, {
ref: extraLeftRef,
position: "left",
extra: extra,
prefixCls: prefixCls
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(resize_observer_es, {
onResize: onListHolderResize
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(wrapPrefix, {
[`${wrapPrefix}-ping-left`]: pingLeft,
[`${wrapPrefix}-ping-right`]: pingRight,
[`${wrapPrefix}-ping-top`]: pingTop,
[`${wrapPrefix}-ping-bottom`]: pingBottom
}),
ref: tabsWrapperRef
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(resize_observer_es, {
onResize: onListHolderResize
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: tabListRef,
className: `${prefixCls}-nav-list`,
style: {
transform: `translate(${transformLeft}px, ${transformTop}px)`,
transition: lockAnimation ? 'none' : undefined
}
}, tabNodes, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TabNavList_AddButton, {
ref: innerAddButtonRef,
prefixCls: prefixCls,
locale: locale,
editable: editable,
style: {
...(tabNodes.length === 0 ? undefined : tabNodeStyle),
visibility: hasDropdown ? 'hidden' : null
}
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-ink-bar`, tabsClassNames?.indicator, {
[`${prefixCls}-ink-bar-animated`]: animated.inkBar
}),
style: {
...indicatorStyle,
...styles?.indicator
}
}))))), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TabNavList_OperationNode, TabNavList_extends({}, props, {
removeAriaLabel: locale?.removeAriaLabel,
ref: operationsRef,
prefixCls: prefixCls,
tabs: hiddenTabs,
className: !hasDropdown && operationsHiddenClassName,
popupStyle: styles?.popup,
tabMoving: !!lockAnimation
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TabNavList_ExtraContent, {
ref: extraRightRef,
position: "right",
extra: extra,
prefixCls: prefixCls
})));
/* eslint-enable */
});
/* harmony default export */ var es_TabNavList = (TabNavList);
;// ./node_modules/@rc-component/tabs/es/TabNavList/Wrapper.js
// zombieJ: To compatible with `renderTabBar` usage.
// We have to create a TabNavList components.
const TabNavListWrapper = ({
renderTabBar,
...restProps
}) => {
if (renderTabBar) {
return renderTabBar(restProps, es_TabNavList);
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_TabNavList, restProps);
};
if (true) {
TabNavListWrapper.displayName = 'TabNavListWrapper';
}
/* harmony default export */ var TabNavList_Wrapper = (TabNavListWrapper);
;// ./node_modules/@rc-component/tabs/es/TabPanelList/TabPane.js
const TabPane = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls,
className,
style,
id,
active,
tabKey,
children
} = props;
const hasContent = external_root_React_commonjs2_react_commonjs_react_amd_react_.Children.count(children) > 0;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
id: id && `${id}-panel-${tabKey}`,
role: "tabpanel",
tabIndex: active && hasContent ? 0 : -1,
"aria-labelledby": id && `${id}-tab-${tabKey}`,
"aria-hidden": !active,
style: style,
className: (0,clsx.clsx)(prefixCls, active && `${prefixCls}-active`, className),
ref: ref
}, children);
});
if (true) {
TabPane.displayName = 'TabPane';
}
/* harmony default export */ var TabPanelList_TabPane = (TabPane);
;// ./node_modules/@rc-component/tabs/es/TabPanelList/index.js
function TabPanelList_extends() { TabPanelList_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return TabPanelList_extends.apply(this, arguments); }
const TabPanelList = props => {
const {
id,
activeKey,
animated,
tabPosition,
destroyOnHidden,
contentStyle,
contentClassName
} = props;
const {
prefixCls,
tabs
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(TabContext);
const tabPaneAnimated = animated.tabPane;
const tabPanePrefixCls = `${prefixCls}-tabpane`;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-content-holder`)
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-content`, `${prefixCls}-content-${tabPosition}`, {
[`${prefixCls}-content-animated`]: tabPaneAnimated
})
}, tabs.map(item => {
const {
key,
forceRender,
style: paneStyle,
className: paneClassName,
destroyOnHidden: itemDestroyOnHidden,
...restTabProps
} = item;
const active = key === activeKey;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es["default"], TabPanelList_extends({
key: key,
visible: active,
forceRender: forceRender,
removeOnLeave: !!(destroyOnHidden ?? itemDestroyOnHidden),
leavedClassName: `${tabPanePrefixCls}-hidden`
}, animated.tabPaneMotion), ({
style: motionStyle,
className: motionClassName
}, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TabPanelList_TabPane, TabPanelList_extends({}, restTabProps, {
prefixCls: tabPanePrefixCls,
id: id,
tabKey: key,
animated: tabPaneAnimated,
active: active,
style: {
...contentStyle,
...paneStyle,
...motionStyle
},
className: (0,clsx.clsx)(contentClassName, paneClassName, motionClassName),
ref: ref
})));
})));
};
/* harmony default export */ var es_TabPanelList = (TabPanelList);
;// ./node_modules/@rc-component/tabs/es/hooks/useAnimateConfig.js
function useAnimateConfig(animated = {
inkBar: true,
tabPane: false
}) {
let mergedAnimated;
if (animated === false) {
mergedAnimated = {
inkBar: false,
tabPane: false
};
} else if (animated === true) {
mergedAnimated = {
inkBar: true,
tabPane: false
};
} else {
mergedAnimated = {
inkBar: true,
...(typeof animated === 'object' ? animated : {})
};
}
// Enable tabPane animation if provide motion
if (mergedAnimated.tabPaneMotion && mergedAnimated.tabPane === undefined) {
mergedAnimated.tabPane = true;
}
if (!mergedAnimated.tabPaneMotion && mergedAnimated.tabPane) {
if (true) {
(0,warning["default"])(false, '`animated.tabPane` is true but `animated.tabPaneMotion` is not provided. Motion will not work.');
}
mergedAnimated.tabPane = false;
}
return mergedAnimated;
}
;// ./node_modules/@rc-component/tabs/es/Tabs.js
function Tabs_extends() { Tabs_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Tabs_extends.apply(this, arguments); }
// Accessibility https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Tab_Role
/**
* Should added antd:
* - type
*
* Removed:
* - onNextClick
* - onPrevClick
* - keyboard
*/
// Used for accessibility
let Tabs_uuid = 0;
const Tabs = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
id,
prefixCls = 'rc-tabs',
className,
items,
direction,
activeKey,
defaultActiveKey,
editable,
animated,
tabPosition = 'top',
tabBarGutter,
tabBarStyle,
tabBarExtraContent,
locale,
more,
destroyOnHidden,
renderTabBar,
onChange,
onTabClick,
onTabScroll,
getPopupContainer,
popupClassName,
indicator,
classNames: tabsClassNames,
styles,
...restProps
} = props;
const tabs = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => (items || []).filter(item => item && typeof item === 'object' && 'key' in item), [items]);
const rtl = direction === 'rtl';
const mergedAnimated = useAnimateConfig(animated);
// ======================== Mobile ========================
const [mobile, setMobile] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
// Only update on the client side
setMobile(isMobile());
}, []);
// ====================== Active Key ======================
const [mergedActiveKey, setMergedActiveKey] = (0,useControlledState["default"])(defaultActiveKey ?? tabs[0]?.key, activeKey);
const [activeIndex, setActiveIndex] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(() => tabs.findIndex(tab => tab.key === mergedActiveKey));
// Reset active key if not exist anymore
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
let newActiveIndex = tabs.findIndex(tab => tab.key === mergedActiveKey);
if (newActiveIndex === -1) {
newActiveIndex = Math.max(0, Math.min(activeIndex, tabs.length - 1));
setMergedActiveKey(tabs[newActiveIndex]?.key);
}
setActiveIndex(newActiveIndex);
}, [tabs.map(tab => tab.key).join('_'), mergedActiveKey, activeIndex]);
// ===================== Accessibility ====================
const [mergedId, setMergedId] = (0,useControlledState["default"])(null, id);
// Async generate id to avoid ssr mapping failed
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (!id) {
setMergedId(`rc-tabs-${ false ? 0 : Tabs_uuid}`);
Tabs_uuid += 1;
}
}, []);
// ======================== Events ========================
function onInternalTabClick(key, e) {
onTabClick?.(key, e);
const isActiveChanged = key !== mergedActiveKey;
setMergedActiveKey(key);
if (isActiveChanged) {
onChange?.(key);
}
}
// ======================== Render ========================
const sharedProps = {
id: mergedId,
activeKey: mergedActiveKey,
animated: mergedAnimated,
tabPosition,
rtl,
mobile
};
const tabNavBarProps = {
...sharedProps,
editable,
locale,
more,
tabBarGutter,
onTabClick: onInternalTabClick,
onTabScroll,
extra: tabBarExtraContent,
style: tabBarStyle,
getPopupContainer,
popupClassName: (0,clsx.clsx)(popupClassName, tabsClassNames?.popup),
indicator,
styles,
classNames: tabsClassNames
};
const memoizedValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
return {
tabs,
prefixCls
};
}, [tabs, prefixCls]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TabContext.Provider, {
value: memoizedValue
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", Tabs_extends({
ref: ref,
id: id,
className: (0,clsx.clsx)(prefixCls, `${prefixCls}-${tabPosition}`, {
[`${prefixCls}-mobile`]: mobile,
[`${prefixCls}-editable`]: editable,
[`${prefixCls}-rtl`]: rtl
}, className)
}, restProps), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TabNavList_Wrapper, Tabs_extends({}, tabNavBarProps, {
renderTabBar: renderTabBar
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_TabPanelList, Tabs_extends({
destroyOnHidden: destroyOnHidden
}, sharedProps, {
contentStyle: styles?.content,
contentClassName: tabsClassNames?.content,
animated: mergedAnimated
}))));
});
if (true) {
Tabs.displayName = 'Tabs';
}
/* harmony default export */ var es_Tabs = (Tabs);
;// ./node_modules/@rc-component/tabs/es/index.js
/* harmony default export */ var tabs_es = (es_Tabs);
;// ./components/tabs/hooks/useAnimateConfig.ts
const motion = {
motionAppear: false,
motionEnter: true,
motionLeave: true
};
function useAnimateConfig_useAnimateConfig(prefixCls, animated = {
inkBar: true,
tabPane: false
}) {
let mergedAnimated;
if (animated === false) {
mergedAnimated = {
inkBar: false,
tabPane: false
};
} else if (animated === true) {
mergedAnimated = {
inkBar: true,
tabPane: true
};
} else {
mergedAnimated = {
inkBar: true,
...((0,is.isPlainObject)(animated) ? animated : {})
};
}
if (mergedAnimated.tabPane) {
mergedAnimated.tabPaneMotion = {
...motion,
motionName: (0,_util_motion.getTransitionName)(prefixCls, 'switch')
};
}
return mergedAnimated;
}
;// ./components/tabs/hooks/useLegacyItems.ts
function filter(items) {
return items.filter(item => item);
}
function useLegacyItems(items, children) {
if (true) {
const warning = (0,_util_warning.devUseWarning)('Tabs');
warning.deprecated(!children, 'Tabs.TabPane', 'items');
}
if (items) {
return items.map(item => ({
...item,
destroyOnHidden: item.destroyOnHidden ?? item.destroyInactiveTabPane
}));
}
const childrenItems = (0,es.toArray)(children).map(node => {
if (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(node)) {
const {
key,
props
} = node;
const {
tab,
...restProps
} = props || {};
const item = {
key: String(key),
...restProps,
label: tab
};
return item;
}
return null;
});
return filter(childrenItems);
}
/* harmony default export */ var hooks_useLegacyItems = (useLegacyItems);
// EXTERNAL MODULE: ./components/tabs/style/index.ts + 1 modules
var tabs_style = __webpack_require__("./components/tabs/style/index.ts");
;// ./components/tabs/TabPane.ts
const TabPane_TabPane = () => null;
if (true) {
TabPane_TabPane.displayName = 'DeprecatedTabPane';
}
/* harmony default export */ var tabs_TabPane = (TabPane_TabPane);
;// ./components/tabs/index.tsx
const InternalTabs = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
type,
className,
rootClassName,
size: customSize,
onEdit,
hideAdd,
centered,
addIcon,
removeIcon,
moreIcon,
more,
popupClassName,
children,
items,
animated,
style,
indicatorSize,
indicator,
classNames,
styles,
destroyInactiveTabPane,
destroyOnHidden,
tabPlacement,
tabPosition,
...restProps
} = props;
const {
prefixCls: customizePrefixCls
} = restProps;
const {
getPrefixCls,
direction,
getPopupContainer,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('tabs');
const {
tabs
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('tabs', customizePrefixCls);
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,tabs_style["default"])(prefixCls, rootCls);
const tabsRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
nativeElement: tabsRef.current
}));
let editable;
if (type === 'editable-card') {
editable = {
onEdit: (editType, {
key,
event
}) => {
onEdit?.(editType === 'add' ? event : key, editType);
},
removeIcon: removeIcon ?? tabs?.removeIcon ?? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CloseOutlined, null),
addIcon: (addIcon ?? tabs?.addIcon) || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_PlusOutlined, null),
showAdd: hideAdd !== true
};
}
const rootPrefixCls = getPrefixCls();
if (true) {
const warning = (0,_util_warning.devUseWarning)('Tabs');
[['popupClassName', 'classNames.popup'], ['tabPosition', 'tabPlacement']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
true ? warning(!('onPrevClick' in props) && !('onNextClick' in props), 'breaking', '`onPrevClick` and `onNextClick` has been removed. Please use `onTabScroll` instead.') : 0;
true ? warning(!(indicatorSize || tabs?.indicatorSize), 'deprecated', '`indicatorSize` has been deprecated. Please use `indicator={{ size: ... }}` instead.') : 0;
warning.deprecated(!('destroyInactiveTabPane' in props || items?.some(item => 'destroyInactiveTabPane' in item)), 'destroyInactiveTabPane', 'destroyOnHidden');
}
const size = (0,useSize["default"])(customSize);
const mergedItems = hooks_useLegacyItems(items, children);
const mergedAnimated = useAnimateConfig_useAnimateConfig(prefixCls, animated);
const mergedIndicator = {
align: indicator?.align ?? tabs?.indicator?.align,
size: indicator?.size ?? indicatorSize ?? tabs?.indicator?.size ?? tabs?.indicatorSize
};
const mergedPlacement = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const placement = tabPlacement ?? tabPosition ?? undefined;
const isRTL = direction === 'rtl';
switch (placement) {
case 'start':
return isRTL ? 'right' : 'left';
case 'end':
return isRTL ? 'left' : 'right';
default:
return placement;
}
}, [tabPlacement, tabPosition, direction]);
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
size,
tabPlacement: mergedPlacement,
items: mergedItems
};
// ========================= Style ==========================
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
}, {
popup: {
_default: 'root'
}
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(tabs_es, {
ref: tabsRef,
direction: direction,
getPopupContainer: getPopupContainer,
...restProps,
items: mergedItems,
className: (0,clsx.clsx)({
[`${prefixCls}-large`]: size === 'large',
[`${prefixCls}-small`]: size === 'small',
[`${prefixCls}-card`]: ['card', 'editable-card'].includes(type),
[`${prefixCls}-editable-card`]: type === 'editable-card',
[`${prefixCls}-centered`]: centered
}, contextClassName, className, rootClassName, mergedClassNames.root, hashId, cssVarCls, rootCls),
classNames: {
...mergedClassNames,
popup: (0,clsx.clsx)(popupClassName, hashId, cssVarCls, rootCls, mergedClassNames.popup?.root)
},
styles: mergedStyles,
style: {
...mergedStyles.root,
...contextStyle,
...style
},
editable: editable,
more: {
icon: tabs?.more?.icon ?? tabs?.moreIcon ?? moreIcon ?? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_EllipsisOutlined, null),
transitionName: `${rootPrefixCls}-slide-up`,
...more
},
prefixCls: prefixCls,
animated: mergedAnimated,
indicator: mergedIndicator,
destroyOnHidden: destroyOnHidden ?? destroyInactiveTabPane,
tabPosition: mergedPlacement
});
});
const tabs_Tabs = InternalTabs;
tabs_Tabs.TabPane = tabs_TabPane;
if (true) {
tabs_Tabs.displayName = 'Tabs';
}
/* harmony default export */ var components_tabs = (tabs_Tabs);
;// ./components/card/CardGrid.tsx
const CardGrid = ({
prefixCls,
className,
hoverable = true,
...rest
}) => {
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefix = getPrefixCls('card', prefixCls);
const classString = (0,clsx.clsx)(`${prefix}-grid`, className, {
[`${prefix}-grid-hoverable`]: hoverable
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
...rest,
className: classString
});
};
if (true) {
CardGrid.displayName = 'CardGrid';
}
/* harmony default export */ var card_CardGrid = (CardGrid);
// EXTERNAL MODULE: ./components/card/style/index.ts
var card_style = __webpack_require__("./components/card/style/index.ts");
;// ./components/card/Card.tsx
const ActionNode = props => {
const {
actionClasses,
actions = [],
actionStyle
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("ul", {
className: actionClasses,
style: actionStyle
}, actions.map((action, index) => {
// Move this out since eslint not allow index key
// And eslint-disable makes conflict with rollup
// ref https://github.com/ant-design/ant-design/issues/46022
const key = `action-${index}`;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("li", {
style: {
width: `${100 / actions.length}%`
},
key: key
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", null, action));
}));
};
const Card = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
style,
extra,
headStyle = {},
bodyStyle = {},
title,
loading,
bordered,
variant: customVariant,
size: customizeSize,
type,
cover,
actions,
tabList,
children,
activeTabKey,
defaultActiveTabKey,
tabBarExtraContent,
hoverable,
tabProps = {},
classNames,
styles,
...rest
} = props;
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('card');
const [variant] = useVariants('card', customVariant, bordered);
if (true) {
const warning = (0,_util_warning.devUseWarning)('Card');
warning.deprecated(customizeSize !== 'default', 'size="default"', 'size="medium"');
}
const mergedSize = (0,useSize["default"])(customizeSize);
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
size: mergedSize,
variant: variant
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
// =================Warning===================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Card');
[['headStyle', 'styles.header'], ['bodyStyle', 'styles.body'], ['bordered', 'variant']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
}
const onTabChange = key => {
props.onTabChange?.(key);
};
const childNodes = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => (0,es.toArray)(children), [children]);
const isContainGrid = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => childNodes.some(child => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(child) && child.type === card_CardGrid), [childNodes]);
const prefixCls = getPrefixCls('card', customizePrefixCls);
const [hashId, cssVarCls] = (0,card_style["default"])(prefixCls);
const loadingBlock = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(skeleton, {
loading: true,
active: true,
paragraph: {
rows: 4
},
title: false
}, children);
const hasActiveTabKey = activeTabKey !== undefined;
const extraProps = {
...tabProps,
[hasActiveTabKey ? 'activeKey' : 'defaultActiveKey']: hasActiveTabKey ? activeTabKey : defaultActiveTabKey,
tabBarExtraContent
};
let head;
const tabSize = mergedSize !== 'small' ? 'large' : mergedSize;
const tabs = tabList ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_tabs, {
size: tabSize,
...extraProps,
className: `${prefixCls}-head-tabs`,
onChange: onTabChange,
items: tabList.map(({
tab,
...item
}) => ({
label: tab,
...item
}))
})) : null;
if (title || extra || tabs) {
const headClasses = (0,clsx.clsx)(`${prefixCls}-head`, mergedClassNames.header);
const titleClasses = (0,clsx.clsx)(`${prefixCls}-head-title`, mergedClassNames.title);
const extraClasses = (0,clsx.clsx)(`${prefixCls}-extra`, mergedClassNames.extra);
const mergedHeadStyle = {
...headStyle,
...mergedStyles.header
};
head = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: headClasses,
style: mergedHeadStyle
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-head-wrapper`
}, title && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: titleClasses,
style: mergedStyles.title
}, title)), extra && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: extraClasses,
style: mergedStyles.extra
}, extra))), tabs);
}
const coverClasses = (0,clsx.clsx)(`${prefixCls}-cover`, mergedClassNames.cover);
const coverDom = cover ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: coverClasses,
style: mergedStyles.cover
}, cover)) : null;
const bodyClasses = (0,clsx.clsx)(`${prefixCls}-body`, mergedClassNames.body);
const mergedBodyStyle = {
...bodyStyle,
...mergedStyles.body
};
const body = loading || childNodes.length ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: bodyClasses,
style: mergedBodyStyle
}, loading ? loadingBlock : children)) : null;
const actionClasses = (0,clsx.clsx)(`${prefixCls}-actions`, mergedClassNames.actions);
const actionDom = actions?.length ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(ActionNode, {
actionClasses: actionClasses,
actionStyle: mergedStyles.actions,
actions: actions
})) : null;
const divProps = (0,es.omit)(rest, ['onTabChange']);
const classString = (0,clsx.clsx)(prefixCls, contextClassName, {
[`${prefixCls}-loading`]: loading,
[`${prefixCls}-bordered`]: variant !== 'borderless',
[`${prefixCls}-hoverable`]: hoverable,
[`${prefixCls}-contain-grid`]: isContainGrid,
[`${prefixCls}-contain-tabs`]: tabList?.length,
[`${prefixCls}-small`]: mergedSize === 'small',
[`${prefixCls}-type-${type}`]: !!type,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, rootClassName, hashId, cssVarCls, mergedClassNames.root);
const mergedStyle = {
...mergedStyles.root,
...contextStyle,
...style
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: ref,
...divProps,
className: classString,
style: mergedStyle
}, head, coverDom, body, actionDom);
});
if (true) {
Card.displayName = 'Card';
}
/* harmony default export */ var card_Card = (Card);
;// ./components/card/CardMeta.tsx
const CardMeta = props => {
const {
prefixCls: customizePrefixCls,
className,
avatar,
title,
description,
style,
classNames: cardMetaClassNames,
styles,
...restProps
} = props;
const {
getPrefixCls,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('cardMeta');
const prefixCls = getPrefixCls('card', customizePrefixCls);
const metaPrefixCls = `${prefixCls}-meta`;
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, cardMetaClassNames], [contextStyles, styles], {
props
});
const rootClassNames = (0,clsx.clsx)(metaPrefixCls, className, contextClassName, mergedClassNames.root);
const rootStyles = {
...contextStyle,
...mergedStyles.root,
...style
};
const avatarClassNames = (0,clsx.clsx)(`${metaPrefixCls}-avatar`, mergedClassNames.avatar);
const titleClassNames = (0,clsx.clsx)(`${metaPrefixCls}-title`, mergedClassNames.title);
const descriptionClassNames = (0,clsx.clsx)(`${metaPrefixCls}-description`, mergedClassNames.description);
const sectionClassNames = (0,clsx.clsx)(`${metaPrefixCls}-section`, mergedClassNames.section);
const avatarDom = avatar ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: avatarClassNames,
style: mergedStyles.avatar
}, avatar)) : null;
const titleDom = title ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: titleClassNames,
style: mergedStyles.title
}, title)) : null;
const descriptionDom = description ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: descriptionClassNames,
style: mergedStyles.description
}, description)) : null;
const MetaDetail = titleDom || descriptionDom ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: sectionClassNames,
style: mergedStyles.section
}, titleDom, descriptionDom)) : null;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
...restProps,
className: rootClassNames,
style: rootStyles
}, avatarDom, MetaDetail);
};
if (true) {
CardMeta.displayName = 'CardMeta';
}
/* harmony default export */ var card_CardMeta = (CardMeta);
;// ./components/card/index.tsx
const components_card_Card = card_Card;
components_card_Card.Grid = card_CardGrid;
components_card_Card.Meta = card_CardMeta;
/* harmony default export */ var card = (components_card_Card);
;// ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
function objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(r, e) {
if (null == r) return {};
var t = {};
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
if (-1 !== e.indexOf(n)) continue;
t[n] = r[n];
}
return t;
}
;// ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
function objectWithoutProperties_objectWithoutProperties(e, t) {
if (null == e) return {};
var o,
r,
i = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(e, t);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(e);
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
}
return i;
}
;// ./node_modules/@ant-design/react-slick/es/initial-state.js
var initialState = {
animating: false,
autoplaying: null,
currentDirection: 0,
currentLeft: null,
currentSlide: 0,
direction: 1,
dragging: false,
edgeDragged: false,
initialized: false,
lazyLoadedList: [],
listHeight: null,
listWidth: null,
scrolling: false,
slideCount: null,
slideHeight: null,
slideWidth: null,
swipeLeft: null,
swiped: false,
// used by swipeEvent. differentites between touch and swipe.
swiping: false,
touchObject: {
startX: 0,
startY: 0,
curX: 0,
curY: 0
},
trackStyle: {},
trackWidth: 0,
targetSlide: 0
};
/* harmony default export */ var initial_state = (initialState);
;// ./node_modules/throttle-debounce/esm/index.js
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
/**
* Throttle execution of a function. Especially useful for rate limiting
* execution of handlers on events like resize and scroll.
*
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
* are most useful.
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
* as-is, to `callback` when the throttled-function is executed.
* @param {object} [options] - An object to configure options.
* @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
* while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
* one final time after the last throttled-function call. (After the throttled-function has not been called for
* `delay` milliseconds, the internal counter is reset).
* @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
* immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
* callback will never executed if both noLeading = true and noTrailing = true.
* @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
* false (at end), schedule `callback` to execute after `delay` ms.
*
* @returns {Function} A new, throttled, function.
*/
function throttle (delay, callback, options) {
var _ref = options || {},
_ref$noTrailing = _ref.noTrailing,
noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,
_ref$noLeading = _ref.noLeading,
noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,
_ref$debounceMode = _ref.debounceMode,
debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;
/*
* After wrapper has stopped being called, this timeout ensures that
* `callback` is executed at the proper times in `throttle` and `end`
* debounce modes.
*/
var timeoutID;
var cancelled = false;
// Keep track of the last time `callback` was executed.
var lastExec = 0;
// Function to clear existing timeout
function clearExistingTimeout() {
if (timeoutID) {
clearTimeout(timeoutID);
}
}
// Function to cancel next exec
function cancel(options) {
var _ref2 = options || {},
_ref2$upcomingOnly = _ref2.upcomingOnly,
upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
clearExistingTimeout();
cancelled = !upcomingOnly;
}
/*
* The `wrapper` function encapsulates all of the throttling / debouncing
* functionality and when executed will limit the rate at which `callback`
* is executed.
*/
function wrapper() {
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
arguments_[_key] = arguments[_key];
}
var self = this;
var elapsed = Date.now() - lastExec;
if (cancelled) {
return;
}
// Execute `callback` and update the `lastExec` timestamp.
function exec() {
lastExec = Date.now();
callback.apply(self, arguments_);
}
/*
* If `debounceMode` is true (at begin) this is used to clear the flag
* to allow future `callback` executions.
*/
function clear() {
timeoutID = undefined;
}
if (!noLeading && debounceMode && !timeoutID) {
/*
* Since `wrapper` is being called for the first time and
* `debounceMode` is true (at begin), execute `callback`
* and noLeading != true.
*/
exec();
}
clearExistingTimeout();
if (debounceMode === undefined && elapsed > delay) {
if (noLeading) {
/*
* In throttle mode with noLeading, if `delay` time has
* been exceeded, update `lastExec` and schedule `callback`
* to execute after `delay` ms.
*/
lastExec = Date.now();
if (!noTrailing) {
timeoutID = setTimeout(debounceMode ? clear : exec, delay);
}
} else {
/*
* In throttle mode without noLeading, if `delay` time has been exceeded, execute
* `callback`.
*/
exec();
}
} else if (noTrailing !== true) {
/*
* In trailing throttle mode, since `delay` time has not been
* exceeded, schedule `callback` to execute `delay` ms after most
* recent execution.
*
* If `debounceMode` is true (at begin), schedule `clear` to execute
* after `delay` ms.
*
* If `debounceMode` is false (at end), schedule `callback` to
* execute after `delay` ms.
*/
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
}
}
wrapper.cancel = cancel;
// Return the wrapper function.
return wrapper;
}
/* eslint-disable no-undefined */
/**
* Debounce execution of a function. Debouncing, unlike throttling,
* guarantees that a function is only executed a single time, either at the
* very beginning of a series of calls, or at the very end.
*
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
* to `callback` when the debounced-function is executed.
* @param {object} [options] - An object to configure options.
* @param {boolean} [options.atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds
* after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.
* (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).
*
* @returns {Function} A new, debounced function.
*/
function debounce (delay, callback, options) {
var _ref = options || {},
_ref$atBegin = _ref.atBegin,
atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;
return throttle(delay, callback, {
debounceMode: atBegin !== false
});
}
//# sourceMappingURL=index.js.map
;// ./node_modules/@ant-design/react-slick/es/default-props.js
var defaultProps = {
accessibility: true,
adaptiveHeight: false,
afterChange: null,
appendDots: function appendDots(dots) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("ul", {
style: {
display: "block"
}
}, dots);
},
arrows: true,
autoplay: false,
autoplaySpeed: 3000,
beforeChange: null,
centerMode: false,
centerPadding: "50px",
className: "",
cssEase: "ease",
customPaging: function customPaging(i) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", null, i + 1);
},
dots: false,
dotsClass: "slick-dots",
draggable: true,
easing: "linear",
edgeFriction: 0.35,
fade: false,
focusOnSelect: false,
infinite: true,
initialSlide: 0,
lazyLoad: null,
nextArrow: null,
onEdge: null,
onInit: null,
onLazyLoadError: null,
onReInit: null,
pauseOnDotsHover: false,
pauseOnFocus: false,
pauseOnHover: true,
prevArrow: null,
responsive: null,
rows: 1,
rtl: false,
slide: "div",
slidesPerRow: 1,
slidesToScroll: 1,
slidesToShow: 1,
speed: 500,
swipe: true,
swipeEvent: null,
swipeToSlide: false,
touchMove: true,
touchThreshold: 5,
useCSS: true,
useTransform: true,
variableWidth: false,
vertical: false,
verticalSwiping: false,
waitForAnimate: true,
asNavFor: null,
unslick: false
};
/* harmony default export */ var default_props = (defaultProps);
;// ./node_modules/@ant-design/react-slick/es/utils/innerSliderUtils.js
function clamp(number, lowerBound, upperBound) {
return Math.max(lowerBound, Math.min(number, upperBound));
}
var safePreventDefault = function safePreventDefault(event) {
var passiveEvents = ["onTouchStart", "onTouchMove", "onWheel"];
if (!passiveEvents.includes(event._reactName)) {
event.preventDefault();
}
};
var getOnDemandLazySlides = function getOnDemandLazySlides(spec) {
var onDemandSlides = [];
var startIndex = lazyStartIndex(spec);
var endIndex = lazyEndIndex(spec);
for (var slideIndex = startIndex; slideIndex < endIndex; slideIndex++) {
if (spec.lazyLoadedList.indexOf(slideIndex) < 0) {
onDemandSlides.push(slideIndex);
}
}
return onDemandSlides;
};
// return list of slides that need to be present
var getRequiredLazySlides = function getRequiredLazySlides(spec) {
var requiredSlides = [];
var startIndex = lazyStartIndex(spec);
var endIndex = lazyEndIndex(spec);
for (var slideIndex = startIndex; slideIndex < endIndex; slideIndex++) {
requiredSlides.push(slideIndex);
}
return requiredSlides;
};
// startIndex that needs to be present
var lazyStartIndex = function lazyStartIndex(spec) {
return spec.currentSlide - lazySlidesOnLeft(spec);
};
var lazyEndIndex = function lazyEndIndex(spec) {
return spec.currentSlide + lazySlidesOnRight(spec);
};
var lazySlidesOnLeft = function lazySlidesOnLeft(spec) {
return spec.centerMode ? Math.floor(spec.slidesToShow / 2) + (parseInt(spec.centerPadding) > 0 ? 1 : 0) : 0;
};
var lazySlidesOnRight = function lazySlidesOnRight(spec) {
return spec.centerMode ? Math.floor((spec.slidesToShow - 1) / 2) + 1 + (parseInt(spec.centerPadding) > 0 ? 1 : 0) : spec.slidesToShow;
};
// get width of an element
var innerSliderUtils_getWidth = function getWidth(elem) {
return elem && elem.offsetWidth || 0;
};
var getHeight = function getHeight(elem) {
return elem && elem.offsetHeight || 0;
};
var getSwipeDirection = function getSwipeDirection(touchObject) {
var verticalSwiping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var xDist, yDist, r, swipeAngle;
xDist = touchObject.startX - touchObject.curX;
yDist = touchObject.startY - touchObject.curY;
r = Math.atan2(yDist, xDist);
swipeAngle = Math.round(r * 180 / Math.PI);
if (swipeAngle < 0) {
swipeAngle = 360 - Math.abs(swipeAngle);
}
if (swipeAngle <= 45 && swipeAngle >= 0 || swipeAngle <= 360 && swipeAngle >= 315) {
return "left";
}
if (swipeAngle >= 135 && swipeAngle <= 225) {
return "right";
}
if (verticalSwiping === true) {
if (swipeAngle >= 35 && swipeAngle <= 135) {
return "up";
} else {
return "down";
}
}
return "vertical";
};
// whether or not we can go next
var canGoNext = function canGoNext(spec) {
var canGo = true;
if (!spec.infinite) {
if (spec.centerMode && spec.currentSlide >= spec.slideCount - 1) {
canGo = false;
} else if (spec.slideCount <= spec.slidesToShow || spec.currentSlide >= spec.slideCount - spec.slidesToShow) {
canGo = false;
}
}
return canGo;
};
// given an object and a list of keys, return new object with given keys
var extractObject = function extractObject(spec, keys) {
var newObject = {};
keys.forEach(function (key) {
return newObject[key] = spec[key];
});
return newObject;
};
// get initialized state
var initializedState = function initializedState(spec) {
// spec also contains listRef, trackRef
var slideCount = external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.count(spec.children);
var listNode = spec.listRef;
var listWidth = Math.ceil(innerSliderUtils_getWidth(listNode));
var trackNode = spec.trackRef && spec.trackRef.node;
var trackWidth = Math.ceil(innerSliderUtils_getWidth(trackNode));
var slideWidth;
if (!spec.vertical) {
var centerPaddingAdj = spec.centerMode && parseInt(spec.centerPadding) * 2;
if (typeof spec.centerPadding === "string" && spec.centerPadding.slice(-1) === "%") {
centerPaddingAdj *= listWidth / 100;
}
slideWidth = Math.ceil((listWidth - centerPaddingAdj) / spec.slidesToShow);
} else {
slideWidth = listWidth;
}
var slideHeight = listNode && getHeight(listNode.querySelector('[data-index="0"]'));
var listHeight = slideHeight * spec.slidesToShow;
var currentSlide = spec.currentSlide === undefined ? spec.initialSlide : spec.currentSlide;
if (spec.rtl && spec.currentSlide === undefined) {
currentSlide = slideCount - 1 - spec.initialSlide;
}
var lazyLoadedList = spec.lazyLoadedList || [];
var slidesToLoad = getOnDemandLazySlides((0,objectSpread2["default"])((0,objectSpread2["default"])({}, spec), {}, {
currentSlide: currentSlide,
lazyLoadedList: lazyLoadedList
}));
lazyLoadedList = lazyLoadedList.concat(slidesToLoad);
var state = {
slideCount: slideCount,
slideWidth: slideWidth,
listWidth: listWidth,
trackWidth: trackWidth,
currentSlide: currentSlide,
slideHeight: slideHeight,
listHeight: listHeight,
lazyLoadedList: lazyLoadedList
};
if (spec.autoplaying === null && spec.autoplay) {
state["autoplaying"] = "playing";
}
return state;
};
var slideHandler = function slideHandler(spec) {
var waitForAnimate = spec.waitForAnimate,
animating = spec.animating,
fade = spec.fade,
infinite = spec.infinite,
index = spec.index,
slideCount = spec.slideCount,
lazyLoad = spec.lazyLoad,
currentSlide = spec.currentSlide,
centerMode = spec.centerMode,
slidesToScroll = spec.slidesToScroll,
slidesToShow = spec.slidesToShow,
useCSS = spec.useCSS;
var lazyLoadedList = spec.lazyLoadedList;
if (waitForAnimate && animating) return {};
var animationSlide = index,
finalSlide,
animationLeft,
finalLeft;
var state = {},
nextState = {};
var targetSlide = infinite ? index : clamp(index, 0, slideCount - 1);
if (fade) {
if (!infinite && (index < 0 || index >= slideCount)) return {};
if (index < 0) {
animationSlide = index + slideCount;
} else if (index >= slideCount) {
animationSlide = index - slideCount;
}
if (lazyLoad && lazyLoadedList.indexOf(animationSlide) < 0) {
lazyLoadedList = lazyLoadedList.concat(animationSlide);
}
state = {
animating: true,
currentSlide: animationSlide,
lazyLoadedList: lazyLoadedList,
targetSlide: animationSlide
};
nextState = {
animating: false,
targetSlide: animationSlide
};
} else {
finalSlide = animationSlide;
if (animationSlide < 0) {
finalSlide = animationSlide + slideCount;
if (!infinite) finalSlide = 0;else if (slideCount % slidesToScroll !== 0) finalSlide = slideCount - slideCount % slidesToScroll;
} else if (!canGoNext(spec) && animationSlide > currentSlide) {
animationSlide = finalSlide = currentSlide;
} else if (centerMode && animationSlide >= slideCount) {
animationSlide = infinite ? slideCount : slideCount - 1;
finalSlide = infinite ? 0 : slideCount - 1;
} else if (animationSlide >= slideCount) {
finalSlide = animationSlide - slideCount;
if (!infinite) finalSlide = slideCount - slidesToShow;else if (slideCount % slidesToScroll !== 0) finalSlide = 0;
}
if (!infinite && animationSlide + slidesToShow >= slideCount) {
finalSlide = slideCount - slidesToShow;
}
animationLeft = getTrackLeft((0,objectSpread2["default"])((0,objectSpread2["default"])({}, spec), {}, {
slideIndex: animationSlide
}));
finalLeft = getTrackLeft((0,objectSpread2["default"])((0,objectSpread2["default"])({}, spec), {}, {
slideIndex: finalSlide
}));
if (!infinite) {
if (animationLeft === finalLeft) animationSlide = finalSlide;
animationLeft = finalLeft;
}
if (lazyLoad) {
lazyLoadedList = lazyLoadedList.concat(getOnDemandLazySlides((0,objectSpread2["default"])((0,objectSpread2["default"])({}, spec), {}, {
currentSlide: animationSlide
})));
}
if (!useCSS) {
state = {
currentSlide: finalSlide,
trackStyle: getTrackCSS((0,objectSpread2["default"])((0,objectSpread2["default"])({}, spec), {}, {
left: finalLeft
})),
lazyLoadedList: lazyLoadedList,
targetSlide: targetSlide
};
} else {
state = {
animating: true,
currentSlide: finalSlide,
trackStyle: getTrackAnimateCSS((0,objectSpread2["default"])((0,objectSpread2["default"])({}, spec), {}, {
left: animationLeft
})),
lazyLoadedList: lazyLoadedList,
targetSlide: targetSlide
};
nextState = {
animating: false,
currentSlide: finalSlide,
trackStyle: getTrackCSS((0,objectSpread2["default"])((0,objectSpread2["default"])({}, spec), {}, {
left: finalLeft
})),
swipeLeft: null,
targetSlide: targetSlide
};
}
}
return {
state: state,
nextState: nextState
};
};
var changeSlide = function changeSlide(spec, options) {
var indexOffset, previousInt, slideOffset, unevenOffset, targetSlide;
var slidesToScroll = spec.slidesToScroll,
slidesToShow = spec.slidesToShow,
slideCount = spec.slideCount,
currentSlide = spec.currentSlide,
previousTargetSlide = spec.targetSlide,
lazyLoad = spec.lazyLoad,
infinite = spec.infinite;
unevenOffset = slideCount % slidesToScroll !== 0;
indexOffset = unevenOffset ? 0 : (slideCount - currentSlide) % slidesToScroll;
if (options.message === "previous") {
slideOffset = indexOffset === 0 ? slidesToScroll : slidesToShow - indexOffset;
targetSlide = currentSlide - slideOffset;
if (lazyLoad && !infinite) {
previousInt = currentSlide - slideOffset;
targetSlide = previousInt === -1 ? slideCount - 1 : previousInt;
}
if (!infinite) {
targetSlide = previousTargetSlide - slidesToScroll;
}
} else if (options.message === "next") {
slideOffset = indexOffset === 0 ? slidesToScroll : indexOffset;
targetSlide = currentSlide + slideOffset;
if (lazyLoad && !infinite) {
targetSlide = (currentSlide + slidesToScroll) % slideCount + indexOffset;
}
if (!infinite) {
targetSlide = previousTargetSlide + slidesToScroll;
}
} else if (options.message === "dots") {
// Click on dots
targetSlide = options.index * options.slidesToScroll;
} else if (options.message === "children") {
// Click on the slides
targetSlide = options.index;
if (infinite) {
var direction = siblingDirection((0,objectSpread2["default"])((0,objectSpread2["default"])({}, spec), {}, {
targetSlide: targetSlide
}));
if (targetSlide > options.currentSlide && direction === "left") {
targetSlide = targetSlide - slideCount;
} else if (targetSlide < options.currentSlide && direction === "right") {
targetSlide = targetSlide + slideCount;
}
}
} else if (options.message === "index") {
targetSlide = Number(options.index);
}
return targetSlide;
};
var keyHandler = function keyHandler(e, accessibility, rtl) {
if (e.target.tagName.match("TEXTAREA|INPUT|SELECT") || !accessibility) return "";
if (e.keyCode === 37) return rtl ? "next" : "previous";
if (e.keyCode === 39) return rtl ? "previous" : "next";
return "";
};
var swipeStart = function swipeStart(e, swipe, draggable) {
e.target.tagName === "IMG" && safePreventDefault(e);
if (!swipe || !draggable && e.type.indexOf("mouse") !== -1) return "";
return {
dragging: true,
touchObject: {
startX: e.touches ? e.touches[0].pageX : e.clientX,
startY: e.touches ? e.touches[0].pageY : e.clientY,
curX: e.touches ? e.touches[0].pageX : e.clientX,
curY: e.touches ? e.touches[0].pageY : e.clientY
}
};
};
var swipeMove = function swipeMove(e, spec) {
// spec also contains, trackRef and slideIndex
var scrolling = spec.scrolling,
animating = spec.animating,
vertical = spec.vertical,
swipeToSlide = spec.swipeToSlide,
verticalSwiping = spec.verticalSwiping,
rtl = spec.rtl,
currentSlide = spec.currentSlide,
edgeFriction = spec.edgeFriction,
edgeDragged = spec.edgeDragged,
onEdge = spec.onEdge,
swiped = spec.swiped,
swiping = spec.swiping,
slideCount = spec.slideCount,
slidesToScroll = spec.slidesToScroll,
infinite = spec.infinite,
touchObject = spec.touchObject,
swipeEvent = spec.swipeEvent,
listHeight = spec.listHeight,
listWidth = spec.listWidth;
if (scrolling) return;
if (animating) return safePreventDefault(e);
if (vertical && swipeToSlide && verticalSwiping) safePreventDefault(e);
var swipeLeft,
state = {};
var curLeft = getTrackLeft(spec);
touchObject.curX = e.touches ? e.touches[0].pageX : e.clientX;
touchObject.curY = e.touches ? e.touches[0].pageY : e.clientY;
touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curX - touchObject.startX, 2)));
var verticalSwipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curY - touchObject.startY, 2)));
if (!verticalSwiping && !swiping && verticalSwipeLength > 10) {
return {
scrolling: true
};
}
if (verticalSwiping) touchObject.swipeLength = verticalSwipeLength;
var positionOffset = (!rtl ? 1 : -1) * (touchObject.curX > touchObject.startX ? 1 : -1);
if (verticalSwiping) positionOffset = touchObject.curY > touchObject.startY ? 1 : -1;
var dotCount = Math.ceil(slideCount / slidesToScroll);
var swipeDirection = getSwipeDirection(spec.touchObject, verticalSwiping);
var touchSwipeLength = touchObject.swipeLength;
if (!infinite) {
if (currentSlide === 0 && (swipeDirection === "right" || swipeDirection === "down") || currentSlide + 1 >= dotCount && (swipeDirection === "left" || swipeDirection === "up") || !canGoNext(spec) && (swipeDirection === "left" || swipeDirection === "up")) {
touchSwipeLength = touchObject.swipeLength * edgeFriction;
if (edgeDragged === false && onEdge) {
onEdge(swipeDirection);
state["edgeDragged"] = true;
}
}
}
if (!swiped && swipeEvent) {
swipeEvent(swipeDirection);
state["swiped"] = true;
}
if (!vertical) {
if (!rtl) {
swipeLeft = curLeft + touchSwipeLength * positionOffset;
} else {
swipeLeft = curLeft - touchSwipeLength * positionOffset;
}
} else {
swipeLeft = curLeft + touchSwipeLength * (listHeight / listWidth) * positionOffset;
}
if (verticalSwiping) {
swipeLeft = curLeft + touchSwipeLength * positionOffset;
}
state = (0,objectSpread2["default"])((0,objectSpread2["default"])({}, state), {}, {
touchObject: touchObject,
swipeLeft: swipeLeft,
trackStyle: getTrackCSS((0,objectSpread2["default"])((0,objectSpread2["default"])({}, spec), {}, {
left: swipeLeft
}))
});
if (Math.abs(touchObject.curX - touchObject.startX) < Math.abs(touchObject.curY - touchObject.startY) * 0.8) {
return state;
}
if (touchObject.swipeLength > 10) {
state["swiping"] = true;
safePreventDefault(e);
}
return state;
};
var swipeEnd = function swipeEnd(e, spec) {
var dragging = spec.dragging,
swipe = spec.swipe,
touchObject = spec.touchObject,
listWidth = spec.listWidth,
touchThreshold = spec.touchThreshold,
verticalSwiping = spec.verticalSwiping,
listHeight = spec.listHeight,
swipeToSlide = spec.swipeToSlide,
scrolling = spec.scrolling,
onSwipe = spec.onSwipe,
targetSlide = spec.targetSlide,
currentSlide = spec.currentSlide,
infinite = spec.infinite;
if (!dragging) {
if (swipe) safePreventDefault(e);
return {};
}
var minSwipe = verticalSwiping ? listHeight / touchThreshold : listWidth / touchThreshold;
var swipeDirection = getSwipeDirection(touchObject, verticalSwiping);
// reset the state of touch related state variables.
var state = {
dragging: false,
edgeDragged: false,
scrolling: false,
swiping: false,
swiped: false,
swipeLeft: null,
touchObject: {}
};
if (scrolling) {
return state;
}
if (!touchObject.swipeLength) {
return state;
}
if (touchObject.swipeLength > minSwipe) {
safePreventDefault(e);
if (onSwipe) {
onSwipe(swipeDirection);
}
var slideCount, newSlide;
var activeSlide = infinite ? currentSlide : targetSlide;
switch (swipeDirection) {
case "left":
case "up":
newSlide = activeSlide + getSlideCount(spec);
slideCount = swipeToSlide ? checkNavigable(spec, newSlide) : newSlide;
state["currentDirection"] = 0;
break;
case "right":
case "down":
newSlide = activeSlide - getSlideCount(spec);
slideCount = swipeToSlide ? checkNavigable(spec, newSlide) : newSlide;
state["currentDirection"] = 1;
break;
default:
slideCount = activeSlide;
}
state["triggerSlideHandler"] = slideCount;
} else {
// Adjust the track back to it's original position.
var currentLeft = getTrackLeft(spec);
state["trackStyle"] = getTrackAnimateCSS((0,objectSpread2["default"])((0,objectSpread2["default"])({}, spec), {}, {
left: currentLeft
}));
}
return state;
};
var getNavigableIndexes = function getNavigableIndexes(spec) {
var max = spec.infinite ? spec.slideCount * 2 : spec.slideCount;
var breakpoint = spec.infinite ? spec.slidesToShow * -1 : 0;
var counter = spec.infinite ? spec.slidesToShow * -1 : 0;
var indexes = [];
while (breakpoint < max) {
indexes.push(breakpoint);
breakpoint = counter + spec.slidesToScroll;
counter += Math.min(spec.slidesToScroll, spec.slidesToShow);
}
return indexes;
};
var checkNavigable = function checkNavigable(spec, index) {
var navigables = getNavigableIndexes(spec);
var prevNavigable = 0;
if (index > navigables[navigables.length - 1]) {
index = navigables[navigables.length - 1];
} else {
for (var n in navigables) {
if (index < navigables[n]) {
index = prevNavigable;
break;
}
prevNavigable = navigables[n];
}
}
return index;
};
var getSlideCount = function getSlideCount(spec) {
var centerOffset = spec.centerMode ? spec.slideWidth * Math.floor(spec.slidesToShow / 2) : 0;
if (spec.swipeToSlide) {
var swipedSlide;
var slickList = spec.listRef;
var slides = slickList.querySelectorAll && slickList.querySelectorAll(".slick-slide") || [];
Array.from(slides).every(function (slide) {
if (!spec.vertical) {
if (slide.offsetLeft - centerOffset + innerSliderUtils_getWidth(slide) / 2 > spec.swipeLeft * -1) {
swipedSlide = slide;
return false;
}
} else {
if (slide.offsetTop + getHeight(slide) / 2 > spec.swipeLeft * -1) {
swipedSlide = slide;
return false;
}
}
return true;
});
if (!swipedSlide) {
return 0;
}
var currentIndex = spec.rtl === true ? spec.slideCount - spec.currentSlide : spec.currentSlide;
var slidesTraversed = Math.abs(swipedSlide.dataset.index - currentIndex) || 1;
return slidesTraversed;
} else {
return spec.slidesToScroll;
}
};
var checkSpecKeys = function checkSpecKeys(spec, keysArray) {
return (
// eslint-disable-next-line no-prototype-builtins
keysArray.reduce(function (value, key) {
return value && spec.hasOwnProperty(key);
}, true) ? null : console.error("Keys Missing:", spec)
);
};
var getTrackCSS = function getTrackCSS(spec) {
checkSpecKeys(spec, ["left", "variableWidth", "slideCount", "slidesToShow", "slideWidth"]);
var trackWidth, trackHeight;
if (!spec.vertical) {
trackWidth = getTotalSlides(spec) * spec.slideWidth;
} else {
var trackChildren = spec.unslick ? spec.slideCount : spec.slideCount + 2 * spec.slidesToShow;
trackHeight = trackChildren * spec.slideHeight;
}
var style = {
opacity: 1,
transition: "",
WebkitTransition: ""
};
if (spec.useTransform) {
var WebkitTransform = !spec.vertical ? "translate3d(" + spec.left + "px, 0px, 0px)" : "translate3d(0px, " + spec.left + "px, 0px)";
var transform = !spec.vertical ? "translate3d(" + spec.left + "px, 0px, 0px)" : "translate3d(0px, " + spec.left + "px, 0px)";
var msTransform = !spec.vertical ? "translateX(" + spec.left + "px)" : "translateY(" + spec.left + "px)";
style = (0,objectSpread2["default"])((0,objectSpread2["default"])({}, style), {}, {
WebkitTransform: WebkitTransform,
transform: transform,
msTransform: msTransform
});
} else {
if (spec.vertical) {
style["top"] = spec.left;
} else {
style["left"] = spec.left;
}
}
if (spec.fade) style = {
opacity: 1
};
if (trackWidth) style.width = trackWidth;
if (trackHeight) style.height = trackHeight;
// Fallback for IE8
if (window && !window.addEventListener && window.attachEvent) {
if (!spec.vertical) {
style.marginLeft = spec.left + "px";
} else {
style.marginTop = spec.left + "px";
}
}
return style;
};
var getTrackAnimateCSS = function getTrackAnimateCSS(spec) {
checkSpecKeys(spec, ["left", "variableWidth", "slideCount", "slidesToShow", "slideWidth", "speed", "cssEase"]);
var style = getTrackCSS(spec);
// useCSS is true by default so it can be undefined
if (spec.useTransform) {
style.WebkitTransition = "-webkit-transform " + spec.speed + "ms " + spec.cssEase;
style.transition = "transform " + spec.speed + "ms " + spec.cssEase;
} else {
if (spec.vertical) {
style.transition = "top " + spec.speed + "ms " + spec.cssEase;
} else {
style.transition = "left " + spec.speed + "ms " + spec.cssEase;
}
}
return style;
};
var getTrackLeft = function getTrackLeft(spec) {
if (spec.unslick) {
return 0;
}
checkSpecKeys(spec, ["slideIndex", "trackRef", "infinite", "centerMode", "slideCount", "slidesToShow", "slidesToScroll", "slideWidth", "listWidth", "variableWidth", "slideHeight"]);
var slideIndex = spec.slideIndex,
trackRef = spec.trackRef,
infinite = spec.infinite,
centerMode = spec.centerMode,
slideCount = spec.slideCount,
slidesToShow = spec.slidesToShow,
slidesToScroll = spec.slidesToScroll,
slideWidth = spec.slideWidth,
listWidth = spec.listWidth,
variableWidth = spec.variableWidth,
slideHeight = spec.slideHeight,
fade = spec.fade,
vertical = spec.vertical;
var slideOffset = 0;
var targetLeft;
var targetSlide;
var verticalOffset = 0;
if (fade || spec.slideCount === 1) {
return 0;
}
var slidesToOffset = 0;
if (infinite) {
slidesToOffset = -getPreClones(spec); // bring active slide to the beginning of visual area
// if next scroll doesn't have enough children, just reach till the end of original slides instead of shifting slidesToScroll children
if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
slidesToOffset = -(slideIndex > slideCount ? slidesToShow - (slideIndex - slideCount) : slideCount % slidesToScroll);
}
// shift current slide to center of the frame
if (centerMode) {
slidesToOffset += parseInt(slidesToShow / 2);
}
} else {
if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
slidesToOffset = slidesToShow - slideCount % slidesToScroll;
}
if (centerMode) {
slidesToOffset = parseInt(slidesToShow / 2);
}
}
slideOffset = slidesToOffset * slideWidth;
verticalOffset = slidesToOffset * slideHeight;
if (!vertical) {
targetLeft = slideIndex * slideWidth * -1 + slideOffset;
} else {
targetLeft = slideIndex * slideHeight * -1 + verticalOffset;
}
if (variableWidth === true) {
var targetSlideIndex;
var trackElem = trackRef && trackRef.node;
targetSlideIndex = slideIndex + getPreClones(spec);
targetSlide = trackElem && trackElem.childNodes[targetSlideIndex];
targetLeft = targetSlide ? targetSlide.offsetLeft * -1 : 0;
if (centerMode === true) {
targetSlideIndex = infinite ? slideIndex + getPreClones(spec) : slideIndex;
targetSlide = trackElem && trackElem.children[targetSlideIndex];
targetLeft = 0;
for (var slide = 0; slide < targetSlideIndex; slide++) {
targetLeft -= trackElem && trackElem.children[slide] && trackElem.children[slide].offsetWidth;
}
targetLeft -= parseInt(spec.centerPadding);
targetLeft += targetSlide && (listWidth - targetSlide.offsetWidth) / 2;
}
}
return targetLeft;
};
var getPreClones = function getPreClones(spec) {
if (spec.unslick || !spec.infinite) {
return 0;
}
if (spec.variableWidth) {
return spec.slideCount;
}
return spec.slidesToShow + (spec.centerMode ? 1 : 0);
};
var getPostClones = function getPostClones(spec) {
if (spec.unslick || !spec.infinite) {
return 0;
}
if (spec.variableWidth) {
return spec.slideCount;
}
return spec.slidesToShow + (spec.centerMode ? 1 : 0);
};
var getTotalSlides = function getTotalSlides(spec) {
return spec.slideCount === 1 ? 1 : getPreClones(spec) + spec.slideCount + getPostClones(spec);
};
var siblingDirection = function siblingDirection(spec) {
if (spec.targetSlide > spec.currentSlide) {
if (spec.targetSlide > spec.currentSlide + slidesOnRight(spec)) {
return "left";
}
return "right";
} else {
if (spec.targetSlide < spec.currentSlide - slidesOnLeft(spec)) {
return "right";
}
return "left";
}
};
var slidesOnRight = function slidesOnRight(_ref) {
var slidesToShow = _ref.slidesToShow,
centerMode = _ref.centerMode,
rtl = _ref.rtl,
centerPadding = _ref.centerPadding;
// returns no of slides on the right of active slide
if (centerMode) {
var right = (slidesToShow - 1) / 2 + 1;
if (parseInt(centerPadding) > 0) right += 1;
if (rtl && slidesToShow % 2 === 0) right += 1;
return right;
}
if (rtl) {
return 0;
}
return slidesToShow - 1;
};
var slidesOnLeft = function slidesOnLeft(_ref2) {
var slidesToShow = _ref2.slidesToShow,
centerMode = _ref2.centerMode,
rtl = _ref2.rtl,
centerPadding = _ref2.centerPadding;
// returns no of slides on the left of active slide
if (centerMode) {
var left = (slidesToShow - 1) / 2 + 1;
if (parseInt(centerPadding) > 0) left += 1;
if (!rtl && slidesToShow % 2 === 0) left += 1;
return left;
}
if (rtl) {
return slidesToShow - 1;
}
return 0;
};
var canUseDOM = function canUseDOM() {
return !!(typeof window !== "undefined" && window.document && window.document.createElement);
};
var validSettings = Object.keys(default_props);
function filterSettings(settings) {
return validSettings.reduce(function (acc, settingName) {
if (settings.hasOwnProperty(settingName)) {
acc[settingName] = settings[settingName];
}
return acc;
}, {});
}
;// ./node_modules/@ant-design/react-slick/es/track.js
function track_callSuper(t, o, e) { return o = (0,getPrototypeOf["default"])(o), (0,possibleConstructorReturn["default"])(t, (0,isNativeReflectConstruct["default"])() ? Reflect.construct(o, e || [], (0,getPrototypeOf["default"])(t).constructor) : o.apply(t, e)); }
// given specifications/props for a slide, fetch all the classes that need to be applied to the slide
var getSlideClasses = function getSlideClasses(spec) {
var slickActive, slickCenter, slickCloned;
var centerOffset, index;
if (spec.rtl) {
index = spec.slideCount - 1 - spec.index;
} else {
index = spec.index;
}
slickCloned = index < 0 || index >= spec.slideCount;
if (spec.centerMode) {
centerOffset = Math.floor(spec.slidesToShow / 2);
slickCenter = (index - spec.currentSlide) % spec.slideCount === 0;
if (index > spec.currentSlide - centerOffset - 1 && index <= spec.currentSlide + centerOffset) {
slickActive = true;
}
} else {
slickActive = spec.currentSlide <= index && index < spec.currentSlide + spec.slidesToShow;
}
var focusedSlide;
if (spec.targetSlide < 0) {
focusedSlide = spec.targetSlide + spec.slideCount;
} else if (spec.targetSlide >= spec.slideCount) {
focusedSlide = spec.targetSlide - spec.slideCount;
} else {
focusedSlide = spec.targetSlide;
}
var slickCurrent = index === focusedSlide;
return {
"slick-slide": true,
"slick-active": slickActive,
"slick-center": slickCenter,
"slick-cloned": slickCloned,
"slick-current": slickCurrent // dubious in case of RTL
};
};
var getSlideStyle = function getSlideStyle(spec) {
var style = {};
if (spec.variableWidth === undefined || spec.variableWidth === false) {
style.width = spec.slideWidth;
}
if (spec.fade) {
style.position = "relative";
if (spec.vertical && spec.slideHeight) {
style.top = -spec.index * parseInt(spec.slideHeight);
} else {
style.left = -spec.index * parseInt(spec.slideWidth);
}
style.opacity = spec.currentSlide === spec.index ? 1 : 0;
style.zIndex = spec.currentSlide === spec.index ? 999 : 998;
if (spec.useCSS) {
style.transition = "opacity " + spec.speed + "ms " + spec.cssEase + ", " + "visibility " + spec.speed + "ms " + spec.cssEase;
}
}
return style;
};
var track_getKey = function getKey(child, fallbackKey) {
return child.key + "-" + fallbackKey;
};
var renderSlides = function renderSlides(spec) {
var key;
var slides = [];
var preCloneSlides = [];
var postCloneSlides = [];
var childrenCount = external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.count(spec.children);
var startIndex = lazyStartIndex(spec);
var endIndex = lazyEndIndex(spec);
external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.forEach(spec.children, function (elem, index) {
var child;
var childOnClickOptions = {
message: "children",
index: index,
slidesToScroll: spec.slidesToScroll,
currentSlide: spec.currentSlide
};
// in case of lazyLoad, whether or not we want to fetch the slide
if (!spec.lazyLoad || spec.lazyLoad && spec.lazyLoadedList.indexOf(index) >= 0) {
child = elem;
} else {
child = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", null);
}
var childStyle = getSlideStyle((0,objectSpread2["default"])((0,objectSpread2["default"])({}, spec), {}, {
index: index
}));
var slideClass = child.props.className || "";
var slideClasses = getSlideClasses((0,objectSpread2["default"])((0,objectSpread2["default"])({}, spec), {}, {
index: index
}));
// push a cloned element of the desired slide
slides.push(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(child, {
key: "original" + track_getKey(child, index),
"data-index": index,
className: (0,clsx.clsx)(slideClasses, slideClass),
tabIndex: "-1",
"aria-hidden": !slideClasses["slick-active"],
style: (0,objectSpread2["default"])((0,objectSpread2["default"])({
outline: "none"
}, child.props.style || {}), childStyle),
onClick: function onClick(e) {
child.props && child.props.onClick && child.props.onClick(e);
if (spec.focusOnSelect) {
spec.focusOnSelect(childOnClickOptions);
}
}
}));
// if slide needs to be precloned or postcloned
if (spec.infinite && childrenCount > 1 && spec.fade === false && !spec.unslick) {
var preCloneNo = childrenCount - index;
if (preCloneNo <= getPreClones(spec)) {
key = -preCloneNo;
if (key >= startIndex) {
child = elem;
}
slideClasses = getSlideClasses((0,objectSpread2["default"])((0,objectSpread2["default"])({}, spec), {}, {
index: key
}));
preCloneSlides.push(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(child, {
key: "precloned" + track_getKey(child, key),
"data-index": key,
tabIndex: "-1",
className: (0,clsx.clsx)(slideClasses, slideClass),
"aria-hidden": !slideClasses["slick-active"],
style: (0,objectSpread2["default"])((0,objectSpread2["default"])({}, child.props.style || {}), childStyle),
onClick: function onClick(e) {
child.props && child.props.onClick && child.props.onClick(e);
if (spec.focusOnSelect) {
spec.focusOnSelect(childOnClickOptions);
}
}
}));
}
if (index < getPostClones(spec)) {
key = childrenCount + index;
if (key < endIndex) {
child = elem;
}
slideClasses = getSlideClasses((0,objectSpread2["default"])((0,objectSpread2["default"])({}, spec), {}, {
index: key
}));
postCloneSlides.push(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(child, {
key: "postcloned" + track_getKey(child, key),
"data-index": key,
tabIndex: "-1",
className: (0,clsx.clsx)(slideClasses, slideClass),
"aria-hidden": !slideClasses["slick-active"],
style: (0,objectSpread2["default"])((0,objectSpread2["default"])({}, child.props.style || {}), childStyle),
onClick: function onClick(e) {
child.props && child.props.onClick && child.props.onClick(e);
if (spec.focusOnSelect) {
spec.focusOnSelect(childOnClickOptions);
}
}
}));
}
}
});
if (spec.rtl) {
return preCloneSlides.concat(slides, postCloneSlides).reverse();
} else {
return preCloneSlides.concat(slides, postCloneSlides);
}
};
var Track = /*#__PURE__*/function (_React$PureComponent) {
function Track() {
var _this;
(0,classCallCheck["default"])(this, Track);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = track_callSuper(this, Track, [].concat(args));
(0,defineProperty["default"])(_this, "node", null);
(0,defineProperty["default"])(_this, "handleRef", function (ref) {
_this.node = ref;
});
return _this;
}
(0,inherits["default"])(Track, _React$PureComponent);
return (0,createClass["default"])(Track, [{
key: "render",
value: function render() {
var slides = renderSlides(this.props);
var _this$props = this.props,
onMouseEnter = _this$props.onMouseEnter,
onMouseOver = _this$props.onMouseOver,
onMouseLeave = _this$props.onMouseLeave;
var mouseEvents = {
onMouseEnter: onMouseEnter,
onMouseOver: onMouseOver,
onMouseLeave: onMouseLeave
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", (0,esm_extends["default"])({
ref: this.handleRef,
className: "slick-track",
style: this.props.trackStyle
}, mouseEvents), slides);
}
}]);
}((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).PureComponent);
;// ./node_modules/@ant-design/react-slick/es/dots.js
function dots_callSuper(t, o, e) { return o = (0,getPrototypeOf["default"])(o), (0,possibleConstructorReturn["default"])(t, (0,isNativeReflectConstruct["default"])() ? Reflect.construct(o, e || [], (0,getPrototypeOf["default"])(t).constructor) : o.apply(t, e)); }
var getDotCount = function getDotCount(spec) {
var dots;
if (spec.infinite) {
dots = Math.ceil(spec.slideCount / spec.slidesToScroll);
} else {
dots = Math.ceil((spec.slideCount - spec.slidesToShow) / spec.slidesToScroll) + 1;
}
return dots;
};
var Dots = /*#__PURE__*/function (_React$PureComponent) {
function Dots() {
(0,classCallCheck["default"])(this, Dots);
return dots_callSuper(this, Dots, arguments);
}
(0,inherits["default"])(Dots, _React$PureComponent);
return (0,createClass["default"])(Dots, [{
key: "clickHandler",
value: function clickHandler(options, e) {
// In Autoplay the focus stays on clicked button even after transition
// to next slide. That only goes away by click somewhere outside
e.preventDefault();
this.props.clickHandler(options);
}
}, {
key: "render",
value: function render() {
var _this$props = this.props,
onMouseEnter = _this$props.onMouseEnter,
onMouseOver = _this$props.onMouseOver,
onMouseLeave = _this$props.onMouseLeave,
infinite = _this$props.infinite,
slidesToScroll = _this$props.slidesToScroll,
slidesToShow = _this$props.slidesToShow,
slideCount = _this$props.slideCount,
currentSlide = _this$props.currentSlide;
var dotCount = getDotCount({
slideCount: slideCount,
slidesToScroll: slidesToScroll,
slidesToShow: slidesToShow,
infinite: infinite
});
var mouseEvents = {
onMouseEnter: onMouseEnter,
onMouseOver: onMouseOver,
onMouseLeave: onMouseLeave
};
var dots = [];
for (var i = 0; i < dotCount; i++) {
var _rightBound = (i + 1) * slidesToScroll - 1;
var rightBound = infinite ? _rightBound : clamp(_rightBound, 0, slideCount - 1);
var _leftBound = rightBound - (slidesToScroll - 1);
var leftBound = infinite ? _leftBound : clamp(_leftBound, 0, slideCount - 1);
var className = (0,clsx.clsx)({
"slick-active": infinite ? currentSlide >= leftBound && currentSlide <= rightBound : currentSlide === leftBound
});
var dotOptions = {
message: "dots",
index: i,
slidesToScroll: slidesToScroll,
currentSlide: currentSlide
};
var onClick = this.clickHandler.bind(this, dotOptions);
dots = dots.concat(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
key: i,
className: className
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(this.props.customPaging(i), {
onClick: onClick
})));
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(this.props.appendDots(dots), (0,objectSpread2["default"])({
className: this.props.dotsClass
}, mouseEvents));
}
}]);
}((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).PureComponent);
;// ./node_modules/@ant-design/react-slick/es/arrows.js
function arrows_callSuper(t, o, e) { return o = (0,getPrototypeOf["default"])(o), (0,possibleConstructorReturn["default"])(t, (0,isNativeReflectConstruct["default"])() ? Reflect.construct(o, e || [], (0,getPrototypeOf["default"])(t).constructor) : o.apply(t, e)); }
var PrevArrow = /*#__PURE__*/function (_React$PureComponent) {
function PrevArrow() {
(0,classCallCheck["default"])(this, PrevArrow);
return arrows_callSuper(this, PrevArrow, arguments);
}
(0,inherits["default"])(PrevArrow, _React$PureComponent);
return (0,createClass["default"])(PrevArrow, [{
key: "clickHandler",
value: function clickHandler(options, e) {
if (e) {
e.preventDefault();
}
this.props.clickHandler(options, e);
}
}, {
key: "render",
value: function render() {
var prevClasses = {
"slick-arrow": true,
"slick-prev": true
};
var prevHandler = this.clickHandler.bind(this, {
message: "previous"
});
if (!this.props.infinite && (this.props.currentSlide === 0 || this.props.slideCount <= this.props.slidesToShow)) {
prevClasses["slick-disabled"] = true;
prevHandler = null;
}
var prevArrowProps = {
key: "0",
"data-role": "none",
className: (0,clsx.clsx)(prevClasses),
style: {
display: "block"
},
onClick: prevHandler
};
var customProps = {
currentSlide: this.props.currentSlide,
slideCount: this.props.slideCount
};
var prevArrow;
if (this.props.prevArrow) {
prevArrow = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(this.props.prevArrow, (0,objectSpread2["default"])((0,objectSpread2["default"])({}, prevArrowProps), customProps));
} else {
prevArrow = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", (0,esm_extends["default"])({
key: "0",
type: "button"
}, prevArrowProps), " ", "Previous");
}
return prevArrow;
}
}]);
}((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).PureComponent);
var NextArrow = /*#__PURE__*/function (_React$PureComponent2) {
function NextArrow() {
(0,classCallCheck["default"])(this, NextArrow);
return arrows_callSuper(this, NextArrow, arguments);
}
(0,inherits["default"])(NextArrow, _React$PureComponent2);
return (0,createClass["default"])(NextArrow, [{
key: "clickHandler",
value: function clickHandler(options, e) {
if (e) {
e.preventDefault();
}
this.props.clickHandler(options, e);
}
}, {
key: "render",
value: function render() {
var nextClasses = {
"slick-arrow": true,
"slick-next": true
};
var nextHandler = this.clickHandler.bind(this, {
message: "next"
});
if (!canGoNext(this.props)) {
nextClasses["slick-disabled"] = true;
nextHandler = null;
}
var nextArrowProps = {
key: "1",
"data-role": "none",
className: (0,clsx.clsx)(nextClasses),
style: {
display: "block"
},
onClick: nextHandler
};
var customProps = {
currentSlide: this.props.currentSlide,
slideCount: this.props.slideCount
};
var nextArrow;
if (this.props.nextArrow) {
nextArrow = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(this.props.nextArrow, (0,objectSpread2["default"])((0,objectSpread2["default"])({}, nextArrowProps), customProps));
} else {
nextArrow = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", (0,esm_extends["default"])({
key: "1",
type: "button"
}, nextArrowProps), " ", "Next");
}
return nextArrow;
}
}]);
}((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).PureComponent);
;// ./node_modules/@ant-design/react-slick/es/inner-slider.js
var inner_slider_excluded = ["animating"];
function inner_slider_callSuper(t, o, e) { return o = (0,getPrototypeOf["default"])(o), (0,possibleConstructorReturn["default"])(t, (0,isNativeReflectConstruct["default"])() ? Reflect.construct(o, e || [], (0,getPrototypeOf["default"])(t).constructor) : o.apply(t, e)); }
var InnerSlider = /*#__PURE__*/function (_React$Component) {
function InnerSlider(props) {
var _this;
(0,classCallCheck["default"])(this, InnerSlider);
_this = inner_slider_callSuper(this, InnerSlider, [props]);
(0,defineProperty["default"])(_this, "listRefHandler", function (ref) {
return _this.list = ref;
});
(0,defineProperty["default"])(_this, "trackRefHandler", function (ref) {
return _this.track = ref;
});
(0,defineProperty["default"])(_this, "adaptHeight", function () {
if (_this.props.adaptiveHeight && _this.list) {
var elem = _this.list.querySelector("[data-index=\"".concat(_this.state.currentSlide, "\"]"));
_this.list.style.height = getHeight(elem) + "px";
}
});
(0,defineProperty["default"])(_this, "componentDidMount", function () {
_this.props.onInit && _this.props.onInit();
if (_this.props.lazyLoad) {
var slidesToLoad = getOnDemandLazySlides((0,objectSpread2["default"])((0,objectSpread2["default"])({}, _this.props), _this.state));
if (slidesToLoad.length > 0) {
_this.setState(function (prevState) {
return {
lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad)
};
});
if (_this.props.onLazyLoad) {
_this.props.onLazyLoad(slidesToLoad);
}
}
}
var spec = (0,objectSpread2["default"])({
listRef: _this.list,
trackRef: _this.track
}, _this.props);
_this.updateState(spec, true, function () {
_this.adaptHeight();
_this.props.autoplay && _this.autoPlay("playing");
});
if (_this.props.lazyLoad === "progressive") {
_this.lazyLoadTimer = setInterval(_this.progressiveLazyLoad, 1000);
}
if (typeof ResizeObserver !== "undefined") {
_this.ro = new ResizeObserver(function () {
if (_this.state.animating) {
_this.onWindowResized(false); // don't set trackStyle hence don't break animation
_this.callbackTimers.push(setTimeout(function () {
return _this.onWindowResized();
}, _this.props.speed));
} else {
_this.onWindowResized();
}
});
_this.ro.observe(_this.list);
}
document.querySelectorAll && Array.prototype.forEach.call(document.querySelectorAll(".slick-slide"), function (slide) {
slide.onfocus = _this.props.pauseOnFocus ? _this.onSlideFocus : null;
slide.onblur = _this.props.pauseOnFocus ? _this.onSlideBlur : null;
});
if (window.addEventListener) {
window.addEventListener("resize", _this.onWindowResized);
} else {
window.attachEvent("onresize", _this.onWindowResized);
}
});
(0,defineProperty["default"])(_this, "componentWillUnmount", function () {
var _this$ro;
if (_this.animationEndCallback) {
clearTimeout(_this.animationEndCallback);
}
if (_this.lazyLoadTimer) {
clearInterval(_this.lazyLoadTimer);
}
if (_this.callbackTimers.length) {
_this.callbackTimers.forEach(function (timer) {
return clearTimeout(timer);
});
_this.callbackTimers = [];
}
if (window.addEventListener) {
window.removeEventListener("resize", _this.onWindowResized);
} else {
window.detachEvent("onresize", _this.onWindowResized);
}
if (_this.autoplayTimer) {
clearInterval(_this.autoplayTimer);
}
(_this$ro = _this.ro) === null || _this$ro === void 0 || _this$ro.disconnect();
});
(0,defineProperty["default"])(_this, "componentDidUpdate", function (prevProps) {
_this.checkImagesLoad();
_this.props.onReInit && _this.props.onReInit();
if (_this.props.lazyLoad) {
var slidesToLoad = getOnDemandLazySlides((0,objectSpread2["default"])((0,objectSpread2["default"])({}, _this.props), _this.state));
if (slidesToLoad.length > 0) {
_this.setState(function (prevState) {
return {
lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad)
};
});
if (_this.props.onLazyLoad) {
_this.props.onLazyLoad(slidesToLoad);
}
}
}
// if (this.props.onLazyLoad) {
// this.props.onLazyLoad([leftMostSlide])
// }
_this.adaptHeight();
var spec = (0,objectSpread2["default"])((0,objectSpread2["default"])({
listRef: _this.list,
trackRef: _this.track
}, _this.props), _this.state);
var setTrackStyle = _this.didPropsChange(prevProps);
setTrackStyle && _this.updateState(spec, setTrackStyle, function () {
if (_this.state.currentSlide >= external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.count(_this.props.children)) {
_this.changeSlide({
message: "index",
index: external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.count(_this.props.children) - _this.props.slidesToShow,
currentSlide: _this.state.currentSlide
});
}
if (prevProps.autoplay !== _this.props.autoplay || prevProps.autoplaySpeed !== _this.props.autoplaySpeed) {
if (!prevProps.autoplay && _this.props.autoplay) {
_this.autoPlay("playing");
} else if (_this.props.autoplay) {
_this.autoPlay("update");
} else {
_this.pause("paused");
}
}
});
});
(0,defineProperty["default"])(_this, "onWindowResized", function (setTrackStyle) {
if (_this.debouncedResize) _this.debouncedResize.cancel();
_this.debouncedResize = debounce(50, function () {
return _this.resizeWindow(setTrackStyle);
});
_this.debouncedResize();
});
(0,defineProperty["default"])(_this, "resizeWindow", function () {
var setTrackStyle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
var isTrackMounted = Boolean(_this.track && _this.track.node);
// prevent warning: setting state on unmounted component (server side rendering)
if (!isTrackMounted) return;
var spec = (0,objectSpread2["default"])((0,objectSpread2["default"])({
listRef: _this.list,
trackRef: _this.track
}, _this.props), _this.state);
_this.updateState(spec, setTrackStyle, function () {
if (_this.props.autoplay) _this.autoPlay("update");else _this.pause("paused");
});
// animating state should be cleared while resizing, otherwise autoplay stops working
_this.setState({
animating: false
});
clearTimeout(_this.animationEndCallback);
delete _this.animationEndCallback;
});
(0,defineProperty["default"])(_this, "updateState", function (spec, setTrackStyle, callback) {
var updatedState = initializedState(spec);
spec = (0,objectSpread2["default"])((0,objectSpread2["default"])((0,objectSpread2["default"])({}, spec), updatedState), {}, {
slideIndex: updatedState.currentSlide
});
var targetLeft = getTrackLeft(spec);
spec = (0,objectSpread2["default"])((0,objectSpread2["default"])({}, spec), {}, {
left: targetLeft
});
var trackStyle = getTrackCSS(spec);
if (setTrackStyle || external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.count(_this.props.children) !== external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.count(spec.children)) {
updatedState["trackStyle"] = trackStyle;
}
_this.setState(updatedState, callback);
});
(0,defineProperty["default"])(_this, "ssrInit", function () {
if (_this.props.variableWidth) {
var _trackWidth = 0,
_trackLeft = 0;
var childrenWidths = [];
var preClones = getPreClones((0,objectSpread2["default"])((0,objectSpread2["default"])((0,objectSpread2["default"])({}, _this.props), _this.state), {}, {
slideCount: _this.props.children.length
}));
var postClones = getPostClones((0,objectSpread2["default"])((0,objectSpread2["default"])((0,objectSpread2["default"])({}, _this.props), _this.state), {}, {
slideCount: _this.props.children.length
}));
_this.props.children.forEach(function (child) {
childrenWidths.push(child.props.style.width);
_trackWidth += child.props.style.width;
});
for (var i = 0; i < preClones; i++) {
_trackLeft += childrenWidths[childrenWidths.length - 1 - i];
_trackWidth += childrenWidths[childrenWidths.length - 1 - i];
}
for (var _i = 0; _i < postClones; _i++) {
_trackWidth += childrenWidths[_i];
}
for (var _i2 = 0; _i2 < _this.state.currentSlide; _i2++) {
_trackLeft += childrenWidths[_i2];
}
var _trackStyle = {
width: _trackWidth + "px",
left: -_trackLeft + "px"
};
if (_this.props.centerMode) {
var currentWidth = "".concat(childrenWidths[_this.state.currentSlide], "px");
_trackStyle.left = "calc(".concat(_trackStyle.left, " + (100% - ").concat(currentWidth, ") / 2 ) ");
}
return {
trackStyle: _trackStyle
};
}
var childrenCount = external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.count(_this.props.children);
var spec = (0,objectSpread2["default"])((0,objectSpread2["default"])((0,objectSpread2["default"])({}, _this.props), _this.state), {}, {
slideCount: childrenCount
});
var slideCount = getPreClones(spec) + getPostClones(spec) + childrenCount;
var trackWidth = 100 / _this.props.slidesToShow * slideCount;
var slideWidth = 100 / slideCount;
var trackLeft = -slideWidth * (getPreClones(spec) + _this.state.currentSlide) * trackWidth / 100;
if (_this.props.centerMode) {
trackLeft += (100 - slideWidth * trackWidth / 100) / 2;
}
var trackStyle = {
width: trackWidth + "%",
left: trackLeft + "%"
};
return {
slideWidth: slideWidth + "%",
trackStyle: trackStyle
};
});
(0,defineProperty["default"])(_this, "checkImagesLoad", function () {
var images = _this.list && _this.list.querySelectorAll && _this.list.querySelectorAll(".slick-slide img") || [];
var imagesCount = images.length,
loadedCount = 0;
Array.prototype.forEach.call(images, function (image) {
var handler = function handler() {
return ++loadedCount && loadedCount >= imagesCount && _this.onWindowResized();
};
if (!image.onclick) {
image.onclick = function () {
return image.parentNode.focus();
};
} else {
var prevClickHandler = image.onclick;
image.onclick = function (e) {
prevClickHandler(e);
image.parentNode.focus();
};
}
if (!image.onload) {
if (_this.props.lazyLoad) {
image.onload = function () {
_this.adaptHeight();
_this.callbackTimers.push(setTimeout(_this.onWindowResized, _this.props.speed));
};
} else {
image.onload = handler;
image.onerror = function () {
handler();
_this.props.onLazyLoadError && _this.props.onLazyLoadError();
};
}
}
});
});
(0,defineProperty["default"])(_this, "progressiveLazyLoad", function () {
var slidesToLoad = [];
var spec = (0,objectSpread2["default"])((0,objectSpread2["default"])({}, _this.props), _this.state);
for (var index = _this.state.currentSlide; index < _this.state.slideCount + getPostClones(spec); index++) {
if (_this.state.lazyLoadedList.indexOf(index) < 0) {
slidesToLoad.push(index);
break;
}
}
for (var _index = _this.state.currentSlide - 1; _index >= -getPreClones(spec); _index--) {
if (_this.state.lazyLoadedList.indexOf(_index) < 0) {
slidesToLoad.push(_index);
break;
}
}
if (slidesToLoad.length > 0) {
_this.setState(function (state) {
return {
lazyLoadedList: state.lazyLoadedList.concat(slidesToLoad)
};
});
if (_this.props.onLazyLoad) {
_this.props.onLazyLoad(slidesToLoad);
}
} else {
if (_this.lazyLoadTimer) {
clearInterval(_this.lazyLoadTimer);
delete _this.lazyLoadTimer;
}
}
});
(0,defineProperty["default"])(_this, "slideHandler", function (index) {
var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var _this$props = _this.props,
asNavFor = _this$props.asNavFor,
beforeChange = _this$props.beforeChange,
onLazyLoad = _this$props.onLazyLoad,
speed = _this$props.speed,
afterChange = _this$props.afterChange;
// capture currentslide before state is updated
var currentSlide = _this.state.currentSlide;
var _slideHandler = slideHandler((0,objectSpread2["default"])((0,objectSpread2["default"])((0,objectSpread2["default"])({
index: index
}, _this.props), _this.state), {}, {
trackRef: _this.track,
useCSS: _this.props.useCSS && !dontAnimate
})),
state = _slideHandler.state,
nextState = _slideHandler.nextState;
if (!state) return;
beforeChange && beforeChange(currentSlide, state.currentSlide);
var slidesToLoad = state.lazyLoadedList.filter(function (value) {
return _this.state.lazyLoadedList.indexOf(value) < 0;
});
onLazyLoad && slidesToLoad.length > 0 && onLazyLoad(slidesToLoad);
if (!_this.props.waitForAnimate && _this.animationEndCallback) {
clearTimeout(_this.animationEndCallback);
afterChange && afterChange(currentSlide);
delete _this.animationEndCallback;
}
_this.setState(state, function () {
// asNavForIndex check is to avoid recursive calls of slideHandler in waitForAnimate=false mode
if (asNavFor && _this.asNavForIndex !== index) {
_this.asNavForIndex = index;
asNavFor.innerSlider.slideHandler(index);
}
if (!nextState) return;
_this.animationEndCallback = setTimeout(function () {
var animating = nextState.animating,
firstBatch = objectWithoutProperties_objectWithoutProperties(nextState, inner_slider_excluded);
_this.setState(firstBatch, function () {
_this.callbackTimers.push(setTimeout(function () {
return _this.setState({
animating: animating
});
}, 10));
afterChange && afterChange(state.currentSlide);
delete _this.animationEndCallback;
});
}, speed);
});
});
(0,defineProperty["default"])(_this, "changeSlide", function (options) {
var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var spec = (0,objectSpread2["default"])((0,objectSpread2["default"])({}, _this.props), _this.state);
var targetSlide = changeSlide(spec, options);
if (targetSlide !== 0 && !targetSlide) return;
if (dontAnimate === true) {
_this.slideHandler(targetSlide, dontAnimate);
} else {
_this.slideHandler(targetSlide);
}
_this.props.autoplay && _this.autoPlay("update");
if (_this.props.focusOnSelect) {
var nodes = _this.list.querySelectorAll(".slick-current");
nodes[0] && nodes[0].focus();
}
});
(0,defineProperty["default"])(_this, "clickHandler", function (e) {
if (_this.clickable === false) {
e.stopPropagation();
e.preventDefault();
}
_this.clickable = true;
});
(0,defineProperty["default"])(_this, "keyHandler", function (e) {
var dir = keyHandler(e, _this.props.accessibility, _this.props.rtl);
dir !== "" && _this.changeSlide({
message: dir
});
});
(0,defineProperty["default"])(_this, "selectHandler", function (options) {
_this.changeSlide(options);
});
(0,defineProperty["default"])(_this, "disableBodyScroll", function () {
var preventDefault = function preventDefault(e) {
e = e || window.event;
if (e.preventDefault) e.preventDefault();
e.returnValue = false;
};
window.ontouchmove = preventDefault;
});
(0,defineProperty["default"])(_this, "enableBodyScroll", function () {
window.ontouchmove = null;
});
(0,defineProperty["default"])(_this, "swipeStart", function (e) {
if (_this.props.verticalSwiping) {
_this.disableBodyScroll();
}
var state = swipeStart(e, _this.props.swipe, _this.props.draggable);
state !== "" && _this.setState(state);
});
(0,defineProperty["default"])(_this, "swipeMove", function (e) {
var state = swipeMove(e, (0,objectSpread2["default"])((0,objectSpread2["default"])((0,objectSpread2["default"])({}, _this.props), _this.state), {}, {
trackRef: _this.track,
listRef: _this.list,
slideIndex: _this.state.currentSlide
}));
if (!state) return;
if (state["swiping"]) {
_this.clickable = false;
}
_this.setState(state);
});
(0,defineProperty["default"])(_this, "swipeEnd", function (e) {
var state = swipeEnd(e, (0,objectSpread2["default"])((0,objectSpread2["default"])((0,objectSpread2["default"])({}, _this.props), _this.state), {}, {
trackRef: _this.track,
listRef: _this.list,
slideIndex: _this.state.currentSlide
}));
if (!state) return;
var triggerSlideHandler = state["triggerSlideHandler"];
delete state["triggerSlideHandler"];
_this.setState(state);
if (triggerSlideHandler === undefined) return;
_this.slideHandler(triggerSlideHandler);
if (_this.props.verticalSwiping) {
_this.enableBodyScroll();
}
});
(0,defineProperty["default"])(_this, "touchEnd", function (e) {
_this.swipeEnd(e);
_this.clickable = true;
});
(0,defineProperty["default"])(_this, "slickPrev", function () {
// this and fellow methods are wrapped in setTimeout
// to make sure initialize setState has happened before
// any of such methods are called
_this.callbackTimers.push(setTimeout(function () {
return _this.changeSlide({
message: "previous"
});
}, 0));
});
(0,defineProperty["default"])(_this, "slickNext", function () {
_this.callbackTimers.push(setTimeout(function () {
return _this.changeSlide({
message: "next"
});
}, 0));
});
(0,defineProperty["default"])(_this, "slickGoTo", function (slide) {
var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
slide = Number(slide);
if (isNaN(slide)) return "";
_this.callbackTimers.push(setTimeout(function () {
return _this.changeSlide({
message: "index",
index: slide,
currentSlide: _this.state.currentSlide
}, dontAnimate);
}, 0));
});
(0,defineProperty["default"])(_this, "play", function () {
var nextIndex;
if (_this.props.rtl) {
nextIndex = _this.state.currentSlide - _this.props.slidesToScroll;
} else {
if (canGoNext((0,objectSpread2["default"])((0,objectSpread2["default"])({}, _this.props), _this.state))) {
nextIndex = _this.state.currentSlide + _this.props.slidesToScroll;
} else {
return false;
}
}
_this.slideHandler(nextIndex);
});
(0,defineProperty["default"])(_this, "autoPlay", function (playType) {
if (_this.autoplayTimer) {
clearInterval(_this.autoplayTimer);
}
var autoplaying = _this.state.autoplaying;
if (playType === "update") {
if (autoplaying === "hovered" || autoplaying === "focused" || autoplaying === "paused") {
return;
}
} else if (playType === "leave") {
if (autoplaying === "paused" || autoplaying === "focused") {
return;
}
} else if (playType === "blur") {
if (autoplaying === "paused" || autoplaying === "hovered") {
return;
}
}
_this.autoplayTimer = setInterval(_this.play, _this.props.autoplaySpeed + 50);
_this.setState({
autoplaying: "playing"
});
});
(0,defineProperty["default"])(_this, "pause", function (pauseType) {
if (_this.autoplayTimer) {
clearInterval(_this.autoplayTimer);
_this.autoplayTimer = null;
}
var autoplaying = _this.state.autoplaying;
if (pauseType === "paused") {
_this.setState({
autoplaying: "paused"
});
} else if (pauseType === "focused") {
if (autoplaying === "hovered" || autoplaying === "playing") {
_this.setState({
autoplaying: "focused"
});
}
} else {
// pauseType is 'hovered'
if (autoplaying === "playing") {
_this.setState({
autoplaying: "hovered"
});
}
}
});
(0,defineProperty["default"])(_this, "onDotsOver", function () {
return _this.props.autoplay && _this.pause("hovered");
});
(0,defineProperty["default"])(_this, "onDotsLeave", function () {
return _this.props.autoplay && _this.state.autoplaying === "hovered" && _this.autoPlay("leave");
});
(0,defineProperty["default"])(_this, "onTrackOver", function () {
return _this.props.autoplay && _this.pause("hovered");
});
(0,defineProperty["default"])(_this, "onTrackLeave", function () {
return _this.props.autoplay && _this.state.autoplaying === "hovered" && _this.autoPlay("leave");
});
(0,defineProperty["default"])(_this, "onSlideFocus", function () {
return _this.props.autoplay && _this.pause("focused");
});
(0,defineProperty["default"])(_this, "onSlideBlur", function () {
return _this.props.autoplay && _this.state.autoplaying === "focused" && _this.autoPlay("blur");
});
(0,defineProperty["default"])(_this, "render", function () {
var className = (0,clsx.clsx)("slick-slider", _this.props.className, {
"slick-vertical": _this.props.vertical,
"slick-initialized": true
});
var spec = (0,objectSpread2["default"])((0,objectSpread2["default"])({}, _this.props), _this.state);
var trackProps = extractObject(spec, ["fade", "cssEase", "speed", "infinite", "centerMode", "focusOnSelect", "currentSlide", "lazyLoad", "lazyLoadedList", "rtl", "slideWidth", "slideHeight", "listHeight", "vertical", "slidesToShow", "slidesToScroll", "slideCount", "trackStyle", "variableWidth", "unslick", "centerPadding", "targetSlide", "useCSS"]);
var pauseOnHover = _this.props.pauseOnHover;
trackProps = (0,objectSpread2["default"])((0,objectSpread2["default"])({}, trackProps), {}, {
onMouseEnter: pauseOnHover ? _this.onTrackOver : null,
onMouseLeave: pauseOnHover ? _this.onTrackLeave : null,
onMouseOver: pauseOnHover ? _this.onTrackOver : null,
focusOnSelect: _this.props.focusOnSelect && _this.clickable ? _this.selectHandler : null
});
var dots;
if (_this.props.dots === true && _this.state.slideCount >= _this.props.slidesToShow) {
var dotProps = extractObject(spec, ["dotsClass", "slideCount", "slidesToShow", "currentSlide", "slidesToScroll", "clickHandler", "children", "customPaging", "infinite", "appendDots"]);
var pauseOnDotsHover = _this.props.pauseOnDotsHover;
dotProps = (0,objectSpread2["default"])((0,objectSpread2["default"])({}, dotProps), {}, {
clickHandler: _this.changeSlide,
onMouseEnter: pauseOnDotsHover ? _this.onDotsLeave : null,
onMouseOver: pauseOnDotsHover ? _this.onDotsOver : null,
onMouseLeave: pauseOnDotsHover ? _this.onDotsLeave : null
});
dots = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Dots, dotProps);
}
var prevArrow, nextArrow;
var arrowProps = extractObject(spec, ["infinite", "centerMode", "currentSlide", "slideCount", "slidesToShow", "prevArrow", "nextArrow"]);
arrowProps.clickHandler = _this.changeSlide;
if (_this.props.arrows) {
prevArrow = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(PrevArrow, arrowProps);
nextArrow = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(NextArrow, arrowProps);
}
var verticalHeightStyle = null;
if (_this.props.vertical) {
verticalHeightStyle = {
height: _this.state.listHeight
};
}
var centerPaddingStyle = null;
if (_this.props.vertical === false) {
if (_this.props.centerMode === true) {
centerPaddingStyle = {
padding: "0px " + _this.props.centerPadding
};
}
} else {
if (_this.props.centerMode === true) {
centerPaddingStyle = {
padding: _this.props.centerPadding + " 0px"
};
}
}
var listStyle = (0,objectSpread2["default"])((0,objectSpread2["default"])({}, verticalHeightStyle), centerPaddingStyle);
var touchMove = _this.props.touchMove;
var listProps = {
className: "slick-list",
style: listStyle,
onClick: _this.clickHandler,
onMouseDown: touchMove ? _this.swipeStart : null,
onMouseMove: _this.state.dragging && touchMove ? _this.swipeMove : null,
onMouseUp: touchMove ? _this.swipeEnd : null,
onMouseLeave: _this.state.dragging && touchMove ? _this.swipeEnd : null,
onTouchStart: touchMove ? _this.swipeStart : null,
onTouchMove: _this.state.dragging && touchMove ? _this.swipeMove : null,
onTouchEnd: touchMove ? _this.touchEnd : null,
onTouchCancel: _this.state.dragging && touchMove ? _this.swipeEnd : null,
onKeyDown: _this.props.accessibility ? _this.keyHandler : null
};
var innerSliderProps = {
className: className,
dir: "ltr",
style: _this.props.style
};
if (_this.props.unslick) {
listProps = {
className: "slick-list"
};
innerSliderProps = {
className: className,
style: _this.props.style
};
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", innerSliderProps, !_this.props.unslick ? prevArrow : "", /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", (0,esm_extends["default"])({
ref: _this.listRefHandler
}, listProps), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Track, (0,esm_extends["default"])({
ref: _this.trackRefHandler
}, trackProps), _this.props.children)), !_this.props.unslick ? nextArrow : "", !_this.props.unslick ? dots : "");
});
_this.list = null;
_this.track = null;
_this.state = (0,objectSpread2["default"])((0,objectSpread2["default"])({}, initial_state), {}, {
currentSlide: _this.props.initialSlide,
targetSlide: _this.props.initialSlide ? _this.props.initialSlide : 0,
slideCount: external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.count(_this.props.children)
});
_this.callbackTimers = [];
_this.clickable = true;
_this.debouncedResize = null;
var ssrState = _this.ssrInit();
_this.state = (0,objectSpread2["default"])((0,objectSpread2["default"])({}, _this.state), ssrState);
return _this;
}
(0,inherits["default"])(InnerSlider, _React$Component);
return (0,createClass["default"])(InnerSlider, [{
key: "didPropsChange",
value: function didPropsChange(prevProps) {
var setTrackStyle = false;
for (var _i3 = 0, _Object$keys = Object.keys(this.props); _i3 < _Object$keys.length; _i3++) {
var key = _Object$keys[_i3];
// eslint-disable-next-line no-prototype-builtins
if (!prevProps.hasOwnProperty(key)) {
setTrackStyle = true;
break;
}
if ((0,esm_typeof["default"])(prevProps[key]) === "object" || typeof prevProps[key] === "function" || isNaN(prevProps[key])) {
continue;
}
if (prevProps[key] !== this.props[key]) {
setTrackStyle = true;
break;
}
}
return setTrackStyle || external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.count(this.props.children) !== external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.count(prevProps.children);
}
}]);
}((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Component);
// EXTERNAL MODULE: ./node_modules/json2mq/index.js
var json2mq = __webpack_require__("./node_modules/json2mq/index.js");
var json2mq_default = /*#__PURE__*/__webpack_require__.n(json2mq);
;// ./node_modules/@ant-design/react-slick/es/slider.js
function slider_callSuper(t, o, e) { return o = (0,getPrototypeOf["default"])(o), (0,possibleConstructorReturn["default"])(t, (0,isNativeReflectConstruct["default"])() ? Reflect.construct(o, e || [], (0,getPrototypeOf["default"])(t).constructor) : o.apply(t, e)); }
var Slider = /*#__PURE__*/function (_React$Component) {
function Slider(props) {
var _this;
(0,classCallCheck["default"])(this, Slider);
_this = slider_callSuper(this, Slider, [props]);
(0,defineProperty["default"])(_this, "innerSliderRefHandler", function (ref) {
return _this.innerSlider = ref;
});
(0,defineProperty["default"])(_this, "slickPrev", function () {
return _this.innerSlider.slickPrev();
});
(0,defineProperty["default"])(_this, "slickNext", function () {
return _this.innerSlider.slickNext();
});
(0,defineProperty["default"])(_this, "slickGoTo", function (slide) {
var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
return _this.innerSlider.slickGoTo(slide, dontAnimate);
});
(0,defineProperty["default"])(_this, "slickPause", function () {
return _this.innerSlider.pause("paused");
});
(0,defineProperty["default"])(_this, "slickPlay", function () {
return _this.innerSlider.autoPlay("play");
});
_this.state = {
breakpoint: null
};
_this._responsiveMediaHandlers = [];
return _this;
}
(0,inherits["default"])(Slider, _React$Component);
return (0,createClass["default"])(Slider, [{
key: "media",
value: function media(query, handler) {
// javascript handler for css media query
var mql = window.matchMedia(query);
var listener = function listener(_ref) {
var matches = _ref.matches;
if (matches) {
handler();
}
};
mql.addListener(listener);
this._responsiveMediaHandlers.push({
mql: mql,
query: query,
listener: listener
});
}
// handles responsive breakpoints
}, {
key: "componentDidMount",
value: function componentDidMount() {
var _this2 = this;
// performance monitoring
//if (process.env.NODE_ENV !== 'production') {
//const { whyDidYouUpdate } = require('why-did-you-update')
//whyDidYouUpdate(React)
//}
if (this.props.responsive) {
var breakpoints = this.props.responsive.map(function (breakpt) {
return breakpt.breakpoint;
});
// sort them in increasing order of their numerical value
breakpoints.sort(function (x, y) {
return x - y;
});
breakpoints.forEach(function (breakpoint, index) {
// media query for each breakpoint
var bQuery;
if (index === 0) {
bQuery = json2mq_default()({
minWidth: 0,
maxWidth: breakpoint
});
} else {
bQuery = json2mq_default()({
minWidth: breakpoints[index - 1] + 1,
maxWidth: breakpoint
});
}
// when not using server side rendering
canUseDOM() && _this2.media(bQuery, function () {
_this2.setState({
breakpoint: breakpoint
});
});
});
// Register media query for full screen. Need to support resize from small to large
// convert javascript object to media query string
var query = json2mq_default()({
minWidth: breakpoints.slice(-1)[0]
});
canUseDOM() && this.media(query, function () {
_this2.setState({
breakpoint: null
});
});
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this._responsiveMediaHandlers.forEach(function (obj) {
obj.mql.removeListener(obj.listener);
});
}
}, {
key: "render",
value: function render() {
var _this3 = this;
var settings;
var newProps;
if (this.state.breakpoint) {
newProps = this.props.responsive.filter(function (resp) {
return resp.breakpoint === _this3.state.breakpoint;
});
settings = newProps[0].settings === "unslick" ? "unslick" : (0,objectSpread2["default"])((0,objectSpread2["default"])((0,objectSpread2["default"])({}, default_props), this.props), newProps[0].settings);
} else {
settings = (0,objectSpread2["default"])((0,objectSpread2["default"])({}, default_props), this.props);
}
// force scrolling by one if centerMode is on
if (settings.centerMode) {
if (settings.slidesToScroll > 1 && "development" !== "production") {
console.warn("slidesToScroll should be equal to 1 in centerMode, you are using ".concat(settings.slidesToScroll));
}
settings.slidesToScroll = 1;
}
// force showing one slide and scrolling by one if the fade mode is on
if (settings.fade) {
if (settings.slidesToShow > 1 && "development" !== "production") {
console.warn("slidesToShow should be equal to 1 when fade is true, you're using ".concat(settings.slidesToShow));
}
if (settings.slidesToScroll > 1 && "development" !== "production") {
console.warn("slidesToScroll should be equal to 1 when fade is true, you're using ".concat(settings.slidesToScroll));
}
settings.slidesToShow = 1;
settings.slidesToScroll = 1;
}
// makes sure that children is an array, even when there is only 1 child
var children = external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.toArray(this.props.children);
// Children may contain false or null, so we should filter them
// children may also contain string filled with spaces (in certain cases where we use jsx strings)
children = children.filter(function (child) {
if (typeof child === "string") {
return !!child.trim();
}
return !!child;
});
// rows and slidesPerRow logic is handled here
if (settings.variableWidth && (settings.rows > 1 || settings.slidesPerRow > 1)) {
console.warn("variableWidth is not supported in case of rows > 1 or slidesPerRow > 1");
settings.variableWidth = false;
}
var newChildren = [];
var currentWidth = null;
for (var i = 0; i < children.length; i += settings.rows * settings.slidesPerRow) {
var newSlide = [];
for (var j = i; j < i + settings.rows * settings.slidesPerRow; j += settings.slidesPerRow) {
var row = [];
for (var k = j; k < j + settings.slidesPerRow; k += 1) {
if (settings.variableWidth && children[k].props.style) {
currentWidth = children[k].props.style.width;
}
if (k >= children.length) break;
row.push(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(children[k], {
key: 100 * i + 10 * j + k,
tabIndex: -1,
style: {
width: "".concat(100 / settings.slidesPerRow, "%"),
display: "inline-block"
}
}));
}
newSlide.push(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
key: 10 * i + j
}, row));
}
if (settings.variableWidth) {
newChildren.push(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
key: i,
style: {
width: currentWidth
}
}, newSlide));
} else {
newChildren.push(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
key: i
}, newSlide));
}
}
if (settings === "unslick") {
var className = "regular slider " + (this.props.className || "");
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: className
}, children);
} else if (newChildren.length <= settings.slidesToShow) {
settings.unslick = true;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(InnerSlider, (0,esm_extends["default"])({
style: this.props.style,
ref: this.innerSliderRefHandler
}, filterSettings(settings)), newChildren);
}
}]);
}((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Component);
;// ./node_modules/@ant-design/react-slick/es/index.js
/* harmony default export */ var react_slick_es = (Slider);
// EXTERNAL MODULE: ./components/carousel/style/index.ts
var carousel_style = __webpack_require__("./components/carousel/style/index.ts");
;// ./components/carousel/index.tsx
const dotsClass = 'slick-dots';
const ArrowButton = ({
currentSlide,
slideCount,
...rest
}) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
...rest
}));
const Carousel = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
dots = true,
arrows = false,
prevArrow,
nextArrow,
draggable = false,
waitForAnimate = false,
dotPosition,
dotPlacement,
vertical,
rootClassName,
className: customClassName,
style,
id,
autoplay = false,
autoplaySpeed = 3000,
rtl,
...otherProps
} = props;
const mergedDotPlacement = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const placement = dotPlacement ?? dotPosition ?? 'bottom';
switch (placement) {
case 'left':
return 'start';
case 'right':
return 'end';
default:
return placement;
}
}, [dotPosition, dotPlacement]);
const mergedVertical = vertical ?? (mergedDotPlacement === 'start' || mergedDotPlacement === 'end');
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle
} = (0,config_provider_context.useComponentConfig)('carousel');
const slickRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const goTo = (slide, dontAnimate = false) => {
slickRef.current.slickGoTo(slide, dontAnimate);
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
goTo,
autoPlay: slickRef.current.innerSlider.autoPlay,
innerSlider: slickRef.current.innerSlider,
prev: slickRef.current.slickPrev,
next: slickRef.current.slickNext
}), [slickRef.current]);
const {
children,
initialSlide = 0
} = props;
const childNodes = (0,es.toArray)(children);
const count = childNodes.length;
const isRTL = (rtl ?? direction === 'rtl') && !vertical;
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (count > 0) {
const newIndex = isRTL ? count - initialSlide - 1 : initialSlide;
goTo(newIndex, false);
}
}, [count, initialSlide, isRTL]);
// ========================== Warn ==========================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Carousel');
warning.deprecated(!dotPosition, 'dotPosition', 'dotPlacement');
}
const newProps = {
vertical: mergedVertical,
className: (0,clsx.clsx)(customClassName, contextClassName),
style: {
...contextStyle,
...style
},
autoplay: !!autoplay,
...otherProps
};
if (newProps.effect === 'fade') {
newProps.fade = true;
}
const prefixCls = getPrefixCls('carousel', newProps.prefixCls);
const enableDots = !!dots;
const dsClass = (0,clsx.clsx)(dotsClass, `${dotsClass}-${mergedDotPlacement}`, typeof dots === 'boolean' ? false : dots?.className);
const [hashId, cssVarCls] = (0,carousel_style["default"])(prefixCls);
const className = (0,clsx.clsx)(prefixCls, {
[`${prefixCls}-rtl`]: isRTL,
[`${prefixCls}-vertical`]: newProps.vertical
}, hashId, cssVarCls, rootClassName);
const mergedShowDuration = autoplay && ((0,is.isPlainObject)(autoplay) ? autoplay.dotDuration : false);
const dotDurationStyle = mergedShowDuration ? {
[carousel_style.DotDuration]: `${autoplaySpeed}ms`
} : {};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: className,
id: id,
style: dotDurationStyle
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(react_slick_es, {
ref: slickRef,
...newProps,
dots: enableDots,
dotsClass: dsClass,
arrows: arrows,
prevArrow: prevArrow ?? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(ArrowButton, {
"aria-label": isRTL ? 'next' : 'prev'
}),
nextArrow: nextArrow ?? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(ArrowButton, {
"aria-label": isRTL ? 'prev' : 'next'
}),
draggable: draggable,
verticalSwiping: mergedVertical,
autoplaySpeed: autoplaySpeed,
waitForAnimate: waitForAnimate,
rtl: isRTL
}));
});
if (true) {
Carousel.displayName = 'Carousel';
}
/* harmony default export */ var carousel = (Carousel);
;// ./node_modules/@rc-component/cascader/es/context.js
const CascaderContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({});
/* harmony default export */ var cascader_es_context = (CascaderContext);
;// ./node_modules/@rc-component/cascader/es/hooks/useSearchOptions.js
const SEARCH_MARK = '__rc_cascader_search_mark__';
const defaultFilter = (search, options, {
label = ''
}) => options.some(opt => String(opt[label]).toLowerCase().includes(search.toLowerCase()));
const defaultRender = (inputValue, path, prefixCls, fieldNames) => path.map(opt => opt[fieldNames.label]).join(' / ');
const useSearchOptions = (search, options, fieldNames, prefixCls, config, enableHalfPath) => {
const {
filter = defaultFilter,
render = defaultRender,
limit = 50,
sort
} = config;
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const filteredOptions = [];
if (!search) {
return [];
}
function dig(list, pathOptions, parentDisabled = false) {
list.forEach(option => {
// Perf saving when `sort` is disabled and `limit` is provided
if (!sort && limit !== false && limit > 0 && filteredOptions.length >= limit) {
return;
}
const connectedPathOptions = [...pathOptions, option];
const children = option[fieldNames.children];
const mergedDisabled = parentDisabled || option.disabled;
// If current option is filterable
if (
// If is leaf option
!children || children.length === 0 ||
// If is changeOnSelect or multiple
enableHalfPath) {
if (filter(search, connectedPathOptions, {
label: fieldNames.label
})) {
filteredOptions.push({
...option,
disabled: mergedDisabled,
[fieldNames.label]: render(search, connectedPathOptions, prefixCls, fieldNames),
[SEARCH_MARK]: connectedPathOptions,
[fieldNames.children]: undefined
});
}
}
if (children) {
dig(option[fieldNames.children], connectedPathOptions, mergedDisabled);
}
});
}
dig(options, []);
// Do sort
if (sort) {
filteredOptions.sort((a, b) => {
return sort(a[SEARCH_MARK], b[SEARCH_MARK], search, fieldNames);
});
}
return limit !== false && limit > 0 ? filteredOptions.slice(0, limit) : filteredOptions;
}, [search, options, fieldNames, prefixCls, render, enableHalfPath, filter, sort, limit]);
};
/* harmony default export */ var hooks_useSearchOptions = (useSearchOptions);
;// ./node_modules/@rc-component/cascader/es/utils/commonUtil.js
const VALUE_SPLIT = '__RC_CASCADER_SPLIT__';
const SHOW_PARENT = 'SHOW_PARENT';
const SHOW_CHILD = 'SHOW_CHILD';
/**
* Will convert value to string, and join with `VALUE_SPLIT`
*/
function toPathKey(value) {
return value.join(VALUE_SPLIT);
}
/**
* Batch convert value to string, and join with `VALUE_SPLIT`
*/
function toPathKeys(value) {
return value.map(toPathKey);
}
function toPathValueStr(pathKey) {
return pathKey.split(VALUE_SPLIT);
}
function commonUtil_fillFieldNames(fieldNames) {
const {
label,
value,
children
} = fieldNames || {};
const val = value || 'value';
return {
label: label || 'label',
value: val,
key: val,
children: children || 'children'
};
}
function isLeaf(option, fieldNames) {
return option.isLeaf ?? !option[fieldNames.children]?.length;
}
function scrollIntoParentView(element) {
const parent = element.parentElement;
if (!parent) {
return;
}
const elementToParent = element.offsetTop - parent.offsetTop; // offsetParent may not be parent.
if (elementToParent - parent.scrollTop < 0) {
parent.scrollTo({
top: elementToParent
});
} else if (elementToParent + element.offsetHeight - parent.scrollTop > parent.offsetHeight) {
parent.scrollTo({
top: elementToParent + element.offsetHeight - parent.offsetHeight
});
}
}
function getFullPathKeys(options, fieldNames) {
return options.map(item => item[SEARCH_MARK]?.map(opt => opt[fieldNames.value]));
}
function isMultipleValue(value) {
return Array.isArray(value) && Array.isArray(value[0]);
}
function toRawValues(value) {
if (!value) {
return [];
}
if (isMultipleValue(value)) {
return value;
}
return (value.length === 0 ? [] : [value]).map(val => Array.isArray(val) ? val : [val]);
}
;// ./node_modules/@rc-component/cascader/es/utils/treeUtil.js
function formatStrategyValues(pathKeys, getKeyPathEntities, showCheckedStrategy) {
const valueSet = new Set(pathKeys);
const keyPathEntities = getKeyPathEntities();
return pathKeys.filter(key => {
const entity = keyPathEntities[key];
const parent = entity ? entity.parent : null;
const children = entity ? entity.children : null;
if (entity && entity.node.disabled) {
return true;
}
return showCheckedStrategy === SHOW_CHILD ? !(children && children.some(child => child.key && valueSet.has(child.key))) : !(parent && !parent.node.disabled && valueSet.has(parent.key));
});
}
function toPathOptions(valueCells, options, fieldNames,
// Used for loadingKeys which saved loaded keys as string
stringMode = false) {
let currentList = options;
const valueOptions = [];
for (let i = 0; i < valueCells.length; i += 1) {
const valueCell = valueCells[i];
const foundIndex = currentList?.findIndex(option => {
const val = option[fieldNames.value];
return stringMode ? String(val) === String(valueCell) : val === valueCell;
});
const foundOption = foundIndex !== -1 ? currentList?.[foundIndex] : null;
valueOptions.push({
value: foundOption?.[fieldNames.value] ?? valueCell,
index: foundIndex,
option: foundOption
});
currentList = foundOption?.[fieldNames.children];
}
return valueOptions;
}
;// ./node_modules/@rc-component/cascader/es/hooks/useDisplayValues.js
/* harmony default export */ var useDisplayValues = ((rawValues, options, fieldNames, multiple, displayRender) => {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const mergedDisplayRender = displayRender || (
// Default displayRender
labels => {
const mergedLabels = multiple ? labels.slice(-1) : labels;
const SPLIT = ' / ';
if (mergedLabels.every(label => ['string', 'number'].includes(typeof label))) {
return mergedLabels.join(SPLIT);
}
// If exist non-string value, use ReactNode instead
return mergedLabels.reduce((list, label, index) => {
const keyedLabel = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(label) ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement(label, {
key: index
}) : label;
if (index === 0) {
return [keyedLabel];
}
return [...list, SPLIT, keyedLabel];
}, []);
});
return rawValues.map(valueCells => {
const valueOptions = toPathOptions(valueCells, options, fieldNames);
const label = mergedDisplayRender(valueOptions.map(({
option,
value
}) => option?.[fieldNames.label] ?? value), valueOptions.map(({
option
}) => option));
const value = toPathKey(valueCells);
return {
label,
value,
key: value,
valueCells,
disabled: valueOptions[valueOptions.length - 1]?.option?.disabled
};
});
}, [rawValues, options, fieldNames, displayRender, multiple]);
});
(Object.getOwnPropertyDescriptor(useDisplayValues, "name") || {}).writable || Object.defineProperty(useDisplayValues, "name", { value: "default", configurable: true });
;// ./node_modules/@rc-component/cascader/es/hooks/useMissingValues.js
function useMissingValues(options, fieldNames) {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(rawValues => {
const missingValues = [];
const existsValues = [];
rawValues.forEach(valueCell => {
const pathOptions = toPathOptions(valueCell, options, fieldNames);
if (pathOptions.every(opt => opt.option)) {
existsValues.push(valueCell);
} else {
missingValues.push(valueCell);
}
});
return [existsValues, missingValues];
}, [options, fieldNames]);
}
;// ./node_modules/@rc-component/tree/es/utils/keyUtil.js
function getEntity(keyEntities, key) {
return keyEntities[key];
}
;// ./node_modules/@rc-component/tree/es/utils/treeUtil.js
function getPosition(level, index) {
return `${level}-${index}`;
}
function isTreeNode(node) {
return node && node.type && node.type.isTreeNode;
}
function treeUtil_getKey(key, pos) {
if (key !== null && key !== undefined) {
return key;
}
return pos;
}
function treeUtil_fillFieldNames(fieldNames) {
const {
title,
_title,
key,
children
} = fieldNames || {};
const mergedTitle = title || 'title';
return {
title: mergedTitle,
_title: _title || [mergedTitle],
key: key || 'key',
children: children || 'children'
};
}
/**
* Warning if TreeNode do not provides key
*/
function warningWithoutKey(treeData, fieldNames) {
const keys = new Map();
function dig(list, path = '') {
(list || []).forEach(treeNode => {
const key = treeNode[fieldNames.key];
const children = treeNode[fieldNames.children];
(0,warning["default"])(key !== null && key !== undefined, `Tree node must have a certain key: [${path}${key}]`);
const recordKey = String(key);
(0,warning["default"])(!keys.has(recordKey) || key === null || key === undefined, `Same 'key' exist in the Tree: ${recordKey}`);
keys.set(recordKey, true);
dig(children, `${path}${recordKey} > `);
});
}
dig(treeData);
}
/**
* Convert `children` of Tree into `treeData` structure.
*/
function convertTreeToData(rootNodes) {
function dig(node) {
const treeNodes = (0,toArray["default"])(node);
return treeNodes.map(treeNode => {
// Filter invalidate node
if (!isTreeNode(treeNode)) {
(0,warning["default"])(!treeNode, 'Tree/TreeNode can only accept TreeNode as children.');
return null;
}
const {
key
} = treeNode;
const {
children,
...rest
} = treeNode.props;
const dataNode = {
key: key,
...rest
};
const parsedChildren = dig(children);
if (parsedChildren.length) {
dataNode.children = parsedChildren;
}
return dataNode;
}).filter(dataNode => dataNode);
}
return dig(rootNodes);
}
/**
* Flat nest tree data into flatten list. This is used for virtual list render.
* @param treeNodeList Origin data node list
* @param expandedKeys
* need expanded keys, provides `true` means all expanded (used in `rc-tree-select`).
*/
function flattenTreeData(treeNodeList, expandedKeys, fieldNames) {
const {
_title: fieldTitles,
key: fieldKey,
children: fieldChildren
} = treeUtil_fillFieldNames(fieldNames);
const expandedKeySet = new Set(expandedKeys === true ? [] : expandedKeys);
const flattenList = [];
function dig(list, parent = null) {
return list.map((treeNode, index) => {
const pos = getPosition(parent ? parent.pos : '0', index);
const mergedKey = treeUtil_getKey(treeNode[fieldKey], pos);
// Pick matched title in field title list
let mergedTitle;
for (let i = 0; i < fieldTitles.length; i += 1) {
const fieldTitle = fieldTitles[i];
if (treeNode[fieldTitle] !== undefined) {
mergedTitle = treeNode[fieldTitle];
break;
}
}
// Add FlattenDataNode into list
// We use `Object.assign` here to save perf since babel's `objectSpread` has perf issue
const flattenNode = Object.assign((0,omit["default"])(treeNode, [...fieldTitles, fieldKey, fieldChildren]), {
title: mergedTitle,
key: mergedKey,
parent,
pos,
children: null,
data: treeNode,
isStart: [...(parent ? parent.isStart : []), index === 0],
isEnd: [...(parent ? parent.isEnd : []), index === list.length - 1]
});
flattenList.push(flattenNode);
// Loop treeNode children
if (expandedKeys === true || expandedKeySet.has(mergedKey)) {
flattenNode.children = dig(treeNode[fieldChildren] || [], flattenNode);
} else {
flattenNode.children = [];
}
return flattenNode;
});
}
dig(treeNodeList);
return flattenList;
}
/**
* Traverse all the data by `treeData`.
* Please not use it out of the `rc-tree` since we may refactor this code.
*/
function traverseDataNodes(dataNodes, callback,
// To avoid too many params, let use config instead of origin param
config) {
let mergedConfig = {};
if (typeof config === 'object') {
mergedConfig = config;
} else {
mergedConfig = {
externalGetKey: config
};
}
mergedConfig = mergedConfig || {};
// Init config
const {
childrenPropName,
externalGetKey,
fieldNames
} = mergedConfig;
const {
key: fieldKey,
children: fieldChildren
} = treeUtil_fillFieldNames(fieldNames);
const mergeChildrenPropName = childrenPropName || fieldChildren;
// Get keys
let syntheticGetKey;
if (externalGetKey) {
if (typeof externalGetKey === 'string') {
syntheticGetKey = node => node[externalGetKey];
} else if (typeof externalGetKey === 'function') {
syntheticGetKey = node => externalGetKey(node);
}
} else {
syntheticGetKey = (node, pos) => treeUtil_getKey(node[fieldKey], pos);
}
// Process
function processNode(node, index, parent, pathNodes) {
const children = node ? node[mergeChildrenPropName] : dataNodes;
const pos = node ? getPosition(parent.pos, index) : '0';
const connectNodes = node ? [...pathNodes, node] : [];
// Process node if is not root
if (node) {
const key = syntheticGetKey(node, pos);
const data = {
node,
index,
pos,
key,
parentPos: parent.node ? parent.pos : null,
level: parent.level + 1,
nodes: connectNodes
};
callback(data);
}
// Process children node
if (children) {
children.forEach((subNode, subIndex) => {
processNode(subNode, subIndex, {
node,
pos,
level: parent ? parent.level + 1 : -1
}, connectNodes);
});
}
}
processNode(null);
}
/**
* Convert `treeData` into entity records.
*/
function convertDataToEntities(dataNodes, {
initWrapper,
processEntity,
onProcessFinished,
externalGetKey,
childrenPropName,
fieldNames
} = {}, /** @deprecated Use `config.externalGetKey` instead */
legacyExternalGetKey) {
// Init config
const mergedExternalGetKey = externalGetKey || legacyExternalGetKey;
const posEntities = {};
const keyEntities = {};
let wrapper = {
posEntities,
keyEntities
};
if (initWrapper) {
wrapper = initWrapper(wrapper) || wrapper;
}
traverseDataNodes(dataNodes, item => {
const {
node,
index,
pos,
key,
parentPos,
level,
nodes
} = item;
const entity = {
node,
nodes,
index,
key,
pos,
level
};
const mergedKey = treeUtil_getKey(key, pos);
posEntities[pos] = entity;
keyEntities[mergedKey] = entity;
// Fill children
entity.parent = posEntities[parentPos];
if (entity.parent) {
entity.parent.children = entity.parent.children || [];
entity.parent.children.push(entity);
}
if (processEntity) {
processEntity(entity, wrapper);
}
}, {
externalGetKey: mergedExternalGetKey,
childrenPropName,
fieldNames
});
if (onProcessFinished) {
onProcessFinished(wrapper);
}
return wrapper;
}
function isLeafNode(isLeaf, loadData, hasChildren, loaded) {
if (isLeaf === false) {
return false;
}
return isLeaf || !loadData && !hasChildren || loadData && loaded && !hasChildren;
}
/**
* Get TreeNode props with Tree props.
*/
function getTreeNodeProps(key, {
expandedKeys,
selectedKeys,
loadedKeys,
loadingKeys,
checkedKeys,
halfCheckedKeys,
dragOverNodeKey,
dropPosition,
keyEntities
}) {
const entity = getEntity(keyEntities, key);
const treeNodeProps = {
eventKey: key,
expanded: expandedKeys.indexOf(key) !== -1,
selected: selectedKeys.indexOf(key) !== -1,
loaded: loadedKeys.indexOf(key) !== -1,
loading: loadingKeys.indexOf(key) !== -1,
checked: checkedKeys.indexOf(key) !== -1,
halfChecked: halfCheckedKeys.indexOf(key) !== -1,
pos: String(entity ? entity.pos : ''),
// [Legacy] Drag props
// Since the interaction of drag is changed, the semantic of the props are
// not accuracy, I think it should be finally removed
dragOver: dragOverNodeKey === key && dropPosition === 0,
dragOverGapTop: dragOverNodeKey === key && dropPosition === -1,
dragOverGapBottom: dragOverNodeKey === key && dropPosition === 1
};
return treeNodeProps;
}
function convertNodePropsToEventData(props) {
const {
data,
expanded,
selected,
checked,
loaded,
loading,
halfChecked,
dragOver,
dragOverGapTop,
dragOverGapBottom,
pos,
active,
eventKey
} = props;
const eventData = {
...data,
expanded,
selected,
checked,
loaded,
loading,
halfChecked,
dragOver,
dragOverGapTop,
dragOverGapBottom,
pos,
active,
key: eventKey
};
if (!('props' in eventData)) {
Object.defineProperty(eventData, 'props', {
get() {
(0,warning["default"])(false, 'Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`.');
return props;
}
});
}
return eventData;
}
;// ./node_modules/@rc-component/cascader/es/hooks/useEntities.js
/** Lazy parse options data into conduct-able info to avoid perf issue in single mode */
/* harmony default export */ var useEntities = ((options, fieldNames) => {
const cacheRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({
options: [],
info: {
keyEntities: {},
pathKeyEntities: {}
}
});
const getEntities = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(() => {
if (cacheRef.current.options !== options) {
cacheRef.current.options = options;
cacheRef.current.info = convertDataToEntities(options, {
fieldNames: fieldNames,
initWrapper: wrapper => ({
...wrapper,
pathKeyEntities: {}
}),
processEntity: (entity, wrapper) => {
const pathKey = entity.nodes.map(node => node[fieldNames.value]).join(VALUE_SPLIT);
wrapper.pathKeyEntities[pathKey] = entity;
// Overwrite origin key.
// this is very hack but we need let conduct logic work with connect path
entity.key = pathKey;
}
});
}
return cacheRef.current.info.pathKeyEntities;
}, [fieldNames, options]);
return getEntities;
});
(Object.getOwnPropertyDescriptor(useEntities, "name") || {}).writable || Object.defineProperty(useEntities, "name", { value: "default", configurable: true });
;// ./node_modules/@rc-component/cascader/es/hooks/useOptions.js
function useOptions_useOptions(mergedFieldNames, options) {
const mergedOptions = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => options || [], [options]);
// Only used in multiple mode, this fn will not call in single mode
const getPathKeyEntities = useEntities(mergedOptions, mergedFieldNames);
/** Convert path key back to value format */
const getValueByKeyPath = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(pathKeys => {
const keyPathEntities = getPathKeyEntities();
return pathKeys.map(pathKey => {
const {
nodes
} = keyPathEntities[pathKey];
return nodes.map(node => node[mergedFieldNames.value]);
});
}, [getPathKeyEntities, mergedFieldNames]);
return [mergedOptions, getPathKeyEntities, getValueByKeyPath];
}
;// ./node_modules/@rc-component/cascader/es/hooks/useSearchConfig.js
// Convert `showSearch` to unique config
function useSearchConfig_useSearchConfig(showSearch, props) {
const {
autoClearSearchValue,
searchValue,
onSearch
} = props;
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!showSearch) {
return [false, {}];
}
let searchConfig = {
matchInputWidth: true,
limit: 50,
autoClearSearchValue,
searchValue,
onSearch
};
if (showSearch && typeof showSearch === 'object') {
searchConfig = {
...searchConfig,
...showSearch
};
}
if (searchConfig.limit <= 0) {
searchConfig.limit = false;
if (true) {
(0,warning["default"])(false, "'limit' of showSearch should be positive number or false.");
}
}
return [true, searchConfig];
}, [showSearch, autoClearSearchValue, searchValue, onSearch]);
}
;// ./node_modules/@rc-component/tree/es/utils/conductUtil.js
function removeFromCheckedKeys(halfCheckedKeys, checkedKeys) {
const filteredKeys = new Set();
halfCheckedKeys.forEach(key => {
if (!checkedKeys.has(key)) {
filteredKeys.add(key);
}
});
return filteredKeys;
}
function isCheckDisabled(node) {
const {
disabled,
disableCheckbox,
checkable
} = node || {};
return !!(disabled || disableCheckbox) || checkable === false;
}
// Fill miss keys
function fillConductCheck(keys, levelEntities, maxLevel, syntheticGetCheckDisabled) {
const checkedKeys = new Set(keys);
const halfCheckedKeys = new Set();
// Add checked keys top to bottom
for (let level = 0; level <= maxLevel; level += 1) {
const entities = levelEntities.get(level) || new Set();
entities.forEach(entity => {
const {
key,
node,
children = []
} = entity;
if (checkedKeys.has(key) && !syntheticGetCheckDisabled(node)) {
children.filter(childEntity => !syntheticGetCheckDisabled(childEntity.node)).forEach(childEntity => {
checkedKeys.add(childEntity.key);
});
}
});
}
// Add checked keys from bottom to top
const visitedKeys = new Set();
for (let level = maxLevel; level >= 0; level -= 1) {
const entities = levelEntities.get(level) || new Set();
entities.forEach(entity => {
const {
parent,
node
} = entity;
// Skip if no need to check
if (syntheticGetCheckDisabled(node) || !entity.parent || visitedKeys.has(entity.parent.key)) {
return;
}
// Skip if parent is disabled
if (syntheticGetCheckDisabled(entity.parent.node)) {
visitedKeys.add(parent.key);
return;
}
let allChecked = true;
let partialChecked = false;
(parent.children || []).filter(childEntity => !syntheticGetCheckDisabled(childEntity.node)).forEach(({
key
}) => {
const checked = checkedKeys.has(key);
if (allChecked && !checked) {
allChecked = false;
}
if (!partialChecked && (checked || halfCheckedKeys.has(key))) {
partialChecked = true;
}
});
if (allChecked) {
checkedKeys.add(parent.key);
}
if (partialChecked) {
halfCheckedKeys.add(parent.key);
}
visitedKeys.add(parent.key);
});
}
return {
checkedKeys: Array.from(checkedKeys),
halfCheckedKeys: Array.from(removeFromCheckedKeys(halfCheckedKeys, checkedKeys))
};
}
// Remove useless key
function cleanConductCheck(keys, halfKeys, levelEntities, maxLevel, syntheticGetCheckDisabled) {
const checkedKeys = new Set(keys);
let halfCheckedKeys = new Set(halfKeys);
// Remove checked keys from top to bottom
for (let level = 0; level <= maxLevel; level += 1) {
const entities = levelEntities.get(level) || new Set();
entities.forEach(entity => {
const {
key,
node,
children = []
} = entity;
if (!checkedKeys.has(key) && !halfCheckedKeys.has(key) && !syntheticGetCheckDisabled(node)) {
children.filter(childEntity => !syntheticGetCheckDisabled(childEntity.node)).forEach(childEntity => {
checkedKeys.delete(childEntity.key);
});
}
});
}
// Remove checked keys form bottom to top
halfCheckedKeys = new Set();
const visitedKeys = new Set();
for (let level = maxLevel; level >= 0; level -= 1) {
const entities = levelEntities.get(level) || new Set();
entities.forEach(entity => {
const {
parent,
node
} = entity;
// Skip if no need to check
if (syntheticGetCheckDisabled(node) || !entity.parent || visitedKeys.has(entity.parent.key)) {
return;
}
// Skip if parent is disabled
if (syntheticGetCheckDisabled(entity.parent.node)) {
visitedKeys.add(parent.key);
return;
}
let allChecked = true;
let partialChecked = false;
(parent.children || []).filter(childEntity => !syntheticGetCheckDisabled(childEntity.node)).forEach(({
key
}) => {
const checked = checkedKeys.has(key);
if (allChecked && !checked) {
allChecked = false;
}
if (!partialChecked && (checked || halfCheckedKeys.has(key))) {
partialChecked = true;
}
});
if (!allChecked) {
checkedKeys.delete(parent.key);
}
if (partialChecked) {
halfCheckedKeys.add(parent.key);
}
visitedKeys.add(parent.key);
});
}
return {
checkedKeys: Array.from(checkedKeys),
halfCheckedKeys: Array.from(removeFromCheckedKeys(halfCheckedKeys, checkedKeys))
};
}
/**
* Conduct with keys.
* @param keyList current key list
* @param keyEntities key - dataEntity map
* @param mode `fill` to fill missing key, `clean` to remove useless key
*/
function conductCheck(keyList, checked, keyEntities, getCheckDisabled) {
const warningMissKeys = [];
let syntheticGetCheckDisabled;
if (getCheckDisabled) {
syntheticGetCheckDisabled = getCheckDisabled;
} else {
syntheticGetCheckDisabled = isCheckDisabled;
}
// We only handle exist keys
const keys = new Set(keyList.filter(key => {
const hasEntity = !!getEntity(keyEntities, key);
if (!hasEntity) {
warningMissKeys.push(key);
}
return hasEntity;
}));
const levelEntities = new Map();
let maxLevel = 0;
// Convert entities by level for calculation
Object.keys(keyEntities).forEach(key => {
const entity = keyEntities[key];
const {
level
} = entity;
let levelSet = levelEntities.get(level);
if (!levelSet) {
levelSet = new Set();
levelEntities.set(level, levelSet);
}
levelSet.add(entity);
maxLevel = Math.max(maxLevel, level);
});
(0,warning["default"])(!warningMissKeys.length, `Tree missing follow keys: ${warningMissKeys.slice(0, 100).map(key => `'${key}'`).join(', ')}`);
let result;
if (checked === true) {
result = fillConductCheck(keys, levelEntities, maxLevel, syntheticGetCheckDisabled);
} else {
result = cleanConductCheck(keys, checked.halfCheckedKeys, levelEntities, maxLevel, syntheticGetCheckDisabled);
}
return result;
}
;// ./node_modules/@rc-component/cascader/es/hooks/useSelect.js
function useSelect(multiple, triggerChange, checkedValues, halfCheckedValues, missingCheckedValues, getPathKeyEntities, getValueByKeyPath, showCheckedStrategy) {
return valuePath => {
if (!multiple) {
triggerChange(valuePath);
} else {
// Prepare conduct required info
const pathKey = toPathKey(valuePath);
const checkedPathKeys = toPathKeys(checkedValues);
const halfCheckedPathKeys = toPathKeys(halfCheckedValues);
const existInChecked = checkedPathKeys.includes(pathKey);
const existInMissing = missingCheckedValues.some(valueCells => toPathKey(valueCells) === pathKey);
// Do update
let nextCheckedValues = checkedValues;
let nextMissingValues = missingCheckedValues;
if (existInMissing && !existInChecked) {
// Missing value only do filter
nextMissingValues = missingCheckedValues.filter(valueCells => toPathKey(valueCells) !== pathKey);
} else {
// Update checked key first
const nextRawCheckedKeys = existInChecked ? checkedPathKeys.filter(key => key !== pathKey) : [...checkedPathKeys, pathKey];
const pathKeyEntities = getPathKeyEntities();
// Conduction by selected or not
let checkedKeys;
if (existInChecked) {
({
checkedKeys
} = conductCheck(nextRawCheckedKeys, {
checked: false,
halfCheckedKeys: halfCheckedPathKeys
}, pathKeyEntities));
} else {
({
checkedKeys
} = conductCheck(nextRawCheckedKeys, true, pathKeyEntities));
}
// Roll up to parent level keys
const deDuplicatedKeys = formatStrategyValues(checkedKeys, getPathKeyEntities, showCheckedStrategy);
nextCheckedValues = getValueByKeyPath(deDuplicatedKeys);
}
triggerChange([...nextMissingValues, ...nextCheckedValues]);
}
};
}
;// ./node_modules/@rc-component/cascader/es/hooks/useValues.js
function useValues(multiple, rawValues, getPathKeyEntities, getValueByKeyPath, getMissingValues) {
// Fill `rawValues` with checked conduction values
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const [existValues, missingValues] = getMissingValues(rawValues);
if (!multiple || !rawValues.length) {
return [existValues, [], missingValues];
}
const keyPathValues = toPathKeys(existValues);
const keyPathEntities = getPathKeyEntities();
const {
checkedKeys,
halfCheckedKeys
} = conductCheck(keyPathValues, true, keyPathEntities);
// Convert key back to value cells
return [getValueByKeyPath(checkedKeys), getValueByKeyPath(halfCheckedKeys), missingValues];
}, [multiple, rawValues, getPathKeyEntities, getValueByKeyPath, getMissingValues]);
}
;// ./node_modules/@rc-component/cascader/es/OptionList/Checkbox.js
function Checkbox_Checkbox({
prefixCls,
checked,
halfChecked,
disabled,
onClick,
disableCheckbox
}) {
const {
checkable
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(cascader_es_context);
const customCheckbox = typeof checkable !== 'boolean' ? checkable : null;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}`, {
[`${prefixCls}-checked`]: checked,
[`${prefixCls}-indeterminate`]: !checked && halfChecked,
[`${prefixCls}-disabled`]: disabled || disableCheckbox
}),
onClick: onClick
}, customCheckbox);
}
;// ./node_modules/@rc-component/cascader/es/OptionList/Column.js
function Column_extends() { Column_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Column_extends.apply(this, arguments); }
const FIX_LABEL = '__cascader_fix_label__';
function Column({
prefixCls,
multiple,
options,
activeValue,
prevValuePath,
onToggleOpen,
onSelect,
onActive,
checkedSet,
halfCheckedSet,
loadingKeys,
isSelectable,
disabled: propsDisabled
}) {
const menuPrefixCls = `${prefixCls}-menu`;
const menuItemPrefixCls = `${prefixCls}-menu-item`;
const menuRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const {
fieldNames,
changeOnSelect,
expandTrigger,
expandIcon,
loadingIcon,
popupMenuColumnStyle,
optionRender,
classNames,
styles
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(cascader_es_context);
const hoverOpen = expandTrigger === 'hover';
const isOptionDisabled = disabled => propsDisabled || disabled;
// ============================ Option ============================
const optionInfoList = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => options.map(option => {
const {
disabled,
disableCheckbox
} = option;
const searchOptions = option[SEARCH_MARK];
const label = option[FIX_LABEL] ?? option[fieldNames.label];
const value = option[fieldNames.value];
const isMergedLeaf = isLeaf(option, fieldNames);
// Get real value of option. Search option is different way.
const fullPath = searchOptions ? searchOptions.map(opt => opt[fieldNames.value]) : [...prevValuePath, value];
const fullPathKey = toPathKey(fullPath);
const isLoading = loadingKeys.includes(fullPathKey);
// >>>>> checked
const checked = checkedSet.has(fullPathKey);
// >>>>> halfChecked
const halfChecked = halfCheckedSet.has(fullPathKey);
return {
disabled,
label,
value,
isLeaf: isMergedLeaf,
isLoading,
checked,
halfChecked,
option,
disableCheckbox,
fullPath,
fullPathKey
};
}), [options, checkedSet, fieldNames, halfCheckedSet, loadingKeys, prevValuePath]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (menuRef.current) {
const selector = `.${menuItemPrefixCls}-active`;
const activeElement = menuRef.current.querySelector(selector);
if (activeElement) {
scrollIntoParentView(activeElement);
}
}
}, [activeValue, menuItemPrefixCls]);
// ============================ Render ============================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("ul", {
className: (0,clsx.clsx)(menuPrefixCls, classNames?.popup?.list),
style: styles?.popup?.list,
ref: menuRef,
role: "menu"
}, optionInfoList.map(({
disabled,
label,
value,
isLeaf: isMergedLeaf,
isLoading,
checked,
halfChecked,
option,
fullPath,
fullPathKey,
disableCheckbox
}) => {
const ariaProps = (0,pickAttrs["default"])(option, {
aria: true,
data: true
});
// >>>>> Open
const triggerOpenPath = () => {
if (isOptionDisabled(disabled)) {
return;
}
const nextValueCells = [...fullPath];
if (hoverOpen && isMergedLeaf) {
nextValueCells.pop();
}
onActive(nextValueCells);
};
// >>>>> Selection
const triggerSelect = () => {
if (isSelectable(option) && !isOptionDisabled(disabled)) {
onSelect(fullPath, isMergedLeaf);
}
};
// >>>>> Title
let title;
if (typeof option.title === 'string') {
title = option.title;
} else if (typeof label === 'string') {
title = label;
}
// >>>>> Render
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("li", Column_extends({
key: fullPathKey
}, ariaProps, {
className: (0,clsx.clsx)(menuItemPrefixCls, classNames?.popup?.listItem, {
[`${menuItemPrefixCls}-expand`]: !isMergedLeaf,
[`${menuItemPrefixCls}-active`]: activeValue === value || activeValue === fullPathKey,
[`${menuItemPrefixCls}-disabled`]: isOptionDisabled(disabled),
[`${menuItemPrefixCls}-loading`]: isLoading
}),
style: {
...popupMenuColumnStyle,
...styles?.popup?.listItem
},
role: "menuitemcheckbox",
title: title,
"aria-checked": checked,
"data-path-key": fullPathKey,
onClick: () => {
triggerOpenPath();
if (disableCheckbox) {
return;
}
if (!multiple || isMergedLeaf) {
triggerSelect();
}
},
onDoubleClick: () => {
if (changeOnSelect) {
onToggleOpen(false);
}
},
onMouseEnter: () => {
if (hoverOpen) {
triggerOpenPath();
}
},
onMouseDown: e => {
// Prevent selector from blurring
e.preventDefault();
}
}), multiple && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Checkbox_Checkbox, {
prefixCls: `${prefixCls}-checkbox`,
checked: checked,
halfChecked: halfChecked,
disabled: isOptionDisabled(disabled) || disableCheckbox,
disableCheckbox: disableCheckbox,
onClick: e => {
if (disableCheckbox) {
return;
}
e.stopPropagation();
triggerSelect();
}
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${menuItemPrefixCls}-content`
}, optionRender && value !== '__EMPTY__' ? optionRender(option) : label), !isLoading && expandIcon && !isMergedLeaf && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${menuItemPrefixCls}-expand-icon`
}, expandIcon), isLoading && loadingIcon && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${menuItemPrefixCls}-loading-icon`
}, loadingIcon));
}));
}
;// ./node_modules/@rc-component/cascader/es/OptionList/useActive.js
/**
* Control the active open options path.
*/
const useActive_useActive = (multiple, open) => {
const {
values
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(cascader_es_context);
const firstValueCells = values[0];
// Record current dropdown active options
// This also control the open status
const [activeValueCells, setActiveValueCells] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (!multiple) {
setActiveValueCells(firstValueCells || []);
}
}, /* eslint-disable react-hooks/exhaustive-deps */
[open, firstValueCells]
/* eslint-enable react-hooks/exhaustive-deps */);
return [activeValueCells, setActiveValueCells];
};
/* harmony default export */ var OptionList_useActive = (useActive_useActive);
;// ./node_modules/@rc-component/cascader/es/OptionList/useKeyboard.js
/* harmony default export */ var useKeyboard = ((ref, options, fieldNames, activeValueCells, setActiveValueCells, onKeyBoardSelect, contextProps) => {
const {
direction,
searchValue,
toggleOpen,
open
} = contextProps;
const rtl = direction === 'rtl';
const [validActiveValueCells, lastActiveIndex, lastActiveOptions, fullPathKeys] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
let activeIndex = -1;
let currentOptions = options;
const mergedActiveIndexes = [];
const mergedActiveValueCells = [];
const len = activeValueCells.length;
const pathKeys = getFullPathKeys(options, fieldNames);
// Fill validate active value cells and index
for (let i = 0; i < len && currentOptions; i += 1) {
// Mark the active index for current options
const nextActiveIndex = currentOptions.findIndex((option, index) => (pathKeys[index] ? toPathKey(pathKeys[index]) : option[fieldNames.value]) === activeValueCells[i]);
if (nextActiveIndex === -1) {
break;
}
activeIndex = nextActiveIndex;
mergedActiveIndexes.push(activeIndex);
mergedActiveValueCells.push(activeValueCells[i]);
currentOptions = currentOptions[activeIndex][fieldNames.children];
}
// Fill last active options
let activeOptions = options;
for (let i = 0; i < mergedActiveIndexes.length - 1; i += 1) {
activeOptions = activeOptions[mergedActiveIndexes[i]][fieldNames.children];
}
return [mergedActiveValueCells, activeIndex, activeOptions, pathKeys];
}, [activeValueCells, fieldNames, options]);
// Update active value cells and scroll to target element
const internalSetActiveValueCells = next => {
setActiveValueCells(next);
};
// Same options offset
const offsetActiveOption = offset => {
const len = lastActiveOptions.length;
let currentIndex = lastActiveIndex;
if (currentIndex === -1 && offset < 0) {
currentIndex = len;
}
for (let i = 0; i < len; i += 1) {
currentIndex = (currentIndex + offset + len) % len;
const option = lastActiveOptions[currentIndex];
if (option && !option.disabled) {
const nextActiveCells = validActiveValueCells.slice(0, -1).concat(fullPathKeys[currentIndex] ? toPathKey(fullPathKeys[currentIndex]) : option[fieldNames.value]);
internalSetActiveValueCells(nextActiveCells);
return;
}
}
};
// Different options offset
const prevColumn = () => {
if (validActiveValueCells.length > 1) {
const nextActiveCells = validActiveValueCells.slice(0, -1);
internalSetActiveValueCells(nextActiveCells);
} else {
toggleOpen(false);
}
};
const nextColumn = () => {
const nextOptions = lastActiveOptions[lastActiveIndex]?.[fieldNames.children] || [];
const nextOption = nextOptions.find(option => !option.disabled);
if (nextOption) {
const nextActiveCells = [...validActiveValueCells, nextOption[fieldNames.value]];
internalSetActiveValueCells(nextActiveCells);
}
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
// scrollTo: treeRef.current?.scrollTo,
onKeyDown: event => {
const {
which
} = event;
switch (which) {
// >>> Arrow keys
case KeyCode["default"].UP:
case KeyCode["default"].DOWN:
{
let offset = 0;
if (which === KeyCode["default"].UP) {
offset = -1;
} else if (which === KeyCode["default"].DOWN) {
offset = 1;
}
if (offset !== 0) {
offsetActiveOption(offset);
}
break;
}
case KeyCode["default"].LEFT:
{
if (searchValue) {
break;
}
if (rtl) {
nextColumn();
} else {
prevColumn();
}
break;
}
case KeyCode["default"].RIGHT:
{
if (searchValue) {
break;
}
if (rtl) {
prevColumn();
} else {
nextColumn();
}
break;
}
case KeyCode["default"].BACKSPACE:
{
if (!searchValue) {
prevColumn();
}
break;
}
// >>> Select
case KeyCode["default"].ENTER:
{
if (validActiveValueCells.length) {
const option = lastActiveOptions[lastActiveIndex];
// Search option should revert back of origin options
const originOptions = option?.[SEARCH_MARK] || [];
if (originOptions.length) {
onKeyBoardSelect(originOptions.map(opt => opt[fieldNames.value]), originOptions[originOptions.length - 1]);
} else {
onKeyBoardSelect(validActiveValueCells, lastActiveOptions[lastActiveIndex]);
}
}
break;
}
// >>> Close
case KeyCode["default"].ESC:
{
toggleOpen(false);
if (open) {
event.stopPropagation();
}
}
}
},
onKeyUp: () => {}
}));
});
(Object.getOwnPropertyDescriptor(useKeyboard, "name") || {}).writable || Object.defineProperty(useKeyboard, "name", { value: "default", configurable: true });
;// ./node_modules/@rc-component/cascader/es/OptionList/List.js
function List_extends() { List_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return List_extends.apply(this, arguments); }
/* eslint-disable default-case */
const RawOptionList = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls,
multiple,
searchValue,
toggleOpen,
notFoundContent,
direction,
open,
disabled,
lockOptions = false
} = props;
const containerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const rtl = direction === 'rtl';
const {
options,
values,
halfValues,
fieldNames,
changeOnSelect,
onSelect,
searchOptions,
popupPrefixCls,
loadData,
expandTrigger
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(cascader_es_context);
const mergedPrefixCls = popupPrefixCls || prefixCls;
// ========================= loadData =========================
const [loadingKeys, setLoadingKeys] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([]);
const internalLoadData = valueCells => {
// Do not load when search
if (!loadData || searchValue) {
return;
}
const optionList = toPathOptions(valueCells, options, fieldNames);
const rawOptions = optionList.map(({
option
}) => option);
const lastOption = rawOptions[rawOptions.length - 1];
if (lastOption && !isLeaf(lastOption, fieldNames)) {
const pathKey = toPathKey(valueCells);
setLoadingKeys(keys => [...keys, pathKey]);
loadData(rawOptions);
}
};
// zombieJ: This is bad. We should make this same as `rc-tree` to use Promise instead.
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (loadingKeys.length) {
loadingKeys.forEach(loadingKey => {
const valueStrCells = toPathValueStr(loadingKey);
const optionList = toPathOptions(valueStrCells, options, fieldNames, true).map(({
option
}) => option);
const lastOption = optionList[optionList.length - 1];
if (!lastOption || lastOption[fieldNames.children] || isLeaf(lastOption, fieldNames)) {
setLoadingKeys(keys => keys.filter(key => key !== loadingKey));
}
});
}
}, [options, loadingKeys, fieldNames]);
// ========================== Values ==========================
const checkedSet = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => new Set(toPathKeys(values)), [values]);
const halfCheckedSet = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => new Set(toPathKeys(halfValues)), [halfValues]);
// ====================== Accessibility =======================
const [activeValueCells, setActiveValueCells] = OptionList_useActive(multiple, open);
// =========================== Path ===========================
const onPathOpen = nextValueCells => {
setActiveValueCells(nextValueCells);
// Trigger loadData
internalLoadData(nextValueCells);
};
const isSelectable = option => {
if (disabled) {
return false;
}
const {
disabled: optionDisabled
} = option;
const isMergedLeaf = isLeaf(option, fieldNames);
return !optionDisabled && (isMergedLeaf || changeOnSelect || multiple);
};
const onPathSelect = (valuePath, leaf, fromKeyboard = false) => {
onSelect(valuePath);
if (!multiple && (leaf || changeOnSelect && (expandTrigger === 'hover' || fromKeyboard))) {
toggleOpen(false);
}
};
// ========================== Option ==========================
const filteredOptions = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (searchValue) {
return searchOptions;
}
return options;
}, [searchValue, searchOptions, options]);
// Update only when open or lockOptions
const mergedOptions = (0,useMemo["default"])(() => filteredOptions, [open, lockOptions], (prev, next) => !!next[0] && !next[1]);
// ========================== Column ==========================
const optionColumns = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const optionList = [{
options: mergedOptions
}];
let currentList = mergedOptions;
const fullPathKeys = getFullPathKeys(currentList, fieldNames);
for (let i = 0; i < activeValueCells.length; i += 1) {
const activeValueCell = activeValueCells[i];
const currentOption = currentList.find((option, index) => (fullPathKeys[index] ? toPathKey(fullPathKeys[index]) : option[fieldNames.value]) === activeValueCell);
const subOptions = currentOption?.[fieldNames.children];
if (!subOptions?.length) {
break;
}
currentList = subOptions;
optionList.push({
options: subOptions
});
}
return optionList;
}, [mergedOptions, activeValueCells, fieldNames]);
// ========================= Keyboard =========================
const onKeyboardSelect = (selectValueCells, option) => {
if (isSelectable(option)) {
onPathSelect(selectValueCells, isLeaf(option, fieldNames), true);
}
};
useKeyboard(ref, mergedOptions, fieldNames, activeValueCells, onPathOpen, onKeyboardSelect, {
direction,
searchValue,
toggleOpen,
open
});
// >>>>> Active Scroll
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (searchValue) {
return;
}
for (let i = 0; i < activeValueCells.length; i += 1) {
const cellPath = activeValueCells.slice(0, i + 1);
const cellKeyPath = toPathKey(cellPath);
const ele = containerRef.current?.querySelector(`li[data-path-key="${cellKeyPath.replace(/\\{0,2}"/g, '\\"')}"]` // matches unescaped double quotes
);
if (ele) {
scrollIntoParentView(ele);
}
}
}, [activeValueCells, searchValue]);
// ========================== Render ==========================
// >>>>> Empty
const isEmpty = !optionColumns[0]?.options?.length;
const emptyList = [{
[fieldNames.value]: '__EMPTY__',
[FIX_LABEL]: notFoundContent,
disabled: true
}];
const columnProps = {
...props,
multiple: !isEmpty && multiple,
onSelect: onPathSelect,
onActive: onPathOpen,
onToggleOpen: toggleOpen,
checkedSet,
halfCheckedSet,
loadingKeys,
isSelectable
};
// >>>>> Columns
const mergedOptionColumns = isEmpty ? [{
options: emptyList
}] : optionColumns;
const columnNodes = mergedOptionColumns.map((col, index) => {
const prevValuePath = activeValueCells.slice(0, index);
const activeValue = activeValueCells[index];
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Column, List_extends({
key: index
}, columnProps, {
prefixCls: mergedPrefixCls,
options: col.options,
prevValuePath: prevValuePath,
activeValue: activeValue
}));
});
// >>>>> Render
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${mergedPrefixCls}-menus`, {
[`${mergedPrefixCls}-menu-empty`]: isEmpty,
[`${mergedPrefixCls}-rtl`]: rtl
}),
ref: containerRef
}, columnNodes);
});
if (true) {
RawOptionList.displayName = 'RawOptionList';
}
/* harmony default export */ var OptionList_List = (RawOptionList);
;// ./node_modules/@rc-component/cascader/es/OptionList/index.js
function es_OptionList_extends() { es_OptionList_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return es_OptionList_extends.apply(this, arguments); }
const OptionList_RefOptionList = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
lockOptions,
...baseProps
} = useBaseProps();
// >>>>> Render
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(OptionList_List, es_OptionList_extends({}, props, baseProps, {
lockOptions: lockOptions,
ref: ref
}));
});
/* harmony default export */ var cascader_es_OptionList = (OptionList_RefOptionList);
;// ./node_modules/@rc-component/cascader/es/Panel.js
function noop() {}
function Panel_Panel(props) {
const {
prefixCls = 'rc-cascader',
style,
className,
options,
checkable,
defaultValue,
value,
fieldNames,
changeOnSelect,
onChange,
showCheckedStrategy,
loadData,
expandTrigger,
expandIcon = '>',
loadingIcon,
direction,
notFoundContent = 'Not Found',
disabled,
optionRender
} = props;
// ======================== Multiple ========================
const multiple = !!checkable;
// ========================= Values =========================
const [interanlRawValues, setRawValues] = (0,es.useControlledState)(defaultValue, value);
const rawValues = toRawValues(interanlRawValues);
// ========================= FieldNames =========================
const mergedFieldNames = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => commonUtil_fillFieldNames(fieldNames), /* eslint-disable react-hooks/exhaustive-deps */
[JSON.stringify(fieldNames)]
/* eslint-enable react-hooks/exhaustive-deps */);
// =========================== Option ===========================
const [mergedOptions, getPathKeyEntities, getValueByKeyPath] = useOptions_useOptions(mergedFieldNames, options);
// ========================= Values =========================
const getMissingValues = useMissingValues(mergedOptions, mergedFieldNames);
// Fill `rawValues` with checked conduction values
const [checkedValues, halfCheckedValues, missingCheckedValues] = useValues(multiple, rawValues, getPathKeyEntities, getValueByKeyPath, getMissingValues);
// =========================== Change ===========================
const triggerChange = (0,es.useEvent)(nextValues => {
setRawValues(nextValues);
// Save perf if no need trigger event
if (onChange) {
const nextRawValues = toRawValues(nextValues);
const valueOptions = nextRawValues.map(valueCells => toPathOptions(valueCells, mergedOptions, mergedFieldNames).map(valueOpt => valueOpt.option));
const triggerValues = multiple ? nextRawValues : nextRawValues[0];
const triggerOptions = multiple ? valueOptions : valueOptions[0];
onChange(triggerValues, triggerOptions);
}
});
// =========================== Select ===========================
const handleSelection = useSelect(multiple, triggerChange, checkedValues, halfCheckedValues, missingCheckedValues, getPathKeyEntities, getValueByKeyPath, showCheckedStrategy);
const onInternalSelect = (0,es.useEvent)(valuePath => {
handleSelection(valuePath);
});
// ======================== Context =========================
const cascaderContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
options: mergedOptions,
fieldNames: mergedFieldNames,
values: checkedValues,
halfValues: halfCheckedValues,
changeOnSelect,
onSelect: onInternalSelect,
checkable,
searchOptions: [],
popupPrefixCls: undefined,
loadData,
expandTrigger,
expandIcon,
loadingIcon,
popupMenuColumnStyle: undefined,
optionRender
}), [mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, loadData, expandTrigger, expandIcon, loadingIcon, optionRender]);
// ========================= Render =========================
const panelPrefixCls = `${prefixCls}-panel`;
const isEmpty = !mergedOptions.length;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(cascader_es_context.Provider, {
value: cascaderContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(panelPrefixCls, {
[`${panelPrefixCls}-rtl`]: direction === 'rtl',
[`${panelPrefixCls}-empty`]: isEmpty
}, className),
style: style
}, isEmpty ? notFoundContent : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(OptionList_List, {
prefixCls: prefixCls,
searchValue: "",
multiple: multiple,
toggleOpen: noop,
open: true,
direction: direction,
disabled: disabled
})));
}
;// ./node_modules/@rc-component/cascader/es/utils/warningPropsUtil.js
// value in Cascader options should not be null
function warningPropsUtil_warningNullOptions(options, fieldNames) {
if (options) {
const recursiveOptions = optionsList => {
for (let i = 0; i < optionsList.length; i++) {
const option = optionsList[i];
if (option[fieldNames?.value] === null) {
(0,warning["default"])(false, '`value` in Cascader options should not be `null`.');
return true;
}
if (Array.isArray(option[fieldNames?.children]) && recursiveOptions(option[fieldNames?.children])) {
return true;
}
}
};
recursiveOptions(options);
}
}
;// ./node_modules/@rc-component/cascader/es/Cascader.js
function Cascader_extends() { Cascader_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Cascader_extends.apply(this, arguments); }
const Cascader = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
// MISC
id,
prefixCls = 'rc-cascader',
fieldNames,
// Value
defaultValue,
value,
changeOnSelect,
onChange,
displayRender,
checkable,
// Search
showSearch,
// Trigger
expandTrigger,
// Options
options,
popupPrefixCls,
loadData,
open,
popupClassName,
popupMenuColumnStyle,
popupStyle: customPopupStyle,
classNames,
styles,
placement,
onPopupVisibleChange,
// Icon
expandIcon = '>',
loadingIcon,
// Children
children,
popupMatchSelectWidth = false,
showCheckedStrategy = SHOW_PARENT,
optionRender,
...restProps
} = props;
const mergedId = useId(id);
const multiple = !!checkable;
// =========================== Values ===========================
const [interanlRawValues, setRawValues] = (0,useControlledState["default"])(defaultValue, value);
const rawValues = toRawValues(interanlRawValues);
// ========================= FieldNames =========================
const mergedFieldNames = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => commonUtil_fillFieldNames(fieldNames), /* eslint-disable react-hooks/exhaustive-deps */
[JSON.stringify(fieldNames)]
/* eslint-enable react-hooks/exhaustive-deps */);
// =========================== Option ===========================
const [mergedOptions, getPathKeyEntities, getValueByKeyPath] = useOptions_useOptions(mergedFieldNames, options);
// =========================== Search ===========================
const [mergedShowSearch, searchConfig] = useSearchConfig_useSearchConfig(showSearch, props);
const {
autoClearSearchValue = true,
searchValue,
onSearch
} = searchConfig;
const [internalSearchValue, setSearchValue] = (0,useControlledState["default"])('', searchValue);
const mergedSearchValue = internalSearchValue || '';
const onInternalSearch = (searchText, info) => {
setSearchValue(searchText);
if (info.source !== 'blur' && onSearch) {
onSearch(searchText);
}
};
const searchOptions = hooks_useSearchOptions(mergedSearchValue, mergedOptions, mergedFieldNames, popupPrefixCls || prefixCls, searchConfig, changeOnSelect || multiple);
// =========================== Values ===========================
const getMissingValues = useMissingValues(mergedOptions, mergedFieldNames);
// Fill `rawValues` with checked conduction values
const [checkedValues, halfCheckedValues, missingCheckedValues] = useValues(multiple, rawValues, getPathKeyEntities, getValueByKeyPath, getMissingValues);
const deDuplicatedValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const checkedKeys = toPathKeys(checkedValues);
const deduplicateKeys = formatStrategyValues(checkedKeys, getPathKeyEntities, showCheckedStrategy);
return [...missingCheckedValues, ...getValueByKeyPath(deduplicateKeys)];
}, [checkedValues, getPathKeyEntities, getValueByKeyPath, missingCheckedValues, showCheckedStrategy]);
const displayValues = useDisplayValues(deDuplicatedValues, mergedOptions, mergedFieldNames, multiple, displayRender);
// =========================== Change ===========================
const triggerChange = (0,useEvent["default"])(nextValues => {
setRawValues(nextValues);
// Save perf if no need trigger event
if (onChange) {
const nextRawValues = toRawValues(nextValues);
const valueOptions = nextRawValues.map(valueCells => toPathOptions(valueCells, mergedOptions, mergedFieldNames).map(valueOpt => valueOpt.option));
const triggerValues = multiple ? nextRawValues : nextRawValues[0];
const triggerOptions = multiple ? valueOptions : valueOptions[0];
onChange(triggerValues, triggerOptions);
}
});
// =========================== Select ===========================
const handleSelection = useSelect(multiple, triggerChange, checkedValues, halfCheckedValues, missingCheckedValues, getPathKeyEntities, getValueByKeyPath, showCheckedStrategy);
const onInternalSelect = (0,useEvent["default"])(valuePath => {
if (!multiple || autoClearSearchValue) {
setSearchValue('');
}
handleSelection(valuePath);
});
// Display Value change logic
const onDisplayValuesChange = (_, info) => {
if (info.type === 'clear') {
triggerChange([]);
return;
}
// Cascader do not support `add` type. Only support `remove`
const {
valueCells
} = info.values[0];
onInternalSelect(valueCells);
};
const onInternalPopupVisibleChange = nextVisible => {
onPopupVisibleChange?.(nextVisible);
};
// ========================== Warning ===========================
if (true) {
warningPropsUtil_warningNullOptions(mergedOptions, mergedFieldNames);
}
// ========================== Context ===========================
const cascaderContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
classNames,
styles,
options: mergedOptions,
fieldNames: mergedFieldNames,
values: checkedValues,
halfValues: halfCheckedValues,
changeOnSelect,
onSelect: onInternalSelect,
checkable,
searchOptions,
popupPrefixCls,
loadData,
expandTrigger,
expandIcon,
loadingIcon,
popupMenuColumnStyle,
optionRender
}), [classNames, styles, mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, searchOptions, popupPrefixCls, loadData, expandTrigger, expandIcon, loadingIcon, popupMenuColumnStyle, optionRender]);
// ==============================================================
// == Render ==
// ==============================================================
const emptyOptions = !(mergedSearchValue ? searchOptions : mergedOptions).length;
const popupStyle =
// Search to match width
mergedSearchValue && searchConfig.matchInputWidth ||
// Empty keep the width
emptyOptions ? {} : {
minWidth: 'auto'
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(cascader_es_context.Provider, {
value: cascaderContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_BaseSelect, Cascader_extends({}, restProps, {
// MISC
ref: ref,
id: mergedId,
prefixCls: prefixCls,
autoClearSearchValue: autoClearSearchValue,
popupMatchSelectWidth: popupMatchSelectWidth,
classNames: classNames,
styles: styles,
popupStyle: {
...popupStyle,
...customPopupStyle
}
// Value
,
displayValues: displayValues,
onDisplayValuesChange: onDisplayValuesChange,
mode: multiple ? 'multiple' : undefined
// Search
,
searchValue: mergedSearchValue,
onSearch: onInternalSearch,
showSearch: mergedShowSearch
// Options
,
OptionList: cascader_es_OptionList,
emptyOptions: emptyOptions
// Open
,
open: open,
popupClassName: popupClassName,
placement: placement,
onPopupVisibleChange: onInternalPopupVisibleChange
// Children
,
getRawInputElement: () => children
})));
});
if (true) {
Cascader.displayName = 'Cascader';
}
Cascader.SHOW_PARENT = SHOW_PARENT;
Cascader.SHOW_CHILD = SHOW_CHILD;
Cascader.Panel = Panel_Panel;
/* harmony default export */ var es_Cascader = (Cascader);
;// ./node_modules/@rc-component/cascader/es/index.js
/* harmony default export */ var cascader_es = (es_Cascader);
;// ./components/cascader/hooks/useBase.ts
function useBase(customizePrefixCls, direction) {
const {
getPrefixCls,
direction: rootDirection,
renderEmpty
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const mergedDirection = direction || rootDirection;
const prefixCls = getPrefixCls('select', customizePrefixCls);
const cascaderPrefixCls = getPrefixCls('cascader', customizePrefixCls);
return [prefixCls, cascaderPrefixCls, mergedDirection, renderEmpty];
}
/* harmony default export */ var hooks_useBase = (useBase);
;// ./components/cascader/hooks/useCheckable.tsx
function useCheckable(cascaderPrefixCls, multiple) {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => multiple ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${cascaderPrefixCls}-checkbox-inner`
}) : false, [cascaderPrefixCls, multiple]);
}
;// ./components/cascader/hooks/useIcons.tsx
const defaultLoadingIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LoadingOutlined, {
spin: true
});
const defaultExpandIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RightOutlined["default"], null);
const defaultRtlExpandIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LeftOutlined, null);
function useIcons_useIcons({
contextExpandIcon,
contextLoadingIcon,
expandIcon,
loadingIcon,
isRtl
}) {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
expandIcon: expandIcon ?? contextExpandIcon ?? (isRtl ? defaultRtlExpandIcon : defaultExpandIcon),
loadingIcon: loadingIcon ?? contextLoadingIcon ?? defaultLoadingIcon
}), [contextExpandIcon, contextLoadingIcon, expandIcon, isRtl, loadingIcon]);
}
// EXTERNAL MODULE: ./components/cascader/style/index.ts
var cascader_style = __webpack_require__("./components/cascader/style/index.ts");
// EXTERNAL MODULE: ./components/cascader/style/columns.ts
var columns = __webpack_require__("./components/cascader/style/columns.ts");
;// ./components/cascader/style/panel.ts
// ============================== Panel ===============================
const genPanelStyle = token => {
const {
componentCls
} = token;
return {
[`${componentCls}-panel`]: [(0,columns["default"])(token), {
display: 'inline-flex',
border: `${(0,cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
borderRadius: token.borderRadiusLG,
overflowX: 'auto',
maxWidth: '100%',
[`${componentCls}-menus`]: {
alignItems: 'stretch'
},
[`${componentCls}-menu`]: {
height: 'auto'
},
'&-empty': {
padding: token.paddingXXS
}
}]
};
};
// ============================== Export ==============================
/* harmony default export */ var panel = ((0,genStyleUtils.genComponentStyleHook)(['Cascader', 'Panel'], genPanelStyle, cascader_style.prepareComponentToken, {
resetFont: false
}));
;// ./components/cascader/Panel.tsx
function CascaderPanel(props) {
const {
prefixCls: customizePrefixCls,
className,
multiple,
rootClassName,
notFoundContent,
direction,
expandIcon,
loadingIcon,
disabled: customDisabled
} = props;
const {
expandIcon: contextExpandIcon,
loadingIcon: contextLoadingIcon
} = (0,config_provider_context.useComponentConfig)('cascader');
const disabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
const mergedDisabled = customDisabled ?? disabled;
const [_, cascaderPrefixCls, mergedDirection, renderEmpty] = hooks_useBase(customizePrefixCls, direction);
const rootCls = hooks_useCSSVarCls(cascaderPrefixCls);
const [hashId, cssVarCls] = (0,cascader_style["default"])(cascaderPrefixCls, rootCls);
panel(cascaderPrefixCls);
const isRtl = mergedDirection === 'rtl';
// ===================== Icon ======================
const {
expandIcon: mergedExpandIcon,
loadingIcon: mergedLoadingIcon
} = useIcons_useIcons({
contextExpandIcon,
contextLoadingIcon,
expandIcon,
loadingIcon,
isRtl
});
// ===================== Empty =====================
const mergedNotFoundContent = notFoundContent || renderEmpty?.('Cascader') || (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(defaultRenderEmpty, {
componentName: "Cascader"
}));
// =================== Multiple ====================
const checkable = useCheckable(cascaderPrefixCls, multiple);
// ==================== Render =====================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Panel_Panel, {
...props,
checkable: checkable,
prefixCls: cascaderPrefixCls,
className: (0,clsx.clsx)(className, hashId, rootClassName, cssVarCls, rootCls),
notFoundContent: mergedNotFoundContent,
direction: mergedDirection,
expandIcon: mergedExpandIcon,
loadingIcon: mergedLoadingIcon,
disabled: mergedDisabled
});
}
/* harmony default export */ var cascader_Panel = (CascaderPanel);
;// ./components/cascader/index.tsx
const {
SHOW_CHILD: cascader_SHOW_CHILD,
SHOW_PARENT: cascader_SHOW_PARENT
} = cascader_es;
const highlightKeyword = (str, lowerKeyword, prefixCls) => {
const cells = str.toLowerCase().split(lowerKeyword).reduce((list, cur, index) => index === 0 ? [cur] : [].concat((0,toConsumableArray["default"])(list), [lowerKeyword, cur]), []);
const fillCells = [];
let start = 0;
cells.forEach((cell, index) => {
const end = start + cell.length;
let originWorld = str.slice(start, end);
start = end;
if (index % 2 === 1) {
originWorld = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-menu-item-keyword`,
key: `separator-${index}`
}, originWorld);
}
fillCells.push(originWorld);
});
return fillCells;
};
const defaultSearchRender = (inputValue, path, prefixCls, fieldNames) => {
const optionList = [];
// We do lower here to save perf
const lower = inputValue.toLowerCase();
path.forEach((node, index) => {
if (index !== 0) {
optionList.push(' / ');
}
let label = node[fieldNames.label];
const type = typeof label;
if (type === 'string' || type === 'number') {
label = highlightKeyword(String(label), lower, prefixCls);
}
optionList.push(label);
});
return optionList;
};
const cascader_Cascader = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
size: customizeSize,
disabled: customDisabled,
className,
rootClassName,
multiple,
bordered = true,
transitionName,
choiceTransitionName = '',
popupClassName,
expandIcon,
placement,
showSearch,
allowClear = true,
notFoundContent,
direction,
getPopupContainer,
status: customStatus,
showArrow,
builtinPlacements,
style,
variant: customVariant,
dropdownClassName,
dropdownRender,
onDropdownVisibleChange,
onPopupVisibleChange,
dropdownMenuColumnStyle,
popupRender,
dropdownStyle,
popupMenuColumnStyle,
onOpenChange,
styles,
classNames,
loadingIcon,
...rest
} = props;
const restProps = (0,es.omit)(rest, ['suffixIcon']);
const {
getPrefixCls,
getPopupContainer: getContextPopupContainer,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles,
expandIcon: contextExpandIcon,
loadingIcon: contextLoadingIcon
} = (0,config_provider_context.useComponentConfig)('cascader');
const {
popupOverflow
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
// =================== Form =====================
const {
status: contextStatus,
hasFeedback,
isFormItemInput,
feedbackIcon
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FormItemInputContext);
const mergedStatus = getMergedStatus(contextStatus, customStatus);
// =================== Warning =====================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Cascader');
// v5 deprecated dropdown api
const deprecatedProps = {
dropdownClassName: 'classNames.popup.root',
dropdownStyle: 'styles.popup.root',
dropdownRender: 'popupRender',
dropdownMenuColumnStyle: 'styles.popup.listItem',
popupMenuColumnStyle: 'styles.popup.listItem',
onDropdownVisibleChange: 'onOpenChange',
onPopupVisibleChange: 'onOpenChange',
bordered: 'variant'
};
Object.entries(deprecatedProps).forEach(([oldProp, newProp]) => {
warning.deprecated(!(oldProp in props), oldProp, newProp);
});
true ? warning(!('showArrow' in props), 'deprecated', '`showArrow` is deprecated which will be removed in next major version. It will be a default behavior, you can hide it by setting `suffixIcon` to null.') : 0;
}
// ==================== Prefix =====================
const [prefixCls, cascaderPrefixCls, mergedDirection, renderEmpty] = hooks_useBase(customizePrefixCls, direction);
const isRtl = mergedDirection === 'rtl';
const rootPrefixCls = getPrefixCls();
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,select_style["default"])(prefixCls, rootCls);
const cascaderRootCls = hooks_useCSSVarCls(cascaderPrefixCls);
(0,cascader_style["default"])(cascaderPrefixCls, cascaderRootCls);
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
const [variant, enableVariantCls] = useVariants('cascader', customVariant, bordered);
// =================== No Found ====================
const mergedNotFoundContent = notFoundContent || renderEmpty?.('Cascader') || (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(defaultRenderEmpty, {
componentName: "Cascader"
}));
const mergedPopupRender = select_usePopupRender(popupRender || dropdownRender);
const mergedPopupMenuColumnStyle = popupMenuColumnStyle || dropdownMenuColumnStyle;
const mergedOnOpenChange = onOpenChange || onPopupVisibleChange || onDropdownVisibleChange;
// ==================== Search =====================
const mergedShowSearch = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!showSearch) {
return showSearch;
}
let searchConfig = {
render: defaultSearchRender
};
if ((0,is.isPlainObject)(showSearch)) {
searchConfig = {
...searchConfig,
...showSearch
};
}
return searchConfig;
}, [showSearch]);
// ===================== Size ======================
const mergedSize = (0,useSize["default"])(ctx => customizeSize ?? compactSize ?? ctx);
// ===================== Disabled =====================
const disabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
const mergedDisabled = customDisabled ?? disabled;
// ===================== Icon ======================
const {
expandIcon: mergedExpandIcon,
loadingIcon: mergedLoadingIcon
} = useIcons_useIcons({
contextExpandIcon,
contextLoadingIcon,
expandIcon,
loadingIcon,
isRtl
});
// =================== Multiple ====================
const checkable = useCheckable(cascaderPrefixCls, multiple);
// ===================== Icons =====================
const showSuffixIcon = useShowArrow(props.suffixIcon, showArrow);
const {
suffixIcon,
removeIcon,
clearIcon
} = useIcons({
...props,
loadingIcon: mergedLoadingIcon,
hasFeedback,
feedbackIcon,
showSuffixIcon,
multiple,
prefixCls,
componentName: 'Cascader'
});
// ===================== Placement =====================
const memoPlacement = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (placement !== undefined) {
return placement;
}
return isRtl ? 'bottomRight' : 'bottomLeft';
}, [placement, isRtl]);
const mergedAllowClear = allowClear === true ? {
clearIcon
} : allowClear;
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
variant,
size: mergedSize,
status: mergedStatus,
disabled: mergedDisabled
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
}, {
popup: {
_default: 'root'
}
});
// =================== Dropdown ====================
const mergedPopupStyle = {
...mergedStyles.popup?.root,
...dropdownStyle
};
// ============================ zIndex ============================
const [zIndex] = (0,useZIndex.useZIndex)('SelectLike', mergedPopupStyle?.zIndex);
const mergedPopupClassName = (0,clsx.clsx)(popupClassName || dropdownClassName, `${cascaderPrefixCls}-dropdown`, {
[`${cascaderPrefixCls}-dropdown-rtl`]: mergedDirection === 'rtl'
}, rootClassName, rootCls, mergedClassNames.popup?.root, cascaderRootCls, hashId, cssVarCls);
// ==================== Render =====================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(cascader_es, {
prefixCls: prefixCls,
className: (0,clsx.clsx)(!customizePrefixCls && cascaderPrefixCls, {
[`${prefixCls}-lg`]: mergedSize === 'large',
[`${prefixCls}-sm`]: mergedSize === 'small',
[`${prefixCls}-rtl`]: isRtl,
[`${prefixCls}-${variant}`]: enableVariantCls,
[`${prefixCls}-in-form-item`]: isFormItemInput
}, getStatusClassNames(prefixCls, mergedStatus, hasFeedback), compactItemClassnames, contextClassName, className, rootClassName, mergedClassNames.root, rootCls, cascaderRootCls, hashId, cssVarCls),
disabled: mergedDisabled,
style: {
...mergedStyles.root,
...contextStyle,
...style
},
classNames: mergedClassNames,
styles: mergedStyles,
...restProps,
builtinPlacements: select_mergedBuiltinPlacements(builtinPlacements, popupOverflow),
direction: mergedDirection,
placement: memoPlacement,
notFoundContent: mergedNotFoundContent,
allowClear: mergedAllowClear,
showSearch: mergedShowSearch,
expandIcon: mergedExpandIcon,
suffixIcon: suffixIcon,
removeIcon: removeIcon,
loadingIcon: mergedLoadingIcon,
checkable: checkable,
popupClassName: mergedPopupClassName,
popupPrefixCls: customizePrefixCls || cascaderPrefixCls,
popupStyle: {
...mergedPopupStyle,
zIndex
},
popupRender: mergedPopupRender,
popupMenuColumnStyle: mergedPopupMenuColumnStyle,
onPopupVisibleChange: mergedOnOpenChange,
choiceTransitionName: (0,_util_motion.getTransitionName)(rootPrefixCls, '', choiceTransitionName),
transitionName: (0,_util_motion.getTransitionName)(rootPrefixCls, 'slide-up', transitionName),
getPopupContainer: getPopupContainer || getContextPopupContainer,
ref: ref
});
});
if (true) {
cascader_Cascader.displayName = 'Cascader';
}
// We don't care debug panel
/* istanbul ignore next */
const cascader_PurePanel = _util_PurePanel(cascader_Cascader, 'popupAlign', props => (0,es.omit)(props, ['visible']));
cascader_Cascader.SHOW_PARENT = cascader_SHOW_PARENT;
cascader_Cascader.SHOW_CHILD = cascader_SHOW_CHILD;
cascader_Cascader.Panel = cascader_Panel;
cascader_Cascader._InternalPanelDoNotUseOrYouWillBeFired = cascader_PurePanel;
/* harmony default export */ var cascader = (cascader_Cascader);
;// ./components/checkbox/GroupContext.ts
const GroupContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createContext(null);
/* harmony default export */ var checkbox_GroupContext = (GroupContext);
// EXTERNAL MODULE: ./components/checkbox/style/index.ts
var checkbox_style = __webpack_require__("./components/checkbox/style/index.ts");
;// ./components/checkbox/Checkbox.tsx
const InternalCheckbox = (props, ref) => {
const {
prefixCls: customizePrefixCls,
children,
indeterminate = false,
onMouseEnter,
onMouseLeave,
skipGroup = false,
disabled,
// Style
rootClassName,
className,
style,
classNames,
styles,
// Name
name,
// Value
value,
// Checked
checked,
defaultChecked,
onChange,
...restProps
} = props;
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('checkbox');
const checkboxGroup = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(checkbox_GroupContext);
const {
isFormItemInput
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FormItemInputContext);
const contextDisabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
const mergedDisabled = (checkboxGroup?.disabled || disabled) ?? contextDisabled;
// ============================= Warning ==============================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Checkbox');
true ? warning('checked' in props || !!checkboxGroup || !('value' in props), 'usage', '`value` is not a valid prop, do you mean `checked`?') : 0;
}
// ============================= Checked ==============================
const [innerChecked, setInnerChecked] = (0,es.useControlledState)(defaultChecked, checked);
let mergedChecked = innerChecked;
const onInternalChange = (0,es.useEvent)(event => {
setInnerChecked(event.target.checked);
onChange?.(event);
if (!skipGroup && checkboxGroup?.toggleOption) {
checkboxGroup.toggleOption({
label: children,
value
});
}
});
// ============================== Group ===============================
if (checkboxGroup && !skipGroup) {
mergedChecked = checkboxGroup.value.includes(value);
}
const checkboxRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const mergedRef = (0,es_ref.useComposeRef)(ref, checkboxRef);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (skipGroup || !checkboxGroup) {
return;
}
checkboxGroup.registerValue(value);
return () => {
checkboxGroup.cancelValue(value);
};
}, [value, skipGroup]);
// ========================== Indeterminate ===========================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (checkboxRef.current?.input) {
checkboxRef.current.input.indeterminate = indeterminate;
}
}, [indeterminate]);
// ============================== Style ===============================
const prefixCls = getPrefixCls('checkbox', customizePrefixCls);
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,checkbox_style["default"])(prefixCls, rootCls);
const checkboxProps = {
...restProps
};
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
indeterminate,
disabled: mergedDisabled,
checked: mergedChecked
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const classString = (0,clsx.clsx)(`${prefixCls}-wrapper`, {
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-wrapper-checked`]: mergedChecked,
[`${prefixCls}-wrapper-disabled`]: mergedDisabled,
[`${prefixCls}-wrapper-in-form-item`]: isFormItemInput
}, contextClassName, className, mergedClassNames.root, rootClassName, cssVarCls, rootCls, hashId);
const checkboxClass = (0,clsx.clsx)(mergedClassNames.icon, {
[`${prefixCls}-indeterminate`]: indeterminate
}, TARGET_CLS, hashId);
// ============================ Event Lock ============================
const [onLabelClick, onInputClick] = useBubbleLock(checkboxProps.onClick);
// ============================== Render ==============================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(wave, {
component: "Checkbox",
disabled: mergedDisabled
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("label", {
className: classString,
style: {
...mergedStyles.root,
...contextStyle,
...style
},
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
onClick: onLabelClick
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(checkbox_es, {
...checkboxProps,
name: !skipGroup && checkboxGroup ? checkboxGroup.name : name,
checked: mergedChecked,
onClick: onInputClick,
onChange: onInternalChange,
prefixCls: prefixCls,
className: checkboxClass,
style: mergedStyles.icon,
disabled: mergedDisabled,
ref: mergedRef,
value: value
}), (0,is.isNonNullable)(children) && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}-label`, mergedClassNames.label),
style: mergedStyles.label
}, children))));
};
const checkbox_Checkbox_Checkbox = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(InternalCheckbox);
if (true) {
checkbox_Checkbox_Checkbox.displayName = 'Checkbox';
}
/* harmony default export */ var checkbox_Checkbox = (checkbox_Checkbox_Checkbox);
;// ./components/checkbox/Group.tsx
const CheckboxGroup = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
defaultValue,
children,
options = [],
prefixCls: customizePrefixCls,
className,
rootClassName,
style,
onChange,
role = 'group',
...restProps
} = props;
const {
getPrefixCls,
direction
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const [value, setValue] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(restProps.value || defaultValue || []);
const [registeredValues, setRegisteredValues] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if ('value' in restProps) {
setValue(restProps.value || []);
}
}, [restProps.value]);
const memoizedOptions = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => options.map(option => {
if (typeof option === 'string' || (0,is.isNumber)(option)) {
return {
label: option,
value: option
};
}
return option;
}), [options]);
const cancelValue = val => {
setRegisteredValues(prevValues => prevValues.filter(v => v !== val));
};
const registerValue = val => {
setRegisteredValues(prevValues => [].concat((0,toConsumableArray["default"])(prevValues), [val]));
};
const toggleOption = option => {
const optionIndex = value.indexOf(option.value);
const newValue = (0,toConsumableArray["default"])(value);
if (optionIndex === -1) {
newValue.push(option.value);
} else {
newValue.splice(optionIndex, 1);
}
if (!('value' in restProps)) {
setValue(newValue);
}
onChange?.(newValue.filter(val => registeredValues.includes(val)).sort((a, b) => {
const indexA = memoizedOptions.findIndex(opt => opt.value === a);
const indexB = memoizedOptions.findIndex(opt => opt.value === b);
return indexA - indexB;
}));
};
const prefixCls = getPrefixCls('checkbox', customizePrefixCls);
const groupPrefixCls = `${prefixCls}-group`;
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,checkbox_style["default"])(prefixCls, rootCls);
const domProps = (0,es.omit)(restProps, ['value', 'disabled']);
const childrenNode = options.length ? memoizedOptions.map(option => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(checkbox_Checkbox, {
prefixCls: prefixCls,
key: option.value.toString(),
disabled: 'disabled' in option ? option.disabled : restProps.disabled,
value: option.value,
checked: value.includes(option.value),
onChange: option.onChange,
className: (0,clsx.clsx)(`${groupPrefixCls}-item`, option.className),
style: option.style,
title: option.title,
id: option.id,
required: option.required
}, option.label))) : children;
const memoizedContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
toggleOption,
value,
disabled: restProps.disabled,
name: restProps.name,
// https://github.com/ant-design/ant-design/issues/16376
registerValue,
cancelValue
}), [toggleOption, value, restProps.disabled, restProps.name, registerValue, cancelValue]);
const classString = (0,clsx.clsx)(groupPrefixCls, {
[`${groupPrefixCls}-rtl`]: direction === 'rtl'
}, className, rootClassName, cssVarCls, rootCls, hashId);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: classString,
style: style,
role: role,
...domProps,
ref: ref
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(checkbox_GroupContext.Provider, {
value: memoizedContext
}, childrenNode));
});
/* harmony default export */ var Group = (CheckboxGroup);
;// ./components/checkbox/index.tsx
const components_checkbox_Checkbox = checkbox_Checkbox;
components_checkbox_Checkbox.Group = Group;
components_checkbox_Checkbox.__ANT_CHECKBOX = true;
if (true) {
components_checkbox_Checkbox.displayName = 'Checkbox';
}
/* harmony default export */ var components_checkbox = (components_checkbox_Checkbox);
;// ./components/grid/RowContext.ts
const RowContext = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext)({});
/* harmony default export */ var grid_RowContext = (RowContext);
// EXTERNAL MODULE: ./components/grid/style/index.ts
var grid_style = __webpack_require__("./components/grid/style/index.ts");
;// ./components/grid/col.tsx
function parseFlex(flex) {
if (flex === 'auto') {
return '1 1 auto';
}
if ((0,is.isNumber)(flex)) {
return `${flex} ${flex} auto`;
}
if (/^\d+(\.\d+)?(px|em|rem|%)$/.test(flex)) {
return `0 0 ${flex}`;
}
return flex;
}
const Col = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
getPrefixCls,
direction
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const {
gutter,
wrap
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(grid_RowContext);
const {
prefixCls: customizePrefixCls,
span,
order,
offset,
push,
pull,
className,
children,
flex,
style,
...others
} = props;
const prefixCls = getPrefixCls('col', customizePrefixCls);
const rootPrefixCls = getPrefixCls();
const [hashId, cssVarCls] = (0,grid_style.useColStyle)(prefixCls);
const [varName] = (0,genStyleUtils.genCssVar)(rootPrefixCls, 'col');
// ===================== Size ======================
const sizeStyle = {};
let sizeClassObj = {};
responsiveArrayReversed.forEach(size => {
let sizeProps = {};
const propSize = props[size];
if ((0,is.isNumber)(propSize)) {
sizeProps.span = propSize;
} else if ((0,is.isPlainObject)(propSize)) {
sizeProps = propSize || {};
}
delete others[size];
sizeClassObj = {
...sizeClassObj,
[`${prefixCls}-${size}-${sizeProps.span}`]: (0,is.isNonNullable)(sizeProps.span),
[`${prefixCls}-${size}-order-${sizeProps.order}`]: sizeProps.order || sizeProps.order === 0,
[`${prefixCls}-${size}-offset-${sizeProps.offset}`]: sizeProps.offset || sizeProps.offset === 0,
[`${prefixCls}-${size}-push-${sizeProps.push}`]: sizeProps.push || sizeProps.push === 0,
[`${prefixCls}-${size}-pull-${sizeProps.pull}`]: sizeProps.pull || sizeProps.pull === 0,
[`${prefixCls}-rtl`]: direction === 'rtl'
};
// Responsive flex layout
if (sizeProps.flex) {
sizeClassObj[`${prefixCls}-${size}-flex`] = true;
sizeStyle[varName(`${size}-flex`)] = parseFlex(sizeProps.flex);
}
});
// ==================== Normal =====================
const classes = (0,clsx.clsx)(prefixCls, {
[`${prefixCls}-${span}`]: span !== undefined,
[`${prefixCls}-order-${order}`]: order,
[`${prefixCls}-offset-${offset}`]: offset,
[`${prefixCls}-push-${push}`]: push,
[`${prefixCls}-pull-${pull}`]: pull
}, className, sizeClassObj, hashId, cssVarCls);
const mergedStyle = {};
// Horizontal gutter use padding
if (gutter?.[0]) {
const horizontalGutter = (0,is.isNumber)(gutter[0]) ? `${gutter[0] / 2}px` : `calc(${gutter[0]} / 2)`;
mergedStyle.paddingInline = horizontalGutter;
}
if (flex) {
mergedStyle.flex = parseFlex(flex);
// Hack for Firefox to avoid size issue
// https://github.com/ant-design/ant-design/pull/20023#issuecomment-564389553
if (wrap === false && !mergedStyle.minWidth) {
mergedStyle.minWidth = 0;
}
}
// ==================== Render =====================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
...others,
style: {
...mergedStyle,
...style,
...sizeStyle
},
className: classes,
ref: ref
}, children);
});
if (true) {
Col.displayName = 'Col';
}
/* harmony default export */ var col = (Col);
;// ./components/col/index.tsx
/* harmony default export */ var components_col = (col);
// EXTERNAL MODULE: ./components/collapse/index.tsx + 7 modules
var collapse = __webpack_require__("./components/collapse/index.tsx");
// EXTERNAL MODULE: ./components/color-picker/color.ts
var color = __webpack_require__("./components/color-picker/color.ts");
// EXTERNAL MODULE: ./components/divider/style/index.ts
var divider_style = __webpack_require__("./components/divider/style/index.ts");
;// ./components/divider/index.tsx
const titlePlacementList = ['left', 'right', 'center', 'start', 'end'];
const divider_Divider = props => {
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('divider');
const {
prefixCls: customizePrefixCls,
type,
orientation,
vertical,
titlePlacement,
orientationMargin,
className,
rootClassName,
children,
dashed,
variant = 'solid',
plain,
style,
size: customSize,
classNames,
styles,
...restProps
} = props;
const prefixCls = getPrefixCls('divider', customizePrefixCls);
const railCls = `${prefixCls}-rail`;
const [hashId, cssVarCls] = (0,divider_style["default"])(prefixCls);
const sizeFullName = (0,useSize["default"])(customSize);
const hasChildren = !!children;
const validTitlePlacement = titlePlacementList.includes(orientation || '');
const mergedTitlePlacement = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const placement = titlePlacement ?? (validTitlePlacement ? orientation : 'center');
if (placement === 'left') {
return direction === 'rtl' ? 'end' : 'start';
}
if (placement === 'right') {
return direction === 'rtl' ? 'start' : 'end';
}
return placement;
}, [direction, orientation, titlePlacement, validTitlePlacement]);
const hasMarginStart = mergedTitlePlacement === 'start' && orientationMargin != null;
const hasMarginEnd = mergedTitlePlacement === 'end' && orientationMargin != null;
const [mergedOrientation, mergedVertical] = useOrientation(orientation, vertical, type);
// ========================= Semantic =========================
const mergedProps = {
...props,
orientation: mergedOrientation,
titlePlacement: mergedTitlePlacement,
size: sizeFullName
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const classString = (0,clsx.clsx)(prefixCls, contextClassName, hashId, cssVarCls, `${prefixCls}-${mergedOrientation}`, {
[`${prefixCls}-with-text`]: hasChildren,
[`${prefixCls}-with-text-${mergedTitlePlacement}`]: hasChildren,
[`${prefixCls}-dashed`]: !!dashed,
[`${prefixCls}-${variant}`]: variant !== 'solid',
[`${prefixCls}-plain`]: !!plain,
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-no-default-orientation-margin-start`]: hasMarginStart,
[`${prefixCls}-no-default-orientation-margin-end`]: hasMarginEnd,
[`${prefixCls}-md`]: sizeFullName === 'medium' || sizeFullName === 'middle',
[`${prefixCls}-sm`]: sizeFullName === 'small',
[railCls]: !children,
[mergedClassNames.rail]: mergedClassNames.rail && !children
}, className, rootClassName, mergedClassNames.root);
const memoizedPlacementMargin = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if ((0,is.isNumber)(orientationMargin)) {
return orientationMargin;
}
if (/^\d+$/.test(orientationMargin)) {
return Number(orientationMargin);
}
return orientationMargin;
}, [orientationMargin]);
const innerStyle = {
marginInlineStart: hasMarginStart ? memoizedPlacementMargin : undefined,
marginInlineEnd: hasMarginEnd ? memoizedPlacementMargin : undefined
};
// =================== Warning =====================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Divider');
true ? warning(!children || !mergedVertical, 'usage', '`children` not working in `vertical` mode.') : 0;
true ? warning(!validTitlePlacement, 'usage', '`orientation` is used for direction, please use `titlePlacement` replace this') : 0;
[['type', 'orientation'], ['orientationMargin', 'styles.content.margin']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: classString,
style: {
...contextStyle,
...mergedStyles.root,
...(children ? {} : mergedStyles.rail),
...style
},
...restProps,
role: "separator"
}, children && !mergedVertical && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(railCls, `${railCls}-start`, mergedClassNames.rail),
style: mergedStyles.rail
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}-inner-text`, mergedClassNames.content),
style: {
...innerStyle,
...mergedStyles.content
}
}, children), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(railCls, `${railCls}-end`, mergedClassNames.rail),
style: mergedStyles.rail
}))));
};
if (true) {
divider_Divider.displayName = 'Divider';
}
/* harmony default export */ var divider = (divider_Divider);
// EXTERNAL MODULE: ./node_modules/@rc-component/color-picker/es/index.js + 14 modules
var color_picker_es = __webpack_require__("./node_modules/@rc-component/color-picker/es/index.js");
;// ./node_modules/@rc-component/segmented/es/MotionThumb.js
const calcThumbStyle = (targetElement, vertical) => {
if (!targetElement) return null;
const style = {
left: targetElement.offsetLeft,
right: targetElement.parentElement.clientWidth - targetElement.clientWidth - targetElement.offsetLeft,
width: targetElement.clientWidth,
top: targetElement.offsetTop,
bottom: targetElement.parentElement.clientHeight - targetElement.clientHeight - targetElement.offsetTop,
height: targetElement.clientHeight
};
if (vertical) {
// Adjusts positioning and size for vertical layout by setting horizontal properties to 0 and using vertical properties from the style object.
return {
left: 0,
right: 0,
width: 0,
top: style.top,
bottom: style.bottom,
height: style.height
};
}
return {
left: style.left,
right: style.right,
width: style.width,
top: 0,
bottom: 0,
height: 0
};
};
const toPX = value => value !== undefined ? `${value}px` : undefined;
function MotionThumb(props) {
const {
prefixCls,
containerRef,
value,
getValueIndex,
motionName,
onMotionStart,
onMotionEnd,
direction,
vertical = false
} = props;
const thumbRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const [prevValue, setPrevValue] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(value);
// =========================== Effect ===========================
const findValueElement = val => {
const index = getValueIndex(val);
const ele = containerRef.current?.querySelectorAll(`.${prefixCls}-item`)[index];
return ele?.offsetParent && ele;
};
const [prevStyle, setPrevStyle] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
const [nextStyle, setNextStyle] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
(0,useLayoutEffect["default"])(() => {
if (prevValue !== value) {
const prev = findValueElement(prevValue);
const next = findValueElement(value);
const calcPrevStyle = calcThumbStyle(prev, vertical);
const calcNextStyle = calcThumbStyle(next, vertical);
setPrevValue(value);
setPrevStyle(calcPrevStyle);
setNextStyle(calcNextStyle);
if (prev && next) {
onMotionStart();
} else {
onMotionEnd();
}
}
}, [value]);
const thumbStart = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (vertical) {
return toPX(prevStyle?.top ?? 0);
}
if (direction === 'rtl') {
return toPX(-prevStyle?.right);
}
return toPX(prevStyle?.left);
}, [vertical, direction, prevStyle]);
const thumbActive = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (vertical) {
return toPX(nextStyle?.top ?? 0);
}
if (direction === 'rtl') {
return toPX(-nextStyle?.right);
}
return toPX(nextStyle?.left);
}, [vertical, direction, nextStyle]);
// =========================== Motion ===========================
const onAppearStart = () => {
if (vertical) {
return {
transform: 'translateY(var(--thumb-start-top))',
height: 'var(--thumb-start-height)'
};
}
return {
transform: 'translateX(var(--thumb-start-left))',
width: 'var(--thumb-start-width)'
};
};
const onAppearActive = () => {
if (vertical) {
return {
transform: 'translateY(var(--thumb-active-top))',
height: 'var(--thumb-active-height)'
};
}
return {
transform: 'translateX(var(--thumb-active-left))',
width: 'var(--thumb-active-width)'
};
};
const onVisibleChanged = () => {
setPrevStyle(null);
setNextStyle(null);
onMotionEnd();
};
// =========================== Render ===========================
// No need motion when nothing exist in queue
if (!prevStyle || !nextStyle) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es["default"], {
visible: true,
motionName: motionName,
motionAppear: true,
onAppearStart: onAppearStart,
onAppearActive: onAppearActive,
onVisibleChanged: onVisibleChanged
}, ({
className: motionClassName,
style: motionStyle
}, ref) => {
const mergedStyle = {
...motionStyle,
'--thumb-start-left': thumbStart,
'--thumb-start-width': toPX(prevStyle?.width),
'--thumb-active-left': thumbActive,
'--thumb-active-width': toPX(nextStyle?.width),
'--thumb-start-top': thumbStart,
'--thumb-start-height': toPX(prevStyle?.height),
'--thumb-active-top': thumbActive,
'--thumb-active-height': toPX(nextStyle?.height)
};
// It's little ugly which should be refactor when @umi/test update to latest jsdom
const motionProps = {
ref: (0,es_ref.composeRef)(thumbRef, ref),
style: mergedStyle,
className: (0,clsx.clsx)(`${prefixCls}-thumb`, motionClassName)
};
if (false) // removed by dead control flow
{}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", motionProps);
});
}
;// ./node_modules/@rc-component/segmented/es/index.js
function getValidTitle(option) {
if (typeof option.title !== 'undefined') {
return option.title;
}
// read `label` when title is `undefined`
if (typeof option.label !== 'object') {
return option.label?.toString();
}
}
function normalizeOptions(options) {
return options.map(option => {
if (typeof option === 'object' && option !== null) {
const validTitle = getValidTitle(option);
return {
...option,
title: validTitle
};
}
return {
label: option?.toString(),
title: option?.toString(),
value: option
};
});
}
const InternalSegmentedOption = ({
prefixCls,
className,
style,
styles,
classNames: segmentedClassNames,
data,
disabled,
checked,
label,
title,
value,
name,
onChange,
onFocus,
onBlur,
onKeyDown,
onKeyUp,
onMouseDown,
itemRender = node => node
}) => {
const handleChange = event => {
if (disabled) {
return;
}
onChange(event, value);
};
const itemContent = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("label", {
className: (0,clsx.clsx)(className, {
[`${prefixCls}-item-disabled`]: disabled
}),
style: style,
onMouseDown: onMouseDown
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("input", {
name: name,
className: `${prefixCls}-item-input`,
type: "radio",
disabled: disabled,
checked: checked,
onChange: handleChange,
onFocus: onFocus,
onBlur: onBlur,
onKeyDown: onKeyDown,
onKeyUp: onKeyUp
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-item-label`, segmentedClassNames?.label),
title: title,
style: styles?.label
}, label));
return itemRender(itemContent, {
item: data
});
};
const Segmented = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls = 'rc-segmented',
direction,
vertical,
options = [],
disabled,
defaultValue,
value,
name,
onChange,
className = '',
style,
styles,
classNames: segmentedClassNames,
motionName = 'thumb-motion',
itemRender,
...restProps
} = props;
const containerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const mergedRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => (0,es_ref.composeRef)(containerRef, ref), [containerRef, ref]);
const segmentedOptions = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
return normalizeOptions(options);
}, [options]);
// Note: We should not auto switch value when value not exist in options
// which may break single source of truth.
const [rawValue, setRawValue] = (0,useControlledState["default"])(defaultValue ?? segmentedOptions[0]?.value, value);
// ======================= Change ========================
const [thumbShow, setThumbShow] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const handleChange = (event, val) => {
setRawValue(val);
onChange?.(val);
};
const divProps = (0,omit["default"])(restProps, ['children']);
// ======================= Focus ========================
const [isKeyboard, setIsKeyboard] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const [isFocused, setIsFocused] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const handleFocus = () => {
setIsFocused(true);
};
const handleBlur = () => {
setIsFocused(false);
};
const handleMouseDown = () => {
setIsKeyboard(false);
};
// capture keyboard tab interaction for correct focus style
const handleKeyUp = event => {
if (event.key === 'Tab') {
setIsKeyboard(true);
}
};
// ======================= Keyboard ========================
const onOffset = offset => {
const currentIndex = segmentedOptions.findIndex(option => option.value === rawValue);
const total = segmentedOptions.length;
const nextIndex = (currentIndex + offset + total) % total;
const nextOption = segmentedOptions[nextIndex];
if (nextOption) {
setRawValue(nextOption.value);
onChange?.(nextOption.value);
}
};
const handleKeyDown = event => {
switch (event.key) {
case 'ArrowLeft':
case 'ArrowUp':
onOffset(-1);
break;
case 'ArrowRight':
case 'ArrowDown':
onOffset(1);
break;
}
};
const renderOption = segmentedOption => {
const {
value: optionValue,
disabled: optionDisabled
} = segmentedOption;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(InternalSegmentedOption, (0,esm_extends["default"])({}, segmentedOption, {
name: name,
data: segmentedOption,
itemRender: itemRender,
key: optionValue,
prefixCls: prefixCls,
className: (0,clsx.clsx)(segmentedOption.className, `${prefixCls}-item`, segmentedClassNames?.item, {
[`${prefixCls}-item-selected`]: optionValue === rawValue && !thumbShow,
[`${prefixCls}-item-focused`]: isFocused && isKeyboard && optionValue === rawValue
}),
style: styles?.item,
classNames: segmentedClassNames,
styles: styles,
checked: optionValue === rawValue,
onChange: handleChange,
onFocus: handleFocus,
onBlur: handleBlur,
onKeyDown: handleKeyDown,
onKeyUp: handleKeyUp,
onMouseDown: handleMouseDown,
disabled: !!disabled || !!optionDisabled
}));
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", (0,esm_extends["default"])({
role: "radiogroup",
"aria-label": "segmented control",
tabIndex: disabled ? undefined : 0,
"aria-orientation": vertical ? 'vertical' : 'horizontal',
style: style
}, divProps, {
className: (0,clsx.clsx)(prefixCls, {
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-disabled`]: disabled,
[`${prefixCls}-vertical`]: vertical
}, className),
ref: mergedRef
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-group`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(MotionThumb, {
vertical: vertical,
prefixCls: prefixCls,
value: rawValue,
containerRef: containerRef,
motionName: `${prefixCls}-${motionName}`,
direction: direction,
getValueIndex: val => segmentedOptions.findIndex(n => n.value === val),
onMotionStart: () => {
setThumbShow(true);
},
onMotionEnd: () => {
setThumbShow(false);
}
}), segmentedOptions.map(renderOption)));
});
if (true) {
Segmented.displayName = 'Segmented';
}
const TypedSegmented = Segmented;
/* harmony default export */ var segmented_es = (TypedSegmented);
// EXTERNAL MODULE: ./components/segmented/style/index.ts
var segmented_style = __webpack_require__("./components/segmented/style/index.ts");
;// ./components/segmented/index.tsx
function isSegmentedLabeledOptionWithIcon(option) {
return (0,is.isPlainObject)(option) && !!option?.icon;
}
const InternalSegmented = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const defaultName = useId();
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
block,
options = [],
size: customSize,
style,
vertical,
orientation,
shape = 'default',
name = defaultName,
styles,
classNames,
...restProps
} = props;
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('segmented');
const mergedProps = {
...props,
options,
size: customSize,
shape
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const prefixCls = getPrefixCls('segmented', customizePrefixCls);
// Style
const [hashId, cssVarCls] = (0,segmented_style["default"])(prefixCls);
// ===================== Size =====================
const mergedSize = (0,useSize["default"])(customSize);
// syntactic sugar to support `icon` for Segmented Item
const extendedOptions = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => options.map(option => {
if (isSegmentedLabeledOptionWithIcon(option)) {
const {
icon,
label,
...restOption
} = option;
return {
...restOption,
label: (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}-item-icon`, mergedClassNames.icon),
style: mergedStyles.icon
}, icon), label && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", null, label)))
};
}
return option;
}), [options, prefixCls, mergedClassNames.icon, mergedStyles.icon]);
const [, mergedVertical] = useOrientation(orientation, vertical);
const cls = (0,clsx.clsx)(className, rootClassName, contextClassName, mergedClassNames.root, {
[`${prefixCls}-block`]: block,
[`${prefixCls}-sm`]: mergedSize === 'small',
[`${prefixCls}-lg`]: mergedSize === 'large',
[`${prefixCls}-vertical`]: mergedVertical,
[`${prefixCls}-shape-${shape}`]: shape === 'round'
}, hashId, cssVarCls);
const mergedStyle = {
...mergedStyles.root,
...contextStyle,
...style
};
const itemRender = (node, {
item
}) => {
if (!item.tooltip) {
return node;
}
const tooltipProps = (0,is.isPlainObject)(item.tooltip) ? item.tooltip : {
title: item.tooltip
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_tooltip, {
...tooltipProps
}, node);
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(segmented_es, {
...restProps,
name: name,
className: cls,
style: mergedStyle,
classNames: mergedClassNames,
styles: mergedStyles,
itemRender: itemRender,
options: extendedOptions,
ref: ref,
prefixCls: prefixCls,
direction: direction,
vertical: mergedVertical
});
});
const segmented_Segmented = InternalSegmented;
if (true) {
segmented_Segmented.displayName = 'Segmented';
}
/* harmony default export */ var segmented = (segmented_Segmented);
;// ./components/color-picker/context.ts
const PanelPickerContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createContext({});
const PanelPresetsContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createContext({});
;// ./components/color-picker/components/ColorClear.tsx
const ColorClear = ({
prefixCls,
value,
onChange,
className,
style
}) => {
const onClick = () => {
if (onChange && value && !value.cleared) {
const hsba = value.toHsb();
hsba.a = 0;
const genColor = (0,util.generateColor)(hsba);
genColor.cleared = true;
onChange(genColor);
}
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx["default"])(`${prefixCls}-clear`, className),
style: style,
onClick: onClick
});
};
/* harmony default export */ var components_ColorClear = (ColorClear);
;// ./components/color-picker/interface.ts
const FORMAT_HEX = 'hex';
const FORMAT_RGB = 'rgb';
const FORMAT_HSB = 'hsb';
;// ./node_modules/@ant-design/icons-svg/es/asn/MinusOutlined.js
// This icon file is generated automatically.
var MinusOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M872 474H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h720c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" } }] }, "name": "minus", "theme": "outlined" };
/* harmony default export */ var asn_MinusOutlined = (MinusOutlined);
;// ./node_modules/@ant-design/icons/es/icons/MinusOutlined.js
function MinusOutlined_extends() { MinusOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return MinusOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const MinusOutlined_MinusOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], MinusOutlined_extends({}, props, {
ref: ref,
icon: asn_MinusOutlined
}));
/** */
const MinusOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(MinusOutlined_MinusOutlined);
if (true) {
MinusOutlined_RefIcon.displayName = 'MinusOutlined';
}
/* harmony default export */ var icons_MinusOutlined = (MinusOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/UpOutlined.js
// This icon file is generated automatically.
var UpOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z" } }] }, "name": "up", "theme": "outlined" };
/* harmony default export */ var asn_UpOutlined = (UpOutlined);
;// ./node_modules/@ant-design/icons/es/icons/UpOutlined.js
function UpOutlined_extends() { UpOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return UpOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const UpOutlined_UpOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], UpOutlined_extends({}, props, {
ref: ref,
icon: asn_UpOutlined
}));
/** */
const UpOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(UpOutlined_UpOutlined);
if (true) {
UpOutlined_RefIcon.displayName = 'UpOutlined';
}
/* harmony default export */ var icons_UpOutlined = (UpOutlined_RefIcon);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 3 modules
var slicedToArray = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");
;// ./node_modules/@rc-component/mini-decimal/es/supportUtil.js
function supportBigInt() {
return typeof BigInt === 'function';
}
;// ./node_modules/@rc-component/mini-decimal/es/numberUtil.js
function isEmpty(value) {
return !value && value !== 0 && !Number.isNaN(value) || !String(value).trim();
}
/**
* Format string number to readable number
*/
function trimNumber(numStr) {
var str = numStr.trim();
var negative = str.startsWith('-');
if (negative) {
str = str.slice(1);
}
str = str
// Remove decimal 0. `1.000` => `1.`, `1.100` => `1.1`
.replace(/(\.\d*[^0])0*$/, '$1')
// Remove useless decimal. `1.` => `1`
.replace(/\.0*$/, '')
// Remove integer 0. `0001` => `1`, 000.1' => `.1`
.replace(/^0+/, '');
if (str.startsWith('.')) {
str = "0".concat(str);
}
var trimStr = str || '0';
var splitNumber = trimStr.split('.');
var integerStr = splitNumber[0] || '0';
var decimalStr = splitNumber[1] || '0';
if (integerStr === '0' && decimalStr === '0') {
negative = false;
}
var negativeStr = negative ? '-' : '';
return {
negative: negative,
negativeStr: negativeStr,
trimStr: trimStr,
integerStr: integerStr,
decimalStr: decimalStr,
fullStr: "".concat(negativeStr).concat(trimStr)
};
}
function isE(number) {
var str = String(number);
return !Number.isNaN(Number(str)) && str.includes('e');
}
/**
* Parse a scientific-notation string into reusable parts.
*
* The idea is to split the value into mantissa and exponent first, then
* normalize the mantissa into sign, integer/decimal segments, and a compact
* digit sequence so later logic can move the decimal point without re-parsing.
*/
function parseScientificNotation(numStr) {
var _numStr$toLowerCase$s = numStr.toLowerCase().split('e'),
_numStr$toLowerCase$s2 = (0,slicedToArray["default"])(_numStr$toLowerCase$s, 2),
mantissa = _numStr$toLowerCase$s2[0],
_numStr$toLowerCase$s3 = _numStr$toLowerCase$s2[1],
exponent = _numStr$toLowerCase$s3 === void 0 ? '0' : _numStr$toLowerCase$s3;
var negative = mantissa.startsWith('-');
var unsignedMantissa = negative ? mantissa.slice(1) : mantissa;
var _unsignedMantissa$spl = unsignedMantissa.split('.'),
_unsignedMantissa$spl2 = (0,slicedToArray["default"])(_unsignedMantissa$spl, 2),
_unsignedMantissa$spl3 = _unsignedMantissa$spl2[0],
integer = _unsignedMantissa$spl3 === void 0 ? '0' : _unsignedMantissa$spl3,
_unsignedMantissa$spl4 = _unsignedMantissa$spl2[1],
decimal = _unsignedMantissa$spl4 === void 0 ? '' : _unsignedMantissa$spl4;
var digits = "".concat(integer).concat(decimal).replace(/^0+/, '') || '0';
return {
decimal: decimal,
digits: digits,
exponent: Number(exponent),
integer: integer,
negative: negative
};
}
/**
* Expand parsed scientific notation into a plain decimal string.
*
* The core idea is to calculate where the decimal point lands after applying
* the exponent, then rebuild the string by either padding zeros or inserting
* the decimal point inside the normalized digit sequence.
*/
function expandScientificNotation(parsed) {
var decimal = parsed.decimal,
digits = parsed.digits,
exponent = parsed.exponent,
integer = parsed.integer,
negative = parsed.negative;
if (digits === '0') {
return '0';
}
var integerDigits = integer.replace(/^0+/, '').length;
var leadingDecimalZeros = (decimal.match(/^0*/) || [''])[0].length;
var initialDecimalIndex = integerDigits || -leadingDecimalZeros;
var decimalIndex = initialDecimalIndex + exponent;
var expanded = '';
if (decimalIndex <= 0) {
expanded = "0.".concat('0'.repeat(-decimalIndex)).concat(digits);
} else if (decimalIndex >= digits.length) {
expanded = "".concat(digits).concat('0'.repeat(decimalIndex - digits.length));
} else {
expanded = "".concat(digits.slice(0, decimalIndex), ".").concat(digits.slice(decimalIndex));
}
return "".concat(negative ? '-' : '').concat(expanded);
}
function getScientificPrecision(parsed) {
if (parsed.exponent >= 0) {
return Math.max(0, parsed.decimal.length - parsed.exponent);
}
return Math.abs(parsed.exponent) + parsed.decimal.length;
}
/**
* [Legacy] Convert 1e-9 to 0.000000001.
* This may lose some precision if user really want 1e-9.
*/
function getNumberPrecision(number) {
var numStr = String(number);
if (isE(number)) {
return getScientificPrecision(parseScientificNotation(numStr));
}
return numStr.includes('.') && validateNumber(numStr) ? numStr.length - numStr.indexOf('.') - 1 : 0;
}
/**
* Convert number (includes scientific notation) to -xxx.yyy format
*/
function num2str(number) {
var numStr = String(number);
if (isE(number)) {
if (number > Number.MAX_SAFE_INTEGER) {
return String(supportBigInt() ? BigInt(number).toString() : Number.MAX_SAFE_INTEGER);
}
if (number < Number.MIN_SAFE_INTEGER) {
return String(supportBigInt() ? BigInt(number).toString() : Number.MIN_SAFE_INTEGER);
}
var parsed = parseScientificNotation(numStr);
var precision = getScientificPrecision(parsed);
numStr = precision > 100 ? expandScientificNotation(parsed) : number.toFixed(precision);
}
return trimNumber(numStr).fullStr;
}
function validateNumber(num) {
if (typeof num === 'number') {
return !Number.isNaN(num);
}
// Empty
if (!num) {
return false;
}
return (
// Normal type: 11.28
/^\s*-?\d+(\.\d+)?\s*$/.test(num) ||
// Pre-number: 1.
/^\s*-?\d+\.\s*$/.test(num) ||
// Post-number: .1
/^\s*-?\.\d+\s*$/.test(num)
);
}
;// ./node_modules/@rc-component/mini-decimal/es/BigIntDecimal.js
var BigIntDecimal = /*#__PURE__*/function () {
function BigIntDecimal(value) {
(0,classCallCheck["default"])(this, BigIntDecimal);
(0,defineProperty["default"])(this, "origin", '');
(0,defineProperty["default"])(this, "negative", void 0);
(0,defineProperty["default"])(this, "integer", void 0);
(0,defineProperty["default"])(this, "decimal", void 0);
/** BigInt will convert `0009` to `9`. We need record the len of decimal */
(0,defineProperty["default"])(this, "decimalLen", void 0);
(0,defineProperty["default"])(this, "empty", void 0);
(0,defineProperty["default"])(this, "nan", void 0);
if (isEmpty(value)) {
this.empty = true;
return;
}
this.origin = String(value);
// Act like Number convert
if (value === '-' || Number.isNaN(value)) {
this.nan = true;
return;
}
var mergedValue = value;
// We need convert back to Number since it require `toFixed` to handle this
if (isE(mergedValue)) {
mergedValue = Number(mergedValue);
}
mergedValue = typeof mergedValue === 'string' ? mergedValue : num2str(mergedValue);
if (validateNumber(mergedValue)) {
var trimRet = trimNumber(mergedValue);
this.negative = trimRet.negative;
var numbers = trimRet.trimStr.split('.');
this.integer = BigInt(numbers[0]);
var decimalStr = numbers[1] || '0';
this.decimal = BigInt(decimalStr);
this.decimalLen = decimalStr.length;
} else {
this.nan = true;
}
}
(0,createClass["default"])(BigIntDecimal, [{
key: "getMark",
value: function getMark() {
return this.negative ? '-' : '';
}
}, {
key: "getIntegerStr",
value: function getIntegerStr() {
return this.integer.toString();
}
/**
* @private get decimal string
*/
}, {
key: "getDecimalStr",
value: function getDecimalStr() {
return this.decimal.toString().padStart(this.decimalLen, '0');
}
/**
* @private Align BigIntDecimal with same decimal length. e.g. 12.3 + 5 = 1230000
* This is used for add function only.
*/
}, {
key: "alignDecimal",
value: function alignDecimal(decimalLength) {
var str = "".concat(this.getMark()).concat(this.getIntegerStr()).concat(this.getDecimalStr().padEnd(decimalLength, '0'));
return BigInt(str);
}
}, {
key: "negate",
value: function negate() {
var clone = new BigIntDecimal(this.toString());
clone.negative = !clone.negative;
return clone;
}
}, {
key: "cal",
value: function cal(offset, calculator, calDecimalLen) {
var maxDecimalLength = Math.max(this.getDecimalStr().length, offset.getDecimalStr().length);
var myAlignedDecimal = this.alignDecimal(maxDecimalLength);
var offsetAlignedDecimal = offset.alignDecimal(maxDecimalLength);
var valueStr = calculator(myAlignedDecimal, offsetAlignedDecimal).toString();
var nextDecimalLength = calDecimalLen(maxDecimalLength);
// We need fill string length back to `maxDecimalLength` to avoid parser failed
var _trimNumber = trimNumber(valueStr),
negativeStr = _trimNumber.negativeStr,
trimStr = _trimNumber.trimStr;
var hydrateValueStr = "".concat(negativeStr).concat(trimStr.padStart(nextDecimalLength + 1, '0'));
return new BigIntDecimal("".concat(hydrateValueStr.slice(0, -nextDecimalLength), ".").concat(hydrateValueStr.slice(-nextDecimalLength)));
}
}, {
key: "add",
value: function add(value) {
if (this.isInvalidate()) {
return new BigIntDecimal(value);
}
var offset = new BigIntDecimal(value);
if (offset.isInvalidate()) {
return this;
}
return this.cal(offset, function (num1, num2) {
return num1 + num2;
}, function (len) {
return len;
});
}
}, {
key: "multi",
value: function multi(value) {
var target = new BigIntDecimal(value);
if (this.isInvalidate() || target.isInvalidate()) {
return new BigIntDecimal(NaN);
}
return this.cal(target, function (num1, num2) {
return num1 * num2;
}, function (len) {
return len * 2;
});
}
}, {
key: "isEmpty",
value: function isEmpty() {
return this.empty;
}
}, {
key: "isNaN",
value: function isNaN() {
return this.nan;
}
}, {
key: "isInvalidate",
value: function isInvalidate() {
return this.isEmpty() || this.isNaN();
}
}, {
key: "equals",
value: function equals(target) {
return this.toString() === (target === null || target === void 0 ? void 0 : target.toString());
}
}, {
key: "lessEquals",
value: function lessEquals(target) {
return this.add(target.negate().toString()).toNumber() <= 0;
}
}, {
key: "toNumber",
value: function toNumber() {
if (this.isNaN()) {
return NaN;
}
return Number(this.toString());
}
}, {
key: "toString",
value: function toString() {
var safe = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
if (!safe) {
return this.origin;
}
if (this.isInvalidate()) {
return '';
}
return trimNumber("".concat(this.getMark()).concat(this.getIntegerStr(), ".").concat(this.getDecimalStr())).fullStr;
}
}]);
return BigIntDecimal;
}();
;// ./node_modules/@rc-component/mini-decimal/es/NumberDecimal.js
/**
* We can remove this when IE not support anymore
*/
var NumberDecimal = /*#__PURE__*/function () {
function NumberDecimal(value) {
(0,classCallCheck["default"])(this, NumberDecimal);
(0,defineProperty["default"])(this, "origin", '');
(0,defineProperty["default"])(this, "number", void 0);
(0,defineProperty["default"])(this, "empty", void 0);
if (isEmpty(value)) {
this.empty = true;
return;
}
this.origin = String(value);
this.number = Number(value);
}
(0,createClass["default"])(NumberDecimal, [{
key: "negate",
value: function negate() {
return new NumberDecimal(-this.toNumber());
}
}, {
key: "add",
value: function add(value) {
if (this.isInvalidate()) {
return new NumberDecimal(value);
}
var target = Number(value);
if (Number.isNaN(target)) {
return this;
}
var number = this.number + target;
// [Legacy] Back to safe integer
if (number > Number.MAX_SAFE_INTEGER) {
return new NumberDecimal(Number.MAX_SAFE_INTEGER);
}
if (number < Number.MIN_SAFE_INTEGER) {
return new NumberDecimal(Number.MIN_SAFE_INTEGER);
}
var maxPrecision = Math.max(getNumberPrecision(this.number), getNumberPrecision(target));
return new NumberDecimal(number.toFixed(maxPrecision));
}
}, {
key: "multi",
value: function multi(value) {
var target = Number(value);
if (this.isInvalidate() || Number.isNaN(target)) {
return new NumberDecimal(NaN);
}
var number = this.number * target;
// [Legacy] Back to safe integer
if (number > Number.MAX_SAFE_INTEGER) {
return new NumberDecimal(Number.MAX_SAFE_INTEGER);
}
if (number < Number.MIN_SAFE_INTEGER) {
return new NumberDecimal(Number.MIN_SAFE_INTEGER);
}
var maxPrecision = Math.max(getNumberPrecision(this.number), getNumberPrecision(target));
return new NumberDecimal(number.toFixed(maxPrecision));
}
}, {
key: "isEmpty",
value: function isEmpty() {
return this.empty;
}
}, {
key: "isNaN",
value: function isNaN() {
return Number.isNaN(this.number);
}
}, {
key: "isInvalidate",
value: function isInvalidate() {
return this.isEmpty() || this.isNaN();
}
}, {
key: "equals",
value: function equals(target) {
return this.toNumber() === (target === null || target === void 0 ? void 0 : target.toNumber());
}
}, {
key: "lessEquals",
value: function lessEquals(target) {
return this.add(target.negate().toString()).toNumber() <= 0;
}
}, {
key: "toNumber",
value: function toNumber() {
return this.number;
}
}, {
key: "toString",
value: function toString() {
var safe = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
if (!safe) {
return this.origin;
}
if (this.isInvalidate()) {
return '';
}
if (isE(this.number) && getNumberPrecision(this.number) > 100) {
return String(this.number);
}
return num2str(this.number);
}
}]);
return NumberDecimal;
}();
;// ./node_modules/@rc-component/mini-decimal/es/MiniDecimal.js
/* eslint-disable max-classes-per-file */
// Still support origin export
function getMiniDecimal(value) {
// We use BigInt here.
// Will fallback to Number if not support.
if (supportBigInt()) {
return new BigIntDecimal(value);
}
return new NumberDecimal(value);
}
/**
* Align the logic of toFixed to around like 1.5 => 2.
* If set `cutOnly`, will just remove the over decimal part.
*/
function toFixed(numStr, separatorStr, precision) {
var cutOnly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
if (numStr === '') {
return '';
}
var _trimNumber = trimNumber(numStr),
negativeStr = _trimNumber.negativeStr,
integerStr = _trimNumber.integerStr,
decimalStr = _trimNumber.decimalStr;
var precisionDecimalStr = "".concat(separatorStr).concat(decimalStr);
var numberWithoutDecimal = "".concat(negativeStr).concat(integerStr);
if (precision >= 0) {
// We will get last + 1 number to check if need advanced number
var advancedNum = Number(decimalStr[precision]);
if (advancedNum >= 5 && !cutOnly) {
var advancedDecimal = getMiniDecimal(numStr).add("".concat(negativeStr, "0.").concat('0'.repeat(precision)).concat(10 - advancedNum));
return toFixed(advancedDecimal.toString(), separatorStr, precision, cutOnly);
}
if (precision === 0) {
return numberWithoutDecimal;
}
return "".concat(numberWithoutDecimal).concat(separatorStr).concat(decimalStr.padEnd(precision, '0').slice(0, precision));
}
if (precisionDecimalStr === '.0') {
return numberWithoutDecimal;
}
return "".concat(numberWithoutDecimal).concat(precisionDecimalStr);
}
;// ./node_modules/@rc-component/mini-decimal/es/index.js
/* harmony default export */ var mini_decimal_es = (getMiniDecimal);
;// ./node_modules/@rc-component/util/es/proxyObject.js
/**
* Proxy object if environment supported
*/
function proxyObject(obj, extendProps) {
if (typeof Proxy !== 'undefined' && obj) {
return new Proxy(obj, {
get(target, prop) {
if (extendProps[prop]) {
return extendProps[prop];
}
// Proxy origin property
const originProp = target[prop];
return typeof originProp === 'function' ? originProp.bind(target) : originProp;
}
});
}
return obj;
}
;// ./node_modules/@rc-component/input-number/es/hooks/useCursor.js
/**
* Keep input cursor in the correct position if possible.
* Is this necessary since we have `formatter` which may mass the content?
*/
function useCursor(input, focused) {
const selectionRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
function recordCursor() {
// Record position
try {
const {
selectionStart: start,
selectionEnd: end,
value
} = input;
const beforeTxt = value.substring(0, start);
const afterTxt = value.substring(end);
selectionRef.current = {
start,
end,
value,
beforeTxt,
afterTxt
};
} catch (e) {
// Fix error in Chrome:
// Failed to read the 'selectionStart' property from 'HTMLInputElement'
// http://stackoverflow.com/q/21177489/3040605
}
}
/**
* Restore logic:
* 1. back string same
* 2. start string same
*/
function restoreCursor() {
if (input && selectionRef.current && focused) {
try {
const {
value
} = input;
const {
beforeTxt,
afterTxt,
start
} = selectionRef.current;
let startPos = value.length;
if (value.startsWith(beforeTxt)) {
startPos = beforeTxt.length;
} else if (value.endsWith(afterTxt)) {
startPos = value.length - selectionRef.current.afterTxt.length;
} else {
const beforeLastChar = beforeTxt[start - 1];
const newIndex = value.indexOf(beforeLastChar, start - 1);
if (newIndex !== -1) {
startPos = newIndex + 1;
}
}
input.setSelectionRange(startPos, startPos);
} catch (e) {
(0,warning["default"])(false, `Something warning of cursor restore. Please fire issue about this: ${e.message}`);
}
}
}
return [recordCursor, restoreCursor];
}
;// ./node_modules/@rc-component/input-number/es/StepHandler.js
/* eslint-disable react/no-unknown-property */
/**
* When click and hold on a button - the speed of auto changing the value.
*/
const STEP_INTERVAL = 200;
/**
* When click and hold on a button - the delay before auto changing the value.
*/
const STEP_DELAY = 600;
function StepHandler({
prefixCls,
action,
children,
disabled,
className,
style,
onStep
}) {
// ======================== MISC ========================
const isUpAction = action === 'up';
// ======================== Step ========================
const stepTimeoutRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
const frameIds = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef([]);
const onStopStep = () => {
clearTimeout(stepTimeoutRef.current);
};
// We will interval update step when hold mouse down
const onStepMouseDown = e => {
e.preventDefault();
onStopStep();
onStep(isUpAction, 'handler');
// Loop step for interval
function loopStep() {
onStep(isUpAction, 'handler');
stepTimeoutRef.current = setTimeout(loopStep, STEP_INTERVAL);
}
// First time press will wait some time to trigger loop step update
stepTimeoutRef.current = setTimeout(loopStep, STEP_DELAY);
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => () => {
onStopStep();
frameIds.current.forEach(id => {
raf["default"].cancel(id);
});
}, []);
// ======================= Render =======================
const actionClassName = `${prefixCls}-action`;
const mergedClassName = (0,clsx.clsx)(actionClassName, `${actionClassName}-${action}`, {
[`${actionClassName}-${action}-disabled`]: disabled
}, className);
// fix: https://github.com/ant-design/ant-design/issues/43088
// In Safari, When we fire onmousedown and onmouseup events in quick succession,
// there may be a problem that the onmouseup events are executed first,
// resulting in a disordered program execution.
// So, we need to use requestAnimationFrame to ensure that the onmouseup event is executed after the onmousedown event.
const safeOnStopStep = () => frameIds.current.push((0,raf["default"])(onStopStep));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
unselectable: "on",
role: "button",
onMouseUp: safeOnStopStep,
onMouseLeave: safeOnStopStep,
onMouseDown: e => {
onStepMouseDown(e);
},
"aria-label": isUpAction ? 'Increase Value' : 'Decrease Value',
"aria-disabled": disabled,
className: mergedClassName,
style: style
}, children || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
unselectable: "on",
className: `${prefixCls}-action-${action}-inner`
}));
}
;// ./node_modules/@rc-component/input-number/es/utils/numberUtil.js
function getDecupleSteps(step) {
const stepStr = typeof step === 'number' ? num2str(step) : trimNumber(step).fullStr;
const hasPoint = stepStr.includes('.');
if (!hasPoint) {
return step + '0';
}
return trimNumber(stepStr.replace(/(\d)\.(\d)/g, '$1$2.')).fullStr;
}
;// ./node_modules/@rc-component/input-number/es/hooks/useFrame.js
/**
* Always trigger latest once when call multiple time
*/
/* harmony default export */ var useFrame = (() => {
const idRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(0);
const cleanUp = () => {
raf["default"].cancel(idRef.current);
};
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => cleanUp, []);
return callback => {
cleanUp();
idRef.current = (0,raf["default"])(() => {
callback();
});
};
});
(Object.getOwnPropertyDescriptor(useFrame, "name") || {}).writable || Object.defineProperty(useFrame, "name", { value: "default", configurable: true });
;// ./node_modules/@rc-component/input-number/es/InputNumber.js
function InputNumber_extends() { InputNumber_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return InputNumber_extends.apply(this, arguments); }
/**
* We support `stringMode` which need handle correct type when user call in onChange
* format max or min value
* 1. if isInvalid return null
* 2. if precision is undefined, return decimal
* 3. format with precision
* I. if max > 0, round down with precision. Example: max= 3.5, precision=0 afterFormat: 3
* II. if max < 0, round up with precision. Example: max= -3.5, precision=0 afterFormat: -4
* III. if min > 0, round up with precision. Example: min= 3.5, precision=0 afterFormat: 4
* IV. if min < 0, round down with precision. Example: max= -3.5, precision=0 afterFormat: -3
*/
const getDecimalValue = (stringMode, decimalValue) => {
if (stringMode || decimalValue.isEmpty()) {
return decimalValue.toString();
}
return decimalValue.toNumber();
};
const getDecimalIfValidate = value => {
const decimal = mini_decimal_es(value);
return decimal.isInvalidate() ? null : decimal;
};
const InputNumber = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
mode = 'input',
prefixCls = 'rc-input-number',
className,
style,
classNames,
styles,
min,
max,
step = 1,
defaultValue,
value,
disabled,
readOnly,
upHandler,
downHandler,
keyboard,
changeOnWheel = false,
controls = true,
prefix,
suffix,
stringMode,
parser,
formatter,
precision,
decimalSeparator,
onChange,
onInput,
onPressEnter,
onStep,
// Mouse Events
onMouseDown,
onClick,
onMouseUp,
onMouseLeave,
onMouseMove,
onMouseEnter,
onMouseOut,
changeOnBlur = true,
...restProps
} = props;
const [focus, setFocus] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const userTypingRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
const compositionRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
const shiftKeyRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
// ============================= Refs =============================
const rootRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const inputRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => proxyObject(inputRef.current, {
focus: option => {
triggerFocus(inputRef.current, option);
},
blur: () => {
inputRef.current?.blur();
},
nativeElement: rootRef.current
}));
// ============================ Value =============================
// Real value control
const [decimalValue, setDecimalValue] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(() => mini_decimal_es(value ?? defaultValue));
function setUncontrolledDecimalValue(newDecimal) {
if (value === undefined) {
setDecimalValue(newDecimal);
}
}
// ====================== Parser & Formatter ======================
/**
* `precision` is used for formatter & onChange.
* It will auto generate by `value` & `step`.
* But it will not block user typing.
*
* Note: Auto generate `precision` is used for legacy logic.
* We should remove this since we already support high precision with BigInt.
*
* @param number Provide which number should calculate precision
* @param userTyping Change by user typing
*/
const getPrecision = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback((numStr, userTyping) => {
if (userTyping) {
return undefined;
}
if (precision >= 0) {
return precision;
}
return Math.max(getNumberPrecision(numStr), getNumberPrecision(step));
}, [precision, step]);
// >>> Parser
const mergedParser = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(num => {
const numStr = String(num);
if (parser) {
return parser(numStr);
}
let parsedStr = numStr;
if (decimalSeparator) {
parsedStr = parsedStr.replace(decimalSeparator, '.');
}
// [Legacy] We still support auto convert `$ 123,456` to `123456`
return parsedStr.replace(/[^\w.-]+/g, '');
}, [parser, decimalSeparator]);
// >>> Formatter
const inputValueRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef('');
const mergedFormatter = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback((number, userTyping) => {
if (formatter) {
return formatter(number, {
userTyping,
input: String(inputValueRef.current)
});
}
let str = typeof number === 'number' ? num2str(number) : number;
// User typing will not auto format with precision directly
if (!userTyping) {
const mergedPrecision = getPrecision(str, userTyping);
if (validateNumber(str) && (decimalSeparator || mergedPrecision >= 0)) {
// Separator
const separatorStr = decimalSeparator || '.';
str = toFixed(str, separatorStr, mergedPrecision);
}
}
return str;
}, [formatter, getPrecision, decimalSeparator]);
// ========================== InputValue ==========================
/**
* Input text value control
*
* User can not update input content directly. It updates with follow rules by priority:
* 1. controlled `value` changed
* * [SPECIAL] Typing like `1.` should not immediately convert to `1`
* 2. User typing with format (not precision)
* 3. Blur or Enter trigger revalidate
*/
const [inputValue, setInternalInputValue] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(() => {
const initValue = defaultValue ?? value;
if (decimalValue.isInvalidate() && ['string', 'number'].includes(typeof initValue)) {
return Number.isNaN(initValue) ? '' : initValue;
}
return mergedFormatter(decimalValue.toString(), false);
});
inputValueRef.current = inputValue;
// Should always be string
function setInputValue(newValue, userTyping) {
setInternalInputValue(mergedFormatter(
// Invalidate number is sometime passed by external control, we should let it go
// Otherwise is controlled by internal interactive logic which check by userTyping
// You can ref 'show limited value when input is not focused' test for more info.
newValue.isInvalidate() ? newValue.toString(false) : newValue.toString(!userTyping), userTyping));
}
// >>> Max & Min limit
const maxDecimal = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => getDecimalIfValidate(max), [max, precision]);
const minDecimal = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => getDecimalIfValidate(min), [min, precision]);
const upDisabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!maxDecimal || !decimalValue || decimalValue.isInvalidate()) {
return false;
}
return maxDecimal.lessEquals(decimalValue);
}, [maxDecimal, decimalValue]);
const downDisabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!minDecimal || !decimalValue || decimalValue.isInvalidate()) {
return false;
}
return decimalValue.lessEquals(minDecimal);
}, [minDecimal, decimalValue]);
// Cursor controller
const [recordCursor, restoreCursor] = useCursor(inputRef.current, focus);
// ============================= Data =============================
/**
* Find target value closet within range.
* e.g. [11, 28]:
* 3 => 11
* 23 => 23
* 99 => 28
*/
const getRangeValue = target => {
// target > max
if (maxDecimal && !target.lessEquals(maxDecimal)) {
return maxDecimal;
}
// target < min
if (minDecimal && !minDecimal.lessEquals(target)) {
return minDecimal;
}
return null;
};
/**
* Check value is in [min, max] range
*/
const isInRange = target => !getRangeValue(target);
/**
* Trigger `onChange` if value validated and not equals of origin.
* Return the value that re-align in range.
*/
const triggerValueUpdate = (newValue, userTyping) => {
let updateValue = newValue;
let isRangeValidate = isInRange(updateValue) || updateValue.isEmpty();
// Skip align value when trigger value is empty.
// We just trigger onChange(null)
// This should not block user typing
if (!updateValue.isEmpty() && !userTyping) {
// Revert value in range if needed
updateValue = getRangeValue(updateValue) || updateValue;
isRangeValidate = true;
}
if (!readOnly && !disabled && isRangeValidate) {
const numStr = updateValue.toString();
const mergedPrecision = getPrecision(numStr, userTyping);
if (mergedPrecision >= 0) {
updateValue = mini_decimal_es(toFixed(numStr, '.', mergedPrecision));
// When to fixed. The value may out of min & max range.
// 4 in [0, 3.8] => 3.8 => 4 (toFixed)
if (!isInRange(updateValue)) {
updateValue = mini_decimal_es(toFixed(numStr, '.', mergedPrecision, true));
}
}
// Trigger event
if (!updateValue.equals(decimalValue)) {
setUncontrolledDecimalValue(updateValue);
onChange?.(updateValue.isEmpty() ? null : getDecimalValue(stringMode, updateValue));
// Reformat input if value is not controlled
if (value === undefined) {
setInputValue(updateValue, userTyping);
}
}
return updateValue;
}
return decimalValue;
};
// ========================== User Input ==========================
const onNextPromise = useFrame();
// >>> Collect input value
const collectInputValue = inputStr => {
recordCursor();
// Update inputValue in case input can not parse as number
// Refresh ref value immediately since it may used by formatter
inputValueRef.current = inputStr;
setInternalInputValue(inputStr);
// Parse number
if (!compositionRef.current) {
const finalValue = mergedParser(inputStr);
const finalDecimal = mini_decimal_es(finalValue);
if (!finalDecimal.isNaN()) {
triggerValueUpdate(finalDecimal, true);
}
}
// Trigger onInput later to let user customize value if they want to handle something after onChange
onInput?.(inputStr);
// optimize for chinese input experience
// https://github.com/ant-design/ant-design/issues/8196
onNextPromise(() => {
let nextInputStr = inputStr;
if (!parser) {
nextInputStr = inputStr.replace(/。/g, '.');
}
if (nextInputStr !== inputStr) {
collectInputValue(nextInputStr);
}
});
};
// >>> Composition
const onCompositionStart = () => {
compositionRef.current = true;
};
const onCompositionEnd = () => {
compositionRef.current = false;
collectInputValue(inputRef.current.value);
};
// >>> Input
const onInternalInput = e => {
collectInputValue(e.target.value);
};
// ============================= Step =============================
const onInternalStep = (0,es.useEvent)((up, emitter) => {
// Ignore step since out of range
if (up && upDisabled || !up && downDisabled) {
return;
}
// Clear typing status since it may be caused by up & down key.
// We should sync with input value.
userTypingRef.current = false;
let stepDecimal = mini_decimal_es(shiftKeyRef.current ? getDecupleSteps(step) : step);
if (!up) {
stepDecimal = stepDecimal.negate();
}
const target = (decimalValue || mini_decimal_es(0)).add(stepDecimal.toString());
const updatedValue = triggerValueUpdate(target, false);
onStep?.(getDecimalValue(stringMode, updatedValue), {
offset: shiftKeyRef.current ? getDecupleSteps(step) : step,
type: up ? 'up' : 'down',
emitter
});
inputRef.current?.focus();
});
// ============================ Flush =============================
/**
* Flush current input content to trigger value change & re-formatter input if needed.
* This will always flush input value for update.
* If it's invalidate, will fallback to last validate value.
*/
const flushInputValue = userTyping => {
const parsedValue = mini_decimal_es(mergedParser(inputValue));
let formatValue;
if (!parsedValue.isNaN()) {
// Only validate value or empty value can be re-fill to inputValue
// Reassign the formatValue within ranged of trigger control
formatValue = triggerValueUpdate(parsedValue, userTyping);
} else {
formatValue = triggerValueUpdate(decimalValue, userTyping);
}
if (value !== undefined) {
// Reset back with controlled value first
setInputValue(decimalValue, false);
} else if (!formatValue.isNaN()) {
// Reset input back since no validate value
setInputValue(formatValue, false);
}
};
// Solve the issue of the event triggering sequence when entering numbers in chinese input (Safari)
const onBeforeInput = () => {
userTypingRef.current = true;
};
const onKeyDown = event => {
const {
key,
shiftKey
} = event;
userTypingRef.current = true;
shiftKeyRef.current = shiftKey;
if (key === 'Enter') {
if (!compositionRef.current) {
userTypingRef.current = false;
}
flushInputValue(false);
onPressEnter?.(event);
}
if (keyboard === false) {
return;
}
// Do step
if (!compositionRef.current && ['Up', 'ArrowUp', 'Down', 'ArrowDown'].includes(key)) {
onInternalStep(key === 'Up' || key === 'ArrowUp', 'keyboard');
event.preventDefault();
}
};
const onKeyUp = () => {
userTypingRef.current = false;
shiftKeyRef.current = false;
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (changeOnWheel && focus) {
const onWheel = event => {
// moving mouse wheel rises wheel event with deltaY < 0
// scroll value grows from top to bottom, as screen Y coordinate
onInternalStep(event.deltaY < 0, 'wheel');
event.preventDefault();
};
const input = inputRef.current;
if (input) {
// React onWheel is passive and we can't preventDefault() in it.
// That's why we should subscribe with DOM listener
// https://stackoverflow.com/questions/63663025/react-onwheel-handler-cant-preventdefault-because-its-a-passive-event-listenev
input.addEventListener('wheel', onWheel, {
passive: false
});
return () => input.removeEventListener('wheel', onWheel);
}
}
});
// >>> Focus & Blur
const onBlur = () => {
if (changeOnBlur) {
flushInputValue(false);
}
setFocus(false);
userTypingRef.current = false;
};
// >>> Mouse events
const onInternalMouseDown = event => {
if (inputRef.current && event.target !== inputRef.current) {
inputRef.current.focus();
event.preventDefault();
}
onMouseDown?.(event);
};
// ========================== Controlled ==========================
// Input by precision & formatter
(0,useLayoutEffect.useLayoutUpdateEffect)(() => {
if (!decimalValue.isInvalidate()) {
setInputValue(decimalValue, false);
}
}, [precision, formatter]);
// Input by value
(0,useLayoutEffect.useLayoutUpdateEffect)(() => {
const newValue = mini_decimal_es(value);
setDecimalValue(newValue);
const currentParsedValue = mini_decimal_es(mergedParser(inputValue));
// When user typing from `1.2` to `1.`, we should not convert to `1` immediately.
// But let it go if user set `formatter`
if (!newValue.equals(currentParsedValue) || !userTypingRef.current || formatter) {
// Update value as effect
setInputValue(newValue, userTypingRef.current);
}
}, [value]);
// ============================ Cursor ============================
(0,useLayoutEffect.useLayoutUpdateEffect)(() => {
if (formatter) {
restoreCursor();
}
}, [inputValue]);
// ============================ Render ============================
// >>>>>> Handler
const sharedHandlerProps = {
prefixCls,
onStep: onInternalStep,
className: classNames?.action,
style: styles?.action
};
const upNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(StepHandler, InputNumber_extends({}, sharedHandlerProps, {
action: "up",
disabled: upDisabled
}), upHandler);
const downNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(StepHandler, InputNumber_extends({}, sharedHandlerProps, {
action: "down",
disabled: downDisabled
}), downHandler);
// >>>>>> Render
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: rootRef,
className: (0,clsx.clsx)(prefixCls, `${prefixCls}-mode-${mode}`, className, classNames?.root, {
[`${prefixCls}-focused`]: focus,
[`${prefixCls}-disabled`]: disabled,
[`${prefixCls}-readonly`]: readOnly,
[`${prefixCls}-not-a-number`]: decimalValue.isNaN(),
[`${prefixCls}-out-of-range`]: !decimalValue.isInvalidate() && !isInRange(decimalValue)
}),
style: {
...styles?.root,
...style
},
onMouseDown: onInternalMouseDown,
onMouseUp: onMouseUp,
onMouseLeave: onMouseLeave,
onMouseMove: onMouseMove,
onMouseEnter: onMouseEnter,
onMouseOut: onMouseOut,
onClick: onClick,
onFocus: () => {
setFocus(true);
},
onBlur: onBlur,
onKeyDown: onKeyDown,
onKeyUp: onKeyUp,
onCompositionStart: onCompositionStart,
onCompositionEnd: onCompositionEnd,
onBeforeInput: onBeforeInput
}, mode === 'spinner' && controls && downNode, prefix !== undefined && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-prefix`, classNames?.prefix),
style: styles?.prefix
}, prefix), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("input", InputNumber_extends({
autoComplete: "off",
role: "spinbutton",
"aria-valuemin": min,
"aria-valuemax": max,
"aria-valuenow": decimalValue.isInvalidate() ? null : decimalValue.toString(),
step: step,
ref: inputRef,
className: (0,clsx.clsx)(`${prefixCls}-input`, classNames?.input),
style: styles?.input,
value: inputValue,
onChange: onInternalInput,
disabled: disabled,
readOnly: readOnly
}, restProps)), suffix !== undefined && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-suffix`, classNames?.suffix),
style: styles?.suffix
}, suffix), mode === 'spinner' && controls && upNode, mode === 'input' && controls && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-actions`, classNames?.actions),
style: styles?.actions
}, upNode, downNode));
});
if (true) {
InputNumber.displayName = 'InputNumber';
}
/* harmony default export */ var es_InputNumber = (InputNumber);
;// ./node_modules/@rc-component/input-number/es/index.js
/* harmony default export */ var input_number_es = (es_InputNumber);
;// ./components/space/style/addon.ts
const genSpaceAddonStyle = token => {
const {
componentCls,
borderRadius,
paddingSM,
colorBorder,
paddingXS,
fontSizeLG,
fontSizeSM,
borderRadiusLG,
borderRadiusSM,
colorBgContainerDisabled,
lineWidth,
antCls
} = token;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'space');
return {
[componentCls]: [
// ==========================================================
// == Base ==
// ==========================================================
{
display: 'inline-flex',
alignItems: 'center',
gap: 0,
whiteSpace: 'nowrap',
paddingInline: paddingSM,
margin: 0,
borderWidth: lineWidth,
borderStyle: 'solid',
borderRadius,
'&:hover': {
zIndex: 0
},
[`&${componentCls}-disabled`]: {
color: token.colorTextDisabled
},
'&-large': {
fontSize: fontSizeLG,
borderRadius: borderRadiusLG
},
'&-small': {
paddingInline: paddingXS,
borderRadius: borderRadiusSM,
fontSize: fontSizeSM
},
'&-compact-last-item': {
borderEndStartRadius: 0,
borderStartStartRadius: 0
},
'&-compact-first-item': {
borderEndEndRadius: 0,
borderStartEndRadius: 0
},
'&-compact-item:not(:first-child):not(:last-child)': {
borderRadius: 0
},
'&-compact-item:not(:last-child)': {
borderInlineEndWidth: 0
},
'&-compact-item:not(:first-child)': {
borderInlineStartWidth: 0
}
},
// ==========================================================
// == Variants ==
// ==========================================================
{
[varName('addon-border-color')]: colorBorder,
[varName('addon-background')]: colorBgContainerDisabled,
// Filled
[varName('addon-border-color-outlined')]: colorBorder,
[varName('addon-background-filled')]: colorBgContainerDisabled,
borderColor: varRef('addon-border-color'),
background: varRef('addon-background'),
// ======================= Outlined =======================
'&-variant-outlined': {
[varName('addon-border-color')]: varRef('addon-border-color-outlined')
},
// ======================== Filled ========================
'&-variant-filled': {
[varName('addon-border-color')]: 'transparent',
[varName('addon-background')]: varRef('addon-background-filled'),
// Disabled
[`&${componentCls}-disabled`]: {
[varName('addon-border-color')]: colorBorder,
[varName('addon-background')]: colorBgContainerDisabled
}
},
// ====================== Borderless ======================
'&-variant-borderless': {
border: 'none',
background: 'transparent'
},
// ====================== Underlined ======================
'&-variant-underlined': {
border: 'none',
background: 'transparent'
}
},
// ==========================================================
// == Status ==
// ==========================================================
{
'&-status-error': {
[varName('addon-border-color-outlined')]: token.colorError,
[varName('addon-background-filled')]: token.colorErrorBg,
color: token.colorError
},
'&-status-warning': {
[varName('addon-border-color-outlined')]: token.colorWarning,
[varName('addon-background-filled')]: token.colorWarningBg,
color: token.colorWarning
}
}]
};
};
// ============================== Export ==============================
/* harmony default export */ var addon = ((0,genStyleUtils.genStyleHooks)(['Space', 'Addon'], token => [genSpaceAddonStyle(token), (0,compact_item.genCompactItemStyle)(token, {
focus: false
})]));
;// ./components/space/Addon.tsx
const SpaceAddon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
className,
children,
style,
prefixCls: customizePrefixCls,
variant = 'outlined',
disabled,
status,
...restProps
} = props;
const {
getPrefixCls,
direction: directionConfig
} = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('space-addon', customizePrefixCls);
const [hashId, cssVarCls] = addon(prefixCls);
const {
compactItemClassnames,
compactSize
} = useCompactItemContext(prefixCls, directionConfig);
const statusCls = getStatusClassNames(prefixCls, status);
const classes = (0,clsx.clsx)(prefixCls, hashId, compactItemClassnames, cssVarCls, `${prefixCls}-variant-${variant}`, statusCls, {
[`${prefixCls}-${compactSize}`]: compactSize,
[`${prefixCls}-disabled`]: disabled
}, className);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
ref: ref,
className: classes,
style: style,
...restProps
}, children);
});
/* harmony default export */ var Addon = (SpaceAddon);
// EXTERNAL MODULE: ./components/input-number/style/index.ts + 1 modules
var input_number_style = __webpack_require__("./components/input-number/style/index.ts");
;// ./components/input-number/index.tsx
const InternalInputNumber = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const inputRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => inputRef.current);
const {
rootClassName,
size: customizeSize,
disabled: customDisabled,
prefixCls,
addonBefore: _addonBefore,
addonAfter: _addonAfter,
prefix,
suffix,
bordered,
readOnly,
status,
controls = true,
variant: customVariant,
className,
style,
classNames,
styles,
mode,
...others
} = props;
const {
direction,
className: contextClassName,
style: contextStyle,
styles: contextStyles,
classNames: contextClassNames
} = (0,config_provider_context.useComponentConfig)('inputNumber');
// ===================== Disabled =====================
const disabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
const mergedDisabled = customDisabled ?? disabled;
// controls && !mergedDisabled && !readOnly;
const mergedControls = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!controls || mergedDisabled || readOnly) {
return false;
}
return controls;
}, [controls, mergedDisabled, readOnly]);
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
let upIcon = mode === 'spinner' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_PlusOutlined, null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_UpOutlined, null);
let downIcon = mode === 'spinner' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_MinusOutlined, null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_DownOutlined, null);
const controlsTemp = typeof mergedControls === 'boolean' ? mergedControls : undefined;
if ((0,is.isPlainObject)(mergedControls)) {
upIcon = mergedControls.upIcon || upIcon;
downIcon = mergedControls.downIcon || downIcon;
}
const {
hasFeedback,
isFormItemInput,
feedbackIcon
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FormItemInputContext);
const mergedSize = (0,useSize["default"])(ctx => customizeSize ?? compactSize ?? ctx);
const [variant, enableVariantCls] = useVariants('inputNumber', customVariant, bordered);
const suffixNode = hasFeedback && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, feedbackIcon);
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
size: mergedSize,
disabled: mergedDisabled,
controls: mergedControls
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(input_number_es, {
ref: inputRef,
mode: mode,
disabled: mergedDisabled,
className: (0,clsx.clsx)(className, rootClassName, mergedClassNames.root, contextClassName, compactItemClassnames, getStatusClassNames(prefixCls, status, hasFeedback), {
[`${prefixCls}-${variant}`]: enableVariantCls,
[`${prefixCls}-lg`]: mergedSize === 'large',
[`${prefixCls}-sm`]: mergedSize === 'small',
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-in-form-item`]: isFormItemInput,
[`${prefixCls}-without-controls`]: !mergedControls
}),
style: {
...mergedStyles.root,
...contextStyle,
...style
},
upHandler: upIcon,
downHandler: downIcon,
prefixCls: prefixCls,
readOnly: readOnly,
controls: controlsTemp,
prefix: prefix,
suffix: suffixNode || suffix,
classNames: mergedClassNames,
styles: mergedStyles,
...others
});
});
// ===================================================================
// == InputNumber ==
// ===================================================================
const input_number_InputNumber = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
addonBefore,
addonAfter,
prefixCls: customizePrefixCls,
className,
status: customStatus,
rootClassName,
...rest
} = props;
const {
getPrefixCls
} = (0,config_provider_context.useComponentConfig)('inputNumber');
const prefixCls = getPrefixCls('input-number', customizePrefixCls);
const {
status: contextStatus
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FormItemInputContext);
const mergedStatus = getMergedStatus(contextStatus, customStatus);
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,input_number_style["default"])(prefixCls, rootCls);
const hasLegacyAddon = addonBefore || addonAfter;
// ======================= Warn =======================
if (true) {
const typeWarning = (0,_util_warning.devUseWarning)('InputNumber');
[['bordered', 'variant'], ['addonAfter', 'Space.Compact'], ['addonBefore', 'Space.Compact']].forEach(([prop, newProp]) => {
typeWarning.deprecated(!(prop in props), prop, newProp);
});
typeWarning(!(props.type === 'number' && props.changeOnWheel), 'usage', 'When `type=number` is used together with `changeOnWheel`, changeOnWheel may not work properly. Please delete `type=number` if it is not necessary.');
}
// ====================== Render ======================
const inputNumberNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(InternalInputNumber, {
ref: ref,
...rest,
prefixCls: prefixCls,
status: mergedStatus,
className: (0,clsx.clsx)(cssVarCls, rootCls, hashId, className),
rootClassName: !hasLegacyAddon ? rootClassName : undefined
});
if (hasLegacyAddon) {
const renderAddon = node => {
if (!node) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Addon, {
className: (0,clsx.clsx)(`${prefixCls}-addon`, cssVarCls, hashId),
variant: props.variant,
disabled: props.disabled,
status: mergedStatus
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(_util_ContextIsolator, {
form: true
}, node));
};
const addonBeforeNode = renderAddon(addonBefore);
const addonAfterNode = renderAddon(addonAfter);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(space_Compact, {
rootClassName: rootClassName
}, addonBeforeNode, inputNumberNode, addonAfterNode);
}
return inputNumberNode;
});
const TypedInputNumber = input_number_InputNumber;
/** @private Internal Component. Do not use in your production. */
const PureInputNumber = props => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(config_provider, {
theme: {
components: {
InputNumber: {
handleVisible: true
}
}
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(input_number_InputNumber, {
...props
})));
if (true) {
InternalInputNumber.displayName = 'InternalInputNumber';
TypedInputNumber.displayName = 'InputNumber';
}
TypedInputNumber._InternalPanelDoNotUseOrYouWillBeFired = PureInputNumber;
/* harmony default export */ var input_number = (TypedInputNumber);
;// ./components/color-picker/components/ColorSteppers.tsx
const ColorSteppers = ({
prefixCls,
min = 0,
max = 100,
value,
onChange,
className,
formatter
}) => {
const colorSteppersPrefixCls = `${prefixCls}-steppers`;
const [internalValue, setInternalValue] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0);
const stepValue = !Number.isNaN(value) ? value : internalValue;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(input_number, {
className: (0,clsx.clsx)(colorSteppersPrefixCls, className),
min: min,
max: max,
value: stepValue,
formatter: formatter,
size: "small",
onChange: step => {
setInternalValue(step || 0);
onChange?.(step);
}
});
};
/* harmony default export */ var components_ColorSteppers = (ColorSteppers);
;// ./components/color-picker/components/ColorAlphaInput.tsx
const ColorAlphaInput = ({
prefixCls,
value,
onChange
}) => {
const colorAlphaInputPrefixCls = `${prefixCls}-alpha-input`;
const [internalValue, setInternalValue] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(() => (0,util.generateColor)(value || '#000'));
const alphaValue = value || internalValue;
const handleAlphaChange = step => {
const hsba = alphaValue.toHsb();
hsba.a = (step || 0) / 100;
const genColor = (0,util.generateColor)(hsba);
setInternalValue(genColor);
onChange?.(genColor);
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_ColorSteppers, {
value: (0,util.getColorAlpha)(alphaValue),
prefixCls: prefixCls,
formatter: step => `${step}%`,
className: colorAlphaInputPrefixCls,
onChange: handleAlphaChange
});
};
/* harmony default export */ var components_ColorAlphaInput = (ColorAlphaInput);
;// ./node_modules/@rc-component/input/es/utils/commonUtils.js
function hasAddon(props) {
return !!(props.addonBefore || props.addonAfter);
}
function hasPrefixSuffix(props) {
return !!(props.prefix || props.suffix || props.allowClear);
}
// TODO: It's better to use `Proxy` replace the `element.value`. But we still need support IE11.
function cloneEvent(event, target, value) {
// A bug report filed on WebKit's Bugzilla tracker, dating back to 2009, specifically addresses the issue of cloneNode() not copying files of elements.
// As of the last update, this bug was still marked as "NEW," indicating that it might not have been resolved yet.
// https://bugs.webkit.org/show_bug.cgi?id=28123
const currentTarget = target.cloneNode(true);
// click clear icon
const newEvent = Object.create(event, {
target: {
value: currentTarget
},
currentTarget: {
value: currentTarget
}
});
// Fill data
currentTarget.value = value;
// Fill selection. Some type like `email` not support selection
// https://github.com/ant-design/ant-design/issues/47833
if (typeof target.selectionStart === 'number' && typeof target.selectionEnd === 'number') {
currentTarget.selectionStart = target.selectionStart;
currentTarget.selectionEnd = target.selectionEnd;
}
currentTarget.setSelectionRange = (...args) => {
target.setSelectionRange(...args);
};
return newEvent;
}
function resolveOnChange(target, e, onChange, targetValue) {
if (!onChange) {
return;
}
let event = e;
if (e.type === 'click') {
// Clone a new target for event.
// Avoid the following usage, the setQuery method gets the original value.
//
// const [query, setQuery] = React.useState('');
// {
// setQuery((prevStatus) => e.target.value);
// }}
// />
event = cloneEvent(e, target, '');
onChange(event);
return;
}
// Trigger by composition event, this means we need force change the input value
// https://github.com/ant-design/ant-design/issues/45737
// https://github.com/ant-design/ant-design/issues/46598
if (target.type !== 'file' && targetValue !== undefined) {
event = cloneEvent(e, target, targetValue);
onChange(event);
return;
}
onChange(event);
}
;// ./node_modules/@rc-component/input/es/BaseInput.js
function BaseInput_extends() { BaseInput_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return BaseInput_extends.apply(this, arguments); }
const BaseInput = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
inputElement: inputEl,
children,
prefixCls,
prefix,
suffix,
addonBefore,
addonAfter,
className,
style,
disabled,
readOnly,
focused,
triggerFocus,
allowClear,
value,
handleReset,
hidden,
classes,
classNames,
dataAttrs,
styles,
components,
onClear
} = props;
const inputElement = children ?? inputEl;
const AffixWrapperComponent = components?.affixWrapper || 'span';
const GroupWrapperComponent = components?.groupWrapper || 'span';
const WrapperComponent = components?.wrapper || 'span';
const GroupAddonComponent = components?.groupAddon || 'span';
const containerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const onInputClick = e => {
if (containerRef.current?.contains(e.target)) {
triggerFocus?.();
}
};
const hasAffix = hasPrefixSuffix(props);
let element = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement)(inputElement, {
value,
className: (0,clsx.clsx)(inputElement.props?.className, !hasAffix && classNames?.variant) || null
});
// ======================== Ref ======================== //
const groupRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useImperativeHandle(ref, () => ({
nativeElement: groupRef.current || containerRef.current
}));
// ================== Prefix & Suffix ================== //
if (hasAffix) {
// ================== Clear Icon ================== //
let clearIcon = null;
if (allowClear) {
const needClear = !disabled && !readOnly && value;
const clearIconCls = `${prefixCls}-clear-icon`;
const iconNode = typeof allowClear === 'object' && allowClear?.clearIcon ? allowClear.clearIcon : '✖';
clearIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
type: "button",
tabIndex: -1,
onClick: event => {
handleReset?.(event);
onClear?.();
}
// Do not trigger onBlur when clear input
// https://github.com/ant-design/ant-design/issues/31200
,
onMouseDown: e => e.preventDefault(),
className: (0,clsx.clsx)(clearIconCls, {
[`${clearIconCls}-hidden`]: !needClear,
[`${clearIconCls}-has-suffix`]: !!suffix
})
}, iconNode);
}
const affixWrapperPrefixCls = `${prefixCls}-affix-wrapper`;
const affixWrapperCls = (0,clsx.clsx)(affixWrapperPrefixCls, {
[`${prefixCls}-disabled`]: disabled,
[`${affixWrapperPrefixCls}-disabled`]: disabled,
// Not used, but keep it
[`${affixWrapperPrefixCls}-focused`]: focused,
// Not used, but keep it
[`${affixWrapperPrefixCls}-readonly`]: readOnly,
[`${affixWrapperPrefixCls}-input-with-clear-btn`]: suffix && allowClear && value
}, classes?.affixWrapper, classNames?.affixWrapper, classNames?.variant);
const suffixNode = (suffix || allowClear) && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}-suffix`, classNames?.suffix),
style: styles?.suffix
}, clearIcon, suffix);
element = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(AffixWrapperComponent, BaseInput_extends({
className: affixWrapperCls,
style: styles?.affixWrapper,
onClick: onInputClick
}, dataAttrs?.affixWrapper, {
ref: containerRef
}), prefix && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}-prefix`, classNames?.prefix),
style: styles?.prefix
}, prefix), element, suffixNode);
}
// ================== Addon ================== //
if (hasAddon(props)) {
const wrapperCls = `${prefixCls}-group`;
const addonCls = `${wrapperCls}-addon`;
const groupWrapperCls = `${wrapperCls}-wrapper`;
const mergedWrapperClassName = (0,clsx.clsx)(`${prefixCls}-wrapper`, wrapperCls, classes?.wrapper, classNames?.wrapper);
const mergedGroupClassName = (0,clsx.clsx)(groupWrapperCls, {
[`${groupWrapperCls}-disabled`]: disabled
}, classes?.group, classNames?.groupWrapper);
// Need another wrapper for changing display:table to display:inline-block
// and put style prop in wrapper
element = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(GroupWrapperComponent, {
className: mergedGroupClassName,
ref: groupRef
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(WrapperComponent, {
className: mergedWrapperClassName
}, addonBefore && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(GroupAddonComponent, {
className: addonCls
}, addonBefore), element, addonAfter && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(GroupAddonComponent, {
className: addonCls
}, addonAfter)));
}
// `className` and `style` are always on the root element
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(element, {
className: (0,clsx.clsx)(element.props?.className, className) || null,
style: {
...element.props?.style,
...style
},
hidden
});
});
/* harmony default export */ var es_BaseInput = (BaseInput);
;// ./node_modules/@rc-component/input/es/hooks/useCount.js
/**
* Cut `value` by the `count.max` prop.
*/
function inCountRange(value, countConfig) {
if (!countConfig.max) {
return true;
}
const count = countConfig.strategy(value);
return count <= countConfig.max;
}
function useCount(count, showCount) {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
let mergedConfig = {};
if (showCount) {
mergedConfig.show = typeof showCount === 'object' && showCount.formatter ? showCount.formatter : !!showCount;
}
mergedConfig = {
...mergedConfig,
...count
};
const {
show,
...rest
} = mergedConfig;
return {
...rest,
show: !!show,
showFormatter: typeof show === 'function' ? show : undefined,
strategy: rest.strategy || (value => value.length)
};
}, [count, showCount]);
}
;// ./node_modules/@rc-component/input/es/Input.js
function es_Input_extends() { es_Input_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return es_Input_extends.apply(this, arguments); }
const es_Input_Input = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((props, ref) => {
const {
autoComplete,
onChange,
onFocus,
onBlur,
onPressEnter,
onKeyDown,
onKeyUp,
prefixCls = 'rc-input',
disabled,
htmlSize,
className,
maxLength,
suffix,
showCount,
count,
type = 'text',
classes,
classNames,
styles,
onCompositionStart,
onCompositionEnd,
...rest
} = props;
const [focused, setFocused] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
const compositionRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
const keyLockRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
const inputRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const holderRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const focus = option => {
if (inputRef.current) {
triggerFocus(inputRef.current, option);
}
};
// ====================== Value =======================
const [value, setValue] = (0,useControlledState["default"])(props.defaultValue, props.value);
const formatValue = value === undefined || value === null ? '' : String(value);
// =================== Select Range ===================
const [selection, setSelection] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null);
// ====================== Count =======================
const countConfig = useCount(count, showCount);
const mergedMax = countConfig.max || maxLength;
const valueLength = countConfig.strategy(formatValue);
const isOutOfRange = !!mergedMax && valueLength > mergedMax;
// ======================= Ref ========================
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref, () => ({
focus,
blur: () => {
inputRef.current?.blur();
},
setSelectionRange: (start, end, direction) => {
inputRef.current?.setSelectionRange(start, end, direction);
},
select: () => {
inputRef.current?.select();
},
input: inputRef.current,
nativeElement: holderRef.current?.nativeElement || inputRef.current
}));
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (keyLockRef.current) {
keyLockRef.current = false;
}
setFocused(prev => prev && disabled ? false : prev);
}, [disabled]);
const triggerChange = (e, currentValue, info) => {
let cutValue = currentValue;
if (!compositionRef.current && countConfig.exceedFormatter && countConfig.max && countConfig.strategy(currentValue) > countConfig.max) {
cutValue = countConfig.exceedFormatter(currentValue, {
max: countConfig.max
});
if (currentValue !== cutValue) {
setSelection([inputRef.current?.selectionStart || 0, inputRef.current?.selectionEnd || 0]);
}
} else if (info.source === 'compositionEnd') {
// Avoid triggering twice
// https://github.com/ant-design/ant-design/issues/46587
return;
}
setValue(cutValue);
if (inputRef.current) {
resolveOnChange(inputRef.current, e, onChange, cutValue);
}
};
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (selection) {
inputRef.current?.setSelectionRange(...selection);
}
}, [selection]);
const onInternalChange = e => {
triggerChange(e, e.target.value, {
source: 'change'
});
};
const onInternalCompositionEnd = e => {
compositionRef.current = false;
triggerChange(e, e.currentTarget.value, {
source: 'compositionEnd'
});
onCompositionEnd?.(e);
};
const handleKeyDown = e => {
if (onPressEnter && e.key === 'Enter' && !keyLockRef.current && !e.nativeEvent.isComposing) {
keyLockRef.current = true;
onPressEnter(e);
}
onKeyDown?.(e);
};
const handleKeyUp = e => {
if (e.key === 'Enter') {
keyLockRef.current = false;
}
onKeyUp?.(e);
};
const handleFocus = e => {
setFocused(true);
onFocus?.(e);
};
const handleBlur = e => {
if (keyLockRef.current) {
keyLockRef.current = false;
}
setFocused(false);
onBlur?.(e);
};
const handleReset = e => {
setValue('');
focus();
if (inputRef.current) {
resolveOnChange(inputRef.current, e, onChange);
}
};
// ====================== Input =======================
const outOfRangeCls = isOutOfRange && `${prefixCls}-out-of-range`;
const getInputElement = () => {
// Fix https://fb.me/react-unknown-prop
const otherProps = (0,omit["default"])(props, ['prefixCls', 'onPressEnter', 'addonBefore', 'addonAfter', 'prefix', 'suffix', 'allowClear',
// Input elements must be either controlled or uncontrolled,
// specify either the value prop, or the defaultValue prop, but not both.
'defaultValue', 'showCount', 'count', 'classes', 'htmlSize', 'styles', 'classNames', 'onClear']);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", es_Input_extends({
autoComplete: autoComplete
}, otherProps, {
onChange: onInternalChange,
onFocus: handleFocus,
onBlur: handleBlur,
onKeyDown: handleKeyDown,
onKeyUp: handleKeyUp,
className: (0,clsx.clsx)(prefixCls, {
[`${prefixCls}-disabled`]: disabled
}, classNames?.input),
style: styles?.input,
ref: inputRef,
size: htmlSize,
type: type,
onCompositionStart: e => {
compositionRef.current = true;
onCompositionStart?.(e);
},
onCompositionEnd: onInternalCompositionEnd
}));
};
const getSuffix = () => {
// Max length value
const hasMaxLength = Number(mergedMax) > 0;
if (suffix || countConfig.show) {
const dataCount = countConfig.showFormatter ? countConfig.showFormatter({
value: formatValue,
count: valueLength,
maxLength: mergedMax
}) : `${valueLength}${hasMaxLength ? ` / ${mergedMax}` : ''}`;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, countConfig.show && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}-show-count-suffix`, {
[`${prefixCls}-show-count-has-suffix`]: !!suffix
}, classNames?.count),
style: {
...styles?.count
}
}, dataCount), suffix);
}
return null;
};
// ====================== Render ======================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_BaseInput, es_Input_extends({}, rest, {
prefixCls: prefixCls,
className: (0,clsx.clsx)(className, outOfRangeCls),
handleReset: handleReset,
value: formatValue,
focused: focused,
triggerFocus: focus,
suffix: getSuffix(),
disabled: disabled,
classes: classes,
classNames: classNames,
styles: styles,
ref: holderRef
}), getInputElement());
});
/* harmony default export */ var es_Input = (es_Input_Input);
;// ./node_modules/@rc-component/input/es/index.js
/* harmony default export */ var input_es = (es_Input);
;// ./components/_util/getAllowClear.tsx
const getAllowClear = allowClear => {
let mergedAllowClear;
if ((0,is.isPlainObject)(allowClear) && allowClear?.clearIcon) {
mergedAllowClear = allowClear;
} else if (allowClear) {
mergedAllowClear = {
clearIcon: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_CloseCircleFilled, null)
};
}
return mergedAllowClear;
};
/* harmony default export */ var _util_getAllowClear = (getAllowClear);
;// ./components/input/hooks/useRemovePasswordTimeout.ts
function useRemovePasswordTimeout(inputRef, triggerOnMount) {
const removePasswordTimeoutRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)([]);
const removePasswordTimeout = () => {
removePasswordTimeoutRef.current.push(setTimeout(() => {
if (inputRef.current?.input && inputRef.current?.input.getAttribute('type') === 'password' && inputRef.current?.input.hasAttribute('value')) {
inputRef.current?.input.removeAttribute('value');
}
}));
};
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (triggerOnMount) {
removePasswordTimeout();
}
return () => removePasswordTimeoutRef.current.forEach(timer => {
if (timer) {
clearTimeout(timer);
}
});
}, []);
return removePasswordTimeout;
}
// EXTERNAL MODULE: ./components/input/style/index.ts
var input_style = __webpack_require__("./components/input/style/index.ts");
;// ./components/input/utils.ts
function utils_hasPrefixSuffix(props) {
return !!(props.prefix || props.suffix || props.allowClear || props.showCount);
}
;// ./components/input/Input.tsx
const input_Input_Input = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((props, ref) => {
const {
prefixCls: customizePrefixCls,
bordered = true,
status: customStatus,
size: customSize,
disabled: customDisabled,
onBlur,
onFocus,
suffix,
allowClear,
addonAfter,
addonBefore,
className,
style,
styles,
rootClassName,
onChange,
classNames,
variant: customVariant,
...rest
} = props;
if (true) {
const {
deprecated
} = (0,_util_warning.devUseWarning)('Input');
[['bordered', 'variant'], ['addonAfter', 'Space.Compact'], ['addonBefore', 'Space.Compact']].forEach(([prop, newProp]) => {
deprecated(!(prop in props), prop, newProp);
});
}
const {
getPrefixCls,
direction,
allowClear: contextAllowClear,
autoComplete: contextAutoComplete,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('input');
const prefixCls = getPrefixCls('input', customizePrefixCls);
const inputRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
// Style
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,input_style.useSharedStyle)(prefixCls, rootClassName);
(0,input_style["default"])(prefixCls, rootCls);
// ===================== Compact Item =====================
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
// ===================== Size =====================
const mergedSize = (0,useSize["default"])(ctx => customSize ?? compactSize ?? ctx);
// ===================== Disabled =====================
const disabled = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(config_provider_DisabledContext);
const mergedDisabled = customDisabled ?? disabled;
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
size: mergedSize,
disabled: mergedDisabled
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
// ===================== Status =====================
const {
status: contextStatus,
hasFeedback,
feedbackIcon
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(FormItemInputContext);
const mergedStatus = getMergedStatus(contextStatus, customStatus);
// ===================== Focus warning =====================
const inputHasPrefixSuffix = utils_hasPrefixSuffix(props) || !!hasFeedback;
const prevHasPrefixSuffixRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(inputHasPrefixSuffix);
/* eslint-disable react-hooks/rules-of-hooks */
if (true) {
const warning = (0,_util_warning.devUseWarning)('Input');
// biome-ignore lint/correctness/useHookAtTopLevel: Development-only warning hook called conditionally
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (inputHasPrefixSuffix && !prevHasPrefixSuffixRef.current) {
true ? warning(document.activeElement === inputRef.current?.input, 'usage', `When Input is focused, dynamic add or remove prefix / suffix will make it lose focus caused by dom structure change. Read more: https://ant.design/components/input/#FAQ`) : 0;
}
prevHasPrefixSuffixRef.current = inputHasPrefixSuffix;
}, [inputHasPrefixSuffix]);
}
/* eslint-enable */
// ===================== Remove Password value =====================
const removePasswordTimeout = useRemovePasswordTimeout(inputRef, true);
const handleBlur = e => {
removePasswordTimeout();
onBlur?.(e);
};
const handleFocus = e => {
removePasswordTimeout();
onFocus?.(e);
};
const handleChange = e => {
removePasswordTimeout();
onChange?.(e);
};
const suffixNode = (hasFeedback || suffix) && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, suffix, hasFeedback && feedbackIcon));
const mergedAllowClear = _util_getAllowClear(allowClear ?? contextAllowClear);
const [variant, enableVariantCls] = useVariants('input', customVariant, bordered);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(input_es, {
ref: (0,es_ref.composeRef)(ref, inputRef),
prefixCls: prefixCls,
autoComplete: contextAutoComplete,
...rest,
disabled: mergedDisabled,
onBlur: handleBlur,
onFocus: handleFocus,
style: {
...mergedStyles.root,
...contextStyle,
...style
},
styles: mergedStyles,
suffix: suffixNode,
allowClear: mergedAllowClear,
className: (0,clsx.clsx)(className, rootClassName, cssVarCls, rootCls, compactItemClassnames, contextClassName, mergedClassNames.root),
onChange: handleChange,
addonBefore: addonBefore && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(_util_ContextIsolator, {
form: true,
space: true
}, addonBefore)),
addonAfter: addonAfter && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(_util_ContextIsolator, {
form: true,
space: true
}, addonAfter)),
classNames: {
...mergedClassNames,
input: (0,clsx.clsx)({
[`${prefixCls}-sm`]: mergedSize === 'small',
[`${prefixCls}-lg`]: mergedSize === 'large',
[`${prefixCls}-rtl`]: direction === 'rtl'
}, mergedClassNames.input, hashId),
variant: (0,clsx.clsx)({
[`${prefixCls}-${variant}`]: enableVariantCls
}, getStatusClassNames(prefixCls, mergedStatus)),
affixWrapper: (0,clsx.clsx)({
[`${prefixCls}-affix-wrapper-sm`]: mergedSize === 'small',
[`${prefixCls}-affix-wrapper-lg`]: mergedSize === 'large',
[`${prefixCls}-affix-wrapper-rtl`]: direction === 'rtl'
}, hashId),
wrapper: (0,clsx.clsx)({
[`${prefixCls}-group-rtl`]: direction === 'rtl'
}, hashId),
groupWrapper: (0,clsx.clsx)({
[`${prefixCls}-group-wrapper-sm`]: mergedSize === 'small',
[`${prefixCls}-group-wrapper-lg`]: mergedSize === 'large',
[`${prefixCls}-group-wrapper-rtl`]: direction === 'rtl',
[`${prefixCls}-group-wrapper-${variant}`]: enableVariantCls
}, getStatusClassNames(`${prefixCls}-group-wrapper`, mergedStatus, hasFeedback), hashId)
}
});
});
if (true) {
input_Input_Input.displayName = 'Input';
}
/* harmony default export */ var input_Input = (input_Input_Input);
;// ./components/color-picker/components/ColorHexInput.tsx
const hexReg = /(^#[\da-f]{6}$)|(^#[\da-f]{8}$)/i;
const isHexString = hex => hexReg.test(`#${hex}`);
const ColorHexInput = ({
prefixCls,
value,
onChange
}) => {
const colorHexInputPrefixCls = `${prefixCls}-hex-input`;
const [hexValue, setHexValue] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(() => value ? (0,color.toHexFormat)(value.toHexString()) : undefined);
// Update step value
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (value) {
setHexValue((0,color.toHexFormat)(value.toHexString()));
}
}, [value]);
const handleHexChange = e => {
const originValue = e.target.value;
setHexValue((0,color.toHexFormat)(originValue));
if (isHexString((0,color.toHexFormat)(originValue, true))) {
onChange?.((0,util.generateColor)(originValue));
}
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(input_Input, {
className: colorHexInputPrefixCls,
value: hexValue,
prefix: "#",
onChange: handleHexChange,
size: "small"
});
};
/* harmony default export */ var components_ColorHexInput = (ColorHexInput);
;// ./components/color-picker/components/ColorHsbInput.tsx
const ColorHsbInput = ({
prefixCls,
value,
onChange
}) => {
const colorHsbInputPrefixCls = `${prefixCls}-hsb-input`;
const [internalValue, setInternalValue] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(() => (0,util.generateColor)(value || '#000'));
const hsbValue = value || internalValue;
const handleHsbChange = (step, type) => {
const hsb = hsbValue.toHsb();
hsb[type] = type === 'h' ? step : (step || 0) / 100;
const genColor = (0,util.generateColor)(hsb);
setInternalValue(genColor);
onChange?.(genColor);
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: colorHsbInputPrefixCls
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_ColorSteppers, {
max: 360,
min: 0,
value: Number(hsbValue.toHsb().h),
prefixCls: prefixCls,
className: colorHsbInputPrefixCls,
formatter: step => (0,util.getRoundNumber)(step || 0).toString(),
onChange: step => handleHsbChange(Number(step), 'h')
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_ColorSteppers, {
max: 100,
min: 0,
value: Number(hsbValue.toHsb().s) * 100,
prefixCls: prefixCls,
className: colorHsbInputPrefixCls,
formatter: step => `${(0,util.getRoundNumber)(step || 0)}%`,
onChange: step => handleHsbChange(Number(step), 's')
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_ColorSteppers, {
max: 100,
min: 0,
value: Number(hsbValue.toHsb().b) * 100,
prefixCls: prefixCls,
className: colorHsbInputPrefixCls,
formatter: step => `${(0,util.getRoundNumber)(step || 0)}%`,
onChange: step => handleHsbChange(Number(step), 'b')
}));
};
/* harmony default export */ var components_ColorHsbInput = (ColorHsbInput);
;// ./components/color-picker/components/ColorRgbInput.tsx
const ColorRgbInput = ({
prefixCls,
value,
onChange
}) => {
const colorRgbInputPrefixCls = `${prefixCls}-rgb-input`;
const [internalValue, setInternalValue] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(() => (0,util.generateColor)(value || '#000'));
const rgbValue = value || internalValue;
const handleRgbChange = (step, type) => {
const rgb = rgbValue.toRgb();
rgb[type] = step || 0;
const genColor = (0,util.generateColor)(rgb);
setInternalValue(genColor);
onChange?.(genColor);
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: colorRgbInputPrefixCls
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_ColorSteppers, {
max: 255,
min: 0,
value: Number(rgbValue.toRgb().r),
prefixCls: prefixCls,
className: colorRgbInputPrefixCls,
onChange: step => handleRgbChange(Number(step), 'r')
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_ColorSteppers, {
max: 255,
min: 0,
value: Number(rgbValue.toRgb().g),
prefixCls: prefixCls,
className: colorRgbInputPrefixCls,
onChange: step => handleRgbChange(Number(step), 'g')
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_ColorSteppers, {
max: 255,
min: 0,
value: Number(rgbValue.toRgb().b),
prefixCls: prefixCls,
className: colorRgbInputPrefixCls,
onChange: step => handleRgbChange(Number(step), 'b')
}));
};
/* harmony default export */ var components_ColorRgbInput = (ColorRgbInput);
;// ./components/color-picker/components/ColorInput.tsx
const selectOptions = [FORMAT_HEX, FORMAT_HSB, FORMAT_RGB].map(format => ({
value: format,
label: format.toUpperCase()
}));
const ColorInput = props => {
const {
prefixCls,
format,
value,
disabledAlpha,
onFormatChange,
onChange,
disabledFormat
} = props;
const [colorFormat, setColorFormat] = (0,es.useControlledState)(FORMAT_HEX, format);
const colorInputPrefixCls = `${prefixCls}-input`;
const triggerFormatChange = newFormat => {
setColorFormat(newFormat);
onFormatChange?.(newFormat);
};
const steppersNode = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
const inputProps = {
value,
prefixCls,
onChange
};
switch (colorFormat) {
case FORMAT_HSB:
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_ColorHsbInput, {
...inputProps
});
case FORMAT_RGB:
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_ColorRgbInput, {
...inputProps
});
// case FORMAT_HEX:
default:
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_ColorHexInput, {
...inputProps
});
}
}, [colorFormat, prefixCls, value, onChange]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${colorInputPrefixCls}-container`
}, !disabledFormat && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_select, {
value: colorFormat,
variant: "borderless",
getPopupContainer: current => current,
popupMatchSelectWidth: 68,
placement: "bottomRight",
onChange: triggerFormatChange,
className: `${prefixCls}-format-select`,
size: "small",
options: selectOptions
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: colorInputPrefixCls
}, steppersNode), !disabledAlpha && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_ColorAlphaInput, {
prefixCls: prefixCls,
value: value,
onChange: onChange
})));
};
/* harmony default export */ var components_ColorInput = (ColorInput);
;// ./node_modules/@rc-component/slider/es/util.js
function util_getOffset(value, min, max) {
return (value - min) / (max - min);
}
function getDirectionStyle(direction, value, min, max) {
const offset = util_getOffset(value, min, max);
const positionStyle = {};
switch (direction) {
case 'rtl':
positionStyle.right = `${offset * 100}%`;
positionStyle.transform = 'translateX(50%)';
break;
case 'btt':
positionStyle.bottom = `${offset * 100}%`;
positionStyle.transform = 'translateY(50%)';
break;
case 'ttb':
positionStyle.top = `${offset * 100}%`;
positionStyle.transform = 'translateY(-50%)';
break;
default:
positionStyle.left = `${offset * 100}%`;
positionStyle.transform = 'translateX(-50%)';
break;
}
return positionStyle;
}
/** Return index value if is list or return value directly */
function getIndex(value, index) {
return Array.isArray(value) ? value[index] : value;
}
;// ./node_modules/@rc-component/slider/es/context.js
const SliderContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({
min: 0,
max: 0,
direction: 'ltr',
step: 1,
includedStart: 0,
includedEnd: 0,
tabIndex: 0,
keyboard: true,
styles: {},
classNames: {}
});
/* harmony default export */ var slider_es_context = (SliderContext);
/** @private NOT PROMISE AVAILABLE. DO NOT USE IN PRODUCTION. */
const UnstableContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({});
;// ./node_modules/@rc-component/slider/es/Handles/Handle.js
function Handle_extends() { Handle_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Handle_extends.apply(this, arguments); }
const Handle = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls,
value,
valueIndex,
onStartMove,
onDelete,
style,
render,
dragging,
draggingDelete,
onOffsetChange,
onChangeComplete,
onFocus,
onMouseEnter,
...restProps
} = props;
const {
min,
max,
direction,
disabled,
keyboard,
range,
tabIndex,
ariaLabelForHandle,
ariaLabelledByForHandle,
ariaRequired,
ariaValueTextFormatterForHandle,
styles,
classNames
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(slider_es_context);
const handlePrefixCls = `${prefixCls}-handle`;
// ============================ Events ============================
const onInternalStartMove = e => {
if (!disabled) {
onStartMove(e, valueIndex);
}
};
const onInternalFocus = e => {
onFocus?.(e, valueIndex);
};
const onInternalMouseEnter = e => {
onMouseEnter(e, valueIndex);
};
// =========================== Keyboard ===========================
const onKeyDown = e => {
if (!disabled && keyboard) {
let offset = null;
// Change the value
switch (e.which || e.keyCode) {
case KeyCode["default"].LEFT:
offset = direction === 'ltr' || direction === 'btt' ? -1 : 1;
break;
case KeyCode["default"].RIGHT:
offset = direction === 'ltr' || direction === 'btt' ? 1 : -1;
break;
// Up is plus
case KeyCode["default"].UP:
offset = direction !== 'ttb' ? 1 : -1;
break;
// Down is minus
case KeyCode["default"].DOWN:
offset = direction !== 'ttb' ? -1 : 1;
break;
case KeyCode["default"].HOME:
offset = 'min';
break;
case KeyCode["default"].END:
offset = 'max';
break;
case KeyCode["default"].PAGE_UP:
offset = 2;
break;
case KeyCode["default"].PAGE_DOWN:
offset = -2;
break;
case KeyCode["default"].BACKSPACE:
case KeyCode["default"].DELETE:
onDelete?.(valueIndex);
break;
}
if (offset !== null) {
e.preventDefault();
onOffsetChange(offset, valueIndex);
}
}
};
const handleKeyUp = e => {
switch (e.which || e.keyCode) {
case KeyCode["default"].LEFT:
case KeyCode["default"].RIGHT:
case KeyCode["default"].UP:
case KeyCode["default"].DOWN:
case KeyCode["default"].HOME:
case KeyCode["default"].END:
case KeyCode["default"].PAGE_UP:
case KeyCode["default"].PAGE_DOWN:
onChangeComplete?.();
break;
}
};
// ============================ Offset ============================
const positionStyle = getDirectionStyle(direction, value, min, max);
// ============================ Render ============================
let divProps = {};
if (valueIndex !== null) {
divProps = {
tabIndex: disabled ? null : getIndex(tabIndex, valueIndex),
role: 'slider',
'aria-valuemin': min,
'aria-valuemax': max,
'aria-valuenow': value,
'aria-disabled': disabled,
'aria-label': getIndex(ariaLabelForHandle, valueIndex),
'aria-labelledby': getIndex(ariaLabelledByForHandle, valueIndex),
'aria-required': getIndex(ariaRequired, valueIndex),
'aria-valuetext': getIndex(ariaValueTextFormatterForHandle, valueIndex)?.(value),
'aria-orientation': direction === 'ltr' || direction === 'rtl' ? 'horizontal' : 'vertical',
onMouseDown: onInternalStartMove,
onTouchStart: onInternalStartMove,
onFocus: onInternalFocus,
onMouseEnter: onInternalMouseEnter,
onKeyDown,
onKeyUp: handleKeyUp
};
}
let handleNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", Handle_extends({
ref: ref,
className: (0,clsx.clsx)(handlePrefixCls, {
[`${handlePrefixCls}-${valueIndex + 1}`]: valueIndex !== null && range,
[`${handlePrefixCls}-dragging`]: dragging,
[`${handlePrefixCls}-dragging-delete`]: draggingDelete
}, classNames.handle),
style: {
...positionStyle,
...style,
...styles.handle
}
}, divProps, restProps));
// Customize
if (render) {
handleNode = render(handleNode, {
index: valueIndex,
prefixCls,
value,
dragging,
draggingDelete
});
}
return handleNode;
});
if (true) {
Handle.displayName = 'Handle';
}
/* harmony default export */ var Handles_Handle = (Handle);
;// ./node_modules/@rc-component/slider/es/Handles/index.js
function Handles_extends() { Handles_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Handles_extends.apply(this, arguments); }
const Handles = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls,
style,
onStartMove,
onOffsetChange,
values,
handleRender,
activeHandleRender,
draggingIndex,
draggingDelete,
onFocus,
...restProps
} = props;
const handlesRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({});
// =========================== Active ===========================
const [activeVisible, setActiveVisible] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const [activeIndex, setActiveIndex] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(-1);
const onActive = index => {
setActiveIndex(index);
setActiveVisible(true);
};
const onHandleFocus = (e, index) => {
onActive(index);
onFocus?.(e);
};
const onHandleMouseEnter = (e, index) => {
onActive(index);
};
// =========================== Render ===========================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
focus: index => {
handlesRef.current[index]?.focus();
},
hideHelp: () => {
(0,external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_.flushSync)(() => {
setActiveVisible(false);
});
}
}));
// =========================== Render ===========================
// Handle Props
const handleProps = {
prefixCls,
onStartMove,
onOffsetChange,
render: handleRender,
onFocus: onHandleFocus,
onMouseEnter: onHandleMouseEnter,
...restProps
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, values.map((value, index) => {
const dragging = draggingIndex === index;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Handles_Handle, Handles_extends({
ref: node => {
if (!node) {
delete handlesRef.current[index];
} else {
handlesRef.current[index] = node;
}
},
dragging: dragging,
draggingDelete: dragging && draggingDelete,
style: getIndex(style, index),
key: index,
value: value,
valueIndex: index
}, handleProps));
}), activeHandleRender && activeVisible && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Handles_Handle, Handles_extends({
key: "a11y"
}, handleProps, {
value: values[activeIndex],
valueIndex: null,
dragging: draggingIndex !== -1,
draggingDelete: draggingDelete,
render: activeHandleRender,
style: {
pointerEvents: 'none'
},
tabIndex: null,
"aria-hidden": true
})));
});
if (true) {
Handles.displayName = 'Handles';
}
/* harmony default export */ var es_Handles = (Handles);
;// ./node_modules/@rc-component/slider/es/Marks/Mark.js
const Mark = props => {
const {
prefixCls,
style,
children,
value,
onClick
} = props;
const {
min,
max,
direction,
includedStart,
includedEnd,
included
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(slider_es_context);
const textCls = `${prefixCls}-text`;
// ============================ Offset ============================
const positionStyle = getDirectionStyle(direction, value, min, max);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(textCls, {
[`${textCls}-active`]: included && includedStart <= value && value <= includedEnd
}),
style: {
...positionStyle,
...style
},
onMouseDown: e => {
e.stopPropagation();
},
onClick: () => {
onClick(value);
}
}, children);
};
/* harmony default export */ var Marks_Mark = (Mark);
;// ./node_modules/@rc-component/slider/es/Marks/index.js
const Marks = props => {
const {
prefixCls,
marks,
onClick
} = props;
const markPrefixCls = `${prefixCls}-mark`;
// Not render mark if empty
if (!marks.length) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: markPrefixCls
}, marks.map(({
value,
style,
label
}) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Marks_Mark, {
key: value,
prefixCls: markPrefixCls,
style: style,
value: value,
onClick: onClick
}, label)));
};
/* harmony default export */ var es_Marks = (Marks);
;// ./node_modules/@rc-component/slider/es/Steps/Dot.js
const Dot = props => {
const {
prefixCls,
value,
style,
activeStyle
} = props;
const {
min,
max,
direction,
included,
includedStart,
includedEnd
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(slider_es_context);
const dotClassName = `${prefixCls}-dot`;
const active = included && includedStart <= value && value <= includedEnd;
// ============================ Offset ============================
let mergedStyle = {
...getDirectionStyle(direction, value, min, max),
...(typeof style === 'function' ? style(value) : style)
};
if (active) {
mergedStyle = {
...mergedStyle,
...(typeof activeStyle === 'function' ? activeStyle(value) : activeStyle)
};
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(dotClassName, {
[`${dotClassName}-active`]: active
}),
style: mergedStyle
});
};
/* harmony default export */ var Steps_Dot = (Dot);
;// ./node_modules/@rc-component/slider/es/Steps/index.js
const Steps = props => {
const {
prefixCls,
marks,
dots,
style,
activeStyle
} = props;
const {
min,
max,
step
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(slider_es_context);
const stepDots = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const dotSet = new Set();
// Add marks
marks.forEach(mark => {
dotSet.add(mark.value);
});
// Fill dots
if (dots && step !== null) {
let current = min;
while (current <= max) {
dotSet.add(current);
current += step;
}
}
return Array.from(dotSet);
}, [min, max, step, dots, marks]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-step`
}, stepDots.map(dotValue => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Steps_Dot, {
prefixCls: prefixCls,
key: dotValue,
value: dotValue,
style: style,
activeStyle: activeStyle
})));
};
/* harmony default export */ var es_Steps = (Steps);
;// ./node_modules/@rc-component/slider/es/Tracks/Track.js
const Track_Track = props => {
const {
prefixCls,
style,
start,
end,
index,
onStartMove,
replaceCls
} = props;
const {
direction,
min,
max,
disabled,
range,
classNames
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(slider_es_context);
const trackPrefixCls = `${prefixCls}-track`;
const offsetStart = util_getOffset(start, min, max);
const offsetEnd = util_getOffset(end, min, max);
// ============================ Events ============================
const onInternalStartMove = e => {
if (!disabled && onStartMove) {
onStartMove(e, -1);
}
};
// ============================ Render ============================
const positionStyle = {};
switch (direction) {
case 'rtl':
positionStyle.right = `${offsetStart * 100}%`;
positionStyle.width = `${offsetEnd * 100 - offsetStart * 100}%`;
break;
case 'btt':
positionStyle.bottom = `${offsetStart * 100}%`;
positionStyle.height = `${offsetEnd * 100 - offsetStart * 100}%`;
break;
case 'ttb':
positionStyle.top = `${offsetStart * 100}%`;
positionStyle.height = `${offsetEnd * 100 - offsetStart * 100}%`;
break;
default:
positionStyle.left = `${offsetStart * 100}%`;
positionStyle.width = `${offsetEnd * 100 - offsetStart * 100}%`;
}
const className = replaceCls || (0,clsx.clsx)(trackPrefixCls, {
[`${trackPrefixCls}-${index + 1}`]: index !== null && range,
[`${prefixCls}-track-draggable`]: onStartMove
}, classNames.track);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: className,
style: {
...positionStyle,
...style
},
onMouseDown: onInternalStartMove,
onTouchStart: onInternalStartMove
});
};
/* harmony default export */ var Tracks_Track = (Track_Track);
;// ./node_modules/@rc-component/slider/es/Tracks/index.js
const Tracks = props => {
const {
prefixCls,
style,
values,
startPoint,
onStartMove
} = props;
const {
included,
range,
min,
styles,
classNames
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(slider_es_context);
// =========================== List ===========================
const trackList = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!range) {
// null value do not have track
if (values.length === 0) {
return [];
}
const startValue = startPoint ?? min;
const endValue = values[0];
return [{
start: Math.min(startValue, endValue),
end: Math.max(startValue, endValue)
}];
}
// Multiple
const list = [];
for (let i = 0; i < values.length - 1; i += 1) {
list.push({
start: values[i],
end: values[i + 1]
});
}
return list;
}, [values, range, startPoint, min]);
if (!included) {
return null;
}
// ========================== Render ==========================
const tracksNode = trackList?.length && (classNames.tracks || styles.tracks) ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Tracks_Track, {
index: null,
prefixCls: prefixCls,
start: trackList[0].start,
end: trackList[trackList.length - 1].end,
replaceCls: (0,clsx.clsx)(classNames.tracks, `${prefixCls}-tracks`),
style: styles.tracks
}) : null;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, tracksNode, trackList.map(({
start,
end
}, index) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Tracks_Track, {
index: index,
prefixCls: prefixCls,
style: {
...getIndex(style, index),
...styles.track
},
start: start,
end: end,
key: index,
onStartMove: onStartMove
})));
};
/* harmony default export */ var es_Tracks = (Tracks);
;// ./node_modules/@rc-component/slider/es/hooks/useDrag.js
/** Drag to delete offset. It's a user experience number for dragging out */
const REMOVE_DIST = 130;
function useDrag_getPosition(e) {
const obj = 'targetTouches' in e ? e.targetTouches[0] : e;
return {
pageX: obj.pageX,
pageY: obj.pageY
};
}
function useDrag(containerRef, direction, rawValues, min, max, formatValue, triggerChange, finishChange, offsetValues, editable, minCount) {
const [draggingValue, setDraggingValue] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
const [draggingIndex, setDraggingIndex] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(-1);
const [draggingDelete, setDraggingDelete] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const [cacheValues, setCacheValues] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(rawValues);
const [originValues, setOriginValues] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(rawValues);
const mouseMoveEventRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const mouseUpEventRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const touchEventTargetRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const {
onDragStart,
onDragChange
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(UnstableContext);
(0,useLayoutEffect["default"])(() => {
if (draggingIndex === -1) {
setCacheValues(rawValues);
}
}, [rawValues, draggingIndex]);
// Clean up event
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => () => {
document.removeEventListener('mousemove', mouseMoveEventRef.current);
document.removeEventListener('mouseup', mouseUpEventRef.current);
if (touchEventTargetRef.current) {
touchEventTargetRef.current.removeEventListener('touchmove', mouseMoveEventRef.current);
touchEventTargetRef.current.removeEventListener('touchend', mouseUpEventRef.current);
}
}, []);
const flushValues = (nextValues, nextValue, deleteMark) => {
// Perf: Only update state when value changed
if (nextValue !== undefined) {
setDraggingValue(nextValue);
}
setCacheValues(nextValues);
let changeValues = nextValues;
if (deleteMark) {
changeValues = nextValues.filter((_, i) => i !== draggingIndex);
}
triggerChange(changeValues);
if (onDragChange) {
onDragChange({
rawValues: nextValues,
deleteIndex: deleteMark ? draggingIndex : -1,
draggingIndex,
draggingValue: nextValue
});
}
};
const updateCacheValue = (0,useEvent["default"])((valueIndex, offsetPercent, deleteMark) => {
if (valueIndex === -1) {
// >>>> Dragging on the track
const startValue = originValues[0];
const endValue = originValues[originValues.length - 1];
const maxStartOffset = min - startValue;
const maxEndOffset = max - endValue;
// Get valid offset
let offset = offsetPercent * (max - min);
offset = Math.max(offset, maxStartOffset);
offset = Math.min(offset, maxEndOffset);
// Use first value to revert back of valid offset (like steps marks)
const formatStartValue = formatValue(startValue + offset);
offset = formatStartValue - startValue;
const cloneCacheValues = originValues.map(val => val + offset);
flushValues(cloneCacheValues);
} else {
// >>>> Dragging on the handle
const offsetDist = (max - min) * offsetPercent;
// Always start with the valueIndex origin value
const cloneValues = [...cacheValues];
cloneValues[valueIndex] = originValues[valueIndex];
const next = offsetValues(cloneValues, offsetDist, valueIndex, 'dist');
flushValues(next.values, next.value, deleteMark);
}
});
const onStartMove = (e, valueIndex, startValues) => {
e.stopPropagation();
// 如果是点击 track 触发的,需要传入变化后的初始值,而不能直接用 rawValues
const initialValues = startValues || rawValues;
const originValue = initialValues[valueIndex];
setDraggingIndex(valueIndex);
setDraggingValue(originValue);
setOriginValues(initialValues);
setCacheValues(initialValues);
setDraggingDelete(false);
const {
pageX: startX,
pageY: startY
} = useDrag_getPosition(e);
// We declare it here since closure can't get outer latest value
let deleteMark = false;
// Internal trigger event
if (onDragStart) {
onDragStart({
rawValues: initialValues,
draggingIndex: valueIndex,
draggingValue: originValue
});
}
// Moving
const onMouseMove = event => {
event.preventDefault();
const {
pageX: moveX,
pageY: moveY
} = useDrag_getPosition(event);
const offsetX = moveX - startX;
const offsetY = moveY - startY;
const {
width,
height
} = containerRef.current.getBoundingClientRect();
let offSetPercent;
let removeDist;
switch (direction) {
case 'btt':
offSetPercent = -offsetY / height;
removeDist = offsetX;
break;
case 'ttb':
offSetPercent = offsetY / height;
removeDist = offsetX;
break;
case 'rtl':
offSetPercent = -offsetX / width;
removeDist = offsetY;
break;
default:
offSetPercent = offsetX / width;
removeDist = offsetY;
}
// Check if need mark remove
deleteMark = editable ? Math.abs(removeDist) > REMOVE_DIST && minCount < cacheValues.length : false;
setDraggingDelete(deleteMark);
updateCacheValue(valueIndex, offSetPercent, deleteMark);
};
// End
const onMouseUp = event => {
event.preventDefault();
document.removeEventListener('mouseup', onMouseUp);
document.removeEventListener('mousemove', onMouseMove);
if (touchEventTargetRef.current) {
touchEventTargetRef.current.removeEventListener('touchmove', mouseMoveEventRef.current);
touchEventTargetRef.current.removeEventListener('touchend', mouseUpEventRef.current);
}
mouseMoveEventRef.current = null;
mouseUpEventRef.current = null;
touchEventTargetRef.current = null;
finishChange(deleteMark);
setDraggingIndex(-1);
setDraggingDelete(false);
};
document.addEventListener('mouseup', onMouseUp);
document.addEventListener('mousemove', onMouseMove);
e.currentTarget.addEventListener('touchend', onMouseUp);
e.currentTarget.addEventListener('touchmove', onMouseMove);
mouseMoveEventRef.current = onMouseMove;
mouseUpEventRef.current = onMouseUp;
touchEventTargetRef.current = e.currentTarget;
};
// Only return cache value when it mapping with rawValues
const returnValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const sourceValues = [...rawValues].sort((a, b) => a - b);
const targetValues = [...cacheValues].sort((a, b) => a - b);
const counts = {};
targetValues.forEach(val => {
counts[val] = (counts[val] || 0) + 1;
});
sourceValues.forEach(val => {
counts[val] = (counts[val] || 0) - 1;
});
const maxDiffCount = editable ? 1 : 0;
const diffCount = Object.values(counts).reduce((prev, next) => prev + Math.abs(next), 0);
return diffCount <= maxDiffCount ? cacheValues : rawValues;
}, [rawValues, cacheValues, editable]);
return [draggingIndex, draggingValue, draggingDelete, returnValues, onStartMove];
}
/* harmony default export */ var hooks_useDrag = (useDrag);
;// ./node_modules/@rc-component/slider/es/hooks/useOffset.js
/** Format the value in the range of [min, max] */
/** Format value align with step */
/** Format value align with step & marks */
function useOffset(min, max, step, markList, allowCross, pushable) {
const formatRangeValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(val => Math.max(min, Math.min(max, val)), [min, max]);
const formatStepValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(val => {
if (step !== null) {
const stepValue = min + Math.round((formatRangeValue(val) - min) / step) * step;
// Cut number in case to be like 0.30000000000000004
const getDecimal = num => (String(num).split('.')[1] || '').length;
const maxDecimal = Math.max(getDecimal(step), getDecimal(max), getDecimal(min));
const fixedValue = Number(stepValue.toFixed(maxDecimal));
return min <= fixedValue && fixedValue <= max ? fixedValue : null;
}
return null;
}, [step, min, max, formatRangeValue]);
const formatValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(val => {
const formatNextValue = formatRangeValue(val);
// List align values
const alignValues = markList.map(mark => mark.value);
if (step !== null) {
alignValues.push(formatStepValue(val));
}
// min & max
alignValues.push(min, max);
// Align with marks
let closeValue = alignValues[0];
let closeDist = max - min;
alignValues.forEach(alignValue => {
const dist = Math.abs(formatNextValue - alignValue);
if (dist <= closeDist) {
closeValue = alignValue;
closeDist = dist;
}
});
return closeValue;
}, [min, max, markList, step, formatRangeValue, formatStepValue]);
// ========================== Offset ==========================
// Single Value
const offsetValue = (values, offset, valueIndex, mode = 'unit') => {
if (typeof offset === 'number') {
let nextValue;
const originValue = values[valueIndex];
// Only used for `dist` mode
const targetDistValue = originValue + offset;
// Compare next step value & mark value which is best match
let potentialValues = [];
markList.forEach(mark => {
potentialValues.push(mark.value);
});
// Min & Max
potentialValues.push(min, max);
// In case origin value is align with mark but not with step
potentialValues.push(formatStepValue(originValue));
// Put offset step value also
const sign = offset > 0 ? 1 : -1;
if (mode === 'unit') {
potentialValues.push(formatStepValue(originValue + sign * step));
} else {
potentialValues.push(formatStepValue(targetDistValue));
}
// Find close one
potentialValues = potentialValues.filter(val => val !== null)
// Remove reverse value
.filter(val => offset < 0 ? val <= originValue : val >= originValue);
if (mode === 'unit') {
// `unit` mode can not contain itself
potentialValues = potentialValues.filter(val => val !== originValue);
}
const compareValue = mode === 'unit' ? originValue : targetDistValue;
nextValue = potentialValues[0];
let valueDist = Math.abs(nextValue - compareValue);
potentialValues.forEach(potentialValue => {
const dist = Math.abs(potentialValue - compareValue);
if (dist < valueDist) {
nextValue = potentialValue;
valueDist = dist;
}
});
// Out of range will back to range
if (nextValue === undefined) {
return offset < 0 ? min : max;
}
// `dist` mode
if (mode === 'dist') {
return nextValue;
}
// `unit` mode may need another round
if (Math.abs(offset) > 1) {
const cloneValues = [...values];
cloneValues[valueIndex] = nextValue;
return offsetValue(cloneValues, offset - sign, valueIndex, mode);
}
return nextValue;
} else if (offset === 'min') {
return min;
} else if (offset === 'max') {
return max;
}
};
/** Same as `offsetValue` but return `changed` mark to tell value changed */
const offsetChangedValue = (values, offset, valueIndex, mode = 'unit') => {
const originValue = values[valueIndex];
const nextValue = offsetValue(values, offset, valueIndex, mode);
return {
value: nextValue,
changed: nextValue !== originValue
};
};
const needPush = dist => {
return pushable === null && dist === 0 || typeof pushable === 'number' && dist < pushable;
};
// Values
const offsetValues = (values, offset, valueIndex, mode = 'unit') => {
const nextValues = values.map(formatValue);
const originValue = nextValues[valueIndex];
const nextValue = offsetValue(nextValues, offset, valueIndex, mode);
nextValues[valueIndex] = nextValue;
if (allowCross === false) {
// >>>>> Allow Cross
const pushNum = pushable || 0;
// ============ AllowCross ===============
if (valueIndex > 0 && nextValues[valueIndex - 1] !== originValue) {
nextValues[valueIndex] = Math.max(nextValues[valueIndex], nextValues[valueIndex - 1] + pushNum);
}
if (valueIndex < nextValues.length - 1 && nextValues[valueIndex + 1] !== originValue) {
nextValues[valueIndex] = Math.min(nextValues[valueIndex], nextValues[valueIndex + 1] - pushNum);
}
} else if (typeof pushable === 'number' || pushable === null) {
// >>>>> Pushable
// =============== Push ==================
// >>>>>> Basic push
// End values
for (let i = valueIndex + 1; i < nextValues.length; i += 1) {
let changed = true;
while (needPush(nextValues[i] - nextValues[i - 1]) && changed) {
({
value: nextValues[i],
changed
} = offsetChangedValue(nextValues, 1, i));
}
}
// Start values
for (let i = valueIndex; i > 0; i -= 1) {
let changed = true;
while (needPush(nextValues[i] - nextValues[i - 1]) && changed) {
({
value: nextValues[i - 1],
changed
} = offsetChangedValue(nextValues, -1, i - 1));
}
}
// >>>>> Revert back to safe push range
// End to Start
for (let i = nextValues.length - 1; i > 0; i -= 1) {
let changed = true;
while (needPush(nextValues[i] - nextValues[i - 1]) && changed) {
({
value: nextValues[i - 1],
changed
} = offsetChangedValue(nextValues, -1, i - 1));
}
}
// Start to End
for (let i = 0; i < nextValues.length - 1; i += 1) {
let changed = true;
while (needPush(nextValues[i + 1] - nextValues[i]) && changed) {
({
value: nextValues[i + 1],
changed
} = offsetChangedValue(nextValues, 1, i + 1));
}
}
}
return {
value: nextValues[valueIndex],
values: nextValues
};
};
return [formatValue, offsetValues];
}
;// ./node_modules/@rc-component/slider/es/hooks/useRange.js
function useRange(range) {
return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (range === true || !range) {
return [!!range, false, false, 0];
}
const {
editable,
draggableTrack,
minCount,
maxCount
} = range;
if (true) {
(0,warning.warning)(!editable || !draggableTrack, '`editable` can not work with `draggableTrack`.');
}
return [true, editable, !editable && draggableTrack, minCount || 0, maxCount];
}, [range]);
}
;// ./node_modules/@rc-component/slider/es/Slider.js
/**
* New:
* - click mark to update range value
* - handleRender
* - Fix handle with count not correct
* - Fix pushable not work in some case
* - No more FindDOMNode
* - Move all position related style into inline style
* - Key: up is plus, down is minus
* - fix Key with step = null not align with marks
* - Change range should not trigger onChange
* - keyboard support pushable
*/
const Slider_Slider = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls = 'rc-slider',
className,
style,
classNames,
styles,
id,
// Status
disabled = false,
keyboard = true,
autoFocus,
onFocus,
onBlur,
// Value
min = 0,
max = 100,
step = 1,
value,
defaultValue,
range,
count,
onChange,
onBeforeChange,
onAfterChange,
onChangeComplete,
// Cross
allowCross = true,
pushable = false,
// Direction
reverse,
vertical,
// Style
included = true,
startPoint,
trackStyle,
handleStyle,
railStyle,
dotStyle,
activeDotStyle,
// Decorations
marks,
dots,
// Components
handleRender,
activeHandleRender,
track,
// Accessibility
tabIndex = 0,
ariaLabelForHandle,
ariaLabelledByForHandle,
ariaRequired,
ariaValueTextFormatterForHandle
} = props;
const handlesRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const containerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const direction = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (vertical) {
return reverse ? 'ttb' : 'btt';
}
return reverse ? 'rtl' : 'ltr';
}, [reverse, vertical]);
// ============================ Range =============================
const [rangeEnabled, rangeEditable, rangeDraggableTrack, minCount, maxCount] = useRange(range);
const mergedMin = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => isFinite(min) ? min : 0, [min]);
const mergedMax = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => isFinite(max) ? max : 100, [max]);
// ============================= Step =============================
const mergedStep = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => step !== null && step <= 0 ? 1 : step, [step]);
// ============================= Push =============================
const mergedPush = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (typeof pushable === 'boolean') {
return pushable ? mergedStep : false;
}
return pushable >= 0 ? pushable : false;
}, [pushable, mergedStep]);
// ============================ Marks =============================
const markList = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
return Object.keys(marks || {}).map(key => {
const mark = marks[key];
const markObj = {
value: Number(key)
};
if (mark && typeof mark === 'object' && ! /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(mark) && ('label' in mark || 'style' in mark)) {
markObj.style = mark.style;
markObj.label = mark.label;
} else {
markObj.label = mark;
}
return markObj;
}).filter(({
label
}) => label || typeof label === 'number').sort((a, b) => a.value - b.value);
}, [marks]);
// ============================ Format ============================
const [formatValue, offsetValues] = useOffset(mergedMin, mergedMax, mergedStep, markList, allowCross, mergedPush);
// ============================ Values ============================
const [mergedValue, setValue] = (0,useControlledState["default"])(defaultValue, value);
const rawValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const valueList = mergedValue === null || mergedValue === undefined ? [] : Array.isArray(mergedValue) ? mergedValue : [mergedValue];
const [val0 = mergedMin] = valueList;
let returnValues = mergedValue === null ? [] : [val0];
// Format as range
if (rangeEnabled) {
returnValues = [...valueList];
// When count provided or value is `undefined`, we fill values
if (count || mergedValue === undefined) {
const pointCount = count >= 0 ? count + 1 : 2;
returnValues = returnValues.slice(0, pointCount);
// Fill with count
while (returnValues.length < pointCount) {
returnValues.push(returnValues[returnValues.length - 1] ?? mergedMin);
}
}
returnValues.sort((a, b) => a - b);
}
// Align in range
returnValues.forEach((val, index) => {
returnValues[index] = formatValue(val);
});
return returnValues;
}, [mergedValue, rangeEnabled, mergedMin, count, formatValue]);
// =========================== onChange ===========================
const getTriggerValue = triggerValues => rangeEnabled ? triggerValues : triggerValues[0];
const triggerChange = (0,useEvent["default"])(nextValues => {
// Order first
const cloneNextValues = [...nextValues].sort((a, b) => a - b);
// Trigger event if needed
if (onChange && !(0,isEqual["default"])(cloneNextValues, rawValues, true)) {
onChange(getTriggerValue(cloneNextValues));
}
// We set this later since it will re-render component immediately
setValue(cloneNextValues);
});
const finishChange = (0,useEvent["default"])(draggingDelete => {
// Trigger from `useDrag` will tell if it's a delete action
if (draggingDelete) {
handlesRef.current.hideHelp();
}
const finishValue = getTriggerValue(rawValues);
onAfterChange?.(finishValue);
(0,warning["default"])(!onAfterChange, '[rc-slider] `onAfterChange` is deprecated. Please use `onChangeComplete` instead.');
onChangeComplete?.(finishValue);
});
const onDelete = index => {
if (disabled || !rangeEditable || rawValues.length <= minCount) {
return;
}
const cloneNextValues = [...rawValues];
cloneNextValues.splice(index, 1);
onBeforeChange?.(getTriggerValue(cloneNextValues));
triggerChange(cloneNextValues);
const nextFocusIndex = Math.max(0, index - 1);
handlesRef.current.hideHelp();
handlesRef.current.focus(nextFocusIndex);
};
const [draggingIndex, draggingValue, draggingDelete, cacheValues, onStartDrag] = hooks_useDrag(containerRef, direction, rawValues, mergedMin, mergedMax, formatValue, triggerChange, finishChange, offsetValues, rangeEditable, minCount);
/**
* When `rangeEditable` will insert a new value in the values array.
* Else it will replace the value in the values array.
*/
const changeToCloseValue = (newValue, e) => {
if (!disabled) {
// Create new values
const cloneNextValues = [...rawValues];
let valueIndex = 0;
let valueBeforeIndex = 0; // Record the index which value < newValue
let valueDist = mergedMax - mergedMin;
rawValues.forEach((val, index) => {
const dist = Math.abs(newValue - val);
if (dist <= valueDist) {
valueDist = dist;
valueIndex = index;
}
if (val < newValue) {
valueBeforeIndex = index;
}
});
let focusIndex = valueIndex;
if (rangeEditable && valueDist !== 0 && (!maxCount || rawValues.length < maxCount)) {
cloneNextValues.splice(valueBeforeIndex + 1, 0, newValue);
focusIndex = valueBeforeIndex + 1;
} else {
cloneNextValues[valueIndex] = newValue;
}
// Fill value to match default 2 (only when `rawValues` is empty)
if (rangeEnabled && !rawValues.length && count === undefined) {
cloneNextValues.push(newValue);
}
const nextValue = getTriggerValue(cloneNextValues);
onBeforeChange?.(nextValue);
triggerChange(cloneNextValues);
if (e) {
document.activeElement?.blur?.();
handlesRef.current.focus(focusIndex);
onStartDrag(e, focusIndex, cloneNextValues);
} else {
// https://github.com/ant-design/ant-design/issues/49997
onAfterChange?.(nextValue);
(0,warning["default"])(!onAfterChange, '[rc-slider] `onAfterChange` is deprecated. Please use `onChangeComplete` instead.');
onChangeComplete?.(nextValue);
}
}
};
// ============================ Click =============================
const onSliderMouseDown = e => {
e.preventDefault();
const {
width,
height,
left,
top,
bottom,
right
} = containerRef.current.getBoundingClientRect();
const {
clientX,
clientY
} = e;
let percent;
switch (direction) {
case 'btt':
percent = (bottom - clientY) / height;
break;
case 'ttb':
percent = (clientY - top) / height;
break;
case 'rtl':
percent = (right - clientX) / width;
break;
default:
percent = (clientX - left) / width;
}
const nextValue = mergedMin + percent * (mergedMax - mergedMin);
changeToCloseValue(formatValue(nextValue), e);
};
// =========================== Keyboard ===========================
const [keyboardValue, setKeyboardValue] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
const onHandleOffsetChange = (offset, valueIndex) => {
if (!disabled) {
const next = offsetValues(rawValues, offset, valueIndex);
onBeforeChange?.(getTriggerValue(rawValues));
triggerChange(next.values);
setKeyboardValue(next.value);
}
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (keyboardValue !== null) {
const valueIndex = rawValues.indexOf(keyboardValue);
if (valueIndex >= 0) {
handlesRef.current.focus(valueIndex);
}
}
setKeyboardValue(null);
}, [keyboardValue]);
// ============================= Drag =============================
const mergedDraggableTrack = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (rangeDraggableTrack && mergedStep === null) {
if (true) {
(0,warning["default"])(false, '`draggableTrack` is not supported when `step` is `null`.');
}
return false;
}
return rangeDraggableTrack;
}, [rangeDraggableTrack, mergedStep]);
const onStartMove = (0,useEvent["default"])((e, valueIndex) => {
onStartDrag(e, valueIndex);
onBeforeChange?.(getTriggerValue(rawValues));
});
// Auto focus for updated handle
const dragging = draggingIndex !== -1;
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (!dragging) {
const valueIndex = rawValues.lastIndexOf(draggingValue);
handlesRef.current.focus(valueIndex);
}
}, [dragging]);
// =========================== Included ===========================
const sortedCacheValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => [...cacheValues].sort((a, b) => a - b), [cacheValues]);
// Provide a range values with included [min, max]
// Used for Track, Mark & Dot
const [includedStart, includedEnd] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!rangeEnabled) {
return [mergedMin, sortedCacheValues[0]];
}
return [sortedCacheValues[0], sortedCacheValues[sortedCacheValues.length - 1]];
}, [sortedCacheValues, rangeEnabled, mergedMin]);
// ============================= Refs =============================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
focus: () => {
handlesRef.current.focus(0);
},
blur: () => {
const {
activeElement
} = document;
if (containerRef.current?.contains(activeElement)) {
activeElement?.blur();
}
}
}));
// ========================== Auto Focus ==========================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (autoFocus) {
handlesRef.current.focus(0);
}
}, []);
// =========================== Context ============================
const context = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
min: mergedMin,
max: mergedMax,
direction,
disabled,
keyboard,
step: mergedStep,
included,
includedStart,
includedEnd,
range: rangeEnabled,
tabIndex,
ariaLabelForHandle,
ariaLabelledByForHandle,
ariaRequired,
ariaValueTextFormatterForHandle,
styles: styles || {},
classNames: classNames || {}
}), [mergedMin, mergedMax, direction, disabled, keyboard, mergedStep, included, includedStart, includedEnd, rangeEnabled, tabIndex, ariaLabelForHandle, ariaLabelledByForHandle, ariaRequired, ariaValueTextFormatterForHandle, styles, classNames]);
// ============================ Render ============================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(slider_es_context.Provider, {
value: context
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: containerRef,
className: (0,clsx.clsx)(prefixCls, className, {
[`${prefixCls}-disabled`]: disabled,
[`${prefixCls}-vertical`]: vertical,
[`${prefixCls}-horizontal`]: !vertical,
[`${prefixCls}-with-marks`]: markList.length
}),
style: style,
onMouseDown: onSliderMouseDown,
id: id
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-rail`, classNames?.rail),
style: {
...railStyle,
...styles?.rail
}
}), track !== false && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Tracks, {
prefixCls: prefixCls,
style: trackStyle,
values: rawValues,
startPoint: startPoint,
onStartMove: mergedDraggableTrack ? onStartMove : undefined
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Steps, {
prefixCls: prefixCls,
marks: markList,
dots: dots,
style: dotStyle,
activeStyle: activeDotStyle
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Handles, {
ref: handlesRef,
prefixCls: prefixCls,
style: handleStyle,
values: cacheValues,
draggingIndex: draggingIndex,
draggingDelete: draggingDelete,
onStartMove: onStartMove,
onOffsetChange: onHandleOffsetChange,
onFocus: onFocus,
onBlur: onBlur,
handleRender: handleRender,
activeHandleRender: activeHandleRender,
onChangeComplete: finishChange,
onDelete: rangeEditable ? onDelete : undefined
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Marks, {
prefixCls: prefixCls,
marks: markList,
onClick: changeToCloseValue
})));
});
if (true) {
Slider_Slider.displayName = 'Slider';
}
/* harmony default export */ var es_Slider = (Slider_Slider);
;// ./node_modules/@rc-component/slider/es/index.js
/* harmony default export */ var slider_es = (es_Slider);
;// ./components/slider/Context.ts
/** @private Internal context. Do not use in your production. */
const SliderInternalContext = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext)({});
/* harmony default export */ var slider_Context = (SliderInternalContext);
;// ./components/slider/SliderTooltip.tsx
const SliderTooltip = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
open,
draggingDelete,
value
} = props;
const innerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const mergedOpen = open && !draggingDelete;
const rafRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
function cancelKeepAlign() {
raf["default"].cancel(rafRef.current);
rafRef.current = null;
}
function keepAlign() {
rafRef.current = (0,raf["default"])(() => {
innerRef.current?.forceAlign();
rafRef.current = null;
});
}
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (mergedOpen) {
keepAlign();
} else {
cancelKeepAlign();
}
return cancelKeepAlign;
}, [mergedOpen, props.title, value]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_tooltip, {
ref: (0,es_ref.composeRef)(innerRef, ref),
...props,
open: mergedOpen
});
});
if (true) {
SliderTooltip.displayName = 'SliderTooltip';
}
/* harmony default export */ var slider_SliderTooltip = (SliderTooltip);
// EXTERNAL MODULE: ./components/slider/style/index.ts
var slider_style = __webpack_require__("./components/slider/style/index.ts");
;// ./components/slider/useRafLock.ts
function useRafLock() {
const [state, setState] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const rafRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const cleanup = () => {
raf["default"].cancel(rafRef.current);
};
const setDelayState = nextState => {
cleanup();
if (nextState) {
setState(nextState);
} else {
rafRef.current = (0,raf["default"])(() => {
setState(nextState);
});
}
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => cleanup, []);
return [state, setDelayState];
}
;// ./components/slider/index.tsx
function getTipFormatter(tipFormatter) {
if (tipFormatter || tipFormatter === null) {
return tipFormatter;
}
return val => (0,is.isNumber)(val) ? val.toString() : '';
}
const slider_Slider = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
range,
className,
rootClassName,
style,
disabled,
// Deprecated Props
tooltip = {},
onChangeComplete,
classNames,
styles,
vertical,
orientation,
...restProps
} = props;
const [, mergedVertical] = useOrientation(orientation, vertical);
const {
getPrefixCls,
direction: contextDirection,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles,
getPopupContainer
} = (0,config_provider_context.useComponentConfig)('slider');
const contextDisabled = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(config_provider_DisabledContext);
const mergedDisabled = disabled ?? contextDisabled;
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
disabled: mergedDisabled,
vertical: mergedVertical
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
// ============================= Context ==============================
const {
handleRender: contextHandleRender,
direction: internalContextDirection
} = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(slider_Context);
const mergedDirection = internalContextDirection || contextDirection;
const isRTL = mergedDirection === 'rtl';
// =============================== Open ===============================
const [hoverOpen, setHoverOpen] = useRafLock();
const [focusOpen, setFocusOpen] = useRafLock();
const tooltipProps = {
...tooltip
};
const {
open: tooltipOpen,
placement: tooltipPlacement,
getPopupContainer: getTooltipPopupContainer,
prefixCls: customizeTooltipPrefixCls,
formatter: tipFormatter
} = tooltipProps;
const lockOpen = tooltipOpen;
const activeOpen = (hoverOpen || focusOpen) && lockOpen !== false;
const mergedTipFormatter = getTipFormatter(tipFormatter);
// ============================= Change ==============================
const [dragging, setDragging] = useRafLock();
const onInternalChangeComplete = nextValues => {
onChangeComplete?.(nextValues);
setDragging(false);
};
// ============================ Placement ============================
const getTooltipPlacement = (placement, vert) => {
if (placement) {
return placement;
}
if (!vert) {
return 'top';
}
return isRTL ? 'left' : 'right';
};
// ============================== Style ===============================
const prefixCls = getPrefixCls('slider', customizePrefixCls);
const [hashId, cssVarCls] = (0,slider_style["default"])(prefixCls);
const rootClassNames = (0,clsx.clsx)(className, contextClassName, mergedClassNames.root, rootClassName, {
[`${prefixCls}-rtl`]: isRTL,
[`${prefixCls}-lock`]: dragging
}, hashId, cssVarCls);
// make reverse default on rtl direction
if (isRTL && !mergedVertical) {
restProps.reverse = !restProps.reverse;
}
// ============================= Warning ==============================
// Warning for deprecated usage
if (true) {
const warning = (0,_util_warning.devUseWarning)('Slider');
[['tooltipPrefixCls', 'prefixCls'], ['getTooltipPopupContainer', 'getPopupContainer'], ['tipFormatter', 'formatter'], ['tooltipPlacement', 'placement'], ['tooltipVisible', 'open']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, `tooltip.${newName}`);
});
}
// ============================== Handle ==============================
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(() => {
const onMouseUp = () => {
// Delay for 1 frame to make the click to enable hide tooltip
// even when the handle is focused
(0,raf["default"])(() => {
setFocusOpen(false);
}, 1);
};
document.addEventListener('mouseup', onMouseUp);
return () => {
document.removeEventListener('mouseup', onMouseUp);
};
}, []);
const useActiveTooltipHandle = range && !lockOpen;
const handleRender = contextHandleRender || ((node, info) => {
const {
index
} = info;
const nodeProps = node.props;
function proxyEvent(eventName, event, triggerRestPropsEvent) {
if (triggerRestPropsEvent) {
restProps[eventName]?.(event);
}
nodeProps[eventName]?.(event);
}
const passedProps = {
...nodeProps,
onMouseEnter: e => {
setHoverOpen(true);
proxyEvent('onMouseEnter', e);
},
onMouseLeave: e => {
setHoverOpen(false);
proxyEvent('onMouseLeave', e);
},
onMouseDown: e => {
setFocusOpen(true);
setDragging(true);
proxyEvent('onMouseDown', e);
},
onFocus: e => {
setFocusOpen(true);
restProps.onFocus?.(e);
proxyEvent('onFocus', e, true);
},
onBlur: e => {
setFocusOpen(false);
restProps.onBlur?.(e);
proxyEvent('onBlur', e, true);
}
};
const cloneNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(node, passedProps);
const open = (!!lockOpen || activeOpen) && mergedTipFormatter !== null;
// Wrap on handle with Tooltip when is single mode or multiple with all show tooltip
if (!useActiveTooltipHandle) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(slider_SliderTooltip, {
...tooltipProps,
prefixCls: getPrefixCls('tooltip', customizeTooltipPrefixCls),
title: mergedTipFormatter ? mergedTipFormatter(info.value) : '',
value: info.value,
open: open,
placement: getTooltipPlacement(tooltipPlacement, mergedVertical),
key: index,
classNames: {
root: `${prefixCls}-tooltip`
},
getPopupContainer: getTooltipPopupContainer || getPopupContainer
}, cloneNode);
}
return cloneNode;
});
// ========================== Active Handle ===========================
const activeHandleRender = useActiveTooltipHandle ? (handle, info) => {
const cloneNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(handle, {
style: {
...handle.props.style,
visibility: 'hidden'
}
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(slider_SliderTooltip, {
...tooltipProps,
prefixCls: getPrefixCls('tooltip', customizeTooltipPrefixCls),
title: mergedTipFormatter ? mergedTipFormatter(info.value) : '',
open: mergedTipFormatter !== null && activeOpen,
placement: getTooltipPlacement(tooltipPlacement, mergedVertical),
key: "tooltip",
classNames: {
root: `${prefixCls}-tooltip`
},
getPopupContainer: getTooltipPopupContainer || getPopupContainer,
draggingDelete: info.draggingDelete
}, cloneNode);
} : undefined;
// ============================== Render ==============================
const rootStyle = {
...mergedStyles.root,
...contextStyle,
...style
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(slider_es, {
...restProps,
classNames: mergedClassNames,
styles: mergedStyles,
step: restProps.step,
range: range,
className: rootClassNames,
style: rootStyle,
disabled: mergedDisabled,
vertical: mergedVertical,
ref: ref,
prefixCls: prefixCls,
handleRender: handleRender,
activeHandleRender: activeHandleRender,
onChangeComplete: onInternalChangeComplete
});
});
if (true) {
slider_Slider.displayName = 'Slider';
}
/* harmony default export */ var slider = (slider_Slider);
;// ./components/color-picker/components/ColorSlider.tsx
const GradientColorSlider = props => {
const {
prefixCls,
colors,
type,
color,
range = false,
className,
activeIndex,
onActive,
onDragStart,
onDragChange,
onKeyDelete,
...restProps
} = props;
const sliderProps = {
...restProps,
track: false
};
// ========================== Background ==========================
const linearCss = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const colorsStr = colors.map(c => `${c.color} ${c.percent}%`).join(', ');
return `linear-gradient(90deg, ${colorsStr})`;
}, [colors]);
const pointColor = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!color || !type) {
return null;
}
if (type === 'alpha') {
return color.toRgbString();
}
return `hsl(${color.toHsb().h}, 100%, 50%)`;
}, [color, type]);
// ======================= Context: Slider ========================
const onInternalDragStart = (0,es.useEvent)(onDragStart);
const onInternalDragChange = (0,es.useEvent)(onDragChange);
const unstableContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
onDragStart: onInternalDragStart,
onDragChange: onInternalDragChange
}), []);
// ======================= Context: Render ========================
const handleRender = (0,es.useEvent)((ori, info) => {
const {
onFocus,
style,
className: handleCls,
onKeyDown
} = ori.props;
// Point Color
const mergedStyle = {
...style
};
if (type === 'gradient') {
mergedStyle.background = (0,util.getGradientPercentColor)(colors, info.value);
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement(ori, {
onFocus: e => {
onActive?.(info.index);
onFocus?.(e);
},
style: mergedStyle,
className: (0,clsx.clsx)(handleCls, {
[`${prefixCls}-slider-handle-active`]: activeIndex === info.index
}),
onKeyDown: e => {
if ((e.key === 'Delete' || e.key === 'Backspace') && onKeyDelete) {
onKeyDelete(info.index);
}
onKeyDown?.(e);
}
});
});
const sliderContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
direction: 'ltr',
handleRender
}), []);
// ============================ Render ============================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(slider_Context.Provider, {
value: sliderContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(UnstableContext.Provider, {
value: unstableContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(slider, {
...sliderProps,
className: (0,clsx.clsx)(className, `${prefixCls}-slider`),
tooltip: {
open: false
},
range: {
editable: range,
minCount: 2
},
styles: {
rail: {
background: linearCss
},
handle: pointColor ? {
background: pointColor
} : {}
},
classNames: {
rail: `${prefixCls}-slider-rail`,
handle: `${prefixCls}-slider-handle`
}
})));
};
const SingleColorSlider = props => {
const {
value,
onChange,
onChangeComplete
} = props;
const singleOnChange = v => onChange(v[0]);
const singleOnChangeComplete = v => onChangeComplete(v[0]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(GradientColorSlider, {
...props,
value: [value],
onChange: singleOnChange,
onChangeComplete: singleOnChangeComplete
});
};
/* harmony default export */ var ColorSlider = (SingleColorSlider);
;// ./components/color-picker/components/PanelPicker/GradientColorBar.tsx
function sortColors(colors) {
return (0,toConsumableArray["default"])(colors).sort((a, b) => a.percent - b.percent);
}
/**
* GradientColorBar will auto show when the mode is `gradient`.
*/
const GradientColorBar = props => {
const {
prefixCls,
mode,
onChange,
onChangeComplete,
onActive,
activeIndex,
onGradientDragging,
colors
} = props;
const isGradient = mode === 'gradient';
// ============================= Colors =============================
const colorList = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => colors.map(info => ({
percent: info.percent,
color: info.color.toRgbString()
})), [colors]);
const values = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => colorList.map(info => info.percent), [colorList]);
// ============================== Drag ==============================
const colorsRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(colorList);
// Record current colors
const onDragStart = ({
rawValues,
draggingIndex,
draggingValue
}) => {
if (rawValues.length > colorList.length) {
// Add new node
const newPointColor = (0,util.getGradientPercentColor)(colorList, draggingValue);
const nextColors = (0,toConsumableArray["default"])(colorList);
nextColors.splice(draggingIndex, 0, {
percent: draggingValue,
color: newPointColor
});
colorsRef.current = nextColors;
} else {
colorsRef.current = colorList;
}
onGradientDragging(true);
onChange(new color.AggregationColor(sortColors(colorsRef.current)), true);
};
// Adjust color when dragging
const onDragChange = ({
deleteIndex,
draggingIndex,
draggingValue
}) => {
let nextColors = (0,toConsumableArray["default"])(colorsRef.current);
if (deleteIndex !== -1) {
nextColors.splice(deleteIndex, 1);
} else {
nextColors[draggingIndex] = {
...nextColors[draggingIndex],
percent: draggingValue
};
nextColors = sortColors(nextColors);
}
onChange(new color.AggregationColor(nextColors), true);
};
// ============================== Key ===============================
const onKeyDelete = index => {
const nextColors = (0,toConsumableArray["default"])(colorList);
nextColors.splice(index, 1);
const nextColor = new color.AggregationColor(nextColors);
onChange(nextColor);
onChangeComplete(nextColor);
};
// ============================= Change =============================
const onInternalChangeComplete = nextValues => {
onChangeComplete(new color.AggregationColor(colorList));
// Reset `activeIndex` if out of range
if (activeIndex >= nextValues.length) {
onActive(nextValues.length - 1);
}
onGradientDragging(false);
};
// ============================= Render =============================
if (!isGradient) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(GradientColorSlider, {
min: 0,
max: 100,
prefixCls: prefixCls,
className: `${prefixCls}-gradient-slider`,
colors: colorList,
color: null,
value: values,
range: true,
onChangeComplete: onInternalChangeComplete,
disabled: false,
type: "gradient",
// Active
activeIndex: activeIndex,
onActive: onActive,
// Drag
onDragStart: onDragStart,
onDragChange: onDragChange,
onKeyDelete: onKeyDelete
});
};
/* harmony default export */ var PanelPicker_GradientColorBar = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo(GradientColorBar));
;// ./components/color-picker/components/PanelPicker/index.tsx
const components = {
slider: ColorSlider
};
const PanelPicker = () => {
const panelPickerContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(PanelPickerContext);
const {
mode,
onModeChange,
modeOptions,
prefixCls,
allowClear,
value,
disabledAlpha,
onChange,
onClear,
onChangeComplete,
activeIndex,
gradientDragging,
...injectProps
} = panelPickerContext;
// ============================ Colors ============================
const colors = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
if (!value.cleared) {
return value.getColors();
}
return [{
percent: 0,
color: new color.AggregationColor('')
}, {
percent: 100,
color: new color.AggregationColor('')
}];
}, [value]);
// ========================= Single Color =========================
const isSingle = !value.isGradient();
// We cache the point color in case user drag the gradient point across another one
const [lockedColor, setLockedColor] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(value);
// Use layout effect here since `useEffect` will cause a blink when mouseDown
(0,useLayoutEffect["default"])(() => {
if (!isSingle) {
setLockedColor(colors[activeIndex]?.color);
}
}, [isSingle, colors, gradientDragging, activeIndex]);
const activeColor = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
if (isSingle) {
return value;
}
// Use cache when dragging. User can not operation panel when dragging.
if (gradientDragging) {
return lockedColor;
}
return colors[activeIndex]?.color;
}, [colors, value, activeIndex, isSingle, lockedColor, gradientDragging]);
// ========================= Picker Color =========================
const [pickerColor, setPickerColor] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(activeColor);
const [forceSync, setForceSync] = useForceUpdate();
const mergedPickerColor = pickerColor?.equals(activeColor) ? activeColor : pickerColor;
(0,useLayoutEffect["default"])(() => {
setPickerColor(activeColor);
}, [forceSync, activeColor?.toHexString()]);
// ============================ Change ============================
const fillColor = (nextColor, info) => {
let submitColor = (0,util.generateColor)(nextColor);
// Fill alpha color to 100% if origin is cleared color
if (value.cleared) {
const rgb = submitColor.toRgb();
// Auto fill color if origin is `0/0/0` to enhance user experience
if (!rgb.r && !rgb.g && !rgb.b && info) {
const {
type: infoType,
value: infoValue = 0
} = info;
submitColor = new color.AggregationColor({
h: infoType === 'hue' ? infoValue : 0,
s: 1,
b: 1,
a: infoType === 'alpha' ? infoValue / 100 : 1
});
} else {
submitColor = (0,util.genAlphaColor)(submitColor);
}
}
if (mode === 'single') {
return submitColor;
}
const nextColors = (0,toConsumableArray["default"])(colors);
nextColors[activeIndex] = {
...nextColors[activeIndex],
color: submitColor
};
return new color.AggregationColor(nextColors);
};
const onPickerChange = (colorValue, fromPicker, info) => {
const nextColor = fillColor(colorValue, info);
setPickerColor(nextColor.isGradient() ? nextColor.getColors()[activeIndex].color : nextColor);
onChange(nextColor, fromPicker);
};
const onInternalChangeComplete = (nextColor, info) => {
// Trigger complete event
onChangeComplete(fillColor(nextColor, info));
// Back of origin color in case in controlled
// This will set after `onChangeComplete` to avoid `setState` trigger rerender
// which will make `fillColor` get wrong `color.cleared` state
setForceSync();
};
const onInputChange = colorValue => {
onChange(fillColor(colorValue));
};
// ============================ Render ============================
// Operation bar
let operationNode = null;
const showMode = modeOptions.length > 1;
if (allowClear || showMode) {
operationNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${prefixCls}-operation`
}, showMode && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(segmented, {
size: "small",
options: modeOptions,
value: mode,
onChange: onModeChange
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_ColorClear, {
prefixCls: prefixCls,
value: value,
onChange: clearColor => {
onChange(clearColor);
onClear?.();
},
...injectProps
}));
}
// Return
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, operationNode, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(PanelPicker_GradientColorBar, {
...panelPickerContext,
colors: colors
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(color_picker_es["default"], {
prefixCls: prefixCls,
value: mergedPickerColor?.toHsb(),
disabledAlpha: disabledAlpha,
onChange: (colorValue, info) => {
onPickerChange(colorValue, true, info);
},
onChangeComplete: (colorValue, info) => {
onInternalChangeComplete(colorValue, info);
},
components: components
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_ColorInput, {
value: activeColor,
onChange: onInputChange,
prefixCls: prefixCls,
disabledAlpha: disabledAlpha,
...injectProps
}));
};
/* harmony default export */ var components_PanelPicker = (PanelPicker);
// EXTERNAL MODULE: ./components/color-picker/components/ColorPresets.tsx
var ColorPresets = __webpack_require__("./components/color-picker/components/ColorPresets.tsx");
;// ./components/color-picker/components/PanelPresets.tsx
const PanelPresets = () => {
const {
prefixCls,
value,
presets,
onChange
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(PanelPresetsContext);
return Array.isArray(presets) ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(ColorPresets["default"], {
value: value,
presets: presets,
prefixCls: prefixCls,
onChange: onChange
})) : null;
};
/* harmony default export */ var components_PanelPresets = (PanelPresets);
;// ./components/color-picker/ColorPickerPanel.tsx
const ColorPickerPanel = props => {
const {
prefixCls,
presets,
panelRender,
value,
onChange,
onClear,
allowClear,
disabledAlpha,
mode,
onModeChange,
modeOptions,
onChangeComplete,
activeIndex,
onActive,
format,
onFormatChange,
gradientDragging,
onGradientDragging,
disabledFormat
} = props;
const colorPickerPanelPrefixCls = `${prefixCls}-inner`;
// ===================== Context ======================
const panelContext = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => ({
prefixCls,
value,
onChange,
onClear,
allowClear,
disabledAlpha,
mode,
onModeChange,
modeOptions,
onChangeComplete,
activeIndex,
onActive,
format,
onFormatChange,
gradientDragging,
onGradientDragging,
disabledFormat
}), [prefixCls, value, onChange, onClear, allowClear, disabledAlpha, mode, onModeChange, modeOptions, onChangeComplete, activeIndex, onActive, format, onFormatChange, gradientDragging, onGradientDragging, disabledFormat]);
const presetContext = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => ({
prefixCls,
value,
presets,
onChange
}), [prefixCls, value, presets, onChange]);
// ====================== Render ======================
const innerPanel = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${colorPickerPanelPrefixCls}-content`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_PanelPicker, null), Array.isArray(presets) && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(divider, null), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_PanelPresets, null));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(PanelPickerContext.Provider, {
value: panelContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(PanelPresetsContext.Provider, {
value: presetContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: colorPickerPanelPrefixCls
}, typeof panelRender === 'function' ? panelRender(innerPanel, {
components: {
Picker: components_PanelPicker,
Presets: components_PanelPresets
}
}) : innerPanel)));
};
if (true) {
ColorPickerPanel.displayName = 'ColorPickerPanel';
}
/* harmony default export */ var color_picker_ColorPickerPanel = (ColorPickerPanel);
;// ./components/color-picker/components/ColorTrigger.tsx
const ColorTrigger = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((props, ref) => {
const {
color,
prefixCls,
open,
disabled,
format,
className,
style,
classNames,
styles,
showText,
activeIndex,
...rest
} = props;
const colorTriggerPrefixCls = `${prefixCls}-trigger`;
const colorTextPrefixCls = `${colorTriggerPrefixCls}-text`;
const colorTextCellPrefixCls = `${colorTextPrefixCls}-cell`;
const [locale] = (0,useLocale["default"])('ColorPicker');
// ============================== Text ==============================
const desc = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
if (!showText) {
return '';
}
if (typeof showText === 'function') {
return showText(color);
}
if (color.cleared) {
return locale.transparent;
}
if (color.isGradient()) {
return color.getColors().map((c, index) => {
const inactive = activeIndex !== -1 && activeIndex !== index;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
key: index,
className: (0,clsx.clsx)(colorTextCellPrefixCls, inactive && `${colorTextCellPrefixCls}-inactive`)
}, c.color.toRgbString(), " ", c.percent, "%");
});
}
const hexString = color.toHexString().toUpperCase();
const alpha = (0,util.getColorAlpha)(color);
switch (format) {
case 'rgb':
return color.toRgbString();
case 'hsb':
return color.toHsbString();
// case 'hex':
default:
return alpha < 100 ? `${hexString.slice(0, 7)},${alpha}%` : hexString;
}
}, [color, format, showText, activeIndex, locale.transparent, colorTextCellPrefixCls]);
// ============================= Render =============================
const containerNode = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => color.cleared ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_ColorClear, {
prefixCls: prefixCls,
className: classNames.body,
style: styles.body
})) : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(color_picker_es.ColorBlock, {
prefixCls: prefixCls,
color: color.toCssString(),
className: classNames.body,
innerClassName: classNames.content,
style: styles.body,
innerStyle: styles.content
})), [color, prefixCls, classNames.body, classNames.content, styles.body, styles.content]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
ref: ref,
className: (0,clsx.clsx)(colorTriggerPrefixCls, className, classNames.root, {
[`${colorTriggerPrefixCls}-active`]: open,
[`${colorTriggerPrefixCls}-disabled`]: disabled
}),
style: {
...styles.root,
...style
},
...(0,pickAttrs["default"])(rest)
}, containerNode, showText && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(colorTextPrefixCls, classNames.description),
style: styles.description
}, desc)));
});
/* harmony default export */ var components_ColorTrigger = (ColorTrigger);
;// ./components/color-picker/hooks/useModeColor.ts
/**
* Combine the `color` and `mode` to make sure sync of state.
*/
function useModeColor(defaultValue, value, mode) {
const [locale] = (0,useLocale["default"])('ColorPicker');
// ======================== Base ========================
// Color
const [mergedColor, setMergedColor] = (0,es.useControlledState)(defaultValue, value);
// Mode
const [modeState, setModeState] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState('single');
const [modeOptionList, modeSet] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const list = (Array.isArray(mode) ? mode : [mode]).filter(m => m);
if (!list.length) {
list.push('single');
}
const modes = new Set(list);
const optionList = [];
const pushOption = (modeType, localeTxt) => {
if (modes.has(modeType)) {
optionList.push({
label: localeTxt,
value: modeType
});
}
};
pushOption('single', locale.singleColor);
pushOption('gradient', locale.gradientColor);
return [optionList, modes];
}, [mode, locale.singleColor, locale.gradientColor]);
// ======================== Post ========================
// We need align `mode` with `color` state
// >>>>> Color
const [cacheColor, setCacheColor] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
const setColor = (0,es.useEvent)(nextColor => {
setCacheColor(nextColor);
setMergedColor(nextColor);
});
const postColor = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const colorObj = (0,util.generateColor)(mergedColor || '');
// Use `cacheColor` in case the color is `cleared`
return colorObj.equals(cacheColor) ? cacheColor : colorObj;
}, [mergedColor, cacheColor]);
// >>>>> Mode
const postMode = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (modeSet.has(modeState)) {
return modeState;
}
return modeOptionList[0]?.value;
}, [modeSet, modeState, modeOptionList]);
// ======================= Effect =======================
// Dynamic update mode when color change
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
setModeState(postColor.isGradient() ? 'gradient' : 'single');
}, [postColor]);
// ======================= Return =======================
return [postColor, setColor, postMode, setModeState, modeOptionList];
}
// EXTERNAL MODULE: ./components/color-picker/style/index.ts + 5 modules
var color_picker_style = __webpack_require__("./components/color-picker/style/index.ts");
;// ./components/color-picker/ColorPicker.tsx
const ColorPicker = props => {
const {
mode,
value,
defaultValue,
format,
defaultFormat,
allowClear = false,
presets,
children,
trigger = 'click',
open,
disabled,
placement = 'bottomLeft',
arrow,
panelRender,
showText,
style,
className,
size: customizeSize,
rootClassName,
prefixCls: customizePrefixCls,
styles,
classNames,
disabledAlpha = false,
onFormatChange,
onChange,
onClear,
onOpenChange,
onChangeComplete,
getPopupContainer,
autoAdjustOverflow = true,
destroyTooltipOnHide,
destroyOnHidden,
disabledFormat,
...rest
} = props;
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles,
arrow: contextArrow
} = (0,config_provider_context.useComponentConfig)('colorPicker');
const contextDisabled = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(config_provider_DisabledContext);
const mergedDisabled = disabled ?? contextDisabled;
const prefixCls = getPrefixCls('color-picker', customizePrefixCls);
const mergedArrow = hook_useMergedArrow(arrow, contextArrow);
// ================== Size ==================
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
const mergedSize = (0,useSize["default"])(ctx => customizeSize ?? compactSize ?? ctx);
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
trigger,
allowClear,
autoAdjustOverflow,
disabledAlpha,
arrow: mergedArrow,
placement,
disabled: mergedDisabled,
size: mergedSize
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
}, {
popup: {
_default: 'root'
}
});
const [internalPopupOpen, setPopupOpen] = (0,es.useControlledState)(false, open);
const popupOpen = !mergedDisabled && internalPopupOpen;
const [formatValue, setFormatValue] = (0,es.useControlledState)(defaultFormat, format);
const triggerFormatChange = newFormat => {
setFormatValue(newFormat);
if (formatValue !== newFormat) {
onFormatChange?.(newFormat);
}
};
const triggerOpenChange = visible => {
if (!visible || !mergedDisabled) {
setPopupOpen(visible);
onOpenChange?.(visible);
}
};
// ================== Value & Mode =================
const [mergedColor, setColor, modeState, setModeState, modeOptions] = useModeColor(defaultValue, value, mode);
const isAlphaColor = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => (0,util.getColorAlpha)(mergedColor) < 100, [mergedColor]);
// ==================== Change =====================
// To enhance user experience, we cache the gradient color when switch from gradient to single
// If user not modify single color, we will use the cached gradient color.
const [cachedGradientColor, setCachedGradientColor] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(null);
const onInternalChangeComplete = color => {
if (onChangeComplete) {
let changeColor = (0,util.generateColor)(color);
// ignore alpha color
if (disabledAlpha && isAlphaColor) {
changeColor = (0,util.genAlphaColor)(color);
}
onChangeComplete(changeColor);
}
};
const onInternalChange = (data, changeFromPickerDrag) => {
let color = (0,util.generateColor)(data);
// ignore alpha color
if (disabledAlpha && isAlphaColor) {
color = (0,util.genAlphaColor)(color);
}
setColor(color);
setCachedGradientColor(null);
// Trigger change event
if (onChange) {
onChange(color, color.toCssString());
}
// Only for drag-and-drop color picking
if (!changeFromPickerDrag) {
onInternalChangeComplete(color);
}
};
// =================== Gradient ====================
const [activeIndex, setActiveIndex] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(0);
const [gradientDragging, setGradientDragging] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(false);
// Mode change should also trigger color change
const onInternalModeChange = newMode => {
setModeState(newMode);
if (newMode === 'single' && mergedColor.isGradient()) {
setActiveIndex(0);
onInternalChange(new color.AggregationColor(mergedColor.getColors()[0].color));
// Should after `onInternalChange` since it will clear the cached color
setCachedGradientColor(mergedColor);
} else if (newMode === 'gradient' && !mergedColor.isGradient()) {
const baseColor = isAlphaColor ? (0,util.genAlphaColor)(mergedColor) : mergedColor;
onInternalChange(new color.AggregationColor(cachedGradientColor || [{
percent: 0,
color: baseColor
}, {
percent: 100,
color: baseColor
}]));
}
};
// ================== Form Status ==================
const {
status: contextStatus
} = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(FormItemInputContext);
// ===================== Style =====================
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,color_picker_style["default"])(prefixCls, rootCls);
const rtlCls = {
[`${prefixCls}-rtl`]: direction
};
const mergedRootCls = (0,clsx.clsx)(rootClassName, cssVarCls, rootCls, rtlCls);
const mergedCls = (0,clsx.clsx)(getStatusClassNames(prefixCls, contextStatus), {
[`${prefixCls}-sm`]: mergedSize === 'small',
[`${prefixCls}-lg`]: mergedSize === 'large'
}, compactItemClassnames, contextClassName, mergedRootCls, className, hashId);
const mergedPopupCls = (0,clsx.clsx)(prefixCls, mergedRootCls, mergedClassNames.popup?.root);
// ===================== Warning ======================
if (true) {
const warning = (0,_util_warning.devUseWarning)('ColorPicker');
true ? warning(!(disabledAlpha && isAlphaColor), 'usage', '`disabledAlpha` will make the alpha to be 100% when use alpha color.') : 0;
}
const popoverProps = {
open: popupOpen,
trigger,
placement,
arrow: mergedArrow,
rootClassName,
getPopupContainer,
autoAdjustOverflow,
destroyOnHidden: destroyOnHidden ?? !!destroyTooltipOnHide
};
const mergedStyle = {
...contextStyle,
...style
};
// ============================ zIndex ============================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(popover, {
classNames: {
root: mergedPopupCls
},
styles: {
root: mergedStyles.popup?.root,
container: styles?.popupOverlayInner
},
onOpenChange: triggerOpenChange,
content: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(_util_ContextIsolator, {
form: true
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(color_picker_ColorPickerPanel, {
mode: modeState,
onModeChange: onInternalModeChange,
modeOptions: modeOptions,
prefixCls: prefixCls,
value: mergedColor,
allowClear: allowClear,
disabled: mergedDisabled,
disabledAlpha: disabledAlpha,
presets: presets,
panelRender: panelRender,
format: formatValue,
onFormatChange: triggerFormatChange,
onChange: onInternalChange,
onChangeComplete: onInternalChangeComplete,
onClear: onClear,
activeIndex: activeIndex,
onActive: setActiveIndex,
gradientDragging: gradientDragging,
onGradientDragging: setGradientDragging,
disabledFormat: disabledFormat
})),
...popoverProps
}, children || (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_ColorTrigger, {
activeIndex: popupOpen ? activeIndex : -1,
open: popupOpen,
className: mergedCls,
style: mergedStyle,
classNames: mergedClassNames,
styles: mergedStyles,
prefixCls: prefixCls,
disabled: mergedDisabled,
showText: showText,
format: formatValue,
...rest,
color: mergedColor
})));
};
if (true) {
ColorPicker.displayName = 'ColorPicker';
}
const ColorPicker_PurePanel = _util_PurePanel(ColorPicker, undefined, props => ({
...props,
placement: 'bottom',
autoAdjustOverflow: false
}), 'color-picker', /* istanbul ignore next */
prefixCls => prefixCls);
ColorPicker._InternalPanelDoNotUseOrYouWillBeFired = ColorPicker_PurePanel;
/* harmony default export */ var color_picker_ColorPicker = (ColorPicker);
;// ./components/color-picker/index.tsx
/* harmony default export */ var color_picker = (color_picker_ColorPicker);
;// ./node_modules/@ant-design/icons-svg/es/asn/SwapRightOutlined.js
// This icon file is generated automatically.
var SwapRightOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M873.1 596.2l-164-208A32 32 0 00684 376h-64.8c-6.7 0-10.4 7.7-6.3 13l144.3 183H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h695.9c26.8 0 41.7-30.8 25.2-51.8z" } }] }, "name": "swap-right", "theme": "outlined" };
/* harmony default export */ var asn_SwapRightOutlined = (SwapRightOutlined);
;// ./node_modules/@ant-design/icons/es/icons/SwapRightOutlined.js
function SwapRightOutlined_extends() { SwapRightOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return SwapRightOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const SwapRightOutlined_SwapRightOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], SwapRightOutlined_extends({}, props, {
ref: ref,
icon: asn_SwapRightOutlined
}));
/** */
const SwapRightOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(SwapRightOutlined_SwapRightOutlined);
if (true) {
SwapRightOutlined_RefIcon.displayName = 'SwapRightOutlined';
}
/* harmony default export */ var icons_SwapRightOutlined = (SwapRightOutlined_RefIcon);
;// ./components/date-picker/hooks/useMergedPickerSemantic.ts
const useMergedPickerSemantic = (pickerType, classNames, styles, popupClassName, popupStyle, mergedProps) => {
const {
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)(pickerType);
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
}, {
popup: {
_default: 'root'
}
});
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
// ClassNames
const filledClassNames = {
...mergedClassNames,
popup: {
...mergedClassNames.popup,
root: (0,clsx.clsx)(mergedClassNames.popup?.root, popupClassName)
}
};
// Styles
const filledStyles = {
...mergedStyles,
popup: {
...mergedStyles.popup,
root: {
...mergedStyles.popup?.root,
...popupStyle
}
}
};
// Return
return [filledClassNames, filledStyles];
}, [mergedClassNames, mergedStyles, popupClassName, popupStyle]);
};
/* harmony default export */ var hooks_useMergedPickerSemantic = (useMergedPickerSemantic);
// EXTERNAL MODULE: ./components/date-picker/locale/en_US.ts + 1 modules
var date_picker_locale_en_US = __webpack_require__("./components/date-picker/locale/en_US.ts");
// EXTERNAL MODULE: ./components/date-picker/style/index.ts + 3 modules
var date_picker_style = __webpack_require__("./components/date-picker/style/index.ts");
;// ./components/date-picker/util.ts
function getPlaceholder(locale, picker, customizePlaceholder) {
if (customizePlaceholder !== undefined) {
return customizePlaceholder;
}
if (picker === 'year' && locale.lang.yearPlaceholder) {
return locale.lang.yearPlaceholder;
}
if (picker === 'quarter' && locale.lang.quarterPlaceholder) {
return locale.lang.quarterPlaceholder;
}
if (picker === 'month' && locale.lang.monthPlaceholder) {
return locale.lang.monthPlaceholder;
}
if (picker === 'week' && locale.lang.weekPlaceholder) {
return locale.lang.weekPlaceholder;
}
if (picker === 'time' && locale.timePickerLocale.placeholder) {
return locale.timePickerLocale.placeholder;
}
return locale.lang.placeholder;
}
function getRangePlaceholder(locale, picker, customizePlaceholder) {
if (customizePlaceholder !== undefined) {
return customizePlaceholder;
}
if (picker === 'year' && locale.lang.yearPlaceholder) {
return locale.lang.rangeYearPlaceholder;
}
if (picker === 'quarter' && locale.lang.quarterPlaceholder) {
return locale.lang.rangeQuarterPlaceholder;
}
if (picker === 'month' && locale.lang.monthPlaceholder) {
return locale.lang.rangeMonthPlaceholder;
}
if (picker === 'week' && locale.lang.weekPlaceholder) {
return locale.lang.rangeWeekPlaceholder;
}
if (picker === 'time' && locale.timePickerLocale.placeholder) {
return locale.timePickerLocale.rangePlaceholder;
}
return locale.lang.rangePlaceholder;
}
function util_useIcons(props, prefixCls) {
const {
allowClear = true
} = props;
const {
clearIcon,
removeIcon
} = useIcons({
...props,
prefixCls,
componentName: 'DatePicker'
});
const mergedAllowClear = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (allowClear === false) {
return false;
}
const allowClearConfig = allowClear === true ? {} : allowClear;
return {
clearIcon: clearIcon,
...allowClearConfig
};
}, [allowClear, clearIcon]);
return [mergedAllowClear, removeIcon];
}
;// ./components/date-picker/generatePicker/constant.ts
const [WEEK, WEEKPICKER] = ['week', 'WeekPicker'];
const [MONTH, MONTHPICKER] = ['month', 'MonthPicker'];
const [YEAR, YEARPICKER] = ['year', 'YearPicker'];
const [QUARTER, QUARTERPICKER] = ['quarter', 'QuarterPicker'];
const [TIME, TIMEPICKER] = ['time', 'TimePicker'];
;// ./node_modules/@ant-design/icons-svg/es/asn/CalendarOutlined.js
// This icon file is generated automatically.
var CalendarOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z" } }] }, "name": "calendar", "theme": "outlined" };
/* harmony default export */ var asn_CalendarOutlined = (CalendarOutlined);
;// ./node_modules/@ant-design/icons/es/icons/CalendarOutlined.js
function CalendarOutlined_extends() { CalendarOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return CalendarOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const CalendarOutlined_CalendarOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], CalendarOutlined_extends({}, props, {
ref: ref,
icon: asn_CalendarOutlined
}));
/** */
const CalendarOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(CalendarOutlined_CalendarOutlined);
if (true) {
CalendarOutlined_RefIcon.displayName = 'CalendarOutlined';
}
/* harmony default export */ var icons_CalendarOutlined = (CalendarOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/ClockCircleOutlined.js
// This icon file is generated automatically.
var ClockCircleOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z" } }] }, "name": "clock-circle", "theme": "outlined" };
/* harmony default export */ var asn_ClockCircleOutlined = (ClockCircleOutlined);
;// ./node_modules/@ant-design/icons/es/icons/ClockCircleOutlined.js
function ClockCircleOutlined_extends() { ClockCircleOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return ClockCircleOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const ClockCircleOutlined_ClockCircleOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], ClockCircleOutlined_extends({}, props, {
ref: ref,
icon: asn_ClockCircleOutlined
}));
/** */
const ClockCircleOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(ClockCircleOutlined_ClockCircleOutlined);
if (true) {
ClockCircleOutlined_RefIcon.displayName = 'ClockCircleOutlined';
}
/* harmony default export */ var icons_ClockCircleOutlined = (ClockCircleOutlined_RefIcon);
;// ./components/date-picker/generatePicker/useSuffixIcon.tsx
const useSuffixIcon = ({
picker,
hasFeedback,
feedbackIcon,
suffixIcon
}) => {
if (suffixIcon === null || suffixIcon === false) {
return null;
}
if (suffixIcon === true || suffixIcon === undefined) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, picker === TIME ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_ClockCircleOutlined, null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_CalendarOutlined, null), hasFeedback && feedbackIcon);
}
return suffixIcon;
};
/* harmony default export */ var generatePicker_useSuffixIcon = (useSuffixIcon);
;// ./components/date-picker/PickerButton.tsx
const PickerButton = props => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(button_Button, {
size: "small",
type: "primary",
...props
}));
/* harmony default export */ var date_picker_PickerButton = (PickerButton);
;// ./components/date-picker/generatePicker/useComponents.ts
function useComponents_useComponents(components) {
return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => ({
button: date_picker_PickerButton,
...components
}), [components]);
}
;// ./components/date-picker/generatePicker/generateRangePicker.tsx
const generateRangePicker = generateConfig => {
const RangePicker = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((props, ref) => {
const {
prefixCls: customizePrefixCls,
getPopupContainer: customGetPopupContainer,
components,
className,
style,
classNames,
styles,
placement,
size: customizeSize,
disabled: customDisabled,
bordered = true,
placeholder,
status: customStatus,
variant: customVariant,
picker,
dropdownClassName,
popupClassName,
popupStyle,
rootClassName,
suffixIcon,
separator,
...restProps
} = props;
const pickerType = picker === TIME ? 'timePicker' : 'datePicker';
// ====================== Warning =======================
if (true) {
const warning = (0,_util_warning.devUseWarning)('DatePicker.RangePicker');
const deprecatedProps = {
dropdownClassName: 'classNames.popup.root',
popupClassName: 'classNames.popup.root',
popupStyle: 'styles.popup.root',
bordered: 'variant',
onSelect: 'onCalendarChange'
};
Object.entries(deprecatedProps).forEach(([oldProp, newProp]) => {
warning.deprecated(!(oldProp in props), oldProp, newProp);
});
}
const [mergedClassNames, mergedStyles] = hooks_useMergedPickerSemantic(pickerType, classNames, styles, popupClassName || dropdownClassName, popupStyle);
const innerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const {
getPrefixCls,
direction,
getPopupContainer,
rangePicker
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('picker', customizePrefixCls);
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
const rootPrefixCls = getPrefixCls();
const mergedSeparator = separator ?? rangePicker?.separator;
const [variant, enableVariantCls] = useVariants('rangePicker', customVariant, bordered);
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,date_picker_style["default"])(prefixCls, rootCls);
const mergedRootClassName = (0,clsx.clsx)(hashId, cssVarCls, rootCls, rootClassName);
// ===================== Icon =====================
const [mergedAllowClear] = util_useIcons(props, prefixCls);
// ================== components ==================
const mergedComponents = useComponents_useComponents(components);
// ===================== Size =====================
const mergedSize = (0,useSize["default"])(ctx => customizeSize ?? compactSize ?? ctx);
// ===================== Disabled =====================
const disabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
const mergedDisabled = customDisabled ?? disabled;
// ===================== FormItemInput =====================
const formItemContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(FormItemInputContext);
const {
hasFeedback,
status: contextStatus,
feedbackIcon
} = formItemContext;
const mergedSuffixIcon = generatePicker_useSuffixIcon({
picker,
hasFeedback,
feedbackIcon,
suffixIcon
});
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref, () => innerRef.current);
const [contextLocale] = (0,useLocale["default"])('Calendar', date_picker_locale_en_US["default"]);
const locale = (0,es.merge)(contextLocale, props.locale || {});
// ============================ zIndex ============================
const [zIndex] = (0,useZIndex.useZIndex)('DatePicker', mergedStyles?.popup?.root?.zIndex);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(_util_ContextIsolator, {
space: true
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PickerInput_RangePicker, {
separator: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
"aria-label": "to",
className: `${prefixCls}-separator`
}, mergedSeparator ?? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_SwapRightOutlined, null)),
disabled: mergedDisabled,
ref: innerRef,
placement: placement,
placeholder: getRangePlaceholder(locale, picker, placeholder),
suffixIcon: mergedSuffixIcon,
prevIcon: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-prev-icon`
}),
nextIcon: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-next-icon`
}),
superPrevIcon: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-super-prev-icon`
}),
superNextIcon: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-super-next-icon`
}),
transitionName: `${rootPrefixCls}-slide-up`,
picker: picker,
...restProps,
locale: locale.lang,
getPopupContainer: customGetPopupContainer || getPopupContainer,
generateConfig: generateConfig,
components: mergedComponents,
direction: direction,
// Style
prefixCls: prefixCls,
rootClassName: mergedRootClassName,
className: (0,clsx.clsx)({
[`${prefixCls}-large`]: mergedSize === 'large',
[`${prefixCls}-small`]: mergedSize === 'small',
[`${prefixCls}-${variant}`]: enableVariantCls
}, getStatusClassNames(prefixCls, getMergedStatus(contextStatus, customStatus), hasFeedback), compactItemClassnames, className, rangePicker?.className),
style: {
...rangePicker?.style,
...style
},
// Semantic Style
classNames: mergedClassNames,
styles: {
...mergedStyles,
popup: {
...mergedStyles.popup,
root: {
...mergedStyles.popup.root,
zIndex
}
}
},
allowClear: mergedAllowClear
}));
});
if (true) {
RangePicker.displayName = 'RangePicker';
}
return RangePicker;
};
/* harmony default export */ var generatePicker_generateRangePicker = (generateRangePicker);
;// ./components/date-picker/generatePicker/generateSinglePicker.tsx
const generatePicker = generateConfig => {
const getPicker = (picker, displayName) => {
const pickerType = displayName === TIMEPICKER ? 'timePicker' : 'datePicker';
const Picker = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((props, ref) => {
const {
prefixCls: customizePrefixCls,
getPopupContainer: customizeGetPopupContainer,
components,
style,
className,
size: customizeSize,
bordered,
placement,
placeholder,
disabled: customDisabled,
status: customStatus,
variant: customVariant,
onCalendarChange,
classNames,
styles,
dropdownClassName,
popupClassName,
popupStyle,
rootClassName,
suffixIcon,
...restProps
} = props;
const {
suffixIcon: contextSuffixIcon
} = (0,config_provider_context.useComponentConfig)(displayName === TIMEPICKER ? 'timePicker' : 'datePicker');
// ====================== Warning =======================
if (true) {
const warning = (0,_util_warning.devUseWarning)(displayName || 'DatePicker');
true ? warning(picker !== 'quarter', 'deprecated', `DatePicker.${displayName} is legacy usage. Please use DatePicker[picker='${picker}'] directly.`) : 0;
const deprecatedProps = {
dropdownClassName: 'classNames.popup.root',
popupClassName: 'classNames.popup.root',
popupStyle: 'styles.popup.root',
bordered: 'variant',
onSelect: 'onCalendarChange'
};
Object.entries(deprecatedProps).forEach(([oldProp, newProp]) => {
warning.deprecated(!(oldProp in props), oldProp, newProp);
});
}
const {
getPrefixCls,
direction,
getPopupContainer,
// Consume different styles according to different names
[pickerType]: contextPickerConfig
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('picker', customizePrefixCls);
// ===================== Size =====================
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
const mergedSize = (0,useSize["default"])(ctx => customizeSize ?? compactSize ?? ctx);
// ===================== Disabled =====================
const disabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
const mergedDisabled = customDisabled ?? disabled;
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
size: mergedSize,
disabled: mergedDisabled,
status: customStatus,
variant: customVariant
};
// ========================= Style ==========================
// Use original useMergedPickerSemantic for proper popup handling
const [mergedClassNames, mergedStyles] = hooks_useMergedPickerSemantic(pickerType, classNames, styles, popupClassName || dropdownClassName, popupStyle, mergedProps);
const innerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const [variant, enableVariantCls] = useVariants('datePicker', customVariant, bordered);
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,date_picker_style["default"])(prefixCls, rootCls);
const mergedRootClassName = (0,clsx.clsx)(hashId, cssVarCls, rootCls, rootClassName);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref, () => innerRef.current);
const additionalProps = {
showToday: true
};
const mergedPicker = picker || props.picker;
const rootPrefixCls = getPrefixCls();
// ==================== Legacy =====================
const {
onSelect,
multiple
} = restProps;
const hasLegacyOnSelect = onSelect && picker === 'time' && !multiple;
const onInternalCalendarChange = (date, dateStr, info) => {
onCalendarChange?.(date, dateStr, info);
if (hasLegacyOnSelect) {
onSelect(date);
}
};
// ===================== Icon =====================
const [mergedAllowClear, removeIcon] = util_useIcons(props, prefixCls);
// ================== components ==================
const mergedComponents = useComponents_useComponents(components);
// ===================== FormItemInput =====================
const formItemContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(FormItemInputContext);
const {
hasFeedback,
status: contextStatus,
feedbackIcon
} = formItemContext;
const mergedSuffixIcon = generatePicker_useSuffixIcon({
picker: mergedPicker,
hasFeedback,
feedbackIcon,
suffixIcon: suffixIcon === undefined ? contextSuffixIcon : suffixIcon
});
const [contextLocale] = (0,useLocale["default"])('DatePicker', date_picker_locale_en_US["default"]);
const locale = (0,es.merge)(contextLocale, props.locale || {});
// ============================ zIndex ============================
const [zIndex] = (0,useZIndex.useZIndex)('DatePicker', mergedStyles?.popup?.root?.zIndex);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(_util_ContextIsolator, {
space: true
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(picker_es, {
ref: innerRef,
placeholder: getPlaceholder(locale, mergedPicker, placeholder),
suffixIcon: mergedSuffixIcon,
placement: placement,
prevIcon: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-prev-icon`
}),
nextIcon: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-next-icon`
}),
superPrevIcon: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-super-prev-icon`
}),
superNextIcon: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-super-next-icon`
}),
transitionName: `${rootPrefixCls}-slide-up`,
picker: picker,
onCalendarChange: onInternalCalendarChange,
...additionalProps,
...restProps,
locale: locale.lang,
getPopupContainer: customizeGetPopupContainer || getPopupContainer,
generateConfig: generateConfig,
components: mergedComponents,
direction: direction,
disabled: mergedDisabled,
// Style
prefixCls: prefixCls,
rootClassName: mergedRootClassName,
className: (0,clsx.clsx)({
[`${prefixCls}-large`]: mergedSize === 'large',
[`${prefixCls}-small`]: mergedSize === 'small',
[`${prefixCls}-${variant}`]: enableVariantCls
}, getStatusClassNames(prefixCls, getMergedStatus(contextStatus, customStatus), hasFeedback), compactItemClassnames, contextPickerConfig?.className, className),
style: {
...contextPickerConfig?.style,
...style
},
// Semantic Style
classNames: mergedClassNames,
styles: {
...mergedStyles,
popup: {
...mergedStyles.popup,
root: {
...mergedStyles.popup.root,
zIndex
}
}
},
allowClear: mergedAllowClear,
removeIcon: removeIcon
}));
});
if ( true && displayName) {
Picker.displayName = displayName;
}
return Picker;
};
const DatePicker = getPicker();
const WeekPicker = getPicker(WEEK, WEEKPICKER);
const MonthPicker = getPicker(MONTH, MONTHPICKER);
const YearPicker = getPicker(YEAR, YEARPICKER);
const QuarterPicker = getPicker(QUARTER, QUARTERPICKER);
const TimePicker = getPicker(TIME, TIMEPICKER);
return {
DatePicker,
WeekPicker,
MonthPicker,
YearPicker,
TimePicker,
QuarterPicker
};
};
/* harmony default export */ var generateSinglePicker = (generatePicker);
;// ./components/date-picker/generatePicker/index.tsx
const generatePicker_generatePicker = generateConfig => {
// =========================== Picker ===========================
const {
DatePicker,
WeekPicker,
MonthPicker,
YearPicker,
TimePicker,
QuarterPicker
} = generateSinglePicker(generateConfig);
// ======================== Range Picker ========================
const RangePicker = generatePicker_generateRangePicker(generateConfig);
const MergedDatePicker = DatePicker;
MergedDatePicker.WeekPicker = WeekPicker;
MergedDatePicker.MonthPicker = MonthPicker;
MergedDatePicker.YearPicker = YearPicker;
MergedDatePicker.RangePicker = RangePicker;
MergedDatePicker.TimePicker = TimePicker;
MergedDatePicker.QuarterPicker = QuarterPicker;
if (true) {
MergedDatePicker.displayName = 'DatePicker';
}
return MergedDatePicker;
};
/* harmony default export */ var date_picker_generatePicker = (generatePicker_generatePicker);
;// ./components/date-picker/index.tsx
const DatePicker = date_picker_generatePicker(dayjs);
// We don't care debug panel
/* istanbul ignore next */
const date_picker_PurePanel = _util_PurePanel(DatePicker, 'popupAlign', undefined, 'picker');
DatePicker._InternalPanelDoNotUseOrYouWillBeFired = date_picker_PurePanel;
const PureRangePanel = _util_PurePanel(DatePicker.RangePicker, 'popupAlign', undefined, 'picker');
DatePicker._InternalRangePanelDoNotUseOrYouWillBeFired = PureRangePanel;
DatePicker.generatePicker = date_picker_generatePicker;
/* harmony default export */ var date_picker = (DatePicker);
;// ./components/descriptions/constant.ts
const DEFAULT_COLUMN_MAP = {
xxxl: 4,
xxl: 3,
xl: 3,
lg: 3,
md: 3,
sm: 2,
xs: 1
};
/* harmony default export */ var constant = (DEFAULT_COLUMN_MAP);
;// ./components/descriptions/DescriptionsContext.ts
const DescriptionsContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createContext(null);
/* harmony default export */ var descriptions_DescriptionsContext = (DescriptionsContext);
;// ./components/descriptions/hooks/useItems.ts
// Convert children into items
const transChildren2Items = childNodes => (0,es.toArray)(childNodes).map(node => ({
...node?.props,
key: node.key
}));
function useItems_useItems(screens, items, children) {
const mergedItems = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() =>
// Take `items` first or convert `children` into items
items || transChildren2Items(children), [items, children]);
const responsiveItems = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => mergedItems.map(({
span,
...restItem
}) => {
if (span === 'filled') {
return {
...restItem,
filled: true
};
}
return {
...restItem,
span: (0,is.isNumber)(span) ? span : matchScreen(screens, span)
};
}), [mergedItems, screens]);
return responsiveItems;
}
;// ./components/descriptions/hooks/useRow.ts
// Calculate the sum of span in a row
function getCalcRows(rowItems, mergedColumn) {
let rows = [];
let tmpRow = [];
let exceed = false;
let count = 0;
rowItems.filter(n => n).forEach(rowItem => {
const {
filled,
...restItem
} = rowItem;
if (filled) {
tmpRow.push(restItem);
rows.push(tmpRow);
// reset
tmpRow = [];
count = 0;
return;
}
const restSpan = mergedColumn - count;
count += rowItem.span || 1;
if (count >= mergedColumn) {
if (count > mergedColumn) {
exceed = true;
tmpRow.push({
...restItem,
span: restSpan
});
} else {
tmpRow.push(restItem);
}
rows.push(tmpRow);
// reset
tmpRow = [];
count = 0;
} else {
tmpRow.push(restItem);
}
});
if (tmpRow.length > 0) {
rows.push(tmpRow);
}
rows = rows.map(rows => {
const count = rows.reduce((acc, item) => acc + (item.span || 1), 0);
if (count < mergedColumn) {
// If the span of the last element in the current row is less than the column, then add its span to the remaining columns
const last = rows[rows.length - 1];
last.span = mergedColumn - (count - (last.span || 1));
return rows;
}
return rows;
});
return [rows, exceed];
}
const useRow = (mergedColumn, items) => {
const [rows, exceed] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => getCalcRows(items, mergedColumn), [items, mergedColumn]);
if (true) {
const warning = (0,_util_warning.devUseWarning)('Descriptions');
true ? warning(!exceed, 'usage', 'Sum of column `span` in a line not match `column` of Descriptions.') : 0;
}
return rows;
};
/* harmony default export */ var hooks_useRow = (useRow);
;// ./components/descriptions/Item.ts
// JSX Structure Syntactic Sugar. Never reach the render code.
/* istanbul ignore next */
const DescriptionsItem = props => {
return props.children;
};
/* harmony default export */ var descriptions_Item = (DescriptionsItem);
;// ./components/descriptions/Cell.tsx
const Cell = props => {
const {
itemPrefixCls,
component,
span,
className,
style,
labelStyle,
contentStyle,
bordered,
label,
content,
colon,
type,
styles,
classNames
} = props;
const Component = component;
const {
classNames: contextClassNames,
styles: contextStyles
} = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(descriptions_DescriptionsContext);
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props
});
const mergedLabelStyle = {
...labelStyle,
...mergedStyles.label
};
const mergedContentStyle = {
...contentStyle,
...mergedStyles.content
};
if (bordered) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Component, {
colSpan: span,
style: style,
className: (0,clsx.clsx)(className, {
[`${itemPrefixCls}-item-${type}`]: type === 'label' || type === 'content',
[mergedClassNames.label]: mergedClassNames.label && type === 'label',
[mergedClassNames.content]: mergedClassNames.content && type === 'content'
})
}, (0,is.isNonNullable)(label) && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
style: mergedLabelStyle
}, label), (0,is.isNonNullable)(content) && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
style: mergedContentStyle
}, content));
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Component, {
className: (0,clsx.clsx)(`${itemPrefixCls}-item`, className),
style: style,
colSpan: span
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${itemPrefixCls}-item-container`
}, (0,is.isNonNullable)(label) && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
style: mergedLabelStyle,
className: (0,clsx.clsx)(`${itemPrefixCls}-item-label`, mergedClassNames.label, {
[`${itemPrefixCls}-item-no-colon`]: !colon
})
}, label)), (0,is.isNonNullable)(content) && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
style: mergedContentStyle,
className: (0,clsx.clsx)(`${itemPrefixCls}-item-content`, mergedClassNames.content)
}, content))));
};
/* harmony default export */ var descriptions_Cell = (Cell);
;// ./components/descriptions/Row.tsx
function renderCells(items, {
colon,
prefixCls,
bordered
}, {
component,
type,
showLabel,
showContent,
labelStyle: rootLabelStyle,
contentStyle: rootContentStyle,
styles: rootStyles
}) {
return items.map(({
label,
children,
prefixCls: itemPrefixCls = prefixCls,
className,
style,
labelStyle,
contentStyle,
span = 1,
key,
styles,
classNames
}, index) => {
if (typeof component === 'string') {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(descriptions_Cell, {
key: `${type}-${key || index}`,
className: className,
style: style,
classNames: classNames,
styles: {
label: {
...rootLabelStyle,
...rootStyles?.label,
...labelStyle,
...styles?.label
},
content: {
...rootContentStyle,
...rootStyles?.content,
...contentStyle,
...styles?.content
}
},
span: span,
colon: colon,
component: component,
itemPrefixCls: itemPrefixCls,
bordered: bordered,
label: showLabel ? label : null,
content: showContent ? children : null,
type: type
});
}
return [/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(descriptions_Cell, {
key: `label-${key || index}`,
className: className,
style: {
...rootLabelStyle,
...rootStyles?.label,
...style,
...labelStyle,
...styles?.label
},
span: 1,
colon: colon,
component: component[0],
itemPrefixCls: itemPrefixCls,
bordered: bordered,
label: label,
type: "label"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(descriptions_Cell, {
key: `content-${key || index}`,
className: className,
style: {
...rootContentStyle,
...rootStyles?.content,
...style,
...contentStyle,
...styles?.content
},
span: span * 2 - 1,
component: component[1],
itemPrefixCls: itemPrefixCls,
bordered: bordered,
content: children,
type: "content"
})];
});
}
const Row = props => {
const descContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(descriptions_DescriptionsContext);
const {
prefixCls,
vertical,
row,
index,
bordered
} = props;
if (vertical) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("tr", {
key: `label-${index}`,
className: `${prefixCls}-row`
}, renderCells(row, props, {
component: 'th',
type: 'label',
showLabel: true,
...descContext
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("tr", {
key: `content-${index}`,
className: `${prefixCls}-row`
}, renderCells(row, props, {
component: 'td',
type: 'content',
showContent: true,
...descContext
})));
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("tr", {
key: index,
className: `${prefixCls}-row`
}, renderCells(row, props, {
component: bordered ? ['th', 'td'] : 'td',
type: 'item',
showLabel: true,
showContent: true,
...descContext
}));
};
/* harmony default export */ var descriptions_Row = (Row);
// EXTERNAL MODULE: ./components/descriptions/style/index.ts
var descriptions_style = __webpack_require__("./components/descriptions/style/index.ts");
;// ./components/descriptions/index.tsx
/* eslint-disable react/no-array-index-key */
const Descriptions = props => {
const {
prefixCls: customizePrefixCls,
title,
extra,
column,
colon = true,
bordered,
layout,
children,
className,
rootClassName,
style,
size: customizeSize,
labelStyle,
contentStyle,
styles,
items,
classNames,
...restProps
} = props;
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('descriptions');
const prefixCls = getPrefixCls('descriptions', customizePrefixCls);
const screens = hooks_useBreakpoint();
// ============================== Warn ==============================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Descriptions');
warning.deprecated(customizeSize !== 'default', 'size="default"', 'size="large"');
[['labelStyle', 'styles.label'], ['contentStyle', 'styles.content']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
}
// Column count
const mergedColumn = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if ((0,is.isNumber)(column)) {
return column;
}
return matchScreen(screens, {
...constant,
...column
}) ?? 3;
}, [screens, column]);
// Items with responsive
const mergedItems = useItems_useItems(screens, items, children);
const mergedSize = (0,useSize["default"])(customizeSize);
const rows = hooks_useRow(mergedColumn, mergedItems);
const [hashId, cssVarCls] = (0,descriptions_style["default"])(prefixCls);
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
column: mergedColumn,
items: mergedItems,
size: mergedSize
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
// ======================== Render ========================
const memoizedValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
labelStyle,
contentStyle,
styles: {
label: mergedStyles.label,
content: mergedStyles.content
},
classNames: {
label: mergedClassNames.label,
content: mergedClassNames.content
}
}), [labelStyle, contentStyle, mergedStyles.label, mergedStyles.content, mergedClassNames.label, mergedClassNames.content]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(descriptions_DescriptionsContext.Provider, {
value: memoizedValue
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(prefixCls, contextClassName, mergedClassNames.root, {
[`${prefixCls}-medium`]: mergedSize === 'medium' || mergedSize === 'middle',
[`${prefixCls}-small`]: mergedSize === 'small',
[`${prefixCls}-bordered`]: !!bordered,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, rootClassName, hashId, cssVarCls),
style: {
...contextStyle,
...mergedStyles.root,
...style
},
...restProps
}, (title || extra) && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-header`, mergedClassNames.header),
style: mergedStyles.header
}, title && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-title`, mergedClassNames.title),
style: mergedStyles.title
}, title)), extra && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-extra`, mergedClassNames.extra),
style: mergedStyles.extra
}, extra)))), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-view`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("table", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("tbody", null, rows.map((row, index) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(descriptions_Row, {
key: index,
index: index,
colon: colon,
prefixCls: prefixCls,
vertical: layout === 'vertical',
bordered: bordered,
row: row
}))))))));
};
if (true) {
Descriptions.displayName = 'Descriptions';
}
Descriptions.Item = descriptions_Item;
/* harmony default export */ var descriptions = (Descriptions);
;// ./node_modules/@rc-component/drawer/es/context.js
const DrawerContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
const context_RefContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({});
/* harmony default export */ var drawer_es_context = (DrawerContext);
;// ./node_modules/@rc-component/drawer/es/DrawerPanel.js
function DrawerPanel_extends() { DrawerPanel_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return DrawerPanel_extends.apply(this, arguments); }
const DrawerPanel = props => {
const {
prefixCls,
className,
containerRef,
...restProps
} = props;
const {
panel: panelRef
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(context_RefContext);
const mergedRef = (0,es_ref.useComposeRef)(panelRef, containerRef);
// =============================== Render ===============================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", DrawerPanel_extends({
className: (0,clsx.clsx)(`${prefixCls}-section`, className),
role: "dialog",
ref: mergedRef
}, (0,pickAttrs["default"])(props, {
aria: true
}), {
"aria-modal": "true"
}, restProps));
};
if (true) {
DrawerPanel.displayName = 'DrawerPanel';
}
/* harmony default export */ var es_DrawerPanel = (DrawerPanel);
;// ./node_modules/@rc-component/drawer/es/hooks/useDrag.js
function useDrag_useDrag(options) {
const {
prefixCls,
direction,
className,
style,
maxSize,
containerRef,
currentSize,
onResize,
onResizeEnd,
onResizeStart
} = options;
const [isDragging, setIsDragging] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const [startPos, setStartPos] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const [startSize, setStartSize] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const isHorizontal = direction === 'left' || direction === 'right';
const handleMouseDown = (0,es.useEvent)(e => {
e.preventDefault();
e.stopPropagation();
setIsDragging(true);
if (isHorizontal) {
setStartPos(e.clientX);
} else {
setStartPos(e.clientY);
}
// Use provided currentSize, or fallback to container size
let startSize;
if (typeof currentSize === 'number') {
startSize = currentSize;
} else if (containerRef?.current) {
const rect = containerRef.current.getBoundingClientRect();
startSize = isHorizontal ? rect.width : rect.height;
}
setStartSize(startSize);
onResizeStart?.(startSize);
});
const handleMouseMove = (0,es.useEvent)(e => {
if (!isDragging) return;
const currentPos = isHorizontal ? e.clientX : e.clientY;
let delta = currentPos - startPos;
// Adjust delta direction based on placement
if (direction === 'right' || direction === 'bottom') {
delta = -delta;
}
let newSize = startSize + delta;
// Apply min/max size limits
if (newSize < 0) {
newSize = 0;
}
// Only apply maxSize if it's a valid positive number
if (maxSize && newSize > maxSize) {
newSize = maxSize;
}
onResize?.(newSize);
});
const handleMouseUp = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(() => {
if (isDragging) {
setIsDragging(false);
// Get the final size after resize
if (containerRef?.current) {
const rect = containerRef.current.getBoundingClientRect();
const finalSize = isHorizontal ? rect.width : rect.height;
onResizeEnd?.(finalSize);
}
}
}, [isDragging, containerRef, onResizeEnd, isHorizontal]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (isDragging) {
document.addEventListener('mousemove', handleMouseMove);
document.addEventListener('mouseup', handleMouseUp);
return () => {
document.removeEventListener('mousemove', handleMouseMove);
document.removeEventListener('mouseup', handleMouseUp);
};
}
}, [isDragging, handleMouseMove, handleMouseUp]);
const dragElementClassName = (0,clsx.clsx)(`${prefixCls}-dragger`, `${prefixCls}-dragger-${direction}`, {
[`${prefixCls}-dragger-dragging`]: isDragging,
[`${prefixCls}-dragger-horizontal`]: isHorizontal,
[`${prefixCls}-dragger-vertical`]: !isHorizontal
}, className);
return {
dragElementProps: {
className: dragElementClassName,
style,
onMouseDown: handleMouseDown
},
isDragging
};
}
;// ./node_modules/@rc-component/drawer/es/util.js
function parseWidthHeight(value) {
if (typeof value === 'string') {
const num = Number(value.replace(/px$/i, ''));
const floatNum = parseFloat(value);
if (floatNum === num) {
(0,warning["default"])(false, 'Invalid value type of `width` or `height` which should be number type instead.');
}
if (!Number.isNaN(num)) {
return num;
}
}
return value;
}
function warnCheck(props) {
(0,warning["default"])(!('wrapperClassName' in props), `'wrapperClassName' is removed. Please use 'rootClassName' instead.`);
(0,warning["default"])((0,canUseDom["default"])() || !props.open, `Drawer with 'open' in SSR is not work since no place to createPortal. Please move to 'useEffect' instead.`);
}
;// ./node_modules/@rc-component/drawer/es/hooks/useFocusable.js
function useFocusable_useFocusable(getContainer, open, autoFocus, focusTrap, mask) {
const mergedFocusTrap = focusTrap ?? mask !== false;
// Focus lock
const [ignoreElement] = useLockFocus(open && mergedFocusTrap, getContainer);
// Auto Focus
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(() => {
if (open && autoFocus === true) {
getContainer()?.focus({
preventScroll: true
});
}
}, [open]);
return ignoreElement;
}
;// ./node_modules/@rc-component/drawer/es/DrawerPopup.js
function DrawerPopup_extends() { DrawerPopup_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return DrawerPopup_extends.apply(this, arguments); }
const DrawerPopup = (props, ref) => {
const {
prefixCls,
open,
placement,
inline,
push,
forceRender,
// Focus
autoFocus,
focusTrap,
// classNames
classNames: drawerClassNames,
// Root
rootClassName,
rootStyle,
zIndex,
// Drawer
className,
id,
style,
motion,
width,
height,
size,
maxSize,
children,
// Mask
mask,
maskClosable,
maskMotion,
maskClassName,
maskStyle,
// Events
afterOpenChange,
onClose,
onMouseEnter,
onMouseOver,
onMouseLeave,
onClick,
onKeyDown,
onKeyUp,
styles,
drawerRender,
resizable,
defaultSize
} = props;
// ================================ Refs ================================
const panelRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => panelRef.current);
// ========================= Focusable ==========================
const ignoreElement = useFocusable_useFocusable(() => panelRef.current, open, autoFocus, focusTrap, mask);
// ============================ Push ============================
const [pushed, setPushed] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const parentContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(drawer_es_context);
// Merge push distance
let pushConfig;
if (typeof push === 'boolean') {
pushConfig = push ? {} : {
distance: 0
};
} else {
pushConfig = push || {};
}
const pushDistance = pushConfig?.distance ?? parentContext?.pushDistance ?? 180;
const mergedContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
pushDistance,
push: () => {
setPushed(true);
},
pull: () => {
setPushed(false);
}
}), [pushDistance]);
// ========================= ScrollLock =========================
// Tell parent to push
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (open) {
parentContext?.push?.();
} else {
parentContext?.pull?.();
}
}, [open]);
// Clean up
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => () => {
parentContext?.pull?.();
}, []);
// ============================ Mask ============================
const maskNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es["default"], DrawerPopup_extends({
key: "mask"
}, maskMotion, {
visible: mask && open
}), ({
className: motionMaskClassName,
style: motionMaskStyle
}, maskRef) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-mask`, motionMaskClassName, drawerClassNames?.mask, maskClassName),
style: {
...motionMaskStyle,
...maskStyle,
...styles?.mask
},
onClick: maskClosable && open ? onClose : undefined,
ref: maskRef
}));
// =========================== Panel ============================
const motionProps = typeof motion === 'function' ? motion(placement) : motion;
// ============================ Size ============================
const [currentSize, setCurrentSize] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState();
const isHorizontal = placement === 'left' || placement === 'right';
// Aggregate size logic with backward compatibility using useMemo
const mergedSize = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const legacySize = isHorizontal ? width : height;
const nextMergedSize = size ?? legacySize ?? currentSize ?? defaultSize ?? (isHorizontal ? 378 : undefined);
return parseWidthHeight(nextMergedSize);
}, [size, width, height, defaultSize, isHorizontal, currentSize]);
// >>> Style
const wrapperStyle = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const nextWrapperStyle = {};
if (pushed && pushDistance) {
switch (placement) {
case 'top':
nextWrapperStyle.transform = `translateY(${pushDistance}px)`;
break;
case 'bottom':
nextWrapperStyle.transform = `translateY(${-pushDistance}px)`;
break;
case 'left':
nextWrapperStyle.transform = `translateX(${pushDistance}px)`;
break;
default:
nextWrapperStyle.transform = `translateX(${-pushDistance}px)`;
break;
}
}
if (isHorizontal) {
nextWrapperStyle.width = parseWidthHeight(mergedSize);
} else {
nextWrapperStyle.height = parseWidthHeight(mergedSize);
}
return nextWrapperStyle;
}, [pushed, pushDistance, placement, isHorizontal, mergedSize]);
// =========================== Resize ===========================
const wrapperRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const isResizable = !!resizable;
const resizeConfig = typeof resizable === 'object' && resizable || {};
const onInternalResize = (0,es.useEvent)(size => {
setCurrentSize(size);
resizeConfig.onResize?.(size);
});
const {
dragElementProps,
isDragging
} = useDrag_useDrag({
prefixCls: `${prefixCls}-resizable`,
direction: placement,
className: drawerClassNames?.dragger,
style: styles?.dragger,
maxSize,
containerRef: wrapperRef,
currentSize: mergedSize,
onResize: onInternalResize,
onResizeStart: resizeConfig.onResizeStart,
onResizeEnd: resizeConfig.onResizeEnd
});
// =========================== Events ===========================
const eventHandlers = {
onMouseEnter,
onMouseOver,
onMouseLeave,
onClick,
onKeyDown,
onKeyUp,
onFocus: e => {
ignoreElement(e.target);
}
};
// =========================== Render ==========================
// >>>>> Panel
const panelNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es["default"], DrawerPopup_extends({
key: "panel"
}, motionProps, {
visible: open,
forceRender: forceRender,
onVisibleChanged: afterOpenChange,
removeOnLeave: false,
leavedClassName: `${prefixCls}-content-wrapper-hidden`
}), ({
className: motionClassName,
style: motionStyle
}, motionRef) => {
const content = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_DrawerPanel, DrawerPopup_extends({
id: id,
containerRef: motionRef,
prefixCls: prefixCls,
className: (0,clsx.clsx)(className, drawerClassNames?.section),
style: {
...style,
...styles?.section
}
}, (0,pickAttrs["default"])(props, {
aria: true
}), eventHandlers), children);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", DrawerPopup_extends({
ref: wrapperRef,
className: (0,clsx.clsx)(`${prefixCls}-content-wrapper`, isDragging && `${prefixCls}-content-wrapper-dragging`, drawerClassNames?.wrapper, !isDragging && motionClassName),
style: {
...motionStyle,
...wrapperStyle,
...styles?.wrapper
}
}, (0,pickAttrs["default"])(props, {
data: true
})), isResizable && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", dragElementProps), drawerRender ? drawerRender(content) : content);
});
// >>>>> Container
const containerStyle = {
...rootStyle
};
if (zIndex) {
containerStyle.zIndex = zIndex;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(drawer_es_context.Provider, {
value: mergedContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(prefixCls, `${prefixCls}-${placement}`, rootClassName, {
[`${prefixCls}-open`]: open,
[`${prefixCls}-inline`]: inline
}),
style: containerStyle,
tabIndex: -1,
ref: panelRef
}, maskNode, panelNode));
};
const RefDrawerPopup = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(DrawerPopup);
if (true) {
RefDrawerPopup.displayName = 'DrawerPopup';
}
/* harmony default export */ var es_DrawerPopup = (RefDrawerPopup);
;// ./node_modules/@rc-component/drawer/es/Drawer.js
const Drawer = props => {
const {
open = false,
prefixCls = 'rc-drawer',
placement = 'right',
autoFocus = true,
keyboard = true,
width,
height,
size,
maxSize,
mask = true,
maskClosable = true,
getContainer,
forceRender,
afterOpenChange,
destroyOnHidden,
onMouseEnter,
onMouseOver,
onMouseLeave,
onClick,
onKeyDown,
onKeyUp,
onClose,
resizable,
defaultSize,
focusTriggerAfterClose,
// Refs
panelRef
} = props;
const [animatedVisible, setAnimatedVisible] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
// ============================= Warn =============================
if (true) {
warnCheck(props);
}
// ============================= Open =============================
const [mounted, setMounted] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
(0,useLayoutEffect["default"])(() => {
setMounted(true);
}, []);
const mergedOpen = mounted ? open : false;
// ============================ Focus =============================
const popupRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const lastActiveRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
(0,useLayoutEffect["default"])(() => {
if (mergedOpen) {
lastActiveRef.current = document.activeElement;
}
}, [mergedOpen]);
// ============================= Open =============================
const internalAfterOpenChange = nextVisible => {
setAnimatedVisible(nextVisible);
afterOpenChange?.(nextVisible);
if (!nextVisible && focusTriggerAfterClose !== false && lastActiveRef.current && !popupRef.current?.contains(lastActiveRef.current)) {
lastActiveRef.current?.focus({
preventScroll: true
});
}
};
// =========================== Context ============================
const refContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
panel: panelRef
}), [panelRef]);
// ============================ Render ============================
if (!forceRender && !animatedVisible && !mergedOpen && destroyOnHidden) {
return null;
}
const eventHandlers = {
onMouseEnter,
onMouseOver,
onMouseLeave,
onClick,
onKeyDown,
onKeyUp
};
const drawerPopupProps = {
...props,
open: mergedOpen,
prefixCls,
placement,
autoFocus,
keyboard,
width,
height,
size,
maxSize,
defaultSize,
mask,
maskClosable,
inline: getContainer === false,
afterOpenChange: internalAfterOpenChange,
ref: popupRef,
resizable,
...eventHandlers
};
const onEsc = ({
top,
event
}) => {
if (top && keyboard) {
event.stopPropagation();
onClose?.(event);
}
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(context_RefContext.Provider, {
value: refContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(portal_es, {
open: mergedOpen || forceRender || animatedVisible,
autoDestroy: false,
getContainer: getContainer,
autoLock: mask && (mergedOpen || animatedVisible),
onEsc: onEsc
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_DrawerPopup, drawerPopupProps)));
};
if (true) {
Drawer.displayName = 'Drawer';
}
/* harmony default export */ var es_Drawer = (Drawer);
;// ./node_modules/@rc-component/drawer/es/index.js
// export this package's api
/* harmony default export */ var drawer_es = (es_Drawer);
;// ./components/drawer/DrawerPanel.tsx
const DrawerPanel_DrawerPanel = props => {
const {
prefixCls,
ariaId,
title,
footer,
extra,
closable,
loading,
onClose,
headerStyle,
bodyStyle,
footerStyle,
children,
classNames: drawerClassNames,
styles: drawerStyles
} = props;
const drawerContext = (0,config_provider_context.useComponentConfig)('drawer');
const {
classNames: contextClassNames,
styles: contextStyles,
closable: contextClosable
} = drawerContext;
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, drawerClassNames], [contextStyles, drawerStyles], {
props: {
...props,
closable: closable ?? contextClosable
}
});
const closablePlacement = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const merged = closable ?? contextClosable;
if (merged === false) {
return undefined;
}
if ((0,is.isPlainObject)(merged) && merged?.placement === 'end') {
return 'end';
}
return 'start';
}, [closable, contextClosable]);
const customCloseIconRender = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(icon => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
onClick: onClose,
className: (0,clsx.clsx)(`${prefixCls}-close`, {
[`${prefixCls}-close-${closablePlacement}`]: closablePlacement === 'end'
}, mergedClassNames.close),
style: mergedStyles.close
}, icon)), [onClose, prefixCls, closablePlacement, mergedClassNames.close, mergedStyles.close]);
const [mergedClosable, mergedCloseIcon] = useClosable(pickClosable(props), pickClosable(drawerContext), {
closable: true,
closeIconRender: customCloseIconRender
});
const renderHeader = () => {
if (!title && !mergedClosable) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
style: {
...mergedStyles.header,
...headerStyle
},
className: (0,clsx.clsx)(`${prefixCls}-header`, mergedClassNames.header, {
[`${prefixCls}-header-close-only`]: mergedClosable && !title && !extra
})
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-header-title`
}, closablePlacement === 'start' && mergedCloseIcon, title && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-title`, mergedClassNames.title),
style: mergedStyles.title,
id: ariaId
}, title))), extra && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-extra`, mergedClassNames.extra),
style: mergedStyles.extra
}, extra)), closablePlacement === 'end' && mergedCloseIcon);
};
const renderFooter = () => {
if (!footer) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-footer`, mergedClassNames.footer),
style: {
...mergedStyles.footer,
...footerStyle
}
}, footer);
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, renderHeader(), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-body`, mergedClassNames.body),
style: {
...mergedStyles.body,
...bodyStyle
}
}, loading ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(skeleton, {
active: true,
title: false,
paragraph: {
rows: 5
},
className: `${prefixCls}-body-skeleton`
})) : children), renderFooter());
};
/* harmony default export */ var drawer_DrawerPanel = (DrawerPanel_DrawerPanel);
// EXTERNAL MODULE: ./components/drawer/style/index.ts + 1 modules
var drawer_style = __webpack_require__("./components/drawer/style/index.ts");
;// ./components/drawer/Drawer.tsx
const _SizeTypes = ['default', 'large'];
const DEFAULT_PUSH_STATE = {
distance: 180
};
const Drawer_DEFAULT_SIZE = 378;
const MOTION_CONFIG = {
motionAppear: true,
motionEnter: true,
motionLeave: true,
motionDeadline: 500
};
const Drawer_Drawer = props => {
const {
rootClassName,
size,
defaultSize = Drawer_DEFAULT_SIZE,
height,
width,
mask: drawerMask,
push = DEFAULT_PUSH_STATE,
open,
afterOpenChange,
onClose,
prefixCls: customizePrefixCls,
getContainer: customizeGetContainer,
panelRef = null,
style,
className,
resizable,
'aria-labelledby': ariaLabelledby,
// Focus
focusable,
// Deprecated
maskClosable,
maskStyle,
drawerStyle,
contentWrapperStyle,
destroyOnClose,
destroyOnHidden,
...rest
} = props;
const {
placement
} = rest;
const id = useId();
const ariaId = rest.title ? id : undefined;
const {
getPopupContainer,
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles,
mask: contextMask
} = (0,config_provider_context.useComponentConfig)('drawer');
const prefixCls = getPrefixCls('drawer', customizePrefixCls);
const [hashId, cssVarCls] = (0,drawer_style["default"])(prefixCls);
const getContainer =
// 有可能为 false,所以不能直接判断
customizeGetContainer === undefined && getPopupContainer ? () => getPopupContainer(document.body) : customizeGetContainer;
// ============================ Size ============================
const drawerSize = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if ((0,is.isNumber)(size)) {
return size;
}
if (size === 'large') {
return 736;
}
if (size === 'default') {
return Drawer_DEFAULT_SIZE;
}
if (typeof size === 'string') {
if (/^\d+(\.\d+)?$/.test(size)) {
return Number(size);
}
return size;
}
if (!placement || placement === 'left' || placement === 'right') {
return width;
}
return height;
}, [size, placement, width, height]);
// =========================== Motion ===========================
const maskMotion = {
motionName: (0,_util_motion.getTransitionName)(prefixCls, 'mask-motion'),
...MOTION_CONFIG
};
const panelMotion = motionPlacement => ({
motionName: (0,_util_motion.getTransitionName)(prefixCls, `panel-motion-${motionPlacement}`),
...MOTION_CONFIG
});
// ============================ Refs ============================
// Select `ant-drawer-content` by `panelRef`
const innerPanelRef = usePanelRef();
const mergedPanelRef = (0,es_ref.composeRef)(panelRef, innerPanelRef);
// =========================== zIndex ===========================
const [zIndex, contextZIndex] = (0,useZIndex.useZIndex)('Drawer', rest.zIndex);
// ============================ Mask ============================
const [mergedMask, maskBlurClassName, mergedMaskClosable] = useMergedMask(drawerMask, contextMask, prefixCls, maskClosable);
// ========================== Focusable =========================
const mergedFocusable = useFocusable(focusable, getContainer !== false && mergedMask);
// =========================== Render ===========================
const {
classNames,
styles,
rootStyle
} = rest;
const mergedProps = {
...props,
zIndex,
panelRef,
mask: mergedMask,
maskClosable: mergedMaskClosable,
defaultSize,
push,
focusable: mergedFocusable
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const drawerClassName = (0,clsx.clsx)({
'no-mask': !mergedMask,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, rootClassName, hashId, cssVarCls, mergedClassNames.root);
// ========================== Warning ===========================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Drawer');
[['headerStyle', 'styles.header'], ['bodyStyle', 'styles.body'], ['footerStyle', 'styles.footer'], ['contentWrapperStyle', 'styles.wrapper'], ['maskStyle', 'styles.mask'], ['drawerStyle', 'styles.section'], ['destroyInactivePanel', 'destroyOnHidden'], ['width', 'size'], ['height', 'size']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
if (getContainer !== undefined && props.style?.position === 'absolute') {
true ? warning(false, 'breaking', '`style` is replaced by `rootStyle` in v5. Please check that `position: absolute` is necessary.') : 0;
}
warning.deprecated(!(mergedClassNames?.content || mergedStyles?.content), 'classNames.content and styles.content', 'classNames.section and styles.section');
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(_util_ContextIsolator, {
form: true,
space: true
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(zindexContext["default"].Provider, {
value: contextZIndex
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(drawer_es, {
prefixCls: prefixCls,
onClose: onClose,
maskMotion: maskMotion,
motion: panelMotion,
...rest,
classNames: {
mask: (0,clsx.clsx)(mergedClassNames.mask, maskBlurClassName.mask),
section: mergedClassNames.section,
wrapper: mergedClassNames.wrapper,
dragger: mergedClassNames.dragger
},
styles: {
mask: {
...mergedStyles.mask,
...maskStyle
},
section: {
...mergedStyles.section,
...drawerStyle
},
wrapper: {
...mergedStyles.wrapper,
...contentWrapperStyle
},
dragger: mergedStyles.dragger
},
open: open,
mask: mergedMask,
maskClosable: mergedMaskClosable,
push: push,
size: drawerSize,
defaultSize: defaultSize,
style: {
...contextStyle,
...style
},
rootStyle: {
...rootStyle,
...mergedStyles.root
},
className: (0,clsx.clsx)(contextClassName, className),
rootClassName: drawerClassName,
getContainer: getContainer,
afterOpenChange: afterOpenChange,
panelRef: mergedPanelRef,
zIndex: zIndex,
...(resizable ? {
resizable
} : {}),
"aria-labelledby": ariaLabelledby ?? ariaId,
destroyOnHidden: destroyOnHidden ?? destroyOnClose,
// Focusable
focusTriggerAfterClose: mergedFocusable.focusTriggerAfterClose,
focusTrap: mergedFocusable.trap
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(drawer_DrawerPanel, {
prefixCls: prefixCls,
size: size,
...rest,
ariaId: ariaId,
onClose: onClose
}))));
};
/** @private Internal Component. Do not use in your production. */
const Drawer_PurePanel = props => {
const {
prefixCls: customizePrefixCls,
style,
className,
placement = 'right',
...restProps
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('drawer', customizePrefixCls);
const [hashId, cssVarCls] = (0,drawer_style["default"])(prefixCls);
const cls = (0,clsx.clsx)(prefixCls, `${prefixCls}-pure`, `${prefixCls}-${placement}`, hashId, cssVarCls, className);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: cls,
style: style
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(drawer_DrawerPanel, {
prefixCls: prefixCls,
...restProps
}));
};
Drawer_Drawer._InternalPanelDoNotUseOrYouWillBeFired = Drawer_PurePanel;
if (true) {
Drawer_Drawer.displayName = 'Drawer';
}
/* harmony default export */ var drawer_Drawer = (Drawer_Drawer);
;// ./components/drawer/index.ts
/* harmony default export */ var drawer = (drawer_Drawer);
;// ./components/_util/gapSize.ts
function isPresetSize(size) {
return ['small', 'middle', 'medium', 'large'].includes(size);
}
function isValidGapNumber(size) {
if (!size) {
// The case of size = 0 is deliberately excluded here, because the default value of the gap attribute in CSS is 0, so if the user passes 0 in, we can directly ignore it.
return false;
}
return (0,is.isNumber)(size);
}
;// ./components/space/context.ts
const SpaceContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createContext({
latestIndex: 0
});
const SpaceContextProvider = SpaceContext.Provider;
;// ./components/space/Item.tsx
const space_Item_Item = props => {
const {
className,
prefix,
index,
children,
separator,
style,
classNames,
styles
} = props;
const {
latestIndex
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(SpaceContext);
if (!(0,is.isNonNullable)(children)) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: className,
style: style
}, children), index < latestIndex && separator && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(`${prefix}-item-separator`, classNames?.separator),
style: styles?.separator
}, separator)));
};
/* harmony default export */ var space_Item = (space_Item_Item);
// EXTERNAL MODULE: ./components/space/style/index.ts
var space_style = __webpack_require__("./components/space/style/index.ts");
;// ./components/space/index.tsx
const InternalSpace = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
getPrefixCls,
direction: directionConfig,
size: contextSize,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('space');
const {
size = contextSize ?? 'small',
align,
className,
rootClassName,
children,
direction,
orientation,
prefixCls: customizePrefixCls,
split,
separator,
style,
vertical,
wrap = false,
classNames,
styles,
...restProps
} = props;
const [horizontalSize, verticalSize] = Array.isArray(size) ? size : [size, size];
const isPresetVerticalSize = isPresetSize(verticalSize);
const isPresetHorizontalSize = isPresetSize(horizontalSize);
const isValidVerticalSize = isValidGapNumber(verticalSize);
const isValidHorizontalSize = isValidGapNumber(horizontalSize);
const childNodes = (0,es.toArray)(children, {
keepEmpty: true
});
const [mergedOrientation, mergedVertical] = useOrientation(orientation, vertical, direction);
const mergedAlign = align === undefined && !mergedVertical ? 'center' : align;
const mergedSeparator = separator ?? split;
const prefixCls = getPrefixCls('space', customizePrefixCls);
const [hashId, cssVarCls] = (0,space_style["default"])(prefixCls);
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
size,
orientation: mergedOrientation,
align: mergedAlign
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const rootClassNames = (0,clsx.clsx)(prefixCls, contextClassName, hashId, `${prefixCls}-${mergedOrientation}`, {
[`${prefixCls}-rtl`]: directionConfig === 'rtl',
[`${prefixCls}-align-${mergedAlign}`]: mergedAlign,
[`${prefixCls}-gap-row-${verticalSize}`]: isPresetVerticalSize,
[`${prefixCls}-gap-col-${horizontalSize}`]: isPresetHorizontalSize
}, className, rootClassName, cssVarCls, mergedClassNames.root);
const itemClassName = (0,clsx.clsx)(`${prefixCls}-item`, mergedClassNames.item);
// Calculate latest one
const renderedItems = childNodes.map((child, i) => {
const key = child?.key || `${itemClassName}-${i}`;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(space_Item, {
prefix: prefixCls,
classNames: mergedClassNames,
styles: mergedStyles,
className: itemClassName,
key: key,
index: i,
separator: mergedSeparator,
style: mergedStyles.item
}, child);
});
// ======================== Warning ==========================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Space');
[['direction', 'orientation'], ['split', 'separator']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
}
const memoizedSpaceContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const calcLatestIndex = childNodes.reduce((latest, child, i) => (0,is.isNonNullable)(child) ? i : latest, 0);
return {
latestIndex: calcLatestIndex
};
}, [childNodes]);
// =========================== Render ===========================
if (childNodes.length === 0) {
return null;
}
const gapStyle = {};
if (wrap) {
gapStyle.flexWrap = 'wrap';
}
if (!isPresetHorizontalSize && isValidHorizontalSize) {
gapStyle.columnGap = horizontalSize;
}
if (!isPresetVerticalSize && isValidVerticalSize) {
gapStyle.rowGap = verticalSize;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: ref,
className: rootClassNames,
style: {
...gapStyle,
...mergedStyles.root,
...contextStyle,
...style
},
...restProps
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(SpaceContextProvider, {
value: memoizedSpaceContext
}, renderedItems));
});
const Space = InternalSpace;
Space.Compact = space_Compact;
Space.Addon = Addon;
if (true) {
Space.displayName = 'Space';
}
/* harmony default export */ var space = (Space);
;// ./components/dropdown/dropdown-button.tsx
/** @deprecated Please use Space.Compact + Dropdown + Button instead */
const DropdownButton = props => {
const {
getPopupContainer: getContextPopupContainer,
getPrefixCls,
direction
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const {
prefixCls: customizePrefixCls,
type = 'default',
danger,
disabled,
loading,
onClick,
htmlType,
children,
className,
menu,
arrow,
autoFocus,
trigger,
align,
open,
onOpenChange,
placement,
getPopupContainer,
href,
icon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_EllipsisOutlined, null),
title,
buttonsRender = buttons => buttons,
mouseEnterDelay,
mouseLeaveDelay,
overlayClassName,
overlayStyle,
destroyOnHidden,
destroyPopupOnHide,
dropdownRender,
popupRender,
...restProps
} = props;
const prefixCls = getPrefixCls('dropdown', customizePrefixCls);
const buttonPrefixCls = `${prefixCls}-button`;
const mergedPopupRender = popupRender || dropdownRender;
const dropdownProps = {
menu,
arrow,
autoFocus,
align,
disabled,
trigger: disabled ? [] : trigger,
onOpenChange,
getPopupContainer: getPopupContainer || getContextPopupContainer,
mouseEnterDelay,
mouseLeaveDelay,
classNames: {
root: overlayClassName
},
styles: {
root: overlayStyle
},
destroyOnHidden,
popupRender: mergedPopupRender
};
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
const classes = (0,clsx.clsx)(buttonPrefixCls, compactItemClassnames, className);
if ('destroyPopupOnHide' in props) {
dropdownProps.destroyPopupOnHide = destroyPopupOnHide;
}
if ('open' in props) {
dropdownProps.open = open;
}
if ('placement' in props) {
dropdownProps.placement = placement;
} else {
dropdownProps.placement = direction === 'rtl' ? 'bottomLeft' : 'bottomRight';
}
// ============================== Warn ==============================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Dropdown.Button');
warning.deprecated(false, 'Dropdown.Button', 'Space.Compact + Dropdown + Button');
}
const leftButton = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_button, {
type: type,
danger: danger,
disabled: disabled,
loading: loading,
onClick: onClick,
htmlType: htmlType,
href: href,
title: title
}, children);
const rightButton = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_button, {
type: type,
danger: danger,
icon: icon
});
const [leftButtonToRender, rightButtonToRender] = buttonsRender([leftButton, rightButton]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(space.Compact, {
className: classes,
size: compactSize,
block: true,
...restProps
}, leftButtonToRender, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(dropdown, {
...dropdownProps
}, rightButtonToRender));
};
DropdownButton.__ANT_BUTTON = true;
/* harmony default export */ var dropdown_button = (DropdownButton);
;// ./components/dropdown/index.tsx
const components_dropdown_Dropdown = dropdown;
/** @deprecated Please use Space.Compact + Dropdown + Button instead */
components_dropdown_Dropdown.Button = dropdown_button;
/* harmony default export */ var components_dropdown = (components_dropdown_Dropdown);
// EXTERNAL MODULE: ./components/flex/style/index.ts
var flex_style = __webpack_require__("./components/flex/style/index.ts");
// EXTERNAL MODULE: ./components/flex/utils.ts
var utils = __webpack_require__("./components/flex/utils.ts");
;// ./components/flex/index.tsx
const Flex = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
rootClassName,
className,
style,
flex,
gap,
vertical,
orientation,
component: Component = 'div',
children,
...othersProps
} = props;
const {
flex: ctxFlex,
direction: ctxDirection,
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('flex', customizePrefixCls);
const [hashId, cssVarCls] = (0,flex_style["default"])(prefixCls);
const [, mergedVertical] = useOrientation(orientation, vertical ?? ctxFlex?.vertical);
const mergedCls = (0,clsx.clsx)(className, rootClassName, ctxFlex?.className, prefixCls, hashId, cssVarCls, (0,utils["default"])(prefixCls, {
...props,
vertical: mergedVertical
}), {
[`${prefixCls}-rtl`]: ctxDirection === 'rtl',
[`${prefixCls}-gap-${gap}`]: isPresetSize(gap),
[`${prefixCls}-vertical`]: mergedVertical
});
const mergedStyle = {
...ctxFlex?.style,
...style
};
if ((0,is.isNonNullable)(flex)) {
mergedStyle.flex = flex;
}
if ((0,is.isNonNullable)(gap) && !isPresetSize(gap)) {
mergedStyle.gap = gap;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Component, {
ref: ref,
className: mergedCls,
style: mergedStyle,
...(0,es.omit)(othersProps, ['justify', 'wrap', 'align'])
}, children);
});
if (true) {
Flex.displayName = 'Flex';
}
/* harmony default export */ var flex = (Flex);
;// ./components/float-button/context.ts
const context_GroupContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createContext(null);
;// ./node_modules/@ant-design/icons-svg/es/asn/FileTextOutlined.js
// This icon file is generated automatically.
var FileTextOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z" } }] }, "name": "file-text", "theme": "outlined" };
/* harmony default export */ var asn_FileTextOutlined = (FileTextOutlined);
;// ./node_modules/@ant-design/icons/es/icons/FileTextOutlined.js
function FileTextOutlined_extends() { FileTextOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return FileTextOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const FileTextOutlined_FileTextOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], FileTextOutlined_extends({}, props, {
ref: ref,
icon: asn_FileTextOutlined
}));
/** */
const FileTextOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(FileTextOutlined_FileTextOutlined);
if (true) {
FileTextOutlined_RefIcon.displayName = 'FileTextOutlined';
}
/* harmony default export */ var icons_FileTextOutlined = (FileTextOutlined_RefIcon);
;// ./components/_util/convertToTooltipProps.ts
const convertToTooltipProps = (tooltip, context) => {
if (!(0,is.isNonNullable)(tooltip)) {
return null;
}
if ((0,is.isPlainObject)(tooltip) && ! /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement)(tooltip)) {
return {
...context,
...tooltip
};
}
return {
...context,
title: tooltip
};
};
/* harmony default export */ var _util_convertToTooltipProps = (convertToTooltipProps);
// EXTERNAL MODULE: ./components/float-button/style/index.ts + 2 modules
var float_button_style = __webpack_require__("./components/float-button/style/index.ts");
;// ./components/float-button/FloatButton.tsx
const floatButtonPrefixCls = 'float-btn';
const InternalFloatButton = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
style,
type = 'default',
shape = 'circle',
icon,
description,
content,
tooltip,
badge = {},
classNames,
styles,
...restProps
} = props;
const {
getPrefixCls,
direction
} = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(config_provider_context.ConfigContext);
const groupContext = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(context_GroupContext);
const prefixCls = getPrefixCls(floatButtonPrefixCls, customizePrefixCls);
const rootCls = hooks_useCSSVarCls(prefixCls);
const {
shape: contextShape,
individual: contextIndividual,
classNames: contextClassNames,
styles: contextStyles
} = groupContext || {};
const mergedShape = contextShape || shape;
const mergedIndividual = contextIndividual ?? true;
const mergedContent = content ?? description;
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
type,
shape: mergedShape
};
// ============================ Styles ============================
const [hashId, cssVarCls] = (0,float_button_style["default"])(prefixCls, rootCls);
const floatButtonClassNames = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => ({
icon: `${prefixCls}-icon`,
content: `${prefixCls}-content`
}), [prefixCls]);
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([floatButtonClassNames, contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
// ============================= Icon =============================
const mergedIcon = !mergedContent && !icon ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_FileTextOutlined, null) : icon;
// ============================ zIndex ============================
const [zIndex] = (0,useZIndex.useZIndex)('FloatButton', style?.zIndex);
const mergedStyle = {
...style,
zIndex
};
// ============================ Badge =============================
// 虽然在 ts 中已经 omit 过了,但是为了防止多余的属性被透传进来,这里再 omit 一遍,以防万一
const badgeProps = (0,es.omit)(badge, ['title', 'children', 'status', 'text']);
const badgeNode = 'badge' in props && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_badge, {
...badgeProps,
className: (0,clsx.clsx)(badgeProps.className, `${prefixCls}-badge`, {
[`${prefixCls}-badge-dot`]: badgeProps.dot
})
}));
// =========================== Tooltip ============================
const tooltipProps = _util_convertToTooltipProps(tooltip);
// =========================== Warning ============================
if (true) {
const warning = (0,_util_warning.devUseWarning)('FloatButton');
true ? warning(!(mergedShape === 'circle' && mergedContent), 'usage', 'supported only when `shape` is `square`. Due to narrow space for text, short sentence is recommended.') : 0;
warning.deprecated(!description, 'description', 'content');
}
// ============================ Render ============================
let node = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(button_Button, {
...restProps,
ref: ref,
// Styles
className: (0,clsx.clsx)(hashId, cssVarCls, rootCls, prefixCls, className, rootClassName, `${prefixCls}-${type}`, `${prefixCls}-${mergedShape}`, {
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-individual`]: mergedIndividual,
[`${prefixCls}-icon-only`]: !mergedContent
}),
classNames: mergedClassNames,
styles: mergedStyles,
style: mergedStyle,
shape: mergedShape,
// Others
type: type,
size: "large",
icon: mergedIcon,
_skipSemantic: true
}, mergedContent, badgeNode);
if (tooltipProps) {
node = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_tooltip, {
...tooltipProps
}, node);
}
return node;
});
const FloatButton = InternalFloatButton;
if (true) {
FloatButton.displayName = 'FloatButton';
}
/* harmony default export */ var float_button_FloatButton = (FloatButton);
;// ./components/float-button/BackTop.tsx
const defaultIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_VerticalAlignTopOutlined, null);
const BackTop_BackTop = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
backTopIcon: contextIcon
} = (0,config_provider_context.useComponentConfig)('floatButton');
const {
prefixCls: customizePrefixCls,
className,
type = 'default',
shape = 'circle',
visibilityHeight = 400,
icon,
target,
onClick,
duration = 450,
...restProps
} = props;
const mergedIcon = icon ?? contextIcon ?? defaultIcon;
const [visible, setVisible] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(visibilityHeight === 0);
const internalRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useImperativeHandle(ref, () => ({
nativeElement: internalRef.current
}));
const getDefaultTarget = () => internalRef.current?.ownerDocument || window;
const handleScroll = _util_throttleByAnimationFrame(e => {
const scrollTop = _util_getScroll(e.target);
setVisible(scrollTop >= visibilityHeight);
});
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
const getTarget = target || getDefaultTarget;
const container = getTarget();
handleScroll({
target: container
});
container?.addEventListener('scroll', handleScroll);
return () => {
handleScroll.cancel();
container?.removeEventListener('scroll', handleScroll);
};
}, [target]);
const scrollToTop = e => {
scrollTo(0, {
getContainer: target || getDefaultTarget,
duration
});
onClick?.(e);
};
const {
getPrefixCls
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls(floatButtonPrefixCls, customizePrefixCls);
const rootPrefixCls = getPrefixCls();
const groupShape = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(context_GroupContext)?.shape;
const mergedShape = groupShape || shape;
const contentProps = {
prefixCls,
icon: mergedIcon,
type,
shape: mergedShape,
...restProps
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(motion_es["default"], {
visible: visible,
motionName: `${rootPrefixCls}-fade`
}, ({
className: motionClassName
}, setRef) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(float_button_FloatButton, {
ref: (0,es_ref.composeRef)(internalRef, setRef),
...contentProps,
onClick: scrollToTop,
className: (0,clsx.clsx)(className, motionClassName)
})));
});
if (true) {
BackTop_BackTop.displayName = 'FloatButton.BackTop';
}
/* harmony default export */ var float_button_BackTop = (BackTop_BackTop);
;// ./components/float-button/FloatButtonGroup.tsx
const FloatButtonGroup = props => {
const {
prefixCls: customizePrefixCls,
className,
style,
classNames,
styles,
rootClassName,
shape = 'circle',
type = 'default',
placement,
icon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_FileTextOutlined, null),
closeIcon,
trigger,
children,
onOpenChange,
open: customOpen,
onClick: onTriggerButtonClick,
...floatButtonProps
} = props;
const {
direction,
getPrefixCls,
closeIcon: contextCloseIcon,
classNames: contextClassNames,
styles: contextStyles,
className: contextClassName,
style: contextStyle
} = (0,config_provider_context.useComponentConfig)('floatButtonGroup');
const mergedCloseIcon = closeIcon ?? contextCloseIcon ?? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_CloseOutlined, null);
const prefixCls = getPrefixCls(floatButtonPrefixCls, customizePrefixCls);
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,float_button_style["default"])(prefixCls, rootCls);
const groupPrefixCls = `${prefixCls}-group`;
const isMenuMode = trigger && ['click', 'hover'].includes(trigger);
// ============================ zIndex ============================
const [zIndex] = (0,useZIndex.useZIndex)('FloatButton', style?.zIndex);
// ============================= Refs =============================
const floatButtonGroupRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
// ========================== Placement ==========================
const mergedPlacement = ['top', 'left', 'right', 'bottom'].includes(placement) ? placement : 'top';
// ========================== Open ==========================
const [open, setOpen] = (0,es.useControlledState)(false, customOpen);
const hoverTrigger = trigger === 'hover';
const clickTrigger = trigger === 'click';
const triggerOpen = (0,es.useEvent)(nextOpen => {
if (open !== nextOpen) {
setOpen(nextOpen);
onOpenChange?.(nextOpen);
}
});
// ===================== Trigger: Hover =====================
const onMouseEnter = () => {
if (hoverTrigger) {
triggerOpen(true);
}
};
const onMouseLeave = () => {
if (hoverTrigger) {
triggerOpen(false);
}
};
// ===================== Trigger: Click =====================
const onInternalTriggerButtonClick = e => {
if (clickTrigger) {
triggerOpen(!open);
}
onTriggerButtonClick?.(e);
};
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(() => {
if (clickTrigger) {
const onDocClick = e => {
// Skip if click on the group
if (floatButtonGroupRef.current?.contains(e.target)) {
return;
}
triggerOpen(false);
};
document.addEventListener('click', onDocClick, {
capture: true
});
return () => document.removeEventListener('click', onDocClick, {
capture: true
});
}
}, [clickTrigger]);
// ======================== Warning =========================
if (true) {
const warning = (0,_util_warning.devUseWarning)('FloatButton.Group');
true ? warning(!('open' in props) || !!trigger, 'usage', '`open` need to be used together with `trigger`') : 0;
}
// ======================== Contexts ========================
const individual = shape === 'circle';
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
shape,
type,
placement: mergedPlacement
};
// ============================ Styles ============================
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const listContext = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => ({
shape,
individual,
classNames: {
root: mergedClassNames.item,
icon: mergedClassNames.itemIcon,
content: mergedClassNames.itemContent
},
styles: {
root: mergedStyles.item,
icon: mergedStyles.itemIcon,
content: mergedStyles.itemContent
}
}), [shape, individual, mergedClassNames, mergedStyles]);
const triggerContext = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => ({
...listContext,
individual: true,
classNames: {
root: mergedClassNames.trigger,
icon: mergedClassNames.triggerIcon,
content: mergedClassNames.triggerContent
},
styles: {
root: mergedStyles.trigger,
icon: mergedStyles.triggerIcon,
content: mergedStyles.triggerContent
}
}), [listContext, mergedClassNames, mergedStyles]);
// ========================= Render =========================
// >>> List
let listNode;
const listCls = `${groupPrefixCls}-list`;
const renderList = motionClassName => {
const vertical = mergedPlacement === 'top' || mergedPlacement === 'bottom';
const sharedProps = {
className: (0,clsx.clsx)(listCls, mergedClassNames.list, motionClassName),
style: mergedStyles.list
};
if (individual) {
listNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(flex, {
vertical: vertical,
...sharedProps
}, children);
} else {
listNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(space.Compact, {
vertical: vertical,
...sharedProps
}, children);
}
return listNode;
};
// >>> Render
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(context_GroupContext.Provider, {
value: listContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(groupPrefixCls, hashId, cssVarCls, rootCls, contextClassName, mergedClassNames.root, className, rootClassName, {
[`${groupPrefixCls}-rtl`]: direction === 'rtl',
[`${groupPrefixCls}-individual`]: individual,
[`${groupPrefixCls}-${mergedPlacement}`]: isMenuMode,
[`${groupPrefixCls}-menu-mode`]: isMenuMode
}),
style: {
...contextStyle,
zIndex,
...mergedStyles.root,
...style
},
// ref
ref: floatButtonGroupRef,
// Hover trigger
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave
}, isMenuMode ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(motion_es["default"], {
visible: open,
motionName: `${listCls}-motion`
}, ({
className: motionClassName
}) => renderList(motionClassName))) : renderList(), isMenuMode && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(context_GroupContext.Provider, {
value: triggerContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(float_button_FloatButton, {
type: type,
icon: open ? mergedCloseIcon : icon,
"aria-label": props['aria-label'],
className: `${groupPrefixCls}-trigger`,
onClick: onInternalTriggerButtonClick,
...floatButtonProps
})))));
};
/* harmony default export */ var float_button_FloatButtonGroup = (FloatButtonGroup);
;// ./components/float-button/PurePanel.tsx
/* eslint-disable react/no-array-index-key */
const PureFloatButton = ({
backTop,
...props
}) => backTop ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(float_button_BackTop, {
...props,
visibilityHeight: 0
}) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(float_button_FloatButton, {
...props
});
/** @private Internal Component. Do not use in your production. */
const float_button_PurePanel_PurePanel = ({
className,
items,
classNames: cls,
styles,
prefixCls: customizePrefixCls,
...restProps
}) => {
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls(floatButtonPrefixCls, customizePrefixCls);
const pureCls = `${prefixCls}-pure`;
if (items) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(float_button_FloatButtonGroup, {
className: (0,clsx.clsx)(className, pureCls),
classNames: cls,
styles: styles,
...restProps
}, items.map((item, index) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PureFloatButton, {
key: index,
...item
}))));
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PureFloatButton, {
className: (0,clsx.clsx)(className, pureCls),
classNames: cls,
styles: styles,
...restProps
});
};
/* harmony default export */ var float_button_PurePanel = (float_button_PurePanel_PurePanel);
;// ./components/float-button/index.tsx
float_button_FloatButton.BackTop = float_button_BackTop;
float_button_FloatButton.Group = float_button_FloatButtonGroup;
float_button_FloatButton._InternalPanelDoNotUseOrYouWillBeFired = float_button_PurePanel;
/* harmony default export */ var float_button = (float_button_FloatButton);
;// ./components/form/hooks/useDebounce.ts
function useDebounce(value) {
const [cacheValue, setCacheValue] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(value);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
const timeout = setTimeout(() => {
setCacheValue(value);
}, value.length ? 0 : 10);
return () => {
clearTimeout(timeout);
};
}, [value]);
return cacheValue;
}
// EXTERNAL MODULE: ./components/form/style/index.ts + 1 modules
var form_style = __webpack_require__("./components/form/style/index.ts");
;// ./components/form/ErrorList.tsx
const ErrorList_EMPTY_LIST = [];
function toErrorEntity(error, prefix, errorStatus, index = 0) {
return {
key: typeof error === 'string' ? error : `${prefix}-${index}`,
error,
errorStatus
};
}
const ErrorList = ({
help,
helpStatus,
errors = ErrorList_EMPTY_LIST,
warnings = ErrorList_EMPTY_LIST,
className: rootClassName,
fieldId,
onVisibleChanged
}) => {
const {
prefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FormItemPrefixContext);
const baseClassName = `${prefixCls}-item-explain`;
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,form_style["default"])(prefixCls, rootCls);
const collapseMotion = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => (0,_util_motion["default"])(prefixCls), [prefixCls]);
// We have to debounce here again since somewhere use ErrorList directly still need no shaking
// ref: https://github.com/ant-design/ant-design/issues/36336
const debounceErrors = useDebounce(errors);
const debounceWarnings = useDebounce(warnings);
const fullKeyList = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if ((0,is.isNonNullable)(help)) {
return [toErrorEntity(help, 'help', helpStatus)];
}
return [].concat((0,toConsumableArray["default"])(debounceErrors.map((error, index) => toErrorEntity(error, 'error', 'error', index))), (0,toConsumableArray["default"])(debounceWarnings.map((warning, index) => toErrorEntity(warning, 'warning', 'warning', index))));
}, [help, helpStatus, debounceErrors, debounceWarnings]);
const filledKeyFullKeyList = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const keysCount = {};
fullKeyList.forEach(({
key
}) => {
keysCount[key] = (keysCount[key] || 0) + 1;
});
return fullKeyList.map((entity, index) => ({
...entity,
key: keysCount[entity.key] > 1 ? `${entity.key}-fallback-${index}` : entity.key
}));
}, [fullKeyList]);
const helpProps = {};
if (fieldId) {
helpProps.id = `${fieldId}_help`;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es["default"], {
motionDeadline: collapseMotion.motionDeadline,
motionName: `${prefixCls}-show-help`,
visible: !!filledKeyFullKeyList.length,
onVisibleChanged: onVisibleChanged
}, holderProps => {
const {
className: holderClassName,
style: holderStyle
} = holderProps;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
...helpProps,
className: (0,clsx.clsx)(baseClassName, holderClassName, cssVarCls, rootCls, rootClassName, hashId),
style: holderStyle
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es.CSSMotionList, {
keys: filledKeyFullKeyList,
...(0,_util_motion["default"])(prefixCls),
motionName: `${prefixCls}-show-help-item`,
component: false
}, itemProps => {
const {
key,
error,
errorStatus,
className: itemClassName,
style: itemStyle
} = itemProps;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
key: key,
className: (0,clsx.clsx)(itemClassName, {
[`${baseClassName}-${errorStatus}`]: errorStatus
}),
style: itemStyle
}, error);
}));
});
};
/* harmony default export */ var form_ErrorList = (ErrorList);
;// ./components/form/hooks/useFormWarning.ts
const names = {};
function useFormWarning({
name
}) {
const warning = (0,_util_warning.devUseWarning)('Form');
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (name) {
names[name] = (names[name] || 0) + 1;
true ? warning(names[name] <= 1, 'usage', 'There exist multiple Form with same `name`.') : 0;
return () => {
names[name] -= 1;
};
}
}, [name]);
}
;// ./components/form/Form.tsx
const Form_InternalForm = (props, ref) => {
const contextDisabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
const {
getPrefixCls,
direction,
requiredMark: contextRequiredMark,
colon: contextColon,
scrollToFirstError: contextScrollToFirstError,
className: contextClassName,
style: contextStyle,
styles: contextStyles,
classNames: contextClassNames,
tooltip: contextTooltip
} = (0,config_provider_context.useComponentConfig)('form');
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
size,
disabled = contextDisabled,
form,
colon,
labelAlign,
labelWrap,
labelCol,
wrapperCol,
layout = 'horizontal',
scrollToFirstError,
requiredMark,
onFinishFailed,
name,
style,
feedbackIcons,
variant,
classNames,
styles,
tooltip,
...restFormProps
} = props;
const mergedSize = (0,useSize["default"])(size);
const contextValidateMessages = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(validateMessagesContext);
/* eslint-disable react-hooks/rules-of-hooks */
if (true) {
// biome-ignore lint/correctness/useHookAtTopLevel: Development-only warning hook called conditionally
useFormWarning(props);
}
/* eslint-enable */
const mergedRequiredMark = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (requiredMark !== undefined) {
return requiredMark;
}
if (contextRequiredMark !== undefined) {
return contextRequiredMark;
}
return true;
}, [requiredMark, contextRequiredMark]);
const mergedColon = colon ?? contextColon;
const mergedTooltip = {
...contextTooltip,
...tooltip
};
const prefixCls = getPrefixCls('form', customizePrefixCls);
// Style
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,form_style["default"])(prefixCls, rootCls);
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
size: mergedSize,
disabled,
layout,
colon: mergedColon,
requiredMark: mergedRequiredMark
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const formClassName = (0,clsx.clsx)(prefixCls, `${prefixCls}-${layout}`, {
[`${prefixCls}-hide-required-mark`]: mergedRequiredMark === false,
// todo: remove in next major version
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-large`]: mergedSize === 'large',
[`${prefixCls}-small`]: mergedSize === 'small'
}, cssVarCls, rootCls, hashId, contextClassName, className, rootClassName, mergedClassNames.root);
const [wrapForm] = useForm_useForm(form);
const {
__INTERNAL__
} = wrapForm;
__INTERNAL__.name = name;
const formContextValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
name,
labelAlign,
labelCol,
labelWrap,
wrapperCol,
layout,
colon: mergedColon,
requiredMark: mergedRequiredMark,
itemRef: __INTERNAL__.itemRef,
form: wrapForm,
feedbackIcons,
tooltip: mergedTooltip,
classNames: mergedClassNames,
styles: mergedStyles
}), [name, labelAlign, labelCol, wrapperCol, layout, mergedColon, mergedRequiredMark, wrapForm, feedbackIcons, mergedClassNames, mergedStyles, mergedTooltip]);
const nativeElementRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
...wrapForm,
nativeElement: nativeElementRef.current?.nativeElement
}));
const scrollToField = (options, fieldName) => {
if (options) {
let defaultScrollToFirstError = {
block: 'nearest'
};
if ((0,is.isPlainObject)(options)) {
defaultScrollToFirstError = {
...defaultScrollToFirstError,
...options
};
}
wrapForm.scrollToField(fieldName, defaultScrollToFirstError);
}
};
const onInternalFinishFailed = errorInfo => {
onFinishFailed?.(errorInfo);
if (errorInfo.errorFields.length) {
const fieldName = errorInfo.errorFields[0].name;
if (scrollToFirstError !== undefined) {
scrollToField(scrollToFirstError, fieldName);
return;
}
if (contextScrollToFirstError !== undefined) {
scrollToField(contextScrollToFirstError, fieldName);
}
}
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(VariantContext.Provider, {
value: variant
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(DisabledContextProvider, {
disabled: disabled
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(SizeContext["default"].Provider, {
value: mergedSize
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(context_FormProvider, {
// This is not list in API, we pass with spread
validateMessages: contextValidateMessages
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(context_FormContext.Provider, {
value: formContextValue
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(NoFormStyle, {
status: true
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(form_es, {
id: name,
...restFormProps,
name: name,
onFinishFailed: onInternalFinishFailed,
form: wrapForm,
ref: nativeElementRef,
style: {
...mergedStyles?.root,
...contextStyle,
...style
},
className: formClassName
})))))));
};
const Form_Form = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(Form_InternalForm);
if (true) {
Form_Form.displayName = 'Form';
}
/* harmony default export */ var form_Form = (Form_Form);
;// ./components/form/hooks/useChildren.ts
function useChildren_useChildren(children) {
if (typeof children === 'function') {
return children;
}
const childList = (0,es.toArray)(children);
return childList.length <= 1 ? childList[0] : childList;
}
;// ./components/form/hooks/useFormItemStatus.ts
const useFormItemStatus = () => {
const {
status,
errors = [],
warnings = []
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FormItemInputContext);
if (true) {
const warning = (0,_util_warning.devUseWarning)('Form.Item');
true ? warning(status !== undefined, 'usage', 'Form.Item.useStatus should be used under Form.Item component. For more information: https://u.ant.design/form-item-usestatus') : 0;
}
return {
status,
errors,
warnings
};
};
// Only used for compatible package. Not promise this will work on future version.
useFormItemStatus.Context = FormItemInputContext;
/* harmony default export */ var hooks_useFormItemStatus = (useFormItemStatus);
;// ./components/form/hooks/useFrameState.ts
function useFrameState(defaultValue) {
const [value, setValue] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(defaultValue);
const frameRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const batchRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef([]);
const destroyRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
destroyRef.current = false;
return () => {
destroyRef.current = true;
raf["default"].cancel(frameRef.current);
frameRef.current = null;
};
}, []);
function setFrameValue(updater) {
if (destroyRef.current) {
return;
}
if (frameRef.current === null) {
batchRef.current = [];
frameRef.current = (0,raf["default"])(() => {
frameRef.current = null;
setValue(prevValue => {
let current = prevValue;
batchRef.current.forEach(func => {
current = func(current);
});
return current;
});
});
}
batchRef.current.push(updater);
}
return [value, setFrameValue];
}
;// ./components/form/hooks/useItemRef.ts
const useItemRef = () => {
const {
itemRef
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(context_FormContext);
const cacheRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({});
function getRef(name, children) {
// Outer caller already check the `supportRef`
const childrenRef = children && typeof children === 'object' && (0,es_ref.getNodeRef)(children);
const nameStr = name.join('_');
if (cacheRef.current.name !== nameStr || cacheRef.current.originRef !== childrenRef) {
cacheRef.current.name = nameStr;
cacheRef.current.originRef = childrenRef;
cacheRef.current.ref = (0,es_ref.composeRef)(itemRef(name), childrenRef);
}
return cacheRef.current.ref;
}
return getRef;
};
/* harmony default export */ var hooks_useItemRef = (useItemRef);
;// ./components/grid/hooks/useGutter.ts
function useGutter(gutter, screens) {
const results = [undefined, undefined];
const normalizedGutter = Array.isArray(gutter) ? gutter : [gutter, undefined];
// By default use as `xs`
const mergedScreens = screens || {
xs: true,
sm: true,
md: true,
lg: true,
xl: true,
xxl: true,
xxxl: true
};
normalizedGutter.forEach((g, index) => {
if ((0,is.isPlainObject)(g)) {
for (let i = 0; i < responsiveArray.length; i++) {
const breakpoint = responsiveArray[i];
if (mergedScreens[breakpoint] && g[breakpoint] !== undefined) {
results[index] = g[breakpoint];
break;
}
}
} else {
results[index] = g;
}
});
return results;
}
;// ./components/grid/row.tsx
const _RowAligns = ['top', 'middle', 'bottom', 'stretch'];
const _RowJustify = ['start', 'end', 'center', 'space-around', 'space-between', 'space-evenly'];
const useMergedPropByScreen = (oriProp, screen) => {
const [prop, setProp] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(() => (0,is.isString)(oriProp) ? oriProp : '');
const calcMergedAlignOrJustify = () => {
if ((0,is.isString)(oriProp)) {
setProp(oriProp);
}
if (!(0,is.isPlainObject)(oriProp)) {
return;
}
for (let i = 0; i < responsiveArray.length; i++) {
const breakpoint = responsiveArray[i];
// if do not match, do nothing
if (!screen || !screen[breakpoint]) {
continue;
}
const curVal = oriProp[breakpoint];
if (curVal !== undefined) {
setProp(curVal);
return;
}
}
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
calcMergedAlignOrJustify();
}, [JSON.stringify(oriProp), screen]);
return prop;
};
const row_Row = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
justify,
align,
className,
style,
children,
gutter = 0,
wrap,
...others
} = props;
const {
getPrefixCls,
direction
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const screens = hooks_useBreakpoint(true, null);
const mergedAlign = useMergedPropByScreen(align, screens);
const mergedJustify = useMergedPropByScreen(justify, screens);
const prefixCls = getPrefixCls('row', customizePrefixCls);
const [hashId, cssVarCls] = (0,grid_style.useRowStyle)(prefixCls);
const gutters = useGutter(gutter, screens);
const classes = (0,clsx.clsx)(prefixCls, {
[`${prefixCls}-no-wrap`]: wrap === false,
[`${prefixCls}-${mergedJustify}`]: mergedJustify,
[`${prefixCls}-${mergedAlign}`]: mergedAlign,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, hashId, cssVarCls);
// Add gutter related style
const rowStyle = {};
if (gutters?.[0]) {
const horizontalGutter = (0,is.isNumber)(gutters[0]) ? `${gutters[0] / -2}px` : `calc(${gutters[0]} / -2)`;
rowStyle.marginInline = horizontalGutter;
}
// "gutters" is a new array in each rendering phase, it'll make 'React.useMemo' effectless.
// So we deconstruct "gutters" variable here.
const [gutterH, gutterV] = gutters;
rowStyle.rowGap = gutterV;
const rowContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
gutter: [gutterH, gutterV],
wrap
}), [gutterH, gutterV, wrap]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(grid_RowContext.Provider, {
value: rowContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
...others,
className: classes,
style: {
...rowStyle,
...style
},
ref: ref
}, children));
});
if (true) {
row_Row.displayName = 'Row';
}
/* harmony default export */ var row = (row_Row);
;// ./components/form/style/fallbackCmp.ts
/**
* Fallback of IE.
* Safe to remove.
*/
// ============================= Fallback =============================
const genFallbackStyle = token => {
const {
formItemCls
} = token;
return {
'@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)': {
// Fallback for IE, safe to remove we not support it anymore
[`${formItemCls}-control`]: {
display: 'flex'
}
}
};
};
// ============================== Export ==============================
/* harmony default export */ var fallbackCmp = ((0,genStyleUtils.genSubStyleComponent)(['Form', 'item-item'], (token, {
rootPrefixCls
}) => {
const formToken = (0,form_style.prepareToken)(token, rootPrefixCls);
return genFallbackStyle(formToken);
}));
;// ./components/form/FormItemInput.tsx
const GRID_MAX = 24;
const FormItemInput = props => {
const {
prefixCls,
status,
labelCol,
wrapperCol,
children,
errors,
warnings,
_internalItemRender: formItemRender,
extra,
help,
fieldId,
marginBottom,
onErrorVisibleChanged,
label
} = props;
const baseClassName = `${prefixCls}-item`;
const formContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(context_FormContext);
const {
classNames: contextClassNames,
styles: contextStyles
} = formContext;
const mergedWrapperCol = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
let mergedWrapper = {
...(wrapperCol || formContext.wrapperCol || {})
};
if (label === null && !labelCol && !wrapperCol && formContext.labelCol) {
const list = [undefined].concat((0,toConsumableArray["default"])(responsiveArrayReversed));
list.forEach(size => {
const _size = size ? [size] : [];
const formLabel = (0,es.get)(formContext.labelCol, _size);
const formLabelObj = (0,is.isPlainObject)(formLabel) ? formLabel : {};
const wrapper = (0,es.get)(mergedWrapper, _size);
const wrapperObj = (0,is.isPlainObject)(wrapper) ? wrapper : {};
if ('span' in formLabelObj && !('offset' in wrapperObj) && formLabelObj.span < GRID_MAX) {
mergedWrapper = (0,es.set)(mergedWrapper, [].concat(_size, ['offset']), formLabelObj.span);
}
});
}
return mergedWrapper;
}, [wrapperCol, formContext.wrapperCol, formContext.labelCol, label, labelCol]);
const className = (0,clsx.clsx)(`${baseClassName}-control`, mergedWrapperCol.className);
// Pass to sub FormItem should not with col info
const subFormContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const {
labelCol: _labelCol,
wrapperCol: _wrapperCol,
...rest
} = formContext;
return rest;
}, [formContext]);
const extraRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const [extraHeight, setExtraHeight] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
(0,useLayoutEffect["default"])(() => {
if (extra && extraRef.current) {
setExtraHeight(extraRef.current.clientHeight);
} else {
setExtraHeight(0);
}
}, [extra]);
const inputDom = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${baseClassName}-control-input`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${baseClassName}-control-input-content`, contextClassNames?.content),
style: contextStyles?.content
}, children));
const formItemContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
prefixCls,
status
}), [prefixCls, status]);
const errorListDom = marginBottom !== null || errors.length || warnings.length ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(FormItemPrefixContext.Provider, {
value: formItemContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(form_ErrorList, {
fieldId: fieldId,
errors: errors,
warnings: warnings,
help: help,
helpStatus: status,
className: `${baseClassName}-explain-connected`,
onVisibleChanged: onErrorVisibleChanged
}))) : null;
const extraProps = {};
if (fieldId) {
extraProps.id = `${fieldId}_extra`;
}
// If extra = 0, && will goes wrong
// 0&&error -> 0
const extraDom = extra ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
...extraProps,
className: `${baseClassName}-extra`,
ref: extraRef
}, extra)) : null;
const additionalDom = errorListDom || extraDom ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${baseClassName}-additional`,
style: marginBottom ? {
minHeight: marginBottom + extraHeight
} : {}
}, errorListDom, extraDom)) : null;
const dom = formItemRender && formItemRender.mark === 'pro_table_render' && formItemRender.render ? formItemRender.render(props, {
input: inputDom,
errorList: errorListDom,
extra: extraDom
}) : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, inputDom, additionalDom));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(context_FormContext.Provider, {
value: subFormContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(col, {
...mergedWrapperCol,
className: className
}, dom), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(fallbackCmp, {
prefixCls: prefixCls
}));
};
/* harmony default export */ var form_FormItemInput = (FormItemInput);
;// ./node_modules/@ant-design/icons-svg/es/asn/QuestionCircleOutlined.js
// This icon file is generated automatically.
var QuestionCircleOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z" } }] }, "name": "question-circle", "theme": "outlined" };
/* harmony default export */ var asn_QuestionCircleOutlined = (QuestionCircleOutlined);
;// ./node_modules/@ant-design/icons/es/icons/QuestionCircleOutlined.js
function QuestionCircleOutlined_extends() { QuestionCircleOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return QuestionCircleOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const QuestionCircleOutlined_QuestionCircleOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], QuestionCircleOutlined_extends({}, props, {
ref: ref,
icon: asn_QuestionCircleOutlined
}));
/** */
const QuestionCircleOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(QuestionCircleOutlined_QuestionCircleOutlined);
if (true) {
QuestionCircleOutlined_RefIcon.displayName = 'QuestionCircleOutlined';
}
/* harmony default export */ var icons_QuestionCircleOutlined = (QuestionCircleOutlined_RefIcon);
;// ./components/form/FormItemLabel.tsx
const FormItemLabel = ({
prefixCls,
label,
htmlFor,
labelCol,
labelAlign,
colon,
required,
requiredMark,
tooltip,
vertical
}) => {
const [formLocale] = (0,useLocale["default"])('Form');
const {
labelAlign: contextLabelAlign,
labelCol: contextLabelCol,
labelWrap,
colon: contextColon,
classNames: contextClassNames,
styles: contextStyles,
tooltip: contextTooltip
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(context_FormContext);
if (!label) {
return null;
}
const mergedLabelCol = labelCol || contextLabelCol || {};
const mergedLabelAlign = labelAlign || contextLabelAlign;
const labelClsBasic = `${prefixCls}-item-label`;
const labelColClassName = (0,clsx.clsx)(labelClsBasic, mergedLabelAlign === 'left' && `${labelClsBasic}-left`, mergedLabelCol.className, {
[`${labelClsBasic}-wrap`]: !!labelWrap
});
let labelChildren = label;
// Keep label is original where there should have no colon
const computedColon = colon === true || contextColon !== false && colon !== false;
const haveColon = computedColon && !vertical;
// Remove duplicated user input colon
if (haveColon && typeof label === 'string' && label.trim()) {
labelChildren = label.replace(/[:|:]\s*$/, '');
}
const tooltipProps = _util_convertToTooltipProps(tooltip, contextTooltip);
if (tooltipProps) {
const tooltipNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_tooltip, {
...tooltipProps
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-item-tooltip`,
onClick: e => {
e.preventDefault();
},
tabIndex: -1
}, tooltipProps.icon || tooltipProps.children || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_QuestionCircleOutlined, null)));
labelChildren = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, labelChildren, tooltipNode);
}
// Required Mark
const isOptionalMark = requiredMark === 'optional';
const isRenderMark = typeof requiredMark === 'function';
const hideRequiredMark = requiredMark === false;
if (isRenderMark) {
labelChildren = requiredMark(labelChildren, {
required: !!required
});
} else if (isOptionalMark && !required) {
labelChildren = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, labelChildren, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-item-optional`,
title: ""
}, formLocale?.optional || en_US["default"].Form?.optional));
}
// https://github.com/ant-design/ant-design/pull/52950#discussion_r1980880316
let markType;
if (hideRequiredMark) {
markType = 'hidden';
} else if (isOptionalMark || isRenderMark) {
markType = 'optional';
}
const labelClassName = (0,clsx.clsx)(contextClassNames?.label, {
[`${prefixCls}-item-required`]: required,
[`${prefixCls}-item-required-mark-${markType}`]: markType,
[`${prefixCls}-item-no-colon`]: !computedColon
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(col, {
...mergedLabelCol,
className: labelColClassName
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("label", {
htmlFor: htmlFor,
className: labelClassName,
style: contextStyles?.label,
title: typeof label === 'string' ? label : ''
}, labelChildren));
};
/* harmony default export */ var form_FormItemLabel = (FormItemLabel);
;// ./components/form/FormItem/StatusProvider.tsx
const iconMap = {
success: icons_CheckCircleFilled,
warning: icons_ExclamationCircleFilled,
error: icons_CloseCircleFilled,
validating: icons_LoadingOutlined
};
function StatusProvider({
children,
errors,
warnings,
hasFeedback,
validateStatus,
prefixCls,
meta,
noStyle,
name
}) {
const itemPrefixCls = `${prefixCls}-item`;
const {
feedbackIcons
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(context_FormContext);
const mergedValidateStatus = getStatus(errors, warnings, meta, null, !!hasFeedback, validateStatus);
const {
isFormItemInput: parentIsFormItemInput,
status: parentStatus,
hasFeedback: parentHasFeedback,
feedbackIcon: parentFeedbackIcon,
name: parentName
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FormItemInputContext);
// ====================== Context =======================
const formItemStatusContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
let feedbackIcon;
if (hasFeedback) {
const customIcons = hasFeedback !== true && hasFeedback.icons || feedbackIcons;
const customIconNode = mergedValidateStatus && customIcons?.({
status: mergedValidateStatus,
errors,
warnings
})?.[mergedValidateStatus];
const IconNode = mergedValidateStatus ? iconMap[mergedValidateStatus] : null;
feedbackIcon = customIconNode !== false && IconNode ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(`${itemPrefixCls}-feedback-icon`, `${itemPrefixCls}-feedback-icon-${mergedValidateStatus}`)
}, customIconNode || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(IconNode, null))) : null;
}
const context = {
status: mergedValidateStatus || '',
errors,
warnings,
hasFeedback: !!hasFeedback,
feedbackIcon,
isFormItemInput: true,
name
};
// No style will follow parent context
if (noStyle) {
context.status = (mergedValidateStatus ?? parentStatus) || '';
context.isFormItemInput = parentIsFormItemInput;
context.hasFeedback = !!(hasFeedback ?? parentHasFeedback);
context.feedbackIcon = hasFeedback !== undefined ? context.feedbackIcon : parentFeedbackIcon;
context.name = name ?? parentName;
}
return context;
}, [mergedValidateStatus, hasFeedback, noStyle, parentIsFormItemInput, parentStatus]);
// ======================= Render =======================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(FormItemInputContext.Provider, {
value: formItemStatusContext
}, children);
}
/* harmony default export */ var FormItem_StatusProvider = (StatusProvider);
;// ./components/form/FormItem/ItemHolder.tsx
function ItemHolder(props) {
const {
prefixCls,
className,
rootClassName,
style,
help,
errors,
warnings,
validateStatus,
meta,
hasFeedback,
hidden,
children,
fieldId,
required,
isRequired,
onSubItemMetaChange,
layout: propsLayout,
name,
...restProps
} = props;
const itemPrefixCls = `${prefixCls}-item`;
const {
requiredMark,
layout: formLayout
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(context_FormContext);
const layout = propsLayout || formLayout;
const vertical = layout === 'vertical';
// ======================== Margin ========================
const itemRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const debounceErrors = useDebounce(errors);
const debounceWarnings = useDebounce(warnings);
const hasHelp = (0,is.isNonNullable)(help);
const hasError = !!(hasHelp || errors.length || warnings.length);
const isOnScreen = !!itemRef.current && isVisible(itemRef.current);
const [marginBottom, setMarginBottom] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
(0,useLayoutEffect["default"])(() => {
if (hasError && itemRef.current) {
// The element must be part of the DOMTree to use getComputedStyle
// https://stackoverflow.com/questions/35360711/getcomputedstyle-returns-a-cssstyledeclaration-but-all-properties-are-empty-on-a
const itemStyle = getComputedStyle(itemRef.current);
setMarginBottom(Number.parseInt(itemStyle.marginBottom, 10));
}
}, [hasError, isOnScreen]);
const onErrorVisibleChanged = nextVisible => {
if (!nextVisible) {
setMarginBottom(null);
}
};
// ======================== Status ========================
const getValidateState = (isDebounce = false) => {
const _errors = isDebounce ? debounceErrors : meta.errors;
const _warnings = isDebounce ? debounceWarnings : meta.warnings;
return getStatus(_errors, _warnings, meta, '', !!hasFeedback, validateStatus);
};
const mergedValidateStatus = getValidateState();
// ======================== Render ========================
const itemClassName = (0,clsx.clsx)(itemPrefixCls, className, rootClassName, {
[`${itemPrefixCls}-with-help`]: hasHelp || debounceErrors.length || debounceWarnings.length,
// Status
[`${itemPrefixCls}-has-feedback`]: mergedValidateStatus && hasFeedback,
[`${itemPrefixCls}-has-success`]: mergedValidateStatus === 'success',
[`${itemPrefixCls}-has-warning`]: mergedValidateStatus === 'warning',
[`${itemPrefixCls}-has-error`]: mergedValidateStatus === 'error',
[`${itemPrefixCls}-is-validating`]: mergedValidateStatus === 'validating',
[`${itemPrefixCls}-hidden`]: hidden,
// Layout
[`${itemPrefixCls}-${layout}`]: layout
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: itemClassName,
style: style,
ref: itemRef
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(row, {
className: `${itemPrefixCls}-row`,
...(0,es.omit)(restProps, ['_internalItemRender', 'colon', 'dependencies', 'extra', 'fieldKey', 'getValueFromEvent', 'getValueProps', 'htmlFor', 'id',
// It is deprecated because `htmlFor` is its replacement.
'initialValue', 'isListField', 'label', 'labelAlign', 'labelCol', 'labelWrap', 'messageVariables', 'name', 'normalize', 'noStyle', 'preserve', 'requiredMark', 'rules', 'shouldUpdate', 'trigger', 'tooltip', 'validateFirst', 'validateTrigger', 'valuePropName', 'wrapperCol', 'validateDebounce'])
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(form_FormItemLabel, {
htmlFor: fieldId,
...props,
requiredMark: requiredMark,
required: required ?? isRequired,
prefixCls: prefixCls,
vertical: vertical
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(form_FormItemInput, {
...props,
...meta,
errors: debounceErrors,
warnings: debounceWarnings,
prefixCls: prefixCls,
status: mergedValidateStatus,
help: help,
marginBottom: marginBottom,
onErrorVisibleChanged: onErrorVisibleChanged
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(NoStyleItemContext.Provider, {
value: onSubItemMetaChange
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(FormItem_StatusProvider, {
prefixCls: prefixCls,
meta: meta,
errors: meta.errors,
warnings: meta.warnings,
hasFeedback: hasFeedback,
// Already calculated
validateStatus: mergedValidateStatus,
name: name
}, children)))), !!marginBottom && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${itemPrefixCls}-margin-offset`,
style: {
marginBottom: -marginBottom
}
})));
}
;// ./components/form/FormItem/index.tsx
const NAME_SPLIT = '__SPLIT__';
const _ValidateStatuses = ['success', 'warning', 'error', 'validating', ''];
// https://github.com/ant-design/ant-design/issues/46417
// `getValueProps` may modify the value props name,
// we should check if the control is similar.
function isSimilarControl(a, b) {
const keysA = Object.keys(a);
const keysB = Object.keys(b);
return keysA.length === keysB.length && keysA.every(key => {
const propValueA = a[key];
const propValueB = b[key];
return propValueA === propValueB || typeof propValueA === 'function' || typeof propValueB === 'function';
});
}
const MemoInput = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo(props => props.children, (prev, next) => isSimilarControl(prev.control, next.control) && prev.update === next.update && prev.childProps.length === next.childProps.length && prev.childProps.every((value, index) => value === next.childProps[index]));
function genEmptyMeta() {
return {
errors: [],
warnings: [],
touched: false,
validating: false,
name: [],
validated: false
};
}
function InternalFormItem(props) {
const {
name,
noStyle,
className,
dependencies,
prefixCls: customizePrefixCls,
shouldUpdate,
rules,
children,
required,
label,
messageVariables,
trigger = 'onChange',
validateTrigger,
hidden,
help,
layout
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const {
name: formName
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(context_FormContext);
const mergedChildren = useChildren_useChildren(children);
const isRenderProps = typeof mergedChildren === 'function';
const notifyParentMetaChange = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(NoStyleItemContext);
const {
validateTrigger: contextValidateTrigger
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FieldContext);
const mergedValidateTrigger = (0,is.isNonNullable)(validateTrigger) ? validateTrigger : contextValidateTrigger;
const hasName = (0,is.isNonNullable)(name);
const prefixCls = getPrefixCls('form', customizePrefixCls);
// Style
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,form_style["default"])(prefixCls, rootCls);
// ========================= Warn =========================
const warning = (0,_util_warning.devUseWarning)('Form.Item');
if (true) {
true ? warning(name !== null, 'usage', '`null` is passed as `name` property') : 0;
}
// ========================= MISC =========================
// Get `noStyle` required info
const listContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(es_ListContext);
const fieldKeyPathRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
// ======================== Errors ========================
// >>>>> Collect sub field errors
const [subFieldErrors, setSubFieldErrors] = useFrameState({});
// >>>>> Current field errors
const [meta, setMeta] = (0,useState["default"])(() => genEmptyMeta());
const onMetaChange = nextMeta => {
// This keyInfo is not correct when field is removed
// Since origin keyManager no longer keep the origin key anymore
// Which means we need cache origin one and reuse when removed
const keyInfo = listContext?.getKey(nextMeta.name);
// Destroy will reset all the meta
setMeta(nextMeta.destroy ? genEmptyMeta() : nextMeta, true);
// Bump to parent since noStyle
if (noStyle && help !== false && notifyParentMetaChange) {
let namePath = nextMeta.name;
if (!nextMeta.destroy) {
if (keyInfo !== undefined) {
const [fieldKey, restPath] = keyInfo;
namePath = [fieldKey].concat((0,toConsumableArray["default"])(restPath));
fieldKeyPathRef.current = namePath;
}
} else {
// Use origin cache data
namePath = fieldKeyPathRef.current || namePath;
}
notifyParentMetaChange(nextMeta, namePath);
}
};
// >>>>> Collect noStyle Field error to the top FormItem
const onSubItemMetaChange = (subMeta, uniqueKeys) => {
// Only `noStyle` sub item will trigger
setSubFieldErrors(prevSubFieldErrors => {
const clone = {
...prevSubFieldErrors
};
// name: ['user', 1] + key: [4] = ['user', 4]
const mergedNamePath = [].concat((0,toConsumableArray["default"])(subMeta.name.slice(0, -1)), (0,toConsumableArray["default"])(uniqueKeys));
const mergedNameKey = mergedNamePath.join(NAME_SPLIT);
if (subMeta.destroy) {
// Remove
delete clone[mergedNameKey];
} else {
// Update
clone[mergedNameKey] = subMeta;
}
return clone;
});
};
// >>>>> Get merged errors
const [mergedErrors, mergedWarnings] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const errorList = (0,toConsumableArray["default"])(meta.errors);
const warningList = (0,toConsumableArray["default"])(meta.warnings);
Object.values(subFieldErrors).forEach(subFieldError => {
errorList.push.apply(errorList, (0,toConsumableArray["default"])(subFieldError.errors || []));
warningList.push.apply(warningList, (0,toConsumableArray["default"])(subFieldError.warnings || []));
});
return [errorList, warningList];
}, [subFieldErrors, meta.errors, meta.warnings]);
// ===================== Children Ref =====================
const getItemRef = hooks_useItemRef();
// ======================== Render ========================
function renderLayout(baseChildren, fieldId, isRequired) {
if (noStyle && !hidden) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(FormItem_StatusProvider, {
prefixCls: prefixCls,
hasFeedback: props.hasFeedback,
validateStatus: props.validateStatus,
meta: meta,
errors: mergedErrors,
warnings: mergedWarnings,
noStyle: true,
name: name
}, baseChildren);
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(ItemHolder, {
key: "row",
...props,
className: (0,clsx.clsx)(className, cssVarCls, rootCls, hashId),
prefixCls: prefixCls,
fieldId: fieldId,
isRequired: isRequired,
errors: mergedErrors,
warnings: mergedWarnings,
meta: meta,
onSubItemMetaChange: onSubItemMetaChange,
layout: layout,
name: name
}, baseChildren);
}
if (!hasName && !isRenderProps && !dependencies) {
return renderLayout(mergedChildren);
}
let variables = {};
if (typeof label === 'string') {
variables.label = label;
} else if (name) {
variables.label = String(name);
}
if (messageVariables) {
variables = {
...variables,
...messageVariables
};
}
// >>>>> With Field
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Field, {
...props,
messageVariables: variables,
trigger: trigger,
validateTrigger: mergedValidateTrigger,
onMetaChange: onMetaChange
}, (control, renderMeta, context) => {
const mergedName = util_toArray(name).length && renderMeta ? renderMeta.name : [];
const fieldId = getFieldId(mergedName, formName);
const isRequired = required !== undefined ? required : rules?.some(rule => {
if ((0,is.isPlainObject)(rule) && rule.required && !rule.warningOnly) {
return true;
}
if (typeof rule === 'function') {
const ruleEntity = rule(context);
return ruleEntity?.required && !ruleEntity?.warningOnly;
}
return false;
});
// ======================= Children =======================
const mergedControl = {
...control
};
let childNode = null;
true ? warning(!(shouldUpdate && dependencies), 'usage', "`shouldUpdate` and `dependencies` shouldn't be used together. See https://u.ant.design/form-deps.") : 0;
if (Array.isArray(mergedChildren) && hasName) {
true ? warning(false, 'usage', 'A `Form.Item` with a `name` prop must have a single child element. For information on how to render more complex form items, see https://u.ant.design/complex-form-item.') : 0;
childNode = mergedChildren;
} else if (isRenderProps && (!(shouldUpdate || dependencies) || hasName)) {
true ? warning(!!(shouldUpdate || dependencies), 'usage', 'A `Form.Item` with a render function must have either `shouldUpdate` or `dependencies`.') : 0;
true ? warning(!hasName, 'usage', 'A `Form.Item` with a render function cannot be a field, and thus cannot have a `name` prop.') : 0;
} else if (dependencies && !isRenderProps && !hasName) {
true ? warning(false, 'usage', 'Must set `name` or use a render function when `dependencies` is set.') : 0;
} else if (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(mergedChildren)) {
true ? warning(mergedChildren.props.defaultValue === undefined, 'usage', '`defaultValue` will not work on controlled Field. You should use `initialValues` of Form instead.') : 0;
const childProps = {
...mergedChildren.props,
...mergedControl
};
if (!childProps.id) {
childProps.id = fieldId;
}
if (help || mergedErrors.length > 0 || mergedWarnings.length > 0 || props.extra) {
const describedbyArr = [];
if (help || mergedErrors.length > 0) {
describedbyArr.push(`${fieldId}_help`);
}
if (props.extra) {
describedbyArr.push(`${fieldId}_extra`);
}
childProps['aria-describedby'] = describedbyArr.join(' ');
}
if (mergedErrors.length > 0) {
childProps['aria-invalid'] = 'true';
}
if (isRequired) {
childProps['aria-required'] = 'true';
}
if ((0,es.supportRef)(mergedChildren)) {
childProps.ref = getItemRef(mergedName, mergedChildren);
}
// We should keep user origin event handler
const triggers = new Set([].concat((0,toConsumableArray["default"])(util_toArray(trigger)), (0,toConsumableArray["default"])(util_toArray(mergedValidateTrigger))));
triggers.forEach(eventName => {
childProps[eventName] = (...args) => {
mergedControl[eventName]?.(...args);
mergedChildren.props[eventName]?.(...args);
};
});
// List of props that need to be watched for changes -> if changes are detected in MemoInput -> rerender
const watchingChildProps = [childProps['aria-required'], childProps['aria-invalid'], childProps['aria-describedby']];
childNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(MemoInput, {
control: mergedControl,
update: mergedChildren,
childProps: watchingChildProps
}, (0,reactNode.cloneElement)(mergedChildren, childProps));
} else if (isRenderProps && (shouldUpdate || dependencies) && !hasName) {
childNode = mergedChildren(context);
} else {
true ? warning(!mergedName.length || !!noStyle, 'usage', '`name` is only used for validate React element. If you are using Form.Item as layout display, please remove `name` instead.') : 0;
childNode = mergedChildren;
}
return renderLayout(childNode, fieldId, isRequired);
});
}
const FormItem = InternalFormItem;
FormItem.useStatus = hooks_useFormItemStatus;
/* harmony default export */ var form_FormItem = (FormItem);
;// ./components/form/FormList.tsx
const FormList = ({
prefixCls: customizePrefixCls,
children,
...props
}) => {
if (true) {
const warning = (0,_util_warning.devUseWarning)('Form.List');
true ? warning((0,is.isNumber)(props.name) || (Array.isArray(props.name) ? !!props.name.length : !!props.name), 'usage', 'Miss `name` prop.') : 0;
}
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('form', customizePrefixCls);
const contextValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
prefixCls,
status: 'error'
}), [prefixCls]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_List, {
...props
}, (fields, operation, meta) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(FormItemPrefixContext.Provider, {
value: contextValue
}, children(fields.map(field => ({
...field,
fieldKey: field.key
})), operation, {
errors: meta.errors,
warnings: meta.warnings
}))));
};
/* harmony default export */ var form_FormList = (FormList);
;// ./components/form/hooks/useFormInstance.ts
function useFormInstance() {
const {
form
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(context_FormContext);
return form;
}
;// ./components/form/index.tsx
const components_form_Form = form_Form;
components_form_Form.Item = form_FormItem;
components_form_Form.List = form_FormList;
components_form_Form.ErrorList = form_ErrorList;
components_form_Form.useForm = useForm_useForm;
components_form_Form.useFormInstance = useFormInstance;
components_form_Form.useWatch = hooks_useWatch;
components_form_Form.Provider = context_FormProvider;
/* harmony default export */ var components_form = (components_form_Form);
;// ./components/grid/index.tsx
// Do not export params
function grid_useBreakpoint() {
return hooks_useBreakpoint();
}
/* harmony default export */ var grid = ({
useBreakpoint: grid_useBreakpoint
});
;// ./node_modules/@rc-component/image/es/context.js
const PreviewGroupContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
;// ./node_modules/@rc-component/image/es/util.js
function isImageValid(src) {
return new Promise(resolve => {
if (!src) {
resolve(false);
return;
}
const img = document.createElement('img');
img.onerror = () => resolve(false);
img.onload = () => resolve(true);
img.src = src;
});
}
// ============================= Legacy =============================
function getClientSize() {
const width = document.documentElement.clientWidth;
const height = window.innerHeight || document.documentElement.clientHeight;
return {
width,
height
};
}
;// ./node_modules/@rc-component/image/es/hooks/useImageTransform.js
const initialTransform = {
x: 0,
y: 0,
rotate: 0,
scale: 1,
flipX: false,
flipY: false
};
function useImageTransform(imgRef, minScale, maxScale, onTransform) {
const frame = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const queue = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)([]);
const [transform, setTransform] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(initialTransform);
const resetTransform = action => {
setTransform(initialTransform);
if (!(0,isEqual["default"])(initialTransform, transform)) {
onTransform?.({
transform: initialTransform,
action
});
}
};
/** Direct update transform */
const updateTransform = (newTransform, action) => {
if (frame.current === null) {
queue.current = [];
frame.current = (0,raf["default"])(() => {
setTransform(preState => {
let memoState = preState;
queue.current.forEach(queueState => {
memoState = {
...memoState,
...queueState
};
});
frame.current = null;
onTransform?.({
transform: memoState,
action
});
return memoState;
});
});
}
queue.current.push({
...transform,
...newTransform
});
};
/** Scale according to the position of centerX and centerY */
const dispatchZoomChange = (ratio, action, centerX, centerY, isTouch) => {
const {
width,
height,
offsetWidth,
offsetHeight,
offsetLeft,
offsetTop
} = imgRef.current;
let newRatio = ratio;
let newScale = transform.scale * ratio;
if (newScale > maxScale) {
newScale = maxScale;
newRatio = maxScale / transform.scale;
} else if (newScale < minScale) {
// For mobile interactions, allow scaling down to the minimum scale.
newScale = isTouch ? newScale : minScale;
newRatio = newScale / transform.scale;
}
/** Default center point scaling */
const mergedCenterX = centerX ?? innerWidth / 2;
const mergedCenterY = centerY ?? innerHeight / 2;
const diffRatio = newRatio - 1;
/** Deviation calculated from image size */
const diffImgX = diffRatio * width * 0.5;
const diffImgY = diffRatio * height * 0.5;
/** The difference between the click position and the edge of the document */
const diffOffsetLeft = diffRatio * (mergedCenterX - transform.x - offsetLeft);
const diffOffsetTop = diffRatio * (mergedCenterY - transform.y - offsetTop);
/** Final positioning */
let newX = transform.x - (diffOffsetLeft - diffImgX);
let newY = transform.y - (diffOffsetTop - diffImgY);
/**
* When zooming the image
* When the image size is smaller than the width and height of the window, the position is initialized
*/
if (ratio < 1 && newScale === 1) {
const mergedWidth = offsetWidth * newScale;
const mergedHeight = offsetHeight * newScale;
const {
width: clientWidth,
height: clientHeight
} = getClientSize();
if (mergedWidth <= clientWidth && mergedHeight <= clientHeight) {
newX = 0;
newY = 0;
}
}
updateTransform({
x: newX,
y: newY,
scale: newScale
}, action);
};
return {
transform,
resetTransform,
updateTransform,
dispatchZoomChange
};
}
;// ./node_modules/@rc-component/image/es/getFixScaleEleTransPosition.js
function fixPoint(key, start, width, clientWidth) {
const startAddWidth = start + width;
const offsetStart = (width - clientWidth) / 2;
if (width > clientWidth) {
if (start > 0) {
return {
[key]: offsetStart
};
}
if (start < 0 && startAddWidth < clientWidth) {
return {
[key]: -offsetStart
};
}
} else if (start < 0 || startAddWidth > clientWidth) {
return {
[key]: start < 0 ? offsetStart : -offsetStart
};
}
return {};
}
/**
* Fix positon x,y point when
*
* Ele width && height < client
* - Back origin
*
* - Ele width | height > clientWidth | clientHeight
* - left | top > 0 -> Back 0
* - left | top + width | height < clientWidth | clientHeight -> Back left | top + width | height === clientWidth | clientHeight
*
* Regardless of other
*/
function getFixScaleEleTransPosition(width, height, left, top) {
const {
width: clientWidth,
height: clientHeight
} = getClientSize();
let fixPos = null;
if (width <= clientWidth && height <= clientHeight) {
fixPos = {
x: 0,
y: 0
};
} else if (width > clientWidth || height > clientHeight) {
fixPos = {
...fixPoint('x', left, width, clientWidth),
...fixPoint('y', top, height, clientHeight)
};
}
return fixPos;
}
;// ./node_modules/@rc-component/image/es/previewConfig.js
/** Scale the ratio base */
const BASE_SCALE_RATIO = 1;
/** The maximum zoom ratio when the mouse zooms in, adjustable */
const WHEEL_MAX_SCALE_RATIO = 1;
;// ./node_modules/@rc-component/image/es/hooks/useMouseEvent.js
function useMouseEvent(imgRef, movable, open, scaleStep, transform, updateTransform, dispatchZoomChange) {
const {
rotate,
scale,
x,
y
} = transform;
const [isMoving, setMoving] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
const startPositionInfo = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
diffX: 0,
diffY: 0,
transformX: 0,
transformY: 0
});
const onMouseDown = event => {
// Only allow main button
if (!movable || event.button !== 0) return;
event.preventDefault();
event.stopPropagation();
startPositionInfo.current = {
diffX: event.pageX - x,
diffY: event.pageY - y,
transformX: x,
transformY: y
};
setMoving(true);
};
const onMouseMove = event => {
if (open && isMoving) {
updateTransform({
x: event.pageX - startPositionInfo.current.diffX,
y: event.pageY - startPositionInfo.current.diffY
}, 'move');
}
};
const onMouseUp = () => {
if (open && isMoving) {
setMoving(false);
/** No need to restore the position when the picture is not moved, So as not to interfere with the click */
const {
transformX,
transformY
} = startPositionInfo.current;
const hasChangedPosition = x !== transformX && y !== transformY;
if (!hasChangedPosition) return;
const width = imgRef.current.offsetWidth * scale;
const height = imgRef.current.offsetHeight * scale;
// eslint-disable-next-line @typescript-eslint/no-shadow
const {
left,
top
} = imgRef.current.getBoundingClientRect();
const isRotate = rotate % 180 !== 0;
const fixState = getFixScaleEleTransPosition(isRotate ? height : width, isRotate ? width : height, left, top);
if (fixState) {
updateTransform({
...fixState
}, 'dragRebound');
}
}
};
const onWheel = event => {
if (!open || event.deltaY == 0) return;
// Scale ratio depends on the deltaY size
const scaleRatio = Math.abs(event.deltaY / 100);
// Limit the maximum scale ratio
const mergedScaleRatio = Math.min(scaleRatio, WHEEL_MAX_SCALE_RATIO);
// Scale the ratio each time
let ratio = BASE_SCALE_RATIO + mergedScaleRatio * scaleStep;
if (event.deltaY > 0) {
ratio = BASE_SCALE_RATIO / ratio;
}
dispatchZoomChange(ratio, 'wheel', event.clientX, event.clientY);
};
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (movable) {
window.addEventListener('mouseup', onMouseUp, false);
window.addEventListener('mousemove', onMouseMove, false);
try {
// Resolve if in iframe lost event
/* istanbul ignore next */
if (window.top !== window.self) {
window.top.addEventListener('mouseup', onMouseUp, false);
window.top.addEventListener('mousemove', onMouseMove, false);
}
} catch (error) {
/* istanbul ignore next */
(0,warning.warning)(false, `[rc-image] ${error}`);
}
}
return () => {
window.removeEventListener('mouseup', onMouseUp);
window.removeEventListener('mousemove', onMouseMove);
/* istanbul ignore next */
try {
window.top?.removeEventListener('mouseup', onMouseUp);
window.top?.removeEventListener('mousemove', onMouseMove);
} catch (error) {
// Do nothing
}
};
}, [open, isMoving, x, y, rotate, movable]);
return {
isMoving,
onMouseDown,
onMouseMove,
onMouseUp,
onWheel
};
}
;// ./node_modules/@rc-component/image/es/hooks/useStatus.js
function useStatus({
src,
isCustomPlaceholder,
fallback
}) {
const [status, setStatus] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(isCustomPlaceholder ? 'loading' : 'normal');
const isLoaded = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
const isError = status === 'error';
// https://github.com/react-component/image/pull/187
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
let isCurrentSrc = true;
isImageValid(src).then(isValid => {
// https://github.com/ant-design/ant-design/issues/44948
// If src changes, the previous setStatus should not be triggered
if (!isValid && isCurrentSrc) {
setStatus('error');
}
});
return () => {
isCurrentSrc = false;
};
}, [src]);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (isCustomPlaceholder && !isLoaded.current) {
setStatus('loading');
} else if (isError) {
setStatus('normal');
}
}, [src]);
const onLoad = () => {
setStatus('normal');
};
const getImgRef = img => {
isLoaded.current = false;
if (status === 'loading' && img?.complete && (img.naturalWidth || img.naturalHeight)) {
isLoaded.current = true;
onLoad();
}
};
const srcAndOnload = isError && fallback ? {
src: fallback
} : {
onLoad,
src
};
return [getImgRef, srcAndOnload, status];
}
;// ./node_modules/@rc-component/image/es/hooks/useTouchEvent.js
function getDistance(a, b) {
const x = a.x - b.x;
const y = a.y - b.y;
return Math.hypot(x, y);
}
function getCenter(oldPoint1, oldPoint2, newPoint1, newPoint2) {
// Calculate the distance each point has moved
const distance1 = getDistance(oldPoint1, newPoint1);
const distance2 = getDistance(oldPoint2, newPoint2);
// If both distances are 0, return the original points
if (distance1 === 0 && distance2 === 0) {
return [oldPoint1.x, oldPoint1.y];
}
// Calculate the ratio of the distances
const ratio = distance1 / (distance1 + distance2);
// Calculate the new center point based on the ratio
const x = oldPoint1.x + ratio * (oldPoint2.x - oldPoint1.x);
const y = oldPoint1.y + ratio * (oldPoint2.y - oldPoint1.y);
return [x, y];
}
function useTouchEvent(imgRef, movable, open, minScale, transform, updateTransform, dispatchZoomChange) {
const {
rotate,
scale,
x,
y
} = transform;
const [isTouching, setIsTouching] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
const touchPointInfo = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
point1: {
x: 0,
y: 0
},
point2: {
x: 0,
y: 0
},
eventType: 'none'
});
const updateTouchPointInfo = values => {
touchPointInfo.current = {
...touchPointInfo.current,
...values
};
};
const onTouchStart = event => {
if (!movable) return;
event.stopPropagation();
setIsTouching(true);
const {
touches = []
} = event;
if (touches.length > 1) {
// touch zoom
updateTouchPointInfo({
point1: {
x: touches[0].clientX,
y: touches[0].clientY
},
point2: {
x: touches[1].clientX,
y: touches[1].clientY
},
eventType: 'touchZoom'
});
} else {
// touch move
updateTouchPointInfo({
point1: {
x: touches[0].clientX - x,
y: touches[0].clientY - y
},
eventType: 'move'
});
}
};
const onTouchMove = event => {
const {
touches = []
} = event;
const {
point1,
point2,
eventType
} = touchPointInfo.current;
if (touches.length > 1 && eventType === 'touchZoom') {
// touch zoom
const newPoint1 = {
x: touches[0].clientX,
y: touches[0].clientY
};
const newPoint2 = {
x: touches[1].clientX,
y: touches[1].clientY
};
const [centerX, centerY] = getCenter(point1, point2, newPoint1, newPoint2);
const ratio = getDistance(newPoint1, newPoint2) / getDistance(point1, point2);
dispatchZoomChange(ratio, 'touchZoom', centerX, centerY, true);
updateTouchPointInfo({
point1: newPoint1,
point2: newPoint2,
eventType: 'touchZoom'
});
} else if (eventType === 'move') {
// touch move
updateTransform({
x: touches[0].clientX - point1.x,
y: touches[0].clientY - point1.y
}, 'move');
updateTouchPointInfo({
eventType: 'move'
});
}
};
const onTouchEnd = () => {
if (!open) return;
if (isTouching) {
setIsTouching(false);
}
updateTouchPointInfo({
eventType: 'none'
});
if (minScale > scale) {
/** When the scaling ratio is less than the minimum scaling ratio, reset the scaling ratio */
return updateTransform({
x: 0,
y: 0,
scale: minScale
}, 'touchZoom');
}
const width = imgRef.current.offsetWidth * scale;
const height = imgRef.current.offsetHeight * scale;
// eslint-disable-next-line @typescript-eslint/no-shadow
const {
left,
top
} = imgRef.current.getBoundingClientRect();
const isRotate = rotate % 180 !== 0;
const fixState = getFixScaleEleTransPosition(isRotate ? height : width, isRotate ? width : height, left, top);
if (fixState) {
updateTransform({
...fixState
}, 'dragRebound');
}
};
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
const preventDefault = e => {
e.preventDefault();
};
if (open && movable) {
window.addEventListener('touchmove', preventDefault, {
passive: false
});
}
return () => {
window.removeEventListener('touchmove', preventDefault);
};
}, [open, movable]);
return {
isTouching,
onTouchStart,
onTouchMove,
onTouchEnd
};
}
;// ./node_modules/@rc-component/image/es/Preview/CloseBtn.js
function CloseBtn(props) {
const {
prefixCls,
icon,
onClick,
className,
style
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
className: (0,clsx.clsx)(`${prefixCls}-close`, className),
style: style,
onClick: onClick
}, icon);
}
;// ./node_modules/@rc-component/image/es/Preview/Footer.js
function Preview_Footer_Footer(props) {
// 修改解构,添加缺失的属性,并提供默认值
const {
prefixCls,
showProgress,
current,
count,
showSwitch,
// Style
classNames,
styles,
// render
icons,
image,
transform,
countRender,
actionsRender,
// Scale
scale,
minScale,
maxScale,
// Actions
onActive,
onFlipY,
onFlipX,
onRotateLeft,
onRotateRight,
onZoomOut,
onZoomIn,
onClose,
onReset
} = props;
const {
left,
right,
prev,
next,
flipY,
flipX,
rotateLeft,
rotateRight,
zoomOut,
zoomIn
} = icons;
// ========================== Render ==========================
// >>>>> Progress
const progressNode = showProgress && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-progress`
}, countRender ? countRender(current + 1, count) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("bdi", null, `${current + 1} / ${count}`));
// >>>>> Actions
const actionCls = `${prefixCls}-actions-action`;
const renderOperation = ({
type,
disabled,
onClick,
icon
}) => {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
key: type,
className: (0,clsx.clsx)(actionCls, `${actionCls}-${type}`, {
[`${actionCls}-disabled`]: !!disabled
}),
onClick: onClick,
disabled: !!disabled,
"aria-label": type
}, icon);
};
const switchPrevNode = showSwitch ? renderOperation({
icon: prev ?? left,
onClick: () => onActive(-1),
type: 'prev',
disabled: current === 0
}) : undefined;
const switchNextNode = showSwitch ? renderOperation({
icon: next ?? right,
onClick: () => onActive(1),
type: 'next',
disabled: current === count - 1
}) : undefined;
const flipYNode = renderOperation({
icon: flipY,
onClick: onFlipY,
type: 'flipY'
});
const flipXNode = renderOperation({
icon: flipX,
onClick: onFlipX,
type: 'flipX'
});
const rotateLeftNode = renderOperation({
icon: rotateLeft,
onClick: onRotateLeft,
type: 'rotateLeft'
});
const rotateRightNode = renderOperation({
icon: rotateRight,
onClick: onRotateRight,
type: 'rotateRight'
});
const zoomOutNode = renderOperation({
icon: zoomOut,
onClick: onZoomOut,
type: 'zoomOut',
disabled: scale <= minScale
});
const zoomInNode = renderOperation({
icon: zoomIn,
onClick: onZoomIn,
type: 'zoomIn',
disabled: scale === maxScale
});
const actionsNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-actions`, classNames.actions),
style: styles.actions
}, flipYNode, flipXNode, rotateLeftNode, rotateRightNode, zoomOutNode, zoomInNode);
// >>>>> Render
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-footer`, classNames.footer),
style: styles.footer
}, progressNode, actionsRender ? actionsRender(actionsNode, {
icons: {
prevIcon: switchPrevNode,
nextIcon: switchNextNode,
flipYIcon: flipYNode,
flipXIcon: flipXNode,
rotateLeftIcon: rotateLeftNode,
rotateRightIcon: rotateRightNode,
zoomOutIcon: zoomOutNode,
zoomInIcon: zoomInNode
},
actions: {
onActive,
onFlipY,
onFlipX,
onRotateLeft,
onRotateRight,
onZoomOut,
onZoomIn,
onReset,
onClose
},
transform,
current,
total: count,
image
}) : actionsNode);
}
;// ./node_modules/@rc-component/image/es/Preview/PrevNext.js
function PrevNext(props) {
const {
prefixCls,
onActive,
current,
count,
icons: {
left,
right,
prev,
next
}
} = props;
const switchCls = `${prefixCls}-switch`;
const prevDisabled = current === 0;
const nextDisabled = current === count - 1;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
className: (0,clsx.clsx)(switchCls, `${switchCls}-prev`, {
[`${switchCls}-disabled`]: prevDisabled
}),
onClick: () => onActive(-1),
disabled: prevDisabled
}, prev ?? left), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
className: (0,clsx.clsx)(switchCls, `${switchCls}-next`, {
[`${switchCls}-disabled`]: nextDisabled
}),
onClick: () => onActive(1),
disabled: nextDisabled
}, next ?? right));
}
;// ./node_modules/@rc-component/image/es/Preview/index.js
function Preview_extends() { Preview_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Preview_extends.apply(this, arguments); }
// Note: if you want to add `action`,
// pls contact @zombieJ or @thinkasany first.
const PreviewImage = ({
fallback,
src,
imgRef,
...props
}) => {
const [getImgRef, srcAndOnload] = useStatus({
src,
fallback
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("img", Preview_extends({
ref: ref => {
imgRef.current = ref;
getImgRef(ref);
}
}, props, srcAndOnload));
};
const Preview = props => {
const {
prefixCls,
rootClassName,
src,
alt,
imageInfo,
fallback,
movable = true,
onClose,
open,
afterOpenChange,
maskClosable = true,
icons = {},
closeIcon,
getContainer,
current = 0,
count = 1,
countRender,
scaleStep = 0.5,
minScale = 1,
maxScale = 50,
motionName = 'fade',
imageRender,
imgCommonProps,
actionsRender,
onTransform,
onChange,
classNames = {},
styles = {},
mousePosition,
zIndex,
focusTrap = true
} = props;
const imgRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
const wrapperRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const triggerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const groupContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(PreviewGroupContext);
const showLeftOrRightSwitches = groupContext && count > 1;
const showOperationsProgress = groupContext && count >= 1;
// ======================== Transform =========================
const [enableTransition, setEnableTransition] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(true);
const {
transform,
resetTransform,
updateTransform,
dispatchZoomChange
} = useImageTransform(imgRef, minScale, maxScale, onTransform);
const {
isMoving,
onMouseDown,
onWheel
} = useMouseEvent(imgRef, movable, open, scaleStep, transform, updateTransform, dispatchZoomChange);
const {
isTouching,
onTouchStart,
onTouchMove,
onTouchEnd
} = useTouchEvent(imgRef, movable, open, minScale, transform, updateTransform, dispatchZoomChange);
const {
rotate,
scale
} = transform;
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (!enableTransition) {
setEnableTransition(true);
}
}, [enableTransition]);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (!open) {
resetTransform('close');
}
}, [open]);
// ========================== Image ===========================
const onDoubleClick = event => {
if (open) {
if (scale !== 1) {
updateTransform({
x: 0,
y: 0,
scale: 1
}, 'doubleClick');
} else {
dispatchZoomChange(BASE_SCALE_RATIO + scaleStep, 'doubleClick', event.clientX, event.clientY);
}
}
};
const imgNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(PreviewImage, Preview_extends({}, imgCommonProps, {
width: props.width,
height: props.height,
imgRef: imgRef,
className: `${prefixCls}-img`,
alt: alt,
style: {
transform: `translate3d(${transform.x}px, ${transform.y}px, 0) scale3d(${transform.flipX ? '-' : ''}${scale}, ${transform.flipY ? '-' : ''}${scale}, 1) rotate(${rotate}deg)`,
transitionDuration: (!enableTransition || isTouching) && '0s'
},
fallback: fallback,
src: src,
onWheel: onWheel,
onMouseDown: onMouseDown,
onDoubleClick: onDoubleClick,
onTouchStart: onTouchStart,
onTouchMove: onTouchMove,
onTouchEnd: onTouchEnd,
onTouchCancel: onTouchEnd
}));
const image = {
url: src,
alt,
...imageInfo
};
// ======================== Operation =========================
// >>>>> Actions
const onZoomIn = () => {
dispatchZoomChange(BASE_SCALE_RATIO + scaleStep, 'zoomIn');
};
const onZoomOut = () => {
dispatchZoomChange(BASE_SCALE_RATIO / (BASE_SCALE_RATIO + scaleStep), 'zoomOut');
};
const onRotateRight = () => {
updateTransform({
rotate: rotate + 90
}, 'rotateRight');
};
const onRotateLeft = () => {
updateTransform({
rotate: rotate - 90
}, 'rotateLeft');
};
const onFlipX = () => {
updateTransform({
flipX: !transform.flipX
}, 'flipX');
};
const onFlipY = () => {
updateTransform({
flipY: !transform.flipY
}, 'flipY');
};
const onReset = () => {
resetTransform('reset');
};
const onActive = offset => {
const nextCurrent = current + offset;
if (nextCurrent >= 0 && nextCurrent <= count - 1) {
setEnableTransition(false);
resetTransform(offset < 0 ? 'prev' : 'next');
onChange?.(nextCurrent, current);
}
};
// >>>>> Effect: Keyboard
const onKeyDown = (0,es.useEvent)(event => {
if (open) {
const {
keyCode
} = event;
if (showLeftOrRightSwitches) {
if (keyCode === KeyCode["default"].LEFT) {
onActive(-1);
} else if (keyCode === KeyCode["default"].RIGHT) {
onActive(1);
}
}
}
});
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (open) {
window.addEventListener('keydown', onKeyDown);
return () => {
window.removeEventListener('keydown', onKeyDown);
};
}
}, [open]);
// ======================= Lock Scroll ========================
const [lockScroll, setLockScroll] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(() => {
if (open) {
setLockScroll(true);
}
}, [open]);
const onVisibleChanged = nextVisible => {
if (!nextVisible) {
setLockScroll(false);
// Restore focus to the trigger element after leave animation
triggerRef.current?.focus?.();
triggerRef.current = null;
}
afterOpenChange?.(nextVisible);
};
// ========================== Portal ==========================
const [portalRender, setPortalRender] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
(0,useLayoutEffect["default"])(() => {
if (open) {
setPortalRender(true);
}
}, [open]);
const onEsc = ({
top
}) => {
if (top) {
onClose?.();
}
};
// =========================== Focus ============================
(0,useLayoutEffect["default"])(() => {
if (open) {
triggerRef.current = document.activeElement;
}
}, [open]);
useLockFocus(focusTrap && open && portalRender, () => wrapperRef.current);
// ========================== Render ==========================
const bodyStyle = {
...styles.body
};
if (mousePosition) {
bodyStyle.transformOrigin = `${mousePosition.x}px ${mousePosition.y}px`;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(portal_es, {
open: portalRender && open,
autoDestroy: false,
getContainer: getContainer,
autoLock: lockScroll,
onEsc: onEsc
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(motion_es["default"], {
motionName: motionName,
visible: portalRender && open,
motionAppear: true,
motionEnter: true,
motionLeave: true,
onVisibleChanged: onVisibleChanged
}, ({
className: motionClassName,
style: motionStyle
}) => {
const mergedStyle = {
...styles.root,
...motionStyle
};
if (zIndex) {
mergedStyle.zIndex = zIndex;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
ref: wrapperRef,
className: (0,clsx.clsx)(prefixCls, rootClassName, classNames.root, motionClassName, {
[`${prefixCls}-movable`]: movable,
[`${prefixCls}-moving`]: isMoving
}),
style: mergedStyle,
role: "dialog",
"aria-modal": "true",
"aria-label": alt,
tabIndex: -1
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-mask`, classNames.mask),
style: styles.mask,
onClick: maskClosable ? onClose : undefined
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-body`, classNames.body),
style: bodyStyle
}, imageRender ? imageRender(imgNode, {
transform,
image,
...(groupContext ? {
current
} : {})
}) : imgNode), closeIcon !== false && closeIcon !== null && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(CloseBtn, {
prefixCls: prefixCls,
icon: closeIcon === true ? icons.close : closeIcon || icons.close,
onClick: onClose,
className: classNames.close,
style: styles.close
}), showLeftOrRightSwitches && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(PrevNext, {
prefixCls: prefixCls,
current: current,
count: count,
icons: icons,
onActive: onActive
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Preview_Footer_Footer, {
prefixCls: prefixCls,
showProgress: showOperationsProgress,
current: current,
count: count,
showSwitch: showLeftOrRightSwitches
// Style
,
classNames: classNames,
styles: styles
// Render
,
image: image,
transform: transform,
icons: icons,
countRender: countRender,
actionsRender: actionsRender
// Scale
,
scale: scale,
minScale: minScale,
maxScale: maxScale
// Actions
,
onActive: onActive,
onFlipY: onFlipY,
onFlipX: onFlipX,
onRotateLeft: onRotateLeft,
onRotateRight: onRotateRight,
onZoomOut: onZoomOut,
onZoomIn: onZoomIn,
onClose: onClose,
onReset: onReset
}));
}));
};
/* harmony default export */ var es_Preview = (Preview);
;// ./node_modules/@rc-component/image/es/common.js
const COMMON_PROPS = ['crossOrigin', 'decoding', 'draggable', 'loading', 'referrerPolicy', 'sizes', 'srcSet', 'useMap', 'alt', 'fetchPriority'];
;// ./node_modules/@rc-component/image/es/hooks/usePreviewItems.js
/**
* Merge props provided `items` or context collected images
*/
function usePreviewItems(items) {
// Context collection image data
const [images, setImages] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState({});
const registerImage = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback((id, data) => {
setImages(imgs => ({
...imgs,
[id]: data
}));
return () => {
setImages(imgs => {
const cloneImgs = {
...imgs
};
delete cloneImgs[id];
return cloneImgs;
});
};
}, []);
// items
const mergedItems = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
// use `items` first
if (items) {
return items.map(item => {
if (typeof item === 'string') {
return {
data: {
src: item
}
};
}
const data = {};
Object.keys(item).forEach(key => {
if (['src', ...COMMON_PROPS].includes(key)) {
data[key] = item[key];
}
});
return {
data
};
});
}
// use registered images secondly
return Object.keys(images).reduce((total, id) => {
const {
canPreview,
data
} = images[id];
if (canPreview) {
total.push({
data,
id
});
}
return total;
}, []);
}, [items, images]);
return [mergedItems, registerImage, !!items];
}
;// ./node_modules/@rc-component/image/es/PreviewGroup.js
function PreviewGroup_extends() { PreviewGroup_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return PreviewGroup_extends.apply(this, arguments); }
const PreviewGroup_Group = ({
previewPrefixCls = 'rc-image-preview',
classNames,
styles,
children,
icons = {},
items,
preview,
fallback
}) => {
const {
open: previewOpen,
onOpenChange,
current: currentIndex,
onChange,
...restProps
} = preview && typeof preview === 'object' ? preview : {};
// ========================== Items ===========================
const [mergedItems, register, fromItems] = usePreviewItems(items);
// ========================= Preview ==========================
// >>> Index
const [current, setCurrent] = (0,useControlledState["default"])(0, currentIndex);
const [keepOpenIndex, setKeepOpenIndex] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
// >>> Image
const {
src,
...imgCommonProps
} = mergedItems[current]?.data || {};
// >>> Visible
const [isShowPreview, setShowPreview] = (0,useControlledState["default"])(!!previewOpen, previewOpen);
const triggerShowPreview = (0,useEvent["default"])(next => {
setShowPreview(next);
if (next !== isShowPreview) {
onOpenChange?.(next, {
current
});
}
});
// >>> Position
const [mousePosition, setMousePosition] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null);
const onPreviewFromImage = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback((id, imageSrc, mouseX, mouseY) => {
const index = fromItems ? mergedItems.findIndex(item => item.data.src === imageSrc) : mergedItems.findIndex(item => item.id === id);
setCurrent(index < 0 ? 0 : index);
triggerShowPreview(true);
setMousePosition({
x: mouseX,
y: mouseY
});
setKeepOpenIndex(true);
}, [mergedItems, fromItems]);
// Reset current when reopen
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (isShowPreview) {
if (!keepOpenIndex) {
setCurrent(0);
}
} else {
setKeepOpenIndex(false);
}
}, [isShowPreview]);
// ========================== Events ==========================
const onInternalChange = (next, prev) => {
setCurrent(next);
onChange?.(next, prev);
};
const onPreviewClose = () => {
triggerShowPreview(false);
setMousePosition(null);
};
// ========================= Context ==========================
const previewGroupContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
register,
onPreview: onPreviewFromImage
}), [register, onPreviewFromImage]);
// ========================== Render ==========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PreviewGroupContext.Provider, {
value: previewGroupContext
}, children, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Preview, PreviewGroup_extends({
"aria-hidden": !isShowPreview,
open: isShowPreview,
prefixCls: previewPrefixCls,
onClose: onPreviewClose,
mousePosition: mousePosition,
imgCommonProps: imgCommonProps,
src: src,
fallback: fallback,
icons: icons,
current: current,
count: mergedItems.length,
onChange: onInternalChange
}, restProps, {
classNames: classNames?.popup,
styles: styles?.popup
})));
};
/* harmony default export */ var PreviewGroup = (PreviewGroup_Group);
;// ./node_modules/@rc-component/image/es/hooks/useRegisterImage.js
let uid = 0;
function useRegisterImage(canPreview, data) {
const [id] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(() => {
uid += 1;
return String(uid);
});
const groupContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(PreviewGroupContext);
const registerData = {
data,
canPreview
};
// Keep order start
// Resolve https://github.com/ant-design/ant-design/issues/28881
// Only need unRegister when component unMount
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (groupContext) {
return groupContext.register(id, registerData);
}
}, []);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (groupContext) {
groupContext.register(id, registerData);
}
}, [canPreview, data]);
return id;
}
;// ./node_modules/@rc-component/image/es/Image.js
function Image_extends() { Image_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Image_extends.apply(this, arguments); }
const ImageInternal = props => {
const {
// Misc
prefixCls = 'rc-image',
previewPrefixCls = `${prefixCls}-preview`,
// Style
rootClassName,
className,
style,
classNames = {},
styles = {},
width,
height,
// Image
src: imgSrc,
alt,
placeholder,
fallback,
// Preview
preview = true,
// Events
onClick,
onError,
onKeyDown,
...otherProps
} = props;
const groupContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(PreviewGroupContext);
// ========================== Preview ===========================
const canPreview = !!preview;
const {
src: previewSrc,
open: previewOpen,
onOpenChange: onPreviewOpenChange,
cover,
rootClassName: previewRootClassName,
...restProps
} = preview && typeof preview === 'object' ? preview : {};
const coverPlacement = typeof cover === 'object' && cover.placement ? cover.placement || 'center' : 'center';
const coverNode = typeof cover === 'object' && cover.coverNode ? cover.coverNode : cover;
// ============================ Open ============================
const [isShowPreview, setShowPreview] = (0,useControlledState["default"])(!!previewOpen, previewOpen);
const [mousePosition, setMousePosition] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null);
const triggerPreviewOpen = nextOpen => {
setShowPreview(nextOpen);
onPreviewOpenChange?.(nextOpen);
};
const onPreviewClose = () => {
triggerPreviewOpen(false);
};
// ========================= ImageProps =========================
const isCustomPlaceholder = placeholder && placeholder !== true;
const src = previewSrc ?? imgSrc;
const [getImgRef, srcAndOnload, status] = useStatus({
src: imgSrc,
isCustomPlaceholder,
fallback
});
const imgCommonProps = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
const obj = {};
COMMON_PROPS.forEach(prop => {
if (props[prop] !== undefined) {
obj[prop] = props[prop];
}
});
return obj;
}, COMMON_PROPS.map(prop => props[prop]));
// ========================== Register ==========================
const registerData = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => ({
...imgCommonProps,
src
}), [src, imgCommonProps]);
const imageId = useRegisterImage(canPreview, registerData);
// ========================== Preview ===========================
const onPreview = e => {
const rect = e.target.getBoundingClientRect();
const left = rect.x + rect.width / 2;
const top = rect.y + rect.height / 2;
if (groupContext) {
groupContext.onPreview(imageId, src, left, top);
} else {
setMousePosition({
x: left,
y: top
});
triggerPreviewOpen(true);
}
onClick?.(e);
};
// ======================= Keyboard Preview =====================
const onPreviewKeyDown = event => {
onKeyDown?.(event);
if (!canPreview) {
return;
}
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
const rect = event.target.getBoundingClientRect();
const left = rect.x + rect.width / 2;
const top = rect.y + rect.height / 2;
if (groupContext) {
groupContext.onPreview(imageId, src, left, top);
} else {
setMousePosition({
x: left,
y: top
});
triggerPreviewOpen(true);
}
}
};
// =========================== Render ===========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", Image_extends({}, otherProps, {
className: (0,clsx.clsx)(prefixCls, rootClassName, classNames.root, {
[`${prefixCls}-error`]: status === 'error'
}),
onClick: canPreview ? onPreview : onClick,
role: canPreview ? 'button' : otherProps.role,
tabIndex: canPreview && otherProps.tabIndex == null ? 0 : otherProps.tabIndex,
"aria-label": canPreview ? otherProps['aria-label'] ?? alt : otherProps['aria-label'],
onKeyDown: onPreviewKeyDown,
style: {
width,
height,
...styles.root
}
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("img", Image_extends({}, imgCommonProps, {
className: (0,clsx.clsx)(`${prefixCls}-img`, {
[`${prefixCls}-img-placeholder`]: placeholder === true
}, classNames.image, className),
style: {
height,
...styles.image,
...style
},
ref: getImgRef
}, srcAndOnload, {
width: width,
height: height,
onError: onError
})), status === 'loading' && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
"aria-hidden": "true",
className: `${prefixCls}-placeholder`
}, placeholder), cover !== false && canPreview && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-cover`, classNames.cover, `${prefixCls}-cover-${coverPlacement}`),
style: {
display: style?.display === 'none' ? 'none' : undefined,
...styles.cover
}
}, coverNode)), !groupContext && canPreview && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Preview, Image_extends({
"aria-hidden": !isShowPreview,
open: isShowPreview,
prefixCls: previewPrefixCls,
onClose: onPreviewClose,
mousePosition: mousePosition,
src: src,
alt: alt,
imageInfo: {
width,
height
},
fallback: fallback,
imgCommonProps: imgCommonProps
}, restProps, {
classNames: classNames?.popup,
styles: styles?.popup,
rootClassName: (0,clsx.clsx)(previewRootClassName, rootClassName)
})));
};
ImageInternal.PreviewGroup = PreviewGroup;
if (true) {
ImageInternal.displayName = 'Image';
}
/* harmony default export */ var es_Image = (ImageInternal);
;// ./node_modules/@rc-component/image/es/index.js
/* harmony default export */ var image_es = (es_Image);
;// ./components/image/hooks/useMergedPreviewConfig.ts
const useMergedPreviewConfig = (previewConfig, contextPreviewConfig, prefixCls, mergedRootClassName, getContextPopupContainer, icons, defaultCover) => {
const [zIndex] = (0,useZIndex.useZIndex)('ImagePreview', previewConfig?.zIndex);
const [mergedPreviewMask, blurClassName] = useMergedMask(previewConfig?.mask, contextPreviewConfig?.mask, `${prefixCls}-preview`);
return external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
if (!previewConfig) {
return previewConfig;
}
const {
cover,
getContainer,
closeIcon,
rootClassName: previewRootClassName
} = previewConfig;
const {
closeIcon: contextCloseIcon
} = contextPreviewConfig ?? {};
return {
motionName: (0,_util_motion.getTransitionName)(`${prefixCls}-preview`, 'fade'),
...previewConfig,
...(defaultCover ? {
cover: cover ?? defaultCover
} : {}),
icons,
getContainer: getContainer ?? getContextPopupContainer,
zIndex,
closeIcon: closeIcon ?? contextCloseIcon,
rootClassName: (0,clsx.clsx)(mergedRootClassName, previewRootClassName),
mask: mergedPreviewMask,
blurClassName: blurClassName.mask
};
}, [previewConfig, contextPreviewConfig, prefixCls, mergedRootClassName, getContextPopupContainer, defaultCover, icons, zIndex, mergedPreviewMask, blurClassName]);
};
/* harmony default export */ var hooks_useMergedPreviewConfig = (useMergedPreviewConfig);
;// ./components/image/hooks/usePreviewConfig.ts
function normalizeMask(mask) {
if (/*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement)(mask)) {
return [mask, undefined];
}
if (typeof mask === 'boolean' || (0,is.isPlainObject)(mask)) {
return [undefined, mask];
}
return [undefined, undefined];
}
function usePreviewConfig(preview) {
// Get origin preview config
const rawPreviewConfig = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (typeof preview === 'boolean') {
return preview ? {} : null;
}
return (0,is.isPlainObject)(preview) ? preview : {};
}, [preview]);
const splittedPreviewConfig = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (!rawPreviewConfig) {
return [rawPreviewConfig, '', ''];
}
const {
open,
onOpenChange,
cover,
actionsRender,
visible,
onVisibleChange,
rootClassName,
maskClassName,
mask,
forceRender: _forceRender,
destroyOnClose: _destroyOnClose,
toolbarRender,
...restPreviewConfig
} = rawPreviewConfig;
let onInternalOpenChange;
if (onOpenChange) {
onInternalOpenChange = onOpenChange;
} else if (onVisibleChange) {
onInternalOpenChange = (nextOpen, info) => {
const {
current
} = info || {};
if (current !== undefined) {
onVisibleChange(nextOpen, !nextOpen, current);
} else {
onVisibleChange(nextOpen, !nextOpen);
}
};
}
const [coverElement, maskConfig] = normalizeMask(mask);
return [{
...restPreviewConfig,
open: open ?? visible,
onOpenChange: onInternalOpenChange,
cover: cover ?? coverElement,
mask: maskConfig,
actionsRender: actionsRender ?? toolbarRender
}, rootClassName, maskClassName];
}, [rawPreviewConfig]);
if (true) {
const warning = (0,_util_warning.devUseWarning)('Image');
if (rawPreviewConfig) {
[['visible', 'open'], ['onVisibleChange', 'onOpenChange'], ['maskClassName', 'classNames.cover'], ['rootClassName', 'classNames.root'], ['toolbarRender', 'actionsRender']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in rawPreviewConfig), deprecatedName, newName);
});
true ? warning(! /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement)(rawPreviewConfig.mask), 'deprecated', '`mask` used as ReactNode is deprecated. Please use `cover` instead.') : 0;
true ? warning(!('forceRender' in rawPreviewConfig), 'breaking', '`forceRender` is no longer supported.') : 0;
true ? warning(!('destroyOnClose' in rawPreviewConfig), 'breaking', '`destroyOnClose` is no longer supported.') : 0;
}
}
return splittedPreviewConfig;
}
;// ./node_modules/@ant-design/icons-svg/es/asn/RotateLeftOutlined.js
// This icon file is generated automatically.
var RotateLeftOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M672 418H144c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H188V494h440v326z" } }, { "tag": "path", "attrs": { "d": "M819.3 328.5c-78.8-100.7-196-153.6-314.6-154.2l-.2-64c0-6.5-7.6-10.1-12.6-6.1l-128 101c-4 3.1-3.9 9.1 0 12.3L492 318.6c5.1 4 12.7.4 12.6-6.1v-63.9c12.9.1 25.9.9 38.8 2.5 42.1 5.2 82.1 18.2 119 38.7 38.1 21.2 71.2 49.7 98.4 84.3 27.1 34.7 46.7 73.7 58.1 115.8a325.95 325.95 0 016.5 140.9h74.9c14.8-103.6-11.3-213-81-302.3z" } }] }, "name": "rotate-left", "theme": "outlined" };
/* harmony default export */ var asn_RotateLeftOutlined = (RotateLeftOutlined);
;// ./node_modules/@ant-design/icons/es/icons/RotateLeftOutlined.js
function RotateLeftOutlined_extends() { RotateLeftOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return RotateLeftOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const RotateLeftOutlined_RotateLeftOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], RotateLeftOutlined_extends({}, props, {
ref: ref,
icon: asn_RotateLeftOutlined
}));
/** */
const RotateLeftOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(RotateLeftOutlined_RotateLeftOutlined);
if (true) {
RotateLeftOutlined_RefIcon.displayName = 'RotateLeftOutlined';
}
/* harmony default export */ var icons_RotateLeftOutlined = (RotateLeftOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/RotateRightOutlined.js
// This icon file is generated automatically.
var RotateRightOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M480.5 251.2c13-1.6 25.9-2.4 38.8-2.5v63.9c0 6.5 7.5 10.1 12.6 6.1L660 217.6c4-3.2 4-9.2 0-12.3l-128-101c-5.1-4-12.6-.4-12.6 6.1l-.2 64c-118.6.5-235.8 53.4-314.6 154.2A399.75 399.75 0 00123.5 631h74.9c-.9-5.3-1.7-10.7-2.4-16.1-5.1-42.1-2.1-84.1 8.9-124.8 11.4-42.2 31-81.1 58.1-115.8 27.2-34.7 60.3-63.2 98.4-84.3 37-20.6 76.9-33.6 119.1-38.8z" } }, { "tag": "path", "attrs": { "d": "M880 418H352c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H396V494h440v326z" } }] }, "name": "rotate-right", "theme": "outlined" };
/* harmony default export */ var asn_RotateRightOutlined = (RotateRightOutlined);
;// ./node_modules/@ant-design/icons/es/icons/RotateRightOutlined.js
function RotateRightOutlined_extends() { RotateRightOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return RotateRightOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const RotateRightOutlined_RotateRightOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], RotateRightOutlined_extends({}, props, {
ref: ref,
icon: asn_RotateRightOutlined
}));
/** */
const RotateRightOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(RotateRightOutlined_RotateRightOutlined);
if (true) {
RotateRightOutlined_RefIcon.displayName = 'RotateRightOutlined';
}
/* harmony default export */ var icons_RotateRightOutlined = (RotateRightOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/SwapOutlined.js
// This icon file is generated automatically.
var SwapOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M847.9 592H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h605.2L612.9 851c-4.1 5.2-.4 13 6.3 13h72.5c4.9 0 9.5-2.2 12.6-6.1l168.8-214.1c16.5-21 1.6-51.8-25.2-51.8zM872 356H266.8l144.3-183c4.1-5.2.4-13-6.3-13h-72.5c-4.9 0-9.5 2.2-12.6 6.1L150.9 380.2c-16.5 21-1.6 51.8 25.1 51.8h696c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" } }] }, "name": "swap", "theme": "outlined" };
/* harmony default export */ var asn_SwapOutlined = (SwapOutlined);
;// ./node_modules/@ant-design/icons/es/icons/SwapOutlined.js
function SwapOutlined_extends() { SwapOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return SwapOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const SwapOutlined_SwapOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], SwapOutlined_extends({}, props, {
ref: ref,
icon: asn_SwapOutlined
}));
/** */
const SwapOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(SwapOutlined_SwapOutlined);
if (true) {
SwapOutlined_RefIcon.displayName = 'SwapOutlined';
}
/* harmony default export */ var icons_SwapOutlined = (SwapOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/ZoomInOutlined.js
// This icon file is generated automatically.
var ZoomInOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z" } }] }, "name": "zoom-in", "theme": "outlined" };
/* harmony default export */ var asn_ZoomInOutlined = (ZoomInOutlined);
;// ./node_modules/@ant-design/icons/es/icons/ZoomInOutlined.js
function ZoomInOutlined_extends() { ZoomInOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return ZoomInOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const ZoomInOutlined_ZoomInOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], ZoomInOutlined_extends({}, props, {
ref: ref,
icon: asn_ZoomInOutlined
}));
/** */
const ZoomInOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(ZoomInOutlined_ZoomInOutlined);
if (true) {
ZoomInOutlined_RefIcon.displayName = 'ZoomInOutlined';
}
/* harmony default export */ var icons_ZoomInOutlined = (ZoomInOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/ZoomOutOutlined.js
// This icon file is generated automatically.
var ZoomOutOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z" } }] }, "name": "zoom-out", "theme": "outlined" };
/* harmony default export */ var asn_ZoomOutOutlined = (ZoomOutOutlined);
;// ./node_modules/@ant-design/icons/es/icons/ZoomOutOutlined.js
function ZoomOutOutlined_extends() { ZoomOutOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return ZoomOutOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const ZoomOutOutlined_ZoomOutOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], ZoomOutOutlined_extends({}, props, {
ref: ref,
icon: asn_ZoomOutOutlined
}));
/** */
const ZoomOutOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(ZoomOutOutlined_ZoomOutOutlined);
if (true) {
ZoomOutOutlined_RefIcon.displayName = 'ZoomOutOutlined';
}
/* harmony default export */ var icons_ZoomOutOutlined = (ZoomOutOutlined_RefIcon);
// EXTERNAL MODULE: ./components/image/style/index.ts
var image_style = __webpack_require__("./components/image/style/index.ts");
;// ./components/image/PreviewGroup.tsx
const icons = {
rotateLeft: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_RotateLeftOutlined, null),
rotateRight: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_RotateRightOutlined, null),
zoomIn: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_ZoomInOutlined, null),
zoomOut: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_ZoomOutOutlined, null),
close: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CloseOutlined, null),
left: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LeftOutlined, null),
right: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RightOutlined["default"], null),
flipX: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_SwapOutlined, null),
flipY: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_SwapOutlined, {
rotate: 90
})
};
const InternalPreviewGroup = ({
previewPrefixCls: customizePrefixCls,
preview,
classNames,
styles,
...otherProps
}) => {
// =============================== MISC ===============================
// Context
const {
getPrefixCls,
getPopupContainer: getContextPopupContainer,
direction,
preview: contextPreview,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('image');
const prefixCls = getPrefixCls('image', customizePrefixCls);
const previewPrefixCls = `${prefixCls}-preview`;
// ============================== Style ===============================
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,image_style["default"])(prefixCls, rootCls);
const mergedRootClassName = (0,clsx.clsx)(hashId, cssVarCls, rootCls);
// ============================= Preview ==============================
const [previewConfig, previewRootClassName, previewMaskClassName] = usePreviewConfig(preview);
const [contextPreviewConfig, contextPreviewRootClassName, contextPreviewMaskClassName] = usePreviewConfig(contextPreview);
// ============================ Semantics =============================
const memoizedIcons = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
...icons,
left: direction === 'rtl' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RightOutlined["default"], null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LeftOutlined, null),
right: direction === 'rtl' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LeftOutlined, null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RightOutlined["default"], null)
}), [direction]);
const mergedPreview = hooks_useMergedPreviewConfig(
// Preview config
previewConfig, contextPreviewConfig,
// MISC
prefixCls, mergedRootClassName, getContextPopupContainer, icons);
const {
mask: mergedMask,
blurClassName
} = mergedPreview ?? {};
// =========== Merged Props for Semantic ===========
const mergedProps = {
...otherProps,
classNames,
styles
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames, {
cover: (0,clsx.clsx)(contextPreviewMaskClassName, previewMaskClassName),
popup: {
root: (0,clsx.clsx)(contextPreviewRootClassName, previewRootClassName),
mask: (0,clsx.clsx)({
[`${prefixCls}-preview-mask-hidden`]: !mergedMask
}, blurClassName)
}
}], [contextStyles, styles], {
props: mergedProps
}, {
popup: {
_default: 'root'
}
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(image_es.PreviewGroup, {
preview: mergedPreview,
previewPrefixCls: previewPrefixCls,
icons: memoizedIcons,
...otherProps,
classNames: mergedClassNames,
styles: mergedStyles
});
};
/* harmony default export */ var image_PreviewGroup = (InternalPreviewGroup);
;// ./components/image/index.tsx
const image_Image = props => {
const {
prefixCls: customizePrefixCls,
preview,
className,
rootClassName,
style,
styles,
classNames,
wrapperStyle,
fallback,
...otherProps
} = props;
// =============================== MISC ===============================
// Context
const {
getPrefixCls,
getPopupContainer: getContextPopupContainer,
className: contextClassName,
style: contextStyle,
preview: contextPreview,
styles: contextStyles,
classNames: contextClassNames,
fallback: contextFallback
} = (0,config_provider_context.useComponentConfig)('image');
const prefixCls = getPrefixCls('image', customizePrefixCls);
// ============================= Warning ==============================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Image');
warning.deprecated(!wrapperStyle, 'wrapperStyle', 'styles.root');
}
// ============================== Styles ==============================
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,image_style["default"])(prefixCls, rootCls);
const mergedRootClassName = (0,clsx.clsx)(rootClassName, hashId, cssVarCls, rootCls);
const mergedClassName = (0,clsx.clsx)(className, hashId, contextClassName);
// ============================= Preview ==============================
const [previewConfig, previewRootClassName, previewMaskClassName] = usePreviewConfig(preview);
const [contextPreviewConfig, contextPreviewRootClassName, contextPreviewMaskClassName] = usePreviewConfig(contextPreview);
const mergedPreviewConfig = hooks_useMergedPreviewConfig(
// Preview config
previewConfig, contextPreviewConfig,
// MISC
prefixCls, mergedRootClassName, getContextPopupContainer, icons, true);
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
preview: mergedPreviewConfig
};
// ============================= Semantic =============================
const mergedLegacyClassNames = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
cover: (0,clsx.clsx)(contextPreviewMaskClassName, previewMaskClassName),
popup: {
root: (0,clsx.clsx)(contextPreviewRootClassName, previewRootClassName)
}
}), [previewRootClassName, previewMaskClassName, contextPreviewRootClassName, contextPreviewMaskClassName]);
const {
mask: mergedMask,
blurClassName
} = mergedPreviewConfig ?? {};
const mergedPopupClassNames = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
mask: (0,clsx.clsx)({
[`${prefixCls}-preview-mask-hidden`]: !mergedMask
}, blurClassName)
}), [mergedMask, prefixCls, blurClassName]);
const internalClassNames = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => [contextClassNames, classNames, mergedLegacyClassNames, {
popup: mergedPopupClassNames
}], [contextClassNames, classNames, mergedLegacyClassNames, mergedPopupClassNames]);
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)(internalClassNames, [contextStyles, {
root: wrapperStyle
}, styles], {
props: mergedProps
}, {
popup: {
_default: 'root'
}
});
const mergedStyle = {
...contextStyle,
...style
};
const mergedFallback = fallback ?? contextFallback;
// ============================== Render ==============================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(image_es, {
prefixCls: prefixCls,
preview: mergedPreviewConfig || false,
rootClassName: mergedRootClassName,
className: mergedClassName,
style: mergedStyle,
fallback: mergedFallback,
...otherProps,
classNames: mergedClassNames,
styles: mergedStyles
});
};
image_Image.PreviewGroup = image_PreviewGroup;
if (true) {
image_Image.displayName = 'Image';
}
/* harmony default export */ var components_image = (image_Image);
;// ./components/input/Group.tsx
/** @deprecated Please use `Space.Compact` */
const Group_Group = props => {
const {
getPrefixCls,
direction
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(config_provider_context.ConfigContext);
const {
prefixCls: customizePrefixCls,
className
} = props;
const prefixCls = getPrefixCls('input-group', customizePrefixCls);
const inputPrefixCls = getPrefixCls('input');
const [hashId, cssVarCls] = (0,input_style["default"])(inputPrefixCls);
const cls = (0,clsx.clsx)(prefixCls, cssVarCls, {
[`${prefixCls}-lg`]: props.size === 'large',
[`${prefixCls}-sm`]: props.size === 'small',
[`${prefixCls}-compact`]: props.compact,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, hashId, className);
const formItemContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(FormItemInputContext);
const groupFormItemContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => ({
...formItemContext,
isFormItemInput: false
}), [formItemContext]);
if (true) {
const warning = (0,_util_warning.devUseWarning)('Input.Group');
warning.deprecated(false, 'Input.Group', 'Space.Compact');
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(FormItemInputContext.Provider, {
value: groupFormItemContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(space.Compact, {
className: cls,
style: props.style,
onMouseEnter: props.onMouseEnter,
onMouseLeave: props.onMouseLeave,
onFocus: props.onFocus,
onBlur: props.onBlur
}, props.children));
};
/* harmony default export */ var input_Group = (Group_Group);
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var cssinjs_utils_es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
// EXTERNAL MODULE: ./components/input/style/token.ts
var input_style_token = __webpack_require__("./components/input/style/token.ts");
;// ./components/input/style/otp.ts
// =============================== OTP ================================
const genOTPStyle = token => {
const {
componentCls,
paddingXS
} = token;
return {
[componentCls]: {
display: 'inline-flex',
alignItems: 'center',
flexWrap: 'nowrap',
columnGap: paddingXS,
[`${componentCls}-input-wrapper`]: {
position: 'relative',
[`${componentCls}-mask-icon`]: {
position: 'absolute',
zIndex: '1',
top: '50%',
right: '50%',
transform: 'translate(50%, -50%)',
pointerEvents: 'none'
},
[`${componentCls}-mask-input`]: {
color: 'transparent',
caretColor: token.colorText,
'&::selection': {
color: 'transparent'
}
},
[`${componentCls}-mask-input[type=number]::-webkit-inner-spin-button`]: {
'-webkit-appearance': 'none',
margin: 0
},
[`${componentCls}-mask-input[type=number]`]: {
'-moz-appearance': 'textfield'
}
},
'&-rtl': {
direction: 'rtl'
},
[`${componentCls}-input`]: {
textAlign: 'center',
paddingInline: token.paddingXXS
},
// ================= Size =================
[`&${componentCls}-sm ${componentCls}-input`]: {
paddingInline: token.calc(token.paddingXXS).div(2).equal()
},
[`&${componentCls}-lg ${componentCls}-input`]: {
paddingInline: token.paddingXS
}
}
};
};
// ============================== Export ==============================
/* harmony default export */ var otp = ((0,genStyleUtils.genStyleHooks)(['Input', 'OTP'], token => {
const inputToken = (0,cssinjs_utils_es.mergeToken)(token, (0,input_style_token.initInputToken)(token));
return genOTPStyle(inputToken);
}, input_style_token.initComponentToken));
;// ./components/input/OTP/OTPInput.tsx
const OTPInput = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
className,
value,
onChange,
onActiveChange,
index,
mask,
onFocus,
...restProps
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('otp');
const maskValue = typeof mask === 'string' ? mask : value;
// ========================== Ref ===========================
const inputRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => inputRef.current);
// ========================= Input ==========================
const onInternalChange = e => {
onChange(index, e.target.value);
};
// ========================= Focus ==========================
const syncSelection = () => {
(0,raf["default"])(() => {
const inputEle = inputRef.current?.input;
if (document.activeElement === inputEle && inputEle) {
inputEle.select();
}
});
};
const onInternalFocus = e => {
onFocus?.(e);
syncSelection();
};
// ======================== Keyboard ========================
const onInternalKeyDown = event => {
const {
key,
ctrlKey,
metaKey
} = event;
if (key === 'ArrowLeft') {
onActiveChange(index - 1);
} else if (key === 'ArrowRight') {
onActiveChange(index + 1);
} else if (key === 'z' && (ctrlKey || metaKey)) {
event.preventDefault();
} else if (key === 'Backspace' && !value) {
onActiveChange(index - 1);
}
syncSelection();
};
// ========================= Render =========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-input-wrapper`,
role: "presentation"
}, mask && value !== '' && value !== undefined && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-mask-icon`,
"aria-hidden": "true"
}, maskValue)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(input_Input, {
"aria-label": `OTP Input ${index + 1}`,
type: mask === true ? 'password' : 'text',
...restProps,
ref: inputRef,
value: value,
onInput: onInternalChange,
onFocus: onInternalFocus,
onKeyDown: onInternalKeyDown,
onMouseDown: syncSelection,
onMouseUp: syncSelection,
className: (0,clsx.clsx)(className, {
[`${prefixCls}-mask-input`]: mask
})
}));
});
/* harmony default export */ var OTP_OTPInput = (OTPInput);
;// ./components/input/OTP/index.tsx
function strToArr(str) {
return (str || '').split('');
}
const Separator = props => {
const {
index,
prefixCls,
separator,
className: semanticClassName,
style: semanticStyle
} = props;
const separatorNode = typeof separator === 'function' ? separator(index) : separator;
if (!separatorNode) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}-separator`, semanticClassName),
style: semanticStyle
}, separatorNode);
};
const OTP = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
length = 6,
size: customSize,
defaultValue,
value,
onChange,
formatter,
separator,
variant,
disabled,
status: customStatus,
autoFocus,
mask,
type,
autoComplete,
onInput,
onFocus,
inputMode,
classNames,
styles,
className,
style,
...restProps
} = props;
if (true) {
const warning = (0,_util_warning.devUseWarning)('Input.OTP');
true ? warning(!(typeof mask === 'string' && mask.length > 1), 'usage', '`mask` prop should be a single character.') : 0;
}
const {
classNames: contextClassNames,
styles: contextStyles,
getPrefixCls,
direction,
style: contextStyle,
className: contextClassName
} = (0,config_provider_context.useComponentConfig)('otp');
const prefixCls = getPrefixCls('otp', customizePrefixCls);
const mergedProps = {
...props,
length
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const domAttrs = (0,pickAttrs["default"])(restProps, {
aria: true,
data: true,
attr: true
});
// ========================= Root =========================
// Style
const [hashId, cssVarCls] = otp(prefixCls);
// ========================= Size =========================
const mergedSize = (0,useSize["default"])(ctx => customSize ?? ctx);
// ======================== Status ========================
const formContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FormItemInputContext);
const mergedStatus = getMergedStatus(formContext.status, customStatus);
const proxyFormContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
...formContext,
status: mergedStatus,
hasFeedback: false,
feedbackIcon: null
}), [formContext, mergedStatus]);
// ========================= Refs =========================
const containerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const inputsRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({});
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
focus: () => {
inputsRef.current[0]?.focus();
},
blur: () => {
for (let i = 0; i < length; i += 1) {
inputsRef.current[i]?.blur();
}
},
nativeElement: containerRef.current
}));
// ======================= Formatter ======================
const internalFormatter = txt => formatter ? formatter(txt) : txt;
// ======================== Values ========================
const [valueCells, setValueCells] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(() => strToArr(internalFormatter(defaultValue || '')));
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (value !== undefined) {
setValueCells(strToArr(value));
}
}, [value]);
const triggerValueCellsChange = (0,es.useEvent)(nextValueCells => {
setValueCells(nextValueCells);
if (onInput) {
onInput(nextValueCells);
}
// Trigger if all cells are filled
if (onChange && nextValueCells.length === length && nextValueCells.every(c => c) && nextValueCells.some((c, index) => valueCells[index] !== c)) {
onChange(nextValueCells.join(''));
}
});
const patchValue = (0,es.useEvent)((index, txt) => {
let nextCells = (0,toConsumableArray["default"])(valueCells);
// Fill cells till index
for (let i = 0; i < index; i += 1) {
if (!nextCells[i]) {
nextCells[i] = '';
}
}
if (txt.length <= 1) {
nextCells[index] = txt;
} else {
nextCells = nextCells.slice(0, index).concat(strToArr(txt));
}
nextCells = nextCells.slice(0, length);
// Clean the last empty cell
for (let i = nextCells.length - 1; i >= 0; i -= 1) {
if (nextCells[i]) {
break;
}
nextCells.pop();
}
// Format if needed
const formattedValue = internalFormatter(nextCells.map(c => c || ' ').join(''));
nextCells = strToArr(formattedValue).map((c, i) => {
if (c === ' ' && !nextCells[i]) {
return nextCells[i];
}
return c;
});
return nextCells;
});
// ======================== Change ========================
const onInputChange = (index, txt) => {
const nextCells = patchValue(index, txt);
const nextIndex = Math.min(index + txt.length, length - 1);
if (nextIndex !== index && nextCells[index] !== undefined) {
inputsRef.current[nextIndex]?.focus();
}
triggerValueCellsChange(nextCells);
};
const onInputActiveChange = nextIndex => {
inputsRef.current[nextIndex]?.focus();
};
// ======================== Focus ========================
const onInputFocus = (event, index) => {
// keep focus on the first empty cell
for (let i = 0; i < index; i += 1) {
if (!inputsRef.current[i]?.input?.value) {
inputsRef.current[i]?.focus();
break;
}
}
onFocus?.(event);
};
// ======================== Render ========================
const inputSharedProps = {
variant,
disabled,
status: mergedStatus,
mask,
type,
inputMode,
autoComplete
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
...domAttrs,
ref: containerRef,
className: (0,clsx.clsx)(className, prefixCls, {
[`${prefixCls}-sm`]: mergedSize === 'small',
[`${prefixCls}-lg`]: mergedSize === 'large',
[`${prefixCls}-rtl`]: direction === 'rtl'
}, cssVarCls, hashId, contextClassName, mergedClassNames.root),
style: {
...mergedStyles.root,
...contextStyle,
...style
},
role: "group"
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(FormItemInputContext.Provider, {
value: proxyFormContext
}, Array.from({
length
}).map((_, index) => {
const key = `otp-${index}`;
const singleValue = valueCells[index] || '';
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
key: key
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(OTP_OTPInput, {
ref: inputEle => {
inputsRef.current[index] = inputEle;
},
index: index,
size: mergedSize,
htmlSize: 1,
className: (0,clsx.clsx)(mergedClassNames.input, `${prefixCls}-input`),
style: mergedStyles.input,
onChange: onInputChange,
value: singleValue,
onActiveChange: onInputActiveChange,
autoFocus: index === 0 && autoFocus,
onFocus: event => onInputFocus(event, index),
...inputSharedProps
}), index < length - 1 && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Separator, {
separator: separator,
index: index,
prefixCls: prefixCls,
className: (0,clsx.clsx)(mergedClassNames.separator),
style: mergedStyles.separator
})));
})));
});
/* harmony default export */ var input_OTP = (OTP);
;// ./node_modules/@ant-design/icons-svg/es/asn/EyeInvisibleOutlined.js
// This icon file is generated automatically.
var EyeInvisibleOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z" } }, { "tag": "path", "attrs": { "d": "M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z" } }] }, "name": "eye-invisible", "theme": "outlined" };
/* harmony default export */ var asn_EyeInvisibleOutlined = (EyeInvisibleOutlined);
;// ./node_modules/@ant-design/icons/es/icons/EyeInvisibleOutlined.js
function EyeInvisibleOutlined_extends() { EyeInvisibleOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return EyeInvisibleOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const EyeInvisibleOutlined_EyeInvisibleOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], EyeInvisibleOutlined_extends({}, props, {
ref: ref,
icon: asn_EyeInvisibleOutlined
}));
/** */
const EyeInvisibleOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(EyeInvisibleOutlined_EyeInvisibleOutlined);
if (true) {
EyeInvisibleOutlined_RefIcon.displayName = 'EyeInvisibleOutlined';
}
/* harmony default export */ var icons_EyeInvisibleOutlined = (EyeInvisibleOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/EyeOutlined.js
// This icon file is generated automatically.
var EyeOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" } }] }, "name": "eye", "theme": "outlined" };
/* harmony default export */ var asn_EyeOutlined = (EyeOutlined);
;// ./node_modules/@ant-design/icons/es/icons/EyeOutlined.js
function EyeOutlined_extends() { EyeOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return EyeOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const EyeOutlined_EyeOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], EyeOutlined_extends({}, props, {
ref: ref,
icon: asn_EyeOutlined
}));
/** */
const EyeOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(EyeOutlined_EyeOutlined);
if (true) {
EyeOutlined_RefIcon.displayName = 'EyeOutlined';
}
/* harmony default export */ var icons_EyeOutlined = (EyeOutlined_RefIcon);
;// ./components/input/Password.tsx
const defaultIconRender = visible => visible ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_EyeOutlined, null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_EyeInvisibleOutlined, null);
const actionMap = {
click: 'onClick',
hover: 'onMouseOver'
};
const Password = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
disabled: customDisabled,
action = 'click',
visibilityToggle = true,
iconRender = defaultIconRender,
suffix
} = props;
// ===================== Disabled =====================
const disabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
const mergedDisabled = customDisabled ?? disabled;
const visibilityControlled = (0,is.isPlainObject)(visibilityToggle) && visibilityToggle.visible !== undefined;
const [visible, setVisible] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(() => visibilityControlled ? visibilityToggle.visible : false);
const inputRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (visibilityControlled) {
setVisible(visibilityToggle.visible);
}
}, [visibilityControlled, visibilityToggle]);
// Remove Password value
const removePasswordTimeout = useRemovePasswordTimeout(inputRef);
const onVisibleChange = () => {
if (mergedDisabled) {
return;
}
if (visible) {
removePasswordTimeout();
}
const nextVisible = !visible;
setVisible(nextVisible);
if ((0,is.isPlainObject)(visibilityToggle)) {
visibilityToggle.onVisibleChange?.(nextVisible);
}
};
const getIcon = prefixCls => {
const iconTrigger = actionMap[action] || '';
const icon = iconRender(visible);
const iconProps = {
[iconTrigger]: onVisibleChange,
className: `${prefixCls}-icon`,
key: 'passwordIcon',
onMouseDown: e => {
// Prevent focused state lost
// https://github.com/ant-design/ant-design/issues/15173
e.preventDefault();
},
onMouseUp: e => {
// Prevent caret position change
// https://github.com/ant-design/ant-design/issues/23524
e.preventDefault();
}
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(icon) ? icon : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", null, icon), iconProps);
};
const {
className,
prefixCls: customizePrefixCls,
inputPrefixCls: customizeInputPrefixCls,
size,
...restProps
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const inputPrefixCls = getPrefixCls('input', customizeInputPrefixCls);
const prefixCls = getPrefixCls('input-password', customizePrefixCls);
const suffixIcon = visibilityToggle && getIcon(prefixCls);
const inputClassName = (0,clsx.clsx)(prefixCls, className, {
[`${prefixCls}-${size}`]: !!size
});
const omittedProps = {
...(0,es.omit)(restProps, ['suffix', 'iconRender', 'visibilityToggle']),
type: visible ? 'text' : 'password',
className: inputClassName,
prefixCls: inputPrefixCls,
suffix: (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, suffixIcon, suffix))
};
if (size) {
omittedProps.size = size;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(input_Input, {
ref: (0,es_ref.composeRef)(ref, inputRef),
...omittedProps
});
});
if (true) {
Password.displayName = 'Input.Password';
}
/* harmony default export */ var input_Password = (Password);
;// ./components/input/style/search.ts
const genSearchStyle = token => {
const {
componentCls
} = token;
const btnCls = `${componentCls}-btn`;
return {
[componentCls]: {
width: '100%',
// =========================== Button ===========================
[btnCls]: {
'&-filled': {
background: token.colorFillTertiary,
'&:not(:disabled)': {
'&:hover': {
background: token.colorFillSecondary
},
'&:active': {
background: token.colorFill
}
}
}
}
}
};
};
/* harmony default export */ var search = ((0,genStyleUtils.genStyleHooks)(['Input', 'Search'], genSearchStyle));
;// ./components/input/Search.tsx
const Search = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
inputPrefixCls: customizeInputPrefixCls,
className,
size: customizeSize,
style,
enterButton = false,
addonAfter,
loading,
disabled,
onSearch: customOnSearch,
onChange: customOnChange,
onCompositionStart,
onCompositionEnd,
variant,
onPressEnter: customOnPressEnter,
classNames,
styles,
hidden,
...restProps
} = props;
const {
direction,
getPrefixCls,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('inputSearch');
const mergedProps = {
...props,
enterButton
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
}, {
button: {
_default: 'root'
}
});
const composedRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
const prefixCls = getPrefixCls('input-search', customizePrefixCls);
const inputPrefixCls = getPrefixCls('input', customizeInputPrefixCls);
const [hashId, cssVarCls] = search(prefixCls);
const {
compactSize
} = useCompactItemContext(prefixCls, direction);
const size = (0,useSize["default"])(ctx => customizeSize ?? compactSize ?? ctx);
const inputRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const onChange = e => {
if (e?.target && e.type === 'click' && customOnSearch) {
customOnSearch(e.target.value, e, {
source: 'clear'
});
}
customOnChange?.(e);
};
const onMouseDown = e => {
if (document.activeElement === inputRef.current?.input) {
e.preventDefault();
}
};
const onSearch = e => {
if (customOnSearch) {
customOnSearch(inputRef.current?.input?.value, e, {
source: 'input'
});
}
};
const onPressEnter = e => {
if (composedRef.current || loading) {
return;
}
customOnPressEnter?.(e);
onSearch(e);
};
const searchIcon = typeof enterButton === 'boolean' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_SearchOutlined, null) : null;
const btnPrefixCls = `${prefixCls}-btn`;
const btnClassName = (0,clsx.clsx)(btnPrefixCls, {
[`${btnPrefixCls}-${variant}`]: variant
});
let button;
const enterButtonAsElement = enterButton || {};
const isAntdButton = enterButtonAsElement.type && enterButtonAsElement.type.__ANT_BUTTON === true;
if (isAntdButton || enterButtonAsElement.type === 'button') {
button = (0,reactNode.cloneElement)(enterButtonAsElement, {
onMouseDown,
onClick: e => {
enterButtonAsElement?.props?.onClick?.(e);
onSearch(e);
},
key: 'enterButton',
...(isAntdButton ? {
className: btnClassName,
size
} : {})
});
} else {
button = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(button_Button, {
classNames: mergedClassNames.button,
styles: mergedStyles.button,
className: btnClassName,
color: enterButton ? 'primary' : 'default',
size: size,
disabled: disabled,
key: "enterButton",
onMouseDown: onMouseDown,
onClick: onSearch,
loading: loading,
icon: searchIcon,
variant: variant === 'borderless' || variant === 'filled' || variant === 'underlined' ? 'text' : enterButton ? 'solid' : undefined
}, enterButton);
}
if (addonAfter) {
button = [button, (0,reactNode.cloneElement)(addonAfter, {
key: 'addonAfter'
})];
}
const mergedClassName = (0,clsx.clsx)(prefixCls, cssVarCls, {
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-${size}`]: !!size,
[`${prefixCls}-with-button`]: !!enterButton
}, className, hashId, mergedClassNames.root);
const handleOnCompositionStart = e => {
composedRef.current = true;
onCompositionStart?.(e);
};
const handleOnCompositionEnd = e => {
composedRef.current = false;
onCompositionEnd?.(e);
};
// ========================== Render ==========================
// >>> Root Props
const rootProps = (0,pickAttrs["default"])(restProps, {
data: true
});
const inputProps = (0,omit["default"])({
...restProps,
classNames: (0,omit["default"])(mergedClassNames, ['button', 'root']),
styles: (0,omit["default"])(mergedStyles, ['button', 'root']),
prefixCls: inputPrefixCls,
type: 'search',
size,
variant,
onPressEnter,
onCompositionStart: handleOnCompositionStart,
onCompositionEnd: handleOnCompositionEnd,
onChange,
disabled
}, Object.keys(rootProps));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(space_Compact, {
className: mergedClassName,
style: {
...style,
...mergedStyles.root
},
...rootProps,
hidden: hidden
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(input_Input, {
ref: (0,es_ref.composeRef)(inputRef, ref),
...inputProps
}), button);
});
if (true) {
Search.displayName = 'Search';
}
/* harmony default export */ var input_Search = (Search);
;// ./node_modules/@rc-component/textarea/es/calculateNodeHeight.js
// Thanks to https://github.com/andreypopp/react-textarea-autosize/
/**
* calculateNodeHeight(uiTextNode, useCache = false)
*/
const HIDDEN_TEXTAREA_STYLE = `
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important;
pointer-events: none !important;
`;
const SIZING_STYLE = ['letter-spacing', 'line-height', 'padding-top', 'padding-bottom', 'font-family', 'font-weight', 'font-size', 'font-variant', 'text-rendering', 'text-transform', 'width', 'text-indent', 'padding-left', 'padding-right', 'border-width', 'box-sizing', 'word-break', 'white-space'];
const computedStyleCache = {};
let hiddenTextarea;
function calculateNodeStyling(node, useCache = false) {
const nodeRef = node.getAttribute('id') || node.getAttribute('data-reactid') || node.getAttribute('name');
if (useCache && computedStyleCache[nodeRef]) {
return computedStyleCache[nodeRef];
}
const style = window.getComputedStyle(node);
const boxSizing = style.getPropertyValue('box-sizing') || style.getPropertyValue('-moz-box-sizing') || style.getPropertyValue('-webkit-box-sizing');
const paddingSize = parseFloat(style.getPropertyValue('padding-bottom')) + parseFloat(style.getPropertyValue('padding-top'));
const borderSize = parseFloat(style.getPropertyValue('border-bottom-width')) + parseFloat(style.getPropertyValue('border-top-width'));
const sizingStyle = SIZING_STYLE.map(name => `${name}:${style.getPropertyValue(name)}`).join(';');
const nodeInfo = {
sizingStyle,
paddingSize,
borderSize,
boxSizing
};
if (useCache && nodeRef) {
computedStyleCache[nodeRef] = nodeInfo;
}
return nodeInfo;
}
function calculateAutoSizeStyle(uiTextNode, useCache = false, minRows = null, maxRows = null) {
if (!hiddenTextarea) {
hiddenTextarea = document.createElement('textarea');
hiddenTextarea.setAttribute('tab-index', '-1');
hiddenTextarea.setAttribute('aria-hidden', 'true');
// fix: A form field element should have an id or name attribute
// A form field element has neither an id nor a name attribute. This might prevent the browser from correctly autofilling the form.
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea
hiddenTextarea.setAttribute('name', 'hiddenTextarea');
document.body.appendChild(hiddenTextarea);
}
// Fix wrap="off" issue
// https://github.com/ant-design/ant-design/issues/6577
if (uiTextNode.getAttribute('wrap')) {
hiddenTextarea.setAttribute('wrap', uiTextNode.getAttribute('wrap'));
} else {
hiddenTextarea.removeAttribute('wrap');
}
// Copy all CSS properties that have an impact on the height of the content in
// the textbox
const {
paddingSize,
borderSize,
boxSizing,
sizingStyle
} = calculateNodeStyling(uiTextNode, useCache);
// Need to have the overflow attribute to hide the scrollbar otherwise
// text-lines will not calculated properly as the shadow will technically be
// narrower for content
hiddenTextarea.setAttribute('style', `${sizingStyle};${HIDDEN_TEXTAREA_STYLE}`);
hiddenTextarea.value = uiTextNode.value || uiTextNode.placeholder || '';
let minHeight = undefined;
let maxHeight = undefined;
let overflowY;
let height = hiddenTextarea.scrollHeight;
if (boxSizing === 'border-box') {
// border-box: add border, since height = content + padding + border
height += borderSize;
} else if (boxSizing === 'content-box') {
// remove padding, since height = content
height -= paddingSize;
}
if (minRows !== null || maxRows !== null) {
// measure height of a textarea with a single row
hiddenTextarea.value = ' ';
const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
if (minRows !== null) {
minHeight = singleRowHeight * minRows;
if (boxSizing === 'border-box') {
minHeight = minHeight + paddingSize + borderSize;
}
height = Math.max(minHeight, height);
}
if (maxRows !== null) {
maxHeight = singleRowHeight * maxRows;
if (boxSizing === 'border-box') {
maxHeight = maxHeight + paddingSize + borderSize;
}
overflowY = height > maxHeight ? '' : 'hidden';
height = Math.min(maxHeight, height);
}
}
const style = {
height,
overflowY,
resize: 'none'
};
if (minHeight) {
style.minHeight = minHeight;
}
if (maxHeight) {
style.maxHeight = maxHeight;
}
return style;
}
;// ./node_modules/@rc-component/textarea/es/ResizableTextArea.js
function ResizableTextArea_extends() { ResizableTextArea_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return ResizableTextArea_extends.apply(this, arguments); }
const RESIZE_START = 0;
const RESIZE_MEASURING = 1;
const RESIZE_STABLE = 2;
const ResizableTextArea = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls,
defaultValue,
value,
autoSize,
onResize,
className,
style,
disabled,
onChange,
// Test only
onInternalAutoSize,
...restProps
} = props;
// =============================== Value ================================
const [internalValue, setMergedValue] = (0,useControlledState["default"])(defaultValue, value);
const mergedValue = internalValue ?? '';
const onInternalChange = event => {
setMergedValue(event.target.value);
onChange?.(event);
};
// ================================ Ref =================================
const textareaRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
textArea: textareaRef.current
}));
// ============================== AutoSize ==============================
const [minRows, maxRows] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (autoSize && typeof autoSize === 'object') {
return [autoSize.minRows, autoSize.maxRows];
}
return [];
}, [autoSize]);
const needAutoSize = !!autoSize;
// =============================== Resize ===============================
const [resizeState, setResizeState] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(RESIZE_STABLE);
const [autoSizeStyle, setAutoSizeStyle] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState();
const startResize = () => {
setResizeState(RESIZE_START);
if (false) // removed by dead control flow
{}
};
// Change to trigger resize measure
(0,useLayoutEffect["default"])(() => {
if (needAutoSize) {
startResize();
}
}, [value, minRows, maxRows, needAutoSize]);
(0,useLayoutEffect["default"])(() => {
if (resizeState === RESIZE_START) {
setResizeState(RESIZE_MEASURING);
} else if (resizeState === RESIZE_MEASURING) {
const textareaStyles = calculateAutoSizeStyle(textareaRef.current, false, minRows, maxRows);
// Safari has bug that text will keep break line on text cut when it's prev is break line.
// ZombieJ: This not often happen. So we just skip it.
// const { selectionStart, selectionEnd, scrollTop } = textareaRef.current;
// const { value: tmpValue } = textareaRef.current;
// textareaRef.current.value = '';
// textareaRef.current.value = tmpValue;
// if (document.activeElement === textareaRef.current) {
// textareaRef.current.scrollTop = scrollTop;
// textareaRef.current.setSelectionRange(selectionStart, selectionEnd);
// }
setResizeState(RESIZE_STABLE);
setAutoSizeStyle(textareaStyles);
} else {
// https://github.com/react-component/textarea/pull/23
// Firefox has blink issue before but fixed in latest version.
}
}, [resizeState]);
// We lock resize trigger by raf to avoid Safari warning
const resizeRafRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
const cleanRaf = () => {
raf["default"].cancel(resizeRafRef.current);
};
const onInternalResize = size => {
if (resizeState === RESIZE_STABLE) {
onResize?.(size);
if (autoSize) {
cleanRaf();
resizeRafRef.current = (0,raf["default"])(() => {
startResize();
});
}
}
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => cleanRaf, []);
// =============================== Render ===============================
const mergedAutoSizeStyle = needAutoSize ? autoSizeStyle : null;
const mergedStyle = {
...style,
...mergedAutoSizeStyle
};
if (resizeState === RESIZE_START || resizeState === RESIZE_MEASURING) {
mergedStyle.overflowY = 'hidden';
mergedStyle.overflowX = 'hidden';
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(resize_observer_es, {
onResize: onInternalResize,
disabled: !(autoSize || onResize)
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("textarea", ResizableTextArea_extends({}, restProps, {
ref: textareaRef,
style: mergedStyle,
className: (0,clsx.clsx)(prefixCls, className, {
[`${prefixCls}-disabled`]: disabled
}),
disabled: disabled,
value: mergedValue,
onChange: onInternalChange
})));
});
/* harmony default export */ var es_ResizableTextArea = (ResizableTextArea);
;// ./node_modules/@rc-component/textarea/es/TextArea.js
function TextArea_extends() { TextArea_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return TextArea_extends.apply(this, arguments); }
const TextArea = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef(({
defaultValue,
value: customValue,
onFocus,
onBlur,
onChange,
allowClear,
maxLength,
onCompositionStart,
onCompositionEnd,
suffix,
prefixCls = 'rc-textarea',
showCount,
count,
className,
style,
disabled,
hidden,
classNames,
styles,
onResize,
onClear,
onPressEnter,
readOnly,
autoSize,
onKeyDown,
...rest
}, ref) => {
const [value, setValue] = (0,useControlledState["default"])(defaultValue, customValue);
const formatValue = value === undefined || value === null ? '' : String(value);
const [focused, setFocused] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(false);
const compositionRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(false);
const [textareaResized, setTextareaResized] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(null);
// =============================== Ref ================================
const holderRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const resizableTextAreaRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const getTextArea = () => resizableTextAreaRef.current?.textArea;
const focus = () => {
getTextArea().focus();
};
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref, () => ({
resizableTextArea: resizableTextAreaRef.current,
focus,
blur: () => {
getTextArea().blur();
},
nativeElement: holderRef.current?.nativeElement || getTextArea()
}));
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
setFocused(prev => !disabled && prev);
}, [disabled]);
// =========================== Select Range ===========================
const [selection, setSelection] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(() => {
if (selection) {
getTextArea().setSelectionRange(...selection);
}
}, [selection]);
// ============================== Count ===============================
const countConfig = useCount(count, showCount);
const mergedMax = countConfig.max ?? maxLength;
// Max length value
const hasMaxLength = Number(mergedMax) > 0;
const valueLength = countConfig.strategy(formatValue);
const isOutOfRange = !!mergedMax && valueLength > mergedMax;
// ============================== Change ==============================
const triggerChange = (e, currentValue) => {
let cutValue = currentValue;
if (!compositionRef.current && countConfig.exceedFormatter && countConfig.max && countConfig.strategy(currentValue) > countConfig.max) {
cutValue = countConfig.exceedFormatter(currentValue, {
max: countConfig.max
});
if (currentValue !== cutValue) {
setSelection([getTextArea().selectionStart || 0, getTextArea().selectionEnd || 0]);
}
}
setValue(cutValue);
resolveOnChange(e.currentTarget, e, onChange, cutValue);
};
// =========================== Value Update ===========================
const onInternalCompositionStart = e => {
compositionRef.current = true;
onCompositionStart?.(e);
};
const onInternalCompositionEnd = e => {
compositionRef.current = false;
triggerChange(e, e.currentTarget.value);
onCompositionEnd?.(e);
};
const onInternalChange = e => {
triggerChange(e, e.target.value);
};
const handleKeyDown = e => {
if (e.key === 'Enter' && onPressEnter && !e.nativeEvent.isComposing) {
onPressEnter(e);
}
onKeyDown?.(e);
};
const handleFocus = e => {
setFocused(true);
onFocus?.(e);
};
const handleBlur = e => {
setFocused(false);
onBlur?.(e);
};
// ============================== Reset ===============================
const handleReset = e => {
setValue('');
focus();
resolveOnChange(getTextArea(), e, onChange);
};
let suffixNode = suffix;
let dataCount;
if (countConfig.show) {
if (countConfig.showFormatter) {
dataCount = countConfig.showFormatter({
value: formatValue,
count: valueLength,
maxLength: mergedMax
});
} else {
dataCount = `${valueLength}${hasMaxLength ? ` / ${mergedMax}` : ''}`;
}
suffixNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, suffixNode, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}-data-count`, classNames?.count),
style: styles?.count
}, dataCount));
}
const handleResize = size => {
onResize?.(size);
if (getTextArea()?.style.height) {
setTextareaResized(true);
}
};
const isPureTextArea = !autoSize && !showCount && !allowClear;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_BaseInput, {
ref: holderRef,
value: formatValue,
allowClear: allowClear,
handleReset: handleReset,
suffix: suffixNode,
prefixCls: prefixCls,
classNames: {
...classNames,
affixWrapper: (0,clsx.clsx)(classNames?.affixWrapper, {
[`${prefixCls}-show-count`]: showCount,
[`${prefixCls}-textarea-allow-clear`]: allowClear
})
},
disabled: disabled,
focused: focused,
className: (0,clsx.clsx)(className, isOutOfRange && `${prefixCls}-out-of-range`),
style: {
...style,
...(textareaResized && !isPureTextArea ? {
height: 'auto'
} : {})
},
dataAttrs: {
affixWrapper: {
'data-count': typeof dataCount === 'string' ? dataCount : undefined
}
},
hidden: hidden,
readOnly: readOnly,
onClear: onClear
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_ResizableTextArea, TextArea_extends({}, rest, {
autoSize: autoSize,
maxLength: maxLength,
onKeyDown: handleKeyDown,
onChange: onInternalChange,
onFocus: handleFocus,
onBlur: handleBlur,
onCompositionStart: onInternalCompositionStart,
onCompositionEnd: onInternalCompositionEnd,
className: (0,clsx.clsx)(classNames?.textarea),
style: {
resize: style?.resize,
...styles?.textarea
},
disabled: disabled,
prefixCls: prefixCls,
onResize: handleResize,
ref: resizableTextAreaRef,
readOnly: readOnly
})));
});
/* harmony default export */ var es_TextArea = (TextArea);
;// ./node_modules/@rc-component/textarea/es/index.js
/* harmony default export */ var textarea_es = (es_TextArea);
;// ./components/input/style/textarea.ts
const genTextAreaStyle = token => {
const {
componentCls,
paddingLG
} = token;
const textareaPrefixCls = `${componentCls}-textarea`;
return {
// Raw Textarea
[`textarea${componentCls}`]: {
maxWidth: '100%',
// prevent textarea resize from coming out of its container
height: 'auto',
minHeight: token.controlHeight,
lineHeight: token.lineHeight,
verticalAlign: 'bottom',
transition: `all ${token.motionDurationSlow}`,
resize: 'vertical',
[`&${componentCls}-mouse-active`]: {
transition: `all ${token.motionDurationSlow}, height 0s, width 0s`
}
},
// Wrapper for resize
[`${componentCls}-textarea-affix-wrapper-resize-dirty`]: {
width: 'auto'
},
[textareaPrefixCls]: {
position: 'relative',
'&-show-count': {
[`${componentCls}-data-count`]: {
position: 'absolute',
bottom: token.calc(token.fontSize).mul(token.lineHeight).mul(-1).equal(),
insetInlineEnd: 0,
color: token.colorTextDescription,
whiteSpace: 'nowrap',
pointerEvents: 'none'
}
},
[`
&-allow-clear > ${componentCls},
&-affix-wrapper${textareaPrefixCls}-has-feedback ${componentCls}
`]: {
paddingInlineEnd: paddingLG
},
[`&-affix-wrapper${componentCls}-affix-wrapper`]: {
padding: 0,
[`> textarea${componentCls}`]: {
fontSize: 'inherit',
border: 'none',
outline: 'none',
background: 'transparent',
minHeight: token.calc(token.controlHeight).sub(token.calc(token.lineWidth).mul(2)).equal(),
'&:focus': {
boxShadow: 'none !important'
}
},
[`${componentCls}-suffix`]: {
margin: 0,
'> *:not(:last-child)': {
marginInline: 0
},
// Clear Icon
[`${componentCls}-clear-icon`]: {
position: 'absolute',
insetInlineEnd: token.paddingInline,
insetBlockStart: token.paddingXS
},
// Feedback Icon
[`${textareaPrefixCls}-suffix`]: {
position: 'absolute',
top: 0,
insetInlineEnd: token.paddingInline,
bottom: 0,
zIndex: 1,
display: 'inline-flex',
alignItems: 'center',
margin: 'auto',
pointerEvents: 'none'
}
}
},
[`&-affix-wrapper${componentCls}-affix-wrapper-rtl`]: {
[`${componentCls}-suffix`]: {
[`${componentCls}-data-count`]: {
direction: 'ltr',
insetInlineStart: 0
}
}
},
[`&-affix-wrapper${componentCls}-affix-wrapper-sm`]: {
[`${componentCls}-suffix`]: {
[`${componentCls}-clear-icon`]: {
insetInlineEnd: token.paddingInlineSM
}
}
}
}
};
};
// ============================== Export ==============================
/* harmony default export */ var style_textarea = ((0,genStyleUtils.genStyleHooks)(['Input', 'TextArea'], token => {
const inputToken = (0,cssinjs_utils_es.mergeToken)(token, (0,input_style_token.initInputToken)(token));
return genTextAreaStyle(inputToken);
}, input_style_token.initComponentToken, {
resetFont: false
}));
;// ./components/input/TextArea.tsx
const TextArea_TextArea = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((props, ref) => {
const {
prefixCls: customizePrefixCls,
bordered = true,
size: customizeSize,
disabled: customDisabled,
status: customStatus,
allowClear,
classNames,
rootClassName,
className,
style,
styles,
variant: customVariant,
showCount,
onMouseDown,
onResize,
...rest
} = props;
if (true) {
const {
deprecated
} = (0,_util_warning.devUseWarning)('TextArea');
deprecated(!('bordered' in props), 'bordered', 'variant');
}
const {
getPrefixCls,
direction,
allowClear: contextAllowClear,
autoComplete: contextAutoComplete,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('textArea');
// =================== Disabled ===================
const disabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
const mergedDisabled = customDisabled ?? disabled;
// ==================== Status ====================
const {
status: contextStatus,
hasFeedback,
feedbackIcon
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FormItemInputContext);
const mergedStatus = getMergedStatus(contextStatus, customStatus);
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props
});
// ===================== Ref ======================
const innerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
resizableTextArea: innerRef.current?.resizableTextArea,
focus: option => {
triggerFocus(innerRef.current?.resizableTextArea?.textArea, option);
},
blur: () => innerRef.current?.blur(),
nativeElement: innerRef.current?.nativeElement || null
}));
const prefixCls = getPrefixCls('input', customizePrefixCls);
// ==================== Style =====================
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,input_style.useSharedStyle)(prefixCls, rootClassName);
style_textarea(prefixCls, rootCls);
// ================= Compact Item =================
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
// ===================== Size =====================
const mergedSize = (0,useSize["default"])(ctx => customizeSize ?? compactSize ?? ctx);
const [variant, enableVariantCls] = useVariants('textArea', customVariant, bordered);
const mergedAllowClear = _util_getAllowClear(allowClear ?? contextAllowClear);
// ==================== Resize ====================
// https://github.com/ant-design/ant-design/issues/51594
const [isMouseDown, setIsMouseDown] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
// When has wrapper, resize will make as dirty for `resize: both` style
const [resizeDirty, setResizeDirty] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const onInternalMouseDown = e => {
setIsMouseDown(true);
onMouseDown?.(e);
const onMouseUp = () => {
setIsMouseDown(false);
document.removeEventListener('mouseup', onMouseUp);
};
document.addEventListener('mouseup', onMouseUp);
};
const onInternalResize = size => {
onResize?.(size);
// Change to dirty since this maybe from the `resize: both` style
if (isMouseDown && typeof getComputedStyle === 'function') {
const ele = innerRef.current?.nativeElement?.querySelector('textarea');
if (ele && getComputedStyle(ele).resize === 'both') {
setResizeDirty(true);
}
}
};
// ==================== Render ====================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(textarea_es, {
autoComplete: contextAutoComplete,
...rest,
style: {
...mergedStyles.root,
...contextStyle,
...style
},
styles: mergedStyles,
disabled: mergedDisabled,
allowClear: mergedAllowClear,
className: (0,clsx.clsx)(cssVarCls, rootCls, className, rootClassName, compactItemClassnames, contextClassName, mergedClassNames.root,
// Only for wrapper
{
[`${prefixCls}-textarea-affix-wrapper-resize-dirty`]: resizeDirty
}),
classNames: {
...mergedClassNames,
textarea: (0,clsx.clsx)({
[`${prefixCls}-sm`]: mergedSize === 'small',
[`${prefixCls}-lg`]: mergedSize === 'large'
}, hashId, mergedClassNames.textarea, isMouseDown && `${prefixCls}-mouse-active`),
variant: (0,clsx.clsx)({
[`${prefixCls}-${variant}`]: enableVariantCls
}, getStatusClassNames(prefixCls, mergedStatus)),
affixWrapper: (0,clsx.clsx)(`${prefixCls}-textarea-affix-wrapper`, {
[`${prefixCls}-affix-wrapper-rtl`]: direction === 'rtl',
[`${prefixCls}-affix-wrapper-sm`]: mergedSize === 'small',
[`${prefixCls}-affix-wrapper-lg`]: mergedSize === 'large',
[`${prefixCls}-textarea-show-count`]: showCount || props.count?.show
}, hashId)
},
prefixCls: prefixCls,
suffix: hasFeedback && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-textarea-suffix`
}, feedbackIcon),
showCount: showCount,
ref: innerRef,
onResize: onInternalResize,
onMouseDown: onInternalMouseDown
});
});
/* harmony default export */ var input_TextArea = (TextArea_TextArea);
;// ./components/input/index.tsx
const components_input_Input = input_Input;
components_input_Input.Group = input_Group;
components_input_Input.Search = input_Search;
components_input_Input.TextArea = input_TextArea;
components_input_Input.Password = input_Password;
components_input_Input.OTP = input_OTP;
/* harmony default export */ var input = (components_input_Input);
;// ./components/layout/hooks/useHasSider.ts
function useHasSider(siders, children, hasSider) {
if (typeof hasSider === 'boolean') {
return hasSider;
}
if (siders.length) {
return true;
}
const childNodes = (0,es.toArray)(children);
return childNodes.some(node => node.type === layout_Sider);
}
;// ./components/layout/layout.tsx
const generator = ({
suffixCls,
tagName,
displayName
}) => {
return Component => {
const Adapter = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, {
ref: ref,
suffixCls: suffixCls,
tagName: tagName,
...props
})));
if (true) {
Adapter.displayName = displayName;
}
return Adapter;
};
};
const Basic = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
suffixCls,
className,
tagName: TagName,
...others
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('layout', customizePrefixCls);
const [hashId] = (0,layout_style["default"])(prefixCls);
const prefixWithSuffixCls = suffixCls ? `${prefixCls}-${suffixCls}` : prefixCls;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TagName, {
className: (0,clsx.clsx)(customizePrefixCls || prefixWithSuffixCls, className, hashId),
ref: ref,
...others
});
});
const BasicLayout = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
direction
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const [siders, setSiders] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([]);
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
children,
hasSider,
tagName: Tag,
style,
...others
} = props;
const passedProps = (0,es.omit)(others, ['suffixCls']);
const {
getPrefixCls,
className: contextClassName,
style: contextStyle
} = (0,config_provider_context.useComponentConfig)('layout');
const prefixCls = getPrefixCls('layout', customizePrefixCls);
const mergedHasSider = useHasSider(siders, children, hasSider);
const [hashId, cssVarCls] = (0,layout_style["default"])(prefixCls);
const classString = (0,clsx.clsx)(prefixCls, {
[`${prefixCls}-has-sider`]: mergedHasSider,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, contextClassName, className, rootClassName, hashId, cssVarCls);
const contextValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
siderHook: {
addSider: id => {
setSiders(prev => [].concat((0,toConsumableArray["default"])(prev), [id]));
},
removeSider: id => {
setSiders(prev => prev.filter(currentId => currentId !== id));
}
}
}), []);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(LayoutContext.Provider, {
value: contextValue
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Tag, {
ref: ref,
className: classString,
style: {
...contextStyle,
...style
},
...passedProps
}, children));
});
const Layout = generator({
tagName: 'div',
displayName: 'Layout'
})(BasicLayout);
const layout_Header = generator({
suffixCls: 'header',
tagName: 'header',
displayName: 'Header'
})(Basic);
const layout_Footer = generator({
suffixCls: 'footer',
tagName: 'footer',
displayName: 'Footer'
})(Basic);
const layout_Content = generator({
suffixCls: 'content',
tagName: 'main',
displayName: 'Content'
})(Basic);
/* harmony default export */ var layout = (Layout);
;// ./components/layout/index.tsx
const layout_Layout = layout;
layout_Layout.Header = layout_Header;
layout_Layout.Footer = layout_Footer;
layout_Layout.Content = layout_Content;
layout_Layout.Sider = layout_Sider;
layout_Layout._InternalSiderContext = SiderContext;
/* harmony default export */ var components_layout = (layout_Layout);
;// ./node_modules/@ant-design/icons-svg/es/asn/DoubleLeftOutlined.js
// This icon file is generated automatically.
var DoubleLeftOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M272.9 512l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L186.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H532c6.7 0 10.4-7.7 6.3-12.9L272.9 512zm304 0l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L490.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H836c6.7 0 10.4-7.7 6.3-12.9L576.9 512z" } }] }, "name": "double-left", "theme": "outlined" };
/* harmony default export */ var asn_DoubleLeftOutlined = (DoubleLeftOutlined);
;// ./node_modules/@ant-design/icons/es/icons/DoubleLeftOutlined.js
function DoubleLeftOutlined_extends() { DoubleLeftOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return DoubleLeftOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const DoubleLeftOutlined_DoubleLeftOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], DoubleLeftOutlined_extends({}, props, {
ref: ref,
icon: asn_DoubleLeftOutlined
}));
/** */
const DoubleLeftOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(DoubleLeftOutlined_DoubleLeftOutlined);
if (true) {
DoubleLeftOutlined_RefIcon.displayName = 'DoubleLeftOutlined';
}
/* harmony default export */ var icons_DoubleLeftOutlined = (DoubleLeftOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/DoubleRightOutlined.js
// This icon file is generated automatically.
var DoubleRightOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M533.2 492.3L277.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H188c-6.7 0-10.4 7.7-6.3 12.9L447.1 512 181.7 851.1A7.98 7.98 0 00188 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5zm304 0L581.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H492c-6.7 0-10.4 7.7-6.3 12.9L751.1 512 485.7 851.1A7.98 7.98 0 00492 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5z" } }] }, "name": "double-right", "theme": "outlined" };
/* harmony default export */ var asn_DoubleRightOutlined = (DoubleRightOutlined);
;// ./node_modules/@ant-design/icons/es/icons/DoubleRightOutlined.js
function DoubleRightOutlined_extends() { DoubleRightOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return DoubleRightOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const DoubleRightOutlined_DoubleRightOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], DoubleRightOutlined_extends({}, props, {
ref: ref,
icon: asn_DoubleRightOutlined
}));
/** */
const DoubleRightOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(DoubleRightOutlined_DoubleRightOutlined);
if (true) {
DoubleRightOutlined_RefIcon.displayName = 'DoubleRightOutlined';
}
/* harmony default export */ var icons_DoubleRightOutlined = (DoubleRightOutlined_RefIcon);
// EXTERNAL MODULE: ./node_modules/@rc-component/pagination/es/locale/zh_CN.js
var zh_CN = __webpack_require__("./node_modules/@rc-component/pagination/es/locale/zh_CN.js");
;// ./node_modules/@rc-component/pagination/es/Options.js
const defaultPageSizeOptions = [10, 20, 50, 100];
const Options = props => {
const {
pageSizeOptions = defaultPageSizeOptions,
locale,
changeSize,
pageSize,
goButton,
quickGo,
rootPrefixCls,
disabled,
buildOptionText,
showSizeChanger,
sizeChangerRender
} = props;
const [goInputText, setGoInputText] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState('');
const getValidValue = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
return !goInputText || Number.isNaN(goInputText) ? undefined : Number(goInputText);
}, [goInputText]);
const mergeBuildOptionText = typeof buildOptionText === 'function' ? buildOptionText : value => `${value} ${locale.items_per_page}`;
const handleChange = e => {
const value = e.target.value;
if (/^\d*$/.test(value)) {
setGoInputText(value);
}
};
const handleBlur = e => {
if (goButton || goInputText === '') {
return;
}
setGoInputText('');
if (e.relatedTarget && (e.relatedTarget.className.includes(`${rootPrefixCls}-item-link`) || e.relatedTarget.className.includes(`${rootPrefixCls}-item`))) {
return;
}
quickGo?.(getValidValue);
};
const go = e => {
if (goInputText === '') {
return;
}
if (e.keyCode === KeyCode["default"].ENTER || e.type === 'click') {
setGoInputText('');
quickGo?.(getValidValue);
}
};
const getPageSizeOptions = () => {
if (pageSizeOptions.some(option => option.toString() === pageSize.toString())) {
return pageSizeOptions;
}
return pageSizeOptions.concat([pageSize]).sort((a, b) => {
const numberA = Number.isNaN(Number(a)) ? 0 : Number(a);
const numberB = Number.isNaN(Number(b)) ? 0 : Number(b);
return numberA - numberB;
});
};
// ============== cls ==============
const prefixCls = `${rootPrefixCls}-options`;
// ============== render ==============
if (!showSizeChanger && !quickGo) {
return null;
}
let changeSelect = null;
let goInput = null;
let gotoButton = null;
// >>>>> Size Changer
if (showSizeChanger && sizeChangerRender) {
changeSelect = sizeChangerRender({
disabled,
size: pageSize,
onSizeChange: nextValue => {
changeSize?.(Number(nextValue));
},
'aria-label': locale.page_size,
className: `${prefixCls}-size-changer`,
options: getPageSizeOptions().map(opt => ({
label: mergeBuildOptionText(opt),
value: opt
}))
});
}
// >>>>> Quick Go
if (quickGo) {
if (goButton) {
gotoButton = typeof goButton === 'boolean' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
type: "button",
onClick: go,
onKeyUp: go,
disabled: disabled,
className: `${prefixCls}-quick-jumper-button`
}, locale.jump_to_confirm) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
onClick: go,
onKeyUp: go
}, goButton);
}
goInput = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${prefixCls}-quick-jumper`
}, locale.jump_to, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", {
disabled: disabled,
type: "text",
value: goInputText,
onChange: handleChange,
onKeyUp: go,
onBlur: handleBlur,
"aria-label": locale.page
}), locale.page, gotoButton);
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
className: prefixCls
}, changeSelect, goInput);
};
if (true) {
Options.displayName = 'Options';
}
/* harmony default export */ var es_Options = (Options);
;// ./node_modules/@rc-component/pagination/es/Pager.js
/* eslint react/prop-types: 0 */
const Pager = props => {
const {
rootPrefixCls,
page,
active,
className,
style,
showTitle,
onClick,
onKeyPress,
itemRender
} = props;
const prefixCls = `${rootPrefixCls}-item`;
const cls = (0,clsx.clsx)(prefixCls, `${prefixCls}-${page}`, {
[`${prefixCls}-active`]: active,
[`${prefixCls}-disabled`]: !page
}, className);
const handleClick = () => {
onClick(page);
};
const handleKeyPress = e => {
onKeyPress(e, onClick, page);
};
const pager = itemRender(page, 'page', /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
rel: "nofollow"
}, page));
return pager ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
title: showTitle ? String(page) : null,
className: cls,
style: style,
onClick: handleClick,
onKeyDown: handleKeyPress,
tabIndex: 0
}, pager) : null;
};
if (true) {
Pager.displayName = 'Pager';
}
/* harmony default export */ var es_Pager = (Pager);
;// ./node_modules/@rc-component/pagination/es/Pagination.js
function Pagination_extends() { Pagination_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Pagination_extends.apply(this, arguments); }
const defaultItemRender = (_, __, element) => element;
function Pagination_noop() {}
function isInteger(v) {
const value = Number(v);
return typeof value === 'number' && !Number.isNaN(value) && isFinite(value) && Math.floor(value) === value;
}
function calculatePage(p, pageSize, total) {
const _pageSize = typeof p === 'undefined' ? pageSize : p;
return Math.floor((total - 1) / _pageSize) + 1;
}
const Pagination = props => {
const {
// cls
prefixCls = 'rc-pagination',
selectPrefixCls = 'rc-select',
className,
classNames: paginationClassNames,
styles,
// control
current: currentProp,
defaultCurrent = 1,
total = 0,
pageSize: pageSizeProp,
defaultPageSize = 10,
onChange = Pagination_noop,
// config
hideOnSinglePage,
align,
showPrevNextJumpers = true,
showQuickJumper,
showLessItems,
showTitle = true,
onShowSizeChange = Pagination_noop,
locale = zh_CN["default"],
style,
totalBoundaryShowSizeChanger = 50,
disabled,
simple,
showTotal,
showSizeChanger = total > totalBoundaryShowSizeChanger,
sizeChangerRender,
pageSizeOptions,
// render
itemRender = defaultItemRender,
jumpPrevIcon,
jumpNextIcon,
prevIcon,
nextIcon
} = props;
const paginationRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
const [pageSize, setPageSize] = (0,useControlledState["default"])(defaultPageSize, pageSizeProp);
const [internalCurrent, setCurrent] = (0,useControlledState["default"])(defaultCurrent, currentProp);
const current = Math.max(1, Math.min(internalCurrent, calculatePage(undefined, pageSize, total)));
const [internalInputVal, setInternalInputVal] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(current);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
setInternalInputVal(current);
}, [current]);
const hasOnChange = onChange !== Pagination_noop;
const hasCurrent = ('current' in props);
if (true) {
(0,warning["default"])(hasCurrent ? hasOnChange : true, 'You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.');
}
const jumpPrevPage = Math.max(1, current - (showLessItems ? 3 : 5));
const jumpNextPage = Math.min(calculatePage(undefined, pageSize, total), current + (showLessItems ? 3 : 5));
function getItemIcon(icon, label) {
let iconNode = icon || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
type: "button",
"aria-label": label,
className: `${prefixCls}-item-link`
});
if (typeof icon === 'function') {
iconNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icon, props);
}
return iconNode;
}
function getValidValue(e) {
const inputValue = e.target.value;
const allPages = calculatePage(undefined, pageSize, total);
let value;
if (inputValue === '') {
value = inputValue;
} else if (Number.isNaN(Number(inputValue))) {
value = internalInputVal;
} else if (inputValue >= allPages) {
value = allPages;
} else {
value = Number(inputValue);
}
return value;
}
function isValid(page) {
return isInteger(page) && page !== current && isInteger(total) && total > 0;
}
const shouldDisplayQuickJumper = total > pageSize ? showQuickJumper : false;
/**
* prevent "up arrow" key reseting cursor position within textbox
* @see https://stackoverflow.com/a/1081114
*/
function handleKeyDown(event) {
if (event.keyCode === KeyCode["default"].UP || event.keyCode === KeyCode["default"].DOWN) {
event.preventDefault();
}
}
function handleKeyUp(event) {
const value = getValidValue(event);
if (value !== internalInputVal) {
setInternalInputVal(value);
}
switch (event.keyCode) {
case KeyCode["default"].ENTER:
handleChange(value);
break;
case KeyCode["default"].UP:
handleChange(value - 1);
break;
case KeyCode["default"].DOWN:
handleChange(value + 1);
break;
default:
break;
}
}
function handleBlur(event) {
handleChange(getValidValue(event));
}
function changePageSize(size) {
const newCurrent = calculatePage(size, pageSize, total);
const nextCurrent = current > newCurrent && newCurrent !== 0 ? newCurrent : current;
setPageSize(size);
setInternalInputVal(nextCurrent);
onShowSizeChange?.(current, size);
setCurrent(nextCurrent);
onChange?.(nextCurrent, size);
}
function handleChange(page) {
if (isValid(page) && !disabled) {
const currentPage = calculatePage(undefined, pageSize, total);
let newPage = page;
if (page > currentPage) {
newPage = currentPage;
} else if (page < 1) {
newPage = 1;
}
if (newPage !== internalInputVal) {
setInternalInputVal(newPage);
}
setCurrent(newPage);
onChange?.(newPage, pageSize);
return newPage;
}
return current;
}
const hasPrev = current > 1;
const hasNext = current < calculatePage(undefined, pageSize, total);
function prevHandle() {
if (hasPrev) handleChange(current - 1);
}
function nextHandle() {
if (hasNext) handleChange(current + 1);
}
function jumpPrevHandle() {
handleChange(jumpPrevPage);
}
function jumpNextHandle() {
handleChange(jumpNextPage);
}
function runIfEnter(event, callback, ...restParams) {
if (event.key === 'Enter' || event.charCode === KeyCode["default"].ENTER || event.keyCode === KeyCode["default"].ENTER) {
callback(...restParams);
}
}
function runIfEnterPrev(event) {
runIfEnter(event, prevHandle);
}
function runIfEnterNext(event) {
runIfEnter(event, nextHandle);
}
function runIfEnterJumpPrev(event) {
runIfEnter(event, jumpPrevHandle);
}
function runIfEnterJumpNext(event) {
runIfEnter(event, jumpNextHandle);
}
function renderPrev(prevPage) {
const prevButton = itemRender(prevPage, 'prev', getItemIcon(prevIcon, 'prev page'));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(prevButton) ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(prevButton, {
disabled: !hasPrev
}) : prevButton;
}
function renderNext(nextPage) {
const nextButton = itemRender(nextPage, 'next', getItemIcon(nextIcon, 'next page'));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(nextButton) ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(nextButton, {
disabled: !hasNext
}) : nextButton;
}
function handleGoTO(event) {
if (event.type === 'click' || event.keyCode === KeyCode["default"].ENTER) {
handleChange(internalInputVal);
}
}
let jumpPrev = null;
const dataOrAriaAttributeProps = (0,pickAttrs["default"])(props, {
aria: true,
data: true
});
const totalText = showTotal && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
className: `${prefixCls}-total-text`
}, showTotal(total, [total === 0 ? 0 : (current - 1) * pageSize + 1, current * pageSize > total ? total : current * pageSize]));
let jumpNext = null;
const allPages = calculatePage(undefined, pageSize, total);
// ================== Render ==================
// When hideOnSinglePage is true and there is only 1 page, hide the pager
if (hideOnSinglePage && total <= pageSize) {
return null;
}
const pagerList = [];
const pagerProps = {
rootPrefixCls: prefixCls,
onClick: handleChange,
onKeyPress: runIfEnter,
showTitle,
itemRender,
page: -1,
className: paginationClassNames?.item,
style: styles?.item
};
const prevPage = current - 1 > 0 ? current - 1 : 0;
const nextPage = current + 1 < allPages ? current + 1 : allPages;
const goButton = showQuickJumper && showQuickJumper.goButton;
// ================== Simple ==================
// FIXME: ts type
const isReadOnly = typeof simple === 'object' ? simple.readOnly : !simple;
let gotoButton = goButton;
let simplePager = null;
if (simple) {
// ====== Simple quick jump ======
if (goButton) {
if (typeof goButton === 'boolean') {
gotoButton = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
type: "button",
onClick: handleGoTO,
onKeyUp: handleGoTO
}, locale.jump_to_confirm);
} else {
gotoButton = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
onClick: handleGoTO,
onKeyUp: handleGoTO
}, goButton);
}
gotoButton = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
title: showTitle ? `${locale.jump_to}${current}/${allPages}` : null,
className: `${prefixCls}-simple-pager`
}, gotoButton);
}
simplePager = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
title: showTitle ? `${current}/${allPages}` : null,
className: (0,clsx.clsx)(`${prefixCls}-simple-pager`, paginationClassNames?.item),
style: styles?.item
}, isReadOnly ? internalInputVal : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", {
type: "text",
"aria-label": locale.jump_to,
value: internalInputVal,
disabled: disabled,
onKeyDown: handleKeyDown,
onKeyUp: handleKeyUp,
onChange: handleKeyUp,
onBlur: handleBlur,
size: 3
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: `${prefixCls}-slash`
}, "/"), allPages);
}
// ====================== Normal ======================
const pageBufferSize = showLessItems ? 1 : 2;
if (allPages <= 3 + pageBufferSize * 2) {
if (!allPages) {
pagerList.push( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_Pager, Pagination_extends({}, pagerProps, {
key: "noPager",
page: 1,
className: `${prefixCls}-item-disabled`
})));
}
for (let i = 1; i <= allPages; i += 1) {
pagerList.push( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_Pager, Pagination_extends({}, pagerProps, {
key: i,
page: i,
active: current === i
})));
}
} else {
const prevItemTitle = showLessItems ? locale.prev_3 : locale.prev_5;
const nextItemTitle = showLessItems ? locale.next_3 : locale.next_5;
const jumpPrevContent = itemRender(jumpPrevPage, 'jump-prev', getItemIcon(jumpPrevIcon, 'prev page'));
const jumpNextContent = itemRender(jumpNextPage, 'jump-next', getItemIcon(jumpNextIcon, 'next page'));
if (showPrevNextJumpers) {
jumpPrev = jumpPrevContent ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
title: showTitle ? prevItemTitle : null,
key: "prev",
onClick: jumpPrevHandle,
tabIndex: 0,
onKeyDown: runIfEnterJumpPrev,
className: (0,clsx.clsx)(`${prefixCls}-jump-prev`, {
[`${prefixCls}-jump-prev-custom-icon`]: !!jumpPrevIcon
})
}, jumpPrevContent) : null;
jumpNext = jumpNextContent ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
title: showTitle ? nextItemTitle : null,
key: "next",
onClick: jumpNextHandle,
tabIndex: 0,
onKeyDown: runIfEnterJumpNext,
className: (0,clsx.clsx)(`${prefixCls}-jump-next`, {
[`${prefixCls}-jump-next-custom-icon`]: !!jumpNextIcon
})
}, jumpNextContent) : null;
}
let left = Math.max(1, current - pageBufferSize);
let right = Math.min(current + pageBufferSize, allPages);
if (current - 1 <= pageBufferSize) {
right = 1 + pageBufferSize * 2;
}
if (allPages - current <= pageBufferSize) {
left = allPages - pageBufferSize * 2;
}
for (let i = left; i <= right; i += 1) {
pagerList.push( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_Pager, Pagination_extends({}, pagerProps, {
key: i,
page: i,
active: current === i
})));
}
if (current - 1 >= pageBufferSize * 2 && current !== 1 + 2) {
pagerList[0] = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(pagerList[0], {
className: (0,clsx.clsx)(`${prefixCls}-item-after-jump-prev`, pagerList[0].props.className)
});
pagerList.unshift(jumpPrev);
}
if (allPages - current >= pageBufferSize * 2 && current !== allPages - 2) {
const lastOne = pagerList[pagerList.length - 1];
pagerList[pagerList.length - 1] = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(lastOne, {
className: (0,clsx.clsx)(`${prefixCls}-item-before-jump-next`, lastOne.props.className)
});
pagerList.push(jumpNext);
}
if (left !== 1) {
pagerList.unshift( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_Pager, Pagination_extends({}, pagerProps, {
key: 1,
page: 1
})));
}
if (right !== allPages) {
pagerList.push( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_Pager, Pagination_extends({}, pagerProps, {
key: allPages,
page: allPages
})));
}
}
let prev = renderPrev(prevPage);
if (prev) {
const prevDisabled = !hasPrev || !allPages;
prev = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
title: showTitle ? locale.prev_page : null,
onClick: prevHandle,
tabIndex: prevDisabled ? null : 0,
onKeyDown: runIfEnterPrev,
className: (0,clsx.clsx)(`${prefixCls}-prev`, paginationClassNames?.item, {
[`${prefixCls}-disabled`]: prevDisabled
}),
style: styles?.item,
"aria-disabled": prevDisabled
}, prev);
}
let next = renderNext(nextPage);
if (next) {
let nextDisabled, nextTabIndex;
if (simple) {
nextDisabled = !hasNext;
nextTabIndex = hasPrev ? 0 : null;
} else {
nextDisabled = !hasNext || !allPages;
nextTabIndex = nextDisabled ? null : 0;
}
next = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
title: showTitle ? locale.next_page : null,
onClick: nextHandle,
tabIndex: nextTabIndex,
onKeyDown: runIfEnterNext,
className: (0,clsx.clsx)(`${prefixCls}-next`, paginationClassNames?.item, {
[`${prefixCls}-disabled`]: nextDisabled
}),
style: styles?.item,
"aria-disabled": nextDisabled
}, next);
}
const cls = (0,clsx.clsx)(prefixCls, className, {
[`${prefixCls}-start`]: align === 'start',
[`${prefixCls}-center`]: align === 'center',
[`${prefixCls}-end`]: align === 'end',
[`${prefixCls}-simple`]: simple,
[`${prefixCls}-disabled`]: disabled
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("ul", Pagination_extends({
className: cls,
style: style,
ref: paginationRef
}, dataOrAriaAttributeProps), totalText, prev, simple ? simplePager : pagerList, next, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_Options, {
locale: locale,
rootPrefixCls: prefixCls,
disabled: disabled,
selectPrefixCls: selectPrefixCls,
changeSize: changePageSize,
pageSize: pageSize,
pageSizeOptions: pageSizeOptions,
quickGo: shouldDisplayQuickJumper ? handleChange : null,
goButton: gotoButton,
showSizeChanger: showSizeChanger,
sizeChangerRender: sizeChangerRender
}));
};
if (true) {
Pagination.displayName = 'Pagination';
}
/* harmony default export */ var es_Pagination = (Pagination);
;// ./node_modules/@rc-component/pagination/es/index.js
// EXTERNAL MODULE: ./node_modules/@rc-component/pagination/es/locale/en_US.js
var es_locale_en_US = __webpack_require__("./node_modules/@rc-component/pagination/es/locale/en_US.js");
// EXTERNAL MODULE: ./components/pagination/style/index.ts
var pagination_style = __webpack_require__("./components/pagination/style/index.ts");
;// ./components/pagination/style/bordered.ts
const genBorderedStyle = token => {
const {
componentCls
} = token;
return {
[`${componentCls}${componentCls}-bordered${componentCls}-disabled`]: {
'&, &:hover': {
[`${componentCls}-item-link`]: {
borderColor: token.colorBorder
}
},
'&:focus-visible': {
[`${componentCls}-item-link`]: {
borderColor: token.colorBorder
}
},
[`${componentCls}-item, ${componentCls}-item-link`]: {
backgroundColor: token.colorBgContainerDisabled,
borderColor: token.colorBorder,
[`&:hover:not(${componentCls}-item-active)`]: {
backgroundColor: token.colorBgContainerDisabled,
borderColor: token.colorBorder,
a: {
color: token.colorTextDisabled
}
},
[`&${componentCls}-item-active`]: {
backgroundColor: token.itemActiveBgDisabled
}
},
[`${componentCls}-prev, ${componentCls}-next`]: {
'&:hover button': {
backgroundColor: token.colorBgContainerDisabled,
borderColor: token.colorBorder,
color: token.colorTextDisabled
},
[`${componentCls}-item-link`]: {
backgroundColor: token.colorBgContainerDisabled,
borderColor: token.colorBorder
}
}
},
[`${componentCls}${componentCls}-bordered`]: {
[`${componentCls}-prev, ${componentCls}-next`]: {
'&:hover button': {
borderColor: token.colorPrimaryHover,
backgroundColor: token.itemBg
},
[`${componentCls}-item-link`]: {
backgroundColor: token.itemLinkBg,
borderColor: token.colorBorder
},
[`&:hover ${componentCls}-item-link`]: {
borderColor: token.colorPrimary,
backgroundColor: token.itemBg,
color: token.colorPrimary
},
[`&${componentCls}-disabled`]: {
[`${componentCls}-item-link`]: {
borderColor: token.colorBorder,
color: token.colorTextDisabled
}
}
},
[`${componentCls}-item`]: {
backgroundColor: token.itemBg,
border: `${(0,cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
[`&:hover:not(${componentCls}-item-active)`]: {
borderColor: token.colorPrimary,
backgroundColor: token.itemBg,
a: {
color: token.colorPrimary
}
},
'&-active': {
borderColor: token.colorPrimary
}
}
}
};
};
/* harmony default export */ var bordered = ((0,genStyleUtils.genSubStyleComponent)(['Pagination', 'bordered'], token => {
const paginationToken = (0,pagination_style.prepareToken)(token);
return genBorderedStyle(paginationToken);
}, pagination_style.prepareComponentToken));
;// ./components/pagination/useShowSizeChanger.ts
function useShowSizeChanger(showSizeChanger) {
return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (typeof showSizeChanger === 'boolean') {
return [showSizeChanger, {}];
}
if ((0,is.isPlainObject)(showSizeChanger)) {
return [true, showSizeChanger];
}
return [undefined, undefined];
}, [showSizeChanger]);
}
;// ./components/pagination/Pagination.tsx
const Pagination_Pagination = props => {
const {
align,
prefixCls: customizePrefixCls,
selectPrefixCls: customizeSelectPrefixCls,
className,
rootClassName,
style,
size: customizeSize,
locale: customLocale,
responsive,
showSizeChanger,
selectComponentClass,
pageSizeOptions,
styles,
classNames,
...restProps
} = props;
const {
xs
} = hooks_useBreakpoint(responsive);
const [, token] = (0,useToken["default"])();
const {
getPrefixCls,
direction,
showSizeChanger: contextShowSizeChangerConfig,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles,
totalBoundaryShowSizeChanger: contextTotalBoundaryShowSizeChanger
} = (0,config_provider_context.useComponentConfig)('pagination');
const prefixCls = getPrefixCls('pagination', customizePrefixCls);
// Style
const [hashId, cssVarCls] = (0,pagination_style["default"])(prefixCls);
// ============================== Size ==============================
const mergedSize = (0,useSize["default"])(customizeSize);
const isSmall = mergedSize === 'small' || !!(xs && !mergedSize && responsive);
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
size: mergedSize
};
// ========================= Style ==========================
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
// ============================= Locale =============================
const [contextLocale] = (0,useLocale["default"])('Pagination', es_locale_en_US["default"]);
const locale = {
...contextLocale,
...customLocale
};
// ========================== Size Changer ==========================
// Merge the props showSizeChanger
const [propShowSizeChanger, propSizeChangerSelectProps] = useShowSizeChanger(showSizeChanger);
const [contextShowSizeChanger, contextSizeChangerSelectProps] = useShowSizeChanger(contextShowSizeChangerConfig);
const mergedShowSizeChanger = propShowSizeChanger ?? contextShowSizeChanger;
const mergedShowSizeChangerSelectProps = propSizeChangerSelectProps ?? contextSizeChangerSelectProps;
const SizeChanger = selectComponentClass || components_select;
// Generate options
const mergedPageSizeOptions = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
return pageSizeOptions ? pageSizeOptions.map(Number) : undefined;
}, [pageSizeOptions]);
// Render size changer
const sizeChangerRender = info => {
const {
disabled,
size: pageSize,
onSizeChange,
'aria-label': ariaLabel,
className: sizeChangerClassName,
options
} = info;
const {
className: propSizeChangerClassName,
onChange: propSizeChangerOnChange
} = mergedShowSizeChangerSelectProps || {};
// Origin Select is using Select.Option,
// So it make the option value must be string
// Just for compatible
const selectedValue = options.find(option => String(option.value) === String(pageSize))?.value;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(SizeChanger, {
disabled: disabled,
showSearch: true,
popupMatchSelectWidth: false,
getPopupContainer: triggerNode => triggerNode.parentNode,
"aria-label": ariaLabel,
options: options,
...mergedShowSizeChangerSelectProps,
value: selectedValue,
onChange: (nextSize, option) => {
onSizeChange?.(nextSize);
propSizeChangerOnChange?.(nextSize, option);
},
size: mergedSize,
className: (0,clsx.clsx)(sizeChangerClassName, propSizeChangerClassName)
});
};
if (true) {
const warning = (0,_util_warning.devUseWarning)('Pagination');
true ? warning(!selectComponentClass, 'usage', '`selectComponentClass` is not official api which will be removed.') : 0;
}
// ============================= Render =============================
const iconsProps = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const ellipsis = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-item-ellipsis`
}, "\u2022\u2022\u2022");
const prevIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
className: `${prefixCls}-item-link`,
type: "button",
tabIndex: -1
}, direction === 'rtl' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RightOutlined["default"], null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LeftOutlined, null));
const nextIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
className: `${prefixCls}-item-link`,
type: "button",
tabIndex: -1
}, direction === 'rtl' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LeftOutlined, null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RightOutlined["default"], null));
const jumpPrevIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("a", {
className: `${prefixCls}-item-link`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-item-container`
}, direction === 'rtl' ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_DoubleRightOutlined, {
className: `${prefixCls}-item-link-icon`
})) : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_DoubleLeftOutlined, {
className: `${prefixCls}-item-link-icon`
})), ellipsis));
const jumpNextIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("a", {
className: `${prefixCls}-item-link`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-item-container`
}, direction === 'rtl' ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_DoubleLeftOutlined, {
className: `${prefixCls}-item-link-icon`
})) : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_DoubleRightOutlined, {
className: `${prefixCls}-item-link-icon`
})), ellipsis));
return {
prevIcon,
nextIcon,
jumpPrevIcon,
jumpNextIcon
};
}, [direction, prefixCls]);
const selectPrefixCls = getPrefixCls('select', customizeSelectPrefixCls);
const extendedClassName = (0,clsx.clsx)({
[`${prefixCls}-${align}`]: !!align,
[`${prefixCls}-${mergedSize}`]: mergedSize,
/** @deprecated Should be removed in v7 */
[`${prefixCls}-mini`]: isSmall,
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-bordered`]: token.wireframe
}, contextClassName, className, rootClassName, mergedClassNames.root, hashId, cssVarCls);
const mergedStyle = {
...mergedStyles.root,
...contextStyle,
...style
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, token.wireframe && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(bordered, {
prefixCls: prefixCls
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Pagination, {
...iconsProps,
...restProps,
styles: mergedStyles,
classNames: mergedClassNames,
style: mergedStyle,
prefixCls: prefixCls,
selectPrefixCls: selectPrefixCls,
className: extendedClassName,
locale: locale,
pageSizeOptions: mergedPageSizeOptions,
showSizeChanger: mergedShowSizeChanger,
totalBoundaryShowSizeChanger: restProps.totalBoundaryShowSizeChanger ?? contextTotalBoundaryShowSizeChanger,
sizeChangerRender: sizeChangerRender
}));
};
if (true) {
Pagination_Pagination.displayName = 'Pagination';
}
/* harmony default export */ var pagination_Pagination = (Pagination_Pagination);
;// ./components/pagination/index.tsx
/* harmony default export */ var components_pagination = (pagination_Pagination);
;// ./components/spin/Indicator/Progress.tsx
const viewSize = 100;
const borderWidth = viewSize / 5;
const radius = viewSize / 2 - borderWidth / 2;
const circumference = radius * 2 * Math.PI;
const position = 50;
const CustomCircle = props => {
const {
dotClassName,
style,
hasCircleCls
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("circle", {
className: (0,clsx.clsx)(`${dotClassName}-circle`, {
[`${dotClassName}-circle-bg`]: hasCircleCls
}),
r: radius,
cx: position,
cy: position,
strokeWidth: borderWidth,
style: style
});
};
const Progress = ({
percent,
prefixCls
}) => {
const dotClassName = `${prefixCls}-dot`;
const holderClassName = `${dotClassName}-holder`;
const hideClassName = `${holderClassName}-hidden`;
const [render, setRender] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
// ==================== Visible =====================
(0,useLayoutEffect["default"])(() => {
if (percent !== 0) {
setRender(true);
}
}, [percent !== 0]);
// ==================== Progress ====================
const safePtg = Math.max(Math.min(percent, 100), 0);
// ===================== Render =====================
if (!render) {
return null;
}
const circleStyle = {
strokeDashoffset: `${circumference / 4}`,
strokeDasharray: `${circumference * safePtg / 100} ${circumference * (100 - safePtg) / 100}`
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(holderClassName, `${dotClassName}-progress`, {
[hideClassName]: safePtg <= 0
})
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("svg", {
viewBox: `0 0 ${viewSize} ${viewSize}`,
role: "progressbar",
"aria-valuemin": 0,
"aria-valuemax": 100,
"aria-valuenow": safePtg
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(CustomCircle, {
dotClassName: dotClassName,
hasCircleCls: true
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(CustomCircle, {
dotClassName: dotClassName,
style: circleStyle
})));
};
/* harmony default export */ var Indicator_Progress = (Progress);
;// ./components/spin/Indicator/Looper.tsx
function Looper(props) {
const {
prefixCls,
percent = 0,
className,
style
} = props;
const dotClassName = `${prefixCls}-dot`;
const holderClassName = `${dotClassName}-holder`;
const hideClassName = `${holderClassName}-hidden`;
// ===================== Render =====================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(holderClassName, className, percent > 0 && hideClassName),
style: style
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(dotClassName, `${prefixCls}-dot-spin`)
}, [1, 2, 3, 4].map(i => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("i", {
className: `${prefixCls}-dot-item`,
key: i
}))))), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Indicator_Progress, {
prefixCls: prefixCls,
percent: percent
}));
}
;// ./components/spin/Indicator/index.tsx
function Indicator(props) {
const {
prefixCls,
indicator,
percent,
className,
style
} = props;
const dotClassName = `${prefixCls}-dot`;
if (indicator && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(indicator)) {
return (0,reactNode.cloneElement)(indicator, currentProps => ({
className: (0,clsx.clsx)(currentProps.className, dotClassName, className),
style: {
...currentProps.style,
...style
},
percent
}));
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Looper, {
prefixCls: prefixCls,
percent: percent,
className: className,
style: style
});
}
// EXTERNAL MODULE: ./components/spin/style/index.ts
var spin_style = __webpack_require__("./components/spin/style/index.ts");
;// ./components/spin/usePercent.ts
const AUTO_INTERVAL = 200;
const STEP_BUCKETS = [[30, 0.05], [70, 0.03], [96, 0.01]];
function usePercent(spinning, percent) {
const [mockPercent, setMockPercent] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const mockIntervalRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const isAuto = percent === 'auto';
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (isAuto && spinning) {
setMockPercent(0);
mockIntervalRef.current = setInterval(() => {
setMockPercent(prev => {
const restPTG = 100 - prev;
for (let i = 0; i < STEP_BUCKETS.length; i += 1) {
const [limit, stepPtg] = STEP_BUCKETS[i];
if (prev <= limit) {
return prev + restPTG * stepPtg;
}
}
return prev;
});
}, AUTO_INTERVAL);
}
return () => {
if (mockIntervalRef.current) {
clearInterval(mockIntervalRef.current);
mockIntervalRef.current = null;
}
};
}, [isAuto, spinning]);
return isAuto ? mockPercent : percent;
}
;// ./components/spin/index.tsx
// Render indicator
let defaultIndicator;
function shouldDelay(spinning, delay) {
return !!spinning && !!delay && !Number.isNaN(Number(delay));
}
const Spin = props => {
const {
prefixCls: customizePrefixCls,
spinning: customSpinning = true,
delay = 0,
className,
rootClassName,
size,
tip,
description,
wrapperClassName,
style,
children,
fullscreen = false,
indicator,
percent,
classNames,
styles,
...restProps
} = props;
const {
getPrefixCls,
direction,
indicator: contextIndicator,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('spin');
const prefixCls = getPrefixCls('spin', customizePrefixCls);
const [hashId, cssVarCls] = (0,spin_style["default"])(prefixCls);
const [spinning, setSpinning] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(() => customSpinning && !shouldDelay(customSpinning, delay));
const mergedPercent = usePercent(spinning, percent);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (customSpinning) {
const showSpinning = debounce(delay, () => {
setSpinning(true);
});
showSpinning();
return () => {
showSpinning?.cancel?.();
};
}
setSpinning(false);
}, [delay, customSpinning]);
// ======================= Size ======================
const mergedSize = (0,useSize["default"])(ctx => size ?? ctx);
if (true) {
const warning = (0,_util_warning.devUseWarning)('Spin');
warning.deprecated(size !== 'default', 'size="default"', 'size="medium"');
}
// ======================= Description ======================
const mergedDescription = description ?? tip;
// =============== Merged Props for Semantic ================
const mergedProps = {
...props,
size: mergedSize,
spinning,
tip: mergedDescription,
description: mergedDescription,
fullscreen,
children,
percent: mergedPercent
};
// ========================= Style ==========================
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
// ======================== Warning =========================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Spin');
warning.deprecated(!tip, 'tip', 'description');
warning.deprecated(!wrapperClassName, 'wrapperClassName', 'classNames.root');
warning.deprecated(!(mergedClassNames?.tip || mergedStyles?.tip), 'classNames.tip and styles.tip', 'classNames.description and styles.description');
warning.deprecated(!(mergedClassNames?.mask || mergedStyles?.mask), 'classNames.mask and styles.mask', 'classNames.root and styles.root');
}
// ======================= Indicator ========================
const mergedIndicator = indicator ?? contextIndicator ?? defaultIndicator;
// ========================= Render =========================
const hasChildren = typeof children !== 'undefined';
const isNested = hasChildren || fullscreen;
const indicatorNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Indicator, {
className: (0,clsx.clsx)(mergedClassNames.indicator),
style: mergedStyles.indicator,
prefixCls: prefixCls,
indicator: mergedIndicator,
percent: mergedPercent
}), mergedDescription && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-description`, mergedClassNames.tip, mergedClassNames.description),
style: {
...mergedStyles.tip,
...mergedStyles.description
}
}, mergedDescription)));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(prefixCls, {
[`${prefixCls}-sm`]: mergedSize === 'small',
[`${prefixCls}-lg`]: mergedSize === 'large',
[`${prefixCls}-spinning`]: spinning,
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-fullscreen`]: fullscreen
}, rootClassName, mergedClassNames.root, fullscreen && mergedClassNames.mask, isNested ? wrapperClassName : [`${prefixCls}-section`, mergedClassNames.section], contextClassName, className, hashId, cssVarCls),
style: {
...mergedStyles.root,
...(!isNested ? mergedStyles.section : {}),
...(fullscreen ? mergedStyles.mask : {}),
...contextStyle,
...style
},
"aria-live": "polite",
"aria-busy": spinning,
...restProps
}, spinning && (isNested ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-section`, mergedClassNames.section),
style: mergedStyles.section
}, indicatorNode)) : indicatorNode), hasChildren && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-container`, mergedClassNames.container),
style: mergedStyles.container
}, children)));
};
Spin.setDefaultIndicator = indicator => {
defaultIndicator = indicator;
};
if (true) {
Spin.displayName = 'Spin';
}
/* harmony default export */ var spin = (Spin);
;// ./components/list/context.ts
const context_ListContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createContext({});
const ListConsumer = context_ListContext.Consumer;
;// ./components/list/Item.tsx
const Meta = ({
prefixCls: customizePrefixCls,
className,
avatar,
title,
description,
...others
}) => {
const {
getPrefixCls
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('list', customizePrefixCls);
const classString = (0,clsx.clsx)(`${prefixCls}-item-meta`, className);
const content = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${prefixCls}-item-meta-content`
}, title && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("h4", {
className: `${prefixCls}-item-meta-title`
}, title), description && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${prefixCls}-item-meta-description`
}, description));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
...others,
className: classString
}, avatar && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${prefixCls}-item-meta-avatar`
}, avatar), (title || description) && content);
};
const Item_InternalItem = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
children,
actions,
extra,
styles,
className,
classNames: customizeClassNames,
colStyle,
...others
} = props;
const {
grid,
itemLayout
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(context_ListContext);
const {
getPrefixCls,
list
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(config_provider_context.ConfigContext);
const moduleClass = moduleName => (0,clsx.clsx)(list?.item?.classNames?.[moduleName], customizeClassNames?.[moduleName]);
const moduleStyle = moduleName => ({
...list?.item?.styles?.[moduleName],
...styles?.[moduleName]
});
const isItemContainsTextNodeAndNotSingular = () => {
const childNodes = (0,es.toArray)(children);
const hasTextNode = childNodes.some(node => typeof node === 'string');
return hasTextNode && childNodes.length > 1;
};
const isFlexMode = () => {
if (itemLayout === 'vertical') {
return !!extra;
}
return !isItemContainsTextNodeAndNotSingular();
};
const prefixCls = getPrefixCls('list', customizePrefixCls);
const actionsContent = actions && actions.length > 0 && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("ul", {
className: (0,clsx.clsx)(`${prefixCls}-item-action`, moduleClass('actions')),
key: "actions",
style: moduleStyle('actions')
}, actions.map((action, i) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
key: `${prefixCls}-item-action-${i}`
}, action, i !== actions.length - 1 && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("em", {
className: `${prefixCls}-item-action-split`
}))))));
const Element = grid ? 'div' : 'li';
const itemChildren = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Element, {
...others,
...(!grid ? {
ref
} : {}),
className: (0,clsx.clsx)(`${prefixCls}-item`, {
[`${prefixCls}-item-no-flex`]: !isFlexMode()
}, className)
}, itemLayout === 'vertical' && extra ? [/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${prefixCls}-item-main`,
key: "content"
}, children, actionsContent), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-item-extra`, moduleClass('extra')),
key: "extra",
style: moduleStyle('extra')
}, extra)] : [children, actionsContent, (0,reactNode.cloneElement)(extra, {
key: 'extra'
})]);
return grid ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(col, {
ref: ref,
flex: 1,
style: colStyle
}, itemChildren)) : itemChildren;
});
const list_Item_Item = Item_InternalItem;
list_Item_Item.Meta = Meta;
/* harmony default export */ var list_Item = (list_Item_Item);
// EXTERNAL MODULE: ./components/list/style/index.ts
var list_style = __webpack_require__("./components/list/style/index.ts");
;// ./components/list/index.tsx
const InternalList = (props, ref) => {
const {
pagination = false,
prefixCls: customizePrefixCls,
bordered = false,
split = true,
className,
rootClassName,
style,
children,
itemLayout,
loadMore,
grid,
dataSource = [],
size: customizeSize,
header,
footer,
loading = false,
rowKey,
renderItem,
locale,
...rest
} = props;
const paginationObj = (0,is.isPlainObject)(pagination) ? pagination : {};
const [paginationCurrent, setPaginationCurrent] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(paginationObj.defaultCurrent || 1);
const [paginationSize, setPaginationSize] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(paginationObj.defaultPageSize || 10);
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle
} = (0,config_provider_context.useComponentConfig)('list');
const {
renderEmpty
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const defaultPaginationProps = {
current: 1,
total: 0,
position: 'bottom'
};
const triggerPaginationEvent = eventName => (page, pageSize) => {
setPaginationCurrent(page);
setPaginationSize(pageSize);
if (pagination) {
pagination?.[eventName]?.(page, pageSize);
}
};
const onPaginationChange = triggerPaginationEvent('onChange');
const onPaginationShowSizeChange = triggerPaginationEvent('onShowSizeChange');
const renderInternalItem = (item, index) => {
if (!renderItem) {
return null;
}
let key;
if (typeof rowKey === 'function') {
key = rowKey(item);
} else if (rowKey) {
key = item[rowKey];
} else {
key = item.key;
}
if (!key) {
key = `list-item-${index}`;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, {
key: key
}, renderItem(item, index));
};
const isSomethingAfterLastItem = !!(loadMore || pagination || footer);
const prefixCls = getPrefixCls('list', customizePrefixCls);
// Style
const [hashId, cssVarCls] = (0,list_style["default"])(prefixCls);
let loadingProp = loading;
if (typeof loadingProp === 'boolean') {
loadingProp = {
spinning: loadingProp
};
}
const isLoading = !!loadingProp?.spinning;
const mergedSize = (0,useSize["default"])(customizeSize);
// large => lg
// small => sm
let sizeCls = '';
switch (mergedSize) {
case 'large':
sizeCls = 'lg';
break;
case 'small':
sizeCls = 'sm';
break;
default:
break;
}
const classString = (0,clsx.clsx)(prefixCls, {
[`${prefixCls}-vertical`]: itemLayout === 'vertical',
[`${prefixCls}-${sizeCls}`]: sizeCls,
[`${prefixCls}-split`]: split,
[`${prefixCls}-bordered`]: bordered,
[`${prefixCls}-loading`]: isLoading,
[`${prefixCls}-grid`]: !!grid,
[`${prefixCls}-something-after-last-item`]: isSomethingAfterLastItem,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, contextClassName, className, rootClassName, hashId, cssVarCls);
const containerCls = `${prefixCls}-container`;
const paginationProps = extendsObject(defaultPaginationProps, {
total: dataSource.length,
current: paginationCurrent,
pageSize: paginationSize
}, pagination || {});
const largestPage = Math.ceil(paginationProps.total / paginationProps.pageSize);
paginationProps.current = Math.min(paginationProps.current, largestPage);
const paginationContent = pagination && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-pagination`)
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_pagination, {
align: "end",
...paginationProps,
onChange: onPaginationChange,
onShowSizeChange: onPaginationShowSizeChange
})));
let splitDataSource = (0,toConsumableArray["default"])(dataSource);
if (pagination) {
if (dataSource.length > (paginationProps.current - 1) * paginationProps.pageSize) {
splitDataSource = (0,toConsumableArray["default"])(dataSource).splice((paginationProps.current - 1) * paginationProps.pageSize, paginationProps.pageSize);
}
}
const needResponsive = Object.keys(grid || {}).some(key => responsiveArray.includes(key));
const screens = hooks_useBreakpoint(needResponsive);
const currentBreakpoint = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
for (let i = 0; i < responsiveArray.length; i += 1) {
const breakpoint = responsiveArray[i];
if (screens[breakpoint]) {
return breakpoint;
}
}
return undefined;
}, [screens]);
const colStyle = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!grid) {
return undefined;
}
const columnCount = currentBreakpoint && grid[currentBreakpoint] ? grid[currentBreakpoint] : grid.column;
if (columnCount) {
return {
width: `${100 / columnCount}%`,
maxWidth: `${100 / columnCount}%`
};
}
}, [JSON.stringify(grid), currentBreakpoint]);
let childrenContent = isLoading && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
style: {
minHeight: 53
}
});
if (splitDataSource.length > 0) {
const items = splitDataSource.map(renderInternalItem);
childrenContent = grid ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(row, {
className: (0,clsx.clsx)(containerCls, cssVarCls),
gutter: grid.gutter
}, external_root_React_commonjs2_react_commonjs_react_amd_react_.Children.map(items, child => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
key: child?.key,
style: colStyle
}, child))))) : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("ul", {
className: (0,clsx.clsx)(`${prefixCls}-items`, containerCls, cssVarCls)
}, items));
} else if (!children && !isLoading) {
childrenContent = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-empty-text`
}, locale?.emptyText || renderEmpty?.('List') || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(defaultRenderEmpty, {
componentName: "List"
}));
}
const paginationPosition = paginationProps.position;
const contextValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
grid,
itemLayout
}), [JSON.stringify(grid), itemLayout]);
if (true) {
const warning = (0,_util_warning.devUseWarning)('List');
true ? warning(false, 'deprecated', 'The `List` component is deprecated. And will be removed in next major version.') : 0;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(context_ListContext.Provider, {
value: contextValue
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: ref,
style: {
...contextStyle,
...style
},
className: classString,
...rest
}, (paginationPosition === 'top' || paginationPosition === 'both') && paginationContent, header && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-header`
}, header), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(spin, {
...loadingProp
}, childrenContent, children), footer && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-footer`
}, footer), loadMore || (paginationPosition === 'bottom' || paginationPosition === 'both') && paginationContent));
};
const ListWithForwardRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(InternalList);
if (true) {
ListWithForwardRef.displayName = 'Deprecated.List';
}
const list_List = ListWithForwardRef;
list_List.Item = list_Item;
/* harmony default export */ var list = (list_List);
;// ./components/masonry/hooks/useDelay.ts
function useDelay_useDelay(callback) {
const idRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(0);
const clearRaf = () => {
raf["default"].cancel(idRef.current);
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => clearRaf, []);
const triggerFn = (0,es.useEvent)(() => {
clearRaf();
idRef.current = (0,raf["default"])(callback);
});
return triggerFn;
}
;// ./components/masonry/hooks/usePositions.ts
// Disabled the rule since `fill` is safe here
// but `Array.from` will increase bundle size.
/* eslint-disable unicorn/no-new-array */
/**
* Auto arrange the items in the masonry layout.
* Always get stable positions by order
* instead of dynamic adjust for next item height.
*/
function usePositions(itemHeights, columnCount, verticalGutter) {
// ==================== Auto Order ====================
const [orderItemPositions, orderTotalHeight] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const columnHeights = new Array(columnCount).fill(0);
const itemPositions = new Map();
for (let i = 0; i < itemHeights.length; i += 1) {
const [itemKey, itemHeight, itemColumn] = itemHeights[i];
let targetColumnIndex = itemColumn ?? columnHeights.indexOf(Math.min.apply(Math, (0,toConsumableArray["default"])(columnHeights)));
targetColumnIndex = Math.min(targetColumnIndex, columnCount - 1);
const top = columnHeights[targetColumnIndex];
itemPositions.set(itemKey, {
column: targetColumnIndex,
top
});
columnHeights[targetColumnIndex] += itemHeight + verticalGutter;
}
return [itemPositions, Math.max(0, Math.max.apply(Math, (0,toConsumableArray["default"])(columnHeights)) - verticalGutter)];
}, [columnCount, itemHeights, verticalGutter]);
// ====================== Return ======================
return [orderItemPositions, orderTotalHeight];
}
;// ./components/masonry/hooks/useRefs.ts
function useRefs() {
const ref = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
if (ref.current === null) {
ref.current = new Map();
}
const setRef = (key, element) => {
ref.current.set(key, element);
};
const getRef = key => ref.current.get(key);
return [setRef, getRef];
}
;// ./components/masonry/MasonryItem.tsx
const MasonryItem = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
item,
style,
prefixCls,
itemRender,
className,
index,
column,
onResize
} = props;
const itemPrefix = `${prefixCls}-item`;
// ====================== Render ======================
const renderNode = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
return item.children ?? itemRender?.({
...item,
index,
column
});
}, [item, itemRender, column, index]);
let returnNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
ref: ref,
style: style,
className: (0,clsx.clsx)(itemPrefix, className)
}, renderNode);
// Listen for resize
if (onResize) {
returnNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(resize_observer_es, {
onResize: onResize
}, returnNode);
}
return returnNode;
});
if (true) {
MasonryItem.displayName = 'MasonryItem';
}
/* harmony default export */ var masonry_MasonryItem = (MasonryItem);
// EXTERNAL MODULE: ./components/masonry/style/index.ts
var masonry_style = __webpack_require__("./components/masonry/style/index.ts");
;// ./components/masonry/Masonry.tsx
const Masonry = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
rootClassName,
className,
style,
classNames,
styles,
columns,
prefixCls: customizePrefixCls,
gutter = 0,
items,
itemRender,
onLayoutChange,
fresh
} = props;
// ======================= MISC =======================
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('masonry');
const prefixCls = getPrefixCls('masonry', customizePrefixCls);
const rootPrefixCls = getPrefixCls();
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,masonry_style["default"])(prefixCls, rootCls);
const [varName, varRef] = (0,genStyleUtils.genCssVar)(rootPrefixCls, 'masonry');
// ======================= Refs =======================
const containerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
nativeElement: containerRef.current
}));
const [setItemRef, getItemRef] = useRefs();
// ======================= Item =======================
const [mergedItems, setMergedItems] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
setMergedItems(items || []);
}, [items]);
// ==================== Breakpoint ====================
const screens = hooks_useBreakpoint();
const gutters = useGutter(gutter, screens);
const [horizontalGutter = 0, verticalGutter = horizontalGutter] = gutters;
// ====================== Layout ======================
const columnCount = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!columns) {
return 3;
}
if ((0,is.isNumber)(columns)) {
return columns;
}
// Find first matching responsive breakpoint
const matchingBreakpoint = responsiveArray.find(breakpoint => screens[breakpoint] && columns[breakpoint] !== undefined);
if (matchingBreakpoint) {
return columns[matchingBreakpoint];
}
return columns.xs ?? 1;
}, [columns, screens]);
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
columns: columnCount
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
// ================== Items Position ==================
const [itemHeights, setItemHeights] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([]);
const collectItemSize = useDelay_useDelay(() => {
const nextItemsHeight = mergedItems.map((item, index) => {
const itemKey = item.key ?? index;
const itemEle = getItemRef(itemKey);
const rect = itemEle?.getBoundingClientRect();
return [itemKey, rect ? rect.height : 0, item.column];
});
setItemHeights(prevItemsHeight => (0,isEqual["default"])(prevItemsHeight, nextItemsHeight) ? prevItemsHeight : nextItemsHeight);
});
const [itemPositions, totalHeight] = usePositions(itemHeights, columnCount, verticalGutter);
const itemWithPositions = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => mergedItems.map((item, index) => {
const key = item.key ?? index;
return {
item,
itemIndex: index,
// CSSMotion will transform key to string.
// Let's keep the original key here.
itemKey: key,
key,
position: itemPositions.get(key)
};
}), [mergedItems, itemPositions]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
collectItemSize();
}, [mergedItems, columnCount]);
// Trigger for `onLayoutChange`
const [itemColumns, setItemColumns] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([]);
(0,useLayoutEffect["default"])(() => {
if (onLayoutChange && itemWithPositions.every(({
position
}) => position)) {
setItemColumns(prevItemColumns => {
const nextItemColumns = itemWithPositions.map(({
item,
position
}) => [item, position.column]);
return (0,isEqual["default"])(prevItemColumns, nextItemColumns) ? prevItemColumns : nextItemColumns;
});
}
}, [itemWithPositions]);
(0,useLayoutEffect["default"])(() => {
if (onLayoutChange && items && items.length === itemColumns.length) {
onLayoutChange(itemColumns.map(([item, column]) => ({
...item,
column
})));
}
}, [itemColumns]);
// ====================== Render ======================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(resize_observer_es, {
onResize: collectItemSize
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: containerRef,
className: (0,clsx.clsx)(prefixCls, contextClassName, mergedClassNames.root, rootClassName, className, hashId, cssVarCls, {
[`${prefixCls}-rtl`]: direction === 'rtl'
}),
style: {
height: totalHeight,
...mergedStyles.root,
...contextStyle,
...style
},
// Listen for image events
onLoad: collectItemSize,
onError: collectItemSize
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es.CSSMotionList, {
keys: itemWithPositions,
component: false,
// Motion config
motionAppear: true,
motionLeave: true,
motionName: `${prefixCls}-item-fade`
}, (motionInfo, motionRef) => {
const {
item,
itemKey,
position = {},
itemIndex,
key,
className: motionClassName,
style: motionStyle
} = motionInfo;
const {
column: columnIndex = 0
} = position;
const itemStyle = {
[varName('item-width')]: `calc((100% + ${horizontalGutter}px) / ${columnCount})`,
insetInlineStart: `calc(${varRef('item-width')} * ${columnIndex})`,
width: `calc(${varRef('item-width')} - ${horizontalGutter}px)`,
top: position.top,
position: 'absolute'
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(masonry_MasonryItem, {
prefixCls: prefixCls,
key: key,
item: item,
style: {
...motionStyle,
...mergedStyles.item,
...itemStyle
},
className: (0,clsx.clsx)(mergedClassNames.item, motionClassName),
ref: (0,es_ref.composeRef)(motionRef, ele => setItemRef(itemKey, ele)),
index: itemIndex,
itemRender: itemRender,
column: columnIndex,
onResize: fresh ? collectItemSize : null
});
})));
});
if (true) {
Masonry.displayName = 'Masonry';
}
/* harmony default export */ var masonry_Masonry = (Masonry);
;// ./components/masonry/index.tsx
/* harmony default export */ var masonry = (masonry_Masonry);
;// ./node_modules/@rc-component/mentions/es/hooks/useEffectState.js
/**
* Trigger a callback on state change
*/
function useEffectState_useEffectState() {
const [effectId, setEffectId] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
id: 0,
callback: null
});
const update = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(callback => {
setEffectId(({
id
}) => ({
id: id + 1,
callback
}));
}, []);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
effectId.callback?.();
}, [effectId]);
return update;
}
;// ./node_modules/@rc-component/mentions/es/MentionsContext.js
/* tslint:disable: no-object-literal-type-assertion */
// We will never use default, here only to fix TypeScript warning
const MentionsContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
/* harmony default export */ var es_MentionsContext = (MentionsContext);
;// ./node_modules/@rc-component/mentions/es/DropdownMenu.js
/**
* We only use Menu to display the candidate.
* The focus is controlled by textarea to make accessibility easy.
*/
function DropdownMenu(props) {
const {
notFoundContent,
activeIndex,
setActiveIndex,
selectOption,
onFocus,
onBlur,
onScroll
} = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(es_MentionsContext);
const {
prefixCls,
options,
opened
} = props;
const activeOption = options[activeIndex] || {};
const menuRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
// Monitor the changes in ActiveIndex and scroll to the visible area if there are any changes
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (activeIndex === -1 || !menuRef.current || !opened) {
return;
}
const activeItem = menuRef.current?.findItem?.({
key: activeOption.key
});
if (activeItem) {
activeItem.scrollIntoView({
block: 'nearest',
inline: 'nearest'
});
}
}, [activeIndex, activeOption.key, opened]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(menu_es, {
ref: menuRef,
prefixCls: `${prefixCls}-menu`,
activeKey: activeOption.key,
onSelect: ({
key
}) => {
const option = options.find(({
key: optionKey
}) => optionKey === key);
selectOption(option);
},
onFocus: onFocus,
onBlur: onBlur,
onScroll: onScroll
}, options.map((option, index) => {
const {
key,
disabled,
className,
style,
label
} = option;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_MenuItem, {
key: key,
disabled: disabled,
className: className,
style: style,
onMouseEnter: () => {
setActiveIndex(index);
}
}, label);
}), !options.length && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_MenuItem, {
disabled: true
}, notFoundContent));
}
/* harmony default export */ var es_DropdownMenu = (DropdownMenu);
;// ./node_modules/@rc-component/mentions/es/KeywordTrigger.js
const KeywordTrigger_BUILT_IN_PLACEMENTS = {
bottomRight: {
points: ['tl', 'br'],
offset: [0, 4],
overflow: {
adjustX: 1,
adjustY: 1
}
},
bottomLeft: {
points: ['tr', 'bl'],
offset: [0, 4],
overflow: {
adjustX: 1,
adjustY: 1
}
},
topRight: {
points: ['bl', 'tr'],
offset: [0, -4],
overflow: {
adjustX: 1,
adjustY: 1
}
},
topLeft: {
points: ['br', 'tl'],
offset: [0, -4],
overflow: {
adjustX: 1,
adjustY: 1
}
}
};
const KeywordTrigger = props => {
const {
prefixCls,
options,
children,
visible,
transitionName,
getPopupContainer,
popupClassName,
popupStyle,
direction,
placement
} = props;
const dropdownPrefix = `${prefixCls}-dropdown`;
const [opened, setOpened] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const dropdownElement = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_DropdownMenu, {
prefixCls: dropdownPrefix,
options: options,
opened: opened
});
const dropdownPlacement = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
let popupPlacement;
if (direction === 'rtl') {
popupPlacement = placement === 'top' ? 'topLeft' : 'bottomLeft';
} else {
popupPlacement = placement === 'top' ? 'topRight' : 'bottomRight';
}
return popupPlacement;
}, [direction, placement]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(trigger_es, {
prefixCls: dropdownPrefix,
popupVisible: visible,
popup: dropdownElement,
popupPlacement: dropdownPlacement,
popupMotion: {
motionName: transitionName
},
builtinPlacements: KeywordTrigger_BUILT_IN_PLACEMENTS,
getPopupContainer: getPopupContainer,
popupClassName: popupClassName,
popupStyle: popupStyle,
afterOpenChange: setOpened
}, children);
};
/* harmony default export */ var es_KeywordTrigger = (KeywordTrigger);
;// ./node_modules/@rc-component/mentions/es/Option.js
const Option_Option = () => null;
/* harmony default export */ var mentions_es_Option = (Option_Option);
;// ./node_modules/@rc-component/mentions/es/util.js
/**
* Cut input selection into 2 part and return text before selection start
*/
function getBeforeSelectionText(input) {
const {
selectionStart
} = input;
return input.value.slice(0, selectionStart);
}
/**
* Find the last match prefix index
*/
function getLastMeasureIndex(text, prefix) {
return prefix.reduce((lastMatch, prefixStr) => {
const lastIndex = text.lastIndexOf(prefixStr);
if (lastIndex > lastMatch.location) {
return {
location: lastIndex,
prefix: prefixStr
};
}
return lastMatch;
}, {
location: -1,
prefix: ''
});
}
function lower(char) {
return (char || '').toLowerCase();
}
function reduceText(text, targetText, split) {
const firstChar = text[0];
if (!firstChar || firstChar === split) {
return text;
}
// Reuse rest text as it can
let restText = text;
const targetTextLen = targetText.length;
for (let i = 0; i < targetTextLen; i += 1) {
if (lower(restText[i]) !== lower(targetText[i])) {
restText = restText.slice(i);
break;
} else if (i === targetTextLen - 1) {
restText = restText.slice(targetTextLen);
}
}
return restText;
}
/**
* Paint targetText into current text:
* text: little@litest
* targetText: light
* => little @light test
*/
function replaceWithMeasure(text, measureConfig) {
const {
measureLocation,
prefix,
targetText,
selectionStart,
split
} = measureConfig;
// Before text will append one space if have other text
let beforeMeasureText = text.slice(0, measureLocation);
if (beforeMeasureText[beforeMeasureText.length - split.length] === split) {
beforeMeasureText = beforeMeasureText.slice(0, beforeMeasureText.length - split.length);
}
if (beforeMeasureText) {
beforeMeasureText = `${beforeMeasureText}${split}`;
}
// Cut duplicate string with current targetText
let restText = reduceText(text.slice(selectionStart), targetText.slice(selectionStart - measureLocation - prefix.length), split);
if (restText.slice(0, split.length) === split) {
restText = restText.slice(split.length);
}
const connectedStartText = `${beforeMeasureText}${prefix}${targetText}${split}`;
return {
text: `${connectedStartText}${restText}`,
selectionLocation: connectedStartText.length
};
}
function setInputSelection(input, location) {
input.setSelectionRange(location, location);
/**
* Reset caret into view.
* Since this function always called by user control, it's safe to focus element.
*/
input.blur();
input.focus();
}
function util_validateSearch(text, split) {
return !split || text.indexOf(split) === -1;
}
function util_filterOption(input, {
value = ''
}) {
const lowerCase = input.toLowerCase();
return value.toLowerCase().indexOf(lowerCase) !== -1;
}
;// ./node_modules/@rc-component/mentions/es/context.js
const context_UnstableContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({});
;// ./node_modules/@rc-component/mentions/es/Mentions.js
function Mentions_extends() { Mentions_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Mentions_extends.apply(this, arguments); }
const InternalMentions = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((props, ref) => {
const {
// Style
prefixCls,
className,
style,
classNames: mentionClassNames,
styles,
// Misc
prefix = '@',
split = ' ',
notFoundContent = 'Not Found',
value,
defaultValue,
children,
options,
allowClear,
hasWrapper,
silent,
// Events
validateSearch = util_validateSearch,
filterOption = util_filterOption,
onChange,
onKeyDown,
onKeyUp,
onPressEnter,
onSearch,
onSelect,
onFocus,
onBlur,
// Dropdown
transitionName,
placement,
direction,
getPopupContainer,
popupClassName,
rows = 1,
// Fix Warning: Received `false` for a non-boolean attribute `visible`.
// https://github.com/ant-design/ant-design/blob/df933e94efc8f376003bbdc658d64b64a0e53495/components/mentions/demo/render-panel.tsx
// @ts-expect-error
visible,
onPopupScroll,
// Rest
...restProps
} = props;
const mergedPrefix = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => Array.isArray(prefix) ? prefix : [prefix], [prefix]);
// =============================== Refs ===============================
const containerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const textareaRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const measureRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const getTextArea = () => textareaRef.current?.resizableTextArea?.textArea;
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useImperativeHandle(ref, () => ({
focus: () => textareaRef.current?.focus(),
blur: () => textareaRef.current?.blur(),
textarea: textareaRef.current?.resizableTextArea?.textArea,
nativeElement: containerRef.current
}));
// ============================== State ===============================
const [measuring, setMeasuring] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
const [measureText, setMeasureText] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)('');
const [measurePrefix, setMeasurePrefix] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)('');
const [measureLocation, setMeasureLocation] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0);
const [activeIndex, setActiveIndex] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0);
const [isFocus, setIsFocus] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
// ================================ Id ================================
const uniqueKey = useId(props.id);
// ============================== Value ===============================
const [mergedValue, setMergedValue] = (0,useControlledState["default"])(defaultValue || '', value);
// =============================== Open ===============================
const {
open
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(context_UnstableContext);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
// Sync measure div top with textarea for rc-trigger usage
if (measuring && measureRef.current) {
measureRef.current.scrollTop = getTextArea().scrollTop;
}
}, [measuring]);
const [mergedMeasuring, mergedMeasureText, mergedMeasurePrefix, mergedMeasureLocation] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
if (open) {
for (let i = 0; i < mergedPrefix.length; i += 1) {
const curPrefix = mergedPrefix[i];
const index = mergedValue.lastIndexOf(curPrefix);
if (index >= 0) {
return [true, '', curPrefix, index];
}
}
}
return [measuring, measureText, measurePrefix, measureLocation];
}, [open, measuring, mergedPrefix, mergedValue, measureText, measurePrefix, measureLocation]);
// ============================== Option ==============================
const getOptions = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useCallback(targetMeasureText => {
let list;
if (options && options.length > 0) {
list = options.map(item => ({
...item,
key: `${item?.key ?? item.value}-${uniqueKey}`
}));
} else {
list = (0,toArray["default"])(children).map(({
props: optionProps,
key
}) => ({
...optionProps,
label: optionProps.children,
key: `${key || optionProps.value}-${uniqueKey}`
}));
}
return list.filter(option => {
/** Return all result if `filterOption` is false. */
if (filterOption === false) {
return true;
}
return filterOption(targetMeasureText, option);
});
}, [options, uniqueKey, children, filterOption]);
const mergedOptions = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => getOptions(mergedMeasureText), [getOptions, mergedMeasureText]);
// ============================= Measure ==============================
// Mark that we will reset input selection to target position when user select option
const onSelectionEffect = useEffectState_useEffectState();
const startMeasure = (nextMeasureText, nextMeasurePrefix, nextMeasureLocation) => {
setMeasuring(true);
setMeasureText(nextMeasureText);
setMeasurePrefix(nextMeasurePrefix);
setMeasureLocation(nextMeasureLocation);
setActiveIndex(0);
};
const stopMeasure = callback => {
setMeasuring(false);
setMeasureLocation(0);
setMeasureText('');
onSelectionEffect(callback);
};
// ============================== Change ==============================
const triggerChange = nextValue => {
setMergedValue(nextValue);
onChange?.(nextValue);
};
const onInternalChange = ({
target: {
value: nextValue
}
}) => {
triggerChange(nextValue);
};
const selectOption = option => {
const {
value: mentionValue = ''
} = option;
const {
text,
selectionLocation
} = replaceWithMeasure(mergedValue, {
measureLocation: mergedMeasureLocation,
targetText: mentionValue,
prefix: mergedMeasurePrefix,
selectionStart: getTextArea()?.selectionStart,
split
});
triggerChange(text);
stopMeasure(() => {
// We need restore the selection position
setInputSelection(getTextArea(), selectionLocation);
});
onSelect?.(option, mergedMeasurePrefix);
};
// ============================= KeyEvent =============================
// Check if hit the measure keyword
const onInternalKeyDown = event => {
const {
which
} = event;
onKeyDown?.(event);
// Skip if not measuring
if (!mergedMeasuring) {
return;
}
if (which === KeyCode["default"].UP || which === KeyCode["default"].DOWN) {
// Control arrow function
const optionLen = mergedOptions.length;
const offset = which === KeyCode["default"].UP ? -1 : 1;
const newActiveIndex = (activeIndex + offset + optionLen) % optionLen;
setActiveIndex(newActiveIndex);
event.preventDefault();
} else if (which === KeyCode["default"].ESC) {
stopMeasure();
} else if (which === KeyCode["default"].ENTER) {
// Measure hit
event.preventDefault();
// loading skip
if (silent) {
return;
}
if (!mergedOptions.length) {
stopMeasure();
return;
}
const option = mergedOptions[activeIndex];
selectOption(option);
}
};
/**
* When to start measure:
* 1. When user press `prefix`
* 2. When measureText !== prevMeasureText
* - If measure hit
* - If measuring
*
* When to stop measure:
* 1. Selection is out of range
* 2. Contains `space`
* 3. ESC or select one
*/
const onInternalKeyUp = event => {
const {
key,
which
} = event;
const target = event.target;
const selectionStartText = getBeforeSelectionText(target);
const {
location: measureIndex,
prefix: nextMeasurePrefix
} = getLastMeasureIndex(selectionStartText, mergedPrefix);
// If the client implements an onKeyUp handler, call it
onKeyUp?.(event);
// Skip if match the white key list
if ([KeyCode["default"].ESC, KeyCode["default"].UP, KeyCode["default"].DOWN, KeyCode["default"].ENTER].indexOf(which) !== -1) {
return;
}
if (measureIndex !== -1) {
const nextMeasureText = selectionStartText.slice(measureIndex + nextMeasurePrefix.length);
const validateMeasure = validateSearch(nextMeasureText, split);
const matchOption = !!getOptions(nextMeasureText).length;
if (validateMeasure) {
// adding AltGraph also fort azert keyboard
if (key === nextMeasurePrefix || key === 'Shift' || which === KeyCode["default"].ALT || key === 'AltGraph' || mergedMeasuring || nextMeasureText !== mergedMeasureText && matchOption) {
startMeasure(nextMeasureText, nextMeasurePrefix, measureIndex);
}
} else if (mergedMeasuring) {
// Stop if measureText is invalidate
stopMeasure();
}
/**
* We will trigger `onSearch` to developer since they may use for async update.
* If met `space` means user finished searching.
*/
if (onSearch && validateMeasure) {
onSearch(nextMeasureText, nextMeasurePrefix);
}
} else if (mergedMeasuring) {
stopMeasure();
}
};
const onInternalPressEnter = event => {
if (!mergedMeasuring && onPressEnter) {
onPressEnter(event);
}
};
// ============================ Focus Blur ============================
const focusRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
const onInternalFocus = event => {
window.clearTimeout(focusRef.current);
if (!isFocus && event && onFocus) {
onFocus(event);
}
setIsFocus(true);
};
const onInternalBlur = event => {
focusRef.current = window.setTimeout(() => {
setIsFocus(false);
stopMeasure();
onBlur?.(event);
}, 0);
};
const onDropdownFocus = () => {
onInternalFocus();
};
const onDropdownBlur = () => {
onInternalBlur();
};
// ============================== Scroll ===============================
const onInternalPopupScroll = event => {
onPopupScroll?.(event);
};
// ============================== Styles ==============================
const mergedStyles = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
const resizeStyle = styles?.textarea?.resize ?? style?.resize;
const mergedTextareaStyle = {
...styles?.textarea
};
// Only add resize if it has a valid value, avoid setting undefined
if (resizeStyle !== undefined) {
mergedTextareaStyle.resize = resizeStyle;
}
return {
...styles,
textarea: mergedTextareaStyle
};
}, [style, styles]);
// ============================== Render ==============================
const mentionNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(textarea_es, Mentions_extends({
classNames: {
textarea: mentionClassNames?.textarea
}
/**
* Example:.
* If written this way, resizing here will become invalid.
* The TextArea component code and found that the resize parameter in the style of the ResizeTextArea component is obtained from prop.style.
* Just pass the resize attribute and leave everything else unchanged.
*/,
styles: mergedStyles,
ref: textareaRef,
value: mergedValue
}, restProps, {
rows: rows,
onChange: onInternalChange,
onKeyDown: onInternalKeyDown,
onKeyUp: onInternalKeyUp,
onPressEnter: onInternalPressEnter,
onFocus: onInternalFocus,
onBlur: onInternalBlur
})), mergedMeasuring && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
ref: measureRef,
className: `${prefixCls}-measure`
}, mergedValue.slice(0, mergedMeasureLocation), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_MentionsContext.Provider, {
value: {
notFoundContent,
activeIndex,
setActiveIndex,
selectOption,
onFocus: onDropdownFocus,
onBlur: onDropdownBlur,
onScroll: onInternalPopupScroll
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_KeywordTrigger, {
prefixCls: prefixCls,
transitionName: transitionName,
placement: placement,
direction: direction,
options: mergedOptions,
visible: true,
getPopupContainer: getPopupContainer,
popupClassName: (0,clsx.clsx)(popupClassName, mentionClassNames?.popup),
popupStyle: styles?.popup
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", null, mergedMeasurePrefix))), mergedValue.slice(mergedMeasureLocation + mergedMeasurePrefix.length)));
if (!hasWrapper) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(prefixCls, className),
style: style,
ref: containerRef
}, mentionNode);
}
return mentionNode;
});
const Mentions = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(({
suffix,
prefixCls = 'rc-mentions',
defaultValue,
value: customValue,
id,
allowClear,
onChange,
classNames: mentionsClassNames,
styles,
className,
disabled,
onClear,
...rest
}, ref) => {
const hasSuffix = !!(suffix || allowClear);
// =============================== Ref ================================
const holderRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const mentionRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref, () => ({
...mentionRef.current,
nativeElement: holderRef.current?.nativeElement || mentionRef.current?.nativeElement
}));
// ============================== Value ===============================
const [mergedValue, setMergedValue] = (0,useControlledState["default"])(defaultValue || '', customValue);
// ============================== Change ==============================
const triggerChange = currentValue => {
setMergedValue(currentValue);
onChange?.(currentValue);
};
// ============================== Reset ===============================
const handleReset = () => {
triggerChange('');
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_BaseInput, {
suffix: suffix,
prefixCls: prefixCls,
value: mergedValue,
allowClear: allowClear,
handleReset: handleReset,
className: (0,clsx.clsx)(prefixCls, className, {
// hasSuffix
[`${prefixCls}-has-suffix`]: hasSuffix
}),
classNames: mentionsClassNames,
disabled: disabled,
ref: holderRef,
onClear: onClear
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(InternalMentions, Mentions_extends({
className: mentionsClassNames?.mentions,
styles: styles,
classNames: mentionsClassNames,
prefixCls: prefixCls,
id: id,
ref: mentionRef,
onChange: triggerChange,
disabled: disabled,
hasWrapper: hasSuffix
}, rest)));
});
Mentions.Option = mentions_es_Option;
/* harmony default export */ var es_Mentions = (Mentions);
;// ./node_modules/@rc-component/mentions/es/index.js
/* harmony default export */ var mentions_es = (es_Mentions);
;// ./components/_util/toList.ts
const toList = (val, config = {}) => {
if (!(0,is.isNonNullable)(val) && config?.skipEmpty) {
return [];
}
return Array.isArray(val) ? val : [val];
};
/* harmony default export */ var _util_toList = (toList);
// EXTERNAL MODULE: ./components/mentions/style/index.ts
var mentions_style = __webpack_require__("./components/mentions/style/index.ts");
;// ./components/mentions/index.tsx
const {
Option: mentions_Option
} = mentions_es;
function loadingFilterOption() {
return true;
}
const mentions_InternalMentions = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
disabled: customDisabled,
loading,
filterOption,
children,
notFoundContent,
options,
status: customStatus,
allowClear = false,
popupClassName,
style,
variant: customVariant,
classNames,
styles,
size: customSize,
...restProps
} = props;
const [focused, setFocused] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const innerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const mergedRef = (0,es_ref.composeRef)(ref, innerRef);
// ===================== Size =====================
const mergedSize = (0,useSize["default"])(ctx => customSize ?? ctx);
// =================== Warning =====================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Mentions');
warning.deprecated(!children, 'Mentions.Option', 'options');
}
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('mentions');
const {
renderEmpty
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const {
status: contextStatus,
hasFeedback,
feedbackIcon
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FormItemInputContext);
const mergedStatus = getMergedStatus(contextStatus, customStatus);
// ===================== Disabled =====================
const contextDisabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
const mergedDisabled = customDisabled ?? contextDisabled;
const prefixCls = getPrefixCls('mentions', customizePrefixCls);
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
disabled: mergedDisabled,
status: mergedStatus,
variant: customVariant
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const onFocus = (...args) => {
if (restProps.onFocus) {
restProps.onFocus.apply(restProps, args);
}
setFocused(true);
};
const onBlur = (...args) => {
if (restProps.onBlur) {
restProps.onBlur.apply(restProps, args);
}
setFocused(false);
};
const notFoundContentEle = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (notFoundContent !== undefined) {
return notFoundContent;
}
return renderEmpty?.('Select') || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(defaultRenderEmpty, {
componentName: "Select"
});
}, [notFoundContent, renderEmpty]);
const mentionOptions = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (loading) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(mentions_Option, {
value: "ANTD_SEARCHING",
disabled: true
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(spin, {
size: "small"
}));
}
return children;
}, [loading, children]);
const mergedOptions = loading ? [{
value: 'ANTD_SEARCHING',
disabled: true,
label: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(spin, {
size: "small"
})
}] : options;
const mentionsfilterOption = loading ? loadingFilterOption : filterOption;
const mergedAllowClear = _util_getAllowClear(allowClear);
// Style
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,mentions_style["default"])(prefixCls, rootCls);
const [variant, enableVariantCls] = useVariants('mentions', customVariant);
const suffixNode = hasFeedback && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, feedbackIcon);
const mergedClassName = (0,clsx.clsx)(contextClassName, className, rootClassName, cssVarCls, rootCls, mergedClassNames.root, {
[`${prefixCls}-sm`]: mergedSize === 'small',
[`${prefixCls}-lg`]: mergedSize === 'large'
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(mentions_es, {
silent: loading,
prefixCls: prefixCls,
notFoundContent: notFoundContentEle,
className: mergedClassName,
disabled: mergedDisabled,
allowClear: mergedAllowClear,
direction: direction,
style: {
...mergedStyles.root,
...contextStyle,
...style
},
...restProps,
filterOption: mentionsfilterOption,
onFocus: onFocus,
onBlur: onBlur,
ref: mergedRef,
options: mergedOptions,
suffix: suffixNode,
styles: {
textarea: mergedStyles.textarea,
popup: mergedStyles.popup,
suffix: mergedStyles.suffix
},
classNames: {
textarea: (0,clsx.clsx)(mergedClassNames.textarea),
popup: (0,clsx.clsx)(mergedClassNames.popup, popupClassName, rootClassName, hashId, cssVarCls, rootCls),
suffix: mergedClassNames.suffix,
mentions: (0,clsx.clsx)({
[`${prefixCls}-disabled`]: mergedDisabled,
[`${prefixCls}-focused`]: focused,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, hashId),
variant: (0,clsx.clsx)({
[`${prefixCls}-${variant}`]: enableVariantCls
}, getStatusClassNames(prefixCls, mergedStatus)),
affixWrapper: hashId
}
}, mentionOptions);
});
const mentions_Mentions = mentions_InternalMentions;
if (true) {
mentions_Mentions.displayName = 'Mentions';
}
mentions_Mentions.Option = mentions_Option;
// We don't care debug panel
/* istanbul ignore next */
const mentions_PurePanel = _util_PurePanel(mentions_Mentions, undefined, undefined, 'mentions');
mentions_Mentions._InternalPanelDoNotUseOrYouWillBeFired = mentions_PurePanel;
mentions_Mentions.getMentions = (value = '', config = {}) => {
const {
prefix = '@',
split = ' '
} = config;
const prefixList = _util_toList(prefix);
return value.split(split).map((str = '') => {
let hitPrefix = null;
prefixList.some(prefixStr => {
const startStr = str.slice(0, prefixStr.length);
if (startStr === prefixStr) {
hitPrefix = prefixStr;
return true;
}
return false;
});
if (hitPrefix !== null) {
return {
prefix: hitPrefix,
value: str.slice(hitPrefix.length)
};
}
return null;
}).filter(entity => !!entity && !!entity.value);
};
/* harmony default export */ var mentions = (mentions_Mentions);
;// ./components/message/index.tsx
let message = null;
let act = callback => callback();
let taskQueue = [];
let defaultGlobalConfig = {};
function getGlobalContext() {
const {
getContainer,
duration,
rtl,
maxCount,
top
} = defaultGlobalConfig;
const mergedContainer = getContainer?.() || document.body;
return {
getContainer: () => mergedContainer,
duration,
rtl,
maxCount,
top
};
}
const GlobalHolder = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
messageConfig,
sync
} = props;
const {
getPrefixCls
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(config_provider_context.ConfigContext);
const prefixCls = defaultGlobalConfig.prefixCls || getPrefixCls('message');
const appConfig = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(AppConfigContext);
const [api, holder] = useInternalMessage({
...messageConfig,
prefixCls,
...appConfig.message
});
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useImperativeHandle(ref, () => {
const instance = {
...api
};
Object.keys(instance).forEach(method => {
instance[method] = (...args) => {
sync();
return api[method].apply(api, args);
};
});
return {
instance,
sync
};
});
return holder;
});
const GlobalHolderWrapper = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((_, ref) => {
const [messageConfig, setMessageConfig] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(getGlobalContext);
const sync = () => {
setMessageConfig(getGlobalContext);
};
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(sync, []);
const global = globalConfig();
const rootPrefixCls = global.getRootPrefixCls();
const rootIconPrefixCls = global.getIconPrefixCls();
const theme = global.getTheme();
const dom = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(GlobalHolder, {
ref: ref,
sync: sync,
messageConfig: messageConfig
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(config_provider, {
prefixCls: rootPrefixCls,
iconPrefixCls: rootIconPrefixCls,
theme: theme
}, global.holderRender ? global.holderRender(dom) : dom);
});
const flushMessageQueue = () => {
if (!message) {
const holderFragment = document.createDocumentFragment();
const newMessage = {
fragment: holderFragment
};
message = newMessage;
// Delay render to avoid sync issue
act(() => {
render(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(GlobalHolderWrapper, {
ref: node => {
const {
instance,
sync
} = node || {};
// React 18 test env will throw if call immediately in ref
Promise.resolve().then(() => {
if (!newMessage.instance && instance) {
newMessage.instance = instance;
newMessage.sync = sync;
flushMessageQueue();
}
});
}
}), holderFragment);
});
return;
}
// Notification not ready
if (!message.instance) {
return;
}
// >>> Execute task
taskQueue.forEach(task => {
const {
type,
skipped
} = task;
// Only `skipped` when user call notice but cancel it immediately
// and instance not ready
if (!skipped) {
switch (type) {
case 'open':
{
act(() => {
const closeFn = message.instance.open({
...defaultGlobalConfig,
...task.config
});
closeFn?.then(task.resolve);
task.setCloseFn(closeFn);
});
break;
}
case 'destroy':
act(() => {
message?.instance.destroy(task.key);
});
break;
// Other type open
default:
{
act(() => {
var _message$instance;
const closeFn = (_message$instance = message.instance)[type].apply(_message$instance, (0,toConsumableArray["default"])(task.args));
closeFn?.then(task.resolve);
task.setCloseFn(closeFn);
});
}
}
}
});
// Clean up
taskQueue = [];
};
// ==============================================================================
// == Export ==
// ==============================================================================
function setMessageGlobalConfig(config) {
defaultGlobalConfig = {
...defaultGlobalConfig,
...config
};
// Trigger sync for it
act(() => {
message?.sync?.();
});
}
function message_open(config) {
const result = wrapPromiseFn(resolve => {
let closeFn;
const task = {
type: 'open',
config,
resolve,
setCloseFn: fn => {
closeFn = fn;
}
};
taskQueue.push(task);
return () => {
if (closeFn) {
act(() => {
closeFn();
});
} else {
task.skipped = true;
}
};
});
flushMessageQueue();
return result;
}
function typeOpen(type, args) {
const global = globalConfig();
if ( true && !global.holderRender) {
warnContext('message');
}
const result = wrapPromiseFn(resolve => {
let closeFn;
const task = {
type,
args,
resolve,
setCloseFn: fn => {
closeFn = fn;
}
};
taskQueue.push(task);
return () => {
if (closeFn) {
act(() => {
closeFn();
});
} else {
task.skipped = true;
}
};
});
flushMessageQueue();
return result;
}
const destroy = key => {
taskQueue.push({
type: 'destroy',
key
});
flushMessageQueue();
};
const methods = ['success', 'info', 'warning', 'error', 'loading'];
const baseStaticMethods = {
open: message_open,
destroy,
config: setMessageGlobalConfig,
useMessage: useMessage,
_InternalPanelDoNotUseOrYouWillBeFired: message_PurePanel
};
const staticMethods = baseStaticMethods;
methods.forEach(type => {
staticMethods[type] = (...args) => typeOpen(type, args);
});
// ==============================================================================
// == Test ==
// ==============================================================================
const message_noop = () => {};
let _actWrapper = message_noop;
if (false) // removed by dead control flow
{}
const actWrapper = _actWrapper;
let _actDestroy = message_noop;
if (false) // removed by dead control flow
{}
const actDestroy = _actDestroy;
/* harmony default export */ var components_message = (staticMethods);
;// ./components/modal/PurePanel.tsx
const modal_PurePanel_PurePanel = props => {
const {
prefixCls: customizePrefixCls,
className,
closeIcon,
closable,
type,
title,
children,
footer,
classNames,
styles,
...restProps
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const {
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('modal');
const rootPrefixCls = getPrefixCls();
const prefixCls = customizePrefixCls || getPrefixCls('modal');
const rootCls = hooks_useCSSVarCls(rootPrefixCls);
const [hashId, cssVarCls] = (0,modal_style["default"])(prefixCls, rootCls);
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props
});
const confirmPrefixCls = `${prefixCls}-confirm`;
// Choose target props by confirm mark
let additionalProps = {};
if (type) {
additionalProps = {
closable: closable ?? false,
title: '',
footer: '',
children: (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(ConfirmContent, {
...props,
prefixCls: prefixCls,
confirmPrefixCls: confirmPrefixCls,
rootPrefixCls: rootPrefixCls,
content: children
}))
};
} else {
additionalProps = {
closable: closable ?? true,
title,
footer: footer !== null && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Footer, {
...props
}),
children
};
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Content_Panel, {
prefixCls: prefixCls,
className: (0,clsx.clsx)(hashId, `${prefixCls}-pure-panel`, type && confirmPrefixCls, type && `${confirmPrefixCls}-${type}`, className, contextClassName, cssVarCls, rootCls, mergedClassNames.root),
style: {
...contextStyle,
...mergedStyles.root
},
...restProps,
closeIcon: renderCloseIcon(prefixCls, closeIcon),
closable: closable,
classNames: mergedClassNames,
styles: mergedStyles,
...additionalProps
});
};
/* harmony default export */ var modal_PurePanel = (withPureRenderTheme(modal_PurePanel_PurePanel));
;// ./components/modal/index.tsx
function modalWarn(props) {
return confirm_confirm(withWarn(props));
}
const components_modal_Modal = modal_Modal;
components_modal_Modal.useModal = modal_useModal;
components_modal_Modal.info = function infoFn(props) {
return confirm_confirm(withInfo(props));
};
components_modal_Modal.success = function successFn(props) {
return confirm_confirm(withSuccess(props));
};
components_modal_Modal.error = function errorFn(props) {
return confirm_confirm(withError(props));
};
components_modal_Modal.warning = modalWarn;
components_modal_Modal.warn = modalWarn;
components_modal_Modal.confirm = function confirmFn(props) {
return confirm_confirm(withConfirm(props));
};
components_modal_Modal.destroyAll = function destroyAllFn() {
while (modal_destroyFns.length) {
const close = modal_destroyFns.pop();
if (close) {
close();
}
}
};
components_modal_Modal.config = modalGlobalConfig;
components_modal_Modal._InternalPanelDoNotUseOrYouWillBeFired = modal_PurePanel;
if (true) {
components_modal_Modal.displayName = 'Modal';
}
/* harmony default export */ var modal = (components_modal_Modal);
;// ./components/notification/index.tsx
let notification = null;
let notification_act = callback => callback();
let notification_taskQueue = [];
let notification_defaultGlobalConfig = {};
function notification_getGlobalContext() {
const {
getContainer,
rtl,
maxCount,
top,
bottom,
showProgress,
pauseOnHover
} = notification_defaultGlobalConfig;
const mergedContainer = getContainer?.() || document.body;
return {
getContainer: () => mergedContainer,
rtl,
maxCount,
top,
bottom,
showProgress,
pauseOnHover
};
}
const notification_GlobalHolder = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
notificationConfig,
sync
} = props;
const {
getPrefixCls
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(config_provider_context.ConfigContext);
const prefixCls = notification_defaultGlobalConfig.prefixCls || getPrefixCls('notification');
const appConfig = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(AppConfigContext);
const [api, holder] = useInternalNotification({
...notificationConfig,
prefixCls,
...appConfig.notification
});
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(sync, []);
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useImperativeHandle(ref, () => {
const instance = {
...api
};
Object.keys(instance).forEach(method => {
instance[method] = (...args) => {
sync();
return api[method].apply(api, args);
};
});
return {
instance,
sync
};
});
return holder;
});
const notification_GlobalHolderWrapper = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((_, ref) => {
const [notificationConfig, setNotificationConfig] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(notification_getGlobalContext);
const sync = () => {
setNotificationConfig(notification_getGlobalContext);
};
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(sync, []);
const global = globalConfig();
const rootPrefixCls = global.getRootPrefixCls();
const rootIconPrefixCls = global.getIconPrefixCls();
const theme = global.getTheme();
const dom = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(notification_GlobalHolder, {
ref: ref,
sync: sync,
notificationConfig: notificationConfig
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(config_provider, {
prefixCls: rootPrefixCls,
iconPrefixCls: rootIconPrefixCls,
theme: theme
}, global.holderRender ? global.holderRender(dom) : dom);
});
const flushNotificationQueue = () => {
if (!notification) {
const holderFragment = document.createDocumentFragment();
const newNotification = {
fragment: holderFragment
};
notification = newNotification;
// Delay render to avoid sync issue
notification_act(() => {
render(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(notification_GlobalHolderWrapper, {
ref: node => {
const {
instance,
sync
} = node || {};
Promise.resolve().then(() => {
if (!newNotification.instance && instance) {
newNotification.instance = instance;
newNotification.sync = sync;
flushNotificationQueue();
}
});
}
}), holderFragment);
});
return;
}
// Notification not ready
if (!notification.instance) {
return;
}
// >>> Execute task
notification_taskQueue.forEach(task => {
switch (task.type) {
case 'open':
{
notification_act(() => {
notification.instance.open({
...notification_defaultGlobalConfig,
...task.config
});
});
break;
}
case 'destroy':
notification_act(() => {
notification?.instance?.destroy(task.key);
});
break;
}
});
// Clean up
notification_taskQueue = [];
};
// ==============================================================================
// == Export ==
// ==============================================================================
function setNotificationGlobalConfig(config) {
notification_defaultGlobalConfig = {
...notification_defaultGlobalConfig,
...config
};
// Trigger sync for it
notification_act(() => {
notification?.sync?.();
});
}
function notification_open(config) {
const global = globalConfig();
if ( true && !global.holderRender) {
warnContext('notification');
}
notification_taskQueue.push({
type: 'open',
config
});
flushNotificationQueue();
}
const notification_destroy = key => {
notification_taskQueue.push({
type: 'destroy',
key
});
flushNotificationQueue();
};
const notification_methods = ['success', 'info', 'warning', 'error'];
const notification_baseStaticMethods = {
open: notification_open,
destroy: notification_destroy,
config: setNotificationGlobalConfig,
useNotification: useNotification_useNotification,
_InternalPanelDoNotUseOrYouWillBeFired: notification_PurePanel
};
const notification_staticMethods = notification_baseStaticMethods;
notification_methods.forEach(type => {
notification_staticMethods[type] = config => notification_open({
...config,
type
});
});
// ==============================================================================
// == Test ==
// ==============================================================================
const notification_noop = () => {};
let notification_actWrapper = notification_noop;
if (false) // removed by dead control flow
{}
const components_notification_actWrapper = notification_actWrapper;
let notification_actDestroy = notification_noop;
if (false) // removed by dead control flow
{}
const components_notification_actDestroy = notification_actDestroy;
/* harmony default export */ var components_notification = (notification_staticMethods);
// EXTERNAL MODULE: ./components/popconfirm/style/index.ts
var popconfirm_style = __webpack_require__("./components/popconfirm/style/index.ts");
;// ./components/popconfirm/PurePanel.tsx
const PurePanel_Overlay = props => {
const {
prefixCls,
okButtonProps,
cancelButtonProps,
title,
description,
cancelText,
okText,
okType = 'primary',
icon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_ExclamationCircleFilled, null),
showCancel = true,
close,
onConfirm,
onCancel,
onPopupClick,
classNames,
styles
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const [contextLocale] = (0,useLocale["default"])('Popconfirm', en_US["default"].Popconfirm);
const titleNode = getRenderPropValue(title);
const descriptionNode = getRenderPropValue(description);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-inner-content`,
onClick: onPopupClick
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-message`
}, icon && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-message-icon`
}, icon), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-message-text`
}, titleNode && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-title`, classNames?.title),
style: styles?.title
}, titleNode)), descriptionNode && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-description`, classNames?.content),
style: styles?.content
}, descriptionNode)))), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-buttons`
}, showCancel && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(button_Button, {
onClick: onCancel,
size: "small",
...cancelButtonProps
}, cancelText || contextLocale?.cancelText)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(_util_ActionButton, {
buttonProps: {
size: 'small',
...convertLegacyProps(okType),
...okButtonProps
},
actionFn: onConfirm,
close: close,
prefixCls: getPrefixCls('btn'),
quitOnNullishReturnValue: true,
emitEvent: true
}, okText || contextLocale?.okText)));
};
const popconfirm_PurePanel_PurePanel = props => {
const {
prefixCls: customizePrefixCls,
placement,
className,
style,
...restProps
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('popconfirm', customizePrefixCls);
(0,popconfirm_style["default"])(prefixCls);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(popover_PurePanel, {
placement: placement,
className: (0,clsx.clsx)(prefixCls, className),
style: style,
content: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PurePanel_Overlay, {
prefixCls: prefixCls,
...restProps
})
});
};
/* harmony default export */ var popconfirm_PurePanel = (popconfirm_PurePanel_PurePanel);
;// ./components/popconfirm/index.tsx
const InternalPopconfirm = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
placement = 'top',
trigger,
okType = 'primary',
icon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_ExclamationCircleFilled, null),
children,
overlayClassName,
onOpenChange,
overlayStyle,
styles,
arrow: popconfirmArrow,
classNames,
...restProps
} = props;
const {
getPrefixCls,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles,
arrow: contextArrow,
trigger: contextTrigger
} = (0,config_provider_context.useComponentConfig)('popconfirm');
const [open, setOpen] = (0,es.useControlledState)(props.defaultOpen ?? false, props.open);
const mergedArrow = hook_useMergedArrow(popconfirmArrow, contextArrow);
const mergedTrigger = trigger || contextTrigger || 'click';
// ========================== Warning ===========================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Popconfirm');
true ? warning(!onOpenChange || onOpenChange.length <= 1, 'usage', 'The second `onOpenChange` parameter is internal and unsupported. Please lock to a previous version if needed.') : 0;
}
const settingOpen = value => {
setOpen(value);
onOpenChange?.(value);
};
const close = () => {
settingOpen(false);
};
const onConfirm = e => props.onConfirm?.call(undefined, e);
const onCancel = e => {
settingOpen(false);
props.onCancel?.call(undefined, e);
};
const onInternalOpenChange = value => {
const {
disabled = false
} = props;
if (disabled) {
return;
}
settingOpen(value);
};
const prefixCls = getPrefixCls('popconfirm', customizePrefixCls);
const mergedProps = {
...props,
placement,
trigger: mergedTrigger,
okType,
overlayStyle,
styles,
classNames
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const rootClassNames = (0,clsx.clsx)(prefixCls, contextClassName, overlayClassName, mergedClassNames.root);
(0,popconfirm_style["default"])(prefixCls);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(popover, {
arrow: mergedArrow,
...(0,es.omit)(restProps, ['title']),
trigger: mergedTrigger,
placement: placement,
onOpenChange: onInternalOpenChange,
open: open,
ref: ref,
classNames: {
root: rootClassNames,
container: mergedClassNames.container,
arrow: mergedClassNames.arrow
},
styles: {
root: {
...contextStyle,
...mergedStyles.root,
...overlayStyle
},
container: mergedStyles.container,
arrow: mergedStyles.arrow
},
content: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(PurePanel_Overlay, {
okType: okType,
icon: icon,
...props,
prefixCls: prefixCls,
close: close,
onConfirm: onConfirm,
onCancel: onCancel,
classNames: mergedClassNames,
styles: mergedStyles
}),
"data-popover-inject": true
}, children);
});
const Popconfirm = InternalPopconfirm;
// We don't care debug panel
/* istanbul ignore next */
Popconfirm._InternalPanelDoNotUseOrYouWillBeFired = popconfirm_PurePanel;
if (true) {
Popconfirm.displayName = 'Popconfirm';
}
/* harmony default export */ var popconfirm = (Popconfirm);
;// ./node_modules/@rc-component/progress/es/common.js
const common_defaultProps = {
percent: 0,
prefixCls: 'rc-progress',
strokeColor: '#2db7f5',
strokeLinecap: 'round',
strokeWidth: 1,
railColor: '#D9D9D9',
railWidth: 1,
gapPosition: 'bottom',
loading: false
};
const useTransitionDuration = () => {
const pathsRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)([]);
const prevTimeStamp = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
const now = Date.now();
let updated = false;
pathsRef.current.forEach(path => {
if (!path) {
return;
}
updated = true;
const pathStyle = path.style;
pathStyle.transitionDuration = '.3s, .3s, .3s, .06s';
if (prevTimeStamp.current && now - prevTimeStamp.current < 100) {
pathStyle.transitionDuration = '0s, 0s';
}
});
if (updated) {
prevTimeStamp.current = Date.now();
}
});
return pathsRef.current;
};
;// ./node_modules/@rc-component/progress/es/utils/getIndeterminateLine.js
/* harmony default export */ var getIndeterminateLine = (options => {
const {
id,
percent,
strokeLinecap,
strokeWidth,
loading
} = options;
if (!loading) {
return {
indeterminateStyleProps: {},
indeterminateStyleAnimation: null
};
}
const animationName = `${id}-indeterminate-animate`;
const strokeDashOffset = 100 - (percent + (strokeLinecap === 'round' ? strokeWidth : 0));
return {
indeterminateStyleProps: {
strokeDasharray: `${percent} 100`,
animation: `${animationName} .6s linear alternate infinite`,
strokeDashoffset: 0
},
indeterminateStyleAnimation: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("style", null, `@keyframes ${animationName} {
0% { stroke-dashoffset: 0; }
100% { stroke-dashoffset: -${strokeDashOffset};
}`)
};
});
(Object.getOwnPropertyDescriptor(getIndeterminateLine, "name") || {}).writable || Object.defineProperty(getIndeterminateLine, "name", { value: "default", configurable: true });
;// ./node_modules/@rc-component/progress/es/Line.js
function Line_extends() { Line_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Line_extends.apply(this, arguments); }
const Line = props => {
const {
id,
className,
percent,
prefixCls,
strokeColor,
strokeLinecap,
strokeWidth,
style,
railColor,
railWidth,
transition,
loading,
...restProps
} = {
...common_defaultProps,
...props
};
const mergedId = useId(id);
// eslint-disable-next-line no-param-reassign
delete restProps.gapPosition;
const percentList = Array.isArray(percent) ? percent : [percent];
const strokeColorList = Array.isArray(strokeColor) ? strokeColor : [strokeColor];
const paths = useTransitionDuration();
const center = strokeWidth / 2;
const right = 100 - strokeWidth / 2;
const pathString = `M ${strokeLinecap === 'round' ? center : 0},${center}
L ${strokeLinecap === 'round' ? right : 100},${center}`;
const viewBoxString = `0 0 100 ${strokeWidth}`;
let stackPtg = 0;
const {
indeterminateStyleProps,
indeterminateStyleAnimation
} = getIndeterminateLine({
id: mergedId,
loading,
percent: percentList[0],
strokeLinecap,
strokeWidth
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("svg", Line_extends({
className: (0,clsx.clsx)(`${prefixCls}-line`, className),
viewBox: viewBoxString,
preserveAspectRatio: "none",
style: style
}, restProps), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
className: `${prefixCls}-line-rail`,
d: pathString,
strokeLinecap: strokeLinecap,
stroke: railColor,
strokeWidth: railWidth || strokeWidth,
fillOpacity: "0"
}), percentList.map((ptg, index) => {
let dashPercent = 1;
switch (strokeLinecap) {
case 'round':
dashPercent = 1 - strokeWidth / 100;
break;
case 'square':
dashPercent = 1 - strokeWidth / 2 / 100;
break;
default:
dashPercent = 1;
break;
}
const pathStyle = {
strokeDasharray: `${ptg * dashPercent}px, 100px`,
strokeDashoffset: `-${stackPtg}px`,
transition: transition || 'stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear',
...indeterminateStyleProps
};
const color = strokeColorList[index] || strokeColorList[strokeColorList.length - 1];
stackPtg += ptg;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
key: index,
className: `${prefixCls}-line-path`,
d: pathString,
strokeLinecap: strokeLinecap,
stroke: color,
strokeWidth: strokeWidth,
fillOpacity: "0",
ref: elem => {
// https://reactjs.org/docs/refs-and-the-dom.html#callback-refs
// React will call the ref callback with the DOM element when the component mounts,
// and call it with `null` when it unmounts.
// Refs are guaranteed to be up-to-date before componentDidMount or componentDidUpdate fires.
paths[index] = elem;
},
style: pathStyle
});
}), indeterminateStyleAnimation);
};
if (true) {
Line.displayName = 'Line';
}
/* harmony default export */ var es_Line = (Line);
;// ./node_modules/@rc-component/progress/es/Circle/PtgCircle.js
const Block = ({
bg,
children
}) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
style: {
width: '100%',
height: '100%',
background: bg
}
}, children);
function getPtgColors(color, scale) {
return Object.keys(color).map(key => {
const parsedKey = parseFloat(key);
const ptgKey = `${Math.floor(parsedKey * scale)}%`;
return `${color[key]} ${ptgKey}`;
});
}
const PtgCircle = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls,
color,
gradientId,
radius,
className,
style: circleStyleForStack,
ptg,
strokeLinecap,
strokeWidth,
size,
gapDegree
} = props;
const isGradient = color && typeof color === 'object';
const stroke = isGradient ? `#FFF` : undefined;
// ========================== Circle ==========================
const halfSize = size / 2;
const circleNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("circle", {
className: (0,clsx.clsx)(`${prefixCls}-circle-path`, className),
r: radius,
cx: halfSize,
cy: halfSize,
stroke: stroke,
strokeLinecap: strokeLinecap,
strokeWidth: strokeWidth,
opacity: ptg === 0 ? 0 : 1,
style: circleStyleForStack,
ref: ref
});
// ========================== Render ==========================
if (!isGradient) {
return circleNode;
}
const maskId = `${gradientId}-conic`;
const fromDeg = gapDegree ? `${180 + gapDegree / 2}deg` : '0deg';
const conicColors = getPtgColors(color, (360 - gapDegree) / 360);
const linearColors = getPtgColors(color, 1);
const conicColorBg = `conic-gradient(from ${fromDeg}, ${conicColors.join(', ')})`;
const linearColorBg = `linear-gradient(to ${gapDegree ? 'bottom' : 'top'}, ${linearColors.join(', ')})`;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("mask", {
id: maskId
}, circleNode), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("foreignObject", {
x: 0,
y: 0,
width: size,
height: size,
mask: `url(#${maskId})`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Block, {
bg: linearColorBg
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Block, {
bg: conicColorBg
}))));
});
if (true) {
PtgCircle.displayName = 'PtgCircle';
}
/* harmony default export */ var Circle_PtgCircle = (PtgCircle);
;// ./node_modules/@rc-component/progress/es/Circle/util.js
const VIEW_BOX_SIZE = 100;
const getCircleStyle = (perimeter, perimeterWithoutGap, offset, percent, rotateDeg, gapDegree, gapPosition, strokeColor, strokeLinecap, strokeWidth, stepSpace = 0) => {
const offsetDeg = offset / 100 * 360 * ((360 - gapDegree) / 360);
const positionDeg = gapDegree === 0 ? 0 : {
bottom: 0,
top: 180,
left: 90,
right: -90
}[gapPosition];
let strokeDashoffset = (100 - percent) / 100 * perimeterWithoutGap;
// Fix percent accuracy when strokeLinecap is round
// https://github.com/ant-design/ant-design/issues/35009
if (strokeLinecap === 'round' && percent !== 100) {
strokeDashoffset += strokeWidth / 2;
// when percent is small enough (<= 1%), keep smallest value to avoid it's disappearance
if (strokeDashoffset >= perimeterWithoutGap) {
strokeDashoffset = perimeterWithoutGap - 0.01;
}
}
const halfSize = VIEW_BOX_SIZE / 2;
return {
stroke: typeof strokeColor === 'string' ? strokeColor : undefined,
strokeDasharray: `${perimeterWithoutGap}px ${perimeter}`,
strokeDashoffset: strokeDashoffset + stepSpace,
transform: `rotate(${rotateDeg + offsetDeg + positionDeg}deg)`,
transformOrigin: `${halfSize}px ${halfSize}px`,
transition: 'stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s',
fillOpacity: 0
};
};
;// ./node_modules/@rc-component/progress/es/utils/getIndeterminateCircle.js
/* harmony default export */ var getIndeterminateCircle = (({
id,
loading
}) => {
if (!loading) {
return {
indeterminateStyleProps: {},
indeterminateStyleAnimation: null
};
}
const animationName = `${id}-indeterminate-animate`;
return {
indeterminateStyleProps: {
transform: 'rotate(0deg)',
animation: `${animationName} 1s linear infinite`
},
indeterminateStyleAnimation: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("style", null, `@keyframes ${animationName} {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}`)
};
});
(Object.getOwnPropertyDescriptor(getIndeterminateCircle, "name") || {}).writable || Object.defineProperty(getIndeterminateCircle, "name", { value: "default", configurable: true });
;// ./node_modules/@rc-component/progress/es/Circle/index.js
function Circle_extends() { Circle_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Circle_extends.apply(this, arguments); }
function Circle_toArray(value) {
const mergedValue = value ?? [];
return Array.isArray(mergedValue) ? mergedValue : [mergedValue];
}
const Circle = props => {
const {
id,
prefixCls,
classNames = {},
styles = {},
steps,
strokeWidth,
railWidth,
gapDegree = 0,
gapPosition,
railColor,
strokeLinecap,
style,
className,
strokeColor,
percent,
loading,
...restProps
} = {
...common_defaultProps,
...props
};
const halfSize = VIEW_BOX_SIZE / 2;
const mergedId = useId(id);
const gradientId = `${mergedId}-gradient`;
const radius = halfSize - strokeWidth / 2;
const perimeter = Math.PI * 2 * radius;
const rotateDeg = gapDegree > 0 ? 90 + gapDegree / 2 : -90;
const perimeterWithoutGap = perimeter * ((360 - gapDegree) / 360);
const {
count: stepCount,
gap: stepGap
} = typeof steps === 'object' ? steps : {
count: steps,
gap: 2
};
const percentList = Circle_toArray(percent);
const strokeColorList = Circle_toArray(strokeColor);
const gradient = strokeColorList.find(color => color && typeof color === 'object');
const isConicGradient = gradient && typeof gradient === 'object';
const mergedStrokeLinecap = isConicGradient ? 'butt' : strokeLinecap;
const {
indeterminateStyleProps,
indeterminateStyleAnimation
} = getIndeterminateCircle({
id: mergedId,
loading
});
const circleStyle = getCircleStyle(perimeter, perimeterWithoutGap, 0, 100, rotateDeg, gapDegree, gapPosition, railColor, mergedStrokeLinecap, strokeWidth);
const paths = useTransitionDuration();
const getStokeList = () => {
let stackPtg = 0;
return percentList.map((ptg, index) => {
const color = strokeColorList[index] || strokeColorList[strokeColorList.length - 1];
const circleStyleForStack = getCircleStyle(perimeter, perimeterWithoutGap, stackPtg, ptg, rotateDeg, gapDegree, gapPosition, color, mergedStrokeLinecap, strokeWidth);
stackPtg += ptg;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Circle_PtgCircle, {
key: index,
color: color,
ptg: ptg,
radius: radius,
prefixCls: prefixCls,
gradientId: gradientId,
className: classNames.track,
style: {
...circleStyleForStack,
...indeterminateStyleProps,
...styles.track
},
strokeLinecap: mergedStrokeLinecap,
strokeWidth: strokeWidth,
gapDegree: gapDegree,
ref: elem => {
// https://reactjs.org/docs/refs-and-the-dom.html#callback-refs
// React will call the ref callback with the DOM element when the component mounts,
// and call it with `null` when it unmounts.
// Refs are guaranteed to be up-to-date before componentDidMount or componentDidUpdate fires.
paths[index] = elem;
},
size: VIEW_BOX_SIZE
});
}).reverse();
};
const getStepStokeList = () => {
// only show the first percent when pass steps
const current = Math.round(stepCount * (percentList[0] / 100));
const stepPtg = 100 / stepCount;
let stackPtg = 0;
return new Array(stepCount).fill(null).map((_, index) => {
const color = index <= current - 1 ? strokeColorList[0] : railColor;
const stroke = color && typeof color === 'object' ? `url(#${gradientId})` : undefined;
const circleStyleForStack = getCircleStyle(perimeter, perimeterWithoutGap, stackPtg, stepPtg, rotateDeg, gapDegree, gapPosition, color, 'butt', strokeWidth, stepGap);
stackPtg += (perimeterWithoutGap - circleStyleForStack.strokeDashoffset + stepGap) * 100 / perimeterWithoutGap;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("circle", {
key: index,
className: (0,clsx.clsx)(`${prefixCls}-circle-path`, classNames.track),
r: radius,
cx: halfSize,
cy: halfSize,
stroke: stroke,
strokeWidth: strokeWidth,
opacity: 1,
style: {
...circleStyleForStack,
...styles.track
},
ref: elem => {
paths[index] = elem;
}
});
});
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("svg", Circle_extends({
className: (0,clsx.clsx)(`${prefixCls}-circle`, classNames.root, className),
viewBox: `0 0 ${VIEW_BOX_SIZE} ${VIEW_BOX_SIZE}`,
style: {
...styles.root,
...style
},
id: id,
role: "presentation"
}, restProps), !stepCount && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("circle", {
className: (0,clsx.clsx)(`${prefixCls}-circle-rail`, classNames.rail),
r: radius,
cx: halfSize,
cy: halfSize,
stroke: railColor,
strokeLinecap: mergedStrokeLinecap,
strokeWidth: railWidth || strokeWidth,
style: {
...circleStyle,
...styles.rail
}
}), stepCount ? getStepStokeList() : getStokeList(), indeterminateStyleAnimation);
};
if (true) {
Circle.displayName = 'Circle';
}
/* harmony default export */ var es_Circle = (Circle);
;// ./node_modules/@rc-component/progress/es/index.js
// EXTERNAL MODULE: ./node_modules/@ant-design/colors/es/index.js + 2 modules
var colors_es = __webpack_require__("./node_modules/@ant-design/colors/es/index.js");
;// ./components/progress/utils.ts
function validProgress(progress) {
if (!progress || progress < 0) {
return 0;
}
if (progress > 100) {
return 100;
}
return progress;
}
function getSuccessPercent({
success
}) {
let percent;
if (success && 'percent' in success) {
percent = success.percent;
}
return percent;
}
const getPercentage = ({
percent,
success
}) => {
const realSuccessPercent = validProgress(getSuccessPercent({
success
}));
return [realSuccessPercent, validProgress(validProgress(percent) - realSuccessPercent)];
};
const getStrokeColor = ({
success = {},
strokeColor
}) => {
const {
strokeColor: successColor
} = success;
return [successColor || colors_es.presetPrimaryColors.green, strokeColor || null];
};
const utils_getSize = (size, type, extra) => {
let width = -1;
let height = -1;
if (type === 'step') {
const steps = extra.steps;
const strokeWidth = extra.strokeWidth;
if (typeof size === 'string' || typeof size === 'undefined') {
width = size === 'small' ? 2 : 14;
height = strokeWidth ?? 8;
} else if ((0,is.isNumber)(size)) {
[width, height] = [size, size];
} else {
[width = 14, height = 8] = Array.isArray(size) ? size : [size.width, size.height];
}
width *= steps;
} else if (type === 'line') {
const strokeWidth = extra?.strokeWidth;
if (typeof size === 'string' || typeof size === 'undefined') {
height = strokeWidth || (size === 'small' ? 6 : 8);
} else if ((0,is.isNumber)(size)) {
[width, height] = [size, size];
} else {
[width = -1, height = 8] = Array.isArray(size) ? size : [size.width, size.height];
}
} else if (type === 'circle' || type === 'dashboard') {
if (typeof size === 'string' || typeof size === 'undefined') {
[width, height] = size === 'small' ? [60, 60] : [120, 120];
} else if ((0,is.isNumber)(size)) {
[width, height] = [size, size];
} else if (Array.isArray(size)) {
width = size[0] ?? size[1] ?? 120;
height = size[0] ?? size[1] ?? 120;
}
}
return [width, height];
};
;// ./components/progress/Circle.tsx
const CIRCLE_MIN_STROKE_WIDTH = 3;
const getMinPercent = width => CIRCLE_MIN_STROKE_WIDTH / width * 100;
const OMIT_SEMANTIC_NAMES = ['root', 'body', 'indicator'];
const Circle_Circle = props => {
const {
prefixCls,
classNames,
styles,
railColor,
trailColor,
strokeLinecap = 'round',
gapPosition,
gapPlacement,
gapDegree,
width: originWidth = 120,
type,
children,
success,
size = originWidth,
steps
} = props;
const {
direction
} = (0,config_provider_context.useComponentConfig)('progress');
const mergedRailColor = railColor ?? trailColor;
const [width, height] = utils_getSize(size, 'circle');
let {
strokeWidth
} = props;
if (strokeWidth === undefined) {
strokeWidth = Math.max(getMinPercent(width), 6);
}
const circleStyle = {
width,
height,
fontSize: width * 0.15 + 6
};
const realGapDegree = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
// Support gapDeg = 0 when type = 'dashboard'
if (gapDegree || gapDegree === 0) {
return gapDegree;
}
if (type === 'dashboard') {
return 75;
}
return undefined;
}, [gapDegree, type]);
const percentArray = getPercentage(props);
const gapPos = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const mergedPlacement = (gapPlacement ?? gapPosition) || type === 'dashboard' && 'bottom' || undefined;
const isRTL = direction === 'rtl';
switch (mergedPlacement) {
case 'start':
return isRTL ? 'right' : 'left';
case 'end':
return isRTL ? 'left' : 'right';
default:
return mergedPlacement;
}
}, [direction, gapPlacement, gapPosition, type]);
// using className to style stroke color
const isGradient = Object.prototype.toString.call(props.strokeColor) === '[object Object]';
const strokeColor = getStrokeColor({
success,
strokeColor: props.strokeColor
});
const wrapperClassName = (0,clsx.clsx)(`${prefixCls}-body`, {
[`${prefixCls}-circle-gradient`]: isGradient
}, classNames.body);
const circleContent = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Circle, {
steps: steps,
percent: steps ? percentArray[1] : percentArray,
strokeWidth: strokeWidth,
railWidth: strokeWidth,
strokeColor: steps ? strokeColor[1] : strokeColor,
strokeLinecap: strokeLinecap,
railColor: mergedRailColor,
prefixCls: prefixCls,
gapDegree: realGapDegree,
gapPosition: gapPos,
classNames: (0,es.omit)(classNames, OMIT_SEMANTIC_NAMES),
styles: (0,es.omit)(styles, OMIT_SEMANTIC_NAMES)
});
const smallCircle = width <= 20;
const node = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: wrapperClassName,
style: {
...circleStyle,
...styles.body
}
}, circleContent, !smallCircle && children);
if (smallCircle) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_tooltip, {
title: children
}, node);
}
return node;
};
/* harmony default export */ var progress_Circle = (Circle_Circle);
// EXTERNAL MODULE: ./components/progress/style/index.ts
var progress_style = __webpack_require__("./components/progress/style/index.ts");
;// ./components/progress/Line.tsx
/**
* @example
* {
* "0%": "#afc163",
* "75%": "#009900",
* "50%": "green", // ====> '#afc163 0%, #66FF00 25%, #00CC00 50%, #009900 75%, #ffffff 100%'
* "25%": "#66FF00",
* "100%": "#ffffff"
* }
*/
const sortGradient = gradients => {
let tempArr = [];
Object.keys(gradients).forEach(key => {
const formattedKey = Number.parseFloat(key.replace(/%/g, ''));
if (!Number.isNaN(formattedKey)) {
tempArr.push({
key: formattedKey,
value: gradients[key]
});
}
});
tempArr = tempArr.sort((a, b) => a.key - b.key);
return tempArr.map(({
key,
value
}) => `${value} ${key}%`).join(', ');
};
/**
* Then this man came to realize the truth: Besides six pence, there is the moon. Besides bread and
* butter, there is the bug. And... Besides women, there is the code.
*
* @example
* {
* "0%": "#afc163",
* "25%": "#66FF00",
* "50%": "#00CC00", // ====> linear-gradient(to right, #afc163 0%, #66FF00 25%,
* "75%": "#009900", // #00CC00 50%, #009900 75%, #ffffff 100%)
* "100%": "#ffffff"
* }
*/
const handleGradient = (strokeColor, directionConfig) => {
const {
from = colors_es.presetPrimaryColors.blue,
to = colors_es.presetPrimaryColors.blue,
direction = directionConfig === 'rtl' ? 'to left' : 'to right',
...rest
} = strokeColor;
if (Object.keys(rest).length !== 0) {
const sortedGradients = sortGradient(rest);
const background = `linear-gradient(${direction}, ${sortedGradients})`;
return {
background,
[progress_style.LineStrokeColorVar]: background
};
}
const background = `linear-gradient(${direction}, ${from}, ${to})`;
return {
background,
[progress_style.LineStrokeColorVar]: background
};
};
const Line_Line = props => {
const {
prefixCls,
classNames,
styles,
direction: directionConfig,
percent,
size,
strokeWidth,
strokeColor,
strokeLinecap = 'round',
children,
railColor,
trailColor,
percentPosition,
success
} = props;
const {
align: infoAlign,
type: infoPosition
} = percentPosition;
const mergedRailColor = railColor ?? trailColor;
const borderRadius = strokeLinecap === 'square' || strokeLinecap === 'butt' ? 0 : undefined;
if (true) {
const warning = (0,_util_warning.devUseWarning)('Progress');
warning.deprecated(!('strokeWidth' in props), 'strokeWidth', 'size');
}
// ========================= Size =========================
const mergedSize = size ?? [-1, strokeWidth || (size === 'small' ? 6 : 8)];
const [width, height] = utils_getSize(mergedSize, 'line', {
strokeWidth
});
// ========================= Rail =========================
const railStyle = {
backgroundColor: mergedRailColor || undefined,
borderRadius,
height
};
// ======================== Tracks ========================
const trackCls = `${prefixCls}-track`;
const backgroundProps = strokeColor && typeof strokeColor !== 'string' ? handleGradient(strokeColor, directionConfig) : {
[progress_style.LineStrokeColorVar]: strokeColor,
background: strokeColor
};
const percentTrackStyle = {
width: `${validProgress(percent)}%`,
height,
borderRadius,
...backgroundProps
};
const successPercent = getSuccessPercent(props);
const successTrackStyle = {
width: `${validProgress(successPercent)}%`,
height,
borderRadius,
backgroundColor: success?.strokeColor
};
// ======================== Render ========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-body`, classNames.body, {
[`${prefixCls}-body-layout-bottom`]: infoAlign === 'center' && infoPosition === 'outer'
}),
style: {
width: width > 0 ? width : '100%',
...styles.body
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-rail`, classNames.rail),
style: {
...railStyle,
...styles.rail
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(trackCls, classNames.track),
style: {
...percentTrackStyle,
...styles.track
}
}, infoPosition === 'inner' && children), successPercent !== undefined && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(trackCls, `${trackCls}-success`, classNames.track),
style: {
...successTrackStyle,
...styles.track
}
}))), infoPosition === 'outer' && children);
};
/* harmony default export */ var progress_Line = (Line_Line);
;// ./components/progress/Steps.tsx
const Steps_Steps = props => {
const {
classNames,
styles,
size,
steps,
rounding: customRounding = Math.round,
percent = 0,
strokeWidth = 8,
strokeColor,
railColor,
trailColor,
prefixCls,
children
} = props;
const current = customRounding(steps * (percent / 100));
const stepWidth = size === 'small' ? 2 : 14;
const mergedSize = size ?? [stepWidth, strokeWidth];
const [width, height] = utils_getSize(mergedSize, 'step', {
steps,
strokeWidth
});
const unitWidth = width / steps;
const styledSteps = Array.from({
length: steps
});
const mergedRailColor = railColor ?? trailColor;
for (let i = 0; i < steps; i++) {
const color = Array.isArray(strokeColor) ? strokeColor[i] : strokeColor;
styledSteps[i] = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
key: i,
className: (0,clsx.clsx)(`${prefixCls}-steps-item`, {
[`${prefixCls}-steps-item-active`]: i <= current - 1
}, classNames.track),
style: {
backgroundColor: i <= current - 1 ? color : mergedRailColor,
width: unitWidth,
height,
...styles.track
}
});
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-steps-body`, classNames.body),
style: styles.body
}, styledSteps, children);
};
/* harmony default export */ var progress_Steps = (Steps_Steps);
;// ./components/progress/progress.tsx
const ProgressTypes = ['line', 'circle', 'dashboard'];
const ProgressStatuses = ['normal', 'exception', 'active', 'success'];
const progress_Progress = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
classNames,
styles,
steps,
strokeColor,
percent = 0,
size = 'medium',
showInfo = true,
type = 'line',
status,
format,
style,
percentPosition = {},
...restProps
} = props;
// ========================= MISC =========================
const {
align: infoAlign = 'end',
type: infoPosition = 'outer'
} = percentPosition;
const strokeColorNotArray = Array.isArray(strokeColor) ? strokeColor[0] : strokeColor;
const strokeColorNotGradient = typeof strokeColor === 'string' || Array.isArray(strokeColor) ? strokeColor : undefined;
const strokeColorIsBright = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (strokeColorNotArray) {
const color = typeof strokeColorNotArray === 'string' ? strokeColorNotArray : Object.values(strokeColorNotArray)[0];
return new fast_color_es.FastColor(color).isLight();
}
return false;
}, [strokeColor]);
const percentNumber = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const successPercent = getSuccessPercent(props);
return Number.parseInt(successPercent !== undefined ? (successPercent ?? 0)?.toString() : (percent ?? 0)?.toString(), 10);
}, [percent, props.success]);
const progressStatus = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!ProgressStatuses.includes(status) && percentNumber >= 100) {
return 'success';
}
return status || 'normal';
}, [status, percentNumber]);
// ======================= Context ========================
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('progress');
const prefixCls = getPrefixCls('progress', customizePrefixCls);
const [hashId, cssVarCls] = (0,progress_style["default"])(prefixCls);
const mergedProps = {
...props,
percent,
type,
size,
showInfo,
percentPosition
};
// ======================== Styles ========================
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
// ========================= Info =========================
const isLineType = type === 'line';
const isPureLineType = isLineType && !steps;
const progressInfo = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!showInfo) {
return null;
}
const successPercent = getSuccessPercent(props);
let text;
const textFormatter = format || (number => `${number}%`);
const isBrightInnerColor = isLineType && strokeColorIsBright && infoPosition === 'inner';
if (infoPosition === 'inner' || format || progressStatus !== 'exception' && progressStatus !== 'success') {
text = textFormatter(validProgress(percent), validProgress(successPercent));
} else if (progressStatus === 'exception') {
text = isLineType ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CloseCircleFilled, null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CloseOutlined, null);
} else if (progressStatus === 'success') {
text = isLineType ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CheckCircleFilled, null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CheckOutlined, null);
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}-indicator`, {
[`${prefixCls}-indicator-bright`]: isBrightInnerColor,
[`${prefixCls}-indicator-${infoAlign}`]: isPureLineType,
[`${prefixCls}-indicator-${infoPosition}`]: isPureLineType
}, mergedClassNames.indicator),
style: mergedStyles.indicator,
title: typeof text === 'string' ? text : undefined
}, text);
}, [showInfo, percent, percentNumber, progressStatus, type, prefixCls, format, isLineType, strokeColorIsBright, infoPosition, infoAlign, isPureLineType, mergedClassNames.indicator, mergedStyles.indicator]);
if (true) {
const warning = (0,_util_warning.devUseWarning)('Progress');
[['width', 'size'], ['trailColor', 'railColor'], ['gapPosition', 'gapPlacement']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
if (type === 'circle' || type === 'dashboard') {
if (Array.isArray(size)) {
true ? warning(false, 'usage', 'Type "circle" and "dashboard" do not accept array as `size`, please use number or preset size instead.') : 0;
} else if ((0,is.isPlainObject)(size)) {
true ? warning(false, 'usage', 'Type "circle" and "dashboard" do not accept object as `size`, please use number or preset size instead.') : 0;
}
}
warning.deprecated(size !== 'default', 'size="default"', 'size="medium"');
}
// ======================== Render ========================
const sharedProps = {
...props,
classNames: mergedClassNames,
styles: mergedStyles
};
let progress;
// Render progress shape
if (type === 'line') {
progress = steps ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(progress_Steps, {
...sharedProps,
strokeColor: strokeColorNotGradient,
prefixCls: prefixCls,
steps: (0,is.isPlainObject)(steps) ? steps.count : steps
}, progressInfo)) : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(progress_Line, {
...sharedProps,
strokeColor: strokeColorNotArray,
prefixCls: prefixCls,
direction: direction,
percentPosition: {
align: infoAlign,
type: infoPosition
}
}, progressInfo));
} else if (type === 'circle' || type === 'dashboard') {
progress = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(progress_Circle, {
...sharedProps,
strokeColor: strokeColorNotArray,
prefixCls: prefixCls,
progressStatus: progressStatus
}, progressInfo);
}
const classString = (0,clsx.clsx)(prefixCls, `${prefixCls}-status-${progressStatus}`, {
[`${prefixCls}-${type === 'dashboard' && 'circle' || type}`]: type !== 'line',
[`${prefixCls}-inline-circle`]: type === 'circle' && utils_getSize(size, 'circle')[0] <= 20,
[`${prefixCls}-line`]: isPureLineType,
[`${prefixCls}-line-align-${infoAlign}`]: isPureLineType,
[`${prefixCls}-line-position-${infoPosition}`]: isPureLineType,
[`${prefixCls}-steps`]: steps,
[`${prefixCls}-show-info`]: showInfo,
[`${prefixCls}-small`]: size === 'small',
[`${prefixCls}-rtl`]: direction === 'rtl'
}, contextClassName, className, rootClassName, mergedClassNames.root, hashId, cssVarCls);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: ref,
style: {
...contextStyle,
...mergedStyles.root,
...style
},
className: classString,
role: "progressbar",
"aria-valuenow": percentNumber,
"aria-valuemin": 0,
"aria-valuemax": 100,
...(0,es.omit)(restProps, ['railColor', 'trailColor', 'strokeWidth', 'width', 'gapDegree', 'gapPosition', 'gapPlacement', 'strokeLinecap', 'success'])
}, progress);
});
if (true) {
progress_Progress.displayName = 'Progress';
}
/* harmony default export */ var progress = (progress_Progress);
;// ./components/progress/index.tsx
/* harmony default export */ var components_progress = (progress);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
var unsupportedIterableToArray = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js");
;// ./node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js
function _createForOfIteratorHelper(r, e) {
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (!t) {
if (Array.isArray(r) || (t = (0,unsupportedIterableToArray["default"])(r)) || e && r && "number" == typeof r.length) {
t && (r = t);
var _n = 0,
F = function F() {};
return {
s: F,
n: function n() {
return _n >= r.length ? {
done: !0
} : {
done: !1,
value: r[_n++]
};
},
e: function e(r) {
throw r;
},
f: F
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var o,
a = !0,
u = !1;
return {
s: function s() {
t = t.call(r);
},
n: function n() {
var r = t.next();
return a = r.done, r;
},
e: function e(r) {
u = !0, o = r;
},
f: function f() {
try {
a || null == t["return"] || t["return"]();
} finally {
if (u) throw o;
}
}
};
}
;// ./node_modules/@rc-component/qrcode/es/libs/qrcodegen.js
var _class, _class2;
// Copyright (c) Project Nayuki. (MIT License)
// https://www.nayuki.io/page/qr-code-generator-library
// Modification with code reorder and prettier
// --------------------------------------------
// Appends the given number of low-order bits of the given value
// to the given buffer. Requires 0 <= len <= 31 and 0 <= val < 2^len.
function appendBits(val, len, bb) {
if (len < 0 || len > 31 || val >>> len != 0) {
throw new RangeError('Value out of range');
}
for (var i = len - 1; i >= 0; i-- // Append bit by bit
) {
bb.push(val >>> i & 1);
}
}
// Returns true iff the i'th bit of x is set to 1.
function getBit(x, i) {
return (x >>> i & 1) != 0;
}
// Throws an exception if the given condition is false.
function assert(cond) {
if (!cond) {
throw new Error('Assertion error');
}
}
/*---- Public helper enumeration ----*/
/*
* Describes how a segment's data bits are numbererpreted. Immutable.
*/
var Mode = /*#__PURE__*/function () {
function Mode(modeBits, numBitsCharCount) {
(0,classCallCheck["default"])(this, Mode);
/*-- Constructor and fields --*/
// The mode indicator bits, which is a unumber4 value (range 0 to 15).
(0,defineProperty["default"])(this, "modeBits", void 0);
// Number of character count bits for three different version ranges.
(0,defineProperty["default"])(this, "numBitsCharCount", void 0);
this.modeBits = modeBits;
this.numBitsCharCount = numBitsCharCount;
}
/*-- Method --*/
// (Package-private) Returns the bit width of the character count field for a segment in
// this mode in a QR Code at the given version number. The result is in the range [0, 16].
(0,createClass["default"])(Mode, [{
key: "numCharCountBits",
value: function numCharCountBits(ver) {
return this.numBitsCharCount[Math.floor((ver + 7) / 17)];
}
}]);
return Mode;
}();
/*---- Public helper enumeration ----*/
/*
* The error correction level in a QR Code symbol. Immutable.
*/
_class = Mode;
/*-- Constants --*/
(0,defineProperty["default"])(Mode, "NUMERIC", new _class(0x1, [10, 12, 14]));
(0,defineProperty["default"])(Mode, "ALPHANUMERIC", new _class(0x2, [9, 11, 13]));
(0,defineProperty["default"])(Mode, "BYTE", new _class(0x4, [8, 16, 16]));
(0,defineProperty["default"])(Mode, "KANJI", new _class(0x8, [8, 10, 12]));
(0,defineProperty["default"])(Mode, "ECI", new _class(0x7, [0, 0, 0]));
var Ecc = /*#__PURE__*/(0,createClass["default"])(function Ecc(ordinal, formatBits) {
(0,classCallCheck["default"])(this, Ecc);
// The QR Code can tolerate about 30% erroneous codewords
/*-- Constructor and fields --*/
// In the range 0 to 3 (unsigned 2-bit numbereger).
(0,defineProperty["default"])(this, "ordinal", void 0);
// (Package-private) In the range 0 to 3 (unsigned 2-bit numbereger).
(0,defineProperty["default"])(this, "formatBits", void 0);
this.ordinal = ordinal;
this.formatBits = formatBits;
});
/*
* A segment of character/binary/control data in a QR Code symbol.
* Instances of this class are immutable.
* The mid-level way to create a segment is to take the payload data
* and call a static factory function such as QrSegment.makeNumeric().
* The low-level way to create a segment is to custom-make the bit buffer
* and call the QrSegment() constructor with appropriate values.
* This segment class imposes no length restrictions, but QR Codes have restrictions.
* Even in the most favorable conditions, a QR Code can only hold 7089 characters of data.
* Any segment longer than this is meaningless for the purpose of generating QR Codes.
*/
_class2 = Ecc;
/*-- Constants --*/
(0,defineProperty["default"])(Ecc, "LOW", new _class2(0, 1));
// The QR Code can tolerate about 7% erroneous codewords
(0,defineProperty["default"])(Ecc, "MEDIUM", new _class2(1, 0));
// The QR Code can tolerate about 15% erroneous codewords
(0,defineProperty["default"])(Ecc, "QUARTILE", new _class2(2, 3));
// The QR Code can tolerate about 25% erroneous codewords
(0,defineProperty["default"])(Ecc, "HIGH", new _class2(3, 2));
var QrSegment = /*#__PURE__*/function () {
// Creates a new QR Code segment with the given attributes and data.
// The character count (numChars) must agree with the mode and the bit buffer length,
// but the constranumber isn't checked. The given bit buffer is cloned and stored.
function QrSegment(mode, numChars, bitData) {
(0,classCallCheck["default"])(this, QrSegment);
/*-- Constructor (low level) and fields --*/
// The mode indicator of this segment.
(0,defineProperty["default"])(this, "mode", void 0);
// The length of this segment's unencoded data. Measured in characters for
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
// Always zero or positive. Not the same as the data's bit length.
(0,defineProperty["default"])(this, "numChars", void 0);
// The data bits of this segment. Accessed through getData().
(0,defineProperty["default"])(this, "bitData", void 0);
this.mode = mode;
this.numChars = numChars;
this.bitData = bitData;
if (numChars < 0) {
throw new RangeError('Invalid argument');
}
this.bitData = bitData.slice(); // Make defensive copy
}
/*-- Methods --*/
// Returns a new copy of the data bits of this segment.
(0,createClass["default"])(QrSegment, [{
key: "getData",
value: function getData() {
return this.bitData.slice(); // Make defensive copy
}
// (Package-private) Calculates and returns the number of bits needed to encode the given segments at
// the given version. The result is infinity if a segment has too many characters to fit its length field.
}], [{
key: "makeBytes",
value: /*-- Static factory functions (mid level) --*/
// Returns a segment representing the given binary data encoded in
// byte mode. All input byte arrays are acceptable. Any text string
// can be converted to UTF-8 bytes and encoded as a byte mode segment.
function makeBytes(data) {
var bb = [];
var _iterator = _createForOfIteratorHelper(data),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var b = _step.value;
appendBits(b, 8, bb);
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return new QrSegment(Mode.BYTE, data.length, bb);
}
// Returns a segment representing the given string of decimal digits encoded in numeric mode.
}, {
key: "makeNumeric",
value: function makeNumeric(digits) {
if (!QrSegment.isNumeric(digits)) {
throw new RangeError('String contains non-numeric characters');
}
var bb = [];
for (var i = 0; i < digits.length;) {
// Consume up to 3 digits per iteration
var n = Math.min(digits.length - i, 3);
appendBits(parseInt(digits.substring(i, i + n), 10), n * 3 + 1, bb);
i += n;
}
return new QrSegment(Mode.NUMERIC, digits.length, bb);
}
// Returns a segment representing the given text string encoded in alphanumeric mode.
// The characters allowed are: 0 to 9, A to Z (uppercase only), space,
// dollar, percent, asterisk, plus, hyphen, period, slash, colon.
}, {
key: "makeAlphanumeric",
value: function makeAlphanumeric(text) {
if (!QrSegment.isAlphanumeric(text)) {
throw new RangeError('String contains unencodable characters in alphanumeric mode');
}
var bb = [];
var i;
for (i = 0; i + 2 <= text.length; i += 2) {
// Process groups of 2
var temp = QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)) * 45;
temp += QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i + 1));
appendBits(temp, 11, bb);
}
if (i < text.length) {
// 1 character remaining
appendBits(QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)), 6, bb);
}
return new QrSegment(Mode.ALPHANUMERIC, text.length, bb);
}
// Returns a new mutable list of zero or more segments to represent the given Unicode text string.
// The result may use various segment modes and switch modes to optimize the length of the bit stream.
}, {
key: "makeSegments",
value: function makeSegments(text) {
// Select the most efficient segment encoding automatically
if (text == '') {
return [];
} else if (QrSegment.isNumeric(text)) {
return [QrSegment.makeNumeric(text)];
} else if (QrSegment.isAlphanumeric(text)) {
return [QrSegment.makeAlphanumeric(text)];
} else {
return [QrSegment.makeBytes(QrSegment.toUtf8ByteArray(text))];
}
}
// Returns a segment representing an Extended Channel Interpretation
// (ECI) designator with the given assignment value.
}, {
key: "makeEci",
value: function makeEci(assignVal) {
var bb = [];
if (assignVal < 0) {
throw new RangeError('ECI assignment value out of range');
} else if (assignVal < 1 << 7) {
appendBits(assignVal, 8, bb);
} else if (assignVal < 1 << 14) {
appendBits(2, 2, bb);
appendBits(assignVal, 14, bb);
} else if (assignVal < 1000000) {
appendBits(6, 3, bb);
appendBits(assignVal, 21, bb);
} else {
throw new RangeError('ECI assignment value out of range');
}
return new QrSegment(Mode.ECI, 0, bb);
}
// Tests whether the given string can be encoded as a segment in numeric mode.
// A string is encodable iff each character is in the range 0 to 9.
}, {
key: "isNumeric",
value: function isNumeric(text) {
return QrSegment.NUMERIC_REGEX.test(text);
}
// Tests whether the given string can be encoded as a segment in alphanumeric mode.
// A string is encodable iff each character is in the following set: 0 to 9, A to Z
// (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
}, {
key: "isAlphanumeric",
value: function isAlphanumeric(text) {
return QrSegment.ALPHANUMERIC_REGEX.test(text);
}
}, {
key: "getTotalBits",
value: function getTotalBits(segs, version) {
var result = 0;
var _iterator2 = _createForOfIteratorHelper(segs),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var seg = _step2.value;
var ccbits = seg.mode.numCharCountBits(version);
if (seg.numChars >= 1 << ccbits) {
return Infinity; // The segment's length doesn't fit the field's bit width
}
result += 4 + ccbits + seg.bitData.length;
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
return result;
}
// Returns a new array of bytes representing the given string encoded in UTF-8.
}, {
key: "toUtf8ByteArray",
value: function toUtf8ByteArray(input) {
var str = encodeURI(input);
var result = [];
for (var i = 0; i < str.length; i++) {
if (str.charAt(i) != '%') {
result.push(str.charCodeAt(i));
} else {
result.push(parseInt(str.substring(i + 1, i + 3), 16));
i += 2;
}
}
return result;
}
/*-- Constants --*/
// Describes precisely all strings that are encodable in numeric mode.
}]);
return QrSegment;
}();
/*
* A QR Code symbol, which is a type of two-dimension barcode.
* Invented by Denso Wave and described in the ISO/IEC 18004 standard.
* Instances of this class represent an immutable square grid of dark and light cells.
* The class provides static factory functions to create a QR Code from text or binary data.
* The class covers the QR Code Model 2 specification, supporting all versions (sizes)
* from 1 to 40, all 4 error correction levels, and 4 character encoding modes.
*
* Ways to create a QR Code object:
* - High level: Take the payload data and call QrCode.encodeText() or QrCode.encodeBinary().
* - Mid level: Custom-make the list of segments and call QrCode.encodeSegments().
* - Low level: Custom-make the array of data codeword bytes (including
* segment headers and final padding, excluding error correction codewords),
* supply the appropriate version number, and call the QrCode() constructor.
* (Note that all ways require supplying the desired error correction level.)
*/
(0,defineProperty["default"])(QrSegment, "NUMERIC_REGEX", /^[0-9]*$/);
// Describes precisely all strings that are encodable in alphanumeric mode.
(0,defineProperty["default"])(QrSegment, "ALPHANUMERIC_REGEX", /^[A-Z0-9 $%*+.\/:-]*$/);
// The set of all legal characters in alphanumeric mode,
// where each character value maps to the index in the string.
(0,defineProperty["default"])(QrSegment, "ALPHANUMERIC_CHARSET", '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:');
var QrCode = /*#__PURE__*/function () {
// Creates a new QR Code with the given version number,
// error correction level, data codeword bytes, and mask number.
// This is a low-level API that most users should not use directly.
// A mid-level API is the encodeSegments() function.
function QrCode(
// The version number of this QR Code, which is between 1 and 40 (inclusive).
// This determines the size of this barcode.
version,
// The error correction level used in this QR Code.
errorCorrectionLevel, dataCodewords, oriMsk) {
(0,classCallCheck["default"])(this, QrCode);
/*-- Fields --*/
// The width and height of this QR Code, measured in modules, between
// 21 and 177 (inclusive). This is equal to version * 4 + 17.
(0,defineProperty["default"])(this, "size", void 0);
// The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).
// Even if a QR Code is created with automatic masking requested (mask = -1),
// the resulting object still has a mask value between 0 and 7.
(0,defineProperty["default"])(this, "mask", void 0);
// The modules of this QR Code (false = light, true = dark).
// Immutable after constructor finishes. Accessed through getModule().
(0,defineProperty["default"])(this, "modules", []);
// Indicates function modules that are not subjected to masking. Discarded when constructor finishes.
(0,defineProperty["default"])(this, "isFunction", []);
/*-- Constructor (low level) and fields --*/
// The version number of this QR Code, which is between 1 and 40 (inclusive).
// This determines the size of this barcode.
(0,defineProperty["default"])(this, "version", void 0);
// The error correction level used in this QR Code.
(0,defineProperty["default"])(this, "errorCorrectionLevel", void 0);
var msk = oriMsk;
this.version = version;
this.errorCorrectionLevel = errorCorrectionLevel;
// Check scalar arguments
if (version < QrCode.MIN_VERSION || version > QrCode.MAX_VERSION) {
throw new RangeError('Version value out of range');
}
if (msk < -1 || msk > 7) {
throw new RangeError('Mask value out of range');
}
this.size = version * 4 + 17;
// Initialize both grids to be size*size arrays of Boolean false
var row = [];
for (var i = 0; i < this.size; i++) {
row.push(false);
}
for (var _i = 0; _i < this.size; _i++) {
this.modules.push(row.slice()); // Initially all light
this.isFunction.push(row.slice());
}
// Compute ECC, draw modules
this.drawFunctionPatterns();
var allCodewords = this.addEccAndInterleave(dataCodewords);
this.drawCodewords(allCodewords);
// Do masking
if (msk == -1) {
// Automatically choose best mask
var minPenalty = 1000000000;
for (var _i2 = 0; _i2 < 8; _i2++) {
this.applyMask(_i2);
this.drawFormatBits(_i2);
var penalty = this.getPenaltyScore();
if (penalty < minPenalty) {
msk = _i2;
minPenalty = penalty;
}
this.applyMask(_i2); // Undoes the mask due to XOR
}
}
assert(0 <= msk && msk <= 7);
this.mask = msk;
this.applyMask(msk); // Apply the final choice of mask
this.drawFormatBits(msk); // Overwrite old format bits
this.isFunction = [];
}
/*-- Accessor methods --*/
// Returns the color of the module (pixel) at the given coordinates, which is false
// for light or true for dark. The top left corner has the coordinates (x=0, y=0).
// If the given coordinates are out of bounds, then false (light) is returned.
(0,createClass["default"])(QrCode, [{
key: "getModule",
value: function getModule(x, y) {
return 0 <= x && x < this.size && 0 <= y && y < this.size && this.modules[y][x];
}
// Modified to expose modules for easy access
}, {
key: "getModules",
value: function getModules() {
return this.modules;
}
/*-- Private helper methods for constructor: Drawing function modules --*/
// Reads this object's version field, and draws and marks all function modules.
}, {
key: "drawFunctionPatterns",
value: function drawFunctionPatterns() {
// Draw horizontal and vertical timing patterns
for (var i = 0; i < this.size; i++) {
this.setFunctionModule(6, i, i % 2 == 0);
this.setFunctionModule(i, 6, i % 2 == 0);
}
// Draw 3 finder patterns (all corners except bottom right; overwrites some timing modules)
this.drawFinderPattern(3, 3);
this.drawFinderPattern(this.size - 4, 3);
this.drawFinderPattern(3, this.size - 4);
// Draw numerous alignment patterns
var alignPatPos = this.getAlignmentPatternPositions();
var numAlign = alignPatPos.length;
for (var _i3 = 0; _i3 < numAlign; _i3++) {
for (var j = 0; j < numAlign; j++) {
// Don't draw on the three finder corners
if (!(_i3 == 0 && j == 0 || _i3 == 0 && j == numAlign - 1 || _i3 == numAlign - 1 && j == 0)) {
this.drawAlignmentPattern(alignPatPos[_i3], alignPatPos[j]);
}
}
}
// Draw configuration data
this.drawFormatBits(0); // Dummy mask value; overwritten later in the constructor
this.drawVersion();
}
// Draws two copies of the format bits (with its own error correction code)
// based on the given mask and this object's error correction level field.
}, {
key: "drawFormatBits",
value: function drawFormatBits(mask) {
// Calculate error correction code and pack bits
var data = this.errorCorrectionLevel.formatBits << 3 | mask; // errCorrLvl is unumber2, mask is unumber3
var rem = data;
for (var i = 0; i < 10; i++) {
rem = rem << 1 ^ (rem >>> 9) * 0x537;
}
var bits = (data << 10 | rem) ^ 0x5412; // unumber15
assert(bits >>> 15 == 0);
// Draw first copy
for (var _i4 = 0; _i4 <= 5; _i4++) {
this.setFunctionModule(8, _i4, getBit(bits, _i4));
}
this.setFunctionModule(8, 7, getBit(bits, 6));
this.setFunctionModule(8, 8, getBit(bits, 7));
this.setFunctionModule(7, 8, getBit(bits, 8));
for (var _i5 = 9; _i5 < 15; _i5++) {
this.setFunctionModule(14 - _i5, 8, getBit(bits, _i5));
}
// Draw second copy
for (var _i6 = 0; _i6 < 8; _i6++) {
this.setFunctionModule(this.size - 1 - _i6, 8, getBit(bits, _i6));
}
for (var _i7 = 8; _i7 < 15; _i7++) {
this.setFunctionModule(8, this.size - 15 + _i7, getBit(bits, _i7));
}
this.setFunctionModule(8, this.size - 8, true); // Always dark
}
// Draws two copies of the version bits (with its own error correction code),
// based on this object's version field, iff 7 <= version <= 40.
}, {
key: "drawVersion",
value: function drawVersion() {
if (this.version < 7) {
return;
}
// Calculate error correction code and pack bits
var rem = this.version; // version is unumber6, in the range [7, 40]
for (var i = 0; i < 12; i++) {
rem = rem << 1 ^ (rem >>> 11) * 0x1f25;
}
var bits = this.version << 12 | rem; // unumber18
assert(bits >>> 18 == 0);
// Draw two copies
for (var _i8 = 0; _i8 < 18; _i8++) {
var color = getBit(bits, _i8);
var a = this.size - 11 + _i8 % 3;
var b = Math.floor(_i8 / 3);
this.setFunctionModule(a, b, color);
this.setFunctionModule(b, a, color);
}
}
// Draws a 9*9 finder pattern including the border separator,
// with the center module at (x, y). Modules can be out of bounds.
}, {
key: "drawFinderPattern",
value: function drawFinderPattern(x, y) {
for (var dy = -4; dy <= 4; dy++) {
for (var dx = -4; dx <= 4; dx++) {
var dist = Math.max(Math.abs(dx), Math.abs(dy)); // Chebyshev/infinity norm
var xx = x + dx;
var yy = y + dy;
if (0 <= xx && xx < this.size && 0 <= yy && yy < this.size) {
this.setFunctionModule(xx, yy, dist != 2 && dist != 4);
}
}
}
}
// Draws a 5*5 alignment pattern, with the center module
// at (x, y). All modules must be in bounds.
}, {
key: "drawAlignmentPattern",
value: function drawAlignmentPattern(x, y) {
for (var dy = -2; dy <= 2; dy++) {
for (var dx = -2; dx <= 2; dx++) this.setFunctionModule(x + dx, y + dy, Math.max(Math.abs(dx), Math.abs(dy)) != 1);
}
}
// Sets the color of a module and marks it as a function module.
// Only used by the constructor. Coordinates must be in bounds.
}, {
key: "setFunctionModule",
value: function setFunctionModule(x, y, isDark) {
this.modules[y][x] = isDark;
this.isFunction[y][x] = true;
}
/*-- Private helper methods for constructor: Codewords and masking --*/
// Returns a new byte string representing the given data with the appropriate error correction
// codewords appended to it, based on this object's version and error correction level.
}, {
key: "addEccAndInterleave",
value: function addEccAndInterleave(data) {
var ver = this.version;
var ecl = this.errorCorrectionLevel;
if (data.length != QrCode.getNumDataCodewords(ver, ecl)) {
throw new RangeError('Invalid argument');
}
// Calculate parameter numbers
var numBlocks = QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
var blockEccLen = QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver];
var rawCodewords = Math.floor(QrCode.getNumRawDataModules(ver) / 8);
var numShortBlocks = numBlocks - rawCodewords % numBlocks;
var shortBlockLen = Math.floor(rawCodewords / numBlocks);
// Split data numbero blocks and append ECC to each block
var blocks = [];
var rsDiv = QrCode.reedSolomonComputeDivisor(blockEccLen);
for (var i = 0, k = 0; i < numBlocks; i++) {
var dat = data.slice(k, k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1));
k += dat.length;
var ecc = QrCode.reedSolomonComputeRemainder(dat, rsDiv);
if (i < numShortBlocks) {
dat.push(0);
}
blocks.push(dat.concat(ecc));
}
// Interleave (not concatenate) the bytes from every block numbero a single sequence
var result = [];
var _loop = function _loop(_i9) {
blocks.forEach(function (block, j) {
// Skip the padding byte in short blocks
if (_i9 != shortBlockLen - blockEccLen || j >= numShortBlocks) {
result.push(block[_i9]);
}
});
};
for (var _i9 = 0; _i9 < blocks[0].length; _i9++) {
_loop(_i9);
}
assert(result.length == rawCodewords);
return result;
}
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
// data area of this QR Code. Function modules need to be marked off before this is called.
}, {
key: "drawCodewords",
value: function drawCodewords(data) {
if (data.length != Math.floor(QrCode.getNumRawDataModules(this.version) / 8)) {
throw new RangeError('Invalid argument');
}
var i = 0; // Bit index numbero the data
// Do the funny zigzag scan
for (var right = this.size - 1; right >= 1; right -= 2) {
// Index of right column in each column pair
if (right == 6) {
right = 5;
}
for (var vert = 0; vert < this.size; vert++) {
// Vertical counter
for (var j = 0; j < 2; j++) {
var x = right - j; // Actual x coordinate
var upward = (right + 1 & 2) == 0;
var y = upward ? this.size - 1 - vert : vert; // Actual y coordinate
if (!this.isFunction[y][x] && i < data.length * 8) {
this.modules[y][x] = getBit(data[i >>> 3], 7 - (i & 7));
i++;
}
// If this QR Code has any remainder bits (0 to 7), they were assigned as
// 0/false/light by the constructor and are left unchanged by this method
}
}
}
assert(i == data.length * 8);
}
// XORs the codeword modules in this QR Code with the given mask pattern.
// The function modules must be marked and the codeword bits must be drawn
// before masking. Due to the arithmetic of XOR, calling applyMask() with
// the same mask value a second time will undo the mask. A final well-formed
// QR Code needs exactly one (not zero, two, etc.) mask applied.
}, {
key: "applyMask",
value: function applyMask(mask) {
if (mask < 0 || mask > 7) {
throw new RangeError('Mask value out of range');
}
for (var y = 0; y < this.size; y++) {
for (var x = 0; x < this.size; x++) {
var invert = void 0;
switch (mask) {
case 0:
invert = (x + y) % 2 == 0;
break;
case 1:
invert = y % 2 == 0;
break;
case 2:
invert = x % 3 == 0;
break;
case 3:
invert = (x + y) % 3 == 0;
break;
case 4:
invert = (Math.floor(x / 3) + Math.floor(y / 2)) % 2 == 0;
break;
case 5:
invert = x * y % 2 + x * y % 3 == 0;
break;
case 6:
invert = (x * y % 2 + x * y % 3) % 2 == 0;
break;
case 7:
invert = ((x + y) % 2 + x * y % 3) % 2 == 0;
break;
default:
throw new Error('Unreachable');
}
if (!this.isFunction[y][x] && invert) {
this.modules[y][x] = !this.modules[y][x];
}
}
}
}
// Calculates and returns the penalty score based on state of this QR Code's current modules.
// This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
}, {
key: "getPenaltyScore",
value: function getPenaltyScore() {
var result = 0;
// Adjacent modules in row having same color, and finder-like patterns
for (var y = 0; y < this.size; y++) {
var runColor = false;
var runX = 0;
var runHistory = [0, 0, 0, 0, 0, 0, 0];
for (var x = 0; x < this.size; x++) {
if (this.modules[y][x] == runColor) {
runX++;
if (runX == 5) {
result += QrCode.PENALTY_N1;
} else if (runX > 5) {
result++;
}
} else {
this.finderPenaltyAddHistory(runX, runHistory);
if (!runColor) {
result += this.finderPenaltyCountPatterns(runHistory) * QrCode.PENALTY_N3;
}
runColor = this.modules[y][x];
runX = 1;
}
}
result += this.finderPenaltyTerminateAndCount(runColor, runX, runHistory) * QrCode.PENALTY_N3;
}
// Adjacent modules in column having same color, and finder-like patterns
for (var _x = 0; _x < this.size; _x++) {
var _runColor = false;
var runY = 0;
var _runHistory = [0, 0, 0, 0, 0, 0, 0];
for (var _y = 0; _y < this.size; _y++) {
if (this.modules[_y][_x] == _runColor) {
runY++;
if (runY == 5) {
result += QrCode.PENALTY_N1;
} else if (runY > 5) {
result++;
}
} else {
this.finderPenaltyAddHistory(runY, _runHistory);
if (!_runColor) {
result += this.finderPenaltyCountPatterns(_runHistory) * QrCode.PENALTY_N3;
}
_runColor = this.modules[_y][_x];
runY = 1;
}
}
result += this.finderPenaltyTerminateAndCount(_runColor, runY, _runHistory) * QrCode.PENALTY_N3;
}
// 2*2 blocks of modules having same color
for (var _y2 = 0; _y2 < this.size - 1; _y2++) {
for (var _x2 = 0; _x2 < this.size - 1; _x2++) {
var color = this.modules[_y2][_x2];
if (color == this.modules[_y2][_x2 + 1] && color == this.modules[_y2 + 1][_x2] && color == this.modules[_y2 + 1][_x2 + 1]) {
result += QrCode.PENALTY_N2;
}
}
}
// Balance of dark and light modules
var dark = 0;
var _iterator3 = _createForOfIteratorHelper(this.modules),
_step3;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var row = _step3.value;
dark = row.reduce(function (sum, color) {
return sum + (color ? 1 : 0);
}, dark);
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
var total = this.size * this.size; // Note that size is odd, so dark/total != 1/2
// Compute the smallest numbereger k >= 0 such that (45-5k)% <= dark/total <= (55+5k)%
var k = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1;
assert(0 <= k && k <= 9);
result += k * QrCode.PENALTY_N4;
assert(0 <= result && result <= 2568888); // Non-tight upper bound based on default values of PENALTY_N1, ..., N4
return result;
}
/*-- Private helper functions --*/
// Returns an ascending list of positions of alignment patterns for this version number.
// Each position is in the range [0,177), and are used on both the x and y axes.
// This could be implemented as lookup table of 40 variable-length lists of numberegers.
}, {
key: "getAlignmentPatternPositions",
value: function getAlignmentPatternPositions() {
if (this.version == 1) {
return [];
} else {
var numAlign = Math.floor(this.version / 7) + 2;
var step = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (numAlign * 2 - 2)) * 2;
var result = [6];
for (var pos = this.size - 7; result.length < numAlign; pos -= step) {
result.splice(1, 0, pos);
}
return result;
}
}
// Returns the number of data bits that can be stored in a QR Code of the given version number, after
// all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
// The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
}, {
key: "finderPenaltyCountPatterns",
value:
// Can only be called immediately after a light run is added, and
// returns either 0, 1, or 2. A helper function for getPenaltyScore().
function finderPenaltyCountPatterns(runHistory) {
var n = runHistory[1];
assert(n <= this.size * 3);
var core = n > 0 && runHistory[2] == n && runHistory[3] == n * 3 && runHistory[4] == n && runHistory[5] == n;
return (core && runHistory[0] >= n * 4 && runHistory[6] >= n ? 1 : 0) + (core && runHistory[6] >= n * 4 && runHistory[0] >= n ? 1 : 0);
}
// Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
}, {
key: "finderPenaltyTerminateAndCount",
value: function finderPenaltyTerminateAndCount(currentRunColor, oriCurrentRunLength, runHistory) {
var currentRunLength = oriCurrentRunLength;
if (currentRunColor) {
// Terminate dark run
this.finderPenaltyAddHistory(currentRunLength, runHistory);
currentRunLength = 0;
}
currentRunLength += this.size; // Add light border to final run
this.finderPenaltyAddHistory(currentRunLength, runHistory);
return this.finderPenaltyCountPatterns(runHistory);
}
// Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
}, {
key: "finderPenaltyAddHistory",
value: function finderPenaltyAddHistory(oriCurrentRunLength, runHistory) {
var currentRunLength = oriCurrentRunLength;
if (runHistory[0] == 0) {
currentRunLength += this.size; // Add light border to initial run
}
runHistory.pop();
runHistory.unshift(currentRunLength);
}
/*-- Constants and tables --*/
// The minimum version number supported in the QR Code Model 2 standard.
}], [{
key: "encodeText",
value: /*-- Static factory functions (high level) --*/
// Returns a QR Code representing the given Unicode text string at the given error correction level.
// As a conservative upper bound, this function is guaranteed to succeed for strings that have 738 or fewer
// Unicode code ponumbers (not UTF-16 code units) if the low error correction level is used. The smallest possible
// QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the
// ecl argument if it can be done without increasing the version.
function encodeText(text, ecl) {
var segs = QrSegment.makeSegments(text);
return QrCode.encodeSegments(segs, ecl);
}
// Returns a QR Code representing the given binary data at the given error correction level.
// This function always encodes using the binary segment mode, not any text mode. The maximum number of
// bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
// The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
}, {
key: "encodeBinary",
value: function encodeBinary(data, ecl) {
var seg = QrSegment.makeBytes(data);
return QrCode.encodeSegments([seg], ecl);
}
/*-- Static factory functions (mid level) --*/
// Returns a QR Code representing the given segments with the given encoding parameters.
// The smallest possible QR Code version within the given range is automatically
// chosen for the output. Iff boostEcl is true, then the ECC level of the result
// may be higher than the ecl argument if it can be done without increasing the
// version. The mask number is either between 0 to 7 (inclusive) to force that
// mask, or -1 to automatically choose an appropriate mask (which may be slow).
// This function allows the user to create a custom sequence of segments that switches
// between modes (such as alphanumeric and byte) to encode text in less space.
// This is a mid-level API; the high-level API is encodeText() and encodeBinary().
}, {
key: "encodeSegments",
value: function encodeSegments(segs, oriEcl) {
var minVersion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var maxVersion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 40;
var mask = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : -1;
var boostEcl = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
if (!(QrCode.MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= QrCode.MAX_VERSION) || mask < -1 || mask > 7) {
throw new RangeError('Invalid value');
}
// Find the minimal version number to use
var version;
var dataUsedBits;
for (version = minVersion;; version++) {
var _dataCapacityBits = QrCode.getNumDataCodewords(version, oriEcl) * 8; // Number of data bits available
var usedBits = QrSegment.getTotalBits(segs, version);
if (usedBits <= _dataCapacityBits) {
dataUsedBits = usedBits;
break; // This version number is found to be suitable
}
if (version >= maxVersion) {
// All versions in the range could not fit the given data
throw new RangeError('Data too long');
}
}
var ecl = oriEcl;
// Increase the error correction level while the data still fits in the current version number
for (var _i10 = 0, _arr = [Ecc.MEDIUM, Ecc.QUARTILE, Ecc.HIGH]; _i10 < _arr.length; _i10++) {
var newEcl = _arr[_i10];
// From low to high
if (boostEcl && dataUsedBits <= QrCode.getNumDataCodewords(version, newEcl) * 8) {
ecl = newEcl;
}
}
// Concatenate all segments to create the data bit string
var bb = [];
var _iterator4 = _createForOfIteratorHelper(segs),
_step4;
try {
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
var seg = _step4.value;
appendBits(seg.mode.modeBits, 4, bb);
appendBits(seg.numChars, seg.mode.numCharCountBits(version), bb);
var _iterator5 = _createForOfIteratorHelper(seg.getData()),
_step5;
try {
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
var b = _step5.value;
bb.push(b);
}
} catch (err) {
_iterator5.e(err);
} finally {
_iterator5.f();
}
}
} catch (err) {
_iterator4.e(err);
} finally {
_iterator4.f();
}
assert(bb.length == dataUsedBits);
// Add terminator and pad up to a byte if applicable
var dataCapacityBits = QrCode.getNumDataCodewords(version, ecl) * 8;
assert(bb.length <= dataCapacityBits);
appendBits(0, Math.min(4, dataCapacityBits - bb.length), bb);
appendBits(0, (8 - bb.length % 8) % 8, bb);
assert(bb.length % 8 == 0);
// Pad with alternating bytes until data capacity is reached
for (var padByte = 0xec; bb.length < dataCapacityBits; padByte ^= 0xec ^ 0x11) {
appendBits(padByte, 8, bb);
}
// Pack bits numbero bytes in big endian
var dataCodewords = [];
while (dataCodewords.length * 8 < bb.length) {
dataCodewords.push(0);
}
bb.forEach(function (b, i) {
dataCodewords[i >>> 3] |= b << 7 - (i & 7);
});
// Create the QR Code object
return new QrCode(version, ecl, dataCodewords, mask);
}
}, {
key: "getNumRawDataModules",
value: function getNumRawDataModules(ver) {
if (ver < QrCode.MIN_VERSION || ver > QrCode.MAX_VERSION) {
throw new RangeError('Version number out of range');
}
var result = (16 * ver + 128) * ver + 64;
if (ver >= 2) {
var numAlign = Math.floor(ver / 7) + 2;
result -= (25 * numAlign - 10) * numAlign - 55;
if (ver >= 7) {
result -= 36;
}
}
assert(208 <= result && result <= 29648);
return result;
}
// Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
// QR Code of the given version number and error correction level, with remainder bits discarded.
// This stateless pure function could be implemented as a (40*4)-cell lookup table.
}, {
key: "getNumDataCodewords",
value: function getNumDataCodewords(ver, ecl) {
return Math.floor(QrCode.getNumRawDataModules(ver) / 8) - QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] * QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
}
// Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
// implemented as a lookup table over all possible parameter values, instead of as an algorithm.
}, {
key: "reedSolomonComputeDivisor",
value: function reedSolomonComputeDivisor(degree) {
if (degree < 1 || degree > 255) {
throw new RangeError('Degree out of range');
}
// Polynomial coefficients are stored from highest to lowest power, excluding the leading term which is always 1.
// For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the unumber8 array [255, 8, 93].
var result = [];
for (var i = 0; i < degree - 1; i++) {
result.push(0);
}
result.push(1); // Start off with the monomial x^0
// Compute the product polynomial (x - r^0) * (x - r^1) * (x - r^2) * ... * (x - r^{degree-1}),
// and drop the highest monomial term which is always 1x^degree.
// Note that r = 0x02, which is a generator element of this field GF(2^8/0x11D).
var root = 1;
for (var _i11 = 0; _i11 < degree; _i11++) {
// Multiply the current product by (x - r^i)
for (var j = 0; j < result.length; j++) {
result[j] = QrCode.reedSolomonMultiply(result[j], root);
if (j + 1 < result.length) {
result[j] ^= result[j + 1];
}
}
root = QrCode.reedSolomonMultiply(root, 0x02);
}
return result;
}
// Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
}, {
key: "reedSolomonComputeRemainder",
value: function reedSolomonComputeRemainder(data, divisor) {
var result = divisor.map(function () {
return 0;
});
var _iterator6 = _createForOfIteratorHelper(data),
_step6;
try {
var _loop2 = function _loop2() {
var b = _step6.value;
// Polynomial division
var factor = b ^ result.shift();
result.push(0);
divisor.forEach(function (coef, i) {
result[i] ^= QrCode.reedSolomonMultiply(coef, factor);
});
};
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
_loop2();
}
} catch (err) {
_iterator6.e(err);
} finally {
_iterator6.f();
}
return result;
}
// Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
// are unsigned 8-bit numberegers. This could be implemented as a lookup table of 256*256 entries of unumber8.
}, {
key: "reedSolomonMultiply",
value: function reedSolomonMultiply(x, y) {
if (x >>> 8 != 0 || y >>> 8 != 0) {
throw new RangeError('Byte out of range');
}
// Russian peasant multiplication
var z = 0;
for (var i = 7; i >= 0; i--) {
z = z << 1 ^ (z >>> 7) * 0x11d;
z ^= (y >>> i & 1) * x;
}
assert(z >>> 8 == 0);
return z;
}
}]);
return QrCode;
}();
(0,defineProperty["default"])(QrCode, "MIN_VERSION", 1);
// The maximum version number supported in the QR Code Model 2 standard.
(0,defineProperty["default"])(QrCode, "MAX_VERSION", 40);
// For use in getPenaltyScore(), when evaluating which mask is best.
(0,defineProperty["default"])(QrCode, "PENALTY_N1", 3);
(0,defineProperty["default"])(QrCode, "PENALTY_N2", 3);
(0,defineProperty["default"])(QrCode, "PENALTY_N3", 40);
(0,defineProperty["default"])(QrCode, "PENALTY_N4", 10);
(0,defineProperty["default"])(QrCode, "ECC_CODEWORDS_PER_BLOCK", [
// Version: (note that index 0 is for padding, and is set to an illegal value)
//0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
[-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
// Low
[-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],
// Medium
[-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
// Quartile
[-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30] // High
]);
(0,defineProperty["default"])(QrCode, "NUM_ERROR_CORRECTION_BLOCKS", [
// Version: (note that index 0 is for padding, and is set to an illegal value)
//0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
[-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],
// Low
[-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],
// Medium
[-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],
// Quartile
[-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81] // High
]);
;// ./node_modules/@rc-component/qrcode/es/utils.js
// Part logic is from `qrcode.react`. (ISC License)
// https://github.com/zpao/qrcode.react
// ==========================================================
// =================== ERROR_LEVEL ==========================
var ERROR_LEVEL_MAP = {
L: Ecc.LOW,
M: Ecc.MEDIUM,
Q: Ecc.QUARTILE,
H: Ecc.HIGH
};
// =================== DEFAULT_VALUE ==========================
var utils_DEFAULT_SIZE = 128;
var DEFAULT_LEVEL = 'L';
var DEFAULT_BACKGROUND_COLOR = '#FFFFFF';
var DEFAULT_FRONT_COLOR = '#000000';
var DEFAULT_NEED_MARGIN = false;
var DEFAULT_MINVERSION = 1;
var SPEC_MARGIN_SIZE = 4;
var DEFAULT_MARGIN_SIZE = 0;
var DEFAULT_IMG_SCALE = 0.1;
// =================== UTILS ==========================
/**
* Generate a path string from modules
* @param modules
* @param margin
* @returns
*/
var generatePath = function generatePath(modules) {
var margin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var ops = [];
modules.forEach(function (row, y) {
var start = null;
row.forEach(function (cell, x) {
if (!cell && start !== null) {
ops.push("M".concat(start + margin, " ").concat(y + margin, "h").concat(x - start, "v1H").concat(start + margin, "z"));
start = null;
return;
}
if (x === row.length - 1) {
if (!cell) {
return;
}
if (start === null) {
ops.push("M".concat(x + margin, ",").concat(y + margin, " h1v1H").concat(x + margin, "z"));
} else {
ops.push("M".concat(start + margin, ",").concat(y + margin, " h").concat(x + 1 - start, "v1H").concat(start + margin, "z"));
}
return;
}
if (cell && start === null) {
start = x;
}
});
});
return ops.join('');
};
/**
* Excavate modules
* @param modules
* @param excavation
* @returns
*/
var excavateModules = function excavateModules(modules, excavation) {
return modules.slice().map(function (row, y) {
if (y < excavation.y || y >= excavation.y + excavation.h) {
return row;
}
return row.map(function (cell, x) {
if (x < excavation.x || x >= excavation.x + excavation.w) {
return cell;
}
return false;
});
});
};
/**
* Get image settings
* @param cells The modules of the QR code
* @param size The size of the QR code
* @param margin
* @param imageSettings
* @returns
*/
var getImageSettings = function getImageSettings(cells, size, margin, imageSettings) {
if (imageSettings == null) {
return null;
}
var numCells = cells.length + margin * 2;
var defaultSize = Math.floor(size * DEFAULT_IMG_SCALE);
var scale = numCells / size;
var w = (imageSettings.width || defaultSize) * scale;
var h = (imageSettings.height || defaultSize) * scale;
var x = imageSettings.x == null ? cells.length / 2 - w / 2 : imageSettings.x * scale;
var y = imageSettings.y == null ? cells.length / 2 - h / 2 : imageSettings.y * scale;
var opacity = imageSettings.opacity == null ? 1 : imageSettings.opacity;
var excavation = null;
if (imageSettings.excavate) {
var floorX = Math.floor(x);
var floorY = Math.floor(y);
var ceilW = Math.ceil(w + x - floorX);
var ceilH = Math.ceil(h + y - floorY);
excavation = {
x: floorX,
y: floorY,
w: ceilW,
h: ceilH
};
}
var crossOrigin = imageSettings.crossOrigin;
return {
x: x,
y: y,
h: h,
w: w,
excavation: excavation,
opacity: opacity,
crossOrigin: crossOrigin
};
};
/**
* Get margin size
* @param needMargin Whether need margin
* @param marginSize Custom margin size
* @returns
*/
var getMarginSize = function getMarginSize(needMargin, marginSize) {
if (marginSize != null) {
return Math.max(Math.floor(marginSize), 0);
}
return needMargin ? SPEC_MARGIN_SIZE : DEFAULT_MARGIN_SIZE;
};
/**
* Check if Path2D is supported
*/
var isSupportPath2d = function () {
try {
new Path2D().addPath(new Path2D());
} catch (_unused) {
return false;
}
return true;
}();
;// ./node_modules/@rc-component/qrcode/es/hooks/useQRCode.js
var useQRCode = function useQRCode(opt) {
var value = opt.value,
level = opt.level,
minVersion = opt.minVersion,
includeMargin = opt.includeMargin,
marginSize = opt.marginSize,
imageSettings = opt.imageSettings,
size = opt.size,
boostLevel = opt.boostLevel;
var memoizedQrcode = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(function () {
var values = Array.isArray(value) ? value : [value];
var segments = values.reduce(function (acc, val) {
acc.push.apply(acc, (0,toConsumableArray["default"])(QrSegment.makeSegments(val)));
return acc;
}, []);
return QrCode.encodeSegments(segments, ERROR_LEVEL_MAP[level], minVersion, undefined, undefined, boostLevel);
}, [value, level, minVersion, boostLevel]);
return external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(function () {
var cs = memoizedQrcode.getModules();
var mg = getMarginSize(includeMargin, marginSize);
var ncs = cs.length + mg * 2;
var cis = getImageSettings(cs, size, mg, imageSettings);
return {
cells: cs,
margin: mg,
numCells: ncs,
calculatedImageSettings: cis,
qrcode: memoizedQrcode
};
}, [memoizedQrcode, size, imageSettings, includeMargin, marginSize]);
};
;// ./node_modules/@rc-component/qrcode/es/QRCodeCanvas.js
var QRCodeCanvas_excluded = ["value", "size", "level", "bgColor", "fgColor", "includeMargin", "minVersion", "marginSize", "style", "imageSettings", "boostLevel"];
var QRCodeCanvas = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef(function (props, ref) {
var value = props.value,
_props$size = props.size,
size = _props$size === void 0 ? utils_DEFAULT_SIZE : _props$size,
_props$level = props.level,
level = _props$level === void 0 ? DEFAULT_LEVEL : _props$level,
_props$bgColor = props.bgColor,
bgColor = _props$bgColor === void 0 ? DEFAULT_BACKGROUND_COLOR : _props$bgColor,
_props$fgColor = props.fgColor,
fgColor = _props$fgColor === void 0 ? DEFAULT_FRONT_COLOR : _props$fgColor,
_props$includeMargin = props.includeMargin,
includeMargin = _props$includeMargin === void 0 ? DEFAULT_NEED_MARGIN : _props$includeMargin,
_props$minVersion = props.minVersion,
minVersion = _props$minVersion === void 0 ? DEFAULT_MINVERSION : _props$minVersion,
marginSize = props.marginSize,
style = props.style,
imageSettings = props.imageSettings,
boostLevel = props.boostLevel,
otherProps = objectWithoutProperties_objectWithoutProperties(props, QRCodeCanvas_excluded);
var imgSrc = imageSettings === null || imageSettings === void 0 ? void 0 : imageSettings.src;
var _canvas = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
var _image = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
var setCanvasRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useCallback(function (node) {
_canvas.current = node;
if (typeof ref === 'function') {
ref(node);
} else if (ref) {
ref.current = node;
}
}, [ref]);
var _React$useState = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(false),
_React$useState2 = (0,slicedToArray["default"])(_React$useState, 2),
setIsImageLoaded = _React$useState2[1];
var _useQRCode = useQRCode({
value: value,
level: level,
minVersion: minVersion,
includeMargin: includeMargin,
marginSize: marginSize,
imageSettings: imageSettings,
size: size,
boostLevel: boostLevel
}),
margin = _useQRCode.margin,
cells = _useQRCode.cells,
numCells = _useQRCode.numCells,
calculatedImageSettings = _useQRCode.calculatedImageSettings;
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(function () {
if (_canvas.current) {
var canvas = _canvas.current;
var ctx = canvas.getContext('2d');
if (!ctx) {
return;
}
var cellsToDraw = cells;
var image = _image.current;
var haveImageToRender = calculatedImageSettings != null && image !== null && image.complete && image.naturalHeight !== 0 && image.naturalWidth !== 0;
if (haveImageToRender) {
if (calculatedImageSettings.excavation != null) {
cellsToDraw = excavateModules(cells, calculatedImageSettings.excavation);
}
}
var pixelRatio = window.devicePixelRatio || 1;
canvas.height = canvas.width = size * pixelRatio;
var scale = size / numCells * pixelRatio;
ctx.scale(scale, scale);
ctx.fillStyle = bgColor;
ctx.fillRect(0, 0, numCells, numCells);
ctx.fillStyle = fgColor;
if (isSupportPath2d) {
ctx.fill(new Path2D(generatePath(cellsToDraw, margin)));
} else {
cells.forEach(function (row, rdx) {
row.forEach(function (cell, cdx) {
if (cell) {
ctx.fillRect(cdx + margin, rdx + margin, 1, 1);
}
});
});
}
if (calculatedImageSettings) {
ctx.globalAlpha = calculatedImageSettings.opacity;
}
if (haveImageToRender) {
ctx.drawImage(image, calculatedImageSettings.x + margin, calculatedImageSettings.y + margin, calculatedImageSettings.w, calculatedImageSettings.h);
}
}
});
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(function () {
setIsImageLoaded(false);
}, [imgSrc]);
var canvasStyle = (0,objectSpread2["default"])({
height: size,
width: size
}, style);
var img = null;
if (imgSrc != null) {
img = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("img", {
alt: "QR-Code",
src: imgSrc,
key: imgSrc,
style: {
display: 'none'
},
onLoad: function onLoad() {
setIsImageLoaded(true);
},
ref: _image
// when crossOrigin is not set, the image will be tainted
// and the canvas cannot be exported to an image
,
crossOrigin: calculatedImageSettings === null || calculatedImageSettings === void 0 ? void 0 : calculatedImageSettings.crossOrigin
});
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("canvas", (0,esm_extends["default"])({
style: canvasStyle,
height: size,
width: size,
ref: setCanvasRef,
role: "img"
}, otherProps)), img);
});
if (true) {
QRCodeCanvas.displayName = 'QRCodeCanvas';
}
;// ./node_modules/@rc-component/qrcode/es/QRCodeSVG.js
var QRCodeSVG_excluded = ["value", "size", "level", "bgColor", "fgColor", "includeMargin", "minVersion", "title", "marginSize", "imageSettings", "boostLevel"];
var QRCodeSVG = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef(function (props, ref) {
var value = props.value,
_props$size = props.size,
size = _props$size === void 0 ? utils_DEFAULT_SIZE : _props$size,
_props$level = props.level,
level = _props$level === void 0 ? DEFAULT_LEVEL : _props$level,
_props$bgColor = props.bgColor,
bgColor = _props$bgColor === void 0 ? DEFAULT_BACKGROUND_COLOR : _props$bgColor,
_props$fgColor = props.fgColor,
fgColor = _props$fgColor === void 0 ? DEFAULT_FRONT_COLOR : _props$fgColor,
_props$includeMargin = props.includeMargin,
includeMargin = _props$includeMargin === void 0 ? DEFAULT_NEED_MARGIN : _props$includeMargin,
_props$minVersion = props.minVersion,
minVersion = _props$minVersion === void 0 ? DEFAULT_MINVERSION : _props$minVersion,
title = props.title,
marginSize = props.marginSize,
imageSettings = props.imageSettings,
boostLevel = props.boostLevel,
otherProps = objectWithoutProperties_objectWithoutProperties(props, QRCodeSVG_excluded);
var _useQRCode = useQRCode({
value: value,
level: level,
minVersion: minVersion,
includeMargin: includeMargin,
marginSize: marginSize,
imageSettings: imageSettings,
size: size,
boostLevel: boostLevel
}),
margin = _useQRCode.margin,
cells = _useQRCode.cells,
numCells = _useQRCode.numCells,
calculatedImageSettings = _useQRCode.calculatedImageSettings;
var cellsToDraw = cells;
var image = null;
if (imageSettings != null && calculatedImageSettings != null) {
if (calculatedImageSettings.excavation != null) {
cellsToDraw = excavateModules(cells, calculatedImageSettings.excavation);
}
image = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("image", {
href: imageSettings.src,
height: calculatedImageSettings.h,
width: calculatedImageSettings.w,
x: calculatedImageSettings.x + margin,
y: calculatedImageSettings.y + margin,
preserveAspectRatio: "none",
opacity: calculatedImageSettings.opacity
// when crossOrigin is not set, the image will be tainted
// and the canvas cannot be exported to an image
,
crossOrigin: calculatedImageSettings.crossOrigin
});
}
var fgPath = generatePath(cellsToDraw, margin);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", (0,esm_extends["default"])({
height: size,
width: size,
viewBox: "0 0 ".concat(numCells, " ").concat(numCells),
ref: ref,
role: "img"
}, otherProps), !!title && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("title", null, title), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
fill: bgColor,
d: "M0,0 h".concat(numCells, "v").concat(numCells, "H0z"),
shapeRendering: "crispEdges"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
fill: fgColor,
d: fgPath,
shapeRendering: "crispEdges"
}), image);
});
if (true) {
QRCodeSVG.displayName = 'QRCodeSVG';
}
;// ./node_modules/@rc-component/qrcode/es/index.js
;// ./node_modules/@ant-design/icons-svg/es/asn/ReloadOutlined.js
// This icon file is generated automatically.
var ReloadOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z" } }] }, "name": "reload", "theme": "outlined" };
/* harmony default export */ var asn_ReloadOutlined = (ReloadOutlined);
;// ./node_modules/@ant-design/icons/es/icons/ReloadOutlined.js
function ReloadOutlined_extends() { ReloadOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return ReloadOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const ReloadOutlined_ReloadOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], ReloadOutlined_extends({}, props, {
ref: ref,
icon: asn_ReloadOutlined
}));
/** */
const ReloadOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(ReloadOutlined_ReloadOutlined);
if (true) {
ReloadOutlined_RefIcon.displayName = 'ReloadOutlined';
}
/* harmony default export */ var icons_ReloadOutlined = (ReloadOutlined_RefIcon);
;// ./components/qr-code/QrcodeStatus.tsx
const defaultSpin = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(spin, null);
function QRcodeStatus({
prefixCls,
locale,
onRefresh,
statusRender,
status
}) {
const defaultExpiredNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("p", {
className: `${prefixCls}-expired`
}, locale?.expired), onRefresh && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(button_Button, {
type: "link",
icon: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_ReloadOutlined, null),
onClick: onRefresh
}, locale?.refresh)));
const defaultScannedNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("p", {
className: `${prefixCls}-scanned`
}, locale?.scanned);
const defaultNodes = {
expired: defaultExpiredNode,
loading: defaultSpin,
scanned: defaultScannedNode
};
const defaultStatusRender = info => defaultNodes[info.status];
const mergedStatusRender = statusRender ?? defaultStatusRender;
return mergedStatusRender({
status,
locale,
onRefresh
});
}
// EXTERNAL MODULE: ./components/qr-code/style/index.ts
var qr_code_style = __webpack_require__("./components/qr-code/style/index.ts");
;// ./components/qr-code/index.tsx
const QRCode = props => {
const [, token] = (0,useToken["default"])();
const {
value,
type = 'canvas',
icon = '',
size = 160,
iconSize,
color = token.colorText,
errorLevel = 'M',
status = 'active',
bordered = true,
onRefresh,
style,
className,
rootClassName,
prefixCls: customizePrefixCls,
bgColor = 'transparent',
marginSize,
statusRender,
classNames,
styles,
boostLevel /* 👈 5.28.0+ */,
...rest
} = props;
const {
getPrefixCls,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('qrcode');
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
bgColor,
type,
size,
status,
bordered,
errorLevel
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const prefixCls = getPrefixCls('qrcode', customizePrefixCls);
const [hashId, cssVarCls] = (0,qr_code_style["default"])(prefixCls);
const imageSettings = {
src: icon,
x: undefined,
y: undefined,
height: (0,is.isNumber)(iconSize) ? iconSize : iconSize?.height ?? 40,
width: (0,is.isNumber)(iconSize) ? iconSize : iconSize?.width ?? 40,
excavate: true,
crossOrigin: 'anonymous'
};
const a11yProps = (0,pickAttrs["default"])(rest, true);
const restProps = (0,es.omit)(rest, Object.keys(a11yProps));
const qrCodeProps = {
value,
size,
level: errorLevel,
bgColor,
fgColor: color,
style: {
width: style?.width,
height: style?.height
},
imageSettings: icon ? imageSettings : undefined,
marginSize,
boostLevel,
...a11yProps
};
const [locale] = (0,useLocale["default"])('QRCode');
if (true) {
const warning = (0,_util_warning.devUseWarning)('QRCode');
true ? warning(!!value, 'usage', 'need to receive `value` props') : 0;
true ? warning(!(icon && errorLevel === 'L'), 'usage', 'ErrorLevel `L` is not recommended to be used with `icon`, for scanning result would be affected by low level.') : 0;
}
if (!value) {
return null;
}
const rootClassNames = (0,clsx.clsx)(prefixCls, className, rootClassName, hashId, cssVarCls, contextClassName, mergedClassNames.root, {
[`${prefixCls}-borderless`]: !bordered
});
const rootStyle = {
backgroundColor: bgColor,
...mergedStyles.root,
...contextStyle,
...style,
width: style?.width ?? size,
height: style?.height ?? size
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
...restProps,
className: rootClassNames,
style: rootStyle
}, status !== 'active' && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-cover`, mergedClassNames.cover),
style: mergedStyles.cover
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(QRcodeStatus, {
prefixCls: prefixCls,
locale: locale,
status: status,
onRefresh: onRefresh,
statusRender: statusRender
}))), type === 'canvas' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(QRCodeCanvas, {
...qrCodeProps
}) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(QRCodeSVG, {
...qrCodeProps
}));
};
if (true) {
QRCode.displayName = 'QRCode';
}
/* harmony default export */ var qr_code = (QRCode);
;// ./components/radio/index.tsx
const radio_Radio = radio_radio;
radio_Radio.Button = radioButton;
radio_Radio.Group = group;
radio_Radio.__ANT_RADIO = true;
/* harmony default export */ var components_radio = (radio_Radio);
;// ./node_modules/@ant-design/icons-svg/es/asn/StarFilled.js
// This icon file is generated automatically.
var StarFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z" } }] }, "name": "star", "theme": "filled" };
/* harmony default export */ var asn_StarFilled = (StarFilled);
;// ./node_modules/@ant-design/icons/es/icons/StarFilled.js
function StarFilled_extends() { StarFilled_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return StarFilled_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const StarFilled_StarFilled = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], StarFilled_extends({}, props, {
ref: ref,
icon: asn_StarFilled
}));
/** */
const StarFilled_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(StarFilled_StarFilled);
if (true) {
StarFilled_RefIcon.displayName = 'StarFilled';
}
/* harmony default export */ var icons_StarFilled = (StarFilled_RefIcon);
;// ./node_modules/@rc-component/rate/es/Star.js
function Star(props, ref) {
const {
disabled,
prefixCls,
character,
characterRender,
index,
count,
value,
allowHalf,
focused,
onHover,
onClick
} = props;
// =========================== Events ===========================
const onInternalHover = e => {
onHover(e, index);
};
const onInternalClick = e => {
onClick(e, index);
};
const onInternalKeyDown = e => {
if (e.keyCode === KeyCode["default"].ENTER) {
onClick(e, index);
}
};
// =========================== Render ===========================
// >>>>> ClassName
const starValue = index + 1;
const classNameList = new Set([prefixCls]);
// TODO: Current we just refactor from CC to FC. This logic seems can be optimized.
if (value === 0 && index === 0 && focused) {
classNameList.add(`${prefixCls}-focused`);
} else if (allowHalf && value + 0.5 >= starValue && value < starValue) {
classNameList.add(`${prefixCls}-half`);
classNameList.add(`${prefixCls}-active`);
if (focused) {
classNameList.add(`${prefixCls}-focused`);
}
} else {
if (starValue <= value) {
classNameList.add(`${prefixCls}-full`);
} else {
classNameList.add(`${prefixCls}-zero`);
}
if (starValue === value && focused) {
classNameList.add(`${prefixCls}-focused`);
}
}
// >>>>> Node
const characterNode = typeof character === 'function' ? character(props) : character;
let start = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
className: (0,clsx.clsx)(Array.from(classNameList)),
ref: ref
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
onClick: disabled ? null : onInternalClick,
onKeyDown: disabled ? null : onInternalKeyDown,
onMouseMove: disabled ? null : onInternalHover,
role: "radio",
"aria-checked": value > index ? 'true' : 'false',
"aria-posinset": index + 1,
"aria-setsize": count,
tabIndex: disabled ? -1 : 0
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${prefixCls}-first`
}, characterNode), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${prefixCls}-second`
}, characterNode)));
if (characterRender) {
start = characterRender(start, props);
}
return start;
}
/* harmony default export */ var es_Star = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef(Star));
;// ./node_modules/@rc-component/rate/es/useRefs.js
function useRefs_useRefs() {
const nodeRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({});
function getRef(index) {
return nodeRef.current[index];
}
function setRef(index) {
return node => {
nodeRef.current[index] = node;
};
}
return [getRef, setRef];
}
;// ./node_modules/@rc-component/rate/es/util.js
function es_util_getScroll(w) {
let ret = w.pageXOffset;
const method = 'scrollLeft';
if (typeof ret !== 'number') {
const d = w.document;
// ie6,7,8 standard mode
ret = d.documentElement[method];
if (typeof ret !== 'number') {
// quirks mode
ret = d.body[method];
}
}
return ret;
}
function getClientPosition(elem) {
let x;
let y;
const doc = elem.ownerDocument;
const {
body
} = doc;
const docElem = doc && doc.documentElement;
const box = elem.getBoundingClientRect();
x = box.left;
y = box.top;
x -= docElem.clientLeft || body.clientLeft || 0;
y -= docElem.clientTop || body.clientTop || 0;
return {
left: x,
top: y
};
}
function getOffsetLeft(el) {
const pos = getClientPosition(el);
const doc = el.ownerDocument;
// Only IE use `parentWindow`
const w = doc.defaultView || doc.parentWindow;
pos.left += es_util_getScroll(w);
return pos.left;
}
;// ./node_modules/@rc-component/rate/es/Rate.js
function Rate_extends() { Rate_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Rate_extends.apply(this, arguments); }
function Rate(props, ref) {
const {
// Base
prefixCls = 'rc-rate',
className,
// Value
defaultValue,
value: propValue,
count = 5,
allowHalf = false,
allowClear = true,
keyboard = true,
// Display
character = '★',
characterRender,
// Meta
disabled,
direction = 'ltr',
tabIndex = 0,
autoFocus,
// Events
onHoverChange,
onChange,
onFocus,
onBlur,
onKeyDown,
onMouseLeave,
...restProps
} = props;
const [getStarRef, setStarRef] = useRefs_useRefs();
const rateRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
// ============================ Ref =============================
const triggerFocus = () => {
if (!disabled) {
rateRef.current?.focus();
}
};
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useImperativeHandle(ref, () => ({
focus: triggerFocus,
blur: () => {
if (!disabled) {
rateRef.current?.blur();
}
}
}));
// =========================== Value ============================
const [value, setValue] = (0,useControlledState["default"])(defaultValue || 0, propValue);
const [cleanedValue, setCleanedValue] = (0,useControlledState["default"])(null);
const getStarValue = (index, x) => {
const reverse = direction === 'rtl';
let starValue = index + 1;
if (allowHalf) {
const starEle = getStarRef(index);
const leftDis = getOffsetLeft(starEle);
const width = starEle.clientWidth;
if (reverse && x - leftDis > width / 2) {
starValue -= 0.5;
} else if (!reverse && x - leftDis < width / 2) {
starValue -= 0.5;
}
}
return starValue;
};
// >>>>> Change
const changeValue = nextValue => {
setValue(nextValue);
onChange?.(nextValue);
};
// =========================== Focus ============================
const [focused, setFocused] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(false);
const onInternalFocus = () => {
setFocused(true);
onFocus?.();
};
const onInternalBlur = () => {
setFocused(false);
onBlur?.();
};
// =========================== Hover ============================
const [hoverValue, setHoverValue] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(null);
const onHover = (event, index) => {
const nextHoverValue = getStarValue(index, event.pageX);
if (nextHoverValue !== cleanedValue) {
setHoverValue(nextHoverValue);
setCleanedValue(null);
}
onHoverChange?.(nextHoverValue);
};
const onMouseLeaveCallback = event => {
if (!disabled) {
setHoverValue(null);
setCleanedValue(null);
onHoverChange?.(undefined);
}
if (event) {
onMouseLeave?.(event);
}
};
// =========================== Click ============================
const onClick = (event, index) => {
const newValue = getStarValue(index, event.pageX);
let isReset = false;
if (allowClear) {
isReset = newValue === value;
}
onMouseLeaveCallback();
changeValue(isReset ? 0 : newValue);
setCleanedValue(isReset ? newValue : null);
};
const onInternalKeyDown = event => {
const {
keyCode
} = event;
const reverse = direction === 'rtl';
const step = allowHalf ? 0.5 : 1;
if (keyboard) {
if (keyCode === KeyCode["default"].RIGHT && value < count && !reverse) {
changeValue(value + step);
event.preventDefault();
} else if (keyCode === KeyCode["default"].LEFT && value > 0 && !reverse) {
changeValue(value - step);
event.preventDefault();
} else if (keyCode === KeyCode["default"].RIGHT && value > 0 && reverse) {
changeValue(value - step);
event.preventDefault();
} else if (keyCode === KeyCode["default"].LEFT && value < count && reverse) {
changeValue(value + step);
event.preventDefault();
}
}
onKeyDown?.(event);
};
// =========================== Effect ===========================
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(() => {
if (autoFocus && !disabled) {
triggerFocus();
}
}, []);
// =========================== Render ===========================
// >>> Star
const starNodes = new Array(count).fill(0).map((item, index) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_Star, {
ref: setStarRef(index),
index: index,
count: count,
disabled: disabled,
prefixCls: `${prefixCls}-star`,
allowHalf: allowHalf,
value: hoverValue === null ? value : hoverValue,
onClick: onClick,
onHover: onHover,
key: item || index,
character: character,
characterRender: characterRender,
focused: focused
}));
const classString = (0,clsx.clsx)(prefixCls, className, {
[`${prefixCls}-disabled`]: disabled,
[`${prefixCls}-rtl`]: direction === 'rtl'
});
// >>> Node
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("ul", Rate_extends({
className: classString,
onMouseLeave: onMouseLeaveCallback,
tabIndex: disabled ? -1 : tabIndex,
onFocus: disabled ? null : onInternalFocus,
onBlur: disabled ? null : onInternalBlur,
onKeyDown: disabled ? null : onInternalKeyDown,
ref: rateRef
}, (0,pickAttrs["default"])(restProps, {
aria: true,
data: true,
attr: true
})), starNodes);
}
/* harmony default export */ var es_Rate = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef(Rate));
;// ./node_modules/@rc-component/rate/es/index.js
/* harmony default export */ var rate_es = (es_Rate);
// EXTERNAL MODULE: ./components/rate/style/index.ts
var rate_style = __webpack_require__("./components/rate/style/index.ts");
;// ./components/rate/index.tsx
const rate_Rate = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls,
className,
rootClassName,
style,
tooltips,
character = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_StarFilled, null),
disabled: customDisabled,
size,
...rest
} = props;
const characterRender = (node, {
index
}) => {
if (!tooltips) {
return node;
}
const tooltipsItem = tooltips[index];
if ((0,is.isPlainObject)(tooltipsItem)) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_tooltip, {
...tooltipsItem
}, node);
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_tooltip, {
title: tooltipsItem
}, node);
};
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle
} = (0,config_provider_context.useComponentConfig)('rate');
const ratePrefixCls = getPrefixCls('rate', prefixCls);
// Style
const [hashId, cssVarCls] = (0,rate_style["default"])(ratePrefixCls);
const mergedStyle = {
...contextStyle,
...style
};
// ===================== Disabled =====================
const disabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
const mergedDisabled = customDisabled ?? disabled;
// ===================== Size =====================
const mergedSize = (0,useSize["default"])(ctx => size ?? ctx);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(rate_es, {
ref: ref,
character: character,
characterRender: characterRender,
disabled: mergedDisabled,
...rest,
className: (0,clsx.clsx)({
[`${ratePrefixCls}-large`]: mergedSize === 'large',
[`${ratePrefixCls}-small`]: mergedSize === 'small'
}, className, rootClassName, hashId, cssVarCls, contextClassName),
style: mergedStyle,
prefixCls: ratePrefixCls,
direction: direction
});
});
if (true) {
rate_Rate.displayName = 'Rate';
}
/* harmony default export */ var rate = (rate_Rate);
;// ./node_modules/@ant-design/icons-svg/es/asn/WarningFilled.js
// This icon file is generated automatically.
var WarningFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M955.7 856l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zM480 416c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v184c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V416zm32 352a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" } }] }, "name": "warning", "theme": "filled" };
/* harmony default export */ var asn_WarningFilled = (WarningFilled);
;// ./node_modules/@ant-design/icons/es/icons/WarningFilled.js
function WarningFilled_extends() { WarningFilled_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return WarningFilled_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const WarningFilled_WarningFilled = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], WarningFilled_extends({}, props, {
ref: ref,
icon: asn_WarningFilled
}));
/** */
const WarningFilled_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(WarningFilled_WarningFilled);
if (true) {
WarningFilled_RefIcon.displayName = 'WarningFilled';
}
/* harmony default export */ var icons_WarningFilled = (WarningFilled_RefIcon);
;// ./components/result/noFound.tsx
const NoFound = () => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("svg", {
width: "252",
height: "294"
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("title", null, "No Found"), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("g", {
fill: "none",
fillRule: "evenodd"
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("circle", {
cx: "126.75",
cy: "128.1",
r: "126",
fill: "#E4EBF7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("circle", {
cx: "31.55",
cy: "130.8",
r: "8.3",
fill: "#FFF"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#FFF",
d: "m37 134.3 10.5 6m.9 6.2-12.7 10.8",
strokeWidth: "2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M39.9 159.4a5.7 5.7 0 1 1-11.3-1.2 5.7 5.7 0 0 1 11.3 1.2m17.7-16.2a5.7 5.7 0 1 1-11.4-1.1 5.7 5.7 0 0 1 11.4 1.1M99 27h29.8a4.6 4.6 0 1 0 0-9.2H99a4.6 4.6 0 1 0 0 9.2m11.4 18.3h29.8a4.6 4.6 0 0 0 0-9.2h-29.8a4.6 4.6 0 1 0 0 9.2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M112.8 26.9h15.8a4.6 4.6 0 1 0 0 9.1h-15.8a4.6 4.6 0 0 0 0-9.1m71.7 108.8a10 10 0 1 1-19.8-2 10 10 0 0 1 19.8 2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#FFF",
d: "m179.3 141.8 12.6 7.1m1.1 7.6-15.2 13",
strokeWidth: "2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M184.7 170a6.8 6.8 0 1 1-13.6-1.3 6.8 6.8 0 0 1 13.6 1.4m18.6-16.8a6.9 6.9 0 1 1-13.7-1.4 6.9 6.9 0 0 1 13.7 1.4"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#FFF",
d: "M152 192.3a2.2 2.2 0 1 1-4.5 0 2.2 2.2 0 0 1 4.4 0zm73.3-76.2a2.2 2.2 0 1 1-4.5 0 2.2 2.2 0 0 1 4.5 0zm-9 35a2.2 2.2 0 1 1-4.4 0 2.2 2.2 0 0 1 4.5 0zM177 107.6a2.2 2.2 0 1 1-4.4 0 2.2 2.2 0 0 1 4.4 0zm18.4-15.4a2.2 2.2 0 1 1-4.5 0 2.2 2.2 0 0 1 4.5 0zm6.8 88.5a2.2 2.2 0 1 1-4.5 0 2.2 2.2 0 0 1 4.5 0z",
strokeWidth: "2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#FFF",
d: "m214.4 153.3-2 20.2-10.8 6m-28-4.7-6.3 9.8H156l-4.5 6.5m23.5-66v-15.7m46 7.8-13 8-15.2-8V94.4",
strokeWidth: "2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M166.6 66h-4a4.8 4.8 0 0 1-4.7-4.8 4.8 4.8 0 0 1 4.7-4.7h4a4.8 4.8 0 0 1 4.7 4.7 4.8 4.8 0 0 1-4.7 4.7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("circle", {
cx: "204.3",
cy: "30",
r: "29.5",
fill: "#1677ff"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M206 38.4c.5.5.7 1.1.7 2s-.2 1.4-.7 1.9a3 3 0 0 1-2 .7c-.8 0-1.5-.3-2-.8s-.8-1.1-.8-1.9.3-1.4.8-2c.5-.4 1.2-.7 2-.7.7 0 1.4.3 2 .8m4.2-19.5c1.5 1.3 2.2 3 2.2 5.2a7.2 7.2 0 0 1-1.5 4.5l-3 2.7a5 5 0 0 0-1.3 1.7 5.2 5.2 0 0 0-.6 2.4v.5h-4v-.5c0-1.4.1-2.5.6-3.5s1.9-2.5 4.2-4.5l.4-.5a4 4 0 0 0 1-2.6c0-1.2-.4-2-1-2.8-.7-.6-1.6-1-2.9-1-1.5 0-2.6.5-3.3 1.5-.4.5-.6 1-.8 1.9a2 2 0 0 1-2 1.6 2 2 0 0 1-2-2.4c.4-1.6 1-2.8 2.1-3.8a8.5 8.5 0 0 1 6.3-2.3c2.3 0 4.2.6 5.6 2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFB594",
d: "M52 76.1s21.8 5.4 27.3 16c5.6 10.7-6.3 9.2-15.7 5C52.8 92 39 85 52 76"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFC6A0",
d: "m90.5 67.5-.5 2.9c-.7.5-4.7-2.7-4.7-2.7l-1.7.8-1.3-5.7s6.8-4.6 9-5c2.4-.5 9.8 1 10.6 2.3 0 0 1.3.4-2.2.6-3.6.3-5 .5-6.8 3.2l-2.4 3.6"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M128 111.4a36.7 36.7 0 0 0-8.9-15.5c-3.5-3-9.3-2.2-11.3-4.2-1.3-1.2-3.2-1.2-3.2-1.2L87.7 87c-2.3-.4-2.1-.7-6-1.4-1.6-1.9-3-1.1-3-1.1l-7-1.4c-1-1.5-2.5-1-2.5-1l-2.4-.9C65 91.2 59 95 59 95c1.8 1.1 15.7 8.3 15.7 8.3l5.1 37.1s-3.3 5.7 1.4 9.1c0 0 19.9-3.7 34.9-.3 0 0 3-2.6 1-8.8.5-3 1.4-8.3 1.7-11.6.4.7 2 1.9 3.1 3.4 0 0 9.4-7.3 11-14a17 17 0 0 1-2.2-2.4c-.5-.8-.3-2-.7-2.8-.7-1-1.8-1.3-2-1.6"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#CBD1D1",
d: "M101 290s4.4 2 7.4 1c2.9-1 4.6.7 7.1 1.2 2.6.5 6.9 1.1 11.7-1.3 0-5.5-6.9-4-12-6.7-2.5-1.4-3.7-4.7-3.5-8.8h-9.5s-1.2 10.6-1 14.6"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#2B0849",
d: "M101 289.8s2.5 1.3 6.8.7c3-.5 3.7.5 7.4 1 3.8.6 10.8 0 11.9-.9.4 1.1-.4 2-.4 2s-1.5.7-4.8.9c-2 .1-5.8.3-7.6-.5-1.8-1.4-5.2-1.9-5.7-.2-4 1-7.4-.3-7.4-.3l-.1-2.7z"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#A4AABA",
d: "M108.3 276h3.1s0 6.7 4.6 8.6c-4.7.6-8.6-2.3-7.7-8.6"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#CBD1D1",
d: "M57.5 272.4s-2 7.4-4.4 12.3c-1.8 3.7-4.3 7.5 5.4 7.5 6.7 0 9-.5 7.4-6.6-1.5-6.1.3-13.2.3-13.2h-8.7z"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#2B0849",
d: "M51.5 289.8s2 1.2 6.6 1.2c6 0 8.3-1.7 8.3-1.7s.6 1.1-.7 2.2c-1 .8-3.6 1.6-7.4 1.5-4.1 0-5.8-.5-6.7-1.1-.8-.6-.7-1.6-.1-2.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#A4AABA",
d: "M58.4 274.3s0 1.5-.3 3c-.3 1.4-1 3-1.1 4 0 1.2 4.5 1.7 5.1.1.6-1.5 1.3-6.4 2-7.2.6-.9-5-2.2-5.7.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#7BB2F9",
d: "m99.7 278.5 13.3.1s1.3-54.5 1.9-64.4c.5-9.9 3.8-43.4 1-63.1l-12.6-.7-22.8.8-1.2 10c0 .5-.7.8-.7 1.4-.1.5.4 1.3.3 2-2.4 14-6.4 33-8.8 46.6 0 .7-1.2 1-1.4 2.7 0 .3.2 1.5 0 1.8-6.8 18.7-10.9 47.8-14.2 61.9h14.6s2.2-8.6 4-17c2.9-12.9 23.2-85 23.2-85l3-.5 1 46.3s-.2 1.2.4 2c.5.8-.6 1.1-.4 2.3l.4 1.8-1 11.8c-.4 4.8 0 39.2 0 39.2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#648BD8",
d: "M76 221.6c1.2.1 4.1-2 7-5m23.4 8.5s2.7-1 6-3.8",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#648BD8",
d: "M107.3 222.1s2.7-1.1 6-3.9",
strokeLinecap: "round",
strokeLinejoin: "round"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#648BD8",
d: "M74.7 224.8s2.7-.6 6.5-3.4m4.8-69.8c-.2 3.1.3 8.6-4.3 9.2m22-11s0 14-1.4 15.1a15 15 0 0 1-3 2m.5-16.5s0 13-1.2 24.4m-5 1.1s7.3-1.7 9.5-1.7M74.3 206a212 212 0 0 1-1 4.5s-1.4 1.9-1 3.8c.5 2-1 2-5 15.4A353 353 0 0 0 61 257l-.2 1.2m14.9-60.5a321 321 0 0 1-.9 4.8m7.8-50.4-1.2 10.5s-1.1.1-.5 2.2c.1 1.4-2.7 15.8-5.2 30.5m-19.6 79h13.3",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#192064",
d: "M116.2 148.2s-17-3-35.9.2c.2 2.5 0 4.2 0 4.2s14.7-2.8 35.7-.3c.3-2.4.2-4 .2-4"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M106.3 151.2v-5a.8.8 0 0 0-.8-.8h-7.8a.8.8 0 0 0-.8.8v5a.8.8 0 0 0 .8.8h7.8a.8.8 0 0 0 .8-.8"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#192064",
d: "M105.2 150.2v-3a.6.6 0 0 0-.6-.7 94.3 94.3 0 0 0-5.9 0 .7.7 0 0 0-.6.6v3.1a.6.6 0 0 0 .6.7 121.1 121.1 0 0 1 5.8 0c.4 0 .7-.3.7-.7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#648BD8",
d: "M100.3 275.4h12.3m-11.2-4.9.1 6.5m0-12.5a915.8 915.8 0 0 0 0 4.4m-.5-94 .9 44.7s.7 1.6-.2 2.7c-1 1.1 2.4.7.9 2.2-1.6 1.6.9 1.2 0 3.4-.6 1.5-1 21.1-1.1 35.2",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFC6A0",
d: "M46.9 83.4s-.5 6 7.2 5.6c11.2-.7 9.2-9.4 31.5-21.7-.7-2.7-2.4-4.7-2.4-4.7s-11 3-22.6 8c-6.8 3-13.4 6.4-13.7 12.8m57.6 7.7.9-5.4-8.9-11.4-5 5.3-1.8 7.9a.3.3 0 0 0 .1.3c1 .8 6.5 5 14.4 3.5a.3.3 0 0 0 .3-.2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFC6A0",
d: "M94 79.4s-4.6-2.9-2.5-6.9c1.6-3 4.5 1.2 4.5 1.2s.5-3.7 3.1-3.7c.6-1 1.6-4.1 1.6-4.1l13.5 3c0 5.3-2.3 19.5-7.8 20-8.9.6-12.5-9.5-12.5-9.5"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#520038",
d: "M113.9 73.4c2.6-2 3.4-9.7 3.4-9.7s-2.4-.5-6.6-2c-4.7-2.1-12.8-4.8-17.5 1-9.6 3.2-2 19.8-2 19.8l2.7-3s-4-3.3-2-6.3c2-3.5 3.8 1 3.8 1s.7-2.3 3.6-3.3c.4-.7 1-2.6 1.4-3.8a1 1 0 0 1 1.3-.7l11.4 2.6c.5.2.8.7.8 1.2l-.3 3.2z"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#552950",
d: "M105 76c-.1.7-.6 1.1-1 1-.6 0-.9-.6-.8-1.2.1-.6.6-1 1-1 .6 0 .9.7.8 1.3m7.1 1.6c0 .6-.5 1-1 1-.5-.1-.8-.7-.7-1.3 0-.6.5-1 1-1 .5.1.8.7.7 1.3"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#DB836E",
d: "m110.1 74.8-.9 1.7-.3 4.3h-2.2",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#5C2552",
d: "M110.8 74.5s1.8-.7 2.6.5",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#DB836E",
d: "M92.4 74.3s.5-1.1 1.1-.7c.6.4 1.3 1.4.6 2-.8.5.1 1.6.1 1.6",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#5C2552",
d: "M103.3 73s1.8 1 4.1.9",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#DB836E",
d: "M103.7 81.8s2.2 1.2 4.4 1.2m-3.5 1.3s1 .4 1.6.3m-11.5-3.4s2.3 7.4 10.4 7.6",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#E4EBF7",
d: "M81.5 89.4s.4 5.6-5 12.8M69 82.7s-.7 9.2-8.2 14.2m68.6 26s-5.3 7.4-9.4 10.7m-.7-26.3s.5 4.4-2.1 32",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#F2D7AD",
d: "M150 151.2h-49.8a1 1 0 0 1-1-1v-31.7c0-.5.4-1 1-1H150c.6 0 1 .5 1 1v31.7a1 1 0 0 1-1 1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#F4D19D",
d: "M150.3 151.2h-19.9v-33.7h20.8v32.8a1 1 0 0 1-1 1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#F2D7AD",
d: "M123.6 127.9H92.9a.5.5 0 0 1-.4-.8l6.4-9.1c.2-.3.5-.5.8-.5h31.1l-7.2 10.4z"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#CC9B6E",
d: "M123.7 128.4H99.2v-.5h24.2l7.2-10.2.4.3z"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#F4D19D",
d: "M158.3 127.9h-18.7a2 2 0 0 1-1.6-.8l-7.2-9.6h20c.5 0 1 .3 1.2.6l6.7 9a.5.5 0 0 1-.4.8"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#CC9B6E",
d: "M157.8 128.5h-19.3l-7.9-10.5.4-.3 7.7 10.3h19.1zm-27.2 22.2v-8.2h.4v8.2zm-.1-10.9v-21.4h.4l.1 21.4zm-18.6 1.1-.5-.1 1.5-5.2.5.2zm-3.5.2-2.6-3 2.6-3.4.4.3-2.4 3.1 2.4 2.6zm8.2 0-.4-.4 2.4-2.6-2.4-3 .4-.4 2.7 3.4z"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFC6A0",
d: "m154.3 131.9-3.1-2v3.5l-1 .1a85 85 0 0 1-4.8.3c-1.9 0-2.7 2.2 2.2 2.6l-2.6-.6s-2.2 1.3.5 2.3c0 0-1.6 1.2.6 2.6-.6 3.5 5.2 4 7 3.6a6.1 6.1 0 0 0 4.6-5.2 8 8 0 0 0-3.4-7.2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#DB836E",
d: "M153.7 133.6s-6.5.4-8.4.3c-1.8 0-1.9 2.2 2.4 2.3 3.7.2 5.4 0 5.4 0",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#DB836E",
d: "M145.2 135.9c-1.9 1.3.5 2.3.5 2.3s3.5 1 6.8.6m-.6 2.9s-6.3.1-6.7-2.1c-.3-1.4.4-1.4.4-1.4m.5 2.7s-1 3.1 5.5 3.5m-.4-14.5v3.5M52.8 89.3a18 18 0 0 0 13.6-7.8",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#5BA02E",
d: "M168.6 248.3a6.6 6.6 0 0 1-6.7-6.6v-66.5a6.6 6.6 0 1 1 13.3 0v66.5a6.6 6.6 0 0 1-6.6 6.6"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#92C110",
d: "M176.5 247.7a6.6 6.6 0 0 1-6.6-6.7v-33.2a6.6 6.6 0 1 1 13.3 0V241a6.6 6.6 0 0 1-6.7 6.7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#F2D7AD",
d: "M186.4 293.6H159a3.2 3.2 0 0 1-3.2-3.2v-46.1a3.2 3.2 0 0 1 3.2-3.2h27.5a3.2 3.2 0 0 1 3.2 3.2v46.1a3.2 3.2 0 0 1-3.2 3.2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#E4EBF7",
d: "M89 89.5s7.8 5.4 16.6 2.8",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}))));
/* harmony default export */ var noFound = (NoFound);
;// ./components/result/serverError.tsx
const ServerError = () => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("svg", {
width: "254",
height: "294"
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("title", null, "Server Error"), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("g", {
fill: "none",
fillRule: "evenodd"
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#E4EBF7",
d: "M0 128.1v-2C0 56.5 56.3.2 125.7.2h2.1C197.2.3 253.5 56.6 253.5 126v2.1c0 69.5-56.3 125.7-125.7 125.7h-2.1A125.7 125.7 0 0 1 0 128.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M40 132.1a8.3 8.3 0 1 1-16.6-1.7 8.3 8.3 0 0 1 16.6 1.7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#FFF",
d: "m37.2 135.6 10.5 6m1 6.3-12.8 10.8",
strokeWidth: "2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M40.1 160.8a5.7 5.7 0 1 1-11.3-1.1 5.7 5.7 0 0 1 11.3 1.1M58 144.6a5.7 5.7 0 1 1-11.4-1.2 5.7 5.7 0 0 1 11.4 1.2M99.7 27.4h30a4.6 4.6 0 1 0 0-9.2h-30a4.6 4.6 0 0 0 0 9.2M111 46h30a4.6 4.6 0 1 0 0-9.3h-30a4.6 4.6 0 1 0 0 9.3m2.5-18.6h16a4.6 4.6 0 1 0 0 9.3h-16a4.6 4.6 0 0 0 0-9.3m36.7 42.7h-4a4.8 4.8 0 0 1-4.8-4.8 4.8 4.8 0 0 1 4.8-4.8h4a4.8 4.8 0 0 1 4.7 4.8 4.8 4.8 0 0 1-4.7 4.8"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("circle", {
cx: "201.35",
cy: "30.2",
r: "29.7",
fill: "#FF603B"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "m203.6 19.4-.7 15a1.5 1.5 0 0 1-3 0l-.7-15a2.2 2.2 0 1 1 4.4 0m-.3 19.4c.5.5.8 1.1.8 1.9s-.3 1.4-.8 1.9a3 3 0 0 1-2 .7 2.5 2.5 0 0 1-1.8-.7c-.6-.6-.8-1.2-.8-2 0-.7.2-1.3.8-1.8.5-.5 1.1-.7 1.8-.7.8 0 1.5.2 2 .7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFB594",
d: "M119.3 133.3c4.4-.6 3.6-1.2 4-4.8.8-5.2-3-17-8.2-25.1-1-10.7-12.6-11.3-12.6-11.3s4.3 5 4.2 16.2c1.4 5.3.8 14.5.8 14.5s5.3 11.4 11.8 10.5"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M101 91.6s1.4-.6 3.2.6c8 1.4 10.3 6.7 11.3 11.4 1.8 1.2 1.8 2.3 1.8 3.5l1.5 3s-7.2 1.7-11 6.7c-1.3-6.4-6.9-25.2-6.9-25.2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFB594",
d: "m94 90.5 1-5.8-9.2-11.9-5.2 5.6-2.6 9.9s8.4 5 16 2.2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFC6A0",
d: "M83 78.2s-4.6-2.9-2.5-6.9c1.6-3 4.5 1.2 4.5 1.2s.5-3.7 3.2-3.7c.5-1 1.5-4.2 1.5-4.2l13.6 3.2c0 5.2-2.3 19.5-7.9 20-8.9.6-12.5-9.6-12.5-9.6"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#520038",
d: "M103 72.2c2.6-2 3.5-9.7 3.5-9.7s-2.5-.5-6.7-2c-4.7-2.2-12.9-4.9-17.6.9-9.5 4.4-2 20-2 20l2.7-3.1s-4-3.3-2.1-6.3c2.2-3.5 4 1 4 1s.6-2.3 3.5-3.3c.4-.7 1-2.7 1.5-3.8A1 1 0 0 1 91 65l11.5 2.7c.5.1.8.6.8 1.2l-.3 3.2z"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#552950",
d: "M101.2 76.5c0 .6-.6 1-1 1-.5-.1-.9-.7-.8-1.3.1-.6.6-1 1.1-1 .5.1.8.7.7 1.3m-7-1.4c0 .6-.5 1-1 1-.5-.1-.8-.7-.7-1.3 0-.6.6-1 1-1 .5.1.9.7.8 1.3"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#DB836E",
d: "m99.2 73.6-.9 1.7-.3 4.3h-2.2",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#5C2552",
d: "M100 73.3s1.7-.7 2.4.5",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#DB836E",
d: "M81.4 73s.4-1 1-.6c.7.4 1.4 1.4.6 2s.2 1.6.2 1.6",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#5C2552",
d: "M92.3 71.7s1.9 1.1 4.2 1",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#DB836E",
d: "M92.7 80.6s2.3 1.2 4.4 1.2m-3.4 1.4s1 .4 1.5.3M83.7 80s1.8 6.6 9.2 8",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#E4EBF7",
d: "M95.5 91.7s-1 2.8-8.2 2c-7.3-.6-10.3-5-10.3-5",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M78.1 87.5s6.6 5 16.5 2.5c0 0 9.6 1 11.5 5.3 5.4 11.8.6 36.8 0 40 3.5 4-.4 8.4-.4 8.4-15.7-3.5-35.8-.6-35.8-.6-4.9-3.5-1.3-9-1.3-9l-6.2-23.8c-2.5-15.2.8-19.8 3.5-20.7 3-1 8-1.3 8-1.3.6 0 1.1 0 1.4-.2 2.4-1.3 2.8-.6 2.8-.6"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFC6A0",
d: "M65.8 89.8s-6.8.5-7.6 8.2c-.4 8.8 3 11 3 11s6.1 22 16.9 22.9c8.4-2.2 4.7-6.7 4.6-11.4-.2-11.3-7-17-7-17s-4.3-13.7-9.9-13.7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFC6A0",
d: "M71.7 124.2s.9 11.3 9.8 6.5c4.8-2.5 7.6-13.8 9.8-22.6A201 201 0 0 0 94 96l-5-1.7s-2.4 5.6-7.7 12.3c-4.4 5.5-9.2 11.1-9.5 17.7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#E4EBF7",
d: "M108.5 105.2s1.7 2.7-2.4 30.5c2.4 2.2 1 6-.2 7.5",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFC6A0",
d: "M123.3 131.5s-.5 2.8-11.8 2c-15.2-1-25.3-3.2-25.3-3.2l.9-5.8s.7.2 9.7-.1c11.9-.4 18.7-6 25-1 4 3.2 1.5 8.1 1.5 8.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M70.2 91s-5.6-4.8-11 2.7c-3.3 7.2.5 15.2 2.6 19.5-.3 3.8 2.4 4.3 2.4 4.3s0 1 1.5 2.7c4-7 6.7-9.1 13.7-12.5-.3-.7-1.9-3.3-1.8-3.8.2-1.7-1.3-2.6-1.3-2.6s-.3-.2-1.2-2.8c-.8-2.3-2-5.1-4.9-7.5"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#CBD1D1",
d: "M90.2 288s4.9 2.3 8.3 1.2c3.2-1 5.2.7 8 1.3a20 20 0 0 0 13.3-1.4c-.2-6.2-7.8-4.5-13.6-7.6-2.9-1.6-4.2-5.3-4-10H91.5s-1.5 12-1.3 16.5"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#2B0849",
d: "M90.2 287.8s2.8 1.5 7.6.8c3.5-.5 3.3.6 7.5 1.3 4.2.6 13-.2 14.3-1.2.5 1.3-.4 2.4-.4 2.4s-1.7.6-5.4.9c-2.3.1-8.1.3-10.2-.6-2-1.6-4.9-1.5-6-.3-4.5 1.1-7.2-.3-7.2-.3l-.2-3z"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#A4AABA",
d: "M98.4 272.3h3.5s0 7.5 5.2 9.6c-5.3.7-9.7-2.6-8.7-9.6"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#CBD1D1",
d: "M44.4 272s-2.2 7.8-4.7 13c-1.9 3.8-4.4 7.8 5.8 7.8 7 0 9.3-.5 7.7-7-1.6-6.3.3-13.8.3-13.8h-9z"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#2B0849",
d: "M38 290.3s2.3 1.2 7 1.2c6.4 0 8.7-1.7 8.7-1.7s.6 1.1-.7 2.2c-1 1-3.8 1.7-7.7 1.7-4.4 0-6.1-.6-7-1.3-1-.5-.8-1.6-.2-2.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#A4AABA",
d: "M45.3 274s0 1.6-.3 3.1-1.1 3.3-1.2 4.4c0 1.2 4.8 1.6 5.4 0 .7-1.6 1.4-6.8 2-7.6.7-.9-5.1-2.2-5.9.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#7BB2F9",
d: "M89.5 277.6h13.9s1.3-56.6 1.9-66.8c.6-10.3 4-45.1 1-65.6l-13-.7-23.7.8-1.3 10.4c0 .5-.7.9-.8 1.4 0 .6.5 1.4.4 2L59.6 206c-.1.7-1.3 1-1.5 2.8 0 .3.2 1.6.1 1.8-7.1 19.5-12.2 52.6-15.6 67.2h15.1L62 259c3-13.3 24-88.3 24-88.3l3.2-1-.2 48.6s-.2 1.3.4 2.1c.5.8-.6 1.2-.4 2.4l.4 1.8-1 12.4c-.4 4.9 1.2 40.7 1.2 40.7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#648BD8",
d: "M64.6 218.9c1.2 0 4.2-2.1 7.2-5.1m24.2 8.7s3-1.1 6.4-4",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#648BD8",
d: "M97 219.4s2.9-1.2 6.3-4",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#648BD8",
d: "M63.2 222.1s2.7-.6 6.7-3.5m5-72.4c-.3 3.2.3 8.8-4.5 9.4m22.8-11.3s.1 14.6-1.4 15.7c-2.3 1.7-3 2-3 2m.4-17s.3 13-1 25m-4.7.7s6.8-1 9.1-1M46 270l-.9 4.6m1.8-11.3-.8 4.1m16.6-64.9c-.3 1.6 0 2-.4 3.4 0 0-2.8 2-2.3 4s-.3 3.4-4.5 17.2c-1.8 5.8-4.3 19-6.2 28.3l-1.1 5.8m16-67-1 4.9m8.1-52.3-1.2 10.9s-1.2.1-.5 2.3c0 1.4-2.8 16.4-5.4 31.6m-20 82.1h13.9",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#192064",
d: "M106.2 142.1c-3-.5-18.8-2.7-36.2.2a.6.6 0 0 0-.6.7v3a.6.6 0 0 0 .8.6c3.3-.5 17-2.4 35.6-.3.4 0 .7-.2.7-.5.2-1.4.2-2.5.2-3a.6.6 0 0 0-.5-.7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M96.4 145.3v-5.1a.8.8 0 0 0-.8-.9 114.1 114.1 0 0 0-8.1 0 .8.8 0 0 0-.9.8v5.1c0 .5.4.9.9.9h8a.8.8 0 0 0 .9-.8"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#192064",
d: "M95.2 144.3v-3.2a.7.7 0 0 0-.6-.7h-6.1a.7.7 0 0 0-.6.7v3.2c0 .4.3.7.6.7h6c.4 0 .7-.3.7-.7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#648BD8",
d: "M90.1 273.5h12.8m-11.7-3.7v6.3m-.3-12.6v4.5m-.5-97.6 1 46.4s.7 1.6-.3 2.8c-.9 1.1 2.6.7 1 2.3-1.7 1.6.9 1.2 0 3.5-.6 1.6-1 22-1.2 36.5",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#E4EBF7",
d: "M73.7 98.7 76 103s2 .8 1.8 2.7l.8 2.2m-14.3 8.7c.2-1 2.2-7.1 12.6-10.5m.7-16s7.7 6 16.5 2.7",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFC6A0",
d: "M92 87s5.5-.9 7.5-4.6c1.3-.3.8 2.2-.3 3.7l-1 1.5s.2.3.2.9c0 .6-.2.6-.3 1v1l-.4 1c-.1.2 0 .6-.2.9-.2.4-1.6 1.8-2.6 2.8-3.8 3.6-5 1.7-6-.4-1-1.8-.7-5.1-.9-6.9-.3-2.9-2.6-3-2-4.4.4-.7 3 .7 3.4 1.8.7 2 2.9 1.8 2.6 1.7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#DB836E",
d: "M99.8 82.4c-.5.1-.3.3-1 1.3-.6 1-4.8 2.9-6.4 3.2-2.5.5-2.2-1.6-4.2-2.9-1.7-1-3.6-.6-1.4 1.4 1 1 1 1.1 1.4 3.2.3 1.5-.7 3.7.7 5.6",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: ".8"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#E59788",
d: "M79.5 108.7c-2 2.9-4.2 6.1-5.5 8.7",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: ".8"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFC6A0",
d: "M87.7 124.8s-2-2-5.1-2.8c-3-.7-3.6-.1-5.5.1-2 .3-4-.9-3.7.7.3 1.7 5 1 5.2 2.1.2 1.1-6.3 2.8-8.3 2.2-.8.8.5 1.9 2 2.2.3 1.5 2.3 1.5 2.3 1.5s.7 1 2.6 1.1c2.5 1.3 9-.7 11-1.5 2-.9-.5-5.6-.5-5.6"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#E59788",
d: "M73.4 122.8s.7 1.2 3.2 1.4c2.3.3 2.6.6 2.6.6s-2.6 3-9.1 2.3m2.3 2.2s3.8 0 5-.7m-2.4 2.2s2 0 3.3-.6m-1 1.7s1.7 0 2.8-.5m-6.8-9s-.6-1.1 1.3-.5c1.7.5 2.8 0 5.1.1 1.4.1 3-.2 4 .2 1.6.8 3.6 2.2 3.6 2.2s10.6 1.2 19-1.1M79 108s-8.4 2.8-13.2 12.1",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: ".8"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#E4EBF7",
d: "M109.3 112.5s3.4-3.6 7.6-4.6",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#E59788",
d: "M107.4 123s9.7-2.7 11.4-.9",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: ".8"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#BFCDDD",
d: "m194.6 83.7 4-4M187.2 91l3.7-3.6m.9-3-4.5-4.7m11.2 11.5-4.2-4.3m-65 76.3 3.7-3.7M122.3 170l3.5-3.5m.8-2.9-4.3-4.2M133 170l-4-4",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#A3B4C6",
d: "M190.2 211.8h-1.6a4 4 0 0 1-4-4v-32.1a4 4 0 0 1 4-4h1.6a4 4 0 0 1 4 4v32a4 4 0 0 1-4 4"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#A3B4C6",
d: "M237.8 213a4.8 4.8 0 0 1-4.8 4.8h-86.6a4.8 4.8 0 0 1 0-9.6H233a4.8 4.8 0 0 1 4.8 4.8"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#A3B4C6",
d: "M154.1 190.1h70.5v-84.6h-70.5z"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#BFCDDD",
d: "M225 190.1h-71.2a3.2 3.2 0 0 1-3.2-3.2v-19a3.2 3.2 0 0 1 3.2-3.2h71.1a3.2 3.2 0 0 1 3.2 3.2v19a3.2 3.2 0 0 1-3.2 3.2m0-59.3h-71.1a3.2 3.2 0 0 1-3.2-3.2v-19a3.2 3.2 0 0 1 3.2-3.2h71.1a3.2 3.2 0 0 1 3.2 3.3v19a3.2 3.2 0 0 1-3.2 3.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M159.6 120.5a2.4 2.4 0 1 1 0-4.8 2.4 2.4 0 0 1 0 4.8m7.4 0a2.4 2.4 0 1 1 0-4.8 2.4 2.4 0 0 1 0 4.8m7.4 0a2.4 2.4 0 1 1 0-4.8 2.4 2.4 0 0 1 0 4.8m48.1 0h-22.4a.8.8 0 0 1-.8-.8v-3.2c0-.4.3-.8.8-.8h22.4c.5 0 .8.4.8.8v3.2c0 .5-.3.8-.8.8"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#BFCDDD",
d: "M225 160.5h-71.2a3.2 3.2 0 0 1-3.2-3.2v-19a3.2 3.2 0 0 1 3.2-3.2h71.1a3.2 3.2 0 0 1 3.2 3.2v19a3.2 3.2 0 0 1-3.2 3.2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#7C90A5",
d: "M173.5 130.8h49.3m-57.8 0h6m-15 0h6.7m11.1 29.8h49.3m-57.7 0h6m-15.8 0h6.7",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M159.6 151a2.4 2.4 0 1 1 0-4.8 2.4 2.4 0 0 1 0 4.8m7.4 0a2.4 2.4 0 1 1 0-4.8 2.4 2.4 0 0 1 0 4.8m7.4 0a2.4 2.4 0 1 1 0-4.8 2.4 2.4 0 0 1 0 4.8m48.1 0h-22.4a.8.8 0 0 1-.8-.8V147c0-.4.3-.8.8-.8h22.4c.5 0 .8.4.8.8v3.2c0 .5-.3.8-.8.8m-63 29a2.4 2.4 0 1 1 0-4.8 2.4 2.4 0 0 1 0 4.8m7.5 0a2.4 2.4 0 1 1 0-4.8 2.4 2.4 0 0 1 0 4.8m7.4 0a2.4 2.4 0 1 1 0-4.8 2.4 2.4 0 0 1 0 4.8m48.1 0h-22.4a.8.8 0 0 1-.8-.8V176c0-.5.3-.8.8-.8h22.4c.5 0 .8.3.8.8v3.2c0 .4-.3.8-.8.8"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#BFCDDD",
d: "M203 221.1h-27.3a2.4 2.4 0 0 1-2.4-2.4v-11.4a2.4 2.4 0 0 1 2.4-2.5H203a2.4 2.4 0 0 1 2.4 2.5v11.4a2.4 2.4 0 0 1-2.4 2.4"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#A3B4C6",
d: "M177.3 207.2v11.5m23.8-11.5v11.5",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#5BA02E",
d: "M162.9 267.9a9.4 9.4 0 0 1-9.4-9.4v-14.8a9.4 9.4 0 0 1 18.8 0v14.8a9.4 9.4 0 0 1-9.4 9.4"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#92C110",
d: "M171.2 267.8a9.4 9.4 0 0 1-9.4-9.4V255a9.4 9.4 0 0 1 18.8 0v3.4a9.4 9.4 0 0 1-9.4 9.4"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#F2D7AD",
d: "M181.3 293.7h-27.7a3.2 3.2 0 0 1-3.2-3.2v-20.7a3.2 3.2 0 0 1 3.2-3.2h27.7a3.2 3.2 0 0 1 3.2 3.2v20.7a3.2 3.2 0 0 1-3.2 3.2"
}))));
/* harmony default export */ var serverError = (ServerError);
// EXTERNAL MODULE: ./components/result/style/index.ts
var result_style = __webpack_require__("./components/result/style/index.ts");
;// ./components/result/unauthorized.tsx
const Unauthorized = () => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("svg", {
width: "251",
height: "294"
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("title", null, "Unauthorized"), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("g", {
fill: "none",
fillRule: "evenodd"
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#E4EBF7",
d: "M0 129v-2C0 58.3 55.6 2.7 124.2 2.7h2c68.6 0 124.2 55.6 124.2 124.1v2.1c0 68.6-55.6 124.2-124.1 124.2h-2.1A124.2 124.2 0 0 1 0 129"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M41.4 133a8.2 8.2 0 1 1-16.4-1.7 8.2 8.2 0 0 1 16.4 1.6"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#FFF",
d: "m38.7 136.4 10.4 5.9m.9 6.2-12.6 10.7",
strokeWidth: "2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M41.5 161.3a5.6 5.6 0 1 1-11.2-1.2 5.6 5.6 0 0 1 11.2 1.2m17.7-16a5.7 5.7 0 1 1-11.3-1.2 5.7 5.7 0 0 1 11.3 1.2m41.2-115.8H130a4.6 4.6 0 1 0 0-9.1h-29.6a4.6 4.6 0 0 0 0 9.1m11.3 18.3h29.7a4.6 4.6 0 1 0 0-9.2h-29.7a4.6 4.6 0 1 0 0 9.2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M114 29.5h15.8a4.6 4.6 0 1 0 0 9.1H114a4.6 4.6 0 0 0 0-9.1m71.3 108.2a10 10 0 1 1-19.8-2 10 10 0 0 1 19.8 2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#FFF",
d: "m180.2 143.8 12.5 7.1m1.1 7.5-15.1 13",
strokeWidth: "2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M185.6 172a6.8 6.8 0 1 1-13.6-1.4 6.8 6.8 0 0 1 13.5 1.3m18.6-16.6a6.8 6.8 0 1 1-13.6-1.4 6.8 6.8 0 0 1 13.6 1.4"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#FFF",
d: "M153 194a2.2 2.2 0 1 1-4.4 0 2.2 2.2 0 0 1 4.4 0zm73-75.8a2.2 2.2 0 1 1-4.5 0 2.2 2.2 0 0 1 4.4 0zm-9 34.9a2.2 2.2 0 1 1-4.3 0 2.2 2.2 0 0 1 4.4 0zm-39.2-43.3a2.2 2.2 0 1 1-4.4 0 2.2 2.2 0 0 1 4.4 0zm18.3-15.3a2.2 2.2 0 1 1-4.4 0 2.2 2.2 0 0 1 4.4 0zm6.7 88a2.2 2.2 0 1 1-4.4 0 2.2 2.2 0 0 1 4.4 0z",
strokeWidth: "2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#FFF",
d: "m215.1 155.3-1.9 20-10.8 6m-27.8-4.7-6.3 9.8H157l-4.5 6.4m23.4-65.5v-15.7m45.6 7.8-12.8 7.9-15.2-7.9V96.7",
strokeWidth: "2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#A26EF4",
d: "M180.7 29.3a29.3 29.3 0 1 1 58.6 0 29.3 29.3 0 0 1-58.6 0"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "m221.4 41.7-21.5-.1a1.7 1.7 0 0 1-1.7-1.8V27.6a1.7 1.7 0 0 1 1.8-1.7h21.5c1 0 1.8.9 1.8 1.8l-.1 12.3a1.7 1.7 0 0 1-1.7 1.7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M215.1 29.2c0 2.6-2 4.6-4.5 4.6a4.6 4.6 0 0 1-4.5-4.7v-6.9c0-2.6 2-4.6 4.6-4.6 2.5 0 4.5 2 4.4 4.7v6.9zm-4.5-14a6.9 6.9 0 0 0-7 6.8v7.3a6.9 6.9 0 0 0 13.8.1V22a6.9 6.9 0 0 0-6.8-6.9zm-43 53.2h-4a4.7 4.7 0 0 1-4.7-4.8 4.7 4.7 0 0 1 4.7-4.7h4a4.7 4.7 0 0 1 4.7 4.8 4.7 4.7 0 0 1-4.7 4.7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#5BA02E",
d: "M168.2 248.8a6.6 6.6 0 0 1-6.6-6.6v-66a6.6 6.6 0 0 1 13.2 0v66a6.6 6.6 0 0 1-6.6 6.6"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#92C110",
d: "M176.1 248.2a6.6 6.6 0 0 1-6.6-6.6v-33a6.6 6.6 0 1 1 13.3 0v33a6.6 6.6 0 0 1-6.7 6.6"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#F2D7AD",
d: "M186 293.9h-27.4a3.2 3.2 0 0 1-3.2-3.2v-45.9a3.2 3.2 0 0 1 3.2-3.1H186a3.2 3.2 0 0 1 3.2 3.1v46a3.2 3.2 0 0 1-3.2 3"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M82 147.7s6.3-1 17.5-1.3c11.8-.4 17.6 1 17.6 1s3.7-3.8 1-8.3c1.3-12.1 6-32.9.3-48.3-1.1-1.4-3.7-1.5-7.5-.6-1.4.3-7.2-.2-8-.1l-15.3-.4-8-.5c-1.6-.1-4.3-1.7-5.5-.3-.4.4-2.4 5.6-2 16l8.7 35.7s-3.2 3.6 1.2 7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFC6A0",
d: "m75.8 73.3-1-6.4 12-6.5s7.4-.1 8 1.2c.8 1.3-5.5 1-5.5 1s-1.9 1.4-2.6 2.5c-1.7 2.4-1 6.5-8.4 6-1.7.3-2.5 2.2-2.5 2.2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFB594",
d: "M52.4 77.7S66.7 87 77.4 92c1 .5-2 16.2-11.9 11.8-7.4-3.3-20.1-8.4-21.5-14.5-.7-3.2 2.6-7.6 8.4-11.7M142 80s-6.7 3-13.9 6.9c-3.9 2.1-10.1 4.7-12.3 8-6.2 9.3 3.5 11.2 13 7.5 6.6-2.7 29-12.1 13.2-22.4"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFC6A0",
d: "m76.2 66.4 3 3.8S76.4 73 73 76c-7 6.2-12.8 14.3-16 16.4-4 2.7-9.7 3.3-12.2 0-3.5-5.1.5-14.7 31.5-26"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M64.7 85.1s-2.4 8.4-9 14.5c.7.5 18.6 10.5 22.2 10 5.2-.6 6.4-19 1.2-20.5-.8-.2-6-1.3-8.9-2.2-.9-.2-1.6-1.7-3.5-1l-2-.8zm63.7.7s5.3 2 7.3 13.8c-.6.2-17.6 12.3-21.8 7.8-6.6-7-.8-17.4 4.2-18.6 4.7-1.2 5-1.4 10.3-3"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#E4EBF7",
d: "M78.2 94.7s.9 7.4-5 13",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#E4EBF7",
d: "M87.4 94.7s3.1 2.6 10.3 2.6c7.1 0 9-3.5 9-3.5",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: ".9"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFC6A0",
d: "m117.2 68.6-6.8-6.1s-5.4-4.4-9.2-1c-3.9 3.5 4.4 2.2 5.6 4.2 1.2 2.1.9 1.2-2 .5-5.7-1.4-2.1.9 3 5.3 2 1.9 7 1 7 1l2.4-3.9z"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFB594",
d: "m105.3 91.3-.3-11H89l-.5 10.5c0 .4.2.8.6 1 2 1.3 9.3 5 15.8.4.2-.2.4-.5.4-.9"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#5C2552",
d: "M107.6 74.2c.8-1.1 1-9 1-11.9a1 1 0 0 0-1-1l-4.6-.4c-7.7-1-17 .6-18.3 6.3-5.4 5.9-.4 13.3-.4 13.3s2 3.5 4.3 6.8c.8 1 .4-3.8 3-6a47.9 47.9 0 0 1 16-7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFC6A0",
d: "M88.4 83.2s2.7 6.2 11.6 6.5c7.8.3 9-7 7.5-17.5l-1-5.5c-6-2.9-15.4.6-15.4.6s-.6 2-.2 5.5c-2.3 2-1.8 5.6-1.8 5.6s-1-2-2-2.3c-.9-.3-2 0-2.3 2-1 4.6 3.6 5.1 3.6 5.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#DB836E",
d: "m100.8 77.1 1.7-1-1-4.3.7-1.4",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#552950",
d: "M105.5 74c0 .8-.4 1.4-1 1.4-.4 0-.8-.7-.8-1.4s.5-1.2 1-1.2.9.6.8 1.3m-8 .2c0 .8-.4 1.3-.9 1.3s-.9-.6-.9-1.3c0-.7.5-1.3 1-1.3s1 .6.9 1.3"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#DB836E",
d: "M91.1 86.8s5.3 5 12.7 2.3",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#DB836E",
d: "M99.8 81.9s-3.6.2-1.5-2.8c1.6-1.5 5-.4 5-.4s1 3.9-3.5 3.2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#5C2552",
d: "M102.9 70.6s2.5.8 3.4.7m-12.4.7s2.5-1.2 4.8-1.1",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.5"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#DB836E",
d: "M86.3 77.4s1 .9 1.5 2c-.4.6-1 1.2-.3 1.9m11.8 2.4s2 .2 2.5-.2",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#E4EBF7",
d: "m87.8 115.8 15.7-3m-3.3 3 10-2m-43.7-27s-1.6 8.8-6.7 14M128.3 88s3 4 4 11.7",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#DB836E",
d: "M64 84.8s-6 10-13.5 10",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: ".8"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFC6A0",
d: "m112.4 66-.2 5.2 12 9.2c4.5 3.6 8.9 7.5 11 8.7 4.8 2.8 8.9 3.3 11 1.8 4.1-2.9 4.4-9.9-8.1-15.3-4.3-1.8-16.1-6.3-25.7-9.7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#DB836E",
d: "M130.5 85.5s4.6 5.7 11.7 6.2",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: ".8"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#E4EBF7",
d: "M121.7 105.7s-.4 8.6-1.3 13.6",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#648BD8",
d: "M115.8 161.5s-3.6-1.5-2.7-7.1",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#CBD1D1",
d: "M101.5 290.2s4.3 2.1 7.4 1c2.9-.9 4.6.7 7.2 1.3 2.5.5 6.9 1 11.7-1.3 0-5.6-7-4-12-6.8-2.6-1.4-3.8-4.7-3.6-8.8h-9.5s-1.4 10.6-1.2 14.6"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#2B0849",
d: "M101.5 290s2.4 1.4 6.8.7c3-.4 3.7.5 7.5 1 3.7.6 10.8 0 11.9-.8.4 1-.4 2-.4 2s-1.5.7-4.8.9c-2 .1-5.8.3-7.7-.5-1.8-1.4-5.2-2-5.7-.3-4 1-7.4-.3-7.4-.3l-.2-2.6z"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#A4AABA",
d: "M108.8 276.2h3.1s0 6.7 4.6 8.6c-4.7.6-8.6-2.3-7.7-8.6"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#CBD1D1",
d: "M57.6 272.5s-2 7.5-4.5 12.4c-1.8 3.7-4.2 7.6 5.5 7.6 6.7 0 9-.5 7.5-6.7-1.5-6.1.3-13.3.3-13.3h-8.8z"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#2B0849",
d: "M51.5 290s2.2 1.2 6.7 1.2c6.1 0 8.3-1.6 8.3-1.6s.6 1-.6 2.1c-1 .9-3.6 1.6-7.4 1.6-4.2 0-6-.6-6.8-1.2-.9-.5-.7-1.6-.2-2"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#A4AABA",
d: "M58.5 274.4s0 1.6-.3 3-1 3.1-1.1 4.2c0 1.1 4.5 1.5 5.2 0 .6-1.6 1.3-6.5 1.9-7.3.6-.8-5-2.1-5.7.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#7BB2F9",
d: "m100.9 277 13.3.1s1.3-54.2 1.8-64c.6-9.9 3.8-43.2 1-62.8l-12.4-.7-22.8.8-1.2 10c0 .4-.6.8-.7 1.3 0 .6.4 1.3.3 2-2.3 14-6.3 32.9-8.7 46.4-.1.6-1.2 1-1.4 2.6 0 .3.2 1.6 0 1.8-6.8 18.7-10.8 47.6-14.1 61.6h14.5s2.2-8.6 4-17a3984 3984 0 0 1 23-84.5l3-.5 1 46.1s-.2 1.2.4 2c.5.8-.6 1.1-.4 2.3l.4 1.7-1 11.9c-.4 4.6 0 39 0 39"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#648BD8",
d: "M77.4 220.4c1.2.1 4-2 7-4.9m23.1 8.4s2.8-1 6.1-3.8",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#648BD8",
d: "M108.5 221s2.7-1.2 6-4",
strokeLinecap: "round",
strokeLinejoin: "round"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#648BD8",
d: "M76.1 223.6s2.6-.6 6.5-3.4m4.7-69.4c-.2 3.1.3 8.5-4.3 9m21.8-10.7s.1 14-1.3 15c-2.2 1.6-3 1.9-3 1.9m.5-16.4s0 12.8-1.2 24.3m-4.9 1s7.2-1.6 9.4-1.6m-28.6 31.5-1 4.5s-1.5 1.8-1 3.7c.4 2-1 2-5 15.3-1.7 5.6-4.4 18.5-6.3 27.5l-4 18.4M77 196.7a313.3 313.3 0 0 1-.8 4.8m7.7-50-1.2 10.3s-1 .2-.5 2.3c.1 1.3-2.6 15.6-5.1 30.2M57.6 273h13.2",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#192064",
d: "M117.4 147.4s-17-3-35.7.2v4.2s14.6-2.9 35.5-.4l.2-4"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#FFF",
d: "M107.5 150.4v-5a.8.8 0 0 0-.8-.7H99a.8.8 0 0 0-.7.8v4.8c0 .5.3.9.8.8a140.8 140.8 0 0 1 7.7 0 .8.8 0 0 0 .8-.7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
fill: "#192064",
d: "M106.4 149.4v-3a.6.6 0 0 0-.6-.7 94.1 94.1 0 0 0-5.8 0 .6.6 0 0 0-.7.7v3c0 .4.3.7.7.7h5.7c.4 0 .7-.3.7-.7"
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
stroke: "#648BD8",
d: "M101.5 274h12.3m-11.1-5v6.5m0-12.4v4.3m-.5-93.4.9 44.4s.7 1.6-.2 2.7c-1 1.1 2.4.7.9 2.2-1.6 1.6.9 1.1 0 3.4-.6 1.5-1 21-1.1 35",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.1"
}))));
/* harmony default export */ var unauthorized = (Unauthorized);
;// ./components/result/index.tsx
const IconMap = {
success: icons_CheckCircleFilled,
error: icons_CloseCircleFilled,
info: icons_ExclamationCircleFilled,
warning: icons_WarningFilled
};
const ExceptionMap = {
'404': noFound,
'500': serverError,
'403': unauthorized
};
// ExceptionImageMap keys
const ExceptionStatus = Object.keys(ExceptionMap);
const result_Icon = ({
icon,
status,
className,
style
}) => {
if (true) {
const warning = (0,_util_warning.devUseWarning)('Result');
true ? warning(!(typeof icon === 'string' && icon.length > 2), 'breaking', `\`icon\` is using ReactNode instead of string naming in v4. Please check \`${icon}\` at https://ant.design/components/icon`) : 0;
}
if (ExceptionStatus.includes(`${status}`)) {
const SVGComponent = ExceptionMap[status];
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: className,
style: style
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(SVGComponent, null));
}
const iconNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(IconMap[status]);
if (icon === null || icon === false) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: className,
style: style
}, icon || iconNode);
};
const Extra = ({
className,
extra,
style
}) => {
if (!extra) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: className,
style: style
}, extra);
};
const Result = props => {
const {
prefixCls: customizePrefixCls,
className: customizeClassName,
rootClassName,
subTitle,
title,
style,
children,
status = 'info',
icon,
extra,
styles,
classNames,
...rest
} = props;
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('result');
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
status
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const prefixCls = getPrefixCls('result', customizePrefixCls);
// Style
const [hashId, cssVarCls] = (0,result_style["default"])(prefixCls);
const rootClassNames = (0,clsx.clsx)(prefixCls, `${prefixCls}-${status}`, customizeClassName, contextClassName, rootClassName, {
[`${prefixCls}-rtl`]: direction === 'rtl'
}, hashId, cssVarCls, mergedClassNames.root);
const titleClassNames = (0,clsx.clsx)(`${prefixCls}-title`, mergedClassNames.title);
const subTitleClassNames = (0,clsx.clsx)(`${prefixCls}-subtitle`, mergedClassNames.subTitle);
const extraClassNames = (0,clsx.clsx)(`${prefixCls}-extra`, mergedClassNames.extra);
const bodyClassNames = (0,clsx.clsx)(`${prefixCls}-body`, mergedClassNames.body);
const iconClassNames = (0,clsx.clsx)(`${prefixCls}-icon`, {
[`${prefixCls}-image`]: ExceptionStatus.includes(`${status}`)
}, mergedClassNames.icon);
const rootStyles = {
...mergedStyles.root,
...contextStyle,
...style
};
const restProps = (0,pickAttrs["default"])(rest, {
aria: true,
data: true
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
...restProps,
className: rootClassNames,
style: rootStyles
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(result_Icon, {
className: iconClassNames,
style: mergedStyles.icon,
status: status,
icon: icon
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: titleClassNames,
style: mergedStyles.title
}, title), subTitle && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: subTitleClassNames,
style: mergedStyles.subTitle
}, subTitle)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Extra, {
className: extraClassNames,
extra: extra,
style: mergedStyles.extra
}), children && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: bodyClassNames,
style: mergedStyles.body
}, children)));
};
Result.PRESENTED_IMAGE_403 = ExceptionMap['403'];
Result.PRESENTED_IMAGE_404 = ExceptionMap['404'];
Result.PRESENTED_IMAGE_500 = ExceptionMap['500'];
if (true) {
Result.displayName = 'Result';
}
/* harmony default export */ var result = (Result);
;// ./components/row/index.tsx
/* harmony default export */ var components_row = (row);
;// ./components/splitter/Panel.tsx
const InternalPanel = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)((props, ref) => {
const {
prefixCls,
className,
children,
size,
style = {}
} = props;
const panelClassName = (0,clsx.clsx)(`${prefixCls}-panel`, {
[`${prefixCls}-panel-hidden`]: size === 0
}, className);
const hasSize = size !== undefined;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
ref: ref,
className: panelClassName,
style: {
...style,
// Use auto when start from ssr
flexBasis: hasSize ? size : 'auto',
flexGrow: hasSize ? 0 : 1
}
}, children);
});
if (true) {
InternalPanel.displayName = 'Panel';
}
const splitter_Panel_Panel = () => null;
/* harmony default export */ var splitter_Panel = (splitter_Panel_Panel);
;// ./components/splitter/hooks/useItems.ts
function getCollapsible(collapsible) {
if ((0,is.isPlainObject)(collapsible)) {
return {
...collapsible,
showCollapsibleIcon: collapsible.showCollapsibleIcon === undefined ? 'auto' : collapsible.showCollapsibleIcon
};
}
const mergedCollapsible = !!collapsible;
return {
start: mergedCollapsible,
end: mergedCollapsible,
showCollapsibleIcon: 'auto'
};
}
/**
* Convert `children` into `items`.
*/
function hooks_useItems_useItems(children) {
const items = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => (0,es.toArray)(children).filter(item => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(item)).map(node => {
const {
props
} = node;
const {
collapsible,
...restProps
} = props;
return {
...restProps,
collapsible: getCollapsible(collapsible)
};
}), [children]);
return items;
}
/* harmony default export */ var hooks_useItems = (hooks_useItems_useItems);
;// ./components/splitter/hooks/useResizable.ts
function getShowCollapsibleIcon(prev, next) {
if (prev.collapsible && next.collapsible) {
if (prev.showCollapsibleIcon === true || next.showCollapsibleIcon === true) {
return true;
}
if (prev.showCollapsibleIcon === 'auto' || next.showCollapsibleIcon === 'auto') {
return 'auto';
}
return false;
}
if (prev.collapsible) {
return prev.showCollapsibleIcon;
}
if (next.collapsible) {
return next.showCollapsibleIcon;
}
return false;
}
function useResizable(items, pxSizes, reverse) {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const resizeInfos = [];
for (let i = 0; i < items.length - 1; i += 1) {
const prevItem = items[i];
const nextItem = items[i + 1];
const prevSize = pxSizes[i];
const nextSize = pxSizes[i + 1];
const {
resizable: prevResizable = true,
min: prevMin,
collapsible: prevCollapsible
} = prevItem;
const {
resizable: nextResizable = true,
min: nextMin,
collapsible: nextCollapsible
} = nextItem;
const mergedResizable =
// Both need to be resizable
prevResizable && nextResizable && (
// Prev is not collapsed and limit min size
prevSize !== 0 || !prevMin) && (
// Next is not collapsed and limit min size
nextSize !== 0 || !nextMin);
const prevEndCollapsible = !!prevCollapsible.end && prevSize > 0;
const nextStartExpandable = !!nextCollapsible.start && nextSize === 0 && prevSize > 0;
const startCollapsible = prevEndCollapsible || nextStartExpandable;
const nextStartCollapsible = !!nextCollapsible.start && nextSize > 0;
const prevEndExpandable = !!prevCollapsible.end && prevSize === 0 && nextSize > 0;
const endCollapsible = nextStartCollapsible || prevEndExpandable;
const showStartCollapsibleIcon = getShowCollapsibleIcon({
collapsible: prevEndCollapsible,
showCollapsibleIcon: prevCollapsible.showCollapsibleIcon
}, {
collapsible: nextStartExpandable,
showCollapsibleIcon: nextCollapsible.showCollapsibleIcon
});
const showEndCollapsibleIcon = getShowCollapsibleIcon({
collapsible: nextStartCollapsible,
showCollapsibleIcon: nextCollapsible.showCollapsibleIcon
}, {
collapsible: prevEndExpandable,
showCollapsibleIcon: prevCollapsible.showCollapsibleIcon
});
resizeInfos[i] = {
resizable: mergedResizable,
startCollapsible: !!(reverse ? endCollapsible : startCollapsible),
endCollapsible: !!(reverse ? startCollapsible : endCollapsible),
showStartCollapsibleIcon: reverse ? showEndCollapsibleIcon : showStartCollapsibleIcon,
showEndCollapsibleIcon: reverse ? showStartCollapsibleIcon : showEndCollapsibleIcon
};
}
return resizeInfos;
}, [pxSizes, items, reverse]);
}
;// ./components/splitter/hooks/sizeUtil.ts
function autoPtgSizes(ptgSizes, minPtgSizes, maxPtgSizes) {
// Static current data
let currentTotalPtg = 0;
const undefinedIndexes = [];
ptgSizes.forEach((size, index) => {
if (size === undefined) {
undefinedIndexes.push(index);
} else {
currentTotalPtg += size;
}
});
const restPtg = 1 - currentTotalPtg;
const undefinedCount = undefinedIndexes.length;
// If all sizes are defined but don't sum to 1, scale them.
if (ptgSizes.length && !undefinedIndexes.length && currentTotalPtg !== 1) {
// Handle the case when all sizes are 0
if (currentTotalPtg === 0) {
const avg = 1 / ptgSizes.length;
return ptgSizes.map(() => avg);
}
const scale = 1 / currentTotalPtg;
// We know `size` is a number here because undefinedIndexes is empty.
return ptgSizes.map(size => size * scale);
}
// Fill if exceed
if (restPtg < 0) {
const scale = 1 / currentTotalPtg;
return ptgSizes.map(size => size === undefined ? 0 : size * scale);
}
// Check if limit exists
let sumMin = 0;
let sumMax = 0;
let limitMin = 0;
let limitMax = 1;
for (const index of undefinedIndexes) {
const min = minPtgSizes[index] || 0;
const max = maxPtgSizes[index] || 1;
sumMin += min;
sumMax += max;
limitMin = Math.max(limitMin, min);
limitMax = Math.min(limitMax, max);
}
// Impossible case, just average fill
if (sumMin > 1 && sumMax < 1) {
const avg = 1 / undefinedCount;
return ptgSizes.map(size => size === undefined ? avg : size);
}
// Quickly fill if can
const restAvg = restPtg / undefinedCount;
if (limitMin <= restAvg && restAvg <= limitMax) {
return ptgSizes.map(size => size === undefined ? restAvg : size);
}
// Greedy algorithm
const result = (0,toConsumableArray["default"])(ptgSizes);
let remain = restPtg - sumMin;
for (let i = 0; i < undefinedCount; i += 1) {
const index = undefinedIndexes[i];
const min = minPtgSizes[index] || 0;
const max = maxPtgSizes[index] || 1;
result[index] = min;
const canAdd = max - min;
const add = Math.min(canAdd, remain);
result[index] += add;
remain -= add;
}
return result;
}
;// ./components/splitter/hooks/useSizes.ts
function getPtg(str) {
return Number(str.slice(0, -1)) / 100;
}
function isPtg(itemSize) {
return typeof itemSize === 'string' && itemSize.endsWith('%');
}
/**
* Save the size state.
* Align the size into flex percentage base.
*/
function useSizes(items, containerSize) {
const propSizes = items.map(item => item.size);
const itemsCount = items.length;
const mergedContainerSize = containerSize || 0;
const ptg2px = ptg => ptg * mergedContainerSize;
// We do not need care the size state match the `items` length in `useState`.
// It will calculate later.
const [innerSizes, setInnerSizes] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(() => items.map(item => item.defaultSize));
const sizes = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
// If any panel has a `size` passed as a prop, use `propSizes` and calculate all other panel sizes that don't have a `size` defined by the prop.
// If no panel has received a value for the `size` prop, use `innerSizes`.
return propSizes.some(is.isNonNullable) ? propSizes : innerSizes;
}, [itemsCount, innerSizes, propSizes]);
const postPercentMinSizes = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => items.map(item => {
if (isPtg(item.min)) {
return getPtg(item.min);
}
return (item.min || 0) / mergedContainerSize;
}), [items, mergedContainerSize]);
const postPercentMaxSizes = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => items.map(item => {
if (isPtg(item.max)) {
return getPtg(item.max);
}
return (item.max || mergedContainerSize) / mergedContainerSize;
}), [items, mergedContainerSize]);
// Post handle the size. Will do:
// 1. Convert all the px into percentage if not empty.
// 2. Get rest percentage for exist percentage.
// 3. Fill the rest percentage into empty item.
const postPercentSizes = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
const ptgList = [];
// Fill default percentage
for (let i = 0; i < itemsCount; i += 1) {
const itemSize = sizes[i];
if (isPtg(itemSize)) {
ptgList[i] = getPtg(itemSize);
} else if (itemSize || itemSize === 0) {
const num = Number(itemSize);
if (!Number.isNaN(num)) {
ptgList[i] = num / mergedContainerSize;
}
} else {
ptgList[i] = undefined;
}
}
// Use autoPtgSizes to handle the undefined sizes
return autoPtgSizes(ptgList, postPercentMinSizes, postPercentMaxSizes);
}, [itemsCount, sizes, mergedContainerSize, postPercentMinSizes, postPercentMaxSizes]);
const postPxSizes = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => postPercentSizes.map(ptg2px), [postPercentSizes, mergedContainerSize]);
// If ssr, we will use the size from developer config first.
const panelSizes = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => containerSize ? postPxSizes : sizes, [postPxSizes, sizes, containerSize]);
return [panelSizes, postPxSizes, postPercentSizes, postPercentMinSizes, postPercentMaxSizes, setInnerSizes];
}
;// ./components/splitter/hooks/useResize.ts
/**
* Handle user drag resize logic.
*/
function useResize(items, resizableInfos, percentSizes, containerSize, updateSizes, reverse) {
const limitSizes = items.map(item => [item.min, item.max]);
const mergedContainerSize = containerSize || 0;
const ptg2px = ptg => ptg * mergedContainerSize;
// ======================== Resize ========================
function getLimitSize(str, defaultLimit) {
if (typeof str === 'string') {
return ptg2px(getPtg(str));
}
return str ?? defaultLimit;
}
// Real px sizes
const [cacheSizes, setCacheSizes] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([]);
const cacheCollapsedSizeRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef([]);
/**
* When start drag, check the direct is `start` or `end`.
* This will handle when 2 splitter bar are in the same position.
*/
const [movingIndex, setMovingIndex] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
const getPxSizes = () => percentSizes.map(ptg2px);
const onOffsetStart = index => {
setCacheSizes(getPxSizes());
setMovingIndex({
index,
confirmed: false
});
};
const onOffsetUpdate = (index, offset) => {
// First time trigger move index update is not sync in the state
let confirmedIndex = null;
// We need to know what the real index is.
if ((!movingIndex || !movingIndex.confirmed) && offset !== 0) {
// Search for the real index
if (offset > 0) {
confirmedIndex = index;
setMovingIndex({
index,
confirmed: true
});
} else {
for (let i = index; i >= 0; i -= 1) {
if (cacheSizes[i] > 0 && resizableInfos[i].resizable) {
confirmedIndex = i;
setMovingIndex({
index: i,
confirmed: true
});
break;
}
}
}
}
const mergedIndex = confirmedIndex ?? movingIndex?.index ?? index;
const numSizes = (0,toConsumableArray["default"])(cacheSizes);
const nextIndex = mergedIndex + 1;
// Get boundary
const startMinSize = getLimitSize(limitSizes[mergedIndex][0], 0);
const endMinSize = getLimitSize(limitSizes[nextIndex][0], 0);
const startMaxSize = getLimitSize(limitSizes[mergedIndex][1], mergedContainerSize);
const endMaxSize = getLimitSize(limitSizes[nextIndex][1], mergedContainerSize);
let mergedOffset = offset;
// Align with the boundary
if (numSizes[mergedIndex] + mergedOffset < startMinSize) {
mergedOffset = startMinSize - numSizes[mergedIndex];
}
if (numSizes[nextIndex] - mergedOffset < endMinSize) {
mergedOffset = numSizes[nextIndex] - endMinSize;
}
if (numSizes[mergedIndex] + mergedOffset > startMaxSize) {
mergedOffset = startMaxSize - numSizes[mergedIndex];
}
if (numSizes[nextIndex] - mergedOffset > endMaxSize) {
mergedOffset = numSizes[nextIndex] - endMaxSize;
}
// Do offset
numSizes[mergedIndex] += mergedOffset;
numSizes[nextIndex] -= mergedOffset;
updateSizes(numSizes);
return numSizes;
};
const onOffsetEnd = () => {
setMovingIndex(null);
};
// ======================= Collapse =======================
const onCollapse = (index, type) => {
const currentSizes = getPxSizes();
const adjustedType = reverse ? type === 'start' ? 'end' : 'start' : type;
const currentIndex = adjustedType === 'start' ? index : index + 1;
const targetIndex = adjustedType === 'start' ? index + 1 : index;
const currentSize = currentSizes[currentIndex];
const targetSize = currentSizes[targetIndex];
if (currentSize !== 0 && targetSize !== 0) {
// Collapse directly
currentSizes[currentIndex] = 0;
currentSizes[targetIndex] += currentSize;
cacheCollapsedSizeRef.current[index] = currentSize;
} else {
const totalSize = currentSize + targetSize;
const currentSizeMin = getLimitSize(limitSizes[currentIndex][0], 0);
const currentSizeMax = getLimitSize(limitSizes[currentIndex][1], mergedContainerSize);
const targetSizeMin = getLimitSize(limitSizes[targetIndex][0], 0);
const targetSizeMax = getLimitSize(limitSizes[targetIndex][1], mergedContainerSize);
const limitStart = Math.max(currentSizeMin, totalSize - targetSizeMax);
const limitEnd = Math.min(currentSizeMax, totalSize - targetSizeMin);
const halfOffset = targetSizeMin || (limitEnd - limitStart) / 2;
const targetCacheCollapsedSize = cacheCollapsedSizeRef.current[index];
const currentCacheCollapsedSize = totalSize - targetCacheCollapsedSize;
const shouldUseCache = targetCacheCollapsedSize && targetCacheCollapsedSize <= targetSizeMax && targetCacheCollapsedSize >= targetSizeMin && currentCacheCollapsedSize <= currentSizeMax && currentCacheCollapsedSize >= currentSizeMin;
if (shouldUseCache) {
currentSizes[targetIndex] = targetCacheCollapsedSize;
currentSizes[currentIndex] = currentCacheCollapsedSize;
} else {
currentSizes[currentIndex] -= halfOffset;
currentSizes[targetIndex] += halfOffset;
}
}
updateSizes(currentSizes);
return currentSizes;
};
return [onOffsetStart, onOffsetUpdate, onOffsetEnd, onCollapse, movingIndex?.index];
}
;// ./components/splitter/SplitBar.tsx
const getValidNumber = num => {
return (0,is.isNumber)(num) && Number.isFinite(num) ? Math.round(num) : 0;
};
const DOUBLE_CLICK_TIME_GAP = 300;
const SplitBar = props => {
const {
prefixCls,
rootPrefixCls,
vertical,
index,
active,
ariaNow,
ariaMin,
ariaMax,
resizable,
draggerIcon,
draggerStyle,
draggerClassName,
collapsibleIcon,
startCollapsible,
endCollapsible,
onDraggerDoubleClick,
onOffsetStart,
onOffsetUpdate,
onOffsetEnd,
onCollapse,
lazy,
containerSize,
showStartCollapsibleIcon,
showEndCollapsibleIcon
} = props;
const splitBarPrefixCls = `${prefixCls}-bar`;
const lastClickTimeRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(0);
const [varName] = (0,genStyleUtils.genCssVar)(rootPrefixCls, 'splitter');
// ======================== Resize ========================
const [startPos, setStartPos] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null);
const [constrainedOffset, setConstrainedOffset] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0);
const constrainedOffsetX = vertical ? 0 : constrainedOffset;
const constrainedOffsetY = vertical ? constrainedOffset : 0;
const onMouseDown = e => {
e.stopPropagation();
const currentTime = Date.now();
const timeGap = currentTime - lastClickTimeRef.current;
if (timeGap > 0 && timeGap < DOUBLE_CLICK_TIME_GAP) {
// Prevent drag start if it's a double-click action
return;
}
lastClickTimeRef.current = currentTime;
if (resizable && e.currentTarget) {
setStartPos([e.pageX, e.pageY]);
onOffsetStart(index);
}
};
const onTouchStart = e => {
if (resizable && e.touches.length === 1) {
const touch = e.touches[0];
setStartPos([touch.pageX, touch.pageY]);
onOffsetStart(index);
}
};
// Updated constraint calculation
const getConstrainedOffset = rawOffset => {
const currentPos = containerSize * ariaNow / 100;
const newPos = currentPos + rawOffset;
// Calculate available space
const minAllowed = Math.max(0, containerSize * ariaMin / 100);
const maxAllowed = Math.min(containerSize, containerSize * ariaMax / 100);
// Constrain new position within bounds
const clampedPos = Math.max(minAllowed, Math.min(maxAllowed, newPos));
return clampedPos - currentPos;
};
const handleLazyMove = (0,es.useEvent)((offsetX, offsetY) => {
const constrainedOffsetValue = getConstrainedOffset(vertical ? offsetY : offsetX);
setConstrainedOffset(constrainedOffsetValue);
});
const handleLazyEnd = (0,es.useEvent)(() => {
onOffsetUpdate(index, constrainedOffsetX, constrainedOffsetY, true);
setConstrainedOffset(0);
onOffsetEnd(true);
});
const getVisibilityClass = mode => {
switch (mode) {
case true:
return `${splitBarPrefixCls}-collapse-bar-always-visible`;
case false:
return `${splitBarPrefixCls}-collapse-bar-always-hidden`;
case 'auto':
return `${splitBarPrefixCls}-collapse-bar-hover-only`;
}
};
(0,useLayoutEffect["default"])(() => {
if (!startPos) {
return;
}
const onMouseMove = e => {
const {
pageX,
pageY
} = e;
const offsetX = pageX - startPos[0];
const offsetY = pageY - startPos[1];
if (lazy) {
handleLazyMove(offsetX, offsetY);
} else {
onOffsetUpdate(index, offsetX, offsetY);
}
};
const onMouseUp = () => {
if (lazy) {
handleLazyEnd();
} else {
onOffsetEnd();
}
setStartPos(null);
};
const handleTouchMove = e => {
if (e.touches.length === 1) {
const touch = e.touches[0];
const offsetX = touch.pageX - startPos[0];
const offsetY = touch.pageY - startPos[1];
if (lazy) {
handleLazyMove(offsetX, offsetY);
} else {
onOffsetUpdate(index, offsetX, offsetY);
}
}
};
const handleTouchEnd = () => {
if (lazy) {
handleLazyEnd();
} else {
onOffsetEnd();
}
setStartPos(null);
};
const eventHandlerMap = {
mousemove: onMouseMove,
mouseup: onMouseUp,
touchmove: handleTouchMove,
touchend: handleTouchEnd
};
for (const [event, handler] of Object.entries(eventHandlerMap)) {
// eslint-disable-next-line react-web-api/no-leaked-event-listener
window.addEventListener(event, handler);
}
return () => {
for (const [event, handler] of Object.entries(eventHandlerMap)) {
window.removeEventListener(event, handler);
}
};
}, [startPos, index, lazy]);
const transformStyle = {
[varName('bar-preview-offset')]: `${constrainedOffset}px`
};
// ======================== Render ========================
const [startIcon, endIcon, startCustomize, endCustomize] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
let startIcon = null;
let endIcon = null;
const startCustomize = collapsibleIcon?.start !== undefined;
const endCustomize = collapsibleIcon?.end !== undefined;
if (vertical) {
startIcon = startCustomize ? collapsibleIcon.start : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_UpOutlined, null);
endIcon = endCustomize ? collapsibleIcon.end : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_DownOutlined, null);
} else {
startIcon = startCustomize ? collapsibleIcon.start : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_LeftOutlined, null);
endIcon = endCustomize ? collapsibleIcon.end : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(RightOutlined["default"], null);
}
return [startIcon, endIcon, startCustomize, endCustomize];
}, [collapsibleIcon, vertical]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: splitBarPrefixCls,
role: "separator",
"aria-valuenow": getValidNumber(ariaNow),
"aria-valuemin": getValidNumber(ariaMin),
"aria-valuemax": getValidNumber(ariaMax)
}, lazy && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${splitBarPrefixCls}-preview`, {
[`${splitBarPrefixCls}-preview-active`]: !!constrainedOffset
}),
style: transformStyle
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
style: draggerStyle,
className: (0,clsx.clsx)(`${splitBarPrefixCls}-dragger`, {
[`${splitBarPrefixCls}-dragger-disabled`]: !resizable,
[`${splitBarPrefixCls}-dragger-active`]: active,
[`${splitBarPrefixCls}-dragger-customize`]: draggerIcon !== undefined
}, draggerClassName?.default, active && draggerClassName?.active),
onMouseDown: onMouseDown,
onTouchStart: onTouchStart,
onDoubleClick: () => onDraggerDoubleClick?.(index)
}, draggerIcon !== undefined ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${splitBarPrefixCls}-dragger-icon`)
}, draggerIcon)) : null), startCollapsible && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${splitBarPrefixCls}-collapse-bar`, `${splitBarPrefixCls}-collapse-bar-start`, {
[`${splitBarPrefixCls}-collapse-bar-customize`]: startCustomize
}, getVisibilityClass(showStartCollapsibleIcon)),
onClick: () => onCollapse(index, 'start')
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: (0,clsx.clsx)(`${splitBarPrefixCls}-collapse-icon`, `${splitBarPrefixCls}-collapse-start`)
}, startIcon))), endCollapsible && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${splitBarPrefixCls}-collapse-bar`, `${splitBarPrefixCls}-collapse-bar-end`, {
[`${splitBarPrefixCls}-collapse-bar-customize`]: endCustomize
}, getVisibilityClass(showEndCollapsibleIcon)),
onClick: () => onCollapse(index, 'end')
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: (0,clsx.clsx)(`${splitBarPrefixCls}-collapse-icon`, `${splitBarPrefixCls}-collapse-end`)
}, endIcon))));
};
/* harmony default export */ var splitter_SplitBar = (SplitBar);
// EXTERNAL MODULE: ./components/splitter/style/index.ts
var splitter_style = __webpack_require__("./components/splitter/style/index.ts");
;// ./components/splitter/Splitter.tsx
/* eslint-disable react/no-array-index-key */
const Splitter = props => {
const {
prefixCls: customizePrefixCls,
className,
classNames,
style,
styles,
layout,
orientation,
vertical,
children,
draggerIcon,
collapsibleIcon,
rootClassName,
onDraggerDoubleClick,
onResizeStart,
onResize,
onResizeEnd,
lazy
} = props;
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('splitter');
const prefixCls = getPrefixCls('splitter', customizePrefixCls);
const rootPrefixCls = getPrefixCls();
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,splitter_style["default"])(prefixCls, rootCls);
// ======================== Direct ========================
const [mergedOrientation, isVertical] = useOrientation(orientation, vertical, layout);
const isRTL = direction === 'rtl';
const reverse = !isVertical && isRTL;
// ====================== Items Data ======================
const items = hooks_useItems(children);
// >>> Warning for uncontrolled
if (true) {
const warning = (0,_util_warning.devUseWarning)('Splitter');
const existSize = items.some(item => item.size !== undefined);
const existUndefinedSize = items.some(item => item.size === undefined);
if (existSize && existUndefinedSize && !onResize) {
true ? warning(false, 'usage', 'When part of `Splitter.Panel` has `size`, `onResize` is required or change `size` to `defaultSize`.') : 0;
}
warning.deprecated(!layout, 'layout', 'orientation');
}
// ====================== Container =======================
const [containerSize, setContainerSize] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)();
const onContainerResize = size => {
const {
offsetWidth,
offsetHeight
} = size;
const containerSize = isVertical ? offsetHeight : offsetWidth;
// Skip when container has no size, Such as nested in a hidden tab panel
// to fix: https://github.com/ant-design/ant-design/issues/51106
if (containerSize === 0) {
return;
}
setContainerSize(containerSize);
};
// ========================= Size =========================
const [panelSizes, itemPxSizes, itemPtgSizes, itemPtgMinSizes, itemPtgMaxSizes, updateSizes] = useSizes(items, containerSize);
// ====================== Resizable =======================
const resizableInfos = useResizable(items, itemPxSizes, reverse);
const [onOffsetStart, onOffsetUpdate, onOffsetEnd, onCollapse, movingIndex] = useResize(items, resizableInfos, itemPtgSizes, containerSize, updateSizes, reverse);
// ======================== Events ========================
const onInternalResizeStart = (0,es.useEvent)(index => {
onOffsetStart(index);
onResizeStart?.(itemPxSizes);
});
const onInternalResizeUpdate = (0,es.useEvent)((index, offset, lazyEnd) => {
const nextSizes = onOffsetUpdate(index, offset);
if (lazyEnd) {
onResizeEnd?.(nextSizes);
} else {
onResize?.(nextSizes);
}
});
const onInternalResizeEnd = (0,es.useEvent)(lazyEnd => {
onOffsetEnd();
if (!lazyEnd) {
onResizeEnd?.(itemPxSizes);
}
});
const onInternalCollapse = (0,es.useEvent)((index, type) => {
const nextSizes = onCollapse(index, type);
onResize?.(nextSizes);
onResizeEnd?.(nextSizes);
const collapsed = nextSizes.map(size => Math.abs(size) < Number.EPSILON);
props.onCollapse?.(collapsed, nextSizes);
});
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
vertical: isVertical,
orientation: mergedOrientation
};
// ======================== Styles ========================
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
}, {
// Convert `classNames.dragger: 'a'` to
// `classNames.dragger: { default: 'a' }`
dragger: {
_default: 'default'
}
});
const containerClassName = (0,clsx.clsx)(prefixCls, className, `${prefixCls}-${mergedOrientation}`, {
[`${prefixCls}-rtl`]: isRTL
}, rootClassName, mergedClassNames.root, contextClassName, cssVarCls, rootCls, hashId);
// ======================== Render ========================
const maskCls = `${prefixCls}-mask`;
const stackSizes = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
const mergedSizes = [];
let stack = 0;
const len = items.length;
for (let i = 0; i < len; i += 1) {
stack += itemPtgSizes[i];
mergedSizes.push(stack);
}
return mergedSizes;
}, [itemPtgSizes, items.length]);
const mergedStyle = {
...mergedStyles.root,
...contextStyle,
...style
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(resize_observer_es, {
onResize: onContainerResize
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
style: mergedStyle,
className: containerClassName
}, items.map((item, idx) => {
const panelProps = {
...item,
className: (0,clsx.clsx)(mergedClassNames.panel, item.className),
style: {
...mergedStyles.panel,
...item.style
}
};
// Panel
const panel = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(InternalPanel, {
...panelProps,
prefixCls: prefixCls,
size: panelSizes[idx]
});
// Split Bar
let splitBar = null;
const resizableInfo = resizableInfos[idx];
if (resizableInfo) {
const ariaMinStart = (stackSizes[idx - 1] || 0) + itemPtgMinSizes[idx];
const ariaMinEnd = (stackSizes[idx + 1] || 100) - itemPtgMaxSizes[idx + 1];
const ariaMaxStart = (stackSizes[idx - 1] || 0) + itemPtgMaxSizes[idx];
const ariaMaxEnd = (stackSizes[idx + 1] || 100) - itemPtgMinSizes[idx + 1];
splitBar = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(splitter_SplitBar, {
lazy: lazy,
index: idx,
active: movingIndex === idx,
prefixCls: prefixCls,
rootPrefixCls: rootPrefixCls,
vertical: isVertical,
resizable: resizableInfo.resizable,
draggerStyle: mergedStyles.dragger,
draggerClassName: mergedClassNames.dragger,
draggerIcon: draggerIcon,
collapsibleIcon: collapsibleIcon,
ariaNow: stackSizes[idx] * 100,
ariaMin: Math.max(ariaMinStart, ariaMinEnd) * 100,
ariaMax: Math.min(ariaMaxStart, ariaMaxEnd) * 100,
startCollapsible: resizableInfo.startCollapsible,
endCollapsible: resizableInfo.endCollapsible,
showStartCollapsibleIcon: resizableInfo.showStartCollapsibleIcon,
showEndCollapsibleIcon: resizableInfo.showEndCollapsibleIcon,
onDraggerDoubleClick: onDraggerDoubleClick,
onOffsetStart: onInternalResizeStart,
onOffsetUpdate: (index, offsetX, offsetY, lazyEnd) => {
let offset = isVertical ? offsetY : offsetX;
if (reverse) {
offset = -offset;
}
onInternalResizeUpdate(index, offset, lazyEnd);
},
onOffsetEnd: onInternalResizeEnd,
onCollapse: onInternalCollapse,
containerSize: containerSize || 0
});
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
key: `split-panel-${idx}`
}, panel, splitBar);
}), (0,is.isNumber)(movingIndex) && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
"aria-hidden": true,
className: (0,clsx.clsx)(maskCls, `${maskCls}-${mergedOrientation}`)
}))));
};
if (true) {
Splitter.displayName = 'Splitter';
}
/* harmony default export */ var splitter_Splitter = (Splitter);
;// ./components/splitter/index.tsx
const components_splitter_Splitter = splitter_Splitter;
components_splitter_Splitter.Panel = splitter_Panel;
/* harmony default export */ var splitter = (components_splitter_Splitter);
;// ./components/statistic/Number.tsx
const StatisticNumber = props => {
const {
value,
formatter,
precision,
decimalSeparator,
groupSeparator = '',
prefixCls
} = props;
let valueNode;
if (typeof formatter === 'function') {
// Customize formatter
valueNode = formatter(value);
} else {
// Internal formatter
const val = String(value);
const cells = val.match(/^(-?)(\d*)(\.(\d+))?$/);
// Process if illegal number
if (!cells || val === '-') {
valueNode = val;
} else {
const negative = cells[1];
let int = cells[2] || '0';
let decimal = cells[4] || '';
int = int.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
if ((0,is.isNumber)(precision)) {
decimal = decimal.padEnd(precision, '0').slice(0, precision > 0 ? precision : 0);
}
if (decimal) {
decimal = `${decimalSeparator}${decimal}`;
}
valueNode = [/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
key: "int",
className: `${prefixCls}-content-value-int`
}, negative, int), decimal && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
key: "decimal",
className: `${prefixCls}-content-value-decimal`
}, decimal))];
}
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-content-value`
}, valueNode);
};
/* harmony default export */ var statistic_Number = (StatisticNumber);
// EXTERNAL MODULE: ./components/statistic/style/index.ts
var statistic_style = __webpack_require__("./components/statistic/style/index.ts");
;// ./components/statistic/Statistic.tsx
const Statistic = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
style,
valueStyle,
value = 0,
title,
valueRender,
prefix,
suffix,
loading = false,
/* --- FormatConfig starts --- */
formatter,
precision,
decimalSeparator = '.',
groupSeparator = ',',
/* --- FormatConfig starts --- */
onMouseEnter,
onMouseLeave,
styles,
classNames,
...rest
} = props;
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('statistic');
const prefixCls = getPrefixCls('statistic', customizePrefixCls);
const [hashId, cssVarCls] = (0,statistic_style["default"])(prefixCls);
const mergedProps = {
...props,
decimalSeparator,
groupSeparator,
loading,
value
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
// ============================= Warning ==============================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Statistic');
[['valueStyle', 'styles.content']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
}
const valueNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(statistic_Number, {
decimalSeparator: decimalSeparator,
groupSeparator: groupSeparator,
prefixCls: prefixCls,
formatter: formatter,
precision: precision,
value: value
});
const rootClassNames = (0,clsx.clsx)(prefixCls, {
[`${prefixCls}-rtl`]: direction === 'rtl'
}, contextClassName, className, rootClassName, mergedClassNames.root, hashId, cssVarCls);
const headerClassNames = (0,clsx.clsx)(`${prefixCls}-header`, mergedClassNames.header);
const titleClassNames = (0,clsx.clsx)(`${prefixCls}-title`, mergedClassNames.title);
const contentClassNames = (0,clsx.clsx)(`${prefixCls}-content`, mergedClassNames.content);
const prefixClassNames = (0,clsx.clsx)(`${prefixCls}-content-prefix`, mergedClassNames.prefix);
const suffixClassNames = (0,clsx.clsx)(`${prefixCls}-content-suffix`, mergedClassNames.suffix);
const internalRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
nativeElement: internalRef.current
}));
const restProps = (0,pickAttrs["default"])(rest, {
aria: true,
data: true
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
...restProps,
className: rootClassNames,
style: {
...mergedStyles.root,
...contextStyle,
...style
},
ref: internalRef,
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave
}, title && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: headerClassNames,
style: mergedStyles.header
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: titleClassNames,
style: mergedStyles.title
}, title))), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(skeleton, {
paragraph: false,
loading: loading,
className: `${prefixCls}-skeleton`,
active: true
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: contentClassNames,
style: {
...valueStyle,
...mergedStyles.content
}
}, prefix && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: prefixClassNames,
style: mergedStyles.prefix
}, prefix)), typeof valueRender === 'function' ? valueRender(valueNode) : valueNode, suffix && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: suffixClassNames,
style: mergedStyles.suffix
}, suffix)))));
});
if (true) {
Statistic.displayName = 'Statistic';
}
/* harmony default export */ var statistic_Statistic = (Statistic);
;// ./components/statistic/utils.ts
// Countdown
const timeUnits = [['Y', 1000 * 60 * 60 * 24 * 365],
// years
['M', 1000 * 60 * 60 * 24 * 30],
// months
['D', 1000 * 60 * 60 * 24],
// days
['H', 1000 * 60 * 60],
// hours
['m', 1000 * 60],
// minutes
['s', 1000],
// seconds
['S', 1] // million seconds
];
function formatTimeStr(duration, format) {
let leftDuration = duration;
const escapeRegex = /\[[^\]]*]/g;
const keepList = (format.match(escapeRegex) || []).map(str => str.slice(1, -1));
const templateText = format.replace(escapeRegex, '[]');
const replacedText = timeUnits.reduce((current, [name, unit]) => {
if (current.includes(name)) {
const value = Math.floor(leftDuration / unit);
leftDuration -= value * unit;
return current.replace(new RegExp(`${name}+`, 'g'), match => {
const len = match.length;
return value.toString().padStart(len, '0');
});
}
return current;
}, templateText);
let index = 0;
return replacedText.replace(escapeRegex, () => {
const match = keepList[index];
index += 1;
return match;
});
}
function formatCounter(value, config, down) {
const {
format = ''
} = config;
const target = new Date(value).getTime();
const current = Date.now();
const diff = down ? Math.max(target - current, 0) : Math.max(current - target, 0);
return formatTimeStr(diff, format);
}
;// ./components/statistic/Timer.tsx
const UPDATE_INTERVAL = 1000 / 60;
function getTime(value) {
return new Date(value).getTime();
}
const StatisticTimer = props => {
const {
value,
format = 'HH:mm:ss',
onChange,
onFinish,
type,
...rest
} = props;
const down = type === 'countdown';
// We reuse state here to do same as `forceUpdate`
const [showTime, setShowTime] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
// ======================== Update ========================
const update = (0,es.useEvent)(() => {
const now = Date.now();
const timestamp = getTime(value);
setShowTime({});
const timeDiff = !down ? now - timestamp : timestamp - now;
onChange?.(timeDiff);
// Only countdown will trigger `onFinish`
if (down && timestamp < now) {
onFinish?.();
return false;
}
return true;
});
// Effect trigger
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
let intervalId;
const tick = () => {
if (!update()) {
window.clearInterval(intervalId);
}
};
const startTimer = () => {
intervalId = window.setInterval(tick, UPDATE_INTERVAL);
};
const stopTimer = () => {
window.clearInterval(intervalId);
};
startTimer();
return () => {
stopTimer();
};
}, [value, down]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
setShowTime({});
}, []);
// ======================== Format ========================
const formatter = (formatValue, config) => showTime ? formatCounter(formatValue, {
...config,
format
}, down) : '-';
const valueRender = node => (0,reactNode.cloneElement)(node, {
title: undefined
});
// ======================== Render ========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(statistic_Statistic, {
...rest,
value: value,
valueRender: valueRender,
formatter: formatter
});
};
/* harmony default export */ var Timer = (StatisticTimer);
;// ./components/statistic/Countdown.tsx
const Countdown = props => {
if (true) {
const warning = (0,_util_warning.devUseWarning)('Countdown');
warning.deprecated(false, '', '');
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Timer, {
...props,
type: "countdown"
});
};
/* harmony default export */ var statistic_Countdown = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo(Countdown));
;// ./components/statistic/index.tsx
statistic_Statistic.Timer = Timer;
statistic_Statistic.Countdown = statistic_Countdown;
/* harmony default export */ var statistic = (statistic_Statistic);
;// ./node_modules/@rc-component/steps/es/Rail.js
function Rail(props) {
const {
prefixCls,
className,
style,
status
} = props;
const railCls = `${prefixCls}-rail`;
// ============================= render =============================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(railCls, `${railCls}-${status}`, className),
style: style
});
}
;// ./node_modules/@rc-component/steps/es/UnstableContext.js
const UnstableContext_UnstableContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({});
;// ./node_modules/@rc-component/steps/es/Context.js
const StepsContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
;// ./node_modules/@rc-component/steps/es/StepIcon.js
function StepIcon_extends() { StepIcon_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return StepIcon_extends.apply(this, arguments); }
const StepIconSemanticContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({});
const StepIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
className,
style,
children,
...restProps
} = props;
const {
prefixCls,
classNames,
styles
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(StepsContext);
const {
className: itemClassName,
style: itemStyle
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(StepIconSemanticContext);
const itemCls = `${prefixCls}-item`;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", StepIcon_extends({}, (0,pickAttrs["default"])(restProps, false), {
ref: ref,
className: (0,clsx.clsx)(`${itemCls}-icon`, classNames.itemIcon, itemClassName, className),
style: {
...styles.itemIcon,
...itemStyle,
...style
}
}), children);
});
/* harmony default export */ var es_StepIcon = (StepIcon);
;// ./node_modules/@rc-component/steps/es/Step.js
function Step_extends() { Step_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Step_extends.apply(this, arguments); }
/* eslint react/prop-types: 0 */
function hasContent(value) {
return value !== undefined && value !== null;
}
function Step(props) {
const {
// style
prefixCls,
classNames,
styles,
// data
data,
last,
nextStatus,
active,
index,
// render
itemRender,
iconRender,
itemWrapperRender,
// events
onClick
} = props;
const itemCls = `${prefixCls}-item`;
// ======================== Contexts ========================
const {
railFollowPrevStatus
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(UnstableContext_UnstableContext);
const {
ItemComponent
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(StepsContext);
// ========================== Data ==========================
const {
onClick: onItemClick,
title,
subTitle,
content,
description,
disabled,
icon,
status,
className,
style,
classNames: itemClassNames = {},
styles: itemStyles = {},
...restItemProps
} = data;
const mergedContent = content ?? description;
const renderInfo = {
item: {
...data,
content: mergedContent
},
index,
active
};
// ========================= Click ==========================
const clickable = !!(onClick || onItemClick) && !disabled;
const accessibilityProps = {};
if (clickable) {
accessibilityProps.role = 'button';
accessibilityProps.tabIndex = 0;
accessibilityProps.onClick = e => {
onItemClick?.(e);
onClick(index);
};
accessibilityProps.onKeyDown = e => {
const {
which
} = e;
if (which === KeyCode["default"].ENTER || which === KeyCode["default"].SPACE) {
onClick(index);
}
};
}
// ========================= Render =========================
const mergedStatus = status || 'wait';
const hasTitle = hasContent(title);
const hasSubTitle = hasContent(subTitle);
const classString = (0,clsx.clsx)(itemCls, `${itemCls}-${mergedStatus}`, {
[`${itemCls}-custom`]: icon,
[`${itemCls}-active`]: active,
[`${itemCls}-disabled`]: disabled === true,
[`${itemCls}-empty-header`]: !hasTitle && !hasSubTitle
}, className, classNames.item, itemClassNames.root);
let iconNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_StepIcon, null);
if (iconRender) {
iconNode = iconRender(iconNode, {
...renderInfo,
components: {
Icon: es_StepIcon
}
});
}
const wrapperNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${itemCls}-wrapper`, classNames.itemWrapper, itemClassNames.wrapper),
style: {
...styles.itemWrapper,
...itemStyles.wrapper
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(StepIconSemanticContext.Provider, {
value: {
className: itemClassNames.icon,
style: itemStyles.icon
}
}, iconNode), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${itemCls}-section`, classNames.itemSection, itemClassNames.section),
style: {
...styles.itemSection,
...itemStyles.section
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${itemCls}-header`, classNames.itemHeader, itemClassNames.header),
style: {
...styles.itemHeader,
...itemStyles.header
}
}, hasTitle && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${itemCls}-title`, classNames.itemTitle, itemClassNames.title),
style: {
...styles.itemTitle,
...itemStyles.title
}
}, title), hasSubTitle && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
title: typeof subTitle === 'string' ? subTitle : undefined,
className: (0,clsx.clsx)(`${itemCls}-subtitle`, classNames.itemSubtitle, itemClassNames.subtitle),
style: {
...styles.itemSubtitle,
...itemStyles.subtitle
}
}, subTitle), !last && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Rail, {
prefixCls: itemCls,
className: (0,clsx.clsx)(classNames.itemRail, itemClassNames.rail),
style: {
...styles.itemRail,
...itemStyles.rail
},
status: railFollowPrevStatus ? status : nextStatus
})), hasContent(mergedContent) && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${itemCls}-content`, classNames.itemContent, itemClassNames.content),
style: {
...styles.itemContent,
...itemStyles.content
}
}, mergedContent)));
let stepNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(ItemComponent, Step_extends({}, restItemProps, accessibilityProps, {
className: classString,
style: {
...styles.item,
...itemStyles.root,
...style
}
}), itemWrapperRender ? itemWrapperRender(wrapperNode) : wrapperNode);
if (itemRender) {
stepNode = itemRender(stepNode, renderInfo) || null;
}
return stepNode;
}
;// ./node_modules/@rc-component/steps/es/Steps.js
function Steps_extends() { Steps_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Steps_extends.apply(this, arguments); }
/* eslint react/no-did-mount-set-state: 0, react/prop-types: 0 */
const EmptyObject = {};
function es_Steps_Steps(props) {
const {
// style
prefixCls = 'rc-steps',
style,
className,
classNames = EmptyObject,
styles = EmptyObject,
rootClassName,
// layout
orientation,
titlePlacement,
components,
// data
status = 'process',
current = 0,
initial = 0,
onChange,
items,
// render
iconRender,
itemRender,
itemWrapperRender,
...restProps
} = props;
// ============================= layout =============================
const isVertical = orientation === 'vertical';
const mergedOrientation = isVertical ? 'vertical' : 'horizontal';
const mergeTitlePlacement = !isVertical && titlePlacement === 'vertical' ? 'vertical' : 'horizontal';
// ============================= styles =============================
const classString = (0,clsx.clsx)(prefixCls, `${prefixCls}-${mergedOrientation}`, `${prefixCls}-title-${mergeTitlePlacement}`, rootClassName, className, classNames.root);
// ============================== Data ==============================
const mergedItems = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => (items || []).filter(Boolean), [items]);
const statuses = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => mergedItems.map(({
status: itemStatus
}, index) => {
const stepNumber = initial + index;
if (!itemStatus) {
if (stepNumber === current) {
return status;
} else if (stepNumber < current) {
return 'finish';
}
return 'wait';
}
return itemStatus;
}), [mergedItems, status, current, initial]);
// ============================= events =============================
const onStepClick = next => {
if (onChange && current !== next) {
onChange(next);
}
};
// =========================== components ===========================
const {
root: RootComponent = 'div',
item: ItemComponent = 'div'
} = components || {};
// ============================ contexts ============================
const stepIconContext = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => ({
prefixCls,
classNames,
styles,
ItemComponent
}), [prefixCls, classNames, styles, ItemComponent]);
// ============================= render =============================
const renderStep = (item, index) => {
const stepIndex = initial + index;
const itemStatus = statuses[index];
const nextStatus = statuses[index + 1];
const data = {
...item,
status: itemStatus
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Step, {
key: stepIndex
// Style
,
prefixCls: prefixCls,
classNames: classNames,
styles: styles
// Data
,
data: data,
nextStatus: nextStatus,
active: stepIndex === current,
index: stepIndex,
last: mergedItems.length - 1 === index
// Render
,
iconRender: iconRender,
itemRender: itemRender,
itemWrapperRender: itemWrapperRender,
onClick: onChange && onStepClick
});
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(RootComponent, Steps_extends({
className: classString,
style: {
...style,
...styles?.root
}
}, restProps), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(StepsContext.Provider, {
value: stepIconContext
}, mergedItems.map(renderStep)));
}
;// ./node_modules/@rc-component/steps/es/index.js
/* harmony default export */ var steps_es = (es_Steps_Steps);
;// ./components/steps/context.ts
/**
* When use this context. Will trade as sub component instead of root Steps component.
*/
const InternalContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
;// ./components/steps/PanelArrow.tsx
const PanelArrow = props => {
const {
prefixCls
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("svg", {
className: `${prefixCls}-panel-arrow`,
viewBox: "0 0 100 100",
xmlns: "http://www.w3.org/2000/svg",
preserveAspectRatio: "none"
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("title", null, "Arrow"), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("path", {
d: "M 0 0 L 100 50 L 0 100"
}));
};
/* harmony default export */ var steps_PanelArrow = (PanelArrow);
;// ./components/steps/ProgressIcon.tsx
const ProgressIcon = props => {
const {
prefixCls,
rootPrefixCls,
children,
percent
} = props;
const progressCls = `${prefixCls}-item-progress-icon`;
const circleCls = `${progressCls}-circle`;
const [, varRef] = (0,genStyleUtils.genCssVar)(rootPrefixCls, 'cmp-steps');
const dashArray = `calc(${varRef('progress-radius')} * 2 * ${Math.PI * percent / 100}) 9999`;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("svg", {
className: `${progressCls}-svg`,
viewBox: "0 0 100 100",
width: "100%",
height: "100%",
xmlns: "http://www.w3.org/2000/svg",
"aria-valuemax": 100,
"aria-valuemin": 0,
"aria-valuenow": percent
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("title", null, "Progress"), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("circle", {
className: (0,clsx.clsx)(circleCls, `${circleCls}-rail`)
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("circle", {
className: (0,clsx.clsx)(circleCls, `${circleCls}-ptg`),
strokeDasharray: dashArray,
transform: "rotate(-90 50 50)"
})), children);
};
/* harmony default export */ var steps_ProgressIcon = (ProgressIcon);
// EXTERNAL MODULE: ./components/steps/style/index.ts + 13 modules
var steps_style = __webpack_require__("./components/steps/style/index.ts");
;// ./components/steps/index.tsx
const waveEffectClassNames = {
itemIcon: TARGET_CLS
};
const steps_Steps = props => {
const {
// Style
size,
className,
rootClassName,
style,
variant = 'filled',
type,
classNames,
styles,
// Layout
direction,
orientation,
responsive = true,
progressDot,
labelPlacement,
titlePlacement,
ellipsis,
offset = 0,
// Data
items,
percent,
current = 0,
onChange,
// Render
iconRender,
// MISC
...restProps
} = props;
const internalContent = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(InternalContext);
const contextContent = (0,config_provider_context.useComponentConfig)('steps');
const {
getPrefixCls,
direction: rtlDirection,
className: contextClassName,
style: contextStyle
} = contextContent;
let contextClassNames;
let contextStyles;
let components = {};
if (internalContent) {
components = {
root: internalContent.rootComponent,
item: internalContent.itemComponent
};
} else {
({
classNames: contextClassNames,
styles: contextStyles
} = contextContent);
}
const rootPrefixCls = getPrefixCls();
const prefixCls = getPrefixCls('steps', props.prefixCls);
const itemIconCls = `${prefixCls}-item-icon`;
const [hashId, cssVarCls] = (0,steps_style["default"])(prefixCls);
const [varName] = (0,genStyleUtils.genCssVar)(rootPrefixCls, 'cmp-steps');
// ============================= Size =============================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Steps');
warning.deprecated(size !== 'default', 'size="default"', 'size="medium"');
}
const mergedSize = (0,useSize["default"])(size);
// ============================= Item =============================
const mergedItems = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => (items || []).filter(Boolean), [items]);
// ============================ Layout ============================
const {
xs
} = hooks_useBreakpoint(responsive);
// Type
const mergedType = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (type && type !== 'default') {
return type;
}
if (progressDot) {
return 'dot';
}
return type;
}, [progressDot, type]);
const isInline = mergedType === 'inline';
const isDot = mergedType === 'dot' || mergedType === 'inline';
// Progress Dot Render function
const legacyProgressDotRender = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
return mergedType === 'dot' && typeof progressDot === 'function' ? progressDot : undefined;
}, [mergedType, progressDot]);
const mergedOrientation = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const nextOrientation = orientation || direction;
if (mergedType === 'panel') {
return 'horizontal';
}
return responsive && xs || nextOrientation === 'vertical' ? 'vertical' : 'horizontal';
}, [orientation, direction, mergedType, responsive, xs]);
const mergedTitlePlacement = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (isDot || mergedOrientation === 'vertical') {
return mergedOrientation === 'vertical' ? 'horizontal' : 'vertical';
}
if (type === 'navigation') {
return 'horizontal';
}
return titlePlacement || labelPlacement || 'horizontal';
}, [isDot, labelPlacement, mergedOrientation, titlePlacement, type]);
// ========================== Percentage ==========================
const mergedPercent = isInline ? undefined : percent;
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
variant,
size: mergedSize,
type: mergedType,
orientation: mergedOrientation,
titlePlacement: mergedTitlePlacement,
current,
percent: mergedPercent,
responsive,
offset
};
// ============================ Styles ============================
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([waveEffectClassNames, contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
// ============================= Icon =============================
const internalIconRender = (_, info) => {
const {
item,
index,
active,
components: {
Icon: StepIcon
}
} = info;
const {
status,
icon
} = item;
let iconContent = null;
if (isDot || icon) {
iconContent = icon;
} else {
switch (status) {
case 'finish':
iconContent = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CheckOutlined, {
className: `${itemIconCls}-finish`
});
break;
case 'error':
iconContent = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CloseOutlined, {
className: `${itemIconCls}-error`
});
break;
default:
{
let numNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${itemIconCls}-number`
}, info.index + 1);
if (status === 'process' && mergedPercent !== undefined) {
numNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(steps_ProgressIcon, {
prefixCls: prefixCls,
rootPrefixCls: rootPrefixCls,
percent: mergedPercent
}, numNode);
}
iconContent = numNode;
}
}
}
let iconNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(StepIcon, null, iconContent);
// Custom Render Props
if (iconRender) {
iconNode = iconRender(iconNode, {
index,
active,
item,
components: {
Icon: StepIcon
}
});
} else if (typeof legacyProgressDotRender === 'function') {
iconNode = legacyProgressDotRender(iconNode, {
index,
...item
});
}
return iconNode;
};
// ============================ Custom ============================
const itemRender = (itemNode, itemInfo) => {
let content = itemNode;
if (isInline && itemInfo.item.content) {
content = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_tooltip, {
destroyOnHidden: true,
title: itemInfo.item.content
}, itemNode);
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(wave, {
component: "Steps",
disabled: itemInfo.item.disabled || !onChange,
colorSource: variant === 'filled' ? 'color' : null
}, content);
};
const itemWrapperRender = mergedType === 'panel' ? itemNode => {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, itemNode, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(steps_PanelArrow, {
prefixCls: prefixCls
}));
} : undefined;
// ============================ Styles ============================
const mergedStyle = {
[varName('items-offset')]: `${offset}`,
...contextStyle,
...style
};
const stepsClassName = (0,clsx.clsx)(contextClassName, `${prefixCls}-${variant}`, {
[`${prefixCls}-${mergedType}`]: mergedType !== 'dot' ? mergedType : false,
[`${prefixCls}-rtl`]: rtlDirection === 'rtl',
[`${prefixCls}-dot`]: isDot,
[`${prefixCls}-ellipsis`]: ellipsis,
[`${prefixCls}-with-progress`]: mergedPercent !== undefined,
[`${prefixCls}-small`]: mergedSize === 'small'
}, className, rootClassName, hashId, cssVarCls);
// =========================== Warning ============================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Steps');
warning.deprecated(!labelPlacement, 'labelPlacement', 'titlePlacement');
warning.deprecated(!progressDot, 'progressDot', 'type="dot"');
warning.deprecated(!direction, 'direction', 'orientation');
warning.deprecated(mergedItems.every(item => !item.description), 'items.description', 'items.content');
}
// ============================ Render ============================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(steps_es, {
...restProps,
// Style
prefixCls: prefixCls,
className: stepsClassName,
style: mergedStyle,
classNames: mergedClassNames,
styles: mergedStyles,
// Layout
orientation: mergedOrientation,
titlePlacement: mergedTitlePlacement,
components: components,
// Data
current: current,
items: mergedItems,
onChange: onChange,
// Render
iconRender: internalIconRender,
itemRender: itemRender,
itemWrapperRender: itemWrapperRender
});
};
if (true) {
steps_Steps.displayName = 'Steps';
}
/* harmony default export */ var steps = (steps_Steps);
;// ./node_modules/@rc-component/switch/es/index.js
function switch_es_extends() { switch_es_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return switch_es_extends.apply(this, arguments); }
const Switch = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(({
prefixCls = 'rc-switch',
className,
checked,
defaultChecked,
disabled,
loadingIcon,
checkedChildren,
unCheckedChildren,
onClick,
onChange,
onKeyDown,
styles,
classNames: switchClassNames,
...restProps
}, ref) => {
const [innerChecked, setInnerChecked] = (0,useControlledState["default"])(defaultChecked ?? false, checked);
function triggerChange(newChecked, event) {
let mergedChecked = innerChecked;
if (!disabled) {
mergedChecked = newChecked;
setInnerChecked(mergedChecked);
onChange?.(mergedChecked, event);
}
return mergedChecked;
}
function onInternalKeyDown(e) {
if (e.which === KeyCode["default"].LEFT) {
triggerChange(false, e);
} else if (e.which === KeyCode["default"].RIGHT) {
triggerChange(true, e);
}
onKeyDown?.(e);
}
function onInternalClick(e) {
const ret = triggerChange(!innerChecked, e);
// [Legacy] trigger onClick with value
onClick?.(ret, e);
}
const switchClassName = (0,clsx.clsx)(prefixCls, className, {
[`${prefixCls}-checked`]: innerChecked,
[`${prefixCls}-disabled`]: disabled
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", switch_es_extends({}, restProps, {
type: "button",
role: "switch",
"aria-checked": innerChecked,
disabled: disabled,
className: switchClassName,
ref: ref,
onKeyDown: onInternalKeyDown,
onClick: onInternalClick
}), loadingIcon, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-inner`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}-inner-checked`, switchClassNames?.content),
style: styles?.content
}, checkedChildren), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}-inner-unchecked`, switchClassNames?.content),
style: styles?.content
}, unCheckedChildren)));
});
Switch.displayName = 'Switch';
/* harmony default export */ var switch_es = (Switch);
// EXTERNAL MODULE: ./components/switch/style/index.ts
var switch_style = __webpack_require__("./components/switch/style/index.ts");
;// ./components/switch/index.tsx
const InternalSwitch = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
size: customizeSize,
disabled: customDisabled,
loading,
className,
rootClassName,
style,
checked: checkedProp,
value,
defaultChecked: defaultCheckedProp,
defaultValue,
onChange,
styles,
classNames,
...restProps
} = props;
const [checked, setChecked] = (0,es.useControlledState)(defaultCheckedProp ?? defaultValue ?? false, checkedProp ?? value);
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('switch');
// ===================== Disabled =====================
const disabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
const mergedDisabled = (customDisabled ?? disabled) || loading;
const prefixCls = getPrefixCls('switch', customizePrefixCls);
// Style
const [hashId, cssVarCls] = (0,switch_style["default"])(prefixCls);
if (true) {
const warning = (0,_util_warning.devUseWarning)('Switch');
warning.deprecated(customizeSize !== 'default', 'size="default"', 'size="medium"');
}
const mergedSize = (0,useSize["default"])(customizeSize);
const mergedProps = {
...props,
size: mergedSize,
disabled: mergedDisabled
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const loadingIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-handle`, mergedClassNames.indicator),
style: mergedStyles.indicator
}, loading && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LoadingOutlined, {
className: `${prefixCls}-loading-icon`
}));
const classes = (0,clsx.clsx)(contextClassName, {
[`${prefixCls}-small`]: mergedSize === 'small',
[`${prefixCls}-loading`]: loading,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, rootClassName, mergedClassNames.root, hashId, cssVarCls);
const mergedStyle = {
...mergedStyles.root,
...contextStyle,
...style
};
const changeHandler = (...args) => {
setChecked(args[0]);
onChange?.(...args);
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(wave, {
component: "Switch",
disabled: mergedDisabled
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(switch_es, {
...restProps,
classNames: mergedClassNames,
styles: mergedStyles,
checked: checked,
onChange: changeHandler,
prefixCls: prefixCls,
className: classes,
style: mergedStyle,
disabled: mergedDisabled,
ref: ref,
loadingIcon: loadingIcon
}));
});
const switch_Switch = InternalSwitch;
switch_Switch.__ANT_SWITCH = true;
if (true) {
switch_Switch.displayName = 'Switch';
}
/* harmony default export */ var components_switch = (switch_Switch);
;// ./node_modules/@rc-component/table/es/constant.js
const EXPAND_COLUMN = {};
const INTERNAL_HOOKS = 'rc-table-internal-hook';
;// ./node_modules/@rc-component/context/es/context.js
function createContext(defaultValue) {
const Context = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(undefined);
const Provider = ({
value,
children
}) => {
const valueRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(value);
valueRef.current = value;
const [context] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(() => ({
getValue: () => valueRef.current,
listeners: new Set()
}));
(0,useLayoutEffect["default"])(() => {
(0,external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_.unstable_batchedUpdates)(() => {
context.listeners.forEach(listener => {
listener(value);
});
});
}, [value]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Context.Provider, {
value: context
}, children);
};
return {
Context,
Provider,
defaultValue
};
}
/** e.g. useSelect(userContext) => user */
/** e.g. useSelect(userContext, user => user.name) => user.name */
/** e.g. useSelect(userContext, ['name', 'age']) => user { name, age } */
/** e.g. useSelect(userContext, 'name') => user.name */
function useContext(holder, selector) {
const eventSelector = (0,useEvent["default"])(typeof selector === 'function' ? selector : ctx => {
if (selector === undefined) {
return ctx;
}
if (!Array.isArray(selector)) {
return ctx[selector];
}
const obj = {};
selector.forEach(key => {
obj[key] = ctx[key];
});
return obj;
});
const context = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(holder?.Context);
const {
listeners,
getValue
} = context || {};
const valueRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
valueRef.current = eventSelector(context ? getValue() : holder?.defaultValue);
const [, forceUpdate] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState({});
(0,useLayoutEffect["default"])(() => {
if (!context) {
return;
}
function trigger(nextValue) {
const nextSelectorValue = eventSelector(nextValue);
if (!(0,isEqual["default"])(valueRef.current, nextSelectorValue, true)) {
forceUpdate({});
}
}
listeners.add(trigger);
return () => {
listeners.delete(trigger);
};
}, [context]);
return valueRef.current;
}
;// ./node_modules/@rc-component/context/es/Immutable.js
function Immutable_extends() { Immutable_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Immutable_extends.apply(this, arguments); }
/**
* Create Immutable pair for `makeImmutable` and `responseImmutable`.
*/
function createImmutable() {
const ImmutableContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
/**
* Get render update mark by `makeImmutable` root.
* Do not deps on the return value as render times
* but only use for `useMemo` or `useCallback` deps.
*/
function useImmutableMark() {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(ImmutableContext);
}
/**
* Wrapped Component will be marked as Immutable.
* When Component parent trigger render,
* it will notice children component (use with `responseImmutable`) node that parent has updated.
* @param Component Passed Component
* @param triggerRender Customize trigger `responseImmutable` children re-render logic. Default will always trigger re-render when this component re-render.
*/
function makeImmutable(Component, shouldTriggerRender) {
const refAble = (0,es_ref.supportRef)(Component);
const ImmutableComponent = (props, ref) => {
const refProps = refAble ? {
ref
} : {};
const renderTimesRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(0);
const prevProps = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(props);
// If parent has the context, we do not wrap it
const mark = useImmutableMark();
if (mark !== null) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, Immutable_extends({}, props, refProps));
}
if (
// Always trigger re-render if `shouldTriggerRender` is not provided
!shouldTriggerRender || shouldTriggerRender(prevProps.current, props)) {
renderTimesRef.current += 1;
}
prevProps.current = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(ImmutableContext.Provider, {
value: renderTimesRef.current
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, Immutable_extends({}, props, refProps)));
};
if (true) {
ImmutableComponent.displayName = `ImmutableRoot(${Component.displayName || Component.name})`;
}
return refAble ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(ImmutableComponent) : ImmutableComponent;
}
/**
* Wrapped Component with `React.memo`.
* But will rerender when parent with `makeImmutable` rerender.
*/
function responseImmutable(Component, propsAreEqual) {
const refAble = (0,es_ref.supportRef)(Component);
const ImmutableComponent = (props, ref) => {
const refProps = refAble ? {
ref
} : {};
useImmutableMark();
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, Immutable_extends({}, props, refProps));
};
if (true) {
ImmutableComponent.displayName = `ImmutableResponse(${Component.displayName || Component.name})`;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo(refAble ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(ImmutableComponent) : ImmutableComponent, propsAreEqual);
}
return {
makeImmutable,
responseImmutable,
useImmutableMark
};
}
;// ./node_modules/@rc-component/context/es/index.js
// For legacy usage, we export it directly
const {
makeImmutable,
responseImmutable,
useImmutableMark
} = createImmutable();
;// ./node_modules/@rc-component/table/es/context/TableContext.js
const {
makeImmutable: TableContext_makeImmutable,
responseImmutable: TableContext_responseImmutable,
useImmutableMark: TableContext_useImmutableMark
} = createImmutable();
const TableContext = createContext();
/* harmony default export */ var context_TableContext = (TableContext);
;// ./node_modules/@rc-component/table/es/hooks/useRenderTimes.js
/* istanbul ignore file */
function useRenderTimes(props, debug) {
// Render times
const timesRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(0);
timesRef.current += 1;
// Props changed
const propsRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(props);
const keys = [];
Object.keys(props || {}).map(key => {
if (props?.[key] !== propsRef.current?.[key]) {
keys.push(key);
}
});
propsRef.current = props;
// Cache keys since React rerender may cause it lost
const keysRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef([]);
if (keys.length) {
keysRef.current = keys;
}
external_root_React_commonjs2_react_commonjs_react_amd_react_.useDebugValue(timesRef.current);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useDebugValue(keysRef.current.join(', '));
if (debug) {
console.log(`${debug}:`, timesRef.current, keysRef.current);
}
return timesRef.current;
}
/* harmony default export */ var hooks_useRenderTimes = ( true ? useRenderTimes : 0);
const RenderBlock = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo(() => {
const times = useRenderTimes();
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("h1", null, "Render Times: ", times);
});
if (true) {
RenderBlock.displayName = 'RenderBlock';
}
;// ./node_modules/@rc-component/table/es/context/PerfContext.js
// TODO: Remove when use `responsiveImmutable`
const PerfContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({
renderWithProps: false
});
/* harmony default export */ var context_PerfContext = (PerfContext);
;// ./node_modules/@rc-component/table/es/utils/valueUtil.js
const INTERNAL_KEY_PREFIX = 'RC_TABLE_KEY';
function valueUtil_toArray(arr) {
if (arr === undefined || arr === null) {
return [];
}
return Array.isArray(arr) ? arr : [arr];
}
function getColumnsKey(columns) {
const columnKeys = [];
const keys = {};
columns.forEach(column => {
const {
key,
dataIndex
} = column || {};
let mergedKey = key || valueUtil_toArray(dataIndex).join('-') || INTERNAL_KEY_PREFIX;
while (keys[mergedKey]) {
mergedKey = `${mergedKey}_next`;
}
keys[mergedKey] = true;
columnKeys.push(mergedKey);
});
return columnKeys;
}
function validateValue(val) {
return val !== null && val !== undefined;
}
function validNumberValue(value) {
return typeof value === 'number' && !Number.isNaN(value);
}
;// ./node_modules/@rc-component/table/es/Cell/useCellRender.js
function isRenderCell(data) {
return data && typeof data === 'object' && !Array.isArray(data) && ! /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(data);
}
function useCellRender_useCellRender(record, dataIndex, renderIndex, children, render, shouldCellUpdate) {
// TODO: Remove this after next major version
const perfRecord = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(context_PerfContext);
const mark = TableContext_useImmutableMark();
// ======================== Render ========================
const retData = (0,useMemo["default"])(() => {
if (validateValue(children)) {
return [children];
}
const path = dataIndex === null || dataIndex === undefined || dataIndex === '' ? [] : Array.isArray(dataIndex) ? dataIndex : [dataIndex];
const value = (0,get["default"])(record, path);
// Customize render node
let returnChildNode = value;
let returnCellProps = undefined;
if (render) {
const renderData = render(value, record, renderIndex);
if (isRenderCell(renderData)) {
if (true) {
(0,warning["default"])(false, '`columns.render` return cell props is deprecated with perf issue, please use `onCell` instead.');
}
returnChildNode = renderData.children;
returnCellProps = renderData.props;
perfRecord.renderWithProps = true;
} else {
returnChildNode = renderData;
}
}
return [returnChildNode, returnCellProps];
}, [
// Force update deps
mark,
// Normal deps
record, children, dataIndex, render, renderIndex], (prev, next) => {
if (shouldCellUpdate) {
const [, prevRecord] = prev;
const [, nextRecord] = next;
return shouldCellUpdate(nextRecord, prevRecord);
}
// Legacy mode should always update
if (perfRecord.renderWithProps) {
return true;
}
return !(0,isEqual["default"])(prev, next, true);
});
return retData;
}
;// ./node_modules/@rc-component/table/es/Cell/useHoverState.js
/** Check if cell is in hover range */
function inHoverRange(cellStartRow, cellRowSpan, startRow, endRow) {
const cellEndRow = cellStartRow + cellRowSpan - 1;
return cellStartRow <= endRow && cellEndRow >= startRow;
}
function useHoverState(rowIndex, rowSpan) {
return useContext(context_TableContext, ctx => {
const hovering = inHoverRange(rowIndex, rowSpan || 1, ctx.hoverStartRow, ctx.hoverEndRow);
return [hovering, ctx.onHover];
});
}
;// ./node_modules/@rc-component/table/es/Cell/index.js
function Cell_extends() { Cell_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Cell_extends.apply(this, arguments); }
const getTitleFromCellRenderChildren = ({
ellipsis,
rowType,
children
}) => {
let title;
const ellipsisConfig = ellipsis === true ? {
showTitle: true
} : ellipsis;
if (ellipsisConfig && (ellipsisConfig.showTitle || rowType === 'header')) {
if (typeof children === 'string' || typeof children === 'number') {
title = children.toString();
} else if ( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(children) && typeof children.props?.children === 'string') {
title = children.props?.children;
}
}
return title;
};
const Cell_Cell = props => {
if (true) {
hooks_useRenderTimes(props);
}
const {
component: Component,
children,
ellipsis,
scope,
// Style
prefixCls,
className,
style,
align,
// Value
record,
render,
dataIndex,
renderIndex,
shouldCellUpdate,
// Row
index,
rowType,
// Span
colSpan,
rowSpan,
// Fixed
fixStart,
fixEnd,
fixedStartShadow,
fixedEndShadow,
offsetFixedStartShadow,
offsetFixedEndShadow,
zIndex,
zIndexReverse,
// Private
appendNode,
additionalProps = {},
isSticky
} = props;
const cellPrefixCls = `${prefixCls}-cell`;
const {
allColumnsFixedLeft,
rowHoverable
} = useContext(context_TableContext, ['allColumnsFixedLeft', 'rowHoverable']);
// ====================== Value =======================
const [childNode, legacyCellProps] = useCellRender_useCellRender(record, dataIndex, renderIndex, children, render, shouldCellUpdate);
// ====================== Fixed =======================
const fixedStyle = {};
const isFixStart = typeof fixStart === 'number' && !allColumnsFixedLeft;
const isFixEnd = typeof fixEnd === 'number' && !allColumnsFixedLeft;
const [showFixStartShadow, showFixEndShadow] = useContext(context_TableContext, ({
scrollInfo
}) => {
if (!isFixStart && !isFixEnd) {
return [false, false];
}
const [absScroll, scrollWidth] = scrollInfo;
const showStartShadow = (isFixStart && fixedStartShadow && absScroll) -
// For precision, we not show shadow by default which has better user experience.
offsetFixedStartShadow >= 1;
const showEndShadow = (isFixEnd && fixedEndShadow && scrollWidth - absScroll) -
// Same as above
offsetFixedEndShadow > 1;
return [showStartShadow, showEndShadow];
});
if (isFixStart) {
fixedStyle.insetInlineStart = fixStart;
fixedStyle['--z-offset'] = zIndex;
fixedStyle['--z-offset-reverse'] = zIndexReverse;
}
if (isFixEnd) {
fixedStyle.insetInlineEnd = fixEnd;
fixedStyle['--z-offset'] = zIndex;
fixedStyle['--z-offset-reverse'] = zIndexReverse;
}
// ================ RowSpan & ColSpan =================
const mergedColSpan = legacyCellProps?.colSpan ?? additionalProps.colSpan ?? colSpan ?? 1;
const mergedRowSpan = legacyCellProps?.rowSpan ?? additionalProps.rowSpan ?? rowSpan ?? 1;
// ====================== Hover =======================
const [hovering, onHover] = useHoverState(index, mergedRowSpan);
const onMouseEnter = (0,es.useEvent)(event => {
if (record) {
onHover(index, index + mergedRowSpan - 1);
}
additionalProps?.onMouseEnter?.(event);
});
const onMouseLeave = (0,es.useEvent)(event => {
if (record) {
onHover(-1, -1);
}
additionalProps?.onMouseLeave?.(event);
});
// ====================== Render ======================
if (mergedColSpan === 0 || mergedRowSpan === 0) {
return null;
}
// >>>>> Title
const title = additionalProps.title ?? getTitleFromCellRenderChildren({
rowType,
ellipsis,
children: childNode
});
// >>>>> ClassName
const mergedClassName = (0,clsx.clsx)(cellPrefixCls, className, {
// Fixed
[`${cellPrefixCls}-fix`]: isFixStart || isFixEnd,
[`${cellPrefixCls}-fix-start`]: isFixStart,
[`${cellPrefixCls}-fix-end`]: isFixEnd,
// Fixed shadow
[`${cellPrefixCls}-fix-start-shadow`]: fixedStartShadow,
[`${cellPrefixCls}-fix-start-shadow-show`]: fixedStartShadow && showFixStartShadow,
[`${cellPrefixCls}-fix-end-shadow`]: fixedEndShadow,
[`${cellPrefixCls}-fix-end-shadow-show`]: fixedEndShadow && showFixEndShadow,
[`${cellPrefixCls}-ellipsis`]: ellipsis,
[`${cellPrefixCls}-with-append`]: appendNode,
[`${cellPrefixCls}-fix-sticky`]: (isFixStart || isFixEnd) && isSticky,
[`${cellPrefixCls}-row-hover`]: !legacyCellProps && hovering
}, additionalProps.className, legacyCellProps?.className);
// >>>>> Style
const alignStyle = {};
if (align) {
alignStyle.textAlign = align;
}
// The order is important since user can overwrite style.
// For example ant-design/ant-design#51763
const mergedStyle = {
...legacyCellProps?.style,
...fixedStyle,
...alignStyle,
...additionalProps.style,
...style
};
// >>>>> Children Node
let mergedChildNode = childNode;
// Not crash if final `childNode` is not validate ReactNode
if (typeof mergedChildNode === 'object' && !Array.isArray(mergedChildNode) && ! /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(mergedChildNode)) {
mergedChildNode = null;
}
if (ellipsis && (fixedStartShadow || fixedEndShadow)) {
mergedChildNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${cellPrefixCls}-content`
}, mergedChildNode);
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, Cell_extends({}, legacyCellProps, additionalProps, {
className: mergedClassName,
style: mergedStyle
// A11y
,
title: title,
scope: scope
// Hover
,
onMouseEnter: rowHoverable ? onMouseEnter : undefined,
onMouseLeave: rowHoverable ? onMouseLeave : undefined
//Span
,
colSpan: mergedColSpan !== 1 ? mergedColSpan : null,
rowSpan: mergedRowSpan !== 1 ? mergedRowSpan : null
}), appendNode, mergedChildNode);
};
/* harmony default export */ var es_Cell = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo(Cell_Cell));
;// ./node_modules/@rc-component/table/es/utils/fixUtil.js
function isFixedStart(column) {
return column.fixed === 'start';
}
function isFixedEnd(column) {
return column.fixed === 'end';
}
function getCellFixedInfo(colStart, colEnd, columns, stickyOffsets) {
const startColumn = columns[colStart] || {};
const endColumn = columns[colEnd] || {};
let fixStart = null;
let fixEnd = null;
if (isFixedStart(startColumn) && isFixedStart(endColumn)) {
fixStart = stickyOffsets.start[colStart];
} else if (isFixedEnd(endColumn) && isFixedEnd(startColumn)) {
fixEnd = stickyOffsets.end[colEnd];
}
// check if need to add shadow
let fixedStartShadow = false;
let fixedEndShadow = false;
// Calc `zIndex`.
// first fixed start (start -> end) column `zIndex` should be greater than next column.
// first fixed end (end -> start) column `zIndex` should be greater than next column.
let zIndex = 0;
let zIndexReverse = 0;
if (fixStart !== null) {
fixedStartShadow = !columns[colEnd + 1] || !isFixedStart(columns[colEnd + 1]);
zIndex = columns.length * 2 - colStart; // Fix start always overlay fix end
zIndexReverse = columns.length + colStart;
}
if (fixEnd !== null) {
fixedEndShadow = !columns[colStart - 1] || !isFixedEnd(columns[colStart - 1]);
zIndex = colEnd;
zIndexReverse = columns.length - colEnd; // Fix end always overlay fix start
}
// Check if scrollLeft will show the shadow
let offsetFixedStartShadow = 0;
let offsetFixedEndShadow = 0;
if (fixedStartShadow) {
for (let i = 0; i < colStart; i += 1) {
if (!isFixedStart(columns[i])) {
offsetFixedStartShadow += stickyOffsets.widths[i] || 0;
}
}
}
if (fixedEndShadow) {
for (let i = columns.length - 1; i > colEnd; i -= 1) {
if (!isFixedEnd(columns[i])) {
offsetFixedEndShadow += stickyOffsets.widths[i] || 0;
}
}
}
return {
fixStart,
fixEnd,
fixedStartShadow,
fixedEndShadow,
offsetFixedStartShadow,
offsetFixedEndShadow,
isSticky: stickyOffsets.isSticky,
zIndex,
zIndexReverse
};
}
;// ./node_modules/@rc-component/table/es/Footer/SummaryContext.js
const SummaryContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({});
/* harmony default export */ var Footer_SummaryContext = (SummaryContext);
;// ./node_modules/@rc-component/table/es/Footer/Cell.js
function Footer_Cell_extends() { Footer_Cell_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Footer_Cell_extends.apply(this, arguments); }
const SummaryCell = props => {
const {
className,
index,
children,
colSpan = 1,
rowSpan,
align
} = props;
const {
prefixCls
} = useContext(context_TableContext, ['prefixCls']);
const {
scrollColumnIndex,
stickyOffsets,
flattenColumns
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(Footer_SummaryContext);
const lastIndex = index + colSpan - 1;
const mergedColSpan = lastIndex + 1 === scrollColumnIndex ? colSpan + 1 : colSpan;
const fixedInfo = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => getCellFixedInfo(index, index + mergedColSpan - 1, flattenColumns, stickyOffsets), [index, mergedColSpan, flattenColumns, stickyOffsets]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Cell, Footer_Cell_extends({
className: className,
index: index,
component: "td",
prefixCls: prefixCls,
record: null,
dataIndex: null,
align: align,
colSpan: mergedColSpan,
rowSpan: rowSpan,
render: () => children
}, fixedInfo));
};
/* harmony default export */ var Footer_Cell = (SummaryCell);
;// ./node_modules/@rc-component/table/es/Footer/Row.js
const FooterRow = props => {
const {
children,
...restProps
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("tr", restProps, children);
};
/* harmony default export */ var Footer_Row = (FooterRow);
;// ./node_modules/@rc-component/table/es/Footer/Summary.js
/**
* Syntactic sugar. Do not support HOC.
*/
const Summary = props => {
const {
children
} = props;
return children;
};
Summary.Row = Footer_Row;
Summary.Cell = Footer_Cell;
/* harmony default export */ var Footer_Summary = (Summary);
;// ./node_modules/@rc-component/table/es/Footer/index.js
const es_Footer_Footer = props => {
if (true) {
hooks_useRenderTimes(props);
}
const {
children,
stickyOffsets,
flattenColumns
} = props;
const prefixCls = useContext(context_TableContext, 'prefixCls');
const lastColumnIndex = flattenColumns.length - 1;
const scrollColumn = flattenColumns[lastColumnIndex];
const summaryContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
stickyOffsets,
flattenColumns,
scrollColumnIndex: scrollColumn?.scrollbar ? lastColumnIndex : null
}), [scrollColumn, flattenColumns, lastColumnIndex, stickyOffsets]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Footer_SummaryContext.Provider, {
value: summaryContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("tfoot", {
className: `${prefixCls}-summary`
}, children));
};
/* harmony default export */ var es_Footer = (TableContext_responseImmutable(es_Footer_Footer));
const FooterComponents = Footer_Summary;
;// ./node_modules/@rc-component/table/es/sugar/Column.js
/* istanbul ignore next */
/**
* This is a syntactic sugar for `columns` prop.
* So HOC will not work on this.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function Column_Column(_) {
return null;
}
/* harmony default export */ var sugar_Column = (Column_Column);
;// ./node_modules/@rc-component/table/es/sugar/ColumnGroup.js
/* istanbul ignore next */
/**
* This is a syntactic sugar for `columns` prop.
* So HOC will not work on this.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function ColumnGroup(_) {
return null;
}
/* harmony default export */ var sugar_ColumnGroup = (ColumnGroup);
;// ./node_modules/@rc-component/table/es/hooks/useFlattenRecords.js
// recursion (flat tree structure)
function fillRecords(list, record, indent, childrenColumnName, expandedKeys, getRowKey, index) {
const key = getRowKey(record, index);
list.push({
record,
indent,
index,
rowKey: key
});
const expanded = expandedKeys?.has(key);
if (record && Array.isArray(record[childrenColumnName]) && expanded) {
// expanded state, flat record
for (let i = 0; i < record[childrenColumnName].length; i += 1) {
fillRecords(list, record[childrenColumnName][i], indent + 1, childrenColumnName, expandedKeys, getRowKey, i);
}
}
}
/**
* flat tree data on expanded state
*
* @export
* @template T
* @param {*} data : table data
* @param {string} childrenColumnName : 指定树形结构的列名
* @param {Set} expandedKeys : 展开的行对应的keys
* @param {GetRowKey} getRowKey : 获取当前rowKey的方法
* @returns flattened data
*/
function useFlattenRecords(data, childrenColumnName, expandedKeys, getRowKey) {
const arr = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (expandedKeys?.size) {
const list = [];
// collect flattened record
for (let i = 0; i < data?.length; i += 1) {
const record = data[i];
// using array.push or spread operator may cause "Maximum call stack size exceeded" exception if array size is big enough.
fillRecords(list, record, 0, childrenColumnName, expandedKeys, getRowKey, i);
}
return list;
}
return data?.map((item, index) => {
return {
record: item,
indent: 0,
index,
rowKey: getRowKey(item, index)
};
});
}, [data, childrenColumnName, expandedKeys, getRowKey]);
return arr;
}
;// ./node_modules/@rc-component/table/es/hooks/useRowInfo.js
function useRowInfo(record, rowKey, recordIndex, indent) {
const context = useContext(context_TableContext, ['prefixCls', 'fixedInfoList', 'flattenColumns', 'expandableType', 'expandRowByClick', 'onTriggerExpand', 'rowClassName', 'expandedRowClassName', 'indentSize', 'expandIcon', 'expandedRowRender', 'expandIconColumnIndex', 'expandedKeys', 'childrenColumnName', 'rowExpandable', 'onRow']);
const {
flattenColumns,
expandableType,
expandedKeys,
childrenColumnName,
onTriggerExpand,
rowExpandable,
onRow,
expandRowByClick,
rowClassName
} = context;
// ======================= Expandable =======================
// Only when row is not expandable and `children` exist in record
const nestExpandable = expandableType === 'nest';
const rowSupportExpand = expandableType === 'row' && (!rowExpandable || rowExpandable(record));
const mergedExpandable = rowSupportExpand || nestExpandable;
const expanded = expandedKeys && expandedKeys.has(rowKey);
const hasNestChildren = childrenColumnName && record && record[childrenColumnName];
const onInternalTriggerExpand = (0,es.useEvent)(onTriggerExpand);
// ========================= onRow ==========================
const rowProps = onRow?.(record, recordIndex);
const onRowClick = rowProps?.onClick;
const onClick = (event, ...args) => {
if (expandRowByClick && mergedExpandable) {
onTriggerExpand(record, event);
}
onRowClick?.(event, ...args);
};
// ====================== RowClassName ======================
let computeRowClassName;
if (typeof rowClassName === 'string') {
computeRowClassName = rowClassName;
} else if (typeof rowClassName === 'function') {
computeRowClassName = rowClassName(record, recordIndex, indent);
}
// ========================= Column =========================
const columnsKey = getColumnsKey(flattenColumns);
return {
...context,
columnsKey,
nestExpandable,
expanded,
hasNestChildren,
record,
onTriggerExpand: onInternalTriggerExpand,
rowSupportExpand,
expandable: mergedExpandable,
rowProps: {
...rowProps,
className: (0,clsx.clsx)(computeRowClassName, rowProps?.className),
onClick
}
};
}
;// ./node_modules/@rc-component/table/es/Body/ExpandedRow.js
const ExpandedRow = props => {
if (true) {
hooks_useRenderTimes(props);
}
const {
prefixCls,
children,
component: Component,
cellComponent,
className,
expanded,
colSpan,
isEmpty,
stickyOffset = 0
} = props;
const {
scrollbarSize,
fixHeader,
fixColumn,
componentWidth,
horizonScroll
} = useContext(context_TableContext, ['scrollbarSize', 'fixHeader', 'fixColumn', 'componentWidth', 'horizonScroll']);
// Cache render node
let contentNode = children;
if (isEmpty ? horizonScroll && componentWidth : fixColumn) {
contentNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
style: {
width: componentWidth - stickyOffset - (fixHeader && !isEmpty ? scrollbarSize : 0),
position: 'sticky',
left: stickyOffset,
overflow: 'hidden'
},
className: `${prefixCls}-expanded-row-fixed`
}, contentNode);
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, {
className: className,
style: {
display: expanded ? null : 'none'
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Cell, {
component: cellComponent,
prefixCls: prefixCls,
colSpan: colSpan
}, contentNode));
};
/* harmony default export */ var Body_ExpandedRow = (ExpandedRow);
;// ./node_modules/@rc-component/table/es/utils/expandUtil.js
function renderExpandIcon({
prefixCls,
record,
onExpand,
expanded,
expandable
}) {
const expandClassName = `${prefixCls}-row-expand-icon`;
if (!expandable) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(expandClassName, `${prefixCls}-row-spaced`)
});
}
const onClick = event => {
onExpand(record, event);
event.stopPropagation();
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(expandClassName, {
[`${prefixCls}-row-expanded`]: expanded,
[`${prefixCls}-row-collapsed`]: !expanded
}),
onClick: onClick
});
}
function findAllChildrenKeys(data, getRowKey, childrenColumnName) {
const keys = [];
function dig(list) {
(list || []).forEach((item, index) => {
keys.push(getRowKey(item, index));
dig(item[childrenColumnName]);
});
}
dig(data);
return keys;
}
function computedExpandedClassName(cls, record, index, indent) {
if (typeof cls === 'string') {
return cls;
}
if (typeof cls === 'function') {
return cls(record, index, indent);
}
return '';
}
;// ./node_modules/@rc-component/table/es/Body/BodyRow.js
function BodyRow_extends() { BodyRow_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return BodyRow_extends.apply(this, arguments); }
// ==================================================================================
// == getCellProps ==
// ==================================================================================
function getCellProps(rowInfo, column, colIndex, indent, index, rowKeys = [], expandedRowOffset = 0) {
const {
record,
prefixCls,
columnsKey,
fixedInfoList,
expandIconColumnIndex,
nestExpandable,
indentSize,
expandIcon,
expanded,
hasNestChildren,
onTriggerExpand,
expandable,
expandedKeys
} = rowInfo;
const key = columnsKey[colIndex];
const fixedInfo = fixedInfoList[colIndex];
// ============= Used for nest expandable =============
let appendCellNode;
if (colIndex === (expandIconColumnIndex || 0) && nestExpandable) {
appendCellNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
style: {
paddingLeft: `${indentSize * indent}px`
},
className: `${prefixCls}-row-indent indent-level-${indent}`
}), expandIcon({
prefixCls,
expanded,
expandable: hasNestChildren,
record,
onExpand: onTriggerExpand
}));
}
const additionalCellProps = column.onCell?.(record, index) || {};
// Expandable row has offset
if (expandedRowOffset) {
const {
rowSpan = 1
} = additionalCellProps;
// For expandable row with rowSpan,
// We should increase the rowSpan if the row is expanded
if (expandable && rowSpan && colIndex < expandedRowOffset) {
let currentRowSpan = rowSpan;
for (let i = index; i < index + rowSpan; i += 1) {
const rowKey = rowKeys[i];
if (expandedKeys.has(rowKey)) {
currentRowSpan += 1;
}
}
additionalCellProps.rowSpan = currentRowSpan;
}
}
return {
key,
fixedInfo,
appendCellNode,
additionalCellProps: additionalCellProps
};
}
// ==================================================================================
// == getCellProps ==
// ==================================================================================
const BodyRow = props => {
if (true) {
hooks_useRenderTimes(props);
}
const {
className,
style,
classNames,
styles,
record,
index,
renderIndex,
rowKey,
rowKeys,
indent = 0,
rowComponent: RowComponent,
cellComponent,
scopeCellComponent,
expandedRowInfo
} = props;
const rowInfo = useRowInfo(record, rowKey, index, indent);
const {
prefixCls,
flattenColumns,
expandedRowClassName,
expandedRowRender,
rowProps,
// Misc
expanded,
rowSupportExpand
} = rowInfo;
// Force render expand row if expanded before
const expandedRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
expandedRef.current ||= expanded;
if (true) {
hooks_useRenderTimes(props);
}
// 若没有 expandedRowRender 参数, 将使用 baseRowNode 渲染 Children
// 此时如果 level > 1 则说明是 expandedRow, 一样需要附加 computedExpandedRowClassName
const expandedClsName = computedExpandedClassName(expandedRowClassName, record, index, indent);
// ======================== Base tr row ========================
const baseRowNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RowComponent, BodyRow_extends({}, rowProps, {
"data-row-key": rowKey,
className: (0,clsx.clsx)(className, `${prefixCls}-row`, `${prefixCls}-row-level-${indent}`, rowProps?.className, classNames.row, {
[expandedClsName]: indent >= 1
}),
style: {
...style,
...rowProps?.style,
...styles.row
}
}), flattenColumns.map((column, colIndex) => {
const {
render,
dataIndex,
className: columnClassName
} = column;
const {
key,
fixedInfo,
appendCellNode,
additionalCellProps
} = getCellProps(rowInfo, column, colIndex, indent, index, rowKeys, expandedRowInfo?.offset);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Cell, BodyRow_extends({
className: (0,clsx.clsx)(columnClassName, classNames.cell),
style: styles.cell,
ellipsis: column.ellipsis,
align: column.align,
scope: column.rowScope,
component: column.rowScope ? scopeCellComponent : cellComponent,
prefixCls: prefixCls,
key: key,
record: record,
index: index,
renderIndex: renderIndex,
dataIndex: dataIndex,
render: render,
shouldCellUpdate: column.shouldCellUpdate
}, fixedInfo, {
appendNode: appendCellNode,
additionalProps: additionalCellProps
}));
}));
// ======================== Expand Row =========================
let expandRowNode;
if (rowSupportExpand && (expandedRef.current || expanded)) {
const expandContent = expandedRowRender(record, index, indent + 1, expanded);
expandRowNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Body_ExpandedRow, {
expanded: expanded,
className: (0,clsx.clsx)(`${prefixCls}-expanded-row`, `${prefixCls}-expanded-row-level-${indent + 1}`, expandedClsName),
prefixCls: prefixCls,
component: RowComponent,
cellComponent: cellComponent,
colSpan: expandedRowInfo ? expandedRowInfo.colSpan : flattenColumns.length,
isEmpty: false,
stickyOffset: expandedRowInfo?.sticky
}, expandContent);
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, baseRowNode, expandRowNode);
};
if (true) {
BodyRow.displayName = 'BodyRow';
}
/* harmony default export */ var Body_BodyRow = (TableContext_responseImmutable(BodyRow));
;// ./node_modules/@rc-component/table/es/Body/MeasureCell.js
const MeasureCell = props => {
const {
columnKey,
onColumnResize,
title
} = props;
const cellRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
(0,useLayoutEffect["default"])(() => {
if (cellRef.current) {
onColumnResize(columnKey, cellRef.current.offsetWidth);
}
}, []);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(resize_observer_es, {
data: columnKey
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("td", {
ref: cellRef,
style: {
paddingTop: 0,
paddingBottom: 0,
borderTop: 0,
borderBottom: 0,
height: 0
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
style: {
height: 0,
overflow: 'hidden',
fontWeight: 'bold'
}
}, title || '\xa0')));
};
/* harmony default export */ var Body_MeasureCell = (MeasureCell);
;// ./node_modules/@rc-component/table/es/Body/MeasureRow.js
const MeasureRow = ({
prefixCls,
columnsKey,
onColumnResize,
columns
}) => {
const ref = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const {
measureRowRender
} = useContext(context_TableContext, ['measureRowRender']);
const measureRow = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("tr", {
"aria-hidden": "true",
className: `${prefixCls}-measure-row`,
style: {
height: 0
},
ref: ref
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(resize_observer_es.Collection, {
onBatchResize: infoList => {
if (isVisible(ref.current)) {
infoList.forEach(({
data: columnKey,
size
}) => {
onColumnResize(columnKey, size.offsetWidth);
});
}
}
}, columnsKey.map(columnKey => {
const column = columns.find(col => col.key === columnKey);
const rawTitle = column?.title;
const titleForMeasure = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(rawTitle) ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement(rawTitle, {
ref: null
}) : rawTitle;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Body_MeasureCell, {
key: columnKey,
columnKey: columnKey,
onColumnResize: onColumnResize,
title: titleForMeasure
});
})));
return typeof measureRowRender === 'function' ? measureRowRender(measureRow) : measureRow;
};
/* harmony default export */ var Body_MeasureRow = (MeasureRow);
;// ./node_modules/@rc-component/table/es/Body/index.js
const Body = props => {
if (true) {
hooks_useRenderTimes(props);
}
const {
data,
measureColumnWidth
} = props;
const {
prefixCls,
getComponent,
onColumnResize,
flattenColumns,
getRowKey,
expandedKeys,
childrenColumnName,
emptyNode,
classNames,
styles,
expandedRowOffset = 0,
colWidths
} = useContext(context_TableContext, ['prefixCls', 'getComponent', 'onColumnResize', 'flattenColumns', 'getRowKey', 'expandedKeys', 'childrenColumnName', 'emptyNode', 'classNames', 'styles', 'expandedRowOffset', 'fixedInfoList', 'colWidths']);
const {
body: bodyCls = {}
} = classNames || {};
const {
body: bodyStyles = {}
} = styles || {};
const flattenData = useFlattenRecords(data, childrenColumnName, expandedKeys, getRowKey);
const rowKeys = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => flattenData.map(item => item.rowKey), [flattenData]);
// =================== Performance ====================
const perfRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({
renderWithProps: false
});
// ===================== Expanded =====================
// `expandedRowOffset` data is same for all the rows.
// Let's calc on Body side to save performance.
const expandedRowInfo = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const expandedColSpan = flattenColumns.length - expandedRowOffset;
let expandedStickyStart = 0;
for (let i = 0; i < expandedRowOffset; i += 1) {
expandedStickyStart += colWidths[i] || 0;
}
return {
offset: expandedRowOffset,
colSpan: expandedColSpan,
sticky: expandedStickyStart
};
}, [flattenColumns.length, expandedRowOffset, colWidths]);
// ====================== Render ======================
const WrapperComponent = getComponent(['body', 'wrapper'], 'tbody');
const trComponent = getComponent(['body', 'row'], 'tr');
const tdComponent = getComponent(['body', 'cell'], 'td');
const thComponent = getComponent(['body', 'cell'], 'th');
let rows;
if (data.length) {
rows = flattenData.map((item, idx) => {
const {
record,
indent,
index: renderIndex,
rowKey
} = item;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Body_BodyRow, {
classNames: bodyCls,
styles: bodyStyles,
key: rowKey,
rowKey: rowKey,
rowKeys: rowKeys,
record: record,
index: idx,
renderIndex: renderIndex,
rowComponent: trComponent,
cellComponent: tdComponent,
scopeCellComponent: thComponent,
indent: indent
// Expanded row info
,
expandedRowInfo: expandedRowInfo
});
});
} else {
rows = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Body_ExpandedRow, {
expanded: true,
className: `${prefixCls}-placeholder`,
prefixCls: prefixCls,
component: trComponent,
cellComponent: tdComponent,
colSpan: flattenColumns.length,
isEmpty: true
}, emptyNode);
}
const columnsKey = getColumnsKey(flattenColumns);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(context_PerfContext.Provider, {
value: perfRef.current
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(WrapperComponent, {
style: bodyStyles.wrapper,
className: (0,clsx.clsx)(`${prefixCls}-tbody`, bodyCls.wrapper)
}, measureColumnWidth && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Body_MeasureRow, {
prefixCls: prefixCls,
columnsKey: columnsKey,
onColumnResize: onColumnResize,
columns: flattenColumns
}), rows));
};
if (true) {
Body.displayName = 'Body';
}
/* harmony default export */ var es_Body = (TableContext_responseImmutable(Body));
;// ./node_modules/@rc-component/table/es/utils/legacyUtil.js
const INTERNAL_COL_DEFINE = 'RC_TABLE_INTERNAL_COL_DEFINE';
function getExpandableProps(props) {
const {
expandable,
...legacyExpandableConfig
} = props;
let config;
if ('expandable' in props) {
config = {
...legacyExpandableConfig,
...expandable
};
} else {
if ( true && ['indentSize', 'expandedRowKeys', 'defaultExpandedRowKeys', 'defaultExpandAllRows', 'expandedRowRender', 'expandRowByClick', 'expandIcon', 'onExpand', 'onExpandedRowsChange', 'expandedRowClassName', 'expandIconColumnIndex', 'showExpandColumn', 'title'].some(prop => prop in props)) {
(0,warning["default"])(false, 'expanded related props have been moved into `expandable`.');
}
config = legacyExpandableConfig;
}
if (config.showExpandColumn === false) {
config.expandIconColumnIndex = -1;
}
return config;
}
;// ./node_modules/@rc-component/table/es/ColGroup.js
function ColGroup_extends() { ColGroup_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return ColGroup_extends.apply(this, arguments); }
const ColGroup = props => {
const {
colWidths,
columns,
columCount
} = props;
const {
tableLayout
} = useContext(context_TableContext, ['tableLayout']);
const cols = [];
const len = columCount || columns.length;
// Only insert col with width & additional props
// Skip if rest col do not have any useful info
let mustInsert = false;
for (let i = len - 1; i >= 0; i -= 1) {
const width = colWidths[i];
const column = columns && columns[i];
let additionalProps;
let minWidth;
if (column) {
additionalProps = column[INTERNAL_COL_DEFINE];
// fixed will cause layout problems
if (tableLayout === 'auto') {
minWidth = column.minWidth;
}
}
if (width || minWidth || additionalProps || mustInsert) {
const {
columnType,
...restAdditionalProps
} = additionalProps || {};
cols.unshift( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("col", ColGroup_extends({
key: i,
style: {
width,
minWidth
}
}, restAdditionalProps)));
mustInsert = true;
}
}
return cols.length > 0 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("colgroup", null, cols) : null;
};
/* harmony default export */ var es_ColGroup = (ColGroup);
;// ./node_modules/@rc-component/table/es/FixedHolder/index.js
function useColumnWidth(colWidths, columCount) {
return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
const cloneColumns = [];
for (let i = 0; i < columCount; i += 1) {
const val = colWidths[i];
if (val !== undefined) {
cloneColumns[i] = val;
} else {
return null;
}
}
return cloneColumns;
}, [colWidths.join('_'), columCount]);
}
const FixedHolder = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
if (true) {
hooks_useRenderTimes(props);
}
const {
className,
style,
noData,
columns,
flattenColumns,
colWidths,
colGroup,
columCount,
stickyOffsets,
direction,
fixHeader,
stickyTopOffset,
stickyBottomOffset,
stickyClassName,
scrollX,
tableLayout = 'fixed',
onScroll,
maxContentScroll,
children,
...restProps
} = props;
const {
prefixCls,
scrollbarSize,
isSticky,
getComponent
} = useContext(context_TableContext, ['prefixCls', 'scrollbarSize', 'isSticky', 'getComponent']);
const TableComponent = getComponent(['header', 'table'], 'table');
const combinationScrollBarSize = isSticky && !fixHeader ? 0 : scrollbarSize;
// Pass wheel to scroll event
const scrollRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const setScrollRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(element => {
(0,es_ref.fillRef)(ref, element);
(0,es_ref.fillRef)(scrollRef, element);
}, []);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
function onWheel(e) {
const {
currentTarget,
deltaX
} = e;
if (deltaX) {
const {
scrollLeft,
scrollWidth,
clientWidth
} = currentTarget;
const maxScrollWidth = scrollWidth - clientWidth;
let nextScroll = scrollLeft + deltaX;
if (direction === 'rtl') {
nextScroll = Math.max(-maxScrollWidth, nextScroll);
nextScroll = Math.min(0, nextScroll);
} else {
nextScroll = Math.min(maxScrollWidth, nextScroll);
nextScroll = Math.max(0, nextScroll);
}
onScroll({
currentTarget,
scrollLeft: nextScroll
});
e.preventDefault();
}
}
const scrollEle = scrollRef.current;
scrollEle?.addEventListener('wheel', onWheel, {
passive: false
});
return () => {
scrollEle?.removeEventListener('wheel', onWheel);
};
}, []);
// Add scrollbar column
const lastColumn = flattenColumns[flattenColumns.length - 1];
const ScrollBarColumn = {
fixed: lastColumn ? lastColumn.fixed : null,
scrollbar: true,
onHeaderCell: () => ({
className: `${prefixCls}-cell-scrollbar`
})
};
const columnsWithScrollbar = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => combinationScrollBarSize ? [...columns, ScrollBarColumn] : columns, [combinationScrollBarSize, columns]);
const flattenColumnsWithScrollbar = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => combinationScrollBarSize ? [...flattenColumns, ScrollBarColumn] : flattenColumns, [combinationScrollBarSize, flattenColumns]);
// Calculate the sticky offsets
const headerStickyOffsets = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
const {
start,
end
} = stickyOffsets;
return {
...stickyOffsets,
// left:
// direction === 'rtl' ? [...left.map(width => width + combinationScrollBarSize), 0] : left,
// right:
// direction === 'rtl' ? right : [...right.map(width => width + combinationScrollBarSize), 0],
start: start,
end: [...end.map(width => width + combinationScrollBarSize), 0],
isSticky
};
}, [combinationScrollBarSize, stickyOffsets, isSticky]);
const mergedColumnWidth = useColumnWidth(colWidths, columCount);
const isColGroupEmpty = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
// use original ColGroup if no data or no calculated column width, otherwise use calculated column width
// Return original colGroup if no data, or mergedColumnWidth is empty, or all widths are falsy
const noWidth = !mergedColumnWidth || !mergedColumnWidth.length || mergedColumnWidth.every(w => !w);
return noData || noWidth;
}, [noData, mergedColumnWidth]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
style: {
overflow: 'hidden',
...(isSticky ? {
top: stickyTopOffset,
bottom: stickyBottomOffset
} : {}),
...style
},
ref: setScrollRef,
className: (0,clsx.clsx)(className, {
[stickyClassName]: !!stickyClassName
})
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TableComponent, {
style: {
tableLayout,
minWidth: '100%',
// https://github.com/ant-design/ant-design/issues/54894
width: scrollX
}
}, isColGroupEmpty ? colGroup : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_ColGroup, {
colWidths: [...mergedColumnWidth, combinationScrollBarSize],
columCount: columCount + 1,
columns: flattenColumnsWithScrollbar
}), children({
...restProps,
stickyOffsets: headerStickyOffsets,
columns: columnsWithScrollbar,
flattenColumns: flattenColumnsWithScrollbar
})));
});
if (true) {
FixedHolder.displayName = 'FixedHolder';
}
/** Return a table in div as fixed element which contains sticky info */
// export default responseImmutable(FixedHolder);
/* harmony default export */ var es_FixedHolder = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo(FixedHolder));
;// ./node_modules/@rc-component/table/es/Header/HeaderRow.js
function HeaderRow_extends() { HeaderRow_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return HeaderRow_extends.apply(this, arguments); }
const HeaderRow = props => {
const {
cells,
stickyOffsets,
flattenColumns,
rowComponent: RowComponent,
cellComponent: CellComponent,
onHeaderRow,
index,
classNames,
styles
} = props;
const {
prefixCls
} = useContext(context_TableContext, ['prefixCls']);
let rowProps;
if (onHeaderRow) {
rowProps = onHeaderRow(cells.map(cell => cell.column), index);
}
const columnsKey = getColumnsKey(cells.map(cell => cell.column));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RowComponent, HeaderRow_extends({}, rowProps, {
className: classNames.row,
style: styles.row
}), cells.map((cell, cellIndex) => {
const {
column,
colStart,
colEnd,
colSpan
} = cell;
const fixedInfo = getCellFixedInfo(colStart, colEnd, flattenColumns, stickyOffsets);
const additionalProps = column?.onHeaderCell?.(column) || {};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Cell, HeaderRow_extends({}, cell, {
scope: column.title ? colSpan > 1 ? 'colgroup' : 'col' : null,
ellipsis: column.ellipsis,
align: column.align,
component: CellComponent,
prefixCls: prefixCls,
key: columnsKey[cellIndex]
}, fixedInfo, {
additionalProps: additionalProps,
rowType: "header"
}));
}));
};
if (true) {
HeaderRow.displayName = 'HeaderRow';
}
/* harmony default export */ var Header_HeaderRow = (HeaderRow);
;// ./node_modules/@rc-component/table/es/Header/Header.js
function parseHeaderRows(rootColumns, classNames, styles) {
const rows = [];
function fillRowCells(columns, colIndex, rowIndex = 0) {
// Init rows
rows[rowIndex] = rows[rowIndex] || [];
let currentColIndex = colIndex;
const colSpans = columns.filter(Boolean).map(column => {
const cell = {
key: column.key,
className: (0,clsx.clsx)(column.className, classNames.cell) || '',
style: styles.cell,
children: column.title,
column,
colStart: currentColIndex
};
let colSpan = 1;
const subColumns = column.children;
if (subColumns && subColumns.length > 0) {
colSpan = fillRowCells(subColumns, currentColIndex, rowIndex + 1).reduce((total, count) => total + count, 0);
cell.hasSubColumns = true;
}
if ('colSpan' in column) {
({
colSpan
} = column);
}
if ('rowSpan' in column) {
cell.rowSpan = column.rowSpan;
}
cell.colSpan = colSpan;
cell.colEnd = cell.colStart + colSpan - 1;
rows[rowIndex].push(cell);
currentColIndex += colSpan;
return colSpan;
});
return colSpans;
}
// Generate `rows` cell data
fillRowCells(rootColumns, 0);
// Handle `rowSpan`
const rowCount = rows.length;
for (let rowIndex = 0; rowIndex < rowCount; rowIndex += 1) {
rows[rowIndex].forEach(cell => {
if (!('rowSpan' in cell) && !cell.hasSubColumns) {
// eslint-disable-next-line no-param-reassign
cell.rowSpan = rowCount - rowIndex;
}
});
}
return rows;
}
const Header_Header = props => {
if (true) {
hooks_useRenderTimes(props);
}
const {
stickyOffsets,
columns,
flattenColumns,
onHeaderRow
} = props;
const {
prefixCls,
getComponent,
classNames,
styles
} = useContext(context_TableContext, ['prefixCls', 'getComponent', 'classNames', 'styles']);
const {
header: headerCls = {}
} = classNames || {};
const {
header: headerStyles = {}
} = styles || {};
const rows = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => parseHeaderRows(columns, headerCls, headerStyles), [columns, headerCls, headerStyles]);
const WrapperComponent = getComponent(['header', 'wrapper'], 'thead');
const trComponent = getComponent(['header', 'row'], 'tr');
const thComponent = getComponent(['header', 'cell'], 'th');
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(WrapperComponent, {
className: (0,clsx.clsx)(`${prefixCls}-thead`, headerCls.wrapper),
style: headerStyles.wrapper
}, rows.map((row, rowIndex) => {
const rowNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Header_HeaderRow, {
classNames: headerCls,
styles: headerStyles,
key: rowIndex,
flattenColumns: flattenColumns,
cells: row,
stickyOffsets: stickyOffsets,
rowComponent: trComponent,
cellComponent: thComponent,
onHeaderRow: onHeaderRow,
index: rowIndex
});
return rowNode;
}));
};
/* harmony default export */ var es_Header_Header = (TableContext_responseImmutable(Header_Header));
;// ./node_modules/@rc-component/table/es/hooks/useColumns/useWidthColumns.js
function parseColWidth(totalWidth, width = '') {
if (typeof width === 'number') {
return width;
}
if (width.endsWith('%')) {
return totalWidth * parseFloat(width) / 100;
}
return null;
}
/**
* Fill all column with width
*/
function useWidthColumns(flattenColumns, scrollWidth, clientWidth) {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
// Fill width if needed
if (scrollWidth && scrollWidth > 0) {
let totalWidth = 0;
let missWidthCount = 0;
// collect not given width column
flattenColumns.forEach(col => {
const colWidth = parseColWidth(scrollWidth, col.width);
if (colWidth) {
totalWidth += colWidth;
} else {
missWidthCount += 1;
}
});
// Fill width
const maxFitWidth = Math.max(scrollWidth, clientWidth);
let restWidth = Math.max(maxFitWidth - totalWidth, missWidthCount);
let restCount = missWidthCount;
const avgWidth = restWidth / missWidthCount;
let realTotal = 0;
const filledColumns = flattenColumns.map(col => {
const clone = {
...col
};
const colWidth = parseColWidth(scrollWidth, clone.width);
if (colWidth) {
clone.width = colWidth;
} else {
const colAvgWidth = Math.floor(avgWidth);
clone.width = restCount === 1 ? restWidth : colAvgWidth;
restWidth -= colAvgWidth;
restCount -= 1;
}
realTotal += clone.width;
return clone;
});
// If realTotal is less than clientWidth,
// We need extend column width
if (realTotal < maxFitWidth) {
const scale = maxFitWidth / realTotal;
restWidth = maxFitWidth;
filledColumns.forEach((col, index) => {
const colWidth = Math.floor(col.width * scale);
col.width = index === filledColumns.length - 1 ? restWidth : colWidth;
restWidth -= colWidth;
});
}
return [filledColumns, Math.max(realTotal, maxFitWidth)];
}
return [flattenColumns, scrollWidth];
}, [flattenColumns, scrollWidth, clientWidth]);
}
;// ./node_modules/@rc-component/table/es/hooks/useColumns/index.js
function convertChildrenToColumns(children) {
return (0,toArray["default"])(children).filter(node => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(node)).map(node => {
const {
key,
props
} = node;
const {
children: nodeChildren,
...restProps
} = props;
const column = {
key,
...restProps
};
if (nodeChildren) {
column.children = convertChildrenToColumns(nodeChildren);
}
return column;
});
}
function filterHiddenColumns(columns) {
return columns.filter(column => column && typeof column === 'object' && !column.hidden).map(column => {
const subColumns = column.children;
if (subColumns && subColumns.length > 0) {
return {
...column,
children: filterHiddenColumns(subColumns)
};
}
return column;
});
}
function flatColumns(columns, parentKey = 'key') {
return columns.filter(column => column && typeof column === 'object').reduce((list, column, index) => {
const {
fixed
} = column;
const parsedFixed = fixed === true || fixed === 'left' ? 'start' : fixed === 'right' ? 'end' : fixed;
const mergedKey = `${parentKey}-${index}`;
const subColumns = column.children;
if (subColumns && subColumns.length > 0) {
return [...list, ...flatColumns(subColumns, mergedKey).map(subColum => ({
...subColum,
fixed: subColum.fixed ?? parsedFixed
}))];
}
return [...list, {
key: mergedKey,
...column,
fixed: parsedFixed
}];
}, []);
}
/**
* Parse `columns` & `children` into `columns`.
*/
function useColumns({
prefixCls,
columns,
children,
expandable,
expandedKeys,
columnTitle,
getRowKey,
onTriggerExpand,
expandIcon,
rowExpandable,
expandIconColumnIndex,
expandedRowOffset = 0,
direction,
expandRowByClick,
columnWidth,
fixed,
scrollWidth,
clientWidth
}, transformColumns) {
const baseColumns = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const newColumns = columns || convertChildrenToColumns(children) || [];
return filterHiddenColumns(newColumns.slice());
}, [columns, children]);
// ========================== Expand ==========================
const withExpandColumns = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (expandable) {
let cloneColumns = baseColumns.slice();
// >>> Warning if use `expandIconColumnIndex`
if ( true && expandIconColumnIndex >= 0) {
(0,warning["default"])(false, '`expandIconColumnIndex` is deprecated. Please use `Table.EXPAND_COLUMN` in `columns` instead.');
}
// >>> Insert expand column if not exist
if (!cloneColumns.includes(EXPAND_COLUMN)) {
const expandColIndex = expandIconColumnIndex || 0;
const insertIndex = expandColIndex === 0 && (fixed === 'right' || fixed === 'end') ? baseColumns.length : expandColIndex;
if (insertIndex >= 0) {
cloneColumns.splice(insertIndex, 0, EXPAND_COLUMN);
}
}
// >>> Deduplicate additional expand column
if ( true && cloneColumns.filter(c => c === EXPAND_COLUMN).length > 1) {
(0,warning["default"])(false, 'There exist more than one `EXPAND_COLUMN` in `columns`.');
}
const expandColumnIndex = cloneColumns.indexOf(EXPAND_COLUMN);
cloneColumns = cloneColumns.filter((column, index) => column !== EXPAND_COLUMN || index === expandColumnIndex);
// >>> Check if expand column need to fixed
const prevColumn = baseColumns[expandColumnIndex];
let fixedColumn;
if (fixed) {
fixedColumn = fixed;
} else {
fixedColumn = prevColumn ? prevColumn.fixed : null;
}
// >>> Create expandable column
const expandColumn = {
[INTERNAL_COL_DEFINE]: {
className: `${prefixCls}-expand-icon-col`,
columnType: 'EXPAND_COLUMN'
},
title: columnTitle,
fixed: fixedColumn,
className: `${prefixCls}-row-expand-icon-cell`,
width: columnWidth,
render: (_, record, index) => {
const rowKey = getRowKey(record, index);
const expanded = expandedKeys.has(rowKey);
const recordExpandable = rowExpandable ? rowExpandable(record) : true;
const icon = expandIcon({
prefixCls,
expanded,
expandable: recordExpandable,
record,
onExpand: onTriggerExpand
});
if (expandRowByClick) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
onClick: e => e.stopPropagation()
}, icon);
}
return icon;
}
};
return cloneColumns.map((col, index) => {
const column = col === EXPAND_COLUMN ? expandColumn : col;
if (index < expandedRowOffset) {
return {
...column,
fixed: column.fixed || 'start'
};
}
return column;
});
}
if ( true && baseColumns.includes(EXPAND_COLUMN)) {
(0,warning["default"])(false, '`expandable` is not config but there exist `EXPAND_COLUMN` in `columns`.');
}
return baseColumns.filter(col => col !== EXPAND_COLUMN);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [expandable, baseColumns, getRowKey, expandedKeys, expandIcon, direction, expandedRowOffset]);
// ========================= Transform ========================
const mergedColumns = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
let finalColumns = withExpandColumns;
if (transformColumns) {
finalColumns = transformColumns(finalColumns);
}
// Always provides at least one column for table display
if (!finalColumns.length) {
finalColumns = [{
render: () => null
}];
}
return finalColumns;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [transformColumns, withExpandColumns, direction]);
// ========================== Flatten =========================
const flattenColumns = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => flatColumns(mergedColumns),
// eslint-disable-next-line react-hooks/exhaustive-deps
[mergedColumns, direction, scrollWidth]);
// ========================= FillWidth ========================
const [filledColumns, realScrollWidth] = useWidthColumns(flattenColumns, scrollWidth, clientWidth);
return [mergedColumns, filledColumns, realScrollWidth];
}
/* harmony default export */ var hooks_useColumns = (useColumns);
;// ./node_modules/@rc-component/table/es/hooks/useExpand.js
function useExpand(props, mergedData, getRowKey) {
const expandableConfig = getExpandableProps(props);
const {
expandIcon,
expandedRowKeys,
defaultExpandedRowKeys,
defaultExpandAllRows,
expandedRowRender,
onExpand,
onExpandedRowsChange,
childrenColumnName
} = expandableConfig;
const mergedExpandIcon = expandIcon || renderExpandIcon;
const mergedChildrenColumnName = childrenColumnName || 'children';
const expandableType = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (expandedRowRender) {
return 'row';
}
/* eslint-disable no-underscore-dangle */
/**
* Fix https://github.com/ant-design/ant-design/issues/21154
* This is a workaround to not to break current behavior.
* We can remove follow code after final release.
*
* To other developer:
* Do not use `__PARENT_RENDER_ICON__` in prod since we will remove this when refactor
*/
if (props.expandable && props.internalHooks === INTERNAL_HOOKS && props.expandable.__PARENT_RENDER_ICON__ || mergedData.some(record => record && typeof record === 'object' && record[mergedChildrenColumnName])) {
return 'nest';
}
/* eslint-enable */
return false;
}, [!!expandedRowRender, mergedData]);
const [innerExpandedKeys, setInnerExpandedKeys] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(() => {
if (defaultExpandedRowKeys) {
return defaultExpandedRowKeys;
}
if (defaultExpandAllRows) {
return findAllChildrenKeys(mergedData, getRowKey, mergedChildrenColumnName);
}
return [];
});
const mergedExpandedKeys = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => new Set(expandedRowKeys || innerExpandedKeys || []), [expandedRowKeys, innerExpandedKeys]);
const onTriggerExpand = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(record => {
const key = getRowKey(record, mergedData.indexOf(record));
let newExpandedKeys;
const hasKey = mergedExpandedKeys.has(key);
if (hasKey) {
mergedExpandedKeys.delete(key);
newExpandedKeys = [...mergedExpandedKeys];
} else {
newExpandedKeys = [...mergedExpandedKeys, key];
}
setInnerExpandedKeys(newExpandedKeys);
if (onExpand) {
onExpand(!hasKey, record);
}
if (onExpandedRowsChange) {
onExpandedRowsChange(newExpandedKeys);
}
}, [getRowKey, mergedExpandedKeys, mergedData, onExpand, onExpandedRowsChange]);
// Warning if use `expandedRowRender` and nest children in the same time
if ( true && expandedRowRender && mergedData.some(record => {
return Array.isArray(record?.[mergedChildrenColumnName]);
})) {
(0,warning["default"])(false, '`expandedRowRender` should not use with nested Table');
}
return [expandableConfig, expandableType, mergedExpandedKeys, mergedExpandIcon, mergedChildrenColumnName, onTriggerExpand];
}
;// ./node_modules/@rc-component/table/es/hooks/useFixedInfo.js
function useFixedInfo(flattenColumns, stickyOffsets) {
const fixedInfoList = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => flattenColumns.map((_, colIndex) => getCellFixedInfo(colIndex, colIndex, flattenColumns, stickyOffsets)), [flattenColumns, stickyOffsets]);
return (0,useMemo["default"])(() => fixedInfoList, [fixedInfoList], (prev, next) => !(0,isEqual["default"])(prev, next));
}
;// ./node_modules/@rc-component/table/es/hooks/useFrame.js
/**
* Execute code before next frame but async
*/
function useLayoutState(defaultState) {
const stateRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(defaultState);
const [, forceUpdate] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({});
const lastPromiseRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
const updateBatchRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)([]);
function setFrameState(updater) {
updateBatchRef.current.push(updater);
const promise = Promise.resolve();
lastPromiseRef.current = promise;
promise.then(() => {
if (lastPromiseRef.current === promise) {
const prevBatch = updateBatchRef.current;
const prevState = stateRef.current;
updateBatchRef.current = [];
prevBatch.forEach(batchUpdater => {
stateRef.current = batchUpdater(stateRef.current);
});
lastPromiseRef.current = null;
if (prevState !== stateRef.current) {
forceUpdate({});
}
}
});
}
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => () => {
lastPromiseRef.current = null;
}, []);
return [stateRef.current, setFrameState];
}
/** Lock frame, when frame pass reset the lock. */
function useTimeoutLock(defaultState) {
const frameRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(defaultState || null);
const timeoutRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
function cleanUp() {
clearTimeout(timeoutRef.current);
}
function setState(newState) {
frameRef.current = newState;
cleanUp();
timeoutRef.current = setTimeout(() => {
frameRef.current = null;
timeoutRef.current = undefined;
}, 100);
}
function getState() {
return frameRef.current;
}
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => cleanUp, []);
return [setState, getState];
}
;// ./node_modules/@rc-component/table/es/hooks/useHover.js
function useHover() {
const [startRow, setStartRow] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(-1);
const [endRow, setEndRow] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(-1);
const onHover = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback((start, end) => {
setStartRow(start);
setEndRow(end);
}, []);
return [startRow, endRow, onHover];
}
;// ./node_modules/@rc-component/table/es/hooks/useSticky.js
// fix ssr render
const defaultContainer = (0,canUseDom["default"])() ? window : null;
/** Sticky header hooks */
function useSticky(sticky, prefixCls) {
const {
offsetHeader = 0,
offsetSummary = 0,
offsetScroll = 0,
getContainer = () => defaultContainer
} = typeof sticky === 'object' ? sticky : {};
const container = getContainer() || defaultContainer;
const isSticky = !!sticky;
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
return {
isSticky,
stickyClassName: isSticky ? `${prefixCls}-sticky-holder` : '',
offsetHeader,
offsetSummary,
offsetScroll,
container
};
}, [isSticky, offsetScroll, offsetHeader, offsetSummary, prefixCls, container]);
}
;// ./node_modules/@rc-component/table/es/hooks/useStickyOffsets.js
/**
* Get sticky column offset width
*/
function useStickyOffsets(colWidths, flattenColumns) {
const stickyOffsets = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
const columnCount = flattenColumns.length;
const getOffsets = (startIndex, endIndex, offset) => {
const offsets = [];
let total = 0;
for (let i = startIndex; i !== endIndex; i += offset) {
offsets.push(total);
if (flattenColumns[i].fixed) {
total += colWidths[i] || 0;
}
}
return offsets;
};
const startOffsets = getOffsets(0, columnCount, 1);
const endOffsets = getOffsets(columnCount - 1, -1, -1).reverse();
return {
start: startOffsets,
end: endOffsets,
widths: colWidths
};
}, [colWidths, flattenColumns]);
return stickyOffsets;
}
/* harmony default export */ var hooks_useStickyOffsets = (useStickyOffsets);
;// ./node_modules/@rc-component/table/es/Panel/index.js
const es_Panel_Panel = props => {
const {
children,
className,
style
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: className,
style: style
}, children);
};
/* harmony default export */ var es_Panel = (es_Panel_Panel);
;// ./node_modules/@rc-component/table/es/utils/offsetUtil.js
// Copy from `rc-component/util/Dom/css.js`
function offsetUtil_getOffset(node) {
const element = (0,findDOMNode.getDOM)(node);
const box = element.getBoundingClientRect();
const docElem = document.documentElement;
// < ie8 not support win.pageXOffset, use docElem.scrollLeft instead
return {
left: box.left + (window.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || document.body.clientLeft || 0),
top: box.top + (window.pageYOffset || docElem.scrollTop) - (docElem.clientTop || document.body.clientTop || 0)
};
}
;// ./node_modules/@rc-component/table/es/stickyScrollBar.js
const MOUSEUP_EVENT = 'mouseup';
const MOUSEMOVE_EVENT = 'mousemove';
const SCROLL_EVENT = 'scroll';
const RESIZE_EVENT = 'resize';
const StickyScrollBar = (props, ref) => {
const {
scrollBodyRef,
onScroll,
offsetScroll,
container,
direction
} = props;
const prefixCls = useContext(context_TableContext, 'prefixCls');
const bodyScrollWidth = scrollBodyRef.current?.scrollWidth || 0;
const bodyWidth = scrollBodyRef.current?.clientWidth || 0;
const scrollBarWidth = bodyScrollWidth && bodyWidth * (bodyWidth / bodyScrollWidth);
const scrollBarRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const [scrollState, setScrollState] = useLayoutState({
scrollLeft: 0,
isHiddenScrollBar: true
});
const refState = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({
delta: 0,
x: 0
});
const [isActive, setActive] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const rafRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => () => {
raf["default"].cancel(rafRef.current);
}, []);
const onMouseUp = () => {
setActive(false);
};
const onMouseDown = event => {
event.persist();
refState.current.delta = event.pageX - scrollState.scrollLeft;
refState.current.x = 0;
setActive(true);
event.preventDefault();
};
const onMouseMove = event => {
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
const {
buttons
} = event || window?.event;
if (!isActive || buttons === 0) {
// If out body mouse up, we can set isActive false when mouse move
if (isActive) {
setActive(false);
}
return;
}
let left = refState.current.x + event.pageX - refState.current.x - refState.current.delta;
const isRTL = direction === 'rtl';
// Limit scroll range
left = Math.max(isRTL ? scrollBarWidth - bodyWidth : 0, Math.min(isRTL ? 0 : bodyWidth - scrollBarWidth, left));
// Calculate the scroll position and update
const shouldScroll = !isRTL || Math.abs(left) + Math.abs(scrollBarWidth) < bodyWidth;
if (shouldScroll) {
onScroll({
scrollLeft: left / bodyWidth * (bodyScrollWidth + 2)
});
refState.current.x = event.pageX;
}
};
const checkScrollBarVisible = () => {
raf["default"].cancel(rafRef.current);
rafRef.current = (0,raf["default"])(() => {
if (!scrollBodyRef.current) {
return;
}
const tableOffsetTop = offsetUtil_getOffset(scrollBodyRef.current).top;
const tableBottomOffset = tableOffsetTop + scrollBodyRef.current.offsetHeight;
const currentClientOffset = container === window ? document.documentElement.scrollTop + window.innerHeight : offsetUtil_getOffset(container).top + container.clientHeight;
if (tableBottomOffset - getScrollBarSize() <= currentClientOffset || tableOffsetTop >= currentClientOffset - offsetScroll) {
setScrollState(state => ({
...state,
isHiddenScrollBar: true
}));
} else {
setScrollState(state => ({
...state,
isHiddenScrollBar: false
}));
}
});
};
const setScrollLeft = left => {
setScrollState(state => {
return {
...state,
scrollLeft: left / bodyScrollWidth * bodyWidth || 0
};
});
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
setScrollLeft,
checkScrollBarVisible
}));
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
document.body.addEventListener(MOUSEUP_EVENT, onMouseUp, false);
document.body.addEventListener(MOUSEMOVE_EVENT, onMouseMove, false);
checkScrollBarVisible();
return () => {
document.body.removeEventListener(MOUSEUP_EVENT, onMouseUp);
document.body.removeEventListener(MOUSEMOVE_EVENT, onMouseMove);
};
}, [scrollBarWidth, isActive]);
// Loop for scroll event check
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (scrollBodyRef.current) {
const scrollParents = [];
let parent = (0,findDOMNode.getDOM)(scrollBodyRef.current);
while (parent) {
scrollParents.push(parent);
parent = parent.parentElement;
}
scrollParents.forEach(p => {
p.addEventListener(SCROLL_EVENT, checkScrollBarVisible, false);
});
window.addEventListener(RESIZE_EVENT, checkScrollBarVisible, false);
window.addEventListener(SCROLL_EVENT, checkScrollBarVisible, false);
container.addEventListener(SCROLL_EVENT, checkScrollBarVisible, false);
return () => {
scrollParents.forEach(p => {
p.removeEventListener(SCROLL_EVENT, checkScrollBarVisible);
});
window.removeEventListener(RESIZE_EVENT, checkScrollBarVisible);
window.removeEventListener(SCROLL_EVENT, checkScrollBarVisible);
container.removeEventListener(SCROLL_EVENT, checkScrollBarVisible);
};
}
}, [container]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (!scrollState.isHiddenScrollBar) {
setScrollState(state => {
const bodyNode = scrollBodyRef.current;
if (!bodyNode) {
return state;
}
return {
...state,
scrollLeft: bodyNode.scrollLeft / bodyNode.scrollWidth * bodyNode.clientWidth
};
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [scrollState.isHiddenScrollBar]);
if (bodyScrollWidth <= bodyWidth || !scrollBarWidth || scrollState.isHiddenScrollBar) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
style: {
height: getScrollBarSize(),
width: bodyWidth,
bottom: offsetScroll
},
className: `${prefixCls}-sticky-scroll`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
onMouseDown: onMouseDown,
ref: scrollBarRef,
className: (0,clsx.clsx)(`${prefixCls}-sticky-scroll-bar`, {
[`${prefixCls}-sticky-scroll-bar-active`]: isActive
}),
style: {
width: `${scrollBarWidth}px`,
transform: `translate3d(${scrollState.scrollLeft}px, 0, 0)`
}
}));
};
/* harmony default export */ var stickyScrollBar = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(StickyScrollBar));
;// ./node_modules/@rc-component/table/es/Table.js
function Table_extends() { Table_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Table_extends.apply(this, arguments); }
/**
* Feature:
* - fixed not need to set width
* - support `rowExpandable` to config row expand logic
* - add `summary` to support `() => ReactNode`
*
* Update:
* - `dataIndex` is `array[]` now
* - `expandable` wrap all the expand related props
*
* Removed:
* - expandIconAsCell
* - useFixedHeader
* - rowRef
* - columns[number].onCellClick
* - onRowClick
* - onRowDoubleClick
* - onRowMouseEnter
* - onRowMouseLeave
* - getBodyWrapper
* - bodyStyle
*
* Deprecated:
* - All expanded props, move into expandable
*/
const DEFAULT_PREFIX = 'rc-table';
// Used for conditions cache
const Table_EMPTY_DATA = [];
// Used for customize scroll
const EMPTY_SCROLL_TARGET = {};
function defaultEmpty() {
return 'No Data';
}
const Table = (tableProps, ref) => {
const props = {
rowKey: 'key',
prefixCls: DEFAULT_PREFIX,
emptyText: defaultEmpty,
...tableProps
};
const {
prefixCls,
className,
rowClassName,
style,
classNames,
styles,
data,
rowKey,
scroll,
tableLayout,
direction,
// Additional Part
title,
footer,
summary,
caption,
// Customize
id,
showHeader,
components,
emptyText,
onRow,
onHeaderRow,
// Measure Row
measureRowRender,
// Events
onScroll,
// Internal
internalHooks,
transformColumns,
internalRefs,
tailor,
getContainerWidth,
sticky,
rowHoverable = true
} = props;
const mergedData = data || Table_EMPTY_DATA;
const hasData = !!mergedData.length;
const useInternalHooks = internalHooks === INTERNAL_HOOKS;
// ===================== Warning ======================
if (true) {
['onRowClick', 'onRowDoubleClick', 'onRowContextMenu', 'onRowMouseEnter', 'onRowMouseLeave'].forEach(name => {
(0,warning["default"])(props[name] === undefined, `\`${name}\` is removed, please use \`onRow\` instead.`);
});
(0,warning["default"])(!('getBodyWrapper' in props), '`getBodyWrapper` is deprecated, please use custom `components` instead.');
}
// ==================== Customize =====================
const getComponent = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback((path, defaultComponent) => (0,get["default"])(components, path) || defaultComponent, [components]);
const getRowKey = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (typeof rowKey === 'function') {
return rowKey;
}
return record => {
const key = record && record[rowKey];
if (true) {
(0,warning["default"])(key !== undefined, 'Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key.');
}
return key;
};
}, [rowKey]);
const customizeScrollBody = getComponent(['body']);
// ====================== Hover =======================
const [startRow, endRow, onHover] = useHover();
// ====================== Expand ======================
const [expandableConfig, expandableType, mergedExpandedKeys, mergedExpandIcon, mergedChildrenColumnName, onTriggerExpand] = useExpand(props, mergedData, getRowKey);
// ====================== Column ======================
const scrollX = scroll?.x;
const [componentWidth, setComponentWidth] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const [columns, flattenColumns, flattenScrollX] = hooks_useColumns({
...props,
...expandableConfig,
expandable: !!expandableConfig.expandedRowRender,
columnTitle: expandableConfig.columnTitle,
expandedKeys: mergedExpandedKeys,
getRowKey,
// https://github.com/ant-design/ant-design/issues/23894
onTriggerExpand,
expandIcon: mergedExpandIcon,
expandIconColumnIndex: expandableConfig.expandIconColumnIndex,
direction,
scrollWidth: useInternalHooks && tailor && typeof scrollX === 'number' ? scrollX : null,
clientWidth: componentWidth
}, useInternalHooks ? transformColumns : null);
const mergedScrollX = flattenScrollX ?? scrollX;
const columnContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
columns,
flattenColumns
}), [columns, flattenColumns]);
// ======================= Refs =======================
const fullTableRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const scrollHeaderRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const scrollBodyRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const scrollBodyContainerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => {
return {
nativeElement: fullTableRef.current,
scrollTo: config => {
if (scrollBodyRef.current instanceof HTMLElement) {
// Native scroll
const {
index,
top,
key,
offset
} = config;
if (validNumberValue(top)) {
// In top mode, offset is ignored
scrollBodyRef.current?.scrollTo({
top
});
} else {
const mergedKey = key ?? getRowKey(mergedData[index]);
const targetElement = scrollBodyRef.current.querySelector(`[data-row-key="${mergedKey}"]`);
if (targetElement) {
if (!offset) {
// No offset, use scrollIntoView for default behavior
targetElement.scrollIntoView();
} else {
// With offset, use element's offsetTop + offset
const elementTop = targetElement.offsetTop;
scrollBodyRef.current.scrollTo({
top: elementTop + offset
});
}
}
}
} else if (scrollBodyRef.current?.scrollTo) {
// Pass to proxy
scrollBodyRef.current.scrollTo(config);
}
}
};
});
// ====================== Scroll ======================
const scrollSummaryRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const [shadowStart, setShadowStart] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const [shadowEnd, setShadowEnd] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const [colsWidths, updateColsWidths] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(new Map());
// Convert map to number width
const colsKeys = getColumnsKey(flattenColumns);
const pureColWidths = colsKeys.map(columnKey => colsWidths.get(columnKey));
const colWidths = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => pureColWidths, [pureColWidths.join('_')]);
const stickyOffsets = hooks_useStickyOffsets(colWidths, flattenColumns);
const fixHeader = scroll && validateValue(scroll.y);
const horizonScroll = scroll && validateValue(mergedScrollX) || Boolean(expandableConfig.fixed);
const fixColumn = horizonScroll && flattenColumns.some(({
fixed
}) => fixed);
// Sticky
const stickyRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const {
isSticky,
offsetHeader,
offsetSummary,
offsetScroll,
stickyClassName,
container
} = useSticky(sticky, prefixCls);
// Footer (Fix footer must fixed header)
const summaryNode = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => summary?.(mergedData), [summary, mergedData]);
const fixFooter = (fixHeader || isSticky) && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(summaryNode) && summaryNode.type === Footer_Summary && summaryNode.props.fixed;
// Scroll
let scrollXStyle;
let scrollYStyle;
let scrollTableStyle;
if (fixHeader) {
scrollYStyle = {
overflowY: hasData ? 'scroll' : 'auto',
maxHeight: scroll.y
};
}
if (horizonScroll) {
scrollXStyle = {
overflowX: 'auto'
};
// When no vertical scrollbar, should hide it
// https://github.com/ant-design/ant-design/pull/20705
// https://github.com/ant-design/ant-design/issues/21879
if (!fixHeader) {
scrollYStyle = {
overflowY: 'hidden'
};
}
scrollTableStyle = {
width: mergedScrollX === true ? 'auto' : mergedScrollX,
minWidth: '100%'
};
}
const onColumnResize = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback((columnKey, width) => {
updateColsWidths(widths => {
if (widths.get(columnKey) !== width) {
const newWidths = new Map(widths);
newWidths.set(columnKey, width);
return newWidths;
}
return widths;
});
}, []);
const [setScrollTarget, getScrollTarget] = useTimeoutLock(null);
function forceScroll(scrollLeft, target) {
if (!target) {
return;
}
if (typeof target === 'function') {
target(scrollLeft);
} else if (target.scrollLeft !== scrollLeft) {
target.scrollLeft = scrollLeft;
// Delay to force scroll position if not sync
// ref: https://github.com/ant-design/ant-design/issues/37179
if (target.scrollLeft !== scrollLeft) {
setTimeout(() => {
target.scrollLeft = scrollLeft;
}, 0);
}
}
}
const [scrollInfo, setScrollInfo] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([0, 0]);
const onInternalScroll = (0,useEvent["default"])(({
currentTarget,
scrollLeft
}) => {
const mergedScrollLeft = typeof scrollLeft === 'number' ? scrollLeft : currentTarget.scrollLeft;
const compareTarget = currentTarget || EMPTY_SCROLL_TARGET;
if (!getScrollTarget() || getScrollTarget() === compareTarget) {
setScrollTarget(compareTarget);
forceScroll(mergedScrollLeft, scrollHeaderRef.current);
forceScroll(mergedScrollLeft, scrollBodyRef.current);
forceScroll(mergedScrollLeft, scrollSummaryRef.current);
forceScroll(mergedScrollLeft, stickyRef.current?.setScrollLeft);
}
const measureTarget = currentTarget || scrollHeaderRef.current;
if (measureTarget) {
const scrollWidth =
// Should use mergedScrollX in virtual table(useInternalHooks && tailor === true)
useInternalHooks && tailor && typeof mergedScrollX === 'number' ? mergedScrollX : measureTarget.scrollWidth;
const clientWidth = measureTarget.clientWidth;
const absScrollStart = Math.abs(mergedScrollLeft);
setScrollInfo(ori => {
const nextScrollInfo = [absScrollStart, scrollWidth - clientWidth];
return (0,isEqual["default"])(ori, nextScrollInfo) ? ori : nextScrollInfo;
});
// There is no space to scroll
if (scrollWidth === clientWidth) {
setShadowStart(false);
setShadowEnd(false);
return;
}
setShadowStart(absScrollStart > 0);
setShadowEnd(absScrollStart < scrollWidth - clientWidth - 1);
}
});
const onBodyScroll = (0,useEvent["default"])(e => {
onInternalScroll(e);
onScroll?.(e);
});
const triggerOnScroll = () => {
if (horizonScroll && scrollBodyRef.current) {
onInternalScroll({
currentTarget: (0,findDOMNode.getDOM)(scrollBodyRef.current),
scrollLeft: scrollBodyRef.current?.scrollLeft
});
} else {
setShadowStart(false);
setShadowEnd(false);
}
};
const onFullTableResize = offsetWidth => {
stickyRef.current?.checkScrollBarVisible();
let mergedWidth = offsetWidth ?? fullTableRef.current?.offsetWidth ?? 0;
if (useInternalHooks && getContainerWidth && fullTableRef.current) {
mergedWidth = getContainerWidth(fullTableRef.current, mergedWidth) || mergedWidth;
}
if (mergedWidth !== componentWidth) {
triggerOnScroll();
setComponentWidth(mergedWidth);
}
};
// fix https://github.com/ant-design/ant-design/issues/49279
(0,useLayoutEffect["default"])(() => {
if (horizonScroll) {
onFullTableResize();
}
}, [horizonScroll]);
// Sync scroll bar when init or `horizonScroll`, `data` and `columns.length` changed
const mounted = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
// onFullTableResize will be trigger once when ResizeObserver is mounted
// This will reduce one duplicated triggerOnScroll time
if (mounted.current) {
triggerOnScroll();
}
}, [horizonScroll, data, columns.length]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
mounted.current = true;
}, []);
// ===================== Effects ======================
const [scrollbarSize, setScrollbarSize] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
(0,useLayoutEffect["default"])(() => {
if (!tailor || !useInternalHooks) {
if (scrollBodyRef.current instanceof Element) {
setScrollbarSize(getTargetScrollBarSize(scrollBodyRef.current).width);
} else {
setScrollbarSize(getTargetScrollBarSize(scrollBodyContainerRef.current).width);
}
}
}, []);
// ================== INTERNAL HOOKS ==================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (useInternalHooks && internalRefs) {
internalRefs.body.current = scrollBodyRef.current;
}
});
// ========================================================================
// == Render ==
// ========================================================================
// =================== Render: Func ===================
const renderFixedHeaderTable = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(fixedHolderPassProps => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Header_Header, fixedHolderPassProps), fixFooter === 'top' && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Footer, fixedHolderPassProps, summaryNode)), [fixFooter, summaryNode]);
const renderFixedFooterTable = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(fixedHolderPassProps => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Footer, fixedHolderPassProps, summaryNode), [summaryNode]);
// =================== Render: Node ===================
const TableComponent = getComponent(['table'], 'table');
// Table layout
const mergedTableLayout = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (tableLayout) {
return tableLayout;
}
// https://github.com/ant-design/ant-design/issues/25227
// When scroll.x is max-content, no need to fix table layout
// it's width should stretch out to fit content
if (fixColumn) {
return mergedScrollX === 'max-content' ? 'auto' : 'fixed';
}
if (fixHeader || isSticky || flattenColumns.some(({
ellipsis
}) => ellipsis)) {
return 'fixed';
}
return 'auto';
}, [fixHeader, fixColumn, flattenColumns, tableLayout, isSticky]);
let groupTableNode;
// Header props
const headerProps = {
colWidths,
columCount: flattenColumns.length,
stickyOffsets,
onHeaderRow,
fixHeader,
scroll
};
// Empty
const emptyNode = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (hasData) {
return null;
}
if (typeof emptyText === 'function') {
return emptyText();
}
return emptyText;
}, [hasData, emptyText]);
// Body
const bodyTable = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Body, {
data: mergedData,
measureColumnWidth: fixHeader || horizonScroll || isSticky
});
const bodyColGroup = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_ColGroup, {
colWidths: flattenColumns.map(({
width
}) => width),
columns: flattenColumns
});
const captionElement = caption !== null && caption !== undefined ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("caption", {
className: `${prefixCls}-caption`
}, caption) : undefined;
const dataProps = (0,pickAttrs["default"])(props, {
data: true
});
const ariaProps = (0,pickAttrs["default"])(props, {
aria: true
});
if (fixHeader || isSticky) {
// >>>>>> Fixed Header
let bodyContent;
if (typeof customizeScrollBody === 'function') {
bodyContent = customizeScrollBody(mergedData, {
scrollbarSize,
ref: scrollBodyRef,
onScroll: onInternalScroll
});
headerProps.colWidths = flattenColumns.map(({
width
}, index) => {
const colWidth = index === flattenColumns.length - 1 ? width - scrollbarSize : width;
if (typeof colWidth === 'number' && !Number.isNaN(colWidth)) {
return colWidth;
}
if (true) {
(0,warning["default"])(props.columns.length === 0, 'When use `components.body` with render props. Each column should have a fixed `width` value.');
}
return 0;
});
} else {
bodyContent = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
style: {
...scrollXStyle,
...scrollYStyle
},
onScroll: onBodyScroll,
ref: scrollBodyRef,
className: `${prefixCls}-body`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TableComponent, Table_extends({
style: {
...scrollTableStyle,
tableLayout: mergedTableLayout
}
}, ariaProps), captionElement, bodyColGroup, bodyTable, !fixFooter && summaryNode && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Footer, {
stickyOffsets: stickyOffsets,
flattenColumns: flattenColumns
}, summaryNode)));
}
// Fixed holder share the props
const fixedHolderProps = {
noData: !mergedData.length,
maxContentScroll: horizonScroll && mergedScrollX === 'max-content',
...headerProps,
...columnContext,
direction,
stickyClassName,
scrollX: mergedScrollX,
tableLayout: mergedTableLayout,
onScroll: onInternalScroll
};
groupTableNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, showHeader !== false && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_FixedHolder, Table_extends({}, fixedHolderProps, {
stickyTopOffset: offsetHeader,
className: `${prefixCls}-header`,
ref: scrollHeaderRef,
colGroup: bodyColGroup
}), renderFixedHeaderTable), bodyContent, fixFooter && fixFooter !== 'top' && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_FixedHolder, Table_extends({}, fixedHolderProps, {
stickyBottomOffset: offsetSummary,
className: `${prefixCls}-summary`,
ref: scrollSummaryRef,
colGroup: bodyColGroup
}), renderFixedFooterTable), isSticky && scrollBodyRef.current && scrollBodyRef.current instanceof Element && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(stickyScrollBar, {
ref: stickyRef,
offsetScroll: offsetScroll,
scrollBodyRef: scrollBodyRef,
onScroll: onInternalScroll,
container: container,
direction: direction
}));
} else {
// >>>>>> Unique table
groupTableNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
style: {
...scrollXStyle,
...scrollYStyle,
...styles?.content
},
className: (0,clsx.clsx)(`${prefixCls}-content`, classNames?.content),
onScroll: onInternalScroll,
ref: scrollBodyRef
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TableComponent, Table_extends({
style: {
...scrollTableStyle,
tableLayout: mergedTableLayout
}
}, ariaProps), captionElement, bodyColGroup, showHeader !== false && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Header_Header, Table_extends({}, headerProps, columnContext)), bodyTable, summaryNode && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Footer, {
stickyOffsets: stickyOffsets,
flattenColumns: flattenColumns
}, summaryNode)));
}
const tableStyle = {
...style
};
// Add css var for sticky header `zIndex` calc
if (isSticky) {
tableStyle['--columns-count'] = flattenColumns.length;
}
let fullTable = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", Table_extends({
className: (0,clsx.clsx)(prefixCls, className, {
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-fix-start-shadow`]: horizonScroll,
[`${prefixCls}-fix-end-shadow`]: horizonScroll,
[`${prefixCls}-fix-start-shadow-show`]: horizonScroll && shadowStart,
[`${prefixCls}-fix-end-shadow-show`]: horizonScroll && shadowEnd,
[`${prefixCls}-layout-fixed`]: tableLayout === 'fixed',
[`${prefixCls}-fixed-header`]: fixHeader,
/** No used but for compatible */
[`${prefixCls}-fixed-column`]: fixColumn,
[`${prefixCls}-scroll-horizontal`]: horizonScroll,
[`${prefixCls}-has-fix-start`]: flattenColumns[0]?.fixed,
[`${prefixCls}-has-fix-end`]: flattenColumns[flattenColumns.length - 1]?.fixed === 'end'
}),
style: tableStyle,
id: id,
ref: fullTableRef
}, dataProps), title && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Panel, {
className: (0,clsx.clsx)(`${prefixCls}-title`, classNames?.title),
style: styles?.title
}, title(mergedData)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: scrollBodyContainerRef,
className: (0,clsx.clsx)(`${prefixCls}-container`, classNames?.section),
style: styles?.section
}, groupTableNode), footer && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Panel, {
className: (0,clsx.clsx)(`${prefixCls}-footer`, classNames?.footer),
style: styles?.footer
}, footer(mergedData)));
if (horizonScroll) {
fullTable = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(resize_observer_es, {
onResize: ({
offsetWidth
}) => onFullTableResize(offsetWidth)
}, fullTable);
}
const fixedInfoList = useFixedInfo(flattenColumns, stickyOffsets);
const TableContextValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
// Scroll
scrollX: mergedScrollX,
scrollInfo,
classNames,
styles,
// Table
prefixCls,
getComponent,
scrollbarSize,
direction,
fixedInfoList,
isSticky,
componentWidth,
fixHeader,
fixColumn,
horizonScroll,
// Body
tableLayout: mergedTableLayout,
rowClassName,
expandedRowClassName: expandableConfig.expandedRowClassName,
expandIcon: mergedExpandIcon,
expandableType,
expandRowByClick: expandableConfig.expandRowByClick,
expandedRowRender: expandableConfig.expandedRowRender,
expandedRowOffset: expandableConfig.expandedRowOffset,
onTriggerExpand,
expandIconColumnIndex: expandableConfig.expandIconColumnIndex,
indentSize: expandableConfig.indentSize,
allColumnsFixedLeft: flattenColumns.every(col => col.fixed === 'start'),
emptyNode,
// Column
columns,
flattenColumns,
onColumnResize,
colWidths,
// Row
hoverStartRow: startRow,
hoverEndRow: endRow,
onHover,
rowExpandable: expandableConfig.rowExpandable,
onRow,
getRowKey,
expandedKeys: mergedExpandedKeys,
childrenColumnName: mergedChildrenColumnName,
rowHoverable,
// Measure Row
measureRowRender
}), [
// Scroll
mergedScrollX, scrollInfo, classNames, styles,
// Table
prefixCls, getComponent, scrollbarSize, direction, fixedInfoList, isSticky, componentWidth, fixHeader, fixColumn, horizonScroll,
// Body
mergedTableLayout, rowClassName, expandableConfig.expandedRowClassName, mergedExpandIcon, expandableType, expandableConfig.expandRowByClick, expandableConfig.expandedRowRender, expandableConfig.expandedRowOffset, onTriggerExpand, expandableConfig.expandIconColumnIndex, expandableConfig.indentSize, emptyNode,
// Column
columns, flattenColumns, onColumnResize, colWidths,
// Row
startRow, endRow, onHover, expandableConfig.rowExpandable, onRow, getRowKey, mergedExpandedKeys, mergedChildrenColumnName, rowHoverable, measureRowRender]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(context_TableContext.Provider, {
value: TableContextValue
}, fullTable);
};
const RefTable = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(Table);
if (true) {
RefTable.displayName = 'Table';
}
const genTable = shouldTriggerRender => {
return TableContext_makeImmutable(RefTable, shouldTriggerRender);
};
const ImmutableTable = genTable();
ImmutableTable.EXPAND_COLUMN = EXPAND_COLUMN;
ImmutableTable.INTERNAL_HOOKS = INTERNAL_HOOKS;
ImmutableTable.Column = sugar_Column;
ImmutableTable.ColumnGroup = sugar_ColumnGroup;
ImmutableTable.Summary = FooterComponents;
/* harmony default export */ var es_Table = (ImmutableTable);
;// ./node_modules/@rc-component/table/es/VirtualTable/context.js
const StaticContext = createContext(null);
const GridContext = createContext(null);
;// ./node_modules/@rc-component/table/es/VirtualTable/VirtualCell.js
function VirtualCell_extends() { VirtualCell_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return VirtualCell_extends.apply(this, arguments); }
/**
* Return the width of the column by `colSpan`.
* When `colSpan` is `0` will be trade as `1`.
*/
function getColumnWidth(colIndex, colSpan, columnsOffset) {
const mergedColSpan = colSpan || 1;
return columnsOffset[colIndex + mergedColSpan] - (columnsOffset[colIndex] || 0);
}
const VirtualCell = props => {
const {
rowInfo,
column,
colIndex,
indent,
index,
component,
renderIndex,
record,
style,
className,
inverse,
getHeight
} = props;
const {
render,
dataIndex,
className: columnClassName,
width: colWidth
} = column;
const {
columnsOffset
} = useContext(GridContext, ['columnsOffset']);
// TODO: support `expandableRowOffset`
const {
key,
fixedInfo,
appendCellNode,
additionalCellProps
} = getCellProps(rowInfo, column, colIndex, indent, index);
const {
style: cellStyle,
colSpan = 1,
rowSpan = 1
} = additionalCellProps;
// ========================= ColWidth =========================
// column width
const startColIndex = colIndex - 1;
const concatColWidth = getColumnWidth(startColIndex, colSpan, columnsOffset);
// margin offset
const marginOffset = colSpan > 1 ? colWidth - concatColWidth : 0;
// ========================== Style ===========================
const mergedStyle = {
...cellStyle,
...style,
flex: `0 0 ${concatColWidth}px`,
width: `${concatColWidth}px`,
marginRight: marginOffset,
pointerEvents: 'auto'
};
// When `colSpan` or `rowSpan` is `0`, should skip render.
const needHide = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (inverse) {
return rowSpan <= 1;
} else {
return colSpan === 0 || rowSpan === 0 || rowSpan > 1;
}
}, [rowSpan, colSpan, inverse]);
// 0 rowSpan or colSpan should not render
if (needHide) {
mergedStyle.visibility = 'hidden';
} else if (inverse) {
mergedStyle.height = getHeight?.(rowSpan);
}
const mergedRender = needHide ? () => null : render;
// ========================== Render ==========================
const cellSpan = {};
// Virtual should reset `colSpan` & `rowSpan`
if (rowSpan === 0 || colSpan === 0) {
cellSpan.rowSpan = 1;
cellSpan.colSpan = 1;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Cell, VirtualCell_extends({
className: (0,clsx.clsx)(columnClassName, className),
ellipsis: column.ellipsis,
align: column.align,
scope: column.rowScope,
component: component,
prefixCls: rowInfo.prefixCls,
key: key,
record: record,
index: index,
renderIndex: renderIndex,
dataIndex: dataIndex,
render: mergedRender,
shouldCellUpdate: column.shouldCellUpdate
}, fixedInfo, {
appendNode: appendCellNode,
additionalProps: {
...additionalCellProps,
style: mergedStyle,
...cellSpan
}
}));
};
/* harmony default export */ var VirtualTable_VirtualCell = (VirtualCell);
;// ./node_modules/@rc-component/table/es/VirtualTable/BodyLine.js
function BodyLine_extends() { BodyLine_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return BodyLine_extends.apply(this, arguments); }
const BodyLine = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
data,
index,
className,
rowKey,
style,
extra,
getHeight,
...restProps
} = props;
const {
record,
indent,
index: renderIndex
} = data;
const {
scrollX,
flattenColumns,
prefixCls,
fixColumn,
componentWidth
} = useContext(context_TableContext, ['prefixCls', 'flattenColumns', 'fixColumn', 'componentWidth', 'scrollX']);
const {
getComponent
} = useContext(StaticContext, ['getComponent']);
const rowInfo = useRowInfo(record, rowKey, index, indent);
const RowComponent = getComponent(['body', 'row'], 'div');
const cellComponent = getComponent(['body', 'cell'], 'div');
// ========================== Expand ==========================
const {
rowSupportExpand,
expanded,
rowProps,
expandedRowRender,
expandedRowClassName
} = rowInfo;
let expandRowNode;
if (rowSupportExpand && expanded) {
const expandContent = expandedRowRender(record, index, indent + 1, expanded);
const expandedClsName = computedExpandedClassName(expandedRowClassName, record, index, indent);
let additionalProps = {};
if (fixColumn) {
additionalProps = {
style: {
['--virtual-width']: `${componentWidth}px`
}
};
}
const rowCellCls = `${prefixCls}-expanded-row-cell`;
expandRowNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RowComponent, {
className: (0,clsx.clsx)(`${prefixCls}-expanded-row`, `${prefixCls}-expanded-row-level-${indent + 1}`, expandedClsName)
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Cell, {
component: cellComponent,
prefixCls: prefixCls,
className: (0,clsx.clsx)(rowCellCls, {
[`${rowCellCls}-fixed`]: fixColumn
}),
additionalProps: additionalProps
}, expandContent));
}
// ========================== Render ==========================
const rowStyle = {
...style,
width: scrollX
};
if (extra) {
rowStyle.position = 'absolute';
rowStyle.pointerEvents = 'none';
}
const rowNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RowComponent, BodyLine_extends({}, rowProps, restProps, {
"data-row-key": rowKey,
ref: rowSupportExpand ? null : ref,
className: (0,clsx.clsx)(className, `${prefixCls}-row`, rowProps?.className, {
[`${prefixCls}-row-extra`]: extra
}),
style: {
...rowStyle,
...rowProps?.style
}
}), flattenColumns.map((column, colIndex) => {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(VirtualTable_VirtualCell, {
key: colIndex,
component: cellComponent,
rowInfo: rowInfo,
column: column,
colIndex: colIndex,
indent: indent,
index: index,
renderIndex: renderIndex,
record: record,
inverse: extra,
getHeight: getHeight
});
}));
if (rowSupportExpand) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: ref
}, rowNode, expandRowNode);
}
return rowNode;
});
const ResponseBodyLine = TableContext_responseImmutable(BodyLine);
if (true) {
ResponseBodyLine.displayName = 'BodyLine';
}
/* harmony default export */ var VirtualTable_BodyLine = (ResponseBodyLine);
;// ./node_modules/@rc-component/table/es/VirtualTable/BodyGrid.js
const Grid = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
data,
onScroll
} = props;
const {
flattenColumns,
onColumnResize,
getRowKey,
expandedKeys,
prefixCls,
childrenColumnName,
scrollX,
direction
} = useContext(context_TableContext, ['flattenColumns', 'onColumnResize', 'getRowKey', 'prefixCls', 'expandedKeys', 'childrenColumnName', 'scrollX', 'direction']);
const {
sticky,
scrollY,
listItemHeight,
getComponent,
onScroll: onTablePropScroll
} = useContext(StaticContext);
// =========================== Ref ============================
const listRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
// =========================== Data ===========================
const flattenData = useFlattenRecords(data, childrenColumnName, expandedKeys, getRowKey);
// ========================== Column ==========================
const columnsWidth = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
let total = 0;
return flattenColumns.map(({
width,
minWidth,
key
}) => {
const finalWidth = Math.max(width || 0, minWidth || 0);
total += finalWidth;
return [key, finalWidth, total];
});
}, [flattenColumns]);
const columnsOffset = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => columnsWidth.map(colWidth => colWidth[2]), [columnsWidth]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
columnsWidth.forEach(([key, width]) => {
onColumnResize(key, width);
});
}, [columnsWidth]);
// =========================== Ref ============================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => {
const obj = {
scrollTo: config => {
const {
offset,
...restConfig
} = config;
// If offset is provided, force align to 'top' for consistent behavior
if (offset) {
listRef.current?.scrollTo({
...restConfig,
offset,
align: 'top'
});
} else {
listRef.current?.scrollTo(config);
}
},
nativeElement: listRef.current?.nativeElement
};
Object.defineProperty(obj, 'scrollLeft', {
get: () => listRef.current?.getScrollInfo().x || 0,
set: value => {
listRef.current?.scrollTo({
left: value
});
}
});
// https://github.com/ant-design/ant-design/issues/54734
Object.defineProperty(obj, 'scrollTop', {
get: () => listRef.current?.getScrollInfo().y || 0,
set: value => {
listRef.current?.scrollTo({
top: value
});
}
});
return obj;
});
// ======================= Col/Row Span =======================
const getRowSpan = (column, index) => {
const record = flattenData[index]?.record;
const {
onCell
} = column;
if (onCell) {
const cellProps = onCell(record, index);
return cellProps?.rowSpan ?? 1;
}
return 1;
};
const extraRender = info => {
const {
start,
end,
getSize,
offsetY
} = info;
// Do nothing if no data
if (end < 0) {
return null;
}
// Find first rowSpan column
let firstRowSpanColumns = flattenColumns.filter(
// rowSpan is 0
column => getRowSpan(column, start) === 0);
let startIndex = start;
for (let i = start; i >= 0; i -= 1) {
firstRowSpanColumns = firstRowSpanColumns.filter(column => getRowSpan(column, i) === 0);
if (!firstRowSpanColumns.length) {
startIndex = i;
break;
}
}
// Find last rowSpan column
let lastRowSpanColumns = flattenColumns.filter(
// rowSpan is not 1
column => getRowSpan(column, end) !== 1);
let endIndex = end;
for (let i = end; i < flattenData.length; i += 1) {
lastRowSpanColumns = lastRowSpanColumns.filter(column => getRowSpan(column, i) !== 1);
if (!lastRowSpanColumns.length) {
endIndex = Math.max(i - 1, end);
break;
}
}
// Collect the line who has rowSpan
const spanLines = [];
for (let i = startIndex; i <= endIndex; i += 1) {
const item = flattenData[i];
// This code will never reach, just incase
if (!item) {
continue;
}
if (flattenColumns.some(column => getRowSpan(column, i) > 1)) {
spanLines.push(i);
}
}
// Patch extra line on the page
const nodes = spanLines.map(index => {
const item = flattenData[index];
const rowKey = getRowKey(item.record, index);
const getHeight = rowSpan => {
const endItemIndex = index + rowSpan - 1;
const endItem = flattenData[endItemIndex];
if (!endItem || !endItem.record) {
// clamp 到当前可用的最后一行,或退化为默认高度
const safeEndIndex = Math.min(endItemIndex, flattenData.length - 1);
const safeEndItem = flattenData[safeEndIndex];
const endItemKey = getRowKey(safeEndItem.record, safeEndIndex);
const sizeInfo = getSize(rowKey, endItemKey);
return sizeInfo.bottom - sizeInfo.top;
}
const endItemKey = getRowKey(endItem.record, endItemIndex);
const sizeInfo = getSize(rowKey, endItemKey);
return sizeInfo.bottom - sizeInfo.top;
};
const sizeInfo = getSize(rowKey);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(VirtualTable_BodyLine, {
key: index,
data: item,
rowKey: rowKey,
index: index,
style: {
top: -offsetY + sizeInfo.top
},
extra: true,
getHeight: getHeight
});
});
return nodes;
};
// ========================= Context ==========================
const gridContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
columnsOffset
}), [columnsOffset]);
// ========================== Render ==========================
const tblPrefixCls = `${prefixCls}-tbody`;
// default 'div' in @rc-component/virtual-list
const wrapperComponent = getComponent(['body', 'wrapper']);
// ========================== Sticky Scroll Bar ==========================
const horizontalScrollBarStyle = {};
if (sticky) {
horizontalScrollBarStyle.position = 'sticky';
horizontalScrollBarStyle.bottom = 0;
if (typeof sticky === 'object' && sticky.offsetScroll) {
horizontalScrollBarStyle.bottom = sticky.offsetScroll;
}
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(GridContext.Provider, {
value: gridContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(virtual_list_es, {
fullHeight: false,
ref: listRef,
prefixCls: `${tblPrefixCls}-virtual`,
styles: {
horizontalScrollBar: horizontalScrollBarStyle
},
className: tblPrefixCls,
height: scrollY,
itemHeight: listItemHeight || 24,
data: flattenData,
itemKey: item => getRowKey(item.record),
component: wrapperComponent,
scrollWidth: scrollX,
direction: direction,
onVirtualScroll: ({
x
}) => {
onScroll({
currentTarget: listRef.current?.nativeElement,
scrollLeft: x
});
},
onScroll: onTablePropScroll,
extraRender: extraRender
}, (item, index, itemProps) => {
const rowKey = getRowKey(item.record, index);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(VirtualTable_BodyLine, {
data: item,
rowKey: rowKey,
index: index,
style: itemProps.style
});
}));
});
const ResponseGrid = TableContext_responseImmutable(Grid);
if (true) {
ResponseGrid.displayName = 'ResponseGrid';
}
/* harmony default export */ var BodyGrid = (ResponseGrid);
;// ./node_modules/@rc-component/table/es/VirtualTable/index.js
function VirtualTable_extends() { VirtualTable_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return VirtualTable_extends.apply(this, arguments); }
const renderBody = (rawData, props) => {
const {
ref,
onScroll
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(BodyGrid, {
ref: ref,
data: rawData,
onScroll: onScroll
});
};
const VirtualTable = (props, ref) => {
const {
data,
columns,
scroll,
sticky,
prefixCls = DEFAULT_PREFIX,
className,
listItemHeight,
components,
onScroll
} = props;
let {
x: scrollX,
y: scrollY
} = scroll || {};
// Fill scrollX
if (typeof scrollX !== 'number') {
if (true) {
(0,es.warning)(!scrollX, '`scroll.x` in virtual table must be number.');
}
scrollX = 1;
}
// Fill scrollY
if (typeof scrollY !== 'number') {
scrollY = 500;
if (true) {
(0,es.warning)(false, '`scroll.y` in virtual table must be number.');
}
}
const getComponent = (0,es.useEvent)((path, defaultComponent) => (0,get["default"])(components, path) || defaultComponent);
// Memo this
const onInternalScroll = (0,es.useEvent)(onScroll);
// ========================= Context ==========================
const context = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
sticky,
scrollY,
listItemHeight,
getComponent,
onScroll: onInternalScroll
}), [sticky, scrollY, listItemHeight, getComponent, onInternalScroll]);
// ========================== Render ==========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(StaticContext.Provider, {
value: context
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Table, VirtualTable_extends({}, props, {
className: (0,clsx.clsx)(className, `${prefixCls}-virtual`),
scroll: {
...scroll,
x: scrollX
},
components: {
...components,
// fix https://github.com/ant-design/ant-design/issues/48991
body: data?.length ? renderBody : undefined
},
columns: columns,
internalHooks: INTERNAL_HOOKS,
tailor: true,
ref: ref
})));
};
const RefVirtualTable = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(VirtualTable);
if (true) {
RefVirtualTable.displayName = 'VirtualTable';
}
const genVirtualTable = shouldTriggerRender => {
return TableContext_makeImmutable(RefVirtualTable, shouldTriggerRender);
};
/* harmony default export */ var es_VirtualTable = (genVirtualTable());
;// ./node_modules/@rc-component/table/es/index.js
/* harmony default export */ var table_es = (es_Table);
;// ./components/table/Column.ts
/* istanbul ignore next */
/** This is a syntactic sugar for `columns` prop. So HOC will not work on this. */
const table_Column_Column = _ => null;
/* harmony default export */ var table_Column = (table_Column_Column);
;// ./components/table/ColumnGroup.ts
/* istanbul ignore next */
/** This is a syntactic sugar for `columns` prop. So HOC will not work on this. */
const ColumnGroup_ColumnGroup = _ => null;
/* harmony default export */ var table_ColumnGroup = (ColumnGroup_ColumnGroup);
;// ./node_modules/@rc-component/tree/es/contextTypes.js
/**
* Webpack has bug for import loop, which is not the same behavior as ES module.
* When util.js imports the TreeNode for tree generate will cause treeContextTypes be empty.
*/
const TreeContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
/** Internal usage, safe to remove. Do not use in prod */
const contextTypes_UnstableContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({});
;// ./node_modules/@rc-component/tree/es/Indent.js
const Indent = ({
prefixCls,
level,
isStart,
isEnd
}) => {
const baseClassName = `${prefixCls}-indent-unit`;
const list = [];
for (let i = 0; i < level; i += 1) {
list.push( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
key: i,
className: (0,clsx.clsx)(baseClassName, {
[`${baseClassName}-start`]: isStart[i],
[`${baseClassName}-end`]: isEnd[i]
})
}));
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
"aria-hidden": "true",
className: `${prefixCls}-indent`
}, list);
};
/* harmony default export */ var es_Indent = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo(Indent));
;// ./node_modules/@rc-component/tree/es/TreeNode.js
function TreeNode_extends() { TreeNode_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return TreeNode_extends.apply(this, arguments); }
const ICON_OPEN = 'open';
const ICON_CLOSE = 'close';
const defaultTitle = '---';
const TreeNode = props => {
const {
eventKey,
className,
style,
dragOver,
dragOverGapTop,
dragOverGapBottom,
isLeaf,
isStart,
isEnd,
expanded,
selected,
checked,
halfChecked,
loading,
domRef,
active,
data,
onMouseMove,
selectable,
treeId,
...otherProps
} = props;
const nodeId = getId(treeId, eventKey);
const context = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(TreeContext);
const {
classNames: treeClassNames,
styles
} = context || {};
const unstableContext = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(contextTypes_UnstableContext);
const selectHandleRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
const [dragNodeHighlight, setDragNodeHighlight] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(false);
// ======= State: Disabled State =======
const isDisabled = !!(context.disabled || props.disabled || unstableContext.nodeDisabled?.(data));
const isCheckable = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
// Return false if tree or treeNode is not checkable
if (!context.checkable || props.checkable === false) {
return false;
}
return context.checkable;
}, [context.checkable, props.checkable]);
// ======= Event Handlers: Selection and Check =======
const onSelect = e => {
if (isDisabled) {
return;
}
context.onNodeSelect(e, convertNodePropsToEventData(props));
};
const onCheck = e => {
if (isDisabled) {
return;
}
if (!isCheckable || props.disableCheckbox) {
return;
}
context.onNodeCheck(e, convertNodePropsToEventData(props), !checked);
};
// ======= State: Selectable Check =======
const isSelectable = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
// Ignore when selectable is undefined or null
if (typeof selectable === 'boolean') {
return selectable;
}
return context.selectable;
}, [selectable, context.selectable]);
const onSelectorClick = e => {
// Click trigger before select/check operation
context.onNodeClick(e, convertNodePropsToEventData(props));
if (isSelectable) {
onSelect(e);
} else {
onCheck(e);
}
};
const onSelectorDoubleClick = e => {
context.onNodeDoubleClick(e, convertNodePropsToEventData(props));
};
const onMouseEnter = e => {
context.onNodeMouseEnter(e, convertNodePropsToEventData(props));
};
const onMouseLeave = e => {
context.onNodeMouseLeave(e, convertNodePropsToEventData(props));
};
const onContextMenu = e => {
context.onNodeContextMenu(e, convertNodePropsToEventData(props));
};
// ======= Drag: Drag Enabled =======
const isDraggable = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
return !!(context.draggable && (!context.draggable.nodeDraggable || context.draggable.nodeDraggable(data)));
}, [context.draggable, data]);
// ======= Drag: Drag Event Handlers =======
const onDragStart = e => {
e.stopPropagation();
setDragNodeHighlight(true);
context.onNodeDragStart(e, props);
try {
// ie throw error
// firefox-need-it
e.dataTransfer.setData('text/plain', '');
} catch {
// empty
}
};
const onDragEnter = e => {
e.preventDefault();
e.stopPropagation();
context.onNodeDragEnter(e, props);
};
const onDragOver = e => {
e.preventDefault();
e.stopPropagation();
context.onNodeDragOver(e, props);
};
const onDragLeave = e => {
e.stopPropagation();
context.onNodeDragLeave(e, props);
};
const onDragEnd = e => {
e.stopPropagation();
setDragNodeHighlight(false);
context.onNodeDragEnd(e, props);
};
const onDrop = e => {
e.preventDefault();
e.stopPropagation();
setDragNodeHighlight(false);
context.onNodeDrop(e, props);
};
// ======= Expand: Node Expansion =======
const onExpand = e => {
if (loading) {
return;
}
context.onNodeExpand(e, convertNodePropsToEventData(props));
};
// ======= State: Has Children =======
const hasChildren = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
const {
children
} = getEntity(context.keyEntities, eventKey) || {};
return Boolean((children || []).length);
}, [context.keyEntities, eventKey]);
// ======= State: Leaf Check =======
const memoizedIsLeaf = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
return isLeafNode(isLeaf, context.loadData, hasChildren, props.loaded);
}, [isLeaf, context.loadData, hasChildren, props.loaded]);
// ============== Effect ==============
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(() => {
// Load data to avoid default expanded tree without data
if (loading) {
return;
}
// read from state to avoid loadData at same time
if (typeof context.loadData === 'function' && expanded && !memoizedIsLeaf && !props.loaded) {
// We needn't reload data when has children in sync logic
// It's only needed in node expanded
context.onNodeLoad(convertNodePropsToEventData(props));
}
}, [loading, context.loadData, context.onNodeLoad, expanded, memoizedIsLeaf, props]);
// ==================== Render: Drag Handler ====================
const dragHandlerNode = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
if (!context.draggable?.icon) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: `${context.prefixCls}-draggable-icon`
}, context.draggable.icon);
}, [context.draggable]);
// ====================== Render: Switcher ======================
const renderSwitcherIconDom = isInternalLeaf => {
const switcherIcon = props.switcherIcon || context.switcherIcon;
// if switcherIconDom is null, no render switcher span
if (typeof switcherIcon === 'function') {
return switcherIcon({
...props,
isLeaf: isInternalLeaf
});
}
return switcherIcon;
};
// Switcher
const renderSwitcher = () => {
if (memoizedIsLeaf) {
// if switcherIconDom is null, no render switcher span
const switcherIconDom = renderSwitcherIconDom(true);
return switcherIconDom !== false ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: (0,clsx.clsx)(`${context.prefixCls}-switcher`, `${context.prefixCls}-switcher-noop`)
}, switcherIconDom) : null;
}
const switcherIconDom = renderSwitcherIconDom(false);
return switcherIconDom !== false ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
onClick: onExpand,
className: (0,clsx.clsx)(`${context.prefixCls}-switcher`, `${context.prefixCls}-switcher_${expanded ? ICON_OPEN : ICON_CLOSE}`)
}, switcherIconDom) : null;
};
// ====================== Checkbox ======================
const checkboxNode = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
if (!isCheckable) {
return null;
}
// [Legacy] Custom element should be separate with `checkable` in future
const $custom = typeof isCheckable !== 'boolean' ? isCheckable : null;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: (0,clsx.clsx)(`${context.prefixCls}-checkbox`, {
[`${context.prefixCls}-checkbox-checked`]: checked,
[`${context.prefixCls}-checkbox-indeterminate`]: !checked && halfChecked,
[`${context.prefixCls}-checkbox-disabled`]: isDisabled || props.disableCheckbox
}),
onClick: onCheck,
role: "checkbox",
"aria-checked": halfChecked ? 'mixed' : checked,
"aria-disabled": isDisabled || props.disableCheckbox,
"aria-labelledby": nodeId
}, $custom);
}, [isCheckable, checked, halfChecked, isDisabled, props.disableCheckbox, nodeId]);
// ============== State: Node State (Open/Close) ==============
const nodeState = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
if (memoizedIsLeaf) {
return null;
}
return expanded ? ICON_OPEN : ICON_CLOSE;
}, [memoizedIsLeaf, expanded]);
// ==================== Render: Title + Icon ====================
const iconNode = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: (0,clsx.clsx)(treeClassNames?.itemIcon, `${context.prefixCls}-iconEle`, `${context.prefixCls}-icon__${nodeState || 'docu'}`, {
[`${context.prefixCls}-icon_loading`]: loading
}),
style: styles?.itemIcon
});
}, [context.prefixCls, nodeState, loading]);
// =================== Drop Indicator ===================
const dropIndicatorNode = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
const rootDraggable = Boolean(context.draggable);
// allowDrop is calculated in Tree.tsx, there is no need for calc it here
const showIndicator = !props.disabled && rootDraggable && context.dragOverNodeKey === eventKey;
if (!showIndicator) {
return null;
}
return context.dropIndicatorRender({
dropPosition: context.dropPosition,
dropLevelOffset: context.dropLevelOffset,
indent: context.indent,
prefixCls: context.prefixCls,
direction: context.direction
});
}, [context.dropPosition, context.dropLevelOffset, context.indent, context.prefixCls, context.direction, context.draggable, context.dragOverNodeKey, context.dropIndicatorRender]);
// Icon + Title
const selectorNode = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
const {
title = defaultTitle
} = props;
const wrapClass = `${context.prefixCls}-node-content-wrapper`;
// Icon - Still show loading icon when loading without showIcon
let $icon;
if (context.showIcon) {
const currentIcon = props.icon || context.icon;
$icon = currentIcon ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: (0,clsx.clsx)(treeClassNames?.itemIcon, `${context.prefixCls}-iconEle`, `${context.prefixCls}-icon__customize`),
style: styles?.itemIcon
}, typeof currentIcon === 'function' ? currentIcon(props) : currentIcon) : iconNode;
} else if (context.loadData && loading) {
$icon = iconNode;
}
// Title
let titleNode;
if (typeof title === 'function') {
titleNode = title(data);
} else if (context.titleRender) {
titleNode = context.titleRender(data);
} else {
titleNode = title;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
ref: selectHandleRef,
title: typeof title === 'string' ? title : '',
className: (0,clsx.clsx)(wrapClass, `${wrapClass}-${nodeState || 'normal'}`, {
[`${context.prefixCls}-node-selected`]: !isDisabled && (selected || dragNodeHighlight)
}),
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
onContextMenu: onContextMenu,
onClick: onSelectorClick,
onDoubleClick: onSelectorDoubleClick
}, $icon, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: (0,clsx.clsx)(`${context.prefixCls}-title`, treeClassNames?.itemTitle),
style: styles?.itemTitle
}, titleNode), dropIndicatorNode);
}, [context.prefixCls, context.showIcon, props, context.icon, iconNode, context.titleRender, data, nodeState, onMouseEnter, onMouseLeave, onContextMenu, onSelectorClick, onSelectorDoubleClick]);
const dataOrAriaAttributeProps = (0,pickAttrs["default"])(otherProps, {
aria: true,
data: true
});
const {
level
} = getEntity(context.keyEntities, eventKey) || {};
const isEndNode = isEnd[isEnd.length - 1];
const draggableWithoutDisabled = !isDisabled && isDraggable;
const dragging = context.draggingNodeKey === eventKey;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", TreeNode_extends({
ref: domRef,
role: "treeitem",
id: nodeId,
"aria-expanded": memoizedIsLeaf ? undefined : expanded,
"aria-selected": isSelectable && !isDisabled ? selected : undefined,
"aria-checked": isCheckable && !isDisabled ? halfChecked ? 'mixed' : checked : undefined,
"aria-disabled": isDisabled,
className: (0,clsx.clsx)(className, `${context.prefixCls}-treenode`, treeClassNames?.item, {
[`${context.prefixCls}-treenode-disabled`]: isDisabled,
[`${context.prefixCls}-treenode-switcher-${expanded ? 'open' : 'close'}`]: !isLeaf,
[`${context.prefixCls}-treenode-checkbox-checked`]: checked,
[`${context.prefixCls}-treenode-checkbox-indeterminate`]: halfChecked,
[`${context.prefixCls}-treenode-selected`]: selected,
[`${context.prefixCls}-treenode-loading`]: loading,
[`${context.prefixCls}-treenode-active`]: active,
[`${context.prefixCls}-treenode-leaf-last`]: isEndNode,
[`${context.prefixCls}-treenode-draggable`]: isDraggable,
dragging,
'drop-target': context.dropTargetKey === eventKey,
'drop-container': context.dropContainerKey === eventKey,
'drag-over': !isDisabled && dragOver,
'drag-over-gap-top': !isDisabled && dragOverGapTop,
'drag-over-gap-bottom': !isDisabled && dragOverGapBottom,
'filter-node': context.filterTreeNode?.(convertNodePropsToEventData(props)),
[`${context.prefixCls}-treenode-leaf`]: memoizedIsLeaf
}),
style: {
...style,
...styles?.item
}
// Draggable config
,
draggable: draggableWithoutDisabled,
onDragStart: draggableWithoutDisabled ? onDragStart : undefined
// Drop config
,
onDragEnter: isDraggable ? onDragEnter : undefined,
onDragOver: isDraggable ? onDragOver : undefined,
onDragLeave: isDraggable ? onDragLeave : undefined,
onDrop: isDraggable ? onDrop : undefined,
onDragEnd: isDraggable ? onDragEnd : undefined,
onMouseMove: onMouseMove
}, dataOrAriaAttributeProps), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_Indent, {
prefixCls: context.prefixCls,
level: level,
isStart: isStart,
isEnd: isEnd
}), dragHandlerNode, renderSwitcher(), checkboxNode, selectorNode);
};
TreeNode.isTreeNode = 1;
if (true) {
TreeNode.displayName = 'TreeNode';
}
/* harmony default export */ var es_TreeNode = (TreeNode);
;// ./node_modules/@rc-component/tree/es/util.js
function util_extends() { util_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return util_extends.apply(this, arguments); }
/* eslint-disable no-lonely-if */
/**
* Legacy code. Should avoid to use if you are new to import these code.
*/
function arrDel(list, value) {
if (!list) return [];
const clone = list.slice();
const index = clone.indexOf(value);
if (index >= 0) {
clone.splice(index, 1);
}
return clone;
}
function arrAdd(list, value) {
const clone = (list || []).slice();
if (clone.indexOf(value) === -1) {
clone.push(value);
}
return clone;
}
function posToArr(pos) {
return pos.split('-');
}
function getDragChildrenKeys(dragNodeKey, keyEntities) {
// not contains self
// self for left or right drag
const dragChildrenKeys = [];
const entity = getEntity(keyEntities, dragNodeKey);
function dig(list = []) {
list.forEach(({
key,
children
}) => {
dragChildrenKeys.push(key);
dig(children);
});
}
dig(entity.children);
return dragChildrenKeys;
}
function isLastChild(treeNodeEntity) {
if (treeNodeEntity.parent) {
const posArr = posToArr(treeNodeEntity.pos);
return Number(posArr[posArr.length - 1]) === treeNodeEntity.parent.children.length - 1;
}
return false;
}
function isFirstChild(treeNodeEntity) {
const posArr = posToArr(treeNodeEntity.pos);
return Number(posArr[posArr.length - 1]) === 0;
}
// Only used when drag, not affect SSR.
function calcDropPosition(event, dragNodeProps, targetNodeProps, indent, startMousePosition, allowDrop, flattenedNodes, keyEntities, expandKeys, direction) {
const {
clientX,
clientY
} = event;
const {
top,
height
} = event.target.getBoundingClientRect();
// optional chain for testing
const horizontalMouseOffset = (direction === 'rtl' ? -1 : 1) * ((startMousePosition?.x || 0) - clientX);
const rawDropLevelOffset = (horizontalMouseOffset - 12) / indent;
// Filter the expanded keys to exclude the node that not has children currently (like async nodes).
const filteredExpandKeys = expandKeys.filter(key => keyEntities[key]?.children?.length);
// find abstract drop node by horizontal offset
let abstractDropNodeEntity = getEntity(keyEntities, targetNodeProps.eventKey);
if (clientY < top + height / 2) {
// first half, set abstract drop node to previous node
const nodeIndex = flattenedNodes.findIndex(flattenedNode => flattenedNode.key === abstractDropNodeEntity.key);
const prevNodeIndex = nodeIndex <= 0 ? 0 : nodeIndex - 1;
const prevNodeKey = flattenedNodes[prevNodeIndex].key;
abstractDropNodeEntity = getEntity(keyEntities, prevNodeKey);
}
const initialAbstractDropNodeKey = abstractDropNodeEntity.key;
const abstractDragOverEntity = abstractDropNodeEntity;
const dragOverNodeKey = abstractDropNodeEntity.key;
let dropPosition = 0;
let dropLevelOffset = 0;
// Only allow cross level drop when dragging on a non-expanded node
if (!filteredExpandKeys.includes(initialAbstractDropNodeKey)) {
for (let i = 0; i < rawDropLevelOffset; i += 1) {
if (isLastChild(abstractDropNodeEntity)) {
abstractDropNodeEntity = abstractDropNodeEntity.parent;
dropLevelOffset += 1;
} else {
break;
}
}
}
const abstractDragDataNode = dragNodeProps.data;
const abstractDropDataNode = abstractDropNodeEntity.node;
let dropAllowed = true;
if (isFirstChild(abstractDropNodeEntity) && abstractDropNodeEntity.level === 0 && clientY < top + height / 2 && allowDrop({
dragNode: abstractDragDataNode,
dropNode: abstractDropDataNode,
dropPosition: -1
}) && abstractDropNodeEntity.key === targetNodeProps.eventKey) {
// first half of first node in first level
dropPosition = -1;
} else if ((abstractDragOverEntity.children || []).length && filteredExpandKeys.includes(dragOverNodeKey)) {
// drop on expanded node
// only allow drop inside
if (allowDrop({
dragNode: abstractDragDataNode,
dropNode: abstractDropDataNode,
dropPosition: 0
})) {
dropPosition = 0;
} else {
dropAllowed = false;
}
} else if (dropLevelOffset === 0) {
if (rawDropLevelOffset > -1.5) {
// | Node | <- abstractDropNode
// | -^-===== | <- mousePosition
// 1. try drop after
// 2. do not allow drop
if (allowDrop({
dragNode: abstractDragDataNode,
dropNode: abstractDropDataNode,
dropPosition: 1
})) {
dropPosition = 1;
} else {
dropAllowed = false;
}
} else {
// | Node | <- abstractDropNode
// | ---==^== | <- mousePosition
// whether it has children or doesn't has children
// always
// 1. try drop inside
// 2. try drop after
// 3. do not allow drop
if (allowDrop({
dragNode: abstractDragDataNode,
dropNode: abstractDropDataNode,
dropPosition: 0
})) {
dropPosition = 0;
} else if (allowDrop({
dragNode: abstractDragDataNode,
dropNode: abstractDropDataNode,
dropPosition: 1
})) {
dropPosition = 1;
} else {
dropAllowed = false;
}
}
} else {
// | Node1 | <- abstractDropNode
// | Node2 |
// --^--|----=====| <- mousePosition
// 1. try insert after Node1
// 2. do not allow drop
if (allowDrop({
dragNode: abstractDragDataNode,
dropNode: abstractDropDataNode,
dropPosition: 1
})) {
dropPosition = 1;
} else {
dropAllowed = false;
}
}
return {
dropPosition,
dropLevelOffset,
dropTargetKey: abstractDropNodeEntity.key,
dropTargetPos: abstractDropNodeEntity.pos,
dragOverNodeKey,
dropContainerKey: dropPosition === 0 ? null : abstractDropNodeEntity.parent?.key || null,
dropAllowed
};
}
/**
* Return selectedKeys according with multiple prop
* @param selectedKeys
* @param props
* @returns [string]
*/
function calcSelectedKeys(selectedKeys, props) {
if (!selectedKeys) return undefined;
const {
multiple
} = props;
if (multiple) {
return selectedKeys.slice();
}
if (selectedKeys.length) {
return [selectedKeys[0]];
}
return selectedKeys;
}
const internalProcessProps = props => props;
function convertDataToTree(treeData, processor) {
if (!treeData) return [];
const {
processProps = internalProcessProps
} = processor || {};
const list = Array.isArray(treeData) ? treeData : [treeData];
return list.map(({
children,
...props
}) => {
const childrenNodes = convertDataToTree(children, processor);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_TreeNode, util_extends({
key: props.key
}, processProps(props)), childrenNodes);
});
}
/**
* Parse `checkedKeys` to { checkedKeys, halfCheckedKeys } style
*/
function parseCheckedKeys(keys) {
if (!keys) {
return null;
}
// Convert keys to object format
let keyProps;
if (Array.isArray(keys)) {
// [Legacy] Follow the api doc
keyProps = {
checkedKeys: keys,
halfCheckedKeys: undefined
};
} else if (typeof keys === 'object') {
keyProps = {
checkedKeys: keys.checked || undefined,
halfCheckedKeys: keys.halfChecked || undefined
};
} else {
(0,warning["default"])(false, '`checkedKeys` is not an array or an object');
return null;
}
return keyProps;
}
/**
* If user use `autoExpandParent` we should get the list of parent node
* @param keyList
* @param keyEntities
*/
function conductExpandParent(keyList, keyEntities) {
const expandedKeys = new Set();
function conductUp(key) {
if (expandedKeys.has(key)) return;
const entity = getEntity(keyEntities, key);
if (!entity) return;
expandedKeys.add(key);
const {
parent,
node
} = entity;
if (node.disabled) return;
if (parent) {
conductUp(parent.key);
}
}
(keyList || []).forEach(key => {
conductUp(key);
});
return [...expandedKeys];
}
;// ./components/_util/hooks/useMultipleSelect.ts
/**
* @title multipleSelect hooks
* @description multipleSelect by hold down shift key
*/
const useMultipleSelect = getKey => {
const [prevSelectedIndex, setPrevSelectedIndex] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null);
const multipleSelect = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)((currentSelectedIndex, data, selectedKeys) => {
const configPrevSelectedIndex = prevSelectedIndex ?? currentSelectedIndex;
// add/delete the selected range
const startIndex = Math.min(configPrevSelectedIndex || 0, currentSelectedIndex);
const endIndex = Math.max(configPrevSelectedIndex || 0, currentSelectedIndex);
const rangeKeys = data.slice(startIndex, endIndex + 1).map(getKey);
const shouldSelected = rangeKeys.some(rangeKey => !selectedKeys.has(rangeKey));
const changedKeys = [];
rangeKeys.forEach(item => {
if (shouldSelected) {
if (!selectedKeys.has(item)) {
changedKeys.push(item);
}
selectedKeys.add(item);
} else {
selectedKeys.delete(item);
changedKeys.push(item);
}
});
setPrevSelectedIndex(shouldSelected ? endIndex : null);
return changedKeys;
}, [prevSelectedIndex]);
return [multipleSelect, setPrevSelectedIndex];
};
;// ./components/table/hooks/useSelection.tsx
// TODO: warning if use ajax!!!
const SELECTION_COLUMN = {};
const SELECTION_ALL = 'SELECT_ALL';
const SELECTION_INVERT = 'SELECT_INVERT';
const SELECTION_NONE = 'SELECT_NONE';
const useSelection_EMPTY_LIST = [];
const flattenData = (childrenColumnName, data, list = []) => {
(data || []).forEach(record => {
list.push(record);
if ((0,is.isPlainObject)(record) && childrenColumnName in record) {
flattenData(childrenColumnName, record[childrenColumnName], list);
}
});
return list;
};
const useSelection = (config, rowSelection) => {
const {
preserveSelectedRowKeys,
selectedRowKeys,
defaultSelectedRowKeys,
getCheckboxProps,
getTitleCheckboxProps,
onChange: onSelectionChange,
onSelect,
onSelectAll,
onSelectInvert,
onSelectNone,
onSelectMultiple,
columnWidth: selectionColWidth,
type: selectionType,
selections,
fixed,
renderCell: customizeRenderCell,
hideSelectAll,
checkStrictly = true
} = rowSelection || {};
const {
prefixCls,
data,
pageData,
getRecordByKey,
getRowKey,
expandType,
childrenColumnName,
locale: tableLocale,
getPopupContainer
} = config;
const warning = (0,_util_warning.devUseWarning)('Table');
// ========================= MultipleSelect =========================
const [multipleSelect, updatePrevSelectedIndex] = useMultipleSelect(item => item);
// ========================= Keys =========================
const [mergedSelectedKeys, setMergedSelectedKeys] = (0,es.useControlledState)(defaultSelectedRowKeys || useSelection_EMPTY_LIST, selectedRowKeys);
const mergedSelectedKeyList = mergedSelectedKeys ?? useSelection_EMPTY_LIST;
// ======================== Caches ========================
const preserveRecordsRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(new Map());
const updatePreserveRecordsCache = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(keys => {
if (preserveSelectedRowKeys) {
const newCache = new Map();
// Keep key if mark as preserveSelectedRowKeys
keys.forEach(key => {
let record = getRecordByKey(key);
if (!record && preserveRecordsRef.current.has(key)) {
record = preserveRecordsRef.current.get(key);
}
newCache.set(key, record);
});
// Refresh to new cache
preserveRecordsRef.current = newCache;
}
}, [getRecordByKey, preserveSelectedRowKeys]);
// Update cache with selectedKeys
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
updatePreserveRecordsCache(mergedSelectedKeyList);
}, [mergedSelectedKeyList, updatePreserveRecordsCache]);
// Get flatten data
const flattedData = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => flattenData(childrenColumnName, pageData), [childrenColumnName, pageData]);
const {
keyEntities
} = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (checkStrictly) {
return {
keyEntities: null
};
}
let convertData = data;
if (preserveSelectedRowKeys) {
// use flattedData keys
const keysSet = new Set(flattedData.map(getRowKey));
// remove preserveRecords that duplicate data
const preserveRecords = Array.from(preserveRecordsRef.current).reduce((total, [key, value]) => keysSet.has(key) ? total : total.concat(value), []);
convertData = [].concat((0,toConsumableArray["default"])(convertData), (0,toConsumableArray["default"])(preserveRecords));
}
return convertDataToEntities(convertData, {
externalGetKey: getRowKey,
childrenPropName: childrenColumnName
});
}, [data, getRowKey, checkStrictly, childrenColumnName, preserveSelectedRowKeys, flattedData]);
// Get all checkbox props
const checkboxPropsMap = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
const map = new Map();
flattedData.forEach((record, index) => {
const key = getRowKey(record, index);
const checkboxProps = (getCheckboxProps ? getCheckboxProps(record) : null) || {};
map.set(key, checkboxProps);
true ? warning(!('checked' in checkboxProps || 'defaultChecked' in checkboxProps), 'usage', 'Do not set `checked` or `defaultChecked` in `getCheckboxProps`. Please use `selectedRowKeys` instead.') : 0;
});
return map;
}, [flattedData, getRowKey, getCheckboxProps]);
const isCheckboxDisabled = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(r => {
const rowKey = getRowKey(r);
let checkboxProps;
if (checkboxPropsMap.has(rowKey)) {
checkboxProps = checkboxPropsMap.get(getRowKey(r));
} else {
checkboxProps = getCheckboxProps ? getCheckboxProps(r) : undefined;
}
return !!checkboxProps?.disabled;
}, [checkboxPropsMap, getRowKey]);
const [derivedSelectedKeys, derivedHalfSelectedKeys] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (checkStrictly) {
return [mergedSelectedKeyList, []];
}
const {
checkedKeys,
halfCheckedKeys
} = conductCheck(mergedSelectedKeyList, true, keyEntities, isCheckboxDisabled);
return [checkedKeys || [], halfCheckedKeys];
}, [mergedSelectedKeyList, checkStrictly, keyEntities, isCheckboxDisabled]);
const derivedSelectedKeySet = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
const keys = selectionType === 'radio' ? derivedSelectedKeys.slice(0, 1) : derivedSelectedKeys;
return new Set(keys);
}, [derivedSelectedKeys, selectionType]);
const derivedHalfSelectedKeySet = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => selectionType === 'radio' ? new Set() : new Set(derivedHalfSelectedKeys), [derivedHalfSelectedKeys, selectionType]);
// Reset if rowSelection reset
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (!rowSelection) {
setMergedSelectedKeys(useSelection_EMPTY_LIST);
}
}, [!!rowSelection]);
const setSelectedKeys = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)((keys, method) => {
let availableKeys;
let records;
updatePreserveRecordsCache(keys);
if (preserveSelectedRowKeys) {
availableKeys = keys;
records = keys.map(key => preserveRecordsRef.current.get(key));
} else {
// Filter key which not exist in the `dataSource`
availableKeys = [];
records = [];
keys.forEach(key => {
const record = getRecordByKey(key);
if (record !== undefined) {
availableKeys.push(key);
records.push(record);
}
});
}
setMergedSelectedKeys(availableKeys);
onSelectionChange?.(availableKeys, records, {
type: method
});
}, [setMergedSelectedKeys, getRecordByKey, onSelectionChange, preserveSelectedRowKeys]);
// ====================== Selections ======================
// Trigger single `onSelect` event
const triggerSingleSelection = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)((key, selected, keys, event) => {
if (onSelect) {
const rows = keys.map(getRecordByKey);
onSelect(getRecordByKey(key), selected, rows, event);
}
setSelectedKeys(keys, 'single');
}, [onSelect, getRecordByKey, setSelectedKeys]);
const mergedSelections = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (!selections || hideSelectAll) {
return null;
}
const selectionList = selections === true ? [SELECTION_ALL, SELECTION_INVERT, SELECTION_NONE] : selections;
return selectionList.map(selection => {
if (selection === SELECTION_ALL) {
return {
key: 'all',
text: tableLocale.selectionAll,
onSelect() {
setSelectedKeys(data.map((record, index) => getRowKey(record, index)).filter(key => {
const checkProps = checkboxPropsMap.get(key);
return !checkProps?.disabled || derivedSelectedKeySet.has(key);
}), 'all');
}
};
}
if (selection === SELECTION_INVERT) {
return {
key: 'invert',
text: tableLocale.selectInvert,
onSelect() {
const keySet = new Set(derivedSelectedKeySet);
pageData.forEach((record, index) => {
const key = getRowKey(record, index);
const checkProps = checkboxPropsMap.get(key);
if (!checkProps?.disabled) {
if (keySet.has(key)) {
keySet.delete(key);
} else {
keySet.add(key);
}
}
});
const keys = Array.from(keySet);
if (onSelectInvert) {
warning.deprecated(false, 'onSelectInvert', 'onChange');
onSelectInvert(keys);
}
setSelectedKeys(keys, 'invert');
}
};
}
if (selection === SELECTION_NONE) {
return {
key: 'none',
text: tableLocale.selectNone,
onSelect() {
onSelectNone?.();
setSelectedKeys(Array.from(derivedSelectedKeySet).filter(key => {
const checkProps = checkboxPropsMap.get(key);
return checkProps?.disabled;
}), 'none');
}
};
}
return selection;
}).map(selection => ({
...selection,
onSelect: (...rest) => {
selection.onSelect?.(...rest);
updatePrevSelectedIndex(null);
}
}));
}, [selections, hideSelectAll, tableLocale.selectionAll, tableLocale.selectInvert, tableLocale.selectNone, checkboxPropsMap, derivedSelectedKeySet, data, pageData, getRowKey, onSelectInvert, setSelectedKeys]);
// ======================= Columns ========================
const transformColumns = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(columns => {
// >>>>>>>>>>> Skip if not exists `rowSelection`
if (!rowSelection) {
true ? warning(!columns.includes(SELECTION_COLUMN), 'usage', '`rowSelection` is not config but `SELECTION_COLUMN` exists in the `columns`.') : 0;
return columns.filter(col => col !== SELECTION_COLUMN);
}
// >>>>>>>>>>> Support selection
let cloneColumns = (0,toConsumableArray["default"])(columns);
const keySet = new Set(derivedSelectedKeySet);
// Record key only need check with enabled
const recordKeys = flattedData.map(getRowKey).filter(key => !checkboxPropsMap.get(key).disabled);
const checkedCurrentAll = recordKeys.every(key => keySet.has(key));
const checkedCurrentSome = recordKeys.some(key => keySet.has(key));
const onSelectAllChange = () => {
const changeKeys = [];
if (checkedCurrentAll) {
recordKeys.forEach(key => {
keySet.delete(key);
changeKeys.push(key);
});
} else {
recordKeys.forEach(key => {
if (!keySet.has(key)) {
keySet.add(key);
changeKeys.push(key);
}
});
}
const keys = Array.from(keySet);
onSelectAll?.(!checkedCurrentAll, keys.map(getRecordByKey), changeKeys.map(getRecordByKey));
setSelectedKeys(keys, 'all');
updatePrevSelectedIndex(null);
};
// ===================== Render =====================
// Title Cell
let title;
let columnTitleCheckbox;
if (selectionType !== 'radio') {
let customizeSelections;
if (mergedSelections) {
const menu = {
getPopupContainer,
items: mergedSelections.map((selection, index) => {
const {
key,
text,
onSelect: onSelectionClick
} = selection;
return {
key: key ?? index,
onClick: () => {
onSelectionClick?.(recordKeys);
},
label: text
};
})
};
customizeSelections = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-selection-extra`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_dropdown, {
menu: menu,
getPopupContainer: getPopupContainer
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_DownOutlined, null))));
}
const allDisabledData = flattedData.map((record, index) => {
const key = getRowKey(record, index);
const checkboxProps = checkboxPropsMap.get(key) || {};
return {
checked: keySet.has(key),
...checkboxProps
};
}).filter(({
disabled
}) => disabled);
const allDisabled = !!allDisabledData.length && allDisabledData.length === flattedData.length;
const allDisabledAndChecked = allDisabled && allDisabledData.every(({
checked
}) => checked);
const allDisabledSomeChecked = allDisabled && allDisabledData.some(({
checked
}) => checked);
const customCheckboxProps = getTitleCheckboxProps?.() || {};
const {
onChange,
disabled
} = customCheckboxProps;
columnTitleCheckbox = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_checkbox, {
"aria-label": customizeSelections ? 'Custom selection' : 'Select all',
...customCheckboxProps,
checked: !allDisabled ? !!flattedData.length && checkedCurrentAll : allDisabledAndChecked,
indeterminate: !allDisabled ? !checkedCurrentAll && checkedCurrentSome : !allDisabledAndChecked && allDisabledSomeChecked,
onChange: e => {
onSelectAllChange();
onChange?.(e);
},
disabled: disabled ?? (flattedData.length === 0 || allDisabled),
skipGroup: true
});
title = !hideSelectAll && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-selection`
}, columnTitleCheckbox, customizeSelections));
}
// Body Cell
let renderCell;
if (selectionType === 'radio') {
renderCell = (_, record, index) => {
const key = getRowKey(record, index);
const checked = keySet.has(key);
const checkboxProps = checkboxPropsMap.get(key);
return {
node: (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_radio, {
...checkboxProps,
checked: checked,
onClick: e => {
e.stopPropagation();
checkboxProps?.onClick?.(e);
},
onChange: event => {
if (!keySet.has(key)) {
triggerSingleSelection(key, true, [key], event.nativeEvent);
}
checkboxProps?.onChange?.(event);
}
})),
checked
};
};
} else {
renderCell = (_, record, index) => {
const key = getRowKey(record, index);
const checked = keySet.has(key);
const indeterminate = derivedHalfSelectedKeySet.has(key);
const checkboxProps = checkboxPropsMap.get(key);
let mergedIndeterminate;
if (expandType === 'nest') {
mergedIndeterminate = indeterminate;
true ? warning(typeof checkboxProps?.indeterminate !== 'boolean', 'usage', 'set `indeterminate` using `rowSelection.getCheckboxProps` is not allowed with tree structured dataSource.') : 0;
} else {
mergedIndeterminate = checkboxProps?.indeterminate ?? indeterminate;
}
// Record checked
return {
node: (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_checkbox, {
...checkboxProps,
indeterminate: mergedIndeterminate,
checked: checked,
skipGroup: true,
onClick: e => {
e.stopPropagation();
checkboxProps?.onClick?.(e);
},
onChange: event => {
const {
nativeEvent
} = event;
const {
shiftKey
} = nativeEvent;
const currentSelectedIndex = recordKeys.indexOf(key);
const isMultiple = derivedSelectedKeys.some(item => recordKeys.includes(item));
if (shiftKey && checkStrictly && isMultiple) {
const changedKeys = multipleSelect(currentSelectedIndex, recordKeys, keySet);
const keys = Array.from(keySet);
onSelectMultiple?.(!checked, keys.map(getRecordByKey), changedKeys.map(getRecordByKey));
setSelectedKeys(keys, 'multiple');
} else {
// Single record selected
const originCheckedKeys = derivedSelectedKeys;
if (checkStrictly) {
const checkedKeys = checked ? arrDel(originCheckedKeys, key) : arrAdd(originCheckedKeys, key);
triggerSingleSelection(key, !checked, checkedKeys, nativeEvent);
} else {
// Always fill first
const result = conductCheck([].concat((0,toConsumableArray["default"])(originCheckedKeys), [key]), true, keyEntities, isCheckboxDisabled);
const {
checkedKeys,
halfCheckedKeys
} = result;
let nextCheckedKeys = checkedKeys;
// If remove, we do it again to correction
if (checked) {
const tempKeySet = new Set(checkedKeys);
tempKeySet.delete(key);
nextCheckedKeys = conductCheck(Array.from(tempKeySet), {
checked: false,
halfCheckedKeys
}, keyEntities, isCheckboxDisabled).checkedKeys;
}
triggerSingleSelection(key, !checked, nextCheckedKeys, nativeEvent);
}
}
if (checked) {
updatePrevSelectedIndex(null);
} else {
updatePrevSelectedIndex(currentSelectedIndex);
}
checkboxProps?.onChange?.(event);
}
})),
checked
};
};
}
const renderSelectionCell = (_, record, index) => {
const {
node,
checked
} = renderCell(_, record, index);
if (customizeRenderCell) {
return customizeRenderCell(checked, record, index, node);
}
return node;
};
// Insert selection column if not exist
if (!cloneColumns.includes(SELECTION_COLUMN)) {
// Always after expand icon
if (cloneColumns.findIndex(col => col[INTERNAL_COL_DEFINE]?.columnType === 'EXPAND_COLUMN') === 0) {
const [expandColumn, ...restColumns] = cloneColumns;
cloneColumns = [expandColumn, SELECTION_COLUMN].concat((0,toConsumableArray["default"])(restColumns));
} else {
// Normal insert at first column
cloneColumns = [SELECTION_COLUMN].concat((0,toConsumableArray["default"])(cloneColumns));
}
}
// Deduplicate selection column
const selectionColumnIndex = cloneColumns.indexOf(SELECTION_COLUMN);
true ? warning(cloneColumns.filter(col => col === SELECTION_COLUMN).length <= 1, 'usage', 'Multiple `SELECTION_COLUMN` exist in `columns`.') : 0;
cloneColumns = cloneColumns.filter((column, index) => column !== SELECTION_COLUMN || index === selectionColumnIndex);
// Fixed column logic
const prevCol = cloneColumns[selectionColumnIndex - 1];
const nextCol = cloneColumns[selectionColumnIndex + 1];
let mergedFixed = fixed;
if (mergedFixed === undefined) {
if (nextCol?.fixed !== undefined) {
mergedFixed = nextCol.fixed;
} else if (prevCol?.fixed !== undefined) {
mergedFixed = prevCol.fixed;
}
}
if (mergedFixed && prevCol && prevCol[INTERNAL_COL_DEFINE]?.columnType === 'EXPAND_COLUMN' && prevCol.fixed === undefined) {
prevCol.fixed = mergedFixed;
}
const columnCls = (0,clsx.clsx)(`${prefixCls}-selection-col`, {
[`${prefixCls}-selection-col-with-dropdown`]: selections && selectionType === 'checkbox'
});
const renderColumnTitle = () => {
if (!rowSelection?.columnTitle) {
return title;
}
if (typeof rowSelection.columnTitle === 'function') {
return rowSelection.columnTitle(columnTitleCheckbox);
}
return rowSelection.columnTitle;
};
// Replace with real selection column
const selectionColumn = {
fixed: mergedFixed,
width: selectionColWidth,
className: `${prefixCls}-selection-column`,
title: renderColumnTitle(),
render: renderSelectionCell,
onCell: rowSelection.onCell,
align: rowSelection.align,
[INTERNAL_COL_DEFINE]: {
className: columnCls
}
};
return cloneColumns.map(col => col === SELECTION_COLUMN ? selectionColumn : col);
}, [getRowKey, flattedData, rowSelection, derivedSelectedKeys, derivedSelectedKeySet, derivedHalfSelectedKeySet, selectionColWidth, mergedSelections, expandType, checkboxPropsMap, onSelectMultiple, triggerSingleSelection, isCheckboxDisabled]);
return [transformColumns, derivedSelectedKeySet];
};
/* harmony default export */ var hooks_useSelection = (useSelection);
;// ./components/_util/hooks/useProxyImperativeHandle.ts
// Proxy the dom ref with `{ nativeElement, otherFn }` type
// ref: https://github.com/ant-design/ant-design/discussions/45242
const fillProxy = (element, handler) => {
element._antProxy = element._antProxy || {};
Object.keys(handler).forEach(key => {
if (!(key in element._antProxy)) {
const ori = element[key];
element._antProxy[key] = ori;
element[key] = handler[key];
}
});
return element;
};
const useProxyImperativeHandle = (ref, init) => {
return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref, () => {
const refObj = init();
const {
nativeElement
} = refObj;
if (typeof Proxy !== 'undefined') {
return new Proxy(nativeElement, {
get(obj, prop) {
if (refObj[prop]) {
return refObj[prop];
}
return Reflect.get(obj, prop);
}
});
}
// Fallback of IE
return fillProxy(nativeElement, refObj);
});
};
;// ./components/table/ExpandIcon.tsx
function ExpandIcon_renderExpandIcon(locale) {
return props => {
const {
prefixCls,
onExpand,
record,
expanded,
expandable
} = props;
const iconPrefix = `${prefixCls}-row-expand-icon`;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
onClick: e => {
onExpand(record, e);
e.stopPropagation();
},
className: (0,clsx.clsx)(iconPrefix, {
[`${iconPrefix}-spaced`]: !expandable,
[`${iconPrefix}-expanded`]: expandable && expanded,
[`${iconPrefix}-collapsed`]: expandable && !expanded
}),
"aria-label": expanded ? locale.collapse : locale.expand,
"aria-expanded": expanded
});
};
}
/* harmony default export */ var ExpandIcon = (ExpandIcon_renderExpandIcon);
;// ./components/table/hooks/useContainerWidth.ts
function useContainerWidth(prefixCls) {
const getContainerWidth = (ele, width) => {
const container = ele.querySelector(`.${prefixCls}-container`);
let returnWidth = width;
if (container) {
const style = getComputedStyle(container);
const borderLeft = Number.parseInt(style.borderLeftWidth, 10);
const borderRight = Number.parseInt(style.borderRightWidth, 10);
returnWidth = width - borderLeft - borderRight;
}
return returnWidth;
};
return getContainerWidth;
}
;// ./components/table/util.ts
const getColumnKey = (column, defaultKey) => {
if ('key' in column && (0,is.isNonNullable)(column.key)) {
return column.key;
}
if (column.dataIndex) {
return Array.isArray(column.dataIndex) ? column.dataIndex.join('.') : column.dataIndex;
}
return defaultKey;
};
function getColumnPos(index, pos) {
return pos ? `${pos}-${index}` : `${index}`;
}
const renderColumnTitle = (title, props) => {
if (typeof title === 'function') {
return title(props);
}
return title;
};
/**
* Safe get column title
*
* Should filter [object Object]
*
* @param title
*/
const safeColumnTitle = (title, props) => {
const res = renderColumnTitle(title, props);
if (Object.prototype.toString.call(res) === '[object Object]') {
return '';
}
return res;
};
;// ./node_modules/@ant-design/icons-svg/es/asn/FilterFilled.js
// This icon file is generated automatically.
var FilterFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z" } }] }, "name": "filter", "theme": "filled" };
/* harmony default export */ var asn_FilterFilled = (FilterFilled);
;// ./node_modules/@ant-design/icons/es/icons/FilterFilled.js
function FilterFilled_extends() { FilterFilled_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return FilterFilled_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const FilterFilled_FilterFilled = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], FilterFilled_extends({}, props, {
ref: ref,
icon: asn_FilterFilled
}));
/** */
const FilterFilled_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(FilterFilled_FilterFilled);
if (true) {
FilterFilled_RefIcon.displayName = 'FilterFilled';
}
/* harmony default export */ var icons_FilterFilled = (FilterFilled_RefIcon);
;// ./components/_util/hooks/useSyncState.ts
const hooks_useSyncState_useSyncState = initialValue => {
const ref = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(initialValue);
const [, forceUpdate] = useForceUpdate();
return [() => ref.current, newValue => {
ref.current = newValue;
forceUpdate();
}];
};
;// ./node_modules/@rc-component/tree/es/DropIndicator.js
const DropIndicator = props => {
const {
dropPosition,
dropLevelOffset,
indent
} = props;
const style = {
pointerEvents: 'none',
position: 'absolute',
right: 0,
backgroundColor: 'red',
height: 2
};
switch (dropPosition) {
case -1:
style.top = 0;
style.left = -dropLevelOffset * indent;
break;
case 1:
style.bottom = 0;
style.left = -dropLevelOffset * indent;
break;
case 0:
style.bottom = 0;
style.left = indent;
break;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
style: style
});
};
if (true) {
DropIndicator.displayName = 'DropIndicator';
}
/* harmony default export */ var es_DropIndicator = (DropIndicator);
;// ./node_modules/@rc-component/tree/es/useUnmount.js
/**
* Trigger only when component unmount
*/
function useUnmount(triggerStart, triggerEnd) {
const [firstMount, setFirstMount] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
(0,useLayoutEffect["default"])(() => {
if (firstMount) {
triggerStart();
return () => {
triggerEnd();
};
}
}, [firstMount]);
(0,useLayoutEffect["default"])(() => {
setFirstMount(true);
return () => {
setFirstMount(false);
};
}, []);
}
/* harmony default export */ var es_useUnmount = (useUnmount);
;// ./node_modules/@rc-component/tree/es/MotionTreeNode.js
function MotionTreeNode_extends() { MotionTreeNode_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return MotionTreeNode_extends.apply(this, arguments); }
const MotionTreeNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((oriProps, ref) => {
const {
className,
style,
motion,
motionNodes,
motionType,
onMotionStart: onOriginMotionStart,
onMotionEnd: onOriginMotionEnd,
active,
treeNodeRequiredProps,
...props
} = oriProps;
const [visible, setVisible] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(true);
const {
prefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(TreeContext);
// Calculate target visible here.
// And apply in effect to make `leave` motion work.
const targetVisible = motionNodes && motionType !== 'hide';
(0,useLayoutEffect["default"])(() => {
if (motionNodes) {
if (targetVisible !== visible) {
setVisible(targetVisible);
}
}
}, [motionNodes]);
const triggerMotionStart = () => {
if (motionNodes) {
onOriginMotionStart();
}
};
// Should only trigger once
const triggerMotionEndRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
const triggerMotionEnd = () => {
if (motionNodes && !triggerMotionEndRef.current) {
triggerMotionEndRef.current = true;
onOriginMotionEnd();
}
};
// Effect if unmount
es_useUnmount(triggerMotionStart, triggerMotionEnd);
// Motion end event
const onVisibleChanged = nextVisible => {
if (targetVisible === nextVisible) {
triggerMotionEnd();
}
};
if (motionNodes) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es["default"], MotionTreeNode_extends({
ref: ref,
visible: visible
}, motion, {
motionAppear: motionType === 'show',
onVisibleChanged: onVisibleChanged
}), ({
className: motionClassName,
style: motionStyle
}, motionRef) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: motionRef,
className: (0,clsx.clsx)(`${prefixCls}-treenode-motion`, motionClassName),
style: motionStyle
}, motionNodes.map(treeNode => {
const {
data: {
...restProps
},
title,
key,
isStart,
isEnd
} = treeNode;
delete restProps.children;
const treeNodeProps = getTreeNodeProps(key, treeNodeRequiredProps);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_TreeNode, MotionTreeNode_extends({}, restProps, treeNodeProps, {
title: title,
active: active,
data: treeNode.data,
key: key,
isStart: isStart,
isEnd: isEnd
}));
})));
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_TreeNode, MotionTreeNode_extends({
domRef: ref,
className: className,
style: style
}, props, {
active: active
}));
});
if (true) {
MotionTreeNode.displayName = 'MotionTreeNode';
}
/* harmony default export */ var es_MotionTreeNode = (MotionTreeNode);
;// ./node_modules/@rc-component/tree/es/utils/diffUtil.js
function findExpandedKeys(prev = [], next = []) {
const prevLen = prev.length;
const nextLen = next.length;
if (Math.abs(prevLen - nextLen) !== 1) {
return {
add: false,
key: null
};
}
function find(shorter, longer) {
const cache = new Map();
shorter.forEach(key => {
cache.set(key, true);
});
const keys = longer.filter(key => !cache.has(key));
return keys.length === 1 ? keys[0] : null;
}
if (prevLen < nextLen) {
return {
add: true,
key: find(prev, next)
};
}
return {
add: false,
key: find(next, prev)
};
}
function getExpandRange(shorter, longer, key) {
const shorterStartIndex = shorter.findIndex(data => data.key === key);
const shorterEndNode = shorter[shorterStartIndex + 1];
const longerStartIndex = longer.findIndex(data => data.key === key);
if (shorterEndNode) {
const longerEndIndex = longer.findIndex(data => data.key === shorterEndNode.key);
return longer.slice(longerStartIndex + 1, longerEndIndex);
}
return longer.slice(longerStartIndex + 1);
}
;// ./node_modules/@rc-component/tree/es/NodeList.js
function NodeList_extends() { NodeList_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return NodeList_extends.apply(this, arguments); }
/**
* Handle virtual list of the TreeNodes.
*/
const MOTION_KEY = `RC_TREE_MOTION_${Math.random()}`;
const MotionNode = {
key: MOTION_KEY
};
const MotionEntity = {
key: MOTION_KEY,
level: 0,
index: 0,
pos: '0',
node: MotionNode,
nodes: [MotionNode]
};
const MotionFlattenData = {
parent: null,
children: [],
pos: MotionEntity.pos,
data: MotionNode,
title: null,
key: MOTION_KEY,
/** Hold empty list here since we do not use it */
isStart: [],
isEnd: []
};
/**
* We only need get visible content items to play the animation.
*/
function getMinimumRangeTransitionRange(list, virtual, height, itemHeight) {
if (virtual === false || !height) {
return list;
}
return list.slice(0, Math.ceil(height / itemHeight) + 1);
}
function NodeList_itemKey(item) {
const {
key,
pos
} = item;
return treeUtil_getKey(key, pos);
}
const NodeList = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls,
data,
selectable,
checkable,
expandedKeys,
selectedKeys,
checkedKeys,
loadedKeys,
loadingKeys,
halfCheckedKeys,
keyEntities,
disabled,
dragging,
dragOverNodeKey,
dropPosition,
motion,
height,
itemHeight,
virtual,
scrollWidth,
focusable,
activeItem,
tabIndex,
onKeyDown,
onFocus,
onBlur,
onMouseDown,
onMouseUp,
onActiveChange,
onListChangeStart,
onListChangeEnd,
...domProps
} = props;
const treeId = useId();
// =============================== Ref ================================
const listRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const indentMeasurerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
scrollTo: scroll => {
listRef.current.scrollTo(scroll);
},
getIndentWidth: () => indentMeasurerRef.current.offsetWidth
}));
// ============================== Motion ==============================
const [prevExpandedKeys, setPrevExpandedKeys] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(expandedKeys);
const [prevData, setPrevData] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(data);
const [transitionData, setTransitionData] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(data);
const [transitionRange, setTransitionRange] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([]);
const [motionType, setMotionType] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
// When motion end but data change, this will makes data back to previous one
const dataRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(data);
dataRef.current = data;
function onMotionEnd() {
const latestData = dataRef.current;
setPrevData(latestData);
setTransitionData(latestData);
setTransitionRange([]);
setMotionType(null);
onListChangeEnd();
}
// Do animation if expanded keys changed
// layoutEffect here to avoid blink of node removing
(0,useLayoutEffect["default"])(() => {
setPrevExpandedKeys(expandedKeys);
const diffExpanded = findExpandedKeys(prevExpandedKeys, expandedKeys);
if (diffExpanded.key !== null) {
if (diffExpanded.add) {
const keyIndex = prevData.findIndex(({
key
}) => key === diffExpanded.key);
const rangeNodes = getMinimumRangeTransitionRange(getExpandRange(prevData, data, diffExpanded.key), virtual, height, itemHeight);
const newTransitionData = prevData.slice();
newTransitionData.splice(keyIndex + 1, 0, MotionFlattenData);
setTransitionData(newTransitionData);
setTransitionRange(rangeNodes);
setMotionType('show');
} else {
const keyIndex = data.findIndex(({
key
}) => key === diffExpanded.key);
const rangeNodes = getMinimumRangeTransitionRange(getExpandRange(data, prevData, diffExpanded.key), virtual, height, itemHeight);
const newTransitionData = data.slice();
newTransitionData.splice(keyIndex + 1, 0, MotionFlattenData);
setTransitionData(newTransitionData);
setTransitionRange(rangeNodes);
setMotionType('hide');
}
} else if (prevData !== data) {
// If whole data changed, we just refresh the list
setPrevData(data);
setTransitionData(data);
}
}, [expandedKeys, data]);
// We should clean up motion if is changed by dragging
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (!dragging) {
onMotionEnd();
}
}, [dragging]);
const mergedData = motion ? transitionData : data;
const treeNodeRequiredProps = {
expandedKeys,
selectedKeys,
loadedKeys,
loadingKeys,
checkedKeys,
halfCheckedKeys,
dragOverNodeKey,
dropPosition,
keyEntities
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-treenode`,
"aria-hidden": true,
style: {
position: 'absolute',
pointerEvents: 'none',
visibility: 'hidden',
height: 0,
overflow: 'hidden',
border: 0,
padding: 0
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-indent`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: indentMeasurerRef,
className: `${prefixCls}-indent-unit`
}))), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(virtual_list_es, NodeList_extends({}, domProps, {
data: mergedData,
itemKey: NodeList_itemKey,
height: height,
fullHeight: false,
virtual: virtual,
itemHeight: itemHeight,
scrollWidth: scrollWidth,
prefixCls: `${prefixCls}-list`,
ref: listRef,
role: "tree",
tabIndex: focusable !== false && !disabled ? tabIndex : undefined,
"aria-activedescendant": activeItem ? getId(treeId, activeItem.key) : undefined,
onKeyDown: onKeyDown,
onFocus: onFocus,
onBlur: onBlur,
onMouseDown: onMouseDown,
onMouseUp: onMouseUp,
onVisibleChange: originList => {
// The best match is using `fullList` - `originList` = `restList`
// and check the `restList` to see if has the MOTION_KEY node
// but this will cause performance issue for long list compare
// we just check `originList` and repeat trigger `onMotionEnd`
if (originList.every(item => NodeList_itemKey(item) !== MOTION_KEY)) {
onMotionEnd();
}
}
}), treeNode => {
const {
pos,
data: {
...restProps
},
title,
key,
isStart,
isEnd
} = treeNode;
const mergedKey = treeUtil_getKey(key, pos);
delete restProps.key;
delete restProps.children;
const treeNodeProps = getTreeNodeProps(mergedKey, treeNodeRequiredProps);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_MotionTreeNode, NodeList_extends({}, restProps, treeNodeProps, {
title: title,
active: !!activeItem && key === activeItem.key,
pos: pos,
data: treeNode.data,
isStart: isStart,
isEnd: isEnd,
motion: motion,
motionNodes: key === MOTION_KEY ? transitionRange : null,
motionType: motionType,
onMotionStart: onListChangeStart,
onMotionEnd: onMotionEnd,
treeNodeRequiredProps: treeNodeRequiredProps,
treeId: treeId,
onMouseMove: () => {
onActiveChange(null);
}
}));
}));
});
if (true) {
NodeList.displayName = 'NodeList';
}
/* harmony default export */ var es_NodeList = (NodeList);
;// ./node_modules/@rc-component/tree/es/Tree.js
function Tree_extends() { Tree_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Tree_extends.apply(this, arguments); }
// TODO: Fully accessibility support
// Reference: https://www.w3.org/WAI/ARIA/apg/patterns/treeview
const MAX_RETRY_TIMES = 10;
class Tree extends external_root_React_commonjs2_react_commonjs_react_amd_react_.Component {
static defaultProps = {
prefixCls: 'rc-tree',
showLine: false,
showIcon: true,
selectable: true,
multiple: false,
checkable: false,
disabled: false,
checkStrictly: false,
draggable: false,
defaultExpandParent: true,
autoExpandParent: false,
defaultExpandAll: false,
defaultExpandedKeys: [],
defaultCheckedKeys: [],
defaultSelectedKeys: [],
dropIndicatorRender: es_DropIndicator,
allowDrop: () => true,
expandAction: false
};
static TreeNode = es_TreeNode;
destroyed = false;
delayedDragEnterLogic;
loadingRetryTimes = {};
state = {
keyEntities: {},
indent: null,
selectedKeys: [],
checkedKeys: [],
halfCheckedKeys: [],
loadedKeys: [],
loadingKeys: [],
expandedKeys: [],
draggingNodeKey: null,
dragChildrenKeys: [],
// dropTargetKey is the key of abstract-drop-node
// the abstract-drop-node is the real drop node when drag and drop
// not the DOM drag over node
dropTargetKey: null,
dropPosition: null,
// the drop position of abstract-drop-node, inside 0, top -1, bottom 1
dropContainerKey: null,
// the container key of abstract-drop-node if dropPosition is -1 or 1
dropLevelOffset: null,
// the drop level offset of abstract-drag-over-node
dropTargetPos: null,
// the pos of abstract-drop-node
dropAllowed: true,
// if drop to abstract-drop-node is allowed
// the abstract-drag-over-node
// if mouse is on the bottom of top dom node or no the top of the bottom dom node
// abstract-drag-over-node is the top node
dragOverNodeKey: null,
treeData: [],
flattenNodes: [],
activeKey: null,
listChanging: false,
prevProps: null,
fieldNames: treeUtil_fillFieldNames()
};
dragStartMousePosition = null;
dragNodeProps = null;
currentMouseOverDroppableNodeKey = null;
focusedByMouse = false;
listRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createRef();
componentDidMount() {
this.destroyed = false;
this.onUpdated();
}
componentDidUpdate() {
this.onUpdated();
}
onUpdated() {
const {
activeKey,
itemScrollOffset = 0
} = this.props;
if (activeKey !== undefined && activeKey !== this.state.activeKey) {
this.setState({
activeKey
});
if (activeKey !== null) {
this.scrollTo({
key: activeKey,
offset: itemScrollOffset
});
}
}
}
componentWillUnmount() {
window.removeEventListener('dragend', this.onWindowDragEnd);
this.destroyed = true;
}
static getDerivedStateFromProps(props, prevState) {
const {
prevProps
} = prevState;
const newState = {
prevProps: props
};
function needSync(name) {
return !prevProps && props.hasOwnProperty(name) || prevProps && prevProps[name] !== props[name];
}
// ================== Tree Node ==================
let treeData;
// fieldNames
let {
fieldNames
} = prevState;
if (needSync('fieldNames')) {
fieldNames = treeUtil_fillFieldNames(props.fieldNames);
newState.fieldNames = fieldNames;
}
// Check if `treeData` or `children` changed and save into the state.
if (needSync('treeData')) {
({
treeData
} = props);
} else if (needSync('children')) {
(0,warning["default"])(false, '`children` of Tree is deprecated. Please use `treeData` instead.');
treeData = convertTreeToData(props.children);
}
// Save flatten nodes info and convert `treeData` into keyEntities
if (treeData) {
newState.treeData = treeData;
const entitiesMap = convertDataToEntities(treeData, {
fieldNames
});
newState.keyEntities = {
[MOTION_KEY]: MotionEntity,
...entitiesMap.keyEntities
};
// Warning if treeNode not provide key
if (true) {
warningWithoutKey(treeData, fieldNames);
}
}
const keyEntities = newState.keyEntities || prevState.keyEntities;
// ================ expandedKeys =================
if (needSync('expandedKeys') || prevProps && needSync('autoExpandParent')) {
newState.expandedKeys = props.autoExpandParent || !prevProps && props.defaultExpandParent ? conductExpandParent(props.expandedKeys, keyEntities) : props.expandedKeys;
} else if (!prevProps && props.defaultExpandAll) {
const cloneKeyEntities = {
...keyEntities
};
delete cloneKeyEntities[MOTION_KEY];
// Only take the key who has the children to enhance the performance
const nextExpandedKeys = [];
Object.keys(cloneKeyEntities).forEach(key => {
const entity = cloneKeyEntities[key];
if (entity.children && entity.children.length) {
nextExpandedKeys.push(entity.key);
}
});
newState.expandedKeys = nextExpandedKeys;
} else if (!prevProps && props.defaultExpandedKeys) {
newState.expandedKeys = props.autoExpandParent || props.defaultExpandParent ? conductExpandParent(props.defaultExpandedKeys, keyEntities) : props.defaultExpandedKeys;
}
if (!newState.expandedKeys) {
delete newState.expandedKeys;
}
// ================ flattenNodes =================
if (treeData || newState.expandedKeys) {
const flattenNodes = flattenTreeData(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys, fieldNames);
newState.flattenNodes = flattenNodes;
}
// ================ selectedKeys =================
if (props.selectable) {
if (needSync('selectedKeys')) {
newState.selectedKeys = calcSelectedKeys(props.selectedKeys, props);
} else if (!prevProps && props.defaultSelectedKeys) {
newState.selectedKeys = calcSelectedKeys(props.defaultSelectedKeys, props);
}
}
// ================= checkedKeys =================
if (props.checkable) {
let checkedKeyEntity;
if (needSync('checkedKeys')) {
checkedKeyEntity = parseCheckedKeys(props.checkedKeys) || {};
} else if (!prevProps && props.defaultCheckedKeys) {
checkedKeyEntity = parseCheckedKeys(props.defaultCheckedKeys) || {};
} else if (treeData) {
// If `treeData` changed, we also need check it
checkedKeyEntity = parseCheckedKeys(props.checkedKeys) || {
checkedKeys: prevState.checkedKeys,
halfCheckedKeys: prevState.halfCheckedKeys
};
}
if (checkedKeyEntity) {
let {
checkedKeys = [],
halfCheckedKeys = []
} = checkedKeyEntity;
if (!props.checkStrictly) {
const conductKeys = conductCheck(checkedKeys, true, keyEntities);
({
checkedKeys,
halfCheckedKeys
} = conductKeys);
}
newState.checkedKeys = checkedKeys;
newState.halfCheckedKeys = halfCheckedKeys;
}
}
// ================= loadedKeys ==================
if (needSync('loadedKeys')) {
newState.loadedKeys = props.loadedKeys;
}
return newState;
}
onNodeDragStart = (event, nodeProps) => {
const {
expandedKeys,
keyEntities
} = this.state;
const {
onDragStart
} = this.props;
const {
eventKey
} = nodeProps;
this.dragNodeProps = nodeProps;
this.dragStartMousePosition = {
x: event.clientX,
y: event.clientY
};
const newExpandedKeys = arrDel(expandedKeys, eventKey);
this.setState({
draggingNodeKey: eventKey,
dragChildrenKeys: getDragChildrenKeys(eventKey, keyEntities),
indent: this.listRef.current.getIndentWidth()
});
this.setExpandedKeys(newExpandedKeys);
window.addEventListener('dragend', this.onWindowDragEnd);
onDragStart?.({
event,
node: convertNodePropsToEventData(nodeProps)
});
};
/**
* [Legacy] Select handler is smaller than node,
* so that this will trigger when drag enter node or select handler.
* This is a little tricky if customize css without padding.
* Better for use mouse move event to refresh drag state.
* But let's just keep it to avoid event trigger logic change.
*/
onNodeDragEnter = (event, nodeProps) => {
const {
expandedKeys,
keyEntities,
dragChildrenKeys,
flattenNodes,
indent
} = this.state;
const {
onDragEnter,
onExpand,
allowDrop,
direction
} = this.props;
const {
pos,
eventKey
} = nodeProps;
// record the key of node which is latest entered, used in dragleave event.
if (this.currentMouseOverDroppableNodeKey !== eventKey) {
this.currentMouseOverDroppableNodeKey = eventKey;
}
if (!this.dragNodeProps) {
this.resetDragState();
return;
}
const {
dropPosition,
dropLevelOffset,
dropTargetKey,
dropContainerKey,
dropTargetPos,
dropAllowed,
dragOverNodeKey
} = calcDropPosition(event, this.dragNodeProps, nodeProps, indent, this.dragStartMousePosition, allowDrop, flattenNodes, keyEntities, expandedKeys, direction);
if (
// don't allow drop inside its children
dragChildrenKeys.includes(dropTargetKey) ||
// don't allow drop when drop is not allowed caculated by calcDropPosition
!dropAllowed) {
this.resetDragState();
return;
}
// Side effect for delay drag
if (!this.delayedDragEnterLogic) {
this.delayedDragEnterLogic = {};
}
Object.keys(this.delayedDragEnterLogic).forEach(key => {
clearTimeout(this.delayedDragEnterLogic[key]);
});
if (this.dragNodeProps.eventKey !== nodeProps.eventKey) {
// hoist expand logic here
// since if logic is on the bottom
// it will be blocked by abstract dragover node check
// => if you dragenter from top, you mouse will still be consider as in the top node
event.persist();
this.delayedDragEnterLogic[pos] = window.setTimeout(() => {
if (this.state.draggingNodeKey === null) {
return;
}
let newExpandedKeys = [...expandedKeys];
const entity = getEntity(keyEntities, nodeProps.eventKey);
if (entity && (entity.children || []).length) {
newExpandedKeys = arrAdd(expandedKeys, nodeProps.eventKey);
}
if (!this.props.hasOwnProperty('expandedKeys')) {
this.setExpandedKeys(newExpandedKeys);
}
onExpand?.(newExpandedKeys, {
node: convertNodePropsToEventData(nodeProps),
expanded: true,
nativeEvent: event.nativeEvent
});
}, 800);
}
// Skip if drag node is self
if (this.dragNodeProps.eventKey === dropTargetKey && dropLevelOffset === 0) {
this.resetDragState();
return;
}
// Update drag over node and drag state
this.setState({
dragOverNodeKey,
dropPosition,
dropLevelOffset,
dropTargetKey,
dropContainerKey,
dropTargetPos,
dropAllowed
});
onDragEnter?.({
event,
node: convertNodePropsToEventData(nodeProps),
expandedKeys
});
};
onNodeDragOver = (event, nodeProps) => {
const {
dragChildrenKeys,
flattenNodes,
keyEntities,
expandedKeys,
indent
} = this.state;
const {
onDragOver,
allowDrop,
direction
} = this.props;
if (!this.dragNodeProps) {
return;
}
const {
dropPosition,
dropLevelOffset,
dropTargetKey,
dropContainerKey,
dropTargetPos,
dropAllowed,
dragOverNodeKey
} = calcDropPosition(event, this.dragNodeProps, nodeProps, indent, this.dragStartMousePosition, allowDrop, flattenNodes, keyEntities, expandedKeys, direction);
if (dragChildrenKeys.includes(dropTargetKey) || !dropAllowed) {
// don't allow drop inside its children
// don't allow drop when drop is not allowed calculated by calcDropPosition
return;
}
// Update drag position
if (this.dragNodeProps.eventKey === dropTargetKey && dropLevelOffset === 0) {
if (!(this.state.dropPosition === null && this.state.dropLevelOffset === null && this.state.dropTargetKey === null && this.state.dropContainerKey === null && this.state.dropTargetPos === null && this.state.dropAllowed === false && this.state.dragOverNodeKey === null)) {
this.resetDragState();
}
} else if (!(dropPosition === this.state.dropPosition && dropLevelOffset === this.state.dropLevelOffset && dropTargetKey === this.state.dropTargetKey && dropContainerKey === this.state.dropContainerKey && dropTargetPos === this.state.dropTargetPos && dropAllowed === this.state.dropAllowed && dragOverNodeKey === this.state.dragOverNodeKey)) {
this.setState({
dropPosition,
dropLevelOffset,
dropTargetKey,
dropContainerKey,
dropTargetPos,
dropAllowed,
dragOverNodeKey
});
}
onDragOver?.({
event,
node: convertNodePropsToEventData(nodeProps)
});
};
onNodeDragLeave = (event, nodeProps) => {
// if it is outside the droppable area
// currentMouseOverDroppableNodeKey will be updated in dragenter event when into another droppable receiver.
if (this.currentMouseOverDroppableNodeKey === nodeProps.eventKey && !event.currentTarget.contains(event.relatedTarget)) {
this.resetDragState();
this.currentMouseOverDroppableNodeKey = null;
}
const {
onDragLeave
} = this.props;
onDragLeave?.({
event,
node: convertNodePropsToEventData(nodeProps)
});
};
// since stopPropagation() is called in treeNode
// if onWindowDrag is called, whice means state is keeped, drag state should be cleared
onWindowDragEnd = event => {
this.onNodeDragEnd(event, null, true);
window.removeEventListener('dragend', this.onWindowDragEnd);
};
// if onNodeDragEnd is called, onWindowDragEnd won't be called since stopPropagation() is called
onNodeDragEnd = (event, nodeProps) => {
const {
onDragEnd
} = this.props;
this.setState({
dragOverNodeKey: null
});
this.cleanDragState();
onDragEnd?.({
event,
node: convertNodePropsToEventData(nodeProps)
});
this.dragNodeProps = null;
window.removeEventListener('dragend', this.onWindowDragEnd);
};
onNodeDrop = (event, _, outsideTree = false) => {
const {
dragChildrenKeys,
dropPosition,
dropTargetKey,
dropTargetPos,
dropAllowed
} = this.state;
if (!dropAllowed) {
return;
}
const {
onDrop
} = this.props;
this.setState({
dragOverNodeKey: null
});
this.cleanDragState();
if (dropTargetKey === null) return;
const abstractDropNodeProps = {
...getTreeNodeProps(dropTargetKey, this.getTreeNodeRequiredProps()),
active: this.getActiveItem()?.key === dropTargetKey,
data: getEntity(this.state.keyEntities, dropTargetKey).node
};
const dropToChild = dragChildrenKeys.includes(dropTargetKey);
(0,warning["default"])(!dropToChild, "Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");
const posArr = posToArr(dropTargetPos);
const dropResult = {
event,
node: convertNodePropsToEventData(abstractDropNodeProps),
dragNode: this.dragNodeProps ? convertNodePropsToEventData(this.dragNodeProps) : null,
dragNodesKeys: [this.dragNodeProps.eventKey].concat(dragChildrenKeys),
dropToGap: dropPosition !== 0,
dropPosition: dropPosition + Number(posArr[posArr.length - 1])
};
if (!outsideTree) {
onDrop?.(dropResult);
}
this.dragNodeProps = null;
};
resetDragState() {
this.setState({
dragOverNodeKey: null,
dropPosition: null,
dropLevelOffset: null,
dropTargetKey: null,
dropContainerKey: null,
dropTargetPos: null,
dropAllowed: false
});
}
cleanDragState = () => {
const {
draggingNodeKey
} = this.state;
if (draggingNodeKey !== null) {
this.setState({
draggingNodeKey: null,
dropPosition: null,
dropContainerKey: null,
dropTargetKey: null,
dropLevelOffset: null,
dropAllowed: true,
dragOverNodeKey: null
});
}
this.dragStartMousePosition = null;
this.currentMouseOverDroppableNodeKey = null;
};
triggerExpandActionExpand = (e, treeNode) => {
const {
expandedKeys,
flattenNodes
} = this.state;
const {
expanded,
key,
isLeaf
} = treeNode;
if (isLeaf || e.shiftKey || e.metaKey || e.ctrlKey) {
return;
}
const node = flattenNodes.filter(nodeItem => nodeItem.key === key)[0];
const eventNode = convertNodePropsToEventData({
...getTreeNodeProps(key, this.getTreeNodeRequiredProps()),
data: node.data
});
this.setExpandedKeys(expanded ? arrDel(expandedKeys, key) : arrAdd(expandedKeys, key));
this.onNodeExpand(e, eventNode);
};
onNodeClick = (e, treeNode) => {
const {
onClick,
expandAction
} = this.props;
if (expandAction === 'click') {
this.triggerExpandActionExpand(e, treeNode);
}
onClick?.(e, treeNode);
};
onNodeDoubleClick = (e, treeNode) => {
const {
onDoubleClick,
expandAction
} = this.props;
if (expandAction === 'doubleClick') {
this.triggerExpandActionExpand(e, treeNode);
}
onDoubleClick?.(e, treeNode);
};
onNodeSelect = (e, treeNode) => {
let {
selectedKeys
} = this.state;
const {
keyEntities,
fieldNames
} = this.state;
const {
onSelect,
multiple
} = this.props;
const {
selected
} = treeNode;
const key = treeNode[fieldNames.key];
const targetSelected = !selected;
// Update selected keys
if (!targetSelected) {
selectedKeys = arrDel(selectedKeys, key);
} else if (!multiple) {
selectedKeys = [key];
} else {
selectedKeys = arrAdd(selectedKeys, key);
}
// [Legacy] Not found related usage in doc or upper libs
const selectedNodes = selectedKeys.map(selectedKey => {
const entity = getEntity(keyEntities, selectedKey);
return entity ? entity.node : null;
}).filter(Boolean);
this.setUncontrolledState({
selectedKeys
});
onSelect?.(selectedKeys, {
event: 'select',
selected: targetSelected,
node: treeNode,
selectedNodes,
nativeEvent: e.nativeEvent
});
};
onNodeCheck = (e, treeNode, checked) => {
const {
keyEntities,
checkedKeys: oriCheckedKeys,
halfCheckedKeys: oriHalfCheckedKeys
} = this.state;
const {
checkStrictly,
onCheck
} = this.props;
const {
key
} = treeNode;
// Prepare trigger arguments
let checkedObj;
const eventObj = {
event: 'check',
node: treeNode,
checked,
nativeEvent: e.nativeEvent
};
if (checkStrictly) {
const checkedKeys = checked ? arrAdd(oriCheckedKeys, key) : arrDel(oriCheckedKeys, key);
const halfCheckedKeys = arrDel(oriHalfCheckedKeys, key);
checkedObj = {
checked: checkedKeys,
halfChecked: halfCheckedKeys
};
eventObj.checkedNodes = checkedKeys.map(checkedKey => getEntity(keyEntities, checkedKey)).filter(Boolean).map(entity => entity.node);
this.setUncontrolledState({
checkedKeys
});
} else {
// Always fill first
let {
checkedKeys,
halfCheckedKeys
} = conductCheck([...oriCheckedKeys, key], true, keyEntities);
// If remove, we do it again to correction
if (!checked) {
const keySet = new Set(checkedKeys);
keySet.delete(key);
({
checkedKeys,
halfCheckedKeys
} = conductCheck(Array.from(keySet), {
checked: false,
halfCheckedKeys
}, keyEntities));
}
checkedObj = checkedKeys;
// [Legacy] This is used for `rc-tree-select`
eventObj.checkedNodes = [];
eventObj.checkedNodesPositions = [];
eventObj.halfCheckedKeys = halfCheckedKeys;
checkedKeys.forEach(checkedKey => {
const entity = getEntity(keyEntities, checkedKey);
if (!entity) return;
const {
node,
pos
} = entity;
eventObj.checkedNodes.push(node);
eventObj.checkedNodesPositions.push({
node,
pos
});
});
this.setUncontrolledState({
checkedKeys
}, false, {
halfCheckedKeys
});
}
onCheck?.(checkedObj, eventObj);
};
onNodeLoad = treeNode => {
const {
key
} = treeNode;
const {
keyEntities
} = this.state;
// Skip if has children already
const entity = getEntity(keyEntities, key);
if (entity?.children?.length) {
return;
}
const loadPromise = new Promise((resolve, reject) => {
// We need to get the latest state of loading/loaded keys
this.setState(({
loadedKeys = [],
loadingKeys = []
}) => {
const {
loadData,
onLoad
} = this.props;
if (!loadData || loadedKeys.includes(key) || loadingKeys.includes(key)) {
return null;
}
// Process load data
const promise = loadData(treeNode);
promise.then(() => {
const {
loadedKeys: currentLoadedKeys
} = this.state;
const newLoadedKeys = arrAdd(currentLoadedKeys, key);
// onLoad should trigger before internal setState to avoid `loadData` trigger twice.
// https://github.com/ant-design/ant-design/issues/12464
onLoad?.(newLoadedKeys, {
event: 'load',
node: treeNode
});
this.setUncontrolledState({
loadedKeys: newLoadedKeys
});
this.setState(prevState => ({
loadingKeys: arrDel(prevState.loadingKeys, key)
}));
resolve();
}).catch(e => {
this.setState(prevState => ({
loadingKeys: arrDel(prevState.loadingKeys, key)
}));
// If exceed max retry times, we give up retry
this.loadingRetryTimes[key] = (this.loadingRetryTimes[key] || 0) + 1;
if (this.loadingRetryTimes[key] >= MAX_RETRY_TIMES) {
const {
loadedKeys: currentLoadedKeys
} = this.state;
(0,warning["default"])(false, 'Retry for `loadData` many times but still failed. No more retry.');
this.setUncontrolledState({
loadedKeys: arrAdd(currentLoadedKeys, key)
});
resolve();
}
reject(e);
});
return {
loadingKeys: arrAdd(loadingKeys, key)
};
});
});
// Not care warning if we ignore this
loadPromise.catch(() => {});
return loadPromise;
};
onNodeMouseEnter = (event, node) => {
const {
onMouseEnter
} = this.props;
onMouseEnter?.({
event,
node
});
};
onNodeMouseLeave = (event, node) => {
const {
onMouseLeave
} = this.props;
onMouseLeave?.({
event,
node
});
};
onNodeContextMenu = (event, node) => {
const {
onRightClick
} = this.props;
if (onRightClick) {
event.preventDefault();
onRightClick({
event,
node
});
}
};
onMouseDown = event => {
this.focusedByMouse = true;
const {
onMouseDown
} = this.props;
onMouseDown?.(event);
};
onMouseUp = event => {
this.focusedByMouse = false;
const {
onMouseUp
} = this.props;
onMouseUp?.(event);
};
onFocus = (...args) => {
const {
onFocus,
disabled
} = this.props;
const {
activeKey,
selectedKeys,
flattenNodes
} = this.state;
if (!this.focusedByMouse && !disabled && activeKey === null) {
const visibleSelectedKey = selectedKeys.find(key => {
return flattenNodes.some(nodeItem => nodeItem.key === key);
});
if (visibleSelectedKey !== undefined) {
this.onActiveChange(visibleSelectedKey);
} else {
this.onActiveChange(flattenNodes?.[0]?.key || null);
}
}
onFocus?.(...args);
};
onBlur = (...args) => {
this.focusedByMouse = false;
const {
onBlur
} = this.props;
this.onActiveChange(null);
onBlur?.(...args);
};
getTreeNodeRequiredProps = () => {
const {
expandedKeys,
selectedKeys,
loadedKeys,
loadingKeys,
checkedKeys,
halfCheckedKeys,
dragOverNodeKey,
dropPosition,
keyEntities
} = this.state;
return {
expandedKeys: expandedKeys || [],
selectedKeys: selectedKeys || [],
loadedKeys: loadedKeys || [],
loadingKeys: loadingKeys || [],
checkedKeys: checkedKeys || [],
halfCheckedKeys: halfCheckedKeys || [],
dragOverNodeKey,
dropPosition,
keyEntities: keyEntities
};
};
// =========================== Expanded ===========================
/** Set uncontrolled `expandedKeys`. This will also auto update `flattenNodes`. */
setExpandedKeys = expandedKeys => {
const {
treeData,
fieldNames
} = this.state;
const flattenNodes = flattenTreeData(treeData, expandedKeys, fieldNames);
this.setUncontrolledState({
expandedKeys,
flattenNodes
}, true);
};
onNodeExpand = (e, treeNode) => {
let {
expandedKeys
} = this.state;
const {
listChanging,
fieldNames
} = this.state;
const {
onExpand,
loadData
} = this.props;
const {
expanded
} = treeNode;
const key = treeNode[fieldNames.key];
// Do nothing when motion is in progress
if (listChanging) {
return;
}
// Update selected keys
const certain = expandedKeys.includes(key);
const targetExpanded = !expanded;
(0,warning["default"])(expanded && certain || !expanded && !certain, 'Expand state not sync with index check');
expandedKeys = targetExpanded ? arrAdd(expandedKeys, key) : arrDel(expandedKeys, key);
this.setExpandedKeys(expandedKeys);
onExpand?.(expandedKeys, {
node: treeNode,
expanded: targetExpanded,
nativeEvent: e.nativeEvent
});
// Async Load data
if (targetExpanded && loadData) {
const loadPromise = this.onNodeLoad(treeNode);
if (loadPromise) {
loadPromise.then(() => {
// [Legacy] Refresh logic
const newFlattenTreeData = flattenTreeData(this.state.treeData, expandedKeys, fieldNames);
this.setUncontrolledState({
flattenNodes: newFlattenTreeData
});
}).catch(() => {
const {
expandedKeys: currentExpandedKeys
} = this.state;
const expandedKeysToRestore = arrDel(currentExpandedKeys, key);
this.setExpandedKeys(expandedKeysToRestore);
});
}
}
};
onListChangeStart = () => {
this.setUncontrolledState({
listChanging: true
});
};
onListChangeEnd = () => {
setTimeout(() => {
this.setUncontrolledState({
listChanging: false
});
});
};
// =========================== Keyboard ===========================
onActiveChange = newActiveKey => {
const {
activeKey
} = this.state;
const {
onActiveChange,
itemScrollOffset = 0
} = this.props;
if (activeKey === newActiveKey) {
return;
}
this.setState({
activeKey: newActiveKey
});
if (newActiveKey !== null) {
this.scrollTo({
key: newActiveKey,
offset: itemScrollOffset
});
}
onActiveChange?.(newActiveKey);
};
getActiveItem = () => {
const {
activeKey,
flattenNodes
} = this.state;
if (activeKey === null) {
return null;
}
return flattenNodes.find(({
key
}) => key === activeKey) || null;
};
offsetActiveKey = offset => {
const {
flattenNodes,
activeKey
} = this.state;
let index = flattenNodes.findIndex(({
key
}) => key === activeKey);
// Align with index
if (index === -1 && offset < 0) {
index = flattenNodes.length;
}
index = (index + offset + flattenNodes.length) % flattenNodes.length;
const item = flattenNodes[index];
if (item) {
const {
key
} = item;
this.onActiveChange(key);
} else {
this.onActiveChange(null);
}
};
onKeyDown = event => {
const {
activeKey,
expandedKeys,
checkedKeys,
flattenNodes,
keyEntities
} = this.state;
const {
onKeyDown,
checkable,
selectable,
disabled,
loadData
} = this.props;
if (disabled) {
return;
}
// >>>>>>>>>> Direction
switch (event.key) {
case 'ArrowUp':
{
this.offsetActiveKey(-1);
event.preventDefault();
break;
}
case 'ArrowDown':
{
this.offsetActiveKey(1);
event.preventDefault();
break;
}
case 'Home':
{
this.onActiveChange(flattenNodes?.[0]?.key);
event.preventDefault();
break;
}
case 'End':
{
this.onActiveChange(flattenNodes?.[flattenNodes.length - 1]?.key);
event.preventDefault();
break;
}
}
// >>>>>>>>>> Expand & Selection
const activeItem = this.getActiveItem();
if (activeItem && activeItem.data) {
const treeNodeRequiredProps = this.getTreeNodeRequiredProps();
const eventNode = convertNodePropsToEventData({
...getTreeNodeProps(activeKey, treeNodeRequiredProps),
data: activeItem.data,
active: true
});
const entity = getEntity(keyEntities, activeKey);
const hasChildren = !!entity?.children?.length;
const expandable = !isLeafNode(activeItem.data.isLeaf, loadData, hasChildren, eventNode.loaded);
const canCheck = checkable && !eventNode.disabled && eventNode.checkable !== false && !eventNode.disableCheckbox;
const canSelect = !checkable && selectable && !eventNode.disabled && eventNode.selectable !== false;
switch (event.key) {
// >>> Expand
case 'ArrowLeft':
{
// Collapse if possible
if (expandable && expandedKeys.includes(activeKey)) {
this.onNodeExpand({}, eventNode);
} else if (activeItem.parent) {
this.onActiveChange(activeItem.parent.key);
}
event.preventDefault();
break;
}
case 'ArrowRight':
{
// Expand if possible
if (expandable && !expandedKeys.includes(activeKey)) {
this.onNodeExpand({}, eventNode);
} else if (activeItem.children && activeItem.children.length) {
this.onActiveChange(activeItem.children[0].key);
}
event.preventDefault();
break;
}
case 'Enter':
{
if (expandable) {
event.preventDefault();
this.onNodeExpand({}, eventNode);
} else if (canCheck) {
if (!checkedKeys.includes(activeKey)) {
event.preventDefault();
this.onNodeCheck({}, eventNode, true);
}
} else if (canSelect && !eventNode.selected) {
event.preventDefault();
this.onNodeSelect({}, eventNode);
}
break;
}
case ' ':
{
if (canCheck) {
event.preventDefault();
this.onNodeCheck({}, eventNode, !checkedKeys.includes(activeKey));
} else if (canSelect) {
event.preventDefault();
this.onNodeSelect({}, eventNode);
}
break;
}
}
}
onKeyDown?.(event);
};
/**
* Only update the value which is not in props
*/
setUncontrolledState = (state, atomic = false, forceState = null) => {
if (!this.destroyed) {
let needSync = false;
let allPassed = true;
const newState = {};
Object.keys(state).forEach(name => {
if (this.props.hasOwnProperty(name)) {
allPassed = false;
return;
}
needSync = true;
newState[name] = state[name];
});
if (needSync && (!atomic || allPassed)) {
this.setState({
...newState,
...forceState
});
}
}
};
scrollTo = scroll => {
this.listRef.current.scrollTo(scroll);
};
render() {
const {
flattenNodes,
keyEntities,
draggingNodeKey,
dropLevelOffset,
dropContainerKey,
dropTargetKey,
dropPosition,
dragOverNodeKey,
indent
} = this.state;
const {
prefixCls,
className,
style,
styles,
classNames: treeClassNames,
showLine,
focusable,
tabIndex = 0,
selectable,
showIcon,
icon,
switcherIcon,
draggable,
checkable,
checkStrictly,
disabled,
motion,
loadData,
filterTreeNode,
height,
itemHeight,
scrollWidth,
virtual,
titleRender,
dropIndicatorRender,
onContextMenu,
onScroll,
direction,
rootClassName,
rootStyle
} = this.props;
const domProps = (0,pickAttrs["default"])(this.props, {
aria: true,
data: true
});
// It's better move to hooks but we just simply keep here
let draggableConfig;
if (draggable) {
if (typeof draggable === 'object') {
draggableConfig = draggable;
} else if (typeof draggable === 'function') {
draggableConfig = {
nodeDraggable: draggable
};
} else {
draggableConfig = {};
}
}
const contextValue = {
styles,
classNames: treeClassNames,
prefixCls,
selectable,
showIcon,
icon,
switcherIcon,
draggable: draggableConfig,
draggingNodeKey,
checkable,
checkStrictly,
disabled,
keyEntities,
dropLevelOffset,
dropContainerKey,
dropTargetKey,
dropPosition,
dragOverNodeKey,
indent,
direction,
dropIndicatorRender,
loadData,
filterTreeNode,
titleRender,
onNodeClick: this.onNodeClick,
onNodeDoubleClick: this.onNodeDoubleClick,
onNodeExpand: this.onNodeExpand,
onNodeSelect: this.onNodeSelect,
onNodeCheck: this.onNodeCheck,
onNodeLoad: this.onNodeLoad,
onNodeMouseEnter: this.onNodeMouseEnter,
onNodeMouseLeave: this.onNodeMouseLeave,
onNodeContextMenu: this.onNodeContextMenu,
onNodeDragStart: this.onNodeDragStart,
onNodeDragEnter: this.onNodeDragEnter,
onNodeDragOver: this.onNodeDragOver,
onNodeDragLeave: this.onNodeDragLeave,
onNodeDragEnd: this.onNodeDragEnd,
onNodeDrop: this.onNodeDrop
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TreeContext.Provider, {
value: contextValue
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(prefixCls, className, rootClassName, {
[`${prefixCls}-show-line`]: showLine
}),
style: rootStyle
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_NodeList, Tree_extends({
ref: this.listRef,
prefixCls: prefixCls,
style: style,
data: flattenNodes,
disabled: disabled,
selectable: selectable,
checkable: !!checkable,
motion: motion,
dragging: draggingNodeKey !== null,
height: height,
itemHeight: itemHeight,
virtual: virtual,
focusable: focusable,
tabIndex: tabIndex,
activeItem: this.getActiveItem(),
onFocus: this.onFocus,
onMouseDown: this.onMouseDown,
onMouseUp: this.onMouseUp,
onBlur: this.onBlur,
onKeyDown: this.onKeyDown,
onActiveChange: this.onActiveChange,
onListChangeStart: this.onListChangeStart,
onListChangeEnd: this.onListChangeEnd,
onContextMenu: onContextMenu,
onScroll: onScroll,
scrollWidth: scrollWidth
}, this.getTreeNodeRequiredProps(), domProps))));
}
}
/* harmony default export */ var es_Tree = (Tree);
;// ./node_modules/@rc-component/tree/es/index.js
/* harmony default export */ var tree_es = (es_Tree);
;// ./node_modules/@ant-design/icons-svg/es/asn/FileOutlined.js
// This icon file is generated automatically.
var FileOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z" } }] }, "name": "file", "theme": "outlined" };
/* harmony default export */ var asn_FileOutlined = (FileOutlined);
;// ./node_modules/@ant-design/icons/es/icons/FileOutlined.js
function FileOutlined_extends() { FileOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return FileOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const FileOutlined_FileOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], FileOutlined_extends({}, props, {
ref: ref,
icon: asn_FileOutlined
}));
/** */
const FileOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(FileOutlined_FileOutlined);
if (true) {
FileOutlined_RefIcon.displayName = 'FileOutlined';
}
/* harmony default export */ var icons_FileOutlined = (FileOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/FolderOpenOutlined.js
// This icon file is generated automatically.
var FolderOpenOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z" } }] }, "name": "folder-open", "theme": "outlined" };
/* harmony default export */ var asn_FolderOpenOutlined = (FolderOpenOutlined);
;// ./node_modules/@ant-design/icons/es/icons/FolderOpenOutlined.js
function FolderOpenOutlined_extends() { FolderOpenOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return FolderOpenOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const FolderOpenOutlined_FolderOpenOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], FolderOpenOutlined_extends({}, props, {
ref: ref,
icon: asn_FolderOpenOutlined
}));
/** */
const FolderOpenOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(FolderOpenOutlined_FolderOpenOutlined);
if (true) {
FolderOpenOutlined_RefIcon.displayName = 'FolderOpenOutlined';
}
/* harmony default export */ var icons_FolderOpenOutlined = (FolderOpenOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/FolderOutlined.js
// This icon file is generated automatically.
var FolderOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z" } }] }, "name": "folder", "theme": "outlined" };
/* harmony default export */ var asn_FolderOutlined = (FolderOutlined);
;// ./node_modules/@ant-design/icons/es/icons/FolderOutlined.js
function FolderOutlined_extends() { FolderOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return FolderOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const FolderOutlined_FolderOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], FolderOutlined_extends({}, props, {
ref: ref,
icon: asn_FolderOutlined
}));
/** */
const FolderOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(FolderOutlined_FolderOutlined);
if (true) {
FolderOutlined_RefIcon.displayName = 'FolderOutlined';
}
/* harmony default export */ var icons_FolderOutlined = (FolderOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/HolderOutlined.js
// This icon file is generated automatically.
var HolderOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M300 276.5a56 56 0 1056-97 56 56 0 00-56 97zm0 284a56 56 0 1056-97 56 56 0 00-56 97zM640 228a56 56 0 10112 0 56 56 0 00-112 0zm0 284a56 56 0 10112 0 56 56 0 00-112 0zM300 844.5a56 56 0 1056-97 56 56 0 00-56 97zM640 796a56 56 0 10112 0 56 56 0 00-112 0z" } }] }, "name": "holder", "theme": "outlined" };
/* harmony default export */ var asn_HolderOutlined = (HolderOutlined);
;// ./node_modules/@ant-design/icons/es/icons/HolderOutlined.js
function HolderOutlined_extends() { HolderOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return HolderOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const HolderOutlined_HolderOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], HolderOutlined_extends({}, props, {
ref: ref,
icon: asn_HolderOutlined
}));
/** */
const HolderOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(HolderOutlined_HolderOutlined);
if (true) {
HolderOutlined_RefIcon.displayName = 'HolderOutlined';
}
/* harmony default export */ var icons_HolderOutlined = (HolderOutlined_RefIcon);
// EXTERNAL MODULE: ./components/tree/style/index.ts + 1 modules
var tree_style = __webpack_require__("./components/tree/style/index.ts");
;// ./components/tree/utils/dropIndicator.tsx
const dropIndicator_offset = 4;
const dropIndicatorRender = props => {
const {
dropPosition,
dropLevelOffset,
prefixCls,
indent,
direction = 'ltr'
} = props;
const startPosition = direction === 'ltr' ? 'left' : 'right';
const endPosition = direction === 'ltr' ? 'right' : 'left';
const style = {
[startPosition]: -dropLevelOffset * indent + dropIndicator_offset,
[endPosition]: 0
};
switch (dropPosition) {
case -1:
style.top = -3;
break;
case 1:
style.bottom = -3;
break;
default:
// dropPosition === 0
style.bottom = -3;
style[startPosition] = indent + dropIndicator_offset;
break;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
style: style,
className: `${prefixCls}-drop-indicator`
});
};
/* harmony default export */ var dropIndicator = (dropIndicatorRender);
;// ./node_modules/@ant-design/icons-svg/es/asn/CaretDownFilled.js
// This icon file is generated automatically.
var CaretDownFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z" } }] }, "name": "caret-down", "theme": "filled" };
/* harmony default export */ var asn_CaretDownFilled = (CaretDownFilled);
;// ./node_modules/@ant-design/icons/es/icons/CaretDownFilled.js
function CaretDownFilled_extends() { CaretDownFilled_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return CaretDownFilled_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const CaretDownFilled_CaretDownFilled = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], CaretDownFilled_extends({}, props, {
ref: ref,
icon: asn_CaretDownFilled
}));
/** */
const CaretDownFilled_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(CaretDownFilled_CaretDownFilled);
if (true) {
CaretDownFilled_RefIcon.displayName = 'CaretDownFilled';
}
/* harmony default export */ var icons_CaretDownFilled = (CaretDownFilled_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/MinusSquareOutlined.js
// This icon file is generated automatically.
var MinusSquareOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M328 544h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z" } }, { "tag": "path", "attrs": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z" } }] }, "name": "minus-square", "theme": "outlined" };
/* harmony default export */ var asn_MinusSquareOutlined = (MinusSquareOutlined);
;// ./node_modules/@ant-design/icons/es/icons/MinusSquareOutlined.js
function MinusSquareOutlined_extends() { MinusSquareOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return MinusSquareOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const MinusSquareOutlined_MinusSquareOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], MinusSquareOutlined_extends({}, props, {
ref: ref,
icon: asn_MinusSquareOutlined
}));
/** */
const MinusSquareOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(MinusSquareOutlined_MinusSquareOutlined);
if (true) {
MinusSquareOutlined_RefIcon.displayName = 'MinusSquareOutlined';
}
/* harmony default export */ var icons_MinusSquareOutlined = (MinusSquareOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/PlusSquareOutlined.js
// This icon file is generated automatically.
var PlusSquareOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z" } }, { "tag": "path", "attrs": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z" } }] }, "name": "plus-square", "theme": "outlined" };
/* harmony default export */ var asn_PlusSquareOutlined = (PlusSquareOutlined);
;// ./node_modules/@ant-design/icons/es/icons/PlusSquareOutlined.js
function PlusSquareOutlined_extends() { PlusSquareOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return PlusSquareOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const PlusSquareOutlined_PlusSquareOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], PlusSquareOutlined_extends({}, props, {
ref: ref,
icon: asn_PlusSquareOutlined
}));
/** */
const PlusSquareOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(PlusSquareOutlined_PlusSquareOutlined);
if (true) {
PlusSquareOutlined_RefIcon.displayName = 'PlusSquareOutlined';
}
/* harmony default export */ var icons_PlusSquareOutlined = (PlusSquareOutlined_RefIcon);
;// ./components/tree/utils/iconUtil.tsx
const SwitcherIconCom = props => {
const {
prefixCls,
switcherIcon,
treeNodeProps,
showLine,
switcherLoadingIcon
} = props;
const {
isLeaf,
expanded,
loading
} = treeNodeProps;
if (loading) {
if (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(switcherLoadingIcon)) {
return switcherLoadingIcon;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LoadingOutlined, {
className: `${prefixCls}-switcher-loading-icon`
});
}
let showLeafIcon;
if ((0,is.isPlainObject)(showLine)) {
showLeafIcon = showLine.showLeafIcon;
}
if (isLeaf) {
if (!showLine) {
return null;
}
if (typeof showLeafIcon !== 'boolean' && !!showLeafIcon) {
const leafIcon = typeof showLeafIcon === 'function' ? showLeafIcon(treeNodeProps) : showLeafIcon;
const leafCls = `${prefixCls}-switcher-line-custom-icon`;
if (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(leafIcon)) {
return (0,reactNode.cloneElement)(leafIcon, {
className: (0,clsx.clsx)(leafIcon.props?.className, leafCls)
});
}
return leafIcon;
}
return showLeafIcon ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_FileOutlined, {
className: `${prefixCls}-switcher-line-icon`
})) : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-switcher-leaf-line`
}));
}
const switcherCls = `${prefixCls}-switcher-icon`;
const switcher = typeof switcherIcon === 'function' ? switcherIcon(treeNodeProps) : switcherIcon;
if (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(switcher)) {
return (0,reactNode.cloneElement)(switcher, {
className: (0,clsx.clsx)(switcher.props?.className, showLine ? `${prefixCls}-switcher-line-icon` : switcherCls)
});
}
if (switcher !== undefined) {
return switcher;
}
if (showLine) {
return expanded ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_MinusSquareOutlined, {
className: `${prefixCls}-switcher-line-icon`
})) : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_PlusSquareOutlined, {
className: `${prefixCls}-switcher-line-icon`
}));
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CaretDownFilled, {
className: switcherCls
});
};
/* harmony default export */ var iconUtil = (SwitcherIconCom);
;// ./components/tree/Tree.tsx
const Tree_Tree = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('tree');
const {
virtual
} = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(config_provider_context.ConfigContext);
const {
prefixCls: customizePrefixCls,
className,
showIcon = false,
showLine,
switcherIcon,
switcherLoadingIcon,
blockNode = false,
children,
checkable = false,
selectable = true,
draggable,
disabled,
motion: customMotion,
style,
rootClassName,
classNames,
styles,
icon
} = props;
const contextDisabled = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useContext(config_provider_DisabledContext);
const mergedDisabled = disabled ?? contextDisabled;
const prefixCls = getPrefixCls('tree', customizePrefixCls);
const rootPrefixCls = getPrefixCls();
const motion = customMotion ?? {
...(0,_util_motion["default"])(rootPrefixCls),
motionAppear: false
};
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
showIcon,
blockNode,
checkable,
selectable,
disabled: mergedDisabled,
motion
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const newProps = {
...mergedProps,
showLine: Boolean(showLine),
icon: icon,
dropIndicatorRender: dropIndicator
};
const [hashId, cssVarCls] = (0,tree_style["default"])(prefixCls);
const [, token] = (0,useToken["default"])();
const itemHeight = token.paddingXS / 2 + (token.Tree?.titleHeight || token.controlHeightSM);
const draggableConfig = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
if (!draggable) {
return false;
}
let mergedDraggable = {};
switch (typeof draggable) {
case 'function':
mergedDraggable.nodeDraggable = draggable;
break;
case 'object':
mergedDraggable = {
...draggable
};
break;
default:
break;
// Do nothing
}
if (mergedDraggable.icon !== false) {
mergedDraggable.icon = mergedDraggable.icon || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_HolderOutlined, null);
}
return mergedDraggable;
}, [draggable]);
const renderSwitcherIcon = nodeProps => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(iconUtil, {
prefixCls: prefixCls,
switcherIcon: switcherIcon,
switcherLoadingIcon: switcherLoadingIcon,
treeNodeProps: nodeProps,
showLine: showLine
}));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(tree_es, {
itemHeight: itemHeight,
ref: ref,
virtual: virtual,
...newProps,
// newProps may contain style so declare style below it
prefixCls: prefixCls,
className: (0,clsx.clsx)({
[`${prefixCls}-icon-hide`]: !showIcon,
[`${prefixCls}-block-node`]: blockNode,
[`${prefixCls}-unselectable`]: !selectable,
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-disabled`]: mergedDisabled
}, contextClassName, className, hashId, cssVarCls),
style: {
...contextStyle,
...style
},
rootClassName: (0,clsx.clsx)(mergedClassNames.root, rootClassName),
rootStyle: mergedStyles.root,
classNames: mergedClassNames,
styles: mergedStyles,
direction: direction,
checkable: checkable ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: `${prefixCls}-checkbox-inner`
}) : checkable,
selectable: selectable,
switcherIcon: renderSwitcherIcon,
draggable: draggableConfig
}, children);
});
if (true) {
Tree_Tree.displayName = 'Tree';
}
/* harmony default export */ var tree_Tree = (Tree_Tree);
;// ./components/tree/utils/dictUtil.ts
const RECORD_NONE = 0;
const RECORD_START = 1;
const RECORD_END = 2;
function traverseNodesKey(treeData, callback, fieldNames) {
const {
key: fieldKey,
children: fieldChildren
} = fieldNames;
function processNode(dataNode) {
const key = dataNode[fieldKey];
const children = dataNode[fieldChildren];
if (callback(key, dataNode) !== false) {
traverseNodesKey(children || [], callback, fieldNames);
}
}
treeData.forEach(processNode);
}
/** 计算选中范围,只考虑expanded情况以优化性能 */
function calcRangeKeys({
treeData,
expandedKeys,
startKey,
endKey,
fieldNames
}) {
const keys = [];
let record = RECORD_NONE;
if (startKey && startKey === endKey) {
return [startKey];
}
if (!startKey || !endKey) {
return [];
}
function matchKey(key) {
return key === startKey || key === endKey;
}
traverseNodesKey(treeData, key => {
if (record === RECORD_END) {
return false;
}
if (matchKey(key)) {
// Match test
keys.push(key);
if (record === RECORD_NONE) {
record = RECORD_START;
} else if (record === RECORD_START) {
record = RECORD_END;
return false;
}
} else if (record === RECORD_START) {
// Append selection
keys.push(key);
}
return expandedKeys.includes(key);
}, treeUtil_fillFieldNames(fieldNames));
return keys;
}
function convertDirectoryKeysToNodes(treeData, keys, fieldNames) {
const restKeys = (0,toConsumableArray["default"])(keys);
const nodes = [];
traverseNodesKey(treeData, (key, node) => {
const index = restKeys.indexOf(key);
if (index !== -1) {
nodes.push(node);
restKeys.splice(index, 1);
}
return !!restKeys.length;
}, treeUtil_fillFieldNames(fieldNames));
return nodes;
}
;// ./components/tree/DirectoryTree.tsx
function getIcon(props) {
const {
isLeaf,
expanded
} = props;
if (isLeaf) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_FileOutlined, null);
}
return expanded ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_FolderOpenOutlined, null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_FolderOutlined, null);
}
function getTreeData({
treeData,
children
}) {
return treeData || convertTreeToData(children);
}
const DirectoryTree = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((oriProps, ref) => {
const {
defaultExpandAll,
defaultExpandParent,
defaultExpandedKeys,
...props
} = oriProps;
// Shift click usage
const lastSelectedKeyRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const cachedSelectedKeysRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const getInitExpandedKeys = () => {
const {
keyEntities
} = convertDataToEntities(getTreeData(props), {
fieldNames: props.fieldNames
});
let initExpandedKeys;
const mergedExpandedKeys = props.expandedKeys || defaultExpandedKeys || [];
// Expanded keys
if (defaultExpandAll) {
initExpandedKeys = Object.keys(keyEntities);
} else if (defaultExpandParent) {
initExpandedKeys = conductExpandParent(mergedExpandedKeys, keyEntities);
} else {
initExpandedKeys = mergedExpandedKeys;
}
return initExpandedKeys;
};
const [selectedKeys, setSelectedKeys] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(props.selectedKeys || props.defaultSelectedKeys || []);
const [expandedKeys, setExpandedKeys] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(() => getInitExpandedKeys());
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if ('selectedKeys' in props) {
setSelectedKeys(props.selectedKeys);
}
}, [props.selectedKeys]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if ('expandedKeys' in props) {
setExpandedKeys(props.expandedKeys);
}
}, [props.expandedKeys]);
const onExpand = (keys, info) => {
if (!('expandedKeys' in props)) {
setExpandedKeys(keys);
}
// Call origin function
return props.onExpand?.(keys, info);
};
const onSelect = (keys, event) => {
const {
multiple,
fieldNames
} = props;
const {
node,
nativeEvent
} = event;
const {
key = ''
} = node;
const treeData = getTreeData(props);
// We need wrap this event since some value is not same
const newEvent = {
...event,
selected: true // Directory selected always true
};
// Windows / Mac single pick
const ctrlPick = nativeEvent?.ctrlKey || nativeEvent?.metaKey;
const shiftPick = nativeEvent?.shiftKey;
// Generate new selected keys
let newSelectedKeys;
if (multiple && ctrlPick) {
// Control click
newSelectedKeys = keys;
lastSelectedKeyRef.current = key;
cachedSelectedKeysRef.current = newSelectedKeys;
newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys, fieldNames);
} else if (multiple && shiftPick) {
// Shift click
newSelectedKeys = Array.from(new Set([].concat((0,toConsumableArray["default"])(cachedSelectedKeysRef.current || []), (0,toConsumableArray["default"])(calcRangeKeys({
treeData,
expandedKeys,
startKey: key,
endKey: lastSelectedKeyRef.current,
fieldNames
})))));
newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys, fieldNames);
} else {
// Single click
newSelectedKeys = [key];
lastSelectedKeyRef.current = key;
cachedSelectedKeysRef.current = newSelectedKeys;
newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys, fieldNames);
}
props.onSelect?.(newSelectedKeys, newEvent);
if (!('selectedKeys' in props)) {
setSelectedKeys(newSelectedKeys);
}
};
const {
getPrefixCls,
direction
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const {
prefixCls: customizePrefixCls,
className,
showIcon = true,
expandAction = 'click',
...restProps
} = props;
const prefixCls = getPrefixCls('tree', customizePrefixCls);
const connectClassName = (0,clsx.clsx)(`${prefixCls}-directory`, {
[`${prefixCls}-directory-rtl`]: direction === 'rtl'
}, className);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(tree_Tree, {
icon: getIcon,
ref: ref,
blockNode: true,
...restProps,
showIcon: showIcon,
expandAction: expandAction,
prefixCls: prefixCls,
className: connectClassName,
expandedKeys: expandedKeys,
selectedKeys: selectedKeys,
onSelect: onSelect,
onExpand: onExpand
});
});
if (true) {
DirectoryTree.displayName = 'DirectoryTree';
}
/* harmony default export */ var tree_DirectoryTree = (DirectoryTree);
;// ./components/tree/index.tsx
const components_tree_Tree = tree_Tree;
components_tree_Tree.DirectoryTree = tree_DirectoryTree;
components_tree_Tree.TreeNode = es_TreeNode;
/* harmony default export */ var tree = (components_tree_Tree);
;// ./components/table/hooks/useFilter/FilterSearch.tsx
const FilterSearch = props => {
const {
value,
filterSearch,
tablePrefixCls,
locale,
onChange
} = props;
if (!filterSearch) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${tablePrefixCls}-filter-dropdown-search`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(input_Input, {
prefix: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_SearchOutlined, null),
placeholder: locale.filterSearchPlaceholder,
onChange: onChange,
value: value,
// for skip min-width of input
htmlSize: 1,
className: `${tablePrefixCls}-filter-dropdown-search-input`
}));
};
/* harmony default export */ var useFilter_FilterSearch = (FilterSearch);
;// ./components/table/hooks/useFilter/FilterWrapper.tsx
const onKeyDown = event => {
const {
keyCode
} = event;
if (keyCode === KeyCode["default"].ENTER) {
event.stopPropagation();
}
};
const FilterDropdownMenuWrapper = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: props.className,
onClick: e => e.stopPropagation(),
onKeyDown: onKeyDown,
ref: ref
}, props.children)));
if (true) {
FilterDropdownMenuWrapper.displayName = 'FilterDropdownMenuWrapper';
}
/* harmony default export */ var FilterWrapper = (FilterDropdownMenuWrapper);
;// ./components/table/hooks/useFilter/FilterDropdown.tsx
function flattenKeys(filters) {
let keys = [];
(filters || []).forEach(({
value,
children
}) => {
keys.push(value);
if (children) {
keys = [].concat((0,toConsumableArray["default"])(keys), (0,toConsumableArray["default"])(flattenKeys(children)));
}
});
return keys;
}
function hasSubMenu(filters) {
return filters.some(({
children
}) => children);
}
const searchValueMatched = (normalizedSearchValue, text) => {
if (typeof text === 'string' || (0,is.isNumber)(text)) {
return text.toString().toLowerCase().includes(normalizedSearchValue);
}
return false;
};
const renderFilterItems = options => {
const {
filters,
prefixCls,
filteredKeys,
filterMultiple,
searchValue,
normalizedSearchValue,
filterSearch
} = options;
return filters.map((filter, index) => {
const key = String(filter.value);
if (filter.children) {
return {
key: key || index,
label: filter.text,
popupClassName: `${prefixCls}-dropdown-submenu`,
children: renderFilterItems({
filters: filter.children,
prefixCls,
filteredKeys,
filterMultiple,
searchValue,
normalizedSearchValue,
filterSearch
})
};
}
const Component = filterMultiple ? components_checkbox : components_radio;
const item = {
key: filter.value !== undefined ? key : index,
label: (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, {
checked: filteredKeys.includes(key)
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", null, filter.text)))
};
if (normalizedSearchValue) {
if (typeof filterSearch === 'function') {
return filterSearch(normalizedSearchValue, filter) ? item : null;
}
return searchValueMatched(normalizedSearchValue, filter.text) ? item : null;
}
return item;
});
};
function wrapStringListType(keys) {
return keys || [];
}
const FilterDropdown = props => {
const {
tablePrefixCls,
prefixCls,
column,
dropdownPrefixCls,
columnKey,
filterOnClose,
filterMultiple,
filterMode = 'menu',
filterSearch = false,
filterState,
triggerFilter,
locale,
children,
getPopupContainer,
rootClassName
} = props;
const {
filterResetToDefaultFilteredValue,
defaultFilteredValue,
filterDropdownProps = {},
// Deprecated
filterDropdownOpen,
onFilterDropdownOpenChange
} = column;
const [visible, setVisible] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const inMeasureRow = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(table_TableMeasureRowContext);
const filtered = !!(filterState && (filterState.filteredKeys?.length || filterState.forceFiltered));
const triggerVisible = newVisible => {
setVisible(newVisible);
filterDropdownProps.onOpenChange?.(newVisible);
// deprecated
onFilterDropdownOpenChange?.(newVisible);
};
// =================Warning===================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Table');
const deprecatedList = [['filterDropdownOpen', 'filterDropdownProps.open'], ['onFilterDropdownOpenChange', 'filterDropdownProps.onOpenChange']];
deprecatedList.forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in column), deprecatedName, newName);
});
warning.deprecated(!('filterCheckall' in locale), 'filterCheckall', 'locale.filterCheckAll');
}
const mergedVisible = filterDropdownProps.open ?? filterDropdownOpen ??
// deprecated
visible; // inner state
// ===================== Select Keys =====================
const propFilteredKeys = filterState?.filteredKeys;
const [getFilteredKeysSync, setFilteredKeysSync] = hooks_useSyncState_useSyncState(wrapStringListType(propFilteredKeys));
const onSelectKeys = ({
selectedKeys
}) => {
setFilteredKeysSync(selectedKeys);
};
const onCheck = (keys, {
node,
checked
}) => {
if (!filterMultiple) {
onSelectKeys({
selectedKeys: checked && node.key ? [node.key] : []
});
} else {
onSelectKeys({
selectedKeys: keys
});
}
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (!visible) {
return;
}
onSelectKeys({
selectedKeys: wrapStringListType(propFilteredKeys)
});
}, [propFilteredKeys]);
// ====================== Open Keys ======================
const [openKeys, setOpenKeys] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState([]);
const onOpenChange = keys => {
setOpenKeys(keys);
};
// search in tree mode column filter
const [searchValue, setSearchValue] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState('');
const normalizedSearchValue = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => searchValue.trim().toLowerCase(), [searchValue]);
const onSearch = e => {
const {
value
} = e.target;
setSearchValue(value);
};
// clear search value after close filter dropdown
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (!visible) {
setSearchValue('');
}
}, [visible]);
// ======================= Submit ========================
const internalTriggerFilter = keys => {
const mergedKeys = keys?.length ? keys : null;
if (mergedKeys === null && (!filterState || !filterState.filteredKeys)) {
return null;
}
if ((0,isEqual["default"])(mergedKeys, filterState?.filteredKeys, true)) {
return null;
}
triggerFilter({
column,
key: columnKey,
filteredKeys: mergedKeys
});
};
const onConfirm = () => {
triggerVisible(false);
internalTriggerFilter(getFilteredKeysSync());
};
const onReset = ({
confirm,
closeDropdown
} = {
confirm: false,
closeDropdown: false
}) => {
if (confirm) {
internalTriggerFilter([]);
}
if (closeDropdown) {
triggerVisible(false);
}
setSearchValue('');
if (filterResetToDefaultFilteredValue) {
setFilteredKeysSync((defaultFilteredValue || []).map(String));
} else {
setFilteredKeysSync([]);
}
};
const doFilter = ({
closeDropdown
} = {
closeDropdown: true
}) => {
if (closeDropdown) {
triggerVisible(false);
}
internalTriggerFilter(getFilteredKeysSync());
};
const onVisibleChange = (newVisible, info) => {
if (info.source === 'trigger') {
if (newVisible && propFilteredKeys !== undefined) {
// Sync filteredKeys on appear in controlled mode (propFilteredKeys !== undefined)
setFilteredKeysSync(wrapStringListType(propFilteredKeys));
}
triggerVisible(newVisible);
if (!newVisible && !column.filterDropdown && filterOnClose) {
onConfirm();
}
}
};
// ======================== Style ========================
const dropdownMenuClass = (0,clsx.clsx)({
[`${dropdownPrefixCls}-menu-without-submenu`]: !hasSubMenu(column.filters || [])
});
const onCheckAll = e => {
if (e.target.checked) {
const allFilterKeys = flattenKeys(column?.filters).map(String);
setFilteredKeysSync(allFilterKeys);
} else {
setFilteredKeysSync([]);
}
};
const getTreeData = ({
filters
}) => (filters || []).map((filter, index) => {
const key = String(filter.value);
const item = {
title: filter.text,
key: filter.value !== undefined ? key : String(index)
};
if (filter.children) {
item.children = getTreeData({
filters: filter.children
});
}
return item;
});
const getFilterData = node => ({
...node,
text: node.title,
value: node.key,
children: node.children?.map(getFilterData) || []
});
let dropdownContent;
const {
direction,
renderEmpty
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
if (typeof column.filterDropdown === 'function') {
dropdownContent = column.filterDropdown({
prefixCls: `${dropdownPrefixCls}-custom`,
setSelectedKeys: selectedKeys => onSelectKeys({
selectedKeys: selectedKeys
}),
selectedKeys: getFilteredKeysSync(),
confirm: doFilter,
clearFilters: onReset,
filters: column.filters,
visible: mergedVisible,
close: () => {
triggerVisible(false);
}
});
} else if (column.filterDropdown) {
dropdownContent = column.filterDropdown;
} else {
const selectedKeys = getFilteredKeysSync() || [];
const getFilterComponent = () => {
const empty = renderEmpty?.('Table.filter') ?? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_empty, {
image: components_empty.PRESENTED_IMAGE_SIMPLE,
description: locale.filterEmptyText,
styles: {
image: {
height: 24
}
},
style: {
margin: 0,
padding: '16px 0'
}
}));
if ((column.filters || []).length === 0) {
return empty;
}
if (filterMode === 'tree') {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(useFilter_FilterSearch, {
filterSearch: filterSearch,
value: searchValue,
onChange: onSearch,
tablePrefixCls: tablePrefixCls,
locale: locale
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${tablePrefixCls}-filter-dropdown-tree`
}, filterMultiple ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_checkbox, {
checked: selectedKeys.length === flattenKeys(column.filters).length,
indeterminate: selectedKeys.length > 0 && selectedKeys.length < flattenKeys(column.filters).length,
className: `${tablePrefixCls}-filter-dropdown-checkall`,
onChange: onCheckAll
}, locale?.filterCheckall ?? locale?.filterCheckAll)) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(tree, {
checkable: true,
selectable: false,
blockNode: true,
multiple: filterMultiple,
checkStrictly: !filterMultiple,
className: `${dropdownPrefixCls}-menu`,
onCheck: onCheck,
checkedKeys: selectedKeys,
selectedKeys: selectedKeys,
showIcon: false,
treeData: getTreeData({
filters: column.filters
}),
autoExpandParent: true,
defaultExpandAll: true,
filterTreeNode: normalizedSearchValue ? node => {
if (typeof filterSearch === 'function') {
return filterSearch(searchValue, getFilterData(node));
}
return searchValueMatched(normalizedSearchValue, node.title);
} : undefined
})));
}
const items = renderFilterItems({
filters: column.filters || [],
filterSearch,
prefixCls,
filteredKeys: getFilteredKeysSync(),
filterMultiple,
searchValue,
normalizedSearchValue
});
const isEmpty = items.every(item => item === null);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(useFilter_FilterSearch, {
filterSearch: filterSearch,
value: searchValue,
onChange: onSearch,
tablePrefixCls: tablePrefixCls,
locale: locale
}), isEmpty ? empty : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_menu, {
selectable: true,
multiple: filterMultiple,
prefixCls: `${dropdownPrefixCls}-menu`,
className: dropdownMenuClass,
onSelect: onSelectKeys,
onDeselect: onSelectKeys,
selectedKeys: selectedKeys,
getPopupContainer: getPopupContainer,
openKeys: openKeys,
onOpenChange: onOpenChange,
items: items
})));
};
const getResetDisabled = () => {
if (filterResetToDefaultFilteredValue) {
return (0,isEqual["default"])((defaultFilteredValue || []).map(String), selectedKeys, true);
}
return selectedKeys.length === 0;
};
dropdownContent = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, getFilterComponent(), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-dropdown-btns`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(button_Button, {
type: "link",
size: "small",
disabled: getResetDisabled(),
onClick: () => onReset()
}, locale.filterReset), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(button_Button, {
type: "primary",
size: "small",
onClick: onConfirm
}, locale.filterConfirm)));
}
// We should not block customize Menu with additional props
if (column.filterDropdown) {
dropdownContent = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(OverrideProvider, {
selectable: undefined
}, dropdownContent);
}
dropdownContent = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(FilterWrapper, {
className: `${prefixCls}-dropdown`
}, dropdownContent);
const getDropdownTrigger = () => {
let filterIcon;
if (typeof column.filterIcon === 'function') {
filterIcon = column.filterIcon(filtered);
} else if (column.filterIcon) {
filterIcon = column.filterIcon;
} else {
filterIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_FilterFilled, null);
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
role: "button",
tabIndex: -1,
className: (0,clsx.clsx)(`${prefixCls}-trigger`, {
active: filtered
}),
onClick: e => {
e.stopPropagation();
}
}, filterIcon);
};
const triggerNode = getDropdownTrigger();
// MeasureRow:仅渲染静态 trigger,不渲染 Dropdown 实例
if (inMeasureRow) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-column`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${tablePrefixCls}-column-title`
}, children), triggerNode);
}
const mergedDropdownProps = extendsObject({
trigger: ['click'],
placement: direction === 'rtl' ? 'bottomLeft' : 'bottomRight',
children: triggerNode,
getPopupContainer
}, {
...filterDropdownProps,
rootClassName: (0,clsx.clsx)(rootClassName, filterDropdownProps.rootClassName),
open: mergedVisible,
onOpenChange: onVisibleChange,
popupRender: () => {
if (typeof filterDropdownProps?.dropdownRender === 'function') {
return filterDropdownProps.dropdownRender(dropdownContent);
}
return dropdownContent;
}
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-column`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${tablePrefixCls}-column-title`
}, children), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_dropdown, {
...mergedDropdownProps
}));
};
/* harmony default export */ var useFilter_FilterDropdown = (FilterDropdown);
;// ./components/table/hooks/useFilter/index.tsx
const collectFilterStates = (columns, init, pos) => {
let filterStates = [];
(columns || []).forEach((column, index) => {
const columnPos = getColumnPos(index, pos);
const filterDropdownIsDefined = column.filterDropdown !== undefined;
if (column.filters || filterDropdownIsDefined || 'onFilter' in column) {
if ('filteredValue' in column) {
// Controlled
let filteredValues = column.filteredValue;
if (!filterDropdownIsDefined) {
filteredValues = filteredValues?.map(String) ?? filteredValues;
}
filterStates.push({
column,
key: getColumnKey(column, columnPos),
filteredKeys: filteredValues,
forceFiltered: column.filtered
});
} else {
// Uncontrolled
filterStates.push({
column,
key: getColumnKey(column, columnPos),
filteredKeys: init && column.defaultFilteredValue ? column.defaultFilteredValue : undefined,
forceFiltered: column.filtered
});
}
}
if ('children' in column) {
filterStates = [].concat((0,toConsumableArray["default"])(filterStates), (0,toConsumableArray["default"])(collectFilterStates(column.children, init, columnPos)));
}
});
return filterStates;
};
function injectFilter(prefixCls, dropdownPrefixCls, columns, filterStates, locale, triggerFilter, getPopupContainer, pos, rootClassName) {
return columns.map((column, index) => {
const columnPos = getColumnPos(index, pos);
const {
filterOnClose = true,
filterMultiple = true,
filterMode,
filterSearch
} = column;
let newColumn = column;
if (newColumn.filters || newColumn.filterDropdown) {
const columnKey = getColumnKey(newColumn, columnPos);
const filterState = filterStates.find(({
key
}) => columnKey === key);
newColumn = {
...newColumn,
title: renderProps => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(useFilter_FilterDropdown, {
tablePrefixCls: prefixCls,
prefixCls: `${prefixCls}-filter`,
dropdownPrefixCls: dropdownPrefixCls,
column: newColumn,
columnKey: columnKey,
filterState: filterState,
filterOnClose: filterOnClose,
filterMultiple: filterMultiple,
filterMode: filterMode,
filterSearch: filterSearch,
triggerFilter: triggerFilter,
locale: locale,
getPopupContainer: getPopupContainer,
rootClassName: rootClassName
}, renderColumnTitle(column.title, renderProps)))
};
}
if ('children' in newColumn) {
newColumn = {
...newColumn,
children: injectFilter(prefixCls, dropdownPrefixCls, newColumn.children, filterStates, locale, triggerFilter, getPopupContainer, columnPos, rootClassName)
};
}
return newColumn;
});
}
const generateFilterInfo = filterStates => {
const currentFilters = {};
filterStates.forEach(({
key,
filteredKeys,
column
}) => {
const keyAsString = key;
const {
filters,
filterDropdown
} = column;
if (filterDropdown) {
currentFilters[keyAsString] = filteredKeys || null;
} else if (Array.isArray(filteredKeys)) {
const keys = flattenKeys(filters);
currentFilters[keyAsString] = keys.filter(originKey => filteredKeys.includes(String(originKey)));
} else {
currentFilters[keyAsString] = null;
}
});
return currentFilters;
};
const getFilterData = (data, filterStates, childrenColumnName) => {
const filterDatas = filterStates.reduce((currentData, filterState) => {
const {
column: {
onFilter,
filters
},
filteredKeys
} = filterState;
if (onFilter && filteredKeys && filteredKeys.length) {
// Preprocess the keys corresponding to the filter tree,
// use Map to improve lookup performance to O(1).
const flatKeys = flattenKeys(filters);
const keyMap = new Map();
flatKeys.forEach(k => {
const strKey = String(k);
if (!keyMap.has(strKey)) {
keyMap.set(strKey, k);
}
});
const realKeys = filteredKeys.map(key => {
const strKey = String(key);
return keyMap.get(strKey) ?? key;
});
const internalFilter = subset => subset.reduce((acc, record) => {
const clonedRecord = {
...record
};
if (clonedRecord[childrenColumnName]) {
clonedRecord[childrenColumnName] = getFilterData(clonedRecord[childrenColumnName], filterStates, childrenColumnName);
}
if (realKeys.some(realKey => onFilter(realKey, clonedRecord))) {
acc.push(clonedRecord);
}
return acc;
}, []);
return internalFilter(currentData);
}
return currentData;
}, data);
return filterDatas;
};
const getMergedColumns = rawMergedColumns => rawMergedColumns.flatMap(column => {
if ('children' in column) {
return [column].concat((0,toConsumableArray["default"])(getMergedColumns(column.children || [])));
}
return [column];
});
const useFilter = props => {
const {
prefixCls,
dropdownPrefixCls,
mergedColumns: rawMergedColumns,
onFilterChange,
getPopupContainer,
locale: tableLocale,
rootClassName
} = props;
const warning = (0,_util_warning.devUseWarning)('Table');
const mergedColumns = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => getMergedColumns(rawMergedColumns || []), [rawMergedColumns]);
const [filterStates, setFilterStates] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(() => collectFilterStates(mergedColumns, true));
const mergedFilterStates = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const collectedStates = collectFilterStates(mergedColumns, false);
if (collectedStates.length === 0) {
return collectedStates;
}
let filteredKeysIsAllNotControlled = true;
let filteredKeysIsAllControlled = true;
collectedStates.forEach(({
filteredKeys
}) => {
if (filteredKeys !== undefined) {
filteredKeysIsAllNotControlled = false;
} else {
filteredKeysIsAllControlled = false;
}
});
// Return if not controlled
if (filteredKeysIsAllNotControlled) {
// Filter column may have been removed
const keyList = (mergedColumns || []).map((column, index) => getColumnKey(column, getColumnPos(index)));
return filterStates.filter(({
key
}) => keyList.includes(key)).map(item => {
const col = mergedColumns[keyList.indexOf(item.key)];
return {
...item,
column: {
...item.column,
...col
},
forceFiltered: col.filtered
};
});
}
true ? warning(filteredKeysIsAllControlled, 'usage', 'Columns should all contain `filteredValue` or not contain `filteredValue`.') : 0;
return collectedStates;
}, [mergedColumns, filterStates]);
const filters = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => generateFilterInfo(mergedFilterStates), [mergedFilterStates]);
const triggerFilter = filterState => {
const newFilterStates = mergedFilterStates.filter(({
key
}) => key !== filterState.key);
newFilterStates.push(filterState);
setFilterStates(newFilterStates);
onFilterChange(generateFilterInfo(newFilterStates), newFilterStates);
};
const transformColumns = innerColumns => injectFilter(prefixCls, dropdownPrefixCls, innerColumns, mergedFilterStates, tableLocale, triggerFilter, getPopupContainer, undefined, rootClassName);
return [transformColumns, mergedFilterStates, filters];
};
/* harmony default export */ var hooks_useFilter = (useFilter);
;// ./components/table/hooks/useLazyKVMap.ts
const useLazyKVMap = (data, childrenColumnName, getRowKey) => {
const mapCacheRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({});
function getRecordByKey(key) {
if (!mapCacheRef.current || mapCacheRef.current.data !== data || mapCacheRef.current.childrenColumnName !== childrenColumnName || mapCacheRef.current.getRowKey !== getRowKey) {
const kvMap = new Map();
function dig(records) {
records.forEach((record, index) => {
const rowKey = getRowKey(record, index);
kvMap.set(rowKey, record);
if ((0,is.isPlainObject)(record) && childrenColumnName in record) {
dig(record[childrenColumnName] || []);
}
});
}
dig(data);
mapCacheRef.current = {
data,
childrenColumnName,
kvMap,
getRowKey
};
}
return mapCacheRef.current.kvMap?.get(key);
}
return [getRecordByKey];
};
/* harmony default export */ var hooks_useLazyKVMap = (useLazyKVMap);
;// ./components/table/hooks/usePagination.ts
const DEFAULT_PAGE_SIZE = 10;
function getPaginationParam(mergedPagination, pagination) {
const param = {
current: mergedPagination.current,
pageSize: mergedPagination.pageSize
};
const paginationObj = (0,is.isPlainObject)(pagination) ? pagination : {};
Object.keys(paginationObj).forEach(pageProp => {
const value = mergedPagination[pageProp];
if (typeof value !== 'function') {
param[pageProp] = value;
}
});
return param;
}
function usePagination(total, onChange, pagination) {
const {
total: paginationTotal = 0,
...paginationObj
} = (0,is.isPlainObject)(pagination) ? pagination : {};
const [innerPagination, setInnerPagination] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(() => ({
current: 'defaultCurrent' in paginationObj ? paginationObj.defaultCurrent : 1,
pageSize: 'defaultPageSize' in paginationObj ? paginationObj.defaultPageSize : DEFAULT_PAGE_SIZE
}));
// ============ Basic Pagination Config ============
const mergedPagination = extendsObject(innerPagination, paginationObj, {
total: paginationTotal > 0 ? paginationTotal : total
});
// Reset `current` if data length or pageSize changed
const maxPage = Math.ceil((paginationTotal || total) / mergedPagination.pageSize);
if (mergedPagination.current > maxPage) {
// Prevent a maximum page count of 0
mergedPagination.current = maxPage || 1;
}
const refreshPagination = (current, pageSize) => {
setInnerPagination({
current: current ?? 1,
pageSize: pageSize || mergedPagination.pageSize
});
};
const onInternalChange = (current, pageSize) => {
if (pagination) {
pagination.onChange?.(current, pageSize);
}
refreshPagination(current, pageSize);
onChange(current, pageSize || mergedPagination?.pageSize);
};
if (pagination === false) {
return [{}, () => {}];
}
return [{
...mergedPagination,
onChange: onInternalChange
}, refreshPagination];
}
/* harmony default export */ var hooks_usePagination = (usePagination);
;// ./node_modules/@ant-design/icons-svg/es/asn/CaretDownOutlined.js
// This icon file is generated automatically.
var CaretDownOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z" } }] }, "name": "caret-down", "theme": "outlined" };
/* harmony default export */ var asn_CaretDownOutlined = (CaretDownOutlined);
;// ./node_modules/@ant-design/icons/es/icons/CaretDownOutlined.js
function CaretDownOutlined_extends() { CaretDownOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return CaretDownOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const CaretDownOutlined_CaretDownOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], CaretDownOutlined_extends({}, props, {
ref: ref,
icon: asn_CaretDownOutlined
}));
/** */
const CaretDownOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(CaretDownOutlined_CaretDownOutlined);
if (true) {
CaretDownOutlined_RefIcon.displayName = 'CaretDownOutlined';
}
/* harmony default export */ var icons_CaretDownOutlined = (CaretDownOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/CaretUpOutlined.js
// This icon file is generated automatically.
var CaretUpOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z" } }] }, "name": "caret-up", "theme": "outlined" };
/* harmony default export */ var asn_CaretUpOutlined = (CaretUpOutlined);
;// ./node_modules/@ant-design/icons/es/icons/CaretUpOutlined.js
function CaretUpOutlined_extends() { CaretUpOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return CaretUpOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const CaretUpOutlined_CaretUpOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], CaretUpOutlined_extends({}, props, {
ref: ref,
icon: asn_CaretUpOutlined
}));
/** */
const CaretUpOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(CaretUpOutlined_CaretUpOutlined);
if (true) {
CaretUpOutlined_RefIcon.displayName = 'CaretUpOutlined';
}
/* harmony default export */ var icons_CaretUpOutlined = (CaretUpOutlined_RefIcon);
;// ./components/table/hooks/useSorter.tsx
const ASCEND = 'ascend';
const DESCEND = 'descend';
const getMultiplePriority = column => {
if (column.sorter && typeof column.sorter === 'object' && (0,is.isNumber)(column.sorter.multiple)) {
return column.sorter.multiple;
}
return false;
};
const getSortFunction = sorter => {
if (typeof sorter === 'function') {
return sorter;
}
if ((0,is.isPlainObject)(sorter) && sorter.compare) {
return sorter.compare;
}
return false;
};
const nextSortDirection = (sortDirections, current) => {
if (!current) {
return sortDirections[0];
}
return sortDirections[sortDirections.indexOf(current) + 1];
};
const collectSortStates = (columns, init, pos) => {
let sortStates = [];
const pushState = (column, columnPos) => {
sortStates.push({
column,
key: getColumnKey(column, columnPos),
multiplePriority: getMultiplePriority(column),
sortOrder: column.sortOrder
});
};
(columns || []).forEach((column, index) => {
const columnPos = getColumnPos(index, pos);
if (column.children) {
if ('sortOrder' in column) {
// Controlled
pushState(column, columnPos);
}
sortStates = [].concat((0,toConsumableArray["default"])(sortStates), (0,toConsumableArray["default"])(collectSortStates(column.children, init, columnPos)));
} else if (column.sorter) {
if ('sortOrder' in column) {
// Controlled
pushState(column, columnPos);
} else if (init && column.defaultSortOrder) {
// Default sorter
sortStates.push({
column,
key: getColumnKey(column, columnPos),
multiplePriority: getMultiplePriority(column),
sortOrder: column.defaultSortOrder
});
}
}
});
return sortStates;
};
const injectSorter = (prefixCls, columns, sorterStates, triggerSorter, defaultSortDirections, tableLocale, tableShowSorterTooltip, pos, a11yLocale) => {
const finalColumns = (columns || []).map((column, index) => {
const columnPos = getColumnPos(index, pos);
let newColumn = column;
if (newColumn.sorter) {
const sortDirections = newColumn.sortDirections || defaultSortDirections;
const showSorterTooltip = newColumn.showSorterTooltip === undefined ? tableShowSorterTooltip : newColumn.showSorterTooltip;
const columnKey = getColumnKey(newColumn, columnPos);
const sorterState = sorterStates.find(({
key
}) => key === columnKey);
const sortOrder = sorterState ? sorterState.sortOrder : null;
const nextSortOrder = nextSortDirection(sortDirections, sortOrder);
let sorter;
if (column.sortIcon) {
sorter = column.sortIcon({
sortOrder
});
} else {
const upNode = sortDirections.includes(ASCEND) && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CaretUpOutlined, {
className: (0,clsx.clsx)(`${prefixCls}-column-sorter-up`, {
active: sortOrder === ASCEND
})
}));
const downNode = sortDirections.includes(DESCEND) && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CaretDownOutlined, {
className: (0,clsx.clsx)(`${prefixCls}-column-sorter-down`, {
active: sortOrder === DESCEND
})
}));
sorter = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}-column-sorter`, {
[`${prefixCls}-column-sorter-full`]: !!(upNode && downNode)
})
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-column-sorter-inner`,
"aria-hidden": "true"
}, upNode, downNode));
}
const {
cancelSort,
triggerAsc,
triggerDesc
} = tableLocale || {};
let sortTip = cancelSort;
if (nextSortOrder === DESCEND) {
sortTip = triggerDesc;
} else if (nextSortOrder === ASCEND) {
sortTip = triggerAsc;
}
const tooltipProps = (0,is.isPlainObject)(showSorterTooltip) ? {
title: sortTip,
...showSorterTooltip
} : {
title: sortTip
};
newColumn = {
...newColumn,
className: (0,clsx.clsx)(newColumn.className, {
[`${prefixCls}-column-sort`]: sortOrder
}),
title: renderProps => {
const columnSortersClass = `${prefixCls}-column-sorters`;
const renderColumnTitleWrapper = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-column-title`
}, renderColumnTitle(column.title, renderProps));
const renderSortTitle = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: columnSortersClass
}, renderColumnTitleWrapper, sorter);
if (showSorterTooltip) {
if (typeof showSorterTooltip !== 'boolean' && showSorterTooltip?.target === 'sorter-icon') {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(columnSortersClass, `${columnSortersClass}-tooltip-target-sorter`)
}, renderColumnTitleWrapper, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_tooltip, {
...tooltipProps
}, sorter));
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_tooltip, {
...tooltipProps
}, renderSortTitle);
}
return renderSortTitle;
},
onHeaderCell: col => {
const cell = column.onHeaderCell?.(col) || {};
const originOnClick = cell.onClick;
const originOKeyDown = cell.onKeyDown;
cell.onClick = event => {
triggerSorter({
column,
key: columnKey,
sortOrder: nextSortOrder,
multiplePriority: getMultiplePriority(column)
});
originOnClick?.(event);
};
cell.onKeyDown = event => {
if (event.keyCode === KeyCode["default"].ENTER) {
triggerSorter({
column,
key: columnKey,
sortOrder: nextSortOrder,
multiplePriority: getMultiplePriority(column)
});
originOKeyDown?.(event);
}
};
const renderTitle = safeColumnTitle(column.title, {});
const displayTitle = renderTitle?.toString();
// Inform the screen-reader so it can tell the visually impaired user which column is sorted
if (sortOrder) {
cell['aria-sort'] = sortOrder === 'ascend' ? 'ascending' : 'descending';
}
// Inform the screen-reader so it can tell the visually impaired user that this column can be sorted
cell['aria-description'] = a11yLocale?.sortable;
cell['aria-label'] = displayTitle || '';
cell.className = (0,clsx.clsx)(cell.className, `${prefixCls}-column-has-sorters`);
cell.tabIndex = 0;
if (column.ellipsis) {
cell.title = (renderTitle ?? '').toString();
}
return cell;
}
};
}
if ('children' in newColumn) {
newColumn = {
...newColumn,
children: injectSorter(prefixCls, newColumn.children, sorterStates, triggerSorter, defaultSortDirections, tableLocale, tableShowSorterTooltip, columnPos, a11yLocale)
};
}
return newColumn;
});
return finalColumns;
};
const stateToInfo = sorterState => {
const {
column,
sortOrder
} = sorterState;
return {
column,
order: sortOrder,
field: column.dataIndex,
columnKey: column.key
};
};
const generateSorterInfo = sorterStates => {
const activeSorters = sorterStates.filter(({
sortOrder
}) => sortOrder).map(stateToInfo);
// =========== Legacy compatible support ===========
// https://github.com/ant-design/ant-design/pull/19226
if (activeSorters.length === 0 && sorterStates.length) {
const lastIndex = sorterStates.length - 1;
return {
...stateToInfo(sorterStates[lastIndex]),
column: undefined,
order: undefined,
field: undefined,
columnKey: undefined
};
}
if (activeSorters.length <= 1) {
return activeSorters[0] || {};
}
return activeSorters;
};
const getSortData = (data, sortStates, childrenColumnName) => {
const innerSorterStates = sortStates.slice().sort((a, b) => b.multiplePriority - a.multiplePriority);
const cloneData = data.slice();
const runningSorters = innerSorterStates.filter(({
column: {
sorter
},
sortOrder
}) => getSortFunction(sorter) && sortOrder);
// Skip if no sorter needed
if (!runningSorters.length) {
return cloneData;
}
return cloneData.sort((record1, record2) => {
for (let i = 0; i < runningSorters.length; i += 1) {
const sorterState = runningSorters[i];
const {
column: {
sorter
},
sortOrder
} = sorterState;
const compareFn = getSortFunction(sorter);
if (compareFn && sortOrder) {
const compareResult = compareFn(record1, record2, sortOrder);
if (compareResult !== 0) {
return sortOrder === ASCEND ? compareResult : -compareResult;
}
}
}
return 0;
}).map(record => {
const subRecords = record[childrenColumnName];
if (subRecords) {
return {
...record,
[childrenColumnName]: getSortData(subRecords, sortStates, childrenColumnName)
};
}
return record;
});
};
const useFilterSorter = props => {
const {
prefixCls,
mergedColumns,
sortDirections,
tableLocale,
showSorterTooltip,
onSorterChange,
globalLocale
} = props;
const [sortStates, setSortStates] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(() => collectSortStates(mergedColumns, true));
const getColumnKeys = (columns, pos) => {
const newKeys = [];
columns.forEach((item, index) => {
const columnPos = getColumnPos(index, pos);
newKeys.push(getColumnKey(item, columnPos));
if (Array.isArray(item.children)) {
const childKeys = getColumnKeys(item.children, columnPos);
newKeys.push.apply(newKeys, (0,toConsumableArray["default"])(childKeys));
}
});
return newKeys;
};
const mergedSorterStates = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
let validate = true;
const collectedStates = collectSortStates(mergedColumns, false);
// Return if not controlled
if (!collectedStates.length) {
const mergedColumnsKeys = getColumnKeys(mergedColumns);
return sortStates.filter(({
key
}) => mergedColumnsKeys.includes(key));
}
const validateStates = [];
function patchStates(state) {
if (validate) {
validateStates.push(state);
} else {
validateStates.push({
...state,
sortOrder: null
});
}
}
let multipleMode = null;
collectedStates.forEach(state => {
if (multipleMode === null) {
patchStates(state);
if (state.sortOrder) {
if (state.multiplePriority === false) {
validate = false;
} else {
multipleMode = true;
}
}
} else if (multipleMode && state.multiplePriority !== false) {
patchStates(state);
} else {
validate = false;
patchStates(state);
}
});
return validateStates;
}, [mergedColumns, sortStates]);
// Get render columns title required props
const columnTitleSorterProps = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const sortColumns = mergedSorterStates.map(({
column,
sortOrder
}) => ({
column,
order: sortOrder
}));
return {
sortColumns,
// Legacy
sortColumn: sortColumns[0]?.column,
sortOrder: sortColumns[0]?.order
};
}, [mergedSorterStates]);
const triggerSorter = sortState => {
let newSorterStates;
if (sortState.multiplePriority === false || !mergedSorterStates.length || mergedSorterStates[0].multiplePriority === false) {
newSorterStates = [sortState];
} else {
newSorterStates = [].concat((0,toConsumableArray["default"])(mergedSorterStates.filter(({
key
}) => key !== sortState.key)), [sortState]);
}
setSortStates(newSorterStates);
onSorterChange(generateSorterInfo(newSorterStates), newSorterStates);
};
const transformColumns = innerColumns => injectSorter(prefixCls, innerColumns, mergedSorterStates, triggerSorter, sortDirections, tableLocale, showSorterTooltip, undefined, globalLocale);
const getSorters = () => generateSorterInfo(mergedSorterStates);
return [transformColumns, mergedSorterStates, columnTitleSorterProps, getSorters];
};
/* harmony default export */ var useSorter = (useFilterSorter);
;// ./components/table/hooks/useTitleColumns.ts
const fillTitle = (columns, columnTitleProps) => {
const finalColumns = columns.map(column => {
const cloneColumn = {
...column
};
cloneColumn.title = renderColumnTitle(column.title, columnTitleProps);
if ('children' in cloneColumn) {
cloneColumn.children = fillTitle(cloneColumn.children, columnTitleProps);
}
return cloneColumn;
});
return finalColumns;
};
const useTitleColumns = columnTitleProps => {
const filledColumns = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(columns => fillTitle(columns, columnTitleProps), [columnTitleProps]);
return [filledColumns];
};
/* harmony default export */ var hooks_useTitleColumns = (useTitleColumns);
;// ./components/table/RcTable/index.tsx
/**
* Same as `rc-component/table` but we modify trigger children update logic instead.
*/
const RcTable = genTable((prev, next) => {
const {
_renderTimes: prevRenderTimes
} = prev;
const {
_renderTimes: nextRenderTimes
} = next;
return prevRenderTimes !== nextRenderTimes;
});
/* harmony default export */ var table_RcTable = (RcTable);
;// ./components/table/RcTable/VirtualTable.tsx
/**
* Same as `rc-component/table` but we modify trigger children update logic instead.
*/
const RcVirtualTable = genVirtualTable((prev, next) => {
const {
_renderTimes: prevRenderTimes
} = prev;
const {
_renderTimes: nextRenderTimes
} = next;
return prevRenderTimes !== nextRenderTimes;
});
/* harmony default export */ var RcTable_VirtualTable = (RcVirtualTable);
// EXTERNAL MODULE: ./components/table/style/index.ts + 15 modules
var table_style = __webpack_require__("./components/table/style/index.ts");
;// ./components/table/InternalTable.tsx
const InternalTable_EMPTY_LIST = [];
const InternalTable = (props, ref) => {
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
style,
classNames,
styles,
size: customizeSize,
bordered,
dropdownPrefixCls: customizeDropdownPrefixCls,
dataSource,
pagination,
rowSelection: customizeRowSelection,
rowKey: customizeRowKey,
rowClassName,
columns,
children,
childrenColumnName: legacyChildrenColumnName,
onChange,
getPopupContainer,
loading,
expandIcon,
expandable,
expandedRowRender,
expandIconColumnIndex,
indentSize,
scroll,
sortDirections,
locale,
showSorterTooltip = {
target: 'full-header'
},
virtual
} = props;
const warning = (0,_util_warning.devUseWarning)('Table');
const baseColumns = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => columns || convertChildrenToColumns(children), [columns, children]);
const needResponsive = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => baseColumns.some(col => col.responsive), [baseColumns]);
const screens = hooks_useBreakpoint(needResponsive);
const mergedColumns = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const matched = new Set(Object.keys(screens).filter(m => screens[m]));
return baseColumns.filter(c => !c.responsive || c.responsive.some(r => matched.has(r)));
}, [baseColumns, screens]);
const tableProps = (0,es.omit)(props, ['className', 'style', 'columns']);
const {
locale: contextLocale = en_US["default"],
table
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const {
getPrefixCls,
direction,
renderEmpty,
getPopupContainer: getContextPopupContainer,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('table');
const mergedSize = (0,useSize["default"])(ctx => customizeSize === 'middle' ? 'medium' : customizeSize ?? ctx);
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
size: mergedSize,
bordered
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
}, {
pagination: {
_default: 'root'
},
header: {
_default: 'wrapper'
},
body: {
_default: 'wrapper'
}
});
const tableLocale = {
...contextLocale.Table,
...locale
};
const [globalLocale] = (0,useLocale["default"])('global', en_US["default"].global);
const rawData = dataSource || InternalTable_EMPTY_LIST;
const prefixCls = getPrefixCls('table', customizePrefixCls);
const dropdownPrefixCls = getPrefixCls('dropdown', customizeDropdownPrefixCls);
const [, token] = (0,useToken["default"])();
const mergedRowSelection = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
return (0,is.isPlainObject)(customizeRowSelection) ? {
columnWidth: token.Table?.selectionColumnWidth,
...customizeRowSelection
} : customizeRowSelection;
}, [customizeRowSelection, token.Table?.selectionColumnWidth]);
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,table_style["default"])(prefixCls, rootCls);
const mergedExpandable = {
childrenColumnName: legacyChildrenColumnName,
expandIconColumnIndex,
...expandable,
expandIcon: expandable?.expandIcon ?? table?.expandable?.expandIcon
};
const {
childrenColumnName = 'children'
} = mergedExpandable;
const expandType = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (rawData.some(item => item?.[childrenColumnName])) {
return 'nest';
}
if (expandedRowRender || expandable?.expandedRowRender) {
return 'row';
}
return null;
}, [childrenColumnName, rawData]);
const internalRef = {
body: external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null)
};
// ============================ Width =============================
const getContainerWidth = useContainerWidth(prefixCls);
// ============================= Refs =============================
const rootRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const tblRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
useProxyImperativeHandle(ref, () => ({
...tblRef.current,
nativeElement: rootRef.current
}));
// ============================ RowKey ============================
const rowKey = customizeRowKey || table?.rowKey || 'key';
// ============================ Scroll ============================
const mergedScroll = scroll ?? table?.scroll;
if (true) {
true ? warning(!(typeof rowKey === 'function' && rowKey.length > 1), 'usage', '`index` parameter of `rowKey` function is deprecated. There is no guarantee that it will work as expected.') : 0;
}
const getRowKey = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (typeof rowKey === 'function') {
return rowKey;
}
return record => record?.[rowKey];
}, [rowKey]);
const [getRecordByKey] = hooks_useLazyKVMap(rawData, childrenColumnName, getRowKey);
// ============================ Events =============================
const changeEventInfo = {};
const triggerOnChange = (info, action, reset = false) => {
const changeInfo = {
...changeEventInfo,
...info
};
if (reset) {
changeEventInfo.resetPagination?.();
// Reset event param
if (changeInfo.pagination?.current) {
changeInfo.pagination.current = 1;
}
// Trigger pagination events
if (pagination) {
pagination.onChange?.(1, changeInfo.pagination?.pageSize);
}
}
if (scroll && scroll.scrollToFirstRowOnChange !== false && internalRef.body.current) {
scrollTo(0, {
getContainer: () => internalRef.body.current
});
}
onChange?.(changeInfo.pagination, changeInfo.filters, changeInfo.sorter, {
currentDataSource: getFilterData(getSortData(rawData, changeInfo.sorterStates, childrenColumnName), changeInfo.filterStates, childrenColumnName),
action
});
};
/**
* Controlled state in `columns` is not a good idea that makes too many code (1000+ line?) to read
* state out and then put it back to title render. Move these code into `hooks` but still too
* complex. We should provides Table props like `sorter` & `filter` to handle control in next big
* version.
*/
// ============================ Sorter =============================
const onSorterChange = (sorter, sorterStates) => {
triggerOnChange({
sorter,
sorterStates
}, 'sort', false);
};
const [transformSorterColumns, sortStates, sorterTitleProps, getSorters] = useSorter({
prefixCls,
mergedColumns,
onSorterChange,
sortDirections: sortDirections || ['ascend', 'descend'],
tableLocale,
showSorterTooltip,
globalLocale
});
const sortedData = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => getSortData(rawData, sortStates, childrenColumnName), [childrenColumnName, rawData, sortStates]);
changeEventInfo.sorter = getSorters();
changeEventInfo.sorterStates = sortStates;
// ============================ Filter ============================
const onFilterChange = (filters, filterStates) => {
triggerOnChange({
filters,
filterStates
}, 'filter', true);
};
const [transformFilterColumns, filterStates, filters] = hooks_useFilter({
prefixCls,
locale: tableLocale,
dropdownPrefixCls,
mergedColumns,
onFilterChange,
getPopupContainer: getPopupContainer || getContextPopupContainer,
rootClassName: (0,clsx.clsx)(rootClassName, rootCls)
});
const mergedData = getFilterData(sortedData, filterStates, childrenColumnName);
changeEventInfo.filters = filters;
changeEventInfo.filterStates = filterStates;
// ============================ Column ============================
const columnTitleProps = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const mergedFilters = {};
Object.keys(filters).forEach(filterKey => {
if (filters[filterKey] !== null) {
mergedFilters[filterKey] = filters[filterKey];
}
});
return {
...sorterTitleProps,
filters: mergedFilters
};
}, [sorterTitleProps, filters]);
const [transformTitleColumns] = hooks_useTitleColumns(columnTitleProps);
// ========================== Pagination ==========================
const onPaginationChange = (current, pageSize) => {
triggerOnChange({
pagination: {
...changeEventInfo.pagination,
current,
pageSize
}
}, 'paginate');
};
const [mergedPagination, resetPagination] = hooks_usePagination(mergedData.length, onPaginationChange, pagination);
changeEventInfo.pagination = pagination === false ? {} : getPaginationParam(mergedPagination, pagination);
changeEventInfo.resetPagination = resetPagination;
// ============================= Data =============================
const pageData = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (pagination === false || !mergedPagination.pageSize) {
return mergedData;
}
const {
current = 1,
total,
pageSize = DEFAULT_PAGE_SIZE
} = mergedPagination;
true ? warning(current > 0, 'usage', '`current` should be positive number.') : 0;
// Dynamic table data
if (mergedData.length < total) {
if (mergedData.length > pageSize) {
true ? warning(false, 'usage', '`dataSource` length is less than `pagination.total` but large than `pagination.pageSize`. Please make sure your config correct data with async mode.') : 0;
return mergedData.slice((current - 1) * pageSize, current * pageSize);
}
return mergedData;
}
return mergedData.slice((current - 1) * pageSize, current * pageSize);
}, [!!pagination, mergedData, mergedPagination?.current, mergedPagination?.pageSize, mergedPagination?.total]);
// ========================== Selections ==========================
const [transformSelectionColumns, selectedKeySet] = hooks_useSelection({
prefixCls,
data: mergedData,
pageData,
getRowKey,
getRecordByKey,
expandType,
childrenColumnName,
locale: tableLocale,
getPopupContainer: getPopupContainer || getContextPopupContainer
}, mergedRowSelection);
const internalRowClassName = (record, index, indent) => {
const resolvedRowClassName = typeof rowClassName === 'function' ? rowClassName(record, index, indent) : rowClassName;
return (0,clsx.clsx)({
[`${prefixCls}-row-selected`]: selectedKeySet.has(getRowKey(record, index))
}, resolvedRowClassName);
};
// ========================== Expandable ==========================
// Pass origin render status into `@rc-component/table`, this can be removed when refactor with `@rc-component/table`
mergedExpandable.__PARENT_RENDER_ICON__ = mergedExpandable.expandIcon;
// Customize expandable icon
mergedExpandable.expandIcon = mergedExpandable.expandIcon || expandIcon || ExpandIcon(tableLocale);
// Adjust expand icon index, no overwrite expandIconColumnIndex if set.
if (expandType === 'nest' && mergedExpandable.expandIconColumnIndex === undefined) {
mergedExpandable.expandIconColumnIndex = mergedRowSelection ? 1 : 0;
} else if (mergedExpandable.expandIconColumnIndex > 0 && mergedRowSelection) {
mergedExpandable.expandIconColumnIndex -= 1;
}
// Indent size
if (typeof mergedExpandable.indentSize !== 'number') {
mergedExpandable.indentSize = (0,is.isNumber)(indentSize) ? indentSize : 15;
}
// ============================ Render ============================
const transformColumns = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(innerColumns => transformTitleColumns(transformSelectionColumns(transformFilterColumns(transformSorterColumns(innerColumns)))), [transformSorterColumns, transformFilterColumns, transformSelectionColumns]);
let topPaginationNode;
let bottomPaginationNode;
if (pagination !== false && mergedPagination?.total) {
let paginationSize;
if (mergedPagination.size) {
paginationSize = mergedPagination.size;
} else {
paginationSize = mergedSize === 'small' || mergedSize === 'medium' ? 'small' : undefined;
}
const renderPagination = (placement = 'end') => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_pagination, {
...mergedPagination,
classNames: mergedClassNames.pagination,
styles: mergedStyles.pagination,
className: (0,clsx.clsx)(`${prefixCls}-pagination ${prefixCls}-pagination-${placement}`, mergedPagination.className),
size: paginationSize
}));
const {
placement,
position
} = mergedPagination;
const mergedPlacement = placement ?? position;
const normalizePlacement = pos => {
const lowerPos = pos.toLowerCase();
if (lowerPos.includes('center')) {
return 'center';
}
return lowerPos.includes('left') || lowerPos.includes('start') ? 'start' : 'end';
};
if (Array.isArray(mergedPlacement)) {
const [topPos, bottomPos] = ['top', 'bottom'].map(dir => mergedPlacement.find(p => p.includes(dir)));
const isDisable = mergedPlacement.every(p => `${p}` === 'none');
if (!topPos && !bottomPos && !isDisable) {
bottomPaginationNode = renderPagination();
}
if (topPos) {
topPaginationNode = renderPagination(normalizePlacement(topPos));
}
if (bottomPos) {
bottomPaginationNode = renderPagination(normalizePlacement(bottomPos));
}
} else {
bottomPaginationNode = renderPagination();
}
if (true) {
warning.deprecated(!position, 'pagination.position', 'pagination.placement');
}
}
// >>>>>>>>> Spinning
const spinProps = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (typeof loading === 'boolean') {
return {
spinning: loading
};
} else if ((0,is.isPlainObject)(loading)) {
return {
spinning: true,
...loading
};
} else {
return undefined;
}
}, [loading]);
const wrappercls = (0,clsx.clsx)(cssVarCls, rootCls, `${prefixCls}-wrapper`, contextClassName, {
[`${prefixCls}-wrapper-rtl`]: direction === 'rtl'
}, className, rootClassName, mergedClassNames.root, hashId);
const mergedStyle = {
...mergedStyles.root,
...contextStyle,
...style
};
// ========== empty ==========
const mergedEmptyNode = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
// When dataSource is null/undefined (detected by reference equality with EMPTY_LIST),
// and the table is in a loading state, we only show the loading spinner without the empty placeholder.
// For empty arrays (datasource={[]}), both loading and empty states would normally be shown.
// discussion https://github.com/ant-design/ant-design/issues/54601#issuecomment-3158091383
if (spinProps?.spinning && rawData === InternalTable_EMPTY_LIST) {
return null;
}
if (typeof locale?.emptyText !== 'undefined') {
return locale.emptyText;
}
return renderEmpty?.('Table') || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(defaultRenderEmpty, {
componentName: "Table"
});
}, [spinProps?.spinning, rawData, locale?.emptyText, renderEmpty]);
// ========================== Render ==========================
const TableComponent = virtual ? RcTable_VirtualTable : table_RcTable;
// >>> Virtual Table props. We set height here since it will affect height collection
const virtualProps = {};
const listItemHeight = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const {
fontSize,
lineHeight,
lineWidth,
padding,
paddingXS,
paddingSM
} = token;
const fontHeight = Math.floor(fontSize * lineHeight);
switch (mergedSize) {
case 'medium':
return paddingSM * 2 + fontHeight + lineWidth;
case 'small':
return paddingXS * 2 + fontHeight + lineWidth;
default:
return padding * 2 + fontHeight + lineWidth;
}
}, [token, mergedSize]);
if (virtual) {
virtualProps.listItemHeight = listItemHeight;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: rootRef,
className: wrappercls,
style: mergedStyle
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(spin, {
spinning: false,
...spinProps
}, topPaginationNode, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TableComponent, {
...virtualProps,
...tableProps,
scroll: mergedScroll,
classNames: mergedClassNames,
styles: mergedStyles,
ref: tblRef,
columns: mergedColumns,
direction: direction,
expandable: mergedExpandable,
prefixCls: prefixCls,
className: (0,clsx.clsx)({
[`${prefixCls}-medium`]: mergedSize === 'medium',
[`${prefixCls}-small`]: mergedSize === 'small',
[`${prefixCls}-bordered`]: bordered,
[`${prefixCls}-empty`]: rawData.length === 0
}, cssVarCls, rootCls, hashId),
data: pageData,
rowKey: getRowKey,
rowClassName: internalRowClassName,
emptyText: mergedEmptyNode,
// Internal
internalHooks: INTERNAL_HOOKS,
internalRefs: internalRef,
transformColumns: transformColumns,
getContainerWidth: getContainerWidth,
measureRowRender: measureRow => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(table_TableMeasureRowContext.Provider, {
value: true
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(config_provider, {
getPopupContainer: node => node
}, measureRow)))
}), bottomPaginationNode));
};
/* harmony default export */ var table_InternalTable = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(InternalTable));
;// ./components/table/Table.tsx
const Table_Table = (props, ref) => {
const renderTimesRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(0);
renderTimesRef.current += 1;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(table_InternalTable, {
...props,
ref: ref,
_renderTimes: renderTimesRef.current
});
};
const ForwardTable = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(Table_Table);
ForwardTable.SELECTION_COLUMN = SELECTION_COLUMN;
ForwardTable.EXPAND_COLUMN = EXPAND_COLUMN;
ForwardTable.SELECTION_ALL = SELECTION_ALL;
ForwardTable.SELECTION_INVERT = SELECTION_INVERT;
ForwardTable.SELECTION_NONE = SELECTION_NONE;
ForwardTable.Column = table_Column;
ForwardTable.ColumnGroup = table_ColumnGroup;
ForwardTable.Summary = FooterComponents;
if (true) {
ForwardTable.displayName = 'Table';
}
/* harmony default export */ var table_Table = (ForwardTable);
;// ./components/table/index.tsx
/* harmony default export */ var table = (table_Table);
// EXTERNAL MODULE: ./components/tag/style/index.ts
var tag_style = __webpack_require__("./components/tag/style/index.ts");
;// ./components/tag/CheckableTag.tsx
const CheckableTag = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
style,
className,
checked,
children,
icon,
onChange,
onClick,
disabled: customDisabled,
...restProps
} = props;
const {
getPrefixCls,
tag
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const disabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
const mergedDisabled = customDisabled ?? disabled;
const handleClick = e => {
if (mergedDisabled) {
return;
}
onChange?.(!checked);
onClick?.(e);
};
const prefixCls = getPrefixCls('tag', customizePrefixCls);
// Style
const [hashId, cssVarCls] = (0,tag_style["default"])(prefixCls);
const cls = (0,clsx.clsx)(prefixCls, `${prefixCls}-checkable`, {
[`${prefixCls}-checkable-checked`]: checked,
[`${prefixCls}-checkable-disabled`]: mergedDisabled
}, tag?.className, className, hashId, cssVarCls);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
...restProps,
ref: ref,
style: {
...style,
...tag?.style
},
className: cls,
onClick: handleClick
}, icon, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", null, children));
});
/* harmony default export */ var tag_CheckableTag = (CheckableTag);
;// ./components/tag/CheckableTagGroup.tsx
const CheckableTagGroup = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
const {
id,
prefixCls: customizePrefixCls,
rootClassName,
className,
style,
classNames,
styles,
disabled,
options,
value,
defaultValue,
onChange,
multiple,
...restProps
} = props;
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('tag');
const prefixCls = getPrefixCls('tag', customizePrefixCls);
const groupPrefixCls = `${prefixCls}-checkable-group`;
const rootCls = hooks_useCSSVarCls(prefixCls);
const [hashId, cssVarCls] = (0,tag_style["default"])(prefixCls, rootCls);
// ====================== Styles ======================
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props
});
// =============================== Option ===============================
const parsedOptions = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (!Array.isArray(options)) {
return [];
}
return options.map(option => {
if ((0,is.isPlainObject)(option)) {
return option;
}
return {
value: option,
label: option
};
});
}, [options]);
// =============================== Values ===============================
const [mergedValue, setMergedValue] = (0,es.useControlledState)(defaultValue, value);
const handleChange = (checked, option) => {
let newValue = null;
if (multiple) {
const valueList = mergedValue || [];
newValue = checked ? [].concat((0,toConsumableArray["default"])(valueList), [option.value]) : valueList.filter(item => item !== option.value);
} else {
newValue = checked ? option.value : null;
}
setMergedValue(newValue);
onChange?.(newValue); // TS not support generic type in function call
};
// ================================ Refs ================================
const divRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref, () => ({
nativeElement: divRef.current
}));
// ================================ ARIA ================================
const ariaProps = (0,pickAttrs["default"])(restProps, {
aria: true,
data: true
});
// =============================== Render ===============================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
...ariaProps,
className: (0,clsx.clsx)(groupPrefixCls, contextClassName, rootClassName, {
[`${groupPrefixCls}-disabled`]: disabled,
[`${groupPrefixCls}-rtl`]: direction === 'rtl'
}, hashId, cssVarCls, className, mergedClassNames.root),
style: {
...contextStyle,
...mergedStyles.root,
...style
},
id: id,
ref: divRef
}, parsedOptions.map(option => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(tag_CheckableTag, {
key: option.value,
className: (0,clsx.clsx)(`${groupPrefixCls}-item`, mergedClassNames.item),
style: mergedStyles.item,
checked: multiple ? (mergedValue || []).includes(option.value) : mergedValue === option.value,
onChange: checked => handleChange(checked, option),
disabled: disabled
}, option.label))));
});
if (true) {
CheckableTagGroup.displayName = 'CheckableTagGroup';
}
/* harmony default export */ var tag_CheckableTagGroup = (CheckableTagGroup);
;// ./components/tag/hooks/useColor.ts
/**
* Convert color related props to a unified object,
* which is used to flatten the compatibility requirements.
*/
function useColor(props, contextVariant) {
const {
color,
variant,
bordered
} = props;
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const isInverseColor = color?.endsWith('-inverse');
// =================== Variant ===================
let nextVariant;
if (variant) {
// `variant` first
nextVariant = variant;
} else if (isInverseColor) {
// Fallback if using inverse color
nextVariant = 'solid';
} else if (bordered === false) {
// Fallback if using filled
nextVariant = 'filled';
} else {
// Finally not conflict, use context
nextVariant = contextVariant || 'filled';
}
// ==================== Color ====================
const nextColor = isInverseColor ? color?.replace('-inverse', '') : color;
// =============== Preset & Status ===============
const nextIsPreset = isPresetColor(color);
const nextIsStatus = isPresetStatusColor(color);
// ================== Customize ==================
// When `color` is not preset color,
// dynamic calculate the color pair.
const tagStyle = {};
if (!nextIsPreset && !nextIsStatus && nextColor) {
if (nextVariant === 'solid') {
tagStyle.backgroundColor = color;
} else {
const hsl = new fast_color_es.FastColor(nextColor).toHsl();
hsl.l = 0.95;
tagStyle.backgroundColor = new fast_color_es.FastColor(hsl).toHexString();
tagStyle.color = color;
if (nextVariant === 'outlined') {
tagStyle.borderColor = color;
}
}
}
return [nextVariant, nextColor, nextIsPreset, nextIsStatus, tagStyle];
}, [color, variant, bordered, contextVariant]);
}
;// ./components/tag/style/presetCmp.ts
// Style as status component
// ============================== Preset ==============================
const genPresetStyle = token => (0,genPresetColor["default"])(token, (colorKey, {
textColor,
lightBorderColor,
lightColor,
darkColor
}) => ({
[`${token.componentCls}${token.componentCls}-${colorKey}:not(${token.componentCls}-disabled)`]: {
[`&${token.componentCls}-outlined`]: {
backgroundColor: lightColor,
borderColor: lightBorderColor,
color: textColor
},
[`&${token.componentCls}-solid`]: {
backgroundColor: darkColor,
borderColor: darkColor,
color: token.colorTextLightSolid
},
[`&${token.componentCls}-filled`]: {
backgroundColor: lightColor,
color: textColor
}
}
}));
// ============================== Export ==============================
/* harmony default export */ var presetCmp = ((0,genStyleUtils.genSubStyleComponent)(['Tag', 'preset'], token => {
const tagToken = (0,tag_style.prepareToken)(token);
return genPresetStyle(tagToken);
}, tag_style.prepareComponentToken));
;// ./components/_util/capitalize.ts
function capitalize(str) {
if (typeof str !== 'string') {
return str;
}
const ret = str.charAt(0).toUpperCase() + str.slice(1);
return ret;
}
;// ./components/tag/style/statusCmp.ts
const genTagStatusStyle = (token, status, cssVariableType) => {
const capitalizedCssVariableType = capitalize(cssVariableType);
return {
[`${token.componentCls}${token.componentCls}-${status}:not(${token.componentCls}-disabled)`]: {
[`&${token.componentCls}-outlined`]: {
backgroundColor: token[`color${capitalizedCssVariableType}Bg`],
borderColor: token[`color${capitalizedCssVariableType}Border`],
color: token[`color${cssVariableType}`]
},
[`&${token.componentCls}-solid`]: {
backgroundColor: token[`color${cssVariableType}`],
borderColor: token[`color${cssVariableType}`]
},
[`&${token.componentCls}-filled`]: {
backgroundColor: token[`color${capitalizedCssVariableType}Bg`],
color: token[`color${cssVariableType}`]
}
}
};
};
// ============================== Export ==============================
/* harmony default export */ var statusCmp = ((0,genStyleUtils.genSubStyleComponent)(['Tag', 'status'], token => {
const tagToken = (0,tag_style.prepareToken)(token);
return [genTagStatusStyle(tagToken, 'success', 'Success'), genTagStatusStyle(tagToken, 'processing', 'Info'), genTagStatusStyle(tagToken, 'error', 'Error'), genTagStatusStyle(tagToken, 'warning', 'Warning')];
}, tag_style.prepareComponentToken));
;// ./components/tag/index.tsx
const InternalTag = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
style,
children,
icon,
color,
variant: _variant,
onClose,
bordered,
disabled: customDisabled,
href,
target,
styles,
classNames,
...restProps
} = props;
const {
getPrefixCls,
direction,
className: contextClassName,
variant: contextVariant,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('tag');
// ===================== Warnings =====================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Tag');
warning.deprecated(bordered !== false, 'bordered={false}', 'variant="filled"');
warning.deprecated(!color?.endsWith('-inverse'), 'color="xxx-inverse"', 'variant="solid"');
}
// ====================== Colors ======================
const [mergedVariant, mergedColor, isPreset, isStatus, customTagStyle] = useColor(props, contextVariant);
const isInternalColor = isPreset || isStatus;
// ===================== Disabled =====================
const disabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
const mergedDisabled = customDisabled ?? disabled;
const {
tag: tagContext
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const [visible, setVisible] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(true);
const domProps = (0,es.omit)(restProps, ['closeIcon', 'closable']);
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
color: mergedColor,
variant: mergedVariant,
disabled: mergedDisabled
};
// ====================== Styles ======================
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const tagStyle = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
let nextTagStyle = {
...mergedStyles.root,
...contextStyle,
...style
};
if (!mergedDisabled) {
nextTagStyle = {
...customTagStyle,
...nextTagStyle
};
}
return nextTagStyle;
}, [mergedStyles.root, contextStyle, style, customTagStyle, mergedDisabled]);
const prefixCls = getPrefixCls('tag', customizePrefixCls);
const [hashId, cssVarCls] = (0,tag_style["default"])(prefixCls);
const tagClassName = (0,clsx.clsx)(prefixCls, contextClassName, mergedClassNames.root, `${prefixCls}-${mergedVariant}`, {
[`${prefixCls}-${mergedColor}`]: isInternalColor,
[`${prefixCls}-hidden`]: !visible,
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-disabled`]: mergedDisabled
}, className, rootClassName, hashId, cssVarCls);
// ===================== Closable =====================
const handleCloseClick = e => {
if (mergedDisabled) {
return;
}
e.stopPropagation();
onClose?.(e);
if (e.defaultPrevented) {
return;
}
setVisible(false);
};
const [, mergedCloseIcon] = useClosable(pickClosable(props), pickClosable(tagContext), {
closable: false,
closeIconRender: iconNode => {
const replacement = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-close-icon`,
onClick: handleCloseClick
}, iconNode);
return (0,reactNode.replaceElement)(iconNode, replacement, originProps => ({
onClick: e => {
originProps?.onClick?.(e);
handleCloseClick(e);
},
className: (0,clsx.clsx)(originProps?.className, `${prefixCls}-close-icon`)
}));
}
});
// ====================== Render ======================
const isNeedWave = typeof restProps.onClick === 'function' || children && children.type === 'a';
const iconNode = (0,reactNode.cloneElement)(icon, {
className: (0,clsx.clsx)(/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(icon) ? icon.props?.className : undefined, mergedClassNames.icon),
style: mergedStyles.icon
});
const child = iconNode ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, iconNode, children && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: mergedClassNames.content,
style: mergedStyles.content
}, children)))) : children;
const TagWrapper = href ? 'a' : 'span';
const tagNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(TagWrapper, {
...domProps,
// @ts-expect-error
ref: ref,
className: tagClassName,
style: tagStyle,
href: mergedDisabled ? undefined : href,
target: target,
onClick: mergedDisabled ? undefined : domProps.onClick,
...(href && mergedDisabled ? {
'aria-disabled': true
} : {})
}, child, mergedCloseIcon, isPreset && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(presetCmp, {
key: "preset",
prefixCls: prefixCls
}), isStatus && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(statusCmp, {
key: "status",
prefixCls: prefixCls
}));
return isNeedWave ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(wave, {
component: "Tag"
}, tagNode) : tagNode;
});
const Tag = InternalTag;
if (true) {
Tag.displayName = 'Tag';
}
Tag.CheckableTag = tag_CheckableTag;
Tag.CheckableTagGroup = tag_CheckableTagGroup;
/* harmony default export */ var tag = (Tag);
// EXTERNAL MODULE: ./components/theme/util/alias.ts
var alias = __webpack_require__("./components/theme/util/alias.ts");
;// ./components/theme/getDesignToken.ts
const getDesignToken = config => {
const theme = config?.algorithm ? (0,cssinjs.createTheme)(config.algorithm) : default_theme["default"];
const mergedToken = {
...seed["default"],
...config?.token
};
return (0,cssinjs.getComputedToken)(mergedToken, {
override: config?.token
}, theme, alias["default"]);
};
/* harmony default export */ var theme_getDesignToken = (getDesignToken);
// EXTERNAL MODULE: ./components/theme/themes/default/index.ts + 5 modules
var themes_default = __webpack_require__("./components/theme/themes/default/index.ts");
// EXTERNAL MODULE: ./components/theme/themes/shared/genControlHeight.ts
var genControlHeight = __webpack_require__("./components/theme/themes/shared/genControlHeight.ts");
// EXTERNAL MODULE: ./components/theme/themes/shared/genFontMapToken.ts
var genFontMapToken = __webpack_require__("./components/theme/themes/shared/genFontMapToken.ts");
;// ./components/theme/themes/compact/genCompactSizeMapToken.ts
function genSizeMapToken(token) {
const {
sizeUnit,
sizeStep
} = token;
const compactSizeStep = sizeStep - 2;
return {
sizeXXL: sizeUnit * (compactSizeStep + 10),
sizeXL: sizeUnit * (compactSizeStep + 6),
sizeLG: sizeUnit * (compactSizeStep + 2),
sizeMD: sizeUnit * (compactSizeStep + 2),
sizeMS: sizeUnit * (compactSizeStep + 1),
size: sizeUnit * compactSizeStep,
sizeSM: sizeUnit * compactSizeStep,
sizeXS: sizeUnit * (compactSizeStep - 1),
sizeXXS: sizeUnit * (compactSizeStep - 1)
};
}
;// ./components/theme/themes/compact/index.ts
const derivative = (token, mapToken) => {
const mergedMapToken = mapToken ?? (0,themes_default["default"])(token);
const fontSize = mergedMapToken.fontSizeSM; // Smaller size font-size as base
const controlHeight = mergedMapToken.controlHeight - 4;
return {
...mergedMapToken,
...genSizeMapToken(mapToken ?? token),
// font
...(0,genFontMapToken["default"])(fontSize),
// controlHeight
controlHeight,
...(0,genControlHeight["default"])({
...mergedMapToken,
controlHeight
})
};
};
/* harmony default export */ var themes_compact = (derivative);
// EXTERNAL MODULE: ./components/theme/themes/shared/genColorMapToken.ts
var genColorMapToken = __webpack_require__("./components/theme/themes/shared/genColorMapToken.ts");
;// ./components/theme/themes/dark/colorAlgorithm.ts
const getAlphaColor = (baseColor, alpha) => new fast_color_es.FastColor(baseColor).setA(alpha).toRgbString();
const getSolidColor = (baseColor, brightness) => {
const instance = new fast_color_es.FastColor(baseColor);
return instance.lighten(brightness).toHexString();
};
;// ./components/theme/themes/dark/colors.ts
const generateColorPalettes = baseColor => {
const colors = (0,colors_es.generate)(baseColor, {
theme: 'dark'
});
return {
1: colors[0],
2: colors[1],
3: colors[2],
4: colors[3],
5: colors[6],
6: colors[5],
7: colors[4],
8: colors[6],
9: colors[5],
10: colors[4]
};
};
const generateNeutralColorPalettes = (bgBaseColor, textBaseColor, shadowColor) => {
const colorBgBase = bgBaseColor || '#000';
const colorTextBase = textBaseColor || '#fff';
const colorShadow = shadowColor || 'rgba(255, 255, 255, 0.2)';
return {
colorBgBase,
colorTextBase,
colorShadow,
colorText: getAlphaColor(colorTextBase, 0.85),
colorTextSecondary: getAlphaColor(colorTextBase, 0.65),
colorTextTertiary: getAlphaColor(colorTextBase, 0.45),
colorTextQuaternary: getAlphaColor(colorTextBase, 0.25),
colorFill: getAlphaColor(colorTextBase, 0.18),
colorFillSecondary: getAlphaColor(colorTextBase, 0.12),
colorFillTertiary: getAlphaColor(colorTextBase, 0.08),
colorFillQuaternary: getAlphaColor(colorTextBase, 0.04),
colorBgSolid: getAlphaColor(colorTextBase, 0.95),
colorBgSolidHover: getAlphaColor(colorTextBase, 1),
colorBgSolidActive: getAlphaColor(colorTextBase, 0.9),
colorBgElevated: getSolidColor(colorBgBase, 12),
colorBgContainer: getSolidColor(colorBgBase, 8),
colorBgLayout: getSolidColor(colorBgBase, 0),
colorBgSpotlight: getSolidColor(colorBgBase, 26),
colorBgBlur: getAlphaColor(colorTextBase, 0.04),
colorBorder: getSolidColor(colorBgBase, 26),
colorBorderDisabled: getSolidColor(colorBgBase, 26),
colorBorderSecondary: getSolidColor(colorBgBase, 19)
};
};
;// ./components/theme/themes/dark/index.ts
const dark_derivative = (token, mapToken) => {
const colorPalettes = Object.keys(seed.defaultPresetColors).map(colorKey => {
const colors = (0,colors_es.generate)(token[colorKey], {
theme: 'dark'
});
return Array.from({
length: 10
}, () => 1).reduce((prev, _, i) => {
prev[`${colorKey}-${i + 1}`] = colors[i];
prev[`${colorKey}${i + 1}`] = colors[i];
return prev;
}, {});
}).reduce((prev, cur) => {
prev = {
...prev,
...cur
};
return prev;
}, {});
const mergedMapToken = mapToken ?? (0,themes_default["default"])(token);
const colorMapToken = (0,genColorMapToken["default"])(token, {
generateColorPalettes: generateColorPalettes,
generateNeutralColorPalettes: generateNeutralColorPalettes
});
const presetColorHoverActiveTokens = presetColors.PresetColors.reduce((prev, colorKey) => {
const colorBase = token[colorKey];
if (colorBase) {
const colorPalette = generateColorPalettes(colorBase);
prev[`${colorKey}Hover`] = colorPalette[7];
prev[`${colorKey}Active`] = colorPalette[5];
}
return prev;
}, {});
return {
...mergedMapToken,
// Dark tokens
...colorPalettes,
// Colors
...colorMapToken,
...presetColorHoverActiveTokens,
// Customize selected item background color
// https://github.com/ant-design/ant-design/issues/30524#issuecomment-871961867
colorPrimaryBg: colorMapToken.colorPrimaryBorder,
colorPrimaryBgHover: colorMapToken.colorPrimaryBorderHover
};
};
/* harmony default export */ var dark = (dark_derivative);
;// ./components/theme/index.tsx
// ZombieJ: We export as object to user but array in internal.
// This is used to minimize the bundle size for antd package but safe to refactor as object also.
// Please do not export internal `useToken` directly to avoid something export unexpected.
/** Get current context Design Token. Will be different if you are using nest theme config. */
function theme_useToken() {
const [theme, token, hashId, cssVar] = (0,useToken["default"])();
return {
theme,
token,
hashId,
cssVar
};
}
/* harmony default export */ var theme = ({
/** Default seedToken */
defaultSeed: context.defaultConfig.token,
useToken: theme_useToken,
defaultAlgorithm: themes_default["default"],
darkAlgorithm: dark,
compactAlgorithm: themes_compact,
getDesignToken: theme_getDesignToken,
/**
* @private Private variable
* @warring 🔥 Do not use in production. 🔥
*/
defaultConfig: context.defaultConfig,
/**
* @private Private variable
* @warring 🔥 Do not use in production. 🔥
*/
_internalContext: context.DesignTokenContext
});
;// ./components/time-picker/index.tsx
const {
TimePicker: InternalTimePicker,
RangePicker: InternalRangePicker
} = date_picker;
const time_picker_RangePicker = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(InternalRangePicker, {
...props,
picker: "time",
mode: undefined,
ref: ref
})));
const TimePicker = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
addon,
renderExtraFooter,
variant,
bordered,
classNames,
styles,
popupClassName,
popupStyle,
...restProps
} = props;
// ====================== Warning =======================
if (true) {
const warning = (0,_util_warning.devUseWarning)('TimePicker');
warning.deprecated(!addon, 'addon', 'renderExtraFooter');
}
const [mergedVariant] = useVariants('timePicker', variant, bordered);
const internalRenderExtraFooter = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (renderExtraFooter) {
return renderExtraFooter;
}
if (addon) {
return addon;
}
return undefined;
}, [addon, renderExtraFooter]);
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
variant: mergedVariant
};
// =========== Merged Semantic ===========
const [mergedClassNames, mergedStyles] = hooks_useMergedPickerSemantic('timePicker', classNames, styles, popupClassName, popupStyle, mergedProps);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(InternalTimePicker, {
...restProps,
mode: undefined,
ref: ref,
renderExtraFooter: internalRenderExtraFooter,
variant: mergedVariant,
classNames: mergedClassNames,
styles: mergedStyles
});
});
if (true) {
TimePicker.displayName = 'TimePicker';
}
// We don't care debug panel
/* istanbul ignore next */
const time_picker_PurePanel = _util_PurePanel(TimePicker, 'popupAlign', undefined, 'picker');
TimePicker._InternalPanelDoNotUseOrYouWillBeFired = time_picker_PurePanel;
TimePicker.RangePicker = time_picker_RangePicker;
TimePicker._InternalPanelDoNotUseOrYouWillBeFired = time_picker_PurePanel;
/* harmony default export */ var time_picker = (TimePicker);
// EXTERNAL MODULE: ./components/timeline/style/index.ts + 1 modules
var timeline_style = __webpack_require__("./components/timeline/style/index.ts");
;// ./components/timeline/useItems.tsx
const timeline_useItems_useItems = (rootPrefixCls, prefixCls, mode, items, children, pending, pendingDot) => {
const itemCls = `${prefixCls}-item`;
const [varName] = (0,genStyleUtils.genCssVar)(rootPrefixCls, 'cmp-steps');
// Merge items and children
const parseItems = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
return Array.isArray(items) ? items : (0,es.toArray)(children).map(ele => ({
...ele.props
}));
}, [items, children]);
// convert legacy type
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const mergedItems = parseItems.map((item, index) => {
const {
label,
children,
title,
content,
color,
className,
style,
icon,
dot,
placement,
position,
loading,
...restProps
} = item;
let mergedStyle = style;
let mergedClassName = className;
if (color) {
if (['blue', 'red', 'green', 'gray'].includes(color)) {
mergedClassName = (0,clsx.clsx)(className, `${itemCls}-color-${color}`);
} else {
mergedStyle = {
[varName('item-icon-dot-color')]: color,
...style
};
}
}
// Placement
const mergedPlacement = placement ?? position ?? (mode === 'alternate' ? index % 2 === 0 ? 'start' : 'end' : mode);
mergedClassName = (0,clsx.clsx)(mergedClassName, `${itemCls}-placement-${mergedPlacement}`);
// Icon
let mergedIcon = icon ?? dot;
if (!mergedIcon && loading) {
mergedIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LoadingOutlined, null);
}
return {
...restProps,
title: title ?? label,
content: content ?? children,
style: mergedStyle,
className: mergedClassName,
icon: mergedIcon,
status: loading ? 'process' : 'finish'
};
});
if (pending) {
mergedItems.push({
icon: pendingDot ?? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LoadingOutlined, null),
content: pending,
status: 'process'
});
}
return mergedItems;
}, [parseItems, pending, mode, itemCls, varName, pendingDot]);
};
/* harmony default export */ var timeline_useItems = (timeline_useItems_useItems);
;// ./components/timeline/Timeline.tsx
const stepInternalContext = {
rootComponent: 'ol',
itemComponent: 'li'
};
const Timeline = props => {
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('timeline');
const {
prefixCls: customizePrefixCls,
// Style
className,
style,
classNames,
styles,
// Design
variant = 'outlined',
mode,
orientation = 'vertical',
titleSpan,
// Data
items,
children,
reverse,
// Legacy Pending
pending,
pendingDot,
...restProps
} = props;
// ===================== MISC =======================
const rootPrefixCls = getPrefixCls();
const prefixCls = getPrefixCls('timeline', customizePrefixCls);
// ==================== Styles ======================
// This will be duplicated with Steps's hashId & cssVarCls when they have same token
// But this is safe to keep here since web will do nothing
const [hashId, cssVarCls] = (0,timeline_style["default"])(prefixCls);
const [varName] = (0,genStyleUtils.genCssVar)(rootPrefixCls, 'timeline');
const stepsClassNames = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
item: `${prefixCls}-item`,
itemTitle: `${prefixCls}-item-title`,
itemIcon: `${prefixCls}-item-icon`,
itemContent: `${prefixCls}-item-content`,
itemRail: `${prefixCls}-item-rail`,
itemWrapper: `${prefixCls}-item-wrapper`,
itemSection: `${prefixCls}-item-section`,
itemHeader: `${prefixCls}-item-header`
}), [prefixCls]);
// ===================== Mode =======================
const mergedMode = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
// Deprecated
if (mode === 'left') {
return 'start';
}
if (mode === 'right') {
return 'end';
}
// Fill
const modeList = ['alternate', 'start', 'end'];
return modeList.includes(mode) ? mode : 'start';
}, [mode]);
// ===================== Data =======================
const rawItems = timeline_useItems(rootPrefixCls, prefixCls, mergedMode, items, children, pending, pendingDot);
const mergedItems = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => reverse ? (0,toConsumableArray["default"])(rawItems).reverse() : rawItems, [reverse, rawItems]);
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
variant,
mode: mergedMode,
orientation,
items: mergedItems
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([stepsClassNames, contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const stepContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
railFollowPrevStatus: reverse
}), [reverse]);
// ==================== Design ======================
const layoutAlternate = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => mergedMode === 'alternate' || orientation === 'vertical' && mergedItems.some(item => item.title), [mergedItems, mergedMode, orientation]);
// ===================== Warn =======================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Timeline');
// Item
warning.deprecated(!children, 'Timeline.Item', 'items');
// Pending
const pendingWarning = 'You can create a `item` as pending node directly.';
warning.deprecated(!pending, 'pending', 'items', pendingWarning);
warning.deprecated(!pendingDot, 'pendingDot', 'items', pendingWarning);
// Mode
warning.deprecated(mode !== 'left' && mode !== 'right', 'mode=left|right', 'mode=start|end');
// Item Props
const warnItems = items || [];
[['label', 'title'], ['children', 'content'], ['dot', 'icon'], ['position', 'placement']].forEach(([oldProp, newProp]) => {
warning.deprecated(warnItems.every(item => !item[oldProp]), `items.${oldProp}`, `items.${newProp}`);
});
}
// ==================== Render ======================
const stepStyle = {
...contextStyle,
...style
};
if ((0,is.isNonNullable)(titleSpan) && mergedMode !== 'alternate') {
if ((0,is.isNumber)(titleSpan)) {
stepStyle[varName('head-span')] = titleSpan;
} else {
stepStyle[varName('head-span-ptg')] = titleSpan;
}
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(InternalContext.Provider, {
value: stepInternalContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(UnstableContext_UnstableContext.Provider, {
value: stepContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(steps, {
...restProps,
// Style
className: (0,clsx.clsx)(prefixCls, contextClassName, className, hashId, cssVarCls, {
[`${prefixCls}-${orientation}`]: orientation === 'horizontal',
[`${prefixCls}-layout-alternate`]: layoutAlternate,
[`${prefixCls}-rtl`]: direction === 'rtl'
}),
style: stepStyle,
classNames: mergedClassNames,
styles: mergedStyles,
// Design
variant: variant,
orientation: orientation,
// Layout
type: "dot",
items: mergedItems,
current: mergedItems.length - 1
})));
};
Timeline.Item = () => {};
if (true) {
Timeline.displayName = 'Timeline';
}
/* harmony default export */ var timeline_Timeline = (Timeline);
;// ./components/timeline/index.tsx
/* harmony default export */ var timeline = (timeline_Timeline);
;// ./node_modules/@rc-component/tour/es/hooks/useClosable.js
function isConfigObj(closable) {
return closable !== null && typeof closable === 'object';
}
/**
* Convert `closable` to ClosableConfig.
* When `preset` is true, will auto fill ClosableConfig with default value.
*/
function getClosableConfig(closable, closeIcon, preset) {
if (closable === false || closeIcon === false && (!isConfigObj(closable) || !closable.closeIcon)) {
return null;
}
const mergedCloseIcon = typeof closeIcon !== 'boolean' ? closeIcon : undefined;
if (isConfigObj(closable)) {
return {
...closable,
closeIcon: closable.closeIcon ?? mergedCloseIcon
};
}
// When StepClosable no need auto fill, but RootClosable need this.
return preset || closable || closeIcon ? {
closeIcon: mergedCloseIcon
} : 'empty';
}
function useClosable_useClosable(stepClosable, stepCloseIcon, closable, closeIcon) {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const stepClosableConfig = getClosableConfig(stepClosable, stepCloseIcon, false);
const rootClosableConfig = getClosableConfig(closable, closeIcon, true);
if (stepClosableConfig !== 'empty') {
return stepClosableConfig;
}
return rootClosableConfig;
}, [closable, closeIcon, stepClosable, stepCloseIcon]);
}
;// ./node_modules/@rc-component/tour/es/util.js
function isInViewPort(element) {
const viewWidth = window.innerWidth || document.documentElement.clientWidth;
const viewHeight = window.innerHeight || document.documentElement.clientHeight;
const {
top,
right,
bottom,
left
} = element.getBoundingClientRect();
return top >= 0 && left >= 0 && right <= viewWidth && bottom <= viewHeight;
}
function getPlacement(targetElement, placement, stepPlacement) {
return stepPlacement ?? placement ?? (targetElement === null ? 'center' : 'bottom');
}
;// ./node_modules/@rc-component/tour/es/hooks/useTarget.js
function isValidNumber(val) {
return typeof val === 'number' && !Number.isNaN(val);
}
function useTarget(target, open, gap, scrollIntoViewOptions, inlineMode, placeholderRef) {
// ========================= Target =========================
// We trade `undefined` as not get target by function yet.
// `null` as empty target.
const [targetElement, setTargetElement] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(undefined);
(0,useLayoutEffect["default"])(() => {
const nextElement = typeof target === 'function' ? target() : target;
setTargetElement(nextElement || null);
});
// ========================= Align ==========================
const [posInfo, setPosInfo] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null);
const updatePos = (0,useEvent["default"])(() => {
if (targetElement) {
// Exist target element. We should scroll and get target position
if (!inlineMode && !isInViewPort(targetElement) && open) {
targetElement.scrollIntoView(scrollIntoViewOptions);
}
const {
left,
top,
width,
height
} = targetElement.getBoundingClientRect();
const nextPosInfo = {
left,
top,
width,
height,
radius: 0
};
// If `inlineMode` we need cut off parent offset
if (inlineMode) {
const parentRect = placeholderRef.current?.parentElement?.getBoundingClientRect();
if (parentRect) {
nextPosInfo.left -= parentRect.left;
nextPosInfo.top -= parentRect.top;
}
}
setPosInfo(origin => {
if (JSON.stringify(origin) !== JSON.stringify(nextPosInfo)) {
return nextPosInfo;
}
return origin;
});
} else {
// Not exist target which means we just show in center
setPosInfo(null);
}
});
const getGapOffset = index => (Array.isArray(gap?.offset) ? gap?.offset[index] : gap?.offset) ?? 6;
(0,useLayoutEffect["default"])(() => {
updatePos();
// update when window resize
window.addEventListener('resize', updatePos);
// update when `document.body.style.overflow` is set to visible
// by default, it will be set to hidden
window.addEventListener('scroll', updatePos);
return () => {
window.removeEventListener('resize', updatePos);
window.removeEventListener('scroll', updatePos);
};
}, [targetElement, open, updatePos]);
// ======================== PosInfo =========================
const mergedPosInfo = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (!posInfo) {
return posInfo;
}
const gapOffsetX = getGapOffset(0);
const gapOffsetY = getGapOffset(1);
const gapRadius = isValidNumber(gap?.radius) ? gap?.radius : 2;
return {
left: posInfo.left - gapOffsetX,
top: posInfo.top - gapOffsetY,
width: posInfo.width + gapOffsetX * 2,
height: posInfo.height + gapOffsetY * 2,
radius: gapRadius
};
}, [posInfo, gap]);
return [mergedPosInfo, targetElement];
}
;// ./node_modules/@rc-component/tour/es/Mask.js
function es_Mask_extends() { es_Mask_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return es_Mask_extends.apply(this, arguments); }
const COVER_PROPS = {
fill: 'transparent',
pointerEvents: 'auto'
};
const es_Mask_Mask = props => {
const {
prefixCls,
rootClassName,
pos,
showMask,
style = {},
fill = 'rgba(0,0,0,0.5)',
open,
animated,
zIndex,
disabledInteraction,
styles,
classNames: tourClassNames,
getPopupContainer,
onEsc
} = props;
const id = useId();
const maskId = `${prefixCls}-mask-${id}`;
const mergedAnimated = typeof animated === 'object' ? animated?.placeholder : animated;
const isSafari = typeof navigator !== 'undefined' && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
const maskRectSize = isSafari ? {
width: '100%',
height: '100%'
} : {
width: '100vw',
height: '100vh'
};
const inlineMode = getPopupContainer === false;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(portal_es, {
open: open,
autoLock: !inlineMode,
getContainer: getPopupContainer,
onEsc: onEsc
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-mask`, rootClassName, tourClassNames?.mask),
style: {
position: inlineMode ? 'absolute' : 'fixed',
left: 0,
right: 0,
top: 0,
bottom: 0,
zIndex,
pointerEvents: pos && !disabledInteraction ? 'none' : 'auto',
...style,
...styles?.mask
}
}, showMask ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
style: {
width: '100%',
height: '100%'
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("defs", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("mask", {
id: maskId
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("rect", es_Mask_extends({
x: "0",
y: "0"
}, maskRectSize, {
fill: "white"
})), pos && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("rect", {
x: pos.left,
y: pos.top,
rx: pos.radius,
width: pos.width,
height: pos.height,
fill: "black",
className: mergedAnimated ? `${prefixCls}-placeholder-animated` : ''
}))), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("rect", {
x: "0",
y: "0",
width: "100%",
height: "100%",
fill: fill,
mask: `url(#${maskId})`
}), pos && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("rect", es_Mask_extends({}, COVER_PROPS, {
x: "0",
y: "0",
width: "100%",
height: Math.max(pos.top, 0)
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("rect", es_Mask_extends({}, COVER_PROPS, {
x: "0",
y: "0",
width: Math.max(pos.left, 0),
height: "100%"
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("rect", es_Mask_extends({}, COVER_PROPS, {
x: "0",
y: pos.top + pos.height,
width: "100%",
height: `calc(100% - ${pos.top + pos.height}px)`
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("rect", es_Mask_extends({}, COVER_PROPS, {
x: pos.left + pos.width,
y: "0",
width: `calc(100% - ${pos.left + pos.width}px)`,
height: "100%"
})))) : null));
};
/* harmony default export */ var es_Mask = (es_Mask_Mask);
;// ./node_modules/@rc-component/tour/es/placements.js
const es_placements_targetOffset = [0, 0];
const basePlacements = {
left: {
points: ['cr', 'cl'],
offset: [-8, 0]
},
right: {
points: ['cl', 'cr'],
offset: [8, 0]
},
top: {
points: ['bc', 'tc'],
offset: [0, -8]
},
bottom: {
points: ['tc', 'bc'],
offset: [0, 8]
},
topLeft: {
points: ['bl', 'tl'],
offset: [0, -8]
},
leftTop: {
points: ['tr', 'tl'],
offset: [-8, 0]
},
topRight: {
points: ['br', 'tr'],
offset: [0, -8]
},
rightTop: {
points: ['tl', 'tr'],
offset: [8, 0]
},
bottomRight: {
points: ['tr', 'br'],
offset: [0, 8]
},
rightBottom: {
points: ['bl', 'br'],
offset: [8, 0]
},
bottomLeft: {
points: ['tl', 'bl'],
offset: [0, 8]
},
leftBottom: {
points: ['br', 'bl'],
offset: [-8, 0]
}
};
function placements_getPlacements(arrowPointAtCenter = false) {
const placements = {};
Object.keys(basePlacements).forEach(key => {
placements[key] = {
...basePlacements[key],
autoArrow: arrowPointAtCenter,
targetOffset: es_placements_targetOffset
};
});
return placements;
}
const tour_es_placements_placements = placements_getPlacements();
;// ./node_modules/@rc-component/tour/es/TourStep/DefaultPanel.js
function DefaultPanel_extends() { DefaultPanel_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return DefaultPanel_extends.apply(this, arguments); }
function DefaultPanel(props) {
const {
prefixCls,
current,
total,
title,
description,
onClose,
onPrev,
onNext,
onFinish,
className,
closable,
classNames: tourClassNames,
styles
} = props;
const ariaProps = (0,pickAttrs["default"])(closable || {}, true);
const closeIcon = closable?.closeIcon ?? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-close-x`
}, "\xD7");
const mergedClosable = !!closable;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-panel`, className)
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-section`, tourClassNames?.section),
style: styles?.section
}, mergedClosable && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", DefaultPanel_extends({
type: "button",
onClick: onClose,
"aria-label": "Close"
}, ariaProps, {
className: `${prefixCls}-close`
}), closeIcon), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-header`, tourClassNames?.header),
style: styles?.header
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-title`, tourClassNames?.title),
style: styles?.title
}, title)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-description`, tourClassNames?.description),
style: styles?.description
}, description), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-footer`, tourClassNames?.footer),
style: styles?.footer
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-sliders`
}, total > 1 ? [...Array.from({
length: total
}).keys()].map((item, index) => {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
key: item,
className: index === current ? 'active' : ''
});
}) : null), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-actions`, tourClassNames?.actions),
style: styles?.actions
}, current !== 0 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
className: `${prefixCls}-prev-btn`,
onClick: onPrev
}, "Prev") : null, current === total - 1 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
className: `${prefixCls}-finish-btn`,
onClick: onFinish
}, "Finish") : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
className: `${prefixCls}-next-btn`,
onClick: onNext
}, "Next")))));
}
;// ./node_modules/@rc-component/tour/es/TourStep/index.js
const TourStep = props => {
const {
current,
renderPanel
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, typeof renderPanel === 'function' ? renderPanel(props, current) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(DefaultPanel, props));
};
/* harmony default export */ var es_TourStep = (TourStep);
;// ./node_modules/@rc-component/tour/es/Placeholder.js
const Placeholder_Placeholder = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
open,
autoLock,
getContainer,
domRef,
className,
style,
fallbackDOM
} = props;
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => domRef.current || fallbackDOM());
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(portal_es, {
open: open,
autoLock: autoLock,
getContainer: getContainer
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
ref: domRef,
className: className,
style: style
}));
});
if (true) {
Placeholder_Placeholder.displayName = 'Placeholder';
}
/* harmony default export */ var es_Placeholder = (Placeholder_Placeholder);
;// ./node_modules/@rc-component/tour/es/Tour.js
function Tour_extends() { Tour_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Tour_extends.apply(this, arguments); }
const CENTER_PLACEHOLDER = {
left: '50%',
top: '50%',
width: 1,
height: 1
};
const defaultScrollIntoViewOptions = {
block: 'center',
inline: 'center'
};
const Tour = props => {
const {
prefixCls = 'rc-tour',
steps = [],
defaultCurrent,
current,
keyboard = true,
onChange,
onClose,
onFinish,
open,
defaultOpen,
mask = true,
arrow = true,
rootClassName,
placement,
renderPanel,
gap,
animated,
scrollIntoViewOptions = defaultScrollIntoViewOptions,
zIndex = 1001,
closeIcon,
closable,
builtinPlacements,
disabledInteraction,
styles,
classNames: tourClassNames,
className,
style,
getPopupContainer,
...restProps
} = props;
const triggerRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
const [mergedCurrent, setMergedCurrent] = (0,useControlledState["default"])(defaultCurrent || 0, current);
const [internalOpen, setMergedOpen] = (0,useControlledState["default"])(defaultOpen, open);
const mergedOpen = mergedCurrent < 0 || mergedCurrent >= steps.length ? false : internalOpen ?? true;
// Record if already rended in the DOM to avoid `findDOMNode` issue
const [hasOpened, setHasOpened] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(mergedOpen);
const openRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(mergedOpen);
(0,useLayoutEffect["default"])(() => {
if (mergedOpen) {
if (!openRef.current) {
setMergedCurrent(0);
}
setHasOpened(true);
}
openRef.current = mergedOpen;
}, [mergedOpen, setMergedCurrent]);
const {
target,
placement: stepPlacement,
style: stepStyle,
arrow: stepArrow,
className: stepClassName,
mask: stepMask,
scrollIntoViewOptions: stepScrollIntoViewOptions = defaultScrollIntoViewOptions,
closeIcon: stepCloseIcon,
closable: stepClosable
} = steps[mergedCurrent] || {};
const mergedClosable = useClosable_useClosable(stepClosable, stepCloseIcon, closable, closeIcon);
const mergedMask = mergedOpen && (stepMask ?? mask);
const mergedScrollIntoViewOptions = stepScrollIntoViewOptions ?? scrollIntoViewOptions;
// ====================== Align Target ======================
const placeholderRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const inlineMode = getPopupContainer === false;
const [posInfo, targetElement] = useTarget(target, open, gap, mergedScrollIntoViewOptions, inlineMode, placeholderRef);
const mergedPlacement = getPlacement(targetElement, placement, stepPlacement);
// ========================= arrow =========================
const mergedArrow = targetElement ? typeof stepArrow === 'undefined' ? arrow : stepArrow : false;
const arrowPointAtCenter = typeof mergedArrow === 'object' ? mergedArrow.pointAtCenter : false;
(0,useLayoutEffect["default"])(() => {
triggerRef.current?.forceAlign();
}, [arrowPointAtCenter, mergedCurrent]);
// ========================= Change =========================
const onInternalChange = nextCurrent => {
setMergedCurrent(nextCurrent);
onChange?.(nextCurrent);
};
const mergedBuiltinPlacements = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (builtinPlacements) {
return typeof builtinPlacements === 'function' ? builtinPlacements({
arrowPointAtCenter
}) : builtinPlacements;
}
return placements_getPlacements(arrowPointAtCenter);
}, [builtinPlacements, arrowPointAtCenter]);
const handleClose = () => {
setMergedOpen(false);
onClose?.(mergedCurrent);
};
// ========================= Esc Close =========================
// Use Portal's onEsc to handle Escape key with proper stacking logic
const handleEscClose = (0,useEvent["default"])(({
event
}) => {
if (keyboard && mergedClosable !== null) {
event.preventDefault();
handleClose();
}
});
// ========================= Keyboard =========================
// Support ArrowLeft/ArrowRight to navigate steps.
const keyboardHandler = (0,useEvent["default"])(e => {
// Ignore keyboard events from input-like elements to avoid interfering when typing
if (KeyCode["default"].isEditableTarget(e)) {
return;
}
if (keyboard && e.key === 'ArrowLeft') {
if (mergedCurrent > 0) {
e.preventDefault();
onInternalChange(mergedCurrent - 1);
}
return;
}
if (keyboard && e.key === 'ArrowRight') {
if (mergedCurrent < steps.length - 1) {
e.preventDefault();
onInternalChange(mergedCurrent + 1);
}
return;
}
});
(0,useLayoutEffect["default"])(() => {
if (!mergedOpen) return;
window.addEventListener('keydown', keyboardHandler);
return () => {
window.removeEventListener('keydown', keyboardHandler);
};
}, [mergedOpen, keyboardHandler]);
// ========================= Render =========================
// Skip if not init yet
if (targetElement === undefined || !hasOpened) {
return null;
}
const getPopupElement = () => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_TourStep, Tour_extends({
styles: styles,
classNames: tourClassNames,
arrow: mergedArrow,
key: "content",
prefixCls: prefixCls,
total: steps.length,
renderPanel: renderPanel,
onPrev: () => {
onInternalChange(mergedCurrent - 1);
},
onNext: () => {
onInternalChange(mergedCurrent + 1);
},
onClose: handleClose,
current: mergedCurrent,
onFinish: () => {
handleClose();
onFinish?.();
}
}, steps[mergedCurrent], {
closable: mergedClosable
}));
const mergedShowMask = typeof mergedMask === 'boolean' ? mergedMask : !!mergedMask;
const mergedMaskStyle = typeof mergedMask === 'boolean' ? undefined : mergedMask;
// when targetElement is not exist, use body as triggerDOMNode
const fallbackDOM = () => {
return targetElement || document.body;
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Mask, {
getPopupContainer: getPopupContainer,
styles: styles,
classNames: tourClassNames,
zIndex: zIndex,
prefixCls: prefixCls,
pos: posInfo,
showMask: mergedShowMask,
style: mergedMaskStyle?.style,
fill: mergedMaskStyle?.color,
open: mergedOpen,
animated: animated,
rootClassName: rootClassName,
disabledInteraction: disabledInteraction,
onEsc: handleEscClose
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(trigger_es, Tour_extends({}, restProps, {
// `rc-portal` def bug not support `false` but does support and in used.
getPopupContainer: getPopupContainer,
builtinPlacements: mergedBuiltinPlacements,
ref: triggerRef,
popupStyle: stepStyle,
popupPlacement: mergedPlacement,
popupVisible: mergedOpen,
popupClassName: (0,clsx.clsx)(rootClassName, stepClassName),
prefixCls: prefixCls,
popup: getPopupElement,
forceRender: false,
autoDestroy: true,
zIndex: zIndex,
arrow: !!mergedArrow
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_Placeholder, {
open: mergedOpen,
autoLock: !inlineMode,
getContainer: getPopupContainer,
domRef: placeholderRef,
fallbackDOM: fallbackDOM,
className: (0,clsx.clsx)(className, rootClassName, `${prefixCls}-target-placeholder`),
style: {
...(posInfo || CENTER_PLACEHOLDER),
position: inlineMode ? 'absolute' : 'fixed',
pointerEvents: 'none',
...style
}
})));
};
/* harmony default export */ var es_Tour = (Tour);
;// ./node_modules/@rc-component/tour/es/index.js
/* harmony default export */ var tour_es = (es_Tour);
;// ./components/tour/panelRender.tsx
// Due to the independent design of Panel, it will be too coupled to put in rc-tour,
// so a set of Panel logic is implemented separately in antd.
const TourPanel = props => {
const {
stepProps,
current,
type,
indicatorsRender,
actionsRender
} = props;
const {
prefixCls,
total = 1,
title,
onClose,
onPrev,
onNext,
onFinish,
cover,
description,
nextButtonProps,
prevButtonProps,
type: stepType,
closable,
classNames = {},
styles = {}
} = stepProps;
const mergedType = stepType ?? type;
const ariaProps = (0,pickAttrs["default"])(closable ?? {}, true);
const [contextLocaleGlobal] = (0,useLocale["default"])('global', en_US["default"].global);
const [contextLocaleTour] = (0,useLocale["default"])('Tour', en_US["default"].Tour);
const mergedCloseIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
type: "button",
onClick: onClose,
className: `${prefixCls}-close`,
"aria-label": contextLocaleGlobal?.close,
...ariaProps
}, closable?.closeIcon || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_CloseOutlined, {
className: `${prefixCls}-close-icon`
}));
const isLastStep = current === total - 1;
const prevBtnClick = () => {
onPrev?.();
prevButtonProps?.onClick?.();
};
const nextBtnClick = () => {
if (isLastStep) {
onFinish?.();
} else {
onNext?.();
}
nextButtonProps?.onClick?.();
};
const headerNode = (0,is.isNonNullable)(title) ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-header`, classNames.header),
style: styles.header
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-title`, classNames.title),
style: styles.title
}, title))) : null;
const descriptionNode = (0,is.isNonNullable)(description) ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-description`, classNames.description),
style: styles.description
}, description)) : null;
const coverNode = (0,is.isNonNullable)(cover) ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-cover`, classNames.cover),
style: styles.cover
}, cover)) : null;
let mergedIndicatorNode;
if (indicatorsRender) {
mergedIndicatorNode = indicatorsRender(current, total);
} else {
mergedIndicatorNode = (0,toConsumableArray["default"])(Array.from({
length: total
}).keys()).map((stepItem, index) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
key: stepItem,
className: (0,clsx.clsx)(index === current && `${prefixCls}-indicator-active`, `${prefixCls}-indicator`, classNames.indicator),
style: styles.indicator
})));
}
const mainBtnType = mergedType === 'primary' ? 'default' : 'primary';
const secondaryBtnProps = {
type: 'default',
ghost: mergedType === 'primary'
};
const defaultActionsNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, current !== 0 ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(button_Button, {
size: "small",
...secondaryBtnProps,
...prevButtonProps,
onClick: prevBtnClick,
className: (0,clsx.clsx)(`${prefixCls}-prev-btn`, prevButtonProps?.className)
}, prevButtonProps?.children ?? contextLocaleTour?.Previous)) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(button_Button, {
size: "small",
type: mainBtnType,
...nextButtonProps,
onClick: nextBtnClick,
className: (0,clsx.clsx)(`${prefixCls}-next-btn`, nextButtonProps?.className)
}, nextButtonProps?.children ?? (isLastStep ? contextLocaleTour?.Finish : contextLocaleTour?.Next)));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${prefixCls}-panel`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-section`, classNames.section),
style: styles.section
}, closable && mergedCloseIcon, coverNode, headerNode, descriptionNode, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-footer`, classNames.footer),
style: styles.footer
}, total > 1 && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-indicators`, classNames.indicators),
style: styles.indicators
}, mergedIndicatorNode)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-actions`, classNames.actions),
style: styles.actions
}, actionsRender ? actionsRender(defaultActionsNode, {
current,
total
}) : defaultActionsNode))));
};
/* harmony default export */ var panelRender = (TourPanel);
// EXTERNAL MODULE: ./components/tour/style/index.ts
var tour_style = __webpack_require__("./components/tour/style/index.ts");
;// ./components/tour/PurePanel.tsx
const tour_PurePanel_PurePanel = props => {
const {
prefixCls: customizePrefixCls,
current = 0,
total = 6,
className,
style,
type,
closable,
closeIcon,
...restProps
} = props;
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const prefixCls = getPrefixCls('tour', customizePrefixCls);
const [hashId, cssVarCls] = (0,tour_style["default"])(prefixCls);
const [mergedClosable, mergedCloseIcon] = useClosable({
closable,
closeIcon
}, null, {
closable: true,
closeIconRender: icon => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(icon) ? (0,reactNode.cloneElement)(icon, {
className: (0,clsx.clsx)(icon.props?.className, `${prefixCls}-close-icon`)
}) : icon
});
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(RawPurePanel, {
prefixCls: prefixCls,
hashId: hashId,
className: (0,clsx.clsx)(className, `${prefixCls}-pure`, type && `${prefixCls}-${type}`, cssVarCls),
style: style
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(panelRender, {
stepProps: {
...restProps,
prefixCls,
total,
closable: mergedClosable ? {
closeIcon: mergedCloseIcon
} : undefined
},
current: current,
type: type
}));
};
/* harmony default export */ var tour_PurePanel = (withPureRenderTheme(tour_PurePanel_PurePanel));
;// ./components/tour/index.tsx
const tour_Tour = props => {
const {
prefixCls: customizePrefixCls,
type,
rootClassName,
indicatorsRender,
actionsRender,
steps,
closeIcon,
keyboard = true,
classNames,
styles,
className,
style,
...restProps
} = props;
const {
getPrefixCls,
direction,
closeIcon: contextCloseIcon,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('tour');
const prefixCls = getPrefixCls('tour', customizePrefixCls);
const [hashId, cssVarCls] = (0,tour_style["default"])(prefixCls);
const [, token] = (0,useToken["default"])();
const mergedSteps = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => steps?.map(step => ({
...step,
className: (0,clsx.clsx)(step.className, {
[`${prefixCls}-primary`]: (step.type ?? type) === 'primary'
})
})), [prefixCls, steps, type]);
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
steps: mergedSteps
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const builtinPlacements = config => getPlacements({
arrowPointAtCenter: config?.arrowPointAtCenter ?? true,
autoAdjustOverflow: true,
offset: token.marginXXS,
arrowWidth: token.sizePopupArrow,
borderRadius: token.borderRadius
});
const mergedRootClassName = (0,clsx.clsx)({
[`${prefixCls}-rtl`]: direction === 'rtl'
}, hashId, cssVarCls, rootClassName, contextClassName, mergedClassNames.root, className);
const semanticStyles = {
...mergedStyles,
mask: {
...mergedStyles.root,
...mergedStyles.mask,
...contextStyle,
...style
}
};
const mergedRenderPanel = (stepProps, stepCurrent) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(panelRender, {
styles: semanticStyles,
classNames: mergedClassNames,
type: type,
stepProps: stepProps,
current: stepCurrent,
indicatorsRender: indicatorsRender,
actionsRender: actionsRender
}));
// ============================ zIndex ============================
const [zIndex, contextZIndex] = (0,useZIndex.useZIndex)('Tour', restProps.zIndex);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(zindexContext["default"].Provider, {
value: contextZIndex
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(tour_es, {
...restProps,
styles: semanticStyles,
classNames: mergedClassNames,
closeIcon: closeIcon ?? contextCloseIcon,
keyboard: keyboard,
zIndex: zIndex,
rootClassName: mergedRootClassName,
prefixCls: prefixCls,
animated: true,
renderPanel: mergedRenderPanel,
builtinPlacements: builtinPlacements,
steps: mergedSteps
}));
};
if (true) {
tour_Tour.displayName = 'Tour';
}
tour_Tour._InternalPanelDoNotUseOrYouWillBeFired = tour_PurePanel;
/* harmony default export */ var tour = (tour_Tour);
;// ./components/_util/transKeys.ts
const groupKeysMap = keys => {
const map = new Map();
keys.forEach((key, index) => {
map.set(key, index);
});
return map;
};
const groupDisabledKeysMap = dataSource => {
const map = new Map();
dataSource.forEach(({
disabled,
key
}, index) => {
if (disabled) {
map.set(key, index);
}
});
return map;
};
;// ./components/transfer/Actions.tsx
function getArrowIcon(type, direction) {
const isRight = type === 'right';
if (direction !== 'rtl') {
return isRight ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(RightOutlined["default"], null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_LeftOutlined, null);
}
return isRight ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_LeftOutlined, null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(RightOutlined["default"], null);
}
const Action = ({
type,
actions,
moveToLeft,
moveToRight,
leftActive,
rightActive,
direction,
disabled
}) => {
const isRight = type === 'right';
const button = isRight ? actions[0] : actions[1];
const moveHandler = isRight ? moveToRight : moveToLeft;
const active = isRight ? rightActive : leftActive;
const icon = getArrowIcon(type, direction);
if (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(button)) {
const element = button;
const onClick = event => {
element?.props?.onClick?.(event);
moveHandler?.(event);
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(element, {
disabled: disabled || !active,
onClick
});
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(button_Button, {
type: "primary",
size: "small",
disabled: disabled || !active,
onClick: event => moveHandler?.(event),
icon: icon
}, button);
};
const Actions = props => {
const {
className,
style,
oneWay,
actions,
...restProps
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: className,
style: style
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Action, {
type: "right",
actions: actions,
...restProps
}), !oneWay && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Action, {
type: "left",
actions: actions,
...restProps
}), actions.slice(oneWay ? 1 : 2));
};
if (true) {
Actions.displayName = 'Actions';
}
/* harmony default export */ var transfer_Actions = (Actions);
;// ./components/transfer/hooks/useData.ts
const useData = (dataSource, rowKey, targetKeys) => {
const mergedDataSource = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => (dataSource || []).map(record => {
if (rowKey) {
return {
...record,
key: rowKey(record)
};
}
return record;
}), [dataSource, rowKey]);
const [leftDataSource, rightDataSource] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const leftData = [];
const rightData = Array.from({
length: targetKeys?.length ?? 0
});
const targetKeysMap = groupKeysMap(targetKeys || []);
mergedDataSource.forEach(record => {
// rightData should be ordered by targetKeys
// leftData should be ordered by dataSource
if (targetKeysMap.has(record.key)) {
const idx = targetKeysMap.get(record.key);
rightData[idx] = record;
} else {
leftData.push(record);
}
});
return [leftData, rightData];
}, [mergedDataSource, targetKeys]);
return [mergedDataSource, leftDataSource.filter(Boolean), rightDataSource.filter(Boolean)];
};
/* harmony default export */ var hooks_useData = (useData);
;// ./components/transfer/hooks/useSelection.ts
const EMPTY_KEYS = [];
function filterKeys(keys, dataKeys) {
const filteredKeys = keys.filter(key => dataKeys.has(key));
return keys.length === filteredKeys.length ? keys : filteredKeys;
}
function useSelection_flattenKeys(keys) {
return Array.from(keys).join(';');
}
function useSelection_useSelection(leftDataSource, rightDataSource, selectedKeys) {
// Prepare `dataSource` keys
const [leftKeys, rightKeys] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => [new Set(leftDataSource.map(src => src?.key)), new Set(rightDataSource.map(src => src?.key))], [leftDataSource, rightDataSource]);
// Selected Keys
const [mergedSelectedKeys, setMergedSelectedKeys] = (0,es.useControlledState)(EMPTY_KEYS, selectedKeys);
const sourceSelectedKeys = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => filterKeys(mergedSelectedKeys, leftKeys), [mergedSelectedKeys, leftKeys]);
const targetSelectedKeys = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => filterKeys(mergedSelectedKeys, rightKeys), [mergedSelectedKeys, rightKeys]);
// // Reset when data changed
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
setMergedSelectedKeys([].concat((0,toConsumableArray["default"])(filterKeys(mergedSelectedKeys, leftKeys)), (0,toConsumableArray["default"])(filterKeys(mergedSelectedKeys, rightKeys))));
}, [useSelection_flattenKeys(leftKeys), useSelection_flattenKeys(rightKeys)]);
// Update keys
const setSourceSelectedKeys = (0,es.useEvent)(nextSrcKeys => {
setMergedSelectedKeys([].concat((0,toConsumableArray["default"])(nextSrcKeys), (0,toConsumableArray["default"])(targetSelectedKeys)));
});
const setTargetSelectedKeys = (0,es.useEvent)(nextTargetKeys => {
setMergedSelectedKeys([].concat((0,toConsumableArray["default"])(sourceSelectedKeys), (0,toConsumableArray["default"])(nextTargetKeys)));
});
return [
// Keys
sourceSelectedKeys, targetSelectedKeys,
// Updater
setSourceSelectedKeys, setTargetSelectedKeys];
}
/* harmony default export */ var transfer_hooks_useSelection = (useSelection_useSelection);
;// ./components/transfer/search.tsx
const search_Search = props => {
const {
placeholder = '',
value,
prefixCls,
disabled,
onChange,
handleClear
} = props;
const handleChange = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(e => {
onChange?.(e);
if (e.target.value === '') {
handleClear?.();
}
}, [onChange]);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(input_Input, {
placeholder: placeholder,
className: prefixCls,
value: value,
onChange: handleChange,
disabled: disabled,
allowClear: true,
prefix: /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_SearchOutlined, null)
});
};
if (true) {
search_Search.displayName = 'Search';
}
/* harmony default export */ var transfer_search = (search_Search);
;// ./node_modules/@ant-design/icons-svg/es/asn/DeleteOutlined.js
// This icon file is generated automatically.
var DeleteOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z" } }] }, "name": "delete", "theme": "outlined" };
/* harmony default export */ var asn_DeleteOutlined = (DeleteOutlined);
;// ./node_modules/@ant-design/icons/es/icons/DeleteOutlined.js
function DeleteOutlined_extends() { DeleteOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return DeleteOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const DeleteOutlined_DeleteOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], DeleteOutlined_extends({}, props, {
ref: ref,
icon: asn_DeleteOutlined
}));
/** */
const DeleteOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(DeleteOutlined_DeleteOutlined);
if (true) {
DeleteOutlined_RefIcon.displayName = 'DeleteOutlined';
}
/* harmony default export */ var icons_DeleteOutlined = (DeleteOutlined_RefIcon);
;// ./components/transfer/ListItem.tsx
const ListItem = props => {
const {
prefixCls,
classNames,
styles,
renderedText,
renderedEl,
item,
checked,
disabled,
onClick,
onRemove,
showRemove
} = props;
const mergedDisabled = disabled || item?.disabled;
const classes = (0,clsx.clsx)(`${prefixCls}-content-item`, classNames.item, {
[`${prefixCls}-content-item-disabled`]: mergedDisabled,
[`${prefixCls}-content-item-checked`]: checked && !mergedDisabled
});
let title;
if (typeof renderedText === 'string' || (0,is.isNumber)(renderedText)) {
title = String(renderedText);
}
const [contextLocale] = (0,useLocale["default"])('Transfer', en_US["default"].Transfer);
const liProps = {
className: classes,
style: styles.item,
title
};
const labelNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: (0,clsx.clsx)(`${prefixCls}-content-item-text`, classNames.itemContent),
style: styles.itemContent
}, renderedEl);
if (showRemove) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("li", {
...liProps
}, labelNode, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
disabled: mergedDisabled,
className: `${prefixCls}-content-item-remove`,
"aria-label": contextLocale?.remove,
onClick: () => onRemove?.(item)
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_DeleteOutlined, null)));
}
// Default click to select
liProps.onClick = mergedDisabled ? undefined : event => onClick(item, event);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("li", {
...liProps
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_checkbox, {
className: (0,clsx.clsx)(`${prefixCls}-checkbox`, classNames.itemIcon),
style: styles.itemIcon,
checked: checked,
disabled: mergedDisabled
}), labelNode);
};
/* harmony default export */ var transfer_ListItem = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.memo(ListItem));
;// ./components/transfer/ListBody.tsx
const OmitProps = ['handleFilter', 'handleClear', 'checkedKeys'];
const parsePagination = pagination => {
const defaultPagination = {
simple: true,
showSizeChanger: false,
showLessItems: false
};
return {
...defaultPagination,
...pagination
};
};
const TransferListBody = (props, ref) => {
const {
prefixCls,
classNames,
styles,
filteredRenderItems,
selectedKeys,
disabled: globalDisabled,
showRemove,
pagination,
onScroll,
onItemSelect,
onItemRemove
} = props;
const [current, setCurrent] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(1);
const mergedPagination = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!pagination) {
return null;
}
const convertPagination = (0,is.isPlainObject)(pagination) ? pagination : {};
return parsePagination(convertPagination);
}, [pagination]);
const [pageSize, setPageSize] = (0,es.useControlledState)(10, mergedPagination?.pageSize);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (mergedPagination) {
const maxPageCount = Math.ceil(filteredRenderItems.length / pageSize);
setCurrent(Math.min(current, maxPageCount));
}
}, [filteredRenderItems, mergedPagination, pageSize]);
const onInternalClick = (item, e) => {
onItemSelect(item.key, !selectedKeys.includes(item.key), e);
};
const onRemove = item => {
onItemRemove?.([item.key]);
};
const onPageChange = cur => {
setCurrent(cur);
};
const onSizeChange = (cur, size) => {
setCurrent(cur);
setPageSize(size);
};
const memoizedItems = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const displayItems = mergedPagination ? filteredRenderItems.slice((current - 1) * pageSize, current * pageSize) : filteredRenderItems;
return displayItems;
}, [current, filteredRenderItems, mergedPagination, pageSize]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
items: memoizedItems
}));
const paginationNode = mergedPagination ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_pagination, {
size: "small",
disabled: globalDisabled,
simple: mergedPagination.simple,
pageSize: pageSize,
showLessItems: mergedPagination.showLessItems,
showSizeChanger: mergedPagination.showSizeChanger,
className: `${prefixCls}-pagination`,
total: filteredRenderItems.length,
current: current,
onChange: onPageChange,
onShowSizeChange: onSizeChange
})) : null;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("ul", {
className: (0,clsx.clsx)(`${prefixCls}-content`, classNames.list, {
[`${prefixCls}-content-show-remove`]: showRemove
}),
style: styles.list,
onScroll: onScroll
}, (memoizedItems || []).map(({
renderedEl,
renderedText,
item
}) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(transfer_ListItem, {
key: item.key,
prefixCls: prefixCls,
classNames: classNames,
styles: styles,
item: item,
renderedText: renderedText,
renderedEl: renderedEl,
showRemove: showRemove,
onClick: onInternalClick,
onRemove: onRemove,
checked: selectedKeys.includes(item.key),
disabled: globalDisabled
})))), paginationNode);
};
if (true) {
TransferListBody.displayName = 'TransferListBody';
}
/* harmony default export */ var ListBody = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(TransferListBody));
;// ./components/transfer/Section.tsx
const Section_defaultRender = () => null;
function isRenderResultPlainObject(result) {
return !!(result && ! /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(result) && Object.prototype.toString.call(result) === '[object Object]');
}
function getEnabledItemKeys(items) {
return items.filter(data => !data.disabled).map(data => data.key);
}
function getTextFromRenderResult(renderResult, item) {
for (const v of [renderResult, item.title, item.key]) {
if (typeof v === 'string' || (0,is.isNumber)(v)) {
return String(v);
}
}
return '';
}
const isValidIcon = icon => icon !== undefined;
const getShowSearchOption = showSearch => {
if ((0,is.isPlainObject)(showSearch)) {
return {
...showSearch,
defaultValue: showSearch.defaultValue || ''
};
}
return {
defaultValue: '',
placeholder: ''
};
};
const TransferSection = props => {
const {
prefixCls,
style,
classNames,
styles,
dataSource = [],
titleText = '',
checkedKeys,
disabled,
showSearch = false,
searchPlaceholder,
notFoundContent,
selectAll,
deselectAll,
selectCurrent,
selectInvert,
removeAll,
removeCurrent,
showSelectAll = true,
showRemove,
pagination,
direction,
itemsUnit,
itemUnit,
selectAllLabel,
selectionsIcon,
footer,
renderList,
onItemSelectAll,
onItemRemove,
handleFilter,
handleClear,
filterOption,
render = Section_defaultRender
} = props;
const sectionPrefixCls = `${prefixCls}-section`;
const listPrefixCls = `${prefixCls}-list`;
const searchOptions = getShowSearchOption(showSearch);
const [filterValue, setFilterValue] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(searchOptions.defaultValue);
const listBodyRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({});
const internalHandleFilter = e => {
setFilterValue(e.target.value);
handleFilter(e);
};
const internalHandleClear = () => {
setFilterValue('');
handleClear();
};
const matchFilter = (text, item) => {
if (typeof filterOption === 'function') {
return filterOption(filterValue, item, direction);
}
return text.includes(filterValue);
};
const customRenderListBody = listProps => {
let bodyContent = renderList ? renderList({
...listProps,
onItemSelect: (key, check) => listProps.onItemSelect(key, check)
}) : null;
const customize = !!bodyContent;
if (!customize) {
// @ts-ignore
bodyContent = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(ListBody, {
ref: listBodyRef,
...listProps,
prefixCls: listPrefixCls
});
}
return {
customize,
bodyContent
};
};
const renderItem = item => {
const renderResult = render(item);
const isRenderResultPlain = isRenderResultPlainObject(renderResult);
const renderedEl = isRenderResultPlain ? renderResult.label : renderResult;
const renderedText = isRenderResultPlain ? renderResult.value : getTextFromRenderResult(renderResult, item);
return {
item,
renderedEl,
renderedText
};
};
const notFoundContentEle = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => Array.isArray(notFoundContent) ? notFoundContent[direction === 'left' ? 0 : 1] : notFoundContent, [notFoundContent, direction]);
const [filteredItems, filteredRenderItems] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
const filterItems = [];
const filterRenderItems = [];
dataSource.forEach(item => {
const renderedItem = renderItem(item);
if (filterValue && !matchFilter(renderedItem.renderedText, item)) {
return;
}
filterItems.push(item);
filterRenderItems.push(renderedItem);
});
return [filterItems, filterRenderItems];
}, [dataSource, filterValue]);
const checkedActiveItems = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
return filteredItems.filter(item => checkedKeys.includes(item.key) && !item.disabled);
}, [checkedKeys, filteredItems]);
const checkStatus = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (checkedActiveItems.length === 0) {
return 'none';
}
const checkedKeysMap = groupKeysMap(checkedKeys);
if (filteredItems.every(item => checkedKeysMap.has(item.key) || !!item.disabled)) {
return 'all';
}
return 'part';
}, [checkedActiveItems.length, checkedKeys, filteredItems]);
const renderListBody = () => {
const search = showSearch ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${listPrefixCls}-body-search-wrapper`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(transfer_search, {
prefixCls: `${listPrefixCls}-search`,
onChange: internalHandleFilter,
handleClear: internalHandleClear,
placeholder: searchOptions.placeholder || searchPlaceholder,
value: filterValue,
disabled: disabled
}))) : null;
const {
customize,
bodyContent
} = customRenderListBody({
...(0,es.omit)(props, OmitProps),
filteredItems,
filteredRenderItems,
selectedKeys: checkedKeys,
classNames,
styles
});
let bodyNode;
// We should wrap customize list body in a classNamed div to use flex layout.
if (customize) {
bodyNode = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${listPrefixCls}-body-customize-wrapper`
}, bodyContent);
} else {
bodyNode = filteredItems.length ? bodyContent : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: `${listPrefixCls}-body-not-found`
}, notFoundContentEle));
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${listPrefixCls}-body`, {
[`${listPrefixCls}-body-with-search`]: showSearch
}, classNames.body),
style: styles.body
}, search, bodyNode);
};
const checkBox = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_checkbox, {
disabled: dataSource.filter(d => !d.disabled).length === 0 || disabled,
checked: checkStatus === 'all',
indeterminate: checkStatus === 'part',
className: `${listPrefixCls}-checkbox`,
onChange: () => {
// Only select enabled items
onItemSelectAll?.(filteredItems.filter(item => !item.disabled).map(({
key
}) => key), checkStatus !== 'all');
}
});
const getSelectAllLabel = (selectedCount, totalCount) => {
if (selectAllLabel) {
return typeof selectAllLabel === 'function' ? selectAllLabel({
selectedCount,
totalCount
}) : selectAllLabel;
}
const unit = totalCount > 1 ? itemsUnit : itemUnit;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, (selectedCount > 0 ? `${selectedCount}/` : '') + totalCount, " ", unit);
};
// Custom Layout
const footerDom = footer && (footer.length < 2 ? footer(props) : footer(props, {
direction
}));
// Get filtered, checked item list
const listFooter = footerDom ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${listPrefixCls}-footer`, classNames.footer),
style: styles.footer
}, footerDom)) : null;
const checkAllCheckbox = !showRemove && !pagination && checkBox;
let items;
if (showRemove) {
items = [/* Remove Current Page */
pagination ? {
key: 'removeCurrent',
label: removeCurrent,
onClick() {
const pageKeys = getEnabledItemKeys((listBodyRef.current?.items || []).map(entity => entity.item));
onItemRemove?.(pageKeys);
}
} : null, /* Remove All */
{
key: 'removeAll',
label: removeAll,
onClick() {
onItemRemove?.(getEnabledItemKeys(filteredItems));
}
}].filter(Boolean);
} else {
items = [{
key: 'selectAll',
label: checkStatus === 'all' ? deselectAll : selectAll,
onClick() {
const keys = getEnabledItemKeys(filteredItems);
onItemSelectAll?.(keys, keys.length !== checkedKeys.length);
}
}, pagination ? {
key: 'selectCurrent',
label: selectCurrent,
onClick() {
const pageItems = listBodyRef.current?.items || [];
onItemSelectAll?.(getEnabledItemKeys(pageItems.map(entity => entity.item)), true);
}
} : null, {
key: 'selectInvert',
label: selectInvert,
onClick() {
const availablePageItemKeys = getEnabledItemKeys((listBodyRef.current?.items || []).map(entity => entity.item));
const checkedKeySet = new Set(checkedKeys);
const newCheckedKeysSet = new Set(checkedKeySet);
availablePageItemKeys.forEach(key => {
if (checkedKeySet.has(key)) {
newCheckedKeysSet.delete(key);
} else {
newCheckedKeysSet.add(key);
}
});
onItemSelectAll?.((0,toConsumableArray["default"])(newCheckedKeysSet), 'replace');
}
}];
}
const dropdown = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(components_dropdown, {
className: `${listPrefixCls}-header-dropdown`,
menu: {
items
},
disabled: disabled
}, isValidIcon(selectionsIcon) ? selectionsIcon : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(icons_DownOutlined, null));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(sectionPrefixCls, classNames.section, {
[`${sectionPrefixCls}-with-pagination`]: !!pagination,
[`${sectionPrefixCls}-with-footer`]: !!footerDom
}),
style: {
...style,
...styles.section
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: (0,clsx.clsx)(`${listPrefixCls}-header`, classNames.header),
style: styles.header
}, showSelectAll ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, checkAllCheckbox, dropdown)) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: `${listPrefixCls}-header-selected`
}, getSelectAllLabel(checkedActiveItems.length, filteredItems.length)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
className: (0,clsx.clsx)(`${listPrefixCls}-header-title`, classNames.title),
style: styles.title
}, titleText)), renderListBody(), listFooter);
};
if (true) {
TransferSection.displayName = 'TransferSection';
}
/* harmony default export */ var Section = (TransferSection);
// EXTERNAL MODULE: ./components/transfer/style/index.ts
var transfer_style = __webpack_require__("./components/transfer/style/index.ts");
;// ./components/transfer/index.tsx
const Transfer = props => {
const {
prefixCls: customizePrefixCls,
className,
rootClassName,
classNames,
styles,
style,
listStyle,
operationStyle,
operations,
actions,
dataSource,
targetKeys = [],
selectedKeys,
selectAllLabels = [],
locale = {},
titles,
disabled,
showSearch = false,
showSelectAll,
oneWay,
pagination,
status: customStatus,
selectionsIcon,
filterOption,
render,
footer,
children,
rowKey,
onScroll,
onChange,
onSearch,
onSelectChange
} = props;
const {
getPrefixCls,
renderEmpty,
direction: dir,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles,
selectionsIcon: contextSelectionsIcon
} = (0,config_provider_context.useComponentConfig)('transfer');
const contextDisabled = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(config_provider_DisabledContext);
const mergedDisabled = disabled ?? contextDisabled;
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
disabled: mergedDisabled
};
const prefixCls = getPrefixCls('transfer', customizePrefixCls);
const [hashId, cssVarCls] = (0,transfer_style["default"])(prefixCls);
const mergedActions = actions || operations || [];
const isRtl = dir === 'rtl';
// Fill record with `key`
const [mergedDataSource, leftDataSource, rightDataSource] = hooks_useData(dataSource, rowKey, targetKeys);
// Get direction selected keys
const [
// Keys
sourceSelectedKeys, targetSelectedKeys,
// Setters
setSourceSelectedKeys, setTargetSelectedKeys] = transfer_hooks_useSelection(leftDataSource, rightDataSource, selectedKeys);
const [leftMultipleSelect, updateLeftPrevSelectedIndex] = useMultipleSelect(item => item.key);
const [rightMultipleSelect, updateRightPrevSelectedIndex] = useMultipleSelect(item => item.key);
const setStateKeys = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)((direction, keys) => {
if (direction === 'left') {
const nextKeys = typeof keys === 'function' ? keys(sourceSelectedKeys || []) : keys;
setSourceSelectedKeys(nextKeys);
} else {
const nextKeys = typeof keys === 'function' ? keys(targetSelectedKeys || []) : keys;
setTargetSelectedKeys(nextKeys);
}
}, [sourceSelectedKeys, targetSelectedKeys]);
const setPrevSelectedIndex = (direction, value) => {
const isLeftDirection = direction === 'left';
const updatePrevSelectedIndex = isLeftDirection ? updateLeftPrevSelectedIndex : updateRightPrevSelectedIndex;
updatePrevSelectedIndex(value);
};
const handleSelectChange = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)((direction, holder) => {
if (direction === 'left') {
onSelectChange?.(holder, targetSelectedKeys);
} else {
onSelectChange?.(sourceSelectedKeys, holder);
}
}, [sourceSelectedKeys, targetSelectedKeys]);
const getTitles = transferLocale => titles ?? transferLocale.titles ?? [];
const handleLeftScroll = e => {
onScroll?.('left', e);
};
const handleRightScroll = e => {
onScroll?.('right', e);
};
const moveTo = direction => {
const moveKeys = direction === 'right' ? sourceSelectedKeys : targetSelectedKeys;
const dataSourceDisabledKeysMap = groupDisabledKeysMap(mergedDataSource);
// filter the disabled options
const newMoveKeys = moveKeys.filter(key => !dataSourceDisabledKeysMap.has(key));
const newMoveKeysMap = groupKeysMap(newMoveKeys);
// move items to target box
const newTargetKeys = direction === 'right' ? newMoveKeys.concat(targetKeys) : targetKeys.filter(targetKey => !newMoveKeysMap.has(targetKey));
// empty checked keys
const oppositeDirection = direction === 'right' ? 'left' : 'right';
setStateKeys(oppositeDirection, []);
handleSelectChange(oppositeDirection, []);
onChange?.(newTargetKeys, direction, newMoveKeys);
};
const moveToLeft = () => {
moveTo('left');
setPrevSelectedIndex('left', null);
};
const moveToRight = () => {
moveTo('right');
setPrevSelectedIndex('right', null);
};
const onItemSelectAll = (direction, keys, checkAll) => {
setStateKeys(direction, prevKeys => {
let mergedCheckedKeys = [];
if (checkAll === 'replace') {
mergedCheckedKeys = keys;
} else if (checkAll) {
// Merge current keys with origin key
mergedCheckedKeys = Array.from(new Set([].concat((0,toConsumableArray["default"])(prevKeys), (0,toConsumableArray["default"])(keys))));
} else {
const selectedKeysMap = groupKeysMap(keys);
// Remove current keys from origin keys
mergedCheckedKeys = prevKeys.filter(key => !selectedKeysMap.has(key));
}
handleSelectChange(direction, mergedCheckedKeys);
return mergedCheckedKeys;
});
setPrevSelectedIndex(direction, null);
};
const onLeftItemSelectAll = (keys, checkAll) => onItemSelectAll('left', keys, checkAll);
const onRightItemSelectAll = (keys, checkAll) => onItemSelectAll('right', keys, checkAll);
const leftFilter = e => onSearch?.('left', e.target.value);
const rightFilter = e => onSearch?.('right', e.target.value);
const handleLeftClear = () => onSearch?.('left', '');
const handleRightClear = () => onSearch?.('right', '');
const handleSingleSelect = (direction, holder, selectedKey, checked, currentSelectedIndex) => {
const isSelected = holder.has(selectedKey);
if (isSelected) {
holder.delete(selectedKey);
setPrevSelectedIndex(direction, null);
}
if (checked) {
holder.add(selectedKey);
setPrevSelectedIndex(direction, currentSelectedIndex);
}
};
const handleMultipleSelect = (direction, data, holder, currentSelectedIndex) => {
const isLeftDirection = direction === 'left';
const multipleSelect = isLeftDirection ? leftMultipleSelect : rightMultipleSelect;
multipleSelect(currentSelectedIndex, data, holder);
};
const onItemSelect = (direction, selectedKey, checked, multiple) => {
const isLeftDirection = direction === 'left';
const holder = isLeftDirection ? sourceSelectedKeys : targetSelectedKeys;
const holderSet = new Set(holder);
const data = (isLeftDirection ? leftDataSource : rightDataSource).filter(item => !item.disabled);
const currentSelectedIndex = data.findIndex(item => item.key === selectedKey);
// multiple select by hold down the shift key
if (multiple && holder.length > 0) {
handleMultipleSelect(direction, data, holderSet, currentSelectedIndex);
} else {
handleSingleSelect(direction, holderSet, selectedKey, checked, currentSelectedIndex);
}
const holderArr = Array.from(holderSet);
handleSelectChange(direction, holderArr);
if (!props.selectedKeys) {
setStateKeys(direction, holderArr);
}
};
const onLeftItemSelect = (selectedKey, checked, e) => {
onItemSelect('left', selectedKey, checked, e?.shiftKey);
};
const onRightItemSelect = (selectedKey, checked, e) => onItemSelect('right', selectedKey, checked, e?.shiftKey);
const onRightItemRemove = keys => {
setStateKeys('right', []);
onChange?.(targetKeys.filter(key => !keys.includes(key)), 'left', (0,toConsumableArray["default"])(keys));
};
const handleListStyle = direction => {
if (typeof listStyle === 'function') {
return listStyle({
direction
});
}
return listStyle || {};
};
const formItemContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(FormItemInputContext);
const {
hasFeedback,
status
} = formItemContext;
const getLocale = transferLocale => ({
...transferLocale,
notFoundContent: renderEmpty?.('Transfer') || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(defaultRenderEmpty, {
componentName: "Transfer"
}),
...locale
});
const mergedStatus = getMergedStatus(status, customStatus);
const mergedPagination = !children && pagination;
const leftActive = rightDataSource.filter(d => targetSelectedKeys.includes(d.key) && !d.disabled).length > 0;
const rightActive = leftDataSource.filter(d => sourceSelectedKeys.includes(d.key) && !d.disabled).length > 0;
// ====================== Styles ======================
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const cls = (0,clsx.clsx)(prefixCls, {
[`${prefixCls}-disabled`]: mergedDisabled,
[`${prefixCls}-customize-list`]: !!children,
[`${prefixCls}-rtl`]: isRtl
}, getStatusClassNames(prefixCls, mergedStatus, hasFeedback), contextClassName, className, rootClassName, hashId, cssVarCls, mergedClassNames.root);
// ====================== Locale ======================
const [contextLocale] = (0,useLocale["default"])('Transfer', en_US["default"].Transfer);
const listLocale = getLocale(contextLocale);
const [leftTitle, rightTitle] = getTitles(listLocale);
const mergedSelectionsIcon = selectionsIcon ?? contextSelectionsIcon;
// ===================== Warning ======================
if (true) {
const warning = (0,_util_warning.devUseWarning)('Transfer');
true ? warning(!pagination || !children, 'usage', '`pagination` not support customize render list.') : 0;
[['listStyle', 'styles.section'], ['operationStyle', 'styles.actions'], ['operations', 'actions']].forEach(([deprecatedName, newName]) => {
warning.deprecated(!(deprecatedName in props), deprecatedName, newName);
});
}
// ====================== Render ======================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
className: cls,
style: {
...contextStyle,
...mergedStyles.root,
...style
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Section, {
prefixCls: prefixCls,
style: handleListStyle('left'),
classNames: mergedClassNames,
styles: mergedStyles,
titleText: leftTitle,
dataSource: leftDataSource,
filterOption: filterOption,
checkedKeys: sourceSelectedKeys,
handleFilter: leftFilter,
handleClear: handleLeftClear,
onItemSelect: onLeftItemSelect,
onItemSelectAll: onLeftItemSelectAll,
render: render,
showSearch: showSearch,
renderList: children,
footer: footer,
onScroll: handleLeftScroll,
disabled: mergedDisabled,
direction: isRtl ? 'right' : 'left',
showSelectAll: showSelectAll,
selectAllLabel: selectAllLabels[0],
pagination: mergedPagination,
selectionsIcon: mergedSelectionsIcon,
...listLocale
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(transfer_Actions, {
className: (0,clsx.clsx)(`${prefixCls}-actions`, mergedClassNames.actions),
rightActive: rightActive,
moveToRight: moveToRight,
leftActive: leftActive,
actions: mergedActions,
moveToLeft: moveToLeft,
style: {
...operationStyle,
...mergedStyles.actions
},
disabled: mergedDisabled,
direction: dir,
oneWay: oneWay
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Section, {
prefixCls: prefixCls,
style: handleListStyle('right'),
classNames: mergedClassNames,
styles: mergedStyles,
titleText: rightTitle,
dataSource: rightDataSource,
filterOption: filterOption,
checkedKeys: targetSelectedKeys,
handleFilter: rightFilter,
handleClear: handleRightClear,
onItemSelect: onRightItemSelect,
onItemSelectAll: onRightItemSelectAll,
onItemRemove: onRightItemRemove,
render: render,
showSearch: showSearch,
renderList: children,
footer: footer,
onScroll: handleRightScroll,
disabled: mergedDisabled,
direction: isRtl ? 'left' : 'right',
showSelectAll: showSelectAll,
selectAllLabel: selectAllLabels[1],
showRemove: oneWay,
pagination: mergedPagination,
selectionsIcon: mergedSelectionsIcon,
...listLocale
}));
};
if (true) {
Transfer.displayName = 'Transfer';
}
Transfer.List = Section;
Transfer.Search = transfer_search;
Transfer.Operation = transfer_Actions;
/* harmony default export */ var transfer = (Transfer);
;// ./node_modules/@rc-component/tree-select/es/hooks/useCache.js
/**
* This function will try to call requestIdleCallback if available to save performance.
* No need `getLabel` here since already fetch on `rawLabeledValue`.
*/
/* harmony default export */ var hooks_useCache = (values => {
const cacheRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({
valueLabels: new Map()
});
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const {
valueLabels
} = cacheRef.current;
const valueLabelsCache = new Map();
const filledValues = values.map(item => {
const {
value,
label
} = item;
const mergedLabel = label ?? valueLabels.get(value);
// Save in cache
valueLabelsCache.set(value, mergedLabel);
return {
...item,
label: mergedLabel
};
});
cacheRef.current.valueLabels = valueLabelsCache;
return [filledValues];
}, [values]);
});
(Object.getOwnPropertyDescriptor(hooks_useCache, "name") || {}).writable || Object.defineProperty(hooks_useCache, "name", { value: "default", configurable: true });
;// ./node_modules/@rc-component/tree-select/es/hooks/useCheckedKeys.js
const useCheckedKeys = (rawLabeledValues, rawHalfCheckedValues, treeConduction, keyEntities) => {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const extractValues = values => values.map(({
value
}) => value);
const checkedKeys = extractValues(rawLabeledValues);
const halfCheckedKeys = extractValues(rawHalfCheckedValues);
const missingValues = checkedKeys.filter(key => !keyEntities[key]);
let finalCheckedKeys = checkedKeys;
let finalHalfCheckedKeys = halfCheckedKeys;
if (treeConduction) {
const conductResult = conductCheck(checkedKeys, true, keyEntities);
finalCheckedKeys = conductResult.checkedKeys;
finalHalfCheckedKeys = conductResult.halfCheckedKeys;
}
return [Array.from(new Set([...missingValues, ...finalCheckedKeys])), finalHalfCheckedKeys];
}, [rawLabeledValues, rawHalfCheckedValues, treeConduction, keyEntities]);
};
/* harmony default export */ var hooks_useCheckedKeys = (useCheckedKeys);
;// ./node_modules/@rc-component/tree-select/es/utils/valueUtil.js
const utils_valueUtil_toArray = value => Array.isArray(value) ? value : value !== undefined ? [value] : [];
const valueUtil_fillFieldNames = fieldNames => {
const {
label,
value,
children
} = fieldNames || {};
return {
_title: label ? [label] : ['title', 'label'],
value: value || 'value',
key: value || 'value',
children: children || 'children'
};
};
const valueUtil_isCheckDisabled = node => !node || node.disabled || node.disableCheckbox || node.checkable === false;
const getAllKeys = (treeData, fieldNames) => {
const keys = [];
const dig = list => {
list.forEach(item => {
const children = item[fieldNames.children];
if (children) {
keys.push(item[fieldNames.value]);
dig(children);
}
});
};
dig(treeData);
return keys;
};
const isNil = val => val === null || val === undefined;
;// ./node_modules/@rc-component/tree-select/es/hooks/useDataEntities.js
/* harmony default export */ var useDataEntities = ((treeData, fieldNames) => external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const collection = convertDataToEntities(treeData, {
fieldNames,
initWrapper: wrapper => ({
...wrapper,
valueEntities: new Map()
}),
processEntity: (entity, wrapper) => {
const val = entity.node[fieldNames.value];
// Check if exist same value
if (true) {
const key = entity.node.key;
(0,warning["default"])(!isNil(val), 'TreeNode `value` is invalidate: undefined');
(0,warning["default"])(!wrapper.valueEntities.has(val), `Same \`value\` exist in the tree: ${val}`);
(0,warning["default"])(!key || String(key) === String(val), `\`key\` or \`value\` with TreeNode must be the same or you can remove one of them. key: ${key}, value: ${val}.`);
}
wrapper.valueEntities.set(val, entity);
}
});
return collection;
}, [treeData, fieldNames]));
(Object.getOwnPropertyDescriptor(useDataEntities, "name") || {}).writable || Object.defineProperty(useDataEntities, "name", { value: "default", configurable: true });
;// ./node_modules/@rc-component/tree-select/es/TreeNode.js
/* istanbul ignore file */
/** This is a placeholder, not real render in dom */
const TreeNode_TreeNode = () => null;
/* harmony default export */ var tree_select_es_TreeNode = (TreeNode_TreeNode);
;// ./node_modules/@rc-component/tree-select/es/utils/legacyUtil.js
function legacyUtil_convertChildrenToData(nodes) {
return (0,toArray["default"])(nodes).map(node => {
if (! /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(node) || !node.type) {
return null;
}
const {
key,
props: {
children,
value,
...restProps
}
} = node;
const data = {
key,
value,
...restProps
};
const childData = legacyUtil_convertChildrenToData(children);
if (childData.length) {
data.children = childData;
}
return data;
}).filter(data => data);
}
function fillLegacyProps(dataNode) {
if (!dataNode) {
return dataNode;
}
const cloneNode = {
...dataNode
};
if (!('props' in cloneNode)) {
Object.defineProperty(cloneNode, 'props', {
get() {
(0,warning["default"])(false, 'New `rc-tree-select` not support return node instance as argument anymore. Please consider to remove `props` access.');
return cloneNode;
}
});
}
return cloneNode;
}
function fillAdditionalInfo(extra, triggerValue, checkedValues, treeData, showPosition, fieldNames) {
let triggerNode = null;
let nodeList = null;
function generateMap() {
function dig(list, level = '0', parentIncluded = false) {
return list.map((option, index) => {
const pos = `${level}-${index}`;
const value = option[fieldNames.value];
const included = checkedValues.includes(value);
const children = dig(option[fieldNames.children] || [], pos, included);
const node = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(tree_select_es_TreeNode, option, children.map(child => child.node));
// Link with trigger node
if (triggerValue === value) {
triggerNode = node;
}
if (included) {
const checkedNode = {
pos,
node,
children
};
if (!parentIncluded) {
nodeList.push(checkedNode);
}
return checkedNode;
}
return null;
}).filter(node => node);
}
if (!nodeList) {
nodeList = [];
dig(treeData);
// Sort to keep the checked node length
nodeList.sort(({
node: {
props: {
value: val1
}
}
}, {
node: {
props: {
value: val2
}
}
}) => {
const index1 = checkedValues.indexOf(val1);
const index2 = checkedValues.indexOf(val2);
return index1 - index2;
});
}
}
Object.defineProperty(extra, 'triggerNode', {
get() {
(0,warning["default"])(false, '`triggerNode` is deprecated. Please consider decoupling data with node.');
generateMap();
return triggerNode;
}
});
Object.defineProperty(extra, 'allCheckedNodes', {
get() {
(0,warning["default"])(false, '`allCheckedNodes` is deprecated. Please consider decoupling data with node.');
generateMap();
if (showPosition) {
return nodeList;
}
return nodeList.map(({
node
}) => node);
}
});
}
;// ./node_modules/@rc-component/tree-select/es/hooks/useFilterTreeData.js
const useFilterTreeData = (treeData, searchValue, options) => {
const {
fieldNames,
treeNodeFilterProp,
filterTreeNode
} = options;
const {
children: fieldChildren
} = fieldNames;
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!searchValue || filterTreeNode === false) {
return treeData;
}
const filterOptionFunc = typeof filterTreeNode === 'function' ? filterTreeNode : (_, dataNode) => String(dataNode[treeNodeFilterProp]).toUpperCase().includes(searchValue.toUpperCase());
const filterTreeNodes = (nodes, keepAll = false) => nodes.reduce((filtered, node) => {
const children = node[fieldChildren];
const isMatch = keepAll || filterOptionFunc(searchValue, fillLegacyProps(node));
const filteredChildren = filterTreeNodes(children || [], isMatch);
if (isMatch || filteredChildren.length) {
filtered.push({
...node,
isLeaf: undefined,
[fieldChildren]: filteredChildren
});
}
return filtered;
}, []);
return filterTreeNodes(treeData);
}, [treeData, searchValue, fieldChildren, treeNodeFilterProp, filterTreeNode]);
};
/* harmony default export */ var hooks_useFilterTreeData = (useFilterTreeData);
;// ./node_modules/@rc-component/tree-select/es/hooks/useRefFunc.js
/**
* Same as `React.useCallback` but always return a memoized function
* but redirect to real function.
*/
function useRefFunc_useRefFunc(callback) {
const funcRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
funcRef.current = callback;
const cacheFn = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback((...args) => {
return funcRef.current(...args);
}, []);
return cacheFn;
}
;// ./node_modules/@rc-component/tree-select/es/hooks/useTreeData.js
function buildTreeStructure(nodes, config) {
const {
id,
pId,
rootPId
} = config;
const nodeMap = new Map();
const rootNodes = [];
nodes.forEach(node => {
const nodeKey = node[id];
const clonedNode = {
...node,
key: node.key || nodeKey
};
nodeMap.set(nodeKey, clonedNode);
});
nodeMap.forEach(node => {
const parentKey = node[pId];
const parent = nodeMap.get(parentKey);
if (parent) {
parent.children = parent.children || [];
parent.children.push(node);
} else if (parentKey === rootPId || rootPId === null) {
rootNodes.push(node);
}
});
return rootNodes;
}
/**
* 将 `treeData` 或 `children` 转换为格式化的 `treeData`。
* 如果 `treeData` 或 `children` 没有变化,则不会重新计算。
*/
function useTreeData(treeData, children, simpleMode) {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (treeData) {
if (simpleMode) {
const config = {
id: 'id',
pId: 'pId',
rootPId: null,
...(typeof simpleMode === 'object' ? simpleMode : {})
};
return buildTreeStructure(treeData, config);
}
return treeData;
}
return legacyUtil_convertChildrenToData(children);
}, [children, simpleMode, treeData]);
}
;// ./node_modules/@rc-component/tree-select/es/LegacyContext.js
const LegacySelectContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
/* harmony default export */ var LegacyContext = (LegacySelectContext);
;// ./node_modules/@rc-component/tree-select/es/TreeSelectContext.js
const TreeSelectContext = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext(null);
/* harmony default export */ var es_TreeSelectContext = (TreeSelectContext);
;// ./node_modules/@rc-component/tree-select/es/OptionList.js
function tree_select_es_OptionList_extends() { tree_select_es_OptionList_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return tree_select_es_OptionList_extends.apply(this, arguments); }
const OptionList_HIDDEN_STYLE = {
width: 0,
height: 0,
display: 'flex',
overflow: 'hidden',
opacity: 0,
border: 0,
padding: 0,
margin: 0
};
const OptionList_OptionList = (_, ref) => {
const {
prefixCls,
multiple,
searchValue,
toggleOpen,
open,
notFoundContent
} = useBaseProps();
const {
virtual,
listHeight,
listItemHeight,
listItemScrollOffset,
treeData,
fieldNames,
onSelect,
popupMatchSelectWidth,
treeExpandAction,
treeTitleRender,
onPopupScroll,
leftMaxCount,
leafCountOnly,
valueEntities,
classNames: treeClassNames,
styles
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(es_TreeSelectContext);
const {
checkable,
checkedKeys,
halfCheckedKeys,
treeExpandedKeys,
treeDefaultExpandAll,
treeDefaultExpandedKeys,
onTreeExpand,
treeIcon,
showTreeIcon,
switcherIcon,
treeLine,
treeNodeFilterProp,
loadData,
treeLoadedKeys,
treeMotion,
onTreeLoad,
keyEntities
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(LegacyContext);
const treeRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef();
const memoTreeData = (0,useMemo["default"])(() => treeData,
// eslint-disable-next-line react-hooks/exhaustive-deps
[open, treeData], (prev, next) => next[0] && prev[1] !== next[1]);
// ========================== Values ==========================
const mergedCheckedKeys = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!checkable) {
return null;
}
return {
checked: checkedKeys,
halfChecked: halfCheckedKeys
};
}, [checkable, checkedKeys, halfCheckedKeys]);
// ========================== Scroll ==========================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
// Single mode should scroll to current key
if (open && !multiple && checkedKeys.length) {
treeRef.current?.scrollTo({
key: checkedKeys[0]
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [open]);
// ========================== Events ==========================
const onListMouseDown = event => {
event.preventDefault();
};
const onInternalSelect = (__, info) => {
const {
node
} = info;
if (checkable && valueUtil_isCheckDisabled(node)) {
return;
}
onSelect(node.key, {
selected: !checkedKeys.includes(node.key)
});
if (!multiple) {
toggleOpen(false);
}
};
// =========================== Keys ===========================
const [expandedKeys, setExpandedKeys] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(treeDefaultExpandedKeys);
const [searchExpandedKeys, setSearchExpandedKeys] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
const mergedExpandedKeys = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (treeExpandedKeys) {
return [...treeExpandedKeys];
}
return searchValue ? searchExpandedKeys : expandedKeys;
}, [expandedKeys, searchExpandedKeys, treeExpandedKeys, searchValue]);
const onInternalExpand = keys => {
setExpandedKeys(keys);
setSearchExpandedKeys(keys);
if (onTreeExpand) {
onTreeExpand(keys);
}
};
// ========================== Search ==========================
const lowerSearchValue = String(searchValue).toLowerCase();
const filterTreeNode = treeNode => {
if (!lowerSearchValue) {
return false;
}
return String(treeNode[treeNodeFilterProp]).toLowerCase().includes(lowerSearchValue);
};
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (searchValue) {
setSearchExpandedKeys(getAllKeys(treeData, fieldNames));
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [searchValue]);
// ========================= Disabled =========================
// Cache disabled states in React state to ensure re-render when cache updates
const [disabledCache, setDisabledCache] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(() => new Map());
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (leftMaxCount) {
setDisabledCache(new Map());
}
}, [leftMaxCount]);
function getDisabledWithCache(node) {
const value = node[fieldNames.value];
if (!disabledCache.has(value)) {
const entity = valueEntities.get(value);
const isLeaf = (entity.children || []).length === 0;
if (!isLeaf) {
const checkableChildren = entity.children.filter(childTreeNode => !childTreeNode.node.disabled && !childTreeNode.node.disableCheckbox && !checkedKeys.includes(childTreeNode.node[fieldNames.value]));
const checkableChildrenCount = checkableChildren.length;
disabledCache.set(value, checkableChildrenCount > leftMaxCount);
} else {
disabledCache.set(value, false);
}
}
return disabledCache.get(value);
}
const nodeDisabled = (0,es.useEvent)(node => {
const nodeValue = node[fieldNames.value];
if (checkedKeys.includes(nodeValue)) {
return false;
}
if (leftMaxCount === null) {
return false;
}
if (leftMaxCount <= 0) {
return true;
}
// This is a low performance calculation
if (leafCountOnly && leftMaxCount) {
return getDisabledWithCache(node);
}
return false;
});
// ========================== Get First Selectable Node ==========================
const getFirstMatchingNode = nodes => {
for (const node of nodes) {
if (node.disabled || node.selectable === false) {
continue;
}
if (searchValue) {
if (filterTreeNode(node)) {
return node;
}
} else {
return node;
}
if (node[fieldNames.children]) {
const matchInChildren = getFirstMatchingNode(node[fieldNames.children]);
if (matchInChildren) {
return matchInChildren;
}
}
}
return null;
};
// ========================== Active ==========================
const [activeKey, setActiveKey] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
const activeEntity = keyEntities[activeKey];
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (!open) {
return;
}
let nextActiveKey = null;
const getFirstNode = () => {
const firstNode = getFirstMatchingNode(memoTreeData);
return firstNode ? firstNode[fieldNames.value] : null;
};
// single mode active first checked node
if (!multiple && checkedKeys.length && !searchValue) {
nextActiveKey = checkedKeys[0];
} else {
nextActiveKey = getFirstNode();
}
setActiveKey(nextActiveKey);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [open, searchValue]);
// ========================= Keyboard =========================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
scrollTo: treeRef.current?.scrollTo,
onKeyDown: event => {
const {
which
} = event;
switch (which) {
// >>> Arrow keys
case KeyCode["default"].UP:
case KeyCode["default"].DOWN:
case KeyCode["default"].LEFT:
case KeyCode["default"].RIGHT:
treeRef.current?.onKeyDown(event);
break;
// >>> Select item
case KeyCode["default"].ENTER:
{
if (activeEntity) {
const isNodeDisabled = nodeDisabled(activeEntity.node);
const {
selectable,
value,
disabled
} = activeEntity?.node || {};
if (selectable !== false && !disabled && !isNodeDisabled) {
onInternalSelect(null, {
node: {
key: activeKey
},
selected: !checkedKeys.includes(value)
});
}
}
break;
}
// >>> Close
case KeyCode["default"].ESC:
{
toggleOpen(false);
}
}
},
onKeyUp: () => {}
}));
const hasLoadDataFn = (0,useMemo["default"])(() => searchValue ? false : true,
// eslint-disable-next-line react-hooks/exhaustive-deps
[searchValue, treeExpandedKeys || expandedKeys], ([preSearchValue], [nextSearchValue, nextExcludeSearchExpandedKeys]) => preSearchValue !== nextSearchValue && !!(nextSearchValue || nextExcludeSearchExpandedKeys));
const syncLoadData = hasLoadDataFn ? loadData : null;
// ========================== Render ==========================
if (memoTreeData.length === 0) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
role: "listbox",
className: `${prefixCls}-empty`,
onMouseDown: onListMouseDown
}, notFoundContent);
}
const treeProps = {
fieldNames
};
if (treeLoadedKeys) {
treeProps.loadedKeys = treeLoadedKeys;
}
if (mergedExpandedKeys) {
treeProps.expandedKeys = mergedExpandedKeys;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
onMouseDown: onListMouseDown
}, activeEntity && open && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
style: OptionList_HIDDEN_STYLE,
"aria-live": "assertive"
}, activeEntity.node.value), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(contextTypes_UnstableContext.Provider, {
value: {
nodeDisabled
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(tree_es, tree_select_es_OptionList_extends({
classNames: treeClassNames?.popup,
styles: styles?.popup,
ref: treeRef,
focusable: false,
prefixCls: `${prefixCls}-tree`,
treeData: memoTreeData,
height: listHeight,
itemHeight: listItemHeight,
itemScrollOffset: listItemScrollOffset,
virtual: virtual !== false && popupMatchSelectWidth !== false,
multiple: multiple,
icon: treeIcon,
showIcon: showTreeIcon,
switcherIcon: switcherIcon,
showLine: treeLine,
loadData: syncLoadData,
motion: treeMotion,
activeKey: activeKey
// We handle keys by out instead tree self
,
checkable: checkable,
checkStrictly: true,
checkedKeys: mergedCheckedKeys,
selectedKeys: !checkable ? checkedKeys : [],
defaultExpandAll: treeDefaultExpandAll,
titleRender: treeTitleRender
}, treeProps, {
// Proxy event out
onActiveChange: setActiveKey,
onSelect: onInternalSelect,
onCheck: onInternalSelect,
onExpand: onInternalExpand,
onLoad: onTreeLoad,
filterTreeNode: filterTreeNode,
expandAction: treeExpandAction,
onScroll: onPopupScroll
}))));
};
const es_OptionList_RefOptionList = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(OptionList_OptionList);
if (true) {
es_OptionList_RefOptionList.displayName = 'OptionList';
}
/* harmony default export */ var tree_select_es_OptionList = (es_OptionList_RefOptionList);
;// ./node_modules/@rc-component/tree-select/es/utils/strategyUtil.js
const SHOW_ALL = 'SHOW_ALL';
const strategyUtil_SHOW_PARENT = 'SHOW_PARENT';
const strategyUtil_SHOW_CHILD = 'SHOW_CHILD';
function strategyUtil_formatStrategyValues(values, strategy, keyEntities, fieldNames) {
const valueSet = new Set(values);
if (strategy === strategyUtil_SHOW_CHILD) {
return values.filter(key => {
const entity = keyEntities[key];
return !entity || !entity.children || !entity.children.some(({
node
}) => valueSet.has(node[fieldNames.value])) || !entity.children.every(({
node
}) => valueUtil_isCheckDisabled(node) || valueSet.has(node[fieldNames.value]));
});
}
if (strategy === strategyUtil_SHOW_PARENT) {
return values.filter(key => {
const entity = keyEntities[key];
const parent = entity ? entity.parent : null;
return !parent || valueUtil_isCheckDisabled(parent.node) || !valueSet.has(parent.key);
});
}
return values;
}
;// ./node_modules/@rc-component/tree-select/es/utils/warningPropsUtil.js
function warningPropsUtil_warningProps(props) {
const {
searchPlaceholder,
treeCheckStrictly,
treeCheckable,
labelInValue,
value,
multiple,
showCheckedStrategy,
maxCount
} = props;
(0,warning["default"])(!searchPlaceholder, '`searchPlaceholder` has been removed.');
if (treeCheckStrictly && labelInValue === false) {
(0,warning["default"])(false, '`treeCheckStrictly` will force set `labelInValue` to `true`.');
}
if (labelInValue || treeCheckStrictly) {
(0,warning["default"])(utils_valueUtil_toArray(value).every(val => val && typeof val === 'object' && 'value' in val), 'Invalid prop `value` supplied to `TreeSelect`. You should use { label: string, value: string | number } or [{ label: string, value: string | number }] instead.');
}
if (treeCheckStrictly || multiple || treeCheckable) {
(0,warning["default"])(!value || Array.isArray(value), '`value` should be an array when `TreeSelect` is checkable or multiple.');
} else {
(0,warning["default"])(!Array.isArray(value), '`value` should not be array when `TreeSelect` is single mode.');
}
if (maxCount && (showCheckedStrategy === 'SHOW_ALL' && !treeCheckStrictly || showCheckedStrategy === 'SHOW_PARENT')) {
(0,warning["default"])(false, '`maxCount` not work with `showCheckedStrategy=SHOW_ALL` (when `treeCheckStrictly=false`) or `showCheckedStrategy=SHOW_PARENT`.');
}
}
/* harmony default export */ var utils_warningPropsUtil = (warningPropsUtil_warningProps);
;// ./node_modules/@rc-component/tree-select/es/hooks/useSearchConfig.js
// Convert `showSearch` to unique config
function hooks_useSearchConfig_useSearchConfig(showSearch, props) {
const {
searchValue,
inputValue,
onSearch,
autoClearSearchValue,
filterTreeNode,
treeNodeFilterProp
} = props;
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const isObject = typeof showSearch === 'object';
const searchConfig = {
searchValue: searchValue ?? inputValue,
onSearch,
autoClearSearchValue,
filterTreeNode,
treeNodeFilterProp,
...(isObject ? showSearch : {})
};
return [isObject ? true : showSearch, searchConfig];
}, [showSearch, searchValue, inputValue, onSearch, autoClearSearchValue, filterTreeNode, treeNodeFilterProp]);
}
;// ./node_modules/@rc-component/tree-select/es/TreeSelect.js
function TreeSelect_extends() { TreeSelect_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return TreeSelect_extends.apply(this, arguments); }
function TreeSelect_isRawValue(value) {
return !value || typeof value !== 'object';
}
const TreeSelect = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
id,
prefixCls = 'rc-tree-select',
// Value
value,
defaultValue,
onChange,
onSelect,
onDeselect,
// Search
showSearch,
searchValue: legacySearchValue,
inputValue: legacyinputValue,
onSearch: legacyOnSearch,
autoClearSearchValue: legacyAutoClearSearchValue,
filterTreeNode: legacyFilterTreeNode,
treeNodeFilterProp: legacytreeNodeFilterProp,
// Selector
showCheckedStrategy,
treeNodeLabelProp,
// Mode
multiple,
treeCheckable,
treeCheckStrictly,
labelInValue,
maxCount,
// FieldNames
fieldNames,
// Data
treeDataSimpleMode,
treeData,
children,
loadData,
treeLoadedKeys,
onTreeLoad,
// Expanded
treeDefaultExpandAll,
treeExpandedKeys,
treeDefaultExpandedKeys,
onTreeExpand,
treeExpandAction,
// Options
virtual,
listHeight = 200,
listItemHeight = 20,
listItemScrollOffset = 0,
onPopupVisibleChange,
popupMatchSelectWidth = true,
// Tree
treeLine,
treeIcon,
showTreeIcon,
switcherIcon,
treeMotion,
treeTitleRender,
onPopupScroll,
classNames: treeSelectClassNames,
styles,
...restProps
} = props;
const mergedId = useId(id);
const treeConduction = treeCheckable && !treeCheckStrictly;
const mergedCheckable = treeCheckable || treeCheckStrictly;
const mergedLabelInValue = treeCheckStrictly || labelInValue;
const mergedMultiple = mergedCheckable || multiple;
const searchProps = {
searchValue: legacySearchValue,
inputValue: legacyinputValue,
onSearch: legacyOnSearch,
autoClearSearchValue: legacyAutoClearSearchValue,
filterTreeNode: legacyFilterTreeNode,
treeNodeFilterProp: legacytreeNodeFilterProp
};
const [mergedShowSearch, searchConfig] = hooks_useSearchConfig_useSearchConfig(showSearch, searchProps);
const {
searchValue,
onSearch,
autoClearSearchValue = true,
filterTreeNode,
treeNodeFilterProp = 'value'
} = searchConfig;
const [internalValue, setInternalValue] = (0,useControlledState["default"])(defaultValue, value);
// `multiple` && `!treeCheckable` should be show all
const mergedShowCheckedStrategy = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!treeCheckable) {
return SHOW_ALL;
}
return showCheckedStrategy || strategyUtil_SHOW_CHILD;
}, [showCheckedStrategy, treeCheckable]);
// ========================== Warning ===========================
if (true) {
utils_warningPropsUtil(props);
}
// ========================= FieldNames =========================
const mergedFieldNames = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => valueUtil_fillFieldNames(fieldNames), /* eslint-disable react-hooks/exhaustive-deps */
[JSON.stringify(fieldNames)]
/* eslint-enable react-hooks/exhaustive-deps */);
// =========================== Search ===========================
const [internalSearchValue, setSearchValue] = (0,useControlledState["default"])('', searchValue);
const mergedSearchValue = internalSearchValue || '';
const onInternalSearch = searchText => {
setSearchValue(searchText);
onSearch?.(searchText);
};
// ============================ Data ============================
// `useTreeData` only do convert of `children` or `simpleMode`.
// Else will return origin `treeData` for perf consideration.
// Do not do anything to loop the data.
const mergedTreeData = useTreeData(treeData, children, treeDataSimpleMode);
const {
keyEntities,
valueEntities
} = useDataEntities(mergedTreeData, mergedFieldNames);
/** Get `missingRawValues` which not exist in the tree yet */
const splitRawValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(newRawValues => {
const missingRawValues = [];
const existRawValues = [];
// Keep missing value in the cache
newRawValues.forEach(val => {
if (valueEntities.has(val)) {
existRawValues.push(val);
} else {
missingRawValues.push(val);
}
});
return {
missingRawValues,
existRawValues
};
}, [valueEntities]);
// Filtered Tree
const filteredTreeData = hooks_useFilterTreeData(mergedTreeData, mergedSearchValue, {
fieldNames: mergedFieldNames,
treeNodeFilterProp,
filterTreeNode
});
// =========================== Label ============================
const getLabel = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(item => {
if (item) {
if (treeNodeLabelProp) {
return item[treeNodeLabelProp];
}
// Loop from fieldNames
const {
_title: titleList
} = mergedFieldNames;
for (let i = 0; i < titleList.length; i += 1) {
const title = item[titleList[i]];
if (title !== undefined) {
return title;
}
}
}
}, [mergedFieldNames, treeNodeLabelProp]);
// ========================= Wrap Value =========================
const toLabeledValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(draftValues => {
const values = utils_valueUtil_toArray(draftValues);
return values.map(val => {
if (TreeSelect_isRawValue(val)) {
return {
value: val
};
}
return val;
});
}, []);
const convert2LabelValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(draftValues => {
const values = toLabeledValues(draftValues);
return values.map(item => {
let {
label: rawLabel
} = item;
const {
value: rawValue,
halfChecked: rawHalfChecked
} = item;
let rawDisabled;
const entity = valueEntities.get(rawValue);
// Fill missing label & status
if (entity) {
rawLabel = treeTitleRender ? treeTitleRender(entity.node) : rawLabel ?? getLabel(entity.node);
rawDisabled = entity.node.disabled;
} else if (rawLabel === undefined) {
// We try to find in current `labelInValue` value
const labelInValueItem = toLabeledValues(internalValue).find(labeledItem => labeledItem.value === rawValue);
rawLabel = labelInValueItem.label;
}
return {
label: rawLabel,
value: rawValue,
halfChecked: rawHalfChecked,
disabled: rawDisabled
};
});
}, [valueEntities, getLabel, toLabeledValues, internalValue]);
// =========================== Values ===========================
const rawMixedLabeledValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => toLabeledValues(internalValue === null ? [] : internalValue), [toLabeledValues, internalValue]);
// Split value into full check and half check
const [rawLabeledValues, rawHalfLabeledValues] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const fullCheckValues = [];
const halfCheckValues = [];
rawMixedLabeledValues.forEach(item => {
if (item.halfChecked) {
halfCheckValues.push(item);
} else {
fullCheckValues.push(item);
}
});
return [fullCheckValues, halfCheckValues];
}, [rawMixedLabeledValues]);
// const [mergedValues] = useCache(rawLabeledValues);
const rawValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => rawLabeledValues.map(item => item.value), [rawLabeledValues]);
// Convert value to key. Will fill missed keys for conduct check.
const [rawCheckedValues, rawHalfCheckedValues] = hooks_useCheckedKeys(rawLabeledValues, rawHalfLabeledValues, treeConduction, keyEntities);
// Convert rawCheckedKeys to check strategy related values
const displayValues = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
// Collect keys which need to show
const displayKeys = strategyUtil_formatStrategyValues(rawCheckedValues, mergedShowCheckedStrategy, keyEntities, mergedFieldNames);
// Convert to value and filled with label
const values = displayKeys.map(key => keyEntities[key]?.node?.[mergedFieldNames.value] ?? key);
// Back fill with origin label
const labeledValues = values.map(val => {
const targetItem = rawLabeledValues.find(item => item.value === val);
const label = labelInValue ? targetItem?.label : treeTitleRender?.(targetItem);
return {
value: val,
label
};
});
const rawDisplayValues = convert2LabelValues(labeledValues);
const firstVal = rawDisplayValues[0];
if (!mergedMultiple && firstVal && isNil(firstVal.value) && isNil(firstVal.label)) {
return [];
}
return rawDisplayValues.map(item => ({
...item,
label: item.label ?? item.value
}));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [mergedFieldNames, mergedMultiple, rawCheckedValues, rawLabeledValues, convert2LabelValues, mergedShowCheckedStrategy, keyEntities]);
const [cachedDisplayValues] = hooks_useCache(displayValues);
// ========================== MaxCount ==========================
const mergedMaxCount = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (mergedMultiple && (mergedShowCheckedStrategy === 'SHOW_CHILD' || treeCheckStrictly || !treeCheckable)) {
return maxCount;
}
return null;
}, [maxCount, mergedMultiple, treeCheckStrictly, mergedShowCheckedStrategy, treeCheckable]);
// =========================== Change ===========================
const triggerChange = useRefFunc_useRefFunc((newRawValues, extra, source) => {
const formattedKeyList = strategyUtil_formatStrategyValues(newRawValues, mergedShowCheckedStrategy, keyEntities, mergedFieldNames);
// Not allow pass with `maxCount`
if (mergedMaxCount && formattedKeyList.length > mergedMaxCount) {
return;
}
const labeledValues = convert2LabelValues(newRawValues);
setInternalValue(labeledValues);
// Clean up if needed
if (autoClearSearchValue) {
setSearchValue('');
}
// Generate rest parameters is costly, so only do it when necessary
if (onChange) {
let eventValues = newRawValues;
if (treeConduction) {
eventValues = formattedKeyList.map(key => {
const entity = valueEntities.get(key);
return entity ? entity.node[mergedFieldNames.value] : key;
});
}
const {
triggerValue,
selected
} = extra || {
triggerValue: undefined,
selected: undefined
};
let returnRawValues = eventValues;
// We need fill half check back
if (treeCheckStrictly) {
const halfValues = rawHalfLabeledValues.filter(item => !eventValues.includes(item.value));
returnRawValues = [...returnRawValues, ...halfValues];
}
const returnLabeledValues = convert2LabelValues(returnRawValues);
const additionalInfo = {
// [Legacy] Always return as array contains label & value
preValue: rawLabeledValues,
triggerValue
};
// [Legacy] Fill legacy data if user query.
// This is expansive that we only fill when user query
// https://github.com/react-component/tree-select/blob/fe33eb7c27830c9ac70cd1fdb1ebbe7bc679c16a/src/Select.jsx
let showPosition = true;
if (treeCheckStrictly || source === 'selection' && !selected) {
showPosition = false;
}
fillAdditionalInfo(additionalInfo, triggerValue, newRawValues, mergedTreeData, showPosition, mergedFieldNames);
if (mergedCheckable) {
additionalInfo.checked = selected;
} else {
additionalInfo.selected = selected;
}
const returnValues = mergedLabelInValue ? returnLabeledValues : returnLabeledValues.map(item => item.value);
onChange(mergedMultiple ? returnValues : returnValues[0], mergedLabelInValue ? null : returnLabeledValues.map(item => item.label), additionalInfo);
}
});
// ========================== Options ===========================
/** Trigger by option list */
const onOptionSelect = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback((selectedKey, {
selected,
source
}) => {
const entity = keyEntities[selectedKey];
const node = entity?.node;
const selectedValue = node?.[mergedFieldNames.value] ?? selectedKey;
// Never be falsy but keep it safe
if (!mergedMultiple) {
// Single mode always set value
triggerChange([selectedValue], {
selected: true,
triggerValue: selectedValue
}, 'option');
} else {
let newRawValues = selected ? [...rawValues, selectedValue] : rawCheckedValues.filter(v => v !== selectedValue);
// Add keys if tree conduction
if (treeConduction) {
// Should keep missing values
const {
missingRawValues,
existRawValues
} = splitRawValues(newRawValues);
const keyList = existRawValues.map(val => valueEntities.get(val).key);
// Conduction by selected or not
let checkedKeys;
if (selected) {
({
checkedKeys
} = conductCheck(keyList, true, keyEntities));
} else {
({
checkedKeys
} = conductCheck(keyList, {
checked: false,
halfCheckedKeys: rawHalfCheckedValues
}, keyEntities));
}
// Fill back of keys
newRawValues = [...missingRawValues, ...checkedKeys.map(key => keyEntities[key].node[mergedFieldNames.value])];
}
triggerChange(newRawValues, {
selected,
triggerValue: selectedValue
}, source || 'option');
}
// Trigger select event
if (selected || !mergedMultiple) {
onSelect?.(selectedValue, fillLegacyProps(node));
} else {
onDeselect?.(selectedValue, fillLegacyProps(node));
}
}, [splitRawValues, valueEntities, keyEntities, mergedFieldNames, mergedMultiple, rawValues, triggerChange, treeConduction, onSelect, onDeselect, rawCheckedValues, rawHalfCheckedValues, maxCount]);
// ========================== Dropdown ==========================
const onInternalPopupVisibleChange = external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback(open => {
if (onPopupVisibleChange) {
onPopupVisibleChange(open);
}
}, [onPopupVisibleChange]);
// ====================== Display Change ========================
const onDisplayValuesChange = useRefFunc_useRefFunc((newValues, info) => {
const newRawValues = newValues.map(item => item.value);
if (info.type === 'clear') {
triggerChange(newRawValues, {}, 'selection');
return;
}
// TreeSelect only have multiple mode which means display change only has remove
if (info.values.length) {
onOptionSelect(info.values[0].value, {
selected: false,
source: 'selection'
});
}
});
// ========================== Context ===========================
const treeSelectContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
return {
virtual,
popupMatchSelectWidth,
listHeight,
listItemHeight,
listItemScrollOffset,
treeData: filteredTreeData,
fieldNames: mergedFieldNames,
onSelect: onOptionSelect,
treeExpandAction,
treeTitleRender,
onPopupScroll,
leftMaxCount: maxCount === undefined ? null : maxCount - cachedDisplayValues.length,
leafCountOnly: mergedShowCheckedStrategy === 'SHOW_CHILD' && !treeCheckStrictly && !!treeCheckable,
valueEntities,
classNames: treeSelectClassNames,
styles
};
}, [virtual, popupMatchSelectWidth, listHeight, listItemHeight, listItemScrollOffset, filteredTreeData, mergedFieldNames, onOptionSelect, treeExpandAction, treeTitleRender, onPopupScroll, maxCount, cachedDisplayValues.length, mergedShowCheckedStrategy, treeCheckStrictly, treeCheckable, valueEntities, treeSelectClassNames, styles]);
// ======================= Legacy Context =======================
const legacyContext = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => ({
checkable: mergedCheckable,
loadData,
treeLoadedKeys,
onTreeLoad,
checkedKeys: rawCheckedValues,
halfCheckedKeys: rawHalfCheckedValues,
treeDefaultExpandAll,
treeExpandedKeys,
treeDefaultExpandedKeys,
onTreeExpand,
treeIcon,
treeMotion,
showTreeIcon,
switcherIcon,
treeLine,
treeNodeFilterProp,
keyEntities
}), [mergedCheckable, loadData, treeLoadedKeys, onTreeLoad, rawCheckedValues, rawHalfCheckedValues, treeDefaultExpandAll, treeExpandedKeys, treeDefaultExpandedKeys, onTreeExpand, treeIcon, treeMotion, showTreeIcon, switcherIcon, treeLine, treeNodeFilterProp, keyEntities]);
// =========================== Render ===========================
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_TreeSelectContext.Provider, {
value: treeSelectContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(LegacyContext.Provider, {
value: legacyContext
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(es_BaseSelect, TreeSelect_extends({
ref: ref
}, restProps, {
classNames: treeSelectClassNames,
styles: styles
// >>> MISC
,
id: mergedId,
prefixCls: prefixCls,
mode: mergedMultiple ? 'multiple' : undefined
// >>> Display Value
,
displayValues: cachedDisplayValues,
onDisplayValuesChange: onDisplayValuesChange
// >>> Search
,
autoClearSearchValue: autoClearSearchValue,
showSearch: mergedShowSearch,
searchValue: mergedSearchValue,
onSearch: onInternalSearch
// >>> Options
,
OptionList: tree_select_es_OptionList,
emptyOptions: !mergedTreeData.length,
onPopupVisibleChange: onInternalPopupVisibleChange,
popupMatchSelectWidth: popupMatchSelectWidth
}))));
});
// Assign name for Debug
if (true) {
TreeSelect.displayName = 'TreeSelect';
}
const GenericTreeSelect = TreeSelect;
GenericTreeSelect.TreeNode = tree_select_es_TreeNode;
GenericTreeSelect.SHOW_ALL = SHOW_ALL;
GenericTreeSelect.SHOW_PARENT = strategyUtil_SHOW_PARENT;
GenericTreeSelect.SHOW_CHILD = strategyUtil_SHOW_CHILD;
/* harmony default export */ var es_TreeSelect = (GenericTreeSelect);
;// ./node_modules/@rc-component/tree-select/es/index.js
/* harmony default export */ var tree_select_es = (es_TreeSelect);
// EXTERNAL MODULE: ./components/tree-select/style/index.ts
var tree_select_style = __webpack_require__("./components/tree-select/style/index.ts");
;// ./components/tree-select/index.tsx
const InternalTreeSelect = (props, ref) => {
const {
prefixCls: customizePrefixCls,
size: customizeSize,
disabled: customDisabled,
bordered = true,
style,
className,
rootClassName,
treeCheckable,
multiple,
listHeight = 256,
listItemHeight: customListItemHeight,
placement,
notFoundContent,
switcherIcon: customSwitcherIcon,
treeLine,
getPopupContainer,
popupClassName,
dropdownClassName,
treeIcon = false,
transitionName,
choiceTransitionName = '',
status: customStatus,
treeExpandAction,
builtinPlacements,
dropdownMatchSelectWidth,
popupMatchSelectWidth,
allowClear,
variant: customVariant,
dropdownStyle: _dropdownStyle,
dropdownRender,
popupRender,
onDropdownVisibleChange,
onOpenChange,
tagRender,
maxCount,
showCheckedStrategy,
treeCheckStrictly,
styles,
classNames,
...restProps
} = props;
const {
getPrefixCls,
getPopupContainer: getContextPopupContainer,
direction,
styles: contextStyles,
classNames: contextClassNames,
switcherIcon
} = (0,config_provider_context.useComponentConfig)('treeSelect');
const {
renderEmpty,
virtual,
popupMatchSelectWidth: contextPopupMatchSelectWidth,
popupOverflow
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const [, token] = (0,useToken["default"])();
const listItemHeight = customListItemHeight ?? token?.controlHeightSM + token?.paddingXXS;
if (true) {
const warning = (0,_util_warning.devUseWarning)('TreeSelect');
const deprecatedProps = {
dropdownMatchSelectWidth: 'popupMatchSelectWidth',
dropdownStyle: 'styles.popup.root',
dropdownClassName: 'classNames.popup.root',
popupClassName: 'classNames.popup.root',
dropdownRender: 'popupRender',
onDropdownVisibleChange: 'onOpenChange',
bordered: 'variant'
};
Object.entries(deprecatedProps).forEach(([oldProp, newProp]) => {
warning.deprecated(!(oldProp in props), oldProp, newProp);
});
true ? warning(multiple !== false || !treeCheckable, 'usage', '`multiple` will always be `true` when `treeCheckable` is true') : 0;
true ? warning(!('showArrow' in props), 'deprecated', '`showArrow` is deprecated which will be removed in next major version. It will be a default behavior, you can hide it by setting `suffixIcon` to null.') : 0;
}
const rootPrefixCls = getPrefixCls();
const prefixCls = getPrefixCls('select', customizePrefixCls);
const treePrefixCls = getPrefixCls('select-tree', customizePrefixCls);
const treeSelectPrefixCls = getPrefixCls('tree-select', customizePrefixCls);
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
const rootCls = hooks_useCSSVarCls(prefixCls);
const treeSelectRootCls = hooks_useCSSVarCls(treeSelectPrefixCls);
const [hashId, cssVarCls] = (0,select_style["default"])(prefixCls, rootCls);
(0,tree_select_style["default"])(treeSelectPrefixCls, treePrefixCls, treeSelectRootCls);
const [variant, enableVariantCls] = useVariants('treeSelect', customVariant, bordered);
// ===================== Size =====================
const mergedSize = (0,useSize["default"])(ctx => customizeSize ?? compactSize ?? ctx);
// ===================== Disabled =====================
const disabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
const mergedDisabled = customDisabled ?? disabled;
// ===================== Form =====================
const {
status: contextStatus,
hasFeedback,
isFormItemInput,
feedbackIcon
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(FormItemInputContext);
const mergedStatus = getMergedStatus(contextStatus, customStatus);
// =========== Merged Props for Semantic ===========
const mergedProps = {
...props,
size: mergedSize,
disabled: mergedDisabled,
status: mergedStatus,
variant
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
}, {
popup: {
_default: 'root'
}
});
const mergedPopupClassName = (0,clsx.clsx)(popupClassName || dropdownClassName, `${treeSelectPrefixCls}-dropdown`, {
[`${treeSelectPrefixCls}-dropdown-rtl`]: direction === 'rtl'
}, rootClassName, mergedClassNames.root, mergedClassNames.popup?.root, cssVarCls, rootCls, treeSelectRootCls, hashId);
const mergedPopupRender = select_usePopupRender(popupRender || dropdownRender);
const mergedOnOpenChange = onOpenChange || onDropdownVisibleChange;
const isMultiple = !!(treeCheckable || multiple);
const mergedMaxCount = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (maxCount && (showCheckedStrategy === 'SHOW_ALL' && !treeCheckStrictly || showCheckedStrategy === 'SHOW_PARENT')) {
return undefined;
}
return maxCount;
}, [maxCount, showCheckedStrategy, treeCheckStrictly]);
const showSuffixIcon = useShowArrow(props.suffixIcon, props.showArrow);
const mergedPopupMatchSelectWidth = popupMatchSelectWidth ?? dropdownMatchSelectWidth ?? contextPopupMatchSelectWidth;
// ===================== Icons =====================
const {
suffixIcon,
removeIcon,
clearIcon
} = useIcons({
...restProps,
multiple: isMultiple,
showSuffixIcon,
hasFeedback,
feedbackIcon,
prefixCls,
componentName: 'TreeSelect'
});
const mergedAllowClear = allowClear === true ? {
clearIcon
} : allowClear;
// ===================== Empty =====================
let mergedNotFound;
if (notFoundContent !== undefined) {
mergedNotFound = notFoundContent;
} else {
mergedNotFound = renderEmpty?.('Select') || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(defaultRenderEmpty, {
componentName: "Select"
});
}
// ==================== Render =====================
const selectProps = (0,es.omit)(restProps, ['suffixIcon', 'removeIcon', 'clearIcon']);
// ===================== Placement =====================
const memoizedPlacement = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (placement !== undefined) {
return placement;
}
return direction === 'rtl' ? 'bottomRight' : 'bottomLeft';
}, [placement, direction]);
const mergedClassName = (0,clsx.clsx)(!customizePrefixCls && treeSelectPrefixCls, {
[`${prefixCls}-lg`]: mergedSize === 'large',
[`${prefixCls}-sm`]: mergedSize === 'small',
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-${variant}`]: enableVariantCls,
[`${prefixCls}-in-form-item`]: isFormItemInput
}, getStatusClassNames(prefixCls, mergedStatus, hasFeedback), compactItemClassnames, className, rootClassName, mergedClassNames?.root, cssVarCls, rootCls, treeSelectRootCls, hashId);
const mergedSwitcherIcon = customSwitcherIcon ?? switcherIcon;
const renderSwitcherIcon = nodeProps => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(iconUtil, {
prefixCls: treePrefixCls,
switcherIcon: mergedSwitcherIcon,
treeNodeProps: nodeProps,
showLine: treeLine
}));
// ============================ zIndex ============================
const [zIndex] = (0,useZIndex.useZIndex)('SelectLike', mergedStyles.popup?.root?.zIndex);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(tree_select_es, {
classNames: mergedClassNames,
styles: mergedStyles,
virtual: virtual,
disabled: mergedDisabled,
...selectProps,
popupMatchSelectWidth: mergedPopupMatchSelectWidth,
builtinPlacements: select_mergedBuiltinPlacements(builtinPlacements, popupOverflow),
ref: ref,
prefixCls: prefixCls,
className: mergedClassName,
style: {
...mergedStyles?.root,
...style
},
listHeight: listHeight,
listItemHeight: listItemHeight,
treeCheckable: treeCheckable ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-tree-checkbox-inner`
}) : treeCheckable,
treeLine: !!treeLine,
suffixIcon: suffixIcon,
multiple: isMultiple,
placement: memoizedPlacement,
removeIcon: removeIcon,
allowClear: mergedAllowClear,
switcherIcon: renderSwitcherIcon,
showTreeIcon: treeIcon,
notFoundContent: mergedNotFound,
getPopupContainer: getPopupContainer || getContextPopupContainer,
treeMotion: null,
popupClassName: mergedPopupClassName,
popupStyle: {
...mergedStyles.root,
...mergedStyles.popup?.root,
zIndex
},
popupRender: mergedPopupRender,
onPopupVisibleChange: mergedOnOpenChange,
choiceTransitionName: (0,_util_motion.getTransitionName)(rootPrefixCls, '', choiceTransitionName),
transitionName: (0,_util_motion.getTransitionName)(rootPrefixCls, 'slide-up', transitionName),
treeExpandAction: treeExpandAction,
tagRender: isMultiple ? tagRender : undefined,
maxCount: mergedMaxCount,
showCheckedStrategy: showCheckedStrategy,
treeCheckStrictly: treeCheckStrictly
});
};
const TreeSelectRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(InternalTreeSelect);
const tree_select_TreeSelect = TreeSelectRef;
// We don't care debug panel
/* istanbul ignore next */
const tree_select_PurePanel = _util_PurePanel(tree_select_TreeSelect, 'popupAlign', props => (0,es.omit)(props, ['visible']));
tree_select_TreeSelect.TreeNode = tree_select_es_TreeNode;
tree_select_TreeSelect.SHOW_ALL = SHOW_ALL;
tree_select_TreeSelect.SHOW_PARENT = strategyUtil_SHOW_PARENT;
tree_select_TreeSelect.SHOW_CHILD = strategyUtil_SHOW_CHILD;
tree_select_TreeSelect._InternalPanelDoNotUseOrYouWillBeFired = tree_select_PurePanel;
if (true) {
tree_select_TreeSelect.displayName = 'TreeSelect';
}
/* harmony default export */ var tree_select = (tree_select_TreeSelect);
;// ./node_modules/@ant-design/icons-svg/es/asn/EditOutlined.js
// This icon file is generated automatically.
var EditOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z" } }] }, "name": "edit", "theme": "outlined" };
/* harmony default export */ var asn_EditOutlined = (EditOutlined);
;// ./node_modules/@ant-design/icons/es/icons/EditOutlined.js
function EditOutlined_extends() { EditOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return EditOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const EditOutlined_EditOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], EditOutlined_extends({}, props, {
ref: ref,
icon: asn_EditOutlined
}));
/** */
const EditOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(EditOutlined_EditOutlined);
if (true) {
EditOutlined_RefIcon.displayName = 'EditOutlined';
}
/* harmony default export */ var icons_EditOutlined = (EditOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/EnterOutlined.js
// This icon file is generated automatically.
var EnterOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 000 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z" } }] }, "name": "enter", "theme": "outlined" };
/* harmony default export */ var asn_EnterOutlined = (EnterOutlined);
;// ./node_modules/@ant-design/icons/es/icons/EnterOutlined.js
function EnterOutlined_extends() { EnterOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return EnterOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const EnterOutlined_EnterOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], EnterOutlined_extends({}, props, {
ref: ref,
icon: asn_EnterOutlined
}));
/** */
const EnterOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(EnterOutlined_EnterOutlined);
if (true) {
EnterOutlined_RefIcon.displayName = 'EnterOutlined';
}
/* harmony default export */ var icons_EnterOutlined = (EnterOutlined_RefIcon);
// EXTERNAL MODULE: ./components/typography/style/index.ts + 1 modules
var typography_style = __webpack_require__("./components/typography/style/index.ts");
;// ./components/typography/Editable.tsx
const Editable = props => {
const {
prefixCls,
'aria-label': ariaLabel,
className,
style,
direction,
maxLength,
autoSize = true,
value,
onSave,
onCancel,
onEnd,
component,
enterIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_EnterOutlined, null)
} = props;
const ref = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const inCompositionRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(false);
const lastKeyCodeRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const [current, setCurrent] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(value);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
setCurrent(value);
}, [value]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (ref.current?.resizableTextArea) {
const {
textArea
} = ref.current.resizableTextArea;
textArea.focus();
const {
length
} = textArea.value;
textArea.setSelectionRange(length, length);
}
}, []);
const onChange = ({
target
}) => {
setCurrent(target.value.replace(/[\n\r]/g, ''));
};
const onCompositionStart = () => {
inCompositionRef.current = true;
};
const onCompositionEnd = () => {
inCompositionRef.current = false;
};
const onKeyDown = ({
keyCode
}) => {
// We don't record keyCode when IME is using
if (inCompositionRef.current) {
return;
}
lastKeyCodeRef.current = keyCode;
};
const confirmChange = () => {
onSave(current.trim());
};
const onKeyUp = ({
keyCode,
ctrlKey,
altKey,
metaKey,
shiftKey
}) => {
// Check if it's a real key
if (lastKeyCodeRef.current !== keyCode || inCompositionRef.current || ctrlKey || altKey || metaKey || shiftKey) {
return;
}
if (keyCode === KeyCode["default"].ENTER) {
confirmChange();
onEnd?.();
} else if (keyCode === KeyCode["default"].ESC) {
onCancel();
}
};
const onBlur = () => {
confirmChange();
};
const [hashId, cssVarCls] = (0,typography_style["default"])(prefixCls);
const textAreaClassName = (0,clsx.clsx)(prefixCls, `${prefixCls}-edit-content`, {
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-${component}`]: !!component
}, className, hashId, cssVarCls);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: textAreaClassName,
style: style
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(input_TextArea, {
ref: ref,
maxLength: maxLength,
value: current,
onChange: onChange,
onKeyDown: onKeyDown,
onKeyUp: onKeyUp,
onCompositionStart: onCompositionStart,
onCompositionEnd: onCompositionEnd,
onBlur: onBlur,
"aria-label": ariaLabel,
rows: 1,
autoSize: autoSize
}), enterIcon !== null ? (0,reactNode.cloneElement)(enterIcon, {
className: `${prefixCls}-edit-content-confirm`
}) : null);
};
/* harmony default export */ var typography_Editable = (Editable);
;// ./components/_util/copy.ts
const execCopy = (text, isHtmlFormat) => {
let copySuccess = false;
const onCopy = event => {
event.stopPropagation();
event.preventDefault();
event.clipboardData?.clearData();
event.clipboardData?.setData('text/plain', text);
if (isHtmlFormat) {
event.clipboardData?.setData('text/html', text);
}
copySuccess = true;
};
try {
document.addEventListener('copy', onCopy, {
capture: true
});
document.execCommand('copy');
return copySuccess;
} catch {
return false;
} finally {
document.removeEventListener('copy', onCopy, {
capture: true
});
}
};
const asyncCopy = async (text, isHtmlFormat) => {
try {
if (isHtmlFormat) {
await navigator.clipboard.write([new ClipboardItem({
'text/html': new Blob([text], {
type: 'text/html'
}),
'text/plain': new Blob([text], {
type: 'text/plain'
})
})]);
} else {
await navigator.clipboard.writeText(text);
}
return true;
} catch {
return false;
}
};
async function copy(text, config) {
if (typeof text !== 'string') {
true ? (0,_util_warning["default"])(false, 'The clipboard content must be of string type', '') : 0;
return false;
}
const isHtmlFormat = config?.format === 'text/html';
if (await asyncCopy(text, isHtmlFormat)) {
return true;
}
if (execCopy(text, isHtmlFormat)) {
return true;
}
return false;
}
/* harmony default export */ var _util_copy = (copy);
;// ./components/typography/hooks/useCopyClick.ts
const useCopyClick = ({
copyConfig,
children
}) => {
const [copied, setCopied] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const [copyLoading, setCopyLoading] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const copyIdRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const cleanCopyId = () => {
if (copyIdRef.current) {
clearTimeout(copyIdRef.current);
}
};
const copyOptions = {};
if (copyConfig.format) {
copyOptions.format = copyConfig.format;
}
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => cleanCopyId, []);
// Keep copy action up to date
const onClick = (0,es.useEvent)(async e => {
e?.preventDefault();
e?.stopPropagation();
setCopyLoading(true);
try {
const text = typeof copyConfig.text === 'function' ? await copyConfig.text() : copyConfig.text;
await _util_copy(text || _util_toList(children, {
skipEmpty: true
}).join('') || '', copyOptions);
setCopyLoading(false);
setCopied(true);
// Trigger tips update
cleanCopyId();
copyIdRef.current = setTimeout(() => {
setCopied(false);
}, 3000);
copyConfig.onCopy?.(e);
} catch (error) {
setCopyLoading(false);
throw error;
}
});
return {
copied,
copyLoading,
onClick
};
};
/* harmony default export */ var hooks_useCopyClick = (useCopyClick);
;// ./components/typography/hooks/useMergedConfig.ts
function useMergedConfig(propConfig, templateConfig) {
return external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const support = !!propConfig;
return [support, {
...templateConfig,
...(support && typeof propConfig === 'object' ? propConfig : null)
}];
}, [propConfig]);
}
;// ./components/typography/hooks/usePrevious.ts
const usePrevious = value => {
const ref = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(undefined);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
ref.current = value;
});
return ref.current;
};
/* harmony default export */ var hooks_usePrevious = (usePrevious);
;// ./components/typography/hooks/useTooltipProps.ts
const useTooltipProps = (tooltip, editConfigText, children) => (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
if (tooltip === true) {
return {
title: editConfigText ?? children
};
}
if (/*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement)(tooltip)) {
return {
title: tooltip
};
}
if ((0,is.isPlainObject)(tooltip)) {
return {
title: editConfigText ?? children,
...tooltip
};
}
return {
title: tooltip
};
}, [tooltip, editConfigText, children]);
/* harmony default export */ var hooks_useTooltipProps = (useTooltipProps);
;// ./components/typography/Typography.tsx
const Typography = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
component: Component = 'article',
className,
rootClassName,
children,
direction: typographyDirection,
style,
...restProps
} = props;
const {
getPrefixCls,
direction: contextDirection,
className: contextClassName,
style: contextStyle
} = (0,config_provider_context.useComponentConfig)('typography');
const direction = typographyDirection ?? contextDirection;
const prefixCls = getPrefixCls('typography', customizePrefixCls);
// Style
const [hashId, cssVarCls] = (0,typography_style["default"])(prefixCls);
const componentClassName = (0,clsx.clsx)(prefixCls, contextClassName, {
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, rootClassName, hashId, cssVarCls);
const mergedStyle = {
...contextStyle,
...style
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Component, {
className: componentClassName,
style: mergedStyle,
ref: ref,
...restProps
}, children);
});
if (true) {
Typography.displayName = 'Typography';
}
/* harmony default export */ var typography_Typography = (Typography);
;// ./node_modules/@ant-design/icons-svg/es/asn/CopyOutlined.js
// This icon file is generated automatically.
var CopyOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z" } }] }, "name": "copy", "theme": "outlined" };
/* harmony default export */ var asn_CopyOutlined = (CopyOutlined);
;// ./node_modules/@ant-design/icons/es/icons/CopyOutlined.js
function CopyOutlined_extends() { CopyOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return CopyOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const CopyOutlined_CopyOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], CopyOutlined_extends({}, props, {
ref: ref,
icon: asn_CopyOutlined
}));
/** */
const CopyOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(CopyOutlined_CopyOutlined);
if (true) {
CopyOutlined_RefIcon.displayName = 'CopyOutlined';
}
/* harmony default export */ var icons_CopyOutlined = (CopyOutlined_RefIcon);
;// ./components/typography/Base/util.ts
const toCopyConfigList = val => {
if (val === false) {
return [false, false];
}
return _util_toList(val);
};
function getNode(dom, defaultNode, needDom) {
if (dom === true || dom === undefined) {
return defaultNode;
}
return dom || needDom && defaultNode;
}
/**
* Check for element is native ellipsis
* ref:
* - https://github.com/ant-design/ant-design/issues/50143
* - https://github.com/ant-design/ant-design/issues/50414
*/
function isEleEllipsis(ele) {
// Create a new div to get the size
const childDiv = document.createElement('em');
ele.appendChild(childDiv);
// For test case
if (true) {
childDiv.className = 'ant-typography-css-ellipsis-content-measure';
}
const rect = ele.getBoundingClientRect();
const childRect = childDiv.getBoundingClientRect();
// Reset
ele.removeChild(childDiv);
// Range checker
return (
// Horizontal out of range
rect.left > childRect.left || childRect.right > rect.right ||
// Vertical out of range
rect.top > childRect.top || childRect.bottom > rect.bottom
);
}
const isValidText = val => ['string', 'number'].includes(typeof val);
;// ./components/typography/Base/CopyBtn.tsx
const CopyBtn = props => {
const {
prefixCls,
copied,
locale,
iconOnly,
tooltips,
icon,
tabIndex,
onCopy,
loading: btnLoading
} = props;
const tooltipNodes = toCopyConfigList(tooltips);
const iconNodes = toCopyConfigList(icon);
const {
copied: copiedText,
copy: copyText
} = locale ?? {};
const systemStr = copied ? copiedText : copyText;
const copyTitle = getNode(tooltipNodes[copied ? 1 : 0], systemStr);
const ariaLabel = typeof copyTitle === 'string' ? copyTitle : systemStr;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_tooltip, {
title: copyTitle
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
className: (0,clsx.clsx)(`${prefixCls}-copy`, {
[`${prefixCls}-copy-success`]: copied,
[`${prefixCls}-copy-icon-only`]: iconOnly
}),
onClick: onCopy,
"aria-label": ariaLabel,
tabIndex: tabIndex
}, copied ? getNode(iconNodes[1], /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CheckOutlined, null), true) : getNode(iconNodes[0], btnLoading ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LoadingOutlined, null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_CopyOutlined, null), true)));
};
/* harmony default export */ var Base_CopyBtn = (CopyBtn);
;// ./components/typography/Base/Ellipsis.tsx
const MeasureText = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(({
style,
children
}, ref) => {
const spanRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
isExceed: () => {
const span = spanRef.current;
return span.scrollHeight > span.clientHeight;
},
getHeight: () => spanRef.current.clientHeight
}));
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
"aria-hidden": true,
ref: spanRef,
style: {
position: 'fixed',
display: 'block',
left: 0,
top: 0,
pointerEvents: 'none',
backgroundColor: 'rgba(255, 0, 0, 0.65)',
...style
}
}, children);
});
const getNodesLen = nodeList => nodeList.reduce((totalLen, node) => totalLen + (isValidText(node) ? String(node).length : 1), 0);
function sliceNodes(nodeList, len) {
let currLen = 0;
const currentNodeList = [];
for (let i = 0; i < nodeList.length; i += 1) {
// Match to return
if (currLen === len) {
return currentNodeList;
}
const node = nodeList[i];
const canCut = isValidText(node);
const nodeLen = canCut ? String(node).length : 1;
const nextLen = currLen + nodeLen;
// Exceed but current not which means we need cut this
// This will not happen on validate ReactElement
if (nextLen > len) {
const restLen = len - currLen;
currentNodeList.push(String(node).slice(0, restLen));
return currentNodeList;
}
currentNodeList.push(node);
currLen = nextLen;
}
return nodeList;
}
// Measure for the `text` is exceed the `rows` or not
const STATUS_MEASURE_NONE = 0;
const STATUS_MEASURE_PREPARE = 1;
const STATUS_MEASURE_START = 2;
const STATUS_MEASURE_NEED_ELLIPSIS = 3;
const STATUS_MEASURE_NO_NEED_ELLIPSIS = 4;
const lineClipStyle = {
display: '-webkit-box',
overflow: 'hidden',
WebkitBoxOrient: 'vertical'
};
function EllipsisMeasure(props) {
const {
enableMeasure,
width,
text,
children,
rows,
expanded,
miscDeps,
onEllipsis
} = props;
const nodeList = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => (0,es.toArray)(text), [text]);
const nodeLen = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => getNodesLen(nodeList), [text]);
// ========================= Full Content =========================
// Used for measure only, which means it's always render as no need ellipsis
const fullContent = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => children(nodeList, false), [text]);
// ========================= Cut Content ==========================
const [ellipsisCutIndex, setEllipsisCutIndex] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
const cutMidRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
// ========================= NeedEllipsis =========================
const measureWhiteSpaceRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const needEllipsisRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
// Measure for `rows-1` height, to avoid operation exceed the line height
const descRowsEllipsisRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const symbolRowEllipsisRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const [canEllipsis, setCanEllipsis] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const [needEllipsis, setNeedEllipsis] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(STATUS_MEASURE_NONE);
const [ellipsisHeight, setEllipsisHeight] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const [parentWhiteSpace, setParentWhiteSpace] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(null);
// Trigger start measure
(0,useLayoutEffect["default"])(() => {
if (enableMeasure && width && nodeLen) {
setNeedEllipsis(STATUS_MEASURE_PREPARE);
} else {
setNeedEllipsis(STATUS_MEASURE_NONE);
}
}, [width, text, rows, enableMeasure, nodeList]);
// Measure process
(0,useLayoutEffect["default"])(() => {
if (needEllipsis === STATUS_MEASURE_PREPARE) {
setNeedEllipsis(STATUS_MEASURE_START);
// Parent ref `white-space`
const nextWhiteSpace = measureWhiteSpaceRef.current && getComputedStyle(measureWhiteSpaceRef.current).whiteSpace;
setParentWhiteSpace(nextWhiteSpace);
} else if (needEllipsis === STATUS_MEASURE_START) {
const isOverflow = !!needEllipsisRef.current?.isExceed();
setNeedEllipsis(isOverflow ? STATUS_MEASURE_NEED_ELLIPSIS : STATUS_MEASURE_NO_NEED_ELLIPSIS);
setEllipsisCutIndex(isOverflow ? [0, nodeLen] : null);
setCanEllipsis(isOverflow);
// Get the basic height of ellipsis rows
const baseRowsEllipsisHeight = needEllipsisRef.current?.getHeight() || 0;
// Get the height of `rows - 1` + symbol height
const descRowsEllipsisHeight = rows === 1 ? 0 : descRowsEllipsisRef.current?.getHeight() || 0;
const symbolRowEllipsisHeight = symbolRowEllipsisRef.current?.getHeight() || 0;
const maxRowsHeight = Math.max(baseRowsEllipsisHeight,
// height of rows with ellipsis
descRowsEllipsisHeight + symbolRowEllipsisHeight);
setEllipsisHeight(maxRowsHeight + 1);
onEllipsis(isOverflow);
}
}, [needEllipsis]);
// ========================= Cut Measure ==========================
const cutMidIndex = ellipsisCutIndex ? Math.ceil((ellipsisCutIndex[0] + ellipsisCutIndex[1]) / 2) : 0;
(0,useLayoutEffect["default"])(() => {
const [minIndex, maxIndex] = ellipsisCutIndex || [0, 0];
if (minIndex !== maxIndex) {
const midHeight = cutMidRef.current?.getHeight() || 0;
const isOverflow = midHeight > ellipsisHeight;
let targetMidIndex = cutMidIndex;
if (maxIndex - minIndex === 1) {
targetMidIndex = isOverflow ? minIndex : maxIndex;
}
setEllipsisCutIndex(isOverflow ? [minIndex, targetMidIndex] : [targetMidIndex, maxIndex]);
}
}, [ellipsisCutIndex, cutMidIndex]);
// ========================= Text Content =========================
const finalContent = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
// Skip everything if `enableMeasure` is disabled
if (!enableMeasure) {
return children(nodeList, false);
}
if (needEllipsis !== STATUS_MEASURE_NEED_ELLIPSIS || !ellipsisCutIndex || ellipsisCutIndex[0] !== ellipsisCutIndex[1]) {
const content = children(nodeList, false);
// Limit the max line count to avoid scrollbar blink unless no need ellipsis
// https://github.com/ant-design/ant-design/issues/42958
if ([STATUS_MEASURE_NO_NEED_ELLIPSIS, STATUS_MEASURE_NONE].includes(needEllipsis)) {
return content;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
style: {
...lineClipStyle,
WebkitLineClamp: rows
}
}, content);
}
return children(expanded ? nodeList : sliceNodes(nodeList, ellipsisCutIndex[0]), canEllipsis);
}, [expanded, needEllipsis, ellipsisCutIndex, nodeList].concat((0,toConsumableArray["default"])(miscDeps)));
// ============================ Render ============================
const measureStyle = {
width,
margin: 0,
padding: 0,
whiteSpace: parentWhiteSpace === 'nowrap' ? 'normal' : 'inherit'
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, finalContent, needEllipsis === STATUS_MEASURE_START && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(MeasureText, {
style: {
...measureStyle,
...lineClipStyle,
WebkitLineClamp: rows
},
ref: needEllipsisRef
}, fullContent), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(MeasureText, {
style: {
...measureStyle,
...lineClipStyle,
WebkitLineClamp: rows - 1
},
ref: descRowsEllipsisRef
}, fullContent), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(MeasureText, {
style: {
...measureStyle,
...lineClipStyle,
WebkitLineClamp: 1
},
ref: symbolRowEllipsisRef
}, children([], true)))), needEllipsis === STATUS_MEASURE_NEED_ELLIPSIS && ellipsisCutIndex && ellipsisCutIndex[0] !== ellipsisCutIndex[1] && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(MeasureText, {
style: {
...measureStyle,
top: 400
},
ref: cutMidRef
}, children(sliceNodes(nodeList, cutMidIndex), true))), needEllipsis === STATUS_MEASURE_PREPARE && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
style: {
whiteSpace: 'inherit'
},
ref: measureWhiteSpaceRef
})));
}
;// ./components/typography/Base/EllipsisTooltip.tsx
const EllipsisTooltip = ({
enableEllipsis,
isEllipsis,
open,
children,
tooltipProps
}) => {
if (!tooltipProps?.title || !enableEllipsis) {
return children;
}
const mergedOpen = open && isEllipsis;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_tooltip, {
open: mergedOpen,
...tooltipProps
}, children);
};
if (true) {
EllipsisTooltip.displayName = 'EllipsisTooltip';
}
/* harmony default export */ var Base_EllipsisTooltip = (EllipsisTooltip);
;// ./components/typography/Base/index.tsx
function wrapperDecorations({
mark,
code,
underline,
delete: del,
strong,
keyboard,
italic
}, content) {
let currentContent = content;
function wrap(tag, needed) {
if (!needed) {
return;
}
currentContent = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(tag, {}, currentContent);
}
wrap('strong', strong);
wrap('u', underline);
wrap('del', del);
wrap('code', code);
wrap('mark', mark);
wrap('kbd', keyboard);
wrap('i', italic);
return currentContent;
}
const ELLIPSIS_STR = '...';
const DECORATION_PROPS = ['delete', 'mark', 'code', 'underline', 'strong', 'keyboard', 'italic'];
const Base = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
prefixCls: customizePrefixCls,
className,
style,
type,
disabled,
children,
ellipsis,
editable,
copyable,
component,
title,
onMouseEnter,
onMouseLeave,
...restProps
} = props;
const {
getPrefixCls,
direction
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const [textLocale] = (0,useLocale["default"])('Text');
const typographyRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const editIconRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
// ============================ MISC ============================
const prefixCls = getPrefixCls('typography', customizePrefixCls);
const textProps = (0,es.omit)(restProps, DECORATION_PROPS);
// ========================== Editable ==========================
const [enableEdit, editConfig] = useMergedConfig(editable);
const [editing, setEditing] = (0,es.useControlledState)(false, editConfig.editing);
const {
triggerType = ['icon']
} = editConfig;
const triggerEdit = edit => {
if (edit) {
editConfig.onStart?.();
}
setEditing(edit);
};
// Focus edit icon when back
const prevEditing = hooks_usePrevious(editing);
(0,useLayoutEffect["default"])(() => {
if (!editing && prevEditing) {
editIconRef.current?.focus();
}
}, [editing]);
const onEditClick = e => {
e?.preventDefault();
triggerEdit(true);
};
const onEditChange = value => {
editConfig.onChange?.(value);
triggerEdit(false);
};
const onEditCancel = () => {
editConfig.onCancel?.();
triggerEdit(false);
};
// ========================== Copyable ==========================
const [enableCopy, copyConfig] = useMergedConfig(copyable);
const {
copied,
copyLoading,
onClick: onCopyClick
} = hooks_useCopyClick({
copyConfig,
children
});
// ========================== Ellipsis ==========================
const [isLineClampSupport, setIsLineClampSupport] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const [isTextOverflowSupport, setIsTextOverflowSupport] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const [isJsEllipsis, setIsJsEllipsis] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const [isNativeEllipsis, setIsNativeEllipsis] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const [isNativeVisible, setIsNativeVisible] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(true);
const [enableEllipsis, ellipsisConfig] = useMergedConfig(ellipsis, {
expandable: false,
symbol: isExpanded => isExpanded ? textLocale?.collapse : textLocale?.expand
});
const [expanded, setExpanded] = (0,es.useControlledState)(ellipsisConfig.defaultExpanded || false, ellipsisConfig.expanded);
const mergedEnableEllipsis = enableEllipsis && (!expanded || ellipsisConfig.expandable === 'collapsible');
// Shared prop to reduce bundle size
const {
rows = 1
} = ellipsisConfig;
const needMeasureEllipsis = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() =>
// Disable ellipsis
mergedEnableEllipsis && (
// Provide suffix
ellipsisConfig.suffix !== undefined || ellipsisConfig.onEllipsis ||
// Can't use css ellipsis since we need to provide the place for button
ellipsisConfig.expandable || enableEdit || enableCopy), [mergedEnableEllipsis, ellipsisConfig, enableEdit, enableCopy]);
(0,useLayoutEffect["default"])(() => {
if (enableEllipsis && !needMeasureEllipsis) {
setIsLineClampSupport(isStyleSupport('webkitLineClamp'));
setIsTextOverflowSupport(isStyleSupport('textOverflow'));
}
}, [needMeasureEllipsis, enableEllipsis]);
const [cssEllipsis, setCssEllipsis] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(mergedEnableEllipsis);
const canUseCssEllipsis = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (needMeasureEllipsis) {
return false;
}
if (rows === 1) {
return isTextOverflowSupport;
}
return isLineClampSupport;
}, [needMeasureEllipsis, isTextOverflowSupport, isLineClampSupport]);
// We use effect to change from css ellipsis to js ellipsis.
// To make SSR still can see the ellipsis.
(0,useLayoutEffect["default"])(() => {
setCssEllipsis(canUseCssEllipsis && mergedEnableEllipsis);
}, [canUseCssEllipsis, mergedEnableEllipsis]);
const tooltipProps = hooks_useTooltipProps(ellipsisConfig.tooltip, editConfig.text, children);
const needNativeEllipsisMeasure = cssEllipsis && !!tooltipProps.title;
const isMergedEllipsis = mergedEnableEllipsis && (cssEllipsis ? needNativeEllipsisMeasure && isNativeEllipsis : isJsEllipsis);
const cssTextOverflow = mergedEnableEllipsis && rows === 1 && cssEllipsis;
const cssLineClamp = mergedEnableEllipsis && rows > 1 && cssEllipsis;
// >>>>> Expand
const onExpandClick = (e, info) => {
setExpanded(info.expanded);
ellipsisConfig.onExpand?.(e, info);
};
const [ellipsisWidth, setEllipsisWidth] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(0);
const [isHoveringOperations, setIsHoveringOperations] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const [isHoveringTypography, setIsHoveringTypography] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const onResize = ({
offsetWidth
}) => {
setEllipsisWidth(offsetWidth);
};
// >>>>> JS Ellipsis
const onJsEllipsis = jsEllipsis => {
setIsJsEllipsis(jsEllipsis);
// Trigger if changed
if (isJsEllipsis !== jsEllipsis) {
ellipsisConfig.onEllipsis?.(jsEllipsis);
}
};
// >>>>> Native ellipsis
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
const textEle = typographyRef.current;
if (enableEllipsis && needNativeEllipsisMeasure && textEle) {
const currentEllipsis = isEleEllipsis(textEle);
if (isNativeEllipsis !== currentEllipsis) {
setIsNativeEllipsis(currentEllipsis);
}
}
}, [enableEllipsis, needNativeEllipsisMeasure, children, cssLineClamp, isNativeVisible, ellipsisWidth]);
// https://github.com/ant-design/ant-design/issues/36786
// Use IntersectionObserver to check if element is invisible
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
const textEle = typographyRef.current;
if (typeof IntersectionObserver === 'undefined' || !textEle || !needNativeEllipsisMeasure || !mergedEnableEllipsis) {
return;
}
const observer = new IntersectionObserver(() => {
setIsNativeVisible(!!textEle.offsetParent);
});
observer.observe(textEle);
return () => {
observer.disconnect();
};
}, [needNativeEllipsisMeasure, mergedEnableEllipsis]);
// ========================== Tooltip ===========================
const topAriaLabel = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if (!enableEllipsis || cssEllipsis) {
return undefined;
}
return [editConfig.text, children, title, tooltipProps.title].find(isValidText);
}, [enableEllipsis, cssEllipsis, title, tooltipProps.title, isMergedEllipsis]);
// =========================== Render ===========================
// >>>>>>>>>>> Editing input
if (editing) {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(typography_Editable, {
value: editConfig.text ?? (typeof children === 'string' ? children : ''),
onSave: onEditChange,
onCancel: onEditCancel,
onEnd: editConfig.onEnd,
prefixCls: prefixCls,
className: className,
style: style,
direction: direction,
component: component,
maxLength: editConfig.maxLength,
autoSize: editConfig.autoSize,
enterIcon: editConfig.enterIcon
});
}
// >>>>>>>>>>> Typography
// Expand
const renderExpand = () => {
const {
expandable,
symbol
} = ellipsisConfig;
return expandable ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
key: "expand",
className: `${prefixCls}-${expanded ? 'collapse' : 'expand'}`,
onClick: e => onExpandClick(e, {
expanded: !expanded
}),
"aria-label": expanded ? textLocale.collapse : textLocale?.expand
}, typeof symbol === 'function' ? symbol(expanded) : symbol)) : null;
};
// Edit
const renderEdit = () => {
if (!enableEdit) {
return;
}
const {
icon,
tooltip,
tabIndex
} = editConfig;
const editTitle = (0,es.toArray)(tooltip)[0] || textLocale?.edit;
const ariaLabel = typeof editTitle === 'string' ? editTitle : '';
return triggerType.includes('icon') ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_tooltip, {
key: "edit",
title: tooltip === false ? '' : editTitle
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("button", {
type: "button",
ref: editIconRef,
className: `${prefixCls}-edit`,
onClick: onEditClick,
"aria-label": ariaLabel,
tabIndex: tabIndex
}, icon || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_EditOutlined, {
role: "button"
})))) : null;
};
// Copy
const renderCopy = () => {
if (!enableCopy) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Base_CopyBtn, {
key: "copy",
...copyConfig,
prefixCls: prefixCls,
copied: copied,
locale: textLocale,
onCopy: onCopyClick,
loading: copyLoading,
iconOnly: !(0,is.isNonNullable)(children)
});
};
const renderOperations = canEllipsis => {
const expandNode = canEllipsis && renderExpand();
const editNode = renderEdit();
const copyNode = renderCopy();
if (!expandNode && !editNode && !copyNode) {
return null;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
key: "operations",
className: `${prefixCls}-actions`,
onMouseEnter: () => setIsHoveringOperations(true),
onMouseLeave: () => setIsHoveringOperations(false)
}, expandNode, editNode, copyNode);
};
const renderEllipsis = canEllipsis => [canEllipsis && !expanded && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
"aria-hidden": true,
key: "ellipsis"
}, ELLIPSIS_STR)), ellipsisConfig.suffix, renderOperations(canEllipsis)];
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(resize_observer_es, {
onResize: onResize,
disabled: !mergedEnableEllipsis
}, resizeRef => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(Base_EllipsisTooltip, {
tooltipProps: tooltipProps,
enableEllipsis: mergedEnableEllipsis,
isEllipsis: isMergedEllipsis,
open: isHoveringTypography && !isHoveringOperations
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(typography_Typography, {
onMouseEnter: e => {
setIsHoveringTypography(true);
onMouseEnter?.(e);
},
onMouseLeave: e => {
setIsHoveringTypography(false);
onMouseLeave?.(e);
},
className: (0,clsx.clsx)({
[`${prefixCls}-${type}`]: type,
[`${prefixCls}-disabled`]: disabled,
[`${prefixCls}-ellipsis`]: enableEllipsis,
[`${prefixCls}-ellipsis-single-line`]: cssTextOverflow,
[`${prefixCls}-ellipsis-multiple-line`]: cssLineClamp,
[`${prefixCls}-link`]: component === 'a'
}, className),
prefixCls: customizePrefixCls,
style: {
...style,
WebkitLineClamp: cssLineClamp ? rows : undefined
},
component: component,
ref: (0,es_ref.composeRef)(resizeRef, typographyRef, ref),
direction: direction,
onClick: triggerType.includes('text') ? onEditClick : undefined,
"aria-label": topAriaLabel?.toString(),
title: title,
...textProps
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(EllipsisMeasure, {
enableMeasure: mergedEnableEllipsis && !cssEllipsis,
text: children,
rows: rows,
width: ellipsisWidth,
onEllipsis: onJsEllipsis,
expanded: expanded,
miscDeps: [copied, expanded, copyLoading, enableEdit, enableCopy, textLocale].concat((0,toConsumableArray["default"])(DECORATION_PROPS.map(key => props[key])))
}, (node, canEllipsis) => wrapperDecorations(props, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment, null, node.length > 0 && canEllipsis && !expanded && topAriaLabel ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
key: "show-content",
"aria-hidden": true
}, node)) : node, renderEllipsis(canEllipsis))))))));
});
/* harmony default export */ var typography_Base = (Base);
;// ./components/typography/Link.tsx
const Link = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
ellipsis,
rel,
children,
// @ts-expect-error: https://github.com/ant-design/ant-design/issues/26622
navigate: _navigate,
...restProps
} = props;
if (true) {
const warning = (0,_util_warning.devUseWarning)('Typography.Link');
true ? warning(typeof ellipsis !== 'object', 'usage', '`ellipsis` only supports boolean value.') : 0;
}
const mergedProps = {
...restProps,
rel: rel === undefined && restProps.target === '_blank' ? 'noopener noreferrer' : rel
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(typography_Base, {
...mergedProps,
ref: ref,
ellipsis: !!ellipsis,
component: "a"
}, children);
});
/* harmony default export */ var typography_Link = (Link);
;// ./components/typography/Paragraph.tsx
const Paragraph_Paragraph = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
children,
...restProps
} = props;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(typography_Base, {
ref: ref,
...restProps,
component: "div"
}, children);
});
/* harmony default export */ var typography_Paragraph = (Paragraph_Paragraph);
;// ./components/typography/Text.tsx
const Text = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
ellipsis,
children,
...restProps
} = props;
const mergedEllipsis = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
if ((0,is.isPlainObject)(ellipsis)) {
return (0,es.omit)(ellipsis, ['expandable', 'rows']);
}
return ellipsis;
}, [ellipsis]);
if (true) {
const warning = (0,_util_warning.devUseWarning)('Typography.Text');
true ? warning(typeof ellipsis !== 'object' || !ellipsis || !('expandable' in ellipsis) && !('rows' in ellipsis), 'usage', '`ellipsis` do not support `expandable` or `rows` props.') : 0;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(typography_Base, {
ref: ref,
...restProps,
ellipsis: mergedEllipsis,
component: "span"
}, children);
});
/* harmony default export */ var typography_Text = (Text);
;// ./components/typography/Title.tsx
const TITLE_ELE_LIST = [1, 2, 3, 4, 5];
const Title_Title = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
level = 1,
children,
...restProps
} = props;
if (true) {
const warning = (0,_util_warning.devUseWarning)('Typography.Title');
true ? warning(TITLE_ELE_LIST.includes(level), 'usage', 'Title only accept `1 | 2 | 3 | 4 | 5` as `level` value. And `5` need 4.6.0+ version.') : 0;
}
const component = TITLE_ELE_LIST.includes(level) ? `h${level}` : `h1`;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(typography_Base, {
ref: ref,
...restProps,
component: component
}, children);
});
/* harmony default export */ var typography_Title = (Title_Title);
;// ./components/typography/index.tsx
const components_typography_Typography = typography_Typography;
components_typography_Typography.Text = typography_Text;
components_typography_Typography.Link = typography_Link;
components_typography_Typography.Title = typography_Title;
components_typography_Typography.Paragraph = typography_Paragraph;
/* harmony default export */ var typography = (components_typography_Typography);
;// ./node_modules/@rc-component/upload/es/attr-accept.js
/* harmony default export */ var attr_accept = ((file, acceptedFiles) => {
if (file && acceptedFiles) {
const acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
const fileName = file.name || '';
const mimeType = file.type || '';
const baseMimeType = mimeType.replace(/\/.*$/, '');
return acceptedFilesArray.some(type => {
const validType = type.trim();
// This is something like */*,* allow all files
if (/^\*(\/\*)?$/.test(type)) {
return true;
}
// like .jpg, .png
if (validType.charAt(0) === '.') {
const lowerFileName = fileName.toLowerCase();
const lowerType = validType.toLowerCase();
let affixList = [lowerType];
if (lowerType === '.jpg' || lowerType === '.jpeg') {
affixList = ['.jpg', '.jpeg'];
}
return affixList.some(affix => lowerFileName.endsWith(affix));
}
// This is something like a image/* mime type
if (/\/\*$/.test(validType)) {
return baseMimeType === validType.replace(/\/.*$/, '');
}
// Full match
if (mimeType === validType) {
return true;
}
// Invalidate type should skip
if (/^\w+$/.test(validType)) {
(0,es.warning)(false, `Upload takes an invalidate 'accept' type '${validType}'.Skip for check.`);
return true;
}
return false;
});
}
return true;
});
(Object.getOwnPropertyDescriptor(attr_accept, "name") || {}).writable || Object.defineProperty(attr_accept, "name", { value: "default", configurable: true });
;// ./node_modules/@rc-component/upload/es/request.js
function getError(option, xhr) {
const msg = `cannot ${option.method} ${option.action} ${xhr.status}'`;
const err = new Error(msg);
err.status = xhr.status;
err.method = option.method;
err.url = option.action;
return err;
}
function getBody(xhr) {
const text = xhr.responseText || xhr.response;
if (!text) {
return text;
}
try {
return JSON.parse(text);
} catch (e) {
return text;
}
}
function upload(option) {
// eslint-disable-next-line no-undef
const xhr = new XMLHttpRequest();
if (option.onProgress && xhr.upload) {
xhr.upload.onprogress = function progress(e) {
if (e.total > 0) {
e.percent = e.loaded / e.total * 100;
}
option.onProgress(e);
};
}
// eslint-disable-next-line no-undef
const formData = new FormData();
if (option.data) {
Object.keys(option.data).forEach(key => {
const value = option.data[key];
// support key-value array data
if (Array.isArray(value)) {
value.forEach(item => {
// { list: [ 11, 22 ] }
// formData.append('list[]', 11);
formData.append(`${key}[]`, item);
});
return;
}
formData.append(key, value);
});
}
// eslint-disable-next-line no-undef
if (option.file instanceof Blob) {
formData.append(option.filename, option.file, option.file.name);
} else {
formData.append(option.filename, option.file);
}
xhr.onerror = function error(e) {
option.onError(e);
};
xhr.onload = function onload() {
// allow success when 2xx status
// see https://github.com/react-component/upload/issues/34
if (xhr.status < 200 || xhr.status >= 300) {
return option.onError(getError(option, xhr), getBody(xhr));
}
return option.onSuccess(getBody(xhr), xhr);
};
xhr.open(option.method, option.action, true);
// Has to be after `.open()`. See https://github.com/enyo/dropzone/issues/179
if (option.withCredentials && 'withCredentials' in xhr) {
xhr.withCredentials = true;
}
const headers = option.headers || {};
// when set headers['X-Requested-With'] = null , can close default XHR header
// see https://github.com/react-component/upload/issues/33
if (headers['X-Requested-With'] !== null) {
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
}
Object.keys(headers).forEach(h => {
if (headers[h] !== null) {
xhr.setRequestHeader(h, headers[h]);
}
});
xhr.send(formData);
return {
abort() {
xhr.abort();
}
};
}
;// ./node_modules/@rc-component/upload/es/traverseFileTree.js
// https://github.com/ant-design/ant-design/issues/50080
const traverseFileTree = async (files, isAccepted) => {
const flattenFileList = [];
const progressFileList = [];
files.forEach(file => progressFileList.push(file.webkitGetAsEntry()));
async function readDirectory(directory) {
const dirReader = directory.createReader();
const entries = [];
while (true) {
const results = await new Promise(resolve => {
dirReader.readEntries(resolve, () => resolve([]));
});
const n = results.length;
if (!n) {
break;
}
for (let i = 0; i < n; i++) {
entries.push(results[i]);
}
}
return entries;
}
async function readFile(item) {
return new Promise(reslove => {
item.file(file => {
if (isAccepted(file)) {
// https://github.com/ant-design/ant-design/issues/16426
if (item.fullPath && !file.webkitRelativePath) {
Object.defineProperties(file, {
webkitRelativePath: {
writable: true
}
});
// eslint-disable-next-line no-param-reassign
file.webkitRelativePath = item.fullPath.replace(/^\//, '');
Object.defineProperties(file, {
webkitRelativePath: {
writable: false
}
});
}
reslove(file);
} else {
reslove(null);
}
});
});
}
// eslint-disable-next-line @typescript-eslint/naming-convention
const _traverseFileTree = async (item, path) => {
if (!item) {
return;
}
// eslint-disable-next-line no-param-reassign
item.path = path || '';
if (item.isFile) {
const file = await readFile(item);
if (file) {
flattenFileList.push(file);
}
} else if (item.isDirectory) {
const entries = await readDirectory(item);
progressFileList.push(...entries);
}
};
let wipIndex = 0;
while (wipIndex < progressFileList.length) {
await _traverseFileTree(progressFileList[wipIndex]);
wipIndex++;
}
return flattenFileList;
};
/* harmony default export */ var es_traverseFileTree = (traverseFileTree);
;// ./node_modules/@rc-component/upload/es/uid.js
const now = +new Date();
let index = 0;
function uid_uid() {
// eslint-disable-next-line no-plusplus
return `rc-upload-${now}-${++index}`;
}
;// ./node_modules/@rc-component/upload/es/AjaxUploader.js
function AjaxUploader_extends() { AjaxUploader_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return AjaxUploader_extends.apply(this, arguments); }
/* eslint react/no-is-mounted:0,react/sort-comp:0,react/prop-types:0 */
class AjaxUploader extends external_root_React_commonjs2_react_commonjs_react_amd_react_.Component {
state = {
uid: uid_uid()
};
reqs = {};
fileInput;
_isMounted;
filterFile = (file, force = false) => {
const {
accept,
directory
} = this.props;
let filterFn;
let acceptFormat;
if (typeof accept === 'string') {
acceptFormat = accept;
} else {
const {
filter,
format
} = accept || {};
acceptFormat = format;
if (filter === 'native') {
filterFn = () => true;
} else {
filterFn = filter;
}
}
const mergedFilter = filterFn || (directory || force ? currentFile => attr_accept(currentFile, acceptFormat) : () => true);
return mergedFilter(file);
};
onChange = e => {
const {
files
} = e.target;
const acceptedFiles = [...files].filter(file => this.filterFile(file));
this.uploadFiles(acceptedFiles);
this.reset();
};
onClick = event => {
const el = this.fileInput;
if (!el) {
return;
}
const target = event.target;
const {
onClick
} = this.props;
if (target && target.tagName === 'BUTTON') {
const parent = el.parentNode;
parent.focus();
target.blur();
}
el.click();
if (onClick) {
onClick(event);
}
};
onKeyDown = e => {
if (e.key === 'Enter') {
this.onClick(e);
}
};
onDataTransferFiles = async (dataTransfer, existFileCallback) => {
const {
multiple,
directory
} = this.props;
const items = [...(dataTransfer.items || [])];
let files = [...(dataTransfer.files || [])];
if (files.length > 0 || items.some(item => item.kind === 'file')) {
existFileCallback?.();
}
if (directory) {
files = await es_traverseFileTree(Array.prototype.slice.call(items), this.filterFile);
this.uploadFiles(files);
} else {
let acceptFiles = [...files].filter(file => this.filterFile(file, true));
if (multiple === false) {
acceptFiles = files.slice(0, 1);
}
this.uploadFiles(acceptFiles);
}
};
onFilePaste = async e => {
const {
pastable
} = this.props;
if (!pastable) {
return;
}
if (e.type === 'paste') {
const clipboardData = e.clipboardData;
return this.onDataTransferFiles(clipboardData, () => {
e.preventDefault();
});
}
};
onFileDragOver = e => {
e.preventDefault();
};
onFileDrop = async e => {
e.preventDefault();
if (e.type === 'drop') {
const dataTransfer = e.dataTransfer;
return this.onDataTransferFiles(dataTransfer);
}
};
componentDidMount() {
this._isMounted = true;
const {
pastable
} = this.props;
if (pastable) {
document.addEventListener('paste', this.onFilePaste);
}
}
componentWillUnmount() {
this._isMounted = false;
this.abort();
document.removeEventListener('paste', this.onFilePaste);
}
componentDidUpdate(prevProps) {
const {
pastable
} = this.props;
if (pastable && !prevProps.pastable) {
document.addEventListener('paste', this.onFilePaste);
} else if (!pastable && prevProps.pastable) {
document.removeEventListener('paste', this.onFilePaste);
}
}
uploadFiles = files => {
const originFiles = [...files];
const postFiles = originFiles.map(file => {
// eslint-disable-next-line no-param-reassign
file.uid = uid_uid();
return this.processFile(file, originFiles);
});
// Batch upload files
Promise.all(postFiles).then(fileList => {
const {
onBatchStart
} = this.props;
onBatchStart?.(fileList.map(({
origin,
parsedFile
}) => ({
file: origin,
parsedFile
})));
fileList.filter(file => file.parsedFile !== null).forEach(file => {
this.post(file);
});
});
};
/**
* Process file before upload. When all the file is ready, we start upload.
*/
processFile = async (file, fileList) => {
const {
beforeUpload
} = this.props;
let transformedFile = file;
if (beforeUpload) {
try {
transformedFile = await beforeUpload(file, fileList);
} catch (e) {
// Rejection will also trade as false
transformedFile = false;
}
if (transformedFile === false) {
return {
origin: file,
parsedFile: null,
action: null,
data: null
};
}
}
// Get latest action
const {
action
} = this.props;
let mergedAction;
if (typeof action === 'function') {
mergedAction = await action(file);
} else {
mergedAction = action;
}
// Get latest data
const {
data
} = this.props;
let mergedData;
if (typeof data === 'function') {
mergedData = await data(file);
} else {
mergedData = data;
}
const parsedData =
// string type is from legacy `transformFile`.
// Not sure if this will work since no related test case works with it
(typeof transformedFile === 'object' || typeof transformedFile === 'string') && transformedFile ? transformedFile : file;
let parsedFile;
if (parsedData instanceof File) {
parsedFile = parsedData;
} else {
parsedFile = new File([parsedData], file.name, {
type: file.type
});
}
const mergedParsedFile = parsedFile;
mergedParsedFile.uid = file.uid;
return {
origin: file,
data: mergedData,
parsedFile: mergedParsedFile,
action: mergedAction
};
};
post({
data,
origin,
action,
parsedFile
}) {
if (!this._isMounted) {
return;
}
const {
onStart,
customRequest,
name,
headers,
withCredentials,
method
} = this.props;
const {
uid
} = origin;
const request = customRequest || upload;
const requestOption = {
action,
filename: name,
data,
file: parsedFile,
headers,
withCredentials,
method: method || 'post',
onProgress: e => {
const {
onProgress
} = this.props;
onProgress?.(e, parsedFile);
},
onSuccess: (ret, xhr) => {
const {
onSuccess
} = this.props;
onSuccess?.(ret, parsedFile, xhr);
delete this.reqs[uid];
},
onError: (err, ret) => {
const {
onError
} = this.props;
onError?.(err, ret, parsedFile);
delete this.reqs[uid];
}
};
onStart(origin);
this.reqs[uid] = request(requestOption, {
defaultRequest: upload
});
}
reset() {
this.setState({
uid: uid_uid()
});
}
abort(file) {
const {
reqs
} = this;
if (file) {
const uid = file.uid ? file.uid : file;
if (reqs[uid] && reqs[uid].abort) {
reqs[uid].abort();
}
delete reqs[uid];
} else {
Object.keys(reqs).forEach(uid => {
if (reqs[uid] && reqs[uid].abort) {
reqs[uid].abort();
}
delete reqs[uid];
});
}
}
saveFileInput = node => {
this.fileInput = node;
};
render() {
const {
component: Tag,
prefixCls,
className,
classNames = {},
disabled,
id,
name,
style,
styles = {},
multiple,
accept,
capture,
children,
directory,
openFileDialogOnClick,
onMouseEnter,
onMouseLeave,
hasControlInside,
...otherProps
} = this.props;
// Extract accept format for input element
const acceptFormat = typeof accept === 'string' ? accept : accept?.format;
const cls = (0,clsx.clsx)(prefixCls, {
[`${prefixCls}-disabled`]: disabled,
[className]: className
});
// because input don't have directory/webkitdirectory type declaration
const dirProps = directory ? {
directory: 'directory',
webkitdirectory: 'webkitdirectory'
} : {};
const events = disabled ? {} : {
onClick: openFileDialogOnClick ? this.onClick : () => {},
onKeyDown: openFileDialogOnClick ? this.onKeyDown : () => {},
onMouseEnter,
onMouseLeave,
onDrop: this.onFileDrop,
onDragOver: this.onFileDragOver,
tabIndex: hasControlInside ? undefined : '0'
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Tag, AjaxUploader_extends({}, events, {
className: cls,
role: hasControlInside ? undefined : 'button',
style: style
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", AjaxUploader_extends({}, (0,pickAttrs["default"])(otherProps, {
aria: true,
data: true
}), {
id: id
/**
* https://github.com/ant-design/ant-design/issues/50643,
* https://github.com/react-component/upload/pull/575#issuecomment-2320646552
*/,
name: name,
disabled: disabled,
type: "file",
ref: this.saveFileInput,
onClick: e => e.stopPropagation() // https://github.com/ant-design/ant-design/issues/19948
,
key: this.state.uid,
style: {
display: 'none',
...styles.input
},
className: classNames.input,
accept: acceptFormat
}, dirProps, {
multiple: multiple,
onChange: this.onChange
}, capture != null ? {
capture
} : {})), children);
}
}
/* harmony default export */ var es_AjaxUploader = (AjaxUploader);
;// ./node_modules/@rc-component/upload/es/Upload.js
function Upload_extends() { Upload_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Upload_extends.apply(this, arguments); }
/* eslint react/prop-types:0 */
function Upload_empty() {}
class Upload extends external_root_React_commonjs2_react_commonjs_react_amd_react_.Component {
static defaultProps = {
component: 'span',
prefixCls: 'rc-upload',
data: {},
headers: {},
name: 'file',
multipart: false,
onStart: Upload_empty,
onError: Upload_empty,
onSuccess: Upload_empty,
multiple: false,
beforeUpload: null,
customRequest: null,
withCredentials: false,
openFileDialogOnClick: true,
hasControlInside: false
};
uploader;
abort(file) {
this.uploader.abort(file);
}
saveUploader = node => {
this.uploader = node;
};
render() {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(es_AjaxUploader, Upload_extends({}, this.props, {
ref: this.saveUploader
}));
}
}
/* harmony default export */ var es_Upload = (Upload);
;// ./node_modules/@rc-component/upload/es/index.js
/* harmony default export */ var upload_es = (es_Upload);
// EXTERNAL MODULE: ./components/upload/style/index.ts + 5 modules
var upload_style = __webpack_require__("./components/upload/style/index.ts");
;// ./node_modules/@ant-design/icons-svg/es/asn/FileTwoTone.js
// This icon file is generated automatically.
var FileTwoTone = { "icon": function render(primaryColor, secondaryColor) { return { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M534 352V136H232v752h560V394H576a42 42 0 01-42-42z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0042 42h216v494z", "fill": primaryColor } }] }; }, "name": "file", "theme": "twotone" };
/* harmony default export */ var asn_FileTwoTone = (FileTwoTone);
;// ./node_modules/@ant-design/icons/es/icons/FileTwoTone.js
function FileTwoTone_extends() { FileTwoTone_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return FileTwoTone_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const FileTwoTone_FileTwoTone = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], FileTwoTone_extends({}, props, {
ref: ref,
icon: asn_FileTwoTone
}));
/** */
const FileTwoTone_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(FileTwoTone_FileTwoTone);
if (true) {
FileTwoTone_RefIcon.displayName = 'FileTwoTone';
}
/* harmony default export */ var icons_FileTwoTone = (FileTwoTone_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/PaperClipOutlined.js
// This icon file is generated automatically.
var PaperClipOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z" } }] }, "name": "paper-clip", "theme": "outlined" };
/* harmony default export */ var asn_PaperClipOutlined = (PaperClipOutlined);
;// ./node_modules/@ant-design/icons/es/icons/PaperClipOutlined.js
function PaperClipOutlined_extends() { PaperClipOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return PaperClipOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const PaperClipOutlined_PaperClipOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], PaperClipOutlined_extends({}, props, {
ref: ref,
icon: asn_PaperClipOutlined
}));
/** */
const PaperClipOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(PaperClipOutlined_PaperClipOutlined);
if (true) {
PaperClipOutlined_RefIcon.displayName = 'PaperClipOutlined';
}
/* harmony default export */ var icons_PaperClipOutlined = (PaperClipOutlined_RefIcon);
;// ./node_modules/@ant-design/icons-svg/es/asn/PictureTwoTone.js
// This icon file is generated automatically.
var PictureTwoTone = { "icon": function render(primaryColor, secondaryColor) { return { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2z", "fill": primaryColor } }, { "tag": "path", "attrs": { "d": "M424.6 765.8l-150.1-178L136 752.1V792h752v-30.4L658.1 489z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M136 652.7l132.4-157c3.2-3.8 9-3.8 12.2 0l144 170.7L652 396.8c3.2-3.8 9-3.8 12.2 0L888 662.2V232H136v420.7zM304 280a88 88 0 110 176 88 88 0 010-176z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M276 368a28 28 0 1056 0 28 28 0 10-56 0z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z", "fill": primaryColor } }] }; }, "name": "picture", "theme": "twotone" };
/* harmony default export */ var asn_PictureTwoTone = (PictureTwoTone);
;// ./node_modules/@ant-design/icons/es/icons/PictureTwoTone.js
function PictureTwoTone_extends() { PictureTwoTone_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return PictureTwoTone_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const PictureTwoTone_PictureTwoTone = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], PictureTwoTone_extends({}, props, {
ref: ref,
icon: asn_PictureTwoTone
}));
/** */
const PictureTwoTone_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(PictureTwoTone_PictureTwoTone);
if (true) {
PictureTwoTone_RefIcon.displayName = 'PictureTwoTone';
}
/* harmony default export */ var icons_PictureTwoTone = (PictureTwoTone_RefIcon);
;// ./components/upload/utils.ts
function file2Obj(file) {
return {
...file,
lastModified: file.lastModified,
lastModifiedDate: file.lastModifiedDate,
name: file.name,
size: file.size,
type: file.type,
uid: file.uid,
percent: 0,
originFileObj: file
};
}
/** Upload fileList. Replace file if exist or just push into it. */
function updateFileList(file, fileList) {
const nextFileList = (0,toConsumableArray["default"])(fileList);
const fileIndex = nextFileList.findIndex(({
uid
}) => uid === file.uid);
if (fileIndex === -1) {
nextFileList.push(file);
} else {
nextFileList[fileIndex] = file;
}
return nextFileList;
}
function getFileItem(file, fileList) {
const matchKey = file.uid !== undefined ? 'uid' : 'name';
return fileList.filter(item => item[matchKey] === file[matchKey])[0];
}
function removeFileItem(file, fileList) {
const matchKey = file.uid !== undefined ? 'uid' : 'name';
const removed = fileList.filter(item => item[matchKey] !== file[matchKey]);
if (removed.length === fileList.length) {
return null;
}
return removed;
}
// ==================== Default Image Preview ====================
const extname = (url = '') => {
const temp = url.split('/');
const filename = temp[temp.length - 1];
const filenameWithoutSuffix = filename.split(/#|\?/)[0];
return (/\.[^./\\]*$/.exec(filenameWithoutSuffix) || [''])[0];
};
const isImageFileType = type => type.indexOf('image/') === 0;
const isImageUrl = file => {
if (file.type && !file.thumbUrl) {
return isImageFileType(file.type);
}
const url = file.thumbUrl || file.url || '';
const extension = extname(url);
if (/^data:image\//.test(url) || /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico|heic|heif)$/i.test(extension)) {
return true;
}
if (/^data:/.test(url)) {
// other file types of base64
return false;
}
if (extension) {
// other file types which have extension
return false;
}
return true;
};
const MEASURE_SIZE = 200;
function previewImage(file) {
return new Promise(resolve => {
if (!file.type || !isImageFileType(file.type)) {
resolve('');
return;
}
const canvas = document.createElement('canvas');
canvas.width = MEASURE_SIZE;
canvas.height = MEASURE_SIZE;
canvas.style.cssText = `position: fixed; left: 0; top: 0; width: ${MEASURE_SIZE}px; height: ${MEASURE_SIZE}px; z-index: 9999; display: none;`;
document.body.appendChild(canvas);
const ctx = canvas.getContext('2d');
const img = new Image();
img.onload = () => {
const {
width,
height
} = img;
let drawWidth = MEASURE_SIZE;
let drawHeight = MEASURE_SIZE;
let offsetX = 0;
let offsetY = 0;
if (width > height) {
drawHeight = height * (MEASURE_SIZE / width);
offsetY = -(drawHeight - drawWidth) / 2;
} else {
drawWidth = width * (MEASURE_SIZE / height);
offsetX = -(drawWidth - drawHeight) / 2;
}
ctx.drawImage(img, offsetX, offsetY, drawWidth, drawHeight);
const dataURL = canvas.toDataURL();
document.body.removeChild(canvas);
window.URL.revokeObjectURL(img.src);
resolve(dataURL);
};
img.crossOrigin = 'anonymous';
if (file.type.startsWith('image/svg+xml')) {
const reader = new FileReader();
reader.onload = () => {
if (reader.result && typeof reader.result === 'string') {
img.src = reader.result;
}
};
reader.readAsDataURL(file);
} else if (file.type.startsWith('image/gif')) {
const reader = new FileReader();
reader.onload = () => {
if (reader.result) {
resolve(reader.result);
}
};
reader.readAsDataURL(file);
} else {
img.src = window.URL.createObjectURL(file);
}
});
}
;// ./node_modules/@ant-design/icons-svg/es/asn/DownloadOutlined.js
// This icon file is generated automatically.
var DownloadOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" } }] }, "name": "download", "theme": "outlined" };
/* harmony default export */ var asn_DownloadOutlined = (DownloadOutlined);
;// ./node_modules/@ant-design/icons/es/icons/DownloadOutlined.js
function DownloadOutlined_extends() { DownloadOutlined_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return DownloadOutlined_extends.apply(this, arguments); }
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
const DownloadOutlined_DownloadOutlined = (props, ref) => /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(AntdIcon["default"], DownloadOutlined_extends({}, props, {
ref: ref,
icon: asn_DownloadOutlined
}));
/** */
const DownloadOutlined_RefIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(DownloadOutlined_DownloadOutlined);
if (true) {
DownloadOutlined_RefIcon.displayName = 'DownloadOutlined';
}
/* harmony default export */ var icons_DownloadOutlined = (DownloadOutlined_RefIcon);
;// ./components/upload/UploadList/ListItem.tsx
const ListItem_ListItem = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(({
prefixCls,
className,
style,
classNames: itemClassNames,
styles,
locale,
listType,
file,
items,
progress: progressProps,
iconRender,
actionIconRender,
itemRender,
isImgUrl,
showPreviewIcon,
showRemoveIcon,
showDownloadIcon,
previewIcon: customPreviewIcon,
removeIcon: customRemoveIcon,
downloadIcon: customDownloadIcon,
extra: customExtra,
onPreview,
onDownload,
onClose
}, ref) => {
// Status: which will ignore `removed` status
const {
status
} = file;
const [mergedStatus, setMergedStatus] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(status);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (status !== 'removed') {
setMergedStatus(status);
}
}, [status]);
// Delay to show the progress bar
const [showProgress, setShowProgress] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
const timer = setTimeout(() => {
setShowProgress(true);
}, 300);
return () => {
clearTimeout(timer);
};
}, []);
const iconNode = iconRender(file);
let icon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-icon`
}, iconNode);
if (listType === 'picture' || listType === 'picture-card' || listType === 'picture-circle') {
if (mergedStatus === 'uploading' || !file.thumbUrl && !file.url) {
const uploadingClassName = (0,clsx.clsx)(`${prefixCls}-list-item-thumbnail`, {
[`${prefixCls}-list-item-file`]: mergedStatus !== 'uploading'
});
icon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: uploadingClassName
}, iconNode);
} else {
const thumbnail = isImgUrl?.(file) ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("img", {
src: file.thumbUrl || file.url,
alt: file.name,
className: `${prefixCls}-list-item-image`,
crossOrigin: file.crossOrigin
})) : iconNode;
const aClassName = (0,clsx.clsx)(`${prefixCls}-list-item-thumbnail`, {
[`${prefixCls}-list-item-file`]: isImgUrl && !isImgUrl(file)
});
icon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("a", {
className: aClassName,
onClick: e => onPreview(file, e),
href: file.url || file.thumbUrl,
target: "_blank",
rel: "noopener noreferrer"
}, thumbnail);
}
}
const listItemClassName = (0,clsx.clsx)(`${prefixCls}-list-item`, `${prefixCls}-list-item-${mergedStatus}`, itemClassNames?.item);
const linkProps = typeof file.linkProps === 'string' ? JSON.parse(file.linkProps) : file.linkProps;
const removeIcon = (typeof showRemoveIcon === 'function' ? showRemoveIcon(file) : showRemoveIcon) ? actionIconRender((typeof customRemoveIcon === 'function' ? customRemoveIcon(file) : customRemoveIcon) || (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_DeleteOutlined, null)), () => onClose(file), prefixCls, locale.removeFile,
// acceptUploadDisabled is true, only remove icon will follow Upload disabled prop
// https://github.com/ant-design/ant-design/issues/46171
true) : null;
const downloadIcon = (typeof showDownloadIcon === 'function' ? showDownloadIcon(file) : showDownloadIcon) && mergedStatus === 'done' ? actionIconRender((typeof customDownloadIcon === 'function' ? customDownloadIcon(file) : customDownloadIcon) || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_DownloadOutlined, null), () => onDownload(file), prefixCls, locale.downloadFile) : null;
const downloadOrDelete = listType !== 'picture-card' && listType !== 'picture-circle' && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
key: "download-delete",
className: (0,clsx.clsx)(`${prefixCls}-list-item-actions`, {
picture: listType === 'picture'
})
}, downloadIcon, removeIcon));
const extraContent = typeof customExtra === 'function' ? customExtra(file) : customExtra;
const extra = extraContent && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-list-item-extra`
}, extraContent));
const listItemNameClass = (0,clsx.clsx)(`${prefixCls}-list-item-name`);
const fileName = file.url ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("a", {
key: "view",
target: "_blank",
rel: "noopener noreferrer",
className: listItemNameClass,
title: file.name,
...linkProps,
href: file.url,
onClick: e => onPreview(file, e)
}, file.name, extra)) : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
key: "view",
className: listItemNameClass,
onClick: e => onPreview(file, e),
title: file.name
}, file.name, extra));
const previewIcon = (typeof showPreviewIcon === 'function' ? showPreviewIcon(file) : showPreviewIcon) && (file.url || file.thumbUrl) ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("a", {
href: file.url || file.thumbUrl,
target: "_blank",
rel: "noopener noreferrer",
onClick: e => onPreview(file, e),
title: locale.previewFile
}, typeof customPreviewIcon === 'function' ? customPreviewIcon(file) : customPreviewIcon || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_EyeOutlined, null))) : null;
const pictureCardActions = (listType === 'picture-card' || listType === 'picture-circle') && mergedStatus !== 'uploading' && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: `${prefixCls}-list-item-actions`
}, previewIcon, mergedStatus === 'done' && downloadIcon, removeIcon));
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
const rootPrefixCls = getPrefixCls();
const dom = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: listItemClassName,
style: styles?.item
}, icon, fileName, downloadOrDelete, pictureCardActions, showProgress && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es["default"], {
motionName: `${rootPrefixCls}-fade`,
visible: mergedStatus === 'uploading',
motionDeadline: 2000
}, ({
className: motionClassName
}) => {
// show loading icon if upload progress listener is disabled
const loadingProgress = 'percent' in file ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_progress, {
type: "line",
percent: file.percent,
"aria-label": file['aria-label'],
"aria-labelledby": file['aria-labelledby'],
...progressProps
})) : null;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-list-item-progress`, motionClassName)
}, loadingProgress);
})));
const message = file.response && typeof file.response === 'string' ? file.response : file.error?.statusText || file.error?.message || locale.uploadError;
const item = mergedStatus === 'error' ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(components_tooltip, {
title: message,
getPopupContainer: node => node.parentNode
}, dom)) : dom;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: (0,clsx.clsx)(`${prefixCls}-list-item-container`, className),
style: style,
ref: ref
}, itemRender ? itemRender(item, file, items, {
download: onDownload.bind(null, file),
preview: onPreview.bind(null, file),
remove: onClose.bind(null, file)
}) : item);
});
/* harmony default export */ var UploadList_ListItem = (ListItem_ListItem);
;// ./components/upload/UploadList/index.tsx
const InternalUploadList = (props, ref) => {
const {
listType = 'text',
previewFile = previewImage,
onPreview,
onDownload,
onRemove,
locale,
iconRender,
isImageUrl: isImgUrl = isImageUrl,
prefixCls: customizePrefixCls,
items = [],
showPreviewIcon = true,
showRemoveIcon = true,
showDownloadIcon = false,
removeIcon,
previewIcon,
downloadIcon,
extra,
progress = {
size: [-1, 2],
showInfo: false
},
appendAction,
appendActionVisible = true,
itemRender,
disabled,
classNames: uploadListClassNames,
styles
} = props;
const [, forceUpdate] = useForceUpdate();
const [motionAppear, setMotionAppear] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState(false);
const isPictureCardOrCirle = ['picture-card', 'picture-circle'].includes(listType);
// ============================= Effect =============================
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
if (!listType.startsWith('picture')) {
return;
}
(items || []).forEach(file => {
if (!(file.originFileObj instanceof File || file.originFileObj instanceof Blob) || file.thumbUrl !== undefined) {
return;
}
file.thumbUrl = '';
previewFile?.(file.originFileObj).then(previewDataUrl => {
// Need append '' to avoid dead loop
file.thumbUrl = previewDataUrl || '';
forceUpdate();
});
});
}, [listType, items, previewFile]);
external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(() => {
setMotionAppear(true);
}, []);
// ============================= Events =============================
const onInternalPreview = (file, e) => {
if (!onPreview) {
return;
}
e?.preventDefault();
return onPreview(file);
};
const onInternalDownload = file => {
if (typeof onDownload === 'function') {
onDownload(file);
} else if (file.url) {
window.open(file.url);
}
};
const onInternalClose = file => {
onRemove?.(file);
};
const internalIconRender = file => {
if (iconRender) {
return iconRender(file, listType);
}
const isLoading = file.status === 'uploading';
if (listType.startsWith('picture')) {
const loadingIcon = listType === 'picture' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LoadingOutlined, null) : locale.uploading;
const fileIcon = isImgUrl?.(file) ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_PictureTwoTone, null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_FileTwoTone, null);
return isLoading ? loadingIcon : fileIcon;
}
return isLoading ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_LoadingOutlined, null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(icons_PaperClipOutlined, null);
};
const actionIconRender = (customIcon, callback, prefixCls, title, acceptUploadDisabled) => {
const btnProps = {
type: 'text',
size: 'small',
title,
onClick: e => {
callback();
if (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(customIcon)) {
customIcon.props.onClick?.(e);
}
},
className: `${prefixCls}-list-item-action`,
disabled: acceptUploadDisabled ? disabled : false
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement(customIcon) ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(button_Button, {
...btnProps,
icon: (0,reactNode.cloneElement)(customIcon, {
...customIcon.props,
onClick: () => {}
})
})) : (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(button_Button, {
...btnProps
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", null, customIcon)));
};
// ============================== Ref ===============================
// Test needs
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
handlePreview: onInternalPreview,
handleDownload: onInternalDownload
}));
const {
getPrefixCls
} = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_context.ConfigContext);
// ============================= Render =============================
const prefixCls = getPrefixCls('upload', customizePrefixCls);
const rootPrefixCls = getPrefixCls();
const listClassNames = (0,clsx.clsx)(`${prefixCls}-list`, `${prefixCls}-list-${listType}`, uploadListClassNames?.list);
const listItemMotion = external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => (0,es.omit)((0,_util_motion["default"])(rootPrefixCls), ['onAppearEnd', 'onEnterEnd', 'onLeaveEnd']), [rootPrefixCls]);
const motionConfig = {
...(isPictureCardOrCirle ? {} : listItemMotion),
motionDeadline: 2000,
motionName: `${prefixCls}-${isPictureCardOrCirle ? 'animate-inline' : 'animate'}`,
keys: (0,toConsumableArray["default"])(items.map(file => ({
key: file.uid,
file
}))),
motionAppear
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: listClassNames,
style: styles?.list
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es.CSSMotionList, {
...motionConfig,
component: false
}, ({
key,
file,
className: motionClassName,
style: motionStyle
}) => (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(UploadList_ListItem, {
key: key,
locale: locale,
prefixCls: prefixCls,
className: motionClassName,
style: motionStyle,
classNames: uploadListClassNames,
styles: styles,
file: file,
items: items,
progress: progress,
listType: listType,
isImgUrl: isImgUrl,
showPreviewIcon: showPreviewIcon,
showRemoveIcon: showRemoveIcon,
showDownloadIcon: showDownloadIcon,
removeIcon: removeIcon,
previewIcon: previewIcon,
downloadIcon: downloadIcon,
extra: extra,
iconRender: internalIconRender,
actionIconRender: actionIconRender,
itemRender: itemRender,
onPreview: onInternalPreview,
onDownload: onInternalDownload,
onClose: onInternalClose
}))), appendAction && (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(motion_es["default"], {
...motionConfig,
visible: appendActionVisible,
forceRender: true
}, ({
className: motionClassName,
style: motionStyle
}) => (0,reactNode.cloneElement)(appendAction, oriProps => ({
className: (0,clsx.clsx)(oriProps.className, motionClassName),
style: {
...motionStyle,
// prevent the element has hover css pseudo-class that may cause animation to end prematurely.
pointerEvents: motionClassName ? 'none' : undefined,
...oriProps.style
}
})))));
};
const UploadList = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(InternalUploadList);
if (true) {
UploadList.displayName = 'UploadList';
}
/* harmony default export */ var upload_UploadList = (UploadList);
;// ./components/upload/Upload.tsx
const LIST_IGNORE = `__LIST_IGNORE_${Date.now()}__`;
const InternalUpload = (props, ref) => {
const config = (0,config_provider_context.useComponentConfig)('upload');
const {
fileList,
defaultFileList,
onRemove,
showUploadList = true,
listType = 'text',
onPreview,
onDownload,
onChange,
onDrop,
previewFile,
disabled: customDisabled,
locale: propLocale,
iconRender,
isImageUrl,
progress,
prefixCls: customizePrefixCls,
className,
type = 'select',
children,
style,
itemRender,
maxCount,
data = {},
multiple = false,
hasControlInside = true,
action = '',
accept = '',
supportServerRender = true,
rootClassName,
styles,
classNames
} = props;
// ===================== Disabled =====================
const disabled = external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext(config_provider_DisabledContext);
const mergedDisabled = customDisabled ?? disabled;
const customRequest = props.customRequest || config.customRequest;
const [internalFileList, setMergedFileList] = (0,es.useControlledState)(defaultFileList, fileList);
const mergedFileList = internalFileList || [];
const [dragState, setDragState] = external_root_React_commonjs2_react_commonjs_react_amd_react_.useState('drop');
const uploadRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
const wrapRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(null);
if (true) {
const warning = (0,_util_warning.devUseWarning)('Upload');
true ? warning('fileList' in props || !('value' in props), 'usage', '`value` is not a valid prop, do you mean `fileList`?') : 0;
}
// Control mode will auto fill file uid if not provided
// eslint-disable-next-line react/use-memo
external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo(() => {
const timestamp = Date.now();
(fileList || []).forEach((file, index) => {
if (!file.uid && !Object.isFrozen(file)) {
file.uid = `__AUTO__${timestamp}_${index}__`;
}
});
}, [fileList]);
const onInternalChange = (file, changedFileList, event) => {
let cloneList = (0,toConsumableArray["default"])(changedFileList);
let exceedMaxCount = false;
// Cut to match count
if (maxCount === 1) {
cloneList = cloneList.slice(-1);
} else if (maxCount) {
exceedMaxCount = cloneList.length > maxCount;
cloneList = cloneList.slice(0, maxCount);
}
// Prevent React18 auto batch since input[upload] trigger process at same time
// which makes fileList closure problem
// eslint-disable-next-line react-dom/no-flush-sync
(0,external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_.flushSync)(() => {
setMergedFileList(cloneList);
});
const changeInfo = {
file: file,
fileList: cloneList
};
if (event) {
changeInfo.event = event;
}
if (!exceedMaxCount || file.status === 'removed' ||
// We should ignore event if current file is exceed `maxCount`
cloneList.some(f => f.uid === file.uid)) {
// eslint-disable-next-line react-dom/no-flush-sync
(0,external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_.flushSync)(() => {
onChange?.(changeInfo);
});
}
};
const mergedBeforeUpload = async (file, fileListArgs) => {
const {
beforeUpload
} = props;
let parsedFile = file;
if (beforeUpload) {
const result = await beforeUpload(file, fileListArgs);
if (result === false) {
return false;
}
// Hack for LIST_IGNORE, we add additional info to remove from the list
delete file[LIST_IGNORE];
if (result === LIST_IGNORE) {
Object.defineProperty(file, LIST_IGNORE, {
value: true,
configurable: true
});
return false;
}
if ((0,is.isPlainObject)(result)) {
parsedFile = result;
}
}
return parsedFile;
};
const onBatchStart = batchFileInfoList => {
// Skip file which marked as `LIST_IGNORE`, these file will not add to file list
const filteredFileInfoList = batchFileInfoList.filter(info => !info.file[LIST_IGNORE]);
// Nothing to do since no file need upload
if (!filteredFileInfoList.length) {
return;
}
const objectFileList = filteredFileInfoList.map(info => file2Obj(info.file));
// Concat new files with prev files
let newFileList = (0,toConsumableArray["default"])(mergedFileList);
objectFileList.forEach(fileObj => {
// Replace file if exist
newFileList = updateFileList(fileObj, newFileList);
});
objectFileList.forEach((fileObj, index) => {
// Repeat trigger `onChange` event for compatible
let triggerFileObj = fileObj;
if (!filteredFileInfoList[index].parsedFile) {
// `beforeUpload` return false
const {
originFileObj
} = fileObj;
let clone;
try {
clone = new File([originFileObj], originFileObj.name, {
type: originFileObj.type
});
} catch {
clone = new Blob([originFileObj], {
type: originFileObj.type
});
clone.name = originFileObj.name;
clone.lastModifiedDate = new Date();
clone.lastModified = new Date().getTime();
}
clone.uid = fileObj.uid;
triggerFileObj = clone;
} else {
// Inject `uploading` status
fileObj.status = 'uploading';
}
onInternalChange(triggerFileObj, newFileList);
});
};
const onSuccess = (response, file, xhr) => {
try {
if (typeof response === 'string') {
response = JSON.parse(response);
}
} catch {
/* do nothing */
}
// removed
if (!getFileItem(file, mergedFileList)) {
return;
}
const targetItem = file2Obj(file);
targetItem.status = 'done';
targetItem.percent = 100;
targetItem.response = response;
targetItem.xhr = xhr;
const nextFileList = updateFileList(targetItem, mergedFileList);
onInternalChange(targetItem, nextFileList);
};
const onProgress = (e, file) => {
// removed
if (!getFileItem(file, mergedFileList)) {
return;
}
const targetItem = file2Obj(file);
targetItem.status = 'uploading';
targetItem.percent = e.percent;
const nextFileList = updateFileList(targetItem, mergedFileList);
onInternalChange(targetItem, nextFileList, e);
};
const onError = (error, response, file) => {
// removed
if (!getFileItem(file, mergedFileList)) {
return;
}
const targetItem = file2Obj(file);
targetItem.error = error;
targetItem.response = response;
targetItem.status = 'error';
const nextFileList = updateFileList(targetItem, mergedFileList);
onInternalChange(targetItem, nextFileList);
};
const handleRemove = file => {
let currentFile;
Promise.resolve(typeof onRemove === 'function' ? onRemove(file) : onRemove).then(ret => {
// Prevent removing file
if (ret === false) {
return;
}
const removedFileList = removeFileItem(file, mergedFileList);
if (removedFileList) {
currentFile = {
...file,
status: 'removed'
};
mergedFileList?.forEach(item => {
const matchKey = currentFile.uid !== undefined ? 'uid' : 'name';
if (item[matchKey] === currentFile[matchKey] && !Object.isFrozen(item)) {
item.status = 'removed';
}
});
uploadRef.current?.abort(currentFile);
onInternalChange(currentFile, removedFileList);
}
});
};
const onFileDrop = e => {
setDragState(e.type);
if (e.type === 'drop') {
onDrop?.(e);
}
};
// Test needs
external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle(ref, () => ({
onBatchStart,
onSuccess,
onProgress,
onError,
fileList: mergedFileList,
upload: uploadRef.current,
nativeElement: wrapRef.current
}));
const {
getPrefixCls,
direction,
className: contextClassName,
style: contextStyle,
classNames: contextClassNames,
styles: contextStyles
} = (0,config_provider_context.useComponentConfig)('upload');
const prefixCls = getPrefixCls('upload', customizePrefixCls);
// =========== Merged Props for Semantic ==========
const mergedProps = {
...props,
listType,
showUploadList,
type,
multiple,
hasControlInside,
supportServerRender,
disabled: mergedDisabled
};
const [mergedClassNames, mergedStyles] = (0,useMergeSemantic.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
props: mergedProps
});
const rcUploadProps = {
onBatchStart,
onError,
onProgress,
onSuccess,
...props,
customRequest,
data,
multiple,
action,
accept,
supportServerRender,
prefixCls,
disabled: mergedDisabled,
beforeUpload: mergedBeforeUpload,
onChange: undefined,
hasControlInside
};
delete rcUploadProps.className;
delete rcUploadProps.style;
// Remove id to avoid open by label when trigger is hidden
// !children: https://github.com/ant-design/ant-design/issues/14298
// disabled: https://github.com/ant-design/ant-design/issues/16478
// https://github.com/ant-design/ant-design/issues/24197
if (!children || mergedDisabled) {
delete rcUploadProps.id;
}
const wrapperCls = `${prefixCls}-wrapper`;
const [hashId, cssVarCls] = (0,upload_style["default"])(prefixCls, wrapperCls);
const [contextLocale] = (0,useLocale["default"])('Upload', en_US["default"].Upload);
const {
showRemoveIcon,
showPreviewIcon,
showDownloadIcon,
removeIcon,
previewIcon,
downloadIcon,
extra
} = typeof showUploadList === 'boolean' ? {} : showUploadList;
// use showRemoveIcon if it is specified explicitly
const realShowRemoveIcon = typeof showRemoveIcon === 'undefined' ? !mergedDisabled : showRemoveIcon;
const renderUploadList = (button, buttonVisible) => {
if (!showUploadList) {
return button;
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(upload_UploadList, {
classNames: mergedClassNames,
styles: mergedStyles,
prefixCls: prefixCls,
listType: listType,
items: mergedFileList,
previewFile: previewFile,
onPreview: onPreview,
onDownload: onDownload,
onRemove: handleRemove,
showRemoveIcon: realShowRemoveIcon,
showPreviewIcon: showPreviewIcon,
showDownloadIcon: showDownloadIcon,
removeIcon: removeIcon,
previewIcon: previewIcon,
downloadIcon: downloadIcon,
iconRender: iconRender,
extra: extra,
locale: {
...contextLocale,
...propLocale
},
isImageUrl: isImageUrl,
progress: progress,
appendAction: button,
appendActionVisible: buttonVisible,
itemRender: itemRender,
disabled: mergedDisabled
});
};
const mergedRootCls = (0,clsx.clsx)(wrapperCls, className, rootClassName, hashId, cssVarCls, contextClassName, mergedClassNames.root, {
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-picture-card-wrapper`]: listType === 'picture-card',
[`${prefixCls}-picture-circle-wrapper`]: listType === 'picture-circle'
});
const mergedRootStyle = {
...mergedStyles.root
};
const mergedStyle = {
...contextStyle,
...style
};
// ======================== Render ========================
if (type === 'drag') {
const dragCls = (0,clsx.clsx)(hashId, prefixCls, `${prefixCls}-drag`, {
[`${prefixCls}-drag-uploading`]: mergedFileList.some(file => file.status === 'uploading'),
[`${prefixCls}-drag-hover`]: dragState === 'dragover',
[`${prefixCls}-disabled`]: mergedDisabled,
[`${prefixCls}-rtl`]: direction === 'rtl'
}, mergedClassNames.trigger);
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: mergedRootCls,
ref: wrapRef,
style: mergedRootStyle
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: dragCls,
style: {
...mergedStyle,
...mergedStyles.trigger
},
onDrop: onFileDrop,
onDragOver: onFileDrop,
onDragLeave: onFileDrop
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(upload_es, {
...rcUploadProps,
ref: uploadRef,
className: `${prefixCls}-btn`
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: `${prefixCls}-drag-container`
}, children))), renderUploadList());
}
const uploadBtnCls = (0,clsx.clsx)(prefixCls, `${prefixCls}-select`, {
[`${prefixCls}-disabled`]: mergedDisabled,
[`${prefixCls}-hidden`]: !children
}, mergedClassNames.trigger);
const uploadButton = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("div", {
className: uploadBtnCls,
style: {
...mergedStyle,
...mergedStyles.trigger
}
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(upload_es, {
...rcUploadProps,
ref: uploadRef
}));
if (listType === 'picture-card' || listType === 'picture-circle') {
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: mergedRootCls,
ref: wrapRef,
style: mergedRootStyle
}, renderUploadList(uploadButton, !!children));
}
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement("span", {
className: mergedRootCls,
ref: wrapRef,
style: mergedRootStyle
}, uploadButton, renderUploadList());
};
const Upload_Upload = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(InternalUpload);
if (true) {
Upload_Upload.displayName = 'Upload';
}
/* harmony default export */ var upload_Upload = (Upload_Upload);
;// ./components/upload/Dragger.tsx
const Dragger = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
const {
style,
height,
hasControlInside = false,
children,
...restProps
} = props;
const mergedStyle = {
...style,
height
};
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement(upload_Upload, {
ref: ref,
hasControlInside: hasControlInside,
...restProps,
style: mergedStyle,
type: "drag"
}, children);
});
if (true) {
Dragger.displayName = 'Dragger';
}
/* harmony default export */ var upload_Dragger = (Dragger);
;// ./components/upload/index.tsx
const components_upload_Upload = upload_Upload;
components_upload_Upload.Dragger = upload_Dragger;
components_upload_Upload.LIST_IGNORE = LIST_IGNORE;
/* harmony default export */ var components_upload = (components_upload_Upload);
// EXTERNAL MODULE: ./components/version/index.tsx + 1 modules
var version = __webpack_require__("./components/version/index.tsx");
;// ./node_modules/@rc-component/mutate-observer/es/useMutateObserver.js
const defaultOptions = {
subtree: true,
childList: true,
attributeFilter: ['style', 'class']
};
const useMutateObserver = (nodeOrList, callback, options = defaultOptions) => {
external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(() => {
if (!(0,canUseDom["default"])() || !nodeOrList) {
return;
}
let instance;
const nodeList = Array.isArray(nodeOrList) ? nodeOrList : [nodeOrList];
if ('MutationObserver' in window) {
instance = new MutationObserver(callback);
nodeList.forEach(element => {
instance.observe(element, options);
});
}
return () => {
instance?.takeRecords();
instance?.disconnect();
};
}, [options, nodeOrList]);
};
/* harmony default export */ var es_useMutateObserver = (useMutateObserver);
;// ./node_modules/@rc-component/mutate-observer/es/MutateObserver.js
const MutateObserver = props => {
const {
children,
options,
onMutate = () => {}
} = props;
const callback = (0,useEvent["default"])(onMutate);
const elementRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
const canRef = (0,es_ref.supportNodeRef)(children);
const mergedRef = (0,es_ref.useComposeRef)(elementRef, (0,es_ref.getNodeRef)(children));
const [target, setTarget] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(null);
es_useMutateObserver(target, callback, options);
// =========================== Effect ===========================
(0,useLayoutEffect["default"])(() => {
// Set target based on the refs
if (canRef && elementRef.current) {
setTarget((0,findDOMNode.getDOM)(elementRef.current));
}
}, [canRef]);
// =========================== Render ===========================
if (!children) {
if (true) {
console.error('MutationObserver need children props');
}
return null;
}
return canRef ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(children, {
ref: mergedRef
}) : children;
};
/* harmony default export */ var es_MutateObserver = (MutateObserver);
;// ./node_modules/@rc-component/mutate-observer/es/index.js
/* harmony default export */ var mutate_observer_es = (es_MutateObserver);
;// ./components/watermark/useClips.ts
const FontGap = 3;
const prepareCanvas = (width, height, ratio = 1) => {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const realWidth = width * ratio;
const realHeight = height * ratio;
canvas.setAttribute('width', `${realWidth}px`);
canvas.setAttribute('height', `${realHeight}px`);
ctx.save();
return [ctx, canvas, realWidth, realHeight];
};
// Get boundary of rotated text
const getRotatePos = (x, y, angle) => {
const targetX = x * Math.cos(angle) - y * Math.sin(angle);
const targetY = x * Math.sin(angle) + y * Math.cos(angle);
return [targetX, targetY];
};
/**
* Get the clips of text content.
* This is a lazy hook function since SSR no need this
*/
const useClips = () => {
// Get single clips
const getClips = (content, rotate, ratio, width, height, font, gapX, gapY) => {
// ================= Text / Image =================
const [ctx, canvas, contentWidth, contentHeight] = prepareCanvas(width, height, ratio);
if (content instanceof HTMLImageElement) {
// Image
ctx.drawImage(content, 0, 0, contentWidth, contentHeight);
} else {
// Text
const {
color,
fontSize,
fontStyle,
fontWeight,
fontFamily,
textAlign
} = font;
const mergedFontSize = Number(fontSize) * ratio;
ctx.font = `${fontStyle} normal ${fontWeight} ${mergedFontSize}px/${height}px ${fontFamily}`;
ctx.fillStyle = color;
ctx.textAlign = textAlign;
ctx.textBaseline = 'top';
const contents = _util_toList(content);
contents?.forEach((item, index) => {
ctx.fillText(item ?? '', contentWidth / 2, index * (mergedFontSize + FontGap * ratio));
});
}
// ==================== Rotate ====================
const angle = Math.PI / 180 * Number(rotate);
const maxSize = Math.max(width, height);
const [rCtx, rCanvas, realMaxSize] = prepareCanvas(maxSize, maxSize, ratio);
// Copy from `ctx` and rotate
rCtx.translate(realMaxSize / 2, realMaxSize / 2);
rCtx.rotate(angle);
if (contentWidth > 0 && contentHeight > 0) {
rCtx.drawImage(canvas, -contentWidth / 2, -contentHeight / 2);
}
let left = 0;
let right = 0;
let top = 0;
let bottom = 0;
const halfWidth = contentWidth / 2;
const halfHeight = contentHeight / 2;
const points = [[0 - halfWidth, 0 - halfHeight], [0 + halfWidth, 0 - halfHeight], [0 + halfWidth, 0 + halfHeight], [0 - halfWidth, 0 + halfHeight]];
points.forEach(([x, y]) => {
const [targetX, targetY] = getRotatePos(x, y, angle);
left = Math.min(left, targetX);
right = Math.max(right, targetX);
top = Math.min(top, targetY);
bottom = Math.max(bottom, targetY);
});
const cutLeft = left + realMaxSize / 2;
const cutTop = top + realMaxSize / 2;
const cutWidth = right - left;
const cutHeight = bottom - top;
// ================ Fill Alternate ================
const realGapX = gapX * ratio;
const realGapY = gapY * ratio;
const filledWidth = (cutWidth + realGapX) * 2;
const filledHeight = cutHeight + realGapY;
const [fCtx, fCanvas] = prepareCanvas(filledWidth, filledHeight);
const drawImg = (targetX = 0, targetY = 0) => {
fCtx.drawImage(rCanvas, cutLeft, cutTop, cutWidth, cutHeight, targetX, targetY, cutWidth, cutHeight);
};
drawImg();
drawImg(cutWidth + realGapX, -cutHeight / 2 - realGapY / 2);
drawImg(cutWidth + realGapX, +cutHeight / 2 + realGapY / 2);
return [fCanvas.toDataURL(), filledWidth / ratio, filledHeight / ratio];
};
return external_root_React_commonjs2_react_commonjs_react_amd_react_default().useCallback(getClips, []);
};
/* harmony default export */ var watermark_useClips = (useClips);
;// ./components/watermark/useRafDebounce.ts
/**
* Callback will only execute last one for each raf
*/
function useRafDebounce(callback) {
const executeRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(false);
const rafRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
const wrapperCallback = (0,es.useEvent)(callback);
return () => {
if (executeRef.current) {
return;
}
executeRef.current = true;
wrapperCallback();
rafRef.current = (0,raf["default"])(() => {
executeRef.current = false;
});
};
}
;// ./components/watermark/useSingletonCache.ts
/**
* Singleton cache will only take latest `cacheParams` as key
* and return the result for callback matching.
*/
function useSingletonCache() {
const cacheRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef([null, null]);
const getCache = (cacheKeys, callback) => {
const filteredKeys = cacheKeys.map(item => item instanceof HTMLElement || Number.isNaN(item) ? '' : item);
if (!(0,isEqual["default"])(cacheRef.current[0], filteredKeys)) {
cacheRef.current = [filteredKeys, callback()];
}
return cacheRef.current[1];
};
return getCache;
}
;// ./components/watermark/utils.ts
/** converting camel-cased strings to be lowercase and link it with Separator */
function toLowercaseSeparator(key) {
return key.replace(/([A-Z])/g, '-$1').toLowerCase();
}
function getStyleStr(style) {
return Object.keys(style).map(key => `${toLowercaseSeparator(key)}: ${style[key]};`).join(' ');
}
/** Returns the ratio of the device's physical pixel resolution to the css pixel resolution */
function getPixelRatio() {
return window.devicePixelRatio || 1;
}
/** Whether to re-render the watermark */
const reRendering = (mutation, isWatermarkEle) => {
let flag = false;
// Whether to delete the watermark node
if (mutation.removedNodes.length) {
flag = Array.from(mutation.removedNodes).some(isWatermarkEle);
}
// Whether the watermark dom property value has been modified
if (mutation.type === 'attributes' && isWatermarkEle(mutation.target)) {
flag = true;
}
return flag;
};
;// ./components/watermark/useWatermark.ts
/**
* Base size of the canvas, 1 for parallel layout and 2 for alternate layout
* Only alternate layout is currently supported
*/
const BaseSize = 2;
const useWatermark_FontGap = 3;
// Prevent external hidden elements from adding accent styles
const emphasizedStyle = {
visibility: 'visible !important'
};
const useWatermark_noop = () => {};
function useWatermark(markStyle, onRemove) {
const watermarkMapRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef(new Map());
const onRemoveEvent = (0,es.useEvent)(onRemove ?? useWatermark_noop);
const appendWatermark = (base64Url, markWidth, container) => {
if (container) {
const exist = watermarkMapRef.current.get(container);
if (!exist) {
const newWatermarkEle = document.createElement('div');
watermarkMapRef.current.set(container, newWatermarkEle);
}
const watermarkEle = watermarkMapRef.current.get(container);
watermarkEle.setAttribute('style', getStyleStr({
...markStyle,
backgroundImage: `url('${base64Url}')`,
backgroundSize: `${Math.floor(markWidth)}px`,
...emphasizedStyle
}));
// Prevents using the browser `Hide Element` to hide watermarks
watermarkEle.removeAttribute('class');
watermarkEle.removeAttribute('hidden');
if (watermarkEle.parentElement !== container) {
if (exist && onRemove) {
onRemoveEvent();
}
container.append(watermarkEle);
}
}
return watermarkMapRef.current.get(container);
};
const removeWatermark = container => {
const watermarkEle = watermarkMapRef.current.get(container);
if (watermarkEle && container) {
container.removeChild(watermarkEle);
}
watermarkMapRef.current.delete(container);
};
const isWatermarkEle = ele => Array.from(watermarkMapRef.current.values()).includes(ele);
return [appendWatermark, removeWatermark, isWatermarkEle];
}
/* harmony default export */ var watermark_useWatermark = (useWatermark);
;// ./components/watermark/index.tsx
/**
* Only return `next` when size changed.
* This is only used for elements compare, not a shallow equal!
*/
function getSizeDiff(prev, next) {
return prev.size === next.size ? prev : next;
}
const DEFAULT_GAP_X = 100;
const DEFAULT_GAP_Y = 100;
const fixedStyle = {
position: 'relative',
overflow: 'hidden'
};
const Watermark = props => {
const {
/**
* The antd content layer zIndex is basically below 10
* https://github.com/ant-design/ant-design/blob/6192403b2ce517c017f9e58a32d58774921c10cd/components/style/themes/default.less#L335
*/
zIndex = 9,
rotate = -22,
width,
height,
image,
content,
font = {},
style,
className,
rootClassName,
gap = [DEFAULT_GAP_X, DEFAULT_GAP_Y],
offset,
children,
inherit = true,
onRemove
} = props;
const {
className: contextClassName,
style: contextStyle
} = (0,config_provider_context.useComponentConfig)('watermark');
const mergedStyle = {
...fixedStyle,
...contextStyle,
...style
};
const [, token] = (0,useToken["default"])();
const {
color = token.colorFill,
fontSize = token.fontSizeLG,
fontWeight = 'normal',
fontStyle = 'normal',
fontFamily = 'sans-serif',
textAlign = 'center'
} = font;
const [gapX = DEFAULT_GAP_X, gapY = DEFAULT_GAP_Y] = gap;
const gapXCenter = gapX / 2;
const gapYCenter = gapY / 2;
const offsetLeft = offset?.[0] ?? gapXCenter;
const offsetTop = offset?.[1] ?? gapYCenter;
const markStyle = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
const mergedMarkStyle = {
zIndex,
position: 'absolute',
left: 0,
top: 0,
width: '100%',
height: '100%',
pointerEvents: 'none',
backgroundRepeat: 'repeat'
};
/** Calculate the style of the offset */
let positionLeft = offsetLeft - gapXCenter;
let positionTop = offsetTop - gapYCenter;
if (positionLeft > 0) {
mergedMarkStyle.left = `${positionLeft}px`;
mergedMarkStyle.width = `calc(100% - ${positionLeft}px)`;
positionLeft = 0;
}
if (positionTop > 0) {
mergedMarkStyle.top = `${positionTop}px`;
mergedMarkStyle.height = `calc(100% - ${positionTop}px)`;
positionTop = 0;
}
mergedMarkStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`;
return mergedMarkStyle;
}, [zIndex, offsetLeft, gapXCenter, offsetTop, gapYCenter]);
const [container, setContainer] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState();
// Used for nest case like Modal, Drawer
const [subElements, setSubElements] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(() => new Set());
// Nest elements should also support watermark
const targetElements = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
const list = container ? [container] : [];
return [].concat(list, (0,toConsumableArray["default"])(Array.from(subElements)));
}, [container, subElements]);
// ============================ Content =============================
/**
* Get the width and height of the watermark. The default values are as follows
* Image: [120, 64]; Content: It's calculated by content;
*/
const getMarkSize = ctx => {
let defaultWidth = 120;
let defaultHeight = 64;
if (!image && ctx.measureText) {
ctx.font = `${Number(fontSize)}px ${fontFamily}`;
const contents = _util_toList(content);
const sizes = contents.map(item => {
const metrics = ctx.measureText(item);
return [metrics.width, metrics.fontBoundingBoxAscent + metrics.fontBoundingBoxDescent];
});
defaultWidth = Math.ceil(Math.max.apply(Math, (0,toConsumableArray["default"])(sizes.map(size => size[0]))));
defaultHeight = Math.ceil(Math.max.apply(Math, (0,toConsumableArray["default"])(sizes.map(size => size[1])))) * contents.length + (contents.length - 1) * FontGap;
}
return [width ?? defaultWidth, height ?? defaultHeight];
};
const getClips = watermark_useClips();
const getClipsCache = useSingletonCache();
const [watermarkInfo, setWatermarkInfo] = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState(null);
// Generate new Watermark content
const renderWatermark = () => {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
if (ctx) {
const ratio = getPixelRatio();
const [markWidth, markHeight] = getMarkSize(ctx);
const drawCanvas = drawContent => {
const params = [drawContent || '', rotate, ratio, markWidth, markHeight, {
color,
fontSize,
fontStyle,
fontWeight,
fontFamily,
textAlign
}, gapX, gapY];
const [nextClips, clipWidth] = getClipsCache(params, () => getClips.apply(void 0, params));
setWatermarkInfo([nextClips, clipWidth]);
};
if (image) {
const img = new Image();
img.onload = () => {
drawCanvas(img);
};
img.onerror = () => {
drawCanvas(content);
};
img.crossOrigin = 'anonymous';
img.referrerPolicy = 'no-referrer';
img.src = image;
} else {
drawCanvas(content);
}
}
};
const syncWatermark = useRafDebounce(renderWatermark);
// ============================= Effect =============================
// Append watermark to the container
const [appendWatermark, removeWatermark, isWatermarkEle] = watermark_useWatermark(markStyle, onRemove);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
if (watermarkInfo) {
targetElements.forEach(holder => {
appendWatermark(watermarkInfo[0], watermarkInfo[1], holder);
});
}
}, [watermarkInfo, targetElements]);
// ============================ Observe =============================
const onMutate = (0,es.useEvent)(mutations => {
mutations.forEach(mutation => {
if (reRendering(mutation, isWatermarkEle)) {
syncWatermark();
} else if (mutation.target === container && mutation.attributeName === 'style') {
// We've only force container not modify.
// Not consider nest case.
const keyStyles = Object.keys(fixedStyle);
for (let i = 0; i < keyStyles.length; i += 1) {
const key = keyStyles[i];
const oriValue = mergedStyle[key];
const currentValue = container.style[key];
if (oriValue && oriValue !== currentValue) {
container.style[key] = oriValue;
}
}
}
});
});
es_useMutateObserver(targetElements, onMutate);
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(syncWatermark, [rotate, zIndex, width, height, image, content, color, fontSize, fontWeight, fontStyle, fontFamily, textAlign, gapX, gapY, offsetLeft, offsetTop]);
// ============================ Context =============================
const watermarkContext = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => ({
add: ele => {
setSubElements(prev => {
const clone = new Set(prev);
clone.add(ele);
return getSizeDiff(prev, clone);
});
},
remove: ele => {
removeWatermark(ele);
setSubElements(prev => {
const clone = new Set(prev);
clone.delete(ele);
return getSizeDiff(prev, clone);
});
}
}), []);
// ============================= Render =============================
const childNode = inherit ? (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(watermark_context.Provider, {
value: watermarkContext
}, children)) : children;
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
ref: setContainer,
className: (0,clsx.clsx)(className, contextClassName, rootClassName),
style: mergedStyle
}, childNode);
};
if (true) {
Watermark.displayName = 'Watermark';
}
/* harmony default export */ var watermark = (Watermark);
;// ./components/index.ts
const unstableSetRender = () => {
true ? (0,_util_warning["default"])(false, 'compatible', "antd v6 support React 19 already, it's no need to call the compatible function or just remove `@ant-design/v5-patch-for-react-19`") : 0;
};
// Warning if React is less than 18 (not include 18)
if (true) {
const majorVersion = getReactMajorVersion();
true ? (0,_util_warning["default"])(majorVersion >= 18, 'version', `antd v6 no longer supports React versions below 18. Please upgrade to React 18 or higher.`) : 0;
}
/***/ }),
/***/ "./components/input-number/style/index.ts":
/*!************************************************************!*\
!*** ./components/input-number/style/index.ts + 1 modules ***!
\************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ input_number_style; }
});
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
// EXTERNAL MODULE: ./components/input/style/index.ts
var style = __webpack_require__("./components/input/style/index.ts");
// EXTERNAL MODULE: ./components/input/style/token.ts
var style_token = __webpack_require__("./components/input/style/token.ts");
// EXTERNAL MODULE: ./components/input/style/variants.ts
var variants = __webpack_require__("./components/input/style/variants.ts");
// EXTERNAL MODULE: ./components/style/index.tsx
var components_style = __webpack_require__("./components/style/index.tsx");
// EXTERNAL MODULE: ./components/style/compact-item.ts
var compact_item = __webpack_require__("./components/style/compact-item.ts");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
// EXTERNAL MODULE: ./node_modules/@ant-design/fast-color/es/index.js + 3 modules
var fast_color_es = __webpack_require__("./node_modules/@ant-design/fast-color/es/index.js");
;// ./components/input-number/style/token.ts
const prepareComponentToken = token => {
const handleVisible = token.handleVisible ?? 'auto';
const handleWidth = token.controlHeightSM - token.lineWidth * 2;
return {
...(0,style_token.initComponentToken)(token),
controlWidth: 90,
handleWidth,
handleFontSize: token.fontSize / 2,
handleVisible,
handleActiveBg: token.colorFillAlter,
handleBg: token.colorBgContainer,
filledHandleBg: new fast_color_es.FastColor(token.colorFillSecondary).onBackground(token.colorBgContainer).toHexString(),
handleHoverColor: token.colorPrimary,
handleBorderColor: token.colorBorder,
handleOpacity: handleVisible === true ? 1 : 0,
handleVisibleWidth: handleVisible === true ? handleWidth : 0
};
};
;// ./components/input-number/style/index.ts
const genInputNumberStyles = token => {
const {
componentCls,
lineWidth,
lineType,
borderRadius,
inputFontSizeSM,
inputFontSizeLG,
colorError,
paddingInlineSM,
paddingBlockSM,
paddingBlockLG,
paddingInlineLG,
colorIcon,
colorTextDisabled,
motionDurationMid,
handleHoverColor,
handleOpacity,
paddingInline,
paddingBlock,
handleBg,
handleActiveBg,
inputAffixPadding,
borderRadiusSM,
controlWidth,
handleBorderColor,
filledHandleBg,
lineHeightLG,
antCls
} = token;
const borderStyle = `${(0,cssinjs.unit)(lineWidth)} ${lineType} ${handleBorderColor}`;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'input-number');
return [
// ==========================================================
// == Base ==
// ==========================================================
{
[componentCls]: {
...(0,components_style.resetComponent)(token),
...(0,style.genBasicInputStyle)(token),
[varName('input-padding-block')]: (0,cssinjs.unit)(paddingBlock),
[varName('input-padding-inline')]: (0,cssinjs.unit)(paddingInline),
display: 'inline-flex',
width: controlWidth,
margin: 0,
paddingBlock: 0,
borderRadius,
// ======================= Variants =======================
...(0,variants.genOutlinedStyle)(token, {
[`${componentCls}-actions`]: {
background: handleBg,
[`${componentCls}-action-down`]: {
borderBlockStart: borderStyle
}
}
}),
...(0,variants.genFilledStyle)(token, {
[`${componentCls}-actions`]: {
background: filledHandleBg,
[`${componentCls}-action-down`]: {
borderBlockStart: borderStyle
}
},
'&:focus-within': {
[`${componentCls}-actions`]: {
background: handleBg
}
}
}),
...(0,variants.genUnderlinedStyle)(token, {
[`${componentCls}-actions`]: {
background: handleBg,
[`${componentCls}-action-down`]: {
borderBlockStart: borderStyle
}
}
}),
...(0,variants.genBorderlessStyle)(token),
// InputNumber 两层结构:borderless 补偿只加在内层 input 的 CSS 变量上,避免外层+内层双重 padding 导致高度异常
[`&${componentCls}-borderless`]: {
paddingBlock: 0,
[varName('input-padding-block')]: (0,cssinjs.unit)(token.calc(paddingBlock).add(lineWidth).equal())
},
[`&${componentCls}-borderless${componentCls}-sm`]: {
paddingBlock: 0,
[varName('input-padding-block')]: (0,cssinjs.unit)(token.calc(paddingBlockSM).add(lineWidth).equal())
},
[`&${componentCls}-borderless${componentCls}-lg`]: {
paddingBlock: 0,
[varName('input-padding-block')]: (0,cssinjs.unit)(token.calc(paddingBlockLG).add(lineWidth).equal())
},
// ========================= RTL ==========================
'&-rtl': {
direction: 'rtl',
[`${componentCls}-input`]: {
direction: 'rtl'
}
},
// ===================== Out Of Range =====================
[`&${componentCls}-out-of-range`]: {
[`${componentCls}-input`]: {
color: colorError
}
},
// ======================== Input =========================
[`${componentCls}-input`]: {
...(0,components_style.resetComponent)(token),
width: '100%',
paddingBlock: varRef('input-padding-block'),
textAlign: 'start',
backgroundColor: 'transparent',
border: 0,
borderRadius: 0,
outline: 0,
transition: `all ${motionDurationMid} linear`,
appearance: 'textfield',
fontSize: 'inherit',
lineHeight: 'inherit',
...(0,style.genPlaceholderStyle)(token.colorTextPlaceholder),
'&[type="number"]::-webkit-inner-spin-button, &[type="number"]::-webkit-outer-spin-button': {
margin: 0,
appearance: 'none'
}
},
[`&:hover ${componentCls}-handler-wrap, &-focused ${componentCls}-handler-wrap`]: {
width: token.handleWidth,
opacity: 1
},
// ======================= Disabled =======================
[`&-disabled ${componentCls}-input`]: {
cursor: 'not-allowed',
color: token.colorTextDisabled
}
}
},
// ==========================================================
// == Action ==
// ==========================================================
{
[componentCls]: {
// ======================= Shared =======================
[`${componentCls}-action`]: {
...(0,components_style.resetIcon)(),
userSelect: 'none',
overflow: 'hidden',
fontWeight: 'bold',
lineHeight: 0,
textAlign: 'center',
cursor: 'pointer',
transition: `all ${motionDurationMid} linear`,
// Active: change background not disabled only;
[`&:active:not(${componentCls}-action-up-disabled):not(${componentCls}-action-down-disabled)`]: {
background: handleActiveBg
},
// Hover: change color not disabled only;
[`&:hover:not(${componentCls}-action-up-disabled):not(${componentCls}-action-down-disabled)`]: {
color: handleHoverColor
},
[`&${componentCls}-action-up-disabled, &${componentCls}-action-down-disabled`]: {
cursor: 'not-allowed',
color: colorTextDisabled
}
},
// ===================== Input Mode =====================
'&-mode-input': {
overflow: 'hidden',
[`${componentCls}-actions`]: {
position: 'absolute',
insetBlockStart: 0,
insetInlineEnd: 0,
width: token.handleVisibleWidth,
opacity: handleOpacity,
height: '100%',
borderRadius: 0,
display: 'flex',
flexDirection: 'column',
alignItems: 'stretch',
transition: `all ${motionDurationMid}`,
overflow: 'hidden',
// Fix input number inside Menu makes icon too large
// We arise the selector priority by nest selector here
// https://github.com/ant-design/ant-design/issues/14367
[`${componentCls}-action`]: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
flex: 'auto',
height: '40%',
marginInlineEnd: 0,
fontSize: token.handleFontSize
}
},
[`&:hover ${componentCls}-actions, &-focused ${componentCls}-actions`]: {
width: token.handleWidth,
opacity: 1
},
[`${componentCls}-action`]: {
color: colorIcon,
height: '50%',
borderInlineStart: borderStyle,
// Hover: change height not disabled only;
[`&:hover:not(${componentCls}-action-up-disabled):not(${componentCls}-action-down-disabled)`]: {
height: `60%`
}
},
[`&${componentCls}-disabled, &${componentCls}-readonly`]: {
[`${componentCls}-actions`]: {
display: 'none'
}
}
},
// ==================== Spinner Mode ====================
[`&${componentCls}-mode-spinner`]: {
padding: 0,
width: 'auto',
[`${componentCls}-action`]: {
flex: 'none',
paddingInline: varRef('input-padding-inline'),
'&-up': {
borderInlineStart: borderStyle
},
'&-down': {
borderInlineEnd: borderStyle
}
},
[`${componentCls}-input`]: {
textAlign: 'center',
paddingInline: varRef('input-padding-inline')
}
}
}
},
// ==========================================================
// == Size ==
// ==========================================================
{
[componentCls]: {
'&-lg': {
[varName('input-padding-block')]: (0,cssinjs.unit)(paddingBlockLG),
[varName('input-padding-inline')]: (0,cssinjs.unit)(paddingInlineLG),
paddingBlock: 0,
fontSize: inputFontSizeLG,
lineHeight: lineHeightLG
},
'&-sm': {
[varName('input-padding-block')]: (0,cssinjs.unit)(paddingBlockSM),
[varName('input-padding-inline')]: (0,cssinjs.unit)(paddingInlineSM),
paddingBlock: 0,
fontSize: inputFontSizeSM,
borderRadius: borderRadiusSM
}
}
},
// ==========================================================
// == Pre/Suffix ==
// ==========================================================
{
[componentCls]: {
[`${componentCls}-prefix, ${componentCls}-suffix`]: {
display: 'flex',
flex: 'none',
alignItems: 'center',
alignSelf: 'center',
pointerEvents: 'none'
},
[`${componentCls}-prefix`]: {
marginInlineEnd: inputAffixPadding
},
[`${componentCls}-suffix`]: {
height: '100%',
marginInlineStart: inputAffixPadding,
transition: `margin ${motionDurationMid}`
},
[`&:hover:not(${componentCls}-without-controls)`]: {
[`${componentCls}-suffix`]: {
marginInlineEnd: token.handleWidth
}
}
}
}];
};
const genCompatibleStyles = token => {
const {
componentCls,
antCls
} = token;
return {
[`${componentCls}-addon`]: {
[`&:has(${antCls}-select)`]: {
border: 0,
padding: 0
}
}
};
};
/* harmony default export */ var input_number_style = ((0,genStyleUtils.genStyleHooks)('InputNumber', token => {
const inputNumberToken = (0,es.mergeToken)(token, (0,style_token.initInputToken)(token));
return [genInputNumberStyles(inputNumberToken), genCompatibleStyles(inputNumberToken),
// =====================================================
// == Space Compact ==
// =====================================================
(0,compact_item.genCompactItemStyle)(inputNumberToken)];
}, prepareComponentToken, {
unitless: {
handleOpacity: true
},
resetFont: false
}));
/***/ }),
/***/ "./components/input/style/index.ts":
/*!*****************************************!*\
!*** ./components/input/style/index.ts ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ genActiveStyle: function() { return /* binding */ genActiveStyle; },
/* harmony export */ genAffixStyle: function() { return /* binding */ genAffixStyle; },
/* harmony export */ genBasicInputStyle: function() { return /* binding */ genBasicInputStyle; },
/* harmony export */ genInputGroupStyle: function() { return /* binding */ genInputGroupStyle; },
/* harmony export */ genInputLargeStyle: function() { return /* binding */ genInputLargeStyle; },
/* harmony export */ genInputSmallStyle: function() { return /* binding */ genInputSmallStyle; },
/* harmony export */ genInputStyle: function() { return /* binding */ genInputStyle; },
/* harmony export */ genPlaceholderStyle: function() { return /* binding */ genPlaceholderStyle; },
/* harmony export */ initComponentToken: function() { return /* reexport safe */ _token__WEBPACK_IMPORTED_MODULE_5__.initComponentToken; },
/* harmony export */ initInputToken: function() { return /* reexport safe */ _token__WEBPACK_IMPORTED_MODULE_5__.initInputToken; },
/* harmony export */ useSharedStyle: function() { return /* binding */ useSharedStyle; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _style_compact_item__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../style/compact-item */ "./components/style/compact-item.ts");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
/* harmony import */ var _token__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./token */ "./components/input/style/token.ts");
/* harmony import */ var _variants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variants */ "./components/input/style/variants.ts");
const genPlaceholderStyle = color => ({
// Firefox
'&::-moz-placeholder': {
opacity: 1
},
'&::placeholder': {
color,
userSelect: 'none' // https://github.com/ant-design/ant-design/pull/32639
},
'&:placeholder-shown': {
textOverflow: 'ellipsis'
}
});
const genActiveStyle = token => ({
borderColor: token.activeBorderColor,
boxShadow: token.activeShadow,
outline: 0,
backgroundColor: token.activeBg
});
const genInputLargeStyle = token => {
const {
paddingBlockLG,
lineHeightLG,
borderRadiusLG,
paddingInlineLG
} = token;
return {
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingBlockLG)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingInlineLG)}`,
fontSize: token.inputFontSizeLG,
lineHeight: lineHeightLG,
borderRadius: borderRadiusLG
};
};
const genInputSmallStyle = token => ({
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingBlockSM)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingInlineSM)}`,
fontSize: token.inputFontSizeSM,
borderRadius: token.borderRadiusSM
});
const genBasicInputStyle = (token, option = {}) => ({
position: 'relative',
display: 'inline-block',
width: '100%',
minWidth: 0,
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingBlock)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingInline)}`,
color: token.colorText,
fontSize: token.inputFontSize,
lineHeight: token.lineHeight,
borderRadius: token.borderRadius,
transition: `all ${token.motionDurationMid}`,
...genPlaceholderStyle(token.colorTextPlaceholder),
// Size
'&-lg': {
...genInputLargeStyle(token),
...option.largeStyle
},
'&-sm': {
...genInputSmallStyle(token),
...option.smallStyle
},
// RTL
'&-rtl, &-textarea-rtl': {
direction: 'rtl'
}
});
const genInputGroupStyle = token => {
const {
componentCls,
antCls
} = token;
return {
position: 'relative',
display: 'table',
width: '100%',
borderCollapse: 'separate',
borderSpacing: 0,
// Undo padding and float of grid classes
"&[class*='col-']": {
paddingInlineEnd: token.paddingXS,
'&:last-child': {
paddingInlineEnd: 0
}
},
// Sizing options
[`&-lg ${componentCls}, &-lg > ${componentCls}-group-addon`]: {
...genInputLargeStyle(token)
},
[`&-sm ${componentCls}, &-sm > ${componentCls}-group-addon`]: {
...genInputSmallStyle(token)
},
// Fix https://github.com/ant-design/ant-design/issues/5754
[`&-lg ${antCls}-select-single`]: {
height: token.controlHeightLG
},
[`&-sm ${antCls}-select-single`]: {
height: token.controlHeightSM
},
[`> ${componentCls}`]: {
display: 'table-cell',
'&:not(:first-child):not(:last-child)': {
borderRadius: 0
}
},
[`${componentCls}-group`]: {
'&-addon, &-wrap': {
display: 'table-cell',
width: 1,
whiteSpace: 'nowrap',
verticalAlign: 'middle',
'&:not(:first-child):not(:last-child)': {
borderRadius: 0
}
},
'&-wrap > *': {
display: 'block !important'
},
'&-addon': {
position: 'relative',
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingInline)}`,
color: token.colorText,
fontWeight: 'normal',
fontSize: token.inputFontSize,
textAlign: 'center',
borderRadius: token.borderRadius,
transition: `all ${token.motionDurationSlow}`,
lineHeight: 1,
// Reset Select's style in addon
[`${antCls}-select`]: {
margin: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(token.paddingBlock).add(1).mul(-1).equal())} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(token.paddingInline).mul(-1).equal())}`,
[`&${antCls}-select-single:not(${antCls}-select-customize-input):not(${antCls}-pagination-size-changer)`]: {
backgroundColor: 'inherit',
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} transparent`,
boxShadow: 'none'
}
},
// https://github.com/ant-design/ant-design/issues/31333
[`${antCls}-cascader-picker`]: {
margin: `-9px ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(token.paddingInline).mul(-1).equal())}`,
backgroundColor: 'transparent',
[`${antCls}-cascader-input`]: {
textAlign: 'start',
border: 0,
boxShadow: 'none'
}
}
}
},
[componentCls]: {
width: '100%',
marginBottom: 0,
textAlign: 'inherit',
'&:focus': {
zIndex: 1,
// Fix https://gw.alipayobjects.com/zos/rmsportal/DHNpoqfMXSfrSnlZvhsJ.png
borderInlineEndWidth: 1
},
'&:hover': {
zIndex: 1,
borderInlineEndWidth: 1
}
},
// Reset rounded corners
[`> ${componentCls}:first-child, ${componentCls}-group-addon:first-child`]: {
borderStartEndRadius: 0,
borderEndEndRadius: 0,
// Reset Select's style in addon
[`${antCls}-select`]: {
borderStartEndRadius: 0,
borderEndEndRadius: 0
}
},
[`> ${componentCls}-affix-wrapper`]: {
[`&:not(:first-child) ${componentCls}`]: {
borderStartStartRadius: 0,
borderEndStartRadius: 0
},
[`&:not(:last-child) ${componentCls}`]: {
borderStartEndRadius: 0,
borderEndEndRadius: 0
}
},
[`> ${componentCls}:last-child, ${componentCls}-group-addon:last-child`]: {
borderStartStartRadius: 0,
borderEndStartRadius: 0,
// Reset Select's style in addon
[`${antCls}-select`]: {
borderStartStartRadius: 0,
borderEndStartRadius: 0
}
},
[`${componentCls}-affix-wrapper`]: {
'&:not(:last-child)': {
borderStartEndRadius: 0,
borderEndEndRadius: 0
},
'&:not(:first-child)': {
borderStartStartRadius: 0,
borderEndStartRadius: 0
}
},
[`&${componentCls}-group-compact`]: {
display: 'block',
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.clearFix)(),
[`${componentCls}-group-addon, ${componentCls}-group-wrap, > ${componentCls}`]: {
'&:not(:first-child):not(:last-child)': {
borderInlineEndWidth: token.lineWidth,
'&:hover, &:focus': {
zIndex: 1
}
}
},
'& > *': {
display: 'inline-flex',
float: 'none',
verticalAlign: 'top',
// https://github.com/ant-design/ant-design-pro/issues/139
borderRadius: 0
},
[`
& > ${componentCls}-affix-wrapper,
& > ${componentCls}-number-affix-wrapper,
& > ${antCls}-picker-range
`]: {
display: 'inline-flex'
},
'& > *:not(:last-child)': {
marginInlineEnd: token.calc(token.lineWidth).mul(-1).equal(),
borderInlineEndWidth: token.lineWidth
},
// Undo float for .ant-input-group .ant-input
[componentCls]: {
float: 'none'
},
// reset border for Select, DatePicker, AutoComplete, Cascader, Mention, TimePicker, Input
[`& > ${antCls}-select,
& > ${antCls}-select-auto-complete ${componentCls},
& > ${antCls}-cascader-picker ${componentCls},
& > ${componentCls}-group-wrapper ${componentCls}`]: {
borderInlineEndWidth: token.lineWidth,
borderRadius: 0,
'&:hover, &:focus': {
zIndex: 1
}
},
[`& > ${antCls}-select-focused`]: {
zIndex: 1
},
// update z-index for arrow icon
[`& > ${antCls}-select > ${antCls}-select-arrow`]: {
zIndex: 1 // https://github.com/ant-design/ant-design/issues/20371
},
[`& > *:first-child,
& > ${antCls}-select:first-child,
& > ${antCls}-select-auto-complete:first-child ${componentCls},
& > ${antCls}-cascader-picker:first-child ${componentCls}`]: {
borderStartStartRadius: token.borderRadius,
borderEndStartRadius: token.borderRadius
},
[`& > *:last-child,
& > ${antCls}-select:last-child,
& > ${antCls}-cascader-picker:last-child ${componentCls},
& > ${antCls}-cascader-picker-focused:last-child ${componentCls}`]: {
borderInlineEndWidth: token.lineWidth,
borderStartEndRadius: token.borderRadius,
borderEndEndRadius: token.borderRadius
},
// https://github.com/ant-design/ant-design/issues/12493
[`& > ${antCls}-select-auto-complete ${componentCls}`]: {
verticalAlign: 'top'
},
[`${componentCls}-group-wrapper + ${componentCls}-group-wrapper`]: {
marginInlineStart: token.calc(token.lineWidth).mul(-1).equal(),
[`${componentCls}-affix-wrapper`]: {
// borderRadius: 0,
}
}
}
};
};
const genInputStyle = token => {
const {
componentCls,
controlHeightSM,
lineWidth,
calc
} = token;
const FIXED_CHROME_COLOR_HEIGHT = 16;
const colorSmallPadding = calc(controlHeightSM).sub(calc(lineWidth).mul(2)).sub(FIXED_CHROME_COLOR_HEIGHT).div(2).equal();
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
...genBasicInputStyle(token),
// Variants
...(0,_variants__WEBPACK_IMPORTED_MODULE_6__.genOutlinedStyle)(token),
...(0,_variants__WEBPACK_IMPORTED_MODULE_6__.genFilledStyle)(token),
...(0,_variants__WEBPACK_IMPORTED_MODULE_6__.genBorderlessStyle)(token),
...(0,_variants__WEBPACK_IMPORTED_MODULE_6__.genUnderlinedStyle)(token),
'&[type="color"]': {
height: token.controlHeight,
[`&${componentCls}-lg`]: {
height: token.controlHeightLG
},
[`&${componentCls}-sm`]: {
height: controlHeightSM,
paddingTop: colorSmallPadding,
paddingBottom: colorSmallPadding
}
},
'&[type="search"]::-webkit-search-cancel-button, &[type="search"]::-webkit-search-decoration': {
appearance: 'none'
}
}
};
};
const genAllowClearStyle = token => {
const {
componentCls
} = token;
return {
// ========================= Input =========================
[`${componentCls}-clear-icon`]: {
margin: 0,
padding: 0,
lineHeight: 0,
color: token.colorTextQuaternary,
fontSize: token.fontSizeIcon,
verticalAlign: -1,
// https://github.com/ant-design/ant-design/pull/18151
// https://codesandbox.io/s/wizardly-sun-u10br
cursor: 'pointer',
transition: `color ${token.motionDurationSlow}`,
border: 'none',
outline: 'none',
backgroundColor: 'transparent',
'&:hover': {
color: token.colorIcon
},
'&:focus-visible': {
color: token.colorIcon,
borderRadius: token.borderRadiusSM,
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.genFocusOutline)(token)
},
'&:active': {
color: token.colorText
},
'&-hidden': {
visibility: 'hidden'
},
'&-has-suffix': {
margin: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.inputAffixPadding)}`
}
}
};
};
const genAffixStyle = token => {
const {
componentCls,
inputAffixPadding,
colorTextDescription,
motionDurationSlow,
colorIcon,
colorIconHover,
iconCls
} = token;
const affixCls = `${componentCls}-affix-wrapper`;
const affixClsDisabled = `${componentCls}-affix-wrapper-disabled`;
return {
[affixCls]: {
...genBasicInputStyle(token),
display: 'inline-flex',
'&-focused, &:focus': {
zIndex: 1
},
[`> input${componentCls}`]: {
padding: 0
},
[`> input${componentCls}, > textarea${componentCls}`]: {
fontSize: 'inherit',
border: 'none',
borderRadius: 0,
outline: 'none',
background: 'transparent',
color: 'inherit',
'&::-ms-reveal': {
display: 'none'
},
'&:focus': {
boxShadow: 'none !important'
}
},
'&::before': {
display: 'inline-block',
width: 0,
visibility: 'hidden',
content: '"\\a0"'
},
[componentCls]: {
'&-prefix, &-suffix': {
display: 'flex',
flex: 'none',
alignItems: 'center',
'> *:not(:last-child)': {
marginInlineEnd: token.paddingXS
}
},
'&-show-count-suffix': {
color: colorTextDescription,
direction: 'ltr'
},
'&-show-count-has-suffix': {
marginInlineEnd: token.paddingXXS
},
'&-prefix': {
marginInlineEnd: inputAffixPadding
},
'&-suffix': {
marginInlineStart: inputAffixPadding
}
},
...genAllowClearStyle(token),
// password
[`${iconCls}${componentCls}-password-icon`]: {
color: colorIcon,
cursor: 'pointer',
transition: `all ${motionDurationSlow}`,
'&:hover': {
color: colorIconHover
}
}
},
// 覆盖 affix-wrapper borderRadius!
[`${componentCls}-underlined`]: {
borderRadius: 0
},
[affixClsDisabled]: {
// password disabled
[`${iconCls}${componentCls}-password-icon`]: {
color: colorIcon,
cursor: 'not-allowed',
'&:hover': {
color: colorIcon
}
}
}
};
};
const genGroupStyle = token => {
const {
componentCls,
borderRadiusLG,
borderRadiusSM
} = token;
return {
[`${componentCls}-group`]: {
// Style for input-group: input with label, with button or dropdown...
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
...genInputGroupStyle(token),
'&-rtl': {
direction: 'rtl'
},
'&-wrapper': {
display: 'inline-block',
width: '100%',
textAlign: 'start',
verticalAlign: 'top',
// https://github.com/ant-design/ant-design/issues/6403
'&-rtl': {
direction: 'rtl'
},
// Size
'&-lg': {
[`${componentCls}-group-addon`]: {
borderRadius: borderRadiusLG,
fontSize: token.inputFontSizeLG
}
},
'&-sm': {
[`${componentCls}-group-addon`]: {
borderRadius: borderRadiusSM
}
},
// Variants
...(0,_variants__WEBPACK_IMPORTED_MODULE_6__.genOutlinedGroupStyle)(token),
...(0,_variants__WEBPACK_IMPORTED_MODULE_6__.genFilledGroupStyle)(token),
// '&-disabled': {
// [`${componentCls}-group-addon`]: {
// ...genDisabledStyle(token),
// },
// },
// Fix the issue of using icons in Space Compact mode
// https://github.com/ant-design/ant-design/issues/42122
[`&:not(${componentCls}-compact-first-item):not(${componentCls}-compact-last-item)${componentCls}-compact-item`]: {
[`${componentCls}, ${componentCls}-group-addon`]: {
borderRadius: 0
}
},
[`&:not(${componentCls}-compact-last-item)${componentCls}-compact-first-item`]: {
[`${componentCls}, ${componentCls}-group-addon`]: {
borderStartEndRadius: 0,
borderEndEndRadius: 0
}
},
[`&:not(${componentCls}-compact-first-item)${componentCls}-compact-last-item`]: {
[`${componentCls}, ${componentCls}-group-addon`]: {
borderStartStartRadius: 0,
borderEndStartRadius: 0
}
},
// Fix the issue of input use show-count param in space compact mode
// https://github.com/ant-design/ant-design/issues/46872
[`&:not(${componentCls}-compact-last-item)${componentCls}-compact-item`]: {
[`${componentCls}-affix-wrapper`]: {
borderStartEndRadius: 0,
borderEndEndRadius: 0
}
},
// Fix the issue of input use `addonAfter` param in space compact mode
// https://github.com/ant-design/ant-design/issues/52483
[`&:not(${componentCls}-compact-first-item)${componentCls}-compact-item`]: {
[`${componentCls}-affix-wrapper`]: {
borderStartStartRadius: 0,
borderEndStartRadius: 0
}
}
}
}
};
};
// ============================== Range ===============================
const genRangeStyle = token => {
const {
componentCls
} = token;
return {
[`${componentCls}-out-of-range`]: {
[`&, & input, & textarea, ${componentCls}-show-count-suffix, ${componentCls}-data-count`]: {
color: token.colorError
}
}
};
};
// ============================== Export ==============================
const useSharedStyle = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_4__.genStyleHooks)(['Input', 'Shared'], token => {
const inputToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.mergeToken)(token, (0,_token__WEBPACK_IMPORTED_MODULE_5__.initInputToken)(token));
return [genInputStyle(inputToken), genAffixStyle(inputToken)];
}, _token__WEBPACK_IMPORTED_MODULE_5__.initComponentToken, {
resetFont: false
});
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_4__.genStyleHooks)(['Input', 'Component'], token => {
const inputToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.mergeToken)(token, (0,_token__WEBPACK_IMPORTED_MODULE_5__.initInputToken)(token));
return [genGroupStyle(inputToken), genRangeStyle(inputToken),
// =====================================================
// == Space Compact ==
// =====================================================
(0,_style_compact_item__WEBPACK_IMPORTED_MODULE_2__.genCompactItemStyle)(inputToken, {
focus: true,
focusElCls: `${inputToken.componentCls}-affix-wrapper-focused`
})];
}, _token__WEBPACK_IMPORTED_MODULE_5__.initComponentToken, {
resetFont: false
}));
/***/ }),
/***/ "./components/input/style/token.ts":
/*!*****************************************!*\
!*** ./components/input/style/token.ts ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ initComponentToken: function() { return /* binding */ initComponentToken; },
/* harmony export */ initInputToken: function() { return /* binding */ initInputToken; }
/* harmony export */ });
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
function initInputToken(token) {
return (0,_theme_internal__WEBPACK_IMPORTED_MODULE_0__.mergeToken)(token, {
inputAffixPadding: token.paddingXXS
});
}
const initComponentToken = token => {
const {
controlHeight,
fontSize,
lineHeight,
lineWidth,
controlHeightSM,
controlHeightLG,
fontSizeLG,
lineHeightLG,
paddingSM,
controlPaddingHorizontalSM,
controlPaddingHorizontal,
colorFillAlter,
colorPrimaryHover,
colorPrimary,
controlOutlineWidth,
controlOutline,
colorErrorOutline,
colorWarningOutline,
colorBgContainer,
inputFontSize,
inputFontSizeLG,
inputFontSizeSM
} = token;
const mergedFontSize = inputFontSize || fontSize;
const mergedFontSizeSM = inputFontSizeSM || mergedFontSize;
const mergedFontSizeLG = inputFontSizeLG || fontSizeLG;
const paddingBlock = Math.round((controlHeight - mergedFontSize * lineHeight) / 2 * 10) / 10 - lineWidth;
const paddingBlockSM = Math.round((controlHeightSM - mergedFontSizeSM * lineHeight) / 2 * 10) / 10 - lineWidth;
const paddingBlockLG = Math.ceil((controlHeightLG - mergedFontSizeLG * lineHeightLG) / 2 * 10) / 10 - lineWidth;
return {
paddingBlock: Math.max(paddingBlock, 0),
paddingBlockSM: Math.max(paddingBlockSM, 0),
paddingBlockLG: Math.max(paddingBlockLG, 0),
paddingInline: paddingSM - lineWidth,
paddingInlineSM: controlPaddingHorizontalSM - lineWidth,
paddingInlineLG: controlPaddingHorizontal - lineWidth,
addonBg: colorFillAlter,
activeBorderColor: colorPrimary,
hoverBorderColor: colorPrimaryHover,
activeShadow: `0 0 0 ${controlOutlineWidth}px ${controlOutline}`,
errorActiveShadow: `0 0 0 ${controlOutlineWidth}px ${colorErrorOutline}`,
warningActiveShadow: `0 0 0 ${controlOutlineWidth}px ${colorWarningOutline}`,
hoverBg: colorBgContainer,
activeBg: colorBgContainer,
inputFontSize: mergedFontSize,
inputFontSizeLG: mergedFontSizeLG,
inputFontSizeSM: mergedFontSizeSM
};
};
/***/ }),
/***/ "./components/input/style/variants.ts":
/*!********************************************!*\
!*** ./components/input/style/variants.ts ***!
\********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ genBaseOutlinedStyle: function() { return /* binding */ genBaseOutlinedStyle; },
/* harmony export */ genBorderlessStyle: function() { return /* binding */ genBorderlessStyle; },
/* harmony export */ genDisabledStyle: function() { return /* binding */ genDisabledStyle; },
/* harmony export */ genFilledGroupStyle: function() { return /* binding */ genFilledGroupStyle; },
/* harmony export */ genFilledStyle: function() { return /* binding */ genFilledStyle; },
/* harmony export */ genOutlinedGroupStyle: function() { return /* binding */ genOutlinedGroupStyle; },
/* harmony export */ genOutlinedStyle: function() { return /* binding */ genOutlinedStyle; },
/* harmony export */ genUnderlinedStyle: function() { return /* binding */ genUnderlinedStyle; }
/* harmony export */ });
/* unused harmony exports genHoverStyle, genBaseUnderlinedStyle */
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
const genHoverStyle = token => ({
borderColor: token.hoverBorderColor,
backgroundColor: token.hoverBg
});
const genDisabledStyle = token => ({
color: token.colorTextDisabled,
backgroundColor: token.colorBgContainerDisabled,
borderColor: token.colorBorderDisabled,
boxShadow: 'none',
cursor: 'not-allowed',
opacity: 1,
'input[disabled], textarea[disabled]': {
cursor: 'not-allowed'
},
'&:hover:not([disabled])': {
...genHoverStyle((0,_theme_internal__WEBPACK_IMPORTED_MODULE_1__.mergeToken)(token, {
hoverBorderColor: token.colorBorderDisabled,
hoverBg: token.colorBgContainerDisabled
}))
}
});
/* ============== Outlined ============== */
const genBaseOutlinedStyle = (token, options) => ({
background: token.colorBgContainer,
borderWidth: token.lineWidth,
borderStyle: token.lineType,
borderColor: options.borderColor,
'&:hover': {
borderColor: options.hoverBorderColor,
backgroundColor: token.hoverBg
},
'&:focus, &:focus-within': {
borderColor: options.activeBorderColor,
boxShadow: options.activeShadow,
outline: 0,
backgroundColor: token.activeBg
}
});
const genOutlinedStatusStyle = (token, options) => ({
[`&${token.componentCls}-status-${options.status}:not(${token.componentCls}-disabled)`]: {
...genBaseOutlinedStyle(token, options),
[`${token.componentCls}-prefix, ${token.componentCls}-suffix`]: {
color: options.affixColor
}
},
[`&${token.componentCls}-status-${options.status}${token.componentCls}-disabled`]: {
borderColor: options.borderColor
}
});
const genOutlinedStyle = (token, extraStyles) => ({
'&-outlined': {
...genBaseOutlinedStyle(token, {
borderColor: token.colorBorder,
hoverBorderColor: token.hoverBorderColor,
activeBorderColor: token.activeBorderColor,
activeShadow: token.activeShadow
}),
[`&${token.componentCls}-disabled, &[disabled]`]: {
...genDisabledStyle(token)
},
...genOutlinedStatusStyle(token, {
status: 'error',
borderColor: token.colorError,
hoverBorderColor: token.colorErrorBorderHover,
activeBorderColor: token.colorError,
activeShadow: token.errorActiveShadow,
affixColor: token.colorError
}),
...genOutlinedStatusStyle(token, {
status: 'warning',
borderColor: token.colorWarning,
hoverBorderColor: token.colorWarningBorderHover,
activeBorderColor: token.colorWarning,
activeShadow: token.warningActiveShadow,
affixColor: token.colorWarning
}),
...extraStyles
}
});
const genOutlinedGroupStatusStyle = (token, options) => ({
[`&${token.componentCls}-group-wrapper-status-${options.status}`]: {
[`${token.componentCls}-group-addon`]: {
borderColor: options.addonBorderColor,
color: options.addonColor
}
}
});
const genOutlinedGroupStyle = token => ({
'&-outlined': {
[`${token.componentCls}-group`]: {
'&-addon': {
background: token.addonBg,
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`
},
'&-addon:first-child': {
borderInlineEnd: 0
},
'&-addon:last-child': {
borderInlineStart: 0
}
},
...genOutlinedGroupStatusStyle(token, {
status: 'error',
addonBorderColor: token.colorError,
addonColor: token.colorErrorText
}),
...genOutlinedGroupStatusStyle(token, {
status: 'warning',
addonBorderColor: token.colorWarning,
addonColor: token.colorWarningText
}),
[`&${token.componentCls}-group-wrapper-disabled`]: {
[`${token.componentCls}-group-addon`]: {
...genDisabledStyle(token)
}
}
}
});
/* ============ Borderless ============ */
const genBorderlessStyle = (token, extraStyles) => {
const {
componentCls
} = token;
return {
'&-borderless': {
background: 'transparent',
border: 'none',
// Compensate for the removed border to maintain consistent height with other components
// (e.g. Select borderless) that keep a transparent border.
paddingBlock: token.calc(token.paddingBlock).add(token.lineWidth).equal(),
[`&${componentCls}-sm, &${componentCls}-affix-wrapper-sm`]: {
paddingBlock: token.calc(token.paddingBlockSM).add(token.lineWidth).equal()
},
[`&${componentCls}-lg, &${componentCls}-affix-wrapper-lg`]: {
paddingBlock: token.calc(token.paddingBlockLG).add(token.lineWidth).equal()
},
'&:focus, &:focus-within': {
outline: 'none'
},
// >>>>> Disabled
[`&${componentCls}-disabled, &[disabled]`]: {
color: token.colorTextDisabled,
cursor: 'not-allowed'
},
// >>>>> Status
[`&${componentCls}-status-error`]: {
'&, & input, & textarea': {
color: token.colorError
}
},
[`&${componentCls}-status-warning`]: {
'&, & input, & textarea': {
color: token.colorWarning
}
},
...extraStyles
}
};
};
/* ============== Filled ============== */
const genBaseFilledStyle = (token, options) => ({
background: options.bg,
borderWidth: token.lineWidth,
borderStyle: token.lineType,
borderColor: 'transparent',
'input&, & input, textarea&, & textarea': {
color: options?.inputColor ?? 'unset'
},
'&:hover': {
background: options.hoverBg
},
'&:focus, &:focus-within': {
outline: 0,
borderColor: options.activeBorderColor,
backgroundColor: token.activeBg
}
});
const genFilledStatusStyle = (token, options) => ({
[`&${token.componentCls}-status-${options.status}:not(${token.componentCls}-disabled)`]: {
...genBaseFilledStyle(token, options),
[`${token.componentCls}-prefix, ${token.componentCls}-suffix`]: {
color: options.affixColor
}
}
});
const genFilledStyle = (token, extraStyles) => ({
'&-filled': {
...genBaseFilledStyle(token, {
bg: token.colorFillTertiary,
hoverBg: token.colorFillSecondary,
activeBorderColor: token.activeBorderColor,
inputColor: token.colorText
}),
[`&${token.componentCls}-disabled, &[disabled]`]: {
...genDisabledStyle(token)
},
...genFilledStatusStyle(token, {
status: 'error',
bg: token.colorErrorBg,
hoverBg: token.colorErrorBgHover,
activeBorderColor: token.colorError,
inputColor: token.colorErrorText,
affixColor: token.colorError
}),
...genFilledStatusStyle(token, {
status: 'warning',
bg: token.colorWarningBg,
hoverBg: token.colorWarningBgHover,
activeBorderColor: token.colorWarning,
inputColor: token.colorWarningText,
affixColor: token.colorWarning
}),
...extraStyles
}
});
const genFilledGroupStatusStyle = (token, options) => ({
[`&${token.componentCls}-group-wrapper-status-${options.status}`]: {
[`${token.componentCls}-group-addon`]: {
background: options.addonBg,
color: options.addonColor
}
}
});
const genFilledGroupStyle = token => ({
'&-filled': {
[`${token.componentCls}-group-addon`]: {
background: token.colorFillTertiary,
'&:last-child': {
position: 'static'
}
},
...genFilledGroupStatusStyle(token, {
status: 'error',
addonBg: token.colorErrorBg,
addonColor: token.colorErrorText
}),
...genFilledGroupStatusStyle(token, {
status: 'warning',
addonBg: token.colorWarningBg,
addonColor: token.colorWarningText
}),
[`&${token.componentCls}-group-wrapper-disabled`]: {
[`${token.componentCls}-group`]: {
'&-addon': {
background: token.colorFillTertiary,
color: token.colorTextDisabled
},
'&-addon:first-child': {
borderInlineStart: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
borderTop: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
borderBottom: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`
},
'&-addon:last-child': {
borderInlineEnd: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
borderTop: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
borderBottom: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`
}
}
}
}
});
/* ============== Underlined ============== */
// https://github.com/ant-design/ant-design/issues/51379
const genBaseUnderlinedStyle = (token, options) => ({
background: token.colorBgContainer,
borderWidth: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} 0`,
borderStyle: `${token.lineType} none`,
borderColor: `transparent transparent ${options.borderColor} transparent`,
borderRadius: 0,
'&:hover': {
borderColor: `transparent transparent ${options.hoverBorderColor} transparent`,
backgroundColor: token.hoverBg
},
'&:focus, &:focus-within': {
borderColor: `transparent transparent ${options.activeBorderColor} transparent`,
outline: 0,
backgroundColor: token.activeBg
}
});
const genUnderlinedStatusStyle = (token, options) => ({
[`&${token.componentCls}-status-${options.status}:not(${token.componentCls}-disabled)`]: {
...genBaseUnderlinedStyle(token, options),
[`${token.componentCls}-prefix, ${token.componentCls}-suffix`]: {
color: options.affixColor
}
},
[`&${token.componentCls}-status-${options.status}${token.componentCls}-disabled`]: {
borderColor: `transparent transparent ${options.borderColor} transparent`
}
});
const genUnderlinedStyle = (token, extraStyles) => ({
'&-underlined': {
...genBaseUnderlinedStyle(token, {
borderColor: token.colorBorder,
hoverBorderColor: token.hoverBorderColor,
activeBorderColor: token.activeBorderColor,
activeShadow: token.activeShadow
}),
// >>>>> Disabled
[`&${token.componentCls}-disabled, &[disabled]`]: {
color: token.colorTextDisabled,
boxShadow: 'none',
cursor: 'not-allowed',
'&:hover': {
borderColor: `transparent transparent ${token.colorBorder} transparent`
}
},
'input[disabled], textarea[disabled]': {
cursor: 'not-allowed'
},
...genUnderlinedStatusStyle(token, {
status: 'error',
borderColor: token.colorError,
hoverBorderColor: token.colorErrorBorderHover,
activeBorderColor: token.colorError,
activeShadow: token.errorActiveShadow,
affixColor: token.colorError
}),
...genUnderlinedStatusStyle(token, {
status: 'warning',
borderColor: token.colorWarning,
hoverBorderColor: token.colorWarningBorderHover,
activeBorderColor: token.colorWarning,
activeShadow: token.warningActiveShadow,
affixColor: token.colorWarning
}),
...extraStyles
}
});
/***/ }),
/***/ "./components/layout/style/index.ts":
/*!******************************************!*\
!*** ./components/layout/style/index.ts ***!
\******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ DEPRECATED_TOKENS: function() { return /* binding */ DEPRECATED_TOKENS; },
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const genLayoutStyle = token => {
const {
antCls,
// .ant
componentCls,
// .ant-layout
colorText,
footerBg,
headerHeight,
headerPadding,
headerColor,
footerPadding,
fontSize,
bodyBg,
headerBg
} = token;
return {
[componentCls]: {
display: 'flex',
flex: 'auto',
flexDirection: 'column',
/* fix firefox can't set height smaller than content on flex item */
minHeight: 0,
background: bodyBg,
'&, *': {
boxSizing: 'border-box'
},
[`&${componentCls}-has-sider`]: {
flexDirection: 'row',
[`> ${componentCls}, > ${componentCls}-content`]: {
// https://segmentfault.com/a/1190000019498300
width: 0
}
},
[`${componentCls}-header, &${componentCls}-footer`]: {
flex: '0 0 auto'
},
// RTL
'&-rtl': {
direction: 'rtl'
}
},
// ==================== Header ====================
[`${componentCls}-header`]: {
height: headerHeight,
padding: headerPadding,
color: headerColor,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(headerHeight),
background: headerBg,
// Other components/menu/style/index.less line:686
// Integration with header element so menu items have the same height
[`${antCls}-menu`]: {
lineHeight: 'inherit'
}
},
// ==================== Footer ====================
[`${componentCls}-footer`]: {
padding: footerPadding,
color: colorText,
fontSize,
background: footerBg
},
// =================== Content ====================
[`${componentCls}-content`]: {
flex: 'auto',
color: colorText,
// fix firefox can't set height smaller than content on flex item
minHeight: 0
}
};
};
const prepareComponentToken = token => {
const {
colorBgLayout,
controlHeight,
controlHeightLG,
colorText,
controlHeightSM,
marginXXS,
colorTextLightSolid,
colorBgContainer
} = token;
const paddingInline = controlHeightLG * 1.25;
return {
// Deprecated
colorBgHeader: '#001529',
colorBgBody: colorBgLayout,
colorBgTrigger: '#002140',
bodyBg: colorBgLayout,
headerBg: '#001529',
headerHeight: controlHeight * 2,
headerPadding: `0 ${paddingInline}px`,
headerColor: colorText,
footerPadding: `${controlHeightSM}px ${paddingInline}px`,
footerBg: colorBgLayout,
siderBg: '#001529',
triggerHeight: controlHeightLG + marginXXS * 2,
triggerBg: '#002140',
triggerColor: colorTextLightSolid,
zeroTriggerWidth: controlHeightLG,
zeroTriggerHeight: controlHeightLG,
lightSiderBg: colorBgContainer,
lightTriggerBg: colorBgContainer,
lightTriggerColor: colorText
};
};
// ============================== Export ==============================
const DEPRECATED_TOKENS = [['colorBgBody', 'bodyBg'], ['colorBgHeader', 'headerBg'], ['colorBgTrigger', 'triggerBg']];
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_1__.genStyleHooks)('Layout', genLayoutStyle, prepareComponentToken, {
deprecatedTokens: DEPRECATED_TOKENS
}));
/***/ }),
/***/ "./components/list/style/index.ts":
/*!****************************************!*\
!*** ./components/list/style/index.ts ***!
\****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const genBorderedStyle = token => {
const {
listBorderedCls,
componentCls,
paddingLG,
margin,
itemPaddingSM,
itemPaddingLG,
marginLG,
borderRadiusLG
} = token;
const innerCornerBorderRadius = (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(borderRadiusLG).sub(token.lineWidth).equal());
return {
[listBorderedCls]: {
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
borderRadius: borderRadiusLG,
[`${componentCls}-header`]: {
borderRadius: `${innerCornerBorderRadius} ${innerCornerBorderRadius} 0 0`
},
[`${componentCls}-footer`]: {
borderRadius: `0 0 ${innerCornerBorderRadius} ${innerCornerBorderRadius}`
},
[`${componentCls}-header,${componentCls}-footer,${componentCls}-item`]: {
paddingInline: paddingLG
},
[`${componentCls}-pagination`]: {
margin: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(margin)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(marginLG)}`
}
},
[`${listBorderedCls}${componentCls}-sm`]: {
[`${componentCls}-item,${componentCls}-header,${componentCls}-footer`]: {
padding: itemPaddingSM
}
},
[`${listBorderedCls}${componentCls}-lg`]: {
[`${componentCls}-item,${componentCls}-header,${componentCls}-footer`]: {
padding: itemPaddingLG
}
}
};
};
const genResponsiveStyle = token => {
const {
componentCls,
screenSM,
screenMD,
marginLG,
marginSM,
margin
} = token;
return {
[`@media screen and (max-width:${screenMD}px)`]: {
[componentCls]: {
[`${componentCls}-item`]: {
[`${componentCls}-item-action`]: {
marginInlineStart: marginLG
}
}
},
[`${componentCls}-vertical`]: {
[`${componentCls}-item`]: {
[`${componentCls}-item-extra`]: {
marginInlineStart: marginLG
}
}
}
},
[`@media screen and (max-width: ${screenSM}px)`]: {
[componentCls]: {
[`${componentCls}-item`]: {
flexWrap: 'wrap',
[`${componentCls}-action`]: {
marginInlineStart: marginSM
}
}
},
[`${componentCls}-vertical`]: {
[`${componentCls}-item`]: {
flexWrap: 'wrap-reverse',
[`${componentCls}-item-main`]: {
minWidth: token.contentWidth
},
[`${componentCls}-item-extra`]: {
margin: `auto auto ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(margin)}`
}
}
}
}
};
};
// =============================== Base ===============================
const genBaseStyle = token => {
const {
componentCls,
antCls,
controlHeight,
minHeight,
paddingSM,
marginLG,
padding,
itemPadding,
colorPrimary,
itemPaddingSM,
itemPaddingLG,
paddingXS,
margin,
colorText,
colorTextDescription,
motionDurationSlow,
lineWidth,
headerBg,
footerBg,
emptyTextPadding,
metaMarginBottom,
avatarMarginRight,
titleMarginBottom,
descriptionFontSize
} = token;
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
position: 'relative',
// fix https://github.com/ant-design/ant-design/issues/46177
['--rc-virtual-list-scrollbar-bg']: token.colorSplit,
'*': {
outline: 'none'
},
[`${componentCls}-header`]: {
background: headerBg
},
[`${componentCls}-footer`]: {
background: footerBg
},
[`${componentCls}-header, ${componentCls}-footer`]: {
paddingBlock: paddingSM
},
[`${componentCls}-pagination`]: {
marginBlockStart: marginLG,
// https://github.com/ant-design/ant-design/issues/20037
[`${antCls}-pagination-options`]: {
textAlign: 'start'
}
},
[`${componentCls}-spin`]: {
minHeight,
textAlign: 'center'
},
[`${componentCls}-items`]: {
margin: 0,
padding: 0,
listStyle: 'none'
},
[`${componentCls}-item`]: {
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
padding: itemPadding,
color: colorText,
[`${componentCls}-item-meta`]: {
display: 'flex',
flex: 1,
alignItems: 'flex-start',
maxWidth: '100%',
[`${componentCls}-item-meta-avatar`]: {
marginInlineEnd: avatarMarginRight
},
[`${componentCls}-item-meta-content`]: {
flex: '1 0',
width: 0,
color: colorText
},
[`${componentCls}-item-meta-title`]: {
margin: `0 0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.marginXXS)} 0`,
color: colorText,
fontSize: token.fontSize,
lineHeight: token.lineHeight,
'> a': {
color: colorText,
transition: `all ${motionDurationSlow}`,
'&:hover': {
color: colorPrimary
}
}
},
[`${componentCls}-item-meta-description`]: {
color: colorTextDescription,
fontSize: descriptionFontSize,
lineHeight: token.lineHeight
}
},
[`${componentCls}-item-action`]: {
flex: '0 0 auto',
marginInlineStart: token.marginXXL,
padding: 0,
fontSize: 0,
listStyle: 'none',
'& > li': {
position: 'relative',
display: 'inline-block',
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingXS)}`,
color: colorTextDescription,
fontSize: token.fontSize,
lineHeight: token.lineHeight,
textAlign: 'center',
'&:first-child': {
paddingInlineStart: 0
}
},
[`${componentCls}-item-action-split`]: {
position: 'absolute',
insetBlockStart: '50%',
insetInlineEnd: 0,
width: lineWidth,
height: token.calc(token.fontHeight).sub(token.calc(token.marginXXS).mul(2)).equal(),
transform: 'translateY(-50%)',
backgroundColor: token.colorSplit
}
}
},
[`${componentCls}-empty`]: {
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(padding)} 0`,
color: colorTextDescription,
fontSize: token.fontSizeSM,
textAlign: 'center'
},
[`${componentCls}-empty-text`]: {
padding: emptyTextPadding,
color: token.colorTextDisabled,
fontSize: token.fontSize,
textAlign: 'center'
},
// ============================ without flex ============================
[`${componentCls}-item-no-flex`]: {
display: 'block'
}
},
[`${componentCls}-grid ${antCls}-col > ${componentCls}-item`]: {
display: 'block',
maxWidth: '100%',
marginBlockEnd: margin,
paddingBlock: 0,
borderBlockEnd: 'none'
},
[`${componentCls}-vertical ${componentCls}-item`]: {
alignItems: 'initial',
[`${componentCls}-item-main`]: {
display: 'block',
flex: 1
},
[`${componentCls}-item-extra`]: {
marginInlineStart: marginLG
},
[`${componentCls}-item-meta`]: {
marginBlockEnd: metaMarginBottom,
[`${componentCls}-item-meta-title`]: {
marginBlockStart: 0,
marginBlockEnd: titleMarginBottom,
color: colorText,
fontSize: token.fontSizeLG,
lineHeight: token.lineHeightLG
}
},
[`${componentCls}-item-action`]: {
marginBlockStart: padding,
marginInlineStart: 'auto',
'> li': {
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(padding)}`,
'&:first-child': {
paddingInlineStart: 0
}
}
}
},
[`${componentCls}-split ${componentCls}-item`]: {
borderBlockEnd: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
'&:last-child': {
borderBlockEnd: 'none'
}
},
[`${componentCls}-split ${componentCls}-header`]: {
borderBlockEnd: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}`
},
[`${componentCls}-split${componentCls}-empty ${componentCls}-footer`]: {
borderTop: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}`
},
[`${componentCls}-loading ${componentCls}-spin-nested-loading`]: {
minHeight: controlHeight
},
[`${componentCls}-split${componentCls}-something-after-last-item ${antCls}-spin-container > ${componentCls}-items > ${componentCls}-item:last-child`]: {
borderBlockEnd: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}`
},
[`${componentCls}-lg ${componentCls}-item`]: {
padding: itemPaddingLG
},
[`${componentCls}-sm ${componentCls}-item`]: {
padding: itemPaddingSM
},
// Horizontal
[`${componentCls}:not(${componentCls}-vertical)`]: {
[`${componentCls}-item-no-flex`]: {
[`${componentCls}-item-action`]: {
float: 'right'
}
}
}
};
};
const prepareComponentToken = token => ({
contentWidth: 220,
itemPadding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingContentVertical)} 0`,
itemPaddingSM: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingContentVerticalSM)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingContentHorizontal)}`,
itemPaddingLG: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingContentVerticalLG)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingContentHorizontalLG)}`,
headerBg: 'transparent',
footerBg: 'transparent',
emptyTextPadding: token.padding,
metaMarginBottom: token.padding,
avatarMarginRight: token.padding,
titleMarginBottom: token.paddingSM,
descriptionFontSize: token.fontSize
});
// ============================== Export ==============================
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genStyleHooks)('List', token => {
const listToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token, {
listBorderedCls: `${token.componentCls}-bordered`,
minHeight: token.controlHeightLG
});
return [genBaseStyle(listToken), genBorderedStyle(listToken), genResponsiveStyle(listToken)];
}, prepareComponentToken, {
extraCssVarPrefixCls: ({
prefixCls
}) => [`${prefixCls}-container`]
}));
/***/ }),
/***/ "./components/locale/context.ts":
/*!**************************************!*\
!*** ./components/locale/context.ts ***!
\**************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
const LocaleContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(undefined);
/* harmony default export */ __webpack_exports__["default"] = (LocaleContext);
/***/ }),
/***/ "./components/locale/en_US.ts":
/*!************************************!*\
!*** ./components/locale/en_US.ts ***!
\************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _rc_component_pagination_es_locale_en_US__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @rc-component/pagination/es/locale/en_US */ "./node_modules/@rc-component/pagination/es/locale/en_US.js");
/* harmony import */ var _calendar_locale_en_US__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../calendar/locale/en_US */ "./components/calendar/locale/en_US.ts");
/* harmony import */ var _date_picker_locale_en_US__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../date-picker/locale/en_US */ "./components/date-picker/locale/en_US.ts");
/* harmony import */ var _time_picker_locale_en_US__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../time-picker/locale/en_US */ "./components/time-picker/locale/en_US.ts");
const typeTemplate = '${label} is not a valid ${type}';
const localeValues = {
locale: 'en',
Pagination: _rc_component_pagination_es_locale_en_US__WEBPACK_IMPORTED_MODULE_0__["default"],
DatePicker: _date_picker_locale_en_US__WEBPACK_IMPORTED_MODULE_2__["default"],
TimePicker: _time_picker_locale_en_US__WEBPACK_IMPORTED_MODULE_3__["default"],
Calendar: _calendar_locale_en_US__WEBPACK_IMPORTED_MODULE_1__["default"],
global: {
placeholder: 'Please select',
close: 'Close',
sortable: 'sortable'
},
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',
deselectAll: 'Deselect 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',
collapse: 'Collapse'
},
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}'
}
}
},
QRCode: {
expired: 'QR code expired',
refresh: 'Refresh',
scanned: 'Scanned'
},
ColorPicker: {
presetEmpty: 'Empty',
transparent: 'Transparent',
singleColor: 'Single',
gradientColor: 'Gradient'
}
};
/* harmony default export */ __webpack_exports__["default"] = (localeValues);
/***/ }),
/***/ "./components/locale/useLocale.ts":
/*!****************************************!*\
!*** ./components/locale/useLocale.ts ***!
\****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./context */ "./components/locale/context.ts");
/* harmony import */ var _en_US__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./en_US */ "./components/locale/en_US.ts");
const useLocale = (componentName, defaultLocale) => {
const fullLocale = react__WEBPACK_IMPORTED_MODULE_0__.useContext(_context__WEBPACK_IMPORTED_MODULE_1__["default"]);
const getLocale = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => {
const locale = defaultLocale || _en_US__WEBPACK_IMPORTED_MODULE_2__["default"][componentName];
const localeFromContext = fullLocale?.[componentName] ?? {};
return {
...(typeof locale === 'function' ? locale() : locale),
...(localeFromContext || {})
};
}, [componentName, defaultLocale, fullLocale]);
const getLocaleCode = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => {
const localeCode = fullLocale?.locale;
// Had use LocaleProvide but didn't set locale
if (fullLocale?.exist && !localeCode) {
return _en_US__WEBPACK_IMPORTED_MODULE_2__["default"].locale;
}
return localeCode;
}, [fullLocale]);
return [getLocale, getLocaleCode];
};
/* harmony default export */ __webpack_exports__["default"] = (useLocale);
/***/ }),
/***/ "./components/masonry/style/index.ts":
/*!*******************************************!*\
!*** ./components/masonry/style/index.ts ***!
\*******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ genMasonryStyle: function() { return /* binding */ genMasonryStyle; }
/* harmony export */ });
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const genMasonryStyle = token => {
const {
componentCls
} = token;
const itemCls = `${componentCls}-item`;
return {
[componentCls]: {
position: 'relative',
boxSizing: 'border-box',
display: 'flex',
flexDirection: 'column',
flexWrap: 'wrap',
'&-rtl': {
direction: 'rtl'
},
[`& > ${itemCls}`]: {
boxSizing: 'border-box',
// Motion
'&-fade': {
'&-appear': {
transition: `opacity ${token.motionDurationSlow} ${token.motionEaseOut}`,
opacity: 0,
'&-active': {
opacity: 1
}
},
'&-leave': {
transition: `opacity ${token.motionDurationFast} ${token.motionEaseOut}`,
opacity: 1,
'&-active': {
opacity: 0
}
}
},
[`&:not(${itemCls}-fade)`]: {
transition: ['left', 'right', 'top'].map(prop => `${prop} ${token.motionDurationSlow} ${token.motionEaseOut}`).join(',')
}
}
}
};
};
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_0__.genStyleHooks)('Masonry', genMasonryStyle));
/***/ }),
/***/ "./components/mentions/style/index.ts":
/*!********************************************!*\
!*** ./components/mentions/style/index.ts ***!
\********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _input_style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../input/style */ "./components/input/style/index.ts");
/* harmony import */ var _input_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../input/style */ "./components/input/style/token.ts");
/* harmony import */ var _input_style_variants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../input/style/variants */ "./components/input/style/variants.ts");
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../theme/util/genStyleUtils */ "./components/theme/util/genStyleUtils.ts");
// ============================= Mentions =============================
const genDropdownStyle = token => {
const {
componentCls,
fontSize,
paddingXXS,
colorBgElevated,
borderRadiusLG,
boxShadowSecondary,
itemPaddingVertical,
controlPaddingHorizontal,
colorText,
borderRadius,
lineHeight,
colorTextDisabled,
controlItemBgHover,
motionDurationSlow
} = token;
return {
[componentCls]: {
// ================== Dropdown ==================
'&-dropdown': {
// Ref select dropdown style
...(0,_style__WEBPACK_IMPORTED_MODULE_4__.resetComponent)(token),
position: 'absolute',
top: -9999,
insetInlineStart: -9999,
zIndex: token.zIndexPopup,
boxSizing: 'border-box',
fontSize,
fontVariant: 'initial',
padding: paddingXXS,
backgroundColor: colorBgElevated,
borderRadius: borderRadiusLG,
outline: 'none',
boxShadow: boxShadowSecondary,
'&-hidden': {
display: 'none'
},
[`${componentCls}-dropdown-menu`]: {
maxHeight: token.dropdownHeight,
margin: 0,
paddingInlineStart: 0,
// Override default ul/ol
overflow: 'auto',
listStyle: 'none',
outline: 'none',
'&-item': {
..._style__WEBPACK_IMPORTED_MODULE_4__.textEllipsis,
position: 'relative',
display: 'block',
minWidth: token.controlItemWidth,
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(itemPaddingVertical)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(controlPaddingHorizontal)}`,
color: colorText,
borderRadius,
fontWeight: 'normal',
lineHeight,
cursor: 'pointer',
transition: `background-color ${motionDurationSlow} ease`,
'&:hover': {
backgroundColor: controlItemBgHover
},
'&-disabled': {
color: colorTextDisabled,
cursor: 'not-allowed',
'&:hover': {
color: colorTextDisabled,
backgroundColor: controlItemBgHover,
cursor: 'not-allowed'
}
},
'&-selected': {
color: colorText,
fontWeight: token.fontWeightStrong,
backgroundColor: controlItemBgHover
},
'&-active': {
backgroundColor: controlItemBgHover
}
}
}
}
}
};
};
const genMentionsStyle = token => {
const {
componentCls,
colorText,
antCls,
colorTextDisabled,
calc
} = token;
const [varName, varRef] = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_6__.genCssVar)(antCls, 'cmp-mentions');
return {
[componentCls]: [
// =========================== Common ===========================
(0,_style__WEBPACK_IMPORTED_MODULE_4__.resetComponent)(token), (0,_input_style__WEBPACK_IMPORTED_MODULE_1__.genBasicInputStyle)(token, {
largeStyle: {
padding: 0
},
smallStyle: {
padding: 0
}
}),
// ========================== Variants ==========================
(0,_input_style_variants__WEBPACK_IMPORTED_MODULE_3__.genOutlinedStyle)(token), (0,_input_style_variants__WEBPACK_IMPORTED_MODULE_3__.genFilledStyle)(token), (0,_input_style_variants__WEBPACK_IMPORTED_MODULE_3__.genBorderlessStyle)(token), (0,_input_style_variants__WEBPACK_IMPORTED_MODULE_3__.genUnderlinedStyle)(token),
// ========================== Mentions ==========================
{
[varName('padding-inline')]: token.paddingInline,
[varName('padding-block')]: token.paddingBlock,
[varName('control-height')]: token.controlHeight,
display: 'flex',
padding: 0,
whiteSpace: 'pre-wrap',
// ========================= Textarea =========================
'> textarea': [(0,_style__WEBPACK_IMPORTED_MODULE_4__.resetComponent)(token), (0,_input_style__WEBPACK_IMPORTED_MODULE_1__.genPlaceholderStyle)(token.colorTextPlaceholder), {
background: 'transparent',
border: 'none',
borderRadius: 'inherit',
outline: 'none',
flex: 'auto',
minWidth: 0,
resize: 'none',
'&:disabled': {
color: colorTextDisabled
}
}],
[`> textarea, ${componentCls}-measure`]: {
color: colorText,
boxSizing: 'border-box',
margin: 0,
minHeight: calc(varRef('control-height')).sub(calc(token.lineWidth).mul(2).equal()).equal(),
paddingInline: varRef('padding-inline'),
paddingBlock: varRef('padding-block'),
overflow: 'inherit',
overflowX: 'hidden',
overflowY: 'auto',
fontWeight: 'inherit',
fontSize: 'inherit',
fontFamily: 'inherit',
fontStyle: 'inherit',
fontVariant: 'inherit',
fontSizeAdjust: 'inherit',
fontStretch: 'inherit',
lineHeight: 'inherit',
direction: 'inherit',
letterSpacing: 'inherit',
whiteSpace: 'inherit',
textAlign: 'inherit',
verticalAlign: 'top',
wordWrap: 'break-word',
wordBreak: 'inherit',
tabSize: 'inherit'
},
// ========================= Measure ==========================
[`${componentCls}-measure`]: {
position: 'absolute',
inset: 0,
zIndex: -1,
color: 'transparent',
pointerEvents: 'none',
'> span': {
display: 'inline-block',
minHeight: '1em'
}
},
// ========================== Suffix ==========================
[`${componentCls}-suffix`]: {
display: 'inline-flex',
alignItems: 'center',
flex: 'none',
color: token.colorTextQuaternary,
fontSize: token.fontSizeIcon,
lineHeight: 1,
position: 'absolute',
top: '50%',
transform: 'translateY(-50%)',
insetInlineEnd: varRef('padding-inline'),
columnGap: token.marginXS,
[`${componentCls}-clear-icon`]: {
// https://github.com/ant-design/ant-design/pull/18151
// https://codesandbox.io/s/wizardly-sun-u10br
cursor: 'pointer',
border: 0,
background: 'transparent',
'&:hover': {
color: token.colorIcon
},
'&:active': {
color: token.colorText
},
'&-hidden': {
visibility: 'hidden'
}
},
[`${antCls}-form-item-feedback-icon`]: {
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center'
}
}
},
// ========================= AllowClear =========================
{
'&-has-suffix': {
'> textarea': {
paddingInlineEnd: calc(token.paddingXXS).mul(1.5).add(token.fontSizeIcon).add(varRef('padding-inline')).equal()
}
}
},
// ========================== Disabled ==========================
{
'&-disabled': {
'> textarea': {
...(0,_input_style_variants__WEBPACK_IMPORTED_MODULE_3__.genDisabledStyle)(token)
}
}
}, {
'&-lg': {
[varName('padding-inline')]: token.paddingInlineLG,
[varName('padding-block')]: token.paddingBlockLG,
[varName('control-height')]: token.controlHeightLG
},
'&-sm': {
[varName('padding-inline')]: token.paddingInlineSM,
[varName('padding-block')]: token.paddingBlockSM,
[varName('control-height')]: token.controlHeightSM
}
}]
};
};
// ============================== Tokens ==============================
const prepareComponentToken = token => ({
...(0,_input_style__WEBPACK_IMPORTED_MODULE_2__.initComponentToken)(token),
dropdownHeight: 250,
controlItemWidth: 100,
zIndexPopup: token.zIndexPopupBase + 50,
itemPaddingVertical: (token.controlHeight - token.fontHeight) / 2
});
// ============================== Export ==============================
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_6__.genStyleHooks)('Mentions', token => {
const mentionsToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_5__.mergeToken)(token, (0,_input_style__WEBPACK_IMPORTED_MODULE_2__.initInputToken)(token));
return [genMentionsStyle(mentionsToken), genDropdownStyle(mentionsToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/menu/style/index.ts":
/*!****************************************************!*\
!*** ./components/menu/style/index.ts + 4 modules ***!
\****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ menu_style; },
prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
});
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
// EXTERNAL MODULE: ./node_modules/@ant-design/fast-color/es/index.js + 3 modules
var es = __webpack_require__("./node_modules/@ant-design/fast-color/es/index.js");
// EXTERNAL MODULE: ./components/style/index.tsx
var style = __webpack_require__("./components/style/index.tsx");
// EXTERNAL MODULE: ./components/style/motion/collapse.ts
var collapse = __webpack_require__("./components/style/motion/collapse.ts");
// EXTERNAL MODULE: ./components/style/motion/slide.ts
var slide = __webpack_require__("./components/style/motion/slide.ts");
// EXTERNAL MODULE: ./components/style/motion/zoom.ts
var zoom = __webpack_require__("./components/style/motion/zoom.ts");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var cssinjs_utils_es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
;// ./components/menu/style/horizontal.ts
const getHorizontalStyle = token => {
const {
componentCls,
motionDurationSlow,
horizontalLineHeight,
colorSplit,
lineWidth,
lineType,
itemPaddingInline
} = token;
return {
[`${componentCls}-horizontal`]: {
lineHeight: horizontalLineHeight,
border: 0,
borderBottom: `${(0,cssinjs.unit)(lineWidth)} ${lineType} ${colorSplit}`,
boxShadow: 'none',
'&::after': {
display: 'block',
clear: 'both',
height: 0,
content: '"\\20"'
},
// ======================= Item =======================
[`${componentCls}-item, ${componentCls}-submenu`]: {
position: 'relative',
display: 'inline-block',
verticalAlign: 'bottom',
paddingInline: itemPaddingInline
},
[`> ${componentCls}-item:hover,
> ${componentCls}-item-active,
> ${componentCls}-submenu ${componentCls}-submenu-title:hover`]: {
backgroundColor: 'transparent'
},
[`${componentCls}-item, ${componentCls}-submenu-title`]: {
transition: [`border-color`, `background-color`].map(prop => `${prop} ${motionDurationSlow}`).join(',')
},
// ===================== Sub Menu =====================
[`${componentCls}-submenu-arrow`]: {
display: 'none'
}
}
};
};
/* harmony default export */ var horizontal = (getHorizontalStyle);
;// ./components/menu/style/rtl.ts
const getRTLStyle = ({
componentCls,
menuArrowOffset,
calc
}) => ({
[`${componentCls}-rtl`]: {
direction: 'rtl'
},
[`${componentCls}-submenu-rtl`]: {
transformOrigin: '100% 0'
},
// Vertical Arrow
[`${componentCls}-rtl${componentCls}-vertical,
${componentCls}-submenu-rtl ${componentCls}-vertical`]: {
[`${componentCls}-submenu-arrow`]: {
'&::before': {
transform: `rotate(-45deg) translateY(${(0,cssinjs.unit)(calc(menuArrowOffset).mul(-1).equal())})`
},
'&::after': {
transform: `rotate(45deg) translateY(${(0,cssinjs.unit)(menuArrowOffset)})`
}
}
}
});
/* harmony default export */ var rtl = (getRTLStyle);
;// ./components/menu/style/theme.ts
const accessibilityFocus = token => (0,style.genFocusOutline)(token);
const getThemeStyle = (token, themeSuffix) => {
const {
componentCls,
itemColor,
itemSelectedColor,
subMenuItemSelectedColor,
groupTitleColor,
itemBg,
subMenuItemBg,
itemSelectedBg,
activeBarHeight,
activeBarWidth,
activeBarBorderWidth,
motionDurationSlow,
motionEaseInOut,
motionEaseOut,
itemPaddingInline,
motionDurationMid,
itemHoverColor,
lineType,
colorSplit,
// Disabled
itemDisabledColor,
// Danger
dangerItemColor,
dangerItemHoverColor,
dangerItemSelectedColor,
dangerItemActiveBg,
dangerItemSelectedBg,
// Bg
popupBg,
itemHoverBg,
itemActiveBg,
menuSubMenuBg,
// Horizontal
horizontalItemSelectedColor,
horizontalItemSelectedBg,
horizontalItemBorderRadius,
horizontalItemHoverBg
} = token;
return {
[`${componentCls}-${themeSuffix}, ${componentCls}-${themeSuffix} > ${componentCls}`]: {
color: itemColor,
background: itemBg,
[`&${componentCls}-root:focus-visible`]: {
...accessibilityFocus(token)
},
// ======================== Item ========================
[`${componentCls}-item`]: {
'&-group-title, &-extra': {
color: groupTitleColor
}
},
[`${componentCls}-submenu-selected > ${componentCls}-submenu-title`]: {
color: subMenuItemSelectedColor
},
[`${componentCls}-item, ${componentCls}-submenu-title`]: {
color: itemColor,
[`&:not(${componentCls}-item-disabled):focus-visible`]: {
...accessibilityFocus(token)
}
},
// Disabled
[`${componentCls}-item-disabled, ${componentCls}-submenu-disabled`]: {
color: `${itemDisabledColor} !important`
},
// Hover
[`${componentCls}-item:not(${componentCls}-item-selected):not(${componentCls}-submenu-selected)`]: {
[`&:hover, > ${componentCls}-submenu-title:hover`]: {
color: itemHoverColor
}
},
// SubMenu active (when hover on parent menu item)
[`${componentCls}-submenu:not(${componentCls}-submenu-selected)`]: {
[`> ${componentCls}-submenu-title:hover`]: {
color: itemHoverColor
}
},
[`&:not(${componentCls}-horizontal)`]: {
[`${componentCls}-item:not(${componentCls}-item-selected)`]: {
'&:hover': {
backgroundColor: itemHoverBg
},
'&:active': {
backgroundColor: itemActiveBg
}
},
[`${componentCls}-submenu-title`]: {
'&:hover': {
backgroundColor: itemHoverBg
},
'&:active': {
backgroundColor: itemActiveBg
}
}
},
// Danger - only Item has
[`${componentCls}-item-danger`]: {
color: dangerItemColor,
[`&${componentCls}-item:hover`]: {
[`&:not(${componentCls}-item-selected):not(${componentCls}-submenu-selected)`]: {
color: dangerItemHoverColor
}
},
[`&${componentCls}-item:active`]: {
background: dangerItemActiveBg
}
},
[`${componentCls}-item a`]: {
'&, &:hover': {
color: 'inherit'
}
},
[`${componentCls}-item-selected`]: {
color: itemSelectedColor,
// Danger
[`&${componentCls}-item-danger`]: {
color: dangerItemSelectedColor
},
'a, a:hover': {
color: 'inherit'
}
},
[`& ${componentCls}-item-selected`]: {
backgroundColor: itemSelectedBg,
// Danger
[`&${componentCls}-item-danger`]: {
backgroundColor: dangerItemSelectedBg
}
},
[`&${componentCls}-submenu > ${componentCls}`]: {
backgroundColor: menuSubMenuBg
},
// ===== 设置浮层的颜色 =======
// !dark 模式会被popupBg 会被rest 为 darkPopupBg
[`&${componentCls}-popup > ${componentCls}`]: {
backgroundColor: popupBg
},
[`&${componentCls}-submenu-popup > ${componentCls}`]: {
backgroundColor: popupBg
},
// ===== 设置浮层的颜色 end =======
// ====================== Horizontal ======================
[`&${componentCls}-horizontal`]: {
...(themeSuffix === 'dark' ? {
borderBottom: 0
} : {}),
[`> ${componentCls}-item, > ${componentCls}-submenu`]: {
top: activeBarBorderWidth,
marginTop: token.calc(activeBarBorderWidth).mul(-1).equal(),
marginBottom: 0,
borderRadius: horizontalItemBorderRadius,
'&::after': {
position: 'absolute',
insetInline: itemPaddingInline,
bottom: 0,
borderBottom: `${(0,cssinjs.unit)(activeBarHeight)} solid transparent`,
transition: `border-color ${motionDurationSlow} ${motionEaseInOut}`,
content: '""'
},
'&:hover, &-active, &-open': {
background: horizontalItemHoverBg,
'&::after': {
borderBottomWidth: activeBarHeight,
borderBottomColor: horizontalItemSelectedColor
}
},
'&-selected': {
color: horizontalItemSelectedColor,
backgroundColor: horizontalItemSelectedBg,
'&:hover': {
backgroundColor: horizontalItemSelectedBg
},
'&::after': {
borderBottomWidth: activeBarHeight,
borderBottomColor: horizontalItemSelectedColor
}
}
}
},
// ================== Inline & Vertical ===================
//
[`&${componentCls}-root`]: {
[`&${componentCls}-inline, &${componentCls}-vertical`]: {
borderInlineEnd: `${(0,cssinjs.unit)(activeBarBorderWidth)} ${lineType} ${colorSplit}`
}
},
// ======================== Inline ========================
[`&${componentCls}-inline`]: {
// Sub
[`${componentCls}-sub${componentCls}-inline`]: {
background: subMenuItemBg
},
[`${componentCls}-item`]: {
position: 'relative',
'&::after': {
position: 'absolute',
insetBlock: 0,
insetInlineEnd: 0,
borderInlineEnd: `${(0,cssinjs.unit)(activeBarWidth)} solid ${itemSelectedColor}`,
transform: 'scaleY(0.0001)',
opacity: 0,
transition: [`transform`, `opacity`].map(prop => `${prop} ${motionDurationMid} ${motionEaseOut}`).join(','),
content: '""'
},
// Danger
[`&${componentCls}-item-danger`]: {
'&::after': {
borderInlineEndColor: dangerItemSelectedColor
}
}
},
[`${componentCls}-selected, ${componentCls}-item-selected`]: {
'&::after': {
transform: 'scaleY(1)',
opacity: 1,
transition: [`transform`, `opacity`].map(prop => `${prop} ${motionDurationMid} ${motionEaseInOut}`).join(',')
}
}
}
}
};
};
/* harmony default export */ var theme = (getThemeStyle);
;// ./components/menu/style/vertical.ts
const getVerticalInlineStyle = token => {
const {
componentCls,
itemHeight,
itemMarginInline,
padding,
menuArrowSize,
marginXS,
itemMarginBlock,
itemWidth,
itemPaddingInline
} = token;
const paddingWithArrow = token.calc(menuArrowSize).add(padding).add(marginXS).equal();
return {
[`${componentCls}-item`]: {
position: 'relative',
overflow: 'hidden'
},
[`${componentCls}-item, ${componentCls}-submenu-title`]: {
height: itemHeight,
lineHeight: (0,cssinjs.unit)(itemHeight),
paddingInline: itemPaddingInline,
overflow: 'hidden',
textOverflow: 'ellipsis',
marginInline: itemMarginInline,
marginBlock: itemMarginBlock,
width: itemWidth
},
[`> ${componentCls}-item,
> ${componentCls}-submenu > ${componentCls}-submenu-title`]: {
height: itemHeight,
lineHeight: (0,cssinjs.unit)(itemHeight)
},
[`${componentCls}-item-group-list ${componentCls}-submenu-title,
${componentCls}-submenu-title`]: {
paddingInlineEnd: paddingWithArrow
}
};
};
const getVerticalStyle = token => {
const {
componentCls,
iconCls,
itemHeight,
colorTextLightSolid,
dropdownWidth,
controlHeightLG,
motionEaseOut,
paddingXL,
itemMarginInline,
fontSizeLG,
motionDurationFast,
motionDurationSlow,
paddingXS,
boxShadowSecondary,
collapsedWidth,
collapsedIconSize
} = token;
const inlineItemStyle = {
height: itemHeight,
lineHeight: (0,cssinjs.unit)(itemHeight),
listStylePosition: 'inside',
listStyleType: 'disc'
};
return [{
[componentCls]: {
'&-inline, &-vertical': {
[`&${componentCls}-root`]: {
boxShadow: 'none'
},
...getVerticalInlineStyle(token)
}
},
[`${componentCls}-submenu-popup`]: {
[`${componentCls}-vertical`]: {
...getVerticalInlineStyle(token),
boxShadow: boxShadowSecondary
}
}
},
// Vertical only
{
[`${componentCls}-submenu-popup ${componentCls}-vertical${componentCls}-sub`]: {
minWidth: dropdownWidth,
maxHeight: `calc(100vh - ${(0,cssinjs.unit)(token.calc(controlHeightLG).mul(2.5).equal())})`,
padding: '0',
overflow: 'hidden',
borderInlineEnd: 0,
// https://github.com/ant-design/ant-design/issues/22244
// https://github.com/ant-design/ant-design/issues/26812
"&:not([class*='-active'])": {
overflowX: 'hidden',
overflowY: 'auto'
}
}
},
// Inline Only
{
[`${componentCls}-inline`]: {
width: '100%',
// Motion enhance for first level
[`&${componentCls}-root`]: {
[`${componentCls}-item, ${componentCls}-submenu-title`]: {
display: 'flex',
alignItems: 'center',
transition: [`border-color ${motionDurationSlow}`, `background-color ${motionDurationSlow}`, `padding ${motionDurationFast} ${motionEaseOut}`].join(','),
[`> ${componentCls}-title-content`]: {
flex: 'auto',
minWidth: 0,
overflow: 'hidden',
textOverflow: 'ellipsis'
},
'> *': {
flex: 'none'
}
}
},
// >>>>> Sub
[`${componentCls}-sub${componentCls}-inline`]: {
padding: 0,
border: 0,
borderRadius: 0,
boxShadow: 'none',
[`& > ${componentCls}-submenu > ${componentCls}-submenu-title`]: inlineItemStyle,
[`& ${componentCls}-item-group-title`]: {
paddingInlineStart: paddingXL
}
},
// >>>>> Item
[`${componentCls}-item`]: inlineItemStyle
}
},
// Inline Collapse Only
{
[`${componentCls}-inline-collapsed`]: {
width: collapsedWidth,
[`&${componentCls}-root`]: {
[`${componentCls}-item, ${componentCls}-submenu ${componentCls}-submenu-title`]: {
[`> ${componentCls}-inline-collapsed-noicon`]: {
fontSize: fontSizeLG,
textAlign: 'center'
}
}
},
[`> ${componentCls}-item,
> ${componentCls}-item-group > ${componentCls}-item-group-list > ${componentCls}-item,
> ${componentCls}-item-group > ${componentCls}-item-group-list > ${componentCls}-submenu > ${componentCls}-submenu-title,
> ${componentCls}-submenu > ${componentCls}-submenu-title`]: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
insetInlineStart: 0,
paddingInline: `calc(50% - ${(0,cssinjs.unit)(token.calc(collapsedIconSize).div(2).equal())} - ${(0,cssinjs.unit)(itemMarginInline)})`,
textOverflow: 'clip',
[`
${componentCls}-submenu-arrow,
${componentCls}-submenu-expand-icon
`]: {
opacity: 0
},
[`> ${componentCls}-title-content`]: {
width: 0,
opacity: 0,
overflow: 'hidden'
},
[`${componentCls}-item-icon, ${iconCls}`]: {
margin: 0,
fontSize: collapsedIconSize,
lineHeight: (0,cssinjs.unit)(itemHeight),
'+ span': {
display: 'inline-block',
width: 0,
opacity: 0,
overflow: 'hidden',
marginInlineStart: 0
}
}
},
[`${componentCls}-item-icon, ${iconCls}`]: {
display: 'inline-block'
},
'&-tooltip': {
pointerEvents: 'none',
[`${componentCls}-item-icon, ${iconCls}`]: {
display: 'none'
},
'a, a:hover': {
color: colorTextLightSolid
}
},
[`${componentCls}-item-group-title`]: {
...style.textEllipsis,
paddingInline: paddingXS
}
}
}];
};
/* harmony default export */ var vertical = (getVerticalStyle);
;// ./components/menu/style/index.ts
const genMenuItemStyle = token => {
const {
componentCls,
motionDurationSlow,
motionDurationMid,
motionEaseInOut,
motionEaseOut,
iconCls,
iconSize,
iconMarginInlineEnd
} = token;
return {
// >>>>> Item
[`${componentCls}-item, ${componentCls}-submenu-title`]: {
position: 'relative',
display: 'block',
margin: 0,
whiteSpace: 'nowrap',
cursor: 'pointer',
transition: [`border-color ${motionDurationSlow}`, `background-color ${motionDurationSlow}`, `padding calc(${motionDurationSlow} + 0.1s) ${motionEaseInOut}`].join(','),
[`${componentCls}-item-icon, ${iconCls}`]: {
minWidth: iconSize,
fontSize: iconSize,
transition: [`font-size ${motionDurationMid} ${motionEaseOut}`, `margin ${motionDurationSlow} ${motionEaseInOut}`, `color ${motionDurationSlow}`].join(','),
'+ span': {
marginInlineStart: iconMarginInlineEnd,
opacity: 1,
transition: [`opacity ${motionDurationSlow} ${motionEaseInOut}`, `margin ${motionDurationSlow}`, `color ${motionDurationSlow}`].join(',')
}
},
[`${componentCls}-item-icon`]: {
...(0,style.resetIcon)()
},
[`&${componentCls}-item-only-child`]: {
[`> ${iconCls}, > ${componentCls}-item-icon`]: {
marginInlineEnd: 0
}
}
},
// Disabled state sets text to gray and nukes hover/tab effects
[`${componentCls}-item-disabled, ${componentCls}-submenu-disabled`]: {
background: 'none !important',
cursor: 'not-allowed',
'&::after': {
borderColor: 'transparent !important'
},
a: {
color: 'inherit !important',
cursor: 'not-allowed',
pointerEvents: 'none'
},
[`> ${componentCls}-submenu-title`]: {
color: 'inherit !important',
cursor: 'not-allowed'
}
}
};
};
const genSubMenuArrowStyle = token => {
const {
componentCls,
motionDurationSlow,
motionEaseInOut,
borderRadius,
menuArrowSize,
menuArrowOffset
} = token;
return {
[`${componentCls}-submenu`]: {
'&-expand-icon, &-arrow': {
position: 'absolute',
top: '50%',
insetInlineEnd: token.margin,
width: menuArrowSize,
color: 'currentcolor',
transform: 'translateY(-50%)',
transition: ['transform', 'opacity'].map(prop => `${prop} ${motionDurationSlow}`).join(',')
},
'&-arrow': {
// →
'&::before, &::after': {
position: 'absolute',
width: token.calc(menuArrowSize).mul(0.6).equal(),
height: token.calc(menuArrowSize).mul(0.15).equal(),
backgroundColor: 'currentcolor',
borderRadius,
transition: [`background-color`, `transform`, `top`, `color`].map(prop => `${prop} ${motionDurationSlow} ${motionEaseInOut}`).join(','),
content: '""'
},
'&::before': {
transform: `rotate(45deg) translateY(${(0,cssinjs.unit)(token.calc(menuArrowOffset).mul(-1).equal())})`
},
'&::after': {
transform: `rotate(-45deg) translateY(${(0,cssinjs.unit)(menuArrowOffset)})`
}
}
}
};
};
// =============================== Base ===============================
const getBaseStyle = token => {
const {
antCls,
componentCls,
fontSize,
motionDurationSlow,
motionDurationMid,
motionEaseInOut,
paddingXS,
padding,
colorSplit,
lineWidth,
zIndexPopup,
borderRadiusLG,
subMenuItemBorderRadius,
menuArrowSize,
menuArrowOffset,
lineType,
groupTitleLineHeight,
groupTitleFontSize
} = token;
return [
// Misc
{
'': {
[componentCls]: {
...(0,style.clearFix)(),
// Hidden
'&-hidden': {
display: 'none'
}
}
},
[`${componentCls}-submenu-hidden`]: {
display: 'none'
}
}, {
[componentCls]: {
...(0,style.resetComponent)(token),
...(0,style.clearFix)(),
marginBottom: 0,
paddingInlineStart: 0,
// Override default ul/ol
fontSize,
lineHeight: 0,
// Fix display inline-block gap
listStyle: 'none',
outline: 'none',
// Magic cubic here but smooth transition
transition: `width ${motionDurationSlow} cubic-bezier(0.2, 0, 0, 1) 0s`,
'ul, ol': {
margin: 0,
padding: 0,
listStyle: 'none'
},
// Overflow ellipsis
'&-overflow': {
display: 'flex',
[`${componentCls}-item`]: {
flex: 'none'
}
},
[`${componentCls}-item, ${componentCls}-submenu, ${componentCls}-submenu-title`]: {
borderRadius: token.itemBorderRadius
},
[`${componentCls}-item-group-title`]: {
padding: `${(0,cssinjs.unit)(paddingXS)} ${(0,cssinjs.unit)(padding)}`,
fontSize: groupTitleFontSize,
lineHeight: groupTitleLineHeight,
transition: `all ${motionDurationSlow}`
},
[`&-horizontal ${componentCls}-submenu`]: {
transition: [`border-color`, `background-color`].map(prop => `${prop} ${motionDurationSlow} ${motionEaseInOut}`).join(',')
},
[`${componentCls}-submenu, ${componentCls}-submenu-inline`]: {
transition: [`border-color ${motionDurationSlow}`, `background-color ${motionDurationSlow}`, `padding ${motionDurationMid}`].map(prop => `${prop} ${motionEaseInOut}`).join(',')
},
[`${componentCls}-submenu ${componentCls}-sub`]: {
cursor: 'initial',
transition: [`background-color`, `padding`].map(prop => `${prop} ${motionDurationSlow} ${motionEaseInOut}`).join(',')
},
[`${componentCls}-title-content`]: {
transition: `color ${motionDurationSlow}`,
'&-with-extra': {
display: 'inline-flex',
alignItems: 'center',
width: '100%'
},
// https://github.com/ant-design/ant-design/issues/41143
[`> ${antCls}-typography-ellipsis-single-line`]: {
display: 'inline',
verticalAlign: 'unset'
},
[`${componentCls}-item-extra`]: {
marginInlineStart: 'auto',
paddingInlineStart: token.padding
}
},
[`${componentCls}-item a`]: {
'&::before': {
position: 'absolute',
inset: 0,
backgroundColor: 'transparent',
content: '""'
}
},
// Removed a Badge related style seems it's safe
// https://github.com/ant-design/ant-design/issues/19809
// >>>>> Divider
[`${componentCls}-item-divider`]: {
overflow: 'hidden',
lineHeight: 0,
borderColor: colorSplit,
borderStyle: lineType,
borderWidth: 0,
borderTopWidth: lineWidth,
marginBlock: lineWidth,
padding: 0,
'&-dashed': {
borderStyle: 'dashed'
}
},
// Item
...genMenuItemStyle(token),
[`${componentCls}-item-group`]: {
[`${componentCls}-item-group-list`]: {
margin: 0,
padding: 0,
[`${componentCls}-item, ${componentCls}-submenu-title`]: {
paddingInline: `${(0,cssinjs.unit)(token.calc(fontSize).mul(2).equal())} ${(0,cssinjs.unit)(padding)}`
}
}
},
// ======================= Sub Menu =======================
'&-submenu': {
'&-popup': {
position: 'absolute',
zIndex: zIndexPopup,
borderRadius: borderRadiusLG,
boxShadow: 'none',
transformOrigin: '0 0',
[`&${componentCls}-submenu`]: {
background: 'transparent'
},
// https://github.com/ant-design/ant-design/issues/13955
'&::before': {
position: 'absolute',
inset: 0,
zIndex: -1,
width: '100%',
height: '100%',
opacity: 0,
content: '""'
},
[`> ${componentCls}`]: {
borderRadius: borderRadiusLG,
...genMenuItemStyle(token),
...genSubMenuArrowStyle(token),
[`${componentCls}-item, ${componentCls}-submenu > ${componentCls}-submenu-title`]: {
borderRadius: subMenuItemBorderRadius
},
[`${componentCls}-submenu-title::after`]: {
transition: `transform ${motionDurationSlow} ${motionEaseInOut}`
}
}
},
'&-placement-leftTop, &-placement-bottomRight': {
transformOrigin: '100% 0'
},
'&-placement-leftBottom, &-placement-topRight': {
transformOrigin: '100% 100%'
},
'&-placement-rightBottom, &-placement-topLeft': {
transformOrigin: '0 100%'
},
'&-placement-bottomLeft, &-placement-rightTop': {
transformOrigin: '0 0'
},
'&-placement-leftTop, &-placement-leftBottom': {
paddingInlineEnd: token.paddingXS
},
'&-placement-rightTop, &-placement-rightBottom': {
paddingInlineStart: token.paddingXS
},
'&-placement-topRight, &-placement-topLeft': {
paddingBottom: token.paddingXS
},
'&-placement-bottomRight, &-placement-bottomLeft': {
paddingTop: token.paddingXS
}
},
...genSubMenuArrowStyle(token),
[`&-inline-collapsed ${componentCls}-submenu-arrow,
&-inline ${componentCls}-submenu-arrow`]: {
// ↓
'&::before': {
transform: `rotate(-45deg) translateX(${(0,cssinjs.unit)(menuArrowOffset)})`
},
'&::after': {
transform: `rotate(45deg) translateX(${(0,cssinjs.unit)(token.calc(menuArrowOffset).mul(-1).equal())})`
}
},
[`${componentCls}-submenu-open${componentCls}-submenu-inline > ${componentCls}-submenu-title > ${componentCls}-submenu-arrow`]: {
// ↑
transform: `translateY(${(0,cssinjs.unit)(token.calc(menuArrowSize).mul(0.2).mul(-1).equal())})`,
'&::after': {
transform: `rotate(-45deg) translateX(${(0,cssinjs.unit)(token.calc(menuArrowOffset).mul(-1).equal())})`
},
'&::before': {
transform: `rotate(45deg) translateX(${(0,cssinjs.unit)(menuArrowOffset)})`
}
}
}
},
// Integration with header element so menu items have the same height
{
[`${antCls}-layout-header`]: {
[componentCls]: {
lineHeight: 'inherit'
}
}
}];
};
const prepareComponentToken = token => {
const {
colorPrimary,
colorError,
colorTextDisabled,
colorErrorBg,
colorText,
colorTextDescription,
colorBgContainer,
colorFillAlter,
colorFillContent,
lineWidth,
lineWidthBold,
controlItemBgActive,
colorBgTextHover,
controlHeightLG,
lineHeight,
colorBgElevated,
marginXXS,
padding,
fontSize,
controlHeightSM,
fontSizeLG,
colorTextLightSolid,
colorErrorHover
} = token;
const activeBarWidth = token.activeBarWidth ?? 0;
const activeBarBorderWidth = token.activeBarBorderWidth ?? lineWidth;
const itemMarginInline = token.itemMarginInline ?? token.marginXXS;
const colorTextDark = new es.FastColor(colorTextLightSolid).setA(0.65).toRgbString();
return {
dropdownWidth: 160,
zIndexPopup: token.zIndexPopupBase + 50,
radiusItem: token.borderRadiusLG,
itemBorderRadius: token.borderRadiusLG,
radiusSubMenuItem: token.borderRadiusSM,
subMenuItemBorderRadius: token.borderRadiusSM,
colorItemText: colorText,
itemColor: colorText,
colorItemTextHover: colorText,
itemHoverColor: colorText,
colorItemTextHoverHorizontal: colorPrimary,
horizontalItemHoverColor: colorPrimary,
colorGroupTitle: colorTextDescription,
groupTitleColor: colorTextDescription,
colorItemTextSelected: colorPrimary,
itemSelectedColor: colorPrimary,
subMenuItemSelectedColor: colorPrimary,
colorItemTextSelectedHorizontal: colorPrimary,
horizontalItemSelectedColor: colorPrimary,
colorItemBg: colorBgContainer,
itemBg: colorBgContainer,
colorItemBgHover: colorBgTextHover,
itemHoverBg: colorBgTextHover,
colorItemBgActive: colorFillContent,
itemActiveBg: controlItemBgActive,
colorSubItemBg: colorFillAlter,
subMenuItemBg: colorFillAlter,
colorItemBgSelected: controlItemBgActive,
itemSelectedBg: controlItemBgActive,
colorItemBgSelectedHorizontal: 'transparent',
horizontalItemSelectedBg: 'transparent',
colorActiveBarWidth: 0,
activeBarWidth,
colorActiveBarHeight: lineWidthBold,
activeBarHeight: lineWidthBold,
colorActiveBarBorderSize: lineWidth,
activeBarBorderWidth,
// Disabled
colorItemTextDisabled: colorTextDisabled,
itemDisabledColor: colorTextDisabled,
// Danger
colorDangerItemText: colorError,
dangerItemColor: colorError,
colorDangerItemTextHover: colorError,
dangerItemHoverColor: colorError,
colorDangerItemTextSelected: colorError,
dangerItemSelectedColor: colorError,
colorDangerItemBgActive: colorErrorBg,
dangerItemActiveBg: colorErrorBg,
colorDangerItemBgSelected: colorErrorBg,
dangerItemSelectedBg: colorErrorBg,
itemMarginInline,
horizontalItemBorderRadius: 0,
horizontalItemHoverBg: 'transparent',
itemHeight: controlHeightLG,
groupTitleLineHeight: lineHeight,
collapsedWidth: controlHeightLG * 2,
popupBg: colorBgElevated,
itemMarginBlock: marginXXS,
itemPaddingInline: padding,
horizontalLineHeight: `${controlHeightLG * 1.15}px`,
iconSize: fontSize,
iconMarginInlineEnd: controlHeightSM - fontSize,
collapsedIconSize: fontSizeLG,
groupTitleFontSize: fontSize,
// Disabled
darkItemDisabledColor: new es.FastColor(colorTextLightSolid).setA(0.25).toRgbString(),
// Dark
darkItemColor: colorTextDark,
darkDangerItemColor: colorError,
darkItemBg: '#001529',
darkPopupBg: '#001529',
darkSubMenuItemBg: '#000c17',
darkItemSelectedColor: colorTextLightSolid,
darkItemSelectedBg: colorPrimary,
darkDangerItemSelectedBg: colorError,
darkItemHoverBg: 'transparent',
darkGroupTitleColor: colorTextDark,
darkItemHoverColor: colorTextLightSolid,
darkDangerItemHoverColor: colorErrorHover,
darkDangerItemSelectedColor: colorTextLightSolid,
darkDangerItemActiveBg: colorError,
// internal
itemWidth: activeBarWidth ? `calc(100% + ${activeBarBorderWidth}px)` : `calc(100% - ${itemMarginInline * 2}px)`
};
};
// ============================== Export ==============================
/* harmony default export */ var menu_style = ((prefixCls, rootCls = prefixCls, injectStyle = true) => {
const useStyle = (0,genStyleUtils.genStyleHooks)('Menu', token => {
const {
colorBgElevated,
controlHeightLG,
fontSize,
darkItemColor,
darkDangerItemColor,
darkItemBg,
darkSubMenuItemBg,
darkItemSelectedColor,
darkItemSelectedBg,
darkDangerItemSelectedBg,
darkItemHoverBg,
darkGroupTitleColor,
darkItemHoverColor,
darkItemDisabledColor,
darkDangerItemHoverColor,
darkDangerItemSelectedColor,
darkDangerItemActiveBg,
popupBg,
darkPopupBg
} = token;
const menuArrowSize = token.calc(fontSize).div(7).mul(5).equal();
// Menu Token
const menuToken = (0,cssinjs_utils_es.mergeToken)(token, {
menuArrowSize,
menuHorizontalHeight: token.calc(controlHeightLG).mul(1.15).equal(),
menuArrowOffset: token.calc(menuArrowSize).mul(0.25).equal(),
menuSubMenuBg: colorBgElevated,
calc: token.calc,
popupBg
});
const menuDarkToken = (0,cssinjs_utils_es.mergeToken)(menuToken, {
itemColor: darkItemColor,
itemHoverColor: darkItemHoverColor,
groupTitleColor: darkGroupTitleColor,
itemSelectedColor: darkItemSelectedColor,
subMenuItemSelectedColor: darkItemSelectedColor,
itemBg: darkItemBg,
popupBg: darkPopupBg,
subMenuItemBg: darkSubMenuItemBg,
itemActiveBg: 'transparent',
itemSelectedBg: darkItemSelectedBg,
activeBarHeight: 0,
activeBarBorderWidth: 0,
itemHoverBg: darkItemHoverBg,
// Disabled
itemDisabledColor: darkItemDisabledColor,
// Danger
dangerItemColor: darkDangerItemColor,
dangerItemHoverColor: darkDangerItemHoverColor,
dangerItemSelectedColor: darkDangerItemSelectedColor,
dangerItemActiveBg: darkDangerItemActiveBg,
dangerItemSelectedBg: darkDangerItemSelectedBg,
menuSubMenuBg: darkSubMenuItemBg,
// Horizontal
horizontalItemSelectedColor: darkItemSelectedColor,
horizontalItemSelectedBg: darkItemSelectedBg
});
return [
// Basic
getBaseStyle(menuToken),
// Horizontal
horizontal(menuToken),
// Hard code for some light style
// Vertical
vertical(menuToken),
// Hard code for some light style
// Theme
theme(menuToken, 'light'), theme(menuDarkToken, 'dark'),
// RTL
rtl(menuToken),
// Motion
(0,collapse["default"])(menuToken), (0,slide.initSlideMotion)(menuToken, 'slide-up'), (0,slide.initSlideMotion)(menuToken, 'slide-down'), (0,zoom.initZoomMotion)(menuToken, 'zoom-big')];
}, prepareComponentToken, {
deprecatedTokens: [['colorGroupTitle', 'groupTitleColor'], ['radiusItem', 'itemBorderRadius'], ['radiusSubMenuItem', 'subMenuItemBorderRadius'], ['colorItemText', 'itemColor'], ['colorItemTextHover', 'itemHoverColor'], ['colorItemTextHoverHorizontal', 'horizontalItemHoverColor'], ['colorItemTextSelected', 'itemSelectedColor'], ['colorItemTextSelectedHorizontal', 'horizontalItemSelectedColor'], ['colorItemTextDisabled', 'itemDisabledColor'], ['colorDangerItemText', 'dangerItemColor'], ['colorDangerItemTextHover', 'dangerItemHoverColor'], ['colorDangerItemTextSelected', 'dangerItemSelectedColor'], ['colorDangerItemBgActive', 'dangerItemActiveBg'], ['colorDangerItemBgSelected', 'dangerItemSelectedBg'], ['colorItemBg', 'itemBg'], ['colorItemBgHover', 'itemHoverBg'], ['colorSubItemBg', 'subMenuItemBg'], ['colorItemBgActive', 'itemActiveBg'], ['colorItemBgSelectedHorizontal', 'horizontalItemSelectedBg'], ['colorActiveBarWidth', 'activeBarWidth'], ['colorActiveBarHeight', 'activeBarHeight'], ['colorActiveBarBorderSize', 'activeBarBorderWidth'], ['colorItemBgSelected', 'itemSelectedBg']],
// Dropdown will handle menu style self. We do not need to handle this.
injectStyle,
unitless: {
groupTitleLineHeight: true
}
});
return useStyle(prefixCls, rootCls);
});
(Object.getOwnPropertyDescriptor(menu_style, "name") || {}).writable || Object.defineProperty(menu_style, "name", { value: "default", configurable: true });
/***/ }),
/***/ "./components/message/style/index.ts":
/*!*******************************************!*\
!*** ./components/message/style/index.ts ***!
\*******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _util_hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../_util/hooks */ "./components/_util/hooks/useZIndex.ts");
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const genMessageStyle = token => {
const {
componentCls,
iconCls,
boxShadow,
colorText,
colorSuccess,
colorError,
colorWarning,
colorInfo,
fontSizeLG,
motionEaseInOutCirc,
motionDurationSlow,
marginXS,
paddingXS,
borderRadiusLG,
zIndexPopup,
// Custom token
contentPadding,
contentBg
} = token;
const noticeCls = `${componentCls}-notice`;
const messageMoveIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('MessageMoveIn', {
'0%': {
padding: 0,
transform: 'translateY(-100%)',
opacity: 0
},
'100%': {
padding: paddingXS,
transform: 'translateY(0)',
opacity: 1
}
});
const messageMoveOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('MessageMoveOut', {
'0%': {
maxHeight: token.height,
padding: paddingXS,
opacity: 1
},
'100%': {
maxHeight: 0,
padding: 0,
opacity: 0
}
});
const noticeStyle = {
padding: paddingXS,
textAlign: 'center',
[`${componentCls}-custom-content`]: {
display: 'flex',
alignItems: 'center'
},
[`${componentCls}-custom-content > ${iconCls}`]: {
marginInlineEnd: marginXS,
// affected by ltr or rtl
fontSize: fontSizeLG
},
[`${noticeCls}-content`]: {
display: 'inline-block',
padding: contentPadding,
background: contentBg,
borderRadius: borderRadiusLG,
boxShadow,
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
}
};
return [
// ============================ Holder ============================
{
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_2__.resetComponent)(token),
color: colorText,
position: 'fixed',
top: marginXS,
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]: {
[`${noticeCls}-wrapper`]: {
...noticeStyle
}
}
},
// ============================= Pure =============================
{
[`${componentCls}-notice-pure-panel`]: {
...noticeStyle,
padding: 0,
textAlign: 'start'
}
}];
};
const prepareComponentToken = token => ({
zIndexPopup: token.zIndexPopupBase + _util_hooks__WEBPACK_IMPORTED_MODULE_1__.CONTAINER_MAX_OFFSET + 10,
contentBg: token.colorBgElevated,
contentPadding: `${(token.controlHeightLG - token.fontSize * token.lineHeight) / 2}px ${token.paddingSM}px`
});
// ============================== Export ==============================
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_4__.genStyleHooks)('Message', token => {
// Gen-style functions here
const combinedToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.mergeToken)(token, {
height: 150
});
return genMessageStyle(combinedToken);
}, prepareComponentToken));
/***/ }),
/***/ "./components/modal/style/index.ts":
/*!*****************************************!*\
!*** ./components/modal/style/index.ts ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ genModalMaskStyle: function() { return /* binding */ genModalMaskStyle; },
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; },
/* harmony export */ prepareToken: function() { return /* binding */ prepareToken; }
/* harmony export */ });
/* harmony import */ var _babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/toConsumableArray */ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _grid_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../grid/style */ "./components/grid/style/index.ts");
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _style_motion__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../style/motion */ "./components/style/motion/fade.ts");
/* harmony import */ var _style_motion__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../style/motion */ "./components/style/motion/zoom.ts");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
function box(position) {
return {
position,
inset: 0
};
}
const genModalMaskStyle = token => {
const {
componentCls,
antCls
} = token;
return [{
[`${componentCls}-root`]: {
[`${componentCls}${antCls}-zoom-enter, ${componentCls}${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'
},
// https://github.com/ant-design/ant-design/issues/37329
// https://github.com/ant-design/ant-design/issues/40272
[`${componentCls}${antCls}-zoom-leave ${componentCls}-container`]: {
pointerEvents: 'none'
},
[`${componentCls}-mask`]: {
...box('fixed'),
zIndex: token.zIndexPopupBase,
height: '100%',
backgroundColor: token.colorBgMask,
pointerEvents: 'none',
[`&${componentCls}-mask-blur`]: {
backdropFilter: 'blur(4px)'
},
[`${componentCls}-hidden`]: {
display: 'none'
}
},
[`${componentCls}-wrap`]: {
...box('fixed'),
zIndex: token.zIndexPopupBase,
overflow: 'auto',
outline: 0,
WebkitOverflowScrolling: 'touch'
}
}
}, {
[`${componentCls}-root`]: (0,_style_motion__WEBPACK_IMPORTED_MODULE_4__.initFadeMotion)(token)
}];
};
const genModalStyle = token => {
const {
componentCls,
motionDurationMid
} = token;
return [
// ======================== Root =========================
{
[`${componentCls}-root`]: {
[`${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}px)`]: {
[componentCls]: {
maxWidth: 'calc(100vw - 16px)',
margin: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.marginXS)} auto`
},
[`${componentCls}-centered`]: {
[componentCls]: {
flex: 1
}
}
}
}
},
// ======================== Modal ========================
{
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_3__.resetComponent)(token),
pointerEvents: 'none',
position: 'relative',
top: 100,
width: 'auto',
maxWidth: `calc(100vw - ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.calc(token.margin).mul(2).equal())})`,
margin: '0 auto',
'&:focus-visible': {
borderRadius: token.borderRadiusLG,
...(0,_style__WEBPACK_IMPORTED_MODULE_3__.genFocusOutline)(token)
},
[`${componentCls}-title`]: {
margin: 0,
color: token.titleColor,
fontWeight: token.fontWeightStrong,
fontSize: token.titleFontSize,
lineHeight: token.titleLineHeight,
wordWrap: 'break-word'
},
[`${componentCls}-container`]: {
position: 'relative',
backgroundColor: token.contentBg,
backgroundClip: 'padding-box',
border: 0,
borderRadius: token.borderRadiusLG,
boxShadow: token.boxShadow,
pointerEvents: 'auto',
padding: token.contentPadding
},
[`${componentCls}-close`]: {
position: 'absolute',
top: token.calc(token.modalHeaderHeight).sub(token.modalCloseBtnSize).div(2).equal(),
insetInlineEnd: token.calc(token.modalHeaderHeight).sub(token.modalCloseBtnSize).div(2).equal(),
zIndex: token.calc(token.zIndexPopupBase).add(10).equal(),
padding: 0,
color: token.modalCloseIconColor,
fontWeight: token.fontWeightStrong,
lineHeight: 1,
textDecoration: 'none',
background: 'transparent',
borderRadius: token.borderRadiusSM,
width: token.modalCloseBtnSize,
height: token.modalCloseBtnSize,
border: 0,
outline: 0,
cursor: 'pointer',
transition: ['color', 'background-color'].map(prop => `${prop} ${motionDurationMid}`).join(', '),
'&-x': {
display: 'flex',
fontSize: token.fontSizeLG,
fontStyle: 'normal',
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.modalCloseBtnSize),
justifyContent: 'center',
textTransform: 'none',
textRendering: 'auto'
},
'&:disabled': {
pointerEvents: 'none'
},
'&:hover': {
color: token.modalCloseIconHoverColor,
backgroundColor: token.colorBgTextHover,
textDecoration: 'none'
},
'&:active': {
backgroundColor: token.colorBgTextActive
},
...(0,_style__WEBPACK_IMPORTED_MODULE_3__.genFocusStyle)(token)
},
[`${componentCls}-header`]: {
color: token.colorText,
background: token.headerBg,
borderRadius: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.borderRadiusLG)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.borderRadiusLG)} 0 0`,
marginBottom: token.headerMarginBottom,
padding: token.headerPadding,
borderBottom: token.headerBorderBottom
},
[`${componentCls}-body`]: {
fontSize: token.fontSize,
lineHeight: token.lineHeight,
wordWrap: 'break-word',
padding: token.bodyPadding,
[`${componentCls}-body-skeleton`]: {
width: '100%',
height: '100%',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
margin: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.margin)} auto`
}
},
[`${componentCls}-footer`]: {
textAlign: 'end',
background: token.footerBg,
marginTop: token.footerMarginTop,
padding: token.footerPadding,
borderTop: token.footerBorderTop,
borderRadius: token.footerBorderRadius,
[`> ${token.antCls}-btn + ${token.antCls}-btn`]: {
marginInlineStart: token.marginXS
}
},
[`${componentCls}-open`]: {
overflow: 'hidden'
}
}
},
// ======================== Pure =========================
{
[`${componentCls}-pure-panel`]: {
top: 'auto',
padding: 0,
display: 'flex',
flexDirection: 'column',
[`${componentCls}-container,
${componentCls}-body,
${componentCls}-confirm-body-wrapper`]: {
display: 'flex',
flexDirection: 'column',
flex: 'auto'
},
[`${componentCls}-confirm-body`]: {
marginBottom: 'auto'
}
}
}];
};
const genRTLStyle = token => {
const {
componentCls
} = token;
return {
[`${componentCls}-root`]: {
[`${componentCls}-wrap-rtl`]: {
direction: 'rtl',
[`${componentCls}-confirm-body`]: {
direction: 'rtl'
}
}
}
};
};
const genResponsiveWidthStyle = token => {
const {
componentCls
} = token;
const oriGridMediaSizesMap = (0,_grid_style__WEBPACK_IMPORTED_MODULE_2__.getMediaSize)(token);
const gridMediaSizesMap = {
...oriGridMediaSizesMap
};
delete gridMediaSizesMap.xs;
const cssVarPrefix = `--${componentCls.replace('.', '')}-`;
const responsiveStyles = Object.keys(gridMediaSizesMap).map(key => ({
[`@media (min-width: ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(gridMediaSizesMap[key])})`]: {
width: `var(${cssVarPrefix}${key}-width)`
}
}));
return {
[`${componentCls}-root`]: {
[componentCls]: [].concat((0,_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__["default"])(Object.keys(oriGridMediaSizesMap).map((currentKey, index) => {
const previousKey = Object.keys(oriGridMediaSizesMap)[index - 1];
return previousKey ? {
[`${cssVarPrefix}${currentKey}-width`]: `var(${cssVarPrefix}${previousKey}-width)`
} : null;
})), [{
width: `var(${cssVarPrefix}xs-width)`
}], (0,_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__["default"])(responsiveStyles))
}
};
};
// ============================== Export ==============================
const prepareToken = token => {
const headerPaddingVertical = token.padding;
const headerFontSize = token.fontSizeHeading5;
const headerLineHeight = token.lineHeightHeading5;
const modalToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_6__.mergeToken)(token, {
modalHeaderHeight: token.calc(token.calc(headerLineHeight).mul(headerFontSize).equal()).add(token.calc(headerPaddingVertical).mul(2).equal()).equal(),
modalFooterBorderColorSplit: token.colorSplit,
modalFooterBorderStyle: token.lineType,
modalFooterBorderWidth: token.lineWidth,
modalCloseIconColor: token.colorIcon,
modalCloseIconHoverColor: token.colorIconHover,
modalCloseBtnSize: token.controlHeight,
modalConfirmIconSize: token.fontHeight,
modalTitleHeight: token.calc(token.titleFontSize).mul(token.titleLineHeight).equal()
});
return modalToken;
};
const prepareComponentToken = token => ({
footerBg: 'transparent',
headerBg: 'transparent',
titleLineHeight: token.lineHeightHeading5,
titleFontSize: token.fontSizeHeading5,
contentBg: token.colorBgElevated,
titleColor: token.colorTextHeading,
// internal
contentPadding: token.wireframe ? 0 : `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.paddingMD)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.paddingContentHorizontalLG)}`,
headerPadding: token.wireframe ? `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.padding)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.paddingLG)}` : 0,
headerBorderBottom: token.wireframe ? `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}` : 'none',
headerMarginBottom: token.wireframe ? 0 : token.marginXS,
bodyPadding: token.wireframe ? token.paddingLG : 0,
footerPadding: token.wireframe ? `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.paddingXS)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.padding)}` : 0,
footerBorderTop: token.wireframe ? `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.lineWidth)} ${token.lineType} ${token.colorSplit}` : 'none',
footerBorderRadius: token.wireframe ? `0 0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.borderRadiusLG)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.borderRadiusLG)}` : 0,
footerMarginTop: token.wireframe ? 0 : token.marginSM,
confirmBodyPadding: token.wireframe ? `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.padding * 2)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.padding * 2)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.unit)(token.paddingLG)}` : 0,
confirmIconMarginInlineEnd: token.wireframe ? token.margin : token.marginSM,
confirmBtnsMarginTop: token.wireframe ? token.marginLG : token.marginSM,
mask: true
});
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_7__.genStyleHooks)('Modal', token => {
const modalToken = prepareToken(token);
return [genModalStyle(modalToken), genRTLStyle(modalToken), genModalMaskStyle(modalToken), (0,_style_motion__WEBPACK_IMPORTED_MODULE_5__.initZoomMotion)(modalToken, 'zoom'), genResponsiveWidthStyle(modalToken)];
}, prepareComponentToken, {
unitless: {
titleLineHeight: true
}
}));
/***/ }),
/***/ "./components/notification/style/index.ts":
/*!************************************************************!*\
!*** ./components/notification/style/index.ts + 3 modules ***!
\************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ notification_style; },
genNoticeStyle: function() { return /* binding */ genNoticeStyle; },
prepareComponentToken: function() { return /* binding */ prepareComponentToken; },
prepareNotificationToken: function() { return /* binding */ prepareNotificationToken; }
});
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
// EXTERNAL MODULE: ./components/_util/hooks/useZIndex.ts
var useZIndex = __webpack_require__("./components/_util/hooks/useZIndex.ts");
// EXTERNAL MODULE: ./components/style/index.tsx
var style = __webpack_require__("./components/style/index.tsx");
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
;// ./components/notification/style/placement.ts
const genNotificationPlacementStyle = token => {
const {
componentCls,
notificationMarginEdge,
animationMaxHeight
} = token;
const noticeCls = `${componentCls}-notice`;
const rightFadeIn = new cssinjs.Keyframes('antNotificationFadeIn', {
'0%': {
transform: `translate3d(100%, 0, 0)`,
opacity: 0
},
'100%': {
transform: `translate3d(0, 0, 0)`,
opacity: 1
}
});
const topFadeIn = new cssinjs.Keyframes('antNotificationTopFadeIn', {
'0%': {
top: -animationMaxHeight,
opacity: 0
},
'100%': {
top: 0,
opacity: 1
}
});
const bottomFadeIn = new cssinjs.Keyframes('antNotificationBottomFadeIn', {
'0%': {
bottom: token.calc(animationMaxHeight).mul(-1).equal(),
opacity: 0
},
'100%': {
bottom: 0,
opacity: 1
}
});
const leftFadeIn = new cssinjs.Keyframes('antNotificationLeftFadeIn', {
'0%': {
transform: `translate3d(-100%, 0, 0)`,
opacity: 0
},
'100%': {
transform: `translate3d(0, 0, 0)`,
opacity: 1
}
});
return {
[componentCls]: {
[`&${componentCls}-top, &${componentCls}-bottom`]: {
marginInline: 0,
[noticeCls]: {
marginInline: 'auto auto'
}
},
[`&${componentCls}-top`]: {
[`${componentCls}-fade-enter${componentCls}-fade-enter-active, ${componentCls}-fade-appear${componentCls}-fade-appear-active`]: {
animationName: topFadeIn
}
},
[`&${componentCls}-bottom`]: {
[`${componentCls}-fade-enter${componentCls}-fade-enter-active, ${componentCls}-fade-appear${componentCls}-fade-appear-active`]: {
animationName: bottomFadeIn
}
},
[`&${componentCls}-topRight, &${componentCls}-bottomRight`]: {
[`${componentCls}-fade-enter${componentCls}-fade-enter-active, ${componentCls}-fade-appear${componentCls}-fade-appear-active`]: {
animationName: rightFadeIn
}
},
[`&${componentCls}-topLeft, &${componentCls}-bottomLeft`]: {
marginRight: {
value: 0,
_skip_check_: true
},
marginLeft: {
value: notificationMarginEdge,
_skip_check_: true
},
[noticeCls]: {
marginInlineEnd: 'auto',
marginInlineStart: 0
},
[`${componentCls}-fade-enter${componentCls}-fade-enter-active, ${componentCls}-fade-appear${componentCls}-fade-appear-active`]: {
animationName: leftFadeIn
}
}
}
};
};
/* harmony default export */ var placement = (genNotificationPlacementStyle);
;// ./components/notification/interface.ts
const NotificationPlacements = ['top', 'topLeft', 'topRight', 'bottom', 'bottomLeft', 'bottomRight'];
;// ./components/notification/style/stack.ts
const placementAlignProperty = {
topLeft: 'left',
topRight: 'right',
bottomLeft: 'left',
bottomRight: 'right',
top: 'left',
bottom: 'left'
};
const genPlacementStackStyle = (token, placement) => {
const {
componentCls
} = token;
return {
[`${componentCls}-${placement}`]: {
[`&${componentCls}-stack > ${componentCls}-notice-wrapper`]: {
[placement.startsWith('top') ? 'top' : 'bottom']: 0,
[placementAlignProperty[placement]]: {
value: 0,
_skip_check_: true
}
}
}
};
};
const genStackChildrenStyle = token => {
const childrenStyle = {};
for (let i = 1; i < token.notificationStackLayer; i++) {
childrenStyle[`&:nth-last-child(${i + 1})`] = {
overflow: 'hidden',
[`& > ${token.componentCls}-notice`]: {
opacity: 0,
transition: `opacity ${token.motionDurationMid}`
}
};
}
return {
[`&:not(:nth-last-child(-n+${token.notificationStackLayer}))`]: {
opacity: 0,
overflow: 'hidden',
color: 'transparent',
pointerEvents: 'none'
},
...childrenStyle
};
};
const genStackedNoticeStyle = token => {
const childrenStyle = {};
for (let i = 1; i < token.notificationStackLayer; i++) {
childrenStyle[`&:nth-last-child(${i + 1})`] = {
background: token.colorBgBlur,
backdropFilter: 'blur(10px)',
'-webkit-backdrop-filter': 'blur(10px)'
};
}
return childrenStyle;
};
const genStackStyle = token => {
const {
componentCls
} = token;
return {
[`${componentCls}-stack`]: {
[`& > ${componentCls}-notice-wrapper`]: {
transition: `transform ${token.motionDurationSlow}, backdrop-filter 0s`,
willChange: 'transform, opacity',
position: 'absolute',
...genStackChildrenStyle(token)
}
},
[`${componentCls}-stack:not(${componentCls}-stack-expanded)`]: {
[`& > ${componentCls}-notice-wrapper`]: {
...genStackedNoticeStyle(token)
}
},
[`${componentCls}-stack${componentCls}-stack-expanded`]: {
[`& > ${componentCls}-notice-wrapper`]: {
'&:not(:nth-last-child(-n + 1))': {
opacity: 1,
overflow: 'unset',
color: 'inherit',
pointerEvents: 'auto',
[`& > ${token.componentCls}-notice`]: {
opacity: 1
}
},
'&:after': {
content: '""',
position: 'absolute',
height: token.margin,
width: '100%',
insetInline: 0,
bottom: token.calc(token.margin).mul(-1).equal(),
background: 'transparent',
pointerEvents: 'auto'
}
}
},
...NotificationPlacements.map(placement => genPlacementStackStyle(token, placement)).reduce((acc, cur) => ({
...acc,
...cur
}), {})
};
};
/* harmony default export */ var stack = (genStackStyle);
;// ./components/notification/style/index.ts
const genNoticeStyle = token => {
const {
iconCls,
componentCls,
// .ant-notification
boxShadow,
fontSizeLG,
notificationMarginBottom,
borderRadiusLG,
colorSuccess,
colorInfo,
colorWarning,
colorError,
colorTextHeading,
notificationBg,
notificationPadding,
notificationMarginEdge,
progressBg,
notificationProgressHeight,
fontSize,
lineHeight,
width,
notificationIconSize,
colorText,
colorSuccessBg,
colorErrorBg,
colorInfoBg,
colorWarningBg,
motionDurationMid
} = token;
const noticeCls = `${componentCls}-notice`;
return {
position: 'relative',
marginBottom: notificationMarginBottom,
marginInlineStart: 'auto',
background: notificationBg,
borderRadius: borderRadiusLG,
boxShadow,
[noticeCls]: {
padding: notificationPadding,
width,
maxWidth: `calc(100vw - ${(0,cssinjs.unit)(token.calc(notificationMarginEdge).mul(2).equal())})`,
lineHeight,
wordWrap: 'break-word',
borderRadius: borderRadiusLG,
overflow: 'hidden',
// Type-specific background colors
'&-success': colorSuccessBg ? {
background: colorSuccessBg
} : {},
'&-error': colorErrorBg ? {
background: colorErrorBg
} : {},
'&-info': colorInfoBg ? {
background: colorInfoBg
} : {},
'&-warning': colorWarningBg ? {
background: colorWarningBg
} : {}
},
[`${noticeCls}-title`]: {
marginBottom: token.marginXS,
color: colorTextHeading,
fontSize: fontSizeLG,
lineHeight: token.lineHeightLG
},
[`${noticeCls}-description`]: {
fontSize,
color: colorText,
marginTop: token.marginXS,
'&:first-child': {
marginTop: 0,
marginInlineEnd: token.marginSM
}
},
[`${noticeCls}-closable ${noticeCls}-title`]: {
paddingInlineEnd: token.paddingLG
},
[`${noticeCls}-with-icon ${noticeCls}-title`]: {
marginBottom: token.marginXS,
marginInlineStart: token.calc(token.marginSM).add(notificationIconSize).equal(),
fontSize: fontSizeLG
},
[`${noticeCls}-with-icon ${noticeCls}-description`]: {
marginInlineStart: token.calc(token.marginSM).add(notificationIconSize).equal(),
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: 1,
// 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: ['color', 'background-color'].map(prop => `${prop} ${motionDurationMid}`).join(', '),
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
background: 'none',
border: 'none',
'&:hover': {
color: token.colorIconHover,
backgroundColor: token.colorBgTextHover
},
'&:active': {
backgroundColor: token.colorBgTextActive
},
...(0,style.genFocusStyle)(token)
},
[`${noticeCls}-progress`]: {
position: 'absolute',
display: 'block',
appearance: 'none',
inlineSize: `calc(100% - ${(0,cssinjs.unit)(borderRadiusLG)} * 2)`,
left: {
_skip_check_: true,
value: borderRadiusLG
},
right: {
_skip_check_: true,
value: borderRadiusLG
},
bottom: 0,
blockSize: notificationProgressHeight,
border: 0,
'&, &::-webkit-progress-bar': {
borderRadius: borderRadiusLG,
backgroundColor: `rgba(0, 0, 0, 0.04)`
},
'&::-moz-progress-bar': {
background: progressBg
},
'&::-webkit-progress-value': {
borderRadius: borderRadiusLG,
background: progressBg
}
},
[`${noticeCls}-actions`]: {
float: 'right',
marginTop: token.marginSM
}
};
};
const genNotificationStyle = token => {
const {
componentCls,
// .ant-notification
notificationMarginBottom,
notificationMarginEdge,
motionDurationMid,
motionEaseInOut
} = token;
const noticeCls = `${componentCls}-notice`;
const fadeOut = new cssinjs.Keyframes('antNotificationFadeOut', {
'0%': {
maxHeight: token.animationMaxHeight,
marginBottom: notificationMarginBottom
},
'100%': {
maxHeight: 0,
marginBottom: 0,
paddingTop: 0,
paddingBottom: 0,
opacity: 0
}
});
return [
// ============================ Holder ============================
{
[componentCls]: {
...(0,style.resetComponent)(token),
position: 'fixed',
zIndex: token.zIndexPopup,
marginRight: {
value: notificationMarginEdge,
_skip_check_: true
},
[`${componentCls}-hook-holder`]: {
position: 'relative'
},
// animation
[`${componentCls}-fade-appear-prepare`]: {
opacity: '0 !important'
},
[`${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`]: {
animationPlayState: 'running'
},
[`${componentCls}-fade-leave${componentCls}-fade-leave-active`]: {
animationName: fadeOut,
animationPlayState: 'running'
},
// RTL
'&-rtl': {
direction: 'rtl',
[`${noticeCls}-actions`]: {
float: 'left'
}
}
}
},
// ============================ Notice ============================
{
[componentCls]: {
[`${noticeCls}-wrapper`]: genNoticeStyle(token)
}
}];
};
// ============================== Export ==============================
const prepareComponentToken = token => ({
zIndexPopup: token.zIndexPopupBase + useZIndex.CONTAINER_MAX_OFFSET + 50,
width: 384,
progressBg: `linear-gradient(90deg, ${token.colorPrimaryBorderHover}, ${token.colorPrimary})`,
// Fix notification background color issue
// https://github.com/ant-design/ant-design/issues/55649
// https://github.com/ant-design/ant-design/issues/56055
colorSuccessBg: undefined,
colorErrorBg: undefined,
colorInfoBg: undefined,
colorWarningBg: undefined
});
const prepareNotificationToken = token => {
const notificationPaddingVertical = token.paddingMD;
const notificationPaddingHorizontal = token.paddingLG;
const notificationToken = (0,es.mergeToken)(token, {
notificationBg: token.colorBgElevated,
notificationPaddingVertical,
notificationPaddingHorizontal,
notificationIconSize: token.calc(token.fontSizeLG).mul(token.lineHeightLG).equal(),
notificationCloseButtonSize: token.calc(token.controlHeightLG).mul(0.55).equal(),
notificationMarginBottom: token.margin,
notificationPadding: `${(0,cssinjs.unit)(token.paddingMD)} ${(0,cssinjs.unit)(token.paddingContentHorizontalLG)}`,
notificationMarginEdge: token.marginLG,
animationMaxHeight: 150,
notificationStackLayer: 3,
notificationProgressHeight: 2
});
return notificationToken;
};
/* harmony default export */ var notification_style = ((0,genStyleUtils.genStyleHooks)('Notification', token => {
const notificationToken = prepareNotificationToken(token);
return [genNotificationStyle(notificationToken), placement(notificationToken), stack(notificationToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/pagination/style/index.ts":
/*!**********************************************!*\
!*** ./components/pagination/style/index.ts ***!
\**********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; },
/* harmony export */ prepareToken: function() { return /* binding */ prepareToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _input_style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../input/style */ "./components/input/style/index.ts");
/* harmony import */ var _input_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../input/style */ "./components/input/style/token.ts");
/* harmony import */ var _input_style_variants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../input/style/variants */ "./components/input/style/variants.ts");
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../theme/util/genStyleUtils */ "./components/theme/util/genStyleUtils.ts");
const genPaginationDisabledStyle = token => {
const {
componentCls
} = token;
return {
[`${componentCls}-disabled`]: {
'&, &:hover': {
cursor: 'not-allowed',
[`${componentCls}-item-link`]: {
color: token.colorTextDisabled,
cursor: 'not-allowed'
}
},
'&:focus-visible': {
cursor: 'not-allowed',
[`${componentCls}-item-link`]: {
color: token.colorTextDisabled,
cursor: 'not-allowed'
}
}
},
[`&${componentCls}-disabled`]: {
cursor: 'not-allowed',
[`${componentCls}-item`]: {
cursor: 'not-allowed',
backgroundColor: 'transparent',
'&:hover, &:active': {
backgroundColor: 'transparent'
},
a: {
color: token.colorTextDisabled,
backgroundColor: 'transparent',
border: 'none',
cursor: 'not-allowed'
},
'&-active': {
borderColor: token.colorBorder,
backgroundColor: token.itemActiveBgDisabled,
'&:hover, &:active': {
backgroundColor: token.itemActiveBgDisabled
},
a: {
color: token.itemActiveColorDisabled
}
}
},
[`${componentCls}-item-link`]: {
color: token.colorTextDisabled,
cursor: 'not-allowed',
'&:hover, &:active': {
backgroundColor: 'transparent'
},
[`${componentCls}-simple&`]: {
backgroundColor: 'transparent',
'&:hover, &:active': {
backgroundColor: 'transparent'
}
}
},
[`${componentCls}-simple-pager`]: {
color: token.colorTextDisabled
},
[`${componentCls}-jump-prev, ${componentCls}-jump-next`]: {
[`${componentCls}-item-link-icon`]: {
opacity: 0
},
[`${componentCls}-item-ellipsis`]: {
opacity: 1
}
}
}
};
};
const genPaginationSmallStyle = token => {
const {
componentCls
} = token;
return {
[`&${componentCls}-small ${componentCls}-options`]: {
marginInlineStart: token.paginationMiniOptionsMarginInlineStart,
'&-quick-jumper': {
input: {
...(0,_input_style__WEBPACK_IMPORTED_MODULE_1__.genInputSmallStyle)(token),
width: token.paginationMiniQuickJumperInputWidth
}
}
}
};
};
const genPaginationLargeStyle = token => {
const {
componentCls
} = token;
return {
[`&${componentCls}-large ${componentCls}-options`]: {
'&-quick-jumper': {
input: {
...(0,_input_style__WEBPACK_IMPORTED_MODULE_1__.genInputLargeStyle)(token)
}
}
}
};
};
const genPaginationSimpleStyle = token => {
const {
componentCls,
antCls
} = token;
const [, varRef] = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_6__.genCssVar)(antCls, 'pagination');
return {
[`&${componentCls}-simple`]: {
[`${componentCls}-prev, ${componentCls}-next`]: {
height: varRef(`item-size-actual`),
lineHeight: varRef(`item-size-actual`),
verticalAlign: 'top',
[`${componentCls}-item-link`]: {
height: varRef(`item-size-actual`),
backgroundColor: 'transparent',
border: 0,
'&:hover': {
backgroundColor: token.colorBgTextHover
},
'&:active': {
backgroundColor: token.colorBgTextActive
},
'&::after': {
height: varRef(`item-size-actual`),
lineHeight: varRef(`item-size-actual`)
}
}
},
[`${componentCls}-simple-pager`]: {
display: 'inline-flex',
alignItems: 'center',
height: varRef(`item-size-actual`),
marginInlineEnd: varRef(`item-spacing-actual`),
input: {
boxSizing: 'border-box',
height: '100%',
width: token.quickJumperInputWidth,
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paginationItemPaddingInline)}`,
textAlign: 'center',
backgroundColor: token.itemInputBg,
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
borderRadius: token.borderRadius,
outline: 'none',
transition: `border-color ${token.motionDurationMid}`,
color: 'inherit',
'&:hover': {
borderColor: token.colorPrimary
},
'&:focus': {
borderColor: token.colorPrimaryHover,
boxShadow: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.inputOutlineOffset)} 0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.controlOutlineWidth)} ${token.controlOutline}`
},
'&[disabled]': {
color: token.colorTextDisabled,
backgroundColor: token.colorBgContainerDisabled,
borderColor: token.colorBorder,
cursor: 'not-allowed'
}
}
},
[`&${componentCls}-disabled`]: {
[`${componentCls}-prev, ${componentCls}-next`]: {
[`${componentCls}-item-link`]: {
'&:hover, &:active': {
backgroundColor: 'transparent'
}
}
}
},
[`&${componentCls}-small`]: {
[`${componentCls}-simple-pager`]: {
input: {
width: token.paginationMiniQuickJumperInputWidth
}
}
}
}
};
};
const genPaginationJumpStyle = token => {
const {
componentCls,
antCls
} = token;
const [, varRef] = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_6__.genCssVar)(antCls, 'pagination');
return {
[`${componentCls}-jump-prev, ${componentCls}-jump-next`]: {
outline: 0,
[`${componentCls}-item-container`]: {
position: 'relative',
[`${componentCls}-item-link-icon`]: {
color: token.colorPrimary,
fontSize: token.fontSizeSM,
opacity: 0,
transition: `all ${token.motionDurationMid}`,
'&-svg': {
top: 0,
insetInlineEnd: 0,
bottom: 0,
insetInlineStart: 0,
margin: 'auto'
}
},
[`${componentCls}-item-ellipsis`]: {
position: 'absolute',
top: 0,
insetInlineEnd: 0,
bottom: 0,
insetInlineStart: 0,
display: 'block',
margin: 'auto',
color: token.colorTextDisabled,
letterSpacing: token.paginationEllipsisLetterSpacing,
textAlign: 'center',
textIndent: token.paginationEllipsisTextIndent,
opacity: 1,
transition: `all ${token.motionDurationMid}`
}
},
'&:hover': {
[`${componentCls}-item-link-icon`]: {
opacity: 1
},
[`${componentCls}-item-ellipsis`]: {
opacity: 0
}
}
},
[`
${componentCls}-prev,
${componentCls}-jump-prev,
${componentCls}-jump-next
`]: {
marginInlineEnd: varRef(`item-spacing-actual`)
},
[`
${componentCls}-prev,
${componentCls}-next,
${componentCls}-jump-prev,
${componentCls}-jump-next
`]: {
display: 'inline-block',
minWidth: varRef(`item-size-actual`),
height: varRef(`item-size-actual`),
color: token.colorText,
fontFamily: token.fontFamily,
lineHeight: varRef(`item-size-actual`),
textAlign: 'center',
verticalAlign: 'middle',
listStyle: 'none',
borderRadius: token.borderRadius,
cursor: 'pointer',
transition: `all ${token.motionDurationMid}`
},
[`${componentCls}-prev, ${componentCls}-next`]: {
outline: 0,
button: {
color: token.colorText,
cursor: 'pointer',
userSelect: 'none'
},
[`${componentCls}-item-link`]: {
display: 'block',
width: '100%',
height: '100%',
padding: 0,
fontSize: token.fontSizeSM,
textAlign: 'center',
backgroundColor: 'transparent',
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} transparent`,
borderRadius: token.borderRadius,
outline: 'none',
transition: `all ${token.motionDurationMid}`
},
[`&:hover ${componentCls}-item-link`]: {
backgroundColor: token.colorBgTextHover
},
[`&:active ${componentCls}-item-link`]: {
backgroundColor: token.colorBgTextActive
},
[`&${componentCls}-disabled:hover`]: {
[`${componentCls}-item-link`]: {
backgroundColor: 'transparent'
}
}
},
[`${componentCls}-slash`]: {
marginInlineEnd: token.paginationSlashMarginInlineEnd,
marginInlineStart: token.paginationSlashMarginInlineStart
},
[`${componentCls}-options`]: {
display: 'inline-block',
marginInlineStart: token.margin,
verticalAlign: 'middle',
'&-size-changer': {
width: 'auto'
},
'&-quick-jumper': {
display: 'inline-block',
height: varRef(`item-size-actual`),
marginInlineStart: token.marginXS,
lineHeight: varRef(`item-size-actual`),
verticalAlign: 'baseline',
input: {
...(0,_input_style__WEBPACK_IMPORTED_MODULE_1__.genBasicInputStyle)(token),
...(0,_input_style_variants__WEBPACK_IMPORTED_MODULE_3__.genBaseOutlinedStyle)(token, {
borderColor: token.colorBorder,
hoverBorderColor: token.colorPrimaryHover,
activeBorderColor: token.colorPrimary,
activeShadow: token.activeShadow
}),
'&[disabled]': {
...(0,_input_style_variants__WEBPACK_IMPORTED_MODULE_3__.genDisabledStyle)(token)
},
width: token.quickJumperInputWidth,
height: varRef(`item-size-actual`),
boxSizing: 'border-box',
margin: 0,
marginInlineStart: varRef(`item-spacing-actual`),
marginInlineEnd: varRef(`item-spacing-actual`)
}
}
}
};
};
const genPaginationItemStyle = token => {
const {
componentCls,
antCls
} = token;
const [, varRef] = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_6__.genCssVar)(antCls, 'pagination');
return {
[`${componentCls}-item`]: {
display: 'inline-block',
minWidth: varRef(`item-size-actual`),
height: varRef(`item-size-actual`),
marginInlineEnd: varRef(`item-spacing-actual`),
fontFamily: token.fontFamily,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(varRef('item-size-actual')).sub(2).equal()),
textAlign: 'center',
verticalAlign: 'middle',
listStyle: 'none',
backgroundColor: token.itemBg,
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} transparent`,
borderRadius: token.borderRadius,
outline: 0,
cursor: 'pointer',
userSelect: 'none',
a: {
display: 'block',
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paginationItemPaddingInline)}`,
color: token.colorText,
'&:hover': {
textDecoration: 'none'
}
},
[`&:not(${componentCls}-item-active)`]: {
'&:hover': {
transition: `all ${token.motionDurationMid}`,
backgroundColor: token.colorBgTextHover
},
'&:active': {
backgroundColor: token.colorBgTextActive
}
},
'&-active': {
fontWeight: token.fontWeightStrong,
backgroundColor: token.itemActiveBg,
borderColor: token.colorPrimary,
a: {
color: token.itemActiveColor
},
'&:hover': {
borderColor: token.colorPrimaryHover
},
'&:hover a': {
color: token.itemActiveColorHover
}
}
}
};
};
const genPaginationStyle = token => {
const {
componentCls,
antCls
} = token;
const [varName, varRef] = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_6__.genCssVar)(antCls, 'pagination');
return {
[componentCls]: {
[varName(`item-size-actual`)]: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.itemSize),
[varName(`item-spacing-actual`)]: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.marginXS),
'&-small': {
[varName(`item-size-actual`)]: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.itemSizeSM),
[varName(`item-spacing-actual`)]: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.marginXXS)
},
'&-large': {
[varName(`item-size-actual`)]: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.itemSizeLG),
[varName(`item-spacing-actual`)]: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.marginSM)
},
...(0,_style__WEBPACK_IMPORTED_MODULE_4__.resetComponent)(token),
display: 'flex',
alignItems: 'center',
'&-start': {
justifyContent: 'start'
},
'&-center': {
justifyContent: 'center'
},
'&-end': {
justifyContent: 'end'
},
'ul, ol': {
margin: 0,
padding: 0,
listStyle: 'none'
},
'&::after': {
display: 'block',
clear: 'both',
height: 0,
overflow: 'hidden',
visibility: 'hidden',
content: '""'
},
[`${componentCls}-total-text`]: {
display: 'inline-block',
height: varRef(`item-size-actual`),
marginInlineEnd: varRef(`item-spacing-actual`),
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(varRef(`item-size-actual`)).sub(2).equal()),
verticalAlign: 'middle'
},
// item style
...genPaginationItemStyle(token),
// jump btn style
...genPaginationJumpStyle(token),
// simple style
...genPaginationSimpleStyle(token),
// size style
...genPaginationSmallStyle(token),
...genPaginationLargeStyle(token),
// disabled style
...genPaginationDisabledStyle(token),
// media query style
[`@media only screen and (max-width: ${token.screenLG}px)`]: {
[`${componentCls}-item`]: {
'&-after-jump-prev, &-before-jump-next': {
display: 'none'
}
}
},
[`@media only screen and (max-width: ${token.screenSM}px)`]: {
[`${componentCls}-options`]: {
display: 'none'
}
}
},
// rtl style
[`&${token.componentCls}-rtl`]: {
direction: 'rtl'
}
};
};
const genPaginationFocusStyle = token => {
const {
componentCls
} = token;
return {
[`${componentCls}:not(${componentCls}-disabled)`]: {
[`${componentCls}-item`]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_4__.genFocusStyle)(token)
},
[`${componentCls}-jump-prev, ${componentCls}-jump-next`]: {
'&:focus-visible': {
[`${componentCls}-item-link-icon`]: {
opacity: 1
},
[`${componentCls}-item-ellipsis`]: {
opacity: 0
},
...(0,_style__WEBPACK_IMPORTED_MODULE_4__.genFocusOutline)(token)
}
},
[`${componentCls}-prev, ${componentCls}-next`]: {
[`&:focus-visible ${componentCls}-item-link`]: (0,_style__WEBPACK_IMPORTED_MODULE_4__.genFocusOutline)(token)
}
}
};
};
const prepareComponentToken = token => ({
itemBg: token.colorBgContainer,
itemSize: token.controlHeight,
itemSizeSM: token.controlHeightSM,
itemSizeLG: token.controlHeightLG,
itemActiveBg: token.colorBgContainer,
itemActiveColor: token.colorPrimary,
itemActiveColorHover: token.colorPrimaryHover,
itemLinkBg: token.colorBgContainer,
itemActiveColorDisabled: token.colorTextDisabled,
itemActiveBgDisabled: token.controlItemBgActiveDisabled,
itemInputBg: token.colorBgContainer,
miniOptionsSizeChangerTop: 0,
...(0,_input_style__WEBPACK_IMPORTED_MODULE_2__.initComponentToken)(token)
});
const prepareToken = token => (0,_theme_internal__WEBPACK_IMPORTED_MODULE_5__.mergeToken)(token, {
inputOutlineOffset: 0,
quickJumperInputWidth: token.calc(token.controlHeightLG).mul(1.25).equal(),
paginationMiniOptionsMarginInlineStart: token.calc(token.marginXXS).div(2).equal(),
paginationMiniQuickJumperInputWidth: token.calc(token.controlHeightLG).mul(1.1).equal(),
paginationItemPaddingInline: token.calc(token.marginXXS).mul(1.5).equal(),
paginationEllipsisLetterSpacing: token.calc(token.marginXXS).div(2).equal(),
paginationSlashMarginInlineStart: token.marginSM,
paginationSlashMarginInlineEnd: token.marginSM,
paginationEllipsisTextIndent: '0.13em' // magic for ui experience
}, (0,_input_style__WEBPACK_IMPORTED_MODULE_2__.initInputToken)(token));
// ============================== Export ==============================
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_6__.genStyleHooks)('Pagination', token => {
const paginationToken = prepareToken(token);
return [genPaginationStyle(paginationToken), genPaginationFocusStyle(paginationToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/popconfirm/style/index.ts":
/*!**********************************************!*\
!*** ./components/popconfirm/style/index.ts ***!
\**********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
// =============================== Base ===============================
const genBaseStyle = token => {
const {
componentCls,
iconCls,
antCls,
zIndexPopup,
colorText,
colorWarning,
marginXXS,
marginXS,
fontSize,
fontWeightStrong,
colorTextHeading
} = token;
return {
[componentCls]: {
zIndex: zIndexPopup,
[`&${antCls}-popover`]: {
fontSize
},
[`${componentCls}-message`]: {
marginBottom: marginXS,
display: 'flex',
flexWrap: 'nowrap',
alignItems: 'start',
[`> ${componentCls}-message-icon ${iconCls}`]: {
color: colorWarning,
fontSize,
lineHeight: 1,
marginInlineEnd: marginXS
},
[`${componentCls}-title`]: {
fontWeight: fontWeightStrong,
color: colorTextHeading,
'&:only-child': {
fontWeight: 'normal'
}
},
[`${componentCls}-description`]: {
marginTop: marginXXS,
color: colorText
}
},
[`${componentCls}-buttons`]: {
textAlign: 'end',
whiteSpace: 'nowrap',
button: {
marginInlineStart: marginXS
}
}
}
};
};
// ============================== Export ==============================
const prepareComponentToken = token => {
const {
zIndexPopupBase
} = token;
return {
zIndexPopup: zIndexPopupBase + 60
};
};
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_0__.genStyleHooks)('Popconfirm', genBaseStyle, prepareComponentToken, {
resetStyle: false
}));
/***/ }),
/***/ "./components/popover/style/index.ts":
/*!*******************************************!*\
!*** ./components/popover/style/index.ts ***!
\*******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _style_motion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style/motion */ "./components/style/motion/zoom.ts");
/* harmony import */ var _style_placementArrow__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../style/placementArrow */ "./components/style/placementArrow.ts");
/* harmony import */ var _style_roundedArrow__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../style/roundedArrow */ "./components/style/roundedArrow.ts");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/interface/presetColors.ts");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../theme/util/genStyleUtils */ "./components/theme/util/genStyleUtils.ts");
const FALL_BACK_ORIGIN = '50%';
const genBaseStyle = token => {
const {
componentCls,
popoverColor,
titleMinWidth,
fontWeightStrong,
innerPadding,
boxShadowSecondary,
colorTextHeading,
borderRadiusLG,
zIndexPopup,
titleMarginBottom,
colorBgElevated,
popoverBg,
titleBorderBottom,
innerContentPadding,
titlePadding,
antCls
} = token;
const [varName, varRef] = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_6__.genCssVar)(antCls, 'tooltip');
return [{
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_0__.resetComponent)(token),
position: 'absolute',
top: 0,
// use `left` to fix https://github.com/ant-design/ant-design/issues/39195
left: {
_skip_check_: true,
value: 0
},
zIndex: zIndexPopup,
fontWeight: 'normal',
whiteSpace: 'normal',
textAlign: 'start',
cursor: 'auto',
userSelect: 'text',
// When use `autoArrow`, origin will follow the arrow position
[varName('valid-offset-x')]: varRef('arrow-offset-x', 'var(--arrow-x)'),
transformOrigin: [varRef('valid-offset-x', FALL_BACK_ORIGIN), `var(--arrow-y, ${FALL_BACK_ORIGIN})`].join(' '),
[varName('arrow-background-color')]: colorBgElevated,
width: 'max-content',
maxWidth: '100vw',
'&-rtl': {
direction: 'rtl'
},
'&-hidden': {
display: 'none'
},
[`${componentCls}-content`]: {
position: 'relative'
},
[`${componentCls}-container`]: {
backgroundColor: popoverBg,
backgroundClip: 'padding-box',
borderRadius: borderRadiusLG,
boxShadow: boxShadowSecondary,
padding: innerPadding
},
[`${componentCls}-title`]: {
minWidth: titleMinWidth,
marginBottom: titleMarginBottom,
color: colorTextHeading,
fontWeight: fontWeightStrong,
borderBottom: titleBorderBottom,
padding: titlePadding
},
[`${componentCls}-content`]: {
color: popoverColor,
padding: innerContentPadding
}
}
},
// Arrow Style
(0,_style_placementArrow__WEBPACK_IMPORTED_MODULE_2__["default"])(token, varRef('arrow-background-color')),
// Pure Render
{
[`${componentCls}-pure`]: {
position: 'relative',
maxWidth: 'none',
margin: token.sizePopupArrow,
display: 'inline-block'
}
}];
};
const genColorStyle = token => {
const {
componentCls,
antCls
} = token;
const [varName] = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_6__.genCssVar)(antCls, 'tooltip');
return {
[componentCls]: _theme_internal__WEBPACK_IMPORTED_MODULE_4__.PresetColors.map(colorKey => {
const lightColor = token[`${colorKey}6`];
return {
[`&${componentCls}-${colorKey}`]: {
[varName('arrow-background-color')]: lightColor,
[`${componentCls}-inner`]: {
backgroundColor: lightColor
},
[`${componentCls}-arrow`]: {
background: 'transparent'
}
}
};
})
};
};
const prepareComponentToken = token => {
const {
lineWidth,
controlHeight,
fontHeight,
padding,
wireframe,
zIndexPopupBase,
borderRadiusLG,
marginXS,
lineType,
colorSplit,
paddingSM
} = token;
const titlePaddingBlockDist = controlHeight - fontHeight;
const popoverTitlePaddingBlockTop = titlePaddingBlockDist / 2;
const popoverTitlePaddingBlockBottom = titlePaddingBlockDist / 2 - lineWidth;
const popoverPaddingHorizontal = padding;
return {
titleMinWidth: 177,
zIndexPopup: zIndexPopupBase + 30,
...(0,_style_roundedArrow__WEBPACK_IMPORTED_MODULE_3__.getArrowToken)(token),
...(0,_style_placementArrow__WEBPACK_IMPORTED_MODULE_2__.getArrowOffsetToken)({
contentRadius: borderRadiusLG,
limitVerticalRadius: true
}),
// internal
innerPadding: wireframe ? 0 : 12,
titleMarginBottom: wireframe ? 0 : marginXS,
titlePadding: wireframe ? `${popoverTitlePaddingBlockTop}px ${popoverPaddingHorizontal}px ${popoverTitlePaddingBlockBottom}px` : 0,
titleBorderBottom: wireframe ? `${lineWidth}px ${lineType} ${colorSplit}` : 'none',
innerContentPadding: wireframe ? `${paddingSM}px ${popoverPaddingHorizontal}px` : 0
};
};
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_6__.genStyleHooks)('Popover', token => {
const {
colorBgElevated,
colorText
} = token;
const popoverToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_5__.mergeToken)(token, {
popoverBg: colorBgElevated,
popoverColor: colorText
});
return [genBaseStyle(popoverToken), genColorStyle(popoverToken), (0,_style_motion__WEBPACK_IMPORTED_MODULE_1__.initZoomMotion)(popoverToken, 'zoom-big')];
}, prepareComponentToken, {
resetStyle: false,
deprecatedTokens: [['width', 'titleMinWidth'], ['minWidth', 'titleMinWidth']]
}));
/***/ }),
/***/ "./components/progress/style/index.ts":
/*!********************************************!*\
!*** ./components/progress/style/index.ts ***!
\********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ LineStrokeColorVar: function() { return /* binding */ LineStrokeColorVar; },
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const LineStrokeColorVar = '--progress-line-stroke-color';
const genAntProgressActive = isRtl => {
const direction = isRtl ? '100%' : '-100%';
return new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes(`antProgress${isRtl ? 'RTL' : 'LTR'}Active`, {
'0%': {
transform: `translateX(${direction}) scaleX(0)`,
opacity: 0.1
},
'20%': {
transform: `translateX(${direction}) scaleX(0)`,
opacity: 0.5
},
to: {
transform: 'translateX(0) scaleX(1)',
opacity: 0
}
});
};
// ====================================================================
// == Base ==
// ====================================================================
const genBaseStyle = token => {
const {
componentCls: progressCls,
iconCls: iconPrefixCls
} = token;
return {
[progressCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
display: 'inline-flex',
'&-rtl': {
direction: 'rtl'
},
[`${progressCls}-indicator`]: {
color: token.colorText,
lineHeight: 1,
whiteSpace: 'nowrap',
verticalAlign: 'middle',
wordBreak: 'normal',
[iconPrefixCls]: {
fontSize: token.fontSize
}
},
[`&${progressCls}-status-exception`]: {
[`${progressCls}-indicator`]: {
color: token.colorError
}
},
[`&${progressCls}-status-success`]: {
[`${progressCls}-indicator`]: {
color: token.colorSuccess
}
}
}
};
};
// ====================================================================
// == Line ==
// ====================================================================
const genLineStyle = token => {
const {
componentCls
} = token;
return {
[`${componentCls}-line`]: {
position: 'relative',
width: '100%',
fontSize: token.fontSize,
[`${componentCls}-body`]: {
display: 'inline-flex',
alignItems: 'center',
width: '100%',
gap: token.marginXS
},
[`${componentCls}-rail`]: {
flex: 'auto',
background: token.remainingColor,
borderRadius: token.lineBorderRadius,
position: 'relative',
width: '100%',
overflow: 'hidden'
},
[`&${componentCls}-status-active`]: {
[`${componentCls}-track:after`]: {
content: '""',
position: 'absolute',
inset: 0,
backgroundColor: token.colorBgContainer,
borderRadius: 'inherit',
opacity: 0,
animationName: genAntProgressActive(),
animationDuration: token.progressActiveMotionDuration,
animationTimingFunction: token.motionEaseOutQuint,
animationIterationCount: 'infinite'
}
},
[`${componentCls}-track`]: {
position: 'absolute',
insetInlineStart: 0,
insetBlock: 0,
borderRadius: 'inherit',
background: token.defaultColor,
transition: `all ${token.motionDurationSlow} ${token.motionEaseInOutCirc}`,
minWidth: 'max-content',
display: 'flex',
alignItems: 'center',
'&-success': {
background: token.colorSuccess
}
},
[`&${componentCls}-status-exception`]: {
[`${componentCls}-track`]: {
background: token.colorError
}
},
[`&${componentCls}-status-success`]: {
[`${componentCls}-track`]: {
background: token.colorSuccess
}
},
// >>>>> indicator
// >>> Outer
[`${componentCls}-indicator-outer`]: {
[`&${componentCls}-indicator-start`]: {
order: -1
}
},
[`${componentCls}-body-layout-bottom`]: {
flexDirection: 'column',
alignItems: 'center',
gap: token.marginXXS
},
// >>> Inner
[`${componentCls}-indicator${componentCls}-indicator-inner`]: {
color: token.colorWhite,
paddingInline: token.paddingXXS,
width: '100%',
display: 'flex',
justifyContent: 'center',
[`&${componentCls}-indicator-end`]: {
justifyContent: 'end'
},
[`&${componentCls}-indicator-start`]: {
justifyContent: 'start'
},
[`&${componentCls}-indicator-bright`]: {
color: 'rgba(0, 0, 0, 0.45)'
}
}
}
};
};
// ====================================================================
// == Circle ==
// ====================================================================
const genCircleStyle = token => {
const {
componentCls: progressCls,
iconCls: iconPrefixCls
} = token;
return {
[`${progressCls}-circle`]: {
[`${progressCls}-circle-rail`]: {
stroke: token.remainingColor
},
[`${progressCls}-body:not(${progressCls}-circle-gradient)`]: {
[`${progressCls}-circle-path`]: {
stroke: token.defaultColor
}
},
[`${progressCls}-body`]: {
position: 'relative',
lineHeight: 1,
backgroundColor: 'transparent'
},
[`${progressCls}-indicator`]: {
position: 'absolute',
insetBlockStart: '50%',
insetInlineStart: 0,
width: '100%',
margin: 0,
padding: 0,
color: token.circleTextColor,
fontSize: token.circleTextFontSize,
lineHeight: 1,
whiteSpace: 'normal',
textAlign: 'center',
transform: 'translateY(-50%)',
[iconPrefixCls]: {
fontSize: token.circleIconFontSize
}
},
[`&${progressCls}-status-exception`]: {
[`${progressCls}-body:not(${progressCls}-circle-gradient)`]: {
[`${progressCls}-circle-path`]: {
stroke: token.colorError
}
}
},
[`&${progressCls}-status-success`]: {
[`${progressCls}-body:not(${progressCls}-circle-gradient)`]: {
[`${progressCls}-circle-path`]: {
stroke: token.colorSuccess
}
}
}
},
[`${progressCls}-inline-circle`]: {
lineHeight: 1,
[`${progressCls}-inner`]: {
verticalAlign: 'bottom'
}
}
};
};
// ====================================================================
// == Step ==
// ====================================================================
const genStepStyle = token => {
const {
componentCls: progressCls
} = token;
return {
[progressCls]: {
[`${progressCls}-steps`]: {
display: 'inline-block',
'&-body': {
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
gap: token.progressStepMarginInlineEnd,
[`${progressCls}-indicator`]: {
marginInlineStart: token.marginXS
}
},
'&-item': {
flexShrink: 0,
minWidth: token.progressStepMinWidth,
backgroundColor: token.remainingColor,
transition: `all ${token.motionDurationSlow}`,
'&-active': {
backgroundColor: token.defaultColor
}
}
}
}
};
};
// ====================================================================
// == Small Line ==
// ====================================================================
const genSmallLine = token => {
const {
componentCls: progressCls,
iconCls: iconPrefixCls
} = token;
return {
[progressCls]: {
[`${progressCls}-small&-line, ${progressCls}-small&-line ${progressCls}-indicator ${iconPrefixCls}`]: {
fontSize: token.fontSizeSM
}
}
};
};
// ====================================================================
// == Export ==
// ====================================================================
const prepareComponentToken = token => ({
circleTextColor: token.colorText,
defaultColor: token.colorInfo,
remainingColor: token.colorFillSecondary,
lineBorderRadius: 100,
// magic for capsule shape, should be a very large number
circleTextFontSize: '1em',
circleIconFontSize: `${token.fontSize / token.fontSizeSM}em`
});
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genStyleHooks)('Progress', token => {
const progressStepMarginInlineEnd = token.calc(token.marginXXS).div(2).equal();
const progressToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token, {
progressStepMarginInlineEnd,
progressStepMinWidth: progressStepMarginInlineEnd,
progressActiveMotionDuration: '2.4s'
});
return [genBaseStyle(progressToken), genLineStyle(progressToken), genCircleStyle(progressToken), genStepStyle(progressToken), genSmallLine(progressToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/qr-code/style/index.ts":
/*!*******************************************!*\
!*** ./components/qr-code/style/index.ts ***!
\*******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ant-design/fast-color */ "./node_modules/@ant-design/fast-color/es/index.js");
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const genQRCodeStyle = token => {
const {
componentCls,
lineWidth,
lineType,
colorSplit
} = token;
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_2__.resetComponent)(token),
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
padding: token.paddingSM,
backgroundColor: token.colorWhite,
borderRadius: token.borderRadiusLG,
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${lineType} ${colorSplit}`,
position: 'relative',
overflow: 'hidden',
[`& > ${componentCls}-cover`]: {
position: 'absolute',
insetBlockStart: 0,
insetInlineStart: 0,
zIndex: 10,
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
width: '100%',
height: '100%',
color: token.colorText,
lineHeight: token.lineHeight,
background: token.QRCodeCoverBackgroundColor,
textAlign: 'center',
[`& > ${componentCls}-expired, & > ${componentCls}-scanned`]: {
color: token.QRCodeTextColor
}
},
'> canvas': {
alignSelf: 'stretch',
flex: 'auto',
minWidth: 0
},
'&-icon': {
marginBlockEnd: token.marginXS,
fontSize: token.controlHeight
}
},
[`${componentCls}-borderless`]: {
borderColor: 'transparent',
padding: 0,
borderRadius: 0
}
};
};
const prepareComponentToken = token => ({
QRCodeCoverBackgroundColor: new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__.FastColor(token.colorBgContainer).setA(0.96).toRgbString()
});
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_4__.genStyleHooks)('QRCode', token => {
const mergedToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.mergeToken)(token, {
QRCodeTextColor: token.colorText
});
return genQRCodeStyle(mergedToken);
}, prepareComponentToken));
/***/ }),
/***/ "./components/qrcode/style/index.ts":
/*!******************************************!*\
!*** ./components/qrcode/style/index.ts ***!
\******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* reexport safe */ _qr_code_style__WEBPACK_IMPORTED_MODULE_0__.prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _qr_code_style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../qr-code/style */ "./components/qr-code/style/index.ts");
// Legacy path. Please use `qr-code` instead.
// Keep file here in case developer import directly from the old path.
/***/ }),
/***/ "./components/radio/style/index.ts":
/*!*****************************************!*\
!*** ./components/radio/style/index.ts ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
// ============================== Styles ==============================
// styles from RadioGroup only
const getGroupRadioStyle = token => {
const {
componentCls,
antCls
} = token;
const groupPrefixCls = `${componentCls}-group`;
return {
[groupPrefixCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
display: 'inline-block',
fontSize: 0,
// RTL
[`&${groupPrefixCls}-rtl`]: {
direction: 'rtl'
},
[`&${groupPrefixCls}-block`]: {
display: 'flex'
},
[`${antCls}-badge ${antCls}-badge-count`]: {
zIndex: 1
},
[`> ${antCls}-badge:not(:first-child) > ${antCls}-button-wrapper`]: {
borderInlineStart: 'none'
},
'&-vertical': {
display: 'flex',
flexDirection: 'column',
rowGap: token.marginXS,
[`${componentCls}-wrapper`]: {
marginInlineEnd: 0
}
}
}
};
};
// Styles from radio-wrapper
const getRadioBasicStyle = token => {
const {
componentCls,
wrapperMarginInlineEnd,
colorPrimary,
colorPrimaryHover,
radioSize,
motionDurationSlow,
motionDurationMid,
motionEaseInOutCirc,
colorBgContainer,
colorBorder,
lineWidth,
colorBgContainerDisabled,
colorTextDisabled,
paddingXS,
dotColorDisabled,
dotSize,
lineType,
radioColor,
radioBgColor
} = token;
return {
[`${componentCls}-wrapper`]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
display: 'inline-flex',
alignItems: 'baseline',
marginInlineStart: 0,
marginInlineEnd: wrapperMarginInlineEnd,
cursor: 'pointer',
'&:last-child': {
marginInlineEnd: 0
},
// RTL
[`&${componentCls}-wrapper-rtl`]: {
direction: 'rtl'
},
'&-disabled': {
cursor: 'not-allowed',
color: token.colorTextDisabled
},
'&::after': {
display: 'inline-block',
width: 0,
overflow: 'hidden',
content: '"\\a0"'
},
'&-block': {
flex: 1,
justifyContent: 'center'
},
// ===================== Radio =====================
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
position: 'relative',
whiteSpace: 'nowrap',
lineHeight: 1,
cursor: 'pointer',
alignSelf: 'center',
// Styles moved from inner
boxSizing: 'border-box',
display: 'block',
width: `calc(${radioSize} * 1px)`,
height: `calc(${radioSize} * 1px)`,
backgroundColor: colorBgContainer,
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${lineType} ${colorBorder}`,
borderRadius: '50%',
transition: `all ${motionDurationMid}`,
flex: 'none',
// Dot
'&:after': {
content: '""',
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%) scale(0)',
width: `calc(${dotSize} * 1px)`,
height: `calc(${dotSize} * 1px)`,
backgroundColor: radioColor,
borderRadius: '50%',
transformOrigin: '50% 50%',
opacity: 0,
transition: `all ${motionDurationSlow} ${motionEaseInOutCirc}`
},
// Wrapper > Radio > input
[`${componentCls}-input`]: {
position: 'absolute',
inset: 0,
zIndex: 1,
cursor: 'pointer',
opacity: 0,
margin: 0
},
// Focus outline on radio when input is focus-visible
[`&:has(${componentCls}-input:focus-visible)`]: (0,_style__WEBPACK_IMPORTED_MODULE_1__.genFocusOutline)(token)
},
// ===================== Hover =====================
[`&:hover:not(${componentCls}-wrapper-disabled) ${componentCls}`]: {
borderColor: colorPrimary
},
[`&:hover ${componentCls}-checked:not(${componentCls}-disabled)`]: {
backgroundColor: colorPrimaryHover,
borderColor: 'transparent'
},
// ==================== Checked ====================
[`${componentCls}-checked`]: {
backgroundColor: radioBgColor,
borderColor: colorPrimary,
'&::after': {
transform: `translate(-50%, -50%)`,
opacity: 1
}
},
// ==================== Disable ====================
[`${componentCls}-disabled`]: {
// Wrapper > Radio > input
[`&, ${componentCls}-input`]: {
cursor: 'not-allowed',
// Disabled for native input to enable Tooltip event handler
pointerEvents: 'none'
},
// Disabled radio styles
background: colorBgContainerDisabled,
borderColor: colorBorder,
'&::after': {
backgroundColor: dotColorDisabled
}
},
[`${componentCls}-disabled + span`]: {
color: colorTextDisabled,
cursor: 'not-allowed'
},
[`span${componentCls} + *`]: {
paddingInlineStart: paddingXS,
paddingInlineEnd: paddingXS
}
}
};
};
// Styles from radio-button
const getRadioButtonStyle = token => {
const {
buttonColor,
controlHeight,
componentCls,
lineWidth,
lineType,
colorBorder,
motionDurationMid,
buttonPaddingInline,
fontSize,
buttonBg,
fontSizeLG,
controlHeightLG,
controlHeightSM,
paddingXS,
borderRadius,
borderRadiusSM,
borderRadiusLG,
buttonCheckedBg,
buttonSolidCheckedColor,
colorTextDisabled,
colorBgContainerDisabled,
buttonCheckedBgDisabled,
buttonCheckedColorDisabled,
colorPrimary,
colorPrimaryHover,
colorPrimaryActive,
buttonSolidCheckedBg,
buttonSolidCheckedHoverBg,
buttonSolidCheckedActiveBg,
calc
} = token;
return {
[`${componentCls}-button-wrapper`]: {
position: 'relative',
display: 'inline-block',
height: controlHeight,
margin: 0,
paddingInline: buttonPaddingInline,
paddingBlock: 0,
color: buttonColor,
fontSize,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(calc(controlHeight).sub(calc(lineWidth).mul(2)).equal()),
background: buttonBg,
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${lineType} ${colorBorder}`,
// strange align fix for chrome but works
// https://gw.alipayobjects.com/zos/rmsportal/VFTfKXJuogBAXcvfAUWJ.gif
borderBlockStartWidth: calc(lineWidth).add(0.02).equal(),
borderInlineEndWidth: lineWidth,
cursor: 'pointer',
transition: [`color`, `background-color`, `box-shadow`].map(prop => `${prop} ${motionDurationMid}`).join(','),
a: {
color: buttonColor
},
[`> ${componentCls}-button`]: {
position: 'absolute',
insetBlockStart: 0,
insetInlineStart: 0,
zIndex: -1,
width: '100%',
height: '100%'
},
'&:not(:last-child)': {
marginInlineEnd: calc(lineWidth).mul(-1).equal()
},
'&:first-child': {
borderInlineStart: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${lineType} ${colorBorder}`,
borderStartStartRadius: borderRadius,
borderEndStartRadius: borderRadius
},
'&:last-child': {
borderStartEndRadius: borderRadius,
borderEndEndRadius: borderRadius
},
'&:first-child:last-child': {
borderRadius
},
[`${componentCls}-group-large &`]: {
height: controlHeightLG,
fontSize: fontSizeLG,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(calc(controlHeightLG).sub(calc(lineWidth).mul(2)).equal()),
'&:first-child': {
borderStartStartRadius: borderRadiusLG,
borderEndStartRadius: borderRadiusLG
},
'&:last-child': {
borderStartEndRadius: borderRadiusLG,
borderEndEndRadius: borderRadiusLG
}
},
[`${componentCls}-group-small &`]: {
height: controlHeightSM,
paddingInline: calc(paddingXS).sub(lineWidth).equal(),
paddingBlock: 0,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(calc(controlHeightSM).sub(calc(lineWidth).mul(2)).equal()),
'&:first-child': {
borderStartStartRadius: borderRadiusSM,
borderEndStartRadius: borderRadiusSM
},
'&:last-child': {
borderStartEndRadius: borderRadiusSM,
borderEndEndRadius: borderRadiusSM
}
},
'&:hover': {
position: 'relative',
color: colorPrimary
},
'&:has(:focus-visible)': (0,_style__WEBPACK_IMPORTED_MODULE_1__.genFocusOutline)(token),
[`${componentCls}, input[type='checkbox'], input[type='radio']`]: {
width: 0,
height: 0,
opacity: 0,
pointerEvents: 'none'
},
[`&-checked:not(${componentCls}-button-wrapper-disabled)`]: {
zIndex: 1,
color: colorPrimary,
background: buttonCheckedBg,
borderColor: colorPrimary,
'&::before': {
backgroundColor: colorPrimary
},
'&:first-child': {
borderColor: colorPrimary
},
'&:hover': {
color: colorPrimaryHover,
borderColor: colorPrimaryHover,
'&::before': {
backgroundColor: colorPrimaryHover
}
},
'&:active': {
color: colorPrimaryActive,
borderColor: colorPrimaryActive,
'&::before': {
backgroundColor: colorPrimaryActive
}
}
},
[`${componentCls}-group-solid &-checked:not(${componentCls}-button-wrapper-disabled)`]: {
color: buttonSolidCheckedColor,
background: buttonSolidCheckedBg,
borderColor: buttonSolidCheckedBg,
'&:hover': {
color: buttonSolidCheckedColor,
background: buttonSolidCheckedHoverBg,
borderColor: buttonSolidCheckedHoverBg
},
'&:active': {
color: buttonSolidCheckedColor,
background: buttonSolidCheckedActiveBg,
borderColor: buttonSolidCheckedActiveBg
}
},
'&-disabled': {
color: colorTextDisabled,
backgroundColor: colorBgContainerDisabled,
borderColor: colorBorder,
cursor: 'not-allowed',
'&:first-child, &:hover': {
color: colorTextDisabled,
backgroundColor: colorBgContainerDisabled,
borderColor: colorBorder
}
},
[`&-disabled${componentCls}-button-wrapper-checked`]: {
color: buttonCheckedColorDisabled,
backgroundColor: buttonCheckedBgDisabled,
borderColor: colorBorder,
boxShadow: 'none'
},
'&-block': {
flex: 1,
textAlign: 'center'
}
}
};
};
// ============================== Export ==============================
const prepareComponentToken = token => {
const {
wireframe,
padding,
marginXS,
lineWidth,
fontSizeLG,
colorText,
colorBgContainer,
colorTextDisabled,
controlItemBgActiveDisabled,
colorTextLightSolid,
colorPrimary,
colorPrimaryHover,
colorPrimaryActive,
colorWhite
} = token;
const dotPadding = 4; // Fixed value
const radioSize = fontSizeLG;
const radioDotSize = wireframe ? radioSize - dotPadding * 2 : radioSize - (dotPadding + lineWidth) * 2;
return {
// Radio
radioSize,
dotSize: radioDotSize,
dotColorDisabled: colorTextDisabled,
// Radio buttons
buttonSolidCheckedColor: colorTextLightSolid,
buttonSolidCheckedBg: colorPrimary,
buttonSolidCheckedHoverBg: colorPrimaryHover,
buttonSolidCheckedActiveBg: colorPrimaryActive,
buttonBg: colorBgContainer,
buttonCheckedBg: colorBgContainer,
buttonColor: colorText,
buttonCheckedBgDisabled: controlItemBgActiveDisabled,
buttonCheckedColorDisabled: colorTextDisabled,
buttonPaddingInline: padding - lineWidth,
wrapperMarginInlineEnd: marginXS,
// internal
radioColor: wireframe ? colorPrimary : colorWhite,
radioBgColor: wireframe ? colorBgContainer : colorPrimary
};
};
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genStyleHooks)('Radio', token => {
const {
controlOutline,
controlOutlineWidth
} = token;
const radioFocusShadow = `0 0 0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(controlOutlineWidth)} ${controlOutline}`;
const radioButtonFocusShadow = radioFocusShadow;
const radioToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token, {
radioFocusShadow,
radioButtonFocusShadow
});
return [getGroupRadioStyle(radioToken), getRadioBasicStyle(radioToken), getRadioButtonStyle(radioToken)];
}, prepareComponentToken, {
unitless: {
radioSize: true,
dotSize: true
}
}));
/***/ }),
/***/ "./components/rate/style/index.ts":
/*!****************************************!*\
!*** ./components/rate/style/index.ts ***!
\****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const genRateStarStyle = token => {
const {
componentCls
} = token;
return {
[`${componentCls}-star`]: {
position: 'relative',
display: 'inline-block',
color: 'inherit',
cursor: 'pointer',
'&:not(:last-child)': {
marginInlineEnd: token.marginXS
},
'> div': {
transition: `all ${token.motionDurationMid}, outline 0s`,
'&:hover': {
transform: token.starHoverScale
},
'&:focus': {
outline: 0
},
'&:focus-visible': {
outline: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} dashed ${token.starColor}`,
transform: token.starHoverScale
}
},
'&-first, &-second': {
color: token.starBg,
transition: `all ${token.motionDurationMid}`,
userSelect: 'none'
},
'&-first': {
position: 'absolute',
top: 0,
insetInlineStart: 0,
width: '50%',
height: '100%',
overflow: 'hidden',
opacity: 0
},
[`&-half ${componentCls}-star-first, &-half ${componentCls}-star-second`]: {
opacity: 1
},
[`&-half ${componentCls}-star-first, &-full ${componentCls}-star-second`]: {
color: 'inherit'
}
}
};
};
const genRateRtlStyle = token => ({
[`&-rtl${token.componentCls}`]: {
direction: 'rtl'
}
});
const genRateStyle = token => {
const {
componentCls
} = token;
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
display: 'inline-block',
margin: 0,
padding: 0,
color: token.starColor,
fontSize: token.starSize,
lineHeight: 1,
listStyle: 'none',
outline: 'none',
'&-small': {
fontSize: token.starSizeSM
},
'&-large': {
fontSize: token.starSizeLG
},
// disable styles
[`&-disabled${componentCls} ${componentCls}-star`]: {
cursor: 'default',
'> div:hover': {
transform: 'scale(1)'
}
},
// star styles
...genRateStarStyle(token),
// rtl styles
...genRateRtlStyle(token)
}
};
};
// ============================== Export ==============================
const prepareComponentToken = token => ({
starColor: token.yellow6,
starSize: token.controlHeight * 0.625,
starSizeSM: token.controlHeightSM * 0.625,
starSizeLG: token.controlHeightLG * 0.625,
starHoverScale: 'scale(1.1)',
starBg: token.colorFillContent
});
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genStyleHooks)('Rate', token => {
const rateToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token, {});
return genRateStyle(rateToken);
}, prepareComponentToken));
/***/ }),
/***/ "./components/result/style/index.ts":
/*!******************************************!*\
!*** ./components/result/style/index.ts ***!
\******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
// ============================== Styles ==============================
const genBaseStyle = token => {
const {
componentCls,
lineHeightHeading3,
iconCls,
padding,
paddingXL,
paddingXS,
paddingLG,
marginXS,
lineHeight
} = token;
return {
// Result
[componentCls]: {
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(paddingLG).mul(2).equal())} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingXL)}`,
// RTL
'&-rtl': {
direction: 'rtl'
}
},
// Exception Status image
[`${componentCls} ${componentCls}-image`]: {
width: token.imageWidth,
height: token.imageHeight,
margin: 'auto'
},
[`${componentCls} ${componentCls}-icon`]: {
marginBottom: paddingLG,
textAlign: 'center',
[`& > ${iconCls}`]: {
fontSize: token.iconFontSize
}
},
[`${componentCls} ${componentCls}-title`]: {
color: token.colorTextHeading,
fontSize: token.titleFontSize,
lineHeight: lineHeightHeading3,
marginBlock: marginXS,
textAlign: 'center'
},
[`${componentCls} ${componentCls}-subtitle`]: {
color: token.colorTextDescription,
fontSize: token.subtitleFontSize,
lineHeight,
textAlign: 'center'
},
[`${componentCls} ${componentCls}-body`]: {
marginTop: paddingLG,
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingLG)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(padding).mul(2.5).equal())}`,
backgroundColor: token.colorFillAlter
},
[`${componentCls} ${componentCls}-extra`]: {
margin: token.extraMargin,
textAlign: 'center',
'& > *': {
marginInlineEnd: paddingXS,
'&:last-child': {
marginInlineEnd: 0
}
}
}
};
};
const genStatusIconStyle = token => {
const {
componentCls,
iconCls
} = token;
return {
[`${componentCls}-success ${componentCls}-icon > ${iconCls}`]: {
color: token.resultSuccessIconColor
},
[`${componentCls}-error ${componentCls}-icon > ${iconCls}`]: {
color: token.resultErrorIconColor
},
[`${componentCls}-info ${componentCls}-icon > ${iconCls}`]: {
color: token.resultInfoIconColor
},
[`${componentCls}-warning ${componentCls}-icon > ${iconCls}`]: {
color: token.resultWarningIconColor
}
};
};
const genResultStyle = token => [genBaseStyle(token), genStatusIconStyle(token)];
// ============================== Export ==============================
const prepareComponentToken = token => ({
titleFontSize: token.fontSizeHeading3,
subtitleFontSize: token.fontSize,
iconFontSize: token.fontSizeHeading3 * 3,
extraMargin: `${token.paddingLG}px 0 0 0`
});
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.genStyleHooks)('Result', token => {
const resultInfoIconColor = token.colorInfo;
const resultErrorIconColor = token.colorError;
const resultSuccessIconColor = token.colorSuccess;
const resultWarningIconColor = token.colorWarning;
const resultToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_1__.mergeToken)(token, {
resultInfoIconColor,
resultErrorIconColor,
resultSuccessIconColor,
resultWarningIconColor,
imageWidth: 250,
imageHeight: 295
});
return genResultStyle(resultToken);
}, prepareComponentToken));
/***/ }),
/***/ "./components/row/style/index.ts":
/*!***************************************!*\
!*** ./components/row/style/index.ts ***!
\***************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// Compatible for babel-plugin-import
/* istanbul ignore next */
/* harmony default export */ __webpack_exports__["default"] = ({});
/***/ }),
/***/ "./components/segmented/style/index.ts":
/*!*********************************************!*\
!*** ./components/segmented/style/index.ts ***!
\*********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
// ============================== Mixins ==============================
function getItemDisabledStyle(cls, token) {
return {
[`${cls}, ${cls}:hover, ${cls}:focus`]: {
color: token.colorTextDisabled,
cursor: 'not-allowed'
}
};
}
const getItemSelectedStyle = token => {
return {
background: token.itemSelectedBg,
boxShadow: token.boxShadowTertiary
};
};
const segmentedTextEllipsisCss = {
overflow: 'hidden',
// handle text ellipsis
..._style__WEBPACK_IMPORTED_MODULE_1__.textEllipsis
};
// ============================== Styles ==============================
const genSegmentedStyle = token => {
const {
componentCls,
motionDurationSlow,
motionEaseInOut,
motionDurationMid
} = token;
const labelHeight = token.calc(token.controlHeight).sub(token.calc(token.trackPadding).mul(2)).equal();
const labelHeightLG = token.calc(token.controlHeightLG).sub(token.calc(token.trackPadding).mul(2)).equal();
const labelHeightSM = token.calc(token.controlHeightSM).sub(token.calc(token.trackPadding).mul(2)).equal();
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
display: 'inline-block',
padding: token.trackPadding,
color: token.itemColor,
background: token.trackBg,
borderRadius: token.borderRadius,
transition: `all ${motionDurationMid}`,
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.genFocusStyle)(token),
[`${componentCls}-group`]: {
position: 'relative',
display: 'flex',
alignItems: 'stretch',
justifyItems: 'flex-start',
flexDirection: 'row',
width: '100%'
},
// RTL styles
[`&${componentCls}-rtl`]: {
direction: 'rtl'
},
[`&${componentCls}-vertical`]: {
[`${componentCls}-group`]: {
flexDirection: 'column'
},
[`${componentCls}-thumb`]: {
width: '100%',
height: 0,
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingXXS)}`
}
},
// block styles
[`&${componentCls}-block`]: {
display: 'flex'
},
[`&${componentCls}-block ${componentCls}-item`]: {
flex: 1,
minWidth: 0
},
// item styles
[`${componentCls}-item`]: {
position: 'relative',
textAlign: 'center',
cursor: 'pointer',
transition: `color ${motionDurationMid}`,
borderRadius: token.borderRadiusSM,
// Fix Safari render bug
// https://github.com/ant-design/ant-design/issues/45250
transform: 'translateZ(0)',
'&-selected': {
...getItemSelectedStyle(token),
color: token.itemSelectedColor
},
'&-focused': (0,_style__WEBPACK_IMPORTED_MODULE_1__.genFocusOutline)(token),
'&::after': {
content: '""',
position: 'absolute',
zIndex: -1,
width: '100%',
height: '100%',
top: 0,
insetInlineStart: 0,
borderRadius: 'inherit',
opacity: 0,
// This is mandatory to make it not clickable or hoverable
// Ref: https://github.com/ant-design/ant-design/issues/40888
pointerEvents: 'none',
transition: ['opacity', 'background-color'].map(prop => `${prop} ${motionDurationMid}`).join(', ')
},
[`&:not(${componentCls}-item-selected):not(${componentCls}-item-disabled)`]: {
'&:hover, &:active': {
color: token.itemHoverColor
},
'&:hover::after': {
opacity: 1,
backgroundColor: token.itemHoverBg
},
'&:active::after': {
opacity: 1,
backgroundColor: token.itemActiveBg
}
},
'&-label': {
minHeight: labelHeight,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(labelHeight),
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.segmentedPaddingHorizontal)}`,
...segmentedTextEllipsisCss
},
// syntactic sugar to add `icon` for Segmented Item
'&-icon + *': {
marginInlineStart: token.calc(token.marginSM).div(2).equal()
},
'&-input': {
position: 'absolute',
insetBlockStart: 0,
insetInlineStart: 0,
width: 0,
height: 0,
opacity: 0,
pointerEvents: 'none'
}
},
// thumb styles
[`${componentCls}-thumb`]: {
...getItemSelectedStyle(token),
position: 'absolute',
insetBlockStart: 0,
insetInlineStart: 0,
width: 0,
height: '100%',
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingXXS)} 0`,
borderRadius: token.borderRadiusSM,
[`& ~ ${componentCls}-item:not(${componentCls}-item-selected):not(${componentCls}-item-disabled)::after`]: {
backgroundColor: 'transparent'
}
},
// size styles
[`&${componentCls}-lg`]: {
borderRadius: token.borderRadiusLG,
[`${componentCls}-item-label`]: {
minHeight: labelHeightLG,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(labelHeightLG),
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.segmentedPaddingHorizontal)}`,
fontSize: token.fontSizeLG
},
[`${componentCls}-item, ${componentCls}-thumb`]: {
borderRadius: token.borderRadius
}
},
[`&${componentCls}-sm`]: {
borderRadius: token.borderRadiusSM,
[`${componentCls}-item-label`]: {
minHeight: labelHeightSM,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(labelHeightSM),
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.segmentedPaddingHorizontalSM)}`
},
[`${componentCls}-item, ${componentCls}-thumb`]: {
borderRadius: token.borderRadiusXS
}
},
// disabled styles
...getItemDisabledStyle(`&-disabled ${componentCls}-item`, token),
...getItemDisabledStyle(`${componentCls}-item-disabled`, token),
// transition effect when `appear-active`
[`${componentCls}-thumb-motion-appear-active`]: {
willChange: 'transform, width',
transition: [`transform`, `width`].map(prop => `${prop} ${motionDurationSlow} ${motionEaseInOut}`).join(', ')
},
[`&${componentCls}-shape-round`]: {
borderRadius: 9999,
[`${componentCls}-item, ${componentCls}-thumb`]: {
borderRadius: 9999
}
}
}
};
};
// ============================== Export ==============================
const prepareComponentToken = token => {
const {
colorTextLabel,
colorText,
colorFillSecondary,
colorBgElevated,
colorFill,
lineWidthBold,
colorBgLayout
} = token;
return {
trackPadding: lineWidthBold,
trackBg: colorBgLayout,
itemColor: colorTextLabel,
itemHoverColor: colorText,
itemHoverBg: colorFillSecondary,
itemSelectedBg: colorBgElevated,
itemActiveBg: colorFill,
itemSelectedColor: colorText
};
};
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genStyleHooks)('Segmented', token => {
const {
lineWidth,
calc
} = token;
const segmentedToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token, {
segmentedPaddingHorizontal: calc(token.controlPaddingHorizontal).sub(lineWidth).equal(),
segmentedPaddingHorizontalSM: calc(token.controlPaddingHorizontalSM).sub(lineWidth).equal()
});
return genSegmentedStyle(segmentedToken);
}, prepareComponentToken));
/***/ }),
/***/ "./components/select/style/index.ts":
/*!******************************************************!*\
!*** ./components/select/style/index.ts + 5 modules ***!
\******************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ select_style; }
});
// EXTERNAL MODULE: ./components/style/index.tsx
var style = __webpack_require__("./components/style/index.tsx");
// EXTERNAL MODULE: ./components/style/compact-item.ts
var compact_item = __webpack_require__("./components/style/compact-item.ts");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
// EXTERNAL MODULE: ./components/style/motion/slide.ts
var slide = __webpack_require__("./components/style/motion/slide.ts");
// EXTERNAL MODULE: ./components/style/motion/move.ts
var move = __webpack_require__("./components/style/motion/move.ts");
;// ./components/select/style/dropdown.ts
const genItemStyle = token => {
const {
optionHeight,
optionFontSize,
optionLineHeight,
optionPadding
} = token;
return {
position: 'relative',
display: 'block',
minHeight: optionHeight,
padding: optionPadding,
color: token.colorText,
fontWeight: 'normal',
fontSize: optionFontSize,
lineHeight: optionLineHeight,
boxSizing: 'border-box'
};
};
const genSingleStyle = token => {
const {
antCls,
componentCls
} = token;
const selectItemCls = `${componentCls}-item`;
const slideUpEnterActive = `&${antCls}-slide-up-enter${antCls}-slide-up-enter-active`;
const slideUpAppearActive = `&${antCls}-slide-up-appear${antCls}-slide-up-appear-active`;
const slideUpLeaveActive = `&${antCls}-slide-up-leave${antCls}-slide-up-leave-active`;
const dropdownPlacementCls = `${componentCls}-dropdown-placement-`;
const selectedItemCls = `${selectItemCls}-option-selected`;
return [{
[`${componentCls}-dropdown`]: {
// ========================== Popup ==========================
...(0,style.resetComponent)(token),
position: 'absolute',
top: -9999,
zIndex: token.zIndexPopup,
boxSizing: 'border-box',
padding: token.paddingXXS,
overflow: 'hidden',
fontSize: token.fontSize,
// Fix select render lag of long text in chrome
// https://github.com/ant-design/ant-design/issues/11456
// https://github.com/ant-design/ant-design/issues/11843
fontVariant: 'initial',
backgroundColor: token.colorBgElevated,
borderRadius: token.borderRadiusLG,
outline: 'none',
boxShadow: token.boxShadowSecondary,
[`
${slideUpEnterActive}${dropdownPlacementCls}bottomLeft,
${slideUpAppearActive}${dropdownPlacementCls}bottomLeft
`]: {
animationName: slide.slideUpIn
},
[`
${slideUpEnterActive}${dropdownPlacementCls}topLeft,
${slideUpAppearActive}${dropdownPlacementCls}topLeft,
${slideUpEnterActive}${dropdownPlacementCls}topRight,
${slideUpAppearActive}${dropdownPlacementCls}topRight
`]: {
animationName: slide.slideDownIn
},
[`${slideUpLeaveActive}${dropdownPlacementCls}bottomLeft`]: {
animationName: slide.slideUpOut
},
[`
${slideUpLeaveActive}${dropdownPlacementCls}topLeft,
${slideUpLeaveActive}${dropdownPlacementCls}topRight
`]: {
animationName: slide.slideDownOut
},
'&-hidden': {
display: 'none'
},
[selectItemCls]: {
...genItemStyle(token),
cursor: 'pointer',
transition: `background-color ${token.motionDurationSlow} ease`,
borderRadius: token.borderRadiusSM,
// =========== Group ============
'&-group': {
color: token.colorTextDescription,
fontSize: token.fontSizeSM,
cursor: 'default'
},
// =========== Option ===========
'&-option': {
display: 'flex',
'&-content': {
flex: 'auto',
...style.textEllipsis
},
'&-state': {
flex: 'none',
display: 'flex',
alignItems: 'center'
},
[`&-active:not(${selectItemCls}-option-disabled)`]: {
backgroundColor: token.optionActiveBg
},
[`&-selected:not(${selectItemCls}-option-disabled)`]: {
color: token.optionSelectedColor,
fontWeight: token.optionSelectedFontWeight,
backgroundColor: token.optionSelectedBg,
[`${selectItemCls}-option-state`]: {
color: token.colorPrimary
}
},
'&-disabled': {
[`&${selectItemCls}-option-selected`]: {
backgroundColor: token.colorBgContainerDisabled
},
color: token.colorTextDisabled,
cursor: 'not-allowed'
},
'&-grouped': {
paddingInlineStart: token.calc(token.controlPaddingHorizontal).mul(2).equal()
}
},
'&-empty': {
...genItemStyle(token),
color: token.colorTextDisabled
}
},
// https://github.com/ant-design/ant-design/pull/46646
[`${selectedItemCls}:has(+ ${selectedItemCls})`]: {
borderEndStartRadius: 0,
borderEndEndRadius: 0,
[`& + ${selectedItemCls}`]: {
borderStartStartRadius: 0,
borderStartEndRadius: 0
}
},
// =========================== RTL ===========================
'&-rtl': {
direction: 'rtl'
}
}
},
// Follow code may reuse in other components
(0,slide.initSlideMotion)(token, 'slide-up'), (0,slide.initSlideMotion)(token, 'slide-down'), (0,move.initMoveMotion)(token, 'move-up'), (0,move.initMoveMotion)(token, 'move-down')];
};
/* harmony default export */ var dropdown = (genSingleStyle);
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
;// ./components/select/style/select-input-customize.ts
const genSelectInputCustomizeStyle = token => {
const {
componentCls
} = token;
return {
[`&${componentCls}-customize`]: {
border: 0,
padding: 0,
fontSize: 'inherit',
lineHeight: 'inherit',
[`${componentCls}-placeholder`]: {
display: 'none'
},
[`${componentCls}-content`]: {
margin: 0,
padding: 0,
'&-value': {
display: 'none'
}
}
}
};
};
/* harmony default export */ var select_input_customize = (genSelectInputCustomizeStyle);
;// ./components/select/style/select-input-multiple.ts
const FIXED_INPUT_MIN_WIDTH = 4;
const genSelectInputMultipleStyle = token => {
const {
componentCls,
calc,
iconCls,
paddingXS,
paddingXXS,
INTERNAL_FIXED_ITEM_MARGIN,
lineWidth,
colorIcon,
colorIconHover,
inputPaddingHorizontalBase,
antCls
} = token;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'select');
return {
'&-multiple': {
[varName('multi-item-background')]: token.multipleItemBg,
[varName('multi-item-border-color')]: 'transparent',
[varName('multi-item-border-radius')]: token.borderRadiusSM,
[varName('multi-item-height')]: token.multipleItemHeight,
[varName('multi-padding-base')]: `calc((${varRef('height')} - ${varRef('multi-item-height')}) / 2)`,
[varName('multi-padding-vertical')]: `calc(${varRef('multi-padding-base')} - ${INTERNAL_FIXED_ITEM_MARGIN} - ${lineWidth})`,
[varName('multi-item-padding-horizontal')]: `calc(${inputPaddingHorizontalBase} - ${varRef('multi-padding-vertical')} - ${lineWidth} * 2)`,
// ========================================================
// == Base ==
// ========================================================
// ========================= Root =========================
paddingBlock: varRef('multi-padding-vertical'),
paddingInlineStart: `calc(${varRef('multi-padding-base')} - ${lineWidth})`,
// ======================== Prefix ========================
[`${componentCls}-prefix`]: {
marginInlineStart: varRef('multi-item-padding-horizontal')
},
[`${componentCls}-prefix + ${componentCls}-content`]: {
[`${componentCls}-placeholder`]: {
insetInlineStart: 0
},
[`${componentCls}-content-item${componentCls}-content-item-suffix`]: {
marginInlineStart: 0
}
},
// ===================== Placeholder ======================
[`${componentCls}-placeholder`]: {
position: 'absolute',
lineHeight: varRef('line-height'),
insetInlineStart: varRef('multi-item-padding-horizontal'),
width: `calc(100% - ${varRef('multi-item-padding-horizontal')})`,
top: '50%',
transform: 'translateY(-50%)'
},
// ======================= Content ========================
[`${componentCls}-content`]: {
flexWrap: 'wrap',
alignItems: 'center',
lineHeight: 1,
'&-item-prefix': {
height: varRef('font-size')
},
'&-item': {
lineHeight: 1,
maxWidth: `calc(100% - ${FIXED_INPUT_MIN_WIDTH}px)`
},
[`${componentCls}-content-item-prefix + ${componentCls}-content-item-suffix,
${componentCls}-content-item-suffix:first-child`]: {
marginInlineStart: varRef('multi-item-padding-horizontal')
},
[`${componentCls}-selection-item`]: {
lineHeight: `calc(${varRef('multi-item-height')} - ${lineWidth} * 2)`,
border: `${lineWidth} solid ${varRef('multi-item-border-color')}`,
display: 'flex',
marginBlock: INTERNAL_FIXED_ITEM_MARGIN,
marginInlineEnd: calc(INTERNAL_FIXED_ITEM_MARGIN).mul(2).equal(),
background: varRef('multi-item-background'),
borderRadius: varRef('multi-item-border-radius'),
paddingInlineStart: paddingXS,
paddingInlineEnd: paddingXXS,
transition: ['height', 'line-height', 'padding'].map(key => `${key} ${token.motionDurationSlow}`).join(','),
// >>> Content
'&-content': {
...style.textEllipsis,
marginInlineEnd: paddingXXS
},
// >>> Remove
'&-remove': {
...(0,style.resetIcon)(),
display: 'inline-flex',
alignItems: 'center',
color: colorIcon,
fontWeight: 'bold',
fontSize: 10,
lineHeight: 'inherit',
cursor: 'pointer',
[`> ${iconCls}`]: {
verticalAlign: '-0.2em'
},
'&:hover': {
color: colorIconHover
}
}
},
[`${componentCls}-input`]: {
lineHeight: calc(INTERNAL_FIXED_ITEM_MARGIN).mul(2).add(varRef('multi-item-height')).equal(),
width: `calc(var(--select-input-width, 0) * 1px)`,
minWidth: FIXED_INPUT_MIN_WIDTH,
maxWidth: '100%',
transition: `line-height ${token.motionDurationSlow}`
}
},
// ========================================================
// == Size ==
// ========================================================
[`&${componentCls}-sm`]: {
[varName('multi-item-height')]: token.multipleItemHeightSM,
[varName('multi-item-border-radius')]: token.borderRadiusXS
},
[`&${componentCls}-lg`]: {
[varName('multi-item-height')]: token.multipleItemHeightLG,
[varName('multi-item-border-radius')]: token.borderRadius
},
// ========================================================
// == Variants ==
// ========================================================
[`&${componentCls}-filled`]: {
[varName('multi-item-border-color')]: token.colorSplit,
[varName('multi-item-background')]: token.colorBgContainer,
[`&${componentCls}-disabled`]: {
[varName('multi-item-border-color')]: 'transparent'
}
}
}
};
};
/* harmony default export */ var select_input_multiple = (genSelectInputMultipleStyle);
;// ./components/select/style/select-input.ts
/** Set CSS variables and hover/focus styles for a Select input based on provided colors. */
const genSelectInputVariableStyle = (token, colors) => {
const {
componentCls,
antCls
} = token;
const [varName] = (0,genStyleUtils.genCssVar)(antCls, 'select');
const {
border,
borderHover,
borderActive,
borderOutline
} = colors;
const baseBG = colors.background || token.selectorBg || token.colorBgContainer;
return {
[varName('border-color')]: border,
[varName('background-color')]: baseBG,
[varName('color')]: colors.color || token.colorText,
[`&:not(${componentCls}-disabled)`]: {
'&:hover': {
[varName('border-color')]: borderHover,
[varName('background-color')]: colors.backgroundHover || baseBG
},
[`&${componentCls}-focused`]: {
[varName('border-color')]: borderActive,
[varName('background-color')]: colors.backgroundActive || baseBG,
boxShadow: `0 0 0 ${(0,cssinjs.unit)(token.controlOutlineWidth)} ${borderOutline}`
}
},
[`&${componentCls}-disabled`]: {
[varName('border-color')]: colors.borderDisabled || colors.border,
[varName('background-color')]: colors.backgroundDisabled || colors.background
}
};
};
/** Generate variant-scoped variable styles and status overrides for a Select input. */
const genSelectInputVariantStyle = (token, variant, colors, errorColors = {}, warningColors = {}, patchStyle) => {
const {
componentCls
} = token;
return {
[`&${componentCls}-${variant}`]: [genSelectInputVariableStyle(token, colors), {
[`&${componentCls}-status-error`]: genSelectInputVariableStyle(token, {
...colors,
color: errorColors.color || token.colorError,
...errorColors
}),
[`&${componentCls}-status-warning`]: genSelectInputVariableStyle(token, {
...colors,
color: warningColors.color || token.colorWarning,
...warningColors
})
}, patchStyle]
};
};
const genSelectInputStyle = token => {
const {
componentCls,
fontHeight,
controlHeight,
iconCls,
antCls,
calc
} = token;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'select');
return {
[componentCls]: [{
// Border
[varName('border-radius')]: token.borderRadius,
[varName('border-color')]: '#000',
[varName('border-size')]: token.lineWidth,
// Background
[varName('background-color')]: token.colorBgContainer,
// Font
[varName('font-size')]: token.fontSize,
[varName('line-height')]: token.lineHeight,
[varName('font-height')]: fontHeight,
[varName('color')]: token.colorText,
// Size
[varName('height')]: controlHeight,
[varName('padding-horizontal')]: calc(token.paddingSM).sub(token.lineWidth).equal(),
[varName('padding-vertical')]: `calc((${varRef('height')} - ${varRef('font-height')}) / 2 - ${varRef('border-size')})`,
// ==========================================================
// == Base ==
// ==========================================================
...(0,style.resetComponent)(token, true),
display: 'inline-flex',
// gap: calc(token.paddingXXS).mul(1.5).equal(),
flexWrap: 'nowrap',
position: 'relative',
transition: `all ${token.motionDurationSlow}`,
alignItems: 'flex-start',
outline: 0,
cursor: 'pointer',
// Border
borderRadius: varRef('border-radius'),
borderWidth: varRef('border-size'),
borderStyle: token.lineType,
borderColor: varRef('border-color'),
// Background
background: varRef('background-color'),
// Font
fontSize: varRef('font-size'),
lineHeight: varRef('line-height'),
color: varRef('color'),
// Padding
paddingInline: varRef('padding-horizontal'),
paddingBlock: varRef('padding-vertical'),
// ========================= Prefix =========================
[`${componentCls}-prefix`]: {
flex: 'none',
lineHeight: 1
},
// ====================== Placeholder =======================
[`${componentCls}-placeholder`]: {
...style.textEllipsis,
color: token.colorTextPlaceholder,
pointerEvents: 'none',
zIndex: 1
},
// ======================== Content =========================
[`${componentCls}-content`]: {
flex: 'auto',
minWidth: 0,
position: 'relative',
display: 'flex',
marginInlineEnd: calc(token.paddingXXS).mul(1.5).equal(),
'&:before': {
content: '"\\a0"',
width: 0,
overflow: 'hidden'
},
// >>> Value
'&-value': {
visibility: 'inherit'
},
// >>> Input: should only take effect for not customize mode
// input element with readOnly use cursor pointer
'input[readonly]': {
cursor: 'inherit',
caretColor: 'transparent'
}
},
// ========================= Suffix =========================
[`${componentCls}-suffix`]: {
flex: 'none',
color: token.colorTextQuaternary,
fontSize: token.fontSizeIcon,
lineHeight: 1,
'> :not(:last-child)': {
marginInlineEnd: token.marginXS
}
},
[`${componentCls}-prefix, ${componentCls}-suffix`]: {
alignSelf: 'center',
[iconCls]: {
verticalAlign: 'top'
}
},
// ==========================================================
// == Disabled ==
// ==========================================================
'&-disabled': {
background: token.colorBgContainerDisabled,
color: token.colorTextDisabled,
cursor: 'not-allowed',
input: {
cursor: 'not-allowed'
}
},
// ==========================================================
// == Size ==
// ==========================================================
'&-sm': {
[varName('height')]: token.controlHeightSM,
[varName('padding-horizontal')]: calc(token.paddingXS).sub(token.lineWidth).equal(),
[varName('border-radius')]: token.borderRadiusSM,
[`${componentCls}-clear`]: {
insetInlineEnd: varRef('padding-horizontal')
}
},
'&-lg': {
[varName('height')]: token.controlHeightLG,
[varName('font-size')]: token.fontSizeLG,
[varName('line-height')]: token.lineHeightLG,
[varName('font-height')]: token.fontHeightLG,
[varName('border-radius')]: token.borderRadiusLG
}
},
// ============================================================
// == Input ==
// ============================================================
{
[`&:not(${componentCls}-customize)`]: {
[`${componentCls}-input`]: {
outline: 'none',
background: 'transparent',
appearance: 'none',
border: 0,
margin: 0,
padding: 0,
color: varRef('color'),
'&::-webkit-search-cancel-button': {
display: 'none',
appearance: 'none'
}
}
}
},
// ============================================================
// == Single ==
// ============================================================
{
[`&-single:not(${componentCls}-customize)`]: {
[`${componentCls}-input`]: {
position: 'absolute',
inset: 0,
lineHeight: `calc(${varRef('font-height')} + ${varRef('padding-vertical')} * 2)`
},
// Content center align
[`${componentCls}-content`]: {
...style.textEllipsis,
alignSelf: 'center',
'&-has-value': {
display: 'block',
'&:before': {
display: 'none'
}
},
'&-has-search-value': {
color: 'transparent'
},
// >>> Value
'&-value': {
transition: `all ${token.motionDurationMid} ${token.motionEaseInOut}`,
zIndex: 1
}
},
[`&${componentCls}-open ${componentCls}-content`]: {
color: token.colorTextPlaceholder,
'&-has-search-value': {
color: 'transparent'
}
}
}
},
// ======================== Show Search =======================
{
[`&-show-search:not(${componentCls}-customize-input):not(${componentCls}-disabled)`]: {
cursor: 'text'
}
},
// ============================================================
// == Multiple ==
// ============================================================
select_input_multiple(token),
// ========================= Variant ==========================
// >>> Outlined
genSelectInputVariantStyle(token, 'outlined', {
border: token.colorBorder,
borderHover: token.hoverBorderColor,
borderActive: token.activeBorderColor,
borderOutline: token.activeOutlineColor,
borderDisabled: token.colorBorderDisabled
},
// Error
{
border: token.colorError,
borderHover: token.colorErrorHover,
borderActive: token.colorError,
borderOutline: token.colorErrorOutline
},
// Warning
{
border: token.colorWarning,
borderHover: token.colorWarningHover,
borderActive: token.colorWarning,
borderOutline: token.colorWarningOutline
}),
// >>> Filled
genSelectInputVariantStyle(token, 'filled', {
border: 'transparent',
borderHover: 'transparent',
borderActive: token.activeBorderColor,
borderOutline: 'transparent',
borderDisabled: token.colorBorderDisabled,
background: token.colorFillTertiary,
backgroundHover: token.colorFillSecondary,
backgroundActive: token.colorBgContainer
},
// Error
{
background: token.colorErrorBg,
backgroundHover: token.colorErrorBgHover,
borderActive: token.colorError
},
// Warning
{
background: token.colorWarningBg,
backgroundHover: token.colorWarningBgHover,
borderActive: token.colorWarning
}),
// >>> Borderless
genSelectInputVariantStyle(token, 'borderless', {
border: 'transparent',
borderHover: 'transparent',
borderActive: 'transparent',
borderOutline: 'transparent',
background: 'transparent'
}),
// Underlined
genSelectInputVariantStyle(token, 'underlined', {
border: token.colorBorder,
borderHover: token.hoverBorderColor,
borderActive: token.activeBorderColor,
borderOutline: 'transparent'
},
// Error
{
border: token.colorError,
borderHover: token.colorErrorHover,
borderActive: token.colorError
},
// Warning
{
border: token.colorWarning,
borderHover: token.colorWarningHover,
borderActive: token.colorWarning
}, {
borderRadius: 0,
borderTopColor: 'transparent',
borderInlineColor: 'transparent'
}),
// ============================================================
// == Custom ==
// ============================================================
select_input_customize(token)]
};
};
/* harmony default export */ var select_input = (genSelectInputStyle);
;// ./components/select/style/token.ts
const prepareComponentToken = token => {
const {
fontSize,
lineHeight,
lineWidth,
controlHeight,
controlHeightSM,
controlHeightLG,
paddingXXS,
controlPaddingHorizontal,
zIndexPopupBase,
colorText,
fontWeightStrong,
controlItemBgActive,
controlItemBgHover,
colorBgContainer,
colorFillSecondary,
colorBgContainerDisabled,
colorTextDisabled,
colorPrimaryHover,
colorPrimary,
controlOutline
} = token;
// Item height default use `controlHeight - 2 * paddingXXS`,
// but some case `paddingXXS=0`.
// Let's fallback it.
const dblPaddingXXS = paddingXXS * 2;
const dblLineWidth = lineWidth * 2;
const multipleItemHeight = Math.min(controlHeight - dblPaddingXXS, controlHeight - dblLineWidth);
const multipleItemHeightSM = Math.min(controlHeightSM - dblPaddingXXS, controlHeightSM - dblLineWidth);
const multipleItemHeightLG = Math.min(controlHeightLG - dblPaddingXXS, controlHeightLG - dblLineWidth);
// FIXED_ITEM_MARGIN is a hardcode calculation since calc not support rounding
const INTERNAL_FIXED_ITEM_MARGIN = Math.floor(paddingXXS / 2);
return {
INTERNAL_FIXED_ITEM_MARGIN,
zIndexPopup: zIndexPopupBase + 50,
optionSelectedColor: colorText,
optionSelectedFontWeight: fontWeightStrong,
optionSelectedBg: controlItemBgActive,
optionActiveBg: controlItemBgHover,
optionPadding: `${(controlHeight - fontSize * lineHeight) / 2}px ${controlPaddingHorizontal}px`,
optionFontSize: fontSize,
optionLineHeight: lineHeight,
optionHeight: controlHeight,
selectorBg: colorBgContainer,
clearBg: colorBgContainer,
singleItemHeightLG: controlHeightLG,
multipleItemBg: colorFillSecondary,
multipleItemBorderColor: 'transparent',
multipleItemHeight,
multipleItemHeightSM,
multipleItemHeightLG,
multipleSelectorBgDisabled: colorBgContainerDisabled,
multipleItemColorDisabled: colorTextDisabled,
multipleItemBorderColorDisabled: 'transparent',
showArrowPaddingInlineEnd: Math.ceil(token.fontSize * 1.25),
hoverBorderColor: colorPrimaryHover,
activeBorderColor: colorPrimary,
activeOutlineColor: controlOutline,
selectAffixPadding: paddingXXS
};
};
;// ./components/select/style/index.ts
// =============================== Base ===============================
const genBaseStyle = token => {
const {
antCls,
componentCls,
motionDurationMid,
inputPaddingHorizontalBase
} = token;
const hoverShowClearStyle = {
[`${componentCls}-clear`]: {
opacity: 1,
background: token.colorBgBase,
borderRadius: '50%'
}
};
return {
[componentCls]: {
...(0,style.resetComponent)(token),
// ======================== Selection ========================
[`${componentCls}-selection-item`]: {
flex: 1,
fontWeight: 'normal',
position: 'relative',
userSelect: 'none',
...style.textEllipsis,
// https://github.com/ant-design/ant-design/issues/40421
[`> ${antCls}-typography`]: {
display: 'inline'
}
},
// ========================= Prefix ==========================
[`${componentCls}-prefix`]: {
flex: 'none',
marginInlineEnd: token.selectAffixPadding
},
// ========================== Clear ==========================
[`${componentCls}-clear`]: {
position: 'absolute',
top: '50%',
insetInlineStart: 'auto',
insetInlineEnd: inputPaddingHorizontalBase,
zIndex: 1,
display: 'inline-block',
width: token.fontSizeIcon,
height: token.fontSizeIcon,
marginTop: token.calc(token.fontSizeIcon).mul(-1).div(2).equal(),
color: token.colorTextQuaternary,
fontSize: token.fontSizeIcon,
fontStyle: 'normal',
lineHeight: 1,
textAlign: 'center',
textTransform: 'none',
cursor: 'pointer',
opacity: 0,
transition: ['color', 'opacity'].map(prop => `${prop} ${motionDurationMid} ease`).join(', '),
textRendering: 'auto',
// https://github.com/ant-design/ant-design/issues/54205
// Force GPU compositing on Safari to prevent flickering on opacity/transform transitions
transform: 'translateZ(0)',
'&:before': {
display: 'block'
},
'&:hover': {
color: token.colorIcon
}
},
'@media(hover:none)': hoverShowClearStyle,
'&:hover': hoverShowClearStyle
},
// ========================= Feedback ==========================
[`${componentCls}-status`]: {
'&-error, &-warning, &-success, &-validating': {
[`&${componentCls}-has-feedback`]: {
[`${componentCls}-clear`]: {
insetInlineEnd: token.calc(inputPaddingHorizontalBase).add(token.fontSize).add(token.paddingXS).equal()
}
}
}
}
};
};
// ============================== Styles ==============================
const genSelectStyle = token => {
const {
componentCls
} = token;
return [{
[componentCls]: {
// ==================== In Form ====================
[`&${componentCls}-in-form-item`]: {
width: '100%'
}
}
},
// =====================================================
// == LTR ==
// =====================================================
// Base
genBaseStyle(token),
// Dropdown
dropdown(token),
// =====================================================
// == RTL ==
// =====================================================
{
[`${componentCls}-rtl`]: {
direction: 'rtl'
}
},
// =====================================================
// == Space Compact ==
// =====================================================
(0,compact_item.genCompactItemStyle)(token, {
focusElCls: `${componentCls}-focused`
})];
};
// ============================== Export ==============================
/* harmony default export */ var select_style = ((0,genStyleUtils.genStyleHooks)('Select', (token, {
rootPrefixCls
}) => {
const selectToken = (0,es.mergeToken)(token, {
rootPrefixCls,
inputPaddingHorizontalBase: token.calc(token.paddingSM).sub(token.lineWidth).equal(),
multipleSelectItemHeight: token.multipleItemHeight,
selectHeight: token.controlHeight
});
return [genSelectStyle(selectToken), select_input(selectToken)];
}, prepareComponentToken, {
unitless: {
optionLineHeight: true,
optionSelectedFontWeight: true
}
}));
/***/ }),
/***/ "./components/skeleton/style/index.ts":
/*!********************************************!*\
!*** ./components/skeleton/style/index.ts ***!
\********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const skeletonClsLoading = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes(`ant-skeleton-loading`, {
'0%': {
backgroundPosition: '100% 50%'
},
'100%': {
backgroundPosition: '0 50%'
}
});
const genSkeletonElementCommonSize = size => ({
height: size,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(size)
});
const genSkeletonElementSize = size => ({
width: size,
...genSkeletonElementCommonSize(size)
});
const genSkeletonColor = token => ({
background: token.skeletonLoadingBackground,
backgroundSize: '400% 100%',
animationName: skeletonClsLoading,
animationDuration: token.skeletonLoadingMotionDuration,
animationTimingFunction: 'ease',
animationIterationCount: 'infinite'
});
const genSkeletonElementInputSize = (size, calc) => ({
width: calc(size).mul(5).equal(),
minWidth: calc(size).mul(5).equal(),
...genSkeletonElementCommonSize(size)
});
const genSkeletonElementAvatar = token => {
const {
skeletonAvatarCls,
gradientFromColor,
controlHeight,
controlHeightLG,
controlHeightSM
} = token;
return {
[skeletonAvatarCls]: {
display: 'inline-block',
verticalAlign: 'top',
background: gradientFromColor,
...genSkeletonElementSize(controlHeight)
},
[`${skeletonAvatarCls}${skeletonAvatarCls}-circle`]: {
borderRadius: '50%'
},
[`${skeletonAvatarCls}${skeletonAvatarCls}-lg`]: {
...genSkeletonElementSize(controlHeightLG)
},
[`${skeletonAvatarCls}${skeletonAvatarCls}-sm`]: {
...genSkeletonElementSize(controlHeightSM)
}
};
};
const genSkeletonElementInput = token => {
const {
controlHeight,
borderRadiusSM,
skeletonInputCls,
controlHeightLG,
controlHeightSM,
gradientFromColor,
calc
} = token;
return {
[skeletonInputCls]: {
display: 'inline-block',
verticalAlign: 'top',
background: gradientFromColor,
borderRadius: borderRadiusSM,
...genSkeletonElementInputSize(controlHeight, calc)
},
[`${skeletonInputCls}-lg`]: {
...genSkeletonElementInputSize(controlHeightLG, calc)
},
[`${skeletonInputCls}-sm`]: {
...genSkeletonElementInputSize(controlHeightSM, calc)
}
};
};
const genSkeletonElementShape = token => {
const {
gradientFromColor,
borderRadiusSM,
imageSizeBase,
calc
} = token;
return {
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
verticalAlign: 'middle',
background: gradientFromColor,
borderRadius: borderRadiusSM,
...genSkeletonElementSize(calc(imageSizeBase).mul(2).equal())
};
};
const genSkeletonElementNode = token => {
return {
[token.skeletonNodeCls]: {
...genSkeletonElementShape(token)
}
};
};
const genSkeletonElementImage = token => {
const {
skeletonImageCls,
imageSizeBase,
calc
} = token;
return {
[skeletonImageCls]: {
...genSkeletonElementShape(token),
[`${skeletonImageCls}-path`]: {
fill: '#bfbfbf'
},
[`${skeletonImageCls}-svg`]: {
...genSkeletonElementSize(imageSizeBase),
maxWidth: calc(imageSizeBase).mul(4).equal(),
maxHeight: calc(imageSizeBase).mul(4).equal()
},
[`${skeletonImageCls}-svg${skeletonImageCls}-svg-circle`]: {
borderRadius: '50%'
}
},
[`${skeletonImageCls}${skeletonImageCls}-circle`]: {
borderRadius: '50%'
}
};
};
const genSkeletonElementButtonShape = (token, size, buttonCls) => {
const {
skeletonButtonCls
} = token;
return {
[`${buttonCls}${skeletonButtonCls}-circle`]: {
width: size,
minWidth: size,
borderRadius: '50%'
},
[`${buttonCls}${skeletonButtonCls}-round`]: {
borderRadius: size
}
};
};
const genSkeletonElementButtonSize = (size, calc) => ({
width: calc(size).mul(2).equal(),
minWidth: calc(size).mul(2).equal(),
...genSkeletonElementCommonSize(size)
});
const genSkeletonElementButton = token => {
const {
borderRadiusSM,
skeletonButtonCls,
controlHeight,
controlHeightLG,
controlHeightSM,
gradientFromColor,
calc
} = token;
return {
[skeletonButtonCls]: {
display: 'inline-block',
verticalAlign: 'top',
background: gradientFromColor,
borderRadius: borderRadiusSM,
width: calc(controlHeight).mul(2).equal(),
minWidth: calc(controlHeight).mul(2).equal(),
...genSkeletonElementButtonSize(controlHeight, calc)
},
...genSkeletonElementButtonShape(token, controlHeight, skeletonButtonCls),
[`${skeletonButtonCls}-lg`]: {
...genSkeletonElementButtonSize(controlHeightLG, calc)
},
...genSkeletonElementButtonShape(token, controlHeightLG, `${skeletonButtonCls}-lg`),
[`${skeletonButtonCls}-sm`]: {
...genSkeletonElementButtonSize(controlHeightSM, calc)
},
...genSkeletonElementButtonShape(token, controlHeightSM, `${skeletonButtonCls}-sm`)
};
};
// =============================== Base ===============================
const genBaseStyle = token => {
const {
componentCls,
skeletonAvatarCls,
skeletonTitleCls,
skeletonParagraphCls,
skeletonButtonCls,
skeletonInputCls,
skeletonNodeCls,
skeletonImageCls,
controlHeight,
controlHeightLG,
controlHeightSM,
gradientFromColor,
padding,
marginSM,
borderRadius,
titleHeight,
blockRadius,
paragraphLiHeight,
controlHeightXS,
paragraphMarginTop
} = token;
return {
[componentCls]: {
display: 'table',
width: '100%',
[`${componentCls}-header`]: {
display: 'table-cell',
paddingInlineEnd: padding,
verticalAlign: 'top',
// Avatar
[skeletonAvatarCls]: {
display: 'inline-block',
verticalAlign: 'top',
background: gradientFromColor,
...genSkeletonElementSize(controlHeight)
},
[`${skeletonAvatarCls}-circle`]: {
borderRadius: '50%'
},
[`${skeletonAvatarCls}-lg`]: {
...genSkeletonElementSize(controlHeightLG)
},
[`${skeletonAvatarCls}-sm`]: {
...genSkeletonElementSize(controlHeightSM)
}
},
[`${componentCls}-section`]: {
display: 'table-cell',
width: '100%',
verticalAlign: 'top',
// Title
[skeletonTitleCls]: {
width: '100%',
height: titleHeight,
background: gradientFromColor,
borderRadius: blockRadius,
[`+ ${skeletonParagraphCls}`]: {
marginBlockStart: controlHeightSM
}
},
// paragraph
[skeletonParagraphCls]: {
padding: 0,
'> li': {
width: '100%',
height: paragraphLiHeight,
listStyle: 'none',
background: gradientFromColor,
borderRadius: blockRadius,
'+ li': {
marginBlockStart: controlHeightXS
}
}
},
[`${skeletonParagraphCls}> li:last-child:not(:first-child):not(:nth-child(2))`]: {
width: '61%'
}
},
[`&-round ${componentCls}-section`]: {
[`${skeletonTitleCls}, ${skeletonParagraphCls} > li`]: {
borderRadius
}
}
},
[`${componentCls}-with-avatar ${componentCls}-section`]: {
// Title
[skeletonTitleCls]: {
marginBlockStart: marginSM,
[`+ ${skeletonParagraphCls}`]: {
marginBlockStart: paragraphMarginTop
}
}
},
// Skeleton with element
[`${componentCls}${componentCls}-element`]: {
display: 'inline-block',
width: 'auto',
...genSkeletonElementButton(token),
...genSkeletonElementAvatar(token),
...genSkeletonElementInput(token),
...genSkeletonElementNode(token),
...genSkeletonElementImage(token)
},
// Skeleton Block Button, Input
[`${componentCls}${componentCls}-block`]: {
width: '100%',
[skeletonButtonCls]: {
width: '100%'
},
[skeletonInputCls]: {
width: '100%'
}
},
// With active animation
[`${componentCls}${componentCls}-active`]: {
[`
${skeletonTitleCls},
${skeletonParagraphCls} > li,
${skeletonAvatarCls},
${skeletonButtonCls},
${skeletonInputCls},
${skeletonNodeCls},
${skeletonImageCls}
`]: {
...genSkeletonColor(token)
}
}
};
};
// ============================== Export ==============================
const prepareComponentToken = token => {
const {
colorFillContent,
colorFill
} = token;
const gradientFromColor = colorFillContent;
const gradientToColor = colorFill;
return {
color: gradientFromColor,
colorGradientEnd: gradientToColor,
gradientFromColor,
gradientToColor,
titleHeight: token.controlHeight / 2,
blockRadius: token.borderRadiusSM,
paragraphMarginTop: token.marginLG + token.marginXXS,
paragraphLiHeight: token.controlHeight / 2
};
};
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.genStyleHooks)('Skeleton', token => {
const {
componentCls,
calc
} = token;
const skeletonToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_1__.mergeToken)(token, {
skeletonAvatarCls: `${componentCls}-avatar`,
skeletonTitleCls: `${componentCls}-title`,
skeletonParagraphCls: `${componentCls}-paragraph`,
skeletonButtonCls: `${componentCls}-button`,
skeletonInputCls: `${componentCls}-input`,
skeletonNodeCls: `${componentCls}-node`,
skeletonImageCls: `${componentCls}-image`,
imageSizeBase: calc(token.controlHeight).mul(1.5).equal(),
borderRadius: 100,
// Large number to make capsule shape
skeletonLoadingBackground: `linear-gradient(90deg, ${token.gradientFromColor} 25%, ${token.gradientToColor} 37%, ${token.gradientFromColor} 63%)`,
skeletonLoadingMotionDuration: '1.4s'
});
return genBaseStyle(skeletonToken);
}, prepareComponentToken, {
deprecatedTokens: [['color', 'gradientFromColor'], ['colorGradientEnd', 'gradientToColor']]
}));
/***/ }),
/***/ "./components/slider/style/index.ts":
/*!******************************************!*\
!*** ./components/slider/style/index.ts ***!
\******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ant-design/fast-color */ "./node_modules/@ant-design/fast-color/es/index.js");
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
// =============================== Base ===============================
const genBaseStyle = token => {
const {
componentCls,
antCls,
controlSize,
dotSize,
marginFull,
marginPart,
colorFillContentHover,
handleColorDisabled,
calc,
handleSize,
handleSizeHover,
handleActiveColor,
handleActiveOutlineColor,
handleLineWidth,
handleLineWidthHover,
motionDurationMid
} = token;
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_2__.resetComponent)(token),
position: 'relative',
height: controlSize,
margin: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(marginPart)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(marginFull)}`,
padding: 0,
cursor: 'pointer',
touchAction: 'none',
'&-vertical': {
margin: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(marginFull)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(marginPart)}`
},
[`${componentCls}-rail`]: {
position: 'absolute',
backgroundColor: token.railBg,
borderRadius: token.borderRadiusXS,
transition: `background-color ${motionDurationMid}`
},
[`${componentCls}-track,${componentCls}-tracks`]: {
position: 'absolute',
transition: `background-color ${motionDurationMid}`
},
[`${componentCls}-track`]: {
backgroundColor: token.trackBg,
borderRadius: token.borderRadiusXS
},
[`${componentCls}-track-draggable`]: {
boxSizing: 'content-box',
backgroundClip: 'content-box',
border: 'solid rgba(0,0,0,0)'
},
'&:hover': {
[`${componentCls}-rail`]: {
backgroundColor: token.railHoverBg
},
[`${componentCls}-track`]: {
backgroundColor: token.trackHoverBg
},
[`${componentCls}-dot`]: {
borderColor: colorFillContentHover
},
[`${componentCls}-handle::after`]: {
boxShadow: `0 0 0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(handleLineWidth)} ${token.colorPrimaryBorderHover}`
},
[`${componentCls}-dot-active`]: {
borderColor: token.dotActiveBorderColor
}
},
[`${componentCls}-handle`]: {
position: 'absolute',
width: handleSize,
height: handleSize,
outline: 'none',
userSelect: 'none',
// Dragging status
'&-dragging-delete': {
opacity: 0
},
// 扩大选区
'&::before': {
content: '""',
position: 'absolute',
insetInlineStart: calc(handleLineWidth).mul(-1).equal(),
insetBlockStart: calc(handleLineWidth).mul(-1).equal(),
width: calc(handleSize).add(calc(handleLineWidth).mul(2)).equal(),
height: calc(handleSize).add(calc(handleLineWidth).mul(2)).equal(),
backgroundColor: 'transparent'
},
'&::after': {
content: '""',
position: 'absolute',
insetBlockStart: 0,
insetInlineStart: 0,
width: handleSize,
height: handleSize,
backgroundColor: token.colorBgElevated,
boxShadow: `0 0 0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(handleLineWidth)} ${token.handleColor}`,
outline: `0px solid transparent`,
borderRadius: '50%',
cursor: 'pointer',
transition: ['inset-inline-start', 'inset-block-start', 'width', 'height', 'box-shadow', 'outline'].map(prop => `${prop} ${motionDurationMid}`).join(', ')
},
'&:hover, &:active, &:focus': {
'&::before': {
insetInlineStart: calc(handleSizeHover).sub(handleSize).div(2).add(handleLineWidthHover).mul(-1).equal(),
insetBlockStart: calc(handleSizeHover).sub(handleSize).div(2).add(handleLineWidthHover).mul(-1).equal(),
width: calc(handleSizeHover).add(calc(handleLineWidthHover).mul(2)).equal(),
height: calc(handleSizeHover).add(calc(handleLineWidthHover).mul(2)).equal()
},
'&::after': {
boxShadow: `0 0 0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(handleLineWidthHover)} ${handleActiveColor}`,
outline: `6px solid ${handleActiveOutlineColor}`,
width: handleSizeHover,
height: handleSizeHover,
insetInlineStart: token.calc(handleSize).sub(handleSizeHover).div(2).equal(),
insetBlockStart: token.calc(handleSize).sub(handleSizeHover).div(2).equal()
}
}
},
[`&-lock ${componentCls}-handle`]: {
'&::before, &::after': {
transition: 'none'
}
},
[`${componentCls}-mark`]: {
position: 'absolute',
fontSize: token.fontSize
},
[`${componentCls}-mark-text`]: {
position: 'absolute',
display: 'inline-block',
color: token.colorTextDescription,
textAlign: 'center',
wordBreak: 'keep-all',
cursor: 'pointer',
userSelect: 'none',
'&-active': {
color: token.colorText
}
},
[`${componentCls}-step`]: {
position: 'absolute',
background: 'transparent',
pointerEvents: 'none'
},
[`${componentCls}-dot`]: {
position: 'absolute',
width: dotSize,
height: dotSize,
backgroundColor: token.colorBgElevated,
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(handleLineWidth)} solid ${token.dotBorderColor}`,
borderRadius: '50%',
cursor: 'pointer',
transition: `border-color ${token.motionDurationSlow}`,
pointerEvents: 'auto',
'&-active': {
borderColor: token.dotActiveBorderColor
}
},
[`&${componentCls}-disabled`]: {
cursor: 'not-allowed',
[`${componentCls}-rail`]: {
backgroundColor: `${token.railBg} !important`
},
[`${componentCls}-track`]: {
backgroundColor: `${token.trackBgDisabled} !important`
},
[`
${componentCls}-dot
`]: {
backgroundColor: token.colorBgElevated,
borderColor: token.trackBgDisabled,
boxShadow: 'none',
cursor: 'not-allowed'
},
[`${componentCls}-handle::after`]: {
backgroundColor: token.colorBgElevated,
cursor: 'not-allowed',
width: handleSize,
height: handleSize,
boxShadow: `0 0 0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(handleLineWidth)} ${handleColorDisabled}`,
insetInlineStart: 0,
insetBlockStart: 0
},
[`
${componentCls}-mark-text,
${componentCls}-dot
`]: {
cursor: `not-allowed !important`
}
},
[`&-tooltip ${antCls}-tooltip-container`]: {
minWidth: 'unset'
}
}
};
};
// ============================ Horizontal ============================
const genDirectionStyle = (token, horizontal) => {
const {
componentCls,
railSize,
handleSize,
dotSize,
marginFull,
calc
} = token;
const railPadding = horizontal ? 'paddingBlock' : 'paddingInline';
const full = horizontal ? 'width' : 'height';
const part = horizontal ? 'height' : 'width';
const handlePos = horizontal ? 'insetBlockStart' : 'insetInlineStart';
const markInset = horizontal ? 'top' : 'insetInlineStart';
const handlePosSize = calc(railSize).mul(3).sub(handleSize).div(2).equal();
const draggableBorderSize = calc(handleSize).sub(railSize).div(2).equal();
const draggableBorder = horizontal ? {
borderWidth: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(draggableBorderSize)} 0`,
transform: `translateY(${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(calc(draggableBorderSize).mul(-1).equal())})`
} : {
borderWidth: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(draggableBorderSize)}`,
transform: `translateX(${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(draggableBorderSize).mul(-1).equal())})`
};
return {
[railPadding]: railSize,
[part]: calc(railSize).mul(3).equal(),
[`${componentCls}-rail`]: {
[full]: '100%',
[part]: railSize
},
[`${componentCls}-track,${componentCls}-tracks`]: {
[part]: railSize
},
[`${componentCls}-track-draggable`]: {
...draggableBorder
},
[`${componentCls}-handle`]: {
[handlePos]: handlePosSize
},
[`${componentCls}-mark`]: {
// Reset all
insetInlineStart: 0,
top: 0,
// https://github.com/ant-design/ant-design/issues/43731
[markInset]: calc(railSize).mul(3).add(horizontal ? 0 : marginFull).equal(),
[full]: '100%'
},
[`${componentCls}-step`]: {
// Reset all
insetInlineStart: 0,
top: 0,
[markInset]: railSize,
[full]: '100%',
[part]: railSize
},
[`${componentCls}-dot`]: {
position: 'absolute',
[handlePos]: calc(railSize).sub(dotSize).div(2).equal()
}
};
};
// ============================ Horizontal ============================
const genHorizontalStyle = token => {
const {
componentCls,
marginPartWithMark
} = token;
return {
[`${componentCls}-horizontal`]: {
...genDirectionStyle(token, true),
[`&${componentCls}-with-marks`]: {
marginBottom: marginPartWithMark
}
}
};
};
// ============================= Vertical =============================
const genVerticalStyle = token => {
const {
componentCls
} = token;
return {
[`${componentCls}-vertical`]: {
...genDirectionStyle(token, false),
height: '100%'
}
};
};
// ============================== Export ==============================
const prepareComponentToken = token => {
// Handle line width is always width-er 1px
const increaseHandleWidth = 1;
const controlSize = token.controlHeightLG / 4;
const controlSizeHover = token.controlHeightSM / 2;
const handleLineWidth = token.lineWidth + increaseHandleWidth;
const handleLineWidthHover = token.lineWidth + increaseHandleWidth * 1.5;
const handleActiveColor = token.colorPrimary;
const handleActiveOutlineColor = new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__.FastColor(handleActiveColor).setA(0.2).toRgbString();
return {
controlSize,
railSize: 4,
handleSize: controlSize,
handleSizeHover: controlSizeHover,
dotSize: 8,
handleLineWidth,
handleLineWidthHover,
railBg: token.colorFillTertiary,
railHoverBg: token.colorFillSecondary,
trackBg: token.colorPrimaryBorder,
trackHoverBg: token.colorPrimaryBorderHover,
handleColor: token.colorPrimaryBorder,
handleActiveColor,
handleActiveOutlineColor,
handleColorDisabled: new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__.FastColor(token.colorTextDisabled).onBackground(token.colorBgContainer).toHexString(),
dotBorderColor: token.colorBorderSecondary,
dotActiveBorderColor: token.colorPrimaryBorder,
trackBgDisabled: token.colorBgContainerDisabled
};
};
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_4__.genStyleHooks)('Slider', token => {
const sliderToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.mergeToken)(token, {
marginPart: token.calc(token.controlHeight).sub(token.controlSize).div(2).equal(),
marginFull: token.calc(token.controlSize).div(2).equal(),
marginPartWithMark: token.calc(token.controlHeightLG).sub(token.controlSize).equal()
});
return [genBaseStyle(sliderToken), genHorizontalStyle(sliderToken), genVerticalStyle(sliderToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/space/style/index.ts":
/*!*****************************************!*\
!*** ./components/space/style/index.ts ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const genSpaceStyle = token => {
const {
componentCls,
antCls
} = 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'
},
// https://github.com/ant-design/ant-design/issues/47875
[`${componentCls}-item > ${antCls}-badge-not-a-wrapper:only-child`]: {
display: 'block'
}
}
};
};
const genSpaceGapStyle = token => {
const {
componentCls
} = token;
return {
[componentCls]: {
'&-gap-row-small': {
rowGap: token.spaceGapSmallSize
},
'&-gap-row-medium, &-gap-row-middle': {
rowGap: token.spaceGapMiddleSize
},
'&-gap-row-large': {
rowGap: token.spaceGapLargeSize
},
'&-gap-col-small': {
columnGap: token.spaceGapSmallSize
},
'&-gap-col-medium, &-gap-col-middle': {
columnGap: token.spaceGapMiddleSize
},
'&-gap-col-large': {
columnGap: token.spaceGapLargeSize
}
}
};
};
// ============================== Export ==============================
const prepareComponentToken = () => ({});
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_1__.genStyleHooks)('Space', token => {
const spaceToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_0__.mergeToken)(token, {
spaceGapSmallSize: token.paddingXS,
spaceGapMiddleSize: token.padding,
spaceGapLargeSize: token.paddingLG
});
return [genSpaceStyle(spaceToken), genSpaceGapStyle(spaceToken)];
}, () => ({}), {
// Space component don't apply extra font style
// https://github.com/ant-design/ant-design/issues/40315
resetStyle: false
}));
/***/ }),
/***/ "./components/spin/style/index.ts":
/*!****************************************!*\
!*** ./components/spin/style/index.ts ***!
\****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/util/genStyleUtils */ "./components/theme/util/genStyleUtils.ts");
const antSpinMove = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antSpinMove', {
to: {
opacity: 1
}
});
const antRotate = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antRotate', {
to: {
transform: 'rotate(405deg)'
}
});
// =============================== Spin ===============================
const genSpinStyle = token => {
const {
componentCls
} = token;
const sectionCls = `${componentCls}-section`;
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
position: 'relative',
'&-rtl': {
direction: 'rtl'
},
// ========================== Section ===========================
[`&${sectionCls}, ${sectionCls}`]: {
display: 'flex',
alignItems: 'center',
flexDirection: 'column',
gap: token.paddingSM,
color: token.colorPrimary
},
[`&${sectionCls}`]: {
display: 'inline-flex'
},
[sectionCls]: {
position: 'absolute',
top: '50%',
left: {
_skip_check_: true,
value: '50%'
},
transform: 'translate(-50%, -50%)',
zIndex: 1
},
[`${componentCls}-description`]: {
fontSize: token.fontSize,
lineHeight: 1
},
// ========================= Container ==========================
[`${componentCls}-container`]: {
position: 'relative',
transition: `opacity ${token.motionDurationSlow}`,
'&::after': {
position: 'absolute',
top: 0,
insetInlineEnd: 0,
bottom: 0,
insetInlineStart: 0,
zIndex: 10,
width: '100%',
height: '100%',
background: token.colorBgContainer,
opacity: 0,
transition: `all ${token.motionDurationSlow}`,
content: '""',
pointerEvents: 'none'
}
},
// ========================== Spinning ==========================
'&-spinning': {
[`${componentCls}-description`]: {
textShadow: `0 0px 5px ${token.colorBgContainer}`
},
[`${componentCls}-container`]: {
clear: 'both',
opacity: 0.5,
userSelect: 'none',
pointerEvents: 'none',
'&::after': {
opacity: 0.4,
pointerEvents: 'auto'
}
}
},
// ========================= Fullscreen =========================
'&-fullscreen': {
position: 'fixed',
inset: 0,
backgroundColor: token.colorBgMask,
zIndex: token.zIndexPopupBase,
opacity: 0,
pointerEvents: 'none',
transition: `all ${token.motionDurationMid}`,
[`&${componentCls}-spinning`]: {
opacity: 1,
pointerEvents: 'auto'
},
[sectionCls]: {
color: token.colorWhite,
[`${componentCls}-description`]: {
color: token.colorTextLightSolid
}
}
}
}
};
};
// ============================ Indicator =============================
const genIndicatorStyle = token => {
const {
componentCls,
antCls,
motionDurationSlow
} = token;
const [varName, varRef] = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genCssVar)(antCls, 'spin');
return {
[componentCls]: {
[varName('dot-holder-size')]: token.dotSize,
[varName('dot-item-size')]: `calc((${varRef('dot-holder-size')} - ${token.marginXXS} / 2) / 2)`,
[`${componentCls}-dot`]: {
// >>> holder
'&-holder': {
width: '1em',
height: '1em',
fontSize: varRef('dot-holder-size'),
display: 'inline-block',
transition: ['transform', 'opacity'].map(prop => `${prop} ${motionDurationSlow} ease`).join(', '),
transformOrigin: '50% 50%',
lineHeight: 1,
'&-hidden': {
transform: 'scale(0.3)',
opacity: 0
}
},
// >>> holder > dot
position: 'relative',
display: 'inline-block',
fontSize: varRef('dot-holder-size'),
width: '1em',
height: '1em',
'&-spin': {
transform: 'rotate(45deg)',
animationName: antRotate,
animationDuration: '1.2s',
animationIterationCount: 'infinite',
animationTimingFunction: 'linear'
},
// >>> holder > dot > item
'&-item': {
position: 'absolute',
display: 'block',
width: varRef('dot-item-size'),
height: varRef('dot-item-size'),
background: 'currentColor',
borderRadius: '100%',
transform: 'scale(0.75)',
transformOrigin: '50% 50%',
opacity: 0.3,
animationName: antSpinMove,
animationDuration: '1s',
animationIterationCount: 'infinite',
animationTimingFunction: 'linear',
animationDirection: 'alternate',
'&:nth-child(1)': {
top: 0,
insetInlineStart: 0,
animationDelay: '0s'
},
'&:nth-child(2)': {
top: 0,
insetInlineEnd: 0,
animationDelay: '0.4s'
},
'&:nth-child(3)': {
insetInlineEnd: 0,
bottom: 0,
animationDelay: '0.8s'
},
'&:nth-child(4)': {
bottom: 0,
insetInlineStart: 0,
animationDelay: '1.2s'
}
},
// ========================= Progress =========================
'&-progress': {
position: 'absolute',
left: '50%',
top: 0,
transform: 'translateX(-50%)'
},
'&-circle': {
strokeLinecap: 'round',
transition: ['stroke-dashoffset', 'stroke-dasharray', 'stroke', 'stroke-width', 'opacity'].map(item => `${item} ${motionDurationSlow} ease`).join(','),
fillOpacity: 0,
stroke: 'currentcolor'
},
'&-circle-bg': {
stroke: token.colorFillSecondary
}
}
}
};
};
// =============================== Size ===============================
const genSizeStyle = token => {
const {
componentCls
} = token;
const [varName] = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genCssVar)(token.antCls, 'spin');
return {
[componentCls]: {
'&-sm': {
[varName('dot-holder-size')]: token.dotSizeSM
},
'&-lg': {
[varName('dot-holder-size')]: token.dotSizeLG
}
}
};
};
// ========================= Component Token ==========================
const prepareComponentToken = token => {
const {
controlHeightLG,
controlHeight
} = token;
return {
contentHeight: 400,
dotSize: controlHeightLG / 2,
dotSizeSM: controlHeightLG * 0.35,
dotSizeLG: controlHeight
};
};
// ============================== Export ==============================
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genStyleHooks)('Spin', token => {
const spinToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token, {
spinDotDefault: token.colorTextDescription
});
return [genSpinStyle(spinToken), genIndicatorStyle(spinToken), genSizeStyle(spinToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/splitter/style/index.ts":
/*!********************************************!*\
!*** ./components/splitter/style/index.ts ***!
\********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../theme/util/genStyleUtils */ "./components/theme/util/genStyleUtils.ts");
const centerStyle = {
position: 'absolute',
top: '50%',
left: {
_skip_check_: true,
value: '50%'
},
transform: 'translate(-50%, -50%)'
};
const genSplitterStyle = token => {
const {
componentCls,
colorFill,
splitBarDraggableSize,
splitBarSize,
splitTriggerSize,
controlItemBgHover,
controlItemBgActive,
controlItemBgActiveHover,
colorPrimary,
antCls,
calc
} = token;
const [, varRef] = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_1__.genCssVar)(antCls, 'splitter');
const splitBarCls = `${componentCls}-bar`;
const splitMaskCls = `${componentCls}-mask`;
const splitPanelCls = `${componentCls}-panel`;
const halfTriggerSize = calc(splitTriggerSize).div(2).equal();
const splitterBarPreviewStyle = {
position: 'absolute',
background: token.colorPrimary,
opacity: 0.2,
pointerEvents: 'none',
transition: 'none',
zIndex: 1,
display: 'none'
};
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_0__.resetComponent)(token),
display: 'flex',
width: '100%',
height: '100%',
alignItems: 'stretch',
// ======================== SplitBar ========================
// Use `>` to avoid conflict with mix layout
[`> ${splitBarCls}`]: {
flex: 'none',
position: 'relative',
userSelect: 'none',
// ======================= Dragger =======================
[`${splitBarCls}-dragger`]: {
...centerStyle,
zIndex: 1,
// Hover background
'&::before': {
content: '""',
background: controlItemBgHover,
...centerStyle
},
// Spinner
'&::after': {
content: '""',
background: colorFill,
...centerStyle
},
// Hover
[`&:hover:not(${splitBarCls}-dragger-active)`]: {
'&::before': {
background: controlItemBgActive
}
},
// Active
'&-active': {
zIndex: 2,
'&::before': {
background: controlItemBgActiveHover
}
},
[`&-active${splitBarCls}-dragger-customize`]: {
[`${splitBarCls}-dragger-icon`]: {
color: colorPrimary
}
},
// Disabled, not use `pointer-events: none` since still need trigger collapse
[`&-disabled${splitBarCls}-dragger`]: {
zIndex: 0,
'&, &:hover, &-active': {
cursor: 'default',
'&::before': {
background: controlItemBgHover
}
},
'&::after': {
display: 'none'
},
[`${splitBarCls}-dragger-icon`]: {
display: 'none'
}
},
// customize dragger icon
'&-customize': {
[`${splitBarCls}-dragger-icon`]: {
...centerStyle,
display: 'flex',
alignItems: 'center',
color: colorFill
},
'&::after': {
display: 'none'
}
}
},
// ======================= Collapse =======================
[`${splitBarCls}-collapse-bar`]: {
...centerStyle,
zIndex: token.zIndexPopupBase,
background: controlItemBgHover,
fontSize: token.fontSizeSM,
borderRadius: token.borderRadiusXS,
color: token.colorText,
cursor: 'pointer',
opacity: 0,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
// Hover
[`&:hover:not(${splitBarCls}-collapse-bar-customize)`]: {
background: controlItemBgActive
},
// Active
[`&:active:not(${splitBarCls}-collapse-bar-customize)`]: {
background: controlItemBgActiveHover
},
[`${splitBarCls}-collapse-icon`]: {
display: 'flex',
alignItems: 'center'
}
},
[`${splitBarCls}-collapse-bar-customize`]: {
background: 'transparent'
},
'&:hover, &:active': {
[`${splitBarCls}-collapse-bar-hover-only`]: {
opacity: 1
}
},
[`${splitBarCls}-collapse-bar-hover-only`]: {
'@media(hover:none)': {
opacity: 1
}
},
[`${splitBarCls}-collapse-bar-always-hidden`]: {
display: 'none'
},
[`${splitBarCls}-collapse-bar-always-visible`]: {
opacity: 1
}
},
// =========================== Mask =========================
// Util dom for handle cursor
[splitMaskCls]: {
position: 'fixed',
zIndex: token.zIndexPopupBase,
inset: 0,
'&-horizontal': {
cursor: 'col-resize'
},
'&-vertical': {
cursor: 'row-resize'
}
},
// ==========================================================
// == Layout ==
// ==========================================================
'&-horizontal': {
flexDirection: 'row',
[`> ${splitBarCls}`]: {
width: 0,
// ======================= Preview =======================
[`${splitBarCls}-preview`]: {
height: '100%',
width: splitBarSize,
...splitterBarPreviewStyle,
[`&${splitBarCls}-preview-active`]: {
display: 'block',
transform: `translate3d(${varRef('bar-preview-offset')}, 0, 0)`
}
},
// ======================= Dragger =======================
[`${splitBarCls}-dragger`]: {
cursor: 'col-resize',
height: '100%',
width: splitTriggerSize,
'&::before': {
height: '100%',
width: splitBarSize
},
'&::after': {
height: splitBarDraggableSize,
width: splitBarSize
}
},
// ======================= Collapse =======================
[`${splitBarCls}-collapse-bar`]: {
width: token.fontSizeSM,
height: token.controlHeightSM,
'&-start': {
left: {
_skip_check_: true,
value: 'auto'
},
right: {
_skip_check_: true,
value: halfTriggerSize
},
transform: 'translateY(-50%)'
},
'&-end': {
left: {
_skip_check_: true,
value: halfTriggerSize
},
right: {
_skip_check_: true,
value: 'auto'
},
transform: 'translateY(-50%)'
}
}
}
},
'&-vertical': {
flexDirection: 'column',
[`> ${splitBarCls}`]: {
height: 0,
// ======================= Preview =======================
[`${splitBarCls}-preview`]: {
height: splitBarSize,
width: '100%',
...splitterBarPreviewStyle,
[`&${splitBarCls}-preview-active`]: {
display: 'block',
transform: `translate3d(0, ${varRef('bar-preview-offset')}, 0)`
}
},
// ======================= Dragger =======================
[`${splitBarCls}-dragger`]: {
cursor: 'row-resize',
width: '100%',
height: splitTriggerSize,
'&::before': {
width: '100%',
height: splitBarSize
},
'&::after': {
width: splitBarDraggableSize,
height: splitBarSize
}
},
// ======================= Collapse =======================
[`${splitBarCls}-collapse-bar`]: {
height: token.fontSizeSM,
width: token.controlHeightSM,
'&-start': {
top: 'auto',
bottom: halfTriggerSize,
transform: 'translateX(-50%)'
},
'&-end': {
top: halfTriggerSize,
bottom: 'auto',
transform: 'translateX(-50%)'
}
}
}
},
// ========================= Panels =========================
[splitPanelCls]: {
overflow: 'auto',
padding: '0 1px',
scrollbarWidth: 'thin',
boxSizing: 'border-box',
'&-hidden': {
padding: 0,
overflow: 'hidden'
},
[`&:has(${componentCls}:only-child)`]: {
overflow: 'hidden'
}
}
}
};
};
const prepareComponentToken = token => {
const splitBarSize = token.splitBarSize || 2;
const splitTriggerSize = token.splitTriggerSize || 6;
// https://github.com/ant-design/ant-design/pull/51223
const resizeSpinnerSize = token.resizeSpinnerSize || 20;
const splitBarDraggableSize = token.splitBarDraggableSize ?? resizeSpinnerSize;
return {
splitBarSize,
splitTriggerSize,
splitBarDraggableSize,
resizeSpinnerSize
};
};
// ============================== Export ==============================
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_1__.genStyleHooks)('Splitter', genSplitterStyle, prepareComponentToken));
/***/ }),
/***/ "./components/statistic/style/index.ts":
/*!*********************************************!*\
!*** ./components/statistic/style/index.ts ***!
\*********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const genStatisticStyle = token => {
const {
componentCls,
marginXXS,
padding,
colorTextDescription,
titleFontSize,
colorTextHeading,
contentFontSize,
fontFamily
} = token;
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_0__.resetComponent)(token),
[`${componentCls}-header`]: {
paddingBottom: marginXXS,
[`${componentCls}-title`]: {
color: colorTextDescription,
fontSize: titleFontSize
}
},
[`${componentCls}-skeleton`]: {
paddingTop: padding
},
[`${componentCls}-content`]: {
color: colorTextHeading,
fontSize: contentFontSize,
fontFamily,
[`${componentCls}-content-value`]: {
display: 'inline-block',
direction: 'ltr'
},
[`${componentCls}-content-prefix, ${componentCls}-content-suffix`]: {
display: 'inline-block'
},
[`${componentCls}-content-prefix`]: {
marginInlineEnd: marginXXS
},
[`${componentCls}-content-suffix`]: {
marginInlineStart: marginXXS
}
}
}
};
};
// ============================== Export ==============================
const prepareComponentToken = token => {
const {
fontSizeHeading3,
fontSize
} = token;
return {
titleFontSize: fontSize,
contentFontSize: fontSizeHeading3
};
};
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.genStyleHooks)('Statistic', token => {
const statisticToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_1__.mergeToken)(token, {});
return genStatisticStyle(statisticToken);
}, prepareComponentToken));
/***/ }),
/***/ "./components/steps/style/index.ts":
/*!******************************************************!*\
!*** ./components/steps/style/index.ts + 13 modules ***!
\******************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ steps_style; },
prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
});
// EXTERNAL MODULE: ./components/style/index.tsx
var style = __webpack_require__("./components/style/index.tsx");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
;// ./components/steps/style/horizontal.ts
const genHorizontalStyle = token => {
const {
componentCls,
antCls
} = token;
const itemCls = `${componentCls}-item`;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'cmp-steps');
return {
[`${componentCls}-horizontal`]: {
[`> ${itemCls}`]: {
flex: '1 1 auto',
minWidth: token.iconSize,
[`${itemCls}-rail`]: {
[varName('horizontal-rail-margin')]: `calc(${varRef('icon-size-max')} / 2 + ${varRef('item-wrapper-padding-top')})`,
position: 'static',
marginTop: varRef('horizontal-rail-margin'),
width: 'auto',
borderBlockStartWidth: varRef('rail-size'),
flex: 1,
minWidth: 0,
alignSelf: 'flex-start',
transform: 'translateY(-50%)'
}
}
}
};
};
/* harmony default export */ var horizontal = (genHorizontalStyle);
;// ./components/steps/style/icon.ts
const genIconStyle = token => {
const {
componentCls,
customIconFontSize,
motionDurationSlow,
iconSize,
lineWidth,
lineType,
antCls
} = token;
const itemCls = `${componentCls}-item`;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'cmp-steps');
return {
[componentCls]: {
[varName('icon-size')]: iconSize,
[varName('icon-border-width')]: lineWidth,
[`${itemCls}-icon`]: {
width: varRef('icon-size'),
height: varRef('icon-size'),
margin: 0,
flex: 'none',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontSize: token.iconFontSize,
fontFamily: token.fontFamily,
lineHeight: varRef('icon-size'),
textAlign: 'center',
borderRadius: varRef('icon-size'),
border: `${varRef('icon-border-width')} ${lineType} transparent`,
transition: ['background-color', 'border', 'color', 'inset', 'transform'].map(key => `${key} ${motionDurationSlow}`).join(', '),
zIndex: 1
},
// ==================== Custom ====================
[`${itemCls}-custom ${itemCls}-icon`]: {
background: 'none',
border: 0,
fontSize: customIconFontSize
}
}
};
};
/* harmony default export */ var icon = (genIconStyle);
;// ./components/steps/style/inline.ts
const genInlineStyle = token => {
const {
componentCls,
inlineDotSize,
paddingXS,
lineWidth,
antCls,
calc
} = token;
const containerPaddingTop = calc(paddingXS).add(lineWidth).equal();
const itemCls = `${componentCls}-item`;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'cmp-steps');
return {
[`${componentCls}-inline`]: {
[varName('items-offset')]: '0',
[varName('item-wrapper-padding-top')]: containerPaddingTop,
display: 'inline-flex',
'&:before': {
content: '""',
flex: varRef('items-offset')
},
[itemCls]: {
// ========================= Variable =========================
// Item
[varName('title-vertical-row-gap')]: paddingXS,
// Icon
[varName('icon-size')]: inlineDotSize,
[varName('icon-size-active')]: inlineDotSize,
// Title
[varName('title-font-size')]: token.fontSizeSM,
[varName('title-line-height')]: token.lineHeightSM,
[varName('item-title-color')]: token.colorTextSecondary,
[varName('subtitle-font-size')]: token.fontSizeSM,
[varName('subtitle-line-height')]: token.lineHeightSM,
[varName('item-subtitle-color')]: token.colorTextQuaternary,
// Rail
[varName('rail-size')]: token.lineWidth,
[varName('title-horizontal-rail-gap')]: '0px',
// ========================== Styles ==========================
flex: 1,
'&-wrapper': {
paddingInline: token.paddingXXS,
marginInline: token.calc(token.marginXXS).div(2).equal(),
borderRadius: token.borderRadiusSM,
cursor: 'pointer',
transition: `background-color ${token.motionDurationMid}`,
'&:hover': {
background: token.controlItemBgHover
}
},
// Icon
'&-icon': {
[`${itemCls}-icon-dot`]: {
'&:after': {
display: 'none'
}
}
},
// Header
'&-title': {
fontWeight: 'normal',
whiteSpace: 'nowrap'
},
'&-content': {
display: 'none'
}
}
}
};
};
/* harmony default export */ var inline = (genInlineStyle);
;// ./components/steps/style/util.ts
function withoutVar(cssVar) {
return (cssVar || '--ant-not-exist').replace(/var\((.*)\)/, '$1');
}
/**
* Force override the width related styles.
* This should be multiple since will conflict with other `rail` styles.
*/
const getItemWithWidthStyle = (token, marginSize, optionalStyle) => {
const {
calc,
componentCls,
descriptionMaxWidth,
antCls
} = token;
const itemCls = `${componentCls}-item`;
const [, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'cmp-steps');
return {
[`@container style(${withoutVar(descriptionMaxWidth)})`]: [{
// Icon
[`${itemCls}-icon`]: {
marginInlineStart: calc(descriptionMaxWidth).sub(varRef('icon-size')).div(2).equal()
},
// >>> Rail
[`${itemCls}-rail`]: {
width: 'auto',
insetInlineStart: calc(descriptionMaxWidth).add(varRef('icon-size')).div(2).add(marginSize).equal(),
insetInlineEnd: calc(descriptionMaxWidth).sub(varRef('icon-size')).div(2).sub(marginSize).mul(-1).equal()
}
}, optionalStyle]
};
};
;// ./components/steps/style/label-placement.ts
const genLabelPlacementStyle = token => {
const {
componentCls,
descriptionMaxWidth,
marginXS,
fontHeightLG,
margin,
paddingSM,
marginXXS,
antCls,
calc
} = token;
const itemCls = `${componentCls}-item`;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'cmp-steps');
return {
// ====================== Shared ======================
[componentCls]: {
// Dot Steps active icon size is 2px larger than the default icon size
[varName('icon-size-max')]: `max(${varRef('icon-size')}, ${varRef('icon-size-active', varRef('icon-size'))})`,
// Icon
[`${itemCls}-icon`]: {
marginBlockStart: `calc((${varRef('heading-height')} - ${varRef('icon-size')}) / 2)`
}
},
// ==================== Horizontal ====================
[`${componentCls}-title-horizontal`]: {
[varName('title-horizontal-item-margin')]: margin,
[varName('title-horizontal-rail-margin')]: margin,
[varName('title-horizontal-title-height')]: fontHeightLG,
[varName('heading-height')]: `max(${varRef('icon-size')}, ${varRef('title-horizontal-title-height')})`,
// Horizontal only
[`&${componentCls}-horizontal, &${componentCls}-horizontal-alternate`]: {
[`${itemCls}:not(:first-child)`]: {
marginInlineStart: varRef('title-horizontal-item-margin')
},
[`${itemCls}:last-child`]: {
flex: '0 1 auto'
},
[`${itemCls}-wrapper`]: {
columnGap: token.marginXS
}
},
// Vertical only
[`&${componentCls}-vertical`]: {
[`${itemCls}-wrapper`]: {
columnGap: token.margin
},
[`${itemCls}-empty-header`]: {
[`${itemCls}-header`]: {
minHeight: 'auto'
},
[`${itemCls}-content`]: {
marginTop: calc(varRef('heading-height')).sub(token.fontHeight).div(2).equal()
}
}
},
// Shared
[`${itemCls}-section`]: {
flex: 1,
minWidth: 0
},
[`${itemCls}-header`]: {
minHeight: varRef('heading-height')
},
[`${itemCls}-title`]: {
flex: '0 1 auto'
},
[`${itemCls}-content`]: {
maxWidth: descriptionMaxWidth
},
[`${itemCls}-subtitle`]: {
flex: '0 9999 auto'
},
[`&${componentCls}-horizontal ${itemCls}-rail`]: {
[varName('item-wrapper-padding-top')]: '0px',
flex: '1 1 0%',
marginInlineStart: varRef('title-horizontal-rail-margin')
}
},
// ===================== Vertical =====================
[`${componentCls}-title-vertical`]: {
[varName('title-vertical-row-gap')]: paddingSM,
[varName('title-horizontal-rail-gap')]: marginXXS,
[varName('heading-height')]: varRef('icon-size-max'),
[`> ${itemCls}`]: {
flex: '1 1 0%',
[`${itemCls}-wrapper`]: {
flexDirection: 'column',
rowGap: varRef('title-vertical-row-gap'),
alignItems: 'center'
},
// Section
[`${itemCls}-section`]: {
alignSelf: 'stretch'
},
// Header
[`${itemCls}-header`]: {
flexDirection: 'column',
alignItems: 'center'
},
// >>> title & subtitle & Content
[`${itemCls}-title, ${itemCls}-subtitle, ${itemCls}-content`]: {
textAlign: 'center',
maxWidth: '100%'
},
[`${itemCls}-subtitle`]: {
margin: 0
},
// >>> rail
[`${itemCls}-rail`]: {
position: 'absolute',
top: 0,
width: `calc(100% - ${varRef('icon-size')} - ${varRef('title-horizontal-rail-gap')} * 2)`,
insetInlineStart: `calc(50% + ${varRef('icon-size')} / 2 + ${varRef('title-horizontal-rail-gap')})`
}
},
// With descriptionMaxWidth
...getItemWithWidthStyle(token, marginXS, {
[`${itemCls}:last-child`]: {
flex: 'none'
},
// Icon
[`${itemCls}-icon`]: {
alignSelf: 'flex-start'
},
// Section
[`${itemCls}-section`]: {
width: descriptionMaxWidth
}
})
}
};
};
/* harmony default export */ var label_placement = (genLabelPlacementStyle);
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
;// ./components/steps/style/nav.ts
const genLegacyNavStyle = token => {
const {
componentCls,
fontSizeIcon,
navContentMaxWidth,
navArrowColor,
colorPrimary,
motionDurationSlow,
antCls,
calc
} = token;
const itemCls = `${componentCls}-item`;
const stepsNavActiveColor = colorPrimary;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'cmp-steps');
return {
[`${componentCls}${componentCls}-navigation`]: {
// ==========================================================
// == Shared ==
// ==========================================================
// ========================== Item ==========================
[itemCls.repeat(4)]: {
display: 'flex',
justifyContent: 'center',
position: 'relative',
flex: 1,
marginInlineStart: 0,
[`${itemCls}-wrapper`]: {
paddingBlock: token.paddingSM
},
// Section
[`${itemCls}-section`]: {
maxWidth: navContentMaxWidth
},
// Rail
[`${itemCls}-rail`]: {
display: 'none'
},
// ======================== Active ========================
'&:before': {
position: 'absolute',
display: 'block',
backgroundColor: stepsNavActiveColor,
transition: `all ${motionDurationSlow}`,
transitionTimingFunction: 'ease-out',
content: '""'
},
'&:not(:last-child):after': {
position: 'absolute',
display: 'block',
borderTop: `${(0,cssinjs.unit)(token.lineWidth)} ${token.lineType} ${navArrowColor}`,
borderBottom: 'none',
borderInlineStart: 'none',
borderInlineEnd: `${(0,cssinjs.unit)(token.lineWidth)} ${token.lineType} ${navArrowColor}`,
content: '""'
},
// Reset active item style to same as default
[`&${itemCls}-active`]: {
[varName('item-content-active-color')]: varRef('item-content-color'),
[varName('item-icon-active-bg-color')]: varRef('item-icon-bg-color'),
[varName('item-icon-active-border-color')]: varRef('item-icon-border-color'),
[varName('item-icon-active-text-color')]: varRef('item-icon-text-color')
}
},
// ==========================================================
// == Horizontal ==
// ==========================================================
[`&${componentCls}-horizontal`]: {
[itemCls]: {
'&:before': {
bottom: 0,
insetInlineStart: '50%',
width: 0,
height: token.lineWidthBold
},
[`&${itemCls}-active:before`]: {
insetInlineStart: 0,
width: '100%'
},
'&:not(:last-child):after': {
top: `50%`,
insetInlineStart: calc(fontSizeIcon).div(2).mul(-1).add('100%').equal(),
width: fontSizeIcon,
height: fontSizeIcon,
transform: 'translateY(-50%) rotate(45deg)'
}
}
},
// ==========================================================
// == Vertical ==
// ==========================================================
[`&${componentCls}-vertical`]: {
[itemCls.repeat(4)]: {
[`${itemCls}-content`]: {
padding: 0
},
'&:before': {
insetInlineEnd: 0,
top: '50%',
width: token.lineWidthBold,
height: 0
},
[`&${itemCls}-active::before`]: {
top: 0,
height: '100%'
},
'&:not(:last-child):after': {
left: {
_skip_check_: true,
value: '50%'
},
top: '100%',
width: calc(fontSizeIcon).div(3).mul(2).equal(),
height: calc(fontSizeIcon).div(3).mul(2).equal(),
transform: 'translateY(-50%) translateX(-50%) rotate(135deg)'
}
}
}
// ========================= Legacy =========================
}
};
};
/* harmony default export */ var nav = (genLegacyNavStyle);
;// ./components/steps/style/panel.ts
const genPanelStyle = token => {
const {
componentCls,
lineWidthBold,
borderRadius,
borderRadiusSM,
motionDurationMid,
paddingXS,
lineType,
paddingSM,
antCls,
calc
} = token;
const itemCls = `${componentCls}-item`;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'cmp-steps');
const borderStyle = `${(0,cssinjs.unit)(lineWidthBold)} ${lineType} ${varRef('panel-border-color')}`;
return {
[`${componentCls}${componentCls}-panel`]: [
// ==========================================================
// == Clean up ==
// ==========================================================
{
// ====================== Shared ======================
[`${itemCls}-rail`]: {
display: 'none'
},
// ==================== Horizontal ====================
[`&${componentCls}-horizontal`]: {
alignItems: 'stretch',
[itemCls]: {
flex: 1,
margin: 0
}
}
},
// ==========================================================
// == Template ==
// ==========================================================
{
'&': {
[varName('panel-padding')]: paddingSM,
[varName('item-border-radius')]: borderRadius,
[itemCls]: {
// Panel background
[varName('panel-bg-color')]: varRef('item-icon-bg-color'),
[varName('panel-border-color')]: varRef('item-icon-border-color'),
[varName('panel-active-bg-color')]: varRef('item-icon-active-bg-color'),
[varName('panel-active-border-color')]: varRef('item-icon-active-border-color'),
[varName('panel-title-height')]: `calc(${varRef('title-font-size')} * ${varRef('title-line-height')})`,
// Base height = padding * 2 + iconSize + contentHeight
[varName('item-base-height')]: calc(varRef('panel-padding')).mul(2).add(varRef('icon-size')).add(varRef('panel-title-height')).equal(),
[varName('item-base-width')]: `calc(${varRef('item-base-height')} * 0.7071)`,
transition: `background-color ${motionDurationMid}`
}
},
// ======================= Icon =======================
[`${itemCls}-icon`]: {
display: 'none'
},
// ====================== Header ======================
[`${itemCls}-header`]: {
minHeight: 'auto'
},
// ====================== Arrow =======================
[`${componentCls}-panel-arrow`]: {
position: 'absolute',
top: calc(lineWidthBold).mul(-1).equal(),
insetInlineStart: '100%',
zIndex: 1,
height: calc(lineWidthBold).mul(2).add('100%').equal(),
width: varRef('item-base-width'),
overflow: 'visible',
strokeLinecap: 'round',
path: {
fill: varRef('panel-bg-color'),
stroke: varRef('panel-border-color'),
strokeWidth: lineWidthBold,
vectorEffect: 'non-scaling-stroke',
transition: `fill ${motionDurationMid}`
}
},
[`${itemCls}:last-child ${componentCls}-panel-arrow`]: {
display: 'none'
},
// ======================= Item =======================
[itemCls]: {
padding: varRef('panel-padding'),
background: varRef('panel-bg-color'),
position: 'relative',
borderBlock: borderStyle,
'&:not(:first-child)': {
paddingInlineStart: `calc(${varRef('panel-padding')} + ${varRef('item-base-width')})`
},
'&:first-child': {
borderInlineStart: borderStyle,
borderStartStartRadius: varRef('item-border-radius'),
borderEndStartRadius: varRef('item-border-radius')
},
'&:last-child': {
borderInlineEnd: borderStyle,
borderStartEndRadius: varRef('item-border-radius'),
borderEndEndRadius: varRef('item-border-radius')
},
'&-active': {
background: varRef('panel-active-bg-color'),
borderColor: varRef('panel-active-border-color'),
[`${componentCls}-panel-arrow`]: {
path: {
fill: varRef('panel-active-bg-color'),
stroke: varRef('panel-active-border-color')
}
},
[`${itemCls}-title, ${itemCls}-subtitle, ${itemCls}-content`]: {
color: varRef('item-icon-active-text-color')
}
}
}
},
// ==========================================================
// == Size ==
// ==========================================================
{
[`&${componentCls}-small`]: {
[varName('panel-padding')]: paddingXS,
[varName('item-border-radius')]: borderRadiusSM
}
},
// ==========================================================
// == Filled ==
// ==========================================================
{
[`&${componentCls}-filled`]: {
[itemCls]: {
'&:not(:first-child)': {
clipPath: `polygon(${[`${(0,cssinjs.unit)(lineWidthBold)} 0`, `calc(100% + ${varRef('item-base-width')}) 0`, `calc(100% + ${varRef('item-base-width')}) 100%`, `${(0,cssinjs.unit)(lineWidthBold)} 100%`, `calc(${varRef('item-base-width')} + ${(0,cssinjs.unit)(lineWidthBold)}) 50%`].join(',')})`
}
}
}
},
// ==========================================================
// == Outlined ==
// ==========================================================
{
[`&${componentCls}-outlined`]: {
[`${componentCls}-panel-arrow`]: {
top: calc(lineWidthBold).div(2).mul(-1).equal(),
height: calc(lineWidthBold).add('100%').equal()
}
}
}]
};
};
/* harmony default export */ var panel = (genPanelStyle);
;// ./components/steps/style/progress.ts
const genStepsProgressStyle = token => {
const {
calc,
antCls,
componentCls,
lineWidthBold,
motionDurationSlow
} = token;
const itemCls = `${componentCls}-item`;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'cmp-steps');
const enhanceSize = calc(lineWidthBold).add(lineWidthBold).equal();
return {
[`${componentCls}${componentCls}-with-progress`]: {
[varName('item-wrapper-padding-top')]: enhanceSize,
[`${itemCls}${itemCls}-process`]: {
[`${itemCls}-icon`]: {
position: 'relative'
}
},
[`${itemCls}-progress-icon`]: {
'&-svg': {
[varName('svg-size')]: calc(enhanceSize).mul(2).add(varRef('icon-size')).equal(),
[varName('icon-size-ptg-unitless')]: `calc(100 / tan(atan2(${varRef('svg-size')}, 1px)))`,
fontSize: varRef('svg-size'),
lineHeight: varRef('icon-size-ptg-unitless'),
position: 'absolute',
inset: calc(enhanceSize).mul(-1).equal(),
width: 'auto',
height: 'auto'
},
'&-circle': {
lineHeight: varRef('icon-size-ptg-unitless'),
strokeWidth: calc(varRef('icon-size-ptg-unitless')).mul(lineWidthBold).equal(),
[varName('progress-radius')]: calc(varRef('svg-size')).sub(lineWidthBold).mul(varRef('icon-size-ptg-unitless')).div(2).equal(),
r: varRef('progress-radius'),
fill: 'none',
cx: 50,
cy: 50,
transition: `all ${motionDurationSlow} ease-in-out`,
'&-rail': {
stroke: token.colorSplit
},
'&-ptg': {
stroke: token.colorPrimary
}
}
}
}
};
};
/* harmony default export */ var progress = (genStepsProgressStyle);
;// ./components/steps/style/progress-dot.ts
const genDotStyle = token => {
const {
componentCls,
iconSize,
dotSize,
dotCurrentSize,
marginXXS,
lineWidthBold,
fontSizeSM,
antCls
} = token;
const itemCls = `${componentCls}-item`;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'cmp-steps');
return {
[`${componentCls}${componentCls}-dot`]: {
[varName('icon-size-active')]: dotCurrentSize,
[varName('icon-size')]: dotSize,
[varName('dot-icon-size')]: dotSize,
[varName('dot-icon-border-width')]: lineWidthBold,
[varName('rail-size')]: lineWidthBold,
[varName('icon-border-width')]: lineWidthBold,
// ========================= Shared ==========================
// Icon
[`${itemCls}-custom ${itemCls}-icon`]: {
fontSize: fontSizeSM
},
[`${itemCls}-icon`]: {
position: 'relative',
'&:after': {
content: '""',
width: iconSize,
height: iconSize,
display: 'block',
position: 'absolute',
top: '50%',
left: {
_skip_check_: true,
value: '50%'
},
transform: 'translate(-50%, -50%)'
}
},
// // >>> active
[`${itemCls}-active ${itemCls}-icon`]: {
[varName('icon-size')]: varRef('icon-size-active')
},
// ======================= Horizontal ========================
[`&${componentCls}-horizontal`]: {
// With descriptionMaxWidth
[`&, &${componentCls}-small`]: getItemWithWidthStyle(token, marginXXS)
}
}
};
};
/* harmony default export */ var progress_dot = (genDotStyle);
;// ./components/steps/style/rtl.ts
const genRTLStyle = token => {
const {
componentCls,
lineWidthBold,
antCls
} = token;
const itemCls = `${componentCls}-item`;
const [, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'cmp-steps');
return {
[`${componentCls}${componentCls}-rtl`]: {
direction: 'rtl',
// nav
[`&${componentCls}-navigation${componentCls}-horizontal`]: {
[`${itemCls}:after`]: {
transform: 'translateY(-50%) rotate(-45deg)'
}
},
// panel
[`&${componentCls}-panel`]: {
[`${componentCls}-panel-arrow`]: {
transform: `scaleX(-1)`
},
[`&${componentCls}-filled`]: {
[itemCls]: {
'&:not(:first-child)': {
clipPath: `polygon(${[`calc(0px - ${varRef('item-base-width')}) 0px`, `calc(100% - ${(0,cssinjs.unit)(lineWidthBold)}) 0px`, `calc(100% - ${varRef('item-base-width')} - ${(0,cssinjs.unit)(lineWidthBold)}) 50%`, `calc(100% - ${(0,cssinjs.unit)(lineWidthBold)}) 100%`, `calc(0px - ${varRef('item-base-width')}) 100%`].join(',')})`
}
}
}
}
}
};
};
/* harmony default export */ var rtl = (genRTLStyle);
;// ./components/steps/style/small.ts
const genSmallStyle = token => {
const {
componentCls,
iconSizeSM,
fontSize,
lineHeight,
marginXS,
fontHeight,
marginSM,
paddingXS,
antCls
} = token;
const [varName] = (0,genStyleUtils.genCssVar)(antCls, 'cmp-steps');
return {
[`${componentCls}${componentCls}-small`]: {
[varName('icon-size')]: iconSizeSM,
[varName('title-horizontal-item-margin')]: marginSM,
[varName('title-vertical-row-gap')]: paddingXS,
[varName('title-font-size')]: fontSize,
[varName('title-line-height')]: lineHeight,
[varName('title-horizontal-rail-margin')]: marginXS,
[varName('title-horizontal-title-height')]: fontHeight,
// Horizontal: label vertical
[`&${componentCls}-horizontal${componentCls}-title-vertical`]: getItemWithWidthStyle(token, marginXS)
}
};
};
/* harmony default export */ var small = (genSmallStyle);
;// ./components/steps/style/status.ts
const STATUS_WAIT = 'wait';
const STATUS_PROCESS = 'process';
const STATUS_FINISH = 'finish';
const STATUS_ERROR = 'error';
const genStatusStyle = token => {
const {
componentCls,
colorTextDisabled,
colorTextLightSolid,
colorPrimary,
colorTextLabel,
colorError,
colorErrorHover,
colorErrorBgFilledHover,
colorFillTertiary,
colorErrorBg,
colorPrimaryBgHover,
colorPrimaryBg,
colorText,
colorTextDescription,
colorBgContainer,
colorPrimaryHover,
lineType,
antCls
} = token;
const itemCls = `${componentCls}-item`;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'cmp-steps');
return {
[componentCls]: [{
// ========================= Variable =========================
[itemCls]: {
// Normal
// >>> line
[varName('item-solid-line-color')]: '#000',
// >>> text
[varName('item-title-color')]: '#000',
[varName('item-content-color')]: '#000',
[varName('item-subtitle-color')]: varRef('item-content-color'),
// >>> icon
[varName('item-icon-custom-color')]: '#000',
[varName('item-icon-bg-color')]: '#000',
[varName('item-icon-border-color')]: '#000',
[varName('item-icon-text-color')]: '#fff',
// >>> dot
[varName('item-icon-dot-color')]: '#000',
[varName('item-icon-dot-bg-color')]: varRef('item-icon-dot-color'),
[varName('item-icon-dot-border-color')]: varRef('item-icon-dot-color'),
// Hover
// >>> text
[varName('item-text-hover-color')]: '#000',
// >>> icon
[varName('item-icon-bg-hover-color')]: varRef('item-icon-bg-color'),
[varName('item-icon-border-hover-color')]: varRef('item-icon-border-color'),
[varName('item-icon-text-hover-color')]: varRef('item-icon-text-color'),
// Active
// >>> text
[varName('item-content-active-color')]: varRef('item-content-color'),
// >>> icon
[varName('item-icon-active-bg-color')]: varRef('item-icon-bg-color'),
[varName('item-icon-active-border-color')]: varRef('item-icon-border-color'),
[varName('item-icon-active-text-color')]: varRef('item-icon-text-color'),
// Status
[varName('item-process-rail-line-style')]: lineType
},
// ========================= Template =========================
// Normal
// >>> line
[`${itemCls}-rail`]: {
borderColor: varRef('item-solid-line-color')
},
// >>> icon
[`${itemCls}-custom ${itemCls}-icon`]: {
color: varRef('item-icon-custom-color')
},
// >>> text
[`${itemCls}-title`]: {
color: varRef('item-title-color')
},
[`${itemCls}-subtitle`]: {
color: varRef('item-subtitle-color')
},
[`${itemCls}-content`]: {
color: varRef('item-content-color')
},
// Active
// >>> icon
[`${itemCls}-active ${itemCls}-icon`]: {
//
},
// >>> text
[`${itemCls}-active ${itemCls}-content`]: {
color: varRef('item-content-active-color')
},
// Hover
// >>> text
[`${itemCls}[role='button']:not(${itemCls}-active):hover`]: {
[`${itemCls}-title, ${itemCls}-content`]: {
color: varRef('item-text-hover-color')
}
},
// Not dot
[`&:not(${componentCls}-dot)`]: {
[`${itemCls}:not(${itemCls}-custom)`]: {
[`${itemCls}-icon`]: {
background: varRef('item-icon-bg-color'),
borderColor: varRef('item-icon-border-color'),
color: varRef('item-icon-text-color')
},
// Hover
[`&[role='button']:not(${itemCls}-active):hover`]: {
[`${itemCls}-icon`]: {
background: varRef('item-icon-bg-hover-color'),
borderColor: varRef('item-icon-border-hover-color'),
color: varRef('item-icon-text-hover-color')
}
},
// Active
[`&${itemCls}-active`]: {
[`${itemCls}-icon`]: {
background: varRef('item-icon-active-bg-color'),
borderColor: varRef('item-icon-active-border-color'),
color: varRef('item-icon-active-text-color')
}
}
}
},
// Dot
[`&${componentCls}-dot`]: {
[`${itemCls}-icon`]: {
background: varRef('item-icon-dot-bg-color'),
borderColor: varRef('item-icon-dot-border-color'),
color: varRef('item-icon-dot-color'),
[`&${itemCls}-icon-dot-custom`]: {
background: 'transparent',
border: 'none'
}
}
}
}, {
// ========================== Shared ==========================
// Wait
[`${itemCls}-${STATUS_WAIT}`]: {
[varName('item-icon-custom-color')]: colorTextDisabled,
[varName('item-title-color')]: colorTextDescription,
[varName('item-content-color')]: colorTextDescription,
[varName('item-content-active-color')]: colorText,
[varName('item-text-hover-color')]: colorPrimaryHover
},
[`${itemCls}-rail-${STATUS_WAIT}`]: {
[varName('item-solid-line-color')]: colorTextDisabled
},
// Process
[`${itemCls}-${STATUS_PROCESS}`]: {
[varName('item-icon-custom-color')]: colorPrimary,
[varName('item-title-color')]: colorText,
[varName('item-content-color')]: colorTextDescription,
[varName('item-content-active-color')]: colorText,
[varName('item-text-hover-color')]: colorPrimaryHover
},
[`${itemCls}-rail-${STATUS_PROCESS}`]: {
[varName('item-solid-line-color')]: colorPrimary,
// Special for Timeline usage
[varName('rail-line-style')]: varRef('item-process-rail-line-style')
},
// Finish
[`${itemCls}-${STATUS_FINISH}`]: {
[varName('item-icon-custom-color')]: colorPrimary,
[varName('item-title-color')]: colorText,
[varName('item-content-color')]: colorTextDescription,
[varName('item-content-active-color')]: colorText,
[varName('item-text-hover-color')]: colorPrimaryHover
},
[`${itemCls}-rail-${STATUS_FINISH}`]: {
[varName('item-solid-line-color')]: colorPrimary
},
// Error
[`${itemCls}-${STATUS_ERROR}`]: {
[varName('item-icon-custom-color')]: colorError,
[varName('item-title-color')]: colorError,
[varName('item-content-color')]: colorError,
[varName('item-content-active-color')]: colorError,
[varName('item-text-hover-color')]: colorErrorHover
},
[`${itemCls}-rail-${STATUS_ERROR}`]: {
[varName('item-solid-line-color')]: colorError
}
}, {
// ========================== Filled ==========================
[`&${componentCls}-filled`]: {
[itemCls]: {
[varName('item-icon-dot-border-color')]: 'transparent'
},
// Wait
[`${itemCls}-${STATUS_WAIT}`]: {
[varName('item-icon-bg-color')]: colorFillTertiary,
[varName('item-icon-border-color')]: 'transparent',
[varName('item-icon-text-color')]: colorTextLabel,
[varName('item-icon-dot-bg-color')]: colorTextDisabled,
// Hover
[varName('item-icon-bg-hover-color')]: colorPrimaryBgHover,
[varName('item-icon-border-hover-color')]: 'transparent',
[varName('item-icon-text-hover-color')]: colorPrimary,
// Active
[varName('item-icon-active-bg-color')]: colorPrimary,
[varName('item-icon-active-border-color')]: 'transparent',
[varName('item-icon-active-text-color')]: colorTextLightSolid
},
// Finish & Process
[`${itemCls}-${STATUS_PROCESS}, ${itemCls}-${STATUS_FINISH}`]: {
[varName('item-icon-bg-color')]: colorPrimaryBg,
[varName('item-icon-border-color')]: 'transparent',
[varName('item-icon-text-color')]: colorPrimary,
[varName('item-icon-dot-bg-color')]: colorPrimary,
// Hover
[varName('item-icon-bg-hover-color')]: colorPrimaryBgHover,
[varName('item-icon-border-hover-color')]: 'transparent',
[varName('item-icon-text-hover-color')]: colorPrimary,
// Active
[varName('item-icon-active-bg-color')]: colorPrimary,
[varName('item-icon-active-border-color')]: 'transparent',
[varName('item-icon-active-text-color')]: colorTextLightSolid
},
// Error
[`${itemCls}-${STATUS_ERROR}`]: {
[varName('item-icon-bg-color')]: colorErrorBg,
[varName('item-icon-border-color')]: 'transparent',
[varName('item-icon-text-color')]: colorError,
[varName('item-icon-dot-bg-color')]: colorError,
// Hover
[varName('item-icon-bg-hover-color')]: colorErrorBgFilledHover,
[varName('item-icon-border-hover-color')]: 'transparent',
[varName('item-icon-text-hover-color')]: colorError,
// Active
[varName('item-icon-active-bg-color')]: colorError,
[varName('item-icon-active-border-color')]: 'transparent',
[varName('item-icon-active-text-color')]: colorTextLightSolid
}
}
}, {
// ========================= Outlined =========================
[`&${componentCls}-outlined`]: {
[itemCls]: {
[varName('item-icon-dot-bg-color')]: 'transparent'
},
// Wait
[`${itemCls}-${STATUS_WAIT}`]: {
[varName('item-icon-bg-color')]: colorBgContainer,
[varName('item-icon-border-color')]: colorTextDisabled,
[varName('item-icon-text-color')]: colorTextDisabled,
[varName('item-icon-dot-color')]: colorTextDisabled,
// Hover
[varName('item-icon-bg-hover-color')]: 'transparent',
[varName('item-icon-border-hover-color')]: colorPrimaryHover,
[varName('item-icon-text-hover-color')]: colorPrimaryHover,
// Active
[varName('item-icon-active-bg-color')]: colorFillTertiary
},
// Finish & Process
[`${itemCls}-${STATUS_PROCESS}, ${itemCls}-${STATUS_FINISH}`]: {
[varName('item-icon-bg-color')]: colorBgContainer,
[varName('item-icon-border-color')]: colorPrimary,
[varName('item-icon-text-color')]: colorPrimary,
[varName('item-icon-dot-color')]: colorPrimary,
// Hover
[varName('item-icon-bg-hover-color')]: 'transparent',
[varName('item-icon-border-hover-color')]: colorPrimaryHover,
[varName('item-icon-text-hover-color')]: colorPrimaryHover,
// Active
[varName('item-icon-active-bg-color')]: colorPrimaryBg
},
// Error
[`${itemCls}-${STATUS_ERROR}`]: {
[varName('item-icon-bg-color')]: colorBgContainer,
[varName('item-icon-border-color')]: colorError,
[varName('item-icon-text-color')]: colorError,
[varName('item-icon-dot-color')]: colorError,
// Hover
[varName('item-icon-bg-hover-color')]: 'transparent',
[varName('item-icon-border-hover-color')]: colorErrorHover,
[varName('item-icon-text-hover-color')]: colorErrorHover,
// Active
[varName('item-icon-active-bg-color')]: colorErrorBg
}
}
}]
};
};
/* harmony default export */ var style_status = (genStatusStyle);
;// ./components/steps/style/vertical.ts
const genVerticalStyle = token => {
const {
componentCls,
marginXXS,
paddingSM,
controlHeight,
antCls,
calc
} = token;
const itemCls = `${componentCls}-item`;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'cmp-steps');
return {
[`${componentCls}-vertical`]: {
[varName('vertical-rail-margin')]: calc(marginXXS).mul(1.5).equal(),
flexDirection: 'column',
alignItems: 'stretch',
// Item
[`> ${itemCls}`]: {
minHeight: calc(controlHeight).mul(1.5).equal(),
paddingBottom: paddingSM,
'&:last-child': {
paddingBottom: 0
},
// Icon
[`${itemCls}-icon`]: {
marginInlineStart: `calc((${varRef('icon-size-max')} - ${varRef('icon-size')}) / 2)`
},
// >>> Rail
[`${itemCls}-rail`]: {
[varName('rail-offset')]: calc(varRef('heading-height')).sub(varRef('icon-size')).div(2).equal(),
borderInlineStartWidth: varRef('rail-size'),
position: 'absolute',
top: calc(varRef('icon-size')).add(varRef('item-wrapper-padding-top')).add(varRef('rail-offset')).add(varRef('vertical-rail-margin')).equal(),
insetInlineStart: calc(varRef('icon-size-max')).div(2).equal(),
bottom: calc(varRef('vertical-rail-margin')).sub(varRef('rail-offset')).equal(),
marginInlineStart: `calc(${varRef('rail-size')} / -2)`
}
}
}
};
};
/* harmony default export */ var vertical = (genVerticalStyle);
;// ./components/steps/style/index.ts
const genBasicStyle = token => {
const {
componentCls,
antCls
} = token;
const itemCls = `${componentCls}-item`;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'cmp-steps');
return {
[componentCls]: {
[varName('title-font-size')]: token.fontSizeLG,
[varName('title-line-height')]: token.lineHeightLG,
[varName('subtitle-font-size')]: token.fontSize,
[varName('subtitle-line-height')]: token.lineHeight,
[varName('item-wrapper-padding-top')]: '0px',
[varName('rail-size')]: token.lineWidth,
[varName('rail-line-style')]: token.lineType,
...(0,style.resetComponent)(token),
display: 'flex',
flexWrap: 'nowrap',
alignItems: 'flex-start',
[itemCls]: {
flex: 'none',
position: 'relative'
},
[`${itemCls}-wrapper`]: {
display: 'flex',
flexWrap: 'nowrap',
paddingTop: varRef('item-wrapper-padding-top')
},
// Icon
// Check `./icon.ts`
// Header
[`${itemCls}-header`]: {
display: 'flex',
flexWrap: 'nowrap',
alignItems: 'center'
},
// >>> Title
[`${itemCls}-title`]: {
color: token.colorText,
fontSize: varRef('title-font-size'),
lineHeight: varRef('title-line-height'),
wordBreak: 'break-word'
},
// >>> Sub Title
[`${itemCls}-subtitle`]: {
color: token.colorTextDescription,
fontWeight: 'normal',
fontSize: varRef('subtitle-font-size'),
lineHeight: varRef('subtitle-line-height'),
marginInlineStart: token.marginXS,
wordBreak: 'break-word'
},
// Content
[`${itemCls}-content`]: {
color: token.colorTextDescription,
fontSize: token.fontSize,
lineHeight: token.lineHeight,
wordBreak: 'break-word'
},
// Rail
[`${itemCls}-rail`]: {
borderStyle: varRef('rail-line-style'),
borderWidth: 0
},
// Motion
[`${itemCls}-title, ${itemCls}-subtitle, ${itemCls}-content, ${itemCls}-rail`]: {
transition: `all ${token.motionDurationSlow}`
},
// ========================== Ellipsis ==========================
[`&${componentCls}-ellipsis`]: {
[`${itemCls}-title, ${itemCls}-subtitle, ${itemCls}-content`]: style.textEllipsis
},
// ========================= Clickable ==========================
[`${itemCls}[role='button']:not(${itemCls}-active):hover`]: {
cursor: 'pointer'
}
}
};
};
// ============================== Export ==============================
const prepareComponentToken = token => ({
titleLineHeight: token.controlHeight,
customIconSize: token.controlHeight,
customIconTop: 0,
customIconFontSize: token.controlHeightSM,
iconSize: token.controlHeight,
iconTop: -0.5,
// magic for ui experience
iconFontSize: token.fontSize,
iconSizeSM: token.fontSizeHeading3,
dotSize: token.controlHeight / 4,
dotCurrentSize: token.controlHeightLG / 4,
navArrowColor: token.colorTextDisabled,
navContentMaxWidth: 'unset',
descriptionMaxWidth: undefined,
// should be `undefined` to create css var
waitIconColor: token.wireframe ? token.colorTextDisabled : token.colorTextLabel,
waitIconBgColor: token.wireframe ? token.colorBgContainer : token.colorFillContent,
waitIconBorderColor: token.wireframe ? token.colorTextDisabled : 'transparent',
finishIconBgColor: token.wireframe ? token.colorBgContainer : token.controlItemBgActive,
finishIconBorderColor: token.wireframe ? token.colorPrimary : token.controlItemBgActive
});
/* harmony default export */ var steps_style = ((0,genStyleUtils.genStyleHooks)('Steps', token => {
const stepsToken = (0,es.mergeToken)(token, {
inlineDotSize: 6
});
return [genBasicStyle(stepsToken), icon(stepsToken), vertical(stepsToken), horizontal(stepsToken), label_placement(stepsToken), small(stepsToken), progress_dot(stepsToken), style_status(stepsToken), nav(stepsToken), panel(stepsToken), inline(stepsToken), progress(stepsToken), rtl(stepsToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/style/compact-item.ts":
/*!******************************************!*\
!*** ./components/style/compact-item.ts ***!
\******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ genCompactItemStyle: function() { return /* binding */ genCompactItemStyle; }
/* harmony export */ });
// handle border collapse
function compactItemBorder(token, parentCls, options, prefixCls) {
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.calc(token.lineWidth).mul(-1).equal()
},
[`&-item:not(${prefixCls}-status-success)`]: {
zIndex: 2
},
'&-item': {
[hoverEffects]: {
zIndex: 3
},
...(focusElCls ? {
[`&${focusElCls}`]: {
zIndex: 3
}
} : {}),
[`&[disabled] ${childCombinator}`]: {
zIndex: 0
}
}
};
}
// handle border-radius
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, options = {
focus: true
}) {
const {
componentCls
} = token;
const {
componentCls: customizePrefixCls
} = options;
const mergedComponentCls = customizePrefixCls || componentCls;
const compactCls = `${mergedComponentCls}-compact`;
return {
[compactCls]: {
...compactItemBorder(token, compactCls, options, mergedComponentCls),
...compactItemBorderRadius(mergedComponentCls, compactCls, options)
}
};
}
/***/ }),
/***/ "./components/style/index.tsx":
/*!************************************!*\
!*** ./components/style/index.tsx ***!
\************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ clearFix: function() { return /* binding */ clearFix; },
/* harmony export */ genCommonStyle: function() { return /* binding */ genCommonStyle; },
/* harmony export */ genFocusOutline: function() { return /* binding */ genFocusOutline; },
/* harmony export */ genFocusStyle: function() { return /* binding */ genFocusStyle; },
/* harmony export */ genIconStyle: function() { return /* binding */ genIconStyle; },
/* harmony export */ genLinkStyle: function() { return /* binding */ genLinkStyle; },
/* harmony export */ operationUnit: function() { return /* binding */ operationUnit; },
/* harmony export */ resetComponent: function() { return /* binding */ resetComponent; },
/* harmony export */ resetIcon: function() { return /* binding */ resetIcon; },
/* harmony export */ textEllipsis: function() { return /* binding */ textEllipsis; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
const textEllipsis = {
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis'
};
const resetComponent = (token, needInheritFontFamily = false) => ({
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: needInheritFontFamily ? 'inherit' : 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 genFocusOutline = (token, offset) => ({
outline: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidthFocus)} solid ${token.colorPrimaryBorder}`,
outlineOffset: offset ?? 1,
transition: [`outline-offset`, `outline`].map(prop => `${prop} 0s`).join(', ')
});
const genFocusStyle = (token, offset) => ({
'&:focus-visible': genFocusOutline(token, offset)
});
const genLinkStyle = token => ({
a: {
color: token.colorLink,
textDecoration: token.linkDecoration,
backgroundColor: 'transparent',
// remove the gray background on active links in IE 10.
outline: 'none',
cursor: 'pointer',
transition: `color ${token.motionDurationSlow}`,
'-webkit-text-decoration-skip': 'objects',
// remove gaps in links underline in iOS 8+ and Safari 8+.
'&: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
},
...genFocusStyle(token),
'&[disabled]': {
color: token.colorTextDisabled,
cursor: 'not-allowed'
}
}
});
const genCommonStyle = (token, componentPrefixCls, rootCls, resetFont) => {
const prefixSelector = `[class^="${componentPrefixCls}"], [class*=" ${componentPrefixCls}"]`;
const rootPrefixSelector = rootCls ? `.${rootCls}` : prefixSelector;
const resetStyle = {
boxSizing: 'border-box',
'&::before, &::after': {
boxSizing: 'border-box'
}
};
let resetFontStyle = {};
if (resetFont !== false) {
resetFontStyle = {
fontFamily: token.fontFamily,
fontSize: token.fontSize
};
}
return {
[rootPrefixSelector]: {
...resetFontStyle,
...resetStyle,
[prefixSelector]: resetStyle
}
};
};
const genIconStyle = iconPrefixCls => ({
[`.${iconPrefixCls}`]: {
...resetIcon(),
[`.${iconPrefixCls} .${iconPrefixCls}-icon`]: {
display: 'block'
}
}
});
const operationUnit = token => ({
// FIXME: This use link but is a operation unit. Seems should be a colorPrimary.
// And Typography use this to generate link style which should not do this.
color: token.colorLink,
textDecoration: token.linkDecoration,
outline: 'none',
cursor: 'pointer',
transition: `all ${token.motionDurationSlow}`,
border: 0,
padding: 0,
background: 'none',
userSelect: 'none',
...genFocusStyle(token),
'&:hover': {
color: token.colorLinkHover,
textDecoration: token.linkHoverDecoration
},
'&:focus': {
color: token.colorLinkHover,
textDecoration: token.linkFocusDecoration
},
'&:active': {
color: token.colorLinkActive,
textDecoration: token.linkHoverDecoration
}
});
/***/ }),
/***/ "./components/style/motion/collapse.ts":
/*!*********************************************!*\
!*** ./components/style/motion/collapse.ts ***!
\*********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__) {
"use strict";
const genCollapseMotion = token => {
const {
componentCls,
antCls,
motionDurationMid,
motionEaseInOut
} = token;
return {
[componentCls]: {
// For common/openAnimation
[`${antCls}-motion-collapse-legacy`]: {
overflow: 'hidden',
'&-active': {
transition: `${['height', 'opacity'].map(prop => `${prop} ${motionDurationMid} ${motionEaseInOut}`).join(', ')} !important`
}
},
[`${antCls}-motion-collapse`]: {
overflow: 'hidden',
transition: `${['height', 'opacity'].map(prop => `${prop} ${motionDurationMid} ${motionEaseInOut}`).join(', ')} !important`
}
}
};
};
/* harmony default export */ __webpack_exports__["default"] = (genCollapseMotion);
/***/ }),
/***/ "./components/style/motion/fade.ts":
/*!*****************************************!*\
!*** ./components/style/motion/fade.ts ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ initFadeMotion: function() { return /* binding */ initFadeMotion; }
/* harmony export */ });
/* unused harmony exports fadeIn, fadeOut */
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _motion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./motion */ "./components/style/motion/motion.ts");
const fadeIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antFadeIn', {
'0%': {
opacity: 0
},
'100%': {
opacity: 1
}
});
const fadeOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antFadeOut', {
'0%': {
opacity: 1
},
'100%': {
opacity: 0
}
});
/**
* Initialize fade motion styles
*
* Generates CSS styles for fade in/out transition animations when elements are shown/hidden.
* Supports enter, appear, and leave animation states.
*
* @param token - Object containing design tokens and CSS class prefix
* @param sameLevel - Controls CSS selector nesting behavior:
* - `false` (default): Generates descendant selectors like `.ant-fade-enter`, `.ant-fade-appear`
* - `true`: Generates same-level selectors with `&` prefix like `&.ant-fade-enter`, `&.ant-fade-appear`
* Use `true` when the motion classes are applied to the same element as the parent selector,
* Use `false` when the motion classes are applied to child elements
* @returns CSS interpolation object containing fade motion styles
*
* @example
* ```ts
* // For child elements (default behavior)
* const fadeStyles = initFadeMotion(token);
* // Generates: .parent .ant-fade-enter { ... }
*
* // For same element
* const sameLevelFadeStyles = initFadeMotion(token, true);
* // Generates: .parent.ant-fade-enter { ... }
* ```
*/
const initFadeMotion = (token, sameLevel = false) => {
const {
antCls
} = token;
const motionCls = `${antCls}-fade`;
const sameLevelPrefix = sameLevel ? '&' : '';
return [(0,_motion__WEBPACK_IMPORTED_MODULE_1__.initMotion)(motionCls, fadeIn, fadeOut, token.motionDurationMid, sameLevel), {
[`
${sameLevelPrefix}${motionCls}-enter,
${sameLevelPrefix}${motionCls}-appear
`]: {
opacity: 0,
animationTimingFunction: 'linear'
},
[`${sameLevelPrefix}${motionCls}-leave`]: {
animationTimingFunction: 'linear'
}
}];
};
/***/ }),
/***/ "./components/style/motion/motion.ts":
/*!*******************************************!*\
!*** ./components/style/motion/motion.ts ***!
\*******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ initMotion: function() { return /* binding */ initMotion; }
/* harmony export */ });
const initMotionCommon = duration => ({
animationDuration: duration,
animationFillMode: 'both'
});
const initMotion = (motionCls, inKeyframes, outKeyframes, duration, sameLevel = false) => {
const sameLevelPrefix = sameLevel ? '&' : '';
return {
[`
${sameLevelPrefix}${motionCls}-enter,
${sameLevelPrefix}${motionCls}-appear
`]: {
...initMotionCommon(duration),
animationPlayState: 'paused'
},
[`${sameLevelPrefix}${motionCls}-leave`]: {
...initMotionCommon(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'
}
};
};
/***/ }),
/***/ "./components/style/motion/move.ts":
/*!*****************************************!*\
!*** ./components/style/motion/move.ts ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ initMoveMotion: function() { return /* binding */ initMoveMotion; }
/* harmony export */ });
/* unused harmony exports moveDownIn, moveDownOut, moveLeftIn, moveLeftOut, moveRightIn, moveRightOut, moveUpIn, moveUpOut */
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _motion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./motion */ "./components/style/motion/motion.ts");
const moveDownIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antMoveDownIn', {
'0%': {
transform: 'translate3d(0, 100%, 0)',
transformOrigin: '0 0',
opacity: 0
},
'100%': {
transform: 'translate3d(0, 0, 0)',
transformOrigin: '0 0',
opacity: 1
}
});
const moveDownOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antMoveDownOut', {
'0%': {
transform: 'translate3d(0, 0, 0)',
transformOrigin: '0 0',
opacity: 1
},
'100%': {
transform: 'translate3d(0, 100%, 0)',
transformOrigin: '0 0',
opacity: 0
}
});
const moveLeftIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antMoveLeftIn', {
'0%': {
transform: 'translate3d(-100%, 0, 0)',
transformOrigin: '0 0',
opacity: 0
},
'100%': {
transform: 'translate3d(0, 0, 0)',
transformOrigin: '0 0',
opacity: 1
}
});
const moveLeftOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antMoveLeftOut', {
'0%': {
transform: 'translate3d(0, 0, 0)',
transformOrigin: '0 0',
opacity: 1
},
'100%': {
transform: 'translate3d(-100%, 0, 0)',
transformOrigin: '0 0',
opacity: 0
}
});
const moveRightIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antMoveRightIn', {
'0%': {
transform: 'translate3d(100%, 0, 0)',
transformOrigin: '0 0',
opacity: 0
},
'100%': {
transform: 'translate3d(0, 0, 0)',
transformOrigin: '0 0',
opacity: 1
}
});
const moveRightOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antMoveRightOut', {
'0%': {
transform: 'translate3d(0, 0, 0)',
transformOrigin: '0 0',
opacity: 1
},
'100%': {
transform: 'translate3d(100%, 0, 0)',
transformOrigin: '0 0',
opacity: 0
}
});
const moveUpIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antMoveUpIn', {
'0%': {
transform: 'translate3d(0, -100%, 0)',
transformOrigin: '0 0',
opacity: 0
},
'100%': {
transform: 'translate3d(0, 0, 0)',
transformOrigin: '0 0',
opacity: 1
}
});
const moveUpOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antMoveUpOut', {
'0%': {
transform: 'translate3d(0, 0, 0)',
transformOrigin: '0 0',
opacity: 1
},
'100%': {
transform: 'translate3d(0, -100%, 0)',
transformOrigin: '0 0',
opacity: 0
}
});
const moveMotion = {
'move-up': {
inKeyframes: moveUpIn,
outKeyframes: moveUpOut
},
'move-down': {
inKeyframes: moveDownIn,
outKeyframes: moveDownOut
},
'move-left': {
inKeyframes: moveLeftIn,
outKeyframes: moveLeftOut
},
'move-right': {
inKeyframes: moveRightIn,
outKeyframes: moveRightOut
}
};
const initMoveMotion = (token, motionName) => {
const {
antCls
} = token;
const motionCls = `${antCls}-${motionName}`;
const {
inKeyframes,
outKeyframes
} = moveMotion[motionName];
return [(0,_motion__WEBPACK_IMPORTED_MODULE_1__.initMotion)(motionCls, inKeyframes, outKeyframes, token.motionDurationMid), {
[`
${motionCls}-enter,
${motionCls}-appear
`]: {
opacity: 0,
animationTimingFunction: token.motionEaseOutCirc
},
[`${motionCls}-leave`]: {
animationTimingFunction: token.motionEaseInOutCirc
}
}];
};
/***/ }),
/***/ "./components/style/motion/slide.ts":
/*!******************************************!*\
!*** ./components/style/motion/slide.ts ***!
\******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ initSlideMotion: function() { return /* binding */ initSlideMotion; },
/* harmony export */ slideDownIn: function() { return /* binding */ slideDownIn; },
/* harmony export */ slideDownOut: function() { return /* binding */ slideDownOut; },
/* harmony export */ slideUpIn: function() { return /* binding */ slideUpIn; },
/* harmony export */ slideUpOut: function() { return /* binding */ slideUpOut; }
/* harmony export */ });
/* unused harmony exports slideLeftIn, slideLeftOut, slideRightIn, slideRightOut */
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _motion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./motion */ "./components/style/motion/motion.ts");
const slideUpIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antSlideUpIn', {
'0%': {
transform: 'scaleY(0.8)',
transformOrigin: '0% 0%',
opacity: 0
},
'100%': {
transform: 'scaleY(1)',
transformOrigin: '0% 0%',
opacity: 1
}
});
const slideUpOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antSlideUpOut', {
'0%': {
transform: 'scaleY(1)',
transformOrigin: '0% 0%',
opacity: 1
},
'100%': {
transform: 'scaleY(0.8)',
transformOrigin: '0% 0%',
opacity: 0
}
});
const slideDownIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antSlideDownIn', {
'0%': {
transform: 'scaleY(0.8)',
transformOrigin: '100% 100%',
opacity: 0
},
'100%': {
transform: 'scaleY(1)',
transformOrigin: '100% 100%',
opacity: 1
}
});
const slideDownOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antSlideDownOut', {
'0%': {
transform: 'scaleY(1)',
transformOrigin: '100% 100%',
opacity: 1
},
'100%': {
transform: 'scaleY(0.8)',
transformOrigin: '100% 100%',
opacity: 0
}
});
const slideLeftIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antSlideLeftIn', {
'0%': {
transform: 'scaleX(0.8)',
transformOrigin: '0% 0%',
opacity: 0
},
'100%': {
transform: 'scaleX(1)',
transformOrigin: '0% 0%',
opacity: 1
}
});
const slideLeftOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antSlideLeftOut', {
'0%': {
transform: 'scaleX(1)',
transformOrigin: '0% 0%',
opacity: 1
},
'100%': {
transform: 'scaleX(0.8)',
transformOrigin: '0% 0%',
opacity: 0
}
});
const slideRightIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antSlideRightIn', {
'0%': {
transform: 'scaleX(0.8)',
transformOrigin: '100% 0%',
opacity: 0
},
'100%': {
transform: 'scaleX(1)',
transformOrigin: '100% 0%',
opacity: 1
}
});
const slideRightOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antSlideRightOut', {
'0%': {
transform: 'scaleX(1)',
transformOrigin: '100% 0%',
opacity: 1
},
'100%': {
transform: 'scaleX(0.8)',
transformOrigin: '100% 0%',
opacity: 0
}
});
const slideMotion = {
'slide-up': {
inKeyframes: slideUpIn,
outKeyframes: slideUpOut
},
'slide-down': {
inKeyframes: slideDownIn,
outKeyframes: slideDownOut
},
'slide-left': {
inKeyframes: slideLeftIn,
outKeyframes: slideLeftOut
},
'slide-right': {
inKeyframes: slideRightIn,
outKeyframes: slideRightOut
}
};
const initSlideMotion = (token, motionName) => {
const {
antCls
} = token;
const motionCls = `${antCls}-${motionName}`;
const {
inKeyframes,
outKeyframes
} = slideMotion[motionName];
return [(0,_motion__WEBPACK_IMPORTED_MODULE_1__.initMotion)(motionCls, inKeyframes, outKeyframes, token.motionDurationMid), {
[`
${motionCls}-enter,
${motionCls}-appear
`]: {
transform: 'scale(0)',
transformOrigin: '0% 0%',
opacity: 0,
animationTimingFunction: token.motionEaseOutQuint,
'&-prepare': {
transform: 'scale(1)'
}
},
[`${motionCls}-leave`]: {
animationTimingFunction: token.motionEaseInQuint
}
}];
};
/***/ }),
/***/ "./components/style/motion/util.ts":
/*!*****************************************!*\
!*** ./components/style/motion/util.ts ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ genNoMotionStyle: function() { return /* binding */ genNoMotionStyle; }
/* harmony export */ });
const genNoMotionStyle = () => {
return {
'@media (prefers-reduced-motion: reduce)': {
transition: 'none',
animation: 'none'
}
};
};
/***/ }),
/***/ "./components/style/motion/zoom.ts":
/*!*****************************************!*\
!*** ./components/style/motion/zoom.ts ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ initZoomMotion: function() { return /* binding */ initZoomMotion; },
/* harmony export */ zoomIn: function() { return /* binding */ zoomIn; }
/* harmony export */ });
/* unused harmony exports zoomOut, zoomBigIn, zoomBigOut, zoomUpIn, zoomUpOut, zoomLeftIn, zoomLeftOut, zoomRightIn, zoomRightOut, zoomDownIn, zoomDownOut */
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _motion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./motion */ "./components/style/motion/motion.ts");
const zoomIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antZoomIn', {
'0%': {
transform: 'scale(0.2)',
opacity: 0
},
'100%': {
transform: 'scale(1)',
opacity: 1
}
});
const zoomOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antZoomOut', {
'0%': {
transform: 'scale(1)'
},
'100%': {
transform: 'scale(0.2)',
opacity: 0
}
});
const zoomBigIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antZoomBigIn', {
'0%': {
transform: 'scale(0.8)',
opacity: 0
},
'100%': {
transform: 'scale(1)',
opacity: 1
}
});
const zoomBigOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antZoomBigOut', {
'0%': {
transform: 'scale(1)'
},
'100%': {
transform: 'scale(0.8)',
opacity: 0
}
});
const zoomUpIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antZoomUpIn', {
'0%': {
transform: 'scale(0.8)',
transformOrigin: '50% 0%',
opacity: 0
},
'100%': {
transform: 'scale(1)',
transformOrigin: '50% 0%'
}
});
const zoomUpOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antZoomUpOut', {
'0%': {
transform: 'scale(1)',
transformOrigin: '50% 0%'
},
'100%': {
transform: 'scale(0.8)',
transformOrigin: '50% 0%',
opacity: 0
}
});
const zoomLeftIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antZoomLeftIn', {
'0%': {
transform: 'scale(0.8)',
transformOrigin: '0% 50%',
opacity: 0
},
'100%': {
transform: 'scale(1)',
transformOrigin: '0% 50%'
}
});
const zoomLeftOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antZoomLeftOut', {
'0%': {
transform: 'scale(1)',
transformOrigin: '0% 50%'
},
'100%': {
transform: 'scale(0.8)',
transformOrigin: '0% 50%',
opacity: 0
}
});
const zoomRightIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antZoomRightIn', {
'0%': {
transform: 'scale(0.8)',
transformOrigin: '100% 50%',
opacity: 0
},
'100%': {
transform: 'scale(1)',
transformOrigin: '100% 50%'
}
});
const zoomRightOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antZoomRightOut', {
'0%': {
transform: 'scale(1)',
transformOrigin: '100% 50%'
},
'100%': {
transform: 'scale(0.8)',
transformOrigin: '100% 50%',
opacity: 0
}
});
const zoomDownIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antZoomDownIn', {
'0%': {
transform: 'scale(0.8)',
transformOrigin: '50% 100%',
opacity: 0
},
'100%': {
transform: 'scale(1)',
transformOrigin: '50% 100%'
}
});
const zoomDownOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('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 [(0,_motion__WEBPACK_IMPORTED_MODULE_1__.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
}
}];
};
/***/ }),
/***/ "./components/style/placementArrow.ts":
/*!********************************************!*\
!*** ./components/style/placementArrow.ts ***!
\********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ MAX_VERTICAL_CONTENT_RADIUS: function() { return /* binding */ MAX_VERTICAL_CONTENT_RADIUS; },
/* harmony export */ getArrowOffsetToken: function() { return /* binding */ getArrowOffsetToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _theme_util_genStyleUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../theme/util/genStyleUtils */ "./components/theme/util/genStyleUtils.ts");
/* harmony import */ var _roundedArrow__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./roundedArrow */ "./components/style/roundedArrow.ts");
const MAX_VERTICAL_CONTENT_RADIUS = 8;
function getArrowOffsetToken(options) {
const {
contentRadius,
limitVerticalRadius
} = options;
const arrowOffset = contentRadius > 12 ? contentRadius + 2 : 12;
const arrowOffsetVertical = limitVerticalRadius ? MAX_VERTICAL_CONTENT_RADIUS : arrowOffset;
return {
arrowOffsetHorizontal: arrowOffset,
arrowOffsetVertical
};
}
function isInject(valid, code) {
if (!valid) {
return {};
}
return code;
}
const getArrowStyle = (token, colorBg, options) => {
const {
componentCls,
boxShadowPopoverArrow,
arrowOffsetVertical,
arrowOffsetHorizontal,
antCls
} = token;
const [varName] = (0,_theme_util_genStyleUtils__WEBPACK_IMPORTED_MODULE_1__.genCssVar)(antCls, 'tooltip');
const {
arrowDistance = 0,
arrowPlacement = {
left: true,
right: true,
top: true,
bottom: true
}
} = options || {};
return {
[componentCls]: {
// ============================ Basic ============================
[`${componentCls}-arrow`]: [{
position: 'absolute',
zIndex: 1,
// lift it up so the menu wouldn't cask shadow on it
display: 'block',
...(0,_roundedArrow__WEBPACK_IMPORTED_MODULE_2__.genRoundedArrow)(token, colorBg, boxShadowPopoverArrow),
'&:before': {
background: colorBg
}
}],
// ========================== Placement ==========================
// Here handle the arrow position and rotate stuff
// >>>>> Top
...isInject(!!arrowPlacement.top, {
[[`&-placement-top > ${componentCls}-arrow`, `&-placement-topLeft > ${componentCls}-arrow`, `&-placement-topRight > ${componentCls}-arrow`].join(',')]: {
bottom: arrowDistance,
transform: 'translateY(100%) rotate(180deg)'
},
[`&-placement-top > ${componentCls}-arrow`]: {
left: {
_skip_check_: true,
value: '50%'
},
transform: 'translateX(-50%) translateY(100%) rotate(180deg)'
},
'&-placement-topLeft': {
[varName('arrow-offset-x')]: arrowOffsetHorizontal,
[`> ${componentCls}-arrow`]: {
left: {
_skip_check_: true,
value: arrowOffsetHorizontal
}
}
},
'&-placement-topRight': {
[varName('arrow-offset-x')]: `calc(100% - ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(arrowOffsetHorizontal)})`,
[`> ${componentCls}-arrow`]: {
right: {
_skip_check_: true,
value: arrowOffsetHorizontal
}
}
}
}),
// >>>>> Bottom
...isInject(!!arrowPlacement.bottom, {
[[`&-placement-bottom > ${componentCls}-arrow`, `&-placement-bottomLeft > ${componentCls}-arrow`, `&-placement-bottomRight > ${componentCls}-arrow`].join(',')]: {
top: arrowDistance,
transform: `translateY(-100%)`
},
[`&-placement-bottom > ${componentCls}-arrow`]: {
left: {
_skip_check_: true,
value: '50%'
},
transform: `translateX(-50%) translateY(-100%)`
},
'&-placement-bottomLeft': {
[varName('arrow-offset-x')]: arrowOffsetHorizontal,
[`> ${componentCls}-arrow`]: {
left: {
_skip_check_: true,
value: arrowOffsetHorizontal
}
}
},
'&-placement-bottomRight': {
[varName('arrow-offset-x')]: `calc(100% - ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(arrowOffsetHorizontal)})`,
[`> ${componentCls}-arrow`]: {
right: {
_skip_check_: true,
value: arrowOffsetHorizontal
}
}
}
}),
// >>>>> Left
...isInject(!!arrowPlacement.left, {
[[`&-placement-left > ${componentCls}-arrow`, `&-placement-leftTop > ${componentCls}-arrow`, `&-placement-leftBottom > ${componentCls}-arrow`].join(',')]: {
right: {
_skip_check_: true,
value: arrowDistance
},
transform: 'translateX(100%) rotate(90deg)'
},
[`&-placement-left > ${componentCls}-arrow`]: {
top: {
_skip_check_: true,
value: '50%'
},
transform: 'translateY(-50%) translateX(100%) rotate(90deg)'
},
[`&-placement-leftTop > ${componentCls}-arrow`]: {
top: arrowOffsetVertical
},
[`&-placement-leftBottom > ${componentCls}-arrow`]: {
bottom: arrowOffsetVertical
}
}),
// >>>>> Right
...isInject(!!arrowPlacement.right, {
[[`&-placement-right > ${componentCls}-arrow`, `&-placement-rightTop > ${componentCls}-arrow`, `&-placement-rightBottom > ${componentCls}-arrow`].join(',')]: {
left: {
_skip_check_: true,
value: arrowDistance
},
transform: 'translateX(-100%) rotate(-90deg)'
},
[`&-placement-right > ${componentCls}-arrow`]: {
top: {
_skip_check_: true,
value: '50%'
},
transform: 'translateY(-50%) translateX(-100%) rotate(-90deg)'
},
[`&-placement-rightTop > ${componentCls}-arrow`]: {
top: arrowOffsetVertical
},
[`&-placement-rightBottom > ${componentCls}-arrow`]: {
bottom: arrowOffsetVertical
}
})
}
};
};
/* harmony default export */ __webpack_exports__["default"] = (getArrowStyle);
/***/ }),
/***/ "./components/style/roundedArrow.ts":
/*!******************************************!*\
!*** ./components/style/roundedArrow.ts ***!
\******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ genRoundedArrow: function() { return /* binding */ genRoundedArrow; },
/* harmony export */ getArrowToken: function() { return /* binding */ getArrowToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
function getArrowToken(token) {
const {
sizePopupArrow,
borderRadiusXS,
borderRadiusOuter
} = token;
const unitWidth = sizePopupArrow / 2;
const ax = 0;
const ay = unitWidth;
const bx = borderRadiusOuter * 1 / Math.sqrt(2);
const by = unitWidth - borderRadiusOuter * (1 - 1 / Math.sqrt(2));
const cx = unitWidth - borderRadiusXS * (1 / Math.sqrt(2));
const cy = borderRadiusOuter * (Math.sqrt(2) - 1) + borderRadiusXS * (1 / Math.sqrt(2));
const dx = 2 * unitWidth - cx;
const dy = cy;
const ex = 2 * unitWidth - bx;
const ey = by;
const fx = 2 * unitWidth - ax;
const fy = ay;
const shadowWidth = unitWidth * Math.sqrt(2) + borderRadiusOuter * (Math.sqrt(2) - 2);
const polygonOffset = borderRadiusOuter * (Math.sqrt(2) - 1);
const arrowPolygon = `polygon(${polygonOffset}px 100%, 50% ${polygonOffset}px, ${2 * unitWidth - polygonOffset}px 100%, ${polygonOffset}px 100%)`;
const arrowPath = `path('M ${ax} ${ay} A ${borderRadiusOuter} ${borderRadiusOuter} 0 0 0 ${bx} ${by} L ${cx} ${cy} A ${borderRadiusXS} ${borderRadiusXS} 0 0 1 ${dx} ${dy} L ${ex} ${ey} A ${borderRadiusOuter} ${borderRadiusOuter} 0 0 0 ${fx} ${fy} Z')`;
return {
arrowShadowWidth: shadowWidth,
arrowPath,
arrowPolygon
};
}
const genRoundedArrow = (token, bgColor, boxShadow) => {
const {
sizePopupArrow,
arrowPolygon,
arrowPath,
arrowShadowWidth,
borderRadiusXS,
calc
} = token;
return {
pointerEvents: 'none',
width: sizePopupArrow,
height: sizePopupArrow,
overflow: 'hidden',
'&::before': {
position: 'absolute',
bottom: 0,
insetInlineStart: 0,
width: sizePopupArrow,
height: calc(sizePopupArrow).div(2).equal(),
background: bgColor,
clipPath: {
_multi_value_: true,
value: [arrowPolygon, arrowPath]
},
content: '""'
},
'&::after': {
content: '""',
position: 'absolute',
width: arrowShadowWidth,
height: arrowShadowWidth,
bottom: 0,
insetInline: 0,
margin: 'auto',
borderRadius: {
_skip_check_: true,
value: `0 0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(borderRadiusXS)} 0`
},
transform: 'translateY(50%) rotate(-135deg)',
boxShadow,
zIndex: 0,
background: 'transparent'
}
};
};
/***/ }),
/***/ "./components/switch/style/index.ts":
/*!******************************************!*\
!*** ./components/switch/style/index.ts ***!
\******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ant-design/fast-color */ "./node_modules/@ant-design/fast-color/es/index.js");
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _style_motion__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../style/motion */ "./components/style/motion/util.ts");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const genSwitchSmallStyle = token => {
const {
componentCls,
trackHeightSM,
trackPadding,
trackMinWidthSM,
innerMinMarginSM,
innerMaxMarginSM,
handleSizeSM,
calc
} = token;
const switchInnerCls = `${componentCls}-inner`;
const trackPaddingCalc = (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(calc(handleSizeSM).add(calc(trackPadding).mul(2)).equal());
const innerMaxMarginCalc = (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(calc(innerMaxMarginSM).mul(2).equal());
return {
[componentCls]: {
[`&${componentCls}-small`]: {
minWidth: trackMinWidthSM,
height: trackHeightSM,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(trackHeightSM),
[`${componentCls}-inner`]: {
paddingInlineStart: innerMaxMarginSM,
paddingInlineEnd: innerMinMarginSM,
[`${switchInnerCls}-checked, ${switchInnerCls}-unchecked`]: {
minHeight: trackHeightSM
},
[`${switchInnerCls}-checked`]: {
marginInlineStart: `calc(-100% + ${trackPaddingCalc} - ${innerMaxMarginCalc})`,
marginInlineEnd: `calc(100% - ${trackPaddingCalc} + ${innerMaxMarginCalc})`
},
[`${switchInnerCls}-unchecked`]: {
marginTop: calc(trackHeightSM).mul(-1).equal(),
marginInlineStart: 0,
marginInlineEnd: 0
}
},
[`${componentCls}-handle`]: {
width: handleSizeSM,
height: handleSizeSM
},
[`${componentCls}-loading-icon`]: {
top: calc(calc(handleSizeSM).sub(token.switchLoadingIconSize)).div(2).equal(),
fontSize: token.switchLoadingIconSize
},
[`&${componentCls}-checked`]: {
[`${componentCls}-inner`]: {
paddingInlineStart: innerMinMarginSM,
paddingInlineEnd: innerMaxMarginSM,
[`${switchInnerCls}-checked`]: {
marginInlineStart: 0,
marginInlineEnd: 0
},
[`${switchInnerCls}-unchecked`]: {
marginInlineStart: `calc(100% - ${trackPaddingCalc} + ${innerMaxMarginCalc})`,
marginInlineEnd: `calc(-100% + ${trackPaddingCalc} - ${innerMaxMarginCalc})`
}
},
[`${componentCls}-handle`]: {
insetInlineStart: `calc(100% - ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(calc(handleSizeSM).add(trackPadding).equal())})`
}
},
[`&:not(${componentCls}-disabled):active`]: {
[`&:not(${componentCls}-checked) ${switchInnerCls}`]: {
[`${switchInnerCls}-unchecked`]: {
marginInlineStart: calc(token.marginXXS).div(2).equal(),
marginInlineEnd: calc(token.marginXXS).mul(-1).div(2).equal()
}
},
[`&${componentCls}-checked ${switchInnerCls}`]: {
[`${switchInnerCls}-checked`]: {
marginInlineStart: calc(token.marginXXS).mul(-1).div(2).equal(),
marginInlineEnd: calc(token.marginXXS).div(2).equal()
}
}
}
}
}
};
};
const genSwitchLoadingStyle = token => {
const {
componentCls,
handleSize,
calc
} = token;
return {
[componentCls]: {
[`${componentCls}-loading-icon${token.iconCls}`]: {
position: 'relative',
top: calc(calc(handleSize).sub(token.fontSize)).div(2).equal(),
color: token.switchLoadingIconColor,
verticalAlign: 'top'
},
[`&${componentCls}-checked ${componentCls}-loading-icon`]: {
color: token.switchColor
}
}
};
};
const genSwitchHandleStyle = token => {
const {
componentCls,
trackPadding,
handleBg,
handleShadow,
handleSize,
calc
} = token;
const switchHandleCls = `${componentCls}-handle`;
return {
[componentCls]: {
[switchHandleCls]: {
position: 'absolute',
top: trackPadding,
insetInlineStart: trackPadding,
width: handleSize,
height: handleSize,
transition: `all ${token.switchDuration} ease-in-out`,
...(0,_style_motion__WEBPACK_IMPORTED_MODULE_3__.genNoMotionStyle)(),
'&::before': {
position: 'absolute',
top: 0,
insetInlineEnd: 0,
bottom: 0,
insetInlineStart: 0,
backgroundColor: handleBg,
borderRadius: calc(handleSize).div(2).equal(),
boxShadow: handleShadow,
transition: `all ${token.switchDuration} ease-in-out`,
content: '""',
...(0,_style_motion__WEBPACK_IMPORTED_MODULE_3__.genNoMotionStyle)()
}
},
[`&${componentCls}-checked ${switchHandleCls}`]: {
insetInlineStart: `calc(100% - ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(calc(handleSize).add(trackPadding).equal())})`
},
[`&:not(${componentCls}-disabled):active`]: {
[`${switchHandleCls}::before`]: {
insetInlineEnd: token.switchHandleActiveInset,
insetInlineStart: 0
},
[`&${componentCls}-checked ${switchHandleCls}::before`]: {
insetInlineEnd: 0,
insetInlineStart: token.switchHandleActiveInset
}
}
}
};
};
const genSwitchInnerStyle = token => {
const {
componentCls,
trackHeight,
trackPadding,
innerMinMargin,
innerMaxMargin,
handleSize,
switchDuration,
calc
} = token;
const switchInnerCls = `${componentCls}-inner`;
const trackPaddingCalc = (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(calc(handleSize).add(calc(trackPadding).mul(2)).equal());
const innerMaxMarginCalc = (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(calc(innerMaxMargin).mul(2).equal());
return {
[componentCls]: {
[switchInnerCls]: {
display: 'block',
overflow: 'hidden',
borderRadius: 100,
height: '100%',
paddingInlineStart: innerMaxMargin,
paddingInlineEnd: innerMinMargin,
transition: [`padding-inline-start`, `padding-inline-end`].map(prop => `${prop} ${switchDuration} ease-in-out`).join(', '),
...(0,_style_motion__WEBPACK_IMPORTED_MODULE_3__.genNoMotionStyle)(),
[`${switchInnerCls}-checked, ${switchInnerCls}-unchecked`]: {
display: 'block',
color: token.colorTextLightSolid,
fontSize: token.fontSizeSM,
pointerEvents: 'none',
minHeight: trackHeight,
transition: [`margin-inline-start`, `margin-inline-end`].map(prop => `${prop} ${switchDuration} ease-in-out`).join(', '),
...(0,_style_motion__WEBPACK_IMPORTED_MODULE_3__.genNoMotionStyle)()
},
[`${switchInnerCls}-checked`]: {
marginInlineStart: `calc(-100% + ${trackPaddingCalc} - ${innerMaxMarginCalc})`,
marginInlineEnd: `calc(100% - ${trackPaddingCalc} + ${innerMaxMarginCalc})`
},
[`${switchInnerCls}-unchecked`]: {
marginTop: calc(trackHeight).mul(-1).equal(),
marginInlineStart: 0,
marginInlineEnd: 0
}
},
[`&${componentCls}-checked ${switchInnerCls}`]: {
paddingInlineStart: innerMinMargin,
paddingInlineEnd: innerMaxMargin,
[`${switchInnerCls}-checked`]: {
marginInlineStart: 0,
marginInlineEnd: 0
},
[`${switchInnerCls}-unchecked`]: {
marginInlineStart: `calc(100% - ${trackPaddingCalc} + ${innerMaxMarginCalc})`,
marginInlineEnd: `calc(-100% + ${trackPaddingCalc} - ${innerMaxMarginCalc})`
}
},
[`&:not(${componentCls}-disabled):active`]: {
[`&:not(${componentCls}-checked) ${switchInnerCls}`]: {
[`${switchInnerCls}-unchecked`]: {
marginInlineStart: calc(trackPadding).mul(2).equal(),
marginInlineEnd: calc(trackPadding).mul(-1).mul(2).equal()
}
},
[`&${componentCls}-checked ${switchInnerCls}`]: {
[`${switchInnerCls}-checked`]: {
marginInlineStart: calc(trackPadding).mul(-1).mul(2).equal(),
marginInlineEnd: calc(trackPadding).mul(2).equal()
}
}
}
}
};
};
const genSwitchStyle = token => {
const {
componentCls,
trackHeight,
trackMinWidth
} = token;
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_2__.resetComponent)(token),
position: 'relative',
display: 'inline-block',
boxSizing: 'border-box',
minWidth: trackMinWidth,
height: trackHeight,
lineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(trackHeight),
verticalAlign: 'middle',
background: token.colorTextQuaternary,
border: '0',
borderRadius: 100,
cursor: 'pointer',
transition: `all ${token.motionDurationMid}`,
userSelect: 'none',
...(0,_style_motion__WEBPACK_IMPORTED_MODULE_3__.genNoMotionStyle)(),
[`&:hover:not(${componentCls}-disabled)`]: {
background: token.colorTextTertiary
},
...(0,_style__WEBPACK_IMPORTED_MODULE_2__.genFocusStyle)(token),
[`&${componentCls}-checked`]: {
background: token.switchColor,
[`&:hover:not(${componentCls}-disabled)`]: {
background: token.colorPrimaryHover
}
},
[`&${componentCls}-loading, &${componentCls}-disabled`]: {
cursor: 'not-allowed',
opacity: token.switchDisabledOpacity,
'*': {
boxShadow: 'none',
cursor: 'not-allowed'
}
},
// rtl style
[`&${componentCls}-rtl`]: {
direction: 'rtl'
}
}
};
};
// ============================== Export ==============================
const prepareComponentToken = token => {
const {
fontSize,
lineHeight,
controlHeight,
colorWhite
} = token;
const height = fontSize * lineHeight;
const heightSM = controlHeight / 2;
const padding = 2; // Fixed value
const handleSize = height - padding * 2;
const handleSizeSM = heightSM - padding * 2;
return {
trackHeight: height,
trackHeightSM: heightSM,
trackMinWidth: handleSize * 2 + padding * 4,
trackMinWidthSM: handleSizeSM * 2 + padding * 2,
trackPadding: padding,
// Fixed value
handleBg: colorWhite,
handleSize,
handleSizeSM,
handleShadow: `0 2px 4px 0 ${new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__.FastColor('#00230b').setA(0.2).toRgbString()}`,
innerMinMargin: handleSize / 2,
innerMaxMargin: handleSize + padding + padding * 2,
innerMinMarginSM: handleSizeSM / 2,
innerMaxMarginSM: handleSizeSM + padding + padding * 2
};
};
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_5__.genStyleHooks)('Switch', token => {
const switchToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_4__.mergeToken)(token, {
switchDuration: token.motionDurationMid,
switchColor: token.colorPrimary,
switchDisabledOpacity: token.opacityLoading,
switchLoadingIconSize: token.calc(token.fontSizeIcon).mul(0.75).equal(),
switchLoadingIconColor: `rgba(0, 0, 0, ${token.opacityLoading})`,
switchHandleActiveInset: '-30%'
});
return [genSwitchStyle(switchToken),
// inner style
genSwitchInnerStyle(switchToken),
// handle style
genSwitchHandleStyle(switchToken),
// loading style
genSwitchLoadingStyle(switchToken),
// small style
genSwitchSmallStyle(switchToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/table/style/index.ts":
/*!******************************************************!*\
!*** ./components/table/style/index.ts + 15 modules ***!
\******************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ table_style; },
prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
});
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
// EXTERNAL MODULE: ./node_modules/@ant-design/fast-color/es/index.js + 3 modules
var es = __webpack_require__("./node_modules/@ant-design/fast-color/es/index.js");
// EXTERNAL MODULE: ./components/style/index.tsx
var style = __webpack_require__("./components/style/index.tsx");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var cssinjs_utils_es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
;// ./components/table/style/bordered.ts
const genBorderedStyle = token => {
const {
componentCls,
lineWidth,
lineType,
tableBorderColor,
tableHeaderBg,
tablePaddingVertical,
tablePaddingHorizontal,
calc
} = token;
const tableBorder = `${(0,cssinjs.unit)(lineWidth)} ${lineType} ${tableBorderColor}`;
const getSizeBorderStyle = (size, paddingVertical, paddingHorizontal) => ({
[`&${componentCls}-${size}`]: {
[`> ${componentCls}-container`]: {
[`> ${componentCls}-content, > ${componentCls}-body`]: {
'> table > tbody > tr > th, > table > tbody > tr > td': {
[`> ${componentCls}-expanded-row-fixed`]: {
margin: `${(0,cssinjs.unit)(calc(paddingVertical).mul(-1).equal())}
${(0,cssinjs.unit)(calc(calc(paddingHorizontal).add(lineWidth)).mul(-1).equal())}`
}
}
}
}
}
});
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}${componentCls}-bordered`]: {
// ============================ Title =============================
[`> ${componentCls}-title`]: {
border: tableBorder,
borderBottom: 0
},
// ============================ Content ============================
[`> ${componentCls}-container`]: {
borderInlineStart: tableBorder,
borderTop: tableBorder,
[`> ${componentCls}-content, > ${componentCls}-header, > ${componentCls}-body, > ${componentCls}-summary`]: {
'> table': {
// ============================= Cell =============================
'> thead > tr > th, > thead > tr > td, > tbody > tr > th, > tbody > tr > td, > tfoot > tr > th, > tfoot > tr > td': {
borderInlineEnd: tableBorder
},
// ============================ Header ============================
'> thead': {
'> tr:not(:last-child) > th': {
borderBottom: tableBorder
},
'> tr > th::before': {
backgroundColor: 'transparent !important'
}
},
// Fixed right should provides additional border
'> thead > tr, > tbody > tr, > tfoot > tr': {
[`> ${componentCls}-cell-fix-right-first::after`]: {
borderInlineEnd: tableBorder
}
},
// ========================== Expandable ==========================
'> tbody > tr > th, > tbody > tr > td': {
[`> ${componentCls}-expanded-row-fixed`]: {
margin: `${(0,cssinjs.unit)(calc(tablePaddingVertical).mul(-1).equal())} ${(0,cssinjs.unit)(calc(calc(tablePaddingHorizontal).add(lineWidth)).mul(-1).equal())}`,
'&::after': {
position: 'absolute',
top: 0,
insetInlineEnd: lineWidth,
bottom: 0,
borderInlineEnd: tableBorder,
content: '""'
}
}
}
}
}
},
// ============================ Scroll ============================
[`&${componentCls}-scroll-horizontal`]: {
[`> ${componentCls}-container > ${componentCls}-body`]: {
'> table > tbody': {
[`
> tr${componentCls}-expanded-row,
> tr${componentCls}-placeholder
`]: {
'> th, > td': {
borderInlineEnd: 0
}
}
}
}
},
// ============================ Size ============================
...getSizeBorderStyle('medium', token.tablePaddingVerticalMiddle, token.tablePaddingHorizontalMiddle),
...getSizeBorderStyle('small', token.tablePaddingVerticalSmall, token.tablePaddingHorizontalSmall),
// ============================ Footer ============================
[`> ${componentCls}-footer`]: {
border: tableBorder,
borderTop: 0
}
},
// ============================ Nested ============================
[`${componentCls}-cell`]: {
[`${componentCls}-container:first-child`]: {
// :first-child to avoid the case when bordered and title is set
borderTop: 0
},
// https://github.com/ant-design/ant-design/issues/35577
'&-scrollbar:not([rowspan])': {
boxShadow: `0 ${(0,cssinjs.unit)(lineWidth)} 0 ${(0,cssinjs.unit)(lineWidth)} ${tableHeaderBg}`
}
},
[`${componentCls}-bordered ${componentCls}-cell-scrollbar`]: {
borderInlineEnd: tableBorder
}
}
};
};
/* harmony default export */ var bordered = (genBorderedStyle);
;// ./components/table/style/ellipsis.ts
const genEllipsisStyle = token => {
const {
componentCls
} = token;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-cell-ellipsis`]: {
...style.textEllipsis,
wordBreak: 'keep-all',
// Fixed first or last should special process
[`
&${componentCls}-cell-fix-start-shadow,
&${componentCls}-cell-fix-end-shadow
`]: {
overflow: 'visible',
[`${componentCls}-cell-content`]: {
...style.textEllipsis,
display: 'block'
}
},
[`${componentCls}-column-title`]: {
...style.textEllipsis,
wordBreak: 'keep-all'
}
}
}
};
};
/* harmony default export */ var ellipsis = (genEllipsisStyle);
;// ./components/table/style/empty.ts
// ========================= Placeholder ==========================
const genEmptyStyle = token => {
const {
componentCls
} = token;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-tbody > tr${componentCls}-placeholder`]: {
textAlign: 'center',
color: token.colorTextDisabled,
'&:hover > th, &:hover > td': {
background: token.colorBgContainer
}
}
}
};
};
/* harmony default export */ var empty = (genEmptyStyle);
;// ./components/table/style/expand.ts
const genExpandStyle = token => {
const {
componentCls,
antCls,
motionDurationSlow,
lineWidth,
paddingXS,
lineType,
tableBorderColor,
tableExpandIconBg,
tableExpandColumnWidth,
borderRadius,
tablePaddingVertical,
tablePaddingHorizontal,
tableExpandedRowBg,
paddingXXS,
expandIconMarginTop,
expandIconSize,
expandIconHalfInner,
expandIconScale,
calc
} = token;
const tableBorder = `${(0,cssinjs.unit)(lineWidth)} ${lineType} ${tableBorderColor}`;
const expandIconLineOffset = calc(paddingXXS).sub(lineWidth).equal();
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-expand-icon-col`]: {
width: tableExpandColumnWidth
},
[`${componentCls}-row-expand-icon-cell`]: {
textAlign: 'center',
[`${componentCls}-row-expand-icon`]: {
display: 'inline-flex',
float: 'none',
verticalAlign: 'sub'
}
},
[`${componentCls}-row-indent`]: {
height: 1,
float: 'left'
},
[`${componentCls}-row-expand-icon`]: {
...(0,style.operationUnit)(token),
position: 'relative',
float: 'left',
width: expandIconSize,
height: expandIconSize,
color: 'inherit',
lineHeight: (0,cssinjs.unit)(expandIconSize),
background: tableExpandIconBg,
border: tableBorder,
borderRadius,
transform: `scale(${expandIconScale})`,
'&:focus, &:hover, &:active': {
borderColor: 'currentcolor'
},
'&::before, &::after': {
position: 'absolute',
background: 'currentcolor',
transition: `transform ${motionDurationSlow} ease-out`,
content: '""'
},
'&::before': {
top: expandIconHalfInner,
insetInlineEnd: expandIconLineOffset,
insetInlineStart: expandIconLineOffset,
height: lineWidth
},
'&::after': {
top: expandIconLineOffset,
bottom: expandIconLineOffset,
insetInlineStart: expandIconHalfInner,
width: lineWidth,
transform: 'rotate(90deg)'
},
// Motion effect
'&-collapsed::before': {
transform: 'rotate(-180deg)'
},
'&-collapsed::after': {
transform: 'rotate(0deg)'
},
'&-spaced': {
'&::before, &::after': {
display: 'none',
content: 'none'
},
background: 'transparent',
border: 0,
visibility: 'hidden'
}
},
[`${componentCls}-row-indent + ${componentCls}-row-expand-icon`]: {
marginTop: expandIconMarginTop,
marginInlineEnd: paddingXS
},
[`tr${componentCls}-expanded-row`]: {
'&, &:hover': {
'> th, > td': {
background: tableExpandedRowBg
}
},
// https://github.com/ant-design/ant-design/issues/25573
[`${antCls}-descriptions-view`]: {
display: 'flex',
table: {
flex: 'auto',
width: '100%'
}
}
},
// With fixed
[`${componentCls}-expanded-row-fixed`]: {
position: 'relative',
margin: `${(0,cssinjs.unit)(calc(tablePaddingVertical).mul(-1).equal())} ${(0,cssinjs.unit)(calc(tablePaddingHorizontal).mul(-1).equal())}`,
padding: `${(0,cssinjs.unit)(tablePaddingVertical)} ${(0,cssinjs.unit)(tablePaddingHorizontal)}`
}
}
};
};
/* harmony default export */ var expand = (genExpandStyle);
;// ./components/table/style/filter.ts
const genFilterStyle = token => {
const {
componentCls,
antCls,
iconCls,
tableFilterDropdownWidth,
tableFilterDropdownSearchWidth,
paddingXXS,
paddingXS,
colorText,
lineWidth,
lineType,
tableBorderColor,
headerIconColor,
fontSizeSM,
tablePaddingHorizontal,
borderRadius,
motionDurationSlow,
colorIcon,
colorPrimary,
tableHeaderFilterActiveBg,
colorTextDisabled,
tableFilterDropdownBg,
tableFilterDropdownHeight,
controlItemBgHover,
controlItemBgActive,
boxShadowSecondary,
filterDropdownMenuBg,
calc
} = token;
const dropdownPrefixCls = `${antCls}-dropdown`;
const tableFilterDropdownPrefixCls = `${componentCls}-filter-dropdown`;
const treePrefixCls = `${antCls}-tree`;
const tableBorder = `${(0,cssinjs.unit)(lineWidth)} ${lineType} ${tableBorderColor}`;
return [{
[`${componentCls}-wrapper`]: {
[`${componentCls}-filter-column`]: {
display: 'flex',
justifyContent: 'space-between'
},
[`${componentCls}-filter-trigger`]: {
position: 'relative',
display: 'flex',
alignItems: 'center',
marginBlock: calc(paddingXXS).mul(-1).equal(),
marginInline: `${(0,cssinjs.unit)(paddingXXS)} ${(0,cssinjs.unit)(calc(tablePaddingHorizontal).div(2).mul(-1).equal())}`,
padding: `0 ${(0,cssinjs.unit)(paddingXXS)}`,
color: headerIconColor,
fontSize: fontSizeSM,
borderRadius,
cursor: 'pointer',
transition: `all ${motionDurationSlow}`,
'&:hover': {
color: colorIcon,
background: tableHeaderFilterActiveBg
},
'&.active': {
color: colorPrimary
}
}
}
}, {
// Dropdown
[`${antCls}-dropdown`]: {
[tableFilterDropdownPrefixCls]: {
...(0,style.resetComponent)(token),
minWidth: tableFilterDropdownWidth,
backgroundColor: tableFilterDropdownBg,
borderRadius,
boxShadow: boxShadowSecondary,
overflow: 'hidden',
// Reset menu
[`${dropdownPrefixCls}-menu`]: {
// https://github.com/ant-design/ant-design/issues/4916
// https://github.com/ant-design/ant-design/issues/19542
maxHeight: tableFilterDropdownHeight,
overflowX: 'hidden',
border: 0,
boxShadow: 'none',
borderRadius: 'unset',
backgroundColor: filterDropdownMenuBg,
'&:empty::after': {
display: 'block',
padding: `${(0,cssinjs.unit)(paddingXS)} 0`,
color: colorTextDisabled,
fontSize: fontSizeSM,
textAlign: 'center',
content: '"Not Found"'
}
},
[`${tableFilterDropdownPrefixCls}-tree`]: {
paddingBlock: `${(0,cssinjs.unit)(paddingXS)} 0`,
paddingInline: paddingXS,
[treePrefixCls]: {
padding: 0
},
[`${treePrefixCls}-treenode ${treePrefixCls}-node-content-wrapper:hover`]: {
backgroundColor: controlItemBgHover
},
[`${treePrefixCls}-treenode-checkbox-checked ${treePrefixCls}-node-content-wrapper`]: {
'&, &:hover': {
backgroundColor: controlItemBgActive
}
}
},
[`${tableFilterDropdownPrefixCls}-search`]: {
padding: paddingXS,
borderBottom: tableBorder,
'&-input': {
input: {
minWidth: tableFilterDropdownSearchWidth
},
[iconCls]: {
color: colorTextDisabled
}
}
},
[`${tableFilterDropdownPrefixCls}-checkall`]: {
width: '100%',
marginBottom: paddingXXS,
marginInlineStart: paddingXXS
},
// Operation
[`${tableFilterDropdownPrefixCls}-btns`]: {
display: 'flex',
justifyContent: 'space-between',
padding: `${(0,cssinjs.unit)(calc(paddingXS).sub(lineWidth).equal())} ${(0,cssinjs.unit)(paddingXS)}`,
overflow: 'hidden',
borderTop: tableBorder
}
}
}
},
// Dropdown Menu & SubMenu
{
// submenu of table filter dropdown
[`${antCls}-dropdown ${tableFilterDropdownPrefixCls}, ${tableFilterDropdownPrefixCls}-submenu`]: {
// Checkbox
[`${antCls}-checkbox-wrapper + span`]: {
paddingInlineStart: paddingXS,
color: colorText
},
'> ul': {
maxHeight: 'calc(100vh - 130px)',
overflowX: 'hidden',
overflowY: 'auto'
}
}
}];
};
/* harmony default export */ var filter = (genFilterStyle);
;// ./components/table/style/fixed.ts
function getShadowStyle({
colorSplit: shadowColor
}) {
const leftShadowStyle = {
boxShadow: `inset 10px 0 8px -8px ${shadowColor}`
};
const rightShadowStyle = {
boxShadow: `inset -10px 0 8px -8px ${shadowColor}`
};
return [leftShadowStyle, rightShadowStyle];
}
const genFixedStyle = token => {
const {
componentCls,
lineWidth,
motionDurationSlow,
zIndexTableFixed,
tableBg,
calc
} = token;
const cellCls = `${componentCls}-cell`;
const fixCellCls = `${cellCls}-fix`;
const sharedShadowStyle = {
position: 'absolute',
top: 0,
bottom: calc(lineWidth).mul(-1).equal(),
width: 30,
transition: `box-shadow ${motionDurationSlow}`,
content: '""',
pointerEvents: 'none'
};
const [leftShadowStyle, rightShadowStyle] = getShadowStyle(token);
// Follow style is magic of shadow which should not follow token:
return {
[`${componentCls}-wrapper`]: {
// ====================== Cell ======================
[`${cellCls}${fixCellCls}`]: {
position: 'sticky'
},
[fixCellCls]: {
zIndex: `calc(var(--z-offset-reverse) + ${zIndexTableFixed})`,
background: tableBg,
'&:after': sharedShadowStyle,
// Position
'&-start:after': {
insetInlineStart: '100%'
},
'&-end:after': {
insetInlineEnd: '100%'
},
// visible
'&-start-shadow-show:after': leftShadowStyle,
'&-end-shadow-show:after': rightShadowStyle
},
// =================== Container ====================
[`${componentCls}-container`]: {
position: 'relative',
'&:before, &:after': {
...sharedShadowStyle,
zIndex: `calc(var(--columns-count) * 2 + ${zIndexTableFixed} + 1)`
},
'&:before': {
insetInlineStart: 0
},
'&:after': {
insetInlineEnd: 0
}
},
[`${componentCls}-has-fix-start ${componentCls}-container:before`]: {
display: 'none'
},
[`${componentCls}-has-fix-end ${componentCls}-container:after`]: {
display: 'none'
},
[`${componentCls}-fix-start-shadow-show ${componentCls}-container:before`]: leftShadowStyle,
[`${componentCls}-fix-end-shadow-show ${componentCls}-container:after`]: rightShadowStyle
}
};
};
/* harmony default export */ var fixed = (genFixedStyle);
;// ./components/table/style/pagination.ts
const genPaginationStyle = token => {
const {
componentCls,
antCls,
margin
} = token;
return {
[`${componentCls}-wrapper`]: {
// ========================== Pagination ==========================
[`${componentCls}-pagination${antCls}-pagination`]: {
margin: `${(0,cssinjs.unit)(margin)} 0`
},
[`${componentCls}-pagination`]: {
display: 'flex',
flexWrap: 'wrap',
rowGap: token.paddingXS,
'> *': {
flex: 'none'
},
'&-start': {
justifyContent: 'flex-start'
},
'&-center': {
justifyContent: 'center'
},
'&-end': {
justifyContent: 'flex-end'
}
}
}
};
};
/* harmony default export */ var pagination = (genPaginationStyle);
;// ./components/table/style/radius.ts
const genRadiusStyle = token => {
const {
componentCls,
tableRadius
} = token;
return {
[`${componentCls}-wrapper`]: {
[componentCls]: {
// https://github.com/ant-design/ant-design/issues/39115#issuecomment-1362314574
[`${componentCls}-title, ${componentCls}-header`]: {
borderRadius: `${(0,cssinjs.unit)(tableRadius)} ${(0,cssinjs.unit)(tableRadius)} 0 0`
},
[`${componentCls}-title + ${componentCls}-container`]: {
borderStartStartRadius: 0,
borderStartEndRadius: 0,
// https://github.com/ant-design/ant-design/issues/41975
[`${componentCls}-header, table`]: {
borderRadius: 0
},
'table > thead > tr:first-child': {
'th:first-child, th:last-child, td:first-child, td:last-child': {
borderRadius: 0
}
}
},
'&-container': {
borderStartStartRadius: tableRadius,
borderStartEndRadius: tableRadius,
'&::before': {
borderStartStartRadius: tableRadius
},
'&::after': {
borderStartEndRadius: tableRadius
},
[`> ${componentCls}-content`]: {
borderStartStartRadius: tableRadius,
borderStartEndRadius: tableRadius
},
'table > thead > tr:first-child': {
'> *:first-child': {
borderStartStartRadius: tableRadius
},
'> *:last-child': {
borderStartEndRadius: tableRadius
}
}
},
'&-footer': {
borderRadius: `0 0 ${(0,cssinjs.unit)(tableRadius)} ${(0,cssinjs.unit)(tableRadius)}`
}
}
}
};
};
/* harmony default export */ var radius = (genRadiusStyle);
;// ./components/table/style/rtl.ts
const genStyle = token => {
const {
componentCls
} = token;
const [leftShadowStyle, rightShadowStyle] = getShadowStyle(token);
return {
[`${componentCls}-wrapper-rtl`]: {
direction: 'rtl',
table: {
direction: 'rtl'
},
[`${componentCls}-row-expand-icon`]: {
float: 'right',
'&::after': {
transform: 'rotate(-90deg)'
},
'&-collapsed::before': {
transform: 'rotate(180deg)'
},
'&-collapsed::after': {
transform: 'rotate(0deg)'
}
},
// ====================== Cell ======================
[`${componentCls}-cell-fix`]: {
'&-start-shadow-show:after': rightShadowStyle,
'&-end-shadow-show:after': leftShadowStyle
},
// =================== Container ====================
[`${componentCls}-container`]: {
[`${componentCls}-row-indent`]: {
float: 'right'
}
},
[`${componentCls}-fix-start-shadow-show ${componentCls}-container:before`]: rightShadowStyle,
[`${componentCls}-fix-end-shadow-show ${componentCls}-container:after`]: leftShadowStyle
}
};
};
/* harmony default export */ var rtl = (genStyle);
;// ./components/table/style/selection.ts
const genSelectionStyle = token => {
const {
componentCls,
antCls,
iconCls,
fontSizeIcon,
padding,
paddingXS,
headerIconColor,
headerIconHoverColor,
tableSelectionColumnWidth,
tableSelectedRowBg,
tableSelectedRowHoverBg,
tableRowHoverBg,
tablePaddingHorizontal,
calc
} = token;
return {
[`${componentCls}-wrapper`]: {
// ========================== Selections ==========================
[`${componentCls}-selection-col`]: {
width: tableSelectionColumnWidth,
[`&${componentCls}-selection-col-with-dropdown`]: {
width: calc(tableSelectionColumnWidth).add(fontSizeIcon).add(calc(padding).div(4)).equal()
}
},
[`${componentCls}-bordered ${componentCls}-selection-col`]: {
width: calc(tableSelectionColumnWidth).add(calc(paddingXS).mul(2)).equal(),
[`&${componentCls}-selection-col-with-dropdown`]: {
width: calc(tableSelectionColumnWidth).add(fontSizeIcon).add(calc(padding).div(4)).add(calc(paddingXS).mul(2)).equal()
}
},
[`
table tr th${componentCls}-selection-column,
table tr td${componentCls}-selection-column,
${componentCls}-selection-column
`]: {
paddingInlineEnd: token.paddingXS,
paddingInlineStart: token.paddingXS,
textAlign: 'center',
[`${antCls}-radio-wrapper`]: {
marginInlineEnd: 0
}
},
[`table tr th${componentCls}-selection-column${componentCls}-cell-fix-left`]: {
zIndex: calc(token.zIndexTableFixed).add(1).equal({
unit: false
})
},
[`table tr th${componentCls}-selection-column::after`]: {
backgroundColor: 'transparent !important'
},
[`${componentCls}-selection`]: {
position: 'relative',
display: 'inline-flex',
flexDirection: 'column'
},
[`${componentCls}-selection-extra`]: {
position: 'absolute',
top: 0,
zIndex: 1,
cursor: 'pointer',
transition: `all ${token.motionDurationSlow}`,
marginInlineStart: '100%',
paddingInlineStart: (0,cssinjs.unit)(calc(tablePaddingHorizontal).div(4).equal()),
[iconCls]: {
color: headerIconColor,
fontSize: fontSizeIcon,
verticalAlign: 'baseline',
'&:hover': {
color: headerIconHoverColor
}
}
},
// ============================= Rows =============================
[`${componentCls}-tbody`]: {
[`${componentCls}-row`]: {
[`&${componentCls}-row-selected`]: {
[`> ${componentCls}-cell`]: {
background: tableSelectedRowBg,
'&-row-hover': {
background: tableSelectedRowHoverBg
}
}
},
[`> ${componentCls}-cell-row-hover`]: {
background: tableRowHoverBg
}
}
}
}
};
};
/* harmony default export */ var selection = (genSelectionStyle);
;// ./components/table/style/size.ts
const genSizeStyle = token => {
const {
componentCls,
tableExpandColumnWidth,
calc
} = token;
const getSizeStyle = (size, paddingVertical, paddingHorizontal, fontSize) => ({
[`${componentCls}${componentCls}-${size}`]: {
fontSize,
[`
${componentCls}-title,
${componentCls}-footer,
${componentCls}-cell,
${componentCls}-thead > tr > th,
${componentCls}-tbody > tr > th,
${componentCls}-tbody > tr > td,
tfoot > tr > th,
tfoot > tr > td
`]: {
padding: `${(0,cssinjs.unit)(paddingVertical)} ${(0,cssinjs.unit)(paddingHorizontal)}`
},
[`${componentCls}-filter-trigger`]: {
marginInlineEnd: (0,cssinjs.unit)(calc(paddingHorizontal).div(2).mul(-1).equal())
},
[`${componentCls}-expanded-row-fixed`]: {
margin: `${(0,cssinjs.unit)(calc(paddingVertical).mul(-1).equal())} ${(0,cssinjs.unit)(calc(paddingHorizontal).mul(-1).equal())}`
},
[`${componentCls}-tbody`]: {
// ========================= Nest Table ===========================
[`${componentCls}-wrapper:only-child ${componentCls}`]: {
marginBlock: (0,cssinjs.unit)(calc(paddingVertical).mul(-1).equal()),
marginInline: `${(0,cssinjs.unit)(calc(tableExpandColumnWidth).sub(paddingHorizontal).equal())} ${(0,cssinjs.unit)(calc(paddingHorizontal).mul(-1).equal())}`
}
},
// https://github.com/ant-design/ant-design/issues/35167
[`${componentCls}-selection-extra`]: {
paddingInlineStart: (0,cssinjs.unit)(calc(paddingHorizontal).div(4).equal())
}
}
});
return {
[`${componentCls}-wrapper`]: {
...getSizeStyle('medium', token.tablePaddingVerticalMiddle, token.tablePaddingHorizontalMiddle, token.tableFontSizeMiddle),
...getSizeStyle('small', token.tablePaddingVerticalSmall, token.tablePaddingHorizontalSmall, token.tableFontSizeSmall)
}
};
};
/* harmony default export */ var size = (genSizeStyle);
;// ./components/table/style/sorter.ts
const genSorterStyle = token => {
const {
componentCls,
marginXXS,
fontSizeIcon,
headerIconColor,
headerIconHoverColor
} = token;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-thead th${componentCls}-column-has-sorters`]: {
outline: 'none',
cursor: 'pointer',
// why left 0s? Avoid column header move with transition when left is changed
// https://github.com/ant-design/ant-design/issues/50588
transition: `all ${token.motionDurationSlow}, left 0s`,
'&:hover': {
background: token.tableHeaderSortHoverBg,
'&::before': {
backgroundColor: 'transparent !important'
}
},
'&:focus-visible': {
color: token.colorPrimary
},
// https://github.com/ant-design/ant-design/issues/30969
[`
&${componentCls}-cell-fix-left:hover,
&${componentCls}-cell-fix-right:hover
`]: {
background: token.tableFixedHeaderSortActiveBg
}
},
[`${componentCls}-thead th${componentCls}-column-sort`]: {
background: token.tableHeaderSortBg,
'&::before': {
backgroundColor: 'transparent !important'
}
},
[`td${componentCls}-column-sort`]: {
background: token.tableBodySortBg
},
[`${componentCls}-column-title`]: {
position: 'relative',
zIndex: 1,
flex: 1,
minWidth: 0
},
[`${componentCls}-column-sorters`]: {
display: 'flex',
flex: 'auto',
alignItems: 'center',
justifyContent: 'space-between',
'&::after': {
position: 'absolute',
inset: 0,
width: '100%',
height: '100%',
content: '""'
}
},
[`${componentCls}-column-sorters-tooltip-target-sorter`]: {
'&::after': {
content: 'none'
}
},
[`${componentCls}-column-sorter`]: {
marginInlineStart: marginXXS,
color: headerIconColor,
fontSize: 0,
transition: `color ${token.motionDurationSlow}`,
'&-inner': {
display: 'inline-flex',
flexDirection: 'column',
alignItems: 'center'
},
'&-up, &-down': {
fontSize: fontSizeIcon,
'&.active': {
color: token.colorPrimary
}
},
[`${componentCls}-column-sorter-up + ${componentCls}-column-sorter-down`]: {
marginTop: '-0.3em'
}
},
[`${componentCls}-column-sorters:hover ${componentCls}-column-sorter`]: {
color: headerIconHoverColor
}
}
};
};
/* harmony default export */ var sorter = (genSorterStyle);
;// ./components/table/style/sticky.ts
const genStickyStyle = token => {
const {
componentCls,
opacityLoading,
tableScrollThumbBg,
tableScrollThumbBgHover,
tableScrollThumbSize,
tableScrollBg,
stickyScrollBarBorderRadius,
lineWidth,
lineType,
tableBorderColor,
zIndexTableFixed
} = token;
const tableBorder = `${(0,cssinjs.unit)(lineWidth)} ${lineType} ${tableBorderColor}`;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-sticky`]: {
'&-holder': {
position: 'sticky',
zIndex: `calc(var(--columns-count) * 2 + ${zIndexTableFixed} + 1)`,
background: token.colorBgContainer
},
'&-scroll': {
position: 'sticky',
bottom: 0,
height: `${(0,cssinjs.unit)(tableScrollThumbSize)} !important`,
zIndex: `calc(var(--columns-count) * 2 + ${zIndexTableFixed} + 1)`,
display: 'flex',
alignItems: 'center',
background: tableScrollBg,
borderTop: tableBorder,
opacity: opacityLoading,
'&:hover': {
transformOrigin: 'center bottom'
},
// fake scrollbar style of sticky
'&-bar': {
height: tableScrollThumbSize,
backgroundColor: tableScrollThumbBg,
borderRadius: stickyScrollBarBorderRadius,
transition: `all ${token.motionDurationSlow}, transform 0s`,
position: 'absolute',
bottom: 0,
'&:hover, &-active': {
backgroundColor: tableScrollThumbBgHover
}
}
}
}
}
};
};
/* harmony default export */ var sticky = (genStickyStyle);
;// ./components/table/style/summary.ts
const genSummaryStyle = token => {
const {
componentCls,
lineWidth,
tableBorderColor,
calc
} = token;
const tableBorder = `${(0,cssinjs.unit)(lineWidth)} ${token.lineType} ${tableBorderColor}`;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-summary`]: {
position: 'relative',
zIndex: token.zIndexTableFixed,
background: token.tableBg,
'> tr': {
'> th, > td': {
borderBottom: tableBorder
}
}
},
[`div${componentCls}-summary`]: {
boxShadow: `0 ${(0,cssinjs.unit)(calc(lineWidth).mul(-1).equal())} 0 ${tableBorderColor}`
}
}
};
};
/* harmony default export */ var summary = (genSummaryStyle);
;// ./components/table/style/virtual.ts
const genVirtualStyle = token => {
const {
componentCls,
motionDurationMid,
lineWidth,
lineType,
tableBorderColor,
calc
} = token;
const tableBorder = `${(0,cssinjs.unit)(lineWidth)} ${lineType} ${tableBorderColor}`;
const rowCellCls = `${componentCls}-expanded-row-cell`;
return {
[`${componentCls}-wrapper`]: {
// ========================== Row ==========================
[`${componentCls}-tbody-virtual`]: {
[`${componentCls}-tbody-virtual-holder-inner`]: {
[`
& > ${componentCls}-row,
& > div:not(${componentCls}-row) > ${componentCls}-row
`]: {
display: 'flex',
boxSizing: 'border-box',
width: '100%'
}
},
[`${componentCls}-cell`]: {
borderBottom: tableBorder,
transition: `background-color ${motionDurationMid}`
},
[`${componentCls}-expanded-row`]: {
[`${rowCellCls}${rowCellCls}-fixed`]: {
position: 'sticky',
insetInlineStart: 0,
overflow: 'hidden',
width: `calc(var(--virtual-width) - ${(0,cssinjs.unit)(lineWidth)})`,
borderInlineEnd: 'none'
}
}
},
// ======================== Border =========================
[`${componentCls}-bordered`]: {
[`${componentCls}-tbody-virtual`]: {
'&:after': {
content: '""',
insetInline: 0,
bottom: 0,
borderBottom: tableBorder,
position: 'absolute'
},
[`${componentCls}-cell`]: {
borderInlineEnd: tableBorder,
[`&${componentCls}-cell-fix-right-first:before`]: {
content: '""',
position: 'absolute',
insetBlock: 0,
insetInlineStart: calc(lineWidth).mul(-1).equal(),
borderInlineStart: tableBorder
}
}
},
// Empty placeholder
[`&${componentCls}-virtual`]: {
[`${componentCls}-placeholder ${componentCls}-cell`]: {
borderInlineEnd: tableBorder,
borderBottom: tableBorder
}
}
}
}
};
};
/* harmony default export */ var virtual = (genVirtualStyle);
;// ./components/table/style/index.ts
const genTableStyle = token => {
const {
componentCls,
fontWeightStrong,
tablePaddingVertical,
tablePaddingHorizontal,
tableExpandColumnWidth,
lineWidth,
lineType,
tableBorderColor,
tableFontSize,
tableBg,
tableRadius,
tableHeaderTextColor,
motionDurationMid,
tableHeaderBg,
tableHeaderCellSplitColor,
tableFooterTextColor,
tableFooterBg,
calc
} = token;
const tableBorder = `${(0,cssinjs.unit)(lineWidth)} ${lineType} ${tableBorderColor}`;
return {
[`${componentCls}-wrapper`]: {
clear: 'both',
maxWidth: '100%',
// fix https://github.com/ant-design/ant-design/issues/46177
['--rc-virtual-list-scrollbar-bg']: token.tableScrollBg,
...(0,style.clearFix)(),
[componentCls]: {
...(0,style.resetComponent)(token),
fontSize: tableFontSize,
background: tableBg,
borderRadius: `${(0,cssinjs.unit)(tableRadius)} ${(0,cssinjs.unit)(tableRadius)} 0 0`,
// https://github.com/ant-design/ant-design/issues/47486
scrollbarColor: `${token.tableScrollThumbBg} ${token.tableScrollBg}`
},
// https://github.com/ant-design/ant-design/issues/17611
table: {
width: '100%',
textAlign: 'start',
borderRadius: `${(0,cssinjs.unit)(tableRadius)} ${(0,cssinjs.unit)(tableRadius)} 0 0`,
borderCollapse: 'separate',
borderSpacing: 0
},
// ============================= Cell ==============================
[`
${componentCls}-cell,
${componentCls}-thead > tr > th,
${componentCls}-tbody > tr > th,
${componentCls}-tbody > tr > td,
tfoot > tr > th,
tfoot > tr > td
`]: {
position: 'relative',
padding: `${(0,cssinjs.unit)(tablePaddingVertical)} ${(0,cssinjs.unit)(tablePaddingHorizontal)}`,
overflowWrap: 'break-word'
},
// ============================ Title =============================
[`${componentCls}-title`]: {
padding: `${(0,cssinjs.unit)(tablePaddingVertical)} ${(0,cssinjs.unit)(tablePaddingHorizontal)}`
},
// ============================ Header ============================
[`${componentCls}-thead`]: {
'> tr > th, > tr > td': {
position: 'relative',
color: tableHeaderTextColor,
fontWeight: fontWeightStrong,
textAlign: 'start',
background: tableHeaderBg,
borderBottom: tableBorder,
transition: `background-color ${motionDurationMid} ease`,
"&[colspan]:not([colspan='1'])": {
textAlign: 'center'
},
[`&:not(:last-child):not(${componentCls}-selection-column):not(${componentCls}-row-expand-icon-cell):not([colspan])::before`]: {
position: 'absolute',
top: '50%',
insetInlineEnd: 0,
width: 1,
height: '1.6em',
backgroundColor: tableHeaderCellSplitColor,
transform: 'translateY(-50%)',
transition: `background-color ${motionDurationMid}`,
content: '""'
}
},
'> tr:not(:last-child) > th[colspan]': {
borderBottom: 0
}
},
// ============================ Body ============================
[`${componentCls}-tbody`]: {
'> tr': {
'> th, > td': {
borderBottom: tableBorder,
transition: [`background-color`, `border-color`].map(prop => `${prop} ${motionDurationMid}`).join(', '),
// ========================= Nest Table ===========================
[`
> ${componentCls}-wrapper:only-child,
> ${componentCls}-expanded-row-fixed > ${componentCls}-wrapper:only-child
`]: {
[componentCls]: {
marginBlock: (0,cssinjs.unit)(calc(tablePaddingVertical).mul(-1).equal()),
marginInline: `${(0,cssinjs.unit)(calc(tableExpandColumnWidth).sub(tablePaddingHorizontal).equal())}
${(0,cssinjs.unit)(calc(tablePaddingHorizontal).mul(-1).equal())}`,
[`${componentCls}-tbody > tr:last-child > td`]: {
borderBottomWidth: 0,
'&:first-child, &:last-child': {
borderRadius: 0
}
}
}
}
},
'> th': {
position: 'relative',
color: tableHeaderTextColor,
fontWeight: fontWeightStrong,
textAlign: 'start',
background: tableHeaderBg,
borderBottom: tableBorder,
transition: `background-color ${motionDurationMid} ease`
},
// measure cell styles
[`& > ${componentCls}-measure-cell`]: {
paddingBlock: `0 !important`,
borderBlock: `0 !important`,
[`${componentCls}-measure-cell-content`]: {
height: 0,
overflow: 'hidden',
pointerEvents: 'none'
}
}
}
},
// ============================ Footer ============================
[`${componentCls}-footer`]: {
padding: `${(0,cssinjs.unit)(tablePaddingVertical)} ${(0,cssinjs.unit)(tablePaddingHorizontal)}`,
color: tableFooterTextColor,
background: tableFooterBg
}
}
};
};
const prepareComponentToken = token => {
const {
colorFillAlter,
colorBgContainer,
colorTextHeading,
colorFillSecondary,
colorFillContent,
controlItemBgActive,
controlItemBgActiveHover,
padding,
paddingSM,
paddingXS,
colorBorderSecondary,
borderRadiusLG,
controlHeight,
colorTextPlaceholder,
fontSize,
fontSizeSM,
lineHeight,
lineWidth,
colorIcon,
colorIconHover,
opacityLoading,
controlInteractiveSize
} = token;
const colorFillSecondarySolid = new es.FastColor(colorFillSecondary).onBackground(colorBgContainer).toHexString();
const colorFillContentSolid = new es.FastColor(colorFillContent).onBackground(colorBgContainer).toHexString();
const colorFillAlterSolid = new es.FastColor(colorFillAlter).onBackground(colorBgContainer).toHexString();
const baseColorAction = new es.FastColor(colorIcon);
const baseColorActionHover = new es.FastColor(colorIconHover);
const expandIconHalfInner = controlInteractiveSize / 2 - lineWidth;
const expandIconSize = expandIconHalfInner * 2 + lineWidth * 3;
return {
headerBg: colorFillAlterSolid,
headerColor: colorTextHeading,
headerSortActiveBg: colorFillSecondarySolid,
headerSortHoverBg: colorFillContentSolid,
bodySortBg: colorFillAlterSolid,
rowHoverBg: colorFillAlterSolid,
rowSelectedBg: controlItemBgActive,
rowSelectedHoverBg: controlItemBgActiveHover,
rowExpandedBg: colorFillAlter,
cellPaddingBlock: padding,
cellPaddingInline: padding,
cellPaddingBlockMD: paddingSM,
cellPaddingInlineMD: paddingXS,
cellPaddingBlockSM: paddingXS,
cellPaddingInlineSM: paddingXS,
borderColor: colorBorderSecondary,
headerBorderRadius: borderRadiusLG,
footerBg: colorFillAlterSolid,
footerColor: colorTextHeading,
cellFontSize: fontSize,
cellFontSizeMD: fontSize,
cellFontSizeSM: fontSize,
headerSplitColor: colorBorderSecondary,
fixedHeaderSortActiveBg: colorFillSecondarySolid,
headerFilterHoverBg: colorFillContent,
filterDropdownMenuBg: colorBgContainer,
filterDropdownBg: colorBgContainer,
expandIconBg: colorBgContainer,
selectionColumnWidth: controlHeight,
stickyScrollBarBg: colorTextPlaceholder,
stickyScrollBarBorderRadius: 100,
expandIconMarginTop: (fontSize * lineHeight - lineWidth * 3) / 2 - Math.ceil((fontSizeSM * 1.4 - lineWidth * 3) / 2),
headerIconColor: baseColorAction.clone().setA(baseColorAction.a * opacityLoading).toRgbString(),
headerIconHoverColor: baseColorActionHover.clone().setA(baseColorActionHover.a * opacityLoading).toRgbString(),
expandIconHalfInner,
expandIconSize,
expandIconScale: controlInteractiveSize / expandIconSize
};
};
const zIndexTableFixed = 2;
// ============================== Export ==============================
/* harmony default export */ var table_style = ((0,genStyleUtils.genStyleHooks)('Table', token => {
const {
colorTextHeading,
colorSplit,
colorBgContainer,
controlInteractiveSize: checkboxSize,
headerBg,
headerColor,
headerSortActiveBg,
headerSortHoverBg,
bodySortBg,
rowHoverBg,
rowSelectedBg,
rowSelectedHoverBg,
rowExpandedBg,
cellPaddingBlock,
cellPaddingInline,
cellPaddingBlockMD,
cellPaddingInlineMD,
cellPaddingBlockSM,
cellPaddingInlineSM,
borderColor,
footerBg,
footerColor,
headerBorderRadius,
cellFontSize,
cellFontSizeMD,
cellFontSizeSM,
headerSplitColor,
fixedHeaderSortActiveBg,
headerFilterHoverBg,
filterDropdownBg,
expandIconBg,
selectionColumnWidth,
stickyScrollBarBg,
calc
} = token;
const tableToken = (0,cssinjs_utils_es.mergeToken)(token, {
tableFontSize: cellFontSize,
tableBg: colorBgContainer,
tableRadius: headerBorderRadius,
tablePaddingVertical: cellPaddingBlock,
tablePaddingHorizontal: cellPaddingInline,
tablePaddingVerticalMiddle: cellPaddingBlockMD,
tablePaddingHorizontalMiddle: cellPaddingInlineMD,
tablePaddingVerticalSmall: cellPaddingBlockSM,
tablePaddingHorizontalSmall: cellPaddingInlineSM,
tableBorderColor: borderColor,
tableHeaderTextColor: headerColor,
tableHeaderBg: headerBg,
tableFooterTextColor: footerColor,
tableFooterBg: footerBg,
tableHeaderCellSplitColor: headerSplitColor,
tableHeaderSortBg: headerSortActiveBg,
tableHeaderSortHoverBg: headerSortHoverBg,
tableBodySortBg: bodySortBg,
tableFixedHeaderSortActiveBg: fixedHeaderSortActiveBg,
tableHeaderFilterActiveBg: headerFilterHoverBg,
tableFilterDropdownBg: filterDropdownBg,
tableRowHoverBg: rowHoverBg,
tableSelectedRowBg: rowSelectedBg,
tableSelectedRowHoverBg: rowSelectedHoverBg,
zIndexTableFixed,
tableFontSizeMiddle: cellFontSizeMD,
tableFontSizeSmall: cellFontSizeSM,
tableSelectionColumnWidth: selectionColumnWidth,
tableExpandIconBg: expandIconBg,
tableExpandColumnWidth: calc(checkboxSize).add(calc(token.padding).mul(2)).equal(),
tableExpandedRowBg: rowExpandedBg,
// Dropdown
tableFilterDropdownWidth: 120,
tableFilterDropdownHeight: 264,
tableFilterDropdownSearchWidth: 140,
// Virtual Scroll Bar
tableScrollThumbSize: 8,
// Mac scroll bar size
tableScrollThumbBg: stickyScrollBarBg,
tableScrollThumbBgHover: colorTextHeading,
tableScrollBg: colorSplit
});
return [genTableStyle(tableToken), pagination(tableToken), summary(tableToken), sorter(tableToken), filter(tableToken), bordered(tableToken), radius(tableToken), expand(tableToken), summary(tableToken), empty(tableToken), selection(tableToken), fixed(tableToken), sticky(tableToken), ellipsis(tableToken), size(tableToken), rtl(tableToken), virtual(tableToken)];
}, prepareComponentToken, {
resetFont: false,
unitless: {
expandIconScale: true
}
}));
/***/ }),
/***/ "./components/tabs/style/index.ts":
/*!****************************************************!*\
!*** ./components/tabs/style/index.ts + 1 modules ***!
\****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ tabs_style; },
prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
});
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
// EXTERNAL MODULE: ./components/style/index.tsx
var style = __webpack_require__("./components/style/index.tsx");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
// EXTERNAL MODULE: ./components/style/motion/slide.ts
var slide = __webpack_require__("./components/style/motion/slide.ts");
;// ./components/tabs/style/motion.ts
const genMotionStyle = token => {
const {
componentCls,
motionDurationSlow
} = token;
return [{
[componentCls]: {
[`${componentCls}-switch`]: {
'&-appear, &-enter': {
transition: 'none',
'&-start': {
opacity: 0
},
'&-active': {
opacity: 1,
transition: `opacity ${motionDurationSlow}`
}
},
'&-leave': {
position: 'absolute',
transition: 'none',
inset: 0,
'&-start': {
opacity: 1
},
'&-active': {
opacity: 0,
transition: `opacity ${motionDurationSlow}`
}
}
}
}
},
// Follow code may reuse in other components
[(0,slide.initSlideMotion)(token, 'slide-up'), (0,slide.initSlideMotion)(token, 'slide-down')]];
};
/* harmony default export */ var motion = (genMotionStyle);
;// ./components/tabs/style/index.ts
const genCardStyle = token => {
const {
componentCls,
tabsCardPadding,
cardBg,
cardGutter,
colorBorderSecondary,
itemSelectedColor
} = token;
return {
[`${componentCls}-card`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
margin: 0,
padding: tabsCardPadding,
background: cardBg,
border: `${(0,cssinjs.unit)(token.lineWidth)} ${token.lineType} ${colorBorderSecondary}`,
transition: `all ${token.motionDurationSlow} ${token.motionEaseInOut}`
},
[`${componentCls}-tab-active`]: {
color: itemSelectedColor,
background: token.colorBgContainer
},
[`${componentCls}-tab-focus:has(${componentCls}-tab-btn:focus-visible)`]: (0,style.genFocusOutline)(token, -3),
[`& ${componentCls}-tab${componentCls}-tab-focus ${componentCls}-tab-btn:focus-visible`]: {
outline: 'none'
},
[`${componentCls}-ink-bar`]: {
visibility: 'hidden'
}
},
// ========================== Top & Bottom ==========================
[`&${componentCls}-top, &${componentCls}-bottom`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-tab + ${componentCls}-tab`]: {
marginLeft: {
_skip_check_: true,
value: (0,cssinjs.unit)(cardGutter)
}
}
}
},
[`&${componentCls}-top`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
borderRadius: `${(0,cssinjs.unit)(token.borderRadiusLG)} ${(0,cssinjs.unit)(token.borderRadiusLG)} 0 0`
},
[`${componentCls}-tab-active`]: {
borderBottomColor: token.colorBgContainer
}
}
},
[`&${componentCls}-bottom`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
borderRadius: `0 0 ${(0,cssinjs.unit)(token.borderRadiusLG)} ${(0,cssinjs.unit)(token.borderRadiusLG)}`
},
[`${componentCls}-tab-active`]: {
borderTopColor: token.colorBgContainer
}
}
},
// ========================== Left & Right ==========================
[`&${componentCls}-left, &${componentCls}-right`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-tab + ${componentCls}-tab`]: {
marginTop: (0,cssinjs.unit)(cardGutter)
}
}
},
[`&${componentCls}-left`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
borderRadius: {
_skip_check_: true,
value: `${(0,cssinjs.unit)(token.borderRadiusLG)} 0 0 ${(0,cssinjs.unit)(token.borderRadiusLG)}`
}
},
[`${componentCls}-tab-active`]: {
borderRightColor: {
_skip_check_: true,
value: token.colorBgContainer
}
}
}
},
[`&${componentCls}-right`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
borderRadius: {
_skip_check_: true,
value: `0 ${(0,cssinjs.unit)(token.borderRadiusLG)} ${(0,cssinjs.unit)(token.borderRadiusLG)} 0`
}
},
[`${componentCls}-tab-active`]: {
borderLeftColor: {
_skip_check_: true,
value: token.colorBgContainer
}
}
}
}
}
};
};
const genDropdownStyle = token => {
const {
componentCls,
itemHoverColor,
dropdownEdgeChildVerticalPadding
} = token;
return {
[`${componentCls}-dropdown`]: {
...(0,style.resetComponent)(token),
position: 'absolute',
top: -9999,
left: {
_skip_check_: true,
value: -9999
},
zIndex: token.zIndexPopup,
display: 'block',
'&-hidden': {
display: 'none'
},
[`${componentCls}-dropdown-menu`]: {
maxHeight: token.tabsDropdownHeight,
margin: 0,
padding: `${(0,cssinjs.unit)(dropdownEdgeChildVerticalPadding)} 0`,
overflowX: 'hidden',
overflowY: 'auto',
textAlign: {
_skip_check_: true,
value: 'left'
},
listStyleType: 'none',
backgroundColor: token.colorBgContainer,
backgroundClip: 'padding-box',
borderRadius: token.borderRadiusLG,
outline: 'none',
boxShadow: token.boxShadowSecondary,
'&-item': {
...style.textEllipsis,
display: 'flex',
alignItems: 'center',
minWidth: token.tabsDropdownWidth,
margin: 0,
padding: `${(0,cssinjs.unit)(token.paddingXXS)} ${(0,cssinjs.unit)(token.paddingSM)}`,
color: token.colorText,
fontWeight: 'normal',
fontSize: token.fontSize,
lineHeight: token.lineHeight,
cursor: 'pointer',
transition: `all ${token.motionDurationSlow}`,
'> span': {
flex: 1,
whiteSpace: 'nowrap'
},
'&-remove': {
flex: 'none',
marginLeft: {
_skip_check_: true,
value: token.marginSM
},
color: token.colorIcon,
fontSize: token.fontSizeSM,
background: 'transparent',
border: 0,
cursor: 'pointer',
'&:hover': {
color: itemHoverColor
}
},
'&:hover': {
background: token.controlItemBgHover
},
'&-disabled': {
'&, &:hover': {
color: token.colorTextDisabled,
background: 'transparent',
cursor: 'not-allowed'
}
}
}
}
}
};
};
const genPositionStyle = token => {
const {
componentCls,
margin,
colorBorderSecondary,
horizontalMargin,
verticalItemPadding,
verticalItemMargin,
motionDurationSlow,
calc
} = token;
return {
// ========================== Top & Bottom ==========================
[`${componentCls}-top, ${componentCls}-bottom`]: {
flexDirection: 'column',
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
margin: horizontalMargin,
'&::before': {
position: 'absolute',
right: {
_skip_check_: true,
value: 0
},
left: {
_skip_check_: true,
value: 0
},
borderBottom: `${(0,cssinjs.unit)(token.lineWidth)} ${token.lineType} ${colorBorderSecondary}`,
content: "''"
},
[`${componentCls}-ink-bar`]: {
height: token.lineWidthBold,
'&-animated': {
transition: ['width', 'left', 'right'].map(prop => `${prop} ${motionDurationSlow}`).join(', ')
}
},
[`${componentCls}-nav-wrap`]: {
'&::before, &::after': {
top: 0,
bottom: 0,
width: token.controlHeight
},
'&::before': {
left: {
_skip_check_: true,
value: 0
},
boxShadow: token.boxShadowTabsOverflowLeft
},
'&::after': {
right: {
_skip_check_: true,
value: 0
},
boxShadow: token.boxShadowTabsOverflowRight
},
[`&${componentCls}-nav-wrap-ping-left::before`]: {
opacity: 1
},
[`&${componentCls}-nav-wrap-ping-right::after`]: {
opacity: 1
}
}
}
},
[`${componentCls}-top`]: {
[`> ${componentCls}-nav,
> div > ${componentCls}-nav`]: {
'&::before': {
bottom: 0
},
[`${componentCls}-ink-bar`]: {
bottom: 0
}
}
},
[`${componentCls}-bottom`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
order: 1,
marginTop: margin,
marginBottom: 0,
'&::before': {
top: 0
},
[`${componentCls}-ink-bar`]: {
top: 0
}
},
[`> ${componentCls}-content-holder, > div > ${componentCls}-content-holder`]: {
order: 0
}
},
// ========================== Left & Right ==========================
[`${componentCls}-left, ${componentCls}-right`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
flexDirection: 'column',
minWidth: calc(token.controlHeight).mul(1.25).equal(),
// >>>>>>>>>>> Tab
[`${componentCls}-tab`]: {
padding: verticalItemPadding,
textAlign: 'center'
},
[`${componentCls}-tab + ${componentCls}-tab`]: {
margin: verticalItemMargin
},
// >>>>>>>>>>> Nav
[`${componentCls}-nav-wrap`]: {
flexDirection: 'column',
'&::before, &::after': {
right: {
_skip_check_: true,
value: 0
},
left: {
_skip_check_: true,
value: 0
},
height: token.controlHeight
},
'&::before': {
top: 0,
boxShadow: token.boxShadowTabsOverflowTop
},
'&::after': {
bottom: 0,
boxShadow: token.boxShadowTabsOverflowBottom
},
[`&${componentCls}-nav-wrap-ping-top::before`]: {
opacity: 1
},
[`&${componentCls}-nav-wrap-ping-bottom::after`]: {
opacity: 1
}
},
// >>>>>>>>>>> Ink Bar
[`${componentCls}-ink-bar`]: {
width: token.lineWidthBold,
'&-animated': {
transition: ['height', 'top'].map(prop => `${prop} ${motionDurationSlow}`).join(', ')
}
},
[`${componentCls}-nav-list, ${componentCls}-nav-operations`]: {
flex: '1 0 auto',
// fix safari scroll problem
flexDirection: 'column'
}
}
},
[`${componentCls}-left`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-ink-bar`]: {
right: {
_skip_check_: true,
value: 0
}
}
},
[`> ${componentCls}-content-holder, > div > ${componentCls}-content-holder`]: {
marginLeft: {
_skip_check_: true,
value: (0,cssinjs.unit)(calc(token.lineWidth).mul(-1).equal())
},
borderLeft: {
_skip_check_: true,
value: `${(0,cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`
},
[`> ${componentCls}-content > ${componentCls}-tabpane`]: {
paddingLeft: {
_skip_check_: true,
value: token.paddingLG
}
}
}
},
[`${componentCls}-right`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
order: 1,
[`${componentCls}-ink-bar`]: {
left: {
_skip_check_: true,
value: 0
}
}
},
[`> ${componentCls}-content-holder, > div > ${componentCls}-content-holder`]: {
order: 0,
marginRight: {
_skip_check_: true,
value: calc(token.lineWidth).mul(-1).equal()
},
borderRight: {
_skip_check_: true,
value: `${(0,cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`
},
[`> ${componentCls}-content > ${componentCls}-tabpane`]: {
paddingRight: {
_skip_check_: true,
value: token.paddingLG
}
}
}
}
};
};
const genSizeStyle = token => {
const {
componentCls,
cardPaddingSM,
cardPaddingLG,
cardHeightSM,
cardHeightLG,
horizontalItemPaddingSM,
horizontalItemPaddingLG
} = token;
return {
// >>>>> shared
[componentCls]: {
'&-small': {
[`> ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
padding: horizontalItemPaddingSM,
fontSize: token.titleFontSizeSM
}
}
},
'&-large': {
[`> ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
padding: horizontalItemPaddingLG,
fontSize: token.titleFontSizeLG,
lineHeight: token.lineHeightLG
}
}
}
},
// >>>>> card
[`${componentCls}-card`]: {
// Small
[`&${componentCls}-small`]: {
[`> ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
padding: cardPaddingSM
},
[`${componentCls}-nav-add`]: {
minWidth: cardHeightSM,
minHeight: cardHeightSM
}
},
[`&${componentCls}-bottom`]: {
[`> ${componentCls}-nav ${componentCls}-tab`]: {
borderRadius: `0 0 ${(0,cssinjs.unit)(token.borderRadius)} ${(0,cssinjs.unit)(token.borderRadius)}`
}
},
[`&${componentCls}-top`]: {
[`> ${componentCls}-nav ${componentCls}-tab`]: {
borderRadius: `${(0,cssinjs.unit)(token.borderRadius)} ${(0,cssinjs.unit)(token.borderRadius)} 0 0`
}
},
[`&${componentCls}-right`]: {
[`> ${componentCls}-nav ${componentCls}-tab`]: {
borderRadius: {
_skip_check_: true,
value: `0 ${(0,cssinjs.unit)(token.borderRadius)} ${(0,cssinjs.unit)(token.borderRadius)} 0`
}
}
},
[`&${componentCls}-left`]: {
[`> ${componentCls}-nav ${componentCls}-tab`]: {
borderRadius: {
_skip_check_: true,
value: `${(0,cssinjs.unit)(token.borderRadius)} 0 0 ${(0,cssinjs.unit)(token.borderRadius)}`
}
}
}
},
// Large
[`&${componentCls}-large`]: {
[`> ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
padding: cardPaddingLG
},
[`${componentCls}-nav-add`]: {
minWidth: cardHeightLG,
minHeight: cardHeightLG
}
}
}
}
};
};
const genTabStyle = token => {
const {
componentCls,
itemActiveColor,
itemHoverColor,
iconCls,
tabsHorizontalItemMargin,
horizontalItemPadding,
itemSelectedColor,
itemColor
} = token;
const tabCls = `${componentCls}-tab`;
return {
[tabCls]: {
position: 'relative',
WebkitTouchCallout: 'none',
WebkitTapHighlightColor: 'transparent',
display: 'inline-flex',
alignItems: 'center',
padding: horizontalItemPadding,
fontSize: token.titleFontSize,
background: 'transparent',
border: 0,
outline: 'none',
cursor: 'pointer',
color: itemColor,
'&-btn, &-remove': {
'&:focus:not(:focus-visible), &:active': {
color: itemActiveColor
}
},
'&-btn': {
outline: 'none',
transition: `all ${token.motionDurationSlow}`,
[`${tabCls}-icon:not(:last-child)`]: {
marginInlineEnd: token.marginSM
}
},
'&-remove': {
flex: 'none',
lineHeight: 1,
marginRight: {
_skip_check_: true,
value: token.calc(token.marginXXS).mul(-1).equal()
},
marginLeft: {
_skip_check_: true,
value: token.marginXS
},
color: token.colorIcon,
fontSize: token.fontSizeSM,
background: 'transparent',
border: 'none',
outline: 'none',
cursor: 'pointer',
transition: `all ${token.motionDurationSlow}`,
'&:hover': {
color: token.colorTextHeading
},
...(0,style.genFocusStyle)(token)
},
'&:hover': {
color: itemHoverColor
},
[`&${tabCls}-active ${tabCls}-btn`]: {
color: itemSelectedColor
},
[`&${tabCls}-focus ${tabCls}-btn:focus-visible`]: (0,style.genFocusOutline)(token),
[`&${tabCls}-disabled`]: {
color: token.colorTextDisabled,
cursor: 'not-allowed'
},
[`&${tabCls}-disabled ${tabCls}-btn, &${tabCls}-disabled ${componentCls}-remove`]: {
'&:focus, &:active': {
color: token.colorTextDisabled
}
},
[`& ${tabCls}-remove ${iconCls}`]: {
margin: 0,
verticalAlign: 'middle'
},
[`${iconCls}:not(:last-child)`]: {
marginRight: {
_skip_check_: true,
value: token.marginSM
}
}
},
[`${tabCls} + ${tabCls}`]: {
margin: {
_skip_check_: true,
value: tabsHorizontalItemMargin
}
}
};
};
const genRtlStyle = token => {
const {
componentCls,
tabsHorizontalItemMarginRTL,
iconCls,
cardGutter,
calc
} = token;
const rtlCls = `${componentCls}-rtl`;
return {
[rtlCls]: {
direction: 'rtl',
[`${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
margin: {
_skip_check_: true,
value: tabsHorizontalItemMarginRTL
},
[`${componentCls}-tab:last-of-type`]: {
marginLeft: {
_skip_check_: true,
value: 0
}
},
[iconCls]: {
marginRight: {
_skip_check_: true,
value: 0
},
marginLeft: {
_skip_check_: true,
value: token.marginSM
}
},
[`${componentCls}-tab-remove`]: {
marginRight: {
_skip_check_: true,
value: token.marginXS
},
marginLeft: {
_skip_check_: true,
value: calc(token.marginXXS).mul(-1).equal()
},
[iconCls]: {
margin: 0
}
}
}
},
[`&${componentCls}-left`]: {
[`> ${componentCls}-nav`]: {
order: 1
},
[`> ${componentCls}-content-holder`]: {
order: 0
}
},
[`&${componentCls}-right`]: {
[`> ${componentCls}-nav`]: {
order: 0
},
[`> ${componentCls}-content-holder`]: {
order: 1
}
},
// ====================== Card ======================
[`&${componentCls}-card${componentCls}-top, &${componentCls}-card${componentCls}-bottom`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-tab + ${componentCls}-tab`]: {
marginRight: {
_skip_check_: true,
value: cardGutter
},
marginLeft: {
_skip_check_: true,
value: 0
}
}
}
}
},
[`${componentCls}-dropdown-rtl`]: {
direction: 'rtl'
},
[`${componentCls}-menu-item`]: {
[`${componentCls}-dropdown-rtl`]: {
textAlign: {
_skip_check_: true,
value: 'right'
}
}
}
};
};
const genTabsStyle = token => {
const {
componentCls,
tabsCardPadding,
cardHeight,
cardGutter,
itemHoverColor,
itemActiveColor,
colorBorderSecondary
} = token;
return {
[componentCls]: {
...(0,style.resetComponent)(token),
display: 'flex',
// ========================== Navigation ==========================
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
position: 'relative',
display: 'flex',
flex: 'none',
alignItems: 'center',
[`${componentCls}-nav-wrap`]: {
position: 'relative',
display: 'flex',
flex: 'auto',
alignSelf: 'stretch',
overflow: 'hidden',
whiteSpace: 'nowrap',
transform: 'translate(0)',
// Fix chrome render bug
// >>>>> Ping shadow
'&::before, &::after': {
position: 'absolute',
zIndex: 1,
opacity: 0,
transition: `opacity ${token.motionDurationSlow}`,
content: "''",
pointerEvents: 'none'
}
},
[`${componentCls}-nav-list`]: {
position: 'relative',
display: 'flex',
transition: `opacity ${token.motionDurationSlow}`
},
// >>>>>>>> Operations
[`${componentCls}-nav-operations`]: {
display: 'flex',
alignSelf: 'stretch'
},
[`${componentCls}-nav-operations-hidden`]: {
position: 'absolute',
visibility: 'hidden',
pointerEvents: 'none'
},
[`${componentCls}-nav-more`]: {
position: 'relative',
padding: tabsCardPadding,
background: 'transparent',
border: 0,
color: token.colorText,
'&::after': {
position: 'absolute',
right: {
_skip_check_: true,
value: 0
},
bottom: 0,
left: {
_skip_check_: true,
value: 0
},
height: token.calc(token.controlHeightLG).div(8).equal(),
transform: 'translateY(100%)',
content: "''"
}
},
[`${componentCls}-nav-add`]: {
minWidth: cardHeight,
minHeight: cardHeight,
marginLeft: {
_skip_check_: true,
value: cardGutter
},
background: 'transparent',
border: `${(0,cssinjs.unit)(token.lineWidth)} ${token.lineType} ${colorBorderSecondary}`,
borderRadius: `${(0,cssinjs.unit)(token.borderRadiusLG)} ${(0,cssinjs.unit)(token.borderRadiusLG)} 0 0`,
outline: 'none',
cursor: 'pointer',
color: token.colorText,
transition: `all ${token.motionDurationSlow} ${token.motionEaseInOut}`,
'&:hover': {
color: itemHoverColor
},
'&:active, &:focus:not(:focus-visible)': {
color: itemActiveColor
},
...(0,style.genFocusStyle)(token, -3)
}
},
[`${componentCls}-extra-content`]: {
flex: 'none'
},
// ============================ InkBar ============================
[`${componentCls}-ink-bar`]: {
position: 'absolute',
background: token.inkBarColor,
pointerEvents: 'none'
},
// ============================= Tabs =============================
...genTabStyle(token),
// =========================== TabPanes ===========================
[`${componentCls}-content`]: {
position: 'relative',
width: '100%'
},
[`${componentCls}-content-holder`]: {
flex: 'auto',
minWidth: 0,
minHeight: 0
},
[`${componentCls}-tabpane`]: {
...(0,style.genFocusStyle)(token),
'&-hidden': {
display: 'none'
}
}
},
[`${componentCls}-centered`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-nav-wrap`]: {
[`&:not([class*='${componentCls}-nav-wrap-ping']) > ${componentCls}-nav-list`]: {
margin: 'auto'
}
}
}
}
};
};
const prepareComponentToken = token => {
const {
cardHeight,
cardHeightSM,
cardHeightLG,
controlHeight,
controlHeightLG
} = token;
const mergedCardHeight = cardHeight || controlHeightLG;
const mergedCardHeightSM = cardHeightSM || controlHeight;
// `controlHeight` missing XL variable, so we directly write it here:
const mergedCardHeightLG = cardHeightLG || controlHeightLG + 8;
return {
zIndexPopup: token.zIndexPopupBase + 50,
cardBg: token.colorFillAlter,
// We can not pass this as valid value,
// Since `cardHeight` will lock nav add button height.
cardHeight: mergedCardHeight,
cardHeightSM: mergedCardHeightSM,
cardHeightLG: mergedCardHeightLG,
// Initialize with empty string, because cardPadding will be calculated with cardHeight by default.
cardPadding: `${(mergedCardHeight - token.fontHeight) / 2 - token.lineWidth}px ${token.padding}px`,
cardPaddingSM: `${(mergedCardHeightSM - token.fontHeight) / 2 - token.lineWidth}px ${token.paddingXS}px`,
cardPaddingLG: `${(mergedCardHeightLG - token.fontHeightLG) / 2 - token.lineWidth}px ${token.padding}px`,
titleFontSize: token.fontSize,
titleFontSizeLG: token.fontSizeLG,
titleFontSizeSM: token.fontSize,
inkBarColor: token.colorPrimary,
horizontalMargin: `0 0 ${token.margin}px 0`,
horizontalItemGutter: 32,
// Fixed Value
// Initialize with empty string, because horizontalItemMargin will be calculated with horizontalItemGutter by default.
horizontalItemMargin: ``,
horizontalItemMarginRTL: ``,
horizontalItemPadding: `${token.paddingSM}px 0`,
horizontalItemPaddingSM: `${token.paddingXS}px 0`,
horizontalItemPaddingLG: `${token.padding}px 0`,
verticalItemPadding: `${token.paddingXS}px ${token.paddingLG}px`,
verticalItemMargin: `${token.margin}px 0 0 0`,
itemColor: token.colorText,
itemSelectedColor: token.colorPrimary,
itemHoverColor: token.colorPrimaryHover,
itemActiveColor: token.colorPrimaryActive,
cardGutter: token.marginXXS / 2
};
};
// ============================== Export ==============================
/* harmony default export */ var tabs_style = ((0,genStyleUtils.genStyleHooks)('Tabs', token => {
const tabsToken = (0,es.mergeToken)(token, {
// `cardPadding` is empty by default, so we could calculate with dynamic `cardHeight`
tabsCardPadding: token.cardPadding,
dropdownEdgeChildVerticalPadding: token.paddingXXS,
tabsDropdownHeight: 200,
tabsDropdownWidth: 120,
tabsHorizontalItemMargin: `0 0 0 ${(0,cssinjs.unit)(token.horizontalItemGutter)}`,
tabsHorizontalItemMarginRTL: `0 0 0 ${(0,cssinjs.unit)(token.horizontalItemGutter)}`
});
return [genSizeStyle(tabsToken), genRtlStyle(tabsToken), genPositionStyle(tabsToken), genDropdownStyle(tabsToken), genCardStyle(tabsToken), genTabsStyle(tabsToken), motion(tabsToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/tag/style/index.ts":
/*!***************************************!*\
!*** ./components/tag/style/index.ts ***!
\***************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; },
/* harmony export */ prepareToken: function() { return /* binding */ prepareToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ant-design/fast-color */ "./node_modules/@ant-design/fast-color/es/index.js");
/* harmony import */ var _color_picker_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../color-picker/color */ "./components/color-picker/color.ts");
/* harmony import */ var _color_picker_components_ColorPresets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../color-picker/components/ColorPresets */ "./components/color-picker/components/ColorPresets.tsx");
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
// ============================== Styles ==============================
const genBaseStyle = token => {
const {
paddingXXS,
lineWidth,
tagPaddingHorizontal,
componentCls,
calc
} = token;
const paddingInline = calc(tagPaddingHorizontal).sub(lineWidth).equal();
const iconMarginInline = calc(paddingXXS).sub(lineWidth).equal();
return {
// Result
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_4__.resetComponent)(token),
display: 'inline-block',
height: 'auto',
paddingInline,
fontSize: token.tagFontSize,
lineHeight: token.tagLineHeight,
whiteSpace: 'nowrap',
backgroundColor: token.defaultBg,
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
borderRadius: token.borderRadiusSM,
opacity: 1,
transition: `all ${token.motionDurationMid}`,
textAlign: 'start',
position: 'relative',
// RTL
[`&${componentCls}-rtl`]: {
direction: 'rtl'
},
'&, a, a:hover': {
color: token.defaultColor
},
[`${componentCls}-close-icon`]: {
marginInlineStart: iconMarginInline,
fontSize: token.tagIconSize,
color: token.colorIcon,
cursor: 'pointer',
transition: `all ${token.motionDurationMid}`,
'&:hover': {
color: token.colorTextHeading
}
},
'&-checkable': {
backgroundColor: 'transparent',
borderColor: 'transparent',
cursor: 'pointer',
[`&:not(${componentCls}-checkable-checked):hover`]: {
color: token.colorPrimary,
backgroundColor: token.colorFillSecondary
},
'&:active, &-checked': {
color: token.colorTextLightSolid
},
'&-checked': {
backgroundColor: token.colorPrimary,
'&:hover': {
backgroundColor: token.colorPrimaryHover
}
},
'&:active': {
backgroundColor: token.colorPrimaryActive
},
'&-disabled': {
cursor: 'not-allowed',
[`&:not(${componentCls}-checkable-checked)`]: {
color: token.colorTextDisabled,
'&:hover': {
backgroundColor: 'transparent'
}
},
[`&${componentCls}-checkable-checked`]: {
color: token.colorTextDisabled,
backgroundColor: token.colorBgContainerDisabled
},
'&:hover, &:active': {
backgroundColor: token.colorBgContainerDisabled,
color: token.colorTextDisabled
},
[`&:not(${componentCls}-checkable-checked):hover`]: {
color: token.colorTextDisabled
}
},
'&-group': {
display: 'flex',
flexWrap: 'wrap',
gap: token.paddingXS
}
},
'&-hidden': {
display: 'none'
},
// To ensure that a space will be placed between character and `Icon`.
[`> ${token.iconCls} + span, > span + ${token.iconCls}`]: {
marginInlineStart: paddingInline
}
},
[`&${token.componentCls}-solid`]: {
borderColor: 'transparent',
color: token.colorTextLightSolid,
backgroundColor: token.colorBgSolid,
[`&${componentCls}-default`]: {
color: token.solidTextColor
}
},
[`${componentCls}-filled`]: {
borderColor: 'transparent',
backgroundColor: token.tagBorderlessBg
},
[`&${componentCls}-disabled`]: {
color: token.colorTextDisabled,
cursor: 'not-allowed',
backgroundColor: token.colorBgContainerDisabled,
a: {
cursor: 'not-allowed',
pointerEvents: 'none',
color: token.colorTextDisabled,
'&:hover': {
color: token.colorTextDisabled
}
},
'a&': {
'&:hover, &:active': {
color: token.colorTextDisabled
}
},
[`&${componentCls}-outlined`]: {
borderColor: token.colorBorderDisabled
},
[`&${componentCls}-solid, &${componentCls}-filled`]: {
color: token.colorTextDisabled,
[`${componentCls}-close-icon`]: {
color: token.colorTextDisabled
}
},
[`${componentCls}-close-icon`]: {
cursor: 'not-allowed',
color: token.colorTextDisabled,
'&:hover': {
color: token.colorTextDisabled
}
}
}
};
};
// ============================== Export ==============================
const prepareToken = token => {
const {
lineWidth,
fontSizeIcon,
calc
} = token;
const tagFontSize = token.fontSizeSM;
const tagToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_5__.mergeToken)(token, {
tagFontSize,
tagLineHeight: (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(calc(token.lineHeightSM).mul(tagFontSize).equal()),
tagIconSize: calc(fontSizeIcon).sub(calc(lineWidth).mul(2)).equal(),
// Tag icon is much smaller
tagPaddingHorizontal: 8,
// Fixed padding.
tagBorderlessBg: token.defaultBg
});
return tagToken;
};
const prepareComponentToken = token => {
const solidTextColor = (0,_color_picker_components_ColorPresets__WEBPACK_IMPORTED_MODULE_3__.isBright)(new _color_picker_color__WEBPACK_IMPORTED_MODULE_2__.AggregationColor(token.colorBgSolid), '#fff') ? '#000' : '#fff';
return {
defaultBg: new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__.FastColor(token.colorFillTertiary).onBackground(token.colorBgContainer).toHexString(),
defaultColor: token.colorText,
solidTextColor
};
};
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_6__.genStyleHooks)('Tag', token => {
const tagToken = prepareToken(token);
return genBaseStyle(tagToken);
}, prepareComponentToken));
/***/ }),
/***/ "./components/theme/context.ts":
/*!*************************************!*\
!*** ./components/theme/context.ts ***!
\*************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ DesignTokenContext: function() { return /* binding */ DesignTokenContext; },
/* harmony export */ defaultConfig: function() { return /* binding */ defaultConfig; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _themes_seed__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./themes/seed */ "./components/theme/themes/seed.ts");
// ================================ Context =================================
// To ensure snapshot stable. We disable hashed in test env.
const defaultConfig = {
token: _themes_seed__WEBPACK_IMPORTED_MODULE_1__["default"],
override: {
override: _themes_seed__WEBPACK_IMPORTED_MODULE_1__["default"]
},
hashed: true
};
const DesignTokenContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(defaultConfig);
/***/ }),
/***/ "./components/theme/interface/presetColors.ts":
/*!****************************************************!*\
!*** ./components/theme/interface/presetColors.ts ***!
\****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ PresetColors: function() { return /* binding */ PresetColors; }
/* harmony export */ });
const PresetColors = ['blue', 'purple', 'cyan', 'green', 'magenta', 'pink', 'red', 'orange', 'yellow', 'volcano', 'geekblue', 'lime', 'gold'];
/***/ }),
/***/ "./components/theme/themes/default/index.ts":
/*!**************************************************************!*\
!*** ./components/theme/themes/default/index.ts + 5 modules ***!
\**************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ derivative; }
});
// EXTERNAL MODULE: ./node_modules/@ant-design/colors/es/index.js + 2 modules
var es = __webpack_require__("./node_modules/@ant-design/colors/es/index.js");
// EXTERNAL MODULE: ./components/theme/themes/seed.ts
var seed = __webpack_require__("./components/theme/themes/seed.ts");
// EXTERNAL MODULE: ./components/theme/themes/shared/genColorMapToken.ts
var genColorMapToken = __webpack_require__("./components/theme/themes/shared/genColorMapToken.ts");
;// ./components/theme/themes/shared/genRadius.ts
const genRadius = radiusBase => {
let radiusLG = radiusBase;
let radiusSM = radiusBase;
let radiusXS = radiusBase;
let radiusOuter = radiusBase;
// radiusLG
if (radiusBase < 6 && radiusBase >= 5) {
radiusLG = radiusBase + 1;
} else if (radiusBase < 16 && radiusBase >= 6) {
radiusLG = radiusBase + 2;
} else if (radiusBase >= 16) {
radiusLG = 16;
}
// radiusSM
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;
}
// radiusXS
if (radiusBase < 6 && radiusBase >= 2) {
radiusXS = 1;
} else if (radiusBase >= 6) {
radiusXS = 2;
}
// radiusOuter
if (radiusBase > 4 && radiusBase < 8) {
radiusOuter = 4;
} else if (radiusBase >= 8) {
radiusOuter = 6;
}
return {
borderRadius: radiusBase,
borderRadiusXS: radiusXS,
borderRadiusSM: radiusSM,
borderRadiusLG: radiusLG,
borderRadiusOuter: radiusOuter
};
};
/* harmony default export */ var shared_genRadius = (genRadius);
;// ./components/theme/themes/shared/genCommonMapToken.ts
function genCommonMapToken(token) {
const {
motionUnit,
motionBase,
borderRadius,
lineWidth
} = token;
return {
// 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,
// radius
...shared_genRadius(borderRadius)
};
}
// EXTERNAL MODULE: ./components/theme/themes/shared/genControlHeight.ts
var genControlHeight = __webpack_require__("./components/theme/themes/shared/genControlHeight.ts");
// EXTERNAL MODULE: ./components/theme/themes/shared/genFontMapToken.ts
var genFontMapToken = __webpack_require__("./components/theme/themes/shared/genFontMapToken.ts");
;// ./components/theme/themes/shared/genSizeMapToken.ts
function genSizeMapToken(token) {
const {
sizeUnit,
sizeStep
} = token;
return {
sizeXXL: sizeUnit * (sizeStep + 8),
// 48
sizeXL: sizeUnit * (sizeStep + 4),
// 32
sizeLG: sizeUnit * (sizeStep + 2),
// 24
sizeMD: sizeUnit * (sizeStep + 1),
// 20
sizeMS: sizeUnit * sizeStep,
// 16
size: sizeUnit * sizeStep,
// 16
sizeSM: sizeUnit * (sizeStep - 1),
// 12
sizeXS: sizeUnit * (sizeStep - 2),
// 8
sizeXXS: sizeUnit * (sizeStep - 3) // 4
};
}
// EXTERNAL MODULE: ./node_modules/@ant-design/fast-color/es/index.js + 3 modules
var fast_color_es = __webpack_require__("./node_modules/@ant-design/fast-color/es/index.js");
;// ./components/theme/themes/default/colorAlgorithm.ts
const getAlphaColor = (baseColor, alpha) => new fast_color_es.FastColor(baseColor).setA(alpha).toRgbString();
const getSolidColor = (baseColor, brightness) => {
const instance = new fast_color_es.FastColor(baseColor);
return instance.darken(brightness).toHexString();
};
;// ./components/theme/themes/default/colors.ts
const generateColorPalettes = baseColor => {
const colors = (0,es.generate)(baseColor);
return {
1: colors[0],
2: colors[1],
3: colors[2],
4: colors[3],
5: colors[4],
6: colors[5],
7: colors[6],
8: colors[4],
9: colors[5],
10: colors[6]
};
};
const generateNeutralColorPalettes = (bgBaseColor, textBaseColor, shadowColor) => {
const colorBgBase = bgBaseColor || '#fff';
const colorTextBase = textBaseColor || '#000';
const colorShadow = shadowColor || '#000';
return {
colorBgBase,
colorTextBase,
colorShadow,
colorText: getAlphaColor(colorTextBase, 0.88),
colorTextSecondary: getAlphaColor(colorTextBase, 0.65),
colorTextTertiary: getAlphaColor(colorTextBase, 0.45),
colorTextQuaternary: getAlphaColor(colorTextBase, 0.25),
colorFill: getAlphaColor(colorTextBase, 0.15),
colorFillSecondary: getAlphaColor(colorTextBase, 0.06),
colorFillTertiary: getAlphaColor(colorTextBase, 0.04),
colorFillQuaternary: getAlphaColor(colorTextBase, 0.02),
colorBgSolid: getAlphaColor(colorTextBase, 1),
colorBgSolidHover: getAlphaColor(colorTextBase, 0.75),
colorBgSolidActive: getAlphaColor(colorTextBase, 0.95),
colorBgLayout: getSolidColor(colorBgBase, 4),
colorBgContainer: getSolidColor(colorBgBase, 0),
colorBgElevated: getSolidColor(colorBgBase, 0),
colorBgSpotlight: getAlphaColor(colorTextBase, 0.85),
colorBgBlur: 'transparent',
colorBorder: getSolidColor(colorBgBase, 15),
colorBorderDisabled: getSolidColor(colorBgBase, 15),
colorBorderSecondary: getSolidColor(colorBgBase, 6)
};
};
;// ./components/theme/themes/default/index.ts
function derivative(token) {
// pink is deprecated name of magenta, keep this for backwards compatibility
es.presetPrimaryColors.pink = es.presetPrimaryColors.magenta;
es.presetPalettes.pink = es.presetPalettes.magenta;
const colorPalettes = Object.keys(seed.defaultPresetColors).map(colorKey => {
const colors = token[colorKey] === es.presetPrimaryColors[colorKey] ? es.presetPalettes[colorKey] : (0,es.generate)(token[colorKey]);
return Array.from({
length: 10
}, () => 1).reduce((prev, _, i) => {
prev[`${colorKey}-${i + 1}`] = colors[i];
prev[`${colorKey}${i + 1}`] = colors[i];
return prev;
}, {});
}).reduce((prev, cur) => {
prev = {
...prev,
...cur
};
return prev;
}, {});
return {
...token,
...colorPalettes,
// Colors
...(0,genColorMapToken["default"])(token, {
generateColorPalettes: generateColorPalettes,
generateNeutralColorPalettes: generateNeutralColorPalettes
}),
// Font
...(0,genFontMapToken["default"])(token.fontSize),
// Size
...genSizeMapToken(token),
// Height
...(0,genControlHeight["default"])(token),
// Others
...genCommonMapToken(token)
};
}
/***/ }),
/***/ "./components/theme/themes/default/theme.ts":
/*!**************************************************!*\
!*** ./components/theme/themes/default/theme.ts ***!
\**************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index */ "./components/theme/themes/default/index.ts");
const defaultTheme = (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.createTheme)(_index__WEBPACK_IMPORTED_MODULE_1__["default"]);
/* harmony default export */ __webpack_exports__["default"] = (defaultTheme);
/***/ }),
/***/ "./components/theme/themes/seed.ts":
/*!*****************************************!*\
!*** ./components/theme/themes/seed.ts ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ defaultPresetColors: function() { return /* binding */ defaultPresetColors; }
/* harmony export */ });
const defaultPresetColors = {
blue: '#1677FF',
purple: '#722ED1',
cyan: '#13C2C2',
green: '#52C41A',
magenta: '#EB2F96',
/**
* @deprecated Use magenta instead
*/
pink: '#EB2F96',
red: '#F5222D',
orange: '#FA8C16',
yellow: '#FADB14',
volcano: '#FA541C',
geekblue: '#2F54EB',
gold: '#FAAD14',
lime: '#A0D911'
};
const seedToken = {
// preset color palettes
...defaultPresetColors,
// Color
colorPrimary: '#1677ff',
colorSuccess: '#52c41a',
colorWarning: '#faad14',
colorError: '#ff4d4f',
colorInfo: '#1677ff',
colorLink: '',
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'`,
fontFamilyCode: `'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace`,
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: 1000,
// Image
opacityImage: 1,
// Wireframe
wireframe: false,
// Motion
motion: true
};
/* harmony default export */ __webpack_exports__["default"] = (seedToken);
/***/ }),
/***/ "./components/theme/themes/shared/genColorMapToken.ts":
/*!************************************************************!*\
!*** ./components/theme/themes/shared/genColorMapToken.ts ***!
\************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ genColorMapToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/fast-color */ "./node_modules/@ant-design/fast-color/es/index.js");
/* harmony import */ var _interface_presetColors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../interface/presetColors */ "./components/theme/interface/presetColors.ts");
function genColorMapToken(seed, {
generateColorPalettes,
generateNeutralColorPalettes
}) {
const {
colorSuccess: colorSuccessBase,
colorWarning: colorWarningBase,
colorError: colorErrorBase,
colorInfo: colorInfoBase,
colorPrimary: colorPrimaryBase,
colorBgBase,
colorTextBase
} = seed;
const primaryColors = generateColorPalettes(colorPrimaryBase);
const successColors = generateColorPalettes(colorSuccessBase);
const warningColors = generateColorPalettes(colorWarningBase);
const errorColors = generateColorPalettes(colorErrorBase);
const infoColors = generateColorPalettes(colorInfoBase);
const neutralColors = generateNeutralColorPalettes(colorBgBase, colorTextBase);
// Color Link
const colorLink = seed.colorLink || seed.colorInfo;
const linkColors = generateColorPalettes(colorLink);
const colorErrorBgFilledHover = new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_0__.FastColor(errorColors[1]).mix(new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_0__.FastColor(errorColors[3]), 50).toHexString();
const presetColorTokens = {};
_interface_presetColors__WEBPACK_IMPORTED_MODULE_1__.PresetColors.forEach(colorKey => {
const colorBase = seed[colorKey];
if (colorBase) {
const colorPalette = generateColorPalettes(colorBase);
presetColorTokens[`${colorKey}Hover`] = colorPalette[5];
presetColorTokens[`${colorKey}Active`] = colorPalette[7];
}
});
return {
...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],
colorErrorBgFilledHover,
colorErrorBgActive: errorColors[3],
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],
colorLinkHover: linkColors[4],
colorLink: linkColors[6],
colorLinkActive: linkColors[7],
...presetColorTokens,
colorBgMask: new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_0__.FastColor('#000').setA(0.45).toRgbString(),
colorWhite: '#fff'
};
}
/***/ }),
/***/ "./components/theme/themes/shared/genControlHeight.ts":
/*!************************************************************!*\
!*** ./components/theme/themes/shared/genControlHeight.ts ***!
\************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__) {
"use strict";
const genControlHeight = token => {
const {
controlHeight
} = token;
return {
controlHeightSM: controlHeight * 0.75,
controlHeightXS: controlHeight * 0.5,
controlHeightLG: controlHeight * 1.25
};
};
/* harmony default export */ __webpack_exports__["default"] = (genControlHeight);
/***/ }),
/***/ "./components/theme/themes/shared/genFontMapToken.ts":
/*!***********************************************************!*\
!*** ./components/theme/themes/shared/genFontMapToken.ts ***!
\***********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _genFontSizes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./genFontSizes */ "./components/theme/themes/shared/genFontSizes.ts");
const genFontMapToken = fontSize => {
const fontSizePairs = (0,_genFontSizes__WEBPACK_IMPORTED_MODULE_0__["default"])(fontSize);
const fontSizes = fontSizePairs.map(pair => pair.size);
const lineHeights = fontSizePairs.map(pair => pair.lineHeight);
const fontSizeMD = fontSizes[1];
const fontSizeSM = fontSizes[0];
const fontSizeLG = fontSizes[2];
const lineHeight = lineHeights[1];
const lineHeightSM = lineHeights[0];
const lineHeightLG = lineHeights[2];
return {
fontSizeSM,
fontSize: fontSizeMD,
fontSizeLG,
fontSizeXL: fontSizes[3],
fontSizeHeading1: fontSizes[6],
fontSizeHeading2: fontSizes[5],
fontSizeHeading3: fontSizes[4],
fontSizeHeading4: fontSizes[3],
fontSizeHeading5: fontSizes[2],
lineHeight,
lineHeightLG,
lineHeightSM,
fontHeight: Math.round(lineHeight * fontSizeMD),
fontHeightLG: Math.round(lineHeightLG * fontSizeLG),
fontHeightSM: Math.round(lineHeightSM * fontSizeSM),
lineHeightHeading1: lineHeights[6],
lineHeightHeading2: lineHeights[5],
lineHeightHeading3: lineHeights[4],
lineHeightHeading4: lineHeights[3],
lineHeightHeading5: lineHeights[2]
};
};
/* harmony default export */ __webpack_exports__["default"] = (genFontMapToken);
/***/ }),
/***/ "./components/theme/themes/shared/genFontSizes.ts":
/*!********************************************************!*\
!*** ./components/theme/themes/shared/genFontSizes.ts ***!
\********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ getFontSizes; },
/* harmony export */ getLineHeight: function() { return /* binding */ getLineHeight; }
/* harmony export */ });
function getLineHeight(fontSize) {
return (fontSize + 8) / fontSize;
}
// https://zhuanlan.zhihu.com/p/32746810
function getFontSizes(base) {
const fontSizes = Array.from({
length: 10
}).map((_, index) => {
const i = index - 1;
const baseSize = base * Math.E ** (i / 5);
const intSize = index > 1 ? Math.floor(baseSize) : Math.ceil(baseSize);
// Convert to even
return Math.floor(intSize / 2) * 2;
});
fontSizes[1] = base;
return fontSizes.map(size => ({
size,
lineHeight: getLineHeight(size)
}));
}
/***/ }),
/***/ "./components/theme/useToken.ts":
/*!**************************************!*\
!*** ./components/theme/useToken.ts ***!
\**************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ useToken; },
/* harmony export */ unitless: function() { return /* binding */ unitless; }
/* harmony export */ });
/* unused harmony exports ignore, getComputedToken */
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _config_provider_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../config-provider/context */ "./components/config-provider/context.ts");
/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../version */ "./components/version/index.tsx");
/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./context */ "./components/theme/context.ts");
/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./context */ "./components/theme/themes/default/theme.ts");
/* harmony import */ var _themes_seed__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./themes/seed */ "./components/theme/themes/seed.ts");
/* harmony import */ var _util_alias__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./util/alias */ "./components/theme/util/alias.ts");
const unitless = {
lineHeight: true,
lineHeightSM: true,
lineHeightLG: true,
lineHeightHeading1: true,
lineHeightHeading2: true,
lineHeightHeading3: true,
lineHeightHeading4: true,
lineHeightHeading5: true,
opacityLoading: true,
fontWeightStrong: true,
zIndexPopupBase: true,
zIndexBase: true,
opacityImage: true
};
const ignore = {
motionBase: true,
motionUnit: true
};
const preserve = {
screenXS: true,
screenXSMin: true,
screenXSMax: true,
screenSM: true,
screenSMMin: true,
screenSMMax: true,
screenMD: true,
screenMDMin: true,
screenMDMax: true,
screenLG: true,
screenLGMin: true,
screenLGMax: true,
screenXL: true,
screenXLMin: true,
screenXLMax: true,
screenXXL: true,
screenXXLMin: true,
screenXXLMax: true,
screenXXXL: true,
screenXXXLMin: true
};
const getComputedToken = (originToken, overrideToken, theme) => {
const derivativeToken = theme.getDerivativeToken(originToken);
const {
override,
...components
} = overrideToken;
// Merge with override
let mergedDerivativeToken = {
...derivativeToken,
override
};
// Format if needed
mergedDerivativeToken = (0,_util_alias__WEBPACK_IMPORTED_MODULE_7__["default"])(mergedDerivativeToken);
if (components) {
Object.entries(components).forEach(([key, value]) => {
const {
theme: componentTheme,
...componentTokens
} = value;
let mergedComponentToken = componentTokens;
if (componentTheme) {
mergedComponentToken = getComputedToken({
...mergedDerivativeToken,
...componentTokens
}, {
override: componentTokens
}, componentTheme);
}
mergedDerivativeToken[key] = mergedComponentToken;
});
}
return mergedDerivativeToken;
};
// ================================== Hook ==================================
function useToken() {
const {
token: rootDesignToken,
hashed,
theme,
override,
cssVar: ctxCssVar,
zeroRuntime
} = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(_context__WEBPACK_IMPORTED_MODULE_4__.DesignTokenContext);
const {
csp
} = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(_config_provider_context__WEBPACK_IMPORTED_MODULE_2__.ConfigContext);
const cssVar = {
prefix: ctxCssVar?.prefix ?? 'ant',
key: ctxCssVar?.key ?? 'css-var-root'
};
const salt = `${_version__WEBPACK_IMPORTED_MODULE_3__["default"]}-${hashed || ''}`;
const mergedTheme = theme || _context__WEBPACK_IMPORTED_MODULE_5__["default"];
const [token, hashId, realToken] = (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_1__.useCacheToken)(mergedTheme, [_themes_seed__WEBPACK_IMPORTED_MODULE_6__["default"], rootDesignToken], {
salt,
override,
getComputedToken,
cssVar: {
...cssVar,
unitless,
ignore,
preserve
},
nonce: csp?.nonce
});
return [mergedTheme, realToken, hashed ? hashId : '', token, cssVar, !!zeroRuntime];
}
/***/ }),
/***/ "./components/theme/util/alias.ts":
/*!****************************************!*\
!*** ./components/theme/util/alias.ts ***!
\****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ formatToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/fast-color */ "./node_modules/@ant-design/fast-color/es/index.js");
/* harmony import */ var _themes_seed__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../themes/seed */ "./components/theme/themes/seed.ts");
/* harmony import */ var _getAlphaColor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getAlphaColor */ "./components/theme/util/getAlphaColor.ts");
/**
* Seed (designer) > Derivative (designer) > Alias (developer).
*
* Merge seed & derivative & override token and generate alias token for developer.
*/
function formatToken(derivativeToken) {
const {
override,
...restToken
} = derivativeToken;
const overrideTokens = {
...override
};
Object.keys(_themes_seed__WEBPACK_IMPORTED_MODULE_1__["default"]).forEach(token => {
delete overrideTokens[token];
});
const mergedToken = {
...restToken,
...overrideTokens
};
const shadowBaseColor = new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_0__.FastColor(mergedToken.colorShadow);
const shadowBaseAlpha = shadowBaseColor.a;
const getShadowColor = alpha => shadowBaseColor.clone().setA(shadowBaseAlpha * alpha).toRgbString();
const screenXS = 480;
const screenSM = 576;
const screenMD = 768;
const screenLG = 992;
const screenXL = 1200;
const screenXXL = 1600;
const screenXXXL = 1920;
// Motion
if (mergedToken.motion === false) {
const fastDuration = '0s';
mergedToken.motionDurationFast = fastDuration;
mergedToken.motionDurationMid = fastDuration;
mergedToken.motionDurationSlow = fastDuration;
}
// Generate alias token
const aliasToken = {
...mergedToken,
// ============== Background ============== //
colorFillContent: mergedToken.colorFillSecondary,
colorFillContentHover: mergedToken.colorFill,
colorFillAlter: mergedToken.colorFillQuaternary,
colorBgContainerDisabled: mergedToken.colorFillTertiary,
// ============== Split ============== //
colorBorderBg: mergedToken.colorBgContainer,
colorSplit: (0,_getAlphaColor__WEBPACK_IMPORTED_MODULE_2__["default"])(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: (0,_getAlphaColor__WEBPACK_IMPORTED_MODULE_2__["default"])(mergedToken.colorErrorBg, mergedToken.colorBgContainer),
colorWarningOutline: (0,_getAlphaColor__WEBPACK_IMPORTED_MODULE_2__["default"])(mergedToken.colorWarningBg, mergedToken.colorBgContainer),
// Font
fontSizeIcon: mergedToken.fontSizeSM,
// Line
lineWidthFocus: mergedToken.lineWidth * 3,
// 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: (0,_getAlphaColor__WEBPACK_IMPORTED_MODULE_2__["default"])(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 6px 16px 0 ${getShadowColor(0.08)},
0 3px 6px -4px ${getShadowColor(0.12)},
0 9px 28px 8px ${getShadowColor(0.05)}
`,
boxShadowSecondary: `
0 6px 16px 0 ${getShadowColor(0.08)},
0 3px 6px -4px ${getShadowColor(0.12)},
0 9px 28px 8px ${getShadowColor(0.05)}
`,
boxShadowTertiary: `
0 1px 2px 0 ${getShadowColor(0.03)},
0 1px 6px -1px ${getShadowColor(0.02)},
0 2px 4px 0 ${getShadowColor(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,
boxShadowPopoverArrow: `2px 2px 5px ${getShadowColor(0.05)}`,
boxShadowCard: `
0 1px 2px -2px ${getShadowColor(0.16)},
0 3px 6px 0 ${getShadowColor(0.12)},
0 5px 12px 4px ${getShadowColor(0.09)}
`,
boxShadowDrawerRight: `
-6px 0 16px 0 ${getShadowColor(0.08)},
-3px 0 6px -4px ${getShadowColor(0.12)},
-9px 0 28px 8px ${getShadowColor(0.05)}
`,
boxShadowDrawerLeft: `
6px 0 16px 0 ${getShadowColor(0.08)},
3px 0 6px -4px ${getShadowColor(0.12)},
9px 0 28px 8px ${getShadowColor(0.05)}
`,
boxShadowDrawerUp: `
0 6px 16px 0 ${getShadowColor(0.08)},
0 3px 6px -4px ${getShadowColor(0.12)},
0 9px 28px 8px ${getShadowColor(0.05)}
`,
boxShadowDrawerDown: `
0 -6px 16px 0 ${getShadowColor(0.08)},
0 -3px 6px -4px ${getShadowColor(0.12)},
0 -9px 28px 8px ${getShadowColor(0.05)}
`,
boxShadowTabsOverflowLeft: `inset 10px 0 8px -8px ${getShadowColor(0.08)}`,
boxShadowTabsOverflowRight: `inset -10px 0 8px -8px ${getShadowColor(0.08)}`,
boxShadowTabsOverflowTop: `inset 0 10px 8px -8px ${getShadowColor(0.08)}`,
boxShadowTabsOverflowBottom: `inset 0 -10px 8px -8px ${getShadowColor(0.08)}`,
// Override AliasToken
...overrideTokens
};
return aliasToken;
}
/***/ }),
/***/ "./components/theme/util/genPresetColor.ts":
/*!*************************************************!*\
!*** ./components/theme/util/genPresetColor.ts ***!
\*************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ genPresetColor; }
/* harmony export */ });
/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../interface */ "./components/theme/interface/presetColors.ts");
function genPresetColor(token, genCss) {
return _interface__WEBPACK_IMPORTED_MODULE_0__.PresetColors.reduce((prev, colorKey) => {
const lightColor = token[`${colorKey}1`];
const lightBorderColor = token[`${colorKey}3`];
const darkColor = token[`${colorKey}6`];
const textColor = token[`${colorKey}7`];
return {
...prev,
...genCss(colorKey, {
lightColor,
lightBorderColor,
darkColor,
textColor
})
};
}, {});
}
/***/ }),
/***/ "./components/theme/util/genStyleUtils.ts":
/*!************************************************!*\
!*** ./components/theme/util/genStyleUtils.ts ***!
\************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ genComponentStyleHook: function() { return /* binding */ genComponentStyleHook; },
/* harmony export */ genCssVar: function() { return /* binding */ genCssVar; },
/* harmony export */ genStyleHooks: function() { return /* binding */ genStyleHooks; },
/* harmony export */ genSubStyleComponent: function() { return /* binding */ genSubStyleComponent; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _ant_design_cssinjs_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ant-design/cssinjs-utils */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _config_provider_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config-provider/context */ "./components/config-provider/context.ts");
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _useToken__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../useToken */ "./components/theme/useToken.ts");
const {
genStyleHooks,
genComponentStyleHook,
genSubStyleComponent
} = (0,_ant_design_cssinjs_utils__WEBPACK_IMPORTED_MODULE_1__.genStyleUtils)({
usePrefix: () => {
const {
getPrefixCls,
iconPrefixCls
} = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_config_provider_context__WEBPACK_IMPORTED_MODULE_2__.ConfigContext);
const rootPrefixCls = getPrefixCls();
return {
rootPrefixCls,
iconPrefixCls
};
},
useToken: () => {
const [theme, realToken, hashId, token, cssVar, zeroRuntime] = (0,_useToken__WEBPACK_IMPORTED_MODULE_4__["default"])();
return {
theme,
realToken,
hashId,
token,
cssVar,
zeroRuntime
};
},
useCSP: () => {
const {
csp
} = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_config_provider_context__WEBPACK_IMPORTED_MODULE_2__.ConfigContext);
return csp ?? {};
},
getResetStyles: (token, config) => {
const linkStyle = (0,_style__WEBPACK_IMPORTED_MODULE_3__.genLinkStyle)(token);
return [linkStyle, {
'&': linkStyle
}, (0,_style__WEBPACK_IMPORTED_MODULE_3__.genIconStyle)(config?.prefix.iconPrefixCls ?? _config_provider_context__WEBPACK_IMPORTED_MODULE_2__.defaultIconPrefixCls)];
},
getCommonStyle: _style__WEBPACK_IMPORTED_MODULE_3__.genCommonStyle,
getCompUnitless: () => _useToken__WEBPACK_IMPORTED_MODULE_4__.unitless
});
const genCssVar = (antCls, component) => {
const cssPrefix = `--${antCls.replace(/\./g, '')}-${component}-`;
const varName = name => {
return `${cssPrefix}${name}`;
};
const varRef = (name, fallback) => {
return fallback ? `var(${cssPrefix}${name}, ${fallback})` : `var(${cssPrefix}${name})`;
};
return [varName, varRef];
};
/***/ }),
/***/ "./components/theme/util/getAlphaColor.ts":
/*!************************************************!*\
!*** ./components/theme/util/getAlphaColor.ts ***!
\************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/fast-color */ "./node_modules/@ant-design/fast-color/es/index.js");
function isStableColor(color) {
return color >= 0 && color <= 255;
}
function getAlphaColor(frontColor, backgroundColor) {
const {
r: fR,
g: fG,
b: fB,
a: originAlpha
} = new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_0__.FastColor(frontColor).toRgb();
if (originAlpha < 1) {
return frontColor;
}
const {
r: bR,
g: bG,
b: bB
} = new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_0__.FastColor(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 _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_0__.FastColor({
r,
g,
b,
a: Math.round(fA * 100) / 100
}).toRgbString();
}
}
// fallback
/* istanbul ignore next */
return new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_0__.FastColor({
r: fR,
g: fG,
b: fB,
a: 1
}).toRgbString();
}
/* harmony default export */ __webpack_exports__["default"] = (getAlphaColor);
/***/ }),
/***/ "./components/theme/util/useResetIconStyle.ts":
/*!****************************************************!*\
!*** ./components/theme/util/useResetIconStyle.ts ***!
\****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _useToken__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../useToken */ "./components/theme/useToken.ts");
const useResetIconStyle = (iconPrefixCls, csp) => {
const [theme, token] = (0,_useToken__WEBPACK_IMPORTED_MODULE_2__["default"])();
// Generate style for icons
return (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.useStyleRegister)({
theme,
token,
hashId: '',
path: ['ant-design-icons', iconPrefixCls],
nonce: () => csp?.nonce,
layer: {
name: 'antd'
}
}, () => (0,_style__WEBPACK_IMPORTED_MODULE_1__.genIconStyle)(iconPrefixCls));
};
/* harmony default export */ __webpack_exports__["default"] = (useResetIconStyle);
/***/ }),
/***/ "./components/time-picker/locale/en_US.ts":
/*!************************************************!*\
!*** ./components/time-picker/locale/en_US.ts ***!
\************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__) {
"use strict";
const locale = {
placeholder: 'Select time',
rangePlaceholder: ['Start time', 'End time']
};
/* harmony default export */ __webpack_exports__["default"] = (locale);
/***/ }),
/***/ "./components/timeline/style/index.ts":
/*!********************************************************!*\
!*** ./components/timeline/style/index.ts + 1 modules ***!
\********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ timeline_style; },
prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
});
// EXTERNAL MODULE: ./components/style/index.tsx
var style = __webpack_require__("./components/style/index.tsx");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
;// ./components/timeline/style/horizontal.ts
const genHorizontalStyle = token => {
const {
componentCls,
fontHeight,
antCls,
paddingXS
} = token;
const [stepsVarName, stepsVarRef] = (0,genStyleUtils.genCssVar)(antCls, 'cmp-steps');
const [timelineVarName, timelineVarRef] = (0,genStyleUtils.genCssVar)(antCls, 'timeline');
const itemCls = `${componentCls}-item`;
return {
[`${componentCls}-horizontal`]: {
[stepsVarName('title-vertical-row-gap')]: paddingXS,
[timelineVarName('content-height')]: (0,cssinjs.unit)(fontHeight),
// =============================================================
// == Share ==
// =============================================================
alignItems: 'stretch',
// =============================================================
// == Alternate ==
// =============================================================
[`&${componentCls}-layout-alternate`]: {
[itemCls]: {
[`${itemCls}-wrapper`]: {
[timelineVarName('alternate-content-offset')]: `calc(${timelineVarRef('content-height')} + ${stepsVarRef('title-vertical-row-gap')} * 2 + ${stepsVarRef('icon-size-max')})`,
height: `calc(${timelineVarRef('content-height')} * 2 + ${stepsVarRef('title-vertical-row-gap')} * 2 + ${stepsVarRef('icon-size-max')})`
},
// Icon
[`${itemCls}-icon`]: {
position: 'absolute'
},
// Icon & Rail
[`${itemCls}-icon, ${itemCls}-rail`]: {
position: 'absolute',
top: '50%',
transform: 'translateY(-50%)',
margin: 0
},
// Title & Content
[`${itemCls}-title, ${itemCls}-subtitle, ${itemCls}-content`]: {
whiteSpace: 'nowrap',
maxWidth: 'unset'
},
// Title
[`${itemCls}-title`]: {
position: 'absolute',
left: {
_skip_check_: true,
value: '50%'
},
transform: 'translateX(-50%)'
},
// Content
[`${itemCls}-content`]: {
position: 'absolute',
left: {
_skip_check_: true,
value: '50%'
},
transform: 'translateX(-50%)'
},
// Placement
'&-placement-start': {
[`${itemCls}-title`]: {
bottom: timelineVarRef('alternate-content-offset')
},
[`${itemCls}-content`]: {
top: timelineVarRef('alternate-content-offset')
}
},
'&-placement-end': {
[`${itemCls}-title`]: {
top: timelineVarRef('alternate-content-offset')
},
[`${itemCls}-content`]: {
bottom: timelineVarRef('alternate-content-offset')
}
}
}
},
// =============================================================
// == Same Side ==
// =============================================================
[`&:not(${componentCls}-layout-alternate)`]: {
[`${itemCls}-placement-end`]: {
display: 'flex',
alignItems: 'flex-end',
[`${itemCls}-wrapper`]: {
flex: 'auto',
flexDirection: 'column-reverse'
},
[`${itemCls}-rail`]: {
top: 'auto',
bottom: stepsVarRef('horizontal-rail-margin'),
transform: 'translateY(50%)'
}
}
}
}
};
};
/* harmony default export */ var horizontal = (genHorizontalStyle);
;// ./components/timeline/style/index.ts
const genTimelineStyle = token => {
const {
componentCls,
tailColor,
fontHeight,
dotSize,
dotBg,
dotBorderWidth,
fontSize,
lineHeight,
colorText,
tailWidth,
colorPrimary,
colorError,
colorSuccess,
colorTextDisabled,
antCls
} = token;
const itemCls = `${componentCls}-item`;
const [varName, varRef] = (0,genStyleUtils.genCssVar)(antCls, 'cmp-steps');
return {
[componentCls]: [
// ==============================================================
// == Item ==
// ==============================================================
{
...(0,style.resetComponent)(token),
[itemCls]: {
[varName('title-horizontal-title-height')]: fontHeight,
[varName('vertical-rail-margin')]: '0px',
[varName('title-horizontal-rail-gap')]: '0px',
// Root Level: Record Steps icon size and support fallback
[varName('icon-dot-size-origin')]: varRef('icon-size-active'),
[varName('icon-dot-size-custom')]: dotSize,
// Item Level: Record Steps icon color and support fallback
[varName('item-icon-dot-bg-color-origin')]: varRef('item-icon-dot-bg-color'),
[varName('item-icon-dot-bg-color-custom')]: dotBg,
[varName('icon-size')]: varRef('icon-dot-size-custom', varRef('icon-dot-size-origin')),
// Icon
[`${itemCls}-icon`]: {
[varName('dot-icon-border-width')]: dotBorderWidth,
[varName('dot-icon-size')]: varRef('icon-size'),
[varName('item-icon-dot-bg-color')]: varRef('item-icon-dot-bg-color-custom', varRef('item-icon-dot-bg-color-origin'))
},
// Title
[`${itemCls}-title`]: {
fontSize,
lineHeight
},
// Content
[`${itemCls}-content`]: {
color: colorText
},
// Rail
[`${itemCls}-rail`]: {
[varName('item-solid-line-color')]: tailColor,
[varName('rail-size')]: tailWidth
}
}
},
// ==============================================================
// == Status ==
// ==============================================================
{
[itemCls]: {
[varName('item-process-rail-line-style')]: 'dotted'
},
[`${itemCls}${itemCls}${itemCls}-color`]: {
'&-blue': {
[varName('item-icon-dot-color')]: colorPrimary
},
'&-red': {
[varName('item-icon-dot-color')]: colorError
},
'&-green': {
[varName('item-icon-dot-color')]: colorSuccess
},
'&-gray': {
[varName('item-icon-dot-color')]: colorTextDisabled
}
}
}]
};
};
const genVerticalStyle = token => {
const {
calc,
componentCls,
itemPaddingBottom,
margin,
antCls
} = token;
const itemCls = `${componentCls}-item`;
const [, stepsVarRef] = (0,genStyleUtils.genCssVar)(antCls, 'cmp-steps');
const [timelineVarName, timelineVarRef] = (0,genStyleUtils.genCssVar)(antCls, 'timeline');
return {
[`${componentCls}:not(${componentCls}-horizontal)`]: {
[timelineVarName('head-span')]: '12',
[timelineVarName('head-span-ptg')]: `calc(${timelineVarRef('head-span')} / 24 * 100%)`,
// =============================================================
// == Alternate ==
// =============================================================
[`&${componentCls}-layout-alternate`]: {
[itemCls]: {
[timelineVarName('alternate-gap')]: calc(margin).mul(2).add(stepsVarRef('dot-icon-size')).equal(),
minHeight: 'auto',
paddingBottom: itemPaddingBottom,
// Icon & Rail
[`${itemCls}-icon, ${itemCls}-rail`]: {
position: 'absolute',
insetInlineStart: timelineVarRef('head-span-ptg')
},
// Icon
[`${itemCls}-icon`]: {
marginInlineStart: `calc(${stepsVarRef('icon-size')} / -2)`
},
// Section
[`${itemCls}-section`]: {
display: 'flex',
flexWrap: 'nowrap',
gap: timelineVarRef('alternate-gap')
},
// >>> Header
[`${itemCls}-header`]: {
textAlign: 'end',
flexDirection: 'column',
alignItems: 'stretch',
flex: `1 1 calc(${timelineVarRef('head-span-ptg')} - ${timelineVarRef('alternate-gap')} / 2)`
},
// >>> Content
[`${itemCls}-content`]: {
textAlign: 'start',
flex: `1 1 calc(100% - ${timelineVarRef('head-span-ptg')} - ${timelineVarRef('alternate-gap')} / 2)`
},
// Placement
'&-placement-end': {
[`${itemCls}-header`]: {
textAlign: 'start',
order: 1
},
[`${itemCls}-content`]: {
textAlign: 'end'
},
[`${itemCls}-icon, ${itemCls}-rail`]: {
insetInlineStart: `calc(100% - ${timelineVarRef('head-span-ptg')})`
}
}
}
},
// =============================================================
// == Same Side ==
// =============================================================
[`&:not(${componentCls}-layout-alternate)`]: {
[`${itemCls}-placement-end`]: {
textAlign: 'end',
[`${itemCls}-icon`]: {
order: 1
},
[`${itemCls}-rail`]: {
insetInlineStart: 'auto',
insetInlineEnd: `calc(${stepsVarRef('icon-size')} / 2)`,
marginInlineEnd: `calc(${stepsVarRef('rail-size')} / -2)`
}
}
}
}
};
};
// ============================== Export ==============================
const prepareComponentToken = token => ({
tailColor: token.colorSplit,
tailWidth: token.lineWidthBold,
dotBorderWidth: token.lineWidthBold,
dotBg: undefined,
dotSize: undefined,
itemPaddingBottom: token.padding * 1.25
});
/* harmony default export */ var timeline_style = ((0,genStyleUtils.genStyleHooks)('Timeline', token => {
const timeLineToken = (0,es.mergeToken)(token, {
itemHeadSize: 10,
customHeadPaddingVertical: token.paddingXXS,
paddingInlineEnd: 2
});
return [genTimelineStyle(timeLineToken), genVerticalStyle(timeLineToken), horizontal(timeLineToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/tooltip/style/index.ts":
/*!*******************************************!*\
!*** ./components/tooltip/style/index.ts ***!
\*******************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _style_motion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../style/motion */ "./components/style/motion/fade.ts");
/* harmony import */ var _style_motion__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../style/motion */ "./components/style/motion/zoom.ts");
/* harmony import */ var _style_placementArrow__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../style/placementArrow */ "./components/style/placementArrow.ts");
/* harmony import */ var _style_roundedArrow__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../style/roundedArrow */ "./components/style/roundedArrow.ts");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../theme/util/genStyleUtils */ "./components/theme/util/genStyleUtils.ts");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genPresetColor.ts");
const FALL_BACK_ORIGIN = '50%';
const genTooltipStyle = token => {
const {
calc,
componentCls,
// ant-tooltip
tooltipMaxWidth,
tooltipColor,
tooltipBg,
tooltipBorderRadius,
zIndexPopup,
controlHeight,
boxShadowSecondary,
paddingSM,
paddingXS,
arrowOffsetHorizontal,
sizePopupArrow,
antCls
} = token;
const [varName, varRef] = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_7__.genCssVar)(antCls, 'tooltip');
// arrowOffsetHorizontal + arrowWidth + borderRadius
const edgeAlignMinWidth = calc(tooltipBorderRadius).add(sizePopupArrow).add(arrowOffsetHorizontal).equal();
// borderRadius * 2 + arrowWidth
const centerAlignMinWidth = calc(tooltipBorderRadius).mul(2).add(sizePopupArrow).equal();
const sharedBodyStyle = {
minWidth: centerAlignMinWidth,
minHeight: controlHeight,
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(paddingSM).div(2).equal())} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingXS)}`,
color: varRef('overlay-color', tooltipColor),
textAlign: 'start',
textDecoration: 'none',
wordWrap: 'break-word',
backgroundColor: tooltipBg,
borderRadius: tooltipBorderRadius,
boxShadow: boxShadowSecondary,
boxSizing: 'border-box'
};
const sharedTransformOrigin = {
// When use `autoArrow`, origin will follow the arrow position
[varName('valid-offset-x')]: varRef('arrow-offset-x', 'var(--arrow-x)'),
transformOrigin: [varRef('valid-offset-x', FALL_BACK_ORIGIN), `var(--arrow-y, ${FALL_BACK_ORIGIN})`].join(' ')
};
return [{
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
position: 'absolute',
zIndex: zIndexPopup,
display: 'block',
width: 'max-content',
maxWidth: tooltipMaxWidth,
visibility: 'visible',
...sharedTransformOrigin,
'&-hidden': {
display: 'none'
},
[varName('arrow-background-color')]: tooltipBg,
// Wrapper for the tooltip content
[`${componentCls}-container`]: [sharedBodyStyle, (0,_style_motion__WEBPACK_IMPORTED_MODULE_2__.initFadeMotion)(token, true)],
[`&:has(~ ${componentCls}-unique-container)`]: {
[`${componentCls}-container`]: {
border: 'none',
background: 'transparent',
boxShadow: 'none'
}
},
// Align placement should have another min width
[[`&-placement-topLeft`, `&-placement-topRight`, `&-placement-bottomLeft`, `&-placement-bottomRight`].join(',')]: {
minWidth: edgeAlignMinWidth
},
// Limit left and right placement radius
[[`&-placement-left`, `&-placement-leftTop`, `&-placement-leftBottom`, `&-placement-right`, `&-placement-rightTop`, `&-placement-rightBottom`].join(',')]: {
[`${componentCls}-inner`]: {
borderRadius: token.min(tooltipBorderRadius, _style_placementArrow__WEBPACK_IMPORTED_MODULE_4__.MAX_VERTICAL_CONTENT_RADIUS)
}
},
[`${componentCls}-content`]: {
position: 'relative'
},
// generator for preset color
...(0,_theme_internal__WEBPACK_IMPORTED_MODULE_8__["default"])(token, (colorKey, {
darkColor
}) => ({
[`&${componentCls}-${colorKey}`]: {
[`${componentCls}-container`]: {
backgroundColor: darkColor
},
[`${componentCls}-arrow`]: {
[varName('arrow-background-color')]: darkColor
}
}
})),
// RTL
'&-rtl': {
direction: 'rtl'
}
}
},
// Arrow Style
(0,_style_placementArrow__WEBPACK_IMPORTED_MODULE_4__["default"])(token, varRef('arrow-background-color')),
// Pure Render
{
[`${componentCls}-pure`]: {
position: 'relative',
maxWidth: 'none',
margin: token.sizePopupArrow
}
},
// Unique Body
{
[`${componentCls}-unique-container`]: {
...sharedBodyStyle,
...sharedTransformOrigin,
position: 'absolute',
zIndex: calc(zIndexPopup).sub(1).equal(),
'&-hidden': {
display: 'none'
},
'&-visible': {
transition: `all ${token.motionDurationSlow}`
}
}
}];
};
// ============================== Export ==============================
const prepareComponentToken = token => ({
zIndexPopup: token.zIndexPopupBase + 70,
maxWidth: 250,
...(0,_style_placementArrow__WEBPACK_IMPORTED_MODULE_4__.getArrowOffsetToken)({
contentRadius: token.borderRadius,
limitVerticalRadius: true
}),
...(0,_style_roundedArrow__WEBPACK_IMPORTED_MODULE_5__.getArrowToken)((0,_theme_internal__WEBPACK_IMPORTED_MODULE_6__.mergeToken)(token, {
borderRadiusOuter: Math.min(token.borderRadiusOuter, 4)
}))
});
/* harmony default export */ __webpack_exports__["default"] = ((prefixCls, rootCls, injectStyle = true) => {
const useStyle = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_7__.genStyleHooks)('Tooltip', token => {
const {
borderRadius,
colorTextLightSolid,
colorBgSpotlight,
maxWidth
} = token;
const TooltipToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_6__.mergeToken)(token, {
// default variables
tooltipMaxWidth: maxWidth,
tooltipColor: colorTextLightSolid,
tooltipBorderRadius: borderRadius,
tooltipBg: colorBgSpotlight
});
return [genTooltipStyle(TooltipToken), (0,_style_motion__WEBPACK_IMPORTED_MODULE_3__.initZoomMotion)(token, 'zoom-big-fast')];
}, prepareComponentToken, {
resetStyle: false,
// Popover use Tooltip as internal component. We do not need to handle this.
injectStyle
});
return useStyle(prefixCls, rootCls);
});
(Object.getOwnPropertyDescriptor(__webpack_exports__["default"], "name") || {}).writable || Object.defineProperty(__webpack_exports__["default"], "name", { value: "default", configurable: true });
/***/ }),
/***/ "./components/tour/style/index.ts":
/*!****************************************!*\
!*** ./components/tour/style/index.ts ***!
\****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ant-design/fast-color */ "./node_modules/@ant-design/fast-color/es/index.js");
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _style_placementArrow__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../style/placementArrow */ "./components/style/placementArrow.ts");
/* harmony import */ var _style_roundedArrow__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../style/roundedArrow */ "./components/style/roundedArrow.ts");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../theme/util/genStyleUtils */ "./components/theme/util/genStyleUtils.ts");
// =============================== Base ===============================
const genBaseStyle = token => {
const {
componentCls,
padding,
paddingXS,
borderRadius,
borderRadiusXS,
colorPrimary,
colorFill,
indicatorHeight,
indicatorWidth,
boxShadowTertiary,
zIndexPopup,
colorBgElevated,
fontWeightStrong,
marginXS,
colorTextLightSolid,
tourBorderRadius,
colorWhite,
primaryNextBtnHoverBg,
closeBtnSize,
motionDurationSlow,
antCls,
primaryPrevBtnBg,
motionDurationMid
} = token;
const [varName, varRef] = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_6__.genCssVar)(antCls, 'tooltip');
return [{
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_2__.resetComponent)(token),
position: 'absolute',
zIndex: zIndexPopup,
maxWidth: 'fit-content',
visibility: 'visible',
width: 520,
[varName('arrow-background-color')]: colorBgElevated,
'&-pure': {
maxWidth: '100%',
position: 'relative'
},
[`&${componentCls}-hidden`]: {
display: 'none'
},
// ============================= panel content ============================
[`${componentCls}-panel`]: {
position: 'relative'
},
[`${componentCls}-section`]: {
textAlign: 'start',
textDecoration: 'none',
borderRadius: tourBorderRadius,
boxShadow: boxShadowTertiary,
position: 'relative',
backgroundColor: colorBgElevated,
border: 'none',
backgroundClip: 'padding-box',
[`${componentCls}-close`]: {
position: 'absolute',
top: padding,
insetInlineEnd: padding,
color: token.colorIcon,
background: 'none',
border: 'none',
width: closeBtnSize,
height: closeBtnSize,
borderRadius: token.borderRadiusSM,
transition: ['color', 'background-color'].map(prop => `${prop} ${motionDurationMid}`).join(', '),
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
cursor: 'pointer',
'&:hover': {
color: token.colorIconHover,
backgroundColor: token.colorBgTextHover
},
'&:active': {
backgroundColor: token.colorBgTextActive
},
...(0,_style__WEBPACK_IMPORTED_MODULE_2__.genFocusStyle)(token)
},
[`${componentCls}-cover`]: {
textAlign: 'center',
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(padding).add(closeBtnSize).add(paddingXS).equal())} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(padding)} 0`,
img: {
width: '100%'
}
},
[`${componentCls}-header`]: {
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(padding)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(padding)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingXS)}`,
width: `calc(100% - ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(closeBtnSize)})`,
wordBreak: 'break-word',
[`${componentCls}-title`]: {
fontWeight: fontWeightStrong
}
},
[`${componentCls}-description`]: {
padding: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(padding)}`,
wordWrap: 'break-word'
},
[`${componentCls}-footer`]: {
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingXS)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(padding)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(padding)}`,
textAlign: 'end',
borderRadius: `0 0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(borderRadiusXS)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(borderRadiusXS)}`,
display: 'flex',
[`${componentCls}-indicators`]: {
display: 'inline-block',
[`${componentCls}-indicator`]: {
width: indicatorWidth,
height: indicatorHeight,
display: 'inline-block',
borderRadius: '50%',
background: colorFill,
'&:not(:last-child)': {
marginInlineEnd: indicatorHeight
},
'&-active': {
background: colorPrimary
}
}
},
[`${componentCls}-actions`]: {
marginInlineStart: 'auto',
[`${antCls}-btn`]: {
marginInlineStart: marginXS
}
}
}
},
// ============================= primary type ===========================
// `$` for panel, `&$` for pure panel
[`${componentCls}-primary, &${componentCls}-primary`]: {
[varName('arrow-background-color')]: colorPrimary,
[`${componentCls}-section`]: {
color: colorTextLightSolid,
textAlign: 'start',
textDecoration: 'none',
backgroundColor: colorPrimary,
borderRadius,
boxShadow: boxShadowTertiary,
[`${componentCls}-close`]: {
color: colorTextLightSolid
},
[`${componentCls}-indicators`]: {
[`${componentCls}-indicator`]: {
background: primaryPrevBtnBg,
'&-active': {
background: colorTextLightSolid
}
}
},
[`${componentCls}-prev-btn`]: {
color: colorTextLightSolid,
borderColor: primaryPrevBtnBg,
backgroundColor: colorPrimary,
'&:hover': {
backgroundColor: primaryPrevBtnBg,
borderColor: 'transparent'
}
},
[`${componentCls}-next-btn`]: {
color: colorPrimary,
borderColor: 'transparent',
background: colorWhite,
'&:hover': {
background: primaryNextBtnHoverBg
}
}
}
}
},
// ============================= mask ===========================
[`${componentCls}-mask`]: {
[`${componentCls}-placeholder-animated`]: {
transition: `all ${motionDurationSlow}`
}
},
// =========== Limit left and right placement radius ==============
[['&-placement-left', '&-placement-leftTop', '&-placement-leftBottom', '&-placement-right', '&-placement-rightTop', '&-placement-rightBottom'].join(',')]: {
[`${componentCls}-section`]: {
borderRadius: token.min(tourBorderRadius, _style_placementArrow__WEBPACK_IMPORTED_MODULE_3__.MAX_VERTICAL_CONTENT_RADIUS)
}
}
},
// ============================= Arrow ===========================
(0,_style_placementArrow__WEBPACK_IMPORTED_MODULE_3__["default"])(token, varRef('arrow-background-color'))];
};
// ============================== Export ==============================
const prepareComponentToken = token => ({
zIndexPopup: token.zIndexPopupBase + 70,
closeBtnSize: token.fontSize * token.lineHeight,
primaryPrevBtnBg: new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__.FastColor(token.colorTextLightSolid).setA(0.15).toRgbString(),
primaryNextBtnHoverBg: new _ant_design_fast_color__WEBPACK_IMPORTED_MODULE_1__.FastColor(token.colorBgTextHover).onBackground(token.colorWhite).toRgbString(),
...(0,_style_placementArrow__WEBPACK_IMPORTED_MODULE_3__.getArrowOffsetToken)({
contentRadius: token.borderRadiusLG,
limitVerticalRadius: true
}),
...(0,_style_roundedArrow__WEBPACK_IMPORTED_MODULE_4__.getArrowToken)(token)
});
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_6__.genStyleHooks)('Tour', token => {
const {
borderRadiusLG
} = token;
const tourToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_5__.mergeToken)(token, {
indicatorWidth: 6,
indicatorHeight: 6,
tourBorderRadius: borderRadiusLG
});
return genBaseStyle(tourToken);
}, prepareComponentToken));
/***/ }),
/***/ "./components/transfer/style/index.ts":
/*!********************************************!*\
!*** ./components/transfer/style/index.ts ***!
\********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../style */ "./components/style/index.tsx");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
const genTransferCustomizeStyle = token => {
const {
antCls,
componentCls,
listHeight,
controlHeightLG
} = token;
const tableCls = `${antCls}-table`;
const inputCls = `${antCls}-input`;
return {
[`${componentCls}-customize-list`]: {
[`${componentCls}-section`]: {
flex: '1 1 50%',
width: 'auto',
height: 'auto',
minHeight: listHeight,
minWidth: 0
},
// =================== Hook Components ===================
[`${tableCls}-wrapper`]: {
[`${tableCls}-small`]: {
border: 0,
borderRadius: 0,
[`${tableCls}-selection-column`]: {
width: controlHeightLG,
minWidth: controlHeightLG
}
},
[`${tableCls}-pagination${tableCls}-pagination`]: {
margin: 0,
padding: token.paddingXS
}
},
[`${inputCls}[disabled]`]: {
backgroundColor: 'transparent'
}
}
};
};
const genTransferStatusColor = (token, color) => {
const {
componentCls,
colorBorder
} = token;
return {
[`${componentCls}-section`]: {
borderColor: color,
[`${componentCls}-list-search:not([disabled])`]: {
borderColor: colorBorder
}
}
};
};
const genTransferStatusStyle = token => {
const {
componentCls
} = token;
return {
[`${componentCls}-status-error`]: {
...genTransferStatusColor(token, token.colorError)
},
[`${componentCls}-status-warning`]: {
...genTransferStatusColor(token, token.colorWarning)
}
};
};
const genTransferListStyle = token => {
const {
componentCls,
colorBorder,
colorSplit,
lineWidth,
itemHeight,
headerHeight,
transferHeaderVerticalPadding,
itemPaddingBlock,
controlItemBgActive,
colorTextDisabled,
colorTextSecondary,
listHeight,
listWidth,
listWidthLG,
fontSizeIcon,
marginXS,
paddingSM,
lineType,
antCls,
iconCls,
motionDurationSlow,
controlItemBgHover,
borderRadiusLG,
colorBgContainer,
colorText,
controlItemBgActiveHover
} = token;
const contentBorderRadius = (0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(borderRadiusLG).sub(lineWidth).equal());
return {
display: 'flex',
flexDirection: 'column',
width: listWidth,
height: listHeight,
border: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${lineType} ${colorBorder}`,
borderRadius: token.borderRadiusLG,
'&-with-pagination': {
width: listWidthLG,
height: 'auto'
},
[`${componentCls}-list`]: {
'&-search': {
[`${iconCls}-search`]: {
color: colorTextDisabled
}
},
'&-header': {
display: 'flex',
flex: 'none',
alignItems: 'center',
height: headerHeight,
// border-top is on the transfer dom. We should minus 1px for this
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(transferHeaderVerticalPadding).sub(lineWidth).equal())} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingSM)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(transferHeaderVerticalPadding)}`,
color: colorText,
background: colorBgContainer,
borderBottom: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${lineType} ${colorSplit}`,
borderRadius: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(borderRadiusLG)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(borderRadiusLG)} 0 0`,
'> *:not(:last-child)': {
marginInlineEnd: 4 // This is magic and fixed number, DO NOT use token since it may change.
},
'> *': {
flex: 'none'
},
'&-title': {
..._style__WEBPACK_IMPORTED_MODULE_1__.textEllipsis,
flex: '0 1 auto',
textAlign: 'end',
marginInlineStart: 'auto'
},
'&-dropdown': {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetIcon)(),
fontSize: fontSizeIcon,
transform: 'translateY(10%)',
cursor: 'pointer',
'&[disabled]': {
cursor: 'not-allowed'
}
}
},
'&-body': {
display: 'flex',
flex: 'auto',
flexDirection: 'column',
fontSize: token.fontSize,
// https://blog.csdn.net/qq449245884/article/details/107373672/
minHeight: 0,
'&-search-wrapper': {
position: 'relative',
flex: 'none',
padding: paddingSM
}
},
'&-content': {
flex: 'auto',
margin: 0,
padding: 0,
overflow: 'auto',
listStyle: 'none',
borderRadius: `0 0 ${contentBorderRadius} ${contentBorderRadius}`,
'&-item': {
display: 'flex',
alignItems: 'center',
minHeight: itemHeight,
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(itemPaddingBlock)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(paddingSM)}`,
transition: `all ${motionDurationSlow}`,
'> *:not(:last-child)': {
marginInlineEnd: marginXS
},
'> *': {
flex: 'none'
},
'&-text': {
..._style__WEBPACK_IMPORTED_MODULE_1__.textEllipsis,
flex: 'auto'
},
'&-remove': {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.operationUnit)(token),
color: colorBorder,
'&:hover, &:focus': {
color: colorTextSecondary
},
'&:disabled': {
color: colorTextDisabled,
cursor: 'not-allowed'
}
},
[`&:not(${componentCls}-list-content-item-disabled)`]: {
'&:hover': {
backgroundColor: controlItemBgHover,
cursor: 'pointer'
},
[`&${componentCls}-list-content-item-checked:hover`]: {
backgroundColor: controlItemBgActiveHover
}
},
'&-checked': {
backgroundColor: controlItemBgActive
},
'&-disabled': {
color: colorTextDisabled,
cursor: 'not-allowed'
}
},
// Do not change hover style when `oneWay` mode
[`&-show-remove ${componentCls}-list-content-item:not(${componentCls}-list-content-item-disabled):hover`]: {
background: 'transparent',
cursor: 'default'
}
},
'&-pagination': {
padding: token.paddingXS,
textAlign: 'end',
borderTop: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${lineType} ${colorSplit}`,
[`${antCls}-pagination-options`]: {
paddingInlineEnd: token.paddingXS
}
},
'&-body-not-found': {
flex: 'none',
width: '100%',
margin: 'auto 0',
color: colorTextDisabled,
textAlign: 'center'
},
'&-footer': {
borderTop: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(lineWidth)} ${lineType} ${colorSplit}`
},
// fix: https://github.com/ant-design/ant-design/issues/44489
'&-checkbox': {
lineHeight: 1
}
}
};
};
const genTransferStyle = token => {
const {
antCls,
iconCls,
componentCls,
marginXS,
marginXXS,
fontSizeIcon,
colorBgContainerDisabled
} = token;
return {
[componentCls]: {
...(0,_style__WEBPACK_IMPORTED_MODULE_1__.resetComponent)(token),
position: 'relative',
display: 'flex',
alignItems: 'stretch',
[`${componentCls}-disabled`]: {
[`${componentCls}-section`]: {
background: colorBgContainerDisabled
}
},
[`${componentCls}-section`]: genTransferListStyle(token),
[`${componentCls}-actions`]: {
display: 'flex',
flex: 'none',
flexDirection: 'column',
alignSelf: 'center',
margin: `0 ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(marginXS)}`,
verticalAlign: 'middle',
gap: marginXXS,
[`${antCls}-btn ${iconCls}`]: {
fontSize: fontSizeIcon
}
}
}
};
};
const genTransferRTLStyle = token => {
const {
componentCls
} = token;
return {
[`${componentCls}-rtl`]: {
direction: 'rtl'
}
};
};
const prepareComponentToken = token => {
const {
fontSize,
lineHeight,
controlHeight,
controlHeightLG,
lineWidth
} = token;
const fontHeight = Math.round(fontSize * lineHeight);
return {
listWidth: 180,
listHeight: 200,
listWidthLG: 250,
headerHeight: controlHeightLG,
itemHeight: controlHeight,
itemPaddingBlock: (controlHeight - fontHeight) / 2,
transferHeaderVerticalPadding: Math.ceil((controlHeightLG - lineWidth - fontHeight) / 2)
};
};
// ============================== Export ==============================
/* harmony default export */ __webpack_exports__["default"] = ((0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genStyleHooks)('Transfer', token => {
const transferToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token);
return [genTransferStyle(transferToken), genTransferCustomizeStyle(transferToken), genTransferStatusStyle(transferToken), genTransferRTLStyle(transferToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/tree-select/style/index.ts":
/*!***********************************************!*\
!*** ./components/tree-select/style/index.ts ***!
\***********************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ useTreeSelectStyle; },
/* harmony export */ prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
/* harmony export */ });
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ "./alias/cssinjs.js");
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _checkbox_style__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../checkbox/style */ "./components/checkbox/style/index.ts");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../theme/internal */ "./node_modules/@ant-design/cssinjs-utils/es/index.js");
/* harmony import */ var _theme_internal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../theme/internal */ "./components/theme/util/genStyleUtils.ts");
/* harmony import */ var _tree_style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../tree/style */ "./components/tree/style/index.ts");
// =============================== Base ===============================
const genBaseStyle = token => {
const {
componentCls,
treePrefixCls,
colorBgElevated
} = token;
const treeCls = `.${treePrefixCls}`;
return [
// ======================================================
// == Dropdown ==
// ======================================================
{
[`${componentCls}-dropdown`]: [{
padding: `${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.paddingXS)} ${(0,_ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.unit)(token.calc(token.paddingXS).div(2).equal())}`
},
// ====================== Tree ======================
(0,_tree_style__WEBPACK_IMPORTED_MODULE_4__.genTreeStyle)(treePrefixCls, (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token, {
colorBgContainer: colorBgElevated
}), false), {
[treeCls]: {
borderRadius: 0,
[`${treeCls}-list-holder-inner`]: {
alignItems: 'stretch',
[`${treeCls}-treenode`]: {
[`${treeCls}-node-content-wrapper`]: {
flex: 'auto'
}
}
}
}
},
// ==================== Checkbox ====================
(0,_checkbox_style__WEBPACK_IMPORTED_MODULE_1__.getStyle)(`${treePrefixCls}-checkbox`, token),
// ====================== RTL =======================
{
'&-rtl': {
direction: 'rtl',
[`${treeCls}-switcher${treeCls}-switcher_close`]: {
[`${treeCls}-switcher-icon svg`]: {
transform: 'rotate(90deg)'
}
}
}
}]
}];
};
const prepareComponentToken = _tree_style__WEBPACK_IMPORTED_MODULE_4__.initComponentToken;
// ============================== Export ==============================
function useTreeSelectStyle(prefixCls, treePrefixCls, rootCls) {
return (0,_theme_internal__WEBPACK_IMPORTED_MODULE_3__.genStyleHooks)('TreeSelect', token => {
const treeSelectToken = (0,_theme_internal__WEBPACK_IMPORTED_MODULE_2__.mergeToken)(token, {
treePrefixCls
});
return genBaseStyle(treeSelectToken);
}, _tree_style__WEBPACK_IMPORTED_MODULE_4__.initComponentToken, {
resetFont: false
})(prefixCls, rootCls);
}
/***/ }),
/***/ "./components/tree/style/index.ts":
/*!****************************************************!*\
!*** ./components/tree/style/index.ts + 1 modules ***!
\****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ tree_style; },
genBaseStyle: function() { return /* binding */ genBaseStyle; },
genTreeStyle: function() { return /* binding */ genTreeStyle; },
initComponentToken: function() { return /* binding */ initComponentToken; },
prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
});
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
// EXTERNAL MODULE: ./components/checkbox/style/index.ts
var style = __webpack_require__("./components/checkbox/style/index.ts");
// EXTERNAL MODULE: ./components/style/index.tsx
var components_style = __webpack_require__("./components/style/index.tsx");
// EXTERNAL MODULE: ./components/style/motion/collapse.ts
var collapse = __webpack_require__("./components/style/motion/collapse.ts");
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
;// ./components/tree/style/directory.ts
// ============================ Directory =============================
const genDirectoryStyle = ({
treeCls,
treeNodeCls,
directoryNodeSelectedBg,
directoryNodeSelectedColor,
motionDurationMid,
borderRadius,
controlItemBgHover
}) => ({
[`${treeCls}${treeCls}-directory ${treeNodeCls}`]: {
// >>> Title
[`${treeCls}-node-content-wrapper`]: {
position: 'static',
[`&:has(${treeCls}-drop-indicator)`]: {
position: 'relative'
},
[`> *:not(${treeCls}-drop-indicator)`]: {
position: 'relative'
},
'&:hover': {
background: 'transparent'
},
// Expand interactive area to whole line
'&:before': {
position: 'absolute',
inset: 0,
transition: `background-color ${motionDurationMid}`,
content: '""',
borderRadius
},
'&:hover:before': {
background: controlItemBgHover
}
},
[`${treeCls}-switcher, ${treeCls}-checkbox, ${treeCls}-draggable-icon`]: {
zIndex: 1
},
// ============= Selected =============
'&-selected': {
background: directoryNodeSelectedBg,
borderRadius,
[`${treeCls}-switcher, ${treeCls}-draggable-icon`]: {
color: directoryNodeSelectedColor
},
// >>> Title
[`${treeCls}-node-content-wrapper`]: {
color: directoryNodeSelectedColor,
background: 'transparent',
'&, &:hover': {
color: directoryNodeSelectedColor
},
'&:before, &:hover:before': {
background: directoryNodeSelectedBg
}
}
}
}
});
;// ./components/tree/style/index.ts
// ============================ Keyframes =============================
const treeNodeFX = new cssinjs.Keyframes('ant-tree-node-fx-do-not-use', {
'0%': {
opacity: 0
},
'100%': {
opacity: 1
}
});
// ============================== Switch ==============================
const getSwitchStyle = (prefixCls, token) => ({
[`.${prefixCls}-switcher-icon`]: {
display: 'inline-block',
fontSize: 10,
verticalAlign: 'baseline',
svg: {
transition: `transform ${token.motionDurationSlow}`
}
}
});
// =============================== Drop ===============================
const getDropIndicatorStyle = (prefixCls, token) => ({
[`.${prefixCls}-drop-indicator`]: {
position: 'absolute',
// it should displayed over the following node
zIndex: 1,
height: 2,
backgroundColor: token.colorPrimary,
borderRadius: 1,
pointerEvents: 'none',
'&:after': {
position: 'absolute',
top: -3,
insetInlineStart: -6,
width: 8,
height: 8,
backgroundColor: 'transparent',
border: `${(0,cssinjs.unit)(token.lineWidthBold)} solid ${token.colorPrimary}`,
borderRadius: '50%',
content: '""'
}
}
});
const genBaseStyle = (prefixCls, token) => {
const {
treeCls,
treeNodeCls,
treeNodePadding,
titleHeight,
indentSize,
switcherSize,
motionDurationMid,
nodeSelectedBg,
nodeHoverBg,
colorTextQuaternary,
controlItemBgActiveDisabled
} = token;
return {
[treeCls]: {
...(0,components_style.resetComponent)(token),
// fix https://github.com/ant-design/ant-design/issues/50316
['--rc-virtual-list-scrollbar-bg']: token.colorSplit,
background: token.colorBgContainer,
borderRadius: token.borderRadius,
transition: `background-color ${token.motionDurationSlow}`,
'&-rtl': {
direction: 'rtl'
},
[`&${treeCls}-rtl ${treeCls}-switcher_close ${treeCls}-switcher-icon svg`]: {
transform: 'rotate(90deg)'
},
// =================== Virtual List ===================
[`${treeCls}-list`]: {
'&:focus-visible': {
outline: 'none',
[`${treeNodeCls}-active ${treeCls}-node-content-wrapper`]: {
...(0,components_style.genFocusOutline)(token)
}
}
},
[`${treeCls}-list-holder-inner`]: {
alignItems: 'flex-start'
},
[`&${treeCls}-block-node`]: {
[`${treeCls}-list-holder-inner`]: {
alignItems: 'stretch',
// >>> Title
[`${treeCls}-node-content-wrapper`]: {
flex: 'auto'
},
// >>> Drag
[`${treeNodeCls}.dragging:after`]: {
position: 'absolute',
inset: 0,
border: `1px solid ${token.colorPrimary}`,
opacity: 0,
animationName: treeNodeFX,
animationDuration: token.motionDurationSlow,
animationPlayState: 'running',
animationFillMode: 'forwards',
content: '""',
pointerEvents: 'none',
borderRadius: token.borderRadius
}
}
},
// ===================== TreeNode =====================
[treeNodeCls]: {
display: 'flex',
alignItems: 'flex-start',
marginBottom: treeNodePadding,
lineHeight: (0,cssinjs.unit)(titleHeight),
position: 'relative',
// 非常重要,避免 drop-indicator 在拖拽过程中闪烁
'&:before': {
content: '""',
position: 'absolute',
zIndex: 1,
insetInlineStart: 0,
width: '100%',
top: '100%',
height: treeNodePadding
},
// Disabled
[`&-disabled ${treeCls}-node-content-wrapper`]: {
color: token.colorTextDisabled,
cursor: 'not-allowed',
'&:hover': {
background: 'transparent'
}
},
[`${treeCls}-checkbox-disabled + ${treeCls}-node-selected,&${treeNodeCls}-disabled${treeNodeCls}-selected ${treeCls}-node-content-wrapper`]: {
backgroundColor: controlItemBgActiveDisabled
},
// we can not set pointer-events to none for checkbox in tree
// ref: https://github.com/ant-design/ant-design/issues/39822#issuecomment-2605234058
[`${treeCls}-checkbox-disabled`]: {
pointerEvents: 'unset'
},
// not disable
[`&:not(${treeNodeCls}-disabled)`]: {
// >>> Title
[`${treeCls}-node-content-wrapper`]: {
'&:hover': {
color: token.nodeHoverColor
}
}
},
[`&-active ${treeCls}-node-content-wrapper`]: {
background: token.controlItemBgHover
},
[`&:not(${treeNodeCls}-disabled).filter-node ${treeCls}-title`]: {
color: token.colorPrimary,
fontWeight: token.fontWeightStrong
},
'&-draggable': {
cursor: 'grab',
[`${treeCls}-draggable-icon`]: {
// https://github.com/ant-design/ant-design/issues/41915
flexShrink: 0,
width: switcherSize,
textAlign: 'center',
visibility: 'visible',
color: colorTextQuaternary
},
[`&${treeNodeCls}-disabled ${treeCls}-draggable-icon`]: {
visibility: 'hidden'
}
}
},
// >>> Indent
[`${treeCls}-indent`]: {
alignSelf: 'stretch',
whiteSpace: 'nowrap',
userSelect: 'none',
'&-unit': {
display: 'inline-block',
width: indentSize
}
},
// >>> Drag Handler
[`${treeCls}-draggable-icon`]: {
visibility: 'hidden'
},
// Switcher / Checkbox
[`${treeCls}-switcher, ${treeCls}-checkbox`]: {
marginInlineEnd: token.calc(token.calc(switcherSize).sub(token.controlInteractiveSize)).div(2).equal()
},
// >>> Checkbox
// https://github.com/ant-design/ant-design/issues/56957
[`${treeCls}-checkbox`]: {
flexShrink: 0,
// When the title spans multiple lines, the checkbox aligns vertically centered with other elements
// However, the switcher aligns to flex-start, causing a vertical alignment discrepancy in the parent node
// Currently, the checkbox uses start alignment, but this causes it to stick to the top, resulting in a visually higher position
// By setting the switcher's lineHeight to titleHeight, the required margin-block-start distance can be calculated to correct the alignment
alignSelf: 'flex-start',
marginBlockStart: token.calc(token.calc(titleHeight).sub(token.controlInteractiveSize)).div(2).equal()
},
// >>> Switcher
[`${treeCls}-switcher`]: {
...getSwitchStyle(prefixCls, token),
position: 'relative',
flex: 'none',
alignSelf: 'stretch',
width: switcherSize,
textAlign: 'center',
cursor: 'pointer',
userSelect: 'none',
transition: `all ${token.motionDurationSlow}`,
'&-noop': {
cursor: 'unset'
},
'&:before': {
pointerEvents: 'none',
content: '""',
width: switcherSize,
height: titleHeight,
position: 'absolute',
left: {
_skip_check_: true,
value: 0
},
top: 0,
borderRadius: token.borderRadius,
transition: `all ${token.motionDurationSlow}`
},
[`&:not(${treeCls}-switcher-noop):hover:before`]: {
backgroundColor: token.colorBgTextHover
},
[`&_close ${treeCls}-switcher-icon svg`]: {
transform: 'rotate(-90deg)'
},
'&-loading-icon': {
color: token.colorPrimary
},
'&-leaf-line': {
position: 'relative',
zIndex: 1,
display: 'inline-block',
width: '100%',
height: '100%',
// https://github.com/ant-design/ant-design/issues/31884
'&:before': {
position: 'absolute',
top: 0,
insetInlineEnd: token.calc(switcherSize).div(2).equal(),
bottom: token.calc(treeNodePadding).mul(-1).equal(),
marginInlineStart: -1,
borderInlineEnd: `1px solid ${token.colorBorder}`,
content: '""'
},
'&:after': {
position: 'absolute',
width: token.calc(token.calc(switcherSize).div(2).equal()).mul(0.8).equal(),
height: token.calc(titleHeight).div(2).equal(),
borderBottom: `1px solid ${token.colorBorder}`,
content: '""'
}
}
},
// >>> Title
// add `${treeCls}-checkbox + span` to cover checkbox `${checkboxCls} + span`
[`${treeCls}-node-content-wrapper`]: {
position: 'relative',
minHeight: titleHeight,
paddingBlock: 0,
paddingInline: token.paddingXS,
background: 'transparent',
borderRadius: token.borderRadius,
cursor: 'pointer',
transition: [`all ${motionDurationMid}`, 'border 0s', 'line-height 0s', 'box-shadow 0s'].join(', '),
...getDropIndicatorStyle(prefixCls, token),
'&:hover': {
backgroundColor: nodeHoverBg
},
[`&${treeCls}-node-selected`]: {
color: token.nodeSelectedColor,
backgroundColor: nodeSelectedBg
},
// Icon
[`${treeCls}-iconEle`]: {
display: 'inline-block',
width: switcherSize,
height: titleHeight,
textAlign: 'center',
verticalAlign: 'top',
'&:empty': {
display: 'none'
}
}
},
// https://github.com/ant-design/ant-design/issues/28217
[`${treeCls}-unselectable ${treeCls}-node-content-wrapper:hover`]: {
backgroundColor: 'transparent'
},
[`${treeNodeCls}.drop-container > [draggable]`]: {
boxShadow: `0 0 0 2px ${token.colorPrimary}`
},
// ==================== Show Line =====================
'&-show-line': {
// ================ Indent lines ================
[`${treeCls}-indent-unit`]: {
position: 'relative',
height: '100%',
'&:before': {
position: 'absolute',
top: 0,
insetInlineEnd: token.calc(switcherSize).div(2).equal(),
bottom: token.calc(treeNodePadding).mul(-1).equal(),
borderInlineEnd: `1px solid ${token.colorBorder}`,
content: '""'
},
'&-end:before': {
display: 'none'
}
},
// ============== Cover Background ==============
[`${treeCls}-switcher`]: {
background: 'transparent',
'&-line-icon': {
// https://github.com/ant-design/ant-design/issues/32813
verticalAlign: '-0.15em'
}
}
},
[`${treeNodeCls}-leaf-last ${treeCls}-switcher-leaf-line:before`]: {
top: 'auto !important',
bottom: 'auto !important',
height: `${(0,cssinjs.unit)(token.calc(titleHeight).div(2).equal())} !important`
}
}
};
};
// ============================== Merged ==============================
const genTreeStyle = (prefixCls, token,
/**
* @descCN 是否启用目录树样式
* @descEN Whether to enable directory style
* @default true
*/
enableDirectory = true) => {
const treeCls = `.${prefixCls}`;
const treeNodeCls = `${treeCls}-treenode`;
const treeNodePadding = token.calc(token.paddingXS).div(2).equal();
const treeToken = (0,es.mergeToken)(token, {
treeCls,
treeNodeCls,
treeNodePadding
});
return [
// Basic
genBaseStyle(prefixCls, treeToken),
// Directory
enableDirectory && genDirectoryStyle(treeToken)].filter(Boolean);
};
const initComponentToken = token => {
const {
controlHeightSM,
controlItemBgHover,
controlItemBgActive
} = token;
const titleHeight = controlHeightSM;
return {
titleHeight,
switcherSize: titleHeight,
indentSize: titleHeight,
nodeHoverBg: controlItemBgHover,
nodeHoverColor: token.colorText,
nodeSelectedBg: controlItemBgActive,
nodeSelectedColor: token.colorText
};
};
const prepareComponentToken = token => {
const {
colorTextLightSolid,
colorPrimary
} = token;
return {
...initComponentToken(token),
directoryNodeSelectedColor: colorTextLightSolid,
directoryNodeSelectedBg: colorPrimary
};
};
/* harmony default export */ var tree_style = ((0,genStyleUtils.genStyleHooks)('Tree', (token, {
prefixCls
}) => [{
[token.componentCls]: (0,style.getStyle)(`${prefixCls}-checkbox`, token)
}, genTreeStyle(prefixCls, token), (0,collapse["default"])(token)], prepareComponentToken));
/***/ }),
/***/ "./components/typography/style/index.ts":
/*!**********************************************************!*\
!*** ./components/typography/style/index.ts + 1 modules ***!
\**********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ typography_style; },
prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
});
// EXTERNAL MODULE: ./components/style/index.tsx
var style = __webpack_require__("./components/style/index.tsx");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
// EXTERNAL MODULE: ./node_modules/@ant-design/colors/es/index.js + 2 modules
var es = __webpack_require__("./node_modules/@ant-design/colors/es/index.js");
;// ./components/typography/style/mixins.ts
/*
.typography-title(@fontSize; @fontWeight; @lineHeight; @headingColor; @headingMarginBottom;) {
margin-bottom: @headingMarginBottom;
color: @headingColor;
font-weight: @fontWeight;
fontSize: @fontSize;
line-height: @lineHeight;
}
*/
const getTitleStyle = (fontSize, lineHeight, color, token) => {
const {
titleMarginBottom,
fontWeightStrong
} = token;
return {
marginBottom: titleMarginBottom,
color,
fontWeight: fontWeightStrong,
fontSize,
lineHeight
};
};
const getTitleStyles = token => {
const headings = [1, 2, 3, 4, 5];
const styles = {};
headings.forEach(headingLevel => {
styles[`
h${headingLevel}&,
div&-h${headingLevel},
div&-h${headingLevel} > textarea,
h${headingLevel}
`] = getTitleStyle(token[`fontSizeHeading${headingLevel}`], token[`lineHeightHeading${headingLevel}`], token.colorTextHeading, token);
});
return styles;
};
const getLinkStyles = token => {
const {
componentCls
} = token;
const linkCls = `${componentCls}-link`;
return {
[`&${linkCls}`]: {
...(0,style.operationUnit)(token),
userSelect: 'text',
[`&[disabled], &${componentCls}-disabled`]: {
color: token.colorTextDisabled,
cursor: 'not-allowed',
'&:active, &:hover': {
color: token.colorTextDisabled
},
'&:active': {
pointerEvents: 'none',
// Action buttons (copy, edit, expand) must remain interactive even when
// the disabled link is being clicked, otherwise their click events get
// swallowed by the parent's pointer-events: none during :active.
[`${componentCls}-actions`]: {
pointerEvents: 'auto'
}
}
}
}
};
};
const getResetStyles = token => ({
code: {
margin: '0 0.2em',
paddingInline: '0.4em',
paddingBlock: '0.2em 0.1em',
fontSize: '85%',
fontFamily: token.fontFamilyCode,
background: 'rgba(150, 150, 150, 0.1)',
border: '1px solid rgba(100, 100, 100, 0.2)',
borderRadius: 3
},
kbd: {
margin: '0 0.2em',
paddingInline: '0.4em',
paddingBlock: '0.15em 0.1em',
fontSize: '90%',
fontFamily: token.fontFamilyCode,
background: 'rgba(150, 150, 150, 0.06)',
border: '1px solid rgba(100, 100, 100, 0.2)',
borderBottomWidth: 2,
borderRadius: 3
},
mark: {
padding: 0,
// FIXME hardcode in v4
backgroundColor: es.gold[2]
},
'u, ins': {
textDecoration: 'underline',
textDecorationSkipInk: 'auto'
},
's, del': {
textDecoration: 'line-through'
},
strong: {
fontWeight: token.fontWeightStrong
},
// list
'ul, ol': {
marginInline: 0,
marginBlock: '0 1em',
padding: 0,
li: {
marginInline: '20px 0',
marginBlock: 0,
paddingInline: '4px 0',
paddingBlock: 0
}
},
ul: {
listStyleType: 'circle',
ul: {
listStyleType: 'disc'
}
},
ol: {
listStyleType: 'decimal'
},
// pre & block
'pre, blockquote': {
margin: '1em 0'
},
pre: {
padding: '0.4em 0.6em',
whiteSpace: 'pre-wrap',
wordWrap: 'break-word',
background: 'rgba(150, 150, 150, 0.1)',
border: '1px solid rgba(100, 100, 100, 0.2)',
borderRadius: 3,
fontFamily: token.fontFamilyCode,
// Compatible for marked
code: {
display: 'inline',
margin: 0,
padding: 0,
fontSize: 'inherit',
fontFamily: 'inherit',
background: 'transparent',
border: 0
}
},
blockquote: {
paddingInline: '0.6em 0',
paddingBlock: 0,
borderInlineStart: '4px solid rgba(100, 100, 100, 0.2)',
opacity: 0.85
}
});
const getEditableStyles = token => {
const {
componentCls,
paddingSM
} = token;
const inputShift = paddingSM;
return {
'&-edit-content': {
position: 'relative',
'div&': {
insetInlineStart: token.calc(token.paddingSM).mul(-1).equal(),
insetBlockStart: token.calc(inputShift).div(-2).add(1).equal(),
marginBottom: token.calc(inputShift).div(2).sub(2).equal()
},
[`${componentCls}-edit-content-confirm`]: {
position: 'absolute',
insetInlineEnd: token.calc(token.marginXS).add(2).equal(),
insetBlockEnd: token.marginXS,
color: token.colorIcon,
// default style
fontWeight: 'normal',
fontSize: token.fontSize,
fontStyle: 'normal',
pointerEvents: 'none'
},
textarea: {
margin: '0!important',
// Fix Editable Textarea flash in Firefox
MozTransition: 'none',
height: '1em'
}
}
};
};
const getCopyableStyles = token => ({
[`${token.componentCls}-copy-success`]: {
'&, &:hover, &:focus': {
color: token.colorSuccess
}
},
[`${token.componentCls}-copy-icon-only`]: {
marginInlineStart: 0
}
});
const getEllipsisStyles = () => ({
'a&-ellipsis, span&-ellipsis': {
display: 'inline-block',
maxWidth: '100%'
},
'&-ellipsis-single-line': {
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
// https://blog.csdn.net/iefreer/article/details/50421025
'a&, span&': {
verticalAlign: 'bottom'
},
'> code': {
paddingBlock: 0,
maxWidth: 'calc(100% - 1.2em)',
display: 'inline-block',
overflow: 'hidden',
textOverflow: 'ellipsis',
verticalAlign: 'bottom',
// https://github.com/ant-design/ant-design/issues/45953
boxSizing: 'content-box'
}
},
'&-ellipsis-multiple-line': {
display: '-webkit-box',
overflow: 'hidden',
WebkitLineClamp: 3,
WebkitBoxOrient: 'vertical'
}
});
;// ./components/typography/style/index.ts
const genTypographyStyle = token => {
const {
componentCls,
titleMarginTop
} = token;
return {
[componentCls]: {
color: token.colorText,
wordBreak: 'break-word',
lineHeight: token.lineHeight,
[`&${componentCls}-secondary, &${componentCls}-link${componentCls}-secondary`]: {
color: token.colorTextDescription
},
[`&${componentCls}-success, &${componentCls}-link${componentCls}-success`]: {
color: token.colorSuccessText
},
[`&${componentCls}-warning, &${componentCls}-link${componentCls}-warning`]: {
color: token.colorWarningText
},
[`&${componentCls}-danger, &${componentCls}-link${componentCls}-danger`]: {
color: token.colorErrorText,
[`&${componentCls}-link:active, &${componentCls}-link:focus`]: {
color: token.colorErrorTextActive
},
[`&${componentCls}-link:hover`]: {
color: token.colorErrorTextHover
}
},
[`&${componentCls}-disabled`]: {
color: token.colorTextDisabled,
cursor: 'not-allowed',
userSelect: 'none'
},
'div&, p': {
marginBottom: '1em'
},
...getTitleStyles(token),
[`& + h1${componentCls}, & + h2${componentCls}, & + h3${componentCls}, & + h4${componentCls}, & + h5${componentCls}`]: {
marginTop: titleMarginTop
},
'div, ul, li, p, h1, h2, h3, h4, h5': {
'+ h1, + h2, + h3, + h4, + h5': {
marginTop: titleMarginTop
}
},
...getResetStyles(token),
...getLinkStyles(token),
// Operation
[`${componentCls}-actions`]: {
display: 'inline'
},
[`
${componentCls}-expand,
${componentCls}-collapse,
${componentCls}-edit,
${componentCls}-copy
`]: {
...(0,style.operationUnit)(token),
marginInlineStart: token.marginXXS
},
...getEditableStyles(token),
...getCopyableStyles(token),
...getEllipsisStyles(),
'&-rtl': {
direction: 'rtl'
}
}
};
};
const prepareComponentToken = () => ({
titleMarginTop: '1.2em',
titleMarginBottom: '0.5em'
});
// ============================== Export ==============================
/* harmony default export */ var typography_style = ((0,genStyleUtils.genStyleHooks)('Typography', genTypographyStyle, prepareComponentToken));
/***/ }),
/***/ "./components/upload/style/index.ts":
/*!******************************************************!*\
!*** ./components/upload/style/index.ts + 5 modules ***!
\******************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ upload_style; },
prepareComponentToken: function() { return /* binding */ prepareComponentToken; }
});
// EXTERNAL MODULE: ./components/style/index.tsx
var style = __webpack_require__("./components/style/index.tsx");
// EXTERNAL MODULE: ./components/style/motion/collapse.ts
var collapse = __webpack_require__("./components/style/motion/collapse.ts");
// EXTERNAL MODULE: ./components/theme/util/genStyleUtils.ts
var genStyleUtils = __webpack_require__("./components/theme/util/genStyleUtils.ts");
// EXTERNAL MODULE: ./node_modules/@ant-design/cssinjs-utils/es/index.js + 12 modules
var es = __webpack_require__("./node_modules/@ant-design/cssinjs-utils/es/index.js");
// EXTERNAL MODULE: ./alias/cssinjs.js
var cssinjs = __webpack_require__("./alias/cssinjs.js");
;// ./components/upload/style/dragger.ts
const genDraggerStyle = token => {
const {
componentCls,
iconCls
} = token;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-drag`]: {
position: 'relative',
width: '100%',
height: '100%',
textAlign: 'center',
background: token.colorFillAlter,
border: `${(0,cssinjs.unit)(token.lineWidth)} dashed ${token.colorBorder}`,
borderRadius: token.borderRadiusLG,
cursor: 'pointer',
transition: `border-color ${token.motionDurationSlow}`,
[componentCls]: {
padding: token.padding
},
[`${componentCls}-btn`]: {
display: 'table',
width: '100%',
height: '100%',
outline: 'none',
borderRadius: token.borderRadiusLG,
'&:focus-visible': {
outline: `${(0,cssinjs.unit)(token.lineWidthFocus)} solid ${token.colorPrimaryBorder}`
}
},
[`${componentCls}-drag-container`]: {
display: 'table-cell',
verticalAlign: 'middle'
},
[`
&:not(${componentCls}-disabled):hover,
&-hover:not(${componentCls}-disabled)
`]: {
borderColor: token.colorPrimaryHover
},
[`p${componentCls}-drag-icon`]: {
marginBottom: token.margin,
[iconCls]: {
color: token.colorPrimary,
fontSize: token.uploadThumbnailSize
}
},
[`p${componentCls}-text`]: {
margin: `0 0 ${(0,cssinjs.unit)(token.marginXXS)}`,
color: token.colorTextHeading,
fontSize: token.fontSizeLG
},
[`p${componentCls}-hint`]: {
color: token.colorTextDescription,
fontSize: token.fontSize
},
// ===================== Disabled =====================
[`&${componentCls}-disabled`]: {
[`p${componentCls}-drag-icon ${iconCls},
p${componentCls}-text,
p${componentCls}-hint
`]: {
color: token.colorTextDisabled
}
}
}
}
};
};
/* harmony default export */ var dragger = (genDraggerStyle);
;// ./components/upload/style/list.ts
const genListStyle = token => {
const {
componentCls,
iconCls,
fontSize,
lineHeight,
motionDurationSlow,
calc
} = token;
const itemCls = `${componentCls}-list-item`;
const actionsCls = `${itemCls}-actions`;
const actionCls = `${itemCls}-action`;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-list`]: {
...(0,style.clearFix)(),
lineHeight: token.lineHeight,
[itemCls]: {
position: 'relative',
height: calc(token.lineHeight).mul(fontSize).equal(),
marginTop: token.marginXS,
fontSize,
display: 'flex',
alignItems: 'center',
transition: `background-color ${motionDurationSlow}`,
borderRadius: token.borderRadiusSM,
'&:hover': {
backgroundColor: token.controlItemBgHover
},
[`${itemCls}-name`]: {
...style.textEllipsis,
padding: `0 ${(0,cssinjs.unit)(token.paddingXS)}`,
lineHeight,
flex: 'auto',
transition: `all ${motionDurationSlow}`
},
[actionsCls]: {
whiteSpace: 'nowrap',
[actionCls]: {
opacity: 0
},
'@media (hover: none), (pointer: coarse)': {
[actionCls]: {
opacity: 1
}
},
[iconCls]: {
color: token.actionsColor,
transition: `all ${motionDurationSlow}`
},
[`
${actionCls}:focus-visible,
&.picture ${actionCls}
`]: {
opacity: 1
}
},
[`${componentCls}-icon ${iconCls}`]: {
color: token.colorIcon,
fontSize
},
[`${itemCls}-progress`]: {
position: 'absolute',
bottom: token.calc(token.uploadProgressOffset).mul(-1).equal(),
width: '100%',
paddingInlineStart: calc(fontSize).add(token.paddingXS).equal(),
fontSize,
lineHeight: 0,
pointerEvents: 'none',
'> div': {
margin: 0
}
}
},
[`${itemCls}:hover ${actionCls}`]: {
opacity: 1
},
[`${itemCls}-error`]: {
color: token.colorError,
[`${itemCls}-name, ${componentCls}-icon ${iconCls}`]: {
color: token.colorError
},
[actionsCls]: {
[`${iconCls}, ${iconCls}:hover`]: {
color: token.colorError
},
[actionCls]: {
opacity: 1
}
}
},
[`${componentCls}-list-item-container`]: {
transition: ['opacity', 'height'].map(prop => `${prop} ${motionDurationSlow}`).join(', '),
// For smooth removing animation
'&::before': {
display: 'table',
width: 0,
height: 0,
content: '""'
}
}
}
}
};
};
/* harmony default export */ var list = (genListStyle);
// EXTERNAL MODULE: ./components/style/motion/fade.ts
var fade = __webpack_require__("./components/style/motion/fade.ts");
;// ./components/upload/style/motion.ts
// =========================== Motion ===========================
const genMotionStyle = token => {
const {
componentCls
} = token;
const uploadAnimateInlineIn = new cssinjs.Keyframes('uploadAnimateInlineIn', {
from: {
width: 0,
height: 0,
padding: 0,
opacity: 0,
margin: token.calc(token.marginXS).div(-2).equal()
}
});
const uploadAnimateInlineOut = new cssinjs.Keyframes('uploadAnimateInlineOut', {
to: {
width: 0,
height: 0,
padding: 0,
opacity: 0,
margin: token.calc(token.marginXS).div(-2).equal()
}
});
const inlineCls = `${componentCls}-animate-inline`;
return [{
[`${componentCls}-wrapper`]: {
[`${inlineCls}-appear, ${inlineCls}-enter, ${inlineCls}-leave`]: {
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseInOutCirc,
animationFillMode: 'forwards'
},
[`${inlineCls}-appear, ${inlineCls}-enter`]: {
animationName: uploadAnimateInlineIn
},
[`${inlineCls}-leave`]: {
animationName: uploadAnimateInlineOut
}
}
}, {
[`${componentCls}-wrapper`]: (0,fade.initFadeMotion)(token)
}, uploadAnimateInlineIn, uploadAnimateInlineOut];
};
/* harmony default export */ var motion = (genMotionStyle);
// EXTERNAL MODULE: ./node_modules/@ant-design/colors/es/index.js + 2 modules
var colors_es = __webpack_require__("./node_modules/@ant-design/colors/es/index.js");
;// ./components/upload/style/picture.ts
const genPictureStyle = token => {
const {
componentCls,
iconCls,
uploadThumbnailSize,
uploadProgressOffset,
calc
} = token;
const listCls = `${componentCls}-list`;
const itemCls = `${listCls}-item`;
return {
[`${componentCls}-wrapper`]: {
// ${listCls} 增加优先级
[`
${listCls}${listCls}-picture,
${listCls}${listCls}-picture-card,
${listCls}${listCls}-picture-circle
`]: {
[itemCls]: {
position: 'relative',
height: calc(uploadThumbnailSize).add(calc(token.lineWidth).mul(2)).add(calc(token.paddingXS).mul(2)).equal(),
padding: token.paddingXS,
border: `${(0,cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
borderRadius: token.borderRadiusLG,
'&:hover': {
background: 'transparent'
},
[`${itemCls}-thumbnail`]: {
...style.textEllipsis,
width: uploadThumbnailSize,
height: uploadThumbnailSize,
lineHeight: (0,cssinjs.unit)(calc(uploadThumbnailSize).add(token.paddingSM).equal()),
textAlign: 'center',
flex: 'none',
[iconCls]: {
fontSize: token.fontSizeHeading2,
color: token.colorPrimary
},
img: {
display: 'block',
width: '100%',
height: '100%',
overflow: 'hidden'
}
},
[`${itemCls}-progress`]: {
bottom: calc(token.fontSize).mul(token.lineHeight).div(2).add(uploadProgressOffset).equal(),
width: `calc(100% - ${(0,cssinjs.unit)(calc(token.paddingSM).mul(2).equal())})`,
marginTop: 0,
paddingInlineStart: calc(uploadThumbnailSize).add(token.paddingXS).equal()
}
},
[`${itemCls}-error`]: {
borderColor: token.colorError,
// Adjust the color of the error icon : https://github.com/ant-design/ant-design/pull/24160
[`${itemCls}-thumbnail ${iconCls}`]: {
[`svg path[fill='${colors_es.blue[0]}']`]: {
fill: token.colorErrorBg
},
[`svg path[fill='${colors_es.blue.primary}']`]: {
fill: token.colorError
}
}
},
[`${itemCls}-uploading`]: {
borderStyle: 'dashed',
[`${itemCls}-name`]: {
marginBottom: uploadProgressOffset
}
}
},
[`${listCls}${listCls}-picture-circle ${itemCls}`]: {
[`&, &::before, ${itemCls}-thumbnail`]: {
borderRadius: '50%'
}
}
}
};
};
const genPictureCardStyle = token => {
const {
componentCls,
iconCls,
fontSizeLG,
colorTextLightSolid,
calc
} = token;
const listCls = `${componentCls}-list`;
const itemCls = `${listCls}-item`;
const uploadPictureCardSize = token.uploadPicCardSize;
return {
[`
${componentCls}-wrapper${componentCls}-picture-card-wrapper,
${componentCls}-wrapper${componentCls}-picture-circle-wrapper
`]: {
...(0,style.clearFix)(),
display: 'block',
[`${componentCls}${componentCls}-select`]: {
width: uploadPictureCardSize,
height: uploadPictureCardSize,
textAlign: 'center',
verticalAlign: 'top',
backgroundColor: token.colorFillAlter,
border: `${(0,cssinjs.unit)(token.lineWidth)} dashed ${token.colorBorder}`,
borderRadius: token.borderRadiusLG,
cursor: 'pointer',
transition: `border-color ${token.motionDurationSlow}`,
[`> ${componentCls}`]: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
height: '100%',
textAlign: 'center'
},
[`&:not(${componentCls}-disabled):hover`]: {
borderColor: token.colorPrimary
}
},
// list
[`${listCls}${listCls}-picture-card, ${listCls}${listCls}-picture-circle`]: {
display: 'flex',
flexWrap: 'wrap',
'&:not(:empty)': {
minHeight: uploadPictureCardSize
},
'@supports not (gap: 1px)': {
'& > *': {
marginBlockEnd: token.marginXS,
marginInlineEnd: token.marginXS
}
},
'@supports (gap: 1px)': {
gap: token.marginXS
},
[`${listCls}-item-container`]: {
display: 'inline-block',
width: uploadPictureCardSize,
height: uploadPictureCardSize,
verticalAlign: 'top'
},
'&::after': {
display: 'none'
},
'&::before': {
display: 'none'
},
[itemCls]: {
height: '100%',
margin: 0,
'&::before': {
position: 'absolute',
zIndex: 1,
width: `calc(100% - ${(0,cssinjs.unit)(calc(token.paddingXS).mul(2).equal())})`,
height: `calc(100% - ${(0,cssinjs.unit)(calc(token.paddingXS).mul(2).equal())})`,
backgroundColor: token.colorBgMask,
opacity: 0,
transition: `all ${token.motionDurationSlow}`,
content: '" "'
}
},
[`${itemCls}:hover`]: {
[`&::before, ${itemCls}-actions`]: {
opacity: 1
}
},
[`${itemCls}-actions`]: {
position: 'absolute',
insetInlineStart: 0,
zIndex: 10,
width: '100%',
whiteSpace: 'nowrap',
textAlign: 'center',
opacity: 0,
transition: `all ${token.motionDurationSlow}`,
[`
${iconCls}-eye,
${iconCls}-download,
${iconCls}-delete
`]: {
zIndex: 10,
width: fontSizeLG,
margin: `0 ${(0,cssinjs.unit)(token.marginXXS)}`,
fontSize: fontSizeLG,
cursor: 'pointer',
transition: `all ${token.motionDurationSlow}`,
color: colorTextLightSolid,
'&:hover': {
color: colorTextLightSolid
},
svg: {
verticalAlign: 'baseline'
}
}
},
[`${itemCls}-thumbnail, ${itemCls}-thumbnail img`]: {
position: 'static',
display: 'block',
width: '100%',
height: '100%',
objectFit: 'contain'
},
[`${itemCls}-name`]: {
display: 'none',
textAlign: 'center'
},
[`${itemCls}-file + ${itemCls}-name`]: {
position: 'absolute',
bottom: token.margin,
display: 'block',
width: `calc(100% - ${(0,cssinjs.unit)(calc(token.paddingXS).mul(2).equal())})`
},
[`${itemCls}-uploading`]: {
[`&${itemCls}`]: {
backgroundColor: token.colorFillAlter
},
[`&::before, ${iconCls}-eye, ${iconCls}-download, ${iconCls}-delete`]: {
display: 'none'
}
},
[`${itemCls}-progress`]: {
bottom: token.marginXL,
width: `calc(100% - ${(0,cssinjs.unit)(calc(token.paddingXS).mul(2).equal())})`,
paddingInlineStart: 0
}
}
},
[`${componentCls}-wrapper${componentCls}-picture-circle-wrapper`]: {
[`${componentCls}${componentCls}-select`]: {
borderRadius: '50%'
}
}
};
};
;// ./components/upload/style/rtl.ts
// =========================== Motion ===========================
const genRtlStyle = token => {
const {
componentCls
} = token;
return {
[`${componentCls}-rtl`]: {
direction: 'rtl'
}
};
};
/* harmony default export */ var rtl = (genRtlStyle);
;// ./components/upload/style/index.ts
const genBaseStyle = token => {
const {
componentCls,
colorTextDisabled
} = token;
return {
[`${componentCls}-wrapper`]: {
...(0,style.resetComponent)(token),
[componentCls]: {
outline: 0,
"input[type='file']": {
cursor: 'pointer'
}
},
[`${componentCls}-select`]: {
display: 'inline-block'
},
[`${componentCls}-hidden`]: {
display: 'none'
},
[`${componentCls}-disabled`]: {
color: colorTextDisabled,
cursor: 'not-allowed'
}
}
};
};
const prepareComponentToken = token => ({
actionsColor: token.colorIcon,
pictureCardSize: token.controlHeightLG * 2.55
});
// ============================== Export ==============================
/* harmony default export */ var upload_style = ((0,genStyleUtils.genStyleHooks)('Upload', token => {
const {
fontSizeHeading3,
marginXS,
lineWidth,
pictureCardSize,
calc
} = token;
const uploadToken = (0,es.mergeToken)(token, {
uploadThumbnailSize: calc(fontSizeHeading3).mul(2).equal(),
uploadProgressOffset: calc(calc(marginXS).div(2)).add(lineWidth).equal(),
uploadPicCardSize: pictureCardSize
});
return [genBaseStyle(uploadToken), dragger(uploadToken), genPictureStyle(uploadToken), genPictureCardStyle(uploadToken), list(uploadToken), motion(uploadToken), rtl(uploadToken), (0,collapse["default"])(uploadToken)];
}, prepareComponentToken));
/***/ }),
/***/ "./components/version/index.tsx":
/*!**************************************************!*\
!*** ./components/version/index.tsx + 1 modules ***!
\**************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ components_version; }
});
;// ./components/version/version.ts
/* harmony default export */ var version = ('6.3.7');
;// ./components/version/index.tsx
// @ts-ignore
/* harmony default export */ var components_version = (version);
/***/ }),
/***/ "./node_modules/dayjs/plugin/advancedFormat.js":
/*!*****************************************************!*\
!*** ./node_modules/dayjs/plugin/advancedFormat.js ***!
\*****************************************************/
/***/ (function(module) {
!function(e,t){ true?module.exports=t():0}(this,(function(){"use strict";return function(e,t){var r=t.prototype,n=r.format;r.format=function(e){var t=this,r=this.$locale();if(!this.isValid())return n.bind(this)(e);var s=this.$utils(),a=(e||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(e){switch(e){case"Q":return Math.ceil((t.$M+1)/3);case"Do":return r.ordinal(t.$D);case"gggg":return t.weekYear();case"GGGG":return t.isoWeekYear();case"wo":return r.ordinal(t.week(),"W");case"w":case"ww":return s.s(t.week(),"w"===e?1:2,"0");case"W":case"WW":return s.s(t.isoWeek(),"W"===e?1:2,"0");case"k":case"kk":return s.s(String(0===t.$H?24:t.$H),"k"===e?1:2,"0");case"X":return Math.floor(t.$d.getTime()/1e3);case"x":return t.$d.getTime();case"z":return"["+t.offsetName()+"]";case"zzz":return"["+t.offsetName("long")+"]";default:return e}}));return n.bind(this)(a)}}}));
/***/ }),
/***/ "./node_modules/dayjs/plugin/customParseFormat.js":
/*!********************************************************!*\
!*** ./node_modules/dayjs/plugin/customParseFormat.js ***!
\********************************************************/
/***/ (function(module) {
!function(e,t){ true?module.exports=t():0}(this,(function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,i=/\d\d?/,o=/\d*[^-_:/,()\s\d]+/,s={},a=function(e){return(e=+e)+(e>68?1900:2e3)};var f=function(e){return function(t){this[e]=+t}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e)}],u=function(e){var t=s[e];return t&&(t.indexOf?t:t.s.concat(t.f))},d=function(e,t){var n,r=s.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?"pm":"PM");return n},c={A:[o,function(e){this.afternoon=d(e,!1)}],a:[o,function(e){this.afternoon=d(e,!0)}],Q:[n,function(e){this.month=3*(e-1)+1}],S:[n,function(e){this.milliseconds=100*+e}],SS:[r,function(e){this.milliseconds=10*+e}],SSS:[/\d{3}/,function(e){this.milliseconds=+e}],s:[i,f("seconds")],ss:[i,f("seconds")],m:[i,f("minutes")],mm:[i,f("minutes")],H:[i,f("hours")],h:[i,f("hours")],HH:[i,f("hours")],hh:[i,f("hours")],D:[i,f("day")],DD:[r,f("day")],Do:[o,function(e){var t=s.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r)}],w:[i,f("week")],ww:[r,f("week")],M:[i,f("month")],MM:[r,f("month")],MMM:[o,function(e){var t=u("months"),n=(u("monthsShort")||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n}],MMMM:[o,function(e){var t=u("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t}],Y:[/[+-]?\d+/,f("year")],YY:[r,function(e){this.year=a(e)}],YYYY:[/\d{4}/,f("year")],Z:h,ZZ:h};function l(n){var r,i;r=n,i=s&&s.formats;for(var o=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var o=r&&r.toUpperCase();return n||i[r]||e[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),a=o.length,f=0;f-1)return new Date(("X"===t?1e3:1)*e);var i=l(t)(e),o=i.year,s=i.month,a=i.day,f=i.hours,h=i.minutes,u=i.seconds,d=i.milliseconds,c=i.zone,m=i.week,M=new Date,Y=a||(o||s?1:M.getDate()),p=o||M.getFullYear(),v=0;o&&!s||(v=s>0?s-1:M.getMonth());var D,w=f||0,g=h||0,y=u||0,L=d||0;return c?new Date(Date.UTC(p,v,Y,w,g,y,L+60*c.offset*1e3)):n?new Date(Date.UTC(p,v,Y,w,g,y,L)):(D=new Date(p,v,Y,w,g,y,L),m&&(D=r(D).week(m).toDate()),D)}catch(e){return new Date("")}}(t,a,r,n),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(a)&&(this.$d=new Date("")),s={}}else if(a instanceof Array)for(var c=a.length,m=1;m<=c;m+=1){o[1]=a[m-1];var M=n.apply(this,o);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===c&&(this.$d=new Date(""))}else i.call(this,e)}}}));
/***/ }),
/***/ "./node_modules/dayjs/plugin/localeData.js":
/*!*************************************************!*\
!*** ./node_modules/dayjs/plugin/localeData.js ***!
\*************************************************/
/***/ (function(module) {
!function(n,e){ true?module.exports=e():0}(this,(function(){"use strict";return function(n,e,t){var r=e.prototype,o=function(n){return n&&(n.indexOf?n:n.s)},u=function(n,e,t,r,u){var i=n.name?n:n.$locale(),a=o(i[e]),s=o(i[t]),f=a||s.map((function(n){return n.slice(0,r)}));if(!u)return f;var d=i.weekStart;return f.map((function(n,e){return f[(e+(d||0))%7]}))},i=function(){return t.Ls[t.locale()]},a=function(n,e){return n.formats[e]||function(n){return n.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(n,e,t){return e||t.slice(1)}))}(n.formats[e.toUpperCase()])},s=function(){var n=this;return{months:function(e){return e?e.format("MMMM"):u(n,"months")},monthsShort:function(e){return e?e.format("MMM"):u(n,"monthsShort","months",3)},firstDayOfWeek:function(){return n.$locale().weekStart||0},weekdays:function(e){return e?e.format("dddd"):u(n,"weekdays")},weekdaysMin:function(e){return e?e.format("dd"):u(n,"weekdaysMin","weekdays",2)},weekdaysShort:function(e){return e?e.format("ddd"):u(n,"weekdaysShort","weekdays",3)},longDateFormat:function(e){return a(n.$locale(),e)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};r.localeData=function(){return s.bind(this)()},t.localeData=function(){var n=i();return{firstDayOfWeek:function(){return n.weekStart||0},weekdays:function(){return t.weekdays()},weekdaysShort:function(){return t.weekdaysShort()},weekdaysMin:function(){return t.weekdaysMin()},months:function(){return t.months()},monthsShort:function(){return t.monthsShort()},longDateFormat:function(e){return a(n,e)},meridiem:n.meridiem,ordinal:n.ordinal}},t.months=function(){return u(i(),"months")},t.monthsShort=function(){return u(i(),"monthsShort","months",3)},t.weekdays=function(n){return u(i(),"weekdays",null,null,n)},t.weekdaysShort=function(n){return u(i(),"weekdaysShort","weekdays",3,n)},t.weekdaysMin=function(n){return u(i(),"weekdaysMin","weekdays",2,n)}}}));
/***/ }),
/***/ "./node_modules/dayjs/plugin/weekOfYear.js":
/*!*************************************************!*\
!*** ./node_modules/dayjs/plugin/weekOfYear.js ***!
\*************************************************/
/***/ (function(module) {
!function(e,t){ true?module.exports=t():0}(this,(function(){"use strict";var e="week",t="year";return function(i,n,r){var f=n.prototype;f.week=function(i){if(void 0===i&&(i=null),null!==i)return this.add(7*(i-this.week()),"day");var n=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var f=r(this).startOf(t).add(1,t).date(n),s=r(this).endOf(e);if(f.isBefore(s))return 1}var a=r(this).startOf(t).date(n).startOf(e).subtract(1,"millisecond"),o=this.diff(a,e,!0);return o<0?r(this).startOf("week").week():Math.ceil(o)},f.weeks=function(e){return void 0===e&&(e=null),this.week(e)}}}));
/***/ }),
/***/ "./node_modules/dayjs/plugin/weekYear.js":
/*!***********************************************!*\
!*** ./node_modules/dayjs/plugin/weekYear.js ***!
\***********************************************/
/***/ (function(module) {
!function(e,t){ true?module.exports=t():0}(this,(function(){"use strict";return function(e,t){t.prototype.weekYear=function(){var e=this.month(),t=this.week(),n=this.year();return 1===t&&11===e?n+1:0===e&&t>=52?n-1:n}}}));
/***/ }),
/***/ "./node_modules/dayjs/plugin/weekday.js":
/*!**********************************************!*\
!*** ./node_modules/dayjs/plugin/weekday.js ***!
\**********************************************/
/***/ (function(module) {
!function(e,t){ true?module.exports=t():0}(this,(function(){"use strict";return function(e,t){t.prototype.weekday=function(e){var t=this.$locale().weekStart||0,i=this.$W,n=(i 1 &&
ua.indexOf('Macintosh') !== -1 &&
ua.indexOf('Safari') !== -1
) {
result = true
}
return result
}
/***/ }),
/***/ "./node_modules/json2mq/index.js":
/*!***************************************!*\
!*** ./node_modules/json2mq/index.js ***!
\***************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var camel2hyphen = __webpack_require__(/*! string-convert/camel2hyphen */ "./node_modules/string-convert/camel2hyphen.js");
var isDimension = function (feature) {
var re = /[height|width]$/;
return re.test(feature);
};
var obj2mq = function (obj) {
var mq = '';
var features = Object.keys(obj);
features.forEach(function (feature, index) {
var value = obj[feature];
feature = camel2hyphen(feature);
// Add px to dimension features
if (isDimension(feature) && typeof value === 'number') {
value = value + 'px';
}
if (value === true) {
mq += feature;
} else if (value === false) {
mq += 'not ' + feature;
} else {
mq += '(' + feature + ': ' + value + ')';
}
if (index < features.length-1) {
mq += ' and '
}
});
return mq;
};
var json2mq = function (query) {
var mq = '';
if (typeof query === 'string') {
return query;
}
// Handling array of media queries
if (query instanceof Array) {
query.forEach(function (q, index) {
mq += obj2mq(q);
if (index < query.length-1) {
mq += ', '
}
});
return mq;
}
// Handling single media query
return obj2mq(query);
};
module.exports = json2mq;
/***/ }),
/***/ "./node_modules/react-dom/client.js":
/*!******************************************!*\
!*** ./node_modules/react-dom/client.js ***!
\******************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
var __webpack_unused_export__;
var m = __webpack_require__(/*! react-dom */ "react-dom");
if (false) // removed by dead control flow
{} else {
var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
exports.createRoot = function(c, o) {
i.usingClientEntryPoint = true;
try {
return m.createRoot(c, o);
} finally {
i.usingClientEntryPoint = false;
}
};
__webpack_unused_export__ = function(c, h, o) {
i.usingClientEntryPoint = true;
try {
return m.hydrateRoot(c, h, o);
} finally {
i.usingClientEntryPoint = false;
}
};
}
/***/ }),
/***/ "./node_modules/string-convert/camel2hyphen.js":
/*!*****************************************************!*\
!*** ./node_modules/string-convert/camel2hyphen.js ***!
\*****************************************************/
/***/ (function(module) {
var camel2hyphen = function (str) {
return str
.replace(/[A-Z]/g, function (match) {
return '-' + match.toLowerCase();
})
.toLowerCase();
};
module.exports = camel2hyphen;
/***/ }),
/***/ "react":
/*!**************************************************************************************!*\
!*** external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"} ***!
\**************************************************************************************/
/***/ (function(module) {
"use strict";
module.exports = __WEBPACK_EXTERNAL_MODULE_react__;
/***/ }),
/***/ "react-dom":
/*!*****************************************************************************************************!*\
!*** external {"root":"ReactDOM","commonjs2":"react-dom","commonjs":"react-dom","amd":"react-dom"} ***!
\*****************************************************************************************************/
/***/ (function(module) {
"use strict";
module.exports = __WEBPACK_EXTERNAL_MODULE_react_dom__;
/***/ }),
/***/ "dayjs":
/*!**************************************************************************************!*\
!*** external {"root":"dayjs","commonjs2":"dayjs","commonjs":"dayjs","amd":"dayjs"} ***!
\**************************************************************************************/
/***/ (function(module) {
"use strict";
module.exports = __WEBPACK_EXTERNAL_MODULE_dayjs__;
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js":
/*!*********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js ***!
\*********************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ _arrayLikeToArray; }
/* harmony export */ });
function _arrayLikeToArray(r, a) {
(null == a || a > r.length) && (a = r.length);
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
return n;
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js":
/*!**************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js ***!
\**************************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ _assertThisInitialized; }
/* harmony export */ });
function _assertThisInitialized(e) {
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e;
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js":
/*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js ***!
\*******************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ _classCallCheck; }
/* harmony export */ });
function _classCallCheck(a, n) {
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/createClass.js":
/*!****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/createClass.js ***!
\****************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ _createClass; }
/* harmony export */ });
/* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js");
function _defineProperties(e, r) {
for (var t = 0; t < r.length; t++) {
var o = r[t];
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(o.key), o);
}
}
function _createClass(e, r, t) {
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
writable: !1
}), e;
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/createSuper.js":
/*!****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/createSuper.js ***!
\****************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ _createSuper; }
/* harmony export */ });
/* harmony import */ var _getPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js");
/* harmony import */ var _isNativeReflectConstruct_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isNativeReflectConstruct.js */ "./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js");
/* harmony import */ var _possibleConstructorReturn_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./possibleConstructorReturn.js */ "./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js");
function _createSuper(t) {
var r = (0,_isNativeReflectConstruct_js__WEBPACK_IMPORTED_MODULE_1__["default"])();
return function () {
var e,
o = (0,_getPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(t);
if (r) {
var s = (0,_getPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(this).constructor;
e = Reflect.construct(o, arguments, s);
} else e = o.apply(this, arguments);
return (0,_possibleConstructorReturn_js__WEBPACK_IMPORTED_MODULE_2__["default"])(this, e);
};
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js":
/*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/defineProperty.js ***!
\*******************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ _defineProperty; }
/* harmony export */ });
/* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js");
function _defineProperty(e, r, t) {
return (r = (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r)) in e ? Object.defineProperty(e, r, {
value: t,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[r] = t, e;
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/extends.js":
/*!************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/extends.js ***!
\************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ _extends; }
/* harmony export */ });
function _extends() {
return _extends = Object.assign ? Object.assign.bind() : function (n) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
}
return n;
}, _extends.apply(null, arguments);
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js":
/*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js ***!
\*******************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ _getPrototypeOf; }
/* harmony export */ });
function _getPrototypeOf(t) {
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
return t.__proto__ || Object.getPrototypeOf(t);
}, _getPrototypeOf(t);
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/inherits.js":
/*!*************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/inherits.js ***!
\*************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ _inherits; }
/* harmony export */ });
/* harmony import */ var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js");
function _inherits(t, e) {
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
t.prototype = Object.create(e && e.prototype, {
constructor: {
value: t,
writable: !0,
configurable: !0
}
}), Object.defineProperty(t, "prototype", {
writable: !1
}), e && (0,_setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(t, e);
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js":
/*!*****************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js ***!
\*****************************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ _isNativeReflectConstruct; }
/* harmony export */ });
function _isNativeReflectConstruct() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
} catch (t) {}
return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
return !!t;
})();
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/objectSpread2.js":
/*!******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js ***!
\******************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ _objectSpread2; }
/* harmony export */ });
/* harmony import */ var _defineProperty_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defineProperty.js */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
function ownKeys(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function (r) {
return Object.getOwnPropertyDescriptor(e, r).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread2(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
(0,_defineProperty_js__WEBPACK_IMPORTED_MODULE_0__["default"])(e, r, t[r]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
});
}
return e;
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js":
/*!******************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js ***!
\******************************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ _possibleConstructorReturn; }
/* harmony export */ });
/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
/* harmony import */ var _assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assertThisInitialized.js */ "./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js");
function _possibleConstructorReturn(t, e) {
if (e && ("object" == (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(e) || "function" == typeof e)) return e;
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
return (0,_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_1__["default"])(t);
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js":
/*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js ***!
\*******************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ _setPrototypeOf; }
/* harmony export */ });
function _setPrototypeOf(t, e) {
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
return t.__proto__ = e, t;
}, _setPrototypeOf(t, e);
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js":
/*!******************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 3 modules ***!
\******************************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ _slicedToArray; }
});
;// ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
function _arrayWithHoles(r) {
if (Array.isArray(r)) return r;
}
;// ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
function _iterableToArrayLimit(r, l) {
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != t) {
var e,
n,
i,
u,
a = [],
f = !0,
o = !1;
try {
if (i = (t = t.call(r)).next, 0 === l) {
if (Object(t) !== t) return;
f = !1;
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
} catch (r) {
o = !0, n = r;
} finally {
try {
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
} finally {
if (o) throw n;
}
}
return a;
}
}
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
var unsupportedIterableToArray = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js");
;// ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
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.");
}
;// ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
function _slicedToArray(r, e) {
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || (0,unsupportedIterableToArray["default"])(r, e) || _nonIterableRest();
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js":
/*!**********************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 3 modules ***!
\**********************************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ _toConsumableArray; }
});
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
var arrayLikeToArray = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js");
;// ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
function _arrayWithoutHoles(r) {
if (Array.isArray(r)) return (0,arrayLikeToArray["default"])(r);
}
;// ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
function _iterableToArray(r) {
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
}
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
var unsupportedIterableToArray = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js");
;// ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
;// ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
function _toConsumableArray(r) {
return _arrayWithoutHoles(r) || _iterableToArray(r) || (0,unsupportedIterableToArray["default"])(r) || _nonIterableSpread();
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js":
/*!******************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js + 1 modules ***!
\******************************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ toPropertyKey; }
});
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
var esm_typeof = __webpack_require__("./node_modules/@babel/runtime/helpers/esm/typeof.js");
;// ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
function toPrimitive(t, r) {
if ("object" != (0,esm_typeof["default"])(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != (0,esm_typeof["default"])(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
;// ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
function toPropertyKey(t) {
var i = toPrimitive(t, "string");
return "symbol" == (0,esm_typeof["default"])(i) ? i : i + "";
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/typeof.js":
/*!***********************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/typeof.js ***!
\***********************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ _typeof; }
/* harmony export */ });
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js":
/*!*******************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js ***!
\*******************************************************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": function() { return /* binding */ _unsupportedIterableToArray; }
/* harmony export */ });
/* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js");
function _unsupportedIterableToArray(r, a) {
if (r) {
if ("string" == typeof r) return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r, a);
var t = {}.toString.call(r).slice(8, -1);
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(r, a) : void 0;
}
}
/***/ }),
/***/ "./node_modules/clsx/dist/clsx.mjs":
/*!*****************************************!*\
!*** ./node_modules/clsx/dist/clsx.mjs ***!
\*****************************************/
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ clsx: function() { return /* binding */ clsx; }
/* harmony export */ });
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t