Skip to content

Commit 5625e71

Browse files
Scheduler: Appointment form customization
1 parent 8d9ffd4 commit 5625e71

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

packages/devextreme/js/__internal/scheduler/appointment_popup/appointment_popup.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,28 @@ describe('Appointment Popup Form', () => {
13391339
});
13401340
});
13411341

1342+
describe('Form custimization', () => {
1343+
it('should propagate editing.form options to the form instance', async () => {
1344+
const { scheduler, POM } = await createScheduler({
1345+
...getDefaultConfig(),
1346+
editing: {
1347+
allowAdding: true,
1348+
allowUpdating: true,
1349+
form: {
1350+
height: 500,
1351+
},
1352+
},
1353+
});
1354+
1355+
scheduler.showAppointmentPopup(commonAppointment);
1356+
1357+
const { form } = POM.popup;
1358+
const formHeight = form.option('height') as number;
1359+
1360+
expect(formHeight).toBe(500);
1361+
});
1362+
});
1363+
13421364
it('should update form data after another appointment was open', async () => {
13431365
const { scheduler, POM } = await createScheduler(getDefaultConfig());
13441366

packages/devextreme/js/__internal/scheduler/appointment_popup/m_form.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ export class AppointmentForm {
236236

237237
private createForm(items: FormProperties['items']): dxForm {
238238
const element = $('<div>');
239+
const editingConfig = this.scheduler.getEditingConfig();
240+
const userFormOptions = editingConfig?.form ?? {};
239241

240242
return this.scheduler.createComponent(element, dxForm, {
241243
items,

packages/devextreme/js/ui/scheduler.d.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030

3131
import dxDraggable from './draggable';
3232

33-
import dxForm, { Item as FormItem } from './form';
33+
import dxForm, { Properties as FormProperties } from './form';
3434
import dxPopup, { Properties as PopupProperties } from './popup';
3535

3636
import dxSortable from './sortable';
@@ -633,17 +633,10 @@ export interface dxSchedulerOptions extends WidgetOptions<dxScheduler> {
633633
allowUpdating?: boolean;
634634
/**
635635
* @docid
636-
* @default undefined
637636
* @public
637+
* @type dxFormOptions
638638
*/
639-
form?: {
640-
/**
641-
* @docid
642-
* @type Array<dxFormSimpleItem | dxFormGroupItem | dxFormTabbedItem | dxFormEmptyItem | dxFormButtonItem>
643-
* @default []
644-
* @public
645-
*/
646-
items?: Array<FormItem>;
639+
form?: FormProperties & {
647640
/**
648641
* @docid
649642
* @type_function_param1 formData:object

0 commit comments

Comments
 (0)