Skip to content

Commit 12ab206

Browse files
committed
set agenda's geometry
1 parent 92ce255 commit 12ab206

3 files changed

Lines changed: 37 additions & 0 deletions

File tree

packages/devextreme/js/__internal/scheduler/appointments_new/appointment/agenda_appointment.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ const getAgendaAppointmentProperties = (
2525
modifiers: {
2626
isLastInGroup: false,
2727
},
28+
geometry: {
29+
height: 50,
30+
width: '100%',
31+
},
2832
getResourcesValues: (): Promise<AppointmentResource[]> => Promise.resolve([]),
2933
};
3034
};
@@ -195,4 +199,21 @@ describe('AgendaAppointment', () => {
195199
expect($resourceItems.length).toBe(0);
196200
});
197201
});
202+
203+
describe('Geometry', () => {
204+
it('should have correct height and width', async () => {
205+
const instance = await createAgendaAppointment(
206+
getAgendaAppointmentProperties({
207+
...defaultAppointmentData,
208+
geometry: {
209+
height: 60,
210+
width: '80%',
211+
},
212+
}),
213+
);
214+
215+
expect(instance.$element().css('height')).toBe('60px');
216+
expect(instance.$element().css('width')).toBe('80%');
217+
});
218+
});
198219
});

packages/devextreme/js/__internal/scheduler/appointments_new/appointment/agenda_appointment.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ export interface AgendaAppointmentProperties extends BaseAppointmentProperties {
1414
isLastInGroup: boolean;
1515
};
1616

17+
geometry: {
18+
height: number;
19+
width: string;
20+
};
21+
1722
getResourcesValues: (
1823
appointmentData: SafeAppointment,
1924
) => Promise<AppointmentResource[]>;
@@ -27,6 +32,13 @@ export class AgendaAppointment extends BaseAppointment<AgendaAppointmentProperti
2732
.toggleClass(AGENDA_APPOINTMENT_CLASSES.LAST_IN_DATE, this.option().modifiers.isLastInGroup);
2833
}
2934

35+
public override resize(): void {
36+
this.$element().css({
37+
height: this.option().geometry.height,
38+
width: this.option().geometry.width,
39+
});
40+
}
41+
3042
protected override defaultAppointmentContent(
3143
$container: dxElementWrapper,
3244
): dxElementWrapper {

packages/devextreme/js/__internal/scheduler/appointments_new/appointments.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ export class Appointments extends DOMComponent<Appointments, AppointmentsPropert
268268
modifiers: {
269269
isLastInGroup: appointmentViewModel.isLastInGroup,
270270
},
271+
geometry: {
272+
height: appointmentViewModel.height,
273+
width: appointmentViewModel.width,
274+
},
271275
getResourcesValues: this.getResourcesValues.bind(this),
272276
},
273277
);

0 commit comments

Comments
 (0)