@nutui/nutui 4.1.3 → 4.1.5-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 (150) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +1 -1
  3. package/dist/nutui.es.js +1 -1
  4. package/dist/nutui.js +3215 -3175
  5. package/dist/nutui.umd.js +1 -1
  6. package/dist/packages/_es/ActionSheet.js +9 -7
  7. package/dist/packages/_es/Address.js +17 -17
  8. package/dist/packages/_es/Animate.js +2 -2
  9. package/dist/packages/_es/Audio.js +7 -7
  10. package/dist/packages/_es/Avatar.js +2 -2
  11. package/dist/packages/_es/AvatarGroup.js +1 -1
  12. package/dist/packages/_es/Badge.js +3 -3
  13. package/dist/packages/_es/Calendar.js +17 -17
  14. package/dist/packages/_es/CalendarItem.js +1 -1
  15. package/dist/packages/_es/Cascader.js +14 -14
  16. package/dist/packages/_es/Category.js +2 -2
  17. package/dist/packages/_es/CategoryPane.js +3 -3
  18. package/dist/packages/_es/Collapse.js +2 -2
  19. package/dist/packages/_es/CollapseItem.js +7 -7
  20. package/dist/packages/_es/Comment.js +3 -3
  21. package/dist/packages/_es/Countdown.js +6 -6
  22. package/dist/packages/_es/Countup.js +11 -11
  23. package/dist/packages/_es/DatePicker.js +5 -5
  24. package/dist/packages/_es/Dialog.js +3 -3
  25. package/dist/packages/_es/Drag.js +1 -1
  26. package/dist/packages/_es/Ecard.js +3 -3
  27. package/dist/packages/_es/Elevator.js +8 -8
  28. package/dist/packages/_es/Ellipsis.js +2 -2
  29. package/dist/packages/_es/FormItem.js +0 -1
  30. package/dist/packages/_es/GridItem.js +1 -1
  31. package/dist/packages/_es/Image.js +2 -2
  32. package/dist/packages/_es/ImagePreview.js +12 -12
  33. package/dist/packages/_es/InfiniteLoading.js +5 -5
  34. package/dist/packages/_es/Input.js +3 -3
  35. package/dist/packages/_es/Invoice.js +5 -5
  36. package/dist/packages/_es/List.js +11 -11
  37. package/dist/packages/_es/Menu.js +4 -4
  38. package/dist/packages/_es/MenuItem.js +9 -10
  39. package/dist/packages/_es/Navbar.js +7 -7
  40. package/dist/packages/_es/Noticebar.js +21 -15
  41. package/dist/packages/_es/Notify.js +1 -1
  42. package/dist/packages/_es/NumberKeyboard.js +2 -2
  43. package/dist/packages/_es/Overlay.js +3 -3
  44. package/dist/packages/_es/Picker.js +96 -57
  45. package/dist/packages/_es/Popover.js +6 -6
  46. package/dist/packages/_es/Popup.js +1 -1
  47. package/dist/packages/_es/PullRefresh.js +1 -1
  48. package/dist/packages/_es/Range.js +5 -5
  49. package/dist/packages/_es/Row.js +0 -1
  50. package/dist/packages/_es/Searchbar.js +10 -10
  51. package/dist/packages/_es/ShortPassword.js +9 -9
  52. package/dist/packages/_es/SideNavbar.js +2 -3
  53. package/dist/packages/_es/SideNavbarItem.js +2 -2
  54. package/dist/packages/_es/Signature.js +2 -2
  55. package/dist/packages/_es/Sku.js +24 -24
  56. package/dist/packages/_es/Step.js +1 -1
  57. package/dist/packages/_es/Steps.js +2 -2
  58. package/dist/packages/_es/Sticky.js +2 -2
  59. package/dist/packages/_es/SubSideNavbar.js +2 -2
  60. package/dist/packages/_es/Swipe.js +2 -2
  61. package/dist/packages/_es/SwipeGroup.js +2 -2
  62. package/dist/packages/_es/Swiper.js +4 -4
  63. package/dist/packages/_es/Switch.js +2 -2
  64. package/dist/packages/_es/Tabbar.js +2 -2
  65. package/dist/packages/_es/Table.js +6 -6
  66. package/dist/packages/_es/Tabs.js +13 -13
  67. package/dist/packages/_es/Textarea.js +3 -3
  68. package/dist/packages/_es/TimeDetail.js +1 -1
  69. package/dist/packages/_es/TimeSelect.js +1 -1
  70. package/dist/packages/_es/Tour.js +3 -3
  71. package/dist/packages/_es/Uploader.js +11 -11
  72. package/dist/packages/_es/Video.js +11 -11
  73. package/dist/packages/_es/{index-7fe29a2f.js → index-3032df15.js} +8 -9
  74. package/dist/packages/_es/{index-66fff386.js → index-ae1af668.js} +10 -10
  75. package/dist/packages/circleprogress/index.scss +3 -1
  76. package/dist/packages/formitem/index.scss +3 -1
  77. package/dist/packages/popover/index.scss +3 -1
  78. package/dist/packages/video/index.scss +4 -1
  79. package/dist/smartips/web-types.json +11 -2
  80. package/dist/style.css +1 -1
  81. package/dist/styles/themes/default.scss +48 -48
  82. package/dist/styles/themes/jdb.scss +48 -48
  83. package/dist/styles/themes/jddkh.scss +48 -48
  84. package/dist/styles/themes/jdt.scss +48 -48
  85. package/dist/styles/variables-jdb.scss +7 -1
  86. package/dist/styles/variables-jddkh.scss +7 -1
  87. package/dist/types/__VUE/actionsheet/index.vue.d.ts +1 -1
  88. package/dist/types/__VUE/address/index.vue.d.ts +3 -3
  89. package/dist/types/__VUE/addresslist/components/GeneralShell.vue.d.ts +60 -0
  90. package/dist/types/__VUE/addresslist/components/ItemContents.vue.d.ts +23 -0
  91. package/dist/types/__VUE/addresslist/index.vue.d.ts +2 -2
  92. package/dist/types/__VUE/audio/index.vue.d.ts +3 -3
  93. package/dist/types/__VUE/cascader/cascader-item.vue.d.ts +77 -0
  94. package/dist/types/__VUE/collapseitem/index.vue.d.ts +3 -3
  95. package/dist/types/__VUE/comment/components/CmtBottom.vue.d.ts +42 -0
  96. package/dist/types/__VUE/comment/components/CmtHeader.vue.d.ts +36 -0
  97. package/dist/types/__VUE/comment/components/CmtImages.vue.d.ts +59 -0
  98. package/dist/types/__VUE/comment/index.vue.d.ts +4 -4
  99. package/dist/types/__VUE/countdown/index.vue.d.ts +4 -4
  100. package/dist/types/__VUE/countup/index.vue.d.ts +3 -3
  101. package/dist/types/__VUE/datepicker/index.vue.d.ts +3 -3
  102. package/dist/types/__VUE/elevator/index.vue.d.ts +3 -3
  103. package/dist/types/__VUE/empty/index.vue.d.ts +1 -1
  104. package/dist/types/__VUE/formitem/index.vue.d.ts +2 -4
  105. package/dist/types/__VUE/grid/index.vue.d.ts +1 -1
  106. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +126 -0
  107. package/dist/types/__VUE/imagepreview/index.vue.d.ts +3 -3
  108. package/dist/types/__VUE/indicator/index.vue.d.ts +1 -0
  109. package/dist/types/__VUE/infiniteloading/index.vue.d.ts +3 -3
  110. package/dist/types/__VUE/input/index.vue.d.ts +3 -3
  111. package/dist/types/__VUE/inputnumber/index.vue.d.ts +1 -1
  112. package/dist/types/__VUE/invoice/index.vue.d.ts +2 -2
  113. package/dist/types/__VUE/list/index.vue.d.ts +4 -4
  114. package/dist/types/__VUE/navbar/index.vue.d.ts +5 -5
  115. package/dist/types/__VUE/noticebar/index.vue.d.ts +3 -3
  116. package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +4 -4
  117. package/dist/types/__VUE/picker/Column.vue.d.ts +134 -0
  118. package/dist/types/__VUE/picker/baseProps.d.ts +5 -1
  119. package/dist/types/__VUE/picker/common.d.ts +503 -11
  120. package/dist/types/__VUE/picker/doc.en.d.ts +4 -2
  121. package/dist/types/__VUE/picker/index.vue.d.ts +139 -8
  122. package/dist/types/__VUE/picker/types.d.ts +6 -0
  123. package/dist/types/__VUE/picker/usePicker.d.ts +7 -4
  124. package/dist/types/__VUE/popover/index.vue.d.ts +1 -1
  125. package/dist/types/__VUE/popup/index.vue.d.ts +4 -4
  126. package/dist/types/__VUE/range/index.vue.d.ts +8 -7
  127. package/dist/types/__VUE/rate/index.vue.d.ts +5 -5
  128. package/dist/types/__VUE/row/index.vue.d.ts +2 -2
  129. package/dist/types/__VUE/searchbar/index.vue.d.ts +7 -7
  130. package/dist/types/__VUE/sidenavbar/index.vue.d.ts +2 -2
  131. package/dist/types/__VUE/signature/index.vue.d.ts +1 -1
  132. package/dist/types/__VUE/sku/components/SkuHeader.vue.d.ts +17 -0
  133. package/dist/types/__VUE/sku/components/SkuOperate.vue.d.ts +60 -0
  134. package/dist/types/__VUE/sku/components/SkuSelect.vue.d.ts +25 -0
  135. package/dist/types/__VUE/sku/components/SkuStepper.vue.d.ts +56 -0
  136. package/dist/types/__VUE/sku/index.vue.d.ts +9 -9
  137. package/dist/types/__VUE/step/index.vue.d.ts +2 -2
  138. package/dist/types/__VUE/steps/index.vue.d.ts +2 -2
  139. package/dist/types/__VUE/subsidenavbar/index.vue.d.ts +2 -2
  140. package/dist/types/__VUE/swiper/index.vue.d.ts +2 -2
  141. package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
  142. package/dist/types/__VUE/tabbaritem/index.vue.d.ts +3 -3
  143. package/dist/types/__VUE/table/common.d.ts +1 -1
  144. package/dist/types/__VUE/tabs/index.vue.d.ts +1 -1
  145. package/dist/types/__VUE/tag/index.vue.d.ts +3 -0
  146. package/dist/types/__VUE/textarea/index.vue.d.ts +1 -1
  147. package/dist/types/__VUE/toast/index.vue.d.ts +4 -4
  148. package/dist/types/__VUE/uploader/index.vue.d.ts +2 -2
  149. package/dist/types/index.d.ts +1 -1
  150. package/package.json +1 -1
