@ccs-ui/rc-pro 1.1.1-rc25 → 1.1.1-rc27
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/theme-dialog.d.ts +14 -0
- package/es/theme-dialog.js +41 -0
- package/es/theme.d.ts +6 -0
- package/es/theme.js +8 -8
- package/es/utils/index.d.ts +0 -15
- package/es/utils/index.js +3 -48
- package/package.json +1 -1
package/es/theme-dialog.d.ts
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import { MessageInstance } from 'antd/es/message/interface';
|
|
2
2
|
import { HookAPI } from 'antd/es/modal/useModal';
|
|
3
3
|
import { NotificationInstance } from 'antd/es/notification/interface';
|
|
4
|
+
import CCS from '.';
|
|
4
5
|
export default class ThemeDialog {
|
|
5
6
|
static message: MessageInstance;
|
|
6
7
|
static notice: NotificationInstance;
|
|
7
8
|
static modal: HookAPI;
|
|
8
9
|
static setConfig(message: MessageInstance, notice: NotificationInstance, modal: HookAPI): void;
|
|
10
|
+
/**
|
|
11
|
+
* 接口结果反馈
|
|
12
|
+
* @param result // 结果
|
|
13
|
+
* @param successText // 成功提示
|
|
14
|
+
* @param failText // 失败提示
|
|
15
|
+
*/
|
|
16
|
+
static easyMessage(result: CCS.HttpResult, successText?: string, failText?: string): void;
|
|
17
|
+
/**
|
|
18
|
+
* 确认提示框
|
|
19
|
+
* @param content
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
static easyConfirm: (content?: string) => Promise<unknown>;
|
|
9
23
|
}
|
package/es/theme-dialog.js
CHANGED
|
@@ -16,10 +16,51 @@ var ThemeDialog = /*#__PURE__*/function () {
|
|
|
16
16
|
this.notice = notice;
|
|
17
17
|
this.modal = modal;
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 接口结果反馈
|
|
22
|
+
* @param result // 结果
|
|
23
|
+
* @param successText // 成功提示
|
|
24
|
+
* @param failText // 失败提示
|
|
25
|
+
*/
|
|
26
|
+
}, {
|
|
27
|
+
key: "easyMessage",
|
|
28
|
+
value: function easyMessage(result, successText, failText) {
|
|
29
|
+
if (result.success) {
|
|
30
|
+
ThemeDialog.message.success(successText || '操作成功');
|
|
31
|
+
} else {
|
|
32
|
+
ThemeDialog.message.error(failText || result.msg || '操作失败');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 确认提示框
|
|
38
|
+
* @param content
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
19
41
|
}]);
|
|
20
42
|
return ThemeDialog;
|
|
21
43
|
}();
|
|
22
44
|
_defineProperty(ThemeDialog, "message", void 0);
|
|
23
45
|
_defineProperty(ThemeDialog, "notice", void 0);
|
|
24
46
|
_defineProperty(ThemeDialog, "modal", void 0);
|
|
47
|
+
_defineProperty(ThemeDialog, "easyConfirm", function () {
|
|
48
|
+
var content = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
49
|
+
return new Promise(function (resolve) {
|
|
50
|
+
ThemeDialog.modal.confirm({
|
|
51
|
+
title: '操作确认',
|
|
52
|
+
content: content,
|
|
53
|
+
okText: '确定',
|
|
54
|
+
okType: 'danger',
|
|
55
|
+
cancelText: '取消',
|
|
56
|
+
centered: true,
|
|
57
|
+
onOk: function onOk() {
|
|
58
|
+
resolve(true);
|
|
59
|
+
},
|
|
60
|
+
onCancel: function onCancel() {
|
|
61
|
+
resolve(false);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
25
66
|
export { ThemeDialog as default };
|
package/es/theme.d.ts
CHANGED
|
@@ -7,5 +7,11 @@ interface AppThemeProps {
|
|
|
7
7
|
children: ReactElement;
|
|
8
8
|
}
|
|
9
9
|
/** 主题设置 */
|
|
10
|
+
interface AppThemeProps {
|
|
11
|
+
theme: GlobalConfig['AppTheme'];
|
|
12
|
+
themeConfig?: ThemeConfig;
|
|
13
|
+
children: ReactElement;
|
|
14
|
+
}
|
|
15
|
+
/** 主题设置 */
|
|
10
16
|
export default function AppTheme({ theme, themeConfig, children, }: AppThemeProps): import("react/jsx-runtime").JSX.Element;
|
|
11
17
|
export {};
|
package/es/theme.js
CHANGED
|
@@ -13,9 +13,10 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
import { darkTheme, defaultTheme } from '@ant-design/compatible';
|
|
14
14
|
import { App, ConfigProvider, Modal, message, notification } from 'antd';
|
|
15
15
|
import zhCN from 'antd/locale/zh_CN';
|
|
16
|
-
import _merge from 'lodash/merge';
|
|
17
16
|
import { useEffect } from 'react';
|
|
18
17
|
import ThemeDialog from "./theme-dialog";
|
|
18
|
+
|
|
19
|
+
/** 主题设置 */
|
|
19
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
22
|
/** 主题设置 */
|
|
@@ -41,21 +42,20 @@ export default function AppTheme(_ref) {
|
|
|
41
42
|
|
|
42
43
|
// 主题
|
|
43
44
|
var appTheme = theme === 'default' ? defaultTheme : darkTheme;
|
|
45
|
+
|
|
44
46
|
// 合并token
|
|
45
|
-
var token = _objectSpread(_objectSpread({}, themeConfig === null || themeConfig === void 0 ? void 0 : themeConfig.token), {}, {
|
|
47
|
+
var token = _objectSpread(_objectSpread(_objectSpread({}, appTheme.token), themeConfig === null || themeConfig === void 0 ? void 0 : themeConfig.token), {}, {
|
|
46
48
|
_appTheme: theme
|
|
47
49
|
});
|
|
48
50
|
|
|
49
51
|
// 暗黑模式背景色
|
|
50
52
|
if (theme === 'dark') token.colorBgContainer = 'rgb(36, 37, 37)';
|
|
51
|
-
|
|
52
|
-
// 合并主题
|
|
53
|
-
var themes = _merge(appTheme, _objectSpread(_objectSpread({}, themeConfig), {}, {
|
|
54
|
-
token: token
|
|
55
|
-
}));
|
|
56
53
|
return /*#__PURE__*/_jsx(ConfigProvider, {
|
|
57
54
|
locale: zhCN,
|
|
58
|
-
theme:
|
|
55
|
+
theme: _objectSpread(_objectSpread({}, appTheme), {}, {
|
|
56
|
+
token: token,
|
|
57
|
+
components: _objectSpread(_objectSpread({}, appTheme.components), themeConfig === null || themeConfig === void 0 ? void 0 : themeConfig.components)
|
|
58
|
+
}),
|
|
59
59
|
children: /*#__PURE__*/_jsxs(App, {
|
|
60
60
|
style: {
|
|
61
61
|
height: '100%'
|
package/es/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
|
-
import CCS from '..';
|
|
3
2
|
interface DayjsType extends dayjs.Dayjs {
|
|
4
3
|
fromNow(withoutSuffix?: boolean): string;
|
|
5
4
|
from(compared: dayjs.ConfigType, withoutSuffix?: boolean): string;
|
|
@@ -83,13 +82,6 @@ export default class utils {
|
|
|
83
82
|
* @param {*} str
|
|
84
83
|
*/
|
|
85
84
|
static stringToHex(str: string): string;
|
|
86
|
-
/**
|
|
87
|
-
* 根据HttpResult返回结果提示成功或失败
|
|
88
|
-
* @param result
|
|
89
|
-
* @param successText
|
|
90
|
-
* @param failText
|
|
91
|
-
*/
|
|
92
|
-
static messageInfo(result: CCS.HttpResult, successText?: string, failText?: string): void;
|
|
93
85
|
/**
|
|
94
86
|
* string to dayjs
|
|
95
87
|
* @param val
|
|
@@ -97,13 +89,6 @@ export default class utils {
|
|
|
97
89
|
* @returns
|
|
98
90
|
*/
|
|
99
91
|
static dayjsFmt(val: string | undefined, formartType?: string): dayjs.Dayjs | undefined;
|
|
100
|
-
/**
|
|
101
|
-
* 确认提示框
|
|
102
|
-
* @param title
|
|
103
|
-
* @param content
|
|
104
|
-
* @returns
|
|
105
|
-
*/
|
|
106
|
-
static showConfirm: (title: string, content?: string) => Promise<unknown>;
|
|
107
92
|
/**
|
|
108
93
|
* 空对象?
|
|
109
94
|
* @param obj
|
package/es/utils/index.js
CHANGED
|
@@ -5,7 +5,6 @@ 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 { Modal } from 'antd';
|
|
9
8
|
import _dayjs from 'dayjs';
|
|
10
9
|
import zhCn from 'dayjs/locale/zh-cn';
|
|
11
10
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
@@ -15,8 +14,6 @@ import _isArray from 'lodash/isArray';
|
|
|
15
14
|
import _empty from 'lodash/isEmpty';
|
|
16
15
|
import _isObject from 'lodash/isObject';
|
|
17
16
|
import devWarning from 'rc-util/lib/warning';
|
|
18
|
-
import ThemeDialog from "../theme-dialog";
|
|
19
|
-
var confirm = Modal.confirm;
|
|
20
17
|
_dayjs.locale(zhCn);
|
|
21
18
|
_dayjs.extend(relativeTime);
|
|
22
19
|
var utils = /*#__PURE__*/function () {
|
|
@@ -177,22 +174,6 @@ var utils = /*#__PURE__*/function () {
|
|
|
177
174
|
return hexCharCode.join('').toUpperCase();
|
|
178
175
|
}
|
|
179
176
|
|
|
180
|
-
/**
|
|
181
|
-
* 根据HttpResult返回结果提示成功或失败
|
|
182
|
-
* @param result
|
|
183
|
-
* @param successText
|
|
184
|
-
* @param failText
|
|
185
|
-
*/
|
|
186
|
-
}, {
|
|
187
|
-
key: "messageInfo",
|
|
188
|
-
value: function messageInfo(result, successText, failText) {
|
|
189
|
-
if (result.success) {
|
|
190
|
-
ThemeDialog.message.success(successText || '操作成功');
|
|
191
|
-
} else {
|
|
192
|
-
ThemeDialog.message.error(failText || result.msg || '操作失败');
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
177
|
/**
|
|
197
178
|
* string to dayjs
|
|
198
179
|
* @param val
|
|
@@ -209,21 +190,14 @@ var utils = /*#__PURE__*/function () {
|
|
|
209
190
|
return _dayjs(val);
|
|
210
191
|
}
|
|
211
192
|
|
|
212
|
-
/**
|
|
213
|
-
* 确认提示框
|
|
214
|
-
* @param title
|
|
215
|
-
* @param content
|
|
216
|
-
* @returns
|
|
217
|
-
*/
|
|
218
|
-
}, {
|
|
219
|
-
key: "objIsEmpty",
|
|
220
|
-
value:
|
|
221
193
|
/**
|
|
222
194
|
* 空对象?
|
|
223
195
|
* @param obj
|
|
224
196
|
* @returns
|
|
225
197
|
*/
|
|
226
|
-
|
|
198
|
+
}, {
|
|
199
|
+
key: "objIsEmpty",
|
|
200
|
+
value: function objIsEmpty(obj) {
|
|
227
201
|
if (!obj) return true;
|
|
228
202
|
return Object.keys(obj).length === 0;
|
|
229
203
|
}
|
|
@@ -262,23 +236,4 @@ _defineProperty(utils, "isEmpty", function (val) {
|
|
|
262
236
|
_defineProperty(utils, "isNotEmpty", function (val) {
|
|
263
237
|
return !utils.isEmpty(val);
|
|
264
238
|
});
|
|
265
|
-
_defineProperty(utils, "showConfirm", function (title) {
|
|
266
|
-
var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
267
|
-
return new Promise(function (resolve) {
|
|
268
|
-
confirm({
|
|
269
|
-
title: title,
|
|
270
|
-
content: content,
|
|
271
|
-
okText: '确定',
|
|
272
|
-
okType: 'danger',
|
|
273
|
-
cancelText: '取消',
|
|
274
|
-
centered: true,
|
|
275
|
-
onOk: function onOk() {
|
|
276
|
-
resolve(true);
|
|
277
|
-
},
|
|
278
|
-
onCancel: function onCancel() {
|
|
279
|
-
resolve(false);
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
});
|
|
283
|
-
});
|
|
284
239
|
export { utils as default };
|