@acrool/react-picker 0.1.0 → 0.1.1-alpha.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/README.md +24 -1
- package/dist/MotionDrawer/utils.d.ts +4 -3
- package/dist/PickerProvider.d.ts +2 -1
- package/dist/acrool-react-picker.es.js +663 -5346
- package/dist/types.d.ts +5 -0
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -34,9 +34,18 @@
|
|
|
34
34
|
## Install
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
yarn add @acrool/react-picker
|
|
37
|
+
yarn add framer-motion @acrool/react-picker
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
in your packages. (Make the version of styled-component you use match the version of styled-component used in acrool-react-gird)
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
"resolutions": {
|
|
44
|
+
"framer-motion": "^11.x"
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
|
|
40
49
|
## Usage
|
|
41
50
|
|
|
42
51
|
add in your index.tsx
|
|
@@ -192,6 +201,20 @@ const DateTimeFieldAfter = (props: IProps, ref?: ForwardedRef<HTMLElement>) => {
|
|
|
192
201
|
```
|
|
193
202
|
|
|
194
203
|
|
|
204
|
+
## There is an onClick event in the outer layer, causing the picker to click and trigger
|
|
205
|
+
|
|
206
|
+
It should be set in the outer layer to prevent bubbling.
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
const handleOnClick = (e: React.MouseEvent) => {
|
|
210
|
+
e.stopPropagation();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return <DropdownRoot onClick={handleOnClick}>
|
|
214
|
+
<DropTitle>{i18n('page.workspaceTask.action.subTask', {def: 'SubTask'})}</DropTitle>
|
|
215
|
+
</DropdownRoot>;
|
|
216
|
+
```
|
|
217
|
+
|
|
195
218
|
## License
|
|
196
219
|
|
|
197
220
|
MIT © [Acrool](https://github.com/acrool) & [Imagine](https://github.com/imagine10255)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
import { EVertical } from '../types';
|
|
2
|
+
import { EVertical, IPosition } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Get the closest scrollable parent of an element.
|
|
5
5
|
* Caches results for performance.
|
|
@@ -9,6 +9,7 @@ export declare function getScrollParent(element: HTMLElement): HTMLElement | Win
|
|
|
9
9
|
* Update the position of the picker element relative to the anchor element.
|
|
10
10
|
* @param anchorRef Reference to the anchor element.
|
|
11
11
|
* @param pickerRef Reference to the picker element.
|
|
12
|
-
* @param
|
|
12
|
+
* @param importantPosition 強制指定位置
|
|
13
|
+
* @param setVertical 設定垂直(top/bottom, 讓選擇棄可以決定順序
|
|
13
14
|
*/
|
|
14
|
-
export declare const updatePosition: (anchorRef: RefObject<HTMLElement>, pickerRef: RefObject<HTMLElement>, setVertical: (vertical: EVertical) => void) => void;
|
|
15
|
+
export declare const updatePosition: (anchorRef: RefObject<HTMLElement>, pickerRef: RefObject<HTMLElement>, setVertical: (vertical: EVertical) => void, importantPosition?: IPosition) => void;
|
package/dist/PickerProvider.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { EVertical } from './types';
|
|
2
|
+
import { EVertical, IPosition } from './types';
|
|
3
3
|
interface IContextProps<T = any> {
|
|
4
4
|
hide: () => void;
|
|
5
5
|
show: () => void;
|
|
@@ -9,6 +9,7 @@ interface IContextProps<T = any> {
|
|
|
9
9
|
inputBlur: () => void;
|
|
10
10
|
isInputFocus: boolean;
|
|
11
11
|
value?: T;
|
|
12
|
+
importantPosition?: IPosition;
|
|
12
13
|
vertical: EVertical;
|
|
13
14
|
setVertical: (vertical: EVertical) => void;
|
|
14
15
|
onChange: (value: T) => void;
|