Compare commits

...

3 Commits

Author SHA1 Message Date
Ben Beckford 63b6d412fe Merge branch 'main' into chore/workflow-property-order 2026-06-22 13:42:35 -07:00
Ben Beckford dec0ce6016 chore(web): extract schema property sorting to method 2026-06-22 13:41:50 -07:00
Ben Beckford dac42d4fee chore(web): workflow property ordering 2026-06-22 11:00:04 -07:00
5 changed files with 26 additions and 8 deletions
+11 -3
View File
@@ -278,7 +278,9 @@
"title": "Album IDs",
"array": true,
"description": "Target album IDs",
"uiHint": "AlbumId"
"uiHint": {
"type": "AlbumId"
}
},
"albumName": {
"type": "string",
@@ -368,14 +370,20 @@
"type": "string",
"title": "Album ID",
"description": "Target album ID",
"uiHint": "AlbumId"
"uiHint": {
"type": "AlbumId",
"order": 1
}
},
"albumIds": {
"type": "string",
"title": "Album IDs",
"description": "Target album IDs",
"array": true,
"uiHint": "AlbumId"
"uiHint": {
"type": "AlbumId",
"order": 2
}
}
}
}
+6 -1
View File
@@ -14,7 +14,12 @@ const JsonSchemaPropertySchema = z
enum: z.array(z.string()).optional().describe('Valid choices for enum types'),
array: z.boolean().optional().describe('Type is an array type'),
required: z.array(z.string()).optional().describe('A list of required properties'),
uiHint: z.string().optional(),
uiHint: z
.object({
type: z.string().optional(),
order: z.int().optional(),
})
.optional(),
get properties() {
return z.record(z.string(), JsonSchemaPropertySchema).optional();
},
@@ -51,6 +51,8 @@
};
const setUiHintValue = (values: string[]) => setValue(schema.array ? values : values[0]);
const getSchemaProperties = (schema: JSONSchemaProperty) =>
Object.entries(schema.properties ?? {}).sort((a, b) => (a[1].uiHint?.order ?? 0) - (b[1].uiHint?.order ?? 0));
const getBoolean = (defaultValue = false) => getValue<boolean>(defaultValue);
const getString = () => getValue<string>();
@@ -72,11 +74,11 @@
</div>
{/if}
<div class="flex flex-col gap-4 {root ? '' : 'border-l-4 border-gray-200 ps-2'}">
{#each Object.entries(schema.properties ?? {}) as [childKey, childSchema] (childKey)}
{#each getSchemaProperties(schema) as [childKey, childSchema] (childKey)}
<Self schema={childSchema} key={childKey} bind:config={getValue, setValue} />
{/each}
</div>
{:else if schema.uiHint === 'AlbumId'}
{:else if schema.uiHint?.type === 'AlbumId'}
<SchemaAlbumPicker {label} {description} array={schema.array} bind:albumIds={getUiHintValue, setUiHintValue} />
{:else if schema.enum && schema.array}
<Field {label} {description}>
+4 -1
View File
@@ -96,7 +96,10 @@ export type JSONSchemaProperty = {
array?: boolean;
properties?: Record<string, JSONSchemaProperty>;
required?: string[];
uiHint?: 'AlbumId' | 'AssetId' | 'PersonId';
uiHint?: {
type?: 'AlbumId' | 'AssetId' | 'PersonId';
order?: number;
};
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -55,7 +55,7 @@
);
const isGhost = $derived(step.id === 'ghost');
const getUiHint = (key: string) => schema?.properties?.[key]?.uiHint;
const getUiHint = (key: string) => schema?.properties?.[key]?.uiHint?.type;
const toIds = (value: unknown): string[] => (Array.isArray(value) ? value.map(String) : [String(value)]);
let dragImage = $state<Element>();
let isDropTarget = $state(false);