@arco-design/mobile-react 2.35.2 → 2.36.1
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.
- package/CHANGELOG.md +30 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/_helpers/hooks.d.ts +10 -2
- package/cjs/_helpers/hooks.js +12 -5
- package/cjs/date-picker/index.js +218 -18
- package/cjs/date-picker/style/css/index.css +42 -0
- package/cjs/date-picker/style/index.less +38 -1
- package/cjs/date-picker/type.d.ts +22 -6
- package/cjs/ellipsis/components/js-ellipsis.js +3 -1
- package/cjs/form/linked-container.d.ts +2 -2
- package/cjs/form/linked-container.js +5 -1
- package/cjs/picker/index.js +3 -2
- package/cjs/picker/type.d.ts +5 -0
- package/cjs/popover/hooks/usePosition.js +26 -8
- package/cjs/search-bar/association.js +2 -2
- package/cjs/search-bar/type.d.ts +1 -1
- package/cjs/stepper/hooks/useValue.js +3 -1
- package/cjs/tabs/index.js +1 -1
- package/cjs/tabs/type.d.ts +2 -2
- package/dist/index.js +301 -47
- package/dist/index.min.js +4 -4
- package/dist/style.css +23 -0
- package/dist/style.min.css +1 -1
- package/esm/_helpers/hooks.d.ts +10 -2
- package/esm/_helpers/hooks.js +12 -5
- package/esm/date-picker/index.js +218 -18
- package/esm/date-picker/style/css/index.css +42 -0
- package/esm/date-picker/style/index.less +38 -1
- package/esm/date-picker/type.d.ts +22 -6
- package/esm/ellipsis/components/js-ellipsis.js +3 -1
- package/esm/form/linked-container.d.ts +2 -2
- package/esm/form/linked-container.js +5 -1
- package/esm/picker/index.js +3 -2
- package/esm/picker/type.d.ts +5 -0
- package/esm/popover/hooks/usePosition.js +26 -8
- package/esm/search-bar/association.js +2 -2
- package/esm/search-bar/type.d.ts +1 -1
- package/esm/stepper/hooks/useValue.js +1 -0
- package/esm/tabs/index.js +1 -1
- package/esm/tabs/type.d.ts +2 -2
- package/esnext/_helpers/hooks.d.ts +10 -2
- package/esnext/_helpers/hooks.js +12 -5
- package/esnext/date-picker/index.js +167 -10
- package/esnext/date-picker/style/css/index.css +42 -0
- package/esnext/date-picker/style/index.less +38 -1
- package/esnext/date-picker/type.d.ts +22 -6
- package/esnext/ellipsis/components/js-ellipsis.js +2 -0
- package/esnext/form/linked-container.d.ts +2 -2
- package/esnext/form/linked-container.js +7 -2
- package/esnext/picker/index.js +2 -1
- package/esnext/picker/type.d.ts +5 -0
- package/esnext/popover/hooks/usePosition.js +32 -12
- package/esnext/search-bar/association.js +1 -1
- package/esnext/search-bar/type.d.ts +1 -1
- package/esnext/stepper/hooks/useValue.js +1 -0
- package/esnext/tabs/index.js +1 -1
- package/esnext/tabs/type.d.ts +2 -2
- package/package.json +3 -3
- package/tokens/app/arcodesign/default/css-variables.less +10 -0
- package/tokens/app/arcodesign/default/index.d.ts +10 -0
- package/tokens/app/arcodesign/default/index.js +11 -1
- package/tokens/app/arcodesign/default/index.json +108 -0
- package/tokens/app/arcodesign/default/index.less +10 -0
- package/umd/_helpers/hooks.d.ts +10 -2
- package/umd/_helpers/hooks.js +12 -5
- package/umd/date-picker/index.js +218 -18
- package/umd/date-picker/style/css/index.css +42 -0
- package/umd/date-picker/style/index.less +38 -1
- package/umd/date-picker/type.d.ts +22 -6
- package/umd/ellipsis/components/js-ellipsis.js +3 -1
- package/umd/form/linked-container.d.ts +2 -2
- package/umd/form/linked-container.js +5 -1
- package/umd/picker/index.js +3 -2
- package/umd/picker/type.d.ts +5 -0
- package/umd/popover/hooks/usePosition.js +26 -8
- package/umd/search-bar/association.js +2 -2
- package/umd/search-bar/type.d.ts +1 -1
- package/umd/stepper/hooks/useValue.js +5 -5
- package/umd/tabs/index.js +1 -1
- package/umd/tabs/type.d.ts +2 -2
package/cjs/picker/index.js
CHANGED
@@ -38,7 +38,7 @@ Object.keys(_type).forEach(function (key) {
|
|
38
38
|
if (key in exports && exports[key] === _type[key]) return;
|
39
39
|
exports[key] = _type[key];
|
40
40
|
});
|
41
|
-
var _excluded = ["className", "itemStyle", "cascade", "cols", "rows", "data", "okText", "dismissText", "disabled", "clickable", "hideEmptyCols", "title", "visible", "value", "needBottomOffset", "onDismiss", "onOk", "onChange", "maskClosable", "onHide", "onPickerChange", "touchToStop", "gestureOutOfControl", "renderLinkedContainer"];
|
41
|
+
var _excluded = ["className", "itemStyle", "cascade", "cols", "rows", "data", "okText", "dismissText", "disabled", "clickable", "hideEmptyCols", "title", "visible", "value", "needBottomOffset", "onDismiss", "onOk", "onChange", "maskClosable", "onHide", "onPickerChange", "touchToStop", "gestureOutOfControl", "renderLinkedContainer", "renderExtraHeader"];
|
42
42
|
|
43
43
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
44
44
|
|
@@ -79,6 +79,7 @@ var Picker = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
79
79
|
_props$gestureOutOfCo = props.gestureOutOfControl,
|
80
80
|
gestureOutOfControl = _props$gestureOutOfCo === void 0 ? true : _props$gestureOutOfCo,
|
81
81
|
renderLinkedContainer = props.renderLinkedContainer,
|
82
|
+
renderExtraHeader = props.renderExtraHeader,
|
82
83
|
otherProps = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
83
84
|
var scrollValueRef = (0, _helpers.useLatestRef)(value);
|
84
85
|
var domRef = (0, _react.useRef)(null);
|
@@ -225,7 +226,7 @@ var Picker = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
225
226
|
}, title), /*#__PURE__*/_react.default.createElement("div", {
|
226
227
|
className: prefixCls + "-picker-header-btn right",
|
227
228
|
onClick: handleConfirm
|
228
|
-
}, okText || (locale == null ? void 0 : locale.Picker.okText))), /*#__PURE__*/_react.default.createElement(_pickerView.default, {
|
229
|
+
}, okText || (locale == null ? void 0 : locale.Picker.okText))), renderExtraHeader && renderExtraHeader(), /*#__PURE__*/_react.default.createElement(_pickerView.default, {
|
229
230
|
ref: pickerViewRef,
|
230
231
|
data: data,
|
231
232
|
cascade: cascade,
|
package/cjs/picker/type.d.ts
CHANGED
@@ -128,4 +128,9 @@ export interface PickerProps extends Omit<PopupProps, 'visible' | 'close' | 'chi
|
|
128
128
|
* @en Associate the hidden state of the picker and the display of the selected value with a container. After passing it in, the container and the picker component will be rendered at the same time. At this time, the visible and onHide attributes of the picker component are optional values. Clicking the container will evoke the picker
|
129
129
|
*/
|
130
130
|
renderLinkedContainer?: (value: ValueType[], data: PickerData[]) => ReactNode;
|
131
|
+
/**
|
132
|
+
* 自定义头部扩展区域
|
133
|
+
* @en Define the area of extra header
|
134
|
+
*/
|
135
|
+
renderExtraHeader?: () => ReactNode;
|
131
136
|
}
|
@@ -235,20 +235,38 @@ var usePosition = function usePosition(props, popoverRef, childRef, wrapperRef)
|
|
235
235
|
|
236
236
|
|
237
237
|
if (verticalAuto) {
|
238
|
-
var
|
239
|
-
var popoverBottom = childRect.top + (newConfig.top && newConfig.height ? newConfig.top + newConfig.height : 0); // 顶部安全距离不够,调整到底部
|
240
|
-
// @en The top safety distance is not enough, adjust to the bottom
|
241
|
-
|
242
|
-
if (directionState.indexOf('top') !== -1 && popoverTop < topOffset) {
|
238
|
+
var setToBottom = function setToBottom() {
|
243
239
|
newConfig.top = verticalOffset + childRect.height;
|
244
240
|
newConfig.bottom = null;
|
245
241
|
onAdjustDirection('bottom');
|
246
|
-
}
|
247
|
-
|
248
|
-
|
242
|
+
};
|
243
|
+
|
244
|
+
var setToTop = function setToTop() {
|
249
245
|
newConfig.top = null;
|
250
246
|
newConfig.bottom = verticalOffset + childRect.height;
|
251
247
|
onAdjustDirection('top');
|
248
|
+
}; // 判断上下空间是否都不足以展示气泡内容
|
249
|
+
// @en Determine whether there is insufficient space both above and below to display content
|
250
|
+
|
251
|
+
|
252
|
+
var isPopoverTooTall = window.innerHeight - topOffset - bottomOffset < 2 * (newConfig.height || 0) + 2 * verticalOffset + childRect.height;
|
253
|
+
|
254
|
+
if (isPopoverTooTall) {
|
255
|
+
var spaceAbove = childRect.top;
|
256
|
+
var spaceBelow = window.innerHeight - childRect.bottom;
|
257
|
+
spaceAbove > spaceBelow ? setToTop() : setToBottom();
|
258
|
+
} else {
|
259
|
+
var popoverTop = childRect.bottom - (newConfig.bottom && newConfig.height ? newConfig.bottom + newConfig.height : 0);
|
260
|
+
var popoverBottom = childRect.top + (newConfig.top && newConfig.height ? newConfig.top + newConfig.height : 0); // 顶部安全距离不够,调整到底部
|
261
|
+
// @en The top safety distance is not enough, adjust to the bottom
|
262
|
+
|
263
|
+
if (directionState.indexOf('top') !== -1 && popoverTop < topOffset) {
|
264
|
+
setToBottom();
|
265
|
+
} else if ( // 底部安全距离不够,调整到顶部
|
266
|
+
// @en The bottom safety distance is not enough, adjust to the top
|
267
|
+
directionState.indexOf('bottom') !== -1 && popoverBottom + bottomOffset > window.innerHeight) {
|
268
|
+
setToTop();
|
269
|
+
}
|
252
270
|
}
|
253
271
|
} // 挂载在全局的气泡需要计算相对屏幕的位置
|
254
272
|
// @en Bubble mounted in the global needs to calculate the position relative to the screen
|
@@ -69,8 +69,8 @@ function SearchBarAssociation(props) {
|
|
69
69
|
return /*#__PURE__*/_react.default.createElement("div", {
|
70
70
|
key: index,
|
71
71
|
className: searchBarAssociationPrefixCls + "-item",
|
72
|
-
onClick: function onClick() {
|
73
|
-
return onAssociationItemClick == null ? void 0 : onAssociationItemClick(item, index);
|
72
|
+
onClick: function onClick(e) {
|
73
|
+
return onAssociationItemClick == null ? void 0 : onAssociationItemClick(item, index, e);
|
74
74
|
}
|
75
75
|
}, node);
|
76
76
|
};
|
package/cjs/search-bar/type.d.ts
CHANGED
@@ -57,7 +57,7 @@ export interface SearchBarAssociationProps<Data = Record<string, any>> {
|
|
57
57
|
* 每行搜索结果的点击回调
|
58
58
|
* @en Click callback for each row of search results
|
59
59
|
*/
|
60
|
-
onAssociationItemClick?: (item: SearchAssociationItem<Data>, index: number) => void;
|
60
|
+
onAssociationItemClick?: (item: SearchAssociationItem<Data>, index: number, event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
61
61
|
/**
|
62
62
|
* 搜索联想框整体被点击的回调
|
63
63
|
* @en The callback for the overall click of the search association box
|
@@ -5,6 +5,8 @@ exports.default = useValue;
|
|
5
5
|
|
6
6
|
var _react = require("react");
|
7
7
|
|
8
|
+
var _es6Promise = require("es6-promise");
|
9
|
+
|
8
10
|
function useValue(params) {
|
9
11
|
var defaultValue = params.defaultValue,
|
10
12
|
formatter = params.formatter,
|
@@ -21,7 +23,7 @@ function useValue(params) {
|
|
21
23
|
var tempValue = typeof updater === 'function' ? updater(innerValue) : updater;
|
22
24
|
|
23
25
|
if (formatter) {
|
24
|
-
new Promise(function (resolve) {
|
26
|
+
new _es6Promise.Promise(function (resolve) {
|
25
27
|
resolve(formatter(Number(tempValue)));
|
26
28
|
}).then(function (result) {
|
27
29
|
var res = Math.max(min, Math.min(max, result));
|
package/cjs/tabs/index.js
CHANGED
@@ -439,7 +439,7 @@ var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
439
439
|
width = _getOffset.width,
|
440
440
|
height = _getOffset.height;
|
441
441
|
|
442
|
-
cellRef.current && cellRef.current.
|
442
|
+
cellRef.current && cellRef.current.updateLayout();
|
443
443
|
setWrapWidth(width || ((_domRef$current = domRef.current) == null ? void 0 : _domRef$current.offsetWidth) || 0);
|
444
444
|
setWrapHeight(height || ((_domRef$current2 = domRef.current) == null ? void 0 : _domRef$current2.offsetHeight) || 0);
|
445
445
|
paneRef.current && paneRef.current.setCurrentHeight();
|
package/cjs/tabs/type.d.ts
CHANGED
@@ -561,8 +561,8 @@ export interface TabCellRef {
|
|
561
561
|
*/
|
562
562
|
setCaterpillarAnimate: (ratio?: number) => void;
|
563
563
|
/**
|
564
|
-
*
|
565
|
-
* @en Recalculate underline style
|
564
|
+
* 重新计算下划线样式(仅重算位置,如果 tab cell DOM 被人为改变,请调用 updateLayout)
|
565
|
+
* @en Recalculate underline style (only recalculate position, if the tab cell DOM is changed manually, please call updateLayout)
|
566
566
|
*/
|
567
567
|
resetUnderlineStyle: () => void;
|
568
568
|
/**
|