@aloudata/aloudata-design 1.6.2 → 1.6.3

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.
@@ -1,4 +1,5 @@
1
- var _excluded = ["className"];
1
+ var _excluded = ["className", "disabled"],
2
+ _excluded2 = ["className", "disabled"];
2
3
 
3
4
  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); }
4
5
 
@@ -7,18 +8,35 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
7
8
  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; }
8
9
 
9
10
  import { Checkbox as AntdCheckbox } from 'antd';
11
+ import DisabledContext from 'antd/lib/config-provider/DisabledContext';
10
12
  import classNames from 'classnames';
11
13
  import React from 'react';
12
14
  import CheckboxGroup from "./component/CheckboxGroup";
13
15
 
14
16
  function Checkbox(props) {
15
17
  var className = props.className,
18
+ customDisabled = props.disabled,
16
19
  otherProps = _objectWithoutProperties(props, _excluded);
17
20
 
21
+ var disabled = React.useContext(DisabledContext);
22
+ var mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
18
23
  return /*#__PURE__*/React.createElement(AntdCheckbox, _extends({
19
- className: classNames('ald-checkbox', className)
24
+ className: classNames('ald-checkbox', className),
25
+ disabled: mergedDisabled
20
26
  }, otherProps));
21
27
  }
22
28
 
23
- Checkbox.Group = CheckboxGroup;
29
+ Checkbox.Group = function Group(props) {
30
+ var className = props.className,
31
+ customDisabled = props.disabled,
32
+ otherProps = _objectWithoutProperties(props, _excluded2);
33
+
34
+ var disabled = React.useContext(DisabledContext);
35
+ var mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
36
+ return /*#__PURE__*/React.createElement(CheckboxGroup, _extends({
37
+ className: classNames('ald-checkbox-group', className),
38
+ disabled: mergedDisabled
39
+ }, otherProps));
40
+ };
41
+
24
42
  export default Checkbox;
@@ -34,7 +34,7 @@ export interface ICheckboxProps extends CheckboxProps {
34
34
  * @type boolean
35
35
  * @default false
36
36
  */
37
- indeterminate?: false;
37
+ indeterminate?: boolean;
38
38
  /**
39
39
  * @description 变化时的回调函数
40
40
  * @type function(e:Event)
@@ -84,7 +84,7 @@ export interface ICheckboxGroupProps extends CheckboxGroupProps {
84
84
  * @type 'vertical' | 'horizontal'
85
85
  * @default -
86
86
  */
87
- direction: EDirection.VERTICAL;
87
+ direction?: 'vertical' | 'horizontal';
88
88
  /**
89
89
  * @description className
90
90
  * @type string
@@ -10,11 +10,15 @@ declare const AldForm: <Values = any>(props: FormProps<Values> & {
10
10
  children?: React.ReactNode;
11
11
  } & {
12
12
  ref?: React.Ref<FormInstance<Values>> | undefined;
13
+ labelWidth?: number | undefined;
13
14
  }) => React.ReactElement;
15
+ interface IFormItemProps extends FormItemProps {
16
+ labelWidth?: number;
17
+ }
14
18
  declare const AldFormItem: {
15
- (props: FormItemProps): JSX.Element;
19
+ (props: IFormItemProps): JSX.Element;
16
20
  useStatus: () => {
17
- status?: "" | "error" | "success" | "warning" | "validating" | undefined;
21
+ status?: "" | "warning" | "error" | "success" | "validating" | undefined;
18
22
  errors: React.ReactNode[];
19
23
  warnings: React.ReactNode[];
20
24
  };
@@ -1,7 +1,14 @@
1
- var _excluded = ["children", "colon", "size"];
1
+ var _excluded = ["children", "colon", "size", "labelWidth", "style"],
2
+ _excluded2 = ["labelWidth", "style"];
2
3
 
3
4
  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); }
4
5
 
6
+ 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; }
7
+
8
+ 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; }
9
+
10
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+
5
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; }
6
13
 
7
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; }
@@ -23,23 +30,37 @@ var AldForm = /*#__PURE__*/forwardRef(function (props, ref) {
23
30
  colon = _props$colon === void 0 ? false : _props$colon,
24
31
  _props$size = props.size,
25
32
  size = _props$size === void 0 ? contextSize : _props$size,
33
+ labelWidth = props.labelWidth,
34
+ _props$style = props.style,
35
+ style = _props$style === void 0 ? {} : _props$style,
26
36
  restProps = _objectWithoutProperties(props, _excluded);
27
37
 
38
+ var customStyle = labelWidth ? _objectSpread(_objectSpread({}, style), {}, {
39
+ '--label-width': "".concat(labelWidth, "px")
40
+ }) : style;
28
41
  return /*#__PURE__*/React.createElement(SizeContextProvider, {
29
42
  size: size
30
43
  }, /*#__PURE__*/React.createElement(InternalForm, _extends({
31
44
  colon: colon,
32
- size: size
45
+ size: size,
46
+ style: customStyle
33
47
  }, restProps, {
34
48
  ref: ref
35
49
  }), children));
36
50
  });
37
51
 
38
52
  var AldFormItem = function AldFormItem(props) {
39
- //@ts-ignore antd formItem 的ts接口里面无gutter 但是实际上是支持的
53
+ var labelWidth = props.labelWidth,
54
+ _props$style2 = props.style,
55
+ style = _props$style2 === void 0 ? {} : _props$style2,
56
+ restProps = _objectWithoutProperties(props, _excluded2);
57
+
58
+ var customStyle = labelWidth ? _objectSpread(_objectSpread({}, style), {}, {
59
+ '--label-width': "".concat(labelWidth, "px")
60
+ }) : style;
40
61
  return /*#__PURE__*/React.createElement(Item, _extends({
41
- gutter: 12
42
- }, props));
62
+ style: customStyle
63
+ }, restProps));
43
64
  };
