Commit 6ce4aed5 authored by Merzough Münker's avatar Merzough Münker
Browse files

feat: add support for the form context token

parent 7014bfec
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -3,4 +3,3 @@ export * from './lib/form-window-ref';
export * from './lib/open-form.directive';
export * from './lib/form-window-footer.directive';
export * from './lib/open-form-window.method';
export * from './lib/tokens';
+3 −3
Original line number Diff line number Diff line
@@ -22,7 +22,8 @@ import {
  RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD,
  FormSubmitSuccessfulMethod,
  RXAP_FORM_LOAD_METHOD,
  FormLoadMethod
  FormLoadMethod,
  RXAP_FORM_CONTEXT
} from '@rxap/forms';
import {
  Constructor,
@@ -30,7 +31,6 @@ import {
  DeleteUndefinedProperties
} from '@rxap/utilities';
import { FormSystemMetadataKeys } from '@rxap/form-system';
import { RXAP_FORM_WINDOW_CONTEXT } from './tokens';

export interface FormWindowOptions<FormData, D = any, T = any> extends WindowConfig<D, T> {
  initial?: FormData;
@@ -121,7 +121,7 @@ export class FormWindowService {
      }
      if (options.context) {
        providers.push({
          provide:  RXAP_FORM_WINDOW_CONTEXT,
          provide:  RXAP_FORM_CONTEXT,
          useValue: options.context
        });
      }
+0 −3
Original line number Diff line number Diff line
import { InjectionToken } from '@angular/core';

export const RXAP_FORM_WINDOW_CONTEXT = new InjectionToken('@rxap/form-window-system/context');
+4 −4
Original line number Diff line number Diff line
@@ -92,11 +92,11 @@ export abstract class FormHandleMethodElement implements ParsedElement<Rule>, Ha
        {
          provide:    this.type,
          useFactory: this.adapter.name,
          deps:       [ this.method.toValue({ sourceFile, project, options }), '[new Optional(), RXAP_FORM_INITIAL_STATE]', 'INJECTOR' ]
          deps: [ this.method.toValue({ sourceFile, project, options }), '[new Optional(), RXAP_FORM_CONTEXT]', 'INJECTOR' ]
        },
        [
          {
            namedImports:    [ this.type, 'RXAP_FORM_INITIAL_STATE' ],
            namedImports:    [ this.type, 'RXAP_FORM_CONTEXT' ],
            moduleSpecifier: '@rxap/forms'
          },
          {
@@ -133,11 +133,11 @@ export abstract class FormHandleMethodElement implements ParsedElement<Rule>, Ha
        {
          provide:    this.type,
          useFactory: this.adapter.name,
          deps:       [ this.method.toValue({ sourceFile, project, options }), '[new Optional(), RXAP_FORM_INITIAL_STATE]', 'INJECTOR' ]
          deps: [ this.method.toValue({ sourceFile, project, options }), '[new Optional(), RXAP_FORM_CONTEXT]', 'INJECTOR' ]
        },
        [
          {
            namedImports:    [ this.type, 'RXAP_FORM_INITIAL_STATE' ],
            namedImports:    [ this.type, 'RXAP_FORM_CONTEXT' ],
            moduleSpecifier: '@rxap/forms'
          },
          {
+1 −0
Original line number Diff line number Diff line
import { InjectionToken } from '@angular/core';

export const RXAP_FORM_INITIAL_STATE = new InjectionToken('rxap/forms/initial-state');
export const RXAP_FORM_CONTEXT       = new InjectionToken('rxap/forms/context');