@oceanbase/ui 0.2.13 → 0.2.15

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.
Files changed (124) hide show
  1. package/dist/ui.min.css +1 -1
  2. package/dist/ui.min.js +1 -1
  3. package/es/Action/Item.js +6 -8
  4. package/es/BackgroundTaskManager/index.d.ts +5 -5
  5. package/es/BackgroundTaskManager/index.js +1 -1
  6. package/es/BasicLayout/Header.d.ts +1 -1
  7. package/es/BasicLayout/Header.js +4 -4
  8. package/es/BasicLayout/index.d.ts +3 -2
  9. package/es/BasicLayout/index.js +6 -7
  10. package/es/BasicLayout/style/index.d.ts +7 -3
  11. package/es/BatchOperationBar/index.d.ts +3 -3
  12. package/es/Boundary/constant.d.ts +4 -4
  13. package/es/ContentWithIcon/index.d.ts +21 -0
  14. package/es/ContentWithIcon/index.js +110 -0
  15. package/{lib/ContentWithQuestion → es/ContentWithIcon}/index.less +5 -1
  16. package/es/DocDialog/index.js +1 -2
  17. package/es/FullscreenBox/index.d.ts +1 -1
  18. package/es/Highlight/index.d.ts +2 -2
  19. package/es/LocaleDropdown/index.d.ts +1 -1
  20. package/es/Login/ActivateForm.d.ts +1 -1
  21. package/es/Login/ActivateForm.js +5 -5
  22. package/es/Login/LoginForm.d.ts +1 -1
  23. package/es/Login/RegisterForm.d.ts +1 -1
  24. package/es/Login/RegisterForm.js +5 -5
  25. package/es/Login/index.d.ts +2 -2
  26. package/es/Lottie/index.d.ts +2 -1
  27. package/es/NavMenu/index.js +5 -6
  28. package/es/PageContainer/ItemRender.js +3 -3
  29. package/es/PageContainer/index.d.ts +2 -2
  30. package/es/PageContainer/index.js +2 -3
  31. package/es/PageContainer/style/index.d.ts +6 -2
  32. package/es/Password/index.d.ts +2 -2
  33. package/es/Ranger/QuickPicker.d.ts +2 -1
  34. package/es/Ranger/Ranger.d.ts +3 -3
  35. package/es/Ranger/index.d.ts +1 -32
  36. package/es/SideTip/index.d.ts +4 -4
  37. package/es/TagSelect/Group.d.ts +23 -0
  38. package/es/TagSelect/Group.js +121 -0
  39. package/es/TagSelect/Item.d.ts +17 -0
  40. package/es/TagSelect/Item.js +84 -0
  41. package/es/TagSelect/TagSelectContext.d.ts +13 -0
  42. package/es/TagSelect/TagSelectContext.js +3 -0
  43. package/es/TagSelect/index.d.ts +6 -0
  44. package/es/TagSelect/index.js +6 -0
  45. package/es/TagSelect/style/index.d.ts +9 -0
  46. package/es/TagSelect/style/index.js +98 -0
  47. package/es/TreeSearch/index.d.ts +1 -1
  48. package/es/Welcome/index.d.ts +2 -2
  49. package/es/_util/genComponentStyleHook.d.ts +6 -2
  50. package/es/_util/genComponentStyleHook.js +5 -5
  51. package/es/_util/useNavigate.d.ts +2 -0
  52. package/es/_util/useNavigate.js +7 -0
  53. package/es/index.d.ts +2 -1
  54. package/es/index.js +3 -2
  55. package/es/interface.d.ts +1 -1
  56. package/es/locale/en-US.js +2 -2
  57. package/es/locale/index.d.ts +2 -2
  58. package/es/locale/zh-CN.js +2 -2
  59. package/es/locale/zh-TW.js +2 -2
  60. package/lib/Action/Item.js +5 -7
  61. package/lib/BackgroundTaskManager/index.d.ts +5 -5
  62. package/lib/BackgroundTaskManager/index.js +1 -1
  63. package/lib/BasicLayout/Header.d.ts +1 -1
  64. package/lib/BasicLayout/Header.js +4 -4
  65. package/lib/BasicLayout/index.d.ts +3 -2
  66. package/lib/BasicLayout/index.js +6 -6
  67. package/lib/BasicLayout/style/index.d.ts +7 -3
  68. package/lib/BatchOperationBar/index.d.ts +3 -3
  69. package/lib/Boundary/constant.d.ts +4 -4
  70. package/lib/ContentWithIcon/index.d.ts +21 -0
  71. package/lib/ContentWithIcon/index.js +130 -0
  72. package/{es/ContentWithQuestion → lib/ContentWithIcon}/index.less +5 -1
  73. package/lib/DocDialog/index.js +1 -2
  74. package/lib/FullscreenBox/index.d.ts +1 -1
  75. package/lib/Highlight/index.d.ts +2 -2
  76. package/lib/LocaleDropdown/index.d.ts +1 -1
  77. package/lib/Login/ActivateForm.d.ts +1 -1
  78. package/lib/Login/ActivateForm.js +5 -5
  79. package/lib/Login/LoginForm.d.ts +1 -1
  80. package/lib/Login/RegisterForm.d.ts +1 -1
  81. package/lib/Login/RegisterForm.js +5 -5
  82. package/lib/Login/index.d.ts +2 -2
  83. package/lib/Lottie/index.d.ts +2 -1
  84. package/lib/NavMenu/index.js +5 -6
  85. package/lib/PageContainer/ItemRender.js +3 -3
  86. package/lib/PageContainer/index.d.ts +2 -2
  87. package/lib/PageContainer/index.js +2 -3
  88. package/lib/PageContainer/style/index.d.ts +6 -2
  89. package/lib/Password/index.d.ts +2 -2
  90. package/lib/Ranger/QuickPicker.d.ts +2 -1
  91. package/lib/Ranger/Ranger.d.ts +3 -3
  92. package/lib/Ranger/index.d.ts +1 -32
  93. package/lib/SideTip/index.d.ts +4 -4
  94. package/lib/TagSelect/Group.d.ts +23 -0
  95. package/lib/TagSelect/Group.js +128 -0
  96. package/lib/TagSelect/Item.d.ts +17 -0
  97. package/lib/TagSelect/Item.js +108 -0
  98. package/lib/TagSelect/TagSelectContext.d.ts +13 -0
  99. package/lib/TagSelect/TagSelectContext.js +27 -0
  100. package/lib/TagSelect/index.d.ts +6 -0
  101. package/lib/TagSelect/index.js +37 -0
  102. package/lib/TagSelect/style/index.d.ts +9 -0
  103. package/lib/TagSelect/style/index.js +152 -0
  104. package/lib/TreeSearch/index.d.ts +1 -1
  105. package/lib/Welcome/index.d.ts +2 -2
  106. package/lib/_util/genComponentStyleHook.d.ts +6 -2
  107. package/lib/_util/genComponentStyleHook.js +3 -3
  108. package/lib/_util/useNavigate.d.ts +2 -0
  109. package/lib/_util/{useHistory.js → useNavigate.js} +10 -11
  110. package/lib/index.d.ts +2 -1
  111. package/lib/index.js +6 -3
  112. package/lib/interface.d.ts +1 -1
  113. package/lib/locale/en-US.js +1 -1
  114. package/lib/locale/index.d.ts +2 -2
  115. package/lib/locale/zh-CN.js +1 -1
  116. package/lib/locale/zh-TW.js +1 -1
  117. package/package.json +10 -11
  118. package/es/ContentWithQuestion/index.d.ts +0 -13
  119. package/es/ContentWithQuestion/index.js +0 -46
  120. package/es/_util/useHistory.d.ts +0 -4
  121. package/es/_util/useHistory.js +0 -13
  122. package/lib/ContentWithQuestion/index.d.ts +0 -13
  123. package/lib/ContentWithQuestion/index.js +0 -76
  124. package/lib/_util/useHistory.d.ts +0 -4
