vue-devui 1.0.0-rc.8 → 1.0.0-rc.9

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.
Files changed (123) hide show
  1. package/alert/index.es.js +2 -2
  2. package/alert/index.umd.js +1 -1
  3. package/auto-complete/index.es.js +282 -84
  4. package/auto-complete/index.umd.js +3 -5
  5. package/auto-complete/style.css +1 -1
  6. package/avatar/index.es.js +59 -74
  7. package/avatar/index.umd.js +1 -1
  8. package/badge/index.es.js +2 -2
  9. package/badge/index.umd.js +1 -1
  10. package/button/index.es.js +111 -38
  11. package/button/index.umd.js +15 -15
  12. package/button/style.css +1 -1
  13. package/card/index.es.js +2 -2
  14. package/card/index.umd.js +1 -1
  15. package/checkbox/index.es.js +340 -228
  16. package/checkbox/index.umd.js +1 -1
  17. package/checkbox/style.css +1 -1
  18. package/date-picker/index.es.js +264 -63
  19. package/date-picker/index.umd.js +1 -1
  20. package/date-picker/style.css +1 -1
  21. package/drawer/index.es.js +2 -2
  22. package/drawer/index.umd.js +1 -1
  23. package/dropdown/index.es.js +104 -48
  24. package/dropdown/index.umd.js +1 -1
  25. package/dropdown/style.css +1 -1
  26. package/editable-select/index.es.js +423 -8
  27. package/editable-select/index.umd.js +1 -1
  28. package/editable-select/style.css +1 -1
  29. package/form/index.es.js +304 -184
  30. package/form/index.umd.js +15 -15
  31. package/form/style.css +1 -1
  32. package/fullscreen/index.es.js +2 -2
  33. package/fullscreen/index.umd.js +1 -1
  34. package/grid/index.es.js +8 -6
  35. package/grid/index.umd.js +1 -1
  36. package/icon/index.es.js +109 -13
  37. package/icon/index.umd.js +1 -1
  38. package/icon/style.css +1 -0
  39. package/image-preview/index.es.js +2 -2
  40. package/image-preview/index.umd.js +1 -1
  41. package/input/index.es.js +278 -30
  42. package/input/index.umd.js +1 -1
  43. package/input/style.css +1 -1
  44. package/input-number/index.es.js +272 -199
  45. package/input-number/index.umd.js +1 -1
  46. package/input-number/style.css +1 -1
  47. package/layout/index.es.js +2 -2
  48. package/layout/index.umd.js +1 -1
  49. package/loading/index.es.js +2 -2
  50. package/loading/index.umd.js +1 -1
  51. package/modal/index.es.js +105 -32
  52. package/modal/index.umd.js +1 -1
  53. package/modal/style.css +1 -1
  54. package/notification/index.es.js +105 -32
  55. package/notification/index.umd.js +1 -1
  56. package/notification/style.css +1 -1
  57. package/nuxt/components/CheckboxButton.js +3 -0
  58. package/nuxt/components/Icon.js +1 -0
  59. package/nuxt/components/LABEL_DATA.js +3 -0
  60. package/nuxt/components/Option.js +3 -0
  61. package/nuxt/components/iconProps.js +1 -0
  62. package/nuxt/components/svgIconProps.js +3 -0
  63. package/overlay/index.es.js +2 -2
  64. package/overlay/index.umd.js +1 -1
  65. package/package.json +2 -1
  66. package/pagination/index.es.js +2 -2
  67. package/pagination/index.umd.js +1 -1
  68. package/popover/index.es.js +153 -67
  69. package/popover/index.umd.js +15 -15
  70. package/popover/style.css +1 -1
  71. package/progress/index.es.js +2 -2
  72. package/progress/index.umd.js +2 -2
  73. package/radio/index.es.js +139 -143
  74. package/radio/index.umd.js +1 -1
  75. package/rate/index.es.js +16 -8
  76. package/rate/index.umd.js +1 -1
  77. package/result/index.es.js +108 -12
  78. package/result/index.umd.js +1 -1
  79. package/result/style.css +1 -1
  80. package/search/index.es.js +316 -60
  81. package/search/index.umd.js +16 -16
  82. package/search/style.css +1 -1
  83. package/select/index.es.js +7334 -574
  84. package/select/index.umd.js +27 -1
  85. package/select/style.css +1 -1
  86. package/skeleton/index.es.js +2 -2
  87. package/skeleton/index.umd.js +1 -1
  88. package/slider/index.es.js +2 -2
  89. package/slider/index.umd.js +1 -1
  90. package/splitter/index.es.js +178 -89
  91. package/splitter/index.umd.js +17 -17
  92. package/splitter/style.css +1 -1
  93. package/status/index.es.js +2 -2
  94. package/status/index.umd.js +1 -1
  95. package/style.css +1 -1
  96. package/switch/index.es.js +2 -2
  97. package/switch/index.umd.js +1 -1
  98. package/table/index.es.js +1301 -524
  99. package/table/index.umd.js +18 -18
  100. package/table/style.css +1 -1
  101. package/tabs/index.es.js +114 -72
  102. package/tabs/index.umd.js +1 -1
  103. package/tabs/style.css +1 -1
  104. package/tag/index.es.js +6 -7
  105. package/tag/index.umd.js +1 -1
  106. package/textarea/index.es.js +5545 -11
  107. package/textarea/index.umd.js +35 -1
  108. package/timeline/index.es.js +108 -12
  109. package/timeline/index.umd.js +1 -1
  110. package/timeline/style.css +1 -1
  111. package/tooltip/index.es.js +168 -79
  112. package/tooltip/index.umd.js +15 -15
  113. package/tooltip/style.css +1 -1
  114. package/tree/index.es.js +338 -227
  115. package/tree/index.umd.js +1 -1
  116. package/tree/style.css +1 -1
  117. package/upload/index.es.js +105 -32
  118. package/upload/index.umd.js +1 -1
  119. package/upload/style.css +1 -1
  120. package/vue-devui.es.js +3269 -1742
  121. package/vue-devui.umd.js +29 -23
  122. package/nuxt/components/FormControl.js +0 -3
  123. package/nuxt/components/FormLabel.js +0 -3
