balibabu
commited on
Commit
·
7f9c7e1
1
Parent(s):
b371a08
Feat: Add MultiSelect #3221 (#4090)
Browse files### What problem does this PR solve?
Feat: Add MultiSelect #3221
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
- web/package-lock.json +249 -12
- web/package.json +2 -0
- web/src/components/ui/command.tsx +153 -0
- web/src/components/ui/dialog.tsx +122 -0
- web/src/components/ui/multi-select.tsx +381 -0
- web/src/pages/dataset/setting/advanced-setting-form.tsx +11 -9
- web/src/pages/dataset/setting/basic-setting-form.tsx +57 -68
- web/src/pages/dataset/setting/chunk-method-card.tsx +124 -0
- web/src/pages/dataset/setting/index.less +45 -0
- web/src/pages/dataset/setting/index.tsx +1 -3
- web/src/pages/dataset/setting/utils.ts +19 -0
- web/src/pages/profile-setting/sidebar/index.tsx +7 -2
web/package-lock.json
CHANGED
@@ -16,6 +16,7 @@
|
|
16 |
"@radix-ui/react-aspect-ratio": "^1.1.0",
|
17 |
"@radix-ui/react-avatar": "^1.1.1",
|
18 |
"@radix-ui/react-checkbox": "^1.1.2",
|
|
|
19 |
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
20 |
"@radix-ui/react-icons": "^1.3.1",
|
21 |
"@radix-ui/react-label": "^2.1.0",
|
@@ -40,6 +41,7 @@
|
|
40 |
"class-variance-authority": "^0.7.0",
|
41 |
"classnames": "^2.5.1",
|
42 |
"clsx": "^2.1.1",
|
|
|
43 |
"dayjs": "^1.11.10",
|
44 |
"dompurify": "^3.1.6",
|
45 |
"eventsource-parser": "^1.1.2",
|
@@ -4240,6 +4242,219 @@
|
|
4240 |
}
|
4241 |
}
|
4242 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4243 |
"node_modules/@radix-ui/react-direction": {
|
4244 |
"version": "1.1.0",
|
4245 |
"resolved": "https://registry.npmmirror.com/@radix-ui/react-direction/-/react-direction-1.1.0.tgz",
|
@@ -10672,6 +10887,29 @@
|
|
10672 |
"node": ">=6"
|
10673 |
}
|
10674 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10675 |
"node_modules/co": {
|
10676 |
"version": "4.6.0",
|
10677 |
"resolved": "https://registry.npmmirror.com/co/-/co-4.6.0.tgz",
|
@@ -25069,19 +25307,19 @@
|
|
25069 |
}
|
25070 |
},
|
25071 |
"node_modules/react-remove-scroll-bar": {
|
25072 |
-
"version": "2.3.
|
25073 |
-
"resolved": "https://registry.npmmirror.com/react-remove-scroll-bar/-/react-remove-scroll-bar-2.3.
|
25074 |
-
"integrity": "sha512-
|
25075 |
"dependencies": {
|
25076 |
-
"react-style-singleton": "^2.2.
|
25077 |
"tslib": "^2.0.0"
|
25078 |
},
|
25079 |
"engines": {
|
25080 |
"node": ">=10"
|
25081 |
},
|
25082 |
"peerDependencies": {
|
25083 |
-
"@types/react": "
|
25084 |
-
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
25085 |
},
|
25086 |
"peerDependenciesMeta": {
|
25087 |
"@types/react": {
|
@@ -25229,20 +25467,19 @@
|
|
25229 |
}
|
25230 |
},
|
25231 |
"node_modules/react-style-singleton": {
|
25232 |
-
"version": "2.2.
|
25233 |
-
"resolved": "https://registry.npmmirror.com/react-style-singleton/-/react-style-singleton-2.2.
|
25234 |
-
"integrity": "sha512-
|
25235 |
"dependencies": {
|
25236 |
"get-nonce": "^1.0.0",
|
25237 |
-
"invariant": "^2.2.4",
|
25238 |
"tslib": "^2.0.0"
|
25239 |
},
|
25240 |
"engines": {
|
25241 |
"node": ">=10"
|
25242 |
},
|
25243 |
"peerDependencies": {
|
25244 |
-
"@types/react": "
|
25245 |
-
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
25246 |
},
|
25247 |
"peerDependenciesMeta": {
|
25248 |
"@types/react": {
|
|
|
16 |
"@radix-ui/react-aspect-ratio": "^1.1.0",
|
17 |
"@radix-ui/react-avatar": "^1.1.1",
|
18 |
"@radix-ui/react-checkbox": "^1.1.2",
|
19 |
+
"@radix-ui/react-dialog": "^1.1.4",
|
20 |
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
21 |
"@radix-ui/react-icons": "^1.3.1",
|
22 |
"@radix-ui/react-label": "^2.1.0",
|
|
|
41 |
"class-variance-authority": "^0.7.0",
|
42 |
"classnames": "^2.5.1",
|
43 |
"clsx": "^2.1.1",
|
44 |
+
"cmdk": "^1.0.4",
|
45 |
"dayjs": "^1.11.10",
|
46 |
"dompurify": "^3.1.6",
|
47 |
"eventsource-parser": "^1.1.2",
|
|
|
4242 |
}
|
4243 |
}
|
4244 |
},
|
4245 |
+
"node_modules/@radix-ui/react-dialog": {
|
4246 |
+
"version": "1.1.4",
|
4247 |
+
"resolved": "https://registry.npmmirror.com/@radix-ui/react-dialog/-/react-dialog-1.1.4.tgz",
|
4248 |
+
"integrity": "sha512-Ur7EV1IwQGCyaAuyDRiOLA5JIUZxELJljF+MbM/2NC0BYwfuRrbpS30BiQBJrVruscgUkieKkqXYDOoByaxIoA==",
|
4249 |
+
"dependencies": {
|
4250 |
+
"@radix-ui/primitive": "1.1.1",
|
4251 |
+
"@radix-ui/react-compose-refs": "1.1.1",
|
4252 |
+
"@radix-ui/react-context": "1.1.1",
|
4253 |
+
"@radix-ui/react-dismissable-layer": "1.1.3",
|
4254 |
+
"@radix-ui/react-focus-guards": "1.1.1",
|
4255 |
+
"@radix-ui/react-focus-scope": "1.1.1",
|
4256 |
+
"@radix-ui/react-id": "1.1.0",
|
4257 |
+
"@radix-ui/react-portal": "1.1.3",
|
4258 |
+
"@radix-ui/react-presence": "1.1.2",
|
4259 |
+
"@radix-ui/react-primitive": "2.0.1",
|
4260 |
+
"@radix-ui/react-slot": "1.1.1",
|
4261 |
+
"@radix-ui/react-use-controllable-state": "1.1.0",
|
4262 |
+
"aria-hidden": "^1.1.1",
|
4263 |
+
"react-remove-scroll": "^2.6.1"
|
4264 |
+
},
|
4265 |
+
"peerDependencies": {
|
4266 |
+
"@types/react": "*",
|
4267 |
+
"@types/react-dom": "*",
|
4268 |
+
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
4269 |
+
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
4270 |
+
},
|
4271 |
+
"peerDependenciesMeta": {
|
4272 |
+
"@types/react": {
|
4273 |
+
"optional": true
|
4274 |
+
},
|
4275 |
+
"@types/react-dom": {
|
4276 |
+
"optional": true
|
4277 |
+
}
|
4278 |
+
}
|
4279 |
+
},
|
4280 |
+
"node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive": {
|
4281 |
+
"version": "1.1.1",
|
4282 |
+
"resolved": "https://registry.npmmirror.com/@radix-ui/primitive/-/primitive-1.1.1.tgz",
|
4283 |
+
"integrity": "sha512-SJ31y+Q/zAyShtXJc8x83i9TYdbAfHZ++tUZnvjJJqFjzsdUnKsxPL6IEtBlxKkU7yzer//GQtZSV4GbldL3YA=="
|
4284 |
+
},
|
4285 |
+
"node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs": {
|
4286 |
+
"version": "1.1.1",
|
4287 |
+
"resolved": "https://registry.npmmirror.com/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.1.tgz",
|
4288 |
+
"integrity": "sha512-Y9VzoRDSJtgFMUCoiZBDVo084VQ5hfpXxVE+NgkdNsjiDBByiImMZKKhxMwCbdHvhlENG6a833CbFkOQvTricw==",
|
4289 |
+
"peerDependencies": {
|
4290 |
+
"@types/react": "*",
|
4291 |
+
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
4292 |
+
},
|
4293 |
+
"peerDependenciesMeta": {
|
4294 |
+
"@types/react": {
|
4295 |
+
"optional": true
|
4296 |
+
}
|
4297 |
+
}
|
4298 |
+
},
|
4299 |
+
"node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer": {
|
4300 |
+
"version": "1.1.3",
|
4301 |
+
"resolved": "https://registry.npmmirror.com/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.3.tgz",
|
4302 |
+
"integrity": "sha512-onrWn/72lQoEucDmJnr8uczSNTujT0vJnA/X5+3AkChVPowr8n1yvIKIabhWyMQeMvvmdpsvcyDqx3X1LEXCPg==",
|
4303 |
+
"dependencies": {
|
4304 |
+
"@radix-ui/primitive": "1.1.1",
|
4305 |
+
"@radix-ui/react-compose-refs": "1.1.1",
|
4306 |
+
"@radix-ui/react-primitive": "2.0.1",
|
4307 |
+
"@radix-ui/react-use-callback-ref": "1.1.0",
|
4308 |
+
"@radix-ui/react-use-escape-keydown": "1.1.0"
|
4309 |
+
},
|
4310 |
+
"peerDependencies": {
|
4311 |
+
"@types/react": "*",
|
4312 |
+
"@types/react-dom": "*",
|
4313 |
+
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
4314 |
+
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
4315 |
+
},
|
4316 |
+
"peerDependenciesMeta": {
|
4317 |
+
"@types/react": {
|
4318 |
+
"optional": true
|
4319 |
+
},
|
4320 |
+
"@types/react-dom": {
|
4321 |
+
"optional": true
|
4322 |
+
}
|
4323 |
+
}
|
4324 |
+
},
|
4325 |
+
"node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-focus-scope": {
|
4326 |
+
"version": "1.1.1",
|
4327 |
+
"resolved": "https://registry.npmmirror.com/@radix-ui/react-focus-scope/-/react-focus-scope-1.1.1.tgz",
|
4328 |
+
"integrity": "sha512-01omzJAYRxXdG2/he/+xy+c8a8gCydoQ1yOxnWNcRhrrBW5W+RQJ22EK1SaO8tb3WoUsuEw7mJjBozPzihDFjA==",
|
4329 |
+
"dependencies": {
|
4330 |
+
"@radix-ui/react-compose-refs": "1.1.1",
|
4331 |
+
"@radix-ui/react-primitive": "2.0.1",
|
4332 |
+
"@radix-ui/react-use-callback-ref": "1.1.0"
|
4333 |
+
},
|
4334 |
+
"peerDependencies": {
|
4335 |
+
"@types/react": "*",
|
4336 |
+
"@types/react-dom": "*",
|
4337 |
+
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
4338 |
+
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
4339 |
+
},
|
4340 |
+
"peerDependenciesMeta": {
|
4341 |
+
"@types/react": {
|
4342 |
+
"optional": true
|
4343 |
+
},
|
4344 |
+
"@types/react-dom": {
|
4345 |
+
"optional": true
|
4346 |
+
}
|
4347 |
+
}
|
4348 |
+
},
|
4349 |
+
"node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal": {
|
4350 |
+
"version": "1.1.3",
|
4351 |
+
"resolved": "https://registry.npmmirror.com/@radix-ui/react-portal/-/react-portal-1.1.3.tgz",
|
4352 |
+
"integrity": "sha512-NciRqhXnGojhT93RPyDaMPfLH3ZSl4jjIFbZQ1b/vxvZEdHsBZ49wP9w8L3HzUQwep01LcWtkUvm0OVB5JAHTw==",
|
4353 |
+
"dependencies": {
|
4354 |
+
"@radix-ui/react-primitive": "2.0.1",
|
4355 |
+
"@radix-ui/react-use-layout-effect": "1.1.0"
|
4356 |
+
},
|
4357 |
+
"peerDependencies": {
|
4358 |
+
"@types/react": "*",
|
4359 |
+
"@types/react-dom": "*",
|
4360 |
+
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
4361 |
+
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
4362 |
+
},
|
4363 |
+
"peerDependenciesMeta": {
|
4364 |
+
"@types/react": {
|
4365 |
+
"optional": true
|
4366 |
+
},
|
4367 |
+
"@types/react-dom": {
|
4368 |
+
"optional": true
|
4369 |
+
}
|
4370 |
+
}
|
4371 |
+
},
|
4372 |
+
"node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence": {
|
4373 |
+
"version": "1.1.2",
|
4374 |
+
"resolved": "https://registry.npmmirror.com/@radix-ui/react-presence/-/react-presence-1.1.2.tgz",
|
4375 |
+
"integrity": "sha512-18TFr80t5EVgL9x1SwF/YGtfG+l0BS0PRAlCWBDoBEiDQjeKgnNZRVJp/oVBl24sr3Gbfwc/Qpj4OcWTQMsAEg==",
|
4376 |
+
"dependencies": {
|
4377 |
+
"@radix-ui/react-compose-refs": "1.1.1",
|
4378 |
+
"@radix-ui/react-use-layout-effect": "1.1.0"
|
4379 |
+
},
|
4380 |
+
"peerDependencies": {
|
4381 |
+
"@types/react": "*",
|
4382 |
+
"@types/react-dom": "*",
|
4383 |
+
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
4384 |
+
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
4385 |
+
},
|
4386 |
+
"peerDependenciesMeta": {
|
4387 |
+
"@types/react": {
|
4388 |
+
"optional": true
|
4389 |
+
},
|
4390 |
+
"@types/react-dom": {
|
4391 |
+
"optional": true
|
4392 |
+
}
|
4393 |
+
}
|
4394 |
+
},
|
4395 |
+
"node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive": {
|
4396 |
+
"version": "2.0.1",
|
4397 |
+
"resolved": "https://registry.npmmirror.com/@radix-ui/react-primitive/-/react-primitive-2.0.1.tgz",
|
4398 |
+
"integrity": "sha512-sHCWTtxwNn3L3fH8qAfnF3WbUZycW93SM1j3NFDzXBiz8D6F5UTTy8G1+WFEaiCdvCVRJWj6N2R4Xq6HdiHmDg==",
|
4399 |
+
"dependencies": {
|
4400 |
+
"@radix-ui/react-slot": "1.1.1"
|
4401 |
+
},
|
4402 |
+
"peerDependencies": {
|
4403 |
+
"@types/react": "*",
|
4404 |
+
"@types/react-dom": "*",
|
4405 |
+
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
4406 |
+
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
4407 |
+
},
|
4408 |
+
"peerDependenciesMeta": {
|
4409 |
+
"@types/react": {
|
4410 |
+
"optional": true
|
4411 |
+
},
|
4412 |
+
"@types/react-dom": {
|
4413 |
+
"optional": true
|
4414 |
+
}
|
4415 |
+
}
|
4416 |
+
},
|
4417 |
+
"node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-slot": {
|
4418 |
+
"version": "1.1.1",
|
4419 |
+
"resolved": "https://registry.npmmirror.com/@radix-ui/react-slot/-/react-slot-1.1.1.tgz",
|
4420 |
+
"integrity": "sha512-RApLLOcINYJA+dMVbOju7MYv1Mb2EBp2nH4HdDzXTSyaR5optlm6Otrz1euW3HbdOR8UmmFK06TD+A9frYWv+g==",
|
4421 |
+
"dependencies": {
|
4422 |
+
"@radix-ui/react-compose-refs": "1.1.1"
|
4423 |
+
},
|
4424 |
+
"peerDependencies": {
|
4425 |
+
"@types/react": "*",
|
4426 |
+
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
4427 |
+
},
|
4428 |
+
"peerDependenciesMeta": {
|
4429 |
+
"@types/react": {
|
4430 |
+
"optional": true
|
4431 |
+
}
|
4432 |
+
}
|
4433 |
+
},
|
4434 |
+
"node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll": {
|
4435 |
+
"version": "2.6.1",
|
4436 |
+
"resolved": "https://registry.npmmirror.com/react-remove-scroll/-/react-remove-scroll-2.6.1.tgz",
|
4437 |
+
"integrity": "sha512-jWEvWQidZ/C/FnFlUIB1mDLpY3r7uEb22WZ3uVeKj520caKDiaBsNDEB9J1gHJgpiLo+eTdPl2MVi0JitFTiFg==",
|
4438 |
+
"dependencies": {
|
4439 |
+
"react-remove-scroll-bar": "^2.3.7",
|
4440 |
+
"react-style-singleton": "^2.2.1",
|
4441 |
+
"tslib": "^2.1.0",
|
4442 |
+
"use-callback-ref": "^1.3.0",
|
4443 |
+
"use-sidecar": "^1.1.2"
|
4444 |
+
},
|
4445 |
+
"engines": {
|
4446 |
+
"node": ">=10"
|
4447 |
+
},
|
4448 |
+
"peerDependencies": {
|
4449 |
+
"@types/react": "*",
|
4450 |
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
|
4451 |
+
},
|
4452 |
+
"peerDependenciesMeta": {
|
4453 |
+
"@types/react": {
|
4454 |
+
"optional": true
|
4455 |
+
}
|
4456 |
+
}
|
4457 |
+
},
|
4458 |
"node_modules/@radix-ui/react-direction": {
|
4459 |
"version": "1.1.0",
|
4460 |
"resolved": "https://registry.npmmirror.com/@radix-ui/react-direction/-/react-direction-1.1.0.tgz",
|
|
|
10887 |
"node": ">=6"
|
10888 |
}
|
10889 |
},
|
10890 |
+
"node_modules/cmdk": {
|
10891 |
+
"version": "1.0.4",
|
10892 |
+
"resolved": "https://registry.npmmirror.com/cmdk/-/cmdk-1.0.4.tgz",
|
10893 |
+
"integrity": "sha512-AnsjfHyHpQ/EFeAnG216WY7A5LiYCoZzCSygiLvfXC3H3LFGCprErteUcszaVluGOhuOTbJS3jWHrSDYPBBygg==",
|
10894 |
+
"dependencies": {
|
10895 |
+
"@radix-ui/react-dialog": "^1.1.2",
|
10896 |
+
"@radix-ui/react-id": "^1.1.0",
|
10897 |
+
"@radix-ui/react-primitive": "^2.0.0",
|
10898 |
+
"use-sync-external-store": "^1.2.2"
|
10899 |
+
},
|
10900 |
+
"peerDependencies": {
|
10901 |
+
"react": "^18 || ^19 || ^19.0.0-rc",
|
10902 |
+
"react-dom": "^18 || ^19 || ^19.0.0-rc"
|
10903 |
+
}
|
10904 |
+
},
|
10905 |
+
"node_modules/cmdk/node_modules/use-sync-external-store": {
|
10906 |
+
"version": "1.4.0",
|
10907 |
+
"resolved": "https://registry.npmmirror.com/use-sync-external-store/-/use-sync-external-store-1.4.0.tgz",
|
10908 |
+
"integrity": "sha512-9WXSPC5fMv61vaupRkCKCxsPxBocVnwakBEkMIHHpkTTg6icbJtg6jzgtLDm4bl3cSHAca52rYWih0k4K3PfHw==",
|
10909 |
+
"peerDependencies": {
|
10910 |
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
10911 |
+
}
|
10912 |
+
},
|
10913 |
"node_modules/co": {
|
10914 |
"version": "4.6.0",
|
10915 |
"resolved": "https://registry.npmmirror.com/co/-/co-4.6.0.tgz",
|
|
|
25307 |
}
|
25308 |
},
|
25309 |
"node_modules/react-remove-scroll-bar": {
|
25310 |
+
"version": "2.3.8",
|
25311 |
+
"resolved": "https://registry.npmmirror.com/react-remove-scroll-bar/-/react-remove-scroll-bar-2.3.8.tgz",
|
25312 |
+
"integrity": "sha512-9r+yi9+mgU33AKcj6IbT9oRCO78WriSj6t/cF8DWBZJ9aOGPOTEDvdUDz1FwKim7QXWwmHqtdHnRJfhAxEG46Q==",
|
25313 |
"dependencies": {
|
25314 |
+
"react-style-singleton": "^2.2.2",
|
25315 |
"tslib": "^2.0.0"
|
25316 |
},
|
25317 |
"engines": {
|
25318 |
"node": ">=10"
|
25319 |
},
|
25320 |
"peerDependencies": {
|
25321 |
+
"@types/react": "*",
|
25322 |
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
25323 |
},
|
25324 |
"peerDependenciesMeta": {
|
25325 |
"@types/react": {
|
|
|
25467 |
}
|
25468 |
},
|
25469 |
"node_modules/react-style-singleton": {
|
25470 |
+
"version": "2.2.3",
|
25471 |
+
"resolved": "https://registry.npmmirror.com/react-style-singleton/-/react-style-singleton-2.2.3.tgz",
|
25472 |
+
"integrity": "sha512-b6jSvxvVnyptAiLjbkWLE/lOnR4lfTtDAl+eUC7RZy+QQWc6wRzIV2CE6xBuMmDxc2qIihtDCZD5NPOFl7fRBQ==",
|
25473 |
"dependencies": {
|
25474 |
"get-nonce": "^1.0.0",
|
|
|
25475 |
"tslib": "^2.0.0"
|
25476 |
},
|
25477 |
"engines": {
|
25478 |
"node": ">=10"
|
25479 |
},
|
25480 |
"peerDependencies": {
|
25481 |
+
"@types/react": "*",
|
25482 |
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
|
25483 |
},
|
25484 |
"peerDependenciesMeta": {
|
25485 |
"@types/react": {
|
web/package.json
CHANGED
@@ -27,6 +27,7 @@
|
|
27 |
"@radix-ui/react-aspect-ratio": "^1.1.0",
|
28 |
"@radix-ui/react-avatar": "^1.1.1",
|
29 |
"@radix-ui/react-checkbox": "^1.1.2",
|
|
|
30 |
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
31 |
"@radix-ui/react-icons": "^1.3.1",
|
32 |
"@radix-ui/react-label": "^2.1.0",
|
@@ -51,6 +52,7 @@
|
|
51 |
"class-variance-authority": "^0.7.0",
|
52 |
"classnames": "^2.5.1",
|
53 |
"clsx": "^2.1.1",
|
|
|
54 |
"dayjs": "^1.11.10",
|
55 |
"dompurify": "^3.1.6",
|
56 |
"eventsource-parser": "^1.1.2",
|
|
|
27 |
"@radix-ui/react-aspect-ratio": "^1.1.0",
|
28 |
"@radix-ui/react-avatar": "^1.1.1",
|
29 |
"@radix-ui/react-checkbox": "^1.1.2",
|
30 |
+
"@radix-ui/react-dialog": "^1.1.4",
|
31 |
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
32 |
"@radix-ui/react-icons": "^1.3.1",
|
33 |
"@radix-ui/react-label": "^2.1.0",
|
|
|
52 |
"class-variance-authority": "^0.7.0",
|
53 |
"classnames": "^2.5.1",
|
54 |
"clsx": "^2.1.1",
|
55 |
+
"cmdk": "^1.0.4",
|
56 |
"dayjs": "^1.11.10",
|
57 |
"dompurify": "^3.1.6",
|
58 |
"eventsource-parser": "^1.1.2",
|
web/src/components/ui/command.tsx
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use client';
|
2 |
+
|
3 |
+
import { type DialogProps } from '@radix-ui/react-dialog';
|
4 |
+
import { Command as CommandPrimitive } from 'cmdk';
|
5 |
+
import { Search } from 'lucide-react';
|
6 |
+
import * as React from 'react';
|
7 |
+
|
8 |
+
import { Dialog, DialogContent } from '@/components/ui/dialog';
|
9 |
+
import { cn } from '@/lib/utils';
|
10 |
+
|
11 |
+
const Command = React.forwardRef<
|
12 |
+
React.ElementRef<typeof CommandPrimitive>,
|
13 |
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive>
|
14 |
+
>(({ className, ...props }, ref) => (
|
15 |
+
<CommandPrimitive
|
16 |
+
ref={ref}
|
17 |
+
className={cn(
|
18 |
+
'flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground',
|
19 |
+
className,
|
20 |
+
)}
|
21 |
+
{...props}
|
22 |
+
/>
|
23 |
+
));
|
24 |
+
Command.displayName = CommandPrimitive.displayName;
|
25 |
+
|
26 |
+
const CommandDialog = ({ children, ...props }: DialogProps) => {
|
27 |
+
return (
|
28 |
+
<Dialog {...props}>
|
29 |
+
<DialogContent className="overflow-hidden p-0 shadow-lg">
|
30 |
+
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
31 |
+
{children}
|
32 |
+
</Command>
|
33 |
+
</DialogContent>
|
34 |
+
</Dialog>
|
35 |
+
);
|
36 |
+
};
|
37 |
+
|
38 |
+
const CommandInput = React.forwardRef<
|
39 |
+
React.ElementRef<typeof CommandPrimitive.Input>,
|
40 |
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
|
41 |
+
>(({ className, ...props }, ref) => (
|
42 |
+
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
|
43 |
+
<Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
|
44 |
+
<CommandPrimitive.Input
|
45 |
+
ref={ref}
|
46 |
+
className={cn(
|
47 |
+
'flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',
|
48 |
+
className,
|
49 |
+
)}
|
50 |
+
{...props}
|
51 |
+
/>
|
52 |
+
</div>
|
53 |
+
));
|
54 |
+
|
55 |
+
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
56 |
+
|
57 |
+
const CommandList = React.forwardRef<
|
58 |
+
React.ElementRef<typeof CommandPrimitive.List>,
|
59 |
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
|
60 |
+
>(({ className, ...props }, ref) => (
|
61 |
+
<CommandPrimitive.List
|
62 |
+
ref={ref}
|
63 |
+
className={cn('max-h-[300px] overflow-y-auto overflow-x-hidden', className)}
|
64 |
+
{...props}
|
65 |
+
/>
|
66 |
+
));
|
67 |
+
|
68 |
+
CommandList.displayName = CommandPrimitive.List.displayName;
|
69 |
+
|
70 |
+
const CommandEmpty = React.forwardRef<
|
71 |
+
React.ElementRef<typeof CommandPrimitive.Empty>,
|
72 |
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
|
73 |
+
>((props, ref) => (
|
74 |
+
<CommandPrimitive.Empty
|
75 |
+
ref={ref}
|
76 |
+
className="py-6 text-center text-sm"
|
77 |
+
{...props}
|
78 |
+
/>
|
79 |
+
));
|
80 |
+
|
81 |
+
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
82 |
+
|
83 |
+
const CommandGroup = React.forwardRef<
|
84 |
+
React.ElementRef<typeof CommandPrimitive.Group>,
|
85 |
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
|
86 |
+
>(({ className, ...props }, ref) => (
|
87 |
+
<CommandPrimitive.Group
|
88 |
+
ref={ref}
|
89 |
+
className={cn(
|
90 |
+
'overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground',
|
91 |
+
className,
|
92 |
+
)}
|
93 |
+
{...props}
|
94 |
+
/>
|
95 |
+
));
|
96 |
+
|
97 |
+
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
98 |
+
|
99 |
+
const CommandSeparator = React.forwardRef<
|
100 |
+
React.ElementRef<typeof CommandPrimitive.Separator>,
|
101 |
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
|
102 |
+
>(({ className, ...props }, ref) => (
|
103 |
+
<CommandPrimitive.Separator
|
104 |
+
ref={ref}
|
105 |
+
className={cn('-mx-1 h-px bg-border', className)}
|
106 |
+
{...props}
|
107 |
+
/>
|
108 |
+
));
|
109 |
+
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
110 |
+
|
111 |
+
const CommandItem = React.forwardRef<
|
112 |
+
React.ElementRef<typeof CommandPrimitive.Item>,
|
113 |
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
|
114 |
+
>(({ className, ...props }, ref) => (
|
115 |
+
<CommandPrimitive.Item
|
116 |
+
ref={ref}
|
117 |
+
className={cn(
|
118 |
+
"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
119 |
+
className,
|
120 |
+
)}
|
121 |
+
{...props}
|
122 |
+
/>
|
123 |
+
));
|
124 |
+
|
125 |
+
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
126 |
+
|
127 |
+
const CommandShortcut = ({
|
128 |
+
className,
|
129 |
+
...props
|
130 |
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
131 |
+
return (
|
132 |
+
<span
|
133 |
+
className={cn(
|
134 |
+
'ml-auto text-xs tracking-widest text-muted-foreground',
|
135 |
+
className,
|
136 |
+
)}
|
137 |
+
{...props}
|
138 |
+
/>
|
139 |
+
);
|
140 |
+
};
|
141 |
+
CommandShortcut.displayName = 'CommandShortcut';
|
142 |
+
|
143 |
+
export {
|
144 |
+
Command,
|
145 |
+
CommandDialog,
|
146 |
+
CommandEmpty,
|
147 |
+
CommandGroup,
|
148 |
+
CommandInput,
|
149 |
+
CommandItem,
|
150 |
+
CommandList,
|
151 |
+
CommandSeparator,
|
152 |
+
CommandShortcut,
|
153 |
+
};
|
web/src/components/ui/dialog.tsx
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use client';
|
2 |
+
|
3 |
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
4 |
+
import { X } from 'lucide-react';
|
5 |
+
import * as React from 'react';
|
6 |
+
|
7 |
+
import { cn } from '@/lib/utils';
|
8 |
+
|
9 |
+
const Dialog = DialogPrimitive.Root;
|
10 |
+
|
11 |
+
const DialogTrigger = DialogPrimitive.Trigger;
|
12 |
+
|
13 |
+
const DialogPortal = DialogPrimitive.Portal;
|
14 |
+
|
15 |
+
const DialogClose = DialogPrimitive.Close;
|
16 |
+
|
17 |
+
const DialogOverlay = React.forwardRef<
|
18 |
+
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
19 |
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
20 |
+
>(({ className, ...props }, ref) => (
|
21 |
+
<DialogPrimitive.Overlay
|
22 |
+
ref={ref}
|
23 |
+
className={cn(
|
24 |
+
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
25 |
+
className,
|
26 |
+
)}
|
27 |
+
{...props}
|
28 |
+
/>
|
29 |
+
));
|
30 |
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
31 |
+
|
32 |
+
const DialogContent = React.forwardRef<
|
33 |
+
React.ElementRef<typeof DialogPrimitive.Content>,
|
34 |
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
35 |
+
>(({ className, children, ...props }, ref) => (
|
36 |
+
<DialogPortal>
|
37 |
+
<DialogOverlay />
|
38 |
+
<DialogPrimitive.Content
|
39 |
+
ref={ref}
|
40 |
+
className={cn(
|
41 |
+
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
|
42 |
+
className,
|
43 |
+
)}
|
44 |
+
{...props}
|
45 |
+
>
|
46 |
+
{children}
|
47 |
+
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
48 |
+
<X className="h-4 w-4" />
|
49 |
+
<span className="sr-only">Close</span>
|
50 |
+
</DialogPrimitive.Close>
|
51 |
+
</DialogPrimitive.Content>
|
52 |
+
</DialogPortal>
|
53 |
+
));
|
54 |
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
55 |
+
|
56 |
+
const DialogHeader = ({
|
57 |
+
className,
|
58 |
+
...props
|
59 |
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
60 |
+
<div
|
61 |
+
className={cn(
|
62 |
+
'flex flex-col space-y-1.5 text-center sm:text-left',
|
63 |
+
className,
|
64 |
+
)}
|
65 |
+
{...props}
|
66 |
+
/>
|
67 |
+
);
|
68 |
+
DialogHeader.displayName = 'DialogHeader';
|
69 |
+
|
70 |
+
const DialogFooter = ({
|
71 |
+
className,
|
72 |
+
...props
|
73 |
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
74 |
+
<div
|
75 |
+
className={cn(
|
76 |
+
'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
|
77 |
+
className,
|
78 |
+
)}
|
79 |
+
{...props}
|
80 |
+
/>
|
81 |
+
);
|
82 |
+
DialogFooter.displayName = 'DialogFooter';
|
83 |
+
|
84 |
+
const DialogTitle = React.forwardRef<
|
85 |
+
React.ElementRef<typeof DialogPrimitive.Title>,
|
86 |
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
87 |
+
>(({ className, ...props }, ref) => (
|
88 |
+
<DialogPrimitive.Title
|
89 |
+
ref={ref}
|
90 |
+
className={cn(
|
91 |
+
'text-lg font-semibold leading-none tracking-tight',
|
92 |
+
className,
|
93 |
+
)}
|
94 |
+
{...props}
|
95 |
+
/>
|
96 |
+
));
|
97 |
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
98 |
+
|
99 |
+
const DialogDescription = React.forwardRef<
|
100 |
+
React.ElementRef<typeof DialogPrimitive.Description>,
|
101 |
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
102 |
+
>(({ className, ...props }, ref) => (
|
103 |
+
<DialogPrimitive.Description
|
104 |
+
ref={ref}
|
105 |
+
className={cn('text-sm text-muted-foreground', className)}
|
106 |
+
{...props}
|
107 |
+
/>
|
108 |
+
));
|
109 |
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
110 |
+
|
111 |
+
export {
|
112 |
+
Dialog,
|
113 |
+
DialogClose,
|
114 |
+
DialogContent,
|
115 |
+
DialogDescription,
|
116 |
+
DialogFooter,
|
117 |
+
DialogHeader,
|
118 |
+
DialogOverlay,
|
119 |
+
DialogPortal,
|
120 |
+
DialogTitle,
|
121 |
+
DialogTrigger,
|
122 |
+
};
|
web/src/components/ui/multi-select.tsx
ADDED
@@ -0,0 +1,381 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// src/components/multi-select.tsx
|
2 |
+
|
3 |
+
import { cva, type VariantProps } from 'class-variance-authority';
|
4 |
+
import {
|
5 |
+
CheckIcon,
|
6 |
+
ChevronDown,
|
7 |
+
WandSparkles,
|
8 |
+
XCircle,
|
9 |
+
XIcon,
|
10 |
+
} from 'lucide-react';
|
11 |
+
import * as React from 'react';
|
12 |
+
|
13 |
+
import { Badge } from '@/components/ui/badge';
|
14 |
+
import { Button } from '@/components/ui/button';
|
15 |
+
import {
|
16 |
+
Command,
|
17 |
+
CommandEmpty,
|
18 |
+
CommandGroup,
|
19 |
+
CommandInput,
|
20 |
+
CommandItem,
|
21 |
+
CommandList,
|
22 |
+
CommandSeparator,
|
23 |
+
} from '@/components/ui/command';
|
24 |
+
import {
|
25 |
+
Popover,
|
26 |
+
PopoverContent,
|
27 |
+
PopoverTrigger,
|
28 |
+
} from '@/components/ui/popover';
|
29 |
+
import { Separator } from '@/components/ui/separator';
|
30 |
+
import { cn } from '@/lib/utils';
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Variants for the multi-select component to handle different styles.
|
34 |
+
* Uses class-variance-authority (cva) to define different styles based on "variant" prop.
|
35 |
+
*/
|
36 |
+
const multiSelectVariants = cva(
|
37 |
+
'm-1 transition ease-in-out delay-150 hover:-translate-y-1 hover:scale-110 duration-300',
|
38 |
+
{
|
39 |
+
variants: {
|
40 |
+
variant: {
|
41 |
+
default:
|
42 |
+
'border-foreground/10 text-foreground bg-card hover:bg-card/80',
|
43 |
+
secondary:
|
44 |
+
'border-foreground/10 bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
45 |
+
destructive:
|
46 |
+
'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',
|
47 |
+
inverted: 'inverted',
|
48 |
+
},
|
49 |
+
},
|
50 |
+
defaultVariants: {
|
51 |
+
variant: 'default',
|
52 |
+
},
|
53 |
+
},
|
54 |
+
);
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Props for MultiSelect component
|
58 |
+
*/
|
59 |
+
interface MultiSelectProps
|
60 |
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
61 |
+
VariantProps<typeof multiSelectVariants> {
|
62 |
+
/**
|
63 |
+
* An array of option objects to be displayed in the multi-select component.
|
64 |
+
* Each option object has a label, value, and an optional icon.
|
65 |
+
*/
|
66 |
+
options: {
|
67 |
+
/** The text to display for the option. */
|
68 |
+
label: string;
|
69 |
+
/** The unique value associated with the option. */
|
70 |
+
value: string;
|
71 |
+
/** Optional icon component to display alongside the option. */
|
72 |
+
icon?: React.ComponentType<{ className?: string }>;
|
73 |
+
}[];
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Callback function triggered when the selected values change.
|
77 |
+
* Receives an array of the new selected values.
|
78 |
+
*/
|
79 |
+
onValueChange: (value: string[]) => void;
|
80 |
+
|
81 |
+
/** The default selected values when the component mounts. */
|
82 |
+
defaultValue?: string[];
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Placeholder text to be displayed when no values are selected.
|
86 |
+
* Optional, defaults to "Select options".
|
87 |
+
*/
|
88 |
+
placeholder?: string;
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Animation duration in seconds for the visual effects (e.g., bouncing badges).
|
92 |
+
* Optional, defaults to 0 (no animation).
|
93 |
+
*/
|
94 |
+
animation?: number;
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Maximum number of items to display. Extra selected items will be summarized.
|
98 |
+
* Optional, defaults to 3.
|
99 |
+
*/
|
100 |
+
maxCount?: number;
|
101 |
+
|
102 |
+
/**
|
103 |
+
* The modality of the popover. When set to true, interaction with outside elements
|
104 |
+
* will be disabled and only popover content will be visible to screen readers.
|
105 |
+
* Optional, defaults to false.
|
106 |
+
*/
|
107 |
+
modalPopover?: boolean;
|
108 |
+
|
109 |
+
/**
|
110 |
+
* If true, renders the multi-select component as a child of another component.
|
111 |
+
* Optional, defaults to false.
|
112 |
+
*/
|
113 |
+
asChild?: boolean;
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Additional class names to apply custom styles to the multi-select component.
|
117 |
+
* Optional, can be used to add custom styles.
|
118 |
+
*/
|
119 |
+
className?: string;
|
120 |
+
}
|
121 |
+
|
122 |
+
export const MultiSelect = React.forwardRef<
|
123 |
+
HTMLButtonElement,
|
124 |
+
MultiSelectProps
|
125 |
+
>(
|
126 |
+
(
|
127 |
+
{
|
128 |
+
options,
|
129 |
+
onValueChange,
|
130 |
+
variant,
|
131 |
+
defaultValue = [],
|
132 |
+
placeholder = 'Select options',
|
133 |
+
animation = 0,
|
134 |
+
maxCount = 3,
|
135 |
+
modalPopover = false,
|
136 |
+
asChild = false,
|
137 |
+
className,
|
138 |
+
...props
|
139 |
+
},
|
140 |
+
ref,
|
141 |
+
) => {
|
142 |
+
const [selectedValues, setSelectedValues] =
|
143 |
+
React.useState<string[]>(defaultValue);
|
144 |
+
const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);
|
145 |
+
const [isAnimating, setIsAnimating] = React.useState(false);
|
146 |
+
|
147 |
+
const handleInputKeyDown = (
|
148 |
+
event: React.KeyboardEvent<HTMLInputElement>,
|
149 |
+
) => {
|
150 |
+
if (event.key === 'Enter') {
|
151 |
+
setIsPopoverOpen(true);
|
152 |
+
} else if (event.key === 'Backspace' && !event.currentTarget.value) {
|
153 |
+
const newSelectedValues = [...selectedValues];
|
154 |
+
newSelectedValues.pop();
|
155 |
+
setSelectedValues(newSelectedValues);
|
156 |
+
onValueChange(newSelectedValues);
|
157 |
+
}
|
158 |
+
};
|
159 |
+
|
160 |
+
const toggleOption = (option: string) => {
|
161 |
+
const newSelectedValues = selectedValues.includes(option)
|
162 |
+
? selectedValues.filter((value) => value !== option)
|
163 |
+
: [...selectedValues, option];
|
164 |
+
setSelectedValues(newSelectedValues);
|
165 |
+
onValueChange(newSelectedValues);
|
166 |
+
};
|
167 |
+
|
168 |
+
const handleClear = () => {
|
169 |
+
setSelectedValues([]);
|
170 |
+
onValueChange([]);
|
171 |
+
};
|
172 |
+
|
173 |
+
const handleTogglePopover = () => {
|
174 |
+
setIsPopoverOpen((prev) => !prev);
|
175 |
+
};
|
176 |
+
|
177 |
+
const clearExtraOptions = () => {
|
178 |
+
const newSelectedValues = selectedValues.slice(0, maxCount);
|
179 |
+
setSelectedValues(newSelectedValues);
|
180 |
+
onValueChange(newSelectedValues);
|
181 |
+
};
|
182 |
+
|
183 |
+
const toggleAll = () => {
|
184 |
+
if (selectedValues.length === options.length) {
|
185 |
+
handleClear();
|
186 |
+
} else {
|
187 |
+
const allValues = options.map((option) => option.value);
|
188 |
+
setSelectedValues(allValues);
|
189 |
+
onValueChange(allValues);
|
190 |
+
}
|
191 |
+
};
|
192 |
+
|
193 |
+
return (
|
194 |
+
<Popover
|
195 |
+
open={isPopoverOpen}
|
196 |
+
onOpenChange={setIsPopoverOpen}
|
197 |
+
modal={modalPopover}
|
198 |
+
>
|
199 |
+
<PopoverTrigger asChild>
|
200 |
+
<Button
|
201 |
+
ref={ref}
|
202 |
+
{...props}
|
203 |
+
onClick={handleTogglePopover}
|
204 |
+
className={cn(
|
205 |
+
'flex w-full p-1 rounded-md border min-h-10 h-auto items-center justify-between bg-inherit hover:bg-inherit [&_svg]:pointer-events-auto',
|
206 |
+
className,
|
207 |
+
)}
|
208 |
+
>
|
209 |
+
{selectedValues.length > 0 ? (
|
210 |
+
<div className="flex justify-between items-center w-full">
|
211 |
+
<div className="flex flex-wrap items-center">
|
212 |
+
{selectedValues.slice(0, maxCount).map((value) => {
|
213 |
+
const option = options.find((o) => o.value === value);
|
214 |
+
const IconComponent = option?.icon;
|
215 |
+
return (
|
216 |
+
<Badge
|
217 |
+
key={value}
|
218 |
+
className={cn(
|
219 |
+
isAnimating ? 'animate-bounce' : '',
|
220 |
+
multiSelectVariants({ variant }),
|
221 |
+
)}
|
222 |
+
style={{ animationDuration: `${animation}s` }}
|
223 |
+
>
|
224 |
+
{IconComponent && (
|
225 |
+
<IconComponent className="h-4 w-4 mr-2" />
|
226 |
+
)}
|
227 |
+
{option?.label}
|
228 |
+
<XCircle
|
229 |
+
className="ml-2 h-4 w-4 cursor-pointer"
|
230 |
+
onClick={(event) => {
|
231 |
+
event.stopPropagation();
|
232 |
+
toggleOption(value);
|
233 |
+
}}
|
234 |
+
/>
|
235 |
+
</Badge>
|
236 |
+
);
|
237 |
+
})}
|
238 |
+
{selectedValues.length > maxCount && (
|
239 |
+
<Badge
|
240 |
+
className={cn(
|
241 |
+
'bg-transparent text-foreground border-foreground/1 hover:bg-transparent',
|
242 |
+
isAnimating ? 'animate-bounce' : '',
|
243 |
+
multiSelectVariants({ variant }),
|
244 |
+
)}
|
245 |
+
style={{ animationDuration: `${animation}s` }}
|
246 |
+
>
|
247 |
+
{`+ ${selectedValues.length - maxCount} more`}
|
248 |
+
<XCircle
|
249 |
+
className="ml-2 h-4 w-4 cursor-pointer"
|
250 |
+
onClick={(event) => {
|
251 |
+
event.stopPropagation();
|
252 |
+
clearExtraOptions();
|
253 |
+
}}
|
254 |
+
/>
|
255 |
+
</Badge>
|
256 |
+
)}
|
257 |
+
</div>
|
258 |
+
<div className="flex items-center justify-between">
|
259 |
+
<XIcon
|
260 |
+
className="h-4 mx-2 cursor-pointer text-muted-foreground"
|
261 |
+
onClick={(event) => {
|
262 |
+
event.stopPropagation();
|
263 |
+
handleClear();
|
264 |
+
}}
|
265 |
+
/>
|
266 |
+
<Separator
|
267 |
+
orientation="vertical"
|
268 |
+
className="flex min-h-6 h-full"
|
269 |
+
/>
|
270 |
+
<ChevronDown className="h-4 mx-2 cursor-pointer text-muted-foreground" />
|
271 |
+
</div>
|
272 |
+
</div>
|
273 |
+
) : (
|
274 |
+
<div className="flex items-center justify-between w-full mx-auto">
|
275 |
+
<span className="text-sm text-muted-foreground mx-3">
|
276 |
+
{placeholder}
|
277 |
+
</span>
|
278 |
+
<ChevronDown className="h-4 cursor-pointer text-muted-foreground mx-2" />
|
279 |
+
</div>
|
280 |
+
)}
|
281 |
+
</Button>
|
282 |
+
</PopoverTrigger>
|
283 |
+
<PopoverContent
|
284 |
+
className="w-auto p-0"
|
285 |
+
align="start"
|
286 |
+
onEscapeKeyDown={() => setIsPopoverOpen(false)}
|
287 |
+
>
|
288 |
+
<Command>
|
289 |
+
<CommandInput
|
290 |
+
placeholder="Search..."
|
291 |
+
onKeyDown={handleInputKeyDown}
|
292 |
+
/>
|
293 |
+
<CommandList>
|
294 |
+
<CommandEmpty>No results found.</CommandEmpty>
|
295 |
+
<CommandGroup>
|
296 |
+
<CommandItem
|
297 |
+
key="all"
|
298 |
+
onSelect={toggleAll}
|
299 |
+
className="cursor-pointer"
|
300 |
+
>
|
301 |
+
<div
|
302 |
+
className={cn(
|
303 |
+
'mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary',
|
304 |
+
selectedValues.length === options.length
|
305 |
+
? 'bg-primary text-primary-foreground'
|
306 |
+
: 'opacity-50 [&_svg]:invisible',
|
307 |
+
)}
|
308 |
+
>
|
309 |
+
<CheckIcon className="h-4 w-4" />
|
310 |
+
</div>
|
311 |
+
<span>(Select All)</span>
|
312 |
+
</CommandItem>
|
313 |
+
{options.map((option) => {
|
314 |
+
const isSelected = selectedValues.includes(option.value);
|
315 |
+
return (
|
316 |
+
<CommandItem
|
317 |
+
key={option.value}
|
318 |
+
onSelect={() => toggleOption(option.value)}
|
319 |
+
className="cursor-pointer"
|
320 |
+
>
|
321 |
+
<div
|
322 |
+
className={cn(
|
323 |
+
'mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary',
|
324 |
+
isSelected
|
325 |
+
? 'bg-primary text-primary-foreground'
|
326 |
+
: 'opacity-50 [&_svg]:invisible',
|
327 |
+
)}
|
328 |
+
>
|
329 |
+
<CheckIcon className="h-4 w-4" />
|
330 |
+
</div>
|
331 |
+
{option.icon && (
|
332 |
+
<option.icon className="mr-2 h-4 w-4 text-muted-foreground" />
|
333 |
+
)}
|
334 |
+
<span>{option.label}</span>
|
335 |
+
</CommandItem>
|
336 |
+
);
|
337 |
+
})}
|
338 |
+
</CommandGroup>
|
339 |
+
<CommandSeparator />
|
340 |
+
<CommandGroup>
|
341 |
+
<div className="flex items-center justify-between">
|
342 |
+
{selectedValues.length > 0 && (
|
343 |
+
<>
|
344 |
+
<CommandItem
|
345 |
+
onSelect={handleClear}
|
346 |
+
className="flex-1 justify-center cursor-pointer"
|
347 |
+
>
|
348 |
+
Clear
|
349 |
+
</CommandItem>
|
350 |
+
<Separator
|
351 |
+
orientation="vertical"
|
352 |
+
className="flex min-h-6 h-full"
|
353 |
+
/>
|
354 |
+
</>
|
355 |
+
)}
|
356 |
+
<CommandItem
|
357 |
+
onSelect={() => setIsPopoverOpen(false)}
|
358 |
+
className="flex-1 justify-center cursor-pointer max-w-full"
|
359 |
+
>
|
360 |
+
Close
|
361 |
+
</CommandItem>
|
362 |
+
</div>
|
363 |
+
</CommandGroup>
|
364 |
+
</CommandList>
|
365 |
+
</Command>
|
366 |
+
</PopoverContent>
|
367 |
+
{animation > 0 && selectedValues.length > 0 && (
|
368 |
+
<WandSparkles
|
369 |
+
className={cn(
|
370 |
+
'cursor-pointer my-2 text-foreground bg-background w-3 h-3',
|
371 |
+
isAnimating ? '' : 'text-muted-foreground',
|
372 |
+
)}
|
373 |
+
onClick={() => setIsAnimating(!isAnimating)}
|
374 |
+
/>
|
375 |
+
)}
|
376 |
+
</Popover>
|
377 |
+
);
|
378 |
+
},
|
379 |
+
);
|
380 |
+
|
381 |
+
MultiSelect.displayName = 'MultiSelect';
|
web/src/pages/dataset/setting/advanced-setting-form.tsx
CHANGED
@@ -23,9 +23,10 @@ import {
|
|
23 |
} from '@/components/ui/select';
|
24 |
import { FormSlider } from '@/components/ui/slider';
|
25 |
import { Textarea } from '@/components/ui/textarea';
|
|
|
26 |
|
27 |
const formSchema = z.object({
|
28 |
-
|
29 |
message: 'Username must be at least 2 characters.',
|
30 |
}),
|
31 |
a: z.number().min(2, {
|
@@ -46,7 +47,7 @@ export default function AdvancedSettingForm() {
|
|
46 |
const form = useForm<z.infer<typeof formSchema>>({
|
47 |
resolver: zodResolver(formSchema),
|
48 |
defaultValues: {
|
49 |
-
|
50 |
},
|
51 |
});
|
52 |
|
@@ -59,9 +60,9 @@ export default function AdvancedSettingForm() {
|
|
59 |
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
|
60 |
<FormField
|
61 |
control={form.control}
|
62 |
-
name="
|
63 |
render={({ field }) => (
|
64 |
-
<FormItem>
|
65 |
<FormLabel>Username</FormLabel>
|
66 |
<FormControl>
|
67 |
<FormSlider {...field}></FormSlider>
|
@@ -73,11 +74,12 @@ export default function AdvancedSettingForm() {
|
|
73 |
</FormItem>
|
74 |
)}
|
75 |
/>
|
|
|
76 |
<FormField
|
77 |
control={form.control}
|
78 |
name="a"
|
79 |
render={({ field }) => (
|
80 |
-
<FormItem>
|
81 |
<FormLabel>Username</FormLabel>
|
82 |
<FormControl>
|
83 |
<FormSlider {...field}></FormSlider>
|
@@ -93,7 +95,7 @@ export default function AdvancedSettingForm() {
|
|
93 |
control={form.control}
|
94 |
name="b"
|
95 |
render={({ field }) => (
|
96 |
-
<FormItem>
|
97 |
<FormLabel>Username</FormLabel>
|
98 |
<Select onValueChange={field.onChange} defaultValue={field.value}>
|
99 |
<FormControl>
|
@@ -118,7 +120,7 @@ export default function AdvancedSettingForm() {
|
|
118 |
control={form.control}
|
119 |
name="c"
|
120 |
render={({ field }) => (
|
121 |
-
<FormItem>
|
122 |
<FormLabel>Username</FormLabel>
|
123 |
<FormControl>
|
124 |
<FormSlider {...field}></FormSlider>
|
@@ -134,7 +136,7 @@ export default function AdvancedSettingForm() {
|
|
134 |
control={form.control}
|
135 |
name="d"
|
136 |
render={({ field }) => (
|
137 |
-
<FormItem>
|
138 |
<FormLabel>Username</FormLabel>
|
139 |
<FormControl>
|
140 |
<Textarea
|
@@ -153,7 +155,7 @@ export default function AdvancedSettingForm() {
|
|
153 |
variant={'tertiary'}
|
154 |
size={'sm'}
|
155 |
type="submit"
|
156 |
-
className="w-
|
157 |
>
|
158 |
Test
|
159 |
</Button>
|
|
|
23 |
} from '@/components/ui/select';
|
24 |
import { FormSlider } from '@/components/ui/slider';
|
25 |
import { Textarea } from '@/components/ui/textarea';
|
26 |
+
import ChunkMethodCard from './chunk-method-card';
|
27 |
|
28 |
const formSchema = z.object({
|
29 |
+
parser_id: z.string().min(1, {
|
30 |
message: 'Username must be at least 2 characters.',
|
31 |
}),
|
32 |
a: z.number().min(2, {
|
|
|
47 |
const form = useForm<z.infer<typeof formSchema>>({
|
48 |
resolver: zodResolver(formSchema),
|
49 |
defaultValues: {
|
50 |
+
parser_id: '',
|
51 |
},
|
52 |
});
|
53 |
|
|
|
60 |
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
|
61 |
<FormField
|
62 |
control={form.control}
|
63 |
+
name="a"
|
64 |
render={({ field }) => (
|
65 |
+
<FormItem className="w-2/5">
|
66 |
<FormLabel>Username</FormLabel>
|
67 |
<FormControl>
|
68 |
<FormSlider {...field}></FormSlider>
|
|
|
74 |
</FormItem>
|
75 |
)}
|
76 |
/>
|
77 |
+
<ChunkMethodCard></ChunkMethodCard>
|
78 |
<FormField
|
79 |
control={form.control}
|
80 |
name="a"
|
81 |
render={({ field }) => (
|
82 |
+
<FormItem className="w-2/5">
|
83 |
<FormLabel>Username</FormLabel>
|
84 |
<FormControl>
|
85 |
<FormSlider {...field}></FormSlider>
|
|
|
95 |
control={form.control}
|
96 |
name="b"
|
97 |
render={({ field }) => (
|
98 |
+
<FormItem className="w-2/5">
|
99 |
<FormLabel>Username</FormLabel>
|
100 |
<Select onValueChange={field.onChange} defaultValue={field.value}>
|
101 |
<FormControl>
|
|
|
120 |
control={form.control}
|
121 |
name="c"
|
122 |
render={({ field }) => (
|
123 |
+
<FormItem className="w-2/5">
|
124 |
<FormLabel>Username</FormLabel>
|
125 |
<FormControl>
|
126 |
<FormSlider {...field}></FormSlider>
|
|
|
136 |
control={form.control}
|
137 |
name="d"
|
138 |
render={({ field }) => (
|
139 |
+
<FormItem className="w-2/5">
|
140 |
<FormLabel>Username</FormLabel>
|
141 |
<FormControl>
|
142 |
<Textarea
|
|
|
155 |
variant={'tertiary'}
|
156 |
size={'sm'}
|
157 |
type="submit"
|
158 |
+
className="w-2/5"
|
159 |
>
|
160 |
Test
|
161 |
</Button>
|
web/src/pages/dataset/setting/basic-setting-form.tsx
CHANGED
@@ -4,16 +4,16 @@ import { zodResolver } from '@hookform/resolvers/zod';
|
|
4 |
import { useForm } from 'react-hook-form';
|
5 |
import { z } from 'zod';
|
6 |
|
7 |
-
import { Button } from '@/components/ui/button';
|
8 |
import {
|
9 |
Form,
|
10 |
FormControl,
|
11 |
-
FormDescription,
|
12 |
FormField,
|
13 |
FormItem,
|
14 |
FormLabel,
|
15 |
FormMessage,
|
16 |
} from '@/components/ui/form';
|
|
|
|
|
17 |
import {
|
18 |
Select,
|
19 |
SelectContent,
|
@@ -21,34 +21,48 @@ import {
|
|
21 |
SelectTrigger,
|
22 |
SelectValue,
|
23 |
} from '@/components/ui/select';
|
24 |
-
import {
|
25 |
-
import {
|
|
|
26 |
|
27 |
-
const
|
28 |
-
|
29 |
-
|
30 |
-
}
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
b: z.string().min(2, {
|
35 |
-
message: 'Username must be at least 2 characters.',
|
36 |
-
}),
|
37 |
-
c: z.number().min(2, {
|
38 |
-
message: 'Username must be at least 2 characters.',
|
39 |
-
}),
|
40 |
-
d: z.string().min(2, {
|
41 |
-
message: 'Username must be at least 2 characters.',
|
42 |
-
}),
|
43 |
-
});
|
44 |
|
45 |
export default function BasicSettingForm() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
const form = useForm<z.infer<typeof formSchema>>({
|
47 |
resolver: zodResolver(formSchema),
|
48 |
defaultValues: {
|
49 |
-
|
|
|
50 |
},
|
51 |
});
|
|
|
|
|
|
|
|
|
52 |
|
53 |
function onSubmit(values: z.infer<typeof formSchema>) {
|
54 |
console.log(values);
|
@@ -59,42 +73,42 @@ export default function BasicSettingForm() {
|
|
59 |
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
|
60 |
<FormField
|
61 |
control={form.control}
|
62 |
-
name="
|
63 |
render={({ field }) => (
|
64 |
<FormItem>
|
65 |
-
<FormLabel>
|
66 |
<FormControl>
|
67 |
-
<
|
|
|
|
|
|
|
68 |
</FormControl>
|
69 |
-
<FormDescription>
|
70 |
-
This is your public display name.
|
71 |
-
</FormDescription>
|
72 |
<FormMessage />
|
73 |
</FormItem>
|
74 |
)}
|
75 |
/>
|
76 |
<FormField
|
77 |
control={form.control}
|
78 |
-
name="
|
79 |
render={({ field }) => (
|
80 |
<FormItem>
|
81 |
<FormLabel>Username</FormLabel>
|
82 |
<FormControl>
|
83 |
-
<
|
|
|
|
|
|
|
84 |
</FormControl>
|
85 |
-
<FormDescription>
|
86 |
-
This is your public display name.
|
87 |
-
</FormDescription>
|
88 |
<FormMessage />
|
89 |
</FormItem>
|
90 |
)}
|
91 |
/>
|
92 |
<FormField
|
93 |
control={form.control}
|
94 |
-
name="
|
95 |
render={({ field }) => (
|
96 |
<FormItem>
|
97 |
-
<FormLabel>
|
98 |
<Select onValueChange={field.onChange} defaultValue={field.value}>
|
99 |
<FormControl>
|
100 |
<SelectTrigger className="bg-colors-background-inverse-weak">
|
@@ -107,9 +121,6 @@ export default function BasicSettingForm() {
|
|
107 |
<SelectItem value="[email protected]">[email protected]</SelectItem>
|
108 |
</SelectContent>
|
109 |
</Select>
|
110 |
-
<FormDescription>
|
111 |
-
This is your public display name.
|
112 |
-
</FormDescription>
|
113 |
<FormMessage />
|
114 |
</FormItem>
|
115 |
)}
|
@@ -121,42 +132,20 @@ export default function BasicSettingForm() {
|
|
121 |
<FormItem>
|
122 |
<FormLabel>Username</FormLabel>
|
123 |
<FormControl>
|
124 |
-
<
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
)}
|
132 |
-
/>
|
133 |
-
<FormField
|
134 |
-
control={form.control}
|
135 |
-
name="d"
|
136 |
-
render={({ field }) => (
|
137 |
-
<FormItem>
|
138 |
-
<FormLabel>Username</FormLabel>
|
139 |
-
<FormControl>
|
140 |
-
<Textarea
|
141 |
{...field}
|
142 |
-
|
143 |
-
></Textarea>
|
144 |
</FormControl>
|
145 |
-
<FormDescription>
|
146 |
-
This is your public display name.
|
147 |
-
</FormDescription>
|
148 |
<FormMessage />
|
149 |
</FormItem>
|
150 |
)}
|
151 |
/>
|
152 |
-
<Button
|
153 |
-
variant={'tertiary'}
|
154 |
-
size={'sm'}
|
155 |
-
type="submit"
|
156 |
-
className="w-full"
|
157 |
-
>
|
158 |
-
Test
|
159 |
-
</Button>
|
160 |
</form>
|
161 |
</Form>
|
162 |
);
|
|
|
4 |
import { useForm } from 'react-hook-form';
|
5 |
import { z } from 'zod';
|
6 |
|
|
|
7 |
import {
|
8 |
Form,
|
9 |
FormControl,
|
|
|
10 |
FormField,
|
11 |
FormItem,
|
12 |
FormLabel,
|
13 |
FormMessage,
|
14 |
} from '@/components/ui/form';
|
15 |
+
import { Input } from '@/components/ui/input';
|
16 |
+
import { MultiSelect } from '@/components/ui/multi-select';
|
17 |
import {
|
18 |
Select,
|
19 |
SelectContent,
|
|
|
21 |
SelectTrigger,
|
22 |
SelectValue,
|
23 |
} from '@/components/ui/select';
|
24 |
+
import { useTranslate } from '@/hooks/common-hooks';
|
25 |
+
import { Cat, Dog, Fish, Rabbit, Turtle } from 'lucide-react';
|
26 |
+
import { useState } from 'react';
|
27 |
|
28 |
+
const frameworksList = [
|
29 |
+
{ value: 'react', label: 'React', icon: Turtle },
|
30 |
+
{ value: 'angular', label: 'Angular', icon: Cat },
|
31 |
+
{ value: 'vue', label: 'Vue', icon: Dog },
|
32 |
+
{ value: 'svelte', label: 'Svelte', icon: Rabbit },
|
33 |
+
{ value: 'ember', label: 'Ember', icon: Fish },
|
34 |
+
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
export default function BasicSettingForm() {
|
37 |
+
const { t } = useTranslate('knowledgeConfiguration');
|
38 |
+
|
39 |
+
const formSchema = z.object({
|
40 |
+
name: z.string().min(1),
|
41 |
+
a: z.number().min(2, {
|
42 |
+
message: 'Username must be at least 2 characters.',
|
43 |
+
}),
|
44 |
+
language: z.string().min(1, {
|
45 |
+
message: 'Username must be at least 2 characters.',
|
46 |
+
}),
|
47 |
+
c: z.number().min(2, {
|
48 |
+
message: 'Username must be at least 2 characters.',
|
49 |
+
}),
|
50 |
+
d: z.string().min(2, {
|
51 |
+
message: 'Username must be at least 2 characters.',
|
52 |
+
}),
|
53 |
+
});
|
54 |
+
|
55 |
const form = useForm<z.infer<typeof formSchema>>({
|
56 |
resolver: zodResolver(formSchema),
|
57 |
defaultValues: {
|
58 |
+
name: '',
|
59 |
+
language: 'English',
|
60 |
},
|
61 |
});
|
62 |
+
const [selectedFrameworks, setSelectedFrameworks] = useState<string[]>([
|
63 |
+
'react',
|
64 |
+
'angular',
|
65 |
+
]);
|
66 |
|
67 |
function onSubmit(values: z.infer<typeof formSchema>) {
|
68 |
console.log(values);
|
|
|
73 |
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
|
74 |
<FormField
|
75 |
control={form.control}
|
76 |
+
name="name"
|
77 |
render={({ field }) => (
|
78 |
<FormItem>
|
79 |
+
<FormLabel>{t('name')}</FormLabel>
|
80 |
<FormControl>
|
81 |
+
<Input
|
82 |
+
{...field}
|
83 |
+
className="bg-colors-background-inverse-weak"
|
84 |
+
></Input>
|
85 |
</FormControl>
|
|
|
|
|
|
|
86 |
<FormMessage />
|
87 |
</FormItem>
|
88 |
)}
|
89 |
/>
|
90 |
<FormField
|
91 |
control={form.control}
|
92 |
+
name="d"
|
93 |
render={({ field }) => (
|
94 |
<FormItem>
|
95 |
<FormLabel>Username</FormLabel>
|
96 |
<FormControl>
|
97 |
+
<Input
|
98 |
+
{...field}
|
99 |
+
className="bg-colors-background-inverse-weak"
|
100 |
+
></Input>
|
101 |
</FormControl>
|
|
|
|
|
|
|
102 |
<FormMessage />
|
103 |
</FormItem>
|
104 |
)}
|
105 |
/>
|
106 |
<FormField
|
107 |
control={form.control}
|
108 |
+
name="language"
|
109 |
render={({ field }) => (
|
110 |
<FormItem>
|
111 |
+
<FormLabel>{t('language')}</FormLabel>
|
112 |
<Select onValueChange={field.onChange} defaultValue={field.value}>
|
113 |
<FormControl>
|
114 |
<SelectTrigger className="bg-colors-background-inverse-weak">
|
|
|
121 |
<SelectItem value="[email protected]">[email protected]</SelectItem>
|
122 |
</SelectContent>
|
123 |
</Select>
|
|
|
|
|
|
|
124 |
<FormMessage />
|
125 |
</FormItem>
|
126 |
)}
|
|
|
132 |
<FormItem>
|
133 |
<FormLabel>Username</FormLabel>
|
134 |
<FormControl>
|
135 |
+
<MultiSelect
|
136 |
+
options={frameworksList}
|
137 |
+
onValueChange={setSelectedFrameworks}
|
138 |
+
defaultValue={selectedFrameworks}
|
139 |
+
placeholder="Select frameworks"
|
140 |
+
variant="inverted"
|
141 |
+
maxCount={100}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
{...field}
|
143 |
+
/>
|
|
|
144 |
</FormControl>
|
|
|
|
|
|
|
145 |
<FormMessage />
|
146 |
</FormItem>
|
147 |
)}
|
148 |
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
</form>
|
150 |
</Form>
|
151 |
);
|
web/src/pages/dataset/setting/chunk-method-card.tsx
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import SvgIcon from '@/components/svg-icon';
|
2 |
+
import { Card } from '@/components/ui/card';
|
3 |
+
import {
|
4 |
+
FormControl,
|
5 |
+
FormField,
|
6 |
+
FormItem,
|
7 |
+
FormLabel,
|
8 |
+
FormMessage,
|
9 |
+
} from '@/components/ui/form';
|
10 |
+
import {
|
11 |
+
Select,
|
12 |
+
SelectContent,
|
13 |
+
SelectItem,
|
14 |
+
SelectTrigger,
|
15 |
+
SelectValue,
|
16 |
+
} from '@/components/ui/select';
|
17 |
+
import { useTranslate } from '@/hooks/common-hooks';
|
18 |
+
import { useSelectParserList } from '@/hooks/user-setting-hooks';
|
19 |
+
import { Col, Divider, Empty, Row, Typography } from 'antd';
|
20 |
+
import DOMPurify from 'dompurify';
|
21 |
+
import camelCase from 'lodash/camelCase';
|
22 |
+
import { useMemo } from 'react';
|
23 |
+
import { useFormContext } from 'react-hook-form';
|
24 |
+
import styles from './index.less';
|
25 |
+
import { ImageMap } from './utils';
|
26 |
+
|
27 |
+
const { Title, Text } = Typography;
|
28 |
+
|
29 |
+
const CategoryPanel = ({ chunkMethod }: { chunkMethod: string }) => {
|
30 |
+
const parserList = useSelectParserList();
|
31 |
+
const { t } = useTranslate('knowledgeConfiguration');
|
32 |
+
|
33 |
+
const item = useMemo(() => {
|
34 |
+
const item = parserList.find((x) => x.value === chunkMethod);
|
35 |
+
if (item) {
|
36 |
+
return {
|
37 |
+
title: item.label,
|
38 |
+
description: t(camelCase(item.value)),
|
39 |
+
};
|
40 |
+
}
|
41 |
+
return { title: '', description: '' };
|
42 |
+
}, [parserList, chunkMethod, t]);
|
43 |
+
|
44 |
+
const imageList = useMemo(() => {
|
45 |
+
if (chunkMethod in ImageMap) {
|
46 |
+
return ImageMap[chunkMethod as keyof typeof ImageMap];
|
47 |
+
}
|
48 |
+
return [];
|
49 |
+
}, [chunkMethod]);
|
50 |
+
|
51 |
+
return (
|
52 |
+
<section className={styles.categoryPanelWrapper}>
|
53 |
+
{imageList.length > 0 ? (
|
54 |
+
<>
|
55 |
+
<Title level={5} className={styles.topTitle}>
|
56 |
+
{`"${item.title}" ${t('methodTitle')}`}
|
57 |
+
</Title>
|
58 |
+
<p
|
59 |
+
dangerouslySetInnerHTML={{
|
60 |
+
__html: DOMPurify.sanitize(item.description),
|
61 |
+
}}
|
62 |
+
></p>
|
63 |
+
<Title level={5}>{`"${item.title}" ${t('methodExamples')}`}</Title>
|
64 |
+
<Text>{t('methodExamplesDescription')}</Text>
|
65 |
+
<Row gutter={[10, 10]} className={styles.imageRow}>
|
66 |
+
{imageList.map((x) => (
|
67 |
+
<Col span={12} key={x}>
|
68 |
+
<SvgIcon
|
69 |
+
name={x}
|
70 |
+
width={'100%'}
|
71 |
+
className={styles.image}
|
72 |
+
></SvgIcon>
|
73 |
+
</Col>
|
74 |
+
))}
|
75 |
+
</Row>
|
76 |
+
<Title level={5}>
|
77 |
+
{item.title} {t('dialogueExamplesTitle')}
|
78 |
+
</Title>
|
79 |
+
<Divider></Divider>
|
80 |
+
</>
|
81 |
+
) : (
|
82 |
+
<Empty description={''} image={null}>
|
83 |
+
<p>{t('methodEmpty')}</p>
|
84 |
+
<SvgIcon name={'chunk-method/chunk-empty'} width={'100%'}></SvgIcon>
|
85 |
+
</Empty>
|
86 |
+
)}
|
87 |
+
</section>
|
88 |
+
);
|
89 |
+
};
|
90 |
+
|
91 |
+
export default function ChunkMethodCard() {
|
92 |
+
const { t } = useTranslate('knowledgeConfiguration');
|
93 |
+
const form = useFormContext();
|
94 |
+
|
95 |
+
return (
|
96 |
+
<Card className="border-0 p-6 mb-8 bg-colors-background-inverse-weak flex">
|
97 |
+
<div className="w-2/5">
|
98 |
+
<FormField
|
99 |
+
control={form.control}
|
100 |
+
name="parser_id"
|
101 |
+
render={({ field }) => (
|
102 |
+
<FormItem>
|
103 |
+
<FormLabel>{t('chunkMethod')}</FormLabel>
|
104 |
+
<Select onValueChange={field.onChange} defaultValue={field.value}>
|
105 |
+
<FormControl>
|
106 |
+
<SelectTrigger className="bg-colors-background-inverse-weak">
|
107 |
+
<SelectValue placeholder="Select a verified email to display" />
|
108 |
+
</SelectTrigger>
|
109 |
+
</FormControl>
|
110 |
+
<SelectContent>
|
111 |
+
<SelectItem value="[email protected]">[email protected]</SelectItem>
|
112 |
+
<SelectItem value="[email protected]">[email protected]</SelectItem>
|
113 |
+
<SelectItem value="[email protected]">[email protected]</SelectItem>
|
114 |
+
</SelectContent>
|
115 |
+
</Select>
|
116 |
+
<FormMessage />
|
117 |
+
</FormItem>
|
118 |
+
)}
|
119 |
+
/>
|
120 |
+
</div>
|
121 |
+
<CategoryPanel chunkMethod=""></CategoryPanel>
|
122 |
+
</Card>
|
123 |
+
);
|
124 |
+
}
|
web/src/pages/dataset/setting/index.less
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.tags {
|
2 |
+
margin-bottom: 24px;
|
3 |
+
}
|
4 |
+
|
5 |
+
.preset {
|
6 |
+
display: flex;
|
7 |
+
height: 80px;
|
8 |
+
background-color: rgba(0, 0, 0, 0.1);
|
9 |
+
border-radius: 5px;
|
10 |
+
padding: 5px;
|
11 |
+
margin-bottom: 24px;
|
12 |
+
|
13 |
+
.left {
|
14 |
+
flex: 1;
|
15 |
+
}
|
16 |
+
|
17 |
+
.right {
|
18 |
+
width: 100px;
|
19 |
+
border-left: 1px solid rgba(0, 0, 0, 0.4);
|
20 |
+
margin: 10px 0px;
|
21 |
+
padding: 5px;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
.configurationWrapper {
|
26 |
+
padding: 0 52px;
|
27 |
+
.buttonWrapper {
|
28 |
+
text-align: right;
|
29 |
+
}
|
30 |
+
.variableSlider {
|
31 |
+
width: 100%;
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
.categoryPanelWrapper {
|
36 |
+
.topTitle {
|
37 |
+
margin-top: 0;
|
38 |
+
}
|
39 |
+
.imageRow {
|
40 |
+
margin-top: 16px;
|
41 |
+
}
|
42 |
+
.image {
|
43 |
+
width: 100%;
|
44 |
+
}
|
45 |
+
}
|
web/src/pages/dataset/setting/index.tsx
CHANGED
@@ -14,9 +14,7 @@ export default function DatasetSettings() {
|
|
14 |
|
15 |
<div className="text-3xl font-bold mb-6">Advanced settings</div>
|
16 |
<Card className="border-0 p-6 mb-8 bg-colors-background-inverse-weak">
|
17 |
-
<
|
18 |
-
<AdvancedSettingForm></AdvancedSettingForm>
|
19 |
-
</div>
|
20 |
</Card>
|
21 |
</section>
|
22 |
);
|
|
|
14 |
|
15 |
<div className="text-3xl font-bold mb-6">Advanced settings</div>
|
16 |
<Card className="border-0 p-6 mb-8 bg-colors-background-inverse-weak">
|
17 |
+
<AdvancedSettingForm></AdvancedSettingForm>
|
|
|
|
|
18 |
</Card>
|
19 |
</section>
|
20 |
);
|
web/src/pages/dataset/setting/utils.ts
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const getImageName = (prefix: string, length: number) =>
|
2 |
+
new Array(length)
|
3 |
+
.fill(0)
|
4 |
+
.map((x, idx) => `chunk-method/${prefix}-0${idx + 1}`);
|
5 |
+
|
6 |
+
export const ImageMap = {
|
7 |
+
book: getImageName('book', 4),
|
8 |
+
laws: getImageName('law', 2),
|
9 |
+
manual: getImageName('manual', 4),
|
10 |
+
picture: getImageName('media', 2),
|
11 |
+
naive: getImageName('naive', 2),
|
12 |
+
paper: getImageName('paper', 2),
|
13 |
+
presentation: getImageName('presentation', 2),
|
14 |
+
qa: getImageName('qa', 2),
|
15 |
+
resume: getImageName('resume', 2),
|
16 |
+
table: getImageName('table', 2),
|
17 |
+
one: getImageName('one', 2),
|
18 |
+
knowledge_graph: getImageName('knowledge-graph', 2),
|
19 |
+
};
|
web/src/pages/profile-setting/sidebar/index.tsx
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import { useTheme } from '@/components/theme-provider';
|
2 |
import { Button } from '@/components/ui/button';
|
3 |
import { Label } from '@/components/ui/label';
|
4 |
import { Switch } from '@/components/ui/switch';
|
@@ -52,6 +52,7 @@ export function SideBar() {
|
|
52 |
const pathName = useSecondPathName();
|
53 |
const { handleMenuClick } = useHandleMenuClick();
|
54 |
const { setTheme } = useTheme();
|
|
|
55 |
|
56 |
const handleThemeChange = useCallback(
|
57 |
(checked: boolean) => {
|
@@ -89,7 +90,11 @@ export function SideBar() {
|
|
89 |
|
90 |
<div className="p-6 mt-auto border-t">
|
91 |
<div className="flex items-center gap-2 mb-6">
|
92 |
-
<Switch
|
|
|
|
|
|
|
|
|
93 |
<Label htmlFor="dark-mode" className="text-sm">
|
94 |
Dark
|
95 |
</Label>
|
|
|
1 |
+
import { useIsDarkTheme, useTheme } from '@/components/theme-provider';
|
2 |
import { Button } from '@/components/ui/button';
|
3 |
import { Label } from '@/components/ui/label';
|
4 |
import { Switch } from '@/components/ui/switch';
|
|
|
52 |
const pathName = useSecondPathName();
|
53 |
const { handleMenuClick } = useHandleMenuClick();
|
54 |
const { setTheme } = useTheme();
|
55 |
+
const isDarkTheme = useIsDarkTheme();
|
56 |
|
57 |
const handleThemeChange = useCallback(
|
58 |
(checked: boolean) => {
|
|
|
90 |
|
91 |
<div className="p-6 mt-auto border-t">
|
92 |
<div className="flex items-center gap-2 mb-6">
|
93 |
+
<Switch
|
94 |
+
id="dark-mode"
|
95 |
+
onCheckedChange={handleThemeChange}
|
96 |
+
checked={isDarkTheme}
|
97 |
+
/>
|
98 |
<Label htmlFor="dark-mode" className="text-sm">
|
99 |
Dark
|
100 |
</Label>
|