@baishuyun/chat-sdk 0.0.16 → 0.0.17

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/chat-sdk.js +16293 -15784
  3. package/dist/chat-sdk.js.map +1 -1
  4. package/dist/chat-sdk.umd.cjs +149 -149
  5. package/dist/chat-sdk.umd.cjs.map +1 -1
  6. package/dist/index.css +1 -1
  7. package/package.json +4 -4
  8. package/src/chat.tsx +15 -1
  9. package/src/components/biz-comp/FieldChecker.tsx +49 -7
  10. package/src/components/biz-comp/FieldCheckerListMsg.tsx +101 -22
  11. package/src/components/biz-comp/chat-client.tsx +7 -2
  12. package/src/components/biz-comp/error-msg.tsx +10 -0
  13. package/src/components/biz-comp/messages.tsx +10 -0
  14. package/src/components/biz-comp/multi-modal-input/clear-btn.tsx +3 -1
  15. package/src/components/biz-comp/multi-modal-input/index.tsx +58 -38
  16. package/src/components/biz-comp/multi-modal-input/prompt-input.tsx +13 -10
  17. package/src/components/biz-comp/preview-message-wrapper.tsx +4 -4
  18. package/src/components/biz-comp/preview-message.tsx +3 -1
  19. package/src/components/biz-comp/suggestions.tsx +5 -1
  20. package/src/components/bs-ui/attachments-previewer.tsx +4 -1
  21. package/src/components/bs-ui/base-button.tsx +7 -2
  22. package/src/components/bs-ui/bs-icons.tsx +29 -0
  23. package/src/components/bs-ui/card.tsx +4 -3
  24. package/src/components/bs-ui/chat-area-header.tsx +7 -3
  25. package/src/components/bs-ui/fields-design-info-table.tsx +160 -0
  26. package/src/components/bs-ui/fields-previewer.tsx +2 -0
  27. package/src/components/bs-ui/form-info-editor.tsx +2 -42
  28. package/src/components/bs-ui/generate-animation.tsx +7 -5
  29. package/src/components/bs-ui/img-part.tsx +1 -1
  30. package/src/components/bs-ui/line-checker.tsx +19 -5
  31. package/src/components/bs-ui/previewer-header.tsx +28 -3
  32. package/src/components/bs-ui/square-checker.tsx +30 -5
  33. package/src/components/bs-ui/tooltip.tsx +1 -1
  34. package/src/components/ui/dialog.tsx +1 -1
  35. package/src/components/ui/tooltip.tsx +1 -1
  36. package/src/const/ui.ts +42 -0
  37. package/src/hooks/use-frame-mode.ts +15 -0
  38. package/src/lib/parse-design-doc.ts +60 -0
  39. package/src/lib/utils.ts +19 -0
  40. package/src/plugins/form-builder-base-plugin/const.ts +3 -0
  41. package/src/plugins/form-builder-plugin/components/create-form-confirm.tsx +14 -1
  42. package/src/plugins/form-builder-plugin/components/design-info.tsx +47 -0
  43. package/src/plugins/form-builder-plugin/components/entry-btn.tsx +10 -2
  44. package/src/plugins/form-builder-plugin/components/follow-up.tsx +21 -6
  45. package/src/plugins/form-builder-plugin/components/msg-part.tsx +29 -9
  46. package/src/plugins/form-builder-plugin/components/opening-lines.tsx +11 -6
  47. package/src/plugins/form-builder-plugin/index.ts +73 -5
  48. package/src/plugins/form-builder-plugin/types.ts +3 -0
  49. package/src/plugins/form-builder-plugin/utils/index.ts +33 -6
  50. package/src/plugins/form-filling-plugin/components/batch-generator-action.tsx +44 -34
  51. package/src/plugins/form-filling-plugin/components/first-batch-generating-animation.tsx +21 -0
  52. package/src/plugins/form-filling-plugin/components/generated-data-counter.tsx +17 -0
  53. package/src/plugins/form-filling-plugin/components/non-first-batch-generating-animation.tsx +28 -0
  54. package/src/plugins/form-filling-plugin/index.ts +14 -0
  55. package/src/plugins/form-filling-plugin/types.ts +2 -0
  56. package/src/plugins/report-query-plugin/components/query-msg-part.tsx +16 -18
  57. package/src/plugins/report-query-plugin/components/result-cards/CreatedSourceMsg.tsx +36 -0
  58. package/src/plugins/report-query-plugin/components/result-cards/DataTableCard.tsx +15 -2
  59. package/src/plugins/report-query-plugin/const.ts +22 -0
  60. package/src/plugins/report-query-plugin/index.ts +30 -3
  61. package/src/plugins/report-query-plugin/types.ts +6 -0
  62. package/src/sdk.impl.tsx +4 -0
  63. package/src/store/index.ts +11 -0
  64. package/src/stories/FormInfoEditor.stories.tsx +19 -28
  65. package/src/stories/fields-design-info-table.stories.tsx +203 -0
