@nutui/nutui 3.2.6-beta.2 → 3.2.7

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 (195) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.md +11 -1
  3. package/dist/nutui.es.js +682 -1156
  4. package/dist/nutui.umd.js +689 -1164
  5. package/dist/packages/_es/ActionSheet.js +1 -1
  6. package/dist/packages/_es/Address.js +1 -1
  7. package/dist/packages/_es/AddressList.js +1 -1
  8. package/dist/packages/_es/Animate.js +1 -1
  9. package/dist/packages/_es/Audio.js +1 -1
  10. package/dist/packages/_es/AudioOperate.js +1 -1
  11. package/dist/packages/_es/Avatar.js +1 -1
  12. package/dist/packages/_es/AvatarGroup.js +1 -1
  13. package/dist/packages/_es/BackTop.js +1 -1
  14. package/dist/packages/_es/Badge.js +1 -1
  15. package/dist/packages/_es/Barrage.js +1 -1
  16. package/dist/packages/_es/Button.js +1 -1
  17. package/dist/packages/_es/Calendar.js +11 -4
  18. package/dist/packages/_es/CalendarItem.js +1 -1
  19. package/dist/packages/_es/Card.js +1 -1
  20. package/dist/packages/_es/Cascader.js +1 -1
  21. package/dist/packages/_es/Category.js +1 -1
  22. package/dist/packages/_es/CategoryPane.js +1 -1
  23. package/dist/packages/_es/Cell.js +1 -1
  24. package/dist/packages/_es/CellGroup.js +1 -1
  25. package/dist/packages/_es/Checkbox.js +1 -1
  26. package/dist/packages/_es/CheckboxGroup.js +1 -1
  27. package/dist/packages/_es/CircleProgress.js +1 -1
  28. package/dist/packages/_es/Col.js +1 -1
  29. package/dist/packages/_es/Collapse.js +1 -1
  30. package/dist/packages/_es/CollapseItem.js +9 -12
  31. package/dist/packages/_es/Comment.js +1 -1
  32. package/dist/packages/_es/ConfigProvider.js +1 -1
  33. package/dist/packages/_es/CountDown.js +1 -1
  34. package/dist/packages/_es/CountUp.js +1 -1
  35. package/dist/packages/_es/DatePicker.js +1 -1
  36. package/dist/packages/_es/Dialog.js +1 -1
  37. package/dist/packages/_es/Divider.js +1 -1
  38. package/dist/packages/_es/Drag.js +1 -1
  39. package/dist/packages/_es/Ecard.js +1 -1
  40. package/dist/packages/_es/Elevator.js +8 -2
  41. package/dist/packages/_es/Ellipsis.js +3 -3
  42. package/dist/packages/_es/Empty.js +1 -1
  43. package/dist/packages/_es/FixedNav.js +1 -1
  44. package/dist/packages/_es/Form.js +1 -1
  45. package/dist/packages/_es/FormItem.js +1 -1
  46. package/dist/packages/_es/Grid.js +1 -1
  47. package/dist/packages/_es/GridItem.js +1 -1
  48. package/dist/packages/_es/Icon.js +1 -1
  49. package/dist/packages/_es/Image.js +1 -1
  50. package/dist/packages/_es/ImagePreview.js +16 -5
  51. package/dist/packages/_es/Indicator.js +1 -1
  52. package/dist/packages/_es/InfiniteLoading.js +9 -2
  53. package/dist/packages/_es/Input.js +5 -12
  54. package/dist/packages/_es/InputNumber.js +1 -1
  55. package/dist/packages/_es/Invoice.js +1 -1
  56. package/dist/packages/_es/Layout.js +1 -1
  57. package/dist/packages/_es/List.js +1 -1
  58. package/dist/packages/_es/Menu.js +1 -1
  59. package/dist/packages/_es/MenuItem.js +5 -2
  60. package/dist/packages/_es/Navbar.js +1 -1
  61. package/dist/packages/_es/NoticeBar.js +1 -1
  62. package/dist/packages/_es/Notify.js +1 -1
  63. package/dist/packages/_es/NumberKeyboard.js +1 -1
  64. package/dist/packages/_es/OverLay.js +1 -1
  65. package/dist/packages/_es/Pagination.js +1 -1
  66. package/dist/packages/_es/Picker.js +1 -1
  67. package/dist/packages/_es/Popover.js +1 -1
  68. package/dist/packages/_es/Popup.js +6 -47
  69. package/dist/packages/_es/Price.js +1 -1
  70. package/dist/packages/_es/Progress.js +1 -1
  71. package/dist/packages/_es/PullRefresh.js +1 -1
  72. package/dist/packages/_es/Radio.js +1 -1
  73. package/dist/packages/_es/RadioGroup.js +1 -1
  74. package/dist/packages/_es/Range.js +1 -1
  75. package/dist/packages/_es/Rate.js +1 -1
  76. package/dist/packages/_es/Row.js +1 -1
  77. package/dist/packages/_es/SearchBar.js +1 -1
  78. package/dist/packages/_es/ShortPassword.js +1 -1
  79. package/dist/packages/_es/SideNavBar.js +1 -1
  80. package/dist/packages/_es/SideNavBarItem.js +1 -1
  81. package/dist/packages/_es/Signature.js +1 -1
  82. package/dist/packages/_es/Skeleton.js +19 -24
  83. package/dist/packages/_es/Sku.js +1 -1
  84. package/dist/packages/_es/Step.js +1 -1
  85. package/dist/packages/_es/Steps.js +1 -1
  86. package/dist/packages/_es/Sticky.js +1 -1
  87. package/dist/packages/_es/SubSideNavBar.js +1 -1
  88. package/dist/packages/_es/Swipe.js +1 -1
  89. package/dist/packages/_es/Swiper.js +1 -1
  90. package/dist/packages/_es/SwiperItem.js +1 -1
  91. package/dist/packages/_es/Switch.js +1 -1
  92. package/dist/packages/_es/TabPane.js +1 -1
  93. package/dist/packages/_es/Tabbar.js +1 -1
  94. package/dist/packages/_es/TabbarItem.js +24 -10
  95. package/dist/packages/_es/Table.js +1 -1
  96. package/dist/packages/_es/Tabs.js +1 -1
  97. package/dist/packages/_es/Tag.js +1 -1
  98. package/dist/packages/_es/TextArea.js +1 -1
  99. package/dist/packages/_es/TimeDetail.js +1 -1
  100. package/dist/packages/_es/TimePannel.js +1 -1
  101. package/dist/packages/_es/TimeSelect.js +1 -1
  102. package/dist/packages/_es/Toast.js +1 -1
  103. package/dist/packages/_es/TrendArrow.js +1 -1
  104. package/dist/packages/_es/Uploader.js +6 -6
  105. package/dist/packages/_es/Video.js +3 -2
  106. package/dist/packages/_es/WaterMark.js +1 -1
  107. package/dist/packages/_es/common.js +1 -1
  108. package/dist/packages/_es/component.js +1 -1
  109. package/dist/packages/_es/index.js +1 -1
  110. package/dist/packages/_es/index2.js +1 -1
  111. package/dist/packages/_es/index3.js +1 -1
  112. package/dist/packages/_es/index4.js +1 -1
  113. package/dist/packages/_es/index5.js +8 -2
  114. package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
  115. package/dist/packages/_es/pxCheck.js +1 -1
  116. package/dist/packages/_es/raf.js +1 -1
  117. package/dist/packages/address/index.scss +5 -1
  118. package/dist/packages/card/index.scss +1 -0
  119. package/dist/packages/ellipsis/index.scss +4 -0
  120. package/dist/packages/formitem/index.scss +2 -0
  121. package/dist/packages/imagepreview/index.scss +5 -0
  122. package/dist/packages/locale/lang/baseLang.js +1 -1
  123. package/dist/packages/locale/lang/en-US.js +1 -1
  124. package/dist/packages/locale/lang/id-ID.js +1 -1
  125. package/dist/packages/locale/lang/index.js +1 -1
  126. package/dist/packages/locale/lang/zh-CN.js +1 -1
  127. package/dist/packages/locale/lang/zh-TW.js +1 -1
  128. package/dist/packages/menuitem/index.scss +1 -0
  129. package/dist/packages/signature/index.scss +6 -2
  130. package/dist/packages/skeleton/index.scss +21 -19
  131. package/dist/packages/sticky/index.scss +3 -0
  132. package/dist/packages/tabbaritem/index.scss +4 -0
  133. package/dist/packages/timeselect/index.scss +0 -1
  134. package/dist/smartips/attributes.json +32 -56
  135. package/dist/smartips/tags.json +6 -16
  136. package/dist/smartips/web-types.json +48 -109
  137. package/dist/style.css +1 -1
  138. package/dist/styles/font/config.json +4 -0
  139. package/dist/styles/font/demo_index.html +118 -26
  140. package/dist/styles/font/iconfont.css +23 -7
  141. package/dist/styles/font/iconfont.js +6 -6
  142. package/dist/styles/font/iconfont.json +35 -7
  143. package/dist/styles/font/iconfont.ttf +0 -0
  144. package/dist/styles/font/iconfont.woff +0 -0
  145. package/dist/styles/font/iconfont.woff2 +0 -0
  146. package/dist/styles/themes/default.scss +53 -54
  147. package/dist/styles/themes/jdb.scss +53 -54
  148. package/dist/styles/themes/jddkh.scss +53 -54
  149. package/dist/styles/themes/jdt.scss +53 -54
  150. package/dist/styles/variables-jdb.scss +8 -1
  151. package/dist/styles/variables-jddkh.scss +8 -1
  152. package/dist/styles/variables-jdt.scss +8 -1
  153. package/dist/styles/variables.scss +8 -1
  154. package/dist/types/__VUE/address/index.vue.d.ts +2 -2
  155. package/dist/types/__VUE/audio/index.vue.d.ts +4 -4
  156. package/dist/types/__VUE/calendar/index.vue.d.ts +11 -0
  157. package/dist/types/__VUE/calendaritem/index.vue.d.ts +15 -5
  158. package/dist/types/__VUE/cell/index.vue.d.ts +1 -1
  159. package/dist/types/__VUE/countup/index.vue.d.ts +2 -2
  160. package/dist/types/__VUE/divider/index.vue.d.ts +1 -1
  161. package/dist/types/__VUE/elevator/index.vue.d.ts +2 -1
  162. package/dist/types/__VUE/fixednav/index.vue.d.ts +1 -1
  163. package/dist/types/__VUE/image/index.vue.d.ts +4 -4
  164. package/dist/types/__VUE/imagepreview/index.vue.d.ts +1 -1
  165. package/dist/types/__VUE/infiniteloading/index.vue.d.ts +4 -4
  166. package/dist/types/__VUE/input/index.vue.d.ts +1 -2
  167. package/dist/types/__VUE/inputnumber/index.vue.d.ts +1 -1
  168. package/dist/types/__VUE/menuitem/index.vue.d.ts +3 -1
  169. package/dist/types/__VUE/navbar/index.vue.d.ts +2 -2
  170. package/dist/types/__VUE/noticebar/index.vue.d.ts +2 -2
  171. package/dist/types/__VUE/picker/Column.vue.d.ts +4 -4
  172. package/dist/types/__VUE/picker/index.vue.d.ts +4 -4
  173. package/dist/types/__VUE/popover/index.vue.d.ts +1 -1
  174. package/dist/types/__VUE/range/index.vue.d.ts +7 -7
  175. package/dist/types/__VUE/rate/index.vue.d.ts +1 -1
  176. package/dist/types/__VUE/searchbar/index.vue.d.ts +1 -1
  177. package/dist/types/__VUE/skeleton/common.d.ts +2 -3
  178. package/dist/types/__VUE/skeleton/index.vue.d.ts +2 -3
  179. package/dist/types/__VUE/swiper/index.vue.d.ts +1 -1
  180. package/dist/types/__VUE/switch/index.vue.d.ts +1 -1
  181. package/dist/types/__VUE/tabbar/index.vue.d.ts +1 -1
  182. package/dist/types/__VUE/tabbaritem/index.vue.d.ts +1 -0
  183. package/dist/types/__VUE/timeselect/index.vue.d.ts +1 -1
  184. package/dist/types/__VUE/uploader/index.vue.d.ts +13 -4
  185. package/dist/types/__VUE/video/index.vue.d.ts +2 -2
  186. package/dist/types/__VUE/watermark/index.vue.d.ts +1 -1
  187. package/dist/types/index.d.ts +1 -1
  188. package/dist/types/nutui.d.ts +1 -2
  189. package/package.json +2 -1
  190. package/dist/packages/_es/OldPicker.js +0 -486
  191. package/dist/packages/oldpicker/index.scss +0 -133
  192. package/dist/types/__VUE/oldpicker/Column.vue.d.ts +0 -96
  193. package/dist/types/__VUE/oldpicker/commonProps.d.ts +0 -22
  194. package/dist/types/__VUE/oldpicker/index.vue.d.ts +0 -369
  195. package/dist/types/__VUE/oldpicker/types.d.ts +0 -24
