cnhis-design-vue 3.1.40-beta.3 → 3.1.40-beta.5

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.
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, computed, onMounted, ref, watch, onUnmounted, openBlock, createBlock, unref, withCtx, createElementBlock, createVNode, isRef, Fragment, renderList, createCommentVNode, createElementVNode, normalizeStyle, withKeys, withModifiers, toDisplayString } from 'vue';
2
- import { createForm, onFieldValueChange, onFieldReact } from '@formily/core';
2
+ import { createForm, onFieldValueChange, onFieldReact, onFormMount } from '@formily/core';
3
3
  import { FormProvider, FormConsumer } from '@formily/vue';
4
4
  import { cloneDeep } from 'lodash-es';
5
5
  import { NForm, NTabs, NTabPane, NConfigProvider } from 'naive-ui';
@@ -96,7 +96,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
96
96
  });
97
97
  lowCodeReactionsHandler(fieldKey, field.value);
98
98
  });
99
- onFieldReact("*", (field) => props.linebarAutoHidden && triggerAutoHidden(field));
99
+ if (!props.linebarAutoHidden)
100
+ return;
101
+ onFieldReact("*", triggerAutoHidden);
102
+ onFormMount((formModel2) => formModel2.query("*").forEach(triggerAutoHidden));
100
103
  }
101
104
  });
