|
| 1 | +import type { Meta, StoryObj } from "@storybook/react-webpack5"; |
| 2 | +import dxScheduler from "devextreme/ui/scheduler"; |
| 3 | +import { wrapDxWithReact } from "../utils"; |
| 4 | +import { resources } from "./data"; |
| 5 | + |
| 6 | +const Scheduler = wrapDxWithReact(dxScheduler); |
| 7 | + |
| 8 | +const data = [ |
| 9 | + { text: '1 minute', roomId: 1, assigneeId: [1], priorityId: 1, startDate: new Date(2026, 2, 15, 10, 0), endDate: new Date(2026, 2, 15, 10, 1) }, |
| 10 | + { text: '5 minutes', roomId: 1, assigneeId: [2], priorityId: 1, startDate: new Date(2026, 2, 16, 10, 0), endDate: new Date(2026, 2, 16, 10, 5) }, |
| 11 | + { text: '15 minutes', roomId: 2, assigneeId: [3], priorityId: 2, startDate: new Date(2026, 2, 17, 10, 0), endDate: new Date(2026, 2, 17, 10, 15) }, |
| 12 | + { text: '30 minutes', roomId: 2, assigneeId: [1], priorityId: 2, startDate: new Date(2026, 2, 18, 10, 0), endDate: new Date(2026, 2, 18, 10, 30) }, |
| 13 | + { text: '46 minutes', roomId: 3, assigneeId: [2], priorityId: 1, startDate: new Date(2026, 2, 19, 10, 0), endDate: new Date(2026, 2, 19, 10, 46) }, |
| 14 | + { text: '1 hour', roomId: 2, assigneeId: [4], priorityId: 1, startDate: new Date(2026, 2, 20, 10, 0), endDate: new Date(2026, 2, 20, 11, 0) }, |
| 15 | +]; |
| 16 | + |
| 17 | +const viewNames = ['day', 'week', 'workWeek', 'month', 'agenda', 'timelineDay', 'timelineWeek', 'timelineWorkWeek', 'timelineMonth']; |
| 18 | + |
| 19 | +const meta: Meta<typeof Scheduler> = { |
| 20 | + title: 'Components/Scheduler/SnapToCellsMode', |
| 21 | + component: Scheduler, |
| 22 | + parameters: { layout: 'padded' }, |
| 23 | +}; |
| 24 | +export default meta; |
| 25 | + |
| 26 | +type Story = StoryObj<typeof Scheduler>; |
| 27 | + |
| 28 | +export const Overview: Story = { |
| 29 | + args: { |
| 30 | + height: 600, |
| 31 | + views: viewNames, |
| 32 | + currentView: 'week', |
| 33 | + currentDate: new Date(2026, 2, 15), |
| 34 | + startDayHour: 9, |
| 35 | + endDayHour: 22, |
| 36 | + dataSource: data, |
| 37 | + resources, |
| 38 | + snapToCellsMode: 'auto', |
| 39 | + }, |
| 40 | + argTypes: { |
| 41 | + height: { control: 'number' }, |
| 42 | + views: { control: 'object' }, |
| 43 | + snapToCellsMode: { control: 'select', options: ['always', 'auto', 'never'] }, |
| 44 | + currentView: { control: 'select', options: viewNames }, |
| 45 | + }, |
| 46 | +}; |
| 47 | + |
| 48 | +export const PerViewOverrides: Story = { |
| 49 | + args: { |
| 50 | + height: 600, |
| 51 | + views: viewNames, |
| 52 | + currentView: 'timelineMonth', |
| 53 | + currentDate: new Date(2026, 2, 15), |
| 54 | + startDayHour: 9, |
| 55 | + endDayHour: 22, |
| 56 | + dataSource: data, |
| 57 | + resources, |
| 58 | + snapToCellsMode: 'never', |
| 59 | + }, |
| 60 | + argTypes: { |
| 61 | + height: { control: 'number' }, |
| 62 | + views: { control: 'object' }, |
| 63 | + snapToCellsMode: { control: 'select', options: ['always', 'auto', 'never'] }, |
| 64 | + currentView: { control: 'select', options: viewNames }, |
| 65 | + }, |
| 66 | +}; |
0 commit comments