Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Employee } from './data';
import type { Employee } from './data';

interface EmployeeCardProps {
employee: Employee;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import EmployeeCard from './EmployeeCard.tsx';
import { Employee } from './data';
import type { Employee } from './data';

interface EmployeeGalleryProps {
employees: Employee[];
Expand Down
6 changes: 4 additions & 2 deletions apps/demos/Demos/Scheduler/AllDayPanelMode/React/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { useCallback, useState } from 'react';
import Scheduler, { type SchedulerTypes } from 'devextreme-react/scheduler';
import RadioGroup, { type RadioGroupTypes } from 'devextreme-react/radio-group';
import Scheduler from 'devextreme-react/scheduler';
import RadioGroup from 'devextreme-react/radio-group';
import type { SchedulerTypes } from 'devextreme-react/scheduler';
import type { RadioGroupTypes } from 'devextreme-react/radio-group';
import { data } from './data.ts';

const currentDate = new Date(2021, 2, 28);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import Scheduler, { Resource, type SchedulerTypes } from 'devextreme-react/scheduler';
import Scheduler, { Resource } from 'devextreme-react/scheduler';
import type { SchedulerTypes } from 'devextreme-react/scheduler';

import { data, resourcesData } from './data.ts';

Expand Down
3 changes: 2 additions & 1 deletion apps/demos/Demos/Scheduler/BasicViews/React/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import Scheduler, { type SchedulerTypes } from 'devextreme-react/scheduler';
import Scheduler from 'devextreme-react/scheduler';
import type { SchedulerTypes } from 'devextreme-react/scheduler';

import { data } from './data.ts';

Expand Down
9 changes: 5 additions & 4 deletions apps/demos/Demos/Scheduler/CellTemplates/React/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ const notifyDisableDate = () => {
};

const onContentReady = (e: SchedulerTypes.ContentReadyEvent) => {
setComponentAria(e.component?.$element());
const element = e.component?.element();
element && setComponentAria(element);
};

const applyDisableDatesToDateEditors = (form: ReturnType<FormRef['instance']>) => {
Expand Down Expand Up @@ -75,11 +76,11 @@ const onAppointmentUpdating = (e: SchedulerTypes.AppointmentUpdatingEvent) => {
}
};

const setComponentAria = (element) => {
const prevAria = element?.attr('aria-label') || '';
const setComponentAria = (element: HTMLElement) => {
const prevAria = element.getAttribute('aria-label') || '';
const description = ariaDescription();
const nextAria = `${prevAria}${description ? ` ${description}` : ''}`;
element?.attr('aria-label', nextAria);
element.setAttribute('aria-label', nextAria);
};

const App = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { type SchedulerTypes } from 'devextreme-react/scheduler';
import type { SchedulerTypes } from 'devextreme-react/scheduler';
import Utils from './utils.ts';

interface DateCellProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const TimeCell = (props: TimeCellProps) => {
const hasCoffeeCupIcon = Utils.hasCoffeeCupIcon(date);

return (
<div className={isDinner ? 'dinner' : null}>
<div className={isDinner ? 'dinner' : undefined}>
{text}
{hasCoffeeCupIcon && <div className='cafe' />}
</div>
Expand Down
6 changes: 3 additions & 3 deletions apps/demos/Demos/Scheduler/CellTemplates/React/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ export default class Utils {
}

static isValidAppointment(component: SchedulerTypes.AppointmentAddingEvent['component'], appointmentData: SchedulerTypes.AppointmentAddingEvent['appointmentData']) {
const startDate = new Date(appointmentData.startDate);
const endDate = new Date(appointmentData.endDate);
const cellDuration = component.option('cellDuration');
const startDate = appointmentData.startDate ? new Date(appointmentData.startDate) : new Date();
const endDate = appointmentData.endDate ? new Date(appointmentData.endDate) : new Date();
const cellDuration = Number(component.option('cellDuration'));
return Utils.isValidAppointmentInterval(startDate, endDate, cellDuration);
}

Expand Down
7 changes: 4 additions & 3 deletions apps/demos/Demos/Scheduler/CellTemplates/ReactJs/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ const notifyDisableDate = () => {
);
};
const onContentReady = (e) => {
setComponentAria(e.component?.$element());
const element = e.component?.element();
element && setComponentAria(element);
};
const applyDisableDatesToDateEditors = (form) => {
const startDateEditor = form.getEditor('startDate');
Expand Down Expand Up @@ -70,10 +71,10 @@ const onAppointmentUpdating = (e) => {
}
};
const setComponentAria = (element) => {
const prevAria = element?.attr('aria-label') || '';
const prevAria = element.getAttribute('aria-label') || '';
const description = ariaDescription();
const nextAria = `${prevAria}${description ? ` ${description}` : ''}`;
element?.attr('aria-label', nextAria);
element.setAttribute('aria-label', nextAria);
};
const App = () => {
const [currentView, setCurrentView] = useState(views[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const TimeCell = (props) => {
const isDinner = Utils.isDinner(date);
const hasCoffeeCupIcon = Utils.hasCoffeeCupIcon(date);
return (
<div className={isDinner ? 'dinner' : null}>
<div className={isDinner ? 'dinner' : undefined}>
{text}
{hasCoffeeCupIcon && <div className="cafe" />}
</div>
Expand Down
6 changes: 3 additions & 3 deletions apps/demos/Demos/Scheduler/CellTemplates/ReactJs/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export default class Utils {
}

static isValidAppointment(component, appointmentData) {
const startDate = new Date(appointmentData.startDate);
const endDate = new Date(appointmentData.endDate);
const cellDuration = component.option('cellDuration');
const startDate = appointmentData.startDate ? new Date(appointmentData.startDate) : new Date();
const endDate = appointmentData.endDate ? new Date(appointmentData.endDate) : new Date();
const cellDuration = Number(component.option('cellDuration'));
return Utils.isValidAppointmentInterval(startDate, endDate, cellDuration);
}

Expand Down
2 changes: 1 addition & 1 deletion apps/demos/Demos/Scheduler/CellTemplates/Vue/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type DxScheduler } from 'devextreme-vue';
import type { DxScheduler } from 'devextreme-vue';
import { dinnerTime, holidays } from './data.ts';

export default class Utils {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { type DxContextMenuTypes } from 'devextreme-angular/ui/context-menu';
import type { DxContextMenuTypes } from 'devextreme-angular/ui/context-menu';

export interface Appointment {
text: string;
Expand Down
4 changes: 2 additions & 2 deletions apps/demos/Demos/Scheduler/ContextMenu/React/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const appointmentClassName = '.dx-scheduler-appointment';
const cellClassName = '.dx-scheduler-date-table-cell';

const onContextMenuItemClick = (e: ContextMenuTypes.ItemClickEvent<ContextMenuItem>) => {
e.itemData.onItemClick?.(e);
e.itemData?.onItemClick?.(e);
};

const App = () => {
Expand All @@ -35,7 +35,7 @@ const App = () => {
...item,
onItemClick: (e: ContextMenuTypes.ItemClickEvent<ContextMenuItem>) => scheduler?.updateAppointment(appointmentData, {
...appointmentData,
...{ roomId: [e.itemData.id] },
...{ roomId: [e.itemData?.id] },
}),
}));

Expand Down
2 changes: 1 addition & 1 deletion apps/demos/Demos/Scheduler/ContextMenu/React/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { SchedulerTypes } from 'devextreme-react/scheduler';
import { type ContextMenuTypes } from 'devextreme-react/context-menu';
import type { ContextMenuTypes } from 'devextreme-react/context-menu';

export type Appointment = SchedulerTypes.Appointment & { roomId: number[] };

Expand Down
4 changes: 2 additions & 2 deletions apps/demos/Demos/Scheduler/ContextMenu/ReactJs/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const views = ['day', 'month'];
const appointmentClassName = '.dx-scheduler-appointment';
const cellClassName = '.dx-scheduler-date-table-cell';
const onContextMenuItemClick = (e) => {
e.itemData.onItemClick?.(e);
e.itemData?.onItemClick?.(e);
};
const App = () => {
const schedulerRef = useRef(null);
Expand All @@ -26,7 +26,7 @@ const App = () => {
onItemClick: (e) =>
scheduler?.updateAppointment(appointmentData, {
...appointmentData,
...{ roomId: [e.itemData.id] },
...{ roomId: [e.itemData?.id] },
}),
}));
setTarget(appointmentClassName);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import React, { useCallback, useState } from 'react';
import Scheduler, { Resource, type SchedulerTypes } from 'devextreme-react/scheduler';
import { Switch, type SwitchTypes } from 'devextreme-react/switch';
import { NumberBox, type NumberBoxTypes } from 'devextreme-react/number-box';
import Scheduler, { Resource } from 'devextreme-react/scheduler';
import { Switch } from 'devextreme-react/switch';
import { NumberBox } from 'devextreme-react/number-box';
import type { SchedulerTypes } from 'devextreme-react/scheduler';
import type { SwitchTypes } from 'devextreme-react/switch';
import type { NumberBoxTypes } from 'devextreme-react/number-box';

import { data, moviesData } from './data.ts';
import AppointmentTemplate from './AppointmentTemplate.tsx';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<script setup lang="ts">
import { query as Query } from 'devextreme-vue/common/data';
import { type DxSchedulerTypes } from 'devextreme-vue/scheduler';
import type { DxSchedulerTypes } from 'devextreme-vue/scheduler';
import { moviesData } from './data.ts';

const props = defineProps<{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import Scheduler, { type SchedulerTypes } from 'devextreme-react/scheduler';
import Scheduler from 'devextreme-react/scheduler';
import type { SchedulerTypes } from 'devextreme-react/scheduler';

import { data } from './data.ts';

Expand Down
6 changes: 3 additions & 3 deletions apps/demos/Demos/Scheduler/Editing/React/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ const showToast = (event: string, value: string, type: string) => {
};

const showAddedToast = (e: SchedulerTypes.AppointmentAddedEvent) => {
showToast('Added', e.appointmentData.text, 'success');
showToast('Added', e.appointmentData.text ?? '', 'success');
};

const showUpdatedToast = (e: SchedulerTypes.AppointmentUpdatedEvent) => {
showToast('Updated', e.appointmentData.text, 'info');
showToast('Updated', e.appointmentData.text ?? '', 'info');
};

const showDeletedToast = (e: SchedulerTypes.AppointmentDeletedEvent) => {
showToast('Deleted', e.appointmentData.text, 'warning');
showToast('Deleted', e.appointmentData.text ?? '', 'warning');
};

const App = () => {
Expand Down
6 changes: 3 additions & 3 deletions apps/demos/Demos/Scheduler/Editing/ReactJs/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ const showToast = (event, value, type) => {
notify(`${event} "${value}" task`, type, 800);
};
const showAddedToast = (e) => {
showToast('Added', e.appointmentData.text, 'success');
showToast('Added', e.appointmentData.text ?? '', 'success');
};
const showUpdatedToast = (e) => {
showToast('Updated', e.appointmentData.text, 'info');
showToast('Updated', e.appointmentData.text ?? '', 'info');
};
const showDeletedToast = (e) => {
showToast('Deleted', e.appointmentData.text, 'warning');
showToast('Deleted', e.appointmentData.text ?? '', 'warning');
};
const App = () => {
const [allowAdding, setAllowAdding] = useState(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import 'whatwg-fetch';
import React from 'react';

import Scheduler, { type SchedulerTypes } from 'devextreme-react/scheduler';
import Scheduler from 'devextreme-react/scheduler';
import type { SchedulerTypes } from 'devextreme-react/scheduler';
import type { LoadOptions } from 'devextreme/data';

import { CustomStore } from 'devextreme-react/common/data';

const getData = async (_, requestOptions) => {
const getData = async (_: LoadOptions, requestOptions: RequestInit & { showDeleted: boolean }) => {
const GOOGLE_CALENDAR_URL = 'https://www.googleapis.com/calendar/v3/calendars/';
const CALENDAR_ID = '[email protected]';
const PUBLIC_KEY = 'AIzaSyBnNAISIUKe6xdhq1_rjor2rxoI3UlMY7k';
Expand Down
3 changes: 2 additions & 1 deletion apps/demos/Demos/Scheduler/GroupByDate/React/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useCallback, useState } from 'react';

import Switch, { type SwitchTypes } from 'devextreme-react/switch';
import Switch from 'devextreme-react/switch';
import type { SwitchTypes } from 'devextreme-react/switch';
import Scheduler, { Resource, View } from 'devextreme-react/scheduler';
import { data, priorityData } from './data.ts';

Expand Down
3 changes: 2 additions & 1 deletion apps/demos/Demos/Scheduler/Overview/React/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import Scheduler, { Resource, type SchedulerTypes } from 'devextreme-react/scheduler';
import Scheduler, { Resource } from 'devextreme-react/scheduler';
import type { SchedulerTypes } from 'devextreme-react/scheduler';

import { employees, data } from './data.ts';
import DataCell from './DataCell.tsx';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import Scheduler, { Resource, type SchedulerTypes } from 'devextreme-react/scheduler';
import Scheduler, { Resource } from 'devextreme-react/scheduler';
import type { SchedulerTypes } from 'devextreme-react/scheduler';

import { data, resourcesData } from './data.ts';

Expand Down
3 changes: 2 additions & 1 deletion apps/demos/Demos/Scheduler/Resources/React/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import Scheduler, {
type SchedulerTypes,
} from 'devextreme-react/scheduler';

import RadioGroup, { type RadioGroupTypes } from 'devextreme-react/radio-group';
import RadioGroup from 'devextreme-react/radio-group';
import type { RadioGroupTypes } from 'devextreme-react/radio-group';

import {
data, assignees, rooms, priorities, resourcesList,
Expand Down
3 changes: 2 additions & 1 deletion apps/demos/Demos/Scheduler/SignalRService/React/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import Scheduler, { type SchedulerTypes } from 'devextreme-react/scheduler';
import Scheduler from 'devextreme-react/scheduler';
import type { SchedulerTypes } from 'devextreme-react/scheduler';

import * as AspNetData from 'devextreme-aspnet-data-nojquery';

Expand Down
3 changes: 2 additions & 1 deletion apps/demos/Demos/Scheduler/SimpleArray/React/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import Scheduler, { type SchedulerTypes } from 'devextreme-react/scheduler';
import Scheduler from 'devextreme-react/scheduler';
import type { SchedulerTypes } from 'devextreme-react/scheduler';

import { data } from './data.ts';

Expand Down
Loading
Loading