mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 15:39:24 +08:00
chore: avoid misoperation of date variables (#4452)
This commit is contained in:
parent
2d880e576f
commit
f6d56a9cb3
@ -39,6 +39,7 @@ export const SchemaSettingsDataScope: FC<DataScopeProps> = function DataScopeCon
|
||||
{...props}
|
||||
form={form}
|
||||
record={record}
|
||||
noDisabled={true}
|
||||
shouldChange={getShouldChange({
|
||||
collectionField: props.collectionField,
|
||||
variables,
|
||||
|
@ -67,6 +67,10 @@ type Props = {
|
||||
* @returns
|
||||
*/
|
||||
returnScope?: (scope: Option[]) => any[];
|
||||
/**
|
||||
* 不需要禁用选项,一般会在表达式中使用
|
||||
*/
|
||||
noDisabled?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -91,6 +95,7 @@ export const VariableInput = (props: Props) => {
|
||||
record,
|
||||
returnScope = _.identity,
|
||||
targetFieldSchema,
|
||||
noDisabled,
|
||||
} = props;
|
||||
const { name: blockCollectionName } = useBlockCollection();
|
||||
const scope = useVariableScope();
|
||||
@ -103,6 +108,7 @@ export const VariableInput = (props: Props) => {
|
||||
operator,
|
||||
uiSchema,
|
||||
targetFieldSchema,
|
||||
noDisabled,
|
||||
});
|
||||
const contextVariable = useContextAssociationFields({ schema, maxDepth: 2, contextCollectionName, collectionField });
|
||||
const { compatOldVariables } = useCompatOldVariables({
|
||||
|
@ -193,7 +193,7 @@ export const useDatetimeVariable = ({ operator, schema, noDisabled }: Props = {}
|
||||
const { t } = useTranslation();
|
||||
const datetimeSettings = useMemo(() => {
|
||||
const operatorValue = operator?.value || '';
|
||||
const disabled = noDisabled ? false : !['DatePicker', 'DatePicker.RangePicker'].includes(schema?.['x-component']);
|
||||
const disabled = noDisabled ? false : !['DatePicker.RangePicker'].includes(schema?.['x-component']);
|
||||
const dateOptions = [
|
||||
{
|
||||
key: 'now',
|
||||
|
@ -11,7 +11,6 @@ import { Form } from '@formily/core';
|
||||
import { ISchema, Schema } from '@formily/react';
|
||||
import { useMemo } from 'react';
|
||||
import { CollectionFieldOptions_deprecated } from '../../../collection-manager';
|
||||
import { useBlockCollection } from './useBlockCollection';
|
||||
import { useDatetimeVariable } from './useDateVariable';
|
||||
import { useCurrentFormVariable } from './useFormVariable';
|
||||
import { useCurrentObjectVariable } from './useIterationVariable';
|
||||
@ -56,7 +55,6 @@ export const useVariableOptions = ({
|
||||
targetFieldSchema,
|
||||
record,
|
||||
}: Props) => {
|
||||
const { name: blockCollectionName = record?.__collectionName } = useBlockCollection();
|
||||
const blockParentCollectionName = record?.__parent?.__collectionName;
|
||||
const { currentUserSettings } = useCurrentUserVariable({
|
||||
maxDepth: 3,
|
||||
|
Loading…
x
Reference in New Issue
Block a user