mirror of
https://github.com/nocobase/nocobase.git
synced 2026-09-21 13:52:17 +08:00
Merge branch 'next' into develop
This commit is contained in:
@@ -258,6 +258,15 @@ DatePicker.RangePicker = function RangePicker(props: any) {
|
||||
return <InternalRangePicker {...newProps} />;
|
||||
};
|
||||
|
||||
function toLocalNaiveISOString(dateString: string, format): string {
|
||||
if (dateString && dateString.endsWith('Z')) {
|
||||
const date = dayjs(dateString);
|
||||
return date.format(format);
|
||||
}
|
||||
return dateString;
|
||||
}
|
||||
|
||||
//筛选区块的日期字段总是输出无时区
|
||||
DatePicker.FilterWithPicker = function FilterWithPicker(props: any) {
|
||||
const { picker = 'date', format, showTime, timeFormat } = props;
|
||||
const isMobileMedia = isMobile();
|
||||
@@ -332,7 +341,10 @@ DatePicker.FilterWithPicker = function FilterWithPicker(props: any) {
|
||||
field.value = null;
|
||||
}}
|
||||
/>
|
||||
<InternalDatePicker {...stateProps} value={value} />
|
||||
<InternalDatePicker
|
||||
{...stateProps}
|
||||
value={toLocalNaiveISOString(value, getDateTimeFormat(targetPicker, targetDateFormat, showTime, timeFormat))}
|
||||
/>
|
||||
</Space.Compact>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -67,7 +67,7 @@ export const useChartData = () => {
|
||||
const chartCollections: {
|
||||
[dataSource: string]: string[];
|
||||
} = useMemo(() => {
|
||||
return Object.values(charts)
|
||||
return Object.values(charts || {})
|
||||
.filter((chart) => chart)
|
||||
.reduce((mp, chart) => {
|
||||
const { dataSource, collection } = chart;
|
||||
|
||||
+9
@@ -15,6 +15,7 @@ import {
|
||||
useDatetimeVariable,
|
||||
usePopupVariable,
|
||||
useURLSearchParamsVariable,
|
||||
useExactDateVariable,
|
||||
} from '@nocobase/client';
|
||||
import { useMemo } from 'react';
|
||||
import { useFilterVariable } from './filter';
|
||||
@@ -36,6 +37,11 @@ export const useGeneralVariableOptions = (
|
||||
const { settings: popupRecordSettings, shouldDisplayPopupRecord } = usePopupVariable({
|
||||
schema,
|
||||
});
|
||||
const { exactDateTimeSettings, shouldDisplayExactDate } = useExactDateVariable({
|
||||
operator,
|
||||
schema,
|
||||
noDisabled: true,
|
||||
});
|
||||
|
||||
const result = useMemo(
|
||||
() =>
|
||||
@@ -46,6 +52,7 @@ export const useGeneralVariableOptions = (
|
||||
datetimeSettings,
|
||||
urlSearchParamsSettings,
|
||||
shouldDisplayPopupRecord && popupRecordSettings,
|
||||
shouldDisplayExactDate && exactDateTimeSettings,
|
||||
].filter(Boolean),
|
||||
[
|
||||
datetimeSettings,
|
||||
@@ -55,6 +62,8 @@ export const useGeneralVariableOptions = (
|
||||
apiTokenSettings,
|
||||
shouldDisplayPopupRecord,
|
||||
popupRecordSettings,
|
||||
shouldDisplayExactDate,
|
||||
exactDateTimeSettings,
|
||||
],
|
||||
);
|
||||
|
||||
|
||||
+17
-1
@@ -7,7 +7,7 @@
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import React, { useContext } from 'react';
|
||||
import React, { useContext, useMemo } from 'react';
|
||||
import {
|
||||
EditDescription,
|
||||
GeneralSchemaDesigner,
|
||||
@@ -31,6 +31,8 @@ import {
|
||||
SchemaSettings,
|
||||
useApp,
|
||||
useIsFileField,
|
||||
FlagProvider,
|
||||
SchemaComponentContext,
|
||||
} from '@nocobase/client';
|
||||
import { useChartsTranslation } from '../locale';
|
||||
import { Schema, useField, useFieldSchema, ISchema } from '@formily/react';
|
||||
@@ -256,6 +258,13 @@ const EditDefaultValue = () => {
|
||||
const fieldSchema = useFieldSchema();
|
||||
const { getTranslatedTitle } = useChartFilter();
|
||||
const title = getTranslatedTitle(fieldSchema.title);
|
||||
const { getField } = useCollection_deprecated();
|
||||
const { getCollectionJoinField, getCollectionFields, getAllCollectionsInheritChain } =
|
||||
useCollectionManager_deprecated();
|
||||
const collectionField = useMemo(
|
||||
() => getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']),
|
||||
[fieldSchema, getCollectionJoinField, getField],
|
||||
);
|
||||
return (
|
||||
<SchemaSettingsModalItem
|
||||
key="set field default value"
|
||||
@@ -289,6 +298,13 @@ const EditDefaultValue = () => {
|
||||
dn.refresh();
|
||||
setDefaultValue(field, variables, localVariables);
|
||||
}}
|
||||
ModalContextProvider={(props: any) => {
|
||||
return (
|
||||
<SchemaComponentContext.Provider value={{ designable: false }}>
|
||||
<FlagProvider collectionField={collectionField || {}}>{props.children}</FlagProvider>
|
||||
</SchemaComponentContext.Provider>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user