@pisell/materials 6.0.6 → 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 +46 -25
- 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/filter/index.js +1 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +4 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +7 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +28 -5
- package/es/components/dataSourceComponents/dataSourceTable/index.js +4 -2
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +9 -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 +49 -3
- 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 +4 -4
- 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/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 +15 -4
- 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/filter/index.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +4 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +7 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +24 -3
- package/lib/components/dataSourceComponents/dataSourceTable/index.js +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +9 -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 +49 -3
- 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 +4 -4
- 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/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 +139 -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
|
@@ -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,18 +58,22 @@ 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) => {
|
|
65
66
|
setLoading(true);
|
|
66
67
|
try {
|
|
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
78
|
} finally {
|
|
74
79
|
setLoading(false);
|
|
@@ -110,7 +115,12 @@ var SubmitButton = (props) => {
|
|
|
110
115
|
content: toastConfig.title
|
|
111
116
|
});
|
|
112
117
|
}
|
|
113
|
-
|
|
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
|
+
}
|
|
114
124
|
if (refreshData) {
|
|
115
125
|
refreshTableData == null ? void 0 : refreshTableData();
|
|
116
126
|
}
|
|
@@ -156,7 +166,8 @@ var SubmitButton = (props) => {
|
|
|
156
166
|
size: "large",
|
|
157
167
|
loading,
|
|
158
168
|
onClick: onSubmitClick,
|
|
159
|
-
disabled: isDisabled
|
|
169
|
+
disabled: isDisabled,
|
|
170
|
+
htmlType: "submit"
|
|
160
171
|
},
|
|
161
172
|
childrenString
|
|
162
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,
|
|
@@ -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
|
};
|
|
@@ -81,5 +81,12 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
81
81
|
}[];
|
|
82
82
|
} | undefined;
|
|
83
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;
|
|
84
91
|
};
|
|
85
92
|
export default useTableProps;
|
|
@@ -102,6 +102,11 @@ var useTableProps = (props) => {
|
|
|
102
102
|
return propsSubTitle;
|
|
103
103
|
}, [propsSubTitle]);
|
|
104
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
|
+
}
|
|
105
110
|
registerValueVariable == null ? void 0 : registerValueVariable(componentId, {
|
|
106
111
|
currentRecord: record
|
|
107
112
|
});
|
|
@@ -142,7 +147,7 @@ var useTableProps = (props) => {
|
|
|
142
147
|
type,
|
|
143
148
|
render: (_, record) => {
|
|
144
149
|
return /* @__PURE__ */ import_react.default.createElement(import_antd.Space, null, items == null ? void 0 : items.map((item) => {
|
|
145
|
-
const { label, actionType } = item;
|
|
150
|
+
const { label, actionType, show: show2 } = item;
|
|
146
151
|
const handleClick = () => {
|
|
147
152
|
if (actionType === "delete") {
|
|
148
153
|
import_pisellModal.default.confirm({
|
|
@@ -159,6 +164,16 @@ var useTableProps = (props) => {
|
|
|
159
164
|
handleOpenDrawer(record, item);
|
|
160
165
|
}
|
|
161
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
|
+
}
|
|
162
177
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
163
178
|
import_antd.Button,
|
|
164
179
|
{
|
|
@@ -187,13 +202,19 @@ var useTableProps = (props) => {
|
|
|
187
202
|
return null;
|
|
188
203
|
}
|
|
189
204
|
return (_a2 = titleButtons == null ? void 0 : titleButtons.items) == null ? void 0 : _a2.map((button) => {
|
|
190
|
-
const { actionType, buttonProps } = button;
|
|
205
|
+
const { actionType, buttonProps, beforeOpen } = button;
|
|
191
206
|
return {
|
|
192
207
|
...button,
|
|
193
208
|
...buttonProps,
|
|
194
209
|
onClick: () => {
|
|
195
210
|
if (actionType === "add") {
|
|
196
|
-
|
|
211
|
+
let result = true;
|
|
212
|
+
if (beforeOpen) {
|
|
213
|
+
result = beforeOpen();
|
|
214
|
+
}
|
|
215
|
+
if (result) {
|
|
216
|
+
handleOpenDrawer(null, button);
|
|
217
|
+
}
|
|
197
218
|
}
|
|
198
219
|
}
|
|
199
220
|
};
|
|
@@ -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);
|
|
@@ -67,4 +68,11 @@ export interface DataSourceTableProps {
|
|
|
67
68
|
}[];
|
|
68
69
|
};
|
|
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
|
+
};
|
|
70
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,
|
|
@@ -29,7 +29,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
// src/components/dataSourceComponents/fields/Input.Url/ReadPretty.tsx
|
|
30
30
|
var ReadPretty_exports = {};
|
|
31
31
|
__export(ReadPretty_exports, {
|
|
32
|
-
default: () => ReadPretty_default
|
|
32
|
+
default: () => ReadPretty_default,
|
|
33
|
+
formatUrl: () => formatUrl
|
|
33
34
|
});
|
|
34
35
|
module.exports = __toCommonJS(ReadPretty_exports);
|
|
35
36
|
var import_react = __toESM(require("react"));
|
|
@@ -37,17 +38,31 @@ var import_antd = require("antd");
|
|
|
37
38
|
var import_classnames = __toESM(require("classnames"));
|
|
38
39
|
var import_ReadPretty = require("./ReadPretty.less");
|
|
39
40
|
var { Link } = import_antd.Typography;
|
|
41
|
+
var formatUrl = (url) => {
|
|
42
|
+
if (!url)
|
|
43
|
+
return "";
|
|
44
|
+
if (url.startsWith("http://") || url.startsWith("https://")) {
|
|
45
|
+
return url;
|
|
46
|
+
}
|
|
47
|
+
return `https://${url}`;
|
|
48
|
+
};
|
|
40
49
|
var UrlReadPretty = (props) => {
|
|
41
50
|
const { value, renderMode } = props;
|
|
51
|
+
const formattedUrl = formatUrl(value);
|
|
42
52
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
43
53
|
Link,
|
|
44
54
|
{
|
|
45
55
|
className: (0, import_classnames.default)("pisell-url-read-pretty", {
|
|
46
56
|
"pisell-url-read-pretty-table-view": renderMode === "tableView"
|
|
47
57
|
}),
|
|
48
|
-
href:
|
|
58
|
+
href: formattedUrl,
|
|
59
|
+
target: "_blank"
|
|
49
60
|
},
|
|
50
61
|
value
|
|
51
62
|
);
|
|
52
63
|
};
|
|
53
64
|
var ReadPretty_default = UrlReadPretty;
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
formatUrl
|
|
68
|
+
});
|
|
@@ -34,7 +34,11 @@ __export(Select_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(Select_exports);
|
|
35
35
|
var import_utils = require("../../dataSourceForm/utils");
|
|
36
36
|
var import_WithMode = __toESM(require("./WithMode"));
|
|
37
|
-
var SelectWithFormItem = (0, import_utils.withFormItem)(import_WithMode.default
|
|
37
|
+
var SelectWithFormItem = (0, import_utils.withFormItem)(import_WithMode.default, {
|
|
38
|
+
innerProps: {
|
|
39
|
+
getPopupContainer: (triggerNode) => triggerNode.parentElement
|
|
40
|
+
}
|
|
41
|
+
});
|
|
38
42
|
var SelectWithOptions = (0, import_utils.withOptions)(SelectWithFormItem);
|
|
39
43
|
var SelectWithDataSource = (0, import_utils.withDataSource)(SelectWithOptions);
|
|
40
44
|
var Select_default = SelectWithDataSource;
|
|
@@ -8,7 +8,10 @@ export interface MediaType {
|
|
|
8
8
|
maxsize: number;
|
|
9
9
|
}
|
|
10
10
|
export declare const useMediaConfig: () => {
|
|
11
|
-
data:
|
|
11
|
+
data: {
|
|
12
|
+
upload_onetime_limit: any;
|
|
13
|
+
upload_maxsize: any;
|
|
14
|
+
};
|
|
12
15
|
};
|
|
13
16
|
export declare const useMediaTypes: () => {
|
|
14
17
|
data: MediaType[];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
|
|
19
29
|
// src/components/dataSourceComponents/fields/Upload/serve.ts
|
|
@@ -27,6 +37,7 @@ module.exports = __toCommonJS(serve_exports);
|
|
|
27
37
|
var import_ahooks = require("ahooks");
|
|
28
38
|
var import_utils = require("./utils");
|
|
29
39
|
var import_utils2 = require("../../../table/utils");
|
|
40
|
+
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
|
|
30
41
|
var getMediaTypeList = async () => {
|
|
31
42
|
const { data } = await import_utils2.request.getRequest().get(
|
|
32
43
|
`/media_type:list`,
|
|
@@ -41,19 +52,16 @@ var getMediaTypeList = async () => {
|
|
|
41
52
|
);
|
|
42
53
|
return data;
|
|
43
54
|
};
|
|
44
|
-
var getMediaConfig = async () => {
|
|
45
|
-
const data = await import_utils2.request.getRequest().get(`/core/module/media/config`, {});
|
|
46
|
-
return data;
|
|
47
|
-
};
|
|
48
55
|
var useMediaConfig = () => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
57
|
+
const context = (0, import_useEngineContext.default)();
|
|
58
|
+
const data = (_h = (_g = (_f = (_e = (_d = (_c = (_b = (_a = context.appHelper.utils) == null ? void 0 : _a.getApp) == null ? void 0 : _b.call(_a)) == null ? void 0 : _c.data) == null ? void 0 : _d.store) == null ? void 0 : _e.getStore) == null ? void 0 : _f.call(_e)) == null ? void 0 : _g.getDataByModel) == null ? void 0 : _h.call(_g, "core", "core");
|
|
59
|
+
return {
|
|
60
|
+
data: {
|
|
61
|
+
upload_onetime_limit: data == null ? void 0 : data.media_upload_onetime_limit,
|
|
62
|
+
upload_maxsize: data == null ? void 0 : data.media_upload_maxsize
|
|
63
|
+
}
|
|
64
|
+
};
|
|
57
65
|
};
|
|
58
66
|
var useMediaTypes = () => {
|
|
59
67
|
const { data } = (0, import_ahooks.useRequest)(getMediaTypeList, {
|
|
@@ -3,8 +3,9 @@ export interface UseActionsParams {
|
|
|
3
3
|
dataSource?: DataSourceType;
|
|
4
4
|
currentValue?: 'server' | 'local';
|
|
5
5
|
__designMode?: string;
|
|
6
|
+
extraParams?: Record<string, any>;
|
|
6
7
|
}
|
|
7
|
-
declare const useActions: ({ dataSource: propsDataSource, currentValue: propsCurrentValue, __designMode, }?: UseActionsParams) => {
|
|
8
|
+
declare const useActions: ({ dataSource: propsDataSource, currentValue: propsCurrentValue, __designMode, extraParams: propsExtraParams, }?: UseActionsParams) => {
|
|
8
9
|
create: (values: Record<string, any>) => Promise<any>;
|
|
9
10
|
get: () => Promise<any>;
|
|
10
11
|
update: (values: Record<string, any>) => Promise<any>;
|
|
@@ -44,7 +44,8 @@ var import_locales = require("../../../locales");
|
|
|
44
44
|
var useActions = ({
|
|
45
45
|
dataSource: propsDataSource,
|
|
46
46
|
currentValue: propsCurrentValue,
|
|
47
|
-
__designMode
|
|
47
|
+
__designMode,
|
|
48
|
+
extraParams: propsExtraParams
|
|
48
49
|
} = {}) => {
|
|
49
50
|
const { dataSource: ctxDataSource, __designMode: ctxDesignMode } = (0, import_useDataSource.default)();
|
|
50
51
|
const { parseVariable } = (0, import_useVariables.default)();
|
|
@@ -68,6 +69,15 @@ var useActions = ({
|
|
|
68
69
|
const currentRecord = (0, import_react.useMemo)(() => {
|
|
69
70
|
return parseVariable == null ? void 0 : parseVariable(currentValue, {});
|
|
70
71
|
}, [currentValue, parseVariable]);
|
|
72
|
+
const extraParams = (0, import_react.useMemo)(() => {
|
|
73
|
+
return Object.entries(propsExtraParams || {}).reduce((acc, [key, value]) => {
|
|
74
|
+
acc[key] = Object.entries(value || {}).reduce((acc2, [k, v]) => {
|
|
75
|
+
acc2[k] = parseVariable == null ? void 0 : parseVariable(v, {});
|
|
76
|
+
return acc2;
|
|
77
|
+
}, {});
|
|
78
|
+
return acc;
|
|
79
|
+
}, {});
|
|
80
|
+
}, [propsExtraParams, parseVariable]);
|
|
71
81
|
const getParsedActions = (0, import_ahooks.useMemoizedFn)(() => {
|
|
72
82
|
return parseActions(originalActions, { currentRecord });
|
|
73
83
|
});
|
|
@@ -88,7 +98,7 @@ var useActions = ({
|
|
|
88
98
|
headers,
|
|
89
99
|
body
|
|
90
100
|
});
|
|
91
|
-
if (
|
|
101
|
+
if (["pisell2-api", "mypisell-api"].includes(dataSourceKey)) {
|
|
92
102
|
return result.data;
|
|
93
103
|
}
|
|
94
104
|
return result;
|
|
@@ -132,7 +142,12 @@ var useActions = ({
|
|
|
132
142
|
const getApi = genCustomApi(actions == null ? void 0 : actions.get);
|
|
133
143
|
return getApi({});
|
|
134
144
|
}
|
|
135
|
-
|
|
145
|
+
const res = await (0, import_serve.getNocobaseData)({
|
|
146
|
+
key: name || "",
|
|
147
|
+
query: extraParams == null ? void 0 : extraParams.get,
|
|
148
|
+
headers: getHeaders()
|
|
149
|
+
});
|
|
150
|
+
return (res == null ? void 0 : res.data) || {};
|
|
136
151
|
} else if (currentValue) {
|
|
137
152
|
return parseVariable == null ? void 0 : parseVariable(currentValue, {});
|
|
138
153
|
}
|
|
@@ -151,7 +166,7 @@ var useActions = ({
|
|
|
151
166
|
const updateApi = genCustomApi(actions == null ? void 0 : actions.update);
|
|
152
167
|
return updateApi(formatCreateUpdateParams(values));
|
|
153
168
|
} else {
|
|
154
|
-
const id = values == null ? void 0 : values.id;
|
|
169
|
+
const id = (extraParams == null ? void 0 : extraParams.filterByTk) || (values == null ? void 0 : values.id);
|
|
155
170
|
if (!id || !name) {
|
|
156
171
|
(0, import_pisellToast.default)({
|
|
157
172
|
content: (0, import_locales.getText)("pisell-action-get-data")
|
|
@@ -160,9 +175,9 @@ var useActions = ({
|
|
|
160
175
|
}
|
|
161
176
|
return (0, import_serve.updateNocobaseData)({
|
|
162
177
|
key: name,
|
|
163
|
-
id,
|
|
164
178
|
data: formatCreateUpdateParams(values),
|
|
165
|
-
headers: getHeaders()
|
|
179
|
+
headers: getHeaders(),
|
|
180
|
+
query: { filterByTk: id, ...extraParams == null ? void 0 : extraParams.update }
|
|
166
181
|
});
|
|
167
182
|
}
|
|
168
183
|
});
|
|
@@ -182,7 +197,10 @@ var useActions = ({
|
|
|
182
197
|
return formatListResult(
|
|
183
198
|
await (0, import_serve.getNocobaseDataList)({
|
|
184
199
|
key: name,
|
|
185
|
-
params:
|
|
200
|
+
params: {
|
|
201
|
+
...formatParams,
|
|
202
|
+
...(extraParams == null ? void 0 : extraParams.list) || {}
|
|
203
|
+
},
|
|
186
204
|
headers: getHeaders()
|
|
187
205
|
})
|
|
188
206
|
);
|