@unicom-cloud/ui 0.8.65 → 0.8.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Affix.js +79 -79
- package/Alert.js +46 -46
- package/Anchor.js +1 -1
- package/AutoComplete.js +74 -74
- package/Avatar.js +36 -36
- package/BackTop.js +35 -35
- package/Badge.js +55 -55
- package/Breadcrumb.js +42 -42
- package/Button.js +24 -24
- package/Calendar.js +230 -230
- package/Card.js +18 -18
- package/Carousel.js +165 -165
- package/Cascader.js +1 -1
- package/Checkbox.js +1 -1
- package/Collapse.js +1 -1
- package/ColorPicker.js +26 -26
- package/Comment.js +18 -18
- package/ConfigProvider.js +2 -2
- package/Copy.js +28 -27
- package/DatePicker.js +872 -871
- package/Descriptions.js +34 -34
- package/Divider.js +19 -19
- package/Draggable.js +27 -26
- package/Drawer.js +1 -1
- package/Dropdown.js +110 -110
- package/Empty.js +3 -3
- package/Form.js +984 -945
- package/Grid.js +34 -34
- package/Icon.js +16 -16
- package/IconHover.js +2 -2
- package/Image.js +2 -2
- package/Input.js +7 -6
- package/InputNumber.js +6 -6
- package/InputTag.js +1 -1
- package/Layout.js +24 -24
- package/Link.js +30 -30
- package/List.js +95 -95
- package/Mentions.js +85 -84
- package/Menu.js +2 -2
- package/Message.js +7 -6
- package/Modal.js +1 -1
- package/Notice.js +14 -3
- package/Notification.js +9 -7
- package/OverflowEllipsis.js +64 -62
- package/PageHeader.js +73 -73
- package/Pagination.js +1 -1
- package/Picker.js +1 -1
- package/Popconfirm.js +60 -60
- package/Popover.js +31 -31
- package/Portal.js +23 -31
- package/Progress.js +22 -22
- package/Radio.js +2 -2
- package/Rate.js +24 -24
- package/ResizeBox.js +274 -271
- package/Result.js +3 -3
- package/Select.js +4 -4
- package/SelectView.js +257 -237
- package/Skeleton.js +46 -46
- package/Slider.js +286 -283
- package/Space.js +28 -28
- package/SpeechSynthesis.js +62 -55
- package/Spin.js +23 -23
- package/Statistic.js +80 -80
- package/Steps.js +67 -67
- package/Switch.js +47 -47
- package/Table.js +1463 -1395
- package/Tabs.js +5 -5
- package/Tag.js +45 -45
- package/TimePicker.js +154 -154
- package/Timeline.js +2 -2
- package/Tooltip.js +80 -79
- package/Transfer.js +103 -102
- package/Tree.js +3 -2
- package/TreeSelect.js +2 -2
- package/Trigger.js +699 -772
- package/Typography.js +756 -6
- package/Upload.js +2 -2
- package/VerificationCode.js +1 -1
- package/Version.js +1 -1
- package/VirtualList.js +1 -1
- package/Watermark.js +1 -1
- package/chunk/{DIx0qmCq.js → -UuKKT0Z.js} +29 -29
- package/chunk/{B8QV6E2b.js → AwZqeapI.js} +5 -5
- package/chunk/B5gK1Idp.js +19 -0
- package/chunk/B7FlazNB.js +24 -0
- package/chunk/{DXZEpA3t.js → BBvWDeuZ.js} +67 -67
- package/chunk/BCftTxEy.js +626 -0
- package/chunk/{CsbCHnFk.js → BGny4zSb.js} +60 -60
- package/chunk/BHF15Dog.js +98 -0
- package/chunk/BJQ5UNa-.js +1585 -0
- package/chunk/BP9sYyk9.js +8 -0
- package/chunk/BUdtVdnv.js +38 -0
- package/chunk/BVQlOzTS.js +11 -0
- package/chunk/B__a_gb_.js +519 -0
- package/chunk/BbEYToV1.js +10 -0
- package/chunk/BbdDQAnm.js +15 -0
- package/chunk/BdUcgWdu.js +11 -0
- package/chunk/BfbXSG70.js +26 -0
- package/chunk/BndfNLK4.js +186 -0
- package/chunk/BoMCZV6K.js +1098 -0
- package/chunk/Br0B6y1T.js +18 -0
- package/chunk/BrOW642m.js +130 -0
- package/chunk/BxUs8_Cr.js +9 -0
- package/chunk/{DK4KcodH.js → C42LIMP9.js} +244 -242
- package/chunk/C4YkFMzC.js +778 -0
- package/chunk/{CF6p9R93.js → C9Wcraj7.js} +21 -21
- package/chunk/{4-gvEY5y.js → CANgSlh3.js} +10 -10
- package/chunk/CJ_o9tZM.js +5 -0
- package/chunk/{Bqk6yh16.js → CK5m7rLl.js} +36 -36
- package/chunk/{CANaGbGR.js → CKNyIitu.js} +57 -56
- package/chunk/CLiqJm_T.js +10 -0
- package/chunk/{DjtWv6Wn.js → CNmmhbCn.js} +32 -32
- package/chunk/{BUCEs557.js → CP0odX99.js} +51 -51
- package/chunk/CPT-OZH2.js +14 -0
- package/chunk/CVSF8p0O.js +698 -0
- package/chunk/C_agcwLN.js +31 -0
- package/chunk/{DTjcKyDN.js → C_gJWGGh.js} +201 -201
- package/chunk/{CPcm9Cm5.js → CaasmWg_.js} +11 -11
- package/chunk/Ce1j9KTi.js +6 -0
- package/chunk/{D_-UD4vO.js → Cf5QNhkG.js} +18 -18
- package/chunk/CkNSv2U7.js +56 -0
- package/chunk/Cp2f70gB.js +9 -0
- package/chunk/CpegYjdC.js +16 -0
- package/chunk/CucI3KZr.js +20 -0
- package/chunk/CwoFBTYz.js +11 -0
- package/chunk/D2KPqPhV.js +17 -0
- package/chunk/D7NyvE5f.js +17 -0
- package/chunk/D8oTPQ2H.js +384 -0
- package/chunk/{CLBavO5c.js → DC1iHEiy.js} +87 -87
- package/chunk/{Dnycc1qJ.js → DFrfrmfK.js} +120 -119
- package/chunk/DGTIZ_0O.js +6 -0
- package/chunk/DJfpiZn_.js +25 -0
- package/chunk/DKr2_PYd.js +34 -0
- package/chunk/DNUz6zgo.js +11 -0
- package/chunk/DRtM649q.js +11 -0
- package/chunk/DS_mUWn6.js +41 -0
- package/chunk/DU6bs_19.js +10 -0
- package/chunk/DWdbwz22.js +10 -0
- package/chunk/DcveZuqd.js +6 -0
- package/chunk/DdVFknul.js +24 -0
- package/chunk/DgRfikwe.js +16 -0
- package/chunk/{DG-epQqF.js → DkyR2EfG.js} +66 -66
- package/chunk/{DUeHQKtx.js → DleQ5HwG.js} +42 -42
- package/chunk/DnrZEnQ_.js +27 -0
- package/chunk/DsRSHWtX.js +1025 -0
- package/chunk/Dz5BdmXo.js +270 -0
- package/chunk/EANe01DF.js +1030 -0
- package/chunk/{CwhPMMWy.js → Ey4YJCkX.js} +7 -7
- package/chunk/GoNx5R4F.js +873 -0
- package/chunk/HDUQku8d.js +20 -0
- package/chunk/HrAP__Hi.js +25 -0
- package/chunk/JPPo5nY_.js +9 -0
- package/chunk/{CIlGCedk.js → SLWP34OR.js} +90 -85
- package/chunk/VVKtwaGf.js +278 -0
- package/chunk/WPNpLxSI.js +16 -0
- package/chunk/{DLvMA1OW.js → WpO_DsK4.js} +49 -48
- package/chunk/fdU3ang6.js +14 -0
- package/chunk/{DqFhzTWC.js → fkclKOAL.js} +298 -292
- package/chunk/flvYlqx3.js +22 -0
- package/chunk/kTDayEpF.js +288 -0
- package/chunk/{DQDkV47j.js → pZoNQ75H.js} +31 -31
- package/chunk/qFf1w_Jq.js +8 -0
- package/chunk/{CH1UUxsg.js → w-kM1L5W.js} +155 -155
- package/hooks/index.js +53 -49
- package/hooks/useComputedState.js +2 -10
- package/hooks/useCreate.js +2 -7
- package/hooks/useForceUpdate.js +2 -7
- package/hooks/useId.js +2 -10
- package/hooks/useInView.js +2 -30
- package/hooks/useIntersectionObserver.js +2 -23
- package/hooks/useInterval.js +2 -17
- package/hooks/useIsFirstRender.js +2 -9
- package/hooks/useIsomorphicLayoutEffect.js +2 -5
- package/hooks/useKeyboardEvent.js +2 -16
- package/hooks/useMedia.js +2 -15
- package/hooks/useMergeProps.js +2 -18
- package/hooks/useMergeValue.js +2 -19
- package/hooks/useOnlineStatus.js +4 -0
- package/hooks/useOverflowHidden.js +2 -25
- package/hooks/useOverrideRef.js +2 -13
- package/hooks/usePersistCallback.js +2 -13
- package/hooks/usePrefersColorSchemeDark.js +4 -0
- package/hooks/usePrevious.js +2 -9
- package/hooks/useRefs.js +2 -9
- package/hooks/useResizeObserver.js +2 -15
- package/hooks/useStateCallback.js +2 -15
- package/hooks/useStateWithPromise.js +2 -24
- package/hooks/useUpdateEffect.js +2 -9
- package/hooks/useVerificationCode.js +73 -0
- package/hooks/useWatch.js +2 -10
- package/hooks/{use-watermark.js → useWatermark.js} +27 -26
- package/hooks/useWindowSize.js +2 -20
- package/index.js +571 -584
- package/locale/en-US.js +4 -2
- package/locale/interface.js +1 -4
- package/locale/ja-JP.js +3 -1
- package/locale/tr-TR.js +1 -1
- package/locale/zh-CN.js +3 -1
- package/locale/zh-HK.js +3 -1
- package/locale/zh-TW.js +3 -1
- package/package.json +1 -1
- package/style.css +1 -1
- package/types/anchor/util.d.ts +1 -1
- package/types/button/index.d.ts +2 -2
- package/types/color-picker/hooks/useColorPicker.d.ts +2 -2
- package/types/form/Control-old.d.ts +56 -0
- package/types/form/Control.d.ts +6 -54
- package/types/form/FormItem.d.ts +1 -1
- package/types/form/store.d.ts +0 -1
- package/types/hooks/index.d.ts +2 -0
- package/types/hooks/useComputedState.d.ts +1 -4
- package/types/hooks/useCreate.d.ts +1 -2
- package/types/hooks/useForceUpdate.d.ts +1 -2
- package/types/hooks/useId.d.ts +1 -2
- package/types/hooks/useInView.d.ts +1 -11
- package/types/hooks/useIntersectionObserver.d.ts +1 -7
- package/types/hooks/useInterval.d.ts +1 -2
- package/types/hooks/useIsFirstRender.d.ts +1 -2
- package/types/hooks/useIsomorphicLayoutEffect.d.ts +1 -3
- package/types/hooks/useKeyboardEvent.d.ts +1 -8
- package/types/hooks/useMedia.d.ts +1 -2
- package/types/hooks/useMergeProps.d.ts +1 -5
- package/types/hooks/useMergeValue.d.ts +1 -6
- package/types/hooks/useOnlineStatus.d.ts +1 -0
- package/types/hooks/useOverflowHidden.d.ts +1 -5
- package/types/hooks/useOverrideRef.d.ts +1 -6
- package/types/hooks/usePersistCallback.d.ts +1 -2
- package/types/hooks/usePrefersColorSchemeDark.d.ts +1 -0
- package/types/hooks/usePrevious.d.ts +1 -3
- package/types/hooks/useRefs.d.ts +1 -2
- package/types/hooks/useResizeObserver.d.ts +1 -6
- package/types/hooks/useStateCallback.d.ts +1 -5
- package/types/hooks/useStateWithPromise.d.ts +1 -2
- package/types/hooks/useUpdateEffect.d.ts +1 -3
- package/types/hooks/useWatch.d.ts +1 -3
- package/types/hooks/useWindowSize.d.ts +1 -5
- package/types/image/interface.d.ts +1 -0
- package/types/index.d.ts +157 -86
- package/types/input/Input.d.ts +1 -1
- package/types/input/Textarea.d.ts +2 -2
- package/types/locale/en-US.d.ts +2 -0
- package/types/locale/interface.d.ts +1 -2
- package/types/locale/ja-JP.d.ts +2 -0
- package/types/locale/zh-CN.d.ts +2 -0
- package/types/locale/zh-HK.d.ts +2 -0
- package/types/locale/zh-TW.d.ts +2 -0
- package/types/menu/context.d.ts +1 -1
- package/types/message/index.d.ts +14 -14
- package/types/message/interface.d.ts +2 -0
- package/types/modal/config.d.ts +0 -1
- package/types/modal/interface.d.ts +0 -1
- package/types/notice/index.d.ts +2 -27
- package/types/notification/index.d.ts +15 -16
- package/types/notification/interface.d.ts +2 -0
- package/types/notification/withNotification.d.ts +2 -0
- package/types/select/util.d.ts +1 -2
- package/types/select-view/interface.d.ts +2 -1
- package/types/speech-synthesis/index.d.ts +1 -1
- package/types/table/constant.d.ts +2 -0
- package/types/table/hook/useThResizable.d.ts +7 -0
- package/types/table/index.d.ts +10 -1
- package/types/table/style/index.d.ts +1 -0
- package/types/table/th-resizable/index.d.ts +2 -0
- package/types/table/thead/Column.d.ts +1 -2
- package/types/tree/Tree.d.ts +12 -67
- package/types/tree-select/Select.d.ts +2 -2
- package/types/trigger/index.d.ts +2 -120
- package/types/trigger/interface.d.ts +2 -1
- package/types/utils/CSSTransition.d.ts +2 -3
- package/types/utils/caseName.d.ts +1 -1
- package/types/utils/className.d.ts +1 -1
- package/types/utils/constant.d.ts +2 -2
- package/types/utils/copy.d.ts +1 -1
- package/types/utils/dayjs.d.ts +1 -21
- package/types/utils/dom.d.ts +1 -6
- package/types/utils/fileToURL.d.ts +1 -1
- package/types/utils/fillNBSP.d.ts +1 -1
- package/types/utils/getHighlightText.d.ts +1 -5
- package/types/utils/getHotkeyHandler.d.ts +1 -8
- package/types/utils/getStringLength.d.ts +1 -1
- package/types/utils/include.d.ts +1 -1
- package/types/utils/index.d.ts +3 -4
- package/types/utils/is.d.ts +1 -16
- package/types/utils/keyboardCode.d.ts +3 -0
- package/types/utils/lodash.d.ts +1 -17
- package/types/utils/mergeProps.d.ts +1 -1
- package/types/utils/mergedToString.d.ts +1 -1
- package/types/utils/omit.d.ts +1 -1
- package/types/utils/pad.d.ts +1 -2
- package/types/utils/pick.d.ts +2 -4
- package/types/utils/reactDOM.d.ts +1 -7
- package/types/utils/resizeObserverEffect.d.ts +2 -0
- package/types/utils/saveAs.d.ts +1 -1
- package/types/utils/screenfull.d.ts +2 -0
- package/types/utils/scrollIntoView.d.ts +1 -2
- package/types/utils/style.d.ts +1 -3
- package/types/utils/throttleByRaf.d.ts +1 -5
- package/types/utils/throttleByRaf2.d.ts +1 -0
- package/types/utils/warning.d.ts +1 -2
- package/types/version/index.d.ts +1 -1
- package/utils/CSSTransition.js +2 -6
- package/utils/className.js +2 -2
- package/utils/constant.js +8 -9
- package/utils/contextHolder.js +1 -1
- package/utils/copy.js +1 -1
- package/utils/dayjs.js +14 -173
- package/utils/dom.js +33 -29
- package/utils/fillNBSP.js +2 -4
- package/utils/getHighlightText.js +2 -38
- package/utils/getHotkeyHandler.js +2 -25
- package/utils/getStringLength.js +2 -7
- package/utils/include.js +2 -7
- package/utils/index.js +237 -240
- package/utils/is.js +116 -156
- package/utils/keyboardCode.js +27 -0
- package/utils/mergeProps.js +2 -9
- package/utils/mergedToString.js +2 -13
- package/utils/omit.js +2 -9
- package/utils/pad.js +12 -12
- package/utils/pick.js +4 -15
- package/utils/reactDOM.js +3 -54
- package/utils/resizeObserverEffect.js +4 -0
- package/utils/saveAs.js +1 -1
- package/utils/screenfull.js +4 -0
- package/utils/scrollIntoView.js +2 -21
- package/utils/style.js +12 -11
- package/utils/throttleByRaf.js +13 -12
- package/utils/throttleByRaf2.js +5 -0
- package/utils/warning.js +5 -4
- package/NotificationBase.js +0 -53
- package/chunk/1GQdnTJp.js +0 -284
- package/chunk/BAWsPQBM.js +0 -11
- package/chunk/BS09tn7B.js +0 -638
- package/chunk/BqGtwxTi.js +0 -777
- package/chunk/BqufsN8i.js +0 -376
- package/chunk/BtlvlGQN.js +0 -278
- package/chunk/C2lIz2F9.js +0 -60
- package/chunk/CGZ0In1p.js +0 -776
- package/chunk/CWgltRVL.js +0 -698
- package/chunk/D3NFxdmG.js +0 -518
- package/chunk/DApXtulb.js +0 -1102
- package/chunk/DlLL5JQo.js +0 -1501
- package/chunk/Dv_xRzvR.js +0 -269
- package/chunk/Ek8U5CTN.js +0 -1032
- package/chunk/ewRDIDUz.js +0 -995
- package/chunk/l0sNRNKZ.js +0 -1
- package/chunk/tYXLFPVI.js +0 -871
- package/hooks/use-verification-code.js +0 -73
- package/types/notification-base/index.d.ts +0 -15
- package/types/notification-base/style/index.d.ts +0 -2
- package/types/trigger/Portal.d.ts +0 -7
- package/types/utils/keyCode.d.ts +0 -45
- package/types/utils/raf.d.ts +0 -3
- package/types/utils/throttleByRafV2.d.ts +0 -5
- package/utils/keyCode.js +0 -12
- package/utils/raf.js +0 -19
- package/utils/throttleByRafV2.js +0 -16
- /package/style/{variable.less → variables.less} +0 -0
|
@@ -0,0 +1,1585 @@
|
|
|
1
|
+
import et, { forwardRef as nt, useContext as G, createContext as se, useRef as j, useImperativeHandle as rt, useEffect as E, useState as Ft } from "react";
|
|
2
|
+
import { jsx as f, jsxs as tt, Fragment as Nt } from "react/jsx-runtime";
|
|
3
|
+
import ut from "@unicom-cloud/icons/context";
|
|
4
|
+
import ce from "lodash/isPlainObject";
|
|
5
|
+
import { c as xt } from "./B5gK1Idp.js";
|
|
6
|
+
import { _ as qt, N as Ut } from "./DC1iHEiy.js";
|
|
7
|
+
import V from "lodash/isNumber";
|
|
8
|
+
import B from "lodash/isUndefined";
|
|
9
|
+
import { createRoot as jt } from "react-dom/client";
|
|
10
|
+
import le from "@unicom-cloud/icons/IconUiCheckCircleFill";
|
|
11
|
+
import St from "@unicom-cloud/icons/IconUiClose";
|
|
12
|
+
import fe from "@unicom-cloud/icons/IconUiCloseCircleFill";
|
|
13
|
+
import he from "@unicom-cloud/icons/IconUiExclamationCircleFill";
|
|
14
|
+
import ue from "@unicom-cloud/icons/IconUiInfoCircleFill";
|
|
15
|
+
import de from "@unicom-cloud/icons/IconUiLoading";
|
|
16
|
+
import ge from "@unicom-cloud/icons/IconUiEmpty";
|
|
17
|
+
import { m as K } from "./JPPo5nY_.js";
|
|
18
|
+
import me from "../locale/zh-CN.js";
|
|
19
|
+
import "lodash/isEqualWith";
|
|
20
|
+
import "./CkNSv2U7.js";
|
|
21
|
+
import "./CSC_V_25.js";
|
|
22
|
+
import "lodash/merge";
|
|
23
|
+
import "../utils/dom.js";
|
|
24
|
+
import "./HrAP__Hi.js";
|
|
25
|
+
import { createPortal as be } from "react-dom";
|
|
26
|
+
import "./Ce1j9KTi.js";
|
|
27
|
+
import "lodash/debounce";
|
|
28
|
+
import xe from "lodash/isString";
|
|
29
|
+
import { c as pe } from "./BdUcgWdu.js";
|
|
30
|
+
var ye = Object.defineProperty, Ce = (t, n, e) => n in t ? ye(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e, P = (t, n, e) => Ce(t, typeof n != "symbol" ? n + "" : n, e);
|
|
31
|
+
function w(t, n) {
|
|
32
|
+
ve(t) && (t = "100%");
|
|
33
|
+
const e = $e(t);
|
|
34
|
+
return t = n === 360 ? t : Math.min(n, Math.max(0, parseFloat(t))), e && (t = parseInt(String(t * n), 10) / 100), Math.abs(t - n) < 1e-6 ? 1 : (n === 360 ? t = (t < 0 ? t % n + n : t % n) / parseFloat(String(n)) : t = t % n / parseFloat(String(n)), t);
|
|
35
|
+
}
|
|
36
|
+
function Y(t) {
|
|
37
|
+
return Math.min(1, Math.max(0, t));
|
|
38
|
+
}
|
|
39
|
+
function ve(t) {
|
|
40
|
+
return typeof t == "string" && t.indexOf(".") !== -1 && parseFloat(t) === 1;
|
|
41
|
+
}
|
|
42
|
+
function $e(t) {
|
|
43
|
+
return typeof t == "string" && t.indexOf("%") !== -1;
|
|
44
|
+
}
|
|
45
|
+
function Ot(t) {
|
|
46
|
+
return t = parseFloat(t), (isNaN(t) || t < 0 || t > 1) && (t = 1), t;
|
|
47
|
+
}
|
|
48
|
+
function Z(t) {
|
|
49
|
+
return Number(t) <= 1 ? `${Number(t) * 100}%` : t;
|
|
50
|
+
}
|
|
51
|
+
function I(t) {
|
|
52
|
+
return t.length === 1 ? "0" + t : String(t);
|
|
53
|
+
}
|
|
54
|
+
function we(t, n, e) {
|
|
55
|
+
return {
|
|
56
|
+
r: w(t, 255) * 255,
|
|
57
|
+
g: w(n, 255) * 255,
|
|
58
|
+
b: w(e, 255) * 255
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function Rt(t, n, e) {
|
|
62
|
+
t = w(t, 255), n = w(n, 255), e = w(e, 255);
|
|
63
|
+
const r = Math.max(t, n, e), o = Math.min(t, n, e);
|
|
64
|
+
let i = 0, a = 0;
|
|
65
|
+
const s = (r + o) / 2;
|
|
66
|
+
if (r === o)
|
|
67
|
+
a = 0, i = 0;
|
|
68
|
+
else {
|
|
69
|
+
const c = r - o;
|
|
70
|
+
switch (a = s > 0.5 ? c / (2 - r - o) : c / (r + o), r) {
|
|
71
|
+
case t:
|
|
72
|
+
i = (n - e) / c + (n < e ? 6 : 0);
|
|
73
|
+
break;
|
|
74
|
+
case n:
|
|
75
|
+
i = (e - t) / c + 2;
|
|
76
|
+
break;
|
|
77
|
+
case e:
|
|
78
|
+
i = (t - n) / c + 4;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
i /= 6;
|
|
82
|
+
}
|
|
83
|
+
return { h: i, s: a, l: s };
|
|
84
|
+
}
|
|
85
|
+
function ct(t, n, e) {
|
|
86
|
+
return e < 0 && (e += 1), e > 1 && (e -= 1), e < 1 / 6 ? t + (n - t) * (6 * e) : e < 1 / 2 ? n : e < 2 / 3 ? t + (n - t) * (2 / 3 - e) * 6 : t;
|
|
87
|
+
}
|
|
88
|
+
function ke(t, n, e) {
|
|
89
|
+
let r, o, i;
|
|
90
|
+
if (t = w(t, 360), n = w(n, 100), e = w(e, 100), n === 0)
|
|
91
|
+
o = e, i = e, r = e;
|
|
92
|
+
else {
|
|
93
|
+
const a = e < 0.5 ? e * (1 + n) : e + n - e * n, s = 2 * e - a;
|
|
94
|
+
r = ct(s, a, t + 1 / 3), o = ct(s, a, t), i = ct(s, a, t - 1 / 3);
|
|
95
|
+
}
|
|
96
|
+
return { r: r * 255, g: o * 255, b: i * 255 };
|
|
97
|
+
}
|
|
98
|
+
function lt(t, n, e) {
|
|
99
|
+
t = w(t, 255), n = w(n, 255), e = w(e, 255);
|
|
100
|
+
const r = Math.max(t, n, e), o = Math.min(t, n, e);
|
|
101
|
+
let i = 0;
|
|
102
|
+
const a = r, s = r - o, c = r === 0 ? 0 : s / r;
|
|
103
|
+
if (r === o)
|
|
104
|
+
i = 0;
|
|
105
|
+
else {
|
|
106
|
+
switch (r) {
|
|
107
|
+
case t:
|
|
108
|
+
i = (n - e) / s + (n < e ? 6 : 0);
|
|
109
|
+
break;
|
|
110
|
+
case n:
|
|
111
|
+
i = (e - t) / s + 2;
|
|
112
|
+
break;
|
|
113
|
+
case e:
|
|
114
|
+
i = (t - n) / s + 4;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
i /= 6;
|
|
118
|
+
}
|
|
119
|
+
return { h: i, s: c, v: a };
|
|
120
|
+
}
|
|
121
|
+
function Me(t, n, e) {
|
|
122
|
+
t = w(t, 360) * 6, n = w(n, 100), e = w(e, 100);
|
|
123
|
+
const r = Math.floor(t), o = t - r, i = e * (1 - n), a = e * (1 - o * n), s = e * (1 - (1 - o) * n), c = r % 6, h = [e, a, i, i, s, e][c], d = [s, e, e, a, i, i][c], u = [i, i, s, e, e, a][c];
|
|
124
|
+
return { r: h * 255, g: d * 255, b: u * 255 };
|
|
125
|
+
}
|
|
126
|
+
function Et(t, n, e, r) {
|
|
127
|
+
const o = [
|
|
128
|
+
I(Math.round(t).toString(16)),
|
|
129
|
+
I(Math.round(n).toString(16)),
|
|
130
|
+
I(Math.round(e).toString(16))
|
|
131
|
+
];
|
|
132
|
+
return r && o[0].startsWith(o[0].charAt(1)) && o[1].startsWith(o[1].charAt(1)) && o[2].startsWith(o[2].charAt(1)) ? o[0].charAt(0) + o[1].charAt(0) + o[2].charAt(0) : o.join("");
|
|
133
|
+
}
|
|
134
|
+
function Ne(t, n, e, r, o) {
|
|
135
|
+
const i = [
|
|
136
|
+
I(Math.round(t).toString(16)),
|
|
137
|
+
I(Math.round(n).toString(16)),
|
|
138
|
+
I(Math.round(e).toString(16)),
|
|
139
|
+
I(Dt(r))
|
|
140
|
+
];
|
|
141
|
+
return o && i[0].startsWith(i[0].charAt(1)) && i[1].startsWith(i[1].charAt(1)) && i[2].startsWith(i[2].charAt(1)) && i[3].startsWith(i[3].charAt(1)) ? i[0].charAt(0) + i[1].charAt(0) + i[2].charAt(0) + i[3].charAt(0) : i.join("");
|
|
142
|
+
}
|
|
143
|
+
function Rn(t, n, e, r) {
|
|
144
|
+
return [
|
|
145
|
+
I(Dt(r)),
|
|
146
|
+
I(Math.round(t).toString(16)),
|
|
147
|
+
I(Math.round(n).toString(16)),
|
|
148
|
+
I(Math.round(e).toString(16))
|
|
149
|
+
].join("");
|
|
150
|
+
}
|
|
151
|
+
function Se(t, n, e, r) {
|
|
152
|
+
const o = t / 100, i = n / 100, a = e / 100, s = r / 100, c = 255 * (1 - o) * (1 - s), h = 255 * (1 - i) * (1 - s), d = 255 * (1 - a) * (1 - s);
|
|
153
|
+
return { r: c, g: h, b: d };
|
|
154
|
+
}
|
|
155
|
+
function It(t, n, e) {
|
|
156
|
+
let r = 1 - t / 255, o = 1 - n / 255, i = 1 - e / 255, a = Math.min(r, o, i);
|
|
157
|
+
return a === 1 ? (r = 0, o = 0, i = 0) : (r = (r - a) / (1 - a) * 100, o = (o - a) / (1 - a) * 100, i = (i - a) / (1 - a) * 100), a *= 100, {
|
|
158
|
+
c: Math.round(r),
|
|
159
|
+
m: Math.round(o),
|
|
160
|
+
y: Math.round(i),
|
|
161
|
+
k: Math.round(a)
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function Dt(t) {
|
|
165
|
+
return Math.round(parseFloat(t) * 255).toString(16);
|
|
166
|
+
}
|
|
167
|
+
function At(t) {
|
|
168
|
+
return N(t) / 255;
|
|
169
|
+
}
|
|
170
|
+
function N(t) {
|
|
171
|
+
return parseInt(t, 16);
|
|
172
|
+
}
|
|
173
|
+
function Re(t) {
|
|
174
|
+
return {
|
|
175
|
+
r: t >> 16,
|
|
176
|
+
g: (t & 65280) >> 8,
|
|
177
|
+
b: t & 255
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
const dt = {
|
|
181
|
+
aliceblue: "#f0f8ff",
|
|
182
|
+
antiquewhite: "#faebd7",
|
|
183
|
+
aqua: "#00ffff",
|
|
184
|
+
aquamarine: "#7fffd4",
|
|
185
|
+
azure: "#f0ffff",
|
|
186
|
+
beige: "#f5f5dc",
|
|
187
|
+
bisque: "#ffe4c4",
|
|
188
|
+
black: "#000000",
|
|
189
|
+
blanchedalmond: "#ffebcd",
|
|
190
|
+
blue: "#0000ff",
|
|
191
|
+
blueviolet: "#8a2be2",
|
|
192
|
+
brown: "#a52a2a",
|
|
193
|
+
burlywood: "#deb887",
|
|
194
|
+
cadetblue: "#5f9ea0",
|
|
195
|
+
chartreuse: "#7fff00",
|
|
196
|
+
chocolate: "#d2691e",
|
|
197
|
+
coral: "#ff7f50",
|
|
198
|
+
cornflowerblue: "#6495ed",
|
|
199
|
+
cornsilk: "#fff8dc",
|
|
200
|
+
crimson: "#dc143c",
|
|
201
|
+
cyan: "#00ffff",
|
|
202
|
+
darkblue: "#00008b",
|
|
203
|
+
darkcyan: "#008b8b",
|
|
204
|
+
darkgoldenrod: "#b8860b",
|
|
205
|
+
darkgray: "#a9a9a9",
|
|
206
|
+
darkgreen: "#006400",
|
|
207
|
+
darkgrey: "#a9a9a9",
|
|
208
|
+
darkkhaki: "#bdb76b",
|
|
209
|
+
darkmagenta: "#8b008b",
|
|
210
|
+
darkolivegreen: "#556b2f",
|
|
211
|
+
darkorange: "#ff8c00",
|
|
212
|
+
darkorchid: "#9932cc",
|
|
213
|
+
darkred: "#8b0000",
|
|
214
|
+
darksalmon: "#e9967a",
|
|
215
|
+
darkseagreen: "#8fbc8f",
|
|
216
|
+
darkslateblue: "#483d8b",
|
|
217
|
+
darkslategray: "#2f4f4f",
|
|
218
|
+
darkslategrey: "#2f4f4f",
|
|
219
|
+
darkturquoise: "#00ced1",
|
|
220
|
+
darkviolet: "#9400d3",
|
|
221
|
+
deeppink: "#ff1493",
|
|
222
|
+
deepskyblue: "#00bfff",
|
|
223
|
+
dimgray: "#696969",
|
|
224
|
+
dimgrey: "#696969",
|
|
225
|
+
dodgerblue: "#1e90ff",
|
|
226
|
+
firebrick: "#b22222",
|
|
227
|
+
floralwhite: "#fffaf0",
|
|
228
|
+
forestgreen: "#228b22",
|
|
229
|
+
fuchsia: "#ff00ff",
|
|
230
|
+
gainsboro: "#dcdcdc",
|
|
231
|
+
ghostwhite: "#f8f8ff",
|
|
232
|
+
goldenrod: "#daa520",
|
|
233
|
+
gold: "#ffd700",
|
|
234
|
+
gray: "#808080",
|
|
235
|
+
green: "#008000",
|
|
236
|
+
greenyellow: "#adff2f",
|
|
237
|
+
grey: "#808080",
|
|
238
|
+
honeydew: "#f0fff0",
|
|
239
|
+
hotpink: "#ff69b4",
|
|
240
|
+
indianred: "#cd5c5c",
|
|
241
|
+
indigo: "#4b0082",
|
|
242
|
+
ivory: "#fffff0",
|
|
243
|
+
khaki: "#f0e68c",
|
|
244
|
+
lavenderblush: "#fff0f5",
|
|
245
|
+
lavender: "#e6e6fa",
|
|
246
|
+
lawngreen: "#7cfc00",
|
|
247
|
+
lemonchiffon: "#fffacd",
|
|
248
|
+
lightblue: "#add8e6",
|
|
249
|
+
lightcoral: "#f08080",
|
|
250
|
+
lightcyan: "#e0ffff",
|
|
251
|
+
lightgoldenrodyellow: "#fafad2",
|
|
252
|
+
lightgray: "#d3d3d3",
|
|
253
|
+
lightgreen: "#90ee90",
|
|
254
|
+
lightgrey: "#d3d3d3",
|
|
255
|
+
lightpink: "#ffb6c1",
|
|
256
|
+
lightsalmon: "#ffa07a",
|
|
257
|
+
lightseagreen: "#20b2aa",
|
|
258
|
+
lightskyblue: "#87cefa",
|
|
259
|
+
lightslategray: "#778899",
|
|
260
|
+
lightslategrey: "#778899",
|
|
261
|
+
lightsteelblue: "#b0c4de",
|
|
262
|
+
lightyellow: "#ffffe0",
|
|
263
|
+
lime: "#00ff00",
|
|
264
|
+
limegreen: "#32cd32",
|
|
265
|
+
linen: "#faf0e6",
|
|
266
|
+
magenta: "#ff00ff",
|
|
267
|
+
maroon: "#800000",
|
|
268
|
+
mediumaquamarine: "#66cdaa",
|
|
269
|
+
mediumblue: "#0000cd",
|
|
270
|
+
mediumorchid: "#ba55d3",
|
|
271
|
+
mediumpurple: "#9370db",
|
|
272
|
+
mediumseagreen: "#3cb371",
|
|
273
|
+
mediumslateblue: "#7b68ee",
|
|
274
|
+
mediumspringgreen: "#00fa9a",
|
|
275
|
+
mediumturquoise: "#48d1cc",
|
|
276
|
+
mediumvioletred: "#c71585",
|
|
277
|
+
midnightblue: "#191970",
|
|
278
|
+
mintcream: "#f5fffa",
|
|
279
|
+
mistyrose: "#ffe4e1",
|
|
280
|
+
moccasin: "#ffe4b5",
|
|
281
|
+
navajowhite: "#ffdead",
|
|
282
|
+
navy: "#000080",
|
|
283
|
+
oldlace: "#fdf5e6",
|
|
284
|
+
olive: "#808000",
|
|
285
|
+
olivedrab: "#6b8e23",
|
|
286
|
+
orange: "#ffa500",
|
|
287
|
+
orangered: "#ff4500",
|
|
288
|
+
orchid: "#da70d6",
|
|
289
|
+
palegoldenrod: "#eee8aa",
|
|
290
|
+
palegreen: "#98fb98",
|
|
291
|
+
paleturquoise: "#afeeee",
|
|
292
|
+
palevioletred: "#db7093",
|
|
293
|
+
papayawhip: "#ffefd5",
|
|
294
|
+
peachpuff: "#ffdab9",
|
|
295
|
+
peru: "#cd853f",
|
|
296
|
+
pink: "#ffc0cb",
|
|
297
|
+
plum: "#dda0dd",
|
|
298
|
+
powderblue: "#b0e0e6",
|
|
299
|
+
purple: "#800080",
|
|
300
|
+
rebeccapurple: "#663399",
|
|
301
|
+
red: "#ff0000",
|
|
302
|
+
rosybrown: "#bc8f8f",
|
|
303
|
+
royalblue: "#4169e1",
|
|
304
|
+
saddlebrown: "#8b4513",
|
|
305
|
+
salmon: "#fa8072",
|
|
306
|
+
sandybrown: "#f4a460",
|
|
307
|
+
seagreen: "#2e8b57",
|
|
308
|
+
seashell: "#fff5ee",
|
|
309
|
+
sienna: "#a0522d",
|
|
310
|
+
silver: "#c0c0c0",
|
|
311
|
+
skyblue: "#87ceeb",
|
|
312
|
+
slateblue: "#6a5acd",
|
|
313
|
+
slategray: "#708090",
|
|
314
|
+
slategrey: "#708090",
|
|
315
|
+
snow: "#fffafa",
|
|
316
|
+
springgreen: "#00ff7f",
|
|
317
|
+
steelblue: "#4682b4",
|
|
318
|
+
tan: "#d2b48c",
|
|
319
|
+
teal: "#008080",
|
|
320
|
+
thistle: "#d8bfd8",
|
|
321
|
+
tomato: "#ff6347",
|
|
322
|
+
turquoise: "#40e0d0",
|
|
323
|
+
violet: "#ee82ee",
|
|
324
|
+
wheat: "#f5deb3",
|
|
325
|
+
white: "#ffffff",
|
|
326
|
+
whitesmoke: "#f5f5f5",
|
|
327
|
+
yellow: "#ffff00",
|
|
328
|
+
yellowgreen: "#9acd32"
|
|
329
|
+
};
|
|
330
|
+
function Ee(t) {
|
|
331
|
+
let n = { r: 0, g: 0, b: 0 }, e = 1, r = null, o = null, i = null, a = !1, s = !1;
|
|
332
|
+
return typeof t == "string" && (t = He(t)), typeof t == "object" && (M(t.r) && M(t.g) && M(t.b) ? (n = we(t.r, t.g, t.b), a = !0, s = String(t.r).slice(-1) === "%" ? "prgb" : "rgb") : M(t.h) && M(t.s) && M(t.v) ? (r = Z(t.s), o = Z(t.v), n = Me(t.h, r, o), a = !0, s = "hsv") : M(t.h) && M(t.s) && M(t.l) ? (r = Z(t.s), i = Z(t.l), n = ke(t.h, r, i), a = !0, s = "hsl") : M(t.c) && M(t.m) && M(t.y) && M(t.k) && (n = Se(t.c, t.m, t.y, t.k), a = !0, s = "cmyk"), Object.prototype.hasOwnProperty.call(t, "a") && (e = t.a)), e = Ot(e), {
|
|
333
|
+
ok: a,
|
|
334
|
+
format: t.format || s,
|
|
335
|
+
r: Math.min(255, Math.max(n.r, 0)),
|
|
336
|
+
g: Math.min(255, Math.max(n.g, 0)),
|
|
337
|
+
b: Math.min(255, Math.max(n.b, 0)),
|
|
338
|
+
a: e
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
const Ie = "[-\\+]?\\d+%?", Ae = "[-\\+]?\\d*\\.\\d+%?", q = "(?:" + Ae + ")|(?:" + Ie + ")", ft = "[\\s|\\(]+(" + q + ")[,|\\s]+(" + q + ")[,|\\s]+(" + q + ")\\s*\\)?", _ = (
|
|
342
|
+
// eslint-disable-next-line prettier/prettier
|
|
343
|
+
"[\\s|\\(]+(" + q + ")[,|\\s]+(" + q + ")[,|\\s]+(" + q + ")[,|\\s]+(" + q + ")\\s*\\)?"
|
|
344
|
+
), R = {
|
|
345
|
+
CSS_UNIT: new RegExp(q),
|
|
346
|
+
rgb: new RegExp("rgb" + ft),
|
|
347
|
+
rgba: new RegExp("rgba" + _),
|
|
348
|
+
hsl: new RegExp("hsl" + ft),
|
|
349
|
+
hsla: new RegExp("hsla" + _),
|
|
350
|
+
hsv: new RegExp("hsv" + ft),
|
|
351
|
+
hsva: new RegExp("hsva" + _),
|
|
352
|
+
cmyk: new RegExp("cmyk" + _),
|
|
353
|
+
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
354
|
+
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
355
|
+
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
356
|
+
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
357
|
+
};
|
|
358
|
+
function He(t) {
|
|
359
|
+
if (t = t.trim().toLowerCase(), t.length === 0)
|
|
360
|
+
return !1;
|
|
361
|
+
let n = !1;
|
|
362
|
+
if (dt[t])
|
|
363
|
+
t = dt[t], n = !0;
|
|
364
|
+
else if (t === "transparent")
|
|
365
|
+
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
|
366
|
+
let e = R.rgb.exec(t);
|
|
367
|
+
return e ? { r: e[1], g: e[2], b: e[3] } : (e = R.rgba.exec(t), e ? { r: e[1], g: e[2], b: e[3], a: e[4] } : (e = R.hsl.exec(t), e ? { h: e[1], s: e[2], l: e[3] } : (e = R.hsla.exec(t), e ? { h: e[1], s: e[2], l: e[3], a: e[4] } : (e = R.hsv.exec(t), e ? { h: e[1], s: e[2], v: e[3] } : (e = R.hsva.exec(t), e ? { h: e[1], s: e[2], v: e[3], a: e[4] } : (e = R.cmyk.exec(t), e ? {
|
|
368
|
+
c: e[1],
|
|
369
|
+
m: e[2],
|
|
370
|
+
y: e[3],
|
|
371
|
+
k: e[4]
|
|
372
|
+
} : (e = R.hex8.exec(t), e ? {
|
|
373
|
+
r: N(e[1]),
|
|
374
|
+
g: N(e[2]),
|
|
375
|
+
b: N(e[3]),
|
|
376
|
+
a: At(e[4]),
|
|
377
|
+
format: n ? "name" : "hex8"
|
|
378
|
+
} : (e = R.hex6.exec(t), e ? {
|
|
379
|
+
r: N(e[1]),
|
|
380
|
+
g: N(e[2]),
|
|
381
|
+
b: N(e[3]),
|
|
382
|
+
format: n ? "name" : "hex"
|
|
383
|
+
} : (e = R.hex4.exec(t), e ? {
|
|
384
|
+
r: N(e[1] + e[1]),
|
|
385
|
+
g: N(e[2] + e[2]),
|
|
386
|
+
b: N(e[3] + e[3]),
|
|
387
|
+
a: At(e[4] + e[4]),
|
|
388
|
+
format: n ? "name" : "hex8"
|
|
389
|
+
} : (e = R.hex3.exec(t), e ? {
|
|
390
|
+
r: N(e[1] + e[1]),
|
|
391
|
+
g: N(e[2] + e[2]),
|
|
392
|
+
b: N(e[3] + e[3]),
|
|
393
|
+
format: n ? "name" : "hex"
|
|
394
|
+
} : !1))))))))));
|
|
395
|
+
}
|
|
396
|
+
function M(t) {
|
|
397
|
+
return typeof t == "number" ? !Number.isNaN(t) : R.CSS_UNIT.test(t);
|
|
398
|
+
}
|
|
399
|
+
class C {
|
|
400
|
+
constructor(n = "", e = {}) {
|
|
401
|
+
if (P(this, "r"), P(this, "g"), P(this, "b"), P(this, "a"), P(this, "format"), P(this, "originalInput"), P(this, "isValid"), P(this, "gradientType"), P(this, "roundA"), n instanceof C)
|
|
402
|
+
return n;
|
|
403
|
+
typeof n == "number" && (n = Re(n)), this.originalInput = n;
|
|
404
|
+
const r = Ee(n);
|
|
405
|
+
this.originalInput = n, this.r = r.r, this.g = r.g, this.b = r.b, this.a = r.a, this.roundA = Math.round(100 * this.a) / 100, this.format = e.format ?? r.format, this.gradientType = e.gradientType, this.r < 1 && (this.r = Math.round(this.r)), this.g < 1 && (this.g = Math.round(this.g)), this.b < 1 && (this.b = Math.round(this.b)), this.isValid = r.ok;
|
|
406
|
+
}
|
|
407
|
+
get ok() {
|
|
408
|
+
return this.isValid;
|
|
409
|
+
}
|
|
410
|
+
isDark() {
|
|
411
|
+
return this.getBrightness() < 128;
|
|
412
|
+
}
|
|
413
|
+
isLight() {
|
|
414
|
+
return !this.isDark();
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Returns the perceived brightness of the color, from 0-255.
|
|
418
|
+
*/
|
|
419
|
+
getBrightness() {
|
|
420
|
+
const n = this.toRgb();
|
|
421
|
+
return (n.r * 299 + n.g * 587 + n.b * 114) / 1e3;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Returns the perceived luminance of a color, from 0-1.
|
|
425
|
+
*/
|
|
426
|
+
getLuminance() {
|
|
427
|
+
const n = this.toRgb();
|
|
428
|
+
let e, r, o;
|
|
429
|
+
const i = n.r / 255, a = n.g / 255, s = n.b / 255;
|
|
430
|
+
return i <= 0.03928 ? e = i / 12.92 : e = Math.pow((i + 0.055) / 1.055, 2.4), a <= 0.03928 ? r = a / 12.92 : r = Math.pow((a + 0.055) / 1.055, 2.4), s <= 0.03928 ? o = s / 12.92 : o = Math.pow((s + 0.055) / 1.055, 2.4), 0.2126 * e + 0.7152 * r + 0.0722 * o;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Returns the alpha value of a color, from 0-1.
|
|
434
|
+
*/
|
|
435
|
+
getAlpha() {
|
|
436
|
+
return this.a;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Sets the alpha value on the current color.
|
|
440
|
+
*
|
|
441
|
+
* @param alpha - The new alpha value. The accepted range is 0-1.
|
|
442
|
+
*/
|
|
443
|
+
setAlpha(n) {
|
|
444
|
+
return this.a = Ot(n), this.roundA = Math.round(100 * this.a) / 100, this;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Returns whether the color is monochrome.
|
|
448
|
+
*/
|
|
449
|
+
isMonochrome() {
|
|
450
|
+
const { s: n } = this.toHsl();
|
|
451
|
+
return n === 0;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Returns the object as a HSVA object.
|
|
455
|
+
*/
|
|
456
|
+
toHsv() {
|
|
457
|
+
const n = lt(this.r, this.g, this.b);
|
|
458
|
+
return { h: n.h * 360, s: n.s, v: n.v, a: this.a };
|
|
459
|
+
}
|
|
460
|
+
toHsv_() {
|
|
461
|
+
const n = lt(this.r, this.g, this.b);
|
|
462
|
+
return { h: n.h, s: n.s, v: n.v, a: this.a };
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Returns the hsva values interpolated into a string with the following format:
|
|
466
|
+
* "hsva(xxx, xxx, xxx, xx)".
|
|
467
|
+
*/
|
|
468
|
+
toHsvString() {
|
|
469
|
+
const n = lt(this.r, this.g, this.b), e = Math.round(n.h * 360), r = Math.round(n.s * 100), o = Math.round(n.v * 100);
|
|
470
|
+
return this.a === 1 ? `hsv(${e}, ${r}%, ${o}%)` : `hsva(${e}, ${r}%, ${o}%, ${this.roundA})`;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Returns the object as a HSLA object.
|
|
474
|
+
*/
|
|
475
|
+
toHsl() {
|
|
476
|
+
const n = Rt(this.r, this.g, this.b);
|
|
477
|
+
return { h: n.h * 360, s: n.s, l: n.l, a: this.a };
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Returns the hsla values interpolated into a string with the following format:
|
|
481
|
+
* "hsla(xxx, xxx, xxx, xx)".
|
|
482
|
+
*/
|
|
483
|
+
toHslString() {
|
|
484
|
+
const n = Rt(this.r, this.g, this.b), e = Math.round(n.h * 360), r = Math.round(n.s * 100), o = Math.round(n.l * 100);
|
|
485
|
+
return this.a === 1 ? `hsl(${e}, ${r}%, ${o}%)` : `hsla(${e}, ${r}%, ${o}%, ${this.roundA})`;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Returns the hex value of the color.
|
|
489
|
+
* @param allow3Char will shorten hex value to 3 char if possible
|
|
490
|
+
*/
|
|
491
|
+
toHex(n = !1) {
|
|
492
|
+
return Et(this.r, this.g, this.b, n);
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Returns the hex value of the color -with a # prefixed.
|
|
496
|
+
* @param allow3Char will shorten hex value to 3 char if possible
|
|
497
|
+
*/
|
|
498
|
+
toHexString(n = !1) {
|
|
499
|
+
return `#${this.toHex(n)}`;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Returns the hex 8 value of the color.
|
|
503
|
+
* @param allow4Char will shorten hex value to 4 char if possible
|
|
504
|
+
*/
|
|
505
|
+
toHex8(n = !1) {
|
|
506
|
+
return Ne(this.r, this.g, this.b, this.a, n);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Returns the hex 8 value of the color -with a # prefixed.
|
|
510
|
+
* @param allow4Char will shorten hex value to 4 char if possible
|
|
511
|
+
*/
|
|
512
|
+
toHex8String(n = !1) {
|
|
513
|
+
return `#${this.toHex8(n)}`;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Returns the shorter hex value of the color depends on its alpha -with a # prefixed.
|
|
517
|
+
* @param allowShortChar will shorten hex value to 3 or 4 char if possible
|
|
518
|
+
*/
|
|
519
|
+
toHexShortString(n = !1) {
|
|
520
|
+
return this.a === 1 ? this.toHexString(n) : this.toHex8String(n);
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Returns the object as a RGBA object.
|
|
524
|
+
*/
|
|
525
|
+
toRgb() {
|
|
526
|
+
return {
|
|
527
|
+
r: Math.round(this.r),
|
|
528
|
+
g: Math.round(this.g),
|
|
529
|
+
b: Math.round(this.b),
|
|
530
|
+
a: this.a
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
toRgbArray() {
|
|
534
|
+
const n = this.toRgb();
|
|
535
|
+
return [n.r, n.g, n.b];
|
|
536
|
+
}
|
|
537
|
+
toRgbArrayString() {
|
|
538
|
+
const n = this.toRgb();
|
|
539
|
+
return `${n.r},${n.g},${n.b}`;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Returns the RGBA values interpolated into a string with the following format:
|
|
543
|
+
* "RGBA(xxx, xxx, xxx, xx)".
|
|
544
|
+
*/
|
|
545
|
+
toRgbString() {
|
|
546
|
+
const n = Math.round(this.r), e = Math.round(this.g), r = Math.round(this.b);
|
|
547
|
+
return this.a === 1 ? `rgb(${n}, ${e}, ${r})` : `rgba(${n}, ${e}, ${r}, ${this.roundA})`;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Returns the object as a RGBA object.
|
|
551
|
+
*/
|
|
552
|
+
toPercentageRgb() {
|
|
553
|
+
const n = (e) => `${Math.round(w(e, 255) * 100)}%`;
|
|
554
|
+
return {
|
|
555
|
+
r: n(this.r),
|
|
556
|
+
g: n(this.g),
|
|
557
|
+
b: n(this.b),
|
|
558
|
+
a: this.a
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Returns the RGBA relative values interpolated into a string
|
|
563
|
+
*/
|
|
564
|
+
toPercentageRgbString() {
|
|
565
|
+
const n = (e) => Math.round(w(e, 255) * 100);
|
|
566
|
+
return this.a === 1 ? `rgb(${n(this.r)}%, ${n(this.g)}%, ${n(this.b)}%)` : `rgba(${n(this.r)}%, ${n(this.g)}%, ${n(this.b)}%, ${this.roundA})`;
|
|
567
|
+
}
|
|
568
|
+
toCmyk() {
|
|
569
|
+
return {
|
|
570
|
+
...It(this.r, this.g, this.b)
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
toCmykString() {
|
|
574
|
+
const { c: n, m: e, y: r, k: o } = It(this.r, this.g, this.b);
|
|
575
|
+
return `cmyk(${n}, ${e}, ${r}, ${o})`;
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* The 'real' name of the color -if there is one.
|
|
579
|
+
*/
|
|
580
|
+
toName() {
|
|
581
|
+
if (this.a === 0)
|
|
582
|
+
return "transparent";
|
|
583
|
+
if (this.a < 1)
|
|
584
|
+
return !1;
|
|
585
|
+
const n = `#${Et(this.r, this.g, this.b, !1)}`;
|
|
586
|
+
for (const [e, r] of Object.entries(dt))
|
|
587
|
+
if (n === r)
|
|
588
|
+
return e;
|
|
589
|
+
return !1;
|
|
590
|
+
}
|
|
591
|
+
toString(n) {
|
|
592
|
+
const e = !!n;
|
|
593
|
+
n = n ?? this.format;
|
|
594
|
+
let r = !1;
|
|
595
|
+
const o = this.a < 1 && this.a >= 0;
|
|
596
|
+
return !e && o && (n.startsWith("hex") || n === "name") ? n === "name" && this.a === 0 ? this.toName() : this.toRgbString() : (n === "rgb" && (r = this.toRgbString()), n === "prgb" && (r = this.toPercentageRgbString()), (n === "hex" || n === "hex6") && (r = this.toHexString()), n === "hex3" && (r = this.toHexString(!0)), n === "hex4" && (r = this.toHex8String(!0)), n === "hex8" && (r = this.toHex8String()), n === "name" && (r = this.toName()), n === "hsl" && (r = this.toHslString()), n === "hsv" && (r = this.toHsvString()), n === "cmyk" && (r = this.toCmykString()), r || this.toHexString());
|
|
597
|
+
}
|
|
598
|
+
toNumber() {
|
|
599
|
+
return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
|
|
600
|
+
}
|
|
601
|
+
clone() {
|
|
602
|
+
return new C(this.toString());
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Lighten the color a given amount. Providing 100 will always return white.
|
|
606
|
+
* @param amount - valid between 1-100
|
|
607
|
+
*/
|
|
608
|
+
lighten(n = 10) {
|
|
609
|
+
const e = this.toHsl();
|
|
610
|
+
return e.l += n / 100, e.l = Y(e.l), new C(e);
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Brighten the color a given amount, from 0 to 100.
|
|
614
|
+
* @param amount - valid between 1-100
|
|
615
|
+
*/
|
|
616
|
+
brighten(n = 10) {
|
|
617
|
+
const e = this.toRgb();
|
|
618
|
+
return e.r = Math.max(
|
|
619
|
+
0,
|
|
620
|
+
Math.min(255, e.r - Math.round(255 * -(n / 100)))
|
|
621
|
+
), e.g = Math.max(
|
|
622
|
+
0,
|
|
623
|
+
Math.min(255, e.g - Math.round(255 * -(n / 100)))
|
|
624
|
+
), e.b = Math.max(
|
|
625
|
+
0,
|
|
626
|
+
Math.min(255, e.b - Math.round(255 * -(n / 100)))
|
|
627
|
+
), new C(e);
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Darken the color a given amount, from 0 to 100.
|
|
631
|
+
* Providing 100 will always return black.
|
|
632
|
+
* @param amount - valid between 1-100
|
|
633
|
+
*/
|
|
634
|
+
darken(n = 10) {
|
|
635
|
+
const e = this.toHsl();
|
|
636
|
+
return e.l -= n / 100, e.l = Y(e.l), new C(e);
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Mix the color with pure white, from 0 to 100.
|
|
640
|
+
* Providing 0 will do nothing, providing 100 will always return white.
|
|
641
|
+
* @param amount - valid between 1-100
|
|
642
|
+
*/
|
|
643
|
+
tint(n = 10) {
|
|
644
|
+
return this.mix("white", n);
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Mix the color with pure black, from 0 to 100.
|
|
648
|
+
* Providing 0 will do nothing, providing 100 will always return black.
|
|
649
|
+
* @param amount - valid between 1-100
|
|
650
|
+
*/
|
|
651
|
+
shade(n = 10) {
|
|
652
|
+
return this.mix("black", n);
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Desaturate the color a given amount, from 0 to 100.
|
|
656
|
+
* Providing 100 will is the same as calling greyscale
|
|
657
|
+
* @param amount - valid between 1-100
|
|
658
|
+
*/
|
|
659
|
+
desaturate(n = 10) {
|
|
660
|
+
const e = this.toHsl();
|
|
661
|
+
return e.s -= n / 100, e.s = Y(e.s), new C(e);
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Saturate the color a given amount, from 0 to 100.
|
|
665
|
+
* @param amount - valid between 1-100
|
|
666
|
+
*/
|
|
667
|
+
saturate(n = 10) {
|
|
668
|
+
const e = this.toHsl();
|
|
669
|
+
return e.s += n / 100, e.s = Y(e.s), new C(e);
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Completely desaturates a color into greyscale.
|
|
673
|
+
* Same as calling `desaturate(100)`
|
|
674
|
+
*/
|
|
675
|
+
greyscale() {
|
|
676
|
+
return this.desaturate(100);
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
|
680
|
+
* Values outside of this range will be wrapped into this range.
|
|
681
|
+
*/
|
|
682
|
+
spin(n) {
|
|
683
|
+
const e = this.toHsl(), r = (e.h + n) % 360;
|
|
684
|
+
return e.h = r < 0 ? 360 + r : r, new C(e);
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Mix the current color a given amount with another color, from 0 to 100.
|
|
688
|
+
* 0 means no mixing (return current color).
|
|
689
|
+
*/
|
|
690
|
+
mix(n, e = 50) {
|
|
691
|
+
const r = this.toRgb(), o = new C(n).toRgb(), i = e / 100, a = {
|
|
692
|
+
r: (o.r - r.r) * i + r.r,
|
|
693
|
+
g: (o.g - r.g) * i + r.g,
|
|
694
|
+
b: (o.b - r.b) * i + r.b,
|
|
695
|
+
a: (o.a - r.a) * i + r.a
|
|
696
|
+
};
|
|
697
|
+
return new C(a);
|
|
698
|
+
}
|
|
699
|
+
analogous(n = 6, e = 30) {
|
|
700
|
+
const r = this.toHsl(), o = 360 / e, i = [this];
|
|
701
|
+
for (r.h = (r.h - (o * n >> 1) + 720) % 360; --n; )
|
|
702
|
+
r.h = (r.h + o) % 360, i.push(new C(r));
|
|
703
|
+
return i;
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* taken from https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js
|
|
707
|
+
*/
|
|
708
|
+
complement() {
|
|
709
|
+
const n = this.toHsl();
|
|
710
|
+
return n.h = (n.h + 180) % 360, new C(n);
|
|
711
|
+
}
|
|
712
|
+
monochromatic(n = 6) {
|
|
713
|
+
const e = this.toHsv(), { h: r } = e, { s: o } = e;
|
|
714
|
+
let { v: i } = e;
|
|
715
|
+
const a = [], s = 1 / n;
|
|
716
|
+
for (; n--; )
|
|
717
|
+
a.push(new C({ h: r, s: o, v: i })), i = (i + s) % 1;
|
|
718
|
+
return a;
|
|
719
|
+
}
|
|
720
|
+
splitcomplement() {
|
|
721
|
+
const n = this.toHsl(), { h: e } = n;
|
|
722
|
+
return [
|
|
723
|
+
this,
|
|
724
|
+
new C({ h: (e + 72) % 360, s: n.s, l: n.l }),
|
|
725
|
+
new C({ h: (e + 216) % 360, s: n.s, l: n.l })
|
|
726
|
+
];
|
|
727
|
+
}
|
|
728
|
+
/**
|
|
729
|
+
* Compute how the color would appear on a background
|
|
730
|
+
*/
|
|
731
|
+
onBackground(n) {
|
|
732
|
+
const e = this.toRgb(), r = new C(n).toRgb(), o = e.a + r.a * (1 - e.a);
|
|
733
|
+
return new C({
|
|
734
|
+
r: (e.r * e.a + r.r * r.a * (1 - e.a)) / o,
|
|
735
|
+
g: (e.g * e.a + r.g * r.a * (1 - e.a)) / o,
|
|
736
|
+
b: (e.b * e.a + r.b * r.a * (1 - e.a)) / o,
|
|
737
|
+
a: o
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Alias for `polyad(3)`
|
|
742
|
+
*/
|
|
743
|
+
triad() {
|
|
744
|
+
return this.polyad(3);
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* Alias for `polyad(4)`
|
|
748
|
+
*/
|
|
749
|
+
tetrad() {
|
|
750
|
+
return this.polyad(4);
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Get polyad colors, like (for 1, 2, 3, 4, 5, 6, 7, 8, etc...)
|
|
754
|
+
* monad, dyad, triad, tetrad, pentad, hexad, heptad, octad, etc...
|
|
755
|
+
*/
|
|
756
|
+
polyad(n) {
|
|
757
|
+
const e = this.toHsl(), { h: r } = e, o = [this], i = 360 / n;
|
|
758
|
+
for (let a = 1; a < n; a++)
|
|
759
|
+
o.push(
|
|
760
|
+
new C({ h: (r + a * i) % 360, s: e.s, l: e.l })
|
|
761
|
+
);
|
|
762
|
+
return o;
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* compare color vs current color
|
|
766
|
+
*/
|
|
767
|
+
equals(n) {
|
|
768
|
+
const e = new C(n);
|
|
769
|
+
return this.format === "cmyk" || e.format === "cmyk" ? this.toCmykString() === e.toCmykString() : this.toRgbString() === e.toRgbString();
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
function Pe(t, n) {
|
|
773
|
+
const {
|
|
774
|
+
getPrefixCls: e,
|
|
775
|
+
locale: r,
|
|
776
|
+
componentConfig: o
|
|
777
|
+
} = G(U), i = xt(
|
|
778
|
+
t,
|
|
779
|
+
{},
|
|
780
|
+
o == null ? void 0 : o.Empty
|
|
781
|
+
), { style: a, className: s, description: c, icon: h, imgSrc: d, ...u } = i, g = e("empty"), x = K(g, s), b = r.Empty.noData, l = typeof c == "string" ? c : "empty";
|
|
782
|
+
return /* @__PURE__ */ f("div", { ref: n, className: x, style: a, ...u, children: /* @__PURE__ */ tt("div", { className: `${g}-wrapper`, children: [
|
|
783
|
+
/* @__PURE__ */ f("div", { className: `${g}-image`, children: d ? /* @__PURE__ */ f("img", { alt: l, src: d }) : h || /* @__PURE__ */ f(ge, {}) }),
|
|
784
|
+
/* @__PURE__ */ f("div", { className: `${g}-description`, children: c || b })
|
|
785
|
+
] }) });
|
|
786
|
+
}
|
|
787
|
+
const Tt = nt(Pe);
|
|
788
|
+
Tt.displayName = "Empty";
|
|
789
|
+
const Fe = et.memo(Tt);
|
|
790
|
+
function qe(t) {
|
|
791
|
+
return /* @__PURE__ */ f(Fe, {});
|
|
792
|
+
}
|
|
793
|
+
const Lt = {
|
|
794
|
+
locale: me,
|
|
795
|
+
prefixCls: "pqb",
|
|
796
|
+
getPopupContainer: () => document.body,
|
|
797
|
+
size: "default",
|
|
798
|
+
renderEmpty: qe
|
|
799
|
+
}, U = se({
|
|
800
|
+
getPrefixCls: (t, n) => `${n || "pqb"}-${t}`,
|
|
801
|
+
...Lt
|
|
802
|
+
});
|
|
803
|
+
function Ue(t, n) {
|
|
804
|
+
const {
|
|
805
|
+
children: e,
|
|
806
|
+
className: r,
|
|
807
|
+
disabled: o,
|
|
808
|
+
prefix: i,
|
|
809
|
+
size: a = "default",
|
|
810
|
+
...s
|
|
811
|
+
} = t, { getPrefixCls: c } = G(U), h = c("icon-hover"), d = j();
|
|
812
|
+
return rt(n, () => ({
|
|
813
|
+
getRootDOMNode: () => d.current
|
|
814
|
+
})), /* @__PURE__ */ f(
|
|
815
|
+
"span",
|
|
816
|
+
{
|
|
817
|
+
ref: d,
|
|
818
|
+
className: K(
|
|
819
|
+
h,
|
|
820
|
+
{
|
|
821
|
+
[`${i}-icon-hover`]: i,
|
|
822
|
+
[`${h}-size-${a}`]: a && a !== "default",
|
|
823
|
+
[`${h}-disabled`]: o
|
|
824
|
+
},
|
|
825
|
+
r
|
|
826
|
+
),
|
|
827
|
+
onClick: t.onClick,
|
|
828
|
+
...s,
|
|
829
|
+
children: e
|
|
830
|
+
}
|
|
831
|
+
);
|
|
832
|
+
}
|
|
833
|
+
const Ht = et.forwardRef(Ue), je = {
|
|
834
|
+
type: "info",
|
|
835
|
+
showIcon: !0,
|
|
836
|
+
noticeType: "message",
|
|
837
|
+
duration: 3e3
|
|
838
|
+
};
|
|
839
|
+
function Oe(t, n) {
|
|
840
|
+
const {
|
|
841
|
+
getPrefixCls: e,
|
|
842
|
+
componentConfig: r,
|
|
843
|
+
rtl: o
|
|
844
|
+
} = G(U), i = xt(
|
|
845
|
+
t,
|
|
846
|
+
je,
|
|
847
|
+
r == null ? void 0 : r.Notice
|
|
848
|
+
), a = G(U), s = e("notice");
|
|
849
|
+
j();
|
|
850
|
+
const c = j(), h = j(), d = j(), {
|
|
851
|
+
title: u,
|
|
852
|
+
content: g,
|
|
853
|
+
showIcon: x,
|
|
854
|
+
className: b,
|
|
855
|
+
style: l,
|
|
856
|
+
type: m,
|
|
857
|
+
btn: p,
|
|
858
|
+
icon: v,
|
|
859
|
+
prefixCls: y,
|
|
860
|
+
closable: k,
|
|
861
|
+
noticeType: D,
|
|
862
|
+
iconPrefix: vt,
|
|
863
|
+
rtl: ne = o,
|
|
864
|
+
closeIcon: Q,
|
|
865
|
+
classPrefixCls: $t
|
|
866
|
+
} = i, re = K(
|
|
867
|
+
y,
|
|
868
|
+
`${y}-${m}`,
|
|
869
|
+
{
|
|
870
|
+
[`${y}-closable`]: k,
|
|
871
|
+
[`${y}-rtl`]: ne
|
|
872
|
+
},
|
|
873
|
+
b
|
|
874
|
+
);
|
|
875
|
+
let ot = "closable" in i ? k : !0, it = x;
|
|
876
|
+
m === "normal" && !v && (it = !1);
|
|
877
|
+
const wt = { ...a };
|
|
878
|
+
$t && (wt.prefixCls = $t);
|
|
879
|
+
function oe() {
|
|
880
|
+
return h.current;
|
|
881
|
+
}
|
|
882
|
+
function at() {
|
|
883
|
+
const { duration: S, onClose: L, id: st } = i;
|
|
884
|
+
S !== 0 && (c.current = window.setTimeout(() => {
|
|
885
|
+
L == null || L(st), z();
|
|
886
|
+
}, S));
|
|
887
|
+
}
|
|
888
|
+
function z() {
|
|
889
|
+
c.current && (window.clearTimeout(c.current), c.current = null);
|
|
890
|
+
}
|
|
891
|
+
function X() {
|
|
892
|
+
var S;
|
|
893
|
+
(S = i.onClose) == null || S.call(i, i.id);
|
|
894
|
+
}
|
|
895
|
+
function kt() {
|
|
896
|
+
const { showIcon: S, icon: L, type: st, iconPrefix: Mt } = i;
|
|
897
|
+
let H;
|
|
898
|
+
if (L)
|
|
899
|
+
H = L;
|
|
900
|
+
else if (S) {
|
|
901
|
+
switch (st) {
|
|
902
|
+
case "info":
|
|
903
|
+
H = /* @__PURE__ */ f(ue, {});
|
|
904
|
+
break;
|
|
905
|
+
case "success":
|
|
906
|
+
H = /* @__PURE__ */ f(le, {});
|
|
907
|
+
break;
|
|
908
|
+
case "error":
|
|
909
|
+
H = /* @__PURE__ */ f(fe, {});
|
|
910
|
+
break;
|
|
911
|
+
case "warning":
|
|
912
|
+
H = /* @__PURE__ */ f(he, {});
|
|
913
|
+
break;
|
|
914
|
+
case "loading":
|
|
915
|
+
H = /* @__PURE__ */ f(de, {});
|
|
916
|
+
break;
|
|
917
|
+
}
|
|
918
|
+
H = /* @__PURE__ */ f(
|
|
919
|
+
ut.Provider,
|
|
920
|
+
{
|
|
921
|
+
value: Mt ? { prefixCls: Mt } : {},
|
|
922
|
+
children: H
|
|
923
|
+
}
|
|
924
|
+
);
|
|
925
|
+
}
|
|
926
|
+
return /* @__PURE__ */ f("span", { className: `${y}-icon`, children: H });
|
|
927
|
+
}
|
|
928
|
+
function ie() {
|
|
929
|
+
z();
|
|
930
|
+
}
|
|
931
|
+
function ae() {
|
|
932
|
+
z(), at();
|
|
933
|
+
}
|
|
934
|
+
rt(n, () => ({
|
|
935
|
+
getRootDOMNode: oe
|
|
936
|
+
}), []), E(() => {
|
|
937
|
+
const S = d.current;
|
|
938
|
+
return (S && (S == null ? void 0 : S.duration) !== i.duration || i.update) && (z(), at()), d.current = i, () => {
|
|
939
|
+
};
|
|
940
|
+
}, [i.duration, i.update]), E(() => (at(), () => {
|
|
941
|
+
z();
|
|
942
|
+
}), []);
|
|
943
|
+
let T;
|
|
944
|
+
return D === "message" && (ot = k, T = /* @__PURE__ */ tt(Nt, { children: [
|
|
945
|
+
it && kt(),
|
|
946
|
+
/* @__PURE__ */ f("span", { className: `${y}-content`, children: g }),
|
|
947
|
+
ot && (Q !== void 0 ? /* @__PURE__ */ f("span", { onClick: X, className: `${y}-close-btn`, children: Q }) : /* @__PURE__ */ f(
|
|
948
|
+
Ht,
|
|
949
|
+
{
|
|
950
|
+
prefix: y,
|
|
951
|
+
className: `${y}-close-btn`,
|
|
952
|
+
onClick: X,
|
|
953
|
+
children: /* @__PURE__ */ f(St, {})
|
|
954
|
+
}
|
|
955
|
+
))
|
|
956
|
+
] })), D === "notification" && (T = /* @__PURE__ */ tt(Nt, { children: [
|
|
957
|
+
it && /* @__PURE__ */ f("div", { className: `${y}-left`, children: kt() }),
|
|
958
|
+
/* @__PURE__ */ tt("div", { className: `${y}-right`, children: [
|
|
959
|
+
u && /* @__PURE__ */ f("div", { className: `${y}-title`, children: u }),
|
|
960
|
+
/* @__PURE__ */ f("div", { className: `${y}-content`, children: g }),
|
|
961
|
+
p && /* @__PURE__ */ f("div", { className: `${y}-btn-wrapper`, children: p })
|
|
962
|
+
] }),
|
|
963
|
+
ot && (Q !== void 0 ? /* @__PURE__ */ f("span", { onClick: X, className: `${y}-close-btn`, children: Q }) : /* @__PURE__ */ f(
|
|
964
|
+
Ht,
|
|
965
|
+
{
|
|
966
|
+
prefix: y,
|
|
967
|
+
className: `${y}-close-btn`,
|
|
968
|
+
onClick: X,
|
|
969
|
+
children: /* @__PURE__ */ f(
|
|
970
|
+
ut.Provider,
|
|
971
|
+
{
|
|
972
|
+
value: vt ? { prefixCls: vt } : {},
|
|
973
|
+
children: /* @__PURE__ */ f(St, {})
|
|
974
|
+
}
|
|
975
|
+
)
|
|
976
|
+
}
|
|
977
|
+
))
|
|
978
|
+
] })), T && (T = /* @__PURE__ */ f(Ct, { ...wt, children: /* @__PURE__ */ f(
|
|
979
|
+
"div",
|
|
980
|
+
{
|
|
981
|
+
ref: h,
|
|
982
|
+
className: `${s}-${D}`,
|
|
983
|
+
onMouseEnter: ie,
|
|
984
|
+
onMouseLeave: ae,
|
|
985
|
+
children: /* @__PURE__ */ f("div", { className: re, style: l, role: "alert", children: T })
|
|
986
|
+
}
|
|
987
|
+
) })), T;
|
|
988
|
+
}
|
|
989
|
+
const Wt = nt(Oe);
|
|
990
|
+
function De(t = {}) {
|
|
991
|
+
const {
|
|
992
|
+
maxCount: n,
|
|
993
|
+
duration: e = 3e3,
|
|
994
|
+
prefixCls: r,
|
|
995
|
+
getContainer: o
|
|
996
|
+
} = t, i = j(), a = /* @__PURE__ */ f(ee, { ref: i }), s = {};
|
|
997
|
+
let c;
|
|
998
|
+
function h(u) {
|
|
999
|
+
let g, x;
|
|
1000
|
+
if (i.current) {
|
|
1001
|
+
const v = i.current.getContextConfig();
|
|
1002
|
+
x = v.rtl, g = v.prefixCls;
|
|
1003
|
+
}
|
|
1004
|
+
const b = r || g, l = yt(u.position, x), m = {
|
|
1005
|
+
duration: e,
|
|
1006
|
+
...u
|
|
1007
|
+
}, p = s[l];
|
|
1008
|
+
if (p) {
|
|
1009
|
+
if (p.notices.length >= n) {
|
|
1010
|
+
const v = p.notices[0];
|
|
1011
|
+
m.id = v.id, p.shift();
|
|
1012
|
+
}
|
|
1013
|
+
p.add({ ...m });
|
|
1014
|
+
} else
|
|
1015
|
+
c = /* @__PURE__ */ f(
|
|
1016
|
+
A,
|
|
1017
|
+
{
|
|
1018
|
+
...m,
|
|
1019
|
+
prefixCls: b,
|
|
1020
|
+
rtl: x,
|
|
1021
|
+
getContainer: o,
|
|
1022
|
+
callback: (v) => {
|
|
1023
|
+
s[l] = v;
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
), i.current.addInstance(c);
|
|
1027
|
+
return s[l];
|
|
1028
|
+
}
|
|
1029
|
+
const d = {};
|
|
1030
|
+
return pt.forEach((u) => {
|
|
1031
|
+
d[u] = (g) => h({
|
|
1032
|
+
...g,
|
|
1033
|
+
type: u
|
|
1034
|
+
});
|
|
1035
|
+
}), [d, a];
|
|
1036
|
+
}
|
|
1037
|
+
const Te = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Pt = { randomUUID: Te };
|
|
1038
|
+
let ht;
|
|
1039
|
+
const Le = new Uint8Array(16);
|
|
1040
|
+
function We() {
|
|
1041
|
+
if (!ht) {
|
|
1042
|
+
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
1043
|
+
throw new Error(
|
|
1044
|
+
"crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"
|
|
1045
|
+
);
|
|
1046
|
+
ht = crypto.getRandomValues.bind(crypto);
|
|
1047
|
+
}
|
|
1048
|
+
return ht(Le);
|
|
1049
|
+
}
|
|
1050
|
+
const $ = [];
|
|
1051
|
+
for (let t = 0; t < 256; ++t)
|
|
1052
|
+
$.push((t + 256).toString(16).slice(1));
|
|
1053
|
+
function Ve(t, n = 0) {
|
|
1054
|
+
return ($[t[n + 0]] + $[t[n + 1]] + $[t[n + 2]] + $[t[n + 3]] + "-" + $[t[n + 4]] + $[t[n + 5]] + "-" + $[t[n + 6]] + $[t[n + 7]] + "-" + $[t[n + 8]] + $[t[n + 9]] + "-" + $[t[n + 10]] + $[t[n + 11]] + $[t[n + 12]] + $[t[n + 13]] + $[t[n + 14]] + $[t[n + 15]]).toLowerCase();
|
|
1055
|
+
}
|
|
1056
|
+
function ze(t, n, e) {
|
|
1057
|
+
var r;
|
|
1058
|
+
if (Pt.randomUUID && !n && !t)
|
|
1059
|
+
return Pt.randomUUID();
|
|
1060
|
+
t = t || {};
|
|
1061
|
+
const o = t.random ?? ((r = t.rng) == null ? void 0 : r.call(t)) ?? We();
|
|
1062
|
+
if (o.length < 16)
|
|
1063
|
+
throw new Error("Random bytes length must be >= 16");
|
|
1064
|
+
if (o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, n) {
|
|
1065
|
+
if (e = e || 0, e < 0 || e + 16 > n.length)
|
|
1066
|
+
throw new RangeError(
|
|
1067
|
+
`UUID byte range ${e}:${e + 15} is out of buffer bounds`
|
|
1068
|
+
);
|
|
1069
|
+
for (let i = 0; i < 16; ++i)
|
|
1070
|
+
n[e + i] = o[i];
|
|
1071
|
+
return n;
|
|
1072
|
+
}
|
|
1073
|
+
return Ve(o);
|
|
1074
|
+
}
|
|
1075
|
+
function Vt(t) {
|
|
1076
|
+
function n(e, r) {
|
|
1077
|
+
const [o, i] = Ft(
|
|
1078
|
+
(e == null ? void 0 : e.notices) ?? []
|
|
1079
|
+
);
|
|
1080
|
+
function a(u) {
|
|
1081
|
+
const g = (u == null ? void 0 : u.id) ?? `pqb_notice_id_${ze()}`;
|
|
1082
|
+
return u.id && o.findIndex((x) => x.id === u.id) !== -1 ? s(u) : i((x) => [].concat(x, {
|
|
1083
|
+
...u,
|
|
1084
|
+
id: g
|
|
1085
|
+
})), g;
|
|
1086
|
+
}
|
|
1087
|
+
function s(u) {
|
|
1088
|
+
i((g) => g.map((x) => u.id === x.id ? (delete x.update, u) : x));
|
|
1089
|
+
}
|
|
1090
|
+
function c() {
|
|
1091
|
+
i((u) => {
|
|
1092
|
+
const g = [].concat(u);
|
|
1093
|
+
return g.shift(), g;
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
function h(u) {
|
|
1097
|
+
i((g) => g.filter((x) => x.id !== u));
|
|
1098
|
+
}
|
|
1099
|
+
function d() {
|
|
1100
|
+
i((u) => []);
|
|
1101
|
+
}
|
|
1102
|
+
return rt(r, () => ({ notices: o, add: a, update: s, shift: c, remove: h, clear: d }), [o, a, s, c, h, d]), E(() => () => {
|
|
1103
|
+
}, [o]), /* @__PURE__ */ f(
|
|
1104
|
+
t,
|
|
1105
|
+
{
|
|
1106
|
+
...e,
|
|
1107
|
+
notices: o,
|
|
1108
|
+
add: a,
|
|
1109
|
+
update: s,
|
|
1110
|
+
shift: c,
|
|
1111
|
+
remove: h,
|
|
1112
|
+
clear: d
|
|
1113
|
+
}
|
|
1114
|
+
);
|
|
1115
|
+
}
|
|
1116
|
+
return nt(n);
|
|
1117
|
+
}
|
|
1118
|
+
const pt = [
|
|
1119
|
+
"info",
|
|
1120
|
+
"success",
|
|
1121
|
+
"error",
|
|
1122
|
+
"warning",
|
|
1123
|
+
"loading",
|
|
1124
|
+
"normal"
|
|
1125
|
+
];
|
|
1126
|
+
let O = {}, zt, Bt, Gt, gt, J;
|
|
1127
|
+
function yt(t, n) {
|
|
1128
|
+
return B(t) && (t = n || J ? "topLeft" : "topRight"), t;
|
|
1129
|
+
}
|
|
1130
|
+
function Be(t) {
|
|
1131
|
+
const { prefixCls: n, rtl: e, getContainer: r, notices: o } = t, i = B(e) ? J : e, a = yt(t.position, i), s = n || Bt, c = s ? `${s}-notification` : "pqb-notification";
|
|
1132
|
+
let h;
|
|
1133
|
+
a === "topLeft" || a === "bottomLeft" ? h = "slideNoticeLeft" : h = "slideNoticeRight";
|
|
1134
|
+
const d = K(
|
|
1135
|
+
`${c}-wrapper`,
|
|
1136
|
+
`${c}-wrapper-${a}`,
|
|
1137
|
+
{ [`${c}-wrapper-rtl`]: J }
|
|
1138
|
+
), u = r == null ? void 0 : r();
|
|
1139
|
+
function g(b) {
|
|
1140
|
+
const l = o.find((m) => m.id === b);
|
|
1141
|
+
l && t.update({
|
|
1142
|
+
...l,
|
|
1143
|
+
style: { ...l.style, opacity: 0 }
|
|
1144
|
+
}), setTimeout(() => {
|
|
1145
|
+
t.remove(b);
|
|
1146
|
+
}, 200);
|
|
1147
|
+
}
|
|
1148
|
+
E(() => (t.add(t), () => {
|
|
1149
|
+
t.clear();
|
|
1150
|
+
}), []), E(() => {
|
|
1151
|
+
var l;
|
|
1152
|
+
const b = {
|
|
1153
|
+
...t,
|
|
1154
|
+
add: t.add,
|
|
1155
|
+
update: t.update,
|
|
1156
|
+
clear: t.clear,
|
|
1157
|
+
remove: g
|
|
1158
|
+
};
|
|
1159
|
+
return (l = t.callback) == null || l.call(t, b), () => {
|
|
1160
|
+
var m;
|
|
1161
|
+
(m = t.callback) == null || m.call(t, null);
|
|
1162
|
+
};
|
|
1163
|
+
}, [t, t.notices]);
|
|
1164
|
+
const x = /* @__PURE__ */ f("div", { className: d, children: /* @__PURE__ */ f(qt, { component: null, children: o.map((b) => /* @__PURE__ */ f(
|
|
1165
|
+
Ut,
|
|
1166
|
+
{
|
|
1167
|
+
timeout: {
|
|
1168
|
+
enter: 400,
|
|
1169
|
+
exit: 300
|
|
1170
|
+
},
|
|
1171
|
+
classNames: h,
|
|
1172
|
+
onExit: (l) => {
|
|
1173
|
+
l && (l.style.height = `${l.scrollHeight}px`);
|
|
1174
|
+
},
|
|
1175
|
+
onExiting: (l) => {
|
|
1176
|
+
l && (l.style.height = 0);
|
|
1177
|
+
},
|
|
1178
|
+
onExited: (l) => {
|
|
1179
|
+
var m;
|
|
1180
|
+
l && (l.style.height = 0, (m = b.onClose) == null || m.call(b));
|
|
1181
|
+
},
|
|
1182
|
+
children: /* @__PURE__ */ f(
|
|
1183
|
+
Wt,
|
|
1184
|
+
{
|
|
1185
|
+
...b,
|
|
1186
|
+
onClose: g,
|
|
1187
|
+
prefixCls: c,
|
|
1188
|
+
iconPrefix: s,
|
|
1189
|
+
classPrefixCls: s,
|
|
1190
|
+
noticeType: "notification",
|
|
1191
|
+
rtl: i
|
|
1192
|
+
}
|
|
1193
|
+
)
|
|
1194
|
+
},
|
|
1195
|
+
b.id
|
|
1196
|
+
)) }) });
|
|
1197
|
+
return u ? be(x, u) : x;
|
|
1198
|
+
}
|
|
1199
|
+
const A = Vt(Be);
|
|
1200
|
+
A.useNotification = De;
|
|
1201
|
+
A.config = (t = {}) => {
|
|
1202
|
+
var n;
|
|
1203
|
+
V(t.maxCount) && (zt = t.maxCount), t.prefixCls && (Bt = t.prefixCls), V(t.duration) && (Gt = t.duration), typeof t.rtl == "boolean" && (J = t.rtl), t.getContainer && ((n = t.getContainer) == null ? void 0 : n.call(t)) !== gt && (gt = t.getContainer(), Object.values(O).forEach(
|
|
1204
|
+
(e) => {
|
|
1205
|
+
var r;
|
|
1206
|
+
return (r = e == null ? void 0 : e.clear) == null ? void 0 : r.call(e);
|
|
1207
|
+
}
|
|
1208
|
+
), O = {});
|
|
1209
|
+
};
|
|
1210
|
+
A.clear = () => {
|
|
1211
|
+
Object.values(O).forEach((t) => {
|
|
1212
|
+
t == null || t.clear();
|
|
1213
|
+
});
|
|
1214
|
+
};
|
|
1215
|
+
A.remove = (t) => {
|
|
1216
|
+
Object.values(O).forEach((n) => {
|
|
1217
|
+
n == null || n.remove(t);
|
|
1218
|
+
});
|
|
1219
|
+
};
|
|
1220
|
+
A.addInstance = (t) => {
|
|
1221
|
+
const n = yt(t.position, J), e = O[n], r = {
|
|
1222
|
+
duration: Gt,
|
|
1223
|
+
...t
|
|
1224
|
+
};
|
|
1225
|
+
if (e) {
|
|
1226
|
+
const a = e.notices.find(
|
|
1227
|
+
(c) => c.id === t.id
|
|
1228
|
+
), s = {
|
|
1229
|
+
...r,
|
|
1230
|
+
update: a
|
|
1231
|
+
};
|
|
1232
|
+
return e.notices.length >= zt && (a ? s.id = a.id : e.shift()), e.add({ ...s }), e;
|
|
1233
|
+
}
|
|
1234
|
+
const o = document.createElement("div");
|
|
1235
|
+
return (gt || document.body).appendChild(o), jt(o).render(
|
|
1236
|
+
/* @__PURE__ */ f(
|
|
1237
|
+
A,
|
|
1238
|
+
{
|
|
1239
|
+
...r,
|
|
1240
|
+
callback: (a) => {
|
|
1241
|
+
O[n] = a;
|
|
1242
|
+
},
|
|
1243
|
+
ref: (a) => () => {
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
)
|
|
1247
|
+
), O[n];
|
|
1248
|
+
};
|
|
1249
|
+
pt.forEach((t) => {
|
|
1250
|
+
A[t] = (n) => A.addInstance({
|
|
1251
|
+
...n,
|
|
1252
|
+
type: t
|
|
1253
|
+
});
|
|
1254
|
+
});
|
|
1255
|
+
function Ge(t = {}) {
|
|
1256
|
+
const { maxCount: n, duration: e = 3e3, prefixCls: r } = t, o = j(), i = /* @__PURE__ */ f(ee, { ref: o }), a = {};
|
|
1257
|
+
let s;
|
|
1258
|
+
function c(d) {
|
|
1259
|
+
let u, g;
|
|
1260
|
+
if (o.current) {
|
|
1261
|
+
const k = o.current.getContextConfig();
|
|
1262
|
+
g = k.rtl, u = k.prefixCls;
|
|
1263
|
+
}
|
|
1264
|
+
const x = r || u, b = {
|
|
1265
|
+
position: "top",
|
|
1266
|
+
duration: e,
|
|
1267
|
+
...d
|
|
1268
|
+
}, { position: l, transitionClassNames: m } = b;
|
|
1269
|
+
let p;
|
|
1270
|
+
const v = a[l];
|
|
1271
|
+
return v ? v.notices.length >= n ? (p = v.notices[0].id, v.shift(), v.add({ ...b, id: p })) : p = v.add(b) : (s = /* @__PURE__ */ f(
|
|
1272
|
+
F,
|
|
1273
|
+
{
|
|
1274
|
+
...b,
|
|
1275
|
+
transitionClassNames: m,
|
|
1276
|
+
prefixCls: x,
|
|
1277
|
+
rtl: g,
|
|
1278
|
+
callback: (k) => {
|
|
1279
|
+
a[l] = k;
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
), o.current.addInstance(s)), () => {
|
|
1283
|
+
var k, D;
|
|
1284
|
+
(D = (k = a[l]) == null ? void 0 : k.remove) == null || D.call(k, p);
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
const h = {};
|
|
1288
|
+
return Jt.forEach((d) => {
|
|
1289
|
+
h[d] = (u) => {
|
|
1290
|
+
const g = xe(u) ? { content: u } : u;
|
|
1291
|
+
return c({
|
|
1292
|
+
...g,
|
|
1293
|
+
type: d
|
|
1294
|
+
});
|
|
1295
|
+
};
|
|
1296
|
+
}), [h, i];
|
|
1297
|
+
}
|
|
1298
|
+
const Jt = [...pt];
|
|
1299
|
+
let W = {}, Kt, Qt, Xt, mt, Yt, Zt;
|
|
1300
|
+
function Je(t) {
|
|
1301
|
+
const {
|
|
1302
|
+
transitionClassNames: n,
|
|
1303
|
+
transitionTimeout: e,
|
|
1304
|
+
prefixCls: r,
|
|
1305
|
+
rtl: o,
|
|
1306
|
+
closable: i,
|
|
1307
|
+
notices: a,
|
|
1308
|
+
position: s
|
|
1309
|
+
} = t;
|
|
1310
|
+
function c(l) {
|
|
1311
|
+
const m = t.notices.find((p) => p.id === l);
|
|
1312
|
+
m && t.update({
|
|
1313
|
+
...m,
|
|
1314
|
+
style: { ...m.style, opacity: 0 }
|
|
1315
|
+
}), setTimeout(() => {
|
|
1316
|
+
t.remove(l);
|
|
1317
|
+
}, 100);
|
|
1318
|
+
}
|
|
1319
|
+
E(() => (t.add(t), () => {
|
|
1320
|
+
t.clear();
|
|
1321
|
+
}), []), E(() => {
|
|
1322
|
+
var m;
|
|
1323
|
+
const l = {
|
|
1324
|
+
...t,
|
|
1325
|
+
add: t.add,
|
|
1326
|
+
update: t.update,
|
|
1327
|
+
clear: t.clear,
|
|
1328
|
+
remove: c
|
|
1329
|
+
};
|
|
1330
|
+
return (m = t.callback) == null || m.call(t, l), () => {
|
|
1331
|
+
var p;
|
|
1332
|
+
(p = t.callback) == null || p.call(t, null);
|
|
1333
|
+
};
|
|
1334
|
+
}, [t, t.notices]);
|
|
1335
|
+
const h = r || Qt, d = B(o) ? Yt : o, u = B(i) ? Zt : i, g = h ? `${h}-message` : "pqb-message", x = {
|
|
1336
|
+
enter: V(e == null ? void 0 : e.enter) ? e == null ? void 0 : e.enter : 100,
|
|
1337
|
+
exit: V(e == null ? void 0 : e.exit) ? e == null ? void 0 : e.exit : 300
|
|
1338
|
+
}, b = K(
|
|
1339
|
+
`${g}-wrapper`,
|
|
1340
|
+
`${g}-wrapper-${s}`
|
|
1341
|
+
);
|
|
1342
|
+
return /* @__PURE__ */ f("div", { className: b, children: /* @__PURE__ */ f(qt, { component: null, children: a.map((l) => /* @__PURE__ */ f(
|
|
1343
|
+
Ut,
|
|
1344
|
+
{
|
|
1345
|
+
timeout: x,
|
|
1346
|
+
classNames: n || "fadeMessage",
|
|
1347
|
+
onExit: (m) => {
|
|
1348
|
+
m && (m.style.height = `${m.scrollHeight}px`);
|
|
1349
|
+
},
|
|
1350
|
+
onExiting: (m) => {
|
|
1351
|
+
m && (m.style.height = 0);
|
|
1352
|
+
},
|
|
1353
|
+
onExited: (m) => {
|
|
1354
|
+
var p;
|
|
1355
|
+
m && (m.style.height = 0, (p = l.onClose) == null || p.call(l));
|
|
1356
|
+
},
|
|
1357
|
+
children: /* @__PURE__ */ f(
|
|
1358
|
+
Wt,
|
|
1359
|
+
{
|
|
1360
|
+
...l,
|
|
1361
|
+
prefixCls: g,
|
|
1362
|
+
classPrefixCls: h,
|
|
1363
|
+
iconPrefix: h,
|
|
1364
|
+
onClose: c,
|
|
1365
|
+
noticeType: "message",
|
|
1366
|
+
rtl: d,
|
|
1367
|
+
...B(u) ? {} : { closable: u }
|
|
1368
|
+
}
|
|
1369
|
+
)
|
|
1370
|
+
},
|
|
1371
|
+
l.id
|
|
1372
|
+
)) }) });
|
|
1373
|
+
}
|
|
1374
|
+
const F = Vt(Je);
|
|
1375
|
+
F.config = (t = {}) => {
|
|
1376
|
+
var n;
|
|
1377
|
+
V(t.maxCount) && (Kt = t.maxCount), t.prefixCls && (Qt = t.prefixCls), V(t.duration) && (Xt = t.duration), typeof t.rtl == "boolean" && (Yt = t.rtl), typeof t.closable == "boolean" && (Zt = t.closable), ((n = t.getContainer) == null ? void 0 : n.call(t)) !== mt && (mt = t.getContainer(), Object.values(W).forEach((e) => e == null ? void 0 : e.clear()), W = {});
|
|
1378
|
+
};
|
|
1379
|
+
F.clear = () => {
|
|
1380
|
+
Object.values(W).forEach((t) => {
|
|
1381
|
+
t == null || t.clear();
|
|
1382
|
+
});
|
|
1383
|
+
};
|
|
1384
|
+
F.addInstance = (t) => {
|
|
1385
|
+
const n = {
|
|
1386
|
+
position: "top",
|
|
1387
|
+
duration: Xt,
|
|
1388
|
+
...t
|
|
1389
|
+
}, { position: e, transitionClassNames: r, transitionTimeout: o } = n;
|
|
1390
|
+
let i;
|
|
1391
|
+
const a = W[e];
|
|
1392
|
+
if (a) {
|
|
1393
|
+
const c = a.notices.find(
|
|
1394
|
+
(d) => d.id === t.id
|
|
1395
|
+
), h = {
|
|
1396
|
+
...n,
|
|
1397
|
+
update: c
|
|
1398
|
+
};
|
|
1399
|
+
a.notices.length >= Kt ? c ? a.add({
|
|
1400
|
+
...h,
|
|
1401
|
+
id: c.id
|
|
1402
|
+
}) : (a.shift(), a.add(h)) : i = a.add(h);
|
|
1403
|
+
} else {
|
|
1404
|
+
const c = document.createElement("div");
|
|
1405
|
+
(mt || document.body).appendChild(c), jt(c).render(
|
|
1406
|
+
/* @__PURE__ */ f(
|
|
1407
|
+
F,
|
|
1408
|
+
{
|
|
1409
|
+
transitionClassNames: r,
|
|
1410
|
+
transitionTimeout: o,
|
|
1411
|
+
...n,
|
|
1412
|
+
callback: (d) => {
|
|
1413
|
+
W[e] = d;
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
)
|
|
1417
|
+
);
|
|
1418
|
+
}
|
|
1419
|
+
return () => {
|
|
1420
|
+
var c;
|
|
1421
|
+
(c = W[e]) == null || c.remove(i);
|
|
1422
|
+
};
|
|
1423
|
+
};
|
|
1424
|
+
Jt.forEach((t) => {
|
|
1425
|
+
F[t] = (n) => {
|
|
1426
|
+
const e = typeof n == "string" ? { content: n } : n;
|
|
1427
|
+
return F.addInstance({
|
|
1428
|
+
...e,
|
|
1429
|
+
type: t
|
|
1430
|
+
});
|
|
1431
|
+
};
|
|
1432
|
+
});
|
|
1433
|
+
F.useMessage = Ge;
|
|
1434
|
+
let _t = {};
|
|
1435
|
+
function Ke(t) {
|
|
1436
|
+
_t = {
|
|
1437
|
+
...t
|
|
1438
|
+
};
|
|
1439
|
+
}
|
|
1440
|
+
function En() {
|
|
1441
|
+
return _t;
|
|
1442
|
+
}
|
|
1443
|
+
let bt = {
|
|
1444
|
+
simple: !0
|
|
1445
|
+
};
|
|
1446
|
+
const In = (t) => {
|
|
1447
|
+
bt = {
|
|
1448
|
+
...bt,
|
|
1449
|
+
...t
|
|
1450
|
+
};
|
|
1451
|
+
}, An = () => bt, Hn = [], Qe = {
|
|
1452
|
+
primaryColor: {
|
|
1453
|
+
default: "--pqbblue-6",
|
|
1454
|
+
hover: "--pqbblue-5",
|
|
1455
|
+
active: "--pqbblue-7"
|
|
1456
|
+
},
|
|
1457
|
+
successColor: {
|
|
1458
|
+
default: "--green-6",
|
|
1459
|
+
hover: "--green-5",
|
|
1460
|
+
active: "--green-7"
|
|
1461
|
+
},
|
|
1462
|
+
infoColor: {
|
|
1463
|
+
default: "--pqbblue-6",
|
|
1464
|
+
hover: "--pqbblue-5",
|
|
1465
|
+
active: "--pqbblue-7"
|
|
1466
|
+
},
|
|
1467
|
+
warningColor: {
|
|
1468
|
+
default: "--orangered-6",
|
|
1469
|
+
hover: "--orangered-5",
|
|
1470
|
+
active: "--orangered-7"
|
|
1471
|
+
},
|
|
1472
|
+
dangerColor: {
|
|
1473
|
+
default: "--red-6",
|
|
1474
|
+
hover: "--red-5",
|
|
1475
|
+
active: "--red-7"
|
|
1476
|
+
}
|
|
1477
|
+
}, Xe = Lt, Ye = {};
|
|
1478
|
+
function Ct(t) {
|
|
1479
|
+
const n = xt(
|
|
1480
|
+
t,
|
|
1481
|
+
Xe,
|
|
1482
|
+
Ye
|
|
1483
|
+
), {
|
|
1484
|
+
theme: e,
|
|
1485
|
+
themeMode: r,
|
|
1486
|
+
prefixCls: o,
|
|
1487
|
+
children: i,
|
|
1488
|
+
locale: a,
|
|
1489
|
+
rtl: s,
|
|
1490
|
+
effectGlobalNotice: c = !0,
|
|
1491
|
+
effectGlobalModal: h = !0
|
|
1492
|
+
} = n, d = window.document.body;
|
|
1493
|
+
E(() => {
|
|
1494
|
+
e && ce(e) && Object.entries(Qe).forEach(([b, l], m, p) => {
|
|
1495
|
+
const v = e[b];
|
|
1496
|
+
if (!v) return;
|
|
1497
|
+
const y = new C(v);
|
|
1498
|
+
d.style.setProperty(l.default, y.lighten(0).toRgbArrayString()), e[`${b}Hover`] || d.style.setProperty(l.hover, y.lighten(10).toRgbArrayString()), e[`${b}Active`] || d.style.setProperty(l.active, y.lighten(-10).toRgbArrayString());
|
|
1499
|
+
});
|
|
1500
|
+
}, [e]), E(() => {
|
|
1501
|
+
const b = ["pqb-theme"];
|
|
1502
|
+
return r ? b.forEach((l) => {
|
|
1503
|
+
d.setAttribute(l, r);
|
|
1504
|
+
}) : b.forEach((l) => {
|
|
1505
|
+
d.removeAttribute(l);
|
|
1506
|
+
}), () => {
|
|
1507
|
+
};
|
|
1508
|
+
}, [r]), E(() => {
|
|
1509
|
+
c && (F.config({ prefixCls: o, rtl: s }), A.config({ prefixCls: o, rtl: s }));
|
|
1510
|
+
}, [o, s, c]);
|
|
1511
|
+
function u(b, l) {
|
|
1512
|
+
return `${l || o}-${b}`;
|
|
1513
|
+
}
|
|
1514
|
+
const g = {
|
|
1515
|
+
...pe(n, ["children"]),
|
|
1516
|
+
getPrefixCls: u
|
|
1517
|
+
};
|
|
1518
|
+
E(() => {
|
|
1519
|
+
h && Ke({ locale: a, prefixCls: o, rtl: s });
|
|
1520
|
+
}, [a, o, s, h]);
|
|
1521
|
+
let x = i;
|
|
1522
|
+
return o && o !== "pqb" && (x = /* @__PURE__ */ f(ut.Provider, { value: { prefixCls: o }, children: i })), /* @__PURE__ */ f(U.Provider, { value: g, children: x });
|
|
1523
|
+
}
|
|
1524
|
+
Ct.ConfigContext = U;
|
|
1525
|
+
Ct.displayName = "ConfigProvider";
|
|
1526
|
+
const Pn = U.Consumer;
|
|
1527
|
+
function te(t, n) {
|
|
1528
|
+
const e = G(U), [r, o] = Ft([]);
|
|
1529
|
+
function i(c) {
|
|
1530
|
+
o((h) => [...h, c]);
|
|
1531
|
+
}
|
|
1532
|
+
function a(c) {
|
|
1533
|
+
o(
|
|
1534
|
+
(h) => h.filter((d) => c !== d)
|
|
1535
|
+
);
|
|
1536
|
+
}
|
|
1537
|
+
function s() {
|
|
1538
|
+
return e;
|
|
1539
|
+
}
|
|
1540
|
+
return rt(n, () => ({
|
|
1541
|
+
addInstance: i,
|
|
1542
|
+
removeInstance: a,
|
|
1543
|
+
getContextConfig: s
|
|
1544
|
+
})), et.Children.map(
|
|
1545
|
+
r,
|
|
1546
|
+
(c, h) => et.cloneElement(c, { key: h })
|
|
1547
|
+
);
|
|
1548
|
+
}
|
|
1549
|
+
te.displayName = "ContextHolderElement";
|
|
1550
|
+
const ee = nt(te);
|
|
1551
|
+
export {
|
|
1552
|
+
Rt as $,
|
|
1553
|
+
Pn as C,
|
|
1554
|
+
Fe as E,
|
|
1555
|
+
At as F,
|
|
1556
|
+
Ne as G,
|
|
1557
|
+
Et as H,
|
|
1558
|
+
Ht as I,
|
|
1559
|
+
Rn as J,
|
|
1560
|
+
F as M,
|
|
1561
|
+
Dt as N,
|
|
1562
|
+
we as O,
|
|
1563
|
+
ke as T,
|
|
1564
|
+
Re as U,
|
|
1565
|
+
Me as W,
|
|
1566
|
+
U as a,
|
|
1567
|
+
Ct as b,
|
|
1568
|
+
N as c,
|
|
1569
|
+
A as d,
|
|
1570
|
+
De as e,
|
|
1571
|
+
C as f,
|
|
1572
|
+
ee as g,
|
|
1573
|
+
Qe as h,
|
|
1574
|
+
Hn as i,
|
|
1575
|
+
En as j,
|
|
1576
|
+
An as k,
|
|
1577
|
+
ze as l,
|
|
1578
|
+
Wt as m,
|
|
1579
|
+
pt as n,
|
|
1580
|
+
yt as o,
|
|
1581
|
+
Jt as p,
|
|
1582
|
+
In as s,
|
|
1583
|
+
Ge as u,
|
|
1584
|
+
lt as y
|
|
1585
|
+
};
|