@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.
@@ -19902,7 +19902,14 @@
19902
19902
  labelStyle: [Object, String],
19903
19903
  labelClass: [Object, String],
19904
19904
  errorStyle: [Object, String],
19905
- errorClass: [Object, String]
19905
+ errorClass: [Object, String],
19906
+ // 给nestFormItem统一注入
19907
+ nestedContentStyle: [Object, String],
19908
+ nestedContentClass: [Object, String],
19909
+ nestedLabelStyle: [Object, String],
19910
+ nestedLabelClass: [Object, String],
19911
+ nestedErrorStyle: [Object, String],
19912
+ nestedErrorClass: [Object, String]
19906
19913
  };
19907
19914
 
19908
19915
  const useForm = (expose, options = {}) => {
@@ -20254,31 +20261,32 @@
20254
20261
  });
20255
20262
  const classes = vue.computed(() => {
20256
20263
  return {
20257
- "is-require": isRequired.value && props.asterisk,
20264
+ "is-required": isRequired.value && props.asterisk,
20258
20265
  "is-error": validateState.value === "error",
20259
20266
  "is-validating": validateState.value === "validating",
20260
20267
  "is-inline": form.props.inline,
20261
- "is-nest": isNest.value,
20268
+ "is-nested": isNested.value,
20262
20269
  "is-alone": !props.showMessage,
20263
20270
  // 用于单独去除form-item的默认margin_bottom
20264
20271
  [`is-${labelPosition.value}`]: true
20265
20272
  };
20266
20273
  });
20267
- const isNest = vue.computed(() => {
20274
+ const isNested = vue.computed(() => {
20268
20275
  return !!formItem.change;
20269
20276
  });
20270
- const isNestLast = vue.ref(false);
20277
+ const isNestedLast = vue.ref(false);
20271
20278
  const hasLabel = vue.computed(() => {
20272
20279
  return !!props.label || slots.label;
20273
20280
  });
20274
20281
  const labelStyle = vue.computed(() => {
20275
- const labelWidth = props.labelWidth === 0 || props.labelWidth ? props.labelWidth : isNest.value ? 0 : form.props.labelWidth;
20282
+ const labelWidth = props.labelWidth === 0 || props.labelWidth ? props.labelWidth : isNested.value ? 0 : form.props.labelWidth;
20276
20283
  return [
20277
20284
  {
20278
20285
  width: labelPosition.value !== "top" && labelWidth && labelWidth > 0 ? `${labelWidth}px` : "auto",
20279
20286
  textAlign: labelPosition.value === "top" ? "left" : labelPosition.value
20280
20287
  },
20281
20288
  form.props.labelStyle,
20289
+ isNested.value && form.props.nestedLabelStyle,
20282
20290
  props.labelStyle
20283
20291
  ];
20284
20292
  });
@@ -20286,24 +20294,25 @@
20286
20294
  const labelWidth = props.labelWidth === 0 || props.labelWidth ? props.labelWidth : form.props.labelWidth;
20287
20295
  return [
20288
20296
  {
20289
- marginLeft: !hasLabel.value && isNest.value ? 0 : labelWidth && labelWidth > 0 ? `${labelWidth}px` : "unset",
20290
- marginBottom: isNest.value && !isNestLast.value ? `20px` : 0
20297
+ marginLeft: labelPosition.value === "top" || !hasLabel.value && isNested.value ? 0 : labelWidth && labelWidth > 0 ? `${labelWidth}px` : "unset",
20298
+ marginBottom: isNested.value && !isNestedLast.value ? `20px` : 0
20291
20299
  },
20292
20300
  form.props.contentStyle,
20301
+ isNested.value && form.props.nestedContentStyle,
20293
20302
  props.contentStyle
20294
20303
  ];
20295
20304
  });
