devextreme-angular
Version:
Angular UI and visualization components based on DevExtreme widgets
83 lines (78 loc) • 3.41 kB
JavaScript
import * as i0 from '@angular/core';
import { PLATFORM_ID, NgModule, Inject } from '@angular/core';
import { isPlatformServer } from '@angular/common';
import infernoRenderer from 'devextreme/core/inferno_renderer';
import { renderToString } from 'inferno-server';
/*!
* devextreme-angular
* Version: 25.1.4
* Build date: Tue Aug 05 2025
*
* Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file in the root of the project for details.
*
* https://github.com/DevExpress/devextreme-angular
*/
class DxServerModule {
constructor(platformId) {
if (isPlatformServer(platformId)) {
infernoRenderer.inject({
render: (component, props, container) => {
const el = infernoRenderer.createElement(component, props);
const document = container.ownerDocument;
const temp = document.createElement(container.tagName);
temp.innerHTML = renderToString(el);
const mainElement = temp.childNodes[0];
const childString = mainElement.innerHTML;
for (let i = 0; i < mainElement.attributes.length; i++) {
const attr = mainElement.attributes[i];
if (!container.hasAttribute(attr.name)) {
container.setAttribute(attr.name, attr.value);
}
}
container.innerHTML = childString;
},
renderIntoContainer: (jsx, container) => {
if (jsx === null) {
container.innerHTML = '';
return;
}
container.innerHTML = renderToString(jsx);
},
});
}
}
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DxServerModule, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.NgModule });
/** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: DxServerModule });
/** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DxServerModule });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DxServerModule, decorators: [{
type: NgModule,
args: [{
exports: [],
imports: [],
providers: [],
}]
}], ctorParameters: () => [{ type: undefined, decorators: [{
type: Inject,
args: [PLATFORM_ID]
}] }] });
/*!
* devextreme-angular
* Version: 25.1.4
* Build date: Tue Aug 05 2025
*
* Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file in the root of the project for details.
*
* https://github.com/DevExpress/devextreme-angular
*/
/**
* Generated bundle index. Do not edit.
*/
export { DxServerModule };
//# sourceMappingURL=devextreme-angular-server.mjs.map