cnhis-design-vue 3.1.9-beta.8 → 3.1.10

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 (254) hide show
  1. package/README.md +22 -22
  2. package/es/packages/big-table/index.d.ts +1 -1
  3. package/es/packages/big-table/index.js +5 -5
  4. package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +41 -20
  5. package/es/packages/big-table/src/components/NoData.vue_vue_type_script_setup_true_lang.js +4 -4
  6. package/es/packages/big-table/src/components/edit-form/edit-select-table.js +2 -2
  7. package/es/packages/big-table/src/components/edit-form/edit-select.js +1 -1
  8. package/es/packages/big-table/src/hooks/useEvent.js +1 -1
  9. package/es/packages/big-table/src/hooks/useFormat.js +1 -1
  10. package/es/packages/big-table/src/hooks/useNestTable.js +1 -1
  11. package/es/packages/big-table/src/hooks/useTableParse.js +1 -1
  12. package/es/packages/big-table/src/utils.js +2 -2
  13. package/es/packages/big-table/style/index.css +1 -6
  14. package/es/packages/bpmn-workflow/index.d.ts +1 -1
  15. package/es/packages/bpmn-workflow/index.js +2 -2
  16. package/es/packages/button-print/index.d.ts +1 -1
  17. package/es/packages/button-print/index.js +2 -2
  18. package/es/packages/chunk-upload/index.d.ts +23 -2
  19. package/es/packages/chunk-upload/index.js +3 -3
  20. package/es/packages/chunk-upload/src/chunk-upload-new.vue.d.ts +33 -3
  21. package/es/packages/chunk-upload/src/chunk-upload-new.vue_vue_type_script_setup_true_lang.js +3 -2
  22. package/es/packages/chunk-upload/src/hooks/upload-data.d.ts +29 -27
  23. package/es/packages/chunk-upload/src/hooks/upload-data.js +32 -29
  24. package/es/packages/chunk-upload/src/hooks/vod-data.d.ts +21 -42
  25. package/es/packages/chunk-upload/src/hooks/vod-data.js +26 -31
  26. package/es/packages/chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue.d.ts +32 -3
  27. package/es/packages/chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue_vue_type_script_setup_true_lang.js +21 -11
  28. package/es/packages/chunk-upload/style/index.css +3 -1
  29. package/es/packages/drag-layout/index.d.ts +1 -1
  30. package/es/packages/drag-layout/index.js +3 -3
  31. package/es/packages/drag-layout/src/DragLayout.vue.d.ts +2 -3
  32. package/es/packages/drag-layout/src/DragLayout.vue_vue_type_script_setup_true_lang.js +1 -1
  33. package/es/packages/editor/index.d.ts +1 -1
  34. package/es/packages/editor/index.js +2 -2
  35. package/es/packages/fabric-chart/index.d.ts +21 -58
  36. package/es/packages/fabric-chart/index.js +2 -2
  37. package/es/packages/fabric-chart/src/FabricChart.vue.d.ts +20 -66
  38. package/es/packages/fabric-chart/src/FabricChart.vue_vue_type_script_setup_true_lang.js +98 -13
  39. package/es/packages/fabric-chart/src/hooks/useCenter.d.ts +4 -0
  40. package/es/packages/fabric-chart/src/hooks/useCenter.js +7 -0
  41. package/es/packages/fabric-chart/src/hooks/useDraw.d.ts +42 -0
  42. package/es/packages/fabric-chart/src/hooks/useDraw.js +76 -0
  43. package/es/packages/fabric-chart/src/hooks/useGrid.d.ts +4 -0
  44. package/es/packages/fabric-chart/src/hooks/useGrid.js +45 -0
  45. package/es/packages/fabric-chart/src/hooks/useLeft.d.ts +4 -0
  46. package/es/packages/fabric-chart/src/hooks/useLeft.js +66 -0
  47. package/es/packages/fabric-chart/src/hooks/useTop.d.ts +4 -0
  48. package/es/packages/fabric-chart/src/hooks/useTop.js +124 -0
  49. package/es/packages/fabric-chart/src/interface.d.ts +88 -0
  50. package/es/packages/fabric-chart/src/interface.js +4 -0
  51. package/es/packages/fabric-chart/src/utils/index.d.ts +2 -0
  52. package/es/packages/fabric-chart/src/utils/index.js +15334 -0
  53. package/es/packages/field-set/index.d.ts +1 -1
  54. package/es/packages/field-set/index.js +2 -2
  55. package/es/packages/form-render/index.d.ts +12 -12
  56. package/es/packages/form-render/index.js +3 -2
  57. package/es/packages/form-render/src/FormRender.vue.d.ts +5 -5
  58. package/es/packages/form-render/src/FormRender.vue_vue_type_script_setup_true_lang.js +23 -9
  59. package/es/packages/form-render/src/components/cascader.d.ts +1 -1
  60. package/es/packages/form-render/src/components/cascader.js +0 -1
  61. package/es/packages/form-render/src/components/checkbox.d.ts +1 -1
  62. package/es/packages/form-render/src/components/complex.js +1 -1
  63. package/es/packages/form-render/src/components/radio.d.ts +1 -1
  64. package/es/packages/form-render/src/components/select.d.ts +1 -1
  65. package/es/packages/form-render/src/components/slider.js +1 -1
  66. package/es/packages/form-render/src/constants/index.d.ts +1 -1
  67. package/es/packages/form-render/src/hooks/index.d.ts +1 -0
  68. package/es/packages/form-render/src/hooks/index.js +1 -0
  69. package/es/packages/form-render/src/hooks/useAsyncQueue.js +1 -1
  70. package/es/packages/form-render/src/hooks/useChangeContext.d.ts +1 -1
  71. package/es/packages/form-render/src/hooks/useFieldList2Schema.js +1 -1
  72. package/es/packages/form-render/src/hooks/useFormField.js +1 -3
  73. package/es/packages/form-render/src/hooks/useFormItemDeps.js +1 -1
  74. package/es/packages/form-render/src/hooks/useFormValidator.d.ts +1 -1
  75. package/es/packages/form-render/src/hooks/useInitialData.d.ts +5 -0
  76. package/es/packages/form-render/src/hooks/useInitialData.js +11 -0
  77. package/es/packages/form-render/src/types/fieldItem.d.ts +1 -1
  78. package/es/packages/form-render/src/types/index.d.ts +2 -2
  79. package/es/packages/form-render/src/utils/index.d.ts +1 -1
  80. package/es/packages/form-render/style/index.css +1 -1
  81. package/es/packages/form-table/index.d.ts +391 -391
  82. package/es/packages/form-table/index.js +2 -2
  83. package/es/packages/form-table/src/FormTable.vue.d.ts +45 -45
  84. package/es/packages/form-table/src/FormTable.vue_vue_type_script_setup_true_lang.js +5 -5
  85. package/es/packages/form-table/src/components/index.d.ts +43 -43
  86. package/es/packages/form-table/src/components/table-age.vue.d.ts +10 -10
  87. package/es/packages/form-table/src/components/table-age.vue_vue_type_script_setup_true_lang.js +1 -1
  88. package/es/packages/form-table/src/components/table-date-picker.vue.d.ts +10 -10
  89. package/es/packages/form-table/src/components/table-digital.vue.d.ts +2 -2
  90. package/es/packages/form-table/src/components/table-digital.vue_vue_type_script_setup_true_lang.js +1 -1
  91. package/es/packages/form-table/src/components/table-input-password.vue.d.ts +2 -2
  92. package/es/packages/form-table/src/components/table-input-password.vue_vue_type_script_setup_true_lang.js +2 -2
  93. package/es/packages/form-table/src/components/table-input.vue.d.ts +2 -2
  94. package/es/packages/form-table/src/components/table-input.vue_vue_type_script_setup_true_lang.js +1 -1
  95. package/es/packages/form-table/src/components/table-month-picker.vue.d.ts +2 -2
  96. package/es/packages/form-table/src/components/table-month-picker.vue_vue_type_script_setup_true_lang.js +1 -1
  97. package/es/packages/form-table/src/components/table-search-more.vue_vue_type_script_setup_true_lang.js +1 -1
  98. package/es/packages/form-table/src/components/table-search.vue_vue_type_script_setup_true_lang.js +1 -1
  99. package/es/packages/form-table/src/components/table-select-multiple.vue.d.ts +10 -10
  100. package/es/packages/form-table/src/components/table-select-multiple.vue_vue_type_script_setup_true_lang.js +1 -1
  101. package/es/packages/form-table/src/components/table-select.vue.d.ts +10 -10
  102. package/es/packages/form-table/src/components/table-select.vue_vue_type_script_setup_true_lang.js +1 -1
  103. package/es/packages/form-table/src/components/table-textarea.vue.d.ts +10 -10
  104. package/es/packages/form-table/src/components/table-textarea.vue_vue_type_script_setup_true_lang.js +2 -2
  105. package/es/packages/form-table/src/components/table-time-picker.vue.d.ts +10 -10
  106. package/es/packages/form-table/src/components/table-time-picker.vue_vue_type_script_setup_true_lang.js +1 -1
  107. package/es/packages/form-table/src/components/table-tree-select.vue.d.ts +10 -10
  108. package/es/packages/form-table/src/components/table-tree-select.vue_vue_type_script_setup_true_lang.js +1 -1
  109. package/es/packages/form-table/src/configs/index.d.ts +1 -1
  110. package/es/packages/form-table/src/hooks/useBoundDate.d.ts +1 -1
  111. package/es/packages/form-table/src/hooks/useDateType.d.ts +1 -1
  112. package/es/packages/form-table/src/hooks/useDateType.js +1 -1
  113. package/es/packages/form-table/src/hooks/useFormCommon.d.ts +1 -1
  114. package/es/packages/form-table/src/hooks/useFormCommon.js +1 -1
  115. package/es/packages/form-table/src/hooks/useFormEvent.d.ts +1 -1
  116. package/es/packages/form-table/src/hooks/useFormEvent.js +1 -1
  117. package/es/packages/form-table/src/hooks/useItemDefault.d.ts +10 -10
  118. package/es/packages/form-table/src/hooks/useItemDefault.js +5 -5
  119. package/es/packages/form-table/src/hooks/useSearch.d.ts +10 -10
  120. package/es/packages/form-table/src/hooks/useSearch.js +2 -2
  121. package/es/packages/form-table/src/hooks/useValidate.d.ts +2 -2
  122. package/es/packages/form-table/src/types/index.d.ts +1 -1
  123. package/es/packages/grid/index.d.ts +1 -1
  124. package/es/packages/grid/index.js +4 -4
  125. package/es/packages/index.css +43 -21
  126. package/es/packages/index.js +1 -0
  127. package/es/packages/info-header/index.d.ts +6 -6
  128. package/es/packages/info-header/index.js +2 -2
  129. package/es/packages/info-header/src/InfoHeader.vue.d.ts +3 -3
  130. package/es/packages/info-header/src/SlotRender.d.ts +1 -1
  131. package/es/packages/map/index.d.ts +1 -1
  132. package/es/packages/map/index.js +2 -2
  133. package/es/packages/scale-view/index.d.ts +138 -1
  134. package/es/packages/scale-view/index.js +4 -4
  135. package/es/packages/scale-view/src/ScaleView.vue.d.ts +119 -0
  136. package/es/packages/scale-view/src/ScaleView.vue_vue_type_script_setup_true_lang.js +32 -25
  137. package/es/packages/scale-view/src/components/AnswerParse.vue_vue_type_script_setup_true_lang.js +1 -1
  138. package/es/packages/scale-view/src/components/EvaluateCountdown.vue_vue_type_script_setup_true_lang.js +1 -1
  139. package/es/packages/scale-view/src/components/LoadingCom.js +7 -0
  140. package/es/packages/scale-view/src/components/LoadingCom.vue_vue_type_template_id_413329b0_lang.js +16 -0
  141. package/es/packages/scale-view/src/components/NoData.vue_vue_type_script_setup_true_lang.js +4 -4
  142. package/es/packages/scale-view/src/components/composables/choose-common.d.ts +1 -0
  143. package/es/packages/scale-view/src/components/composables/choose-common.js +6 -1
  144. package/es/packages/scale-view/src/components/formitem/r-address.js +1 -1
  145. package/es/packages/scale-view/src/components/formitem/r-cascader.js +19 -7
  146. package/es/packages/scale-view/src/components/formitem/r-checkbox.d.ts +9 -0
  147. package/es/packages/scale-view/src/components/formitem/r-checkbox.js +58 -13
  148. package/es/packages/scale-view/src/components/formitem/r-collection.js +1 -2
  149. package/es/packages/scale-view/src/components/formitem/r-datetime.js +6 -3
  150. package/es/packages/scale-view/src/components/formitem/r-map.js +2 -2
  151. package/es/packages/scale-view/src/components/formitem/r-radio.d.ts +9 -0
  152. package/es/packages/scale-view/src/components/formitem/r-radio.js +26 -13
  153. package/es/packages/scale-view/src/components/formitem/r-select.js +17 -8
  154. package/es/packages/scale-view/src/components/formitem/r-upload.js +3 -3
  155. package/es/packages/scale-view/src/components/formitem/text-over-tooltip/TextOverTooltip.vue_vue_type_script_setup_true_lang.js +1 -1
  156. package/es/packages/scale-view/src/hooks/scaleview-computed.js +6 -14
  157. package/es/packages/scale-view/src/hooks/scaleview-init.js +4 -2
  158. package/es/packages/scale-view/src/hooks/scaleview-props.d.ts +28 -0
  159. package/es/packages/scale-view/src/hooks/scaleview-props.js +21 -0
  160. package/es/packages/scale-view/src/hooks/scaleview-state.d.ts +32 -31
  161. package/es/packages/scale-view/src/hooks/scaleview-state.js +41 -38
  162. package/es/packages/scale-view/src/hooks/scaleview-submit.js +1 -1
  163. package/es/packages/scale-view/src/hooks/scaleview-validate.js +1 -1
  164. package/es/packages/scale-view/src/hooks/use-component.d.ts +103 -2
  165. package/es/packages/scale-view/src/hooks/use-component.js +2 -2
  166. package/es/packages/scale-view/src/hooks/use-evaluate.js +1 -1
  167. package/es/packages/scale-view/src/hooks/use-event.js +1 -1
  168. package/es/packages/scale-view/style/index.css +19 -9
  169. package/es/packages/select-label/index.d.ts +47 -3
  170. package/es/packages/select-label/index.js +2 -2
  171. package/es/packages/select-label/src/LabelFormContent.vue.d.ts +2 -2
  172. package/es/packages/select-label/src/LabelFormContent.vue_vue_type_script_setup_true_lang.js +2 -3
  173. package/es/packages/select-label/src/SelectLabel.vue.d.ts +59 -9
  174. package/es/packages/select-label/src/SelectLabel.vue_vue_type_script_setup_true_lang.js +22 -4
  175. package/es/packages/select-label/src/components/label-classify.vue_vue_type_script_setup_true_lang.js +4 -1
  176. package/es/packages/select-label/style/index.css +10 -0
  177. package/es/packages/select-person/index.d.ts +1 -1
  178. package/es/packages/select-person/index.js +2 -2
  179. package/es/packages/select-person/src/SelectPerson.vue_vue_type_script_setup_true_lang.js +1 -1
  180. package/es/packages/time-line/index.d.ts +1 -1
  181. package/es/packages/time-line/index.js +2 -2
  182. package/es/src/assets/img/failure.d.ts +2 -0
  183. package/es/src/assets/img/failure.js +1 -0
  184. package/es/src/assets/img/icon-asc.d.ts +2 -0
  185. package/es/src/assets/img/icon-asc.js +1 -0
  186. package/es/src/assets/img/icon-desc.d.ts +2 -0
  187. package/es/src/assets/img/icon-desc.js +1 -0
  188. package/es/src/assets/img/no-permission.d.ts +2 -0
  189. package/es/src/assets/img/no-permission.js +1 -0
  190. package/es/src/assets/img/nodata.d.ts +2 -0
  191. package/es/src/assets/img/nodata.js +1 -0
  192. package/es/src/assets/img/notfound.d.ts +2 -0
  193. package/es/src/assets/img/notfound.js +1 -0
  194. package/es/src/assets/img/qr.d.ts +2 -0
  195. package/es/src/assets/img/qr.js +1 -0
  196. package/es/src/assets/img/success.d.ts +2 -0
  197. package/es/src/assets/img/success.js +1 -0
  198. package/es/src/assets/img/video.d.ts +2 -0
  199. package/es/src/assets/img/video.js +1 -0
  200. package/es/src/assets/img/video_default_cover.d.ts +2 -0
  201. package/es/src/assets/img/video_default_cover.js +1 -0
  202. package/es/src/assets/img/video_hover.d.ts +2 -0
  203. package/es/src/assets/img/video_hover.js +1 -0
  204. package/es/src/assets/img/video_play_hover.d.ts +2 -0
  205. package/es/src/assets/img/video_play_hover.js +1 -0
  206. package/es/src/assets/img/xb_big.d.ts +2 -0
  207. package/es/src/assets/img/xb_big.js +1 -0
  208. package/es/src/assets/img/xb_small.d.ts +2 -0
  209. package/es/src/assets/img/xb_small.js +1 -0
  210. package/es/src/components/SelectPage/SelectPage.vue.d.ts +1 -1
  211. package/es/src/components/TextOverTooltip/TextOverTooltip.vue_vue_type_script_setup_true_lang.js +1 -1
  212. package/es/src/components/player-vod/video-list.js +2 -2
  213. package/es/src/components/player-vod/video-modal.js +1 -1
  214. package/es/src/utils/loadViewer.js +1 -1
  215. package/es/src/utils/loadVxe.js +1 -1
  216. package/global.d.ts +8 -8
  217. package/package.json +2 -4
  218. package/test.ts +326 -0
  219. package/es/packages/big-table/style/index.less +0 -557
  220. package/es/packages/bpmn-workflow/src/BpmnWorkflow.d.js +0 -1
  221. package/es/packages/bpmn-workflow/style/index.less +0 -29
  222. package/es/packages/bpmn-workflow/types/BpmnViewer.d.js +0 -1
  223. package/es/packages/bpmn-workflow/types/ModelingModule.d.js +0 -1
  224. package/es/packages/bpmn-workflow/types/MoveCanvasModule.d.js +0 -1
  225. package/es/packages/button-print/style/index.less +0 -30
  226. package/es/packages/chunk-upload/style/index.less +0 -395
  227. package/es/packages/drag-layout/style/index.less +0 -208
  228. package/es/packages/editor/style/index.less +0 -0
  229. package/es/packages/fabric-chart/style/index.less +0 -0
  230. package/es/packages/field-set/style/index.less +0 -157
  231. package/es/packages/form-render/style/index.less +0 -129
  232. package/es/packages/form-table/style/index.less +0 -301
  233. package/es/packages/grid/style/index.less +0 -13
  234. package/es/packages/index.less +0 -3077
  235. package/es/packages/info-header/style/index.less +0 -149
  236. package/es/packages/map/style/index.less +0 -60
  237. package/es/packages/scale-view/style/index.less +0 -755
  238. package/es/packages/select-label/style/index.less +0 -151
  239. package/es/packages/select-person/style/index.less +0 -229
  240. package/es/packages/time-line/style/index.less +0 -35
  241. package/es/src/assets/img/failure.png +0 -0
  242. package/es/src/assets/img/icon-asc.png +0 -0
  243. package/es/src/assets/img/icon-desc.png +0 -0
  244. package/es/src/assets/img/no-permission.png +0 -0
  245. package/es/src/assets/img/nodata.png +0 -0
  246. package/es/src/assets/img/notfound.png +0 -0
  247. package/es/src/assets/img/qr.png +0 -0
  248. package/es/src/assets/img/success.png +0 -0
  249. package/es/src/assets/img/video.png +0 -0
  250. package/es/src/assets/img/video_default_cover.png +0 -0
  251. package/es/src/assets/img/video_hover.png +0 -0
  252. package/es/src/assets/img/video_play_hover.png +0 -0
  253. package/es/src/assets/img/xb_big.png +0 -0
  254. package/es/src/assets/img/xb_small.png +0 -0
