@ccs-ui/rc-pro 1.1.0 → 1.1.1-rc10
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.js +25 -12
- package/es/auth/index.d.ts +7 -13
- package/es/auth/index.js +96 -74
- package/es/dialog/HookDrawer.d.ts +1 -1
- package/es/dialog/HookDrawer.js +31 -19
- package/es/dialog/HookModal.d.ts +1 -1
- package/es/dialog/HookModal.js +25 -20
- package/es/dialog/button.d.ts +3 -1
- package/es/dialog/button.js +28 -16
- package/es/dialog/context.d.ts +8 -7
- package/es/dialog/context.js +4 -4
- package/es/dialog/form.d.ts +2 -2
- package/es/dialog/form.js +4 -3
- package/es/dialog/{dialog.d.ts → hook.d.ts} +9 -1
- package/es/dialog/{dialog.js → hook.js} +11 -11
- package/es/dialog/index.d.ts +4 -4
- package/es/dialog/index.js +2 -2
- package/es/dialog/index.less +14 -17
- package/es/drawer.zip +0 -0
- package/es/index.d.ts +11 -8
- package/es/index.js +0 -2
- package/es/keep-alive-tabs/index.d.ts +1 -1
- package/es/keep-alive-tabs/index.js +46 -41
- package/es/keep-alive-tabs/index.less +2 -2
- package/es/modal.zip +0 -0
- package/es/pro-table/index.d.ts +3 -3
- package/es/pro-table/index.js +69 -179
- package/es/pro-table/index.less +3 -13
- package/es/pro-table/search.js +7 -4
- package/es/pro-table/tree.d.ts +22 -0
- package/es/pro-table/tree.js +184 -0
- package/es/table/index.js +70 -59
- package/es/upload/upload-image.js +33 -15
- package/package.json +3 -2
- package/es/drawer/buttons.d.ts +0 -14
- package/es/drawer/buttons.js +0 -93
- package/es/drawer/index.d.ts +0 -13
- package/es/drawer/index.js +0 -11
- package/es/drawer/index.less +0 -5
- package/es/drawer/open/content.d.ts +0 -20
- package/es/drawer/open/content.js +0 -43
- package/es/drawer/open/destory-fns.d.ts +0 -2
- package/es/drawer/open/destory-fns.js +0 -3
- package/es/drawer/open/form.d.ts +0 -12
- package/es/drawer/open/form.js +0 -32
- package/es/drawer/open/index.d.ts +0 -18
- package/es/drawer/open/index.js +0 -166
- package/es/modal/buttons.d.ts +0 -14
- package/es/modal/buttons.js +0 -90
- package/es/modal/index.d.ts +0 -12
- package/es/modal/index.js +0 -11
- package/es/modal/index.less +0 -26
- package/es/modal/open/destory-fns.d.ts +0 -2
- package/es/modal/open/destory-fns.js +0 -3
- package/es/modal/open/drag.d.ts +0 -1
- package/es/modal/open/drag.js +0 -104
- package/es/modal/open/form.d.ts +0 -12
- package/es/modal/open/form.js +0 -35
- package/es/modal/open/index.d.ts +0 -19
- package/es/modal/open/index.js +0 -93
package/es/drawer/buttons.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
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 { Button, Form, Space } from 'antd';
|
|
8
|
-
import _memoize from 'lodash/memoize';
|
|
9
|
-
import { render as reactRender } from 'rc-util/lib/React/render';
|
|
10
|
-
import React, { useEffect, useRef } from 'react';
|
|
11
|
-
import { CcsAuth, useCcsWindow } from '..';
|
|
12
|
-
import { FnContext } from "./open/content";
|
|
13
|
-
var onGetDrawerBodyDom = _memoize(function (dom) {
|
|
14
|
-
var _parent$classList;
|
|
15
|
-
var parent = dom === null || dom === void 0 ? void 0 : dom.parentNode;
|
|
16
|
-
if (!parent) return;
|
|
17
|
-
if ((_parent$classList = parent.classList) !== null && _parent$classList !== void 0 && _parent$classList.contains("ant-drawer-wrapper-body")) {
|
|
18
|
-
return parent;
|
|
19
|
-
} else {
|
|
20
|
-
return onGetDrawerBodyDom(parent);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
export default function DrawerButton(_ref) {
|
|
24
|
-
var children = _ref.children,
|
|
25
|
-
okText = _ref.okText,
|
|
26
|
-
onOk = _ref.onOk,
|
|
27
|
-
okAuth = _ref.okAuth,
|
|
28
|
-
loading = _ref.loading;
|
|
29
|
-
var ref = useRef(null);
|
|
30
|
-
var _useCcsWindow = useCcsWindow(),
|
|
31
|
-
close = _useCcsWindow.close,
|
|
32
|
-
formInitialValues = _useCcsWindow.formInitialValues,
|
|
33
|
-
locationKey = _useCcsWindow.locationKey;
|
|
34
|
-
var form = Form.useFormInstance();
|
|
35
|
-
var onOkClick = function onOkClick() {
|
|
36
|
-
if (!onOk) return;
|
|
37
|
-
|
|
38
|
-
// form返回表单值和所有初始值
|
|
39
|
-
if (form) {
|
|
40
|
-
form.validateFields().then(function (values) {
|
|
41
|
-
onOk(_objectSpread(_objectSpread({}, formInitialValues), values));
|
|
42
|
-
});
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
onOk();
|
|
46
|
-
};
|
|
47
|
-
var renderDefaultButtom = /*#__PURE__*/React.createElement(React.Fragment, null, okAuth ? /*#__PURE__*/React.createElement(CcsAuth.Button, {
|
|
48
|
-
type: "primary",
|
|
49
|
-
onClick: onOkClick,
|
|
50
|
-
loading: loading,
|
|
51
|
-
auth: okAuth
|
|
52
|
-
}, okText || '确定') : /*#__PURE__*/React.createElement(Button, {
|
|
53
|
-
type: "primary",
|
|
54
|
-
onClick: onOkClick,
|
|
55
|
-
loading: loading
|
|
56
|
-
}, okText || '确定'), /*#__PURE__*/React.createElement(Button, {
|
|
57
|
-
style: {
|
|
58
|
-
borderRadius: 3
|
|
59
|
-
},
|
|
60
|
-
onClick: close
|
|
61
|
-
}, "\u53D6\u6D88"));
|
|
62
|
-
var timeoutId;
|
|
63
|
-
var onRenderButton = function onRenderButton() {
|
|
64
|
-
if (!onOk && !children) return;
|
|
65
|
-
if (!ref.current) return;
|
|
66
|
-
|
|
67
|
-
// get drawer body dom
|
|
68
|
-
var drawerBody = onGetDrawerBodyDom(ref.current);
|
|
69
|
-
|
|
70
|
-
// add footer
|
|
71
|
-
clearTimeout(timeoutId);
|
|
72
|
-
timeoutId = setTimeout(function () {
|
|
73
|
-
if (drawerBody !== null && drawerBody !== void 0 && drawerBody.lastChild) {
|
|
74
|
-
(drawerBody === null || drawerBody === void 0 ? void 0 : drawerBody.lastChild).classList.add('ccs-drawer-buttons');
|
|
75
|
-
reactRender( /*#__PURE__*/React.createElement(FnContext, {
|
|
76
|
-
locationKey: locationKey
|
|
77
|
-
}, /*#__PURE__*/React.createElement(Space, {
|
|
78
|
-
size: 16
|
|
79
|
-
}, children, renderDefaultButtom)), drawerBody.lastChild);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
useEffect(function () {
|
|
84
|
-
onRenderButton();
|
|
85
|
-
}, []);
|
|
86
|
-
onRenderButton();
|
|
87
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
88
|
-
style: {
|
|
89
|
-
display: 'none'
|
|
90
|
-
},
|
|
91
|
-
ref: ref
|
|
92
|
-
});
|
|
93
|
-
}
|
package/es/drawer/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import DrawerBtns from './buttons';
|
|
2
|
-
import './index.less';
|
|
3
|
-
import DrawerOpen from './open';
|
|
4
|
-
export declare const classPrefix = "ccs-drawer";
|
|
5
|
-
interface DrawerInterface {
|
|
6
|
-
Buttons: typeof DrawerBtns;
|
|
7
|
-
open: typeof DrawerOpen;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated
|
|
11
|
-
*/
|
|
12
|
-
declare const Drawer: DrawerInterface;
|
|
13
|
-
export default Drawer;
|
package/es/drawer/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import DrawerBtns from "./buttons";
|
|
2
|
-
import "./index.less";
|
|
3
|
-
import DrawerOpen from "./open";
|
|
4
|
-
export var classPrefix = 'ccs-drawer';
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated
|
|
7
|
-
*/
|
|
8
|
-
var Drawer = {};
|
|
9
|
-
Drawer.open = DrawerOpen;
|
|
10
|
-
Drawer.Buttons = DrawerBtns;
|
|
11
|
-
export default Drawer;
|
package/es/drawer/index.less
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { FormProps } from 'antd';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
interface PropsType {
|
|
4
|
-
/** url location key */
|
|
5
|
-
locationKey: string;
|
|
6
|
-
/** react children */
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
/** ant form */
|
|
9
|
-
form?: FormProps;
|
|
10
|
-
/** close function */
|
|
11
|
-
close: () => void;
|
|
12
|
-
}
|
|
13
|
-
type ContextType = Pick<PropsType, 'children' | 'locationKey'>;
|
|
14
|
-
export declare function FnContext({ children, locationKey }: ContextType): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
/**
|
|
16
|
-
* 函数式打开无法获取全局context,需重新设置,但无法获取用户信息和history
|
|
17
|
-
* 为子组件添加form,子组件可以使用useFormInstance来获取form实例
|
|
18
|
-
*/
|
|
19
|
-
export default function FnContent({ form, children, locationKey, close, }: PropsType): import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { ConfigProvider } from 'antd';
|
|
2
|
-
import zhCN from 'antd/locale/zh_CN';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { CCS, CcsConfigProvider } from "../..";
|
|
5
|
-
import { DrawerAndModalContext, PageContext } from "../../context";
|
|
6
|
-
export function FnContext(_ref) {
|
|
7
|
-
var children = _ref.children,
|
|
8
|
-
locationKey = _ref.locationKey;
|
|
9
|
-
var config = CCS.setDefaultConfig(CCS.GlobalConfig);
|
|
10
|
-
return /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
11
|
-
locale: zhCN,
|
|
12
|
-
theme: config.theme
|
|
13
|
-
}, /*#__PURE__*/React.createElement(CcsConfigProvider, {
|
|
14
|
-
userDetail: {}
|
|
15
|
-
}, /*#__PURE__*/React.createElement(PageContext.Provider, {
|
|
16
|
-
value: {
|
|
17
|
-
onAuth: function onAuth(e) {
|
|
18
|
-
var _CCS$UrlAuth$location;
|
|
19
|
-
return (_CCS$UrlAuth$location = CCS.UrlAuth[locationKey]) === null || _CCS$UrlAuth$location === void 0 ? void 0 : _CCS$UrlAuth$location.includes(e);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}, children)));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* 函数式打开无法获取全局context,需重新设置,但无法获取用户信息和history
|
|
27
|
-
* 为子组件添加form,子组件可以使用useFormInstance来获取form实例
|
|
28
|
-
*/
|
|
29
|
-
export default function FnContent(_ref2) {
|
|
30
|
-
var form = _ref2.form,
|
|
31
|
-
children = _ref2.children,
|
|
32
|
-
locationKey = _ref2.locationKey,
|
|
33
|
-
close = _ref2.close;
|
|
34
|
-
return /*#__PURE__*/React.createElement(FnContext, {
|
|
35
|
-
locationKey: locationKey
|
|
36
|
-
}, /*#__PURE__*/React.createElement(DrawerAndModalContext.Provider, {
|
|
37
|
-
value: {
|
|
38
|
-
close: close,
|
|
39
|
-
locationKey: locationKey,
|
|
40
|
-
formInitialValues: (form === null || form === void 0 ? void 0 : form.initialValues) || {}
|
|
41
|
-
}
|
|
42
|
-
}, children));
|
|
43
|
-
}
|
package/es/drawer/open/form.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FormProps } from 'antd';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
interface PropsType {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
formProps: FormProps;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* 添加form实例
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
export default function DrawerForm({ children, formProps: { initialValues, labelCol, wrapperCol }, }: PropsType): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
package/es/drawer/open/form.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
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."); }
|
|
3
|
-
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); }
|
|
4
|
-
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; }
|
|
5
|
-
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; } }
|
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import { Form } from 'antd';
|
|
8
|
-
import React from 'react';
|
|
9
|
-
/**
|
|
10
|
-
* 添加form实例
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
export default function DrawerForm(_ref) {
|
|
14
|
-
var children = _ref.children,
|
|
15
|
-
_ref$formProps = _ref.formProps,
|
|
16
|
-
initialValues = _ref$formProps.initialValues,
|
|
17
|
-
labelCol = _ref$formProps.labelCol,
|
|
18
|
-
wrapperCol = _ref$formProps.wrapperCol;
|
|
19
|
-
var _Form$useForm = Form.useForm(),
|
|
20
|
-
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
21
|
-
form = _Form$useForm2[0];
|
|
22
|
-
return /*#__PURE__*/React.createElement(Form, {
|
|
23
|
-
form: form,
|
|
24
|
-
initialValues: initialValues,
|
|
25
|
-
labelCol: labelCol || {
|
|
26
|
-
span: 7
|
|
27
|
-
},
|
|
28
|
-
wrapperCol: wrapperCol || {
|
|
29
|
-
span: 14
|
|
30
|
-
}
|
|
31
|
-
}, children);
|
|
32
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { DrawerProps, FormProps } from 'antd';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
type ConfigUpdate = DrawerProps | ((prevConfig: DrawerProps) => DrawerProps);
|
|
4
|
-
export type CcsDrawerProps = DrawerProps & {
|
|
5
|
-
/** 内容组件 */
|
|
6
|
-
content?: ReactNode;
|
|
7
|
-
/** 头部扩展 */
|
|
8
|
-
titleExtra?: ReactNode;
|
|
9
|
-
/** 返回文字 */
|
|
10
|
-
closeText?: string;
|
|
11
|
-
/** antd form */
|
|
12
|
-
form?: FormProps;
|
|
13
|
-
};
|
|
14
|
-
export default function DrawerFn(config: CcsDrawerProps): {
|
|
15
|
-
destroy: () => void;
|
|
16
|
-
update: (configUpdate: ConfigUpdate) => void;
|
|
17
|
-
};
|
|
18
|
-
export {};
|
package/es/drawer/open/index.js
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
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
|
-
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
8
|
-
import { LeftOutlined } from '@ant-design/icons';
|
|
9
|
-
import { Button, Divider, Drawer } from 'antd';
|
|
10
|
-
import { render as reactRender, unmount as reactUnmount } from 'rc-util/lib/React/render';
|
|
11
|
-
import React from 'react';
|
|
12
|
-
import FnContent from "./content";
|
|
13
|
-
import destroyDrawerFns from "./destory-fns";
|
|
14
|
-
import DrawerForm from "./form";
|
|
15
|
-
export default function DrawerFn(config) {
|
|
16
|
-
var container = document.createDocumentFragment();
|
|
17
|
-
var isDestroy = false;
|
|
18
|
-
var locationKey = '';
|
|
19
|
-
var open = config.open,
|
|
20
|
-
title = config.title,
|
|
21
|
-
content = config.content,
|
|
22
|
-
titleExtra = config.titleExtra,
|
|
23
|
-
getContainer = config.getContainer,
|
|
24
|
-
_config$rootStyle = config.rootStyle,
|
|
25
|
-
rootStyle = _config$rootStyle === void 0 ? {} : _config$rootStyle,
|
|
26
|
-
_config$bodyStyle = config.bodyStyle,
|
|
27
|
-
bodyStyle = _config$bodyStyle === void 0 ? {} : _config$bodyStyle,
|
|
28
|
-
_config$maskStyle = config.maskStyle,
|
|
29
|
-
maskStyle = _config$maskStyle === void 0 ? {} : _config$maskStyle,
|
|
30
|
-
_config$headerStyle = config.headerStyle,
|
|
31
|
-
headerStyle = _config$headerStyle === void 0 ? {} : _config$headerStyle,
|
|
32
|
-
_config$footerStyle = config.footerStyle,
|
|
33
|
-
footerStyle = _config$footerStyle === void 0 ? {} : _config$footerStyle;
|
|
34
|
-
function afterOpenChange(open) {
|
|
35
|
-
if (config.afterOpenChange) afterOpenChange(open);
|
|
36
|
-
|
|
37
|
-
// 关闭,默认销毁组件
|
|
38
|
-
if (!open && config.destroyOnClose !== false) {
|
|
39
|
-
// 删除destroyDrawerFns关闭方法
|
|
40
|
-
for (var i = 0; i < destroyDrawerFns.length; i++) {
|
|
41
|
-
var fn = destroyDrawerFns[i];
|
|
42
|
-
if (fn === close) {
|
|
43
|
-
destroyDrawerFns.splice(i, 1);
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// 卸载dom
|
|
49
|
-
reactUnmount(container);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// 添加关闭事件
|
|
54
|
-
function onDrawerClose(e) {
|
|
55
|
-
if (config.onClose) config.onClose(e);
|
|
56
|
-
close();
|
|
57
|
-
}
|
|
58
|
-
var renderTitle = /*#__PURE__*/React.createElement("div", {
|
|
59
|
-
style: {
|
|
60
|
-
display: 'flex',
|
|
61
|
-
justifyContent: 'space-between'
|
|
62
|
-
}
|
|
63
|
-
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
|
|
64
|
-
icon: /*#__PURE__*/React.createElement(LeftOutlined, null),
|
|
65
|
-
type: "text",
|
|
66
|
-
style: {
|
|
67
|
-
color: '#9e9e9e',
|
|
68
|
-
padding: 0
|
|
69
|
-
},
|
|
70
|
-
size: "small",
|
|
71
|
-
onClick: function onClick() {
|
|
72
|
-
return close && close();
|
|
73
|
-
}
|
|
74
|
-
}, config.closeText), /*#__PURE__*/React.createElement(Divider, {
|
|
75
|
-
type: "vertical"
|
|
76
|
-
}), title ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
77
|
-
style: {
|
|
78
|
-
fontWeight: 500,
|
|
79
|
-
fontSize: 14
|
|
80
|
-
}
|
|
81
|
-
}, title)) : null), /*#__PURE__*/React.createElement("div", null, titleExtra));
|
|
82
|
-
var defaultConfig = {};
|
|
83
|
-
// 默认抽屉加载到当前tab下面
|
|
84
|
-
if (!('getContainer' in config)) {
|
|
85
|
-
var doms = document.body.querySelectorAll("[id*=\"_tab_content_\"][data-display=\"true\"]");
|
|
86
|
-
if (doms.length > 0) {
|
|
87
|
-
var dom = doms[0];
|
|
88
|
-
defaultConfig.getContainer = dom;
|
|
89
|
-
defaultConfig.rootStyle = _objectSpread({
|
|
90
|
-
position: 'absolute'
|
|
91
|
-
}, rootStyle);
|
|
92
|
-
var id = dom.getAttribute('id');
|
|
93
|
-
locationKey = (id === null || id === void 0 ? void 0 : id.replace('_tab_content_', '')) || '';
|
|
94
|
-
} else {
|
|
95
|
-
defaultConfig.getContainer = undefined;
|
|
96
|
-
}
|
|
97
|
-
} else if (config.getContainer === false) {
|
|
98
|
-
// 命令式不能挂载到当前dom
|
|
99
|
-
defaultConfig.getContainer = undefined;
|
|
100
|
-
} else {
|
|
101
|
-
defaultConfig.getContainer = getContainer;
|
|
102
|
-
}
|
|
103
|
-
var currentConfig = _objectSpread(_objectSpread(_objectSpread({}, config), defaultConfig), {}, {
|
|
104
|
-
open: open === false ? false : true,
|
|
105
|
-
maskStyle: _objectSpread({
|
|
106
|
-
background: 'rgba(0, 0, 0, 0.1)'
|
|
107
|
-
}, maskStyle),
|
|
108
|
-
headerStyle: _objectSpread({
|
|
109
|
-
padding: '8px 10px'
|
|
110
|
-
}, headerStyle),
|
|
111
|
-
bodyStyle: _objectSpread({
|
|
112
|
-
padding: 16
|
|
113
|
-
}, bodyStyle),
|
|
114
|
-
children: content,
|
|
115
|
-
close: close,
|
|
116
|
-
afterOpenChange: afterOpenChange,
|
|
117
|
-
onClose: onDrawerClose,
|
|
118
|
-
title: renderTitle,
|
|
119
|
-
closable: false,
|
|
120
|
-
footer: /*#__PURE__*/React.createElement(React.Fragment, null),
|
|
121
|
-
footerStyle: _objectSpread({
|
|
122
|
-
padding: 0
|
|
123
|
-
}, footerStyle)
|
|
124
|
-
});
|
|
125
|
-
var timeoutId;
|
|
126
|
-
function render(props) {
|
|
127
|
-
clearTimeout(timeoutId);
|
|
128
|
-
timeoutId = setTimeout(function () {
|
|
129
|
-
var Rc = /*#__PURE__*/React.createElement(FnContent, {
|
|
130
|
-
form: config.form,
|
|
131
|
-
close: onDrawerClose,
|
|
132
|
-
locationKey: locationKey
|
|
133
|
-
}, /*#__PURE__*/React.createElement(Drawer, props));
|
|
134
|
-
reactRender(config.form ? /*#__PURE__*/React.createElement(DrawerForm, {
|
|
135
|
-
formProps: config.form
|
|
136
|
-
}, Rc) : Rc, container);
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
function close(open) {
|
|
140
|
-
if (isDestroy) return;
|
|
141
|
-
currentConfig = _objectSpread(_objectSpread({}, currentConfig), {}, {
|
|
142
|
-
open: open
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
// 改变open状态
|
|
146
|
-
render(currentConfig);
|
|
147
|
-
}
|
|
148
|
-
function update(configUpdate) {
|
|
149
|
-
if (isDestroy) return;
|
|
150
|
-
if (typeof configUpdate === 'function') {
|
|
151
|
-
currentConfig = configUpdate(currentConfig);
|
|
152
|
-
} else {
|
|
153
|
-
currentConfig = _objectSpread(_objectSpread({}, currentConfig), configUpdate);
|
|
154
|
-
}
|
|
155
|
-
render(currentConfig);
|
|
156
|
-
}
|
|
157
|
-
render(currentConfig);
|
|
158
|
-
destroyDrawerFns.push(close);
|
|
159
|
-
return {
|
|
160
|
-
destroy: function destroy() {
|
|
161
|
-
isDestroy = true;
|
|
162
|
-
reactUnmount(container);
|
|
163
|
-
},
|
|
164
|
-
update: update
|
|
165
|
-
};
|
|
166
|
-
}
|
package/es/modal/buttons.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
interface PropsType {
|
|
3
|
-
children?: ReactNode;
|
|
4
|
-
/** 确定文字内容 */
|
|
5
|
-
okText?: string;
|
|
6
|
-
/** 确定按钮权限 */
|
|
7
|
-
okAuth?: string;
|
|
8
|
-
/** 加载中 */
|
|
9
|
-
loading?: boolean;
|
|
10
|
-
/** 确定事件 */
|
|
11
|
-
onOk?: (value?: any) => void;
|
|
12
|
-
}
|
|
13
|
-
export default function ModalButtons({ children, okText, okAuth, onOk, loading, }: PropsType): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export {};
|
package/es/modal/buttons.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
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 { Button, Form, Space } from 'antd';
|
|
8
|
-
import _memoize from 'lodash/memoize';
|
|
9
|
-
import { render as reactRender } from 'rc-util/lib/React/render';
|
|
10
|
-
import React, { useEffect, useRef } from 'react';
|
|
11
|
-
import { CcsAuth } from '..';
|
|
12
|
-
import { useCcsWindow } from "../";
|
|
13
|
-
import { FnContext } from "../drawer/open/content";
|
|
14
|
-
var onGetModalBodyDom = _memoize(function (dom) {
|
|
15
|
-
var _parent$classList;
|
|
16
|
-
var parent = dom === null || dom === void 0 ? void 0 : dom.parentNode;
|
|
17
|
-
if (!parent) return;
|
|
18
|
-
if ((_parent$classList = parent.classList) !== null && _parent$classList !== void 0 && _parent$classList.contains("ant-modal-content")) {
|
|
19
|
-
return parent;
|
|
20
|
-
} else {
|
|
21
|
-
return onGetModalBodyDom(parent);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
export default function ModalButtons(_ref) {
|
|
25
|
-
var children = _ref.children,
|
|
26
|
-
okText = _ref.okText,
|
|
27
|
-
okAuth = _ref.okAuth,
|
|
28
|
-
onOk = _ref.onOk,
|
|
29
|
-
loading = _ref.loading;
|
|
30
|
-
var _useCcsWindow = useCcsWindow(),
|
|
31
|
-
close = _useCcsWindow.close,
|
|
32
|
-
formInitialValues = _useCcsWindow.formInitialValues,
|
|
33
|
-
locationKey = _useCcsWindow.locationKey;
|
|
34
|
-
var form = Form.useFormInstance();
|
|
35
|
-
var ref = useRef(null);
|
|
36
|
-
var onOkClick = function onOkClick() {
|
|
37
|
-
if (!onOk) return;
|
|
38
|
-
|
|
39
|
-
// form返回表单值和所有初始值
|
|
40
|
-
if (form) {
|
|
41
|
-
form.validateFields().then(function (values) {
|
|
42
|
-
onOk(_objectSpread(_objectSpread({}, formInitialValues), values));
|
|
43
|
-
});
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
onOk();
|
|
47
|
-
};
|
|
48
|
-
var renderDefaultButtom = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
49
|
-
onClick: close
|
|
50
|
-
}, "\u53D6\u6D88"), okAuth ? /*#__PURE__*/React.createElement(CcsAuth.Button, {
|
|
51
|
-
auth: okAuth,
|
|
52
|
-
type: "primary",
|
|
53
|
-
onClick: onOkClick,
|
|
54
|
-
loading: loading
|
|
55
|
-
}, okText || '确定') : /*#__PURE__*/React.createElement(Button, {
|
|
56
|
-
type: "primary",
|
|
57
|
-
onClick: onOkClick,
|
|
58
|
-
loading: loading
|
|
59
|
-
}, okText || '确定'));
|
|
60
|
-
var timeoutId;
|
|
61
|
-
var onRenderButton = function onRenderButton() {
|
|
62
|
-
if (!onOk && !children) return;
|
|
63
|
-
if (!ref.current) return;
|
|
64
|
-
|
|
65
|
-
// get drawer body dom
|
|
66
|
-
var modalBody = onGetModalBodyDom(ref.current);
|
|
67
|
-
|
|
68
|
-
// add footer
|
|
69
|
-
clearTimeout(timeoutId);
|
|
70
|
-
timeoutId = setTimeout(function () {
|
|
71
|
-
if (modalBody !== null && modalBody !== void 0 && modalBody.lastChild) {
|
|
72
|
-
reactRender( /*#__PURE__*/React.createElement(FnContext, {
|
|
73
|
-
locationKey: locationKey
|
|
74
|
-
}, /*#__PURE__*/React.createElement(Space, {
|
|
75
|
-
size: 16
|
|
76
|
-
}, children, renderDefaultButtom)), modalBody.lastChild);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
useEffect(function () {
|
|
81
|
-
onRenderButton();
|
|
82
|
-
}, []);
|
|
83
|
-
onRenderButton();
|
|
84
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
85
|
-
style: {
|
|
86
|
-
display: 'none'
|
|
87
|
-
},
|
|
88
|
-
ref: ref
|
|
89
|
-
});
|
|
90
|
-
}
|
package/es/modal/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import ModalButtons from './buttons';
|
|
2
|
-
import './index.less';
|
|
3
|
-
import ModalOpen from './open';
|
|
4
|
-
interface ModalInterface {
|
|
5
|
-
Buttons: typeof ModalButtons;
|
|
6
|
-
open: typeof ModalOpen;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated
|
|
10
|
-
*/
|
|
11
|
-
declare const modal: ModalInterface;
|
|
12
|
-
export default modal;
|
package/es/modal/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
2
|
-
import ModalButtons from "./buttons";
|
|
3
|
-
import "./index.less";
|
|
4
|
-
import ModalOpen from "./open";
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated
|
|
7
|
-
*/
|
|
8
|
-
var modal = {};
|
|
9
|
-
modal.open = ModalOpen;
|
|
10
|
-
modal.Buttons = ModalButtons;
|
|
11
|
-
export default modal;
|
package/es/modal/index.less
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
.ccs-drag-modal {
|
|
2
|
-
.ant-modal-header {
|
|
3
|
-
.ant-modal-title div {
|
|
4
|
-
padding: 20px 24px 10px;
|
|
5
|
-
box-sizing: border-box;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
margin-bottom: 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.ant-modal-content {
|
|
12
|
-
padding: 0;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.ant-modal-body {
|
|
16
|
-
padding: 0 24px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.ant-modal-footer {
|
|
20
|
-
padding: 0 24px 20px;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.ccs-modal-buttons {
|
|
25
|
-
text-align: right;
|
|
26
|
-
}
|
package/es/modal/open/drag.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function InternalDragModal({ title, ...restProps }: any): import("react/jsx-runtime").JSX.Element;
|