Skip to content

Commit

Permalink
Merge pull request #36 from KorzhCom/dev
Browse files Browse the repository at this point in the history
Version 1.2.7
  • Loading branch information
antifree authored May 8, 2021
2 parents 5b39636 + 3a9f8f6 commit 8e6469d
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 13 deletions.
1 change: 1 addition & 0 deletions easydata.js/packs/crud/src/form/entity_edit_form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ export class EntityEditForm {
const inputEl = ev.target as HTMLInputElement;
const oldValue = inputEl.value ? new Date(inputEl.value) : new Date();
const pickerOptions: DateTimePickerOptions = {
zIndex: 9999999999,
showCalendar: attr.dataType !== DataType.Time,
showTimePicker: attr.dataType !== DataType.Date,
onApply: (dateTime: Date) => {
Expand Down
4 changes: 2 additions & 2 deletions easydata.js/packs/crud/src/views/easy_data_view_dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ export class EasyDataViewDispatcher {
const activeEntityId = this.getActiveEntityId();
if (activeEntityId) {
this.context.setActiveEntity(activeEntityId);
new EntityDataView(this.container, this.context,
window['EntityDataView'] = new EntityDataView(this.container, this.context,
this.basePath, this.options);
}
else {
new RootDataView(this.container, this.context, this.basePath);
window['RootDataView'] = new RootDataView(this.container, this.context, this.basePath);
}
})
.catch(error => console.error(error))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export interface DateTimePickerOptions {
showCalendar?: boolean;
oneClickDateSelection?: boolean;
showDateTimeInput?: boolean;
zIndex?: number;
beforeShow?: () => void;
onApply?: (dateTime: Date) => void;
onCancel?: () => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class DefaultDateTimePicker extends DateTimePicker {

protected render() {

this.slot = domel('div', document.body)
const sb = domel('div', document.body)
.addClass(`${this.cssPrefix}`)
.attr('tabIndex', '0')
.setStyle('position', 'absolute')
Expand All @@ -35,9 +35,14 @@ export class DefaultDateTimePicker extends DateTimePicker {
this.apply(this.getDateTime());
}
return false;
})
.toDOM();
});

if (this.options.zIndex) {
sb.setStyle('z-index', `${this.options.zIndex}`);
}


this.slot = sb.toDOM();

super.render();

Expand Down
45 changes: 43 additions & 2 deletions easydata.js/packs/ui/src/dialogs/default_dialog_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const cssPrefix = "kdlg";

export class DefaultDialogService implements DialogService {

private static openDialogs: Dialog[] = [];

public openConfirm(title?: string, content?: string): Promise<boolean>;
public openConfirm(title?: string, content?: string, callback?: (result: boolean) => void): void;
public openConfirm(title?: string, content?: string, callback?: (result: boolean) => void): Promise<boolean> | void {
Expand Down Expand Up @@ -109,17 +111,54 @@ export class DefaultDialogService implements DialogService {
}

public open(options: DialogOptions) {
const onDestroy = options.onDestroy;
options.onDestroy = () => {
this.untrack(dlg);
onDestroy && onDestroy();
}

const dlg = new DefaultDialog(options);
dlg.open();

this.track(dlg);
return dlg;
}

private untrack(dlg: Dialog) {
const index = DefaultDialogService.openDialogs.indexOf(dlg);
if (index >= 0) {
DefaultDialogService.openDialogs.splice(index, 1);
}
}

private track(dlg: Dialog) {
DefaultDialogService.openDialogs.push(dlg);
}

public openProgress(options: ProgressDialogOptions) {
const onDestroy = options.onDestroy;
options.onDestroy = () => {
this.untrack(dlg);
onDestroy && onDestroy();
}

const dlg = new DefaultProgressDialog(options);
dlg.open();

this.track(dlg);
return dlg;
}

public getAllDialogs() {
return Array.from(DefaultDialogService.openDialogs);
}

public closeAllDialogs() {
for (const dialog of Array.from(DefaultDialogService.openDialogs)) {
dialog.close();
}
}

}

export class DefaultDialog implements Dialog {
Expand Down Expand Up @@ -289,6 +328,7 @@ export class DefaultDialog implements Dialog {
}

protected destroy() {

if (this.options.arrangeParents) {
this.arrangeParents(false);
}
Expand All @@ -298,7 +338,7 @@ export class DefaultDialog implements Dialog {
if (this.options.submitOnEnter) {
window.removeEventListener('keydown', this.keydownHandler, false);
}

if (this.options.onDestroy) {
this.options.onDestroy();
}
Expand Down Expand Up @@ -399,7 +439,8 @@ export class DefaultProgressDialog extends DefaultDialog implements PorgressDial
height: options.height,
submitable: false,
cancelable: false,
closable: false
closable: false,
onDestroy: options.onDestroy
});

this.contentElement = contentElement;
Expand Down
5 changes: 5 additions & 0 deletions easydata.js/packs/ui/src/dialogs/dialog_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface ProgressDialogOptions {
onSubmit?: () => void;
width?: number | string;
height?: number | string;
onDestroy?: () => void;
};

export interface Dialog {
Expand Down Expand Up @@ -52,4 +53,8 @@ export interface DialogService {
openProgress(options: ProgressDialogOptions): PorgressDialog;

open(options: DialogOptions): Dialog;

getAllDialogs(): Dialog[];

closeAllDialogs();
}
6 changes: 3 additions & 3 deletions easydata.js/version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.2.6",
"baseVersion": "1.2.6",
"assetVersion": "01_02_06"
"version": "1.2.7",
"baseVersion": "1.2.7",
"assetVersion": "01_02_07"
}
6 changes: 3 additions & 3 deletions easydata.net/version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"assemblyVersion": "1.2.6.0",
"packageVersion": "1.2.6",
"assetVersion": "01_02_06"
"assemblyVersion": "1.2.7.0",
"packageVersion": "1.2.7",
"assetVersion": "01_02_07"
}

0 comments on commit 8e6469d

Please sign in to comment.