vue-devui 1.0.0-alpha.4 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/index.d.ts +7 -0
- package/accordion/index.es.js +237 -1
- package/accordion/index.umd.js +1 -1
- package/accordion/style.css +1 -1
- package/alert/index.d.ts +7 -0
- package/alert/index.es.js +175 -1
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/anchor/index.d.ts +7 -0
- package/anchor/index.es.js +263 -1
- package/anchor/index.umd.js +1 -1
- package/avatar/index.d.ts +7 -0
- package/avatar/index.es.js +301 -1
- package/avatar/index.umd.js +1 -1
- package/back-top/index.d.ts +7 -0
- package/back-top/index.es.js +128 -0
- package/back-top/index.umd.js +1 -0
- package/back-top/package.json +7 -0
- package/back-top/style.css +1 -0
- package/badge/index.d.ts +7 -0
- package/badge/index.es.js +95 -1
- package/badge/index.umd.js +1 -1
- package/breadcrumb/index.d.ts +7 -0
- package/breadcrumb/index.es.js +127 -1
- package/breadcrumb/index.umd.js +1 -1
- package/breadcrumb/style.css +1 -1
- package/button/index.d.ts +7 -0
- package/button/index.es.js +190 -1
- package/button/index.umd.js +1 -1
- package/card/index.d.ts +7 -0
- package/card/index.es.js +61 -1
- package/card/index.umd.js +1 -1
- package/carousel/index.d.ts +7 -0
- package/carousel/index.es.js +329 -1
- package/carousel/index.umd.js +1 -1
- package/cascader/index.d.ts +7 -0
- package/cascader/index.es.js +1343 -1
- package/cascader/index.umd.js +1 -1
- package/cascader/style.css +1 -1
- package/checkbox/index.d.ts +7 -0
- package/checkbox/index.es.js +377 -1
- package/checkbox/index.umd.js +1 -1
- package/comment/index.d.ts +7 -0
- package/comment/index.es.js +85 -0
- package/comment/index.umd.js +1 -0
- package/comment/package.json +7 -0
- package/comment/style.css +1 -0
- package/countdown/index.d.ts +7 -0
- package/countdown/index.es.js +176 -0
- package/countdown/index.umd.js +1 -0
- package/countdown/package.json +7 -0
- package/countdown/style.css +1 -0
- package/date-picker/index.d.ts +7 -0
- package/date-picker/index.es.js +1172 -1
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/dragdrop/index.d.ts +7 -0
- package/dragdrop/index.es.js +32 -0
- package/dragdrop/index.umd.js +1 -0
- package/dragdrop/package.json +7 -0
- package/drawer/index.d.ts +7 -0
- package/drawer/index.es.js +288 -0
- package/drawer/index.umd.js +1 -0
- package/drawer/package.json +7 -0
- package/drawer/style.css +1 -0
- package/dropdown/index.d.ts +7 -0
- package/dropdown/index.es.js +527 -0
- package/dropdown/index.umd.js +1 -0
- package/dropdown/package.json +7 -0
- package/dropdown/style.css +1 -0
- package/editable-select/index.d.ts +7 -0
- package/editable-select/index.es.js +5793 -1
- package/editable-select/index.umd.js +27 -1
- package/editable-select/style.css +1 -1
- package/form/index.d.ts +7 -0
- package/form/index.es.js +2244 -0
- package/form/index.umd.js +1 -0
- package/form/package.json +7 -0
- package/form/style.css +1 -0
- package/fullscreen/index.d.ts +7 -0
- package/fullscreen/index.es.js +163 -1
- package/fullscreen/index.umd.js +1 -1
- package/gantt/index.d.ts +7 -0
- package/gantt/index.es.js +535 -0
- package/gantt/index.umd.js +1 -0
- package/gantt/package.json +7 -0
- package/gantt/style.css +1 -0
- package/grid/index.d.ts +7 -0
- package/grid/index.es.js +269 -0
- package/grid/index.umd.js +1 -0
- package/grid/package.json +7 -0
- package/grid/style.css +1 -0
- package/icon/index.d.ts +7 -0
- package/icon/index.es.js +75 -1
- package/icon/index.umd.js +1 -1
- package/image-preview/index.d.ts +7 -0
- package/image-preview/index.es.js +480 -1
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/index.d.ts +7 -0
- package/input/index.d.ts +7 -0
- package/input/index.es.js +190 -1
- package/input/index.umd.js +1 -1
- package/input-icon/index.d.ts +7 -0
- package/input-icon/index.es.js +332 -0
- package/input-icon/index.umd.js +1 -0
- package/input-icon/package.json +7 -0
- package/input-icon/style.css +1 -0
- package/input-number/index.d.ts +7 -0
- package/input-number/index.es.js +240 -1
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.d.ts +7 -0
- package/layout/index.es.js +100 -0
- package/layout/index.umd.js +1 -0
- package/layout/package.json +7 -0
- package/layout/style.css +1 -0
- package/loading/index.d.ts +7 -0
- package/loading/index.es.js +256 -1
- package/loading/index.umd.js +1 -1
- package/modal/index.d.ts +7 -0
- package/modal/index.es.js +1027 -1
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/nav-sprite/index.d.ts +7 -0
- package/nav-sprite/index.es.js +742 -0
- package/nav-sprite/index.umd.js +1 -0
- package/nav-sprite/package.json +7 -0
- package/nuxt/components/Accordion.js +3 -0
- package/nuxt/components/Alert.js +3 -0
- package/nuxt/components/Anchor.js +3 -0
- package/nuxt/components/Aside.js +3 -0
- package/nuxt/components/Avatar.js +3 -0
- package/nuxt/components/BackTop.js +3 -0
- package/nuxt/components/Badge.js +3 -0
- package/nuxt/components/Breadcrumb.js +3 -0
- package/nuxt/components/Button.js +3 -0
- package/nuxt/components/Card.js +3 -0
- package/nuxt/components/Carousel.js +3 -0
- package/nuxt/components/Cascader.js +3 -0
- package/nuxt/components/Checkbox.js +3 -0
- package/nuxt/components/Col.js +3 -0
- package/nuxt/components/Column.js +3 -0
- package/nuxt/components/Comment.js +3 -0
- package/nuxt/components/Content.js +3 -0
- package/nuxt/components/Countdown.js +3 -0
- package/nuxt/components/DatePicker.js +3 -0
- package/nuxt/components/Drawer.js +3 -0
- package/nuxt/components/Dropdown.js +3 -0
- package/nuxt/components/EditableSelect.js +3 -0
- package/nuxt/components/FixedOverlay.js +3 -0
- package/nuxt/components/FlexibleOverlay.js +3 -0
- package/nuxt/components/Footer.js +3 -0
- package/nuxt/components/Form.js +3 -0
- package/nuxt/components/FormControl.js +3 -0
- package/nuxt/components/FormItem.js +3 -0
- package/nuxt/components/FormLabel.js +3 -0
- package/nuxt/components/FormOperation.js +3 -0
- package/nuxt/components/Fullscreen.js +3 -0
- package/nuxt/components/Gantt.js +3 -0
- package/nuxt/components/Header.js +3 -0
- package/nuxt/components/Icon.js +2 -0
- package/nuxt/components/ImagePreviewService.js +3 -0
- package/nuxt/components/Input.js +3 -0
- package/nuxt/components/InputIcon.js +3 -0
- package/nuxt/components/InputNumber.js +3 -0
- package/nuxt/components/Layout.js +3 -0
- package/nuxt/components/Loading.js +3 -0
- package/nuxt/components/LoadingService.js +3 -0
- package/nuxt/components/Modal.js +3 -0
- package/nuxt/components/MultiUpload.js +3 -0
- package/nuxt/components/NavSprite.js +2 -0
- package/nuxt/components/Pagination.js +3 -0
- package/nuxt/components/Panel.js +3 -0
- package/nuxt/components/Popover.js +3 -0
- package/nuxt/components/Progress.js +3 -0
- package/nuxt/components/QuadrantDiagram.js +3 -0
- package/nuxt/components/Radio.js +3 -0
- package/nuxt/components/RadioGroup.js +3 -0
- package/nuxt/components/Rate.js +3 -0
- package/nuxt/components/ReadTip.js +3 -0
- package/nuxt/components/Result.js +3 -0
- package/nuxt/components/Row.js +3 -0
- package/nuxt/components/Search.js +3 -0
- package/nuxt/components/Select.js +3 -0
- package/nuxt/components/Skeleton.js +3 -0
- package/nuxt/components/SkeletonItem.js +3 -0
- package/nuxt/components/Slider.js +3 -0
- package/nuxt/components/Splitter.js +3 -0
- package/nuxt/components/Statistic.js +3 -0
- package/nuxt/components/Status.js +3 -0
- package/nuxt/components/StepsGuide.js +3 -0
- package/nuxt/components/StickSlider.js +3 -0
- package/nuxt/components/Sticky.js +2 -0
- package/nuxt/components/Switch.js +3 -0
- package/nuxt/components/Table.js +3 -0
- package/nuxt/components/Tabs.js +3 -0
- package/nuxt/components/Tag.js +3 -0
- package/nuxt/components/TagInput.js +3 -0
- package/nuxt/components/Textarea.js +3 -0
- package/nuxt/components/TimeAxis.js +3 -0
- package/nuxt/components/TimeAxisItem.js +3 -0
- package/nuxt/components/TimePicker.js +3 -0
- package/nuxt/components/Toast.js +3 -0
- package/nuxt/components/ToastService.js +3 -0
- package/nuxt/components/Tooltip.js +3 -0
- package/nuxt/components/Transfer.js +3 -0
- package/nuxt/components/Tree.js +3 -0
- package/nuxt/components/TreeSelect.js +3 -0
- package/nuxt/components/Upload.js +3 -0
- package/nuxt/components/buttonProps.js +3 -0
- package/nuxt/index.js +13 -0
- package/overlay/index.d.ts +7 -0
- package/overlay/index.es.js +368 -1
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +8 -33
- package/pagination/index.d.ts +7 -0
- package/pagination/index.es.js +642 -1
- package/pagination/index.umd.js +1 -1
- package/panel/index.d.ts +7 -0
- package/panel/index.es.js +205 -1
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.d.ts +7 -0
- package/popover/index.es.js +236 -1
- package/popover/index.umd.js +1 -1
- package/popover/style.css +1 -1
- package/progress/index.d.ts +7 -0
- package/progress/index.es.js +153 -1
- package/progress/index.umd.js +3 -1
- package/quadrant-diagram/index.d.ts +7 -0
- package/quadrant-diagram/index.es.js +489 -1
- package/quadrant-diagram/index.umd.js +1 -1
- package/radio/index.d.ts +7 -0
- package/radio/index.es.js +225 -1
- package/radio/index.umd.js +1 -1
- package/rate/index.d.ts +7 -0
- package/rate/index.es.js +220 -1
- package/rate/index.umd.js +1 -1
- package/read-tip/index.d.ts +7 -0
- package/read-tip/index.es.js +258 -0
- package/read-tip/index.umd.js +1 -0
- package/read-tip/package.json +7 -0
- package/read-tip/style.css +1 -0
- package/result/index.d.ts +7 -0
- package/result/index.es.js +119 -0
- package/result/index.umd.js +1 -0
- package/result/package.json +7 -0
- package/result/style.css +1 -0
- package/ripple/index.d.ts +7 -0
- package/ripple/index.es.js +181 -1
- package/ripple/index.umd.js +1 -1
- package/search/index.d.ts +7 -0
- package/search/index.es.js +543 -1
- package/search/index.umd.js +1 -1
- package/select/index.d.ts +7 -0
- package/select/index.es.js +706 -1
- package/select/index.umd.js +1 -1
- package/skeleton/index.d.ts +7 -0
- package/skeleton/index.es.js +297 -1
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.d.ts +7 -0
- package/slider/index.es.js +199 -1
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.d.ts +7 -0
- package/splitter/index.es.js +636 -1
- package/splitter/index.umd.js +1 -1
- package/statistic/index.d.ts +7 -0
- package/statistic/index.es.js +280 -0
- package/statistic/index.umd.js +1 -0
- package/statistic/package.json +7 -0
- package/statistic/style.css +1 -0
- package/status/index.d.ts +7 -0
- package/status/index.es.js +42 -1
- package/status/index.umd.js +1 -1
- package/steps-guide/index.d.ts +7 -0
- package/steps-guide/index.es.js +239 -1
- package/steps-guide/index.umd.js +1 -1
- package/steps-guide/style.css +1 -1
- package/sticky/index.d.ts +7 -0
- package/sticky/index.es.js +197 -1
- package/sticky/index.umd.js +1 -1
- package/style.css +1 -1
- package/switch/index.d.ts +7 -0
- package/switch/index.es.js +100 -1
- package/switch/index.umd.js +1 -1
- package/switch/style.css +1 -1
- package/table/index.d.ts +7 -0
- package/table/index.es.js +1626 -1
- package/table/index.umd.js +1 -1
- package/table/style.css +1 -1
- package/tabs/index.d.ts +7 -0
- package/tabs/index.es.js +195 -1
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.d.ts +7 -0
- package/tag/index.es.js +131 -0
- package/tag/index.umd.js +1 -0
- package/tag/package.json +7 -0
- package/tag/style.css +1 -0
- package/tag-input/index.d.ts +7 -0
- package/tag-input/index.es.js +329 -1
- package/tag-input/index.umd.js +1 -1
- package/textarea/index.d.ts +7 -0
- package/textarea/index.es.js +132 -0
- package/textarea/index.umd.js +1 -0
- package/textarea/package.json +7 -0
- package/textarea/style.css +1 -0
- package/time-axis/index.d.ts +7 -0
- package/time-axis/index.es.js +299 -0
- package/time-axis/index.umd.js +1 -0
- package/time-axis/package.json +7 -0
- package/time-axis/style.css +1 -0
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +1053 -1
- package/time-picker/index.umd.js +1 -1
- package/time-picker/style.css +1 -1
- package/toast/index.d.ts +7 -0
- package/toast/index.es.js +2060 -1
- package/toast/index.umd.js +1 -1
- package/toast/style.css +1 -1
- package/tooltip/index.d.ts +7 -0
- package/tooltip/index.es.js +171 -1
- package/tooltip/index.umd.js +1 -1
- package/transfer/index.d.ts +7 -0
- package/transfer/index.es.js +1725 -1
- package/transfer/index.umd.js +1 -1
- package/transfer/style.css +1 -1
- package/tree/index.d.ts +7 -0
- package/tree/index.es.js +907 -1
- package/tree/index.umd.js +1 -1
- package/tree/style.css +1 -1
- package/tree-select/index.d.ts +7 -0
- package/tree-select/index.es.js +528 -0
- package/tree-select/index.umd.js +1 -0
- package/tree-select/package.json +7 -0
- package/tree-select/style.css +1 -0
- package/upload/index.d.ts +7 -0
- package/upload/index.es.js +3179 -1
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +27755 -1
- package/vue-devui.umd.js +29 -1
package/search/index.es.js
CHANGED
|
@@ -1 +1,543 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { computed, ref, watch, defineComponent, inject, createVNode, withDirectives, mergeProps, resolveDirective, resolveComponent } from "vue";
|
|
2
|
+
const searchProps = {
|
|
3
|
+
size: {
|
|
4
|
+
type: String,
|
|
5
|
+
default: ""
|
|
6
|
+
},
|
|
7
|
+
placeholder: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57"
|
|
10
|
+
},
|
|
11
|
+
maxLength: {
|
|
12
|
+
type: Number,
|
|
13
|
+
default: Number.MAX_SAFE_INTEGER
|
|
14
|
+
},
|
|
15
|
+
delay: {
|
|
16
|
+
type: Number,
|
|
17
|
+
default: 300
|
|
18
|
+
},
|
|
19
|
+
disabled: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
},
|
|
23
|
+
autoFocus: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
26
|
+
},
|
|
27
|
+
isKeyupSearch: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
},
|
|
31
|
+
iconPosition: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: "right"
|
|
34
|
+
},
|
|
35
|
+
noBorder: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
},
|
|
39
|
+
cssClass: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: ""
|
|
42
|
+
},
|
|
43
|
+
modelValue: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: ""
|
|
46
|
+
},
|
|
47
|
+
onSearch: {
|
|
48
|
+
type: Function,
|
|
49
|
+
default: void 0
|
|
50
|
+
},
|
|
51
|
+
"onUpdate:modelValue": {
|
|
52
|
+
type: Function,
|
|
53
|
+
default: void 0
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const SIZE_CLASS = {
|
|
57
|
+
lg: "lg",
|
|
58
|
+
sm: "sm"
|
|
59
|
+
};
|
|
60
|
+
const ICON_POSITION = {
|
|
61
|
+
right: "right",
|
|
62
|
+
left: "left"
|
|
63
|
+
};
|
|
64
|
+
const getRootClass = (props) => {
|
|
65
|
+
return computed(() => ({
|
|
66
|
+
"devui-search": true,
|
|
67
|
+
"devui-search__disbaled": props.disabled,
|
|
68
|
+
"devui-search__no-border": props.noBorder,
|
|
69
|
+
[`devui-search__${props.size}`]: SIZE_CLASS[props.size],
|
|
70
|
+
[`devui-search__${props.iconPosition}`]: ICON_POSITION[props.iconPosition]
|
|
71
|
+
}));
|
|
72
|
+
};
|
|
73
|
+
const keywordsHandles = (ctx, props) => {
|
|
74
|
+
const keywords = ref("");
|
|
75
|
+
watch(() => props.modelValue, (val) => {
|
|
76
|
+
keywords.value = val;
|
|
77
|
+
}, { immediate: true });
|
|
78
|
+
const onClearHandle = () => {
|
|
79
|
+
keywords.value = "";
|
|
80
|
+
ctx.emit("update:modelValue", "");
|
|
81
|
+
};
|
|
82
|
+
const clearIconShow = computed(() => {
|
|
83
|
+
return keywords.value.length > 0;
|
|
84
|
+
});
|
|
85
|
+
return {
|
|
86
|
+
keywords,
|
|
87
|
+
clearIconShow,
|
|
88
|
+
onClearHandle
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
92
|
+
var freeGlobal$1 = freeGlobal;
|
|
93
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
94
|
+
var root = freeGlobal$1 || freeSelf || Function("return this")();
|
|
95
|
+
var root$1 = root;
|
|
96
|
+
var Symbol$1 = root$1.Symbol;
|
|
97
|
+
var Symbol$2 = Symbol$1;
|
|
98
|
+
var objectProto$1 = Object.prototype;
|
|
99
|
+
var hasOwnProperty = objectProto$1.hasOwnProperty;
|
|
100
|
+
var nativeObjectToString$1 = objectProto$1.toString;
|
|
101
|
+
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
|
|
102
|
+
function getRawTag(value) {
|
|
103
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
|
104
|
+
try {
|
|
105
|
+
value[symToStringTag$1] = void 0;
|
|
106
|
+
var unmasked = true;
|
|
107
|
+
} catch (e) {
|
|
108
|
+
}
|
|
109
|
+
var result = nativeObjectToString$1.call(value);
|
|
110
|
+
if (unmasked) {
|
|
111
|
+
if (isOwn) {
|
|
112
|
+
value[symToStringTag$1] = tag;
|
|
113
|
+
} else {
|
|
114
|
+
delete value[symToStringTag$1];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
var objectProto = Object.prototype;
|
|
120
|
+
var nativeObjectToString = objectProto.toString;
|
|
121
|
+
function objectToString(value) {
|
|
122
|
+
return nativeObjectToString.call(value);
|
|
123
|
+
}
|
|
124
|
+
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
125
|
+
var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
|
|
126
|
+
function baseGetTag(value) {
|
|
127
|
+
if (value == null) {
|
|
128
|
+
return value === void 0 ? undefinedTag : nullTag;
|
|
129
|
+
}
|
|
130
|
+
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
131
|
+
}
|
|
132
|
+
function isObjectLike(value) {
|
|
133
|
+
return value != null && typeof value == "object";
|
|
134
|
+
}
|
|
135
|
+
var symbolTag = "[object Symbol]";
|
|
136
|
+
function isSymbol(value) {
|
|
137
|
+
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
138
|
+
}
|
|
139
|
+
var reWhitespace = /\s/;
|
|
140
|
+
function trimmedEndIndex(string) {
|
|
141
|
+
var index2 = string.length;
|
|
142
|
+
while (index2-- && reWhitespace.test(string.charAt(index2))) {
|
|
143
|
+
}
|
|
144
|
+
return index2;
|
|
145
|
+
}
|
|
146
|
+
var reTrimStart = /^\s+/;
|
|
147
|
+
function baseTrim(string) {
|
|
148
|
+
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
|
|
149
|
+
}
|
|
150
|
+
function isObject(value) {
|
|
151
|
+
var type = typeof value;
|
|
152
|
+
return value != null && (type == "object" || type == "function");
|
|
153
|
+
}
|
|
154
|
+
var NAN = 0 / 0;
|
|
155
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
156
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
157
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
158
|
+
var freeParseInt = parseInt;
|
|
159
|
+
function toNumber(value) {
|
|
160
|
+
if (typeof value == "number") {
|
|
161
|
+
return value;
|
|
162
|
+
}
|
|
163
|
+
if (isSymbol(value)) {
|
|
164
|
+
return NAN;
|
|
165
|
+
}
|
|
166
|
+
if (isObject(value)) {
|
|
167
|
+
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
168
|
+
value = isObject(other) ? other + "" : other;
|
|
169
|
+
}
|
|
170
|
+
if (typeof value != "string") {
|
|
171
|
+
return value === 0 ? value : +value;
|
|
172
|
+
}
|
|
173
|
+
value = baseTrim(value);
|
|
174
|
+
var isBinary = reIsBinary.test(value);
|
|
175
|
+
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
176
|
+
}
|
|
177
|
+
var now = function() {
|
|
178
|
+
return root$1.Date.now();
|
|
179
|
+
};
|
|
180
|
+
var now$1 = now;
|
|
181
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
182
|
+
var nativeMax = Math.max, nativeMin = Math.min;
|
|
183
|
+
function debounce(func, wait, options) {
|
|
184
|
+
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
185
|
+
if (typeof func != "function") {
|
|
186
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
187
|
+
}
|
|
188
|
+
wait = toNumber(wait) || 0;
|
|
189
|
+
if (isObject(options)) {
|
|
190
|
+
leading = !!options.leading;
|
|
191
|
+
maxing = "maxWait" in options;
|
|
192
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
193
|
+
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
194
|
+
}
|
|
195
|
+
function invokeFunc(time) {
|
|
196
|
+
var args = lastArgs, thisArg = lastThis;
|
|
197
|
+
lastArgs = lastThis = void 0;
|
|
198
|
+
lastInvokeTime = time;
|
|
199
|
+
result = func.apply(thisArg, args);
|
|
200
|
+
return result;
|
|
201
|
+
}
|
|
202
|
+
function leadingEdge(time) {
|
|
203
|
+
lastInvokeTime = time;
|
|
204
|
+
timerId = setTimeout(timerExpired, wait);
|
|
205
|
+
return leading ? invokeFunc(time) : result;
|
|
206
|
+
}
|
|
207
|
+
function remainingWait(time) {
|
|
208
|
+
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
|
|
209
|
+
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
210
|
+
}
|
|
211
|
+
function shouldInvoke(time) {
|
|
212
|
+
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
|
|
213
|
+
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
|
|
214
|
+
}
|
|
215
|
+
function timerExpired() {
|
|
216
|
+
var time = now$1();
|
|
217
|
+
if (shouldInvoke(time)) {
|
|
218
|
+
return trailingEdge(time);
|
|
219
|
+
}
|
|
220
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
221
|
+
}
|
|
222
|
+
function trailingEdge(time) {
|
|
223
|
+
timerId = void 0;
|
|
224
|
+
if (trailing && lastArgs) {
|
|
225
|
+
return invokeFunc(time);
|
|
226
|
+
}
|
|
227
|
+
lastArgs = lastThis = void 0;
|
|
228
|
+
return result;
|
|
229
|
+
}
|
|
230
|
+
function cancel() {
|
|
231
|
+
if (timerId !== void 0) {
|
|
232
|
+
clearTimeout(timerId);
|
|
233
|
+
}
|
|
234
|
+
lastInvokeTime = 0;
|
|
235
|
+
lastArgs = lastCallTime = lastThis = timerId = void 0;
|
|
236
|
+
}
|
|
237
|
+
function flush() {
|
|
238
|
+
return timerId === void 0 ? result : trailingEdge(now$1());
|
|
239
|
+
}
|
|
240
|
+
function debounced() {
|
|
241
|
+
var time = now$1(), isInvoking = shouldInvoke(time);
|
|
242
|
+
lastArgs = arguments;
|
|
243
|
+
lastThis = this;
|
|
244
|
+
lastCallTime = time;
|
|
245
|
+
if (isInvoking) {
|
|
246
|
+
if (timerId === void 0) {
|
|
247
|
+
return leadingEdge(lastCallTime);
|
|
248
|
+
}
|
|
249
|
+
if (maxing) {
|
|
250
|
+
clearTimeout(timerId);
|
|
251
|
+
timerId = setTimeout(timerExpired, wait);
|
|
252
|
+
return invokeFunc(lastCallTime);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (timerId === void 0) {
|
|
256
|
+
timerId = setTimeout(timerExpired, wait);
|
|
257
|
+
}
|
|
258
|
+
return result;
|
|
259
|
+
}
|
|
260
|
+
debounced.cancel = cancel;
|
|
261
|
+
debounced.flush = flush;
|
|
262
|
+
return debounced;
|
|
263
|
+
}
|
|
264
|
+
const KEYS_MAP = {
|
|
265
|
+
enter: "Enter"
|
|
266
|
+
};
|
|
267
|
+
const keydownHandles = (ctx, keywords, delay) => {
|
|
268
|
+
const onInputKeydown = ($event) => {
|
|
269
|
+
switch ($event.key) {
|
|
270
|
+
case KEYS_MAP.enter:
|
|
271
|
+
handleEnter($event);
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
const handleEnter = ($event) => {
|
|
276
|
+
if ($event.target instanceof HTMLInputElement) {
|
|
277
|
+
const value = $event.target.value;
|
|
278
|
+
useEmitKeyword(value);
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
const onClickHandle = () => {
|
|
282
|
+
useEmitKeyword(keywords.value);
|
|
283
|
+
};
|
|
284
|
+
const useEmitKeyword = debounce((value) => {
|
|
285
|
+
ctx.emit("onSearch", value);
|
|
286
|
+
}, delay);
|
|
287
|
+
return {
|
|
288
|
+
onInputKeydown,
|
|
289
|
+
useEmitKeyword,
|
|
290
|
+
onClickHandle
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
const inputProps = {
|
|
294
|
+
placeholder: {
|
|
295
|
+
type: String,
|
|
296
|
+
default: void 0
|
|
297
|
+
},
|
|
298
|
+
disabled: {
|
|
299
|
+
type: Boolean,
|
|
300
|
+
default: false
|
|
301
|
+
},
|
|
302
|
+
autoFocus: {
|
|
303
|
+
type: Boolean,
|
|
304
|
+
default: false
|
|
305
|
+
},
|
|
306
|
+
maxLength: {
|
|
307
|
+
type: Number,
|
|
308
|
+
default: Number.MAX_SAFE_INTEGER
|
|
309
|
+
},
|
|
310
|
+
cssClass: {
|
|
311
|
+
type: String,
|
|
312
|
+
default: ""
|
|
313
|
+
},
|
|
314
|
+
error: {
|
|
315
|
+
type: Boolean,
|
|
316
|
+
default: false
|
|
317
|
+
},
|
|
318
|
+
size: {
|
|
319
|
+
type: String,
|
|
320
|
+
default: ""
|
|
321
|
+
},
|
|
322
|
+
showPassword: {
|
|
323
|
+
type: Boolean,
|
|
324
|
+
default: false
|
|
325
|
+
},
|
|
326
|
+
modelValue: {
|
|
327
|
+
type: String,
|
|
328
|
+
default: ""
|
|
329
|
+
},
|
|
330
|
+
"update:modelValue": {
|
|
331
|
+
type: Function,
|
|
332
|
+
default: void 0
|
|
333
|
+
},
|
|
334
|
+
onChange: {
|
|
335
|
+
type: Function,
|
|
336
|
+
default: void 0
|
|
337
|
+
},
|
|
338
|
+
onKeydown: {
|
|
339
|
+
type: Function,
|
|
340
|
+
default: void 0
|
|
341
|
+
},
|
|
342
|
+
onFocus: {
|
|
343
|
+
type: Function,
|
|
344
|
+
default: void 0
|
|
345
|
+
},
|
|
346
|
+
onBlur: {
|
|
347
|
+
type: Function,
|
|
348
|
+
default: void 0
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
var input = "";
|
|
352
|
+
const formItemInjectionKey = Symbol("dFormItem");
|
|
353
|
+
const dFormItemEvents = {
|
|
354
|
+
blur: "d.form.blur",
|
|
355
|
+
change: "d.form.change",
|
|
356
|
+
input: "d.form.input"
|
|
357
|
+
};
|
|
358
|
+
var DInput = defineComponent({
|
|
359
|
+
name: "DInput",
|
|
360
|
+
directives: {
|
|
361
|
+
focus: {
|
|
362
|
+
mounted: function(el, binding) {
|
|
363
|
+
if (binding.value) {
|
|
364
|
+
el.focus();
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
props: inputProps,
|
|
370
|
+
emits: ["update:modelValue", "focus", "blur", "change", "keydown"],
|
|
371
|
+
setup(props, ctx) {
|
|
372
|
+
const formItem = inject(formItemInjectionKey, {});
|
|
373
|
+
const hasFormItem = Object.keys(formItem).length > 0;
|
|
374
|
+
const sizeCls = computed(() => `devui-input-${props.size}`);
|
|
375
|
+
const showPwdIcon = ref(false);
|
|
376
|
+
const inputType = ref("text");
|
|
377
|
+
const inputCls = computed(() => {
|
|
378
|
+
return {
|
|
379
|
+
error: props.error,
|
|
380
|
+
[props.cssClass]: true,
|
|
381
|
+
[sizeCls.value]: props.size !== ""
|
|
382
|
+
};
|
|
383
|
+
});
|
|
384
|
+
const showPreviewIcon = computed(() => inputType.value === "password");
|
|
385
|
+
watch(() => props.showPassword, (flg) => {
|
|
386
|
+
inputType.value = flg ? "password" : "text";
|
|
387
|
+
}, {
|
|
388
|
+
immediate: true
|
|
389
|
+
});
|
|
390
|
+
watch(() => props.modelValue, (value) => {
|
|
391
|
+
value && value.length > 0 && showPreviewIcon.value ? showPwdIcon.value = true : showPwdIcon.value = false;
|
|
392
|
+
});
|
|
393
|
+
const onInput = ($event) => {
|
|
394
|
+
ctx.emit("update:modelValue", $event.target.value);
|
|
395
|
+
hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.input);
|
|
396
|
+
}, onFocus = () => {
|
|
397
|
+
ctx.emit("focus");
|
|
398
|
+
}, onBlur = () => {
|
|
399
|
+
ctx.emit("blur");
|
|
400
|
+
hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.blur);
|
|
401
|
+
}, onChange = ($event) => {
|
|
402
|
+
ctx.emit("change", $event.target.value);
|
|
403
|
+
hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.change);
|
|
404
|
+
}, onKeydown = ($event) => {
|
|
405
|
+
ctx.emit("keydown", $event);
|
|
406
|
+
}, onChangeInputType = () => {
|
|
407
|
+
inputType.value = inputType.value === "password" ? "text" : "password";
|
|
408
|
+
};
|
|
409
|
+
return {
|
|
410
|
+
inputCls,
|
|
411
|
+
inputType,
|
|
412
|
+
showPreviewIcon,
|
|
413
|
+
showPwdIcon,
|
|
414
|
+
onInput,
|
|
415
|
+
onFocus,
|
|
416
|
+
onBlur,
|
|
417
|
+
onChange,
|
|
418
|
+
onKeydown,
|
|
419
|
+
onChangeInputType
|
|
420
|
+
};
|
|
421
|
+
},
|
|
422
|
+
render() {
|
|
423
|
+
const {
|
|
424
|
+
modelValue,
|
|
425
|
+
showPreviewIcon,
|
|
426
|
+
showPwdIcon,
|
|
427
|
+
inputCls,
|
|
428
|
+
inputType,
|
|
429
|
+
maxLength,
|
|
430
|
+
autoFocus,
|
|
431
|
+
placeholder,
|
|
432
|
+
disabled,
|
|
433
|
+
onInput,
|
|
434
|
+
onFocus,
|
|
435
|
+
onBlur,
|
|
436
|
+
onChange,
|
|
437
|
+
onKeydown,
|
|
438
|
+
onChangeInputType
|
|
439
|
+
} = this;
|
|
440
|
+
return createVNode("div", {
|
|
441
|
+
"class": "devui-input__wrap"
|
|
442
|
+
}, [withDirectives(createVNode("input", mergeProps({
|
|
443
|
+
dinput: true
|
|
444
|
+
}, {
|
|
445
|
+
"value": modelValue,
|
|
446
|
+
"disabled": disabled,
|
|
447
|
+
"type": inputType,
|
|
448
|
+
"maxlength": maxLength,
|
|
449
|
+
"placeholder": placeholder,
|
|
450
|
+
"class": inputCls,
|
|
451
|
+
"onInput": onInput,
|
|
452
|
+
"onFocus": onFocus,
|
|
453
|
+
"onBlur": onBlur,
|
|
454
|
+
"onChange": onChange,
|
|
455
|
+
"onKeydown": onKeydown
|
|
456
|
+
}), null), [[resolveDirective("focus"), autoFocus]]), showPwdIcon && createVNode("div", {
|
|
457
|
+
"class": "devui-input__preview",
|
|
458
|
+
"onClick": onChangeInputType
|
|
459
|
+
}, [showPreviewIcon ? createVNode(resolveComponent("d-icon"), {
|
|
460
|
+
"name": "preview",
|
|
461
|
+
"size": "12px",
|
|
462
|
+
"key": 1
|
|
463
|
+
}, null) : createVNode(resolveComponent("d-icon"), {
|
|
464
|
+
"name": "preview-forbidden",
|
|
465
|
+
"size": "12px",
|
|
466
|
+
"key": 2
|
|
467
|
+
}, null)])]);
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
var search = "";
|
|
471
|
+
var Search = defineComponent({
|
|
472
|
+
name: "DSearch",
|
|
473
|
+
props: searchProps,
|
|
474
|
+
emits: ["update:modelValue", "onSearch"],
|
|
475
|
+
setup(props, ctx) {
|
|
476
|
+
const rootClasses = getRootClass(props);
|
|
477
|
+
const {
|
|
478
|
+
keywords,
|
|
479
|
+
clearIconShow,
|
|
480
|
+
onClearHandle
|
|
481
|
+
} = keywordsHandles(ctx, props);
|
|
482
|
+
const {
|
|
483
|
+
onInputKeydown,
|
|
484
|
+
onClickHandle,
|
|
485
|
+
useEmitKeyword
|
|
486
|
+
} = keydownHandles(ctx, keywords, props.delay);
|
|
487
|
+
const onInputUpdate = (event) => {
|
|
488
|
+
if (props.isKeyupSearch) {
|
|
489
|
+
useEmitKeyword(event);
|
|
490
|
+
}
|
|
491
|
+
keywords.value = event;
|
|
492
|
+
ctx.emit("update:modelValue", event);
|
|
493
|
+
};
|
|
494
|
+
return () => {
|
|
495
|
+
return createVNode("div", {
|
|
496
|
+
"class": rootClasses.value
|
|
497
|
+
}, [props.iconPosition === "left" && createVNode("div", {
|
|
498
|
+
"class": "devui-search__icon",
|
|
499
|
+
"onClick": onClickHandle
|
|
500
|
+
}, [createVNode(resolveComponent("d-icon"), {
|
|
501
|
+
"name": "search",
|
|
502
|
+
"size": "inherit",
|
|
503
|
+
"key": "search"
|
|
504
|
+
}, null)]), createVNode(DInput, {
|
|
505
|
+
"size": props.size,
|
|
506
|
+
"disabled": props.disabled,
|
|
507
|
+
"autoFocus": props.autoFocus,
|
|
508
|
+
"modelValue": keywords.value,
|
|
509
|
+
"maxLength": props.maxLength,
|
|
510
|
+
"placeholder": props.placeholder,
|
|
511
|
+
"cssClass": props.cssClass,
|
|
512
|
+
"onKeydown": onInputKeydown,
|
|
513
|
+
"onUpdate:modelValue": onInputUpdate
|
|
514
|
+
}, null), clearIconShow.value && createVNode("div", {
|
|
515
|
+
"class": "devui-search__clear",
|
|
516
|
+
"onClick": onClearHandle
|
|
517
|
+
}, [createVNode(resolveComponent("d-icon"), {
|
|
518
|
+
"name": "close",
|
|
519
|
+
"size": "inherit",
|
|
520
|
+
"key": "close"
|
|
521
|
+
}, null)]), props.iconPosition === "right" && createVNode("div", {
|
|
522
|
+
"class": "devui-search__icon",
|
|
523
|
+
"onClick": onClickHandle
|
|
524
|
+
}, [createVNode(resolveComponent("d-icon"), {
|
|
525
|
+
"name": "search",
|
|
526
|
+
"size": "inherit",
|
|
527
|
+
"key": "search"
|
|
528
|
+
}, null)])]);
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
});
|
|
532
|
+
Search.install = function(app) {
|
|
533
|
+
app.component(Search.name, Search);
|
|
534
|
+
};
|
|
535
|
+
var index = {
|
|
536
|
+
title: "Search \u641C\u7D22\u6846",
|
|
537
|
+
category: "\u901A\u7528",
|
|
538
|
+
status: "100%",
|
|
539
|
+
install(app) {
|
|
540
|
+
app.use(Search);
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
export { Search, index as default };
|
package/search/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(m,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(m=typeof globalThis!="undefined"?globalThis:m||self,t(m.index={},m.Vue))})(this,function(m,t){"use strict";const K={size:{type:String,default:""},placeholder:{type:String,default:"\u8BF7\u8F93\u5165\u5173\u952E\u5B57"},maxLength:{type:Number,default:Number.MAX_SAFE_INTEGER},delay:{type:Number,default:300},disabled:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1},isKeyupSearch:{type:Boolean,default:!1},iconPosition:{type:String,default:"right"},noBorder:{type:Boolean,default:!1},cssClass:{type:String,default:""},modelValue:{type:String,default:""},onSearch:{type:Function,default:void 0},"onUpdate:modelValue":{type:Function,default:void 0}},M={lg:"lg",sm:"sm"},L={right:"right",left:"left"},$=e=>t.computed(()=>({"devui-search":!0,"devui-search__disbaled":e.disabled,"devui-search__no-border":e.noBorder,[`devui-search__${e.size}`]:M[e.size],[`devui-search__${e.iconPosition}`]:L[e.iconPosition]})),A=(e,n)=>{const o=t.ref("");t.watch(()=>n.modelValue,d=>{o.value=d},{immediate:!0});const a=()=>{o.value="",e.emit("update:modelValue","")},u=t.computed(()=>o.value.length>0);return{keywords:o,clearIconShow:u,onClearHandle:a}};var H=typeof global=="object"&&global&&global.Object===Object&&global,D=H,R=typeof self=="object"&&self&&self.Object===Object&&self,W=D||R||Function("return this")(),N=W,G=N.Symbol,I=G,j=Object.prototype,U=j.hasOwnProperty,X=j.toString,S=I?I.toStringTag:void 0;function q(e){var n=U.call(e,S),o=e[S];try{e[S]=void 0;var a=!0}catch{}var u=X.call(e);return a&&(n?e[S]=o:delete e[S]),u}var Y=Object.prototype,Z=Y.toString;function J(e){return Z.call(e)}var Q="[object Null]",ee="[object Undefined]",E=I?I.toStringTag:void 0;function te(e){return e==null?e===void 0?ee:Q:E&&E in Object(e)?q(e):J(e)}function ne(e){return e!=null&&typeof e=="object"}var oe="[object Symbol]";function re(e){return typeof e=="symbol"||ne(e)&&te(e)==oe}var ae=/\s/;function ie(e){for(var n=e.length;n--&&ae.test(e.charAt(n)););return n}var le=/^\s+/;function ue(e){return e&&e.slice(0,ie(e)+1).replace(le,"")}function _(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var O=0/0,de=/^[-+]0x[0-9a-f]+$/i,se=/^0b[01]+$/i,ce=/^0o[0-7]+$/i,fe=parseInt;function P(e){if(typeof e=="number")return e;if(re(e))return O;if(_(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=_(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=ue(e);var o=se.test(e);return o||ce.test(e)?fe(e.slice(2),o?2:8):de.test(e)?O:+e}var me=function(){return N.Date.now()},V=me,ye="Expected a function",he=Math.max,pe=Math.min;function ge(e,n,o){var a,u,d,i,r,s,f=0,y=!1,h=!1,g=!0;if(typeof e!="function")throw new TypeError(ye);n=P(n)||0,_(o)&&(y=!!o.leading,h="maxWait"in o,d=h?he(P(o.maxWait)||0,n):d,g="trailing"in o?!!o.trailing:g);function b(l){var p=a,w=u;return a=u=void 0,f=l,i=e.apply(w,p),i}function C(l){return f=l,r=setTimeout(T,n),y?b(l):i}function c(l){var p=l-s,w=l-f,z=n-p;return h?pe(z,d-w):z}function B(l){var p=l-s,w=l-f;return s===void 0||p>=n||p<0||h&&w>=d}function T(){var l=V();if(B(l))return x(l);r=setTimeout(T,c(l))}function x(l){return r=void 0,g&&a?b(l):(a=u=void 0,i)}function Te(){r!==void 0&&clearTimeout(r),f=0,a=s=u=r=void 0}function _e(){return r===void 0?i:x(V())}function F(){var l=V(),p=B(l);if(a=arguments,u=this,s=l,p){if(r===void 0)return C(s);if(h)return clearTimeout(r),r=setTimeout(T,n),b(s)}return r===void 0&&(r=setTimeout(T,n)),i}return F.cancel=Te,F.flush=_e,F}const be={enter:"Enter"},Se=(e,n,o)=>{const a=r=>{switch(r.key){case be.enter:u(r);break}},u=r=>{if(r.target instanceof HTMLInputElement){const s=r.target.value;i(s)}},d=()=>{i(n.value)},i=ge(r=>{e.emit("onSearch",r)},o);return{onInputKeydown:a,useEmitKeyword:i,onClickHandle:d}},ve={placeholder:{type:String,default:void 0},disabled:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1},maxLength:{type:Number,default:Number.MAX_SAFE_INTEGER},cssClass:{type:String,default:""},error:{type:Boolean,default:!1},size:{type:String,default:""},showPassword:{type:Boolean,default:!1},modelValue:{type:String,default:""},"update:modelValue":{type:Function,default:void 0},onChange:{type:Function,default:void 0},onKeydown:{type:Function,default:void 0},onFocus:{type:Function,default:void 0},onBlur:{type:Function,default:void 0}};var Ve="";const we=Symbol("dFormItem"),k={blur:"d.form.blur",change:"d.form.change",input:"d.form.input"};var Ie=t.defineComponent({name:"DInput",directives:{focus:{mounted:function(e,n){n.value&&e.focus()}}},props:ve,emits:["update:modelValue","focus","blur","change","keydown"],setup(e,n){const o=t.inject(we,{}),a=Object.keys(o).length>0,u=t.computed(()=>`devui-input-${e.size}`),d=t.ref(!1),i=t.ref("text"),r=t.computed(()=>({error:e.error,[e.cssClass]:!0,[u.value]:e.size!==""})),s=t.computed(()=>i.value==="password");return t.watch(()=>e.showPassword,c=>{i.value=c?"password":"text"},{immediate:!0}),t.watch(()=>e.modelValue,c=>{c&&c.length>0&&s.value?d.value=!0:d.value=!1}),{inputCls:r,inputType:i,showPreviewIcon:s,showPwdIcon:d,onInput:c=>{n.emit("update:modelValue",c.target.value),a&&o.formItemMitt.emit(k.input)},onFocus:()=>{n.emit("focus")},onBlur:()=>{n.emit("blur"),a&&o.formItemMitt.emit(k.blur)},onChange:c=>{n.emit("change",c.target.value),a&&o.formItemMitt.emit(k.change)},onKeydown:c=>{n.emit("keydown",c)},onChangeInputType:()=>{i.value=i.value==="password"?"text":"password"}}},render(){const{modelValue:e,showPreviewIcon:n,showPwdIcon:o,inputCls:a,inputType:u,maxLength:d,autoFocus:i,placeholder:r,disabled:s,onInput:f,onFocus:y,onBlur:h,onChange:g,onKeydown:b,onChangeInputType:C}=this;return t.createVNode("div",{class:"devui-input__wrap"},[t.withDirectives(t.createVNode("input",t.mergeProps({dinput:!0},{value:e,disabled:s,type:u,maxlength:d,placeholder:r,class:a,onInput:f,onFocus:y,onBlur:h,onChange:g,onKeydown:b}),null),[[t.resolveDirective("focus"),i]]),o&&t.createVNode("div",{class:"devui-input__preview",onClick:C},[n?t.createVNode(t.resolveComponent("d-icon"),{name:"preview",size:"12px",key:1},null):t.createVNode(t.resolveComponent("d-icon"),{name:"preview-forbidden",size:"12px",key:2},null)])])}}),ke="",v=t.defineComponent({name:"DSearch",props:K,emits:["update:modelValue","onSearch"],setup(e,n){const o=$(e),{keywords:a,clearIconShow:u,onClearHandle:d}=A(n,e),{onInputKeydown:i,onClickHandle:r,useEmitKeyword:s}=Se(n,a,e.delay),f=y=>{e.isKeyupSearch&&s(y),a.value=y,n.emit("update:modelValue",y)};return()=>t.createVNode("div",{class:o.value},[e.iconPosition==="left"&&t.createVNode("div",{class:"devui-search__icon",onClick:r},[t.createVNode(t.resolveComponent("d-icon"),{name:"search",size:"inherit",key:"search"},null)]),t.createVNode(Ie,{size:e.size,disabled:e.disabled,autoFocus:e.autoFocus,modelValue:a.value,maxLength:e.maxLength,placeholder:e.placeholder,cssClass:e.cssClass,onKeydown:i,"onUpdate:modelValue":f},null),u.value&&t.createVNode("div",{class:"devui-search__clear",onClick:d},[t.createVNode(t.resolveComponent("d-icon"),{name:"close",size:"inherit",key:"close"},null)]),e.iconPosition==="right"&&t.createVNode("div",{class:"devui-search__icon",onClick:r},[t.createVNode(t.resolveComponent("d-icon"),{name:"search",size:"inherit",key:"search"},null)])])}});v.install=function(e){e.component(v.name,v)};var Ce={title:"Search \u641C\u7D22\u6846",category:"\u901A\u7528",status:"100%",install(e){e.use(v)}};m.Search=v,m.default=Ce,Object.defineProperty(m,"__esModule",{value:!0}),m[Symbol.toStringTag]="Module"});
|