Я хочу, чтобы сценарий запускался на одном компоненте.
Uncaught TypeError: e.System is undefined
<anonymous> http://localhost:9000/assets/stimulsoft/stimulsoft.viewer.js:11<br>
<anonymous> http://localhost:9000/assets/stimulsoft/stimulsoft.viewer.js:11<br>
<anonymous> http://localhost:9000/assets/stimulsoft/stimulsoft.viewer.js:11<br>
<anonymous> http://localhost:9000/assets/stimulsoft/stimulsoft.viewer.js:11<br>
<anonymous> http://localhost:9000/assets/stimulsoft/stimulsoft.viewer.js:11<br>
Uncaught TypeError: e.Report.Components is undefined<br>
<anonymous> http://localhost:9000/assets/stimulsoft/stimulsoft.designer.js:23<br>
<anonymous> http://localhost:9000/assets/stimulsoft/stimulsoft.designer.js:23<br>
<anonymous> http://localhost:9000/assets/stimulsoft/stimulsoft.designer.js:23<br>
<anonymous> http://localhost:9000/assets/stimulsoft/stimulsoft.designer.js:23<br>
ERROR TypeError: Stimulsoft.Designer is undefined<br>
ngOnInit webpack-internal:///./src/main/webapp/app/reports/report-designer/report-designer.component.ts:18
Angular 7.
report.designer.ts
import { Component, OnInit } from '@angular/core';
import {HttpHeaders, HttpResponse} from '@angular/common/http';
import {IComboVahedAmoozeshi} from 'app/shared/model/combo-vahed-amoozeshi.model';
import {ComboVahedAmoozeshiService} from 'app/entities/combo-vahed-amoozeshi';
declare const Stimulsoft: any;
@Component({
selector: 'jhi-report-designer',
templateUrl: './report-designer.component.html',
styleUrls: ['./report-designer.component.scss']
})
export class ReportDesignerComponent implements OnInit {
comboVahedAmoozeshiS: IComboVahedAmoozeshi[];
constructor(protected comboVahedAmoozeshiService: ComboVahedAmoozeshiService) {
}
ngOnInit() {
this.comboVahedAmoozeshiService.query().subscribe((res: HttpResponse<IComboVahedAmoozeshi[]>) => {
this.comboVahedAmoozeshiS = res.body;
setTimeout(function() {
const options = new Stimulsoft.Designer.StiDesignerOptions();
const designer = new Stimulsoft.Designer.StiDesigner(options, 'StiDesigner', false);
designer.renderHtml('designerContent');
const report = new Stimulsoft.Report.StiReport();
// report.loadFile('assets/stimulsoft/firstReport.mrt');
const dataSet = new Stimulsoft.System.Data.DataSet('comboVahedAmoozeshiS');
report.dictionary.databases.clear();
dataSet.readJson(this.comboVahedAmoozeshiS);
report.regData(dataSet.dataSetName, 'comboVahedAmoozeshiS', dataSet);
// alert(dataSet.);
report.dictionary.synchronize();
designer.report = report;
}, 3000);
});
}
}
report.designer.module.ts
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { ReportDesignerComponent } from './report-designer.component';
import { REPORT_DESIGNER_ROUTE } from './report-designer.route';
import {AsarBakhshiPrjSharedModule} from 'app/shared';
@NgModule({
imports: [AsarBakhshiPrjSharedModule, RouterModule.forChild([REPORT_DESIGNER_ROUTE])],
declarations: [ReportDesignerComponent]
})
export class ReportDesignerModule {
loadAPI: Promise<any>;
constructor() {
this.loadAPI = new Promise(resolve => {
this.loadScript();
resolve(true);
});
}
loadScript() {
let i;
let isFound = false;
const scripts = document.getElementsByTagName('script');
// alert(scripts.length);
for (i = 0; i < scripts.length; ++i) {
if (scripts[i].getAttribute('src') != null && scripts[i].getAttribute('src').includes('loader')) {
isFound = true;
}
}
if (!isFound) {
const dynamicScripts = ['assets/stimulsoft/stimulsoft.reports.js', 'assets/stimulsoft/stimulsoft.viewer.js', 'assets/stimulsoft/stimulsoft.designer.js'];
// const dynamicScripts = ['assets/stimulsoft/load.js'];
for (i = 0; i < dynamicScripts.length; i++) {
const node = document.createElement('script');
node.setAttribute('src', dynamicScripts[i]);
node.setAttribute('type', 'text/javascript');
node.setAttribute('charset', 'utf-8');
node.setAttribute('async', 'true');
document.getElementsByTagName('head')[0].appendChild(node);
}
}
}
}
webpack.common. js
{ from: './src/main/webapp/assets/stimulsoft', to: 'assets/stimulsoft/', toType:'dir'}