@ccs-ui/rc-pro 1.2.1-beta-5 → 2.0.2
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 +3 -1
- package/es/auth/auth-button.js +40 -5
- package/es/auth/index.d.ts +2 -1
- package/es/ccs.d.ts +27 -66
- package/es/color-picker/index.d.ts +2 -4
- package/es/config.d.ts +5 -3
- package/es/config.js +98 -9
- package/es/context/index.d.ts +13 -9
- package/es/context/index.js +2 -2
- package/es/dialog/DialogSelfOkButton.d.ts +1 -1
- package/es/dialog/button.d.ts +3 -3
- package/es/dialog/drawer-footer.d.ts +2 -3
- package/es/dialog/hook.d.ts +4 -0
- package/es/dialog/hook.js +10 -7
- package/es/editor/index.d.ts +2 -4
- package/es/hooks/use-app.d.ts +6 -0
- package/es/hooks/use-app.js +15 -0
- package/es/index.d.ts +2 -3
- package/es/index.js +2 -3
- package/es/layout-keep-alive/index.d.ts +1 -1
- package/es/layout-keep-alive/index.js +14 -18
- package/es/layout-keep-alive/page.d.ts +1 -0
- package/es/layout-single-page/index.d.ts +1 -1
- package/es/layout-single-page/index.js +7 -23
- package/es/pro-grid/index.d.ts +4 -9
- package/es/pro-table/head.d.ts +2 -2
- package/es/pro-table/index.less +0 -27
- package/es/pro-table/table.d.ts +8 -16
- package/es/pro-table/table.js +6 -33
- package/es/trigger/index.d.ts +2 -8
- package/es/upload/index.d.ts +1 -1
- package/es/virtual-list/index.d.ts +3 -4
- package/es/water-mark/index.d.ts +3 -10
- package/package.json +5 -6
- package/es/hooks/use-global.d.ts +0 -4
- package/es/hooks/use-global.js +0 -10
- package/es/pro-table/search.d.ts +0 -17
- package/es/pro-table/search.js +0 -312
- package/es/theme.d.ts +0 -12
- package/es/theme.js +0 -66
package/es/auth/auth-button.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ type CcsAuthButtonProps = Omit<ButtonProps, 'onClick'> & {
|
|
|
7
7
|
text?: string;
|
|
8
8
|
/** 二次确认消息 */
|
|
9
9
|
confirm?: string;
|
|
10
|
+
/** 输入确认的值 */
|
|
11
|
+
inputConfirm?: string;
|
|
10
12
|
/** 点击事件 */
|
|
11
13
|
onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>, selectedRows?: any[]) => void;
|
|
12
14
|
/** 按钮禁用方法 */
|
|
@@ -17,5 +19,5 @@ type CcsAuthButtonProps = Omit<ButtonProps, 'onClick'> & {
|
|
|
17
19
|
* @param CcsAuthButtonProps
|
|
18
20
|
* @returns
|
|
19
21
|
*/
|
|
20
|
-
declare const _default: ({ auth, text, confirm, disabled, onClick, onDisabled, ...restProps }: CcsAuthButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare const _default: ({ auth, text, confirm, disabled, inputConfirm, onClick, onDisabled, ...restProps }: CcsAuthButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
23
|
export default _default;
|
package/es/auth/auth-button.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["auth", "text", "confirm", "disabled", "onClick", "onDisabled"];
|
|
2
|
+
var _excluded = ["auth", "text", "confirm", "disabled", "inputConfirm", "onClick", "onDisabled"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
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; }
|
|
@@ -8,14 +8,14 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
8
8
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
9
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
10
|
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
|
11
|
-
import { Button } from 'antd';
|
|
11
|
+
import { Button, Input } from 'antd';
|
|
12
12
|
import { useContext, useRef } from 'react';
|
|
13
13
|
import { ModalConfirm } from '.';
|
|
14
14
|
import { useCcsPage } from "../";
|
|
15
15
|
import { TableSelectionContext } from "../pro-table/table";
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
17
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
19
|
/**
|
|
20
20
|
* 带权限的按钮组件、继承Ant Button所有属性
|
|
21
21
|
* @param CcsAuthButtonProps
|
|
@@ -26,6 +26,7 @@ export default (function (_ref) {
|
|
|
26
26
|
text = _ref.text,
|
|
27
27
|
confirm = _ref.confirm,
|
|
28
28
|
disabled = _ref.disabled,
|
|
29
|
+
inputConfirm = _ref.inputConfirm,
|
|
29
30
|
_onClick = _ref.onClick,
|
|
30
31
|
onDisabled = _ref.onDisabled,
|
|
31
32
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -34,6 +35,7 @@ export default (function (_ref) {
|
|
|
34
35
|
var modalRef = useRef(null);
|
|
35
36
|
var _ref3 = useContext(TableSelectionContext) || {},
|
|
36
37
|
selectedRows = _ref3.selectedRows;
|
|
38
|
+
var ref = useRef(null);
|
|
37
39
|
var button = /*#__PURE__*/_jsxs(Button, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
38
40
|
onClick: function onClick(e) {
|
|
39
41
|
if (!_onClick) return;
|
|
@@ -43,11 +45,44 @@ export default (function (_ref) {
|
|
|
43
45
|
title: '操作确认',
|
|
44
46
|
icon: /*#__PURE__*/_jsx(ExclamationCircleOutlined, {}),
|
|
45
47
|
centered: true,
|
|
46
|
-
content:
|
|
48
|
+
content: /*#__PURE__*/_jsxs(_Fragment, {
|
|
49
|
+
children: [confirm, inputConfirm && /*#__PURE__*/_jsx(Input, {
|
|
50
|
+
ref: ref,
|
|
51
|
+
placeholder: "\u8BF7\u8F93\u5165",
|
|
52
|
+
style: {
|
|
53
|
+
marginTop: 5
|
|
54
|
+
},
|
|
55
|
+
onFocus: function onFocus() {
|
|
56
|
+
var errorDom = document.getElementById('_inputConfirmError');
|
|
57
|
+
if (errorDom) {
|
|
58
|
+
errorDom.innerHTML = '';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
})]
|
|
62
|
+
}),
|
|
47
63
|
okText: '确认',
|
|
48
64
|
cancelText: '取消',
|
|
49
65
|
onOk: function onOk() {
|
|
50
|
-
|
|
66
|
+
console.log('inputConfirm', inputConfirm);
|
|
67
|
+
if (inputConfirm) {
|
|
68
|
+
return new Promise(function (resolve, reject) {
|
|
69
|
+
var _ref$current;
|
|
70
|
+
if (((_ref$current = ref.current) === null || _ref$current === void 0 || (_ref$current = _ref$current.input) === null || _ref$current === void 0 ? void 0 : _ref$current.value) === inputConfirm) {
|
|
71
|
+
_onClick(e, selectedRows);
|
|
72
|
+
resolve(true);
|
|
73
|
+
} else {
|
|
74
|
+
var errorDom = document.getElementById('_inputConfirmError');
|
|
75
|
+
if (errorDom) {
|
|
76
|
+
errorDom.innerHTML = '输入验证失败!';
|
|
77
|
+
} else {
|
|
78
|
+
var _ref$current2;
|
|
79
|
+
(_ref$current2 = ref.current) === null || _ref$current2 === void 0 || (_ref$current2 = _ref$current2.input) === null || _ref$current2 === void 0 || (_ref$current2 = _ref$current2.parentElement) === null || _ref$current2 === void 0 || _ref$current2.insertAdjacentHTML('beforeend', '<span id="_inputConfirmError" style="color:red">输入验证失败!</span>');
|
|
80
|
+
}
|
|
81
|
+
reject(false);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
_onClick(e, selectedRows);
|
|
51
86
|
}
|
|
52
87
|
});
|
|
53
88
|
return;
|
package/es/auth/index.d.ts
CHANGED
|
@@ -30,10 +30,11 @@ export declare function ModalConfirm({ modalRef }: {
|
|
|
30
30
|
declare function CcsAuth({ auth, children }: CcsAuthProps): ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
31
31
|
declare namespace CcsAuth {
|
|
32
32
|
var Group: typeof AuthGroup;
|
|
33
|
-
var Button: ({ auth, text, confirm, disabled, onClick, onDisabled, ...restProps }: Omit<ButtonProps, "onClick"> & {
|
|
33
|
+
var Button: ({ auth, text, confirm, disabled, inputConfirm, onClick, onDisabled, ...restProps }: Omit<ButtonProps, "onClick"> & {
|
|
34
34
|
auth: string;
|
|
35
35
|
text?: string | undefined;
|
|
36
36
|
confirm?: string | undefined;
|
|
37
|
+
inputConfirm?: string | undefined;
|
|
37
38
|
onClick?: ((e: import("react").MouseEvent<HTMLElement, MouseEvent>, selectedRows?: any[] | undefined) => void) | undefined;
|
|
38
39
|
onDisabled?: ((selectedRows?: any[] | undefined) => boolean) | undefined;
|
|
39
40
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/es/ccs.d.ts
CHANGED
|
@@ -1,43 +1,22 @@
|
|
|
1
|
-
import { ButtonProps
|
|
1
|
+
import { ButtonProps } from 'antd';
|
|
2
2
|
import { Rule } from 'antd/es/form';
|
|
3
|
-
import { MutableRefObject, ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { CSSProperties, MutableRefObject, ReactElement, ReactNode } from 'react';
|
|
4
4
|
import { TableColumn } from './pro-table/table';
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
menuCode: string;
|
|
10
|
-
menuDesc: string;
|
|
11
|
-
menuName: string;
|
|
12
|
-
menuType: number;
|
|
5
|
+
type MenuType = {
|
|
6
|
+
/** 菜单ID */
|
|
7
|
+
menuId: string;
|
|
8
|
+
/** 菜单路由 */
|
|
13
9
|
menuUrl: string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
name: string;
|
|
25
|
-
};
|
|
26
|
-
type MenuTreeNode = {
|
|
27
|
-
nodeId: string;
|
|
28
|
-
nodeName: string;
|
|
29
|
-
icon: string;
|
|
30
|
-
leaf: boolean;
|
|
31
|
-
nodeData: MenuTreeNodeData;
|
|
32
|
-
children?: MenuTreeNode[];
|
|
33
|
-
topUrl?: string;
|
|
34
|
-
parents?: MenuParentType[];
|
|
35
|
-
};
|
|
36
|
-
type UserDetail = {
|
|
37
|
-
/** 头像 */
|
|
38
|
-
avatar?: string;
|
|
39
|
-
/** 用户名 */
|
|
40
|
-
workerName: string;
|
|
10
|
+
/** 菜单名称 */
|
|
11
|
+
menuName: string;
|
|
12
|
+
/** 面包屑数据 */
|
|
13
|
+
breadcrumb?: {
|
|
14
|
+
key: any;
|
|
15
|
+
title: string;
|
|
16
|
+
href?: string;
|
|
17
|
+
}[];
|
|
18
|
+
/** 菜单URL权限 */
|
|
19
|
+
urlAuthList?: string[];
|
|
41
20
|
};
|
|
42
21
|
type TableData<T> = {
|
|
43
22
|
/** loading */
|
|
@@ -184,8 +163,6 @@ export type TableFormItem = {
|
|
|
184
163
|
name: string;
|
|
185
164
|
/** form item element */
|
|
186
165
|
value: ReactElement;
|
|
187
|
-
/** @deprecated 主条件 */
|
|
188
|
-
isMain?: boolean;
|
|
189
166
|
/** 数据依赖、依赖项对应的name数组 */
|
|
190
167
|
depends?: string[];
|
|
191
168
|
/** 显示依赖 */
|
|
@@ -195,33 +172,17 @@ export type TableFormItem = {
|
|
|
195
172
|
/** 格式化值 */
|
|
196
173
|
onFormat?: (e: any) => any;
|
|
197
174
|
};
|
|
198
|
-
type GlobalConfig = {
|
|
199
|
-
/** 项目名称 */
|
|
200
|
-
AppName: string;
|
|
201
|
-
/** 主题 */
|
|
202
|
-
AppTheme: 'light' | 'dark' | 'colorful';
|
|
203
|
-
/** ant组件配置 */
|
|
204
|
-
AppThemeConfig: ThemeConfig;
|
|
205
|
-
/** 菜单展开模式 */
|
|
206
|
-
MenuExpandMode: MenuProps['mode'];
|
|
207
|
-
/** 菜单展开宽度 */
|
|
208
|
-
MenuExpandWidth: number;
|
|
209
|
-
/** 菜单收起宽度 */
|
|
210
|
-
MenuCollapsedWidth: number;
|
|
211
|
-
/** http 请求通用前缀 */
|
|
212
|
-
Api: string;
|
|
213
|
-
/** 路由上下文 */
|
|
214
|
-
Context: string;
|
|
215
|
-
/** 图片上传地址 */
|
|
216
|
-
UploadUrl?: string;
|
|
217
|
-
/** 图片下载地址 */
|
|
218
|
-
DownloadUrl?: string;
|
|
219
|
-
/** 允许改变主题 */
|
|
220
|
-
AllowChangeTheme?: boolean;
|
|
221
|
-
/** 布局模式、single:单页,tabs:缓存页面 */
|
|
222
|
-
layoutMode?: 'tabs' | 'single';
|
|
223
|
-
};
|
|
224
175
|
type TableFormItems = TableFormItem[];
|
|
225
176
|
type TableInstanceRef<T = any> = MutableRefObject<TableInstance<T> | undefined> | React.RefObject<TableInstance<T>>;
|
|
226
177
|
type TableColumns<RecordType = any> = TableColumn<RecordType>[];
|
|
227
|
-
|
|
178
|
+
type PropsWithCss = {
|
|
179
|
+
style?: CSSProperties;
|
|
180
|
+
className?: string;
|
|
181
|
+
};
|
|
182
|
+
type PropsWithNodeChildren = {
|
|
183
|
+
children?: ReactNode;
|
|
184
|
+
};
|
|
185
|
+
type PropsWithElementChildren = {
|
|
186
|
+
children?: ReactElement;
|
|
187
|
+
};
|
|
188
|
+
export type { AuthButtonItem, HttpListResult, HttpPageResult, HttpResult, ListQuery, MenuType, PageQuery, PageType, PropsWithCss, PropsWithElementChildren, PropsWithNodeChildren, RecordType, RouteHistory, TableColumns, TableData, TableFormItems, TableInstance, TableInstanceRef, TriggerChildrenProps, };
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { CSSProperties } from 'react';
|
|
2
1
|
import { RGBColor } from 'react-color';
|
|
2
|
+
import { PropsWithCss } from '../ccs';
|
|
3
3
|
import './index.less';
|
|
4
|
-
export type PropsType = {
|
|
4
|
+
export type PropsType = PropsWithCss & {
|
|
5
5
|
/** 指定选中项 */
|
|
6
6
|
value?: RGBColor;
|
|
7
7
|
/** 占位 */
|
|
8
8
|
placeholder?: string;
|
|
9
|
-
/** 内部样式 */
|
|
10
|
-
style?: CSSProperties;
|
|
11
9
|
/** 选择完成后的回调 */
|
|
12
10
|
onChange?: (value: RGBColor) => void;
|
|
13
11
|
};
|
package/es/config.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { PropsWithElementChildren } from './ccs';
|
|
2
|
+
import { CssAppConfigType } from './context';
|
|
3
|
+
type AppConfigProps = PropsWithElementChildren & CssAppConfigType;
|
|
4
|
+
export default function CssAppConfig(props: AppConfigProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export {};
|
package/es/config.js
CHANGED
|
@@ -1,12 +1,101 @@
|
|
|
1
|
-
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
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(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { darkTheme, defaultTheme } from '@ant-design/compatible';
|
|
14
|
+
import { App, ConfigProvider, message, Modal, notification } from 'antd';
|
|
15
|
+
import zhCN from 'antd/locale/zh_CN';
|
|
16
|
+
import React, { useState } from 'react';
|
|
17
|
+
import { AppConfigContext } from "./context";
|
|
18
|
+
import usePatchElement from "./dialog/usePatchElement";
|
|
19
|
+
import ThemeDialog from "./theme-dialog";
|
|
20
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
22
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
+
var ElementsHolder = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (_props, ref) {
|
|
24
|
+
var _usePatchElement = usePatchElement(),
|
|
25
|
+
_usePatchElement2 = _slicedToArray(_usePatchElement, 2),
|
|
26
|
+
elements = _usePatchElement2[0],
|
|
27
|
+
patchElement = _usePatchElement2[1];
|
|
28
|
+
React.useImperativeHandle(ref, function () {
|
|
29
|
+
return {
|
|
30
|
+
patchElement: patchElement
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
34
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
35
|
+
children: elements
|
|
36
|
+
});
|
|
37
|
+
}));
|
|
38
|
+
function AppDialog() {
|
|
39
|
+
var _message$useMessage = message.useMessage(),
|
|
40
|
+
_message$useMessage2 = _slicedToArray(_message$useMessage, 2),
|
|
41
|
+
messageApi = _message$useMessage2[0],
|
|
42
|
+
contextMsgHolder = _message$useMessage2[1];
|
|
43
|
+
var _notification$useNoti = notification.useNotification(),
|
|
44
|
+
_notification$useNoti2 = _slicedToArray(_notification$useNoti, 2),
|
|
45
|
+
noticeApi = _notification$useNoti2[0],
|
|
46
|
+
contextNotifHolder = _notification$useNoti2[1];
|
|
47
|
+
var _Modal$useModal = Modal.useModal(),
|
|
48
|
+
_Modal$useModal2 = _slicedToArray(_Modal$useModal, 2),
|
|
49
|
+
modalApi = _Modal$useModal2[0],
|
|
50
|
+
contextModalHolder = _Modal$useModal2[1];
|
|
51
|
+
useState(function () {
|
|
52
|
+
ThemeDialog.setConfig(messageApi, noticeApi, modalApi);
|
|
53
|
+
});
|
|
54
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
55
|
+
children: [contextMsgHolder, contextNotifHolder, contextModalHolder]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** 主题设置 */
|
|
60
|
+
function AppConfig(_ref) {
|
|
61
|
+
var children = _ref.children,
|
|
62
|
+
_ref$theme = _ref.theme,
|
|
63
|
+
theme = _ref$theme === void 0 ? 'light' : _ref$theme,
|
|
64
|
+
themeConfig = _ref.themeConfig;
|
|
65
|
+
var holderRef = React.useRef(null);
|
|
66
|
+
// 主题
|
|
67
|
+
var appTheme = theme === 'dark' ? darkTheme : defaultTheme;
|
|
68
|
+
|
|
69
|
+
// 合并token
|
|
70
|
+
var token = _objectSpread(_objectSpread(_objectSpread({}, appTheme.token), themeConfig === null || themeConfig === void 0 ? void 0 : themeConfig.token), {}, {
|
|
71
|
+
_appTheme: theme
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// 暗黑模式背景色
|
|
75
|
+
if (theme === 'dark') token.colorBgContainer = 'rgb(36, 37, 37)';
|
|
76
|
+
return /*#__PURE__*/_jsx(ConfigProvider, {
|
|
77
|
+
locale: zhCN,
|
|
78
|
+
theme: _objectSpread(_objectSpread({}, appTheme), {}, {
|
|
79
|
+
token: token,
|
|
80
|
+
components: _objectSpread(_objectSpread({}, appTheme.components), themeConfig === null || themeConfig === void 0 ? void 0 : themeConfig.components)
|
|
81
|
+
}),
|
|
82
|
+
children: /*#__PURE__*/_jsxs(AppConfigContext.Provider, {
|
|
83
|
+
value: {
|
|
84
|
+
theme: theme,
|
|
85
|
+
themeConfig: themeConfig,
|
|
86
|
+
holderRef: holderRef
|
|
87
|
+
},
|
|
88
|
+
children: [children, /*#__PURE__*/_jsx(AppDialog, {}), /*#__PURE__*/_jsx(ElementsHolder, {
|
|
89
|
+
ref: holderRef
|
|
90
|
+
}, "modal-drawer-holder")]
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
export default function CssAppConfig(props) {
|
|
95
|
+
return /*#__PURE__*/_jsx(App, {
|
|
96
|
+
style: {
|
|
97
|
+
height: '100%'
|
|
9
98
|
},
|
|
10
|
-
children:
|
|
99
|
+
children: /*#__PURE__*/_jsx(AppConfig, _objectSpread({}, props))
|
|
11
100
|
});
|
|
12
|
-
}
|
|
101
|
+
}
|
package/es/context/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { TabPaneProps } from 'antd';
|
|
1
|
+
import { TabPaneProps, ThemeConfig } from 'antd';
|
|
2
2
|
import { Store } from 'antd/es/form/interface';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Location } from 'react-router';
|
|
5
5
|
import CCS from '..';
|
|
6
|
+
import { ElementsHolderRef } from '../dialog/hook';
|
|
6
7
|
type CcsTabsChangeProps = {
|
|
7
8
|
/** 当前激活tab面板的key */
|
|
8
9
|
activeKey?: string;
|
|
@@ -41,19 +42,22 @@ type PageContextType = {
|
|
|
41
42
|
/** 获取按钮权限 */
|
|
42
43
|
onAuth: (code: string) => boolean;
|
|
43
44
|
};
|
|
44
|
-
type GlobalContextPropsType = {
|
|
45
|
-
userDetail: CCS.UserDetail;
|
|
46
|
-
children: React.ReactElement;
|
|
47
|
-
};
|
|
48
|
-
type GlobalContextType = Omit<GlobalContextPropsType, 'children'>;
|
|
49
45
|
type FnContextType<T = Store> = {
|
|
50
46
|
locationKey: string;
|
|
51
47
|
formInitialValues: T;
|
|
52
48
|
close: () => void;
|
|
53
49
|
};
|
|
54
|
-
|
|
50
|
+
type CssAppConfigType = {
|
|
51
|
+
/** 主题 */
|
|
52
|
+
theme?: 'dark' | 'light' | 'colorful';
|
|
53
|
+
/** 主题参数配置 */
|
|
54
|
+
themeConfig?: ThemeConfig;
|
|
55
|
+
/** modal or drawer holder */
|
|
56
|
+
holderRef?: React.RefObject<ElementsHolderRef>;
|
|
57
|
+
};
|
|
55
58
|
declare const DrawerAndModalContext: React.Context<FnContextType<any>>;
|
|
56
59
|
declare const PageContext: React.Context<PageContextType>;
|
|
57
60
|
declare const TabsContext: React.Context<CcsTabsContextType>;
|
|
58
|
-
|
|
59
|
-
export
|
|
61
|
+
declare const AppConfigContext: React.Context<CssAppConfigType>;
|
|
62
|
+
export { AppConfigContext, DrawerAndModalContext, PageContext, TabsContext };
|
|
63
|
+
export type { CcsTabsChangeProps, CcsTabsContextType, CssAppConfigType, FnContextType, };
|
package/es/context/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { createContext } from 'react';
|
|
2
|
-
var GlobalContext = /*#__PURE__*/createContext({});
|
|
3
2
|
var DrawerAndModalContext = /*#__PURE__*/createContext({});
|
|
4
3
|
var PageContext = /*#__PURE__*/createContext({});
|
|
5
4
|
var TabsContext = /*#__PURE__*/React.createContext({});
|
|
6
|
-
|
|
5
|
+
var AppConfigContext = /*#__PURE__*/React.createContext({});
|
|
6
|
+
export { AppConfigContext, DrawerAndModalContext, PageContext, TabsContext };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FormProps } from 'antd';
|
|
2
2
|
import { DialogFormRef } from './form';
|
|
3
3
|
import { CcsDialogModalProps } from './hook';
|
|
4
|
-
declare const DialogSelfOkButton: ({ auth, formRef, extraBtn, formInitialValues, onCancel, onOk, }: Pick<CcsDialogModalProps, "auth" | "
|
|
4
|
+
declare const DialogSelfOkButton: ({ auth, formRef, extraBtn, formInitialValues, onCancel, onOk, }: Pick<CcsDialogModalProps, "auth" | "onCancel" | "onOk" | "extraBtn"> & {
|
|
5
5
|
formRef: React.RefObject<DialogFormRef>;
|
|
6
6
|
formInitialValues: FormProps['initialValues'];
|
|
7
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/es/dialog/button.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PropsWithNodeChildren } from '../ccs';
|
|
2
3
|
import { CcsDialogModalProps } from './hook';
|
|
3
|
-
export type DialogButtonsProps = Pick<CcsDialogModalProps, 'okText' | 'onCancel' | 'cancelText' | 'onOk'> & {
|
|
4
|
+
export type DialogButtonsProps = Pick<CcsDialogModalProps, 'okText' | 'onCancel' | 'cancelText' | 'onOk'> & PropsWithNodeChildren & {
|
|
4
5
|
okAuth?: string;
|
|
5
6
|
loading?: boolean;
|
|
6
|
-
children?: ReactNode;
|
|
7
7
|
hideCancel?: boolean;
|
|
8
8
|
};
|
|
9
9
|
export type DialogButtonRef = {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type DialogButtonsProps = {
|
|
1
|
+
import { PropsWithNodeChildren } from '../ccs';
|
|
2
|
+
type DialogButtonsProps = PropsWithNodeChildren & {
|
|
3
3
|
okText?: string;
|
|
4
4
|
cancelText?: string;
|
|
5
5
|
okAuth?: string;
|
|
6
6
|
loading?: boolean;
|
|
7
|
-
children?: ReactNode;
|
|
8
7
|
hideCancel?: boolean;
|
|
9
8
|
onOk?: (values?: any) => void;
|
|
10
9
|
};
|
package/es/dialog/hook.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DrawerProps, FormProps, ModalFuncProps } from 'antd';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
|
+
import usePatchElement from './usePatchElement';
|
|
3
4
|
export type CcsDialogModal = {
|
|
4
5
|
destroy: () => void;
|
|
5
6
|
update: (config: CcsDialogModalProps) => void;
|
|
@@ -59,5 +60,8 @@ export type CcsDialogType = {
|
|
|
59
60
|
openModal: (props: CcsDialogModalProps) => ReturnType<ModalDialog>;
|
|
60
61
|
contextHolder: React.JSX.Element;
|
|
61
62
|
};
|
|
63
|
+
export type ElementsHolderRef = {
|
|
64
|
+
patchElement: ReturnType<typeof usePatchElement>[1];
|
|
65
|
+
};
|
|
62
66
|
export default function useCcsDialog(): CcsDialogType;
|
|
63
67
|
export {};
|
package/es/dialog/hook.js
CHANGED
|
@@ -13,6 +13,7 @@ import CcsUtils from '@ccs-ui/utils';
|
|
|
13
13
|
import _debounce from 'lodash.debounce';
|
|
14
14
|
import React from 'react';
|
|
15
15
|
import { createRoot } from 'react-dom/client';
|
|
16
|
+
import useAppConfig from "../hooks/use-app";
|
|
16
17
|
import HookDrawer from "./HookDrawer";
|
|
17
18
|
import HookModal from "./HookModal";
|
|
18
19
|
import usePatchElement from "./usePatchElement";
|
|
@@ -44,6 +45,8 @@ export default function useCcsDialog() {
|
|
|
44
45
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
45
46
|
actionQueue = _React$useState2[0],
|
|
46
47
|
setActionQueue = _React$useState2[1];
|
|
48
|
+
var appConfig = useAppConfig() || {};
|
|
49
|
+
var $holderRef = appConfig.holderRef || holderRef;
|
|
47
50
|
React.useEffect(function () {
|
|
48
51
|
if (actionQueue.length) {
|
|
49
52
|
var cloneQueue = _toConsumableArray(actionQueue);
|
|
@@ -68,11 +71,11 @@ export default function useCcsDialog() {
|
|
|
68
71
|
},
|
|
69
72
|
ref: modalRef
|
|
70
73
|
}, "modal-".concat(modalUuid));
|
|
71
|
-
if (holderRef.current) {
|
|
74
|
+
if ($holderRef.current) {
|
|
72
75
|
// 加载了contextHolder
|
|
73
|
-
closeFunc = holderRef.current.patchElement(modal);
|
|
76
|
+
closeFunc = $holderRef.current.patchElement(modal);
|
|
74
77
|
} else {
|
|
75
|
-
CcsUtils.showWarning(
|
|
78
|
+
CcsUtils.showWarning(false, "\u672A\u5C06contextHolder\u63D2\u5165\u7EC4\u4EF6\u4E2D\uFF0C\u5C06\u65E0\u6CD5\u9002\u914Dantd\u4E3B\u9898\u914D\u7F6E\u548C\u83B7\u53D6context\u3002");
|
|
76
79
|
// 未加载contextHolder,创建dom
|
|
77
80
|
var dialogEle = document.createElement('div');
|
|
78
81
|
document.body.append(dialogEle);
|
|
@@ -131,12 +134,12 @@ export default function useCcsDialog() {
|
|
|
131
134
|
},
|
|
132
135
|
ref: modalRef
|
|
133
136
|
}, "drawer-".concat(drawerUuid));
|
|
134
|
-
if (holderRef.current) {
|
|
135
|
-
var
|
|
137
|
+
if ($holderRef.current) {
|
|
138
|
+
var _$holderRef$current;
|
|
136
139
|
// 加载了contextHolder
|
|
137
|
-
closeFunc = (
|
|
140
|
+
closeFunc = (_$holderRef$current = $holderRef.current) === null || _$holderRef$current === void 0 ? void 0 : _$holderRef$current.patchElement(modal);
|
|
138
141
|
} else {
|
|
139
|
-
CcsUtils.showWarning(true, "\u672A\u5C06contextHolder\u63D2\u5165\u7EC4\u4EF6\u4E2D\uFF0C\u5C06\u65E0\u6CD5\u9002\u914Dantd\u4E3B\u9898\u914D\u7F6E\u548C\u83B7\u53D6context\u3002");
|
|
142
|
+
CcsUtils.showWarning(true, "\u672A\u4F7F\u7528CssAppConfig\u5168\u5C40\u914D\u7F6E\u3001\u4E5F\u672A\u5C06contextHolder\u63D2\u5165\u7EC4\u4EF6\u4E2D\uFF0C\u5C06\u65E0\u6CD5\u9002\u914Dantd\u4E3B\u9898\u914D\u7F6E\u548C\u83B7\u53D6context\u3002");
|
|
140
143
|
// 未加载contextHolder,创建dom
|
|
141
144
|
var dialogEle = document.createElement('div');
|
|
142
145
|
document.body.append(dialogEle);
|
package/es/editor/index.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { ReactCodeMirrorProps } from '@uiw/react-codemirror';
|
|
2
|
-
import {
|
|
2
|
+
import { PropsWithCss } from '../ccs';
|
|
3
3
|
import './index.less';
|
|
4
4
|
import JavaScriptEditor from './javascript';
|
|
5
5
|
import JsonEditor from './json';
|
|
6
6
|
import SqlEditor from './sql';
|
|
7
|
-
export type EditorPropsType = Omit<ReactCodeMirrorProps, 'height'> & {
|
|
7
|
+
export type EditorPropsType = PropsWithCss & Omit<ReactCodeMirrorProps, 'height'> & {
|
|
8
8
|
value?: string;
|
|
9
|
-
className?: string;
|
|
10
|
-
style?: CSSProperties;
|
|
11
9
|
placeholder?: string;
|
|
12
10
|
bordered?: boolean;
|
|
13
11
|
isPreview?: boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { AppConfigContext } from "../context";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* app配置
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
var useAppConfig = function useAppConfig() {
|
|
9
|
+
var context = useContext(AppConfigContext);
|
|
10
|
+
if (context === undefined) {
|
|
11
|
+
throw new Error('AppConfigContext not found');
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
};
|
|
15
|
+
export default useAppConfig;
|
package/es/index.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ export { default as CcsAjCaptcha } from './aj-captcha';
|
|
|
2
2
|
export { default as CcsAuth } from './auth';
|
|
3
3
|
export { default as CcsApiCascader } from './cascader';
|
|
4
4
|
export { default as CcsColorPicker } from './color-picker';
|
|
5
|
-
export { default as
|
|
5
|
+
export { default as CcsAppConfig } from './config';
|
|
6
6
|
export { default as CcsDatePicker } from './date-picker';
|
|
7
7
|
export { default as CcsDialog } from './dialog';
|
|
8
8
|
export { default as CcsEditor } from './editor';
|
|
9
9
|
export { default as CcsLinesEllipsis } from './ellipsis';
|
|
10
10
|
export { default as CcsFullScreenButton } from './full-screen';
|
|
11
|
-
export { default as
|
|
11
|
+
export { default as useAppConfig } from './hooks/use-app';
|
|
12
12
|
export { default as useCcsOnceEvent } from './hooks/use-once-event';
|
|
13
13
|
export { default as useCcsPage } from './hooks/use-page';
|
|
14
14
|
export { default as useCcsTabs } from './hooks/use-tabs';
|
|
@@ -25,7 +25,6 @@ export { default as CcsResult } from './result';
|
|
|
25
25
|
export { default as CcsApiSelect } from './select';
|
|
26
26
|
export { default as CcsStatusTag } from './status-tag';
|
|
27
27
|
export { default as CcsTable } from './table';
|
|
28
|
-
export { default as CcsAppTheme } from './theme';
|
|
29
28
|
export { default as CcsTimePicker } from './time-picker';
|
|
30
29
|
export { default as CcsTrigger } from './trigger';
|
|
31
30
|
export { default as CcsUpload } from './upload';
|
package/es/index.js
CHANGED
|
@@ -2,13 +2,13 @@ export { default as CcsAjCaptcha } from "./aj-captcha";
|
|
|
2
2
|
export { default as CcsAuth } from "./auth";
|
|
3
3
|
export { default as CcsApiCascader } from "./cascader";
|
|
4
4
|
export { default as CcsColorPicker } from "./color-picker";
|
|
5
|
-
export { default as
|
|
5
|
+
export { default as CcsAppConfig } from "./config";
|
|
6
6
|
export { default as CcsDatePicker } from "./date-picker";
|
|
7
7
|
export { default as CcsDialog } from "./dialog";
|
|
8
8
|
export { default as CcsEditor } from "./editor";
|
|
9
9
|
export { default as CcsLinesEllipsis } from "./ellipsis";
|
|
10
10
|
export { default as CcsFullScreenButton } from "./full-screen";
|
|
11
|
-
export { default as
|
|
11
|
+
export { default as useAppConfig } from "./hooks/use-app";
|
|
12
12
|
export { default as useCcsOnceEvent } from "./hooks/use-once-event";
|
|
13
13
|
export { default as useCcsPage } from "./hooks/use-page";
|
|
14
14
|
export { default as useCcsTabs } from "./hooks/use-tabs";
|
|
@@ -25,7 +25,6 @@ export { default as CcsResult } from "./result";
|
|
|
25
25
|
export { default as CcsApiSelect } from "./select";
|
|
26
26
|
export { default as CcsStatusTag } from "./status-tag";
|
|
27
27
|
export { default as CcsTable } from "./table";
|
|
28
|
-
export { default as CcsAppTheme } from "./theme";
|
|
29
28
|
export { default as CcsTimePicker } from "./time-picker";
|
|
30
29
|
export { default as CcsTrigger } from "./trigger";
|
|
31
30
|
export { default as CcsUpload } from "./upload";
|