102
105
  const { lowCodeReactionsHandler, triggerAllReactionsHandler } = useLowCodeReactions(
@@ -1,21 +1,27 @@
1
- import { isVoidField } from '@formily/core';
2
- import { promiseTimeout } from '@vueuse/shared';
1
+ import { untracked } from '@formily/reactive';
3
2
 
4
3
  function useAutoHidden() {
5
4
  async function trigger(field) {
6
- const childDisplay = field.selfDisplay;
7
- await promiseTimeout(0);
8
- const parent = field.parent;
9
- if (!parent || !isVoidField(parent) || parent.componentType !== "LINEBAR")
5
+ if (field.componentType === "LINEBAR")
10
6
  return;
11
- const parentAddress = parent.address.toString();
12
- let visible = childDisplay === "visible";
13
- field.form.query(parentAddress + ".*").forEach((childField, address) => {
14
- if (address.parent().toString() === parentAddress) {
15
- visible = visible || childField.selfDisplay === "visible";
7
+ const childDisplay = field.selfDisplay;
8
+ untracked(() => {
9
+ const parent = field.parent;
10
+ if (!parent || parent.componentType !== "LINEBAR")
11
+ return;
12
+ const parentAddress = parent.address.toString();
13
+ let visible = childDisplay === "visible";
14
+ if (!visible) {
15
+ const addresses = Reflect.get(field.form.query(parentAddress + ".*"), "addresses");
16
+ addresses.some((address) => {
17
+ const targetField = field.form.fields[address];
18
+ if (targetField && targetField.address.parent().toString() === parentAddress) {
19
+ return visible = targetField.selfDisplay === "visible";
20
+ }
21
+ });
16
22
  }
23
+ parent.setDisplay(visible ? "visible" : "hidden");
17
24
  });
18
- parent.setDisplay(visible ? "visible" : "hidden");
19
25
  }
20
26
  return { trigger };
21
27
  }
@@ -21,6 +21,7 @@ declare const InfoHeader: SFCWithInstall<import("vue").DefineComponent<{
21
21
  tagList?: Partial<{
22
22
  type?: "warning" | "info" | undefined;
23
23
  content: string;
24
+ render?: any;
24
25
  color?: {
25
26
  color?: string | undefined;
26
27
  textColor?: string | undefined;
@@ -81,6 +82,7 @@ declare const InfoHeader: SFCWithInstall<import("vue").DefineComponent<{
81
82
  tagList?: Partial<{
82
83
  type?: "warning" | "info" | undefined;
83
84
  content: string;
85
+ render?: any;
84
86
  color?: {
85
87
  color?: string | undefined;
86
88
  textColor?: string | undefined;
@@ -142,6 +144,7 @@ declare const InfoHeader: SFCWithInstall<import("vue").DefineComponent<{
142
144
  getTagColor: ({ type }: Partial<{
143
145
  type?: "warning" | "info" | undefined;
144
146
  content: string;
147
+ render?: any;
145
148
  color?: {
146
149
  color?: string | undefined;
147
150
  textColor?: string | undefined;
@@ -150,6 +153,15 @@ declare const InfoHeader: SFCWithInstall<import("vue").DefineComponent<{
150
153
  color: string;
151
154
  textColor: string;
152
155
  };
156
+ tagListExcludeEmpty: import("vue").ComputedRef<Partial<{
157
+ type?: "warning" | "info" | undefined;
158
+ content: string;
159
+ render?: any;
160
+ color?: {
161
+ color?: string | undefined;
162
+ textColor?: string | undefined;
163
+ } | undefined;
164
+ }>[]>;
153
165
  getDescriptionItemStyle: ({ bold, contentStyle }?: import("../../../es/shared/types").AnyObject) => import("vue").CSSProperties;
154
166
  getEllipsisStyle: (index: number, { bold, contentStyle }?: import("../../../es/shared/types").AnyObject) => import("vue").CSSProperties;
155
167
  needHidden: (item: import("../../../es/shared/types").AnyObject) => boolean;
@@ -195,6 +207,7 @@ declare const InfoHeader: SFCWithInstall<import("vue").DefineComponent<{
195
207
  NScrollbar: any;
196
208
  NImage: any;
197
209
  NPopover: any;
210
+ NEllipsis: any;
198
211
  SlotRender: import("vue").DefineComponent<{
199
212
  renderer: {
200
213
  type: import("vue").PropType<string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | import("../../../es/shared/types").Func<any[], any>>;
@@ -240,8 +253,8 @@ declare const InfoHeader: SFCWithInstall<import("vue").DefineComponent<{
240
253
  default: () => {};
241
254
  };
242
255
  }>>, {
243
- contentStyle: import("vue").CSSProperties;
244
256
  content: string;
257
+ contentStyle: import("vue").CSSProperties;
245
258
  }>;
246
259
  HiddenContent: import("vue").DefineComponent<{
247
260
  content: {
@@ -307,8 +320,8 @@ declare const InfoHeader: SFCWithInstall<import("vue").DefineComponent<{
307
320
  default: () => {};
308
321
  };
309
322
  }>>, {
310
- contentStyle: import("vue").CSSProperties;
311
323
  content: string;
324
+ contentStyle: import("vue").CSSProperties;
312
325
  }>;
313
326
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
314
327
  content: {
@@ -324,8 +337,8 @@ declare const InfoHeader: SFCWithInstall<import("vue").DefineComponent<{
324
337
  default: () => {};
325
338
  };
326
339
  }>>, {
327
- contentStyle: import("vue").CSSProperties;
328
340
  content: string;
341
+ contentStyle: import("vue").CSSProperties;
329
342
  }>;
330
343
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("openPatientInfo" | "fieldSet" | "update:compact")[], "openPatientInfo" | "fieldSet" | "update:compact", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
331
344
  compact: {
@@ -349,6 +362,7 @@ declare const InfoHeader: SFCWithInstall<import("vue").DefineComponent<{
349
362
  tagList?: Partial<{
350
363
  type?: "warning" | "info" | undefined;
351
364
  content: string;
365
+ render?: any;
352
366
  color?: {
353
367
  color?: string | undefined;
354
368
  textColor?: string | undefined;
@@ -404,6 +418,7 @@ declare const InfoHeader: SFCWithInstall<import("vue").DefineComponent<{
404
418
  tagList?: Partial<{
405
419
  type?: "warning" | "info" | undefined;
406
420
  content: string;
421
+ render?: any;
407
422
  color?: {
408
423
  color?: string | undefined;
409
424
  textColor?: string | undefined;
@@ -63,8 +63,8 @@ declare const _default: import("vue").DefineComponent<{
63
63
  default: () => {};
64
64
  };
65
65
  }>>, {
66
- contentStyle: CSSProperties;
67
66
  content: string;
67
+ contentStyle: CSSProperties;
68
68
  }>;
69
69
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
70
70
  content: {
@@ -80,7 +80,7 @@ declare const _default: import("vue").DefineComponent<{
80
80
  default: () => {};
81
81
  };
82
82
  }>>, {
83
- contentStyle: CSSProperties;
84
83
  content: string;
84
+ contentStyle: CSSProperties;
85
85
  }>;
86
86
  export default _default;
@@ -27,7 +27,7 @@ declare const _default: import("vue").DefineComponent<{
27
27
  default: () => {};
28
28
  };
29
29
  }>>, {
30
- contentStyle: CSSProperties;
31
30
  content: string;
31
+ contentStyle: CSSProperties;
32
32
  }>;
33
33
  export default _default;
@@ -3,6 +3,7 @@ import { CSSProperties, PropType, VNode } from 'vue';
3
3
  declare type PatientTag = Partial<{
4
4
  type?: 'warning' | 'info';
5
5
  content: string;
6
+ render?: any;
6
7
  color?: {
7
8
  color?: string;
8
9
  textColor?: string;
@@ -30,6 +31,7 @@ declare const _default: import("vue").DefineComponent<{
30
31
  tagList?: Partial<{
31
32
  type?: "warning" | "info" | undefined;
32
33
  content: string;
34
+ render?: any;
33
35
  color?: {
34
36
  color?: string | undefined;
35
37
  textColor?: string | undefined;
@@ -88,6 +90,7 @@ declare const _default: import("vue").DefineComponent<{
88
90
  tagList?: Partial<{
89
91
  type?: "warning" | "info" | undefined;
90
92
  content: string;
93
+ render?: any;
91
94
  color?: {
92
95
  color?: string | undefined;
93
96
  textColor?: string | undefined;
@@ -144,6 +147,15 @@ declare const _default: import("vue").DefineComponent<{
144
147
  color: string;
145
148
  textColor: string;
146
149
  };
150
+ tagListExcludeEmpty: import("vue").ComputedRef<Partial<{
151
+ type?: "warning" | "info" | undefined;
152
+ content: string;
153
+ render?: any;
154
+ color?: {
155
+ color?: string | undefined;
156
+ textColor?: string | undefined;
157
+ } | undefined;
158
+ }>[]>;
147
159
  getDescriptionItemStyle: ({ bold, contentStyle }?: AnyObject) => CSSProperties;
148
160
  getEllipsisStyle: (index: number, { bold, contentStyle }?: AnyObject) => CSSProperties;
149
161
  needHidden: (item: AnyObject) => boolean;
@@ -189,6 +201,7 @@ declare const _default: import("vue").DefineComponent<{
189
201
  NScrollbar: any;
190
202
  NImage: any;
191
203
  NPopover: any;
204
+ NEllipsis: any;
192
205
  SlotRender: import("vue").DefineComponent<{
193
206
  renderer: {
194
207
  type: PropType<string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | Func<any[], any>>;
@@ -234,8 +247,8 @@ declare const _default: import("vue").DefineComponent<{
234
247
  default: () => {};
235
248
  };
236
249
  }>>, {
237
- contentStyle: CSSProperties;
238
250
  content: string;
251
+ contentStyle: CSSProperties;
239
252
  }>;
240
253
  HiddenContent: import("vue").DefineComponent<{
241
254
  content: {
@@ -301,8 +314,8 @@ declare const _default: import("vue").DefineComponent<{
301
314
  default: () => {};
302
315
  };
303
316
  }>>, {
304
- contentStyle: CSSProperties;
305
317
  content: string;
318
+ contentStyle: CSSProperties;
306
319
  }>;
307
320
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
308
321
  content: {
@@ -318,8 +331,8 @@ declare const _default: import("vue").DefineComponent<{
318
331
  default: () => {};
319
332
  };
320
333
  }>>, {
321
- contentStyle: CSSProperties;
322
334
  content: string;
335
+ contentStyle: CSSProperties;
323
336
  }>;
324
337
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("openPatientInfo" | "fieldSet" | "update:compact")[], "openPatientInfo" | "fieldSet" | "update:compact", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
325
338
  compact: {
@@ -343,6 +356,7 @@ declare const _default: import("vue").DefineComponent<{
343
356
  tagList?: Partial<{
344
357
  type?: "warning" | "info" | undefined;
345
358
  content: string;
359
+ render?: any;
346
360
  color?: {
347
361
  color?: string | undefined;
348
362
  textColor?: string | undefined;
@@ -396,6 +410,7 @@ declare const _default: import("vue").DefineComponent<{
396
410
  tagList?: Partial<{
397
411
  type?: "warning" | "info" | undefined;
398
412
  content: string;
413
+ render?: any;
399
414
  color?: {
400
415
  color?: string | undefined;
401
416
  textColor?: string | undefined;
@@ -1,6 +1,6 @@
1
- import { defineComponent, computed, ref, nextTick, onMounted, watch, onBeforeUnmount, onDeactivated, onActivated, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, createCommentVNode, renderSlot, Fragment, createVNode, unref, withCtx, mergeProps, toDisplayString, renderList, withDirectives, createBlock, createTextVNode, vShow, resolveDynamicComponent, h } from 'vue';
2
- import { isString } from 'lodash-es';
3
- import { NPopover, NImage, NTag, NScrollbar, NDescriptions, NDescriptionsItem } from 'naive-ui';
1
+ import { defineComponent, computed, ref, nextTick, onMounted, watch, onBeforeUnmount, onDeactivated, onActivated, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, createCommentVNode, renderSlot, Fragment, createVNode, unref, withCtx, mergeProps, toDisplayString, renderList, createBlock, resolveDynamicComponent, createTextVNode, h } from 'vue';
2
+ import { isString, isArray } from 'lodash-es';
3
+ import { NPopover, NImage, NTag, NEllipsis, NScrollbar, NDescriptions, NDescriptionsItem } from 'naive-ui';
4
4
  import { useThrottleFn, useEventListener } from '@vueuse/core';
5
5
  import script$1 from '../../../shared/components/SlotRender/SlotRender.js';
6
6
  import InfoEllipsis from './InfoEllipsis.vue.js';
@@ -94,6 +94,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
94
94
  const textColorMap = { warning: "#fff", info: "#2563F4" };
95
95
  return { color: colorMap[type], textColor: textColorMap[type] };
96
96
  }
97
+ const tagListExcludeEmpty = computed(() => {
98
+ if (!props.patientInfo || !isArray(props.patientInfo.tagList))
99
+ return [];
100
+ return props.patientInfo.tagList.filter((tag) => tag.render || isString(tag.content) && tag.content);
101
+ });
97
102
  function getDescriptionItemStyle({ bold = true, contentStyle = {} } = {}) {
98
103
  return { fontWeight: bold ? 700 : 500, ...contentStyle };
99
104
  }
@@ -125,7 +130,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
125
130
  if (!labels)
126
131
  return;
127
132
  descriptionWidthList.value = Array.from(labels).map((label) => {
128
- return maxColumnWidth.value - label.clientWidth - 20;
133
+ return maxColumnWidth.value - label.clientWidth - 8;
129
134
  });
130
135
  },
131
136
  200,
@@ -197,23 +202,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
197
202
  __props.patientInfo.sex ? (openBlock(), createElementBlock("div", _hoisted_6, "/ " + toDisplayString(__props.patientInfo.sex), 1)) : createCommentVNode("v-if", true),
198
203
  __props.patientInfo.age ? (openBlock(), createElementBlock("div", _hoisted_7, " / " + toDisplayString(__props.patientInfo.age) + toDisplayString(__props.patientInfo.ageUnit || "\u5C81"), 1)) : createCommentVNode("v-if", true),
199
204
  createCommentVNode(" tag\u533A\u63D2\u69FD "),
200
- renderSlot(_ctx.$slots, "tags", {
201
- tagList: __props.patientInfo.tagList
202
- }, () => [
205
+ renderSlot(_ctx.$slots, "tags", { tagList: unref(tagListExcludeEmpty) }, () => [
203
206
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.patientInfo.tagList || [], (tag) => {
204
- return withDirectives((openBlock(), createBlock(unref(NTag), mergeProps({
207
+ return openBlock(), createBlock(unref(NTag), mergeProps({
205
208
  key: tag.content,
206
209
  size: "medium",
207
210
  bordered: false,
208
211
  color: getTagColor(tag)
209
212
  }, tag), {
210
213
  default: withCtx(() => [
211
- createTextVNode(toDisplayString(tag.content), 1)
214
+ tag.render ? (openBlock(), createBlock(resolveDynamicComponent(tag.render), { key: 0 })) : (openBlock(), createBlock(unref(NEllipsis), {
215
+ key: 1,
216
+ style: { "max-width": "96px" }
217
+ }, {
218
+ default: withCtx(() => [
219
+ createTextVNode(toDisplayString(tag.content), 1)
220
+ ]),
221
+ _: 2
222
+ }, 1024))
212
223
  ]),
213
224
  _: 2
214
- }, 1040, ["color"])), [
215
- [vShow, tag.content]
216
- ]);
225
+ }, 1040, ["color"]);
217
226
  }), 128))
218
227
  ])
219
228
  ]),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.1.40-beta.3",
3
+ "version": "3.1.40-beta.5",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -21,6 +21,7 @@
21
21
  "dependencies": {
22
22
  "@formily/core": "2.1.9",
23
23
  "@formily/path": "2.1.9",
24
+ "@formily/reactive": "2.1.9",
24
25
  "@formily/vue": "2.1.9",
25
26
  "@vicons/ionicons5": "^0.12.0",
26
27
  "@vueuse/core": "^8.6.0",
@@ -61,5 +62,5 @@
61
62
  "iOS 7",
62
63
  "last 3 iOS versions"
63
64
  ],
64
- "gitHead": "b57650253d30a7e48b2c5df106023341bbae4dfc"
65
+ "gitHead": "c414b97bdd24f868f447733009d7c321de3b3564"
65
66
  }