vue-devui 1.3.4-alpha.3 → 1.4.0

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.
@@ -29,12 +29,11 @@ var __objRest = (source, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
- import { computed, ref, watch, defineComponent, toRefs, createVNode, resolveDynamicComponent, mergeProps, provide, reactive, onUnmounted, Transition, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, onMounted, Teleport, createTextVNode, onBeforeUnmount, getCurrentInstance, shallowRef } from "vue";
32
+ import { defineComponent, watch, provide, reactive, toRefs, createVNode, onUnmounted, Transition, mergeProps, ref, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, Teleport, createTextVNode, onBeforeUnmount, resolveDynamicComponent, getCurrentInstance, shallowRef } from "vue";
33
33
  import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
34
34
  const searchProps = {
35
35
  size: {
36
- type: String,
37
- default: "md"
36
+ type: String
38
37
  },
39
38
  placeholder: {
40
39
  type: String,
@@ -81,6 +80,51 @@ const searchProps = {
81
80
  default: void 0
82
81
  }
83
82
  };
83
+ const formProps = {
84
+ data: {
85
+ type: Object,
86
+ default: () => ({})
87
+ },
88
+ layout: {
89
+ type: String,
90
+ default: "horizontal"
91
+ },
92
+ labelSize: {
93
+ type: String,
94
+ default: "md"
95
+ },
96
+ labelAlign: {
97
+ type: String,
98
+ default: "start"
99
+ },
100
+ rules: {
101
+ type: Object
102
+ },
103
+ messageType: {
104
+ type: String,
105
+ default: "popover"
106
+ },
107
+ popPosition: {
108
+ type: Array,
109
+ default: ["right", "bottom"]
110
+ },
111
+ validateOnRuleChange: {
112
+ type: Boolean,
113
+ default: false
114
+ },
115
+ showFeedback: {
116
+ type: Boolean,
117
+ default: false
118
+ },
119
+ disabled: {
120
+ type: Boolean,
121
+ default: false
122
+ },
123
+ size: {
124
+ type: String
125
+ }
126
+ };
127
+ const FORM_TOKEN = Symbol("dForm");
84
128
  function createBem(namespace, element, modifier) {
85
129
  let cls = namespace;
86
130
  if (element) {
@@ -104,43 +148,16 @@ function useNamespace(block, needDot = false) {
104
148
  em
105
149
  };
106
150
  }
107
- const SIZE_CLASS = {
108
- lg: "lg",
109
- md: "md",
110
- sm: "sm"
111
- };
112
- const ICON_POSITION = {
113
- right: "right",
114
- left: "left"
115
- };
116
- const ns$2 = useNamespace("search");
117
- const getRootClass = (props, isFocus) => {
118
- return computed(() => ({
119
- [ns$2.b()]: true,
120
- [ns$2.m("focus")]: isFocus.value,
121
- [ns$2.m("disabled")]: props.disabled,
122
- [ns$2.m("no-border")]: props.noBorder,
123
- [ns$2.m(props.size)]: SIZE_CLASS[props.size],
124
- [ns$2.m(props.iconPosition)]: ICON_POSITION[props.iconPosition]
125
- }));
126
- };
127
- const keywordsHandles = (ctx, props) => {
128
- const keywords = ref("");
129
- watch(() => props.modelValue, (val) => {
130
- keywords.value = val;
131
- }, { immediate: true });
132
- const onClearHandle = () => {
133
- keywords.value = "";
134
- ctx.emit("update:modelValue", "");
135
- ctx.emit("search", "");
151
+ function useFieldCollection() {
152
+ const itemContexts = [];
153
+ const addItemContext = (field) => {
154
+ itemContexts.push(field);
136
155
  };
137
- const clearIconShow = computed(() => keywords.value.length > 0);
138
- return {
139
- keywords,
140
- clearIconShow,
141
- onClearHandle
156
+ const removeItemContext = (field) => {
157
+ itemContexts.splice(itemContexts.indexOf(field), 1);
142
158
  };
143
- };
159
+ return { itemContexts, addItemContext, removeItemContext };
160
+ }
144
161
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
145
162
  var lodash = { exports: {} };
146
163
  /**
@@ -5553,1111 +5570,815 @@ var lodash = { exports: {} };
5553
5570
  }
5554
5571
  }).call(commonjsGlobal);
5555
5572
  })(lodash, lodash.exports);
5556
- const keydownHandles = (ctx, keywords, props) => {
5557
- const useEmitKeyword = lodash.exports.debounce((value) => {
5558
- ctx.emit("search", value);
5559
- }, props.delay);
5560
- const handleEnter = ($event) => {
5561
- if ($event.target instanceof HTMLInputElement) {
5562
- const value = $event.target.value;
5563
- useEmitKeyword(value);
5573
+ function useFormValidation(itemContexts) {
5574
+ const getValidateFields = (fields) => {
5575
+ if (!itemContexts.length) {
5576
+ return [];
5577
+ }
5578
+ const normalizedFields = lodash.exports.castArray(fields);
5579
+ const filteredFields = normalizedFields.length ? itemContexts.filter((context) => context.field && normalizedFields.includes(context.field)) : itemContexts;
5580
+ if (!filteredFields.length) {
5581
+ return [];
5564
5582
  }
5583
+ return filteredFields;
5565
5584
  };
5566
- const onClickHandle = () => {
5567
- if (!props.disabled) {
5568
- ctx.emit("search", keywords.value);
5585
+ const execValidateFields = async (fields = []) => {
5586
+ const validateFields2 = getValidateFields(fields);
5587
+ if (!validateFields2.length) {
5588
+ return true;
5589
+ }
5590
+ let errors = {};
5591
+ for (const field of validateFields2) {
5592
+ try {
5593
+ await field.validate("");
5594
+ } catch (err) {
5595
+ errors = __spreadValues(__spreadValues({}, errors), err);
5596
+ }
5569
5597
  }
5598
+ if (!Object.keys(errors).length) {
5599
+ return true;
5600
+ }
5601
+ return Promise.reject(errors);
5570
5602
  };
5571
- const KEYS_MAP = {
5572
- Enter: handleEnter
5603
+ const validateFields = async (fields = [], callback) => {
5604
+ try {
5605
+ const result = await execValidateFields(fields);
5606
+ if (result) {
5607
+ callback == null ? void 0 : callback(result);
5608
+ }
5609
+ return result;
5610
+ } catch (err) {
5611
+ const invalidFields = err;
5612
+ callback == null ? void 0 : callback(false, invalidFields);
5613
+ return !callback && Promise.reject(invalidFields);
5614
+ }
5573
5615
  };
5574
- const onInputKeydown = ($event) => {
5575
- var _a;
5576
- (_a = KEYS_MAP[$event.key]) == null ? void 0 : _a.call(KEYS_MAP, $event);
5616
+ const validate = async (callback) => validateFields(void 0, callback);
5617
+ const clearValidate = (fields = []) => {
5618
+ getValidateFields(fields).forEach((field) => field.clearValidate());
5577
5619
  };
5578
- return {
5579
- onInputKeydown,
5580
- useEmitKeyword,
5581
- onClickHandle
5620
+ const resetFields = (fields = []) => {
5621
+ getValidateFields(fields).forEach((field) => field.resetField());
5582
5622
  };
5583
- };
5584
- const DEFAULT_PREFIX = "icon";
5585
- const iconProps = {
5586
- name: {
5623
+ return { validate, validateFields, resetFields, clearValidate };
5624
+ }
5625
+ defineComponent({
5626
+ name: "DForm",
5627
+ props: formProps,
5628
+ emits: ["validate"],
5629
+ setup(props, ctx) {
5630
+ const ns2 = useNamespace("form");
5631
+ const {
5632
+ itemContexts,
5633
+ addItemContext,
5634
+ removeItemContext
5635
+ } = useFieldCollection();
5636
+ const {
5637
+ validate,
5638
+ validateFields,
5639
+ resetFields,
5640
+ clearValidate
5641
+ } = useFormValidation(itemContexts);
5642
+ const onSubmit = (e) => {
5643
+ e.preventDefault();
5644
+ };
5645
+ watch(() => props.rules, () => {
5646
+ if (props.validateOnRuleChange) {
5647
+ validate();
5648
+ }
5649
+ }, {
5650
+ deep: true
5651
+ });
5652
+ provide(FORM_TOKEN, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
5653
+ emit: ctx.emit,
5654
+ addItemContext,
5655
+ removeItemContext
5656
+ })));
5657
+ ctx.expose({
5658
+ validate,
5659
+ validateFields,
5660
+ resetFields,
5661
+ clearValidate
5662
+ });
5663
+ return () => {
5664
+ var _a, _b;
5665
+ return createVNode("form", {
5666
+ "onSubmit": onSubmit,
5667
+ "class": ns2.b()
5668
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
5669
+ };
5670
+ }
5671
+ });
5672
+ const formItemProps = {
5673
+ label: {
5674
+ type: String
5675
+ },
5676
+ field: {
5587
5677
  type: String,
5588
- default: "",
5589
- required: true
5678
+ default: ""
5590
5679
  },
5591
- size: {
5592
- type: [Number, String],
5593
- default: "inherit"
5680
+ required: {
5681
+ type: Boolean,
5682
+ default: false
5594
5683
  },
5595
- color: {
5596
- type: String,
5597
- default: "inherit"
5684
+ messageType: {
5685
+ type: String
5598
5686
  },
5599
- component: {
5600
- type: Object,
5601
- default: null
5687
+ popPosition: {
5688
+ type: Array
5602
5689
  },
5603
- classPrefix: {
5604
- type: String,
5605
- default: DEFAULT_PREFIX
5690
+ rules: {
5691
+ type: [Object, Array]
5606
5692
  },
5607
- operable: {
5693
+ showFeedback: {
5608
5694
  type: Boolean,
5609
- default: false
5695
+ default: void 0
5610
5696
  },
5611
- disabled: {
5612
- type: Boolean,
5613
- default: false
5697
+ helpTips: {
5698
+ type: String,
5699
+ default: ""
5614
5700
  },
5615
- rotate: {
5616
- type: [Number, String]
5701
+ feedbackStatus: {
5702
+ type: String
5703
+ },
5704
+ extraInfo: {
5705
+ type: String,
5706
+ default: ""
5617
5707
  }
5618
5708
  };
5619
- const svgIconProps = {
5620
- name: {
5621
- type: String,
5622
- default: "",
5623
- required: true
5624
- },
5625
- color: {
5709
+ const FORM_ITEM_TOKEN = Symbol("dFormItem");
5710
+ const LABEL_DATA = Symbol("labelData");
5711
+ const formLabelProps = {
5712
+ helpTips: {
5626
5713
  type: String,
5627
- default: "inherit"
5628
- },
5629
- size: {
5630
- type: [Number, String],
5631
- default: "inherit"
5714
+ default: ""
5632
5715
  }
5633
5716
  };
5634
- var icon = "";
5635
- var svgIcon = defineComponent({
5636
- name: "DSvgIcon",
5637
- props: svgIconProps,
5638
- setup(props) {
5639
- const {
5640
- name,
5641
- color,
5642
- size
5643
- } = toRefs(props);
5644
- const ns2 = useNamespace("svg-icon");
5645
- const iconName = computed(() => `#icon-${name.value}`);
5646
- const iconSize = computed(() => {
5647
- return typeof size.value === "number" ? `${size.value}px` : size.value;
5648
- });
5649
- const styles = {
5650
- width: iconSize.value,
5651
- height: iconSize.value
5652
- };
5717
+ const fixedOverlayProps = {
5718
+ modelValue: {
5719
+ type: Boolean,
5720
+ default: false
5721
+ },
5722
+ lockScroll: {
5723
+ type: Boolean,
5724
+ default: true
5725
+ },
5726
+ closeOnClickOverlay: {
5727
+ type: Boolean,
5728
+ default: true
5729
+ }
5730
+ };
5731
+ function lockScroll() {
5732
+ if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
5733
+ const scrollTop = document.documentElement.scrollTop;
5734
+ const style = document.documentElement.getAttribute("style");
5735
+ document.documentElement.style.position = "fixed";
5736
+ document.documentElement.style.top = `-${scrollTop}px`;
5737
+ document.documentElement.style.width = document.documentElement.style.width || "100%";
5738
+ document.documentElement.style.overflowY = "scroll";
5653
5739
  return () => {
5654
- return createVNode("svg", {
5655
- "class": ns2.b(),
5656
- "style": styles
5657
- }, [createVNode("use", {
5658
- "xlink:href": iconName.value,
5659
- "fill": color.value
5660
- }, null)]);
5740
+ if (style) {
5741
+ document.documentElement.setAttribute("style", style);
5742
+ } else {
5743
+ document.documentElement.removeAttribute("style");
5744
+ }
5745
+ document.documentElement.scrollTop = scrollTop;
5661
5746
  };
5662
5747
  }
5663
- });
5664
- function isUrl(value) {
5665
- return /^((http|https):)?\/\//.test(value);
5748
+ return;
5666
5749
  }
5667
- function useIconDom(props, ctx) {
5668
- const {
5669
- component,
5670
- name,
5671
- size,
5672
- color,
5673
- classPrefix,
5674
- rotate
5675
- } = toRefs(props);
5676
- const ns2 = useNamespace("icon");
5677
- const iconSize = computed(() => {
5678
- return typeof size.value === "number" ? `${size.value}px` : size.value;
5679
- });
5680
- const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
5681
- const imgIconDom = () => {
5682
- return createVNode("img", mergeProps({
5683
- "src": name.value,
5684
- "alt": name.value.split("/")[name.value.split("/").length - 1],
5685
- "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
5686
- "style": {
5687
- width: iconSize.value || "",
5688
- transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`,
5689
- verticalAlign: "middle"
5690
- }
5691
- }, ctx.attrs), null);
5692
- };
5693
- const svgIconDom = () => {
5694
- return createVNode(IconComponent, mergeProps({
5695
- "name": name.value,
5696
- "color": color.value,
5697
- "size": iconSize.value,
5698
- "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
5699
- "style": {
5700
- transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
5701
- }
5702
- }, ctx.attrs), null);
5703
- };
5704
- const fontIconDom = () => {
5705
- const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
5706
- return createVNode("i", mergeProps({
5707
- "class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
5708
- "style": {
5709
- fontSize: iconSize.value,
5710
- color: color.value,
5711
- transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
5712
- }
5713
- }, ctx.attrs), null);
5714
- };
5715
- const iconDom = () => {
5716
- return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
5750
+ function useFixedOverlay(props, ctx) {
5751
+ let lockScrollCb;
5752
+ const onClick = (event) => {
5753
+ event.preventDefault();
5754
+ ctx.emit("click", event);
5755
+ if (props.closeOnClickOverlay) {
5756
+ ctx.emit("update:modelValue", false);
5757
+ }
5717
5758
  };
5718
- return {
5719
- iconDom
5759
+ const removeBodyAdditions = () => {
5760
+ lockScrollCb == null ? void 0 : lockScrollCb();
5720
5761
  };
5762
+ watch(() => props.modelValue, (val) => {
5763
+ if (val) {
5764
+ props.lockScroll && (lockScrollCb = lockScroll());
5765
+ } else {
5766
+ removeBodyAdditions();
5767
+ }
5768
+ });
5769
+ onUnmounted(removeBodyAdditions);
5770
+ return { onClick };
5721
5771
  }
5722
- var Icon = defineComponent({
5723
- name: "DIcon",
5724
- props: iconProps,
5725
- emits: ["click"],
5772
+ var fixedOverlay = "";
5773
+ defineComponent({
5774
+ name: "DFixedOverlay",
5775
+ inheritAttrs: false,
5776
+ props: fixedOverlayProps,
5777
+ emits: ["update:modelValue", "click"],
5726
5778
  setup(props, ctx) {
5727
5779
  const {
5728
- disabled,
5729
- operable
5780
+ modelValue
5730
5781
  } = toRefs(props);
5782
+ const ns2 = useNamespace("fixed-overlay");
5731
5783
  const {
5732
- iconDom
5733
- } = useIconDom(props, ctx);
5734
- const ns2 = useNamespace("icon");
5735
- const wrapClassed = computed(() => ({
5736
- [ns2.e("container")]: true,
5737
- [ns2.m("disabled")]: disabled.value,
5738
- [ns2.m("operable")]: operable.value,
5739
- [ns2.m("no-slots")]: !Object.keys(ctx.slots).length
5740
- }));
5741
- const onClick = (e) => {
5742
- if (disabled.value) {
5743
- return;
5784
+ onClick
5785
+ } = useFixedOverlay(props, ctx);
5786
+ return () => createVNode(Transition, {
5787
+ "name": ns2.m("fade")
5788
+ }, {
5789
+ default: () => {
5790
+ var _a, _b;
5791
+ return [modelValue.value && createVNode("div", mergeProps({
5792
+ "class": ns2.b()
5793
+ }, ctx.attrs, {
5794
+ "onClick": onClick
5795
+ }), [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
5744
5796
  }
5745
- ctx.emit("click", e);
5746
- };
5747
- return () => {
5748
- var _a, _b, _c, _d;
5749
- return createVNode("div", {
5750
- "class": wrapClassed.value,
5751
- "onClick": onClick
5752
- }, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
5753
- };
5797
+ });
5754
5798
  }
5755
5799
  });
5756
- const inputProps = {
5800
+ const flexibleOverlayProps = {
5757
5801
  modelValue: {
5758
- type: String,
5759
- default: ""
5760
- },
5761
- disabled: {
5762
5802
  type: Boolean,
5763
5803
  default: false
5764
5804
  },
5765
- error: {
5766
- type: Boolean,
5767
- default: false
5805
+ origin: {
5806
+ type: Object,
5807
+ require: true
5768
5808
  },
5769
- size: {
5770
- type: String
5809
+ position: {
5810
+ type: Array,
5811
+ default: ["bottom"]
5771
5812
  },
5772
- validateEvent: {
5773
- type: Boolean,
5774
- default: true
5813
+ offset: {
5814
+ type: [Number, Object],
5815
+ default: 8
5775
5816
  },
5776
- prefix: {
5777
- type: String,
5778
- default: ""
5817
+ shiftOffset: {
5818
+ type: Number
5779
5819
  },
5780
- suffix: {
5820
+ align: {
5781
5821
  type: String,
5782
- default: ""
5822
+ default: null
5783
5823
  },
5784
- showPassword: {
5824
+ showArrow: {
5785
5825
  type: Boolean,
5786
5826
  default: false
5787
5827
  },
5788
- clearable: {
5828
+ isArrowCenter: {
5789
5829
  type: Boolean,
5790
- default: false
5791
- },
5792
- placeholder: {
5793
- type: String,
5794
- default: ""
5795
- }
5796
- };
5797
- const formItemProps = {
5798
- label: {
5799
- type: String
5800
- },
5801
- field: {
5802
- type: String,
5803
- default: ""
5830
+ default: true
5804
5831
  },
5805
- required: {
5832
+ clickEventBubble: {
5806
5833
  type: Boolean,
5807
5834
  default: false
5808
- },
5809
- messageType: {
5810
- type: String
5811
- },
5812
- popPosition: {
5813
- type: Array
5814
- },
5815
- rules: {
5816
- type: [Object, Array]
5817
- },
5818
- showFeedback: {
5819
- type: Boolean,
5820
- default: void 0
5821
- },
5822
- helpTips: {
5823
- type: String,
5824
- default: ""
5825
- },
5826
- feedbackStatus: {
5827
- type: String
5828
- },
5829
- extraInfo: {
5830
- type: String,
5831
- default: ""
5832
5835
  }
5833
5836
  };
5834
- const FORM_ITEM_TOKEN = Symbol("dFormItem");
5835
- const LABEL_DATA = Symbol("labelData");
5836
- const formProps = {
5837
- data: {
5838
- type: Object,
5839
- default: () => ({})
5840
- },
5841
- layout: {
5842
- type: String,
5843
- default: "horizontal"
5844
- },
5845
- labelSize: {
5846
- type: String,
5847
- default: "md"
5848
- },
5849
- labelAlign: {
5850
- type: String,
5851
- default: "start"
5852
- },
5853
- rules: {
5854
- type: Object
5855
- },
5856
- messageType: {
5857
- type: String,
5858
- default: "popover"
5859
- },
5860
- popPosition: {
5861
- type: Array,
5862
- default: ["right", "bottom"]
5863
- },
5864
- validateOnRuleChange: {
5865
- type: Boolean,
5866
- default: false
5867
- },
5868
- showFeedback: {
5869
- type: Boolean,
5870
- default: false
5871
- },
5872
- disabled: {
5873
- type: Boolean,
5874
- default: false
5875
- },
5876
- size: {
5877
- type: String
5837
+ function getScrollParent(element) {
5838
+ const overflowRegex = /(auto|scroll|hidden)/;
5839
+ for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
5840
+ const style = window.getComputedStyle(parent);
5841
+ if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
5842
+ return parent;
5843
+ }
5878
5844
  }
5879
- };
5880
- const FORM_TOKEN = Symbol("dForm");
5881
- function useFieldCollection() {
5882
- const itemContexts = [];
5883
- const addItemContext = (field) => {
5884
- itemContexts.push(field);
5885
- };
5886
- const removeItemContext = (field) => {
5887
- itemContexts.splice(itemContexts.indexOf(field), 1);
5888
- };
5889
- return { itemContexts, addItemContext, removeItemContext };
5845
+ return window;
5890
5846
  }
5891
- function useFormValidation(itemContexts) {
5892
- const getValidateFields = (fields) => {
5893
- if (!itemContexts.length) {
5894
- return [];
5895
- }
5896
- const normalizedFields = lodash.exports.castArray(fields);
5897
- const filteredFields = normalizedFields.length ? itemContexts.filter((context) => context.field && normalizedFields.includes(context.field)) : itemContexts;
5898
- if (!filteredFields.length) {
5899
- return [];
5847
+ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
5848
+ let { x, y } = point;
5849
+ if (!isArrowCenter) {
5850
+ const { width, height } = originRect;
5851
+ if (x && placement.includes("start")) {
5852
+ x = 12;
5900
5853
  }
5901
- return filteredFields;
5902
- };
5903
- const execValidateFields = async (fields = []) => {
5904
- const validateFields2 = getValidateFields(fields);
5905
- if (!validateFields2.length) {
5906
- return true;
5854
+ if (x && placement.includes("end")) {
5855
+ x = Math.round(width - 24);
5907
5856
  }
5908
- let errors = {};
5909
- for (const field of validateFields2) {
5910
- try {
5911
- await field.validate("");
5912
- } catch (err) {
5913
- errors = __spreadValues(__spreadValues({}, errors), err);
5914
- }
5857
+ if (y && placement.includes("start")) {
5858
+ y = 10;
5915
5859
  }
5916
- if (!Object.keys(errors).length) {
5917
- return true;
5860
+ if (y && placement.includes("end")) {
5861
+ y = height - 14;
5918
5862
  }
5919
- return Promise.reject(errors);
5863
+ }
5864
+ return { x, y };
5865
+ }
5866
+ function useOverlay(props, emit) {
5867
+ const overlayRef = ref();
5868
+ const arrowRef = ref();
5869
+ let originParent = null;
5870
+ const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
5871
+ const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
5872
+ const staticSide = {
5873
+ top: "bottom",
5874
+ right: "left",
5875
+ bottom: "top",
5876
+ left: "right"
5877
+ }[placement.split("-")[0]];
5878
+ Object.assign(arrowEl.style, {
5879
+ left: x ? `${x}px` : "",
5880
+ top: y ? `${y}px` : "",
5881
+ right: "",
5882
+ bottom: "",
5883
+ [staticSide]: "-4px"
5884
+ });
5920
5885
  };
5921
- const validateFields = async (fields = [], callback) => {
5922
- try {
5923
- const result = await execValidateFields(fields);
5924
- if (result) {
5925
- callback == null ? void 0 : callback(result);
5926
- }
5927
- return result;
5928
- } catch (err) {
5929
- const invalidFields = err;
5930
- callback == null ? void 0 : callback(false, invalidFields);
5931
- return !callback && Promise.reject(invalidFields);
5886
+ const updatePosition = async () => {
5887
+ const hostEl = props.origin;
5888
+ const overlayEl = unref(overlayRef.value);
5889
+ const arrowEl = unref(arrowRef.value);
5890
+ const middleware = [
5891
+ offset(props.offset),
5892
+ autoPlacement({
5893
+ alignment: props.align,
5894
+ allowedPlacements: props.position
5895
+ })
5896
+ ];
5897
+ props.showArrow && middleware.push(arrow({ element: arrowEl }));
5898
+ props.shiftOffset !== void 0 && middleware.push(shift());
5899
+ const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
5900
+ strategy: "fixed",
5901
+ middleware
5902
+ });
5903
+ let applyX = x;
5904
+ let applyY = y;
5905
+ if (props.shiftOffset !== void 0) {
5906
+ const { x: shiftX, y: shiftY } = middlewareData.shift;
5907
+ shiftX < 0 && (applyX -= props.shiftOffset);
5908
+ shiftX > 0 && (applyX += props.shiftOffset);
5909
+ shiftY < 0 && (applyY -= props.shiftOffset);
5910
+ shiftY > 0 && (applyY += props.shiftOffset);
5932
5911
  }
5912
+ emit("positionChange", placement);
5913
+ Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
5914
+ props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
5933
5915
  };
5934
- const validate = async (callback) => validateFields(void 0, callback);
5935
- const clearValidate = (fields = []) => {
5936
- getValidateFields(fields).forEach((field) => field.clearValidate());
5937
- };
5938
- const resetFields = (fields = []) => {
5939
- getValidateFields(fields).forEach((field) => field.resetField());
5940
- };
5941
- return { validate, validateFields, resetFields, clearValidate };
5916
+ watch(() => props.modelValue, () => {
5917
+ if (props.modelValue && props.origin) {
5918
+ originParent = getScrollParent(props.origin);
5919
+ nextTick(updatePosition);
5920
+ originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
5921
+ originParent !== window && window.addEventListener("scroll", updatePosition);
5922
+ window.addEventListener("resize", updatePosition);
5923
+ } else {
5924
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
5925
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
5926
+ window.removeEventListener("resize", updatePosition);
5927
+ }
5928
+ });
5929
+ onUnmounted(() => {
5930
+ originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
5931
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
5932
+ window.removeEventListener("resize", updatePosition);
5933
+ });
5934
+ return { arrowRef, overlayRef, updatePosition };
5942
5935
  }
5943
- defineComponent({
5944
- name: "DForm",
5945
- props: formProps,
5946
- emits: ["validate"],
5947
- setup(props, ctx) {
5948
- const ns2 = useNamespace("form");
5936
+ var flexibleOverlay = "";
5937
+ const FlexibleOverlay = defineComponent({
5938
+ name: "DFlexibleOverlay",
5939
+ inheritAttrs: false,
5940
+ props: flexibleOverlayProps,
5941
+ emits: ["update:modelValue", "positionChange"],
5942
+ setup(props, {
5943
+ slots,
5944
+ attrs,
5945
+ emit,
5946
+ expose
5947
+ }) {
5948
+ const ns2 = useNamespace("flexible-overlay");
5949
5949
  const {
5950
- itemContexts,
5951
- addItemContext,
5952
- removeItemContext
5953
- } = useFieldCollection();
5950
+ clickEventBubble
5951
+ } = toRefs(props);
5954
5952
  const {
5955
- validate,
5956
- validateFields,
5957
- resetFields,
5958
- clearValidate
5959
- } = useFormValidation(itemContexts);
5960
- const onSubmit = (e) => {
5961
- e.preventDefault();
5962
- };
5963
- watch(() => props.rules, () => {
5964
- if (props.validateOnRuleChange) {
5965
- validate();
5966
- }
5967
- }, {
5968
- deep: true
5969
- });
5970
- provide(FORM_TOKEN, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
5971
- emit: ctx.emit,
5972
- addItemContext,
5973
- removeItemContext
5974
- })));
5975
- ctx.expose({
5976
- validate,
5977
- validateFields,
5978
- resetFields,
5979
- clearValidate
5953
+ arrowRef,
5954
+ overlayRef,
5955
+ updatePosition
5956
+ } = useOverlay(props, emit);
5957
+ expose({
5958
+ updatePosition
5980
5959
  });
5981
5960
  return () => {
5982
- var _a, _b;
5983
- return createVNode("form", {
5984
- "onSubmit": onSubmit,
5961
+ var _a;
5962
+ return props.modelValue && createVNode("div", mergeProps({
5963
+ "ref": overlayRef,
5985
5964
  "class": ns2.b()
5986
- }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
5965
+ }, attrs, {
5966
+ "onClick": withModifiers(() => ({}), [clickEventBubble.value ? "" : "stop"]),
5967
+ "onPointerup": withModifiers(() => ({}), ["stop"])
5968
+ }), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
5969
+ "ref": arrowRef,
5970
+ "class": ns2.e("arrow")
5971
+ }, null)]);
5987
5972
  };
5988
5973
  }
5989
5974
  });
5990
- const formLabelProps = {
5991
- helpTips: {
5992
- type: String,
5993
- default: ""
5994
- }
5995
- };
5996
- const fixedOverlayProps = {
5997
- modelValue: {
5998
- type: Boolean,
5999
- default: false
6000
- },
6001
- lockScroll: {
6002
- type: Boolean,
6003
- default: true
6004
- },
6005
- closeOnClickOverlay: {
6006
- type: Boolean,
6007
- default: true
6008
- }
6009
- };
6010
- function lockScroll() {
6011
- if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
6012
- const scrollTop = document.documentElement.scrollTop;
6013
- const style = document.documentElement.getAttribute("style");
6014
- document.documentElement.style.position = "fixed";
6015
- document.documentElement.style.top = `-${scrollTop}px`;
6016
- document.documentElement.style.width = document.documentElement.style.width || "100%";
6017
- document.documentElement.style.overflowY = "scroll";
6018
- return () => {
6019
- if (style) {
6020
- document.documentElement.setAttribute("style", style);
6021
- } else {
6022
- document.documentElement.removeAttribute("style");
6023
- }
6024
- document.documentElement.scrollTop = scrollTop;
6025
- };
6026
- }
6027
- return;
5975
+ const POPPER_TRIGGER_TOKEN = Symbol("popper-trigger");
5976
+ const isObject = (val) => val !== null && typeof val === "object";
5977
+ const ns$1 = useNamespace("popper-trigger");
5978
+ function wrapContent(content) {
5979
+ return h("span", { class: ns$1.b() }, content);
6028
5980
  }
6029
- function useFixedOverlay(props, ctx) {
6030
- let lockScrollCb;
6031
- const onClick = (event) => {
6032
- event.preventDefault();
6033
- ctx.emit("click", event);
6034
- if (props.closeOnClickOverlay) {
6035
- ctx.emit("update:modelValue", false);
6036
- }
6037
- };
6038
- const removeBodyAdditions = () => {
6039
- lockScrollCb == null ? void 0 : lockScrollCb();
6040
- };
6041
- watch(() => props.modelValue, (val) => {
6042
- if (val) {
6043
- props.lockScroll && (lockScrollCb = lockScroll());
6044
- } else {
6045
- removeBodyAdditions();
5981
+ function getFirstValidChild(nodes) {
5982
+ for (const child of nodes) {
5983
+ if (isObject(child)) {
5984
+ if (child.type === Comment) {
5985
+ continue;
5986
+ }
5987
+ if (child.type === "svg" || child.type === Text) {
5988
+ return wrapContent(child);
5989
+ }
5990
+ if (child.type === Fragment) {
5991
+ return getFirstValidChild(child.children);
5992
+ }
5993
+ return child;
6046
5994
  }
6047
- });
6048
- onUnmounted(removeBodyAdditions);
6049
- return { onClick };
5995
+ return wrapContent(child);
5996
+ }
5997
+ return null;
6050
5998
  }
6051
- var fixedOverlay = "";
6052
- defineComponent({
6053
- name: "DFixedOverlay",
6054
- inheritAttrs: false,
6055
- props: fixedOverlayProps,
6056
- emits: ["update:modelValue", "click"],
6057
- setup(props, ctx) {
6058
- const {
6059
- modelValue
6060
- } = toRefs(props);
6061
- const ns2 = useNamespace("fixed-overlay");
5999
+ var PopperTrigger = defineComponent({
6000
+ name: "DPopperTrigger",
6001
+ setup(_, ctx) {
6062
6002
  const {
6063
- onClick
6064
- } = useFixedOverlay(props, ctx);
6065
- return () => createVNode(Transition, {
6066
- "name": ns2.m("fade")
6067
- }, {
6068
- default: () => {
6069
- var _a, _b;
6070
- return [modelValue.value && createVNode("div", mergeProps({
6071
- "class": ns2.b()
6072
- }, ctx.attrs, {
6073
- "onClick": onClick
6074
- }), [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
6003
+ slots,
6004
+ attrs
6005
+ } = ctx;
6006
+ return () => {
6007
+ var _a;
6008
+ const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots, attrs);
6009
+ const triggerRef = inject(POPPER_TRIGGER_TOKEN);
6010
+ if (!defaultSlot) {
6011
+ return null;
6075
6012
  }
6076
- });
6013
+ const firstValidChild = getFirstValidChild(defaultSlot);
6014
+ if (!firstValidChild) {
6015
+ return null;
6016
+ }
6017
+ return withDirectives(cloneVNode(firstValidChild, attrs), [[{
6018
+ mounted(el) {
6019
+ triggerRef.value = el;
6020
+ },
6021
+ updated(el) {
6022
+ triggerRef.value = el;
6023
+ },
6024
+ unmounted() {
6025
+ triggerRef.value = null;
6026
+ }
6027
+ }]]);
6028
+ };
6077
6029
  }
6078
6030
  });
6079
- const flexibleOverlayProps = {
6080
- modelValue: {
6031
+ const popoverProps = {
6032
+ isOpen: {
6081
6033
  type: Boolean,
6082
6034
  default: false
6083
6035
  },
6084
- origin: {
6085
- type: Object,
6086
- require: true
6087
- },
6088
6036
  position: {
6089
6037
  type: Array,
6090
6038
  default: ["bottom"]
6091
6039
  },
6040
+ align: {
6041
+ type: String,
6042
+ default: null
6043
+ },
6092
6044
  offset: {
6093
6045
  type: [Number, Object],
6094
6046
  default: 8
6095
6047
  },
6096
- shiftOffset: {
6097
- type: Number
6048
+ content: {
6049
+ type: String,
6050
+ default: ""
6098
6051
  },
6099
- align: {
6052
+ trigger: {
6100
6053
  type: String,
6101
- default: null
6054
+ default: "click"
6102
6055
  },
6103
- showArrow: {
6104
- type: Boolean,
6105
- default: false
6056
+ popType: {
6057
+ type: String,
6058
+ default: "default"
6106
6059
  },
6107
- isArrowCenter: {
6060
+ showAnimation: {
6108
6061
  type: Boolean,
6109
6062
  default: true
6110
6063
  },
6111
- clickEventBubble: {
6064
+ mouseEnterDelay: {
6065
+ type: Number,
6066
+ default: 150
6067
+ },
6068
+ mouseLeaveDelay: {
6069
+ type: Number,
6070
+ default: 100
6071
+ },
6072
+ disabled: {
6112
6073
  type: Boolean,
6113
6074
  default: false
6114
6075
  }
6115
6076
  };
6116
- function getScrollParent(element) {
6117
- const overflowRegex = /(auto|scroll|hidden)/;
6118
- for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
6119
- const style = window.getComputedStyle(parent);
6120
- if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
6121
- return parent;
6077
+ const TransformOriginMap = {
6078
+ top: "50% calc(100% + 8px)",
6079
+ bottom: "50% -8px",
6080
+ left: "calc(100% + 8px)",
6081
+ right: "-8px 50%"
6082
+ };
6083
+ function usePopover(props, visible, placement, origin, popoverRef) {
6084
+ const { trigger, isOpen } = toRefs(props);
6085
+ const overlayStyles = computed(() => ({
6086
+ zIndex: "var(--devui-z-index-pop-up, 1060)",
6087
+ transformOrigin: TransformOriginMap[placement.value]
6088
+ }));
6089
+ const onDocumentClick = (e) => {
6090
+ var _a, _b;
6091
+ if (!((_a = origin.value) == null ? void 0 : _a.contains(e.target)) && !((_b = popoverRef.value.$el) == null ? void 0 : _b.contains(e.target))) {
6092
+ visible.value = false;
6122
6093
  }
6123
- }
6124
- return window;
6094
+ };
6095
+ watch(isOpen, (isOpenVal) => {
6096
+ visible.value = isOpenVal;
6097
+ });
6098
+ watch(visible, () => {
6099
+ if (visible.value && trigger.value !== "manually") {
6100
+ document.addEventListener("click", onDocumentClick);
6101
+ } else {
6102
+ document.removeEventListener("click", onDocumentClick);
6103
+ }
6104
+ });
6105
+ onUnmounted(() => {
6106
+ document.removeEventListener("click", onDocumentClick);
6107
+ });
6108
+ return { overlayStyles };
6125
6109
  }
6126
- function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
6127
- let { x, y } = point;
6128
- if (!isArrowCenter) {
6129
- const { width, height } = originRect;
6130
- if (x && placement.includes("start")) {
6131
- x = 12;
6110
+ function usePopoverEvent(props, visible, origin) {
6111
+ const { trigger, position, mouseEnterDelay, mouseLeaveDelay, disabled } = toRefs(props);
6112
+ const isClick = computed(() => trigger.value === "click");
6113
+ const placement = ref(position.value[0].split("-")[0]);
6114
+ const isEnter = ref(false);
6115
+ const onClick = () => {
6116
+ if (disabled.value) {
6117
+ return;
6132
6118
  }
6133
- if (x && placement.includes("end")) {
6134
- x = Math.round(width - 24);
6119
+ isClick.value && (visible.value = !visible.value);
6120
+ };
6121
+ const enter = lodash.exports.debounce(() => {
6122
+ isEnter.value && (visible.value = true);
6123
+ }, mouseEnterDelay.value);
6124
+ const leave = lodash.exports.debounce(() => {
6125
+ !isEnter.value && (visible.value = false);
6126
+ }, mouseLeaveDelay.value);
6127
+ const onMouseenter = () => {
6128
+ if (disabled.value) {
6129
+ return;
6135
6130
  }
6136
- if (y && placement.includes("start")) {
6137
- y = 10;
6131
+ if (!isClick.value) {
6132
+ isEnter.value = true;
6133
+ enter();
6138
6134
  }
6139
- if (y && placement.includes("end")) {
6140
- y = height - 14;
6135
+ };
6136
+ const onMouseleave = () => {
6137
+ if (!isClick.value) {
6138
+ isEnter.value = false;
6139
+ leave();
6141
6140
  }
6142
- }
6143
- return { x, y };
6144
- }
6145
- function useOverlay(props, emit) {
6146
- const overlayRef = ref();
6147
- const arrowRef = ref();
6148
- let originParent = null;
6149
- const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
6150
- const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
6151
- const staticSide = {
6152
- top: "bottom",
6153
- right: "left",
6154
- bottom: "top",
6155
- left: "right"
6156
- }[placement.split("-")[0]];
6157
- Object.assign(arrowEl.style, {
6158
- left: x ? `${x}px` : "",
6159
- top: y ? `${y}px` : "",
6160
- right: "",
6161
- bottom: "",
6162
- [staticSide]: "-4px"
6163
- });
6164
6141
  };
6165
- const updatePosition = async () => {
6166
- const hostEl = props.origin;
6167
- const overlayEl = unref(overlayRef.value);
6168
- const arrowEl = unref(arrowRef.value);
6169
- const middleware = [
6170
- offset(props.offset),
6171
- autoPlacement({
6172
- alignment: props.align,
6173
- allowedPlacements: props.position
6174
- })
6175
- ];
6176
- props.showArrow && middleware.push(arrow({ element: arrowEl }));
6177
- props.shiftOffset !== void 0 && middleware.push(shift());
6178
- const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
6179
- strategy: "fixed",
6180
- middleware
6181
- });
6182
- let applyX = x;
6183
- let applyY = y;
6184
- if (props.shiftOffset !== void 0) {
6185
- const { x: shiftX, y: shiftY } = middlewareData.shift;
6186
- shiftX < 0 && (applyX -= props.shiftOffset);
6187
- shiftX > 0 && (applyX += props.shiftOffset);
6188
- shiftY < 0 && (applyY -= props.shiftOffset);
6189
- shiftY > 0 && (applyY += props.shiftOffset);
6190
- }
6191
- emit("positionChange", placement);
6192
- Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
6193
- props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
6142
+ const quickLeave = () => {
6143
+ isEnter.value = false;
6144
+ visible.value = false;
6194
6145
  };
6195
- watch(() => props.modelValue, () => {
6196
- if (props.modelValue && props.origin) {
6197
- originParent = getScrollParent(props.origin);
6198
- nextTick(updatePosition);
6199
- originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
6200
- originParent !== window && window.addEventListener("scroll", updatePosition);
6201
- window.addEventListener("resize", updatePosition);
6202
- } else {
6203
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
6204
- originParent !== window && window.removeEventListener("scroll", updatePosition);
6205
- window.removeEventListener("resize", updatePosition);
6146
+ watch(disabled, (newVal) => {
6147
+ if (newVal && visible.value) {
6148
+ quickLeave();
6206
6149
  }
6207
6150
  });
6208
- onUnmounted(() => {
6209
- originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
6210
- originParent !== window && window.removeEventListener("scroll", updatePosition);
6211
- window.removeEventListener("resize", updatePosition);
6151
+ const handlePositionChange = (pos) => {
6152
+ placement.value = pos.split("-")[0];
6153
+ };
6154
+ onMounted(() => {
6155
+ if (trigger.value === "click") {
6156
+ origin.value.addEventListener("click", onClick);
6157
+ } else if (trigger.value === "hover") {
6158
+ origin.value.addEventListener("mouseenter", onMouseenter);
6159
+ origin.value.addEventListener("mouseleave", onMouseleave);
6160
+ }
6212
6161
  });
6213
- return { arrowRef, overlayRef, updatePosition };
6162
+ return { placement, handlePositionChange, onMouseenter, onMouseleave };
6214
6163
  }
6215
- var flexibleOverlay = "";
6216
- const FlexibleOverlay = defineComponent({
6217
- name: "DFlexibleOverlay",
6164
+ const ns = useNamespace("popover");
6165
+ function SuccessIcon$1() {
6166
+ return createVNode("svg", {
6167
+ "class": [ns.e("icon"), ns.em("icon", "success")],
6168
+ "viewBox": "0 0 16 16",
6169
+ "version": "1.1",
6170
+ "xmlns": "http://www.w3.org/2000/svg"
6171
+ }, [createVNode("g", {
6172
+ "stroke": "none",
6173
+ "stroke-width": "1",
6174
+ "fill": "none",
6175
+ "fill-rule": "evenodd"
6176
+ }, [createVNode("circle", {
6177
+ "cx": "8",
6178
+ "cy": "8",
6179
+ "r": "7"
6180
+ }, null), createVNode("path", {
6181
+ "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",
6182
+ "fill-rule": "nonzero"
6183
+ }, null), createVNode("polygon", {
6184
+ "stroke-width": "0.4",
6185
+ "fill-rule": "nonzero",
6186
+ "points": "8.16 10.48 7.32 11.32 6.48 10.48 6.48 10.48 3.6 7.68 4.44 6.84 7.28 9.68 11.52 5.44 12.36 6.28"
6187
+ }, null)])]);
6188
+ }
6189
+ function WarningIcon() {
6190
+ return createVNode("svg", {
6191
+ "class": [ns.e("icon"), ns.em("icon", "warning")],
6192
+ "viewBox": "0 0 16 16",
6193
+ "version": "1.1",
6194
+ "xmlns": "http://www.w3.org/2000/svg"
6195
+ }, [createVNode("g", {
6196
+ "stroke": "none",
6197
+ "stroke-width": "1",
6198
+ "fill": "none",
6199
+ "fill-rule": "evenodd"
6200
+ }, [createVNode("polygon", {
6201
+ "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"
6202
+ }, null), createVNode("path", {
6203
+ "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"
6204
+ }, null)])]);
6205
+ }
6206
+ function InfoIcon() {
6207
+ return createVNode("svg", {
6208
+ "class": [ns.e("icon"), ns.em("icon", "info")],
6209
+ "viewBox": "0 0 16 16",
6210
+ "version": "1.1",
6211
+ "xmlns": "http://www.w3.org/2000/svg"
6212
+ }, [createVNode("g", {
6213
+ "stroke": "none",
6214
+ "stroke-width": "1",
6215
+ "fill": "none",
6216
+ "fill-rule": "evenodd"
6217
+ }, [createVNode("circle", {
6218
+ "cx": "8",
6219
+ "cy": "8",
6220
+ "r": "7"
6221
+ }, null), createVNode("g", {
6222
+ "stroke-width": "1"
6223
+ }, [createVNode("path", {
6224
+ "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"
6225
+ }, null)])])]);
6226
+ }
6227
+ function ErrorIcon$1() {
6228
+ return createVNode("svg", {
6229
+ "class": [ns.e("icon"), ns.em("icon", "error")],
6230
+ "width": "16px",
6231
+ "height": "16px",
6232
+ "viewBox": "0 0 16 16",
6233
+ "version": "1.1",
6234
+ "xmlns": "http://www.w3.org/2000/svg"
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": "7"
6244
+ }, null), createVNode("path", {
6245
+ "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",
6246
+ "fill-rule": "nonzero"
6247
+ }, null)])]);
6248
+ }
6249
+ var popoverIcon = "";
6250
+ var PopoverIcon = defineComponent({
6251
+ props: {
6252
+ type: {
6253
+ type: String,
6254
+ default: "default"
6255
+ }
6256
+ },
6257
+ setup(props) {
6258
+ const ns2 = useNamespace("popover");
6259
+ return () => props.type && props.type !== "default" && createVNode("span", {
6260
+ "class": ns2.e("icon-wrap")
6261
+ }, [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)]);
6262
+ }
6263
+ });
6264
+ var popover = "";
6265
+ var Popover = defineComponent({
6266
+ name: "DPopover",
6218
6267
  inheritAttrs: false,
6219
- props: flexibleOverlayProps,
6220
- emits: ["update:modelValue", "positionChange"],
6268
+ props: popoverProps,
6269
+ emits: ["show", "hide"],
6221
6270
  setup(props, {
6222
6271
  slots,
6223
6272
  attrs,
6224
- emit,
6225
- expose
6273
+ emit
6226
6274
  }) {
6227
- const ns2 = useNamespace("flexible-overlay");
6228
6275
  const {
6229
- clickEventBubble
6276
+ content,
6277
+ popType,
6278
+ position,
6279
+ align,
6280
+ offset: offset2,
6281
+ showAnimation
6230
6282
  } = toRefs(props);
6283
+ const origin = ref();
6284
+ const popoverRef = ref();
6285
+ const visible = ref(false);
6231
6286
  const {
6232
- arrowRef,
6233
- overlayRef,
6234
- updatePosition
6235
- } = useOverlay(props, emit);
6236
- expose({
6237
- updatePosition
6238
- });
6239
- return () => {
6240
- var _a;
6241
- return props.modelValue && createVNode("div", mergeProps({
6242
- "ref": overlayRef,
6243
- "class": ns2.b()
6244
- }, attrs, {
6245
- "onClick": withModifiers(() => ({}), [clickEventBubble.value ? "" : "stop"]),
6246
- "onPointerup": withModifiers(() => ({}), ["stop"])
6247
- }), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
6248
- "ref": arrowRef,
6249
- "class": ns2.e("arrow")
6250
- }, null)]);
6251
- };
6252
- }
6253
- });
6254
- const POPPER_TRIGGER_TOKEN = Symbol("popper-trigger");
6255
- const isObject = (val) => val !== null && typeof val === "object";
6256
- const ns$1 = useNamespace("popper-trigger");
6257
- function wrapContent(content) {
6258
- return h("span", { class: ns$1.b() }, content);
6259
- }
6260
- function getFirstValidChild(nodes) {
6261
- for (const child of nodes) {
6262
- if (isObject(child)) {
6263
- if (child.type === Comment) {
6264
- continue;
6287
+ placement,
6288
+ handlePositionChange,
6289
+ onMouseenter,
6290
+ onMouseleave
6291
+ } = usePopoverEvent(props, visible, origin);
6292
+ const {
6293
+ overlayStyles
6294
+ } = usePopover(props, visible, placement, origin, popoverRef);
6295
+ const ns2 = useNamespace("popover");
6296
+ provide(POPPER_TRIGGER_TOKEN, origin);
6297
+ watch(visible, (newVal) => {
6298
+ if (newVal) {
6299
+ emit("show");
6300
+ } else {
6301
+ emit("hide");
6265
6302
  }
6266
- if (child.type === "svg" || child.type === Text) {
6267
- return wrapContent(child);
6303
+ });
6304
+ return () => createVNode(Fragment, null, [createVNode(PopperTrigger, null, {
6305
+ default: () => {
6306
+ var _a;
6307
+ return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
6268
6308
  }
6269
- if (child.type === Fragment) {
6270
- return getFirstValidChild(child.children);
6271
- }
6272
- return child;
6273
- }
6274
- return wrapContent(child);
6275
- }
6276
- return null;
6277
- }
6278
- var PopperTrigger = defineComponent({
6279
- name: "DPopperTrigger",
6280
- setup(_, ctx) {
6281
- const {
6282
- slots,
6283
- attrs
6284
- } = ctx;
6285
- return () => {
6286
- var _a;
6287
- const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots, attrs);
6288
- const triggerRef = inject(POPPER_TRIGGER_TOKEN);
6289
- if (!defaultSlot) {
6290
- return null;
6291
- }
6292
- const firstValidChild = getFirstValidChild(defaultSlot);
6293
- if (!firstValidChild) {
6294
- return null;
6295
- }
6296
- return withDirectives(cloneVNode(firstValidChild, attrs), [[{
6297
- mounted(el) {
6298
- triggerRef.value = el;
6299
- },
6300
- updated(el) {
6301
- triggerRef.value = el;
6302
- },
6303
- unmounted() {
6304
- triggerRef.value = null;
6305
- }
6306
- }]]);
6307
- };
6309
+ }), createVNode(Teleport, {
6310
+ "to": "body"
6311
+ }, {
6312
+ default: () => [createVNode(Transition, {
6313
+ "name": showAnimation.value ? ns2.m(`fade-${placement.value}`) : ""
6314
+ }, {
6315
+ default: () => [createVNode(FlexibleOverlay, mergeProps({
6316
+ "modelValue": visible.value,
6317
+ "onUpdate:modelValue": ($event) => visible.value = $event,
6318
+ "ref": popoverRef,
6319
+ "origin": origin.value,
6320
+ "position": position.value,
6321
+ "align": align.value,
6322
+ "offset": offset2.value,
6323
+ "class": [ns2.e("content"), popType.value !== "default" ? "is-icon" : ""],
6324
+ "show-arrow": true,
6325
+ "is-arrow-center": false,
6326
+ "style": overlayStyles.value
6327
+ }, attrs, {
6328
+ "onPositionChange": handlePositionChange,
6329
+ "onMouseenter": onMouseenter,
6330
+ "onMouseleave": onMouseleave
6331
+ }), {
6332
+ default: () => {
6333
+ var _a;
6334
+ return [createVNode(PopoverIcon, {
6335
+ "type": popType.value
6336
+ }, null), ((_a = slots.content) == null ? void 0 : _a.call(slots)) || createVNode("span", null, [content.value])];
6337
+ }
6338
+ })]
6339
+ })]
6340
+ })]);
6308
6341
  }
6309
6342
  });
6310
- const popoverProps = {
6311
- isOpen: {
6312
- type: Boolean,
6313
- default: false
6314
- },
6315
- position: {
6316
- type: Array,
6317
- default: ["bottom"]
6318
- },
6319
- align: {
6320
- type: String,
6321
- default: null
6322
- },
6323
- offset: {
6324
- type: [Number, Object],
6325
- default: 8
6326
- },
6327
- content: {
6328
- type: String,
6329
- default: ""
6330
- },
6331
- trigger: {
6332
- type: String,
6333
- default: "click"
6334
- },
6335
- popType: {
6336
- type: String,
6337
- default: "default"
6338
- },
6339
- showAnimation: {
6340
- type: Boolean,
6341
- default: true
6342
- },
6343
- mouseEnterDelay: {
6344
- type: Number,
6345
- default: 150
6346
- },
6347
- mouseLeaveDelay: {
6348
- type: Number,
6349
- default: 100
6350
- },
6351
- disabled: {
6352
- type: Boolean,
6353
- default: false
6354
- }
6355
- };
6356
- const TransformOriginMap = {
6357
- top: "50% calc(100% + 8px)",
6358
- bottom: "50% -8px",
6359
- left: "calc(100% + 8px)",
6360
- right: "-8px 50%"
6361
- };
6362
- function usePopover(props, visible, placement, origin, popoverRef) {
6363
- const { trigger, isOpen } = toRefs(props);
6364
- const overlayStyles = computed(() => ({
6365
- zIndex: "var(--devui-z-index-pop-up, 1060)",
6366
- transformOrigin: TransformOriginMap[placement.value]
6367
- }));
6368
- const onDocumentClick = (e) => {
6369
- var _a, _b;
6370
- if (!((_a = origin.value) == null ? void 0 : _a.contains(e.target)) && !((_b = popoverRef.value.$el) == null ? void 0 : _b.contains(e.target))) {
6371
- visible.value = false;
6372
- }
6373
- };
6374
- watch(isOpen, (isOpenVal) => {
6375
- visible.value = isOpenVal;
6376
- });
6377
- watch(visible, () => {
6378
- if (visible.value && trigger.value !== "manually") {
6379
- document.addEventListener("click", onDocumentClick);
6380
- } else {
6381
- document.removeEventListener("click", onDocumentClick);
6382
- }
6383
- });
6384
- onUnmounted(() => {
6385
- document.removeEventListener("click", onDocumentClick);
6386
- });
6387
- return { overlayStyles };
6388
- }
6389
- function usePopoverEvent(props, visible, origin) {
6390
- const { trigger, position, mouseEnterDelay, mouseLeaveDelay, disabled } = toRefs(props);
6391
- const isClick = computed(() => trigger.value === "click");
6392
- const placement = ref(position.value[0].split("-")[0]);
6393
- const isEnter = ref(false);
6394
- const onClick = () => {
6395
- if (disabled.value) {
6396
- return;
6397
- }
6398
- isClick.value && (visible.value = !visible.value);
6399
- };
6400
- const enter = lodash.exports.debounce(() => {
6401
- isEnter.value && (visible.value = true);
6402
- }, mouseEnterDelay.value);
6403
- const leave = lodash.exports.debounce(() => {
6404
- !isEnter.value && (visible.value = false);
6405
- }, mouseLeaveDelay.value);
6406
- const onMouseenter = () => {
6407
- if (disabled.value) {
6408
- return;
6409
- }
6410
- if (!isClick.value) {
6411
- isEnter.value = true;
6412
- enter();
6413
- }
6414
- };
6415
- const onMouseleave = () => {
6416
- if (!isClick.value) {
6417
- isEnter.value = false;
6418
- leave();
6419
- }
6420
- };
6421
- const quickLeave = () => {
6422
- isEnter.value = false;
6423
- visible.value = false;
6424
- };
6425
- watch(disabled, (newVal) => {
6426
- if (newVal && visible.value) {
6427
- quickLeave();
6428
- }
6429
- });
6430
- const handlePositionChange = (pos) => {
6431
- placement.value = pos.split("-")[0];
6432
- };
6433
- onMounted(() => {
6434
- if (trigger.value === "click") {
6435
- origin.value.addEventListener("click", onClick);
6436
- } else if (trigger.value === "hover") {
6437
- origin.value.addEventListener("mouseenter", onMouseenter);
6438
- origin.value.addEventListener("mouseleave", onMouseleave);
6439
- }
6440
- });
6441
- return { placement, handlePositionChange, onMouseenter, onMouseleave };
6442
- }
6443
- const ns = useNamespace("popover");
6444
- function SuccessIcon$1() {
6343
+ function HelpTipsIcon() {
6445
6344
  return createVNode("svg", {
6446
- "class": [ns.e("icon"), ns.em("icon", "success")],
6447
- "viewBox": "0 0 16 16",
6448
- "version": "1.1",
6449
- "xmlns": "http://www.w3.org/2000/svg"
6345
+ "width": "16px",
6346
+ "height": "16px",
6347
+ "viewBox": "0 0 16 16"
6450
6348
  }, [createVNode("g", {
6451
6349
  "stroke": "none",
6452
6350
  "stroke-width": "1",
6453
6351
  "fill": "none",
6454
6352
  "fill-rule": "evenodd"
6455
- }, [createVNode("circle", {
6456
- "cx": "8",
6457
- "cy": "8",
6458
- "r": "7"
6459
- }, null), createVNode("path", {
6460
- "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",
6353
+ }, [createVNode("g", null, [createVNode("path", {
6354
+ "d": "M8.5,8.95852078 L8.5,11 L7.5,11 L7.5,8.5 C7.5,8.22385763 7.72385763,8 8,8 C9.1045695,8 10,7.1045695 10,6 C10,4.8954305 9.1045695,4 8,4 C6.8954305,4 6,4.8954305 6,6 L5,6 C5,4.34314575 6.34314575,3 8,3 C9.65685425,3 11,4.34314575 11,6 C11,7.48649814 9.91885667,8.72048173 8.5,8.95852078 L8.5,8.95852078 Z M8,16 C3.581722,16 0,12.418278 0,8 C0,3.581722 3.581722,0 8,0 C12.418278,0 16,3.581722 16,8 C16,12.418278 12.418278,16 8,16 Z M8,15 C11.8659932,15 15,11.8659932 15,8 C15,4.13400675 11.8659932,1 8,1 C4.13400675,1 1,4.13400675 1,8 C1,11.8659932 4.13400675,15 8,15 Z M7.5,12 L8.5,12 L8.5,13 L7.5,13 L7.5,12 Z",
6355
+ "fill": "#293040",
6461
6356
  "fill-rule": "nonzero"
6462
- }, null), createVNode("polygon", {
6463
- "stroke-width": "0.4",
6464
- "fill-rule": "nonzero",
6465
- "points": "8.16 10.48 7.32 11.32 6.48 10.48 6.48 10.48 3.6 7.68 4.44 6.84 7.28 9.68 11.52 5.44 12.36 6.28"
6466
- }, null)])]);
6357
+ }, null)])])]);
6467
6358
  }
6468
- function WarningIcon() {
6359
+ function ErrorIcon() {
6469
6360
  return createVNode("svg", {
6470
- "class": [ns.e("icon"), ns.em("icon", "warning")],
6471
- "viewBox": "0 0 16 16",
6472
- "version": "1.1",
6473
- "xmlns": "http://www.w3.org/2000/svg"
6361
+ "width": "14px",
6362
+ "height": "14px",
6363
+ "viewBox": "0 0 16 16"
6474
6364
  }, [createVNode("g", {
6475
6365
  "stroke": "none",
6476
6366
  "stroke-width": "1",
6477
6367
  "fill": "none",
6478
6368
  "fill-rule": "evenodd"
6479
- }, [createVNode("polygon", {
6480
- "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"
6481
- }, null), createVNode("path", {
6482
- "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"
6369
+ }, [createVNode("circle", {
6370
+ "cx": "8",
6371
+ "cy": "8",
6372
+ "r": "8"
6373
+ }, null), createVNode("polygon", {
6374
+ "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"
6483
6375
  }, null)])]);
6484
6376
  }
6485
- function InfoIcon() {
6377
+ function SuccessIcon() {
6486
6378
  return createVNode("svg", {
6487
- "class": [ns.e("icon"), ns.em("icon", "info")],
6488
- "viewBox": "0 0 16 16",
6489
- "version": "1.1",
6490
- "xmlns": "http://www.w3.org/2000/svg"
6491
- }, [createVNode("g", {
6492
- "stroke": "none",
6493
- "stroke-width": "1",
6494
- "fill": "none",
6495
- "fill-rule": "evenodd"
6496
- }, [createVNode("circle", {
6497
- "cx": "8",
6498
- "cy": "8",
6499
- "r": "7"
6500
- }, null), createVNode("g", {
6501
- "stroke-width": "1"
6502
- }, [createVNode("path", {
6503
- "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"
6504
- }, null)])])]);
6505
- }
6506
- function ErrorIcon$1() {
6507
- return createVNode("svg", {
6508
- "class": [ns.e("icon"), ns.em("icon", "error")],
6509
- "width": "16px",
6510
- "height": "16px",
6511
- "viewBox": "0 0 16 16",
6512
- "version": "1.1",
6513
- "xmlns": "http://www.w3.org/2000/svg"
6514
- }, [createVNode("g", {
6515
- "stroke": "none",
6516
- "stroke-width": "1",
6517
- "fill": "none",
6518
- "fill-rule": "evenodd"
6519
- }, [createVNode("circle", {
6520
- "cx": "8",
6521
- "cy": "8",
6522
- "r": "7"
6523
- }, null), createVNode("path", {
6524
- "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",
6525
- "fill-rule": "nonzero"
6526
- }, null)])]);
6527
- }
6528
- var popoverIcon = "";
6529
- var PopoverIcon = defineComponent({
6530
- props: {
6531
- type: {
6532
- type: String,
6533
- default: "default"
6534
- }
6535
- },
6536
- setup(props) {
6537
- const ns2 = useNamespace("popover");
6538
- return () => props.type && props.type !== "default" && createVNode("span", {
6539
- "class": ns2.e("icon-wrap")
6540
- }, [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)]);
6541
- }
6542
- });
6543
- var popover = "";
6544
- var Popover = defineComponent({
6545
- name: "DPopover",
6546
- inheritAttrs: false,
6547
- props: popoverProps,
6548
- emits: ["show", "hide"],
6549
- setup(props, {
6550
- slots,
6551
- attrs,
6552
- emit
6553
- }) {
6554
- const {
6555
- content,
6556
- popType,
6557
- position,
6558
- align,
6559
- offset: offset2,
6560
- showAnimation
6561
- } = toRefs(props);
6562
- const origin = ref();
6563
- const popoverRef = ref();
6564
- const visible = ref(false);
6565
- const {
6566
- placement,
6567
- handlePositionChange,
6568
- onMouseenter,
6569
- onMouseleave
6570
- } = usePopoverEvent(props, visible, origin);
6571
- const {
6572
- overlayStyles
6573
- } = usePopover(props, visible, placement, origin, popoverRef);
6574
- const ns2 = useNamespace("popover");
6575
- provide(POPPER_TRIGGER_TOKEN, origin);
6576
- watch(visible, (newVal) => {
6577
- if (newVal) {
6578
- emit("show");
6579
- } else {
6580
- emit("hide");
6581
- }
6582
- });
6583
- return () => createVNode(Fragment, null, [createVNode(PopperTrigger, null, {
6584
- default: () => {
6585
- var _a;
6586
- return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
6587
- }
6588
- }), createVNode(Teleport, {
6589
- "to": "body"
6590
- }, {
6591
- default: () => [createVNode(Transition, {
6592
- "name": showAnimation.value ? ns2.m(`fade-${placement.value}`) : ""
6593
- }, {
6594
- default: () => [createVNode(FlexibleOverlay, mergeProps({
6595
- "modelValue": visible.value,
6596
- "onUpdate:modelValue": ($event) => visible.value = $event,
6597
- "ref": popoverRef,
6598
- "origin": origin.value,
6599
- "position": position.value,
6600
- "align": align.value,
6601
- "offset": offset2.value,
6602
- "class": [ns2.e("content"), popType.value !== "default" ? "is-icon" : ""],
6603
- "show-arrow": true,
6604
- "is-arrow-center": false,
6605
- "style": overlayStyles.value
6606
- }, attrs, {
6607
- "onPositionChange": handlePositionChange,
6608
- "onMouseenter": onMouseenter,
6609
- "onMouseleave": onMouseleave
6610
- }), {
6611
- default: () => {
6612
- var _a;
6613
- return [createVNode(PopoverIcon, {
6614
- "type": popType.value
6615
- }, null), ((_a = slots.content) == null ? void 0 : _a.call(slots)) || createVNode("span", null, [content.value])];
6616
- }
6617
- })]
6618
- })]
6619
- })]);
6620
- }
6621
- });
6622
- function HelpTipsIcon() {
6623
- return createVNode("svg", {
6624
- "width": "16px",
6625
- "height": "16px",
6626
- "viewBox": "0 0 16 16"
6627
- }, [createVNode("g", {
6628
- "stroke": "none",
6629
- "stroke-width": "1",
6630
- "fill": "none",
6631
- "fill-rule": "evenodd"
6632
- }, [createVNode("g", null, [createVNode("path", {
6633
- "d": "M8.5,8.95852078 L8.5,11 L7.5,11 L7.5,8.5 C7.5,8.22385763 7.72385763,8 8,8 C9.1045695,8 10,7.1045695 10,6 C10,4.8954305 9.1045695,4 8,4 C6.8954305,4 6,4.8954305 6,6 L5,6 C5,4.34314575 6.34314575,3 8,3 C9.65685425,3 11,4.34314575 11,6 C11,7.48649814 9.91885667,8.72048173 8.5,8.95852078 L8.5,8.95852078 Z M8,16 C3.581722,16 0,12.418278 0,8 C0,3.581722 3.581722,0 8,0 C12.418278,0 16,3.581722 16,8 C16,12.418278 12.418278,16 8,16 Z M8,15 C11.8659932,15 15,11.8659932 15,8 C15,4.13400675 11.8659932,1 8,1 C4.13400675,1 1,4.13400675 1,8 C1,11.8659932 4.13400675,15 8,15 Z M7.5,12 L8.5,12 L8.5,13 L7.5,13 L7.5,12 Z",
6634
- "fill": "#293040",
6635
- "fill-rule": "nonzero"
6636
- }, null)])])]);
6637
- }
6638
- function ErrorIcon() {
6639
- return createVNode("svg", {
6640
- "width": "14px",
6641
- "height": "14px",
6642
- "viewBox": "0 0 16 16"
6643
- }, [createVNode("g", {
6644
- "stroke": "none",
6645
- "stroke-width": "1",
6646
- "fill": "none",
6647
- "fill-rule": "evenodd"
6648
- }, [createVNode("circle", {
6649
- "cx": "8",
6650
- "cy": "8",
6651
- "r": "8"
6652
- }, null), createVNode("polygon", {
6653
- "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"
6654
- }, null)])]);
6655
- }
6656
- function SuccessIcon() {
6657
- return createVNode("svg", {
6658
- "width": "14px",
6659
- "height": "14px",
6660
- "viewBox": "0 0 16 16"
6379
+ "width": "14px",
6380
+ "height": "14px",
6381
+ "viewBox": "0 0 16 16"
6661
6382
  }, [createVNode("g", {
6662
6383
  "stroke": "none",
6663
6384
  "stroke-width": "1",
@@ -7883,183 +7604,462 @@ function useFormItemValidate(props, _rules) {
7883
7604
  } else {
7884
7605
  return rule.trigger === triggerVal;
7885
7606
  }
7886
- }).map((_a) => {
7887
- var rule = __objRest(_a, []);
7888
- return rule;
7889
- });
7890
- };
7891
- const onValidateSuccess = () => {
7892
- validateState.value = "success";
7893
- validateMessage.value = "";
7894
- formContext.emit("validate", props.field, true, "");
7895
- };
7896
- const onValidateError = ({ errors }) => {
7897
- var _a;
7898
- validateState.value = "error";
7899
- validateMessage.value = ((_a = errors == null ? void 0 : errors[0]) == null ? void 0 : _a.message) || "";
7900
- formContext.emit("validate", props.field, false, validateMessage.value);
7607
+ }).map((_a) => {
7608
+ var rule = __objRest(_a, []);
7609
+ return rule;
7610
+ });
7611
+ };
7612
+ const onValidateSuccess = () => {
7613
+ validateState.value = "success";
7614
+ validateMessage.value = "";
7615
+ formContext.emit("validate", props.field, true, "");
7616
+ };
7617
+ const onValidateError = ({ errors }) => {
7618
+ var _a;
7619
+ validateState.value = "error";
7620
+ validateMessage.value = ((_a = errors == null ? void 0 : errors[0]) == null ? void 0 : _a.message) || "";
7621
+ formContext.emit("validate", props.field, false, validateMessage.value);
7622
+ };
7623
+ const execValidate = async (rules2) => {
7624
+ const ruleName = computedField.value;
7625
+ const validator = new Schema({
7626
+ [ruleName]: rules2
7627
+ });
7628
+ return validator.validate({ [ruleName]: fieldValue.value }, { firstFields: true }).then(() => {
7629
+ onValidateSuccess();
7630
+ return true;
7631
+ }).catch((error) => {
7632
+ onValidateError(error);
7633
+ return Promise.reject(error);
7634
+ });
7635
+ };
7636
+ const validate = async (trigger, callback) => {
7637
+ if (isResetting) {
7638
+ isResetting = false;
7639
+ return false;
7640
+ }
7641
+ const rules2 = getRuleByTrigger(trigger);
7642
+ if (!rules2.length) {
7643
+ callback == null ? void 0 : callback(true);
7644
+ return true;
7645
+ }
7646
+ validateState.value = "pending";
7647
+ return execValidate(rules2).then(() => {
7648
+ callback == null ? void 0 : callback(true);
7649
+ return true;
7650
+ }).catch((error) => {
7651
+ const { fields } = error;
7652
+ callback == null ? void 0 : callback(false, fields);
7653
+ return lodash.exports.isFunction(callback) ? false : Promise.reject(fields);
7654
+ });
7655
+ };
7656
+ const clearValidate = () => {
7657
+ validateState.value = "";
7658
+ validateMessage.value = "";
7659
+ };
7660
+ const resetField = async () => {
7661
+ if (!formContext.data || !props.field) {
7662
+ return;
7663
+ }
7664
+ const currentValue = getFieldValue(formContext.data, props.field);
7665
+ if (!lodash.exports.isEqual(currentValue.value, initFieldValue)) {
7666
+ isResetting = true;
7667
+ }
7668
+ currentValue.value = initFieldValue;
7669
+ await nextTick();
7670
+ clearValidate();
7671
+ };
7672
+ onMounted(() => {
7673
+ initFieldValue = lodash.exports.clone(fieldValue.value);
7674
+ });
7675
+ return { validateState, validateMessage, validate, resetField, clearValidate };
7676
+ }
7677
+ var formItem = "";
7678
+ defineComponent({
7679
+ name: "DFormItem",
7680
+ props: formItemProps,
7681
+ setup(props, ctx) {
7682
+ const formContext = inject(FORM_TOKEN);
7683
+ const _a = toRefs(props), {
7684
+ messageType: itemMessageType,
7685
+ popPosition: itemPopPosition,
7686
+ showFeedback: itemShowFeedback
7687
+ } = _a, otherProps = __objRest(_a, [
7688
+ "messageType",
7689
+ "popPosition",
7690
+ "showFeedback"
7691
+ ]);
7692
+ const {
7693
+ label,
7694
+ helpTips,
7695
+ feedbackStatus,
7696
+ extraInfo
7697
+ } = toRefs(props);
7698
+ const showFeedback = computed(() => (itemShowFeedback == null ? void 0 : itemShowFeedback.value) !== void 0 ? itemShowFeedback.value : formContext.showFeedback);
7699
+ const messageType = computed(() => (itemMessageType == null ? void 0 : itemMessageType.value) || formContext.messageType);
7700
+ const popPosition = computed(() => (itemPopPosition == null ? void 0 : itemPopPosition.value) || formContext.popPosition);
7701
+ const {
7702
+ _rules
7703
+ } = useFormItemRule(props);
7704
+ const {
7705
+ validateState,
7706
+ validateMessage,
7707
+ validate,
7708
+ resetField,
7709
+ clearValidate
7710
+ } = useFormItemValidate(props, _rules);
7711
+ const {
7712
+ itemClasses,
7713
+ isRequired
7714
+ } = useFormItem(messageType, _rules, validateState);
7715
+ const labelData = computed(() => ({
7716
+ layout: formContext.layout,
7717
+ labelSize: formContext.labelSize,
7718
+ labelAlign: formContext.labelAlign
7719
+ }));
7720
+ provide(LABEL_DATA, labelData);
7721
+ const context = reactive(__spreadProps(__spreadValues({}, otherProps), {
7722
+ showFeedback,
7723
+ messageType,
7724
+ popPosition,
7725
+ isRequired,
7726
+ validateState,
7727
+ validateMessage,
7728
+ validate,
7729
+ resetField,
7730
+ clearValidate
7731
+ }));
7732
+ provide(FORM_ITEM_TOKEN, context);
7733
+ ctx.expose({
7734
+ resetField,
7735
+ clearValidate
7736
+ });
7737
+ onMounted(() => {
7738
+ if (props.field) {
7739
+ formContext == null ? void 0 : formContext.addItemContext(context);
7740
+ }
7741
+ });
7742
+ onBeforeUnmount(() => {
7743
+ formContext == null ? void 0 : formContext.removeItemContext(context);
7744
+ });
7745
+ return () => createVNode("div", {
7746
+ "class": itemClasses.value
7747
+ }, [createVNode(FormLabel, {
7748
+ "help-tips": helpTips.value
7749
+ }, {
7750
+ default: () => [label == null ? void 0 : label.value]
7751
+ }), createVNode(FormControl, {
7752
+ "feedback-status": feedbackStatus == null ? void 0 : feedbackStatus.value,
7753
+ "extra-info": extraInfo.value
7754
+ }, {
7755
+ default: () => {
7756
+ var _a2, _b;
7757
+ return [(_b = (_a2 = ctx.slots).default) == null ? void 0 : _b.call(_a2)];
7758
+ }
7759
+ })]);
7760
+ }
7761
+ });
7762
+ var formOperation = "";
7763
+ defineComponent({
7764
+ name: "DFormOperation",
7765
+ setup(props, ctx) {
7766
+ const formContext = inject(FORM_TOKEN);
7767
+ const LabelSizeMap = {
7768
+ sm: 80,
7769
+ md: 100,
7770
+ lg: 150
7771
+ };
7772
+ const styles = computed(() => ({
7773
+ marginLeft: formContext.layout === "horizontal" ? `${LabelSizeMap[formContext.labelSize] + 16}px` : void 0
7774
+ }));
7775
+ return () => {
7776
+ var _a, _b;
7777
+ return createVNode("div", {
7778
+ "class": "devui-form-operation",
7779
+ "style": styles.value
7780
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
7781
+ };
7782
+ }
7783
+ });
7784
+ const useSearchClass = (props, isFocus) => {
7785
+ const formContext = inject(FORM_TOKEN, void 0);
7786
+ const ICON_POSITION = {
7787
+ right: "right",
7788
+ left: "left"
7789
+ };
7790
+ const ns2 = useNamespace("search");
7791
+ const searchSize = computed(() => props.size || (formContext == null ? void 0 : formContext.size) || "md");
7792
+ const rootClass = computed(() => ({
7793
+ [ns2.b()]: true,
7794
+ [ns2.m("focus")]: isFocus.value,
7795
+ [ns2.m("disabled")]: props.disabled,
7796
+ [ns2.m("no-border")]: props.noBorder,
7797
+ [ns2.m(searchSize.value)]: !!searchSize.value,
7798
+ [ns2.m(props.iconPosition)]: ICON_POSITION[props.iconPosition]
7799
+ }));
7800
+ return {
7801
+ rootClass,
7802
+ searchSize
7803
+ };
7804
+ };
7805
+ const keywordsHandles = (ctx, props) => {
7806
+ const keywords = ref("");
7807
+ watch(() => props.modelValue, (val) => {
7808
+ keywords.value = val;
7809
+ }, { immediate: true });
7810
+ const onClearHandle = () => {
7811
+ keywords.value = "";
7812
+ ctx.emit("update:modelValue", "");
7813
+ ctx.emit("search", "");
7814
+ };
7815
+ const clearIconShow = computed(() => keywords.value.length > 0);
7816
+ return {
7817
+ keywords,
7818
+ clearIconShow,
7819
+ onClearHandle
7820
+ };
7821
+ };
7822
+ const keydownHandles = (ctx, keywords, props) => {
7823
+ const useEmitKeyword = lodash.exports.debounce((value) => {
7824
+ ctx.emit("search", value);
7825
+ }, props.delay);
7826
+ const handleEnter = ($event) => {
7827
+ if ($event.target instanceof HTMLInputElement) {
7828
+ const value = $event.target.value;
7829
+ useEmitKeyword(value);
7830
+ }
7831
+ };
7832
+ const onClickHandle = () => {
7833
+ if (!props.disabled) {
7834
+ ctx.emit("search", keywords.value);
7835
+ }
7836
+ };
7837
+ const KEYS_MAP = {
7838
+ Enter: handleEnter
7839
+ };
7840
+ const onInputKeydown = ($event) => {
7841
+ var _a;
7842
+ (_a = KEYS_MAP[$event.key]) == null ? void 0 : _a.call(KEYS_MAP, $event);
7843
+ };
7844
+ return {
7845
+ onInputKeydown,
7846
+ useEmitKeyword,
7847
+ onClickHandle
7848
+ };
7849
+ };
7850
+ const DEFAULT_PREFIX = "icon";
7851
+ const iconProps = {
7852
+ name: {
7853
+ type: String,
7854
+ default: "",
7855
+ required: true
7856
+ },
7857
+ size: {
7858
+ type: [Number, String],
7859
+ default: "inherit"
7860
+ },
7861
+ color: {
7862
+ type: String,
7863
+ default: "inherit"
7864
+ },
7865
+ component: {
7866
+ type: Object,
7867
+ default: null
7868
+ },
7869
+ classPrefix: {
7870
+ type: String,
7871
+ default: DEFAULT_PREFIX
7872
+ },
7873
+ operable: {
7874
+ type: Boolean,
7875
+ default: false
7876
+ },
7877
+ disabled: {
7878
+ type: Boolean,
7879
+ default: false
7880
+ },
7881
+ rotate: {
7882
+ type: [Number, String]
7883
+ }
7884
+ };
7885
+ const svgIconProps = {
7886
+ name: {
7887
+ type: String,
7888
+ default: "",
7889
+ required: true
7890
+ },
7891
+ color: {
7892
+ type: String,
7893
+ default: "inherit"
7894
+ },
7895
+ size: {
7896
+ type: [Number, String],
7897
+ default: "inherit"
7898
+ }
7899
+ };
7900
+ var icon = "";
7901
+ var svgIcon = defineComponent({
7902
+ name: "DSvgIcon",
7903
+ props: svgIconProps,
7904
+ setup(props) {
7905
+ const {
7906
+ name,
7907
+ color,
7908
+ size
7909
+ } = toRefs(props);
7910
+ const ns2 = useNamespace("svg-icon");
7911
+ const iconName = computed(() => `#icon-${name.value}`);
7912
+ const iconSize = computed(() => {
7913
+ return typeof size.value === "number" ? `${size.value}px` : size.value;
7914
+ });
7915
+ const styles = {
7916
+ width: iconSize.value,
7917
+ height: iconSize.value
7918
+ };
7919
+ return () => {
7920
+ return createVNode("svg", {
7921
+ "class": ns2.b(),
7922
+ "style": styles
7923
+ }, [createVNode("use", {
7924
+ "xlink:href": iconName.value,
7925
+ "fill": color.value
7926
+ }, null)]);
7927
+ };
7928
+ }
7929
+ });
7930
+ function isUrl(value) {
7931
+ return /^((http|https):)?\/\//.test(value);
7932
+ }
7933
+ function useIconDom(props, ctx) {
7934
+ const {
7935
+ component,
7936
+ name,
7937
+ size,
7938
+ color,
7939
+ classPrefix,
7940
+ rotate
7941
+ } = toRefs(props);
7942
+ const ns2 = useNamespace("icon");
7943
+ const iconSize = computed(() => {
7944
+ return typeof size.value === "number" ? `${size.value}px` : size.value;
7945
+ });
7946
+ const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
7947
+ const imgIconDom = () => {
7948
+ return createVNode("img", mergeProps({
7949
+ "src": name.value,
7950
+ "alt": name.value.split("/")[name.value.split("/").length - 1],
7951
+ "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
7952
+ "style": {
7953
+ width: iconSize.value || "",
7954
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`,
7955
+ verticalAlign: "middle"
7956
+ }
7957
+ }, ctx.attrs), null);
7901
7958
  };
7902
- const execValidate = async (rules2) => {
7903
- const ruleName = computedField.value;
7904
- const validator = new Schema({
7905
- [ruleName]: rules2
7906
- });
7907
- return validator.validate({ [ruleName]: fieldValue.value }, { firstFields: true }).then(() => {
7908
- onValidateSuccess();
7909
- return true;
7910
- }).catch((error) => {
7911
- onValidateError(error);
7912
- return Promise.reject(error);
7913
- });
7959
+ const svgIconDom = () => {
7960
+ return createVNode(IconComponent, mergeProps({
7961
+ "name": name.value,
7962
+ "color": color.value,
7963
+ "size": iconSize.value,
7964
+ "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
7965
+ "style": {
7966
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
7967
+ }
7968
+ }, ctx.attrs), null);
7914
7969
  };
7915
- const validate = async (trigger, callback) => {
7916
- if (isResetting) {
7917
- isResetting = false;
7918
- return false;
7919
- }
7920
- const rules2 = getRuleByTrigger(trigger);
7921
- if (!rules2.length) {
7922
- callback == null ? void 0 : callback(true);
7923
- return true;
7924
- }
7925
- validateState.value = "pending";
7926
- return execValidate(rules2).then(() => {
7927
- callback == null ? void 0 : callback(true);
7928
- return true;
7929
- }).catch((error) => {
7930
- const { fields } = error;
7931
- callback == null ? void 0 : callback(false, fields);
7932
- return lodash.exports.isFunction(callback) ? false : Promise.reject(fields);
7933
- });
7970
+ const fontIconDom = () => {
7971
+ const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
7972
+ return createVNode("i", mergeProps({
7973
+ "class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
7974
+ "style": {
7975
+ fontSize: iconSize.value,
7976
+ color: color.value,
7977
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
7978
+ }
7979
+ }, ctx.attrs), null);
7934
7980
  };
7935
- const clearValidate = () => {
7936
- validateState.value = "";
7937
- validateMessage.value = "";
7981
+ const iconDom = () => {
7982
+ return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
7938
7983
  };
7939
- const resetField = async () => {
7940
- if (!formContext.data || !props.field) {
7941
- return;
7942
- }
7943
- const currentValue = getFieldValue(formContext.data, props.field);
7944
- if (!lodash.exports.isEqual(currentValue.value, initFieldValue)) {
7945
- isResetting = true;
7946
- }
7947
- currentValue.value = initFieldValue;
7948
- await nextTick();
7949
- clearValidate();
7984
+ return {
7985
+ iconDom
7950
7986
  };
7951
- onMounted(() => {
7952
- initFieldValue = lodash.exports.clone(fieldValue.value);
7953
- });
7954
- return { validateState, validateMessage, validate, resetField, clearValidate };
7955
7987
  }
7956
- var formItem = "";
7957
- defineComponent({
7958
- name: "DFormItem",
7959
- props: formItemProps,
7988
+ var Icon = defineComponent({
7989
+ name: "DIcon",
7990
+ props: iconProps,
7991
+ emits: ["click"],
7960
7992
  setup(props, ctx) {
7961
- const formContext = inject(FORM_TOKEN);
7962
- const _a = toRefs(props), {
7963
- messageType: itemMessageType,
7964
- popPosition: itemPopPosition,
7965
- showFeedback: itemShowFeedback
7966
- } = _a, otherProps = __objRest(_a, [
7967
- "messageType",
7968
- "popPosition",
7969
- "showFeedback"
7970
- ]);
7971
7993
  const {
7972
- label,
7973
- helpTips,
7974
- feedbackStatus,
7975
- extraInfo
7994
+ disabled,
7995
+ operable
7976
7996
  } = toRefs(props);
7977
- const showFeedback = computed(() => (itemShowFeedback == null ? void 0 : itemShowFeedback.value) !== void 0 ? itemShowFeedback.value : formContext.showFeedback);
7978
- const messageType = computed(() => (itemMessageType == null ? void 0 : itemMessageType.value) || formContext.messageType);
7979
- const popPosition = computed(() => (itemPopPosition == null ? void 0 : itemPopPosition.value) || formContext.popPosition);
7980
- const {
7981
- _rules
7982
- } = useFormItemRule(props);
7983
- const {
7984
- validateState,
7985
- validateMessage,
7986
- validate,
7987
- resetField,
7988
- clearValidate
7989
- } = useFormItemValidate(props, _rules);
7990
7997
  const {
7991
- itemClasses,
7992
- isRequired
7993
- } = useFormItem(messageType, _rules, validateState);
7994
- const labelData = computed(() => ({
7995
- layout: formContext.layout,
7996
- labelSize: formContext.labelSize,
7997
- labelAlign: formContext.labelAlign
7998
- }));
7999
- provide(LABEL_DATA, labelData);
8000
- const context = reactive(__spreadProps(__spreadValues({}, otherProps), {
8001
- showFeedback,
8002
- messageType,
8003
- popPosition,
8004
- isRequired,
8005
- validateState,
8006
- validateMessage,
8007
- validate,
8008
- resetField,
8009
- clearValidate
7998
+ iconDom
7999
+ } = useIconDom(props, ctx);
8000
+ const ns2 = useNamespace("icon");
8001
+ const wrapClassed = computed(() => ({
8002
+ [ns2.e("container")]: true,
8003
+ [ns2.m("disabled")]: disabled.value,
8004
+ [ns2.m("operable")]: operable.value,
8005
+ [ns2.m("no-slots")]: !Object.keys(ctx.slots).length
8010
8006
  }));
8011
- provide(FORM_ITEM_TOKEN, context);
8012
- ctx.expose({
8013
- resetField,
8014
- clearValidate
8015
- });
8016
- onMounted(() => {
8017
- if (props.field) {
8018
- formContext == null ? void 0 : formContext.addItemContext(context);
8019
- }
8020
- });
8021
- onBeforeUnmount(() => {
8022
- formContext == null ? void 0 : formContext.removeItemContext(context);
8023
- });
8024
- return () => createVNode("div", {
8025
- "class": itemClasses.value
8026
- }, [createVNode(FormLabel, {
8027
- "help-tips": helpTips.value
8028
- }, {
8029
- default: () => [label == null ? void 0 : label.value]
8030
- }), createVNode(FormControl, {
8031
- "feedback-status": feedbackStatus == null ? void 0 : feedbackStatus.value,
8032
- "extra-info": extraInfo.value
8033
- }, {
8034
- default: () => {
8035
- var _a2, _b;
8036
- return [(_b = (_a2 = ctx.slots).default) == null ? void 0 : _b.call(_a2)];
8007
+ const onClick = (e) => {
8008
+ if (disabled.value) {
8009
+ return;
8037
8010
  }
8038
- })]);
8039
- }
8040
- });
8041
- var formOperation = "";
8042
- defineComponent({
8043
- name: "DFormOperation",
8044
- setup(props, ctx) {
8045
- const formContext = inject(FORM_TOKEN);
8046
- const LabelSizeMap = {
8047
- sm: 80,
8048
- md: 100,
8049
- lg: 150
8011
+ ctx.emit("click", e);
8050
8012
  };
8051
- const styles = computed(() => ({
8052
- marginLeft: formContext.layout === "horizontal" ? `${LabelSizeMap[formContext.labelSize] + 16}px` : void 0
8053
- }));
8054
8013
  return () => {
8055
- var _a, _b;
8014
+ var _a, _b, _c, _d;
8056
8015
  return createVNode("div", {
8057
- "class": "devui-form-operation",
8058
- "style": styles.value
8059
- }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
8016
+ "class": wrapClassed.value,
8017
+ "onClick": onClick
8018
+ }, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
8060
8019
  };
8061
8020
  }
8062
8021
  });
8022
+ const inputProps = {
8023
+ modelValue: {
8024
+ type: String,
8025
+ default: ""
8026
+ },
8027
+ disabled: {
8028
+ type: Boolean,
8029
+ default: false
8030
+ },
8031
+ error: {
8032
+ type: Boolean,
8033
+ default: false
8034
+ },
8035
+ size: {
8036
+ type: String
8037
+ },
8038
+ validateEvent: {
8039
+ type: Boolean,
8040
+ default: true
8041
+ },
8042
+ prefix: {
8043
+ type: String,
8044
+ default: ""
8045
+ },
8046
+ suffix: {
8047
+ type: String,
8048
+ default: ""
8049
+ },
8050
+ showPassword: {
8051
+ type: Boolean,
8052
+ default: false
8053
+ },
8054
+ clearable: {
8055
+ type: Boolean,
8056
+ default: false
8057
+ },
8058
+ placeholder: {
8059
+ type: String,
8060
+ default: ""
8061
+ }
8062
+ };
8063
8063
  function useInputRender(props, ctx) {
8064
8064
  const formContext = inject(FORM_TOKEN, void 0);
8065
8065
  const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
@@ -8442,7 +8442,10 @@ var Search = defineComponent({
8442
8442
  const t = createI18nTranslate("DSearch", app);
8443
8443
  const ns2 = useNamespace("search");
8444
8444
  const isFocus = ref(false);
8445
- const rootClasses = getRootClass(props, isFocus);
8445
+ const {
8446
+ rootClass,
8447
+ searchSize
8448
+ } = useSearchClass(props, isFocus);
8446
8449
  const {
8447
8450
  keywords,
8448
8451
  clearIconShow,
@@ -8468,7 +8471,7 @@ var Search = defineComponent({
8468
8471
  };
8469
8472
  return () => {
8470
8473
  const inputProps2 = {
8471
- size: props.size,
8474
+ size: searchSize.value,
8472
8475
  disabled: props.disabled,
8473
8476
  autoFocus: props.autoFocus,
8474
8477
  modelValue: keywords.value,
@@ -8479,7 +8482,7 @@ var Search = defineComponent({
8479
8482
  onBlur
8480
8483
  };
8481
8484
  return createVNode("label", {
8482
- "class": rootClasses.value
8485
+ "class": rootClass.value
8483
8486
  }, [props.iconPosition === "left" && createVNode("div", {
8484
8487
  "class": ns2.e("icon"),
8485
8488
  "onClick": onClickHandle