@nutui/nutui 3.1.11-beta.0 → 3.1.12
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 +44 -0
- package/dist/nutui.d.ts +5 -2
- package/dist/nutui.es.js +4243 -3673
- package/dist/nutui.umd.js +4252 -3679
- package/dist/packages/_es/ActionSheet.js +1 -1
- package/dist/packages/_es/Address.js +1 -1
- package/dist/packages/_es/Avatar.js +1 -1
- package/dist/packages/_es/BackTop.js +1 -1
- package/dist/packages/_es/Badge.js +1 -1
- package/dist/packages/_es/Barrage.js +1 -1
- package/dist/packages/_es/Button.js +1 -1
- package/dist/packages/_es/Calendar.js +1 -1
- package/dist/packages/_es/Card.js +105 -0
- package/dist/packages/_es/Cell.js +1 -1
- package/dist/packages/_es/CellGroup.js +10 -4
- package/dist/packages/_es/Checkbox.js +1 -1
- package/dist/packages/_es/CheckboxGroup.js +2 -2
- package/dist/packages/_es/CircleProgress.js +1 -1
- package/dist/packages/_es/Col.js +1 -1
- package/dist/packages/_es/Collapse.js +1 -1
- package/dist/packages/_es/CollapseItem.js +1 -1
- package/dist/packages/_es/CountDown.js +1 -1
- package/dist/packages/_es/CountUp.js +1 -1
- package/dist/packages/_es/DatePicker.js +2 -2
- package/dist/packages/_es/Dialog.js +10 -23
- package/dist/packages/_es/Divider.js +1 -1
- package/dist/packages/_es/Drag.js +1 -1
- package/dist/packages/_es/Elevator.js +1 -1
- package/dist/packages/_es/FixedNav.js +1 -1
- package/dist/packages/_es/Form.js +138 -0
- package/dist/packages/_es/FormItem.js +110 -0
- package/dist/packages/_es/Icon.js +1 -1
- package/dist/packages/_es/ImagePreview.js +148 -32
- package/dist/packages/_es/InfiniteLoading.js +1 -1
- package/dist/packages/_es/Input.js +1 -1
- package/dist/packages/_es/InputNumber.js +1 -1
- package/dist/packages/_es/Layout.js +1 -1
- package/dist/packages/_es/Menu.js +83 -167
- package/dist/packages/_es/MenuItem.js +154 -15
- package/dist/packages/_es/Navbar.js +1 -1
- package/dist/packages/_es/NoticeBar.js +1 -1
- package/dist/packages/_es/Notify.js +1 -1
- package/dist/packages/_es/NumberKeyboard.js +9 -7
- package/dist/packages/_es/OverLay.js +1 -1
- package/dist/packages/_es/Pagination.js +1 -1
- package/dist/packages/_es/Picker.js +2 -2
- package/dist/packages/_es/Popover.js +11 -17
- package/dist/packages/_es/Popup.js +52 -13
- package/dist/packages/_es/Price.js +1 -1
- package/dist/packages/_es/Progress.js +1 -1
- package/dist/packages/_es/Radio.js +1 -1
- package/dist/packages/_es/RadioGroup.js +1 -1
- package/dist/packages/_es/Range.js +4 -32
- package/dist/packages/_es/Rate.js +19 -5
- package/dist/packages/_es/Row.js +1 -1
- package/dist/packages/_es/SearchBar.js +1 -1
- package/dist/packages/_es/ShortPassword.js +1 -1
- package/dist/packages/_es/Signature.js +1 -1
- package/dist/packages/_es/Sku.js +2 -37
- package/dist/packages/_es/Step.js +1 -1
- package/dist/packages/_es/Steps.js +1 -1
- package/dist/packages/_es/Swipe.js +2 -2
- package/dist/packages/_es/Swiper.js +11 -11
- package/dist/packages/_es/SwiperItem.js +3 -3
- package/dist/packages/_es/Switch.js +28 -8
- package/dist/packages/_es/TabPane.js +1 -1
- package/dist/packages/_es/Tabbar.js +1 -1
- package/dist/packages/_es/TabbarItem.js +1 -1
- package/dist/packages/_es/Tabs.js +1 -1
- package/dist/packages/_es/Tag.js +1 -1
- package/dist/packages/_es/TextArea.js +1 -1
- package/dist/packages/_es/TimeDetail.js +1 -1
- package/dist/packages/_es/TimePannel.js +1 -1
- package/dist/packages/_es/TimeSelect.js +1 -1
- package/dist/packages/_es/Toast.js +18 -8
- package/dist/packages/_es/Uploader.js +30 -22
- package/dist/packages/_es/Video.js +3 -3
- package/dist/packages/_es/component.js +1 -1
- package/dist/packages/_es/index.js +7 -58
- package/dist/packages/_es/index2.js +58 -7
- package/dist/packages/_es/index3.js +36 -0
- package/dist/packages/_es/plugin-vue_export-helper.js +4 -3
- package/dist/packages/_es/pxCheck.js +1 -1
- package/dist/packages/_es/raf.js +1 -1
- package/dist/packages/_es/util.js +47 -0
- package/dist/packages/button/index.scss +6 -0
- package/dist/packages/card/index.scss +97 -0
- package/dist/packages/cellgroup/index.scss +9 -0
- package/dist/packages/checkbox/index.scss +1 -1
- package/dist/packages/dialog/index.scss +17 -0
- package/dist/packages/drag/index.scss +4 -0
- package/dist/packages/fixednav/index.scss +6 -1
- package/dist/packages/form/index.scss +2 -0
- package/dist/packages/formitem/index.scss +63 -0
- package/dist/packages/icon/index.scss +2 -1
- package/dist/packages/menu/index.scss +32 -60
- package/dist/packages/menuitem/index.scss +36 -99
- package/dist/packages/numberkeyboard/index.scss +1 -1
- package/dist/packages/popover/index.scss +2 -2
- package/dist/packages/rate/index.scss +1 -0
- package/dist/packages/switch/index.scss +1 -1
- package/dist/packages/textarea/index.scss +1 -0
- package/dist/packages/timedetail/index.scss +1 -2
- package/dist/packages/timeselect/index.scss +3 -0
- package/dist/packages/toast/index.scss +6 -0
- package/dist/packages/uploader/index.scss +1 -0
- package/dist/style.css +1 -1
- package/dist/styles/font/config.json +2 -1
- package/dist/styles/font/demo_index.html +26 -3
- package/dist/styles/font/iconfont.css +7 -3
- package/dist/styles/font/iconfont.js +31 -32
- package/dist/styles/font/iconfont.json +7 -0
- package/dist/styles/font/iconfont.ttf +0 -0
- package/dist/styles/font/iconfont.woff +0 -0
- package/dist/styles/font/iconfont.woff2 +0 -0
- package/dist/styles/themes/default.scss +39 -36
- package/dist/styles/variables.scss +29 -2
- package/package.json +3 -2
- package/dist/packages/_es/style.css +0 -160
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.
|
|
21
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2021 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
@@ -15,7 +15,7 @@ var __spreadValues = (a, b) => {
|
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
17
|
/*!
|
|
18
|
-
* @nutui/nutui v3.1.
|
|
18
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
19
19
|
* (c) 2021 @jdf2e.
|
|
20
20
|
* Released under the MIT License.
|
|
21
21
|
*/
|
|
@@ -15,7 +15,7 @@ var __spreadValues = (a, b) => {
|
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
17
|
/*!
|
|
18
|
-
* @nutui/nutui v3.1.
|
|
18
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
19
19
|
* (c) 2021 @jdf2e.
|
|
20
20
|
* Released under the MIT License.
|
|
21
21
|
*/
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { c as createComponent } from "./component.js";
|
|
7
|
+
import { resolveComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, renderSlot, createVNode, createBlock, Fragment, withCtx, createTextVNode } from "vue";
|
|
8
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
|
+
const { create } = createComponent("card");
|
|
10
|
+
const _sfc_main = create({
|
|
11
|
+
props: {
|
|
12
|
+
imgUrl: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: ""
|
|
15
|
+
},
|
|
16
|
+
title: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: ""
|
|
19
|
+
},
|
|
20
|
+
price: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: ""
|
|
23
|
+
},
|
|
24
|
+
vipPrice: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: ""
|
|
27
|
+
},
|
|
28
|
+
shopDesc: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ""
|
|
31
|
+
},
|
|
32
|
+
delivery: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: ""
|
|
35
|
+
},
|
|
36
|
+
shopName: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: ""
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
setup(props, { emit, slots }) {
|
|
42
|
+
console.log(slots["origin"]);
|
|
43
|
+
const isHaveSlot = (slot) => {
|
|
44
|
+
return slots[slot];
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
isHaveSlot
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const _hoisted_1 = { class: "nut-card" };
|
|
52
|
+
const _hoisted_2 = { class: "nut-card__left" };
|
|
53
|
+
const _hoisted_3 = ["src"];
|
|
54
|
+
const _hoisted_4 = { class: "nut-card__right" };
|
|
55
|
+
const _hoisted_5 = { class: "nut-card__right__title" };
|
|
56
|
+
const _hoisted_6 = { class: "nut-card__right__price" };
|
|
57
|
+
const _hoisted_7 = { class: "nut-card__right__other" };
|
|
58
|
+
const _hoisted_8 = { class: "nut-card__right__shop" };
|
|
59
|
+
const _hoisted_9 = { class: "nut-card__right__shop__name" };
|
|
60
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
61
|
+
const _component_nut_price = resolveComponent("nut-price");
|
|
62
|
+
const _component_nut_tag = resolveComponent("nut-tag");
|
|
63
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
64
|
+
createElementVNode("div", _hoisted_2, [
|
|
65
|
+
createElementVNode("img", {
|
|
66
|
+
src: _ctx.imgUrl,
|
|
67
|
+
alt: ""
|
|
68
|
+
}, null, 8, _hoisted_3)
|
|
69
|
+
]),
|
|
70
|
+
createElementVNode("div", _hoisted_4, [
|
|
71
|
+
createElementVNode("div", _hoisted_5, toDisplayString(_ctx.title), 1),
|
|
72
|
+
renderSlot(_ctx.$slots, "prolist"),
|
|
73
|
+
createElementVNode("div", _hoisted_6, [
|
|
74
|
+
createVNode(_component_nut_price, { price: _ctx.price }, null, 8, ["price"]),
|
|
75
|
+
_ctx.isHaveSlot("origin") ? renderSlot(_ctx.$slots, "origin", { key: 0 }) : (openBlock(), createBlock(_component_nut_price, {
|
|
76
|
+
key: 1,
|
|
77
|
+
class: "nut-card__right__price__origin",
|
|
78
|
+
price: _ctx.vipPrice
|
|
79
|
+
}, null, 8, ["price"]))
|
|
80
|
+
]),
|
|
81
|
+
createElementVNode("div", _hoisted_7, [
|
|
82
|
+
_ctx.isHaveSlot("shop-tag") ? renderSlot(_ctx.$slots, "shop-tag", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
83
|
+
createVNode(_component_nut_tag, { type: "danger" }, {
|
|
84
|
+
default: withCtx(() => [
|
|
85
|
+
createTextVNode(toDisplayString(_ctx.shopDesc), 1)
|
|
86
|
+
]),
|
|
87
|
+
_: 1
|
|
88
|
+
}),
|
|
89
|
+
createVNode(_component_nut_tag, { plain: "" }, {
|
|
90
|
+
default: withCtx(() => [
|
|
91
|
+
createTextVNode(toDisplayString(_ctx.delivery), 1)
|
|
92
|
+
]),
|
|
93
|
+
_: 1
|
|
94
|
+
})
|
|
95
|
+
], 64))
|
|
96
|
+
]),
|
|
97
|
+
createElementVNode("div", _hoisted_8, [
|
|
98
|
+
createElementVNode("div", _hoisted_9, toDisplayString(_ctx.shopName), 1),
|
|
99
|
+
renderSlot(_ctx.$slots, "footer")
|
|
100
|
+
])
|
|
101
|
+
])
|
|
102
|
+
]);
|
|
103
|
+
}
|
|
104
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
105
|
+
export { index as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2021 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -9,7 +9,8 @@ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
|
9
9
|
const { componentName, create } = createComponent("cell-group");
|
|
10
10
|
const _sfc_main = create({
|
|
11
11
|
props: {
|
|
12
|
-
title: { type: String, default: "" }
|
|
12
|
+
title: { type: String, default: "" },
|
|
13
|
+
desc: { type: String, default: "" }
|
|
13
14
|
},
|
|
14
15
|
setup() {
|
|
15
16
|
const classes = computed(() => {
|
|
@@ -27,13 +28,18 @@ const _hoisted_1 = {
|
|
|
27
28
|
key: 1,
|
|
28
29
|
class: "nut-cell-group__title"
|
|
29
30
|
};
|
|
30
|
-
const _hoisted_2 = {
|
|
31
|
+
const _hoisted_2 = {
|
|
32
|
+
key: 3,
|
|
33
|
+
class: "nut-cell-group__desc"
|
|
34
|
+
};
|
|
35
|
+
const _hoisted_3 = { class: "nut-cell-group__warp" };
|
|
31
36
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
32
37
|
return openBlock(), createElementBlock("view", {
|
|
33
38
|
class: normalizeClass(_ctx.classes)
|
|
34
39
|
}, [
|
|
35
40
|
_ctx.$slots.title ? renderSlot(_ctx.$slots, "title", { key: 0 }) : _ctx.title ? (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
|
|
36
|
-
|
|
41
|
+
_ctx.$slots.desc ? renderSlot(_ctx.$slots, "desc", { key: 2 }) : _ctx.desc ? (openBlock(), createElementBlock("view", _hoisted_2, toDisplayString(_ctx.desc), 1)) : createCommentVNode("", true),
|
|
42
|
+
createElementVNode("view", _hoisted_3, [
|
|
37
43
|
renderSlot(_ctx.$slots, "default")
|
|
38
44
|
])
|
|
39
45
|
], 2);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2021 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
import { reactive, provide, computed, watch, h } from "vue";
|
|
7
7
|
import { c as createComponent } from "./component.js";
|
|
8
|
-
import { u as useExpose } from "./
|
|
8
|
+
import { u as useExpose } from "./index.js";
|
|
9
9
|
const { create, componentName } = createComponent("checkboxgroup");
|
|
10
10
|
const _sfc_main = create({
|
|
11
11
|
props: {
|
package/dist/packages/_es/Col.js
CHANGED
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.
|
|
21
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2021 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.
|
|
21
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2021 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.
|
|
21
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2021 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.
|
|
21
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2021 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
@@ -26,7 +26,7 @@ import { reactive, computed, onMounted, watch, toRefs, resolveComponent, openBlo
|
|
|
26
26
|
import picker from "./Picker.js";
|
|
27
27
|
import { c as createComponent } from "./component.js";
|
|
28
28
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
29
|
-
import "./
|
|
29
|
+
import "./index2.js";
|
|
30
30
|
import "./Popup.js";
|
|
31
31
|
import "./OverLay.js";
|
|
32
32
|
import "./Icon.js";
|
|
@@ -22,7 +22,7 @@ var __publicField = (obj, key, value) => {
|
|
|
22
22
|
return value;
|
|
23
23
|
};
|
|
24
24
|
/*!
|
|
25
|
-
* @nutui/nutui v3.1.
|
|
25
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
26
26
|
* (c) 2021 @jdf2e.
|
|
27
27
|
* Released under the MIT License.
|
|
28
28
|
*/
|
|
@@ -86,25 +86,13 @@ const _sfc_main = create({
|
|
|
86
86
|
type: String,
|
|
87
87
|
default: "center"
|
|
88
88
|
},
|
|
89
|
-
onOk: {
|
|
90
|
-
type: Function,
|
|
91
|
-
default: null
|
|
92
|
-
},
|
|
93
|
-
onCancel: {
|
|
94
|
-
type: Function,
|
|
95
|
-
default: null
|
|
96
|
-
},
|
|
97
|
-
onClose: {
|
|
98
|
-
type: Function,
|
|
99
|
-
default: null
|
|
100
|
-
},
|
|
101
|
-
onClosed: {
|
|
102
|
-
type: Function,
|
|
103
|
-
default: null
|
|
104
|
-
},
|
|
105
89
|
closeOnPopstate: {
|
|
106
90
|
type: Boolean,
|
|
107
91
|
default: false
|
|
92
|
+
},
|
|
93
|
+
footerDirection: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: "horizontal"
|
|
108
96
|
}
|
|
109
97
|
}),
|
|
110
98
|
emits: ["update", "update:visible", "ok", "cancel", "open", "opened", "close", "closed"],
|
|
@@ -157,10 +145,6 @@ const _hoisted_1 = {
|
|
|
157
145
|
class: "nut-dialog__header"
|
|
158
146
|
};
|
|
159
147
|
const _hoisted_2 = ["innerHTML"];
|
|
160
|
-
const _hoisted_3 = {
|
|
161
|
-
key: 1,
|
|
162
|
-
class: "nut-dialog__footer"
|
|
163
|
-
};
|
|
164
148
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
165
149
|
const _component_nut_button = resolveComponent("nut-button");
|
|
166
150
|
const _component_nut_popup = resolveComponent("nut-popup");
|
|
@@ -192,7 +176,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
192
176
|
innerHTML: _ctx.content
|
|
193
177
|
}, null, 8, _hoisted_2))
|
|
194
178
|
], 4),
|
|
195
|
-
!_ctx.noFooter ? (openBlock(), createElementBlock("view",
|
|
179
|
+
!_ctx.noFooter ? (openBlock(), createElementBlock("view", {
|
|
180
|
+
key: 1,
|
|
181
|
+
class: normalizeClass(["nut-dialog__footer", { [_ctx.footerDirection]: _ctx.footerDirection }])
|
|
182
|
+
}, [
|
|
196
183
|
_ctx.$slots.footer ? renderSlot(_ctx.$slots, "footer", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
197
184
|
!_ctx.noCancelBtn ? (openBlock(), createBlock(_component_nut_button, {
|
|
198
185
|
key: 0,
|
|
@@ -221,7 +208,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
221
208
|
_: 1
|
|
222
209
|
}, 8, ["class", "disabled", "onClick"])) : createCommentVNode("", true)
|
|
223
210
|
], 64))
|
|
224
|
-
])) : createCommentVNode("", true)
|
|
211
|
+
], 2)) : createCommentVNode("", true)
|
|
225
212
|
], 2)
|
|
226
213
|
]),
|
|
227
214
|
_: 3
|
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.
|
|
21
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2021 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { c as createComponent } from "./component.js";
|
|
7
|
+
import { i as isPromise } from "./util.js";
|
|
8
|
+
import { computed, reactive, provide, watch, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, renderSlot } from "vue";
|
|
9
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
10
|
+
const component = {
|
|
11
|
+
props: {
|
|
12
|
+
modelValue: {
|
|
13
|
+
type: Object,
|
|
14
|
+
default: {}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
components: {},
|
|
18
|
+
emits: ["validate"],
|
|
19
|
+
setup(props, { emit, slots }) {
|
|
20
|
+
const formErrorTip = computed(() => reactive({}));
|
|
21
|
+
provide("formErrorTip", formErrorTip);
|
|
22
|
+
const init = (value = props.modelValue) => {
|
|
23
|
+
Object.keys(value).forEach((item) => {
|
|
24
|
+
formErrorTip.value[item] = "";
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const reset = () => {
|
|
28
|
+
init();
|
|
29
|
+
};
|
|
30
|
+
watch(() => props.modelValue, (value) => {
|
|
31
|
+
init(value);
|
|
32
|
+
}, { immediate: true });
|
|
33
|
+
const findFormItem = (vnodes) => {
|
|
34
|
+
let task = [];
|
|
35
|
+
vnodes.forEach((vnode, index2) => {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
let type = vnode.type;
|
|
38
|
+
type = type.name || type;
|
|
39
|
+
if (type == "nut-form-item") {
|
|
40
|
+
task.push({
|
|
41
|
+
prop: (_a = vnode.props) == null ? void 0 : _a["prop"],
|
|
42
|
+
rules: ((_b = vnode.props) == null ? void 0 : _b["rules"]) || []
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return task;
|
|
47
|
+
};
|
|
48
|
+
const tipMessage = (errorMsg) => {
|
|
49
|
+
if (errorMsg.message) {
|
|
50
|
+
emit("validate", errorMsg);
|
|
51
|
+
}
|
|
52
|
+
formErrorTip.value[errorMsg.prop] = errorMsg.message;
|
|
53
|
+
};
|
|
54
|
+
const checkRule = (item) => {
|
|
55
|
+
const { rules, prop } = item;
|
|
56
|
+
const _Promise = (errorMsg) => {
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
tipMessage(errorMsg);
|
|
59
|
+
resolve(errorMsg);
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
const value = props.modelValue[prop];
|
|
63
|
+
tipMessage({ prop, message: "" });
|
|
64
|
+
while (rules.length) {
|
|
65
|
+
const { required, validator, regex, message } = rules.shift();
|
|
66
|
+
const errorMsg = { prop, message };
|
|
67
|
+
if (required) {
|
|
68
|
+
if (!value) {
|
|
69
|
+
return _Promise(errorMsg);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (regex && !regex.test(String(value))) {
|
|
73
|
+
return _Promise(errorMsg);
|
|
74
|
+
}
|
|
75
|
+
if (validator) {
|
|
76
|
+
const result = validator(value);
|
|
77
|
+
if (isPromise(result)) {
|
|
78
|
+
return new Promise((r, j) => {
|
|
79
|
+
result.then((res) => {
|
|
80
|
+
if (!res) {
|
|
81
|
+
tipMessage(errorMsg);
|
|
82
|
+
r(errorMsg);
|
|
83
|
+
} else {
|
|
84
|
+
r(true);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
} else {
|
|
89
|
+
if (!result) {
|
|
90
|
+
return _Promise(errorMsg);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return Promise.resolve(true);
|
|
96
|
+
};
|
|
97
|
+
const validate = () => {
|
|
98
|
+
return new Promise((resolve, reject) => {
|
|
99
|
+
let task = findFormItem(slots.default());
|
|
100
|
+
let errors = task.map((item) => {
|
|
101
|
+
return checkRule(item);
|
|
102
|
+
});
|
|
103
|
+
Promise.all(errors).then((errorRes) => {
|
|
104
|
+
errorRes = errorRes.filter((item) => item != true);
|
|
105
|
+
const res = { valid: true, errors: [] };
|
|
106
|
+
if (errorRes.length) {
|
|
107
|
+
res.valid = false;
|
|
108
|
+
res.errors = errorRes;
|
|
109
|
+
}
|
|
110
|
+
resolve(res);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
const onSubmit = () => {
|
|
115
|
+
validate();
|
|
116
|
+
return false;
|
|
117
|
+
};
|
|
118
|
+
return { validate, reset, onSubmit, formErrorTip };
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const { create } = createComponent("form");
|
|
122
|
+
const _sfc_main = create(component);
|
|
123
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
124
|
+
const _component_nut_cell_group = resolveComponent("nut-cell-group");
|
|
125
|
+
return openBlock(), createElementBlock("form", {
|
|
126
|
+
class: "nut-form",
|
|
127
|
+
onSubmit: _cache[0] || (_cache[0] = (...args) => _ctx.onSubmit && _ctx.onSubmit(...args))
|
|
128
|
+
}, [
|
|
129
|
+
createVNode(_component_nut_cell_group, null, {
|
|
130
|
+
default: withCtx(() => [
|
|
131
|
+
renderSlot(_ctx.$slots, "default")
|
|
132
|
+
]),
|
|
133
|
+
_: 3
|
|
134
|
+
})
|
|
135
|
+
], 32);
|
|
136
|
+
}
|
|
137
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
138
|
+
export { index as default };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { p as pxCheck } from "./pxCheck.js";
|
|
7
|
+
import { inject, computed, resolveComponent, openBlock, createBlock, normalizeClass, withCtx, createElementBlock, normalizeStyle, toDisplayString, createCommentVNode, createElementVNode, renderSlot } from "vue";
|
|
8
|
+
import { c as createComponent } from "./component.js";
|
|
9
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
10
|
+
const { componentName, create } = createComponent("form-item");
|
|
11
|
+
const _sfc_main = create({
|
|
12
|
+
inheritAttrs: false,
|
|
13
|
+
props: {
|
|
14
|
+
prop: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: ""
|
|
17
|
+
},
|
|
18
|
+
label: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: ""
|
|
21
|
+
},
|
|
22
|
+
rules: {
|
|
23
|
+
type: Array,
|
|
24
|
+
default: () => {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
required: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
showErrorMessage: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: true
|
|
35
|
+
},
|
|
36
|
+
showErrorLine: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: true
|
|
39
|
+
},
|
|
40
|
+
labelWidth: {
|
|
41
|
+
type: [String, Number],
|
|
42
|
+
default: ""
|
|
43
|
+
},
|
|
44
|
+
labelAlign: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: "left"
|
|
47
|
+
},
|
|
48
|
+
errorMessageAlign: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: "left"
|
|
51
|
+
},
|
|
52
|
+
bodyAlign: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: "left"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
components: {},
|
|
58
|
+
emits: [""],
|
|
59
|
+
setup(props, { emit }) {
|
|
60
|
+
const parent = inject("formErrorTip");
|
|
61
|
+
const labelStyle = computed(() => {
|
|
62
|
+
return {
|
|
63
|
+
width: pxCheck(props.labelWidth),
|
|
64
|
+
textAlign: props.labelAlign
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
const bodyStyle = computed(() => {
|
|
68
|
+
return {
|
|
69
|
+
textAlign: props.bodyAlign
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
const errorMessageStyle = computed(() => {
|
|
73
|
+
return {
|
|
74
|
+
textAlign: props.errorMessageAlign
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
return { parent, labelStyle, bodyStyle, errorMessageStyle };
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
const _hoisted_1 = { class: "nut-cell__value nut-form-item__body" };
|
|
81
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
82
|
+
const _component_nut_cell = resolveComponent("nut-cell");
|
|
83
|
+
return openBlock(), createBlock(_component_nut_cell, {
|
|
84
|
+
class: normalizeClass(["nut-form-item", { error: _ctx.parent[_ctx.prop], line: _ctx.showErrorLine }])
|
|
85
|
+
}, {
|
|
86
|
+
default: withCtx(() => [
|
|
87
|
+
_ctx.label ? (openBlock(), createElementBlock("view", {
|
|
88
|
+
key: 0,
|
|
89
|
+
class: normalizeClass(["nut-cell__title nut-form-item__label", { required: _ctx.required }]),
|
|
90
|
+
style: normalizeStyle(_ctx.labelStyle)
|
|
91
|
+
}, toDisplayString(_ctx.label), 7)) : createCommentVNode("", true),
|
|
92
|
+
createElementVNode("view", _hoisted_1, [
|
|
93
|
+
createElementVNode("view", {
|
|
94
|
+
class: "nut-form-item__body__slots",
|
|
95
|
+
style: normalizeStyle(_ctx.bodyStyle)
|
|
96
|
+
}, [
|
|
97
|
+
renderSlot(_ctx.$slots, "default")
|
|
98
|
+
], 4),
|
|
99
|
+
_ctx.parent[_ctx.prop] && _ctx.showErrorMessage ? (openBlock(), createElementBlock("view", {
|
|
100
|
+
key: 0,
|
|
101
|
+
class: "nut-form-item__body__tips",
|
|
102
|
+
style: normalizeStyle(_ctx.errorMessageStyle)
|
|
103
|
+
}, toDisplayString(_ctx.parent[_ctx.prop]), 5)) : createCommentVNode("", true)
|
|
104
|
+
])
|
|
105
|
+
]),
|
|
106
|
+
_: 3
|
|
107
|
+
}, 8, ["class"]);
|
|
108
|
+
}
|
|
109
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
110
|
+
export { index as default };
|