ngx-rs-ant 1.9.5 → 1.9.6
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/esm2020/box-container/PluginManager.mjs +4 -32
- package/esm2020/data-grid/cell-component-template/cell-component-template.component.mjs +1 -8
- package/fesm2015/ngx-rs-ant.mjs +251 -279
- package/fesm2015/ngx-rs-ant.mjs.map +1 -1
- package/fesm2020/ngx-rs-ant.mjs +248 -276
- package/fesm2020/ngx-rs-ant.mjs.map +1 -1
- package/package.json +1 -1
package/fesm2020/ngx-rs-ant.mjs
CHANGED
|
@@ -2,11 +2,9 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Component, Input, HostBinding, EventEmitter, Output, HostListener, ViewContainerRef, ViewChild, Directive, ViewChildren, NgModule, Injectable, ContentChild } from '@angular/core';
|
|
3
3
|
import { PluginFactory } from 'coast-plugin-register';
|
|
4
4
|
import * as i1 from '@angular/common';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { CommonModule, formatDate } from '@angular/common';
|
|
6
|
+
import { Subject, ReplaySubject, Subscription, map, firstValueFrom, of, lastValueFrom, debounceTime, interval } from 'rxjs';
|
|
7
7
|
import * as i2 from 'devextreme-angular/ui/number-box';
|
|
8
|
-
import notify from 'devextreme/ui/notify';
|
|
9
|
-
import validationEngine from 'devextreme/ui/validation_engine';
|
|
10
8
|
import * as i2$1 from 'devextreme-angular/ui/draggable';
|
|
11
9
|
import { DevExtremeModule, DxValidationGroupComponent, DxDataGridComponent } from 'devextreme-angular';
|
|
12
10
|
import BpmnModeler from 'camunda-bpmn-js/lib/camunda-platform/Modeler';
|
|
@@ -15,6 +13,8 @@ import { isLabel } from 'diagram-js/lib/util/ModelUtil';
|
|
|
15
13
|
import * as i3 from 'devextreme-angular/ui/button';
|
|
16
14
|
import Viewer from 'camunda-bpmn-js/lib/camunda-platform/NavigatedViewer';
|
|
17
15
|
import * as i1$1 from '@angular/common/http';
|
|
16
|
+
import notify from 'devextreme/ui/notify';
|
|
17
|
+
import validationEngine from 'devextreme/ui/validation_engine';
|
|
18
18
|
import CustomStore from 'devextreme/data/custom_store';
|
|
19
19
|
import * as i2$2 from 'devextreme-angular/core';
|
|
20
20
|
import * as i5 from 'devextreme-angular/ui/data-grid';
|
|
@@ -251,245 +251,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
251
251
|
args: [{ selector: 'rs-style-blank', template: "<div>\n <span>\u8BF7\u5728\u5DE6\u4FA7\u753B\u5E03\u9009\u4E2D\u8282\u70B9</span>\n</div>\n", styles: [":host{height:80px;margin:8px;display:flex;flex-flow:row nowrap;justify-content:center}:host div{flex:1;display:flex;flex-flow:row nowrap;justify-content:center;align-items:center}:host div span{text-align:center;-webkit-user-select:none;user-select:none}\n"] }]
|
|
252
252
|
}] });
|
|
253
253
|
|
|
254
|
-
class ConfigBase {
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
class FormItemConfigBase extends ConfigBase {
|
|
258
|
-
constructor() {
|
|
259
|
-
super(...arguments);
|
|
260
|
-
/**
|
|
261
|
-
* 配置更新事件,emit()将更新配置到组件,emit(true)将更新配置到组件并重新加载组件
|
|
262
|
-
*/
|
|
263
|
-
this.configChange = new EventEmitter();
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
class PageItemConfigBase extends ConfigBase {
|
|
268
|
-
constructor() {
|
|
269
|
-
super(...arguments);
|
|
270
|
-
/**
|
|
271
|
-
* 配置更新事件,emit()将更新配置到组件,emit(true)将更新配置到组件并重新加载组件
|
|
272
|
-
*/
|
|
273
|
-
this.configChange = new EventEmitter();
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
class ComponentBase {
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
class PageItemComponentBase extends ComponentBase {
|
|
281
|
-
constructor() {
|
|
282
|
-
super(...arguments);
|
|
283
|
-
/**
|
|
284
|
-
* 编辑模式,在设计器中为true,用于区分组件设计和应用状态
|
|
285
|
-
*/
|
|
286
|
-
this.editMode = false;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
class FormItemComponentBase extends ComponentBase {
|
|
291
|
-
constructor() {
|
|
292
|
-
super(...arguments);
|
|
293
|
-
/**
|
|
294
|
-
* 编辑模式,在设计器中为true,用于区分组件设计和应用状态
|
|
295
|
-
*/
|
|
296
|
-
this.editMode = false;
|
|
297
|
-
/**
|
|
298
|
-
* 表单只读状态,用于区分组件只读状态
|
|
299
|
-
*/
|
|
300
|
-
this.readonly = false;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
class ModalComponentBase extends ComponentBase {
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
function notify_error(message) {
|
|
308
|
-
_notify(message, 12000, 'warning');
|
|
309
|
-
}
|
|
310
|
-
function notify_warning(message) {
|
|
311
|
-
_notify(message, 8000, 'warning');
|
|
312
|
-
}
|
|
313
|
-
function notify_success(message) {
|
|
314
|
-
_notify(message, 4000, 'success');
|
|
315
|
-
}
|
|
316
|
-
function _notify(message, time, type) {
|
|
317
|
-
notify({
|
|
318
|
-
displayTime: time,
|
|
319
|
-
message,
|
|
320
|
-
type: type,
|
|
321
|
-
closeOnSwipe: false,
|
|
322
|
-
minWidth: 200,
|
|
323
|
-
maxWidth: 500,
|
|
324
|
-
wrapperAttr: { class: 'global-toast-message' }
|
|
325
|
-
}, {
|
|
326
|
-
direction: 'up-push',
|
|
327
|
-
position: 'bottom right'
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
function format_date(date, locale) {
|
|
331
|
-
return formatDate(date, 'yyyy/MM/dd', locale, 'GMT+8');
|
|
332
|
-
}
|
|
333
|
-
function format_datetime(date, locale) {
|
|
334
|
-
return formatDate(date, 'yyyy/MM/dd HH:mm:ss', locale, 'GMT+8');
|
|
335
|
-
}
|
|
336
|
-
function localeSortMethod(value1, value2) {
|
|
337
|
-
return value1.localeCompare(value2);
|
|
338
|
-
}
|
|
339
|
-
function file_type_icon(name) {
|
|
340
|
-
const type = name.substring(name.lastIndexOf('.') + 1).toLocaleLowerCase();
|
|
341
|
-
switch (type) {
|
|
342
|
-
case 'doc':
|
|
343
|
-
case 'docx':
|
|
344
|
-
return 'word';
|
|
345
|
-
case 'xls':
|
|
346
|
-
case 'xlsx':
|
|
347
|
-
case 'csv':
|
|
348
|
-
return 'excel';
|
|
349
|
-
case 'ppt':
|
|
350
|
-
case 'pptx':
|
|
351
|
-
return 'ppt';
|
|
352
|
-
case 'pdf':
|
|
353
|
-
return 'pdf';
|
|
354
|
-
case 'txt':
|
|
355
|
-
case 'xml':
|
|
356
|
-
case 'json':
|
|
357
|
-
case 'js':
|
|
358
|
-
return 'text';
|
|
359
|
-
case 'png':
|
|
360
|
-
case 'jpg':
|
|
361
|
-
case 'jpeg':
|
|
362
|
-
case 'gif':
|
|
363
|
-
case 'bmp':
|
|
364
|
-
return 'image';
|
|
365
|
-
case 'zip':
|
|
366
|
-
case 'rar':
|
|
367
|
-
case '7z':
|
|
368
|
-
case 'jar':
|
|
369
|
-
return 'zip';
|
|
370
|
-
default:
|
|
371
|
-
return 'unknown';
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
function support_preview_ext() {
|
|
375
|
-
return ['pdf', 'png', 'jpg', 'jpeg', 'gif', 'bmp', 'doc', 'docx', 'txt', 'xml', 'json', 'js', 'xls', 'xlsx', 'csv', 'ppt', 'pptx'];
|
|
376
|
-
}
|
|
377
|
-
function format_file_size(size) {
|
|
378
|
-
const labels = ['b', 'Kb', 'Mb', 'Gb'];
|
|
379
|
-
const count = labels.length - 1;
|
|
380
|
-
let i = 0;
|
|
381
|
-
while (i < count && size >= 1024) {
|
|
382
|
-
size /= 1024;
|
|
383
|
-
i++;
|
|
384
|
-
}
|
|
385
|
-
return Math.round(size * 100) / 100 + " " + labels[i];
|
|
386
|
-
}
|
|
387
|
-
function filename_from_disposition(disposition) {
|
|
388
|
-
const filenamePair = disposition.split(';').filter(str => /^filename=/.test(str.trim())).pop();
|
|
389
|
-
if (filenamePair) {
|
|
390
|
-
let str = filenamePair.trim();
|
|
391
|
-
str = str.split('=')[1];
|
|
392
|
-
str = str.replace(/['"]/g, '');
|
|
393
|
-
return decodeURIComponent(str);
|
|
394
|
-
}
|
|
395
|
-
else {
|
|
396
|
-
return null;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
function download_file(blob, filename, callback) {
|
|
400
|
-
const url = window.webkitURL.createObjectURL(blob);
|
|
401
|
-
const a = document.createElement('a');
|
|
402
|
-
document.body.appendChild(a);
|
|
403
|
-
a.setAttribute('style', 'display:none');
|
|
404
|
-
a.setAttribute('href', url);
|
|
405
|
-
a.setAttribute('download', decodeURIComponent(filename));
|
|
406
|
-
a.click();
|
|
407
|
-
setTimeout(() => {
|
|
408
|
-
if (callback) {
|
|
409
|
-
callback();
|
|
410
|
-
}
|
|
411
|
-
a.remove();
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
function validate(validator) {
|
|
415
|
-
return new Promise(resolve => {
|
|
416
|
-
if (!validator) {
|
|
417
|
-
resolve(true);
|
|
418
|
-
}
|
|
419
|
-
const validateResult = validator.instance.validate();
|
|
420
|
-
if (!validateResult.isValid) {
|
|
421
|
-
resolve(false);
|
|
422
|
-
}
|
|
423
|
-
if (validateResult.status === 'pending') {
|
|
424
|
-
validateResult.complete?.then((result) => {
|
|
425
|
-
if (result.isValid) {
|
|
426
|
-
resolve(true);
|
|
427
|
-
}
|
|
428
|
-
else {
|
|
429
|
-
resolve(false);
|
|
430
|
-
}
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
else {
|
|
434
|
-
resolve(true);
|
|
435
|
-
}
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
function validate_group(validationGroupComponent) {
|
|
439
|
-
if (!validationGroupComponent) {
|
|
440
|
-
return firstValueFrom(of(true));
|
|
441
|
-
}
|
|
442
|
-
return validateGroup(validationGroupComponent.instance, validationGroupComponent.element.nativeElement);
|
|
443
|
-
}
|
|
444
|
-
function validate_group_by_name(name, brokenElementParent) {
|
|
445
|
-
const validationGroup = validationEngine.getGroupConfig(name);
|
|
446
|
-
if (!validationGroup) {
|
|
447
|
-
return firstValueFrom(of(true));
|
|
448
|
-
}
|
|
449
|
-
return validateGroup(validationGroup, brokenElementParent);
|
|
450
|
-
}
|
|
451
|
-
function validateGroup(validationGroup, brokenElementParent) {
|
|
452
|
-
let sourceNode;
|
|
453
|
-
const targetClassName = 'dx-field';
|
|
454
|
-
const findTargetNode = (node) => {
|
|
455
|
-
sourceNode = node;
|
|
456
|
-
while (true) {
|
|
457
|
-
if (node.classList.contains(targetClassName)) {
|
|
458
|
-
return node;
|
|
459
|
-
}
|
|
460
|
-
else {
|
|
461
|
-
node = node.parentElement;
|
|
462
|
-
if (node === brokenElementParent) {
|
|
463
|
-
return sourceNode;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
};
|
|
468
|
-
return new Promise(resolve => {
|
|
469
|
-
const validateResult = validationGroup.validate();
|
|
470
|
-
if (!validateResult.isValid) {
|
|
471
|
-
const brokenElement = (validateResult.brokenRules?.[0]).validator.element();
|
|
472
|
-
findTargetNode(brokenElement).scrollIntoView();
|
|
473
|
-
resolve(false);
|
|
474
|
-
}
|
|
475
|
-
if (validateResult.status === 'pending') {
|
|
476
|
-
validateResult.complete?.then((result) => {
|
|
477
|
-
if (result.isValid) {
|
|
478
|
-
resolve(true);
|
|
479
|
-
}
|
|
480
|
-
else {
|
|
481
|
-
const brokenElement = (result.brokenRules?.[0]).validator.element();
|
|
482
|
-
findTargetNode(brokenElement).scrollIntoView();
|
|
483
|
-
resolve(false);
|
|
484
|
-
}
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
else {
|
|
488
|
-
resolve(true);
|
|
489
|
-
}
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
|
|
493
254
|
class PluginManager {
|
|
494
255
|
static createComponent(boxItem, index, style, config) {
|
|
495
256
|
let plugin = PluginFactory.get(config.name);
|
|
@@ -507,20 +268,10 @@ class PluginManager {
|
|
|
507
268
|
const instance = componentRef.instance;
|
|
508
269
|
Object.assign(instance, config.pluginConfig);
|
|
509
270
|
if (PluginFactory.hasType(plugin, 'page')) {
|
|
510
|
-
if (!(instance instanceof PageItemComponentBase)) {
|
|
511
|
-
console.error('page item component need extending PageItemComponentBase, name: ' + config.name);
|
|
512
|
-
notify_error('加载页面组件失败:' + config.name);
|
|
513
|
-
return;
|
|
514
|
-
}
|
|
515
271
|
instance.editMode = boxItem.boxContainer.editMode;
|
|
516
272
|
instance.tabId = boxItem.boxContainer.context?.__tabId;
|
|
517
273
|
}
|
|
518
274
|
if (PluginFactory.hasType(plugin, 'form')) {
|
|
519
|
-
if (!(instance instanceof FormItemComponentBase)) {
|
|
520
|
-
console.error('form item component need extending FormItemComponentBase, name: ' + config.name);
|
|
521
|
-
notify_error('加载表单组件失败:' + config.name);
|
|
522
|
-
return;
|
|
523
|
-
}
|
|
524
275
|
instance.editMode = boxItem.boxContainer.editMode;
|
|
525
276
|
instance.validationGroupName = boxItem.boxContainer.context?.__form.uniqueId;
|
|
526
277
|
instance.tenant = boxItem.boxContainer.context?.__form.tenant;
|
|
@@ -533,11 +284,6 @@ class PluginManager {
|
|
|
533
284
|
}
|
|
534
285
|
}
|
|
535
286
|
if (PluginFactory.hasType(plugin, 'modal')) {
|
|
536
|
-
if (!(instance instanceof ModalComponentBase)) {
|
|
537
|
-
console.error('modal component need extending ModalComponentBase, name: ' + config.name);
|
|
538
|
-
notify_error('加载模窗组件失败:' + config.name);
|
|
539
|
-
return;
|
|
540
|
-
}
|
|
541
287
|
instance.opener = boxItem.boxContainer.context?.__opener;
|
|
542
288
|
}
|
|
543
289
|
instance.params = boxItem.boxContainer.params;
|
|
@@ -663,18 +409,10 @@ class PluginManager {
|
|
|
663
409
|
const componentRef = itemConfigContainerRef.createComponent(pluginConfig.component);
|
|
664
410
|
const instance = componentRef.instance;
|
|
665
411
|
if (PluginFactory.hasType(plugin, 'page')) {
|
|
666
|
-
|
|
667
|
-
console.error('page item component config need extending PageItemConfigBase, name: ' + plugin.name);
|
|
668
|
-
notify_error('加载页面组件配置失败:' + plugin.name);
|
|
669
|
-
return;
|
|
670
|
-
}
|
|
412
|
+
instance.configChange = new EventEmitter();
|
|
671
413
|
}
|
|
672
414
|
if (PluginFactory.hasType(plugin, 'form')) {
|
|
673
|
-
|
|
674
|
-
console.error('form item component config need extending FormItemConfigBase, name: ' + plugin.name);
|
|
675
|
-
notify_error('加载表单组件配置失败:' + plugin.name);
|
|
676
|
-
return;
|
|
677
|
-
}
|
|
415
|
+
instance.configChange = new EventEmitter();
|
|
678
416
|
instance.tenant = context?.tenant;
|
|
679
417
|
instance.className = context?.className;
|
|
680
418
|
instance.fieldTree = context?.fieldTree;
|
|
@@ -2074,6 +1812,192 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2074
1812
|
}]
|
|
2075
1813
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
|
2076
1814
|
|
|
1815
|
+
function notify_error(message) {
|
|
1816
|
+
_notify(message, 12000, 'warning');
|
|
1817
|
+
}
|
|
1818
|
+
function notify_warning(message) {
|
|
1819
|
+
_notify(message, 8000, 'warning');
|
|
1820
|
+
}
|
|
1821
|
+
function notify_success(message) {
|
|
1822
|
+
_notify(message, 4000, 'success');
|
|
1823
|
+
}
|
|
1824
|
+
function _notify(message, time, type) {
|
|
1825
|
+
notify({
|
|
1826
|
+
displayTime: time,
|
|
1827
|
+
message,
|
|
1828
|
+
type: type,
|
|
1829
|
+
closeOnSwipe: false,
|
|
1830
|
+
minWidth: 200,
|
|
1831
|
+
maxWidth: 500,
|
|
1832
|
+
wrapperAttr: { class: 'global-toast-message' }
|
|
1833
|
+
}, {
|
|
1834
|
+
direction: 'up-push',
|
|
1835
|
+
position: 'bottom right'
|
|
1836
|
+
});
|
|
1837
|
+
}
|
|
1838
|
+
function format_date(date, locale) {
|
|
1839
|
+
return formatDate(date, 'yyyy/MM/dd', locale, 'GMT+8');
|
|
1840
|
+
}
|
|
1841
|
+
function format_datetime(date, locale) {
|
|
1842
|
+
return formatDate(date, 'yyyy/MM/dd HH:mm:ss', locale, 'GMT+8');
|
|
1843
|
+
}
|
|
1844
|
+
function localeSortMethod(value1, value2) {
|
|
1845
|
+
return value1.localeCompare(value2);
|
|
1846
|
+
}
|
|
1847
|
+
function file_type_icon(name) {
|
|
1848
|
+
const type = name.substring(name.lastIndexOf('.') + 1).toLocaleLowerCase();
|
|
1849
|
+
switch (type) {
|
|
1850
|
+
case 'doc':
|
|
1851
|
+
case 'docx':
|
|
1852
|
+
return 'word';
|
|
1853
|
+
case 'xls':
|
|
1854
|
+
case 'xlsx':
|
|
1855
|
+
case 'csv':
|
|
1856
|
+
return 'excel';
|
|
1857
|
+
case 'ppt':
|
|
1858
|
+
case 'pptx':
|
|
1859
|
+
return 'ppt';
|
|
1860
|
+
case 'pdf':
|
|
1861
|
+
return 'pdf';
|
|
1862
|
+
case 'txt':
|
|
1863
|
+
case 'xml':
|
|
1864
|
+
case 'json':
|
|
1865
|
+
case 'js':
|
|
1866
|
+
return 'text';
|
|
1867
|
+
case 'png':
|
|
1868
|
+
case 'jpg':
|
|
1869
|
+
case 'jpeg':
|
|
1870
|
+
case 'gif':
|
|
1871
|
+
case 'bmp':
|
|
1872
|
+
return 'image';
|
|
1873
|
+
case 'zip':
|
|
1874
|
+
case 'rar':
|
|
1875
|
+
case '7z':
|
|
1876
|
+
case 'jar':
|
|
1877
|
+
return 'zip';
|
|
1878
|
+
default:
|
|
1879
|
+
return 'unknown';
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
function support_preview_ext() {
|
|
1883
|
+
return ['pdf', 'png', 'jpg', 'jpeg', 'gif', 'bmp', 'doc', 'docx', 'txt', 'xml', 'json', 'js', 'xls', 'xlsx', 'csv', 'ppt', 'pptx'];
|
|
1884
|
+
}
|
|
1885
|
+
function format_file_size(size) {
|
|
1886
|
+
const labels = ['b', 'Kb', 'Mb', 'Gb'];
|
|
1887
|
+
const count = labels.length - 1;
|
|
1888
|
+
let i = 0;
|
|
1889
|
+
while (i < count && size >= 1024) {
|
|
1890
|
+
size /= 1024;
|
|
1891
|
+
i++;
|
|
1892
|
+
}
|
|
1893
|
+
return Math.round(size * 100) / 100 + " " + labels[i];
|
|
1894
|
+
}
|
|
1895
|
+
function filename_from_disposition(disposition) {
|
|
1896
|
+
const filenamePair = disposition.split(';').filter(str => /^filename=/.test(str.trim())).pop();
|
|
1897
|
+
if (filenamePair) {
|
|
1898
|
+
let str = filenamePair.trim();
|
|
1899
|
+
str = str.split('=')[1];
|
|
1900
|
+
str = str.replace(/['"]/g, '');
|
|
1901
|
+
return decodeURIComponent(str);
|
|
1902
|
+
}
|
|
1903
|
+
else {
|
|
1904
|
+
return null;
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
function download_file(blob, filename, callback) {
|
|
1908
|
+
const url = window.webkitURL.createObjectURL(blob);
|
|
1909
|
+
const a = document.createElement('a');
|
|
1910
|
+
document.body.appendChild(a);
|
|
1911
|
+
a.setAttribute('style', 'display:none');
|
|
1912
|
+
a.setAttribute('href', url);
|
|
1913
|
+
a.setAttribute('download', decodeURIComponent(filename));
|
|
1914
|
+
a.click();
|
|
1915
|
+
setTimeout(() => {
|
|
1916
|
+
if (callback) {
|
|
1917
|
+
callback();
|
|
1918
|
+
}
|
|
1919
|
+
a.remove();
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1922
|
+
function validate(validator) {
|
|
1923
|
+
return new Promise(resolve => {
|
|
1924
|
+
if (!validator) {
|
|
1925
|
+
resolve(true);
|
|
1926
|
+
}
|
|
1927
|
+
const validateResult = validator.instance.validate();
|
|
1928
|
+
if (!validateResult.isValid) {
|
|
1929
|
+
resolve(false);
|
|
1930
|
+
}
|
|
1931
|
+
if (validateResult.status === 'pending') {
|
|
1932
|
+
validateResult.complete?.then((result) => {
|
|
1933
|
+
if (result.isValid) {
|
|
1934
|
+
resolve(true);
|
|
1935
|
+
}
|
|
1936
|
+
else {
|
|
1937
|
+
resolve(false);
|
|
1938
|
+
}
|
|
1939
|
+
});
|
|
1940
|
+
}
|
|
1941
|
+
else {
|
|
1942
|
+
resolve(true);
|
|
1943
|
+
}
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1946
|
+
function validate_group(validationGroupComponent) {
|
|
1947
|
+
if (!validationGroupComponent) {
|
|
1948
|
+
return firstValueFrom(of(true));
|
|
1949
|
+
}
|
|
1950
|
+
return validateGroup(validationGroupComponent.instance, validationGroupComponent.element.nativeElement);
|
|
1951
|
+
}
|
|
1952
|
+
function validate_group_by_name(name, brokenElementParent) {
|
|
1953
|
+
const validationGroup = validationEngine.getGroupConfig(name);
|
|
1954
|
+
if (!validationGroup) {
|
|
1955
|
+
return firstValueFrom(of(true));
|
|
1956
|
+
}
|
|
1957
|
+
return validateGroup(validationGroup, brokenElementParent);
|
|
1958
|
+
}
|
|
1959
|
+
function validateGroup(validationGroup, brokenElementParent) {
|
|
1960
|
+
let sourceNode;
|
|
1961
|
+
const targetClassName = 'dx-field';
|
|
1962
|
+
const findTargetNode = (node) => {
|
|
1963
|
+
sourceNode = node;
|
|
1964
|
+
while (true) {
|
|
1965
|
+
if (node.classList.contains(targetClassName)) {
|
|
1966
|
+
return node;
|
|
1967
|
+
}
|
|
1968
|
+
else {
|
|
1969
|
+
node = node.parentElement;
|
|
1970
|
+
if (node === brokenElementParent) {
|
|
1971
|
+
return sourceNode;
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
};
|
|
1976
|
+
return new Promise(resolve => {
|
|
1977
|
+
const validateResult = validationGroup.validate();
|
|
1978
|
+
if (!validateResult.isValid) {
|
|
1979
|
+
const brokenElement = (validateResult.brokenRules?.[0]).validator.element();
|
|
1980
|
+
findTargetNode(brokenElement).scrollIntoView();
|
|
1981
|
+
resolve(false);
|
|
1982
|
+
}
|
|
1983
|
+
if (validateResult.status === 'pending') {
|
|
1984
|
+
validateResult.complete?.then((result) => {
|
|
1985
|
+
if (result.isValid) {
|
|
1986
|
+
resolve(true);
|
|
1987
|
+
}
|
|
1988
|
+
else {
|
|
1989
|
+
const brokenElement = (result.brokenRules?.[0]).validator.element();
|
|
1990
|
+
findTargetNode(brokenElement).scrollIntoView();
|
|
1991
|
+
resolve(false);
|
|
1992
|
+
}
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
else {
|
|
1996
|
+
resolve(true);
|
|
1997
|
+
}
|
|
1998
|
+
});
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2077
2001
|
class CustomTemplateDirective {
|
|
2078
2002
|
constructor(templateRef) {
|
|
2079
2003
|
this.templateRef = templateRef;
|
|
@@ -2875,9 +2799,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2875
2799
|
args: ['drawerFormContentTemplate', { static: true }]
|
|
2876
2800
|
}] } });
|
|
2877
2801
|
|
|
2878
|
-
class CellComponentBase extends ComponentBase {
|
|
2879
|
-
}
|
|
2880
|
-
|
|
2881
2802
|
class CellComponentTemplateComponent {
|
|
2882
2803
|
constructor(service) {
|
|
2883
2804
|
this.service = service;
|
|
@@ -2894,11 +2815,6 @@ class CellComponentTemplateComponent {
|
|
|
2894
2815
|
const componentRef = this.cellComponentRef.createComponent(plugin.component);
|
|
2895
2816
|
const instance = componentRef.instance;
|
|
2896
2817
|
Object.assign(instance, cellComponentConfig);
|
|
2897
|
-
if (!(instance instanceof CellComponentBase)) {
|
|
2898
|
-
console.error('cell component need extending CellComponentBase, name: ' + plugin.name);
|
|
2899
|
-
notify_error('加载单元格组件失败:' + plugin.name);
|
|
2900
|
-
return;
|
|
2901
|
-
}
|
|
2902
2818
|
instance.field = this.cellInfo.column.dataField;
|
|
2903
2819
|
instance.fieldConfig = fieldConfig;
|
|
2904
2820
|
instance.rowData = this.cellInfo.data;
|
|
@@ -3808,12 +3724,68 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
3808
3724
|
args: [PdfJsViewerComponent, { static: true }]
|
|
3809
3725
|
}] } });
|
|
3810
3726
|
|
|
3727
|
+
class ComponentBase {
|
|
3728
|
+
}
|
|
3729
|
+
|
|
3730
|
+
class CellComponentBase extends ComponentBase {
|
|
3731
|
+
}
|
|
3732
|
+
|
|
3733
|
+
class FormItemComponentBase extends ComponentBase {
|
|
3734
|
+
constructor() {
|
|
3735
|
+
super(...arguments);
|
|
3736
|
+
/**
|
|
3737
|
+
* 编辑模式,在设计器中为true,用于区分组件设计和应用状态
|
|
3738
|
+
*/
|
|
3739
|
+
this.editMode = false;
|
|
3740
|
+
/**
|
|
3741
|
+
* 表单只读状态,用于区分组件只读状态
|
|
3742
|
+
*/
|
|
3743
|
+
this.readonly = false;
|
|
3744
|
+
}
|
|
3745
|
+
}
|
|
3746
|
+
|
|
3747
|
+
class ModalComponentBase extends ComponentBase {
|
|
3748
|
+
}
|
|
3749
|
+
|
|
3750
|
+
class PageItemComponentBase extends ComponentBase {
|
|
3751
|
+
constructor() {
|
|
3752
|
+
super(...arguments);
|
|
3753
|
+
/**
|
|
3754
|
+
* 编辑模式,在设计器中为true,用于区分组件设计和应用状态
|
|
3755
|
+
*/
|
|
3756
|
+
this.editMode = false;
|
|
3757
|
+
}
|
|
3758
|
+
}
|
|
3759
|
+
|
|
3760
|
+
class ConfigBase {
|
|
3761
|
+
}
|
|
3762
|
+
|
|
3811
3763
|
class CellConfigBase extends ConfigBase {
|
|
3812
3764
|
}
|
|
3813
3765
|
|
|
3766
|
+
class FormItemConfigBase extends ConfigBase {
|
|
3767
|
+
constructor() {
|
|
3768
|
+
super(...arguments);
|
|
3769
|
+
/**
|
|
3770
|
+
* 配置更新事件,emit()将更新配置到组件,emit(true)将更新配置到组件并重新加载组件
|
|
3771
|
+
*/
|
|
3772
|
+
this.configChange = new EventEmitter();
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3775
|
+
|
|
3814
3776
|
class ModalConfigBase extends ConfigBase {
|
|
3815
3777
|
}
|
|
3816
3778
|
|
|
3779
|
+
class PageItemConfigBase extends ConfigBase {
|
|
3780
|
+
constructor() {
|
|
3781
|
+
super(...arguments);
|
|
3782
|
+
/**
|
|
3783
|
+
* 配置更新事件,emit()将更新配置到组件,emit(true)将更新配置到组件并重新加载组件
|
|
3784
|
+
*/
|
|
3785
|
+
this.configChange = new EventEmitter();
|
|
3786
|
+
}
|
|
3787
|
+
}
|
|
3788
|
+
|
|
3817
3789
|
class WebsocketModule {
|
|
3818
3790
|
}
|
|
3819
3791
|
WebsocketModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: WebsocketModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|