@nutui/nutui-react-taro 3.0.13 → 3.0.15

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 (126) hide show
  1. package/CHANGELOG.md +45 -12
  2. package/dist/cjs/packages/button/style/button.scss +3 -0
  3. package/dist/cjs/packages/button/style/style.css +3 -3
  4. package/dist/cjs/packages/button/style/style.harmony.css +12 -0
  5. package/dist/cjs/packages/button/style-jmapp/button.scss +3 -0
  6. package/dist/cjs/packages/button/style-jmapp/style.css +3 -3
  7. package/dist/cjs/packages/button/style-jrkf/button.scss +3 -0
  8. package/dist/cjs/packages/button/style-jrkf/style.css +3 -3
  9. package/dist/cjs/packages/calendarcard/calendarcard.js +10 -4
  10. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  11. package/dist/cjs/packages/datepicker/utils.js +23 -38
  12. package/dist/cjs/packages/dialog/dialog.js +2 -7
  13. package/dist/cjs/packages/elevator/elevator.d.ts +3 -20
  14. package/dist/cjs/packages/elevator/elevator.js +119 -91
  15. package/dist/cjs/packages/elevator/index.d.ts +1 -1
  16. package/dist/cjs/packages/elevator/style/elevator.scss +61 -33
  17. package/dist/cjs/packages/elevator/style/style.css +65 -40
  18. package/dist/cjs/packages/elevator/style/style.harmony.css +69 -41
  19. package/dist/cjs/packages/elevator/style-jmapp/elevator.scss +61 -33
  20. package/dist/cjs/packages/elevator/style-jmapp/style.css +56 -31
  21. package/dist/cjs/packages/elevator/style-jrkf/elevator.scss +61 -33
  22. package/dist/cjs/packages/elevator/style-jrkf/style.css +56 -31
  23. package/dist/cjs/packages/formitem/formitem.js +2 -2
  24. package/dist/cjs/packages/formitem/style/formitem.scss +14 -15
  25. package/dist/cjs/packages/formitem/style/style.css +9 -11
  26. package/dist/cjs/packages/formitem/style/style.harmony.css +8 -10
  27. package/dist/cjs/packages/formitem/style-jmapp/formitem.scss +14 -15
  28. package/dist/cjs/packages/formitem/style-jmapp/style.css +8 -10
  29. package/dist/cjs/packages/formitem/style-jrkf/formitem.scss +14 -15
  30. package/dist/cjs/packages/formitem/style-jrkf/style.css +8 -10
  31. package/dist/cjs/packages/image/image.js +2 -2
  32. package/dist/cjs/packages/input/input.js +1 -1
  33. package/dist/cjs/packages/navbar/style/navbar.scss +2 -0
  34. package/dist/cjs/packages/navbar/style/style.css +2 -0
  35. package/dist/cjs/packages/navbar/style/style.harmony.css +2 -0
  36. package/dist/cjs/packages/navbar/style-jmapp/navbar.scss +2 -0
  37. package/dist/cjs/packages/navbar/style-jmapp/style.css +2 -0
  38. package/dist/cjs/packages/navbar/style-jrkf/navbar.scss +2 -0
  39. package/dist/cjs/packages/navbar/style-jrkf/style.css +2 -0
  40. package/dist/cjs/packages/noticebar/noticebar.js +1 -1
  41. package/dist/cjs/packages/overlay/style/overlay.scss +0 -1
  42. package/dist/cjs/packages/overlay/style/style.css +0 -1
  43. package/dist/cjs/packages/overlay/style/style.harmony.css +0 -1
  44. package/dist/cjs/packages/overlay/style-jmapp/overlay.scss +0 -1
  45. package/dist/cjs/packages/overlay/style-jmapp/style.css +0 -1
  46. package/dist/cjs/packages/overlay/style-jrkf/overlay.scss +0 -1
  47. package/dist/cjs/packages/overlay/style-jrkf/style.css +0 -1
  48. package/dist/cjs/packages/pickerview/pickerroller.js +9 -1
  49. package/dist/cjs/packages/switch/switch.js +0 -1
  50. package/dist/cjs/packages/tabpane/style/style.css +1 -1
  51. package/dist/cjs/packages/tabpane/style/tabpane.scss +1 -1
  52. package/dist/cjs/packages/tabpane/style-jmapp/style.css +1 -1
  53. package/dist/cjs/packages/tabpane/style-jmapp/tabpane.scss +1 -1
  54. package/dist/cjs/packages/tabpane/style-jrkf/style.css +1 -1
  55. package/dist/cjs/packages/tabpane/style-jrkf/tabpane.scss +1 -1
  56. package/dist/cjs/types/spec/calendarcard/base.d.ts +1 -0
  57. package/dist/cjs/types/spec/datepicker/base.d.ts +1 -1
  58. package/dist/cjs/types/spec/elevator/base.d.ts +5 -2
  59. package/dist/es/packages/button/style/button.scss +3 -0
  60. package/dist/es/packages/button/style/style.css +3 -3
  61. package/dist/es/packages/button/style/style.harmony.css +12 -0
  62. package/dist/es/packages/button/style-jmapp/button.scss +3 -0
  63. package/dist/es/packages/button/style-jmapp/style.css +3 -3
  64. package/dist/es/packages/button/style-jrkf/button.scss +3 -0
  65. package/dist/es/packages/button/style-jrkf/style.css +3 -3
  66. package/dist/es/packages/calendarcard/calendarcard.js +11 -5
  67. package/dist/es/packages/configprovider/types.d.ts +1 -1
  68. package/dist/es/packages/datepicker/utils.js +23 -38
  69. package/dist/es/packages/dialog/dialog.js +2 -7
  70. package/dist/es/packages/elevator/elevator.d.ts +3 -20
  71. package/dist/es/packages/elevator/elevator.js +119 -91
  72. package/dist/es/packages/elevator/index.d.ts +1 -1
  73. package/dist/es/packages/elevator/style/elevator.scss +61 -33
  74. package/dist/es/packages/elevator/style/style.css +65 -40
  75. package/dist/es/packages/elevator/style/style.harmony.css +69 -41
  76. package/dist/es/packages/elevator/style-jmapp/elevator.scss +61 -33
  77. package/dist/es/packages/elevator/style-jmapp/style.css +56 -31
  78. package/dist/es/packages/elevator/style-jrkf/elevator.scss +61 -33
  79. package/dist/es/packages/elevator/style-jrkf/style.css +56 -31
  80. package/dist/es/packages/formitem/formitem.js +2 -2
  81. package/dist/es/packages/formitem/style/formitem.scss +14 -15
  82. package/dist/es/packages/formitem/style/style.css +9 -11
  83. package/dist/es/packages/formitem/style/style.harmony.css +8 -10
  84. package/dist/es/packages/formitem/style-jmapp/formitem.scss +14 -15
  85. package/dist/es/packages/formitem/style-jmapp/style.css +8 -10
  86. package/dist/es/packages/formitem/style-jrkf/formitem.scss +14 -15
  87. package/dist/es/packages/formitem/style-jrkf/style.css +8 -10
  88. package/dist/es/packages/image/image.js +2 -2
  89. package/dist/es/packages/input/input.js +1 -1
  90. package/dist/es/packages/navbar/style/navbar.scss +2 -0
  91. package/dist/es/packages/navbar/style/style.css +2 -0
  92. package/dist/es/packages/navbar/style/style.harmony.css +2 -0
  93. package/dist/es/packages/navbar/style-jmapp/navbar.scss +2 -0
  94. package/dist/es/packages/navbar/style-jmapp/style.css +2 -0
  95. package/dist/es/packages/navbar/style-jrkf/navbar.scss +2 -0
  96. package/dist/es/packages/navbar/style-jrkf/style.css +2 -0
  97. package/dist/es/packages/noticebar/noticebar.js +1 -1
  98. package/dist/es/packages/overlay/style/overlay.scss +0 -1
  99. package/dist/es/packages/overlay/style/style.css +0 -1
  100. package/dist/es/packages/overlay/style/style.harmony.css +0 -1
  101. package/dist/es/packages/overlay/style-jmapp/overlay.scss +0 -1
  102. package/dist/es/packages/overlay/style-jmapp/style.css +0 -1
  103. package/dist/es/packages/overlay/style-jrkf/overlay.scss +0 -1
  104. package/dist/es/packages/overlay/style-jrkf/style.css +0 -1
  105. package/dist/es/packages/pickerview/pickerroller.js +9 -1
  106. package/dist/es/packages/switch/switch.js +0 -1
  107. package/dist/es/packages/tabpane/style/style.css +1 -1
  108. package/dist/es/packages/tabpane/style/tabpane.scss +1 -1
  109. package/dist/es/packages/tabpane/style-jmapp/style.css +1 -1
  110. package/dist/es/packages/tabpane/style-jmapp/tabpane.scss +1 -1
  111. package/dist/es/packages/tabpane/style-jrkf/style.css +1 -1
  112. package/dist/es/packages/tabpane/style-jrkf/tabpane.scss +1 -1
  113. package/dist/es/types/spec/calendarcard/base.d.ts +4 -0
  114. package/dist/es/types/spec/datepicker/base.d.ts +1 -1
  115. package/dist/es/types/spec/elevator/base.d.ts +15 -6
  116. package/dist/nutui.react.umd.js +904 -888
  117. package/dist/style-jmapp.css +1 -1
  118. package/dist/style-jmapp.scss +31 -31
  119. package/dist/style-jrkf.css +1 -1
  120. package/dist/style-jrkf.scss +29 -29
  121. package/dist/style.css +1 -1
  122. package/dist/style.scss +26 -26
  123. package/dist/styles/variables-jmapp.scss +14 -2
  124. package/dist/styles/variables-jrkf.scss +14 -2
  125. package/dist/styles/variables.scss +25 -45
  126. package/package.json +1 -1
