cnhis-design-vue 3.4.0-beta.17 → 3.4.0-beta.18

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
+ ```
@@ -867,6 +867,7 @@ class Print {
867
867
  btnprint,
868
868
  messageTimeout = 0
869
869
  }, successCallbackFn, errorCallbackFn) {
870
+ params = this.isObject(params) || !params ? params : JSON.parse(params);
870
871
  const iReportStatus = isIReport(originFormatId);
871
872
  const formatId = this.getIReportFormatId(iReportStatus, originFormatId);
872
873
  if (iReportStatus && (isDomestic || iReportExecuteMode == 2)) {
@@ -553,12 +553,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
553
553
  hide: boolean;
554
554
  }>;
555
555
  draggable: boolean;
556
- isHighlightRow: boolean;
557
- idx: number;
558
- isHighlight: boolean;
559
- isFieldSet: boolean;
560
556
  fieldDescribeMode: "column" | "tooltip";
557
+ isFieldSet: boolean;
561
558
  hideExpressionOption: AnyObject[];
559
+ idx: number;
560
+ isHighlight: boolean;
561
+ isHighlightRow: boolean;
562
562
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
563
563
  EditDialog: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
564
564
  visible: {
@@ -594,12 +594,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
594
594
  hide: boolean;
595
595
  }>;
596
596
  draggable: boolean;
597
- isHighlightRow: boolean;
598
- idx: number;
599
- isHighlight: boolean;
600
- isFieldSet: boolean;
601
597
  fieldDescribeMode: "column" | "tooltip";
598
+ isFieldSet: boolean;
602
599
  hideExpressionOption: AnyObject[];
600
+ idx: number;
601
+ isHighlight: boolean;
602
+ isHighlightRow: boolean;
603
603
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
604
604
  readonly setStyle: typeof setStyle;
605
605
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "save" | "reset")[], "close" | "save" | "reset", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -773,12 +773,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
773
773
  hide: boolean;
774
774
  }>;
775
775
  draggable: boolean;
776
- isHighlightRow: boolean;
777
- idx: number;
778
- isHighlight: boolean;
779
- isFieldSet: boolean;
780
776
  fieldDescribeMode: "column" | "tooltip";
777
+ isFieldSet: boolean;
781
778
  hideExpressionOption: AnyObject[];
779
+ idx: number;
780
+ isHighlight: boolean;
781
+ isHighlightRow: boolean;
782
782
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
783
783
  readonly isArray: {
784
784
  (value?: any): value is any[];
@@ -918,9 +918,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
918
918
  showSeq: boolean;
919
919
  developMode: boolean;
920
920
  footerFlag: boolean;
921
- fieldDescribeMode: "column" | "tooltip";
922
921
  customColumns: FieldSetColumnItem[];
923
922
  showSortPriority: boolean;
924
923
  showHeadFilter: boolean;
924
+ fieldDescribeMode: "column" | "tooltip";
925
925
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
926
926
  export default _default;
@@ -384,11 +384,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
384
384
  hide: boolean;
385
385
  }>;
386
386
  draggable: boolean;
387
- isHighlightRow: boolean;
388
- idx: number;
389
- isHighlight: boolean;
390
- isFieldSet: boolean;
391
387
  fieldDescribeMode: "column" | "tooltip";
388
+ isFieldSet: boolean;
392
389
  hideExpressionOption: AnyObject[];
390
+ idx: number;
391
+ isHighlight: boolean;
392
+ isHighlightRow: boolean;
393
393
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
394
394
  export default _default;
@@ -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\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), {
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), {
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">\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", {
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", {
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: "",
@@ -366,10 +366,12 @@ declare const TableExportField: SFCWithInstall<import("vue").DefineComponent<imp
366
366
  formRef: import("vue").Ref<any, any>;
367
367
  formValue: {
368
368
  projectName: string;
369
+ exportPath: string;
369
370
  };
370
371
  selectProject: import("vue").Ref<any, any>;
371
372
  projectList: import("vue").Ref<any[], any[]>;
372
373
  exportApiConfig: import("../../shared/types").AnyObject;
374
+ isHoEdge: import("vue").ComputedRef<any>;
373
375
  handleRadioChange: (value: string | number | boolean) => void;
374
376
  validateProjectName: () => boolean;
375
377
  getParams: () => {
@@ -377,6 +379,7 @@ declare const TableExportField: SFCWithInstall<import("vue").DefineComponent<imp
377
379
  lastUsedSchemeName: string;
378
380
  schemeId: string;
379
381
  schemeName: string;
382
+ exportPath: string;
380
383
  tableListId: string;
381
384
  };
382
385
  saveToCalss: () => void;
@@ -64,10 +64,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
64
64
  formRef: import("vue").Ref<any, any>;
65
65
  formValue: {
66
66
  projectName: string;
67
+ exportPath: string;
67
68
  };
68
69
  selectProject: import("vue").Ref<any, any>;
69
70
  projectList: import("vue").Ref<any[], any[]>;
70
71
  exportApiConfig: import("../../../../shared/types").AnyObject;
72
+ isHoEdge: import("vue").ComputedRef<any>;
71
73
  handleRadioChange: (value: string | number | boolean) => void;
72
74
  validateProjectName: () => boolean;
73
75
  getParams: () => {
@@ -75,6 +77,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
75
77
  lastUsedSchemeName: string;
76
78
  schemeId: string;
77
79
  schemeName: string;
80
+ exportPath: string;
78
81
  tableListId: string;
79
82
  };
80
83
  saveToCalss: () => void;
@@ -1,11 +1,12 @@
1
1
  import { i18n } from '../../../../_virtual/_virtual_i18n-methods.js';
2
- import { defineComponent, ref, reactive, inject, watch, openBlock, createBlock, unref, withCtx, createVNode, createElementVNode, createTextVNode, createElementBlock, Fragment, renderList, toDisplayString } from 'vue';
2
+ import { defineComponent, ref, reactive, inject, computed, watch, openBlock, createBlock, unref, withCtx, createVNode, createElementVNode, createTextVNode, createElementBlock, Fragment, renderList, toDisplayString, createCommentVNode } from 'vue';
3
3
  import { useMessage, NModal, NCard, NIcon, NButton, NRadioGroup, NRadio, NForm, NFormItem, NInput } from 'naive-ui';
4
4
  import { CloseOutline } from '@vicons/ionicons5';
5
5
  import { InjectionExportApiConfig } from '../constants/index.js';
6
6
  import useAsyncData from '../hooks/useAsyncData.js';
7
7
  import { dragFieldCheckList } from '../tool.js';
8
8
  import { cloneDeep } from 'lodash-es';
9
+ import { hoEdge } from '../../../../shared/utils/ho-edge.js';
9
10
 
10
11
  const _hoisted_1 = {
11
12
  class: "svg-wrap"
@@ -67,11 +68,16 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
67
68
  const emits = __emit;
68
69
  const formRef = ref(null);
69
70
  const formValue = reactive({
70
- projectName: ""
71
+ projectName: "",
72
+ exportPath: ""
71
73
  });
72
74
  const selectProject = ref();
73
75
  const projectList = ref([]);
74
76
  const exportApiConfig = inject(InjectionExportApiConfig);
77
+ const isHoEdge = computed(() => {
78
+ var _a;
79
+ return (_a = hoEdge) == null ? void 0 : _a.webview;
80
+ });
75
81
  function handleRadioChange(value) {
76
82
  selectProject.value = value;
77
83
  }
@@ -96,6 +102,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
96
102
  }
97
103
  function getParams() {
98
104
  const schemeName = formValue.projectName.trim();
105
+ const exportPath = formValue.exportPath.trim();
99
106
  const {
100
107
  fieldKeys,
101
108
  schemeId
@@ -105,6 +112,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
105
112
  lastUsedSchemeName: schemeName,
106
113
  schemeId: "",
107
114
  schemeName,
115
+ exportPath,
108
116
  tableListId: props.tableListId
109
117
  };
110
118
  if (selectProject.value === "updateProject") {
@@ -120,15 +128,29 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
120
128
  if (validateProjectName()) {
121
129
  return;
122
130
  }
131
+ const exportPath = formValue.exportPath.trim();
132
+ const {
133
+ schemeId
134
+ } = props.curProgram;
135
+ const hoEdgeParams = {
136
+ "exec": "saveconf",
137
+ "data": {
138
+ "key": selectProject.value === "updateProject" ? schemeId : `${defaultKey}_schemeId`,
139
+ "value": exportPath
140
+ }
141
+ };
142
+ await hoEdge.postMsg(hoEdgeParams);
123
143
  const params = getParams();
124
144
  let res = await saveTableListExportScheme(params, exportApiConfig);
125
145
  if (res) {
126
146
  message.success(i18n("10010.1.438", "\u4FDD\u5B58\u5E76\u5BFC\u51FA\u6210\u529F"));
127
- emits("cancelSaveModal");
147
+ cancelSaveToCalss();
128
148
  }
129
149
  });
130
150
  }
131
151
  function cancelSaveToCalss() {
152
+ formValue.projectName = "";
153
+ formValue.exportPath = "";
132
154
  emits("cancelSaveModal");
133
155
  }
134
156
  watch(() => props.curProgram, async (program) => {
@@ -144,6 +166,16 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
144
166
  formValue.projectName = program.schemeName;
145
167
  break;
146
168
  }
169
+ const hoEdgeParams = {
170
+ "exec": "getconf",
171
+ "data": {
172
+ "key": selectProject.value === "updateProject" ? program.schemeId : `${defaultKey}_schemeId`
173
+ }
174
+ };
175
+ const getHoEdgeData = await hoEdge.postMsg(hoEdgeParams);
176
+ if (getHoEdgeData == null ? void 0 : getHoEdgeData.result) {
177
+ formValue.exportPath = (getHoEdgeData == null ? void 0 : getHoEdgeData.res) || "";
178
+ }
147
179
  }, {
148
180
  immediate: true,
149
181
  deep: true
@@ -176,13 +208,13 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
176
208
  footer: withCtx(() => [createElementVNode("div", _hoisted_2, [createVNode(unref(NButton), {
177
209
  onClick: cancelSaveToCalss
178
210
  }, {
179
- default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode(i18n("10010.1.28", "\u53D6\u6D88"), -1)])]),
211
+ default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode(i18n("10010.1.28", "\u53D6\u6D88"), -1)])]),
180
212
  _: 1
181
213
  }), createVNode(unref(NButton), {
182
214
  type: "info",
183
215
  onClick: saveToCalss
184
216
  }, {
185
- default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode(i18n("10010.1.428", "\u786E\u8BA4"), -1)])]),
217
+ default: withCtx(() => [..._cache[4] || (_cache[4] = [createTextVNode(i18n("10010.1.428", "\u786E\u8BA4"), -1)])]),
186
218
  _: 1
187
219
  })])]),
188
220
  default: withCtx(() => [createElementVNode("div", _hoisted_3, [createVNode(unref(NRadioGroup), {
@@ -219,7 +251,19 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
219
251
  maxlength: "100"
220
252
  }, null, 8, ["value"])]),
221
253
  _: 1
222
- })]),
254
+ }), isHoEdge.value ? (openBlock(), createBlock(unref(NFormItem), {
255
+ key: 0,
256
+ label: i18n("10010.1.683", "\u5BFC\u51FA\u8DEF\u5F84"),
257
+ path: "exportPath"
258
+ }, {
259
+ default: withCtx(() => [createVNode(unref(NInput), {
260
+ value: formValue.exportPath,
261
+ "onUpdate:value": _cache[2] || (_cache[2] = ($event) => formValue.exportPath = $event),
262
+ placeholder: i18n("10010.1.684", "\u8BF7\u8F93\u5165\u5BFC\u51FA\u8DEF\u5F84"),
263
+ clearable: ""
264
+ }, null, 8, ["value"])]),
265
+ _: 1
266
+ })) : createCommentVNode("v-if", true)]),
223
267
  _: 1
224
268
  }, 8, ["model"])])]),
225
269
  _: 1
@@ -367,10 +367,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
367
367
  formRef: import("vue").Ref<any, any>;
368
368
  formValue: {
369
369
  projectName: string;
370
+ exportPath: string;
370
371
  };
371
372
  selectProject: import("vue").Ref<any, any>;
372
373
  projectList: import("vue").Ref<any[], any[]>;
373
374
  exportApiConfig: import("../../../shared/types").AnyObject;
375
+ isHoEdge: import("vue").ComputedRef<any>;
374
376
  handleRadioChange: (value: string | number | boolean) => void;
375
377
  validateProjectName: () => boolean;
376
378
  getParams: () => {
@@ -378,6 +380,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
378
380
  lastUsedSchemeName: string;
379
381
  schemeId: string;
380
382
  schemeName: string;
383
+ exportPath: string;
381
384
  tableListId: string;
382
385
  };
383
386
  saveToCalss: () => 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.17";
2
+ var version = "3.4.0-beta.18";
3
3
  var main = "index.ts";
4
4
  var peerDependencies = {
5
5
  "naive-ui": "^2.30.0",
@@ -0,0 +1,12 @@
1
+ declare class HoEdge {
2
+ private readonly webview;
3
+ private msgHandleQueue;
4
+ constructor();
5
+ /** 发送消息 */
6
+ postMsg(data: any): Promise<unknown> | undefined;
7
+ /** 接收消息 */
8
+ msgHandle(evt: any): any;
9
+ destory(): void;
10
+ }
11
+ export declare const hoEdge: HoEdge;
12
+ export {};
@@ -0,0 +1,58 @@
1
+ let HoEdgeInstance = null;
2
+ class HoEdge {
3
+ constructor() {
4
+ this.webview = null;
5
+ this.msgHandleQueue = [];
6
+ var _a, _b, _c, _d;
7
+ if (HoEdgeInstance)
8
+ return HoEdgeInstance;
9
+ HoEdgeInstance = this;
10
+ const _window = window;
11
+ try {
12
+ this.webview = _window.top ? (_a = _window.top.chrome) == null ? void 0 : _a.webview : (_b = _window.chrome) == null ? void 0 : _b.webview;
13
+ } catch (error) {
14
+ this.webview = (_c = _window.chrome) == null ? void 0 : _c.webview;
15
+ }
16
+ if (!this.webview)
17
+ return;
18
+ this.msgHandleQueue = [];
19
+ (_d = this.webview) == null ? void 0 : _d.addEventListener("message", this.msgHandle.bind(this));
20
+ }
21
+ postMsg(data) {
22
+ if (!this.webview)
23
+ return;
24
+ return new Promise((resolve) => {
25
+ var _a;
26
+ const exec = data.exec;
27
+ this.msgHandleQueue.push({ resolve, exec });
28
+ (_a = this.webview) == null ? void 0 : _a.postMessage(data);
29
+ });
30
+ }
31
+ msgHandle(evt) {
32
+ let data = (evt == null ? void 0 : evt.data) || "{}";
33
+ if (typeof data === "string") {
34
+ data = JSON.parse(data);
35
+ }
36
+ const handler = this.msgHandleQueue.pop();
37
+ if (!handler) {
38
+ console.log("\u627E\u4E0D\u5230\u5339\u914D\u7684\u529F\u80FD\u51FD\u6570");
39
+ return;
40
+ }
41
+ const { resolve, exec } = handler;
42
+ if (exec !== data.exec) {
43
+ console.log(`\u5C01\u88C5\u6D4F\u89C8\u5668\u547D\u4EE4\u4E0D\u5339\u914D\uFF0C\u5F53\u524D\uFF1A${exec}\uFF0C\u8FD4\u56DE\u7684\u547D\u4EE4\uFF1A${data.exec}`);
44
+ return;
45
+ }
46
+ return resolve(data);
47
+ }
48
+ destory() {
49
+ var _a;
50
+ if (!this.webview)
51
+ return;
52
+ this.msgHandleQueue = [];
53
+ (_a = this.webview) == null ? void 0 : _a.removeEventListener("message", this.msgHandle);
54
+ }
55
+ }
56
+ const hoEdge = new HoEdge();
57
+
58
+ export { hoEdge };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.4.0-beta.17",
3
+ "version": "3.4.0-beta.18",
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": "bab1f9570df3d13c451db3b446895a87ad1d0a65"
76
+ "gitHead": "dc101d93829c29940d8b82bf0d5c821a3048c6f0"
77
77
  }