@nutui/nutui 3.1.6 → 3.1.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 (92) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/nutui.d.ts +7 -1
  3. package/dist/nutui.es.js +1097 -517
  4. package/dist/nutui.umd.js +1158 -571
  5. package/dist/packages/_es/ActionSheet.js +158 -0
  6. package/dist/packages/_es/Address.js +525 -0
  7. package/dist/packages/_es/Avatar.js +87 -0
  8. package/dist/packages/_es/BackTop.js +159 -0
  9. package/dist/packages/_es/Badge.js +90 -0
  10. package/dist/packages/_es/Barrage.js +118 -0
  11. package/dist/packages/_es/Button.js +124 -0
  12. package/dist/packages/_es/Calendar.js +700 -0
  13. package/dist/packages/_es/Cell.js +95 -0
  14. package/dist/packages/_es/CellGroup.js +42 -0
  15. package/dist/packages/_es/Checkbox.js +109 -0
  16. package/dist/packages/_es/CheckboxGroup.js +62 -0
  17. package/dist/packages/_es/CircleProgress.js +109 -0
  18. package/dist/packages/_es/Col.js +53 -0
  19. package/dist/packages/_es/Collapse.js +89 -0
  20. package/dist/packages/_es/CollapseItem.js +257 -0
  21. package/dist/packages/_es/CountDown.js +224 -0
  22. package/dist/packages/_es/CountUp.js +547 -0
  23. package/dist/packages/_es/DatePicker.js +282 -0
  24. package/dist/packages/_es/Dialog.js +313 -0
  25. package/dist/packages/_es/Divider.js +49 -0
  26. package/dist/packages/_es/Drag.js +198 -0
  27. package/dist/packages/_es/Elevator.js +207 -0
  28. package/dist/packages/_es/FixedNav.js +127 -0
  29. package/dist/packages/_es/Icon.js +44 -0
  30. package/dist/packages/_es/ImagePreview.js +109 -0
  31. package/dist/packages/_es/InfiniteLoading.js +265 -0
  32. package/dist/packages/_es/Input.js +183 -0
  33. package/dist/packages/_es/InputNumber.js +172 -0
  34. package/dist/packages/_es/Layout.js +10 -0
  35. package/dist/packages/_es/MenuItem.js +180 -0
  36. package/dist/packages/_es/Navbar.js +160 -0
  37. package/dist/packages/_es/NoticeBar.js +389 -0
  38. package/dist/packages/_es/Notify.js +233 -0
  39. package/dist/packages/_es/NumberKeyboard.js +248 -0
  40. package/dist/packages/_es/OverLay.js +118 -0
  41. package/dist/packages/_es/Pagination.js +163 -0
  42. package/dist/packages/_es/Picker.js +485 -0
  43. package/dist/packages/_es/Popover.js +157 -0
  44. package/dist/packages/_es/Popup.js +268 -0
  45. package/dist/packages/_es/Price.js +104 -0
  46. package/dist/packages/_es/Progress.js +131 -0
  47. package/dist/packages/_es/Radio.js +72 -0
  48. package/dist/packages/_es/RadioGroup.js +37 -0
  49. package/dist/packages/_es/Range.js +350 -0
  50. package/dist/packages/_es/Rate.js +129 -0
  51. package/dist/packages/_es/Row.js +61 -0
  52. package/dist/packages/_es/ShortPassword.js +221 -0
  53. package/dist/packages/_es/Signature.js +167 -0
  54. package/dist/packages/_es/Step.js +116 -0
  55. package/dist/packages/_es/Steps.js +52 -0
  56. package/dist/packages/_es/Swipe.js +193 -0
  57. package/dist/packages/_es/Swiper.js +429 -0
  58. package/dist/packages/_es/SwiperItem.js +60 -0
  59. package/dist/packages/_es/Switch.js +90 -0
  60. package/dist/packages/_es/Tab.js +179 -0
  61. package/dist/packages/_es/TabPane.js +42 -0
  62. package/dist/packages/_es/TabPanel.js +30 -0
  63. package/dist/packages/_es/Tabbar.js +73 -0
  64. package/dist/packages/_es/TabbarItem.js +142 -0
  65. package/dist/packages/_es/Tag.js +98 -0
  66. package/dist/packages/_es/TextArea.js +127 -0
  67. package/dist/packages/_es/Toast.js +317 -0
  68. package/dist/packages/_es/Uploader.js +400 -0
  69. package/dist/packages/_es/Video.js +405 -0
  70. package/dist/packages/_es/component.js +26 -0
  71. package/dist/packages/_es/index.js +64 -0
  72. package/dist/packages/_es/index2.js +13 -0
  73. package/dist/packages/_es/plugin-vue_export-helper.js +12 -0
  74. package/dist/packages/_es/pxCheck.js +9 -0
  75. package/dist/packages/_es/raf.js +19 -0
  76. package/dist/packages/avatar/index.scss +0 -1
  77. package/dist/packages/badge/index.scss +35 -0
  78. package/dist/packages/calendar/index.scss +13 -0
  79. package/dist/packages/imagepreview/index.scss +48 -0
  80. package/dist/packages/input/index.scss +14 -7
  81. package/dist/packages/pagination/index.scss +51 -0
  82. package/dist/packages/popover/index.scss +159 -0
  83. package/dist/packages/shortpassword/index.scss +19 -7
  84. package/dist/packages/tabpane/index.scss +1 -0
  85. package/dist/packages/tabs/index.scss +1 -0
  86. package/dist/packages/tag/index.scss +47 -0
  87. package/dist/packages/uploader/index.scss +0 -1
  88. package/dist/style.css +1 -1
  89. package/dist/style.es.js +2 -1
  90. package/dist/styles/themes/default.scss +35 -28
  91. package/dist/styles/variables.scss +55 -32
  92. package/package.json +7 -7