@@ -0,0 +1,203 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { IFieldDesignInfo } from '@baishuyun/types';
3
+ import { FieldsDesignInfoTable } from '@/components/bs-ui/fields-design-info-table';
4
+
5
+ const meta: Meta<typeof FieldsDesignInfoTable> = {
6
+ title: 'Example/Chat/FieldsDesignInfoTable',
7
+ component: FieldsDesignInfoTable,
8
+ tags: ['autodocs'],
9
+ parameters: {
10
+ layout: 'centered',
11
+ },
12
+ decorators: [
13
+ (Story) => (
14
+ <div style={{ width: 420 }}>
15
+ <Story />
16
+ </div>
17
+ ),
18
+ ],
19
+ } satisfies Meta<typeof FieldsDesignInfoTable>;
20
+
21
+ export default meta;
22
+ type Story = StoryObj<typeof meta>;
23
+
24
+ const basicFields: IFieldDesignInfo[] = [
25
+ {
26
+ fieldName: '订单编号',
27
+ type: '流水号',
28
+ required: true,
29
+ description: '唯一标识订单的编号',
30
+ relationDesc: '',
31
+ },
32
+ {
33
+ fieldName: '下单日期',
34
+ type: '日期时间',
35
+ required: true,
36
+ description: '选择订单的下单日期时间',
37
+ relationDesc: '',
38
+ },
39
+ {
40
+ fieldName: '客户名称',
41
+ type: '文本',
42
+ required: true,
43
+ description: '输入客户的名称',
44
+ relationDesc: '',
45
+ },
46
+ {
47
+ fieldName: '联系电话',
48
+ type: '文本',
49
+ required: true,
50
+ description: '输入客户的联系电话',
51
+ relationDesc: '',
52
+ },
53
+ {
54
+ fieldName: '收货地址',
55
+ type: '地址',
56
+ required: true,
57
+ description: '选择或输入收货地址',
58
+ relationDesc: '',
59
+ },
60
+ ];
61
+
62
+ const fieldsWithSubform: IFieldDesignInfo[] = [
63
+ ...basicFields,
64
+ {
65
+ fieldName: '商品明细',
66
+ type: '子表单',
67
+ required: true,
68
+ description: '填写订单商品明细',
69
+ relationDesc: '',
70
+ isSubForm: true,
71
+ },
72
+ {
73
+ fieldName: '商品名称',
74
+ type: '文本',
75
+ required: true,
76
+ description: '输入商品的名称',
77
+ relationDesc: '',
78
+ isFieldInSubForm: true,
79
+ parentFormName: '商品明细',
80
+ },
81
+ {
82
+ fieldName: '商品单价',
83
+ type: '数字',
84
+ required: true,
85
+ description: '输入商品的单价',
86
+ relationDesc: '',
87
+ isFieldInSubForm: true,
88
+ parentFormName: '商品明细',
89
+ },
90
+ {
91
+ fieldName: '购买数量',
92
+ type: '数字',
93
+ required: true,
94
+ description: '输入商品的购买数量',
95
+ relationDesc: '',
96
+ isFieldInSubForm: true,
97
+ parentFormName: '商品明细',
98
+ },
99
+ {
100
+ fieldName: '商品金额',
101
+ type: '数字',
102
+ required: true,
103
+ description: '自动计算商品金额(单价*数量)红红火火恍恍惚惚哈哈哈哈哈哈哈',
104
+ relationDesc: '',
105
+ isFieldInSubForm: true,
106
+ parentFormName: '商品明细',
107
+ },
108
+ ];
109
+
110
+ /** 基础表格 - 无子表单 */
111
+ export const Basic: Story = {
112
+ args: {
113
+ fields: basicFields,
114
+ },
115
+ };
116
+
117
+ /** 包含子表单 - 可展开/收起 */
118
+ export const WithSubForm: Story = {
119
+ args: {
120
+ fields: fieldsWithSubform,
121
+ },
122
+ };
123
+
124
+ /** 空数据 */
125
+ export const Empty: Story = {
126
+ args: {
127
+ fields: [],
128
+ },
129
+ };
130
+
131
+ /** 多个子表单 */
132
+ export const MultipleSubForms: Story = {
133
+ args: {
134
+ fields: [
135
+ {
136
+ fieldName: '项目名称',
137
+ type: '文本',
138
+ required: true,
139
+ description: '输入项目名称',
140
+ relationDesc: '',
141
+ },
142
+ {
143
+ fieldName: '团队成员',
144
+ type: '子表单',
145
+ required: true,
146
+ description: '添加团队成员信息',
147
+ relationDesc: '',
148
+ isSubForm: true,
149
+ },
150
+ {
151
+ fieldName: '姓名',
152
+ type: '文本',
153
+ required: true,
154
+ description: '输入成员姓名',
155
+ relationDesc: '',
156
+ isFieldInSubForm: true,
157
+ parentFormName: '团队成员',
158
+ },
159
+ {
160
+ fieldName: '职位',
161
+ type: '文本',
162
+ required: false,
163
+ description: '输入成员职位',
164
+ relationDesc: '',
165
+ isFieldInSubForm: true,
166
+ parentFormName: '团队成员',
167
+ },
168
+ {
169
+ fieldName: '备注',
170
+ type: '文本',
171
+ required: false,
172
+ description: '输入备注信息',
173
+ relationDesc: '',
174
+ },
175
+ {
176
+ fieldName: '里程碑',
177
+ type: '子表单',
178
+ required: false,
179
+ description: '添加项目里程碑',
180
+ relationDesc: '',
181
+ isSubForm: true,
182
+ },
183
+ {
184
+ fieldName: '阶段名称',
185
+ type: '文本',
186
+ required: true,
187
+ description: '输入里程碑阶段名称',
188
+ relationDesc: '',
189
+ isFieldInSubForm: true,
190
+ parentFormName: '里程碑',
191
+ },
192
+ {
193
+ fieldName: '截止日期',
194
+ type: '日期时间',
195
+ required: true,
196
+ description: '选择里程碑截止日期',
197
+ relationDesc: '',
198
+ isFieldInSubForm: true,
199
+ parentFormName: '里程碑',
200
+ },
201
+ ],
202
+ },
203
+ };