@oceanbase/ui 0.4.12 → 0.4.14

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.
@@ -5,37 +5,29 @@
5
5
  align-items: center;
6
6
  justify-content: center;
7
7
  height: 100%;
8
- span {
9
- color: @colorTextTertiary;
10
- font-size: 14px;
11
- text-align: center;
12
- }
13
- .@{prefixCls}-btn-primary {
14
- span {
15
- color: #fff;
16
- }
17
- }
8
+
18
9
  .empty {
19
10
  display: flex;
20
11
  flex-direction: column;
21
12
  align-items: center;
22
13
  justify-content: center;
23
14
  padding-bottom: 60px;
24
- img {
15
+ > img {
25
16
  height: 102px;
26
17
  margin-bottom: 24px;
27
18
  }
28
- h4 {
19
+ > h4 {
29
20
  margin: 0;
30
- margin-bottom: 8px;
31
21
  font-size: 18px;
32
22
  }
33
- button {
23
+ > span {
24
+ margin-top: 8px;
25
+ color: @colorTextTertiary;
26
+ font-size: 14px;
27
+ text-align: center;
28
+ }
29
+ > button {
34
30
  margin-top: 24px;
35
- span {
36
- padding: 0 6px;
37
- font-size: 14px;
38
- }
39
31
  }
40
32
  }
41
33
  }
@@ -17,6 +17,7 @@ export interface PickerPanelProps {
17
17
  onOk: (v: RangeValue) => void;
18
18
  isMoment: boolean;
19
19
  disabledDate: any;
20
+ hideSecond?: boolean;
20
21
  locale: any;
21
22
  }
22
23
  declare const InternalPickerPanel: (props: PickerPanelProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -61,7 +61,8 @@ var InternalPickerPanel = function InternalPickerPanel(props) {
61
61
  onOk = _props$onOk === void 0 ? noop : _props$onOk,
62
62
  _props$onCancel = props.onCancel,
63
63
  onCancel = _props$onCancel === void 0 ? noop : _props$onCancel,
64
- disabledDate = props.disabledDate;
64
+ disabledDate = props.disabledDate,
65
+ hideSecond = props.hideSecond;
65
66
  var rootCls = useCSSVarCls(prefixCls);
66
67
  var _useStyle = useStyle(prefixCls, rootCls),
67
68
  _useStyle2 = _slicedToArray(_useStyle, 3),
@@ -247,7 +248,7 @@ var InternalPickerPanel = function InternalPickerPanel(props) {
247
248
  width: '100%'
248
249
  },
249
250
  format: {
250
- format: 'HH:mm:ss',
251
+ format: hideSecond ? 'HH:mm' : 'HH:mm:ss',
251
252
  type: 'mask'
252
253
  }
253
254
  })
@@ -323,7 +324,7 @@ var InternalPickerPanel = function InternalPickerPanel(props) {
323
324
  width: '100%'
324
325
  },
325
326
  format: {
326
- format: 'HH:mm:ss',
327
+ format: hideSecond ? 'HH:mm' : 'HH:mm:ss',
327
328
  type: 'mask'
328
329
  }
329
330
  })
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["selects", "value", "defaultValue", "defaultQuickValue", "hasRewind", "hasPlay", "hasSync", "hasForward", "hasZoomOut", "hasTagInPicker", "pastOnly", "simpleMode", "hideYear", "hideSecond", "autoCalcRange", "onChange", "disabledDate", "locale", "size", "stickRangeName", "tooltipProps", "isMoment", "rules", "tip", "autoAdjustOverflow", "overlayClassName", "overlayStyle"];
2
+ var _excluded = ["selects", "value", "defaultValue", "defaultQuickValue", "hasRewind", "hasPlay", "hasSync", "hasForward", "hasZoomOut", "hasTagInPicker", "pastOnly", "simpleMode", "hideYear", "hideSecond", "autoCalcRange", "onChange", "disabledDate", "locale", "size", "stickRangeName", "tooltipProps", "isMoment", "rules", "tip", "autoAdjustOverflow", "overlayClassName", "overlayStyle", "getPopupContainer"];
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -72,6 +72,7 @@ var Ranger = /*#__PURE__*/React.forwardRef(function (props, ref) {
72
72
  autoAdjustOverflow = props.autoAdjustOverflow,
73
73
  overlayClassName = props.overlayClassName,
74
74
  overlayStyle = props.overlayStyle,
75
+ getPopupContainer = props.getPopupContainer,
75
76
  rest = _objectWithoutProperties(props, _excluded);
76
77
  var _theme$useToken = theme.useToken(),
77
78
  token = _theme$useToken.token;
@@ -250,7 +251,7 @@ var Ranger = /*#__PURE__*/React.forwardRef(function (props, ref) {
250
251
  return diffMs > differenceMs;
251
252
  }) : selects[rangeNameIndex + 1];
252
253
  return /*#__PURE__*/_jsxs(Space, {
253
- className: classNames(_defineProperty(_defineProperty(_defineProperty({}, prefix, true), "".concat(prefix, "-show-range"), true), "".concat(prefix, "-back-radio-focused"), backRadioFocused)),
254
+ className: classNames(rest.className, _defineProperty(_defineProperty(_defineProperty({}, prefix, true), "".concat(prefix, "-show-range"), true), "".concat(prefix, "-back-radio-focused"), backRadioFocused)),
254
255
  style: rest.style,
255
256
  children: [/*#__PURE__*/_jsxs(Space, {
256
257
  size: 0,
@@ -260,10 +261,11 @@ var Ranger = /*#__PURE__*/React.forwardRef(function (props, ref) {
260
261
  trigger: ['click'],
261
262
  open: open,
262
263
  placement: rest.placement,
263
- autoAdjustOverflow: autoAdjustOverflow
264
+ autoAdjustOverflow: autoAdjustOverflow,
265
+ getPopupContainer: getPopupContainer
264
266
  // 关闭后进行销毁,才可以将 Tooltip 进行同步关闭
265
267
  ,
266
- destroyPopupOnHide: true
268
+ destroyOnHidden: true
267
269
  // 存在缓存,会锁死里面的值
268
270
  ,
269
271
  onOpenChange: function onOpenChange(o) {
@@ -272,7 +274,7 @@ var Ranger = /*#__PURE__*/React.forwardRef(function (props, ref) {
272
274
  }
273
275
  setOpen(o);
274
276
  },
275
- dropdownRender: function dropdownRender(originNode) {
277
+ popupRender: function popupRender(originNode) {
276
278
  return /*#__PURE__*/_jsxs("div", {
277
279
  className: classNames("".concat(prefix, "-dropdown-picker"), overlayClassName),
278
280
  style: overlayStyle,
@@ -291,6 +293,7 @@ var Ranger = /*#__PURE__*/React.forwardRef(function (props, ref) {
291
293
  tip: tip,
292
294
  isMoment: isMoment,
293
295
  rules: rules,
296
+ hideSecond: hideSecond,
294
297
  onOk: function onOk(vList) {
295
298
  setIsPlay(false);
296
299
  handleNameChange(CUSTOMIZE);
@@ -382,7 +385,7 @@ var Ranger = /*#__PURE__*/React.forwardRef(function (props, ref) {
382
385
  size: size,
383
386
  suffixIcon: null
384
387
  // 透传 props 到 antd Ranger
385
- }, omit(rest, 'value', 'onChange')), {}, {
388
+ }, omit(rest, 'value', 'onChange', 'style', 'className')), {}, {
386
389
  open: false
387
390
  }))
388
391
  })]
@@ -82,7 +82,7 @@
82
82
 
83
83
  .@{prefixCls}-dropdown-menu {
84
84
  padding: 0;
85
- box-shadow: none;
85
+ box-shadow: none !important;
86
86
  }
87
87
 
88
88
  .@{prefixCls}-picker-time-panel-container {
@@ -1,4 +1,5 @@
1
- import type { FormProps } from '@oceanbase/design/es/form';
1
+ import type { FormProps, InputProps } from '@oceanbase/design';
2
+ import type { PasswordProps } from '@oceanbase/design/es/input';
2
3
  import React from 'react';
3
4
  import type { LoginLocale } from '.';
4
5
  import './index.less';
@@ -15,6 +16,12 @@ export interface ILoginFormProps extends FormProps {
15
16
  authCodeImg?: string;
16
17
  otherLoginProps?: any;
17
18
  onAuthCodeImgChange?: () => void;
19
+ passwordOptional?: boolean;
20
+ componentProps?: {
21
+ username: InputProps;
22
+ password: PasswordProps;
23
+ authCode: InputProps;
24
+ };
18
25
  }
19
26
  declare const Login: React.FC<ILoginFormProps>;
20
27
  export default Login;
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["loading", "locale", "errorMessage", "showAuthCode", "showOtherLoginButton", "authCodeImg", "otherLoginProps", "onAuthCodeImgChange"];
2
+ var _excluded = ["loading", "locale", "errorMessage", "showAuthCode", "showOtherLoginButton", "authCodeImg", "otherLoginProps", "onAuthCodeImgChange", "componentProps", "passwordOptional"];
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -32,6 +32,9 @@ var Login = function Login(_ref) {
32
32
  authCodeImg = _ref.authCodeImg,
33
33
  otherLoginProps = _ref.otherLoginProps,
34
34
  onAuthCodeImgChange = _ref.onAuthCodeImgChange,
35
+ componentProps = _ref.componentProps,
36
+ _ref$passwordOptional = _ref.passwordOptional,
37
+ passwordOptional = _ref$passwordOptional === void 0 ? false : _ref$passwordOptional,
35
38
  restProps = _objectWithoutProperties(_ref, _excluded);
36
39
  var _theme$useToken = theme.useToken(),
37
40
  token = _theme$useToken.token;
@@ -59,7 +62,7 @@ var Login = function Login(_ref) {
59
62
  required: true,
60
63
  message: locale.usernameMessage
61
64
  }],
62
- children: /*#__PURE__*/_jsx(Input, {
65
+ children: /*#__PURE__*/_jsx(Input, _objectSpread({
63
66
  prefix: /*#__PURE__*/_jsx(UserOutlined, {
64
67
  style: {
65
68
  color: token.colorIcon
@@ -73,14 +76,14 @@ var Login = function Login(_ref) {
73
76
  setFocusInput('');
74
77
  },
75
78
  className: classNames(_defineProperty({}, "".concat(prefix, "-focus-input"), focusInput === 'username'))
76
- })
79
+ }, (componentProps === null || componentProps === void 0 ? void 0 : componentProps.username) || {}))
77
80
  }), /*#__PURE__*/_jsx(Form.Item, {
78
81
  name: "password",
79
- rules: [{
82
+ rules: passwordOptional ? [] : [{
80
83
  required: true,
81
84
  message: locale.passwordMessage
82
85
  }],
83
- children: /*#__PURE__*/_jsx(Input.Password, {
86
+ children: /*#__PURE__*/_jsx(Input.Password, _objectSpread({
84
87
  visibilityToggle: true,
85
88
  autoComplete: "current-password",
86
89
  prefix: /*#__PURE__*/_jsx(LockOutlined, {
@@ -96,7 +99,7 @@ var Login = function Login(_ref) {
96
99
  setFocusInput('');
97
100
  },
98
101
  className: focusInput === 'password' ? "".concat(prefix, "-focus-input") : ''
99
- })
102
+ }, (componentProps === null || componentProps === void 0 ? void 0 : componentProps.password) || {}))
100
103
  }), showAuthCode && /*#__PURE__*/_jsxs(Space, {
101
104
  className: "".concat(prefix, "-auth-code"),
102
105
  children: [/*#__PURE__*/_jsx(Form.Item, {
@@ -105,7 +108,7 @@ var Login = function Login(_ref) {
105
108
  required: true,
106
109
  message: '验证码不能为空'
107
110
  }],
108
- children: /*#__PURE__*/_jsx(Input, {
111
+ children: /*#__PURE__*/_jsx(Input, _objectSpread({
109
112
  prefix: /*#__PURE__*/_jsx(SafetyCertificateOutlined, {
110
113
  style: {
111
114
  color: token.colorIcon
@@ -119,7 +122,7 @@ var Login = function Login(_ref) {
119
122
  setFocusInput('');
120
123
  },
121
124
  className: classNames(_defineProperty({}, "".concat(prefix, "-focus-input"), focusInput === 'authCode'))
122
- })
125
+ }, (componentProps === null || componentProps === void 0 ? void 0 : componentProps.authCode) || {}))
123
126
  }), /*#__PURE__*/_jsxs("div", {
124
127
  className: classNames("".concat(prefix, "-code-btn")),
125
128
  children: [/*#__PURE__*/_jsx("img", {
@@ -102,7 +102,7 @@
102
102
  }
103
103
 
104
104
  // 覆盖 input:-internal-autofill-selected 自带背景色样式问题
105
- .@{prefixCls}-input {
105
+ .@{prefixCls}-input:not(.@{prefixCls}-input-disabled) {
106
106
  box-shadow: inset 0 0 0 1000px white !important;
107
107
  }
108
108
 
@@ -15,6 +15,7 @@ export interface PasswordLocale {
15
15
  export interface PasswordProps extends LocaleWrapperProps, Omit<InputPasswordProps, 'onChange'> {
16
16
  value?: string;
17
17
  onChange?: (value?: string) => void;
18
+ generatePassword?: () => string;
18
19
  rules?: Validator[];
19
20
  onValidate?: (passed: boolean) => void;
20
21
  generatePasswordRegex?: RegExp;
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["value", "locale", "rules", "onChange", "onValidate", "generatePasswordRegex"];
2
+ var _excluded = ["value", "locale", "rules", "onChange", "generatePassword", "onValidate", "generatePasswordRegex"];
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -29,6 +29,7 @@ var Password = function Password(_ref) {
29
29
  locale = _ref.locale,
30
30
  rules = _ref.rules,
31
31
  onChange = _ref.onChange,
32
+ generatePassword = _ref.generatePassword,
32
33
  onValidate = _ref.onValidate,
33
34
  generatePasswordRegex = _ref.generatePasswordRegex,
34
35
  restProps = _objectWithoutProperties(_ref, _excluded);
@@ -135,7 +136,11 @@ var Password = function Password(_ref) {
135
136
  }, restProps))
136
137
  }), generatePasswordRegex && /*#__PURE__*/_jsx(Button, {
137
138
  onClick: function onClick() {
138
- handleChange(getRandomPassword());
139
+ if (generatePassword instanceof Function) {
140
+ handleChange(generatePassword());
141
+ } else {
142
+ handleChange(getRandomPassword());
143
+ }
139
144
  },
140
145
  style: {
141
146
  marginLeft: 8
@@ -5,37 +5,29 @@
5
5
  align-items: center;
6
6
  justify-content: center;
7
7
  height: 100%;
8
- span {
9
- color: @colorTextTertiary;
10
- font-size: 14px;
11
- text-align: center;
12
- }
13
- .@{prefixCls}-btn-primary {
14
- span {
15
- color: #fff;
16
- }
17
- }
8
+
18
9
  .empty {
19
10
  display: flex;
20
11
  flex-direction: column;
21
12
  align-items: center;
22
13
  justify-content: center;
23
14
  padding-bottom: 60px;
24
- img {
15
+ > img {
25
16
  height: 102px;
26
17
  margin-bottom: 24px;
27
18
  }
28
- h4 {
19
+ > h4 {
29
20
  margin: 0;
30
- margin-bottom: 8px;
31
21
  font-size: 18px;
32
22
  }
33
- button {
23
+ > span {
24
+ margin-top: 8px;
25
+ color: @colorTextTertiary;
26
+ font-size: 14px;
27
+ text-align: center;
28
+ }
29
+ > button {
34
30
  margin-top: 24px;
35
- span {
36
- padding: 0 6px;
37
- font-size: 14px;
38
- }
39
31
  }
40
32
  }
41
33
  }
@@ -17,6 +17,7 @@ export interface PickerPanelProps {
17
17
  onOk: (v: RangeValue) => void;
18
18
  isMoment: boolean;
19
19
  disabledDate: any;
20
+ hideSecond?: boolean;
20
21
  locale: any;
21
22
  }
22
23
  declare const InternalPickerPanel: (props: PickerPanelProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -72,7 +72,8 @@ var InternalPickerPanel = (props) => {
72
72
  required = true,
73
73
  onOk = import_lodash.noop,
74
74
  onCancel = import_lodash.noop,
75
- disabledDate
75
+ disabledDate,
76
+ hideSecond
76
77
  } = props;
77
78
  const rootCls = (0, import_useCSSVarCls.default)(prefixCls);
78
79
  const [wrapCSSVar, hashId, cssVarCls] = (0, import_style.default)(prefixCls, rootCls);
@@ -200,7 +201,7 @@ var InternalPickerPanel = (props) => {
200
201
  getPopupContainer: (triggerNode) => triggerNode.parentNode,
201
202
  style: { width: "100%" },
202
203
  format: {
203
- format: "HH:mm:ss",
204
+ format: hideSecond ? "HH:mm" : "HH:mm:ss",
204
205
  type: "mask"
205
206
  }
206
207
  }
@@ -258,7 +259,7 @@ var InternalPickerPanel = (props) => {
258
259
  getPopupContainer: (triggerNode) => triggerNode.parentNode,
259
260
  style: { width: "100%" },
260
261
  format: {
261
- format: "HH:mm:ss",
262
+ format: hideSecond ? "HH:mm" : "HH:mm:ss",
262
263
  type: "mask"
263
264
  }
264
265
  }
@@ -85,6 +85,7 @@ var Ranger = import_react.default.forwardRef((props, ref) => {
85
85
  autoAdjustOverflow,
86
86
  overlayClassName,
87
87
  overlayStyle,
88
+ getPopupContainer,
88
89
  ...rest
89
90
  } = props;
90
91
  const { token } = import_design.theme.useToken();
@@ -230,7 +231,7 @@ var Ranger = import_react.default.forwardRef((props, ref) => {
230
231
  return /* @__PURE__ */ import_react.default.createElement(
231
232
  import_design.Space,
232
233
  {
233
- className: (0, import_classnames.default)({
234
+ className: (0, import_classnames.default)(rest.className, {
234
235
  [prefix]: true,
235
236
  [`${prefix}-show-range`]: true,
236
237
  [`${prefix}-back-radio-focused`]: backRadioFocused
@@ -251,14 +252,15 @@ var Ranger = import_react.default.forwardRef((props, ref) => {
251
252
  open,
252
253
  placement: rest.placement,
253
254
  autoAdjustOverflow,
254
- destroyPopupOnHide: true,
255
+ getPopupContainer,
256
+ destroyOnHidden: true,
255
257
  onOpenChange: (o) => {
256
258
  if (o === false && refState.current.tooltipOpen) {
257
259
  return;
258
260
  }
259
261
  setOpen(o);
260
262
  },
261
- dropdownRender: (originNode) => {
263
+ popupRender: (originNode) => {
262
264
  return /* @__PURE__ */ import_react.default.createElement(
263
265
  "div",
264
266
  {
@@ -276,6 +278,7 @@ var Ranger = import_react.default.forwardRef((props, ref) => {
276
278
  tip,
277
279
  isMoment,
278
280
  rules,
281
+ hideSecond,
279
282
  onOk: (vList) => {
280
283
  setIsPlay(false);
281
284
  handleNameChange(import_constant.CUSTOMIZE);
@@ -358,7 +361,7 @@ var Ranger = import_react.default.forwardRef((props, ref) => {
358
361
  allowClear: false,
359
362
  size,
360
363
  suffixIcon: null,
361
- ...(0, import_lodash.omit)(rest, "value", "onChange"),
364
+ ...(0, import_lodash.omit)(rest, "value", "onChange", "style", "className"),
362
365
  open: false
363
366
  }
364
367
  )
@@ -82,7 +82,7 @@
82
82
 
83
83
  .@{prefixCls}-dropdown-menu {
84
84
  padding: 0;
85
- box-shadow: none;
85
+ box-shadow: none !important;
86
86
  }
87
87
 
88
88
  .@{prefixCls}-picker-time-panel-container {
@@ -1,4 +1,5 @@
1
- import type { FormProps } from '@oceanbase/design/es/form';
1
+ import type { FormProps, InputProps } from '@oceanbase/design';
2
+ import type { PasswordProps } from '@oceanbase/design/es/input';
2
3
  import React from 'react';
3
4
  import type { LoginLocale } from '.';
4
5
  import './index.less';
@@ -15,6 +16,12 @@ export interface ILoginFormProps extends FormProps {
15
16
  authCodeImg?: string;
16
17
  otherLoginProps?: any;
17
18
  onAuthCodeImgChange?: () => void;
19
+ passwordOptional?: boolean;
20
+ componentProps?: {
21
+ username: InputProps;
22
+ password: PasswordProps;
23
+ authCode: InputProps;
24
+ };
18
25
  }
19
26
  declare const Login: React.FC<ILoginFormProps>;
20
27
  export default Login;
@@ -49,6 +49,8 @@ var Login = ({
49
49
  authCodeImg,
50
50
  otherLoginProps,
51
51
  onAuthCodeImgChange,
52
+ componentProps,
53
+ passwordOptional = false,
52
54
  ...restProps
53
55
  }) => {
54
56
  const { token } = import_design2.theme.useToken();
@@ -88,7 +90,8 @@ var Login = ({
88
90
  },
89
91
  className: (0, import_classnames.default)({
90
92
  [`${prefix}-focus-input`]: focusInput === "username"
91
- })
93
+ }),
94
+ ...(componentProps == null ? void 0 : componentProps.username) || {}
92
95
  }
93
96
  )
94
97
  ),
@@ -96,7 +99,7 @@ var Login = ({
96
99
  import_design.Form.Item,
97
100
  {
98
101
  name: "password",
99
- rules: [
102
+ rules: passwordOptional ? [] : [
100
103
  {
101
104
  required: true,
102
105
  message: locale.passwordMessage
@@ -116,7 +119,8 @@ var Login = ({
116
119
  onBlur: () => {
117
120
  setFocusInput("");
118
121
  },
119
- className: focusInput === "password" ? `${prefix}-focus-input` : ""
122
+ className: focusInput === "password" ? `${prefix}-focus-input` : "",
123
+ ...(componentProps == null ? void 0 : componentProps.password) || {}
120
124
  }
121
125
  )
122
126
  ),
@@ -144,7 +148,8 @@ var Login = ({
144
148
  },
145
149
  className: (0, import_classnames.default)({
146
150
  [`${prefix}-focus-input`]: focusInput === "authCode"
147
- })
151
+ }),
152
+ ...(componentProps == null ? void 0 : componentProps.authCode) || {}
148
153
  }
149
154
  )
150
155
  ), /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(`${prefix}-code-btn`) }, /* @__PURE__ */ import_react.default.createElement("img", { src: authCodeImg, alt: "", width: "96", height: "38" }), /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefix}-code-mask`, onClick: onAuthCodeImgChange }, /* @__PURE__ */ import_react.default.createElement(import_icons.SyncOutlined, null)))),
@@ -102,7 +102,7 @@
102
102
  }
103
103
 
104
104
  // 覆盖 input:-internal-autofill-selected 自带背景色样式问题
105
- .@{prefixCls}-input {
105
+ .@{prefixCls}-input:not(.@{prefixCls}-input-disabled) {
106
106
  box-shadow: inset 0 0 0 1000px white !important;
107
107
  }
108
108
 
@@ -15,6 +15,7 @@ export interface PasswordLocale {
15
15
  export interface PasswordProps extends LocaleWrapperProps, Omit<InputPasswordProps, 'onChange'> {
16
16
  value?: string;
17
17
  onChange?: (value?: string) => void;
18
+ generatePassword?: () => string;
18
19
  rules?: Validator[];
19
20
  onValidate?: (passed: boolean) => void;
20
21
  generatePasswordRegex?: RegExp;
@@ -45,6 +45,7 @@ var Password = ({
45
45
  locale,
46
46
  rules,
47
47
  onChange,
48
+ generatePassword,
48
49
  onValidate,
49
50
  generatePasswordRegex,
50
51
  ...restProps
@@ -134,7 +135,11 @@ var Password = ({
134
135
  import_design.Button,
135
136
  {
136
137
  onClick: () => {
137
- handleChange(getRandomPassword());
138
+ if (generatePassword instanceof Function) {
139
+ handleChange(generatePassword());
140
+ } else {
141
+ handleChange(getRandomPassword());
142
+ }
138
143
  },
139
144
  style: { marginLeft: 8 }
140
145
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oceanbase/ui",
3
- "version": "0.4.12",
3
+ "version": "0.4.14",
4
4
  "description": "The UI library based on OceanBase Design",
5
5
  "keywords": [
6
6
  "oceanbase",
@@ -42,9 +42,9 @@
42
42
  "@ant-design/cssinjs": "^1.23.0",
43
43
  "@ant-design/pro-components": "^2.8.7",
44
44
  "@antv/g6": "3.4.10",
45
- "@oceanbase/design": "^0.4.10",
45
+ "@oceanbase/design": "^0.4.11",
46
46
  "@oceanbase/icons": "^0.4.6",
47
- "@oceanbase/util": "^0.4.2",
47
+ "@oceanbase/util": "^0.4.3",
48
48
  "ahooks": "^2.10.14",
49
49
  "classnames": "^2.5.1",
50
50
  "dayjs": "^1.11.13",
@@ -71,5 +71,5 @@
71
71
  "react": ">=16.9.0",
72
72
  "react-dom": ">=16.9.0"
73
73
  },
74
- "gitHead": "db83d4b1d50b50813d9751f4e8c1189badf67820"
74
+ "gitHead": "c3f287cc3ed59f6483423ca1c1f09d65012b0d8f"
75
75
  }