@ccs-ui/rc-pro 1.0.7-rc.9 → 1.1.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/es/auth/auth-button.d.ts +1 -2
- package/es/auth/index.d.ts +11 -4
- package/es/cascader/index.d.ts +2 -3
- package/es/cascader/index.js +3 -2
- package/es/color-picker/index.d.ts +2 -2
- package/es/config.d.ts +1 -2
- package/es/config.js +5 -4
- package/es/context/index.d.ts +25 -12
- package/es/context/index.js +1 -6
- package/es/date-picker/index.d.ts +2 -3
- package/es/dialog/HookDrawer.d.ts +8 -0
- package/es/dialog/HookDrawer.js +106 -0
- package/es/dialog/HookModal.d.ts +8 -0
- package/es/dialog/HookModal.js +179 -0
- package/es/dialog/button.d.ts +10 -0
- package/es/dialog/button.js +47 -0
- package/es/dialog/context.d.ts +11 -0
- package/es/dialog/context.js +10 -0
- package/es/dialog/dialog.d.ts +41 -0
- package/es/dialog/dialog.js +167 -0
- package/es/dialog/form.d.ts +13 -0
- package/es/dialog/form.js +47 -0
- package/es/dialog/index.d.ts +11 -0
- package/es/dialog/index.js +9 -0
- package/es/dialog/index.less +28 -0
- package/es/dialog/usePatchElement.d.ts +5 -0
- package/es/dialog/usePatchElement.js +35 -0
- package/es/drawer/buttons.d.ts +2 -2
- package/es/drawer/index.d.ts +3 -0
- package/es/drawer/index.js +3 -0
- package/es/drawer/open/content.d.ts +3 -3
- package/es/drawer/open/form.d.ts +2 -2
- package/es/drawer/open/index.js +1 -6
- package/es/full-screen/index.d.ts +1 -2
- package/es/full-screen/index.js +29 -26
- package/es/hooks/use-tabs.d.ts +1 -1
- package/es/hooks/use-window.d.ts +4 -0
- package/es/hooks/use-window.js +5 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/interval-button/index.d.ts +1 -2
- package/es/interval-button/index.js +1 -1
- package/es/keep-alive-tabs/index.d.ts +1 -2
- package/es/keep-alive-tabs/page.d.ts +1 -1
- package/es/loading/index.d.ts +1 -2
- package/es/loading/index.js +25 -21
- package/es/modal/buttons.d.ts +2 -2
- package/es/modal/index.d.ts +3 -0
- package/es/modal/index.js +3 -0
- package/es/modal/open/drag.d.ts +1 -2
- package/es/modal/open/form.d.ts +2 -2
- package/es/pro-grid/index.d.ts +2 -2
- package/es/pro-table/index.d.ts +6 -2
- package/es/pro-table/index.js +75 -53
- package/es/pro-table/index.less +5 -14
- package/es/pro-table/search.d.ts +4 -3
- package/es/pro-table/search.js +221 -175
- package/es/pro-tabs/index.d.ts +1 -2
- package/es/pro-tabs/index.js +102 -31
- package/es/select/index.d.ts +2 -3
- package/es/select/index.js +3 -2
- package/es/status-tag/index.js +6 -5
- package/es/table/index.d.ts +1 -2
- package/es/time-picker/index.d.ts +2 -3
- package/es/trigger/index.d.ts +2 -2
- package/es/upload/index.d.ts +1 -2
- package/es/upload/upload-image.d.ts +1 -2
- package/es/utils/index.d.ts +7 -7
- package/es/utils/index.js +33 -27
- package/es/virtual-list/index.d.ts +2 -2
- package/es/water-mark/index.d.ts +1 -1
- package/package.json +4 -3
package/es/auth/auth-button.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ButtonProps } from 'antd';
|
|
2
|
-
import React from 'react';
|
|
3
2
|
type CcsAuthButtonProps = ButtonProps & {
|
|
4
3
|
auth: string;
|
|
5
4
|
text?: string;
|
|
@@ -10,5 +9,5 @@ type CcsAuthButtonProps = ButtonProps & {
|
|
|
10
9
|
* @param CcsAuthButtonProps
|
|
11
10
|
* @returns
|
|
12
11
|
*/
|
|
13
|
-
declare const _default: ({ auth, text, confirm, onClick, ...restProps }: CcsAuthButtonProps) =>
|
|
12
|
+
declare const _default: ({ auth, text, confirm, onClick, ...restProps }: CcsAuthButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
13
|
export default _default;
|
package/es/auth/index.d.ts
CHANGED
|
@@ -34,16 +34,23 @@ export interface CcsAuthProps {
|
|
|
34
34
|
}
|
|
35
35
|
export declare function ModalConfirm({ modalRef }: {
|
|
36
36
|
modalRef: any;
|
|
37
|
-
}):
|
|
37
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
38
38
|
declare function CcsAuth({ auth, children }: CcsAuthProps): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
|
|
39
39
|
declare namespace CcsAuth {
|
|
40
40
|
var Group: typeof AuthGroup;
|
|
41
|
-
var Button: ({ auth, text, confirm, onClick, ...restProps }:
|
|
41
|
+
var Button: ({ auth, text, confirm, onClick, ...restProps }: Partial<{
|
|
42
|
+
href: string;
|
|
43
|
+
target?: React.HTMLAttributeAnchorTarget | undefined;
|
|
44
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
45
|
+
} & import("antd/es/button/button").BaseButtonProps & Omit<React.AnchorHTMLAttributes<HTMLButtonElement | HTMLAnchorElement>, "onClick" | "type"> & {
|
|
46
|
+
htmlType?: "button" | "reset" | "submit" | undefined;
|
|
47
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
48
|
+
} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onClick" | "type">> & {
|
|
42
49
|
auth: string;
|
|
43
50
|
text?: string | undefined;
|
|
44
51
|
confirm?: string | undefined;
|
|
45
|
-
}) =>
|
|
52
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
46
53
|
var Dropdown: ({ auth, menus, children, onClick, ...restProps }: import("./auth-dropdown").CcsAuthDropdownProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
47
54
|
}
|
|
48
|
-
declare function AuthGroup({ size, isLink, showCount, moreIcon, moreText, items, onClick, }: CcsAuthGroupProps):
|
|
55
|
+
declare function AuthGroup({ size, isLink, showCount, moreIcon, moreText, items, onClick, }: CcsAuthGroupProps): import("react/jsx-runtime").JSX.Element | null;
|
|
49
56
|
export default CcsAuth;
|
package/es/cascader/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CascaderProps } from 'antd';
|
|
2
|
-
import React from 'react';
|
|
3
2
|
import { HttpResult, RecordType } from '..';
|
|
4
3
|
type CacheType = {
|
|
5
4
|
/** 缓存key,同一个key将共享数据 */
|
|
@@ -14,12 +13,12 @@ type ApiCascaderProps = CascaderProps & {
|
|
|
14
13
|
/** 依赖参数 */
|
|
15
14
|
defaultParams?: RecordType;
|
|
16
15
|
/** 查询请求 */
|
|
17
|
-
onQuery?: (
|
|
16
|
+
onQuery?: (params?: any) => Promise<HttpResult<any[]>>;
|
|
18
17
|
};
|
|
19
18
|
/**
|
|
20
19
|
* 基于接口查询的select组件
|
|
21
20
|
* @param CcsSelectProps
|
|
22
21
|
* @returns
|
|
23
22
|
*/
|
|
24
|
-
export default function CcsApiCascader({ onQuery, cache, defaultParams, ...restProps }: ApiCascaderProps):
|
|
23
|
+
export default function CcsApiCascader({ onQuery, cache, defaultParams, ...restProps }: ApiCascaderProps): import("react/jsx-runtime").JSX.Element;
|
|
25
24
|
export {};
|
package/es/cascader/index.js
CHANGED
|
@@ -23,7 +23,8 @@ import React, { useEffect } from 'react';
|
|
|
23
23
|
export default function CcsApiCascader(_ref) {
|
|
24
24
|
var onQuery = _ref.onQuery,
|
|
25
25
|
cache = _ref.cache,
|
|
26
|
-
defaultParams = _ref.defaultParams,
|
|
26
|
+
_ref$defaultParams = _ref.defaultParams,
|
|
27
|
+
defaultParams = _ref$defaultParams === void 0 ? {} : _ref$defaultParams,
|
|
27
28
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
28
29
|
var _useRequest = useRequest( /*#__PURE__*/function () {
|
|
29
30
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
@@ -60,7 +61,7 @@ export default function CcsApiCascader(_ref) {
|
|
|
60
61
|
run = _useRequest.run;
|
|
61
62
|
useEffect(function () {
|
|
62
63
|
if (onQuery) run(defaultParams);
|
|
63
|
-
}, [defaultParams]);
|
|
64
|
+
}, [JSON.stringify(defaultParams)]);
|
|
64
65
|
return /*#__PURE__*/React.createElement(Cascader, _extends({
|
|
65
66
|
options: data,
|
|
66
67
|
loading: loading,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
2
|
import { RGBColor } from 'react-color';
|
|
3
3
|
import './index.less';
|
|
4
4
|
export interface PropsType {
|
|
@@ -14,5 +14,5 @@ export interface PropsType {
|
|
|
14
14
|
/**
|
|
15
15
|
* 颜色选择组件
|
|
16
16
|
*/
|
|
17
|
-
declare const ColorPicker: ({ onChange, value, style }: PropsType) =>
|
|
17
|
+
declare const ColorPicker: ({ onChange, value, style }: PropsType) => import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
export default ColorPicker;
|
package/es/config.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { GlobalContextPropsType } from './context';
|
|
3
|
-
declare const _default: ({ userDetail, children }: GlobalContextPropsType) =>
|
|
2
|
+
declare const _default: ({ userDetail, children }: GlobalContextPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
4
3
|
export default _default;
|
package/es/config.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { GlobalContext } from "./context";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
export default (function (_ref) {
|
|
4
4
|
var userDetail = _ref.userDetail,
|
|
5
5
|
children = _ref.children;
|
|
6
|
-
return /*#__PURE__*/
|
|
6
|
+
return /*#__PURE__*/_jsx(GlobalContext.Provider, {
|
|
7
7
|
value: {
|
|
8
8
|
userDetail: userDetail
|
|
9
|
-
}
|
|
10
|
-
|
|
9
|
+
},
|
|
10
|
+
children: children
|
|
11
|
+
});
|
|
11
12
|
});
|
package/es/context/index.d.ts
CHANGED
|
@@ -1,20 +1,33 @@
|
|
|
1
|
+
import { TabPaneProps } from 'antd';
|
|
1
2
|
import { Store } from 'antd/es/form/interface';
|
|
2
3
|
import { Location } from 'history';
|
|
3
|
-
import { Tab } from 'rc-tabs/lib/interface';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { CcsUserDetailType } from '..';
|
|
6
|
-
|
|
5
|
+
import { CcsUserDetailType, RecordType } from '..';
|
|
6
|
+
type CcsTabsChangeProps = {
|
|
7
|
+
/** 当前激活tab面板的key */
|
|
8
|
+
activeKey?: string;
|
|
9
|
+
/** 启用tab keys */
|
|
10
|
+
enableKeys?: string[];
|
|
11
|
+
/** 禁用tab keys */
|
|
12
|
+
disableKeys?: string[];
|
|
13
|
+
/** tab间传递的参数 */
|
|
14
|
+
options?: RecordType;
|
|
15
|
+
};
|
|
16
|
+
export type CcsTabProps = Omit<TabPaneProps, 'tab'> & {
|
|
17
|
+
key: string;
|
|
18
|
+
label: React.ReactNode;
|
|
19
|
+
};
|
|
20
|
+
interface CcsTabsContextType {
|
|
7
21
|
/** 当前激活tab面板的key */
|
|
8
22
|
activeKey: string;
|
|
9
|
-
/** Tabs items */
|
|
10
|
-
items: Tab[];
|
|
11
23
|
/** tab间传递的参数 */
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
24
|
+
options: RecordType;
|
|
25
|
+
/** 添加tab */
|
|
26
|
+
onAddTabs: (tab: CcsTabProps | CcsTabProps[]) => void;
|
|
27
|
+
/** 移除tab */
|
|
28
|
+
onRemoveTabs: (key: string | string[]) => void;
|
|
16
29
|
/** 改变tab间传递的参数 */
|
|
17
|
-
|
|
30
|
+
onTabChange: (tab: CcsTabsChangeProps) => void;
|
|
18
31
|
}
|
|
19
32
|
type PageContextType = {
|
|
20
33
|
/** ID */
|
|
@@ -41,6 +54,6 @@ interface FnContextType<T = Store> {
|
|
|
41
54
|
declare const GlobalContext: React.Context<GlobalContextType>;
|
|
42
55
|
declare const DrawerAndModalContext: React.Context<FnContextType<any>>;
|
|
43
56
|
declare const PageContext: React.Context<PageContextType>;
|
|
44
|
-
declare const TabsContext: React.Context<
|
|
45
|
-
export type {
|
|
57
|
+
declare const TabsContext: React.Context<CcsTabsContextType>;
|
|
58
|
+
export type { FnContextType, CcsTabsContextType, CcsTabsChangeProps, GlobalContextPropsType, };
|
|
46
59
|
export { TabsContext, PageContext, GlobalContext, DrawerAndModalContext };
|
package/es/context/index.js
CHANGED
|
@@ -2,10 +2,5 @@ import React, { createContext } from 'react';
|
|
|
2
2
|
var GlobalContext = /*#__PURE__*/createContext({});
|
|
3
3
|
var DrawerAndModalContext = /*#__PURE__*/createContext({});
|
|
4
4
|
var PageContext = /*#__PURE__*/createContext({});
|
|
5
|
-
var TabsContext = /*#__PURE__*/React.createContext({
|
|
6
|
-
items: [],
|
|
7
|
-
activeKey: '',
|
|
8
|
-
option: {},
|
|
9
|
-
onChange: function onChange() {}
|
|
10
|
-
});
|
|
5
|
+
var TabsContext = /*#__PURE__*/React.createContext({});
|
|
11
6
|
export { TabsContext, PageContext, GlobalContext, DrawerAndModalContext };
|
|
@@ -2,7 +2,6 @@ import { DatePickerProps } from 'antd';
|
|
|
2
2
|
import { PickerPanelDateProps } from 'antd/es/calendar/generateCalendar';
|
|
3
3
|
import { RangePickerProps } from 'antd/es/date-picker';
|
|
4
4
|
import { Dayjs } from 'dayjs';
|
|
5
|
-
import React from 'react';
|
|
6
5
|
type CcsDatePickerProps = {
|
|
7
6
|
value?: string;
|
|
8
7
|
picker?: 'year' | 'month' | 'date';
|
|
@@ -14,8 +13,8 @@ type CcsRangePickerProps = {
|
|
|
14
13
|
picker?: 'year' | 'month' | 'date';
|
|
15
14
|
onChange?: (e: [string, string]) => void;
|
|
16
15
|
} & Omit<RangePickerProps, 'value' | 'onChange'>;
|
|
17
|
-
declare function CcsDatePicker({ value, onChange, ...restProps }: CcsDatePickerProps):
|
|
16
|
+
declare function CcsDatePicker({ value, onChange, ...restProps }: CcsDatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
18
17
|
declare namespace CcsDatePicker {
|
|
19
|
-
var RangePicker: ({ value, onChange, ...restProps }: CcsRangePickerProps) =>
|
|
18
|
+
var RangePicker: ({ value, onChange, ...restProps }: CcsRangePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
19
|
}
|
|
21
20
|
export default CcsDatePicker;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CcsDialogDrawer, CcsDialogDrawerProps } from './dialog';
|
|
3
|
+
export interface HookDrawerProps {
|
|
4
|
+
afterClose: () => void;
|
|
5
|
+
config: CcsDialogDrawerProps;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: import("react").ForwardRefExoticComponent<HookDrawerProps & import("react").RefAttributes<CcsDialogDrawer>>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { Drawer } from 'antd';
|
|
14
|
+
import classNames from 'classnames';
|
|
15
|
+
import { forwardRef, useImperativeHandle, useState } from 'react';
|
|
16
|
+
import { ModalContentContext } from "./context";
|
|
17
|
+
import DialogForm from "./form";
|
|
18
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
var HookDrawer = function HookDrawer(_ref, ref) {
|
|
20
|
+
var _config$form;
|
|
21
|
+
var hookAfterClose = _ref.afterClose,
|
|
22
|
+
config = _ref.config;
|
|
23
|
+
var _useState = useState(function () {
|
|
24
|
+
if (config.open === undefined) {
|
|
25
|
+
return _objectSpread(_objectSpread({}, config), {}, {
|
|
26
|
+
open: true
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return config;
|
|
30
|
+
}),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
innerConfig = _useState2[0],
|
|
33
|
+
setInnerConfig = _useState2[1];
|
|
34
|
+
var _useState3 = useState(false),
|
|
35
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
36
|
+
hasButtons = _useState4[0],
|
|
37
|
+
setHasButtons = _useState4[1];
|
|
38
|
+
var afterClose = function afterClose() {
|
|
39
|
+
hookAfterClose();
|
|
40
|
+
};
|
|
41
|
+
var close = function close() {
|
|
42
|
+
setInnerConfig(function (c) {
|
|
43
|
+
return _objectSpread(_objectSpread({}, c), {}, {
|
|
44
|
+
open: false
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
useImperativeHandle(ref, function () {
|
|
49
|
+
return {
|
|
50
|
+
destroy: close,
|
|
51
|
+
update: function update(newConfig) {
|
|
52
|
+
setInnerConfig(function (originConfig) {
|
|
53
|
+
return _objectSpread(_objectSpread({}, originConfig), newConfig);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
var onGetContainer = function onGetContainer() {
|
|
59
|
+
var doms = document.body.querySelectorAll("[id*=\"_tab_content_\"][data-display=\"true\"]");
|
|
60
|
+
if (doms.length > 0) {
|
|
61
|
+
return doms[0];
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
64
|
+
};
|
|
65
|
+
var isCrInProp = ('getContainer' in innerConfig);
|
|
66
|
+
return /*#__PURE__*/_jsx(Drawer, _objectSpread(_objectSpread({
|
|
67
|
+
onClose: close,
|
|
68
|
+
afterOpenChange: function afterOpenChange(open) {
|
|
69
|
+
if (!open) afterClose();
|
|
70
|
+
}
|
|
71
|
+
}, innerConfig), {}, {
|
|
72
|
+
className: classNames('ccs-dialog-drawer', innerConfig.className),
|
|
73
|
+
maskStyle: _objectSpread({
|
|
74
|
+
background: 'rgba(0, 0, 0, 0.1)'
|
|
75
|
+
}, innerConfig.maskStyle),
|
|
76
|
+
bodyStyle: _objectSpread(_objectSpread({}, hasButtons ? {
|
|
77
|
+
marginBottom: 80
|
|
78
|
+
} : {}), config.form ? {
|
|
79
|
+
padding: 0
|
|
80
|
+
} : innerConfig.bodyStyle),
|
|
81
|
+
rootStyle: _objectSpread(_objectSpread({}, !isCrInProp ? {
|
|
82
|
+
position: 'absolute'
|
|
83
|
+
} : {}), innerConfig.rootStyle),
|
|
84
|
+
contentWrapperStyle: _objectSpread(_objectSpread({}, !isCrInProp ? {
|
|
85
|
+
boxShadow: 'none'
|
|
86
|
+
} : {}), innerConfig.contentWrapperStyle),
|
|
87
|
+
getContainer: isCrInProp ? innerConfig.getContainer : onGetContainer,
|
|
88
|
+
children: /*#__PURE__*/_jsx(ModalContentContext.Provider, {
|
|
89
|
+
value: {
|
|
90
|
+
closeDialog: close,
|
|
91
|
+
onHasButtons: function onHasButtons() {
|
|
92
|
+
return setHasButtons(true);
|
|
93
|
+
},
|
|
94
|
+
formInitialValues: ((_config$form = config.form) === null || _config$form === void 0 ? void 0 : _config$form.initialValues) || {}
|
|
95
|
+
},
|
|
96
|
+
children: config.form ? /*#__PURE__*/_jsx(DialogForm, {
|
|
97
|
+
formProps: config.form,
|
|
98
|
+
bodyStyle: _objectSpread({
|
|
99
|
+
padding: 24
|
|
100
|
+
}, innerConfig.bodyStyle),
|
|
101
|
+
children: config.content
|
|
102
|
+
}) : config.content
|
|
103
|
+
})
|
|
104
|
+
}));
|
|
105
|
+
};
|
|
106
|
+
export default /*#__PURE__*/forwardRef(HookDrawer);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CcsDialogModal, CcsDialogModalProps } from './dialog';
|
|
3
|
+
export interface HookModalProps {
|
|
4
|
+
afterClose: () => void;
|
|
5
|
+
config: CcsDialogModalProps;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: import("react").ForwardRefExoticComponent<HookModalProps & import("react").RefAttributes<CcsDialogModal>>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
10
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
16
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
17
|
+
import { Modal } from 'antd';
|
|
18
|
+
import classNames from 'classnames';
|
|
19
|
+
import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
|
20
|
+
import Draggable from 'react-draggable';
|
|
21
|
+
import { ModalContentContext } from "./context";
|
|
22
|
+
import DialogForm from "./form";
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
var DragModal = function DragModal(_ref) {
|
|
25
|
+
var modal = _ref.modal,
|
|
26
|
+
dragState = _ref.dragState,
|
|
27
|
+
onDragState = _ref.onDragState;
|
|
28
|
+
var draggleRef = useRef(null);
|
|
29
|
+
var _onStart = function onStart(event, uiData) {
|
|
30
|
+
var _draggleRef$current;
|
|
31
|
+
var _window$document$docu = window.document.documentElement,
|
|
32
|
+
clientWidth = _window$document$docu.clientWidth,
|
|
33
|
+
clientHeight = _window$document$docu.clientHeight;
|
|
34
|
+
var targetRect = (_draggleRef$current = draggleRef.current) === null || _draggleRef$current === void 0 ? void 0 : _draggleRef$current.getBoundingClientRect();
|
|
35
|
+
if (!targetRect) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
onDragState(function (e) {
|
|
39
|
+
return _objectSpread(_objectSpread({}, e), {}, {
|
|
40
|
+
bounds: {
|
|
41
|
+
left: -targetRect.left + uiData.x,
|
|
42
|
+
right: clientWidth - (targetRect.right - uiData.x),
|
|
43
|
+
top: -targetRect.top + uiData.y,
|
|
44
|
+
bottom: clientHeight - (targetRect.bottom - uiData.y)
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
return /*#__PURE__*/_jsx(Draggable, {
|
|
50
|
+
disabled: dragState.disabled,
|
|
51
|
+
bounds: dragState.bounds,
|
|
52
|
+
onStart: function onStart(event, uiData) {
|
|
53
|
+
return _onStart(event, uiData);
|
|
54
|
+
},
|
|
55
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
56
|
+
ref: draggleRef,
|
|
57
|
+
children: modal
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
var HookModal = function HookModal(_ref2, ref) {
|
|
62
|
+
var _config$form;
|
|
63
|
+
var hookAfterClose = _ref2.afterClose,
|
|
64
|
+
config = _ref2.config;
|
|
65
|
+
var _useState = useState(function () {
|
|
66
|
+
if (config.open === undefined) {
|
|
67
|
+
return _objectSpread(_objectSpread({}, config), {}, {
|
|
68
|
+
open: true
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return config;
|
|
72
|
+
}),
|
|
73
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
74
|
+
innerConfig = _useState2[0],
|
|
75
|
+
setInnerConfig = _useState2[1];
|
|
76
|
+
var _useState3 = useState({
|
|
77
|
+
disabled: true,
|
|
78
|
+
bounds: {
|
|
79
|
+
left: 0,
|
|
80
|
+
top: 0,
|
|
81
|
+
bottom: 0,
|
|
82
|
+
right: 0
|
|
83
|
+
}
|
|
84
|
+
}),
|
|
85
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
86
|
+
dragState = _useState4[0],
|
|
87
|
+
setDragState = _useState4[1];
|
|
88
|
+
var _useState5 = useState(false),
|
|
89
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
90
|
+
hasButtons = _useState6[0],
|
|
91
|
+
setHasButtons = _useState6[1];
|
|
92
|
+
var afterClose = function afterClose() {
|
|
93
|
+
var _innerConfig$afterClo;
|
|
94
|
+
if (config.destroyOnClose !== false) hookAfterClose();
|
|
95
|
+
(_innerConfig$afterClo = innerConfig.afterClose) === null || _innerConfig$afterClo === void 0 ? void 0 : _innerConfig$afterClo.call(innerConfig);
|
|
96
|
+
};
|
|
97
|
+
var close = function close() {
|
|
98
|
+
setInnerConfig(function (c) {
|
|
99
|
+
return _objectSpread(_objectSpread({}, c), {}, {
|
|
100
|
+
open: false
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
104
|
+
args[_key] = arguments[_key];
|
|
105
|
+
}
|
|
106
|
+
var triggerCancel = args.some(function (param) {
|
|
107
|
+
return param && param.triggerCancel;
|
|
108
|
+
});
|
|
109
|
+
if (innerConfig.onCancel && triggerCancel) {
|
|
110
|
+
innerConfig.onCancel.apply(innerConfig, [function () {}].concat(_toConsumableArray(args.slice(1))));
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
useImperativeHandle(ref, function () {
|
|
114
|
+
return {
|
|
115
|
+
destroy: close,
|
|
116
|
+
update: function update(newConfig) {
|
|
117
|
+
setInnerConfig(function (originConfig) {
|
|
118
|
+
return _objectSpread(_objectSpread({}, originConfig), newConfig);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
return /*#__PURE__*/_jsx(Modal, _objectSpread(_objectSpread({
|
|
124
|
+
onCancel: close,
|
|
125
|
+
afterClose: afterClose
|
|
126
|
+
}, innerConfig), {}, {
|
|
127
|
+
bodyStyle: _objectSpread(_objectSpread({
|
|
128
|
+
position: 'relative'
|
|
129
|
+
}, innerConfig.bodyStyle), hasButtons ? {
|
|
130
|
+
paddingBottom: 44
|
|
131
|
+
} : {}),
|
|
132
|
+
className: classNames('ccs-dialog-modal', innerConfig.className),
|
|
133
|
+
footer: null,
|
|
134
|
+
title: config.isDrag ? /*#__PURE__*/_jsx("div", {
|
|
135
|
+
style: {
|
|
136
|
+
width: '100%',
|
|
137
|
+
cursor: 'move'
|
|
138
|
+
},
|
|
139
|
+
onMouseOver: function onMouseOver() {
|
|
140
|
+
if (dragState.disabled) {
|
|
141
|
+
setDragState(function (e) {
|
|
142
|
+
return _objectSpread(_objectSpread({}, e), {}, {
|
|
143
|
+
disabled: false
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
onMouseOut: function onMouseOut() {
|
|
149
|
+
setDragState(function (e) {
|
|
150
|
+
return _objectSpread(_objectSpread({}, e), {}, {
|
|
151
|
+
disabled: true
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
children: config.title
|
|
156
|
+
}) : config.title,
|
|
157
|
+
modalRender: config.isDrag ? function (modal) {
|
|
158
|
+
return /*#__PURE__*/_jsx(DragModal, {
|
|
159
|
+
modal: modal,
|
|
160
|
+
dragState: dragState,
|
|
161
|
+
onDragState: setDragState
|
|
162
|
+
});
|
|
163
|
+
} : undefined,
|
|
164
|
+
children: /*#__PURE__*/_jsx(ModalContentContext.Provider, {
|
|
165
|
+
value: {
|
|
166
|
+
closeDialog: close,
|
|
167
|
+
onHasButtons: function onHasButtons() {
|
|
168
|
+
return setHasButtons(true);
|
|
169
|
+
},
|
|
170
|
+
formInitialValues: ((_config$form = config.form) === null || _config$form === void 0 ? void 0 : _config$form.initialValues) || {}
|
|
171
|
+
},
|
|
172
|
+
children: config.form ? /*#__PURE__*/_jsx(DialogForm, {
|
|
173
|
+
formProps: config.form,
|
|
174
|
+
children: config.content
|
|
175
|
+
}) : config.content
|
|
176
|
+
})
|
|
177
|
+
}));
|
|
178
|
+
};
|
|
179
|
+
export default /*#__PURE__*/forwardRef(HookModal);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface DialogButtonsProps {
|
|
3
|
+
okText?: string;
|
|
4
|
+
okAuth?: string;
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
onOk?: (values?: any) => void;
|
|
8
|
+
}
|
|
9
|
+
export default function CcsDialogButtons({ okText, okAuth, loading, children, onOk, }: DialogButtonsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
import { CcsAuth } from "./..";
|
|
8
|
+
import { Button, Form } from 'antd';
|
|
9
|
+
import React, { useEffect } from 'react';
|
|
10
|
+
import CcsDialog from '.';
|
|
11
|
+
export default function CcsDialogButtons(_ref) {
|
|
12
|
+
var okText = _ref.okText,
|
|
13
|
+
okAuth = _ref.okAuth,
|
|
14
|
+
loading = _ref.loading,
|
|
15
|
+
children = _ref.children,
|
|
16
|
+
onOk = _ref.onOk;
|
|
17
|
+
var _CcsDialog$useContext = CcsDialog.useContext(),
|
|
18
|
+
closeDialog = _CcsDialog$useContext.closeDialog,
|
|
19
|
+
onHasButtons = _CcsDialog$useContext.onHasButtons,
|
|
20
|
+
formInitialValues = _CcsDialog$useContext.formInitialValues;
|
|
21
|
+
var form = Form.useFormInstance();
|
|
22
|
+
useEffect(function () {
|
|
23
|
+
onHasButtons();
|
|
24
|
+
}, []);
|
|
25
|
+
var onOkClick = function onOkClick() {
|
|
26
|
+
if (!onOk) return;
|
|
27
|
+
|
|
28
|
+
// form返回表单值和所有初始值
|
|
29
|
+
if (form) {
|
|
30
|
+
form.validateFields().then(function (values) {
|
|
31
|
+
onOk(_objectSpread(_objectSpread({}, formInitialValues), values));
|
|
32
|
+
});
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
onOk();
|
|
36
|
+
};
|
|
37
|
+
return onOk ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: "ccs-dialog-buttons"
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
40
|
+
onClick: closeDialog
|
|
41
|
+
}, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(CcsAuth.Button, {
|
|
42
|
+
auth: okAuth || '',
|
|
43
|
+
type: "primary",
|
|
44
|
+
loading: loading,
|
|
45
|
+
onClick: onOkClick
|
|
46
|
+
}, okText || '确定'), children)) : null;
|
|
47
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Store } from 'antd/es/form/interface';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface ContentContextType<T = Store> {
|
|
4
|
+
locationKey: string;
|
|
5
|
+
formInitialValues: T;
|
|
6
|
+
closeDialog: () => void;
|
|
7
|
+
onHasButtons: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const ModalContentContext: React.Context<ContentContextType<any>>;
|
|
10
|
+
declare const useDialogContext: <T = Store>() => ContentContextType<T>;
|
|
11
|
+
export { useDialogContext, ModalContentContext };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
var ModalContentContext = /*#__PURE__*/React.createContext({});
|
|
3
|
+
var useDialogContext = function useDialogContext() {
|
|
4
|
+
var context = useContext(ModalContentContext);
|
|
5
|
+
if (context === undefined) {
|
|
6
|
+
throw new Error('ModalContentContext not found');
|
|
7
|
+
}
|
|
8
|
+
return context;
|
|
9
|
+
};
|
|
10
|
+
export { useDialogContext, ModalContentContext };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { DrawerProps, FormProps, ModalFuncProps } from 'antd';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
export interface CcsDialogModal {
|
|
4
|
+
destroy: () => void;
|
|
5
|
+
update: (config: ModalFuncProps) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface CcsDialogDrawer {
|
|
8
|
+
destroy: () => void;
|
|
9
|
+
update: (config: DrawerProps) => void;
|
|
10
|
+
}
|
|
11
|
+
type ModalFunc = (props: ModalFuncProps) => {
|
|
12
|
+
destroy: () => void;
|
|
13
|
+
update: (configUpdate: ModalFuncProps) => void;
|
|
14
|
+
};
|
|
15
|
+
type DrawerFunc = (props: DrawerProps) => {
|
|
16
|
+
destroy: () => void;
|
|
17
|
+
update: (configUpdate: DrawerProps) => void;
|
|
18
|
+
};
|
|
19
|
+
export type CcsDialogModalProps = ModalFuncProps & {
|
|
20
|
+
/** 可拖拽 */
|
|
21
|
+
isDrag?: boolean;
|
|
22
|
+
/** antd form */
|
|
23
|
+
form?: FormProps;
|
|
24
|
+
/** 关闭后销毁组件,默认true */
|
|
25
|
+
destroyOnClose?: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type CcsDialogDrawerProps = DrawerProps & {
|
|
28
|
+
/** antd form */
|
|
29
|
+
form?: FormProps;
|
|
30
|
+
/** 抽屉内容 */
|
|
31
|
+
content?: ReactNode;
|
|
32
|
+
};
|
|
33
|
+
export type ModalDialog = (...args: Parameters<ModalFunc>) => ReturnType<ModalFunc>;
|
|
34
|
+
export type DrawerDialog = (...args: Parameters<ModalFunc>) => ReturnType<DrawerFunc>;
|
|
35
|
+
export interface CcsDialogType {
|
|
36
|
+
openDrawer: (props: CcsDialogDrawerProps) => ReturnType<DrawerDialog>;
|
|
37
|
+
openModal: (props: CcsDialogModalProps) => ReturnType<ModalDialog>;
|
|
38
|
+
contextHolder: React.JSX.Element;
|
|
39
|
+
}
|
|
40
|
+
export default function useCcsDialog(): CcsDialogType;
|
|
41
|
+
export {};
|