@trionesdev/antd-mobile-base-react 0.0.2-beta.2 → 0.0.2-beta.4
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/ActionSheet/style.scss +6 -5
- package/dist/Alert/style.scss +17 -17
- package/dist/Avatar/avatar.d.ts +2 -1
- package/dist/Avatar/avatar.js +14 -4
- package/dist/Avatar/style.scss +3 -2
- package/dist/Card/style.scss +11 -11
- package/dist/CascaderPicker/style.scss +3 -3
- package/dist/CascaderView/style.scss +2 -2
- package/dist/Cell/CellGroup.js +22 -14
- package/dist/Cell/cell.js +54 -16
- package/dist/Cell/context.d.ts +11 -0
- package/dist/Cell/context.js +2 -0
- package/dist/Cell/styles.scss +10 -14
- package/dist/Cell/types.d.ts +15 -7
- package/dist/Checkbox/checkbox-button.d.ts +6 -2
- package/dist/Checkbox/checkbox-button.js +5 -17
- package/dist/Checkbox/checkbox-group.js +19 -3
- package/dist/Checkbox/checkbox-round.d.ts +8 -0
- package/dist/Checkbox/checkbox-round.js +35 -0
- package/dist/Checkbox/checkbox.js +49 -34
- package/dist/Checkbox/index.d.ts +0 -2
- package/dist/Checkbox/index.js +0 -2
- package/dist/Checkbox/index.scss +48 -34
- package/dist/Checkbox/types.d.ts +11 -1
- package/dist/Descriptions/style.scss +4 -4
- package/dist/Divider/style.scss +5 -5
- package/dist/Form/context.d.ts +2 -1
- package/dist/Form/form.d.ts +2 -7
- package/dist/Form/form.js +4 -3
- package/dist/Form/index.d.ts +5 -3
- package/dist/Form/index.js +4 -2
- package/dist/Form/types.d.ts +7 -0
- package/dist/Form/types.js +1 -0
- package/dist/InputNumber/input-number.d.ts +3 -0
- package/dist/InputNumber/input-number.js +7 -3
- package/dist/InputNumber/style.scss +32 -12
- package/dist/NavBar/nav-bar.d.ts +1 -0
- package/dist/NavBar/nav-bar.js +2 -1
- package/dist/NavBar/style.scss +6 -3
- package/dist/Picker/style.scss +2 -2
- package/dist/Popup/index.d.ts +2 -0
- package/dist/Popup/index.js +2 -0
- package/dist/Popup/style.scss +3 -3
- package/dist/Radio/RadioGroup.js +3 -3
- package/dist/Radio/style.scss +24 -21
- package/dist/Radio/types.d.ts +6 -4
- package/dist/SafeArea/style.scss +5 -3
- package/dist/Scaffold/style.scss +2 -1
- package/dist/SideBar/style.scss +6 -6
- package/dist/Space/space.d.ts +1 -0
- package/dist/Space/space.js +17 -6
- package/dist/Space/style.scss +3 -0
- package/dist/Steps/HorizontalSteps.js +5 -1
- package/dist/Steps/style.scss +7 -0
- package/dist/Switch/style.scss +6 -6
- package/dist/TabBar/index.js +2 -1
- package/dist/TabBar/index.scss +3 -2
- package/dist/Tabs/style.scss +4 -4
- package/dist/Tag/style.scss +14 -14
- package/dist/index.d.ts +3 -7
- package/dist/index.js +2 -4
- package/dist/style/css-variable.scss +6 -0
- package/dist/style/style.scss +2 -2
- package/dist/style/variable.scss +169 -164
- package/dist/types.d.ts +5 -1
- package/package.json +5 -5
- package/dist/Form/FormItem/form-item-input.d.ts +0 -15
- package/dist/Form/FormItem/form-item-input.js +0 -39
- package/dist/Form/FormItem/form-item-label.d.ts +0 -13
- package/dist/Form/FormItem/form-item-label.js +0 -25
- package/dist/Form/FormItem/form-item.d.ts +0 -21
- package/dist/Form/FormItem/form-item.js +0 -70
- package/dist/Form/FormItem/index.d.ts +0 -5
- package/dist/Form/FormItem/index.js +0 -3
- package/dist/Form/style.scss +0 -45
- package/dist/Input/base-input.d.ts +0 -14
- package/dist/Input/base-input.js +0 -63
- package/dist/Input/index.d.ts +0 -12
- package/dist/Input/index.js +0 -9
- package/dist/Input/index.scss +0 -173
- package/dist/Input/input-affix-wrapper.d.ts +0 -8
- package/dist/Input/input-affix-wrapper.js +0 -50
- package/dist/Input/input-opt.d.ts +0 -16
- package/dist/Input/input-opt.js +0 -93
- package/dist/Input/input-password.d.ts +0 -7
- package/dist/Input/input-password.js +0 -47
- package/dist/Input/input.d.ts +0 -15
- package/dist/Input/input.js +0 -47
- package/dist/Input/textarea.d.ts +0 -13
- package/dist/Input/textarea.js +0 -45
- package/dist/Input/types.d.ts +0 -1
- package/dist/Input/types.js +0 -1
- package/dist/VerificationCodeInput/demo/base.d.ts +0 -3
- package/dist/VerificationCodeInput/demo/base.js +0 -11
- package/dist/VerificationCodeInput/index.d.ts +0 -3
- package/dist/VerificationCodeInput/index.js +0 -2
- package/dist/VerificationCodeInput/style.scss +0 -20
- package/dist/VerificationCodeInput/verification-code-input.d.ts +0 -24
- package/dist/VerificationCodeInput/verification-code-input.js +0 -99
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
@use "../style/variable" as
|
|
1
|
+
@use "../style/variable" as variable;
|
|
2
|
+
|
|
2
3
|
$actionSheetCls: 'triones-antm-action-sheet';
|
|
3
4
|
|
|
4
5
|
.#{$actionSheetCls} {
|
|
5
6
|
display: flex;
|
|
6
7
|
flex-direction: column;
|
|
7
|
-
background-color:
|
|
8
|
-
border-top-left-radius:
|
|
9
|
-
border-top-right-radius:
|
|
8
|
+
background-color: variable.$trionesColorFill;
|
|
9
|
+
border-top-left-radius: variable.$trionesBorderRadius;
|
|
10
|
+
border-top-right-radius: variable.$trionesBorderRadius;
|
|
10
11
|
overflow: hidden;
|
|
11
12
|
gap: 2Px;
|
|
12
13
|
&-body{
|
|
@@ -19,7 +20,7 @@ $actionSheetCls: 'triones-antm-action-sheet';
|
|
|
19
20
|
min-height: 48Px;
|
|
20
21
|
background-color: white;
|
|
21
22
|
font-size: 18Px;
|
|
22
|
-
border-bottom: 1Px solid
|
|
23
|
+
border-bottom: 1Px solid variable.$trionesBorderColor;
|
|
23
24
|
}
|
|
24
25
|
&-actions{
|
|
25
26
|
&-item{
|
package/dist/Alert/style.scss
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@use "../style/variable" as
|
|
1
|
+
@use "../style/variable" as variable;
|
|
2
2
|
|
|
3
3
|
$trionesAlertCls: 'triones-antm-alert';
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ $trionesAlertDefaultPadding: 8Px 12Px;
|
|
|
6
6
|
|
|
7
7
|
.#{$trionesAlertCls} {
|
|
8
8
|
padding: $trionesAlertDefaultPadding;
|
|
9
|
-
border-radius:
|
|
9
|
+
border-radius: variable.$trionesBorderRadius;
|
|
10
10
|
display: flex;
|
|
11
11
|
flex: 1 auto;
|
|
12
12
|
border: 1Px solid;
|
|
@@ -15,38 +15,38 @@ $trionesAlertDefaultPadding: 8Px 12Px;
|
|
|
15
15
|
gap: 4Px;
|
|
16
16
|
|
|
17
17
|
&-success {
|
|
18
|
-
border-color:
|
|
19
|
-
background-color:
|
|
18
|
+
border-color: variable.$trionesColorSuccessBorder;
|
|
19
|
+
background-color: variable.$trionesColorSuccessBg;
|
|
20
20
|
|
|
21
21
|
.#{$trionesAlertCls}-icon {
|
|
22
|
-
color:
|
|
22
|
+
color: variable.$trionesColorSuccess;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
&-info {
|
|
27
|
-
border-color:
|
|
28
|
-
background-color:
|
|
27
|
+
border-color: variable.$trionesColorInfoBorder;
|
|
28
|
+
background-color: variable.$trionesColorInfoBg;
|
|
29
29
|
|
|
30
30
|
.#{$trionesAlertCls}-icon {
|
|
31
|
-
color:
|
|
31
|
+
color: variable.$trionesColorInfo;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
&-warning {
|
|
36
|
-
border-color:
|
|
37
|
-
background-color:
|
|
36
|
+
border-color: variable.$trionesColorWarningBorder;
|
|
37
|
+
background-color: variable.$trionesColorWarningBg;
|
|
38
38
|
|
|
39
39
|
.#{$trionesAlertCls}-icon {
|
|
40
|
-
color:
|
|
40
|
+
color: variable.$trionesColorWarning;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
&-error {
|
|
45
|
-
border-color:
|
|
46
|
-
background-color:
|
|
45
|
+
border-color: variable.$trionesColorErrorBorder;
|
|
46
|
+
background-color: variable.$trionesColorErrorBg;
|
|
47
47
|
|
|
48
48
|
.#{$trionesAlertCls}-icon {
|
|
49
|
-
color:
|
|
49
|
+
color: variable.$trionesColorError;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -58,12 +58,12 @@ $trionesAlertDefaultPadding: 8Px 12Px;
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
&-close-icon {
|
|
61
|
-
color:
|
|
62
|
-
font-size:
|
|
61
|
+
color: variable.$trionesColorIcon;
|
|
62
|
+
font-size: variable.$trionesFontSizeIcon;
|
|
63
63
|
cursor: pointer;
|
|
64
64
|
|
|
65
65
|
.triones-antm-icon {
|
|
66
|
-
font-size:
|
|
66
|
+
font-size: variable.$trionesFontSizeIcon;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
package/dist/Avatar/avatar.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './style.scss';
|
|
3
|
+
import { SizeType } from '../types';
|
|
3
4
|
export type AvatarProps = {
|
|
4
5
|
alt?: string;
|
|
5
6
|
icon?: React.ReactNode;
|
|
6
7
|
shape?: 'circle' | 'square';
|
|
7
|
-
size?: number;
|
|
8
|
+
size?: SizeType | number;
|
|
8
9
|
src?: string | React.ReactNode;
|
|
9
10
|
srcSet?: string;
|
|
10
11
|
style?: React.CSSProperties;
|
package/dist/Avatar/avatar.js
CHANGED
|
@@ -5,7 +5,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import classNames from 'classnames';
|
|
8
|
-
import React from 'react';
|
|
8
|
+
import React, { useMemo } from 'react';
|
|
9
9
|
import "./style.scss";
|
|
10
10
|
export var Avatar = function Avatar(_ref) {
|
|
11
11
|
var alt = _ref.alt,
|
|
@@ -13,17 +13,27 @@ export var Avatar = function Avatar(_ref) {
|
|
|
13
13
|
_ref$shape = _ref.shape,
|
|
14
14
|
shape = _ref$shape === void 0 ? 'circle' : _ref$shape,
|
|
15
15
|
_ref$size = _ref.size,
|
|
16
|
-
size = _ref$size === void 0 ?
|
|
16
|
+
size = _ref$size === void 0 ? 32 : _ref$size,
|
|
17
17
|
src = _ref.src,
|
|
18
18
|
srcSet = _ref.srcSet,
|
|
19
19
|
style = _ref.style,
|
|
20
20
|
children = _ref.children;
|
|
21
21
|
var clsPrefix = 'triones-antm-avatar';
|
|
22
|
+
var avatarSize = useMemo(function () {
|
|
23
|
+
if (typeof size === 'number') {
|
|
24
|
+
return size;
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
small: 24,
|
|
28
|
+
middle: 32,
|
|
29
|
+
large: 40
|
|
30
|
+
}[size];
|
|
31
|
+
}, [size]);
|
|
22
32
|
return /*#__PURE__*/React.createElement("div", {
|
|
23
33
|
className: classNames(clsPrefix, _defineProperty({}, "".concat(clsPrefix, "-").concat(shape !== 'square' ? 'circle' : 'square'), true)),
|
|
24
34
|
style: _objectSpread({
|
|
25
|
-
width:
|
|
26
|
-
height:
|
|
35
|
+
width: avatarSize,
|
|
36
|
+
height: avatarSize,
|
|
27
37
|
backgroundColor: src ? undefined : '#ccc'
|
|
28
38
|
}, style)
|
|
29
39
|
}, src ? typeof src === 'string' ? /*#__PURE__*/React.createElement("img", {
|
package/dist/Avatar/style.scss
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@use "../style/variable" as variable;
|
|
1
2
|
$avatarCls: 'triones-antm-avatar';
|
|
2
3
|
|
|
3
4
|
.#{$avatarCls} {
|
|
@@ -10,7 +11,7 @@ $avatarCls: 'triones-antm-avatar';
|
|
|
10
11
|
border-radius: 50%;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
&-
|
|
14
|
-
border-radius:
|
|
14
|
+
&-square {
|
|
15
|
+
border-radius: variable.$trionesBorderRadius;
|
|
15
16
|
}
|
|
16
17
|
}
|
package/dist/Card/style.scss
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
@use "../style/variable" as
|
|
1
|
+
@use "../style/variable" as variable;
|
|
2
2
|
$class-prefix-card: 'triones-antm-card';
|
|
3
3
|
|
|
4
4
|
.#{$class-prefix-card} {
|
|
5
|
-
background:
|
|
6
|
-
border-radius:
|
|
7
|
-
//padding:
|
|
5
|
+
background: variable.$trionesColorBgBase;
|
|
6
|
+
border-radius: variable.$trionesBorderRadius;
|
|
7
|
+
//padding: variable.$trionesPadding variable.$trionesPadding;
|
|
8
8
|
&-header {
|
|
9
9
|
position: relative;
|
|
10
10
|
display: flex;
|
|
@@ -12,24 +12,24 @@ $class-prefix-card: 'triones-antm-card';
|
|
|
12
12
|
align-items: center;
|
|
13
13
|
gap: 8Px;
|
|
14
14
|
box-sizing: border-box;
|
|
15
|
-
padding:
|
|
15
|
+
padding: variable.$trionesPaddingXs variable.$trionesPaddingXs;
|
|
16
16
|
&:not(:last-child) {
|
|
17
|
-
border-bottom: solid 0.5Px
|
|
17
|
+
border-bottom: solid 0.5Px variable.$trionesBorderColor;
|
|
18
18
|
}
|
|
19
19
|
&-title {
|
|
20
|
-
font-size:
|
|
20
|
+
font-size: variable.$trionesFontSize;
|
|
21
21
|
line-height: 1.4;
|
|
22
22
|
font-weight: 500;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
&-body {
|
|
26
|
-
padding:
|
|
26
|
+
padding: variable.$trionesPaddingXs variable.$trionesPaddingXs;
|
|
27
27
|
}
|
|
28
28
|
&-footer {
|
|
29
|
-
padding:
|
|
29
|
+
padding: variable.$trionesPaddingXs variable.$trionesPaddingXs;
|
|
30
30
|
}
|
|
31
31
|
&-footer {
|
|
32
|
-
border-top: solid 0.5Px
|
|
33
|
-
padding:
|
|
32
|
+
border-top: solid 0.5Px variable.$trionesBorderColor;
|
|
33
|
+
padding: variable.$trionesPaddingXs variable.$trionesPaddingXs;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@use "../style/variable" as
|
|
1
|
+
@use "../style/variable" as variable;
|
|
2
2
|
$cascaderPickerCls: 'triones-antm-cascader-picker';
|
|
3
3
|
|
|
4
4
|
.#{$cascaderPickerCls} {
|
|
@@ -13,7 +13,7 @@ $cascaderPickerCls: 'triones-antm-cascader-picker';
|
|
|
13
13
|
display: flex;
|
|
14
14
|
justify-content: space-between;
|
|
15
15
|
align-items: center;
|
|
16
|
-
border-bottom: 1Px solid
|
|
16
|
+
border-bottom: 1Px solid variable.$trionesBorderColor;
|
|
17
17
|
padding: 4Px;
|
|
18
18
|
|
|
19
19
|
&-button {
|
|
@@ -21,7 +21,7 @@ $cascaderPickerCls: 'triones-antm-cascader-picker';
|
|
|
21
21
|
padding: 8Px;
|
|
22
22
|
font-size: 12Px;
|
|
23
23
|
&-ok{
|
|
24
|
-
color:
|
|
24
|
+
color: variable.$trionesColorPrimary;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@use "../style/variable" as
|
|
1
|
+
@use "../style/variable" as variable;
|
|
2
2
|
|
|
3
3
|
$cascaderViewCls: 'triones-antm-cascader-view';
|
|
4
4
|
.#{$cascaderViewCls} {
|
|
@@ -15,7 +15,7 @@ $cascaderViewCls: 'triones-antm-cascader-view';
|
|
|
15
15
|
padding: 0Px 8Px;
|
|
16
16
|
|
|
17
17
|
&-selected {
|
|
18
|
-
color:
|
|
18
|
+
color: variable.$trionesColorPrimary;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
package/dist/Cell/CellGroup.js
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import Divider from "../Divider";
|
|
4
3
|
import { cls } from "./types";
|
|
4
|
+
import { CellGroupContext } from "./context";
|
|
5
|
+
import Cell from '.';
|
|
6
|
+
import { Cell as InternalCell } from "./cell";
|
|
5
7
|
export var CellGroup = function CellGroup(_ref) {
|
|
6
8
|
var className = _ref.className,
|
|
7
9
|
style = _ref.style,
|
|
8
10
|
children = _ref.children,
|
|
9
11
|
title = _ref.title,
|
|
10
12
|
extra = _ref.extra,
|
|
13
|
+
labelCol = _ref.labelCol,
|
|
14
|
+
labelAlign = _ref.labelAlign,
|
|
15
|
+
wrapperAlign = _ref.wrapperAlign,
|
|
11
16
|
divider = _ref.divider;
|
|
12
17
|
var handleRender = function handleRender() {
|
|
13
18
|
if (children) {
|
|
14
19
|
if (Array.isArray(children)) {
|
|
15
20
|
var childrenArray = [];
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
childrenArray.push( /*#__PURE__*/React.createElement(Divider, null));
|
|
23
|
-
}
|
|
21
|
+
children.filter(function (child) {
|
|
22
|
+
return /*#__PURE__*/React.isValidElement(child) && (child.type == Cell || child.type == InternalCell);
|
|
23
|
+
}).forEach(function (child, index) {
|
|
24
|
+
childrenArray.push(child);
|
|
25
|
+
if (divider && index < React.Children.count(children) - 1) {
|
|
26
|
+
childrenArray.push(divider);
|
|
24
27
|
}
|
|
25
|
-
}
|
|
28
|
+
});
|
|
26
29
|
return childrenArray;
|
|
27
30
|
} else {
|
|
28
31
|
return children;
|
|
@@ -30,12 +33,17 @@ export var CellGroup = function CellGroup(_ref) {
|
|
|
30
33
|
}
|
|
31
34
|
return null;
|
|
32
35
|
};
|
|
33
|
-
return /*#__PURE__*/React.createElement(
|
|
36
|
+
return /*#__PURE__*/React.createElement(CellGroupContext.Provider, {
|
|
37
|
+
value: {
|
|
38
|
+
labelCol: labelCol,
|
|
39
|
+
labelAlign: labelAlign,
|
|
40
|
+
wrapperAlign: wrapperAlign,
|
|
41
|
+
extra: extra
|
|
42
|
+
}
|
|
43
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
34
44
|
className: classNames("".concat(cls, "-group"), className),
|
|
35
45
|
style: style
|
|
36
46
|
}, title && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
37
47
|
className: classNames("".concat(cls, "-group-title"))
|
|
38
|
-
}, /*#__PURE__*/React.createElement("div", null, title),
|
|
39
|
-
className: classNames("".concat(cls, "-group-extra"))
|
|
40
|
-
}, extra)), /*#__PURE__*/React.createElement(Divider, null)), handleRender());
|
|
48
|
+
}, /*#__PURE__*/React.createElement("div", null, title))), handleRender()));
|
|
41
49
|
};
|
package/dist/Cell/cell.js
CHANGED
|
@@ -1,31 +1,69 @@
|
|
|
1
|
-
import { RightOutline } from "../../../antd-mobile-icons-react";
|
|
2
1
|
import classNames from 'classnames';
|
|
3
|
-
import React from 'react';
|
|
2
|
+
import React, { useContext, useMemo } from 'react';
|
|
4
3
|
import "./styles.scss";
|
|
4
|
+
import { CellGroupContext } from "./context";
|
|
5
5
|
var cls = 'triones-antm-cell';
|
|
6
6
|
export var Cell = function Cell(_ref) {
|
|
7
7
|
var className = _ref.className,
|
|
8
8
|
style = _ref.style,
|
|
9
9
|
placeholder = _ref.placeholder,
|
|
10
10
|
children = _ref.children,
|
|
11
|
+
label = _ref.label,
|
|
11
12
|
extra = _ref.extra,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
labelCol = _ref.labelCol,
|
|
14
|
+
labelAlign = _ref.labelAlign,
|
|
15
|
+
wrapperAlign = _ref.wrapperAlign,
|
|
16
|
+
onClick = _ref.onClick;
|
|
17
|
+
var _useContext = useContext(CellGroupContext),
|
|
18
|
+
ctxLabelCol = _useContext.labelCol,
|
|
19
|
+
ctxLabelAlign = _useContext.labelAlign,
|
|
20
|
+
ctxWrapperAlign = _useContext.wrapperAlign,
|
|
21
|
+
ctxExtra = _useContext.extra;
|
|
22
|
+
var labelWidth = useMemo(function () {
|
|
23
|
+
return (labelCol === null || labelCol === void 0 ? void 0 : labelCol.flex) || (ctxLabelCol === null || ctxLabelCol === void 0 ? void 0 : ctxLabelCol.flex) || 'auto';
|
|
24
|
+
}, [labelCol, ctxLabelCol]);
|
|
25
|
+
var labelAlignStyle = useMemo(function () {
|
|
26
|
+
var align = labelAlign || ctxLabelAlign;
|
|
27
|
+
switch (align) {
|
|
28
|
+
case 'left':
|
|
29
|
+
return 'start';
|
|
30
|
+
case 'center':
|
|
31
|
+
return 'center';
|
|
32
|
+
case 'right':
|
|
33
|
+
return 'end';
|
|
34
|
+
default:
|
|
35
|
+
return 'start';
|
|
36
|
+
}
|
|
37
|
+
}, [labelAlign, ctxLabelAlign]);
|
|
38
|
+
var wrapperAlignStyle = useMemo(function () {
|
|
39
|
+
var align = wrapperAlign || ctxWrapperAlign;
|
|
40
|
+
switch (align) {
|
|
41
|
+
case 'left':
|
|
42
|
+
return 'start';
|
|
43
|
+
case 'center':
|
|
44
|
+
return 'center';
|
|
45
|
+
case 'right':
|
|
46
|
+
return 'end';
|
|
47
|
+
default:
|
|
48
|
+
return 'start';
|
|
49
|
+
}
|
|
50
|
+
}, [wrapperAlign, ctxWrapperAlign]);
|
|
16
51
|
return /*#__PURE__*/React.createElement("div", {
|
|
17
52
|
className: classNames(cls, className),
|
|
18
53
|
style: style,
|
|
19
54
|
onClick: onClick
|
|
20
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
21
|
-
className: classNames("".concat(cls, "-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
55
|
+
}, label && /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
className: classNames("".concat(cls, "-label")),
|
|
57
|
+
style: {
|
|
58
|
+
width: labelWidth,
|
|
59
|
+
justifyContent: labelAlignStyle
|
|
60
|
+
}
|
|
61
|
+
}, label), /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
className: classNames("".concat(cls, "-content")),
|
|
63
|
+
style: {
|
|
64
|
+
justifyContent: wrapperAlignStyle
|
|
65
|
+
}
|
|
66
|
+
}, children || placeholder && /*#__PURE__*/React.createElement("div", {
|
|
25
67
|
className: classNames("".concat(cls, "-placeholder"))
|
|
26
|
-
}, placeholder)), extra
|
|
27
|
-
className: classNames("".concat(cls, "-extra"))
|
|
28
|
-
}, extra)), arrow && /*#__PURE__*/React.createElement("div", {
|
|
29
|
-
className: classNames("".concat(cls, "-arrow"))
|
|
30
|
-
}, /*#__PURE__*/React.createElement(RightOutline, null)));
|
|
68
|
+
}, placeholder)), extra || ctxExtra);
|
|
31
69
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Col } from "../types";
|
|
3
|
+
import { align } from "./types";
|
|
4
|
+
type CellGroupContextType = {
|
|
5
|
+
labelCol?: Col;
|
|
6
|
+
labelAlign?: align;
|
|
7
|
+
wrapperAlign?: align;
|
|
8
|
+
extra?: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export declare const CellGroupContext: React.Context<CellGroupContextType>;
|
|
11
|
+
export {};
|
package/dist/Cell/styles.scss
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
@use "../style/variable" as
|
|
1
|
+
@use "../style/variable" as variable;
|
|
2
2
|
|
|
3
3
|
$cellCls: 'triones-antm-cell';
|
|
4
4
|
|
|
5
5
|
.#{$cellCls} {
|
|
6
|
+
padding-block: 4Px;
|
|
6
7
|
display: flex;
|
|
7
|
-
padding: 4Px 11Px;
|
|
8
8
|
gap: 4Px;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
&-label {
|
|
11
12
|
display: flex;
|
|
12
|
-
|
|
13
|
+
align-items: center;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
&-content {
|
|
@@ -21,22 +22,17 @@ $cellCls: 'triones-antm-cell';
|
|
|
21
22
|
&-extra {
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
&-placeholder{
|
|
30
|
-
font-size: 14Px;
|
|
31
|
-
color: #cccccc;
|
|
25
|
+
|
|
26
|
+
&-placeholder {
|
|
27
|
+
font-size: variable.$trionesFontSize;
|
|
28
|
+
color: variable.$trionesColorTextPlaceholder;
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
31
|
|
|
35
32
|
.#{$cellCls}-group {
|
|
36
33
|
display: flex;
|
|
37
34
|
flex-direction: column;
|
|
38
|
-
border-radius:
|
|
39
|
-
padding: 4Px 4Px;
|
|
35
|
+
border-radius: variable.$trionesBorderRadius;
|
|
40
36
|
|
|
41
37
|
&-title {
|
|
42
38
|
padding: 4Px 4Px;
|
package/dist/Cell/types.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { Col } from "../types";
|
|
2
3
|
export declare const cls = "triones-antm-cell";
|
|
4
|
+
export type align = 'left' | 'center' | 'right';
|
|
3
5
|
export type CellProps = {
|
|
4
6
|
className?: string;
|
|
5
7
|
style?: React.CSSProperties;
|
|
6
8
|
placeholder?: string;
|
|
7
9
|
children?: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* @description 左侧内容
|
|
12
|
+
*/
|
|
13
|
+
label?: React.ReactNode;
|
|
8
14
|
/**
|
|
9
15
|
* @description 右侧内容
|
|
10
16
|
* @default
|
|
@@ -19,7 +25,9 @@ export type CellProps = {
|
|
|
19
25
|
* @description 点击事件
|
|
20
26
|
*/
|
|
21
27
|
onClick?: () => void;
|
|
22
|
-
|
|
28
|
+
labelCol?: Col;
|
|
29
|
+
labelAlign?: align;
|
|
30
|
+
wrapperAlign?: align;
|
|
23
31
|
};
|
|
24
32
|
export type CellGroupProps = {
|
|
25
33
|
className?: string;
|
|
@@ -33,9 +41,9 @@ export type CellGroupProps = {
|
|
|
33
41
|
* @description 分组右侧内容
|
|
34
42
|
*/
|
|
35
43
|
extra?: React.ReactNode;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
divider?:
|
|
44
|
+
arrow?: boolean;
|
|
45
|
+
labelCol?: Col;
|
|
46
|
+
labelAlign?: align;
|
|
47
|
+
wrapperAlign?: align;
|
|
48
|
+
divider?: ReactNode;
|
|
41
49
|
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import { CheckboxProps } from './types';
|
|
2
1
|
import { FC } from 'react';
|
|
3
|
-
|
|
2
|
+
import { CheckboxProps } from './types';
|
|
3
|
+
type CheckboxButtonProps = CheckboxProps & {
|
|
4
|
+
onClick: () => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const CheckboxButton: FC<CheckboxButtonProps>;
|
|
7
|
+
export {};
|
|
@@ -2,39 +2,27 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2
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
3
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
4
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
-
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."); }
|
|
7
|
-
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); }
|
|
8
|
-
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; }
|
|
9
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
5
|
import React from 'react';
|
|
12
6
|
import { cls } from "./types";
|
|
13
|
-
import { useState } from 'react';
|
|
14
7
|
import classNames from 'classnames';
|
|
15
8
|
import { CheckOutline } from "../../../antd-mobile-icons-react";
|
|
16
9
|
export var CheckboxButton = function CheckboxButton(_ref) {
|
|
17
|
-
var _ref2;
|
|
18
10
|
var children = _ref.children,
|
|
19
11
|
checked = _ref.checked,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var _useState = useState((_ref2 = checked !== null && checked !== void 0 ? checked : defaultChecked) !== null && _ref2 !== void 0 ? _ref2 : false),
|
|
23
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
-
innerChecked = _useState2[0],
|
|
25
|
-
setInnerChecked = _useState2[1];
|
|
12
|
+
disabled = _ref.disabled,
|
|
13
|
+
_onClick = _ref.onClick;
|
|
26
14
|
var prefixCls = "".concat(cls, "-button");
|
|
27
15
|
return /*#__PURE__*/React.createElement("label", {
|
|
28
|
-
className: classNames("".concat(prefixCls), _defineProperty(_defineProperty({}, "".concat(
|
|
16
|
+
className: classNames("".concat(prefixCls), _defineProperty(_defineProperty({}, "".concat(cls, "-disabled"), disabled), "".concat(prefixCls, "-checked"), checked)),
|
|
29
17
|
onClick: function onClick() {
|
|
30
18
|
if (disabled) {
|
|
31
19
|
return;
|
|
32
20
|
}
|
|
33
|
-
|
|
21
|
+
_onClick === null || _onClick === void 0 || _onClick();
|
|
34
22
|
}
|
|
35
23
|
}, /*#__PURE__*/React.createElement("div", {
|
|
36
24
|
className: classNames("".concat(prefixCls, "-content"))
|
|
37
|
-
}, children),
|
|
25
|
+
}, children), checked && /*#__PURE__*/React.createElement("div", {
|
|
38
26
|
className: classNames("".concat(prefixCls, "-icon"))
|
|
39
27
|
}, /*#__PURE__*/React.createElement(CheckOutline, {
|
|
40
28
|
className: classNames("checkedIcon")
|
|
@@ -8,25 +8,41 @@ import classNames from 'classnames';
|
|
|
8
8
|
import React, { useState } from 'react';
|
|
9
9
|
import { CheckboxGroupContext } from "./group-context";
|
|
10
10
|
import { cls } from "./types";
|
|
11
|
+
import Checkbox from "./index";
|
|
12
|
+
import { isEmpty } from "lodash-es";
|
|
13
|
+
import Space from "../Space";
|
|
11
14
|
export var CheckboxGroup = function CheckboxGroup(_ref) {
|
|
12
15
|
var _ref2;
|
|
13
16
|
var value = _ref.value,
|
|
14
17
|
defaultValue = _ref.defaultValue,
|
|
15
18
|
onChange = _ref.onChange,
|
|
16
|
-
children = _ref.children
|
|
19
|
+
children = _ref.children,
|
|
20
|
+
shape = _ref.shape,
|
|
21
|
+
options = _ref.options,
|
|
22
|
+
direction = _ref.direction;
|
|
17
23
|
var _useState = useState((_ref2 = value !== null && value !== void 0 ? value : defaultValue) !== null && _ref2 !== void 0 ? _ref2 : []),
|
|
18
24
|
_useState2 = _slicedToArray(_useState, 2),
|
|
19
25
|
innerValue = _useState2[0],
|
|
20
26
|
setInnerValue = _useState2[1];
|
|
21
27
|
return /*#__PURE__*/React.createElement(CheckboxGroupContext.Provider, {
|
|
22
28
|
value: {
|
|
29
|
+
group: true,
|
|
23
30
|
value: innerValue,
|
|
24
|
-
|
|
31
|
+
onValueChange: function onValueChange(v) {
|
|
25
32
|
setInnerValue(v);
|
|
33
|
+
console.log('value', v);
|
|
26
34
|
onChange === null || onChange === void 0 || onChange(v);
|
|
27
35
|
}
|
|
28
36
|
}
|
|
29
37
|
}, /*#__PURE__*/React.createElement("div", {
|
|
30
38
|
className: classNames("".concat(cls, "-group}"))
|
|
31
|
-
},
|
|
39
|
+
}, !isEmpty(options) && /*#__PURE__*/React.createElement(Space, {
|
|
40
|
+
direction: direction
|
|
41
|
+
}, options === null || options === void 0 ? void 0 : options.map(function (item, index) {
|
|
42
|
+
return /*#__PURE__*/React.createElement(Checkbox, {
|
|
43
|
+
key: "".concat(index),
|
|
44
|
+
shape: shape,
|
|
45
|
+
value: item.value
|
|
46
|
+
}, item.label);
|
|
47
|
+
})), isEmpty(options) && children));
|
|
32
48
|
};
|