From b35c339fb964232759eefae28af528faa71485e6 Mon Sep 17 00:00:00 2001 From: mm <25961416+mlmoravek@users.noreply.github.com> Date: Sat, 7 Oct 2023 15:11:21 +0200 Subject: [PATCH] refactor: input components (#612) * reafactor: update input components to composition-api * reafactor: update dropdown component to composition-api * refactor: dropdown active prop * docs: update component documentations * docs: remove unused inspector classes * chore: remove unnecessary dependency * fix: #513 * fix: #570 * fix: #530 * fix: #516 * fix: #515 --- .../examples/autocomplete/infinite-scroll.vue | 10 +- .../theme/examples/datepicker/base.vue | 2 +- .../theme/examples/datepicker/events.vue | 2 +- .../theme/examples/datepicker/inspector.vue | 36 +- .../examples/datepicker/programmatically.vue | 12 +- .../theme/examples/datepicker/range.vue | 4 +- .../theme/examples/datepicker/slots.vue | 23 +- .../examples/datetimepicker/inspector.vue | 16 +- .../theme/examples/datetimepicker/min-max.vue | 2 - .../theme/examples/dropdown/base.vue | 40 +- .../theme/examples/dropdown/index.vue | 6 + .../theme/examples/dropdown/inspector.vue | 12 +- .../theme/examples/dropdown/multiple.vue | 15 +- .../theme/examples/dropdown/position.vue | 16 +- .../examples/dropdown/programmatically.vue | 26 + .../theme/examples/dropdown/scrollable.vue | 6 +- .../.vitepress/theme/examples/field/base.vue | 6 +- .../.vitepress/theme/examples/input/base.vue | 6 +- .../theme/examples/inputitems/limits.vue | 14 +- .../theme/examples/timepicker/base.vue | 1 - .../theme/examples/timepicker/inspector.vue | 16 +- .../examples/timepicker/min-max-date.vue | 1 + packages/docs-next/.vitepress/theme/index.ts | 54 +- packages/docs-next/components/Autocomplete.md | 125 +- packages/docs-next/components/Button.md | 29 +- packages/docs-next/components/Carousel.md | 40 +- packages/docs-next/components/Checkbox.md | 32 +- packages/docs-next/components/Collapse.md | 8 +- packages/docs-next/components/Datepicker.md | 135 +- .../docs-next/components/Datetimepicker.md | 84 +- packages/docs-next/components/Dropdown.md | 82 +- packages/docs-next/components/Field.md | 25 +- packages/docs-next/components/Icon.md | 27 +- packages/docs-next/components/Input.md | 68 +- packages/docs-next/components/Inputitems.md | 111 +- packages/docs-next/components/Loading.md | 26 +- packages/docs-next/components/Menu.md | 52 +- packages/docs-next/components/Modal.md | 26 +- packages/docs-next/components/Notification.md | 52 +- packages/docs-next/components/Pagination.md | 28 +- packages/docs-next/components/Radio.md | 24 +- packages/docs-next/components/Select.md | 53 +- packages/docs-next/components/Sidebar.md | 24 +- packages/docs-next/components/Skeleton.md | 24 +- packages/docs-next/components/Slider.md | 42 +- packages/docs-next/components/Steps.md | 30 +- packages/docs-next/components/Switch.md | 34 +- packages/docs-next/components/Table.md | 136 +- packages/docs-next/components/Tabs.md | 12 +- packages/docs-next/components/Timepicker.md | 91 +- packages/docs-next/components/Tooltip.md | 20 +- packages/docs-next/components/Upload.md | 43 +- packages/docs-next/docgen.config.js | 88 +- packages/oruga-next/package-lock.json | 232 +- packages/oruga-next/package.json | 7 +- .../components/autocomplete/Autocomplete.vue | 1716 +++++++------- .../src/components/autocomplete/index.ts | 2 +- .../autocomplete/tests/SimpleAutocomplete.vue | 10 +- .../src/components/datepicker/Datepicker.vue | 1968 +++++++---------- .../components/datepicker/DatepickerMixin.ts | 46 - .../components/datepicker/DatepickerMonth.vue | 868 ++++---- .../components/datepicker/DatepickerTable.vue | 669 +++--- .../datepicker/DatepickerTableRow.vue | 787 +++---- .../components/datepicker/PickerWrapper.vue | 266 +++ .../components/datepicker/datepickerUtils.ts | 157 ++ .../src/components/datepicker/index.ts | 4 +- .../datepicker/useDatepickerShare.ts | 182 ++ .../datetimepicker/Datetimepicker.vue | 960 ++++---- .../src/components/datetimepicker/index.ts | 2 +- .../src/components/dropdown/Dropdown.vue | 920 ++++---- .../src/components/dropdown/DropdownItem.vue | 198 +- .../src/components/dropdown/index.ts | 2 +- .../components/dropdown/useDropdownShare.ts | 31 + .../oruga-next/src/components/field/Field.vue | 498 ++--- .../src/components/field/FieldBody.vue | 82 +- .../oruga-next/src/components/field/index.ts | 2 +- .../src/components/field/useFieldShare.ts | 87 + packages/oruga-next/src/components/index.ts | 2 +- .../oruga-next/src/components/input/Input.vue | 704 +++--- .../oruga-next/src/components/input/index.ts | 2 +- .../src/components/inputitems/Inputitems.vue | 850 +++---- packages/oruga-next/src/components/plugins.ts | 2 +- .../src/components/select/Select.vue | 460 ++-- .../oruga-next/src/components/select/index.ts | 2 +- .../src/components/timepicker/Timepicker.vue | 1023 +++++++-- .../src/components/timepicker/index.ts | 2 +- .../timepicker/useTimepickerShare.ts | 243 ++ .../src/components/tooltip/Tooltip.vue | 4 +- .../src/components/upload/Upload.vue | 420 ++-- .../oruga-next/src/components/upload/index.ts | 2 +- packages/oruga-next/src/composables/index.ts | 7 + .../src/composables/useClassProps.ts | 12 + .../src/composables/useComputedClass.ts | 139 ++ .../oruga-next/src/composables/useDebounce.ts | 24 + .../src/composables/useEventListener.ts | 25 + .../src/composables/useInputHandler.ts | 206 ++ .../src/composables/useMatchMedia.ts | 28 + .../src/composables/usePropValue.ts | 109 + .../oruga-next/src/directives/trapFocus.ts | 2 + packages/oruga-next/src/types/config.ts | 26 +- .../oruga-next/src/utils/FormElementMixin.ts | 274 --- packages/oruga-next/src/utils/SharedProps.ts | 10 + .../oruga-next/src/utils/TimepickerMixin.ts | 861 -------- packages/oruga-next/src/utils/helpers.ts | 168 +- packages/oruga-next/src/utils/ssr.ts | 1 + 105 files changed, 8837 insertions(+), 8364 deletions(-) create mode 100644 packages/docs-next/.vitepress/theme/examples/dropdown/programmatically.vue delete mode 100644 packages/oruga-next/src/components/datepicker/DatepickerMixin.ts create mode 100644 packages/oruga-next/src/components/datepicker/PickerWrapper.vue create mode 100644 packages/oruga-next/src/components/datepicker/datepickerUtils.ts create mode 100644 packages/oruga-next/src/components/datepicker/useDatepickerShare.ts create mode 100644 packages/oruga-next/src/components/dropdown/useDropdownShare.ts create mode 100644 packages/oruga-next/src/components/field/useFieldShare.ts create mode 100644 packages/oruga-next/src/components/timepicker/useTimepickerShare.ts create mode 100644 packages/oruga-next/src/composables/index.ts create mode 100644 packages/oruga-next/src/composables/useClassProps.ts create mode 100644 packages/oruga-next/src/composables/useComputedClass.ts create mode 100644 packages/oruga-next/src/composables/useDebounce.ts create mode 100644 packages/oruga-next/src/composables/useEventListener.ts create mode 100644 packages/oruga-next/src/composables/useInputHandler.ts create mode 100644 packages/oruga-next/src/composables/useMatchMedia.ts create mode 100644 packages/oruga-next/src/composables/usePropValue.ts delete mode 100644 packages/oruga-next/src/utils/FormElementMixin.ts create mode 100644 packages/oruga-next/src/utils/SharedProps.ts delete mode 100644 packages/oruga-next/src/utils/TimepickerMixin.ts diff --git a/packages/docs-next/.vitepress/theme/examples/autocomplete/infinite-scroll.vue b/packages/docs-next/.vitepress/theme/examples/autocomplete/infinite-scroll.vue index 2b7b6cdc5..9d4720f9d 100644 --- a/packages/docs-next/.vitepress/theme/examples/autocomplete/infinite-scroll.vue +++ b/packages/docs-next/.vitepress/theme/examples/autocomplete/infinite-scroll.vue @@ -39,6 +39,8 @@ async function getAsyncData(_name) { data.value = [...data.value, ..._data.results]; page.value += 1; totalPages.value = _data.total_pages; + } catch (err) { + console.error(err); } finally { isFetching.value = false; } @@ -57,11 +59,11 @@ function getMoreAsyncData() { placeholder="e.g. Fight Club" field="title" :loading="isFetching" - check-infinite-scroll - :debounce-typing="500" - @typing="getAsyncData" + check-scroll + :debounce="500" + @input="getAsyncData" @select="(option) => (selected = option)" - @infinite-scroll="getMoreAsyncData"> + @scroll-end="getMoreAsyncData"> diff --git a/packages/docs-next/.vitepress/theme/examples/dropdown/position.vue b/packages/docs-next/.vitepress/theme/examples/dropdown/position.vue index 77e7e733e..2dbab3f5a 100644 --- a/packages/docs-next/.vitepress/theme/examples/dropdown/position.vue +++ b/packages/docs-next/.vitepress/theme/examples/dropdown/position.vue @@ -1,7 +1,7 @@