@nutui/nutui 3.1.10 → 3.1.12-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 +17 -0
- package/dist/nutui.d.ts +5 -1
- package/dist/nutui.es.js +4041 -3518
- package/dist/nutui.umd.js +4084 -3627
- package/dist/packages/_es/ActionSheet.js +13 -12
- package/dist/packages/_es/Address.js +63 -49
- package/dist/packages/_es/Avatar.js +4 -5
- package/dist/packages/_es/BackTop.js +72 -109
- package/dist/packages/_es/Badge.js +4 -5
- package/dist/packages/_es/Barrage.js +63 -57
- package/dist/packages/_es/Button.js +5 -6
- package/dist/packages/_es/Calendar.js +27 -18
- package/dist/packages/_es/Card.js +104 -0
- package/dist/packages/_es/Cell.js +5 -13
- package/dist/packages/_es/CellGroup.js +4 -5
- package/dist/packages/_es/Checkbox.js +3 -3
- package/dist/packages/_es/CheckboxGroup.js +9 -4
- package/dist/packages/_es/CircleProgress.js +142 -46
- package/dist/packages/_es/Col.js +4 -5
- package/dist/packages/_es/Collapse.js +35 -10
- package/dist/packages/_es/CollapseItem.js +80 -35
- package/dist/packages/_es/CountDown.js +7 -5
- package/dist/packages/_es/CountUp.js +34 -31
- package/dist/packages/_es/DatePicker.js +451 -219
- package/dist/packages/_es/Dialog.js +13 -87
- package/dist/packages/_es/Divider.js +5 -6
- package/dist/packages/_es/Drag.js +76 -50
- package/dist/packages/_es/Elevator.js +81 -52
- package/dist/packages/_es/FixedNav.js +8 -9
- package/dist/packages/_es/Form.js +137 -0
- package/dist/packages/_es/FormItem.js +109 -0
- package/dist/packages/_es/Icon.js +6 -40
- package/dist/packages/_es/ImagePreview.js +23 -21
- package/dist/packages/_es/InfiniteLoading.js +95 -109
- package/dist/packages/_es/Input.js +22 -21
- package/dist/packages/_es/InputNumber.js +24 -18
- package/dist/packages/_es/Layout.js +2 -2
- package/dist/packages/_es/Menu.js +89 -171
- package/dist/packages/_es/MenuItem.js +155 -18
- package/dist/packages/_es/Navbar.js +7 -7
- package/dist/packages/_es/NoticeBar.js +39 -26
- package/dist/packages/_es/Notify.js +30 -166
- package/dist/packages/_es/NumberKeyboard.js +10 -6
- package/dist/packages/_es/OverLay.js +22 -29
- package/dist/packages/_es/Pagination.js +8 -9
- package/dist/packages/_es/Picker.js +61 -447
- package/dist/packages/_es/Popover.js +146 -25
- package/dist/packages/_es/Popup.js +18 -39
- package/dist/packages/_es/Price.js +18 -7
- package/dist/packages/_es/Progress.js +23 -12
- package/dist/packages/_es/Radio.js +20 -7
- package/dist/packages/_es/RadioGroup.js +7 -3
- package/dist/packages/_es/Range.js +38 -59
- package/dist/packages/_es/Rate.js +16 -20
- package/dist/packages/_es/Row.js +4 -5
- package/dist/packages/_es/SearchBar.js +7 -5
- package/dist/packages/_es/ShortPassword.js +89 -59
- package/dist/packages/_es/Signature.js +70 -71
- package/dist/packages/_es/Sku.js +508 -0
- package/dist/packages/_es/Step.js +10 -8
- package/dist/packages/_es/Steps.js +2 -2
- package/dist/packages/_es/Swipe.js +42 -27
- package/dist/packages/_es/Swiper.js +17 -418
- package/dist/packages/_es/SwiperItem.js +14 -39
- package/dist/packages/_es/Switch.js +4 -5
- package/dist/packages/_es/TabPane.js +4 -5
- package/dist/packages/_es/Tabbar.js +4 -5
- package/dist/packages/_es/TabbarItem.js +8 -9
- package/dist/packages/_es/Tabs.js +23 -17
- package/dist/packages/_es/Tag.js +5 -6
- package/dist/packages/_es/TextArea.js +16 -12
- package/dist/packages/_es/TimeDetail.js +7 -5
- package/dist/packages/_es/TimePannel.js +7 -5
- package/dist/packages/_es/TimeSelect.js +12 -7
- package/dist/packages/_es/Toast.js +41 -163
- package/dist/packages/_es/Uploader.js +210 -164
- package/dist/packages/_es/commonProps.js +30 -0
- package/dist/packages/_es/component.js +1 -1
- package/dist/packages/_es/index.js +1 -1
- package/dist/packages/_es/index.taro.vue_vue&type=script&lang.js +44 -0
- package/dist/packages/_es/index2.js +44 -8
- package/dist/packages/_es/index3.js +419 -0
- package/dist/packages/_es/pxCheck.js +1 -1
- package/dist/packages/_es/raf.js +1 -1
- package/dist/packages/_es/use-lock-scroll.js +23 -0
- package/dist/packages/_es/util.js +47 -0
- package/dist/packages/button/index.scss +9 -0
- package/dist/packages/card/index.scss +97 -0
- package/dist/packages/checkbox/index.scss +1 -1
- package/dist/packages/form/index.scss +2 -0
- package/dist/packages/formitem/index.scss +60 -0
- 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/progress/index.scss +2 -0
- package/dist/packages/radio/index.scss +32 -4
- package/dist/packages/radiogroup/index.scss +20 -0
- package/dist/packages/sku/index.scss +147 -0
- package/dist/packages/switch/index.scss +1 -1
- package/dist/packages/uploader/index.scss +95 -8
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -2
- package/dist/styles/mixins/index.scss +0 -4
- package/dist/styles/themes/default.scss +34 -30
- package/dist/styles/variables.scss +45 -3
- package/package.json +3 -2
- package/dist/packages/_es/Video.js +0 -405
- package/dist/packages/_es/plugin-vue_export-helper.js +0 -12
- package/dist/packages/_es/style.css +0 -160
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2021 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
import Taro from "@tarojs/taro";
|
|
7
|
+
import { computed, reactive, onMounted, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, createVNode, withCtx, createTextVNode } from "vue";
|
|
7
8
|
import { c as createComponent } from "./component.js";
|
|
8
|
-
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
9
|
const { componentName, create } = createComponent("signature");
|
|
10
|
-
|
|
10
|
+
var _sfc_main = create({
|
|
11
11
|
props: {
|
|
12
12
|
customClass: {
|
|
13
13
|
type: String,
|
|
@@ -33,8 +33,6 @@ const _sfc_main = create({
|
|
|
33
33
|
components: {},
|
|
34
34
|
emits: ["confirm", "clear"],
|
|
35
35
|
setup(props, { emit }) {
|
|
36
|
-
const canvas = ref(null);
|
|
37
|
-
const wrap = ref(null);
|
|
38
36
|
const classes = computed(() => {
|
|
39
37
|
const prefixCls = componentName;
|
|
40
38
|
return {
|
|
@@ -43,125 +41,126 @@ const _sfc_main = create({
|
|
|
43
41
|
};
|
|
44
42
|
});
|
|
45
43
|
const state = reactive({
|
|
44
|
+
canvas: null,
|
|
46
45
|
canvasHeight: 0,
|
|
47
46
|
canvasWidth: 0,
|
|
48
|
-
ctx: null
|
|
49
|
-
isSupportTouch: "ontouchstart" in window,
|
|
50
|
-
events: "ontouchstart" in window ? ["touchstart", "touchmove", "touchend", "touchleave"] : ["mousedown", "mousemove", "mouseup", "mouseleave"]
|
|
47
|
+
ctx: null
|
|
51
48
|
});
|
|
52
|
-
const isCanvasSupported = () => {
|
|
53
|
-
let elem = document.createElement("canvas");
|
|
54
|
-
return !!(elem.getContext && elem.getContext("2d"));
|
|
55
|
-
};
|
|
56
|
-
const addEvent = () => {
|
|
57
|
-
canvas.value.addEventListener(state.events[0], startEventHandler, false);
|
|
58
|
-
};
|
|
59
49
|
const startEventHandler = (event) => {
|
|
60
50
|
event.preventDefault();
|
|
61
51
|
state.ctx.beginPath();
|
|
62
52
|
state.ctx.lineWidth = props.lineWidth;
|
|
63
53
|
state.ctx.strokeStyle = props.strokeStyle;
|
|
64
|
-
canvas.value.addEventListener(state.events[1], moveEventHandler, false);
|
|
65
|
-
canvas.value.addEventListener(state.events[2], endEventHandler, false);
|
|
66
|
-
canvas.value.addEventListener(state.events[3], leaveEventHandler, false);
|
|
67
54
|
};
|
|
68
55
|
const moveEventHandler = (event) => {
|
|
69
56
|
event.preventDefault();
|
|
70
|
-
let evt =
|
|
71
|
-
let
|
|
72
|
-
let
|
|
73
|
-
let mouseY = evt.clientY - coverPos.top;
|
|
57
|
+
let evt = event.changedTouches[0];
|
|
58
|
+
let mouseX = evt.x;
|
|
59
|
+
let mouseY = evt.y;
|
|
74
60
|
state.ctx.lineTo(mouseX, mouseY);
|
|
75
61
|
state.ctx.stroke();
|
|
76
62
|
};
|
|
77
63
|
const endEventHandler = (event) => {
|
|
78
64
|
event.preventDefault();
|
|
79
|
-
canvas.value.removeEventListener(state.events[1], moveEventHandler, false);
|
|
80
|
-
canvas.value.removeEventListener(state.events[2], endEventHandler, false);
|
|
81
65
|
};
|
|
82
66
|
const leaveEventHandler = (event) => {
|
|
83
67
|
event.preventDefault();
|
|
84
|
-
canvas.value.removeEventListener(state.events[1], moveEventHandler, false);
|
|
85
|
-
canvas.value.removeEventListener(state.events[2], endEventHandler, false);
|
|
86
68
|
};
|
|
87
69
|
const clear = () => {
|
|
88
|
-
canvas.value.addEventListener(state.events[2], endEventHandler, false);
|
|
89
70
|
state.ctx.clearRect(0, 0, state.canvasWidth, state.canvasHeight);
|
|
90
71
|
state.ctx.closePath();
|
|
91
72
|
emit("clear");
|
|
92
73
|
};
|
|
93
74
|
const confirm = () => {
|
|
94
|
-
onSave(
|
|
75
|
+
onSave();
|
|
95
76
|
};
|
|
96
|
-
const onSave = (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
case "png":
|
|
100
|
-
dataurl = canvas2.toDataURL("image/png");
|
|
101
|
-
break;
|
|
102
|
-
case "jpg":
|
|
103
|
-
dataurl = canvas2.toDataURL("image/jpeg", 0.8);
|
|
104
|
-
break;
|
|
77
|
+
const onSave = () => {
|
|
78
|
+
if (!state.canvas) {
|
|
79
|
+
return;
|
|
105
80
|
}
|
|
106
|
-
|
|
107
|
-
|
|
81
|
+
Taro.createSelectorQuery().select("#spcanvas").fields({
|
|
82
|
+
node: true,
|
|
83
|
+
size: true
|
|
84
|
+
}).exec(async (res) => {
|
|
85
|
+
Taro.canvasToTempFilePath({
|
|
86
|
+
canvas: res[0].node,
|
|
87
|
+
fileType: props.type
|
|
88
|
+
}).then((res2) => {
|
|
89
|
+
emit("confirm", res2.tempFilePath);
|
|
90
|
+
}).catch((e) => {
|
|
91
|
+
emit("confirm", e);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
108
94
|
};
|
|
109
95
|
onMounted(() => {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
96
|
+
setTimeout(() => {
|
|
97
|
+
Taro.createSelectorQuery().select("#spcanvas").fields({
|
|
98
|
+
node: true,
|
|
99
|
+
size: true
|
|
100
|
+
}, function(res) {
|
|
101
|
+
const canvas = res.node;
|
|
102
|
+
const ctx = canvas.getContext("2d");
|
|
103
|
+
state.canvas = canvas;
|
|
104
|
+
state.ctx = ctx;
|
|
105
|
+
state.canvasWidth = res.width;
|
|
106
|
+
state.canvasHeight = res.height;
|
|
107
|
+
}).exec();
|
|
108
|
+
}, 500);
|
|
116
109
|
});
|
|
117
|
-
return {
|
|
110
|
+
return {
|
|
111
|
+
confirm,
|
|
112
|
+
clear,
|
|
113
|
+
classes,
|
|
114
|
+
startEventHandler,
|
|
115
|
+
moveEventHandler,
|
|
116
|
+
endEventHandler,
|
|
117
|
+
leaveEventHandler
|
|
118
|
+
};
|
|
118
119
|
}
|
|
119
120
|
});
|
|
120
|
-
const _hoisted_1 = {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
};
|
|
124
|
-
const _hoisted_2 = ["height", "width"];
|
|
125
|
-
const _hoisted_3 = {
|
|
126
|
-
key: 1,
|
|
127
|
-
class: "nut-signature-unsopport"
|
|
128
|
-
};
|
|
129
|
-
const _hoisted_4 = /* @__PURE__ */ createTextVNode("\u91CD\u7B7E");
|
|
130
|
-
const _hoisted_5 = /* @__PURE__ */ createTextVNode("\u786E\u8BA4");
|
|
121
|
+
const _hoisted_1 = { class: "nut-signature-inner" };
|
|
122
|
+
const _hoisted_2 = /* @__PURE__ */ createTextVNode("\u91CD\u7B7E");
|
|
123
|
+
const _hoisted_3 = /* @__PURE__ */ createTextVNode("\u786E\u8BA4");
|
|
131
124
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
132
125
|
const _component_nut_button = resolveComponent("nut-button");
|
|
133
126
|
return openBlock(), createElementBlock("div", {
|
|
134
127
|
class: normalizeClass(_ctx.classes)
|
|
135
128
|
}, [
|
|
136
129
|
createElementVNode("div", _hoisted_1, [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
130
|
+
createElementVNode("canvas", {
|
|
131
|
+
class: "spcanvas",
|
|
132
|
+
id: "spcanvas",
|
|
133
|
+
canvasId: "spcanvas",
|
|
134
|
+
"canvas-id": "spcanvas",
|
|
135
|
+
type: "2d",
|
|
136
|
+
"disable-scroll": "true",
|
|
137
|
+
onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.startEventHandler && _ctx.startEventHandler(...args)),
|
|
138
|
+
onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.moveEventHandler && _ctx.moveEventHandler(...args)),
|
|
139
|
+
onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.endEventHandler && _ctx.endEventHandler(...args)),
|
|
140
|
+
onTouchleave: _cache[3] || (_cache[3] = (...args) => _ctx.leaveEventHandler && _ctx.leaveEventHandler(...args))
|
|
141
|
+
}, null, 32)
|
|
142
|
+
]),
|
|
144
143
|
createVNode(_component_nut_button, {
|
|
145
144
|
class: "nut-signature-btn",
|
|
146
145
|
type: "default",
|
|
147
|
-
onClick: _cache[
|
|
146
|
+
onClick: _cache[4] || (_cache[4] = ($event) => _ctx.clear())
|
|
148
147
|
}, {
|
|
149
148
|
default: withCtx(() => [
|
|
150
|
-
|
|
149
|
+
_hoisted_2
|
|
151
150
|
]),
|
|
152
151
|
_: 1
|
|
153
152
|
}),
|
|
154
153
|
createVNode(_component_nut_button, {
|
|
155
154
|
class: "nut-signature-btn",
|
|
156
155
|
type: "primary",
|
|
157
|
-
onClick: _cache[
|
|
156
|
+
onClick: _cache[5] || (_cache[5] = ($event) => _ctx.confirm())
|
|
158
157
|
}, {
|
|
159
158
|
default: withCtx(() => [
|
|
160
|
-
|
|
159
|
+
_hoisted_3
|
|
161
160
|
]),
|
|
162
161
|
_: 1
|
|
163
162
|
})
|
|
164
163
|
], 2);
|
|
165
164
|
}
|
|
166
|
-
|
|
167
|
-
export {
|
|
165
|
+
_sfc_main.render = _sfc_render;
|
|
166
|
+
export { _sfc_main as default };
|