@@ -65,8 +65,6 @@ export var BaseDialog = function(props) {
65
65
  var handleCancel = function(e) {
66
66
  e.stopPropagation();
67
67
  if (!(beforeCancel === null || beforeCancel === void 0 ? void 0 : beforeCancel())) return;
68
- if (!(beforeClose === null || beforeClose === void 0 ? void 0 : beforeClose())) return;
69
- onClose();
70
68
  onCancel();
71
69
  };
72
70
  var handleOk = /*#__PURE__*/ function() {
@@ -152,24 +150,21 @@ export var BaseDialog = function(props) {
152
150
  };
153
151
  var renderCloseIcon = function() {
154
152
  if (!closeIcon) return null;
155
- var handleCancel = function() {
156
- if (!(beforeCancel === null || beforeCancel === void 0 ? void 0 : beforeCancel())) return;
153
+ var handleClose = function() {
157
154
  if (!(beforeClose === null || beforeClose === void 0 ? void 0 : beforeClose())) return;
158
155
  onClose();
159
- onCancel();
160
156
  };
161
157
  var _obj;
162
158
  var closeClasses = classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix, "-close"), true), _define_property(_obj, "".concat(classPrefix, "-close-").concat(closeIconPosition), true), _obj));
163
159
  var systomIcon = closeIconPosition !== 'bottom' ? /*#__PURE__*/ React.createElement(Close, null) : /*#__PURE__*/ React.createElement(Failure, null);
