@pisell/materials 1.0.1057 → 1.0.1059
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 +3 -3
- package/build/lowcode/preview.js +9 -9
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +20 -20
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +23 -23
- package/es/components/PisellCards/index.d.ts +3 -0
- package/es/components/PisellCards/index.js +3 -1
- package/es/components/PisellContactBrief/PisellContactBrief.d.ts +13 -0
- package/es/components/PisellContactBrief/PisellContactBrief.js +223 -0
- package/es/components/PisellContactBrief/PisellContactBrief.less +192 -0
- package/es/components/PisellContactBrief/PisellContactBrief.stories.d.ts +31 -0
- package/es/components/PisellContactBrief/PisellContactBrief.stories.js +196 -0
- package/es/components/PisellContactBrief/components/ContactFormModal.d.ts +23 -0
- package/es/components/PisellContactBrief/components/ContactFormModal.js +177 -0
- package/es/components/PisellContactBrief/components/index.d.ts +5 -0
- package/es/components/PisellContactBrief/components/index.js +4 -0
- package/es/components/PisellContactBrief/index.d.ts +6 -0
- package/es/components/PisellContactBrief/index.js +5 -0
- package/es/components/PisellContactBrief/locales.d.ts +55 -0
- package/es/components/PisellContactBrief/locales.js +54 -0
- package/es/components/PisellContactBrief/types.d.ts +82 -0
- package/es/components/PisellContactBrief/types.js +1 -0
- package/es/components/dataSourceComponents/fields/Tabs/Tabs.less +8 -0
- package/es/components/pisellActionPanel/PisellActionPanel.d.ts +13 -0
- package/es/components/pisellActionPanel/PisellActionPanel.js +98 -0
- package/es/components/pisellActionPanel/PisellActionPanel.less +69 -0
- package/es/components/pisellActionPanel/PisellActionPanel.stories.d.ts +19 -0
- package/es/components/pisellActionPanel/PisellActionPanel.stories.js +208 -0
- package/es/components/pisellActionPanel/index.d.ts +6 -0
- package/es/components/pisellActionPanel/index.js +5 -0
- package/es/components/pisellActionPanel/types.d.ts +83 -0
- package/es/components/pisellActionPanel/types.js +1 -0
- package/es/components/pisellBaseCard/PisellBaseCard.d.ts +8 -0
- package/es/components/pisellBaseCard/PisellBaseCard.js +96 -0
- package/es/components/pisellBaseCard/PisellBaseCard.less +25 -0
- package/es/components/pisellBaseCard/PisellBaseCard.stories.d.ts +19 -0
- package/es/components/pisellBaseCard/PisellBaseCard.stories.js +99 -0
- package/es/components/pisellBaseCard/index.d.ts +5 -0
- package/es/components/pisellBaseCard/index.js +4 -0
- package/es/components/pisellBaseCard/types.d.ts +45 -0
- package/es/components/pisellBaseCard/types.js +1 -0
- package/es/components/pisellCurrency/PisellCurrency.js +18 -12
- package/es/components/pisellCurrency/PisellCurrency.less +0 -123
- package/es/components/pisellCustomerBrief/PisellCustomerBrief.d.ts +15 -0
- package/es/components/pisellCustomerBrief/PisellCustomerBrief.js +145 -0
- package/es/components/pisellCustomerBrief/PisellCustomerBrief.less +8 -0
- package/es/components/pisellCustomerBrief/PisellCustomerBrief.stories.d.ts +23 -0
- package/es/components/pisellCustomerBrief/PisellCustomerBrief.stories.js +193 -0
- package/es/components/pisellCustomerBrief/index.d.ts +6 -0
- package/es/components/pisellCustomerBrief/index.js +5 -0
- package/es/components/pisellCustomerBrief/types.d.ts +82 -0
- package/es/components/pisellCustomerBrief/types.js +1 -0
- package/es/components/pisellEmail/PisellEmail.js +48 -42
- package/es/components/pisellEmail/PisellEmail.less +0 -92
- package/es/components/pisellEntityCard/PisellEntityCard.d.ts +8 -0
- package/es/components/pisellEntityCard/PisellEntityCard.js +474 -0
- package/es/components/pisellEntityCard/PisellEntityCard.less +362 -0
- package/es/components/pisellEntityCard/PisellEntityCard.stories.d.ts +47 -0
- package/es/components/pisellEntityCard/PisellEntityCard.stories.js +450 -0
- package/es/components/pisellEntityCard/index.d.ts +5 -0
- package/es/components/pisellEntityCard/index.js +4 -0
- package/es/components/pisellEntityCard/types.d.ts +144 -0
- package/es/components/pisellEntityCard/types.js +1 -0
- package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.js +32 -4
- package/es/components/pisellFloorMapLayout/PisellFloorMapLayout.stories.js +4 -2
- package/es/components/pisellFloorMapLayout/components/ViewControls.d.ts +4 -0
- package/es/components/pisellFloorMapLayout/components/ViewControls.js +12 -2
- package/es/components/pisellFloorMapLayout/types.d.ts +2 -0
- package/es/components/pisellLongText/PisellLongText.js +18 -12
- package/es/components/pisellLongText/PisellLongText.less +0 -67
- package/es/components/pisellLookup/PisellLookup.js +8 -1
- package/es/components/pisellMultipleSelect/PisellMultipleSelect.js +14 -6
- package/es/components/pisellMultipleSelect/PisellMultipleSelect.less +18 -139
- package/es/components/pisellMultipleSelect/components/EditView.js +1 -0
- package/es/components/pisellNumber/PisellNumber.js +18 -12
- package/es/components/pisellNumber/PisellNumber.less +0 -103
- package/es/components/pisellPhone/PisellPhone.js +18 -12
- package/es/components/pisellPhone/PisellPhone.less +0 -119
- package/es/components/pisellPhone/components/EditView.js +44 -33
- package/es/components/pisellPhone/constants/countryCodes.d.ts +1 -0
- package/es/components/pisellPhone/constants/countryCodes.js +26 -25
- package/es/components/pisellPhone/types.d.ts +2 -2
- package/es/components/pisellPhone/utils/countryCodeHelper.d.ts +4 -4
- package/es/components/pisellPhone/utils/countryCodeHelper.js +5 -5
- package/es/components/pisellRating/PisellRating.js +7 -3
- package/es/components/pisellSingleLineText/PisellSingleLineText.js +27 -20
- package/es/components/pisellSingleLineText/PisellSingleLineText.less +58 -201
- package/es/components/pisellSingleSelect/PisellSingleSelect.js +14 -5
- package/es/components/pisellSingleSelect/PisellSingleSelect.less +5 -106
- package/es/components/pisellUrl/PisellUrl.js +48 -42
- package/es/components/pisellWalletPassCard/index.js +2 -1
- package/es/index.d.ts +15 -4
- package/es/index.js +8 -4
- package/es/theme/pisell-components.d.ts +14 -0
- package/es/theme/pisell-components.js +74 -0
- package/lib/components/PisellCards/index.d.ts +3 -0
- package/lib/components/PisellCards/index.js +3 -1
- package/lib/components/PisellContactBrief/PisellContactBrief.d.ts +13 -0
- package/lib/components/PisellContactBrief/PisellContactBrief.js +231 -0
- package/lib/components/PisellContactBrief/PisellContactBrief.less +192 -0
- package/lib/components/PisellContactBrief/PisellContactBrief.stories.d.ts +31 -0
- package/lib/components/PisellContactBrief/PisellContactBrief.stories.js +188 -0
- package/lib/components/PisellContactBrief/components/ContactFormModal.d.ts +23 -0
- package/lib/components/PisellContactBrief/components/ContactFormModal.js +154 -0
- package/lib/components/PisellContactBrief/components/index.d.ts +5 -0
- package/lib/components/PisellContactBrief/components/index.js +29 -0
- package/lib/components/PisellContactBrief/index.d.ts +6 -0
- package/lib/components/PisellContactBrief/index.js +29 -0
- package/lib/components/PisellContactBrief/locales.d.ts +55 -0
- package/lib/components/PisellContactBrief/locales.js +74 -0
- package/lib/components/PisellContactBrief/types.d.ts +82 -0
- package/lib/components/PisellContactBrief/types.js +17 -0
- package/lib/components/dataSourceComponents/fields/Tabs/Tabs.less +8 -0
- package/lib/components/pisellActionPanel/PisellActionPanel.d.ts +13 -0
- package/lib/components/pisellActionPanel/PisellActionPanel.js +124 -0
- package/lib/components/pisellActionPanel/PisellActionPanel.less +69 -0
- package/lib/components/pisellActionPanel/PisellActionPanel.stories.d.ts +19 -0
- package/lib/components/pisellActionPanel/PisellActionPanel.stories.js +186 -0
- package/lib/components/pisellActionPanel/index.d.ts +6 -0
- package/lib/components/pisellActionPanel/index.js +29 -0
- package/lib/components/pisellActionPanel/types.d.ts +83 -0
- package/lib/components/pisellActionPanel/types.js +17 -0
- package/lib/components/pisellBaseCard/PisellBaseCard.d.ts +8 -0
- package/lib/components/pisellBaseCard/PisellBaseCard.js +124 -0
- package/lib/components/pisellBaseCard/PisellBaseCard.less +25 -0
- package/lib/components/pisellBaseCard/PisellBaseCard.stories.d.ts +19 -0
- package/lib/components/pisellBaseCard/PisellBaseCard.stories.js +107 -0
- package/lib/components/pisellBaseCard/index.d.ts +5 -0
- package/lib/components/pisellBaseCard/index.js +29 -0
- package/lib/components/pisellBaseCard/types.d.ts +45 -0
- package/lib/components/pisellBaseCard/types.js +17 -0
- package/lib/components/pisellCurrency/PisellCurrency.js +16 -10
- package/lib/components/pisellCurrency/PisellCurrency.less +0 -123
- package/lib/components/pisellCustomerBrief/PisellCustomerBrief.d.ts +15 -0
- package/lib/components/pisellCustomerBrief/PisellCustomerBrief.js +143 -0
- package/lib/components/pisellCustomerBrief/PisellCustomerBrief.less +8 -0
- package/lib/components/pisellCustomerBrief/PisellCustomerBrief.stories.d.ts +23 -0
- package/lib/components/pisellCustomerBrief/PisellCustomerBrief.stories.js +171 -0
- package/lib/components/pisellCustomerBrief/index.d.ts +6 -0
- package/lib/components/pisellCustomerBrief/index.js +29 -0
- package/lib/components/pisellCustomerBrief/types.d.ts +82 -0
- package/lib/components/pisellCustomerBrief/types.js +17 -0
- package/lib/components/pisellEmail/PisellEmail.js +16 -10
- package/lib/components/pisellEmail/PisellEmail.less +0 -92
- package/lib/components/pisellEntityCard/PisellEntityCard.d.ts +8 -0
- package/lib/components/pisellEntityCard/PisellEntityCard.js +426 -0
- package/lib/components/pisellEntityCard/PisellEntityCard.less +362 -0
- package/lib/components/pisellEntityCard/PisellEntityCard.stories.d.ts +47 -0
- package/lib/components/pisellEntityCard/PisellEntityCard.stories.js +349 -0
- package/lib/components/pisellEntityCard/index.d.ts +5 -0
- package/lib/components/pisellEntityCard/index.js +29 -0
- package/lib/components/pisellEntityCard/types.d.ts +144 -0
- package/lib/components/pisellEntityCard/types.js +17 -0
- package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.js +22 -3
- package/lib/components/pisellFloorMapLayout/PisellFloorMapLayout.stories.js +2 -2
- package/lib/components/pisellFloorMapLayout/components/ViewControls.d.ts +4 -0
- package/lib/components/pisellFloorMapLayout/components/ViewControls.js +11 -1
- package/lib/components/pisellFloorMapLayout/types.d.ts +2 -0
- package/lib/components/pisellLongText/PisellLongText.js +16 -10
- package/lib/components/pisellLongText/PisellLongText.less +0 -67
- package/lib/components/pisellLookup/PisellLookup.js +5 -1
- package/lib/components/pisellMultipleSelect/PisellMultipleSelect.js +62 -53
- package/lib/components/pisellMultipleSelect/PisellMultipleSelect.less +18 -139
- package/lib/components/pisellMultipleSelect/components/EditView.js +42 -30
- package/lib/components/pisellNumber/PisellNumber.js +16 -10
- package/lib/components/pisellNumber/PisellNumber.less +0 -103
- package/lib/components/pisellPhone/PisellPhone.js +16 -10
- package/lib/components/pisellPhone/PisellPhone.less +0 -119
- package/lib/components/pisellPhone/components/EditView.js +40 -24
- package/lib/components/pisellPhone/constants/countryCodes.d.ts +1 -0
- package/lib/components/pisellPhone/constants/countryCodes.js +24 -24
- package/lib/components/pisellPhone/types.d.ts +2 -2
- package/lib/components/pisellPhone/utils/countryCodeHelper.d.ts +4 -4
- package/lib/components/pisellPhone/utils/countryCodeHelper.js +1 -1
- package/lib/components/pisellRating/PisellRating.js +4 -2
- package/lib/components/pisellSingleLineText/PisellSingleLineText.js +16 -10
- package/lib/components/pisellSingleLineText/PisellSingleLineText.less +58 -201
- package/lib/components/pisellSingleSelect/PisellSingleSelect.js +34 -35
- package/lib/components/pisellSingleSelect/PisellSingleSelect.less +5 -106
- package/lib/components/pisellUrl/PisellUrl.js +16 -10
- package/lib/components/pisellWalletPassCard/index.js +1 -1
- package/lib/index.d.ts +15 -4
- package/lib/index.js +18 -3
- package/lib/theme/pisell-components.d.ts +14 -0
- package/lib/theme/pisell-components.js +89 -0
- package/lowcode/pisell-action-panel/meta.ts +146 -0
- package/lowcode/pisell-action-panel/snippets.ts +42 -0
- package/lowcode/pisell-base-card/meta.ts +98 -0
- package/lowcode/pisell-base-card/snippets.ts +13 -0
- package/lowcode/pisell-contact-brief/meta.ts +178 -0
- package/lowcode/pisell-contact-brief/snippets.ts +40 -0
- package/lowcode/pisell-customer-brief/meta.ts +262 -0
- package/lowcode/pisell-customer-brief/snippets.ts +46 -0
- package/lowcode/pisell-entity-card/meta.ts +296 -0
- package/lowcode/pisell-entity-card/snippets.ts +41 -0
- package/lowcode/pisell-floor-map-layout/meta.ts +37 -1
- package/package.json +4 -4
|
@@ -7,125 +7,6 @@
|
|
|
7
7
|
&-edit {
|
|
8
8
|
position: relative;
|
|
9
9
|
width: 100%;
|
|
10
|
-
|
|
11
|
-
.pisell-lowcode-space-compact {
|
|
12
|
-
width: 100%;
|
|
13
|
-
position: relative;
|
|
14
|
-
border-radius: 8px;
|
|
15
|
-
|
|
16
|
-
// 聚焦时整体外圈(与 SingleLineText 一致)
|
|
17
|
-
&:focus-within {
|
|
18
|
-
box-shadow: 0 0 0 4px #f4ebff; // Primary/100
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// 国家码 Select 与 号码 Input 共用 Figma 设计 token
|
|
23
|
-
.pisell-lowcode-select-selector,
|
|
24
|
-
.pisell-lowcode-input {
|
|
25
|
-
font-size: 16px !important;
|
|
26
|
-
line-height: 24px !important;
|
|
27
|
-
border: 1px solid #d0d5dd !important; // Gray/300
|
|
28
|
-
color: #101828 !important; // Gray/900
|
|
29
|
-
background-color: #ffffff !important;
|
|
30
|
-
height: 48px !important;
|
|
31
|
-
padding: 12px 16px !important;
|
|
32
|
-
|
|
33
|
-
&::placeholder {
|
|
34
|
-
color: #667085 !important; // Gray/500
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
&:hover:not(:focus):not(.pisell-lowcode-select-open):not([disabled]) {
|
|
38
|
-
border-color: #b692f6 !important; // Primary/400
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&[disabled],
|
|
42
|
-
&.pisell-lowcode-input-disabled {
|
|
43
|
-
background-color: #f9fafb !important; // Gray/50
|
|
44
|
-
color: #98a2b3 !important; // Gray/400
|
|
45
|
-
border-color: #d0d5dd !important;
|
|
46
|
-
cursor: not-allowed !important;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// 国家码选择器:左侧部分,去掉右侧边框与圆角
|
|
51
|
-
.pisell-lowcode-select {
|
|
52
|
-
flex-shrink: 0;
|
|
53
|
-
|
|
54
|
-
.pisell-lowcode-select-selector {
|
|
55
|
-
border-right: none !important;
|
|
56
|
-
border-top-right-radius: 0 !important;
|
|
57
|
-
border-bottom-right-radius: 0 !important;
|
|
58
|
-
border-top-left-radius: 8px !important;
|
|
59
|
-
border-bottom-left-radius: 8px !important;
|
|
60
|
-
min-height: 48px !important;
|
|
61
|
-
padding: 4px 12px 4px 16px !important;
|
|
62
|
-
align-items: center !important;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
&.pisell-lowcode-select-focused .pisell-lowcode-select-selector {
|
|
66
|
-
border-color: #d6bbfb !important; // Primary/300
|
|
67
|
-
box-shadow: none !important;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// 号码输入框:右侧部分,去掉左侧边框与圆角
|
|
72
|
-
.pisell-lowcode-input {
|
|
73
|
-
flex: 1;
|
|
74
|
-
border-left: none !important;
|
|
75
|
-
border-top-left-radius: 0 !important;
|
|
76
|
-
border-bottom-left-radius: 0 !important;
|
|
77
|
-
border-top-right-radius: 8px !important;
|
|
78
|
-
border-bottom-right-radius: 8px !important;
|
|
79
|
-
|
|
80
|
-
&:focus {
|
|
81
|
-
border-color: #d6bbfb !important; // Primary/300
|
|
82
|
-
box-shadow: none !important;
|
|
83
|
-
outline: none !important;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// 整体聚焦时两侧边框统一为 Primary
|
|
88
|
-
.pisell-lowcode-space-compact:focus-within .pisell-lowcode-select-selector,
|
|
89
|
-
.pisell-lowcode-space-compact:focus-within .pisell-lowcode-input {
|
|
90
|
-
border-color: #d6bbfb !important;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.pisell-lowcode-space-compact:focus-within .pisell-lowcode-select-selector {
|
|
94
|
-
box-shadow: none !important;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// 清空按钮
|
|
98
|
-
.pisell-lowcode-input-clear-icon {
|
|
99
|
-
color: #667085 !important;
|
|
100
|
-
font-size: 14px !important;
|
|
101
|
-
|
|
102
|
-
&:hover {
|
|
103
|
-
color: #344054 !important; // Gray/700
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// 错误状态:Select + Input 整体
|
|
108
|
-
.pisell-lowcode-select-status-error .pisell-lowcode-select-selector,
|
|
109
|
-
.pisell-lowcode-input-status-error {
|
|
110
|
-
border-color: #fda29b !important; // Error/300
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.pisell-lowcode-space-compact:has(.pisell-lowcode-select-status-error) .pisell-lowcode-select-selector,
|
|
114
|
-
.pisell-lowcode-space-compact:has(.pisell-lowcode-input-status-error) .pisell-lowcode-input {
|
|
115
|
-
border-color: #fda29b !important;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.pisell-lowcode-space-compact:focus-within:has(.pisell-lowcode-input-status-error) .pisell-lowcode-select-selector,
|
|
119
|
-
.pisell-lowcode-space-compact:focus-within:has(.pisell-lowcode-input-status-error) .pisell-lowcode-input,
|
|
120
|
-
.pisell-lowcode-space-compact:focus-within:has(.pisell-lowcode-select-status-error) .pisell-lowcode-select-selector,
|
|
121
|
-
.pisell-lowcode-space-compact:focus-within:has(.pisell-lowcode-select-status-error) .pisell-lowcode-input {
|
|
122
|
-
border-color: #f97066 !important; // Error/400
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.pisell-lowcode-space-compact:focus-within:has(.pisell-lowcode-input-status-error),
|
|
126
|
-
.pisell-lowcode-space-compact:focus-within:has(.pisell-lowcode-select-status-error) {
|
|
127
|
-
box-shadow: 0 0 0 4px #fee4e2 !important; // Error/100
|
|
128
|
-
}
|
|
129
10
|
}
|
|
130
11
|
|
|
131
12
|
&-error {
|
|
@@ -62,45 +62,56 @@ var EditView = function EditView(props) {
|
|
|
62
62
|
setCountryCode(code);
|
|
63
63
|
(_props$onCountryCodeC = props.onCountryCodeChange) === null || _props$onCountryCodeC === void 0 || _props$onCountryCodeC.call(props, code);
|
|
64
64
|
};
|
|
65
|
+
|
|
66
|
+
// Input 的 maxLength:有格式化时用「格式化后字符串」长度,否则用数字位数,避免选 CN 只能输 9 位
|
|
67
|
+
var maxDigitLen = getMaxLength(countryCode, countryCodes);
|
|
68
|
+
var maxInputLength = useMemo(function () {
|
|
69
|
+
if (props.maxLength != null) return props.maxLength;
|
|
70
|
+
if (props.autoFormat === false) return maxDigitLen;
|
|
71
|
+
return formatPhone('9'.repeat(maxDigitLen), countryCode).length;
|
|
72
|
+
}, [countryCode, maxDigitLen, props.maxLength, props.autoFormat]);
|
|
65
73
|
return /*#__PURE__*/React.createElement("div", {
|
|
66
74
|
className: "pisell-phone-edit"
|
|
67
|
-
}, /*#__PURE__*/React.createElement(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
}, props.showCountrySelector !== false && /*#__PURE__*/React.createElement(Select, {
|
|
72
|
-
value: countryCode,
|
|
73
|
-
onChange: handleCountryCodeChange,
|
|
74
|
-
style: {
|
|
75
|
-
width: 100,
|
|
76
|
-
height: 48
|
|
77
|
-
},
|
|
78
|
-
showSearch: true,
|
|
79
|
-
optionFilterProp: "children",
|
|
80
|
-
className: "pisell-phone-country-select"
|
|
81
|
-
// 自定义选中后的显示内容(只显示 +xx)
|
|
82
|
-
,
|
|
83
|
-
optionLabelProp: "value"
|
|
84
|
-
// 下拉选项宽度(比选择器本身宽)
|
|
85
|
-
,
|
|
86
|
-
popupMatchSelectWidth: false,
|
|
87
|
-
dropdownStyle: {
|
|
88
|
-
minWidth: 200
|
|
89
|
-
}
|
|
90
|
-
}, countryCodes.map(function (country, index) {
|
|
91
|
-
return /*#__PURE__*/React.createElement(Select.Option, {
|
|
92
|
-
key: "".concat(country.code, "-").concat(country.name, "-").concat(index),
|
|
93
|
-
value: country.code
|
|
94
|
-
}, /*#__PURE__*/React.createElement(Space, {
|
|
95
|
-
size: 4
|
|
96
|
-
}, /*#__PURE__*/React.createElement("span", null, country.flag), /*#__PURE__*/React.createElement("span", null, country.code), /*#__PURE__*/React.createElement("span", null, country.name)));
|
|
97
|
-
})), /*#__PURE__*/React.createElement(Input, {
|
|
75
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
76
|
+
prefix: countryCode ? /*#__PURE__*/React.createElement("span", {
|
|
77
|
+
className: "pisell-phone-prefix"
|
|
78
|
+
}, countryCode) : undefined,
|
|
98
79
|
value: value,
|
|
99
80
|
onChange: handlePhoneChange,
|
|
81
|
+
addonBefore: props.showCountrySelector !== false ? /*#__PURE__*/React.createElement(Select, {
|
|
82
|
+
value: countryCode,
|
|
83
|
+
onChange: handleCountryCodeChange,
|
|
84
|
+
showSearch: true,
|
|
85
|
+
optionFilterProp: "children",
|
|
86
|
+
filterOption: function filterOption(input, option) {
|
|
87
|
+
var code = option === null || option === void 0 ? void 0 : option.value;
|
|
88
|
+
var country = countryCodes.find(function (c) {
|
|
89
|
+
return c.code === code;
|
|
90
|
+
});
|
|
91
|
+
if (!country) return false;
|
|
92
|
+
var search = input.trim().toLowerCase();
|
|
93
|
+
if (!search) return true;
|
|
94
|
+
return country.name.toLowerCase().includes(search) || country.code.toLowerCase().includes(search) || country.flag.toLowerCase().includes(search);
|
|
95
|
+
},
|
|
96
|
+
className: "pisell-phone-country-select",
|
|
97
|
+
optionLabelProp: "label",
|
|
98
|
+
popupMatchSelectWidth: false,
|
|
99
|
+
dropdownStyle: {
|
|
100
|
+
minWidth: 200
|
|
101
|
+
}
|
|
102
|
+
}, countryCodes.map(function (country, index) {
|
|
103
|
+
return /*#__PURE__*/React.createElement(Select.Option, {
|
|
104
|
+
key: "".concat(country.code, "-").concat(country.name, "-").concat(index),
|
|
105
|
+
value: country.code,
|
|
106
|
+
label: country.flag
|
|
107
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
108
|
+
size: 4
|
|
109
|
+
}, /*#__PURE__*/React.createElement("span", null, country.flag), /*#__PURE__*/React.createElement("span", null, country.code)));
|
|
110
|
+
})) : null,
|
|
100
111
|
onBlur: handleBlur,
|
|
101
112
|
onFocus: handleFocus,
|
|
102
113
|
placeholder: props.placeholder || '请输入电话号码',
|
|
103
|
-
maxLength:
|
|
114
|
+
maxLength: maxInputLength,
|
|
104
115
|
allowClear: props.allowClear,
|
|
105
116
|
disabled: props.disabled,
|
|
106
117
|
autoFocus: props.autoFocus,
|
|
@@ -109,7 +120,7 @@ var EditView = function EditView(props) {
|
|
|
109
120
|
style: props.style,
|
|
110
121
|
"aria-label": props['aria-label'],
|
|
111
122
|
"aria-describedby": props['aria-describedby']
|
|
112
|
-
})
|
|
123
|
+
}), !isValid && errors.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
113
124
|
className: "pisell-phone-error"
|
|
114
125
|
}, errors[0]));
|
|
115
126
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 预设的国家码列表(24个常见国家)
|
|
3
|
-
*
|
|
3
|
+
* flag 使用正常文本(ISO 3166-1 alpha-2 两字母代码,如 CN、US)
|
|
4
|
+
*
|
|
4
5
|
* 包含:
|
|
5
6
|
* - 亚洲:中国、香港、澳门、台湾、日本、韩国、新加坡、马来西亚、泰国、印度
|
|
6
7
|
* - 欧洲:英国、法国、德国、意大利、西班牙、俄罗斯
|
|
@@ -13,70 +14,70 @@ export var PRESET_COUNTRY_CODES = [
|
|
|
13
14
|
{
|
|
14
15
|
code: '+86',
|
|
15
16
|
name: '中国',
|
|
16
|
-
flag: '
|
|
17
|
+
flag: 'CN',
|
|
17
18
|
format: 'XXX XXXX XXXX',
|
|
18
19
|
maxLength: 11,
|
|
19
20
|
pattern: /^1[3-9]\d{9}$/
|
|
20
21
|
}, {
|
|
21
22
|
code: '+852',
|
|
22
23
|
name: '香港',
|
|
23
|
-
flag: '
|
|
24
|
+
flag: 'HK',
|
|
24
25
|
format: 'XXXX XXXX',
|
|
25
26
|
maxLength: 8,
|
|
26
27
|
pattern: /^\d{8}$/
|
|
27
28
|
}, {
|
|
28
29
|
code: '+853',
|
|
29
30
|
name: '澳门',
|
|
30
|
-
flag: '
|
|
31
|
+
flag: 'MO',
|
|
31
32
|
format: 'XXXX XXXX',
|
|
32
33
|
maxLength: 8,
|
|
33
34
|
pattern: /^\d{8}$/
|
|
34
35
|
}, {
|
|
35
36
|
code: '+886',
|
|
36
37
|
name: '台湾',
|
|
37
|
-
flag: '
|
|
38
|
+
flag: 'TW',
|
|
38
39
|
format: 'XXXX XXX XXX',
|
|
39
40
|
maxLength: 9,
|
|
40
41
|
pattern: /^\d{9}$/
|
|
41
42
|
}, {
|
|
42
43
|
code: '+81',
|
|
43
44
|
name: '日本',
|
|
44
|
-
flag: '
|
|
45
|
+
flag: 'JP',
|
|
45
46
|
format: 'XX-XXXX-XXXX',
|
|
46
47
|
maxLength: 10,
|
|
47
48
|
pattern: /^\d{10}$/
|
|
48
49
|
}, {
|
|
49
50
|
code: '+82',
|
|
50
51
|
name: '韩国',
|
|
51
|
-
flag: '
|
|
52
|
+
flag: 'KR',
|
|
52
53
|
format: 'XX-XXXX-XXXX',
|
|
53
54
|
maxLength: 10,
|
|
54
55
|
pattern: /^\d{10}$/
|
|
55
56
|
}, {
|
|
56
57
|
code: '+65',
|
|
57
58
|
name: '新加坡',
|
|
58
|
-
flag: '
|
|
59
|
+
flag: 'SG',
|
|
59
60
|
format: 'XXXX XXXX',
|
|
60
61
|
maxLength: 8,
|
|
61
62
|
pattern: /^\d{8}$/
|
|
62
63
|
}, {
|
|
63
64
|
code: '+60',
|
|
64
65
|
name: '马来西亚',
|
|
65
|
-
flag: '
|
|
66
|
+
flag: 'MY',
|
|
66
67
|
format: 'XX-XXXX XXXX',
|
|
67
68
|
maxLength: 10,
|
|
68
69
|
pattern: /^\d{9,10}$/
|
|
69
70
|
}, {
|
|
70
71
|
code: '+66',
|
|
71
72
|
name: '泰国',
|
|
72
|
-
flag: '
|
|
73
|
+
flag: 'TH',
|
|
73
74
|
format: 'XX-XXX-XXXX',
|
|
74
75
|
maxLength: 9,
|
|
75
76
|
pattern: /^\d{9}$/
|
|
76
77
|
}, {
|
|
77
78
|
code: '+91',
|
|
78
79
|
name: '印度',
|
|
79
|
-
flag: '
|
|
80
|
+
flag: 'IN',
|
|
80
81
|
format: 'XXXXX XXXXX',
|
|
81
82
|
maxLength: 10,
|
|
82
83
|
pattern: /^\d{10}$/
|
|
@@ -85,42 +86,42 @@ export var PRESET_COUNTRY_CODES = [
|
|
|
85
86
|
{
|
|
86
87
|
code: '+44',
|
|
87
88
|
name: '英国',
|
|
88
|
-
flag: '
|
|
89
|
+
flag: 'GB',
|
|
89
90
|
format: 'XXXX XXX XXXX',
|
|
90
91
|
maxLength: 10,
|
|
91
92
|
pattern: /^\d{10}$/
|
|
92
93
|
}, {
|
|
93
94
|
code: '+33',
|
|
94
95
|
name: '法国',
|
|
95
|
-
flag: '
|
|
96
|
+
flag: 'FR',
|
|
96
97
|
format: 'X XX XX XX XX',
|
|
97
98
|
maxLength: 9,
|
|
98
99
|
pattern: /^\d{9}$/
|
|
99
100
|
}, {
|
|
100
101
|
code: '+49',
|
|
101
102
|
name: '德国',
|
|
102
|
-
flag: '
|
|
103
|
+
flag: 'DE',
|
|
103
104
|
format: 'XXX XXXXXXX',
|
|
104
105
|
maxLength: 11,
|
|
105
106
|
pattern: /^\d{10,11}$/
|
|
106
107
|
}, {
|
|
107
108
|
code: '+39',
|
|
108
109
|
name: '意大利',
|
|
109
|
-
flag: '
|
|
110
|
+
flag: 'IT',
|
|
110
111
|
format: 'XXX XXX XXXX',
|
|
111
112
|
maxLength: 10,
|
|
112
113
|
pattern: /^\d{10}$/
|
|
113
114
|
}, {
|
|
114
115
|
code: '+34',
|
|
115
116
|
name: '西班牙',
|
|
116
|
-
flag: '
|
|
117
|
+
flag: 'ES',
|
|
117
118
|
format: 'XXX XX XX XX',
|
|
118
119
|
maxLength: 9,
|
|
119
120
|
pattern: /^\d{9}$/
|
|
120
121
|
}, {
|
|
121
122
|
code: '+7',
|
|
122
123
|
name: '俄罗斯',
|
|
123
|
-
flag: '
|
|
124
|
+
flag: 'RU',
|
|
124
125
|
format: 'XXX XXX-XX-XX',
|
|
125
126
|
maxLength: 10,
|
|
126
127
|
pattern: /^\d{10}$/
|
|
@@ -129,28 +130,28 @@ export var PRESET_COUNTRY_CODES = [
|
|
|
129
130
|
{
|
|
130
131
|
code: '+1',
|
|
131
132
|
name: '美国',
|
|
132
|
-
flag: '
|
|
133
|
+
flag: 'US',
|
|
133
134
|
format: '(XXX) XXX-XXXX',
|
|
134
135
|
maxLength: 10,
|
|
135
136
|
pattern: /^\d{10}$/
|
|
136
137
|
}, {
|
|
137
138
|
code: '+1',
|
|
138
139
|
name: '加拿大',
|
|
139
|
-
flag: '
|
|
140
|
+
flag: 'CA',
|
|
140
141
|
format: '(XXX) XXX-XXXX',
|
|
141
142
|
maxLength: 10,
|
|
142
143
|
pattern: /^\d{10}$/
|
|
143
144
|
}, {
|
|
144
145
|
code: '+52',
|
|
145
146
|
name: '墨西哥',
|
|
146
|
-
flag: '
|
|
147
|
+
flag: 'MX',
|
|
147
148
|
format: 'XX XXXX XXXX',
|
|
148
149
|
maxLength: 10,
|
|
149
150
|
pattern: /^\d{10}$/
|
|
150
151
|
}, {
|
|
151
152
|
code: '+55',
|
|
152
153
|
name: '巴西',
|
|
153
|
-
flag: '
|
|
154
|
+
flag: 'BR',
|
|
154
155
|
format: 'XX XXXXX-XXXX',
|
|
155
156
|
maxLength: 11,
|
|
156
157
|
pattern: /^\d{10,11}$/
|
|
@@ -159,14 +160,14 @@ export var PRESET_COUNTRY_CODES = [
|
|
|
159
160
|
{
|
|
160
161
|
code: '+61',
|
|
161
162
|
name: '澳大利亚',
|
|
162
|
-
flag: '
|
|
163
|
+
flag: 'AU',
|
|
163
164
|
format: 'XXX XXX XXX',
|
|
164
165
|
maxLength: 9,
|
|
165
166
|
pattern: /^\d{9}$/
|
|
166
167
|
}, {
|
|
167
168
|
code: '+64',
|
|
168
169
|
name: '新西兰',
|
|
169
|
-
flag: '
|
|
170
|
+
flag: 'NZ',
|
|
170
171
|
format: 'XX XXX XXXX',
|
|
171
172
|
maxLength: 9,
|
|
172
173
|
pattern: /^\d{9}$/
|
|
@@ -175,14 +176,14 @@ export var PRESET_COUNTRY_CODES = [
|
|
|
175
176
|
{
|
|
176
177
|
code: '+971',
|
|
177
178
|
name: '阿联酋',
|
|
178
|
-
flag: '
|
|
179
|
+
flag: 'AE',
|
|
179
180
|
format: 'XX XXX XXXX',
|
|
180
181
|
maxLength: 9,
|
|
181
182
|
pattern: /^\d{9}$/
|
|
182
183
|
}, {
|
|
183
184
|
code: '+966',
|
|
184
185
|
name: '沙特阿拉伯',
|
|
185
|
-
flag: '
|
|
186
|
+
flag: 'SA',
|
|
186
187
|
format: 'XX XXX XXXX',
|
|
187
188
|
maxLength: 9,
|
|
188
189
|
pattern: /^\d{9}$/
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { CountryCode, PisellPhoneProps } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* 根据国家码获取国家/地区展示标识(正常文本,如 CN、US)
|
|
4
4
|
* @param countryCode 国家码
|
|
5
|
-
* @returns
|
|
5
|
+
* @returns 展示用标识,未匹配时返回 '--'
|
|
6
6
|
*/
|
|
7
7
|
export declare function getCountryFlag(countryCode: string): string;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* 根据国家码获取最大长度(数字位数)
|
|
10
10
|
* @param countryCode 国家码
|
|
11
11
|
* @param countryCodes 国家码列表
|
|
12
|
-
* @returns
|
|
12
|
+
* @returns 最大长度(如中国 11 位数字)
|
|
13
13
|
*/
|
|
14
14
|
export declare function getMaxLength(countryCode: string, countryCodes: CountryCode[]): number;
|
|
15
15
|
/**
|
|
@@ -6,22 +6,22 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
6
6
|
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; }
|
|
7
7
|
import { PRESET_COUNTRY_CODES } from "../constants/countryCodes";
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* 根据国家码获取国家/地区展示标识(正常文本,如 CN、US)
|
|
10
10
|
* @param countryCode 国家码
|
|
11
|
-
* @returns
|
|
11
|
+
* @returns 展示用标识,未匹配时返回 '--'
|
|
12
12
|
*/
|
|
13
13
|
export function getCountryFlag(countryCode) {
|
|
14
14
|
var country = PRESET_COUNTRY_CODES.find(function (c) {
|
|
15
15
|
return c.code === countryCode;
|
|
16
16
|
});
|
|
17
|
-
return (country === null || country === void 0 ? void 0 : country.flag) || '
|
|
17
|
+
return (country === null || country === void 0 ? void 0 : country.flag) || '--';
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* 根据国家码获取最大长度(数字位数)
|
|
22
22
|
* @param countryCode 国家码
|
|
23
23
|
* @param countryCodes 国家码列表
|
|
24
|
-
* @returns
|
|
24
|
+
* @returns 最大长度(如中国 11 位数字)
|
|
25
25
|
*/
|
|
26
26
|
export function getMaxLength(countryCode, countryCodes) {
|
|
27
27
|
var country = countryCodes.find(function (c) {
|
|
@@ -5,8 +5,9 @@ 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 React from 'react';
|
|
8
|
-
import { Rate } from 'antd';
|
|
8
|
+
import { ConfigProvider, Rate } from 'antd';
|
|
9
9
|
import { getDisplayState } from '@pisell/utils';
|
|
10
|
+
import { getPisellComponentsThemeConfig } from "../../theme/pisell-components";
|
|
10
11
|
import "./PisellRating.less";
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -82,7 +83,10 @@ export var PisellRating = function PisellRating(props) {
|
|
|
82
83
|
fontSize: size,
|
|
83
84
|
color: color
|
|
84
85
|
}, style);
|
|
85
|
-
|
|
86
|
+
var theme = getPisellComponentsThemeConfig();
|
|
87
|
+
return /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
88
|
+
theme: theme
|
|
89
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
86
90
|
className: "pisell-rating pisell-rating-".concat(displayState, " ").concat(className || ''),
|
|
87
91
|
id: id
|
|
88
92
|
}, /*#__PURE__*/React.createElement(Rate, {
|
|
@@ -111,7 +115,7 @@ export var PisellRating = function PisellRating(props) {
|
|
|
111
115
|
marginLeft: 8,
|
|
112
116
|
color: '#999'
|
|
113
117
|
}
|
|
114
|
-
}, "(", reviewCount, " \u4EBA\u8BC4\u4EF7)"));
|
|
118
|
+
}, "(", reviewCount, " \u4EBA\u8BC4\u4EF7)")));
|
|
115
119
|
};
|
|
116
120
|
|
|
117
121
|
// 性能优化
|
|
@@ -4,35 +4,37 @@ import ReadOnlyView from "./components/ReadOnlyView";
|
|
|
4
4
|
import EditView from "./components/EditView";
|
|
5
5
|
import DisabledView from "./components/DisabledView";
|
|
6
6
|
import "./PisellSingleLineText.less";
|
|
7
|
+
import { ConfigProvider } from 'antd';
|
|
8
|
+
import { getPisellComponentsThemeConfig } from "../../theme/pisell-components";
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* PisellSingleLineText 单行文本组件
|
|
10
|
-
*
|
|
12
|
+
*
|
|
11
13
|
* 通用的单行文本输入/展示组件,支持只读、编辑、禁用三种状态。
|
|
12
14
|
* 基于 Ant Design Input 组件开发,提供完整的校验框架。
|
|
13
|
-
*
|
|
15
|
+
*
|
|
14
16
|
* @param props 组件 Props
|
|
15
|
-
*
|
|
17
|
+
*
|
|
16
18
|
* @example
|
|
17
19
|
* // 受控模式
|
|
18
20
|
* const [value, setValue] = useState('');
|
|
19
|
-
* <PisellSingleLineText
|
|
21
|
+
* <PisellSingleLineText
|
|
20
22
|
* value={value}
|
|
21
23
|
* onChange={(v) => setValue(v)}
|
|
22
24
|
* placeholder="请输入"
|
|
23
25
|
* />
|
|
24
|
-
*
|
|
26
|
+
*
|
|
25
27
|
* @example
|
|
26
28
|
* // 非受控模式
|
|
27
|
-
* <PisellSingleLineText
|
|
29
|
+
* <PisellSingleLineText
|
|
28
30
|
* defaultValue="初始值"
|
|
29
31
|
* required
|
|
30
32
|
* minLength={3}
|
|
31
33
|
* />
|
|
32
|
-
*
|
|
34
|
+
*
|
|
33
35
|
* @example
|
|
34
36
|
* // 只读态
|
|
35
|
-
* <PisellSingleLineText
|
|
37
|
+
* <PisellSingleLineText
|
|
36
38
|
* mode="read"
|
|
37
39
|
* value="这是一段很长的文本内容"
|
|
38
40
|
* ellipsis
|
|
@@ -47,18 +49,23 @@ export var PisellSingleLineText = function PisellSingleLineText(props) {
|
|
|
47
49
|
|
|
48
50
|
// 计算显示状态
|
|
49
51
|
var displayState = getDisplayState(mode, disabled);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
var render = function render() {
|
|
53
|
+
// 根据状态渲染对应子组件
|
|
54
|
+
switch (displayState) {
|
|
55
|
+
case 'read':
|
|
56
|
+
return /*#__PURE__*/React.createElement(ReadOnlyView, props);
|
|
57
|
+
case 'edit':
|
|
58
|
+
return /*#__PURE__*/React.createElement(EditView, props);
|
|
59
|
+
case 'disabled':
|
|
60
|
+
return /*#__PURE__*/React.createElement(DisabledView, props);
|
|
61
|
+
default:
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
var theme = getPisellComponentsThemeConfig();
|
|
66
|
+
return /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
67
|
+
theme: theme
|
|
68
|
+
}, render());
|
|
62
69
|
};
|
|
63
70
|
|
|
64
71
|
// 性能优化:使用 memo 避免不必要的重渲染
|