ngx-rs-ant 1.4.1 → 1.4.4

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.
@@ -14,7 +14,6 @@ import * as i6 from 'devextreme-angular/ui/load-panel';
14
14
  import * as i6$1 from 'devextreme-angular/ui/nested';
15
15
  import { DxoPositionModule } from 'devextreme-angular/ui/nested';
16
16
  import * as i4 from 'devextreme-angular/ui/button';
17
- import { HelperUtils } from 'ng-devui';
18
17
  import * as i1$1 from '@angular/common/http';
19
18
  import CustomStore from 'devextreme/data/custom_store';
20
19
  import * as i3 from 'devextreme-angular/core';
@@ -26,6 +25,8 @@ import * as i3$1 from 'devextreme-angular/ui/accordion';
26
25
  import * as i7 from 'devextreme-angular/ui/validation-group';
27
26
  import * as i4$1 from 'devextreme-angular/ui/text-box';
28
27
  import * as i4$2 from 'devextreme-angular/ui/popover';
28
+ import * as i2$3 from 'ng2-pdfjs-viewer';
29
+ import { PdfJsViewerComponent, PdfJsViewerModule } from 'ng2-pdfjs-viewer';
29
30
 
30
31
  class DividerLineComponent {
31
32
  get _style() {
@@ -1934,11 +1935,10 @@ class DataGridService {
1934
1935
  return response.data.list;
1935
1936
  }));
1936
1937
  }
1937
- downloadAttachment(id, filename, onSuccess) {
1938
- HelperUtils.downloadFileByHttpClient(this.http, 'api/file/download/' + id, {
1939
- method: 'GET',
1940
- filename
1941
- }, undefined, onSuccess);
1938
+ downloadAttachment(id) {
1939
+ return this.http.get('api/file/download/' + id, {
1940
+ responseType: "blob"
1941
+ });
1942
1942
  }
1943
1943
  getUserInfo(uid) {
1944
1944
  if (!this.userInfoCache.hasOwnProperty(uid)) {
@@ -2502,6 +2502,21 @@ function format_file_size(size) {
2502
2502
  }
2503
2503
  return Math.round(size * 100) / 100 + " " + labels[i];
2504
2504
  }
2505
+ function download_file(blob, filename, callback) {
2506
+ const url = window.webkitURL.createObjectURL(blob);
2507
+ const a = document.createElement('a');
2508
+ document.body.appendChild(a);
2509
+ a.setAttribute('style', 'display:none');
2510
+ a.setAttribute('href', url);
2511
+ a.setAttribute('download', decodeURIComponent(filename));
2512
+ a.click();
2513
+ setTimeout(() => {
2514
+ if (callback) {
2515
+ callback();
2516
+ }
2517
+ a.remove();
2518
+ });
2519
+ }
2505
2520
  async function validate(validator) {
2506
2521
  return new Promise(resolve => {
2507
2522
  const validateResult = validator.instance.validate();
@@ -2600,18 +2615,47 @@ class FileCellTemplateComponent {
2600
2615
  });
2601
2616
  });
2602
2617
  }
2618
+ preview() {
2619
+ if (!window.coast.tabManager) {
2620
+ notify_warning('此操作仅能在coast-web项目中执行,type:preview');
2621
+ return;
2622
+ }
2623
+ window.coast.tabManager.add.next({
2624
+ type: 'preview',
2625
+ id: 'preview:' + this.oid,
2626
+ title: this.filename,
2627
+ config: {
2628
+ config: {
2629
+ direction: "row",
2630
+ list: [{
2631
+ type: "plugin",
2632
+ style: {},
2633
+ config: {
2634
+ name: "coast-file-preview",
2635
+ pluginConfig: {
2636
+ id: this.oid,
2637
+ name: this.filename
2638
+ }
2639
+ }
2640
+ }]
2641
+ }
2642
+ }
2643
+ });
2644
+ }
2603
2645
  download() {
2604
2646
  this.loading = true;
2605
- this.service.downloadAttachment(this.oid, this.filename, () => {
2606
- this.loading = false;
2647
+ this.service.downloadAttachment(this.oid).subscribe(blob => {
2648
+ download_file(blob, this.filename, () => {
2649
+ this.loading = false;
2650
+ });
2607
2651
  });
2608
2652
  }
2609
2653
  }
2610
2654
  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 });
