@arqel-dev/types 0.18.0 → 0.19.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.
- package/dist/fields.d.ts +7 -0
- package/dist/fields.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/inertia.d.ts +5 -1
- package/package.json +1 -1
package/dist/fields.d.ts
CHANGED
|
@@ -95,6 +95,13 @@ interface BelongsToFieldProps {
|
|
|
95
95
|
preload: boolean;
|
|
96
96
|
/** Set client-side from the panel routes. */
|
|
97
97
|
searchRoute?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Pre-resolved title of the currently-selected related record,
|
|
100
|
+
* emitted server-side by `FieldSchemaSerializer` from the record
|
|
101
|
+
* being edited. Used as the initial label before any async search
|
|
102
|
+
* has run — without it, the picker would show the raw FK value.
|
|
103
|
+
*/
|
|
104
|
+
selectedLabel?: string;
|
|
98
105
|
}
|
|
99
106
|
interface HasManyFieldProps {
|
|
100
107
|
relatedResource: string;
|
package/dist/fields.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/fields.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../src/fields.ts"],"names":[],"mappings":";AAkPO,SAAS,WAAA,CACd,OACA,IAAA,EAC4C;AAC5C,EAAA,OAAO,MAAM,IAAA,KAAS,IAAA;AACxB","file":"fields.js","sourcesContent":["/**\n * Field schema mirroring `Arqel\\Core\\Support\\FieldSchemaSerializer`\n * output. The discriminated union narrows on `type`; per-type\n * `props` carry the type-specific metadata emitted by each Field's\n * `getTypeSpecificProps()`.\n */\n\nexport type FieldType =\n | 'text'\n | 'textarea'\n | 'email'\n | 'url'\n | 'password'\n | 'slug'\n | 'number'\n | 'currency'\n | 'boolean'\n | 'toggle'\n | 'select'\n | 'multiSelect'\n | 'radio'\n | 'belongsTo'\n | 'hasMany'\n | 'date'\n | 'dateTime'\n | 'file'\n | 'image'\n | 'color'\n | 'hidden';\n\nexport interface FieldValidation {\n rules: string[];\n messages: Record<string, string>;\n attribute: string | null;\n}\n\n/**\n * Per-context visibility flags (mirrors `HasVisibility::isVisibleIn`).\n * `canSee` is the per-user/record gate from `HasAuthorization`.\n */\nexport interface FieldVisibility {\n create: boolean;\n edit: boolean;\n detail: boolean;\n table: boolean;\n canSee: boolean;\n}\n\n/**\n * Common shape every Field carries before the discriminated `props`.\n */\ninterface FieldBase<TType extends FieldType, TProps> {\n type: TType;\n name: string;\n label: string | null;\n component: string | null;\n required: boolean;\n readonly: boolean;\n disabled: boolean;\n placeholder: string | null;\n helperText: string | null;\n defaultValue: unknown;\n columnSpan: number | string;\n live: boolean;\n liveDebounce: number | null;\n validation: FieldValidation;\n visibility: FieldVisibility;\n dependsOn: string[];\n props: TProps;\n}\n\n/* ─── Per-type props ────────────────────────────────────────────── */\n\nexport interface TextFieldProps {\n maxLength?: number;\n minLength?: number;\n pattern?: string;\n autocomplete?: string;\n mask?: string;\n}\n\nexport interface NumberFieldProps {\n min?: number;\n max?: number;\n step?: number | string;\n integer?: boolean;\n decimals?: number;\n}\n\nexport interface CurrencyFieldProps extends NumberFieldProps {\n prefix: string;\n suffix?: string;\n thousandsSeparator: string;\n decimalSeparator: string;\n}\n\nexport interface BooleanFieldProps {\n inline?: boolean;\n}\n\nexport interface ToggleFieldProps {\n onLabel?: string;\n offLabel?: string;\n}\n\nexport interface SelectOption {\n value: string | number;\n label: string;\n}\n\nexport interface SelectFieldProps {\n options: SelectOption[] | Record<string, string>;\n searchable?: boolean;\n multiple?: boolean;\n placeholder?: string;\n}\n\nexport interface MultiSelectFieldProps extends SelectFieldProps {\n multiple: true;\n}\n\nexport interface RadioFieldProps {\n options: SelectOption[];\n inline?: boolean;\n}\n\nexport interface BelongsToFieldProps {\n relatedResource: string;\n relationship: string;\n searchable: boolean;\n searchColumns: string[];\n preload: boolean;\n /** Set client-side from the panel routes. */\n searchRoute?: string;\n /**\n * Pre-resolved title of the currently-selected related record,\n * emitted server-side by `FieldSchemaSerializer` from the record\n * being edited. Used as the initial label before any async search\n * has run — without it, the picker would show the raw FK value.\n */\n selectedLabel?: string;\n}\n\nexport interface HasManyFieldProps {\n relatedResource: string;\n relationship: string;\n canAddRecords?: boolean;\n canEditRecords?: boolean;\n}\n\nexport interface DateFieldProps {\n format: string;\n displayFormat: string;\n minDate?: string;\n maxDate?: string;\n closeOnDateSelection?: boolean;\n timezone?: string;\n}\n\nexport interface DateTimeFieldProps extends DateFieldProps {\n seconds?: boolean;\n}\n\nexport interface FileFieldProps {\n disk: string;\n directory?: string;\n visibility?: 'public' | 'private';\n maxSize?: number;\n acceptedFileTypes?: string[];\n multiple?: boolean;\n reorderable?: boolean;\n strategy?: string;\n /** Set client-side from the panel routes. */\n uploadRoute?: string;\n}\n\nexport interface ImageFieldProps extends FileFieldProps {\n aspectRatio?: number;\n crop?: boolean;\n}\n\nexport type ColorFormat = 'hex' | 'rgb' | 'hsl';\n\nexport interface ColorFieldProps {\n presets?: string[];\n format?: ColorFormat;\n alpha?: boolean;\n}\n\nexport interface SlugFieldProps extends TextFieldProps {\n reservedSlugs?: string[];\n}\n\n/* ─── Discriminated union ───────────────────────────────────────── */\n\nexport type TextFieldSchema = FieldBase<'text', TextFieldProps>;\nexport type TextareaFieldSchema = FieldBase<'textarea', TextFieldProps>;\nexport type EmailFieldSchema = FieldBase<'email', TextFieldProps>;\nexport type UrlFieldSchema = FieldBase<'url', TextFieldProps>;\nexport type PasswordFieldSchema = FieldBase<'password', TextFieldProps>;\nexport type SlugFieldSchema = FieldBase<'slug', SlugFieldProps>;\nexport type NumberFieldSchema = FieldBase<'number', NumberFieldProps>;\nexport type CurrencyFieldSchema = FieldBase<'currency', CurrencyFieldProps>;\nexport type BooleanFieldSchema = FieldBase<'boolean', BooleanFieldProps>;\nexport type ToggleFieldSchema = FieldBase<'toggle', ToggleFieldProps>;\nexport type SelectFieldSchema = FieldBase<'select', SelectFieldProps>;\nexport type MultiSelectFieldSchema = FieldBase<'multiSelect', MultiSelectFieldProps>;\nexport type RadioFieldSchema = FieldBase<'radio', RadioFieldProps>;\nexport type BelongsToFieldSchema = FieldBase<'belongsTo', BelongsToFieldProps>;\nexport type HasManyFieldSchema = FieldBase<'hasMany', HasManyFieldProps>;\nexport type DateFieldSchema = FieldBase<'date', DateFieldProps>;\nexport type DateTimeFieldSchema = FieldBase<'dateTime', DateTimeFieldProps>;\nexport type FileFieldSchema = FieldBase<'file', FileFieldProps>;\nexport type ImageFieldSchema = FieldBase<'image', ImageFieldProps>;\nexport type ColorFieldSchema = FieldBase<'color', ColorFieldProps>;\nexport type HiddenFieldSchema = FieldBase<'hidden', Record<string, never>>;\n\nexport type FieldSchema =\n | TextFieldSchema\n | TextareaFieldSchema\n | EmailFieldSchema\n | UrlFieldSchema\n | PasswordFieldSchema\n | SlugFieldSchema\n | NumberFieldSchema\n | CurrencyFieldSchema\n | BooleanFieldSchema\n | ToggleFieldSchema\n | SelectFieldSchema\n | MultiSelectFieldSchema\n | RadioFieldSchema\n | BelongsToFieldSchema\n | HasManyFieldSchema\n | DateFieldSchema\n | DateTimeFieldSchema\n | FileFieldSchema\n | ImageFieldSchema\n | ColorFieldSchema\n | HiddenFieldSchema;\n\n/* ─── Type guards ───────────────────────────────────────────────── */\n\nexport function isFieldType<T extends FieldType>(\n field: FieldSchema,\n type: T,\n): field is Extract<FieldSchema, { type: T }> {\n return field.type === type;\n}\n"]}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/fields.ts","../src/forms.ts"],"names":[],"mappings":";AA2OO,SAAS,WAAA,CACd,OACA,IAAA,EAC4C;AAC5C,EAAA,OAAO,MAAM,IAAA,KAAS,IAAA;AACxB;;;AClIO,SAAS,cAAc,KAAA,EAA0C;AACtE,EAAA,OAAO,MAAM,IAAA,KAAS,QAAA;AACxB;AAEO,SAAS,aAAa,KAAA,EAAyC;AACpE,EAAA,OAAO,MAAM,IAAA,KAAS,OAAA;AACxB;AAOO,SAAS,iBAAA,CAAkB,OAAmB,MAAA,EAA2C;AAC9F,EAAA,OAAO,MAAA,CAAO,KAAK,CAAC,KAAA,KAAU,MAAM,IAAA,KAAS,KAAA,CAAM,IAAI,CAAA,IAAK,IAAA;AAC9D","file":"index.js","sourcesContent":["/**\n * Field schema mirroring `Arqel\\Core\\Support\\FieldSchemaSerializer`\n * output. The discriminated union narrows on `type`; per-type\n * `props` carry the type-specific metadata emitted by each Field's\n * `getTypeSpecificProps()`.\n */\n\nexport type FieldType =\n | 'text'\n | 'textarea'\n | 'email'\n | 'url'\n | 'password'\n | 'slug'\n | 'number'\n | 'currency'\n | 'boolean'\n | 'toggle'\n | 'select'\n | 'multiSelect'\n | 'radio'\n | 'belongsTo'\n | 'hasMany'\n | 'date'\n | 'dateTime'\n | 'file'\n | 'image'\n | 'color'\n | 'hidden';\n\nexport interface FieldValidation {\n rules: string[];\n messages: Record<string, string>;\n attribute: string | null;\n}\n\n/**\n * Per-context visibility flags (mirrors `HasVisibility::isVisibleIn`).\n * `canSee` is the per-user/record gate from `HasAuthorization`.\n */\nexport interface FieldVisibility {\n create: boolean;\n edit: boolean;\n detail: boolean;\n table: boolean;\n canSee: boolean;\n}\n\n/**\n * Common shape every Field carries before the discriminated `props`.\n */\ninterface FieldBase<TType extends FieldType, TProps> {\n type: TType;\n name: string;\n label: string | null;\n component: string | null;\n required: boolean;\n readonly: boolean;\n disabled: boolean;\n placeholder: string | null;\n helperText: string | null;\n defaultValue: unknown;\n columnSpan: number | string;\n live: boolean;\n liveDebounce: number | null;\n validation: FieldValidation;\n visibility: FieldVisibility;\n dependsOn: string[];\n props: TProps;\n}\n\n/* ─── Per-type props ────────────────────────────────────────────── */\n\nexport interface TextFieldProps {\n maxLength?: number;\n minLength?: number;\n pattern?: string;\n autocomplete?: string;\n mask?: string;\n}\n\nexport interface NumberFieldProps {\n min?: number;\n max?: number;\n step?: number | string;\n integer?: boolean;\n decimals?: number;\n}\n\nexport interface CurrencyFieldProps extends NumberFieldProps {\n prefix: string;\n suffix?: string;\n thousandsSeparator: string;\n decimalSeparator: string;\n}\n\nexport interface BooleanFieldProps {\n inline?: boolean;\n}\n\nexport interface ToggleFieldProps {\n onLabel?: string;\n offLabel?: string;\n}\n\nexport interface SelectOption {\n value: string | number;\n label: string;\n}\n\nexport interface SelectFieldProps {\n options: SelectOption[] | Record<string, string>;\n searchable?: boolean;\n multiple?: boolean;\n placeholder?: string;\n}\n\nexport interface MultiSelectFieldProps extends SelectFieldProps {\n multiple: true;\n}\n\nexport interface RadioFieldProps {\n options: SelectOption[];\n inline?: boolean;\n}\n\nexport interface BelongsToFieldProps {\n relatedResource: string;\n relationship: string;\n searchable: boolean;\n searchColumns: string[];\n preload: boolean;\n /** Set client-side from the panel routes. */\n searchRoute?: string;\n}\n\nexport interface HasManyFieldProps {\n relatedResource: string;\n relationship: string;\n canAddRecords?: boolean;\n canEditRecords?: boolean;\n}\n\nexport interface DateFieldProps {\n format: string;\n displayFormat: string;\n minDate?: string;\n maxDate?: string;\n closeOnDateSelection?: boolean;\n timezone?: string;\n}\n\nexport interface DateTimeFieldProps extends DateFieldProps {\n seconds?: boolean;\n}\n\nexport interface FileFieldProps {\n disk: string;\n directory?: string;\n visibility?: 'public' | 'private';\n maxSize?: number;\n acceptedFileTypes?: string[];\n multiple?: boolean;\n reorderable?: boolean;\n strategy?: string;\n /** Set client-side from the panel routes. */\n uploadRoute?: string;\n}\n\nexport interface ImageFieldProps extends FileFieldProps {\n aspectRatio?: number;\n crop?: boolean;\n}\n\nexport type ColorFormat = 'hex' | 'rgb' | 'hsl';\n\nexport interface ColorFieldProps {\n presets?: string[];\n format?: ColorFormat;\n alpha?: boolean;\n}\n\nexport interface SlugFieldProps extends TextFieldProps {\n reservedSlugs?: string[];\n}\n\n/* ─── Discriminated union ───────────────────────────────────────── */\n\nexport type TextFieldSchema = FieldBase<'text', TextFieldProps>;\nexport type TextareaFieldSchema = FieldBase<'textarea', TextFieldProps>;\nexport type EmailFieldSchema = FieldBase<'email', TextFieldProps>;\nexport type UrlFieldSchema = FieldBase<'url', TextFieldProps>;\nexport type PasswordFieldSchema = FieldBase<'password', TextFieldProps>;\nexport type SlugFieldSchema = FieldBase<'slug', SlugFieldProps>;\nexport type NumberFieldSchema = FieldBase<'number', NumberFieldProps>;\nexport type CurrencyFieldSchema = FieldBase<'currency', CurrencyFieldProps>;\nexport type BooleanFieldSchema = FieldBase<'boolean', BooleanFieldProps>;\nexport type ToggleFieldSchema = FieldBase<'toggle', ToggleFieldProps>;\nexport type SelectFieldSchema = FieldBase<'select', SelectFieldProps>;\nexport type MultiSelectFieldSchema = FieldBase<'multiSelect', MultiSelectFieldProps>;\nexport type RadioFieldSchema = FieldBase<'radio', RadioFieldProps>;\nexport type BelongsToFieldSchema = FieldBase<'belongsTo', BelongsToFieldProps>;\nexport type HasManyFieldSchema = FieldBase<'hasMany', HasManyFieldProps>;\nexport type DateFieldSchema = FieldBase<'date', DateFieldProps>;\nexport type DateTimeFieldSchema = FieldBase<'dateTime', DateTimeFieldProps>;\nexport type FileFieldSchema = FieldBase<'file', FileFieldProps>;\nexport type ImageFieldSchema = FieldBase<'image', ImageFieldProps>;\nexport type ColorFieldSchema = FieldBase<'color', ColorFieldProps>;\nexport type HiddenFieldSchema = FieldBase<'hidden', Record<string, never>>;\n\nexport type FieldSchema =\n | TextFieldSchema\n | TextareaFieldSchema\n | EmailFieldSchema\n | UrlFieldSchema\n | PasswordFieldSchema\n | SlugFieldSchema\n | NumberFieldSchema\n | CurrencyFieldSchema\n | BooleanFieldSchema\n | ToggleFieldSchema\n | SelectFieldSchema\n | MultiSelectFieldSchema\n | RadioFieldSchema\n | BelongsToFieldSchema\n | HasManyFieldSchema\n | DateFieldSchema\n | DateTimeFieldSchema\n | FileFieldSchema\n | ImageFieldSchema\n | ColorFieldSchema\n | HiddenFieldSchema;\n\n/* ─── Type guards ───────────────────────────────────────────────── */\n\nexport function isFieldType<T extends FieldType>(\n field: FieldSchema,\n type: T,\n): field is Extract<FieldSchema, { type: T }> {\n return field.type === type;\n}\n","/**\n * Form schema mirroring `arqel-dev/form` PHP serialisation.\n *\n * The `Form::toArray()` payload is a heterogeneous list of entries\n * tagged by `kind`: a `field` carries `{name, type}` (the React\n * side resolves the full Field schema from the Resource fields\n * array), while a `layout` entry carries `{type, component,\n * columnSpan, props}` plus the component's own children.\n */\n\nimport type { FieldSchema } from './fields.js';\n\nexport type LayoutType = 'section' | 'fieldset' | 'grid' | 'columns' | 'group' | 'tabs' | 'tab';\n\nexport interface FieldEntry {\n kind: 'field';\n name: string;\n type: string;\n}\n\ninterface LayoutBase<TType extends LayoutType, TProps> {\n kind: 'layout';\n type: TType;\n component: string;\n columnSpan: number | string;\n props: TProps;\n /** Schema may include further entries (recursive). */\n schema?: SchemaEntry[];\n}\n\n/* ─── Layout props ──────────────────────────────────────────────── */\n\nexport interface SectionProps {\n heading: string;\n description?: string;\n icon?: string;\n collapsible?: boolean;\n collapsed?: boolean;\n columns: number;\n compact?: boolean;\n aside?: boolean;\n}\n\nexport interface FieldsetProps {\n legend: string;\n columns: number;\n}\n\nexport interface GridProps {\n columns: number | Record<string, number>;\n gap?: string;\n}\n\nexport interface ColumnsProps {\n columns: 2;\n}\n\nexport type GroupOrientation = 'horizontal' | 'vertical';\n\nexport interface GroupProps {\n orientation: GroupOrientation;\n}\n\nexport type TabsOrientation = 'horizontal' | 'vertical';\n\nexport interface TabsProps {\n defaultTab: string | null;\n orientation: TabsOrientation;\n}\n\nexport interface TabProps {\n id: string;\n label: string;\n icon?: string;\n badge?: number;\n}\n\nexport type SectionEntry = LayoutBase<'section', SectionProps>;\nexport type FieldsetEntry = LayoutBase<'fieldset', FieldsetProps>;\nexport type GridEntry = LayoutBase<'grid', GridProps>;\nexport type ColumnsEntry = LayoutBase<'columns', ColumnsProps>;\nexport type GroupEntry = LayoutBase<'group', GroupProps>;\nexport type TabsEntry = LayoutBase<'tabs', TabsProps>;\nexport type TabEntry = LayoutBase<'tab', TabProps>;\n\nexport type LayoutEntry =\n | SectionEntry\n | FieldsetEntry\n | GridEntry\n | ColumnsEntry\n | GroupEntry\n | TabsEntry\n | TabEntry;\n\nexport type SchemaEntry = FieldEntry | LayoutEntry;\n\n/**\n * The full `Form::toArray()` payload.\n */\nexport interface FormSchema {\n schema: SchemaEntry[];\n columns: number;\n model: string | null;\n inline: boolean;\n disabled: boolean;\n}\n\n/**\n * Type guard narrowing on `kind`.\n */\nexport function isLayoutEntry(entry: SchemaEntry): entry is LayoutEntry {\n return entry.kind === 'layout';\n}\n\nexport function isFieldEntry(entry: SchemaEntry): entry is FieldEntry {\n return entry.kind === 'field';\n}\n\n/**\n * Resolve a `FieldEntry`'s full schema by name from a flat list\n * of Field schemas. Returns `null` when the field is missing —\n * authoring sites typically render a fallback.\n */\nexport function resolveFieldEntry(entry: FieldEntry, fields: FieldSchema[]): FieldSchema | null {\n return fields.find((field) => field.name === entry.name) ?? null;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/fields.ts","../src/forms.ts"],"names":[],"mappings":";AAkPO,SAAS,WAAA,CACd,OACA,IAAA,EAC4C;AAC5C,EAAA,OAAO,MAAM,IAAA,KAAS,IAAA;AACxB;;;ACzIO,SAAS,cAAc,KAAA,EAA0C;AACtE,EAAA,OAAO,MAAM,IAAA,KAAS,QAAA;AACxB;AAEO,SAAS,aAAa,KAAA,EAAyC;AACpE,EAAA,OAAO,MAAM,IAAA,KAAS,OAAA;AACxB;AAOO,SAAS,iBAAA,CAAkB,OAAmB,MAAA,EAA2C;AAC9F,EAAA,OAAO,MAAA,CAAO,KAAK,CAAC,KAAA,KAAU,MAAM,IAAA,KAAS,KAAA,CAAM,IAAI,CAAA,IAAK,IAAA;AAC9D","file":"index.js","sourcesContent":["/**\n * Field schema mirroring `Arqel\\Core\\Support\\FieldSchemaSerializer`\n * output. The discriminated union narrows on `type`; per-type\n * `props` carry the type-specific metadata emitted by each Field's\n * `getTypeSpecificProps()`.\n */\n\nexport type FieldType =\n | 'text'\n | 'textarea'\n | 'email'\n | 'url'\n | 'password'\n | 'slug'\n | 'number'\n | 'currency'\n | 'boolean'\n | 'toggle'\n | 'select'\n | 'multiSelect'\n | 'radio'\n | 'belongsTo'\n | 'hasMany'\n | 'date'\n | 'dateTime'\n | 'file'\n | 'image'\n | 'color'\n | 'hidden';\n\nexport interface FieldValidation {\n rules: string[];\n messages: Record<string, string>;\n attribute: string | null;\n}\n\n/**\n * Per-context visibility flags (mirrors `HasVisibility::isVisibleIn`).\n * `canSee` is the per-user/record gate from `HasAuthorization`.\n */\nexport interface FieldVisibility {\n create: boolean;\n edit: boolean;\n detail: boolean;\n table: boolean;\n canSee: boolean;\n}\n\n/**\n * Common shape every Field carries before the discriminated `props`.\n */\ninterface FieldBase<TType extends FieldType, TProps> {\n type: TType;\n name: string;\n label: string | null;\n component: string | null;\n required: boolean;\n readonly: boolean;\n disabled: boolean;\n placeholder: string | null;\n helperText: string | null;\n defaultValue: unknown;\n columnSpan: number | string;\n live: boolean;\n liveDebounce: number | null;\n validation: FieldValidation;\n visibility: FieldVisibility;\n dependsOn: string[];\n props: TProps;\n}\n\n/* ─── Per-type props ────────────────────────────────────────────── */\n\nexport interface TextFieldProps {\n maxLength?: number;\n minLength?: number;\n pattern?: string;\n autocomplete?: string;\n mask?: string;\n}\n\nexport interface NumberFieldProps {\n min?: number;\n max?: number;\n step?: number | string;\n integer?: boolean;\n decimals?: number;\n}\n\nexport interface CurrencyFieldProps extends NumberFieldProps {\n prefix: string;\n suffix?: string;\n thousandsSeparator: string;\n decimalSeparator: string;\n}\n\nexport interface BooleanFieldProps {\n inline?: boolean;\n}\n\nexport interface ToggleFieldProps {\n onLabel?: string;\n offLabel?: string;\n}\n\nexport interface SelectOption {\n value: string | number;\n label: string;\n}\n\nexport interface SelectFieldProps {\n options: SelectOption[] | Record<string, string>;\n searchable?: boolean;\n multiple?: boolean;\n placeholder?: string;\n}\n\nexport interface MultiSelectFieldProps extends SelectFieldProps {\n multiple: true;\n}\n\nexport interface RadioFieldProps {\n options: SelectOption[];\n inline?: boolean;\n}\n\nexport interface BelongsToFieldProps {\n relatedResource: string;\n relationship: string;\n searchable: boolean;\n searchColumns: string[];\n preload: boolean;\n /** Set client-side from the panel routes. */\n searchRoute?: string;\n /**\n * Pre-resolved title of the currently-selected related record,\n * emitted server-side by `FieldSchemaSerializer` from the record\n * being edited. Used as the initial label before any async search\n * has run — without it, the picker would show the raw FK value.\n */\n selectedLabel?: string;\n}\n\nexport interface HasManyFieldProps {\n relatedResource: string;\n relationship: string;\n canAddRecords?: boolean;\n canEditRecords?: boolean;\n}\n\nexport interface DateFieldProps {\n format: string;\n displayFormat: string;\n minDate?: string;\n maxDate?: string;\n closeOnDateSelection?: boolean;\n timezone?: string;\n}\n\nexport interface DateTimeFieldProps extends DateFieldProps {\n seconds?: boolean;\n}\n\nexport interface FileFieldProps {\n disk: string;\n directory?: string;\n visibility?: 'public' | 'private';\n maxSize?: number;\n acceptedFileTypes?: string[];\n multiple?: boolean;\n reorderable?: boolean;\n strategy?: string;\n /** Set client-side from the panel routes. */\n uploadRoute?: string;\n}\n\nexport interface ImageFieldProps extends FileFieldProps {\n aspectRatio?: number;\n crop?: boolean;\n}\n\nexport type ColorFormat = 'hex' | 'rgb' | 'hsl';\n\nexport interface ColorFieldProps {\n presets?: string[];\n format?: ColorFormat;\n alpha?: boolean;\n}\n\nexport interface SlugFieldProps extends TextFieldProps {\n reservedSlugs?: string[];\n}\n\n/* ─── Discriminated union ───────────────────────────────────────── */\n\nexport type TextFieldSchema = FieldBase<'text', TextFieldProps>;\nexport type TextareaFieldSchema = FieldBase<'textarea', TextFieldProps>;\nexport type EmailFieldSchema = FieldBase<'email', TextFieldProps>;\nexport type UrlFieldSchema = FieldBase<'url', TextFieldProps>;\nexport type PasswordFieldSchema = FieldBase<'password', TextFieldProps>;\nexport type SlugFieldSchema = FieldBase<'slug', SlugFieldProps>;\nexport type NumberFieldSchema = FieldBase<'number', NumberFieldProps>;\nexport type CurrencyFieldSchema = FieldBase<'currency', CurrencyFieldProps>;\nexport type BooleanFieldSchema = FieldBase<'boolean', BooleanFieldProps>;\nexport type ToggleFieldSchema = FieldBase<'toggle', ToggleFieldProps>;\nexport type SelectFieldSchema = FieldBase<'select', SelectFieldProps>;\nexport type MultiSelectFieldSchema = FieldBase<'multiSelect', MultiSelectFieldProps>;\nexport type RadioFieldSchema = FieldBase<'radio', RadioFieldProps>;\nexport type BelongsToFieldSchema = FieldBase<'belongsTo', BelongsToFieldProps>;\nexport type HasManyFieldSchema = FieldBase<'hasMany', HasManyFieldProps>;\nexport type DateFieldSchema = FieldBase<'date', DateFieldProps>;\nexport type DateTimeFieldSchema = FieldBase<'dateTime', DateTimeFieldProps>;\nexport type FileFieldSchema = FieldBase<'file', FileFieldProps>;\nexport type ImageFieldSchema = FieldBase<'image', ImageFieldProps>;\nexport type ColorFieldSchema = FieldBase<'color', ColorFieldProps>;\nexport type HiddenFieldSchema = FieldBase<'hidden', Record<string, never>>;\n\nexport type FieldSchema =\n | TextFieldSchema\n | TextareaFieldSchema\n | EmailFieldSchema\n | UrlFieldSchema\n | PasswordFieldSchema\n | SlugFieldSchema\n | NumberFieldSchema\n | CurrencyFieldSchema\n | BooleanFieldSchema\n | ToggleFieldSchema\n | SelectFieldSchema\n | MultiSelectFieldSchema\n | RadioFieldSchema\n | BelongsToFieldSchema\n | HasManyFieldSchema\n | DateFieldSchema\n | DateTimeFieldSchema\n | FileFieldSchema\n | ImageFieldSchema\n | ColorFieldSchema\n | HiddenFieldSchema;\n\n/* ─── Type guards ───────────────────────────────────────────────── */\n\nexport function isFieldType<T extends FieldType>(\n field: FieldSchema,\n type: T,\n): field is Extract<FieldSchema, { type: T }> {\n return field.type === type;\n}\n","/**\n * Form schema mirroring `arqel-dev/form` PHP serialisation.\n *\n * The `Form::toArray()` payload is a heterogeneous list of entries\n * tagged by `kind`: a `field` carries `{name, type}` (the React\n * side resolves the full Field schema from the Resource fields\n * array), while a `layout` entry carries `{type, component,\n * columnSpan, props}` plus the component's own children.\n */\n\nimport type { FieldSchema } from './fields.js';\n\nexport type LayoutType = 'section' | 'fieldset' | 'grid' | 'columns' | 'group' | 'tabs' | 'tab';\n\nexport interface FieldEntry {\n kind: 'field';\n name: string;\n type: string;\n}\n\ninterface LayoutBase<TType extends LayoutType, TProps> {\n kind: 'layout';\n type: TType;\n component: string;\n columnSpan: number | string;\n props: TProps;\n /** Schema may include further entries (recursive). */\n schema?: SchemaEntry[];\n}\n\n/* ─── Layout props ──────────────────────────────────────────────── */\n\nexport interface SectionProps {\n heading: string;\n description?: string;\n icon?: string;\n collapsible?: boolean;\n collapsed?: boolean;\n columns: number;\n compact?: boolean;\n aside?: boolean;\n}\n\nexport interface FieldsetProps {\n legend: string;\n columns: number;\n}\n\nexport interface GridProps {\n columns: number | Record<string, number>;\n gap?: string;\n}\n\nexport interface ColumnsProps {\n columns: 2;\n}\n\nexport type GroupOrientation = 'horizontal' | 'vertical';\n\nexport interface GroupProps {\n orientation: GroupOrientation;\n}\n\nexport type TabsOrientation = 'horizontal' | 'vertical';\n\nexport interface TabsProps {\n defaultTab: string | null;\n orientation: TabsOrientation;\n}\n\nexport interface TabProps {\n id: string;\n label: string;\n icon?: string;\n badge?: number;\n}\n\nexport type SectionEntry = LayoutBase<'section', SectionProps>;\nexport type FieldsetEntry = LayoutBase<'fieldset', FieldsetProps>;\nexport type GridEntry = LayoutBase<'grid', GridProps>;\nexport type ColumnsEntry = LayoutBase<'columns', ColumnsProps>;\nexport type GroupEntry = LayoutBase<'group', GroupProps>;\nexport type TabsEntry = LayoutBase<'tabs', TabsProps>;\nexport type TabEntry = LayoutBase<'tab', TabProps>;\n\nexport type LayoutEntry =\n | SectionEntry\n | FieldsetEntry\n | GridEntry\n | ColumnsEntry\n | GroupEntry\n | TabsEntry\n | TabEntry;\n\nexport type SchemaEntry = FieldEntry | LayoutEntry;\n\n/**\n * The full `Form::toArray()` payload.\n */\nexport interface FormSchema {\n schema: SchemaEntry[];\n columns: number;\n model: string | null;\n inline: boolean;\n disabled: boolean;\n}\n\n/**\n * Type guard narrowing on `kind`.\n */\nexport function isLayoutEntry(entry: SchemaEntry): entry is LayoutEntry {\n return entry.kind === 'layout';\n}\n\nexport function isFieldEntry(entry: SchemaEntry): entry is FieldEntry {\n return entry.kind === 'field';\n}\n\n/**\n * Resolve a `FieldEntry`'s full schema by name from a flat list\n * of Field schemas. Returns `null` when the field is missing —\n * authoring sites typically render a fallback.\n */\nexport function resolveFieldEntry(entry: FieldEntry, fields: FieldSchema[]): FieldSchema | null {\n return fields.find((field) => field.name === entry.name) ?? null;\n}\n"]}
|
package/dist/inertia.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { TenantContextProps } from './tenant.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Inertia shared props injected by
|
|
3
5
|
* `Arqel\Core\Http\Middleware\HandleArqelInertiaRequests`.
|
|
@@ -6,6 +8,7 @@
|
|
|
6
8
|
* receives `auth`, `panel`, `tenant`, `flash`, `translations`,
|
|
7
9
|
* `arqel.version` for free.
|
|
8
10
|
*/
|
|
11
|
+
|
|
9
12
|
interface AuthUserPayload {
|
|
10
13
|
id: number | string;
|
|
11
14
|
name?: string | null;
|
|
@@ -30,6 +33,7 @@ interface FlashPayload {
|
|
|
30
33
|
error: string | null;
|
|
31
34
|
info: string | null;
|
|
32
35
|
warning: string | null;
|
|
36
|
+
download_url?: string | null;
|
|
33
37
|
}
|
|
34
38
|
interface NotificationItem {
|
|
35
39
|
id: string;
|
|
@@ -52,7 +56,7 @@ interface SharedProps {
|
|
|
52
56
|
auth: AuthPayload;
|
|
53
57
|
panel: PanelPayload | null;
|
|
54
58
|
/** Tenant payload — null in Phase 1 (scaffold only). */
|
|
55
|
-
tenant:
|
|
59
|
+
tenant: TenantContextProps | null;
|
|
56
60
|
flash: FlashPayload;
|
|
57
61
|
/** Translation map under the `arqel::*` namespace. */
|
|
58
62
|
translations: Record<string, unknown>;
|
package/package.json
CHANGED