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

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 (125) hide show
  1. package/README.md +3 -0
  2. package/alert/index.es.js +37 -11
  3. package/alert/index.umd.js +1 -1
  4. package/alert/style.css +1 -1
  5. package/auto-complete/index.es.js +62 -26
  6. package/auto-complete/index.umd.js +5 -5
  7. package/auto-complete/style.css +1 -1
  8. package/avatar/index.es.js +32 -6
  9. package/avatar/index.umd.js +1 -1
  10. package/avatar/style.css +1 -1
  11. package/badge/index.es.js +27 -3
  12. package/badge/index.umd.js +1 -1
  13. package/badge/style.css +1 -1
  14. package/button/index.es.js +5548 -77
  15. package/button/index.umd.js +27 -1
  16. package/button/style.css +1 -1
  17. package/card/index.es.js +34 -13
  18. package/card/index.umd.js +1 -1
  19. package/card/style.css +1 -1
  20. package/checkbox/index.es.js +47 -29
  21. package/checkbox/index.umd.js +1 -1
  22. package/checkbox/style.css +1 -1
  23. package/date-picker/index.es.js +90 -138
  24. package/date-picker/index.umd.js +1 -1
  25. package/date-picker/style.css +1 -1
  26. package/drawer/index.es.js +28 -3
  27. package/drawer/index.umd.js +1 -1
  28. package/drawer/style.css +1 -1
  29. package/dropdown/index.es.js +36 -12
  30. package/dropdown/index.umd.js +1 -1
  31. package/dropdown/style.css +1 -1
  32. package/form/index.es.js +208 -73
  33. package/form/index.umd.js +12 -12
  34. package/form/style.css +1 -1
  35. package/fullscreen/index.es.js +28 -4
  36. package/fullscreen/index.umd.js +1 -1
  37. package/fullscreen/style.css +1 -1
  38. package/grid/index.es.js +68 -49
  39. package/grid/index.umd.js +1 -1
  40. package/grid/style.css +1 -1
  41. package/image-preview/index.es.js +34 -11
  42. package/image-preview/index.umd.js +1 -1
  43. package/image-preview/style.css +1 -1
  44. package/input/index.es.js +90 -138
  45. package/input/index.umd.js +1 -1
  46. package/input/style.css +1 -1
  47. package/layout/index.es.js +34 -6
  48. package/layout/index.umd.js +1 -1
  49. package/layout/style.css +1 -1
  50. package/loading/index.es.js +34 -10
  51. package/loading/index.umd.js +1 -1
  52. package/loading/style.css +1 -1
  53. package/modal/index.es.js +41 -15
  54. package/modal/index.umd.js +1 -1
  55. package/modal/style.css +1 -1
  56. package/notification/index.es.js +40 -13
  57. package/notification/index.umd.js +1 -1
  58. package/notification/style.css +1 -1
  59. package/nuxt/components/ButtonGroup.js +3 -0
  60. package/nuxt/components/buttonGroupInjectionKey.js +3 -0
  61. package/nuxt/components/buttonGroupProps.js +3 -0
  62. package/overlay/index.es.js +31 -9
  63. package/overlay/index.umd.js +1 -1
  64. package/overlay/style.css +1 -1
  65. package/package.json +1 -1
  66. package/pagination/index.es.js +59 -32
  67. package/pagination/index.umd.js +1 -1
  68. package/pagination/style.css +1 -1
  69. package/popover/index.es.js +53 -24
  70. package/popover/index.umd.js +13 -13
  71. package/popover/style.css +1 -1
  72. package/progress/index.es.js +31 -9
  73. package/progress/index.umd.js +3 -3
  74. package/progress/style.css +1 -1
  75. package/radio/index.es.js +32 -7
  76. package/radio/index.umd.js +1 -1
  77. package/radio/style.css +1 -1
  78. package/rate/index.es.js +32 -8
  79. package/rate/index.umd.js +1 -1
  80. package/rate/style.css +1 -1
  81. package/search/index.es.js +100 -146
  82. package/search/index.umd.js +13 -13
  83. package/search/style.css +1 -1
  84. package/select/index.es.js +74 -51
  85. package/select/index.umd.js +1 -1
  86. package/select/style.css +1 -1
  87. package/skeleton/index.es.js +37 -12
  88. package/skeleton/index.umd.js +1 -1
  89. package/skeleton/style.css +1 -1
  90. package/slider/index.es.js +34 -10
  91. package/slider/index.umd.js +1 -1
  92. package/slider/style.css +1 -1
  93. package/splitter/index.es.js +52 -24
  94. package/splitter/index.umd.js +15 -15
  95. package/splitter/style.css +1 -1
  96. package/status/index.es.js +26 -2
  97. package/status/index.umd.js +1 -1
  98. package/status/style.css +1 -1
  99. package/style.css +1 -1
  100. package/switch/index.es.js +30 -6
  101. package/switch/index.umd.js +1 -1
  102. package/switch/style.css +1 -1
  103. package/table/index.es.js +5710 -265
  104. package/table/index.umd.js +27 -1
  105. package/table/style.css +1 -1
  106. package/tabs/index.es.js +32 -8
  107. package/tabs/index.umd.js +1 -1
  108. package/tabs/style.css +1 -1
  109. package/tag/index.es.js +27 -2
  110. package/tag/index.umd.js +1 -1
  111. package/tag/style.css +1 -1
  112. package/textarea/index.es.js +93 -76
  113. package/textarea/index.umd.js +1 -1
  114. package/textarea/style.css +1 -1
  115. package/tooltip/index.es.js +41 -14
  116. package/tooltip/index.umd.js +12 -12
  117. package/tooltip/style.css +1 -1
  118. package/tree/index.es.js +60 -51
  119. package/tree/index.umd.js +1 -1
  120. package/tree/style.css +1 -1
  121. package/upload/index.es.js +53 -22
  122. package/upload/index.umd.js +1 -1
  123. package/upload/style.css +1 -1
  124. package/vue-devui.es.js +3703 -3560
  125. package/vue-devui.umd.js +20 -20