44
65
 
45
66
  AldFormItem.useStatus = Item.useStatus;
@@ -9,8 +9,8 @@
9
9
  }
10
10
 
11
11
  .ant-form-item-label {
12
- display: inline-flex;
13
- align-items: center;
12
+ width: var(--label-width);
13
+ margin-right: 12px;
14
14
 
15
15
  label {
16
16
  overflow: hidden;
@@ -19,15 +19,9 @@
19
19
  font-style: normal;
20
20
  font-weight: 500;
21
21
  line-height: 20px;
22
- height: auto !important;
23
-
24
- &[for='textarea'] {
25
- align-self: flex-start;
26
- }
22
+ height: 32px;
27
23
 
28
24
  &.ant-form-item-no-colon {
29
- display: flex;
30
-
31
25
  &::after {
32
26
  display: none;
33
27
  }
@@ -37,6 +31,7 @@
37
31
 
38
32
  .ant-form-item-control {
39
33
  line-height: 20px;
34
+ justify-content: center;
40
35
 
41
36
  .ant-form-item-control-input {
42
37
  min-height: 20px;
@@ -64,15 +59,25 @@
64
59
  }
65
60
  }
66
61
 
67
- // &.ant-form-small {
68
- // .ant-form-item {
69
- // .ant-form-item-control {
70
- // .ant-form-item-control-input {
71
- // min-height: 16px;
72
- // }
73
- // }
74
- // }
75
- // }
62
+ &-small {
63
+ .ant-form-item {
64
+ .ant-form-item-label {
65
+ label {
66
+ height: 28px;
67
+ }
68
+ }
69
+ }
70
+ }
71
+
72
+ &-large {
73
+ .ant-form-item {
74
+ .ant-form-item-label {
75
+ label {
76
+ height: 36px;
77
+ }
78
+ }
79
+ }
80
+ }
76
81
  }
77
82
 
78
83
  .ant-form-vertical {
@@ -54,8 +54,8 @@
54
54
  }
55
55
 
56
56
  .ant-menu-submenu-expand-icon {
57
- inset-inline-end: 0;
58
57
  width: initial;
58
+ right: 8px;
59
59
  }
60
60
  }
61
61
  }
@@ -1,38 +1,37 @@
1
1
  @import './variables.less';
