@hkyhy/marsun-components-core 0.1.67 → 0.1.69
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/dist/components/FlexBox/FlexBox.d.ts +7 -0
- package/dist/components/FlexBox/FlexBox.js +43 -0
- package/dist/components/FlexBox/FlexBox.js.map +1 -0
- package/dist/components/FlexBox/FlexBoxFetch.d.ts +3 -0
- package/dist/components/FlexBox/FlexBoxFetch.js +92 -0
- package/dist/components/FlexBox/FlexBoxFetch.js.map +1 -0
- package/dist/components/FlexBox/FlexBoxView.d.ts +18 -0
- package/dist/components/FlexBox/FlexBoxView.js +42 -0
- package/dist/components/FlexBox/FlexBoxView.js.map +1 -0
- package/dist/components/FlexBox/defaultColumns.d.ts +7 -0
- package/dist/components/FlexBox/defaultColumns.js +26 -0
- package/dist/components/FlexBox/defaultColumns.js.map +1 -0
- package/dist/components/FlexBox/index.d.ts +79 -0
- package/dist/components/FlexBox/useFlexBox.d.ts +5 -0
- package/dist/components/FlexBox/useFlexBox.js +19 -0
- package/dist/components/FlexBox/useFlexBox.js.map +1 -0
- package/dist/components/Form/FormDataSync.d.ts +3 -0
- package/dist/components/Form/FormDataSync.js +29 -15
- package/dist/components/Form/FormDataSync.js.map +1 -1
- package/dist/components/Form/InputRange.d.ts +19 -0
- package/dist/components/Form/InputRange.js +84 -0
- package/dist/components/Form/InputRange.js.map +1 -0
- package/dist/components/Form/InputRange.module.scss.js +9 -0
- package/dist/components/Form/InputRange.module.scss.js.map +1 -0
- package/dist/components/Form/index.d.ts +4 -0
- package/dist/components/Form/inputRangeRules.d.ts +15 -0
- package/dist/components/Form/inputRangeRules.js +23 -0
- package/dist/components/Form/inputRangeRules.js.map +1 -0
- package/dist/components/Form/kneFormInfo.js +7 -7
- package/dist/components/FormInfo/ErrorTip.d.ts +7 -0
- package/dist/components/FormInfo/ErrorTip.js +89 -0
- package/dist/components/FormInfo/ErrorTip.js.map +1 -0
- package/dist/components/FormInfo/Form.d.ts +7 -0
- package/dist/components/FormInfo/Form.js +23 -0
- package/dist/components/FormInfo/Form.js.map +1 -0
- package/dist/components/FormInfo/FormApiButton.d.ts +7 -0
- package/dist/components/FormInfo/FormApiButton.js +28 -0
- package/dist/components/FormInfo/FormApiButton.js.map +1 -0
- package/dist/components/FormInfo/FormDrawer.d.ts +9 -0
- package/dist/components/FormInfo/FormDrawer.js +42 -0
- package/dist/components/FormInfo/FormDrawer.js.map +1 -0
- package/dist/components/FormInfo/FormInfo.d.ts +4 -0
- package/dist/components/FormInfo/FormInfo.js +61 -0
- package/dist/components/FormInfo/FormInfo.js.map +1 -0
- package/dist/components/FormInfo/FormItem.d.ts +4 -0
- package/dist/components/FormInfo/FormItem.js +10 -0
- package/dist/components/FormInfo/FormItem.js.map +1 -0
- package/dist/components/FormInfo/FormModal.d.ts +11 -0
- package/dist/components/FormInfo/FormModal.js +43 -0
- package/dist/components/FormInfo/FormModal.js.map +1 -0
- package/dist/components/FormInfo/FormSteps.d.ts +9 -0
- package/dist/components/FormInfo/FormSteps.js +96 -0
- package/dist/components/FormInfo/FormSteps.js.map +1 -0
- package/dist/components/FormInfo/FormStepsModal.d.ts +14 -0
- package/dist/components/FormInfo/FormStepsModal.js +96 -0
- package/dist/components/FormInfo/FormStepsModal.js.map +1 -0
- package/dist/components/FormInfo/List.d.ts +6 -0
- package/dist/components/FormInfo/List.js +180 -0
- package/dist/components/FormInfo/List.js.map +1 -0
- package/dist/components/FormInfo/MultiField.d.ts +6 -0
- package/dist/components/FormInfo/MultiField.js +76 -0
- package/dist/components/FormInfo/MultiField.js.map +1 -0
- package/dist/components/FormInfo/Steps.d.ts +26 -0
- package/dist/components/FormInfo/Steps.js +178 -0
- package/dist/components/FormInfo/Steps.js.map +1 -0
- package/dist/components/FormInfo/TableList.d.ts +6 -0
- package/dist/components/FormInfo/TableList.js +216 -0
- package/dist/components/FormInfo/TableList.js.map +1 -0
- package/dist/components/FormInfo/buildFormOverlayProps.d.ts +27 -0
- package/dist/components/FormInfo/buildFormOverlayProps.js +55 -0
- package/dist/components/FormInfo/buildFormOverlayProps.js.map +1 -0
- package/dist/components/FormInfo/fields.d.ts +33 -0
- package/dist/components/FormInfo/fields.js +30 -0
- package/dist/components/FormInfo/fields.js.map +1 -0
- package/dist/components/FormInfo/index.d.ts +21 -0
- package/dist/components/FormInfo/locale/zh-CN.d.ts +16 -0
- package/dist/components/FormInfo/locale/zh-CN.js +17 -0
- package/dist/components/FormInfo/locale/zh-CN.js.map +1 -0
- package/dist/components/FormInfo/nestBlock.d.ts +15 -0
- package/dist/components/FormInfo/nestBlock.js +19 -0
- package/dist/components/FormInfo/nestBlock.js.map +1 -0
- package/dist/components/FormInfo/style.module.scss.js +57 -0
- package/dist/components/FormInfo/style.module.scss.js.map +1 -0
- package/dist/components/FormInfo/types.d.ts +213 -0
- package/dist/components/FormInfo/withLocale.d.ts +14 -0
- package/dist/components/FormInfo/withLocale.js +25 -0
- package/dist/components/FormInfo/withLocale.js.map +1 -0
- package/dist/components/InfoPage/CentralContent/boxComputed.d.ts +2 -0
- package/dist/components/InfoPage/CentralContent/boxComputed.js +15 -0
- package/dist/components/InfoPage/CentralContent/boxComputed.js.map +1 -0
- package/dist/components/InfoPage/CentralContent/index.d.ts +3 -0
- package/dist/components/InfoPage/CentralContent/index.js +102 -0
- package/dist/components/InfoPage/CentralContent/index.js.map +1 -0
- package/dist/components/InfoPage/CentralContent/style.module.scss.js +15 -0
- package/dist/components/InfoPage/CentralContent/style.module.scss.js.map +1 -0
- package/dist/components/InfoPage/Content/index.d.ts +16 -0
- package/dist/components/InfoPage/Content/index.js +72 -0
- package/dist/components/InfoPage/Content/index.js.map +1 -0
- package/dist/components/InfoPage/Content/style.module.scss.js +14 -0
- package/dist/components/InfoPage/Content/style.module.scss.js.map +1 -0
- package/dist/components/InfoPage/Descriptions/index.d.ts +9 -0
- package/dist/components/InfoPage/Descriptions/index.js +48 -0
- package/dist/components/InfoPage/Descriptions/index.js.map +1 -0
- package/dist/components/InfoPage/Descriptions/style.module.scss.js +11 -0
- package/dist/components/InfoPage/Descriptions/style.module.scss.js.map +1 -0
- package/dist/components/InfoPage/Flow/index.d.ts +9 -0
- package/dist/components/InfoPage/Flow/index.js +165 -0
- package/dist/components/InfoPage/Flow/index.js.map +1 -0
- package/dist/components/InfoPage/Flow/style.module.scss.js +19 -0
- package/dist/components/InfoPage/Flow/style.module.scss.js.map +1 -0
- package/dist/components/InfoPage/InfoPage/Collapse.d.ts +10 -0
- package/dist/components/InfoPage/InfoPage/Collapse.js +11 -0
- package/dist/components/InfoPage/InfoPage/Collapse.js.map +1 -0
- package/dist/components/InfoPage/InfoPage/index.d.ts +21 -0
- package/dist/components/InfoPage/InfoPage/index.js +35 -0
- package/dist/components/InfoPage/InfoPage/index.js.map +1 -0
- package/dist/components/InfoPage/InfoPage/style.module.scss.js +15 -0
- package/dist/components/InfoPage/InfoPage/style.module.scss.js.map +1 -0
- package/dist/components/InfoPage/Report/List.d.ts +6 -0
- package/dist/components/InfoPage/Report/List.js +26 -0
- package/dist/components/InfoPage/Report/List.js.map +1 -0
- package/dist/components/InfoPage/Report/Part.d.ts +6 -0
- package/dist/components/InfoPage/Report/Part.js +42 -0
- package/dist/components/InfoPage/Report/Part.js.map +1 -0
- package/dist/components/InfoPage/Report/PrintPageBreak.d.ts +3 -0
- package/dist/components/InfoPage/Report/PrintPageBreak.js +8 -0
- package/dist/components/InfoPage/Report/PrintPageBreak.js.map +1 -0
- package/dist/components/InfoPage/Report/Result.d.ts +6 -0
- package/dist/components/InfoPage/Report/Result.js +26 -0
- package/dist/components/InfoPage/Report/Result.js.map +1 -0
- package/dist/components/InfoPage/Report/Table.d.ts +6 -0
- package/dist/components/InfoPage/Report/Table.js +125 -0
- package/dist/components/InfoPage/Report/Table.js.map +1 -0
- package/dist/components/InfoPage/Report/index.d.ts +26 -0
- package/dist/components/InfoPage/Report/index.js +61 -0
- package/dist/components/InfoPage/Report/index.js.map +1 -0
- package/dist/components/InfoPage/Report/style.module.scss.js +47 -0
- package/dist/components/InfoPage/Report/style.module.scss.js.map +1 -0
- package/dist/components/InfoPage/Score/index.d.ts +8 -0
- package/dist/components/InfoPage/Score/index.js +50 -0
- package/dist/components/InfoPage/Score/index.js.map +1 -0
- package/dist/components/InfoPage/Score/style.module.scss.js +10 -0
- package/dist/components/InfoPage/Score/style.module.scss.js.map +1 -0
- package/dist/components/InfoPage/SplitLine/index.d.ts +17 -0
- package/dist/components/InfoPage/SplitLine/index.js +67 -0
- package/dist/components/InfoPage/SplitLine/index.js.map +1 -0
- package/dist/components/InfoPage/SplitLine/style.module.scss.js +8 -0
- package/dist/components/InfoPage/SplitLine/style.module.scss.js.map +1 -0
- package/dist/components/InfoPage/computeColumnsValue.d.ts +28 -0
- package/dist/components/InfoPage/computeColumnsValue.js +60 -0
- package/dist/components/InfoPage/computeColumnsValue.js.map +1 -0
- package/dist/components/InfoPage/formatView.d.ts +23 -0
- package/dist/components/InfoPage/formatView.js +119 -0
- package/dist/components/InfoPage/formatView.js.map +1 -0
- package/dist/components/InfoPage/index.d.ts +262 -0
- package/dist/components/OrgTree/OrgTree.js +103 -89
- package/dist/components/OrgTree/OrgTree.js.map +1 -1
- package/dist/components/ReactModal/ColumnsLayout.d.ts +7 -0
- package/dist/components/ReactModal/ColumnsLayout.js +20 -0
- package/dist/components/ReactModal/ColumnsLayout.js.map +1 -0
- package/dist/components/ReactModal/Drawer.d.ts +73 -0
- package/dist/components/ReactModal/Drawer.js +292 -0
- package/dist/components/ReactModal/Drawer.js.map +1 -0
- package/dist/components/ReactModal/Footer.d.ts +12 -0
- package/dist/components/ReactModal/Footer.js +53 -0
- package/dist/components/ReactModal/Footer.js.map +1 -0
- package/dist/components/ReactModal/Modal.d.ts +14 -0
- package/dist/components/ReactModal/Modal.js +366 -0
- package/dist/components/ReactModal/Modal.js.map +1 -0
- package/dist/components/ReactModal/ScrollRegion.d.ts +7 -0
- package/dist/components/ReactModal/ScrollRegion.js +22 -0
- package/dist/components/ReactModal/ScrollRegion.js.map +1 -0
- package/dist/components/ReactModal/SimpleBar.d.ts +2 -0
- package/dist/components/ReactModal/SimpleBar.js +7 -0
- package/dist/components/ReactModal/SimpleBar.js.map +1 -0
- package/dist/components/ReactModal/TabsLayout.d.ts +6 -0
- package/dist/components/ReactModal/TabsLayout.js +16 -0
- package/dist/components/ReactModal/TabsLayout.js.map +1 -0
- package/dist/components/ReactModal/confirmModal.module.scss.js +30 -0
- package/dist/components/ReactModal/confirmModal.module.scss.js.map +1 -0
- package/dist/components/ReactModal/createDrawerRender.d.ts +2 -0
- package/dist/components/ReactModal/createDrawerRender.js +7 -0
- package/dist/components/ReactModal/createDrawerRender.js.map +1 -0
- package/dist/components/ReactModal/createModalRender.d.ts +2 -0
- package/dist/components/ReactModal/createModalRender.js +7 -0
- package/dist/components/ReactModal/createModalRender.js.map +1 -0
- package/dist/components/ReactModal/drawer.module.scss.js +36 -0
- package/dist/components/ReactModal/drawer.module.scss.js.map +1 -0
- package/dist/components/ReactModal/index.d.ts +57 -0
- package/dist/components/ReactModal/intlStub.d.ts +15 -0
- package/dist/components/ReactModal/intlStub.js +21 -0
- package/dist/components/ReactModal/intlStub.js.map +1 -0
- package/dist/components/ReactModal/layouts.module.scss.js +12 -0
- package/dist/components/ReactModal/layouts.module.scss.js.map +1 -0
- package/dist/components/ReactModal/locale/en-US.d.ts +5 -0
- package/dist/components/ReactModal/locale/zh-CN.d.ts +5 -0
- package/dist/components/ReactModal/locale/zh-CN.js +8 -0
- package/dist/components/ReactModal/locale/zh-CN.js.map +1 -0
- package/dist/components/ReactModal/lockParentScroll.d.ts +3 -0
- package/dist/components/ReactModal/modalClassNames.d.ts +5 -0
- package/dist/components/ReactModal/modalClassNames.js +8 -0
- package/dist/components/ReactModal/modalClassNames.js.map +1 -0
- package/dist/components/ReactModal/style.module.scss.js +38 -0
- package/dist/components/ReactModal/style.module.scss.js.map +1 -0
- package/dist/components/ReactModal/useConfirmModal.d.ts +4 -0
- package/dist/components/ReactModal/useConfirmModal.js +161 -0
- package/dist/components/ReactModal/useConfirmModal.js.map +1 -0
- package/dist/components/ReactModal/useDrawer.d.ts +5 -0
- package/dist/components/ReactModal/useDrawer.js +123 -0
- package/dist/components/ReactModal/useDrawer.js.map +1 -0
- package/dist/components/ReactModal/usePatchElement.d.ts +2 -0
- package/dist/components/ReactModal/usePatchElement.js +11 -0
- package/dist/components/ReactModal/usePatchElement.js.map +1 -0
- package/dist/components/ReactModal/withLocale.d.ts +5 -0
- package/dist/components/ReactModal/withLocale.js +6 -0
- package/dist/components/ReactModal/withLocale.js.map +1 -0
- package/dist/components/VirtualScrollbar/VirtualScrollbar/index.d.ts +5 -0
- package/dist/components/VirtualScrollbar/VirtualScrollbar/index.js +75 -51
- package/dist/components/VirtualScrollbar/VirtualScrollbar/index.js.map +1 -1
- package/dist/components/index.d.ts +5 -0
- package/dist/form-info.d.ts +17 -0
- package/dist/form-info.js +68 -0
- package/dist/form-info.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +700 -632
- package/dist/index.js.map +1 -1
- package/dist/marsun-components-core.css +1 -1
- package/dist/styles/global.css +1 -1
- package/dist/utils/date.d.ts +4 -1
- package/dist/utils/date.js +35 -27
- package/dist/utils/date.js.map +1 -1
- package/package.json +16 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ComponentType, FC, ReactNode } from 'react';
|
|
2
|
+
export interface ReactModalProps {
|
|
3
|
+
open?: boolean;
|
|
4
|
+
title?: ReactNode | ((opts: any) => ReactNode);
|
|
5
|
+
children?: ReactNode | ((opts: any) => ReactNode);
|
|
6
|
+
size?: 'small' | 'default' | 'large' | string;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
onConfirm?: (...args: any[]) => any;
|
|
9
|
+
onCancel?: (...args: any[]) => any;
|
|
10
|
+
confirmText?: ReactNode;
|
|
11
|
+
cancelText?: ReactNode;
|
|
12
|
+
footer?: ReactNode | null | ((opts: any) => ReactNode);
|
|
13
|
+
footerButtons?: any[] | ((opts: any) => any[]);
|
|
14
|
+
closable?: boolean;
|
|
15
|
+
noPadding?: boolean;
|
|
16
|
+
bodyScroll?: boolean;
|
|
17
|
+
mobileFullscreen?: boolean;
|
|
18
|
+
getContainer?: any;
|
|
19
|
+
className?: string;
|
|
20
|
+
wrapClassName?: string;
|
|
21
|
+
width?: number | string;
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ReactDrawerProps extends ReactModalProps {
|
|
26
|
+
placement?: 'left' | 'right' | 'top' | 'bottom';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type ConfirmModalOptions = {
|
|
30
|
+
type?: string;
|
|
31
|
+
title?: ReactNode;
|
|
32
|
+
message?: ReactNode;
|
|
33
|
+
danger?: boolean;
|
|
34
|
+
icon?: ReactNode | false | null;
|
|
35
|
+
confirmType?: string;
|
|
36
|
+
onConfirm?: (...args: any[]) => any;
|
|
37
|
+
onOk?: (...args: any[]) => any;
|
|
38
|
+
onCancel?: (...args: any[]) => any;
|
|
39
|
+
confirmText?: ReactNode;
|
|
40
|
+
cancelText?: ReactNode;
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export declare const ReactModal: FC<ReactModalProps>;
|
|
45
|
+
export declare const ReactDrawer: FC<ReactDrawerProps>;
|
|
46
|
+
export declare function useModal(): (props: ReactModalProps) => { close: () => void };
|
|
47
|
+
export declare function useDrawer(): (props: ReactDrawerProps) => { close: () => void };
|
|
48
|
+
export declare function useConfirmModal(): (opts: ConfirmModalOptions) => { close: () => void };
|
|
49
|
+
export declare const DrawerContextHolder: ComponentType<any>;
|
|
50
|
+
export declare const ScrollRegion: ComponentType<any>;
|
|
51
|
+
export declare const TabsLayout: ComponentType<any>;
|
|
52
|
+
export declare const ColumnsLayout: ComponentType<any>;
|
|
53
|
+
export declare function createModalRender(defaults?: Partial<ReactModalProps>): ComponentType<any>;
|
|
54
|
+
export declare function createDrawerRender(
|
|
55
|
+
defaults?: Partial<ReactDrawerProps>,
|
|
56
|
+
): ComponentType<any>;
|
|
57
|
+
export declare const modalClassNames: Record<string, string>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function useIntl(): {
|
|
2
|
+
formatMessage: ({ id, defaultMessage }?: {}) => any;
|
|
3
|
+
};
|
|
4
|
+
export function FormattedMessage({ id, defaultMessage, children }: {
|
|
5
|
+
id: any;
|
|
6
|
+
defaultMessage: any;
|
|
7
|
+
children: any;
|
|
8
|
+
}): any;
|
|
9
|
+
/**
|
|
10
|
+
* 兼容上游 createWithIntlProvider:返回透传 HOC(默认中文,无 Provider)。
|
|
11
|
+
*/
|
|
12
|
+
export function createWithIntlProvider(): (Component: any) => {
|
|
13
|
+
(props: any): React.CElement<any, React.Component<any, any, any>>;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import a from "react";
|
|
2
|
+
import o from "./locale/zh-CN.js";
|
|
3
|
+
const c = o;
|
|
4
|
+
function u() {
|
|
5
|
+
return {
|
|
6
|
+
formatMessage: ({ id: t, defaultMessage: e } = {}) => t && c[t] || e || t || ""
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function m() {
|
|
10
|
+
return function(e) {
|
|
11
|
+
function r(n) {
|
|
12
|
+
return a.createElement(e, n);
|
|
13
|
+
}
|
|
14
|
+
return r.displayName = `WithLocale(${e.displayName || e.name || "Component"})`, r;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
m as createWithIntlProvider,
|
|
19
|
+
u as useIntl
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=intlStub.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intlStub.js","sources":["../../../src/components/ReactModal/intlStub.js"],"sourcesContent":["// @ts-nocheck\n/**\n * 本地 intl stub:不引入 `@kne/react-intl`。\n * useIntl 返回中文消息;createWithIntlProvider 为透传 HOC。\n */\nimport React from 'react';\nimport zhCN from './locale/zh-CN';\n\nconst MESSAGES = zhCN;\n\nexport function useIntl() {\n return {\n formatMessage: ({ id, defaultMessage } = {}) =>\n (id && MESSAGES[id]) || defaultMessage || id || '',\n };\n}\n\nexport function FormattedMessage({ id, defaultMessage, children }) {\n const text = (id && MESSAGES[id]) || defaultMessage || id || '';\n if (typeof children === 'function') {\n return children(text);\n }\n return text;\n}\n\n/**\n * 兼容上游 createWithIntlProvider:返回透传 HOC(默认中文,无 Provider)。\n */\nexport function createWithIntlProvider() {\n return function withLocale(Component) {\n function WithLocale(props) {\n return React.createElement(Component, props);\n }\n WithLocale.displayName = `WithLocale(${Component.displayName || Component.name || 'Component'})`;\n return WithLocale;\n };\n}\n"],"names":["MESSAGES","zhCN","useIntl","id","defaultMessage","createWithIntlProvider","Component","WithLocale","props","React"],"mappings":";;AAQA,MAAMA,IAAWC;AAEV,SAASC,IAAU;AACxB,SAAO;AAAA,IACL,eAAe,CAAC,EAAE,IAAAC,GAAI,gBAAAC,EAAc,IAAK,CAAA,MACtCD,KAAMH,EAASG,CAAE,KAAMC,KAAkBD,KAAM;AAAA,EACtD;AACA;AAaO,SAASE,IAAyB;AACvC,SAAO,SAAoBC,GAAW;AACpC,aAASC,EAAWC,GAAO;AACzB,aAAOC,EAAM,cAAcH,GAAWE,CAAK;AAAA,IAC7C;AACA,WAAAD,EAAW,cAAc,cAAcD,EAAU,eAAeA,EAAU,QAAQ,WAAW,KACtFC;AAAA,EACT;AACF;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const l = {
|
|
2
|
+
"modal-tabs-layout": "_modal-tabs-layout_11mt7_2",
|
|
3
|
+
"modal-columns-layout": "_modal-columns-layout_11mt7_58",
|
|
4
|
+
"modal-columns-layout__col": "_modal-columns-layout__col_11mt7_69",
|
|
5
|
+
"modal-scroll-region": "_modal-scroll-region_11mt7_80",
|
|
6
|
+
"modal-scroll-region-inner": "_modal-scroll-region-inner_11mt7_121",
|
|
7
|
+
"is-inset": "_is-inset_11mt7_126"
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
l as default
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=layouts.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layouts.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zh-CN.js","sources":["../../../../src/components/ReactModal/locale/zh-CN.js"],"sourcesContent":["// @ts-nocheck\n// Ported from https://github.com/kne-union/react-modal/blob/master/src/locale/zh-CN.js\nconst locale = {\n Cancel: '取消',\n Confirm: '确定',\n};\n\nexport default locale;\n"],"names":["locale"],"mappings":"AAEK,MAACA,IAAS;AAAA,EACb,QAAQ;AAAA,EACR,SAAS;AACX;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modalClassNames.js","sources":["../../../src/components/ReactModal/modalClassNames.js"],"sourcesContent":["// @ts-nocheck\n// Ported from https://github.com/kne-union/react-modal/blob/master/src/modalClassNames.js\nexport const modalClassNames = {\n stepsForm: 'react-modal-steps-form',\n splitter: 'react-modal-splitter',\n};\n\nexport default modalClassNames;\n"],"names":["modalClassNames"],"mappings":"AAEY,MAACA,IAAkB;AAAA,EAC7B,WAAW;AAAA,EACX,UAAU;AACZ;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const a = "_modal_raar2_25", o = "_small_raar2_48", r = "_large_raar2_51", _ = {
|
|
2
|
+
"kne-responsive-boundary": "_kne-responsive-boundary_raar2_3",
|
|
3
|
+
"kne-responsive-scroll": "_kne-responsive-scroll_raar2_7",
|
|
4
|
+
modal: a,
|
|
5
|
+
small: o,
|
|
6
|
+
large: r,
|
|
7
|
+
"modal-body-inner": "_modal-body-inner_raar2_51",
|
|
8
|
+
"is-mobile": "_is-mobile_raar2_54",
|
|
9
|
+
"modal-container": "_modal-container_raar2_69",
|
|
10
|
+
"modal-antd-header": "_modal-antd-header_raar2_84",
|
|
11
|
+
"modal-antd-footer": "_modal-antd-footer_raar2_85",
|
|
12
|
+
"modal-antd-body": "_modal-antd-body_raar2_89",
|
|
13
|
+
"modal-outer": "_modal-outer_raar2_98",
|
|
14
|
+
"no-title": "_no-title_raar2_104",
|
|
15
|
+
"no-footer": "_no-footer_raar2_109",
|
|
16
|
+
"no-padding": "_no-padding_raar2_112",
|
|
17
|
+
"modal-title": "_modal-title_raar2_123",
|
|
18
|
+
"modal-body": "_modal-body_raar2_51",
|
|
19
|
+
"modal-footer": "_modal-footer_raar2_132",
|
|
20
|
+
"body-scroll-off": "_body-scroll-off_raar2_159",
|
|
21
|
+
"is-embedded-footer": "_is-embedded-footer_raar2_203",
|
|
22
|
+
"modal-footer-extra": "_modal-footer-extra_raar2_203",
|
|
23
|
+
"modal-footer-actions": "_modal-footer-actions_raar2_224",
|
|
24
|
+
"modal-close": "_modal-close_raar2_229",
|
|
25
|
+
"modal-host": "_modal-host_raar2_243",
|
|
26
|
+
"modal-form-host": "_modal-form-host_raar2_251",
|
|
27
|
+
"modal-wrap": "_modal-wrap_raar2_268",
|
|
28
|
+
"modal-wrap-centered": "_modal-wrap-centered_raar2_293",
|
|
29
|
+
"modal-wrap-fullscreen": "_modal-wrap-fullscreen_raar2_325",
|
|
30
|
+
"modal-mask-fullscreen": "_modal-mask-fullscreen_raar2_364"
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
_ as default,
|
|
34
|
+
r as large,
|
|
35
|
+
a as modal,
|
|
36
|
+
o as small
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=style.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { jsx as m, jsxs as I } from "react/jsx-runtime";
|
|
2
|
+
import { App as L } from "antd";
|
|
3
|
+
import { CheckCircleFilled as _, CloseCircleFilled as A, ExclamationCircleFilled as P, InfoCircleFilled as j } from "@ant-design/icons";
|
|
4
|
+
import u from "classnames";
|
|
5
|
+
import { useMobilePopupMount as z, useScrollElement as G } from "@kne/responsive-utils";
|
|
6
|
+
import Y from "./withLocale.js";
|
|
7
|
+
import { lockParentScroll as B, resolveModalGetContainer as D } from "./Modal.js";
|
|
8
|
+
import g from "./style.module.scss.js";
|
|
9
|
+
import t from "./confirmModal.module.scss.js";
|
|
10
|
+
const E = Y(({ children: o }) => o), H = [".example-driver-device-scroll"], K = {
|
|
11
|
+
cover: "viewport",
|
|
12
|
+
exampleSelectors: H
|
|
13
|
+
}, S = {
|
|
14
|
+
info: j,
|
|
15
|
+
confirm: P,
|
|
16
|
+
warning: P,
|
|
17
|
+
error: A,
|
|
18
|
+
success: _
|
|
19
|
+
}, V = (o, e) => o === "confirm" ? e : o, W = ({ type: o, danger: e, icon: n }) => n === !1 || n === null ? !1 : o === "confirm" ? !!e : ["info", "success", "warning", "error"].includes(o), X = ({ type: o, confirmType: e = "info", danger: n, icon: c }) => {
|
|
20
|
+
if (c)
|
|
21
|
+
return c;
|
|
22
|
+
if (!W({ type: o, danger: n, icon: c }))
|
|
23
|
+
return null;
|
|
24
|
+
const r = V(o, e), s = S[r] || S.info;
|
|
25
|
+
return /* @__PURE__ */ m(
|
|
26
|
+
s,
|
|
27
|
+
{
|
|
28
|
+
className: u(t["title-icon"], t[`title-icon-${r}`])
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}, $ = ({ type: o, confirmType: e, title: n, message: c, danger: r, icon: s, isMobile: d }) => {
|
|
32
|
+
const l = X({ type: o, confirmType: e, danger: r, icon: s }), a = d ? t["is-mobile-block"] : null;
|
|
33
|
+
return {
|
|
34
|
+
title: n ? /* @__PURE__ */ I(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: u(t.titleRow, a),
|
|
38
|
+
onClick: (i) => {
|
|
39
|
+
i.stopPropagation();
|
|
40
|
+
},
|
|
41
|
+
children: [
|
|
42
|
+
l ? /* @__PURE__ */ m("span", { className: t.titleIcon, children: l }) : null,
|
|
43
|
+
/* @__PURE__ */ m("div", { className: t.titleText, children: n })
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
) : null,
|
|
47
|
+
content: /* @__PURE__ */ I(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
className: u(t.contentRow, a, {
|
|
51
|
+
[t["has-title"]]: n,
|
|
52
|
+
[t["has-icon"]]: !!l && n
|
|
53
|
+
}),
|
|
54
|
+
children: [
|
|
55
|
+
!n && l ? /* @__PURE__ */ m("span", { className: t.titleIcon, children: l }) : null,
|
|
56
|
+
/* @__PURE__ */ m("div", { className: t.contentText, children: c })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
};
|
|
61
|
+
}, q = (o, { isMobile: e, fixedModeClass: n, getPopupContainer: c, anchor: r, unlock: s, userAfterClose: d }) => {
|
|
62
|
+
var T;
|
|
63
|
+
const {
|
|
64
|
+
type: l = "confirm",
|
|
65
|
+
icon: a,
|
|
66
|
+
title: i,
|
|
67
|
+
danger: p,
|
|
68
|
+
wrapClassName: h,
|
|
69
|
+
message: C,
|
|
70
|
+
confirmType: x = "info",
|
|
71
|
+
getContainer: N,
|
|
72
|
+
onConfirm: M,
|
|
73
|
+
onCancel: O,
|
|
74
|
+
confirmText: R,
|
|
75
|
+
cancelText: b,
|
|
76
|
+
afterClose: k,
|
|
77
|
+
zIndex: y,
|
|
78
|
+
...f
|
|
79
|
+
} = {
|
|
80
|
+
maskClosable: !1,
|
|
81
|
+
...o
|
|
82
|
+
}, { title: w, content: F } = $({
|
|
83
|
+
type: l,
|
|
84
|
+
confirmType: x,
|
|
85
|
+
title: i,
|
|
86
|
+
message: C,
|
|
87
|
+
danger: p,
|
|
88
|
+
icon: a,
|
|
89
|
+
isMobile: e
|
|
90
|
+
});
|
|
91
|
+
return {
|
|
92
|
+
modalMethod: l,
|
|
93
|
+
config: {
|
|
94
|
+
...f,
|
|
95
|
+
zIndex: y ?? 1100,
|
|
96
|
+
okText: R ?? f.okText,
|
|
97
|
+
cancelText: b ?? f.cancelText,
|
|
98
|
+
onOk: M ?? f.onOk,
|
|
99
|
+
onCancel: O ?? f.onCancel,
|
|
100
|
+
getContainer: D({
|
|
101
|
+
customGetContainer: N,
|
|
102
|
+
getPopupContainer: c,
|
|
103
|
+
getHostNode: () => r
|
|
104
|
+
}),
|
|
105
|
+
centered: !0,
|
|
106
|
+
afterClose: (...v) => {
|
|
107
|
+
s(), d && d(...v), k && k(...v);
|
|
108
|
+
},
|
|
109
|
+
icon: null,
|
|
110
|
+
classNames: {
|
|
111
|
+
mask: u(
|
|
112
|
+
e && g["modal-mask-fullscreen"],
|
|
113
|
+
e && n,
|
|
114
|
+
(T = f.classNames) == null ? void 0 : T.mask
|
|
115
|
+
)
|
|
116
|
+
},
|
|
117
|
+
wrapClassName: u(
|
|
118
|
+
g["modal-wrap"],
|
|
119
|
+
g["modal-wrap-centered"],
|
|
120
|
+
t["confirm-modal-wrap"],
|
|
121
|
+
h,
|
|
122
|
+
{
|
|
123
|
+
[t["is-danger"]]: p,
|
|
124
|
+
[t["is-mobile"]]: e,
|
|
125
|
+
[n]: e
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
title: w ? /* @__PURE__ */ m(E, { children: w }) : null,
|
|
129
|
+
content: /* @__PURE__ */ m(E, { children: F })
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}, co = () => {
|
|
133
|
+
const { modal: o } = L.useApp(), { resolveMount: e, getPopupContainer: n } = z(K), c = G();
|
|
134
|
+
return (r) => {
|
|
135
|
+
const s = typeof document < "u" ? document.activeElement : null, { isMobile: d, fixedModeClass: l } = e(s), a = B(c), i = {}, { afterClose: p, ...h } = r, { modalMethod: C, config: x } = q(
|
|
136
|
+
{
|
|
137
|
+
...h,
|
|
138
|
+
onClose: () => i.close()
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
isMobile: d,
|
|
142
|
+
fixedModeClass: l,
|
|
143
|
+
getPopupContainer: n,
|
|
144
|
+
anchor: s,
|
|
145
|
+
unlock: a,
|
|
146
|
+
userAfterClose: p
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
if (typeof o[C] == "function") {
|
|
150
|
+
const { destroy: N } = o[C](x);
|
|
151
|
+
i.close = N;
|
|
152
|
+
} else
|
|
153
|
+
a(), i.close = () => {
|
|
154
|
+
};
|
|
155
|
+
return i;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
export {
|
|
159
|
+
co as useConfirmModal
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=useConfirmModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConfirmModal.js","sources":["../../../src/components/ReactModal/useConfirmModal.jsx"],"sourcesContent":["// @ts-nocheck\n// Ported from https://github.com/kne-union/react-modal/blob/master/src/useConfirmModal.js\nimport { App } from 'antd';\nimport {\n CheckCircleFilled,\n CloseCircleFilled,\n ExclamationCircleFilled,\n InfoCircleFilled,\n} from '@ant-design/icons';\nimport classnames from 'classnames';\nimport { useMobilePopupMount, useScrollElement } from '@kne/responsive-utils';\nimport withLocale from './withLocale';\nimport { lockParentScroll, resolveModalGetContainer } from './Modal';\nimport modalStyle from './style.module.scss';\nimport confirmStyle from './confirmModal.module.scss';\n\nconst ConfirmLocaleRoot = withLocale(({ children }) => children);\n\nconst VIEWPORT_EXAMPLE_SELECTORS = ['.example-driver-device-scroll'];\n\nconst viewportPopupMountOptions = {\n cover: 'viewport',\n exampleSelectors: VIEWPORT_EXAMPLE_SELECTORS,\n};\n\nconst ICON_BY_TYPE = {\n info: InfoCircleFilled,\n confirm: ExclamationCircleFilled,\n warning: ExclamationCircleFilled,\n error: CloseCircleFilled,\n success: CheckCircleFilled,\n};\n\nconst getIconKind = (type, confirmType) => (type === 'confirm' ? confirmType : type);\n\nconst shouldShowDefaultIcon = ({ type, danger, icon }) => {\n if (icon === false || icon === null) {\n return false;\n }\n if (type === 'confirm') {\n return !!danger;\n }\n return ['info', 'success', 'warning', 'error'].includes(type);\n};\n\nconst getConfirmIconNode = ({ type, confirmType = 'info', danger, icon }) => {\n if (icon) {\n return icon;\n }\n if (!shouldShowDefaultIcon({ type, danger, icon })) {\n return null;\n }\n const kind = getIconKind(type, confirmType);\n const IconComponent = ICON_BY_TYPE[kind] || ICON_BY_TYPE.info;\n return (\n <IconComponent\n className={classnames(confirmStyle['title-icon'], confirmStyle[`title-icon-${kind}`])}\n />\n );\n};\n\nconst buildConfirmContent = ({ type, confirmType, title, message, danger, icon, isMobile }) => {\n const iconNode = getConfirmIconNode({ type, confirmType, danger, icon });\n const mobileClass = isMobile ? confirmStyle['is-mobile-block'] : null;\n\n return {\n title: title ? (\n <div\n className={classnames(confirmStyle.titleRow, mobileClass)}\n onClick={(e) => {\n e.stopPropagation();\n }}\n >\n {iconNode ? <span className={confirmStyle.titleIcon}>{iconNode}</span> : null}\n <div className={confirmStyle.titleText}>{title}</div>\n </div>\n ) : null,\n content: (\n <div\n className={classnames(confirmStyle.contentRow, mobileClass, {\n [confirmStyle['has-title']]: title,\n [confirmStyle['has-icon']]: !!iconNode && title,\n })}\n >\n {!title && iconNode ? <span className={confirmStyle.titleIcon}>{iconNode}</span> : null}\n <div className={confirmStyle.contentText}>{message}</div>\n </div>\n ),\n };\n};\n\nconst mapConfirmProps = (\n props,\n { isMobile, fixedModeClass, getPopupContainer, anchor, unlock, userAfterClose },\n) => {\n const {\n type = 'confirm',\n icon,\n title,\n danger,\n wrapClassName,\n message,\n confirmType = 'info',\n getContainer: customGetContainer,\n onConfirm,\n onCancel,\n confirmText,\n cancelText,\n afterClose,\n zIndex,\n ...otherProps\n } = {\n maskClosable: false,\n ...props,\n };\n\n const { title: confirmTitle, content } = buildConfirmContent({\n type,\n confirmType,\n title,\n message,\n danger,\n icon,\n isMobile,\n });\n\n return {\n modalMethod: type,\n config: {\n ...otherProps,\n zIndex: zIndex ?? 1100,\n okText: confirmText ?? otherProps.okText,\n cancelText: cancelText ?? otherProps.cancelText,\n onOk: onConfirm ?? otherProps.onOk,\n onCancel: onCancel ?? otherProps.onCancel,\n getContainer: resolveModalGetContainer({\n customGetContainer,\n getPopupContainer,\n getHostNode: () => anchor,\n }),\n centered: true,\n afterClose: (...args) => {\n unlock();\n userAfterClose && userAfterClose(...args);\n afterClose && afterClose(...args);\n },\n icon: null,\n classNames: {\n mask: classnames(\n isMobile && modalStyle['modal-mask-fullscreen'],\n isMobile && fixedModeClass,\n otherProps.classNames?.mask,\n ),\n },\n wrapClassName: classnames(\n modalStyle['modal-wrap'],\n modalStyle['modal-wrap-centered'],\n confirmStyle['confirm-modal-wrap'],\n wrapClassName,\n {\n [confirmStyle['is-danger']]: danger,\n [confirmStyle['is-mobile']]: isMobile,\n [fixedModeClass]: isMobile,\n },\n ),\n title: confirmTitle ? <ConfirmLocaleRoot>{confirmTitle}</ConfirmLocaleRoot> : null,\n content: <ConfirmLocaleRoot>{content}</ConfirmLocaleRoot>,\n },\n };\n};\n\nexport const useConfirmModal = () => {\n const { modal } = App.useApp();\n const { resolveMount, getPopupContainer } = useMobilePopupMount(viewportPopupMountOptions);\n const getScrollElement = useScrollElement();\n\n return (props) => {\n const anchor = typeof document !== 'undefined' ? document.activeElement : null;\n const { isMobile, fixedModeClass } = resolveMount(anchor);\n const unlock = lockParentScroll(getScrollElement);\n const api = {};\n const { afterClose: userAfterClose, ...restProps } = props;\n const { modalMethod, config } = mapConfirmProps(\n {\n ...restProps,\n onClose: () => api.close(),\n },\n {\n isMobile,\n fixedModeClass,\n getPopupContainer,\n anchor,\n unlock,\n userAfterClose,\n },\n );\n\n if (typeof modal[modalMethod] === 'function') {\n const { destroy } = modal[modalMethod](config);\n api.close = destroy;\n } else {\n unlock();\n api.close = () => {};\n }\n\n return api;\n };\n};\n\nexport default useConfirmModal;\n"],"names":["ConfirmLocaleRoot","withLocale","children","VIEWPORT_EXAMPLE_SELECTORS","viewportPopupMountOptions","ICON_BY_TYPE","InfoCircleFilled","ExclamationCircleFilled","CloseCircleFilled","CheckCircleFilled","getIconKind","type","confirmType","shouldShowDefaultIcon","danger","icon","getConfirmIconNode","kind","IconComponent","jsx","classnames","confirmStyle","buildConfirmContent","title","message","isMobile","iconNode","mobileClass","jsxs","e","mapConfirmProps","props","fixedModeClass","getPopupContainer","anchor","unlock","userAfterClose","wrapClassName","customGetContainer","onConfirm","onCancel","confirmText","cancelText","afterClose","zIndex","otherProps","confirmTitle","content","resolveModalGetContainer","args","modalStyle","_a","useConfirmModal","modal","App","resolveMount","useMobilePopupMount","getScrollElement","useScrollElement","lockParentScroll","api","restProps","modalMethod","config","destroy"],"mappings":";;;;;;;;;AAgBA,MAAMA,IAAoBC,EAAW,CAAC,EAAE,UAAAC,EAAA,MAAeA,CAAQ,GAEzDC,IAA6B,CAAC,+BAA+B,GAE7DC,IAA4B;AAAA,EAChC,OAAO;AAAA,EACP,kBAAkBD;AACpB,GAEME,IAAe;AAAA,EACnB,MAAMC;AAAA,EACN,SAASC;AAAA,EACT,SAASA;AAAA,EACT,OAAOC;AAAA,EACP,SAASC;AACX,GAEMC,IAAc,CAACC,GAAMC,MAAiBD,MAAS,YAAYC,IAAcD,GAEzEE,IAAwB,CAAC,EAAE,MAAAF,GAAM,QAAAG,GAAQ,MAAAC,QACzCA,MAAS,MAASA,MAAS,OACtB,KAELJ,MAAS,YACJ,CAAC,CAACG,IAEJ,CAAC,QAAQ,WAAW,WAAW,OAAO,EAAE,SAASH,CAAI,GAGxDK,IAAqB,CAAC,EAAE,MAAAL,GAAM,aAAAC,IAAc,QAAQ,QAAAE,GAAQ,MAAAC,QAAW;AAC3E,MAAIA;AACF,WAAOA;AAET,MAAI,CAACF,EAAsB,EAAE,MAAAF,GAAM,QAAAG,GAAQ,MAA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AA,QACA,gBAAAO;AAAA,QACA,mBAAAC;AAAA,QACA,QAAAC;AAAA,QACA,QAAAC;AAAA,QACA,gBAAAC;AAAA,MAAA;AAAA,IACF;AAGF,QAAI,OAAOiB,EAAMS,CAAW,KAAM,YAAY;AAC5C,YAAM,EAAE,SAAAE,EAAA,IAAYX,EAAMS,CAAW,EAAEC,CAAM;AAC7C,MAAAH,EAAI,QAAQI;AAAA,IACd;AACE,MAAA7B,EAAA,GACAyB,EAAI,QAAQ,MAAM;AAAA,MAAC;AAGrB,WAAOA;AAAA,EACT;AACF;"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsx as p, Fragment as x, jsxs as Q } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as y, useState as g, useEffect as j, useCallback as I, createRef as _, memo as F, forwardRef as b, useImperativeHandle as H } from "react";
|
|
3
|
+
import { Drawer as L } from "antd";
|
|
4
|
+
import { useMobilePopupMount as A, useScrollElement as T } from "@kne/responsive-utils";
|
|
5
|
+
import { lockParentScroll as q, computedDrawerProps as G, resolveDrawerGetContainer as N } from "./Drawer.js";
|
|
6
|
+
import U from "./usePatchElement.js";
|
|
7
|
+
const V = [".example-driver-device-scroll"], M = {
|
|
8
|
+
cover: "boundary",
|
|
9
|
+
exampleSelectors: V
|
|
10
|
+
}, W = (e) => {
|
|
11
|
+
if (e)
|
|
12
|
+
return typeof e == "function" ? (r) => e(r) || null : () => e;
|
|
13
|
+
}, E = { current: null };
|
|
14
|
+
let v = 0;
|
|
15
|
+
const X = b(({ config: e, afterClose: r }, n) => {
|
|
16
|
+
const [s, D] = g(!0), [a, P] = g(e), i = y(null), { getPopupContainer: o, anchorRef: f } = A({
|
|
17
|
+
...M,
|
|
18
|
+
getPopupContainer: W(a.getContainer)
|
|
19
|
+
}), c = () => {
|
|
20
|
+
D(!1);
|
|
21
|
+
};
|
|
22
|
+
H(n, () => ({
|
|
23
|
+
destroy: c,
|
|
24
|
+
update: (t) => {
|
|
25
|
+
P(
|
|
26
|
+
(w) => Object.assign({}, w, typeof t == "function" ? t(w) : t)
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}));
|
|
30
|
+
const { getContainer: m, afterClose: d, ...C } = a, u = G({
|
|
31
|
+
...C,
|
|
32
|
+
onClose: c,
|
|
33
|
+
afterClose: (...t) => {
|
|
34
|
+
r && r(...t), d && d(...t);
|
|
35
|
+
}
|
|
36
|
+
}), h = N({
|
|
37
|
+
customGetContainer: m,
|
|
38
|
+
getPopupContainer: o,
|
|
39
|
+
getHostNode: () => i.current
|
|
40
|
+
});
|
|
41
|
+
return /* @__PURE__ */ Q(x, { children: [
|
|
42
|
+
/* @__PURE__ */ p(
|
|
43
|
+
"span",
|
|
44
|
+
{
|
|
45
|
+
ref: (t) => {
|
|
46
|
+
i.current = t, f(t);
|
|
47
|
+
},
|
|
48
|
+
"aria-hidden": "true",
|
|
49
|
+
style: { position: "absolute", width: 0, height: 0, overflow: "hidden" }
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ p(L, { ...u, open: s, getContainer: h })
|
|
53
|
+
] });
|
|
54
|
+
}), $ = F(
|
|
55
|
+
b((e, r) => {
|
|
56
|
+
const [n, s] = U();
|
|
57
|
+
return H(r, () => ({ patchElement: s }), [s]), /* @__PURE__ */ p(x, { children: n });
|
|
58
|
+
})
|
|
59
|
+
), z = () => {
|
|
60
|
+
const e = y(null), [r, n] = g([]), { resolveMount: s, getPopupContainer: D } = A(M), a = T();
|
|
61
|
+
return j(() => {
|
|
62
|
+
r.length && ([...r].forEach((o) => o()), n([]));
|
|
63
|
+
}, [r]), [I(
|
|
64
|
+
(i) => {
|
|
65
|
+
var C;
|
|
66
|
+
v += 1;
|
|
67
|
+
const o = _(), f = {};
|
|
68
|
+
let c, m = () => {
|
|
69
|
+
};
|
|
70
|
+
const d = () => {
|
|
71
|
+
var R;
|
|
72
|
+
const l = typeof document < "u" ? document.activeElement : null, { isMobile: u, fixedModeClass: h } = s(l);
|
|
73
|
+
m = q(a);
|
|
74
|
+
const {
|
|
75
|
+
afterClose: t,
|
|
76
|
+
getContainer: w,
|
|
77
|
+
...S
|
|
78
|
+
} = i, O = /* @__PURE__ */ p(
|
|
79
|
+
X,
|
|
80
|
+
{
|
|
81
|
+
ref: o,
|
|
82
|
+
config: {
|
|
83
|
+
...S,
|
|
84
|
+
isMobile: u,
|
|
85
|
+
fixedModeClass: h,
|
|
86
|
+
getContainer: w,
|
|
87
|
+
onClose: () => f.close(),
|
|
88
|
+
afterClose: (...k) => {
|
|
89
|
+
m(), t && t(...k);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
afterClose: () => {
|
|
93
|
+
c && c();
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
`react-drawer-${v}`
|
|
97
|
+
);
|
|
98
|
+
c = (R = e.current) == null ? void 0 : R.patchElement(O);
|
|
99
|
+
};
|
|
100
|
+
return (C = e.current) != null && C.patchElement ? d() : n((l) => [...l, d]), f.close = () => {
|
|
101
|
+
o.current ? o.current.destroy() : n((l) => [...l, () => {
|
|
102
|
+
var u;
|
|
103
|
+
return (u = o.current) == null ? void 0 : u.destroy();
|
|
104
|
+
}]);
|
|
105
|
+
}, f;
|
|
106
|
+
},
|
|
107
|
+
[a, s]
|
|
108
|
+
), /* @__PURE__ */ p($, { ref: e }, "drawer-elements-holder")];
|
|
109
|
+
}, re = () => {
|
|
110
|
+
const [e, r] = z();
|
|
111
|
+
return E.current = e, r;
|
|
112
|
+
}, te = () => {
|
|
113
|
+
if (!E.current)
|
|
114
|
+
throw new Error(
|
|
115
|
+
"useDrawer requires <DrawerContextHolder /> mounted inside <App> before calling useDrawer()"
|
|
116
|
+
);
|
|
117
|
+
return E.current;
|
|
118
|
+
};
|
|
119
|
+
export {
|
|
120
|
+
re as DrawerContextHolder,
|
|
121
|
+
te as useDrawer
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=useDrawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDrawer.js","sources":["../../../src/components/ReactModal/useDrawer.jsx"],"sourcesContent":["// @ts-nocheck\n// Ported from https://github.com/kne-union/react-modal/blob/master/src/useDrawer.js\nimport {\n createRef,\n forwardRef,\n memo,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport { Drawer as AntdDrawer } from 'antd';\nimport { useMobilePopupMount, useScrollElement } from '@kne/responsive-utils';\nimport { computedDrawerProps, lockParentScroll, resolveDrawerGetContainer } from './Drawer';\nimport usePatchElement from './usePatchElement';\n\nconst VIEWPORT_EXAMPLE_SELECTORS = ['.example-driver-device-scroll'];\n\nconst boundaryPopupMountOptions = {\n cover: 'boundary',\n exampleSelectors: VIEWPORT_EXAMPLE_SELECTORS,\n};\n\nconst wrapCustomGetContainer = (customGetContainer) => {\n if (!customGetContainer) {\n return undefined;\n }\n if (typeof customGetContainer === 'function') {\n return (triggerNode) => customGetContainer(triggerNode) || null;\n }\n return () => customGetContainer;\n};\n\nconst drawerApiRef = { current: null };\n\nlet hookDrawerUuid = 0;\n\nconst HookDrawer = forwardRef(({ config, afterClose: hookAfterClose }, ref) => {\n const [open, setOpen] = useState(true);\n const [innerConfig, setInnerConfig] = useState(config);\n const hostRef = useRef(null);\n const { getPopupContainer, anchorRef } = useMobilePopupMount({\n ...boundaryPopupMountOptions,\n getPopupContainer: wrapCustomGetContainer(innerConfig.getContainer),\n });\n\n const close = () => {\n setOpen(false);\n };\n\n useImperativeHandle(ref, () => ({\n destroy: close,\n update: (newConfig) => {\n setInnerConfig((origin) =>\n Object.assign({}, origin, typeof newConfig === 'function' ? newConfig(origin) : newConfig),\n );\n },\n }));\n\n const { getContainer, afterClose: userAfterClose, ...restConfig } = innerConfig;\n const mergedAfterClose = (...args) => {\n hookAfterClose && hookAfterClose(...args);\n userAfterClose && userAfterClose(...args);\n };\n\n const drawerProps = computedDrawerProps({\n ...restConfig,\n onClose: close,\n afterClose: mergedAfterClose,\n });\n\n const getDrawerContainer = resolveDrawerGetContainer({\n customGetContainer: getContainer,\n getPopupContainer,\n getHostNode: () => hostRef.current,\n });\n\n return (\n <>\n <span\n ref={(node) => {\n hostRef.current = node;\n anchorRef(node);\n }}\n aria-hidden=\"true\"\n style={{ position: 'absolute', width: 0, height: 0, overflow: 'hidden' }}\n />\n <AntdDrawer {...drawerProps} open={open} getContainer={getDrawerContainer} />\n </>\n );\n});\n\nconst ElementsHolder = memo(\n forwardRef((_props, ref) => {\n const [elements, patchElement] = usePatchElement();\n useImperativeHandle(ref, () => ({ patchElement }), [patchElement]);\n return <>{elements}</>;\n }),\n);\n\nconst useDrawerHolder = () => {\n const holderRef = useRef(null);\n const [actionQueue, setActionQueue] = useState([]);\n const { resolveMount, getPopupContainer } = useMobilePopupMount(boundaryPopupMountOptions);\n const getScrollElement = useScrollElement();\n\n useEffect(() => {\n if (actionQueue.length) {\n const cloneQueue = [...actionQueue];\n cloneQueue.forEach((action) => action());\n setActionQueue([]);\n }\n }, [actionQueue]);\n\n const drawer = useCallback(\n (props) => {\n hookDrawerUuid += 1;\n const drawerRef = createRef();\n const api = {};\n let closeFunc;\n let unlock = () => {};\n\n const runOpen = () => {\n const anchor = typeof document !== 'undefined' ? document.activeElement : null;\n const { isMobile, fixedModeClass } = resolveMount(anchor);\n unlock = lockParentScroll(getScrollElement);\n const {\n afterClose: userAfterClose,\n getContainer: customGetContainer,\n ...restProps\n } = props;\n\n const drawerEl = (\n <HookDrawer\n key={`react-drawer-${hookDrawerUuid}`}\n ref={drawerRef}\n config={{\n ...restProps,\n isMobile,\n fixedModeClass,\n getContainer: customGetContainer,\n onClose: () => api.close(),\n afterClose: (...args) => {\n unlock();\n userAfterClose && userAfterClose(...args);\n },\n }}\n afterClose={() => {\n closeFunc && closeFunc();\n }}\n />\n );\n\n closeFunc = holderRef.current?.patchElement(drawerEl);\n };\n\n if (holderRef.current?.patchElement) {\n runOpen();\n } else {\n setActionQueue((prev) => [...prev, runOpen]);\n }\n\n api.close = () => {\n if (drawerRef.current) {\n drawerRef.current.destroy();\n } else {\n setActionQueue((prev) => [...prev, () => drawerRef.current?.destroy()]);\n }\n };\n\n return api;\n },\n [getScrollElement, resolveMount],\n );\n\n return [drawer, <ElementsHolder key=\"drawer-elements-holder\" ref={holderRef} />];\n};\n\nexport const DrawerContextHolder = () => {\n const [drawer, contextHolder] = useDrawerHolder();\n drawerApiRef.current = drawer;\n return contextHolder;\n};\n\nexport const useDrawer = () => {\n if (!drawerApiRef.current) {\n throw new Error(\n 'useDrawer requires <DrawerContextHolder /> mounted inside <App> before calling useDrawer()',\n );\n }\n return drawerApiRef.current;\n};\n\nexport default useDrawer;\n"],"names":["VIEWPORT_EXAMPLE_SELECTORS","boundaryPopupMountOptions","wrapCustomGetContainer","customGetContainer","triggerNode","drawerApiRef","hookDrawerUuid","HookDrawer","forwardRef","config","hookAfterClose","ref","open","setOpen","useState","innerConfig","setInnerConfig","hostRef","useRef","getPopupContainer","anchorRef","useMobilePopupMount","close","useImperativeHandle","newConfig","origin","getContainer","userAfterClose","restConfig","drawerProps","computedDrawerProps","args","getDrawerContainer","resolveDrawerGetContainer","jsxs","Fragment","jsx","node","AntdDrawer","ElementsHolder","memo","_props","elements","patchElement","usePatchElement","useDrawerHolder","holderRef","actionQueue","setActionQueue","resolveMount","getScrollElement","useScrollElement","useEffect","action","useCallback","props","drawerRef","createRef","api","closeFunc","unlock","runOpen","anchor","isMobile","fixedModeClass","lockParentScroll","restProps","drawerEl","_a","prev","DrawerContextHolder","drawer","contextHolder","useDrawer"],"mappings":";;;;;;AAiBA,MAAMA,IAA6B,CAAC,+BAA+B,GAE7DC,IAA4B;AAAA,EAChC,OAAO;AAAA,EACP,kBAAkBD;AACpB,GAEME,IAAyB,CAACC,MAAuB;AACrD,MAAKA;AAGL,WAAI,OAAOA,KAAuB,aACzB,CAACC,MAAgBD,EAAmBC,CAAW,KAAK,OAEtD,MAAMD;AACf,GAEME,IAAe,EAAE,SAAS,KAAA;AAEhC,IA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
+
const u = () => {
|
|
3
|
+
const [n, e] = l([]), r = c((s) => (e((t) => [...t, s]), () => {
|
|
4
|
+
e((t) => t.filter((a) => a !== s));
|
|
5
|
+
}), []);
|
|
6
|
+
return [n, r];
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
u as default
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=usePatchElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePatchElement.js","sources":["../../../src/components/ReactModal/usePatchElement.js"],"sourcesContent":["// @ts-nocheck\n// Ported from https://github.com/kne-union/react-modal/blob/master/src/usePatchElement.js\nimport { useCallback, useState } from 'react';\n\nconst usePatchElement = () => {\n const [elements, setElements] = useState([]);\n const patchElement = useCallback((element) => {\n setElements((originElements) => [...originElements, element]);\n return () => {\n setElements((originElements) => originElements.filter((ele) => ele !== element));\n };\n }, []);\n return [elements, patchElement];\n};\n\nexport default usePatchElement;\n"],"names":["usePatchElement","elements","setElements","useState","patchElement","useCallback","element","originElements","ele"],"mappings":";AAIK,MAACA,IAAkB,MAAM;AAC5B,QAAM,CAACC,GAAUC,CAAW,IAAIC,EAAS,CAAA,CAAE,GACrCC,IAAeC,EAAY,CAACC,OAChCJ,EAAY,CAACK,MAAmB,CAAC,GAAGA,GAAgBD,CAAO,CAAC,GACrD,MAAM;AACX,IAAAJ,EAAY,CAACK,MAAmBA,EAAe,OAAO,CAACC,MAAQA,MAAQF,CAAO,CAAC;AAAA,EACjF,IACC,CAAA,CAAE;AACL,SAAO,CAACL,GAAUG,CAAY;AAChC;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withLocale.js","sources":["../../../src/components/ReactModal/withLocale.js"],"sourcesContent":["// @ts-nocheck\n// Ported from https://github.com/kne-union/react-modal/blob/master/src/withLocale.js\n// 改写:使用本地 intlStub,不依赖 @kne/react-intl\nimport { createWithIntlProvider } from './intlStub';\nimport zhCN from './locale/zh-CN';\nimport enUS from './locale/en-US';\n\nconst withLocale = createWithIntlProvider({\n defaultLocale: 'zh-CN',\n messages: {\n 'zh-CN': zhCN,\n 'en-US': enUS,\n },\n namespace: 'react-modal',\n});\n\nexport default withLocale;\n"],"names":["withLocale","createWithIntlProvider"],"mappings":";AAOK,MAACA,IAAaC,EAOlB;"}
|
|
@@ -8,6 +8,11 @@ export interface VirtualScrollbarProps extends React.HTMLAttributes<HTMLDivEleme
|
|
|
8
8
|
autoHide?: boolean;
|
|
9
9
|
/** 外层容器 className */
|
|
10
10
|
wrapperClassName?: string;
|
|
11
|
+
/**
|
|
12
|
+
* 子树重渲染 / Modal 关窗 focus 回写等导致 scrollTop 被清零时,恢复上次滚动位置。
|
|
13
|
+
* 默认 true。
|
|
14
|
+
*/
|
|
15
|
+
preserveScroll?: boolean;
|
|
11
16
|
}
|
|
12
17
|
/** 覆盖式虚拟滚动条:隐藏原生滚动条,thumb 悬浮不占布局宽度 */
|
|
13
18
|
declare const VirtualScrollbar: React.ForwardRefExoticComponent<VirtualScrollbarProps & React.RefAttributes<HTMLDivElement>>;
|