cnhis-design-vue 3.1.38-beta.3 → 3.1.38-beta.4

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,6 @@
1
1
  export declare const FORM_ITEM: import("vue").DefineComponent<{
2
2
  label: StringConstructor;
3
+ isSuffix: BooleanConstructor;
3
4
  propertyKey: StringConstructor;
4
5
  remark: StringConstructor;
5
6
  span: NumberConstructor;
@@ -7,9 +8,12 @@ export declare const FORM_ITEM: import("vue").DefineComponent<{
7
8
  fieldItem: {};
8
9
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
9
10
  label: StringConstructor;
11
+ isSuffix: BooleanConstructor;
10
12
  propertyKey: StringConstructor;
11
13
  remark: StringConstructor;
12
14
  span: NumberConstructor;
13
15
  annotation: {};
14
16
  fieldItem: {};
15
- }>>, {}>;
17
+ }>>, {
18
+ isSuffix: boolean;
19
+ }>;
@@ -14,6 +14,7 @@ import { validateMessageParser } from '../../utils/index.js';
14
14
  const script = defineComponent({
15
15
  props: {
16
16
  label: String,
17
+ isSuffix: Boolean,
17
18
  propertyKey: String,
18
19
  remark: String,
19
20
  span: Number,
@@ -21,7 +22,8 @@ const script = defineComponent({
21
22
  fieldItem: {}
22
23
  },
23
24
  setup(props, {
24
- slots
25
+ slots,
26
+ attrs
25
27
  }) {
26
28
  const annotation = inject(InjectionAnnotation);
27
29
  const annotationContent = computed({
@@ -46,7 +48,7 @@ const script = defineComponent({
46
48
  const showAnnotation = computed(() => {
47
49
  return annotation.value && props.annotation !== false;
48
50
  });
49
- const showLabel = computed(() => props.label && props.label !== " ");
51
+ const needRenderLabel = computed(() => props.label && props.label !== " ");
50
52
  const field = useField();
51
53
  const uuid = inject(InjectionFormUUID);
52
54
  const id = computed(() => {
@@ -59,7 +61,7 @@ const script = defineComponent({
59
61
  return result;
60
62
  });
61
63
  function renderLabel() {
62
- return showLabel.value ? createVNode("section", {
64
+ return needRenderLabel.value ? createVNode("section", {
63
65
  "class": "form-render__formItemLabel"
64
66
  }, [createVNode("span", {
65
67
  "class": "form-render__formItemLabel--text",
@@ -74,6 +76,23 @@ const script = defineComponent({
74
76
  "message": props.remark
75
77
  }, null)]) : null, showAnnotation.value ? renderAnnotation() : null]) : null]) : null;
76
78
  }
79
+ const nFormConfig = inject("n-form", {
80
+ props: {}
81
+ });
82
+ const showLabel = computed(() => {
83
+ var _a, _b, _c;
84
+ if (((_a = nFormConfig.props) == null ? void 0 : _a.labelPlacement) === "left" && props.isSuffix)
85
+ return false;
86
+ return (_c = attrs.showLabel) != null ? _c : (_b = nFormConfig.props) == null ? void 0 : _b.showLabel;
87
+ });
88
+ const renderSlots = computed(() => {
89
+ const result = {
90
+ ...slots
91
+ };
92
+ if (showLabel.value)
93
+ result.label = renderLabel;
94
+ return result;
95
+ });
77
96
  return () => {
78
97
  var _a;
79
98
  return createVNode(NFormItem, mergeProps({
@@ -84,11 +103,9 @@ const script = defineComponent({
84
103
  }, {
85
104
  id: id.value,
86
105
  "widget-type": field.value.componentType,
87
- "form-field": field.value.path.toString()
88
- }), {
89
- ...slots,
90
- label: renderLabel
91
- });
106
+ "form-field": field.value.path.toString(),
107
+ showLabel: showLabel.value
108
+ }), renderSlots.value);
92
109
  };
93
110
  }
94
111
  });
@@ -243,7 +243,15 @@ function useFieldListAdaptor(collector) {
243
243
  const suffixList = arrayed(item.suffixConfig);
244
244
  const fieldList = [{ ...item, suffixConfig: void 0 }].concat(
245
245
  suffixList.map((suffix) => {
246
- return { ...suffix, is_show: item.is_show, alias: " " };
246
+ return {
247
+ ...suffix,
248
+ is_show: item.is_show,
249
+ alias: "",
250
+ decoratorProps: {
251
+ ...suffix.decoratorProps,
252
+ isSuffix: true
253
+ }
254
+ };
247
255
  })
248
256
  );
249
257
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.1.38-beta.3",
3
+ "version": "3.1.38-beta.4",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -61,5 +61,5 @@
61
61
  "iOS 7",
62
62
  "last 3 iOS versions"
63
63
  ],
64
- "gitHead": "8befc87f7eec7ffb77d7f7808b468fba4f614515"
64
+ "gitHead": "721f77a45d1d0be32b9186a02f79da33624b5e72"
65
65
  }