@@ -1,486 +0,0 @@
1
- /*!
2
- * @nutui/nutui v3.2.6-beta.2 Fri Nov 04 2022 17:24:29 GMT+0800 (中国标准时间)
3
- * (c) 2022 @jdf2e.
4
- * Released under the MIT License.
5
- */
6
- import { ref, reactive, computed, watch, onMounted, toRefs, openBlock, createElementBlock, createElementVNode, normalizeStyle, Fragment, renderList, normalizeClass, toDisplayString, createCommentVNode, onBeforeUnmount, toRaw, resolveComponent, createVNode, withCtx } from "vue";
7
- import { c as createComponent } from "./component.js";
8
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
- import Popup, { popupProps } from "./Popup.js";
10
- import "../locale/lang";
11
- import "./OverLay.js";
12
- import "./Icon.js";
13
- import "./pxCheck.js";
14
- const { create: create$1 } = createComponent("oldpicker-column");
15
- const _sfc_main$1 = create$1({
16
- props: {
17
- dataType: String,
18
- itemShow: {
19
- type: Boolean,
20
- default: false
21
- },
22
- listData: {
23
- type: Object,
24
- default: () => {
25
- return {};
26
- }
27
- },
28
- readonly: {
29
- type: Boolean,
30
- default: false
31
- },
32
- defaultIndex: {
33
- type: [Number, String],
34
- default: 0
35
- }
36
- },
37
- emits: ["click", "change"],
38
- setup(props, { emit }) {
39
- const wrapper = ref();
40
- const state = reactive({
41
- touchParams: {
42
- startY: 0,
43
- endY: 0,
44
- startTime: 0,
45
- endTime: 0,
46
- lastY: 0
47
- },
48
- currIndex: 1,
49
- transformY: 0,
50
- scrollDistance: 0,
51
- lineSpacing: 36,
52
- rotation: 20,
53
- timer: null
54
- });
55
- const roller = ref(null);
56
- const list = ref(null);
57
- const listItem = ref(null);
58
- const touchDeg = ref(0);
59
- const touchTime = ref(0);
60
- const touchTranslateY = ref(0);
61
- const touchListStyle = computed(() => {
62
- return {
63
- transition: `transform ${touchTime.value}ms cubic-bezier(0.19, 1, 0.22, 1)`,
64
- transform: `translate3d(0, ${state.scrollDistance}px, 0)`
65
- };
66
- });
67
- const touchRollerStyle = computed(() => {
68
- return {
69
- transition: `transform ${touchTime.value}ms cubic-bezier(0.19, 1, 0.22, 1)`,
70
- transform: `rotate3d(1, 0, 0, ${touchDeg.value})`
71
- };
72
- });
73
- const onTouchStart = (event) => {
74
- event.preventDefault();
75
- let changedTouches = event.changedTouches[0];
76
- state.touchParams.startY = changedTouches.pageY;
77
- state.touchParams.startTime = event.timeStamp || Date.now();
78
- state.transformY = state.scrollDistance;
79
- };
80
- const onTouchMove = (event) => {
81
- event.preventDefault();
82
- let changedTouches = event.changedTouches[0];
83
- state.touchParams.lastY = changedTouches.pageY;
84
- state.touchParams.lastTime = event.timeStamp || Date.now();
85
- let move = state.touchParams.lastY - state.touchParams.startY;
86
- setMove(move);
87
- };
88
- const onTouchEnd = (event) => {
89
- event.preventDefault();
90
- let changedTouches = event.changedTouches[0];
91
- state.touchParams.lastY = changedTouches.pageY;
92
- state.touchParams.lastTime = event.timestamp || Date.now();
93
- let move = state.touchParams.lastY - state.touchParams.startY;
94
- let moveTime = state.touchParams.lastTime - state.touchParams.startTime;
95
- if (moveTime <= 300) {
96
- move = move * 2;
97
- moveTime = moveTime + 1e3;
98
- setMove(move, "end", moveTime);
99
- } else {
100
- setMove(move, "end");
101
- }
102
- };
103
- const setRollerStyle = (index2) => {
104
- return `transform: rotate3d(1, 0, 0, ${-state.rotation * index2}deg) translate3d(0px, 0px, 104px)`;
105
- };
106
- const isHidden = (index2) => {
107
- if (index2 >= state.currIndex + 8 || index2 <= state.currIndex - 8) {
108
- return true;
109
- } else {
110
- return false;
111
- }
112
- };
113
- const setTransform = (translateY = 0, type, time = 1e3, deg) => {
114
- if (type === "end") {
115
- touchTime.value = time;
116
- } else {
117
- touchTime.value = 0;
118
- }
119
- touchDeg.value = deg;
120
- touchTranslateY.value = translateY;
121
- state.scrollDistance = translateY;
122
- };
123
- const setMove = (move, type, time) => {
124
- let updateMove = move + state.transformY;
125
- if (type === "end") {
126
- if (updateMove > 0) {
127
- updateMove = 0;
128
- }
129
- if (updateMove < -(props.listData.values.length - 1) * state.lineSpacing) {
130
- updateMove = -(props.listData.values.length - 1) * state.lineSpacing;
131
- }
132
- let endMove = Math.round(updateMove / state.lineSpacing) * state.lineSpacing;
133
- let deg = `${(Math.abs(Math.round(endMove / state.lineSpacing)) + 1) * state.rotation}deg`;
134
- setTransform(endMove, type, time, deg);
135
- let t = time ? time / 2 : 0;
136
- state.timer = setTimeout(() => {
137
- setChooseValue();
138
- }, t);
139
- state.currIndex = Math.abs(Math.round(endMove / state.lineSpacing)) + 1;
140
- } else {
141
- let deg = "0deg";
142
- if (updateMove < 0) {
143
- deg = `${(Math.abs(updateMove / state.lineSpacing) + 1) * state.rotation}deg`;
144
- } else {
145
- deg = `${(-updateMove / state.lineSpacing + 1) * state.rotation}deg`;
146
- }
147
- setTransform(updateMove, null, void 0, deg);
148
- state.currIndex = Math.abs(Math.round(updateMove / state.lineSpacing)) + 1;
149
- }
150
- };
151
- const setChooseValue = () => {
152
- emit("change", state.currIndex - 1);
153
- };
154
- const modifyStatus = (type) => {
155
- let index2 = props.defaultIndex;
156
- state.currIndex = index2 === -1 ? 1 : index2 + 1;
157
- let move = index2 === -1 ? 0 : index2 * state.lineSpacing;
158
- type && setChooseValue();
159
- setMove(-move);
160
- };
161
- watch(
162
- () => props.listData,
163
- (val) => {
164
- state.transformY = 0;
165
- modifyStatus(false);
166
- },
167
- {
168
- deep: true
169
- }
170
- );
171
- watch(
172
- () => props.defaultIndex,
173
- (val) => {
174
- state.transformY = 0;
175
- modifyStatus(false);
176
- }
177
- );
178
- onMounted(() => {
179
- modifyStatus(true);
180
- });
181
- return {
182
- ...toRefs(state),
183
- ...toRefs(props),
184
- wrapper,
185
- setRollerStyle,
186
- isHidden,
187
- roller,
188
- list,
189
- listItem,
190
- onTouchStart,
191
- onTouchMove,
192
- onTouchEnd,
193
- touchRollerStyle,
194
- touchListStyle,
195
- setMove
196
- };
197
- }
198
- });
199
- const _hoisted_1$1 = { class: "nut-oldpicker-content" };
200
- const _hoisted_2$1 = {
201
- key: 0,
202
- class: "nut-oldpicker-placeholder"
203
- };
204
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
205
- return openBlock(), createElementBlock("view", {
206
- class: "nut-oldpicker__list",
207
- onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
208
- onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
209
- onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
210
- }, [
211
- createElementVNode("view", {
212
- class: "nut-oldpicker-roller",
213
- ref: "roller",
214
- style: normalizeStyle(_ctx.touchRollerStyle)
215
- }, [
216
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.listData.values, (item, index2) => {
217
- return openBlock(), createElementBlock("view", {
218
- class: normalizeClass(["nut-oldpicker-roller-item", { "nut-oldpicker-roller-item-hidden": _ctx.isHidden(index2 + 1) }]),
219
- style: normalizeStyle(_ctx.setRollerStyle(index2 + 1)),
220
- key: item.label ? item.label : index2
221
- }, toDisplayString(_ctx.dataType === "cascade" ? item.text : item), 7);
222
- }), 128))
223
- ], 4),
224
- createElementVNode("view", _hoisted_1$1, [
225
- createElementVNode("view", {
226
- class: "nut-oldpicker-list-panel",
227
- ref: "list",
228
- style: normalizeStyle(_ctx.touchListStyle)
229
- }, [
230
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.listData.values, (item, index2) => {
231
- return openBlock(), createElementBlock("view", {
232
- class: "nut-oldpicker-item nut-oldpicker-item-ref",
233
- key: item.label ? item.label : index2
234
- }, toDisplayString(_ctx.dataType === "cascade" ? item.text : item), 1);
235
- }), 128)),
236
- _ctx.listData && _ctx.listData.length === 1 ? (openBlock(), createElementBlock("view", _hoisted_2$1)) : createCommentVNode("", true)
237
- ], 4)
238
- ])
239
- ], 32);
240
- }
241
- var column = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
242
- const { create, componentName } = createComponent("oldpicker");
243
- const _sfc_main = create({
244
- components: {
245
- [column.name]: column,
246
- [Popup.name]: Popup
247
- },
248
- props: {
249
- ...popupProps,
250
- title: {
251
- type: String,
252
- default: ""
253
- },
254
- cancelText: {
255
- type: String,
256
- default: "\u53D6\u6D88"
257
- },
258
- okText: {
259
- type: String,
260
- default: "\u786E\u5B9A"
261
- },
262
- listData: {
263
- type: Array,
264
- default: () => {
265
- return [];
266
- }
267
- },
268
- readonly: {
269
- type: Boolean,
270
- default: false
271
- },
272
- defaultIndex: {
273
- type: [Number, String],
274
- default: 0
275
- }
276
- },
277
- emits: ["close", "change", "confirm", "update:visible"],
278
- setup(props, { emit }) {
279
- const childrenKey = "children";
280
- const valuesKey = "values";
281
- const state = reactive({
282
- show: false,
283
- formattedColumns: props.listData,
284
- defaultIndex: props.defaultIndex
285
- });
286
- let _defaultIndex = props.defaultIndex;
287
- let defaultIndexList = [];
288
- const classes = computed(() => {
289
- const prefixCls = componentName;
290
- return {
291
- [prefixCls]: true
292
- };
293
- });
294
- const dataType = computed(() => {
295
- const firstColumn = state.formattedColumns[0];
296
- if (typeof firstColumn === "object") {
297
- if (firstColumn[childrenKey]) {
298
- return "cascade";
299
- } else if (firstColumn == null ? void 0 : firstColumn[valuesKey]) {
300
- addDefaultIndexList(props.listData);
301
- return "multipleColumns";
302
- }
303
- }
304
- return "text";
305
- });
306
- const columnList = computed(() => {
307
- if (dataType.value === "text") {
308
- return [{ values: state.formattedColumns, defaultIndex: state.defaultIndex }];
309
- } else if (dataType.value === "multipleColumns") {
310
- return state.formattedColumns;
311
- } else if (dataType.value === "cascade") {
312
- return formatCascade(state.formattedColumns, state.defaultIndex);
313
- }
314
- return state.formattedColumns;
315
- });
316
- const addDefaultIndexList = (listData) => {
317
- defaultIndexList = [];
318
- listData.forEach((res) => {
319
- defaultIndexList.push(res.defaultIndex || 0);
320
- });
321
- };
322
- const formatCascade = (listData, defaultIndex) => {
323
- const formatted = [];
324
- let children = listData;
325
- children.defaultIndex = defaultIndex;
326
- while (children) {
327
- formatted.push({
328
- values: children,
329
- defaultIndex: children.defaultIndex || 0
330
- });
331
- children = children == null ? void 0 : children[children.defaultIndex || 0].children;
332
- }
333
- addDefaultIndexList(formatted);
334
- return formatted;
335
- };
336
- const getCascadeData = (listData, defaultIndex) => {
337
- var _a;
338
- let arr = listData;
339
- arr.defaultIndex = defaultIndex;
340
- const dataList = [];
341
- while (arr) {
342
- const item = arr[(_a = arr.defaultIndex) != null ? _a : 0];
343
- dataList.push(item.text);
344
- arr = item.children;
345
- }
346
- return dataList;
347
- };
348
- const close = () => {
349
- emit("close");
350
- emit("update:visible", false);
351
- };
352
- const changeHandler = (columnIndex, dataIndex) => {
353
- if (dataType.value === "cascade") {
354
- let cursor = state.formattedColumns;
355
- if (columnIndex === 0) {
356
- state.defaultIndex = dataIndex;
357
- }
358
- let i = 0;
359
- while (cursor) {
360
- if (i === columnIndex) {
361
- cursor.defaultIndex = dataIndex;
362
- } else if (i > columnIndex) {
363
- cursor.defaultIndex = 0;
364
- }
365
- cursor = cursor[cursor.defaultIndex || 0].children;
366
- i++;
367
- }
368
- } else if (dataType.value === "text") {
369
- _defaultIndex = dataIndex;
370
- } else if (dataType.value === "multipleColumns") {
371
- defaultIndexList[columnIndex] = dataIndex;
372
- const val = defaultIndexList.map(
373
- (res, i) => toRaw(state.formattedColumns)[i].values[res]
374
- );
375
- emit("change", val, columnIndex, dataIndex);
376
- }
377
- };
378
- const confirm = () => {
379
- if (dataType.value === "text") {
380
- state.defaultIndex = _defaultIndex;
381
- emit("confirm", state.formattedColumns[_defaultIndex]);
382
- } else if (dataType.value === "multipleColumns") {
383
- for (let i = 0; i < defaultIndexList.length; i++) {
384
- state.formattedColumns[i].defaultIndex = defaultIndexList[i];
385
- }
386
- const checkedArr = toRaw(state.formattedColumns).map(
387
- (res) => res.values && res.values[res.defaultIndex]
388
- );
389
- emit("confirm", checkedArr);
390
- } else if (dataType.value === "cascade") {
391
- emit("confirm", getCascadeData(toRaw(state.formattedColumns), state.defaultIndex));
392
- }
393
- emit("update:visible", false);
394
- };
395
- onMounted(() => {
396
- if (props.visible)
397
- state.show = props.visible;
398
- });
399
- onBeforeUnmount(() => {
400
- if (props.visible)
401
- state.show = false;
402
- });
403
- watch(
404
- () => props.visible,
405
- (val) => {
406
- state.show = val;
407
- }
408
- );
409
- watch(
410
- () => props.listData,
411
- (val) => {
412
- state.formattedColumns = val;
413
- }
414
- );
415
- return {
416
- classes,
417
- ...toRefs(state),
418
- column,
419
- dataType,
420
- columnList,
421
- close,
422
- changeHandler,
423
- confirm
424
- };
425
- }
426
- });
427
- const _hoisted_1 = { class: "nut-oldpicker__bar" };
428
- const _hoisted_2 = { class: "nut-oldpicker__title" };
429
- const _hoisted_3 = { class: "nut-oldpicker__column" };
430
- const _hoisted_4 = /* @__PURE__ */ createElementVNode("view", { class: "nut-oldpicker__hairline" }, null, -1);
431
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
432
- const _component_nut_oldpicker_column = resolveComponent("nut-oldpicker-column");
433
- const _component_nut_popup = resolveComponent("nut-popup");
434
- return openBlock(), createElementBlock("view", {
435
- class: normalizeClass(_ctx.classes)
436
- }, [
437
- createVNode(_component_nut_popup, {
438
- position: "bottom",
439
- visible: _ctx.show,
440
- "onUpdate:visible": _cache[2] || (_cache[2] = ($event) => _ctx.show = $event),
441
- teleport: _ctx.teleport,
442
- "lock-scroll": _ctx.lockScroll,
443
- "close-on-click-overlay": _ctx.closeOnClickOverlay,
444
- onClose: _ctx.close,
445
- round: true,
446
- isWrapTeleport: _ctx.isWrapTeleport
447
- }, {
448
- default: withCtx(() => [
449
- createElementVNode("view", _hoisted_1, [
450
- createElementVNode("view", {
451
- class: "nut-oldpicker__cancel nut-oldpicker__left nut-oldpicker__button",
452
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.close && _ctx.close(...args))
453
- }, toDisplayString(_ctx.cancelText), 1),
454
- createElementVNode("view", _hoisted_2, toDisplayString(_ctx.title), 1),
455
- createElementVNode("view", {
456
- class: "nut-oldpicker__confirm nut-oldpicker__button nut-oldpicker__right",
457
- onClick: _cache[1] || (_cache[1] = ($event) => _ctx.confirm())
458
- }, toDisplayString(_ctx.okText), 1)
459
- ]),
460
- createElementVNode("view", _hoisted_3, [
461
- _hoisted_4,
462
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columnList, (item, columnIndex) => {
463
- return openBlock(), createElementBlock("view", {
464
- class: "nut-oldpicker__columnitem",
465
- key: columnIndex
466
- }, [
467
- createVNode(_component_nut_oldpicker_column, {
468
- itemShow: _ctx.show,
469
- "list-data": item,
470
- readonly: _ctx.readonly,
471
- "default-index": item.defaultIndex,
472
- "data-type": _ctx.dataType,
473
- onChange: (dataIndex) => {
474
- _ctx.changeHandler(columnIndex, dataIndex);
475
- }
476
- }, null, 8, ["itemShow", "list-data", "readonly", "default-index", "data-type", "onChange"])
477
- ]);
478
- }), 128))
479
- ])
480
- ]),
481
- _: 1
482
- }, 8, ["visible", "teleport", "lock-scroll", "close-on-click-overlay", "onClose", "isWrapTeleport"])
483
- ], 2);
484
- }
485
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
486
- export { index as default };
@@ -1,133 +0,0 @@
1
- .nut-oldpicker {
2
- &__content {
3
- display: block;
4
- position: relative;
5
- text-align: center;
6
- overflow-y: hidden;
7
- &:hover {
8
- cursor: grab;
9
- }
10
- }
11
-
12
- &__bar {
13
- display: flex;
14
- height: 56px;
15
- align-items: center;
16
- justify-content: space-between;
17
- }
18
- &__column {
19
- display: flex;
20
- position: relative;
21
- height: 252px;
22
- }
23
- &__columnitem {
24
- width: 0;
25
- flex-grow: 1;
26
- height: 100%;
27
- }
28
- &__left {
29
- color: $picker-cancel-color;
30
- font-size: $picker-bar-cancel-font-size;
31
- }
32
- &__right {
33
- color: $picker-ok-color;
34
- font-size: $picker-bar-ok-font-size;
35
- }
36
-
37
- &__title {
38
- color: $picker-bar-title-color;
39
- font-size: $picker-bar-title-font-size;
40
- font-weight: $picker-bar-title-font-weight;
41
- }
42
-
43
- &__button {
44
- cursor: pointer;
45
- padding: $picker-bar-button-padding;
46
- display: flex;
47
- align-items: center;
48
- height: 100%;
49
- }
50
- &__wrapper {
51
- display: block;
52
- }
53
- &__item {
54
- display: flex;
55
- justify-content: center;
56
- align-items: center;
57
- height: 35px;
58
- }
59
- &__hairline {
60
- position: absolute;
61
- top: 108px;
62
- height: 34px;
63
- width: 100%;
64
- border: $picker-item-active-line-border;
65
- border-left: 0;
66
- border-right: 0;
67
- }
68
-
69
- &__list {
70
- position: relative;
71
- display: block;
72
- width: 100%;
73
- height: 252px;
74
- overflow: hidden;
75
- text-align: center;
76
- }
77
-
78
- &-roller {
79
- display: block;
80
- position: absolute;
81
- top: 108px;
82
- width: 100%;
83
- height: $picker-item-height;
84
- z-index: 1;
85
- transform-style: preserve-3d;
86
-
87
- &-item {
88
- display: block;
89
- backface-visibility: hidden;
90
- -moz-backface-visibility: hidden;
91
- -webkit-backface-visibility: hidden;
92
- position: absolute;
93
- top: 0;
94
- width: 100%;
95
- height: $picker-item-height;
96
- line-height: $picker-item-height;
97
- color: $picker-item-text-color;
98
- font-size: $picker-item-text-font-size;
99
-
100
- &-hidden {
101
- visibility: hidden;
102
- opacity: 0;
103
- }
104
- }
105
- }
106
-
107
- &-content {
108
- display: block;
109
- position: absolute;
110
- top: 108px;
111
- width: 100%;
112
- height: $picker-item-height;
113
- color: $picker-item-active-text-color;
114
- z-index: 2;
115
- overflow: hidden;
116
- border-left: 0;
117
- border-right: 0;
118
- }
119
- &-list-panel {
120
- display: block;
121
- transform-style: preserve-3d;
122
- }
123
- &-item {
124
- display: block;
125
- white-space: nowrap;
126
- overflow: hidden;
127
- text-overflow: ellipsis;
128
- height: $picker-item-height;
129
- line-height: $picker-item-height;
130
- text-align: center;
131
- font-size: 16px;
132
- }
133
- }
@@ -1,96 +0,0 @@
1
- import { App, PropType, CSSProperties } from 'vue';
2
- declare type Install<T> = T & {
3
- install(app: App): void;
4
- };
5
- declare const _sfc_main: Install< import("vue").DefineComponent<{
6
- dataType: StringConstructor;
7
- itemShow: {
8
- type: BooleanConstructor;
9
- default: boolean;
10
- };
11
- listData: {
12
- type: ObjectConstructor;
13
- default: () => {};
14
- };
15
- readonly: {
16
- type: BooleanConstructor;
17
- default: boolean;
18
- };
19
- defaultIndex: {
20
- type: (NumberConstructor | StringConstructor)[];
21
- default: number;
22
- };
23
- }, {
24
- wrapper: import("vue").Ref<any>;
25
- setRollerStyle: (index: number) => string;
26
- isHidden: (index: number) => boolean;
27
- roller: import("vue").Ref<null>;
28
- list: import("vue").Ref<null>;
29
- listItem: import("vue").Ref<null>;
30
- onTouchStart: (event: TouchEvent) => void;
31
- onTouchMove: (event: TouchEvent) => void;
32
- onTouchEnd: (event: TouchEvent) => void;
33
- touchRollerStyle: import("vue").ComputedRef<{
34
- transition: string;
35
- transform: string;
36
- }>;
37
- touchListStyle: import("vue").ComputedRef<{
38
- transition: string;
39
- transform: string;
40
- }>;
41
- setMove: (move: number, type?: string | undefined, time?: number | undefined) => void;
42
- onClick: import("vue").Ref<((...args: any[]) => any) | undefined>;
43
- onChange: import("vue").Ref<((...args: any[]) => any) | undefined>;
44
- readonly: import("vue").Ref<boolean>;
45
- itemShow: import("vue").Ref<boolean>;
46
- dataType: import("vue").Ref<string | undefined>;
47
- listData: import("vue").Ref<Record<string, any>>;
48
- defaultIndex: import("vue").Ref<string | number>;
49
- touchParams: import("vue").Ref<{
50
- startY: number;
51
- endY: number;
52
- startTime: number;
53
- endTime: number;
54
- lastY: number;
55
- }>;
56
- currIndex: import("vue").Ref<number>;
57
- transformY: import("vue").Ref<number>;
58
- scrollDistance: import("vue").Ref<number>;
59
- lineSpacing: import("vue").Ref<number>;
60
- rotation: import("vue").Ref<number>;
61
- timer: import("vue").Ref<null>;
62
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "change")[], "click" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
63
- dataType: StringConstructor;
64
- itemShow: {
65
- type: BooleanConstructor;
66
- default: boolean;
67
- };
68
- listData: {
69
- type: ObjectConstructor;
70
- default: () => {};
71
- };
72
- readonly: {
73
- type: BooleanConstructor;
74
- default: boolean;
75
- };
76
- defaultIndex: {
77
- type: (NumberConstructor | StringConstructor)[];
78
- default: number;
79
- };
80
- }>> & {
81
- onClick?: ((...args: any[]) => any) | undefined;
82
- onChange?: ((...args: any[]) => any) | undefined;
83
- }, {
84
- readonly: boolean;
85
- itemShow: boolean;
86
- listData: Record<string, any>;
87
- defaultIndex: string | number;
88
- }>>;
89
- export default _sfc_main;
90
-
91
- declare module 'vue' {
92
- interface GlobalComponents {
93
- NutOldPicker: typeof _sfc_main;
94
- }
95
- }
96
-