@nutui/nutui 4.0.9 → 4.0.10

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 (168) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/nutui.es.js +1 -1
  3. package/dist/nutui.js +15382 -0
  4. package/dist/nutui.umd.js +1 -7
  5. package/dist/packages/_es/ActionSheet.js +78 -111
  6. package/dist/packages/_es/Address.js +250 -375
  7. package/dist/packages/_es/AddressList.js +269 -354
  8. package/dist/packages/_es/Animate.js +41 -58
  9. package/dist/packages/_es/Audio.js +128 -197
  10. package/dist/packages/_es/AudioOperate.js +60 -71
  11. package/dist/packages/_es/Avatar.js +66 -89
  12. package/dist/packages/_es/AvatarGroup.js +23 -31
  13. package/dist/packages/_es/Backtop.js +59 -99
  14. package/dist/packages/_es/Badge.js +36 -47
  15. package/dist/packages/_es/Barrage.js +68 -147
  16. package/dist/packages/_es/Button.js +47 -66
  17. package/dist/packages/_es/Calendar.js +135 -157
  18. package/dist/packages/_es/CalendarItem.js +6 -6
  19. package/dist/packages/_es/Card.js +42 -56
  20. package/dist/packages/_es/Cascader.js +315 -474
  21. package/dist/packages/_es/Category.js +29 -39
  22. package/dist/packages/_es/CategoryPane.js +57 -83
  23. package/dist/packages/_es/Cell.js +56 -71
  24. package/dist/packages/_es/CellGroup.js +19 -27
  25. package/dist/packages/_es/Checkbox.js +109 -156
  26. package/dist/packages/_es/CheckboxGroup.js +38 -59
  27. package/dist/packages/_es/CircleProgress.js +67 -96
  28. package/dist/packages/_es/Col.js +23 -31
  29. package/dist/packages/_es/Collapse.js +33 -58
  30. package/dist/packages/_es/CollapseItem.js +78 -108
  31. package/dist/packages/_es/Comment.js +207 -279
  32. package/dist/packages/_es/ConfigProvider.js +37 -55
  33. package/dist/packages/_es/Countdown.js +100 -212
  34. package/dist/packages/_es/Countup.js +232 -445
  35. package/dist/packages/_es/DatePicker.js +162 -265
  36. package/dist/packages/_es/Dialog.js +161 -213
  37. package/dist/packages/_es/Divider.js +42 -57
  38. package/dist/packages/_es/Drag.js +70 -153
  39. package/dist/packages/_es/Ecard.js +64 -104
  40. package/dist/packages/_es/Elevator.js +143 -219
  41. package/dist/packages/_es/Ellipsis.js +95 -178
  42. package/dist/packages/_es/Empty.js +23 -39
  43. package/dist/packages/_es/FixedNav.js +93 -116
  44. package/dist/packages/_es/Form.js +107 -178
  45. package/dist/packages/_es/FormItem.js +48 -61
  46. package/dist/packages/_es/Grid.js +5 -6
  47. package/dist/packages/_es/GridItem.js +58 -84
  48. package/dist/packages/_es/Image.js +90 -129
  49. package/dist/packages/_es/ImagePreview.js +256 -412
  50. package/dist/packages/_es/Indicator.js +30 -34
  51. package/dist/packages/_es/InfiniteLoading.js +83 -136
  52. package/dist/packages/_es/Input.js +160 -264
  53. package/dist/packages/_es/InputNumber.js +81 -117
  54. package/dist/packages/_es/Interceptor-6e26b757.js +18 -0
  55. package/dist/packages/_es/Invoice.js +104 -130
  56. package/dist/packages/_es/Layout.js +3 -4
  57. package/dist/packages/_es/List.js +117 -215
  58. package/dist/packages/_es/Menu.js +96 -152
  59. package/dist/packages/_es/MenuItem.js +117 -172
  60. package/dist/packages/_es/Navbar.js +103 -119
  61. package/dist/packages/_es/Noticebar.js +197 -312
  62. package/dist/packages/_es/Notify.js +110 -166
  63. package/dist/packages/_es/NumberKeyboard.js +127 -202
  64. package/dist/packages/_es/Overlay.js +52 -80
  65. package/dist/packages/_es/Pagination.js +70 -100
  66. package/dist/packages/_es/Picker.js +275 -441
  67. package/dist/packages/_es/Popover.js +122 -225
  68. package/dist/packages/_es/Popup.js +4 -4
  69. package/dist/packages/_es/Price.js +44 -82
  70. package/dist/packages/_es/Progress.js +63 -79
  71. package/dist/packages/_es/PullRefresh.js +95 -173
  72. package/dist/packages/_es/Radio.js +4 -4
  73. package/dist/packages/_es/RadioGroup.js +3 -3
  74. package/dist/packages/_es/Range.js +204 -347
  75. package/dist/packages/_es/Rate.js +92 -141
  76. package/dist/packages/_es/Row.js +21 -27
  77. package/dist/packages/_es/Searchbar.js +130 -179
  78. package/dist/packages/_es/ShortPassword.js +69 -93
  79. package/dist/packages/_es/SideNavbar.js +49 -80
  80. package/dist/packages/_es/SideNavbarItem.js +22 -32
  81. package/dist/packages/_es/Signature.js +83 -146
  82. package/dist/packages/_es/Skeleton.js +110 -130
  83. package/dist/packages/_es/Sku.js +250 -343
  84. package/dist/packages/_es/Step.js +59 -86
  85. package/dist/packages/_es/Steps.js +26 -31
  86. package/dist/packages/_es/Sticky.js +4 -4
  87. package/dist/packages/_es/SubSideNavbar.js +52 -74
  88. package/dist/packages/_es/Swipe.js +83 -155
  89. package/dist/packages/_es/Swiper.js +174 -311
  90. package/dist/packages/_es/SwiperItem.js +28 -44
  91. package/dist/packages/_es/Switch.js +55 -68
  92. package/dist/packages/_es/TabPane.js +30 -41
  93. package/dist/packages/_es/Tabbar.js +41 -52
  94. package/dist/packages/_es/TabbarItem.js +61 -82
  95. package/dist/packages/_es/Table.js +109 -165
  96. package/dist/packages/_es/Tabs.js +240 -388
  97. package/dist/packages/_es/Tag.js +44 -61
  98. package/dist/packages/_es/Textarea.js +80 -124
  99. package/dist/packages/_es/TimeDetail.js +49 -76
  100. package/dist/packages/_es/TimePannel.js +34 -48
  101. package/dist/packages/_es/TimeSelect.js +47 -68
  102. package/dist/packages/_es/Toast.js +144 -218
  103. package/dist/packages/_es/Tour.js +138 -192
  104. package/dist/packages/_es/TrendArrow.js +57 -77
  105. package/dist/packages/_es/Uploader.js +234 -359
  106. package/dist/packages/_es/Video.js +191 -316
  107. package/dist/packages/_es/Watermark.js +84 -117
  108. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +9 -0
  109. package/dist/packages/_es/common-d218746f.js +116 -0
  110. package/dist/packages/_es/component-234624bc.js +89 -0
  111. package/dist/packages/_es/index-14dfadc4.js +561 -0
  112. package/dist/packages/_es/index-192a3ef6.js +29 -0
  113. package/dist/packages/_es/index-360c5092.js +210 -0
  114. package/dist/packages/_es/index-496e6e05.js +24 -0
  115. package/dist/packages/_es/index-50eed3d9.js +7 -0
  116. package/dist/packages/_es/index-53ec2d4d.js +34 -0
  117. package/dist/packages/_es/index-fadb0974.js +8 -0
  118. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +43 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +77 -0
  120. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +110 -0
  121. package/dist/packages/_es/mountComponent-6d4ff200.js +23 -0
  122. package/dist/packages/_es/pxCheck-38173291.js +4 -0
  123. package/dist/packages/_es/raf-a74f1a06.js +16 -0
  124. package/dist/packages/_es/renderIcon-47498b32.js +5 -0
  125. package/dist/packages/col/index.scss +2 -2
  126. package/dist/packages/menuitem/index.scss +7 -10
  127. package/dist/packages/searchbar/index.scss +4 -0
  128. package/dist/smartips/web-types.json +2 -2
  129. package/dist/style.css +1 -1
  130. package/dist/styles/themes/default.scss +158 -55
  131. package/dist/styles/themes/jdb.scss +158 -55
  132. package/dist/styles/themes/jddkh.scss +158 -55
  133. package/dist/styles/themes/jdt.scss +158 -55
  134. package/dist/types/__VUE/address/index.vue.d.ts +1 -1
  135. package/dist/types/__VUE/collapseitem/index.vue.d.ts +110 -3
  136. package/dist/types/__VUE/image/index.vue.d.ts +2 -2
  137. package/dist/types/__VUE/menu/index.vue.d.ts +0 -2
  138. package/dist/types/__VUE/menuitem/index.vue.d.ts +9 -17
  139. package/dist/types/__VUE/navbar/index.vue.d.ts +1 -1
  140. package/dist/types/__VUE/picker/usePicker.d.ts +1 -1
  141. package/dist/types/__VUE/rate/index.vue.d.ts +110 -3
  142. package/dist/types/__VUE/row/index.vue.d.ts +1 -1
  143. package/dist/types/__VUE/searchbar/index.vue.d.ts +121 -5
  144. package/dist/types/__VUE/skeleton/index.vue.d.ts +2 -2
  145. package/dist/types/__VUE/swiper/index.vue.d.ts +1 -1
  146. package/dist/types/__VUE/table/common.d.ts +55 -2
  147. package/dist/types/__VUE/timeselect/index.vue.d.ts +1 -1
  148. package/dist/types/__VUE/watermark/index.vue.d.ts +1 -1
  149. package/dist/types/index.d.ts +1 -1
  150. package/package.json +2 -2
  151. package/dist/packages/_es/Interceptor-956b24fc.js +0 -29
  152. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +0 -10
  153. package/dist/packages/_es/common-b9a5e726.js +0 -145
  154. package/dist/packages/_es/component-81a4c1d0.js +0 -145
  155. package/dist/packages/_es/index-29892cda.js +0 -33
  156. package/dist/packages/_es/index-43c34ac6.js +0 -30
  157. package/dist/packages/_es/index-54d03fc1.js +0 -8
  158. package/dist/packages/_es/index-79c5dc33.js +0 -10
  159. package/dist/packages/_es/index-7a7385e4.js +0 -67
  160. package/dist/packages/_es/index-87422be8.js +0 -942
  161. package/dist/packages/_es/index-da0a7662.js +0 -259
  162. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +0 -46
  163. package/dist/packages/_es/index.vue_vue_type_script_lang-442e4704.js +0 -98
  164. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +0 -151
  165. package/dist/packages/_es/mountComponent-8b24c346.js +0 -39
  166. package/dist/packages/_es/pxCheck-c6b9f6b7.js +0 -6
  167. package/dist/packages/_es/raf-729dad54.js +0 -25
  168. package/dist/packages/_es/renderIcon-3d0fd47c.js +0 -9
