cnhis-design-vue 3.3.3-beta.67 → 3.3.3-beta.69

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/README.md CHANGED
@@ -1,87 +1,87 @@
1
- # 安装
2
-
3
- ```shell
4
- npm i cnhis-design-vue@[版本号]
5
- # or
6
- yarn add cnhis-design-vue@[版本号] #推荐
7
- ```
8
-
9
- ## 1.全局引入
10
-
11
- ```typescript
12
- // main.ts
13
- import { createApp } from 'vue';
14
- import App from './App.vue';
15
- import 'cnhis-design-vue/es/packages/index.css';
16
- import cui from 'cnhis-design-vue';
17
-
18
- const app = createApp(App);
19
- app.use(cui).mount('#app');
20
- ```
21
-
22
- ## 2. 按需引入
23
-
24
- 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
-
26
- ### 2.1 样式处理方式1 (按需引入样式)
27
-
28
- ```shell
29
- # 安装自动导入样式的插件
30
- npm i -d vite-plugin-style-import
31
- ```
32
-
33
- ```typescript
34
- // vite.config.ts
35
- import { defineConfig } from 'vite';
36
- import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
-
38
- export default defineConfig({
39
- plugins: [
40
- // ...otherPlugins
41
- createStyleImportPlugin({
42
- libs: [
43
- {
44
- libraryName: 'cnhis-design-vue',
45
- esModule: true,
46
- ensureStyleFile: true,
47
- resolveStyle: name => {
48
- return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
- }
50
- }
51
- ]
52
- })
53
- ]
54
- });
55
- ```
56
-
57
- ### 2.2 样式处理方式2 (全局引入样式)
58
-
59
- ```typescript
60
- // main.ts
61
- import 'cnhis-design-vue/es/components/index.css';
62
- ```
63
-
64
- ## 3.FAQ
65
-
66
- ### 3.1 项目打包后样式丢失
67
-
68
- 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
-
70
- ```typescript
71
- // vite.config.ts
72
- import { defineConfig } from 'vite';
73
-
74
- export default defineConfig({
75
- build: {
76
- rollupOptions: {
77
- // ..otherOptions
78
- output: {
79
- dir: './dist',
80
- manualChunks: {
81
- 'cnhis-vendor': ['cnhis-design-vue']
82
- }
83
- }
84
- }
85
- }
86
- });
87
- ```
1
+ # 安装
2
+
3
+ ```shell
4
+ npm i cnhis-design-vue@[版本号]
5
+ # or
6
+ yarn add cnhis-design-vue@[版本号] #推荐
7
+ ```
8
+
9
+ ## 1.全局引入
10
+
11
+ ```typescript
12
+ // main.ts
13
+ import { createApp } from 'vue';
14
+ import App from './App.vue';
15
+ import 'cnhis-design-vue/es/packages/index.css';
16
+ import cui from 'cnhis-design-vue';
17
+
18
+ const app = createApp(App);
19
+ app.use(cui).mount('#app');
20
+ ```
21
+
22
+ ## 2. 按需引入
23
+
24
+ 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
+
26
+ ### 2.1 样式处理方式1 (按需引入样式)
27
+
28
+ ```shell
29
+ # 安装自动导入样式的插件
30
+ npm i -d vite-plugin-style-import
31
+ ```
32
+
33
+ ```typescript
34
+ // vite.config.ts
35
+ import { defineConfig } from 'vite';
36
+ import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
+
38
+ export default defineConfig({
39
+ plugins: [
40
+ // ...otherPlugins
41
+ createStyleImportPlugin({
42
+ libs: [
43
+ {
44
+ libraryName: 'cnhis-design-vue',
45
+ esModule: true,
46
+ ensureStyleFile: true,
47
+ resolveStyle: name => {
48
+ return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
+ }
50
+ }
51
+ ]
52
+ })
53
+ ]
54
+ });
55
+ ```
56
+
57
+ ### 2.2 样式处理方式2 (全局引入样式)
58
+
59
+ ```typescript
60
+ // main.ts
61
+ import 'cnhis-design-vue/es/components/index.css';
62
+ ```
63
+
64
+ ## 3.FAQ
65
+
66
+ ### 3.1 项目打包后样式丢失
67
+
68
+ 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
+
70
+ ```typescript
71
+ // vite.config.ts
72
+ import { defineConfig } from 'vite';
73
+
74
+ export default defineConfig({
75
+ build: {
76
+ rollupOptions: {
77
+ // ..otherOptions
78
+ output: {
79
+ dir: './dist',
80
+ manualChunks: {
81
+ 'cnhis-vendor': ['cnhis-design-vue']
82
+ }
83
+ }
84
+ }
85
+ }
86
+ });
87
+ ```
@@ -114,7 +114,20 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
114
114
  eventContent: eventContentRender,
