@pisell/materials 1.0.539 → 1.0.541
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/meta.js +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +23 -13
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +4 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +3 -3
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +5 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +4 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +1 -1
- package/lowcode/submit-button/meta.ts +6 -0
- package/package.json +1 -1
|
@@ -33,6 +33,7 @@ export interface SubmitButtonProps extends ButtonProps {
|
|
|
33
33
|
duration: number;
|
|
34
34
|
placement: 'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight';
|
|
35
35
|
};
|
|
36
|
+
customSubmit?: (values: Record<string, any>) => void;
|
|
36
37
|
}
|
|
37
38
|
declare const SubmitButton: (props: SubmitButtonProps) => React.JSX.Element | null;
|
|
38
39
|
export default SubmitButton;
|
|
@@ -29,7 +29,8 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
29
29
|
afterSubmitType = props.afterSubmitType,
|
|
30
30
|
afterSubmitModalConfig = props.afterSubmitModalConfig,
|
|
31
31
|
afterSubmitNotificationConfig = props.afterSubmitNotificationConfig,
|
|
32
|
-
childrenString = props.childrenString
|
|
32
|
+
childrenString = props.childrenString,
|
|
33
|
+
customSubmit = props.customSubmit;
|
|
33
34
|
var _useState = useState(false),
|
|
34
35
|
_useState2 = _slicedToArray(_useState, 2),
|
|
35
36
|
loading = _useState2[0],
|
|
@@ -57,34 +58,43 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
57
58
|
case 0:
|
|
58
59
|
setLoading(true);
|
|
59
60
|
_context.prev = 1;
|
|
60
|
-
if (!
|
|
61
|
-
_context.next =
|
|
61
|
+
if (!customSubmit) {
|
|
62
|
+
_context.next = 6;
|
|
62
63
|
break;
|
|
63
64
|
}
|
|
64
65
|
_context.next = 5;
|
|
65
|
-
return
|
|
66
|
+
return customSubmit(values);
|
|
66
67
|
case 5:
|
|
67
68
|
return _context.abrupt("return", _context.sent);
|
|
68
|
-
case
|
|
69
|
+
case 6:
|
|
70
|
+
if (!(renderMode === 'edit')) {
|
|
71
|
+
_context.next = 12;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
_context.next = 9;
|
|
75
|
+
return update.runAsync(values);
|
|
76
|
+
case 9:
|
|
77
|
+
return _context.abrupt("return", _context.sent);
|
|
78
|
+
case 12:
|
|
69
79
|
if (!(renderMode === 'add')) {
|
|
70
|
-
_context.next =
|
|
80
|
+
_context.next = 18;
|
|
71
81
|
break;
|
|
72
82
|
}
|
|
73
|
-
_context.next =
|
|
83
|
+
_context.next = 15;
|
|
74
84
|
return create.runAsync(values);
|
|
75
|
-
case
|
|
85
|
+
case 15:
|
|
76
86
|
res = _context.sent;
|
|
77
87
|
form === null || form === void 0 ? void 0 : form.resetFields();
|
|
78
88
|
return _context.abrupt("return", res);
|
|
79
|
-
case
|
|
80
|
-
_context.prev =
|
|
89
|
+
case 18:
|
|
90
|
+
_context.prev = 18;
|
|
81
91
|
setLoading(false);
|
|
82
|
-
return _context.finish(
|
|
83
|
-
case
|
|
92
|
+
return _context.finish(18);
|
|
93
|
+
case 21:
|
|
84
94
|
case "end":
|
|
85
95
|
return _context.stop();
|
|
86
96
|
}
|
|
87
|
-
}, _callee, null, [[1,,
|
|
97
|
+
}, _callee, null, [[1,, 18, 21]]);
|
|
88
98
|
}));
|
|
89
99
|
return function onSubmit(_x2) {
|
|
90
100
|
return _ref.apply(this, arguments);
|
|
@@ -46,7 +46,10 @@ var useColumns = function useColumns(_ref) {
|
|
|
46
46
|
var fieldProps = genFieldProps(field, (_other = column.other) === null || _other === void 0 ? void 0 : _other.fieldProps);
|
|
47
47
|
return _objectSpread(_objectSpread({}, column), {}, {
|
|
48
48
|
title: title,
|
|
49
|
-
render: function render(text) {
|
|
49
|
+
render: function render(text, record, index) {
|
|
50
|
+
if (column !== null && column !== void 0 && column.render) {
|
|
51
|
+
return column.render(text, record, index);
|
|
52
|
+
}
|
|
50
53
|
return /*#__PURE__*/React.createElement(FieldComponent, _extends({}, fieldProps, {
|
|
51
54
|
value: text
|
|
52
55
|
}));
|
|
@@ -94,9 +94,9 @@ var useTableProps = function useTableProps(props) {
|
|
|
94
94
|
|
|
95
95
|
// 打开抽屉
|
|
96
96
|
var handleOpenDrawer = useMemoizedFn(function (record, item) {
|
|
97
|
+
var _item$onClick;
|
|
98
|
+
item === null || item === void 0 ? void 0 : (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, record);
|
|
97
99
|
if (item.openMode === 'custom') {
|
|
98
|
-
var _item$onClick;
|
|
99
|
-
item === null || item === void 0 ? void 0 : (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, record);
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
102
|
registerValueVariable === null || registerValueVariable === void 0 ? void 0 : registerValueVariable(componentId, {
|
|
@@ -224,7 +224,7 @@ var useTableProps = function useTableProps(props) {
|
|
|
224
224
|
var actionType = button.actionType,
|
|
225
225
|
buttonProps = button.buttonProps;
|
|
226
226
|
return _objectSpread(_objectSpread(_objectSpread({}, button), buttonProps), {}, {
|
|
227
|
-
size:
|
|
227
|
+
size: 'large',
|
|
228
228
|
title: button.label,
|
|
229
229
|
onClick: function onClick() {
|
|
230
230
|
if (actionType === 'add') {
|
|
@@ -33,6 +33,7 @@ export interface SubmitButtonProps extends ButtonProps {
|
|
|
33
33
|
duration: number;
|
|
34
34
|
placement: 'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight';
|
|
35
35
|
};
|
|
36
|
+
customSubmit?: (values: Record<string, any>) => void;
|
|
36
37
|
}
|
|
37
38
|
declare const SubmitButton: (props: SubmitButtonProps) => React.JSX.Element | null;
|
|
38
39
|
export default SubmitButton;
|
|
@@ -53,7 +53,8 @@ var SubmitButton = (props) => {
|
|
|
53
53
|
afterSubmitType,
|
|
54
54
|
afterSubmitModalConfig,
|
|
55
55
|
afterSubmitNotificationConfig,
|
|
56
|
-
childrenString
|
|
56
|
+
childrenString,
|
|
57
|
+
customSubmit
|
|
57
58
|
} = props;
|
|
58
59
|
const [loading, setLoading] = (0, import_react.useState)(false);
|
|
59
60
|
const [api, contextHolder] = import_antd.notification.useNotification();
|
|
@@ -65,6 +66,9 @@ var SubmitButton = (props) => {
|
|
|
65
66
|
const onSubmit = async (values) => {
|
|
66
67
|
setLoading(true);
|
|
67
68
|
try {
|
|
69
|
+
if (customSubmit) {
|
|
70
|
+
return await customSubmit(values);
|
|
71
|
+
}
|
|
68
72
|
if (renderMode === "edit") {
|
|
69
73
|
return await update.runAsync(values);
|
|
70
74
|
} else if (renderMode === "add") {
|
|
@@ -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
|
};
|
|
@@ -103,8 +103,8 @@ var useTableProps = (props) => {
|
|
|
103
103
|
}, [propsSubTitle]);
|
|
104
104
|
const handleOpenDrawer = (0, import_ahooks.useMemoizedFn)((record, item) => {
|
|
105
105
|
var _a2;
|
|
106
|
+
(_a2 = item == null ? void 0 : item.onClick) == null ? void 0 : _a2.call(item, record);
|
|
106
107
|
if (item.openMode === "custom") {
|
|
107
|
-
(_a2 = item == null ? void 0 : item.onClick) == null ? void 0 : _a2.call(item, record);
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
registerValueVariable == null ? void 0 : registerValueVariable(componentId, {
|
|
@@ -763,6 +763,12 @@ const SubmitButtonMeta: ComponentMetadata = {
|
|
|
763
763
|
'target => !!target.getProps().getPropValue("href")?.trim()',
|
|
764
764
|
},
|
|
765
765
|
},
|
|
766
|
+
{
|
|
767
|
+
name: 'customSubmit',
|
|
768
|
+
title: '自定义提交',
|
|
769
|
+
propType: 'func',
|
|
770
|
+
setter: 'FunctionSetter',
|
|
771
|
+
},
|
|
766
772
|
],
|
|
767
773
|
},
|
|
768
774
|
{
|