@pisell/materials 6.0.5 → 6.0.7
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 +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +21 -53
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +18 -50
- package/es/components/config-provider/index.js +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/BaseForm.js +20 -11
- package/es/components/dataSourceComponents/dataSourceForm/formItem.js +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/group/index.less +2 -2
- package/es/components/dataSourceComponents/dataSourceForm/index.js +4 -2
- package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +4 -0
- package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.js +11 -3
- package/es/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider.js +10 -3
- package/es/components/dataSourceComponents/dataSourceForm/serve.d.ts +3 -2
- package/es/components/dataSourceComponents/dataSourceForm/serve.js +36 -20
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +50 -35
- package/es/components/dataSourceComponents/dataSourceForm/type.d.ts +5 -0
- package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +3 -1
- package/es/components/dataSourceComponents/dataSourceForm/utils.js +38 -10
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +6 -1
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.js +1 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +4 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +14 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +48 -4
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/index.js +4 -2
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +15 -1
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +7 -1
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +16 -1
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +1 -1
- package/es/components/dataSourceComponents/fields/Select/index.js +7 -1
- package/es/components/dataSourceComponents/fields/Upload/serve.d.ts +4 -1
- package/es/components/dataSourceComponents/fields/Upload/serve.js +10 -31
- package/es/components/dataSourceComponents/hooks/useActions.d.ts +2 -1
- package/es/components/dataSourceComponents/hooks/useActions.js +73 -36
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +7 -0
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +3 -1
- package/es/components/dataSourceComponents/provider/variables/VariablesProvider.js +53 -6
- package/es/components/login-and-register/index.d.ts +82 -0
- package/es/components/login-and-register/index.js +360 -0
- package/es/components/login-and-register/index.less +211 -0
- package/es/components/organizationTenantSwitcher/defaultLogo.png +0 -0
- package/es/components/organizationTenantSwitcher/index.d.ts +17 -0
- package/es/components/organizationTenantSwitcher/index.js +96 -0
- package/es/components/organizationTenantSwitcher/index.less +88 -0
- package/es/components/page/index.js +8 -6
- package/es/components/page-header/index.d.ts +14 -0
- package/es/components/page-header/index.js +36 -0
- package/es/components/page-header/index.less +45 -0
- package/es/components/pisellAvatar/index.d.ts +19 -0
- package/es/components/pisellAvatar/index.js +89 -0
- package/es/components/pisellAvatar/index.less +26 -0
- package/es/components/pisellModal/components/PcModal/index.js +1 -1
- package/es/components/pisellTags/index.d.ts +13 -0
- package/es/components/pisellTags/index.js +83 -0
- package/es/components/pisellTags/index.less +17 -0
- package/es/components/pisellTags/utils.d.ts +1 -0
- package/es/components/pisellTags/utils.js +89 -0
- package/es/components/pisellText/components/Amount/index.js +1 -1
- package/es/components/profileMenu/index.d.ts +26 -0
- package/es/components/profileMenu/index.js +115 -0
- package/es/components/profileMenu/index.less +135 -0
- package/es/components/select/index.js +3 -2
- package/es/components/table/Header/index.js +8 -11
- package/es/index.d.ts +6 -0
- package/es/index.js +7 -1
- package/es/locales/en-US.d.ts +1 -0
- package/es/locales/en-US.js +1 -0
- package/es/locales/zh-CN.d.ts +1 -0
- package/es/locales/zh-CN.js +1 -0
- package/es/locales/zh-TW.d.ts +1 -0
- package/es/locales/zh-TW.js +1 -0
- package/lib/components/config-provider/index.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.js +22 -4
- package/lib/components/dataSourceComponents/dataSourceForm/formItem.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/group/index.less +2 -2
- package/lib/components/dataSourceComponents/dataSourceForm/index.js +3 -2
- package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +4 -0
- package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.js +17 -3
- package/lib/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider.js +16 -6
- package/lib/components/dataSourceComponents/dataSourceForm/serve.d.ts +3 -2
- package/lib/components/dataSourceComponents/dataSourceForm/serve.js +9 -5
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +19 -9
- package/lib/components/dataSourceComponents/dataSourceForm/type.d.ts +5 -0
- package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +3 -1
- package/lib/components/dataSourceComponents/dataSourceForm/utils.js +51 -5
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +6 -1
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +4 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +14 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +46 -3
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/index.js +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +15 -1
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +6 -1
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +17 -2
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +1 -1
- package/lib/components/dataSourceComponents/fields/Select/index.js +5 -1
- package/lib/components/dataSourceComponents/fields/Upload/serve.d.ts +4 -1
- package/lib/components/dataSourceComponents/fields/Upload/serve.js +20 -12
- package/lib/components/dataSourceComponents/hooks/useActions.d.ts +2 -1
- package/lib/components/dataSourceComponents/hooks/useActions.js +25 -7
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +7 -0
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +3 -1
- package/lib/components/dataSourceComponents/provider/variables/VariablesProvider.js +48 -7
- package/lib/components/login-and-register/index.d.ts +82 -0
- package/lib/components/login-and-register/index.js +261 -0
- package/lib/components/login-and-register/index.less +211 -0
- package/lib/components/organizationTenantSwitcher/defaultLogo.png +0 -0
- package/lib/components/organizationTenantSwitcher/index.d.ts +17 -0
- package/lib/components/organizationTenantSwitcher/index.js +119 -0
- package/lib/components/organizationTenantSwitcher/index.less +88 -0
- package/lib/components/page/index.js +6 -6
- package/lib/components/page-header/index.d.ts +14 -0
- package/lib/components/page-header/index.js +63 -0
- package/lib/components/page-header/index.less +45 -0
- package/lib/components/pisellAvatar/index.d.ts +19 -0
- package/lib/components/pisellAvatar/index.js +108 -0
- package/lib/components/pisellAvatar/index.less +26 -0
- package/lib/components/pisellModal/components/PcModal/index.js +1 -1
- package/lib/components/pisellTags/index.d.ts +13 -0
- package/lib/components/pisellTags/index.js +113 -0
- package/lib/components/pisellTags/index.less +17 -0
- package/lib/components/pisellTags/utils.d.ts +1 -0
- package/lib/components/pisellTags/utils.js +86 -0
- package/lib/components/pisellText/components/Amount/index.js +2 -2
- package/lib/components/profileMenu/index.d.ts +26 -0
- package/lib/components/profileMenu/index.js +113 -0
- package/lib/components/profileMenu/index.less +135 -0
- package/lib/components/select/index.js +2 -1
- package/lib/components/table/Header/index.js +11 -1
- package/lib/index.d.ts +6 -0
- package/lib/index.js +18 -0
- package/lib/locales/en-US.d.ts +1 -0
- package/lib/locales/en-US.js +1 -0
- package/lib/locales/zh-CN.d.ts +1 -0
- package/lib/locales/zh-CN.js +1 -0
- package/lib/locales/zh-TW.d.ts +1 -0
- package/lib/locales/zh-TW.js +1 -0
- package/lowcode/_utils/defaultSchema.ts +64 -0
- package/lowcode/data-source-form/meta.ts +130 -0
- package/lowcode/data-source-form/utils.ts +33 -3
- package/lowcode/data-source-table/meta.ts +420 -3
- package/lowcode/data-source-table/utils.tsx +6 -0
- package/lowcode/form-item-date-picker/snippets.ts +3 -0
- package/lowcode/form-item-input/snippets.ts +3 -1
- package/lowcode/form-item-input-number/snippets.ts +4 -0
- package/lowcode/form-item-input.email/snippets.ts +3 -0
- package/lowcode/form-item-input.json/snippets.ts +4 -1
- package/lowcode/form-item-input.password/snippets.ts +3 -0
- package/lowcode/form-item-input.phone/snippets.ts +3 -0
- package/lowcode/form-item-input.text-area/snippets.ts +3 -1
- package/lowcode/form-item-input.url/snippets.ts +3 -0
- package/lowcode/form-item-select/meta.ts +2 -1
- package/lowcode/form-item-select/snippets.ts +6 -0
- package/lowcode/form-item-time-picker/snippets.ts +3 -0
- package/lowcode/form-item-translation/snippets.ts +3 -1
- package/lowcode/login-and-register/meta.ts +541 -0
- package/lowcode/login-and-register/snippets.ts +38 -0
- package/lowcode/organization-tenant-switch/meta.ts +127 -0
- package/lowcode/page-header/meta.ts +68 -124
- package/lowcode/page-header/snippets.ts +1 -1
- package/lowcode/pisell-avatar/__screenshots__/avatar-1.jpg +0 -0
- package/lowcode/pisell-avatar/meta.ts +111 -0
- package/lowcode/pisell-avatar/snippets.ts +14 -0
- package/lowcode/pisell-tags/__screenshots__/tag-1.png +0 -0
- package/lowcode/pisell-tags/meta.ts +123 -0
- package/lowcode/pisell-tags/snippets.ts +14 -0
- package/lowcode/profile-menu/meta.ts +175 -0
- package/lowcode/profile-menu/snippets.ts +71 -0
- package/lowcode/submit-button/meta.ts +6 -0
- package/package.json +3 -3
|
@@ -35,15 +35,29 @@ module.exports = __toCommonJS(FormSettingProvider_exports);
|
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_FormSettingContext = __toESM(require("./FormSettingContext"));
|
|
37
37
|
var FormSettingProvider = (props) => {
|
|
38
|
-
const {
|
|
38
|
+
const {
|
|
39
|
+
children,
|
|
40
|
+
renderMode,
|
|
41
|
+
groupInfoPosition,
|
|
42
|
+
currentValue,
|
|
43
|
+
size,
|
|
44
|
+
onDataSourceFinish,
|
|
45
|
+
formatSubmitValues,
|
|
46
|
+
formatInitialValues,
|
|
47
|
+
customSubmit
|
|
48
|
+
} = props;
|
|
39
49
|
const value = import_react.default.useMemo(() => {
|
|
40
50
|
return {
|
|
41
51
|
renderMode,
|
|
42
52
|
groupInfoPosition,
|
|
43
53
|
currentValue,
|
|
44
|
-
size
|
|
54
|
+
size,
|
|
55
|
+
onDataSourceFinish,
|
|
56
|
+
formatSubmitValues,
|
|
57
|
+
formatInitialValues,
|
|
58
|
+
customSubmit
|
|
45
59
|
};
|
|
46
|
-
}, [renderMode, groupInfoPosition, currentValue, size]);
|
|
60
|
+
}, [renderMode, groupInfoPosition, currentValue, size, onDataSourceFinish, formatSubmitValues, formatInitialValues, customSubmit]);
|
|
47
61
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
48
62
|
import_FormSettingContext.default.Provider,
|
|
49
63
|
{
|
|
@@ -37,16 +37,26 @@ var import_formItem = __toESM(require("../../formItem"));
|
|
|
37
37
|
var import_utils = require("../../utils");
|
|
38
38
|
var import_JsonWrapperContext = __toESM(require("./JsonWrapperContext"));
|
|
39
39
|
var JsonWrapperProvider = (props) => {
|
|
40
|
-
const { children, prefix, label } = props;
|
|
40
|
+
const { children, prefix, label, style } = props;
|
|
41
41
|
const { path: prefixPath = [], level = 0 } = (0, import_react.useContext)(import_JsonWrapperContext.default) || {};
|
|
42
42
|
const concatPath = (0, import_react.useMemo)(
|
|
43
43
|
() => [...prefixPath, ...(0, import_utils.toArr)(prefix)],
|
|
44
44
|
[prefixPath, prefix]
|
|
45
45
|
);
|
|
46
|
-
const contextValue = (0, import_react.useMemo)(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
const contextValue = (0, import_react.useMemo)(
|
|
47
|
+
() => ({
|
|
48
|
+
path: concatPath,
|
|
49
|
+
level: level + 1
|
|
50
|
+
}),
|
|
51
|
+
[concatPath, level]
|
|
52
|
+
);
|
|
53
|
+
return /* @__PURE__ */ import_react.default.createElement(import_JsonWrapperContext.default.Provider, { value: contextValue }, /* @__PURE__ */ import_react.default.createElement(
|
|
54
|
+
import_formItem.default,
|
|
55
|
+
{
|
|
56
|
+
label,
|
|
57
|
+
style: { ...style || {}, paddingLeft: `${level * 12}px` }
|
|
58
|
+
},
|
|
59
|
+
/* @__PURE__ */ import_react.default.createElement("div", { style: { paddingLeft: `${level * 12}px` } }, children)
|
|
60
|
+
));
|
|
51
61
|
};
|
|
52
62
|
var JsonWrapperProvider_default = JsonWrapperProvider;
|
|
@@ -103,7 +103,8 @@ export declare const createNocobaseData: (params: {
|
|
|
103
103
|
*/
|
|
104
104
|
export declare const getNocobaseData: (params: {
|
|
105
105
|
key: string;
|
|
106
|
-
|
|
106
|
+
query: Record<string, any>;
|
|
107
|
+
headers?: any;
|
|
107
108
|
}) => Promise<any>;
|
|
108
109
|
/**
|
|
109
110
|
* 自定义api接口
|
|
@@ -126,9 +127,9 @@ export declare const customApi: (url: string, data: Record<string, any>, options
|
|
|
126
127
|
*/
|
|
127
128
|
export declare const updateNocobaseData: (params: {
|
|
128
129
|
key: string;
|
|
129
|
-
id: string;
|
|
130
130
|
data: any;
|
|
131
131
|
headers?: any;
|
|
132
|
+
query?: Record<string, any> | undefined;
|
|
132
133
|
}) => Promise<any>;
|
|
133
134
|
/**
|
|
134
135
|
* 获取nocobase数据列表
|
|
@@ -65,13 +65,17 @@ var createNocobaseData = async (params) => {
|
|
|
65
65
|
headers
|
|
66
66
|
});
|
|
67
67
|
};
|
|
68
|
+
var formatQueryObjString = (query = {}) => {
|
|
69
|
+
return Object.entries(query || {}).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join("&");
|
|
70
|
+
};
|
|
68
71
|
var getNocobaseData = async (params) => {
|
|
69
|
-
const { key,
|
|
72
|
+
const { key, query, headers } = params;
|
|
70
73
|
return import_utils.request.getRequest().get(
|
|
71
|
-
`/${key}:get
|
|
74
|
+
`/${key}:get?${formatQueryObjString(query)}`,
|
|
72
75
|
{},
|
|
73
76
|
{
|
|
74
|
-
isNocobase: true
|
|
77
|
+
isNocobase: true,
|
|
78
|
+
headers
|
|
75
79
|
}
|
|
76
80
|
);
|
|
77
81
|
};
|
|
@@ -104,8 +108,8 @@ var customApi = async (url, data, options) => {
|
|
|
104
108
|
return import_utils.request.getRequest()[requestMethod](requestUrl, requestData, { headers: requestHeaders, isCustomApi: true });
|
|
105
109
|
};
|
|
106
110
|
var updateNocobaseData = async (params) => {
|
|
107
|
-
const { key,
|
|
108
|
-
return import_utils.request.getRequest().post(`/${key}:update
|
|
111
|
+
const { key, data, headers, query } = params;
|
|
112
|
+
return import_utils.request.getRequest().post(`/${key}:update?${formatQueryObjString(query)}`, data, {
|
|
109
113
|
isNocobase: true,
|
|
110
114
|
headers
|
|
111
115
|
});
|
|
@@ -40,6 +40,7 @@ var import_formItem = __toESM(require("../formItem"));
|
|
|
40
40
|
var import_useFormSetting = __toESM(require("../provider/hooks/useFormSetting"));
|
|
41
41
|
var import_useCtxActions = __toESM(require("../../hooks/useCtxActions"));
|
|
42
42
|
var import_useDataSource = __toESM(require("../../hooks/useDataSource"));
|
|
43
|
+
var import_utils = require("../utils");
|
|
43
44
|
var import_index = require("./index.less");
|
|
44
45
|
var SubmitButton = (props) => {
|
|
45
46
|
const {
|
|
@@ -57,23 +58,23 @@ var SubmitButton = (props) => {
|
|
|
57
58
|
const [loading, setLoading] = (0, import_react.useState)(false);
|
|
58
59
|
const [api, contextHolder] = import_antd.notification.useNotification();
|
|
59
60
|
const form = import_antd.Form.useFormInstance();
|
|
60
|
-
const { renderMode } = (0, import_useFormSetting.default)();
|
|
61
|
+
const { renderMode, onDataSourceFinish, formatSubmitValues, customSubmit } = (0, import_useFormSetting.default)();
|
|
61
62
|
const { setVisible, refreshTableData } = (0, import_useCtxActions.default)();
|
|
62
63
|
const { create, update } = (0, import_useDataSource.default)();
|
|
63
64
|
const isDisabled = status === "disabled";
|
|
64
65
|
const onSubmit = async (values) => {
|
|
66
|
+
setLoading(true);
|
|
65
67
|
try {
|
|
66
|
-
|
|
68
|
+
if (customSubmit) {
|
|
69
|
+
return await customSubmit(values);
|
|
70
|
+
}
|
|
67
71
|
if (renderMode === "edit") {
|
|
68
|
-
await update.runAsync(values);
|
|
72
|
+
return await update.runAsync(values);
|
|
69
73
|
} else if (renderMode === "add") {
|
|
70
74
|
const res = await create.runAsync(values);
|
|
71
75
|
form == null ? void 0 : form.resetFields();
|
|
76
|
+
return res;
|
|
72
77
|
}
|
|
73
|
-
} catch (error) {
|
|
74
|
-
(0, import_pisellToast.default)({
|
|
75
|
-
content: `操作失败:${error.message}`
|
|
76
|
-
});
|
|
77
78
|
} finally {
|
|
78
79
|
setLoading(false);
|
|
79
80
|
}
|
|
@@ -114,7 +115,12 @@ var SubmitButton = (props) => {
|
|
|
114
115
|
content: toastConfig.title
|
|
115
116
|
});
|
|
116
117
|
}
|
|
117
|
-
|
|
118
|
+
const filteredValues = (0, import_utils.filterSystemFields)(allValues);
|
|
119
|
+
const formattedValues = formatSubmitValues ? formatSubmitValues(filteredValues) : filteredValues;
|
|
120
|
+
const result = await onSubmit(formattedValues);
|
|
121
|
+
if (onDataSourceFinish) {
|
|
122
|
+
onDataSourceFinish(formattedValues, result);
|
|
123
|
+
}
|
|
118
124
|
if (refreshData) {
|
|
119
125
|
refreshTableData == null ? void 0 : refreshTableData();
|
|
120
126
|
}
|
|
@@ -130,6 +136,9 @@ var SubmitButton = (props) => {
|
|
|
130
136
|
}
|
|
131
137
|
}
|
|
132
138
|
} catch (error) {
|
|
139
|
+
(0, import_pisellToast.default)({
|
|
140
|
+
content: `${error.message}`
|
|
141
|
+
});
|
|
133
142
|
}
|
|
134
143
|
};
|
|
135
144
|
const onSubmitClick = async () => {
|
|
@@ -157,7 +166,8 @@ var SubmitButton = (props) => {
|
|
|
157
166
|
size: "large",
|
|
158
167
|
loading,
|
|
159
168
|
onClick: onSubmitClick,
|
|
160
|
-
disabled: isDisabled
|
|
169
|
+
disabled: isDisabled,
|
|
170
|
+
htmlType: "submit"
|
|
161
171
|
},
|
|
162
172
|
childrenString
|
|
163
173
|
), contextHolder));
|
|
@@ -5,6 +5,7 @@ export interface DataSourceFormProps {
|
|
|
5
5
|
title: string;
|
|
6
6
|
description: string;
|
|
7
7
|
dataSource: DataSourceType;
|
|
8
|
+
extraParams?: Record<string, any>;
|
|
8
9
|
showTitle: boolean;
|
|
9
10
|
showDescription: boolean;
|
|
10
11
|
groupInfoPosition: 'top' | 'side';
|
|
@@ -14,5 +15,9 @@ export interface DataSourceFormProps {
|
|
|
14
15
|
children: React.ReactNode;
|
|
15
16
|
className?: string;
|
|
16
17
|
size?: 'small' | 'middle' | 'large';
|
|
18
|
+
onDataSourceFinish?: (values: any, result: any) => void;
|
|
17
19
|
__designMode?: string;
|
|
20
|
+
formatSubmitValues?: (values: Record<string, any>) => Record<string, any>;
|
|
21
|
+
formatInitialValues?: (values: Record<string, any>) => Record<string, any>;
|
|
22
|
+
customSubmit?: (values: Record<string, any>) => Promise<any>;
|
|
18
23
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ModeType } from './type';
|
|
3
|
-
import
|
|
3
|
+
import './style.less';
|
|
4
4
|
export interface WithModeProps {
|
|
5
5
|
renderMode?: ModeType;
|
|
6
6
|
value?: any;
|
|
@@ -25,6 +25,7 @@ export interface WithFormItemProps {
|
|
|
25
25
|
}
|
|
26
26
|
export declare const formItemNameReplace: (name: string) => string;
|
|
27
27
|
export declare const formItemNameReverse: (name: string) => string;
|
|
28
|
+
export declare const isValidDomain: (value: string) => boolean;
|
|
28
29
|
/**
|
|
29
30
|
* @title: 追加formItem层
|
|
30
31
|
* @description:
|
|
@@ -48,3 +49,4 @@ export declare const withOptions: <P extends unknown>(WrappedComponent: React.Co
|
|
|
48
49
|
export declare const getNestedValue: (obj: Record<string, any>, path: string) => Record<string, any>;
|
|
49
50
|
export declare const renderValueWithMap: (value: any, valueMap?: Record<string, string>, renderMode?: ModeType) => React.JSX.Element | null;
|
|
50
51
|
export declare function toArr(str: string | number | (string | number)[]): (string | number)[];
|
|
52
|
+
export declare const filterSystemFields: (params: Record<string, any>) => Record<string, any>;
|
|
@@ -29,9 +29,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
// src/components/dataSourceComponents/dataSourceForm/utils.tsx
|
|
30
30
|
var utils_exports = {};
|
|
31
31
|
__export(utils_exports, {
|
|
32
|
+
filterSystemFields: () => filterSystemFields,
|
|
32
33
|
formItemNameReplace: () => formItemNameReplace,
|
|
33
34
|
formItemNameReverse: () => formItemNameReverse,
|
|
34
35
|
getNestedValue: () => getNestedValue,
|
|
36
|
+
isValidDomain: () => isValidDomain,
|
|
35
37
|
renderValueWithMap: () => renderValueWithMap,
|
|
36
38
|
toArr: () => toArr,
|
|
37
39
|
withDataSource: () => withDataSource,
|
|
@@ -85,6 +87,9 @@ var formItemNameReplace = (name) => {
|
|
|
85
87
|
var formItemNameReverse = (name) => {
|
|
86
88
|
return name.replace(new RegExp(FORM_ITEM_SPLIT_CHAR, "g"), ".");
|
|
87
89
|
};
|
|
90
|
+
var isValidDomain = (value) => {
|
|
91
|
+
return /^(?=.{1,253}$)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\.[A-Za-z]{2,})+$/.test(value);
|
|
92
|
+
};
|
|
88
93
|
var withFormItem = (WrappedComponent, overlayProps) => {
|
|
89
94
|
return ({
|
|
90
95
|
name: propsName,
|
|
@@ -164,6 +169,15 @@ var withFormItem = (WrappedComponent, overlayProps) => {
|
|
|
164
169
|
message: typeobj.message || (0, import_locales.getText)("pisell-data-source-form-email-message")
|
|
165
170
|
});
|
|
166
171
|
}
|
|
172
|
+
if (typeobj.type === "domain" && typeobj.enabled) {
|
|
173
|
+
rules.push({
|
|
174
|
+
validator: (_, value) => isValidDomain(value) ? Promise.resolve() : Promise.reject(
|
|
175
|
+
new Error(
|
|
176
|
+
typeobj.message || (0, import_locales.getText)("pisell-data-source-form-domain-message")
|
|
177
|
+
)
|
|
178
|
+
)
|
|
179
|
+
});
|
|
180
|
+
}
|
|
167
181
|
if (typeobj.type === "url" && typeobj.enabled) {
|
|
168
182
|
rules.push({
|
|
169
183
|
...typeobj,
|
|
@@ -174,7 +188,7 @@ var withFormItem = (WrappedComponent, overlayProps) => {
|
|
|
174
188
|
rules.push({
|
|
175
189
|
validator: (_, value) => {
|
|
176
190
|
var _a2;
|
|
177
|
-
return (0, import_libphonenumber_js.isValidPhoneNumber)(value) && ((_a2 = (0, import_libphonenumber_js.parsePhoneNumberFromString)(value)) == null ? void 0 : _a2.isValid()) ? Promise.resolve() : Promise.reject(
|
|
191
|
+
return !otherProps.disabled || (0, import_libphonenumber_js.isValidPhoneNumber)(value) && ((_a2 = (0, import_libphonenumber_js.parsePhoneNumberFromString)(value)) == null ? void 0 : _a2.isValid()) ? Promise.resolve() : Promise.reject(
|
|
178
192
|
new Error(
|
|
179
193
|
typeobj.message || (0, import_locales.getText)("pisell-data-source-form-phone-message")
|
|
180
194
|
)
|
|
@@ -182,6 +196,12 @@ var withFormItem = (WrappedComponent, overlayProps) => {
|
|
|
182
196
|
}
|
|
183
197
|
});
|
|
184
198
|
}
|
|
199
|
+
if (typeobj.type === "pattern" && typeobj.enabled) {
|
|
200
|
+
rules.push({
|
|
201
|
+
...typeobj,
|
|
202
|
+
message: typeobj.message
|
|
203
|
+
});
|
|
204
|
+
}
|
|
185
205
|
}
|
|
186
206
|
if (maxLengthobj && maxLengthobj.enabled) {
|
|
187
207
|
rules.push({
|
|
@@ -316,14 +336,14 @@ var withOptions = (WrappedComponent) => {
|
|
|
316
336
|
}
|
|
317
337
|
}, []);
|
|
318
338
|
const options = (0, import_react.useMemo)(() => {
|
|
319
|
-
var _a2, _b;
|
|
339
|
+
var _a2, _b, _c;
|
|
320
340
|
if (optionSourceType !== "api") {
|
|
321
341
|
return propsOptions;
|
|
322
342
|
}
|
|
323
|
-
return (((_b = (_a2 = list.data) == null ? void 0 : _a2.data) == null ? void 0 : _b.map((item) => ({
|
|
343
|
+
return (((_c = (_b = (_a2 = list.data) == null ? void 0 : _a2.data) == null ? void 0 : _b.filter) == null ? void 0 : _c.call(_b, (item) => !["draft", "inactive", "disabled"].includes(item == null ? void 0 : item.status))) || []).map((item) => ({
|
|
324
344
|
label: translationOriginal(item[labelField]),
|
|
325
345
|
value: item[valueField]
|
|
326
|
-
}))
|
|
346
|
+
})) || [];
|
|
327
347
|
}, [propsOptions, optionSourceType, (_a = list == null ? void 0 : list.data) == null ? void 0 : _a.data]);
|
|
328
348
|
return /* @__PURE__ */ import_react.default.createElement(WrappedComponent, { ...props, options });
|
|
329
349
|
};
|
|
@@ -341,7 +361,15 @@ var getNestedValue = (obj, path) => {
|
|
|
341
361
|
var renderValueWithMap = (value, valueMap, renderMode) => {
|
|
342
362
|
const textStyle = renderMode === "tableView" ? { fontSize: 14, fontWeight: 400 } : {};
|
|
343
363
|
if ((0, import_utils.isArr)(value)) {
|
|
344
|
-
return /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-form-read-pretty-text" }, value.map((item, index) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
364
|
+
return /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-form-read-pretty-text" }, value.map((item, index) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
365
|
+
"span",
|
|
366
|
+
{
|
|
367
|
+
key: item,
|
|
368
|
+
className: "pisell-form-read-pretty-value",
|
|
369
|
+
style: textStyle
|
|
370
|
+
},
|
|
371
|
+
valueMap == null ? void 0 : valueMap[item]
|
|
372
|
+
), index < value.length - 1 && ", ")));
|
|
345
373
|
} else if ((0, import_utils.isString)(value)) {
|
|
346
374
|
return /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-form-read-pretty-text" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-form-read-pretty-value", style: textStyle }, (valueMap == null ? void 0 : valueMap[value]) || value));
|
|
347
375
|
}
|
|
@@ -350,11 +378,29 @@ var renderValueWithMap = (value, valueMap, renderMode) => {
|
|
|
350
378
|
function toArr(str) {
|
|
351
379
|
return Array.isArray(str) ? str : [str];
|
|
352
380
|
}
|
|
381
|
+
var systemFields = [
|
|
382
|
+
"createdAt",
|
|
383
|
+
"updatedAt",
|
|
384
|
+
"createdBy",
|
|
385
|
+
"created_at",
|
|
386
|
+
"updated_at",
|
|
387
|
+
"deleted_at"
|
|
388
|
+
];
|
|
389
|
+
var filterSystemFields = (params) => {
|
|
390
|
+
return Object.keys(params).reduce((acc, key) => {
|
|
391
|
+
if (!systemFields.includes(key)) {
|
|
392
|
+
acc[key] = params[key];
|
|
393
|
+
}
|
|
394
|
+
return acc;
|
|
395
|
+
}, {});
|
|
396
|
+
};
|
|
353
397
|
// Annotate the CommonJS export names for ESM import in node:
|
|
354
398
|
0 && (module.exports = {
|
|
399
|
+
filterSystemFields,
|
|
355
400
|
formItemNameReplace,
|
|
356
401
|
formItemNameReverse,
|
|
357
402
|
getNestedValue,
|
|
403
|
+
isValidDomain,
|
|
358
404
|
renderValueWithMap,
|
|
359
405
|
toArr,
|
|
360
406
|
withDataSource,
|
|
@@ -68,6 +68,11 @@ var BaseTable = (props) => {
|
|
|
68
68
|
drawerContent
|
|
69
69
|
} = (0, import_useDrawerState.default)(operationContent);
|
|
70
70
|
const { queryPageConfig, handleValuesChange, refreshData, handleFilterChange } = (0, import_useTableQuery.default)(props);
|
|
71
|
+
const handleAllValuesChange = (changedValues, values) => {
|
|
72
|
+
var _a;
|
|
73
|
+
(_a = props == null ? void 0 : props.onValuesChange) == null ? void 0 : _a.call(props, changedValues, values);
|
|
74
|
+
handleValuesChange(changedValues, values);
|
|
75
|
+
};
|
|
71
76
|
(0, import_useDesignMode.default)(props, {
|
|
72
77
|
registerValueVariable,
|
|
73
78
|
openDrawer,
|
|
@@ -112,7 +117,7 @@ var BaseTable = (props) => {
|
|
|
112
117
|
...transformProps,
|
|
113
118
|
dataSource: (data == null ? void 0 : data.data) || [],
|
|
114
119
|
loading: list == null ? void 0 : list.loading,
|
|
115
|
-
onValuesChange:
|
|
120
|
+
onValuesChange: handleAllValuesChange
|
|
116
121
|
}
|
|
117
122
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
118
123
|
import_ActionsProvider.default,
|
|
@@ -167,7 +167,7 @@ var Filter = (props) => {
|
|
|
167
167
|
},
|
|
168
168
|
searchDom,
|
|
169
169
|
filterDom,
|
|
170
|
-
show && /* @__PURE__ */ import_react.default.createElement(
|
|
170
|
+
show && sortButtonShow && /* @__PURE__ */ import_react.default.createElement(
|
|
171
171
|
import_FilterButton.default,
|
|
172
172
|
{
|
|
173
173
|
value: list,
|
|
@@ -80,7 +80,10 @@ var useColumns = ({
|
|
|
80
80
|
return {
|
|
81
81
|
...column,
|
|
82
82
|
title,
|
|
83
|
-
render: (text) => {
|
|
83
|
+
render: (text, record, index) => {
|
|
84
|
+
if (column == null ? void 0 : column.render) {
|
|
85
|
+
return column.render(text, record, index);
|
|
86
|
+
}
|
|
84
87
|
return /* @__PURE__ */ import_react.default.createElement(FieldComponent, { ...fieldProps, value: text });
|
|
85
88
|
}
|
|
86
89
|
};
|
|
@@ -142,7 +142,7 @@ var useFormat = ({ dataSourceKey, fields }) => {
|
|
|
142
142
|
}
|
|
143
143
|
);
|
|
144
144
|
const formatListParams = (0, import_ahooks.useMemoizedFn)((params) => {
|
|
145
|
-
if (!dataSourceKey) {
|
|
145
|
+
if (!dataSourceKey || ["pisell2", "main"].includes(dataSourceKey)) {
|
|
146
146
|
return {
|
|
147
147
|
...params,
|
|
148
148
|
filter: formatFilter(params.filter, fields),
|
|
@@ -30,11 +30,17 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
30
30
|
buttons: any[] | null;
|
|
31
31
|
filter: React.JSX.Element | null;
|
|
32
32
|
onRow: (record: any) => any;
|
|
33
|
+
actionButtons: any[] | null;
|
|
33
34
|
titleButtons?: {
|
|
34
35
|
show: boolean;
|
|
35
36
|
maxCount: number;
|
|
36
37
|
items: OperationItem[];
|
|
37
38
|
} | undefined;
|
|
39
|
+
tableButtons?: {
|
|
40
|
+
show: boolean;
|
|
41
|
+
maxCount: number;
|
|
42
|
+
items: OperationItem[];
|
|
43
|
+
} | undefined;
|
|
38
44
|
operation?: {
|
|
39
45
|
show: boolean;
|
|
40
46
|
title: string;
|
|
@@ -74,5 +80,13 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
74
80
|
sortBy: string;
|
|
75
81
|
}[];
|
|
76
82
|
} | undefined;
|
|
83
|
+
onValuesChange?: ((changedValues: any, values: any) => void) | undefined;
|
|
84
|
+
extraParams?: {
|
|
85
|
+
list?: Record<string, any> | undefined;
|
|
86
|
+
get?: Record<string, any> | undefined;
|
|
87
|
+
update?: Record<string, any> | undefined;
|
|
88
|
+
create?: Record<string, any> | undefined;
|
|
89
|
+
destroy?: Record<string, any> | undefined;
|
|
90
|
+
} | undefined;
|
|
77
91
|
};
|
|
78
92
|
export default useTableProps;
|
|
@@ -59,6 +59,7 @@ var useTableProps = (props) => {
|
|
|
59
59
|
title: propsTitle,
|
|
60
60
|
subTitle: propsSubTitle,
|
|
61
61
|
titleButtons,
|
|
62
|
+
tableButtons,
|
|
62
63
|
operation,
|
|
63
64
|
filter: propsFilter,
|
|
64
65
|
search,
|
|
@@ -101,6 +102,11 @@ var useTableProps = (props) => {
|
|
|
101
102
|
return propsSubTitle;
|
|
102
103
|
}, [propsSubTitle]);
|
|
103
104
|
const handleOpenDrawer = (0, import_ahooks.useMemoizedFn)((record, item) => {
|
|
105
|
+
var _a2;
|
|
106
|
+
(_a2 = item == null ? void 0 : item.onClick) == null ? void 0 : _a2.call(item, record);
|
|
107
|
+
if (item.openMode === "custom") {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
104
110
|
registerValueVariable == null ? void 0 : registerValueVariable(componentId, {
|
|
105
111
|
currentRecord: record
|
|
106
112
|
});
|
|
@@ -141,7 +147,7 @@ var useTableProps = (props) => {
|
|
|
141
147
|
type,
|
|
142
148
|
render: (_, record) => {
|
|
143
149
|
return /* @__PURE__ */ import_react.default.createElement(import_antd.Space, null, items == null ? void 0 : items.map((item) => {
|
|
144
|
-
const { label, actionType } = item;
|
|
150
|
+
const { label, actionType, show: show2 } = item;
|
|
145
151
|
const handleClick = () => {
|
|
146
152
|
if (actionType === "delete") {
|
|
147
153
|
import_pisellModal.default.confirm({
|
|
@@ -158,6 +164,16 @@ var useTableProps = (props) => {
|
|
|
158
164
|
handleOpenDrawer(record, item);
|
|
159
165
|
}
|
|
160
166
|
};
|
|
167
|
+
if ((0, import_utils.isBoolean)(show2)) {
|
|
168
|
+
if (!show2) {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
} else if ((0, import_utils.isFunction)(show2)) {
|
|
172
|
+
const result = show2(record);
|
|
173
|
+
if (!result) {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
161
177
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
162
178
|
import_antd.Button,
|
|
163
179
|
{
|
|
@@ -186,10 +202,36 @@ var useTableProps = (props) => {
|
|
|
186
202
|
return null;
|
|
187
203
|
}
|
|
188
204
|
return (_a2 = titleButtons == null ? void 0 : titleButtons.items) == null ? void 0 : _a2.map((button) => {
|
|
205
|
+
const { actionType, buttonProps, beforeOpen } = button;
|
|
206
|
+
return {
|
|
207
|
+
...button,
|
|
208
|
+
...buttonProps,
|
|
209
|
+
onClick: () => {
|
|
210
|
+
if (actionType === "add") {
|
|
211
|
+
let result = true;
|
|
212
|
+
if (beforeOpen) {
|
|
213
|
+
result = beforeOpen();
|
|
214
|
+
}
|
|
215
|
+
if (result) {
|
|
216
|
+
handleOpenDrawer(null, button);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
});
|
|
222
|
+
}, [titleButtons]);
|
|
223
|
+
const actionButtons = (0, import_react.useMemo)(() => {
|
|
224
|
+
var _a2;
|
|
225
|
+
if (!(tableButtons == null ? void 0 : tableButtons.show)) {
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
return (_a2 = tableButtons == null ? void 0 : tableButtons.items) == null ? void 0 : _a2.map((button) => {
|
|
189
229
|
const { actionType, buttonProps } = button;
|
|
190
230
|
return {
|
|
191
231
|
...button,
|
|
192
232
|
...buttonProps,
|
|
233
|
+
size: "large",
|
|
234
|
+
title: button.label,
|
|
193
235
|
onClick: () => {
|
|
194
236
|
if (actionType === "add") {
|
|
195
237
|
handleOpenDrawer(null, button);
|
|
@@ -197,7 +239,7 @@ var useTableProps = (props) => {
|
|
|
197
239
|
}
|
|
198
240
|
};
|
|
199
241
|
});
|
|
200
|
-
}, [
|
|
242
|
+
}, [tableButtons]);
|
|
201
243
|
const filter = (0, import_react.useMemo)(() => {
|
|
202
244
|
if (!(propsFilter == null ? void 0 : propsFilter.show) && !(search == null ? void 0 : search.show)) {
|
|
203
245
|
return null;
|
|
@@ -248,7 +290,8 @@ var useTableProps = (props) => {
|
|
|
248
290
|
subTitle,
|
|
249
291
|
buttons,
|
|
250
292
|
filter,
|
|
251
|
-
onRow
|
|
293
|
+
onRow,
|
|
294
|
+
actionButtons
|
|
252
295
|
};
|
|
253
296
|
};
|
|
254
297
|
var useTableProps_default = useTableProps;
|
|
@@ -42,7 +42,7 @@ var useTableQuery = (props) => {
|
|
|
42
42
|
let filter = prev.filter;
|
|
43
43
|
if ("tabs" in params) {
|
|
44
44
|
sort = ((_a2 = params.tabs) == null ? void 0 : _a2.sortBy) || sortBy || "";
|
|
45
|
-
filter = ((_b2 = params.tabs) == null ? void 0 : _b2.filterBy) || {};
|
|
45
|
+
filter = { ...prev.filter, ...((_b2 = params.tabs) == null ? void 0 : _b2.filterBy) || {} };
|
|
46
46
|
}
|
|
47
47
|
if ("order_by" in params) {
|
|
48
48
|
sort = params.order_by || ((_c2 = allParams.tabs) == null ? void 0 : _c2.sortBy) || sortBy;
|
|
@@ -62,7 +62,7 @@ var useTableQuery = (props) => {
|
|
|
62
62
|
setQueryPageConfig((prev) => ({
|
|
63
63
|
...prev,
|
|
64
64
|
page: 1,
|
|
65
|
-
filter: { ...allFields, ...filterBy || {} }
|
|
65
|
+
filter: { ...prev.filter, ...allFields, ...filterBy || {} }
|
|
66
66
|
}));
|
|
67
67
|
}
|
|
68
68
|
);
|
|
@@ -37,7 +37,7 @@ var import_BaseTable = __toESM(require("./BaseTable"));
|
|
|
37
37
|
var import_DataSourceProvider = __toESM(require("../provider/dataSource/DataSourceProvider"));
|
|
38
38
|
var import_index = require("./index.less");
|
|
39
39
|
var DataSourceTable = (props) => {
|
|
40
|
-
const { dataSource, __designMode } = props;
|
|
41
|
-
return /* @__PURE__ */ import_react.default.createElement(import_DataSourceProvider.default, { dataSource, __designMode }, /* @__PURE__ */ import_react.default.createElement(import_BaseTable.default, { ...props }));
|
|
40
|
+
const { dataSource, __designMode, extraParams } = props;
|
|
41
|
+
return /* @__PURE__ */ import_react.default.createElement(import_DataSourceProvider.default, { dataSource, __designMode, extraParams }, /* @__PURE__ */ import_react.default.createElement(import_BaseTable.default, { ...props }));
|
|
42
42
|
};
|
|
43
43
|
var dataSourceTable_default = DataSourceTable;
|
|
@@ -3,12 +3,13 @@ import { ColumnType } from 'antd/es/table';
|
|
|
3
3
|
import { DataSourceType } from '../provider/dataSource/DataSourceContext';
|
|
4
4
|
export declare type OperationItem = {
|
|
5
5
|
label?: string;
|
|
6
|
-
openMode: 'modal' | 'drawer';
|
|
6
|
+
openMode: 'modal' | 'drawer' | 'custom';
|
|
7
7
|
openContentSize: 'small' | 'middle' | 'large';
|
|
8
8
|
openTitle: string;
|
|
9
9
|
actionType: 'detail' | 'edit' | 'delete' | 'custom';
|
|
10
10
|
key: string;
|
|
11
11
|
buttonProps?: any;
|
|
12
|
+
onClick?: (record: any) => void;
|
|
12
13
|
};
|
|
13
14
|
export interface DataSourceTableProps {
|
|
14
15
|
title?: string | React.ReactNode | (() => React.ReactNode);
|
|
@@ -18,6 +19,11 @@ export interface DataSourceTableProps {
|
|
|
18
19
|
maxCount: number;
|
|
19
20
|
items: OperationItem[];
|
|
20
21
|
};
|
|
22
|
+
tableButtons?: {
|
|
23
|
+
show: boolean;
|
|
24
|
+
maxCount: number;
|
|
25
|
+
items: OperationItem[];
|
|
26
|
+
};
|
|
21
27
|
buttons?: any[];
|
|
22
28
|
operation?: {
|
|
23
29
|
show: boolean;
|
|
@@ -61,4 +67,12 @@ export interface DataSourceTableProps {
|
|
|
61
67
|
sortBy: string;
|
|
62
68
|
}[];
|
|
63
69
|
};
|
|
70
|
+
onValuesChange?: (changedValues: any, values: any) => void;
|
|
71
|
+
extraParams?: {
|
|
72
|
+
list?: Record<string, any>;
|
|
73
|
+
get?: Record<string, any>;
|
|
74
|
+
update?: Record<string, any>;
|
|
75
|
+
create?: Record<string, any>;
|
|
76
|
+
destroy?: Record<string, any>;
|
|
77
|
+
};
|
|
64
78
|
}
|
|
@@ -42,7 +42,7 @@ var import_ReadPretty = __toESM(require("./ReadPretty"));
|
|
|
42
42
|
var import_utils2 = require("../../dataSourceForm/utils");
|
|
43
43
|
var import_useTranslationOriginal = __toESM(require("../../../../hooks/useTranslationOriginal"));
|
|
44
44
|
var { Option } = import_select.default;
|
|
45
|
-
var PhoneInput = ({ value: propsValue, onChange, isVerification, ...props }) => {
|
|
45
|
+
var PhoneInput = ({ value: propsValue, onChange, isVerification, disabled, ...props }) => {
|
|
46
46
|
const { data: countries = [] } = (0, import_serve.useCountries)();
|
|
47
47
|
const translationOriginal = (0, import_useTranslationOriginal.default)();
|
|
48
48
|
const value = (0, import_react.useMemo)(() => {
|
|
@@ -90,6 +90,9 @@ var PhoneInput = ({ value: propsValue, onChange, isVerification, ...props }) =>
|
|
|
90
90
|
const selectedCountry = countries.find(
|
|
91
91
|
(c) => c.code === countryCode
|
|
92
92
|
);
|
|
93
|
+
if (phoneNumber.length === 0) {
|
|
94
|
+
return "";
|
|
95
|
+
}
|
|
93
96
|
const prefix = (selectedCountry == null ? void 0 : selectedCountry.prefix) || "";
|
|
94
97
|
return `${prefix}${phoneNumber}`;
|
|
95
98
|
}, [countryCode, phoneNumber, countries]);
|
|
@@ -106,6 +109,7 @@ var PhoneInput = ({ value: propsValue, onChange, isVerification, ...props }) =>
|
|
|
106
109
|
return /* @__PURE__ */ import_react.default.createElement(import_antd.Space.Compact, { block: true }, /* @__PURE__ */ import_react.default.createElement(
|
|
107
110
|
import_select.default,
|
|
108
111
|
{
|
|
112
|
+
disabled,
|
|
109
113
|
value: countryCode,
|
|
110
114
|
onChange: handleCountryChange,
|
|
111
115
|
style: { width: "90px" },
|
|
@@ -124,6 +128,7 @@ var PhoneInput = ({ value: propsValue, onChange, isVerification, ...props }) =>
|
|
|
124
128
|
import_antd.Input,
|
|
125
129
|
{
|
|
126
130
|
...props,
|
|
131
|
+
disabled,
|
|
127
132
|
status,
|
|
128
133
|
type: "tel",
|
|
129
134
|
value: phoneNumber,
|