react-kui 3.2.0 → 3.3.0
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/ai/kui-components.json +825 -168
- package/es/_virtual/_rolldown/runtime.js +2 -3
- package/es/affix/index.js +73 -185
- package/es/alert/index.js +3 -4
- package/es/anchor/anchor-context.js +2 -3
- package/es/anchor/anchor-link.js +3 -4
- package/es/anchor/anchor.js +195 -398
- package/es/auto-complete/index.js +160 -561
- package/es/avatar/avatar-group-context.js +2 -3
- package/es/avatar/avatar-group.js +32 -124
- package/es/avatar/avatar.js +58 -159
- package/es/back-top/index.js +66 -201
- package/es/badge/index.js +4 -5
- package/es/base/teleport.js +22 -54
- package/es/base/transition-props.js +2 -3
- package/es/base/transition.js +2 -3
- package/es/breadcrumb/breadcrumb-context.js +2 -3
- package/es/breadcrumb/breadcrumb-item.js +19 -102
- package/es/breadcrumb/breadcrumb.js +10 -59
- package/es/button/button-group-context.js +2 -3
- package/es/button/button-group.js +15 -75
- package/es/button/button.js +4 -5
- package/es/calendar/index.js +4 -5
- package/es/card/index.js +4 -5
- package/es/carousel/carousel-context.js +2 -3
- package/es/carousel/carousel-item.js +3 -4
- package/es/carousel/carousel.js +281 -628
- package/es/carousel/drag.js +2 -3
- package/es/cascader/index.js +7 -8
- package/es/check-card/check-card-group.js +53 -179
- package/es/check-card/check-card.js +100 -293
- package/es/check-card/context.js +2 -3
- package/es/checkbox/checkbox-group-context.js +2 -3
- package/es/checkbox/checkbox-group.js +34 -138
- package/es/checkbox/checkbox.js +4 -5
- package/es/checkbox/index.js +2 -3
- package/es/collapse/collapse-panel.js +84 -206
- package/es/collapse/collapse.js +38 -170
- package/es/color-picker/alpha.js +44 -125
- package/es/color-picker/hue.js +39 -108
- package/es/color-picker/index.js +7 -6
- package/es/color-picker/mode.js +76 -159
- package/es/color-picker/paint.js +66 -163
- package/es/color-picker/presets.js +12 -44
- package/es/components.js +37 -32
- package/es/config/config-context.js +2 -3
- package/es/config/context.js +2 -3
- package/es/config/index.js +3 -4
- package/es/config/popup-host.js +3 -4
- package/es/config/size-context.js +2 -3
- package/es/config/use-config-appearance.js +3 -4
- package/es/const/var.js +2 -3
- package/es/date-picker/index.js +8 -9
- package/es/descriptions/descriptions-item.js +3 -4
- package/es/descriptions/descriptions.js +53 -144
- package/es/divider/index.js +2 -3
- package/es/drawer/index.js +171 -465
- package/es/dropdown/dropdown-button.js +25 -128
- package/es/dropdown/dropdown-context.js +2 -3
- package/es/dropdown/dropdown.js +56 -207
- package/es/dropdown/trigger.js +37 -125
- package/es/empty/index.js +34 -111
- package/es/feature-card/index.js +2 -3
- package/es/feedback-panel/index.js +30 -155
- package/es/flame-wrap/index.js +3 -4
- package/es/flame-wrap/types.js +2 -3
- package/es/flex/index.js +2 -3
- package/es/form/field-context.js +3 -4
- package/es/form/form-context.js +2 -3
- package/es/form/form-item.js +4 -5
- package/es/form/form.js +108 -279
- package/es/form/utils.js +2 -3
- package/es/gradient-picker/corners.js +55 -0
- package/es/gradient-picker/index.js +191 -0
- package/es/gradient-picker/stops.js +219 -0
- package/es/gradient-picker/types.js +147 -0
- package/es/grid/grid-item.js +25 -116
- package/es/grid/grid.js +40 -151
- package/es/grid/useBreakpoint.js +3 -4
- package/es/icon/index.js +24 -126
- package/es/image/group.js +3 -4
- package/es/image/image-group-context.js +2 -3
- package/es/image/image.js +5 -6
- package/es/image/instance.js +2 -3
- package/es/image/preview.js +4 -5
- package/es/image/utils.js +2 -3
- package/es/index.js +5 -4
- package/es/input/index.js +2 -3
- package/es/input/input-base.js +4 -5
- package/es/input/input-box.js +2 -3
- package/es/input/input-group.js +4 -5
- package/es/input/input.js +3 -4
- package/es/input/textarea.js +3 -4
- package/es/input-number/drag.js +63 -0
- package/es/input-number/index.js +41 -11
- package/es/input-otp/index.js +3 -4
- package/es/input-tag/index.js +5 -6
- package/es/kanban/index.js +31 -168
- package/es/layout/index.js +43 -215
- package/es/layout/layout-context.js +2 -3
- package/es/list-panel/index.js +47 -185
- package/es/loading/index.js +2 -3
- package/es/loading/loading-bar.js +54 -114
- package/es/locale/de.js +2 -3
- package/es/locale/el.js +2 -3
- package/es/locale/en.js +2 -3
- package/es/locale/fr.js +2 -3
- package/es/locale/it.js +2 -3
- package/es/locale/ja.js +2 -3
- package/es/locale/ko.js +2 -3
- package/es/locale/ru.js +2 -3
- package/es/locale/th.js +2 -3
- package/es/locale/uk.js +2 -3
- package/es/locale/vi.js +2 -3
- package/es/locale/zh-CN.js +2 -3
- package/es/locale/zh-TW.js +2 -3
- package/es/mentions/index.js +214 -581
- package/es/menu/menu-context.js +2 -3
- package/es/menu/menu-divider.js +3 -4
- package/es/menu/menu-group.js +3 -4
- package/es/menu/menu-item.js +2 -3
- package/es/menu/menu-keyboard.js +2 -3
- package/es/menu/menu.js +184 -442
- package/es/menu/recursive-menu.js +3 -4
- package/es/menu/sub-menu.js +5 -6
- package/es/message/index.js +2 -3
- package/es/modal/api.js +2 -3
- package/es/modal/modal.js +263 -599
- package/es/modal/toast.js +63 -179
- package/es/node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js +2 -3
- package/es/notice/container.js +2 -3
- package/es/notice/content.js +4 -5
- package/es/notice/index.js +2 -3
- package/es/notice/instance.js +2 -3
- package/es/page/index.js +4 -5
- package/es/page/responsive.js +2 -3
- package/es/page-header/index.js +3 -4
- package/es/popconfirm/index.js +24 -70
- package/es/poptip/index.js +29 -88
- package/es/popup/index.js +8 -6
- package/es/popup/layers.js +2 -3
- package/es/progress/index.js +95 -229
- package/es/qrcode/index.js +3 -4
- package/es/radio/radio-button.js +37 -131
- package/es/radio/radio-group-context.js +2 -3
- package/es/radio/radio-group.js +69 -223
- package/es/radio/radio.js +3 -4
- package/es/rate/index.js +68 -226
- package/es/rate/star.js +38 -129
- package/es/result/index.js +35 -127
- package/es/ripple/index.js +3 -4
- package/es/ripple/types.js +2 -3
- package/es/row-col/col.js +59 -149
- package/es/row-col/row.js +2 -3
- package/es/segmented/index.js +72 -196
- package/es/select/option.js +23 -116
- package/es/select/select.js +9 -10
- package/es/skeleton/skeleton-avatar.js +2 -3
- package/es/skeleton/skeleton-button.js +2 -3
- package/es/skeleton/skeleton-image.js +28 -108
- package/es/skeleton/skeleton-text.js +17 -93
- package/es/skeleton/skeleton.js +46 -133
- package/es/skeleton/use-skeleton-loading.js +3 -4
- package/es/slider/index.js +92 -286
- package/es/slider/thumb.js +43 -133
- package/es/space/index.js +3 -4
- package/es/spin/index.js +2 -3
- package/es/splitter/splitter-panel.js +3 -4
- package/es/splitter/splitter.js +77 -219
- package/es/stat-card/countup.js +46 -141
- package/es/stat-card/rollup.js +27 -105
- package/es/stat-card/stat-card.js +3 -4
- package/es/stat-card/stat-number.js +26 -113
- package/es/stat-card/utils/countup.js +2 -3
- package/es/stat-card/utils/odometer.js +2 -3
- package/es/stat-card/utils/stat-item-key.js +2 -3
- package/es/steps/index.js +45 -123
- package/es/switch/index.js +4 -5
- package/es/table/column-setting.js +43 -139
- package/es/table/index.js +25 -15
- package/es/table/utils.js +3 -5
- package/es/tabs/tab-panel.js +19 -71
- package/es/tabs/tabs.js +6 -7
- package/es/tag/index.js +4 -5
- package/es/time-line/timeline-item.js +3 -4
- package/es/time-line/timeline.js +8 -44
- package/es/tooltip/index.js +41 -142
- package/es/tour/index.js +138 -356
- package/es/transfer/index.js +184 -487
- package/es/tree/index.js +8 -9
- package/es/tree/utils.js +2 -3
- package/es/tree-select/index.js +8 -9
- package/es/typography/index.js +75 -306
- package/es/upload/file-list.js +95 -119
- package/es/upload/index.js +8 -9
- package/es/upload/picture-sort.js +2 -3
- package/es/upload/selector.js +63 -193
- package/es/utils/checked.js +2 -3
- package/es/utils/color.js +2 -3
- package/es/utils/css.js +2 -3
- package/es/utils/focus.js +2 -3
- package/es/utils/number.js +2 -3
- package/es/utils/overlay-order.js +2 -3
- package/es/utils/overlay-stack.js +3 -4
- package/es/utils/placement.js +16 -4
- package/es/utils/popup-arrow.js +45 -0
- package/es/utils/popup.js +2 -3
- package/es/utils/promise.js +2 -3
- package/es/utils/react-node.js +2 -3
- package/es/utils/selection-tags.js +2 -3
- package/es/utils/share.js +2 -3
- package/es/utils/theme.js +2 -3
- package/es/utils/transition.js +2 -3
- package/es/utils/use-value.js +3 -4
- package/es/virtual-list/index.js +49 -187
- package/es/virtual-list/range.js +2 -3
- package/es/watermark/index.js +149 -289
- package/lib/index.cjs +2 -2
- package/lib/locale/de.cjs +1 -1
- package/lib/locale/el.cjs +1 -1
- package/lib/locale/en.cjs +1 -1
- package/lib/locale/fr.cjs +1 -1
- package/lib/locale/it.cjs +1 -1
- package/lib/locale/ja.cjs +1 -1
- package/lib/locale/ko.cjs +1 -1
- package/lib/locale/ru.cjs +1 -1
- package/lib/locale/th.cjs +1 -1
- package/lib/locale/uk.cjs +1 -1
- package/lib/locale/vi.cjs +1 -1
- package/lib/locale/zh-CN.cjs +1 -1
- package/lib/locale/zh-TW.cjs +1 -1
- package/package.json +24 -24
- package/style/base.css +1 -1
- package/style/components.css +2 -2
- package/style/index.css +2 -2
- package/style/theme.css +1 -1
- package/types/affix/index.d.cts +1 -1
- package/types/affix/index.d.ts +1 -1
- package/types/anchor/anchor-link.d.cts +1 -1
- package/types/anchor/anchor-link.d.ts +1 -1
- package/types/anchor/anchor.d.cts +1 -1
- package/types/anchor/anchor.d.ts +1 -1
- package/types/back-top/index.d.cts +1 -1
- package/types/back-top/index.d.ts +1 -1
- package/types/carousel/carousel-item.d.cts +1 -1
- package/types/carousel/carousel-item.d.ts +1 -1
- package/types/cascader/index.d.cts +1 -1
- package/types/cascader/index.d.ts +1 -1
- package/types/color-picker/alpha.d.cts +1 -1
- package/types/color-picker/alpha.d.ts +1 -1
- package/types/color-picker/hue.d.cts +1 -1
- package/types/color-picker/hue.d.ts +1 -1
- package/types/color-picker/index.d.cts +3 -2
- package/types/color-picker/index.d.ts +3 -2
- package/types/color-picker/mode.d.cts +1 -1
- package/types/color-picker/mode.d.ts +1 -1
- package/types/color-picker/paint.d.cts +1 -1
- package/types/color-picker/paint.d.ts +1 -1
- package/types/color-picker/presets.d.cts +1 -1
- package/types/color-picker/presets.d.ts +1 -1
- package/types/components.d.cts +3 -0
- package/types/components.d.ts +3 -0
- package/types/date-picker/index.d.cts +2 -2
- package/types/date-picker/index.d.ts +2 -2
- package/types/feature-card/index.d.cts +1 -1
- package/types/feature-card/index.d.ts +1 -1
- package/types/feedback-panel/index.d.cts +1 -1
- package/types/feedback-panel/index.d.ts +1 -1
- package/types/flame-wrap/index.d.cts +1 -1
- package/types/flame-wrap/index.d.ts +1 -1
- package/types/form/form-item.d.cts +1 -1
- package/types/form/form-item.d.ts +1 -1
- package/types/gradient-picker/corners.d.cts +8 -0
- package/types/gradient-picker/corners.d.ts +8 -0
- package/types/gradient-picker/index.d.cts +25 -0
- package/types/gradient-picker/index.d.ts +25 -0
- package/types/gradient-picker/stops.d.cts +12 -0
- package/types/gradient-picker/stops.d.ts +12 -0
- package/types/gradient-picker/types.d.cts +34 -0
- package/types/gradient-picker/types.d.ts +34 -0
- package/types/grid/grid-item.d.cts +1 -1
- package/types/grid/grid-item.d.ts +1 -1
- package/types/grid/grid.d.cts +1 -1
- package/types/grid/grid.d.ts +1 -1
- package/types/image/group.d.cts +1 -1
- package/types/image/group.d.ts +1 -1
- package/types/input-number/drag.d.cts +9 -0
- package/types/input-number/drag.d.ts +9 -0
- package/types/input-number/index.d.cts +1 -0
- package/types/input-number/index.d.ts +1 -0
- package/types/kanban/index.d.cts +1 -1
- package/types/kanban/index.d.ts +1 -1
- package/types/list-panel/index.d.cts +1 -1
- package/types/list-panel/index.d.ts +1 -1
- package/types/loading/loading-bar.d.cts +1 -1
- package/types/loading/loading-bar.d.ts +1 -1
- package/types/modal/toast.d.cts +1 -1
- package/types/modal/toast.d.ts +1 -1
- package/types/notice/content.d.cts +2 -2
- package/types/notice/content.d.ts +2 -2
- package/types/page-header/index.d.cts +1 -1
- package/types/page-header/index.d.ts +1 -1
- package/types/popconfirm/index.d.cts +1 -0
- package/types/popconfirm/index.d.ts +1 -0
- package/types/poptip/index.d.cts +1 -0
- package/types/poptip/index.d.ts +1 -0
- package/types/popup/index.d.cts +1 -0
- package/types/popup/index.d.ts +1 -0
- package/types/result/index.d.cts +1 -1
- package/types/result/index.d.ts +1 -1
- package/types/ripple/index.d.cts +1 -1
- package/types/ripple/index.d.ts +1 -1
- package/types/segmented/index.d.cts +2 -1
- package/types/segmented/index.d.ts +2 -1
- package/types/slider/index.d.cts +1 -1
- package/types/slider/index.d.ts +1 -1
- package/types/splitter/splitter-panel.d.cts +1 -1
- package/types/splitter/splitter-panel.d.ts +1 -1
- package/types/splitter/splitter.d.cts +1 -1
- package/types/splitter/splitter.d.ts +1 -1
- package/types/stat-card/countup.d.cts +1 -1
- package/types/stat-card/countup.d.ts +1 -1
- package/types/stat-card/rollup.d.cts +1 -1
- package/types/stat-card/rollup.d.ts +1 -1
- package/types/stat-card/stat-card.d.cts +1 -1
- package/types/stat-card/stat-card.d.ts +1 -1
- package/types/stat-card/stat-number.d.cts +1 -1
- package/types/stat-card/stat-number.d.ts +1 -1
- package/types/table/column-setting.d.cts +1 -1
- package/types/table/column-setting.d.ts +1 -1
- package/types/table/index.d.cts +1 -1
- package/types/table/index.d.ts +1 -1
- package/types/time-line/timeline-item.d.cts +1 -1
- package/types/time-line/timeline-item.d.ts +1 -1
- package/types/time-line/timeline.d.cts +1 -1
- package/types/time-line/timeline.d.ts +1 -1
- package/types/tooltip/index.d.cts +1 -0
- package/types/tooltip/index.d.ts +1 -0
- package/types/transfer/index.d.cts +1 -1
- package/types/transfer/index.d.ts +1 -1
- package/types/tree-select/index.d.cts +1 -1
- package/types/tree-select/index.d.ts +1 -1
- package/types/upload/file-list.d.cts +1 -1
- package/types/upload/file-list.d.ts +1 -1
- package/types/upload/selector.d.cts +1 -1
- package/types/upload/selector.d.ts +1 -1
- package/types/utils/placement.d.cts +2 -1
- package/types/utils/placement.d.ts +2 -1
- package/types/utils/popup-arrow.d.cts +5 -0
- package/types/utils/popup-arrow.d.ts +5 -0
- package/types/utils/selection-tags.d.cts +1 -1
- package/types/utils/selection-tags.d.ts +1 -1
- package/types/watermark/index.d.cts +1 -1
- package/types/watermark/index.d.ts +1 -1
package/es/modal/modal.js
CHANGED
|
@@ -1,47 +1,32 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.
|
|
2
|
+
* react-kui v3.3.0
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
6
6
|
* Author: Qiu / https://chuchur.com
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { useValue } from "../utils/use-value.js";
|
|
10
|
+
import { X } from "../node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js";
|
|
10
11
|
import Teleport from "../base/teleport.js";
|
|
11
12
|
import { Transition } from "../base/transition.js";
|
|
12
|
-
import { PopupHostContext, usePopupHostScope } from "../config/popup-host.js";
|
|
13
|
-
import { toggleContainerScroll } from "../utils/react-node.js";
|
|
14
|
-
import { X } from "../node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js";
|
|
15
|
-
import { useValue } from "../utils/use-value.js";
|
|
16
13
|
import Button from "../button/button.js";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
14
|
+
import { ConfigContext, DEFAULT_LOCALE } from "../config/config-context.js";
|
|
15
|
+
import { PopupHostContext, usePopupHostScope } from "../config/popup-host.js";
|
|
19
16
|
import { getMousePoint } from "../config/context.js";
|
|
17
|
+
import { toCssLength } from "../utils/css.js";
|
|
20
18
|
import { createFocusTrap } from "../utils/focus.js";
|
|
21
|
-
import {
|
|
19
|
+
import { pushOverlay } from "../utils/overlay-stack.js";
|
|
20
|
+
import { toggleContainerScroll } from "../utils/react-node.js";
|
|
22
21
|
import clsx from "clsx";
|
|
23
|
-
import { useContext, useEffect, useRef, useState } from "react";
|
|
22
|
+
import { useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
24
23
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const { className, open, title, okText, cancelText, width: t1, top: t2, mask: t3, maskClosable: t4, maximized: t5, centered: t6, draggable: t7, showClose: t8, loading: t9, footer: t10, escKey: t11, panelOnly: t12, destroyOnClose: t13, onClose, onOk, onCancel, onOpenChange, onAfterClose, content, children } = t0;
|
|
29
|
-
const width = t1 === void 0 ? 520 : t1;
|
|
30
|
-
const top = t2 === void 0 ? 100 : t2;
|
|
31
|
-
const mask = t3 === void 0 ? true : t3;
|
|
32
|
-
const maskClosable = t4 === void 0 ? false : t4;
|
|
33
|
-
const maximized = t5 === void 0 ? false : t5;
|
|
34
|
-
const centered = t6 === void 0 ? false : t6;
|
|
35
|
-
const draggable = t7 === void 0 ? false : t7;
|
|
36
|
-
const showClose = t8 === void 0 ? true : t8;
|
|
37
|
-
const loading = t9 === void 0 ? false : t9;
|
|
38
|
-
const footer = t10 === void 0 ? true : t10;
|
|
39
|
-
const escKey = t11 === void 0 ? true : t11;
|
|
40
|
-
const panelOnly = t12 === void 0 ? false : t12;
|
|
41
|
-
const destroyOnClose = t13 === void 0 ? true : t13;
|
|
24
|
+
import { c } from "react/compiler-runtime";
|
|
25
|
+
// components/modal/modal.tsx
|
|
26
|
+
var Modal = ({ className, open, title, okText, cancelText, width = 520, top = 100, mask = true, maskClosable = false, maximized = false, centered = false, draggable = false, showClose = true, loading = false, footer = true, escKey = true, panelOnly = false, destroyOnClose = true, onClose, onOk, onCancel, onOpenChange, onAfterClose, content, children }) => {
|
|
42
27
|
const locale = useContext(ConfigContext)?.locale || DEFAULT_LOCALE;
|
|
43
28
|
const { register: registerHostedPopup, closeAll: closeHostedPopups } = usePopupHostScope();
|
|
44
|
-
const [innerOpen, setInnerOpen] = useValue(open,
|
|
29
|
+
const [innerOpen, setInnerOpen] = useValue(open, (next) => next ?? false);
|
|
45
30
|
const currentOpen = innerOpen;
|
|
46
31
|
const [visible, setVisible] = useState(panelOnly);
|
|
47
32
|
const [showInner, setShowInner] = useState(panelOnly);
|
|
@@ -50,152 +35,102 @@ var Modal = (t0) => {
|
|
|
50
35
|
const [topPos, setTopPos] = useState(top);
|
|
51
36
|
const [isMousePressed, setIsMousePressed] = useState(false);
|
|
52
37
|
const [mousedownIn, setMousedownIn] = useState(false);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
y: 0
|
|
58
|
-
};
|
|
59
|
-
$[0] = t14;
|
|
60
|
-
} else t14 = $[0];
|
|
61
|
-
const startPos = useRef(t14);
|
|
38
|
+
const startPos = useRef({
|
|
39
|
+
x: 0,
|
|
40
|
+
y: 0
|
|
41
|
+
});
|
|
62
42
|
const refModal = useRef(null);
|
|
63
43
|
const refWrap = useRef(null);
|
|
64
44
|
const refHeader = useRef(null);
|
|
65
45
|
const hideTimerRef = useRef(null);
|
|
66
46
|
const focusTrapRef = useRef(null);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
focusTrapRef.current?.handleKeydown(event.nativeEvent);
|
|
71
|
-
};
|
|
72
|
-
$[1] = t15;
|
|
73
|
-
} else t15 = $[1];
|
|
74
|
-
const handleModalKeydown = t15;
|
|
47
|
+
const handleModalKeydown = useCallback((event) => {
|
|
48
|
+
focusTrapRef.current?.handleKeydown(event.nativeEvent);
|
|
49
|
+
}, []);
|
|
75
50
|
const scrollLockedRef = useRef(false);
|
|
76
51
|
const overlayRef = useRef(null);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
52
|
+
const updateScrollLock = useCallback((lock) => {
|
|
53
|
+
if (panelOnly || scrollLockedRef.current === lock) return;
|
|
54
|
+
toggleContainerScroll(typeof document === "undefined" ? null : document.body, lock);
|
|
55
|
+
scrollLockedRef.current = lock;
|
|
56
|
+
}, [panelOnly]);
|
|
57
|
+
const getOffset = (el) => ({
|
|
58
|
+
left: el.offsetLeft,
|
|
59
|
+
top: el.offsetTop
|
|
60
|
+
});
|
|
61
|
+
const cancelHide = useCallback(() => {
|
|
62
|
+
if (hideTimerRef.current === null) return;
|
|
63
|
+
clearTimeout(hideTimerRef.current);
|
|
64
|
+
hideTimerRef.current = null;
|
|
65
|
+
}, []);
|
|
66
|
+
const updateOrigin = useCallback(() => {
|
|
67
|
+
if (refModal.current) {
|
|
68
|
+
const { x, y } = getMousePoint();
|
|
69
|
+
const p = getOffset(refModal.current);
|
|
70
|
+
refModal.current.style.transformOrigin = `${x - p.left}px ${y - p.top}px`;
|
|
71
|
+
}
|
|
72
|
+
}, []);
|
|
73
|
+
const toggle = useCallback((value) => {
|
|
74
|
+
if (value) cancelHide();
|
|
75
|
+
if (!rendered && value) {
|
|
76
|
+
setRendered(true);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (value) {
|
|
80
|
+
updateScrollLock(true);
|
|
81
|
+
setLeftPos(0);
|
|
82
|
+
setTopPos(top);
|
|
83
|
+
setVisible(true);
|
|
84
|
+
setShowInner(true);
|
|
85
|
+
setTimeout(() => {
|
|
86
|
+
if (draggable && refModal.current) setLeftPos((document.body.offsetWidth - refModal.current.offsetWidth) / 2);
|
|
87
|
+
updateOrigin();
|
|
88
|
+
}, 100);
|
|
89
|
+
} else {
|
|
90
|
+
closeHostedPopups();
|
|
91
|
+
focusTrapRef.current?.deactivate();
|
|
92
|
+
updateScrollLock(false);
|
|
93
|
+
setVisible(false);
|
|
94
|
+
cancelHide();
|
|
95
|
+
hideTimerRef.current = setTimeout(() => {
|
|
96
|
+
hideTimerRef.current = null;
|
|
97
|
+
setShowInner(false);
|
|
98
|
+
if (destroyOnClose && !panelOnly) setRendered(false);
|
|
99
|
+
}, 300);
|
|
100
|
+
}
|
|
101
|
+
}, [
|
|
102
|
+
cancelHide,
|
|
103
|
+
closeHostedPopups,
|
|
104
|
+
draggable,
|
|
105
|
+
updateOrigin,
|
|
106
|
+
rendered,
|
|
107
|
+
top,
|
|
108
|
+
updateScrollLock,
|
|
109
|
+
destroyOnClose,
|
|
110
|
+
panelOnly
|
|
111
|
+
]);
|
|
112
|
+
const requestOpen = useCallback((next_0) => {
|
|
113
|
+
setInnerOpen(next_0);
|
|
114
|
+
onOpenChange?.(next_0);
|
|
115
|
+
}, [onOpenChange, setInnerOpen]);
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (panelOnly) return;
|
|
118
|
+
const timer = setTimeout(() => {
|
|
119
|
+
if (currentOpen && !rendered) {
|
|
116
120
|
setRendered(true);
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
closeHostedPopups();
|
|
131
|
-
focusTrapRef.current?.deactivate();
|
|
132
|
-
updateScrollLock(false);
|
|
133
|
-
setVisible(false);
|
|
134
|
-
cancelHide();
|
|
135
|
-
hideTimerRef.current = setTimeout(() => {
|
|
136
|
-
hideTimerRef.current = null;
|
|
137
|
-
setShowInner(false);
|
|
138
|
-
if (destroyOnClose && !panelOnly) setRendered(false);
|
|
139
|
-
}, 300);
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
$[6] = closeHostedPopups;
|
|
143
|
-
$[7] = destroyOnClose;
|
|
144
|
-
$[8] = draggable;
|
|
145
|
-
$[9] = panelOnly;
|
|
146
|
-
$[10] = rendered;
|
|
147
|
-
$[11] = top;
|
|
148
|
-
$[12] = updateScrollLock;
|
|
149
|
-
$[13] = t19;
|
|
150
|
-
} else t19 = $[13];
|
|
151
|
-
const toggle = t19;
|
|
152
|
-
let t20;
|
|
153
|
-
if ($[14] !== onOpenChange || $[15] !== setInnerOpen) {
|
|
154
|
-
t20 = (next_0) => {
|
|
155
|
-
setInnerOpen(next_0);
|
|
156
|
-
onOpenChange?.(next_0);
|
|
157
|
-
};
|
|
158
|
-
$[14] = onOpenChange;
|
|
159
|
-
$[15] = setInnerOpen;
|
|
160
|
-
$[16] = t20;
|
|
161
|
-
} else t20 = $[16];
|
|
162
|
-
const requestOpen = t20;
|
|
163
|
-
let t21;
|
|
164
|
-
let t22;
|
|
165
|
-
if ($[17] !== currentOpen || $[18] !== panelOnly || $[19] !== rendered || $[20] !== toggle || $[21] !== visible) {
|
|
166
|
-
t21 = () => {
|
|
167
|
-
if (panelOnly) return;
|
|
168
|
-
const timer = setTimeout(() => {
|
|
169
|
-
if (currentOpen && !rendered) {
|
|
170
|
-
setRendered(true);
|
|
171
|
-
toggle(true);
|
|
172
|
-
} else if (currentOpen !== visible) toggle(currentOpen);
|
|
173
|
-
}, 0);
|
|
174
|
-
return () => clearTimeout(timer);
|
|
175
|
-
};
|
|
176
|
-
t22 = [
|
|
177
|
-
currentOpen,
|
|
178
|
-
panelOnly,
|
|
179
|
-
toggle,
|
|
180
|
-
rendered,
|
|
181
|
-
visible
|
|
182
|
-
];
|
|
183
|
-
$[17] = currentOpen;
|
|
184
|
-
$[18] = panelOnly;
|
|
185
|
-
$[19] = rendered;
|
|
186
|
-
$[20] = toggle;
|
|
187
|
-
$[21] = visible;
|
|
188
|
-
$[22] = t21;
|
|
189
|
-
$[23] = t22;
|
|
190
|
-
} else {
|
|
191
|
-
t21 = $[22];
|
|
192
|
-
t22 = $[23];
|
|
193
|
-
}
|
|
194
|
-
useEffect(t21, t22);
|
|
195
|
-
let t23;
|
|
196
|
-
let t24;
|
|
197
|
-
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
198
|
-
t23 = () => () => {
|
|
121
|
+
toggle(true);
|
|
122
|
+
} else if (currentOpen !== visible) toggle(currentOpen);
|
|
123
|
+
}, 0);
|
|
124
|
+
return () => clearTimeout(timer);
|
|
125
|
+
}, [
|
|
126
|
+
currentOpen,
|
|
127
|
+
panelOnly,
|
|
128
|
+
toggle,
|
|
129
|
+
rendered,
|
|
130
|
+
visible
|
|
131
|
+
]);
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
return () => {
|
|
199
134
|
cancelHide();
|
|
200
135
|
if (scrollLockedRef.current) {
|
|
201
136
|
toggleContainerScroll(document.body, false);
|
|
@@ -203,462 +138,201 @@ var Modal = (t0) => {
|
|
|
203
138
|
}
|
|
204
139
|
focusTrapRef.current?.deactivate();
|
|
205
140
|
};
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
panelOnly,
|
|
224
|
-
rendered,
|
|
225
|
-
visible
|
|
226
|
-
];
|
|
227
|
-
$[26] = panelOnly;
|
|
228
|
-
$[27] = rendered;
|
|
229
|
-
$[28] = visible;
|
|
230
|
-
$[29] = t25;
|
|
231
|
-
$[30] = t26;
|
|
232
|
-
} else {
|
|
233
|
-
t25 = $[29];
|
|
234
|
-
t26 = $[30];
|
|
235
|
-
}
|
|
236
|
-
useEffect(t25, t26);
|
|
237
|
-
let t27;
|
|
238
|
-
let t28;
|
|
239
|
-
if ($[31] !== panelOnly || $[32] !== rendered || $[33] !== visible) {
|
|
240
|
-
t27 = () => {
|
|
241
|
-
if (panelOnly || !rendered || !visible) return;
|
|
242
|
-
const handle = pushOverlay();
|
|
243
|
-
overlayRef.current = handle;
|
|
244
|
-
return () => {
|
|
245
|
-
handle.release();
|
|
246
|
-
if (overlayRef.current === handle) overlayRef.current = null;
|
|
247
|
-
};
|
|
141
|
+
}, [cancelHide]);
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
if (panelOnly || !rendered || !visible) return;
|
|
144
|
+
if (!focusTrapRef.current) focusTrapRef.current = createFocusTrap(() => refModal.current);
|
|
145
|
+
focusTrapRef.current.activate();
|
|
146
|
+
}, [
|
|
147
|
+
panelOnly,
|
|
148
|
+
rendered,
|
|
149
|
+
visible
|
|
150
|
+
]);
|
|
151
|
+
useEffect(() => {
|
|
152
|
+
if (panelOnly || !rendered || !visible) return;
|
|
153
|
+
const handle = pushOverlay();
|
|
154
|
+
overlayRef.current = handle;
|
|
155
|
+
return () => {
|
|
156
|
+
handle.release();
|
|
157
|
+
if (overlayRef.current === handle) overlayRef.current = null;
|
|
248
158
|
};
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
159
|
+
}, [
|
|
160
|
+
panelOnly,
|
|
161
|
+
rendered,
|
|
162
|
+
visible
|
|
163
|
+
]);
|
|
164
|
+
const close = useCallback(() => {
|
|
165
|
+
requestOpen(false);
|
|
166
|
+
onClose?.();
|
|
167
|
+
}, [onClose, requestOpen]);
|
|
168
|
+
const escToClose = useCallback((e) => {
|
|
169
|
+
if (e.key !== "Escape" || e.defaultPrevented) return;
|
|
170
|
+
if (!visible) return;
|
|
171
|
+
if (!overlayRef.current?.isTop()) return;
|
|
172
|
+
close();
|
|
173
|
+
}, [close, visible]);
|
|
174
|
+
useEffect(() => {
|
|
175
|
+
if (panelOnly || !escKey) return;
|
|
176
|
+
document.addEventListener("keydown", escToClose);
|
|
177
|
+
return () => {
|
|
178
|
+
document.removeEventListener("keydown", escToClose);
|
|
269
179
|
};
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
return () => {
|
|
295
|
-
document.removeEventListener("keydown", escToClose);
|
|
180
|
+
}, [
|
|
181
|
+
escKey,
|
|
182
|
+
escToClose,
|
|
183
|
+
panelOnly
|
|
184
|
+
]);
|
|
185
|
+
const ok = () => onOk?.();
|
|
186
|
+
const cancel = () => {
|
|
187
|
+
requestOpen(false);
|
|
188
|
+
onCancel?.();
|
|
189
|
+
};
|
|
190
|
+
const afterClose = () => {
|
|
191
|
+
onAfterClose?.();
|
|
192
|
+
};
|
|
193
|
+
const clickMaskToClose = (e_0) => {
|
|
194
|
+
if (!loading && maskClosable && !refModal.current?.contains(e_0.target) && !mousedownIn) close();
|
|
195
|
+
};
|
|
196
|
+
const mousemove = useCallback((e_1) => {
|
|
197
|
+
if (isMousePressed && draggable) {
|
|
198
|
+
const { x: x_0, y: y_0 } = startPos.current;
|
|
199
|
+
setLeftPos((prev) => prev + e_1.clientX - x_0);
|
|
200
|
+
setTopPos((prev_0) => (prev_0 ?? 100) + e_1.clientY - y_0);
|
|
201
|
+
startPos.current = {
|
|
202
|
+
x: e_1.clientX,
|
|
203
|
+
y: e_1.clientY
|
|
296
204
|
};
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
if ($[47] !== onOk) {
|
|
315
|
-
t33 = () => onOk?.();
|
|
316
|
-
$[47] = onOk;
|
|
317
|
-
$[48] = t33;
|
|
318
|
-
} else t33 = $[48];
|
|
319
|
-
const ok = t33;
|
|
320
|
-
let t34;
|
|
321
|
-
if ($[49] !== onCancel || $[50] !== requestOpen) {
|
|
322
|
-
t34 = () => {
|
|
323
|
-
requestOpen(false);
|
|
324
|
-
onCancel?.();
|
|
325
|
-
};
|
|
326
|
-
$[49] = onCancel;
|
|
327
|
-
$[50] = requestOpen;
|
|
328
|
-
$[51] = t34;
|
|
329
|
-
} else t34 = $[51];
|
|
330
|
-
const cancel = t34;
|
|
331
|
-
let t35;
|
|
332
|
-
if ($[52] !== onAfterClose) {
|
|
333
|
-
t35 = () => {
|
|
334
|
-
onAfterClose?.();
|
|
335
|
-
};
|
|
336
|
-
$[52] = onAfterClose;
|
|
337
|
-
$[53] = t35;
|
|
338
|
-
} else t35 = $[53];
|
|
339
|
-
const afterClose = t35;
|
|
340
|
-
let t36;
|
|
341
|
-
if ($[54] !== close || $[55] !== loading || $[56] !== maskClosable || $[57] !== mousedownIn) {
|
|
342
|
-
t36 = (e_0) => {
|
|
343
|
-
if (!loading && maskClosable && !refModal.current?.contains(e_0.target) && !mousedownIn) close();
|
|
344
|
-
};
|
|
345
|
-
$[54] = close;
|
|
346
|
-
$[55] = loading;
|
|
347
|
-
$[56] = maskClosable;
|
|
348
|
-
$[57] = mousedownIn;
|
|
349
|
-
$[58] = t36;
|
|
350
|
-
} else t36 = $[58];
|
|
351
|
-
const clickMaskToClose = t36;
|
|
352
|
-
let t37;
|
|
353
|
-
if ($[59] !== draggable || $[60] !== isMousePressed) {
|
|
354
|
-
t37 = (e_1) => {
|
|
355
|
-
if (isMousePressed && draggable) {
|
|
356
|
-
const { x: x_0, y: y_0 } = startPos.current;
|
|
357
|
-
setLeftPos((prev) => prev + e_1.clientX - x_0);
|
|
358
|
-
setTopPos((prev_0) => (prev_0 ?? 100) + e_1.clientY - y_0);
|
|
359
|
-
startPos.current = {
|
|
360
|
-
x: e_1.clientX,
|
|
361
|
-
y: e_1.clientY
|
|
362
|
-
};
|
|
363
|
-
updateOrigin();
|
|
364
|
-
e_1.preventDefault();
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
$[59] = draggable;
|
|
368
|
-
$[60] = isMousePressed;
|
|
369
|
-
$[61] = t37;
|
|
370
|
-
} else t37 = $[61];
|
|
371
|
-
const mousemove = t37;
|
|
372
|
-
let t38;
|
|
373
|
-
if ($[62] === Symbol.for("react.memo_cache_sentinel")) {
|
|
374
|
-
t38 = () => {
|
|
375
|
-
setIsMousePressed(false);
|
|
376
|
-
};
|
|
377
|
-
$[62] = t38;
|
|
378
|
-
} else t38 = $[62];
|
|
379
|
-
const mouseup = t38;
|
|
380
|
-
let t39;
|
|
381
|
-
if ($[63] !== draggable || $[64] !== visible) {
|
|
382
|
-
t39 = (e_2) => {
|
|
383
|
-
if (e_2.button === 0 && draggable && refHeader.current && refHeader.current.contains(e_2.target)) {
|
|
384
|
-
setIsMousePressed(true);
|
|
385
|
-
startPos.current = {
|
|
386
|
-
x: e_2.clientX,
|
|
387
|
-
y: e_2.clientY
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
setMousedownIn(visible && !!refModal.current?.contains(e_2.target));
|
|
391
|
-
};
|
|
392
|
-
$[63] = draggable;
|
|
393
|
-
$[64] = visible;
|
|
394
|
-
$[65] = t39;
|
|
395
|
-
} else t39 = $[65];
|
|
396
|
-
const handleMouseDown = t39;
|
|
397
|
-
let t40;
|
|
398
|
-
let t41;
|
|
399
|
-
if ($[66] !== handleMouseDown || $[67] !== mousemove || $[68] !== panelOnly) {
|
|
400
|
-
t40 = () => {
|
|
401
|
-
if (panelOnly) return;
|
|
402
|
-
document.addEventListener("mousedown", handleMouseDown);
|
|
403
|
-
document.addEventListener("mousemove", mousemove);
|
|
404
|
-
document.addEventListener("mouseup", mouseup);
|
|
405
|
-
return () => {
|
|
406
|
-
document.removeEventListener("mousedown", handleMouseDown);
|
|
407
|
-
document.removeEventListener("mousemove", mousemove);
|
|
408
|
-
document.removeEventListener("mouseup", mouseup);
|
|
205
|
+
updateOrigin();
|
|
206
|
+
e_1.preventDefault();
|
|
207
|
+
}
|
|
208
|
+
}, [
|
|
209
|
+
draggable,
|
|
210
|
+
isMousePressed,
|
|
211
|
+
updateOrigin
|
|
212
|
+
]);
|
|
213
|
+
const mouseup = useCallback(() => {
|
|
214
|
+
setIsMousePressed(false);
|
|
215
|
+
}, []);
|
|
216
|
+
const handleMouseDown = useCallback((e_2) => {
|
|
217
|
+
if (e_2.button === 0 && draggable && refHeader.current && refHeader.current.contains(e_2.target)) {
|
|
218
|
+
setIsMousePressed(true);
|
|
219
|
+
startPos.current = {
|
|
220
|
+
x: e_2.clientX,
|
|
221
|
+
y: e_2.clientY
|
|
409
222
|
};
|
|
223
|
+
}
|
|
224
|
+
setMousedownIn(visible && !!refModal.current?.contains(e_2.target));
|
|
225
|
+
}, [draggable, visible]);
|
|
226
|
+
useEffect(() => {
|
|
227
|
+
if (panelOnly) return;
|
|
228
|
+
document.addEventListener("mousedown", handleMouseDown);
|
|
229
|
+
document.addEventListener("mousemove", mousemove);
|
|
230
|
+
document.addEventListener("mouseup", mouseup);
|
|
231
|
+
return () => {
|
|
232
|
+
document.removeEventListener("mousedown", handleMouseDown);
|
|
233
|
+
document.removeEventListener("mousemove", mousemove);
|
|
234
|
+
document.removeEventListener("mouseup", mouseup);
|
|
410
235
|
};
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
$[66] = handleMouseDown;
|
|
418
|
-
$[67] = mousemove;
|
|
419
|
-
$[68] = panelOnly;
|
|
420
|
-
$[69] = t40;
|
|
421
|
-
$[70] = t41;
|
|
422
|
-
} else {
|
|
423
|
-
t40 = $[69];
|
|
424
|
-
t41 = $[70];
|
|
425
|
-
}
|
|
426
|
-
useEffect(t40, t41);
|
|
236
|
+
}, [
|
|
237
|
+
handleMouseDown,
|
|
238
|
+
mousemove,
|
|
239
|
+
mouseup,
|
|
240
|
+
panelOnly
|
|
241
|
+
]);
|
|
427
242
|
const okLabel = okText || locale?.k?.common?.ok;
|
|
428
243
|
const cancelLabel = cancelText || locale?.k?.common?.cancel;
|
|
429
244
|
let contentNode = content;
|
|
430
|
-
if (!contentNode) {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
children: cancelLabel
|
|
436
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
437
|
-
onClick: ok,
|
|
438
|
-
type: "primary",
|
|
439
|
-
loading,
|
|
440
|
-
children: okLabel
|
|
441
|
-
})] }) : footer;
|
|
442
|
-
$[71] = cancel;
|
|
443
|
-
$[72] = cancelLabel;
|
|
444
|
-
$[73] = footer;
|
|
445
|
-
$[74] = loading;
|
|
446
|
-
$[75] = ok;
|
|
447
|
-
$[76] = okLabel;
|
|
448
|
-
$[77] = t42;
|
|
449
|
-
} else t42 = $[77];
|
|
450
|
-
const footerContent = t42;
|
|
451
|
-
let t43;
|
|
452
|
-
if ($[78] !== close || $[79] !== showClose) {
|
|
453
|
-
t43 = showClose && /* @__PURE__ */ jsx(Button, {
|
|
245
|
+
if (!contentNode) contentNode = /* @__PURE__ */ jsxs("div", {
|
|
246
|
+
className: "k-modal-content",
|
|
247
|
+
tabIndex: 0,
|
|
248
|
+
children: [
|
|
249
|
+
showClose && /* @__PURE__ */ jsx(Button, {
|
|
454
250
|
icon: X,
|
|
455
251
|
size: "small",
|
|
456
252
|
onClick: close,
|
|
457
253
|
className: "k-modal-close",
|
|
458
254
|
type: "text"
|
|
459
|
-
})
|
|
460
|
-
|
|
461
|
-
$[79] = showClose;
|
|
462
|
-
$[80] = t43;
|
|
463
|
-
} else t43 = $[80];
|
|
464
|
-
let t44;
|
|
465
|
-
if ($[81] !== title) {
|
|
466
|
-
t44 = title != null && /* @__PURE__ */ jsx("div", {
|
|
255
|
+
}),
|
|
256
|
+
title != null && /* @__PURE__ */ jsx("div", {
|
|
467
257
|
className: "k-modal-header",
|
|
468
258
|
ref: refHeader,
|
|
469
259
|
children: /* @__PURE__ */ jsx("div", {
|
|
470
260
|
className: "k-modal-header-inner",
|
|
471
261
|
children: title
|
|
472
262
|
})
|
|
473
|
-
})
|
|
474
|
-
|
|
475
|
-
$[82] = t44;
|
|
476
|
-
} else t44 = $[82];
|
|
477
|
-
let t45;
|
|
478
|
-
if ($[83] !== children) {
|
|
479
|
-
t45 = /* @__PURE__ */ jsx("div", {
|
|
263
|
+
}),
|
|
264
|
+
/* @__PURE__ */ jsx("div", {
|
|
480
265
|
className: "k-modal-body",
|
|
481
266
|
children
|
|
482
|
-
})
|
|
483
|
-
|
|
484
|
-
$[84] = t45;
|
|
485
|
-
} else t45 = $[84];
|
|
486
|
-
let t46;
|
|
487
|
-
if ($[85] !== footer || $[86] !== footerContent) {
|
|
488
|
-
t46 = footer && /* @__PURE__ */ jsx("div", {
|
|
267
|
+
}),
|
|
268
|
+
footer && /* @__PURE__ */ jsx("div", {
|
|
489
269
|
className: "k-modal-footer",
|
|
490
|
-
children:
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
contentNode = t47;
|
|
515
|
-
}
|
|
516
|
-
let t42;
|
|
517
|
-
if ($[93] !== centered || $[94] !== draggable || $[95] !== leftPos || $[96] !== maximized || $[97] !== topPos || $[98] !== width) {
|
|
518
|
-
t42 = maximized ? null : {
|
|
519
|
-
width: toCssLength(width),
|
|
520
|
-
top: centered ? void 0 : `${topPos}px`,
|
|
521
|
-
left: draggable && !centered ? `${leftPos}px` : void 0
|
|
522
|
-
};
|
|
523
|
-
$[93] = centered;
|
|
524
|
-
$[94] = draggable;
|
|
525
|
-
$[95] = leftPos;
|
|
526
|
-
$[96] = maximized;
|
|
527
|
-
$[97] = topPos;
|
|
528
|
-
$[98] = width;
|
|
529
|
-
$[99] = t42;
|
|
530
|
-
} else t42 = $[99];
|
|
531
|
-
const modalStyle = t42;
|
|
532
|
-
const t43 = Boolean(footer);
|
|
533
|
-
let t44;
|
|
534
|
-
if ($[100] !== centered || $[101] !== className || $[102] !== draggable || $[103] !== maximized || $[104] !== panelOnly || $[105] !== t43) {
|
|
535
|
-
t44 = clsx("k-modal", className, {
|
|
536
|
-
"k-modal-draggable": draggable,
|
|
537
|
-
"k-modal-maximized": maximized,
|
|
538
|
-
"k-modal-centered": centered,
|
|
539
|
-
"k-modal-has-footer": t43,
|
|
540
|
-
"k-modal-panel": panelOnly
|
|
541
|
-
});
|
|
542
|
-
$[100] = centered;
|
|
543
|
-
$[101] = className;
|
|
544
|
-
$[102] = draggable;
|
|
545
|
-
$[103] = maximized;
|
|
546
|
-
$[104] = panelOnly;
|
|
547
|
-
$[105] = t43;
|
|
548
|
-
$[106] = t44;
|
|
549
|
-
} else t44 = $[106];
|
|
550
|
-
const classes = t44;
|
|
270
|
+
children: footer === true ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
|
|
271
|
+
onClick: cancel,
|
|
272
|
+
children: cancelLabel
|
|
273
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
274
|
+
onClick: ok,
|
|
275
|
+
type: "primary",
|
|
276
|
+
loading,
|
|
277
|
+
children: okLabel
|
|
278
|
+
})] }) : footer
|
|
279
|
+
})
|
|
280
|
+
]
|
|
281
|
+
});
|
|
282
|
+
const modalStyle = maximized ? null : {
|
|
283
|
+
width: toCssLength(width),
|
|
284
|
+
top: centered ? void 0 : `${topPos}px`,
|
|
285
|
+
left: draggable && !centered ? `${leftPos}px` : void 0
|
|
286
|
+
};
|
|
287
|
+
const classes = clsx("k-modal", className, {
|
|
288
|
+
"k-modal-draggable": draggable,
|
|
289
|
+
"k-modal-maximized": maximized,
|
|
290
|
+
"k-modal-centered": centered,
|
|
291
|
+
"k-modal-has-footer": Boolean(footer),
|
|
292
|
+
"k-modal-panel": panelOnly
|
|
293
|
+
});
|
|
551
294
|
if (!rendered) return null;
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
295
|
+
const modalEl = /* @__PURE__ */ jsxs("div", {
|
|
296
|
+
className: classes,
|
|
297
|
+
children: [mask && /* @__PURE__ */ jsx(Transition, {
|
|
555
298
|
show: visible,
|
|
556
299
|
name: "k-modal-fade",
|
|
557
300
|
timeout: 400,
|
|
558
301
|
unmountOnExit: destroyOnClose,
|
|
559
302
|
children: /* @__PURE__ */ jsx("div", { className: "k-modal-mask" })
|
|
560
|
-
})
|
|
561
|
-
$[107] = destroyOnClose;
|
|
562
|
-
$[108] = mask;
|
|
563
|
-
$[109] = visible;
|
|
564
|
-
$[110] = t45;
|
|
565
|
-
} else t45 = $[110];
|
|
566
|
-
const t46 = !panelOnly && mask ? true : void 0;
|
|
567
|
-
const t47 = showInner ? void 0 : "none";
|
|
568
|
-
let t48;
|
|
569
|
-
if ($[111] !== t47) {
|
|
570
|
-
t48 = { display: t47 };
|
|
571
|
-
$[111] = t47;
|
|
572
|
-
$[112] = t48;
|
|
573
|
-
} else t48 = $[112];
|
|
574
|
-
const t49 = modalStyle || void 0;
|
|
575
|
-
let t50;
|
|
576
|
-
if ($[113] === Symbol.for("react.memo_cache_sentinel")) {
|
|
577
|
-
t50 = /* @__PURE__ */ jsx("div", { tabIndex: 0 });
|
|
578
|
-
$[113] = t50;
|
|
579
|
-
} else t50 = $[113];
|
|
580
|
-
let t51;
|
|
581
|
-
if ($[114] !== contentNode || $[115] !== t49) {
|
|
582
|
-
t51 = /* @__PURE__ */ jsxs("div", {
|
|
583
|
-
ref: refModal,
|
|
584
|
-
className: "k-modal-inner",
|
|
585
|
-
tabIndex: -1,
|
|
586
|
-
style: t49,
|
|
587
|
-
onKeyDown: handleModalKeydown,
|
|
588
|
-
children: [contentNode, t50]
|
|
589
|
-
});
|
|
590
|
-
$[114] = contentNode;
|
|
591
|
-
$[115] = t49;
|
|
592
|
-
$[116] = t51;
|
|
593
|
-
} else t51 = $[116];
|
|
594
|
-
let t52;
|
|
595
|
-
if ($[117] !== afterClose || $[118] !== destroyOnClose || $[119] !== t51 || $[120] !== visible) {
|
|
596
|
-
t52 = /* @__PURE__ */ jsx(Transition, {
|
|
597
|
-
show: visible,
|
|
598
|
-
name: "k-modal-zoom",
|
|
599
|
-
timeout: 250,
|
|
600
|
-
unmountOnExit: destroyOnClose,
|
|
601
|
-
onAfterLeave: afterClose,
|
|
602
|
-
children: t51
|
|
603
|
-
});
|
|
604
|
-
$[117] = afterClose;
|
|
605
|
-
$[118] = destroyOnClose;
|
|
606
|
-
$[119] = t51;
|
|
607
|
-
$[120] = visible;
|
|
608
|
-
$[121] = t52;
|
|
609
|
-
} else t52 = $[121];
|
|
610
|
-
let t53;
|
|
611
|
-
if ($[122] !== clickMaskToClose || $[123] !== t46 || $[124] !== t48 || $[125] !== t52) {
|
|
612
|
-
t53 = /* @__PURE__ */ jsx("div", {
|
|
303
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
613
304
|
ref: refWrap,
|
|
614
305
|
className: "k-modal-wrap",
|
|
615
306
|
tabIndex: -1,
|
|
616
307
|
role: "dialog",
|
|
617
|
-
"aria-modal":
|
|
618
|
-
style:
|
|
308
|
+
"aria-modal": !panelOnly && mask ? true : void 0,
|
|
309
|
+
style: { display: showInner ? void 0 : "none" },
|
|
619
310
|
onClick: clickMaskToClose,
|
|
620
|
-
children:
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
});
|
|
646
|
-
$[131] = modalEl;
|
|
647
|
-
$[132] = registerHostedPopup;
|
|
648
|
-
$[133] = t55;
|
|
649
|
-
} else t55 = $[133];
|
|
650
|
-
const hosted = t55;
|
|
651
|
-
let t56;
|
|
652
|
-
if ($[134] !== hosted || $[135] !== panelOnly) {
|
|
653
|
-
t56 = panelOnly ? hosted : /* @__PURE__ */ jsx(Teleport, {
|
|
654
|
-
to: "body",
|
|
655
|
-
children: hosted
|
|
656
|
-
});
|
|
657
|
-
$[134] = hosted;
|
|
658
|
-
$[135] = panelOnly;
|
|
659
|
-
$[136] = t56;
|
|
660
|
-
} else t56 = $[136];
|
|
661
|
-
return t56;
|
|
311
|
+
children: /* @__PURE__ */ jsx(Transition, {
|
|
312
|
+
show: visible,
|
|
313
|
+
name: "k-modal-zoom",
|
|
314
|
+
timeout: 250,
|
|
315
|
+
unmountOnExit: destroyOnClose,
|
|
316
|
+
onAfterLeave: afterClose,
|
|
317
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
318
|
+
ref: refModal,
|
|
319
|
+
className: "k-modal-inner",
|
|
320
|
+
tabIndex: -1,
|
|
321
|
+
style: modalStyle || void 0,
|
|
322
|
+
onKeyDown: handleModalKeydown,
|
|
323
|
+
children: [contentNode, /* @__PURE__ */ jsx("div", { tabIndex: 0 })]
|
|
324
|
+
})
|
|
325
|
+
})
|
|
326
|
+
})]
|
|
327
|
+
});
|
|
328
|
+
const hosted = /* @__PURE__ */ jsx(PopupHostContext.Provider, {
|
|
329
|
+
value: registerHostedPopup,
|
|
330
|
+
children: modalEl
|
|
331
|
+
});
|
|
332
|
+
return panelOnly ? hosted : /* @__PURE__ */ jsx(Teleport, {
|
|
333
|
+
to: "body",
|
|
334
|
+
children: hosted
|
|
335
|
+
});
|
|
662
336
|
};
|
|
663
337
|
function ModalPanel(props) {
|
|
664
338
|
const $ = c(2);
|
|
@@ -675,14 +349,4 @@ function ModalPanel(props) {
|
|
|
675
349
|
} else t0 = $[1];
|
|
676
350
|
return t0;
|
|
677
351
|
}
|
|
678
|
-
function _temp(next) {
|
|
679
|
-
return next ?? false;
|
|
680
|
-
}
|
|
681
|
-
function _temp2(el) {
|
|
682
|
-
return {
|
|
683
|
-
left: el.offsetLeft,
|
|
684
|
-
top: el.offsetTop
|
|
685
|
-
};
|
|
686
|
-
}
|
|
687
|
-
//#endregion
|
|
688
352
|
export { ModalPanel, Modal as default };
|