From 4e8d2f3cf3b70ca28720f8f3b2ca9ab4f0b8dae8 Mon Sep 17 00:00:00 2001 From: Stepan Date: Thu, 29 Dec 2022 17:04:54 +0300 Subject: [PATCH 1/8] WDS-125 add loading state to select --- .changeset/light-toes-remember.md | 5 ++ packages/ui/etc/api/ui.api.md | 19 +++++ .../ui/src/components/Select/SDropdown.vue | 1 + packages/ui/src/components/Select/SSelect.vue | 1 + .../ui/src/components/Select/SSelectBase.vue | 14 +++- .../src/components/Select/SSelectButton.vue | 2 +- .../src/components/Select/SSelectDropdown.vue | 84 +++++++++++-------- .../ui/src/components/Select/SSelectInput.vue | 2 +- packages/ui/src/components/Select/api.ts | 1 + 9 files changed, 92 insertions(+), 37 deletions(-) create mode 100644 .changeset/light-toes-remember.md diff --git a/.changeset/light-toes-remember.md b/.changeset/light-toes-remember.md new file mode 100644 index 00000000..48626641 --- /dev/null +++ b/.changeset/light-toes-remember.md @@ -0,0 +1,5 @@ +--- +'@soramitsu-ui/ui': patch +--- + +**fix**(`SSelect`): add loading state diff --git a/packages/ui/etc/api/ui.api.md b/packages/ui/etc/api/ui.api.md index b4a2cae6..598cc211 100644 --- a/packages/ui/etc/api/ui.api.md +++ b/packages/ui/etc/api/ui.api.md @@ -471,6 +471,7 @@ label?: string | undefined; size?: SelectSize | undefined; inline?: boolean | undefined; noAutoClose?: boolean | undefined; +loading?: boolean | undefined; }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly[] | SelectOptionGroup[] | undefined; @@ -480,6 +481,7 @@ label?: string | undefined; size?: SelectSize | undefined; inline?: boolean | undefined; noAutoClose?: boolean | undefined; +loading?: boolean | undefined; }>>>, {}>; // @public (undocumented) @@ -495,6 +497,8 @@ export interface SelectApi extends UnwrapRef> { readonly isMenuOpened: boolean; // (undocumented) readonly label: string | null; + // (undocumented) + readonly loading: boolean; menuToggle: (value?: boolean) => void; // (undocumented) readonly multiple: boolean; @@ -992,6 +996,7 @@ multiple?: boolean | undefined; label?: string | undefined; size?: SelectSize | undefined; noAutoClose?: boolean | undefined; +loading?: boolean | undefined; }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly[] | SelectOptionGroup[] | undefined; @@ -1000,6 +1005,7 @@ multiple?: boolean | undefined; label?: string | undefined; size?: SelectSize | undefined; noAutoClose?: boolean | undefined; +loading?: boolean | undefined; }>>>, {}>; // Warning: (ae-forgotten-export) The symbol "__VLS_WithDefaults" needs to be exported by the entry point lib.d.ts @@ -1011,21 +1017,26 @@ disabled?: boolean | undefined; multiple?: boolean | undefined; modelValue?: any; options?: SelectOption[] | SelectOptionGroup[] | undefined; +optionsType?: SelectOptionType | undefined; size?: SelectSize | undefined; label?: string | null | undefined; mandatory?: boolean | undefined; syncMenuAndInputWidths?: boolean | undefined; noAutoClose?: boolean | undefined; +loading?: boolean | undefined; sameWidthPopper?: boolean | undefined; }>, { size: "md"; options: () => never[]; +optionsType: "check"; modelValue: null; multiple: boolean; disabled: boolean; syncMenuAndInputWidths: boolean; noAutoClose: boolean; label: null; +loading: boolean; +sameWidthPopper: boolean; }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, { "update:modelValue": (value: any) => void; }, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly[] | SelectOptionGroup[] | undefined; +optionsType?: SelectOptionType | undefined; size?: SelectSize | undefined; label?: string | null | undefined; mandatory?: boolean | undefined; syncMenuAndInputWidths?: boolean | undefined; noAutoClose?: boolean | undefined; +loading?: boolean | undefined; sameWidthPopper?: boolean | undefined; }>, { size: "md"; options: () => never[]; +optionsType: "check"; modelValue: null; multiple: boolean; disabled: boolean; syncMenuAndInputWidths: boolean; noAutoClose: boolean; label: null; +loading: boolean; +sameWidthPopper: boolean; }>>> & { "onUpdate:modelValue"?: ((value: any) => any) | undefined; }, { @@ -1055,10 +1071,13 @@ modelValue: any; multiple: boolean; size: SelectSize; disabled: boolean; +loading: boolean; options: SelectOption[] | SelectOptionGroup[]; label: string | null; noAutoClose: boolean; +optionsType: SelectOptionType; syncMenuAndInputWidths: boolean; +sameWidthPopper: boolean; }>; // Warning: (ae-forgotten-export) The symbol "__VLS_WithDefaults" needs to be exported by the entry point lib.d.ts diff --git a/packages/ui/src/components/Select/SDropdown.vue b/packages/ui/src/components/Select/SDropdown.vue index 07915bfe..f351acbb 100644 --- a/packages/ui/src/components/Select/SDropdown.vue +++ b/packages/ui/src/components/Select/SDropdown.vue @@ -13,6 +13,7 @@ const props = defineProps<{ size?: SelectSize inline?: boolean noAutoClose?: boolean + loading?: boolean }>() const buttonType = computed(() => (props.inline ? SelectButtonType.Inline : SelectButtonType.Default)) diff --git a/packages/ui/src/components/Select/SSelect.vue b/packages/ui/src/components/Select/SSelect.vue index 806f3c4e..387c24ff 100644 --- a/packages/ui/src/components/Select/SSelect.vue +++ b/packages/ui/src/components/Select/SSelect.vue @@ -12,6 +12,7 @@ defineProps<{ label?: string size?: SelectSize noAutoClose?: boolean + loading?: boolean }>() diff --git a/packages/ui/src/components/Select/SSelectBase.vue b/packages/ui/src/components/Select/SSelectBase.vue index 5457b6d8..1a924c40 100644 --- a/packages/ui/src/components/Select/SSelectBase.vue +++ b/packages/ui/src/components/Select/SSelectBase.vue @@ -1,5 +1,5 @@ diff --git a/packages/ui/src/components/Select/SSelectBase.vue b/packages/ui/src/components/Select/SSelectBase.vue index 1a924c40..80d4be63 100644 --- a/packages/ui/src/components/Select/SSelectBase.vue +++ b/packages/ui/src/components/Select/SSelectBase.vue @@ -1,5 +1,5 @@