bi-sdk-react 0.0.1

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 (146) hide show
  1. package/dist/es/css/bi-sdk.css +1 -0
  2. package/dist/es/js/bi-sdk.es.js +795 -0
  3. package/dist/es/js/bi-sdk.es.js.LICENSE.txt +9 -0
  4. package/dist/types/components/PageDesigner.d.ts +10 -0
  5. package/dist/types/components/context/DesignerContext.d.ts +15 -0
  6. package/dist/types/components/context/EnvContext.d.ts +15 -0
  7. package/dist/types/components/dnd/DropContainer.d.ts +21 -0
  8. package/dist/types/components/example.d.ts +225 -0
  9. package/dist/types/components/hooks/datasource.d.ts +1 -0
  10. package/dist/types/components/hooks/useDeepCompareEffect.d.ts +1 -0
  11. package/dist/types/components/icon/IconFont.d.ts +6 -0
  12. package/dist/types/components/index.d.ts +10 -0
  13. package/dist/types/components/layout/PageCanvas.d.ts +6 -0
  14. package/dist/types/components/layout/PageItem.d.ts +27 -0
  15. package/dist/types/components/panel/AiPanel.d.ts +8 -0
  16. package/dist/types/components/panel/CascadePanel.d.ts +2 -0
  17. package/dist/types/components/panel/ChatInput.d.ts +28 -0
  18. package/dist/types/components/panel/CodePanel.d.ts +2 -0
  19. package/dist/types/components/panel/ComponentPanel.d.ts +2 -0
  20. package/dist/types/components/panel/DatasourcePanel.d.ts +2 -0
  21. package/dist/types/components/panel/LayerPanel.d.ts +2 -0
  22. package/dist/types/components/panel/PaneHeader.d.ts +6 -0
  23. package/dist/types/components/panel/PropertiesPanel.d.ts +2 -0
  24. package/dist/types/components/panel/ScriptPanel.d.ts +2 -0
  25. package/dist/types/components/panel/VariablesPanel.d.ts +2 -0
  26. package/dist/types/components/panel/index.d.ts +9 -0
  27. package/dist/types/components/plugins/@antd/index.d.ts +22 -0
  28. package/dist/types/components/plugins/@antd/item-props/ButtonProps.d.ts +8 -0
  29. package/dist/types/components/plugins/@antd/item-props/CapsuleProps.d.ts +13 -0
  30. package/dist/types/components/plugins/@antd/item-props/CardProps.d.ts +8 -0
  31. package/dist/types/components/plugins/@antd/item-props/CheckboxProps.d.ts +13 -0
  32. package/dist/types/components/plugins/@antd/item-props/ColProps.d.ts +12 -0
  33. package/dist/types/components/plugins/@antd/item-props/DatePickerProps.d.ts +8 -0
  34. package/dist/types/components/plugins/@antd/item-props/EchartsProps.d.ts +6 -0
  35. package/dist/types/components/plugins/@antd/item-props/HtmlProps.d.ts +6 -0
  36. package/dist/types/components/plugins/@antd/item-props/ImageProps.d.ts +10 -0
  37. package/dist/types/components/plugins/@antd/item-props/InputNumberProps.d.ts +9 -0
  38. package/dist/types/components/plugins/@antd/item-props/InputProps.d.ts +10 -0
  39. package/dist/types/components/plugins/@antd/item-props/ListProps.d.ts +10 -0
  40. package/dist/types/components/plugins/@antd/item-props/PageHeaderProps.d.ts +7 -0
  41. package/dist/types/components/plugins/@antd/item-props/RowProps.d.ts +6 -0
  42. package/dist/types/components/plugins/@antd/item-props/SelectProps.d.ts +16 -0
  43. package/dist/types/components/plugins/@antd/item-props/SpaceProps.d.ts +7 -0
  44. package/dist/types/components/plugins/@antd/item-props/SwitchProps.d.ts +6 -0
  45. package/dist/types/components/plugins/@antd/item-props/TableProps.d.ts +15 -0
  46. package/dist/types/components/plugins/@antd/item-props/TextProps.d.ts +6 -0
  47. package/dist/types/components/plugins/@antd/item-props/index.d.ts +19 -0
  48. package/dist/types/components/plugins/@antd/item-props/types.d.ts +5 -0
  49. package/dist/types/components/plugins/@antd/items/ButtonRender.d.ts +14 -0
  50. package/dist/types/components/plugins/@antd/items/CapsuleRender.d.ts +14 -0
  51. package/dist/types/components/plugins/@antd/items/CardRender.d.ts +12 -0
  52. package/dist/types/components/plugins/@antd/items/CheckboxRender.d.ts +14 -0
  53. package/dist/types/components/plugins/@antd/items/ColRender.d.ts +13 -0
  54. package/dist/types/components/plugins/@antd/items/DatePickerRender.d.ts +14 -0
  55. package/dist/types/components/plugins/@antd/items/EchartsRender.d.ts +10 -0
  56. package/dist/types/components/plugins/@antd/items/HtmlRender.d.ts +20 -0
  57. package/dist/types/components/plugins/@antd/items/ImageRender.d.ts +10 -0
  58. package/dist/types/components/plugins/@antd/items/InputNumberRender.d.ts +17 -0
  59. package/dist/types/components/plugins/@antd/items/InputRender.d.ts +17 -0
  60. package/dist/types/components/plugins/@antd/items/ListRender.d.ts +11 -0
  61. package/dist/types/components/plugins/@antd/items/PageHeaderRender.d.ts +8 -0
  62. package/dist/types/components/plugins/@antd/items/RowRender.d.ts +13 -0
  63. package/dist/types/components/plugins/@antd/items/SelectRender.d.ts +18 -0
  64. package/dist/types/components/plugins/@antd/items/SpaceRender.d.ts +10 -0
  65. package/dist/types/components/plugins/@antd/items/SwitchRender.d.ts +14 -0
  66. package/dist/types/components/plugins/@antd/items/TableRender.d.ts +12 -0
  67. package/dist/types/components/plugins/@antd/items/TextRender.d.ts +9 -0
  68. package/dist/types/components/plugins/@antd/items/index.d.ts +19 -0
  69. package/dist/types/components/typing.d.ts +80 -0
  70. package/dist/types/components/utils.d.ts +9 -0
  71. package/dist/types/example.d.ts +2 -0
  72. package/dist/types/index.d.ts +1 -0
  73. package/dist/umd/css/bi-sdk.css +1 -0
  74. package/dist/umd/js/bi-sdk.umd.min.js +795 -0
  75. package/dist/umd/js/bi-sdk.umd.min.js.LICENSE.txt +9 -0
  76. package/package.json +52 -0
  77. package/src/components/PageDesigner.tsx +509 -0
  78. package/src/components/context/DesignerContext.tsx +71 -0
  79. package/src/components/context/EnvContext.tsx +42 -0
  80. package/src/components/dnd/DropContainer.tsx +474 -0
  81. package/src/components/example.ts +577 -0
  82. package/src/components/hooks/datasource.ts +23 -0
  83. package/src/components/hooks/useDeepCompareEffect.ts +12 -0
  84. package/src/components/icon/IconFont.tsx +16 -0
  85. package/src/components/index.ts +29 -0
  86. package/src/components/layout/PageCanvas.tsx +145 -0
  87. package/src/components/layout/PageItem.tsx +182 -0
  88. package/src/components/panel/AiPanel.tsx +116 -0
  89. package/src/components/panel/CascadePanel.tsx +163 -0
  90. package/src/components/panel/ChatInput.tsx +550 -0
  91. package/src/components/panel/CodePanel.tsx +48 -0
  92. package/src/components/panel/ComponentPanel.tsx +119 -0
  93. package/src/components/panel/DatasourcePanel.tsx +419 -0
  94. package/src/components/panel/LayerPanel.tsx +238 -0
  95. package/src/components/panel/PaneHeader.tsx +34 -0
  96. package/src/components/panel/PropertiesPanel.tsx +394 -0
  97. package/src/components/panel/ScriptPanel.tsx +175 -0
  98. package/src/components/panel/VariablesPanel.tsx +153 -0
  99. package/src/components/panel/index.ts +9 -0
  100. package/src/components/plugins/@antd/index.ts +445 -0
  101. package/src/components/plugins/@antd/item-props/ButtonProps.tsx +91 -0
  102. package/src/components/plugins/@antd/item-props/CapsuleProps.tsx +102 -0
  103. package/src/components/plugins/@antd/item-props/CardProps.tsx +58 -0
  104. package/src/components/plugins/@antd/item-props/CheckboxProps.tsx +75 -0
  105. package/src/components/plugins/@antd/item-props/ColProps.tsx +43 -0
  106. package/src/components/plugins/@antd/item-props/DatePickerProps.tsx +72 -0
  107. package/src/components/plugins/@antd/item-props/EchartsProps.tsx +35 -0
  108. package/src/components/plugins/@antd/item-props/HtmlProps.tsx +61 -0
  109. package/src/components/plugins/@antd/item-props/ImageProps.tsx +43 -0
  110. package/src/components/plugins/@antd/item-props/InputNumberProps.tsx +18 -0
  111. package/src/components/plugins/@antd/item-props/InputProps.tsx +89 -0
  112. package/src/components/plugins/@antd/item-props/ListProps.tsx +69 -0
  113. package/src/components/plugins/@antd/item-props/PageHeaderProps.tsx +20 -0
  114. package/src/components/plugins/@antd/item-props/RowProps.tsx +21 -0
  115. package/src/components/plugins/@antd/item-props/SelectProps.tsx +136 -0
  116. package/src/components/plugins/@antd/item-props/SpaceProps.tsx +52 -0
  117. package/src/components/plugins/@antd/item-props/SwitchProps.tsx +17 -0
  118. package/src/components/plugins/@antd/item-props/TableProps.tsx +200 -0
  119. package/src/components/plugins/@antd/item-props/TextProps.tsx +41 -0
  120. package/src/components/plugins/@antd/item-props/index.ts +20 -0
  121. package/src/components/plugins/@antd/item-props/types.ts +6 -0
  122. package/src/components/plugins/@antd/items/ButtonRender.tsx +63 -0
  123. package/src/components/plugins/@antd/items/CapsuleRender.tsx +49 -0
  124. package/src/components/plugins/@antd/items/CardRender.tsx +119 -0
  125. package/src/components/plugins/@antd/items/CheckboxRender.tsx +56 -0
  126. package/src/components/plugins/@antd/items/ColRender.tsx +78 -0
  127. package/src/components/plugins/@antd/items/DatePickerRender.tsx +117 -0
  128. package/src/components/plugins/@antd/items/EchartsRender.tsx +98 -0
  129. package/src/components/plugins/@antd/items/HtmlRender.tsx +74 -0
  130. package/src/components/plugins/@antd/items/ImageRender.tsx +37 -0
  131. package/src/components/plugins/@antd/items/InputNumberRender.tsx +57 -0
  132. package/src/components/plugins/@antd/items/InputRender.tsx +75 -0
  133. package/src/components/plugins/@antd/items/ListRender.tsx +227 -0
  134. package/src/components/plugins/@antd/items/PageHeaderRender.tsx +74 -0
  135. package/src/components/plugins/@antd/items/RowRender.tsx +47 -0
  136. package/src/components/plugins/@antd/items/SelectRender.tsx +53 -0
  137. package/src/components/plugins/@antd/items/SpaceRender.tsx +54 -0
  138. package/src/components/plugins/@antd/items/SwitchRender.tsx +52 -0
  139. package/src/components/plugins/@antd/items/TableRender.tsx +99 -0
  140. package/src/components/plugins/@antd/items/TextRender.tsx +25 -0
  141. package/src/components/plugins/@antd/items/index.ts +20 -0
  142. package/src/components/styles.css +12 -0
  143. package/src/components/typing.ts +80 -0
  144. package/src/components/utils.ts +37 -0
  145. package/src/example.tsx +136 -0
  146. package/src/index.tsx +17 -0
