@nocobase/client-v2 2.1.0-alpha.25 → 2.1.0-alpha.26
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/client-v2",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.26",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"@formily/antd-v5": "1.2.3",
|
|
25
25
|
"@formily/react": "^2.2.27",
|
|
26
26
|
"@formily/shared": "^2.2.27",
|
|
27
|
-
"@nocobase/flow-engine": "2.1.0-alpha.
|
|
28
|
-
"@nocobase/sdk": "2.1.0-alpha.
|
|
29
|
-
"@nocobase/shared": "2.1.0-alpha.
|
|
27
|
+
"@nocobase/flow-engine": "2.1.0-alpha.26",
|
|
28
|
+
"@nocobase/sdk": "2.1.0-alpha.26",
|
|
29
|
+
"@nocobase/shared": "2.1.0-alpha.26",
|
|
30
30
|
"antd": "5.24.2",
|
|
31
31
|
"classnames": "^2.3.1",
|
|
32
32
|
"dayjs": "^1.11.10",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"react-i18next": "^11.15.1",
|
|
36
36
|
"react-router-dom": "^6.30.1"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "e6e6518030175b58080218bb4357642398bcb54a"
|
|
39
39
|
}
|
|
@@ -28,6 +28,18 @@ import { FieldModel } from '../../base/FieldModel';
|
|
|
28
28
|
import { FormComponent } from './FormBlockModel';
|
|
29
29
|
import { FormItemModel } from './FormItemModel';
|
|
30
30
|
|
|
31
|
+
export const QUICK_EDIT_POPOVER_MAX_HEIGHT = 'calc(100vh - 96px)';
|
|
32
|
+
export const QUICK_EDIT_FORM_MAX_HEIGHT = 'calc(100vh - 160px)';
|
|
33
|
+
export const QUICK_EDIT_MARKDOWN_HEIGHT = 'min(480px, calc(100vh - 320px))';
|
|
34
|
+
|
|
35
|
+
export function getQuickEditFieldProps(collectionField: CollectionField, fieldProps?: Record<string, any>) {
|
|
36
|
+
const nextProps = { ...collectionField.getComponentProps(), ...(fieldProps || {}) };
|
|
37
|
+
if (['markdown', 'vditor'].includes(collectionField.interface) && nextProps.height == null) {
|
|
38
|
+
nextProps.height = QUICK_EDIT_MARKDOWN_HEIGHT;
|
|
39
|
+
}
|
|
40
|
+
return nextProps;
|
|
41
|
+
}
|
|
42
|
+
|
|
31
43
|
export class QuickEditFormModel extends FlowModel {
|
|
32
44
|
fieldPath: string;
|
|
33
45
|
|
|
@@ -99,7 +111,10 @@ export class QuickEditFormModel extends FlowModel {
|
|
|
99
111
|
placement: 'rightTop',
|
|
100
112
|
styles: {
|
|
101
113
|
body: {
|
|
102
|
-
width:
|
|
114
|
+
width: 420,
|
|
115
|
+
maxHeight: QUICK_EDIT_POPOVER_MAX_HEIGHT,
|
|
116
|
+
overflowY: 'auto',
|
|
117
|
+
overscrollBehavior: 'contain',
|
|
103
118
|
},
|
|
104
119
|
},
|
|
105
120
|
content: (popover) => {
|
|
@@ -160,20 +175,28 @@ export class QuickEditFormModel extends FlowModel {
|
|
|
160
175
|
|
|
161
176
|
return (
|
|
162
177
|
<FormComponent model={this}>
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
<
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
178
|
+
<div
|
|
179
|
+
style={{
|
|
180
|
+
minHeight: 0,
|
|
181
|
+
overflowY: 'auto',
|
|
182
|
+
maxHeight: QUICK_EDIT_FORM_MAX_HEIGHT,
|
|
183
|
+
}}
|
|
184
|
+
>
|
|
185
|
+
{this.mapSubModels('fields', (field) => {
|
|
186
|
+
return (
|
|
187
|
+
<FormItem
|
|
188
|
+
showLabel={false}
|
|
189
|
+
name={this.fieldPath}
|
|
190
|
+
key={field.uid}
|
|
191
|
+
initialValue={this.context.record?.[this.fieldPath]}
|
|
192
|
+
{...this.props}
|
|
193
|
+
>
|
|
194
|
+
<FieldModelRenderer model={field} fallback={<Skeleton.Input size="small" />} />
|
|
195
|
+
</FormItem>
|
|
196
|
+
);
|
|
197
|
+
})}
|
|
198
|
+
</div>
|
|
199
|
+
<Space style={{ display: 'flex', justifyContent: 'flex-end', flexShrink: 0 }}>
|
|
177
200
|
<Button
|
|
178
201
|
onClick={() => {
|
|
179
202
|
this.viewContainer.close();
|
|
@@ -257,7 +280,7 @@ QuickEditFormModel.registerFlow({
|
|
|
257
280
|
},
|
|
258
281
|
},
|
|
259
282
|
});
|
|
260
|
-
fieldModel.setProps(
|
|
283
|
+
fieldModel.setProps(getQuickEditFieldProps(collectionField, ctx.model._fieldProps));
|
|
261
284
|
fieldModel.setProps({ sourceFieldModelUid: ctx.inputArgs.sourceFieldModelUid });
|
|
262
285
|
ctx.model.context.defineProperty('collectionField', {
|
|
263
286
|
get: () => collectionField,
|