ngx-rs-ant 1.3.7 → 1.3.8

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.
@@ -2,7 +2,7 @@ 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 { CommonModule } from '@angular/common';
5
+ import { CommonModule, formatDate } from '@angular/common';
6
6
  import { Subject, ReplaySubject, Subscription, map, shareReplay, lastValueFrom, debounceTime, interval } from 'rxjs';
7
7
  import * as i2 from 'devextreme-angular/ui/number-box';
8
8
  import * as i2$1 from 'devextreme-angular/ui/draggable';
@@ -20,10 +20,10 @@ import CustomStore from 'devextreme/data/custom_store';
20
20
  import * as i3 from 'devextreme-angular/core';
21
21
  import * as i5$1 from 'devextreme-angular/ui/data-grid';
22
22
  import * as i5 from 'devextreme-angular/ui/tooltip';
23
- import * as i2$2 from '@angular/platform-browser';
24
- import * as i3$1 from 'devextreme-angular/ui/accordion';
25
23
  import { __awaiter } from 'tslib';
26
24
  import notify from 'devextreme/ui/notify';
25
+ import * as i2$2 from '@angular/platform-browser';
26
+ import * as i3$1 from 'devextreme-angular/ui/accordion';
27
27
  import * as i7 from 'devextreme-angular/ui/validation-group';
28
28
  import * as i4$1 from 'devextreme-angular/ui/text-box';
29
29
  import * as i4$2 from 'devextreme-angular/ui/popover';
@@ -2331,6 +2331,7 @@ class DataGridFactory {
2331
2331
  cssClass: 'cell-vertical-middle',
2332
2332
  allowHeaderFiltering: false,
2333
2333
  allowFiltering: false,
2334
+ allowSorting: false,
2334
2335
  visible: field.visible,
2335
2336
  fixed: field.fixed
2336
2337
  };
@@ -2424,6 +2425,160 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
2424
2425
  }]
2425
2426
  }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
2426
2427
 