115
115
  resourceLabelContent: resourceLabelContentRender,
116
116
  select: (...args) => emit("select", ...args),
117
- eventDrop: (...args) => emit("eventDrag", ...args),
117
+ eventDrop: (...args) => {
118
+ var _a, _b;
119
+ const [info] = args;
120
+ const eventId = info.event.id;
121
+ const targetEvent = props.events.find((event) => event.id === eventId);
122
+ if (targetEvent && targetEvent.resourceEditable === false) {
123
+ const oldResourceId = (_a = info.oldResource) == null ? void 0 : _a.id;
124
+ const newResourceId = (_b = info.newResource) == null ? void 0 : _b.id;
125
+ if (oldResourceId !== newResourceId) {
126
+ return;
127
+ }
128
+ }
129
+ emit("eventDrag", ...args);
130
+ },
118
131
  eventResize: (...args) => emit("eventResize", ...args),
119
132
  eventClick: (...args) => emit("eventClick", ...args)
120
133
  });
@@ -200,10 +213,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
200
213
  immediate: true
201
214
  });
202
215
  watch(() => props.events, (events) => {
203
- calendarOptions.events = cloneDeep(events).map((event) => ({
204
- ...event,
205
- resourceEditable: false
206
- }));
216
+ calendarOptions.events = cloneDeep(events);
207
217
  }, {
208
218
  deep: true,
209
219
  immediate: true
@@ -175,6 +175,9 @@ declare const _default: import("vue").DefineComponent<{
175
175
  modelValue: unknown[];
176
176
  componentData: Record<string, any>;
177
177
  } & {
178
+ /**
179
+ * 改变弹窗大小
180
+ */
178
181
  itemKey?: string | Function | undefined;
179
182
  }>, {
180
183
  move: Function;
@@ -708,9 +708,6 @@ declare const _default: import("vue").DefineComponent<{
708
708
  }[];
709
709
  handleEditDisplayCategory: (item: import("../../../components/table-filter/src/types").ICategoryItemType) => void;
710
710
  handleDisplayCategoryAddState: () => void;
711
- /**
712
- * 改变展示方式
713
- */
714
711
  findConditionByDisplayCategory: (sid: string) => unknown;
715
712
  handleDisplayCategorySelectProxy: (item: import("../../../components/table-filter/src/types").ICategoryItemType) => void;
716
713
  clearFormData: () => void;
@@ -1,4 +1,4 @@
1
1
  import { Ref } from 'vue';
2
2
  import { fabric } from '../../../../../shared/utils/fabricjs';
3
3
  import { IPropItems, IObject } from '../../../../../components/fabric-chart/src/interface';
4
- export declare function useOther(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: Function, computedX: Function, computedY: Function, fixedNoRisePoints: Set<IObject>): void;
4
+ export declare function useOther(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: Function, computedX: Function, computedY: Function, fixedNoRisePoints: Set<IObject>, getXValue: Function): void;
@@ -1,7 +1,7 @@
1
1
  import { fabric } from '../../../../../shared/utils/fabricjs/index.js';
2
2
  import { drawLine, defaultStyle } from '../useDraw.js';
3
- import 'date-fns';
4
- import { cloneDeep, last } from 'lodash-es';
3
+ import { parse, isBefore, addDays, getDate } from 'date-fns';
4
+ import { last, cloneDeep } from 'lodash-es';
5
5
  import '../useEvent.js';
6
6
  import '../useShadow.js';
7
7
  import '../useCommon.js';
@@ -14,14 +14,15 @@ import '@vueuse/core';
14
14
  import '../surgicalAnesthesia/useOther.js';
15
15
  import '../../../../../shared/utils/index.js';
16
16
 
17
- function useOther(canvas, propItems, emits, computedX, computedY, fixedNoRisePoints) {
17
+ function useOther(canvas, propItems, emits, computedX, computedY, fixedNoRisePoints, getXValue) {
18
18
  const {
19
19
  left: leftObj,
20
20
  other,
21
21
  vitalSignsOriginY,
22
22
  xCellWidth,
23
23
  yCellHeight,
24
- endX
24
+ endX,
25
+ originX
25
26
  } = propItems;
26
27
  const getYCellHeight = () => {
27
28
  const fontSize = Math.min(...((other == null ? void 0 : other.list) || []).map((item) => {
@@ -32,11 +33,35 @@ function useOther(canvas, propItems, emits, computedX, computedY, fixedNoRisePoi
32
33
  };
33
34
  const _yCellHeight = getYCellHeight();
34
35
  let textDiff = 0;
35
- function drawOther() {
36
- var _a, _b;
36
+ function handleCrossDayLayout(currentTime, itemLeft, lastLeft, eventList) {
37
+ const newLeft = itemLeft + xCellWidth;
38
+ const nextTime = getXValue(newLeft);
39
+ if (isCrossDay(currentTime, nextTime)) {
40
+ adjustEventsForCrossDay(eventList);
41
+ return itemLeft;
42
+ } else {
43
+ return lastLeft + xCellWidth;
44
+ }
45
+ }
46
+ function adjustEventsForCrossDay(eventList) {
47
+ const currentColumnEvents = [...eventList];
48
+ const sortedEvents = currentColumnEvents.sort((a, b) => (b.trueLeft || 0) - (a.trueLeft || 0));
49
+ for (let i = 0; i < sortedEvents.length; i++) {
50
+ const event = sortedEvents[i];
51
+ const nextEvent = sortedEvents[i + 1];
52
+ const prevLeft = event.trueLeft - xCellWidth;
53
+ if (prevLeft >= originX) {
54
+ event.set("left", prevLeft);
55
+ event.trueLeft = prevLeft;
56
+ }
57
+ if (nextEvent && (event.trueLeft || 0) - (nextEvent.trueLeft || 0) > xCellWidth + 1) {
58
+ break;
59
+ }
60
+ }
61
+ }
62
+ function createOtherList() {
37
63
  if (!(other == null ? void 0 : other.list))
38
- return false;
39
- const list = [];
64
+ return [];
40
65
  const otherList = [];
41
66
  cloneDeep(other.list).forEach((item, index) => {
42
67
  item.value = item.value || "";
@@ -44,19 +69,29 @@ function useOther(canvas, propItems, emits, computedX, computedY, fixedNoRisePoi
44
69
  const left = computedX(item.time, true);
45
70
  if (left > endX)
46
71
  return;
47
- const obj = otherList.find((v) => v.left == left);
48
- if (obj) {
49
- obj[align].push(item);
72
+ const existingGroup = otherList.find((v) => v.left === left);
73
+ if (existingGroup) {
74
+ existingGroup[align].push(item);
50
75
  } else {
51
- const initObj = {
76
+ const newGroup = {
52
77
  left,
53
78
  vertical: [],
54
79
  horizontal: []
55
80
  };
56
- initObj[align].push(item);
57
- otherList.push(initObj);
81
+ newGroup[align].push(item);
82
+ otherList.push(newGroup);
58
83
  }
59
84
  });
85
+ return otherList;
86
+ }
87
+ function drawOther() {
88
+ var _a, _b;
89
+ if (!(other == null ? void 0 : other.list))
90
+ return;
91
+ const list = [];
92
+ const otherList = createOtherList();
93
+ if (otherList.length === 0)
94
+ return false;
60
95
  const scaleList = (_b = (_a = leftObj.yScaleValue) == null ? void 0 : _a.find((item) => item.type === "temperature")) == null ? void 0 : _b.list;
61
96
  const fixedTop = (scaleList == null ? void 0 : scaleList.length) ? computedY("temperature", 35) : 0;
62
97
  const isFixed = (v) => v.fixed && fixedTop && (v.fixedValue || v.value);
@@ -99,7 +134,7 @@ function useOther(canvas, propItems, emits, computedX, computedY, fixedNoRisePoi
99
134
  fixedTopY = fixedTop;
100
135
  const lastLeft = ((_a2 = last(list)) == null ? void 0 : _a2.left) || 0;
101
136
  if (item.left <= lastLeft + 0.1) {
102
- leftX = lastLeft + xCellWidth;
137
+ leftX = handleCrossDayLayout(v.time, item.left, lastLeft, list);
103
138
  }
104
139
  if (String(v.value).length) {
105
140
  list.push(drawEventText(v, leftX, topY2));
@@ -197,5 +232,13 @@ function useOther(canvas, propItems, emits, computedX, computedY, fixedNoRisePoi
197
232
  }
198
233
  drawOther();
199
234
  }
235
+ function isCrossDay(dateStr1, dateStr2) {
236
+ const date1 = parse(dateStr1, "yyyy-MM-dd HH:mm", new Date());
237
+ const date2 = parse(dateStr2, "yyyy-MM-dd HH:mm", new Date());
238
+ const earlierDate = isBefore(date1, date2) ? date1 : date2;
239
+ const laterDate = isBefore(date1, date2) ? date2 : date1;
240
+ const earlierDatePlusOneDay = addDays(earlierDate, 1);
241
+ return getDate(earlierDatePlusOneDay) === getDate(laterDate);
242
+ }
200
243
 
201
244
  export { useOther };
@@ -399,7 +399,7 @@ function useTemperatureChart(canvas, props, emits, canvasRef, pointTipProps, poi
399
399
  } = useLeft(canvas, propItems, emits, setPopup, pointTipProps, computedX, computedY, getXValue, getYValue, isAddPoint, updateData, gridPoints);
400
400
  useRight(canvas, propItems, drawScaleValue);
401
401
  useBottom(canvas, propItems);
402
- useOther(canvas, propItems, emits, computedX, computedY, fixedNoRisePoints);
402
+ useOther(canvas, propItems, emits, computedX, computedY, fixedNoRisePoints, getXValue);
403
403
  const {
404
404
  select: _select
405
405
  } = useCanvasEvent(canvas, propItems, emits);
@@ -3649,7 +3649,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
3649
3649
  };
3650
3650
  isForward: boolean;
3651
3651
  };
3652
- trtc: import("trtc-sdk-v5").TRTC;
3652
+ trtc: import("trtc-sdk-v5").default;
3653
3653
  timing: import("vue").Ref<string>;
3654
3654
  voiceClose: import("vue").Ref<boolean>;
3655
3655
  isAudio: import("vue").ComputedRef<boolean>;
@@ -3650,7 +3650,7 @@ declare const _default: import("vue").DefineComponent<{
3650
3650
  };
3651
3651
  isForward: boolean;
3652
3652
  };
3653
- trtc: import("trtc-sdk-v5").TRTC;
3653
+ trtc: import("trtc-sdk-v5").default;
3654
3654
  timing: import("vue").Ref<string>;
3655
3655
  voiceClose: import("vue").Ref<boolean>;
3656
3656
  isAudio: import("vue").ComputedRef<boolean>;
@@ -603,7 +603,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
603
603
  }, {
604
604
  default: withCtx(() => [!unref(isAudioOrVideoMessage)(item.content) ? (openBlock(), createElementBlock(Fragment, {
605
605
  key: 0
606
- }, [createCommentVNode(' <n-button\n quaternary\n size="tiny"\n @click="(event: MouseEvent) => handleSelectLabel(event, item.id)"\n >\n <template #icon>\n <n-icon size="17" :component="HappyOutline" />\n </template>\n </n-button> '), createVNode(unref(NButton), {
606
+ }, [createCommentVNode(' <n-button\r\n quaternary\r\n size="tiny"\r\n @click="(event: MouseEvent) => handleSelectLabel(event, item.id)"\r\n >\r\n <template #icon>\r\n <n-icon size="17" :component="HappyOutline" />\r\n </template>\r\n </n-button> '), createVNode(unref(NButton), {
607
607
  quaternary: "",
608
608
  size: "tiny",
609
609
  onClick: () => setReferenceMsg(item)
@@ -225,7 +225,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
225
225
  round: "",
226
226
  size: 100,
227
227
  onClickCapture: _cache[0] || (_cache[0] = ($event) => showLargeAvatar.value = true)
228
- }, null, 8, ["src"]), createCommentVNode(' <n-upload abstract accept="image/*" @change="onChange">\n <n-upload-trigger #="{ handleClick }" abstract>\n <n-button\n circle\n secondary\n class="edit-avatar"\n v-show="userDetail.id === state.userInfo.id"\n @click="handleClick"\n >\n <template #icon>\n <n-icon size="16" color="#666666" :component="Camera" />\n </template>\n </n-button>\n </n-upload-trigger>\n </n-upload> '), createElementVNode("div", _hoisted_4, [createElementVNode("h4", null, [createElementVNode("label", _hoisted_5, toDisplayString(userDetail.name), 1), withDirectives(createElementVNode("label", {
228
+ }, null, 8, ["src"]), createCommentVNode(' <n-upload abstract accept="image/*" @change="onChange">\r\n <n-upload-trigger #="{ handleClick }" abstract>\r\n <n-button\r\n circle\r\n secondary\r\n class="edit-avatar"\r\n v-show="userDetail.id === state.userInfo.id"\r\n @click="handleClick"\r\n >\r\n <template #icon>\r\n <n-icon size="16" color="#666666" :component="Camera" />\r\n </template>\r\n </n-button>\r\n </n-upload-trigger>\r\n </n-upload> '), createElementVNode("div", _hoisted_4, [createElementVNode("h4", null, [createElementVNode("label", _hoisted_5, toDisplayString(userDetail.name), 1), withDirectives(createElementVNode("label", {
229
229
  class: normalizeClass(["iho-chatRole", unref(isDoctorRole)(userDetail.roleInfo) ? "isDoctor" : ""])
230
230
  }, toDisplayString(unref(getRoleName)(userDetail.roleInfo)), 3), [[vShow, unref(getRoleName)(userDetail.roleInfo)]])]), createElementVNode("p", null, toDisplayString(userDetail.orgName), 1)]), createVNode(unref(NButton), {
231
231
  strong: "",
@@ -58,7 +58,7 @@ declare const _default: import("vue").DefineComponent<{}, {
58
58
  };
59
59
  isForward: boolean;
60
60
  };
61
- trtc: import("trtc-sdk-v5").TRTC;
61
+ trtc: import("trtc-sdk-v5").default;
62
62
  timing: import("vue").Ref<string>;
63
63
  voiceClose: import("vue").Ref<boolean>;
64
64
  isAudio: import("vue").ComputedRef<boolean>;
package/es/env.d.ts CHANGED
@@ -1,25 +1,25 @@
1
- /// <reference types="vite/client" />
2
-
3
- interface ImportMetaEnv {
4
- readonly VITE_APP_TYPE: string;
5
- // 更多环境变量...
6
- }
7
-
8
- interface ImportMeta {
9
- readonly env: ImportMetaEnv;
10
- }
11
-
12
- declare module '*.vue' {
13
- // @ts-ignore
14
- import type { App, defineComponent } from 'vue';
15
- // // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
16
- // // const component: DefineComponent<{}, {}, any>
17
- const component: ReturnType<typeof defineComponent> & {
18
- install(app: App): void;
19
- };
20
- // @ts-ignore
21
- export default component;
22
- }
23
-
24
- declare module '*.js';
25
-
1
+ /// <reference types="vite/client" />
2
+
3
+ interface ImportMetaEnv {
4
+ readonly VITE_APP_TYPE: string;
5
+ // 更多环境变量...
6
+ }
7
+
8
+ interface ImportMeta {
9
+ readonly env: ImportMetaEnv;
10
+ }
11
+
12
+ declare module '*.vue' {
13
+ // @ts-ignore
14
+ import type { App, defineComponent } from 'vue';
15
+ // // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
16
+ // // const component: DefineComponent<{}, {}, any>
17
+ const component: ReturnType<typeof defineComponent> & {
18
+ install(app: App): void;
19
+ };
20
+ // @ts-ignore
21
+ export default component;
22
+ }
23
+
24
+ declare module '*.js';
25
+
@@ -1,5 +1,5 @@
1
1
  var name = "@cnhis-design-vue/shared";
2
- var version = "3.3.3-beta.67";
2
+ var version = "3.3.3-beta.69";
3
3
  var main = "index.ts";
4
4
  var peerDependencies = {
5
5
  "naive-ui": "^2.30.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.3.3-beta.67",
3
+ "version": "3.3.3-beta.69",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -74,5 +74,5 @@
74
74
  "iOS 7",
75
75
  "last 3 iOS versions"
76
76
  ],
77
- "gitHead": "0d3b16a90e477c41a401d8753454bfbd52332077"
77
+ "gitHead": "9d93ee205dff646c62e3b97d0787942d3df46bb4"
78
78
  }