How to use the @pebula/ngrid.PblNgridPluginController.created function in @pebula/ngrid

To help you get started, we’ve selected a few @pebula/ngrid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shlomiassaf / ngrid / libs / ngrid-material / cell-tooltip / src / lib / cell-tooltip.module.ts View on Github external
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();
github shlomiassaf / ngrid / libs / ngrid / clipboard / src / lib / clipboard.module.ts View on Github external
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);
              }
            });
        }
      });
github shlomiassaf / ngrid / libs / ngrid / target-events / src / lib / target-events.module.ts View on Github external
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;
            }
          });
      }
    });
github shlomiassaf / ngrid / libs / ngrid / sticky / src / lib / sticky.module.ts View on Github external
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));