@pisell/materials 1.0.793 → 1.0.794
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 +1 -1
- package/build/lowcode/preview.js +150 -150
- package/build/lowcode/render/default/view.js +23 -27
- package/build/lowcode/view.js +24 -28
- package/es/components/Pagination/index.d.ts +1 -1
- package/es/components/colorPicker/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceForm/formItem.d.ts +0 -1
- package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/utils.js +20 -4
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceWrapper/index.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Input.Mobile/WithMode.d.ts +7 -2
- package/es/components/dataSourceComponents/fields/Input.Mobile/WithMode.js +45 -16
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +7 -2
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +44 -13
- package/es/components/dataSourceComponents/fields/Input.Phone/serve.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/serve.js +56 -10
- package/es/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Select/index.d.ts +1 -2
- package/es/components/dataSourceComponents/fields/index.d.ts +20 -20
- package/es/components/filter/components/items/index.d.ts +1 -0
- package/es/components/filter/components/items/text/Editor/index.d.ts +1 -0
- package/es/components/filter/components/items/text/Preview/index.d.ts +1 -0
- package/es/components/filter/components/items/text/index.d.ts +1 -0
- package/es/components/page/index.d.ts +0 -1
- package/es/components/productCard/components/Packages/utils.d.ts +1 -1
- package/es/components/productCard/index.js +0 -1
- package/es/components/table/Table/SelectField/index.d.ts +1 -0
- package/es/components/table/Table/tableConfig/summary/index.d.ts +1 -0
- package/es/utils/platform.d.ts +1 -1
- package/lib/components/Pagination/index.d.ts +1 -1
- package/lib/components/colorPicker/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceForm/formItem.d.ts +0 -1
- package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/utils.js +14 -2
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceWrapper/index.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Input.Mobile/WithMode.d.ts +7 -2
- package/lib/components/dataSourceComponents/fields/Input.Mobile/WithMode.js +41 -10
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +7 -2
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +40 -9
- package/lib/components/dataSourceComponents/fields/Input.Phone/serve.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/serve.js +29 -9
- package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Select/index.d.ts +1 -2
- package/lib/components/dataSourceComponents/fields/index.d.ts +20 -20
- package/lib/components/filter/components/items/index.d.ts +1 -0
- package/lib/components/filter/components/items/text/Editor/index.d.ts +1 -0
- package/lib/components/filter/components/items/text/Preview/index.d.ts +1 -0
- package/lib/components/filter/components/items/text/index.d.ts +1 -0
- package/lib/components/page/index.d.ts +0 -1
- package/lib/components/productCard/components/Packages/utils.d.ts +1 -1
- package/lib/components/productCard/index.js +0 -1
- package/lib/components/table/Table/SelectField/index.d.ts +1 -0
- package/lib/components/table/Table/tableConfig/summary/index.d.ts +1 -0
- package/lib/utils/platform.d.ts +1 -1
- package/lowcode/form-item-input.mobile/meta.ts +17 -0
- package/lowcode/form-item-input.phone/meta.ts +17 -0
- package/package.json +1 -1
- package/es/components/appVersionControl/index.d.ts +0 -5
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +0 -39
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +0 -79
- package/es/components/drag-sort-tree/index.d.ts +0 -4
- package/es/components/login-and-register/index.d.ts +0 -82
- package/es/components/pisell-config-provider/index.d.ts +0 -12
- package/es/components/pisellAvatar/index.d.ts +0 -19
- package/es/components/pisellCheckboxGroup/index.d.ts +0 -36
- package/es/components/pisellCustomCheckboxGroup/index.d.ts +0 -16
- package/es/components/pisellEmpty/index.d.ts +0 -19
- package/es/components/pisellInformationEntry/hooks/useNativeScanner.d.ts +0 -4
- package/es/components/pisellInformationEntry/index.d.ts +0 -33
- package/es/components/pisellText/components/Amount/index.d.ts +0 -20
- package/es/components/productCard/components/MultiDay/index.d.ts +0 -4
- package/es/components/productCard/components/Packages/components/collapsibleList/utils.d.ts +0 -2
- package/es/components/productCard/components/Time/components/Like/index.d.ts +0 -10
- package/es/components/productCard/components/Time/components/SelectHolder/index.d.ts +0 -4
- package/es/components/productCard/components/Time/components/SelectResource/index.d.ts +0 -19
- package/es/components/productCard/components/Time/index.d.ts +0 -4
- package/es/components/productCard/locales.d.ts +0 -57
- package/es/components/productCard/types.d.ts +0 -83
- package/es/components/productCard/utils.d.ts +0 -31
- package/es/components/table/Actions/component/ExportImport/index.d.ts +0 -8
- package/es/components/table/Gallery/components/GalleryItem/index.d.ts +0 -14
- package/es/components/table/Gallery/index.d.ts +0 -5
- package/es/components/table/Table/index.d.ts +0 -4
- package/es/components/table/Table/utils.d.ts +0 -173
- package/es/components/table/hooks/useTableSetting.d.ts +0 -22
- package/es/components/table/hooks/useTransDataSource.d.ts +0 -12
- package/es/components/table/types.d.ts +0 -253
- package/es/components/versionModal/index.d.ts +0 -24
- package/es/locales/en-US.d.ts +0 -276
- package/es/locales/zh-CN.d.ts +0 -271
- package/es/locales/zh-TW.d.ts +0 -271
- package/lib/components/appVersionControl/index.d.ts +0 -5
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +0 -39
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +0 -79
- package/lib/components/drag-sort-tree/index.d.ts +0 -4
- package/lib/components/login-and-register/index.d.ts +0 -82
- package/lib/components/pisell-config-provider/index.d.ts +0 -12
- package/lib/components/pisellAvatar/index.d.ts +0 -19
- package/lib/components/pisellCheckboxGroup/index.d.ts +0 -36
- package/lib/components/pisellCustomCheckboxGroup/index.d.ts +0 -16
- package/lib/components/pisellEmpty/index.d.ts +0 -19
- package/lib/components/pisellInformationEntry/hooks/useNativeScanner.d.ts +0 -4
- package/lib/components/pisellInformationEntry/index.d.ts +0 -33
- package/lib/components/pisellText/components/Amount/index.d.ts +0 -20
- package/lib/components/productCard/components/MultiDay/index.d.ts +0 -4
- package/lib/components/productCard/components/Packages/components/collapsibleList/utils.d.ts +0 -2
- package/lib/components/productCard/components/Time/components/Like/index.d.ts +0 -10
- package/lib/components/productCard/components/Time/components/SelectHolder/index.d.ts +0 -4
- package/lib/components/productCard/components/Time/components/SelectResource/index.d.ts +0 -19
- package/lib/components/productCard/components/Time/index.d.ts +0 -4
- package/lib/components/productCard/locales.d.ts +0 -57
- package/lib/components/productCard/types.d.ts +0 -83
- package/lib/components/productCard/utils.d.ts +0 -31
- package/lib/components/table/Actions/component/ExportImport/index.d.ts +0 -8
- package/lib/components/table/Gallery/components/GalleryItem/index.d.ts +0 -14
- package/lib/components/table/Gallery/index.d.ts +0 -5
- package/lib/components/table/Table/index.d.ts +0 -4
- package/lib/components/table/Table/utils.d.ts +0 -173
- package/lib/components/table/hooks/useTableSetting.d.ts +0 -22
- package/lib/components/table/hooks/useTransDataSource.d.ts +0 -12
- package/lib/components/table/types.d.ts +0 -253
- package/lib/components/versionModal/index.d.ts +0 -24
- package/lib/locales/en-US.d.ts +0 -276
- package/lib/locales/zh-CN.d.ts +0 -271
- package/lib/locales/zh-TW.d.ts +0 -271
|
@@ -17,4 +17,4 @@ export declare const minusSign: (item: any, type?: string) => "" | "-";
|
|
|
17
17
|
* @Author: WangHan
|
|
18
18
|
* @Date: 2024-11-22 10:58
|
|
19
19
|
*/
|
|
20
|
-
export declare const _formatAmount: (price?: number, amountSymbol?: string, digit?: number) =>
|
|
20
|
+
export declare const _formatAmount: (price?: number, amountSymbol?: string, digit?: number) => any;
|
|
@@ -54,7 +54,6 @@ var ProductCard = function ProductCard(props) {
|
|
|
54
54
|
var useOpenNoteRef = useRef();
|
|
55
55
|
var locale = (utils === null || utils === void 0 || (_utils$storage = utils.storage) === null || _utils$storage === void 0 ? void 0 : _utils$storage.get('umi_locale')) || localStorage.getItem('umi_locale');
|
|
56
56
|
locales.init(localeTexts, locale || 'en');
|
|
57
|
-
console.log(dataSource, isShowImage, isShowNote, 'dataSource');
|
|
58
57
|
var image = dataSource.image,
|
|
59
58
|
bundle = dataSource.bundle,
|
|
60
59
|
relation_products = dataSource.relation_products,
|
package/es/utils/platform.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const isMobile: () =>
|
|
1
|
+
export declare const isMobile: () => any;
|
|
@@ -5,7 +5,7 @@ export declare const paginationConfig: {
|
|
|
5
5
|
className: string;
|
|
6
6
|
defaultCurrent: number;
|
|
7
7
|
showTotal: (total: number, range: [number, number]) => string;
|
|
8
|
-
itemRender: (page: number, type: "
|
|
8
|
+
itemRender: (page: number, type: "page" | "next" | "prev" | "jump-prev" | "jump-next", element: React.ReactNode) => React.ReactNode;
|
|
9
9
|
responsive: boolean;
|
|
10
10
|
size: string;
|
|
11
11
|
};
|
|
@@ -43,7 +43,7 @@ export declare const withDataSource: <P extends unknown>(WrappedComponent: React
|
|
|
43
43
|
}) => JSX.Element;
|
|
44
44
|
export declare const withOptions: <P extends unknown>(WrappedComponent: React.ComponentType<P>) => (props: P & {
|
|
45
45
|
options?: any;
|
|
46
|
-
optionSourceType?: "
|
|
46
|
+
optionSourceType?: "custom" | "api" | "default" | undefined;
|
|
47
47
|
labelField: string;
|
|
48
48
|
valueField: string;
|
|
49
49
|
extraParams?: Record<string, any> | undefined;
|
|
@@ -186,7 +186,13 @@ var withFormItem = (WrappedComponent, overlayProps) => {
|
|
|
186
186
|
break;
|
|
187
187
|
case "phone":
|
|
188
188
|
rules.push({
|
|
189
|
-
validator: (_,
|
|
189
|
+
validator: (_, originValue) => {
|
|
190
|
+
let value = "";
|
|
191
|
+
if ((0, import_utils.isString)(originValue)) {
|
|
192
|
+
value = originValue;
|
|
193
|
+
} else if ("phone" in originValue) {
|
|
194
|
+
value = `${(originValue == null ? void 0 : originValue.countryCallingCode) || ""}${originValue.phone || ""}`;
|
|
195
|
+
}
|
|
190
196
|
if (!(value == null ? void 0 : value.trim())) {
|
|
191
197
|
return Promise.resolve();
|
|
192
198
|
}
|
|
@@ -213,7 +219,13 @@ var withFormItem = (WrappedComponent, overlayProps) => {
|
|
|
213
219
|
break;
|
|
214
220
|
case "mobile":
|
|
215
221
|
rules.push({
|
|
216
|
-
validator: (_,
|
|
222
|
+
validator: (_, originValue) => {
|
|
223
|
+
let value = "";
|
|
224
|
+
if ((0, import_utils.isString)(originValue)) {
|
|
225
|
+
value = originValue;
|
|
226
|
+
} else if ("phone" in originValue) {
|
|
227
|
+
value = `${(originValue == null ? void 0 : originValue.countryCallingCode) || ""}${originValue.phone || ""}`;
|
|
228
|
+
}
|
|
217
229
|
if (!(value == null ? void 0 : value.trim())) {
|
|
218
230
|
return Promise.resolve();
|
|
219
231
|
}
|
|
@@ -17,7 +17,7 @@ interface UseTablePropsProps {
|
|
|
17
17
|
* @returns
|
|
18
18
|
*/
|
|
19
19
|
declare const useTableProps: (props: UseTablePropsProps) => {
|
|
20
|
-
title: number | boolean |
|
|
20
|
+
title: number | boolean | React.ReactFragment | JSX.Element | (() => React.ReactNode) | null | undefined;
|
|
21
21
|
pagination: {
|
|
22
22
|
total: number;
|
|
23
23
|
current: number;
|
|
@@ -26,7 +26,7 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
26
26
|
showSizeChanger: boolean;
|
|
27
27
|
};
|
|
28
28
|
columns: import("./useColumns").Column[];
|
|
29
|
-
subTitle: number | boolean |
|
|
29
|
+
subTitle: number | boolean | React.ReactFragment | JSX.Element | (() => React.ReactNode) | null | undefined;
|
|
30
30
|
buttons: any[] | null;
|
|
31
31
|
filter: JSX.Element | null;
|
|
32
32
|
onRow: (record: any) => any;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InputProps } from 'antd';
|
|
3
3
|
import { ModeType } from "../../dataSourceForm/type";
|
|
4
|
+
declare type PhoneValue = string | {
|
|
5
|
+
phone: string;
|
|
6
|
+
countryCallingCode: string;
|
|
7
|
+
};
|
|
4
8
|
export interface PhoneInputProps extends Omit<InputProps, 'value' | 'onChange'> {
|
|
5
9
|
renderMode: ModeType;
|
|
6
|
-
value?:
|
|
7
|
-
onChange?: (value:
|
|
10
|
+
value?: PhoneValue;
|
|
11
|
+
onChange?: (value: PhoneValue) => void;
|
|
12
|
+
returnFormat?: 'string' | 'object';
|
|
8
13
|
}
|
|
9
14
|
declare const MobileNumberInputWithMode: React.FC<PhoneInputProps & import("../../dataSourceForm/utils").WithModeProps>;
|
|
10
15
|
export default MobileNumberInputWithMode;
|
|
@@ -36,12 +36,14 @@ var import_react = __toESM(require("react"));
|
|
|
36
36
|
var import_antd = require("antd");
|
|
37
37
|
var import_utils = require("@pisell/utils");
|
|
38
38
|
var import_select = __toESM(require("../../../select"));
|
|
39
|
-
var import_serve = require("
|
|
39
|
+
var import_serve = require("./../Input.Phone/serve");
|
|
40
40
|
var import_ReadPretty = __toESM(require("./ReadPretty"));
|
|
41
41
|
var import_utils2 = require("../../dataSourceForm/utils");
|
|
42
42
|
var import_useTranslationOriginal = __toESM(require("../../../../hooks/useTranslationOriginal"));
|
|
43
|
+
var import_useSetRequest = __toESM(require("../../../../hooks/useSetRequest"));
|
|
43
44
|
var { Option } = import_select.default;
|
|
44
|
-
var MobileNumberInput = ({ value: propsValue, onChange, disabled, ...props }) => {
|
|
45
|
+
var MobileNumberInput = ({ value: propsValue, onChange, disabled, returnFormat = "string", ...props }) => {
|
|
46
|
+
(0, import_useSetRequest.default)();
|
|
45
47
|
const { data: countries = [] } = (0, import_serve.useCountries)();
|
|
46
48
|
const translationOriginal = (0, import_useTranslationOriginal.default)();
|
|
47
49
|
const value = (0, import_react.useMemo)(() => {
|
|
@@ -50,20 +52,37 @@ var MobileNumberInput = ({ value: propsValue, onChange, disabled, ...props }) =>
|
|
|
50
52
|
}
|
|
51
53
|
return propsValue;
|
|
52
54
|
}, [propsValue]);
|
|
55
|
+
const handleChange = (prefix, phoneNumber2) => {
|
|
56
|
+
if (returnFormat === "string") {
|
|
57
|
+
const newValue = phoneNumber2 ? `${prefix}${phoneNumber2}` : "";
|
|
58
|
+
onChange == null ? void 0 : onChange(newValue);
|
|
59
|
+
} else {
|
|
60
|
+
onChange == null ? void 0 : onChange({
|
|
61
|
+
phone: phoneNumber2,
|
|
62
|
+
countryCallingCode: prefix
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
53
66
|
const parseExternalValue = (val) => {
|
|
54
67
|
if (!val) return { countryCode: "AU", phoneNumber: "" };
|
|
68
|
+
let srtValue = "";
|
|
69
|
+
if ((0, import_utils.isString)(val)) {
|
|
70
|
+
srtValue = val;
|
|
71
|
+
} else if ("phone" in val) {
|
|
72
|
+
srtValue = `${val.countryCallingCode || ""}${val.phone || ""}`;
|
|
73
|
+
}
|
|
55
74
|
const matchedPrefix = countries.find(
|
|
56
|
-
(country) =>
|
|
75
|
+
(country) => srtValue.startsWith(country.prefix)
|
|
57
76
|
);
|
|
58
77
|
if (matchedPrefix) {
|
|
59
78
|
return {
|
|
60
79
|
countryCode: matchedPrefix.code,
|
|
61
|
-
phoneNumber:
|
|
80
|
+
phoneNumber: srtValue.slice(matchedPrefix.prefix.length)
|
|
62
81
|
};
|
|
63
82
|
}
|
|
64
83
|
return {
|
|
65
84
|
countryCode: "AU",
|
|
66
|
-
phoneNumber:
|
|
85
|
+
phoneNumber: srtValue.replace(/\D/g, "")
|
|
67
86
|
};
|
|
68
87
|
};
|
|
69
88
|
const [countryCode, setCountryCode] = (0, import_react.useState)(
|
|
@@ -87,8 +106,7 @@ var MobileNumberInput = ({ value: propsValue, onChange, disabled, ...props }) =>
|
|
|
87
106
|
(c) => c.code === value2
|
|
88
107
|
);
|
|
89
108
|
const prefix = (selectedCountry == null ? void 0 : selectedCountry.prefix) || "";
|
|
90
|
-
|
|
91
|
-
onChange == null ? void 0 : onChange(newValue);
|
|
109
|
+
handleChange(prefix, phoneNumber);
|
|
92
110
|
setTimeout(() => {
|
|
93
111
|
const formInstance = props.form;
|
|
94
112
|
const fieldName = props.fieldKey;
|
|
@@ -104,8 +122,7 @@ var MobileNumberInput = ({ value: propsValue, onChange, disabled, ...props }) =>
|
|
|
104
122
|
(c) => c.code === countryCode
|
|
105
123
|
);
|
|
106
124
|
const prefix = (selectedCountry == null ? void 0 : selectedCountry.prefix) || "";
|
|
107
|
-
|
|
108
|
-
onChange == null ? void 0 : onChange(newValue);
|
|
125
|
+
handleChange(prefix, cleanNumber);
|
|
109
126
|
if (!cleanNumber) {
|
|
110
127
|
const formInstance = props.form;
|
|
111
128
|
const fieldName = props.fieldKey;
|
|
@@ -132,9 +149,23 @@ var MobileNumberInput = ({ value: propsValue, onChange, disabled, ...props }) =>
|
|
|
132
149
|
const prefix = (selectedCountry == null ? void 0 : selectedCountry.prefix) || "";
|
|
133
150
|
return `${prefix}${phoneNumber}`;
|
|
134
151
|
}, [countryCode, phoneNumber, countries]);
|
|
152
|
+
const objValue = (0, import_react.useMemo)(() => {
|
|
153
|
+
const selectedCountry = countries.find(
|
|
154
|
+
(c) => c.code === countryCode
|
|
155
|
+
);
|
|
156
|
+
const prefix = (selectedCountry == null ? void 0 : selectedCountry.prefix) || "";
|
|
157
|
+
return {
|
|
158
|
+
phone: phoneNumber || "",
|
|
159
|
+
countryCallingCode: prefix
|
|
160
|
+
};
|
|
161
|
+
}, [countryCode, phoneNumber, countries]);
|
|
135
162
|
const handleBlur = () => {
|
|
136
163
|
const finalValue = concatenatedNumber;
|
|
137
|
-
|
|
164
|
+
if (returnFormat === "string") {
|
|
165
|
+
onChange == null ? void 0 : onChange(finalValue);
|
|
166
|
+
} else {
|
|
167
|
+
onChange == null ? void 0 : onChange(objValue);
|
|
168
|
+
}
|
|
138
169
|
};
|
|
139
170
|
return /* @__PURE__ */ import_react.default.createElement(import_antd.Space.Compact, { block: true }, /* @__PURE__ */ import_react.default.createElement(
|
|
140
171
|
import_select.default,
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InputProps } from 'antd';
|
|
3
3
|
import { ModeType } from "../../dataSourceForm/type";
|
|
4
|
+
declare type PhoneValue = string | {
|
|
5
|
+
phone: string;
|
|
6
|
+
countryCallingCode: string;
|
|
7
|
+
};
|
|
4
8
|
export interface PhoneInputProps extends Omit<InputProps, 'value' | 'onChange'> {
|
|
5
9
|
renderMode: ModeType;
|
|
6
|
-
value?:
|
|
7
|
-
onChange?: (value:
|
|
10
|
+
value?: PhoneValue;
|
|
11
|
+
onChange?: (value: PhoneValue) => void;
|
|
12
|
+
returnFormat?: 'string' | 'object';
|
|
8
13
|
}
|
|
9
14
|
declare const PhoneNumberInputWithMode: React.FC<PhoneInputProps & import("../../dataSourceForm/utils").WithModeProps>;
|
|
10
15
|
export default PhoneNumberInputWithMode;
|
|
@@ -40,8 +40,10 @@ var import_serve = require("./serve");
|
|
|
40
40
|
var import_ReadPretty = __toESM(require("./ReadPretty"));
|
|
41
41
|
var import_utils2 = require("../../dataSourceForm/utils");
|
|
42
42
|
var import_useTranslationOriginal = __toESM(require("../../../../hooks/useTranslationOriginal"));
|
|
43
|
+
var import_useSetRequest = __toESM(require("../../../../hooks/useSetRequest"));
|
|
43
44
|
var { Option } = import_select.default;
|
|
44
|
-
var PhoneNumberInput = ({ value: propsValue, onChange, disabled, ...props }) => {
|
|
45
|
+
var PhoneNumberInput = ({ value: propsValue, onChange, disabled, returnFormat = "string", ...props }) => {
|
|
46
|
+
(0, import_useSetRequest.default)();
|
|
45
47
|
const { data: countries = [] } = (0, import_serve.useCountries)();
|
|
46
48
|
const translationOriginal = (0, import_useTranslationOriginal.default)();
|
|
47
49
|
const value = (0, import_react.useMemo)(() => {
|
|
@@ -52,18 +54,24 @@ var PhoneNumberInput = ({ value: propsValue, onChange, disabled, ...props }) =>
|
|
|
52
54
|
}, [propsValue]);
|
|
53
55
|
const parseExternalValue = (val) => {
|
|
54
56
|
if (!val) return { countryCode: "AU", phoneNumber: "" };
|
|
57
|
+
let srtValue = "";
|
|
58
|
+
if ((0, import_utils.isString)(val)) {
|
|
59
|
+
srtValue = val;
|
|
60
|
+
} else if ("phone" in val) {
|
|
61
|
+
srtValue = `${val.countryCallingCode || ""}${val.phone || ""}`;
|
|
62
|
+
}
|
|
55
63
|
const matchedPrefix = countries.find(
|
|
56
|
-
(country) =>
|
|
64
|
+
(country) => srtValue.startsWith(country.prefix)
|
|
57
65
|
);
|
|
58
66
|
if (matchedPrefix) {
|
|
59
67
|
return {
|
|
60
68
|
countryCode: matchedPrefix.code,
|
|
61
|
-
phoneNumber:
|
|
69
|
+
phoneNumber: srtValue.slice(matchedPrefix.prefix.length)
|
|
62
70
|
};
|
|
63
71
|
}
|
|
64
72
|
return {
|
|
65
73
|
countryCode: "AU",
|
|
66
|
-
phoneNumber:
|
|
74
|
+
phoneNumber: srtValue.replace(/\D/g, "")
|
|
67
75
|
};
|
|
68
76
|
};
|
|
69
77
|
const [countryCode, setCountryCode] = (0, import_react.useState)(
|
|
@@ -77,6 +85,17 @@ var PhoneNumberInput = ({ value: propsValue, onChange, disabled, ...props }) =>
|
|
|
77
85
|
setCountryCode(newCountryCode);
|
|
78
86
|
setPhoneNumber(newPhoneNumber);
|
|
79
87
|
}, [value, countries]);
|
|
88
|
+
const handleChange = (prefix, phoneNumber2) => {
|
|
89
|
+
if (returnFormat === "string") {
|
|
90
|
+
const newValue = phoneNumber2 ? `${prefix}${phoneNumber2}` : "";
|
|
91
|
+
onChange == null ? void 0 : onChange(newValue);
|
|
92
|
+
} else {
|
|
93
|
+
onChange == null ? void 0 : onChange({
|
|
94
|
+
phone: phoneNumber2,
|
|
95
|
+
countryCallingCode: prefix
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
};
|
|
80
99
|
const handlePhoneNumberChange = (e) => {
|
|
81
100
|
const cleanNumber = e.target.value.replace(/\D/g, "");
|
|
82
101
|
setPhoneNumber(cleanNumber);
|
|
@@ -84,8 +103,7 @@ var PhoneNumberInput = ({ value: propsValue, onChange, disabled, ...props }) =>
|
|
|
84
103
|
(c) => c.code === countryCode
|
|
85
104
|
);
|
|
86
105
|
const prefix = (selectedCountry == null ? void 0 : selectedCountry.prefix) || "";
|
|
87
|
-
|
|
88
|
-
onChange == null ? void 0 : onChange(newValue);
|
|
106
|
+
handleChange(prefix, cleanNumber);
|
|
89
107
|
if (!cleanNumber) {
|
|
90
108
|
setTimeout(() => {
|
|
91
109
|
const formInstance = props.form;
|
|
@@ -102,8 +120,7 @@ var PhoneNumberInput = ({ value: propsValue, onChange, disabled, ...props }) =>
|
|
|
102
120
|
(c) => c.code === value2
|
|
103
121
|
);
|
|
104
122
|
const prefix = (selectedCountry == null ? void 0 : selectedCountry.prefix) || "";
|
|
105
|
-
|
|
106
|
-
onChange == null ? void 0 : onChange(newValue);
|
|
123
|
+
handleChange(prefix, phoneNumber);
|
|
107
124
|
setTimeout(() => {
|
|
108
125
|
const formInstance = props.form;
|
|
109
126
|
const fieldName = props.fieldKey;
|
|
@@ -122,9 +139,23 @@ var PhoneNumberInput = ({ value: propsValue, onChange, disabled, ...props }) =>
|
|
|
122
139
|
const prefix = (selectedCountry == null ? void 0 : selectedCountry.prefix) || "";
|
|
123
140
|
return `${prefix}${phoneNumber}`;
|
|
124
141
|
}, [countryCode, phoneNumber, countries]);
|
|
142
|
+
const objValue = (0, import_react.useMemo)(() => {
|
|
143
|
+
const selectedCountry = countries.find(
|
|
144
|
+
(c) => c.code === countryCode
|
|
145
|
+
);
|
|
146
|
+
const prefix = (selectedCountry == null ? void 0 : selectedCountry.prefix) || "";
|
|
147
|
+
return {
|
|
148
|
+
phone: phoneNumber || "",
|
|
149
|
+
countryCallingCode: prefix
|
|
150
|
+
};
|
|
151
|
+
}, [countryCode, phoneNumber, countries]);
|
|
125
152
|
const handleBlur = () => {
|
|
126
153
|
const finalValue = concatenatedNumber;
|
|
127
|
-
|
|
154
|
+
if (returnFormat === "string") {
|
|
155
|
+
onChange == null ? void 0 : onChange(finalValue);
|
|
156
|
+
} else {
|
|
157
|
+
onChange == null ? void 0 : onChange(objValue);
|
|
158
|
+
}
|
|
128
159
|
};
|
|
129
160
|
return /* @__PURE__ */ import_react.default.createElement(import_antd.Space.Compact, { block: true }, /* @__PURE__ */ import_react.default.createElement(
|
|
130
161
|
import_select.default,
|
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var serve_exports = {};
|
|
31
31
|
__export(serve_exports, {
|
|
32
32
|
getCountryDataList: () => getCountryDataList,
|
|
33
|
+
getShopCountryDataList: () => getShopCountryDataList,
|
|
33
34
|
useCountries: () => useCountries
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(serve_exports);
|
|
@@ -51,9 +52,16 @@ var getCountryDataList = async () => {
|
|
|
51
52
|
prefix: `+${item.calling_code}`
|
|
52
53
|
}));
|
|
53
54
|
};
|
|
55
|
+
var getShopCountryDataList = async (locale) => {
|
|
56
|
+
const { data } = await import_utils.request.getRequest().get("/shop/area/country", { "translate-locale": locale || "en" });
|
|
57
|
+
return data.map((item) => ({
|
|
58
|
+
...item,
|
|
59
|
+
prefix: `+${item.calling_code}`
|
|
60
|
+
}));
|
|
61
|
+
};
|
|
54
62
|
var useCountries = () => {
|
|
55
63
|
const isShop = (0, import_usePlatform.useIsShop)();
|
|
56
|
-
const { appHelper } = (0, import_useEngineContext.default)();
|
|
64
|
+
const { appHelper, ...others } = (0, import_useEngineContext.default)();
|
|
57
65
|
const { data, run } = (0, import_ahooks.useRequest)(getCountryDataList, {
|
|
58
66
|
cacheKey: "phone-countries",
|
|
59
67
|
staleTime: 1e3 * 60 * 5,
|
|
@@ -62,28 +70,40 @@ var useCountries = () => {
|
|
|
62
70
|
// 1小时后清除缓存
|
|
63
71
|
manual: true
|
|
64
72
|
});
|
|
73
|
+
const { data: shopData, run: runShop } = (0, import_ahooks.useRequest)(getShopCountryDataList, {
|
|
74
|
+
cacheKey: "phone-shop-countries",
|
|
75
|
+
staleTime: 1e3 * 60 * 5,
|
|
76
|
+
// 5分钟后数据过期
|
|
77
|
+
cacheTime: 1e3 * 60 * 60,
|
|
78
|
+
// 1小时后清除缓存
|
|
79
|
+
manual: true
|
|
80
|
+
});
|
|
65
81
|
(0, import_react.useEffect)(() => {
|
|
66
82
|
if (!isShop) {
|
|
67
83
|
run();
|
|
68
84
|
}
|
|
69
85
|
}, [isShop]);
|
|
86
|
+
(0, import_react.useEffect)(() => {
|
|
87
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
88
|
+
if (isShop && !((_e = (_d = (_c = (_b = (_a = appHelper == null ? void 0 : appHelper.utils) == null ? void 0 : _a.store) == null ? void 0 : _b.getState()) == null ? void 0 : _c.global) == null ? void 0 : _d.codeList) == null ? void 0 : _e.length)) {
|
|
89
|
+
runShop((_g = (_f = others == null ? void 0 : others.engine) == null ? void 0 : _f.props) == null ? void 0 : _g.locale);
|
|
90
|
+
}
|
|
91
|
+
}, [isShop]);
|
|
70
92
|
const currentData = (0, import_react.useMemo)(() => {
|
|
71
93
|
var _a, _b, _c, _d;
|
|
72
94
|
if (isShop) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
prefix: `+${item.calling_code}`
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
95
|
+
return (((_d = (_c = (_b = (_a = appHelper == null ? void 0 : appHelper.utils) == null ? void 0 : _a.store) == null ? void 0 : _b.getState()) == null ? void 0 : _c.global) == null ? void 0 : _d.codeList) || shopData).map((item) => ({
|
|
96
|
+
...item,
|
|
97
|
+
prefix: `+${item.calling_code}`
|
|
98
|
+
}));
|
|
80
99
|
}
|
|
81
100
|
return data;
|
|
82
|
-
}, [isShop, data]);
|
|
101
|
+
}, [isShop, data, shopData]);
|
|
83
102
|
return { data: currentData };
|
|
84
103
|
};
|
|
85
104
|
// Annotate the CommonJS export names for ESM import in node:
|
|
86
105
|
0 && (module.exports = {
|
|
87
106
|
getCountryDataList,
|
|
107
|
+
getShopCountryDataList,
|
|
88
108
|
useCountries
|
|
89
109
|
});
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
declare const Subdomain: React.FC<import("antd").InputProps & {
|
|
3
3
|
onChange: (value: string) => void;
|
|
4
4
|
onBlur?: ((e: React.FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
5
|
-
rootDomain: "custom" | "
|
|
5
|
+
rootDomain: "custom" | "xzero" | "saas";
|
|
6
6
|
customDomain?: string | undefined;
|
|
7
7
|
value?: string | undefined;
|
|
8
8
|
tenantId: string;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
declare const SelectWithDataSource: (props: import("antd").SelectProps<any, import("antd/es/select").DefaultOptionType> & import("../../dataSourceForm/utils").WithModeProps & import("../../dataSourceForm/utils").WithFormItemProps & {
|
|
3
2
|
options?: any;
|
|
4
|
-
optionSourceType?: "
|
|
3
|
+
optionSourceType?: "custom" | "api" | "default" | undefined;
|
|
5
4
|
labelField: string;
|
|
6
5
|
valueField: string;
|
|
7
6
|
extraParams?: Record<string, any> | undefined;
|
|
@@ -20,7 +20,7 @@ declare const formFieldMap: {
|
|
|
20
20
|
Subdomain: import("react").FC<import("antd").InputProps & {
|
|
21
21
|
onChange: (value: string) => void;
|
|
22
22
|
onBlur?: ((e: import("react").FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
23
|
-
rootDomain: "custom" | "
|
|
23
|
+
rootDomain: "custom" | "xzero" | "saas";
|
|
24
24
|
customDomain?: string | undefined;
|
|
25
25
|
value?: string | undefined;
|
|
26
26
|
tenantId: string;
|
|
@@ -35,7 +35,7 @@ declare const formFieldMap: {
|
|
|
35
35
|
};
|
|
36
36
|
FormItemSelect: (props: import("antd").SelectProps<any, import("antd/es/select").DefaultOptionType> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps & {
|
|
37
37
|
options?: any;
|
|
38
|
-
optionSourceType?: "
|
|
38
|
+
optionSourceType?: "custom" | "api" | "default" | undefined;
|
|
39
39
|
labelField: string;
|
|
40
40
|
valueField: string;
|
|
41
41
|
extraParams?: Record<string, any> | undefined;
|
|
@@ -60,13 +60,25 @@ declare const formFieldMap: {
|
|
|
60
60
|
FormItemTranslation: import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
61
61
|
FormItemIconSelect: import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
62
62
|
};
|
|
63
|
-
declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
|
|
63
|
+
declare const getFieldComponent: (fieldComponent: string) => import("react").FC<import("./Input.Phone/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Mobile/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Upload/type").UploadProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./TimePicker/type").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<any> | ((props: import("antd").SelectProps<any, import("antd/es/select").DefaultOptionType> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps & {
|
|
64
|
+
options?: any;
|
|
65
|
+
optionSourceType?: "custom" | "api" | "default" | undefined;
|
|
66
|
+
labelField: string;
|
|
67
|
+
valueField: string;
|
|
68
|
+
extraParams?: Record<string, any> | undefined;
|
|
69
|
+
} & {
|
|
70
|
+
dataSource?: any;
|
|
71
|
+
}) => JSX.Element) | import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps> | (import("react").FC<{}> & {
|
|
72
|
+
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
73
|
+
} & {
|
|
74
|
+
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
75
|
+
}) | import("react").FC<import("antd").InputProps & {
|
|
76
|
+
onChange: (value: string) => void;
|
|
77
|
+
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<(import("antd").DatePickerProps & import("../dataSourceForm/utils").WithModeProps) & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./ColorPicker/type").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps> | (import("react").FC<{}> & {
|
|
64
78
|
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
65
79
|
} & {
|
|
66
80
|
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
67
|
-
}) | import("react").FC<import("./
|
|
68
|
-
onChange: (value: string) => void;
|
|
69
|
-
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Phone/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Mobile/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | (import("react").FC<import("./Input/type").InputProps> & {
|
|
81
|
+
}) | (import("react").FC<import("./Input/type").InputProps> & {
|
|
70
82
|
JSON: import("react").FC<any>;
|
|
71
83
|
Password: import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
72
84
|
TextArea: import("react").FC<import("antd/es/input").TextAreaProps & import("react").RefAttributes<import("antd/es/input/TextArea").TextAreaRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
@@ -79,24 +91,12 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
|
|
|
79
91
|
Subdomain: import("react").FC<import("antd").InputProps & {
|
|
80
92
|
onChange: (value: string) => void;
|
|
81
93
|
onBlur?: ((e: import("react").FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
82
|
-
rootDomain: "custom" | "
|
|
94
|
+
rootDomain: "custom" | "xzero" | "saas";
|
|
83
95
|
customDomain?: string | undefined;
|
|
84
96
|
value?: string | undefined;
|
|
85
97
|
tenantId: string;
|
|
86
98
|
name?: string | undefined;
|
|
87
99
|
fieldKey?: string | undefined;
|
|
88
100
|
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
89
|
-
})
|
|
90
|
-
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
91
|
-
} & {
|
|
92
|
-
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
93
|
-
}) | ((props: import("antd").SelectProps<any, import("antd/es/select").DefaultOptionType> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps & {
|
|
94
|
-
options?: any;
|
|
95
|
-
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
96
|
-
labelField: string;
|
|
97
|
-
valueField: string;
|
|
98
|
-
extraParams?: Record<string, any> | undefined;
|
|
99
|
-
} & {
|
|
100
|
-
dataSource?: any;
|
|
101
|
-
}) => JSX.Element) | import("react").FC<import("./TimePicker/type").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Upload/type").UploadProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
101
|
+
});
|
|
102
102
|
export { getFieldComponent, formFieldMap };
|
|
@@ -17,4 +17,4 @@ export declare const minusSign: (item: any, type?: string) => "" | "-";
|
|
|
17
17
|
* @Author: WangHan
|
|
18
18
|
* @Date: 2024-11-22 10:58
|
|
19
19
|
*/
|
|
20
|
-
export declare const _formatAmount: (price?: number, amountSymbol?: string, digit?: number) =>
|
|
20
|
+
export declare const _formatAmount: (price?: number, amountSymbol?: string, digit?: number) => any;
|
|
@@ -74,7 +74,6 @@ var ProductCard = (props) => {
|
|
|
74
74
|
const useOpenNoteRef = (0, import_react.useRef)();
|
|
75
75
|
const locale = ((_a = utils == null ? void 0 : utils.storage) == null ? void 0 : _a.get("umi_locale")) || localStorage.getItem("umi_locale");
|
|
76
76
|
import_utils.locales.init(import_locales.default, locale || "en");
|
|
77
|
-
console.log(dataSource, isShowImage, isShowNote, "dataSource");
|
|
78
77
|
const {
|
|
79
78
|
image,
|
|
80
79
|
bundle,
|