@nocobase/client-v2 2.1.35 → 2.1.37
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/actions/linkageRules.d.ts +24 -0
- package/es/flow/components/FieldAssignValueInput.d.ts +2 -23
- package/es/flow/components/field-value-variable/DateVariableEditor.d.ts +23 -0
- package/es/flow/components/field-value-variable/FieldValueVariableInput.d.ts +28 -0
- package/es/flow/components/field-value-variable/dateValue.d.ts +36 -0
- package/es/flow/components/field-value-variable/index.d.ts +11 -0
- package/es/index.mjs +64 -73
- package/lib/index.js +92 -101
- package/package.json +7 -7
- package/src/flow/actions/__tests__/linkageRules.actionStates.test.ts +33 -0
- package/src/flow/actions/linkageRules.tsx +25 -7
- package/src/flow/components/FieldAssignValueInput.tsx +34 -571
- package/src/flow/components/field-value-variable/DateVariableEditor.tsx +162 -0
- package/src/flow/components/field-value-variable/FieldValueVariableInput.tsx +306 -0
- package/src/flow/components/field-value-variable/__tests__/FieldValueVariableInput.test.tsx +380 -0
- package/src/flow/components/field-value-variable/dateValue.ts +223 -0
- package/src/flow/components/field-value-variable/index.ts +12 -0
- package/src/flow/models/blocks/assign-form/AssignFormItemModel.tsx +28 -53
- package/src/flow/models/blocks/form/__tests__/FormBlockModel.test.tsx +8 -2
- package/src/flow/models/blocks/form/value-runtime/__tests__/runtime.test.ts +398 -0
- package/src/flow/models/blocks/form/value-runtime/rules.ts +39 -9
- package/src/flow/models/blocks/form/value-runtime/runtime.ts +39 -19
- package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/PopupSubTableFieldModel.tsx +8 -0
- package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/__tests__/popupContext.test.ts +120 -0
- package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/actions/PopupSubTableEditActionModel.tsx +10 -2
- package/src/flow/models/fields/AssociationFieldModel/__tests__/RecordPickerFieldModel.itemContext.test.ts +46 -0
- package/src/flow/models/fields/mobile-components/MobileLazySelect.tsx +1 -0
- package/src/flow/models/fields/mobile-components/__tests__/MobileSelect.test.tsx +20 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/client-v2",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.37",
|
|
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.1.
|
|
31
|
-
"@nocobase/flow-engine": "2.1.
|
|
32
|
-
"@nocobase/sdk": "2.1.
|
|
33
|
-
"@nocobase/shared": "2.1.
|
|
34
|
-
"@nocobase/utils": "2.1.
|
|
30
|
+
"@nocobase/evaluators": "2.1.37",
|
|
31
|
+
"@nocobase/flow-engine": "2.1.37",
|
|
32
|
+
"@nocobase/sdk": "2.1.37",
|
|
33
|
+
"@nocobase/shared": "2.1.37",
|
|
34
|
+
"@nocobase/utils": "2.1.37",
|
|
35
35
|
"ahooks": "^3.7.2",
|
|
36
36
|
"antd": "5.24.2",
|
|
37
37
|
"antd-style": "3.7.1",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"react-i18next": "^11.15.1",
|
|
49
49
|
"react-router-dom": "^6.30.1"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "a0c3201363ae028058845af0176ee902a9eeb3e1"
|
|
52
52
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { describe, expect, it } from 'vitest';
|
|
11
|
+
import { getActionLinkageStateOptions } from '../linkageRules';
|
|
12
|
+
|
|
13
|
+
describe('getActionLinkageStateOptions', () => {
|
|
14
|
+
const t = (key: string) => key;
|
|
15
|
+
|
|
16
|
+
it('returns all states for regular action models', () => {
|
|
17
|
+
expect(getActionLinkageStateOptions({}, t).map((option) => option.value)).toEqual([
|
|
18
|
+
'visible',
|
|
19
|
+
'hidden',
|
|
20
|
+
'hiddenText',
|
|
21
|
+
'enabled',
|
|
22
|
+
'disabled',
|
|
23
|
+
]);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('filters states declared unsupported by the action model', () => {
|
|
27
|
+
expect(
|
|
28
|
+
getActionLinkageStateOptions({ supportedActionLinkageStates: ['visible', 'hidden'] }, t).map(
|
|
29
|
+
(option) => option.value,
|
|
30
|
+
),
|
|
31
|
+
).toEqual(['visible', 'hidden']);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -664,6 +664,30 @@ export const linkageSetBlockProps = defineAction({
|
|
|
664
664
|
},
|
|
665
665
|
});
|
|
666
666
|
|
|
667
|
+
const ACTION_LINKAGE_STATE_OPTIONS = [
|
|
668
|
+
{ label: 'Visible', value: 'visible' },
|
|
669
|
+
{ label: 'Hidden', value: 'hidden' },
|
|
670
|
+
{ label: 'Hidden text', value: 'hiddenText' },
|
|
671
|
+
{ label: 'Enabled', value: 'enabled' },
|
|
672
|
+
{ label: 'Disabled', value: 'disabled' },
|
|
673
|
+
] as const;
|
|
674
|
+
|
|
675
|
+
type ActionLinkageState = (typeof ACTION_LINKAGE_STATE_OPTIONS)[number]['value'];
|
|
676
|
+
|
|
677
|
+
export function getActionLinkageStateOptions(
|
|
678
|
+
model: { supportedActionLinkageStates?: readonly ActionLinkageState[] },
|
|
679
|
+
t: (key: string) => string,
|
|
680
|
+
) {
|
|
681
|
+
const supportedStates = model.supportedActionLinkageStates ? new Set(model.supportedActionLinkageStates) : undefined;
|
|
682
|
+
|
|
683
|
+
return ACTION_LINKAGE_STATE_OPTIONS.filter((option) => !supportedStates || supportedStates.has(option.value)).map(
|
|
684
|
+
(option) => ({
|
|
685
|
+
label: t(option.label),
|
|
686
|
+
value: option.value,
|
|
687
|
+
}),
|
|
688
|
+
);
|
|
689
|
+
}
|
|
690
|
+
|
|
667
691
|
export const linkageSetActionProps = defineAction({
|
|
668
692
|
name: 'linkageSetActionProps',
|
|
669
693
|
title: tExpr('Set button state'),
|
|
@@ -684,13 +708,7 @@ export const linkageSetActionProps = defineAction({
|
|
|
684
708
|
onChange={onChange}
|
|
685
709
|
placeholder={t('Please select state')}
|
|
686
710
|
style={{ width: '100%' }}
|
|
687
|
-
options={
|
|
688
|
-
{ label: t('Visible'), value: 'visible' },
|
|
689
|
-
{ label: t('Hidden'), value: 'hidden' },
|
|
690
|
-
{ label: t('Hidden text'), value: 'hiddenText' },
|
|
691
|
-
{ label: t('Enabled'), value: 'enabled' },
|
|
692
|
-
{ label: t('Disabled'), value: 'disabled' },
|
|
693
|
-
]}
|
|
711
|
+
options={getActionLinkageStateOptions(ctx.model, t)}
|
|
694
712
|
allowClear
|
|
695
713
|
/>
|
|
696
714
|
);
|