@@ -1,40 +1,125 @@
1
- import { defineComponent, ref, reactive, provide, onMounted, openBlock, createElementBlock, createElementVNode } from 'vue';
2
- import { fabric } from 'fabric';
1
+ import { defineComponent, ref, computed, reactive, provide, onMounted, openBlock, createElementBlock, createElementVNode } from 'vue';
2
+ import { fabric } from './utils/index.js';
3
+ import { InjectionCanvas, InjectionPropItems } from './interface.js';
4
+ import { defaultBorderStyle } from './hooks/useDraw.js';
5
+ import useTop from './hooks/useTop.js';
6
+ import useCenter from './hooks/useCenter.js';
7
+ import useLeft from './hooks/useLeft.js';
3
8
 
4
9
  const _hoisted_1 = { class: "c-fabric-chart" };
5
10
  var script = /* @__PURE__ */ defineComponent({
6
11
  __name: "FabricChart",
7
12
  props: {
8
- data: { type: Object, required: true }
13
+ data: { type: null, required: true }
9
14
  },
10
15
  setup(__props) {
11
16
  const props = __props;
12
17
  const canvasRef = ref(null);
13
18
  let canvas = ref();
14
- const gridXNumber = () => {
19
+ const gridXNumber = computed(() => {
15
20
  const { grid } = props.data;
16
21
  return grid.mainXCell * grid.subXCell;
17
- };
18
- const endX = () => {
22
+ });
23
+ const gridYNumber = computed(() => {
24
+ const { grid } = props.data;
25
+ return grid.mainYCell * grid.subYCell;
26
+ });
27
+ const endX = computed(() => {
19
28
  const { width, right = null } = props.data;
20
29
  if (!right)
21
30
  return width;
22
31
  const endWidth = right.width || 50;
23
32
  return width - endWidth;
24
- };
25
- const originX = () => {
33
+ });
34
+ const originX = computed(() => {
26
35
  const { top } = props.data;
27
36
  const originX2 = top.titleWidth;
28
- const residue = (endX() - originX2) % gridXNumber();
37
+ const residue = (endX.value - originX2) % gridXNumber.value;
29
38
  return originX2 + residue;
30
- };
39
+ });
40
+ const endY = computed(() => {
41
+ const { bottom = null, height } = props.data;
42
+ if (!bottom)
43
+ return height;
44
+ const endHeight = height || 30;
45
+ return height - endHeight;
46
+ });
47
+ const originY = computed(() => {
48
+ var _a;
49
+ const { top } = props.data;
50
+ const dateHeight = ((_a = top.date) == null ? void 0 : _a.height) || 0;
51
+ const dayHeight = top.dayHeight || 0;
52
+ const xScaleHeight = top.xScalevalue.height || 15;
53
+ const topHeight = dateHeight + dayHeight + xScaleHeight;
54
+ const residue = (endY.value - topHeight) % gridYNumber.value;
55
+ return topHeight + residue;
56
+ });
57
+ const xCellWidth = computed(() => {
58
+ return (endX.value - originX.value) / gridXNumber.value;
59
+ });
60
+ const yCellHeight = computed(() => {
61
+ return (endY.value - originY.value) / gridYNumber.value;
62
+ });
63
+ const xScaleList = computed(() => {
64
+ const { top } = props.data;
65
+ const dateList = top.date.list;
66
+ const dayList = top.xScalevalue.list;
67
+ const timeList = dateList.map((item) => {
68
+ return dayList.map((v) => {
69
+ return new Date(`${item} ${v}:00`).getTime();
70
+ });
71
+ });
72
+ return timeList.flat();
73
+ });
74
+ const xScaleCell = computed(() => {
75
+ return xScaleList.value[1] - xScaleList.value[0];
76
+ });
77
+ const breatheYCell = computed(() => {
78
+ const { yScaleValue, spaceGridNumber = 5 } = props.data.left;
79
+ const list = yScaleValue.find((v) => v.type === "breathe").list;
80
+ return list ? yCellHeight.value / ((parseInt(list[1]) - parseInt(list[0])) / spaceGridNumber) : 0;
81
+ });
82
+ const pulseYCell = computed(() => {
83
+ const { yScaleValue, spaceGridNumber = 5 } = props.data.left;
84
+ const list = yScaleValue.find((v) => v.type === "pulse").list;
85
+ return yCellHeight.value / ((parseInt(list[1]) - parseInt(list[0])) / spaceGridNumber);
86
+ });
87
+ const centigradeYCell = computed(() => {
88
+ const { yScaleValue, spaceGridNumber = 5 } = props.data.left;
89
+ const list = yScaleValue.find((v) => v.type === "centigrade").list;
90
+ return yCellHeight.value / ((parseInt(list[1]) - parseInt(list[0])) / spaceGridNumber);
91
+ });
92
+ const event = computed(() => {
93
+ var _a;
94
+ return ((_a = props.data.grid) == null ? void 0 : _a.event) || { selectable: true, evented: true };
95
+ });
31
96
  const propItems = reactive({
32
97
  canvasWidth: props.data.width,
33
98
  canvasHeight: props.data.height,
34
- originX: originX()
99
+ borderStyle: props.data.borderStyle || defaultBorderStyle,
100
+ grid: props.data.grid,
101
+ top: props.data.top,
102
+ left: props.data.left,
103
+ gridXNumber: gridXNumber.value,
104
+ gridYNumber: gridYNumber.value,
105
+ originX: originX.value,
106
+ originY: originY.value,
107
+ endX: endX.value,
108
+ endY: endY.value,
109
+ xCellWidth: xCellWidth.value,
110
+ yCellHeight: yCellHeight.value,
111
+ xScaleList: xScaleList.value,
112
+ xScaleCell: xScaleCell.value,
113
+ breatheYCell: breatheYCell.value,
114
+ pulseYCell: pulseYCell.value,
115
+ centigradeYCell: centigradeYCell.value,
116
+ event: event.value
35
117
  });
36
- provide("canvas", canvas);
37
- provide("propItems", propItems);
118
+ provide(InjectionCanvas, canvas);
119
+ provide(InjectionPropItems, propItems);
120
+ useTop(canvas, propItems);
121
+ useCenter(canvas, propItems);
122
+ useLeft(canvas, propItems);
38
123
  onMounted(() => {
39
124
  canvas.value = new fabric.Canvas(canvasRef.value, {
40
125
  width: propItems.canvasWidth,
@@ -0,0 +1,4 @@
1
+ import { Ref } from 'vue';
2
+ import { fabric } from '../utils';
3
+ import { IPropItems } from '../interface';
4
+ export default function useCenter(canvas: Ref<fabric.Canvas>, propItems: IPropItems): void;
@@ -0,0 +1,7 @@
1
+ import useGrid from './useGrid.js';
2
+
3
+ function useCenter(canvas, propItems) {
4
+ useGrid(canvas, propItems);
5
+ }
6
+
7
+ export { useCenter as default };
@@ -0,0 +1,42 @@
1
+ import { fabric } from '../utils';
2
+ import { ILineOptions, ITextOptions } from '../interface';
3
+ export declare const defaultStyle: {
4
+ evented: boolean;
5
+ selectable: boolean;
6
+ };
7
+ export declare const defaultBorderStyle: {
8
+ evented: boolean;
9
+ selectable: boolean;
10
+ stroke: string;
11
+ strokeWidth: number;
12
+ };
13
+ export declare const defaultLineStyle: {
14
+ evented: boolean;
15
+ selectable: boolean;
16
+ stroke: string;
17
+ strokeWidth: number;
18
+ strokeDashArray: number[];
19
+ };
20
+ export declare const defaultRectStyle: {
21
+ evented: boolean;
22
+ selectable: boolean;
23
+ fill: string;
24
+ stroke: string;
25
+ strokeWidth: number;
26
+ originX: string;
27
+ originY: string;
28
+ };
29
+ export declare const defaultTextStyle: {
30
+ evented: boolean;
31
+ selectable: boolean;
32
+ fontFamily: string;
33
+ fontSize: number;
34
+ fill: string;
35
+ centeredRotation: boolean;
36
+ originX: string;
37
+ originY: string;
38
+ lineHeight: number;
39
+ };
40
+ export declare function drawLine(points: number[], style: Partial<ILineOptions>): fabric.Line;
41
+ export declare function drawTextGroup(rectStyle: Partial<fabric.IRectOptions>, fontStyle: Partial<ITextOptions>, groupStyle: Partial<fabric.IGroupOptions>): fabric.Group;
42
+ export declare function drawPoint(type: string, style: any): fabric.Triangle | fabric.Circle | undefined;
@@ -0,0 +1,76 @@
1
+ import { fabric } from '../utils/index.js';
2
+
3
+ const defaultStyle = {
4
+ evented: false,
5
+ selectable: false
6
+ };
7
+ const defaultBorderStyle = {
8
+ stroke: "#999",
9
+ strokeWidth: 1,
10
+ ...defaultStyle
11
+ };
12
+ const defaultLineStyle = {
13
+ stroke: "#000",
14
+ strokeWidth: 1,
15
+ strokeDashArray: [0, 0],
16
+ ...defaultStyle
17
+ };
18
+ const defaultRectStyle = {
19
+ fill: "transparent",
20
+ stroke: "#999",
21
+ strokeWidth: 1,
22
+ originX: "center",
23
+ originY: "center",
24
+ ...defaultStyle
25
+ };
26
+ const defaultTextStyle = {
27
+ fontFamily: "\u5FAE\u8F6F\u96C5\u9ED1",
28
+ fontSize: 12,
29
+ fill: "#000",
30
+ centeredRotation: true,
31
+ originX: "center",
32
+ originY: "center",
33
+ lineHeight: 1,
34
+ ...defaultStyle
35
+ };
36
+ function drawLine(points, style) {
37
+ return new fabric.Line(points, {
38
+ ...defaultLineStyle,
39
+ ...style
40
+ });
41
+ }
42
+ function drawTextGroup(rectStyle, fontStyle, groupStyle) {
43
+ const rect = new fabric.Rect({
44
+ ...defaultRectStyle,
45
+ ...rectStyle
46
+ });
47
+ const texts = new fabric.Text(String(fontStyle.value), {
48
+ ...defaultTextStyle,
49
+ ...fontStyle
50
+ });
51
+ return new fabric.Group([rect, texts], {
52
+ ...groupStyle
53
+ });
54
+ }
55
+ function drawPoint(type, style) {
56
+ switch (type) {
57
+ case "triangle":
58
+ return new fabric.Triangle({
59
+ width: 20,
60
+ height: 20,
61
+ strokeWidth: 1,
62
+ scale: 1,
63
+ ...style
64
+ });
65
+ case "circle":
66
+ return new fabric.Circle({
67
+ objectCaching: false,
68
+ strokeWidth: 1,
69
+ radius: 5,
70
+ scale: 1,
71
+ ...style
72
+ });
73
+ }
74
+ }
75
+
76
+ export { defaultBorderStyle, defaultLineStyle, defaultRectStyle, defaultStyle, defaultTextStyle, drawLine, drawPoint, drawTextGroup };
@@ -0,0 +1,4 @@
1
+ import { Ref } from 'vue';
2
+ import { fabric } from '../utils';
3
+ import { IPropItems } from '../interface';
4
+ export default function useGrid(canvas: Ref<fabric.Canvas>, propItems: IPropItems): void;
@@ -0,0 +1,45 @@
1
+ import { onMounted, nextTick } from 'vue';
2
+ import { fabric } from '../utils/index.js';
3
+ import { drawLine } from './useDraw.js';
4
+
5
+ function useGrid(canvas, propItems) {
6
+ const { gridYNumber, originY, grid, originX, endX, xCellWidth, yCellHeight, gridXNumber, endY } = propItems;
7
+ const yList = [];
8
+ const xList = [];
9
+ for (let i = 0; i <= gridYNumber; i++) {
10
+ const y = originY + parseInt(String(yCellHeight * (gridYNumber - i)));
11
+ const style = i % grid.subYCell === 0 ? grid.mainLineStyle || {} : grid.subLineStyle || {};
12
+ yList.push(drawLine([originX, y, endX, y], {
13
+ id: i + "_" + new Date().getTime(),
14
+ ...style
15
+ }));
16
+ }
17
+ for (let i = 0; i <= gridXNumber; i++) {
18
+ const x = originX + parseInt(String(xCellWidth * i));
19
+ let style;
20
+ style = i % grid.subXCell === 0 ? grid.mainLineStyle || {} : grid.subLineStyle || {};
21
+ if (i % grid.subSecondXCell === 0) {
22
+ style = grid.subSecondLineStyle || {};
23
+ }
24
+ if (i % grid.subXCell === 0) {
25
+ style = grid.mainLineStyle || {};
26
+ }
27
+ xList.push(drawLine([x, originY, x, endY], {
28
+ id: i + "_" + new Date().getTime(),
29
+ ...style
30
+ }));
31
+ }
32
+ const group = new fabric.Group([...xList, ...yList], {
33
+ evented: false,
34
+ selectable: false
35
+ });
36
+ onMounted(() => {
37
+ nextTick(() => {
38
+ canvas.value.add(group);
39
+ canvas.value.sendToBack(group);
40
+ canvas.value.renderAll();
41
+ });
42
+ });
43
+ }
44
+
45
+ export { useGrid as default };
@@ -0,0 +1,4 @@
1
+ import { Ref } from 'vue';
2
+ import { fabric } from '../utils';
3
+ import { IPropItems } from '../interface';
4
+ export default function useLeft(canvas: Ref<fabric.Canvas>, propItems: IPropItems): void;
@@ -0,0 +1,66 @@
1
+ import { onMounted, nextTick } from 'vue';
2
+ import { fabric } from '../utils/index.js';
3
+ import { defaultTextStyle, defaultStyle, defaultRectStyle } from './useDraw.js';
4
+
5
+ function useLeft(canvas, propItems) {
6
+ const { originY, endY, originX, yCellHeight, borderStyle, left } = propItems;
7
+ function drawScaleValue() {
8
+ let groupList = [];
9
+ const column = left.yScaleValue.length;
10
+ const colWidth = originX / column;
11
+ const residue = originX % column;
12
+ const firstColWidth = colWidth + residue;
13
+ left.yScaleValue.forEach((item, index) => {
14
+ let list = [];
15
+ const rectWidth = index === 0 ? firstColWidth : colWidth;
16
+ const rectLeft = index === 0 ? 0 : firstColWidth + (index - 1) * colWidth;
17
+ const line = index > 0 ? new fabric.Line([rectLeft, originY, rectLeft, endY], {
18
+ ...borderStyle
19
+ }) : null;
20
+ line && list.push(line);
21
+ const leftVal = rectLeft + rectWidth / 2;
22
+ const spaceGridNumber = left.spaceGridNumber || 5;
23
+ item.list.forEach((v, i) => {
24
+ const top = endY - i * yCellHeight * spaceGridNumber;
25
+ const text = new fabric.Text(String(v), {
26
+ ...defaultTextStyle,
27
+ left: leftVal,
28
+ top: i === 0 ? top - 5 : top,
29
+ ...item.style
30
+ });
31
+ list.push(text);
32
+ });
33
+ let title = item.name || "";
34
+ if (item.unit)
35
+ title += "\n" + item.unit;
36
+ title && list.push(new fabric.Text(String(title), {
37
+ ...defaultTextStyle,
38
+ left: leftVal,
39
+ top: originY + yCellHeight * spaceGridNumber / 2,
40
+ textAlign: "center",
41
+ ...item.style
42
+ }));
43
+ const group2 = new fabric.Group(list, defaultStyle);
44
+ groupList.push(group2);
45
+ });
46
+ groupList.push(new fabric.Rect({
47
+ ...defaultStyle,
48
+ ...defaultRectStyle,
49
+ width: originX,
50
+ height: endY - originY,
51
+ left: 0,
52
+ top: originY
53
+ }));
54
+ const group = groupList.length > 0 ? new fabric.Group([...groupList], { ...defaultStyle }) : null;
55
+ group && group.sendToBack();
56
+ group && canvas.value.add(group);
57
+ }
58
+ onMounted(() => {
59
+ nextTick(() => {
60
+ drawScaleValue();
61
+ canvas.value.renderAll();
62
+ });
63
+ });
64
+ }
65
+
66
+ export { useLeft as default };
@@ -0,0 +1,4 @@
1
+ import { Ref } from 'vue';
2
+ import { fabric } from '../utils';
3
+ import { IPropItems } from '../interface';
4
+ export default function useTop(canvas: Ref<fabric.Canvas>, propItems: IPropItems): void;
@@ -0,0 +1,124 @@
1
+ import { onMounted, nextTick } from 'vue';
2
+ import { fabric } from '../utils/index.js';
3
+ import { defaultStyle, drawTextGroup, defaultTextStyle, defaultRectStyle } from './useDraw.js';
4
+
5
+ function useTop(canvas, propItems) {
6
+ const { originY, grid, originX, xCellWidth, gridXNumber, top } = propItems;
7
+ function drawTop() {
8
+ let list = [];
9
+ drawTopDate(list);
10
+ drawTopDay(list);
11
+ drawTopTime(list);
12
+ const group = list.length > 0 ? new fabric.Group([...list], { ...defaultStyle }) : null;
13
+ group && group.sendToBack();
14
+ group && canvas.value.add(group);
15
+ }
16
+ function drawTopTime(list) {
17
+ var _a, _b;
18
+ const dateHeight = ((_a = top.date) == null ? void 0 : _a.height) || 0;
19
+ const dayHeight = top.dayHeight || 0;
20
+ const height = originY - dateHeight - dayHeight;
21
+ const titleHeight = dayHeight + height;
22
+ const title = drawTextGroup({
23
+ width: originX,
24
+ height: titleHeight,
25
+ ...defaultRectStyle
26
+ }, {
27
+ value: top.xScalevalue.title,
28
+ ...defaultTextStyle,
29
+ ...((_b = top.date) == null ? void 0 : _b.style) || {}
30
+ }, {
31
+ left: 0,
32
+ top: dateHeight
33
+ });
34
+ list.push(title);
35
+ let timeList = [];
36
+ for (let j = 0; j < grid.mainXCell; j++) {
37
+ timeList.push(top.xScalevalue.list);
38
+ }
39
+ timeList.flat().forEach((v, i) => {
40
+ var _a2;
41
+ const left = originX + i * xCellWidth;
42
+ const textGroup = drawTextGroup({
43
+ width: xCellWidth,
44
+ height
45
+ }, {
46
+ value: v,
47
+ ...defaultTextStyle,
48
+ ...((_a2 = top.date) == null ? void 0 : _a2.style) || {}
49
+ }, {
50
+ left,
51
+ top: dateHeight + dayHeight
52
+ });
53
+ list.push(textGroup);
54
+ });
55
+ }
56
+ function drawTopDay(list) {
57
+ var _a;
58
+ if (!top.dayHeight)
59
+ return false;
60
+ const height = top.dayHeight;
61
+ const width = xCellWidth * grid.subSecondXCell;
62
+ const dayList = gridXNumber / grid.subSecondXCell;
63
+ for (let i = 0; i < dayList; i++) {
64
+ const left = originX + i * width;
65
+ const value = i % 2 === 0 ? "\u4E0A\u5348" : "\u4E0B\u5348";
66
+ const textGroup = drawTextGroup({
67
+ width,
68
+ height
69
+ }, {
70
+ value,
71
+ ...defaultTextStyle,
72
+ ...((_a = top.date) == null ? void 0 : _a.style) || {}
73
+ }, {
74
+ left,
75
+ top: top.date.height || 0
76
+ });
77
+ list.push(textGroup);
78
+ }
79
+ }
80
+ function drawTopDate(list) {
81
+ var _a;
82
+ if (!top.date.height)
83
+ return false;
84
+ const height = top.date.height;
85
+ const title = drawTextGroup({
86
+ width: originX,
87
+ height,
88
+ ...defaultRectStyle
89
+ }, {
90
+ value: top.date.title,
91
+ ...defaultTextStyle,
92
+ ...((_a = top.date) == null ? void 0 : _a.style) || {}
93
+ }, {
94
+ left: 0,
95
+ top: 0
96
+ });
97
+ list.push(title);
98
+ const width = xCellWidth * grid.subXCell;
99
+ top.date.list.forEach((v, i) => {
100
+ var _a2;
101
+ const left = originX + i * width;
102
+ const textGroup = drawTextGroup({
103
+ width,
104
+ height
105
+ }, {
106
+ value: v,
107
+ ...defaultTextStyle,
108
+ ...((_a2 = top.date) == null ? void 0 : _a2.style) || {}
109
+ }, {
110
+ left,
111
+ top: 0
112
+ });
113
+ list.push(textGroup);
114
+ });
115
+ }
116
+ onMounted(() => {
117
+ nextTick(() => {
118
+ drawTop();
119
+ canvas.value.renderAll();
120
+ });
121
+ });
122
+ }
123
+
124
+ export { useTop as default };
@@ -0,0 +1,88 @@
1
+ import { InjectionKey, Ref } from 'vue';
2
+ import { fabric } from './utils';
3
+ interface IEvent {
4
+ selectable: boolean;
5
+ evented: boolean;
6
+ }
7
+ interface IGrid {
8
+ mainXCell: number;
9
+ subXCell: number;
10
+ subSecondXCell: number;
11
+ mainYCell: number;
12
+ subYCell: number;
13
+ mainLineStyle?: fabric.ILineOptions;
14
+ subLineStyle?: fabric.ILineOptions;
15
+ subSecondLineStyle?: fabric.ILineOptions;
16
+ event?: Partial<IEvent>;
17
+ }
18
+ export interface IPropItems {
19
+ canvasWidth: number;
20
+ canvasHeight: number;
21
+ borderStyle: fabric.ILineOptions;
22
+ grid: IGrid;
23
+ top: ITop;
24
+ left: ILeft;
25
+ gridXNumber: number;
26
+ gridYNumber: number;
27
+ originX: number;
28
+ originY: number;
29
+ endX: number;
30
+ endY: number;
31
+ xCellWidth: number;
32
+ yCellHeight: number;
33
+ xScaleList: Array<string | number>;
34
+ xScaleCell: number;
35
+ breatheYCell: number;
36
+ pulseYCell: number;
37
+ centigradeYCell: number;
38
+ event: Partial<IEvent>;
39
+ }
40
+ interface IPoint {
41
+ time: string;
42
+ value: string | number;
43
+ }
44
+ interface IOther {
45
+ style?: fabric.ITextOptions;
46
+ list: Array<IPoint>;
47
+ }
48
+ interface IDate {
49
+ title: string;
50
+ height?: number;
51
+ list: Array<string | number>;
52
+ style?: fabric.ITextOptions;
53
+ }
54
+ interface ITop {
55
+ dateStyle?: fabric.ITextOptions;
56
+ titleWidth: number;
57
+ date: IDate;
58
+ xScalevalue: IDate;
59
+ dayHeight?: number;
60
+ }
61
+ interface ILeft {
62
+ spaceGridNumber?: number;
63
+ yScaleValue: Array<any>;
64
+ }
65
+ interface IRight {
66
+ width?: number;
67
+ yScaleValue: any;
68
+ }
69
+ export interface IData {
70
+ width: number;
71
+ height: number;
72
+ borderStyle?: fabric.ILineOptions;
73
+ grid: IGrid;
74
+ other?: IOther;
75
+ top: ITop;
76
+ left: ILeft;
77
+ right?: IRight;
78
+ bottom?: any;
79
+ }
80
+ export interface ILineOptions extends fabric.ILineOptions {
81
+ [key: string]: any;
82
+ }
83
+ export interface ITextOptions extends fabric.ITextOptions {
84
+ [key: string]: any;
85
+ }
86
+ export declare const InjectionCanvas: InjectionKey<Ref<fabric.Canvas>>;
87
+ export declare const InjectionPropItems: InjectionKey<IPropItems>;
88
+ export {};
@@ -0,0 +1,4 @@
1
+ const InjectionCanvas = Symbol("canvas");
2
+ const InjectionPropItems = Symbol("propItems");
3
+
4
+ export { InjectionCanvas, InjectionPropItems };
@@ -0,0 +1,2 @@
1
+ /*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
2
+ export const fabric: any;