@@ -1 +1 @@
1
- @keyframes d-overlay-fade{0%{opacity:0}to{opacity:1}}.devui-overlay-fade-enter{opacity:0}.devui-overlay-fade-enter-active{animation-name:d-overlay-fade;animation-duration:.3s}.devui-overlay-fade-leave{opacity:1}.devui-overlay-fade-leave-active{animation-name:d-overlay-fade;animation-duration:.3s;animation-direction:reverse}.devui-overlay-background{position:fixed;top:0;left:0;height:100vh;width:100vw;display:flex}.devui-overlay-background__color{background:rgba(0,0,0,.4)}.devui-overlay-background .devui-overlay{position:relative;z-index:1000;pointer-events:auto}.devui-overlay-background__disabled{pointer-events:none}.devui-flexible-overlay{position:fixed;border-radius:var(--devui-border-radius, 2px);background-color:var(--devui-connected-overlay-bg, #ffffff);box-shadow:var(--devui-shadow-connected-overlay, 0 2px 8px 0) var(--devui-shadow, rgba(37, 43, 58, .2));z-index:1000}.devui-flexible-overlay-arrow{position:absolute;width:8px;height:8px;transform:rotate(45deg);background-color:inherit}.devui-dropdown-toggle{display:inline-block}.devui-dropdown span.icon-chevron-down,.devui-dropdown span.icon-select-arrow{display:inline-block;vertical-align:text-top}.devui-dropdown-menu-wrap .devui-dropdown-menu{width:100%}.devui-dropdown-animation span.icon-chevron-down,.devui-dropdown-animation span.icon-select-arrow{transition:transform var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1))}.devui-dropdown.open span.icon-chevron-down,.devui-dropdown.open span.icon-select-arrow{transform:rotate(180deg)}.fade-in-top{animation:fadeInTop .2s cubic-bezier(.16,.75,.5,1)}.fade-in-bottom{animation:fadeInBottom .2s cubic-bezier(.16,.75,.5,1)}@keyframes fadeInTop{0%{opacity:.8;transform:scaleY(.8) translateY(4px)}to{opacity:1;transform:scaleY(.9999) translateY(0)}}@keyframes fadeInBottom{0%{opacity:.8;transform:scaleY(.8) translateY(-4px)}to{opacity:1;transform:scaleY(.9999) translateY(0)}}.devui-dropdown-fade-bottom-enter-from,.devui-dropdown-fade-bottom-leave-to{opacity:.8;transform:scaleY(.8) translateY(-4px)}.devui-dropdown-fade-bottom-enter-to,.devui-dropdown-fade-bottom-leave-from{opacity:1;transform:scaleY(.9999) translateY(0)}.devui-dropdown-fade-bottom-enter-active{transition:transform .2s cubic-bezier(.16,.75,.5,1),opacity .2s cubic-bezier(.16,.75,.5,1)}.devui-dropdown-fade-bottom-leave-active{transition:transform .2s cubic-bezier(.5,0,.84,.25),opacity .2s cubic-bezier(.5,0,.84,.25)}.devui-dropdown-fade-top-enter-from,.devui-dropdown-fade-top-leave-to{opacity:.8;transform:scaleY(.8) translateY(4px)}.devui-dropdown-fade-top-enter-to,.devui-dropdown-fade-top-leave-from{opacity:1;transform:scaleY(.9999) translateY(0)}.devui-dropdown-fade-top-enter-active{transition:transform .2s cubic-bezier(.16,.75,.5,1),opacity .2s cubic-bezier(.16,.75,.5,1)}.devui-dropdown-fade-top-leave-active{transition:transform .2s cubic-bezier(.5,0,.84,.25),opacity .2s cubic-bezier(.5,0,.84,.25)}
1
+ @keyframes d-overlay-fade{0%{opacity:0}to{opacity:1}}.devui-overlay__fade-enter{opacity:0}.devui-overlay__fade-enter-active{animation-name:d-overlay-fade;animation-duration:.3s}.devui-overlay__fade-leave{opacity:1}.devui-overlay__fade-leave-active{animation-name:d-overlay-fade;animation-duration:.3s;animation-direction:reverse}.devui-overlay__background{position:fixed;top:0;left:0;height:100vh;width:100vw;display:flex}.devui-overlay__background--color{background:rgba(0,0,0,.4)}.devui-overlay__background .devui-overlay{position:relative;z-index:1000;pointer-events:auto}.devui-overlay__background--disabled{pointer-events:none}.devui-flexible-overlay{position:fixed;border-radius:var(--devui-border-radius, 2px);background-color:var(--devui-connected-overlay-bg, #ffffff);box-shadow:var(--devui-shadow-connected-overlay, 0 2px 8px 0) var(--devui-shadow, rgba(37, 43, 58, .2));z-index:1000}.devui-flexible-overlay__arrow{position:absolute;width:8px;height:8px;transform:rotate(45deg);background-color:inherit}.devui-dropdown__toggle{display:inline-block}.devui-dropdown span.icon-chevron-down,.devui-dropdown span.icon-select-arrow{display:inline-block;vertical-align:text-top}.devui-dropdown__menu-wrap .devui-dropdown-menu{width:100%}.devui-dropdown-animation span.icon-chevron-down,.devui-dropdown-animation span.icon-select-arrow{transition:transform var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1))}.devui-dropdown.open span.icon-chevron-down,.devui-dropdown.open span.icon-select-arrow{transform:rotate(180deg)}.fade-in-top{animation:fadeInTop .2s cubic-bezier(.16,.75,.5,1)}.fade-in-bottom{animation:fadeInBottom .2s cubic-bezier(.16,.75,.5,1)}@keyframes fadeInTop{0%{opacity:.8;transform:scaleY(.8) translateY(4px)}to{opacity:1;transform:scaleY(.9999) translateY(0)}}@keyframes fadeInBottom{0%{opacity:.8;transform:scaleY(.8) translateY(-4px)}to{opacity:1;transform:scaleY(.9999) translateY(0)}}.devui-dropdown-fade-bottom-enter-from,.devui-dropdown-fade-bottom-leave-to{opacity:.8;transform:scaleY(.8) translateY(-4px)}.devui-dropdown-fade-bottom-enter-to,.devui-dropdown-fade-bottom-leave-from{opacity:1;transform:scaleY(.9999) translateY(0)}.devui-dropdown-fade-bottom-enter-active{transition:transform .2s cubic-bezier(.16,.75,.5,1),opacity .2s cubic-bezier(.16,.75,.5,1)}.devui-dropdown-fade-bottom-leave-active{transition:transform .2s cubic-bezier(.5,0,.84,.25),opacity .2s cubic-bezier(.5,0,.84,.25)}.devui-dropdown-fade-top-enter-from,.devui-dropdown-fade-top-leave-to{opacity:.8;transform:scaleY(.8) translateY(4px)}.devui-dropdown-fade-top-enter-to,.devui-dropdown-fade-top-leave-from{opacity:1;transform:scaleY(.9999) translateY(0)}.devui-dropdown-fade-top-enter-active{transition:transform .2s cubic-bezier(.16,.75,.5,1),opacity .2s cubic-bezier(.16,.75,.5,1)}.devui-dropdown-fade-top-leave-active{transition:transform .2s cubic-bezier(.5,0,.84,.25),opacity .2s cubic-bezier(.5,0,.84,.25)}
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, provide, reactive, toRefs, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, 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, Fragment, inject, onBeforeUnmount } from "vue";
33
33
  import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
34
34
  const formProps = {
35
35
  data: {
@@ -58,6 +58,14 @@ const formProps = {
58
58
  popPosition: {
59
59
  type: Array,
60
60
  default: ["right", "bottom"]
61
+ },
62
+ validateOnRuleChange: {
63
+ type: Boolean,
64
+ default: false
65
+ },
66
+ showFeedback: {
67
+ type: Boolean,
68
+ default: false
61
69
  }
62
70
  };
63
71
  const FORM_TOKEN = Symbol("dForm");
@@ -5550,13 +5558,20 @@ function useFormValidation(itemContexts) {
5550
5558
  }
5551
5559
  };
5552
5560
  const validate = async (callback) => validateFields(void 0, callback);
5553
- return { validate, validateFields };
5561
+ const clearValidate = (fields = []) => {
5562
+ getValidateFields(fields).forEach((field) => field.clearValidate());
5563
+ };
5564
+ const resetFields = (fields = []) => {
5565
+ getValidateFields(fields).forEach((field) => field.resetField());
5566
+ };
5567
+ return { validate, validateFields, resetFields, clearValidate };
5554
5568
  }
5555
5569
  var Form = defineComponent({
5556
5570
  name: "DForm",
5557
5571
  props: formProps,
5572
+ emits: ["validate"],
5558
5573
  setup(props, ctx) {
5559
- const ns = useNamespace("form");
5574
+ const ns2 = useNamespace("form");
5560
5575
  const {
5561
5576
  itemContexts,
5562
5577
  addItemContext,
@@ -5564,24 +5579,36 @@ var Form = defineComponent({
5564
5579
  } = useFieldCollection();
5565
5580
  const {
5566
5581
  validate,
5567
- validateFields
5582
+ validateFields,
5583
+ resetFields,
5584
+ clearValidate
5568
5585
  } = useFormValidation(itemContexts);
5569
5586
  const onSubmit = (e) => {
5570
5587
  e.preventDefault();
5571
5588
  };
5589
+ watch(() => props.rules, () => {
5590
+ if (props.validateOnRuleChange) {
5591
+ validate();
5592
+ }
5593
+ }, {
5594
+ deep: true
5595
+ });
5572
5596
  provide(FORM_TOKEN, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
5597
+ emit: ctx.emit,
5573
5598
  addItemContext,
5574
5599
  removeItemContext
5575
5600
  })));
5576
5601
  ctx.expose({
5577
5602
  validate,
5578
- validateFields
5603
+ validateFields,
5604
+ resetFields,
5605
+ clearValidate
5579
5606
  });
5580
5607
  return () => {
5581
5608
  var _a, _b;
5582
5609
  return createVNode("form", {
5583
5610
  "onSubmit": onSubmit,
5584
- "class": ns.b()
5611
+ "class": ns2.b()
5585
5612
  }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
5586
5613
  };
5587
5614
  }
@@ -5598,13 +5625,14 @@ function _isSlot(s) {
5598
5625
  }
5599
5626
  const CommonOverlay = defineComponent({
5600
5627
  setup(props, ctx) {
5628
+ const ns2 = useNamespace("overlay");
5601
5629
  return () => {
5602
5630
  let _slot;
5603
5631
  return createVNode(Teleport, {
5604
5632
  "to": "#d-overlay-anchor"
5605
5633
  }, {
5606
5634
  default: () => [createVNode(Transition, {
5607
- "name": "devui-overlay-fade"
5635
+ "name": ns2.e("fade")
5608
5636
  }, _isSlot(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
5609
5637
  default: () => [_slot]
5610
5638
  })]
@@ -5647,15 +5675,12 @@ const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
5647
5675
  });
5648
5676
  const overlayEmits = ["update:visible", "backdropClick"];
5649
5677
  function useOverlayLogic(props, ctx) {
5678
+ const ns2 = useNamespace("overlay");
5650
5679
  const backgroundClass = computed(() => {
5651
- return [
5652
- "devui-overlay-background",
5653
- props.backgroundClass,
5654
- !props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
5655
- ];
5680
+ return [ns2.e("background"), props.backgroundClass, !props.hasBackdrop ? ns2.em("background", "disabled") : ns2.em("background", "color")];
5656
5681
  });
5657
5682
  const overlayClass = computed(() => {
5658
- return "devui-overlay";
5683
+ return ns2.b();
5659
5684
  });
5660
5685
  const handleBackdropClick = (event) => {
5661
5686
  var _a;
@@ -5865,6 +5890,7 @@ const FlexibleOverlay = defineComponent({
5865
5890
  emit,
5866
5891
  expose
5867
5892
  }) {
5893
+ const ns2 = useNamespace("flexible-overlay");
5868
5894
  const {
5869
5895
  arrowRef,
5870
5896
  overlayRef,
@@ -5877,10 +5903,10 @@ const FlexibleOverlay = defineComponent({
5877
5903
  var _a;
5878
5904
  return props.modelValue && createVNode("div", mergeProps({
5879
5905
  "ref": overlayRef,
5880
- "class": "devui-flexible-overlay"
5906
+ "class": ns2.b()
5881
5907
  }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
5882
5908
  "ref": arrowRef,
5883
- "class": "devui-flexible-overlay-arrow"
5909
+ "class": ns2.e("arrow")
5884
5910
  }, null)]);
5885
5911
  };
5886
5912
  }
@@ -5995,11 +6021,12 @@ function usePopoverEvent(props, visible, origin) {
5995
6021
  origin.value.addEventListener("mouseleave", onMouseleave);
5996
6022
  }
5997
6023
  });
5998
- return { placement, handlePositionChange };
6024
+ return { placement, handlePositionChange, onMouseenter, onMouseleave };
5999
6025
  }
6000
- function SuccessIcon() {
6026
+ const ns = useNamespace("popover");
6027
+ function SuccessIcon$1() {
6001
6028
  return createVNode("svg", {
6002
- "class": "devui-icon devui-icon-success",
6029
+ "class": [ns.e("icon"), ns.em("icon", "success")],
6003
6030
  "viewBox": "0 0 16 16",
6004
6031
  "version": "1.1",
6005
6032
  "xmlns": "http://www.w3.org/2000/svg"
@@ -6023,7 +6050,7 @@ function SuccessIcon() {
6023
6050
  }
6024
6051
  function WarningIcon() {
6025
6052
  return createVNode("svg", {
6026
- "class": "devui-icon devui-icon-warning",
6053
+ "class": [ns.e("icon"), ns.em("icon", "warning")],
6027
6054
  "viewBox": "0 0 16 16",
6028
6055
  "version": "1.1",
6029
6056
  "xmlns": "http://www.w3.org/2000/svg"
@@ -6033,14 +6060,14 @@ function WarningIcon() {
6033
6060
  "fill": "none",
6034
6061
  "fill-rule": "evenodd"
6035
6062
  }, [createVNode("polygon", {
6036
- "points": "7.5 1.74501946 1.39184847 13.5954649 7.08947368 14.2207621 13.9973698 13.5954649 10.9383683 5.61273879 8.40084114 1.27624313"
6063
+ "points": "7.5 1.74501946 1.39184847 13.5954649 7.08947368 14.2207621 13.9973698 13.5954649 10.9383683 5.61273879 8.40084114 1.27624313"
6037
6064
  }, null), createVNode("path", {
6038
- "d": "M8.51325441,0.127397589 C8.70423071,0.228333932 8.8605922,0.383286648 8.96244623,0.57254229 L15.8714442,13.4101975 C16.1549662,13.9370117 15.9538562,14.5918482 15.4222523,14.8728158 C15.2642579,14.9563203 15.0879506,15 14.9088903,15 L1.09089441,15 C0.488410063,15 0,14.5159904 0,13.9189343 C0,13.7414873 0.0440768395,13.5667684 0.128340519,13.4101975 L7.03733844,0.57254229 C7.32086049,0.0457280838 7.98165058,-0.153569987 8.51325441,0.127397589 Z M8.87894737,11.2105263 L7.08947368,11.2105263 L7.08947368,13 L8.87894737,13 L8.87894737,11.2105263 Z M8.96842105,4.5 L7,4.5 L7.08947368,9.86842105 L8.87894737,9.86842105 L8.96842105,4.5 Z"
6065
+ "d": "M8.51325441,0.127397589 C8.70423071,0.228333932 8.8605922,0.383286648 8.96244623,0.57254229 L15.8714442,13.4101975 C16.1549662,13.9370117 15.9538562,14.5918482 15.4222523,14.8728158 C15.2642579,14.9563203 15.0879506,15 14.9088903,15 L1.09089441,15 C0.488410063,15 0,14.5159904 0,13.9189343 C0,13.7414873 0.0440768395,13.5667684 0.128340519,13.4101975 L7.03733844,0.57254229 C7.32086049,0.0457280838 7.98165058,-0.153569987 8.51325441,0.127397589 Z M8.87894737,11.2105263 L7.08947368,11.2105263 L7.08947368,13 L8.87894737,13 L8.87894737,11.2105263 Z M8.96842105,4.5 L7,4.5 L7.08947368,9.86842105 L8.87894737,9.86842105 L8.96842105,4.5 Z"
6039
6066
  }, null)])]);
6040
6067
  }
6041
6068
  function InfoIcon() {
6042
6069
  return createVNode("svg", {
6043
- "class": "devui-icon devui-icon-info",
6070
+ "class": [ns.e("icon"), ns.em("icon", "info")],
6044
6071
  "viewBox": "0 0 16 16",
6045
6072
  "version": "1.1",
6046
6073
  "xmlns": "http://www.w3.org/2000/svg"
@@ -6056,12 +6083,12 @@ function InfoIcon() {
6056
6083
  }, null), createVNode("g", {
6057
6084
  "stroke-width": "1"
6058
6085
  }, [createVNode("path", {
6059
- "d": "M8,0 C3.6,0 0,3.6 0,8 C0,12.4 3.6,16 8,16 C12.4,16 16,12.4 16,8 C16,3.6 12.4,0 8,0 Z M9,5 L7,5 L7,3 L9,3 L9,5 Z M9,12.6 L7,12.6 L7,6.6 L9,6.6 L9,12.6 Z"
6086
+ "d": "M8,0 C3.6,0 0,3.6 0,8 C0,12.4 3.6,16 8,16 C12.4,16 16,12.4 16,8 C16,3.6 12.4,0 8,0 Z M9,5 L7,5 L7,3 L9,3 L9,5 Z M9,12.6 L7,12.6 L7,6.6 L9,6.6 L9,12.6 Z"
6060
6087
  }, null)])])]);
6061
6088
  }
6062
- function ErrorIcon() {
6089
+ function ErrorIcon$1() {
6063
6090
  return createVNode("svg", {
6064
- "class": "devui-icon devui-icon-error",
6091
+ "class": [ns.e("icon"), ns.em("icon", "error")],
6065
6092
  "width": "16px",
6066
6093
  "height": "16px",
6067
6094
  "viewBox": "0 0 16 16",
@@ -6077,7 +6104,7 @@ function ErrorIcon() {
6077
6104
  "cy": "8",
6078
6105
  "r": "7"
6079
6106
  }, null), createVNode("path", {
6080
- "d": "M8,0 C3.6,0 0,3.6 0,8 C0,12.4 3.6,16 8,16 C12.4,16 16,12.4 16,8 C16,3.6 12.4,0 8,0 Z M9,12.6 L7,12.6 L7,10.6 L9,10.6 L9,12.6 Z M9,9.1 L7,9.1 L6.9,3.1 L9.1,3.1 L9,9.1 Z",
6107
+ "d": "M8,0 C3.6,0 0,3.6 0,8 C0,12.4 3.6,16 8,16 C12.4,16 16,12.4 16,8 C16,3.6 12.4,0 8,0 Z M9,12.6 L7,12.6 L7,10.6 L9,10.6 L9,12.6 Z M9,9.1 L7,9.1 L6.9,3.1 L9.1,3.1 L9,9.1 Z",
6081
6108
  "fill-rule": "nonzero"
6082
6109
  }, null)])]);
6083
6110
  }
@@ -6090,9 +6117,10 @@ var PopoverIcon = defineComponent({
6090
6117
  }
6091
6118
  },
6092
6119
  setup(props) {
6120
+ const ns2 = useNamespace("popover");
6093
6121
  return () => props.type && props.type !== "default" && createVNode("span", {
6094
- "class": "devui-popover-icon"
6095
- }, [props.type === "success" && createVNode(SuccessIcon, null, null), props.type === "warning" && createVNode(WarningIcon, null, null), props.type === "info" && createVNode(InfoIcon, null, null), props.type === "error" && createVNode(ErrorIcon, null, null)]);
6122
+ "class": ns2.e("icon-wrap")
6123
+ }, [props.type === "success" && createVNode(SuccessIcon$1, null, null), props.type === "warning" && createVNode(WarningIcon, null, null), props.type === "info" && createVNode(InfoIcon, null, null), props.type === "error" && createVNode(ErrorIcon$1, null, null)]);
6096
6124
  }
6097
6125
  });
6098
6126
  var popover = "";
@@ -6117,21 +6145,24 @@ var Popover = defineComponent({
6117
6145
  const visible = ref(false);
6118
6146
  const {
6119
6147
  placement,
6120
- handlePositionChange
6148
+ handlePositionChange,
6149
+ onMouseenter,
6150
+ onMouseleave
6121
6151
  } = usePopoverEvent(props, visible, origin);
6122
6152
  const {
6123
6153
  overlayStyles
6124
6154
  } = usePopover(props, visible, placement, origin, popoverRef);
6155
+ const ns2 = useNamespace("popover");
6125
6156
  return () => {
6126
6157
  var _a;
6127
6158
  return createVNode(Fragment, null, [createVNode("div", {
6128
6159
  "ref": origin,
6129
- "class": "devui-popover-reference"
6160
+ "class": ns2.e("reference")
6130
6161
  }, [(_a = slots.reference) == null ? void 0 : _a.call(slots)]), createVNode(Teleport, {
6131
6162
  "to": "body"
6132
6163
  }, {
6133
6164
  default: () => [createVNode(Transition, {
6134
- "name": showAnimation.value ? `devui-popover-fade-${placement.value}` : ""
6165
+ "name": showAnimation.value ? ns2.m(`fade-${placement.value}`) : ""
6135
6166
  }, {
6136
6167
  default: () => [createVNode(FlexibleOverlay, mergeProps({
6137
6168
  "modelValue": visible.value,
@@ -6141,12 +6172,14 @@ var Popover = defineComponent({
6141
6172
  "position": position.value,
6142
6173
  "align": align.value,
6143
6174
  "offset": offset2.value,
6144
- "class": ["devui-popover-content", popType.value !== "default" ? "is-icon" : ""],
6175
+ "class": [ns2.e("content"), popType.value !== "default" ? "is-icon" : ""],
6145
6176
  "show-arrow": true,
6146
6177
  "is-arrow-center": false,
6147
6178
  "style": overlayStyles.value
6148
6179
  }, attrs, {
6149
- "onPositionChange": handlePositionChange
6180
+ "onPositionChange": handlePositionChange,
6181
+ "onMouseenter": onMouseenter,
6182
+ "onMouseleave": onMouseleave
6150
6183
  }), {
6151
6184
  default: () => {
6152
6185
  var _a2;
@@ -6176,15 +6209,66 @@ function HelpTipsIcon() {
6176
6209
  "fill-rule": "nonzero"
6177
6210
  }, null)])])]);
6178
6211
  }
6212
+ function ErrorIcon() {
6213
+ return createVNode("svg", {
6214
+ "width": "14px",
6215
+ "height": "14px",
6216
+ "viewBox": "0 0 16 16"
6217
+ }, [createVNode("g", {
6218
+ "stroke": "none",
6219
+ "stroke-width": "1",
6220
+ "fill": "none",
6221
+ "fill-rule": "evenodd"
6222
+ }, [createVNode("circle", {
6223
+ "cx": "8",
6224
+ "cy": "8",
6225
+ "r": "8"
6226
+ }, null), createVNode("polygon", {
6227
+ "points": "8.07106781 6.65685425 10.8994949 3.82842712 12.3137085 5.24264069 9.48528137 8.07106781 12.3137085 10.8994949 10.8994949 12.3137085 8.07106781 9.48528137 5.24264069 12.3137085 3.82842712 10.8994949 6.65685425 8.07106781 3.82842712 5.24264069 5.24264069 3.82842712"
6228
+ }, null)])]);
6229
+ }
6230
+ function SuccessIcon() {
6231
+ return createVNode("svg", {
6232
+ "width": "14px",
6233
+ "height": "14px",
6234
+ "viewBox": "0 0 16 16"
6235
+ }, [createVNode("g", {
6236
+ "stroke": "none",
6237
+ "stroke-width": "1",
6238
+ "fill": "none",
6239
+ "fill-rule": "evenodd"
6240
+ }, [createVNode("circle", {
6241
+ "cx": "8",
6242
+ "cy": "8",
6243
+ "r": "8"
6244
+ }, null), createVNode("polygon", {
6245
+ "points": "6.53553391 9.77817459 12.1923882 4.12132034 13.6066017 5.53553391 6.53553391 12.6066017 3 9.07106781 4.41421356 7.65685425 6.53553391 9.77817459"
6246
+ }, null)])]);
6247
+ }
6248
+ function PendingIcon() {
6249
+ return createVNode("svg", {
6250
+ "width": "14px",
6251
+ "height": "14px",
6252
+ "viewBox": "0 0 16 16"
6253
+ }, [createVNode("g", {
6254
+ "id": "loading",
6255
+ "stroke": "none",
6256
+ "stroke-width": "1",
6257
+ "fill": "none",
6258
+ "fill-rule": "evenodd"
6259
+ }, [createVNode("path", {
6260
+ "d": "M8,0 C12.4,0 16,3.6 16,8 C16,12.4 12.4,16 8,16 C3.6,16 0,12.4 0,8 C0,3.6 3.6,0 8,0 Z M8,1 C4.15,1 1,4.15 1,8 C1,11.85 4.15,15 8,15 C11.85,15 15,11.85 15,8 C15,4.15 11.85,1 8,1 Z",
6261
+ "fill-rule": "nonzero"
6262
+ }, null), createVNode("path", {
6263
+ "d": "M8,0 C12.4,0 16,3.6 16,8 L15,8 C15,4.15 11.85,1 8,1 L8,0 Z",
6264
+ "fill-rule": "nonzero"
6265
+ }, null)])]);
6266
+ }
6179
6267
  const formItemProps = {
6180
6268
  field: {
6181
6269
  type: String,
6182
6270
  default: ""
6183
6271
  },
6184
- dHasFeedback: {
6185
- type: Boolean,
6186
- default: false
6187
- },
6188
6272
  required: {
6189
6273
  type: Boolean,
6190
6274
  default: false
@@ -6197,22 +6281,26 @@ const formItemProps = {
6197
6281
  },
6198
6282
  rules: {
6199
6283
  type: [Object, Array]
6284
+ },
6285
+ showFeedback: {
6286
+ type: Boolean,
6287
+ default: void 0
6200
6288
  }
6201
6289
  };
6202
6290
  const FORM_ITEM_TOKEN = Symbol("dFormItem");
6203
6291
  function useFormLabel() {
6204
6292
  const formContext = inject(FORM_TOKEN);
6205
6293
  const formItemContext = inject(FORM_ITEM_TOKEN);
6206
- const ns = useNamespace("form");
6294
+ const ns2 = useNamespace("form");
6207
6295
  const labelClasses = computed(() => ({
6208
- [`${ns.e("label")}`]: true,
6209
- [`${ns.em("label", "vertical")}`]: formContext.layout === "vertical",
6210
- [`${ns.em("label", formContext.labelSize)}`]: formContext.layout === "horizontal",
6211
- [`${ns.em("label", formContext.labelAlign)}`]: formContext.layout === "horizontal"
6296
+ [`${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"
6212
6300
  }));
6213
6301
  const labelInnerClasses = computed(() => ({
6214
- [`${ns.e("label-span")}`]: true,
6215
- [`${ns.em("label", "required")}`]: formItemContext.isRequired
6302
+ [`${ns2.e("label-span")}`]: true,
6303
+ [`${ns2.em("label", "required")}`]: formItemContext.isRequired
6216
6304
  }));
6217
6305
  return { labelClasses, labelInnerClasses };
6218
6306
  }
@@ -6221,7 +6309,7 @@ var FormLabel = defineComponent({
6221
6309
  name: "DFormLabel",
6222
6310
  props: formLabelProps,
6223
6311
  setup(props, ctx) {
6224
- const ns = useNamespace("form");
6312
+ const ns2 = useNamespace("form");
6225
6313
  const {
6226
6314
  labelClasses,
6227
6315
  labelInnerClasses
@@ -6239,7 +6327,7 @@ var FormLabel = defineComponent({
6239
6327
  "pop-type": "info"
6240
6328
  }, {
6241
6329
  reference: () => createVNode(HelpTipsIcon, {
6242
- "class": ns.e("label-help")
6330
+ "class": ns2.e("label-help")
6243
6331
  }, null)
6244
6332
  })]);
6245
6333
  };
@@ -7249,11 +7337,11 @@ Schema.messages = messages;
7249
7337
  Schema.validators = validators;
7250
7338
  function useFormItem(messageType, _rules, validateState) {
7251
7339
  const formContext = inject(FORM_TOKEN);
7252
- const ns = useNamespace("form");
7340
+ const ns2 = useNamespace("form");
7253
7341
  const itemClasses = computed(() => ({
7254
- [`${ns.em("item", "horizontal")}`]: formContext.layout === "horizontal",
7255
- [`${ns.em("item", "vertical")}`]: formContext.layout === "vertical",
7256
- [`${ns.em("item", "error")}`]: messageType.value === "text" && validateState.value === "error"
7342
+ [`${ns2.em("item", "horizontal")}`]: formContext.layout === "horizontal",
7343
+ [`${ns2.em("item", "vertical")}`]: formContext.layout === "vertical",
7344
+ [`${ns2.em("item", "error")}`]: messageType.value === "text" && validateState.value === "error"
7257
7345
  }));
7258
7346
  const isRequired = computed(() => _rules.value.some((rule) => Boolean(rule.required)));
7259
7347
  return { itemClasses, isRequired };
@@ -7280,15 +7368,22 @@ function useFormItemValidate(props, _rules) {
7280
7368
  const formContext = inject(FORM_TOKEN);
7281
7369
  const validateState = ref("");
7282
7370
  const validateMessage = ref("");
7371
+ let initFieldValue = void 0;
7372
+ let isResetting = false;
7283
7373
  const computedField = computed(() => {
7284
7374
  return typeof props.field === "string" ? props.field : "";
7285
7375
  });
7286
- const fieldValue = computed(() => {
7287
- const formData = formContext.data;
7288
- if (!formData || !props.field) {
7289
- return;
7376
+ const fieldValue = computed({
7377
+ get: () => {
7378
+ const formData = formContext.data;
7379
+ if (!formData || !props.field) {
7380
+ return;
7381
+ }
7382
+ return formData[props.field];
7383
+ },
7384
+ set: (val) => {
7385
+ formContext.data[props.field] = val;
7290
7386
  }
7291
- return formData[props.field];
7292
7387
  });
7293
7388
  const getRuleByTrigger = (triggerVal) => {
7294
7389
  return _rules.value.filter((rule) => {
@@ -7308,11 +7403,13 @@ function useFormItemValidate(props, _rules) {
7308
7403
  const onValidateSuccess = () => {
7309
7404
  validateState.value = "success";
7310
7405
  validateMessage.value = "";
7406
+ formContext.emit("validate", props.field, true, "");
7311
7407
  };
7312
7408
  const onValidateError = ({ errors }) => {
7313
7409
  var _a;
7314
7410
  validateState.value = "error";
7315
7411
  validateMessage.value = ((_a = errors == null ? void 0 : errors[0]) == null ? void 0 : _a.message) || "";
7412
+ formContext.emit("validate", props.field, false, validateMessage.value);
7316
7413
  };
7317
7414
  const execValidate = async (rules2) => {
7318
7415
  const ruleName = computedField.value;
@@ -7328,6 +7425,10 @@ function useFormItemValidate(props, _rules) {
7328
7425
  });
7329
7426
  };
7330
7427
  const validate = async (trigger, callback) => {
7428
+ if (isResetting) {
7429
+ isResetting = false;
7430
+ return false;
7431
+ }
7331
7432
  const rules2 = getRuleByTrigger(trigger);
7332
7433
  if (!rules2.length) {
7333
7434
  callback == null ? void 0 : callback(true);
@@ -7343,7 +7444,23 @@ function useFormItemValidate(props, _rules) {
7343
7444
  return lodash.exports.isFunction(callback) ? false : Promise.reject(fields);
7344
7445
  });
7345
7446
  };
7346
- return { validateState, validateMessage, validate };
7447
+ const clearValidate = () => {
7448
+ validateState.value = "";
7449
+ validateMessage.value = "";
7450
+ };
7451
+ const resetField = async () => {
7452
+ if (!formContext.data || !props.field) {
7453
+ return;
7454
+ }
7455
+ isResetting = true;
7456
+ fieldValue.value = initFieldValue;
7457
+ await nextTick();
7458
+ clearValidate();
7459
+ };
7460
+ onMounted(() => {
7461
+ initFieldValue = lodash.exports.cloneDeep(formContext.data[props.field]);
7462
+ });
7463
+ return { validateState, validateMessage, validate, resetField, clearValidate };
7347
7464
  }
7348
7465
  var formItem = "";
7349
7466
  var FormItem = defineComponent({
@@ -7353,11 +7470,14 @@ var FormItem = defineComponent({
7353
7470
  const formContext = inject(FORM_TOKEN);
7354
7471
  const _a = toRefs(props), {
7355
7472
  messageType: itemMessageType,
7356
- popPosition: itemPopPosition
7473
+ popPosition: itemPopPosition,
7474
+ showFeedback: itemShowFeedback
7357
7475
  } = _a, otherProps = __objRest(_a, [
7358
7476
  "messageType",
7359
- "popPosition"
7477
+ "popPosition",
7478
+ "showFeedback"
7360
7479
  ]);
7480
+ const showFeedback = computed(() => (itemShowFeedback == null ? void 0 : itemShowFeedback.value) !== void 0 ? itemShowFeedback.value : formContext.showFeedback);
7361
7481
  const messageType = computed(() => (itemMessageType == null ? void 0 : itemMessageType.value) || formContext.messageType);
7362
7482
  const popPosition = computed(() => (itemPopPosition == null ? void 0 : itemPopPosition.value) || formContext.popPosition);
7363
7483
  const {
@@ -7366,21 +7486,30 @@ var FormItem = defineComponent({
7366
7486
  const {
7367
7487
  validateState,
7368
7488
  validateMessage,
7369
- validate
7489
+ validate,
7490
+ resetField,
7491
+ clearValidate
7370
7492
  } = useFormItemValidate(props, _rules);
7371
7493
  const {
7372
7494
  itemClasses,
7373
7495
  isRequired
7374
7496
  } = useFormItem(messageType, _rules, validateState);
7375
7497
  const context = reactive(__spreadProps(__spreadValues({}, otherProps), {
7498
+ showFeedback,
7376
7499
  messageType,
7377
7500
  popPosition,
7378
7501
  isRequired,
7379
7502
  validateState,
7380
7503
  validateMessage,
7381
- validate
7504
+ validate,
7505
+ resetField,
7506
+ clearValidate
7382
7507
  }));
7383
7508
  provide(FORM_ITEM_TOKEN, context);
7509
+ ctx.expose({
7510
+ resetField,
7511
+ clearValidate
7512
+ });
7384
7513
  onMounted(() => {
7385
7514
  if (props.field) {
7386
7515
  formContext == null ? void 0 : formContext.addItemContext(context);
@@ -7408,27 +7537,29 @@ const formControlProps = {
7408
7537
  };
7409
7538
  function useFormControl(props) {
7410
7539
  const formContext = inject(FORM_TOKEN);
7411
- const ns = useNamespace("form");
7540
+ const ns2 = useNamespace("form");
7412
7541
  const { feedbackStatus } = toRefs(props);
7413
7542
  const controlClasses = computed(() => ({
7414
- [`${ns.e("control")}`]: true,
7415
- [`${ns.em("control", "horizontal")}`]: formContext.layout === "horizontal"
7543
+ [ns2.e("control")]: true,
7544
+ [ns2.em("control", "horizontal")]: formContext.layout === "horizontal"
7416
7545
  }));
7417
7546
  const controlContainerClasses = computed(() => ({
7418
- [`${ns.e("control-container")}`]: true,
7419
- [`${ns.em("control-container", "horizontal")}`]: formContext.layout === "horizontal",
7420
- [`${ns.em("control-container", "has-feedback")}`]: Boolean(feedbackStatus.value),
7421
- [`${ns.em("control-container", "feedback-error")}`]: Boolean(feedbackStatus.value === "error")
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")
7422
7551
  }));
7423
7552
  return { controlClasses, controlContainerClasses };
7424
7553
  }
7425
7554
  function useFormControlValidate() {
7426
7555
  const formItemContext = inject(FORM_ITEM_TOKEN);
7556
+ const feedbackStatus = computed(() => formItemContext.validateState);
7557
+ const showFeedback = computed(() => formItemContext.showFeedback && Boolean(formItemContext.validateState));
7427
7558
  const showPopover = computed(() => formItemContext.messageType === "popover" && formItemContext.validateState === "error");
7428
7559
  const showMessage = computed(() => formItemContext.messageType === "text" && formItemContext.validateState === "error");
7429
7560
  const errorMessage = computed(() => formItemContext.validateMessage);
7430
7561
  const popPosition = computed(() => formItemContext.popPosition);
7431
- return { showPopover, showMessage, errorMessage, popPosition };
7562
+ return { feedbackStatus, showFeedback, showPopover, showMessage, errorMessage, popPosition };
7432
7563
  }
7433
7564
  var formControl = "";
7434
7565
  var FormControl = defineComponent({
@@ -7436,12 +7567,14 @@ var FormControl = defineComponent({
7436
7567
  props: formControlProps,
7437
7568
  setup(props, ctx) {
7438
7569
  const formControl2 = ref();
7439
- const ns = useNamespace("form");
7570
+ const ns2 = useNamespace("form");
7440
7571
  const {
7441
7572
  controlClasses,
7442
7573
  controlContainerClasses
7443
7574
  } = useFormControl(props);
7444
7575
  const {
7576
+ feedbackStatus,
7577
+ showFeedback,
7445
7578
  showPopover,
7446
7579
  showMessage,
7447
7580
  errorMessage,
@@ -7462,15 +7595,17 @@ var FormControl = defineComponent({
7462
7595
  reference: () => {
7463
7596
  var _a, _b;
7464
7597
  return createVNode("div", {
7465
- "class": ns.e("control-content")
7598
+ "class": ns2.e("control-content")
7466
7599
  }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
7467
7600
  }
7468
- })]), createVNode("div", {
7469
- "class": ns.e("control-info")
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")
7470
7605
  }, [showMessage.value && createVNode("div", {
7471
7606
  "class": "error-message"
7472
7607
  }, [errorMessage.value]), props.extraInfo && createVNode("div", {
7473
- "class": ns.e("control-extra")
7608
+ "class": ns2.e("control-extra")
7474
7609
  }, [props.extraInfo])])]);
7475
7610
  }
7476
7611
  });