@deot/vc-components 1.0.48 → 1.0.49

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/dist/index.js CHANGED
@@ -11466,7 +11466,14 @@ const props$L = {
11466
11466
  labelStyle: [Object, String],
11467
11467
  labelClass: [Object, String],
11468
11468
  errorStyle: [Object, String],
11469
- errorClass: [Object, String]
11469
+ errorClass: [Object, String],
11470
+ // 给nestFormItem统一注入
11471
+ nestedContentStyle: [Object, String],
11472
+ nestedContentClass: [Object, String],
11473
+ nestedLabelStyle: [Object, String],
11474
+ nestedLabelClass: [Object, String],
11475
+ nestedErrorStyle: [Object, String],
11476
+ nestedErrorClass: [Object, String]
11470
11477
  };
11471
11478
 
11472
11479
  const useForm = (expose, options = {}) => {
@@ -11686,31 +11693,32 @@ const useFormItem = (expose) => {
11686
11693
  });
11687
11694
  const classes = computed(() => {
11688
11695
  return {
11689
- "is-require": isRequired.value && props.asterisk,
11696
+ "is-required": isRequired.value && props.asterisk,
11690
11697
  "is-error": validateState.value === "error",
11691
11698
  "is-validating": validateState.value === "validating",
11692
11699
  "is-inline": form.props.inline,
11693
- "is-nest": isNest.value,
11700
+ "is-nested": isNested.value,
11694
11701
  "is-alone": !props.showMessage,
11695
11702
  // 用于单独去除form-item的默认margin_bottom
11696
11703
  [`is-${labelPosition.value}`]: true
11697
11704
  };
11698
11705
  });
