@wix/bex-core 2.350.0 → 2.352.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/cjs/index.js.map +1 -1
  2. package/dist/cjs/state/CustomFieldCollectionOptionsState.js +66 -0
  3. package/dist/cjs/state/CustomFieldCollectionOptionsState.js.map +1 -0
  4. package/dist/cjs/state/CustomFieldModalState.js +108 -13
  5. package/dist/cjs/state/CustomFieldModalState.js.map +1 -1
  6. package/dist/cjs/testkit/createInMemorySchemaSource.js +5 -1
  7. package/dist/cjs/testkit/createInMemorySchemaSource.js.map +1 -1
  8. package/dist/cjs/types/FieldTypeDefinition.js +3 -2
  9. package/dist/cjs/types/FieldTypeDefinition.js.map +1 -1
  10. package/dist/cjs/types/FieldsSource.js.map +1 -1
  11. package/dist/cjs/types/SchemaSource.js +6 -1
  12. package/dist/cjs/types/SchemaSource.js.map +1 -1
  13. package/dist/cjs/util/index.js +6 -0
  14. package/dist/cjs/util/index.js.map +1 -1
  15. package/dist/cjs/util/isReferenceField.js +9 -0
  16. package/dist/cjs/util/isReferenceField.js.map +1 -0
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/esm/state/CustomFieldCollectionOptionsState.js +60 -0
  19. package/dist/esm/state/CustomFieldCollectionOptionsState.js.map +1 -0
  20. package/dist/esm/state/CustomFieldModalState.js +107 -3
  21. package/dist/esm/state/CustomFieldModalState.js.map +1 -1
  22. package/dist/esm/testkit/createInMemorySchemaSource.js +2 -1
  23. package/dist/esm/testkit/createInMemorySchemaSource.js.map +1 -1
  24. package/dist/esm/types/FieldTypeDefinition.js.map +1 -1
  25. package/dist/esm/types/SchemaSource.js +7 -2
  26. package/dist/esm/types/SchemaSource.js.map +1 -1
  27. package/dist/esm/util/index.js +1 -0
  28. package/dist/esm/util/index.js.map +1 -1
  29. package/dist/esm/util/isReferenceField.js +3 -0
  30. package/dist/esm/util/isReferenceField.js.map +1 -0
  31. package/dist/types/index.d.ts +1 -1
  32. package/dist/types/index.d.ts.map +1 -1
  33. package/dist/types/state/CustomFieldCollectionOptionsState.d.ts +12 -0
  34. package/dist/types/state/CustomFieldCollectionOptionsState.d.ts.map +1 -0
  35. package/dist/types/state/CustomFieldModalBiReporter.d.ts +1 -10
  36. package/dist/types/state/CustomFieldModalBiReporter.d.ts.map +1 -1
  37. package/dist/types/state/CustomFieldModalState.d.ts +28 -12
  38. package/dist/types/state/CustomFieldModalState.d.ts.map +1 -1
  39. package/dist/types/testkit/createInMemorySchemaSource.d.ts +1 -0
  40. package/dist/types/testkit/createInMemorySchemaSource.d.ts.map +1 -1
  41. package/dist/types/types/FieldTypeDefinition.d.ts +10 -3
  42. package/dist/types/types/FieldTypeDefinition.d.ts.map +1 -1
  43. package/dist/types/types/FieldsSource.d.ts +25 -0
  44. package/dist/types/types/FieldsSource.d.ts.map +1 -1
  45. package/dist/types/types/SchemaSource.d.ts +11 -1
  46. package/dist/types/types/SchemaSource.d.ts.map +1 -1
  47. package/dist/types/util/index.d.ts +1 -0
  48. package/dist/types/util/index.d.ts.map +1 -1
  49. package/dist/types/util/isReferenceField.d.ts +7 -0
  50. package/dist/types/util/isReferenceField.d.ts.map +1 -0
  51. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"names":["isFilterTypeConfig","filter","defineFieldType","definition","resolveFieldTypeDefinition","source","field","_source$fieldTypes","type","customType","undefined","fieldTypes","find","def"],"sources":["../../../src/types/FieldTypeDefinition.ts"],"sourcesContent":["import type {\n ComponentType,\n MutableRefObject,\n ReactElement,\n ReactNode,\n} from 'react';\nimport type { Field } from './Field';\nimport type { Filter } from '../model/filter';\nimport type {\n FieldPiiWarning,\n FieldSettingsSection,\n FieldsSource,\n} from './FieldsSource';\n\nexport type ValidationRule =\n | { type: 'required'; message: string }\n | { type: 'min' | 'max'; value: number; message: string }\n | { type: 'minLength' | 'maxLength'; value: number; message: string }\n | { type: 'pattern'; value: RegExp; message: string }\n | { type: 'custom'; validate: (value: unknown) => boolean; message: string }\n | {\n type: 'specificValues';\n values: { id: string; value: string }[];\n message: string;\n };\n\nexport interface Focusable {\n focus: () => void;\n}\n\nexport type EditTrigger =\n | { kind: 'type'; key: string }\n | 'enter'\n | 'click'\n | 'doubleClick';\n\nexport interface CellViewProps<V> {\n value: V;\n typeConfig?: unknown;\n validation?: ValidationRule[];\n /** Stable id of the column. Cell components can use it to derive unique DOM ids. */\n columnId: string;\n /** Stable key of the row. Cell components can use it to derive unique DOM ids. */\n rowKey: string;\n}\n\nexport interface CellEditProps<V> {\n value: V;\n // Method syntax keeps CellEditProps covariant in V (see FieldTypeDefinition).\n onChange(value: V): void;\n onCommit: () => void;\n onCancel: () => void;\n /**\n * Signals that the cell is starting an editing operation that will move focus\n * outside the table (e.g., opening a media manager or a modal). Calling this\n * sets isEditing=true so the table does not clear cell focus while the\n * external UI is open. Pair with onCommit (after the operation succeeds)\n * or onCancel (if the user dismisses without a value change).\n */\n onStartEdit?: () => void;\n /** Ref to the focusable input element. Used for type-to-edit (focusing the input when user starts typing on a focused cell). */\n inputRef?: MutableRefObject<Focusable | undefined | null>;\n typeConfig?: unknown;\n /** How edit mode was triggered. Edit components can use this to customize behavior (e.g., date picker auto-opens on 'type'). */\n editTrigger?: EditTrigger | null;\n /** Column-level validation rules. Edit components can derive UI behavior (e.g., maxLength blocking/tooltip) from these. */\n validation?: ValidationRule[];\n /** Stable id of the column. Cell components can use it to derive unique DOM ids. */\n columnId: string;\n /** Stable key of the row. Cell components can use it to derive unique DOM ids. */\n rowKey: string;\n}\n\n/**\n * Props passed to a cell type's optional `EditWrapper`. The table mounts the\n * wrapper around the cell content and keeps it mounted across the edit↔view\n * transition, so the wrapper can own behavior that must outlive the inline\n * editor (e.g. a reference cell navigating to an overlay and refreshing on\n * return). The wrapper hands anything the editor needs down via its own context.\n */\nexport interface CellEditWrapperProps {\n /** The column's typeConfig (same value handed to the cell's Edit/View). */\n typeConfig?: unknown;\n /** Stable id of the column. */\n columnId: string;\n /** Stable key of the row. */\n rowKey: string;\n /** The cell content (the Edit or View component) to render inside the wrapper. */\n children: ReactNode;\n}\n\n/**\n * The editable-cell slot of a field type definition: how a cell of that type\n * renders, edits, and moves through the clipboard. The definition's key\n * identifies the type and the definition's `value` owns validation, so the\n * slot carries neither.\n *\n * Members that take `V` use method syntax so a definition typed with a\n * concrete value type stays assignable where a loosely typed definition is\n * expected (see `FieldTypeDefinition`).\n */\nexport interface EditableCellConfig<V> {\n /** Render cell in view mode (read-only display). */\n ViewComponent(props: CellViewProps<V>): ReactElement | null;\n /** Render cell in edit mode (inline editor). Optional — omit for view-only cells. */\n EditComponent?(props: CellEditProps<V>): ReactElement | null;\n /** Serialize value to clipboard string. */\n serialize?(value: V): string;\n /** Deserialize clipboard string to value. */\n deserialize?(raw: string): V;\n /** Can this cell type be edited? (default: true) */\n editable?: boolean;\n /** Can this cell type be cleared with Delete key? (default: true) */\n clearable?: boolean;\n /** Toggle value on single click (e.g., boolean checkbox). Skips focus→edit flow. */\n toggleValue?(value: V): V;\n /** Enter edit mode on single click (e.g., image cell with no value). */\n editOnClick?(value: V): boolean;\n /** Show the EditComponent when the cell is focused, without entering edit mode.\n * Keyboard navigation remains active. Similar to toggleValue but without toggling. */\n showEditWhenFocused?: boolean;\n /** Optional wrapper component the cell type defines to own behavior that must\n * outlive the inline editor. Mounted around the cell content and kept mounted\n * across the edit↔view transition. */\n EditWrapper?: ComponentType<CellEditWrapperProps>;\n /** Cell content can grow past row height when focused. Only applies to\n * showEditWhenFocused cells. */\n growable?: boolean;\n /** Called on type-to-edit. Return object with cleared value and/or prevent flag.\n * Return undefined to block the key. Return {} to enter edit mode without changing the value. */\n onTypeToEdit?(params: {\n key: string;\n validation?: ValidationRule[];\n }): { value?: V } | undefined;\n /** Optional hook to normalize the committed value (e.g. auto-prepend https://).\n * Called before the edit commits; the value is written back before committing. */\n normalizeOnCommit?(value: V): V;\n /** When true, type-to-edit flushes the edit-mode render synchronously and\n * focuses the input within the same keydown event, then lets the browser's\n * default action deliver the keystroke to the now-focused input naturally.\n * Use for cells that wrap a controlled input whose value can't be seeded via props. */\n nativeTypeToEdit?: boolean;\n}\n\n/** The props the filter builder passes to a definition's toolbar filter\n * component — the same contract the built-in filter elements receive. */\nexport interface FilterTypeComponentProps<V = any> {\n filter: Filter<V>;\n toolbarItemProps?: { label?: ReactNode };\n toolbarTagProps?: { label?: string };\n accordionItemProps?: { label?: string };\n}\n\n/** The filter slot of a field type definition: the filter state registered on\n * the collection query and the toolbar element that renders it. */\nexport interface FilterTypeConfig {\n createFilter: (field: Field) => Filter<any>;\n Component: ComponentType<FilterTypeComponentProps>;\n}\n\n/** Narrows a definition's filter slot to an active filter config. */\nexport function isFilterTypeConfig(\n filter: FieldTypeDefinition['filter'],\n): filter is FilterTypeConfig {\n return 'createFilter' in filter;\n}\n\n/**\n * The read-only table slot of a field type definition: how a cell of that\n * type renders in the table, and the column's layout. Independent of\n * `editableTable` — neither slot falls back to the other.\n */\nexport interface TableCellConfig<V> {\n /** Render the cell. Method syntax keeps the definition assignable to\n * `FieldTypeDefinition<unknown>` (see FieldTypeDefinition). */\n CellComponent(props: { value: V }): ReactElement | null;\n /** Column width. Required — custom types get no built-in layout default. */\n width: string;\n /** Default: 'start'. */\n align?: 'start' | 'center' | 'end';\n}\n\n/** An extra menu item a field type definition adds to a field's actions menu. */\nexport interface FieldTypeActionItem {\n key: string;\n label: string;\n icon?: ReactNode;\n skin?: 'destructive';\n onClick: (field: Field) => void;\n /** Default: visible. */\n visible?: (field: Field) => boolean;\n /** Returning a string disables the item and shows the tooltip. */\n disabledTooltip?: (field: Field) => string | undefined;\n}\n\n/** The actions slot of a field type definition: extra items for the field's \"more actions\" menu. */\nexport interface FieldActionsConfig {\n items?: FieldTypeActionItem[];\n}\n\n/** Display metadata for a field type: menu label and type icons. */\nexport interface FieldTypeDisplay {\n label: string;\n icons: {\n Small: ComponentType;\n Medium: ComponentType;\n };\n}\n\n/** Value semantics of a field type, independent of any rendering surface.\n * Members use method syntax so a definition typed with a concrete value type\n * stays assignable where a loosely typed definition is expected. */\nexport interface FieldValueBehavior<V> {\n defaultValue?: V;\n isEmpty?(value: V): boolean;\n /** Returns an error message, or null when the value is valid. Every surface\n * that validates a field of this type runs this. */\n validate?(value: V, rules?: ValidationRule[]): string | null;\n}\n\nexport interface FieldCapabilities {\n sortable: boolean;\n}\n\n/** The field-modal slot of a field type definition: opts the type into the\n * add/edit-field modal's type picker and describes its entry there. */\nexport interface FieldModalConfig {\n /** True ⇒ the add-field modal offers this type. */\n creatable: boolean;\n /** Placeholder for the name input. Absent ⇒ the modal's generic placeholder. */\n namePlaceholder?: string;\n /** One-line description under the type in the picker. */\n subtitle?: string;\n /** Group heading this type is listed under in the picker. */\n group?: string;\n /** Whether a field of this type can be marked PII. Absent ⇒ follows the\n * source-wide setting. */\n supportsPii?: boolean;\n /** Warning shown while the PII toggle is on. Read on every render, so it can\n * use data that only exists once the schema has loaded. Default: none. */\n piiWarning?: () => FieldPiiWarning | undefined;\n /** This type's collapsible settings section — the same contract a\n * source-declared type option carries (see `FieldSettingsSection`). */\n settingsSection?: FieldSettingsSection;\n}\n\n/**\n * Props the entity-page form dispatcher passes to a field type's form\n * component. The dispatcher owns the form wiring (registration, validation\n * from the definition's `value.validate`) and the field UI (label, required\n * marker, error message) — the component renders only the input: read\n * `value`, report edits through `onChange`.\n */\nexport interface FormFieldComponentProps<V> {\n field: Field;\n value: V;\n // Method syntax keeps FormFieldComponentProps covariant in V (see FieldTypeDefinition).\n onChange(value: V): void;\n /** Call when the input loses focus — marks the field touched, so error\n * timing matches the built-in renderers. */\n onBlur: () => void;\n dataHook?: string;\n}\n\n/** The entity-page form slot of a field type definition. */\nexport interface FormTypeConfig<V = unknown> {\n /** Renders the input. Method syntax keeps the definition assignable to\n * `FieldTypeDefinition<unknown>` (see FieldTypeDefinition). */\n Component(props: FormFieldComponentProps<V>): ReactElement | null;\n}\n\n/**\n * A consumer-defined field type. Defined once on the fields source; every\n * entry point that renders the field resolves its slot from here. `V` is the\n * field's value type — `defineFieldType` infers it, and it keeps all the\n * slots consistent with each other.\n *\n * Sources hold definitions of mixed value types in one\n * `FieldTypeDefinition[]` (= `FieldTypeDefinition<unknown>[]`) array. That\n * works because every member that takes `V` is declared with method syntax,\n * which TypeScript checks bivariantly — so `FieldTypeDefinition<number>` is\n * assignable to `FieldTypeDefinition<unknown>` without casts.\n */\nexport interface FieldTypeDefinition<V = unknown> {\n /** Unique key for the type. A built-in type uses its `PatternsFieldType`; a\n * consumer-defined type uses the string its fields reference via `customType`. */\n type: string;\n display: FieldTypeDisplay;\n /** Filter behavior, or an explicit opt-out — never silently absent. */\n filter: FilterTypeConfig | { filterable: false };\n value?: FieldValueBehavior<V>;\n capabilities?: FieldCapabilities;\n /** Absent ⇒ the field renders with the default cell in the read-only table. */\n table?: TableCellConfig<V>;\n /** Absent ⇒ the field renders as a read-only cell in editable surfaces. */\n editableTable?: EditableCellConfig<V>;\n /** Required once a field of this type renders on an entity page:\n * development throws without it; production skips the field. */\n form?: FormTypeConfig<V>;\n /** Extra items for the field's \"more actions\" menu. */\n actions?: FieldActionsConfig;\n /** Absent ⇒ the add/edit field modal never offers this type. Fields of the\n * type created elsewhere still open in the modal for name/PII edits. */\n fieldModal?: FieldModalConfig;\n}\n\n/** Identity factory: infers `V` and keeps the definition's slots type-checked. */\nexport function defineFieldType<V>(\n definition: FieldTypeDefinition<V>,\n): FieldTypeDefinition<V> {\n return definition;\n}\n\n/** Resolves the definition a CUSTOM field references on its source. */\nexport function resolveFieldTypeDefinition(\n source: Pick<FieldsSource, 'fieldTypes'>,\n field: Field,\n) {\n if (field.type !== 'CUSTOM' || !field.customType) {\n return undefined;\n }\n return source.fieldTypes?.find((def) => def.type === field.customType);\n}\n"],"mappings":";;;;;;AAyEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA4CA;AACA;;AAQA;AACA;;AAMA;AACO,SAASA,kBAAkBA,CAChCC,MAAqC,EACT;EAC5B,OAAO,cAAc,IAAIA,MAAM;AACjC;;AAEA;AACA;AACA;AACA;AACA;;AAWA;;AAaA;;AAKA;;AASA;AACA;AACA;;AAaA;AACA;;AAqBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwBA;AACO,SAASC,eAAeA,CAC7BC,UAAkC,EACV;EACxB,OAAOA,UAAU;AACnB;;AAEA;AACO,SAASC,0BAA0BA,CACxCC,MAAwC,EACxCC,KAAY,EACZ;EAAA,IAAAC,kBAAA;EACA,IAAID,KAAK,CAACE,IAAI,KAAK,QAAQ,IAAI,CAACF,KAAK,CAACG,UAAU,EAAE;IAChD,OAAOC,SAAS;EAClB;EACA,QAAAH,kBAAA,GAAOF,MAAM,CAACM,UAAU,qBAAjBJ,kBAAA,CAAmBK,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACL,IAAI,KAAKF,KAAK,CAACG,UAAU,CAAC;AACxE","ignoreList":[]}
