@nutui/nutui 4.0.9-beta.2 → 4.0.9

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.
@@ -1,4 +1,4 @@
1
- import { ref, computed, provide, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
1
+ import { ref, computed, watch, provide, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
2
2
  import { c as createComponent } from "./component-81a4c1d0.js";
3
3
  import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
4
4
  import "../locale/lang";
@@ -7,7 +7,7 @@ const _sfc_main = create({
7
7
  props: {
8
8
  modelValue: {
9
9
  type: [String, Number, Array],
10
- default: () => []
10
+ default: ""
11
11
  },
12
12
  accordion: {
13
13
  type: Boolean,
@@ -17,30 +17,35 @@ const _sfc_main = create({
17
17
  emits: ["update:modelValue", "change"],
18
18
  setup(props, { emit }) {
19
19
  const collapseDom = ref(null);
20
+ const innerValue = ref(props.modelValue || (props.accordion ? "" : []));
20
21
  const classes = computed(() => {
21
22
  const prefixCls = componentName;
22
23
  return {
23
24
  [prefixCls]: true
24
25
  };
25
26
  });
27
+ watch(() => props.modelValue, (val) => {
28
+ innerValue.value = val;
29
+ });
26
30
  const changeVal = (val, name, status = true) => {
31
+ innerValue.value = val;
27
32
  emit("update:modelValue", val);
28
33
  emit("change", val, name, status);
29
34
  };
30
35
  const updateVal = (name) => {
31
36
  if (props.accordion) {
32
- if (props.modelValue === name) {
37
+ if (innerValue.value === name) {
33
38
  changeVal("", name, false);
34
39
  } else {
35
40
  changeVal(name, name, true);
36
41
  }
37
42
  } else {
38
- if (Array.isArray(props.modelValue)) {
39
- if (props.modelValue.includes(name)) {
40
- const newValue = props.modelValue.filter((v) => v !== name);
43
+ if (Array.isArray(innerValue.value)) {
44
+ if (innerValue.value.includes(name)) {
45
+ const newValue = innerValue.value.filter((v) => v !== name);
41
46
  changeVal(newValue, name, false);
42
47
  } else {
43
- const newValue = props.modelValue.concat([name]);
48
+ const newValue = innerValue.value.concat([name]);
44
49
  changeVal(newValue, name, true);
45
50
  }
46
51
  } else {
@@ -50,9 +55,9 @@ const _sfc_main = create({
50
55
  };
51
56
  const isExpanded = (name) => {
52
57
  if (props.accordion) {
53
- return props.modelValue === name;
54
- } else if (Array.isArray(props.modelValue)) {
55
- return props.modelValue.includes(name);
58
+ return innerValue.value === name;
59
+ } else if (Array.isArray(innerValue.value)) {
60
+ return innerValue.value.includes(name);
56
61
  }
57
62
  return false;
58
63
  };
@@ -41,7 +41,7 @@ const _sfc_main = create({
41
41
  props: __spreadProps(__spreadValues({}, popupProps), {
42
42
  closeOnClickOverlay: {
43
43
  type: Boolean,
44
- default: false
44
+ default: true
45
45
  },
46
46
  title: {
47
47
  type: String,
@@ -147,6 +147,11 @@ const _sfc_main = create({
147
147
  emit("ok");
148
148
  closed("ok");
149
149
  };
150
+ const onClickOverlay = () => {
151
+ if (props.closeOnClickOverlay) {
152
+ closed("");
153
+ }
154
+ };
150
155
  const contentStyle = computed(() => {
151
156
  return {
152
157
  textAlign: props.textAlign
@@ -158,6 +163,7 @@ const _sfc_main = create({
158
163
  onCancel,
159
164
  onOk,
160
165
  showPopup,
166
+ onClickOverlay,
161
167
  contentStyle,
162
168
  translate
163
169
  };
@@ -175,14 +181,14 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
175
181
  teleport: _ctx.teleport,
176
182
  visible: _ctx.showPopup,
177
183
  "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => _ctx.showPopup = $event),
178
- "close-on-click-overlay": _ctx.closeOnClickOverlay,
184
+ "close-on-click-overlay": false,
179
185
  "lock-scroll": _ctx.lockScroll,
180
186
  "pop-class": _ctx.popClass,
181
187
  "overlay-class": _ctx.overlayClass,
182
188
  "overlay-style": _ctx.overlayStyle,
183
189
  style: normalizeStyle(_ctx.popStyle),
184
190
  round: "",
185
- onClickOverlay: _ctx.closed,
191
+ onClickOverlay: _ctx.onClickOverlay,
186
192
  onClickCloseIcon: _ctx.closed
187
193
  }, {
188
194
  default: withCtx(() => [
@@ -238,7 +244,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
238
244
  ], 2)
239
245
  ]),
240
246
  _: 3
241
- }, 8, ["teleport", "visible", "close-on-click-overlay", "lock-scroll", "pop-class", "overlay-class", "overlay-style", "style", "onClickOverlay", "onClickCloseIcon"]);
247
+ }, 8, ["teleport", "visible", "lock-scroll", "pop-class", "overlay-class", "overlay-style", "style", "onClickOverlay", "onClickCloseIcon"]);
242
248
  }
243
249
  const Dialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
244
250
  class DialogOptions {
@@ -270,6 +276,7 @@ class DialogOptions {
270
276
  __publicField(this, "noCancelBtn", false);
271
277
  __publicField(this, "okBtnDisabled", false);
272
278
  __publicField(this, "closeOnPopstate", false);
279
+ __publicField(this, "closeOnClickOverlay", true);
273
280
  __publicField(this, "lockScroll", true);
274
281
  }
275
282
  }
@@ -22,7 +22,7 @@ var __publicField = (obj, key, value) => {
22
22
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
23
23
  return value;
24
24
  };
25
- import { reactive, computed, watch, toRefs, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeStyle, createElementBlock, createCommentVNode, ref, onMounted, Fragment, renderList, toDisplayString, normalizeClass, renderSlot, createVNode, h } from "vue";
25
+ import { reactive, computed, watch, toRefs, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeStyle, createElementBlock, createCommentVNode, ref, onMounted, Fragment, renderList, toDisplayString, normalizeClass, renderSlot, createVNode, nextTick, h } from "vue";
26
26
  import { c as createComponent, e as clamp, d as preventDefault, i as isArray } from "./component-81a4c1d0.js";
27
27
  import { u as useRect } from "./index-29892cda.js";
28
28
  import { u as useTouch } from "./index-7a7385e4.js";
@@ -63,6 +63,10 @@ const _sfc_main$1 = create$1({
63
63
  rootHeight: {
64
64
  type: Number,
65
65
  default: 0
66
+ },
67
+ contentClose: {
68
+ type: Boolean,
69
+ default: true
66
70
  }
67
71
  }),
68
72
  emits: ["close", "scale"],
@@ -204,7 +208,9 @@ const _sfc_main$1 = create$1({
204
208
  toggleScale();
205
209
  } else {
206
210
  doubleTapTimer = setTimeout(() => {
207
- emit("close");
211
+ if (props.contentClose) {
212
+ emit("close");
213
+ }
208
214
  doubleTapTimer = null;
209
215
  }, TAP_TIME);
210
216
  }
@@ -445,9 +451,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
445
451
  show: _ctx.showPop,
446
452
  "init-no": _ctx.active + 1,
447
453
  onClose: _ctx.onClose,
454
+ "content-close": _ctx.contentClose,
448
455
  maxZoom: _ctx.maxZoom,
449
456
  minZoom: _ctx.minZoom
450
- }, null, 8, ["video", "image", "rootHeight", "rootWidth", "show", "init-no", "onClose", "maxZoom", "minZoom"]);
457
+ }, null, 8, ["video", "image", "rootHeight", "rootWidth", "show", "init-no", "onClose", "content-close", "maxZoom", "minZoom"]);
451
458
  }), 128))
452
459
  ]),
453
460
  _: 1
@@ -502,7 +509,10 @@ class ImagePreviewFunction {
502
509
  setup() {
503
510
  return () => {
504
511
  options.onClose = () => {
505
- unmount();
512
+ options.show = false;
513
+ nextTick(() => {
514
+ unmount();
515
+ });
506
516
  };
507
517
  return h(ImagePreview, options);
508
518
  };
@@ -404,10 +404,13 @@ const _sfc_main = create({
404
404
  };
405
405
  });
406
406
  const titleStyle = computed(() => {
407
- return {
408
- marginLeft: pxCheck(props.titleGutter),
409
- marginRight: pxCheck(props.titleGutter)
410
- };
407
+ if (!props.titleGutter)
408
+ return {};
409
+ const px = pxCheck(props.titleGutter);
410
+ if (props.direction === "vertical") {
411
+ return { marginTop: px, marginBottom: px };
412
+ }
413
+ return { marginLeft: px, marginRight: px };
411
414
  });
412
415
  return __spreadValues(__spreadValues({
413
416
  navRef,
@@ -430,8 +433,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
430
433
  const _component_nut_sticky = resolveComponent("nut-sticky");
431
434
  return openBlock(), createElementBlock("view", {
432
435
  class: normalizeClass(["nut-tabs", [_ctx.direction]]),
433
- ref: "container",
434
- id: "container"
436
+ ref: "container"
435
437
  }, [
436
438
  _ctx.sticky ? (openBlock(), createBlock(_component_nut_sticky, {
437
439
  key: 0,
@@ -18,11 +18,6 @@
18
18
  object-fit: contain;
19
19
  }
20
20
 
21
- &-taro-img {
22
- width: 100%;
23
- height: 100%;
24
- }
25
-
26
21
  &-index {
27
22
  position: fixed;
28
23
  z-index: 2002;
@@ -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.9-beta.2",
5
+ "version": "4.0.9",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "tags": [
@@ -2794,7 +2794,7 @@
2794
2794
  },
2795
2795
  {
2796
2796
  "name": "content-close",
2797
- "default": "`false`",
2797
+ "default": "`true`",
2798
2798
  "description": "点击图片可以退出预览",
2799
2799
  "value": {
2800
2800
  "type": "boolean",