diff --git a/packages/core/client/src/schema-component/antd/gantt/Gantt.Designer.tsx b/packages/core/client/src/schema-component/antd/gantt/Gantt.Designer.tsx index 1f629c1669..05b86849ca 100644 --- a/packages/core/client/src/schema-component/antd/gantt/Gantt.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/gantt/Gantt.Designer.tsx @@ -59,12 +59,27 @@ export const GanttDesigner = () => { dn.refresh(); }} /> - { - field.decoratorProps.showLunar = v; - fieldSchema['x-decorator-props']['showLunar'] = v; + value={fieldNames.range} + options={[ + { label: compile('{{t("Hour")}}'), value: 'hour', color: 'orange' }, + { label: compile('{{t("Quarter of day")}}'), value: 'quarterOfDay', color: 'default' }, + { label: compile('{{t("Half of day")}}'), value: 'halOfDay', color: 'blue' }, + { label: compile('{{t("Day")}}'), value: 'day', color: 'yellow' }, + { label: compile('{{t("Week")}}'), value: 'week', color: 'pule' }, + { label: compile('{{t("Month")}}'), value: 'month', color: 'green' }, + { label: compile('{{t("Year")}}'), value: 'year', color: 'green' }, + { label: compile('{{t("QuarterYear")}}'), value: 'quarterYear', color: 'red' }, + ]} + onChange={(range) => { + const fieldNames = field.decoratorProps.fieldNames || {}; + fieldNames['range'] = range; + field.decoratorProps.params = fieldNames; + fieldSchema['x-decorator-props']['params'] = fieldNames; + // Select切换option后value未按照预期切换,固增加以下代码 + fieldSchema['x-decorator-props']['fieldNames'] = fieldNames; + service.refresh(); dn.emit('patch', { schema: { ['x-uid']: fieldSchema['x-uid'], @@ -149,7 +164,7 @@ export const GanttDesigner = () => { }} /> - + { name: v[fieldNames.title], id: v.id + '', type: 'task', - progress: 10, + progress: v[fieldNames.progress], }); }); return tasks; diff --git a/packages/core/client/src/schema-component/antd/gantt/helpers/date-helper.ts b/packages/core/client/src/schema-component/antd/gantt/helpers/date-helper.ts index 6c4ed6fb38..f42b8df3d9 100644 --- a/packages/core/client/src/schema-component/antd/gantt/helpers/date-helper.ts +++ b/packages/core/client/src/schema-component/antd/gantt/helpers/date-helper.ts @@ -2,6 +2,7 @@ import { Task, ViewMode } from '../types/public-types'; const DateTimeFormat = Intl.DateTimeFormat; type DateTimeFormat = typeof DateTimeFormat; +//@ts-ignore const DateTimeFormatOptions = Intl.DateTimeFormatOptions; type DateTimeFormatOptions = typeof DateTimeFormatOptions; type DateHelperScales = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond'; @@ -154,6 +155,7 @@ export const seedDates = (startDate: Date, endDate: Date, viewMode: ViewMode) => export const getLocaleMonth = (date: Date, locale: string) => { let bottomValue = getCachedDateTimeFormat(locale, { month: 'long', + //@ts-ignore }).format(date); bottomValue = bottomValue.replace(bottomValue[0], bottomValue[0].toLocaleUpperCase()); return bottomValue; @@ -162,6 +164,7 @@ export const getLocaleMonth = (date: Date, locale: string) => { export const getLocalDayOfWeek = (date: Date, locale: string, format?: 'long' | 'short' | 'narrow' | undefined) => { let bottomValue = getCachedDateTimeFormat(locale, { weekday: format, + //@ts-ignore }).format(date); bottomValue = bottomValue.replace(bottomValue[0], bottomValue[0].toLocaleUpperCase()); return bottomValue; diff --git a/packages/core/client/src/schema-initializer/buttons/GanttActionInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/GanttActionInitializers.tsx index d56a5eab14..7008e48b57 100644 --- a/packages/core/client/src/schema-initializer/buttons/GanttActionInitializers.tsx +++ b/packages/core/client/src/schema-initializer/buttons/GanttActionInitializers.tsx @@ -8,26 +8,18 @@ export const GanttActionInitializers = { type: 'itemGroup', title: '{{t("Enable actions")}}', children: [ - { - type: 'item', - title: '{{t("Show linkto")}}', - component: 'ActionInitializer', - schema: { - title: '{{t("Select view")}}', - 'x-component': 'GanttV2.ViewSelect', - 'x-action': `gantt:showLinkto`, - 'x-align': 'right', - 'x-designer': 'Action.Designer', - }, - }, - { - type: 'item', - title: "{{t('Time range')}}", - component: 'FilterActionInitializer', - schema: { - 'x-align': 'right', - }, - }, + // { + // type: 'item', + // title: '{{t("Show linkto")}}', + // component: 'ActionInitializer', + // schema: { + // title: '{{t("Select view")}}', + // 'x-component': 'GanttV2.ViewSelect', + // 'x-action': `gantt:showLinkto`, + // 'x-align': 'right', + // 'x-designer': 'Action.Designer', + // }, + // }, { type: 'item', title: "{{t('Filter')}}", diff --git a/packages/core/client/src/schema-initializer/items/GanttBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/GanttBlockInitializer.tsx index d8abe80970..d7346010f8 100644 --- a/packages/core/client/src/schema-initializer/items/GanttBlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/GanttBlockInitializer.tsx @@ -37,6 +37,14 @@ export const GanttBlockInitializer = (props) => { value: field.name, }; }); + const numberFields = collectionFields + ?.filter((field) => field.type === 'double') + ?.map((field) => { + return { + label: field?.uiSchema?.title, + value: field.name, + }; + }); const values = await FormDialog(t('Create gantt block'), () => { return ( @@ -64,6 +72,12 @@ export const GanttBlockInitializer = (props) => { enum: dateFields, 'x-component': 'Select', 'x-decorator': 'FormItem', + }, + progress: { + title: t('Progress field'), + enum: numberFields, + 'x-component': 'Select', + 'x-decorator': 'FormItem', }, range: { title: t('Time range'),