@baishuyun/ai-design 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.ts +29 -0
- package/.storybook/preview.ts +16 -0
- package/.turbo/turbo-build.log +14 -0
- package/CHANGELOG.md +12 -0
- package/components.json +22 -0
- package/debug-storybook.log +88 -0
- package/dist/ai-design.js +20482 -0
- package/dist/ai-design.js.map +1 -0
- package/dist/ai-design.umd.cjs +260 -0
- package/dist/ai-design.umd.cjs.map +1 -0
- package/dist/src/components/abs-fullscreen-gradient-bg.d.ts +10 -0
- package/dist/src/components/abs-fullscreen-gradient-bg.d.ts.map +1 -0
- package/dist/src/components/agent-scroll-selector.d.ts +11 -0
- package/dist/src/components/agent-scroll-selector.d.ts.map +1 -0
- package/dist/src/components/agent-select.d.ts +16 -0
- package/dist/src/components/agent-select.d.ts.map +1 -0
- package/dist/src/components/attachment-part-group.d.ts +16 -0
- package/dist/src/components/attachment-part-group.d.ts.map +1 -0
- package/dist/src/components/attachment-part.d.ts +19 -0
- package/dist/src/components/attachment-part.d.ts.map +1 -0
- package/dist/src/components/attachments-previewer.d.ts +18 -0
- package/dist/src/components/attachments-previewer.d.ts.map +1 -0
- package/dist/src/components/base-button.d.ts +8 -0
- package/dist/src/components/base-button.d.ts.map +1 -0
- package/dist/src/components/border-animation.d.ts +23 -0
- package/dist/src/components/border-animation.d.ts.map +1 -0
- package/dist/src/components/border-color-animation.d.ts +11 -0
- package/dist/src/components/border-color-animation.d.ts.map +1 -0
- package/dist/src/components/bot-avatar-name.d.ts +6 -0
- package/dist/src/components/bot-avatar-name.d.ts.map +1 -0
- package/dist/src/components/bot-icon.d.ts +5 -0
- package/dist/src/components/bot-icon.d.ts.map +1 -0
- package/dist/src/components/bs-entry-select.d.ts +18 -0
- package/dist/src/components/bs-entry-select.d.ts.map +1 -0
- package/dist/src/components/bs-icons.d.ts +75 -0
- package/dist/src/components/bs-icons.d.ts.map +1 -0
- package/dist/src/components/card-field.d.ts +11 -0
- package/dist/src/components/card-field.d.ts.map +1 -0
- package/dist/src/components/card.d.ts +11 -0
- package/dist/src/components/card.d.ts.map +1 -0
- package/dist/src/components/chat-area-header.d.ts +13 -0
- package/dist/src/components/chat-area-header.d.ts.map +1 -0
- package/dist/src/components/circle-checker.d.ts +10 -0
- package/dist/src/components/circle-checker.d.ts.map +1 -0
- package/dist/src/components/collapsible-txt-msg.d.ts +11 -0
- package/dist/src/components/collapsible-txt-msg.d.ts.map +1 -0
- package/dist/src/components/confirm-dialog.d.ts +26 -0
- package/dist/src/components/confirm-dialog.d.ts.map +1 -0
- package/dist/src/components/fake-bot-msg.d.ts +8 -0
- package/dist/src/components/fake-bot-msg.d.ts.map +1 -0
- package/dist/src/components/fields-design-info-table.d.ts +7 -0
- package/dist/src/components/fields-design-info-table.d.ts.map +1 -0
- package/dist/src/components/fields-generating-indicator.d.ts +6 -0
- package/dist/src/components/fields-generating-indicator.d.ts.map +1 -0
- package/dist/src/components/fields-portal.d.ts +8 -0
- package/dist/src/components/fields-portal.d.ts.map +1 -0
- package/dist/src/components/fields-previewer.d.ts +19 -0
- package/dist/src/components/fields-previewer.d.ts.map +1 -0
- package/dist/src/components/font-icon.d.ts +6 -0
- package/dist/src/components/font-icon.d.ts.map +1 -0
- package/dist/src/components/form-info-editor.d.ts +31 -0
- package/dist/src/components/form-info-editor.d.ts.map +1 -0
- package/dist/src/components/formula-tag.d.ts +8 -0
- package/dist/src/components/formula-tag.d.ts.map +1 -0
- package/dist/src/components/generate-animation.d.ts +5 -0
- package/dist/src/components/generate-animation.d.ts.map +1 -0
- package/dist/src/components/icon-btn.d.ts +9 -0
- package/dist/src/components/icon-btn.d.ts.map +1 -0
- package/dist/src/components/img-part.d.ts +10 -0
- package/dist/src/components/img-part.d.ts.map +1 -0
- package/dist/src/components/legacy-slot.d.ts +11 -0
- package/dist/src/components/legacy-slot.d.ts.map +1 -0
- package/dist/src/components/line-checker.d.ts +19 -0
- package/dist/src/components/line-checker.d.ts.map +1 -0
- package/dist/src/components/linear-gradient-border-btn.d.ts +10 -0
- package/dist/src/components/linear-gradient-border-btn.d.ts.map +1 -0
- package/dist/src/components/linear-gradient-color-bg-animation.d.ts +8 -0
- package/dist/src/components/linear-gradient-color-bg-animation.d.ts.map +1 -0
- package/dist/src/components/memoized-markdown.d.ts +5 -0
- package/dist/src/components/memoized-markdown.d.ts.map +1 -0
- package/dist/src/components/message-content.d.ts +6 -0
- package/dist/src/components/message-content.d.ts.map +1 -0
- package/dist/src/components/number-part.d.ts +9 -0
- package/dist/src/components/number-part.d.ts.map +1 -0
- package/dist/src/components/office-container.d.ts +12 -0
- package/dist/src/components/office-container.d.ts.map +1 -0
- package/dist/src/components/option-item.d.ts +9 -0
- package/dist/src/components/option-item.d.ts.map +1 -0
- package/dist/src/components/previewer-header.d.ts +21 -0
- package/dist/src/components/previewer-header.d.ts.map +1 -0
- package/dist/src/components/primary-confirm-btn.d.ts +10 -0
- package/dist/src/components/primary-confirm-btn.d.ts.map +1 -0
- package/dist/src/components/primary-entry-btn.d.ts +9 -0
- package/dist/src/components/primary-entry-btn.d.ts.map +1 -0
- package/dist/src/components/scroll-to-bottom-btn.d.ts +6 -0
- package/dist/src/components/scroll-to-bottom-btn.d.ts.map +1 -0
- package/dist/src/components/split-line.d.ts +5 -0
- package/dist/src/components/split-line.d.ts.map +1 -0
- package/dist/src/components/square-checker.d.ts +15 -0
- package/dist/src/components/square-checker.d.ts.map +1 -0
- package/dist/src/components/tab-radio-group.d.ts +20 -0
- package/dist/src/components/tab-radio-group.d.ts.map +1 -0
- package/dist/src/components/tooltip.d.ts +6 -0
- package/dist/src/components/tooltip.d.ts.map +1 -0
- package/dist/src/components/ui/button.d.ts +12 -0
- package/dist/src/components/ui/button.d.ts.map +1 -0
- package/dist/src/components/ui/dialog.d.ts +24 -0
- package/dist/src/components/ui/dialog.d.ts.map +1 -0
- package/dist/src/components/ui/icons.d.ts +176 -0
- package/dist/src/components/ui/icons.d.ts.map +1 -0
- package/dist/src/components/ui/popover.d.ts +10 -0
- package/dist/src/components/ui/popover.d.ts.map +1 -0
- package/dist/src/components/ui/spinner.d.ts +3 -0
- package/dist/src/components/ui/spinner.d.ts.map +1 -0
- package/dist/src/components/ui/tooltip.d.ts +13 -0
- package/dist/src/components/ui/tooltip.d.ts.map +1 -0
- package/dist/src/components/user-txt-msg-bubble.d.ts +6 -0
- package/dist/src/components/user-txt-msg-bubble.d.ts.map +1 -0
- package/dist/src/components/warning-msg.d.ts +6 -0
- package/dist/src/components/warning-msg.d.ts.map +1 -0
- package/dist/src/const/ui.d.ts +7 -0
- package/dist/src/const/ui.d.ts.map +1 -0
- package/dist/src/hooks/use-resizable-width.d.ts +24 -0
- package/dist/src/hooks/use-resizable-width.d.ts.map +1 -0
- package/dist/src/hooks/use-shadow.d.ts +25 -0
- package/dist/src/hooks/use-shadow.d.ts.map +1 -0
- package/dist/src/index.d.ts +66 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lib/utils.d.ts +4 -0
- package/dist/src/lib/utils.d.ts.map +1 -0
- package/dist/src/stories/AbsFullscreenGradientBg.stories.d.ts +17 -0
- package/dist/src/stories/AbsFullscreenGradientBg.stories.d.ts.map +1 -0
- package/dist/src/stories/AgentScrollSelector.stories.d.ts +11 -0
- package/dist/src/stories/AgentScrollSelector.stories.d.ts.map +1 -0
- package/dist/src/stories/AgentSelect.stories.d.ts +14 -0
- package/dist/src/stories/AgentSelect.stories.d.ts.map +1 -0
- package/dist/src/stories/AttachmentPart.stories.d.ts +23 -0
- package/dist/src/stories/AttachmentPart.stories.d.ts.map +1 -0
- package/dist/src/stories/AttachmentPartGroup.stories.d.ts +21 -0
- package/dist/src/stories/AttachmentPartGroup.stories.d.ts.map +1 -0
- package/dist/src/stories/AttachmentsPreviewer.stories.d.ts +20 -0
- package/dist/src/stories/AttachmentsPreviewer.stories.d.ts.map +1 -0
- package/dist/src/stories/BaseButton.stories.d.ts +18 -0
- package/dist/src/stories/BaseButton.stories.d.ts.map +1 -0
- package/dist/src/stories/BorderAnimation.stories.d.ts +21 -0
- package/dist/src/stories/BorderAnimation.stories.d.ts.map +1 -0
- package/dist/src/stories/BorderColorAnimation.stories.d.ts +26 -0
- package/dist/src/stories/BorderColorAnimation.stories.d.ts.map +1 -0
- package/dist/src/stories/BotAvatarAndName.stories.d.ts +18 -0
- package/dist/src/stories/BotAvatarAndName.stories.d.ts.map +1 -0
- package/dist/src/stories/BotIcon.stories.d.ts +17 -0
- package/dist/src/stories/BotIcon.stories.d.ts.map +1 -0
- package/dist/src/stories/BsEntrySelect.stories.d.ts +13 -0
- package/dist/src/stories/BsEntrySelect.stories.d.ts.map +1 -0
- package/dist/src/stories/BsTooltip.stories.d.ts +7 -0
- package/dist/src/stories/BsTooltip.stories.d.ts.map +1 -0
- package/dist/src/stories/Card.stories.d.ts +14 -0
- package/dist/src/stories/Card.stories.d.ts.map +1 -0
- package/dist/src/stories/CardField.stories.d.ts +13 -0
- package/dist/src/stories/CardField.stories.d.ts.map +1 -0
- package/dist/src/stories/ChatAreaHeader.stories.d.ts +14 -0
- package/dist/src/stories/ChatAreaHeader.stories.d.ts.map +1 -0
- package/dist/src/stories/CircleChecker.stories.d.ts +21 -0
- package/dist/src/stories/CircleChecker.stories.d.ts.map +1 -0
- package/dist/src/stories/CollapsibleTextMsg.stories.d.ts +16 -0
- package/dist/src/stories/CollapsibleTextMsg.stories.d.ts.map +1 -0
- package/dist/src/stories/ConfirmDialog.stories.d.ts +61 -0
- package/dist/src/stories/ConfirmDialog.stories.d.ts.map +1 -0
- package/dist/src/stories/FakeBotMsg.stories.d.ts +21 -0
- package/dist/src/stories/FakeBotMsg.stories.d.ts.map +1 -0
- package/dist/src/stories/FormInfoEditor.stories.d.ts +15 -0
- package/dist/src/stories/FormInfoEditor.stories.d.ts.map +1 -0
- package/dist/src/stories/FormulaTag.stories.d.ts +37 -0
- package/dist/src/stories/FormulaTag.stories.d.ts.map +1 -0
- package/dist/src/stories/GenerateAnimation.stories.d.ts +17 -0
- package/dist/src/stories/GenerateAnimation.stories.d.ts.map +1 -0
- package/dist/src/stories/IconBtn.stories.d.ts +15 -0
- package/dist/src/stories/IconBtn.stories.d.ts.map +1 -0
- package/dist/src/stories/IconLib.d.ts +12 -0
- package/dist/src/stories/IconLib.d.ts.map +1 -0
- package/dist/src/stories/Icons.stories.d.ts +24 -0
- package/dist/src/stories/Icons.stories.d.ts.map +1 -0
- package/dist/src/stories/ImgMsgPart.stories.d.ts +20 -0
- package/dist/src/stories/ImgMsgPart.stories.d.ts.map +1 -0
- package/dist/src/stories/LegacySlot.stories.d.ts +16 -0
- package/dist/src/stories/LegacySlot.stories.d.ts.map +1 -0
- package/dist/src/stories/LineChecker.stories.d.ts +23 -0
- package/dist/src/stories/LineChecker.stories.d.ts.map +1 -0
- package/dist/src/stories/LinearGradientBorderBtn.stories.d.ts +22 -0
- package/dist/src/stories/LinearGradientBorderBtn.stories.d.ts.map +1 -0
- package/dist/src/stories/LinearGradientColorBgAnimation.stories.d.ts +23 -0
- package/dist/src/stories/LinearGradientColorBgAnimation.stories.d.ts.map +1 -0
- package/dist/src/stories/MemoizedMarkdown.stories.d.ts +23 -0
- package/dist/src/stories/MemoizedMarkdown.stories.d.ts.map +1 -0
- package/dist/src/stories/MessageContent.stories.d.ts +16 -0
- package/dist/src/stories/MessageContent.stories.d.ts.map +1 -0
- package/dist/src/stories/NumbersMsgPart.stories.d.ts +19 -0
- package/dist/src/stories/NumbersMsgPart.stories.d.ts.map +1 -0
- package/dist/src/stories/OfficeContainer.stories.d.ts +8 -0
- package/dist/src/stories/OfficeContainer.stories.d.ts.map +1 -0
- package/dist/src/stories/OptionItem.stories.d.ts +20 -0
- package/dist/src/stories/OptionItem.stories.d.ts.map +1 -0
- package/dist/src/stories/PreviewerHeader.stories.d.ts +12 -0
- package/dist/src/stories/PreviewerHeader.stories.d.ts.map +1 -0
- package/dist/src/stories/PrimaryConfirmBtn.stories.d.ts +19 -0
- package/dist/src/stories/PrimaryConfirmBtn.stories.d.ts.map +1 -0
- package/dist/src/stories/PrimaryEntryBtn.stories.d.ts +26 -0
- package/dist/src/stories/PrimaryEntryBtn.stories.d.ts.map +1 -0
- package/dist/src/stories/ScrollToBottom.stories.d.ts +15 -0
- package/dist/src/stories/ScrollToBottom.stories.d.ts.map +1 -0
- package/dist/src/stories/SplitLine.stories.d.ts +9 -0
- package/dist/src/stories/SplitLine.stories.d.ts.map +1 -0
- package/dist/src/stories/SquareChecker.stories.d.ts +26 -0
- package/dist/src/stories/SquareChecker.stories.d.ts.map +1 -0
- package/dist/src/stories/TabRadioGroup.stories.d.ts +18 -0
- package/dist/src/stories/TabRadioGroup.stories.d.ts.map +1 -0
- package/dist/src/stories/UserTextMsgBubble.stories.d.ts +14 -0
- package/dist/src/stories/UserTextMsgBubble.stories.d.ts.map +1 -0
- package/dist/src/stories/WarningMessage.stories.d.ts +16 -0
- package/dist/src/stories/WarningMessage.stories.d.ts.map +1 -0
- package/dist/src/stories/fields-design-info-table.stories.d.ts +14 -0
- package/dist/src/stories/fields-design-info-table.stories.d.ts.map +1 -0
- package/dist/src/stories/fields-generating.stories.d.ts +20 -0
- package/dist/src/stories/fields-generating.stories.d.ts.map +1 -0
- package/dist/src/stories/fields-previewer.stories.d.ts +19 -0
- package/dist/src/stories/fields-previewer.stories.d.ts.map +1 -0
- package/dist/src/types.d.ts +8 -0
- package/dist/src/types.d.ts.map +1 -0
- package/package.json +80 -0
- package/src/components/abs-fullscreen-gradient-bg.tsx +35 -0
- package/src/components/agent-scroll-selector.tsx +181 -0
- package/src/components/agent-select.tsx +149 -0
- package/src/components/attachment-part-group.tsx +35 -0
- package/src/components/attachment-part.tsx +179 -0
- package/src/components/attachments-previewer.tsx +324 -0
- package/src/components/base-button.tsx +49 -0
- package/src/components/border-animation.tsx +107 -0
- package/src/components/border-color-animation.tsx +66 -0
- package/src/components/bot-avatar-name.tsx +36 -0
- package/src/components/bot-icon.tsx +23 -0
- package/src/components/bs-entry-select.tsx +724 -0
- package/src/components/bs-icons.tsx +1201 -0
- package/src/components/card-field.tsx +23 -0
- package/src/components/card.tsx +36 -0
- package/src/components/chat-area-header.tsx +65 -0
- package/src/components/circle-checker.tsx +66 -0
- package/src/components/collapsible-txt-msg.tsx +63 -0
- package/src/components/confirm-dialog.tsx +139 -0
- package/src/components/fake-bot-msg.tsx +49 -0
- package/src/components/fields-design-info-table.tsx +160 -0
- package/src/components/fields-generating-indicator.tsx +95 -0
- package/src/components/fields-portal.tsx +18 -0
- package/src/components/fields-previewer.tsx +216 -0
- package/src/components/font-icon.tsx +17 -0
- package/src/components/form-info-editor.tsx +253 -0
- package/src/components/formula-tag.tsx +32 -0
- package/src/components/generate-animation.tsx +56 -0
- package/src/components/icon-btn.tsx +43 -0
- package/src/components/img-part.tsx +27 -0
- package/src/components/legacy-slot.tsx +103 -0
- package/src/components/line-checker.tsx +160 -0
- package/src/components/linear-gradient-border-btn.tsx +48 -0
- package/src/components/linear-gradient-color-bg-animation.tsx +103 -0
- package/src/components/memoized-markdown.tsx +32 -0
- package/src/components/message-content.tsx +21 -0
- package/src/components/number-part.tsx +46 -0
- package/src/components/office-container.tsx +83 -0
- package/src/components/option-item.tsx +28 -0
- package/src/components/previewer-header.tsx +270 -0
- package/src/components/primary-confirm-btn.tsx +58 -0
- package/src/components/primary-entry-btn.tsx +48 -0
- package/src/components/scroll-to-bottom-btn.tsx +28 -0
- package/src/components/split-line.tsx +9 -0
- package/src/components/square-checker.tsx +87 -0
- package/src/components/tab-radio-group.tsx +83 -0
- package/src/components/tooltip.tsx +53 -0
- package/src/components/ui/button.tsx +51 -0
- package/src/components/ui/dialog.tsx +104 -0
- package/src/components/ui/icons.tsx +1267 -0
- package/src/components/ui/popover.tsx +50 -0
- package/src/components/ui/spinner.tsx +17 -0
- package/src/components/ui/tooltip.tsx +53 -0
- package/src/components/user-txt-msg-bubble.tsx +19 -0
- package/src/components/warning-msg.tsx +27 -0
- package/src/const/ui.ts +52 -0
- package/src/hooks/use-resizable-width.ts +92 -0
- package/src/hooks/use-shadow.ts +127 -0
- package/src/index.ts +76 -0
- package/src/lib/utils.ts +52 -0
- package/src/stories/AbsFullscreenGradientBg.stories.tsx +36 -0
- package/src/stories/AgentScrollSelector.stories.tsx +95 -0
- package/src/stories/AgentSelect.stories.tsx +134 -0
- package/src/stories/AttachmentPart.stories.tsx +122 -0
- package/src/stories/AttachmentPartGroup.stories.tsx +152 -0
- package/src/stories/AttachmentsPreviewer.stories.tsx +306 -0
- package/src/stories/BaseButton.stories.tsx +33 -0
- package/src/stories/BorderAnimation.stories.tsx +116 -0
- package/src/stories/BorderColorAnimation.stories.tsx +63 -0
- package/src/stories/BotAvatarAndName.stories.ts +24 -0
- package/src/stories/BotIcon.stories.ts +22 -0
- package/src/stories/BsEntrySelect.stories.tsx +261 -0
- package/src/stories/BsTooltip.stories.tsx +32 -0
- package/src/stories/Card.stories.tsx +28 -0
- package/src/stories/CardField.stories.tsx +87 -0
- package/src/stories/ChatAreaHeader.stories.ts +26 -0
- package/src/stories/CircleChecker.stories.tsx +89 -0
- package/src/stories/CollapsibleTextMsg.stories.ts +44 -0
- package/src/stories/ConfirmDialog.stories.tsx +123 -0
- package/src/stories/FakeBotMsg.stories.tsx +36 -0
- package/src/stories/FormInfoEditor.stories.tsx +173 -0
- package/src/stories/FormulaTag.stories.tsx +68 -0
- package/src/stories/GenerateAnimation.stories.ts +20 -0
- package/src/stories/IconBtn.stories.tsx +32 -0
- package/src/stories/IconLib.tsx +45 -0
- package/src/stories/Icons.stories.ts +22 -0
- package/src/stories/ImgMsgPart.stories.tsx +42 -0
- package/src/stories/LegacySlot.stories.tsx +56 -0
- package/src/stories/LineChecker.stories.tsx +134 -0
- package/src/stories/LinearGradientBorderBtn.stories.tsx +86 -0
- package/src/stories/LinearGradientColorBgAnimation.stories.tsx +60 -0
- package/src/stories/MemoizedMarkdown.stories.tsx +102 -0
- package/src/stories/MessageContent.stories.tsx +36 -0
- package/src/stories/NumbersMsgPart.stories.tsx +42 -0
- package/src/stories/OfficeContainer.stories.tsx +82 -0
- package/src/stories/OptionItem.stories.tsx +77 -0
- package/src/stories/PreviewerHeader.stories.tsx +91 -0
- package/src/stories/PrimaryConfirmBtn.stories.tsx +60 -0
- package/src/stories/PrimaryEntryBtn.stories.tsx +74 -0
- package/src/stories/ScrollToBottom.stories.tsx +24 -0
- package/src/stories/SplitLine.stories.tsx +40 -0
- package/src/stories/SquareChecker.stories.tsx +96 -0
- package/src/stories/TabRadioGroup.stories.tsx +84 -0
- package/src/stories/UserTextMsgBubble.stories.ts +24 -0
- package/src/stories/WarningMessage.stories.tsx +23 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/demo.css +539 -0
- package/src/stories/assets/demo_index.html +7988 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/iconfont.css +1377 -0
- package/src/stories/assets/iconfont.eot +0 -0
- package/src/stories/assets/iconfont.json +2382 -0
- package/src/stories/assets/iconfont.svg +697 -0
- package/src/stories/assets/iconfont.ttf +0 -0
- package/src/stories/assets/iconfont.woff +0 -0
- package/src/stories/assets/iconfont.woff2 +0 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/fields-design-info-table.stories.tsx +203 -0
- package/src/stories/fields-generating.stories.tsx +41 -0
- package/src/stories/fields-previewer.stories.tsx +77 -0
- package/src/style.css +223 -0
- package/src/types.ts +8 -0
- package/tsconfig.json +12 -0
- package/vite.config.ts +42 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { cn } from '../lib/utils';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface CardFieldProps {
|
|
5
|
+
label: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const CardField = ({ label, children, className }: CardFieldProps) => {
|
|
11
|
+
return (
|
|
12
|
+
<div className={cn('flex gap-2 items-start w-full', className)}>
|
|
13
|
+
<div className="w-[100px] shrink-0 text-[#666] text-sm leading-normal truncate">{label}</div>
|
|
14
|
+
<div className="flex-1 min-w-0 text-sm leading-normal whitespace-pre-wrap break-words">
|
|
15
|
+
{children ?? <span className="text-[#666]">无</span>}
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const CardFieldsWrapper = ({ children }: { children: ReactNode }) => {
|
|
22
|
+
return <div className="flex flex-col gap-[10px] w-full">{children}</div>;
|
|
23
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { transCls } from '../const/ui';
|
|
2
|
+
import { cn } from '../lib/utils';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
export interface CardProps {
|
|
6
|
+
title: string;
|
|
7
|
+
desc?: string;
|
|
8
|
+
index?: number;
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
iconCode?: string;
|
|
11
|
+
onClick?: (title: string, iconCode?: string) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const Card = ({ title, desc, index, icon, onClick, iconCode }: CardProps) => {
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
className={cn(
|
|
18
|
+
'bs-card group flex flex-col cursor-pointer p-2.5 gap-2.5 rounded-lg bg-[#F5F7FA] max-w-[350px] border border-transparent hover:border-[#e0e0e0] hover:bg-white',
|
|
19
|
+
{
|
|
20
|
+
transCls,
|
|
21
|
+
}
|
|
22
|
+
)}
|
|
23
|
+
onClick={() => {
|
|
24
|
+
onClick?.(title, iconCode);
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
<div className="px-2.5 flex items-center gap-1.5 rounded-[4px] h-[34px] bg-white">
|
|
28
|
+
{index === undefined ? null : <div>{index}</div>}
|
|
29
|
+
{icon === undefined ? null : <div className="text-[#0265FF]">{icon}</div>}
|
|
30
|
+
{/* make title text ellipsis */}
|
|
31
|
+
<div className="truncate !text-[#12111] group-hover:text-[#0265FF]">{title}</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div className="text-[#666] leading-5 text-[12px]">{desc}</div>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { cn } from '../lib/utils';
|
|
2
|
+
import { ChatHeaderBgImgUrl } from '../const/ui';
|
|
3
|
+
import { IconBtn } from './icon-btn';
|
|
4
|
+
import { CloseIcon, DockIcon, FloatIcon } from './bs-icons';
|
|
5
|
+
|
|
6
|
+
export interface ChatAreaHeaderProps {
|
|
7
|
+
title?: string;
|
|
8
|
+
width?: number;
|
|
9
|
+
onDockClick?: () => void;
|
|
10
|
+
onCloseClick?: () => void;
|
|
11
|
+
avatar?: React.ReactNode;
|
|
12
|
+
draggable?: boolean;
|
|
13
|
+
isDragging?: boolean;
|
|
14
|
+
isDocked?: boolean;
|
|
15
|
+
onDragStart?: (e: React.MouseEvent) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const ChatAreaHeader = ({
|
|
19
|
+
avatar,
|
|
20
|
+
width,
|
|
21
|
+
onDockClick,
|
|
22
|
+
onCloseClick,
|
|
23
|
+
draggable,
|
|
24
|
+
isDragging,
|
|
25
|
+
isDocked,
|
|
26
|
+
onDragStart,
|
|
27
|
+
}: ChatAreaHeaderProps) => {
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
className={cn('flex items-center justify-between', 'px-4', 'h-[52px] min-w-[200px]', {
|
|
31
|
+
'w-full': !width,
|
|
32
|
+
[`w-[${width}px]`]: width,
|
|
33
|
+
'cursor-grab': draggable && !isDragging,
|
|
34
|
+
'cursor-grabbing': isDragging,
|
|
35
|
+
})}
|
|
36
|
+
style={{
|
|
37
|
+
backgroundImage: ChatHeaderBgImgUrl,
|
|
38
|
+
backgroundSize: 'cover',
|
|
39
|
+
backgroundRepeat: 'no-repeat',
|
|
40
|
+
}}
|
|
41
|
+
onMouseDown={draggable ? onDragStart : undefined}
|
|
42
|
+
>
|
|
43
|
+
{avatar}
|
|
44
|
+
|
|
45
|
+
<div className="actions flex items-center gap-2.5 text-[#666]">
|
|
46
|
+
<IconBtn
|
|
47
|
+
onMouseDown={(e) => {
|
|
48
|
+
// 阻止事件冒泡,避免触发拖拽
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
}}
|
|
51
|
+
tooltip={isDocked ? '悬浮' : '右侧打开'}
|
|
52
|
+
// className="hover:!bg-[#ffffff]"
|
|
53
|
+
icon={isDocked ? <FloatIcon /> : <DockIcon />}
|
|
54
|
+
onClick={onDockClick}
|
|
55
|
+
/>
|
|
56
|
+
<IconBtn
|
|
57
|
+
// tooltip="关闭"
|
|
58
|
+
// className="hover:!bg-[#ffffff]"
|
|
59
|
+
icon={<CloseIcon />}
|
|
60
|
+
onClick={onCloseClick}
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { cn } from '../lib/utils';
|
|
3
|
+
import { CheckerInBoxIcon } from './bs-icons';
|
|
4
|
+
|
|
5
|
+
export interface CircleCheckerProps {
|
|
6
|
+
defaultChecked?: boolean;
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const CircleChecker = ({
|
|
15
|
+
defaultChecked = false,
|
|
16
|
+
checked: controlledChecked,
|
|
17
|
+
onCheckedChange,
|
|
18
|
+
children,
|
|
19
|
+
disabled = false,
|
|
20
|
+
className,
|
|
21
|
+
}: CircleCheckerProps) => {
|
|
22
|
+
const [internalChecked, setInternalChecked] = useState(defaultChecked);
|
|
23
|
+
|
|
24
|
+
const isControlled = controlledChecked !== undefined;
|
|
25
|
+
const isChecked = isControlled ? controlledChecked : internalChecked;
|
|
26
|
+
|
|
27
|
+
const handleClick = () => {
|
|
28
|
+
if (disabled) return;
|
|
29
|
+
|
|
30
|
+
const newChecked = !isChecked;
|
|
31
|
+
if (!isControlled) {
|
|
32
|
+
setInternalChecked(newChecked);
|
|
33
|
+
}
|
|
34
|
+
onCheckedChange?.(newChecked);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<button
|
|
39
|
+
type="button"
|
|
40
|
+
role="checkbox"
|
|
41
|
+
aria-checked={isChecked}
|
|
42
|
+
disabled={disabled}
|
|
43
|
+
onClick={handleClick}
|
|
44
|
+
className={cn(
|
|
45
|
+
'inline-flex items-center gap-[6px] cursor-pointer select-none',
|
|
46
|
+
'text-[#121111] text-[14px]',
|
|
47
|
+
disabled && 'cursor-not-allowed opacity-50',
|
|
48
|
+
className
|
|
49
|
+
)}
|
|
50
|
+
>
|
|
51
|
+
<span
|
|
52
|
+
className={cn(
|
|
53
|
+
'inline-flex items-center justify-center w-4 h-4 rounded-full transition-colors duration-200 box-border border',
|
|
54
|
+
isChecked ? 'bg-[#2E60FF] border-transparent' : 'bg-white border-[#e0e0e0]'
|
|
55
|
+
)}
|
|
56
|
+
>
|
|
57
|
+
{isChecked && (
|
|
58
|
+
<span className="text-white">
|
|
59
|
+
<CheckerInBoxIcon />
|
|
60
|
+
</span>
|
|
61
|
+
)}
|
|
62
|
+
</span>
|
|
63
|
+
{children && <span className="text-sm">{children}</span>}
|
|
64
|
+
</button>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ReactNode, useState } from 'react';
|
|
2
|
+
import { cn } from '../lib/utils';
|
|
3
|
+
import { transCls } from '../const/ui';
|
|
4
|
+
import { AnalysisIcon, ChevronIcon } from './bs-icons';
|
|
5
|
+
|
|
6
|
+
export interface CollapsibleTxtMsgProps {
|
|
7
|
+
title: string;
|
|
8
|
+
content?: string;
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
|
|
13
|
+
disableExpand?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const CollapsibleTxtMsg = ({
|
|
17
|
+
title,
|
|
18
|
+
content,
|
|
19
|
+
icon,
|
|
20
|
+
disableExpand,
|
|
21
|
+
children,
|
|
22
|
+
defaultOpen,
|
|
23
|
+
}: CollapsibleTxtMsgProps) => {
|
|
24
|
+
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className="bg-[#fafafa] border border-[#e0e0e0] border-solid flex flex-col gap-2.5 p-2.5 rounded-lg w-full">
|
|
28
|
+
<div
|
|
29
|
+
className={cn('flex items-center justify-between w-full', {
|
|
30
|
+
'cursor-pointer': !disableExpand,
|
|
31
|
+
})}
|
|
32
|
+
onClick={() => {
|
|
33
|
+
if (disableExpand) return;
|
|
34
|
+
|
|
35
|
+
setIsOpen(!isOpen);
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<div className="flex gap-2.5 items-center">
|
|
39
|
+
<div className="w-4 h-4 shrink-0 flex items-center">{icon || <AnalysisIcon />}</div>
|
|
40
|
+
<p className="text-[#666] text-[14px] leading-normal">{title}</p>
|
|
41
|
+
</div>
|
|
42
|
+
<button
|
|
43
|
+
onClick={() => {
|
|
44
|
+
if (disableExpand) return;
|
|
45
|
+
setIsOpen(!isOpen);
|
|
46
|
+
}}
|
|
47
|
+
className={cn(
|
|
48
|
+
'flex items-center justify-center w-5 h-5 rounded-[4px] cursor-pointer hover:bg-[#EFF0F6]',
|
|
49
|
+
transCls,
|
|
50
|
+
{
|
|
51
|
+
'pointer-events-none opacity-0': disableExpand,
|
|
52
|
+
}
|
|
53
|
+
)}
|
|
54
|
+
>
|
|
55
|
+
<ChevronIcon isOpen={isOpen} />
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|
|
58
|
+
{isOpen && !disableExpand && (
|
|
59
|
+
<div className="text-[#121111] text-[14px] word-wrap">{content || children}</div>
|
|
60
|
+
)}
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Dialog,
|
|
3
|
+
DialogContent,
|
|
4
|
+
DialogDescription,
|
|
5
|
+
DialogFooter,
|
|
6
|
+
DialogHeader,
|
|
7
|
+
DialogTitle,
|
|
8
|
+
} from './ui/dialog';
|
|
9
|
+
import { QuestionIcon } from './bs-icons';
|
|
10
|
+
import { cn } from '../lib/utils';
|
|
11
|
+
import { BaseButton } from './base-button';
|
|
12
|
+
|
|
13
|
+
export interface ConfirmDialogProps {
|
|
14
|
+
open?: boolean;
|
|
15
|
+
onOpenChange?: (open: boolean) => void;
|
|
16
|
+
title: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
/** Text for the left link button */
|
|
19
|
+
linkText?: string;
|
|
20
|
+
/** Callback when link button is clicked */
|
|
21
|
+
onLinkClick?: () => void;
|
|
22
|
+
/** Text for the cancel button */
|
|
23
|
+
cancelText?: string;
|
|
24
|
+
/** Callback when cancel button is clicked */
|
|
25
|
+
onCancel?: () => void;
|
|
26
|
+
/** Text for the confirm button */
|
|
27
|
+
confirmText?: string;
|
|
28
|
+
/** Callback when confirm button is clicked */
|
|
29
|
+
onConfirm?: () => void;
|
|
30
|
+
/** Whether to show the link button */
|
|
31
|
+
showLink?: boolean;
|
|
32
|
+
/** Whether to show the cancel button */
|
|
33
|
+
showCancel?: boolean;
|
|
34
|
+
/** Container element for the dialog portal */
|
|
35
|
+
container?: HTMLElement;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function ConfirmDialog({
|
|
39
|
+
open,
|
|
40
|
+
onOpenChange,
|
|
41
|
+
title,
|
|
42
|
+
description,
|
|
43
|
+
linkText = '留在此页',
|
|
44
|
+
onLinkClick,
|
|
45
|
+
cancelText = '不保存',
|
|
46
|
+
onCancel,
|
|
47
|
+
confirmText = '保存并继续',
|
|
48
|
+
onConfirm,
|
|
49
|
+
container,
|
|
50
|
+
showLink = true,
|
|
51
|
+
showCancel = true,
|
|
52
|
+
}: ConfirmDialogProps) {
|
|
53
|
+
const btnStyle = {
|
|
54
|
+
borderRadius: 4,
|
|
55
|
+
padding: '6px 20px',
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
60
|
+
<DialogContent
|
|
61
|
+
container={container}
|
|
62
|
+
className={cn(
|
|
63
|
+
'w-[480px] max-w-[480px] p-0 gap-0 rounded-[10px] border-none',
|
|
64
|
+
'shadow-[0px_0px_10px_0px_rgba(0,0,0,0.04)]',
|
|
65
|
+
'[&>button]:hidden'
|
|
66
|
+
)}
|
|
67
|
+
>
|
|
68
|
+
<DialogHeader className="flex flex-row items-start gap-[10px] p-9 pb-0">
|
|
69
|
+
<div className="size-[30px] shrink-0 text-[#0265FF]">
|
|
70
|
+
<QuestionIcon />
|
|
71
|
+
</div>
|
|
72
|
+
<div className="flex flex-col gap-2">
|
|
73
|
+
<DialogTitle className="text-[16px] font-[700] text-[#030303] leading-normal">
|
|
74
|
+
{title}
|
|
75
|
+
</DialogTitle>
|
|
76
|
+
{description && (
|
|
77
|
+
<DialogDescription className="text-[14px] text-[#666] leading-normal">
|
|
78
|
+
{description}
|
|
79
|
+
</DialogDescription>
|
|
80
|
+
)}
|
|
81
|
+
</div>
|
|
82
|
+
</DialogHeader>
|
|
83
|
+
|
|
84
|
+
<DialogFooter className="flex flex-row items-center !justify-between p-9 pt-6">
|
|
85
|
+
{showLink ? (
|
|
86
|
+
<button
|
|
87
|
+
type="button"
|
|
88
|
+
className="text-[14px] text-[#0265ff] hover:text-[#0265ff]/80 bg-transparent border-none cursor-pointer"
|
|
89
|
+
onClick={onLinkClick || (() => {
|
|
90
|
+
console.log('Link clicked');
|
|
91
|
+
|
|
92
|
+
onOpenChange?.(false);
|
|
93
|
+
})}
|
|
94
|
+
>
|
|
95
|
+
{linkText}
|
|
96
|
+
</button>
|
|
97
|
+
) : (
|
|
98
|
+
<div />
|
|
99
|
+
)}
|
|
100
|
+
|
|
101
|
+
<div className="flex items-center gap-3">
|
|
102
|
+
{showCancel && (
|
|
103
|
+
<BaseButton
|
|
104
|
+
className="hover:text-[#121111]"
|
|
105
|
+
onClick={onCancel}
|
|
106
|
+
>
|
|
107
|
+
{cancelText}
|
|
108
|
+
</BaseButton>
|
|
109
|
+
// <button
|
|
110
|
+
// type="button"
|
|
111
|
+
// onClick={onCancel}
|
|
112
|
+
// style={btnStyle}
|
|
113
|
+
// className={cn(
|
|
114
|
+
// 'h-8 px-5 py-1.5 rounded border border-[#e0e0e0]',
|
|
115
|
+
// 'text-[14px] text-[#030303] bg-white',
|
|
116
|
+
// 'hover:bg-gray-50 cursor-pointer'
|
|
117
|
+
// )}
|
|
118
|
+
// >
|
|
119
|
+
// {cancelText}
|
|
120
|
+
// </button>
|
|
121
|
+
)}
|
|
122
|
+
<button
|
|
123
|
+
type="button"
|
|
124
|
+
onClick={onConfirm}
|
|
125
|
+
style={btnStyle}
|
|
126
|
+
className={cn(
|
|
127
|
+
// 'h-8 px-5 py-1.5 rounded',
|
|
128
|
+
'text-[14px] text-white bg-[#0265ff]',
|
|
129
|
+
'hover:bg-[#0265ff]/80 cursor-pointer border-none'
|
|
130
|
+
)}
|
|
131
|
+
>
|
|
132
|
+
{confirmText}
|
|
133
|
+
</button>
|
|
134
|
+
</div>
|
|
135
|
+
</DialogFooter>
|
|
136
|
+
</DialogContent>
|
|
137
|
+
</Dialog>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { MessageContent } from './message-content';
|
|
3
|
+
import { cn } from '../lib/utils';
|
|
4
|
+
|
|
5
|
+
export const FakeBotMessage = ({
|
|
6
|
+
children,
|
|
7
|
+
headless,
|
|
8
|
+
className,
|
|
9
|
+
}: {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
headless?: boolean;
|
|
12
|
+
offset?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
}) => {
|
|
15
|
+
if (headless) {
|
|
16
|
+
return (
|
|
17
|
+
<div>
|
|
18
|
+
<MessageContent
|
|
19
|
+
className={cn(
|
|
20
|
+
'w-fit wrap-break-words rounded-2 bg-transparent px-0 py-0 text-left',
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
data-testid="message-content"
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</MessageContent>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div
|
|
33
|
+
className={cn('group/message w-full')}
|
|
34
|
+
data-role="assistant"
|
|
35
|
+
data-testid={`message-assistant`}
|
|
36
|
+
>
|
|
37
|
+
<div className="flex w-full flex-col items-start justify-start gap-2.5">
|
|
38
|
+
<div className="flex flex-col min-w-0 grow gap-2.5 w-full">
|
|
39
|
+
<MessageContent
|
|
40
|
+
className="w-full wrap-break-words rounded-2 bg-transparent px-0 py-0 text-left"
|
|
41
|
+
data-testid="message-content"
|
|
42
|
+
>
|
|
43
|
+
{children}
|
|
44
|
+
</MessageContent>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { useState, useCallback, useMemo } from 'react';
|
|
2
|
+
import { IFieldDesignInfo } from '@baishuyun/types';
|
|
3
|
+
import { cn } from '../lib/utils';
|
|
4
|
+
import { ChevronIcon } from './bs-icons';
|
|
5
|
+
|
|
6
|
+
interface FieldsDesignInfoTableProps {
|
|
7
|
+
fields: IFieldDesignInfo[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Group fields into top-level items and subform groups */
|
|
11
|
+
function groupFields(fields: IFieldDesignInfo[]) {
|
|
12
|
+
const groups: Array<
|
|
13
|
+
| { kind: 'field'; field: IFieldDesignInfo }
|
|
14
|
+
| { kind: 'subform'; parent: IFieldDesignInfo; children: IFieldDesignInfo[] }
|
|
15
|
+
> = [];
|
|
16
|
+
|
|
17
|
+
let i = 0;
|
|
18
|
+
while (i < fields.length) {
|
|
19
|
+
const f = fields[i];
|
|
20
|
+
if (f.isSubForm) {
|
|
21
|
+
const children: IFieldDesignInfo[] = [];
|
|
22
|
+
let j = i + 1;
|
|
23
|
+
while (
|
|
24
|
+
j < fields.length &&
|
|
25
|
+
fields[j].isFieldInSubForm &&
|
|
26
|
+
fields[j].parentFormName === f.fieldName
|
|
27
|
+
) {
|
|
28
|
+
children.push(fields[j]);
|
|
29
|
+
j++;
|
|
30
|
+
}
|
|
31
|
+
groups.push({ kind: 'subform', parent: f, children });
|
|
32
|
+
i = j;
|
|
33
|
+
} else {
|
|
34
|
+
groups.push({ kind: 'field', field: f });
|
|
35
|
+
i++;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return groups;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const cellCls = 'flex items-center px-1.5 py-2.5 text-xs leading-normal';
|
|
42
|
+
|
|
43
|
+
function FieldRow({
|
|
44
|
+
field,
|
|
45
|
+
isSubFormChild = false,
|
|
46
|
+
}: {
|
|
47
|
+
field: IFieldDesignInfo;
|
|
48
|
+
isSubFormChild?: boolean;
|
|
49
|
+
}) {
|
|
50
|
+
return (
|
|
51
|
+
<div className="flex items-center w-full">
|
|
52
|
+
{/* 名称 */}
|
|
53
|
+
<div className={cn(cellCls, 'w-20 shrink-0 min-h-[34px]')}>
|
|
54
|
+
{isSubFormChild && (
|
|
55
|
+
<span className="inline-flex items-center justify-center shrink-0 w-5 h-5 opacity-0">
|
|
56
|
+
<ChevronIcon />
|
|
57
|
+
</span>
|
|
58
|
+
)}
|
|
59
|
+
<span>{field.fieldName}</span>
|
|
60
|
+
</div>
|
|
61
|
+
{/* 类型 */}
|
|
62
|
+
<div className={cn(cellCls, 'w-[72px] shrink-0 min-h-[34px]')}>
|
|
63
|
+
{field.type}
|
|
64
|
+
</div>
|
|
65
|
+
{/* 必填 */}
|
|
66
|
+
<div className={cn(cellCls, 'w-9 shrink-0 min-h-[34px]')}>
|
|
67
|
+
{field.required ? '是' : '否'}
|
|
68
|
+
</div>
|
|
69
|
+
{/* 说明 */}
|
|
70
|
+
<div className={cn(cellCls, 'flex-1 min-w-0 min-h-[34px]')}>
|
|
71
|
+
<span className="break-words min-w-0">{field.description}</span>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function SubFormGroup({
|
|
78
|
+
parent,
|
|
79
|
+
children,
|
|
80
|
+
}: {
|
|
81
|
+
parent: IFieldDesignInfo;
|
|
82
|
+
children: IFieldDesignInfo[];
|
|
83
|
+
}) {
|
|
84
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
85
|
+
const toggle = useCallback(() => setIsOpen((v) => !v), []);
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<>
|
|
89
|
+
{/* 子表单 parent row */}
|
|
90
|
+
<div className="flex items-center w-full">
|
|
91
|
+
{/* 名称 */}
|
|
92
|
+
<div className={cn(cellCls, 'w-20 shrink-0 min-h-[34px]')}>
|
|
93
|
+
<button
|
|
94
|
+
type="button"
|
|
95
|
+
onClick={toggle}
|
|
96
|
+
className="inline-flex items-center justify-center shrink-0 w-5 h-5 rounded cursor-pointer text-[#666] relative -left-[2px]"
|
|
97
|
+
>
|
|
98
|
+
<ChevronIcon isOpen={isOpen} />
|
|
99
|
+
</button>
|
|
100
|
+
<span>{parent.fieldName}</span>
|
|
101
|
+
</div>
|
|
102
|
+
{/* 类型 */}
|
|
103
|
+
<div className={cn(cellCls, 'w-[72px] shrink-0 min-h-[34px] ')}>
|
|
104
|
+
{parent.type}
|
|
105
|
+
</div>
|
|
106
|
+
{/* 必填 */}
|
|
107
|
+
<div className={cn(cellCls, 'w-9 shrink-0 min-h-[34px]')}>
|
|
108
|
+
{parent.required ? '是' : '否'}
|
|
109
|
+
</div>
|
|
110
|
+
{/* 说明 */}
|
|
111
|
+
<div className={cn(cellCls, 'flex-1 min-w-0 min-h-[34px]')}>
|
|
112
|
+
<span className="break-words min-w-0">{parent.description}</span>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
{/* 子表单 children */}
|
|
117
|
+
{isOpen && children.map((child, idx) => <FieldRow key={idx} field={child} isSubFormChild />)}
|
|
118
|
+
</>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function FieldsDesignInfoTable({ fields }: FieldsDesignInfoTableProps) {
|
|
123
|
+
const groups = useMemo(() => groupFields(fields), [fields]);
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<div className="flex flex-col items-start w-full bg-white rounded-[10px] overflow-hidden text-black my-[10px] border border-[#E0E0E0]">
|
|
127
|
+
{/* 表头 */}
|
|
128
|
+
<div className="flex items-center w-full shrink-0 bg-[#E5E6EB] rounded-t-[10px] border-b border-[#E0E0E0]">
|
|
129
|
+
<div className={cn(cellCls, 'w-20 shrink-0 h-[34px] font-bold')}>
|
|
130
|
+
名称
|
|
131
|
+
</div>
|
|
132
|
+
<div className={cn(cellCls, 'w-[72px] shrink-0 h-[34px] font-bold')}>
|
|
133
|
+
类型
|
|
134
|
+
</div>
|
|
135
|
+
<div
|
|
136
|
+
className={cn(
|
|
137
|
+
cellCls,
|
|
138
|
+
'w-9 shrink-0 h-[34px] font-bold justify-center'
|
|
139
|
+
)}
|
|
140
|
+
>
|
|
141
|
+
必填
|
|
142
|
+
</div>
|
|
143
|
+
<div className={cn(cellCls, 'flex-1 min-w-0 h-[34px] font-bold')}>
|
|
144
|
+
说明
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
|
|
148
|
+
{/* 表体 */}
|
|
149
|
+
<div className="flex flex-col items-start w-full">
|
|
150
|
+
{groups.map((g, idx) =>
|
|
151
|
+
g.kind === 'field' ? (
|
|
152
|
+
<FieldRow key={idx} field={g.field} />
|
|
153
|
+
) : (
|
|
154
|
+
<SubFormGroup key={idx} parent={g.parent} children={g.children} />
|
|
155
|
+
)
|
|
156
|
+
)}
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
+
import { BorderColorAnimation } from './border-color-animation';
|
|
3
|
+
import { MagicIcon } from './bs-icons';
|
|
4
|
+
|
|
5
|
+
export const DotAnimation = () => {
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<div className="flex gap-[2px] flex-shrink-0 relative -left-[4px] top-[3px]">
|
|
9
|
+
<div
|
|
10
|
+
className="w-[2px] h-[2px] rounded-full bg-[#0265FF] flex-shrink-0"
|
|
11
|
+
style={{
|
|
12
|
+
animation: 'pulse 1.4s ease-in-out infinite',
|
|
13
|
+
animationDelay: '0s',
|
|
14
|
+
marginRight: '2px',
|
|
15
|
+
}}
|
|
16
|
+
/>
|
|
17
|
+
<div
|
|
18
|
+
className="w-[2px] h-[2px] rounded-full bg-[#0265FF] flex-shrink-0"
|
|
19
|
+
style={{
|
|
20
|
+
animation: 'pulse 1.4s ease-in-out infinite',
|
|
21
|
+
animationDelay: '0.2s',
|
|
22
|
+
marginRight: '2px',
|
|
23
|
+
}}
|
|
24
|
+
/>
|
|
25
|
+
<div
|
|
26
|
+
className="w-[2px] h-[2px] rounded-full bg-[#0265FF] flex-shrink-0"
|
|
27
|
+
style={{
|
|
28
|
+
animation: 'pulse 1.4s ease-in-out infinite',
|
|
29
|
+
animationDelay: '0.4s',
|
|
30
|
+
}}
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
<style>{`
|
|
34
|
+
@keyframes pulse {
|
|
35
|
+
0%, 60%, 100% {
|
|
36
|
+
opacity: 0.3;
|
|
37
|
+
transform: scale(1);
|
|
38
|
+
}
|
|
39
|
+
30% {
|
|
40
|
+
opacity: 1;
|
|
41
|
+
transform: scale(1.2);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`}</style>
|
|
45
|
+
</>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const FieldsGeneratingIndicator = ({
|
|
50
|
+
children,
|
|
51
|
+
loading = true,
|
|
52
|
+
}: {
|
|
53
|
+
children?: React.ReactNode;
|
|
54
|
+
loading?: boolean;
|
|
55
|
+
}) => {
|
|
56
|
+
const paddingAndGap = 16 * 2 + 6; // padding + gap
|
|
57
|
+
const animationWidth = loading ? 14 : 0;
|
|
58
|
+
const magicIconWidth = 16;
|
|
59
|
+
const textRef = useRef<HTMLSpanElement>(null);
|
|
60
|
+
const [textWidth, setWidth] = useState(0);
|
|
61
|
+
|
|
62
|
+
// get text width + padding + gap
|
|
63
|
+
const fullWidth = textWidth + paddingAndGap + animationWidth + magicIconWidth;
|
|
64
|
+
|
|
65
|
+
// when text changes, update width
|
|
66
|
+
useLayoutEffect(() => {
|
|
67
|
+
if (textRef.current) {
|
|
68
|
+
const rect = textRef.current.getBoundingClientRect();
|
|
69
|
+
setWidth(rect.width);
|
|
70
|
+
}
|
|
71
|
+
}, [children]);
|
|
72
|
+
|
|
73
|
+
// when text not change, get init width
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (textRef.current) {
|
|
76
|
+
const rect = textRef.current.getBoundingClientRect();
|
|
77
|
+
console.log('rect.width', rect.width);
|
|
78
|
+
setWidth(rect.width);
|
|
79
|
+
}
|
|
80
|
+
}, []);
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<BorderColorAnimation borderRadius={100} width={fullWidth} height={34} borderWidth={1}>
|
|
84
|
+
<div className="flex items-center gap-[6px] h-[31px] ml-[16px]">
|
|
85
|
+
<div className="shrink-0">
|
|
86
|
+
<MagicIcon />
|
|
87
|
+
</div>
|
|
88
|
+
<span className="text-[14px] text-[#0265FF] shrink-0" ref={textRef}>
|
|
89
|
+
{children || '字段生成中'}
|
|
90
|
+
</span>
|
|
91
|
+
{loading && <DotAnimation />}
|
|
92
|
+
</div>
|
|
93
|
+
</BorderColorAnimation>
|
|
94
|
+
);
|
|
95
|
+
};
|