cnhis-design-vue 3.4.0-beta.33 → 3.4.0-beta.35

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
+ ```
@@ -1081,6 +1081,10 @@ export declare const CallbackMaps: Map<string, {
1081
1081
  type: BooleanConstructor;
1082
1082
  default: boolean;
1083
1083
  };
1084
+ experimental: {
1085
+ type: BooleanConstructor;
1086
+ default: boolean;
1087
+ };
1084
1088
  nConfigProviderProps: {
1085
1089
  type: import("vue").PropType<import("../../../../../shared/types").AnyObject>;
1086
1090
  };
@@ -1116,6 +1120,10 @@ export declare const CallbackMaps: Map<string, {
1116
1120
  type: BooleanConstructor;
1117
1121
  default: boolean;
1118
1122
  };
1123
+ experimental: {
1124
+ type: BooleanConstructor;
1125
+ default: boolean;
1126
+ };
1119
1127
  nConfigProviderProps: {
1120
1128
  type: import("vue").PropType<import("../../../../../shared/types").AnyObject>;
1121
1129
  };
@@ -9396,6 +9404,10 @@ export declare const CallbackMaps: Map<string, {
9396
9404
  type: BooleanConstructor;
9397
9405
  default: boolean;
9398
9406
  };
9407
+ experimental: {
9408
+ type: BooleanConstructor;
9409
+ default: boolean;
9410
+ };
9399
9411
  nConfigProviderProps: {
9400
9412
  type: import("vue").PropType<import("../../../../../shared/types").AnyObject>;
9401
9413
  };
@@ -9451,6 +9463,7 @@ export declare const CallbackMaps: Map<string, {
9451
9463
  tableConfig: import("../../../../../components/iho-table").IhoTableConfig;
9452
9464
  tableData: import("../../../../../shared/types").AnyObject[];
9453
9465
  developMode: boolean;
9466
+ experimental: boolean;
9454
9467
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
9455
9468
  props: {
9456
9469
  consumer?: undefined;
@@ -546,6 +546,13 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
546
546
  immediate: true,
547
547
  deep: true
548
548
  });
549
+ watch(() => props.conditionSid, (val) => {
550
+ if ((val == null ? void 0 : val.length) > 0) {
551
+ initTree(val);
552
+ }
553
+ }, {
554
+ deep: true
555
+ });
549
556
  return (_ctx, _cache) => {
550
557
  var _a, _b;
551
558
  return openBlock(), createElementBlock("div", {
@@ -249,6 +249,16 @@ function useCenter(canvas, propItems, emits, computedX, computedY, getXValue, ge
249
249
  const [points1, points2] = pulsePoints;
250
250
  let _arr1 = [];
251
251
  let _arr2 = [];
252
+ const setData = () => {
253
+ const dataItem = [..._arr1, ..._arr2.reverse()];
254
+ const [firstPoint] = dataItem;
255
+ const lastPoint = last(dataItem);
256
+ if (firstPoint[0] === lastPoint[0] && firstPoint[1] === lastPoint[1])
257
+ dataItem.splice(-1, 1);
258
+ data.push(dataItem);
259
+ _arr1 = [];
260
+ _arr2 = [];
261
+ };
252
262
  sames.forEach(({
253
263
  time,
254
264
  left: left2
@@ -271,16 +281,6 @@ function useCenter(canvas, propItems, emits, computedX, computedY, getXValue, ge
271
281
  } else if (prevPoint2) {
272
282
  _arr2.push(getXY(prevPoint2));
273
283
  }
274
- const setData = () => {
275
- const dataItem = [..._arr1, ..._arr2.reverse()];
276
- const [firstPoint] = dataItem;
277
- const lastPoint = last(dataItem);
278
- if (firstPoint[0] === lastPoint[0] && firstPoint[1] === lastPoint[1])
279
- dataItem.splice(-1, 1);
280
- data.push(dataItem);
281
- _arr1 = [];
282
- _arr2 = [];
283
- };
284
284
  const minYPoint = Math.min(currentPoint1.top, currentPoint2.top);
285
285
  const maxYPoint = Math.max(currentPoint1.top, currentPoint2.top);
286
286
  _arr1.push(getXY([currentPoint1, currentPoint2].find((point) => point.top === minYPoint)));
@@ -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: "",
@@ -37,6 +37,10 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<import("vue
37
37
  type: BooleanConstructor;
38
38
  default: boolean;
39
39
  };
40
+ experimental: {
41
+ type: BooleanConstructor;
42
+ default: boolean;
43
+ };
40
44
  nConfigProviderProps: {
41
45
  type: import("vue").PropType<import("../../shared/types").AnyObject>;
42
46
  };
@@ -72,6 +76,10 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<import("vue
72
76
  type: BooleanConstructor;
73
77
  default: boolean;
74
78
  };
79
+ experimental: {
80
+ type: BooleanConstructor;
81
+ default: boolean;
82
+ };
75
83
  nConfigProviderProps: {
76
84
  type: import("vue").PropType<import("../../shared/types").AnyObject>;
77
85
  };
@@ -8352,6 +8360,10 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<import("vue
8352
8360
  type: BooleanConstructor;
8353
8361
  default: boolean;
8354
8362
  };
8363
+ experimental: {
8364
+ type: BooleanConstructor;
8365
+ default: boolean;
8366
+ };
8355
8367
  nConfigProviderProps: {
8356
8368
  type: import("vue").PropType<import("../../shared/types").AnyObject>;
8357
8369
  };
@@ -8407,5 +8419,6 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<import("vue
8407
8419
  tableConfig: import("../../components/iho-table/src/types").IhoTableConfig;
8408
8420
  tableData: import("../../shared/types").AnyObject[];
8409
8421
  developMode: boolean;
8422
+ experimental: boolean;
8410
8423
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
8411
8424
  export default IhoTable;
@@ -35,6 +35,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
35
35
  type: BooleanConstructor;
36
36
  default: boolean;
37
37
  };
38
+ experimental: {
39
+ type: BooleanConstructor;
40
+ default: boolean;
41
+ };
38
42
  nConfigProviderProps: {
39
43
  type: PropType<AnyObject>;
40
44
  };
@@ -70,6 +74,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
70
74
  type: BooleanConstructor;
71
75
  default: boolean;
72
76
  };
77
+ experimental: {
78
+ type: BooleanConstructor;
79
+ default: boolean;
80
+ };
73
81
  nConfigProviderProps: {
74
82
  type: PropType<AnyObject>;
75
83
  };
@@ -8350,6 +8358,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
8350
8358
  type: BooleanConstructor;
8351
8359
  default: boolean;
8352
8360
  };
8361
+ experimental: {
8362
+ type: BooleanConstructor;
8363
+ default: boolean;
8364
+ };
8353
8365
  nConfigProviderProps: {
8354
8366
  type: PropType<AnyObject>;
8355
8367
  };
@@ -8405,5 +8417,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
8405
8417
  tableConfig: IhoTableConfig;
8406
8418
  tableData: AnyObject[];
8407
8419
  developMode: boolean;
8420
+ experimental: boolean;
8408
8421
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8409
8422
  export default _default;
@@ -28,6 +28,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
28
28
  uniqueCacheData: { type: Boolean, default: false },
29
29
  parallelism: { type: Number, default: 3 },
30
30
  developMode: { type: Boolean, default: false },
31
+ experimental: { type: Boolean, default: false },
31
32
  nConfigProviderProps: { type: Object }
32
33
  },
33
34
  emits: [
@@ -237,8 +238,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
237
238
  var _a2;
238
239
  return (_a2 = props.tableData) == null ? void 0 : _a2.length;
239
240
  }], () => {
240
- dataChanged = true;
241
- updateState();
241
+ if (props.experimental) {
242
+ updateTableDataRef();
243
+ } else {
244
+ dataChanged = true;
245
+ updateState();
246
+ }
242
247
  });
243
248
  updateConfigRef();
244
249
  updateFieldListRef();
@@ -13,16 +13,17 @@ const useEvent = (props, state) => {
13
13
  };
14
14
  const handleLogicList = (formItem, formArray) => {
15
15
  const { seq } = formItem;
16
- let list = formArray.map((item2) => {
16
+ const list = formArray.map((item2) => {
17
17
  if (item2.seq > seq && item2.isShow && item2.__isLogic__)
18
18
  return item2;
19
19
  return false;
20
20
  });
21
21
  let nextItemMax = 0;
22
- let i = 0, len = list.length, item;
22
+ const len = list.length;
23
+ let i = 0, item;
23
24
  for (; i < len; i++) {
24
25
  item = list[i];
25
- let curVal = state.form[formKey(item)];
26
+ const curVal = state.form[formKey(item)];
26
27
  if (!curVal)
27
28
  continue;
28
29
  if (Array.isArray(curVal)) {
@@ -83,7 +84,7 @@ const useEvent = (props, state) => {
83
84
  });
84
85
  }
85
86
  } else if (nextLogic.next_logic == "uncondition") {
86
- let res = vexutilsExpand.isEmpty(choiceValue);
87
+ const res = vexutilsExpand.isEmpty(choiceValue);
87
88
  formItem.__isLogic__ = !res;
88
89
  formItem.__lastSeq__ = seq + 1;
89
90
  formArray.forEach((item) => {
@@ -99,27 +100,60 @@ const useEvent = (props, state) => {
99
100
  });
100
101
  }
101
102
  };
103
+ const processFieldValue = (value, isNumberType) => {
104
+ const defaultValue = isNumberType ? null : "/";
105
+ if (value == null || value === "") {
106
+ return defaultValue;
107
+ }
108
+ if (isNumberType) {
109
+ if (typeof value !== "number" && isNaN(+value)) {
110
+ return null;
111
+ }
112
+ return +value;
113
+ }
114
+ return value;
115
+ };
116
+ const createFormElementMap = (formArray) => {
117
+ const elementMap = /* @__PURE__ */ new Map();
118
+ formArray.forEach((element) => {
119
+ if (element.seq != null) {
120
+ elementMap.set(element.seq, element);
121
+ }
122
+ });
123
+ return elementMap;
124
+ };
125
+ const processRelationFieldList = (dataList, relationField, isNumberType) => {
126
+ return dataList.map((dataItem) => processFieldValue(dataItem[relationField], isNumberType)).filter(Boolean) || [];
127
+ };
102
128
  const handleDynamicDataRelation = (list, formItem, formArray) => {
103
- let { targetSource } = formItem;
104
- if (!targetSource || !Object.keys(targetSource).length)
105
- return;
106
- if (!targetSource.target_id)
107
- return;
108
- let { relationParam = [] } = targetSource;
109
- if (!relationParam.length)
129
+ var _a;
130
+ const { targetSource } = formItem;
131
+ if (!targetSource || !Object.keys(targetSource).length || !targetSource.target_id || !((_a = targetSource.relationParam) == null ? void 0 : _a.length)) {
110
132
  return;
111
- relationParam.forEach((item) => {
112
- let matchEle = formArray.find((v) => v.seq === item.relationElement);
113
- const key = matchEle.val_key;
114
- if (matchEle) {
115
- if (!list.length) {
116
- state.form[key] = "";
117
- } else {
118
- let relationFieldList = list.map((v) => v[item.relationField] || "/") || "";
119
- state.form[key] = relationFieldList.join(",");
120
- }
133
+ }
134
+ const { relationParam } = targetSource;
135
+ const formElementMap = createFormElementMap(formArray);
136
+ const len = relationParam.length;
137
+ let i = 0, item;
138
+ for (; i < len; i++) {
139
+ item = relationParam[i];
140
+ const { relationElement, relationField } = item;
141
+ if (relationElement == null || !relationField)
142
+ continue;
143
+ const targetElement = formElementMap.get(item.relationElement);
144
+ if (!targetElement)
145
+ continue;
146
+ const { val_key: formKey2, valueType } = targetElement;
147
+ const isNumberType = valueType === "number";
148
+ if (!formKey2)
149
+ continue;
150
+ if (!list.length) {
151
+ state.form[formKey2] = null;
152
+ continue;
121
153
  }
122
- });
154
+ const relationFieldList = processRelationFieldList(list, item.relationField, isNumberType);
155
+ state.form[formKey2] = relationFieldList.length > 0 ? relationFieldList.join(",") : null;
156
+ }
123
157
  };
124
158
  return {
125
159
  nextLogicEvent,
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.33";
2
+ var version = "3.4.0-beta.35";
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.33",
3
+ "version": "3.4.0-beta.35",
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": "8354c1494663058951b0f3ec155d0d7032eaa938"
76
+ "gitHead": "e6ca5e2db806ec0bbe3fe5e5bed79c3465fb7fe0"
77
77
  }