@ccs-ui/rc-pro 1.1.1-rc23 → 1.1.1-rc25
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/ccs.d.ts +26 -2
- package/es/dialog/index.d.ts +2 -1
- package/es/dialog/index.js +2 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/theme-dialog.d.ts +9 -0
- package/es/theme-dialog.js +25 -0
- package/es/theme.d.ts +11 -0
- package/es/theme.js +66 -0
- package/es/utils/index.js +4 -3
- package/package.json +1 -1
package/es/ccs.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ButtonProps } from 'antd';
|
|
1
|
+
import { ButtonProps, MenuProps, ThemeConfig } from 'antd';
|
|
2
2
|
import { Rule } from 'antd/es/form';
|
|
3
3
|
import { ColumnsType } from 'antd/es/table';
|
|
4
4
|
import { MutableRefObject, ReactElement, ReactNode } from 'react';
|
|
@@ -177,7 +177,31 @@ type TableFormItem = {
|
|
|
177
177
|
/** 格式化值 */
|
|
178
178
|
onFormat?: (e: any) => any;
|
|
179
179
|
};
|
|
180
|
+
type GlobalConfig = {
|
|
181
|
+
/** 项目名称 */
|
|
182
|
+
AppName: string;
|
|
183
|
+
/** 主题 */
|
|
184
|
+
AppTheme: 'default' | 'dark';
|
|
185
|
+
/** ant组件配置 */
|
|
186
|
+
AppThemeConfig: ThemeConfig;
|
|
187
|
+
/** 菜单展开模式 */
|
|
188
|
+
MenuExpandMode: MenuProps['mode'];
|
|
189
|
+
/** 菜单展开宽度 */
|
|
190
|
+
MenuExpandWidth: number;
|
|
191
|
+
/** 菜单收起宽度 */
|
|
192
|
+
MenuCollapsedWidth: number;
|
|
193
|
+
/** tabs缓存页 */
|
|
194
|
+
IsTabsPage: boolean;
|
|
195
|
+
/** http 请求通用前缀 */
|
|
196
|
+
Api: string;
|
|
197
|
+
/** 路由上下文 */
|
|
198
|
+
Context: string;
|
|
199
|
+
/** 图片上传地址 */
|
|
200
|
+
UploadUrl: string;
|
|
201
|
+
/** 图片下载地址 */
|
|
202
|
+
DownloadUrl: string;
|
|
203
|
+
};
|
|
180
204
|
type TableFormItems = TableFormItem[];
|
|
181
205
|
type TableInstanceRef<T = any> = MutableRefObject<TableInstance<T> | undefined> | React.RefObject<TableInstance<T>>;
|
|
182
206
|
type TableColumns<T = any> = ColumnsType<T>;
|
|
183
|
-
export type { PageType, RecordType, MenuTreeNode, PageQuery, ListQuery, HttpResult, HttpListResult, HttpPageResult, AuthButtonItem, MenuTreeNodeData, UserDetail, RouteHistory, TableData, TableFormItems, TableColumns, TableInstance, TableInstanceRef, TriggerChildrenProps, };
|
|
207
|
+
export type { PageType, RecordType, MenuTreeNode, PageQuery, ListQuery, HttpResult, GlobalConfig, HttpListResult, HttpPageResult, AuthButtonItem, MenuTreeNodeData, UserDetail, RouteHistory, TableData, TableFormItems, TableColumns, TableInstance, TableInstanceRef, TriggerChildrenProps, };
|
package/es/dialog/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import ThemeDialog from '../theme-dialog';
|
|
1
2
|
import CcsDialogButtons from './button';
|
|
2
3
|
import { useDialogContext } from './context';
|
|
3
4
|
import CcsDrawerFooter from './drawer-footer';
|
|
@@ -13,5 +14,5 @@ interface DialogInterface {
|
|
|
13
14
|
/** drawer footer */
|
|
14
15
|
DrawerFooter: typeof CcsDrawerFooter;
|
|
15
16
|
}
|
|
16
|
-
declare const CcsDialog: DialogInterface;
|
|
17
|
+
declare const CcsDialog: typeof ThemeDialog & DialogInterface;
|
|
17
18
|
export default CcsDialog;
|
package/es/dialog/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import ThemeDialog from "../theme-dialog";
|
|
1
2
|
import CcsDialogButtons from "./button";
|
|
2
3
|
import { useDialogContext } from "./context";
|
|
3
4
|
import CcsDrawerFooter from "./drawer-footer";
|
|
4
5
|
import useCcsDialog from "./hook";
|
|
5
6
|
import "./index.less";
|
|
6
|
-
var CcsDialog =
|
|
7
|
+
var CcsDialog = ThemeDialog;
|
|
7
8
|
CcsDialog.Buttons = CcsDialogButtons;
|
|
8
9
|
CcsDialog.useDialog = useCcsDialog;
|
|
9
10
|
CcsDialog.useInstance = useDialogContext;
|
package/es/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export { default as CcsProTabs } from './pro-tabs';
|
|
|
19
19
|
export { default as CcsApiSelect } from './select';
|
|
20
20
|
export { default as CcsStatusTag } from './status-tag';
|
|
21
21
|
export { default as CcsTable } from './table';
|
|
22
|
+
export { default as CcsAppTheme } from './theme';
|
|
22
23
|
export { default as CcsTimePicker } from './time-picker';
|
|
23
24
|
export { default as CcsTrigger } from './trigger';
|
|
24
25
|
export { default as CcsUpload } from './upload';
|
package/es/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export { default as CcsProTabs } from "./pro-tabs";
|
|
|
19
19
|
export { default as CcsApiSelect } from "./select";
|
|
20
20
|
export { default as CcsStatusTag } from "./status-tag";
|
|
21
21
|
export { default as CcsTable } from "./table";
|
|
22
|
+
export { default as CcsAppTheme } from "./theme";
|
|
22
23
|
export { default as CcsTimePicker } from "./time-picker";
|
|
23
24
|
export { default as CcsTrigger } from "./trigger";
|
|
24
25
|
export { default as CcsUpload } from "./upload";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MessageInstance } from 'antd/es/message/interface';
|
|
2
|
+
import { HookAPI } from 'antd/es/modal/useModal';
|
|
3
|
+
import { NotificationInstance } from 'antd/es/notification/interface';
|
|
4
|
+
export default class ThemeDialog {
|
|
5
|
+
static message: MessageInstance;
|
|
6
|
+
static notice: NotificationInstance;
|
|
7
|
+
static modal: HookAPI;
|
|
8
|
+
static setConfig(message: MessageInstance, notice: NotificationInstance, modal: HookAPI): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
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; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
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); }
|
|
8
|
+
var ThemeDialog = /*#__PURE__*/function () {
|
|
9
|
+
function ThemeDialog() {
|
|
10
|
+
_classCallCheck(this, ThemeDialog);
|
|
11
|
+
}
|
|
12
|
+
_createClass(ThemeDialog, null, [{
|
|
13
|
+
key: "setConfig",
|
|
14
|
+
value: function setConfig(message, notice, modal) {
|
|
15
|
+
this.message = message;
|
|
16
|
+
this.notice = notice;
|
|
17
|
+
this.modal = modal;
|
|
18
|
+
}
|
|
19
|
+
}]);
|
|
20
|
+
return ThemeDialog;
|
|
21
|
+
}();
|
|
22
|
+
_defineProperty(ThemeDialog, "message", void 0);
|
|
23
|
+
_defineProperty(ThemeDialog, "notice", void 0);
|
|
24
|
+
_defineProperty(ThemeDialog, "modal", void 0);
|
|
25
|
+
export { ThemeDialog as default };
|
package/es/theme.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ThemeConfig } from 'antd';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { GlobalConfig } from './ccs';
|
|
4
|
+
interface AppThemeProps {
|
|
5
|
+
theme: GlobalConfig['AppTheme'];
|
|
6
|
+
themeConfig?: ThemeConfig;
|
|
7
|
+
children: ReactElement;
|
|
8
|
+
}
|
|
9
|
+
/** 主题设置 */
|
|
10
|
+
export default function AppTheme({ theme, themeConfig, children, }: AppThemeProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
package/es/theme.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
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 { darkTheme, defaultTheme } from '@ant-design/compatible';
|
|
14
|
+
import { App, ConfigProvider, Modal, message, notification } from 'antd';
|
|
15
|
+
import zhCN from 'antd/locale/zh_CN';
|
|
16
|
+
import _merge from 'lodash/merge';
|
|
17
|
+
import { useEffect } from 'react';
|
|
18
|
+
import ThemeDialog from "./theme-dialog";
|
|
19
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
/** 主题设置 */
|
|
22
|
+
export default function AppTheme(_ref) {
|
|
23
|
+
var theme = _ref.theme,
|
|
24
|
+
themeConfig = _ref.themeConfig,
|
|
25
|
+
children = _ref.children;
|
|
26
|
+
var _message$useMessage = message.useMessage(),
|
|
27
|
+
_message$useMessage2 = _slicedToArray(_message$useMessage, 2),
|
|
28
|
+
messageApi = _message$useMessage2[0],
|
|
29
|
+
contextMsgHolder = _message$useMessage2[1];
|
|
30
|
+
var _notification$useNoti = notification.useNotification(),
|
|
31
|
+
_notification$useNoti2 = _slicedToArray(_notification$useNoti, 2),
|
|
32
|
+
noticeApi = _notification$useNoti2[0],
|
|
33
|
+
contextNotifHolder = _notification$useNoti2[1];
|
|
34
|
+
var _Modal$useModal = Modal.useModal(),
|
|
35
|
+
_Modal$useModal2 = _slicedToArray(_Modal$useModal, 2),
|
|
36
|
+
modalApi = _Modal$useModal2[0],
|
|
37
|
+
contextModalHolder = _Modal$useModal2[1];
|
|
38
|
+
useEffect(function () {
|
|
39
|
+
ThemeDialog.setConfig(messageApi, noticeApi, modalApi);
|
|
40
|
+
}, []);
|
|
41
|
+
|
|
42
|
+
// 主题
|
|
43
|
+
var appTheme = theme === 'default' ? defaultTheme : darkTheme;
|
|
44
|
+
// 合并token
|
|
45
|
+
var token = _objectSpread(_objectSpread({}, themeConfig === null || themeConfig === void 0 ? void 0 : themeConfig.token), {}, {
|
|
46
|
+
_appTheme: theme
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// 暗黑模式背景色
|
|
50
|
+
if (theme === 'dark') token.colorBgContainer = 'rgb(36, 37, 37)';
|
|
51
|
+
|
|
52
|
+
// 合并主题
|
|
53
|
+
var themes = _merge(appTheme, _objectSpread(_objectSpread({}, themeConfig), {}, {
|
|
54
|
+
token: token
|
|
55
|
+
}));
|
|
56
|
+
return /*#__PURE__*/_jsx(ConfigProvider, {
|
|
57
|
+
locale: zhCN,
|
|
58
|
+
theme: themes,
|
|
59
|
+
children: /*#__PURE__*/_jsxs(App, {
|
|
60
|
+
style: {
|
|
61
|
+
height: '100%'
|
|
62
|
+
},
|
|
63
|
+
children: [children, contextMsgHolder, contextNotifHolder, contextModalHolder]
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
}
|
package/es/utils/index.js
CHANGED
|
@@ -5,7 +5,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
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; }
|
|
6
6
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
7
|
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); }
|
|
8
|
-
import {
|
|
8
|
+
import { Modal } from 'antd';
|
|
9
9
|
import _dayjs from 'dayjs';
|
|
10
10
|
import zhCn from 'dayjs/locale/zh-cn';
|
|
11
11
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
@@ -15,6 +15,7 @@ import _isArray from 'lodash/isArray';
|
|
|
15
15
|
import _empty from 'lodash/isEmpty';
|
|
16
16
|
import _isObject from 'lodash/isObject';
|
|
17
17
|
import devWarning from 'rc-util/lib/warning';
|
|
18
|
+
import ThemeDialog from "../theme-dialog";
|
|
18
19
|
var confirm = Modal.confirm;
|
|
19
20
|
_dayjs.locale(zhCn);
|
|
20
21
|
_dayjs.extend(relativeTime);
|
|
@@ -186,9 +187,9 @@ var utils = /*#__PURE__*/function () {
|
|
|
186
187
|
key: "messageInfo",
|
|
187
188
|
value: function messageInfo(result, successText, failText) {
|
|
188
189
|
if (result.success) {
|
|
189
|
-
message.success(successText || '操作成功');
|
|
190
|
+
ThemeDialog.message.success(successText || '操作成功');
|
|
190
191
|
} else {
|
|
191
|
-
message.error(failText || result.msg || '操作失败');
|
|
192
|
+
ThemeDialog.message.error(failText || result.msg || '操作失败');
|
|
192
193
|
}
|
|
193
194
|
}
|
|
194
195
|
|