@nutui/nutui 3.1.23-beta.1 → 3.1.23-beta.4
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/README.md +7 -0
- package/dist/nutui.es.js +910 -622
- package/dist/nutui.umd.js +921 -632
- package/dist/packages/_es/ActionSheet.js +8 -3
- package/dist/packages/_es/Address.js +1 -1
- package/dist/packages/_es/AddressList.js +2 -2
- package/dist/packages/_es/Animate.js +1 -1
- package/dist/packages/_es/Audio.js +1 -1
- package/dist/packages/_es/AudioOperate.js +1 -1
- package/dist/packages/_es/Avatar.js +1 -1
- package/dist/packages/_es/AvatarGroup.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/CalendarItem.js +1 -1
- package/dist/packages/_es/Card.js +7 -4
- package/dist/packages/_es/Cascader.js +1 -1
- package/dist/packages/_es/Category.js +1 -1
- package/dist/packages/_es/CategoryPane.js +25 -23
- package/dist/packages/_es/Cell.js +1 -1
- package/dist/packages/_es/CellGroup.js +1 -1
- package/dist/packages/_es/Checkbox.js +11 -2
- 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/Comment.js +4 -3
- package/dist/packages/_es/ConfigProvider.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 +9 -3
- 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/Ecard.js +1 -1
- package/dist/packages/_es/Elevator.js +1 -1
- package/dist/packages/_es/Ellipsis.js +1 -1
- package/dist/packages/_es/Empty.js +1 -1
- package/dist/packages/_es/FixedNav.js +1 -1
- package/dist/packages/_es/Form.js +1 -1
- package/dist/packages/_es/FormItem.js +1 -1
- package/dist/packages/_es/Grid.js +1 -1
- package/dist/packages/_es/GridItem.js +1 -1
- package/dist/packages/_es/Icon.js +1 -1
- package/dist/packages/_es/Image.js +1 -1
- package/dist/packages/_es/ImagePreview.js +1 -1
- package/dist/packages/_es/Indicator.js +1 -1
- 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/List.js +1 -1
- package/dist/packages/_es/Menu.js +2 -2
- package/dist/packages/_es/MenuItem.js +1 -1
- 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 +1 -1
- package/dist/packages/_es/OldPicker.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 +106 -62
- package/dist/packages/_es/Popover.js +1 -1
- package/dist/packages/_es/Popup.js +14 -18
- package/dist/packages/_es/Price.js +1 -1
- package/dist/packages/_es/Progress.js +1 -1
- package/dist/packages/_es/PullRefresh.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/SideNavBar.js +1 -1
- package/dist/packages/_es/SideNavBarItem.js +1 -1
- package/dist/packages/_es/Signature.js +1 -1
- package/dist/packages/_es/Skeleton.js +1 -1
- 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/Sticky.js +1 -1
- package/dist/packages/_es/SubSideNavBar.js +1 -1
- package/dist/packages/_es/Swipe.js +1 -1
- package/dist/packages/_es/Swiper.js +13 -2
- package/dist/packages/_es/SwiperItem.js +1 -1
- package/dist/packages/_es/Switch.js +11 -3
- package/dist/packages/_es/TabPane.js +1 -1
- package/dist/packages/_es/Tabbar.js +3 -3
- package/dist/packages/_es/TabbarItem.js +33 -13
- package/dist/packages/_es/Table.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 +1 -1
- package/dist/packages/_es/Uploader.js +10 -3
- package/dist/packages/_es/Video.js +1 -1
- package/dist/packages/_es/WaterMark.js +187 -0
- package/dist/packages/_es/common.js +2 -2
- package/dist/packages/_es/component.js +5 -5
- 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/index4.js +1 -1
- package/dist/packages/_es/index5.js +2 -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/cascader/index.scss +13 -0
- package/dist/packages/cell/index.scss +2 -1
- package/dist/packages/imagepreview/index.scss +0 -1
- package/dist/packages/locale/lang/baseLang.js +1 -1
- package/dist/packages/locale/lang/en-US.js +1 -1
- package/dist/packages/locale/lang/id-ID.js +1 -1
- package/dist/packages/locale/lang/index.js +1 -1
- package/dist/packages/locale/lang/zh-CN.js +1 -1
- package/dist/packages/locale/lang/zh-TW.js +1 -1
- package/dist/packages/picker/index.scss +10 -0
- package/dist/packages/table/index.scss +33 -0
- package/dist/packages/timedetail/index.scss +16 -0
- package/dist/packages/timepannel/index.scss +10 -0
- package/dist/packages/timeselect/index.scss +19 -1
- package/dist/packages/uploader/index.scss +10 -0
- package/dist/packages/watermark/index.scss +13 -0
- package/dist/smartips/attributes.json +68 -0
- package/dist/smartips/tags.json +24 -3
- package/dist/smartips/web-types.json +161 -1
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/themes/default.scss +51 -50
- package/dist/styles/themes/jdb.scss +51 -50
- package/dist/styles/themes/jdt.scss +51 -50
- package/dist/styles/variables-jdb.scss +5 -3
- package/dist/styles/variables-jdt.scss +5 -3
- package/dist/styles/variables.scss +6 -3
- package/dist/types/__VUE/actionsheet/index.vue.d.ts +7 -0
- package/dist/types/__VUE/avatar/index.vue.d.ts +4 -4
- package/dist/types/__VUE/avatargroup/index.vue.d.ts +2 -2
- package/dist/types/__VUE/backtop/index.vue.d.ts +2 -2
- package/dist/types/__VUE/badge/index.vue.d.ts +2 -2
- package/dist/types/__VUE/button/index.vue.d.ts +2 -2
- package/dist/types/__VUE/cascader/index.vue.d.ts +1 -1
- package/dist/types/__VUE/categorypane/index.vue.d.ts +1 -1
- package/dist/types/__VUE/cell/index.vue.d.ts +6 -6
- package/dist/types/__VUE/collapseitem/index.vue.d.ts +2 -2
- package/dist/types/__VUE/datepicker/index.vue.d.ts +7 -0
- package/dist/types/__VUE/divider/index.vue.d.ts +2 -2
- package/dist/types/__VUE/grid/index.vue.d.ts +3 -3
- package/dist/types/__VUE/griditem/index.vue.d.ts +1 -1
- package/dist/types/__VUE/input/index.vue.d.ts +2 -2
- package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
- package/dist/types/__VUE/picker/Column.vue.d.ts +10 -2
- package/dist/types/__VUE/picker/index.vue.d.ts +17 -2
- package/dist/types/__VUE/popup/index.vue.d.ts +2 -2
- package/dist/types/__VUE/range/index.vue.d.ts +1 -1
- package/dist/types/__VUE/step/index.vue.d.ts +2 -2
- package/dist/types/__VUE/swiper/index.vue.d.ts +7 -0
- package/dist/types/__VUE/tabbar/index.vue.d.ts +3 -3
- package/dist/types/__VUE/tabbaritem/index.vue.d.ts +9 -3
- package/dist/types/__VUE/toast/index.vue.d.ts +2 -2
- package/dist/types/__VUE/uploader/index.vue.d.ts +4 -4
- package/dist/types/__VUE/uploader/uploader.d.ts +1 -0
- package/dist/types/__VUE/video/index.vue.d.ts +1 -1
- package/dist/types/__VUE/watermark/index.vue.d.ts +143 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/nutui.d.ts +2 -1
- package/package.json +8 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.23-beta.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.4 Mon Jul 25 2022 22:41:41 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -106,6 +106,10 @@ const _sfc_main = create({
|
|
|
106
106
|
isStopPropagation: {
|
|
107
107
|
type: Boolean,
|
|
108
108
|
default: true
|
|
109
|
+
},
|
|
110
|
+
isCenter: {
|
|
111
|
+
type: Boolean,
|
|
112
|
+
default: false
|
|
109
113
|
}
|
|
110
114
|
},
|
|
111
115
|
emits: ["change"],
|
|
@@ -151,9 +155,16 @@ const _sfc_main = create({
|
|
|
151
155
|
});
|
|
152
156
|
const activePagination = computed(() => (state.active + childCount.value) % childCount.value);
|
|
153
157
|
const getStyle = () => {
|
|
158
|
+
let offset = 0;
|
|
159
|
+
if (!props.isCenter) {
|
|
160
|
+
offset = state.offset;
|
|
161
|
+
} else {
|
|
162
|
+
let val = isVertical.value ? state.rect.height - size.value : state.rect.width - size.value;
|
|
163
|
+
offset = state.offset + (state.active === childCount.value - 1 ? -val / 2 : val / 2);
|
|
164
|
+
}
|
|
154
165
|
state.style = {
|
|
155
166
|
transitionDuration: `${state.moving ? 0 : props.duration}ms`,
|
|
156
|
-
transform: `translate${isVertical.value ? "Y" : "X"}(${
|
|
167
|
+
transform: `translate${isVertical.value ? "Y" : "X"}(${offset}px)`,
|
|
157
168
|
[isVertical.value ? "height" : "width"]: `${size.value * childCount.value}px`,
|
|
158
169
|
[isVertical.value ? "width" : "height"]: `${isVertical.value ? state.width : state.height}px`
|
|
159
170
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.23-beta.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.4 Mon Jul 25 2022 22:41:41 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, createBlock, createCommentVNode, Fragment, withDirectives, toDisplayString, vShow } from "vue";
|
|
6
|
+
import { computed, watch, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, createBlock, createCommentVNode, Fragment, withDirectives, toDisplayString, vShow } from "vue";
|
|
7
7
|
import { c as createComponent } from "./component.js";
|
|
8
8
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
9
|
import "../locale/lang";
|
|
@@ -76,14 +76,22 @@ const _sfc_main = create({
|
|
|
76
76
|
backgroundColor: isActive.value ? props.activeColor : props.inactiveColor
|
|
77
77
|
};
|
|
78
78
|
});
|
|
79
|
+
let updateType = "";
|
|
79
80
|
const onClick = (event) => {
|
|
80
81
|
if (props.disable || props.loading)
|
|
81
82
|
return;
|
|
82
83
|
const value = isActive.value ? props.inactiveValue : props.activeValue;
|
|
84
|
+
updateType = "click";
|
|
83
85
|
emit("update:modelValue", value);
|
|
84
|
-
emit("update:loading");
|
|
85
86
|
emit("change", value, event);
|
|
86
87
|
};
|
|
88
|
+
watch(() => props.modelValue, (v) => {
|
|
89
|
+
if (updateType == "click") {
|
|
90
|
+
updateType = "";
|
|
91
|
+
} else {
|
|
92
|
+
emit("change", v);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
87
95
|
return {
|
|
88
96
|
classes,
|
|
89
97
|
style,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.23-beta.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.4 Mon Jul 25 2022 22:41:41 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -45,10 +45,10 @@ const _sfc_main = create({
|
|
|
45
45
|
val: props.visible,
|
|
46
46
|
children: []
|
|
47
47
|
});
|
|
48
|
-
function changeIndex(active) {
|
|
48
|
+
function changeIndex(index2, active) {
|
|
49
49
|
emit("update:visible", active);
|
|
50
50
|
parentData.modelValue = active;
|
|
51
|
-
emit("tab-switch", parentData.children[
|
|
51
|
+
emit("tab-switch", parentData.children[index2], active);
|
|
52
52
|
}
|
|
53
53
|
let parentData = reactive({
|
|
54
54
|
children: mdValue.children,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.23-beta.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.4 Mon Jul 25 2022 22:41:41 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -15,6 +15,9 @@ const _sfc_main = create({
|
|
|
15
15
|
type: String,
|
|
16
16
|
default: ""
|
|
17
17
|
},
|
|
18
|
+
name: {
|
|
19
|
+
type: String
|
|
20
|
+
},
|
|
18
21
|
icon: {
|
|
19
22
|
type: String,
|
|
20
23
|
default: ""
|
|
@@ -60,15 +63,25 @@ const _sfc_main = create({
|
|
|
60
63
|
});
|
|
61
64
|
const router = useRouter();
|
|
62
65
|
const relation = (child) => {
|
|
66
|
+
var _a;
|
|
63
67
|
if (child.proxy) {
|
|
64
|
-
let index2 = parent.children.length;
|
|
65
|
-
state.index = index2;
|
|
66
68
|
parent.children.push(child.proxy);
|
|
69
|
+
const index2 = computed(() => parent.children.indexOf(child.proxy));
|
|
70
|
+
state.index = (_a = props.name) != null ? _a : index2.value;
|
|
67
71
|
}
|
|
68
72
|
};
|
|
69
73
|
relation(getCurrentInstance());
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
const active = computed(() => state.index === state.active);
|
|
75
|
+
function change() {
|
|
76
|
+
var _a;
|
|
77
|
+
let key = (_a = props.name) != null ? _a : state.index;
|
|
78
|
+
let index2 = null;
|
|
79
|
+
if (props.name) {
|
|
80
|
+
index2 = parent.children.findIndex((item) => {
|
|
81
|
+
return item.name == key;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
parent.changeIndex(index2 != null ? index2 : key, state.index);
|
|
72
85
|
}
|
|
73
86
|
const choosed = computed(() => {
|
|
74
87
|
if (parent) {
|
|
@@ -78,13 +91,19 @@ const _sfc_main = create({
|
|
|
78
91
|
});
|
|
79
92
|
watch(choosed, (value, oldValue) => {
|
|
80
93
|
state.active = value;
|
|
94
|
+
let index2 = value;
|
|
95
|
+
if (props.name) {
|
|
96
|
+
index2 = parent.children.findIndex((item) => {
|
|
97
|
+
return item.name == value;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
81
100
|
setTimeout(() => {
|
|
82
|
-
if (parent.children[
|
|
83
|
-
window.location.href = parent.children[
|
|
101
|
+
if (parent.children[index2].href) {
|
|
102
|
+
window.location.href = parent.children[index2].href;
|
|
84
103
|
return;
|
|
85
104
|
}
|
|
86
|
-
if (parent.children[
|
|
87
|
-
let to = parent.children[
|
|
105
|
+
if (parent.children[index2].to) {
|
|
106
|
+
let to = parent.children[index2].to;
|
|
88
107
|
if (to && router) {
|
|
89
108
|
router.push(to);
|
|
90
109
|
} else {
|
|
@@ -95,6 +114,7 @@ const _sfc_main = create({
|
|
|
95
114
|
});
|
|
96
115
|
return {
|
|
97
116
|
state,
|
|
117
|
+
active,
|
|
98
118
|
change
|
|
99
119
|
};
|
|
100
120
|
}
|
|
@@ -117,11 +137,11 @@ const _hoisted_6 = { key: 0 };
|
|
|
117
137
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
118
138
|
const _component_nut_icon = resolveComponent("nut-icon");
|
|
119
139
|
return openBlock(), createElementBlock("div", {
|
|
120
|
-
class: normalizeClass(["nut-tabbar-item", { "nut-tabbar-item__icon--unactive": _ctx.
|
|
140
|
+
class: normalizeClass(["nut-tabbar-item", { "nut-tabbar-item__icon--unactive": !_ctx.active }]),
|
|
121
141
|
style: normalizeStyle({
|
|
122
|
-
color: _ctx.
|
|
142
|
+
color: _ctx.active ? _ctx.state.activeColor : _ctx.state.unactiveColor
|
|
123
143
|
}),
|
|
124
|
-
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.change(
|
|
144
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.change())
|
|
125
145
|
}, [
|
|
126
146
|
createElementVNode("view", _hoisted_1, [
|
|
127
147
|
!_ctx.dot ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
@@ -141,7 +161,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
141
161
|
key: 3,
|
|
142
162
|
class: "nut-tabbar-item_icon-box_icon",
|
|
143
163
|
style: normalizeStyle({
|
|
144
|
-
backgroundImage: `url(${_ctx.
|
|
164
|
+
backgroundImage: `url(${_ctx.active ? _ctx.activeImg : _ctx.img})`,
|
|
145
165
|
width: _ctx.state.size,
|
|
146
166
|
height: _ctx.state.size
|
|
147
167
|
})
|
package/dist/packages/_es/Tag.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.23-beta.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.4 Mon Jul 25 2022 22:41:41 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -49,7 +49,11 @@ class Uploader {
|
|
|
49
49
|
xhr.setRequestHeader(key, value);
|
|
50
50
|
}
|
|
51
51
|
(_a = options.onStart) == null ? void 0 : _a.call(options, options);
|
|
52
|
-
|
|
52
|
+
if (options.method.toLowerCase() == "put") {
|
|
53
|
+
xhr.send(options.sourceFile);
|
|
54
|
+
} else {
|
|
55
|
+
xhr.send(options.formData);
|
|
56
|
+
}
|
|
53
57
|
} else {
|
|
54
58
|
console.warn("\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 XMLHttpRequest");
|
|
55
59
|
}
|
|
@@ -173,6 +177,10 @@ const _sfc_main = create({
|
|
|
173
177
|
uploadOption.xhrState = props.xhrState;
|
|
174
178
|
uploadOption.headers = props.headers;
|
|
175
179
|
uploadOption.withCredentials = props.withCredentials;
|
|
180
|
+
try {
|
|
181
|
+
uploadOption.sourceFile = fileItem.formData.get(props.name);
|
|
182
|
+
} catch (error) {
|
|
183
|
+
}
|
|
176
184
|
uploadOption.onStart = (option) => {
|
|
177
185
|
fileItem.status = "ready";
|
|
178
186
|
fileItem.message = translate("readyUpload");
|
|
@@ -399,7 +407,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
399
407
|
])) : createCommentVNode("", true),
|
|
400
408
|
_ctx.isDeletable ? (openBlock(), createBlock(_component_nut_icon, {
|
|
401
409
|
key: 2,
|
|
402
|
-
color: "rgba(0,0,0,0.6)",
|
|
403
410
|
onClick: ($event) => _ctx.onDelete(item, index2),
|
|
404
411
|
class: "close",
|
|
405
412
|
name: "failure"
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.4 Mon Jul 25 2022 22:41:41 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2022 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { reactive, watch, computed, toRefs, openBlock, createElementBlock, normalizeClass, normalizeStyle } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
|
+
import "../locale/lang";
|
|
10
|
+
const { componentName, create } = createComponent("watermark");
|
|
11
|
+
const _sfc_main = create({
|
|
12
|
+
props: {
|
|
13
|
+
name: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: ""
|
|
16
|
+
},
|
|
17
|
+
gapY: {
|
|
18
|
+
type: Number,
|
|
19
|
+
default: 48
|
|
20
|
+
},
|
|
21
|
+
gapX: {
|
|
22
|
+
type: Number,
|
|
23
|
+
default: 24
|
|
24
|
+
},
|
|
25
|
+
zIndex: {
|
|
26
|
+
type: Number,
|
|
27
|
+
default: 2e3
|
|
28
|
+
},
|
|
29
|
+
width: {
|
|
30
|
+
type: Number,
|
|
31
|
+
default: 120
|
|
32
|
+
},
|
|
33
|
+
height: {
|
|
34
|
+
type: Number,
|
|
35
|
+
default: 64
|
|
36
|
+
},
|
|
37
|
+
rotate: {
|
|
38
|
+
type: Number,
|
|
39
|
+
default: -22
|
|
40
|
+
},
|
|
41
|
+
image: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: ""
|
|
44
|
+
},
|
|
45
|
+
imageWidth: {
|
|
46
|
+
type: Number,
|
|
47
|
+
default: 120
|
|
48
|
+
},
|
|
49
|
+
imageHeight: {
|
|
50
|
+
type: Number,
|
|
51
|
+
default: 64
|
|
52
|
+
},
|
|
53
|
+
content: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: ""
|
|
56
|
+
},
|
|
57
|
+
fontColor: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: "rgba(0,0,0,.15)"
|
|
60
|
+
},
|
|
61
|
+
fontStyle: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: "normal"
|
|
64
|
+
},
|
|
65
|
+
fontFamily: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: "PingFang SC"
|
|
68
|
+
},
|
|
69
|
+
fontWeight: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: "normal"
|
|
72
|
+
},
|
|
73
|
+
fontSize: {
|
|
74
|
+
type: [String, Number],
|
|
75
|
+
default: 14
|
|
76
|
+
},
|
|
77
|
+
fullPage: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: ""
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
emits: ["click"],
|
|
83
|
+
setup(props, { emit }) {
|
|
84
|
+
const state = reactive({
|
|
85
|
+
base64Url: ""
|
|
86
|
+
});
|
|
87
|
+
const {
|
|
88
|
+
zIndex,
|
|
89
|
+
gapX,
|
|
90
|
+
gapY,
|
|
91
|
+
width,
|
|
92
|
+
height,
|
|
93
|
+
rotate,
|
|
94
|
+
image,
|
|
95
|
+
imageWidth,
|
|
96
|
+
imageHeight,
|
|
97
|
+
content,
|
|
98
|
+
fontStyle,
|
|
99
|
+
fontWeight,
|
|
100
|
+
fontColor,
|
|
101
|
+
fontSize,
|
|
102
|
+
fontFamily
|
|
103
|
+
} = props;
|
|
104
|
+
const init = () => {
|
|
105
|
+
const canvas = document.createElement("canvas");
|
|
106
|
+
const ratio = window.devicePixelRatio;
|
|
107
|
+
console.log(ratio);
|
|
108
|
+
const ctx = canvas.getContext("2d");
|
|
109
|
+
const canvasWidth = `${(gapX + width) * ratio}px`;
|
|
110
|
+
const canvasHeight = `${(gapY + height) * ratio}px`;
|
|
111
|
+
const markWidth = width * ratio;
|
|
112
|
+
const markHeight = height * ratio;
|
|
113
|
+
canvas.setAttribute("width", canvasWidth);
|
|
114
|
+
canvas.setAttribute("height", canvasHeight);
|
|
115
|
+
if (ctx) {
|
|
116
|
+
if (image) {
|
|
117
|
+
ctx.translate(markWidth / 2, markHeight / 2);
|
|
118
|
+
ctx.rotate(Math.PI / 180 * Number(rotate));
|
|
119
|
+
const img = new Image();
|
|
120
|
+
img.crossOrigin = "anonymous";
|
|
121
|
+
img.referrerPolicy = "no-referrer";
|
|
122
|
+
img.src = image;
|
|
123
|
+
img.onload = () => {
|
|
124
|
+
ctx.drawImage(img, -imageWidth * ratio / 2, -imageHeight * ratio / 2, imageWidth * ratio, imageHeight * ratio);
|
|
125
|
+
ctx.restore();
|
|
126
|
+
state.base64Url = canvas.toDataURL();
|
|
127
|
+
console.log(state.base64Url);
|
|
128
|
+
};
|
|
129
|
+
} else if (content) {
|
|
130
|
+
ctx.textBaseline = "middle";
|
|
131
|
+
ctx.textAlign = "center";
|
|
132
|
+
ctx.translate(markWidth / 2, markHeight / 2);
|
|
133
|
+
ctx.rotate(Math.PI / 180 * Number(rotate));
|
|
134
|
+
const markSize = Number(fontSize) * ratio;
|
|
135
|
+
ctx.font = `${fontStyle} normal ${fontWeight} ${markSize}px/${markHeight}px ${fontFamily}`;
|
|
136
|
+
ctx.fillStyle = fontColor;
|
|
137
|
+
ctx.fillText(content, 0, 0);
|
|
138
|
+
ctx.restore();
|
|
139
|
+
state.base64Url = canvas.toDataURL();
|
|
140
|
+
console.log(state.base64Url);
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
throw new Error("\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301Canvas");
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
init();
|
|
147
|
+
watch(() => [
|
|
148
|
+
zIndex,
|
|
149
|
+
gapX,
|
|
150
|
+
gapY,
|
|
151
|
+
width,
|
|
152
|
+
height,
|
|
153
|
+
rotate,
|
|
154
|
+
image,
|
|
155
|
+
imageWidth,
|
|
156
|
+
imageHeight,
|
|
157
|
+
content,
|
|
158
|
+
fontStyle,
|
|
159
|
+
fontWeight,
|
|
160
|
+
fontColor,
|
|
161
|
+
fontSize,
|
|
162
|
+
fontFamily
|
|
163
|
+
], () => {
|
|
164
|
+
init();
|
|
165
|
+
});
|
|
166
|
+
const classes = computed(() => {
|
|
167
|
+
const prefixCls = componentName;
|
|
168
|
+
return {
|
|
169
|
+
[prefixCls]: true,
|
|
170
|
+
[`${prefixCls}-full-page`]: props.fullPage
|
|
171
|
+
};
|
|
172
|
+
});
|
|
173
|
+
return { ...toRefs(state), classes };
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
177
|
+
return openBlock(), createElementBlock("view", {
|
|
178
|
+
class: normalizeClass(_ctx.classes),
|
|
179
|
+
style: normalizeStyle({
|
|
180
|
+
zIndex: _ctx.zIndex,
|
|
181
|
+
backgroundSize: `${_ctx.gapX + _ctx.width}px`,
|
|
182
|
+
backgroundImage: `url('${_ctx.base64Url}')`
|
|
183
|
+
})
|
|
184
|
+
}, null, 6);
|
|
185
|
+
}
|
|
186
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
187
|
+
export { index as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.23-beta.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.4 Mon Jul 25 2022 22:41:41 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { shallowReactive, getCurrentInstance, provide, markRaw, isVNode, computed, h } from "vue";
|
|
7
7
|
import { c as createComponent } from "./component.js";
|
|
8
8
|
import { p as pxCheck } from "./pxCheck.js";
|
|
9
9
|
function flattenVNodes(children, childName) {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.23-beta.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.4 Mon Jul 25 2022 22:41:41 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
import { defineComponent } from "vue";
|
|
7
7
|
import locale from "../locale/lang";
|
|
8
8
|
const TypeOfFun = (value) => {
|
|
9
|
-
if (
|
|
9
|
+
if (null === value) {
|
|
10
10
|
return "null";
|
|
11
11
|
}
|
|
12
12
|
const type = typeof value;
|
|
13
|
-
if (
|
|
13
|
+
if ("undefined" === type || "string" === type) {
|
|
14
14
|
return type;
|
|
15
15
|
}
|
|
16
16
|
const typeString = toString.call(value);
|
|
@@ -28,8 +28,8 @@ const TypeOfFun = (value) => {
|
|
|
28
28
|
case "[object RegExp]":
|
|
29
29
|
return "regexp";
|
|
30
30
|
case "[object Object]":
|
|
31
|
-
if (value.nodeType
|
|
32
|
-
if (value.nodeType
|
|
31
|
+
if (void 0 !== value.nodeType) {
|
|
32
|
+
if (3 == value.nodeType) {
|
|
33
33
|
return /\S/.test(value.nodeValue) ? "textnode" : "whitespace";
|
|
34
34
|
} else {
|
|
35
35
|
return "element";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.23-beta.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.4 Mon Jul 25 2022 22:41:41 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -302,6 +302,7 @@ const _sfc_main = create({
|
|
|
302
302
|
state.chooseData = [...days];
|
|
303
303
|
}
|
|
304
304
|
if (!isFirst) {
|
|
305
|
+
console.log(state.chooseData);
|
|
305
306
|
emit("select", state.chooseData);
|
|
306
307
|
if (props.isAutoBackFill || !props.poppable) {
|
|
307
308
|
confirm();
|
package/dist/packages/_es/raf.js
CHANGED