@nutui/nutui 4.0.10-beta.1 → 4.0.11

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 (160) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/nutui.es.js +1 -1
  3. package/dist/nutui.js +6316 -7237
  4. package/dist/nutui.umd.js +1 -1
  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 +95 -150
  59. package/dist/packages/_es/MenuItem.js +109 -154
  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 -437
  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 +123 -174
  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/smartips/web-types.json +1 -1
  126. package/dist/style.css +1 -1
  127. package/dist/styles/themes/default.scss +148 -45
  128. package/dist/styles/themes/jdb.scss +148 -45
  129. package/dist/styles/themes/jddkh.scss +148 -45
  130. package/dist/styles/themes/jdt.scss +148 -45
  131. package/dist/types/__VUE/address/index.vue.d.ts +1 -1
  132. package/dist/types/__VUE/collapseitem/index.vue.d.ts +110 -3
  133. package/dist/types/__VUE/image/index.vue.d.ts +2 -2
  134. package/dist/types/__VUE/rate/index.vue.d.ts +110 -3
  135. package/dist/types/__VUE/searchbar/index.vue.d.ts +110 -3
  136. package/dist/types/__VUE/skeleton/index.vue.d.ts +2 -2
  137. package/dist/types/__VUE/swiper/index.vue.d.ts +1 -1
  138. package/dist/types/__VUE/table/common.d.ts +55 -2
  139. package/dist/types/__VUE/timeselect/index.vue.d.ts +1 -1
  140. package/dist/types/__VUE/watermark/index.vue.d.ts +1 -1
  141. package/dist/types/index.d.ts +1 -1
  142. package/package.json +2 -2
  143. package/dist/packages/_es/Interceptor-956b24fc.js +0 -29
  144. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +0 -10
  145. package/dist/packages/_es/common-b9a5e726.js +0 -145
  146. package/dist/packages/_es/component-81a4c1d0.js +0 -145
  147. package/dist/packages/_es/index-29892cda.js +0 -33
  148. package/dist/packages/_es/index-43c34ac6.js +0 -30
  149. package/dist/packages/_es/index-54d03fc1.js +0 -8
  150. package/dist/packages/_es/index-79c5dc33.js +0 -10
  151. package/dist/packages/_es/index-7a7385e4.js +0 -67
  152. package/dist/packages/_es/index-87422be8.js +0 -942
  153. package/dist/packages/_es/index-da0a7662.js +0 -259
  154. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +0 -46
  155. package/dist/packages/_es/index.vue_vue_type_script_lang-442e4704.js +0 -98
  156. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +0 -151
  157. package/dist/packages/_es/mountComponent-8b24c346.js +0 -39
  158. package/dist/packages/_es/pxCheck-c6b9f6b7.js +0 -6
  159. package/dist/packages/_es/raf-729dad54.js +0 -25
  160. package/dist/packages/_es/renderIcon-3d0fd47c.js +0 -9
@@ -1,178 +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
- const 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
- return columnsList.value.map((column2, index) => {
46
- return column2.find((item) => item.value === defaultValues.value[index]);
47
- });
48
- });
49
- const columnsType = computed(() => {
50
- const firstColumn = state.formattedColumns[0];
51
- if (firstColumn) {
52
- 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))
53
30
  return "multiple";
54
- }
55
- if ("children" in firstColumn) {
31
+ if ("children" in l)
56
32
  return "cascade";
57
- }
58
33
  }
59
34
  return "single";