20296
20305
  const errorStyle = vue.computed(() => {
20297
- return [form.props.errorStyle, props.errorStyle];
20306
+ return [form.props.errorStyle, isNested.value && form.props.nestedErrorStyle, props.errorStyle];
20298
20307
  });
20299
20308
  const labelClass = vue.computed(() => {
20300
- return [form.props.labelClass, props.labelClass];
20309
+ return [form.props.labelClass, isNested.value && form.props.nestedLabelClass, props.labelClass];
20301
20310
  });
20302
20311
  const contentClass = vue.computed(() => {
20303
- return [form.props.contentClass, props.contentClass];
20312
+ return [form.props.contentClass, isNested.value && form.props.nestedContentClass, props.contentClass];
20304
20313
  });
20305
20314
  const errorClass = vue.computed(() => {
20306
- return [form.props.errorClass, props.errorClass];
20315
+ return [form.props.errorClass, isNested.value && form.props.nestedErrorClass, props.errorClass];
20307
20316
  });
20308
20317
  const isStyleless = vue.computed(() => {
20309
20318
  return props.styleless || form.props.styleless;
@@ -20440,7 +20449,7 @@
20440
20449
  vue.watch(
20441
20450
  () => formItem.fields?.length,
20442
20451
  async (v) => {
20443
- if (!isNest.value || !v) return isNestLast.value = false;
20452
+ if (!isNested.value || !v) return isNestedLast.value = false;
20444
20453
  const fields$ = [...vue.toRaw(formItem.fields)];
20445
20454
  const positions = await Promise.all(fields$.map((item) => item.exposed.getPosition()));
20446
20455
  const sortFields = fields$.toSorted((a, b) => {
@@ -20451,7 +20460,7 @@
20451
20460
  if (aPosition.top != bPosition.top) return aPosition.top - bPosition.top;
20452
20461
  return aPosition.left - bPosition.left;
20453
20462
  });
20454
- isNestLast.value = sortFields[sortFields.length - 1] === instance;
20463
+ isNestedLast.value = sortFields[sortFields.length - 1] === instance;
20455
20464
  }
20456
20465
  );
20457
20466
  expose({
@@ -20460,9 +20469,9 @@
20460
20469
  getPosition
20461
20470
  });
20462
20471
  return {
20463
- isNest,
20472
+ isNested,
20464
20473
  isStyleless,
20465
- isNestLast,
20474
+ isNestedLast,
20466
20475
  validateMessage,
20467
20476
  classes,
20468
20477
  labelStyle,
@@ -20489,7 +20498,7 @@
20489
20498
  const it = useFormItem(expose);
20490
20499
  const {
20491
20500
  isStyleless,
20492
- isNest,
20501
+ isNested,
20493
20502
  classes,
20494
20503
  labelStyle,
20495
20504
  contentStyle,
@@ -20500,39 +20509,35 @@
20500
20509
  showError,
20501
20510
  validateMessage
20502
20511
  } = it;
20503
- const {
20504
- label,
20505
- labelFor
20506
- } = props;
20507
20512
  const errorColorClass = 'vc-form-item__error';
20508
20513
  return () => {
20509
20514
  if (isStyleless.value) return [slots.default?.(), slots.error?.({
20510
20515
  show: showError.value,
20511
- nest: isNest.value,
20516
+ nested: isNested.value,
20512
20517
  message: validateMessage.value,
20513
20518
  class: [errorColorClass, ...errorClass.value],
20514
20519
  style: errorStyle.value
20515
20520
  })];
20516
20521
  return vue.createVNode("div", {
20517
20522
  "class": ['vc-form-item', classes.value]
20518
- }, [(label || slots.label) && vue.createVNode("div", {
20523
+ }, [(props.label || slots.label) && vue.createVNode("div", {
20519
20524
  "style": labelStyle.value,
20520
20525
  "class": ['vc-form-item__label', ...labelClass.value],
20521
- "for": labelFor
20522
- }, [vue.createVNode("label", null, [label || slots.label?.()])]), vue.createVNode("div", {
20526
+ "for": props.labelFor
20527
+ }, [vue.createVNode("label", null, [props.label || slots.label?.()])]), vue.createVNode("div", {
20523
20528
  "class": "vc-form-item__wrapper"
20524
20529
  }, [vue.createVNode("div", {
20525
20530
  "class": ['vc-form-item__content', ...contentClass.value],
20526
20531
  "style": contentStyle.value
20527
20532
  }, [slots.default?.(), slots.error ? slots.error({
20528
20533
  show: showError.value,
20529
- nest: isNest.value,
20534
+ nest: isNested.value,
20530
20535
  message: validateMessage.value,
20531
20536
  class: [errorColorClass, ...errorClass.value],
20532
20537
  style: errorStyle.value
20533
20538
  }) : vue.createVNode(TransitionFade, null, {
20534
20539
  default: () => [vue.withDirectives(vue.createVNode("div", {
20535
- "class": ['vc-form-item__tip', isNest.value ? 'is-nest' : '', errorColorClass, ...errorClass.value],
20540
+ "class": ['vc-form-item__tip', isNested.value ? 'is-nested' : '', errorColorClass, ...errorClass.value],
20536
20541
  "style": [errorStyle.value]
20537
20542
  }, [validateMessage.value]), [[vue.vShow, showError.value]])]
20538
20543
  })])])]);
@@ -20603,41 +20608,36 @@
20603
20608
  labelClass,
20604
20609
  contentClass,
20605
20610
  errorClass,
20606
- isNest,
20611
+ isNested,
20607
20612
  showError,
20608
20613
  validateMessage
20609
20614
  } = it;
20610
- const {
20611
- label,
20612
- labelFor,
20613
- showMessage
20614
- } = props;
20615
20615
  const errorColorClass = 'vcm-form-item__error';
20616
20616
  return () => {
20617
20617
  if (isStyleless.value) return [slots.default?.(), slots.error?.({
20618
20618
  show: showError.value,
20619
- nest: isNest.value,
20619
+ nested: isNested.value,
20620
20620
  message: validateMessage.value,
20621
20621
  class: [errorColorClass, ...errorClass.value],
20622
20622
  style: errorStyle.value
20623
20623
  })];
20624
20624
  return vue.createVNode("div", {
20625
20625
  "style": {
20626
- paddingLeft: `${isNest.value ? 0 : props.indent}px`
20626
+ paddingLeft: `${isNested.value ? 0 : props.indent}px`
20627
20627
  },
20628
20628
  "class": [classes.value, 'vcm-form-item']
20629
20629
  }, [vue.createVNode("div", {
20630
20630
  "class": "vcm-form-item__wrapper"
20631
20631
  }, [(props.label || slots.label) && vue.createVNode("label", {
20632
- "for": labelFor,
20632
+ "for": props.labelFor,
20633
20633
  "style": labelStyle.value,
20634
20634
  "class": ['vcm-form-item__label', ...labelClass.value]
20635
- }, [label || slots.label?.()]), vue.createVNode("div", {
20635
+ }, [props.label || slots.label?.()]), vue.createVNode("div", {
20636
20636
  "style": contentStyle.value,
20637
20637
  "class": ['vcm-form-item__content', ...contentClass.value]
20638
- }, [slots.default?.(), showMessage && showError.value && vue.createVNode("div", {
20638
+ }, [slots.default?.(), props.showMessage && showError.value && vue.createVNode("div", {
20639
20639
  "class": [{
20640
- 'is-nest': isNest.value
20640
+ 'is-nested': isNested.value
20641
20641
  }, errorColorClass, ...errorClass.value],
20642
20642
  "style": errorStyle.value
20643
20643
  }, [slots.error ? slots.error({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deot/vc-components",
3
- "version": "1.0.48",
3
+ "version": "1.0.49",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",