@baishuyun/chat-sdk 0.1.8 → 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/.turbo/turbo-build.log +8 -107
- package/CHANGELOG.md +18 -0
- package/dist/chat-sdk.js +14087 -13890
- package/dist/chat-sdk.js.map +1 -1
- package/dist/chat-sdk.umd.cjs +150 -150
- package/dist/chat-sdk.umd.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/src/chat.d.ts +5 -0
- package/dist/src/chat.d.ts.map +1 -0
- package/dist/src/components/biz-comp/FakeBotMsg.d.ts +8 -0
- package/dist/src/components/biz-comp/FakeBotMsg.d.ts.map +1 -0
- package/dist/src/components/biz-comp/FieldChecker.d.ts +19 -0
- package/dist/src/components/biz-comp/FieldChecker.d.ts.map +1 -0
- package/dist/src/components/biz-comp/FieldCheckerListMsg.d.ts +19 -0
- package/dist/src/components/biz-comp/FieldCheckerListMsg.d.ts.map +1 -0
- package/dist/src/components/biz-comp/FieldValueChecker.d.ts +16 -0
- package/dist/src/components/biz-comp/FieldValueChecker.d.ts.map +1 -0
- package/dist/src/components/biz-comp/SubformFieldsValueChecker.d.ts +22 -0
- package/dist/src/components/biz-comp/SubformFieldsValueChecker.d.ts.map +1 -0
- package/dist/src/components/biz-comp/chat-client.d.ts +13 -0
- package/dist/src/components/biz-comp/chat-client.d.ts.map +1 -0
- package/dist/src/components/biz-comp/chat-frame.d.ts +6 -0
- package/dist/src/components/biz-comp/chat-frame.d.ts.map +1 -0
- package/dist/src/components/biz-comp/conversation.d.ts +10 -0
- package/dist/src/components/biz-comp/conversation.d.ts.map +1 -0
- package/dist/src/components/biz-comp/dash-widget-icon.d.ts +7 -0
- package/dist/src/components/biz-comp/dash-widget-icon.d.ts.map +1 -0
- package/dist/src/components/biz-comp/dock-btn.d.ts +2 -0
- package/dist/src/components/biz-comp/dock-btn.d.ts.map +1 -0
- package/dist/src/components/biz-comp/error-boundary.d.ts +15 -0
- package/dist/src/components/biz-comp/error-boundary.d.ts.map +1 -0
- package/dist/src/components/biz-comp/error-msg.d.ts +4 -0
- package/dist/src/components/biz-comp/error-msg.d.ts.map +1 -0
- package/dist/src/components/biz-comp/field-icon.d.ts +5 -0
- package/dist/src/components/biz-comp/field-icon.d.ts.map +1 -0
- package/dist/src/components/biz-comp/highlight-msg.d.ts +4 -0
- package/dist/src/components/biz-comp/highlight-msg.d.ts.map +1 -0
- package/dist/src/components/biz-comp/markdown-part.d.ts +7 -0
- package/dist/src/components/biz-comp/markdown-part.d.ts.map +1 -0
- package/dist/src/components/biz-comp/markdown.d.ts +5 -0
- package/dist/src/components/biz-comp/markdown.d.ts.map +1 -0
- package/dist/src/components/biz-comp/message-content.d.ts +6 -0
- package/dist/src/components/biz-comp/message-content.d.ts.map +1 -0
- package/dist/src/components/biz-comp/messages.d.ts +3 -0
- package/dist/src/components/biz-comp/messages.d.ts.map +1 -0
- package/dist/src/components/biz-comp/multi-modal-input/attachment-btn.d.ts +9 -0
- package/dist/src/components/biz-comp/multi-modal-input/attachment-btn.d.ts.map +1 -0
- package/dist/src/components/biz-comp/multi-modal-input/clear-btn.d.ts +8 -0
- package/dist/src/components/biz-comp/multi-modal-input/clear-btn.d.ts.map +1 -0
- package/dist/src/components/biz-comp/multi-modal-input/index.d.ts +22 -0
- package/dist/src/components/biz-comp/multi-modal-input/index.d.ts.map +1 -0
- package/dist/src/components/biz-comp/multi-modal-input/preview-attachment.d.ts +12 -0
- package/dist/src/components/biz-comp/multi-modal-input/preview-attachment.d.ts.map +1 -0
- package/dist/src/components/biz-comp/multi-modal-input/prompt-input.d.ts +36 -0
- package/dist/src/components/biz-comp/multi-modal-input/prompt-input.d.ts.map +1 -0
- package/dist/src/components/biz-comp/multi-modal-input/voice-btn.d.ts +9 -0
- package/dist/src/components/biz-comp/multi-modal-input/voice-btn.d.ts.map +1 -0
- package/dist/src/components/biz-comp/opening-lines.d.ts +3 -0
- package/dist/src/components/biz-comp/opening-lines.d.ts.map +1 -0
- package/dist/src/components/biz-comp/preview-message-wrapper.d.ts +12 -0
- package/dist/src/components/biz-comp/preview-message-wrapper.d.ts.map +1 -0
- package/dist/src/components/biz-comp/preview-message.d.ts +13 -0
- package/dist/src/components/biz-comp/preview-message.d.ts.map +1 -0
- package/dist/src/components/biz-comp/response.d.ts +6 -0
- package/dist/src/components/biz-comp/response.d.ts.map +1 -0
- package/dist/src/components/biz-comp/suggestions.d.ts +8 -0
- package/dist/src/components/biz-comp/suggestions.d.ts.map +1 -0
- package/dist/src/components/ui/badge.d.ts +10 -0
- package/dist/src/components/ui/badge.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/card.d.ts +9 -0
- package/dist/src/components/ui/card.d.ts.map +1 -0
- package/dist/src/components/ui/checkbox.d.ts +5 -0
- package/dist/src/components/ui/checkbox.d.ts.map +1 -0
- package/dist/src/components/ui/collapsible.d.ts +6 -0
- package/dist/src/components/ui/collapsible.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/dropdown-menu.d.ts +28 -0
- package/dist/src/components/ui/dropdown-menu.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/input-group.d.ts +17 -0
- package/dist/src/components/ui/input-group.d.ts.map +1 -0
- package/dist/src/components/ui/input.d.ts +4 -0
- package/dist/src/components/ui/input.d.ts.map +1 -0
- package/dist/src/components/ui/label.d.ts +6 -0
- package/dist/src/components/ui/label.d.ts.map +1 -0
- package/dist/src/components/ui/one-time-click-btn.d.ts +4 -0
- package/dist/src/components/ui/one-time-click-btn.d.ts.map +1 -0
- package/dist/src/components/ui/select.d.ts +14 -0
- package/dist/src/components/ui/select.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/tabs.d.ts +8 -0
- package/dist/src/components/ui/tabs.d.ts.map +1 -0
- package/dist/src/components/ui/textarea.d.ts +4 -0
- package/dist/src/components/ui/textarea.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/web-comp/fields-previewer-web-component.d.ts +60 -0
- package/dist/src/components/web-comp/fields-previewer-web-component.d.ts.map +1 -0
- package/dist/src/const/index.d.ts +5 -0
- package/dist/src/const/index.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-chat-preference.d.ts +3 -0
- package/dist/src/hooks/use-chat-preference.d.ts.map +1 -0
- package/dist/src/hooks/use-draggable.d.ts +24 -0
- package/dist/src/hooks/use-draggable.d.ts.map +1 -0
- package/dist/src/hooks/use-evt-bus.d.ts +2 -0
- package/dist/src/hooks/use-evt-bus.d.ts.map +1 -0
- package/dist/src/hooks/use-evt.d.ts +3 -0
- package/dist/src/hooks/use-evt.d.ts.map +1 -0
- package/dist/src/hooks/use-frame-mode.d.ts +20 -0
- package/dist/src/hooks/use-frame-mode.d.ts.map +1 -0
- package/dist/src/hooks/use-merged-chat.d.ts +7 -0
- package/dist/src/hooks/use-merged-chat.d.ts.map +1 -0
- package/dist/src/hooks/use-msg-status-broadcast.d.ts +3 -0
- package/dist/src/hooks/use-msg-status-broadcast.d.ts.map +1 -0
- package/dist/src/hooks/use-plugin-component.d.ts +5 -0
- package/dist/src/hooks/use-plugin-component.d.ts.map +1 -0
- package/dist/src/hooks/use-plugin-ctx.d.ts +3 -0
- package/dist/src/hooks/use-plugin-ctx.d.ts.map +1 -0
- package/dist/src/hooks/use-plugin-custom-components.d.ts +5 -0
- package/dist/src/hooks/use-plugin-custom-components.d.ts.map +1 -0
- package/dist/src/hooks/use-plugin-life-cycle-chain-runner.d.ts +5 -0
- package/dist/src/hooks/use-plugin-life-cycle-chain-runner.d.ts.map +1 -0
- package/dist/src/hooks/use-plugin-list.d.ts +2 -0
- package/dist/src/hooks/use-plugin-list.d.ts.map +1 -0
- package/dist/src/hooks/use-plugin.d.ts +2 -0
- package/dist/src/hooks/use-plugin.d.ts.map +1 -0
- package/dist/src/hooks/use-scroll-to-bottom.d.ts +9 -0
- package/dist/src/hooks/use-scroll-to-bottom.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/hooks/use-streaming-anchor.d.ts +11 -0
- package/dist/src/hooks/use-streaming-anchor.d.ts.map +1 -0
- package/dist/src/hooks/use-toast.d.ts +3 -0
- package/dist/src/hooks/use-toast.d.ts.map +1 -0
- package/dist/src/hooks/use-voice-input.d.ts +31 -0
- package/dist/src/hooks/use-voice-input.d.ts.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lib/clone.d.ts +32 -0
- package/dist/src/lib/clone.d.ts.map +1 -0
- package/dist/src/lib/event-emitter.d.ts +39 -0
- package/dist/src/lib/event-emitter.d.ts.map +1 -0
- package/dist/src/lib/parse-design-doc.d.ts +16 -0
- package/dist/src/lib/parse-design-doc.d.ts.map +1 -0
- package/dist/src/lib/readonly.d.ts +14 -0
- package/dist/src/lib/readonly.d.ts.map +1 -0
- package/dist/src/lib/utils.d.ts +72 -0
- package/dist/src/lib/utils.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-base-plugin/const.d.ts +3 -0
- package/dist/src/plugins/form-builder-base-plugin/const.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-base-plugin/index.d.ts +7 -0
- package/dist/src/plugins/form-builder-base-plugin/index.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-base-plugin/types.d.ts +12 -0
- package/dist/src/plugins/form-builder-base-plugin/types.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-plugin/components/create-form-confirm.d.ts +7 -0
- package/dist/src/plugins/form-builder-plugin/components/create-form-confirm.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-plugin/components/design-doc-part.d.ts +4 -0
- package/dist/src/plugins/form-builder-plugin/components/design-doc-part.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-plugin/components/design-info.d.ts +6 -0
- package/dist/src/plugins/form-builder-plugin/components/design-info.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-plugin/components/entry-btn.d.ts +3 -0
- package/dist/src/plugins/form-builder-plugin/components/entry-btn.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-plugin/components/fields-part.d.ts +4 -0
- package/dist/src/plugins/form-builder-plugin/components/fields-part.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-plugin/components/follow-up.d.ts +3 -0
- package/dist/src/plugins/form-builder-plugin/components/follow-up.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-plugin/components/msg-part.d.ts +3 -0
- package/dist/src/plugins/form-builder-plugin/components/msg-part.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-plugin/components/opening-lines.d.ts +3 -0
- package/dist/src/plugins/form-builder-plugin/components/opening-lines.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-plugin/components/suggestion-part.d.ts +5 -0
- package/dist/src/plugins/form-builder-plugin/components/suggestion-part.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-plugin/const/index.d.ts +12 -0
- package/dist/src/plugins/form-builder-plugin/const/index.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-plugin/hooks/index.d.ts +4 -0
- package/dist/src/plugins/form-builder-plugin/hooks/index.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-plugin/hooks/use-fields-confirmed.d.ts +2 -0
- package/dist/src/plugins/form-builder-plugin/hooks/use-fields-confirmed.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-plugin/index.d.ts +30 -0
- package/dist/src/plugins/form-builder-plugin/index.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-plugin/types.d.ts +28 -0
- package/dist/src/plugins/form-builder-plugin/types.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-plugin/utils/get-render-strategy.d.ts +3 -0
- package/dist/src/plugins/form-builder-plugin/utils/get-render-strategy.d.ts.map +1 -0
- package/dist/src/plugins/form-builder-plugin/utils/index.d.ts +57 -0
- package/dist/src/plugins/form-builder-plugin/utils/index.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/batch-filling-data-manager.d.ts +26 -0
- package/dist/src/plugins/form-filling-plugin/batch-filling-data-manager.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/components/FormFillingOpeningLines.d.ts +3 -0
- package/dist/src/plugins/form-filling-plugin/components/FormFillingOpeningLines.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/components/avatar.d.ts +5 -0
- package/dist/src/plugins/form-filling-plugin/components/avatar.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/components/batch-fill-part.d.ts +4 -0
- package/dist/src/plugins/form-filling-plugin/components/batch-fill-part.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/components/batch-generator-action.d.ts +14 -0
- package/dist/src/plugins/form-filling-plugin/components/batch-generator-action.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/components/entry-btn.d.ts +3 -0
- package/dist/src/plugins/form-filling-plugin/components/entry-btn.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/components/first-batch-generating-animation.d.ts +2 -0
- package/dist/src/plugins/form-filling-plugin/components/first-batch-generating-animation.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/components/generated-data-counter.d.ts +5 -0
- package/dist/src/plugins/form-filling-plugin/components/generated-data-counter.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/components/mode-select.d.ts +2 -0
- package/dist/src/plugins/form-filling-plugin/components/mode-select.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/components/msg-part.d.ts +3 -0
- package/dist/src/plugins/form-filling-plugin/components/msg-part.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/components/non-first-batch-generating-animation.d.ts +2 -0
- package/dist/src/plugins/form-filling-plugin/components/non-first-batch-generating-animation.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/components/single-fill-part.d.ts +4 -0
- package/dist/src/plugins/form-filling-plugin/components/single-fill-part.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/const.d.ts +615 -0
- package/dist/src/plugins/form-filling-plugin/const.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/hooks/use-conversation-id-in-ctx.d.ts +3 -0
- package/dist/src/plugins/form-filling-plugin/hooks/use-conversation-id-in-ctx.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/hooks/use-fields-data.d.ts +4 -0
- package/dist/src/plugins/form-filling-plugin/hooks/use-fields-data.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/index.d.ts +22 -0
- package/dist/src/plugins/form-filling-plugin/index.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/types.d.ts +22 -0
- package/dist/src/plugins/form-filling-plugin/types.d.ts.map +1 -0
- package/dist/src/plugins/form-filling-plugin/utils.d.ts +6 -0
- package/dist/src/plugins/form-filling-plugin/utils.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/components/avatar.d.ts +5 -0
- package/dist/src/plugins/report-query-plugin/components/avatar.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/components/query-entry-btn.d.ts +3 -0
- package/dist/src/plugins/report-query-plugin/components/query-entry-btn.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/components/query-msg-part.d.ts +3 -0
- package/dist/src/plugins/report-query-plugin/components/query-msg-part.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/components/query-opening-lines.d.ts +2 -0
- package/dist/src/plugins/report-query-plugin/components/query-opening-lines.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/components/result-cards/CreatedSourceMsg.d.ts +7 -0
- package/dist/src/plugins/report-query-plugin/components/result-cards/CreatedSourceMsg.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/components/result-cards/DataTableCard.d.ts +5 -0
- package/dist/src/plugins/report-query-plugin/components/result-cards/DataTableCard.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/components/result-cards/DataTableFields.d.ts +18 -0
- package/dist/src/plugins/report-query-plugin/components/result-cards/DataTableFields.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/components/result-cards/FilterCondition.d.ts +4 -0
- package/dist/src/plugins/report-query-plugin/components/result-cards/FilterCondition.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/components/result-cards/FormulaField.d.ts +8 -0
- package/dist/src/plugins/report-query-plugin/components/result-cards/FormulaField.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/const.d.ts +5 -0
- package/dist/src/plugins/report-query-plugin/const.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/index.d.ts +19 -0
- package/dist/src/plugins/report-query-plugin/index.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/types.d.ts +18 -0
- package/dist/src/plugins/report-query-plugin/types.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/utils/build-dash-component.d.ts +17 -0
- package/dist/src/plugins/report-query-plugin/utils/build-dash-component.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/utils/create-default-dash-styles.d.ts +30 -0
- package/dist/src/plugins/report-query-plugin/utils/create-default-dash-styles.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/utils/create-default-widget-attr-list.d.ts +60 -0
- package/dist/src/plugins/report-query-plugin/utils/create-default-widget-attr-list.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/utils/field-enhance.d.ts +31 -0
- package/dist/src/plugins/report-query-plugin/utils/field-enhance.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/utils/get-field-group.d.ts +208 -0
- package/dist/src/plugins/report-query-plugin/utils/get-field-group.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/utils/get-field-icon.d.ts +4 -0
- package/dist/src/plugins/report-query-plugin/utils/get-field-icon.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/utils/get-group-rule.d.ts +4 -0
- package/dist/src/plugins/report-query-plugin/utils/get-group-rule.d.ts.map +1 -0
- package/dist/src/plugins/report-query-plugin/utils/index.d.ts +5 -0
- package/dist/src/plugins/report-query-plugin/utils/index.d.ts.map +1 -0
- package/dist/src/sdk.impl.d.ts +44 -0
- package/dist/src/sdk.impl.d.ts.map +1 -0
- package/dist/src/store/context.d.ts +12 -0
- package/dist/src/store/context.d.ts.map +1 -0
- package/dist/src/store/index.d.ts +14 -0
- package/dist/src/store/index.d.ts.map +1 -0
- package/dist/src/stories/FormulaField.stories.d.ts +24 -0
- package/dist/src/stories/FormulaField.stories.d.ts.map +1 -0
- package/package.json +5 -4
- package/src/components/biz-comp/FakeBotMsg.tsx +1 -1
- package/src/components/biz-comp/FieldChecker.tsx +2 -2
- package/src/components/biz-comp/FieldCheckerListMsg.tsx +3 -3
- package/src/components/biz-comp/FieldValueChecker.tsx +1 -1
- package/src/components/biz-comp/SubformFieldsValueChecker.tsx +1 -1
- package/src/components/biz-comp/chat-client.tsx +3 -3
- package/src/components/biz-comp/conversation.tsx +1 -1
- package/src/components/biz-comp/dash-widget-icon.tsx +1 -1
- package/src/components/biz-comp/field-icon.tsx +2 -2
- package/src/components/biz-comp/markdown-part.tsx +3 -3
- package/src/components/biz-comp/message-content.tsx +1 -1
- package/src/components/biz-comp/messages.tsx +5 -2
- package/src/components/biz-comp/multi-modal-input/clear-btn.tsx +2 -2
- package/src/components/biz-comp/multi-modal-input/index.tsx +9 -8
- package/src/components/biz-comp/multi-modal-input/prompt-input.tsx +2 -2
- package/src/components/biz-comp/multi-modal-input/voice-btn.tsx +2 -2
- package/src/components/biz-comp/preview-message-wrapper.tsx +14 -7
- package/src/components/biz-comp/preview-message.tsx +5 -5
- package/src/components/biz-comp/suggestions.tsx +2 -2
- package/src/components/web-comp/fields-previewer-web-component.ts +1 -1
- package/src/const/ui.ts +1 -1
- package/src/hooks/use-streaming-anchor.ts +42 -0
- package/src/plugins/form-builder-plugin/components/create-form-confirm.tsx +4 -4
- package/src/plugins/form-builder-plugin/components/design-info.tsx +3 -3
- package/src/plugins/form-builder-plugin/components/entry-btn.tsx +3 -3
- package/src/plugins/form-builder-plugin/components/fields-part.tsx +2 -2
- package/src/plugins/form-builder-plugin/components/follow-up.tsx +2 -2
- package/src/plugins/form-filling-plugin/components/FormFillingOpeningLines.tsx +1 -1
- package/src/plugins/form-filling-plugin/components/avatar.tsx +2 -2
- package/src/plugins/form-filling-plugin/components/batch-generator-action.tsx +1 -1
- package/src/plugins/form-filling-plugin/components/entry-btn.tsx +3 -3
- package/src/plugins/form-filling-plugin/components/first-batch-generating-animation.tsx +2 -2
- package/src/plugins/form-filling-plugin/components/generated-data-counter.tsx +1 -1
- package/src/plugins/form-filling-plugin/components/mode-select.tsx +1 -1
- package/src/plugins/form-filling-plugin/components/non-first-batch-generating-animation.tsx +3 -3
- package/src/plugins/form-filling-plugin/components/single-fill-part.tsx +1 -1
- package/src/plugins/report-query-plugin/components/avatar.tsx +2 -2
- package/src/plugins/report-query-plugin/components/query-entry-btn.tsx +2 -2
- package/src/plugins/report-query-plugin/components/query-opening-lines.tsx +1 -1
- package/src/plugins/report-query-plugin/components/result-cards/CreatedSourceMsg.tsx +1 -1
- package/src/plugins/report-query-plugin/components/result-cards/DataTableCard.tsx +3 -3
- package/src/plugins/report-query-plugin/components/result-cards/DataTableFields.tsx +3 -3
- package/src/plugins/report-query-plugin/components/result-cards/FormulaField.tsx +2 -2
- package/src/plugins/report-query-plugin/const.ts +1 -1
- package/src/style.css +2 -0
- package/tsconfig.json +5 -5
- package/src/components/bs-ui/abs-fullscreen-gradient-bg.tsx +0 -35
- package/src/components/bs-ui/attachment-part-group.tsx +0 -35
- package/src/components/bs-ui/attachment-part.tsx +0 -179
- package/src/components/bs-ui/attachments-previewer.tsx +0 -324
- package/src/components/bs-ui/base-button.tsx +0 -49
- package/src/components/bs-ui/border-animation.tsx +0 -107
- package/src/components/bs-ui/border-color-animation.tsx +0 -66
- package/src/components/bs-ui/bot-avatar-name.tsx +0 -25
- package/src/components/bs-ui/bot-icon.tsx +0 -23
- package/src/components/bs-ui/bs-icons.tsx +0 -1115
- package/src/components/bs-ui/card-field.tsx +0 -23
- package/src/components/bs-ui/card.tsx +0 -36
- package/src/components/bs-ui/chat-area-header.tsx +0 -65
- package/src/components/bs-ui/circle-checker.tsx +0 -66
- package/src/components/bs-ui/collapsible-txt-msg.tsx +0 -63
- package/src/components/bs-ui/confirm-dialog.tsx +0 -139
- package/src/components/bs-ui/fields-design-info-table.tsx +0 -160
- package/src/components/bs-ui/fields-generating-indicator.tsx +0 -95
- package/src/components/bs-ui/fields-portal.tsx +0 -18
- package/src/components/bs-ui/fields-previewer.tsx +0 -210
- package/src/components/bs-ui/font-icon.tsx +0 -17
- package/src/components/bs-ui/form-info-editor.tsx +0 -259
- package/src/components/bs-ui/formula-tag.tsx +0 -32
- package/src/components/bs-ui/generate-animation.tsx +0 -56
- package/src/components/bs-ui/icon-btn.tsx +0 -43
- package/src/components/bs-ui/img-part.tsx +0 -27
- package/src/components/bs-ui/line-checker.tsx +0 -160
- package/src/components/bs-ui/linear-gradient-border-btn.tsx +0 -48
- package/src/components/bs-ui/linear-gradient-color-bg-animation.tsx +0 -103
- package/src/components/bs-ui/number-part.tsx +0 -46
- package/src/components/bs-ui/option-item.tsx +0 -28
- package/src/components/bs-ui/previewer-header.tsx +0 -233
- package/src/components/bs-ui/primary-confirm-btn.tsx +0 -58
- package/src/components/bs-ui/primary-entry-btn.tsx +0 -48
- package/src/components/bs-ui/scroll-to-bottom-btn.tsx +0 -28
- package/src/components/bs-ui/split-line.tsx +0 -9
- package/src/components/bs-ui/square-checker.tsx +0 -87
- package/src/components/bs-ui/tab-radio-group.tsx +0 -82
- package/src/components/bs-ui/tooltip.tsx +0 -53
- package/src/components/bs-ui/user-txt-msg-bubble.tsx +0 -19
- package/src/components/bs-ui/warning-msg.tsx +0 -27
- package/src/stories/AbsFullscreenGradientBg.stories.tsx +0 -36
- package/src/stories/AttachmentPart.stories.tsx +0 -122
- package/src/stories/AttachmentPartGroup.stories.tsx +0 -151
- package/src/stories/AttachmentsPreviewer.stories.tsx +0 -306
- package/src/stories/BaseButton.stories.tsx +0 -33
- package/src/stories/BorderAnimation.stories.tsx +0 -116
- package/src/stories/BorderColorAnimation.stories.tsx +0 -63
- package/src/stories/BotAvatarAndName.stories.ts +0 -24
- package/src/stories/BotIcon.stories.ts +0 -22
- package/src/stories/BsTooltip.stories.tsx +0 -32
- package/src/stories/Card.stories.tsx +0 -28
- package/src/stories/CardField.stories.tsx +0 -87
- package/src/stories/ChatAreaHeader.stories.ts +0 -26
- package/src/stories/CircleChecker.stories.tsx +0 -89
- package/src/stories/CollapsibleTextMsg.stories.ts +0 -44
- package/src/stories/ConfirmDialog.stories.tsx +0 -123
- package/src/stories/DashWidgetIcon.stories.tsx +0 -132
- package/src/stories/FormInfoEditor.stories.tsx +0 -173
- package/src/stories/FormulaTag.stories.tsx +0 -68
- package/src/stories/GenerateAnimation.stories.ts +0 -20
- package/src/stories/IconBtn.stories.tsx +0 -32
- package/src/stories/IconLib.tsx +0 -45
- package/src/stories/Icons.stories.ts +0 -22
- package/src/stories/ImgMsgPart.stories.tsx +0 -42
- package/src/stories/LineChecker.stories.tsx +0 -134
- package/src/stories/LinearGradientBorderBtn.stories.tsx +0 -86
- package/src/stories/LinearGradientColorBgAnimation.stories.tsx +0 -60
- package/src/stories/NumbersMsgPart.stories.tsx +0 -42
- package/src/stories/OptionItem.stories.tsx +0 -77
- package/src/stories/PreviewerHeader.stories.tsx +0 -91
- package/src/stories/PrimaryConfirmBtn.stories.tsx +0 -60
- package/src/stories/PrimaryEntryBtn.stories.tsx +0 -74
- package/src/stories/ScrollToBottom.stories.tsx +0 -24
- package/src/stories/SplitLine.stories.tsx +0 -40
- package/src/stories/SquareChecker.stories.tsx +0 -96
- package/src/stories/TabRadioGroup.stories.tsx +0 -84
- package/src/stories/UserTextMsgBubble.stories.ts +0 -24
- package/src/stories/WarningMessage.stories.tsx +0 -23
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -1
- 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 +0 -539
- package/src/stories/assets/demo_index.html +0 -7988
- package/src/stories/assets/discord.svg +0 -1
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -1
- package/src/stories/assets/iconfont.css +0 -1377
- package/src/stories/assets/iconfont.eot +0 -0
- package/src/stories/assets/iconfont.json +0 -2382
- package/src/stories/assets/iconfont.svg +0 -697
- 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 +0 -1
- package/src/stories/assets/youtube.svg +0 -1
- package/src/stories/fields-design-info-table.stories.tsx +0 -203
- package/src/stories/fields-generating.stories.tsx +0 -41
- package/src/stories/fields-previewer.stories.tsx +0 -77
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import BorderAnimation from '
|
|
2
|
-
import { GenerateAnimation } from '
|
|
1
|
+
import BorderAnimation from '@baishuyun/ai-design/border-animation';
|
|
2
|
+
import { GenerateAnimation } from '@baishuyun/ai-design/generate-animation';
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
|
|
5
5
|
export const FirstBatchGeneratingAnimation = memo(() => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TabRadioGroup } from '
|
|
1
|
+
import { TabRadioGroup } from '@baishuyun/ai-design/tab-radio-group';
|
|
2
2
|
import { useEvtBus } from '@/hooks/use-evt-bus';
|
|
3
3
|
import { FILLING_EVENTS, PLUGIN_NAME } from '../const';
|
|
4
4
|
import { usePluginCtx } from '@/hooks/use-plugin-ctx';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { GenerateAnimation } from '
|
|
2
|
-
import { PrimaryConfirmBtn } from '
|
|
1
|
+
import { GenerateAnimation } from '@baishuyun/ai-design/generate-animation';
|
|
2
|
+
import { PrimaryConfirmBtn } from '@baishuyun/ai-design/primary-confirm-btn';
|
|
3
3
|
import { DATA_COUNT_PER_BATCH } from '../const';
|
|
4
4
|
import { memo } from 'react';
|
|
5
|
-
import BorderAnimation from '
|
|
5
|
+
import BorderAnimation from '@baishuyun/ai-design/border-animation';
|
|
6
6
|
|
|
7
7
|
export const NonFirstBatchGeneratingAnimation = memo(() => {
|
|
8
8
|
return (
|
|
@@ -2,7 +2,7 @@ import { MsgPartCompProps } from "@baishuyun/types";
|
|
|
2
2
|
import { IFieldsData } from "../types";
|
|
3
3
|
import { MessageContent } from "@/components/biz-comp/message-content";
|
|
4
4
|
import { FieldValueCheckerListMsg } from "@/components/biz-comp/FieldCheckerListMsg";
|
|
5
|
-
import { PrimaryConfirmBtn } from "
|
|
5
|
+
import { PrimaryConfirmBtn } from "@baishuyun/ai-design/primary-confirm-btn";
|
|
6
6
|
import { useState } from "react";
|
|
7
7
|
|
|
8
8
|
export const SingleFillPart: React.FC<MsgPartCompProps & IFieldsData> = (props) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BotAvatarAndName } from '
|
|
2
|
-
import { StatsIcon } from '
|
|
1
|
+
import { BotAvatarAndName } from '@baishuyun/ai-design/bot-avatar-name';
|
|
2
|
+
import { StatsIcon } from '@baishuyun/ai-design/bs-icons';
|
|
3
3
|
|
|
4
4
|
export const QueryAvatar = ({
|
|
5
5
|
variant = 'default',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseButton } from '
|
|
2
|
-
import { MagicIcon } from '
|
|
1
|
+
import { BaseButton } from '@baishuyun/ai-design/base-button';
|
|
2
|
+
import { MagicIcon } from '@baishuyun/ai-design/bs-icons';
|
|
3
3
|
import { EntryButtonProps } from '@baishuyun/types';
|
|
4
4
|
|
|
5
5
|
export const QueryEntryBtn = ({ style, onClick }: EntryButtonProps) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ISuggestion } from '@baishuyun/types';
|
|
2
|
-
import { BagIcon, BuildingIcon, UserIcon } from '
|
|
2
|
+
import { BagIcon, BuildingIcon, UserIcon } from '@baishuyun/ai-design/bs-icons';
|
|
3
3
|
import { Suggestions } from '@/components/biz-comp/suggestions';
|
|
4
4
|
import { useChat } from '@ai-sdk/react';
|
|
5
5
|
import { DefaultChatTransport } from 'ai';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FakeBotMessage } from '@/components/biz-comp/FakeBotMsg';
|
|
2
2
|
import { HighlightMsg } from '@/components/biz-comp/highlight-msg';
|
|
3
|
-
import { CollapsibleTxtMsg } from '
|
|
3
|
+
import { CollapsibleTxtMsg } from '@baishuyun/ai-design/collapsible-txt-msg';
|
|
4
4
|
import { QuerySourceType } from '@baishuyun/types';
|
|
5
5
|
import { CreatedSourceConfigMap } from '../../const';
|
|
6
6
|
import { useEffect } from 'react';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CollapsibleTxtMsg } from '
|
|
1
|
+
import { CollapsibleTxtMsg } from '@baishuyun/ai-design/collapsible-txt-msg';
|
|
2
2
|
import { usePluginCtx } from '@/hooks/use-plugin-ctx';
|
|
3
3
|
import { IQueryResult } from '@baishuyun/types';
|
|
4
4
|
import { IReportQueryContext } from '../../types';
|
|
@@ -6,9 +6,9 @@ import { ReportQueryPlugin } from '../..';
|
|
|
6
6
|
import { PLUGIN_NAME } from '../../const';
|
|
7
7
|
import { useCallback, useEffect } from 'react';
|
|
8
8
|
import { ConditionField, DataSourceField, DimensionField, MetricField } from './DataTableFields';
|
|
9
|
-
import { CardFieldsWrapper } from '
|
|
9
|
+
import { CardFieldsWrapper } from '@baishuyun/ai-design/card-field';
|
|
10
10
|
import { FilterCondition } from './FilterCondition';
|
|
11
|
-
import { SplitLine } from '
|
|
11
|
+
import { SplitLine } from '@baishuyun/ai-design/split-line';
|
|
12
12
|
import { DashWidgetIcon } from '@/components/biz-comp/dash-widget-icon';
|
|
13
13
|
import { useFakeGlobalLoadingMessage } from '@/hooks/use-frame-mode';
|
|
14
14
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DefaultFormIcon } from '
|
|
2
|
-
import { CardField } from '
|
|
1
|
+
import { DefaultFormIcon } from '@baishuyun/ai-design/bs-icons';
|
|
2
|
+
import { CardField } from '@baishuyun/ai-design/card-field';
|
|
3
3
|
import { IQueryResultMetric } from '@baishuyun/types/src/chat/plugin/query';
|
|
4
|
-
import { FormulaTag } from '
|
|
4
|
+
import { FormulaTag } from '@baishuyun/ai-design/formula-tag';
|
|
5
5
|
import { cn } from '@/lib/utils';
|
|
6
6
|
import type { ReactNode } from 'react';
|
|
7
7
|
import { FieldIcon } from '@/components/biz-comp/field-icon';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FormulasIcon } from '
|
|
2
|
-
import { FormulaTag } from '
|
|
1
|
+
import { FormulasIcon } from '@baishuyun/ai-design/bs-icons';
|
|
2
|
+
import { FormulaTag } from '@baishuyun/ai-design/formula-tag';
|
|
3
3
|
import { cn } from '@/lib/utils';
|
|
4
4
|
import type { FormulaOp, IQueryResultFormula } from '@baishuyun/types';
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QuerySourceType } from '@baishuyun/types';
|
|
2
2
|
import { ICreatedSourceConfig } from './types';
|
|
3
|
-
import { AggregateTableIcon, DataReportIcon, DataViewIcon } from '
|
|
3
|
+
import { AggregateTableIcon, DataReportIcon, DataViewIcon } from '@baishuyun/ai-design/bs-icons';
|
|
4
4
|
|
|
5
5
|
export const PLUGIN_NAME = 'ReportQueryPlugin';
|
|
6
6
|
|
package/src/style.css
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends":
|
|
2
|
+
"extends": "@baishuyun/typescript-config/vite.json",
|
|
3
3
|
"include": ["src"],
|
|
4
4
|
"compilerOptions": {
|
|
5
5
|
"jsx": "react-jsx",
|
|
6
6
|
"jsxImportSource": "react",
|
|
7
|
-
"
|
|
7
|
+
"rootDir": ".",
|
|
8
8
|
"paths": {
|
|
9
|
-
"@/*": ["./src/*"]
|
|
10
|
-
}
|
|
9
|
+
"@/*": ["./src/*"]
|
|
10
|
+
}
|
|
11
11
|
},
|
|
12
|
-
"references": [{ "path": "../types/tsconfig.json" }]
|
|
12
|
+
"references": [{ "path": "../types/tsconfig.json" }]
|
|
13
13
|
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
|
|
3
|
-
export interface AbsFullscreenGradientBgProps {
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
zIndex: number;
|
|
6
|
-
padding?: number;
|
|
7
|
-
bgColor?: string;
|
|
8
|
-
disableGradient?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const AbsFullscreenGradientBg = forwardRef<HTMLDivElement, AbsFullscreenGradientBgProps>(
|
|
12
|
-
({ children, zIndex, padding, disableGradient, bgColor = '#fff' }, ref) => {
|
|
13
|
-
return (
|
|
14
|
-
<div
|
|
15
|
-
ref={ref}
|
|
16
|
-
style={{
|
|
17
|
-
position: 'absolute',
|
|
18
|
-
top: 0,
|
|
19
|
-
left: 0,
|
|
20
|
-
width: '100%',
|
|
21
|
-
height: '100%',
|
|
22
|
-
background: disableGradient
|
|
23
|
-
? bgColor
|
|
24
|
-
: 'linear-gradient(180deg, #DBE9FF 0%, #E9FFFD 100%)',
|
|
25
|
-
padding: padding || 0,
|
|
26
|
-
zIndex,
|
|
27
|
-
}}
|
|
28
|
-
>
|
|
29
|
-
{children}
|
|
30
|
-
</div>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
AbsFullscreenGradientBg.displayName = 'AbsFullscreenGradientBg';
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { cn } from '@/lib/utils';
|
|
2
|
-
import { AttachmentPart, FilePart } from './attachment-part';
|
|
3
|
-
import { FileUIPart } from 'ai';
|
|
4
|
-
|
|
5
|
-
export interface AttachmentPartGroupProps {
|
|
6
|
-
parts: FileUIPart[];
|
|
7
|
-
className?: string;
|
|
8
|
-
/** Size in pixels for each item, defaults to 102 */
|
|
9
|
-
size?: number;
|
|
10
|
-
/** Gap between items in pixels, defaults to 10 */
|
|
11
|
-
gap?: number;
|
|
12
|
-
/** Show only icons without file names */
|
|
13
|
-
iconOnly?: boolean;
|
|
14
|
-
/** Click handler for individual parts */
|
|
15
|
-
onPartClick?: (part: FilePart) => void;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const AttachmentPartGroup = ({
|
|
19
|
-
parts,
|
|
20
|
-
className,
|
|
21
|
-
size = 100,
|
|
22
|
-
gap = 10,
|
|
23
|
-
iconOnly,
|
|
24
|
-
onPartClick,
|
|
25
|
-
}: AttachmentPartGroupProps) => {
|
|
26
|
-
if (!parts.length) return null;
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<div className={cn('flex flex-wrap content-center items-center', className)} style={{ gap }}>
|
|
30
|
-
{parts.map((part, index) => (
|
|
31
|
-
<AttachmentPart key={part.url || index} part={part} size={size} iconOnly={iconOnly} onClick={onPartClick} />
|
|
32
|
-
))}
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
2
|
-
import { cn } from '@/lib/utils';
|
|
3
|
-
import { ImgMsgPart } from './img-part';
|
|
4
|
-
import { XlsxIcon, CsvFileIcon, TxtFileIcon, UnknownFileIcon } from './bs-icons';
|
|
5
|
-
|
|
6
|
-
/** File part from AI message */
|
|
7
|
-
export interface FilePart {
|
|
8
|
-
type: 'file';
|
|
9
|
-
url: string;
|
|
10
|
-
name?: string;
|
|
11
|
-
mediaType?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface AttachmentPartProps {
|
|
15
|
-
part: FilePart;
|
|
16
|
-
className?: string;
|
|
17
|
-
/** Size in pixels (width & height), defaults to 102 */
|
|
18
|
-
size?: number;
|
|
19
|
-
/** Show only the icon without file name */
|
|
20
|
-
iconOnly?: boolean;
|
|
21
|
-
/** Click handler for the attachment */
|
|
22
|
-
onClick?: (part: FilePart) => void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
type FileIconComponent = ComponentType;
|
|
26
|
-
|
|
27
|
-
interface FileTypeConfig {
|
|
28
|
-
icon: FileIconComponent;
|
|
29
|
-
/** Icon original size for scaling */
|
|
30
|
-
iconSize: number;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** Map media types to icon configurations */
|
|
34
|
-
const FILE_TYPE_MAP: Record<string, FileTypeConfig> = {
|
|
35
|
-
// Excel files
|
|
36
|
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': {
|
|
37
|
-
icon: XlsxIcon,
|
|
38
|
-
iconSize: 52,
|
|
39
|
-
},
|
|
40
|
-
'application/vnd.ms-excel': { icon: XlsxIcon, iconSize: 52 },
|
|
41
|
-
|
|
42
|
-
// CSV files
|
|
43
|
-
'text/csv': { icon: CsvFileIcon, iconSize: 16 },
|
|
44
|
-
|
|
45
|
-
// Text files
|
|
46
|
-
'text/plain': { icon: TxtFileIcon, iconSize: 16 },
|
|
47
|
-
'application/octet-stream': { icon: TxtFileIcon, iconSize: 16 }, // treat as text for ts/js files
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const DEFAULT_FILE_CONFIG: FileTypeConfig = {
|
|
51
|
-
icon: UnknownFileIcon,
|
|
52
|
-
iconSize: 16,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/** Check if media type is an image */
|
|
56
|
-
const isImageType = (mediaType?: string): boolean => {
|
|
57
|
-
return Boolean(mediaType?.startsWith('image/'));
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
/** Get file config based on media type and file extension */
|
|
61
|
-
const getFileConfig = (mediaType?: string, fileName?: string): FileTypeConfig => {
|
|
62
|
-
// Check media type first
|
|
63
|
-
if (mediaType && FILE_TYPE_MAP[mediaType]) {
|
|
64
|
-
return FILE_TYPE_MAP[mediaType];
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Fallback to file extension
|
|
68
|
-
if (fileName) {
|
|
69
|
-
const ext = fileName.split('.').pop()?.toLowerCase();
|
|
70
|
-
switch (ext) {
|
|
71
|
-
case 'xlsx':
|
|
72
|
-
case 'xls':
|
|
73
|
-
return FILE_TYPE_MAP['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'];
|
|
74
|
-
case 'csv':
|
|
75
|
-
return FILE_TYPE_MAP['text/csv'];
|
|
76
|
-
case 'txt':
|
|
77
|
-
case 'ts':
|
|
78
|
-
case 'tsx':
|
|
79
|
-
case 'js':
|
|
80
|
-
case 'jsx':
|
|
81
|
-
case 'json':
|
|
82
|
-
case 'md':
|
|
83
|
-
return FILE_TYPE_MAP['text/plain'];
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return DEFAULT_FILE_CONFIG;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
/** Extract display file name from full path */
|
|
91
|
-
const getDisplayFileName = (name?: string): string | undefined => {
|
|
92
|
-
if (!name) return undefined;
|
|
93
|
-
// Get last segment of path
|
|
94
|
-
const segments = name.split('/');
|
|
95
|
-
return segments[segments.length - 1];
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
/** Generic file message part component */
|
|
99
|
-
const FileMsgPart = ({
|
|
100
|
-
fileName,
|
|
101
|
-
icon: Icon,
|
|
102
|
-
iconSize,
|
|
103
|
-
className,
|
|
104
|
-
size = 102,
|
|
105
|
-
}: {
|
|
106
|
-
fileName?: string;
|
|
107
|
-
icon: FileIconComponent;
|
|
108
|
-
iconSize: number;
|
|
109
|
-
className?: string;
|
|
110
|
-
size?: number;
|
|
111
|
-
}) => {
|
|
112
|
-
const scale = size / 102;
|
|
113
|
-
const scaledIconSize = (52 / 102) * size; // Target icon takes ~51% of container
|
|
114
|
-
const iconScale = scaledIconSize / iconSize;
|
|
115
|
-
const hasFileName = Boolean(fileName);
|
|
116
|
-
|
|
117
|
-
return (
|
|
118
|
-
<div
|
|
119
|
-
className={cn(
|
|
120
|
-
'relative flex flex-col items-center justify-center rounded-[10px] bg-[#EFF0F6] px-[10px]',
|
|
121
|
-
hasFileName && 'gap-[6px]',
|
|
122
|
-
className
|
|
123
|
-
)}
|
|
124
|
-
style={{ width: size, height: size }}
|
|
125
|
-
>
|
|
126
|
-
<div
|
|
127
|
-
className="shrink-0 flex items-center justify-center"
|
|
128
|
-
style={{
|
|
129
|
-
width: scaledIconSize,
|
|
130
|
-
height: scaledIconSize,
|
|
131
|
-
}}
|
|
132
|
-
>
|
|
133
|
-
<div
|
|
134
|
-
style={{
|
|
135
|
-
transform: iconScale !== 1 ? `scale(${iconScale})` : undefined,
|
|
136
|
-
transformOrigin: 'center',
|
|
137
|
-
}}
|
|
138
|
-
>
|
|
139
|
-
<Icon />
|
|
140
|
-
</div>
|
|
141
|
-
</div>
|
|
142
|
-
{hasFileName && (
|
|
143
|
-
<p
|
|
144
|
-
className="block max-w-full shrink-0 truncate text-center text-[14px] leading-normal text-[#030303]"
|
|
145
|
-
style={{ fontSize: 14 * scale, maxWidth: '100%', display: 'block' }}
|
|
146
|
-
title={fileName}
|
|
147
|
-
>
|
|
148
|
-
{fileName}
|
|
149
|
-
</p>
|
|
150
|
-
)}
|
|
151
|
-
</div>
|
|
152
|
-
);
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
export const AttachmentPart = ({ part, className, size = 102, iconOnly, onClick }: AttachmentPartProps) => {
|
|
156
|
-
const { url, name, mediaType } = part;
|
|
157
|
-
const handleClick = onClick ? () => onClick(part) : undefined;
|
|
158
|
-
|
|
159
|
-
// Render image for image types
|
|
160
|
-
if (isImageType(mediaType)) {
|
|
161
|
-
return <ImgMsgPart url={url} alt={name} className={className} size={size} onClick={handleClick} />;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// Render file icon for other types
|
|
165
|
-
const { icon, iconSize } = getFileConfig(mediaType, name);
|
|
166
|
-
const displayName = iconOnly ? undefined : getDisplayFileName(name);
|
|
167
|
-
|
|
168
|
-
return (
|
|
169
|
-
<div onClick={handleClick} className={onClick ? 'cursor-pointer' : undefined}>
|
|
170
|
-
<FileMsgPart
|
|
171
|
-
fileName={displayName}
|
|
172
|
-
icon={icon}
|
|
173
|
-
iconSize={iconSize}
|
|
174
|
-
className={className}
|
|
175
|
-
size={size}
|
|
176
|
-
/>
|
|
177
|
-
</div>
|
|
178
|
-
);
|
|
179
|
-
};
|