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
Expand Up @@ -19,7 +19,7 @@ import type { Properties as SchedulerProperties } from '@js/ui/scheduler';
import { current, isFluent } from '@js/ui/themes';
import errors from '@js/ui/widget/ui.errors';

import { hide as hideLoading, show as showLoading } from '../m_loading';
import { hide as hideLoading, show as showLoading } from '../loading';
import type { TimeZoneCalculator } from '../r1/timezone_calculator/calculator';
import type { SafeAppointment } from '../types';
import { AppointmentAdapter } from '../utils/appointment_adapter/appointment_adapter';
Expand Down Expand Up @@ -338,7 +338,7 @@ export class AppointmentPopup {

return this.config.onSave(appointment);
})
.then(() => { hideLoading(); })
.then(() => { hideLoading().catch(noop); })
.catch(noop);
}

Expand All @@ -357,14 +357,14 @@ export class AppointmentPopup {
}

private showLoadPanel(): void {
const container = this.popupInstance?.$overlayContent();
const container = this.popupInstance?.$overlayContent().get(0);

showLoading({
container,
Comment thread
bit-byte0 marked this conversation as resolved.
position: {
of: container,
},
});
}).catch(noop);
}

private tryLockSaveChanges(): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import $ from '@js/core/renderer';

import {
APPOINTMENT_CONTENT_CLASSES,
} from '../../m_classes';
} from '../../classes';
import { Appointment } from './m_appointment';

export class AgendaAppointment extends Appointment {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
REDUCED_APPOINTMENT_CLASS,
REDUCED_APPOINTMENT_ICON,
REDUCED_APPOINTMENT_PARTS_CLASSES,
} from '../../m_classes';
} from '../../classes';
import type { SubscribeKey, SubscribeMethods } from '../../m_subscribes';
import { validateRRule } from '../../recurrence/validate_rule';
import type { AppointmentDataAccessor } from '../../utils/data_accessor/appointment_data_accessor';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import { dateUtilsTs } from '@ts/core/utils/date';
import type { SupportedKeys } from '@ts/core/widget/widget';
import CollectionWidget from '@ts/ui/collection/collection_widget.edit';

import { APPOINTMENT_SETTINGS_KEY } from '../constants';
import {
AGENDA_LAST_IN_DATE_APPOINTMENT_CLASS,
APPOINTMENT_CONTENT_CLASSES,
APPOINTMENT_DRAG_SOURCE_CLASS,
APPOINTMENT_ITEM_CLASS,
} from '../m_classes';
} from '../classes';
import { APPOINTMENT_SETTINGS_KEY } from '../constants';
import timeZoneUtils from '../m_utils_time_zone';
import type { CompactAppointmentOptions } from '../types';
import { AppointmentAdapter } from '../utils/appointment_adapter/appointment_adapter';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import messageLocalization from '@js/common/core/localization/message';
import domAdapter from '@js/core/dom_adapter';
import $ from '@js/core/renderer';

import { APPOINTMENT_CONTENT_CLASSES } from '../m_classes';
import { APPOINTMENT_CONTENT_CLASSES } from '../classes';

const allDayText = ` ${messageLocalization.format('dxScheduler-allDay')}: `;
const recurringText = messageLocalization.format('dxScheduler-appointmentAriaLabel-recurring');
Expand Down
42 changes: 42 additions & 0 deletions packages/devextreme/js/__internal/scheduler/loading.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import $ from '@js/core/renderer';
import { value as viewPort } from '@js/core/utils/view_port';
import type { Properties as LoadPanelProperties } from '@js/ui/load_panel';
import LoadPanel from '@js/ui/load_panel';

type LoadPanelInstance = InstanceType<typeof LoadPanel>;

let loading: LoadPanelInstance | null = null;

const createLoadPanel = (options?: LoadPanelProperties): LoadPanelInstance => {
const $container = $('<div>').appendTo(options?.container ?? viewPort());
return new LoadPanel($container.get(0), options);
};

const removeLoadPanel = (): void => {
if (!loading) {
return;
}

loading.$element().remove();
loading = null;
};

export function show(options?: LoadPanelProperties): Promise<boolean> {
removeLoadPanel();
loading = createLoadPanel(options);
return loading.show();
}

export function hide(): Promise<boolean | undefined> {
if (!loading) {
return Promise.resolve(undefined);
}

const instance = loading;
return instance.hide().then((result) => {
if (loading === instance) {
removeLoadPanel();
}
return result;
Comment thread
bit-byte0 marked this conversation as resolved.
});
Comment thread
bit-byte0 marked this conversation as resolved.
Comment thread
bit-byte0 marked this conversation as resolved.
}
41 changes: 0 additions & 41 deletions packages/devextreme/js/__internal/scheduler/m_loading.ts

This file was deleted.

