@nocobase/client-v2 2.2.0-beta.3 → 2.2.0-beta.5
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/es/flow/models/fields/AssociationFieldModel/RecordSelectFieldModel.d.ts +2 -0
- package/es/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableColumnModel.d.ts +1 -0
- package/es/flow/utils/dateTimeDisplayProps.d.ts +49 -0
- package/es/index.mjs +110 -90
- package/lib/index.js +89 -69
- package/package.json +7 -7
- package/src/flow/actions/dateTimeFormat.tsx +42 -28
- package/src/flow/admin-shell/admin-layout/HelpLite.tsx +1 -3
- package/src/flow/components/DynamicFlowsIcon.tsx +447 -126
- package/src/flow/components/__tests__/DynamicFlowsIcon.test.tsx +148 -2
- package/src/flow/flows/editMarkdownFlow.tsx +1 -1
- package/src/flow/index.ts +1 -1
- package/src/flow/internal/utils/operatorSchemaHelper.ts +15 -1
- package/src/flow/models/blocks/filter-manager/flow-actions/__tests__/customizeFilterRender.test.tsx +56 -1
- package/src/flow/models/blocks/table/TableColumnModel.tsx +36 -3
- package/src/flow/models/blocks/table/__tests__/TableColumnModel.test.tsx +159 -1
- package/src/flow/models/fields/AssociationFieldModel/RecordSelectFieldModel.tsx +16 -4
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableColumnModel.tsx +24 -1
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/__tests__/SubTableColumnModel.rowRecord.test.ts +12 -0
- package/src/flow/models/fields/AssociationFieldModel/__tests__/RecordPickerFieldModel.itemContext.test.ts +23 -0
- package/src/flow/models/fields/ClickableFieldModel.tsx +5 -0
- package/src/flow/models/fields/DisplayDateTimeFieldModel.tsx +29 -1
- package/src/flow/models/fields/SelectFieldModel.tsx +6 -4
- package/src/flow/models/fields/__tests__/DisplayDateTimeFieldModel.test.tsx +96 -0
- package/src/flow/models/fields/__tests__/SelectFieldModel.test.tsx +43 -0
- package/src/flow/utils/__tests__/dateTimeFormat.test.ts +258 -0
- package/src/flow/utils/dateTimeDisplayProps.ts +135 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/client-v2",
|
|
3
|
-
"version": "2.2.0-beta.
|
|
3
|
+
"version": "2.2.0-beta.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"@formily/antd-v5": "1.2.3",
|
|
28
28
|
"@formily/react": "^2.2.27",
|
|
29
29
|
"@formily/shared": "^2.2.27",
|
|
30
|
-
"@nocobase/evaluators": "2.2.0-beta.
|
|
31
|
-
"@nocobase/flow-engine": "2.2.0-beta.
|
|
32
|
-
"@nocobase/sdk": "2.2.0-beta.
|
|
33
|
-
"@nocobase/shared": "2.2.0-beta.
|
|
34
|
-
"@nocobase/utils": "2.2.0-beta.
|
|
30
|
+
"@nocobase/evaluators": "2.2.0-beta.5",
|
|
31
|
+
"@nocobase/flow-engine": "2.2.0-beta.5",
|
|
32
|
+
"@nocobase/sdk": "2.2.0-beta.5",
|
|
33
|
+
"@nocobase/shared": "2.2.0-beta.5",
|
|
34
|
+
"@nocobase/utils": "2.2.0-beta.5",
|
|
35
35
|
"ahooks": "^3.7.2",
|
|
36
36
|
"antd": "5.24.2",
|
|
37
37
|
"antd-style": "3.7.1",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"react-i18next": "^11.15.1",
|
|
47
47
|
"react-router-dom": "^6.30.1"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "81eab2cfa9d3d989e99ba0c914807b38db55f023"
|
|
50
50
|
}
|
|
@@ -11,13 +11,36 @@ import { css } from '@emotion/css';
|
|
|
11
11
|
import { defineAction, tExpr } from '@nocobase/flow-engine';
|
|
12
12
|
import { getPickerFormat } from '@nocobase/utils/client';
|
|
13
13
|
import { DateFormatCom, ExpiresRadio } from '../components';
|
|
14
|
+
import {
|
|
15
|
+
getDateTimeFormatCollectionField,
|
|
16
|
+
isDateOnlyCollectionField,
|
|
17
|
+
isTimeCollectionField,
|
|
18
|
+
resolveDateTimeDisplayProps,
|
|
19
|
+
} from '../utils/dateTimeDisplayProps';
|
|
20
|
+
|
|
21
|
+
const isTableColumnFieldSubModel = (model) => {
|
|
22
|
+
const parent = model?.parent;
|
|
23
|
+
return (
|
|
24
|
+
parent?.subModels?.field === model &&
|
|
25
|
+
(parent?.use === 'TableColumnModel' || parent?.constructor?.name === 'TableColumnModel')
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const syncTableColumnDateTimeFormatProps = (ctx, props) => {
|
|
30
|
+
const model = ctx.model;
|
|
31
|
+
if (!isTableColumnFieldSubModel(model) || !model?.parent?.collectionField?.isAssociationField?.()) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
model.parent.setProps(props);
|
|
36
|
+
};
|
|
14
37
|
|
|
15
38
|
export const dateTimeFormat = defineAction({
|
|
16
39
|
title: tExpr('Date display format'),
|
|
17
40
|
name: 'dateDisplayFormat',
|
|
18
41
|
uiSchema: (ctx) => {
|
|
19
|
-
const
|
|
20
|
-
const isTimeField = collectionField
|
|
42
|
+
const collectionField = getDateTimeFormatCollectionField({ model: ctx.model });
|
|
43
|
+
const isTimeField = isTimeCollectionField(collectionField);
|
|
21
44
|
const timeFormatField = {
|
|
22
45
|
type: 'string',
|
|
23
46
|
title: '{{t("Time format")}}',
|
|
@@ -43,7 +66,7 @@ export const dateTimeFormat = defineAction({
|
|
|
43
66
|
(field) => {
|
|
44
67
|
if (!isTimeField) {
|
|
45
68
|
const { showTime, picker } = field.form.values || {};
|
|
46
|
-
field.hidden = !showTime || picker !== 'date';
|
|
69
|
+
field.hidden = isDateOnlyCollectionField(collectionField) || !showTime || picker !== 'date';
|
|
47
70
|
}
|
|
48
71
|
},
|
|
49
72
|
],
|
|
@@ -146,10 +169,11 @@ export const dateTimeFormat = defineAction({
|
|
|
146
169
|
},
|
|
147
170
|
},
|
|
148
171
|
(field) => {
|
|
149
|
-
const
|
|
172
|
+
const collectionField = getDateTimeFormatCollectionField({ model: ctx.model });
|
|
150
173
|
const { picker } = field.form.values || {};
|
|
151
|
-
|
|
152
|
-
|
|
174
|
+
const isDateOnlyField = isDateOnlyCollectionField(collectionField);
|
|
175
|
+
field.hidden = isDateOnlyField || picker !== 'date';
|
|
176
|
+
if (isDateOnlyField || picker !== 'date') {
|
|
153
177
|
field.value = false;
|
|
154
178
|
}
|
|
155
179
|
},
|
|
@@ -159,34 +183,24 @@ export const dateTimeFormat = defineAction({
|
|
|
159
183
|
};
|
|
160
184
|
},
|
|
161
185
|
defaultParams: (ctx: any) => {
|
|
162
|
-
const { showTime, dateFormat,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
};
|
|
166
|
-
const collectionField = ctx.model.context.collectionField;
|
|
167
|
-
const isTimeField = collectionField.type === 'time' || collectionField.interface === 'time';
|
|
186
|
+
const { showTime, dateFormat, timeFormat, picker } = resolveDateTimeDisplayProps({
|
|
187
|
+
model: ctx.model,
|
|
188
|
+
withDefaults: true,
|
|
189
|
+
});
|
|
168
190
|
return {
|
|
169
191
|
picker: picker || 'date',
|
|
170
192
|
dateFormat: dateFormat || 'YYYY-MM-DD',
|
|
171
|
-
timeFormat: timeFormat ||
|
|
193
|
+
timeFormat: timeFormat || 'HH:mm:ss',
|
|
172
194
|
showTime,
|
|
173
195
|
};
|
|
174
196
|
},
|
|
197
|
+
async beforeParamsSave(ctx: any, params) {
|
|
198
|
+
const props = resolveDateTimeDisplayProps({ model: ctx.model, params });
|
|
199
|
+
ctx.model.setProps(props);
|
|
200
|
+
syncTableColumnDateTimeFormatProps(ctx, props);
|
|
201
|
+
await ctx.model.save?.();
|
|
202
|
+
},
|
|
175
203
|
handler(ctx: any, params) {
|
|
176
|
-
|
|
177
|
-
const isTimeField = collectionField.type === 'time' || collectionField.interface === 'time';
|
|
178
|
-
if (isTimeField) {
|
|
179
|
-
const timeFormat = params?.timeFormat || params?.format || 'HH:mm:ss';
|
|
180
|
-
ctx.model.setProps({
|
|
181
|
-
...params,
|
|
182
|
-
timeFormat,
|
|
183
|
-
format: timeFormat,
|
|
184
|
-
});
|
|
185
|
-
} else {
|
|
186
|
-
ctx.model.setProps({
|
|
187
|
-
...params,
|
|
188
|
-
format: params?.showTime ? `${params.dateFormat} ${params.timeFormat}` : params.dateFormat,
|
|
189
|
-
});
|
|
190
|
-
}
|
|
204
|
+
ctx.model.setProps(resolveDateTimeDisplayProps({ model: ctx.model, params }));
|
|
191
205
|
},
|
|
192
206
|
});
|
|
@@ -70,9 +70,7 @@ const SettingsMenu: React.FC = () => {
|
|
|
70
70
|
key: 'userManual',
|
|
71
71
|
label: (
|
|
72
72
|
<a
|
|
73
|
-
href={
|
|
74
|
-
isSimplifiedChinese ? 'https://v2.docs.nocobase.com/cn/guide/' : 'https://v2.docs.nocobase.com/guide/'
|
|
75
|
-
}
|
|
73
|
+
href={isSimplifiedChinese ? 'https://docs.nocobase.com/cn/guide/' : 'https://docs.nocobase.com/guide/'}
|
|
76
74
|
target="_blank"
|
|
77
75
|
rel="noreferrer"
|
|
78
76
|
>
|