@@ -1,182 +1,120 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
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";
21
- import { c as createComponent, d as preventDefault, e as clamp } from "./component-81a4c1d0.js";
22
- import { p as pxCheck } from "./pxCheck-c6b9f6b7.js";
23
- import { u as useTouch } from "./index-7a7385e4.js";
24
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
1
+ var le = Object.defineProperty, oe = Object.defineProperties;
2
+ var ae = Object.getOwnPropertyDescriptors;
3
+ var Q = Object.getOwnPropertySymbols;
4
+ var re = Object.prototype.hasOwnProperty, se = Object.prototype.propertyIsEnumerable;
5
+ var W = (e, n, a) => n in e ? le(e, n, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[n] = a, B = (e, n) => {
6
+ for (var a in n || (n = {}))
7
+ re.call(n, a) && W(e, a, n[a]);
8
+ if (Q)
9
+ for (var a of Q(n))
10
+ se.call(n, a) && W(e, a, n[a]);
11
+ return e;
12
+ }, L = (e, n) => oe(e, ae(n));
13
+ import { reactive as x, ref as $, computed as b, watch as E, toRefs as J, onMounted as ue, openBlock as S, createElementBlock as D, createElementVNode as N, normalizeStyle as I, Fragment as U, renderList as _, normalizeClass as ee, toDisplayString as R, createCommentVNode as j, resolveComponent as ie, renderSlot as X, createVNode as ce } from "vue";
14
+ import { c as q, d as Z, e as me } from "./component-234624bc.js";
15
+ import { p as de } from "./pxCheck-38173291.js";
16
+ import { u as he } from "./index-53ec2d4d.js";
17
+ import { _ as te } from "./_plugin-vue_export-helper-dad06003.js";
25
18
  import "../locale/lang";
26
- const { componentName: componentName$1 } = createComponent("picker");
27
- const usePicker = (props, emit) => {
28
- const state = reactive({
29
- formattedColumns: props.columns
30
- });
31
- let defaultValues = ref([]);
32
- const pickerColumn = ref([]);
33
- const swipeRef = (el) => {
34
- if (el && pickerColumn.value.length < columnsList.value.length) {
35
- pickerColumn.value.push(el);
36
- }
37
- };
38
- const classes = computed(() => {
39
- const prefixCls = componentName$1;
40
- return {
41
- [prefixCls]: true
42
- };
43
- });
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]);
50
- });
51
- return optins;
52
- });
53
- const columnsType = computed(() => {
54
- const firstColumn = state.formattedColumns[0];
55
- if (firstColumn) {
56
- if (Array.isArray(firstColumn)) {
19
+ const { componentName: fe } = q("picker"), ve = (e, n) => {
20
+ const a = x({
21
+ formattedColumns: e.columns
22
+ }), t = $([]), y = $([]), p = (l) => {
23
+ l && y.value.length < d.value.length && y.value.push(l);
24
+ }, r = b(() => ({
25
+ [fe]: !0
26
+ })), s = b(() => d.value.map((l, c) => l.find((T) => T.value === t.value[c]))), g = b(() => {
27
+ const l = a.formattedColumns[0];
28
+ if (l) {
29
+ if (Array.isArray(l))
57
30
  return "multiple";
58
- }
59
- if ("children" in firstColumn) {
31
+ if ("children" in l)
60
32
  return "cascade";
61
- }
62
33
  }
63
34
  return "single";
64
- });
65
- const columnsList = computed(() => {
66
- switch (columnsType.value) {
35
+ }), d = b(() => {
36
+ switch (g.value) {
67
37
  case "multiple":
68
- return state.formattedColumns;
38
+ return a.formattedColumns;
69
39
  case "cascade":
70
- return formatCascade(state.formattedColumns, defaultValues.value ? defaultValues.value : []);
40
+ return H(a.formattedColumns, t.value ? t.value : []);
71
41
  default:
72
- return [state.formattedColumns];
42
+ return [a.formattedColumns];
73
43
  }
74
- });
75
- const formatCascade = (columns, defaultValues2) => {
76
- const formatted = [];
77
- let cursor = {
44
+ }), H = (l, c) => {
45
+ const T = [];
46
+ let u = {
78
47
  text: "",
79
48
  value: "",
80
- children: columns
81
- };
82
- let columnIndex = 0;
83
- while (cursor && cursor.children) {
84
- const options = cursor.children;
85
- const value = defaultValues2[columnIndex];
86
- let index = options.findIndex((columnItem) => columnItem.value == value);
87
- if (index == -1)
88
- index = 0;
89
- cursor = cursor.children[index];
90
- columnIndex++;
91
- formatted.push(options);
49
+ children: l
50
+ }, z = 0;
51
+ for (; u && u.children; ) {
52
+ const P = u.children, w = c[z];
53
+ let C = P.findIndex((O) => O.value === w);
54
+ C === -1 && (C = 0), u = u.children[C], z++, T.push(P);
92
55
  }
93
- return formatted;
94
- };
95
- const cancel = () => {
96
- emit("cancel", {
97
- selectedValue: defaultValues.value,
98
- selectedOptions: selectedOptions.value
56
+ return T;
57
+ }, M = () => {
58
+ n("cancel", {
59
+ selectedValue: t.value,
60
+ selectedOptions: s.value
99
61
  });
100
- };
101
- const changeHandler = (columnIndex, option) => {
102
- if (option && Object.keys(option).length) {
103
- defaultValues.value = defaultValues.value ? defaultValues.value : [];
104
- if (columnsType.value === "cascade") {
105
- defaultValues.value[columnIndex] = option.value ? option.value : "";
106
- let index = columnIndex;
107
- let cursor = option;
108
- while (cursor && cursor.children && cursor.children[0]) {
109
- defaultValues.value[index + 1] = cursor.children[0].value;
110
- index++;
111
- cursor = cursor.children[0];
112
- }
113
- if (cursor && cursor.children && cursor.children.length == 0) {
114
- defaultValues.value = defaultValues.value.slice(0, index + 1);
115
- }
116
- } else {
117
- defaultValues.value[columnIndex] = option.hasOwnProperty("value") ? option.value : "";
118
- }
119
- emit("change", {
120
- columnIndex,
121
- selectedValue: defaultValues.value,
122
- selectedOptions: selectedOptions.value
123
- });
124
- }
125
- };
126
- const confirm = () => {
127
- if (defaultValues.value && !defaultValues.value.length) {
128
- columnsList.value.forEach((columns) => {
129
- defaultValues.value.push(columns[0].value);
62
+ }, A = (l, c) => {
63
+ if (c && Object.keys(c).length) {
64
+ if (t.value = t.value ? t.value : [], g.value === "cascade") {
65
+ t.value[l] = c.value ? c.value : "";
66
+ let T = l, u = c;
67
+ for (; u && u.children && u.children[0]; )
68
+ t.value[T + 1] = u.children[0].value, T++, u = u.children[0];
69
+ u && u.children && u.children.length === 0 && (t.value = t.value.slice(0, T + 1));
70
+ } else
71
+ t.value[l] = c.hasOwnProperty("value") ? c.value : "";
72
+ n("change", {
73
+ columnIndex: l,
74
+ selectedValue: t.value,
75
+ selectedOptions: s.value
130
76
  });
131
77
  }
132
- emit("confirm", {
133
- selectedValue: defaultValues.value,
134
- selectedOptions: selectedOptions.value
78
+ }, f = () => {
79
+ t.value && !t.value.length && d.value.forEach((l) => {
80
+ t.value.push(l[0].value);
81
+ }), n("confirm", {
82
+ selectedValue: t.value,
83
+ selectedOptions: s.value
135
84
  });
136
- };
137
- const isSameValue = (valA, valB) => JSON.stringify(valA) === JSON.stringify(valB);
138
- watch(
139
- () => props.modelValue,
140
- (newValues) => {
141
- if (!isSameValue(newValues, defaultValues.value)) {
142
- defaultValues.value = newValues;
143
- }
85
+ }, Y = (l, c) => JSON.stringify(l) === JSON.stringify(c);
86
+ return E(
87
+ () => e.modelValue,
88
+ (l) => {
89
+ Y(l, t.value) || (t.value = l);
144
90
  },
145
- { deep: true, immediate: true }
146
- );
147
- watch(
148
- defaultValues,
149
- (newValues) => {
150
- if (!isSameValue(newValues, props.modelValue)) {
151
- emit("update:modelValue", newValues);
152
- }
91
+ { deep: !0, immediate: !0 }
92
+ ), E(
93
+ t,
94
+ (l) => {
95
+ Y(l, e.modelValue) || n("update:modelValue", l);
153
96
  },
154
- { deep: true }
155
- );
156
- watch(
157
- () => props.columns,
158
- (val) => {
159
- if (val.length)
160
- state.formattedColumns = val;
97
+ { deep: !0 }
98
+ ), E(
99
+ () => e.columns,
100
+ (l) => {
101
+ l.length && (a.formattedColumns = l);
161
102
  }
162
- );
163
- return __spreadProps(__spreadValues({
164
- classes
165
- }, toRefs(state)), {
166
- columnsType,
167
- columnsList,
168
- cancel,
169
- changeHandler,
170
- confirm,
171
- defaultValues,
172
- pickerColumn,
173
- swipeRef,
174
- selectedOptions,
175
- isSameValue
103
+ ), L(B({
104
+ classes: r
105
+ }, J(a)), {
106
+ columnsType: g,
107
+ columnsList: d,
108
+ cancel: M,
109
+ changeHandler: A,
110
+ confirm: f,
111
+ defaultValues: t,
112
+ pickerColumn: y,
113
+ swipeRef: p,
114
+ selectedOptions: s,
115
+ isSameValue: Y
176
116
  });
177
- };
178
- const { create: create$1 } = createComponent("picker-column");
179
- const _sfc_main$1 = create$1({
117
+ }, { create: pe } = q("picker-column"), ge = pe({
180
118
  props: {
181
119
  // 当前选中项
182
120
  value: [String, Number],
@@ -188,7 +126,7 @@ const _sfc_main$1 = create$1({
188
126
  // 是否开启3D效果
189
127
  threeDimensional: {
190
128
  type: Boolean,
191
- default: true
129
+ default: !0
192
130
  },
193
131
  swipeDuration: {
194
132
  type: [Number, String],
@@ -204,9 +142,8 @@ const _sfc_main$1 = create$1({
204
142
  }
205
143
  },
206
144
  emits: ["click", "change"],
207
- setup(props, { emit }) {
208
- const touch = useTouch();
209
- const state = reactive({
145
+ setup(e, { emit: n }) {
146
+ const a = he(), t = x({
210
147
  touchParams: {
211
148
  startY: 0,
212
149
  endY: 0,
@@ -219,227 +156,141 @@ const _sfc_main$1 = create$1({
219
156
  transformY: 0,
220
157
  scrollDistance: 0,
221
158
  rotation: 20
222
- });
223
- const roller = ref(null);
224
- const moving = ref(false);
225
- const touchDeg = ref(0);
226
- const touchTime = ref(0);
227
- const DEFAULT_DURATION = 200;
228
- const INERTIA_TIME = 300;
229
- const INERTIA_DISTANCE = 15;
230
- const touchRollerStyle = computed(() => {
231
- return {
232
- transition: `transform ${touchTime.value}ms cubic-bezier(0.17, 0.89, 0.45, 1)`,
233
- transform: `rotate3d(1, 0, 0, ${touchDeg.value})`,
234
- top: `calc(50% - ${+props.optionHeight / 2}px)`
235
- };
236
- });
237
- const touchTileStyle = computed(() => {
238
- const { optionHeight } = props;
239
- return {
240
- transition: `transform ${touchTime.value}ms cubic-bezier(0.17, 0.89, 0.45, 1)`,
241
- transform: `translate3d(0, ${state.scrollDistance}px, 0)`,
242
- top: `calc(50% - ${+optionHeight / 2}px)`,
243
- height: `${optionHeight}px`
244
- };
245
- });
246
- const setRollerStyle = (index) => {
247
- return `transform: rotate3d(1, 0, 0, ${-state.rotation * index}deg) translate3d(0px, 0px, 104px)`;
248
- };
249
- const maskStyles = computed(() => {
159
+ }), y = $(null), p = $(!1), r = $(0), s = $(0), g = 200, d = 300, H = 15, M = b(() => ({
160
+ transition: `transform ${s.value}ms cubic-bezier(0.17, 0.89, 0.45, 1)`,
161
+ transform: `rotate3d(1, 0, 0, ${r.value})`,
162
+ top: `calc(50% - ${+e.optionHeight / 2}px)`
163
+ })), A = b(() => {
164
+ const { optionHeight: o } = e;
250
165
  return {
251
- backgroundSize: `100% ${(+props.visibleOptionNum - 1) * +props.optionHeight / 2}px`
166
+ transition: `transform ${s.value}ms cubic-bezier(0.17, 0.89, 0.45, 1)`,
167
+ transform: `translate3d(0, ${t.scrollDistance}px, 0)`,
168
+ top: `calc(50% - ${+o / 2}px)`,
169
+ height: `${o}px`
252
170
  };
253
- });
254
- const onTouchStart = (event) => {
255
- touch.start(event);
256
- if (moving.value) {
257
- let dom = roller.value;
258
- const { transform } = window.getComputedStyle(dom);
259
- if (props.threeDimensional) {
260
- const circle = Math.floor(parseInt(touchDeg.value) / 360);
261
- const cos = +transform.split(", ")[5];
262
- const sin = +transform.split(", ")[6] < 0 ? 180 : 0;
263
- const endDeg = circle * 360 + Math.acos(cos) / Math.PI * 180 + sin;
264
- state.scrollDistance = -Math.abs((endDeg / state.rotation - 1) * +props.optionHeight);
265
- } else {
266
- state.scrollDistance = +transform.slice(7, transform.length - 1).split(", ")[5];
267
- }
268
- }
269
- preventDefault(event, true);
270
- state.touchParams.startY = touch.deltaY.value;
271
- state.touchParams.startTime = Date.now();
272
- state.transformY = state.scrollDistance;
273
- };
274
- const onTouchMove = (event) => {
275
- touch.move(event);
276
- if (touch.isVertical()) {
277
- moving.value = true;
278
- preventDefault(event, true);
171
+ }), f = (o) => `transform: rotate3d(1, 0, 0, ${-t.rotation * o}deg) translate3d(0px, 0px, 104px)`, Y = b(() => ({
172
+ backgroundSize: `100% ${(+e.visibleOptionNum - 1) * +e.optionHeight / 2}px`
173
+ })), l = (o) => {
174
+ if (a.start(o), p.value) {
175
+ let m = y.value;
176
+ const { transform: i } = window.getComputedStyle(m);
177
+ if (e.threeDimensional) {
178
+ const h = Math.floor(parseInt(r.value) / 360), v = +i.split(", ")[5], k = +i.split(", ")[6] < 0 ? 180 : 0, V = h * 360 + Math.acos(v) / Math.PI * 180 + k;
179
+ t.scrollDistance = -Math.abs((V / t.rotation - 1) * +e.optionHeight);
180
+ } else
181
+ t.scrollDistance = +i.slice(7, i.length - 1).split(", ")[5];
279
182
  }
280
- state.touchParams.lastY = touch.deltaY.value;
281
- let move = state.touchParams.lastY - state.touchParams.startY;
282
- setMove(move);
283
- };
284
- const onTouchEnd = () => {
285
- state.touchParams.lastY = touch.deltaY.value;
286
- state.touchParams.lastTime = Date.now();
287
- let move = state.touchParams.lastY - state.touchParams.startY;
288
- let moveTime = state.touchParams.lastTime - state.touchParams.startTime;
289
- if (moveTime <= INERTIA_TIME && Math.abs(move) > INERTIA_DISTANCE) {
290
- const distance = momentum(move, moveTime);
291
- setMove(distance, "end", +props.swipeDuration);
183
+ Z(o, !0), t.touchParams.startY = a.deltaY.value, t.touchParams.startTime = Date.now(), t.transformY = t.scrollDistance;
184
+ }, c = (o) => {
185
+ a.move(o), a.isVertical() && (p.value = !0, Z(o, !0)), t.touchParams.lastY = a.deltaY.value;
186
+ let m = t.touchParams.lastY - t.touchParams.startY;
187
+ w(m);
188
+ }, T = () => {
189
+ t.touchParams.lastY = a.deltaY.value, t.touchParams.lastTime = Date.now();
190
+ let o = t.touchParams.lastY - t.touchParams.startY, m = t.touchParams.lastTime - t.touchParams.startTime;
191
+ if (m <= d && Math.abs(o) > H) {
192
+ const i = u(o, m);
193
+ w(i, "end", +e.swipeDuration);
292
194
  return;
293
- } else {
294
- setMove(move, "end");
295
- }
195
+ } else
196
+ w(o, "end");
296
197
  setTimeout(() => {
297
- touch.reset();
298
- moving.value = false;
198
+ a.reset(), p.value = !1;
299
199
  }, 0);
300
- };
301
- const momentum = (distance, duration) => {
302
- const speed = Math.abs(distance / duration);
303
- distance = speed / 3e-3 * (distance < 0 ? -1 : 1);
304
- return distance;
305
- };
306
- const isHidden = (index) => {
307
- if (index >= state.currIndex + 8 || index <= state.currIndex - 8) {
308
- return true;
309
- } else {
310
- return false;
311
- }
312
- };
313
- const setTransform = (translateY = 0, type, time = DEFAULT_DURATION, deg) => {
314
- if (type === "end") {
315
- touchTime.value = time;
316
- } else {
317
- touchTime.value = 0;
318
- }
319
- touchDeg.value = deg;
320
- state.scrollDistance = translateY;
321
- };
322
- const setMove = (move, type, time) => {
323
- const { optionHeight } = props;
324
- let updateMove = move + state.transformY;
325
- if (type === "end") {
326
- if (updateMove > 0) {
327
- updateMove = 0;
328
- }
329
- if (updateMove < -(props.column.length - 1) * +optionHeight) {
330
- updateMove = -(props.column.length - 1) * +optionHeight;
331
- }
332
- let endMove = Math.round(updateMove / +optionHeight) * +optionHeight;
333
- let deg = `${(Math.abs(Math.round(endMove / +optionHeight)) + 1) * state.rotation}deg`;
334
- setTransform(endMove, type, time, deg);
335
- state.currIndex = Math.abs(Math.round(endMove / +optionHeight)) + 1;
200
+ }, u = (o, m) => (o = Math.abs(o / m) / 3e-3 * (o < 0 ? -1 : 1), o), z = (o) => o >= t.currIndex + 8 || o <= t.currIndex - 8, P = (o = 0, m, i = g, h) => {
201
+ m === "end" ? s.value = i : s.value = 0, r.value = h, t.scrollDistance = o;
202
+ }, w = (o, m, i) => {
203
+ const { optionHeight: h } = e;
204
+ let v = o + t.transformY;
205
+ if (m === "end") {
206
+ v > 0 && (v = 0), v < -(e.column.length - 1) * +h && (v = -(e.column.length - 1) * +h);
207
+ let k = Math.round(v / +h) * +h, V = `${(Math.abs(Math.round(k / +h)) + 1) * t.rotation}deg`;
208
+ P(k, m, i, V), t.currIndex = Math.abs(Math.round(k / +h)) + 1;
336
209
  } else {
337
- let deg = 0;
338
- let currentDeg = (-updateMove / +optionHeight + 1) * state.rotation;
339
- const maxDeg = (props.column.length + 1) * state.rotation;
340
- const minDeg = 0;
341
- deg = clamp(currentDeg, minDeg, maxDeg);
342
- if (minDeg < deg && deg < maxDeg) {
343
- setTransform(updateMove, null, void 0, deg + "deg");
344
- state.currIndex = Math.abs(Math.round(updateMove / +optionHeight)) + 1;
345
- }
210
+ let k = 0, V = (-v / +h + 1) * t.rotation;
211
+ const G = (e.column.length + 1) * t.rotation, K = 0;
212
+ k = me(V, K, G), K < k && k < G && (P(v, null, void 0, k + "deg"), t.currIndex = Math.abs(Math.round(v / +h)) + 1);
346
213
  }
214
+ }, C = () => {
215
+ n("change", e.column[t.currIndex - 1]);
216
+ }, O = (o) => {
217
+ const { column: m } = e;
218
+ let i = m.findIndex((v) => v.value === e.value);
219
+ t.currIndex = i === -1 ? 1 : i + 1;
220
+ let h = i === -1 ? 0 : i * +e.optionHeight;
221
+ o && C(), w(-h);
222
+ }, ne = () => {
223
+ p.value = !1, s.value = 0, C();
347
224
  };
348
- const setChooseValue = () => {
349
- emit("change", props.column[state.currIndex - 1]);
350
- };
351
- const modifyStatus = (type) => {
352
- const { column: column2 } = props;
353
- let index = column2.findIndex((columnItem) => columnItem.value == props.value);
354
- state.currIndex = index === -1 ? 1 : index + 1;
355
- let move = index === -1 ? 0 : index * +props.optionHeight;
356
- type && setChooseValue();
357
- setMove(-move);
358
- };
359
- const stopMomentum = () => {
360
- moving.value = false;
361
- touchTime.value = 0;
362
- setChooseValue();
363
- };
364
- watch(
365
- () => props.column,
366
- (val) => {
367
- if (props.column && props.column.length > 0) {
368
- state.transformY = 0;
369
- modifyStatus(false);
370
- }
225
+ return E(
226
+ () => e.column,
227
+ (o) => {
228
+ e.column && e.column.length > 0 && (t.transformY = 0, O(!1));
371
229
  },
372
230
  {
373
- deep: true
231
+ deep: !0
374
232
  }
375
- );
376
- watch(
377
- () => props.value,
378
- (val) => {
379
- state.transformY = 0;
380
- modifyStatus(false);
233
+ ), E(
234
+ () => e.value,
235
+ (o) => {
236
+ t.transformY = 0, O(!1);
381
237
  },
382
238
  {
383
- deep: true
239
+ deep: !0
384
240
  }
385
- );
386
- onMounted(() => {
387
- modifyStatus(true);
388
- });
389
- return __spreadProps(__spreadValues(__spreadValues({}, toRefs(state)), toRefs(props)), {
390
- setRollerStyle,
391
- isHidden,
392
- roller,
393
- onTouchStart,
394
- onTouchMove,
395
- onTouchEnd,
396
- touchRollerStyle,
397
- touchTileStyle,
398
- setMove,
399
- stopMomentum,
400
- pxCheck,
401
- maskStyles
241
+ ), ue(() => {
242
+ O(!0);
243
+ }), L(B(B({}, J(t)), J(e)), {
244
+ setRollerStyle: f,
245
+ isHidden: z,
246
+ roller: y,
247
+ onTouchStart: l,
248
+ onTouchMove: c,
249
+ onTouchEnd: T,
250
+ touchRollerStyle: M,
251
+ touchTileStyle: A,
252
+ setMove: w,
253
+ stopMomentum: ne,
254
+ pxCheck: de,
255
+ maskStyles: Y
402
256
  });
403
257
  }
404
258
  });
405
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
406
- return openBlock(), createElementBlock("view", {
259
+ function ye(e, n, a, t, y, p) {
260
+ return S(), D("view", {
407
261
  class: "nut-picker__list",
408
- onTouchstart: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
409
- onTouchmove: _cache[2] || (_cache[2] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
410
- onTouchend: _cache[3] || (_cache[3] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
262
+ onTouchstart: n[1] || (n[1] = (...r) => e.onTouchStart && e.onTouchStart(...r)),
263
+ onTouchmove: n[2] || (n[2] = (...r) => e.onTouchMove && e.onTouchMove(...r)),
264
+ onTouchend: n[3] || (n[3] = (...r) => e.onTouchEnd && e.onTouchEnd(...r))
411
265
  }, [
412
- createElementVNode("view", {
266
+ N("view", {
413
267
  class: "nut-picker-roller",
414
268
  ref: "roller",
415
- style: normalizeStyle(_ctx.threeDimensional ? _ctx.touchRollerStyle : _ctx.touchTileStyle),
416
- onTransitionend: _cache[0] || (_cache[0] = (...args) => _ctx.stopMomentum && _ctx.stopMomentum(...args))
269
+ style: I(e.threeDimensional ? e.touchRollerStyle : e.touchTileStyle),
270
+ onTransitionend: n[0] || (n[0] = (...r) => e.stopMomentum && e.stopMomentum(...r))
417
271
  }, [
418
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.column, (item, index) => {
419
- return openBlock(), createElementBlock(Fragment, {
420
- key: item.value ? item.value : index
421
- }, [
422
- item && item.text && _ctx.threeDimensional ? (openBlock(), createElementBlock("view", {
423
- key: 0,
424
- class: normalizeClass(["nut-picker-roller-item", { "nut-picker-roller-item-hidden": _ctx.isHidden(index + 1) }]),
425
- style: normalizeStyle(_ctx.setRollerStyle(index + 1))
426
- }, toDisplayString(item.text), 7)) : createCommentVNode("", true),
427
- item && item.text && !_ctx.threeDimensional ? (openBlock(), createElementBlock("view", {
428
- key: 1,
429
- class: "nut-picker-roller-item-tile",
430
- style: normalizeStyle({ height: _ctx.pxCheck(_ctx.optionHeight), lineHeight: _ctx.pxCheck(_ctx.optionHeight) })
431
- }, toDisplayString(item.text), 5)) : createCommentVNode("", true)
432
- ], 64);
433
- }), 128))
272
+ (S(!0), D(U, null, _(e.column, (r, s) => (S(), D(U, {
273
+ key: r.value ? r.value : s
274
+ }, [
275
+ r && r.text && e.threeDimensional ? (S(), D("view", {
276
+ key: 0,
277
+ class: ee(["nut-picker-roller-item", { "nut-picker-roller-item-hidden": e.isHidden(s + 1) }]),
278
+ style: I(e.setRollerStyle(s + 1))
279
+ }, R(r.text), 7)) : j("", !0),
280
+ r && r.text && !e.threeDimensional ? (S(), D("view", {
281
+ key: 1,
282
+ class: "nut-picker-roller-item-tile",
283
+ style: I({ height: e.pxCheck(e.optionHeight), lineHeight: e.pxCheck(e.optionHeight) })
284
+ }, R(r.text), 5)) : j("", !0)
285
+ ], 64))), 128))
434
286
  ], 36),
435
- createElementVNode("view", {
287
+ N("view", {
436
288
  class: "nut-picker-roller-mask",
437
- style: normalizeStyle(_ctx.maskStyles)
289
+ style: I(e.maskStyles)
438
290
  }, null, 4)
439
291
  ], 32);
440
292
  }
441
- const column = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
442
- const baseProps = {
293
+ const F = /* @__PURE__ */ te(ge, [["render", ye]]), Te = {
443
294
  modelValue: {
444
295
  type: Array,
445
296
  default: () => []
@@ -458,13 +309,11 @@ const baseProps = {
458
309
  },
459
310
  columns: {
460
311
  type: Array,
461
- default: () => {
462
- return [];
463
- }
312
+ default: () => []
464
313
  },
465
314
  threeDimensional: {
466
315
  type: Boolean,
467
- default: true
316
+ default: !0
468
317
  },
469
318
  swipeDuration: {
470
319
  type: [Number, String],
@@ -472,7 +321,7 @@ const baseProps = {
472
321
  },
473
322
  showToolbar: {
474
323
  type: Boolean,
475
- default: true
324
+ default: !0
476
325
  },
477
326
  visibleOptionNum: {
478
327
  type: [Number, String],
@@ -482,102 +331,87 @@ const baseProps = {
482
331
  type: [Number, String],
483
332
  default: 36
484
333
  }
485
- };
486
- const { componentName, create, translate } = createComponent("picker");
487
- const _sfc_main = create({
334
+ }, { componentName: Ve, create: ke, translate: Se } = q("picker"), De = ke({
488
335
  components: {
489
- [column.name]: column
336
+ [F.name]: F
490
337
  },
491
- props: baseProps,
338
+ props: Te,
492
339
  emits: ["cancel", "change", "confirm", "update:modelValue"],
493
- setup(props, { emit }) {
494
- const { changeHandler, confirm, defaultValues, columnsList, columnsType, classes, cancel } = usePicker(props, emit);
495
- const pickerColumn = ref([]);
496
- const swipeRef = (el) => {
497
- if (el && pickerColumn.value.length < columnsList.value.length) {
498
- pickerColumn.value.push(el);
499
- }
500
- };
501
- const columnStyle = computed(() => {
502
- const styles = {};
503
- styles.height = `${+props.visibleOptionNum * +props.optionHeight}px`;
504
- styles["--lineHeight"] = `${+props.optionHeight}px`;
505
- return styles;
340
+ setup(e, { emit: n }) {
341
+ const { changeHandler: a, confirm: t, defaultValues: y, columnsList: p, columnsType: r, classes: s, cancel: g } = ve(e, n), d = $([]), H = (f) => {
342
+ f && d.value.length < p.value.length && d.value.push(f);
343
+ }, M = b(() => {
344
+ const f = {};
345
+ return f.height = `${+e.visibleOptionNum * +e.optionHeight}px`, f["--lineHeight"] = `${+e.optionHeight}px`, f;
506
346
  });
507
- const confirmHandler = () => {
508
- pickerColumn.value.length > 0 && pickerColumn.value.forEach((column2) => {
509
- column2.stopMomentum();
510
- });
511
- confirm();
512
- };
513
347
  return {
514
- classes,
515
- column,
516
- columnsType,
517
- columnsList,
518
- cancel,
519
- changeHandler,
520
- confirmHandler,
521
- defaultValues,
522
- translate,
523
- pickerColumn,
524
- swipeRef,
525
- columnStyle
348
+ classes: s,
349
+ column: F,
350
+ columnsType: r,
351
+ columnsList: p,
352
+ cancel: g,
353
+ changeHandler: a,
354
+ confirmHandler: () => {
355
+ d.value.length > 0 && d.value.forEach((f) => {
356
+ f.stopMomentum();
357
+ }), t();
358
+ },
359
+ defaultValues: y,
360
+ translate: Se,
361
+ pickerColumn: d,
362
+ swipeRef: H,
363
+ columnStyle: M
526
364
  };
527
365
  }
528
- });
529
- const _hoisted_1 = {
366
+ }), be = {
530
367
  key: 0,
531
368
  class: "nut-picker__bar"
532
- };
533
- const _hoisted_2 = { class: "nut-picker__title" };
534
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
535
- const _component_nut_picker_column = resolveComponent("nut-picker-column");
536
- return openBlock(), createElementBlock("div", {
537
- class: normalizeClass(_ctx.classes)
369
+ }, we = { class: "nut-picker__title" };
370
+ function $e(e, n, a, t, y, p) {
371
+ const r = ie("nut-picker-column");
372
+ return S(), D("div", {
373
+ class: ee(e.classes)
538
374
  }, [
539
- _ctx.showToolbar ? (openBlock(), createElementBlock("view", _hoisted_1, [
540
- createElementVNode("view", {
375
+ e.showToolbar ? (S(), D("view", be, [
376
+ N("view", {
541
377
  class: "nut-picker__left",
542
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.cancel && _ctx.cancel(...args))
543
- }, toDisplayString(_ctx.cancelText || _ctx.translate("cancel")), 1),
544
- createElementVNode("view", _hoisted_2, toDisplayString(_ctx.title), 1),
545
- createElementVNode("view", {
378
+ onClick: n[0] || (n[0] = (...s) => e.cancel && e.cancel(...s))
379
+ }, R(e.cancelText || e.translate("cancel")), 1),
380
+ N("view", we, R(e.title), 1),
381
+ N("view", {
546
382
  class: "nut-picker__right",
547
- onClick: _cache[1] || (_cache[1] = ($event) => _ctx.confirmHandler())
548
- }, toDisplayString(_ctx.okText || _ctx.translate("confirm")), 1)
549
- ])) : createCommentVNode("", true),
550
- renderSlot(_ctx.$slots, "top"),
551
- createElementVNode("view", {
383
+ onClick: n[1] || (n[1] = (s) => e.confirmHandler())
384
+ }, R(e.okText || e.translate("confirm")), 1)
385
+ ])) : j("", !0),
386
+ X(e.$slots, "top"),
387
+ N("view", {
552
388
  class: "nut-picker__column",
553
- style: normalizeStyle(_ctx.columnStyle)
389
+ style: I(e.columnStyle)
554
390
  }, [
555
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columnsList, (column2, columnIndex) => {
556
- return openBlock(), createElementBlock("view", {
557
- class: "nut-picker__columnitem",
558
- key: columnIndex
559
- }, [
560
- createVNode(_component_nut_picker_column, {
561
- ref_for: true,
562
- ref: _ctx.swipeRef,
563
- column: column2,
564
- columnsType: _ctx.columnsType,
565
- value: _ctx.defaultValues && _ctx.defaultValues[columnIndex],
566
- threeDimensional: _ctx.threeDimensional,
567
- swipeDuration: _ctx.swipeDuration,
568
- visibleOptionNum: _ctx.visibleOptionNum,
569
- optionHeight: _ctx.optionHeight,
570
- onChange: (option) => {
571
- _ctx.changeHandler(columnIndex, option);
572
- }
573
- }, null, 8, ["column", "columnsType", "value", "threeDimensional", "swipeDuration", "visibleOptionNum", "optionHeight", "onChange"])
574
- ]);
575
- }), 128))
391
+ (S(!0), D(U, null, _(e.columnsList, (s, g) => (S(), D("view", {
392
+ class: "nut-picker__columnitem",
393
+ key: g
394
+ }, [
395
+ ce(r, {
396
+ ref_for: !0,
397
+ ref: e.swipeRef,
398
+ column: s,
399
+ columnsType: e.columnsType,
400
+ value: e.defaultValues && e.defaultValues[g],
401
+ threeDimensional: e.threeDimensional,
402
+ swipeDuration: e.swipeDuration,
403
+ visibleOptionNum: e.visibleOptionNum,
404
+ optionHeight: e.optionHeight,
405
+ onChange: (d) => {
406
+ e.changeHandler(g, d);
407
+ }
408
+ }, null, 8, ["column", "columnsType", "value", "threeDimensional", "swipeDuration", "visibleOptionNum", "optionHeight", "onChange"])
409
+ ]))), 128))
576
410
  ], 4),
577
- renderSlot(_ctx.$slots, "default")
411
+ X(e.$slots, "default")
578
412
  ], 2);
579
413
  }
580
- const Picker = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
414
+ const Ie = /* @__PURE__ */ te(De, [["render", $e]]);
581
415
  export {
582
- Picker as default
416
+ Ie as default
583
417
  };