@pisell/materials 6.0.6 → 6.0.8
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/pisellViewGrid/index.d.ts +16 -0
- package/es/components/pisellViewGrid/index.js +66 -0
- package/es/components/pisellViewGrid/index.less +31 -0
- 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 +7 -0
- package/es/index.js +8 -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/pisellViewGrid/index.d.ts +16 -0
- package/lib/components/pisellViewGrid/index.js +98 -0
- package/lib/components/pisellViewGrid/index.less +31 -0
- 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 +7 -0
- package/lib/index.js +21 -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/pisell-view-grid/__screenshots__/card-1.png +0 -0
- package/lowcode/pisell-view-grid/meta.ts +167 -0
- package/lowcode/pisell-view-grid/snippets.ts +54 -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 +1 -1
|
@@ -7,7 +7,7 @@ import { ConfigProvider as OriginalConfigProvider } from "antd";
|
|
|
7
7
|
// 由于 antd 组件的默认文案是英文,所以需要修改为中文
|
|
8
8
|
import dayjs from "dayjs";
|
|
9
9
|
import "dayjs/locale/zh-cn";
|
|
10
|
-
import zhCN from "antd/locale/zh_CN";
|
|
10
|
+
import zhCN from "antd/es/locale/zh_CN";
|
|
11
11
|
var ConfigProvider = function ConfigProvider(props) {
|
|
12
12
|
var locale = props.locale,
|
|
13
13
|
rest = _objectWithoutProperties(props, _excluded);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["title", "description", "dataSource", "showTitle", "showDescription", "groupInfoPosition", "variables", "renderMode", "children", "currentValue", "className"];
|
|
1
|
+
var _excluded = ["title", "description", "dataSource", "showTitle", "showDescription", "groupInfoPosition", "variables", "renderMode", "children", "currentValue", "className", "onDataSourceFinish", "formatSubmitValues", "formatInitialValues", "customSubmit"];
|
|
2
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
3
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -7,6 +7,7 @@ import classNames from 'classnames';
|
|
|
7
7
|
import useDataSource from "../hooks/useDataSource";
|
|
8
8
|
import Form from "../../form";
|
|
9
9
|
import FormSettingProvider from "./provider/formSetting/FormSettingProvider";
|
|
10
|
+
import PageHeader from "../../page-header";
|
|
10
11
|
import "./index.less";
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -25,6 +26,10 @@ var BaseForm = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
25
26
|
children = props.children,
|
|
26
27
|
currentValue = props.currentValue,
|
|
27
28
|
className = props.className,
|
|
29
|
+
onDataSourceFinish = props.onDataSourceFinish,
|
|
30
|
+
formatSubmitValues = props.formatSubmitValues,
|
|
31
|
+
formatInitialValues = props.formatInitialValues,
|
|
32
|
+
customSubmit = props.customSubmit,
|
|
28
33
|
others = _objectWithoutProperties(props, _excluded);
|
|
29
34
|
var formRef = useRef(null);
|
|
30
35
|
var _useDataSource = useDataSource(),
|
|
@@ -43,25 +48,29 @@ var BaseForm = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
43
48
|
if (['edit', 'view'].includes(renderMode || '') && dataSource) {
|
|
44
49
|
get === null || get === void 0 ? void 0 : get.runAsync().then(function (res) {
|
|
45
50
|
var _formRef$current2;
|
|
46
|
-
|
|
51
|
+
var formattedValues = formatInitialValues ? formatInitialValues(res) : res;
|
|
52
|
+
(_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.setFieldsValue(formattedValues);
|
|
47
53
|
});
|
|
48
54
|
}
|
|
49
|
-
}, [renderMode, dataSource]);
|
|
55
|
+
}, [renderMode, dataSource, formatInitialValues]);
|
|
50
56
|
return /*#__PURE__*/React.createElement(FormSettingProvider, {
|
|
51
57
|
renderMode: renderMode,
|
|
52
58
|
groupInfoPosition: groupInfoPosition,
|
|
53
59
|
currentValue: currentValue,
|
|
54
|
-
size: others.size
|
|
60
|
+
size: others.size,
|
|
61
|
+
onDataSourceFinish: onDataSourceFinish,
|
|
62
|
+
formatSubmitValues: formatSubmitValues,
|
|
63
|
+
formatInitialValues: formatInitialValues,
|
|
64
|
+
customSubmit: customSubmit
|
|
55
65
|
}, /*#__PURE__*/React.createElement(Form, _extends({}, others, {
|
|
56
66
|
className: classNames('pisell-lowcode-data-source-form', className),
|
|
57
67
|
ref: formRef,
|
|
58
68
|
preserve: true
|
|
59
|
-
}),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}, description)), children));
|
|
69
|
+
}), /*#__PURE__*/React.createElement(PageHeader, {
|
|
70
|
+
title: title,
|
|
71
|
+
showTitle: showTitle,
|
|
72
|
+
subTitle: description,
|
|
73
|
+
showSubTitle: showDescription
|
|
74
|
+
}), children));
|
|
66
75
|
});
|
|
67
76
|
export default BaseForm;
|
|
@@ -29,7 +29,7 @@ var FormItem = function FormItem(props) {
|
|
|
29
29
|
dataSource = _useDataSource.dataSource;
|
|
30
30
|
var fields = dataSource === null || dataSource === void 0 ? void 0 : dataSource.fields;
|
|
31
31
|
var _useFormSetting = useFormSetting(),
|
|
32
|
-
globalMode = _useFormSetting.
|
|
32
|
+
globalMode = _useFormSetting.renderMode;
|
|
33
33
|
var field = fields === null || fields === void 0 ? void 0 : fields.find(function (item) {
|
|
34
34
|
return item.name === name;
|
|
35
35
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.pisell-lowcode-data-source-form-group {
|
|
2
2
|
display: flex;
|
|
3
|
-
padding: 20px;
|
|
3
|
+
padding: 20px 20px 0;
|
|
4
4
|
border-radius: 8px;
|
|
5
5
|
border: 1px solid var(--Gray-300, #d0d5dd);
|
|
6
6
|
margin-bottom: 24px;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
.pisell-lowcode-data-source-form-group-content {
|
|
27
27
|
border: 1px solid var(--Gray-300, #d0d5dd);
|
|
28
28
|
border-radius: 8px;
|
|
29
|
-
padding: 20px;
|
|
29
|
+
padding: 20px 20px 0;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
&-info {
|
|
@@ -12,11 +12,13 @@ import "./index.less";
|
|
|
12
12
|
var DataSourceForm = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
13
13
|
var dataSource = props.dataSource,
|
|
14
14
|
currentValue = props.currentValue,
|
|
15
|
-
__designMode = props.__designMode
|
|
15
|
+
__designMode = props.__designMode,
|
|
16
|
+
extraParams = props.extraParams;
|
|
16
17
|
return /*#__PURE__*/React.createElement(DataSourceProvider, {
|
|
17
18
|
dataSource: dataSource,
|
|
18
19
|
currentValue: currentValue,
|
|
19
|
-
__designMode: __designMode
|
|
20
|
+
__designMode: __designMode,
|
|
21
|
+
extraParams: extraParams
|
|
20
22
|
}, /*#__PURE__*/React.createElement(BaseForm, _extends({}, props, {
|
|
21
23
|
ref: ref
|
|
22
24
|
})));
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ModeType } from '../../type';
|
|
3
3
|
export interface FormSettingContextType {
|
|
4
|
+
onDataSourceFinish?: (values: any, result: any) => void;
|
|
4
5
|
renderMode?: ModeType;
|
|
5
6
|
groupInfoPosition?: 'top' | 'side';
|
|
6
7
|
children?: React.ReactNode;
|
|
7
8
|
currentValue?: 'server' | 'local';
|
|
8
9
|
size?: 'small' | 'middle' | 'large';
|
|
10
|
+
formatSubmitValues?: (values: Record<string, any>) => Record<string, any>;
|
|
11
|
+
formatInitialValues?: (values: Record<string, any>) => Record<string, any>;
|
|
12
|
+
customSubmit?: (values: Record<string, any>) => Promise<any>;
|
|
9
13
|
}
|
|
10
14
|
export declare const FormSettingContext: import("react").Context<FormSettingContextType>;
|
|
11
15
|
export default FormSettingContext;
|
|
@@ -10,15 +10,23 @@ var FormSettingProvider = function FormSettingProvider(props) {
|
|
|
10
10
|
renderMode = props.renderMode,
|
|
11
11
|
groupInfoPosition = props.groupInfoPosition,
|
|
12
12
|
currentValue = props.currentValue,
|
|
13
|
-
size = props.size
|
|
13
|
+
size = props.size,
|
|
14
|
+
onDataSourceFinish = props.onDataSourceFinish,
|
|
15
|
+
formatSubmitValues = props.formatSubmitValues,
|
|
16
|
+
formatInitialValues = props.formatInitialValues,
|
|
17
|
+
customSubmit = props.customSubmit;
|
|
14
18
|
var value = React.useMemo(function () {
|
|
15
19
|
return {
|
|
16
20
|
renderMode: renderMode,
|
|
17
21
|
groupInfoPosition: groupInfoPosition,
|
|
18
22
|
currentValue: currentValue,
|
|
19
|
-
size: size
|
|
23
|
+
size: size,
|
|
24
|
+
onDataSourceFinish: onDataSourceFinish,
|
|
25
|
+
formatSubmitValues: formatSubmitValues,
|
|
26
|
+
formatInitialValues: formatInitialValues,
|
|
27
|
+
customSubmit: customSubmit
|
|
20
28
|
};
|
|
21
|
-
}, [renderMode, groupInfoPosition, currentValue, size]);
|
|
29
|
+
}, [renderMode, groupInfoPosition, currentValue, size, onDataSourceFinish, formatSubmitValues, formatInitialValues, customSubmit]);
|
|
22
30
|
return /*#__PURE__*/React.createElement(FormSettingContext.Provider, {
|
|
23
31
|
value: value
|
|
24
32
|
}, children);
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
7
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
8
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
9
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -11,7 +17,8 @@ import JsonWrapperContext from "./JsonWrapperContext";
|
|
|
11
17
|
var JsonWrapperProvider = function JsonWrapperProvider(props) {
|
|
12
18
|
var children = props.children,
|
|
13
19
|
prefix = props.prefix,
|
|
14
|
-
label = props.label
|
|
20
|
+
label = props.label,
|
|
21
|
+
style = props.style;
|
|
15
22
|
var _ref = useContext(JsonWrapperContext) || {},
|
|
16
23
|
_ref$path = _ref.path,
|
|
17
24
|
prefixPath = _ref$path === void 0 ? [] : _ref$path,
|
|
@@ -30,9 +37,9 @@ var JsonWrapperProvider = function JsonWrapperProvider(props) {
|
|
|
30
37
|
value: contextValue
|
|
31
38
|
}, /*#__PURE__*/React.createElement(FormItem, {
|
|
32
39
|
label: label,
|
|
33
|
-
style: {
|
|
40
|
+
style: _objectSpread(_objectSpread({}, style || {}), {}, {
|
|
34
41
|
paddingLeft: "".concat(level * 12, "px")
|
|
35
|
-
}
|
|
42
|
+
})
|
|
36
43
|
}, /*#__PURE__*/React.createElement("div", {
|
|
37
44
|
style: {
|
|
38
45
|
paddingLeft: "".concat(level * 12, "px")
|
|
@@ -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数据列表
|
|
@@ -4,6 +4,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
6
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
13
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
8
14
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
15
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -98,19 +104,29 @@ export var createNocobaseData = /*#__PURE__*/function () {
|
|
|
98
104
|
return _ref4.apply(this, arguments);
|
|
99
105
|
};
|
|
100
106
|
}();
|
|
107
|
+
var formatQueryObjString = function formatQueryObjString() {
|
|
108
|
+
var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
109
|
+
return Object.entries(query || {}).map(function (_ref5) {
|
|
110
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
111
|
+
key = _ref6[0],
|
|
112
|
+
value = _ref6[1];
|
|
113
|
+
return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value));
|
|
114
|
+
}).join('&');
|
|
115
|
+
};
|
|
101
116
|
|
|
102
117
|
/**
|
|
103
118
|
* nocobase get数据
|
|
104
119
|
*/
|
|
105
120
|
export var getNocobaseData = /*#__PURE__*/function () {
|
|
106
|
-
var
|
|
107
|
-
var key,
|
|
121
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
|
|
122
|
+
var key, query, headers;
|
|
108
123
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
109
124
|
while (1) switch (_context5.prev = _context5.next) {
|
|
110
125
|
case 0:
|
|
111
|
-
key = params.key,
|
|
112
|
-
return _context5.abrupt("return", request.getRequest().get("/".concat(key, ":get?
|
|
113
|
-
isNocobase: true
|
|
126
|
+
key = params.key, query = params.query, headers = params.headers;
|
|
127
|
+
return _context5.abrupt("return", request.getRequest().get("/".concat(key, ":get?").concat(formatQueryObjString(query)), {}, {
|
|
128
|
+
isNocobase: true,
|
|
129
|
+
headers: headers
|
|
114
130
|
}));
|
|
115
131
|
case 2:
|
|
116
132
|
case "end":
|
|
@@ -119,7 +135,7 @@ export var getNocobaseData = /*#__PURE__*/function () {
|
|
|
119
135
|
}, _callee5);
|
|
120
136
|
}));
|
|
121
137
|
return function getNocobaseData(_x2) {
|
|
122
|
-
return
|
|
138
|
+
return _ref7.apply(this, arguments);
|
|
123
139
|
};
|
|
124
140
|
}();
|
|
125
141
|
|
|
@@ -138,9 +154,9 @@ var formatHeaders = function formatHeaders(headers) {
|
|
|
138
154
|
};
|
|
139
155
|
var formatQueryString = function formatQueryString() {
|
|
140
156
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
141
|
-
return params.map(function (
|
|
142
|
-
var name =
|
|
143
|
-
value =
|
|
157
|
+
return params.map(function (_ref8) {
|
|
158
|
+
var name = _ref8.name,
|
|
159
|
+
value = _ref8.value;
|
|
144
160
|
return "".concat(encodeURIComponent(name), "=").concat(encodeURIComponent(value));
|
|
145
161
|
}).join('&');
|
|
146
162
|
};
|
|
@@ -153,7 +169,7 @@ var formatRequestUrl = function formatRequestUrl(url, baseUrl, queryString) {
|
|
|
153
169
|
* 自定义api接口
|
|
154
170
|
*/
|
|
155
171
|
export var customApi = /*#__PURE__*/function () {
|
|
156
|
-
var
|
|
172
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(url, data, options) {
|
|
157
173
|
var method, baseUrl, _options$headers, headers, _options$params, params, _options$body, body, requestHeaders, queryString, requestUrl, requestData, requestMethod;
|
|
158
174
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
159
175
|
while (1) switch (_context6.prev = _context6.next) {
|
|
@@ -175,7 +191,7 @@ export var customApi = /*#__PURE__*/function () {
|
|
|
175
191
|
}, _callee6);
|
|
176
192
|
}));
|
|
177
193
|
return function customApi(_x3, _x4, _x5) {
|
|
178
|
-
return
|
|
194
|
+
return _ref9.apply(this, arguments);
|
|
179
195
|
};
|
|
180
196
|
}();
|
|
181
197
|
|
|
@@ -183,13 +199,13 @@ export var customApi = /*#__PURE__*/function () {
|
|
|
183
199
|
* 更新nocobase数据
|
|
184
200
|
*/
|
|
185
201
|
export var updateNocobaseData = /*#__PURE__*/function () {
|
|
186
|
-
var
|
|
187
|
-
var key,
|
|
202
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
|
|
203
|
+
var key, data, headers, query;
|
|
188
204
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
189
205
|
while (1) switch (_context7.prev = _context7.next) {
|
|
190
206
|
case 0:
|
|
191
|
-
key = params.key,
|
|
192
|
-
return _context7.abrupt("return", request.getRequest().post("/".concat(key, ":update?
|
|
207
|
+
key = params.key, data = params.data, headers = params.headers, query = params.query;
|
|
208
|
+
return _context7.abrupt("return", request.getRequest().post("/".concat(key, ":update?").concat(formatQueryObjString(query)), data, {
|
|
193
209
|
isNocobase: true,
|
|
194
210
|
headers: headers
|
|
195
211
|
}));
|
|
@@ -200,7 +216,7 @@ export var updateNocobaseData = /*#__PURE__*/function () {
|
|
|
200
216
|
}, _callee7);
|
|
201
217
|
}));
|
|
202
218
|
return function updateNocobaseData(_x6) {
|
|
203
|
-
return
|
|
219
|
+
return _ref10.apply(this, arguments);
|
|
204
220
|
};
|
|
205
221
|
}();
|
|
206
222
|
|
|
@@ -208,7 +224,7 @@ export var updateNocobaseData = /*#__PURE__*/function () {
|
|
|
208
224
|
* 获取nocobase数据列表
|
|
209
225
|
*/
|
|
210
226
|
export var getNocobaseDataList = /*#__PURE__*/function () {
|
|
211
|
-
var
|
|
227
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(allParams) {
|
|
212
228
|
var key, params, headers;
|
|
213
229
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
214
230
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -226,7 +242,7 @@ export var getNocobaseDataList = /*#__PURE__*/function () {
|
|
|
226
242
|
}, _callee8);
|
|
227
243
|
}));
|
|
228
244
|
return function getNocobaseDataList(_x7) {
|
|
229
|
-
return
|
|
245
|
+
return _ref11.apply(this, arguments);
|
|
230
246
|
};
|
|
231
247
|
}();
|
|
232
248
|
|
|
@@ -234,7 +250,7 @@ export var getNocobaseDataList = /*#__PURE__*/function () {
|
|
|
234
250
|
* 删除nocobase数据
|
|
235
251
|
*/
|
|
236
252
|
export var deleteNocobaseData = /*#__PURE__*/function () {
|
|
237
|
-
var
|
|
253
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key, id, headers) {
|
|
238
254
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
239
255
|
while (1) switch (_context9.prev = _context9.next) {
|
|
240
256
|
case 0:
|
|
@@ -249,6 +265,6 @@ export var deleteNocobaseData = /*#__PURE__*/function () {
|
|
|
249
265
|
}, _callee9);
|
|
250
266
|
}));
|
|
251
267
|
return function deleteNocobaseData(_x8, _x9, _x10) {
|
|
252
|
-
return
|
|
268
|
+
return _ref12.apply(this, arguments);
|
|
253
269
|
};
|
|
254
270
|
}();
|
|
@@ -16,6 +16,7 @@ import FormItem from "../formItem";
|
|
|
16
16
|
import useFormSetting from "../provider/hooks/useFormSetting";
|
|
17
17
|
import useCtxActions from "../../hooks/useCtxActions";
|
|
18
18
|
import useDataSource from "../../hooks/useDataSource";
|
|
19
|
+
import { filterSystemFields } from "../utils";
|
|
19
20
|
import "./index.less";
|
|
20
21
|
// 表单提交按钮
|
|
21
22
|
var SubmitButton = function SubmitButton(props) {
|
|
@@ -39,7 +40,10 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
39
40
|
contextHolder = _notification$useNoti2[1];
|
|
40
41
|
var form = Form.useFormInstance();
|
|
41
42
|
var _useFormSetting = useFormSetting(),
|
|
42
|
-
renderMode = _useFormSetting.renderMode
|
|
43
|
+
renderMode = _useFormSetting.renderMode,
|
|
44
|
+
onDataSourceFinish = _useFormSetting.onDataSourceFinish,
|
|
45
|
+
formatSubmitValues = _useFormSetting.formatSubmitValues,
|
|
46
|
+
customSubmit = _useFormSetting.customSubmit;
|
|
43
47
|
var _useCtxActions = useCtxActions(),
|
|
44
48
|
setVisible = _useCtxActions.setVisible,
|
|
45
49
|
refreshTableData = _useCtxActions.refreshTableData;
|
|
@@ -55,34 +59,43 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
55
59
|
case 0:
|
|
56
60
|
setLoading(true);
|
|
57
61
|
_context.prev = 1;
|
|
58
|
-
if (!
|
|
59
|
-
_context.next =
|
|
62
|
+
if (!customSubmit) {
|
|
63
|
+
_context.next = 6;
|
|
60
64
|
break;
|
|
61
65
|
}
|
|
62
66
|
_context.next = 5;
|
|
63
|
-
return
|
|
67
|
+
return customSubmit(values);
|
|
64
68
|
case 5:
|
|
65
|
-
_context.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (!(renderMode === 'add')) {
|
|
69
|
+
return _context.abrupt("return", _context.sent);
|
|
70
|
+
case 6:
|
|
71
|
+
if (!(renderMode === 'edit')) {
|
|
69
72
|
_context.next = 12;
|
|
70
73
|
break;
|
|
71
74
|
}
|
|
72
|
-
_context.next =
|
|
75
|
+
_context.next = 9;
|
|
76
|
+
return update.runAsync(values);
|
|
77
|
+
case 9:
|
|
78
|
+
return _context.abrupt("return", _context.sent);
|
|
79
|
+
case 12:
|
|
80
|
+
if (!(renderMode === 'add')) {
|
|
81
|
+
_context.next = 18;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
_context.next = 15;
|
|
73
85
|
return create.runAsync(values);
|
|
74
|
-
case
|
|
86
|
+
case 15:
|
|
75
87
|
res = _context.sent;
|
|
76
88
|
form === null || form === void 0 ? void 0 : form.resetFields();
|
|
77
|
-
|
|
78
|
-
|
|
89
|
+
return _context.abrupt("return", res);
|
|
90
|
+
case 18:
|
|
91
|
+
_context.prev = 18;
|
|
79
92
|
setLoading(false);
|
|
80
|
-
return _context.finish(
|
|
81
|
-
case
|
|
93
|
+
return _context.finish(18);
|
|
94
|
+
case 21:
|
|
82
95
|
case "end":
|
|
83
96
|
return _context.stop();
|
|
84
97
|
}
|
|
85
|
-
}, _callee, null, [[1,,
|
|
98
|
+
}, _callee, null, [[1,, 18, 21]]);
|
|
86
99
|
}));
|
|
87
100
|
return function onSubmit(_x2) {
|
|
88
101
|
return _ref.apply(this, arguments);
|
|
@@ -116,7 +129,7 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
116
129
|
// 验证表单并提交
|
|
117
130
|
var handleValideFieldsSubmit = /*#__PURE__*/function () {
|
|
118
131
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(values) {
|
|
119
|
-
var allValues, afterSubmitFunc;
|
|
132
|
+
var allValues, filteredValues, formattedValues, result, afterSubmitFunc;
|
|
120
133
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
121
134
|
while (1) switch (_context2.prev = _context2.next) {
|
|
122
135
|
case 0:
|
|
@@ -134,9 +147,16 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
134
147
|
content: toastConfig.title
|
|
135
148
|
});
|
|
136
149
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
150
|
+
filteredValues = filterSystemFields(allValues); // 格式化提交数据
|
|
151
|
+
formattedValues = formatSubmitValues ? formatSubmitValues(filteredValues) : filteredValues;
|
|
152
|
+
_context2.next = 10;
|
|
153
|
+
return onSubmit(formattedValues);
|
|
154
|
+
case 10:
|
|
155
|
+
result = _context2.sent;
|
|
156
|
+
// 数据源提交成功
|
|
157
|
+
if (onDataSourceFinish) {
|
|
158
|
+
onDataSourceFinish(formattedValues, result);
|
|
159
|
+
}
|
|
140
160
|
if (refreshData) {
|
|
141
161
|
refreshTableData === null || refreshTableData === void 0 ? void 0 : refreshTableData();
|
|
142
162
|
}
|
|
@@ -151,19 +171,19 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
151
171
|
afterSubmitFunc();
|
|
152
172
|
}
|
|
153
173
|
}
|
|
154
|
-
_context2.next =
|
|
174
|
+
_context2.next = 20;
|
|
155
175
|
break;
|
|
156
|
-
case
|
|
157
|
-
_context2.prev =
|
|
176
|
+
case 17:
|
|
177
|
+
_context2.prev = 17;
|
|
158
178
|
_context2.t0 = _context2["catch"](0);
|
|
159
179
|
PisellToast({
|
|
160
180
|
content: "".concat(_context2.t0.message)
|
|
161
181
|
});
|
|
162
|
-
case
|
|
182
|
+
case 20:
|
|
163
183
|
case "end":
|
|
164
184
|
return _context2.stop();
|
|
165
185
|
}
|
|
166
|
-
}, _callee2, null, [[0,
|
|
186
|
+
}, _callee2, null, [[0, 17]]);
|
|
167
187
|
}));
|
|
168
188
|
return function handleValideFieldsSubmit(_x3) {
|
|
169
189
|
return _ref2.apply(this, arguments);
|
|
@@ -216,7 +236,8 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
216
236
|
size: "large",
|
|
217
237
|
loading: loading,
|
|
218
238
|
onClick: onSubmitClick,
|
|
219
|
-
disabled: isDisabled
|
|
239
|
+
disabled: isDisabled,
|
|
240
|
+
htmlType: "submit"
|
|
220
241
|
}, childrenString), contextHolder));
|
|
221
242
|
};
|
|
222
243
|
export default SubmitButton;
|
|
@@ -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>;
|