@pisell/materials 6.0.18 → 6.0.20
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +7 -7
- package/build/lowcode/preview.js +146 -146
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +51 -20
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +51 -20
- package/es/components/badge/index.d.ts +7 -0
- package/es/components/badge/index.js +44 -0
- package/es/components/badge/index.less +2 -0
- package/es/components/buttonGroupEdit/index.d.ts +8 -0
- package/es/components/buttonGroupEdit/index.js +408 -0
- package/es/components/buttonGroupPreview/index.d.ts +19 -0
- package/es/components/buttonGroupPreview/index.js +74 -0
- package/es/components/cardMetricItem/index.d.ts +12 -0
- package/es/components/cardMetricItem/index.js +39 -0
- package/es/components/cardMetricItem/index.less +39 -0
- package/es/components/cardPro/index.d.ts +3 -0
- package/es/components/cardPro/index.js +66 -0
- package/es/components/cardPro/index.less +55 -0
- package/es/components/cropPhoto/index.d.ts +3 -0
- package/es/components/cropPhoto/index.js +72 -0
- package/es/components/cropPhoto/index.less +15 -0
- package/es/components/dataSourceComponents/dataSourceMenu/Basic.d.ts +8 -2
- package/es/components/dataSourceComponents/dataSourceMenu/Basic.js +13 -3
- package/es/components/dataSourceComponents/dataSourceMenu/index.d.ts +8 -2
- package/es/components/dataSourceComponents/fields/Input/WithMode.js +24 -1
- package/es/components/dataSourceComponents/fields/Input.Mobile/serve.js +31 -3
- package/es/components/dataSourceComponents/fields/Input.Phone/serve.js +31 -3
- package/es/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +2 -0
- package/es/components/dataSourceComponents/fields/Upload/BaseUpload.js +102 -141
- package/es/components/dataSourceComponents/fields/Upload/WithMode.js +6 -3
- package/es/components/dataSourceComponents/fields/Upload/serve.js +13 -3
- package/es/components/dataSourceComponents/fields/Upload/shopUploadServe.d.ts +56 -0
- package/es/components/dataSourceComponents/fields/Upload/shopUploadServe.js +396 -0
- package/es/components/dataSourceComponents/fields/Upload/type.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Upload/utils.js +17 -2
- package/es/components/dataSourceComponents/fields/index.d.ts +8 -8
- package/es/components/dataSourceComponents/hooks/usePlatform.d.ts +3 -0
- package/es/components/dataSourceComponents/hooks/usePlatform.js +12 -0
- package/es/components/login-and-register/index.js +23 -21
- package/es/components/login-and-register/index.less +7 -7
- package/es/components/page/index.js +23 -57
- package/es/components/pisellAnchor/index.d.ts +23 -0
- package/es/components/pisellAnchor/index.js +303 -0
- package/es/components/pisellAnchor/index.less +197 -0
- package/es/components/pisellNavigationMenu/PisellNavigationMenu.js +18 -2
- package/es/components/pisellQrcode/index.d.ts +10 -0
- package/es/components/pisellQrcode/index.js +70 -0
- package/es/components/pisellQrcode/index.less +41 -0
- package/es/components/pisellStatisticList/index.d.ts +3 -0
- package/es/components/pisellStatisticList/index.js +17 -5
- package/es/components/pisellStatisticList/index.less +1 -1
- package/es/components/pisellText/components/Amount/index.d.ts +2 -0
- package/es/components/pisellText/components/Amount/index.js +3 -2
- package/es/components/pisellWalletPassCard/index.d.ts +4 -4
- package/es/components/pisellWalletPassCard/index.js +28 -12
- package/es/components/pisellWalletPassCard/index.less +26 -4
- package/es/components/record-view/index.d.ts +13 -5
- package/es/components/record-view/index.js +81 -30
- package/es/components/record-view/index.less +37 -2
- package/es/components/table/Table/utils.d.ts +1 -1
- package/es/components/tabs/index.d.ts +1 -0
- package/es/components/tabs/index.js +25 -7
- package/es/components/tabs/index.less +5 -5
- package/es/components/walletCard/Guest/index.d.ts +3 -0
- package/es/components/walletCard/Guest/index.js +83 -0
- package/es/components/walletCard/Guest/index.less +71 -0
- package/es/components/walletCard/index.d.ts +65 -0
- package/es/components/walletCard/index.js +402 -0
- package/es/components/walletCard/index.less +267 -0
- package/es/index.d.ts +10 -1
- package/es/index.js +10 -1
- package/es/locales/en-US.d.ts +38 -2
- package/es/locales/en-US.js +55 -10
- package/es/locales/index.js +4 -2
- package/es/locales/zh-CN.d.ts +36 -0
- package/es/locales/zh-CN.js +41 -1
- package/es/locales/zh-TW.d.ts +36 -0
- package/es/locales/zh-TW.js +41 -1
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +3 -0
- package/es/utils/platform.d.ts +1 -1
- package/lib/components/badge/index.d.ts +7 -0
- package/lib/components/badge/index.js +70 -0
- package/lib/components/badge/index.less +2 -0
- package/lib/components/buttonGroupEdit/index.d.ts +8 -0
- package/lib/components/buttonGroupEdit/index.js +317 -0
- package/lib/components/buttonGroupPreview/index.d.ts +19 -0
- package/lib/components/buttonGroupPreview/index.js +79 -0
- package/lib/components/cardMetricItem/index.d.ts +12 -0
- package/lib/components/cardMetricItem/index.js +75 -0
- package/lib/components/cardMetricItem/index.less +39 -0
- package/lib/components/cardPro/index.d.ts +3 -0
- package/lib/components/cardPro/index.js +98 -0
- package/lib/components/cardPro/index.less +55 -0
- package/lib/components/cropPhoto/index.d.ts +3 -0
- package/lib/components/cropPhoto/index.js +70 -0
- package/lib/components/cropPhoto/index.less +15 -0
- package/lib/components/dataSourceComponents/dataSourceMenu/Basic.d.ts +8 -2
- package/lib/components/dataSourceComponents/dataSourceMenu/Basic.js +12 -3
- package/lib/components/dataSourceComponents/dataSourceMenu/index.d.ts +8 -2
- package/lib/components/dataSourceComponents/fields/Input/WithMode.js +21 -0
- package/lib/components/dataSourceComponents/fields/Input.Mobile/serve.js +37 -3
- package/lib/components/dataSourceComponents/fields/Input.Phone/serve.js +37 -3
- package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +2 -0
- package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.js +47 -72
- package/lib/components/dataSourceComponents/fields/Upload/WithMode.js +11 -9
- package/lib/components/dataSourceComponents/fields/Upload/serve.js +11 -2
- package/lib/components/dataSourceComponents/fields/Upload/shopUploadServe.d.ts +56 -0
- package/lib/components/dataSourceComponents/fields/Upload/shopUploadServe.js +247 -0
- package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Upload/utils.js +17 -2
- package/lib/components/dataSourceComponents/fields/index.d.ts +8 -8
- package/lib/components/dataSourceComponents/hooks/usePlatform.d.ts +3 -0
- package/lib/components/dataSourceComponents/hooks/usePlatform.js +51 -0
- package/lib/components/login-and-register/index.js +23 -21
- package/lib/components/login-and-register/index.less +7 -7
- package/lib/components/page/index.js +37 -65
- package/lib/components/pisellAnchor/index.d.ts +23 -0
- package/lib/components/pisellAnchor/index.js +251 -0
- package/lib/components/pisellAnchor/index.less +197 -0
- package/lib/components/pisellNavigationMenu/PisellNavigationMenu.js +24 -3
- package/lib/components/pisellQrcode/index.d.ts +10 -0
- package/lib/components/pisellQrcode/index.js +82 -0
- package/lib/components/pisellQrcode/index.less +41 -0
- package/lib/components/pisellStatisticList/index.d.ts +3 -0
- package/lib/components/pisellStatisticList/index.js +35 -15
- package/lib/components/pisellStatisticList/index.less +1 -1
- package/lib/components/pisellText/components/Amount/index.d.ts +2 -0
- package/lib/components/pisellText/components/Amount/index.js +2 -1
- package/lib/components/pisellWalletPassCard/index.d.ts +4 -4
- package/lib/components/pisellWalletPassCard/index.js +17 -9
- package/lib/components/pisellWalletPassCard/index.less +26 -4
- package/lib/components/record-view/index.d.ts +13 -5
- package/lib/components/record-view/index.js +63 -11
- package/lib/components/record-view/index.less +37 -2
- package/lib/components/table/Table/utils.d.ts +1 -1
- package/lib/components/tabs/index.d.ts +1 -0
- package/lib/components/tabs/index.js +12 -1
- package/lib/components/tabs/index.less +5 -5
- package/lib/components/walletCard/Guest/index.d.ts +3 -0
- package/lib/components/walletCard/Guest/index.js +138 -0
- package/lib/components/walletCard/Guest/index.less +71 -0
- package/lib/components/walletCard/index.d.ts +65 -0
- package/lib/components/walletCard/index.js +374 -0
- package/lib/components/walletCard/index.less +267 -0
- package/lib/index.d.ts +10 -1
- package/lib/index.js +26 -1
- package/lib/locales/en-US.d.ts +38 -2
- package/lib/locales/en-US.js +41 -3
- package/lib/locales/index.js +4 -2
- package/lib/locales/zh-CN.d.ts +36 -0
- package/lib/locales/zh-CN.js +41 -1
- package/lib/locales/zh-TW.d.ts +36 -0
- package/lib/locales/zh-TW.js +41 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +6 -1
- package/lib/utils/platform.d.ts +1 -1
- package/lowcode/badge/meta.ts +20 -11
- package/lowcode/badge/snippets.ts +2 -0
- package/lowcode/button/meta.ts +2 -6
- package/lowcode/button-group/meta.ts +198 -0
- package/lowcode/button-group/snippets.ts +68 -0
- package/lowcode/button-group-edit/meta.ts +32 -0
- package/lowcode/button-group-edit/snippets.ts +98 -0
- package/lowcode/button-group-preview/meta.ts +55 -0
- package/lowcode/button-group-preview/snippets.ts +57 -0
- package/lowcode/card/snippets.ts +55 -55
- package/lowcode/card-metric-item/meta.ts +83 -0
- package/lowcode/card-metric-item/snippets.ts +13 -0
- package/lowcode/card-pro/meta.ts +338 -0
- package/lowcode/card-pro/snippe.ts +39 -0
- package/lowcode/crop-photo/meta.ts +77 -0
- package/lowcode/crop-photo/snippe.ts +12 -0
- package/lowcode/form-item-input/snippets.ts +1 -1
- package/lowcode/form-item-upload/meta.ts +11 -0
- package/lowcode/pisell-anchor/meta.ts +118 -0
- package/lowcode/pisell-anchor/snippets.ts +26 -0
- package/lowcode/pisell-card/meta.ts +63 -27
- package/lowcode/pisell-card/snippets.ts +6 -0
- package/lowcode/pisell-modal.information/meta.ts +8 -0
- package/lowcode/pisell-qrcode/__screenshots__/upload-1.png +0 -0
- package/lowcode/pisell-qrcode/meta.ts +46 -0
- package/lowcode/pisell-qrcode/snippets.ts +13 -0
- package/lowcode/pisell-tooltip/meta.ts +1 -1
- package/lowcode/record-view/meta.ts +20 -0
- package/lowcode/section-footers/meta.ts +66 -0
- package/lowcode/section-footers/snippe.ts +21 -0
- package/lowcode/spin/meta.ts +9 -0
- package/lowcode/tag/meta.ts +6 -0
- package/lowcode/timeline/meta.ts +32 -9
- package/lowcode/timeline/snippets.ts +12 -2
- package/lowcode/timeline.item/meta.ts +1 -1
- package/lowcode/wallet-card/meta.ts +283 -0
- package/lowcode/wallet-card/snippets.ts +44 -0
- package/package.json +5 -1
|
@@ -16,6 +16,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
16
16
|
import React, { useState, useEffect } from 'react';
|
|
17
17
|
import { Input, Button, Space, Form, Checkbox } from 'antd';
|
|
18
18
|
import { GoogleOutlined, AppleOutlined, FacebookOutlined } from '@ant-design/icons';
|
|
19
|
+
import { getText } from "../../locales/index";
|
|
19
20
|
import "./index.less";
|
|
20
21
|
/**
|
|
21
22
|
* loginAndRegister组件的属性接口
|
|
@@ -38,13 +39,13 @@ var loginAndRegister = function loginAndRegister(_ref) {
|
|
|
38
39
|
height: 48
|
|
39
40
|
} : _ref$logoSize,
|
|
40
41
|
_ref$title = _ref.title,
|
|
41
|
-
title = _ref$title === void 0 ? 'Log in to your account' : _ref$title,
|
|
42
|
+
title = _ref$title === void 0 ? getText('Log in to your account') : _ref$title,
|
|
42
43
|
_ref$showTitle = _ref.showTitle,
|
|
43
44
|
showTitle = _ref$showTitle === void 0 ? false : _ref$showTitle,
|
|
44
45
|
_ref$titleAlign = _ref.titleAlign,
|
|
45
46
|
titleAlign = _ref$titleAlign === void 0 ? 'center' : _ref$titleAlign,
|
|
46
47
|
_ref$subtitle = _ref.subtitle,
|
|
47
|
-
subtitle = _ref$subtitle === void 0 ? '
|
|
48
|
+
subtitle = _ref$subtitle === void 0 ? getText('pisell-login-and-register-subtit') : _ref$subtitle,
|
|
48
49
|
_ref$showSubtitle = _ref.showSubtitle,
|
|
49
50
|
showSubtitle = _ref$showSubtitle === void 0 ? false : _ref$showSubtitle,
|
|
50
51
|
_ref$subtitleAlign = _ref.subtitleAlign,
|
|
@@ -54,35 +55,35 @@ var loginAndRegister = function loginAndRegister(_ref) {
|
|
|
54
55
|
_ref$defaultLoginMeth = _ref.defaultLoginMethod,
|
|
55
56
|
defaultLoginMethod = _ref$defaultLoginMeth === void 0 ? 'email' : _ref$defaultLoginMeth,
|
|
56
57
|
_ref$emailLabel = _ref.emailLabel,
|
|
57
|
-
emailLabel = _ref$emailLabel === void 0 ? '
|
|
58
|
+
emailLabel = _ref$emailLabel === void 0 ? getText('pisell-login-and-register-email-label') : _ref$emailLabel,
|
|
58
59
|
_ref$passwordLabel = _ref.passwordLabel,
|
|
59
|
-
passwordLabel = _ref$passwordLabel === void 0 ? '
|
|
60
|
+
passwordLabel = _ref$passwordLabel === void 0 ? getText('pisell-login-and-register-password-label') : _ref$passwordLabel,
|
|
60
61
|
_ref$emailPlaceholder = _ref.emailPlaceholder,
|
|
61
|
-
emailPlaceholder = _ref$emailPlaceholder === void 0 ? '
|
|
62
|
+
emailPlaceholder = _ref$emailPlaceholder === void 0 ? getText('pisell-login-and-register-email-placeholder') : _ref$emailPlaceholder,
|
|
62
63
|
_ref$passwordPlacehol = _ref.passwordPlaceholder,
|
|
63
|
-
passwordPlaceholder = _ref$passwordPlacehol === void 0 ? '
|
|
64
|
+
passwordPlaceholder = _ref$passwordPlacehol === void 0 ? getText('pisell-login-and-register-password-placeholder') : _ref$passwordPlacehol,
|
|
64
65
|
_ref$emailRules = _ref.emailRules,
|
|
65
66
|
emailRules = _ref$emailRules === void 0 ? [{
|
|
66
67
|
required: true,
|
|
67
|
-
message: '
|
|
68
|
+
message: getText('pisell-login-and-register-email-error')
|
|
68
69
|
}, {
|
|
69
70
|
type: 'email',
|
|
70
|
-
message: '
|
|
71
|
+
message: getText('pisell-login-and-register-email-error-valid')
|
|
71
72
|
}] : _ref$emailRules,
|
|
72
73
|
_ref$buttonText = _ref.buttonText,
|
|
73
|
-
buttonText = _ref$buttonText === void 0 ? 'Log in' : _ref$buttonText,
|
|
74
|
+
buttonText = _ref$buttonText === void 0 ? getText('Log in') : _ref$buttonText,
|
|
74
75
|
_ref$socialLoginTexts = _ref.socialLoginTexts,
|
|
75
76
|
socialLoginTexts = _ref$socialLoginTexts === void 0 ? {
|
|
76
|
-
google: '
|
|
77
|
-
facebook: '
|
|
78
|
-
apple: '
|
|
77
|
+
google: getText('pisell-login-and-register-google'),
|
|
78
|
+
facebook: getText('pisell-login-and-register-facebook'),
|
|
79
|
+
apple: getText('pisell-login-and-register-apple')
|
|
79
80
|
} : _ref$socialLoginTexts,
|
|
80
81
|
_ref$showFooter = _ref.showFooter,
|
|
81
82
|
showFooter = _ref$showFooter === void 0 ? true : _ref$showFooter,
|
|
82
83
|
_ref$showSignUp = _ref.showSignUp,
|
|
83
84
|
showSignUp = _ref$showSignUp === void 0 ? true : _ref$showSignUp,
|
|
84
85
|
_ref$signUpText = _ref.signUpText,
|
|
85
|
-
signUpText = _ref$signUpText === void 0 ?
|
|
86
|
+
signUpText = _ref$signUpText === void 0 ? getText('pisell-login-and-register-sign-up') : _ref$signUpText,
|
|
86
87
|
_ref$signUpLink = _ref.signUpLink,
|
|
87
88
|
signUpLink = _ref$signUpLink === void 0 ? '' : _ref$signUpLink,
|
|
88
89
|
_ref$signUpPosition = _ref.signUpPosition,
|
|
@@ -94,19 +95,19 @@ var loginAndRegister = function loginAndRegister(_ref) {
|
|
|
94
95
|
_ref$showTabs = _ref.showTabs,
|
|
95
96
|
showTabs = _ref$showTabs === void 0 ? true : _ref$showTabs,
|
|
96
97
|
_ref$loginTabText = _ref.loginTabText,
|
|
97
|
-
loginTabText = _ref$loginTabText === void 0 ? '
|
|
98
|
+
loginTabText = _ref$loginTabText === void 0 ? getText('pisell-login-and-register-login-tab') : _ref$loginTabText,
|
|
98
99
|
_ref$registerTabText = _ref.registerTabText,
|
|
99
|
-
registerTabText = _ref$registerTabText === void 0 ? '
|
|
100
|
+
registerTabText = _ref$registerTabText === void 0 ? getText('pisell-login-and-register-register-tab') : _ref$registerTabText,
|
|
100
101
|
_ref$registerEmailPla = _ref.registerEmailPlaceholder,
|
|
101
|
-
registerEmailPlaceholder = _ref$registerEmailPla === void 0 ? '
|
|
102
|
+
registerEmailPlaceholder = _ref$registerEmailPla === void 0 ? getText('pisell-login-and-register-register-email-placeholder') : _ref$registerEmailPla,
|
|
102
103
|
_ref$registerPassword = _ref.registerPasswordPlaceholder,
|
|
103
|
-
registerPasswordPlaceholder = _ref$registerPassword === void 0 ? '
|
|
104
|
+
registerPasswordPlaceholder = _ref$registerPassword === void 0 ? getText('pisell-login-and-register-register-password-placeholder') : _ref$registerPassword,
|
|
104
105
|
_ref$registerButtonTe = _ref.registerButtonText,
|
|
105
|
-
registerButtonText = _ref$registerButtonTe === void 0 ? '
|
|
106
|
+
registerButtonText = _ref$registerButtonTe === void 0 ? getText('pisell-login-and-register-register-button-text') : _ref$registerButtonTe,
|
|
106
107
|
_ref$rememberMeText = _ref.rememberMeText,
|
|
107
|
-
rememberMeText = _ref$rememberMeText === void 0 ? '
|
|
108
|
+
rememberMeText = _ref$rememberMeText === void 0 ? getText('pisell-login-and-register-remember-me') : _ref$rememberMeText,
|
|
108
109
|
_ref$forgotPasswordTe = _ref.forgotPasswordText,
|
|
109
|
-
forgotPasswordText = _ref$forgotPasswordTe === void 0 ? '
|
|
110
|
+
forgotPasswordText = _ref$forgotPasswordTe === void 0 ? getText('pisell-login-and-register-forgot-password') : _ref$forgotPasswordTe,
|
|
110
111
|
_ref$showRememberMe = _ref.showRememberMe,
|
|
111
112
|
showRememberMe = _ref$showRememberMe === void 0 ? false : _ref$showRememberMe,
|
|
112
113
|
_ref$showForgotPasswo = _ref.showForgotPassword,
|
|
@@ -218,6 +219,7 @@ var loginAndRegister = function loginAndRegister(_ref) {
|
|
|
218
219
|
return _ref3.apply(this, arguments);
|
|
219
220
|
};
|
|
220
221
|
}();
|
|
222
|
+
console.log(registerButtonText, 'registerButtonText');
|
|
221
223
|
return /*#__PURE__*/React.createElement("div", {
|
|
222
224
|
className: "saas-login-main"
|
|
223
225
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -285,7 +287,7 @@ var loginAndRegister = function loginAndRegister(_ref) {
|
|
|
285
287
|
loading: loading,
|
|
286
288
|
onClick: handleEmailLogin,
|
|
287
289
|
className: "saas-login-button"
|
|
288
|
-
},
|
|
290
|
+
}, getText('pisell-login-and-register-login'))) : /*#__PURE__*/React.createElement(Form, {
|
|
289
291
|
form: form
|
|
290
292
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
291
293
|
name: "email",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
position: relative;
|
|
68
68
|
|
|
69
69
|
&.active {
|
|
70
|
-
color:
|
|
70
|
+
color: var(--theme-color);
|
|
71
71
|
|
|
72
72
|
&:after {
|
|
73
73
|
content: '';
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
left: 0;
|
|
77
77
|
right: 0;
|
|
78
78
|
height: 2px;
|
|
79
|
-
background:
|
|
79
|
+
background: var(--theme-color);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -105,11 +105,11 @@
|
|
|
105
105
|
background: #FFF;
|
|
106
106
|
|
|
107
107
|
&:hover {
|
|
108
|
-
border-color:
|
|
108
|
+
border-color: var(--theme-color);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
&:focus {
|
|
112
|
-
border-color:
|
|
112
|
+
border-color: var(--theme-color);
|
|
113
113
|
box-shadow: 0 0 0 4px rgba(127, 86, 217, 0.1);
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
.saas-login-button {
|
|
127
127
|
height: 44px;
|
|
128
128
|
border-radius: 8px;
|
|
129
|
-
background:
|
|
129
|
+
background: var(--theme-color);
|
|
130
130
|
border: none;
|
|
131
131
|
font-weight: 500;
|
|
132
132
|
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
&:focus {
|
|
138
|
-
background:
|
|
138
|
+
background: var(--theme-color);
|
|
139
139
|
box-shadow: 0 0 0 4px rgba(127, 86, 217, 0.1);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
margin-bottom: 16px;
|
|
186
186
|
|
|
187
187
|
a {
|
|
188
|
-
color: #7F56D9;
|
|
188
|
+
//color: #7F56D9;
|
|
189
189
|
margin-left: 4px;
|
|
190
190
|
cursor: pointer;
|
|
191
191
|
|
|
@@ -63,7 +63,7 @@ var Page = function Page(props) {
|
|
|
63
63
|
// cssVar: { key: 'app' },
|
|
64
64
|
token: _objectSpread(_objectSpread({}, props.theme.token), {}, {
|
|
65
65
|
// 外部透传主题时,如果没有传入colorPrimary 默认使用主项目内主题色
|
|
66
|
-
colorPrimary: (props === null || props === void 0 || (_props$theme = props.theme) === null || _props$theme === void 0 || (_props$theme = _props$theme.token) === null || _props$theme === void 0 ? void 0 : _props$theme.colorPrimary) || themeColor || '#
|
|
66
|
+
colorPrimary: (props === null || props === void 0 || (_props$theme = props.theme) === null || _props$theme === void 0 || (_props$theme = _props$theme.token) === null || _props$theme === void 0 ? void 0 : _props$theme.colorPrimary) || themeColor || '#5D3F9F'
|
|
67
67
|
})
|
|
68
68
|
});
|
|
69
69
|
}
|
|
@@ -100,10 +100,10 @@ var Page = function Page(props) {
|
|
|
100
100
|
colorErrorBg: '#FEF3F2',
|
|
101
101
|
colorErrorBorderHover: '#FDA29B',
|
|
102
102
|
colorErrorOutline: 'rgba(217, 45, 32, 0.06)',
|
|
103
|
-
colorLink: '#
|
|
104
|
-
colorLinkActive: '#
|
|
105
|
-
colorLinkHover: '#
|
|
106
|
-
// colorPrimaryActive: '#
|
|
103
|
+
colorLink: '#7F56DA',
|
|
104
|
+
colorLinkActive: '#5F3DA8',
|
|
105
|
+
colorLinkHover: '#6D48C4',
|
|
106
|
+
// colorPrimaryActive: '#5D3F9F',
|
|
107
107
|
// colorPrimaryBorder: '#E9D7FE',
|
|
108
108
|
colorText: '#344054',
|
|
109
109
|
colorTextDisabled: '#D0D5DD',
|
|
@@ -150,59 +150,25 @@ var Page = function Page(props) {
|
|
|
150
150
|
Select: {
|
|
151
151
|
fontSizeIcon: 16
|
|
152
152
|
// "lineHeight": 1
|
|
153
|
+
},
|
|
154
|
+
Menu: {
|
|
155
|
+
subMenuItemSelectedColor: "#9976e3"
|
|
153
156
|
}
|
|
154
157
|
},
|
|
155
158
|
token: {
|
|
156
|
-
colorPrimary: themeColor || '#
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
//
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
colorSuccessBorder: '#ABEFC6',
|
|
170
|
-
colorSuccessBorderHover: '#75E0A7',
|
|
171
|
-
colorSuccessHover: '#067647',
|
|
172
|
-
colorSuccessText: '#067647',
|
|
173
|
-
colorSuccessActive: '#085D3A',
|
|
174
|
-
colorSuccessTextHover: '#085D3A',
|
|
175
|
-
colorSuccessTextActive: '#074D31',
|
|
176
|
-
colorWarning: '#dc6803',
|
|
177
|
-
colorWarningBg: '#FFFAEB',
|
|
178
|
-
colorWarningBgHover: '#FEF0C7',
|
|
179
|
-
colorWarningBorder: '#FEDF89',
|
|
180
|
-
colorWarningBorderHover: '#FEC84B',
|
|
181
|
-
colorWarningHover: '#B54708',
|
|
182
|
-
colorWarningText: '#B54708',
|
|
183
|
-
colorWarningActive: '#93370D',
|
|
184
|
-
colorWarningTextHover: '#93370D',
|
|
185
|
-
colorWarningTextActive: '#7A2E0E',
|
|
186
|
-
colorError: '#d92d20',
|
|
187
|
-
colorErrorBg: '#FEF3F2',
|
|
188
|
-
colorErrorBgHover: '#FEE4E2',
|
|
189
|
-
colorErrorBorder: '#FECDCA',
|
|
190
|
-
colorErrorBorderHover: '#FDA29B',
|
|
191
|
-
colorErrorHover: '#B42318',
|
|
192
|
-
colorErrorText: '#B42318',
|
|
193
|
-
colorErrorActive: '#912018',
|
|
194
|
-
colorErrorTextHover: '#912018',
|
|
195
|
-
colorErrorTextActive: '#7A271A',
|
|
196
|
-
colorInfo: '#1570ef',
|
|
197
|
-
colorInfoBg: '#EFF8FF',
|
|
198
|
-
colorInfoBgHover: '#D1E9FF',
|
|
199
|
-
colorInfoBorder: '#B2DDFF',
|
|
200
|
-
colorInfoBorderHover: '#84CAFF',
|
|
201
|
-
colorInfoHover: '#175CD3',
|
|
202
|
-
colorInfoText: '#175CD3',
|
|
203
|
-
colorInfoActive: '#1849A9',
|
|
204
|
-
colorInfoTextHover: '#1849A9',
|
|
205
|
-
colorInfoTextActive: '#194185',
|
|
159
|
+
colorPrimary: themeColor || '#5D3F9F',
|
|
160
|
+
colorPrimaryBg: '#eee5ff',
|
|
161
|
+
colorPrimaryBgHover: '#e4d9fc',
|
|
162
|
+
colorPrimaryBorder: '#d4c3f7',
|
|
163
|
+
colorSuccess: '#5f9e3f',
|
|
164
|
+
colorInfo: '#5d3f9f',
|
|
165
|
+
colorError: '#f5222d',
|
|
166
|
+
colorSuccessBg: '#e5fcd9',
|
|
167
|
+
colorSuccessBgHover: '#d5f7c3',
|
|
168
|
+
// 链接色
|
|
169
|
+
colorLink: '#7F56DA',
|
|
170
|
+
colorLinkActive: '#5F3DA8',
|
|
171
|
+
colorLinkHover: '#6D48C4',
|
|
206
172
|
colorText: '#101828',
|
|
207
173
|
colorTextSecondary: '#475467',
|
|
208
174
|
colorTextTertiary: '#667085',
|
|
@@ -226,7 +192,7 @@ var Page = function Page(props) {
|
|
|
226
192
|
return createTheme({
|
|
227
193
|
palette: {
|
|
228
194
|
primary: {
|
|
229
|
-
main: ((_theme$token = theme.token) === null || _theme$token === void 0 ? void 0 : _theme$token.colorPrimary) || '#
|
|
195
|
+
main: ((_theme$token = theme.token) === null || _theme$token === void 0 ? void 0 : _theme$token.colorPrimary) || '#5D3F9F'
|
|
230
196
|
}
|
|
231
197
|
}
|
|
232
198
|
});
|
|
@@ -255,7 +221,7 @@ var Page = function Page(props) {
|
|
|
255
221
|
variables: ((_context$engine2 = context.engine) === null || _context$engine2 === void 0 || (_context$engine2 = _context$engine2.props) === null || _context$engine2 === void 0 ? void 0 : _context$engine2.variables) || {}
|
|
256
222
|
}, /*#__PURE__*/React.createElement("div", {
|
|
257
223
|
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
258
|
-
'--theme-color': themeColor || '#
|
|
224
|
+
'--theme-color': themeColor || '#5D3F9F'
|
|
259
225
|
}),
|
|
260
226
|
className: className
|
|
261
227
|
}, children))))))));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
export interface Option {
|
|
4
|
+
id: string | number;
|
|
5
|
+
name: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export interface PisellAnchorProps {
|
|
8
|
+
options?: Option[];
|
|
9
|
+
tab?: string | number;
|
|
10
|
+
className?: string;
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
onChange?: (key: string | number) => void;
|
|
13
|
+
onTabClick?: () => void;
|
|
14
|
+
containerRef?: React.RefObject<HTMLElement>;
|
|
15
|
+
/**
|
|
16
|
+
* 平台类型,仅用于样式调整,不再影响锚点滚动功能
|
|
17
|
+
* 无论pc还是h5模式,点击锚点都会自动滚动到对应内容
|
|
18
|
+
* @default 'pc'
|
|
19
|
+
*/
|
|
20
|
+
platform?: 'pc' | 'h5';
|
|
21
|
+
}
|
|
22
|
+
declare const PisellAnchor: React.ForwardRefExoticComponent<PisellAnchorProps & React.RefAttributes<any>>;
|
|
23
|
+
export default PisellAnchor;
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
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."); }
|
|
4
|
+
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); }
|
|
5
|
+
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; }
|
|
6
|
+
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; } }
|
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
+
import React, { useState, forwardRef, useRef, useEffect } from 'react';
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import { useDebounceFn, useThrottleFn } from 'ahooks';
|
|
11
|
+
import ChevronLeft from '@pisell/icon/es/ChevronLeft';
|
|
12
|
+
import ChevronRight from '@pisell/icon/es/ChevronRight';
|
|
13
|
+
import "./index.less";
|
|
14
|
+
var PisellAnchor = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
15
|
+
var _props$options = props.options,
|
|
16
|
+
options = _props$options === void 0 ? [] : _props$options,
|
|
17
|
+
tab = props.tab,
|
|
18
|
+
className = props.className,
|
|
19
|
+
style = props.style,
|
|
20
|
+
onChange = props.onChange,
|
|
21
|
+
onTabClick = props.onTabClick,
|
|
22
|
+
containerRef = props.containerRef,
|
|
23
|
+
_props$platform = props.platform,
|
|
24
|
+
platform = _props$platform === void 0 ? 'pc' : _props$platform;
|
|
25
|
+
var contentRef = useRef(null);
|
|
26
|
+
var scrollTimeoutRef = useRef(null);
|
|
27
|
+
var isClickScrolling = useRef(false);
|
|
28
|
+
var clickedTabRef = useRef(null);
|
|
29
|
+
var _useState = useState(0),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
leftWidth = _useState2[0],
|
|
32
|
+
setLeftWidth = _useState2[1];
|
|
33
|
+
var _useState3 = useState(40),
|
|
34
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
35
|
+
rightWidth = _useState4[0],
|
|
36
|
+
setRightWidth = _useState4[1];
|
|
37
|
+
var _useState5 = useState(false),
|
|
38
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
39
|
+
showButtons = _useState6[0],
|
|
40
|
+
setShowButtons = _useState6[1];
|
|
41
|
+
var _useState7 = useState(null),
|
|
42
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
43
|
+
hoveredTab = _useState8[0],
|
|
44
|
+
setHoveredTab = _useState8[1];
|
|
45
|
+
|
|
46
|
+
// 检查是否需要显示按钮
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
if (contentRef.current) {
|
|
49
|
+
var _contentRef$current = contentRef.current,
|
|
50
|
+
scrollWidth = _contentRef$current.scrollWidth,
|
|
51
|
+
clientWidth = _contentRef$current.clientWidth;
|
|
52
|
+
setShowButtons(scrollWidth > clientWidth);
|
|
53
|
+
}
|
|
54
|
+
}, [options]);
|
|
55
|
+
|
|
56
|
+
// 清理定时器
|
|
57
|
+
useEffect(function () {
|
|
58
|
+
return function () {
|
|
59
|
+
if (scrollTimeoutRef.current) {
|
|
60
|
+
clearTimeout(scrollTimeoutRef.current);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}, []);
|
|
64
|
+
|
|
65
|
+
// 处理水平滚动
|
|
66
|
+
var _useDebounceFn = useDebounceFn(function (e) {
|
|
67
|
+
var _e$target = e.target,
|
|
68
|
+
scrollLeft = _e$target.scrollLeft,
|
|
69
|
+
scrollWidth = _e$target.scrollWidth,
|
|
70
|
+
clientWidth = _e$target.clientWidth;
|
|
71
|
+
setLeftWidth(scrollLeft > 0 ? 40 : 0);
|
|
72
|
+
setRightWidth(scrollLeft + clientWidth >= scrollWidth ? 0 : 40);
|
|
73
|
+
}, {
|
|
74
|
+
wait: 200
|
|
75
|
+
}),
|
|
76
|
+
onScrollDebounced = _useDebounceFn.run;
|
|
77
|
+
|
|
78
|
+
// 处理垂直滚动
|
|
79
|
+
var _useThrottleFn = useThrottleFn(function () {
|
|
80
|
+
// 如果是点击触发的滚动,不处理滚动检测
|
|
81
|
+
if (isClickScrolling.current) return;
|
|
82
|
+
if (!(containerRef !== null && containerRef !== void 0 && containerRef.current)) return;
|
|
83
|
+
var container = containerRef.current;
|
|
84
|
+
var headerHeight = 65;
|
|
85
|
+
var containerRect = container.getBoundingClientRect();
|
|
86
|
+
var scrollTop = container.scrollTop;
|
|
87
|
+
var containerHeight = containerRect.height;
|
|
88
|
+
var scrollHeight = container.scrollHeight;
|
|
89
|
+
|
|
90
|
+
// 检查是否滚动到底部
|
|
91
|
+
var isAtBottom = scrollTop + containerHeight >= scrollHeight - 50;
|
|
92
|
+
if (isAtBottom) {
|
|
93
|
+
var lastOption = options[options.length - 1];
|
|
94
|
+
// 不要切回到之前点击的 tab
|
|
95
|
+
if (tab !== lastOption.id && lastOption.id !== clickedTabRef.current) {
|
|
96
|
+
onChange === null || onChange === void 0 || onChange(lastOption.id);
|
|
97
|
+
}
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// 找到当前可见的元素
|
|
102
|
+
var closestOption = null;
|
|
103
|
+
var minDistance = Infinity;
|
|
104
|
+
var _iterator = _createForOfIteratorHelper(options),
|
|
105
|
+
_step;
|
|
106
|
+
try {
|
|
107
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
108
|
+
var option = _step.value;
|
|
109
|
+
// 尝试通过ID和data属性查找元素
|
|
110
|
+
var elementById = document.getElementById(option.id);
|
|
111
|
+
var elementByDataAttr = document.querySelector("[data-section=\"".concat(option.id, "\"]"));
|
|
112
|
+
var element = elementById || elementByDataAttr;
|
|
113
|
+
if (element) {
|
|
114
|
+
// 使用类型断言解决TS错误
|
|
115
|
+
var htmlElement = element;
|
|
116
|
+
|
|
117
|
+
// 使用offsetTop计算更准确
|
|
118
|
+
var elementOffsetTop = htmlElement.offsetTop;
|
|
119
|
+
var elementHeight = htmlElement.offsetHeight;
|
|
120
|
+
|
|
121
|
+
// 计算可见度
|
|
122
|
+
var elementTopRelativeToViewport = elementOffsetTop - scrollTop;
|
|
123
|
+
var isTopVisible = elementTopRelativeToViewport >= headerHeight && elementTopRelativeToViewport <= containerHeight;
|
|
124
|
+
var isBottomVisible = elementTopRelativeToViewport + elementHeight >= headerHeight && elementTopRelativeToViewport + elementHeight <= containerHeight;
|
|
125
|
+
var isElementPartiallyVisible = isTopVisible || isBottomVisible || elementTopRelativeToViewport < headerHeight && elementTopRelativeToViewport + elementHeight > containerHeight;
|
|
126
|
+
var distance = Math.abs(elementTopRelativeToViewport - headerHeight);
|
|
127
|
+
if (distance < minDistance) {
|
|
128
|
+
minDistance = distance;
|
|
129
|
+
closestOption = option;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// 不要切回到之前点击的 tab
|
|
135
|
+
} catch (err) {
|
|
136
|
+
_iterator.e(err);
|
|
137
|
+
} finally {
|
|
138
|
+
_iterator.f();
|
|
139
|
+
}
|
|
140
|
+
if (closestOption && tab !== closestOption.id && closestOption.id !== clickedTabRef.current && minDistance < 50) {
|
|
141
|
+
onChange === null || onChange === void 0 || onChange(closestOption.id);
|
|
142
|
+
}
|
|
143
|
+
}, {
|
|
144
|
+
wait: 150
|
|
145
|
+
}),
|
|
146
|
+
handleScrollThrottled = _useThrottleFn.run;
|
|
147
|
+
|
|
148
|
+
// 监听容器滚动
|
|
149
|
+
useEffect(function () {
|
|
150
|
+
if (!(containerRef !== null && containerRef !== void 0 && containerRef.current)) return;
|
|
151
|
+
var handleScroll = function handleScroll() {
|
|
152
|
+
if (!isClickScrolling.current) {
|
|
153
|
+
handleScrollThrottled();
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
var container = containerRef.current;
|
|
157
|
+
container.addEventListener('scroll', handleScroll);
|
|
158
|
+
return function () {
|
|
159
|
+
container.removeEventListener('scroll', handleScroll);
|
|
160
|
+
};
|
|
161
|
+
}, [handleScrollThrottled]);
|
|
162
|
+
|
|
163
|
+
// 点击选项时更新选中项并滚动
|
|
164
|
+
var handleOptionClick = function handleOptionClick(item) {
|
|
165
|
+
// 添加调试日志
|
|
166
|
+
console.log('PisellAnchor: Tab clicked', item.id);
|
|
167
|
+
if (scrollTimeoutRef.current) {
|
|
168
|
+
clearTimeout(scrollTimeoutRef.current);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// 更新选中项
|
|
172
|
+
onChange === null || onChange === void 0 || onChange(item.id);
|
|
173
|
+
|
|
174
|
+
// 触发点击事件回调
|
|
175
|
+
onTabClick === null || onTabClick === void 0 || onTabClick();
|
|
176
|
+
|
|
177
|
+
// 统一PC和H5的交互逻辑,无论什么平台都执行滚动
|
|
178
|
+
// 尝试多种方式查找目标元素
|
|
179
|
+
var elementById = document.getElementById(String(item.id));
|
|
180
|
+
var elementByDataAttr = document.querySelector("[data-section=\"".concat(String(item.id), "\"]"));
|
|
181
|
+
var element = elementById || elementByDataAttr;
|
|
182
|
+
|
|
183
|
+
// 添加调试日志
|
|
184
|
+
console.log('PisellAnchor: Target element found?', !!element);
|
|
185
|
+
console.log('PisellAnchor: Container ref exists?', !!(containerRef !== null && containerRef !== void 0 && containerRef.current));
|
|
186
|
+
if (element && containerRef !== null && containerRef !== void 0 && containerRef.current) {
|
|
187
|
+
isClickScrolling.current = true;
|
|
188
|
+
clickedTabRef.current = item.id;
|
|
189
|
+
|
|
190
|
+
// 使用requestAnimationFrame确保DOM更新后再滚动
|
|
191
|
+
requestAnimationFrame(function () {
|
|
192
|
+
if (!(containerRef !== null && containerRef !== void 0 && containerRef.current)) return;
|
|
193
|
+
|
|
194
|
+
// 使用类型断言解决TS错误
|
|
195
|
+
var htmlElement = element;
|
|
196
|
+
|
|
197
|
+
// 更准确的滚动位置计算
|
|
198
|
+
var headerHeight = 65; // 使用一致的头部高度
|
|
199
|
+
var elementOffsetTop = htmlElement.offsetTop; // 使用offsetTop而不是getBoundingClientRect()
|
|
200
|
+
|
|
201
|
+
// 添加调试日志
|
|
202
|
+
console.log('PisellAnchor: Scrolling using offsetTop', {
|
|
203
|
+
elementOffsetTop: elementOffsetTop,
|
|
204
|
+
targetScrollTop: elementOffsetTop - headerHeight
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
// 执行滚动 - 使用更直接的offsetTop定位
|
|
208
|
+
containerRef.current.scrollTo({
|
|
209
|
+
top: elementOffsetTop - headerHeight,
|
|
210
|
+
behavior: 'smooth'
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
// 添加备份滚动机制
|
|
214
|
+
setTimeout(function () {
|
|
215
|
+
if (!(containerRef !== null && containerRef !== void 0 && containerRef.current)) return;
|
|
216
|
+
|
|
217
|
+
// 强制再次滚动以确保滚动效果
|
|
218
|
+
containerRef.current.scrollTo({
|
|
219
|
+
top: elementOffsetTop - headerHeight,
|
|
220
|
+
behavior: 'auto' // 使用即时滚动确保位置准确
|
|
221
|
+
});
|
|
222
|
+
}, 300);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// 延迟重置状态
|
|
226
|
+
scrollTimeoutRef.current = setTimeout(function () {
|
|
227
|
+
isClickScrolling.current = false;
|
|
228
|
+
clickedTabRef.current = null;
|
|
229
|
+
}, 1000);
|
|
230
|
+
} else {
|
|
231
|
+
console.warn('PisellAnchor: Cannot scroll, element or container not found', {
|
|
232
|
+
elementId: item.id,
|
|
233
|
+
elementByIdExists: !!elementById,
|
|
234
|
+
elementByDataAttrExists: !!elementByDataAttr,
|
|
235
|
+
containerExists: !!(containerRef !== null && containerRef !== void 0 && containerRef.current)
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
// 左右按钮点击处理
|
|
241
|
+
var onPageChange = function onPageChange(type) {
|
|
242
|
+
if (contentRef.current) {
|
|
243
|
+
var _contentRef$current2 = contentRef.current,
|
|
244
|
+
scrollLeft = _contentRef$current2.scrollLeft,
|
|
245
|
+
clientWidth = _contentRef$current2.clientWidth;
|
|
246
|
+
var newScrollLeft = scrollLeft + (type === 'left' ? -clientWidth : clientWidth);
|
|
247
|
+
contentRef.current.scrollTo({
|
|
248
|
+
left: newScrollLeft,
|
|
249
|
+
behavior: 'smooth'
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
254
|
+
className: classNames('pisell-anchor-tabs', className),
|
|
255
|
+
style: style
|
|
256
|
+
}, showButtons && /*#__PURE__*/React.createElement("div", {
|
|
257
|
+
className: "pisell-anchor-tabs-btn-left",
|
|
258
|
+
style: {
|
|
259
|
+
width: leftWidth
|
|
260
|
+
},
|
|
261
|
+
onClick: function onClick() {
|
|
262
|
+
return onPageChange('left');
|
|
263
|
+
}
|
|
264
|
+
}, /*#__PURE__*/React.createElement(ChevronLeft, {
|
|
265
|
+
className: "pisell-anchor-tabs-btn-icon"
|
|
266
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
267
|
+
ref: contentRef,
|
|
268
|
+
className: "pisell-anchor-tabs-content",
|
|
269
|
+
id: "tab-".concat(tab, "-content"),
|
|
270
|
+
onScroll: onScrollDebounced
|
|
271
|
+
}, options.map(function (item) {
|
|
272
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
273
|
+
key: item.id,
|
|
274
|
+
id: "tab-".concat(item.id),
|
|
275
|
+
className: classNames('pisell-anchor-tabs-tab', {
|
|
276
|
+
'pisell-anchor-tabs-tab-active': tab === item.id
|
|
277
|
+
}),
|
|
278
|
+
onClick: function onClick() {
|
|
279
|
+
console.log('PisellAnchor: Tab div clicked', item.id);
|
|
280
|
+
handleOptionClick(item);
|
|
281
|
+
}
|
|
282
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
283
|
+
className: "pisell-anchor-tabs-tab-content",
|
|
284
|
+
onClick: function onClick(e) {
|
|
285
|
+
// 防止事件冒泡问题
|
|
286
|
+
e.stopPropagation();
|
|
287
|
+
console.log('PisellAnchor: Tab span clicked', item.id);
|
|
288
|
+
handleOptionClick(item);
|
|
289
|
+
}
|
|
290
|
+
}, item.name));
|
|
291
|
+
})), showButtons && /*#__PURE__*/React.createElement("div", {
|
|
292
|
+
className: "pisell-anchor-tabs-btn-right",
|
|
293
|
+
style: {
|
|
294
|
+
width: rightWidth
|
|
295
|
+
},
|
|
296
|
+
onClick: function onClick() {
|
|
297
|
+
return onPageChange('right');
|
|
298
|
+
}
|
|
299
|
+
}, /*#__PURE__*/React.createElement(ChevronRight, {
|
|
300
|
+
className: "pisell-anchor-tabs-btn-icon"
|
|
301
|
+
})));
|
|
302
|
+
});
|
|
303
|
+
export default PisellAnchor;
|