Form / foldkit-mixins-form

FormViewInputs

interface · packages/mixins-form/src/index.ts:87

interface FormViewInputs<
  Key extends string = string,
  ControlKey extends string = never,
  PickerKey extends string = Key,
> {
  readonly options?:
    | {
        readonly [K in Key]?: ReadonlyArray<Option>
      }
    | undefined
  readonly more?:
    | ([PickerKey] extends [never]
        ? never
        : {
            readonly [K in PickerKey]?: boolean
          })
    | undefined
  readonly nestedOptions?:
    Readonly<Record<string, ReadonlyArray<Option>>> | undefined
  readonly controls?: Readonly<Record<string, unknown>> | undefined
  readonly words?: FormViewWords | undefined
  readonly submits?: boolean | undefined
  readonly locked?: ReadonlyArray<Key | ControlKey> | undefined
  readonly submitting?: boolean | undefined
  readonly failure?: SubmitFailure | undefined
  readonly saved?: boolean | undefined
}

What the view needs that the form does not own: the choices of each relation picker (a query the application makes), and the submit button's words.

Members

FormViewInputs.options

property · packages/mixins-form/src/index.ts:92

readonly options?:
  | {
      readonly [K in Key]?: ReadonlyArray<Option>
    }
  | undefined

FormViewInputs.more

property · packages/mixins-form/src/index.ts:99

readonly more?:
  | ([PickerKey] extends [never]
      ? never
      : {
          readonly [K in PickerKey]?: boolean
        })
  | undefined

The pickers whose list has more rows than options holds (Crud.options' more): each draws a button that sends the form's AskedForMore, for the page that owns the list to answer. Relation pickers of the form itself only, so another key is a type error, and none while locked.

FormViewInputs.nestedOptions

property · packages/mixins-form/src/index.ts:106

readonly nestedOptions?:
  Readonly<Record<string, ReadonlyArray<Option>>> | undefined

The choices of a picker inside a nested key, by its path, the same for every row: 'author.country'.

FormViewInputs.controls

property · packages/mixins-form/src/index.ts:114

readonly controls?: Readonly<Record<string, unknown>> | undefined

What a control backed by a Bundle is drawn with, by key: its view's inputs, such as the page Builder's BuilderView.inputs({ data }). A key in a nested row is named by its path, as in nestedOptions. Keyed by text, as those paths are, and typed where each entry is made, since only the control's Bundle knows its view's inputs.

FormViewInputs.words

property · packages/mixins-form/src/index.ts:116

readonly words?: FormViewWords | undefined

The view's own words, for wording and for translation.

FormViewInputs.submits

property · packages/mixins-form/src/index.ts:122

readonly submits?: boolean | undefined

Whether the form is drawn with its submit button. Default: it is. false for someone who may not submit it, such as a writer where submitting publishes, so what would be refused is not offered.

FormViewInputs.locked

property · packages/mixins-form/src/index.ts:130

readonly locked?: ReadonlyArray<Key | ControlKey> | undefined

Keys shown but not editable, drawn disabled: one the person may not set, such as a member foldkit-guard's May.locks refuses. A hint, not a check: the server checks the write. A key edited by a Bundle with no renderer has its Bundle's view drawn in a disabled fieldset, which disables the buttons and inputs it draws; a key in a nested row is not locked by this.

FormViewInputs.submitting

property · packages/mixins-form/src/index.ts:137

readonly submitting?: boolean | undefined

Whether the write a submit started is in flight: the form hands its value over and cannot see what follows. Crud.editor gives it, read from Remote's ledger by the write's request id; a form placed with an onOut of its own passes Data.mutation(model, requestId)._tag === 'Pending'.

FormViewInputs.failure

property · packages/mixins-form/src/index.ts:145

readonly failure?: SubmitFailure | undefined

Why the write the last submit started did not land, as the page reads it where the write runs: a refusal naming none of the form's keys, or a failure. Drawn as the form's alert (the failure Slot). retry says a submit sends that same write again (a failure; a refusal would only be refused again), and the button then reads words.resubmit.

FormViewInputs.saved

property · packages/mixins-form/src/index.ts:153

readonly saved?: boolean | undefined

Whether the write the last submit started landed, and the form is not edited since.

@deprecated

No effect: the submit button is aria-disabled, never disabled, so it keeps the focus whatever this says. Removed next release.