@nutui/nutui-react-taro 1.5.11 → 1.5.12-beta.0

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.
@@ -8,7 +8,7 @@ var __publicField = (obj, key, value) => {
8
8
  return value;
9
9
  };
10
10
  /*!
11
- * @nutui/nutui-react-taro v1.5.11 Wed Jul 05 2023 11:10:24 GMT+0800 (中国标准时间)
11
+ * @nutui/nutui-react-taro v1.5.12-beta.0 Wed Jul 12 2023 16:47:44 GMT+0800 (中国标准时间)
12
12
  * (c) 2023 @jdf2e.
13
13
  * Released under the MIT License.
14
14
  */
@@ -3273,6 +3273,7 @@ var __publicField = (obj, key, value) => {
3273
3273
  iconFontClassName,
3274
3274
  className,
3275
3275
  onClick,
3276
+ style,
3276
3277
  ...rest
3277
3278
  } = {
3278
3279
  ...defaultProps$1l,
@@ -3285,18 +3286,18 @@ var __publicField = (obj, key, value) => {
3285
3286
  return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
3286
3287
  };
3287
3288
  const rootStyle = () => {
3288
- const style = {
3289
+ const rootStyle2 = {
3289
3290
  flexBasis: `${100 / +columnNum}%`
3290
3291
  };
3291
3292
  if (square) {
3292
- style.paddingTop = `${100 / +columnNum}%`;
3293
+ rootStyle2.paddingTop = `${100 / +columnNum}%`;
3293
3294
  } else if (gutter) {
3294
- style.paddingRight = pxCheck2(gutter);
3295
+ rootStyle2.paddingRight = pxCheck2(gutter);
3295
3296
  if (index >= columnNum) {
3296
- style.marginTop = pxCheck2(gutter);
3297
+ rootStyle2.marginTop = pxCheck2(gutter);
3297
3298
  }
3298
3299
  }
3299
- return style;
3300
+ return { ...rootStyle2, ...style };
3300
3301
  };
3301
3302
  const contentClass = () => {
3302
3303
  return classNames(b2("content"), {
@@ -4119,6 +4120,19 @@ var __publicField = (obj, key, value) => {
4119
4120
  React.useEffect(() => {
4120
4121
  getParentOffset();
4121
4122
  }, [_showPopup]);
4123
+ const windowHeight = React.useMemo(() => Taro.getSystemInfoSync().windowHeight, []);
4124
+ const updateItemOffset = React.useCallback(() => {
4125
+ const p = parent.parent().current;
4126
+ p.getBoundingClientRect().then((rect) => {
4127
+ if (rect) {
4128
+ setPosition({
4129
+ height: rect.height,
4130
+ top: rect.top
4131
+ });
4132
+ }
4133
+ });
4134
+ }, [direction, windowHeight]);
4135
+ Taro.usePageScroll(updateItemOffset);
4122
4136
  React.useImperativeHandle(ref, () => ({
4123
4137
  toggle: parent.toggleItemShow
4124
4138
  }));
@@ -4159,114 +4173,103 @@ var __publicField = (obj, key, value) => {
4159
4173
  return { display: "none" };
4160
4174
  };
4161
4175
  const getPosition = () => {
4162
- return direction === "down" ? { position: "absolute", height: `${window.innerHeight}px` } : {
4163
- position: "absolute",
4164
- bottom: "100%",
4165
- top: "auto",
4166
- height: `${window.innerHeight}px`
4176
+ return direction === "down" ? { top: `${position.top + position.height}px` } : {
4177
+ bottom: `${Taro.getSystemInfoSync().windowHeight - position.top}px`,
4178
+ top: "0",
4179
+ height: "initial"
4167
4180
  };
4168
4181
  };
4169
4182
  const placeholderStyle = () => {
4170
4183
  if (direction === "down") {
4171
4184
  return {
4172
4185
  height: `${position.top + position.height}px`,
4173
- top: "auto",
4174
- bottom: "-100%",
4175
- ...isShow()
4186
+ ...isShow(),
4187
+ ...style
4176
4188
  };
4177
4189
  }
4178
4190
  return {
4179
4191
  height: `${Taro.getSystemInfoSync().windowHeight - position.top}px`,
4180
- bottom: `auto`,
4181
- top: "0",
4182
- ...isShow()
4192
+ top: "auto",
4193
+ ...isShow(),
4194
+ ...style
4183
4195
  };
4184
4196
  };
4185
- return /* @__PURE__ */ React.createElement(
4186
- "div",
4197
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
4198
+ components.View,
4187
4199
  {
4188
- className: "nut-menu-item-container",
4189
- style: { position: "absolute", left: 0, right: 0 }
4190
- },
4191
- /* @__PURE__ */ React.createElement(
4192
- "div",
4193
- {
4194
- className: `placeholder-element ${classNames({
4195
- up: direction === "up"
4196
- })}`,
4197
- style: placeholderStyle(),
4198
- onClick: () => parent.toggleItemShow(orderKey)
4200
+ className: `placeholder-element ${classNames({
4201
+ up: direction === "up"
4202
+ })}`,
4203
+ style: placeholderStyle(),
4204
+ onClick: () => parent.toggleItemShow(orderKey)
4205
+ }
4206
+ ), /* @__PURE__ */ React.createElement(
4207
+ Overlay,
4208
+ {
4209
+ overlayClass: "nut-menu__overlay",
4210
+ style: getPosition(),
4211
+ lockScroll: parent.lockScroll,
4212
+ visible: _showPopup,
4213
+ closeOnClickOverlay: parent.closeOnClickOverlay,
4214
+ onClick: () => {
4215
+ parent.closeOnClickOverlay && parent.toggleItemShow(orderKey);
4199
4216
  }
4200
- ),
4201
- /* @__PURE__ */ React.createElement(
4202
- Overlay,
4203
- {
4204
- overlayClass: "nut-menu__overlay",
4205
- style: getPosition(),
4206
- lockScroll: parent.lockScroll,
4207
- visible: _showPopup,
4208
- closeOnClickOverlay: parent.closeOnClickOverlay,
4209
- onClick: () => {
4210
- parent.closeOnClickOverlay && parent.toggleItemShow(orderKey);
4211
- }
4217
+ }
4218
+ ), /* @__PURE__ */ React.createElement(
4219
+ components.View,
4220
+ {
4221
+ className: direction === "down" ? "nut-menu-item__wrap" : "nut-menu-item__wrap-up",
4222
+ style: {
4223
+ // ...getPosition(),
4224
+ ...isShow()
4212
4225
  }
4213
- ),
4226
+ },
4214
4227
  /* @__PURE__ */ React.createElement(
4215
- "div",
4228
+ CSSTransition$1,
4216
4229
  {
4217
- className: direction === "down" ? "nut-menu-item__wrap" : "nut-menu-item__wrap-up",
4218
- style: {
4219
- // ...getPosition(),
4220
- ...isShow()
4221
- }
4230
+ in: _showPopup,
4231
+ timeout: 100,
4232
+ classNames: direction === "down" ? "menu-item" : "menu-item-up"
4222
4233
  },
4223
- /* @__PURE__ */ React.createElement(
4224
- CSSTransition$1,
4225
- {
4226
- in: _showPopup,
4227
- timeout: 100,
4228
- classNames: direction === "down" ? "menu-item" : "menu-item-up"
4229
- },
4230
- /* @__PURE__ */ React.createElement("div", { className: "nut-menu-item__content" }, options == null ? void 0 : options.map((item, index) => {
4231
- return /* @__PURE__ */ React.createElement(
4232
- "div",
4234
+ /* @__PURE__ */ React.createElement(components.View, { className: "nut-menu-item__content" }, options == null ? void 0 : options.map((item, index) => {
4235
+ return /* @__PURE__ */ React.createElement(
4236
+ components.View,
4237
+ {
4238
+ className: `nut-menu-item__option ${classNames({
4239
+ active: item.value === _value
4240
+ })}`,
4241
+ key: item.text,
4242
+ style: {
4243
+ flexBasis: `${100 / columns}%`
4244
+ },
4245
+ onClick: () => {
4246
+ handleClick(item);
4247
+ }
4248
+ },
4249
+ item.value === _value ? /* @__PURE__ */ React.createElement(
4250
+ Icon$1,
4233
4251
  {
4234
- className: `nut-menu-item__option ${classNames({
4235
- active: item.value === _value
4236
- })}`,
4237
- key: item.text,
4252
+ classPrefix: iconClassPrefix,
4253
+ fontClassName: iconFontClassName,
4254
+ className: getIconCName(item.value, value),
4255
+ name: optionsIcon,
4256
+ color: activeColor
4257
+ }
4258
+ ) : null,
4259
+ /* @__PURE__ */ React.createElement(
4260
+ components.View,
4261
+ {
4262
+ className: getIconCName(item.value, value),
4238
4263
  style: {
4239
- flexBasis: `${100 / columns}%`
4240
- },
4241
- onClick: () => {
4242
- handleClick(item);
4264
+ color: `${item.value === _value ? activeColor : ""}`
4243
4265
  }
4244
4266
  },
4245
- item.value === _value ? /* @__PURE__ */ React.createElement(
4246
- Icon$1,
4247
- {
4248
- classPrefix: iconClassPrefix,
4249
- fontClassName: iconFontClassName,
4250
- className: getIconCName(item.value, value),
4251
- name: optionsIcon,
4252
- color: activeColor
4253
- }
4254
- ) : null,
4255
- /* @__PURE__ */ React.createElement(
4256
- "div",
4257
- {
4258
- className: getIconCName(item.value, value),
4259
- style: {
4260
- color: `${item.value === _value ? activeColor : ""}`
4261
- }
4262
- },
4263
- item.text
4264
- )
4265
- );
4266
- }), children)
4267
- )
4267
+ item.text
4268
+ )
4269
+ );
4270
+ }), children)
4268
4271
  )
4269
- );
4272
+ ));
4270
4273
  });
4271
4274
  MenuItem.defaultProps = defaultProps$1d;
4272
4275
  MenuItem.displayName = "NutMenuItem";
@@ -65,15 +65,15 @@
65
65
  }
66
66
 
67
67
  .placeholder-element {
68
- position: absolute;
69
- top: -$menu-bar-line-height;
68
+ position: fixed;
69
+ top: $menu-placeholder-top;
70
70
  left: 0;
71
71
  right: 0;
72
72
  z-index: $menu-bar-opened-z-index;
73
73
  background-color: transparent;
74
74
 
75
75
  &.up {
76
- bottom: -$menu-bar-line-height;
76
+ bottom: $menu-placeholder-top;
77
77
  }
78
78
  }
79
79