cnhis-design-vue 3.4.0-beta.20 → 3.4.0-beta.22

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
+ ```
@@ -1,6 +1,6 @@
1
1
  import { fabric } from '../../../../../shared/utils/fabricjs/index.js';
2
2
  import { drawLine, defaultStyle } from '../useDraw.js';
3
- import { parse, isBefore, addDays, getDate } from 'date-fns';
3
+ import { parse } from 'date-fns';
4
4
  import { last, cloneDeep } from 'lodash-es';
5
5
  import '../useEvent.js';
6
6
  import '../useShadow.js';
@@ -25,12 +25,12 @@ function useOther(canvas, propItems, emits, computedX, computedY, fixedNoRisePoi
25
25
  };
26
26
  const _yCellHeight = getYCellHeight();
27
27
  let textDiff = 0;
28
- function handleCrossDayLayout(currentTime, itemLeft, lastLeft, eventList) {
29
- const newLeft = itemLeft + xCellWidth;
28
+ function handleCrossDayLayout(currentTime, lastLeft, eventList) {
29
+ const newLeft = lastLeft + xCellWidth;
30
30
  const nextTime = getXValue(newLeft);
31
31
  if (isCrossDay(currentTime, nextTime)) {
32
32
  adjustEventsForCrossDay(eventList);
33
- return itemLeft;
33
+ return lastLeft;
34
34
  } else {
35
35
  return lastLeft + xCellWidth;
36
36
  }
@@ -96,7 +96,7 @@ function useOther(canvas, propItems, emits, computedX, computedY, fixedNoRisePoi
96
96
  item.vertical.forEach((v, i) => {
97
97
  var _a2, _b2, _c, _d, _e;
98
98
  const baseTop = (v.baseTop || 0) * yCellHeight;
99
- const lastLeft = ((_a2 = last(list)) == null ? void 0 : _a2.left) || 0;
99
+ const lastLeft = ((_a2 = last(list)) == null ? void 0 : _a2.trueLeft) || 0;
100
100
  if (i === 0 && item.left <= lastLeft) {
101
101
  leftX = lastLeft + xCellWidth;
102
102
  }
@@ -124,9 +124,9 @@ function useOther(canvas, propItems, emits, computedX, computedY, fixedNoRisePoi
124
124
  var _a2, _b2;
125
125
  const topY2 = vitalSignsOriginY.originY + (v.baseTop || 0) * yCellHeight;
126
126
  fixedTopY = fixedTop;
127
- const lastLeft = ((_a2 = last(list)) == null ? void 0 : _a2.left) || 0;
127
+ const lastLeft = ((_a2 = last(list)) == null ? void 0 : _a2.trueLeft) || 0;
128
128
  if (item.left <= lastLeft + 0.1) {
129
- leftX = handleCrossDayLayout(v.time, item.left, lastLeft, list);
129
+ leftX = handleCrossDayLayout(v.time, lastLeft, list);
130
130
  }
131
131
  if (String(v.value).length) {
132
132
  list.push(drawEventText(v, leftX, topY2));
@@ -223,10 +223,9 @@ function useOther(canvas, propItems, emits, computedX, computedY, fixedNoRisePoi
223
223
  function isCrossDay(dateStr1, dateStr2) {
224
224
  const date1 = parse(dateStr1, "yyyy-MM-dd HH:mm", new Date());
225
225
  const date2 = parse(dateStr2, "yyyy-MM-dd HH:mm", new Date());
226
- const earlierDate = isBefore(date1, date2) ? date1 : date2;
227
- const laterDate = isBefore(date1, date2) ? date2 : date1;
228
- const earlierDatePlusOneDay = addDays(earlierDate, 1);
229
- return getDate(earlierDatePlusOneDay) === getDate(laterDate);
226
+ const date1String = `${date1.getFullYear()}-${date1.getMonth()}-${date1.getDate()}`;
227
+ const date2String = `${date2.getFullYear()}-${date2.getMonth()}-${date2.getDate()}`;
228
+ return date1String !== date2String;
230
229
  }
231
230
 
232
231
  export { useOther };
@@ -553,9 +553,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
553
553
  hide: boolean;
554
554
  }>;
555
555
  draggable: boolean;
556
- isHighlightRow: boolean;
557
556
  idx: number;
558
557
  isHighlight: boolean;
558
+ isHighlightRow: boolean;
559
559
  isFieldSet: boolean;
560
560
  fieldDescribeMode: "column" | "tooltip";
561
561
  hideExpressionOption: AnyObject[];
@@ -594,9 +594,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
594
594
  hide: boolean;
595
595
  }>;
596
596
  draggable: boolean;
597
- isHighlightRow: boolean;
598
597
  idx: number;
599
598
  isHighlight: boolean;
599
+ isHighlightRow: boolean;
600
600
  isFieldSet: boolean;
601
601
  fieldDescribeMode: "column" | "tooltip";
602
602
  hideExpressionOption: AnyObject[];
@@ -773,9 +773,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
773
773
  hide: boolean;
774
774
  }>;
775
775
  draggable: boolean;
776
- isHighlightRow: boolean;
777
776
  idx: number;
778
777
  isHighlight: boolean;
778
+ isHighlightRow: boolean;
779
779
  isFieldSet: boolean;
780
780
  fieldDescribeMode: "column" | "tooltip";
781
781
  hideExpressionOption: AnyObject[];
@@ -384,9 +384,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
384
384
  hide: boolean;
385
385
  }>;
386
386
  draggable: boolean;
387
- isHighlightRow: boolean;
388
387
  idx: number;
389
388
  isHighlight: boolean;
389
+ isHighlightRow: boolean;
390
390
  isFieldSet: boolean;
391
391
  fieldDescribeMode: "column" | "tooltip";
392
392
  hideExpressionOption: AnyObject[];
@@ -601,7 +601,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
601
601
  }, {
602
602
  default: withCtx(() => [!unref(isAudioOrVideoMessage)(item.content) ? (openBlock(), createElementBlock(Fragment, {
603
603
  key: 0
604
- }, [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), {
604
+ }, [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), {
605
605
  quaternary: "",
606
606
  size: "tiny",
607
607
  onClick: () => setReferenceMsg(item)
@@ -170,7 +170,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
170
170
  round: "",
171
171
  size: 100,
172
172
  onClickCapture: _cache[0] || (_cache[0] = ($event) => showLargeAvatar.value = true)
173
- }, 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", {
173
+ }, 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", {
174
174
  class: normalizeClass(["iho-chatRole", unref(isDoctorRole)(userDetail.roleInfo) ? "isDoctor" : ""])
175
175
  }, toDisplayString(unref(getRoleName)(userDetail.roleInfo)), 3), [[vShow, unref(getRoleName)(userDetail.roleInfo)]])]), createElementVNode("p", null, toDisplayString(userDetail.orgName), 1)]), createVNode(unref(NButton), {
176
176
  strong: "",
@@ -10,12 +10,14 @@ export declare class ShortcutManager {
10
10
  static log(message: string, dryRun?: boolean): string;
11
11
  constructor(environmentEle?: MaybeRef<HTMLElement | undefined>, scope?: string | Symbol);
12
12
  get traverse(): Omit<ShortcutItem, "callback">[];
13
+ remove(key: string): void;
13
14
  private query;
14
15
  update(key: string, info: KeyboardEvent | Partial<ShortcutSignatureInfo>): Promise<void>;
15
16
  register(shortcutItem: ShortcutItem): {
16
17
  stop: () => void;
17
18
  start: () => void;
18
19
  signature: () => string;
20
+ remove: () => void;
19
21
  };
20
22
  start(): this;
21
23
  destroy(): void;
@@ -26,6 +28,7 @@ export declare function useShortcuts(scope?: MaybeRef<string | Symbol | undefine
26
28
  stop: () => void;
27
29
  signature: () => string;
28
30
  start: () => void;
31
+ remove: () => void;
29
32
  };
30
33
  traverse: () => Omit<ShortcutItem, "callback">[];
31
34
  clear: () => void;
@@ -23,6 +23,10 @@ class ShortcutManager {
23
23
  get traverse() {
24
24
  return [...Object.values(this.shortcutCache.value)].sort((a, b) => (a.order || 0) - (b.order || 0));
25
25
  }
26
+ remove(key) {
27
+ Reflect.deleteProperty(this.shortcutCache.value, key);
28
+ this.shortcutCallbackMap.delete(key);
29
+ }
26
30
  query(key) {
27
31
  return this.shortcutCache.value[key];
28
32
  }
@@ -61,6 +65,7 @@ class ShortcutManager {
61
65
  }
62
66
  this.shortcutCache.value[shortcutItem.key] = omit(shortcutItem, ["callback"]);
63
67
  this.shortcutCallbackMap.set(shortcutItem.currentKeySignature, shortcutItem.callback);
68
+ const that = this;
64
69
  return createHandler(this.shortcutCache.value[shortcutItem.key]);
65
70
  function createHandler(shortcut) {
66
71
  return {
@@ -70,7 +75,8 @@ class ShortcutManager {
70
75
  start: () => {
71
76
  shortcut.status = ShortcutStatus.ACTIVE;
72
77
  },
73
- signature: () => shortcut.currentKeySignature
78
+ signature: () => shortcut.currentKeySignature,
79
+ remove: () => that.remove(shortcut.key)
74
80
  };
75
81
  }
76
82
  }
@@ -171,7 +177,7 @@ function useShortcuts(scope) {
171
177
  }
172
178
  }
173
179
  function register(shortcut) {
174
- const { stop, signature, start } = unref(manager).register(createShortcutItem(shortcut));
180
+ const { stop, signature, start, remove } = unref(manager).register(createShortcutItem(shortcut));
175
181
  if (getCurrentInstance()) {
176
182
  onBeforeUnmount(stop);
177
183
  onDeactivated(stop);
@@ -179,7 +185,7 @@ function useShortcuts(scope) {
179
185
  } else {
180
186
  onceRegisterWarn();
181
187
  }
182
- return { stop, signature, start };
188
+ return { stop, signature, start, remove };
183
189
  }
184
190
  function traverse() {
185
191
  return unref(manager).traverse;
@@ -30,6 +30,7 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<impor
30
30
  stop: () => void;
31
31
  signature: () => string;
32
32
  start: () => void;
33
+ remove: () => void;
33
34
  };
34
35
  traverse: () => Omit<import("..").ShortcutItem, "callback">[];
35
36
  clear: () => void;
@@ -33,6 +33,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
33
33
  stop: () => void;
34
34
  signature: () => string;
35
35
  start: () => void;
36
+ remove: () => void;
36
37
  };
37
38
  traverse: () => Omit<import("../../../components/shortcut-provider").ShortcutItem, "callback">[];
38
39
  clear: () => void;
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.4.0-beta.20";
2
+ var version = "3.4.0-beta.22";
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.4.0-beta.20",
3
+ "version": "3.4.0-beta.22",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -73,5 +73,5 @@
73
73
  "iOS 7",
74
74
  "last 3 iOS versions"
75
75
  ],
76
- "gitHead": "5fb113aa91c1485451ca4c4e2887694a0f4c1a50"
76
+ "gitHead": "10bb1fa64ad98cbec8b8fdfbdbca6b4ed52dd771"
77
77
  }