@ldmjs/ui 1.0.85 → 1.0.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +62 -24
- package/dist/types/dialogs.d.ts +31 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7740,10 +7740,8 @@ class DialogManager {
|
|
|
7740
7740
|
}
|
|
7741
7741
|
static alert(modal) {
|
|
7742
7742
|
const modalInfo = {
|
|
7743
|
-
|
|
7744
|
-
content: modal.content,
|
|
7743
|
+
...modal,
|
|
7745
7744
|
type: ModalType.Alert,
|
|
7746
|
-
hostObject: modal.hostObject,
|
|
7747
7745
|
managerId: DialogManager._id,
|
|
7748
7746
|
};
|
|
7749
7747
|
return DialogManager.execAsync(modalInfo);
|
|
@@ -7752,7 +7750,6 @@ class DialogManager {
|
|
|
7752
7750
|
const modalInfo = {
|
|
7753
7751
|
...modal,
|
|
7754
7752
|
type: ModalType.Prompt,
|
|
7755
|
-
hostObject: modal.hostObject,
|
|
7756
7753
|
managerId: DialogManager._id,
|
|
7757
7754
|
};
|
|
7758
7755
|
return DialogManager.execAsync(modalInfo);
|
|
@@ -7760,10 +7757,8 @@ class DialogManager {
|
|
|
7760
7757
|
static confirm(modal) {
|
|
7761
7758
|
const modalInfo = {
|
|
7762
7759
|
...modal,
|
|
7763
|
-
content: modal.text,
|
|
7764
7760
|
type: ModalType.Confirm,
|
|
7765
7761
|
closable: true,
|
|
7766
|
-
hostObject: modal.hostObject,
|
|
7767
7762
|
managerId: DialogManager._id,
|
|
7768
7763
|
};
|
|
7769
7764
|
return DialogManager.execAsync(modalInfo);
|
|
@@ -8121,39 +8116,61 @@ const dialog_minimized_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(d
|
|
|
8121
8116
|
/* harmony default export */ const dialog_minimized = (dialog_minimized_exports_);
|
|
8122
8117
|
;// ./src/ld-dialog/dialogs.ts
|
|
8123
8118
|
class Dialog {
|
|
8124
|
-
constructor(
|
|
8125
|
-
this.title = title;
|
|
8126
|
-
this.content = content
|
|
8119
|
+
constructor(data) {
|
|
8120
|
+
this.title = data.title;
|
|
8121
|
+
this.content = data.content;
|
|
8122
|
+
this.pressEnterAsOk = data.pressEnterAsOk !== false;
|
|
8123
|
+
this.pressEscAsCancel = data.pressEscAsCancel !== false;
|
|
8124
|
+
this.hostObject = data.hostObject;
|
|
8127
8125
|
}
|
|
8128
8126
|
}
|
|
8129
8127
|
class AlertDialog extends Dialog {
|
|
8130
8128
|
constructor(data) {
|
|
8131
|
-
super(
|
|
8132
|
-
|
|
8129
|
+
super({
|
|
8130
|
+
title: data.title,
|
|
8131
|
+
content: data.text,
|
|
8132
|
+
pressEnterAsOk: data.pressEnterAsOk,
|
|
8133
|
+
pressEscAsCancel: data.pressEscAsCancel,
|
|
8134
|
+
hostObject: data.hostObject,
|
|
8135
|
+
});
|
|
8133
8136
|
}
|
|
8134
8137
|
}
|
|
8135
8138
|
class PromptDialog extends Dialog {
|
|
8136
8139
|
constructor(data) {
|
|
8137
|
-
super(
|
|
8140
|
+
super({
|
|
8141
|
+
title: data.title,
|
|
8142
|
+
content: data.content,
|
|
8143
|
+
pressEnterAsOk: data.pressEnterAsOk,
|
|
8144
|
+
pressEscAsCancel: data.pressEscAsCancel,
|
|
8145
|
+
hostObject: data.hostObject,
|
|
8146
|
+
});
|
|
8138
8147
|
this.width = data.width || '60%';
|
|
8139
|
-
this.hostObject = data.hostObject;
|
|
8140
8148
|
}
|
|
8141
8149
|
}
|
|
8142
8150
|
class ConfirmDialog extends Dialog {
|
|
8143
8151
|
constructor(data) {
|
|
8144
|
-
super(
|
|
8145
|
-
|
|
8146
|
-
|
|
8152
|
+
super({
|
|
8153
|
+
title: data.title,
|
|
8154
|
+
content: data.text,
|
|
8155
|
+
pressEnterAsOk: data.pressEnterAsOk,
|
|
8156
|
+
pressEscAsCancel: data.pressEscAsCancel,
|
|
8157
|
+
hostObject: data.hostObject,
|
|
8158
|
+
});
|
|
8147
8159
|
this.okTitle = data.okTitle;
|
|
8148
8160
|
this.cancelTitle = data.cancelTitle;
|
|
8149
8161
|
this.okResult = data.okResult;
|
|
8150
8162
|
this.cancelResult = data.cancelResult;
|
|
8151
|
-
this.hostObject = data.hostObject;
|
|
8152
8163
|
}
|
|
8153
8164
|
}
|
|
8154
8165
|
class InfoDialog extends Dialog {
|
|
8155
8166
|
constructor(data) {
|
|
8156
|
-
super(
|
|
8167
|
+
super({
|
|
8168
|
+
title: data.title,
|
|
8169
|
+
content: '',
|
|
8170
|
+
pressEnterAsOk: data.pressEnterAsOk,
|
|
8171
|
+
pressEscAsCancel: data.pressEscAsCancel,
|
|
8172
|
+
hostObject: data.hostObject,
|
|
8173
|
+
});
|
|
8157
8174
|
this.component = data.component;
|
|
8158
8175
|
this.componentProps = data.componentProps;
|
|
8159
8176
|
this.width = data.width;
|
|
@@ -8164,13 +8181,18 @@ class InfoDialog extends Dialog {
|
|
|
8164
8181
|
this.hideFooter = data.hideFooter;
|
|
8165
8182
|
this.minimizable = data.minimizable;
|
|
8166
8183
|
this.description = data.description;
|
|
8167
|
-
this.hostObject = data.hostObject;
|
|
8168
8184
|
this.help = data.help;
|
|
8169
8185
|
}
|
|
8170
8186
|
}
|
|
8171
8187
|
class SelectDialog extends Dialog {
|
|
8172
8188
|
constructor(data) {
|
|
8173
|
-
super(
|
|
8189
|
+
super({
|
|
8190
|
+
title: data.title,
|
|
8191
|
+
content: '',
|
|
8192
|
+
pressEnterAsOk: data.pressEnterAsOk,
|
|
8193
|
+
pressEscAsCancel: data.pressEscAsCancel,
|
|
8194
|
+
hostObject: data.hostObject,
|
|
8195
|
+
});
|
|
8174
8196
|
this.component = data.component;
|
|
8175
8197
|
this.componentProps = data.componentProps;
|
|
8176
8198
|
this.loading = data.loading;
|
|
@@ -8180,20 +8202,24 @@ class SelectDialog extends Dialog {
|
|
|
8180
8202
|
this.selectAsOk = data.selectAsOk;
|
|
8181
8203
|
this.okTitle = data.okTitle;
|
|
8182
8204
|
this.cancelTitle = data.cancelTitle;
|
|
8183
|
-
this.hostObject = data.hostObject;
|
|
8184
8205
|
this.help = data.help;
|
|
8185
8206
|
}
|
|
8186
8207
|
}
|
|
8187
8208
|
class CreateEditDialog extends Dialog {
|
|
8188
8209
|
constructor(data) {
|
|
8189
|
-
super(
|
|
8210
|
+
super({
|
|
8211
|
+
title: data.title,
|
|
8212
|
+
content: '',
|
|
8213
|
+
pressEnterAsOk: data.pressEnterAsOk,
|
|
8214
|
+
pressEscAsCancel: data.pressEscAsCancel,
|
|
8215
|
+
hostObject: data.hostObject,
|
|
8216
|
+
});
|
|
8190
8217
|
this._isChanged = null;
|
|
8191
8218
|
this.component = data.component;
|
|
8192
8219
|
this.componentProps = {
|
|
8193
8220
|
...data.componentProps,
|
|
8194
8221
|
setIsChangedCallback: this.setIsChangedCallback.bind(this),
|
|
8195
8222
|
};
|
|
8196
|
-
this.hostObject = data.hostObject;
|
|
8197
8223
|
this.loading = data.loading;
|
|
8198
8224
|
this.fullHeight = data.fullHeight;
|
|
8199
8225
|
this.width = data.width;
|
|
@@ -8300,6 +8326,8 @@ let DialogComponent = class DialogComponent extends (0,external_vue_class_compon
|
|
|
8300
8326
|
component: modalInfo.component,
|
|
8301
8327
|
componentProps: modalInfo.componentProps,
|
|
8302
8328
|
hostObject: modalInfo.hostObject,
|
|
8329
|
+
pressEnterAsOk: modalInfo.pressEnterAsOk,
|
|
8330
|
+
pressEscAsCancel: modalInfo.pressEscAsCancel,
|
|
8303
8331
|
loading: modalInfo.loading,
|
|
8304
8332
|
noModal: modalInfo.noModal,
|
|
8305
8333
|
type: modalInfo.type,
|
|
@@ -8377,16 +8405,24 @@ let DialogComponent = class DialogComponent extends (0,external_vue_class_compon
|
|
|
8377
8405
|
return;
|
|
8378
8406
|
}
|
|
8379
8407
|
if (e.key === 'Enter') {
|
|
8408
|
+
if (!modal.pressEnterAsOk) {
|
|
8409
|
+
return;
|
|
8410
|
+
}
|
|
8380
8411
|
if (e.shiftKey) {
|
|
8381
8412
|
return;
|
|
8382
8413
|
}
|
|
8383
8414
|
this.handleOk(modal);
|
|
8384
8415
|
}
|
|
8385
8416
|
if (e.key === 'Escape') {
|
|
8417
|
+
if (!modal.pressEscAsCancel) {
|
|
8418
|
+
return;
|
|
8419
|
+
}
|
|
8386
8420
|
this.handleCancel(modal);
|
|
8387
8421
|
}
|
|
8388
8422
|
};
|
|
8389
|
-
|
|
8423
|
+
if (modal.pressEnterAsOk || modal.pressEscAsCancel) {
|
|
8424
|
+
this.dialogListeners.set(modal, listenerHandler.bind(this));
|
|
8425
|
+
}
|
|
8390
8426
|
modal.el = el;
|
|
8391
8427
|
if (this.isConfirmDialog(modal)) {
|
|
8392
8428
|
const btnOk = modal.el.querySelector('#modalOk');
|
|
@@ -8485,6 +8521,7 @@ let DialogComponent = class DialogComponent extends (0,external_vue_class_compon
|
|
|
8485
8521
|
resultSave = await resultSave;
|
|
8486
8522
|
if (resultSave) {
|
|
8487
8523
|
this.modalResult = resultSave;
|
|
8524
|
+
removeModal = true;
|
|
8488
8525
|
}
|
|
8489
8526
|
else {
|
|
8490
8527
|
return;
|
|
@@ -8504,6 +8541,7 @@ let DialogComponent = class DialogComponent extends (0,external_vue_class_compon
|
|
|
8504
8541
|
return;
|
|
8505
8542
|
}
|
|
8506
8543
|
this.modalResult = resultSave;
|
|
8544
|
+
removeModal = true;
|
|
8507
8545
|
}
|
|
8508
8546
|
}
|
|
8509
8547
|
break;
|
package/dist/types/dialogs.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export interface IModalInfo {
|
|
|
27
27
|
processingDescription?: string | (() => string);
|
|
28
28
|
el?: HTMLElement;
|
|
29
29
|
managerId?: string;
|
|
30
|
+
pressEnterAsOk?: boolean;
|
|
31
|
+
pressEscAsCancel?: boolean;
|
|
30
32
|
hostObject?: IHostObject;
|
|
31
33
|
/**
|
|
32
34
|
* Окно немодальное - это начит окно отображается поверх контента страницы и не ограничивает пользователя
|
|
@@ -95,32 +97,39 @@ export type ModalWindow = IModalWindow<IViewModel<number | string>>;
|
|
|
95
97
|
export class Dialog {
|
|
96
98
|
constructor(
|
|
97
99
|
public title: string,
|
|
98
|
-
public content?: string
|
|
100
|
+
public content?: string,
|
|
101
|
+
public pressEnterAsOk?: boolean,
|
|
102
|
+
public pressEscAsCancel?: boolean,
|
|
103
|
+
public hostObject?: IHostObject
|
|
99
104
|
) {}
|
|
100
105
|
}
|
|
101
106
|
|
|
102
107
|
export class AlertDialog extends Dialog {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
constructor(data: {
|
|
109
|
+
title: string;
|
|
110
|
+
text: string;
|
|
111
|
+
pressEnterAsOk?: boolean;
|
|
112
|
+
pressEscAsCancel?: boolean;
|
|
113
|
+
hostObject?: IHostObject;
|
|
114
|
+
});
|
|
107
115
|
}
|
|
108
116
|
|
|
109
117
|
export class PromptDialog extends Dialog {
|
|
110
|
-
title: string;
|
|
111
118
|
width?: string;
|
|
112
|
-
|
|
113
|
-
|
|
119
|
+
constructor(data: {
|
|
120
|
+
title: string;
|
|
121
|
+
width?: string;
|
|
122
|
+
pressEnterAsOk?: boolean;
|
|
123
|
+
pressEscAsCancel?: boolean;
|
|
124
|
+
hostObject?: IHostObject;
|
|
125
|
+
});
|
|
114
126
|
}
|
|
115
127
|
|
|
116
128
|
export class ConfirmDialog extends Dialog {
|
|
117
|
-
title: string;
|
|
118
|
-
text: string;
|
|
119
129
|
okTitle?: string;
|
|
120
130
|
cancelTitle?: string;
|
|
121
131
|
okResult?: number | string | boolean;
|
|
122
132
|
cancelResult?: number | string | boolean;
|
|
123
|
-
hostObject?: IHostObject;
|
|
124
133
|
constructor(data: {
|
|
125
134
|
title: string;
|
|
126
135
|
text: string;
|
|
@@ -128,12 +137,13 @@ export class ConfirmDialog extends Dialog {
|
|
|
128
137
|
cancelTitle?: string;
|
|
129
138
|
okResult?: number | string | boolean;
|
|
130
139
|
cancelResult?: number | string | boolean;
|
|
140
|
+
pressEnterAsOk?: boolean;
|
|
141
|
+
pressEscAsCancel?: boolean;
|
|
131
142
|
hostObject?: IHostObject;
|
|
132
143
|
});
|
|
133
144
|
}
|
|
134
145
|
|
|
135
146
|
export class InfoDialog extends Dialog {
|
|
136
|
-
title: string;
|
|
137
147
|
component: string;
|
|
138
148
|
componentProps: Record<string, unknown>;
|
|
139
149
|
width?: string;
|
|
@@ -144,7 +154,6 @@ export class InfoDialog extends Dialog {
|
|
|
144
154
|
hideFooter?: boolean;
|
|
145
155
|
minimizable?: boolean;
|
|
146
156
|
description?: string;
|
|
147
|
-
hostObject?: IHostObject;
|
|
148
157
|
help?: boolean;
|
|
149
158
|
constructor(data: {
|
|
150
159
|
title: string;
|
|
@@ -158,13 +167,14 @@ export class InfoDialog extends Dialog {
|
|
|
158
167
|
hideFooter?: boolean;
|
|
159
168
|
minimizable?: boolean;
|
|
160
169
|
description?: string;
|
|
170
|
+
pressEnterAsOk?: boolean;
|
|
171
|
+
pressEscAsCancel?: boolean;
|
|
161
172
|
hostObject?: IHostObject;
|
|
162
173
|
help?: boolean;
|
|
163
174
|
});
|
|
164
175
|
}
|
|
165
176
|
|
|
166
|
-
export class SelectDialog<T> {
|
|
167
|
-
title: string;
|
|
177
|
+
export class SelectDialog<T> extends Dialog {
|
|
168
178
|
component: string;
|
|
169
179
|
componentProps: {
|
|
170
180
|
disabledItems: Array<T | number | string>;
|
|
@@ -189,7 +199,6 @@ export class SelectDialog<T> {
|
|
|
189
199
|
selectAsOk?: boolean;
|
|
190
200
|
okTitle?: string;
|
|
191
201
|
cancelTitle?: string;
|
|
192
|
-
hostObject?: IHostObject;
|
|
193
202
|
help?: boolean;
|
|
194
203
|
constructor(data: {
|
|
195
204
|
title: string;
|
|
@@ -210,19 +219,19 @@ export class SelectDialog<T> {
|
|
|
210
219
|
selectAsOk?: boolean;
|
|
211
220
|
okTitle?: string;
|
|
212
221
|
cancelTitle?: string;
|
|
222
|
+
pressEnterAsOk?: boolean;
|
|
223
|
+
pressEscAsCancel?: boolean;
|
|
213
224
|
hostObject?: IHostObject;
|
|
214
225
|
help?: boolean;
|
|
215
226
|
});
|
|
216
227
|
}
|
|
217
228
|
|
|
218
|
-
export class CreateEditDialog<T> {
|
|
219
|
-
title: string;
|
|
229
|
+
export class CreateEditDialog<T> extends Dialog {
|
|
220
230
|
component: string;
|
|
221
231
|
componentProps: {
|
|
222
232
|
model: T;
|
|
223
233
|
[key: string]: unknown;
|
|
224
234
|
};
|
|
225
|
-
hostObject?: IHostObject;
|
|
226
235
|
loading?: boolean;
|
|
227
236
|
fullHeight?: boolean;
|
|
228
237
|
width?: string | number;
|
|
@@ -255,7 +264,6 @@ export class CreateEditDialog<T> {
|
|
|
255
264
|
model: T;
|
|
256
265
|
[key: string]: unknown;
|
|
257
266
|
};
|
|
258
|
-
hostObject?: IHostObject;
|
|
259
267
|
loading?: boolean;
|
|
260
268
|
fullHeight?: boolean;
|
|
261
269
|
width?: string | number;
|
|
@@ -280,6 +288,9 @@ export class CreateEditDialog<T> {
|
|
|
280
288
|
noModal?: boolean;
|
|
281
289
|
okTitle?: string;
|
|
282
290
|
cancelTitle?: string;
|
|
291
|
+
pressEnterAsOk?: boolean;
|
|
292
|
+
pressEscAsCancel?: boolean;
|
|
293
|
+
hostObject?: IHostObject;
|
|
283
294
|
help?: boolean;
|
|
284
295
|
});
|
|
285
296
|
}
|