2611
- 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"] }] });
2655
+ 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-file\" text=\"\u9884\u89C8\"\n (onClick)=\"preview()\" [disabled]=\"loading\"></dx-button>\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"] }] });
2612
2656
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FileCellTemplateComponent, decorators: [{
2613
2657
  type: Component,
2614
- args: [{ selector: 'rs-file-cell-template', 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" }]
2658
+ args: [{ selector: 'rs-file-cell-template', 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-file\" text=\"\u9884\u89C8\"\n (onClick)=\"preview()\" [disabled]=\"loading\"></dx-button>\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" }]
2615
2659
  }], ctorParameters: function () { return [{ type: DataGridService }, { type: i2$2.DomSanitizer }]; }, propDecorators: { table: [{
2616
2660
  type: Input
2617
2661
  }], oid: [{
@@ -3556,6 +3600,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
3556
3600
  }]
3557
3601
  }], ctorParameters: function () { return []; } });
3558
3602
 
3603
+ class PdfViewerComponent {
3604
+ constructor(http) {
3605
+ this.http = http;
3606
+ this.loaded = new EventEmitter();
3607
+ }
3608
+ ngOnInit() {
3609
+ this.http.get(this.src, {
3610
+ responseType: "blob"
3611
+ }).subscribe(response => {
3612
+ this.viewer.pdfSrc = response;
3613
+ this.viewer.refresh();
3614
+ this.loaded.emit();
3615
+ });
3616
+ }
3617
+ }
3618
+ PdfViewerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PdfViewerComponent, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Component });
3619
+ PdfViewerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: PdfViewerComponent, isStandalone: true, selector: "rs-pdf-viewer", inputs: { src: "src" }, outputs: { loaded: "loaded" }, viewQueries: [{ propertyName: "viewer", first: true, predicate: PdfJsViewerComponent, descendants: true, static: true }], ngImport: i0, template: "<ng2-pdfjs-viewer\n [openFile]=\"false\"\n [download]=\"false\"\n [viewBookmark]=\"false\"\n>\n</ng2-pdfjs-viewer>\n", styles: [":host{display:flex;flex-flow:column nowrap}:host ng2-pdfjs-viewer{flex:1}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: PdfJsViewerModule }, { kind: "component", type: i2$3.PdfJsViewerComponent, selector: "ng2-pdfjs-viewer", inputs: ["viewerId", "viewerFolder", "externalWindow", "showSpinner", "downloadFileName", "openFile", "download", "startDownload", "viewBookmark", "print", "startPrint", "fullScreen", "find", "zoom", "nameddest", "pagemode", "lastPage", "rotatecw", "rotateccw", "cursor", "scroll", "spread", "locale", "useOnlyCssZoom", "errorOverride", "errorAppend", "errorMessage", "diagnosticLogs", "externalWindowOptions", "page", "pdfSrc"], outputs: ["onBeforePrint", "onAfterPrint", "onDocumentLoad", "onPageChange"] }] });
3620
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PdfViewerComponent, decorators: [{
3621
+ type: Component,
3622
+ args: [{ selector: 'rs-pdf-viewer', standalone: true, imports: [CommonModule, PdfJsViewerModule], template: "<ng2-pdfjs-viewer\n [openFile]=\"false\"\n [download]=\"false\"\n [viewBookmark]=\"false\"\n>\n</ng2-pdfjs-viewer>\n", styles: [":host{display:flex;flex-flow:column nowrap}:host ng2-pdfjs-viewer{flex:1}\n"] }]
3623
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; }, propDecorators: { src: [{
3624
+ type: Input
3625
+ }], loaded: [{
3626
+ type: Output
3627
+ }], viewer: [{
3628
+ type: ViewChild,
3629
+ args: [PdfJsViewerComponent, { static: true }]
3630
+ }] } });
3631
+
3559
3632
  class WebsocketModule {
3560
3633
  }
3561
3634
  WebsocketModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WebsocketModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -3723,5 +3796,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
3723
3796
  * Generated bundle index. Do not edit.
3724
3797
  */
3725
3798
 
3726
- 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 };
3799
+ 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, PdfViewerComponent, PluginManager, RowButtonsTemplateDirective, TooltipContentTemplateDirective, WebsocketModule, WebsocketService, download_file, file_type_icon, format_date, format_datetime, format_file_size, notify_error, notify_success, notify_warning, validate, validate_group };
3727
3800
  //# sourceMappingURL=ngx-rs-ant.mjs.map