@@ -0,0 +1,577 @@
1
+ export const exampleHtml = `<div>{{title}}</div>
2
+ <div>{{displayValue}}</div>
3
+ <div>
4
+ {{desc || ""}}
5
+ </div>`;
6
+
7
+ export const schema = {
8
+ info: {
9
+ name: "人事基本情况总览",
10
+ description: "实时监控和分析教师人事关键指标",
11
+ },
12
+ datasources: [],
13
+ scripts: [],
14
+ variables: [],
15
+ items: [
16
+ {
17
+ type: "b-page-header",
18
+ name: "页面标题",
19
+ props: {
20
+ title: "人事基本情况总览",
21
+ subTitle: "实时监控和分析教师人事关键指标",
22
+ },
23
+ children: {
24
+ extra: [],
25
+ },
26
+ },
27
+ {
28
+ type: "b-card",
29
+ name: "容器组件",
30
+ props: {
31
+ bordered: true,
32
+ hoverable: true,
33
+ shadow: true,
34
+ size: "default",
35
+ },
36
+ children: {
37
+ title: [
38
+ {
39
+ type: "b-text",
40
+ name: "文本",
41
+ props: {
42
+ text: "人事基本情况总览",
43
+ },
44
+ style: {
45
+ fontSize: 14,
46
+ color: "#444444",
47
+ fontFamily: "'宋体', 'SimSun', serif",
48
+ fontWeight: "normal",
49
+ fontStyle: "normal",
50
+ textDecoration: "none",
51
+ },
52
+ },
53
+ ],
54
+ extra: [],
55
+ body: [
56
+ {
57
+ type: "b-list",
58
+ name: "列表",
59
+ datasource: {
60
+ source: "custom",
61
+ custom:
62
+ '[{"title":"Confucius","avatar":"https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png","href":"https://www.antdv.com/","description":"The man who moves a mountain begins by carrying away small stones."},{"title":"Socrates","description":"I think, therefore I am."}]',
63
+ },
64
+ props: {
65
+ size: "default",
66
+ itemLayout: "horizontal",
67
+ bordered: true,
68
+ split: true,
69
+ pageSize: 10,
70
+ },
71
+ },
72
+ ],
73
+ actions: [],
74
+ },
75
+ },
76
+ {
77
+ type: "b-row",
78
+ name: "栅格行",
79
+ props: {
80
+ gutter: [12, 12],
81
+ },
82
+ children: [
83
+ {
84
+ type: "b-col",
85
+ name: "栅格列",
86
+ props: {
87
+ xs: 24,
88
+ sm: 12,
89
+ md: 12,
90
+ lg: 6,
91
+ xl: 6,
92
+ },
93
+ children: [
94
+ {
95
+ type: "b-card",
96
+ name: "容器组件",
97
+ props: {
98
+ bordered: true,
99
+ hoverable: true,
100
+ shadow: true,
101
+ size: "default",
102
+ },
103
+ children: [
104
+ {
105
+ type: "b-html",
106
+ name: "HTML",
107
+ datasource: {
108
+ source: "custom",
109
+ custom:
110
+ '{"title":"教职工总人数","value":1284,"displayValue":"1284","desc":""}',
111
+ },
112
+ props: {
113
+ template: exampleHtml,
114
+ },
115
+ },
116
+ ],
117
+ },
118
+ ],
119
+ },
120
+ {
121
+ type: "b-col",
122
+ name: "栅格列",
123
+ props: {
124
+ xs: 24,
125
+ sm: 12,
126
+ md: 12,
127
+ lg: 6,
128
+ xl: 6,
129
+ },
130
+ children: [
131
+ {
132
+ type: "b-card",
133
+ name: "容器组件",
134
+ props: {
135
+ bordered: true,
136
+ hoverable: true,
137
+ shadow: true,
138
+ size: "default",
139
+ },
140
+ children: [
141
+ {
142
+ type: "b-html",
143
+ name: "HTML",
144
+ datasource: {
145
+ source: "custom",
146
+ custom:
147
+ '{"title":"男性","value":756,"displayValue":"756","desc":""}',
148
+ },
149
+ props: {
150
+ template: exampleHtml,
151
+ },
152
+ },
153
+ ],
154
+ },
155
+ ],
156
+ },
157
+ {
158
+ type: "b-col",
159
+ name: "栅格列",
160
+ props: {
161
+ xs: 24,
162
+ sm: 12,
163
+ md: 12,
164
+ lg: 6,
165
+ xl: 6,
166
+ },
167
+ children: [
168
+ {
169
+ type: "b-card",
170
+ name: "容器组件",
171
+ props: {
172
+ bordered: true,
173
+ hoverable: true,
174
+ shadow: true,
175
+ size: "default",
176
+ },
177
+ children: [
178
+ {
179
+ type: "b-html",
180
+ name: "HTML",
181
+ datasource: {
182
+ source: "custom",
183
+ custom:
184
+ '{"title":"女性","value":528,"displayValue":"528","desc":""}',
185
+ },
186
+ props: {
187
+ template: exampleHtml,
188
+ },
189
+ },
190
+ ],
191
+ },
192
+ ],
193
+ },
194
+ {
195
+ type: "b-col",
196
+ name: "栅格列",
197
+ props: {
198
+ xs: 24,
199
+ sm: 12,
200
+ md: 12,
201
+ lg: 6,
202
+ xl: 6,
203
+ },
204
+ children: [
205
+ {
206
+ type: "b-card",
207
+ name: "容器组件",
208
+ props: {
209
+ bordered: true,
210
+ hoverable: true,
211
+ shadow: true,
212
+ size: "default",
213
+ },
214
+ children: [
215
+ {
216
+ type: "b-html",
217
+ name: "HTML",
218
+ datasource: {
219
+ source: "custom",
220
+ custom:
221
+ '{"title":"当前在岗","value":1156,"displayValue":"1156","desc":""}',
222
+ },
223
+ props: {
224
+ template: exampleHtml,
225
+ },
226
+ },
227
+ ],
228
+ },
229
+ ],
230
+ },
231
+ ],
232
+ },
233
+ {
234
+ type: "b-row",
235
+ name: "栅格行",
236
+ props: {
237
+ gutter: [12, 12],
238
+ },
239
+ style: { marginLeft: 0, marginRight: 0 },
240
+ children: [
241
+ {
242
+ type: "b-col",
243
+ name: "栅格列",
244
+ props: {
245
+ xs: 24,
246
+ sm: 12,
247
+ md: 12,
248
+ lg: 6,
249
+ xl: 6,
250
+ },
251
+ children: [
252
+ {
253
+ type: "b-card",
254
+ name: "容器组件",
255
+ props: {
256
+ title: "单位人员分布",
257
+ bordered: true,
258
+ hoverable: true,
259
+ shadow: true,
260
+ size: "default",
261
+ },
262
+ children: [
263
+ {
264
+ type: "b-echarts",
265
+ name: "图表",
266
+ datasource: {
267
+ source: "custom",
268
+ custom: "[]",
269
+ },
270
+ props: {
271
+ title: "单位人员分布",
272
+ script: `
273
+ return {
274
+ tooltip: {
275
+ trigger: "axis",
276
+ axisPointer: { type: "shadow" },
277
+ formatter: "{b}: {c} 人",
278
+ },
279
+ grid: { left: "3%", right: "4%", bottom: "3%", containLabel: true },
280
+ xAxis: {
281
+ type: "category",
282
+ data: ["行政部门", "教学单位", "教辅单位", "后勤单位"],
283
+ axisLabel: { fontSize: 12 },
284
+ },
285
+ yAxis: { type: "value", name: "人数", nameTextStyle: { fontSize: 12 } },
286
+ series: [
287
+ {
288
+ data: [215, 856, 132, 81],
289
+ type: "bar",
290
+ itemStyle: {
291
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
292
+ { offset: 0, color: "#165DFF" },
293
+ { offset: 1, color: "#0E42D2" },
294
+ ]),
295
+ },
296
+ },
297
+ ],
298
+ }
299
+ `,
300
+ },
301
+ },
302
+ ],
303
+ },
304
+ ],
305
+ },
306
+ {
307
+ type: "b-col",
308
+ name: "栅格列",
309
+ props: {
310
+ xs: 24,
311
+ sm: 12,
312
+ md: 12,
313
+ lg: 6,
314
+ xl: 6,
315
+ },
316
+ children: [
317
+ {
318
+ type: "b-card",
319
+ name: "容器组件",
320
+ props: {
321
+ title: "性别比例",
322
+ bordered: true,
323
+ hoverable: true,
324
+ shadow: true,
325
+ size: "default",
326
+ },
327
+ children: [
328
+ {
329
+ type: "b-echarts",
330
+ name: "图表",
331
+ datasource: {
332
+ source: "custom",
333
+ custom: "[]",
334
+ },
335
+ props: {
336
+ title: "性别比例",
337
+ script: `
338
+ return {
339
+ tooltip: { trigger: "item", formatter: "{b}: {c} 人 ({d}%)" },
340
+ legend: {
341
+ orient: "vertical",
342
+ left: "left",
343
+ textStyle: { fontSize: 12 },
344
+ },
345
+ series: [
346
+ {
347
+ name: "性别比例",
348
+ type: "pie",
349
+ radius: ["40%", "70%"],
350
+ avoidLabelOverlap: false,
351
+ itemStyle: { borderRadius: 8, borderColor: "#fff", borderWidth: 2 },
352
+ label: { show: false, position: "center" },
353
+ emphasis: {
354
+ label: { show: true, fontSize: 16, fontWeight: "bold" },
355
+ },
356
+ labelLine: { show: false },
357
+ data: [
358
+ { value: 756, name: "男性", itemStyle: { color: "#165DFF" } },
359
+ { value: 528, name: "女性", itemStyle: { color: "#722ED1" } },
360
+ ],
361
+ },
362
+ ],
363
+ }
364
+ `,
365
+ },
366
+ },
367
+ ],
368
+ },
369
+ ],
370
+ },
371
+ ],
372
+ },
373
+ {
374
+ type: "b-row",
375
+ name: "栅格行",
376
+ props: {
377
+ gutter: [12, 12],
378
+ },
379
+ style: { marginLeft: 0, marginRight: 0 },
380
+ children: [
381
+ {
382
+ type: "b-col",
383
+ name: "栅格列",
384
+ props: {
385
+ xs: 24,
386
+ sm: 12,
387
+ md: 12,
388
+ lg: 6,
389
+ xl: 6,
390
+ },
391
+ children: [
392
+ {
393
+ type: "b-card",
394
+ name: "容器组件",
395
+ props: {
396
+ title: "民族分布",
397
+ bordered: true,
398
+ hoverable: true,
399
+ shadow: true,
400
+ size: "default",
401
+ },
402
+ children: [
403
+ {
404
+ type: "b-echarts",
405
+ name: "图表",
406
+ datasource: {
407
+ source: "custom",
408
+ custom: "[]",
409
+ },
410
+ props: {
411
+ title: "民族分布",
412
+ script: `
413
+ return {
414
+ tooltip: {
415
+ trigger: "axis",
416
+ axisPointer: { type: "shadow" },
417
+ formatter: "{b}: {c} 人",
418
+ },
419
+ grid: { left: "3%", right: "4%", bottom: "3%", containLabel: true },
420
+ xAxis: {
421
+ type: "category",
422
+ data: ["汉族", "少数民族"],
423
+ axisLabel: { fontSize: 12 },
424
+ },
425
+ yAxis: { type: "value", name: "人数", nameTextStyle: { fontSize: 12 } },
426
+ series: [
427
+ {
428
+ data: [1204, 80],
429
+ type: "bar",
430
+ itemStyle: {
431
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
432
+ { offset: 0, color: "#165DFF" },
433
+ { offset: 1, color: "#0FC6C2" },
434
+ ]),
435
+ },
436
+ },
437
+ ],
438
+ }
439
+ `,
440
+ },
441
+ },
442
+ ],
443
+ },
444
+ ],
445
+ },
446
+ {
447
+ type: "b-col",
448
+ name: "栅格列",
449
+ props: {
450
+ xs: 24,
451
+ sm: 12,
452
+ md: 12,
453
+ lg: 6,
454
+ xl: 6,
455
+ },
456
+ children: [
457
+ {
458
+ type: "b-card",
459
+ name: "容器组件",
460
+ props: {
461
+ title: "最高学历分布",
462
+ bordered: true,
463
+ hoverable: true,
464
+ shadow: true,
465
+ size: "default",
466
+ },
467
+ children: [
468
+ {
469
+ type: "b-echarts",
470
+ name: "图表",
471
+ datasource: {
472
+ source: "custom",
473
+ custom: "[]",
474
+ },
475
+ props: {
476
+ title: "最高学历分布",
477
+ script: `
478
+ return {
479
+ tooltip: {
480
+ trigger: "axis",
481
+ axisPointer: { type: "shadow" },
482
+ formatter: "{b}: {c} 人",
483
+ },
484
+ grid: { left: "3%", right: "4%", bottom: "3%", containLabel: true },
485
+ xAxis: {
486
+ type: "category",
487
+ data: ["本科", "硕士", "博士"],
488
+ axisLabel: { fontSize: 12 },
489
+ },
490
+ yAxis: { type: "value", name: "人数", nameTextStyle: { fontSize: 12 } },
491
+ series: [
492
+ {
493
+ data: [412, 628, 244],
494
+ type: "bar",
495
+ itemStyle: {
496
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
497
+ { offset: 0, color: "#722ED1" },
498
+ { offset: 1, color: "#531DAB" },
499
+ ]),
500
+ },
501
+ },
502
+ ],
503
+ }
504
+ `,
505
+ },
506
+ },
507
+ ],
508
+ },
509
+ ],
510
+ },
511
+ ],
512
+ },
513
+ {
514
+ type: "b-row",
515
+ name: "栅格行",
516
+ props: {
517
+ gutter: [12, 12],
518
+ },
519
+ style: { marginLeft: 0, marginRight: 0 },
520
+ children: [
521
+ {
522
+ type: "b-col",
523
+ name: "栅格列",
524
+ props: {
525
+ span: 24,
526
+ },
527
+ children: [
528
+ {
529
+ type: "b-card",
530
+ name: "容器组件",
531
+ props: {
532
+ title: "民族分布",
533
+ size: "small",
534
+ bordered: false,
535
+ hoverable: true,
536
+ shadow: true,
537
+ },
538
+ children: [
539
+ {
540
+ type: "b-table",
541
+ name: "数据表格",
542
+ props: {
543
+ title: "民族分布",
544
+ size: "small",
545
+ bordered: true,
546
+ showHeader: true,
547
+ pageSize: 10,
548
+ dataSource: [
549
+ {
550
+ name: "汉族",
551
+ count: 1204,
552
+ },
553
+ {
554
+ name: "少数民族",
555
+ count: 80,
556
+ },
557
+ ],
558
+ columns: [
559
+ {
560
+ title: "民族",
561
+ dataIndex: "name",
562
+ },
563
+ {
564
+ title: "人数",
565
+ dataIndex: "count",
566
+ },
567
+ ],
568
+ },
569
+ },
570
+ ],
571
+ },
572
+ ],
573
+ },
574
+ ],
575
+ },
576
+ ],
577
+ };
@@ -0,0 +1,23 @@
1
+ import { useMemo } from "react";
2
+
3
+ export const useDatasource = (id?: string, datasource?: Record<string, any>) => {
4
+ return useMemo(() => {
5
+ if (!datasource) {
6
+ return null;
7
+ }
8
+ const source = datasource.source || "custom";
9
+ switch (source) {
10
+ case "custom":
11
+ try {
12
+ return JSON.parse(datasource.custom || "[]");
13
+ } catch (e) {
14
+ return null;
15
+ }
16
+ case "define":
17
+ break;
18
+ default:
19
+ break;
20
+ }
21
+ return null;
22
+ }, [id, datasource]);
23
+ };
@@ -0,0 +1,12 @@
1
+ import { useRef } from "react";
2
+
3
+ export function useDeepCompareEffect(effect: () => void, dependencies: any[]) {
4
+ const currentDependenciesRef = useRef<string>();
5
+ const isEqual =
6
+ currentDependenciesRef.current === JSON.stringify(dependencies);
7
+
8
+ if (!isEqual || !currentDependenciesRef.current) {
9
+ currentDependenciesRef.current = JSON.stringify(dependencies);
10
+ effect();
11
+ }
12
+ }
@@ -0,0 +1,16 @@
1
+ import React from 'react'
2
+ import { createFromIconfontCN } from '@ant-design/icons'
3
+
4
+ const IconFontCN = createFromIconfontCN({
5
+ scriptUrl: 'https://at.alicdn.com/t/c/font_5072483_pswdqptbsip.js'
6
+ })
7
+
8
+ export type IconFontProps = {
9
+ type: string
10
+ className?: string
11
+ }
12
+
13
+ export const IconFont: React.FC<IconFontProps> = ({ type, className = '' }) => {
14
+ return <IconFontCN type={type} className={className} />
15
+ }
16
+
@@ -0,0 +1,29 @@
1
+ import PageCanvas from "./layout/PageCanvas";
2
+ import PageDesigner from "./PageDesigner";
3
+
4
+ import { PageSchema } from "./typing";
5
+
6
+ import { plugins, PropEditorProps } from "./plugins/@antd";
7
+
8
+ import DropContainer from "./dnd/DropContainer";
9
+
10
+ import { DesignerContext } from "./context/DesignerContext";
11
+
12
+ import { EnvContext } from "./context/EnvContext";
13
+
14
+ import { handleCallback } from "./utils";
15
+
16
+ import { PluginType } from "./typing";
17
+
18
+ export {
19
+ PageCanvas,
20
+ PageDesigner,
21
+ PageSchema,
22
+ DropContainer,
23
+ DesignerContext,
24
+ EnvContext,
25
+ plugins,
26
+ PropEditorProps,
27
+ PluginType,
28
+ handleCallback,
29
+ };