2
2
 
3
- .ald-multiple-option-list{
3
+ .ald-multiple-option-list {
4
4
  display: flex;
5
5
  justify-content: space-between;
6
6
  flex-direction: column;
7
7
  color: @NL0;
8
8
  font-size: 13px;
9
9
  line-height: 20px;
10
-
11
10
  }
12
11
 
13
- .ald-multiple-option{
14
- padding: 8px 14px;
12
+ .ald-multiple-option {
13
+ padding: 8px 12px;
15
14
  // height: 20px;
16
15
  margin-left: 0;
17
16
  display: flex;
18
17
  height: 36px;
19
18
  box-sizing: border-box;
20
19
 
21
- &:hover{
20
+ &:hover {
22
21
  background-color: @BG90;
23
22
  }
24
23
 
25
- &.ald-multiple-option-disabled{
24
+ &.ald-multiple-option-disabled {
26
25
  opacity: 0.5;
27
26
 
28
- &:hover{
27
+ &:hover {
29
28
  background: none;
30
29
  cursor: default;
31
30
  }
32
31
  }
33
32
  }
34
33
 
35
- .ald-multiple-option-label{
34
+ .ald-multiple-option-label {
36
35
  white-space: nowrap;
37
36
  margin-left: 10px;
38
37
  flex: 1;
@@ -48,8 +47,8 @@
48
47
  cursor: text;
49
48
  align-items: flex-start;
50
49
 
51
- .ant-select-selection-overflow{
50
+ .ant-select-selection-overflow {
52
51
  height: 100%;
53
52
  }
54
53
  }
55
- }
54
+ }
@@ -9,20 +9,22 @@
9
9
  @switch-text-margin-left: 8px;
10
10
  @switch-aspect-ratio: 2; //宽高比
11
11
  @switch-height-radius-ratio: 2; //高度和边框圆角比
12
+ @switch-background-color: #dbdbdb;
13
+ @switch-background-color-checked: #3271c9;
12
14
 
13
15
  .ald-switch.ald-switch {
14
16
  display: inline-block;
15
17
  font-size: 0;
16
18
 
17
19
  .ald-switch-btn {
18
- background: @BG60;
20
+ background: @switch-background-color;
19
21
 
20
22
  &:focus {
21
23
  box-shadow: none;
22
24
  }
23
25
 
24
26
  &:hover {
25
- background: @BG60;
27
+ background: @switch-background-color;
26
28
  }
27
29
  }
28
30
 
@@ -36,10 +38,10 @@
36
38
 
37
39
  &.ald-switch-checked {
38
40
  .ald-switch-btn {
39
- background-color: @B40;
41
+ background-color: @switch-background-color-checked;
40
42
 
41
43
  &:hover {
42
- background-color: @B40;
44
+ background-color: @switch-background-color-checked;
43
45
  }
44
46
  }
45
47
  }
@@ -67,7 +69,6 @@
67
69
  min-width: @switch-handle-height-middle * @switch-aspect-ratio;
68
70
  height: @switch-handle-height-middle;
69
71
  line-height: @switch-handle-height-middle;
70
- border-radius: @switch-handle-height-middle / @switch-height-radius-ratio;
71
72
 
72
73
  .ant-switch-handle {
73
74
  top: @switch-handle-gap-middle;
@@ -79,7 +80,7 @@
79
80
  width: @switch-handle-middle - 4px;
80
81
  height: @switch-handle-middle - 4px;
81
82
  font-size: @switch-handle-middle - 4px;
82
-
83
+
83
84
  svg {
84
85
  width: @switch-handle-middle - 4px;
85
86
  height: @switch-handle-middle - 4px;
@@ -110,7 +111,6 @@
110
111
  min-width: @switch-handle-height-small * @switch-aspect-ratio;
111
112
  height: @switch-handle-height-small;
112
113
  line-height: @switch-handle-height-small;
113
- border-radius: @switch-handle-height-small / @switch-height-radius-ratio;
114
114
 
115
115
  .ant-switch-handle {
116
116
  top: @switch-handle-gap-small;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aloudata/aloudata-design",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",