@oceanbase/design 0.2.16 → 0.2.18
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/dist/design.min.js +1 -1
- package/es/badge/index.d.ts +10 -0
- package/es/badge/index.js +58 -1
- package/es/badge/style/index.d.ts +9 -0
- package/es/badge/style/index.js +35 -0
- package/es/config-provider/index.d.ts +0 -1
- package/es/config-provider/index.js +12 -13
- package/es/config-provider/navigate.d.ts +2 -2
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/lib/badge/index.d.ts +10 -0
- package/lib/badge/index.js +79 -1
- package/lib/badge/style/index.d.ts +9 -0
- package/lib/badge/style/index.js +72 -0
- package/lib/config-provider/index.d.ts +0 -1
- package/lib/config-provider/index.js +24 -25
- package/lib/config-provider/navigate.d.ts +2 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/package.json +6 -7
package/es/badge/index.d.ts
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BadgeProps as AntBadgeProps } from 'antd/es/badge';
|
|
1
3
|
export * from 'antd/es/badge';
|
|
4
|
+
export interface BadgeProps extends AntBadgeProps {
|
|
5
|
+
icon?: boolean | React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const Badge: {
|
|
8
|
+
({ prefixCls: customizePrefixCls, className, status, text, icon, ...restProps }: BadgeProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
11
|
+
export default Badge;
|
package/es/badge/index.js
CHANGED
|
@@ -1 +1,58 @@
|
|
|
1
|
-
|
|
1
|
+
var _excluded = ["prefixCls", "className", "status", "text", "icon"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
import React, { useContext } from 'react';
|
|
6
|
+
import { Badge as AntBadge } from 'antd';
|
|
7
|
+
import { CloseCircleFilled, CheckCircleFilled, Loading3QuartersOutlined, StopFilled, ClockCircleFilled } from '@oceanbase/icons';
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
import ConfigProvider from "../config-provider";
|
|
10
|
+
import useStyle from "./style";
|
|
11
|
+
export * from 'antd/es/badge';
|
|
12
|
+
var Badge = function Badge(_ref) {
|
|
13
|
+
var customizePrefixCls = _ref.prefixCls,
|
|
14
|
+
className = _ref.className,
|
|
15
|
+
status = _ref.status,
|
|
16
|
+
text = _ref.text,
|
|
17
|
+
icon = _ref.icon,
|
|
18
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
var _useContext = useContext(ConfigProvider.ConfigContext),
|
|
20
|
+
getPrefixCls = _useContext.getPrefixCls,
|
|
21
|
+
iconPrefixCls = _useContext.iconPrefixCls;
|
|
22
|
+
var prefixCls = getPrefixCls('badge', customizePrefixCls);
|
|
23
|
+
var _useStyle = useStyle(prefixCls),
|
|
24
|
+
wrapSSR = _useStyle.wrapSSR,
|
|
25
|
+
hashId = _useStyle.hashId;
|
|
26
|
+
var badgeCls = classNames(prefixCls, className);
|
|
27
|
+
var iconMap = {
|
|
28
|
+
default: /*#__PURE__*/React.createElement(StopFilled, null),
|
|
29
|
+
processing: /*#__PURE__*/React.createElement(Loading3QuartersOutlined, {
|
|
30
|
+
style: {
|
|
31
|
+
display: 'inline-block'
|
|
32
|
+
},
|
|
33
|
+
className: "".concat(iconPrefixCls, "-spin")
|
|
34
|
+
}),
|
|
35
|
+
success: /*#__PURE__*/React.createElement(CheckCircleFilled, null),
|
|
36
|
+
error: /*#__PURE__*/React.createElement(CloseCircleFilled, null),
|
|
37
|
+
warning: /*#__PURE__*/React.createElement(ClockCircleFilled, null)
|
|
38
|
+
};
|
|
39
|
+
return wrapSSR( /*#__PURE__*/React.createElement(React.Fragment, null, status && icon ? /*#__PURE__*/React.createElement("span", _extends({
|
|
40
|
+
className: classNames(badgeCls, "".concat(prefixCls, "-status"), hashId),
|
|
41
|
+
style: {
|
|
42
|
+
display: 'inline-block'
|
|
43
|
+
}
|
|
44
|
+
}, restProps), /*#__PURE__*/React.createElement("span", {
|
|
45
|
+
className: classNames("".concat(prefixCls, "-status-icon"), "".concat(prefixCls, "-status-").concat(status))
|
|
46
|
+
}, /*#__PURE__*/React.isValidElement(icon) ? icon : iconMap[status]), text && /*#__PURE__*/React.createElement("span", {
|
|
47
|
+
className: "".concat(prefixCls, "-status-text")
|
|
48
|
+
}, text)) : /*#__PURE__*/React.createElement(AntBadge, _extends({
|
|
49
|
+
prefixCls: customizePrefixCls,
|
|
50
|
+
className: badgeCls,
|
|
51
|
+
status: status,
|
|
52
|
+
text: text
|
|
53
|
+
}, restProps))));
|
|
54
|
+
};
|
|
55
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
56
|
+
Badge.displayName = AntBadge.displayName;
|
|
57
|
+
}
|
|
58
|
+
export default Badge;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FullToken, GenerateStyle } from 'antd/es/theme/internal';
|
|
3
|
+
export type BadgeToken = FullToken<'Badge'>;
|
|
4
|
+
export declare const genBadgeStyle: GenerateStyle<BadgeToken>;
|
|
5
|
+
declare const _default: (prefixCls: string) => {
|
|
6
|
+
wrapSSR: (node: import("react").ReactNode) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
7
|
+
hashId: string;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
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 _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; }
|
|
3
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
|
+
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); }
|
|
5
|
+
import { genComponentStyleHook } from "../../_util/genComponentStyleHook";
|
|
6
|
+
export var genBadgeStyle = function genBadgeStyle(token) {
|
|
7
|
+
var _$concat, _$concat$concat;
|
|
8
|
+
var componentCls = token.componentCls;
|
|
9
|
+
return _defineProperty({}, "".concat(componentCls).concat(componentCls, "-status"), (_$concat$concat = {}, _defineProperty(_$concat$concat, "".concat(componentCls, "-status-dot"), {
|
|
10
|
+
width: 8,
|
|
11
|
+
height: 8
|
|
12
|
+
}), _defineProperty(_$concat$concat, "".concat(componentCls, "-status-icon"), (_$concat = {
|
|
13
|
+
fontSize: 12,
|
|
14
|
+
// remove dot style
|
|
15
|
+
backgroundColor: 'transparent'
|
|
16
|
+
}, _defineProperty(_$concat, '&::after', {
|
|
17
|
+
display: 'none'
|
|
18
|
+
}), _defineProperty(_$concat, "&".concat(componentCls, "-status-success"), {
|
|
19
|
+
color: token.colorSuccess
|
|
20
|
+
}), _defineProperty(_$concat, "&".concat(componentCls, "-status-processing"), {
|
|
21
|
+
color: token.colorPrimary
|
|
22
|
+
}), _defineProperty(_$concat, "&".concat(componentCls, "-status-default"), {
|
|
23
|
+
color: token.colorTextPlaceholder
|
|
24
|
+
}), _defineProperty(_$concat, "&".concat(componentCls, "-status-error"), {
|
|
25
|
+
color: token.colorError
|
|
26
|
+
}), _defineProperty(_$concat, "&".concat(componentCls, "-status-warning"), {
|
|
27
|
+
color: token.colorWarning
|
|
28
|
+
}), _$concat)), _$concat$concat));
|
|
29
|
+
};
|
|
30
|
+
export default (function (prefixCls) {
|
|
31
|
+
var useStyle = genComponentStyleHook('Badge', function (token) {
|
|
32
|
+
return [genBadgeStyle(token)];
|
|
33
|
+
});
|
|
34
|
+
return useStyle(prefixCls);
|
|
35
|
+
});
|
|
@@ -26,7 +26,6 @@ declare const ConfigProvider: {
|
|
|
26
26
|
({ children, theme, navigate, spin, ...restProps }: ConfigProviderProps): React.JSX.Element;
|
|
27
27
|
ConfigContext: React.Context<ConfigConsumerProps>;
|
|
28
28
|
ExtendedConfigContext: React.Context<ExtendedConfigConsumerProps>;
|
|
29
|
-
SizeContext: React.Context<import("antd/es/button").ButtonSize>;
|
|
30
29
|
config: ({ prefixCls, iconPrefixCls, theme, }: Pick<AntConfigProviderProps, "prefixCls" | "iconPrefixCls"> & {
|
|
31
30
|
theme?: AntThemeConfig | import("antd/es/config-provider/context").Theme;
|
|
32
31
|
}) => void;
|
|
@@ -10,6 +10,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
10
10
|
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; }
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import { App, ConfigProvider as AntConfigProvider } from 'antd';
|
|
13
|
+
import { merge } from 'lodash';
|
|
13
14
|
import StaticFunction from "../static-function";
|
|
14
15
|
import defaultTheme from "../theme";
|
|
15
16
|
import defaultThemeToken from "../theme/default";
|
|
@@ -20,37 +21,35 @@ var ExtendedConfigContext = /*#__PURE__*/React.createContext({
|
|
|
20
21
|
});
|
|
21
22
|
var defaultSeed = defaultTheme.defaultSeed,
|
|
22
23
|
components = defaultTheme.components;
|
|
23
|
-
|
|
24
|
-
// ConfigProvider 默认设置主题和内嵌 App,支持 message, notification 和 Modal 等静态方法消费 ConfigProvider 配置
|
|
25
|
-
// ref: https://ant.design/components/app-cn
|
|
26
24
|
var ConfigProvider = function ConfigProvider(_ref) {
|
|
27
|
-
var _theme$components;
|
|
28
25
|
var children = _ref.children,
|
|
29
26
|
theme = _ref.theme,
|
|
30
27
|
navigate = _ref.navigate,
|
|
31
28
|
spin = _ref.spin,
|
|
32
29
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
33
30
|
// inherit from parent ConfigProvider
|
|
34
|
-
var parentContext = React.useContext(
|
|
31
|
+
var parentContext = React.useContext(AntConfigProvider.ConfigContext);
|
|
32
|
+
var parentExtendedContext = React.useContext(ExtendedConfigContext);
|
|
35
33
|
return /*#__PURE__*/React.createElement(AntConfigProvider, _extends({
|
|
36
|
-
spin: spin,
|
|
37
|
-
theme:
|
|
34
|
+
spin: merge(parentContext.spin, spin),
|
|
35
|
+
theme: merge({
|
|
38
36
|
// Only set seed token for dark theme
|
|
39
37
|
// Because defaultThemeToken is designed for light theme
|
|
40
|
-
token: theme !== null && theme !== void 0 && theme.isDark ? _objectSpread(
|
|
41
|
-
components: _objectSpread(_objectSpread(
|
|
42
|
-
InputNumber: _objectSpread(
|
|
38
|
+
token: theme !== null && theme !== void 0 && theme.isDark ? _objectSpread({}, defaultSeed) : _objectSpread(_objectSpread({}, defaultSeed), defaultThemeToken),
|
|
39
|
+
components: _objectSpread(_objectSpread({}, components), {}, {
|
|
40
|
+
InputNumber: _objectSpread({}, components === null || components === void 0 ? void 0 : components.InputNumber)
|
|
43
41
|
})
|
|
44
|
-
})
|
|
42
|
+
}, parentContext.theme, theme)
|
|
45
43
|
}, restProps), /*#__PURE__*/React.createElement(ExtendedConfigContext.Provider, {
|
|
46
44
|
value: {
|
|
47
|
-
navigate: navigate === undefined ?
|
|
45
|
+
navigate: navigate === undefined ? parentExtendedContext.navigate : navigate
|
|
48
46
|
}
|
|
49
47
|
}, /*#__PURE__*/React.createElement(App, null, children, /*#__PURE__*/React.createElement(StaticFunction, null))));
|
|
50
48
|
};
|
|
51
49
|
ConfigProvider.ConfigContext = AntConfigProvider.ConfigContext;
|
|
52
50
|
ConfigProvider.ExtendedConfigContext = ExtendedConfigContext;
|
|
53
|
-
|
|
51
|
+
// SizeContext is deprecated
|
|
52
|
+
// ConfigProvider.SizeContext = AntConfigProvider.SizeContext;
|
|
54
53
|
ConfigProvider.config = AntConfigProvider.config;
|
|
55
54
|
ConfigProvider.useConfig = AntConfigProvider.useConfig;
|
|
56
55
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -16,7 +16,7 @@ export interface Path {
|
|
|
16
16
|
*/
|
|
17
17
|
hash: string;
|
|
18
18
|
}
|
|
19
|
-
export type To = string | Partial<Path
|
|
19
|
+
export type To = string | Partial<Path> | any;
|
|
20
20
|
export type RelativeRoutingType = 'route' | 'path';
|
|
21
21
|
export interface NavigateOptions {
|
|
22
22
|
replace?: boolean;
|
|
@@ -26,5 +26,5 @@ export interface NavigateOptions {
|
|
|
26
26
|
}
|
|
27
27
|
export interface NavigateFunction {
|
|
28
28
|
(to: To, options?: NavigateOptions): void;
|
|
29
|
-
(delta: number): void;
|
|
29
|
+
(delta: number | any): void;
|
|
30
30
|
}
|
package/es/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { default as theme } from './theme';
|
|
|
15
15
|
export { default as Tooltip } from './tooltip';
|
|
16
16
|
export { default as Breadcrumb } from './breadcrumb';
|
|
17
17
|
export { default as Spin } from './spin';
|
|
18
|
+
export { default as Badge } from './badge';
|
|
18
19
|
declare const useToken: () => {
|
|
19
20
|
theme: import("@ant-design/cssinjs").Theme<import("antd/es/theme/interface/seeds").SeedToken, import("antd/es/theme/interface").MapToken>;
|
|
20
21
|
token: import("antd").GlobalToken;
|
package/es/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export { default as theme } from "./theme";
|
|
|
19
19
|
export { default as Tooltip } from "./tooltip";
|
|
20
20
|
export { default as Breadcrumb } from "./breadcrumb";
|
|
21
21
|
export { default as Spin } from "./spin";
|
|
22
|
+
export { default as Badge } from "./badge";
|
|
22
23
|
var useToken = theme.useToken;
|
|
23
24
|
|
|
24
25
|
// 直接导出 useToken,方便上层使用
|
package/lib/badge/index.d.ts
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BadgeProps as AntBadgeProps } from 'antd/es/badge';
|
|
1
3
|
export * from 'antd/es/badge';
|
|
4
|
+
export interface BadgeProps extends AntBadgeProps {
|
|
5
|
+
icon?: boolean | React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const Badge: {
|
|
8
|
+
({ prefixCls: customizePrefixCls, className, status, text, icon, ...restProps }: BadgeProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
11
|
+
export default Badge;
|
package/lib/badge/index.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
5
11
|
var __copyProps = (to, from, except, desc) => {
|
|
6
12
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
13
|
for (let key of __getOwnPropNames(from))
|
|
@@ -11,12 +17,84 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
11
17
|
return to;
|
|
12
18
|
};
|
|
13
19
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
14
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
29
|
|
|
16
|
-
// src/badge/index.
|
|
30
|
+
// src/badge/index.tsx
|
|
17
31
|
var badge_exports = {};
|
|
32
|
+
__export(badge_exports, {
|
|
33
|
+
default: () => badge_default
|
|
34
|
+
});
|
|
18
35
|
module.exports = __toCommonJS(badge_exports);
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_antd = require("antd");
|
|
38
|
+
var import_icons = require("@oceanbase/icons");
|
|
39
|
+
var import_classnames = __toESM(require("classnames"));
|
|
40
|
+
var import_config_provider = __toESM(require("../config-provider"));
|
|
41
|
+
var import_style = __toESM(require("./style"));
|
|
19
42
|
__reExport(badge_exports, require("antd/es/badge"), module.exports);
|
|
43
|
+
var Badge = ({
|
|
44
|
+
prefixCls: customizePrefixCls,
|
|
45
|
+
className,
|
|
46
|
+
status,
|
|
47
|
+
text,
|
|
48
|
+
icon,
|
|
49
|
+
...restProps
|
|
50
|
+
}) => {
|
|
51
|
+
const { getPrefixCls, iconPrefixCls } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
|
|
52
|
+
const prefixCls = getPrefixCls("badge", customizePrefixCls);
|
|
53
|
+
const { wrapSSR, hashId } = (0, import_style.default)(prefixCls);
|
|
54
|
+
const badgeCls = (0, import_classnames.default)(prefixCls, className);
|
|
55
|
+
const iconMap = {
|
|
56
|
+
default: /* @__PURE__ */ import_react.default.createElement(import_icons.StopFilled, null),
|
|
57
|
+
processing: /* @__PURE__ */ import_react.default.createElement(
|
|
58
|
+
import_icons.Loading3QuartersOutlined,
|
|
59
|
+
{
|
|
60
|
+
style: {
|
|
61
|
+
display: "inline-block"
|
|
62
|
+
},
|
|
63
|
+
className: `${iconPrefixCls}-spin`
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
success: /* @__PURE__ */ import_react.default.createElement(import_icons.CheckCircleFilled, null),
|
|
67
|
+
error: /* @__PURE__ */ import_react.default.createElement(import_icons.CloseCircleFilled, null),
|
|
68
|
+
warning: /* @__PURE__ */ import_react.default.createElement(import_icons.ClockCircleFilled, null)
|
|
69
|
+
};
|
|
70
|
+
return wrapSSR(
|
|
71
|
+
/* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, status && icon ? /* @__PURE__ */ import_react.default.createElement(
|
|
72
|
+
"span",
|
|
73
|
+
{
|
|
74
|
+
className: (0, import_classnames.default)(badgeCls, `${prefixCls}-status`, hashId),
|
|
75
|
+
style: {
|
|
76
|
+
display: "inline-block"
|
|
77
|
+
},
|
|
78
|
+
...restProps
|
|
79
|
+
},
|
|
80
|
+
/* @__PURE__ */ import_react.default.createElement("span", { className: (0, import_classnames.default)(`${prefixCls}-status-icon`, `${prefixCls}-status-${status}`) }, import_react.default.isValidElement(icon) ? icon : iconMap[status]),
|
|
81
|
+
text && /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefixCls}-status-text` }, text)
|
|
82
|
+
) : /* @__PURE__ */ import_react.default.createElement(
|
|
83
|
+
import_antd.Badge,
|
|
84
|
+
{
|
|
85
|
+
prefixCls: customizePrefixCls,
|
|
86
|
+
className: badgeCls,
|
|
87
|
+
status,
|
|
88
|
+
text,
|
|
89
|
+
...restProps
|
|
90
|
+
}
|
|
91
|
+
))
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
if (process.env.NODE_ENV !== "production") {
|
|
95
|
+
Badge.displayName = import_antd.Badge.displayName;
|
|
96
|
+
}
|
|
97
|
+
var badge_default = Badge;
|
|
20
98
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21
99
|
0 && (module.exports = {
|
|
22
100
|
...require("antd/es/badge")
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FullToken, GenerateStyle } from 'antd/es/theme/internal';
|
|
3
|
+
export type BadgeToken = FullToken<'Badge'>;
|
|
4
|
+
export declare const genBadgeStyle: GenerateStyle<BadgeToken>;
|
|
5
|
+
declare const _default: (prefixCls: string) => {
|
|
6
|
+
wrapSSR: (node: import("react").ReactNode) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
7
|
+
hashId: string;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/badge/style/index.ts
|
|
20
|
+
var style_exports = {};
|
|
21
|
+
__export(style_exports, {
|
|
22
|
+
default: () => style_default,
|
|
23
|
+
genBadgeStyle: () => genBadgeStyle
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(style_exports);
|
|
26
|
+
var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
|
|
27
|
+
var genBadgeStyle = (token) => {
|
|
28
|
+
const { componentCls } = token;
|
|
29
|
+
return {
|
|
30
|
+
[`${componentCls}${componentCls}-status`]: {
|
|
31
|
+
// dot style
|
|
32
|
+
[`${componentCls}-status-dot`]: {
|
|
33
|
+
width: 8,
|
|
34
|
+
height: 8
|
|
35
|
+
},
|
|
36
|
+
// icon style
|
|
37
|
+
[`${componentCls}-status-icon`]: {
|
|
38
|
+
fontSize: 12,
|
|
39
|
+
// remove dot style
|
|
40
|
+
backgroundColor: "transparent",
|
|
41
|
+
["&::after"]: {
|
|
42
|
+
display: "none"
|
|
43
|
+
},
|
|
44
|
+
[`&${componentCls}-status-success`]: {
|
|
45
|
+
color: token.colorSuccess
|
|
46
|
+
},
|
|
47
|
+
[`&${componentCls}-status-processing`]: {
|
|
48
|
+
color: token.colorPrimary
|
|
49
|
+
},
|
|
50
|
+
[`&${componentCls}-status-default`]: {
|
|
51
|
+
color: token.colorTextPlaceholder
|
|
52
|
+
},
|
|
53
|
+
[`&${componentCls}-status-error`]: {
|
|
54
|
+
color: token.colorError
|
|
55
|
+
},
|
|
56
|
+
[`&${componentCls}-status-warning`]: {
|
|
57
|
+
color: token.colorWarning
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
var style_default = (prefixCls) => {
|
|
64
|
+
const useStyle = (0, import_genComponentStyleHook.genComponentStyleHook)("Badge", (token) => {
|
|
65
|
+
return [genBadgeStyle(token)];
|
|
66
|
+
});
|
|
67
|
+
return useStyle(prefixCls);
|
|
68
|
+
};
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {
|
|
71
|
+
genBadgeStyle
|
|
72
|
+
});
|
|
@@ -26,7 +26,6 @@ declare const ConfigProvider: {
|
|
|
26
26
|
({ children, theme, navigate, spin, ...restProps }: ConfigProviderProps): React.JSX.Element;
|
|
27
27
|
ConfigContext: React.Context<ConfigConsumerProps>;
|
|
28
28
|
ExtendedConfigContext: React.Context<ExtendedConfigConsumerProps>;
|
|
29
|
-
SizeContext: React.Context<import("antd/es/button").ButtonSize>;
|
|
30
29
|
config: ({ prefixCls, iconPrefixCls, theme, }: Pick<AntConfigProviderProps, "prefixCls" | "iconPrefixCls"> & {
|
|
31
30
|
theme?: AntThemeConfig | import("antd/es/config-provider/context").Theme;
|
|
32
31
|
}) => void;
|
|
@@ -35,6 +35,7 @@ __export(config_provider_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(config_provider_exports);
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var import_antd = require("antd");
|
|
38
|
+
var import_lodash = require("lodash");
|
|
38
39
|
var import_static_function = __toESM(require("../static-function"));
|
|
39
40
|
var import_theme = __toESM(require("../theme"));
|
|
40
41
|
var import_default = __toESM(require("../theme/default"));
|
|
@@ -45,40 +46,39 @@ var ExtendedConfigContext = import_react.default.createContext({
|
|
|
45
46
|
});
|
|
46
47
|
var { defaultSeed, components } = import_theme.default;
|
|
47
48
|
var ConfigProvider = ({ children, theme, navigate, spin, ...restProps }) => {
|
|
48
|
-
|
|
49
|
-
const
|
|
49
|
+
const parentContext = import_react.default.useContext(import_antd.ConfigProvider.ConfigContext);
|
|
50
|
+
const parentExtendedContext = import_react.default.useContext(ExtendedConfigContext);
|
|
50
51
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
51
52
|
import_antd.ConfigProvider,
|
|
52
53
|
{
|
|
53
|
-
spin,
|
|
54
|
-
theme:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
InputNumber: {
|
|
70
|
-
...components == null ? void 0 : components.InputNumber,
|
|
71
|
-
...(_a = theme == null ? void 0 : theme.components) == null ? void 0 : _a.InputNumber
|
|
54
|
+
spin: (0, import_lodash.merge)(parentContext.spin, spin),
|
|
55
|
+
theme: (0, import_lodash.merge)(
|
|
56
|
+
{
|
|
57
|
+
// Only set seed token for dark theme
|
|
58
|
+
// Because defaultThemeToken is designed for light theme
|
|
59
|
+
token: (theme == null ? void 0 : theme.isDark) ? {
|
|
60
|
+
...defaultSeed
|
|
61
|
+
} : {
|
|
62
|
+
...defaultSeed,
|
|
63
|
+
...import_default.default
|
|
64
|
+
},
|
|
65
|
+
components: {
|
|
66
|
+
...components,
|
|
67
|
+
InputNumber: {
|
|
68
|
+
...components == null ? void 0 : components.InputNumber
|
|
69
|
+
}
|
|
72
70
|
}
|
|
73
|
-
}
|
|
74
|
-
|
|
71
|
+
},
|
|
72
|
+
parentContext.theme,
|
|
73
|
+
theme
|
|
74
|
+
),
|
|
75
75
|
...restProps
|
|
76
76
|
},
|
|
77
77
|
/* @__PURE__ */ import_react.default.createElement(
|
|
78
78
|
ExtendedConfigContext.Provider,
|
|
79
79
|
{
|
|
80
80
|
value: {
|
|
81
|
-
navigate: navigate === void 0 ?
|
|
81
|
+
navigate: navigate === void 0 ? parentExtendedContext.navigate : navigate
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
/* @__PURE__ */ import_react.default.createElement(import_antd.App, null, children, /* @__PURE__ */ import_react.default.createElement(import_static_function.default, null))
|
|
@@ -87,7 +87,6 @@ var ConfigProvider = ({ children, theme, navigate, spin, ...restProps }) => {
|
|
|
87
87
|
};
|
|
88
88
|
ConfigProvider.ConfigContext = import_antd.ConfigProvider.ConfigContext;
|
|
89
89
|
ConfigProvider.ExtendedConfigContext = ExtendedConfigContext;
|
|
90
|
-
ConfigProvider.SizeContext = import_antd.ConfigProvider.SizeContext;
|
|
91
90
|
ConfigProvider.config = import_antd.ConfigProvider.config;
|
|
92
91
|
ConfigProvider.useConfig = import_antd.ConfigProvider.useConfig;
|
|
93
92
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -16,7 +16,7 @@ export interface Path {
|
|
|
16
16
|
*/
|
|
17
17
|
hash: string;
|
|
18
18
|
}
|
|
19
|
-
export type To = string | Partial<Path
|
|
19
|
+
export type To = string | Partial<Path> | any;
|
|
20
20
|
export type RelativeRoutingType = 'route' | 'path';
|
|
21
21
|
export interface NavigateOptions {
|
|
22
22
|
replace?: boolean;
|
|
@@ -26,5 +26,5 @@ export interface NavigateOptions {
|
|
|
26
26
|
}
|
|
27
27
|
export interface NavigateFunction {
|
|
28
28
|
(to: To, options?: NavigateOptions): void;
|
|
29
|
-
(delta: number): void;
|
|
29
|
+
(delta: number | any): void;
|
|
30
30
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { default as theme } from './theme';
|
|
|
15
15
|
export { default as Tooltip } from './tooltip';
|
|
16
16
|
export { default as Breadcrumb } from './breadcrumb';
|
|
17
17
|
export { default as Spin } from './spin';
|
|
18
|
+
export { default as Badge } from './badge';
|
|
18
19
|
declare const useToken: () => {
|
|
19
20
|
theme: import("@ant-design/cssinjs").Theme<import("antd/es/theme/interface/seeds").SeedToken, import("antd/es/theme/interface").MapToken>;
|
|
20
21
|
token: import("antd").GlobalToken;
|
package/lib/index.js
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
Alert: () => import_alert.default,
|
|
34
|
+
Badge: () => import_badge.default,
|
|
34
35
|
Breadcrumb: () => import_breadcrumb.default,
|
|
35
36
|
Button: () => import_button.default,
|
|
36
37
|
Card: () => import_card.default,
|
|
@@ -68,10 +69,12 @@ var import_theme = __toESM(require("./theme"));
|
|
|
68
69
|
var import_tooltip = __toESM(require("./tooltip"));
|
|
69
70
|
var import_breadcrumb = __toESM(require("./breadcrumb"));
|
|
70
71
|
var import_spin = __toESM(require("./spin"));
|
|
72
|
+
var import_badge = __toESM(require("./badge"));
|
|
71
73
|
var { useToken } = import_antd.theme;
|
|
72
74
|
// Annotate the CommonJS export names for ESM import in node:
|
|
73
75
|
0 && (module.exports = {
|
|
74
76
|
Alert,
|
|
77
|
+
Badge,
|
|
75
78
|
Breadcrumb,
|
|
76
79
|
Button,
|
|
77
80
|
Card,
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanbase/design",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.18",
|
|
4
4
|
"description": "The Design System of OceanBase",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"database",
|
|
6
|
+
"oceanbase",
|
|
8
7
|
"design",
|
|
9
8
|
"ui",
|
|
10
9
|
"react",
|
|
@@ -37,8 +36,8 @@
|
|
|
37
36
|
},
|
|
38
37
|
"dependencies": {
|
|
39
38
|
"@ant-design/cssinjs": "^1.17.0",
|
|
40
|
-
"@oceanbase/icons": "^0.2.
|
|
41
|
-
"@oceanbase/util": "^0.2.
|
|
39
|
+
"@oceanbase/icons": "^0.2.6",
|
|
40
|
+
"@oceanbase/util": "^0.2.8",
|
|
42
41
|
"ahooks": "^2.10.14",
|
|
43
42
|
"antd": "^5.9.0",
|
|
44
43
|
"classnames": "^2.3.2",
|
|
@@ -49,12 +48,12 @@
|
|
|
49
48
|
},
|
|
50
49
|
"devDependencies": {
|
|
51
50
|
"@babel/cli": "^7.22.15",
|
|
52
|
-
"@babel/preset-env": "^7.22.
|
|
51
|
+
"@babel/preset-env": "^7.22.20",
|
|
53
52
|
"antd-token-previewer": "^1.1.0"
|
|
54
53
|
},
|
|
55
54
|
"peerDependencies": {
|
|
56
55
|
"react": "^16.9.0",
|
|
57
56
|
"react-dom": "^16.9.0"
|
|
58
57
|
},
|
|
59
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "489ec76ca21b3a0448dae92fc001f2b03a4bf053"
|
|
60
59
|
}
|