Skip to content
Open
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
Expand Up @@ -14,6 +14,7 @@ import {
AppointmentDataAccessor,
} from '../../utils/data_accessor/appointment_data_accessor';
import type { IFieldExpr } from '../../utils/data_accessor/types';
import type { ResourceConfig } from '../../utils/loader/types';
import {
ResourceManager,
} from '../../utils/resource_manager/resource_manager';
Expand Down Expand Up @@ -64,6 +65,7 @@ interface CreateAppointmentPopupOptions {
firstDayOfWeek?: number;
startDayHour?: number;
timeZone?: string;
resources?: ResourceConfig[];
onAppointmentFormOpening?: (...args: unknown[]) => void;
onSave?: jest.Mock<(appointment: Record<string, unknown>) => PromiseLike<unknown>>;
title?: string;
Expand Down Expand Up @@ -106,10 +108,16 @@ export const createAppointmentPopup = async (
document.body.appendChild(container);

const dataAccessors = new AppointmentDataAccessor(DEFAULT_FIELDS, false);
const resourceManager = new ResourceManager([]);
const resourceManager = new ResourceManager(options.resources ?? []);
const timeZoneCalculator = createTimeZoneCalculator(options.timeZone ?? NO_TIMEZONE);
const editing = { ...DEFAULT_EDITING, ...options.editing };

if (options.resources?.length) {
await Promise.all(
resourceManager.resources.map((r) => r.load()),
);
}
Comment thread
bit-byte0 marked this conversation as resolved.

const addAppointment = options.addAppointment
?? jest.fn(resolvedDeferred);
const updateAppointment = options.updateAppointment
Expand Down Expand Up @@ -187,6 +195,7 @@ export const createAppointmentPopup = async (

const dispose = (): void => {
popup.dispose();
resourceManager.dispose();
container.remove();
};

Expand Down
Loading
Loading