From 894ca4a9c2678debc2e802e286084d6f5f390bed Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Tue, 5 Oct 2021 17:17:04 +0200 Subject: [PATCH] feat(admin-ui): Add empty option for nullable custom field selects Relates to #1083 --- .../lib/core/src/common/generated-types.ts | 46 ++++++++++++++----- .../data/definitions/settings-definitions.ts | 1 + .../select-form-input.component.html | 1 + .../select-form-input.component.ts | 5 +- 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/packages/admin-ui/src/lib/core/src/common/generated-types.ts b/packages/admin-ui/src/lib/core/src/common/generated-types.ts index 61f3736e64..499f00200d 100644 --- a/packages/admin-ui/src/lib/core/src/common/generated-types.ts +++ b/packages/admin-ui/src/lib/core/src/common/generated-types.ts @@ -258,6 +258,7 @@ export type BooleanCustomFieldConfig = CustomField & { description?: Maybe>; readonly?: Maybe; internal?: Maybe; + nullable?: Maybe; }; export type BooleanOperators = { @@ -646,13 +647,17 @@ export type CreatePaymentMethodInput = { handler: ConfigurableOperationInput; }; +export type CreateProductCustomFieldsInput = { + coffeeProfileWithMilk?: Maybe; +}; + export type CreateProductInput = { featuredAssetId?: Maybe; enabled?: Maybe; assetIds?: Maybe>; facetValueIds?: Maybe>; translations: Array; - customFields?: Maybe; + customFields?: Maybe; }; export type CreateProductOptionGroupInput = { @@ -1097,6 +1102,7 @@ export type CustomField = { description?: Maybe>; readonly?: Maybe; internal?: Maybe; + nullable?: Maybe; }; export type CustomFieldConfig = StringCustomFieldConfig | LocaleStringCustomFieldConfig | IntCustomFieldConfig | FloatCustomFieldConfig | BooleanCustomFieldConfig | DateTimeCustomFieldConfig | RelationCustomFieldConfig | TextCustomFieldConfig; @@ -1251,6 +1257,7 @@ export type DateTimeCustomFieldConfig = CustomField & { description?: Maybe>; readonly?: Maybe; internal?: Maybe; + nullable?: Maybe; min?: Maybe; max?: Maybe; step?: Maybe; @@ -1467,6 +1474,7 @@ export type FloatCustomFieldConfig = CustomField & { description?: Maybe>; readonly?: Maybe; internal?: Maybe; + nullable?: Maybe; min?: Maybe; max?: Maybe; step?: Maybe; @@ -1620,6 +1628,7 @@ export type IntCustomFieldConfig = CustomField & { description?: Maybe>; readonly?: Maybe; internal?: Maybe; + nullable?: Maybe; min?: Maybe; max?: Maybe; step?: Maybe; @@ -2069,6 +2078,7 @@ export type LocaleStringCustomFieldConfig = CustomField & { description?: Maybe>; readonly?: Maybe; internal?: Maybe; + nullable?: Maybe; pattern?: Maybe; }; @@ -3593,7 +3603,7 @@ export type Product = Node & { facetValues: Array; translations: Array; collections: Array; - customFields?: Maybe; + customFields?: Maybe; }; @@ -3601,6 +3611,11 @@ export type ProductVariantListArgs = { options?: Maybe; }; +export type ProductCustomFields = { + __typename?: 'ProductCustomFields'; + coffeeProfileWithMilk?: Maybe; +}; + export type ProductFilterParameter = { enabled?: Maybe; createdAt?: Maybe; @@ -3609,6 +3624,7 @@ export type ProductFilterParameter = { name?: Maybe; slug?: Maybe; description?: Maybe; + coffeeProfileWithMilk?: Maybe; }; export type ProductList = PaginatedList & { @@ -3698,6 +3714,7 @@ export type ProductSortParameter = { name?: Maybe; slug?: Maybe; description?: Maybe; + coffeeProfileWithMilk?: Maybe; }; export type ProductTranslation = { @@ -4232,6 +4249,7 @@ export type RelationCustomFieldConfig = CustomField & { description?: Maybe>; readonly?: Maybe; internal?: Maybe; + nullable?: Maybe; entity: Scalars['String']; scalarFields: Array; }; @@ -4566,6 +4584,7 @@ export type StringCustomFieldConfig = CustomField & { description?: Maybe>; readonly?: Maybe; internal?: Maybe; + nullable?: Maybe; pattern?: Maybe; options?: Maybe>; }; @@ -4744,6 +4763,7 @@ export type TextCustomFieldConfig = CustomField & { description?: Maybe>; readonly?: Maybe; internal?: Maybe; + nullable?: Maybe; }; export type TransitionFulfillmentToStateResult = Fulfillment | FulfillmentStateTransitionError; @@ -4921,6 +4941,10 @@ export type UpdatePaymentMethodInput = { handler?: Maybe; }; +export type UpdateProductCustomFieldsInput = { + coffeeProfileWithMilk?: Maybe; +}; + export type UpdateProductInput = { id: Scalars['ID']; enabled?: Maybe; @@ -4928,7 +4952,7 @@ export type UpdateProductInput = { assetIds?: Maybe>; facetValueIds?: Maybe>; translations?: Maybe>; - customFields?: Maybe; + customFields?: Maybe; }; export type UpdateProductOptionGroupInput = { @@ -7556,7 +7580,7 @@ export type UpdateGlobalSettingsMutation = { updateGlobalSettings: ( type CustomFieldConfig_BooleanCustomFieldConfig_Fragment = ( { __typename?: 'BooleanCustomFieldConfig' } - & Pick + & Pick & { description?: Maybe @@ -7568,7 +7592,7 @@ type CustomFieldConfig_BooleanCustomFieldConfig_Fragment = ( type CustomFieldConfig_DateTimeCustomFieldConfig_Fragment = ( { __typename?: 'DateTimeCustomFieldConfig' } - & Pick + & Pick & { description?: Maybe @@ -7580,7 +7604,7 @@ type CustomFieldConfig_DateTimeCustomFieldConfig_Fragment = ( type CustomFieldConfig_FloatCustomFieldConfig_Fragment = ( { __typename?: 'FloatCustomFieldConfig' } - & Pick + & Pick & { description?: Maybe @@ -7592,7 +7616,7 @@ type CustomFieldConfig_FloatCustomFieldConfig_Fragment = ( type CustomFieldConfig_IntCustomFieldConfig_Fragment = ( { __typename?: 'IntCustomFieldConfig' } - & Pick + & Pick & { description?: Maybe @@ -7604,7 +7628,7 @@ type CustomFieldConfig_IntCustomFieldConfig_Fragment = ( type CustomFieldConfig_LocaleStringCustomFieldConfig_Fragment = ( { __typename?: 'LocaleStringCustomFieldConfig' } - & Pick + & Pick & { description?: Maybe @@ -7616,7 +7640,7 @@ type CustomFieldConfig_LocaleStringCustomFieldConfig_Fragment = ( type CustomFieldConfig_RelationCustomFieldConfig_Fragment = ( { __typename?: 'RelationCustomFieldConfig' } - & Pick + & Pick & { description?: Maybe @@ -7628,7 +7652,7 @@ type CustomFieldConfig_RelationCustomFieldConfig_Fragment = ( type CustomFieldConfig_StringCustomFieldConfig_Fragment = ( { __typename?: 'StringCustomFieldConfig' } - & Pick + & Pick & { description?: Maybe @@ -7640,7 +7664,7 @@ type CustomFieldConfig_StringCustomFieldConfig_Fragment = ( type CustomFieldConfig_TextCustomFieldConfig_Fragment = ( { __typename?: 'TextCustomFieldConfig' } - & Pick + & Pick & { description?: Maybe diff --git a/packages/admin-ui/src/lib/core/src/data/definitions/settings-definitions.ts b/packages/admin-ui/src/lib/core/src/data/definitions/settings-definitions.ts index dc74d363e1..ad494a679c 100644 --- a/packages/admin-ui/src/lib/core/src/data/definitions/settings-definitions.ts +++ b/packages/admin-ui/src/lib/core/src/data/definitions/settings-definitions.ts @@ -506,6 +506,7 @@ export const CUSTOM_FIELD_CONFIG_FRAGMENT = gql` value } readonly + nullable } `; diff --git a/packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/select-form-input/select-form-input.component.html b/packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/select-form-input/select-form-input.component.html index 0b30bc7765..1b630e29ea 100644 --- a/packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/select-form-input/select-form-input.component.html +++ b/packages/admin-ui/src/lib/core/src/shared/dynamic-form-inputs/select-form-input/select-form-input.component.html @@ -1,4 +1,5 @@