1
+ {"version":3,"names":["isFilterTypeConfig","filter","defineFieldType","definition","resolveFieldTypeDefinition","source","field","_source$fieldTypes","type","customType","undefined","fieldTypes","find","def"],"sources":["../../../src/types/FieldTypeDefinition.ts"],"sourcesContent":["import type {\n ComponentType,\n MutableRefObject,\n ReactElement,\n ReactNode,\n} from 'react';\nimport type { Field } from './Field';\nimport type { Filter } from '../model/filter';\nimport type {\n FieldModalCollectionInput,\n FieldPiiWarning,\n FieldSettingsSection,\n FieldsSource,\n} from './FieldsSource';\n\nexport type ValidationRule =\n | { type: 'required'; message: string }\n | { type: 'min' | 'max'; value: number; message: string }\n | { type: 'minLength' | 'maxLength'; value: number; message: string }\n | { type: 'pattern'; value: RegExp; message: string }\n | { type: 'custom'; validate: (value: unknown) => boolean; message: string }\n | {\n type: 'specificValues';\n values: { id: string; value: string }[];\n message: string;\n };\n\nexport interface Focusable {\n focus: () => void;\n}\n\nexport type EditTrigger =\n | { kind: 'type'; key: string }\n | 'enter'\n | 'click'\n | 'doubleClick';\n\nexport interface CellViewProps<V> {\n value: V;\n typeConfig?: unknown;\n validation?: ValidationRule[];\n /** Stable id of the column. Cell components can use it to derive unique DOM ids. */\n columnId: string;\n /** Stable key of the row. Cell components can use it to derive unique DOM ids. */\n rowKey: string;\n}\n\nexport interface CellEditProps<V> {\n value: V;\n // Method syntax keeps CellEditProps covariant in V (see FieldTypeDefinition).\n onChange(value: V): void;\n onCommit: () => void;\n onCancel: () => void;\n /**\n * Signals that the cell is starting an editing operation that will move focus\n * outside the table (e.g., opening a media manager or a modal). Calling this\n * sets isEditing=true so the table does not clear cell focus while the\n * external UI is open. Pair with onCommit (after the operation succeeds)\n * or onCancel (if the user dismisses without a value change).\n */\n onStartEdit?: () => void;\n /** Ref to the focusable input element. Used for type-to-edit (focusing the input when user starts typing on a focused cell). */\n inputRef?: MutableRefObject<Focusable | undefined | null>;\n typeConfig?: unknown;\n /** How edit mode was triggered. Edit components can use this to customize behavior (e.g., date picker auto-opens on 'type'). */\n editTrigger?: EditTrigger | null;\n /** Column-level validation rules. Edit components can derive UI behavior (e.g., maxLength blocking/tooltip) from these. */\n validation?: ValidationRule[];\n /** Stable id of the column. Cell components can use it to derive unique DOM ids. */\n columnId: string;\n /** Stable key of the row. Cell components can use it to derive unique DOM ids. */\n rowKey: string;\n}\n\n/**\n * Props passed to a cell type's optional `EditWrapper`. The table mounts the\n * wrapper around the cell content and keeps it mounted across the edit↔view\n * transition, so the wrapper can own behavior that must outlive the inline\n * editor (e.g. a reference cell navigating to an overlay and refreshing on\n * return). The wrapper hands anything the editor needs down via its own context.\n */\nexport interface CellEditWrapperProps {\n /** The column's typeConfig (same value handed to the cell's Edit/View). */\n typeConfig?: unknown;\n /** Stable id of the column. */\n columnId: string;\n /** Stable key of the row. */\n rowKey: string;\n /** The cell content (the Edit or View component) to render inside the wrapper. */\n children: ReactNode;\n}\n\n/**\n * The editable-cell slot of a field type definition: how a cell of that type\n * renders, edits, and moves through the clipboard. The definition's key\n * identifies the type and the definition's `value` owns validation, so the\n * slot carries neither.\n *\n * Members that take `V` use method syntax so a definition typed with a\n * concrete value type stays assignable where a loosely typed definition is\n * expected (see `FieldTypeDefinition`).\n */\nexport interface EditableCellConfig<V> {\n /** Render cell in view mode (read-only display). */\n ViewComponent(props: CellViewProps<V>): ReactElement | null;\n /** Render cell in edit mode (inline editor). Optional — omit for view-only cells. */\n EditComponent?(props: CellEditProps<V>): ReactElement | null;\n /** Serialize value to clipboard string. */\n serialize?(value: V): string;\n /** Deserialize clipboard string to value. */\n deserialize?(raw: string): V;\n /** Can this cell type be edited? (default: true) */\n editable?: boolean;\n /** Can this cell type be cleared with Delete key? (default: true) */\n clearable?: boolean;\n /** Toggle value on single click (e.g., boolean checkbox). Skips focus→edit flow. */\n toggleValue?(value: V): V;\n /** Enter edit mode on single click (e.g., image cell with no value). */\n editOnClick?(value: V): boolean;\n /** Show the EditComponent when the cell is focused, without entering edit mode.\n * Keyboard navigation remains active. Similar to toggleValue but without toggling. */\n showEditWhenFocused?: boolean;\n /** Optional wrapper component the cell type defines to own behavior that must\n * outlive the inline editor. Mounted around the cell content and kept mounted\n * across the edit↔view transition. */\n EditWrapper?: ComponentType<CellEditWrapperProps>;\n /** Cell content can grow past row height when focused. Only applies to\n * showEditWhenFocused cells. */\n growable?: boolean;\n /** Called on type-to-edit. Return object with cleared value and/or prevent flag.\n * Return undefined to block the key. Return {} to enter edit mode without changing the value. */\n onTypeToEdit?(params: {\n key: string;\n validation?: ValidationRule[];\n }): { value?: V } | undefined;\n /** Optional hook to normalize the committed value (e.g. auto-prepend https://).\n * Called before the edit commits; the value is written back before committing. */\n normalizeOnCommit?(value: V): V;\n /** When true, type-to-edit flushes the edit-mode render synchronously and\n * focuses the input within the same keydown event, then lets the browser's\n * default action deliver the keystroke to the now-focused input naturally.\n * Use for cells that wrap a controlled input whose value can't be seeded via props. */\n nativeTypeToEdit?: boolean;\n}\n\n/** The props the filter builder passes to a definition's toolbar filter\n * component — the same contract the built-in filter elements receive. */\nexport interface FilterTypeComponentProps<V = any> {\n filter: Filter<V>;\n toolbarItemProps?: { label?: ReactNode };\n toolbarTagProps?: { label?: string };\n accordionItemProps?: { label?: string };\n}\n\n/** The filter slot of a field type definition: the filter state registered on\n * the collection query and the toolbar element that renders it. */\nexport interface FilterTypeConfig {\n createFilter: (field: Field) => Filter<any>;\n Component: ComponentType<FilterTypeComponentProps>;\n}\n\n/** Narrows a definition's filter slot to an active filter config. */\nexport function isFilterTypeConfig(\n filter: FieldTypeDefinition['filter'],\n): filter is FilterTypeConfig {\n return 'createFilter' in filter;\n}\n\n/**\n * The read-only table slot of a field type definition: how a cell of that\n * type renders in the table, and the column's layout. Independent of\n * `editableTable` — neither slot falls back to the other.\n */\nexport interface TableCellConfig<V> {\n /** Render the cell. Method syntax keeps the definition assignable to\n * `FieldTypeDefinition<unknown>` (see FieldTypeDefinition). */\n CellComponent(props: { value: V }): ReactElement | null;\n /** Column width. Required — custom types get no built-in layout default. */\n width: string;\n /** Default: 'start'. */\n align?: 'start' | 'center' | 'end';\n}\n\n/** An extra menu item a field type definition adds to a field's actions menu. */\nexport interface FieldTypeActionItem {\n key: string;\n label: string;\n icon?: ReactNode;\n skin?: 'destructive';\n onClick: (field: Field) => void;\n /** Default: visible. */\n visible?: (field: Field) => boolean;\n /** Returning a string disables the item and shows the tooltip. */\n disabledTooltip?: (field: Field) => string | undefined;\n}\n\n/** The actions slot of a field type definition: extra items for the field's \"more actions\" menu. */\nexport interface FieldActionsConfig {\n items?: FieldTypeActionItem[];\n}\n\n/** Display metadata for a field type: menu label and type icons. */\nexport interface FieldTypeDisplay {\n label: string;\n icons: {\n Small: ComponentType;\n Medium: ComponentType;\n };\n}\n\n/** Value semantics of a field type, independent of any rendering surface.\n * Members use method syntax so a definition typed with a concrete value type\n * stays assignable where a loosely typed definition is expected. */\nexport interface FieldValueBehavior<V> {\n defaultValue?: V;\n isEmpty?(value: V): boolean;\n /** Returns an error message, or null when the value is valid. Every surface\n * that validates a field of this type runs this. */\n validate?(value: V, rules?: ValidationRule[]): string | null;\n}\n\nexport interface FieldCapabilities {\n sortable: boolean;\n}\n\n/** The field-modal slot of a field type definition: opts the type into the\n * add/edit-field modal's type picker and describes its entry there. */\nexport interface FieldModalConfig {\n /** True ⇒ the add-field modal offers this type. */\n creatable: boolean;\n /** Placeholder for the name input. Absent ⇒ the modal's generic placeholder. */\n namePlaceholder?: string;\n /** One-line description under the type in the picker. */\n subtitle?: string;\n /** Group heading this type is listed under in the picker. */\n group?: string;\n /** Whether a field of this type can be marked PII. Absent ⇒ follows the\n * source-wide setting. */\n supportsPii?: boolean;\n /** Warning shown while the PII toggle is on. Read on every render, so it can\n * use data that only exists once the schema has loaded. Default: none. */\n piiWarning?: () => FieldPiiWarning | undefined;\n /** This type's collapsible settings section — the same contract a\n * source-declared type option carries (see `FieldSettingsSection`). */\n settingsSection?: FieldSettingsSection;\n /** Collection picker shown in the main add/edit field form. */\n collectionInput?: FieldModalCollectionInput;\n}\n\n/**\n * Props the entity-page form dispatcher passes to a field type's form\n * component. The dispatcher owns the form wiring (registration, validation\n * from the definition's `value.validate`) and the field UI (label, required\n * marker, error message); the component renders the input: read `value`,\n * report edits through `onChange`, and hand back the focusable control\n * through `inputRef` so a blocked save can reach it.\n */\nexport interface FormFieldComponentProps<V> {\n field: Field;\n value: V;\n // Method syntax keeps FormFieldComponentProps covariant in V (see FieldTypeDefinition).\n onChange(value: V): void;\n /** Call when the input loses focus — marks the field touched, so error\n * timing matches the built-in renderers. */\n onBlur: () => void;\n /** Ref to the focusable input element. Used to focus the field when a\n * blocked save reports an error on it. Absent ⇒ the entity page brings the\n * field into view and focuses the first control it finds inside. */\n inputRef?: MutableRefObject<Focusable | undefined | null>;\n dataHook?: string;\n}\n\n/** The entity-page form slot of a field type definition. */\nexport interface FormTypeConfig<V = unknown> {\n /** Renders the input. Method syntax keeps the definition assignable to\n * `FieldTypeDefinition<unknown>` (see FieldTypeDefinition). */\n Component(props: FormFieldComponentProps<V>): ReactElement | null;\n}\n\n/**\n * A consumer-defined field type. Defined once on the fields source; every\n * entry point that renders the field resolves its slot from here. `V` is the\n * field's value type — `defineFieldType` infers it, and it keeps all the\n * slots consistent with each other.\n *\n * Sources hold definitions of mixed value types in one\n * `FieldTypeDefinition[]` (= `FieldTypeDefinition<unknown>[]`) array. That\n * works because every member that takes `V` is declared with method syntax,\n * which TypeScript checks bivariantly — so `FieldTypeDefinition<number>` is\n * assignable to `FieldTypeDefinition<unknown>` without casts.\n */\nexport interface FieldTypeDefinition<V = unknown> {\n /** Unique key for the type. A built-in type uses its `PatternsFieldType`; a\n * consumer-defined type uses the string its fields reference via `customType`. */\n type: string;\n display: FieldTypeDisplay;\n /** Filter behavior, or an explicit opt-out — never silently absent. */\n filter: FilterTypeConfig | { filterable: false };\n value?: FieldValueBehavior<V>;\n capabilities?: FieldCapabilities;\n /** Absent ⇒ the field renders with the default cell in the read-only table. */\n table?: TableCellConfig<V>;\n /** Absent ⇒ the field renders as a read-only cell in editable surfaces. */\n editableTable?: EditableCellConfig<V>;\n /** Required once a field of this type renders on an entity page:\n * development throws without it; production skips the field. */\n form?: FormTypeConfig<V>;\n /** Extra items for the field's \"more actions\" menu. */\n actions?: FieldActionsConfig;\n /** Absent ⇒ the add/edit field modal never offers this type. Fields of the\n * type created elsewhere still open in the modal for name/PII edits. */\n fieldModal?: FieldModalConfig;\n}\n\n/** Identity factory: infers `V` and keeps the definition's slots type-checked. */\nexport function defineFieldType<V>(\n definition: FieldTypeDefinition<V>,\n): FieldTypeDefinition<V> {\n return definition;\n}\n\n/** Resolves the definition a CUSTOM field references on its source. */\nexport function resolveFieldTypeDefinition(\n source: Pick<FieldsSource, 'fieldTypes'>,\n field: Field,\n) {\n if (field.type !== 'CUSTOM' || !field.customType) {\n return undefined;\n }\n return source.fieldTypes?.find((def) => def.type === field.customType);\n}\n"],"mappings":";;;;;;AA0EA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA4CA;AACA;;AAQA;AACA;;AAMA;AACO,SAASA,kBAAkBA,CAChCC,MAAqC,EACT;EAC5B,OAAO,cAAc,IAAIA,MAAM;AACjC;;AAEA;AACA;AACA;AACA;AACA;;AAWA;;AAaA;;AAKA;;AASA;AACA;AACA;;AAaA;AACA;;AAuBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwBA;AACO,SAASC,eAAeA,CAC7BC,UAAkC,EACV;EACxB,OAAOA,UAAU;AACnB;;AAEA;AACO,SAASC,0BAA0BA,CACxCC,MAAwC,EACxCC,KAAY,EACZ;EAAA,IAAAC,kBAAA;EACA,IAAID,KAAK,CAACE,IAAI,KAAK,QAAQ,IAAI,CAACF,KAAK,CAACG,UAAU,EAAE;IAChD,OAAOC,SAAS;EAClB;EACA,QAAAH,kBAAA,GAAOF,MAAM,CAACM,UAAU,qBAAjBJ,kBAAA,CAAmBK,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACL,IAAI,KAAKF,KAAK,CAACG,UAAU,CAAC;AACxE","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/types/FieldsSource.ts"],"sourcesContent":["import type { ComponentType } from 'react';\nimport type { Field, PatternsFieldType } from './Field';\nimport type { FieldActions, FieldSettings, Schema } from './Schema';\nimport type { FieldTypeDefinition } from './FieldTypeDefinition';\n\n/** A field the source has archived. Sources without archiving omit `archive`. */\nexport interface ArchivedFieldItem {\n id: string;\n label: string;\n isPii?: boolean;\n}\n\n/** A `FieldTypeOption` the modal can render: the id and label a source left to\n * the defaults are filled in. */\nexport interface ResolvedFieldTypeOption {\n /** Stored on the draft; the source maps it back to its native type. */\n id: string;\n label: string;\n namePlaceholder?: string;\n subtitle?: string;\n /** Group heading in the type list; types sharing a heading form one group. */\n group?: string;\n /** Whether a field of this type can be marked PII. Absent ⇒ follows the\n * source-wide `supportsPii`. */\n supportsPii?: boolean;\n /** Warning to show while the PII toggle is on. Called on every render.\n * Absent ⇒ none. */\n piiWarning?: () => FieldPiiWarning | undefined;\n /** This type's own part of the collapsible section below the main fields.\n * Absent ⇒ the section holds only what the modal itself puts there. */\n settingsSection?: FieldSettingsSection;\n /** Drives the type icon in the modal. */\n patternsType: PatternsFieldType;\n /** Type icons for the picker. Absent ⇒ the icon derives from `patternsType`. */\n icons?: { Small: ComponentType; Medium: ComponentType };\n}\n\n/** Read/write permission defaults a source supports, per audience. */\nexport interface FieldPermissions {\n installedApps?: {\n hide?: boolean;\n defaultRead?: boolean;\n defaultWrite?: boolean;\n };\n siteVisitors?: {\n hide?: boolean;\n defaultRead?: boolean;\n defaultWrite?: boolean;\n };\n}\n\n/** The values the add/edit field modal collects, source-neutral. */\nexport interface FieldDraft {\n type?: string;\n key: string;\n name: string;\n readApps: boolean;\n readUsers: boolean;\n writeApps: boolean;\n writeUsers: boolean;\n containsPii: boolean;\n /** The field this draft was built from, for the source's settings section to\n * read its own values off. Absent for a new field. */\n field?: Field;\n /** What the source's settings section collected, on its way to that source's\n * `addField`/`editField`. */\n settings?: FieldSettings;\n}\n\n/** The add-modal subtitle: a line of text, an optional second note line, and an\n * optional \"learn more\" link. */\nexport interface FieldModalSubtitle {\n text: string;\n note?: string;\n learnMore?: { label: string; href: string };\n}\n\n/** The text a source supplies for the add/edit field modal. */\nexport interface FieldModalText {\n addTitle: string;\n editTitle: string;\n /** Subtitle for the add modal; omit for none. */\n addSubtitle?: FieldModalSubtitle;\n /** Label of the collapsible section below the main fields. */\n settingsLabel?: string;\n}\n\n/** A warning shown under the PII toggle, with an optional action button. */\nexport interface FieldPiiWarning {\n text: string;\n action?: { label: string; onClick: () => void };\n}\n\nexport interface FieldSettingsProps {\n /** The picked field type, or absent before one is picked. */\n fieldType?: string;\n}\n\n/**\n * The collapsible section below the main add/edit field inputs, supplied by the\n * source. The modal renders it, blocks confirm while it has an error, and hands\n * its values to the source's own `addField`/`editField` — it never looks inside.\n */\nexport interface FieldSettingsSection {\n Component: ComponentType<FieldSettingsProps>;\n /** True keeps the modal open on confirm. The section shows the error itself. */\n hasError(fieldType?: string): boolean;\n /** Passed to `FieldActions.addField`/`editField` as-is. */\n getValues(fieldType?: string): FieldSettings;\n /**\n * Fills the inputs when the modal opens: the field being edited, or nothing\n * for a new field. Pushed in rather than read from a prop, so the values are\n * there whether or not the section has been rendered yet.\n */\n setValues(field?: Field): void;\n}\n\n/** Add/edit/delete capability a source exposes. Present ⇒ field management UI shows. */\nexport interface FieldManagement {\n /** False ⇒ the add-field CTA is hidden entirely. */\n canAddFields: boolean;\n /** True ⇒ the add-field CTA renders but is disabled. */\n addFieldDisabled: boolean;\n /** Hint text shown beneath the add-field CTA while it is disabled. */\n addFieldDisabledHint?: string;\n canEditField(field: Field): boolean;\n /** `origin` is the UI surface the delete was triggered from; used for BI. */\n deleteField(fieldId: string, origin: string): Promise<void>;\n\n /** Everything the add/edit field modal shows: its titles, and the field types\n * it offers with what each one brings to it. */\n fieldModal: {\n text: FieldModalText;\n types: ResolvedFieldTypeOption[];\n /** Defaults for the read/write permissions per audience. Absent ⇒ the modal\n * shows no permissions section. */\n permissions?: FieldPermissions;\n /** Whether a field can be marked PII. A field type option overrides it with\n * its own `supportsPii`. */\n supportsPii?: boolean;\n };\n /** Existing field keys, used by the add modal to reject duplicates. */\n existingFieldKeys: string[];\n /** True when no more fields can be added because a limit is reached. */\n maxReached?: boolean;\n addField(draft: FieldDraft): Promise<void>;\n editField(fieldId: string, draft: FieldDraft): Promise<void>;\n /** Current values for an existing field, to prefill the edit modal. */\n getFieldDraft(fieldId: string): FieldDraft | undefined;\n}\n\n/** Archiving capability a source exposes. Present ⇒ archive/restore UI shows. */\nexport interface FieldArchive {\n items: ArchivedFieldItem[];\n shouldDisplay: boolean;\n /** Whether the archived-items panel is currently open. */\n isOpen: boolean;\n openPanel(): void;\n closePanel(): void;\n /** `origin` is the UI surface the action was triggered from; used for BI. */\n archiveField(fieldId: string, origin: string): Promise<void>;\n restoreField(fieldId: string, origin: string): Promise<void>;\n /** Display name for a field, for the confirm-dialog copy. */\n fieldName(fieldId: string): string;\n}\n\n/**\n * The source-neutral fields data a collection reads, implemented by each source\n * adapter. Rendering — field modals, filter elements — is not here; it lives in\n * the collection-page layer.\n */\nexport interface FieldsSource {\n /** Loads the fields (schema/data). The collection runs this once, tracks its\n * status, and shows a retry toast on failure. */\n load(): Promise<void>;\n\n fields: Field[];\n filterableFields: Field[];\n /** The fields the manage-fields panel lists — the source's editable fields. */\n manageableFields: Field[];\n /** Column id for a field. Sources that group fields prefix the group; flat sources use the field key. */\n columnIdForField(field: Field): string;\n /** WQL field path for a filter. Sources that group fields prefix the group; flat sources use the field key. */\n queryFieldId(field: Field): string;\n /** The value to display for a field on a row. */\n getCellValue(row: unknown, field: Field): unknown;\n /** Writes a new value for a field on a row, returning the updated row. Present when cells can be edited in place. */\n setCellValue?(row: unknown, field: Field, value: unknown): unknown;\n\n /** Replaces the source's fields with a freshly-returned map, updating the\n * columns with no refetch. Present when the source holds its fields in a\n * mergeable state (e.g. a loaded schema); used after an import creates fields. */\n mergeFields?(fields: Schema['fields']): void;\n\n /** Field-type definitions the source supports: how a field of that type\n * renders, filters and validates. Built-in types are keyed by their\n * `PatternsFieldType`; consumer-defined types are keyed by the string a field\n * references via `customType`. The add/edit field modal never reads this —\n * see `FieldManagement.fieldModal`. */\n fieldTypes?: FieldTypeDefinition[];\n\n /** Present when fields can be added/edited/deleted. */\n fieldManagement?: FieldManagement;\n\n /** The collection's field-mutation actions (delete/makePrimary/duplicate/…),\n * driving the shared FieldActions menu. Absent ⇒ no per-field action menu. */\n fieldActions?: FieldActions;\n\n /** Present when the source supports archiving fields. */\n archive?: FieldArchive;\n\n /** Present when fields are grouped. Absent ⇒ flat list. */\n groups?: {\n all: string[];\n fieldsForGroup(group: string): Field[];\n };\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["../../../src/types/FieldsSource.ts"],"sourcesContent":["import type { ComponentType } from 'react';\nimport type { Field, PatternsFieldType } from './Field';\nimport type { FieldActions, FieldSettings, Schema } from './Schema';\nimport type { FieldTypeDefinition } from './FieldTypeDefinition';\n\n/** A field the source has archived. Sources without archiving omit `archive`. */\nexport interface ArchivedFieldItem {\n id: string;\n label: string;\n isPii?: boolean;\n}\n\n/** A `FieldTypeOption` the modal can render: the id and label a source left to\n * the defaults are filled in. */\nexport interface ResolvedFieldTypeOption {\n /** Stored on the draft; the source maps it back to its native type. */\n id: string;\n label: string;\n namePlaceholder?: string;\n subtitle?: string;\n /** Group heading in the type list; types sharing a heading form one group. */\n group?: string;\n /** Whether a field of this type can be marked PII. Absent ⇒ follows the\n * source-wide `supportsPii`. */\n supportsPii?: boolean;\n /** Warning to show while the PII toggle is on. Called on every render.\n * Absent ⇒ none. */\n piiWarning?: () => FieldPiiWarning | undefined;\n /** This type's own part of the collapsible section below the main fields.\n * Absent ⇒ the section holds only what the modal itself puts there. */\n settingsSection?: FieldSettingsSection;\n /** Collection picker shown below the type picker. For built-in reference\n * types, absent copy can use the source's referenceable collection loader. */\n collectionInput?: FieldModalCollectionInput;\n /** Drives the type icon in the modal. */\n patternsType: PatternsFieldType;\n /** Type icons for the picker. Absent ⇒ the icon derives from `patternsType`. */\n icons?: { Small: ComponentType; Medium: ComponentType };\n}\n\n/** Read/write permission defaults a source supports, per audience. */\nexport interface FieldPermissions {\n installedApps?: {\n hide?: boolean;\n defaultRead?: boolean;\n defaultWrite?: boolean;\n };\n siteVisitors?: {\n hide?: boolean;\n defaultRead?: boolean;\n defaultWrite?: boolean;\n };\n}\n\n/** The values the add/edit field modal collects, source-neutral. */\nexport interface FieldDraft {\n type?: string;\n key: string;\n name: string;\n readApps: boolean;\n readUsers: boolean;\n writeApps: boolean;\n writeUsers: boolean;\n containsPii: boolean;\n /** Collection selected by the modal's collection picker, when a type has one. */\n referencedCollectionId?: string;\n /** The field this draft was built from, for the source's settings section to\n * read its own values off. Absent for a new field. */\n field?: Field;\n /** What the source's settings section collected, on its way to that source's\n * `addField`/`editField`. */\n settings?: FieldSettings;\n}\n\n/** The add-modal subtitle: a line of text, an optional second note line, and an\n * optional \"learn more\" link. */\nexport interface FieldModalSubtitle {\n text: string;\n note?: string;\n learnMore?: { label: string; href: string };\n}\n\n/** The text a source supplies for the add/edit field modal. */\nexport interface FieldModalText {\n addTitle: string;\n editTitle: string;\n /** Subtitle for the add modal; omit for none. */\n addSubtitle?: FieldModalSubtitle;\n /** Label of the collapsible section below the main fields. */\n settingsLabel?: string;\n}\n\n/** A warning shown under the PII toggle, with an optional action button. */\nexport interface FieldPiiWarning {\n text: string;\n action?: { label: string; onClick: () => void };\n}\n\nexport interface FieldModalCollectionOption {\n id: string;\n label: string;\n}\n\nexport type FieldModalCollectionOptionsLoader = () => Promise<\n FieldModalCollectionOption[]\n>;\n\n/** Extra collection picker a field type can add to the main modal body. */\nexport interface FieldModalCollectionInput {\n label?: string;\n placeholder?: string;\n emptyStateMessage?: string;\n errorMessage?: string;\n required?: boolean;\n loadOptions?: FieldModalCollectionOptionsLoader;\n /** Restores the picker value from an existing field. */\n getValue?: (field: Field) => string | undefined;\n /** Adds picker-derived values to the source-owned settings payload. */\n getSettings?: (collectionId: string) => FieldSettings;\n}\n\nexport interface FieldSettingsProps {\n /** The picked field type, or absent before one is picked. */\n fieldType?: string;\n}\n\n/**\n * The collapsible section below the main add/edit field inputs, supplied by the\n * source. The modal renders it, blocks confirm while it has an error, and hands\n * its values to the source's own `addField`/`editField` — it never looks inside.\n */\nexport interface FieldSettingsSection {\n Component: ComponentType<FieldSettingsProps>;\n /** True keeps the modal open on confirm. The section shows the error itself. */\n hasError(fieldType?: string): boolean;\n /** Passed to `FieldActions.addField`/`editField` as-is. */\n getValues(fieldType?: string): FieldSettings;\n /**\n * Fills the inputs when the modal opens: the field being edited, or nothing\n * for a new field. Pushed in rather than read from a prop, so the values are\n * there whether or not the section has been rendered yet.\n */\n setValues(field?: Field): void;\n}\n\n/** Add/edit/delete capability a source exposes. Present ⇒ field management UI shows. */\nexport interface FieldManagement {\n /** False ⇒ the add-field CTA is hidden entirely. */\n canAddFields: boolean;\n /** True ⇒ the add-field CTA renders but is disabled. */\n addFieldDisabled: boolean;\n /** Hint text shown beneath the add-field CTA while it is disabled. */\n addFieldDisabledHint?: string;\n canEditField(field: Field): boolean;\n /** `origin` is the UI surface the delete was triggered from; used for BI. */\n deleteField(fieldId: string, origin: string): Promise<void>;\n\n /** Everything the add/edit field modal shows: its titles, and the field types\n * it offers with what each one brings to it. */\n fieldModal: {\n text: FieldModalText;\n /** Default option loader for built-in reference and multi-reference types. */\n loadReferenceableCollectionOptions?: FieldModalCollectionOptionsLoader;\n types: ResolvedFieldTypeOption[];\n /** Defaults for the read/write permissions per audience. Absent ⇒ the modal\n * shows no permissions section. */\n permissions?: FieldPermissions;\n /** Whether a field can be marked PII. A field type option overrides it with\n * its own `supportsPii`. */\n supportsPii?: boolean;\n };\n /** Existing field keys, used by the add modal to reject duplicates. */\n existingFieldKeys: string[];\n /** True when no more fields can be added because a limit is reached. */\n maxReached?: boolean;\n addField(draft: FieldDraft): Promise<void>;\n editField(fieldId: string, draft: FieldDraft): Promise<void>;\n /** Current values for an existing field, to prefill the edit modal. */\n getFieldDraft(fieldId: string): FieldDraft | undefined;\n}\n\n/** Archiving capability a source exposes. Present ⇒ archive/restore UI shows. */\nexport interface FieldArchive {\n items: ArchivedFieldItem[];\n shouldDisplay: boolean;\n /** Whether the archived-items panel is currently open. */\n isOpen: boolean;\n openPanel(): void;\n closePanel(): void;\n /** `origin` is the UI surface the action was triggered from; used for BI. */\n archiveField(fieldId: string, origin: string): Promise<void>;\n restoreField(fieldId: string, origin: string): Promise<void>;\n /** Display name for a field, for the confirm-dialog copy. */\n fieldName(fieldId: string): string;\n}\n\n/**\n * The source-neutral fields data a collection reads, implemented by each source\n * adapter. Rendering — field modals, filter elements — is not here; it lives in\n * the collection-page layer.\n */\nexport interface FieldsSource {\n /** Loads the fields (schema/data). The collection runs this once, tracks its\n * status, and shows a retry toast on failure. */\n load(): Promise<void>;\n\n fields: Field[];\n filterableFields: Field[];\n /** The fields the manage-fields panel lists — the source's editable fields. */\n manageableFields: Field[];\n /** Column id for a field. Sources that group fields prefix the group; flat sources use the field key. */\n columnIdForField(field: Field): string;\n /** WQL field path for a filter. Sources that group fields prefix the group; flat sources use the field key. */\n queryFieldId(field: Field): string;\n /** The value to display for a field on a row. */\n getCellValue(row: unknown, field: Field): unknown;\n /** Writes a new value for a field on a row, returning the updated row. Present when cells can be edited in place. */\n setCellValue?(row: unknown, field: Field, value: unknown): unknown;\n\n /** Replaces the source's fields with a freshly-returned map, updating the\n * columns with no refetch. Present when the source holds its fields in a\n * mergeable state (e.g. a loaded schema); used after an import creates fields. */\n mergeFields?(fields: Schema['fields']): void;\n\n /** Field-type definitions the source supports: how a field of that type\n * renders, filters and validates. Built-in types are keyed by their\n * `PatternsFieldType`; consumer-defined types are keyed by the string a field\n * references via `customType`. The add/edit field modal never reads this —\n * see `FieldManagement.fieldModal`. */\n fieldTypes?: FieldTypeDefinition[];\n\n /** Present when fields can be added/edited/deleted. */\n fieldManagement?: FieldManagement;\n\n /** The collection's field-mutation actions (delete/makePrimary/duplicate/…),\n * driving the shared FieldActions menu. Absent ⇒ no per-field action menu. */\n fieldActions?: FieldActions;\n\n /** Present when the source supports archiving fields. */\n archive?: FieldArchive;\n\n /** Present when fields are grouped. Absent ⇒ flat list. */\n groups?: {\n all: string[];\n fieldsForGroup(group: string): Field[];\n };\n}\n"],"mappings":"","ignoreList":[]}
@@ -46,7 +46,8 @@ function defineSchemaSource(input) {
46
46
  fieldTypes = [],
47
47
  fieldPermissions,
48
48
  supportsPii = false,
49
- references = {}
49
+ references = {},
50
+ getReferencedCollectionSource
50
51
  } = input;
51
52
  let loaded;
52
53
  let schema;
@@ -90,8 +91,12 @@ function defineSchemaSource(input) {
90
91
  itemKey,
91
92
  itemName,
92
93
  references,
94
+ ...(getReferencedCollectionSource && {
95
+ getReferencedCollectionSource
96
+ }),
93
97
  fieldModal: {
94
98
  text: fieldModal.text,
99
+ loadReferenceableCollectionOptions: fieldModal.loadReferenceableCollectionOptions,
95
100
  types: fieldModal.types ?? []
96
101
  },
97
102
  fieldTypes,
@@ -1 +1 @@
1
- {"version":3,"names":["sourceFetchData","source","query","backend","schema","loadSchema","visibleColumns","columns","find","searchableFieldIds","length","defineSchemaSource","input","collectionId","paginationMode","fieldModal","fieldTypes","fieldPermissions","supportsPii","references","loaded","then","result","catch","error","undefined","s","displayField","itemKey","item","_schema","String","idField","itemName","_schema2","canAddFields","_s$schemaPermissions","schemaPermissions","createField","canEditField","field","_s$schemaPermissions2","updateField","isSystem","canDeleteField","_s$schemaPermissions3","deleteField","getFieldValue","id","setFieldValue","value","text","types"],"sources":["../../../src/types/SchemaSource.ts"],"sourcesContent":["import type { Field, PatternsFieldType } from './Field';\nimport type { FieldTypeDefinition } from './FieldTypeDefinition';\nimport type { Schema, LoadedSchema, FindOptions } from './Schema';\nimport type {\n FieldModalText,\n FieldPermissions,\n FieldPiiWarning,\n FieldSettingsSection,\n} from './FieldsSource';\nimport type {\n OffsetQuery,\n OffsetQueryResult,\n} from '../hooks/paginationModeConfig';\n\n/** A field type the add/edit field modal offers, with everything that type\n * brings to it. Declare one entry per `patternsType` — the type is the entry's\n * identity. Nothing here reaches the table or the filters; that is `fieldTypes`\n * (`FieldTypeDefinition[]`). */\nexport interface FieldTypeOption {\n patternsType: PatternsFieldType;\n /** Custom display name. Absent ⇒ the UI's standard name for this type. */\n label?: string;\n /** Custom name-input placeholder. Absent ⇒ the UI's standard placeholder. */\n namePlaceholder?: string;\n /** A one-line description shown under the type in the add-field menu. */\n subtitle?: string;\n /** The group heading this type is listed under in the add-field menu, in\n * first-seen order. Types sharing a heading form one group. Absent ⇒\n * ungrouped. */\n group?: string;\n /** Whether a field of this type can be marked PII. Absent ⇒ follows the\n * source's `supportsPii`. */\n supportsPii?: boolean;\n /** Warning shown while the PII toggle is on. Read on every render, so it can\n * use data that only exists once the schema has loaded. Default: none. */\n piiWarning?: () => FieldPiiWarning | undefined;\n /** This type's own part of the collapsible section in the add/edit field\n * modal. Default: none. */\n settingsSection?: FieldSettingsSection;\n}\n\n/** Everything the add/edit field modal shows for this source. */\nexport interface FieldModalInput {\n /** Title and subtitle. Default: generic titles. */\n text?: FieldModalText;\n /** The types the modal offers, in display order. Default: none. */\n types?: FieldTypeOption[];\n}\n\n/** What a caller passes. Only `collectionId` and `loadSchema` are required. */\nexport interface SchemaSourceInput<T> {\n collectionId: string;\n loadSchema: () => Promise<LoadedSchema<T>>;\n /** Sources for collections this one references, keyed by the referenced\n * collection id. A renderer resolves a reference field through the matching\n * entry — its `loadSchema` gives the referenced schema and `sourceFetchData`\n * queries the referenced items. Default: none. */\n references?: Record<string, SchemaSource<any>>;\n paginationMode?: 'offset';\n /** Stable row identity. Default: `row[idField]`. */\n itemKey?: (item: T) => string;\n /** Row display label. Default: `row[displayField]`. */\n itemName?: (item: T) => string;\n /** Fields free-text search runs against. Default: `[displayField]`. */\n searchableFieldIds?: (schema: Schema) => string[];\n /** What the add/edit field modal shows. Default: no types, generic titles. */\n fieldModal?: FieldModalInput;\n /** Consumer-defined field types: how a field of that type renders, filters and\n * validates wherever it appears. A field with `type: 'CUSTOM'` resolves its\n * definition here by `customType`. The add/edit field modal never reads this\n * — see `fieldModal`. Default: none. */\n fieldTypes?: FieldTypeDefinition[];\n /** Default: `schemaPermissions.createField`. */\n canAddFields?: (schema: Schema) => boolean;\n /** Default: `schemaPermissions.updateField && !field.isSystem`. */\n canEditField?: (field: Field, schema: Schema) => boolean;\n /** Default: `schemaPermissions.deleteField && !field.isSystem`. */\n canDeleteField?: (field: Field, schema: Schema) => boolean;\n /** Permission defaults shown in the modal. Absent ⇒ no permissions section. */\n fieldPermissions?: FieldPermissions;\n /** Default: `false`. */\n supportsPii?: boolean;\n /** The value of a field on an item. Default: `item[field.id]`. */\n getFieldValue?: (item: T, field: Field) => unknown;\n /** Writes a field's value on an item, returning the updated item.\n * Default: `{ ...item, [field.id]: value }`. */\n setFieldValue?: (item: T, field: Field, value: unknown) => T;\n}\n\n/** The resolved source: defaults filled, `loadSchema` memoized. */\nexport interface SchemaSource<T> {\n readonly collectionId: string;\n loadSchema: () => Promise<LoadedSchema<T>>;\n readonly paginationMode: 'offset';\n /** Stable row identity. */\n itemKey: (item: T) => string;\n /** Row display label. */\n itemName: (item: T) => string;\n /** Sources for referenced collections, keyed by referenced collection id. */\n readonly references: Record<string, SchemaSource<any>>;\n readonly fieldModal: { text?: FieldModalText; types: FieldTypeOption[] };\n readonly fieldTypes: FieldTypeDefinition[];\n searchableFieldIds: (schema: Schema) => string[];\n canAddFields: (schema: Schema) => boolean;\n canEditField: (field: Field, schema: Schema) => boolean;\n canDeleteField: (field: Field, schema: Schema) => boolean;\n readonly fieldPermissions?: FieldPermissions;\n readonly supportsPii: boolean;\n /** The value of a field on an item. */\n getFieldValue: (item: T, field: Field) => unknown;\n /** Writes a field's value on an item, returning the updated item. */\n setFieldValue: (item: T, field: Field, value: unknown) => T;\n}\n\ntype OffsetFind<T> = (\n query: OffsetQuery,\n options?: FindOptions,\n) => Promise<OffsetQueryResult<T>>;\n\n/** The collection fetch derived from a source: loads once, then queries the\n * backend's `find`.\n *\n * Free-text search covers the columns the page is showing: the table keeps\n * `query.columns` in sync with them, so the scope comes off the query rather\n * than being threaded in. Falls back to the source's own `searchableFieldIds`\n * before any columns are known (or with no table attached). */\nexport function sourceFetchData<T>(\n source: SchemaSource<T>,\n): (query: OffsetQuery) => Promise<OffsetQueryResult<T>> {\n return async (query) => {\n const { backend, schema } = await source.loadSchema();\n // `columns` is the visible-column list; `fields` is the projection, which a\n // source-driven table doesn't set.\n const visibleColumns = query.columns;\n return (backend.find as OffsetFind<T>)(query, {\n searchableFieldIds: visibleColumns?.length\n ? visibleColumns\n : source.searchableFieldIds(schema),\n });\n };\n}\n\n/** Fills source-neutral defaults over `input` and memoizes the load so the collection\n * query and the table columns share a single fetch. */\nexport function defineSchemaSource<T>(\n input: SchemaSourceInput<T>,\n): SchemaSource<T> {\n const {\n collectionId,\n paginationMode = 'offset',\n fieldModal = {},\n fieldTypes = [],\n fieldPermissions,\n supportsPii = false,\n references = {},\n } = input;\n\n let loaded: Promise<LoadedSchema<T>> | undefined;\n let schema: Schema | undefined;\n\n const loadSchema = () =>\n (loaded ??= input\n .loadSchema()\n .then((result) => {\n schema = result.schema;\n return result;\n })\n .catch((error) => {\n loaded = undefined;\n throw error;\n }));\n\n const searchableFieldIds =\n input.searchableFieldIds ?? ((s) => [s.displayField]);\n\n const itemKey =\n input.itemKey ??\n ((item) =>\n String(\n (item as Record<string, unknown>)[schema?.idField ?? '_id'] ?? '',\n ));\n const itemName =\n input.itemName ??\n ((item) =>\n String(\n (item as Record<string, unknown>)[schema?.displayField ?? '_id'] ?? '',\n ));\n const canAddFields =\n input.canAddFields ?? ((s) => s.schemaPermissions?.createField ?? false);\n const canEditField =\n input.canEditField ??\n ((field, s) =>\n (s.schemaPermissions?.updateField ?? false) && !field.isSystem);\n const canDeleteField =\n input.canDeleteField ??\n ((field, s) =>\n (s.schemaPermissions?.deleteField ?? false) && !field.isSystem);\n const getFieldValue =\n input.getFieldValue ??\n ((item, field) => (item as Record<string, unknown>)[field.id]);\n const setFieldValue =\n input.setFieldValue ??\n ((item, field, value) => ({ ...item, [field.id]: value } as T));\n\n return {\n collectionId,\n loadSchema,\n paginationMode,\n itemKey,\n itemName,\n references,\n fieldModal: { text: fieldModal.text, types: fieldModal.types ?? [] },\n fieldTypes,\n searchableFieldIds,\n canAddFields,\n canEditField,\n canDeleteField,\n fieldPermissions,\n supportsPii,\n getFieldValue,\n setFieldValue,\n };\n}\n"],"mappings":";;;;;AAcA;AACA;AACA;AACA;;AAwBA;;AAQA;;AAwCA;;AA8BA;AACA;AACA;AACA;AACA;AACA;AACA;A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AK,MAAM;IAAE,GAAGrB,IAAI;IAAE,CAACW,KAAK,CAACQ,EAAE,GAAGE;EAAM,CAAC,CAAM,CAAC;EAEjE,OAAO;IACLrC,YAAY;IACZR,UAAU;IACVS,cAAc;IACdc,OAAO;IACPK,QAAQ;IACRd,UAAU;IACVJ,UAAU,EAAE;MAAEoC,IAAI,EAAEpC,UAAU,CAACoC,IAAI;MAAEC,KAAK,EAAErC,UAAU,CAACqC,KAAK,IAAI;IAAG,CAAC;IACpEpC,UAAU;IACVP,kBAAkB;IAClB0B,YAAY;IACZI,YAAY;IACZK,cAAc;IACd3B,gBAAgB;IAChBC,WAAW;IACX6B,aAAa;IACbE;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["sourceFetchData","source","query","backend","schema","loadSchema","visibleColumns","columns","find","searchableFieldIds","length","defineSchemaSource","input","collectionId","paginationMode","fieldModal","fieldTypes","fieldPermissions","supportsPii","references","getReferencedCollectionSource","loaded","then","result","catch","error","undefined","s","displayField","itemKey","item","_schema","String","idField","itemName","_schema2","canAddFields","_s$schemaPermissions","schemaPermissions","createField","canEditField","field","_s$schemaPermissions2","updateField","isSystem","canDeleteField","_s$schemaPermissions3","deleteField","getFieldValue","id","setFieldValue","value","text","loadReferenceableCollectionOptions","types"],"sources":["../../../src/types/SchemaSource.ts"],"sourcesContent":["import type { Field, PatternsFieldType } from './Field';\nimport type { FieldTypeDefinition } from './FieldTypeDefinition';\nimport type { Schema, LoadedSchema, FindOptions } from './Schema';\nimport type {\n FieldModalText,\n FieldModalCollectionInput,\n FieldModalCollectionOptionsLoader,\n FieldPermissions,\n FieldPiiWarning,\n FieldSettingsSection,\n} from './FieldsSource';\nimport type {\n OffsetQuery,\n OffsetQueryResult,\n} from '../hooks/paginationModeConfig';\n\n/** A field type the add/edit field modal offers, with everything that type\n * brings to it. Declare one entry per `patternsType` — the type is the entry's\n * identity. Nothing here reaches the table or the filters; that is `fieldTypes`\n * (`FieldTypeDefinition[]`). */\nexport interface FieldTypeOption {\n patternsType: PatternsFieldType;\n /** Custom display name. Absent ⇒ the UI's standard name for this type. */\n label?: string;\n /** Custom name-input placeholder. Absent ⇒ the UI's standard placeholder. */\n namePlaceholder?: string;\n /** A one-line description shown under the type in the add-field menu. */\n subtitle?: string;\n /** The group heading this type is listed under in the add-field menu, in\n * first-seen order. Types sharing a heading form one group. Absent ⇒\n * ungrouped. */\n group?: string;\n /** Whether a field of this type can be marked PII. Absent ⇒ follows the\n * source's `supportsPii`. */\n supportsPii?: boolean;\n /** Warning shown while the PII toggle is on. Read on every render, so it can\n * use data that only exists once the schema has loaded. Default: none. */\n piiWarning?: () => FieldPiiWarning | undefined;\n /** This type's own part of the collapsible section in the add/edit field\n * modal. Default: none. */\n settingsSection?: FieldSettingsSection;\n /** Collection picker shown in the main add/edit field form. */\n collectionInput?: FieldModalCollectionInput;\n}\n\n/** Everything the add/edit field modal shows for this source. */\nexport interface FieldModalInput {\n /** Title and subtitle. Default: generic titles. */\n text?: FieldModalText;\n /** Default option loader for reference-like built-in field types. */\n loadReferenceableCollectionOptions?: FieldModalCollectionOptionsLoader;\n /** The types the modal offers, in display order. Default: none. */\n types?: FieldTypeOption[];\n}\n\n/** What a caller passes. Only `collectionId` and `loadSchema` are required. */\nexport interface SchemaSourceInput<T> {\n collectionId: string;\n loadSchema: () => Promise<LoadedSchema<T>>;\n /** Sources for collections this one references, keyed by the referenced\n * collection id. A renderer resolves a reference field through the matching\n * entry — its `loadSchema` gives the referenced schema and `sourceFetchData`\n * queries the referenced items. Default: none. */\n references?: Record<string, SchemaSource<any>>;\n /** Lazy source lookup for a referenced collection that is not in `references`.\n * Is used when a reference field is created in the add field modal.\n * The returned source owns its own async schema/item loading. */\n getReferencedCollectionSource?: (\n collectionId: string,\n ) => SchemaSource<any> | undefined;\n paginationMode?: 'offset';\n /** Stable row identity. Default: `row[idField]`. */\n itemKey?: (item: T) => string;\n /** Row display label. Default: `row[displayField]`. */\n itemName?: (item: T) => string;\n /** Fields free-text search runs against. Default: `[displayField]`. */\n searchableFieldIds?: (schema: Schema) => string[];\n /** What the add/edit field modal shows. Default: no types, generic titles. */\n fieldModal?: FieldModalInput;\n /** Consumer-defined field types: how a field of that type renders, filters and\n * validates wherever it appears. A field with `type: 'CUSTOM'` resolves its\n * definition here by `customType`. The add/edit field modal never reads this\n * — see `fieldModal`. Default: none. */\n fieldTypes?: FieldTypeDefinition[];\n /** Default: `schemaPermissions.createField`. */\n canAddFields?: (schema: Schema) => boolean;\n /** Default: `schemaPermissions.updateField && !field.isSystem`. */\n canEditField?: (field: Field, schema: Schema) => boolean;\n /** Default: `schemaPermissions.deleteField && !field.isSystem`. */\n canDeleteField?: (field: Field, schema: Schema) => boolean;\n /** Permission defaults shown in the modal. Absent ⇒ no permissions section. */\n fieldPermissions?: FieldPermissions;\n /** Default: `false`. */\n supportsPii?: boolean;\n /** The value of a field on an item. Default: `item[field.id]`. */\n getFieldValue?: (item: T, field: Field) => unknown;\n /** Writes a field's value on an item, returning the updated item.\n * Default: `{ ...item, [field.id]: value }`. */\n setFieldValue?: (item: T, field: Field, value: unknown) => T;\n}\n\n/** The resolved source: defaults filled, `loadSchema` memoized. */\nexport interface SchemaSource<T> {\n readonly collectionId: string;\n loadSchema: () => Promise<LoadedSchema<T>>;\n readonly paginationMode: 'offset';\n /** Stable row identity. */\n itemKey: (item: T) => string;\n /** Row display label. */\n itemName: (item: T) => string;\n /** Sources for referenced collections, keyed by referenced collection id. */\n readonly references: Record<string, SchemaSource<any>>;\n getReferencedCollectionSource?: (\n collectionId: string,\n ) => SchemaSource<any> | undefined;\n readonly fieldModal: {\n text?: FieldModalText;\n loadReferenceableCollectionOptions?: FieldModalCollectionOptionsLoader;\n types: FieldTypeOption[];\n };\n readonly fieldTypes: FieldTypeDefinition[];\n searchableFieldIds: (schema: Schema) => string[];\n canAddFields: (schema: Schema) => boolean;\n canEditField: (field: Field, schema: Schema) => boolean;\n canDeleteField: (field: Field, schema: Schema) => boolean;\n readonly fieldPermissions?: FieldPermissions;\n readonly supportsPii: boolean;\n /** The value of a field on an item. */\n getFieldValue: (item: T, field: Field) => unknown;\n /** Writes a field's value on an item, returning the updated item. */\n setFieldValue: (item: T, field: Field, value: unknown) => T;\n}\n\ntype OffsetFind<T> = (\n query: OffsetQuery,\n options?: FindOptions,\n) => Promise<OffsetQueryResult<T>>;\n\n/** The collection fetch derived from a source: loads once, then queries the\n * backend's `find`.\n *\n * Free-text search covers the columns the page is showing: the table keeps\n * `query.columns` in sync with them, so the scope comes off the query rather\n * than being threaded in. Falls back to the source's own `searchableFieldIds`\n * before any columns are known (or with no table attached). */\nexport function sourceFetchData<T>(\n source: SchemaSource<T>,\n): (query: OffsetQuery) => Promise<OffsetQueryResult<T>> {\n return async (query) => {\n const { backend, schema } = await source.loadSchema();\n // `columns` is the visible-column list; `fields` is the projection, which a\n // source-driven table doesn't set.\n const visibleColumns = query.columns;\n return (backend.find as OffsetFind<T>)(query, {\n searchableFieldIds: visibleColumns?.length\n ? visibleColumns\n : source.searchableFieldIds(schema),\n });\n };\n}\n\n/** Fills source-neutral defaults over `input` and memoizes the load so the collection\n * query and the table columns share a single fetch. */\nexport function defineSchemaSource<T>(\n input: SchemaSourceInput<T>,\n): SchemaSource<T> {\n const {\n collectionId,\n paginationMode = 'offset',\n fieldModal = {},\n fieldTypes = [],\n fieldPermissions,\n supportsPii = false,\n references = {},\n getReferencedCollectionSource,\n } = input;\n\n let loaded: Promise<LoadedSchema<T>> | undefined;\n let schema: Schema | undefined;\n\n const loadSchema = () =>\n (loaded ??= input\n .loadSchema()\n .then((result) => {\n schema = result.schema;\n return result;\n })\n .catch((error) => {\n loaded = undefined;\n throw error;\n }));\n\n const searchableFieldIds =\n input.searchableFieldIds ?? ((s) => [s.displayField]);\n\n const itemKey =\n input.itemKey ??\n ((item) =>\n String(\n (item as Record<string, unknown>)[schema?.idField ?? '_id'] ?? '',\n ));\n const itemName =\n input.itemName ??\n ((item) =>\n String(\n (item as Record<string, unknown>)[schema?.displayField ?? '_id'] ?? '',\n ));\n const canAddFields =\n input.canAddFields ?? ((s) => s.schemaPermissions?.createField ?? false);\n const canEditField =\n input.canEditField ??\n ((field, s) =>\n (s.schemaPermissions?.updateField ?? false) && !field.isSystem);\n const canDeleteField =\n input.canDeleteField ??\n ((field, s) =>\n (s.schemaPermissions?.deleteField ?? false) && !field.isSystem);\n const getFieldValue =\n input.getFieldValue ??\n ((item, field) => (item as Record<string, unknown>)[field.id]);\n const setFieldValue =\n input.setFieldValue ??\n ((item, field, value) => ({ ...item, [field.id]: value } as T));\n\n return {\n collectionId,\n loadSchema,\n paginationMode,\n itemKey,\n itemName,\n references,\n ...(getReferencedCollectionSource && { getReferencedCollectionSource }),\n fieldModal: {\n text: fieldModal.text,\n loadReferenceableCollectionOptions:\n fieldModal.loadReferenceableCollectionOptions,\n types: fieldModal.types ?? [],\n },\n fieldTypes,\n searchableFieldIds,\n canAddFields,\n canEditField,\n canDeleteField,\n fieldPermissions,\n supportsPii,\n getFieldValue,\n setFieldValue,\n };\n}\n"],"mappings":";;;;;AAgBA;AACA;AACA;AACA;;AA0BA;;AAUA;;AA8CA;;AAqCA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAeA,CAC7BC,MAAuB,EACgC;EACvD,OAAO,MAAOC,KAAK,IAAK;IACtB,MAAM;MAAEC,OAAO;MAAEC;IAAO,CAAC,GAAG,MAAMH,MAAM,CAACI,UAAU,CAAC,CAAC;IACrD;IACA;IACA,MAAMC,cAAc,GAAGJ,KAAK,CAACK,OAAO;IACpC,OAAQJ,OAAO,CAACK,IAAI,CAAmBN,KAAK,EAAE;MAC5CO,kBAAkB,EAAEH,cAAc,YAAdA,cAAc,CAAEI,MAAM,GACtCJ,cAAc,GACdL,MAAM,CAACQ,kBAAkB,CAACL,MAAM;IACtC,CAAC,CAAC;EACJ,CAAC;AACH;;AAEA;AACA;AACO,SAASO,kBAAkBA,CAChCC,KAA2B,EACV;EACjB,MAAM;IACJC,YAAY;IACZC,cAA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C,WAAW;IACX8B,aAAa;IACbE;EACF,CAAC;AACH","ignoreList":[]}
@@ -103,4 +103,10 @@ Object.keys(_dataExtensionOperators).forEach(function (key) {
103
103
  if (key in exports && exports[key] === _dataExtensionOperators[key]) return;
104
104
  exports[key] = _dataExtensionOperators[key];
105
105
  });
106
+ var _isReferenceField = require("./isReferenceField");
107
+ Object.keys(_isReferenceField).forEach(function (key) {
108
+ if (key === "default" || key === "__esModule") return;
109
+ if (key in exports && exports[key] === _isReferenceField[key]) return;
110
+ exports[key] = _isReferenceField[key];
111
+ });
106
112
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_safelyMakeObservable","require","Object","keys","forEach","key","exports","_shouldRedirectToLogin","_typedEmitter","_parseFqdn","_OfflineError","_addEventListener","_withoutDefaults","_slugify","_syncWithSharedQuery","_showToastCompat","_tags","_actionsBar","_isHttpError","_fixDomainForBI","_mobileDetection","_operatorLabels","_dataExtensionOperators"],"sources":["../../../src/util/index.ts"],"sourcesContent":["export * from './safelyMakeObservable';\nexport * from './shouldRedirectToLogin';\nexport * from './typedEmitter';\nexport * from './parseFqdn';\nexport * from './OfflineError';\nexport * from './addEventListener';\nexport * from './withoutDefaults';\nexport * from './slugify';\nexport * from './syncWithSharedQuery';\nexport * from './showToastCompat';\nexport * from './tags';\nexport * from './actionsBar';\nexport * from './isHttpError';\nexport * from './fixDomainForBI';\nexport * from './mobileDetection';\nexport * from './operatorLabels';\nexport * from './dataExtensionOperators';\n"],"mappings":";;;AAAA,IAAAA,qBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,qBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,qBAAA,CAAAK,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAL,qBAAA,CAAAK,GAAA;AAAA;AACA,IAAAE,sB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AA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAe,gBAAA,CAAAf,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAe,gBAAA,CAAAf,GAAA;AAAA;AACA,IAAAgB,eAAA,GAAApB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAkB,eAAA,EAAAjB,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAgB,eAAA,CAAAhB,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAgB,eAAA,CAAAhB,GAAA;AAAA;AACA,IAAAiB,uBAAA,GAAArB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAmB,uBAAA,EAAAlB,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAiB,uBAAA,CAAAjB,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAiB,uBAAA,CAAAjB,GAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["_safelyMakeObservable","require","Object","keys","forEach","key","exports","_shouldRedirectToLogin","_typedEmitter","_parseFqdn","_OfflineError","_addEventListener","_withoutDefaults","_slugify","_syncWithSharedQuery","_showToastCompat","_tags","_actionsBar","_isHttpError","_fixDomainForBI","_mobileDetection","_operatorLabels","_dataExtensionOperators","_isReferenceField"],"sources":["../../../src/util/index.ts"],"sourcesContent":["export * from './safelyMakeObservable';\nexport * from './shouldRedirectToLogin';\nexport * from './typedEmitter';\nexport * from './parseFqdn';\nexport * from './OfflineError';\nexport * from './addEventListener';\nexport * from './withoutDefaults';\nexport * from './slugify';\nexport * from './syncWithSharedQuery';\nexport * from './showToastCompat';\nexport * from './tags';\nexport * from './actionsBar';\nexport * from './isHttpError';\nexport * from './fixDomainForBI';\nexport * from './mobileDetection';\nexport * from './operatorLabels';\nexport * from './dataExtensionOperators';\nexport * from './isReferenceField';\n"],"mappings":";;;AAAA,IAAAA,qBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,qBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,qBAAA,CAAAK,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAL,qBAAA,CAAAK,GAAA;AAAA;AACA,IAAAE,sBAAA,GAAAN,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAI,sBAAA,EAAAH,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAE,sBAAA,CAAAF,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAE,sBAAA,CAAAF,GAAA;AAAA;AACA,IAAAG,aAAA,GAAAP,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAK,aAAA,EAAAJ,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAG,aAAA,CAAAH,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAG,aAAA,CAAAH,GAAA;AAAA;AACA,IAAAI,UAAA,GAAAR,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAM,UAAA,EAAAL,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAI,UAAA,CAAAJ,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAI,UAAA,CAAAJ,GA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,MAAA,CAAAC,IAAA,CAAAoB,iBAAA,EAAAnB,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAkB,iBAAA,CAAAlB,GAAA;EAAAC,OAAA,CAAAD,GAAA,IAAAkB,iBAAA,CAAAlB,GAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.isReferenceFieldType = exports.isReferenceField = void 0;
5
+ const isReferenceFieldType = type => type === 'REFERENCE' || type === 'MULTI_REFERENCE';
6
+ exports.isReferenceFieldType = isReferenceFieldType;
7
+ const isReferenceField = field => Boolean(field && isReferenceFieldType(field.type));
8
+ exports.isReferenceField = isReferenceField;
9
+ //# sourceMappingURL=isReferenceField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isReferenceFieldType","type","exports","isReferenceField","field","Boolean"],"sources":["../../../src/util/isReferenceField.ts"],"sourcesContent":["import type {\n BaseReferenceField,\n Field,\n PatternsFieldType,\n} from '../types/Field';\n\nexport type ReferenceFieldType = Extract<\n PatternsFieldType,\n 'REFERENCE' | 'MULTI_REFERENCE'\n>;\n\nexport const isReferenceFieldType = (\n type: string | undefined,\n): type is ReferenceFieldType =>\n type === 'REFERENCE' || type === 'MULTI_REFERENCE';\n\nexport const isReferenceField = (\n field: Field | undefined,\n): field is BaseReferenceField & { type: ReferenceFieldType } =>\n Boolean(field && isReferenceFieldType(field.type));\n"],"mappings":";;;;AAWO,MAAMA,oBAAoB,GAC/BC,IAAwB,IAExBA,IAAI,KAAK,WAAW,IAAIA,IAAI,KAAK,iBAAiB;AAACC,OAAA,CAAAF,oBAAA,GAAAA,oBAAA;AAE9C,MAAMG,gBAAgB,GAC3BC,KAAwB,IAExBC,OAAO,CAACD,KAAK,IAAIJ,oBAAoB,CAACI,KAAK,CAACH,IAAI,CAAC,CAAC;AAACC,OAAA,CAAAC,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,OAAO,EAGL,YAAY,EACZ,WAAW,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA6C9C,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAO3E,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,OAAO,EAGL,YAAY,EACZ,WAAW,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAgD9C,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAO3E,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { action, makeObservable, observable, runInAction } from 'mobx';
2
+ export class CustomFieldCollectionOptionsState {
3
+ constructor() {
4
+ this.options = [];
5
+ this.loading = false;
6
+ this.error = undefined;
7
+ this.loaderRef = undefined;
8
+ this.cache = new Map();
9
+ makeObservable(this, {
10
+ options: observable.ref,
11
+ loading: observable.ref,
12
+ error: observable.ref,
13
+ clearError: action.bound,
14
+ load: action.bound,
15
+ });
16
+ }
17
+ clearError() {
18
+ this.error = undefined;
19
+ }
20
+ async load(loader) {
21
+ if (!loader) {
22
+ this.loaderRef = undefined;
23
+ this.options = [];
24
+ this.loading = false;
25
+ this.error = undefined;
26
+ return;
27
+ }
28
+ const cached = this.cache.get(loader);
29
+ this.loaderRef = loader;
30
+ if (cached) {
31
+ this.options = cached;
32
+ this.loading = false;
33
+ this.error = undefined;
34
+ return;
35
+ }
36
+ this.options = [];
37
+ this.loading = true;
38
+ this.error = undefined;
39
+ try {
40
+ const options = await loader();
41
+ runInAction(() => {
42
+ this.cache.set(loader, options);
43
+ if (this.loaderRef === loader) {
44
+ this.options = options;
45
+ this.loading = false;
46
+ }
47
+ });
48
+ }
49
+ catch (error) {
50
+ runInAction(() => {
51
+ if (this.loaderRef === loader) {
52
+ this.options = [];
53
+ this.loading = false;
54
+ this.error = error;
55
+ }
56
+ });
57
+ }
58
+ }
59
+ }
60
+ //# sourceMappingURL=CustomFieldCollectionOptionsState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomFieldCollectionOptionsState.js","sourceRoot":"","sources":["../../../src/state/CustomFieldCollectionOptionsState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAMvE,MAAM,OAAO,iCAAiC;IAU5C;QATA,YAAO,GAAiC,EAAE,CAAC;QAC3C,YAAO,GAAG,KAAK,CAAC;QAChB,UAAK,GAAY,SAAS,CAAC;QACnB,cAAS,GAAkD,SAAS,CAAC;QAC5D,UAAK,GAAG,IAAI,GAAG,EAG7B,CAAC;QAGF,cAAc,CAAC,IAAI,EAAE;YACnB,OAAO,EAAE,UAAU,CAAC,GAAG;YACvB,OAAO,EAAE,UAAU,CAAC,GAAG;YACvB,KAAK,EAAE,UAAU,CAAC,GAAG;YACrB,UAAU,EAAE,MAAM,C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MAAM,EAAE;oBAC7B,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;oBAClB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;oBACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;iBACpB;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;CACF"}
@@ -1,9 +1,10 @@
1
1
  import { action, computed, makeObservable, observable, runInAction, } from 'mobx';
2
2
  import { ConditionalModalState } from './ConditionalModalState';
3
+ import { CustomFieldCollectionOptionsState } from './CustomFieldCollectionOptionsState';
3
4
  import { CustomFieldModalBiReporter } from './CustomFieldModalBiReporter';
4
5
  import { FieldState, FormState } from 'formstate';
5
6
  import { ToggleState } from './ToggleState';
6
- import { isHttpError, slugify } from '../util';
7
+ import { isHttpError, isReferenceField, isReferenceFieldType, slugify, } from '../util';
7
8
  import { isDetailsResponse, isErrorDetails } from '../util/isHttpError';
8
9
  export class CustomFieldModalState {
9
10
  constructor(params) {
@@ -11,6 +12,7 @@ export class CustomFieldModalState {
11
12
  this.errorToastConfig = undefined;
12
13
  this.mode = 'new';
13
14
  this.origin = 'Custom columns panel';
15
+ this.collectionOptionsState = new CustomFieldCollectionOptionsState();
14
16
  this.modalState = new ConditionalModalState({
15
17
  onConfirm: async () => {
16
18
  if (this.mode === 'new' && this.fieldManagement.maxReached) {
@@ -86,6 +88,18 @@ export class CustomFieldModalState {
86
88
  writeUsers: new FieldState(false),
87
89
  writeApps: new FieldState(false),
88
90
  containsPii: new FieldState(false),
91
+ referencedCollectionId: new FieldState(undefined).validators((value) => {
92
+ const collectionInput = this.collectionInput;
93
+ if (this.mode === 'new' &&
94
+ collectionInput &&
95
+ (collectionInput.required ?? true) &&
96
+ !value) {
97
+ return (collectionInput.errorMessage ??
98
+ collectionInput.label ??
99
+ this.selectedFieldType?.label);
100
+ }
101
+ return undefined;
102
+ }),
89
103
  });
90
104
  this.disabledFields = {
91
105
  permissions: {
@@ -115,6 +129,14 @@ export class CustomFieldModalState {
115
129
  selectedFieldType: computed,
116
130
  namePlaceholder: computed,
117
131
  typeSupportsPii: computed,
132
+ collectionInput: computed,
133
+ collectionOptionsLoader: computed,
134
+ collectionInputLabel: computed,
135
+ collectionInputPlaceholder: computed,
136
+ collectionInputEmptyStateMessage: computed,
137
+ collectionOptions: computed,
138
+ collectionOptionsLoading: computed,
139
+ collectionOptionsError: computed,
118
140
  showSettings: computed,
119
141
  settingsHasError: computed,
120
142
  isSubmitting: computed,
@@ -123,6 +145,9 @@ export class CustomFieldModalState {
123
145
  mode: observable.ref,
124
146
  reset: action,
125
147
  resetSettingsValues: action,
148
+ resetCollectionInput: action,
149
+ setReferencedCollectionId: action.bound,
150
+ loadCollectionOptions: action.bound,
126
151
  setFormValues: action,
127
152
  generateUniqueKey: action.bound,
128
153
  setKeyFieldIfNotDirty: action.bound,
@@ -170,6 +195,7 @@ export class CustomFieldModalState {
170
195
  form.reset();
171
196
  settings.setOff();
172
197
  this.resetSettingsValues();
198
+ this.resetCollectionInput();
173
199
  this.errorToastConfig = undefined;
174
200
  this.disableAutoValidation();
175
201
  permissions.read.apps = false;
@@ -188,25 +214,32 @@ export class CustomFieldModalState {
188
214
  key.enableAutoValidation();
189
215
  name.enableAutoValidation();
190
216
  type.enableAutoValidation();
217
+ this.form.$.referencedCollectionId.enableAutoValidation();
191
218
  }
192
219
  disableAutoValidation() {
193
220
  const { form: { $: { key, name, type }, }, } = this;
194
221
  key.disableAutoValidation();
195
222
  name.disableAutoValidation();
196
223
  type.disableAutoValidation();
224
+ this.form.$.referencedCollectionId.disableAutoValidation();
197
225
  }
198
226
  getFormValues() {
199
- const { form: { $: { type, key, name, readApps, readUsers, writeApps, writeUsers, containsPii, }, }, } = this;
227
+ const { form: { $: { type, key, name, readApps, readUsers, writeApps, writeUsers, containsPii, referencedCollectionId, }, }, } = this;
228
+ const sectionSettings = this.settingsSection?.getValues(type.value);
229
+ const collectionSettings = referencedCollectionId.value && this.collectionInput?.getSettings
230
+ ? this.collectionInput.getSettings(referencedCollectionId.value)
231
+ : undefined;
200
232
  return {
201
233
  type: type.value,
202
234
  key: key.value,
203
235
  name: name.value,
236
+ referencedCollectionId: referencedCollectionId.value,
204
237
  readApps: readApps.value,
205
238
  readUsers: readUsers.value,
206
239
  writeApps: writeApps.value,
207
240
  writeUsers: writeUsers.value,
208
241
  containsPii: containsPii.value,
209
- settings: this.settingsSection?.getValues(type.value),
242
+ settings: combineFieldSettings(sectionSettings, collectionSettings),
210
243
  };
211
244
  }
212
245
  setFormValues(form, params) {
@@ -219,6 +252,12 @@ export class CustomFieldModalState {
219
252
  $.writeApps.value = form.writeApps;
220
253
  $.writeUsers.value = form.writeUsers;
221
254
  $.containsPii.value = form.containsPii;
255
+ $.referencedCollectionId.value =
256
+ form.referencedCollectionId ??
257
+ (form.field ? this.collectionInput?.getValue?.(form.field) : undefined) ??
258
+ (isReferenceField(form.field)
259
+ ? form.field.referenceMetadata.referencedCollectionId
260
+ : undefined);
222
261
  // After `$.type.value` above, so it lands on the picked type's section.
223
262
  this.settingsSection?.setValues(form.field);
224
263
  if (params?.disablePermissionCheckboxes) {
@@ -248,6 +287,17 @@ export class CustomFieldModalState {
248
287
  $.writeUsers.value = !!permissions?.siteVisitors?.defaultWrite;
249
288
  }
250
289
  }
290
+ resetCollectionInput() {
291
+ this.form.$.referencedCollectionId.value = undefined;
292
+ this.form.$.referencedCollectionId.disableAutoValidation();
293
+ this.collectionOptionsState.clearError();
294
+ }
295
+ setReferencedCollectionId(collectionId) {
296
+ this.form.$.referencedCollectionId.onChange(collectionId);
297
+ }
298
+ async loadCollectionOptions() {
299
+ await this.collectionOptionsState.load(this.collectionOptionsLoader);
300
+ }
251
301
  containsKey(key) {
252
302
  return this.fieldManagement.existingFieldKeys.includes(key);
253
303
  }
@@ -275,6 +325,47 @@ export class CustomFieldModalState {
275
325
  get selectedFieldType() {
276
326
  return this.fieldManagement.fieldModal.types.find((option) => option.id === this.form.$.type.value);
277
327
  }
328
+ get collectionInput() {
329
+ if (!this.selectedFieldType) {
330
+ return undefined;
331
+ }
332
+ const explicitInput = this.selectedFieldType.collectionInput;
333
+ const autoWired = isReferenceFieldType(this.selectedFieldType.patternsType) &&
334
+ this.fieldManagement.fieldModal.loadReferenceableCollectionOptions;
335
+ if (!explicitInput && !autoWired) {
336
+ return undefined;
337
+ }
338
+ return explicitInput ?? {};
339
+ }
340
+ get collectionOptionsLoader() {
341
+ const collectionInput = this.collectionInput;
342
+ if (!collectionInput || !this.selectedFieldType) {
343
+ return undefined;
344
+ }
345
+ return (collectionInput.loadOptions ??
346
+ (isReferenceFieldType(this.selectedFieldType.patternsType)
347
+ ? this.fieldManagement.fieldModal.loadReferenceableCollectionOptions
348
+ : undefined));
349
+ }
350
+ get collectionInputLabel() {
351
+ return this.collectionInput?.label ?? this.selectedFieldType?.label ?? '';
352
+ }
353
+ get collectionInputPlaceholder() {
354
+ return this.collectionInput?.placeholder ?? this.collectionInputLabel;
355
+ }
356
+ get collectionInputEmptyStateMessage() {
357
+ return (this.collectionInput?.emptyStateMessage ??
358
+ this.t('cairo.emptyState.subtitle.nothingMatchesCriteria'));
359
+ }
360
+ get collectionOptions() {
361
+ return this.collectionOptionsState.options;
362
+ }
363
+ get collectionOptionsLoading() {
364
+ return this.collectionOptionsState.loading;
365
+ }
366
+ get collectionOptionsError() {
367
+ return this.collectionOptionsState.error;
368
+ }
278
369
  get namePlaceholder() {
279
370
  return (this.selectedFieldType?.namePlaceholder ??
280
371
  this.selectedFieldType?.label ??
@@ -319,4 +410,17 @@ export class CustomFieldModalState {
319
410
  return Boolean(this.settingsSection?.hasError(this.form.$.type.value));
320
411
  }
321
412
  }
413
+ const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
414
+ const combineFieldSettings = (sectionSettings, collectionSettings) => {
415
+ if (sectionSettings === undefined) {
416
+ return collectionSettings;
417
+ }
418
+ if (collectionSettings === undefined) {
419
+ return sectionSettings;
420
+ }
421
+ if (isRecord(sectionSettings) && isRecord(collectionSettings)) {
422
+ return { ...sectionSettings, ...collectionSettings };
423
+ }
424
+ return collectionSettings;
425
+ };
322
426
  //# sourceMappingURL=CustomFieldModalState.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomFieldModalState.js","sourceRoot":"","sources":["../../../src/state/CustomFieldModalState.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,QAAQ,EACR,cAAc,EACd,UAAU,EACV,WAAW,GACZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA8BxE,MAAM,OAAO,qBAAqB;IA0HhC,YAAY,MAA8B;QArH1C,aAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;QAC7B,qBAAgB,GAA4B,SAAS,CAAC;QACtD,SAAI,GAAmB,KAAK,CAAC;QAC7B,WAAM,GAAsB,sBAAsB,CAAC;QAKnD,eAAU,GAAG,IAAI,qBAAqB,CAAC;YACrC,SAAS,EAAE,KAAK,IAAI,EAAE;gBACpB,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE;oBAC1D,OAAO;iBACR;gBACD,MAAM,EACJ,IAAI,EACJ,IAAI,EACJ,0BAA0B,EAAE,EAAE,qBAAqB,EAAE,EACrD,CAAC,GACF,GAAG,IAAI,CAAC;gBAET,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAEzC,IAAI,UAAU,CAAC,QAAQ,EAAE;oBACvB,IAAI,CA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