cnhis-design-vue 3.3.3-beta.61 → 3.3.3-beta.63

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
+ ```
@@ -535,18 +535,28 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
535
535
  };
536
536
  const callLocalServicesErrorCb = (res) => {
537
537
  toggleExpandLoading(false);
538
+ let info = {
539
+ formatId: state.currentFormatId,
540
+ templateId: getTemplateIdByFormatId.value,
541
+ templateCode: getTemplateCodeByFormatId.value
542
+ };
538
543
  encapBrowserLog({
539
544
  type: "\u8FDB\u5165\u5931\u8D25\u7684\u56DE\u8C03",
540
545
  res
541
546
  }, "PRINT-SDK");
542
- emit("error", res);
547
+ emit("error", res, info);
543
548
  if (isObject(res) && res.type === "notInstalledApp") {
544
549
  $message.error(res.message);
545
550
  }
546
551
  };
547
552
  const callLocalServicesCancelCb = (res) => {
548
553
  toggleExpandLoading(false);
549
- emit("cancel", res);
554
+ let info = {
555
+ formatId: state.currentFormatId,
556
+ templateId: getTemplateIdByFormatId.value,
557
+ templateCode: getTemplateCodeByFormatId.value
558
+ };
559
+ emit("cancel", res, info);
550
560
  };
551
561
  const prevFnError = (type) => {
552
562
  const error = {
@@ -561,7 +571,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
561
571
  type,
562
572
  preExecution: true
563
573
  };
564
- emit("error", error);
574
+ let info = {
575
+ formatId: state.currentFormatId,
576
+ templateId: getTemplateIdByFormatId.value,
577
+ templateCode: getTemplateCodeByFormatId.value
578
+ };
579
+ emit("error", error, info);
565
580
  };
566
581
  const getPrintParams = () => {
567
582
  return JSON.stringify({
@@ -274,14 +274,22 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
274
274
  };
275
275
  const callLocalServicesErrorCb = (res) => {
276
276
  state.spinning = false;
277
- emit("error", res);
277
+ let info = {
278
+ formatId: state.currentFormatId,
279
+ templateId: getTemplateIdByFormatId.value
280
+ };
281
+ emit("error", res, info);
278
282
  if (isObject(res) && res.type === "notInstalledApp") {
279
283
  $message.error(res.message);
280
284
  }
281
285
  };
282
286
  const callLocalServicesCancelCb = (res) => {
283
287
  state.spinning = false;
284
- emit("cancel", res);
288
+ let info = {
289
+ formatId: state.currentFormatId,
290
+ templateId: getTemplateIdByFormatId.value
291
+ };
292
+ emit("cancel", res, info);
285
293
  };
286
294
  const prevFnError = (type) => {
287
295
  const error = {
@@ -296,7 +304,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
296
304
  type,
297
305
  preExecution: true
298
306
  };
299
- emit("error", error);
307
+ let info = {
308
+ formatId: state.currentFormatId,
309
+ templateId: getTemplateIdByFormatId.value
310
+ };
311
+ emit("error", error, info);
300
312
  };
301
313
  const getPrintParams = (index = 0) => {
302
314
  var _a2;
@@ -3,7 +3,8 @@ import { cloneDeep, isArray } from 'lodash-es';
3
3
  import { IdentityVerificationDialog, PreviewDialog } from './dialog.js';
4
4
  import { isIReport, getFileUrl, useBrowserPrint } from './browserPrint.js';
5
5
  import { h, getCurrentInstance } from 'vue';
6
- import { createDiscreteApi, NProgress, NDivider } from 'naive-ui';
6
+ import { createDiscreteApi, NIcon, NProgress, NDivider } from 'naive-ui';
7
+ import { PrintOutline } from '@vicons/ionicons5';
7
8
  import { uuidGenerator } from '../../../../shared/utils/index.js';
8
9
  import { format } from 'date-fns';
9
10
  import { io } from 'socket.io-client';
@@ -262,7 +263,13 @@ class Print {
262
263
  overflow: "hidden",
263
264
  marginBottom: "4px"
264
265
  }
265
- }, [h("span", {
266
+ }, [h(NIcon, {
267
+ size: 16,
268
+ component: PrintOutline,
269
+ style: {
270
+ marginRight: "4px"
271
+ }
272
+ }), h("span", {
266
273
  style: {
267
274
  flex: 1,
268
275
  fontSize: "14px",
@@ -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;
@@ -539,9 +539,9 @@ declare const _default: import("vue").DefineComponent<{
539
539
  }>;
540
540
  developMode: boolean;
541
541
  draggable: boolean;
542
+ isHighlightRow: boolean;
542
543
  idx: number;
543
544
  isHighlight: boolean;
544
- isHighlightRow: boolean;
545
545
  isFieldSet: boolean;
546
546
  fieldDescribeMode: "column" | "tooltip";
547
547
  hideExpressionOption: AnyObject[];
@@ -568,9 +568,9 @@ declare const _default: import("vue").DefineComponent<{
568
568
  }>;
569
569
  developMode: boolean;
570
570
  draggable: boolean;
571
+ isHighlightRow: boolean;
571
572
  idx: number;
572
573
  isHighlight: boolean;
573
- isHighlightRow: boolean;
574
574
  isFieldSet: boolean;
575
575
  fieldDescribeMode: "column" | "tooltip";
576
576
  hideExpressionOption: AnyObject[];
@@ -759,9 +759,9 @@ declare const _default: import("vue").DefineComponent<{
759
759
  }>;
760
760
  developMode: boolean;
761
761
  draggable: boolean;
762
+ isHighlightRow: boolean;
762
763
  idx: number;
763
764
  isHighlight: boolean;
764
- isHighlightRow: boolean;
765
765
  isFieldSet: boolean;
766
766
  fieldDescribeMode: "column" | "tooltip";
767
767
  hideExpressionOption: AnyObject[];
@@ -384,9 +384,9 @@ declare const _default: import("vue").DefineComponent<{
384
384
  }>;
385
385
  developMode: boolean;
386
386
  draggable: boolean;
387
+ isHighlightRow: boolean;
387
388
  idx: number;
388
389
  isHighlight: boolean;
389
- isHighlightRow: boolean;
390
390
  isFieldSet: boolean;
391
391
  fieldDescribeMode: "column" | "tooltip";
392
392
  hideExpressionOption: AnyObject[];
@@ -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: "",
@@ -201,6 +201,7 @@ declare const Keyboard: SFCWithInstall<import("vue").DefineComponent<{
201
201
  calculateFraction: () => void;
202
202
  setInputStatus: (valueRef: import("vue").Ref<string>, statusRef: import("vue").Ref<string>, isInteger?: boolean | undefined) => true | undefined;
203
203
  setInputValueStatus: () => void;
204
+ safeEval: (expression: string) => number;
204
205
  setPosition: (position: import("@vueuse/core").Position) => void;
205
206
  getPosition: () => import("@vueuse/core").Position;
206
207
  NIcon: any;
@@ -203,6 +203,7 @@ declare const _default: import("vue").DefineComponent<{
203
203
  calculateFraction: () => void;
204
204
  setInputStatus: (valueRef: import("vue").Ref<string>, statusRef: import("vue").Ref<string>, isInteger?: boolean | undefined) => true | undefined;
205
205
  setInputValueStatus: () => void;
206
+ safeEval: (expression: string) => number;
206
207
  setPosition: (position: Position) => void;
207
208
  getPosition: () => Position;
208
209
  NIcon: any;
@@ -93,6 +93,7 @@ declare const _default: import("vue").DefineComponent<{
93
93
  calculateFraction: () => void;
94
94
  setInputStatus: (valueRef: Ref<string>, statusRef: Ref<string>, isInteger?: boolean) => true | undefined;
95
95
  setInputValueStatus: () => void;
96
+ safeEval: (expression: string) => number;
96
97
  setPosition: (position: Position) => void;
97
98
  getPosition: () => Position;
98
99
  NIcon: any;
@@ -112,7 +112,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
112
112
  inputValueStatus.value = "error";
113
113
  return;
114
114
  }
115
- emit("change", eval(inputValue.value));
115
+ const result = safeEval(inputValue.value);
116
+ emit("change", result);
116
117
  setFocus();
117
118
  break;
118
119
  }
@@ -132,7 +133,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
132
133
  return;
133
134
  keydown("Enter");
134
135
  }
135
- async function updateValue(key2) {
136
+ async function updateValue(key) {
136
137
  var _a, _b, _c;
137
138
  const inputRefS = (_c = (_b = (_a = inputRef.value) == null ? void 0 : _a.$childrenRefs) == null ? void 0 : _b.$refs) == null ? void 0 : _c.inputElRef;
138
139
  const {
@@ -140,18 +141,18 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
140
141
  selectionEnd
141
142
  } = inputRefS;
142
143
  const arr = inputValue.value.split("");
143
- if (key2 === "Undo") {
144
+ if (key === "Undo") {
144
145
  const num = selectionStart === selectionEnd ? 1 : selectionEnd - selectionStart;
145
146
  const startIdx = selectionStart === selectionEnd ? selectionStart - 1 : selectionStart;
146
147
  if (inputValue.value && startIdx > -1)
147
148
  arr.splice(startIdx, num);
148
149
  } else {
149
- arr.splice(selectionStart, selectionEnd - selectionStart, key2);
150
+ arr.splice(selectionStart, selectionEnd - selectionStart, key);
150
151
  }
151
152
  inputValue.value = arr.join("");
152
153
  await nextTick();
153
154
  inputRefS.focus();
154
- const selectionIdx = key2 === "Undo" ? !selectionStart ? 0 : selectionEnd > selectionStart ? selectionStart : selectionStart - 1 : selectionStart + 1;
155
+ const selectionIdx = key === "Undo" ? !selectionStart ? 0 : selectionEnd > selectionStart ? selectionStart : selectionStart - 1 : selectionStart + 1;
155
156
  inputRefS.setSelectionRange(selectionIdx, selectionIdx);
156
157
  setInputValueStatus();
157
158
  }
@@ -209,6 +210,18 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
209
210
  function setInputValueStatus() {
210
211
  inputValueStatus.value = !inputValue.value ? "error" : "success";
211
212
  }
213
+ function safeEval(expression) {
214
+ const cleanExpression = expression.replace(/\b0+(\d)/g, "$1").replace(/\b0+\./g, "0.");
215
+ if (/^\d*\.?\d*$/.test(cleanExpression)) {
216
+ return parseFloat(cleanExpression) || 0;
217
+ }
218
+ try {
219
+ return new Function("return " + cleanExpression)();
220
+ } catch (error) {
221
+ console.error("Expression evaluation error:", error);
222
+ return 0;
223
+ }
224
+ }
212
225
  function setPosition(position) {
213
226
  if (draggableInstance) {
214
227
  draggableInstance.x.value = position.x;
@@ -258,12 +271,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
258
271
  class: "margin-offset",
259
272
  "wrap-item": false
260
273
  }, {
261
- default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(numberKeys), (key2) => {
274
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(numberKeys), (key) => {
262
275
  return openBlock(), createElementBlock("span", {
263
- key: key2,
264
- class: normalizeClass(key2 === "0" ? "is-0" : ""),
265
- onClick: ($event) => keydown(key2)
266
- }, toDisplayString(key2), 11, _hoisted_2);
276
+ key,
277
+ class: normalizeClass(key === "0" ? "is-0" : ""),
278
+ onClick: ($event) => keydown(key)
279
+ }, toDisplayString(key), 11, _hoisted_2);
267
280
  }), 128))]),
268
281
  _: 1
269
282
  }), createVNode(unref(NSpace), {
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.61";
2
+ var version = "3.3.3-beta.63";
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.61",
3
+ "version": "3.3.3-beta.63",
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": "ca79a2e2af6d422573c63bc2237ea3f64fd59a6e"
77
+ "gitHead": "15df50851026873ba4c19746fc7f7c588ad7cf8f"
78
78
  }