164
160
  return /*#__PURE__*/ React.createElement(View, {
165
161
  className: closeClasses,
166
- onClick: handleCancel
162
+ onClick: handleClose
167
163
  }, /*#__PURE__*/ React.isValidElement(closeIcon) ? closeIcon : systomIcon);
168
164
  };
169
165
  var onHandleClickOverlay = function(e) {
170
166
  if (closeOnOverlayClick && visible && e.target === e.currentTarget) {
171
167
  var closed = onOverlayClick && onOverlayClick(e);
172
- closed && onClose();
173
168
  closed && onCancel();
174
169
  }
175
170
  };
@@ -1,23 +1,6 @@
1
1
  import React, { FunctionComponent } from 'react';
2
- import { BasicComponent } from "../../utils/typings";
3
- export declare const elevatorContext: React.Context<ElevatorData>;
4
- export interface ElevatorProps extends BasicComponent {
5
- height: number | string;
6
- floorKey: string;
7
- list: any[];
8
- sticky: boolean;
9
- spaceHeight: number;
10
- titleHeight: number;
11
- showKeys: boolean;
12
- onItemClick: (key: string, item: ElevatorData) => void;
13
- onIndexClick: (key: string) => void;
14
- }
15
- interface ElevatorData {
16
- name: string;
17
- id: number | string;
18
- [key: string]: string | number;
19
- }
20
- export declare const Elevator: FunctionComponent<Partial<ElevatorProps> & React.HTMLAttributes<HTMLDivElement>> & {
2
+ import { ElevatorItem, TaroElevatorProps } from "../../types";
3
+ export declare const elevatorContext: React.Context<ElevatorItem>;
4
+ export declare const Elevator: FunctionComponent<Partial<TaroElevatorProps> & React.HTMLAttributes<HTMLDivElement>> & {
21
5
  Context: typeof elevatorContext;
22
6
  };
23
- export {};
@@ -1,9 +1,10 @@
1
+ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
1
2
  import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
3
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
4
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
5
  import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
5
6
  import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
6
- import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
7
+ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
7
8
  import React, { useEffect, useRef, useState, createContext, useMemo } from "react";
8
9
  import Taro, { nextTick, createSelectorQuery } from "@tarojs/taro";
9
10
  import { ScrollView, View, Text } from "@tarojs/components";
@@ -11,25 +12,30 @@ import classNames from "classnames";
11
12
  import { ComponentDefaults } from "../../utils/typings";
12
13
  import { harmony } from "../../utils/taro/platform";
13
14
  import { useUuid } from "../../hooks/use-uuid";
15
+ import raf from "../../utils/raf";
16
+ import { usePropsValue } from "../../hooks";
14
17
  export var elevatorContext = /*#__PURE__*/ createContext({});
15
18
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
19
+ mode: 'horizontal',
16
20
  height: '200px',
17
21
  floorKey: 'title',
18
22
  list: [],
19
23
  sticky: false,
20
- spaceHeight: 23,
21
- titleHeight: 35,
24
+ spaceHeight: 18,
22
25
  showKeys: true,
23
- className: 'weapp-elevator'
26
+ defaultValue: undefined,
27
+ value: undefined
24
28
  });
