@nutui/nutui 4.0.9 → 4.0.10-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.
@@ -25,9 +25,8 @@ const _sfc_main = create({
25
25
  },
26
26
  duration: {
27
27
  type: [Number, String],
28
- default: 0
28
+ default: 0.3
29
29
  },
30
- titleIcon: String,
31
30
  closeOnClickOverlay: {
32
31
  type: Boolean,
33
32
  default: true
@@ -17,14 +17,14 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { reactive, computed, inject, getCurrentInstance, onUnmounted, resolveComponent, withDirectives, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, vShow, createVNode, mergeProps, withCtx, Fragment, renderList, renderSlot, createCommentVNode, toDisplayString } from "vue";
20
+ import { reactive, computed, inject, getCurrentInstance, onUnmounted, resolveComponent, withDirectives, openBlock, createElementBlock, normalizeStyle, createElementVNode, vShow, createVNode, mergeProps, withCtx, Fragment, renderList, normalizeClass, renderSlot, createCommentVNode, toDisplayString } from "vue";
21
21
  import { c as createComponent } from "./component-81a4c1d0.js";
22
22
  import { P as Popup } from "./index-da0a7662.js";
23
23
  import { Check } from "@nutui/icons-vue";
24
24
  import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
25
25
  import "../locale/lang";
26
26
  import "./Overlay.js";
27
- const { componentName, create } = createComponent("menu-item");
27
+ const { create } = createComponent("menu-item");
28
28
  const _sfc_main = create({
29
29
  props: {
30
30
  title: String,
@@ -42,23 +42,17 @@ const _sfc_main = create({
42
42
  default: 1
43
43
  },
44
44
  activeTitleClass: String,
45
- inactiveTitleClass: String,
46
- optionIcon: {
47
- type: String,
48
- default: "Check"
49
- }
45
+ inactiveTitleClass: String
50
46
  },
51
47
  components: {
52
48
  [Popup.name]: Popup,
53
49
  Check
54
50
  },
55
51
  emits: ["update:modelValue", "change", "open", "close"],
56
- setup(props, { emit, slots }) {
52
+ setup(props, { emit }) {
57
53
  const state = reactive({
58
54
  showPopup: false,
59
- transition: true,
60
- showWrapper: false,
61
- isShowPlaceholderElement: false
55
+ showWrapper: false
62
56
  });
63
57
  const useParent = () => {
64
58
  const parent2 = inject("menuParent", null);
@@ -69,32 +63,30 @@ const _sfc_main = create({
69
63
  onUnmounted(() => {
70
64
  removeLink(instance);
71
65
  });
72
- return {
73
- parent: parent2
74
- };
66
+ return { parent: parent2 };
75
67
  }
76
68
  };
77
69
  const { parent } = useParent();
78
- const classes = computed(() => {
79
- const prefixCls = componentName;
80
- return {
81
- [prefixCls]: true
70
+ const style = computed(() => {
71
+ return parent.props.direction === "down" ? {
72
+ top: parent.offset.value + "px"
73
+ } : {
74
+ bottom: parent.offset.value + "px"
82
75
  };
83
76
  });
84
77
  const placeholderElementStyle = computed(() => {
85
78
  const heightStyle = { height: parent.offset.value + "px" };
86
79
  if (parent.props.direction === "down") {
87
- return heightStyle;
80
+ return __spreadProps(__spreadValues({}, heightStyle), { top: "0px" });
88
81
  } else {
89
- return __spreadProps(__spreadValues({}, heightStyle), { top: "auto" });
82
+ return __spreadProps(__spreadValues({}, heightStyle), { bottom: "0px" });
90
83
  }
91
84
  });
92
- const toggle = (show = !state.showPopup, options = {}) => {
85
+ const toggle = (show = !state.showPopup) => {
93
86
  if (show === state.showPopup) {
94
87
  return;
95
88
  }
96
89
  state.showPopup = show;
97
- state.isShowPlaceholderElement = show;
98
90
  if (show) {
99
91
  state.showWrapper = true;
100
92
  emit("open");
@@ -110,7 +102,6 @@ const _sfc_main = create({
110
102
  };
111
103
  const onClick = (option) => {
112
104
  state.showPopup = false;
113
- state.isShowPlaceholderElement = false;
114
105
  if (option.value !== props.modelValue) {
115
106
  emit("update:modelValue", option.value);
116
107
  emit("change", option.value);
@@ -119,14 +110,13 @@ const _sfc_main = create({
119
110
  const handleClose = () => {
120
111
  emit("close");
121
112
  state.showWrapper = false;
122
- state.isShowPlaceholderElement = false;
123
113
  };
124
114
  const handleClickOutside = () => {
125
115
  state.showPopup = false;
126
116
  emit("close");
127
117
  };
128
118
  return {
129
- classes,
119
+ style,
130
120
  placeholderElementStyle,
131
121
  renderTitle,
132
122
  state,
@@ -144,24 +134,24 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
144
134
  const _component_Check = resolveComponent("Check");
145
135
  const _component_nut_popup = resolveComponent("nut-popup");
146
136
  return withDirectives((openBlock(), createElementBlock("view", {
147
- class: normalizeClass(_ctx.classes)
137
+ class: "nut-menu-item",
138
+ style: normalizeStyle(_ctx.style)
148
139
  }, [
149
140
  withDirectives(createElementVNode("div", {
150
141
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClickOutside && _ctx.handleClickOutside(...args)),
151
- class: normalizeClass(["nut-menu-item-placeholder-element", { up: _ctx.parent.props.direction === "up" }]),
142
+ class: "nut-menu-item-placeholder-element",
152
143
  style: normalizeStyle(_ctx.placeholderElementStyle)
153
- }, null, 6), [
154
- [vShow, _ctx.state.isShowPlaceholderElement]
144
+ }, null, 4), [
145
+ [vShow, _ctx.state.showPopup]
155
146
  ]),
156
147
  createVNode(_component_nut_popup, mergeProps({
157
- style: _ctx.parent.props.direction === "down" ? { top: _ctx.parent.offset.value + "px" } : { bottom: _ctx.parent.offset.value + "px" },
158
- overlayStyle: _ctx.parent.props.direction === "down" ? { top: _ctx.parent.offset.value + "px" } : { bottom: _ctx.parent.offset.value + "px", top: "auto" }
148
+ style: { position: "absolute" },
149
+ overlayStyle: { position: "absolute" }
159
150
  }, _ctx.$attrs, {
160
151
  visible: _ctx.state.showPopup,
161
152
  "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => _ctx.state.showPopup = $event),
162
153
  position: _ctx.parent.props.direction === "down" ? "top" : "bottom",
163
154
  duration: _ctx.parent.props.duration,
164
- "pop-class": "nut-menu__pop",
165
155
  "destroy-on-close": false,
166
156
  overlay: _ctx.parent.props.overlay,
167
157
  onClosed: _ctx.handleClose,
@@ -198,8 +188,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
198
188
  ])
199
189
  ]),
200
190
  _: 3
201
- }, 16, ["style", "overlayStyle", "visible", "position", "duration", "overlay", "onClosed", "lockScroll", "close-on-click-overlay"])
202
- ], 2)), [
191
+ }, 16, ["visible", "position", "duration", "overlay", "onClosed", "lockScroll", "close-on-click-overlay"])
192
+ ], 4)), [
203
193
  [vShow, _ctx.state.showWrapper]
204
194
  ]);
205
195
  }
@@ -28,7 +28,7 @@ const usePicker = (props, emit) => {
28
28
  const state = reactive({
29
29
  formattedColumns: props.columns
30
30
  });
31
- let defaultValues = ref([]);
31
+ const defaultValues = ref([]);
32
32
  const pickerColumn = ref([]);
33
33
  const swipeRef = (el) => {
34
34
  if (el && pickerColumn.value.length < columnsList.value.length) {
@@ -42,13 +42,9 @@ const usePicker = (props, emit) => {
42
42
  };
43
43
  });
44
44
  const selectedOptions = computed(() => {
45
- let optins = [];
46
- columnsList.value.map((column2, index) => {
47
- let currOptions = [];
48
- currOptions = column2.filter((item) => item.value == defaultValues.value[index]);
49
- optins.push(currOptions[0]);
45
+ return columnsList.value.map((column2, index) => {
46
+ return column2.find((item) => item.value === defaultValues.value[index]);
50
47
  });
51
- return optins;
52
48
  });
53
49
  const columnsType = computed(() => {
54
50
  const firstColumn = state.formattedColumns[0];
@@ -83,8 +79,8 @@ const usePicker = (props, emit) => {
83
79
  while (cursor && cursor.children) {
84
80
  const options = cursor.children;
85
81
  const value = defaultValues2[columnIndex];
86
- let index = options.findIndex((columnItem) => columnItem.value == value);
87
- if (index == -1)
82
+ let index = options.findIndex((columnItem) => columnItem.value === value);
83
+ if (index === -1)
88
84
  index = 0;
89
85
  cursor = cursor.children[index];
90
86
  columnIndex++;
@@ -110,7 +106,7 @@ const usePicker = (props, emit) => {
110
106
  index++;
111
107
  cursor = cursor.children[0];
112
108
  }
113
- if (cursor && cursor.children && cursor.children.length == 0) {
109
+ if (cursor && cursor.children && cursor.children.length === 0) {
114
110
  defaultValues.value = defaultValues.value.slice(0, index + 1);
115
111
  }
116
112
  } else {
@@ -350,7 +346,7 @@ const _sfc_main$1 = create$1({
350
346
  };
351
347
  const modifyStatus = (type) => {
352
348
  const { column: column2 } = props;
353
- let index = column2.findIndex((columnItem) => columnItem.value == props.value);
349
+ let index = column2.findIndex((columnItem) => columnItem.value === props.value);
354
350
  state.currIndex = index === -1 ? 1 : index + 1;
355
351
  let move = index === -1 ? 0 : index * +props.optionHeight;
356
352
  type && setChooseValue();
@@ -1,4 +1,4 @@
1
- import { provide, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
1
+ import { provide, computed, 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";
@@ -33,23 +33,23 @@ const _sfc_main = create({
33
33
  const getClass = (prefix, type) => {
34
34
  return prefix ? type ? `nut-row-${prefix}-${type}` : "" : `nut-row-${type}`;
35
35
  };
36
- const getClasses = () => {
37
- return `
38
- ${getClass("", props.type)}
39
- ${getClass("justify", props.justify)}
40
- ${getClass("align", props.align)}
41
- ${getClass("flex", props.flexWrap)}
42
- ${prefixCls}
43
- `;
44
- };
36
+ const classes = computed(() => {
37
+ return [
38
+ prefixCls,
39
+ getClass("", props.type),
40
+ getClass("justify", props.justify),
41
+ getClass("align", props.align),
42
+ getClass("flex", props.flexWrap)
43
+ ];
44
+ });
45
45
  return {
46
- getClasses
46
+ classes
47
47
  };
48
48
  }
49
49
  });
50
50
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
51
51
  return openBlock(), createElementBlock("view", {
52
- class: normalizeClass(_ctx.getClasses())
52
+ class: normalizeClass(_ctx.classes)
53
53
  }, [
54
54
  renderSlot(_ctx.$slots, "default")
55
55
  ], 2);
@@ -32,12 +32,16 @@ const _sfc_main = create({
32
32
  },
33
33
  inputType: {
34
34
  type: String,
35
- default: "textarea"
35
+ default: "text"
36
36
  },
37
37
  label: {
38
38
  type: String,
39
39
  default: ""
40
40
  },
41
+ shape: {
42
+ type: String,
43
+ default: "round"
44
+ },
41
45
  maxLength: {
42
46
  type: [String, Number],
43
47
  default: "9999"
@@ -64,9 +68,7 @@ const _sfc_main = create({
64
68
  },
65
69
  focusStyle: {
66
70
  type: Object,
67
- // eslint-disable-next-line @typescript-eslint/no-empty-function
68
- default: () => {
69
- }
71
+ default: () => ({})
70
72
  },
71
73
  autofocus: {
72
74
  type: Boolean,
@@ -96,7 +98,7 @@ const _sfc_main = create({
96
98
  "click-left-icon",
97
99
  "click-right-icon"
98
100
  ],
99
- setup(props, { slots, emit }) {
101
+ setup(props, { emit }) {
100
102
  const state = reactive({
101
103
  active: false
102
104
  });
@@ -215,7 +217,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
215
217
  renderSlot(_ctx.$slots, "leftout")
216
218
  ])) : createCommentVNode("", true),
217
219
  createElementVNode("view", {
218
- class: "nut-searchbar__search-input",
220
+ class: normalizeClass([`nut-searchbar__search-input`, _ctx.shape]),
219
221
  style: normalizeStyle(__spreadValues(__spreadValues({}, _ctx.inputSearchbarStyle), _ctx.focusCss))
220
222
  }, [
221
223
  _ctx.$slots.leftin ? (openBlock(), createElementBlock("view", {
@@ -266,7 +268,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
266
268
  renderSlot(_ctx.$slots, "rightin")
267
269
  ])) : createCommentVNode("", true)
268
270
  ], 2)
269
- ], 4),
271
+ ], 6),
270
272
  _ctx.$slots.rightout ? (openBlock(), createElementBlock("view", _hoisted_5, [
271
273
  renderSlot(_ctx.$slots, "rightout")
272
274
  ])) : createCommentVNode("", true)
@@ -15,10 +15,10 @@
15
15
 
16
16
  @for $i from 1 through 24 {
17
17
  .nut-col-offset-#{$i} {
18
- margin-left: calc(100 / 24) * $i * 1%;
18
+ margin-left: calc((100 / 24) * #{$i} * 1%);
19
19
  }
20
20
 
21
21
  .nut-col-#{$i} {
22
- width: calc(100 / 24) * $i * 1%;
22
+ width: calc((100 / 24) * #{$i} * 1%);
23
23
  }
24
24
  }
@@ -9,6 +9,13 @@
9
9
  }
10
10
 
11
11
  .nut-menu-item {
12
+ position: fixed;
13
+ z-index: $menu-bar-opened-z-index;
14
+ left: 0;
15
+ right: 0;
16
+ height: 100vh;
17
+ overflow: hidden;
18
+
12
19
  .active {
13
20
  font-weight: $menu-active-item-font-weight;
14
21
  color: $menu-item-active-text-color !important;
@@ -40,20 +47,10 @@
40
47
  }
41
48
  }
42
49
 
43
- .nut-menu__pop {
44
- transition: height linear 3s;
45
- transform: none;
46
- }
47
-
48
50
  .nut-menu-item-placeholder-element {
49
51
  position: fixed;
50
- top: $menu-bar-line-height;
51
52
  left: 0;
52
53
  right: 0;
53
54
  z-index: $menu-bar-opened-z-index;
54
55
  background-color: transparent;
55
-
56
- &.up {
57
- bottom: $menu-bar-line-height;
58
- }
59
56
  }
@@ -48,6 +48,10 @@
48
48
  background: $searchbar-input-background;
49
49
  box-sizing: border-box;
50
50
 
51
+ &.square {
52
+ border-radius: 0;
53
+ }
54
+
51
55
  .nut-searchbar__input-inner {
52
56
  display: flex;
53
57
  position: relative;
@@ -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",
5
+ "version": "4.0.10-beta.1",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "tags": [
@@ -4924,7 +4924,7 @@
4924
4924
  },
4925
4925
  {
4926
4926
  "name": "shape",
4927
- "default": "`square`",
4927
+ "default": "`round`",
4928
4928
  "description": "搜索框形状,可选值为 `square` `round`",
4929
4929
  "value": {
4930
4930
  "type": "string",