2428
+ function notify_error(message) {
2429
+ notify({
2430
+ displayTime: 12000,
2431
+ message,
2432
+ type: 'error',
2433
+ width: '300px'
2434
+ }, {
2435
+ direction: 'up-push',
2436
+ position: 'bottom right'
2437
+ });
2438
+ }
2439
+ function notify_warning(message) {
2440
+ notify({
2441
+ displayTime: 8000,
2442
+ message,
2443
+ type: 'warning',
2444
+ width: '300px'
2445
+ }, {
2446
+ direction: 'up-push',
2447
+ position: 'bottom right'
2448
+ });
2449
+ }
2450
+ function notify_success(message) {
2451
+ notify({
2452
+ displayTime: 4000,
2453
+ message,
2454
+ type: 'success',
2455
+ width: '300px'
2456
+ }, {
2457
+ direction: 'down-push',
2458
+ position: 'top right'
2459
+ });
2460
+ }
2461
+ function format_date(date, locale) {
2462
+ return formatDate(date, 'yyyy/MM/dd', locale, 'GMT+8');
2463
+ }
2464
+ function format_datetime(date, locale) {
2465
+ return formatDate(date, 'yyyy/MM/dd HH:mm:ss', locale, 'GMT+8');
2466
+ }
2467
+ function file_type_icon(name) {
2468
+ const type = name.substring(name.lastIndexOf('.') + 1).toLocaleLowerCase();
2469
+ switch (type) {
2470
+ case 'xls':
2471
+ case 'xlsx':
2472
+ return 'excel';
2473
+ case 'doc':
2474
+ case 'docx':
2475
+ return 'word';
2476
+ case 'ppt':
2477
+ case 'pptx':
2478
+ return 'ppt';
2479
+ case 'pdf':
2480
+ return 'pdf';
2481
+ case 'txt':
2482
+ case 'csv':
2483
+ case 'xml':
2484
+ case 'json':
2485
+ case 'js':
2486
+ return 'text';
2487
+ case 'jpg':
2488
+ case 'jpeg':
2489
+ case 'png':
2490
+ case 'gif':
2491
+ return 'image';
2492
+ case 'zip':
2493
+ case 'rar':
2494
+ case '7z':
2495
+ case 'jar':
2496
+ return 'zip';
2497
+ default:
2498
+ return 'unknown';
2499
+ }
2500
+ }
2501
+ function format_file_size(size) {
2502
+ const labels = ['b', 'Kb', 'Mb', 'Gb'];
2503
+ const count = labels.length - 1;
2504
+ let i = 0;
2505
+ while (i < count && size >= 1024) {
2506
+ size /= 1024;
2507
+ i++;
2508
+ }
2509
+ return Math.round(size * 100) / 100 + " " + labels[i];
2510
+ }
2511
+ function validate(validator) {
2512
+ return __awaiter(this, void 0, void 0, function* () {
2513
+ return new Promise(resolve => {
2514
+ var _a;
2515
+ const validateResult = validator.instance.validate();
2516
+ if (!validateResult.isValid) {
2517
+ resolve(false);
2518
+ }
2519
+ if (validateResult.status === 'pending') {
2520
+ (_a = validateResult.complete) === null || _a === void 0 ? void 0 : _a.then((result) => {
2521
+ if (result.isValid) {
2522
+ resolve(true);
2523
+ }
2524
+ else {
2525
+ resolve(false);
2526
+ }
2527
+ });
2528
+ }
2529
+ else {
2530
+ resolve(true);
2531
+ }
2532
+ });
2533
+ });
2534
+ }
2535
+ function validate_group(validationGroup) {
2536
+ return __awaiter(this, void 0, void 0, function* () {
2537
+ const top = validationGroup.element.nativeElement;
2538
+ let sourceNode;
2539
+ const targetClassName = 'dx-field';
2540
+ const findTargetNode = (node) => {
2541
+ sourceNode = node;
2542
+ while (true) {
2543
+ if (node.classList.contains(targetClassName)) {
2544
+ return node;
2545
+ }
2546
+ else {
2547
+ node = node.parentElement;
2548
+ if (node === top) {
2549
+ return sourceNode;
2550
+ }
2551
+ }
2552
+ }
2553
+ };
2554
+ return new Promise(resolve => {
2555
+ var _a, _b;
2556
+ const validateResult = validationGroup.instance.validate();
2557
+ if (!validateResult.isValid) {
2558
+ const brokenElement = ((_a = validateResult.brokenRules) === null || _a === void 0 ? void 0 : _a[0]).validator.element();
2559
+ findTargetNode(brokenElement).scrollIntoView();
2560
+ resolve(false);
2561
+ }
2562
+ if (validateResult.status === 'pending') {
2563
+ (_b = validateResult.complete) === null || _b === void 0 ? void 0 : _b.then((result) => {
2564
+ var _a;
2565
+ if (result.isValid) {
2566
+ resolve(true);
2567
+ }
2568
+ else {
2569
+ const brokenElement = ((_a = result.brokenRules) === null || _a === void 0 ? void 0 : _a[0]).validator.element();
2570
+ findTargetNode(brokenElement).scrollIntoView();
2571
+ resolve(false);
2572
+ }
2573
+ });
2574
+ }
2575
+ else {
2576
+ resolve(true);
2577
+ }
2578
+ });
2579
+ });
2580
+ }
2581
+
2427
2582
  class FileCellTemplateComponent {
2428
2583
  constructor(service, domSanitizer) {
2429
2584
  this.service = service;
@@ -2438,11 +2593,11 @@ class FileCellTemplateComponent {
2438
2593
  <table>
2439
2594
  <tr>
2440
2595
  <td style="text-align: right;">名称:</td>
2441
- <td style="text-align: left;">${this.file.fileName}</td>
2596
+ <td style="text-align: left;">${this.filename}</td>
2442
2597
  </tr>
2443
2598
  <tr>
2444
2599
  <td style="text-align: right;">大小:</td>
2445
- <td style="text-align: left;">${this.getFileSize(this.file.fileSize)}</td>
2600
+ <td style="text-align: left;">${format_file_size(this.file.fileSize)}</td>
2446
2601
  </tr>
2447
2602
  <tr>
2448
2603
  <td style="text-align: right;">时间:</td>
@@ -2450,46 +2605,7 @@ class FileCellTemplateComponent {
2450
2605
  </tr>
2451
2606
  </table>
2452
2607
  `);
2453
- const type = this.file.fileName.substring(this.file.fileName.lastIndexOf('.') + 1).toLocaleLowerCase();
2454
- switch (type) {
2455
- case 'xls':
2456
- case 'xlsx':
2457
- this.icon = 'excel';
2458
- break;
2459
- case 'doc':
2460
- case 'docx':
2461
- this.icon = 'word';
2462
- break;
2463
- case 'ppt':
2464
- case 'pptx':
2465
- this.icon = 'ppt';
2466
- break;
2467
- case 'pdf':
2468
- this.icon = 'pdf';
2469
- break;
2470
- case 'txt':
2471
- case 'csv':
2472
- case 'xml':
2473
- case 'json':
2474
- case 'js':
2475
- this.icon = 'text';
2476
- break;
2477
- case 'jpg':
2478
- case 'jpeg':
2479
- case 'png':
2480
- case 'gif':
2481
- this.icon = 'image';
2482
- break;
2483
- case 'zip':
2484
- case 'rar':
2485
- case '7z':
2486
- case 'jar':
2487
- this.icon = 'zip';
2488
- break;
2489
- default:
2490
- this.icon = 'unknown';
2491
- break;
2492
- }
2608
+ this.icon = file_type_icon(this.filename);
2493
2609
  // 重绘表格宽高
2494
2610
  setTimeout(() => {
2495
2611
  //this.table.resize();
@@ -2503,16 +2619,6 @@ class FileCellTemplateComponent {
2503
2619
  this.loading = false;
2504
2620
  });
2505
2621
  }
2506
- getFileSize(size) {
2507
- const labels = ['b', 'Kb', 'Mb', 'Gb'];
2508
- const count = labels.length - 1;
2509
- let i = 0;
2510
- while (i < count && size >= 1024) {
2511
- size /= 1024;
2512
- i++;
2513
- }
2514
- return Math.round(size * 100) / 100 + " " + labels[i];
2515
- }
2516
2622
  }
2517
2623
  FileCellTemplateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FileCellTemplateComponent, deps: [{ token: DataGridService }, { token: i2$2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
2518
2624
  FileCellTemplateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: FileCellTemplateComponent, selector: "rs-file-cell-template", inputs: { table: "table", oid: "oid" }, ngImport: i0, template: "<dx-button #fileBtn type=\"default\" stylingMode=\"text\">\n <i class=\"coast-icon-file-{{icon}}\" style=\"padding-right: 4px;\"></i>\n {{filename}}\n <dx-tooltip [target]=\"fileBtn.instance.element()\"\n [position]=\"'top'\"\n [visible]=\"false\"\n [showEvent]=\"'click'\">\n <div *dxTemplate=\"let data of 'content'\">\n <div [innerHTML]=\"content\"></div>\n <dx-button type=\"default\" stylingMode=\"text\" icon=\"coast-icon coast-icon-download\" text=\"\u4E0B\u8F7D\"\n (onClick)=\"download()\" [disabled]=\"loading\"></dx-button>\n </div>\n </dx-tooltip>\n</dx-button><br/>\n", styles: [""], dependencies: [{ kind: "directive", type: i3.DxTemplateDirective, selector: "[dxTemplate]", inputs: ["dxTemplateOf"] }, { kind: "component", type: i4.DxButtonComponent, selector: "dx-button", inputs: ["accessKey", "activeStateEnabled", "disabled", "elementAttr", "focusStateEnabled", "height", "hint", "hoverStateEnabled", "icon", "rtlEnabled", "stylingMode", "tabIndex", "template", "text", "type", "useSubmitBehavior", "validationGroup", "visible", "width"], outputs: ["onClick", "onContentReady", "onDisposing", "onInitialized", "onOptionChanged", "accessKeyChange", "activeStateEnabledChange", "disabledChange", "elementAttrChange", "focusStateEnabledChange", "heightChange", "hintChange", "hoverStateEnabledChange", "iconChange", "rtlEnabledChange", "stylingModeChange", "tabIndexChange", "templateChange", "textChange", "typeChange", "useSubmitBehaviorChange", "validationGroupChange", "visibleChange", "widthChange"] }, { kind: "component", type: i5.DxTooltipComponent, selector: "dx-tooltip", inputs: ["animation", "closeOnOutsideClick", "container", "contentTemplate", "copyRootClassesToWrapper", "deferRendering", "disabled", "elementAttr", "height", "hideEvent", "hideOnOutsideClick", "hideOnParentScroll", "hint", "hoverStateEnabled", "maxHeight", "maxWidth", "minHeight", "minWidth", "position", "rtlEnabled", "shading", "shadingColor", "showEvent", "target", "visible", "width", "wrapperAttr"], outputs: ["onContentReady", "onDisposing", "onHidden", "onHiding", "onInitialized", "onOptionChanged", "onShowing", "onShown", "animationChange", "closeOnOutsideClickChange", "containerChange", "contentTemplateChange", "copyRootClassesToWrapperChange", "deferRenderingChange", "disabledChange", "elementAttrChange", "heightChange", "hideEventChange", "hideOnOutsideClickChange", "hideOnParentScrollChange", "hintChange", "hoverStateEnabledChange", "maxHeightChange", "maxWidthChange", "minHeightChange", "minWidthChange", "positionChange", "rtlEnabledChange", "shadingChange", "shadingColorChange", "showEventChange", "targetChange", "visibleChange", "widthChange", "wrapperAttrChange"] }] });
@@ -2842,110 +2948,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
2842
2948
  type: Injectable
2843
2949
  }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
2844
2950
 
2845
- function notify_error(message) {
2846
- notify({
2847
- displayTime: 12000,
2848
- message,
2849
- type: 'error',
2850
- width: '300px'
2851
- }, {
2852
- direction: 'up-push',
2853
- position: 'bottom right'
2854
- });
2855
- }
2856
- function notify_warning(message) {
2857
- notify({
2858
- displayTime: 8000,
2859
- message,
2860
- type: 'warning',
2861
- width: '300px'
2862
- }, {
2863
- direction: 'up-push',
2864
- position: 'bottom right'
2865
- });
2866
- }
2867
- function notify_success(message) {
2868
- notify({
2869
- displayTime: 4000,
2870
- message,
2871
- type: 'success',
2872
- width: '300px'
2873
- }, {
2874
- direction: 'down-push',
2875
- position: 'top right'
2876
- });
2877
- }
2878
- function validate(validator) {
2879
- return __awaiter(this, void 0, void 0, function* () {
2880
- return new Promise(resolve => {
2881
- var _a;
2882
- const validateResult = validator.instance.validate();
2883
- if (!validateResult.isValid) {
2884
- resolve(false);
2885
- }
2886
- if (validateResult.status === 'pending') {
2887
- (_a = validateResult.complete) === null || _a === void 0 ? void 0 : _a.then((result) => {
2888
- if (result.isValid) {
2889
- resolve(true);
2890
- }
2891
- else {
2892
- resolve(false);
2893
- }
2894
- });
2895
- }
2896
- else {
2897
- resolve(true);
2898
- }
2899
- });
2900
- });
2901
- }
2902
- function validate_group(validationGroup) {
2903
- return __awaiter(this, void 0, void 0, function* () {
2904
- const top = validationGroup.element.nativeElement;
2905
- let sourceNode;
2906
- const targetClassName = 'dx-field';
2907
- const findTargetNode = (node) => {
2908
- sourceNode = node;
2909
- while (true) {
2910
- if (node.classList.contains(targetClassName)) {
2911
- return node;
2912
- }
2913
- else {
2914
- node = node.parentElement;
2915
- if (node === top) {
2916
- return sourceNode;
2917
- }
2918
- }
2919
- }
2920
- };
2921
- return new Promise(resolve => {
2922
- var _a, _b;
2923
- const validateResult = validationGroup.instance.validate();
2924
- if (!validateResult.isValid) {
2925
- const brokenElement = ((_a = validateResult.brokenRules) === null || _a === void 0 ? void 0 : _a[0]).validator.element();
2926
- findTargetNode(brokenElement).scrollIntoView();
2927
- resolve(false);
2928
- }
2929
- if (validateResult.status === 'pending') {
2930
- (_b = validateResult.complete) === null || _b === void 0 ? void 0 : _b.then((result) => {
2931
- var _a;
2932
- if (result.isValid) {
2933
- resolve(true);
2934
- }
2935
- else {
2936
- const brokenElement = ((_a = result.brokenRules) === null || _a === void 0 ? void 0 : _a[0]).validator.element();
2937
- findTargetNode(brokenElement).scrollIntoView();
2938
- resolve(false);
2939
- }
2940
- });
2941
- }
2942
- else {
2943
- resolve(true);
2944
- }
2945
- });
2946
- });
2947
- }
2948
-
2949
2951
  class FormComponent {
2950
2952
  constructor(viewContainerRef, service, elementRef) {
2951
2953
  this.viewContainerRef = viewContainerRef;
@@ -3729,5 +3731,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
3729
3731
  * Generated bundle index. Do not edit.
3730
3732
  */
3731
3733
 
3732
- export { BoxContainerComponent, BoxContainerModule, CamundaBpmnEditorComponent, CamundaBpmnEditorModule, ChangeFilter, CodeEditorComponent, CodeEditorModule, DataDetailComponent, DataDetailModule, DataGridComponent, DataGridFactory, DataGridModule, DataGridService, DrawerComponent, DrawerModule, DrawerService, DynamicParamsComponent, DynamicParamsModule, FormComponent, FormModule, FormService, IconSelectorComponent, IconSelectorModule, InstanceLinkTemplateDirective, ItemConfigComponent, ItemStyleComponent, MasterDetailTemplateDirective, ModalComponent, ModalModule, ModalService, PluginManager, RowButtonsTemplateDirective, TooltipContentTemplateDirective, WebsocketModule, WebsocketService, notify_error, notify_success, notify_warning, validate, validate_group };
3734
+ export { BoxContainerComponent, BoxContainerModule, CamundaBpmnEditorComponent, CamundaBpmnEditorModule, ChangeFilter, CodeEditorComponent, CodeEditorModule, DataDetailComponent, DataDetailModule, DataGridComponent, DataGridFactory, DataGridModule, DataGridService, DrawerComponent, DrawerModule, DrawerService, DynamicParamsComponent, DynamicParamsModule, FormComponent, FormModule, FormService, IconSelectorComponent, IconSelectorModule, InstanceLinkTemplateDirective, ItemConfigComponent, ItemStyleComponent, MasterDetailTemplateDirective, ModalComponent, ModalModule, ModalService, PluginManager, RowButtonsTemplateDirective, TooltipContentTemplateDirective, WebsocketModule, WebsocketService, file_type_icon, format_date, format_datetime, format_file_size, notify_error, notify_success, notify_warning, validate, validate_group };
3733
3735
  //# sourceMappingURL=ngx-rs-ant.mjs.map