fix: fixed showing default option label
This commit is contained in:
@ -1,11 +1,11 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { omit } from "lodash";
|
import { omit } from "lodash";
|
||||||
import useAttributeOptionsList from "@/app/module-editor/[moduleId]/components/shared/AttrOptionSelect/useAttributeOptionsList";
|
|
||||||
import ObjectSelect from "@/components/selects/ObjectSelect/ObjectSelect";
|
import ObjectSelect from "@/components/selects/ObjectSelect/ObjectSelect";
|
||||||
|
import useAttributeOptionsList from "@/hooks/lists/useAttributeOptionsList";
|
||||||
import { AttrOptionSchema } from "@/lib/client";
|
import { AttrOptionSchema } from "@/lib/client";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
value: any;
|
value: number;
|
||||||
onChange: (val: any) => void;
|
onChange: (val: any) => void;
|
||||||
selectId: number;
|
selectId: number;
|
||||||
error?: string;
|
error?: string;
|
||||||
@ -22,7 +22,7 @@ const AttrOptionSelect = (props: Props) => {
|
|||||||
setSelectedOption(undefined);
|
setSelectedOption(undefined);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setSelectedOption(options.find(option => option.value === props.value));
|
setSelectedOption(options.find(option => option.id === props.value));
|
||||||
}, [props.value, options]);
|
}, [props.value, options]);
|
||||||
|
|
||||||
const restProps = omit(props, ["value, onChange", "selectId"]);
|
const restProps = omit(props, ["value, onChange", "selectId"]);
|
||||||
@ -35,7 +35,7 @@ const AttrOptionSelect = (props: Props) => {
|
|||||||
value={selectedOption}
|
value={selectedOption}
|
||||||
onChange={option => {
|
onChange={option => {
|
||||||
setSelectedOption(option);
|
setSelectedOption(option);
|
||||||
props.onChange(option.value);
|
props.onChange(option.id);
|
||||||
}}
|
}}
|
||||||
onClear={() => {
|
onClear={() => {
|
||||||
setSelectedOption(undefined);
|
setSelectedOption(undefined);
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import { CSSProperties, FC, JSX } from "react";
|
import { CSSProperties, FC, JSX } from "react";
|
||||||
import { Checkbox, NumberInput, TextInput } from "@mantine/core";
|
import { Checkbox, NumberInput, TextInput } from "@mantine/core";
|
||||||
import { DatePickerInput, DateTimePicker } from "@mantine/dates";
|
import { DatePickerInput, DateTimePicker } from "@mantine/dates";
|
||||||
import AttrOptionSelect from "@/app/module-editor/[moduleId]/components/shared/AttrOptionSelect/AttrOptionSelect";
|
import AttrOptionSelect from "@/app/deals/drawers/DealEditorDrawer/components/AttrOptionSelect";
|
||||||
import { DealModuleAttributeSchema } from "@/lib/client";
|
import { DealModuleAttributeSchema } from "@/lib/client";
|
||||||
import { naiveDateTimeStringToUtc } from "@/utils/datetime";
|
import { naiveDateTimeStringToUtc } from "@/utils/datetime";
|
||||||
|
|
||||||
|
|||||||
@ -3,14 +3,14 @@
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { DataTableColumn } from "mantine-datatable";
|
import { DataTableColumn } from "mantine-datatable";
|
||||||
import { Center } from "@mantine/core";
|
import { Center } from "@mantine/core";
|
||||||
import { useAttributesContext } from "@/app/attributes/contexts/AttributesContext";
|
|
||||||
import AttributeTableActions from "@/app/module-editor/[moduleId]/components/shared/AttributeTableActions/AttributeTableActions";
|
import AttributeTableActions from "@/app/module-editor/[moduleId]/components/shared/AttributeTableActions/AttributeTableActions";
|
||||||
|
import { useModuleEditorContext } from "@/app/module-editor/[moduleId]/contexts/ModuleEditorContext";
|
||||||
import useIsMobile from "@/hooks/utils/useIsMobile";
|
import useIsMobile from "@/hooks/utils/useIsMobile";
|
||||||
import { AttributeSchema } from "@/lib/client";
|
import { AttributeSchema } from "@/lib/client";
|
||||||
|
|
||||||
const useAttributesTableColumns = () => {
|
const useAttributesTableColumns = () => {
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
const { attributesActions } = useAttributesContext();
|
const { attributeActions } = useModuleEditorContext();
|
||||||
|
|
||||||
return useMemo(
|
return useMemo(
|
||||||
() =>
|
() =>
|
||||||
@ -24,7 +24,7 @@ const useAttributesTableColumns = () => {
|
|||||||
accessor: "type.name",
|
accessor: "type.name",
|
||||||
render: attr =>
|
render: attr =>
|
||||||
attr.type.type === "select"
|
attr.type.type === "select"
|
||||||
? `Выбор "${attr.label}"`
|
? `Выбор "${attr.select?.label}"`
|
||||||
: attr.type.name,
|
: attr.type.name,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -34,7 +34,7 @@ const useAttributesTableColumns = () => {
|
|||||||
render: attribute => (
|
render: attribute => (
|
||||||
<AttributeTableActions
|
<AttributeTableActions
|
||||||
attribute={attribute}
|
attribute={attribute}
|
||||||
{...attributesActions}
|
{...attributeActions}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|||||||
@ -0,0 +1,29 @@
|
|||||||
|
import ObjectSelect from "@/components/selects/ObjectSelect/ObjectSelect";
|
||||||
|
import useAttributeOptionsList from "@/hooks/lists/useAttributeOptionsList";
|
||||||
|
import { AttrOptionSchema } from "@/lib/client";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
value?: AttrOptionSchema | null;
|
||||||
|
onChange: (val: AttrOptionSchema | null) => void;
|
||||||
|
selectId: number;
|
||||||
|
error?: string;
|
||||||
|
label?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const DefaultAttrOptionSelect = ({ selectId, ...props }: Props) => {
|
||||||
|
const { options } = useAttributeOptionsList({ selectId });
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ObjectSelect
|
||||||
|
label={"Значение"}
|
||||||
|
{...props}
|
||||||
|
data={options}
|
||||||
|
onClear={() => props.onChange(null)}
|
||||||
|
getLabelFn={(option: AttrOptionSchema) => option.label}
|
||||||
|
clearable
|
||||||
|
searchable
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default DefaultAttrOptionSelect;
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import { Checkbox, NumberInput, TextInput } from "@mantine/core";
|
import { Checkbox, NumberInput, TextInput } from "@mantine/core";
|
||||||
import { DatePickerInput, DateTimePicker } from "@mantine/dates";
|
import { DatePickerInput, DateTimePicker } from "@mantine/dates";
|
||||||
import { UseFormReturnType } from "@mantine/form";
|
import { UseFormReturnType } from "@mantine/form";
|
||||||
import AttrOptionSelect from "@/app/module-editor/[moduleId]/components/shared/AttrOptionSelect/AttrOptionSelect";
|
import DefaultAttrOptionSelect from "@/app/module-editor/[moduleId]/components/shared/DefaultAttrOptionSelect/DefaultAttrOptionSelect";
|
||||||
import { AttributeSchema } from "@/lib/client";
|
import { AttributeSchema } from "@/lib/client";
|
||||||
import { naiveDateTimeStringToUtc } from "@/utils/datetime";
|
import { naiveDateTimeStringToUtc } from "@/utils/datetime";
|
||||||
|
|
||||||
@ -91,11 +91,14 @@ const DefaultAttributeValueInput = ({ form }: Props) => {
|
|||||||
} else if (type === "select") {
|
} else if (type === "select") {
|
||||||
if (!form.values.select?.id) return <></>;
|
if (!form.values.select?.id) return <></>;
|
||||||
return (
|
return (
|
||||||
<AttrOptionSelect
|
<DefaultAttrOptionSelect
|
||||||
label={"Значение по умолчанию"}
|
label={"Значение по умолчанию"}
|
||||||
{...form.getInputProps("defaultValue")}
|
{...form.getInputProps("defaultOption")}
|
||||||
value={form.values.defaultValue}
|
value={form.values.defaultOption}
|
||||||
onChange={value => form.setFieldValue("defaultValue", value)}
|
onChange={value => {
|
||||||
|
form.setFieldValue("defaultOption", value);
|
||||||
|
form.setFieldValue("defaultOptionId", value?.id);
|
||||||
|
}}
|
||||||
selectId={form.values.select?.id}
|
selectId={form.values.select?.id}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -11,6 +11,8 @@ import PageBlock from "@/components/layout/PageBlock/PageBlock";
|
|||||||
const PageBody = () => {
|
const PageBody = () => {
|
||||||
const { module } = useModuleEditorContext();
|
const { module } = useModuleEditorContext();
|
||||||
|
|
||||||
|
if (!module) return;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack h={"100%"}>
|
<Stack h={"100%"}>
|
||||||
<PageBlock
|
<PageBlock
|
||||||
|
|||||||
@ -67,11 +67,10 @@ const useAttributesCrud = ({
|
|||||||
_id?: string;
|
_id?: string;
|
||||||
path?: { moduleId?: number };
|
path?: { moduleId?: number };
|
||||||
};
|
};
|
||||||
const isMatch =
|
return (
|
||||||
key?._id === "getDealModuleAttributes" &&
|
key?._id === "getDealModuleAttributes" &&
|
||||||
key?.path?.moduleId === module.id;
|
key?.path?.moduleId === module.id
|
||||||
if (isMatch) console.log(isMatch);
|
);
|
||||||
return isMatch;
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -44,13 +44,19 @@ const AttributeEditorModal = ({
|
|||||||
isApplicableToGroup: false,
|
isApplicableToGroup: false,
|
||||||
isNullable: false,
|
isNullable: false,
|
||||||
defaultValue: null,
|
defaultValue: null,
|
||||||
|
defaultOptionId: null,
|
||||||
|
defaultOption: null,
|
||||||
description: "",
|
description: "",
|
||||||
} as Partial<AttributeSchema>),
|
} as Partial<AttributeSchema>),
|
||||||
validate: {
|
validate: {
|
||||||
label: label => !label?.trim() && "Название не заполнено",
|
label: label => !label?.trim() && "Название не заполнено",
|
||||||
type: type => !type && "Тип атрибута не выбран",
|
type: type => !type && "Тип атрибута не выбран",
|
||||||
defaultValue: (defaultValue, values) => {
|
isNullable: (isNullable, values) => {
|
||||||
if (defaultValue === null && !values.isNullable) {
|
if (
|
||||||
|
values.defaultValue === null &&
|
||||||
|
values.defaultOption === null &&
|
||||||
|
!isNullable
|
||||||
|
) {
|
||||||
return "Укажите значение по умолчанию или разрешите пустое значение.";
|
return "Укажите значение по умолчанию или разрешите пустое значение.";
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -25,7 +25,7 @@ const useAttributesInnerTableColumns = () => {
|
|||||||
accessor: "type.name",
|
accessor: "type.name",
|
||||||
render: attr =>
|
render: attr =>
|
||||||
attr.type.type === "select"
|
attr.type.type === "select"
|
||||||
? `Выбор "${attr.label}"`
|
? `Выбор "${attr.select?.label}"`
|
||||||
: attr.type.name,
|
: attr.type.name,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,9 +12,8 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const AttributeDefaultValue: FC<Props> = ({ attribute }) => {
|
const AttributeDefaultValue: FC<Props> = ({ attribute }) => {
|
||||||
if (!attribute.defaultValue) return <>-</>;
|
if (!attribute.defaultValue && !attribute.defaultOption) return <>-</>;
|
||||||
const value = attribute.defaultValue;
|
const value = attribute.defaultValue;
|
||||||
if (value === null) return <>-</>;
|
|
||||||
|
|
||||||
const type = attribute.type.type;
|
const type = attribute.type.type;
|
||||||
if (type === "datetime") {
|
if (type === "datetime") {
|
||||||
@ -28,6 +27,9 @@ const AttributeDefaultValue: FC<Props> = ({ attribute }) => {
|
|||||||
if (type === "bool") {
|
if (type === "bool") {
|
||||||
return value ? <IconCheck /> : <IconX />;
|
return value ? <IconCheck /> : <IconX />;
|
||||||
}
|
}
|
||||||
|
if (type === "select") {
|
||||||
|
return attribute.defaultOption?.label;
|
||||||
|
}
|
||||||
|
|
||||||
return <>{value}</>;
|
return <>{value}</>;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -266,9 +266,9 @@ export const mergeHeaders = (
|
|||||||
delete mergedHeaders[key];
|
delete mergedHeaders[key];
|
||||||
} else if (Array.isArray(value)) {
|
} else if (Array.isArray(value)) {
|
||||||
for (const v of value) {
|
for (const v of value) {
|
||||||
// @ts-ignore
|
// @ts-expect-error
|
||||||
mergedHeaders[key] = [
|
mergedHeaders[key] = [
|
||||||
...(mergedHeaders[key] ?? []) as any,
|
...(mergedHeaders[key] ?? []),
|
||||||
v as string,
|
v as string,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,10 +22,6 @@ export type AttrOptionSchema = {
|
|||||||
* Label
|
* Label
|
||||||
*/
|
*/
|
||||||
label: string;
|
label: string;
|
||||||
/**
|
|
||||||
* Value
|
|
||||||
*/
|
|
||||||
value: unknown;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,6 +62,10 @@ export type AttributeSchema = {
|
|||||||
* Defaultvalue
|
* Defaultvalue
|
||||||
*/
|
*/
|
||||||
defaultValue: unknown | null;
|
defaultValue: unknown | null;
|
||||||
|
/**
|
||||||
|
* Defaultoptionid
|
||||||
|
*/
|
||||||
|
defaultOptionId?: number | null;
|
||||||
/**
|
/**
|
||||||
* Description
|
* Description
|
||||||
*/
|
*/
|
||||||
@ -87,21 +87,8 @@ export type AttributeSchema = {
|
|||||||
*/
|
*/
|
||||||
isBuiltIn: boolean;
|
isBuiltIn: boolean;
|
||||||
type: AttributeTypeSchema;
|
type: AttributeTypeSchema;
|
||||||
select: AttributeSelectSchema | null;
|
defaultOption?: AttrOptionSchema | null;
|
||||||
};
|
select: AttrSelectSchema | null;
|
||||||
|
|
||||||
/**
|
|
||||||
* AttributeSelectSchema
|
|
||||||
*/
|
|
||||||
export type AttributeSelectSchema = {
|
|
||||||
/**
|
|
||||||
* Id
|
|
||||||
*/
|
|
||||||
id: number;
|
|
||||||
/**
|
|
||||||
* Label
|
|
||||||
*/
|
|
||||||
label: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -345,6 +332,10 @@ export type CreateAttributeSchema = {
|
|||||||
* Defaultvalue
|
* Defaultvalue
|
||||||
*/
|
*/
|
||||||
defaultValue: unknown | null;
|
defaultValue: unknown | null;
|
||||||
|
/**
|
||||||
|
* Defaultoptionid
|
||||||
|
*/
|
||||||
|
defaultOptionId?: number | null;
|
||||||
/**
|
/**
|
||||||
* Description
|
* Description
|
||||||
*/
|
*/
|
||||||
@ -1084,7 +1075,7 @@ export type DealModuleAttributeSchema = {
|
|||||||
*/
|
*/
|
||||||
value: unknown | null;
|
value: unknown | null;
|
||||||
type: AttributeTypeSchema;
|
type: AttributeTypeSchema;
|
||||||
select: AttributeSelectSchema | null;
|
select: AttrSelectSchema | null;
|
||||||
/**
|
/**
|
||||||
* Defaultvalue
|
* Defaultvalue
|
||||||
*/
|
*/
|
||||||
@ -1847,6 +1838,10 @@ export type ModuleAttributeSchema = {
|
|||||||
* Defaultvalue
|
* Defaultvalue
|
||||||
*/
|
*/
|
||||||
defaultValue: unknown | null;
|
defaultValue: unknown | null;
|
||||||
|
/**
|
||||||
|
* Defaultoptionid
|
||||||
|
*/
|
||||||
|
defaultOptionId?: number | null;
|
||||||
/**
|
/**
|
||||||
* Description
|
* Description
|
||||||
*/
|
*/
|
||||||
@ -1868,7 +1863,8 @@ export type ModuleAttributeSchema = {
|
|||||||
*/
|
*/
|
||||||
isBuiltIn: boolean;
|
isBuiltIn: boolean;
|
||||||
type: AttributeTypeSchema;
|
type: AttributeTypeSchema;
|
||||||
select: AttributeSelectSchema | null;
|
defaultOption?: AttrOptionSchema | null;
|
||||||
|
select: AttrSelectSchema | null;
|
||||||
/**
|
/**
|
||||||
* Originallabel
|
* Originallabel
|
||||||
*/
|
*/
|
||||||
@ -2454,6 +2450,10 @@ export type UpdateAttributeSchema = {
|
|||||||
* Defaultvalue
|
* Defaultvalue
|
||||||
*/
|
*/
|
||||||
defaultValue?: unknown | null;
|
defaultValue?: unknown | null;
|
||||||
|
/**
|
||||||
|
* Defaultoptionid
|
||||||
|
*/
|
||||||
|
defaultOptionId?: number | null;
|
||||||
/**
|
/**
|
||||||
* Description
|
* Description
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -15,7 +15,6 @@ export const zAddAttributeResponse = z.object({
|
|||||||
export const zAttrOptionSchema = z.object({
|
export const zAttrOptionSchema = z.object({
|
||||||
id: z.int(),
|
id: z.int(),
|
||||||
label: z.string(),
|
label: z.string(),
|
||||||
value: z.unknown(),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -36,14 +35,6 @@ export const zAttributeTypeSchema = z.object({
|
|||||||
name: z.string(),
|
name: z.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* AttributeSelectSchema
|
|
||||||
*/
|
|
||||||
export const zAttributeSelectSchema = z.object({
|
|
||||||
id: z.int(),
|
|
||||||
label: z.string(),
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AttributeSchema
|
* AttributeSchema
|
||||||
*/
|
*/
|
||||||
@ -52,13 +43,15 @@ export const zAttributeSchema = z.object({
|
|||||||
isApplicableToGroup: z.boolean(),
|
isApplicableToGroup: z.boolean(),
|
||||||
isNullable: z.boolean(),
|
isNullable: z.boolean(),
|
||||||
defaultValue: z.union([z.unknown(), z.null()]),
|
defaultValue: z.union([z.unknown(), z.null()]),
|
||||||
|
defaultOptionId: z.optional(z.union([z.int(), z.null()])),
|
||||||
description: z.string(),
|
description: z.string(),
|
||||||
typeId: z.int(),
|
typeId: z.int(),
|
||||||
selectId: z.optional(z.union([z.int(), z.null()])),
|
selectId: z.optional(z.union([z.int(), z.null()])),
|
||||||
id: z.int(),
|
id: z.int(),
|
||||||
isBuiltIn: z.boolean(),
|
isBuiltIn: z.boolean(),
|
||||||
type: zAttributeTypeSchema,
|
type: zAttributeTypeSchema,
|
||||||
select: z.union([zAttributeSelectSchema, z.null()]),
|
defaultOption: z.optional(z.union([zAttrOptionSchema, z.null()])),
|
||||||
|
select: z.union([zAttrSelectSchema, z.null()]),
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,14 +115,14 @@ export const zBoardSchema = z.object({
|
|||||||
* Body_upload_product_barcode_image
|
* Body_upload_product_barcode_image
|
||||||
*/
|
*/
|
||||||
export const zBodyUploadProductBarcodeImage = z.object({
|
export const zBodyUploadProductBarcodeImage = z.object({
|
||||||
upload_file: z.any(),
|
upload_file: z.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Body_upload_product_image
|
* Body_upload_product_image
|
||||||
*/
|
*/
|
||||||
export const zBodyUploadProductImage = z.object({
|
export const zBodyUploadProductImage = z.object({
|
||||||
upload_file: z.any(),
|
upload_file: z.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -162,6 +155,7 @@ export const zCreateAttributeSchema = z.object({
|
|||||||
isApplicableToGroup: z.boolean(),
|
isApplicableToGroup: z.boolean(),
|
||||||
isNullable: z.boolean(),
|
isNullable: z.boolean(),
|
||||||
defaultValue: z.union([z.unknown(), z.null()]),
|
defaultValue: z.union([z.unknown(), z.null()]),
|
||||||
|
defaultOptionId: z.optional(z.union([z.int(), z.null()])),
|
||||||
description: z.string(),
|
description: z.string(),
|
||||||
typeId: z.int(),
|
typeId: z.int(),
|
||||||
selectId: z.optional(z.union([z.int(), z.null()])),
|
selectId: z.optional(z.union([z.int(), z.null()])),
|
||||||
@ -854,7 +848,7 @@ export const zDealModuleAttributeSchema = z.object({
|
|||||||
originalLabel: z.string(),
|
originalLabel: z.string(),
|
||||||
value: z.union([z.unknown(), z.null()]),
|
value: z.union([z.unknown(), z.null()]),
|
||||||
type: zAttributeTypeSchema,
|
type: zAttributeTypeSchema,
|
||||||
select: z.union([zAttributeSelectSchema, z.null()]),
|
select: z.union([zAttrSelectSchema, z.null()]),
|
||||||
defaultValue: z.unknown(),
|
defaultValue: z.unknown(),
|
||||||
description: z.string(),
|
description: z.string(),
|
||||||
isApplicableToGroup: z.boolean(),
|
isApplicableToGroup: z.boolean(),
|
||||||
@ -1053,13 +1047,15 @@ export const zModuleAttributeSchema = z.object({
|
|||||||
isApplicableToGroup: z.boolean(),
|
isApplicableToGroup: z.boolean(),
|
||||||
isNullable: z.boolean(),
|
isNullable: z.boolean(),
|
||||||
defaultValue: z.union([z.unknown(), z.null()]),
|
defaultValue: z.union([z.unknown(), z.null()]),
|
||||||
|
defaultOptionId: z.optional(z.union([z.int(), z.null()])),
|
||||||
description: z.string(),
|
description: z.string(),
|
||||||
typeId: z.int(),
|
typeId: z.int(),
|
||||||
selectId: z.optional(z.union([z.int(), z.null()])),
|
selectId: z.optional(z.union([z.int(), z.null()])),
|
||||||
id: z.int(),
|
id: z.int(),
|
||||||
isBuiltIn: z.boolean(),
|
isBuiltIn: z.boolean(),
|
||||||
type: zAttributeTypeSchema,
|
type: zAttributeTypeSchema,
|
||||||
select: z.union([zAttributeSelectSchema, z.null()]),
|
defaultOption: z.optional(z.union([zAttrOptionSchema, z.null()])),
|
||||||
|
select: z.union([zAttrSelectSchema, z.null()]),
|
||||||
originalLabel: z.string(),
|
originalLabel: z.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1389,6 +1385,7 @@ export const zUpdateAttributeSchema = z.object({
|
|||||||
isApplicableToGroup: z.optional(z.union([z.boolean(), z.null()])),
|
isApplicableToGroup: z.optional(z.union([z.boolean(), z.null()])),
|
||||||
isNullable: z.optional(z.union([z.boolean(), z.null()])),
|
isNullable: z.optional(z.union([z.boolean(), z.null()])),
|
||||||
defaultValue: z.optional(z.union([z.unknown(), z.null()])),
|
defaultValue: z.optional(z.union([z.unknown(), z.null()])),
|
||||||
|
defaultOptionId: z.optional(z.union([z.int(), z.null()])),
|
||||||
description: z.optional(z.union([z.string(), z.null()])),
|
description: z.optional(z.union([z.string(), z.null()])),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user