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 01/54] 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 | 36 ++++--- 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, 956 insertions(+), 124 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 }) =>
{children}
diff --git a/web/app/styles/markdown.scss b/web/app/styles/markdown.scss
index f1f2a7d670..bd9c7343f3 100644
--- a/web/app/styles/markdown.scss
+++ b/web/app/styles/markdown.scss
@@ -1039,3 +1039,6 @@
.markdown-body .react-syntax-highlighter-line-number {
color: var(--color-text-quaternary);
}
+.markdown-body .abcjs-inline-audio .abcjs-btn {
+ display: flex !important;
+}
diff --git a/web/package.json b/web/package.json
index b63617f47b..0dd0b72bc2 100644
--- a/web/package.json
+++ b/web/package.json
@@ -57,6 +57,7 @@
"@tanstack/react-form": "^1.3.3",
"@tanstack/react-query": "^5.60.5",
"@tanstack/react-query-devtools": "^5.60.5",
+ "abcjs": "^6.4.4",
"ahooks": "^3.8.4",
"class-variance-authority": "^0.7.0",
"classnames": "^2.5.1",
diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml
index 28822be807..bf39194eaa 100644
--- a/web/pnpm-lock.yaml
+++ b/web/pnpm-lock.yaml
@@ -103,6 +103,9 @@ importers:
'@tanstack/react-query-devtools':
specifier: ^5.60.5
version: 5.72.2(@tanstack/react-query@5.72.2(react@19.0.0))(react@19.0.0)
+ abcjs:
+ specifier: ^6.4.4
+ version: 6.4.4
ahooks:
specifier: ^3.8.4
version: 3.8.4(react@19.0.0)
@@ -3416,6 +3419,9 @@ packages:
abbrev@1.1.1:
resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==}
+ abcjs@6.4.4:
+ resolution: {integrity: sha512-dT3Z2vb8yihbiPMzSoup0JOcvO2je4qpFNlTD+kS5VBelE3AASAs18dS5qeMWkZeqCz7kI/hz62B2lpMDugWLA==}
+
abort-controller@3.0.0:
resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==}
engines: {node: '>=6.5'}
@@ -12127,6 +12133,8 @@ snapshots:
abbrev@1.1.1:
optional: true
+ abcjs@6.4.4: {}
+
abort-controller@3.0.0:
dependencies:
event-target-shim: 5.0.1
From 93c1ee225e72a40a9be5d8fc84abc096531631db Mon Sep 17 00:00:00 2001
From: crazywoola <100913391+crazywoola@users.noreply.github.com>
Date: Sat, 19 Apr 2025 14:46:10 +0800
Subject: [PATCH 12/54] fix: styles and missing imports (#18396)
---
web/app/components/base/markdown-blocks/music.tsx | 11 ++++++-----
.../workflow/panel/debug-and-preview/index.tsx | 10 +++++-----
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/web/app/components/base/markdown-blocks/music.tsx b/web/app/components/base/markdown-blocks/music.tsx
index aedddf905c..7edd1713c9 100644
--- a/web/app/components/base/markdown-blocks/music.tsx
+++ b/web/app/components/base/markdown-blocks/music.tsx
@@ -9,7 +9,10 @@ const MarkdownMusic = ({ children }: { children: React.ReactNode }) => {
useEffect(() => {
if (containerRef.current && controlsRef.current) {
if (typeof children === 'string') {
- const visualObjs = abcjs.renderAbc(containerRef.current, children)
+ const visualObjs = abcjs.renderAbc(containerRef.current, children, {
+ add_classes: true, // Add classes to SVG elements for cursor tracking
+ responsive: 'resize', // Make notation responsive
+ })
const synthControl = new abcjs.synth.SynthController()
synthControl.load(controlsRef.current, {}, { displayPlay: true })
const synth = new abcjs.synth.CreateSynth()
@@ -23,11 +26,9 @@ const MarkdownMusic = ({ children }: { children: React.ReactNode }) => {
}, [children])
return (
-