@nutui/nutui 4.0.5-beta.1 → 4.0.5-beta.2

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.
@@ -187,6 +187,9 @@ const _sfc_main = create({
187
187
  case "datehour":
188
188
  result = result.slice(0, 4);
189
189
  break;
190
+ case "hour-minute":
191
+ result = result.slice(3, 5);
192
+ break;
190
193
  }
191
194
  return result;
192
195
  });
@@ -104,7 +104,7 @@ const _sfc_main = create({
104
104
  }
105
105
  },
106
106
  components: { MaskClose },
107
- emits: ["update:modelValue", "blur", "focus", "clear", "keypress", "click-input"],
107
+ emits: ["update:modelValue", "blur", "focus", "clear", "keypress", "click", "click-input"],
108
108
  setup(props, { emit, slots }) {
109
109
  const active = ref(false);
110
110
  const inputRef = ref();
@@ -221,6 +221,9 @@ const _sfc_main = create({
221
221
  }
222
222
  emit("click-input", event);
223
223
  };
224
+ const onClick = (event) => {
225
+ emit("click", event);
226
+ };
224
227
  const startComposing = ({ target }) => {
225
228
  target.composing = true;
226
229
  };
@@ -253,6 +256,7 @@ const _sfc_main = create({
253
256
  clear,
254
257
  startComposing,
255
258
  endComposing,
259
+ onClick,
256
260
  onClickInput
257
261
  };
258
262
  }
@@ -274,7 +278,8 @@ const _hoisted_8 = { class: "nut-input-right-box" };
274
278
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
275
279
  const _component_MaskClose = resolveComponent("MaskClose");
276
280
  return openBlock(), createElementBlock("view", {
277
- class: normalizeClass(_ctx.classes)
281
+ class: normalizeClass(_ctx.classes),
282
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
278
283
  }, [
279
284
  createElementVNode("view", _hoisted_1, [
280
285
  createElementVNode("view", _hoisted_2, [
@@ -232,6 +232,9 @@ const _sfc_main = create({
232
232
  currentIndex.value = index;
233
233
  }
234
234
  };
235
+ const getScrollY = computed(() => {
236
+ return props.titleScroll && props.direction === "vertical";
237
+ });
235
238
  const navRef = ref();
236
239
  const titleRef = ref([]);
237
240
  const scrollIntoView = (immediate) => {
@@ -241,15 +244,25 @@ const _sfc_main = create({
241
244
  return;
242
245
  }
243
246
  const title = _titles[currentIndex.value];
244
- const to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
245
- scrollLeftTo(nav, to, immediate ? 0 : 0.3);
247
+ let to = 0;
248
+ if (props.direction === "vertical") {
249
+ const runTop = title.offsetTop - nav.offsetTop + 10;
250
+ to = runTop - (nav.offsetHeight - title.offsetHeight) / 2;
251
+ } else {
252
+ to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
253
+ }
254
+ scrollDirection(nav, to, immediate ? 0 : 0.3, props.direction);
246
255
  };
247
- const scrollLeftTo = (nav, to, duration) => {
256
+ const scrollDirection = (nav, to, duration, direction) => {
248
257
  let count = 0;
249
- const from = nav.scrollLeft;
258
+ const from = direction === "horizontal" ? nav.scrollLeft : nav.scrollTop;
250
259
  const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
251
260
  function animate() {
252
- nav.scrollLeft += (to - from) / frames;
261
+ if (direction === "horizontal") {
262
+ nav.scrollLeft += (to - from) / frames;
263
+ } else {
264
+ nav.scrollTop += (to - from) / frames;
265
+ }
253
266
  if (++count < frames) {
254
267
  requestAniFrame(animate);
255
268
  }
@@ -371,6 +384,7 @@ const _sfc_main = create({
371
384
  titleStyle,
372
385
  tabsActiveStyle,
373
386
  container,
387
+ getScrollY,
374
388
  onStickyScroll,
375
389
  ...tabMethods,
376
390
  ...touchMethods
@@ -428,7 +442,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
428
442
  _: 3
429
443
  }, 8, ["top", "container", "onScroll"])) : (openBlock(), createElementBlock("view", {
430
444
  key: 1,
431
- class: normalizeClass(["nut-tabs__titles", { [_ctx.type]: _ctx.type, scrollable: _ctx.titleScroll, [_ctx.size]: _ctx.size }]),
445
+ class: normalizeClass(["nut-tabs__titles", { [_ctx.type]: _ctx.type, scrollable: _ctx.titleScroll, "scroll-vertical": _ctx.getScrollY, [_ctx.size]: _ctx.size }]),
432
446
  style: normalizeStyle(_ctx.tabsNavStyle),
433
447
  ref: "navRef"
434
448
  }, [
@@ -48,6 +48,13 @@
48
48
  padding: 0 10px 0 15px;
49
49
  }
50
50
  }
51
+ &.scroll-vertical {
52
+ overflow-y: scroll;
53
+ height: auto;
54
+ .nut-tabs__titles-placeholder {
55
+ height: 22px;
56
+ }
57
+ }
51
58
  &-item {
52
59
  height: $tabs-vertical-titles-item-height;
53
60
  flex: none;
@@ -92,7 +99,7 @@
92
99
 
93
100
  &__titles {
94
101
  height: $tabs-horizontal-titles-height;
95
- padding: 0 10px;
102
+ // padding: 0 10px;
96
103
  display: flex;
97
104
  user-select: none;
98
105
  background: $tabs-titles-background-color;
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
4
  "name": "NutUI",
5
- "version": "4.0.5-beta.1",
5
+ "version": "4.0.5-beta.2",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "tags": [
@@ -1686,8 +1686,8 @@
1686
1686
  },
1687
1687
  {
1688
1688
  "name": "type",
1689
- "default": "`'date'`",
1690
- "description": "时间类型,可选值 `date` `time` `year-month` `month-day` `datehour`",
1689
+ "default": "`date`",
1690
+ "description": "时间类型,可选值 `date`(年月日) `time`(时分秒) `year-month`(年月) `month-day`(月日) `datehour`(年月日时) `hour-minute`(时分)",
1691
1691
  "value": {
1692
1692
  "type": "string",
1693
1693
  "kind": "expression"
@@ -2182,7 +2182,7 @@
2182
2182
  },
2183
2183
  {
2184
2184
  "name": "card-buy-min",
2185
- "default": "`9999`",
2185
+ "default": "`1`",
2186
2186
  "description": "购买数量最小值",
2187
2187
  "value": {
2188
2188
  "type": "number",