@nutui/nutui 3.1.12 → 3.1.15-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/README.md +139 -37
- package/dist/nutui.d.ts +8 -1
- package/dist/nutui.es.js +2143 -826
- package/dist/nutui.umd.js +2155 -831
- package/dist/packages/_es/ActionSheet.js +1 -1
- package/dist/packages/_es/Address.js +18 -17
- 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 +1 -1
- package/dist/packages/_es/Cascader.js +547 -0
- package/dist/packages/_es/Cell.js +1 -1
- package/dist/packages/_es/CellGroup.js +1 -1
- package/dist/packages/_es/Checkbox.js +1 -1
- package/dist/packages/_es/CheckboxGroup.js +1 -1
- 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 +3 -4
- package/dist/packages/_es/CountUp.js +3 -1
- package/dist/packages/_es/DatePicker.js +1 -1
- package/dist/packages/_es/Dialog.js +1 -1
- package/dist/packages/_es/Divider.js +1 -1
- package/dist/packages/_es/Drag.js +1 -1
- package/dist/packages/_es/Elevator.js +3 -2
- package/dist/packages/_es/Empty.js +74 -0
- package/dist/packages/_es/FixedNav.js +1 -1
- package/dist/packages/_es/Form.js +18 -5
- package/dist/packages/_es/FormItem.js +1 -1
- package/dist/packages/_es/Grid.js +12 -0
- package/dist/packages/_es/GridItem.js +149 -0
- package/dist/packages/_es/Icon.js +1 -1
- package/dist/packages/_es/ImagePreview.js +104 -10
- package/dist/packages/_es/Indicator.js +66 -0
- 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 +1 -1
- package/dist/packages/_es/MenuItem.js +1 -1
- package/dist/packages/_es/Navbar.js +1 -1
- package/dist/packages/_es/NoticeBar.js +6 -8
- package/dist/packages/_es/Notify.js +1 -1
- package/dist/packages/_es/NumberKeyboard.js +1 -1
- package/dist/packages/_es/OverLay.js +1 -1
- package/dist/packages/_es/Pagination.js +1 -1
- package/dist/packages/_es/Picker.js +1 -1
- package/dist/packages/_es/Popover.js +1 -1
- package/dist/packages/_es/Popup.js +1 -1
- 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 +1 -1
- package/dist/packages/_es/Rate.js +1 -1
- 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/Skeleton.js +138 -0
- package/dist/packages/_es/Sku.js +1 -1
- package/dist/packages/_es/Step.js +1 -1
- package/dist/packages/_es/Steps.js +1 -1
- package/dist/packages/_es/Swipe.js +1 -1
- package/dist/packages/_es/Swiper.js +1 -1
- package/dist/packages/_es/SwiperItem.js +1 -1
- package/dist/packages/_es/Switch.js +16 -6
- 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/Table.js +191 -0
- package/dist/packages/_es/Tabs.js +6 -2
- 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 +1 -1
- package/dist/packages/_es/Uploader.js +1 -1
- package/dist/packages/_es/Video.js +1 -1
- package/dist/packages/_es/common.js +136 -0
- package/dist/packages/_es/component.js +1 -1
- package/dist/packages/_es/index.js +1 -1
- package/dist/packages/_es/index2.js +1 -1
- package/dist/packages/_es/index3.js +1 -1
- package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
- package/dist/packages/_es/pxCheck.js +1 -1
- package/dist/packages/_es/raf.js +1 -1
- package/dist/packages/_es/util.js +1 -1
- package/dist/packages/cascader/index.scss +81 -0
- package/dist/packages/empty/index.scss +33 -0
- package/dist/packages/formitem/index.scss +1 -1
- package/dist/packages/grid/index.scss +10 -0
- package/dist/packages/griditem/index.scss +92 -0
- package/dist/packages/imagepreview/index.scss +1 -0
- package/dist/packages/indicator/index.scss +48 -0
- package/dist/packages/skeleton/index.scss +57 -0
- package/dist/packages/table/index.scss +81 -0
- package/dist/packages/tabs/index.scss +16 -0
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +45 -38
- package/dist/styles/variables.scss +49 -0
- package/package.json +2 -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.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2021 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
@@ -165,6 +165,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
165
165
|
return openBlock(), createElementBlock("view", {
|
|
166
166
|
class: "nut-elevator__list__item",
|
|
167
167
|
key: item[_ctx.acceptKey],
|
|
168
|
+
ref_for: true,
|
|
168
169
|
ref: _ctx.setListGroup
|
|
169
170
|
}, [
|
|
170
171
|
createElementVNode("view", _hoisted_1, toDisplayString(item[_ctx.acceptKey]), 1),
|
|
@@ -176,7 +177,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
176
177
|
innerHTML: subitem.name
|
|
177
178
|
}, null, 8, _hoisted_2);
|
|
178
179
|
}), 128))
|
|
179
|
-
]
|
|
180
|
+
]);
|
|
180
181
|
}), 128))
|
|
181
182
|
], 4),
|
|
182
183
|
_ctx.indexList.length ? withDirectives((openBlock(), createElementBlock("view", {
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { toRefs, computed, openBlock, createElementBlock, createElementVNode, normalizeStyle, renderSlot, Fragment, createCommentVNode, toDisplayString } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
|
+
const { componentName, create } = createComponent("empty");
|
|
10
|
+
const defaultStatus = {
|
|
11
|
+
empty: "https://static-ftcms.jd.com/p/files/61a9e3183985005b3958672b.png",
|
|
12
|
+
error: "https://ftcms.jd.com/p/files/61a9e33ee7dcdbcc0ce62736.png",
|
|
13
|
+
network: "https://static-ftcms.jd.com/p/files/61a9e31de7dcdbcc0ce62734.png"
|
|
14
|
+
};
|
|
15
|
+
const _sfc_main = create({
|
|
16
|
+
props: {
|
|
17
|
+
image: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: "empty"
|
|
20
|
+
},
|
|
21
|
+
imageSize: {
|
|
22
|
+
type: [Number, String],
|
|
23
|
+
default: ""
|
|
24
|
+
},
|
|
25
|
+
description: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "\u65E0\u5185\u5BB9"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
setup(props) {
|
|
31
|
+
const { image, imageSize } = toRefs(props);
|
|
32
|
+
const imgStyle = computed(() => {
|
|
33
|
+
if (!imageSize.value) {
|
|
34
|
+
return "";
|
|
35
|
+
}
|
|
36
|
+
if (typeof imageSize.value === "number") {
|
|
37
|
+
return `width:${imageSize.value}px;height:${imageSize.value}px`;
|
|
38
|
+
}
|
|
39
|
+
return `width:${imageSize.value};height:${imageSize.value}`;
|
|
40
|
+
});
|
|
41
|
+
const isHttpUrl = image.value.startsWith("https://") || image.value.startsWith("http://") || image.value.startsWith("//");
|
|
42
|
+
const imageUrl = isHttpUrl ? image.value : defaultStatus[image.value];
|
|
43
|
+
return {
|
|
44
|
+
imageUrl,
|
|
45
|
+
imgStyle
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const _hoisted_1 = { class: "nut-empty" };
|
|
50
|
+
const _hoisted_2 = ["src"];
|
|
51
|
+
const _hoisted_3 = {
|
|
52
|
+
key: 1,
|
|
53
|
+
class: "nut-empty-description"
|
|
54
|
+
};
|
|
55
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
56
|
+
return openBlock(), createElementBlock("view", _hoisted_1, [
|
|
57
|
+
createElementVNode("view", {
|
|
58
|
+
class: "nut-empty-image",
|
|
59
|
+
style: normalizeStyle(_ctx.imgStyle)
|
|
60
|
+
}, [
|
|
61
|
+
_ctx.$slots.image ? renderSlot(_ctx.$slots, "image", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
62
|
+
_ctx.imageUrl ? (openBlock(), createElementBlock("img", {
|
|
63
|
+
key: 0,
|
|
64
|
+
class: "img",
|
|
65
|
+
src: _ctx.imageUrl
|
|
66
|
+
}, null, 8, _hoisted_2)) : createCommentVNode("", true)
|
|
67
|
+
], 64))
|
|
68
|
+
], 4),
|
|
69
|
+
_ctx.$slots.description ? renderSlot(_ctx.$slots, "description", { key: 0 }) : (openBlock(), createElementBlock("view", _hoisted_3, toDisplayString(_ctx.description), 1)),
|
|
70
|
+
_ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("", true)
|
|
71
|
+
]);
|
|
72
|
+
}
|
|
73
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
74
|
+
export { index as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2021 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -33,7 +33,7 @@ const component = {
|
|
|
33
33
|
const findFormItem = (vnodes) => {
|
|
34
34
|
let task = [];
|
|
35
35
|
vnodes.forEach((vnode, index2) => {
|
|
36
|
-
var _a, _b;
|
|
36
|
+
var _a, _b, _c;
|
|
37
37
|
let type = vnode.type;
|
|
38
38
|
type = type.name || type;
|
|
39
39
|
if (type == "nut-form-item") {
|
|
@@ -41,6 +41,8 @@ const component = {
|
|
|
41
41
|
prop: (_a = vnode.props) == null ? void 0 : _a["prop"],
|
|
42
42
|
rules: ((_b = vnode.props) == null ? void 0 : _b["rules"]) || []
|
|
43
43
|
});
|
|
44
|
+
} else if (Array.isArray(vnode.children) && ((_c = vnode.children) == null ? void 0 : _c.length)) {
|
|
45
|
+
task = task.concat(findFormItem(vnode.children));
|
|
44
46
|
}
|
|
45
47
|
});
|
|
46
48
|
return task;
|
|
@@ -59,7 +61,10 @@ const component = {
|
|
|
59
61
|
resolve(errorMsg);
|
|
60
62
|
});
|
|
61
63
|
};
|
|
62
|
-
const
|
|
64
|
+
const getPropByPath = (obj, keyPath) => {
|
|
65
|
+
return keyPath.split(".").reduce((prev, curr) => prev[curr], obj);
|
|
66
|
+
};
|
|
67
|
+
let value = getPropByPath(props.modelValue, prop);
|
|
63
68
|
tipMessage({ prop, message: "" });
|
|
64
69
|
while (rules.length) {
|
|
65
70
|
const { required, validator, regex, message } = rules.shift();
|
|
@@ -94,11 +99,19 @@ const component = {
|
|
|
94
99
|
}
|
|
95
100
|
return Promise.resolve(true);
|
|
96
101
|
};
|
|
97
|
-
const validate = () => {
|
|
102
|
+
const validate = (customProp = "") => {
|
|
98
103
|
return new Promise((resolve, reject) => {
|
|
99
104
|
let task = findFormItem(slots.default());
|
|
100
105
|
let errors = task.map((item) => {
|
|
101
|
-
|
|
106
|
+
if (customProp) {
|
|
107
|
+
if (customProp == item.prop) {
|
|
108
|
+
return checkRule(item);
|
|
109
|
+
} else {
|
|
110
|
+
return Promise.resolve(true);
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
return checkRule(item);
|
|
114
|
+
}
|
|
102
115
|
});
|
|
103
116
|
Promise.all(errors).then((errorRes) => {
|
|
104
117
|
errorRes = errorRes.filter((item) => item != true);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { c as createComponent } from "./component.js";
|
|
7
|
+
import { c as component } from "./common.js";
|
|
8
|
+
import "vue";
|
|
9
|
+
import "./pxCheck.js";
|
|
10
|
+
const { create } = createComponent("grid");
|
|
11
|
+
const _sfc_main = create(component);
|
|
12
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { inject, getCurrentInstance, onUnmounted, computed, ref, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot, Fragment, createBlock, toDisplayString } from "vue";
|
|
7
|
+
import { useRouter } from "vue-router";
|
|
8
|
+
import { c as createComponent } from "./component.js";
|
|
9
|
+
import { p as pxCheck } from "./pxCheck.js";
|
|
10
|
+
import { G as GRID_KEY } from "./common.js";
|
|
11
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
12
|
+
function useInject(key) {
|
|
13
|
+
const parent = inject(key, null);
|
|
14
|
+
if (parent) {
|
|
15
|
+
const instance = getCurrentInstance();
|
|
16
|
+
const { add, remove, internalChildren } = parent;
|
|
17
|
+
add(instance);
|
|
18
|
+
onUnmounted(() => remove(instance));
|
|
19
|
+
const index2 = computed(() => internalChildren.indexOf(instance));
|
|
20
|
+
return {
|
|
21
|
+
parent,
|
|
22
|
+
index: index2
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
parent: null,
|
|
27
|
+
index: ref(-1)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const { create, componentName } = createComponent("grid-item");
|
|
31
|
+
const _sfc_main = create({
|
|
32
|
+
props: {
|
|
33
|
+
text: {
|
|
34
|
+
type: String
|
|
35
|
+
},
|
|
36
|
+
icon: {
|
|
37
|
+
type: String
|
|
38
|
+
},
|
|
39
|
+
iconSize: {
|
|
40
|
+
type: [Number, String]
|
|
41
|
+
},
|
|
42
|
+
iconColor: {
|
|
43
|
+
type: String
|
|
44
|
+
},
|
|
45
|
+
to: {
|
|
46
|
+
type: [String, Object]
|
|
47
|
+
},
|
|
48
|
+
url: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: ""
|
|
51
|
+
},
|
|
52
|
+
replace: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
emits: ["click"],
|
|
58
|
+
setup(props, { emit }) {
|
|
59
|
+
const Parent = useInject(GRID_KEY);
|
|
60
|
+
if (!Parent.parent)
|
|
61
|
+
return;
|
|
62
|
+
const index2 = Parent.index;
|
|
63
|
+
const parent = Parent.parent.props;
|
|
64
|
+
const rootClass = computed(() => {
|
|
65
|
+
const prefixCls = componentName;
|
|
66
|
+
return {
|
|
67
|
+
[prefixCls]: true
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
const rootStyle = computed(() => {
|
|
71
|
+
const style = {
|
|
72
|
+
flexBasis: `${100 / +parent.columnNum}%`
|
|
73
|
+
};
|
|
74
|
+
if (parent.square) {
|
|
75
|
+
style.paddingTop = `${100 / +parent.columnNum}%`;
|
|
76
|
+
} else if (parent.gutter) {
|
|
77
|
+
style.paddingRight = pxCheck(parent.gutter);
|
|
78
|
+
if (index2.value >= parent.columnNum) {
|
|
79
|
+
style.marginTop = pxCheck(parent.gutter);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return style;
|
|
83
|
+
});
|
|
84
|
+
const contentClass = computed(() => {
|
|
85
|
+
const prefixCls = `${componentName}__content`;
|
|
86
|
+
return {
|
|
87
|
+
[`${prefixCls}`]: true,
|
|
88
|
+
[`${prefixCls}--border`]: parent.border,
|
|
89
|
+
[`${prefixCls}--surround`]: parent.border && parent.gutter,
|
|
90
|
+
[`${prefixCls}--center`]: parent.center,
|
|
91
|
+
[`${prefixCls}--square`]: parent.square,
|
|
92
|
+
[`${prefixCls}--reverse`]: parent.reverse,
|
|
93
|
+
[`${prefixCls}--${parent.direction}`]: !!parent.direction,
|
|
94
|
+
[`${prefixCls}--clickable`]: parent.clickable || props.to || props.url
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
const iconProps = computed(() => {
|
|
98
|
+
return {
|
|
99
|
+
name: props.icon,
|
|
100
|
+
size: props.iconSize || parent.iconSize,
|
|
101
|
+
color: props.iconColor || parent.iconColor
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
const router = useRouter();
|
|
105
|
+
const handleClick = (event) => {
|
|
106
|
+
emit("click", event);
|
|
107
|
+
if (props.to && router) {
|
|
108
|
+
router[props.replace ? "replace" : "push"](props.to);
|
|
109
|
+
} else if (props.url) {
|
|
110
|
+
props.replace ? location.replace(props.url) : location.href = props.url;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
return {
|
|
114
|
+
rootClass,
|
|
115
|
+
rootStyle,
|
|
116
|
+
contentClass,
|
|
117
|
+
iconProps,
|
|
118
|
+
handleClick
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
const _hoisted_1 = {
|
|
123
|
+
key: 3,
|
|
124
|
+
class: "nut-grid-item__text"
|
|
125
|
+
};
|
|
126
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
127
|
+
const _component_nut_icon = resolveComponent("nut-icon");
|
|
128
|
+
return openBlock(), createElementBlock("view", {
|
|
129
|
+
class: normalizeClass(_ctx.rootClass),
|
|
130
|
+
style: normalizeStyle(_ctx.rootStyle),
|
|
131
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
|
|
132
|
+
}, [
|
|
133
|
+
createElementVNode("view", {
|
|
134
|
+
class: normalizeClass(_ctx.contentClass)
|
|
135
|
+
}, [
|
|
136
|
+
_ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
137
|
+
_ctx.$slots.icon ? renderSlot(_ctx.$slots, "icon", { key: 0 }) : (openBlock(), createBlock(_component_nut_icon, {
|
|
138
|
+
key: 1,
|
|
139
|
+
name: _ctx.iconProps.name,
|
|
140
|
+
size: _ctx.iconProps.size,
|
|
141
|
+
color: _ctx.iconProps.color
|
|
142
|
+
}, null, 8, ["name", "size", "color"])),
|
|
143
|
+
_ctx.$slots.text ? renderSlot(_ctx.$slots, "text", { key: 2 }) : (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(_ctx.text), 1))
|
|
144
|
+
], 64))
|
|
145
|
+
], 2)
|
|
146
|
+
], 6);
|
|
147
|
+
}
|
|
148
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
149
|
+
export { index as default };
|
|
@@ -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.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
|
|
26
26
|
* (c) 2021 @jdf2e.
|
|
27
27
|
* Released under the MIT License.
|
|
28
28
|
*/
|
|
@@ -67,6 +67,10 @@ const _sfc_main = create({
|
|
|
67
67
|
paginationColor: {
|
|
68
68
|
type: String,
|
|
69
69
|
default: "#fff"
|
|
70
|
+
},
|
|
71
|
+
autoplay: {
|
|
72
|
+
type: [Number, String],
|
|
73
|
+
default: 3e3
|
|
70
74
|
}
|
|
71
75
|
},
|
|
72
76
|
emits: ["close"],
|
|
@@ -89,7 +93,13 @@ const _sfc_main = create({
|
|
|
89
93
|
options: {
|
|
90
94
|
muted: true,
|
|
91
95
|
controls: true
|
|
92
|
-
}
|
|
96
|
+
},
|
|
97
|
+
eleImg: null,
|
|
98
|
+
store: {
|
|
99
|
+
scale: 1,
|
|
100
|
+
moveable: false
|
|
101
|
+
},
|
|
102
|
+
lastTouchEndTime: 0
|
|
93
103
|
});
|
|
94
104
|
const slideChangeEnd = function(page) {
|
|
95
105
|
state.active = page + 1;
|
|
@@ -101,11 +111,88 @@ const _sfc_main = create({
|
|
|
101
111
|
};
|
|
102
112
|
const onClose = () => {
|
|
103
113
|
state.showPop = false;
|
|
114
|
+
state.store.scale = 1;
|
|
115
|
+
scaleNow();
|
|
104
116
|
state.active = 1;
|
|
105
117
|
emit("close");
|
|
106
118
|
};
|
|
119
|
+
const getDistance = (first, second) => {
|
|
120
|
+
return Math.hypot(Math.abs(second.x - first.x), Math.abs(second.y - first.y));
|
|
121
|
+
};
|
|
122
|
+
const scaleNow = () => {
|
|
123
|
+
state.eleImg.style.transform = "scale(" + state.store.scale + ")";
|
|
124
|
+
};
|
|
125
|
+
const onTouchStart = (event) => {
|
|
126
|
+
console.log("start");
|
|
127
|
+
const curTouchTime = new Date().getTime();
|
|
128
|
+
if (curTouchTime - state.lastTouchEndTime < 300) {
|
|
129
|
+
const store2 = state.store;
|
|
130
|
+
if (store2.scale > 1) {
|
|
131
|
+
store2.scale = 1;
|
|
132
|
+
} else if (store2.scale == 1) {
|
|
133
|
+
store2.scale = 2;
|
|
134
|
+
}
|
|
135
|
+
scaleNow();
|
|
136
|
+
}
|
|
137
|
+
var touches = event.touches;
|
|
138
|
+
var events = touches[0];
|
|
139
|
+
var events2 = touches[1];
|
|
140
|
+
const store = state.store;
|
|
141
|
+
store.moveable = true;
|
|
142
|
+
if (events2) {
|
|
143
|
+
store.oriDistance = getDistance({
|
|
144
|
+
x: events.pageX,
|
|
145
|
+
y: events.pageY
|
|
146
|
+
}, {
|
|
147
|
+
x: events2.pageX,
|
|
148
|
+
y: events2.pageY
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
store.originScale = store.scale || 1;
|
|
152
|
+
};
|
|
153
|
+
const onTouchMove = (event) => {
|
|
154
|
+
if (!state.store.moveable) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const store = state.store;
|
|
158
|
+
var touches = event.touches;
|
|
159
|
+
var events = touches[0];
|
|
160
|
+
var events2 = touches[1];
|
|
161
|
+
if (events2) {
|
|
162
|
+
const curDistance = getDistance({
|
|
163
|
+
x: events.pageX,
|
|
164
|
+
y: events.pageY
|
|
165
|
+
}, {
|
|
166
|
+
x: events2.pageX,
|
|
167
|
+
y: events2.pageY
|
|
168
|
+
});
|
|
169
|
+
const curScale = curDistance / store.oriDistance;
|
|
170
|
+
store.scale = store.originScale * curScale;
|
|
171
|
+
if (store.scale > 3) {
|
|
172
|
+
store.scale = 3;
|
|
173
|
+
}
|
|
174
|
+
scaleNow();
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const onTouchEnd = () => {
|
|
178
|
+
console.log("end");
|
|
179
|
+
state.lastTouchEndTime = new Date().getTime();
|
|
180
|
+
const store = state.store;
|
|
181
|
+
store.moveable = false;
|
|
182
|
+
if (store.scale < 1.1 && store.scale > 1 || store.scale < 1) {
|
|
183
|
+
store.scale = 1;
|
|
184
|
+
scaleNow();
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
const init = () => {
|
|
188
|
+
state.eleImg = document.querySelector(".nut-imagepreview");
|
|
189
|
+
document.addEventListener("touchmove", onTouchMove);
|
|
190
|
+
document.addEventListener("touchend", onTouchEnd);
|
|
191
|
+
document.addEventListener("touchcancel", onTouchEnd);
|
|
192
|
+
};
|
|
107
193
|
watch(() => props.show, (val) => {
|
|
108
194
|
state.showPop = val;
|
|
195
|
+
init();
|
|
109
196
|
});
|
|
110
197
|
onMounted(() => {
|
|
111
198
|
state.active = props.initNo;
|
|
@@ -115,7 +202,12 @@ const _sfc_main = create({
|
|
|
115
202
|
return __spreadProps(__spreadValues({}, toRefs(state)), {
|
|
116
203
|
slideChangeEnd,
|
|
117
204
|
onClose,
|
|
118
|
-
closeOnImg
|
|
205
|
+
closeOnImg,
|
|
206
|
+
onTouchStart,
|
|
207
|
+
onTouchMove,
|
|
208
|
+
onTouchEnd,
|
|
209
|
+
getDistance,
|
|
210
|
+
scaleNow
|
|
119
211
|
});
|
|
120
212
|
}
|
|
121
213
|
});
|
|
@@ -129,17 +221,19 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
129
221
|
return openBlock(), createBlock(_component_nut_popup, {
|
|
130
222
|
"pop-class": "custom-pop",
|
|
131
223
|
visible: _ctx.showPop,
|
|
132
|
-
"onUpdate:visible": _cache[
|
|
133
|
-
onClick: _ctx.onClose
|
|
224
|
+
"onUpdate:visible": _cache[2] || (_cache[2] = ($event) => _ctx.showPop = $event),
|
|
225
|
+
onClick: _ctx.onClose,
|
|
226
|
+
style: { "width": "100%" }
|
|
134
227
|
}, {
|
|
135
228
|
default: withCtx(() => [
|
|
136
229
|
createElementVNode("view", {
|
|
137
230
|
class: "nut-imagepreview",
|
|
138
|
-
onClick: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.closeOnImg && _ctx.closeOnImg(...args), ["stop"]))
|
|
231
|
+
onClick: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.closeOnImg && _ctx.closeOnImg(...args), ["stop"])),
|
|
232
|
+
onTouchstartCapture: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args))
|
|
139
233
|
}, [
|
|
140
234
|
_ctx.showPop ? (openBlock(), createBlock(_component_nut_swiper, {
|
|
141
235
|
key: 0,
|
|
142
|
-
"auto-play":
|
|
236
|
+
"auto-play": _ctx.autoplay,
|
|
143
237
|
class: "nut-imagepreview-swiper",
|
|
144
238
|
loop: true,
|
|
145
239
|
"is-preventDefault": false,
|
|
@@ -174,9 +268,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
174
268
|
}), 128))
|
|
175
269
|
]),
|
|
176
270
|
_: 1
|
|
177
|
-
}, 8, ["onChange", "init-page", "pagination-visible", "pagination-color"])) : createCommentVNode("", true)
|
|
178
|
-
|
|
179
|
-
|
|
271
|
+
}, 8, ["auto-play", "onChange", "init-page", "pagination-visible", "pagination-color"])) : createCommentVNode("", true)
|
|
272
|
+
], 32),
|
|
273
|
+
createElementVNode("view", _hoisted_2, toDisplayString(_ctx.active) + " / " + toDisplayString(_ctx.images.length + _ctx.videos.length), 1)
|
|
180
274
|
]),
|
|
181
275
|
_: 1
|
|
182
276
|
}, 8, ["visible", "onClick"]);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { toRefs, computed, openBlock, createElementBlock, normalizeClass, Fragment, renderList, toDisplayString } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
|
+
const { componentName, create } = createComponent("indicator");
|
|
10
|
+
const _sfc_main = create({
|
|
11
|
+
props: {
|
|
12
|
+
size: {
|
|
13
|
+
type: Number,
|
|
14
|
+
default: 3,
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
current: {
|
|
18
|
+
type: Number,
|
|
19
|
+
default: 1,
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
block: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false
|
|
25
|
+
},
|
|
26
|
+
align: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "center"
|
|
29
|
+
},
|
|
30
|
+
fillZero: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: true
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
setup(props) {
|
|
36
|
+
const { block, align } = toRefs(props);
|
|
37
|
+
const classes = computed(() => {
|
|
38
|
+
const prefixCls = componentName;
|
|
39
|
+
return {
|
|
40
|
+
[prefixCls]: true,
|
|
41
|
+
[`${prefixCls}--block`]: block.value,
|
|
42
|
+
[`${prefixCls}--align__${align.value}`]: block.value && align.value
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
return { classes, componentName };
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
49
|
+
return openBlock(), createElementBlock("view", {
|
|
50
|
+
class: normalizeClass(_ctx.classes)
|
|
51
|
+
}, [
|
|
52
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.size, (item) => {
|
|
53
|
+
return openBlock(), createElementBlock(Fragment, { key: item }, [
|
|
54
|
+
item === _ctx.current ? (openBlock(), createElementBlock("view", {
|
|
55
|
+
key: 0,
|
|
56
|
+
class: normalizeClass(`${_ctx.componentName}--number`)
|
|
57
|
+
}, toDisplayString(_ctx.fillZero && item < 10 ? `0${item}` : item), 3)) : (openBlock(), createElementBlock("view", {
|
|
58
|
+
key: 1,
|
|
59
|
+
class: normalizeClass(`${_ctx.componentName}--dot`)
|
|
60
|
+
}, null, 2))
|
|
61
|
+
], 64);
|
|
62
|
+
}), 128))
|
|
63
|
+
], 2);
|
|
64
|
+
}
|
|
65
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
66
|
+
export { index as default };
|
|
@@ -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.15-beta.0 Thu Dec 23 2021 17:12:09 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2021 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|