@@ -92,7 +92,7 @@ const _sfc_main = create({
92
92
  Notice,
93
93
  CircleClose
94
94
  },
95
- emits: ["click", "close", "across-end"],
95
+ emits: ["click", "close", "acrossEnd"],
96
96
  setup(props, { emit, slots }) {
97
97
  const wrap = ref(null);
98
98
  const content = ref(null);
@@ -208,7 +208,7 @@ const _sfc_main = create({
208
208
  };
209
209
  const onAnimationEnd = (event) => {
210
210
  state.firstRound = false;
211
- emit("across-end", event);
211
+ emit("acrossEnd", event);
212
212
  setTimeout(() => {
213
213
  state.duration = (state.offsetWidth + state.wrapWidth) / props.speed;
214
214
  state.animationClass = "play-infinite";
@@ -220,19 +220,25 @@ const _sfc_main = create({
220
220
  };
221
221
  const showhorseLamp = () => {
222
222
  state.animate = true;
223
- setTimeout(() => {
224
- state.scrollList.push(state.scrollList[0]);
225
- state.scrollList.shift();
226
- state.animate = false;
227
- }, ~~(props.height / props.speed / 4 * 1e3));
223
+ setTimeout(
224
+ () => {
225
+ state.scrollList.push(state.scrollList[0]);
226
+ state.scrollList.shift();
227
+ state.animate = false;
228
+ },
229
+ ~~(props.height / props.speed / 4 * 1e3)
230
+ );
228
231
  };
229
232
  const startRoll = () => {
230
- state.timer = setInterval(() => {
231
- let chunk = 100;
232
- for (let i = 0; i < chunk; i++) {
233
- scroll(i, i < chunk - 1 ? false : true);
234
- }
235
- }, props.standTime + 100 * props.speed);
233
+ state.timer = setInterval(
234
+ () => {
235
+ let chunk = 100;
236
+ for (let i = 0; i < chunk; i++) {
237
+ scroll(i, i < chunk - 1 ? false : true);
238
+ }
239
+ },
240
+ props.standTime + 100 * props.speed
241
+ );
236
242
  };
237
243
  const scroll = (n, last) => {
238
244
  setTimeout(() => {
@@ -360,7 +366,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
360
366
  class: normalizeClass(_ctx.wrapContentClass),
361
367
  style: normalizeStyle(_ctx.contentStyle),
362
368
  onAnimationend: _cache[0] || (_cache[0] = (...args) => _ctx.onAnimationEnd && _ctx.onAnimationEnd(...args)),
363
- "on:webkitAnimationEnd": _cache[1] || (_cache[1] = (...args) => _ctx.onAnimationEnd && _ctx.onAnimationEnd(...args))
369
+ onWebkitAnimationEnd: _cache[1] || (_cache[1] = (...args) => _ctx.onAnimationEnd && _ctx.onAnimationEnd(...args))
364
370
  }, [
365
371
  renderSlot(_ctx.$slots, "default", {}, () => [
366
372
  createTextVNode(toDisplayString(_ctx.text), 1)
@@ -407,8 +413,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
407
413
  }, [
408
414
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.scrollList, (item, index2) => {
409
415
  return openBlock(), createElementBlock("li", {
410
- class: "nut-noticebar__vertical-item",
411
416
  key: index2,
417
+ class: "nut-noticebar__vertical-item",
412
418
  style: normalizeStyle({ height: _ctx.pxCheck(_ctx.height), lineHeight: _ctx.pxCheck(_ctx.height) }),
413
419
  onClick: ($event) => _ctx.go(item)
414
420
  }, toDisplayString(item), 13, _hoisted_5);
@@ -19,7 +19,7 @@ var __spreadValues = (a, b) => {
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import { ref, watch, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeClass, normalizeStyle, renderSlot, createElementBlock, Fragment, createTextVNode, toDisplayString, createVNode, render, onMounted, h } from "vue";
21
21
  import { c as createComponent } from "./component-0fbad28e.js";
22
- import { P as Popup } from "./index-7fe29a2f.js";
22
+ import { P as Popup } from "./index-3032df15.js";
23
23
  import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
24
24
  import "../locale/lang";
25
25
  import "@nutui/icons-vue";
@@ -1,6 +1,6 @@
1
1
  import { ref, computed, watch, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, toDisplayString, createCommentVNode, Fragment, renderList, normalizeClass, createTextVNode } from "vue";
2
2
  import { c as createComponent } from "./component-0fbad28e.js";
3
- import { P as Popup } from "./index-7fe29a2f.js";
3
+ import { P as Popup } from "./index-3032df15.js";
4
4
  import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
5
5
  import "../locale/lang";
6
6
  import "@nutui/icons-vue";
@@ -137,7 +137,7 @@ const _sfc_main = create({
137
137
  clickKeyIndex.value = item.id;
138
138
  if (item.type == "number" || item.type == "custom") {
139
139
  emit("input", item.id);
140
- if (props.modelValue.length < props.maxlength) {
140
+ if (props.modelValue.length < +props.maxlength) {
141
141
  emit("update:modelValue", props.modelValue + item.id);
142
142
  }
143
143
  }
@@ -14,7 +14,7 @@ var __spreadValues = (a, b) => {
14
14
  }
15
15
  return a;
16
16
  };
17
- import { computed, watchEffect, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, withModifiers, normalizeStyle, renderSlot, vShow } from "vue";
17
+ import { computed, watchEffect, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, withModifiers, renderSlot, vShow } from "vue";
18
18
  import { b as body, c as createComponent } from "./component-0fbad28e.js";
19
19
  import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
20
20
  import "../locale/lang";
@@ -107,8 +107,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
107
107
  default: withCtx(() => [
108
108
  withDirectives(createElementVNode("view", {
109
109
  class: normalizeClass(_ctx.classes),
110
- onClick: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.onClick && _ctx.onClick(...args), ["stop"])),
111
- style: normalizeStyle(_ctx.style)
110
+ style: normalizeStyle(_ctx.style),
111
+ onClick: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.onClick && _ctx.onClick(...args), ["stop"]))
112
112
  }, [
113
113
  renderSlot(_ctx.$slots, "default")
114
114
  ], 6), [
@@ -17,72 +17,91 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { reactive, ref, computed, watch, toRefs, onMounted, openBlock, createElementBlock, createElementVNode, normalizeStyle, Fragment, renderList, normalizeClass, toDisplayString, createCommentVNode, resolveComponent, renderSlot, createVNode } from "vue";
20
+ import { reactive, computed, ref, watch, toRefs, onMounted, openBlock, createElementBlock, createElementVNode, normalizeStyle, Fragment, renderList, normalizeClass, toDisplayString, createCommentVNode, resolveComponent, renderSlot, createVNode } from "vue";
21
21
  import { c as createComponent, d as preventDefault, e as clamp } from "./component-0fbad28e.js";
22
22
  import { p as pxCheck } from "./pxCheck-c6b9f6b7.js";
23
23
  import { u as useTouch } from "./index-7a7385e4.js";
24
24
  import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
25
25
  import "../locale/lang";
26
- const { componentName } = createComponent("picker");
26
+ const DEFAULT_FILED_NAMES = {
27
+ text: "text",
28
+ value: "value",
29
+ children: "children"
30
+ };
27
31
  const usePicker = (props, emit) => {
28
32
  const state = reactive({
29
33
  formattedColumns: props.columns
30
34
  });
35
+ const columnFieldNames = computed(() => {
36
+ return __spreadValues(__spreadValues({}, DEFAULT_FILED_NAMES), props.fieldNames);
37
+ });
31
38
  const defaultValues = ref([]);
39
+ const defaultIndexes = computed(() => {
40
+ const fields = columnFieldNames.value;
41
+ return columnsList.value.map((column2, index) => {
42
+ const targetIndex = column2.findIndex((item) => item[fields.value] === defaultValues.value[index]);
43
+ return targetIndex === -1 ? 0 : targetIndex;
44
+ });
45
+ });
32
46
  const pickerColumn = ref([]);
33
47
  const swipeRef = (el) => {
34
48
  if (el && pickerColumn.value.length < columnsList.value.length) {
35
49
  pickerColumn.value.push(el);
36
50
  }
37
51
  };
38
- const classes = computed(() => {
39
- const prefixCls = componentName;
40
- return {
41
- [prefixCls]: true
42
- };
43
- });
44
52
  const selectedOptions = computed(() => {
53
+ const fields = columnFieldNames.value;
45
54
  return columnsList.value.map((column2, index) => {
46
- return column2.find((item) => item.value === defaultValues.value[index]);
55
+ return column2.find((item) => item[fields.value] === defaultValues.value[index]) || column2[0];
47
56
  });
48
57
  });
49
58
  const columnsType = computed(() => {
50
59
  const firstColumn = state.formattedColumns[0];
60
+ const fields = columnFieldNames.value;
51
61
  if (firstColumn) {
52
62
  if (Array.isArray(firstColumn)) {
53
63
  return "multiple";
54
64
  }
55
- if ("children" in firstColumn) {
65
+ if (fields.children in firstColumn) {
56
66
  return "cascade";
57
67
  }
58
68
  }
59
69
  return "single";
60
70
  });
61
71
  const columnsList = computed(() => {
72
+ let result = [];
62
73
  switch (columnsType.value) {
63
74
  case "multiple":
64
- return state.formattedColumns;
75
+ result = state.formattedColumns;
76
+ break;
65
77
  case "cascade":
66
- return formatCascade(state.formattedColumns, defaultValues.value ? defaultValues.value : []);
78
+ result = formatCascade(
79
+ state.formattedColumns,
80
+ defaultValues.value ? defaultValues.value : []
81
+ );
82
+ break;
67
83
  default:
68
- return [state.formattedColumns];
84
+ result = [state.formattedColumns];
85
+ break;
69
86
  }
87
+ return result;
70
88
  });
71
89
  const formatCascade = (columns, defaultValues2) => {
72
90
  const formatted = [];
91
+ const fields = columnFieldNames.value;
73
92
  let cursor = {
74
93
  text: "",
75
94
  value: "",
76
- children: columns
95
+ [fields.children]: columns
77
96
  };
78
97
  let columnIndex = 0;
79
- while (cursor && cursor.children) {
80
- const options = cursor.children;
98
+ while (cursor && cursor[fields.children]) {
99
+ const options = cursor[fields.children];
81
100
  const value = defaultValues2[columnIndex];
82
- let index = options.findIndex((columnItem) => columnItem.value === value);
101
+ let index = options.findIndex((columnItem) => columnItem[fields.value] === value);
83
102
  if (index === -1)
84
103
  index = 0;
85
- cursor = cursor.children[index];
104
+ cursor = cursor[fields.children][index];
86
105
  columnIndex++;
87
106
  formatted.push(options);
88
107
  }
@@ -95,22 +114,24 @@ const usePicker = (props, emit) => {
95
114
  });
96
115
  };
97
116
  const changeHandler = (columnIndex, option) => {
117
+ var _a;
118
+ const fields = columnFieldNames.value;
98
119
  if (option && Object.keys(option).length) {
99
120
  defaultValues.value = defaultValues.value ? defaultValues.value : [];
100
121
  if (columnsType.value === "cascade") {
101
- defaultValues.value[columnIndex] = option.value ? option.value : "";
122
+ defaultValues.value[columnIndex] = (_a = option[fields.value]) != null ? _a : "";
102
123
  let index = columnIndex;
103
124
  let cursor = option;
104
- while (cursor && cursor.children && cursor.children[0]) {
105
- defaultValues.value[index + 1] = cursor.children[0].value;
125
+ while (cursor && cursor[fields.children] && cursor[fields.children][0]) {
126
+ defaultValues.value[index + 1] = cursor[fields.children][0][fields.value];
106
127
  index++;
107
- cursor = cursor.children[0];
128
+ cursor = cursor[fields.children][0];
108
129
  }
109
- if (cursor && cursor.children && cursor.children.length === 0) {
130
+ if (cursor && cursor[fields.children] && cursor[fields.children].length === 0) {
110
131
  defaultValues.value = defaultValues.value.slice(0, index + 1);
111
132
  }
112
133
  } else {
113
- defaultValues.value[columnIndex] = Object.prototype.hasOwnProperty.call(option, "value") ? option.value : "";
134
+ defaultValues.value[columnIndex] = Object.prototype.hasOwnProperty.call(option, fields.value) ? option[fields.value] : "";
114
135
  }
115
136
  emit("change", {
116
137
  columnIndex,
@@ -120,9 +141,10 @@ const usePicker = (props, emit) => {
120
141
  }
121
142
  };
122
143
  const confirm = () => {
144
+ const fields = columnFieldNames.value;
123
145
  if (defaultValues.value && !defaultValues.value.length) {
124
146
  columnsList.value.forEach((columns) => {
125
- defaultValues.value.push(columns[0].value);
147
+ defaultValues.value.push(columns[0][fields.value]);
126
148
  });
127
149
  }
128
150
  emit("confirm", {
@@ -156,15 +178,15 @@ const usePicker = (props, emit) => {
156
178
  state.formattedColumns = val;
157
179
  }
158
180
  );
159
- return __spreadProps(__spreadValues({
160
- classes
161
- }, toRefs(state)), {
181
+ return __spreadProps(__spreadValues({}, toRefs(state)), {
162
182
  columnsType,
163
183
  columnsList,
184
+ columnFieldNames,
164
185
  cancel,
165
186
  changeHandler,
166
187
  confirm,
167
188
  defaultValues,
189
+ defaultIndexes,
168
190
  pickerColumn,
169
191
  swipeRef,
170
192
  selectedOptions,
@@ -197,6 +219,15 @@ const _sfc_main$1 = create$1({
197
219
  optionHeight: {
198
220
  type: [Number, String],
199
221
  default: 36
222
+ },
223
+ fieldNames: {
224
+ type: Object,
225
+ default: () => ({})
226
+ },
227
+ // 特殊环境判断
228
+ taro: {
229
+ type: Boolean,
230
+ defualt: false
200
231
  }
201
232
  },
202
233
  emits: ["click", "change"],
@@ -249,8 +280,8 @@ const _sfc_main$1 = create$1({
249
280
  });
250
281
  const onTouchStart = (event) => {
251
282
  touch.start(event);
252
- if (moving.value) {
253
- let dom = roller.value;
283
+ if (moving.value && !props.taro) {
284
+ const dom = roller.value;
254
285
  const { transform } = window.getComputedStyle(dom);
255
286
  if (props.threeDimensional) {
256
287
  const circle = Math.floor(parseInt(touchDeg.value) / 360);
@@ -346,7 +377,7 @@ const _sfc_main$1 = create$1({
346
377
  };
347
378
  const modifyStatus = (type) => {
348
379
  const { column: column2 } = props;
349
- let index = column2.findIndex((columnItem) => columnItem.value === props.value);
380
+ let index = column2.findIndex((columnItem) => columnItem[props.fieldNames.value] === props.value);
350
381
  state.currIndex = index === -1 ? 1 : index + 1;
351
382
  let move = index === -1 ? 0 : index * +props.optionHeight;
352
383
  type && setChooseValue();
@@ -406,25 +437,26 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
406
437
  onTouchend: _cache[3] || (_cache[3] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
407
438
  }, [
408
439
  createElementVNode("view", {
409
- class: "nut-picker-roller",
410
440
  ref: "roller",
441
+ class: "nut-picker-roller",
411
442
  style: normalizeStyle(_ctx.threeDimensional ? _ctx.touchRollerStyle : _ctx.touchTileStyle),
412
443
  onTransitionend: _cache[0] || (_cache[0] = (...args) => _ctx.stopMomentum && _ctx.stopMomentum(...args))
413
444
  }, [
414
445
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.column, (item, index) => {
446
+ var _a;
415
447
  return openBlock(), createElementBlock(Fragment, {
416
- key: item.value ? item.value : index
448
+ key: (_a = item[_ctx.fieldNames.value]) != null ? _a : index
417
449
  }, [
418
- item && item.text && _ctx.threeDimensional ? (openBlock(), createElementBlock("view", {
450
+ item && item[_ctx.fieldNames.text] && _ctx.threeDimensional ? (openBlock(), createElementBlock("view", {
419
451
  key: 0,
420
452
  class: normalizeClass(["nut-picker-roller-item", { "nut-picker-roller-item-hidden": _ctx.isHidden(index + 1) }]),
421
453
  style: normalizeStyle(_ctx.setRollerStyle(index + 1))
422
- }, toDisplayString(item.text), 7)) : createCommentVNode("", true),
423
- item && item.text && !_ctx.threeDimensional ? (openBlock(), createElementBlock("view", {
454
+ }, toDisplayString(item[_ctx.fieldNames.text]), 7)) : createCommentVNode("", true),
455
+ item && item[_ctx.fieldNames.text] && !_ctx.threeDimensional ? (openBlock(), createElementBlock("view", {
424
456
  key: 1,
425
457
  class: "nut-picker-roller-item-tile",
426
458
  style: normalizeStyle({ height: _ctx.pxCheck(_ctx.optionHeight), lineHeight: _ctx.pxCheck(_ctx.optionHeight) })
427
- }, toDisplayString(item.text), 5)) : createCommentVNode("", true)
459
+ }, toDisplayString(item[_ctx.fieldNames.text]), 5)) : createCommentVNode("", true)
428
460
  ], 64);
429
461
  }), 128))
430
462
  ], 36),
@@ -460,7 +492,7 @@ const baseProps = {
460
492
  },
461
493
  threeDimensional: {
462
494
  type: Boolean,
463
- default: true
495
+ default: false
464
496
  },
465
497
  swipeDuration: {
466
498
  type: [Number, String],
@@ -477,6 +509,10 @@ const baseProps = {
477
509
  optionHeight: {
478
510
  type: [Number, String],
479
511
  default: 36
512
+ },
513
+ fieldNames: {
514
+ type: Object,
515
+ default: () => ({})
480
516
  }
481
517
  };
482
518
  const { create, translate } = createComponent("picker");
@@ -487,7 +523,10 @@ const _sfc_main = create({
487
523
  props: baseProps,
488
524
  emits: ["cancel", "change", "confirm", "update:modelValue"],
489
525
  setup(props, { emit }) {
490
- const { changeHandler, confirm, defaultValues, columnsList, columnsType, classes, cancel } = usePicker(props, emit);
526
+ const { changeHandler, confirm, defaultValues, columnsList, columnsType, columnFieldNames, cancel } = usePicker(
527
+ props,
528
+ emit
529
+ );
491
530
  const pickerColumn = ref([]);
492
531
  const swipeRef = (el) => {
493
532
  if (el && pickerColumn.value.length < columnsList.value.length) {
@@ -507,10 +546,10 @@ const _sfc_main = create({
507
546
  confirm();
508
547
  };
509
548
  return {
510
- classes,
511
549
  column,
512
550
  columnsType,
513
551
  columnsList,
552
+ columnFieldNames,
514
553
  cancel,
515
554
  changeHandler,
516
555
  confirmHandler,
@@ -522,25 +561,24 @@ const _sfc_main = create({
522
561
  };
523
562
  }
524
563
  });
525
- const _hoisted_1 = {
564
+ const _hoisted_1 = { class: "nut-picker" };
565
+ const _hoisted_2 = {
526
566
  key: 0,
527
567
  class: "nut-picker__bar"
528
568
  };
529
- const _hoisted_2 = { class: "nut-picker__title" };
569
+ const _hoisted_3 = { class: "nut-picker__title" };
530
570
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
531
571
  const _component_nut_picker_column = resolveComponent("nut-picker-column");
532
- return openBlock(), createElementBlock("div", {
533
- class: normalizeClass(_ctx.classes)
534
- }, [
535
- _ctx.showToolbar ? (openBlock(), createElementBlock("view", _hoisted_1, [
572
+ return openBlock(), createElementBlock("div", _hoisted_1, [
573
+ _ctx.showToolbar ? (openBlock(), createElementBlock("view", _hoisted_2, [
536
574
  createElementVNode("view", {
537
575
  class: "nut-picker__left",
538
576
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.cancel && _ctx.cancel(...args))
539
577
  }, toDisplayString(_ctx.cancelText || _ctx.translate("cancel")), 1),
540
- createElementVNode("view", _hoisted_2, toDisplayString(_ctx.title), 1),
578
+ createElementVNode("view", _hoisted_3, toDisplayString(_ctx.title), 1),
541
579
  createElementVNode("view", {
542
580
  class: "nut-picker__right",
543
- onClick: _cache[1] || (_cache[1] = ($event) => _ctx.confirmHandler())
581
+ onClick: _cache[1] || (_cache[1] = (...args) => _ctx.confirmHandler && _ctx.confirmHandler(...args))
544
582
  }, toDisplayString(_ctx.okText || _ctx.translate("confirm")), 1)
545
583
  ])) : createCommentVNode("", true),
546
584
  renderSlot(_ctx.$slots, "top"),
@@ -550,28 +588,29 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
550
588
  }, [
551
589
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columnsList, (column2, columnIndex) => {
552
590
  return openBlock(), createElementBlock("view", {
553
- class: "nut-picker__columnitem",
554
- key: columnIndex
591
+ key: columnIndex,
592
+ class: "nut-picker__columnitem"
555
593
  }, [
556
594
  createVNode(_component_nut_picker_column, {
557
595
  ref_for: true,
558
596
  ref: _ctx.swipeRef,
559
597
  column: column2,
560
- columnsType: _ctx.columnsType,
598
+ "columns-type": _ctx.columnsType,
599
+ "field-names": _ctx.columnFieldNames,
561
600
  value: _ctx.defaultValues && _ctx.defaultValues[columnIndex],
562
- threeDimensional: _ctx.threeDimensional,
563
- swipeDuration: _ctx.swipeDuration,
564
- visibleOptionNum: _ctx.visibleOptionNum,
565
- optionHeight: _ctx.optionHeight,
601
+ "three-dimensional": _ctx.threeDimensional,
602
+ "swipe-duration": _ctx.swipeDuration,
603
+ "visible-option-num": _ctx.visibleOptionNum,
604
+ "option-height": _ctx.optionHeight,
566
605
  onChange: (option) => {
567
606
  _ctx.changeHandler(columnIndex, option);
568
607
  }
569
- }, null, 8, ["column", "columnsType", "value", "threeDimensional", "swipeDuration", "visibleOptionNum", "optionHeight", "onChange"])
608
+ }, null, 8, ["column", "columns-type", "field-names", "value", "three-dimensional", "swipe-duration", "visible-option-num", "option-height", "onChange"])
570
609
  ]);
571
610
  }), 128))
572
611
  ], 4),
573
612
  renderSlot(_ctx.$slots, "default")
574
- ], 2);
613
+ ]);
575
614
  }
576
615
  const Picker = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
577
616
  export {
@@ -2,7 +2,7 @@ import { ref, computed, onMounted, watch, resolveComponent, openBlock, createEle
2
2
  import { i as isArray, c as createComponent } from "./component-0fbad28e.js";
3
3
  import { r as renderIcon } from "./renderIcon-3d0fd47c.js";
4
4
  import { u as useRect } from "./index-29892cda.js";
5
- import { P as Popup } from "./index-7fe29a2f.js";
5
+ import { P as Popup } from "./index-3032df15.js";
6
6
  import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
7
7
  import "../locale/lang";
8
8
  import "@nutui/icons-vue";
@@ -223,9 +223,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
223
223
  return openBlock(), createElementBlock(Fragment, null, [
224
224
  !_ctx.targetId ? (openBlock(), createElementBlock("div", {
225
225
  key: 0,
226
+ ref: "popoverRef",
226
227
  class: "nut-popover-wrapper",
227
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.openPopover && _ctx.openPopover(...args)),
228
- ref: "popoverRef"
228
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.openPopover && _ctx.openPopover(...args))
229
229
  }, [
230
230
  renderSlot(_ctx.$slots, "reference")
231
231
  ], 512)) : createCommentVNode("", true),
@@ -234,10 +234,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
234
234
  style: normalizeStyle(_ctx.getRootPosition)
235
235
  }, [
236
236
  createVNode(_component_nut_popup, {
237
- popClass: `nut-popover-content nut-popover-content--${_ctx.location}`,
238
- style: normalizeStyle(_ctx.customStyle),
239
237
  visible: _ctx.showPopup,
240
238
  "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => _ctx.showPopup = $event),
239
+ popClass: `nut-popover-content nut-popover-content--${_ctx.location}`,
240
+ style: normalizeStyle(_ctx.customStyle),
241
241
  position: "",
242
242
  transition: "nut-popover",
243
243
  overlay: _ctx.overlay,
@@ -270,7 +270,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
270
270
  ], 512)
271
271
  ]),
272
272
  _: 3
273
- }, 8, ["popClass", "style", "visible", "overlay", "duration", "overlayStyle", "overlayClass", "closeOnClickOverlay"])
273
+ }, 8, ["visible", "popClass", "style", "overlay", "duration", "overlayStyle", "overlayClass", "closeOnClickOverlay"])
274
274
  ], 6)
275
275
  ], 64);
276
276
  }
@@ -1,4 +1,4 @@
1
- import { P } from "./index-7fe29a2f.js";
1
+ import { P } from "./index-3032df15.js";
2
2
  import "vue";
3
3
  import "./_plugin-vue_export-helper-cc2b3d55.js";
4
4
  import "@nutui/icons-vue";
@@ -199,8 +199,8 @@ const _hoisted_1 = { class: "nut-pull-refresh-container-topbox-text" };
199
199
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
200
200
  const _component_Loading = resolveComponent("Loading");
201
201
  return openBlock(), createElementBlock("div", {
202
- class: normalizeClass(_ctx.classes),
203
202
  ref: "scroller",
203
+ class: normalizeClass(_ctx.classes),
204
204
  onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.touchStart && _ctx.touchStart(...args)),
205
205
  onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.touchMove && _ctx.touchMove(...args)),
206
206
  onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.touchEnd && _ctx.touchEnd(...args))
@@ -67,7 +67,7 @@ const _sfc_main = create({
67
67
  default: 0
68
68
  }
69
69
  },
70
- emits: ["change", "drag-end", "drag-start", "update:modelValue"],
70
+ emits: ["change", "dragEnd", "dragStart", "update:modelValue"],
71
71
  setup(props, { emit }) {
72
72
  const buttonIndex = ref(0);
73
73
  let startValue;
@@ -78,7 +78,7 @@ const _sfc_main = create({
78
78
  const marksList = computed(() => {
79
79
  const { marks, max, min } = props;
80
80
  const marksKeys = Object.keys(marks);
81
- const list = marksKeys.map(parseFloat).sort((a, b) => a - b).filter((point) => point >= min && point <= max);
81
+ const list = marksKeys.map(parseFloat).sort((a, b) => a - b).filter((point) => point >= +min && point <= +max);
82
82
  return list;
83
83
  });
84
84
  const scope = computed(() => Number(props.max) - Number(props.min));
@@ -152,7 +152,7 @@ const _sfc_main = create({
152
152
  } else {
153
153
  upperBound = modelValue;
154
154
  }
155
- let isActive = mark <= upperBound && mark >= lowerBound;
155
+ let isActive = mark <= +upperBound && mark >= lowerBound;
156
156
  return {
157
157
  [`${classPrefix}-text`]: true,
158
158
  [`${classPrefix}-text-active`]: isActive
@@ -253,7 +253,7 @@ const _sfc_main = create({
253
253
  return;
254
254
  }
255
255
  if (dragStatus.value === "start") {
256
- emit("drag-start");
256
+ emit("dragStart");
257
257
  }
258
258
  touch.move(event);
259
259
  dragStatus.value = "draging";
@@ -281,7 +281,7 @@ const _sfc_main = create({
281
281
  }
282
282
  if (dragStatus.value === "draging") {
283
283
  updateValue(currentValue, true);
284
- emit("drag-end");
284
+ emit("dragEnd");
285
285
  }
286
286
  dragStatus.value = "";
287
287
  };
@@ -26,7 +26,6 @@ const _sfc_main = create({
26
26
  default: "nowrap"
27
27
  }
28
28
  },
29
- emits: [],
30
29
  setup(props) {
31
30
  const prefixCls = componentName;
32
31
  provide("gutter", props.gutter);
@@ -94,9 +94,9 @@ const _sfc_main = create({
94
94
  "focus",
95
95
  "clear",
96
96
  "search",
97
- "click-input",
98
- "click-left-icon",
99
- "click-right-icon"
97
+ "clickInput",
98
+ "clickLeftIcon",
99
+ "clickRightIcon"
100
100
  ],
101
101
  setup(props, { emit }) {
102
102
  const state = reactive({
@@ -150,13 +150,13 @@ const _sfc_main = create({
150
150
  emit("search", props.modelValue);
151
151
  };
152
152
  const clickInput = (event) => {
153
- emit("click-input", event);
153
+ emit("clickInput", event);
154
154
  };
155
155
  const leftIconClick = (event) => {
156
- emit("click-left-icon", props.modelValue, event);
156
+ emit("clickLeftIcon", props.modelValue, event);
157
157
  };
158
158
  const rightIconClick = (event) => {
159
- emit("click-right-icon", props.modelValue, event);
159
+ emit("clickRightIcon", props.modelValue, event);
160
160
  };
161
161
  const styleSearchbar = computed(() => {
162
162
  const style = {
@@ -244,11 +244,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
244
244
  value: _ctx.modelValue,
245
245
  disabled: _ctx.disabled,
246
246
  readonly: _ctx.readonly,
247
+ style: normalizeStyle(_ctx.styleSearchbar),
247
248
  onClick: _cache[1] || (_cache[1] = (...args) => _ctx.clickInput && _ctx.clickInput(...args)),
248
249
  onInput: _cache[2] || (_cache[2] = (...args) => _ctx.valueChange && _ctx.valueChange(...args)),
249
250
  onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.valueFocus && _ctx.valueFocus(...args)),
250
- onBlur: _cache[4] || (_cache[4] = (...args) => _ctx.valueBlur && _ctx.valueBlur(...args)),
251
- style: normalizeStyle(_ctx.styleSearchbar)
251
+ onBlur: _cache[4] || (_cache[4] = (...args) => _ctx.valueBlur && _ctx.valueBlur(...args))
252
252
  }, null, 46, _hoisted_3)
253
253
  ], 32)
254
254
  ], 2),
@@ -257,8 +257,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
257
257
  }, [
258
258
  _ctx.clearable ? withDirectives((openBlock(), createElementBlock("view", {
259
259
  key: 0,
260
- onClick: _cache[6] || (_cache[6] = (...args) => _ctx.handleClear && _ctx.handleClear(...args)),
261
- class: "nut-searchbar__search-icon nut-searchbar__input-clear"
260
+ class: "nut-searchbar__search-icon nut-searchbar__input-clear",
261
+ onClick: _cache[6] || (_cache[6] = (...args) => _ctx.handleClear && _ctx.handleClear(...args))
262
262
  }, [
263
263
  _ctx.$slots["clear-icon"] ? renderSlot(_ctx.$slots, "clear-icon", { key: 0 }) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.renderIcon(_ctx.clearIcon)), { key: 1 }))
264
264
  ], 512)), [