@nutui/nutui 3.1.22-beta.5 → 3.1.23-beta.1
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/CHANGELOG.md +48 -0
- package/README.md +3 -4
- package/dist/nutui.es.js +20412 -4214
- package/dist/nutui.umd.js +20518 -4216
- package/dist/packages/_es/ActionSheet.js +149 -17
- package/dist/packages/_es/Address.js +535 -110
- package/dist/packages/_es/AddressList.js +615 -113
- package/dist/packages/_es/Animate.js +59 -17
- package/dist/packages/_es/Audio.js +257 -53
- package/dist/packages/_es/AudioOperate.js +100 -13
- package/dist/packages/_es/Avatar.js +162 -38
- package/dist/packages/_es/AvatarGroup.js +73 -14
- package/dist/packages/_es/BackTop.js +156 -43
- package/dist/packages/_es/Badge.js +86 -14
- package/dist/packages/_es/Barrage.js +120 -41
- package/dist/packages/_es/Button.js +128 -23
- package/dist/packages/_es/Calendar.js +246 -30
- package/dist/packages/_es/CalendarItem.js +1 -1
- package/dist/packages/_es/Card.js +107 -10
- package/dist/packages/_es/Cascader.js +496 -147
- package/dist/packages/_es/Category.js +58 -15
- package/dist/packages/_es/CategoryPane.js +111 -11
- package/dist/packages/_es/Cell.js +108 -21
- package/dist/packages/_es/CellGroup.js +44 -9
- package/dist/packages/_es/Checkbox.js +134 -29
- package/dist/packages/_es/CheckboxGroup.js +79 -29
- package/dist/packages/_es/CircleProgress.js +150 -28
- package/dist/packages/_es/Col.js +56 -14
- package/dist/packages/_es/Collapse.js +109 -32
- package/dist/packages/_es/CollapseItem.js +253 -59
- package/dist/packages/_es/Comment.js +434 -64
- package/dist/packages/_es/ConfigProvider.js +20 -8
- package/dist/packages/_es/CountDown.js +238 -56
- package/dist/packages/_es/CountUp.js +539 -140
- package/dist/packages/_es/DatePicker.js +315 -98
- package/dist/packages/_es/Dialog.js +289 -60
- package/dist/packages/_es/Divider.js +65 -13
- package/dist/packages/_es/Drag.js +197 -56
- package/dist/packages/_es/Ecard.js +159 -24
- package/dist/packages/_es/Elevator.js +255 -58
- package/dist/packages/_es/Ellipsis.js +200 -58
- package/dist/packages/_es/Empty.js +71 -12
- package/dist/packages/_es/FixedNav.js +122 -15
- package/dist/packages/_es/Form.js +151 -64
- package/dist/packages/_es/FormItem.js +114 -15
- package/dist/packages/_es/Grid.js +6 -5
- package/dist/packages/_es/GridItem.js +144 -33
- package/dist/packages/_es/Icon.js +40 -15
- package/dist/packages/_es/Image.js +137 -26
- package/dist/packages/_es/ImagePreview.js +547 -76
- package/dist/packages/_es/Indicator.js +62 -15
- package/dist/packages/_es/InfiniteLoading.js +249 -57
- package/dist/packages/_es/Input.js +433 -51
- package/dist/packages/_es/InputNumber.js +160 -41
- package/dist/packages/_es/Layout.js +5 -4
- package/dist/packages/_es/List.js +106 -18
- package/dist/packages/_es/Menu.js +168 -44
- package/dist/packages/_es/MenuItem.js +173 -37
- package/dist/packages/_es/Navbar.js +192 -30
- package/dist/packages/_es/NoticeBar.js +380 -74
- package/dist/packages/_es/Notify.js +227 -72
- package/dist/packages/_es/NumberKeyboard.js +272 -41
- package/dist/packages/_es/OldPicker.js +457 -130
- package/dist/packages/_es/OverLay.js +98 -24
- package/dist/packages/_es/Pagination.js +157 -39
- package/dist/packages/_es/Picker.js +454 -129
- package/dist/packages/_es/Popover.js +957 -318
- package/dist/packages/_es/Popup.js +299 -55
- package/dist/packages/_es/Price.js +118 -16
- package/dist/packages/_es/Progress.js +146 -14
- package/dist/packages/_es/PullRefresh.js +339 -84
- package/dist/packages/_es/Radio.js +90 -22
- package/dist/packages/_es/RadioGroup.js +37 -8
- package/dist/packages/_es/Range.js +408 -83
- package/dist/packages/_es/Rate.js +192 -36
- package/dist/packages/_es/Row.js +64 -22
- package/dist/packages/_es/SearchBar.js +238 -37
- package/dist/packages/_es/ShortPassword.js +225 -35
- package/dist/packages/_es/SideNavBar.js +81 -24
- package/dist/packages/_es/SideNavBarItem.js +46 -11
- package/dist/packages/_es/Signature.js +160 -41
- package/dist/packages/_es/Skeleton.js +136 -20
- package/dist/packages/_es/Sku.js +491 -84
- package/dist/packages/_es/Step.js +115 -20
- package/dist/packages/_es/Steps.js +53 -18
- package/dist/packages/_es/Sticky.js +138 -53
- package/dist/packages/_es/SubSideNavBar.js +82 -17
- package/dist/packages/_es/Swipe.js +178 -41
- package/dist/packages/_es/Swiper.js +433 -121
- package/dist/packages/_es/SwiperItem.js +53 -22
- package/dist/packages/_es/Switch.js +116 -21
- package/dist/packages/_es/TabPane.js +39 -12
- package/dist/packages/_es/Tabbar.js +72 -17
- package/dist/packages/_es/TabbarItem.js +151 -29
- package/dist/packages/_es/Table.js +178 -18
- package/dist/packages/_es/Tabs.js +202 -43
- package/dist/packages/_es/Tag.js +97 -20
- package/dist/packages/_es/TextArea.js +160 -42
- package/dist/packages/_es/TimeDetail.js +79 -18
- package/dist/packages/_es/TimePannel.js +48 -14
- package/dist/packages/_es/TimeSelect.js +112 -15
- package/dist/packages/_es/Toast.js +310 -71
- package/dist/packages/_es/Uploader.js +455 -104
- package/dist/packages/_es/Video.js +332 -74
- package/dist/packages/_es/common.js +128 -38
- package/dist/packages/_es/component.js +76 -35
- package/dist/packages/_es/index.js +6 -5
- package/dist/packages/_es/index2.js +30 -9
- package/dist/packages/_es/index3.js +8 -6
- package/dist/packages/_es/index4.js +64 -13
- package/dist/packages/_es/index5.js +780 -164
- package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
- package/dist/packages/_es/pxCheck.js +5 -3
- package/dist/packages/_es/raf.js +15 -8
- package/dist/packages/imagepreview/index.scss +6 -1
- package/dist/packages/locale/lang/baseLang.js +3 -3
- package/dist/packages/locale/lang/en-US.js +105 -5
- package/dist/packages/locale/lang/id-ID.js +105 -5
- package/dist/packages/locale/lang/index.js +38 -16
- package/dist/packages/locale/lang/zh-CN.js +105 -5
- package/dist/packages/locale/lang/zh-TW.js +105 -5
- package/dist/packages/picker/index.scss +13 -0
- package/dist/smartips/attributes.json +8 -0
- package/dist/smartips/tags.json +3 -1
- package/dist/smartips/web-types.json +19 -1
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/themes/default.scss +49 -49
- package/dist/styles/themes/jdb.scss +49 -49
- package/dist/styles/themes/jdt.scss +49 -49
- package/dist/styles/variables-jdb.scss +4 -1
- package/dist/styles/variables-jdt.scss +4 -1
- package/dist/styles/variables.scss +1 -1
- package/dist/types/__VUE/actionsheet/index.vue.d.ts +3 -3
- package/dist/types/__VUE/address/index.vue.d.ts +4 -4
- package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
- package/dist/types/__VUE/cascader/index.vue.d.ts +3 -3
- package/dist/types/__VUE/cell/index.vue.d.ts +2 -2
- package/dist/types/__VUE/checkbox/index.vue.d.ts +2 -2
- package/dist/types/__VUE/collapse/index.vue.d.ts +2 -2
- package/dist/types/__VUE/datepicker/index.vue.d.ts +2 -2
- package/dist/types/__VUE/dialog/index.vue.d.ts +2 -2
- package/dist/types/__VUE/ecard/index.vue.d.ts +2 -2
- package/dist/types/__VUE/fixednav/index.vue.d.ts +2 -2
- package/dist/types/__VUE/grid/index.vue.d.ts +3 -3
- package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +95 -0
- package/dist/types/__VUE/imagepreview/index.vue.d.ts +23 -25
- package/dist/types/__VUE/infiniteloading/index.vue.d.ts +6 -6
- package/dist/types/__VUE/input/index.vue.d.ts +2 -2
- package/dist/types/__VUE/menu/index.vue.d.ts +4 -4
- package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
- package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
- package/dist/types/__VUE/oldpicker/index.vue.d.ts +3 -3
- package/dist/types/__VUE/picker/index.vue.d.ts +3 -3
- package/dist/types/__VUE/popover/index.vue.d.ts +6 -6
- package/dist/types/__VUE/popup/index.vue.d.ts +4 -4
- package/dist/types/__VUE/range/index.vue.d.ts +1 -1
- package/dist/types/__VUE/rate/index.vue.d.ts +2 -2
- package/dist/types/__VUE/searchbar/index.vue.d.ts +2 -2
- package/dist/types/__VUE/shortpassword/index.vue.d.ts +1 -1
- package/dist/types/__VUE/sku/index.vue.d.ts +3 -3
- package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
- package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
- package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
- package/dist/types/__VUE/textarea/index.vue.d.ts +2 -2
- package/dist/types/__VUE/toast/index.vue.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -2
|
@@ -1,42 +1,198 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { c as
|
|
7
|
-
import { ref
|
|
8
|
-
import { p as
|
|
9
|
-
import { u as
|
|
10
|
-
import { _ as
|
|
6
|
+
import { c as createComponent } from "./component.js";
|
|
7
|
+
import { ref, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, Fragment, renderList, normalizeStyle, createVNode, createBlock, createCommentVNode } from "vue";
|
|
8
|
+
import { p as pxCheck } from "./pxCheck.js";
|
|
9
|
+
import { u as useTouch } from "./index4.js";
|
|
10
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
11
11
|
import "../locale/lang";
|
|
12
|
-
const { componentName
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
const { componentName } = createComponent("rate");
|
|
13
|
+
const useComponent = (touchable = true) => {
|
|
14
|
+
return {
|
|
15
|
+
props: {
|
|
16
|
+
count: {
|
|
17
|
+
type: [String, Number],
|
|
18
|
+
default: 5
|
|
19
|
+
},
|
|
20
|
+
modelValue: {
|
|
21
|
+
type: [String, Number],
|
|
22
|
+
default: 0
|
|
23
|
+
},
|
|
24
|
+
iconSize: {
|
|
25
|
+
type: [String, Number],
|
|
26
|
+
default: 18
|
|
27
|
+
},
|
|
28
|
+
activeColor: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ""
|
|
31
|
+
},
|
|
32
|
+
voidColor: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: ""
|
|
35
|
+
},
|
|
36
|
+
uncheckedIcon: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "star-n"
|
|
39
|
+
},
|
|
40
|
+
checkedIcon: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: "star-fill-n"
|
|
43
|
+
},
|
|
44
|
+
readonly: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
47
|
+
},
|
|
48
|
+
disabled: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false
|
|
51
|
+
},
|
|
52
|
+
allowHalf: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
touchable: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: true
|
|
59
|
+
},
|
|
60
|
+
spacing: {
|
|
61
|
+
type: [String, Number],
|
|
62
|
+
default: 14
|
|
63
|
+
},
|
|
64
|
+
classPrefix: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: "nut-icon"
|
|
67
|
+
},
|
|
68
|
+
fontClassName: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: "nutui-iconfont"
|
|
26
71
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
72
|
+
},
|
|
73
|
+
emits: ["update:modelValue", "change"],
|
|
74
|
+
setup(props, { emit }) {
|
|
75
|
+
const rateRefs = ref([]);
|
|
76
|
+
const classes = computed(() => {
|
|
77
|
+
const prefixCls = componentName;
|
|
78
|
+
return {
|
|
79
|
+
[prefixCls]: true
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
const updateVal = (value) => {
|
|
83
|
+
emit("update:modelValue", value);
|
|
84
|
+
emit("change", value);
|
|
85
|
+
};
|
|
86
|
+
const onClick = (e, index2) => {
|
|
87
|
+
if (props.disabled || props.readonly)
|
|
88
|
+
return;
|
|
89
|
+
let value = 0;
|
|
90
|
+
if (index2 === 1 && props.modelValue === index2)
|
|
91
|
+
;
|
|
92
|
+
else {
|
|
93
|
+
value = index2;
|
|
94
|
+
if (props.allowHalf && e == 2) {
|
|
95
|
+
value -= 0.5;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
updateVal(value);
|
|
99
|
+
};
|
|
100
|
+
const getScoreByPosition = (x, rateRefs2, allowHalf) => {
|
|
101
|
+
let v = 0;
|
|
102
|
+
for (let index2 = rateRefs2.value.length - 1; index2 >= 0; index2--) {
|
|
103
|
+
const item = rateRefs2.value[index2];
|
|
104
|
+
if (x > item.offsetLeft) {
|
|
105
|
+
if (allowHalf) {
|
|
106
|
+
v = index2 + (x > item.offsetLeft + item.clientWidth / 2 ? 1 : 0.5);
|
|
107
|
+
} else {
|
|
108
|
+
v = index2 + 1;
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return v;
|
|
114
|
+
};
|
|
115
|
+
const touch = useTouch();
|
|
116
|
+
const touchMethods = {
|
|
117
|
+
onTouchStart(event) {
|
|
118
|
+
if (!props.touchable)
|
|
119
|
+
return;
|
|
120
|
+
touch.start(event);
|
|
121
|
+
},
|
|
122
|
+
onTouchMove(event) {
|
|
123
|
+
if (!props.touchable || !touchable)
|
|
124
|
+
return;
|
|
125
|
+
touch.move(event);
|
|
126
|
+
if (touch.isHorizontal()) {
|
|
127
|
+
if (rateRefs.value) {
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
updateVal(getScoreByPosition(touch.moveX.value, rateRefs, props.allowHalf));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
const refRandomId = Math.random().toString(36).slice(-8);
|
|
135
|
+
return {
|
|
136
|
+
classes,
|
|
137
|
+
...touchMethods,
|
|
138
|
+
onClick,
|
|
139
|
+
pxCheck,
|
|
140
|
+
rateRefs,
|
|
141
|
+
refRandomId
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
const component = useComponent();
|
|
147
|
+
const _hoisted_1 = ["id"];
|
|
148
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
149
|
+
const _component_nut_icon = resolveComponent("nut-icon");
|
|
150
|
+
return openBlock(), createElementBlock("view", {
|
|
151
|
+
class: normalizeClass(_ctx.classes),
|
|
152
|
+
onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
|
|
153
|
+
onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args))
|
|
154
|
+
}, [
|
|
155
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(Number(_ctx.count), (n) => {
|
|
156
|
+
return openBlock(), createElementBlock("view", {
|
|
157
|
+
class: "nut-rate-item",
|
|
158
|
+
key: n,
|
|
159
|
+
ref: "rateRefs",
|
|
160
|
+
id: "rateRefs-" + _ctx.refRandomId + n,
|
|
161
|
+
style: normalizeStyle({ marginRight: _ctx.pxCheck(_ctx.spacing) })
|
|
162
|
+
}, [
|
|
163
|
+
createVNode(_component_nut_icon, {
|
|
164
|
+
size: _ctx.iconSize,
|
|
165
|
+
class: normalizeClass(["nut-rate-item__icon", { "nut-rate-item__icon--disabled": _ctx.disabled || n > _ctx.modelValue }]),
|
|
166
|
+
onClick: ($event) => _ctx.onClick(1, n),
|
|
167
|
+
color: n <= _ctx.modelValue ? _ctx.activeColor : _ctx.voidColor,
|
|
168
|
+
"font-class-name": _ctx.fontClassName,
|
|
169
|
+
"class-prefix": _ctx.classPrefix,
|
|
170
|
+
name: n <= _ctx.modelValue ? _ctx.checkedIcon : _ctx.uncheckedIcon
|
|
171
|
+
}, null, 8, ["size", "onClick", "class", "color", "font-class-name", "class-prefix", "name"]),
|
|
172
|
+
_ctx.allowHalf && Number(_ctx.modelValue) + 1 > n ? (openBlock(), createBlock(_component_nut_icon, {
|
|
173
|
+
key: 0,
|
|
174
|
+
class: "nut-rate-item__icon nut-rate-item__icon--half",
|
|
175
|
+
onClick: ($event) => _ctx.onClick(2, n),
|
|
176
|
+
"font-class-name": _ctx.fontClassName,
|
|
177
|
+
"class-prefix": _ctx.classPrefix,
|
|
178
|
+
color: n <= Number(_ctx.modelValue) + 1 ? _ctx.activeColor : _ctx.voidColor,
|
|
179
|
+
size: _ctx.iconSize,
|
|
180
|
+
name: _ctx.checkedIcon
|
|
181
|
+
}, null, 8, ["onClick", "font-class-name", "class-prefix", "color", "size", "name"])) : _ctx.allowHalf && Number(_ctx.modelValue) + 1 < n ? (openBlock(), createBlock(_component_nut_icon, {
|
|
182
|
+
key: 1,
|
|
183
|
+
class: "nut-rate-item__icon nut-rate-item__icon--disabled nut-rate-item__icon--half",
|
|
184
|
+
onClick: ($event) => _ctx.onClick(2, n),
|
|
185
|
+
"font-class-name": _ctx.fontClassName,
|
|
186
|
+
"class-prefix": _ctx.classPrefix,
|
|
187
|
+
color: _ctx.voidColor,
|
|
188
|
+
size: _ctx.iconSize,
|
|
189
|
+
name: _ctx.uncheckedIcon
|
|
190
|
+
}, null, 8, ["onClick", "font-class-name", "class-prefix", "color", "size", "name"])) : createCommentVNode("", true)
|
|
191
|
+
], 12, _hoisted_1);
|
|
192
|
+
}), 128))
|
|
193
|
+
], 34);
|
|
194
|
+
}
|
|
195
|
+
const { create } = createComponent("rate");
|
|
196
|
+
const _sfc_main = create(component);
|
|
197
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", render]]);
|
|
198
|
+
export { index as default };
|
package/dist/packages/_es/Row.js
CHANGED
|
@@ -1,27 +1,69 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { provide
|
|
7
|
-
import { c as
|
|
8
|
-
import { _ as
|
|
6
|
+
import { provide, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
9
|
import "../locale/lang";
|
|
10
|
-
const { componentName
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
10
|
+
const { componentName, create } = createComponent("row");
|
|
11
|
+
const _sfc_main = create({
|
|
12
|
+
props: {
|
|
13
|
+
type: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: ""
|
|
16
|
+
},
|
|
17
|
+
gutter: {
|
|
18
|
+
type: [String, Number],
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
justify: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "start"
|
|
24
|
+
},
|
|
25
|
+
align: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "flex-start"
|
|
28
|
+
},
|
|
29
|
+
flexWrap: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "nowrap"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
emits: ["click"],
|
|
35
|
+
setup(props, { emit }) {
|
|
36
|
+
const prefixCls = componentName;
|
|
37
|
+
provide("gutter", props.gutter);
|
|
38
|
+
const getClass = (prefix, type) => {
|
|
39
|
+
return prefix ? type ? `nut-row-${prefix}-${type}` : "" : `nut-row-${type}`;
|
|
40
|
+
};
|
|
41
|
+
const getClasses = () => {
|
|
42
|
+
return `
|
|
43
|
+
${getClass("", props.type)}
|
|
44
|
+
${getClass("justify", props.justify)}
|
|
45
|
+
${getClass("align", props.align)}
|
|
46
|
+
${getClass("flex", props.flexWrap)}
|
|
47
|
+
${prefixCls}
|
|
48
|
+
`;
|
|
49
|
+
};
|
|
50
|
+
const handleClick = (evt) => {
|
|
51
|
+
evt.stopPropagation();
|
|
52
|
+
emit("click", evt);
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
getClasses,
|
|
56
|
+
handleClick
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
61
|
+
return openBlock(), createElementBlock("view", {
|
|
62
|
+
class: normalizeClass(_ctx.getClasses()),
|
|
63
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
|
|
64
|
+
}, [
|
|
65
|
+
renderSlot(_ctx.$slots, "default")
|
|
66
|
+
], 2);
|
|
67
|
+
}
|
|
68
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
69
|
+
export { index as default };
|
|
@@ -1,42 +1,243 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { reactive
|
|
7
|
-
import { c as
|
|
8
|
-
import { _ as
|
|
6
|
+
import { reactive, computed, ref, onMounted, toRefs, resolveComponent, openBlock, createElementBlock, normalizeStyle, toDisplayString, createCommentVNode, renderSlot, createElementVNode, withModifiers, withDirectives, createVNode, vShow } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
9
|
import "../locale/lang";
|
|
10
|
-
const { create
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
10
|
+
const { create, translate } = createComponent("searchbar");
|
|
11
|
+
const _sfc_main = create({
|
|
12
|
+
props: {
|
|
13
|
+
modelValue: {
|
|
14
|
+
type: [String, Number],
|
|
15
|
+
default: ""
|
|
16
|
+
},
|
|
17
|
+
inputType: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: "textarea"
|
|
20
|
+
},
|
|
21
|
+
label: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: ""
|
|
24
|
+
},
|
|
25
|
+
maxLength: {
|
|
26
|
+
type: [String, Number],
|
|
27
|
+
default: "9999"
|
|
28
|
+
},
|
|
29
|
+
placeholder: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ""
|
|
32
|
+
},
|
|
33
|
+
clearable: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: true
|
|
36
|
+
},
|
|
37
|
+
background: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: ""
|
|
40
|
+
},
|
|
41
|
+
inputBackground: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: ""
|
|
44
|
+
},
|
|
45
|
+
autofocus: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
disabled: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
readonly: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false
|
|
56
|
+
},
|
|
57
|
+
inputAlign: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: "left"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
emits: [
|
|
63
|
+
"change",
|
|
64
|
+
"update:modelValue",
|
|
65
|
+
"blur",
|
|
66
|
+
"focus",
|
|
67
|
+
"clear",
|
|
68
|
+
"search",
|
|
69
|
+
"click-input",
|
|
70
|
+
"click-left-icon",
|
|
71
|
+
"click-right-icon"
|
|
72
|
+
],
|
|
73
|
+
setup(props, { emit }) {
|
|
74
|
+
const state = reactive({
|
|
75
|
+
active: false
|
|
76
|
+
});
|
|
77
|
+
const searchbarStyle = computed(() => {
|
|
78
|
+
return {
|
|
79
|
+
background: props.background
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
const inputSearchbarStyle = computed(() => {
|
|
83
|
+
return {
|
|
84
|
+
background: props.inputBackground
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
const valueChange = (event) => {
|
|
88
|
+
const input = event.target;
|
|
89
|
+
let val = input.value;
|
|
90
|
+
if (props.maxLength && val.length > Number(props.maxLength)) {
|
|
91
|
+
val = val.slice(0, Number(props.maxLength));
|
|
92
|
+
}
|
|
93
|
+
emit("update:modelValue", val, event);
|
|
94
|
+
emit("change", val, event);
|
|
95
|
+
};
|
|
96
|
+
const valueFocus = (event) => {
|
|
97
|
+
const input = event.target;
|
|
98
|
+
let value = input.value;
|
|
99
|
+
state.active = true;
|
|
100
|
+
emit("focus", value, event);
|
|
101
|
+
};
|
|
102
|
+
const valueBlur = (event) => {
|
|
103
|
+
setTimeout(() => {
|
|
104
|
+
state.active = false;
|
|
105
|
+
}, 0);
|
|
106
|
+
const input = event.target;
|
|
107
|
+
let value = input.value;
|
|
108
|
+
if (props.maxLength && value.length > Number(props.maxLength)) {
|
|
109
|
+
value = value.slice(0, Number(props.maxLength));
|
|
110
|
+
}
|
|
111
|
+
emit("blur", value, event);
|
|
112
|
+
};
|
|
113
|
+
const handleClear = (event) => {
|
|
114
|
+
emit("update:modelValue", "", event);
|
|
115
|
+
emit("change", "", event);
|
|
116
|
+
emit("clear", "");
|
|
117
|
+
};
|
|
118
|
+
const handleSubmit = () => {
|
|
119
|
+
emit("search", props.modelValue);
|
|
120
|
+
};
|
|
121
|
+
const clickInput = (event) => {
|
|
122
|
+
emit("click-input", event);
|
|
123
|
+
};
|
|
124
|
+
const leftIconClick = (event) => {
|
|
125
|
+
emit("click-left-icon", props.modelValue, event);
|
|
126
|
+
};
|
|
127
|
+
const rightIconClick = (event) => {
|
|
128
|
+
emit("click-right-icon", props.modelValue, event);
|
|
129
|
+
};
|
|
130
|
+
const styleSearchbar = computed(() => {
|
|
131
|
+
return {
|
|
132
|
+
"text-align": props.inputAlign
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
const inputsearch = ref(null);
|
|
136
|
+
onMounted(() => {
|
|
137
|
+
if (props.autofocus) {
|
|
138
|
+
inputsearch.value.focus();
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
return {
|
|
142
|
+
inputsearch,
|
|
143
|
+
...toRefs(state),
|
|
144
|
+
valueChange,
|
|
145
|
+
valueFocus,
|
|
146
|
+
valueBlur,
|
|
147
|
+
handleClear,
|
|
148
|
+
handleSubmit,
|
|
149
|
+
searchbarStyle,
|
|
150
|
+
inputSearchbarStyle,
|
|
151
|
+
translate,
|
|
152
|
+
clickInput,
|
|
153
|
+
leftIconClick,
|
|
154
|
+
rightIconClick,
|
|
155
|
+
styleSearchbar
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
const _hoisted_1 = {
|
|
160
|
+
key: 0,
|
|
161
|
+
class: "nut-searchbar__search-label"
|
|
162
|
+
};
|
|
163
|
+
const _hoisted_2 = {
|
|
164
|
+
key: 1,
|
|
165
|
+
class: "nut-searchbar__search-icon nut-searchbar__left-search-icon"
|
|
166
|
+
};
|
|
167
|
+
const _hoisted_3 = { class: "nut-searchbar__input-inner" };
|
|
168
|
+
const _hoisted_4 = ["type", "maxlength", "placeholder", "value", "disabled", "readonly"];
|
|
169
|
+
const _hoisted_5 = {
|
|
170
|
+
key: 2,
|
|
171
|
+
class: "nut-searchbar__search-icon nut-searchbar__right-search-icon"
|
|
172
|
+
};
|
|
173
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
174
|
+
const _component_nut_icon = resolveComponent("nut-icon");
|
|
175
|
+
return openBlock(), createElementBlock("view", {
|
|
176
|
+
class: "nut-searchbar",
|
|
177
|
+
style: normalizeStyle(_ctx.searchbarStyle)
|
|
178
|
+
}, [
|
|
179
|
+
_ctx.label ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(_ctx.label), 1)) : createCommentVNode("", true),
|
|
180
|
+
_ctx.$slots.leftout ? (openBlock(), createElementBlock("view", _hoisted_2, [
|
|
181
|
+
renderSlot(_ctx.$slots, "leftout")
|
|
182
|
+
])) : createCommentVNode("", true),
|
|
183
|
+
createElementVNode("view", {
|
|
184
|
+
class: "nut-searchbar__search-input",
|
|
185
|
+
style: normalizeStyle(_ctx.inputSearchbarStyle)
|
|
186
|
+
}, [
|
|
187
|
+
_ctx.$slots.leftin ? (openBlock(), createElementBlock("view", {
|
|
188
|
+
key: 0,
|
|
189
|
+
class: "nut-searchbar__search-icon nut-searchbar__iptleft-search-icon",
|
|
190
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.leftIconClick && _ctx.leftIconClick(...args))
|
|
191
|
+
}, [
|
|
192
|
+
renderSlot(_ctx.$slots, "leftin")
|
|
193
|
+
])) : createCommentVNode("", true),
|
|
194
|
+
createElementVNode("view", _hoisted_3, [
|
|
195
|
+
createElementVNode("form", {
|
|
196
|
+
action: "#",
|
|
197
|
+
onSubmit: _cache[5] || (_cache[5] = withModifiers((...args) => _ctx.handleSubmit && _ctx.handleSubmit(...args), ["prevent"]))
|
|
198
|
+
}, [
|
|
199
|
+
createElementVNode("input", {
|
|
200
|
+
ref: "inputsearch",
|
|
201
|
+
class: "nut-searchbar__input-bar",
|
|
202
|
+
type: _ctx.inputType,
|
|
203
|
+
maxlength: _ctx.maxLength,
|
|
204
|
+
placeholder: _ctx.placeholder || _ctx.translate("placeholder"),
|
|
205
|
+
value: _ctx.modelValue,
|
|
206
|
+
disabled: _ctx.disabled,
|
|
207
|
+
readonly: _ctx.readonly,
|
|
208
|
+
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.clickInput && _ctx.clickInput(...args)),
|
|
209
|
+
onInput: _cache[2] || (_cache[2] = (...args) => _ctx.valueChange && _ctx.valueChange(...args)),
|
|
210
|
+
onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.valueFocus && _ctx.valueFocus(...args)),
|
|
211
|
+
onBlur: _cache[4] || (_cache[4] = (...args) => _ctx.valueBlur && _ctx.valueBlur(...args)),
|
|
212
|
+
style: normalizeStyle(_ctx.styleSearchbar)
|
|
213
|
+
}, null, 44, _hoisted_4)
|
|
214
|
+
], 32),
|
|
215
|
+
_ctx.clearable ? withDirectives((openBlock(), createElementBlock("view", {
|
|
216
|
+
key: 0,
|
|
217
|
+
onClick: _cache[6] || (_cache[6] = (...args) => _ctx.handleClear && _ctx.handleClear(...args)),
|
|
218
|
+
class: "nut-searchbar__input-clear"
|
|
219
|
+
}, [
|
|
220
|
+
createVNode(_component_nut_icon, {
|
|
221
|
+
name: "circle-close",
|
|
222
|
+
size: "12",
|
|
223
|
+
color: "#555"
|
|
224
|
+
})
|
|
225
|
+
], 512)), [
|
|
226
|
+
[vShow, _ctx.modelValue.length > 0]
|
|
227
|
+
]) : createCommentVNode("", true)
|
|
228
|
+
]),
|
|
229
|
+
_ctx.$slots.rightin ? (openBlock(), createElementBlock("view", {
|
|
230
|
+
key: 1,
|
|
231
|
+
class: "nut-searchbar__search-icon nut-searchbar__iptright-sarch-icon",
|
|
232
|
+
onClick: _cache[7] || (_cache[7] = (...args) => _ctx.rightIconClick && _ctx.rightIconClick(...args))
|
|
233
|
+
}, [
|
|
234
|
+
renderSlot(_ctx.$slots, "rightin")
|
|
235
|
+
])) : createCommentVNode("", true)
|
|
236
|
+
], 4),
|
|
237
|
+
_ctx.$slots.rightout ? (openBlock(), createElementBlock("view", _hoisted_5, [
|
|
238
|
+
renderSlot(_ctx.$slots, "rightout")
|
|
239
|
+
])) : createCommentVNode("", true)
|
|
240
|
+
], 4);
|
|
241
|
+
}
|
|
242
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
243
|
+
export { index as default };
|