functional-models
    Preparing search index...

    Function DenormalizedProperty

    • A property for Denormalizing. This represents a complex value that has been simplified for ease of use. One common use is for creating "Display Values" in a GUI. This process can be extremely expensive, such as having to get selected values 2 or 3 Foreign Keys deep.

      This property allows passing in a calculate function that will only be executed once, and only if there is no value, and then only when asked.

      To recalculate the value, you need to run the calculate function on the property itself, passing in new model data.

      Type Parameters

      • TValue extends DataValue
      • T extends Readonly<{ [s: string]: any }>

      Parameters

      Returns Readonly<
          {
              createGetter: (
                  value: TValue,
                  modelData: Readonly,
                  modelInstance: ModelInstance<
                      Readonly<{ [s: string]: any }>,
                      object,
                      object,
                  >,
              ) => ValueGetter<TValue, Readonly<{ [s: string]: any }>, object, object>;
              getChoices: () => readonly ChoiceTypes[];
              getConfig: () => object;
              getConstantValue: () => undefined | TValue;
              getDefaultValue: () => undefined | TValue;
              getPropertyType: () => string;
              getValidator: (
                  valueGetter: ValueGetter<
                      TValue,
                      Readonly<{ [s: string]: any }>,
                      object,
                      object,
                  >,
              ) => PropertyValidator<Readonly<{ [s: string]: any }>>;
          },
      > & { calculate: CalculateDenormalization<TValue, T> }