@nocobase/flow-engine 2.2.50 → 2.2.52
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.
|
@@ -10,6 +10,7 @@ import React from 'react';
|
|
|
10
10
|
import type { FormItemProps } from 'antd';
|
|
11
11
|
type ChildExtraProps = Record<string, any>;
|
|
12
12
|
interface ExtendedFormItemProps extends FormItemProps {
|
|
13
|
+
itemMarginClassName?: string;
|
|
13
14
|
labelWidth?: number | string;
|
|
14
15
|
labelWrap?: boolean;
|
|
15
16
|
showLabel?: boolean;
|
|
@@ -20,5 +21,5 @@ export declare const verticalFormItemLabelStyle: {
|
|
|
20
21
|
export declare const formItemStyle: {
|
|
21
22
|
marginBottom: number;
|
|
22
23
|
};
|
|
23
|
-
export declare const FormItem: ({ children, showLabel, labelWidth, ...rest }: ExtendedFormItemProps & ChildExtraProps) => React.JSX.Element;
|
|
24
|
+
export declare const FormItem: ({ children, showLabel, labelWidth, itemMarginClassName, ...rest }: ExtendedFormItemProps & ChildExtraProps) => React.JSX.Element;
|
|
24
25
|
export {};
|
|
@@ -82,6 +82,7 @@ const FormItem = /* @__PURE__ */ __name(({
|
|
|
82
82
|
children,
|
|
83
83
|
showLabel = true,
|
|
84
84
|
labelWidth,
|
|
85
|
+
itemMarginClassName,
|
|
85
86
|
...rest
|
|
86
87
|
}) => {
|
|
87
88
|
const forwardedRest = Object.fromEntries(
|
|
@@ -96,7 +97,7 @@ const FormItem = /* @__PURE__ */ __name(({
|
|
|
96
97
|
}
|
|
97
98
|
return child;
|
|
98
99
|
});
|
|
99
|
-
const { label, labelWrap, colon = true, layout } = forwardedRest;
|
|
100
|
+
const { className, label, labelWrap, colon = true, layout } = forwardedRest;
|
|
100
101
|
const effectiveLabelWrap = !layout || layout === "vertical" ? true : labelWrap;
|
|
101
102
|
const labelColStyle = layout === "vertical" ? { width: labelWidth, ...verticalFormItemLabelStyle } : { width: labelWidth };
|
|
102
103
|
const renderLabel = /* @__PURE__ */ __name(() => {
|
|
@@ -141,7 +142,8 @@ const FormItem = /* @__PURE__ */ __name(({
|
|
|
141
142
|
import_antd.Form.Item,
|
|
142
143
|
{
|
|
143
144
|
...forwardedRest,
|
|
144
|
-
|
|
145
|
+
className: itemMarginClassName ? [className, itemMarginClassName].filter(Boolean).join(" ") : className,
|
|
146
|
+
style: itemMarginClassName ? forwardedRest.style : { ...formItemStyle, ...forwardedRest.style },
|
|
145
147
|
labelCol: { style: labelColStyle },
|
|
146
148
|
layout,
|
|
147
149
|
label: renderLabel(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/flow-engine",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.52",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A standalone flow engine for NocoBase, managing workflows, models, and actions.",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@formily/antd-v5": "1.x",
|
|
10
10
|
"@formily/reactive": "2.x",
|
|
11
|
-
"@nocobase/sdk": "2.2.
|
|
12
|
-
"@nocobase/shared": "2.2.
|
|
11
|
+
"@nocobase/sdk": "2.2.52",
|
|
12
|
+
"@nocobase/shared": "2.2.52",
|
|
13
13
|
"ahooks": "^3.7.2",
|
|
14
14
|
"axios": "^1.7.0",
|
|
15
15
|
"dayjs": "^1.11.9",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
],
|
|
38
38
|
"author": "NocoBase Team",
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "27ab36740f5cb8235d3b35f2b41246c4771532b0"
|
|
41
41
|
}
|
|
@@ -14,6 +14,7 @@ import type { FormItemProps, TooltipProps } from 'antd';
|
|
|
14
14
|
type ChildExtraProps = Record<string, any>;
|
|
15
15
|
|
|
16
16
|
interface ExtendedFormItemProps extends FormItemProps {
|
|
17
|
+
itemMarginClassName?: string;
|
|
17
18
|
labelWidth?: number | string;
|
|
18
19
|
labelWrap?: boolean;
|
|
19
20
|
showLabel?: boolean;
|
|
@@ -60,6 +61,7 @@ export const FormItem = ({
|
|
|
60
61
|
children,
|
|
61
62
|
showLabel = true,
|
|
62
63
|
labelWidth,
|
|
64
|
+
itemMarginClassName,
|
|
63
65
|
...rest
|
|
64
66
|
}: ExtendedFormItemProps & ChildExtraProps) => {
|
|
65
67
|
const forwardedRest = Object.fromEntries(
|
|
@@ -79,7 +81,7 @@ export const FormItem = ({
|
|
|
79
81
|
}
|
|
80
82
|
return child;
|
|
81
83
|
});
|
|
82
|
-
const { label, labelWrap, colon = true, layout } = forwardedRest;
|
|
84
|
+
const { className, label, labelWrap, colon = true, layout } = forwardedRest;
|
|
83
85
|
const effectiveLabelWrap = !layout || layout === 'vertical' ? true : labelWrap;
|
|
84
86
|
const labelColStyle =
|
|
85
87
|
layout === 'vertical' ? { width: labelWidth, ...verticalFormItemLabelStyle } : { width: labelWidth };
|
|
@@ -128,7 +130,8 @@ export const FormItem = ({
|
|
|
128
130
|
return (
|
|
129
131
|
<Form.Item
|
|
130
132
|
{...forwardedRest}
|
|
131
|
-
|
|
133
|
+
className={itemMarginClassName ? [className, itemMarginClassName].filter(Boolean).join(' ') : className}
|
|
134
|
+
style={itemMarginClassName ? forwardedRest.style : { ...formItemStyle, ...forwardedRest.style }}
|
|
132
135
|
labelCol={{ style: labelColStyle }}
|
|
133
136
|
layout={layout}
|
|
134
137
|
label={renderLabel()}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import { css } from '@emotion/css';
|
|
10
11
|
import { render } from '@testing-library/react';
|
|
11
12
|
import React from 'react';
|
|
12
13
|
import { describe, expect, it, vi } from 'vitest';
|
|
@@ -25,6 +26,21 @@ describe('FormItem', () => {
|
|
|
25
26
|
});
|
|
26
27
|
});
|
|
27
28
|
|
|
29
|
+
it.each([undefined, 'detail-margin'])('preserves caller classes with margin class %s', (itemMarginClassName) => {
|
|
30
|
+
const colorClass = css({ color: 'red' });
|
|
31
|
+
const sizeClass = css({ fontSize: 13 });
|
|
32
|
+
const { container } = render(
|
|
33
|
+
<FormItem className={`${colorClass} ${sizeClass}`} itemMarginClassName={itemMarginClassName}>
|
|
34
|
+
<input />
|
|
35
|
+
</FormItem>,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const wrapper = container.querySelector('.ant-form-item');
|
|
39
|
+
expect(wrapper).toHaveClass(colorClass, sizeClass);
|
|
40
|
+
expect(wrapper.classList.contains('detail-margin')).toBe(Boolean(itemMarginClassName));
|
|
41
|
+
expect(container.querySelector('input')).not.toHaveClass('detail-margin');
|
|
42
|
+
});
|
|
43
|
+
|
|
28
44
|
it('does not forward model-internal globalSort props to field children', () => {
|
|
29
45
|
const Field = vi.fn(() => <input aria-label="field" />);
|
|
30
46
|
|