11699
- const isNest = computed(() => {
11706
+ const isNested = computed(() => {
11700
11707
  return !!formItem.change;
11701
11708
  });
11702
- const isNestLast = ref(false);
11709
+ const isNestedLast = ref(false);
11703
11710
  const hasLabel = computed(() => {
11704
11711
  return !!props.label || slots.label;
11705
11712
  });
11706
11713
  const labelStyle = computed(() => {
11707
- const labelWidth = props.labelWidth === 0 || props.labelWidth ? props.labelWidth : isNest.value ? 0 : form.props.labelWidth;
11714
+ const labelWidth = props.labelWidth === 0 || props.labelWidth ? props.labelWidth : isNested.value ? 0 : form.props.labelWidth;
11708
11715
  return [
11709
11716
  {
11710
11717
  width: labelPosition.value !== "top" && labelWidth && labelWidth > 0 ? `${labelWidth}px` : "auto",
11711
11718
  textAlign: labelPosition.value === "top" ? "left" : labelPosition.value
11712
11719
  },
11713
11720
  form.props.labelStyle,
11721
+ isNested.value && form.props.nestedLabelStyle,
11714
11722
  props.labelStyle
11715
11723
  ];
11716
11724
  });
@@ -11718,24 +11726,25 @@ const useFormItem = (expose) => {
11718
11726
  const labelWidth = props.labelWidth === 0 || props.labelWidth ? props.labelWidth : form.props.labelWidth;
11719
11727
  return [
11720
11728
  {
11721
- marginLeft: !hasLabel.value && isNest.value ? 0 : labelWidth && labelWidth > 0 ? `${labelWidth}px` : "unset",
11722
- marginBottom: isNest.value && !isNestLast.value ? `20px` : 0
11729
+ marginLeft: labelPosition.value === "top" || !hasLabel.value && isNested.value ? 0 : labelWidth && labelWidth > 0 ? `${labelWidth}px` : "unset",
11730
+ marginBottom: isNested.value && !isNestedLast.value ? `20px` : 0
11723
11731
  },
11724
11732
  form.props.contentStyle,
11733
+ isNested.value && form.props.nestedContentStyle,
11725
11734
  props.contentStyle
11726
11735
  ];
11727
11736
  });
11728
11737
  const errorStyle = computed(() => {
11729
- return [form.props.errorStyle, props.errorStyle];
11738
+ return [form.props.errorStyle, isNested.value && form.props.nestedErrorStyle, props.errorStyle];
11730
11739
  });
11731
11740
  const labelClass = computed(() => {
11732
- return [form.props.labelClass, props.labelClass];
11741
+ return [form.props.labelClass, isNested.value && form.props.nestedLabelClass, props.labelClass];
11733
11742
  });
11734
11743
  const contentClass = computed(() => {
11735
- return [form.props.contentClass, props.contentClass];
11744
+ return [form.props.contentClass, isNested.value && form.props.nestedContentClass, props.contentClass];
11736
11745
  });
11737
11746
  const errorClass = computed(() => {
11738
- return [form.props.errorClass, props.errorClass];
11747
+ return [form.props.errorClass, isNested.value && form.props.nestedErrorClass, props.errorClass];
11739
11748
  });
11740
11749
  const isStyleless = computed(() => {
11741
11750
  return props.styleless || form.props.styleless;
@@ -11872,7 +11881,7 @@ const useFormItem = (expose) => {
11872
11881
  watch(
11873
11882
  () => formItem.fields?.length,
11874
11883
  async (v) => {
11875
- if (!isNest.value || !v) return isNestLast.value = false;
11884
+ if (!isNested.value || !v) return isNestedLast.value = false;
11876
11885
  const fields$ = [...toRaw(formItem.fields)];
11877
11886
  const positions = await Promise.all(fields$.map((item) => item.exposed.getPosition()));
11878
11887
  const sortFields = fields$.toSorted((a, b) => {
@@ -11883,7 +11892,7 @@ const useFormItem = (expose) => {
11883
11892
  if (aPosition.top != bPosition.top) return aPosition.top - bPosition.top;
11884
11893
  return aPosition.left - bPosition.left;
11885
11894
  });
11886
- isNestLast.value = sortFields[sortFields.length - 1] === instance;
11895
+ isNestedLast.value = sortFields[sortFields.length - 1] === instance;
11887
11896
  }
11888
11897
  );
11889
11898
  expose({
@@ -11892,9 +11901,9 @@ const useFormItem = (expose) => {
11892
11901
  getPosition
11893
11902
  });
11894
11903
  return {
11895
- isNest,
11904
+ isNested,
11896
11905
  isStyleless,
11897
- isNestLast,
11906
+ isNestedLast,
11898
11907
  validateMessage,
11899
11908
  classes,
11900
11909
  labelStyle,
@@ -11921,7 +11930,7 @@ const FormItem = /* @__PURE__ */ defineComponent({
11921
11930
  const it = useFormItem(expose);
11922
11931
  const {
11923
11932
  isStyleless,
11924
- isNest,
11933
+ isNested,
11925
11934
  classes,
11926
11935
  labelStyle,
11927
11936
  contentStyle,
@@ -11932,39 +11941,35 @@ const FormItem = /* @__PURE__ */ defineComponent({
11932
11941
  showError,
11933
11942
  validateMessage
11934
11943
  } = it;
11935
- const {
11936
- label,
11937
- labelFor
11938
- } = props;
11939
11944
  const errorColorClass = 'vc-form-item__error';
11940
11945
  return () => {
11941
11946
  if (isStyleless.value) return [slots.default?.(), slots.error?.({
11942
11947
  show: showError.value,
11943
- nest: isNest.value,
11948
+ nested: isNested.value,
11944
11949
  message: validateMessage.value,
11945
11950
  class: [errorColorClass, ...errorClass.value],
11946
11951
  style: errorStyle.value
11947
11952
  })];
11948
11953
  return createVNode("div", {
11949
11954
  "class": ['vc-form-item', classes.value]
11950
- }, [(label || slots.label) && createVNode("div", {
11955
+ }, [(props.label || slots.label) && createVNode("div", {
11951
11956
  "style": labelStyle.value,
11952
11957
  "class": ['vc-form-item__label', ...labelClass.value],
11953
- "for": labelFor
11954
- }, [createVNode("label", null, [label || slots.label?.()])]), createVNode("div", {
11958
+ "for": props.labelFor
11959
+ }, [createVNode("label", null, [props.label || slots.label?.()])]), createVNode("div", {
11955
11960
  "class": "vc-form-item__wrapper"
11956
11961
  }, [createVNode("div", {
11957
11962
  "class": ['vc-form-item__content', ...contentClass.value],
11958
11963
  "style": contentStyle.value
11959
11964
  }, [slots.default?.(), slots.error ? slots.error({
11960
11965
  show: showError.value,
11961
- nest: isNest.value,
11966
+ nest: isNested.value,
11962
11967
  message: validateMessage.value,
11963
11968
  class: [errorColorClass, ...errorClass.value],
11964
11969
  style: errorStyle.value
11965
11970
  }) : createVNode(TransitionFade, null, {
11966
11971
  default: () => [withDirectives(createVNode("div", {
11967
- "class": ['vc-form-item__tip', isNest.value ? 'is-nest' : '', errorColorClass, ...errorClass.value],
11972
+ "class": ['vc-form-item__tip', isNested.value ? 'is-nested' : '', errorColorClass, ...errorClass.value],
11968
11973
  "style": [errorStyle.value]
11969
11974
  }, [validateMessage.value]), [[vShow, showError.value]])]
11970
11975
  })])])]);
@@ -12035,41 +12040,36 @@ const MFormItem = /* @__PURE__ */ defineComponent({
12035
12040
  labelClass,
12036
12041
  contentClass,
12037
12042
  errorClass,
12038
- isNest,
12043
+ isNested,
12039
12044
  showError,
12040
12045
  validateMessage
12041
12046
  } = it;
12042
- const {
12043
- label,
12044
- labelFor,
12045
- showMessage
12046
- } = props;
12047
12047
  const errorColorClass = 'vcm-form-item__error';
12048
12048
  return () => {
12049
12049
  if (isStyleless.value) return [slots.default?.(), slots.error?.({
12050
12050
  show: showError.value,
12051
- nest: isNest.value,
12051
+ nested: isNested.value,
12052
12052
  message: validateMessage.value,
12053
12053
  class: [errorColorClass, ...errorClass.value],
12054
12054
  style: errorStyle.value
12055
12055
  })];
12056
12056
  return createVNode("div", {
12057
12057
  "style": {
12058
- paddingLeft: `${isNest.value ? 0 : props.indent}px`
12058
+ paddingLeft: `${isNested.value ? 0 : props.indent}px`
12059
12059
  },
12060
12060
  "class": [classes.value, 'vcm-form-item']
12061
12061
  }, [createVNode("div", {
12062
12062
  "class": "vcm-form-item__wrapper"
12063
12063
  }, [(props.label || slots.label) && createVNode("label", {
12064
- "for": labelFor,
12064
+ "for": props.labelFor,
12065
12065
  "style": labelStyle.value,
12066
12066
  "class": ['vcm-form-item__label', ...labelClass.value]
12067
- }, [label || slots.label?.()]), createVNode("div", {
12067
+ }, [props.label || slots.label?.()]), createVNode("div", {
12068
12068
  "style": contentStyle.value,
12069
12069
  "class": ['vcm-form-item__content', ...contentClass.value]
12070
- }, [slots.default?.(), showMessage && showError.value && createVNode("div", {
12070
+ }, [slots.default?.(), props.showMessage && showError.value && createVNode("div", {
12071
12071
  "class": [{
12072
- 'is-nest': isNest.value
12072
+ 'is-nested': isNested.value
12073
12073
  }, errorColorClass, ...errorClass.value],
12074
12074
  "style": errorStyle.value
12075
12075
  }, [slots.error ? slots.error({