cnhis-design-vue 3.4.0-beta.49 → 3.4.0-beta.52
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 +87 -87
- package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogram.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogram.js +35 -25
- package/es/components/form-render/src/hooks/useFormEvent.js +1 -1
- package/es/components/form-render/src/utils/index.d.ts +1 -1
- package/es/components/form-render/src/utils/index.js +5 -2
- package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
- package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
- package/es/env.d.ts +25 -25
- package/es/shared/package.json.js +1 -1
- package/package.json +2 -2
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
|
+
```
|
|
@@ -2,5 +2,5 @@ import { AnyObject } from '../../../../../shared/types';
|
|
|
2
2
|
import { fabric } from '../../../../../shared/utils/fabricjs';
|
|
3
3
|
import { type Ref } from 'vue';
|
|
4
4
|
export declare function useElectrocardiogram(canvas: Ref<fabric.Canvas>, propItems: AnyObject, flag: Ref<boolean>): {
|
|
5
|
-
updatePolyline: (
|
|
5
|
+
updatePolyline: (percent: number) => void;
|
|
6
6
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fabric } from '../../../../../shared/utils/fabricjs/index.js';
|
|
2
|
-
import { useThrottleFn } from '@vueuse/core';
|
|
2
|
+
import { useDebounceFn, useThrottleFn } from '@vueuse/core';
|
|
3
3
|
import { range } from 'lodash-es';
|
|
4
4
|
import { useDetailEvent } from './hooks/useDetailEvent.js';
|
|
5
5
|
import { defaultStyle, drawLine } from '../useDraw.js';
|
|
@@ -59,24 +59,29 @@ function useElectrocardiogram(canvas, propItems, flag) {
|
|
|
59
59
|
drawPolyLine();
|
|
60
60
|
}
|
|
61
61
|
function getShowLength(list = []) {
|
|
62
|
-
const
|
|
62
|
+
const overflowIsScroll = config.overflow === "scroll";
|
|
63
|
+
const showLength = ~~(list.length / columnNumber / (overflowIsScroll ? 2 : 1));
|
|
63
64
|
return showLength * (config.mainXCellValue / ECG.DEFAULTMAINXCELLVALUE);
|
|
64
65
|
}
|
|
65
66
|
function drawPolyLine(startIdx = 0) {
|
|
67
|
+
const overflowIsScroll = config.overflow === "scroll";
|
|
66
68
|
dataList.forEach((lineItem, idx) => {
|
|
67
|
-
if (idx ===
|
|
69
|
+
if (idx === ECG.MAXLINENUMBER - 1 && arguments.length && !overflowIsScroll)
|
|
68
70
|
return;
|
|
69
71
|
const { x, y, rowIdx, limitX } = lineItem.origin;
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
const lineLength = lineItem.data.length;
|
|
73
|
+
const showLength = idx < ECG.MAXLINENUMBER - 1 ? getShowLength(lineItem.data) : lineLength;
|
|
74
|
+
const points = [];
|
|
75
|
+
let pointIndex = 0;
|
|
76
|
+
for (let _idx = startIdx; _idx <= startIdx + showLength && _idx < lineLength; _idx++) {
|
|
77
|
+
const value = lineItem.data[_idx];
|
|
78
|
+
const point = { x: computedX(pointIndex + 1), y: computedY(-+value) + y };
|
|
79
|
+
if (idx < ECG.MAXLINENUMBER - 1 && point.x > limitX) {
|
|
80
|
+
break;
|
|
77
81
|
}
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
points.push(point);
|
|
83
|
+
pointIndex++;
|
|
84
|
+
}
|
|
80
85
|
const polyline = new fabric.Polyline(points, {
|
|
81
86
|
...lineStyle,
|
|
82
87
|
fill: "transparent",
|
|
@@ -102,8 +107,7 @@ function useElectrocardiogram(canvas, propItems, flag) {
|
|
|
102
107
|
detailRadius: 370,
|
|
103
108
|
beforeEvent: () => flag.value && Promise.reject()
|
|
104
109
|
});
|
|
105
|
-
|
|
106
|
-
if (idx < dataList.length - 1) {
|
|
110
|
+
if (idx < ECG.MAXLINENUMBER - 1 || overflowIsScroll) {
|
|
107
111
|
gridPoints.add(polyline);
|
|
108
112
|
} else {
|
|
109
113
|
fixedPointsCache.add(polyline);
|
|
@@ -184,24 +188,30 @@ function useElectrocardiogram(canvas, propItems, flag) {
|
|
|
184
188
|
});
|
|
185
189
|
canvas.value.add(...lines);
|
|
186
190
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
191
|
+
let currentStartIdx = -1;
|
|
192
|
+
let isUpdating = false;
|
|
193
|
+
const debouncedUpdate = useDebounceFn((startIdx) => {
|
|
194
|
+
if (isUpdating || currentStartIdx === startIdx)
|
|
190
195
|
return;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
const _startIdx = centerIdx - showLength / 2;
|
|
194
|
-
const startIdx = _startIdx + showLength > totalLength ? totalLength - showLength : Math.max(0, _startIdx);
|
|
196
|
+
isUpdating = true;
|
|
197
|
+
currentStartIdx = startIdx;
|
|
195
198
|
fabric.util.requestAnimFrame(() => {
|
|
196
199
|
if (gridPoints.size) {
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
return;
|
|
200
|
-
[...gridPoints].forEach((point) => canvas.value.remove(point));
|
|
200
|
+
const pointsArray = [...gridPoints];
|
|
201
|
+
canvas.value.remove(...pointsArray);
|
|
201
202
|
gridPoints.clear();
|
|
202
203
|
}
|
|
203
204
|
drawPolyLine(startIdx);
|
|
205
|
+
isUpdating = false;
|
|
204
206
|
});
|
|
207
|
+
}, 100);
|
|
208
|
+
const updatePolyline = useThrottleFn((percent) => {
|
|
209
|
+
const showLength = getShowLength(dataList[dataList.length - 1].data);
|
|
210
|
+
if (showLength === dataList[0].data.length)
|
|
211
|
+
return;
|
|
212
|
+
const totalLength = dataList[dataList.length - 1].data.length;
|
|
213
|
+
const startIdx = ~~(percent * totalLength);
|
|
214
|
+
debouncedUpdate(startIdx);
|
|
205
215
|
}, 150);
|
|
206
216
|
function drawBorder() {
|
|
207
217
|
const { strokeWidth } = borderStyle;
|
|
@@ -133,7 +133,7 @@ function useFormExposeEvent({
|
|
|
133
133
|
wordbookSettingHandler2.triggerDisabled = options.avoidWordbookSettingConnection;
|
|
134
134
|
operationalFormHandler.triggerDisabled = options.avoidOperationalFormConnection;
|
|
135
135
|
if (options.needSplitExtendKey) {
|
|
136
|
-
values = splitExtendKey(getFieldList(), values);
|
|
136
|
+
values = splitExtendKey(getFieldList(), values, !!options.overwrite);
|
|
137
137
|
}
|
|
138
138
|
if (options.avoidFormChangeEvent) {
|
|
139
139
|
emitFormChange.value = false;
|
|
@@ -18,7 +18,7 @@ export declare function createSlot(renderer: unknown, props: AnyObject, defaultR
|
|
|
18
18
|
export declare function createInputSlot(props: AnyObject, defaultRenderer?: (v: unknown) => unknown[]): import("vue").ComputedRef<Record<string, FunctionalComponent<{}, {}, any, {}>>>;
|
|
19
19
|
export declare function validateMessageParser(message: string, fieldItem: Omit<FieldItem, 'reactions'>): string;
|
|
20
20
|
export declare function combineExtendKey(fieldList: FieldItem[], values: AnyObject): AnyObject;
|
|
21
|
-
export declare function splitExtendKey(fieldList: FieldItem[], values: AnyObject): AnyObject;
|
|
21
|
+
export declare function splitExtendKey(fieldList: FieldItem[], values: AnyObject, overwrite: boolean): AnyObject;
|
|
22
22
|
export declare function isNestedType(type?: string): boolean | "" | undefined;
|
|
23
23
|
export declare function isNestedFieldType(field: FieldItem | GeneralField): boolean | "" | undefined;
|
|
24
24
|
export declare function renderOptionLabel(option: AnyObject, labelKey: string): any;
|
|
@@ -136,7 +136,7 @@ function combineExtendKey(fieldList, values) {
|
|
|
136
136
|
});
|
|
137
137
|
return result;
|
|
138
138
|
}
|
|
139
|
-
function splitExtendKey(fieldList, values) {
|
|
139
|
+
function splitExtendKey(fieldList, values, overwrite) {
|
|
140
140
|
const fieldListWithExtendKey = findExtendKeyField(fieldList);
|
|
141
141
|
if (!fieldListWithExtendKey.length)
|
|
142
142
|
return values;
|
|
@@ -156,7 +156,10 @@ function splitExtendKey(fieldList, values) {
|
|
|
156
156
|
}) => {
|
|
157
157
|
if (Reflect.has(result, val_key))
|
|
158
158
|
return;
|
|
159
|
-
|
|
159
|
+
const value = queryFieldValue(extendKey)[val_key];
|
|
160
|
+
if (value == null && !overwrite)
|
|
161
|
+
return;
|
|
162
|
+
result[val_key] = value;
|
|
160
163
|
});
|
|
161
164
|
return result;
|
|
162
165
|
}
|
|
@@ -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: "",
|
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
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
|
-
"version": "3.4.0-beta.
|
|
3
|
+
"version": "3.4.0-beta.52",
|
|
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": "
|
|
76
|
+
"gitHead": "577e344e6eb94688fb0152288073d483d17e9a0f"
|
|
77
77
|
}
|