@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.
Files changed (109) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/nutui.d.ts +5 -1
  3. package/dist/nutui.es.js +4041 -3518
  4. package/dist/nutui.umd.js +4084 -3627
  5. package/dist/packages/_es/ActionSheet.js +13 -12
  6. package/dist/packages/_es/Address.js +63 -49
  7. package/dist/packages/_es/Avatar.js +4 -5
  8. package/dist/packages/_es/BackTop.js +72 -109
  9. package/dist/packages/_es/Badge.js +4 -5
  10. package/dist/packages/_es/Barrage.js +63 -57
  11. package/dist/packages/_es/Button.js +5 -6
  12. package/dist/packages/_es/Calendar.js +27 -18
  13. package/dist/packages/_es/Card.js +104 -0
  14. package/dist/packages/_es/Cell.js +5 -13
  15. package/dist/packages/_es/CellGroup.js +4 -5
  16. package/dist/packages/_es/Checkbox.js +3 -3
  17. package/dist/packages/_es/CheckboxGroup.js +9 -4
  18. package/dist/packages/_es/CircleProgress.js +142 -46
  19. package/dist/packages/_es/Col.js +4 -5
  20. package/dist/packages/_es/Collapse.js +35 -10
  21. package/dist/packages/_es/CollapseItem.js +80 -35
  22. package/dist/packages/_es/CountDown.js +7 -5
  23. package/dist/packages/_es/CountUp.js +34 -31
  24. package/dist/packages/_es/DatePicker.js +451 -219
  25. package/dist/packages/_es/Dialog.js +13 -87
  26. package/dist/packages/_es/Divider.js +5 -6
  27. package/dist/packages/_es/Drag.js +76 -50
  28. package/dist/packages/_es/Elevator.js +81 -52
  29. package/dist/packages/_es/FixedNav.js +8 -9
  30. package/dist/packages/_es/Form.js +137 -0
  31. package/dist/packages/_es/FormItem.js +109 -0
  32. package/dist/packages/_es/Icon.js +6 -40
  33. package/dist/packages/_es/ImagePreview.js +23 -21
  34. package/dist/packages/_es/InfiniteLoading.js +95 -109
  35. package/dist/packages/_es/Input.js +22 -21
  36. package/dist/packages/_es/InputNumber.js +24 -18
  37. package/dist/packages/_es/Layout.js +2 -2
  38. package/dist/packages/_es/Menu.js +89 -171
  39. package/dist/packages/_es/MenuItem.js +155 -18
  40. package/dist/packages/_es/Navbar.js +7 -7
  41. package/dist/packages/_es/NoticeBar.js +39 -26
  42. package/dist/packages/_es/Notify.js +30 -166
  43. package/dist/packages/_es/NumberKeyboard.js +10 -6
  44. package/dist/packages/_es/OverLay.js +22 -29
  45. package/dist/packages/_es/Pagination.js +8 -9
  46. package/dist/packages/_es/Picker.js +61 -447
  47. package/dist/packages/_es/Popover.js +146 -25
  48. package/dist/packages/_es/Popup.js +18 -39
  49. package/dist/packages/_es/Price.js +18 -7
  50. package/dist/packages/_es/Progress.js +23 -12
  51. package/dist/packages/_es/Radio.js +20 -7
  52. package/dist/packages/_es/RadioGroup.js +7 -3
  53. package/dist/packages/_es/Range.js +38 -59
  54. package/dist/packages/_es/Rate.js +16 -20
  55. package/dist/packages/_es/Row.js +4 -5
  56. package/dist/packages/_es/SearchBar.js +7 -5
  57. package/dist/packages/_es/ShortPassword.js +89 -59
  58. package/dist/packages/_es/Signature.js +70 -71
  59. package/dist/packages/_es/Sku.js +508 -0
  60. package/dist/packages/_es/Step.js +10 -8
  61. package/dist/packages/_es/Steps.js +2 -2
  62. package/dist/packages/_es/Swipe.js +42 -27
  63. package/dist/packages/_es/Swiper.js +17 -418
  64. package/dist/packages/_es/SwiperItem.js +14 -39
  65. package/dist/packages/_es/Switch.js +4 -5
  66. package/dist/packages/_es/TabPane.js +4 -5
  67. package/dist/packages/_es/Tabbar.js +4 -5
  68. package/dist/packages/_es/TabbarItem.js +8 -9
  69. package/dist/packages/_es/Tabs.js +23 -17
  70. package/dist/packages/_es/Tag.js +5 -6
  71. package/dist/packages/_es/TextArea.js +16 -12
  72. package/dist/packages/_es/TimeDetail.js +7 -5
  73. package/dist/packages/_es/TimePannel.js +7 -5
  74. package/dist/packages/_es/TimeSelect.js +12 -7
  75. package/dist/packages/_es/Toast.js +41 -163
  76. package/dist/packages/_es/Uploader.js +210 -164
  77. package/dist/packages/_es/commonProps.js +30 -0
  78. package/dist/packages/_es/component.js +1 -1
  79. package/dist/packages/_es/index.js +1 -1
  80. package/dist/packages/_es/index.taro.vue_vue&type=script&lang.js +44 -0
  81. package/dist/packages/_es/index2.js +44 -8
  82. package/dist/packages/_es/index3.js +419 -0
  83. package/dist/packages/_es/pxCheck.js +1 -1
  84. package/dist/packages/_es/raf.js +1 -1
  85. package/dist/packages/_es/use-lock-scroll.js +23 -0
  86. package/dist/packages/_es/util.js +47 -0
  87. package/dist/packages/button/index.scss +9 -0
  88. package/dist/packages/card/index.scss +97 -0
  89. package/dist/packages/checkbox/index.scss +1 -1
  90. package/dist/packages/form/index.scss +2 -0
  91. package/dist/packages/formitem/index.scss +60 -0
  92. package/dist/packages/menu/index.scss +32 -60
  93. package/dist/packages/menuitem/index.scss +36 -99
  94. package/dist/packages/numberkeyboard/index.scss +1 -1
  95. package/dist/packages/progress/index.scss +2 -0
  96. package/dist/packages/radio/index.scss +32 -4
  97. package/dist/packages/radiogroup/index.scss +20 -0
  98. package/dist/packages/sku/index.scss +147 -0
  99. package/dist/packages/switch/index.scss +1 -1
  100. package/dist/packages/uploader/index.scss +95 -8
  101. package/dist/style.css +1 -1
  102. package/dist/style.es.js +1 -2
  103. package/dist/styles/mixins/index.scss +0 -4
  104. package/dist/styles/themes/default.scss +34 -30
  105. package/dist/styles/variables.scss +45 -3
  106. package/package.json +3 -2
  107. package/dist/packages/_es/Video.js +0 -405
  108. package/dist/packages/_es/plugin-vue_export-helper.js +0 -12
  109. package/dist/packages/_es/style.css +0 -160