25
29
  export var Elevator = function(props) {
26
- var _ref = _object_spread({}, defaultProps, props), height = _ref.height, floorKey = _ref.floorKey, list = _ref.list, sticky = _ref.sticky, spaceHeight = _ref.spaceHeight, titleHeight = _ref.titleHeight, showKeys = _ref.showKeys, className = _ref.className, style = _ref.style, onItemClick = _ref.onItemClick, onIndexClick = _ref.onIndexClick, children = _ref.children, rest = _object_without_properties(_ref, [
30
+ var _ref = _object_spread({}, defaultProps, props), value = _ref.value, defaultValue = _ref.defaultValue, mode = _ref.mode, height = _ref.height, floorKey = _ref.floorKey, list = _ref.list, sticky = _ref.sticky, spaceHeight = _ref.spaceHeight, showKeys = _ref.showKeys, className = _ref.className, style = _ref.style, onItemClick = _ref.onItemClick, onIndexClick = _ref.onIndexClick, children = _ref.children, rest = _object_without_properties(_ref, [
31
+ "value",
32
+ "defaultValue",
33
+ "mode",
27
34
  "height",
28
35
  "floorKey",
29
36
  "list",
30
37
  "sticky",
31
38
  "spaceHeight",
32
- "titleHeight",
33
39
  "showKeys",
34
40
  "className",
35
41
  "style",
@@ -39,25 +45,25 @@ export var Elevator = function(props) {
39
45
  ]);
40
46
  var uuid = useUuid();
41
47
  var classPrefix = 'nut-elevator';
42
- var listview = useRef(null);
43
48
  var initData = {
44
49
  anchorIndex: 0,
45
50
  listHeight: [],
46
- listGroup: [],
47
51
  scrollY: 0
48
52
  };
49
53
  var touchState = useRef({
50
54
  y1: 0,
51
55
  y2: 0
52
56
  });
53
- var _useState = _sliced_to_array(useState({}), 2), currentData = _useState[0], setCurrentData = _useState[1];
54
- var _useState1 = _sliced_to_array(useState(''), 2), currentKey = _useState1[0], setCurrentKey = _useState1[1];
55
- var _useState2 = _sliced_to_array(useState(0), 2), codeIndex = _useState2[0], setCodeIndex = _useState2[1];
56
- var _useState3 = _sliced_to_array(useState(false), 2), scrollStart = _useState3[0], setScrollStart = _useState3[1];
57
+ var _usePropsValue = _sliced_to_array(usePropsValue({
58
+ value: value,
59
+ defaultValue: defaultValue || {}
60
+ }), 2), currentData = _usePropsValue[0], setCurrentData = _usePropsValue[1];
61
+ var _useState = _sliced_to_array(useState(0), 2), codeIndex = _useState[0], setCodeIndex = _useState[1];
62
+ var _useState1 = _sliced_to_array(useState(false), 2), scrollStart = _useState1[0], setScrollStart = _useState1[1];
57
63
  var state = useRef(initData);
58
64
  var scrolling = useRef(false);
59
- var _useState4 = _sliced_to_array(useState(0), 2), scrollTop = _useState4[0], setScrollTop = _useState4[1];
60
- var _useState5 = _sliced_to_array(useState(0), 2), scrollY = _useState5[0], setScrollY = _useState5[1];
65
+ var _useState2 = _sliced_to_array(useState(0), 2), scrollTop = _useState2[0], setScrollTop = _useState2[1];
66
+ var _useState3 = _sliced_to_array(useState(0), 2), scrollY = _useState3[0], setScrollY = _useState3[1];
61
67
  var resetScrollState = function() {
62
68
  setScrollStart(false);
63
69
  };
@@ -68,39 +74,71 @@ export var Elevator = function(props) {
68
74
  return el.dataset.index;
69
75
  };
70
76
  var calculateHeight = function() {
71
- var height = 0;
72
- state.current.listHeight.push(height);
73
- for(var i = 0; i < state.current.listGroup.length; i++){
74
- var query = createSelectorQuery();
75
- query.selectAll(".".concat(classPrefix, "-").concat(uuid, " .nut-elevator-item-").concat(i)).boundingClientRect();
76
- // eslint-disable-next-line no-loop-func
77
- query.exec(function(res) {
78
- if (res[0][0]) height += res[0][0].height;
79
- state.current.listHeight.push(height);
80
- });
81
- }
82
- };
83
- var scrollTo = function(index) {
84
- if (!index && index !== 0) {
85
- return;
86
- }
87
- if (!state.current.listHeight.length) {
88
- calculateHeight();
89
- }
90
- var cacheIndex = index;
91
- if (index < 0) {
92
- cacheIndex = 0;
93
- }
94
- if (index > state.current.listHeight.length - 2) {
95
- cacheIndex = Math.max(0, state.current.listHeight.length - 2);
96
- }
97
- setCodeIndex(cacheIndex);
98
- var scrollTop = state.current.listHeight[cacheIndex];
99
- setScrollTop(scrollTop);
100
- if (sticky && scrollY !== scrollTop) {
101
- setScrollY(Math.floor(scrollTop) > 0 ? 1 : 0);
102
- }
77
+ state.current.listHeight = [
78
+ 0
79
+ ];
80
+ var query = createSelectorQuery();
81
+ query.selectAll("#".concat(classPrefix, "-").concat(uuid, " .").concat(classPrefix, "-list-item")).boundingClientRect().exec(function() {
82
+ var rect = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
83
+ if (rect[0] && rect[0].length) {
84
+ // rect[0] = rect[0].reverse()
85
+ state.current.listHeight = rect[0].reduce(function(acc, item, index) {
86
+ // 当前项的高度等于前面所有项的高度之和
87
+ var height = acc[index] + item.height;
88
+ acc.push(height);
89
+ return acc;
90
+ }, [
91
+ 0
92
+ ]);
93
+ }
94
+ });
103
95
  };
96
+ var scrollTo = /*#__PURE__*/ function() {
97
+ var _ref = _async_to_generator(function(index) {
98
+ var cacheIndex, scrollTop;
99
+ return _ts_generator(this, function(_state) {
100
+ switch(_state.label){
101
+ case 0:
102
+ if (!index && index !== 0) {
103
+ return [
104
+ 2
105
+ ];
106
+ }
107
+ if (!!state.current.listHeight.length) return [
108
+ 3,
109
+ 2
110
+ ];
111
+ return [
112
+ 4,
113
+ calculateHeight()
114
+ ];
115
+ case 1:
116
+ _state.sent();
117
+ _state.label = 2;
118
+ case 2:
119
+ cacheIndex = index;
120
+ if (index < 0) {
121
+ cacheIndex = 0;
122
+ }
123
+ if (index > state.current.listHeight.length - 2) {
124
+ cacheIndex = Math.max(0, state.current.listHeight.length - 2);
125
+ }
126
+ setCodeIndex(cacheIndex);
127
+ scrollTop = state.current.listHeight[cacheIndex];
128
+ setScrollTop(scrollTop);
129
+ if (mode === 'vertical' && sticky) {
130
+ setScrollY(Math.floor(scrollTop) > 0 ? 1 : 0);
131
+ }
132
+ return [
133
+ 2
134
+ ];
135
+ }
136
+ });
137
+ });
138
+ return function scrollTo(index) {
139
+ return _ref.apply(this, arguments);
140
+ };
141
+ }();
104
142
  var touchMove = function(e) {
105
143
  var firstTouch = e.touches[0];
106
144
  touchState.current.y2 = firstTouch.pageY;
@@ -125,39 +163,31 @@ export var Elevator = function(props) {
125
163
  var handleClickItem = function(key, item) {
126
164
  onItemClick && onItemClick(key, item);
127
165
  setCurrentData(item);
128
- setCurrentKey(key);
129
166
  };
130
167
  var handleClickIndex = function(key) {
131
168
  onIndexClick && onIndexClick(key);
132
169
  };
133
- var setListGroup = function() {
134
- if (listview.current) {
135
- createSelectorQuery().selectAll(".".concat(classPrefix, "-").concat(uuid, " .nut-elevator-list-item")).node(function(el) {
136
- state.current.listGroup = _to_consumable_array(Object.keys(el));
137
- calculateHeight();
138
- }).exec();
139
- }
140
- };
141
170
  var listViewScroll = function(e) {
142
- var listHeight = state.current.listHeight;
143
- if (!listHeight.length) {
144
- calculateHeight();
145
- }
146
- var target = e.target;
147
- var scrollTop = target.scrollTop;
148
- state.current.scrollY = Math.floor(scrollTop);
149
- Taro.getEnv() === 'WEB' && setScrollTop(scrollTop);
150
- if (sticky && scrollTop !== scrollY) {
151
- setScrollY(Math.floor(scrollTop) > 0 ? 1 : 0);
152
- }
153
- if (scrolling.current) return;
154
- for(var i = 0; i < listHeight.length - 1; i++){
155
- var height1 = listHeight[i];
156
- var height2 = listHeight[i + 1];
157
- if (state.current.scrollY >= height1 && state.current.scrollY < height2) {
158
- return setCodeIndex(i);
171
+ raf(function() {
172
+ var listHeight = state.current.listHeight;
173
+ if (!listHeight.length) {
174
+ calculateHeight();
159
175
  }
160
- }
176
+ var target = e.target;
177
+ var scrollTop = target.scrollTop;
178
+ state.current.scrollY = Math.floor(scrollTop);
179
+ Taro.getEnv() === 'WEB' && setScrollTop(scrollTop);
180
+ if (mode === 'vertical' && sticky) {
181
+ setScrollY(Math.floor(scrollTop) > 0 ? 1 : 0);
182
+ }
183
+ if (scrolling.current) return;
184
+ var index = listHeight.findIndex(function(height, i) {
185
+ return state.current.scrollY >= height && state.current.scrollY < (listHeight[i + 1] || Infinity);
186
+ });
187
+ if (index !== -1 && index !== codeIndex) {
188
+ setCodeIndex(index);
189
+ }
190
+ });
161
191
  };
162
192
  var getWrapStyle = useMemo(function() {
163
193
  var calcHeight = Number.isNaN(+height) ? height : "".concat(height, "px");
@@ -168,17 +198,14 @@ export var Elevator = function(props) {
168
198
  height
169
199
  ]);
170
200
  useEffect(function() {
171
- if (listview.current) {
172
- nextTick(function() {
173
- setListGroup();
174
- });
175
- }
176
- }, [
177
- listview
178
- ]);
201
+ nextTick(function() {
202
+ calculateHeight();
203
+ });
204
+ }, []);
179
205
  var _obj;
180
206
  return /*#__PURE__*/ React.createElement("div", _object_spread({
181
- className: "".concat(classPrefix, " ").concat(className, " ").concat(classPrefix, "-").concat(uuid),
207
+ className: "".concat(classPrefix, " ").concat(className, " ").concat(classPrefix, "-").concat(mode, " "),
208
+ id: "".concat(classPrefix, "-").concat(uuid),
182
209
  style: style
183
210
  }, rest), /*#__PURE__*/ React.createElement(View, {
184
211
  className: "".concat(classPrefix, "-list"),
@@ -186,11 +213,10 @@ export var Elevator = function(props) {
186
213
  }, /*#__PURE__*/ React.createElement(ScrollView, {
187
214
  scrollTop: scrollTop,
188
215
  scrollY: true,
189
- scrollWithAnimation: true,
216
+ enhanced: true,
217
+ scrollWithAnimation: false,
190
218
  scrollAnchoring: true,
191
219
  className: "".concat(classPrefix, "-list-inner"),
192
- type: "list",
193
- ref: listview,
194
220
  onScroll: listViewScroll,
195
221
  onTouchStart: function(e) {
196
222
  scrolling.current = false;
@@ -201,10 +227,12 @@ export var Elevator = function(props) {
201
227
  key: idx
202
228
  }, /*#__PURE__*/ React.createElement(View, {
203
229
  className: "".concat(classPrefix, "-list-item-code")
204
- }, item[floorKey]), /*#__PURE__*/ React.createElement(React.Fragment, null, item.list.map(function(subitem) {
230
+ }, item[floorKey]), /*#__PURE__*/ React.createElement(View, {
231
+ className: "".concat(classPrefix, "-list-item-sublist")
232
+ }, item.list.map(function(subitem) {
205
233
  var _obj;
206
234
  return /*#__PURE__*/ React.createElement(View, {
207
- className: classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix, "-list-item-name"), true), _define_property(_obj, "".concat(classPrefix, "-list-item-name-highcolor"), currentData.id === subitem.id && currentKey === item[floorKey]), _obj)),
235
+ className: classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix, "-list-item-name"), true), _define_property(_obj, "".concat(classPrefix, "-list-item-name-highcolor"), currentData.id === subitem.id), _obj)),
208
236
  key: subitem.id,
209
237
  onClick: function() {
210
238
  return handleClickItem(item[floorKey], subitem);
@@ -215,7 +243,7 @@ export var Elevator = function(props) {
215
243
  })));
216
244
  }))), showKeys ? /*#__PURE__*/ React.createElement(React.Fragment, null, list.length && scrollStart ? /*#__PURE__*/ React.createElement(View, {
217
245
  className: classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix, "-code-current"), true), _define_property(_obj, "".concat(classPrefix, "-code-current-current"), true), _obj))
218
- }, list[codeIndex][floorKey]) : null, /*#__PURE__*/ React.createElement(View, {
246
+ }, list[codeIndex] && String(list[codeIndex][floorKey])) : null, /*#__PURE__*/ React.createElement(View, {
219
247
  className: "".concat(classPrefix, "-bars")
220
248
  }, /*#__PURE__*/ React.createElement(View, {
221
249
  className: "".concat(classPrefix, "-bars-inner")
@@ -238,12 +266,12 @@ export var Elevator = function(props) {
238
266
  style: {
239
267
  touchAction: 'pan-y'
240
268
  }
241
- }, item[floorKey]);
242
- })))) : null, sticky && scrollY > 0 ? /*#__PURE__*/ React.createElement(View, {
269
+ }, String(item[floorKey]));
270
+ })))) : null, mode === 'vertical' && sticky && scrollY > 0 ? /*#__PURE__*/ React.createElement(View, {
243
271
  className: "".concat(classPrefix, "-list-fixed")
244
272
  }, /*#__PURE__*/ React.createElement(Text, {
245
273
  className: "".concat(classPrefix, "-list-fixed-title")
246
- }, list[codeIndex][floorKey])) : null);
274
+ }, list[codeIndex] && String(list[codeIndex][floorKey]))) : null);
247
275
  };