package/form/index.es.js CHANGED
@@ -29,7 +29,7 @@ var __objRest = (source, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
- import { defineComponent, watch, provide, reactive, toRefs, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, onUnmounted, ref, unref, nextTick, mergeProps, Fragment, inject, onBeforeUnmount } from "vue";
32
+ import { defineComponent, watch, provide, reactive, toRefs, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, onUnmounted, ref, unref, nextTick, mergeProps, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, createTextVNode, onBeforeUnmount } from "vue";
33
33
  import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
34
34
  const formProps = {
35
35
  data: {
@@ -79,8 +79,8 @@ function createBem(namespace, element, modifier) {
79
79
  }
80
80
  return cls;
81
81
  }
82
- function useNamespace(block) {
83
- const namespace = `devui-${block}`;
82
+ function useNamespace(block, needDot = false) {
83
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
84
84
  const b = () => createBem(namespace);
85
85
  const e = (element) => element ? createBem(namespace, element) : "";
86
86
  const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
@@ -844,7 +844,7 @@ var lodash = { exports: {} };
844
844
  function object4() {
845
845
  }
846
846
  return function(proto) {
847
- if (!isObject(proto)) {
847
+ if (!isObject2(proto)) {
848
848
  return {};
849
849
  }
850
850
  if (objectCreate) {
@@ -1206,7 +1206,7 @@ var lodash = { exports: {} };
1206
1206
  if (result2 !== undefined$1) {
1207
1207
  return result2;
1208
1208
  }
1209
- if (!isObject(value)) {
1209
+ if (!isObject2(value)) {
1210
1210
  return value;
1211
1211
  }
1212
1212
  var isArr = isArray(value);
@@ -1553,7 +1553,7 @@ var lodash = { exports: {} };
1553
1553
  return true;
1554
1554
  }
1555
1555
  function baseIsNative(value) {
1556
- if (!isObject(value) || isMasked(value)) {
1556
+ if (!isObject2(value) || isMasked(value)) {
1557
1557
  return false;
1558
1558
  }
1559
1559
  var pattern4 = isFunction(value) ? reIsNative : reIsHostCtor;
@@ -1593,7 +1593,7 @@ var lodash = { exports: {} };
1593
1593
  return result2;
1594
1594
  }
1595
1595
  function baseKeysIn(object4) {
1596
- if (!isObject(object4)) {
1596
+ if (!isObject2(object4)) {
1597
1597
  return nativeKeysIn(object4);
1598
1598
  }
1599
1599
  var isProto = isPrototype(object4), result2 = [];
@@ -1638,7 +1638,7 @@ var lodash = { exports: {} };
1638
1638
  }
1639
1639
  baseFor(source, function(srcValue, key) {
1640
1640
  stack || (stack = new Stack());
1641
- if (isObject(srcValue)) {
1641
+ if (isObject2(srcValue)) {
1642
1642
  baseMergeDeep(object4, source, key, srcIndex, baseMerge, customizer, stack);
1643
1643
  } else {
1644
1644
  var newValue = customizer ? customizer(safeGet(object4, key), srcValue, key + "", object4, source, stack) : undefined$1;
@@ -1678,7 +1678,7 @@ var lodash = { exports: {} };
1678
1678
  newValue = objValue;
1679
1679
  if (isArguments(objValue)) {
1680
1680
  newValue = toPlainObject(objValue);
1681
- } else if (!isObject(objValue) || isFunction(objValue)) {
1681
+ } else if (!isObject2(objValue) || isFunction(objValue)) {
1682
1682
  newValue = initCloneObject(srcValue);
1683
1683
  }
1684
1684
  } else {
@@ -1817,7 +1817,7 @@ var lodash = { exports: {} };
1817
1817
  return shuffleSelf(array4, baseClamp(n, 0, array4.length));
1818
1818
  }
1819
1819
  function baseSet(object4, path, value, customizer) {
1820
- if (!isObject(object4)) {
1820
+ if (!isObject2(object4)) {
1821
1821
  return object4;
1822
1822
  }
1823
1823
  path = castPath(path, object4);
@@ -1831,7 +1831,7 @@ var lodash = { exports: {} };
1831
1831
  var objValue = nested[key];
1832
1832
  newValue = customizer ? customizer(objValue, key, nested) : undefined$1;
1833
1833
  if (newValue === undefined$1) {
1834
- newValue = isObject(objValue) ? objValue : isIndex(path[index2 + 1]) ? [] : {};
1834
+ newValue = isObject2(objValue) ? objValue : isIndex(path[index2 + 1]) ? [] : {};
1835
1835
  }
1836
1836
  }
1837
1837
  assignValue(nested, key, newValue);
@@ -2281,7 +2281,7 @@ var lodash = { exports: {} };
2281
2281
  return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
2282
2282
  }
2283
2283
  var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
2284
- return isObject(result2) ? result2 : thisBinding;
2284
+ return isObject2(result2) ? result2 : thisBinding;
2285
2285
  };
2286
2286
  }
2287
2287
  function createCurry(func, bitmask, arity) {
@@ -2595,7 +2595,7 @@ var lodash = { exports: {} };
2595
2595
  return objValue;
2596
2596
  }
2597
2597
  function customDefaultsMerge(objValue, srcValue, key, object4, source, stack) {
2598
- if (isObject(objValue) && isObject(srcValue)) {
2598
+ if (isObject2(objValue) && isObject2(srcValue)) {
2599
2599
  stack.set(srcValue, objValue);
2600
2600
  baseMerge(objValue, srcValue, undefined$1, customDefaultsMerge, stack);
2601
2601
  stack["delete"](srcValue);
@@ -2943,7 +2943,7 @@ var lodash = { exports: {} };
2943
2943
  return !!length && (type4 == "number" || type4 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
2944
2944
  }
2945
2945
  function isIterateeCall(value, index2, object4) {
2946
- if (!isObject(object4)) {
2946
+ if (!isObject2(object4)) {
2947
2947
  return false;
2948
2948
  }
2949
2949
  var type4 = typeof index2;
@@ -2986,7 +2986,7 @@ var lodash = { exports: {} };
2986
2986
  return value === proto;
2987
2987
  }
2988
2988
  function isStrictComparable(value) {
2989
- return value === value && !isObject(value);
2989
+ return value === value && !isObject2(value);
2990
2990
  }
2991
2991
  function matchesStrictComparable(key, srcValue) {
2992
2992
  return function(object4) {
@@ -3868,7 +3868,7 @@ var lodash = { exports: {} };
3868
3868
  throw new TypeError2(FUNC_ERROR_TEXT);
3869
3869
  }
3870
3870
  wait = toNumber(wait) || 0;
3871
- if (isObject(options)) {
3871
+ if (isObject2(options)) {
3872
3872
  leading = !!options.leading;
3873
3873
  maxing = "maxWait" in options;
3874
3874
  maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
@@ -4038,7 +4038,7 @@ var lodash = { exports: {} };
4038
4038
  if (typeof func != "function") {
4039
4039
  throw new TypeError2(FUNC_ERROR_TEXT);
4040
4040
  }
4041
- if (isObject(options)) {
4041
+ if (isObject2(options)) {
4042
4042
  leading = "leading" in options ? !!options.leading : leading;
4043
4043
  trailing = "trailing" in options ? !!options.trailing : trailing;
4044
4044
  }
@@ -4146,7 +4146,7 @@ var lodash = { exports: {} };
4146
4146
  return typeof value == "number" && nativeIsFinite(value);
4147
4147
  }
4148
4148
  function isFunction(value) {
4149
- if (!isObject(value)) {
4149
+ if (!isObject2(value)) {
4150
4150
  return false;
4151
4151
  }
4152
4152
  var tag = baseGetTag(value);
@@ -4158,7 +4158,7 @@ var lodash = { exports: {} };
4158
4158
  function isLength(value) {
4159
4159
  return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
4160
4160
  }
4161
- function isObject(value) {
4161
+ function isObject2(value) {
4162
4162
  var type4 = typeof value;
4163
4163
  return value != null && (type4 == "object" || type4 == "function");
4164
4164
  }
@@ -4265,9 +4265,9 @@ var lodash = { exports: {} };
4265
4265
  if (isSymbol(value)) {
4266
4266
  return NAN;
4267
4267
  }
4268
- if (isObject(value)) {
4268
+ if (isObject2(value)) {
4269
4269
  var other = typeof value.valueOf == "function" ? value.valueOf() : value;
4270
- value = isObject(other) ? other + "" : other;
4270
+ value = isObject2(other) ? other + "" : other;
4271
4271
  }
4272
4272
  if (typeof value != "string") {
4273
4273
  return value === 0 ? value : +value;
@@ -4488,7 +4488,7 @@ var lodash = { exports: {} };
4488
4488
  var Ctor = object4 && object4.constructor;
4489
4489
  if (isArrLike) {
4490
4490
  accumulator = isArr ? new Ctor() : [];
4491
- } else if (isObject(object4)) {
4491
+ } else if (isObject2(object4)) {
4492
4492
  accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object4)) : {};
4493
4493
  } else {
4494
4494
  accumulator = {};
@@ -4770,7 +4770,7 @@ var lodash = { exports: {} };
4770
4770
  }
4771
4771
  function truncate(string3, options) {
4772
4772
  var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
4773
- if (isObject(options)) {
4773
+ if (isObject2(options)) {
4774
4774
  var separator = "separator" in options ? options.separator : separator;
4775
4775
  length = "length" in options ? toInteger(options.length) : length;
4776
4776
  omission = "omission" in options ? baseToString(options.omission) : omission;
@@ -4900,13 +4900,13 @@ var lodash = { exports: {} };
4900
4900
  });
4901
4901
  function mixin(object4, source, options) {
4902
4902
  var props = keys(source), methodNames = baseFunctions(source, props);
4903
- if (options == null && !(isObject(source) && (methodNames.length || !props.length))) {
4903
+ if (options == null && !(isObject2(source) && (methodNames.length || !props.length))) {
4904
4904
  options = source;
4905
4905
  source = object4;
4906
4906
  object4 = this;
4907
4907
  methodNames = baseFunctions(source, keys(source));
4908
4908
  }
4909
- var chain2 = !(isObject(options) && "chain" in options) || !!options.chain, isFunc = isFunction(object4);
4909
+ var chain2 = !(isObject2(options) && "chain" in options) || !!options.chain, isFunc = isFunction(object4);
4910
4910
  arrayEach(methodNames, function(methodName) {
4911
4911
  var func = source[methodName];
4912
4912
  object4[methodName] = func;
@@ -5252,7 +5252,7 @@ var lodash = { exports: {} };
5252
5252
  lodash2.isNil = isNil;
5253
5253
  lodash2.isNull = isNull;
5254
5254
  lodash2.isNumber = isNumber;
5255
- lodash2.isObject = isObject;
5255
+ lodash2.isObject = isObject2;
5256
5256
  lodash2.isObjectLike = isObjectLike;
5257
5257
  lodash2.isPlainObject = isPlainObject;
5258
5258
  lodash2.isRegExp = isRegExp;
@@ -5613,6 +5613,45 @@ var Form = defineComponent({
5613
5613
  };
5614
5614
  }
5615
5615
  });
5616
+ const formItemProps = {
5617
+ label: {
5618
+ type: String
5619
+ },
5620
+ field: {
5621
+ type: String,
5622
+ default: ""
5623
+ },
5624
+ required: {
5625
+ type: Boolean,
5626
+ default: false
5627
+ },
5628
+ messageType: {
5629
+ type: String
5630
+ },
5631
+ popPosition: {
5632
+ type: Array
5633
+ },
5634
+ rules: {
5635
+ type: [Object, Array]
5636
+ },
5637
+ showFeedback: {
5638
+ type: Boolean,
5639
+ default: void 0
5640
+ },
5641
+ helpTips: {
5642
+ type: String,
5643
+ default: ""
5644
+ },
5645
+ feedbackStatus: {
5646
+ type: String
5647
+ },
5648
+ extraInfo: {
5649
+ type: String,
5650
+ default: ""
5651
+ }
5652
+ };
5653
+ const FORM_ITEM_TOKEN = Symbol("dFormItem");
5654
+ const LABEL_DATA = Symbol("labelData");
5616
5655
  const formLabelProps = {
5617
5656
  helpTips: {
5618
5657
  type: String,
@@ -5911,6 +5950,62 @@ const FlexibleOverlay = defineComponent({
5911
5950
  };
5912
5951
  }
5913
5952
  });
5953
+ const POPPER_TRIGGER_TOKEN = Symbol("popper-trigger");
5954
+ const isObject = (val) => val !== null && typeof val === "object";
5955
+ const ns$1 = useNamespace("popper-trigger");
5956
+ function wrapContent(content) {
5957
+ return h("span", { class: ns$1.b() }, content);
5958
+ }
5959
+ function getFirstValidChild(nodes) {
5960
+ for (const child of nodes) {
5961
+ if (isObject(child)) {
5962
+ if (child.type === Comment) {
5963
+ continue;
5964
+ }
5965
+ if (child.type === "svg" || child.type === Text) {
5966
+ return wrapContent(child);
5967
+ }
5968
+ if (child.type === Fragment) {
5969
+ return getFirstValidChild(child.children);
5970
+ }
5971
+ return child;
5972
+ }
5973
+ return wrapContent(child);
5974
+ }
5975
+ return null;
5976
+ }
5977
+ var PopperTrigger = defineComponent({
5978
+ name: "DPopperTrigger",
5979
+ setup(_, ctx) {
5980
+ const {
5981
+ slots,
5982
+ attrs
5983
+ } = ctx;
5984
+ return () => {
5985
+ var _a;
5986
+ const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots, attrs);
5987
+ const triggerRef = inject(POPPER_TRIGGER_TOKEN);
5988
+ if (!defaultSlot) {
5989
+ return null;
5990
+ }
5991
+ const firstValidChild = getFirstValidChild(defaultSlot);
5992
+ if (!firstValidChild) {
5993
+ return null;
5994
+ }
5995
+ return withDirectives(cloneVNode(firstValidChild, attrs), [[{
5996
+ mounted(el) {
5997
+ triggerRef.value = el;
5998
+ },
5999
+ updated(el) {
6000
+ triggerRef.value = el;
6001
+ },
6002
+ unmounted() {
6003
+ triggerRef.value = null;
6004
+ }
6005
+ }]]);
6006
+ };
6007
+ }
6008
+ });
5914
6009
  const popoverProps = {
5915
6010
  isOpen: {
5916
6011
  type: Boolean,
@@ -5951,6 +6046,10 @@ const popoverProps = {
5951
6046
  mouseLeaveDelay: {
5952
6047
  type: Number,
5953
6048
  default: 100
6049
+ },
6050
+ disabled: {
6051
+ type: Boolean,
6052
+ default: false
5954
6053
  }
5955
6054
  };
5956
6055
  const TransformOriginMap = {
@@ -5987,11 +6086,16 @@ function usePopover(props, visible, placement, origin, popoverRef) {
5987
6086
  return { overlayStyles };
5988
6087
  }
5989
6088
  function usePopoverEvent(props, visible, origin) {
5990
- const { trigger, position, mouseEnterDelay, mouseLeaveDelay } = toRefs(props);
6089
+ const { trigger, position, mouseEnterDelay, mouseLeaveDelay, disabled } = toRefs(props);
5991
6090
  const isClick = computed(() => trigger.value === "click");
5992
6091
  const placement = ref(position.value[0].split("-")[0]);
5993
6092
  const isEnter = ref(false);
5994
- const onClick = () => isClick.value && (visible.value = !visible.value);
6093
+ const onClick = () => {
6094
+ if (disabled.value) {
6095
+ return;
6096
+ }
6097
+ isClick.value && (visible.value = !visible.value);
6098
+ };
5995
6099
  const enter = lodash.exports.debounce(() => {
5996
6100
  isEnter.value && (visible.value = true);
5997
6101
  }, mouseEnterDelay.value);
@@ -5999,6 +6103,9 @@ function usePopoverEvent(props, visible, origin) {
5999
6103
  !isEnter.value && (visible.value = false);
6000
6104
  }, mouseLeaveDelay.value);
6001
6105
  const onMouseenter = () => {
6106
+ if (disabled.value) {
6107
+ return;
6108
+ }
6002
6109
  if (!isClick.value) {
6003
6110
  isEnter.value = true;
6004
6111
  enter();
@@ -6010,6 +6117,15 @@ function usePopoverEvent(props, visible, origin) {
6010
6117
  leave();
6011
6118
  }
6012
6119
  };
6120
+ const quickLeave = () => {
6121
+ isEnter.value = false;
6122
+ visible.value = false;
6123
+ };
6124
+ watch(disabled, (newVal) => {
6125
+ if (newVal && visible.value) {
6126
+ quickLeave();
6127
+ }
6128
+ });
6013
6129
  const handlePositionChange = (pos) => {
6014
6130
  placement.value = pos.split("-")[0];
6015
6131
  };
@@ -6128,9 +6244,11 @@ var Popover = defineComponent({
6128
6244
  name: "DPopover",
6129
6245
  inheritAttrs: false,
6130
6246
  props: popoverProps,
6247
+ emits: ["show", "hide"],
6131
6248
  setup(props, {
6132
6249
  slots,
6133
- attrs
6250
+ attrs,
6251
+ emit
6134
6252
  }) {
6135
6253
  const {
6136
6254
  content,
@@ -6153,44 +6271,51 @@ var Popover = defineComponent({
6153
6271
  overlayStyles
6154
6272
  } = usePopover(props, visible, placement, origin, popoverRef);
6155
6273
  const ns2 = useNamespace("popover");
6156
- return () => {
6157
- var _a;
6158
- return createVNode(Fragment, null, [createVNode("div", {
6159
- "ref": origin,
6160
- "class": ns2.e("reference")
6161
- }, [(_a = slots.reference) == null ? void 0 : _a.call(slots)]), createVNode(Teleport, {
6162
- "to": "body"
6274
+ provide(POPPER_TRIGGER_TOKEN, origin);
6275
+ watch(visible, (newVal) => {
6276
+ if (newVal) {
6277
+ emit("show");
6278
+ } else {
6279
+ emit("hide");
6280
+ }
6281
+ });
6282
+ return () => createVNode(Fragment, null, [createVNode(PopperTrigger, null, {
6283
+ default: () => {
6284
+ var _a;
6285
+ return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
6286
+ }
6287
+ }), createVNode(Teleport, {
6288
+ "to": "body"
6289
+ }, {
6290
+ default: () => [createVNode(Transition, {
6291
+ "name": showAnimation.value ? ns2.m(`fade-${placement.value}`) : ""
6163
6292
  }, {
6164
- default: () => [createVNode(Transition, {
6165
- "name": showAnimation.value ? ns2.m(`fade-${placement.value}`) : ""
6166
- }, {
6167
- default: () => [createVNode(FlexibleOverlay, mergeProps({
6168
- "modelValue": visible.value,
6169
- "onUpdate:modelValue": ($event) => visible.value = $event,
6170
- "ref": popoverRef,
6171
- "origin": origin.value,
6172
- "position": position.value,
6173
- "align": align.value,
6174
- "offset": offset2.value,
6175
- "class": [ns2.e("content"), popType.value !== "default" ? "is-icon" : ""],
6176
- "show-arrow": true,
6177
- "is-arrow-center": false,
6178
- "style": overlayStyles.value
6179
- }, attrs, {
6180
- "onPositionChange": handlePositionChange,
6181
- "onMouseenter": onMouseenter,
6182
- "onMouseleave": onMouseleave
6183
- }), {
6184
- default: () => {
6185
- var _a2;
6186
- return [createVNode(PopoverIcon, {
6187
- "type": popType.value
6188
- }, null), ((_a2 = slots.content) == null ? void 0 : _a2.call(slots)) || createVNode("span", null, [content.value])];
6189
- }
6190
- })]
6293
+ default: () => [createVNode(FlexibleOverlay, mergeProps({
6294
+ "modelValue": visible.value,
6295
+ "onUpdate:modelValue": ($event) => visible.value = $event,
6296
+ "ref": popoverRef,
6297
+ "origin": origin.value,
6298
+ "position": position.value,
6299
+ "align": align.value,
6300
+ "offset": offset2.value,
6301
+ "class": [ns2.e("content"), popType.value !== "default" ? "is-icon" : ""],
6302
+ "show-arrow": true,
6303
+ "is-arrow-center": false,
6304
+ "style": overlayStyles.value
6305
+ }, attrs, {
6306
+ "onPositionChange": handlePositionChange,
6307
+ "onMouseenter": onMouseenter,
6308
+ "onMouseleave": onMouseleave
6309
+ }), {
6310
+ default: () => {
6311
+ var _a;
6312
+ return [createVNode(PopoverIcon, {
6313
+ "type": popType.value
6314
+ }, null), ((_a = slots.content) == null ? void 0 : _a.call(slots)) || createVNode("span", null, [content.value])];
6315
+ }
6191
6316
  })]
6192
- })]);
6193
- };
6317
+ })]
6318
+ })]);
6194
6319
  }
6195
6320
  });
6196
6321
  function HelpTipsIcon() {
@@ -6264,39 +6389,15 @@ function PendingIcon() {
6264
6389
  "fill-rule": "nonzero"
6265
6390
  }, null)])]);
6266
6391
  }
6267
- const formItemProps = {
6268
- field: {
6269
- type: String,
6270
- default: ""
6271
- },
6272
- required: {
6273
- type: Boolean,
6274
- default: false
6275
- },
6276
- messageType: {
6277
- type: String
6278
- },
6279
- popPosition: {
6280
- type: Array
6281
- },
6282
- rules: {
6283
- type: [Object, Array]
6284
- },
6285
- showFeedback: {
6286
- type: Boolean,
6287
- default: void 0
6288
- }
6289
- };
6290
- const FORM_ITEM_TOKEN = Symbol("dFormItem");
6291
6392
  function useFormLabel() {
6292
- const formContext = inject(FORM_TOKEN);
6293
6393
  const formItemContext = inject(FORM_ITEM_TOKEN);
6394
+ const labelData = inject(LABEL_DATA);
6294
6395
  const ns2 = useNamespace("form");
6295
6396
  const labelClasses = computed(() => ({
6296
6397
  [`${ns2.e("label")}`]: true,
6297
- [`${ns2.em("label", "vertical")}`]: formContext.layout === "vertical",
6298
- [`${ns2.em("label", formContext.labelSize)}`]: formContext.layout === "horizontal",
6299
- [`${ns2.em("label", formContext.labelAlign)}`]: formContext.layout === "horizontal"
6398
+ [`${ns2.em("label", "vertical")}`]: labelData.value.layout === "vertical",
6399
+ [`${ns2.em("label", labelData.value.labelSize)}`]: labelData.value.layout === "horizontal",
6400
+ [`${ns2.em("label", labelData.value.labelAlign)}`]: labelData.value.layout === "horizontal"
6300
6401
  }));
6301
6402
  const labelInnerClasses = computed(() => ({
6302
6403
  [`${ns2.e("label-span")}`]: true,
@@ -6326,13 +6427,96 @@ var FormLabel = defineComponent({
6326
6427
  "trigger": "hover",
6327
6428
  "pop-type": "info"
6328
6429
  }, {
6329
- reference: () => createVNode(HelpTipsIcon, {
6430
+ default: () => [createVNode(HelpTipsIcon, {
6330
6431
  "class": ns2.e("label-help")
6331
- }, null)
6432
+ }, null), createTextVNode(",")]
6332
6433
  })]);
6333
6434
  };
6334
6435
  }
6335
6436
  });
6437
+ const formControlProps = {
6438
+ feedbackStatus: {
6439
+ type: String
6440
+ },
6441
+ extraInfo: {
6442
+ type: String,
6443
+ default: ""
6444
+ }
6445
+ };
6446
+ function useFormControl(props) {
6447
+ const labelData = inject(LABEL_DATA);
6448
+ const ns2 = useNamespace("form");
6449
+ const { feedbackStatus } = toRefs(props);
6450
+ const controlClasses = computed(() => ({
6451
+ [ns2.e("control")]: true,
6452
+ [ns2.em("control", "horizontal")]: labelData.value.layout === "horizontal"
6453
+ }));
6454
+ const controlContainerClasses = computed(() => ({
6455
+ [ns2.e("control-container")]: true,
6456
+ [ns2.em("control-container", "horizontal")]: labelData.value.layout === "horizontal",
6457
+ [ns2.em("control-container", "has-feedback")]: Boolean(feedbackStatus == null ? void 0 : feedbackStatus.value),
6458
+ [ns2.em("control-container", "feedback-error")]: Boolean((feedbackStatus == null ? void 0 : feedbackStatus.value) === "error")
6459
+ }));
6460
+ return { controlClasses, controlContainerClasses };
6461
+ }
6462
+ function useFormControlValidate() {
6463
+ const formItemContext = inject(FORM_ITEM_TOKEN);
6464
+ const feedbackStatus = computed(() => formItemContext.validateState);
6465
+ const showFeedback = computed(() => formItemContext.showFeedback && Boolean(formItemContext.validateState));
6466
+ const showPopover = computed(() => formItemContext.messageType === "popover" && formItemContext.validateState === "error");
6467
+ const showMessage = computed(() => formItemContext.messageType === "text" && formItemContext.validateState === "error");
6468
+ const errorMessage = computed(() => formItemContext.validateMessage);
6469
+ const popPosition = computed(() => formItemContext.popPosition);
6470
+ return { feedbackStatus, showFeedback, showPopover, showMessage, errorMessage, popPosition };
6471
+ }
6472
+ var formControl = "";
6473
+ var FormControl = defineComponent({
6474
+ name: "DFormControl",
6475
+ props: formControlProps,
6476
+ setup(props, ctx) {
6477
+ const formControl2 = ref();
6478
+ const ns2 = useNamespace("form");
6479
+ const {
6480
+ controlClasses,
6481
+ controlContainerClasses
6482
+ } = useFormControl(props);
6483
+ const {
6484
+ feedbackStatus,
6485
+ showFeedback,
6486
+ showPopover,
6487
+ showMessage,
6488
+ errorMessage,
6489
+ popPosition
6490
+ } = useFormControlValidate();
6491
+ return () => createVNode("div", {
6492
+ "class": controlClasses.value,
6493
+ "ref": formControl2
6494
+ }, [createVNode("div", {
6495
+ "class": controlContainerClasses.value
6496
+ }, [createVNode(Popover, {
6497
+ "is-open": showPopover.value,
6498
+ "trigger": "manually",
6499
+ "content": errorMessage.value,
6500
+ "pop-type": "error",
6501
+ "position": popPosition.value
6502
+ }, {
6503
+ default: () => {
6504
+ var _a, _b;
6505
+ return [createVNode("div", {
6506
+ "class": ns2.e("control-content")
6507
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), createTextVNode(",")];
6508
+ }
6509
+ }), showFeedback.value && createVNode("span", {
6510
+ "class": [ns2.e("feedback-icon"), ns2.em("feedback-icon", feedbackStatus.value)]
6511
+ }, [feedbackStatus.value === "error" && createVNode(ErrorIcon, null, null), feedbackStatus.value === "success" && createVNode(SuccessIcon, null, null), feedbackStatus.value === "pending" && createVNode(PendingIcon, null, null)])]), createVNode("div", {
6512
+ "class": ns2.e("control-info")
6513
+ }, [showMessage.value && createVNode("div", {
6514
+ "class": "error-message"
6515
+ }, [errorMessage.value]), props.extraInfo && createVNode("div", {
6516
+ "class": ns2.e("control-extra")
6517
+ }, [props.extraInfo])])]);
6518
+ }
6519
+ });
6336
6520
  function _extends() {
6337
6521
  _extends = Object.assign || function(target) {
6338
6522
  for (var i = 1; i < arguments.length; i++) {
@@ -7477,6 +7661,12 @@ var FormItem = defineComponent({
7477
7661
  "popPosition",
7478
7662
  "showFeedback"
7479
7663
  ]);
7664
+ const {
7665
+ label,
7666
+ helpTips,
7667
+ feedbackStatus,
7668
+ extraInfo
7669
+ } = toRefs(props);
7480
7670
  const showFeedback = computed(() => (itemShowFeedback == null ? void 0 : itemShowFeedback.value) !== void 0 ? itemShowFeedback.value : formContext.showFeedback);
7481
7671
  const messageType = computed(() => (itemMessageType == null ? void 0 : itemMessageType.value) || formContext.messageType);
7482
7672
  const popPosition = computed(() => (itemPopPosition == null ? void 0 : itemPopPosition.value) || formContext.popPosition);
@@ -7494,6 +7684,12 @@ var FormItem = defineComponent({
7494
7684
  itemClasses,
7495
7685
  isRequired
7496
7686
  } = useFormItem(messageType, _rules, validateState);
7687
+ const labelData = computed(() => ({
7688
+ layout: formContext.layout,
7689
+ labelSize: formContext.labelSize,
7690
+ labelAlign: formContext.labelAlign
7691
+ }));
7692
+ provide(LABEL_DATA, labelData);
7497
7693
  const context = reactive(__spreadProps(__spreadValues({}, otherProps), {
7498
7694
  showFeedback,
7499
7695
  messageType,
@@ -7518,95 +7714,21 @@ var FormItem = defineComponent({
7518
7714
  onBeforeUnmount(() => {
7519
7715
  formContext == null ? void 0 : formContext.removeItemContext(context);
7520
7716
  });
7521
- return () => {
7522
- var _a2, _b;
7523
- return createVNode("div", {
7524
- "class": itemClasses.value
7525
- }, [(_b = (_a2 = ctx.slots).default) == null ? void 0 : _b.call(_a2)]);
7526
- };
7527
- }
7528
- });
7529
- const formControlProps = {
7530
- feedbackStatus: {
7531
- type: String
7532
- },
7533
- extraInfo: {
7534
- type: String,
7535
- default: ""
7536
- }
7537
- };
7538
- function useFormControl(props) {
7539
- const formContext = inject(FORM_TOKEN);
7540
- const ns2 = useNamespace("form");
7541
- const { feedbackStatus } = toRefs(props);
7542
- const controlClasses = computed(() => ({
7543
- [ns2.e("control")]: true,
7544
- [ns2.em("control", "horizontal")]: formContext.layout === "horizontal"
7545
- }));
7546
- const controlContainerClasses = computed(() => ({
7547
- [ns2.e("control-container")]: true,
7548
- [ns2.em("control-container", "horizontal")]: formContext.layout === "horizontal",
7549
- [ns2.em("control-container", "has-feedback")]: Boolean(feedbackStatus == null ? void 0 : feedbackStatus.value),
7550
- [ns2.em("control-container", "feedback-error")]: Boolean((feedbackStatus == null ? void 0 : feedbackStatus.value) === "error")
7551
- }));
7552
- return { controlClasses, controlContainerClasses };
7553
- }
7554
- function useFormControlValidate() {
7555
- const formItemContext = inject(FORM_ITEM_TOKEN);
7556
- const feedbackStatus = computed(() => formItemContext.validateState);
7557
- const showFeedback = computed(() => formItemContext.showFeedback && Boolean(formItemContext.validateState));
7558
- const showPopover = computed(() => formItemContext.messageType === "popover" && formItemContext.validateState === "error");
7559
- const showMessage = computed(() => formItemContext.messageType === "text" && formItemContext.validateState === "error");
7560
- const errorMessage = computed(() => formItemContext.validateMessage);
7561
- const popPosition = computed(() => formItemContext.popPosition);
7562
- return { feedbackStatus, showFeedback, showPopover, showMessage, errorMessage, popPosition };
7563
- }
7564
- var formControl = "";
7565
- var FormControl = defineComponent({
7566
- name: "DFormControl",
7567
- props: formControlProps,
7568
- setup(props, ctx) {
7569
- const formControl2 = ref();
7570
- const ns2 = useNamespace("form");
7571
- const {
7572
- controlClasses,
7573
- controlContainerClasses
7574
- } = useFormControl(props);
7575
- const {
7576
- feedbackStatus,
7577
- showFeedback,
7578
- showPopover,
7579
- showMessage,
7580
- errorMessage,
7581
- popPosition
7582
- } = useFormControlValidate();
7583
7717
  return () => createVNode("div", {
7584
- "class": controlClasses.value,
7585
- "ref": formControl2
7586
- }, [createVNode("div", {
7587
- "class": controlContainerClasses.value
7588
- }, [createVNode(Popover, {
7589
- "is-open": showPopover.value,
7590
- "trigger": "manually",
7591
- "content": errorMessage.value,
7592
- "pop-type": "error",
7593
- "position": popPosition.value
7718
+ "class": itemClasses.value
7719
+ }, [createVNode(FormLabel, {
7720
+ "help-tips": helpTips.value
7594
7721
  }, {
7595
- reference: () => {
7596
- var _a, _b;
7597
- return createVNode("div", {
7598
- "class": ns2.e("control-content")
7599
- }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
7722
+ default: () => [label == null ? void 0 : label.value]
7723
+ }), createVNode(FormControl, {
7724
+ "feedback-status": feedbackStatus == null ? void 0 : feedbackStatus.value,
7725
+ "extra-info": extraInfo.value
7726
+ }, {
7727
+ default: () => {
7728
+ var _a2, _b;
7729
+ return [(_b = (_a2 = ctx.slots).default) == null ? void 0 : _b.call(_a2)];
7600
7730
  }
7601
- }), showFeedback.value && createVNode("span", {
7602
- "class": [ns2.e("feedback-icon"), ns2.em("feedback-icon", feedbackStatus.value)]
7603
- }, [feedbackStatus.value === "error" && createVNode(ErrorIcon, null, null), feedbackStatus.value === "success" && createVNode(SuccessIcon, null, null), feedbackStatus.value === "pending" && createVNode(PendingIcon, null, null)])]), createVNode("div", {
7604
- "class": ns2.e("control-info")
7605
- }, [showMessage.value && createVNode("div", {
7606
- "class": "error-message"
7607
- }, [errorMessage.value]), props.extraInfo && createVNode("div", {
7608
- "class": ns2.e("control-extra")
7609
- }, [props.extraInfo])])]);
7731
+ })]);
7610
7732
  }
7611
7733
  });
7612
7734
  var formOperation = "";
@@ -7637,10 +7759,8 @@ var index = {
7637
7759
  status: "75%",
7638
7760
  install(app) {
7639
7761
  app.component(Form.name, Form);
7640
- app.component(FormLabel.name, FormLabel);
7641
7762
  app.component(FormItem.name, FormItem);
7642
- app.component(FormControl.name, FormControl);
7643
7763
  app.component(FormOperation.name, FormOperation);
7644
7764
  }
7645
7765
  };
7646
- export { FORM_ITEM_TOKEN, FORM_TOKEN, Form, FormControl, FormItem, FormLabel, FormOperation, index as default, formControlProps, formItemProps, formProps };
7766
+ export { FORM_ITEM_TOKEN, FORM_TOKEN, Form, FormItem, FormOperation, LABEL_DATA, index as default, formControlProps, formItemProps, formProps };