60
- });
61
- const columnsList = computed(() => {
62
- switch (columnsType.value) {
35
+ }), d = b(() => {
36
+ switch (g.value) {
63
37
  case "multiple":
64
- return state.formattedColumns;
38
+ return a.formattedColumns;
65
39
  case "cascade":
66
- return formatCascade(state.formattedColumns, defaultValues.value ? defaultValues.value : []);
40
+ return H(a.formattedColumns, t.value ? t.value : []);
67
41
  default:
68
- return [state.formattedColumns];
42
+ return [a.formattedColumns];
69
43
  }
70
- });
71
- const formatCascade = (columns, defaultValues2) => {
72
- const formatted = [];
73
- let cursor = {
44
+ }), H = (l, c) => {
45
+ const T = [];
46
+ let u = {
74
47
  text: "",
75
48
  value: "",
76
- children: columns
77
- };
78
- let columnIndex = 0;
79
- while (cursor && cursor.children) {
80
- const options = cursor.children;
81
- const value = defaultValues2[columnIndex];
82
- let index = options.findIndex((columnItem) => columnItem.value === value);
83
- if (index === -1)
84
- index = 0;
85
- cursor = cursor.children[index];
86
- columnIndex++;
87
- 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);
88
55
  }
89
- return formatted;
90
- };
91
- const cancel = () => {
92
- emit("cancel", {
93
- selectedValue: defaultValues.value,
94
- selectedOptions: selectedOptions.value
56
+ return T;
57
+ }, M = () => {
58
+ n("cancel", {
59
+ selectedValue: t.value,
60
+ selectedOptions: s.value
95
61
  });
96
- };
97
- const changeHandler = (columnIndex, option) => {
98
- if (option && Object.keys(option).length) {
99
- defaultValues.value = defaultValues.value ? defaultValues.value : [];
100
- if (columnsType.value === "cascade") {
101
- defaultValues.value[columnIndex] = option.value ? option.value : "";
102
- let index = columnIndex;
103
- let cursor = option;
104
- while (cursor && cursor.children && cursor.children[0]) {
105
- defaultValues.value[index + 1] = cursor.children[0].value;
106
- index++;
107
- cursor = cursor.children[0];
108
- }
109
- if (cursor && cursor.children && cursor.children.length === 0) {
110
- defaultValues.value = defaultValues.value.slice(0, index + 1);
111
- }
112
- } else {
113
- defaultValues.value[columnIndex] = option.hasOwnProperty("value") ? option.value : "";
114
- }
115
- emit("change", {
116
- columnIndex,
117
- selectedValue: defaultValues.value,
118
- selectedOptions: selectedOptions.value
119
- });
120
- }
121
- };
122
- const confirm = () => {
123
- if (defaultValues.value && !defaultValues.value.length) {
124
- columnsList.value.forEach((columns) => {
125
- 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
126
76
  });
127
77
  }
128
- emit("confirm", {
129
- selectedValue: defaultValues.value,
130
- 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
131
84
  });
132
- };
133
- const isSameValue = (valA, valB) => JSON.stringify(valA) === JSON.stringify(valB);
134
- watch(
135
- () => props.modelValue,
136
- (newValues) => {
137
- if (!isSameValue(newValues, defaultValues.value)) {
138
- defaultValues.value = newValues;
139
- }
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);
140
90
  },
141
- { deep: true, immediate: true }
142
- );
143
- watch(
144
- defaultValues,
145
- (newValues) => {
146
- if (!isSameValue(newValues, props.modelValue)) {
147
- emit("update:modelValue", newValues);
148
- }
91
+ { deep: !0, immediate: !0 }
92
+ ), E(
93
+ t,
94
+ (l) => {
95
+ Y(l, e.modelValue) || n("update:modelValue", l);
149
96
  },
150
- { deep: true }
151
- );
152
- watch(
153
- () => props.columns,
154
- (val) => {
155
- if (val.length)
156
- state.formattedColumns = val;
97
+ { deep: !0 }
98
+ ), E(
99
+ () => e.columns,
100
+ (l) => {
101
+ l.length && (a.formattedColumns = l);
157
102
  }
158
- );
159
- return __spreadProps(__spreadValues({
160
- classes
161
- }, toRefs(state)), {
162
- columnsType,
163
- columnsList,
164
- cancel,
165
- changeHandler,
166
- confirm,
167
- defaultValues,
168
- pickerColumn,
169
- swipeRef,
170
- selectedOptions,
171
- 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
172
116
  });
173
- };
174
- const { create: create$1 } = createComponent("picker-column");
175
- const _sfc_main$1 = create$1({
117
+ }, { create: pe } = q("picker-column"), ge = pe({
176
118
  props: {
177
119
  // 当前选中项
178
120
  value: [String, Number],
@@ -184,7 +126,7 @@ const _sfc_main$1 = create$1({
184
126
  // 是否开启3D效果
185
127
  threeDimensional: {
186
128
  type: Boolean,
187
- default: true
129
+ default: !0
188
130
  },
189
131
  swipeDuration: {
190
132
  type: [Number, String],
@@ -200,9 +142,8 @@ const _sfc_main$1 = create$1({
200
142
  }
201
143
  },
202
144
  emits: ["click", "change"],
203
- setup(props, { emit }) {
204
- const touch = useTouch();
205
- const state = reactive({
145
+ setup(e, { emit: n }) {
146
+ const a = he(), t = x({
206
147
  touchParams: {
207
148
  startY: 0,
208
149
  endY: 0,
@@ -215,227 +156,141 @@ const _sfc_main$1 = create$1({
215
156
  transformY: 0,
216
157
  scrollDistance: 0,
217
158
  rotation: 20
218
- });
219
- const roller = ref(null);
220
- const moving = ref(false);
221
- const touchDeg = ref(0);
222
- const touchTime = ref(0);
223
- const DEFAULT_DURATION = 200;
224
- const INERTIA_TIME = 300;
225
- const INERTIA_DISTANCE = 15;
226
- const touchRollerStyle = computed(() => {
227
- return {
228
- transition: `transform ${touchTime.value}ms cubic-bezier(0.17, 0.89, 0.45, 1)`,
229
- transform: `rotate3d(1, 0, 0, ${touchDeg.value})`,
230
- top: `calc(50% - ${+props.optionHeight / 2}px)`
231
- };
232
- });
233
- const touchTileStyle = computed(() => {
234
- const { optionHeight } = props;
235
- return {
236
- transition: `transform ${touchTime.value}ms cubic-bezier(0.17, 0.89, 0.45, 1)`,
237
- transform: `translate3d(0, ${state.scrollDistance}px, 0)`,
238
- top: `calc(50% - ${+optionHeight / 2}px)`,
239
- height: `${optionHeight}px`
240
- };
241
- });
242
- const setRollerStyle = (index) => {
243
- return `transform: rotate3d(1, 0, 0, ${-state.rotation * index}deg) translate3d(0px, 0px, 104px)`;
244
- };
245
- 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;
246
165
  return {
247
- 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`
248
170
  };
249
- });
250
- const onTouchStart = (event) => {
251
- touch.start(event);
252
- if (moving.value) {
253
- let dom = roller.value;
254
- const { transform } = window.getComputedStyle(dom);
255
- if (props.threeDimensional) {
256
- const circle = Math.floor(parseInt(touchDeg.value) / 360);
257
- const cos = +transform.split(", ")[5];
258
- const sin = +transform.split(", ")[6] < 0 ? 180 : 0;
259
- const endDeg = circle * 360 + Math.acos(cos) / Math.PI * 180 + sin;
260
- state.scrollDistance = -Math.abs((endDeg / state.rotation - 1) * +props.optionHeight);
261
- } else {
262
- state.scrollDistance = +transform.slice(7, transform.length - 1).split(", ")[5];
263
- }
264
- }
265
- preventDefault(event, true);
266
- state.touchParams.startY = touch.deltaY.value;
267
- state.touchParams.startTime = Date.now();
268
- state.transformY = state.scrollDistance;
269
- };
270
- const onTouchMove = (event) => {
271
- touch.move(event);
272
- if (touch.isVertical()) {
273
- moving.value = true;
274
- 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];
275
182
  }
276
- state.touchParams.lastY = touch.deltaY.value;
277
- let move = state.touchParams.lastY - state.touchParams.startY;
278
- setMove(move);
279
- };
280
- const onTouchEnd = () => {
281
- state.touchParams.lastY = touch.deltaY.value;
282
- state.touchParams.lastTime = Date.now();
283
- let move = state.touchParams.lastY - state.touchParams.startY;
284
- let moveTime = state.touchParams.lastTime - state.touchParams.startTime;
285
- if (moveTime <= INERTIA_TIME && Math.abs(move) > INERTIA_DISTANCE) {
286
- const distance = momentum(move, moveTime);
287
- 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);
288
194
  return;
289
- } else {
290
- setMove(move, "end");
291
- }
195
+ } else
196
+ w(o, "end");
292
197
  setTimeout(() => {
293
- touch.reset();
294
- moving.value = false;
198
+ a.reset(), p.value = !1;
295
199
  }, 0);
296
- };
297
- const momentum = (distance, duration) => {
298
- const speed = Math.abs(distance / duration);
299
- distance = speed / 3e-3 * (distance < 0 ? -1 : 1);
300
- return distance;
301
- };
302
- const isHidden = (index) => {
303
- if (index >= state.currIndex + 8 || index <= state.currIndex - 8) {
304
- return true;
305
- } else {
306
- return false;
307
- }
308
- };
309
- const setTransform = (translateY = 0, type, time = DEFAULT_DURATION, deg) => {
310
- if (type === "end") {
311
- touchTime.value = time;
312
- } else {
313
- touchTime.value = 0;
314
- }
315
- touchDeg.value = deg;
316
- state.scrollDistance = translateY;
317
- };
318
- const setMove = (move, type, time) => {
319
- const { optionHeight } = props;
320
- let updateMove = move + state.transformY;
321
- if (type === "end") {
322
- if (updateMove > 0) {
323
- updateMove = 0;
324
- }
325
- if (updateMove < -(props.column.length - 1) * +optionHeight) {
326
- updateMove = -(props.column.length - 1) * +optionHeight;
327
- }
328
- let endMove = Math.round(updateMove / +optionHeight) * +optionHeight;
329
- let deg = `${(Math.abs(Math.round(endMove / +optionHeight)) + 1) * state.rotation}deg`;
330
- setTransform(endMove, type, time, deg);
331
- 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;
332
209
  } else {
333
- let deg = 0;
334
- let currentDeg = (-updateMove / +optionHeight + 1) * state.rotation;
335
- const maxDeg = (props.column.length + 1) * state.rotation;
336
- const minDeg = 0;
337
- deg = clamp(currentDeg, minDeg, maxDeg);
338
- if (minDeg < deg && deg < maxDeg) {
339
- setTransform(updateMove, null, void 0, deg + "deg");
340
- state.currIndex = Math.abs(Math.round(updateMove / +optionHeight)) + 1;
341
- }
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);
342
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();
343
224
  };
344
- const setChooseValue = () => {
345
- emit("change", props.column[state.currIndex - 1]);
346
- };
347
- const modifyStatus = (type) => {
348
- const { column: column2 } = props;
349
- let index = column2.findIndex((columnItem) => columnItem.value === props.value);
350
- state.currIndex = index === -1 ? 1 : index + 1;
351
- let move = index === -1 ? 0 : index * +props.optionHeight;
352
- type && setChooseValue();
353
- setMove(-move);
354
- };
355
- const stopMomentum = () => {
356
- moving.value = false;
357
- touchTime.value = 0;
358
- setChooseValue();
359
- };
360
- watch(
361
- () => props.column,
362
- (val) => {
363
- if (props.column && props.column.length > 0) {
364
- state.transformY = 0;
365
- modifyStatus(false);
366
- }
225
+ return E(
226
+ () => e.column,
227
+ (o) => {
228
+ e.column && e.column.length > 0 && (t.transformY = 0, O(!1));
367
229
  },
368
230
  {
369
- deep: true
231
+ deep: !0
370
232
  }
371
- );
372
- watch(
373
- () => props.value,
374
- (val) => {
375
- state.transformY = 0;
376
- modifyStatus(false);
233
+ ), E(
234
+ () => e.value,
235
+ (o) => {
236
+ t.transformY = 0, O(!1);
377
237
  },
378
238
  {
379
- deep: true
239
+ deep: !0
380
240
  }
381
- );
382
- onMounted(() => {
383
- modifyStatus(true);
384
- });
385
- return __spreadProps(__spreadValues(__spreadValues({}, toRefs(state)), toRefs(props)), {
386
- setRollerStyle,
387
- isHidden,
388
- roller,
389
- onTouchStart,
390
- onTouchMove,
391
- onTouchEnd,
392
- touchRollerStyle,
393
- touchTileStyle,
394
- setMove,
395
- stopMomentum,
396
- pxCheck,
397
- 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
398
256
  });
399
257
  }
400
258
  });
401
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
402
- return openBlock(), createElementBlock("view", {
259
+ function ye(e, n, a, t, y, p) {
260
+ return S(), D("view", {
403
261
  class: "nut-picker__list",
404
- onTouchstart: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
405
- onTouchmove: _cache[2] || (_cache[2] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
406
- 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))
407
265
  }, [
408
- createElementVNode("view", {
266
+ N("view", {
409
267
  class: "nut-picker-roller",
410
268
  ref: "roller",
411
- style: normalizeStyle(_ctx.threeDimensional ? _ctx.touchRollerStyle : _ctx.touchTileStyle),
412
- 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))
413
271
  }, [
414
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.column, (item, index) => {
415
- return openBlock(), createElementBlock(Fragment, {
416
- key: item.value ? item.value : index
417
- }, [
418
- item && item.text && _ctx.threeDimensional ? (openBlock(), createElementBlock("view", {
419
- key: 0,
420
- class: normalizeClass(["nut-picker-roller-item", { "nut-picker-roller-item-hidden": _ctx.isHidden(index + 1) }]),
421
- style: normalizeStyle(_ctx.setRollerStyle(index + 1))
422
- }, toDisplayString(item.text), 7)) : createCommentVNode("", true),
423
- item && item.text && !_ctx.threeDimensional ? (openBlock(), createElementBlock("view", {
424
- key: 1,
425
- class: "nut-picker-roller-item-tile",
426
- style: normalizeStyle({ height: _ctx.pxCheck(_ctx.optionHeight), lineHeight: _ctx.pxCheck(_ctx.optionHeight) })
427
- }, toDisplayString(item.text), 5)) : createCommentVNode("", true)
428
- ], 64);
429
- }), 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))
430
286
  ], 36),
431
- createElementVNode("view", {
287
+ N("view", {
432
288
  class: "nut-picker-roller-mask",
433
- style: normalizeStyle(_ctx.maskStyles)
289
+ style: I(e.maskStyles)
434
290
  }, null, 4)
435
291
  ], 32);
436
292
  }
437
- const column = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
438
- const baseProps = {
293
+ const F = /* @__PURE__ */ te(ge, [["render", ye]]), Te = {
439
294
  modelValue: {
440
295
  type: Array,
441
296
  default: () => []
@@ -454,13 +309,11 @@ const baseProps = {
454
309
  },
455
310
  columns: {
456
311
  type: Array,
457
- default: () => {
458
- return [];
459
- }
312
+ default: () => []
460
313
  },
461
314
  threeDimensional: {
462
315
  type: Boolean,
463
- default: true
316
+ default: !0
464
317
  },
465
318
  swipeDuration: {
466
319
  type: [Number, String],
@@ -468,7 +321,7 @@ const baseProps = {
468
321
  },
469
322
  showToolbar: {
470
323
  type: Boolean,
471
- default: true
324
+ default: !0
472
325
  },
473
326
  visibleOptionNum: {
474
327
  type: [Number, String],
@@ -478,102 +331,87 @@ const baseProps = {
478
331
  type: [Number, String],
479
332
  default: 36
480
333
  }
481
- };
482
- const { componentName, create, translate } = createComponent("picker");
483
- const _sfc_main = create({
334
+ }, { componentName: Ve, create: ke, translate: Se } = q("picker"), De = ke({
484
335
  components: {
485
- [column.name]: column
336
+ [F.name]: F
486
337
  },
487
- props: baseProps,
338
+ props: Te,
488
339
  emits: ["cancel", "change", "confirm", "update:modelValue"],
489
- setup(props, { emit }) {
490
- const { changeHandler, confirm, defaultValues, columnsList, columnsType, classes, cancel } = usePicker(props, emit);
491
- const pickerColumn = ref([]);
492
- const swipeRef = (el) => {
493
- if (el && pickerColumn.value.length < columnsList.value.length) {
494
- pickerColumn.value.push(el);
495
- }
496
- };
497
- const columnStyle = computed(() => {
498
- const styles = {};
499
- styles.height = `${+props.visibleOptionNum * +props.optionHeight}px`;
500
- styles["--lineHeight"] = `${+props.optionHeight}px`;
501
- 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;
502
346
  });
503
- const confirmHandler = () => {
504
- pickerColumn.value.length > 0 && pickerColumn.value.forEach((column2) => {
505
- column2.stopMomentum();
506
- });
507
- confirm();
508
- };
509
347
  return {
510
- classes,
511
- column,
512
- columnsType,
513
- columnsList,
514
- cancel,
515
- changeHandler,
516
- confirmHandler,
517
- defaultValues,
518
- translate,
519
- pickerColumn,
520
- swipeRef,
521
- 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
522
364
  };
523
365
  }
524
- });
525
- const _hoisted_1 = {
366
+ }), be = {
526
367
  key: 0,
527
368
  class: "nut-picker__bar"
528
- };
529
- const _hoisted_2 = { class: "nut-picker__title" };
530
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
531
- const _component_nut_picker_column = resolveComponent("nut-picker-column");
532
- return openBlock(), createElementBlock("div", {
533
- 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)
534
374
  }, [
535
- _ctx.showToolbar ? (openBlock(), createElementBlock("view", _hoisted_1, [
536
- createElementVNode("view", {
375
+ e.showToolbar ? (S(), D("view", be, [
376
+ N("view", {
537
377
  class: "nut-picker__left",
538
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.cancel && _ctx.cancel(...args))
539
- }, toDisplayString(_ctx.cancelText || _ctx.translate("cancel")), 1),
540
- createElementVNode("view", _hoisted_2, toDisplayString(_ctx.title), 1),
541
- 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", {
542
382
  class: "nut-picker__right",
543
- onClick: _cache[1] || (_cache[1] = ($event) => _ctx.confirmHandler())
544
- }, toDisplayString(_ctx.okText || _ctx.translate("confirm")), 1)
545
- ])) : createCommentVNode("", true),
546
- renderSlot(_ctx.$slots, "top"),
547
- 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", {
548
388
  class: "nut-picker__column",
549
- style: normalizeStyle(_ctx.columnStyle)
389
+ style: I(e.columnStyle)
550
390
  }, [
551
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columnsList, (column2, columnIndex) => {
552
- return openBlock(), createElementBlock("view", {
553
- class: "nut-picker__columnitem",
554
- key: columnIndex
555
- }, [
556
- createVNode(_component_nut_picker_column, {
557
- ref_for: true,
558
- ref: _ctx.swipeRef,
559
- column: column2,
560
- columnsType: _ctx.columnsType,
561
- value: _ctx.defaultValues && _ctx.defaultValues[columnIndex],
562
- threeDimensional: _ctx.threeDimensional,
563
- swipeDuration: _ctx.swipeDuration,
564
- visibleOptionNum: _ctx.visibleOptionNum,
565
- optionHeight: _ctx.optionHeight,
566
- onChange: (option) => {
567
- _ctx.changeHandler(columnIndex, option);
568
- }
569
- }, null, 8, ["column", "columnsType", "value", "threeDimensional", "swipeDuration", "visibleOptionNum", "optionHeight", "onChange"])
570
- ]);
571
- }), 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))
572
410
  ], 4),
573
- renderSlot(_ctx.$slots, "default")
411
+ X(e.$slots, "default")
574
412
  ], 2);
575
413
  }
576
- const Picker = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
414
+ const Ie = /* @__PURE__ */ te(De, [["render", $e]]);
577
415
  export {
578
- Picker as default
416
+ Ie as default
579
417
  };