@@ -1,4 +1,4 @@
1
- import type { PasswordProps as AntdPasswordProps } from 'antd/es/input';
1
+ import type { PasswordProps as InputPasswordProps } from '@oceanbase/design/es/input';
2
2
  import type { LocaleWrapperProps } from '../locale/LocaleWrapper';
3
3
  import type { Validator } from './Content';
4
4
  export interface PasswordLocale {
@@ -13,7 +13,7 @@ export interface PasswordLocale {
13
13
  copyPassword: string;
14
14
  andKeepItProperly: string;
15
15
  }
16
- export interface PasswordProps extends LocaleWrapperProps, Omit<AntdPasswordProps, 'onChange'> {
16
+ export interface PasswordProps extends LocaleWrapperProps, Omit<InputPasswordProps, 'onChange'> {
17
17
  value?: string;
18
18
  onChange?: (value?: string) => void;
19
19
  rules?: Validator[];
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import type { LocaleWrapperProps } from '../locale/LocaleWrapper';
3
3
  import type { RangeValue } from './Ranger';
4
4
  import type { RangeOption } from './typing';
5
- export declare type QuickType = 'select' | 'dropdown';
5
+ export type QuickType = 'select' | 'dropdown';
6
6
  interface IProps extends LocaleWrapperProps {
7
7
  selects: RangeOption[];
8
8
  type?: QuickType;
@@ -12,6 +12,7 @@ interface IProps extends LocaleWrapperProps {
12
12
  name?: string;
13
13
  defaultName?: string;
14
14
  isMoment?: boolean;
15
+ size?: 'small' | 'large' | 'middle';
15
16
  }
16
17
  declare const _default: (props: IProps) => React.JSX.Element;
17
18
  export default _default;
@@ -1,9 +1,9 @@
1
1
  import type { Dayjs } from 'dayjs';
2
2
  import type { Moment } from 'moment';
3
3
  import './index.less';
4
- export declare type RangeName = 'customize' | string;
5
- export declare type RangeValue = [Moment, Moment] | [Dayjs, Dayjs];
6
- export declare type RangeDateValue = {
4
+ export type RangeName = 'customize' | string;
5
+ export type RangeValue = [Moment, Moment] | [Dayjs, Dayjs];
6
+ export type RangeDateValue = {
7
7
  name: RangeName;
8
8
  range: RangeValue;
9
9
  };
@@ -1,33 +1,2 @@
1
- import QuickPicker from './QuickPicker';
2
- import InternalRanger from './Ranger';
3
- import type { RangeOption } from './typing';
4
- declare type InternalRangerType = typeof InternalRanger;
5
- interface RangerType extends InternalRangerType {
6
- NEAR_1_MINUTES: RangeOption;
7
- NEAR_5_MINUTES: RangeOption;
8
- NEAR_10_MINUTES: RangeOption;
9
- NEAR_20_MINUTES: RangeOption;
10
- NEAR_30_MINUTES: RangeOption;
11
- NEAR_1_HOURS: RangeOption;
12
- NEAR_2_HOURS: RangeOption;
13
- NEAR_3_HOURS: RangeOption;
14
- NEAR_6_HOURS: RangeOption;
15
- TODAY: RangeOption;
16
- YESTERDAY: RangeOption;
17
- TOMORROW: RangeOption;
18
- THIS_WEEK: RangeOption;
19
- LAST_WEEK: RangeOption;
20
- NEXT_WEEK: RangeOption;
21
- THIS_MONTH: RangeOption;
22
- LAST_MONTH: RangeOption;
23
- NEXT_MONTH: RangeOption;
24
- THIS_QUARTER: RangeOption;
25
- LAST_QUARTER: RangeOption;
26
- NEXT_QUARTER: RangeOption;
27
- THIS_YEAR: RangeOption;
28
- LAST_YEAR: RangeOption;
29
- NEXT_YEAR: RangeOption;
30
- QuickPicker: typeof QuickPicker;
31
- }
32
- declare const Ranger: RangerType;
1
+ declare const Ranger: any;
33
2
  export default Ranger;
@@ -1,10 +1,10 @@
1
- import type { BadgeProps } from 'antd/es/badge/index';
2
- import type { TooltipPropsWithTitle } from 'antd/es/tooltip/index';
1
+ import type { BadgeProps } from '@oceanbase/design/es/badge/index';
2
+ import type { TooltipPropsWithTitle } from '@oceanbase/design/es/tooltip/index';
3
3
  import React from 'react';
4
4
  import type { LocaleWrapperProps } from '../locale/LocaleWrapper';
5
5
  import './index.less';
6
- export declare type SideTipType = 'primary' | 'default';
7
- export declare type SideTipSize = 'small' | 'default';
6
+ export type SideTipType = 'primary' | 'default';
7
+ export type SideTipSize = 'small' | 'default';
8
8
  export interface Position {
9
9
  /**
10
10
  * @title 距离右侧
@@ -0,0 +1,23 @@
1
+ import React, { ReactNode } from 'react';
2
+ export type TagSelectValueType = string | number;
3
+ export interface TagSelectOptionType {
4
+ label: React.ReactNode;
5
+ value: TagSelectValueType;
6
+ style?: React.CSSProperties;
7
+ disabled?: boolean;
8
+ onChange?: (e: any) => void;
9
+ }
10
+ export interface TagSelectGroupProps {
11
+ title?: string;
12
+ children?: ReactNode;
13
+ disabled?: boolean;
14
+ className?: string;
15
+ multiple?: boolean;
16
+ defaultValue?: TagSelectValueType | Array<TagSelectValueType>;
17
+ value?: TagSelectValueType | Array<TagSelectValueType>;
18
+ size?: string;
19
+ options?: Array<TagSelectOptionType | string | number>;
20
+ onChange?: (value: Array<TagSelectValueType> | TagSelectValueType) => void;
21
+ }
22
+ declare const Group: React.FC<TagSelectGroupProps>;
23
+ export default Group;
@@ -0,0 +1,121 @@
1
+ var _excluded = ["title", "multiple", "defaultValue", "size", "options", "children", "className"];
2
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
+ 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."); }
8
+ 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); }
9
+ 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; }
10
+ 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; } }
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+ 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; }
13
+ 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; }
14
+ import classNames from 'classnames';
15
+ import { getPrefix } from "../_util";
16
+ import React, { useMemo, useState, useEffect } from 'react';
17
+ import TagSelectContext from "./TagSelectContext";
18
+ import Item from "./Item";
19
+ import useStyle from "./style";
20
+ function toArray(value) {
21
+ var res = value;
22
+ if (value === undefined) {
23
+ res = [];
24
+ } else if (!Array.isArray(value)) {
25
+ res = [value];
26
+ }
27
+ return res;
28
+ }
29
+ var Group = function Group(_ref) {
30
+ var title = _ref.title,
31
+ multiple = _ref.multiple,
32
+ defaultValue = _ref.defaultValue,
33
+ _ref$size = _ref.size,
34
+ size = _ref$size === void 0 ? 'middle' : _ref$size,
35
+ _ref$options = _ref.options,
36
+ options = _ref$options === void 0 ? [] : _ref$options,
37
+ children = _ref.children,
38
+ className = _ref.className,
39
+ restProps = _objectWithoutProperties(_ref, _excluded);
40
+ var prefix = getPrefix('tag-select');
41
+ var _useStyle = useStyle(prefix),
42
+ wrapSSR = _useStyle.wrapSSR,
43
+ hashId = _useStyle.hashId;
44
+ var _useState = useState(toArray(defaultValue || restProps.value)),
45
+ _useState2 = _slicedToArray(_useState, 2),
46
+ value = _useState2[0],
47
+ setValue = _useState2[1];
48
+ var _React$useState = React.useState([]),
49
+ _React$useState2 = _slicedToArray(_React$useState, 2),
50
+ registeredValues = _React$useState2[0],
51
+ setRegisteredValues = _React$useState2[1];
52
+ var registerValue = function registerValue(val) {
53
+ setRegisteredValues(function (prev) {
54
+ return [].concat(_toConsumableArray(prev), [val]);
55
+ });
56
+ };
57
+ useEffect(function () {
58
+ if ('value' in restProps) {
59
+ setValue(toArray(restProps.value));
60
+ }
61
+ }, [restProps.value]);
62
+ var handleValueChange = function handleValueChange(v) {
63
+ var _restProps$onChange;
64
+ var registeredValue = value.filter(function (v1) {
65
+ return registeredValues.includes(v1);
66
+ });
67
+ var newValue = _toConsumableArray(registeredValue);
68
+ var index = newValue.indexOf(v);
69
+ var checkedValue = index === -1 ? v : undefined;
70
+ if (multiple) {
71
+ if (index === -1) {
72
+ newValue.push(v);
73
+ } else {
74
+ newValue.splice(index, 1);
75
+ }
76
+ }
77
+ if (!('value' in restProps)) {
78
+ setValue(multiple ? newValue : [checkedValue]);
79
+ }
80
+ (_restProps$onChange = restProps.onChange) === null || _restProps$onChange === void 0 ? void 0 : _restProps$onChange.call(restProps, multiple ? newValue : checkedValue);
81
+ };
82
+ var contextValue = {
83
+ multiple: multiple,
84
+ size: size,
85
+ value: value,
86
+ disabled: restProps.disabled,
87
+ onChange: restProps.onChange,
88
+ registerValue: registerValue,
89
+ handleValueChange: handleValueChange
90
+ };
91
+ var memoOptions = useMemo(function () {
92
+ return options.map(function (option) {
93
+ if (typeof option === 'string' || typeof option === 'number') {
94
+ return {
95
+ label: option,
96
+ value: option
97
+ };
98
+ }
99
+ return option;
100
+ });
101
+ }, [options]);
102
+ var childrenNode = options.length ? memoOptions.map(function (option) {
103
+ return /*#__PURE__*/React.createElement(Item, {
104
+ key: option.value.toString(),
105
+ disabled: 'disabled' in option ? option.disabled : restProps.disabled,
106
+ value: option.value,
107
+ onChange: option.onChange,
108
+ style: option.style,
109
+ checked: value === null || value === void 0 ? void 0 : value.includes(option.value)
110
+ }, option.label);
111
+ }) : children;
112
+ var groupCls = classNames("".concat(prefix, "-container"), hashId, className);
113
+ return wrapSSR( /*#__PURE__*/React.createElement(TagSelectContext.Provider, {
114
+ value: contextValue
115
+ }, /*#__PURE__*/React.createElement("div", {
116
+ className: groupCls
117
+ }, /*#__PURE__*/React.createElement("div", {
118
+ className: "".concat(prefix, "-title")
119
+ }, title), childrenNode)));
120
+ };
121
+ export default Group;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import type { TagSelectValueType } from './Group';
3
+ export interface TagSelectItemProps {
4
+ children?: React.ReactNode;
5
+ cover?: React.ReactNode;
6
+ value?: string | number;
7
+ defaultChecked?: boolean;
8
+ checked?: boolean;
9
+ title?: string;
10
+ disabled?: boolean;
11
+ style?: React.CSSProperties;
12
+ multiple?: boolean;
13
+ handleChange?: (value: TagSelectValueType) => void;
14
+ onChange?: (e: any) => void;
15
+ }
16
+ declare const Item: React.FC<TagSelectItemProps>;
17
+ export default Item;
@@ -0,0 +1,84 @@
1
+ var _excluded = ["children", "handleChange", "onChange", "cover"];
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 _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; }
4
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
5
+ 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); }
6
+ 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); }
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
+ 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; }
14
+ 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; }
15
+ import RcCheckBox from 'rc-checkbox';
16
+ import classNames from 'classnames';
17
+ import { isBoolean } from 'lodash';
18
+ import React, { useEffect, useState } from 'react';
19
+ import useStyle from "./style";
20
+ import { getPrefix } from "../_util";
21
+ import TagSelectContext from "./TagSelectContext";
22
+ var Item = function Item(_ref) {
23
+ var _classNames;
24
+ var children = _ref.children,
25
+ handleChange = _ref.handleChange,
26
+ _onChange = _ref.onChange,
27
+ cover = _ref.cover,
28
+ restProps = _objectWithoutProperties(_ref, _excluded);
29
+ var _useState = useState(restProps.defaultChecked),
30
+ _useState2 = _slicedToArray(_useState, 2),
31
+ checked = _useState2[0],
32
+ setChecked = _useState2[1];
33
+ var coverType = _typeof(cover);
34
+ var prefixCls = getPrefix('tag-select');
35
+ var _useStyle = useStyle(prefixCls),
36
+ wrapSSR = _useStyle.wrapSSR,
37
+ hashId = _useStyle.hashId;
38
+ var tagSelectGroup = React.useContext(TagSelectContext);
39
+ var wrapperClassName = classNames("".concat(prefixCls, "-wrapper"), (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-checked"), checked), _defineProperty(_classNames, "multiple", tagSelectGroup.multiple), _defineProperty(_classNames, "".concat(prefixCls, "-").concat(tagSelectGroup.size), tagSelectGroup.size), _defineProperty(_classNames, "".concat(prefixCls, "-disabled"), tagSelectGroup.disabled || restProps.disabled), _defineProperty(_classNames, "".concat(prefixCls, "-img"), coverType === 'string'), _defineProperty(_classNames, "".concat(prefixCls, "-custom"), coverType !== 'string'), _classNames), hashId);
40
+ useEffect(function () {
41
+ if (isBoolean(restProps.checked)) {
42
+ setChecked(restProps.checked);
43
+ }
44
+ }, [restProps.checked]);
45
+ useEffect(function () {
46
+ var _tagSelectGroup$regis;
47
+ return (_tagSelectGroup$regis = tagSelectGroup.registerValue) === null || _tagSelectGroup$regis === void 0 ? void 0 : _tagSelectGroup$regis.call(tagSelectGroup, restProps.value);
48
+ }, [restProps.value]);
49
+ useEffect(function () {
50
+ var _tagSelectGroup$value;
51
+ if ((_tagSelectGroup$value = tagSelectGroup.value) !== null && _tagSelectGroup$value !== void 0 && _tagSelectGroup$value.includes(restProps.value) || restProps.checked || restProps.defaultChecked) {
52
+ setChecked(true);
53
+ } else {
54
+ setChecked(false);
55
+ }
56
+ }, [tagSelectGroup.value, restProps.value]);
57
+ var renderCover = function renderCover() {
58
+ return coverType === 'string' ? /*#__PURE__*/React.createElement("div", {
59
+ className: "".concat(prefixCls, "-cover")
60
+ }, /*#__PURE__*/React.createElement("img", {
61
+ src: cover,
62
+ alt: "tagselect"
63
+ })) : cover;
64
+ };
65
+ return wrapSSR( /*#__PURE__*/React.createElement("label", {
66
+ className: wrapperClassName,
67
+ style: restProps.style
68
+ }, /*#__PURE__*/React.createElement(RcCheckBox, _extends({}, restProps, {
69
+ checked: checked,
70
+ prefixCls: prefixCls,
71
+ onChange: function onChange(e) {
72
+ if (!('checked' in restProps) && !Object.keys(tagSelectGroup).length) {
73
+ setChecked(e.target.checked);
74
+ }
75
+ if (_onChange) {
76
+ _onChange(e);
77
+ }
78
+ if (tagSelectGroup.handleValueChange) {
79
+ tagSelectGroup.handleValueChange(e.target.value);
80
+ }
81
+ }
82
+ })), cover ? renderCover() : /*#__PURE__*/React.createElement("span", null, children)));
83
+ };
84
+ export default Item;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import type { TagSelectValueType } from './Group';
3
+ export type TagSelectContextProps = {
4
+ multiple?: boolean;
5
+ size?: string;
6
+ disabled?: boolean;
7
+ value?: Array<TagSelectValueType>;
8
+ onChange?: (value: Array<TagSelectValueType> | TagSelectValueType) => void;
9
+ registerValue?: (val: TagSelectValueType) => void;
10
+ handleValueChange?: (val: TagSelectValueType) => void;
11
+ };
12
+ declare const TagSelectContext: import("react").Context<TagSelectContextProps>;
13
+ export default TagSelectContext;
@@ -0,0 +1,3 @@
1
+ import { createContext } from 'react';
2
+ var TagSelectContext = /*#__PURE__*/createContext({});
3
+ export default TagSelectContext;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare const _default: {
3
+ Group: import("react").FC<import("./Group").TagSelectGroupProps>;
4
+ Item: import("react").FC<import("./Item").TagSelectItemProps>;
5
+ };
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import Group from "./Group";
2
+ import Item from "./Item";
3
+ export default {
4
+ Group: Group,
5
+ Item: Item
6
+ };
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { FullToken, GenerateStyle } from 'antd/lib/theme/internal';
3
+ export type TagSelectToken = FullToken<any>;
4
+ export declare const genTagSelectStyle: GenerateStyle<TagSelectToken>;
5
+ declare const _default: (prefixCls: string) => {
6
+ wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
7
+ hashId: string;
8
+ };
9
+ export default _default;
@@ -0,0 +1,98 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ import { genComponentStyleHook } from "../../_util/genComponentStyleHook";
8
+ var genSizeStyle = function genSizeStyle(height, fontSize) {
9
+ return {
10
+ paddingTop: "".concat(height, "px"),
11
+ paddingBottom: "".concat(height, "px"),
12
+ fontSize: fontSize
13
+ };
14
+ };
15
+ var genColoredStyle = function genColoredStyle(borderColor, backgroundColor, color) {
16
+ return {
17
+ borderColor: borderColor,
18
+ backgroundColor: backgroundColor,
19
+ color: color
20
+ };
21
+ };
22
+ var genMultipleStyle = function genMultipleStyle(color, token) {
23
+ return {
24
+ position: 'absolute',
25
+ top: '1px',
26
+ right: '1px',
27
+ borderTop: "12px solid ".concat(color),
28
+ borderLeft: "12px solid transparent",
29
+ borderTopRightRadius: token.borderRadiusSM
30
+ };
31
+ };
32
+ var genImgCoverStyle = function genImgCoverStyle(width, height) {
33
+ return {
34
+ width: width,
35
+ height: height
36
+ };
37
+ };
38
+ export var genTagSelectStyle = function genTagSelectStyle(token) {
39
+ var _$concat, _ref;
40
+ var componentCls = token.componentCls;
41
+ return _ref = {}, _defineProperty(_ref, "".concat(componentCls, "-title"), {
42
+ fontSize: token.fontSize,
43
+ color: token.colorText,
44
+ margin: "".concat(token.marginXXS, "px 0")
45
+ }), _defineProperty(_ref, "".concat(componentCls, "-wrapper"), (_$concat = {
46
+ position: 'relative',
47
+ display: 'inline-block',
48
+ fontSize: token.fontSize,
49
+ color: token.colorTextLabel,
50
+ background: token.colorWhite,
51
+ border: "".concat(token.lineWidth, "px ").concat(token.lineType, " ").concat(token.colorBorder),
52
+ borderRadius: token.borderRadius,
53
+ marginRight: token.marginXS,
54
+ padding: "".concat(token.paddingXXS, "px ").concat(token.paddingContentHorizontal, "px"),
55
+ cursor: 'pointer'
56
+ }, _defineProperty(_$concat, "".concat(componentCls, "-input"), {
57
+ width: 0,
58
+ height: 0,
59
+ opacity: 0,
60
+ pointerEvents: 'none'
61
+ }), _defineProperty(_$concat, '&:last-child', {
62
+ margin: 0
63
+ }), _defineProperty(_$concat, "&:has(".concat(componentCls, "-cover)"), _objectSpread({
64
+ padding: 0
65
+ }, genImgCoverStyle('76px', '40px'))), _$concat)), _defineProperty(_ref, "".concat(componentCls, "-cover"), {
66
+ display: 'inline-block',
67
+ width: '100%',
68
+ height: '100%',
69
+ img: {
70
+ height: 'calc(100% - 2px)',
71
+ width: 'calc(100% - 2px)',
72
+ borderRadius: token.borderRadius,
73
+ marginLeft: '1px',
74
+ marginTop: '1px'
75
+ }
76
+ }), _defineProperty(_ref, "".concat(componentCls, "-large").concat(componentCls, "-img"), _objectSpread(_objectSpread({}, genImgCoverStyle('228px', '120px')), {}, {
77
+ marginRight: '16px'
78
+ })), _defineProperty(_ref, "".concat(componentCls, "-small").concat(componentCls, "-img"), genImgCoverStyle('76px', '32px')), _defineProperty(_ref, "".concat(componentCls, "-large"), genSizeStyle(token.paddingContentVerticalSM, token.fontSize)), _defineProperty(_ref, "".concat(componentCls, "-small"), genSizeStyle(0, token.fontSize)), _defineProperty(_ref, "".concat(componentCls, "-wrapper:not(").concat(componentCls, "-disabled):hover"), {
79
+ color: token.colorPrimaryTextHover
80
+ }), _defineProperty(_ref, "".concat(componentCls, "-checked"), genColoredStyle(token.blue, token.colorPrimaryBg, token.colorPrimaryText)), _defineProperty(_ref, "".concat(componentCls, "-wrapper").concat(componentCls, "-checked:not(").concat(componentCls, "-disabled):focus-within"), {
81
+ boxShadow: "0 1px 3px 0px #000",
82
+ borderColor: "".concat(token.colorPrimary)
83
+ }), _defineProperty(_ref, "".concat(componentCls, "-checked:not(").concat(componentCls, "-disabled)"), {
84
+ '&:hover': _objectSpread(_objectSpread({}, genColoredStyle(token.colorInfoBorder, '#EBF1FF', token.colorInfoTextHover)), {}, _defineProperty({}, "".concat(componentCls, "-inner"), {
85
+ borderTopColor: "".concat(token.colorPrimaryTextHover, " !important")
86
+ }))
87
+ }), _defineProperty(_ref, "".concat(componentCls, "-disabled:not(").concat(componentCls, "-checked)"), _objectSpread(_objectSpread({}, genColoredStyle(token.colorBorder, '#F6F8FE', '#CDD5E3')), {}, {
88
+ cursor: 'not-allowed'
89
+ })), _defineProperty(_ref, "".concat(componentCls, "-disabled").concat(componentCls, "-checked"), _objectSpread({
90
+ cursor: 'not-allowed'
91
+ }, genColoredStyle(token.colorBorder, '#E2E8F3', token.colorTextTertiary))), _defineProperty(_ref, "".concat(componentCls, "-checked").concat(componentCls, "-disabled.multiple"), _defineProperty({}, "".concat(componentCls, "-inner"), genMultipleStyle('#CDD5E3', token))), _defineProperty(_ref, "".concat(componentCls, "-checked:not(").concat(componentCls, "-disabled).multiple"), _defineProperty({}, "".concat(componentCls, "-inner"), genMultipleStyle(token.colorPrimary, token))), _ref;
92
+ };
93
+ export default (function (prefixCls) {
94
+ var useStyle = genComponentStyleHook('TagSelect', function (token) {
95
+ return [genTagSelectStyle(token)];
96
+ });
97
+ return useStyle(prefixCls);
98
+ });
@@ -1,4 +1,4 @@
1
- import type { DataNode } from 'antd/es/tree';
1
+ import type { DataNode } from '@oceanbase/design/es/tree';
2
2
  import React from 'react';
3
3
  export interface Node {
4
4
  originTitle?: string;
@@ -1,4 +1,4 @@
1
- import type { ButtonProps } from 'antd/es/button';
1
+ import type { ButtonProps } from '@oceanbase/design/es/button';
2
2
  import React from 'react';
3
3
  import './index.less';
4
4
  export interface IntroduceItem {
@@ -19,7 +19,7 @@ export interface WelcomeLocale {
19
19
  helpTitle: string;
20
20
  defaultOperation: string;
21
21
  }
22
- export declare type StepType = 'default' | 'card';
22
+ export type StepType = 'default' | 'card';
23
23
  export interface WelcomeProps {
24
24
  title: string;
25
25
  description: string;
@@ -1,5 +1,6 @@
1
1
  import type { ProAliasToken } from '@ant-design/pro-components';
2
- import type { GenerateStyle } from 'antd/es/theme/internal';
2
+ import type { GenerateStyle } from '@oceanbase/design/es/theme';
3
+ import React from 'react';
3
4
  export interface OBToken extends ProAliasToken {
4
5
  /** Wrap component class with `.` prefix */
5
6
  componentCls: string;
@@ -11,4 +12,7 @@ export interface OBToken extends ProAliasToken {
11
12
  antCls: string;
12
13
  zIndexPopup: number;
13
14
  }
14
- export declare function genComponentStyleHook(componentName: string, styleFn: GenerateStyle<OBToken>): (prefixCls: string) => any;
15
+ export declare function genComponentStyleHook(componentName: string, styleFn: GenerateStyle<OBToken>): (prefixCls: string) => {
16
+ wrapSSR: (node: React.ReactElement<any, string | React.JSXElementConstructor<any>>) => React.JSX.Element;
17
+ hashId: string;
18
+ };
@@ -9,12 +9,12 @@ import React from 'react';
9
9
  import { ConfigProvider } from '@oceanbase/design';
10
10
  export function genComponentStyleHook(componentName, styleFn) {
11
11
  return function (prefixCls) {
12
+ var _React$useContext = React.useContext(ConfigProvider.ConfigContext),
13
+ getPrefixCls = _React$useContext.getPrefixCls,
14
+ iconPrefixCls = _React$useContext.iconPrefixCls;
15
+ var rootPrefixCls = getPrefixCls();
16
+ var componentCls = ".".concat(prefixCls);
12
17
  return useStyle(componentName, function (token) {
13
- var _React$useContext = React.useContext(ConfigProvider.ConfigContext),
14
- getPrefixCls = _React$useContext.getPrefixCls,
15
- iconPrefixCls = _React$useContext.iconPrefixCls;
16
- var rootPrefixCls = getPrefixCls();
17
- var componentCls = ".".concat(prefixCls);
18
18
  var mergedToken = _objectSpread(_objectSpread({}, token), {}, {
19
19
  componentCls: componentCls,
20
20
  prefixCls: prefixCls,
@@ -0,0 +1,2 @@
1
+ declare const _default: () => import("packages/design/es/config-provider").NavigateFunction;
2
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { useContext } from 'react';
2
+ import { ConfigProvider } from '@oceanbase/design';
3
+ export default (function () {
4
+ var _useContext = useContext(ConfigProvider.ExtendedConfigContext),
5
+ navigate = _useContext.navigate;
6
+ return navigate;
7
+ });
package/es/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export { default as BasicLayout } from './BasicLayout';
8
8
  export { default as BatchOperationBar } from './BatchOperationBar';
9
9
  export { default as Boundary } from './Boundary';
10
10
  export * from './constant';
11
- export { default as ContentWithQuestion } from './ContentWithQuestion';
11
+ export { default as ContentWithIcon } from './ContentWithIcon';
12
12
  export { default as Dialog } from './Dialog';
13
13
  export { default as DocDialog } from './DocDialog';
14
14
  export { default as FullscreenBox } from './FullscreenBox';
@@ -26,3 +26,4 @@ export { default as SideTip } from './SideTip';
26
26
  export { default as TaskGraph } from './TaskGraph';
27
27
  export { default as TreeSearch } from './TreeSearch';
28
28
  export { default as Welcome } from './Welcome';
29
+ export { default as TagSelect } from './TagSelect';
package/es/index.js CHANGED
@@ -7,7 +7,7 @@ export { default as BasicLayout } from "./BasicLayout";
7
7
  export { default as BatchOperationBar } from "./BatchOperationBar";
8
8
  export { default as Boundary } from "./Boundary";
9
9
  export * from "./constant";
10
- export { default as ContentWithQuestion } from "./ContentWithQuestion";
10
+ export { default as ContentWithIcon } from "./ContentWithIcon";
11
11
  export { default as Dialog } from "./Dialog";
12
12
  export { default as DocDialog } from "./DocDialog";
13
13
  export { default as FullscreenBox } from "./FullscreenBox";
@@ -24,4 +24,5 @@ export { default as Ranger } from "./Ranger";
24
24
  export { default as SideTip } from "./SideTip";
25
25
  export { default as TaskGraph } from "./TaskGraph";
26
26
  export { default as TreeSearch } from "./TreeSearch";
27
- export { default as Welcome } from "./Welcome";
27
+ export { default as Welcome } from "./Welcome";
28
+ export { default as TagSelect } from "./TagSelect";
package/es/interface.d.ts CHANGED
@@ -1 +1 @@
1
- export declare type Locale = 'zh-TW' | 'zh-CN' | 'en-US';
1
+ export type Locale = 'zh-TW' | 'zh-CN' | 'en-US';
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
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
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
- import antdEnUS from 'antd/es/locale/en_US';
7
+ import enUS from '@oceanbase/design/es/locale/en-US';
8
8
  import BasicLayout from "../BasicLayout/locale/en-US";
9
9
  import BatchOperationBar from "../BatchOperationBar/locale/en-US";
10
10
  import Boundary from "../Boundary/locale/en-US";
@@ -19,7 +19,7 @@ import Ranger from "../Ranger/locale/en-US";
19
19
  import SideTip from "../SideTip/locale/en-US";
20
20
  import TaskGraph from "../TaskGraph/locale/en-US";
21
21
  import Welcome from "../Welcome/locale/en-US";
22
- export default _objectSpread(_objectSpread({}, antdEnUS), {}, {
22
+ export default _objectSpread(_objectSpread({}, enUS), {}, {
23
23
  // 业务组件
24
24
  BasicLayout: BasicLayout,
25
25
  PageContainer: PageContainer,
@@ -1,4 +1,4 @@
1
- import type { Locale as AntLocale } from 'antd/es/locale';
2
- export interface Locale extends AntLocale {
1
+ import type { Locale as DesignLocale } from '@oceanbase/design/es/locale';
2
+ export interface Locale extends DesignLocale {
3
3
  [key: string]: any;
4
4
  }