@@ -0,0 +1,485 @@
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
+ /*!
21
+ * @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
22
+ * (c) 2021 @jdf2e.
23
+ * Released under the MIT License.
24
+ */
25
+ import { ref, reactive, computed, onMounted, watch, toRefs, openBlock, createElementBlock, normalizeStyle, createElementVNode, Fragment, renderList, toDisplayString, toRaw, resolveComponent, normalizeClass, createVNode, withCtx } from "vue";
26
+ import { c as createComponent } from "./component.js";
27
+ import { u as useTouch } from "./index.js";
28
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
29
+ import Popup, { popupProps } from "./Popup.js";
30
+ import "./OverLay.js";
31
+ import "./Icon.js";
32
+ import "./pxCheck.js";
33
+ const commonProps = {
34
+ listData: {
35
+ type: Array,
36
+ default: () => {
37
+ return [];
38
+ }
39
+ },
40
+ readonly: {
41
+ type: Boolean,
42
+ default: false
43
+ },
44
+ visibleItemCount: {
45
+ type: [Number, String],
46
+ default: 7
47
+ },
48
+ defaultIndex: {
49
+ type: [Number, String],
50
+ default: 0
51
+ },
52
+ itemHeight: {
53
+ type: [Number, String],
54
+ default: 35
55
+ }
56
+ };
57
+ const MOMENTUM_LIMIT_DISTANCE = 15;
58
+ const MOMENTUM_LIMIT_TIME = 300;
59
+ const DEFAULT_DURATION = 200;
60
+ const { create: create$1 } = createComponent("picker-column");
61
+ function range(num, min, max) {
62
+ return Math.min(Math.max(num, min), max);
63
+ }
64
+ function stopPropagation(event) {
65
+ event.stopPropagation();
66
+ }
67
+ function preventDefault(event, isStopPropagation) {
68
+ if (typeof event.cancelable !== "boolean" || event.cancelable) {
69
+ event.preventDefault();
70
+ }
71
+ if (isStopPropagation) {
72
+ stopPropagation(event);
73
+ }
74
+ }
75
+ function getElementTranslateY(element) {
76
+ const style = window.getComputedStyle(element);
77
+ const transform = style.transform || style.webkitTransform;
78
+ const translateY = transform.slice(7, transform.length - 1).split(", ")[5];
79
+ return Number(translateY);
80
+ }
81
+ function isObject(val) {
82
+ return val !== null && typeof val === "object";
83
+ }
84
+ function isOptionDisabled(option) {
85
+ return isObject(option) && option.disabled;
86
+ }
87
+ const _sfc_main$1 = create$1({
88
+ props: __spreadValues({
89
+ dataType: String
90
+ }, commonProps),
91
+ emits: ["click", "change"],
92
+ setup(props, { emit }) {
93
+ const wrapper = ref();
94
+ const state = reactive({
95
+ index: props.defaultIndex,
96
+ offset: 0,
97
+ duration: 0,
98
+ options: props.listData,
99
+ moving: false,
100
+ startOffset: 0,
101
+ touchStartTime: 0,
102
+ momentumOffset: 0,
103
+ transitionEndTrigger: null
104
+ });
105
+ const touch = useTouch();
106
+ const wrapperStyle = computed(() => ({
107
+ transform: `translate3d(0, ${state.offset + baseOffset()}px, 0)`,
108
+ transitionDuration: `${state.duration}ms`,
109
+ transitionProperty: state.duration ? "all" : "none"
110
+ }));
111
+ const getIndexByOffset = (offset) => {
112
+ return range(Math.round(-offset / +props.itemHeight), 0, state.options.length - 1);
113
+ };
114
+ const baseOffset = () => {
115
+ return +props.itemHeight * (+props.visibleItemCount - 1) / 2;
116
+ };
117
+ const stopMomentum = () => {
118
+ state.moving = false;
119
+ state.duration = 0;
120
+ if (state.transitionEndTrigger) {
121
+ state.transitionEndTrigger();
122
+ state.transitionEndTrigger = null;
123
+ }
124
+ };
125
+ const adjustIndex = (index) => {
126
+ index = range(index, 0, state.options.length);
127
+ for (let i = index; i < state.options.length; i++) {
128
+ if (!isOptionDisabled(state.options[i]))
129
+ return i;
130
+ }
131
+ for (let i = index - 1; i >= 0; i--) {
132
+ if (!isOptionDisabled(state.options[i]))
133
+ return i;
134
+ }
135
+ };
136
+ const setIndex = (index, emitChange = false) => {
137
+ index = adjustIndex(index) || 0;
138
+ const offset = -index * +props.itemHeight;
139
+ const trigger = () => {
140
+ if (index !== state.index) {
141
+ state.index = index;
142
+ if (emitChange) {
143
+ emit("change", index);
144
+ }
145
+ }
146
+ };
147
+ if (state.moving && offset !== state.offset) {
148
+ state.transitionEndTrigger = trigger;
149
+ } else {
150
+ trigger();
151
+ }
152
+ state.offset = offset;
153
+ };
154
+ const momentum = (distance, duration) => {
155
+ const speed = Math.abs(distance / duration);
156
+ distance = state.offset + speed / 0.03 * (distance < 0 ? -1 : 1);
157
+ const index = getIndexByOffset(distance);
158
+ setIndex(index, true);
159
+ };
160
+ const onTouchStart = (event) => {
161
+ if (props.readonly) {
162
+ return;
163
+ }
164
+ touch.start(event);
165
+ if (state.moving) {
166
+ const translateY = getElementTranslateY(wrapper.value);
167
+ state.offset = Math.min(0, translateY - baseOffset());
168
+ state.startOffset = state.offset;
169
+ } else {
170
+ state.startOffset = state.offset;
171
+ }
172
+ state.duration = 0;
173
+ state.touchStartTime = Date.now();
174
+ state.momentumOffset = state.startOffset;
175
+ state.transitionEndTrigger = null;
176
+ };
177
+ const onTouchMove = (event) => {
178
+ if (props.readonly) {
179
+ return;
180
+ }
181
+ state.moving = true;
182
+ touch.move(event);
183
+ if (touch.isVertical()) {
184
+ state.moving = true;
185
+ preventDefault(event, true);
186
+ }
187
+ const moveOffset = state.startOffset + touch.deltaY.value;
188
+ if (moveOffset > props.itemHeight) {
189
+ state.offset = props.itemHeight;
190
+ } else {
191
+ state.offset = state.startOffset + touch.deltaY.value;
192
+ }
193
+ const now = Date.now();
194
+ if (now - state.touchStartTime > MOMENTUM_LIMIT_TIME) {
195
+ state.touchStartTime = now;
196
+ state.momentumOffset = state.offset;
197
+ }
198
+ };
199
+ const onTouchEnd = () => {
200
+ const index = getIndexByOffset(state.offset);
201
+ state.duration = DEFAULT_DURATION;
202
+ setIndex(index, true);
203
+ const distance = state.offset - state.momentumOffset;
204
+ const duration = Date.now() - state.touchStartTime;
205
+ const allowMomentum = duration < MOMENTUM_LIMIT_TIME && Math.abs(distance) > MOMENTUM_LIMIT_DISTANCE;
206
+ if (allowMomentum) {
207
+ momentum(distance, duration);
208
+ return;
209
+ }
210
+ };
211
+ onMounted(() => {
212
+ setIndex(+props.defaultIndex);
213
+ });
214
+ watch(() => props.listData, (val) => {
215
+ if (val) {
216
+ state.options = val;
217
+ }
218
+ });
219
+ watch(() => props.defaultIndex, (val) => {
220
+ setIndex(+val);
221
+ });
222
+ return __spreadProps(__spreadValues({}, toRefs(state)), {
223
+ wrapper,
224
+ onTouchStart,
225
+ onTouchMove,
226
+ onTouchEnd,
227
+ wrapperStyle,
228
+ stopMomentum,
229
+ columns: state.options,
230
+ height: Number(props.visibleItemCount) * +props.itemHeight
231
+ });
232
+ }
233
+ });
234
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
235
+ return openBlock(), createElementBlock("view", {
236
+ class: "nut-picker__content",
237
+ style: normalizeStyle({ height: _ctx.height + "px" }),
238
+ onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
239
+ onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
240
+ onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
241
+ onTouchcancel: _cache[3] || (_cache[3] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
242
+ onTransitionend: _cache[4] || (_cache[4] = (...args) => _ctx.stopMomentum && _ctx.stopMomentum(...args))
243
+ }, [
244
+ createElementVNode("view", {
245
+ class: "nut-picker__wrapper",
246
+ ref: "wrapper",
247
+ style: normalizeStyle(_ctx.wrapperStyle)
248
+ }, [
249
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item, index) => {
250
+ return openBlock(), createElementBlock("view", {
251
+ class: "nut-picker__item",
252
+ key: index
253
+ }, toDisplayString(_ctx.dataType === "cascade" ? item.text : item), 1);
254
+ }), 128))
255
+ ], 4)
256
+ ], 36);
257
+ }
258
+ var column = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
259
+ const { create, componentName } = createComponent("picker");
260
+ const _sfc_main = create({
261
+ components: {
262
+ [column.name]: column,
263
+ [Popup.name]: Popup
264
+ },
265
+ props: __spreadValues(__spreadProps(__spreadValues({}, popupProps), {
266
+ title: {
267
+ type: String,
268
+ default: ""
269
+ },
270
+ cancelText: {
271
+ type: String,
272
+ default: "\u53D6\u6D88"
273
+ },
274
+ okText: {
275
+ type: String,
276
+ default: "\u786E\u5B9A"
277
+ }
278
+ }), commonProps),
279
+ emits: ["close", "change", "confirm", "update:visible"],
280
+ setup(props, { emit }) {
281
+ const childrenKey = "children";
282
+ const valuesKey = "values";
283
+ const state = reactive({
284
+ show: false,
285
+ formattedColumns: props.listData,
286
+ defaultIndex: props.defaultIndex
287
+ });
288
+ let _defaultIndex = props.defaultIndex;
289
+ let defaultIndexList = [];
290
+ const classes = computed(() => {
291
+ const prefixCls = componentName;
292
+ return {
293
+ [prefixCls]: true
294
+ };
295
+ });
296
+ const top = computed(() => {
297
+ return Number(+props.visibleItemCount - 1) / 2 * +props.itemHeight;
298
+ });
299
+ const height = computed(() => {
300
+ return Number(props.visibleItemCount) * +props.itemHeight;
301
+ });
302
+ const dataType = computed(() => {
303
+ const firstColumn = state.formattedColumns[0];
304
+ if (typeof firstColumn === "object") {
305
+ if (firstColumn[childrenKey]) {
306
+ return "cascade";
307
+ } else if (firstColumn == null ? void 0 : firstColumn[valuesKey]) {
308
+ addDefaultIndexList(props.listData);
309
+ return "multipleColumns";
310
+ }
311
+ }
312
+ return "text";
313
+ });
314
+ const columnList = computed(() => {
315
+ if (dataType.value === "text") {
316
+ return [
317
+ { values: state.formattedColumns, defaultIndex: state.defaultIndex }
318
+ ];
319
+ } else if (dataType.value === "multipleColumns") {
320
+ return state.formattedColumns;
321
+ } else if (dataType.value === "cascade") {
322
+ return formatCascade(state.formattedColumns, state.defaultIndex);
323
+ }
324
+ return state.formattedColumns;
325
+ });
326
+ const addDefaultIndexList = (listData) => {
327
+ defaultIndexList = [];
328
+ listData.forEach((res) => {
329
+ defaultIndexList.push(res.defaultIndex || 0);
330
+ });
331
+ };
332
+ const formatCascade = (listData, defaultIndex) => {
333
+ const formatted = [];
334
+ let children = listData;
335
+ children.defaultIndex = defaultIndex;
336
+ while (children) {
337
+ formatted.push({
338
+ values: children,
339
+ defaultIndex: children.defaultIndex || 0
340
+ });
341
+ children = children == null ? void 0 : children[children.defaultIndex || 0].children;
342
+ }
343
+ addDefaultIndexList(formatted);
344
+ return formatted;
345
+ };
346
+ const getCascadeData = (listData, defaultIndex) => {
347
+ var _a;
348
+ let arr = listData;
349
+ arr.defaultIndex = defaultIndex;
350
+ const dataList = [];
351
+ while (arr) {
352
+ const item = arr[(_a = arr.defaultIndex) != null ? _a : 0];
353
+ dataList.push(item.text);
354
+ arr = item.children;
355
+ }
356
+ return dataList;
357
+ };
358
+ const close = () => {
359
+ emit("close");
360
+ emit("update:visible", false);
361
+ };
362
+ const changeHandler = (columnIndex, dataIndex) => {
363
+ if (dataType.value === "cascade") {
364
+ let cursor = state.formattedColumns;
365
+ if (columnIndex === 0) {
366
+ state.defaultIndex = dataIndex;
367
+ }
368
+ let i = 0;
369
+ while (cursor) {
370
+ if (i === columnIndex) {
371
+ cursor.defaultIndex = dataIndex;
372
+ } else if (i > columnIndex) {
373
+ cursor.defaultIndex = 0;
374
+ }
375
+ cursor = cursor[cursor.defaultIndex || 0].children;
376
+ i++;
377
+ }
378
+ } else if (dataType.value === "text") {
379
+ _defaultIndex = dataIndex;
380
+ } else if (dataType.value === "multipleColumns") {
381
+ defaultIndexList[columnIndex] = dataIndex;
382
+ const val = defaultIndexList.map((res, i) => toRaw(state.formattedColumns)[i].values[res]);
383
+ emit("change", val);
384
+ }
385
+ };
386
+ const confirm = () => {
387
+ if (dataType.value === "text") {
388
+ state.defaultIndex = _defaultIndex;
389
+ emit("confirm", state.formattedColumns[_defaultIndex]);
390
+ } else if (dataType.value === "multipleColumns") {
391
+ for (let i = 0; i < defaultIndexList.length; i++) {
392
+ state.formattedColumns[i].defaultIndex = defaultIndexList[i];
393
+ }
394
+ const checkedArr = toRaw(state.formattedColumns).map((res) => res.values && res.values[res.defaultIndex]);
395
+ emit("confirm", checkedArr);
396
+ } else if (dataType.value === "cascade") {
397
+ emit("confirm", getCascadeData(toRaw(state.formattedColumns), state.defaultIndex));
398
+ }
399
+ emit("update:visible", false);
400
+ };
401
+ watch(() => props.visible, (val) => {
402
+ state.show = val;
403
+ });
404
+ watch(() => props.listData, (val) => {
405
+ state.formattedColumns = val;
406
+ });
407
+ return __spreadProps(__spreadValues({
408
+ classes
409
+ }, toRefs(state)), {
410
+ column,
411
+ dataType,
412
+ columnList,
413
+ top,
414
+ height,
415
+ close,
416
+ changeHandler,
417
+ confirm
418
+ });
419
+ }
420
+ });
421
+ const _hoisted_1 = { class: "nut-picker__bar" };
422
+ const _hoisted_2 = { class: "nut-picker__column" };
423
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
424
+ const _component_nut_picker_column = resolveComponent("nut-picker-column");
425
+ const _component_nut_popup = resolveComponent("nut-popup");
426
+ return openBlock(), createElementBlock("view", {
427
+ class: normalizeClass(_ctx.classes)
428
+ }, [
429
+ createVNode(_component_nut_popup, {
430
+ position: "bottom",
431
+ style: normalizeStyle({ height: _ctx.height + 56 + "px" }),
432
+ visible: _ctx.show,
433
+ "onUpdate:visible": _cache[2] || (_cache[2] = ($event) => _ctx.show = $event),
434
+ teleport: _ctx.teleport,
435
+ "lock-scroll": _ctx.lockScroll,
436
+ "close-on-click-overlay": _ctx.closeOnClickOverlay,
437
+ onClose: _ctx.close
438
+ }, {
439
+ default: withCtx(() => [
440
+ createElementVNode("view", _hoisted_1, [
441
+ createElementVNode("view", {
442
+ class: "nut-picker__left nut-picker__button",
443
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.close && _ctx.close(...args))
444
+ }, toDisplayString(_ctx.cancelText), 1),
445
+ createElementVNode("view", null, toDisplayString(_ctx.title), 1),
446
+ createElementVNode("view", {
447
+ class: "nut-picker__button",
448
+ onClick: _cache[1] || (_cache[1] = ($event) => _ctx.confirm())
449
+ }, toDisplayString(_ctx.okText), 1)
450
+ ]),
451
+ createElementVNode("view", _hoisted_2, [
452
+ createElementVNode("view", {
453
+ class: "nut-picker__mask",
454
+ style: normalizeStyle({ backgroundSize: `100% ${_ctx.top}px` })
455
+ }, null, 4),
456
+ createElementVNode("view", {
457
+ class: "nut-picker__hairline",
458
+ style: normalizeStyle({ top: ` ${_ctx.top}px` })
459
+ }, null, 4),
460
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columnList, (item, columnIndex) => {
461
+ return openBlock(), createElementBlock("view", {
462
+ class: "nut-picker__columnitem",
463
+ key: columnIndex
464
+ }, [
465
+ createVNode(_component_nut_picker_column, {
466
+ "list-data": item.values,
467
+ readonly: _ctx.readonly,
468
+ "default-index": item.defaultIndex,
469
+ "visible-item-count": _ctx.visibleItemCount,
470
+ "item-height": _ctx.itemHeight,
471
+ "data-type": _ctx.dataType,
472
+ onChange: (dataIndex) => {
473
+ _ctx.changeHandler(columnIndex, dataIndex);
474
+ }
475
+ }, null, 8, ["list-data", "readonly", "default-index", "visible-item-count", "item-height", "data-type", "onChange"])
476
+ ]);
477
+ }), 128))
478
+ ])
479
+ ]),
480
+ _: 1
481
+ }, 8, ["style", "visible", "teleport", "lock-scroll", "close-on-click-overlay", "onClose"])
482
+ ], 2);
483
+ }
484
+ var picker = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
485
+ export { picker as default };
@@ -0,0 +1,157 @@
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
+ /*!
21
+ * @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
22
+ * (c) 2021 @jdf2e.
23
+ * Released under the MIT License.
24
+ */
25
+ import { ref, toRefs, computed, onMounted, watch, resolveComponent, openBlock, createElementBlock, normalizeClass, renderSlot, Fragment, createElementVNode, renderList, createVNode, createCommentVNode, toDisplayString } from "vue";
26
+ import { c as createComponent } from "./component.js";
27
+ import Popup, { popupProps } from "./Popup.js";
28
+ import Button from "./Button.js";
29
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
30
+ import "./OverLay.js";
31
+ import "./Icon.js";
32
+ import "./pxCheck.js";
33
+ const { componentName, create } = createComponent("popover");
34
+ const _sfc_main = create({
35
+ inheritAttrs: false,
36
+ components: {
37
+ [Popup.name]: Popup,
38
+ [Button.name]: Button
39
+ },
40
+ props: __spreadProps(__spreadValues({}, popupProps), {
41
+ list: {
42
+ type: Array,
43
+ default: []
44
+ },
45
+ theme: {
46
+ type: String,
47
+ default: "light"
48
+ },
49
+ location: {
50
+ type: String,
51
+ default: "bottom"
52
+ }
53
+ }),
54
+ emits: ["update", "update:visible", "close", "choose", "openPopover"],
55
+ setup(props, { emit }) {
56
+ const showPopup = ref(props.visible);
57
+ const { theme, location } = toRefs(props);
58
+ const classes = computed(() => {
59
+ const prefixCls = componentName;
60
+ return {
61
+ [prefixCls]: true,
62
+ [`${prefixCls}--${theme.value}`]: theme.value
63
+ };
64
+ });
65
+ const popoverContent = computed(() => {
66
+ const prefixCls = "popoverContent";
67
+ return {
68
+ [prefixCls]: true,
69
+ [`${prefixCls}--${location.value}`]: location.value
70
+ };
71
+ });
72
+ const popoverArrow = computed(() => {
73
+ const prefixCls = "popoverArrow";
74
+ return {
75
+ [prefixCls]: true,
76
+ [`${prefixCls}--${location.value}`]: location.value
77
+ };
78
+ });
79
+ onMounted(() => {
80
+ });
81
+ watch(() => props.visible, (value) => {
82
+ showPopup.value = value;
83
+ });
84
+ const update = (val) => {
85
+ emit("update", val);
86
+ emit("update:visible", val);
87
+ };
88
+ const openPopover = (event) => {
89
+ event.stopPropagation();
90
+ event.preventDefault();
91
+ update(!props.visible);
92
+ emit("open");
93
+ };
94
+ const closePopover = (event) => {
95
+ event.stopPropagation();
96
+ event.preventDefault();
97
+ emit("close");
98
+ emit("update:visible", false);
99
+ };
100
+ const chooseItem = (event, item) => {
101
+ event.stopPropagation();
102
+ event.preventDefault();
103
+ emit("choose");
104
+ };
105
+ return {
106
+ classes,
107
+ showPopup,
108
+ openPopover,
109
+ popoverContent,
110
+ popoverArrow,
111
+ closePopover,
112
+ chooseItem
113
+ };
114
+ }
115
+ });
116
+ const _hoisted_1 = ["onClick"];
117
+ const _hoisted_2 = { class: "title-name" };
118
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
119
+ const _component_nut_icon = resolveComponent("nut-icon");
120
+ return openBlock(), createElementBlock("view", {
121
+ onClick: _cache[1] || (_cache[1] = (...args) => _ctx.openPopover && _ctx.openPopover(...args)),
122
+ class: normalizeClass(_ctx.classes)
123
+ }, [
124
+ renderSlot(_ctx.$slots, "reference"),
125
+ _ctx.showPopup ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
126
+ createElementVNode("view", {
127
+ class: "more-background",
128
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.closePopover && _ctx.closePopover(...args))
129
+ }),
130
+ createElementVNode("view", {
131
+ class: normalizeClass(_ctx.popoverContent)
132
+ }, [
133
+ createElementVNode("view", {
134
+ class: normalizeClass(_ctx.popoverArrow)
135
+ }, null, 2),
136
+ renderSlot(_ctx.$slots, "content"),
137
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.list, (item) => {
138
+ return openBlock(), createElementBlock("view", {
139
+ key: item.name,
140
+ class: normalizeClass({ "title-item": true, disabled: item.disabled }),
141
+ onClick: ($event) => _ctx.chooseItem(_ctx.e, item)
142
+ }, [
143
+ item.icon ? renderSlot(_ctx.$slots, "default", { key: 0 }, () => [
144
+ createVNode(_component_nut_icon, {
145
+ class: "item-img",
146
+ name: item.icon
147
+ }, null, 8, ["name"])
148
+ ]) : createCommentVNode("", true),
149
+ createElementVNode("view", _hoisted_2, toDisplayString(item.name), 1)
150
+ ], 10, _hoisted_1);
151
+ }), 128))
152
+ ], 2)
153
+ ], 64)) : createCommentVNode("", true)
154
+ ], 2);
155
+ }
156
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
157
+ export { index as default };