Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(@Optional() @SkipSelf() parentModule: PblNgridCellTooltipModule,
configService: PblNgridConfigService) {
if (parentModule) {
return;
}
PblNgridPluginController.created
.subscribe( event => {
// Do not remove the explicit reference to `PblNgridCellTooltipDirective`
// We use `PblNgridCellTooltipDirective.PLUGIN_KEY` to create a direct reference to `PblNgridCellTooltipDirective`
// which will disable dead code elimination for the `PblNgridCellTooltipDirective` plugin.
// If it is not set, using the plugin will only work when it is used in templates, other wise, if used programmatically (`autoSetAll`)
// CLI prod builds will remove the plugin's code.
const cellTooltipConfig = configService.get(PblNgridCellTooltipDirective.PLUGIN_KEY);
if (cellTooltipConfig && cellTooltipConfig.autoSetAll === true) {
const pluginCtrl = event.controller;
let subscription = pluginCtrl.events
.subscribe( evt => {
if (evt.kind === 'onInit') {
if (!pluginCtrl.hasPlugin(PblNgridCellTooltipDirective.PLUGIN_KEY)) {
pluginCtrl.createPlugin(PblNgridCellTooltipDirective.PLUGIN_KEY);
}
subscription.unsubscribe();
constructor(@Optional() @SkipSelf() parentModule: PblNgridClipboardPluginModule,
configService: PblNgridConfigService) {
if (parentModule) {
return;
}
PblNgridPluginController.created
.subscribe( event => {
const config = configService.get(PLUGIN_KEY, {});
if (config.autoEnable === true) {
const pluginCtrl = event.controller;
pluginCtrl.events
.pipe(
filter( e => e.kind === 'onInit' ),
first(),
)
.subscribe( e => {
if (!pluginCtrl.hasPlugin(PLUGIN_KEY)) {
pluginCtrl.createPlugin(PLUGIN_KEY);
}
});
}
});
constructor(@Optional() @SkipSelf() parentModule: PblNgridTargetEventsModule,
configService: PblNgridConfigService) {
if (parentModule) {
return;
}
PblNgridPluginController.created
.subscribe( event => {
const targetEventsConfig = configService.get(PLUGIN_KEY);
if (targetEventsConfig && targetEventsConfig.autoEnable === true) {
const pluginCtrl = event.controller;
let subscription = pluginCtrl.events
.subscribe( evt => {
if (evt.kind === 'onInit') {
if (!pluginCtrl.hasPlugin(PLUGIN_KEY)) {
pluginCtrl.createPlugin(PLUGIN_KEY);
}
subscription.unsubscribe();
subscription = undefined;
}
});
}
});
constructor(@Optional() @SkipSelf() parentModule: PblNgridStickyModule,
configService: PblNgridConfigService) {
if (parentModule) {
return;
}
PblNgridPluginController.created
.subscribe( event => {
const { table, controller } = event;
if (controller && !controller.hasPlugin('sticky')) {
controller.events
.pipe( filter( e => e.kind === 'onInit' ), first() )
.subscribe( event => {
const stickyPluginConfig = configService.get('stickyPlugin');
if (stickyPluginConfig) {
if (stickyPluginConfig.headers) {
setStickyRow(table, 'header', stickyPluginConfig.headers.map(MAPPER));
}
if (stickyPluginConfig.footers) {
setStickyRow(table, 'footer', stickyPluginConfig.footers.map(MAPPER));
}
if (stickyPluginConfig.columnStart) {
setStickyColumns(table, 'start', stickyPluginConfig.columnStart.map(MAPPER));