20 changes: 11 additions & 9 deletions packages/devextreme/js/__internal/scheduler/m_scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ import { Appointments } from './appointments_new/appointments';
import NotifyScheduler from './base/widget_notify_scheduler';
import { SchedulerHeader } from './header/header';
import type { HeaderOptions } from './header/types';
import { hide as hideLoading, show as showLoading } from './loading';
import { CompactAppointmentsHelper } from './m_compact_appointments_helper';
import { hide as hideLoading, show as showLoading } from './m_loading';
import type { SubscribeKey, SubscribeMethods } from './m_subscribes';
import subscribes from './m_subscribes';
import { utils } from './m_utils';
Expand Down Expand Up @@ -689,20 +689,22 @@ class Scheduler extends SchedulerOptionsBaseWidget {

if (this._dataSource) {
this._dataSource.load().done(() => {
hideLoading();
hideLoading().catch(noop);

this._fireContentReadyAction(result);
}).fail(() => {
hideLoading();
hideLoading().catch(noop);
result.reject();
});

this._dataSource.isLoading() && showLoading({
container: this.$element(),
position: {
of: this.$element(),
},
});
if (this._dataSource.isLoading()) {
showLoading({
container: this.$element().get(0),
position: {
of: this.$element() as any,
},
}).catch(noop);
}
Comment thread
bit-byte0 marked this conversation as resolved.
} else {
this._fireContentReadyAction(result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import dateUtils from '@js/core/utils/date';
import { isDefined, isObject } from '@js/core/utils/type';
import { dateUtilsTs } from '@ts/core/utils/date';

import { VERTICAL_GROUP_COUNT_CLASSES } from '../../classes';
import {
HORIZONTAL_GROUP_ORIENTATION, VERTICAL_GROUP_ORIENTATION,
} from '../../constants';
import { VERTICAL_GROUP_COUNT_CLASSES } from '../../m_classes';
import timeZoneUtils from '../../m_utils_time_zone';
import type {
AllDayPanelModeType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
GROUP_HEADER_CONTENT_CLASS,
GROUP_ROW_CLASS,
TIME_PANEL_CLASS,
} from '../m_classes';
} from '../classes';
import tableCreatorModule, { type GroupRows } from '../m_table_creator';
import { agendaUtils, formatWeekday, getVerticalGroupCountClass } from '../r1/utils/index';
import type { ResourceId } from '../utils/loader/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ import type { GroupOrientation, ViewType } from '@ts/scheduler/types';
import Scrollable, { type ScrollableProperties } from '@ts/ui/scroll_view/scrollable';

import type NotifyScheduler from '../base/widget_notify_scheduler';
import { APPOINTMENT_SETTINGS_KEY } from '../constants';
import { Cache } from '../global_cache';
import AppointmentDragBehavior from '../m_appointment_drag_behavior';
import {
APPOINTMENT_DRAG_SOURCE_CLASS,
DATE_TABLE_CLASS,
Expand All @@ -69,7 +66,10 @@ import {
TIME_PANEL_CLASS,
VERTICAL_GROUP_COUNT_CLASSES,
VIRTUAL_CELL_CLASS,
} from '../m_classes';
} from '../classes';
import { APPOINTMENT_SETTINGS_KEY } from '../constants';
import { Cache } from '../global_cache';
import AppointmentDragBehavior from '../m_appointment_drag_behavior';
import { CompactAppointmentsHelper } from '../m_compact_appointments_helper';
import type { SubscribeKey, SubscribeMethods } from '../m_subscribes';
import tableCreatorModule, { type GroupRows } from '../m_table_creator';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getBoundingRect } from '@js/core/utils/position';
import { WORK_SPACE_BORDER_PX } from '@ts/scheduler/workspaces/const';

import { FIRST_GROUP_CELL_CLASS, LAST_GROUP_CELL_CLASS } from '../m_classes';
import { FIRST_GROUP_CELL_CLASS, LAST_GROUP_CELL_CLASS } from '../classes';

class HorizontalGroupedStrategy {
// TODO: make private once external usages in current_time_shader.ts, current_time_shader_horizontal.ts are removed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { getBoundingRect } from '@js/core/utils/position';
import { calculateDayDuration, getVerticalGroupCountClass } from '@ts/scheduler/r1/utils/index';
import { WORK_SPACE_BORDER_PX } from '@ts/scheduler/workspaces/const';

import { FIRST_GROUP_CELL_CLASS, LAST_GROUP_CELL_CLASS } from '../classes';
import { Cache } from '../global_cache';
import { FIRST_GROUP_CELL_CLASS, LAST_GROUP_CELL_CLASS } from '../m_classes';

class VerticalGroupedStrategy {
cache = new Cache();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { ScrollableProperties } from '@ts/ui/scroll_view/scrollable';
import {
GROUP_HEADER_CONTENT_CLASS,
GROUP_ROW_CLASS,
} from '../m_classes';
} from '../classes';
import tableCreatorModule, { type GroupRows } from '../m_table_creator';
import timezoneUtils from '../m_utils_time_zone';
import HorizontalShader from '../shaders/current_time_shader_horizontal';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { dateUtilsTs } from '@ts/core/utils/date';
import type { OptionChanged } from '@ts/core/widget/types';
import { getToday } from '@ts/scheduler/r1/utils/index';

import { HEADER_CURRENT_TIME_CELL_CLASS } from '../m_classes';
import { HEADER_CURRENT_TIME_CELL_CLASS } from '../classes';
import timezoneUtils from '../m_utils_time_zone';
import SchedulerWorkSpace, {
type WorkspaceOptionsInternal,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const $ = require('jquery');
const loading = require('__internal/scheduler/m_loading');
const loading = require('__internal/scheduler/loading');
const viewPort = require('core/utils/view_port').value;
const fx = require('common/core/animation/fx');
const LoadPanel = require('ui/load_panel');
Expand Down Expand Up @@ -27,7 +27,7 @@ QUnit.test('hide loadPanel', async function(assert) {
position: { at: 'center' }
});

loading.hide();
await loading.hide();
assert.equal($('.dx-loadpanel').length, 0);
});

Expand Down
Loading