Skip to content

Commit 19daed4

Browse files
committed
fix: fix bugs
1 parent a4b30ae commit 19daed4

File tree

3 files changed

+34
-38
lines changed

3 files changed

+34
-38
lines changed

apps/react-storybook/stories/scheduler/SchedulerFormCustomization.stories.tsx

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -381,12 +381,6 @@ export const LegacyPopup: Story = {
381381
form: {
382382
onContentReady: function (e) {
383383
form = e.component;
384-
const onValueChanged = form.getEditor("startDateEditor").option("onValueChanged");
385-
386-
form.getEditor("startDateEditor").option("onValueChanged", (e) => {
387-
onValueChanged(e);
388-
form.getEditor("recurrenceStartDateEditor")?.option("value", e.value);
389-
});
390384
},
391385
iconsShowMode: "both",
392386
items: [
@@ -408,23 +402,25 @@ export const LegacyPopup: Story = {
408402
onValueChanged: (e) => {
409403
if (e.value === true) {
410404
form.option("colCount", 2);
411-
form.itemOption("recurrenceGroup", "cssClass", "");
412405

413-
const onValueChanged = form.getEditor("repeatEditor").option("onValueChanged");
414-
form.getEditor("repeatEditor").option("value", "daily");
415-
onValueChanged({ ...e, value: "daily" });
406+
const recurrenceRule = form.option('formData').recurrenceRule;
407+
408+
form.option('formData', {
409+
...form.option('formData'),
410+
recurrenceRule: recurrenceRule ? form.option('formData')?.recurrenceRule : "FREQ=DAILY"
411+
})
412+
form.itemOption("recurrenceGroup", "cssClass", "");
416413
} else {
417414
form.option("colCount", 1);
415+
form.option('formData', {
416+
...form.option('formData'),
417+
recurrenceRule: ""
418+
})
418419
form.itemOption("recurrenceGroup", "cssClass", "dx-hidden");
419-
420-
const onValueChanged = form.getEditor("repeatEditor").option("onValueChanged");
421-
form.getEditor("repeatEditor").option("value", "never");
422-
onValueChanged({ ...e, value: "never" });
423420
}
424421
},
425422
},
426423
},
427-
{ name: "repeatEditor", colCount: 0, cssClass: "dx-hidden" },
428424
],
429425
},
430426
"resourcesGroup",
@@ -435,10 +431,6 @@ export const LegacyPopup: Story = {
435431
name: "recurrenceGroup",
436432
itemType: "group",
437433
items: [
438-
{
439-
name: "recurrenceStartDateEditor",
440-
cssClass: "dx-hidden",
441-
},
442434
"recurrenceRuleGroup",
443435
"recurrenceEndGroup",
444436
],

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -847,22 +847,6 @@ export class AppointmentForm {
847847
}
848848
}
849849

850-
showRecurrenceGroup(): void {
851-
const currentHeight = this.dxPopup.option('height') as string | number | undefined;
852-
853-
if (currentHeight === 'auto' || currentHeight === undefined) {
854-
const overlayHeight = this.dxPopup.$overlayContent().get(0).clientHeight;
855-
this.dxPopup.option('height', overlayHeight);
856-
}
857-
858-
this._$mainGroup?.addClass(CLASSES.mainHidden);
859-
this._$mainGroup?.attr('tabindex', '-1');
860-
this._$recurrenceGroup?.removeClass(CLASSES.recurrenceHidden);
861-
this._$recurrenceGroup?.removeAttr('tabindex');
862-
863-
this._popup.updateToolbarForRecurrenceGroup();
864-
}
865-
866850
showMainGroup(): void {
867851
const currentHeight = this.dxPopup.option('height') as string | number | undefined;
868852
const editingConfig = this.scheduler.getEditingConfig();
@@ -880,6 +864,22 @@ export class AppointmentForm {
880864
this._popup.updateToolbarForMainGroup();
881865
}
882866

867+
showRecurrenceGroup(): void {
868+
const currentHeight = this.dxPopup.option('height') as string | number | undefined;
869+
870+
if (currentHeight === 'auto' || currentHeight === undefined) {
871+
const overlayHeight = this.dxPopup.$overlayContent().get(0).clientHeight;
872+
this.dxPopup.option('height', overlayHeight);
873+
}
874+
875+
this._$mainGroup?.addClass(CLASSES.mainHidden);
876+
this._$mainGroup?.attr('tabindex', '-1');
877+
this._$recurrenceGroup?.removeClass(CLASSES.recurrenceHidden);
878+
this._$recurrenceGroup?.removeAttr('tabindex');
879+
880+
this._popup.updateToolbarForRecurrenceGroup();
881+
}
882+
883883
saveRecurrenceValue(): void {
884884
const { recurrenceRule } = this._recurrenceForm;
885885
const { recurrenceRuleExpr } = this.scheduler.getDataAccessors().expr;

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ export class RecurrenceForm {
179179

180180
setReadOnly(value: boolean): void {
181181
this._readOnly = value;
182+
this.updateWeekDaysButtons();
182183
}
183184

184185
createRecurrenceFormGroup(): GroupItem {
@@ -350,6 +351,11 @@ export class RecurrenceForm {
350351
disabled: this._readOnly,
351352
onContentReady: (e): void => {
352353
$(e.element).removeClass('dx-button-has-text');
354+
355+
const isSelected = this.recurrenceRule.byDay.includes(item.key);
356+
357+
e.component.option('stylingMode', isSelected ? 'contained' : 'outlined');
358+
e.component.option('type', isSelected ? 'default' : 'normal');
353359
},
354360
onClick: (): void => {
355361
const isSelected = this.recurrenceRule.byDay.includes(item.key);
@@ -587,8 +593,6 @@ export class RecurrenceForm {
587593
}
588594

589595
private updateDayEditorsVisibility(): void {
590-
this.dxForm.beginUpdate();
591-
592596
const recurrencePatternGroupPath = `${RECURRENCE_GROUP_NAME}.${GROUP_NAMES.recurrenceRuleGroup}.${GROUP_NAMES.recurrencePatternGroup}`;
593597

594598
const daysOfWeekGroup = `${recurrencePatternGroupPath}.${GROUP_NAMES.recurrenceDaysOfWeekEditor}`;
@@ -613,7 +617,6 @@ export class RecurrenceForm {
613617
break;
614618
}
615619

616-
this.dxForm.endUpdate();
617620
this.updateWeekDaysButtons();
618621
}
619622

@@ -623,6 +626,7 @@ export class RecurrenceForm {
623626

624627
button.option('stylingMode', isSelected ? 'contained' : 'outlined');
625628
button.option('type', isSelected ? 'default' : 'normal');
629+
button.option('disabled', this._readOnly);
626630
});
627631
}
628632
}

0 commit comments

Comments
 (0)