248
276
  Elevator.displayName = 'NutElevator';
249
277
  Elevator.Context = elevatorContext;
@@ -1,3 +1,3 @@
1
1
  import { Elevator } from "./elevator";
2
- export type { ElevatorProps } from "./elevator";
2
+ export type { TaroElevatorProps as ElevatorProps } from "../../types";
3
3
  export default Elevator;
@@ -1,68 +1,66 @@
1
1
  .nut-elevator {
2
- width: 100%;
3
- display: block;
4
2
  position: relative;
5
- overflow: hidden;
3
+ display: flex;
4
+ width: 100%;
6
5
 
7
6
  &-list {
8
- display: block;
9
7
  position: relative;
10
8
  top: 0;
9
+ display: flex;
10
+ width: 100%;
11
11
  overflow: hidden;
12
- font-size: $elevator-list-font-size;
13
- color: $elevator-list-color;
14
12
 
15
13
  &-inner {
16
- height: 100%;
14
+ display: flex;
15
+ flex-direction: column;
16
+ min-height: 100%;
17
17
  width: 100%;
18
- display: block;
19
18
  background-color: $elevator-list-bg-color;
20
19
  overflow: auto;
21
20
  }
22
21
 
23
22
  &-item {
24
- display: block;
25
-
23
+ display: flex;
24
+ &-sublist {
25
+ display: flex;
26
+ flex-direction: column;
27
+ }
26
28
  &-code {
27
29
  display: flex;
28
- position: relative;
30
+ align-items: center;
29
31
  height: $elevator-list-item-code-height;
30
- line-height: $elevator-list-item-code-line-height;
31
32
  font-size: $elevator-list-item-code-font-size;
32
33
  color: $elevator-list-item-code-color;
33
- padding: $elevator-list-item-padding;
34
34
  font-weight: $elevator-list-item-code-font-weight;
35
- box-sizing: border-box;
36
- border-bottom: $elevator-list-item-code-border-bottom;
37
- background-color: $elevator-list-item-code-background-color;
38
35
  }
39
36
 
40
37
  &-name {
41
38
  display: flex;
42
39
  align-items: center;
43
- padding: $elevator-list-item-padding;
44
40
  height: $elevator-list-item-name-height;
45
- line-height: $elevator-list-item-name-line-height;
41
+ font-size: $elevator-list-font-size;
42
+ color: $elevator-list-color;
46
43
 
47
44
  &-highcolor {
48
45
  color: $color-primary;
46
+ font-weight: 600;
49
47
  }
50
48
  }
51
49
  }
52
50
 
53
51
  &-fixed {
54
- display: flex;
55
- align-items: center;
56
- width: 100%;
57
52
  position: absolute;
58
53
  top: 0;
59
54
  left: 0;
60
55
  z-index: 1;
56
+ display: flex;
57
+ align-items: center;
58
+ width: 100%;
61
59
  padding: $elevator-list-item-padding;
62
60
  height: $elevator-list-item-code-height;
63
- background-color: $elevator-list-fixed-bg-color;
64
61
  box-sizing: border-box;
65
62
  box-shadow: $elevator-list-fixed-box-shadow;
63
+ background-color: $elevator-list-fixed-bg-color;
66
64
  &-title {
67
65
  font-size: $elevator-list-item-code-font-size;
68
66
  color: $elevator-list-fixed-color;
@@ -76,41 +74,71 @@
76
74
  right: $elevator-list-item-code-current-right;
77
75
  top: $elevator-list-item-code-current-top;
78
76
  transform: $elevator-bars-transform;
77
+ display: flex;
78
+ align-items: center;
79
+ justify-content: center;
79
80
  width: $elevator-list-item-code-current-width;
80
81
  height: $elevator-list-item-code-current-height;
81
- line-height: $elevator-list-item-code-current-line-height;
82
82
  border-radius: $elevator-list-item-code-current-border-radius;
83
83
  background: $elevator-list-item-code-current-bg-color;
84
84
  box-shadow: $elevator-list-item-code-current-box-shadow;
85
- text-align: $elevator-list-item-code-current-text-align;
85
+ color: $elevator-list-item-code-current-color;
86
86
  }
87
87
 
88
88
  &-bars {
89
89
  position: absolute;
90
90
  right: $elevator-bars-right;
91
91
  top: $elevator-bars-top;
92
- color: $color-text-help;
93
- font-size: $elevator-bars-font-size;
94
92
  transform: $elevator-bars-transform;
95
- padding: $elevator-bars-padding;
96
- background-color: $elevator-bars-background-color;
97
- border-radius: $elevator-bars-border-radius;
98
- text-align: center;
99
93
  z-index: $elevator-bars-z-index;
100
94
 
101
95
  &-inner {
96
+ display: flex;
97
+ flex-direction: column;
102
98
  &-item {
103
- display: block;
104
- padding: $elevator-bars-inner-item-padding;
99
+ display: inline-flex;
100
+ align-items: center;
101
+ justify-content: center;
102
+ height: 16px;
103
+ width: 16px;
104
+ border-radius: 50%;
105
+ margin: 1px 0;
106
+ color: $elevator-bars-color;
107
+ font-size: $elevator-bars-font-size;
105
108
  cursor: pointer;
106
-
107
109
  &-active {
108
110
  font-weight: $font-weight-bold;
109
111
  color: $elevator-bars-active-color;
112
+ /* #ifndef weapp jd*/
113
+ background: linear-gradient(to right, #ff475d, #ff0f23);
114
+ /* #endif */
115
+ /* #ifdef weapp jd*/
116
+ background: #ff0f23;
117
+ /* #endif */
110
118
  }
111
119
  }
112
120
  }
113
121
  }
122
+ &-horizontal {
123
+ .nut-elevator-list-item {
124
+ &-code {
125
+ width: $elevator-list-item-code-width;
126
+ justify-content: center;
127
+ }
128
+ }
129
+ }
130
+ &-vertical {
131
+ .nut-elevator-list-item {
132
+ flex-direction: column;
133
+ &-code {
134
+ border-bottom: $elevator-list-item-code-border-bottom;
135
+ }
136
+ &-name,
137
+ &-code {
138
+ padding: $elevator-list-item-padding;
139
+ }
140
+ }
141
+ }
114
142
  }
115
143
 
116
144
  [dir='rtl'] .nut-elevator,