@@ -1,13 +1,13 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.10 Fri Nov 05 2021 19:52:49 GMT+0800 (中国标准时间)
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 { ref, computed, reactive, onMounted, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createVNode, withCtx, createTextVNode } from "vue";
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
- const _sfc_main = create({
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 = state.isSupportTouch ? event.touches[0] : event;
71
- let coverPos = canvas.value.getBoundingClientRect();
72
- let mouseX = evt.clientX - coverPos.left;
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(canvas.value);
75
+ onSave();
95
76
  };
96
- const onSave = (canvas2) => {
97
- let dataurl;
98
- switch (props.type) {
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
- clear();
107
- emit("confirm", canvas2, dataurl);
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
- if (isCanvasSupported()) {
111
- state.ctx = canvas.value.getContext("2d");
112
- state.canvasWidth = wrap.value.offsetWidth;
113
- state.canvasHeight = wrap.value.offsetHeight;
114
- addEvent();
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 { canvas, wrap, isCanvasSupported, confirm, clear, classes };
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
- class: "nut-signature-inner",
122
- ref: "wrap"
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
- _ctx.isCanvasSupported ? (openBlock(), createElementBlock("canvas", {
138
- key: 0,
139
- ref: "canvas",
140
- height: _ctx.canvasHeight,
141
- width: _ctx.canvasWidth
142
- }, null, 8, _hoisted_2)) : (openBlock(), createElementBlock("p", _hoisted_3, toDisplayString(_ctx.unSupportTpl), 1))
143
- ], 512),
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[0] || (_cache[0] = ($event) => _ctx.clear())
146
+ onClick: _cache[4] || (_cache[4] = ($event) => _ctx.clear())
148
147
  }, {
149
148
  default: withCtx(() => [
150
- _hoisted_4
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[1] || (_cache[1] = ($event) => _ctx.confirm())
156
+ onClick: _cache[5] || (_cache[5] = ($event) => _ctx.confirm())
158
157
  }, {
159
158
  default: withCtx(() => [
160
- _hoisted_5
159
+ _hoisted_3
161
160
  ]),
162
161
  _: 1
163
162
  })
164
163
  ], 2);
165
164
  }
166
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
167
- export { index as default };
165
+ _sfc_main.render = _sfc_render;
166
+ export { _sfc_main as default };