mirror of
https://github.com/faiztyanirh/clqms-shadcn-v1.git
synced 2026-04-22 09:35:34 +07:00
add feature level validation dict test cal
This commit is contained in:
parent
c5d2aa6711
commit
0d49cc57eb
@ -23,7 +23,7 @@ const optionsMode = {
|
||||
if (field.key === 'FormulaInput') {
|
||||
return {
|
||||
...baseOption,
|
||||
level: item.SeqRpt,
|
||||
level: item.CountStat,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -9,6 +9,7 @@
|
||||
import DictionaryFormRenderer from '$lib/components/reusable/form/dictionary-form-renderer.svelte';
|
||||
|
||||
let props = $props();
|
||||
|
||||
// const formState = props.calFormState;
|
||||
|
||||
// let options = $state([]);
|
||||
|
||||
@ -85,9 +85,9 @@
|
||||
const selected = formState.form.FormulaInput;
|
||||
if (!Array.isArray(selected)) return [];
|
||||
|
||||
return selected.map((v) => ({
|
||||
value: v,
|
||||
done: new RegExp(`\\b${v}\\b`, 'i').test(formulaCode)
|
||||
return selected.map((item) => ({
|
||||
value: item.value,
|
||||
done: new RegExp(`\\b${item.value}\\b`, 'i').test(formulaCode)
|
||||
}));
|
||||
}
|
||||
|
||||
@ -347,13 +347,17 @@
|
||||
</Select.Root>
|
||||
{:else if type === 'selectmultiple'}
|
||||
{@const filteredOptions = getFilteredOptions(key)}
|
||||
{@const currentValues = Array.isArray(formState.form[key]) ? formState.form[key] : []}
|
||||
<Select.Root
|
||||
type="multiple"
|
||||
bind:value={formState.form[key]}
|
||||
value={currentValues.map((item) => item.value)}
|
||||
onValueChange={(val) => {
|
||||
formState.form[key] = val;
|
||||
const selectedObjects = (formState.selectOptions?.[key] ?? []).filter((opt) =>
|
||||
val.includes(opt.value)
|
||||
);
|
||||
formState.form[key] = selectedObjects;
|
||||
if (validateOn?.includes('input')) {
|
||||
formState.validateField?.(key, val, false);
|
||||
formState.validateField?.(key, selectedObjects, false);
|
||||
formState.validateField?.('FormulaCode', expression, false);
|
||||
}
|
||||
}}
|
||||
@ -367,9 +371,9 @@
|
||||
}}
|
||||
>
|
||||
<Select.Trigger class="w-full">
|
||||
{formState.form[key]?.length
|
||||
{currentValues.length
|
||||
? (formState.selectOptions?.[key] ?? [])
|
||||
.filter((o) => formState.form[key].includes(o.value))
|
||||
.filter((o) => currentValues.some((f) => f.value === o.value))
|
||||
.map((o) => o.label)
|
||||
.join(', ')
|
||||
: 'Choose'}
|
||||
@ -387,7 +391,7 @@
|
||||
{#if formState.loadingOptions?.[key]}
|
||||
<div class="p-2 text-sm text-muted-foreground">Loading...</div>
|
||||
{:else}
|
||||
{#if formState.form[key].length > 0}
|
||||
{#if currentValues.length > 0}
|
||||
<Select.Separator />
|
||||
<button
|
||||
class="w-full px-2 py-1.5 text-left text-sm hover:bg-accent hover:text-accent-foreground"
|
||||
@ -581,9 +585,9 @@
|
||||
type="button"
|
||||
variant="outline"
|
||||
class="h-auto w-auto p-2"
|
||||
onclick={() => addValue(item)}
|
||||
onclick={() => addValue(item.value)}
|
||||
>
|
||||
{item}
|
||||
{item.value}
|
||||
</Button>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user