From 1e7418095f6ba4668987841a527d8b74a891a1aa Mon Sep 17 00:00:00 2001 From: Wu Tianwei <30284043+WTW0313@users.noreply.github.com> Date: Fri, 18 Apr 2025 15:54:22 +0800 Subject: [PATCH] feat/TanStack-Form (#18346) --- .../config-var/config-select/index.spec.tsx | 82 ++++++++++++++++ .../config-var/config-select/index.tsx | 3 +- .../checkbox/assets/indeterminate-icon.tsx | 11 +++ .../components/base/checkbox/assets/mixed.svg | 5 - .../components/base/checkbox/index.module.css | 10 -- .../components/base/checkbox/index.spec.tsx | 67 +++++++++++++ web/app/components/base/checkbox/index.tsx | 49 +++++----- .../base/form/components/field/checkbox.tsx | 43 ++++++++ .../form/components/field/number-input.tsx | 49 ++++++++++ .../base/form/components/field/options.tsx | 34 +++++++ .../base/form/components/field/select.tsx | 51 ++++++++++ .../base/form/components/field/text.tsx | 48 +++++++++ .../form/components/form/submit-button.tsx | 25 +++++ .../base/form/components/label.spec.tsx | 53 ++++++++++ .../components/base/form/components/label.tsx | 48 +++++++++ .../form-scenarios/demo/contact-fields.tsx | 35 +++++++ .../base/form/form-scenarios/demo/index.tsx | 68 +++++++++++++ .../form-scenarios/demo/shared-options.tsx | 14 +++ .../base/form/form-scenarios/demo/types.ts | 34 +++++++ web/app/components/base/form/index.tsx | 25 +++++ .../base/input-number/index.spec.tsx | 97 +++++++++++++++++++ .../components/base/input-number/index.tsx | 42 ++++---- web/app/components/base/input/index.tsx | 2 +- web/app/components/base/param-item/index.tsx | 2 +- web/app/components/base/tooltip/index.tsx | 4 +- .../datasets/create/step-two/inputs.tsx | 4 +- .../documents/detail/completed/index.tsx | 55 +++++------ .../detail/completed/segment-card/index.tsx | 6 +- .../detail/completed/segment-detail.tsx | 9 +- .../detail/completed/segment-list.tsx | 2 +- .../components/datasets/documents/list.tsx | 6 +- .../edit-metadata-batch/input-combined.tsx | 2 +- .../nodes/_base/components/agent-strategy.tsx | 2 +- web/app/dev-preview/page.tsx | 20 ++-- web/jest.config.ts | 13 +-- web/jest.setup.ts | 5 + web/package.json | 1 + web/pnpm-lock.yaml | 60 ++++++++++++ 38 files changed, 959 insertions(+), 127 deletions(-) create mode 100644 web/app/components/app/configuration/config-var/config-select/index.spec.tsx create mode 100644 web/app/components/base/checkbox/assets/indeterminate-icon.tsx delete mode 100644 web/app/components/base/checkbox/assets/mixed.svg delete mode 100644 web/app/components/base/checkbox/index.module.css create mode 100644 web/app/components/base/checkbox/index.spec.tsx create mode 100644 web/app/components/base/form/components/field/checkbox.tsx create mode 100644 web/app/components/base/form/components/field/number-input.tsx create mode 100644 web/app/components/base/form/components/field/options.tsx create mode 100644 web/app/components/base/form/components/field/select.tsx create mode 100644 web/app/components/base/form/components/field/text.tsx create mode 100644 web/app/components/base/form/components/form/submit-button.tsx create mode 100644 web/app/components/base/form/components/label.spec.tsx create mode 100644 web/app/components/base/form/components/label.tsx create mode 100644 web/app/components/base/form/form-scenarios/demo/contact-fields.tsx create mode 100644 web/app/components/base/form/form-scenarios/demo/index.tsx create mode 100644 web/app/components/base/form/form-scenarios/demo/shared-options.tsx create mode 100644 web/app/components/base/form/form-scenarios/demo/types.ts create mode 100644 web/app/components/base/form/index.tsx create mode 100644 web/app/components/base/input-number/index.spec.tsx diff --git a/web/app/components/app/configuration/config-var/config-select/index.spec.tsx b/web/app/components/app/configuration/config-var/config-select/index.spec.tsx new file mode 100644 index 0000000000..18df318de3 --- /dev/null +++ b/web/app/components/app/configuration/config-var/config-select/index.spec.tsx @@ -0,0 +1,82 @@ +import { fireEvent, render, screen } from '@testing-library/react' +import ConfigSelect from './index' + +jest.mock('react-sortablejs', () => ({ + ReactSortable: ({ children }: { children: React.ReactNode }) =>