wenay-react2 1.0.35 → 1.0.36
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 +12 -56
- package/lib/common/api.d.ts +28 -28
- package/lib/common/api.js +31 -31
- package/lib/common/src/components/Buttons/MiniButton.d.ts +1 -3
- package/lib/common/src/components/Buttons/MiniButton.js +1 -3
- package/lib/common/src/components/Dnd/{RNDFunc.d.ts → DragArea.d.ts} +1 -1
- package/lib/common/src/components/Dnd/{RNDFunc.js → DragArea.js} +1 -1
- package/lib/common/src/components/Dnd/{RNDFunc3.d.ts → FloatingWindow.d.ts} +7 -7
- package/lib/common/src/components/Dnd/{RNDFunc3.js → FloatingWindow.js} +10 -10
- package/lib/common/src/components/Dnd/OutlineDragDemo.d.ts +1 -0
- package/lib/common/src/components/Dnd/{DraggableOutlineDiv.js → OutlineDragDemo.js} +1 -2
- package/lib/common/src/components/Dnd/Resizable.js +1 -1
- package/lib/common/src/components/Dnd/index.d.ts +3 -3
- package/lib/common/src/components/Dnd/index.js +3 -3
- package/lib/common/src/components/Input.d.ts +5 -5
- package/lib/common/src/components/Input.js +10 -10
- package/lib/common/src/components/Menu/RightMenu.d.ts +25 -5
- package/lib/common/src/components/Menu/RightMenu.js +27 -19
- package/lib/common/src/components/Menu/RightMenuStore.d.ts +2 -2
- package/lib/common/src/components/Menu/RightMenuStore.js +1 -1
- package/lib/common/src/components/Modal/LeftModal.js +4 -4
- package/lib/common/src/components/Modal/Modal.d.ts +11 -17
- package/lib/common/src/components/Modal/Modal.js +15 -21
- package/lib/common/src/components/Modal/ModalContextProvider.d.ts +0 -6
- package/lib/common/src/components/Modal/ModalContextProvider.js +2 -9
- package/lib/common/src/components/Other.d.ts +2 -2
- package/lib/common/src/components/Other.js +5 -5
- package/lib/common/src/components/Parameters.d.ts +3 -3
- package/lib/common/src/components/Parameters.js +3 -3
- package/lib/common/src/components/{ParametersEngine.d.ts → ParamsEditor.d.ts} +1 -1
- package/lib/common/src/components/{ParametersEngine.js → ParamsEditor.js} +10 -10
- package/lib/common/src/components/Settings/SettingsDialog.d.ts +4 -4
- package/lib/common/src/components/Toolbar/Toolbar.d.ts +50 -37
- package/lib/common/src/components/Toolbar/Toolbar.js +60 -23
- package/lib/common/src/components/UiSlot/UiSlot.d.ts +3 -3
- package/lib/common/src/components/UiSlot/UiSlot.js +6 -6
- package/lib/common/src/grid/agGrid4/agGrid4.d.ts +4 -4
- package/lib/common/src/grid/agGrid4/agGrid4.js +6 -6
- package/lib/common/src/grid/agGrid4/index.d.ts +3 -3
- package/lib/common/src/grid/agGrid4/index.js +1 -1
- package/lib/common/src/grid/agGrid4/theme.d.ts +3 -3
- package/lib/common/src/grid/columnState/CardList.d.ts +11 -0
- package/lib/common/src/grid/columnState/CardList.js +28 -0
- package/lib/common/src/grid/columnState/ColumnDots.d.ts +9 -0
- package/lib/common/src/grid/columnState/ColumnDots.js +121 -0
- package/lib/common/src/grid/columnState/ColumnsMenu.d.ts +65 -0
- package/lib/common/src/grid/columnState/ColumnsMenu.js +123 -0
- package/lib/common/src/grid/columnState/columnState.d.ts +113 -0
- package/lib/common/src/grid/columnState/columnState.js +284 -0
- package/lib/common/src/grid/columnState/index.d.ts +4 -0
- package/lib/common/src/grid/columnState/index.js +4 -0
- package/lib/common/src/hooks/index.d.ts +1 -1
- package/lib/common/src/hooks/index.js +1 -1
- package/lib/common/src/hooks/useKeyboard.d.ts +18 -0
- package/lib/common/src/hooks/{useAddDownAnyKey.js → useKeyboard.js} +16 -24
- package/lib/common/src/hooks/useObserveStore.d.ts +12 -12
- package/lib/common/src/hooks/useObserveStore.js +2 -2
- package/lib/common/src/hooks/useOutside.d.ts +12 -19
- package/lib/common/src/hooks/useOutside.js +9 -16
- package/lib/common/src/hooks/useReorder.d.ts +4 -4
- package/lib/common/src/hooks/useReorderBoard.d.ts +15 -15
- package/lib/common/src/hooks/useReplay.d.ts +9 -9
- package/lib/common/src/hooks/useReplay.js +7 -7
- package/lib/common/src/logs/logs.d.ts +3 -3
- package/lib/common/src/logs/logs.js +11 -13
- package/lib/common/src/logs/{logs3.d.ts → logsContext.d.ts} +4 -4
- package/lib/common/src/logs/{logs3.js → logsContext.js} +4 -4
- package/lib/common/src/menu/menu.d.ts +16 -16
- package/lib/common/src/menu/menu.js +12 -11
- package/lib/common/src/menu/menuMouse.d.ts +71 -13
- package/lib/common/src/menu/menuMouse.js +189 -21
- package/lib/common/src/menu/menuR.d.ts +3 -3
- package/lib/common/src/menu/menuR.js +5 -5
- package/lib/common/src/styles/styleGrid.d.ts +1 -1
- package/lib/common/src/styles/tokens.d.ts +1 -1
- package/lib/common/src/styles/tokens.js +1 -1
- package/lib/common/src/utils/cache.d.ts +11 -11
- package/lib/common/src/utils/cache.js +0 -0
- package/lib/common/src/utils/gridRows.d.ts +37 -0
- package/lib/common/src/utils/{applyTransactionAsyncUpdate.js → gridRows.js} +6 -38
- package/lib/common/src/utils/index.d.ts +2 -2
- package/lib/common/src/utils/index.js +2 -2
- package/lib/common/src/utils/inputAutoStep.d.ts +2 -2
- package/lib/common/src/utils/inputAutoStep.js +26 -37
- package/lib/common/src/utils/{mapMemory.d.ts → memoryStore.d.ts} +13 -13
- package/lib/common/src/utils/{mapMemory.js → memoryStore.js} +32 -32
- package/lib/common/src/utils/observableMap.d.ts +5 -5
- package/lib/common/src/utils/observableMap.js +3 -3
- package/lib/common/updateBy.js +2 -2
- package/lib/style/style.css +3 -3
- package/lib/style/tokens.css +1 -1
- package/package.json +49 -49
- package/lib/common/src/components/Dnd/DraggableOutlineDiv.d.ts +0 -2
- package/lib/common/src/hooks/useAddDownAnyKey.d.ts +0 -24
- package/lib/common/src/utils/applyTransactionAsyncUpdate.d.ts +0 -53
package/README.md
CHANGED
|
@@ -1,58 +1,14 @@
|
|
|
1
1
|
# wenay-react2
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
- [wenay-
|
|
9
|
-
- [
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import { useModal, useAgGrid, createGridBuffer, createColumnBuffer, useStoreMirror } from "wenay-react2"
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
The root export is still flat. A grouped namespace is also exported for large files:
|
|
19
|
-
|
|
20
|
-
```ts
|
|
21
|
-
import { v2 } from "wenay-react2"
|
|
22
|
-
|
|
23
|
-
v2.grid.useAgGrid(...)
|
|
24
|
-
v2.modal.useModal()
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## API Standard
|
|
28
|
-
|
|
29
|
-
New code should use the short controller-style surface:
|
|
30
|
-
|
|
31
|
-
```tsx
|
|
32
|
-
const modal = useModal()
|
|
33
|
-
modal.open(<Dialog />)
|
|
34
|
-
modal.close()
|
|
35
|
-
|
|
36
|
-
const grid = useAgGrid<Row>({getId: row => row.id})
|
|
37
|
-
grid.update({newData})
|
|
38
|
-
grid.clean()
|
|
39
|
-
grid.flush()
|
|
40
|
-
|
|
41
|
-
const mirror = useStoreMirror(remoteStore, initialState, {mask, current: true})
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Old `Get*`, `*2/*3`, `FuncJSX`, and legacy grid helper names remain documented in `wenay-react2-rare.md` for existing code, but they are not the teaching path for new code.
|
|
45
|
-
|
|
46
|
-
## QA Stand
|
|
47
|
-
|
|
48
|
-
```sh
|
|
49
|
-
npm run testReact -- --host 127.0.0.1 --port 3002
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
The stand source is `src/common/testUseReact/qa.tsx`. Use it for visual checks after changing UI primitives.
|
|
53
|
-
|
|
54
|
-
## Build
|
|
55
|
-
|
|
56
|
-
```sh
|
|
57
|
-
npm run build
|
|
58
|
-
```
|
|
3
|
+
Documentation index only.
|
|
4
|
+
|
|
5
|
+
- Brief API guide: [doc/wenay-react2.md](doc/wenay-react2.md)
|
|
6
|
+
- Detailed / rare API guide: [doc/wenay-react2-rare.md](doc/wenay-react2-rare.md)
|
|
7
|
+
- wenay-react2 rename map: [doc/WENAY_REACT2_RENAMES.md](doc/WENAY_REACT2_RENAMES.md)
|
|
8
|
+
- Pulled wenay-common2 brief guide: [doc/wenay-common2.md](doc/wenay-common2.md)
|
|
9
|
+
- Pulled wenay-common2 detailed / rare guide: [doc/wenay-common2-rare.md](doc/wenay-common2-rare.md)
|
|
10
|
+
- Pulled wenay-common2 rename map: [doc/NAMING_RENAMES.md](doc/NAMING_RENAMES.md)
|
|
11
|
+
- Project rules for maintainers and AI agents: [doc/PROJECT_RULES.md](doc/PROJECT_RULES.md)
|
|
12
|
+
- Recent version changes: [doc/changes/](doc/changes/)
|
|
13
|
+
|
|
14
|
+
Feature-specific docs may also live next to their code, for example agGrid4 docs under `src/common/src/grid/agGrid4/`.
|
package/lib/common/api.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import "../style/menuRight.css";
|
|
2
2
|
import "../style/style.css";
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
7
|
-
import * as
|
|
8
|
-
import * as
|
|
9
|
-
import * as
|
|
10
|
-
import * as
|
|
11
|
-
import * as
|
|
12
|
-
import * as
|
|
3
|
+
import * as hooksKit from "./src/hooks";
|
|
4
|
+
import * as dndKit from "./src/components/Dnd";
|
|
5
|
+
import * as utilsKit from "./src/utils";
|
|
6
|
+
import * as gridKit from "./src/grid/agGrid4";
|
|
7
|
+
import * as modalKit from "./src/components/Modal";
|
|
8
|
+
import * as menuKit from "./src/menu/menu";
|
|
9
|
+
import * as contextMenuKit from "./src/menu/menuMouse";
|
|
10
|
+
import * as rightClickMenuKit from "./src/menu/menuR";
|
|
11
|
+
import * as logsKit from "./src/logs/logs";
|
|
12
|
+
import * as updateByKit from "./updateBy";
|
|
13
13
|
export * from "./src/styles/styleGrid";
|
|
14
14
|
export * from "./src/styles/tokens";
|
|
15
15
|
export * from "./updateBy";
|
|
@@ -17,41 +17,41 @@ export * from "./src/hooks";
|
|
|
17
17
|
export * from "./src/components/Dnd";
|
|
18
18
|
export * from "./src/utils";
|
|
19
19
|
export * from "./src/grid/agGrid4";
|
|
20
|
+
export * from "./src/grid/columnState";
|
|
20
21
|
export * from "./src/components/Buttons";
|
|
21
22
|
export * from "./src/components/MyResizeObserver";
|
|
22
23
|
export * from "./src/components/Other";
|
|
23
24
|
export * from "./src/components/Parameters";
|
|
24
|
-
export * from "./src/components/
|
|
25
|
+
export * from "./src/components/ParamsEditor";
|
|
25
26
|
export * from "./src/components/Input";
|
|
26
27
|
export * from "./src/components/Modal";
|
|
27
28
|
export * from "./src/components/Menu";
|
|
28
29
|
export * from "./src/components/Settings";
|
|
29
30
|
export * from "./src/components/UiSlot";
|
|
30
31
|
export * from "./src/components/Toolbar";
|
|
31
|
-
export {
|
|
32
|
-
export type {
|
|
32
|
+
export { Menu, MenuProgress, MenuElement as MenuItemElement } from "./src/menu/menu";
|
|
33
|
+
export type { MenuItem, MenuItemStrict } from "./src/menu/menu";
|
|
33
34
|
export * from "./src/menu/menuMouse";
|
|
34
35
|
export * from "./src/menu/menuR";
|
|
35
36
|
export * from "./src/logs/logs";
|
|
36
|
-
export * from "./src/logs/
|
|
37
|
+
export * from "./src/logs/logsContext";
|
|
37
38
|
export * from "./src/logs/miniLogs";
|
|
38
39
|
export * from "./src/myChart/1/myChart";
|
|
39
40
|
export * from "./src/myChart/1/myChartTest";
|
|
40
41
|
export * from "./src/myChart/chartEngine/chartEngineReact";
|
|
41
|
-
export declare
|
|
42
|
-
|
|
43
|
-
readonly
|
|
44
|
-
readonly
|
|
45
|
-
readonly
|
|
46
|
-
readonly
|
|
47
|
-
readonly modal: typeof modalV2;
|
|
42
|
+
export declare const kit: {
|
|
43
|
+
readonly hooks: typeof hooksKit;
|
|
44
|
+
readonly dnd: typeof dndKit;
|
|
45
|
+
readonly utils: typeof utilsKit;
|
|
46
|
+
readonly grid: typeof gridKit;
|
|
47
|
+
readonly modal: typeof modalKit;
|
|
48
48
|
readonly menu: {
|
|
49
|
-
readonly
|
|
50
|
-
readonly rightClick: typeof
|
|
51
|
-
readonly
|
|
52
|
-
readonly
|
|
53
|
-
readonly MenuElement: typeof
|
|
49
|
+
readonly context: typeof contextMenuKit;
|
|
50
|
+
readonly rightClick: typeof rightClickMenuKit;
|
|
51
|
+
readonly Menu: typeof menuKit.Menu;
|
|
52
|
+
readonly MenuProgress: typeof menuKit.MenuProgress;
|
|
53
|
+
readonly MenuElement: typeof menuKit.MenuElement;
|
|
54
54
|
};
|
|
55
|
-
readonly logs: typeof
|
|
56
|
-
readonly updateBy: typeof
|
|
55
|
+
readonly logs: typeof logsKit;
|
|
56
|
+
readonly updateBy: typeof updateByKit;
|
|
57
57
|
};
|
package/lib/common/api.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import "../style/menuRight.css";
|
|
2
2
|
import "../style/style.css";
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
7
|
-
import * as
|
|
8
|
-
import * as
|
|
9
|
-
import * as
|
|
10
|
-
import * as
|
|
11
|
-
import * as
|
|
12
|
-
import * as
|
|
3
|
+
import * as hooksKit from "./src/hooks";
|
|
4
|
+
import * as dndKit from "./src/components/Dnd";
|
|
5
|
+
import * as utilsKit from "./src/utils";
|
|
6
|
+
import * as gridKit from "./src/grid/agGrid4";
|
|
7
|
+
import * as modalKit from "./src/components/Modal";
|
|
8
|
+
import * as menuKit from "./src/menu/menu";
|
|
9
|
+
import * as contextMenuKit from "./src/menu/menuMouse";
|
|
10
|
+
import * as rightClickMenuKit from "./src/menu/menuR";
|
|
11
|
+
import * as logsKit from "./src/logs/logs";
|
|
12
|
+
import * as updateByKit from "./updateBy";
|
|
13
13
|
// 0. STYLES - independent
|
|
14
14
|
export * from "./src/styles/styleGrid";
|
|
15
15
|
export * from "./src/styles/tokens";
|
|
@@ -19,18 +19,21 @@ export * from "./updateBy";
|
|
|
19
19
|
export * from "./src/hooks";
|
|
20
20
|
// 4. DND components - depend on updateBy
|
|
21
21
|
export * from "./src/components/Dnd";
|
|
22
|
-
// 5. UTILS - now depend on Dnd (
|
|
22
|
+
// 5. UTILS - now depend on Dnd (memoryStore imports floatingWindowMap, mapResiReact)
|
|
23
23
|
export * from "./src/utils";
|
|
24
|
-
// 5b. GRID (agGrid4): core buffer + headless hook +
|
|
24
|
+
// 5b. GRID (agGrid4): core buffer + headless hook + AgGridTable.
|
|
25
25
|
export * from "./src/grid/agGrid4";
|
|
26
|
+
// 5c. GRID column state (createColumnState): persisted order/visibility/width/sort/filter,
|
|
27
|
+
// standalone config store + optional two-way ag-grid adapter (attach via onGridReady)
|
|
28
|
+
export * from "./src/grid/columnState";
|
|
26
29
|
// 6. BASE COMPONENTS - depend on hooks
|
|
27
30
|
export * from "./src/components/Buttons";
|
|
28
31
|
export * from "./src/components/MyResizeObserver";
|
|
29
32
|
export * from "./src/components/Other";
|
|
30
33
|
// 7. Parameters - depends on utils
|
|
31
34
|
export * from "./src/components/Parameters";
|
|
32
|
-
// 8.
|
|
33
|
-
export * from "./src/components/
|
|
35
|
+
// 8. ParamsEditor - depends on Parameters and utils
|
|
36
|
+
export * from "./src/components/ParamsEditor";
|
|
34
37
|
// 9. Input - depends on hooks and Dnd
|
|
35
38
|
export * from "./src/components/Input";
|
|
36
39
|
// 10. Modal - depends on Input and updateBy
|
|
@@ -44,31 +47,28 @@ export * from "./src/components/UiSlot";
|
|
|
44
47
|
// pure Settings editor works both in the bar's gear popover and in a settings section
|
|
45
48
|
export * from "./src/components/Toolbar";
|
|
46
49
|
// 12. MENU - depends on components
|
|
47
|
-
export {
|
|
50
|
+
export { Menu, MenuProgress, MenuElement as MenuItemElement } from "./src/menu/menu";
|
|
48
51
|
export * from "./src/menu/menuMouse";
|
|
49
52
|
export * from "./src/menu/menuR";
|
|
50
|
-
// 13. LOGS - depend on utils/
|
|
53
|
+
// 13. LOGS - depend on utils/memoryStore, menu, and components/ParamsEditor
|
|
51
54
|
export * from "./src/logs/logs";
|
|
52
|
-
export * from "./src/logs/
|
|
55
|
+
export * from "./src/logs/logsContext";
|
|
53
56
|
export * from "./src/logs/miniLogs";
|
|
54
57
|
// 14. CHARTS - highest level
|
|
55
58
|
export * from "./src/myChart/1/myChart";
|
|
56
59
|
export * from "./src/myChart/1/myChartTest";
|
|
57
60
|
export * from "./src/myChart/chartEngine/chartEngineReact";
|
|
58
|
-
export
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
utils: utilsV2,
|
|
65
|
-
grid: gridV2,
|
|
66
|
-
modal: modalV2,
|
|
61
|
+
export const kit = {
|
|
62
|
+
hooks: hooksKit,
|
|
63
|
+
dnd: dndKit,
|
|
64
|
+
utils: utilsKit,
|
|
65
|
+
grid: gridKit,
|
|
66
|
+
modal: modalKit,
|
|
67
67
|
menu: {
|
|
68
|
-
...
|
|
69
|
-
|
|
70
|
-
rightClick:
|
|
68
|
+
...menuKit,
|
|
69
|
+
context: contextMenuKit,
|
|
70
|
+
rightClick: rightClickMenuKit,
|
|
71
71
|
},
|
|
72
|
-
logs:
|
|
73
|
-
updateBy:
|
|
72
|
+
logs: logsKit,
|
|
73
|
+
updateBy: updateByKit,
|
|
74
74
|
};
|
|
@@ -8,11 +8,9 @@ export declare function MiniButton({ name, arr, get, onClick, style }: {
|
|
|
8
8
|
onClick: (index: number) => void;
|
|
9
9
|
style?: React.CSSProperties | undefined;
|
|
10
10
|
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function PopupButton({ name, children, statusDef, className }: {
|
|
12
12
|
name: string;
|
|
13
13
|
statusDef?: boolean;
|
|
14
14
|
children: React.ReactElement | (() => React.ReactElement);
|
|
15
15
|
className?: string;
|
|
16
16
|
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
/** @deprecated Use MiniButton2 instead */
|
|
18
|
-
export declare const MiniButton3: typeof MiniButton2;
|
|
@@ -10,9 +10,7 @@ export function MiniButton({ name, arr, get, onClick, style }) {
|
|
|
10
10
|
onClick(i);
|
|
11
11
|
}, children: k }, k)) }) }) });
|
|
12
12
|
}
|
|
13
|
-
export function
|
|
13
|
+
export function PopupButton({ name, children, statusDef, className = "newButtonSimple" }) {
|
|
14
14
|
const content = typeof children === 'function' ? children() : children;
|
|
15
15
|
return _jsx(Button, { className: className, statusDef: statusDef, button: (e) => _jsx("div", { className: e ? "msTradeAlt msTradeActive" : "msTradeAlt", children: name }), children: content });
|
|
16
16
|
}
|
|
17
|
-
/** @deprecated Use MiniButton2 instead */
|
|
18
|
-
export const MiniButton3 = MiniButton2;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
//
|
|
4
|
-
export function
|
|
4
|
+
export function DragArea({ children, onY, onX, x = 0, y = 0, last, onStart, onStop, }) {
|
|
5
5
|
const lastC = useRef(null);
|
|
6
6
|
const lastT = useRef(null);
|
|
7
7
|
const [a, setA] = useState(false);
|
|
@@ -12,7 +12,7 @@ type tRND = {
|
|
|
12
12
|
position: tPosition;
|
|
13
13
|
size: tSize;
|
|
14
14
|
};
|
|
15
|
-
export type
|
|
15
|
+
export type FloatingWindowUpdate = {
|
|
16
16
|
e: MouseEvent | TouchEvent;
|
|
17
17
|
dir: string;
|
|
18
18
|
elementRef: HTMLElement;
|
|
@@ -26,7 +26,7 @@ type tDivRndBase = {
|
|
|
26
26
|
zIndex?: number;
|
|
27
27
|
disableDragging?: () => boolean;
|
|
28
28
|
keyForSave?: string;
|
|
29
|
-
onUpdate?: (data:
|
|
29
|
+
onUpdate?: (data: FloatingWindowUpdate) => void;
|
|
30
30
|
position?: tPosition;
|
|
31
31
|
size?: tSize;
|
|
32
32
|
moveOnlyHeader?: boolean;
|
|
@@ -47,14 +47,14 @@ type tDivRndBase = {
|
|
|
47
47
|
children: React.ReactElement | ((update: number) => React.ReactElement);
|
|
48
48
|
className?: string;
|
|
49
49
|
};
|
|
50
|
-
export declare const
|
|
51
|
-
export declare const
|
|
50
|
+
export declare const floatingWindowMap: ObservableMap<string, tRND>;
|
|
51
|
+
export declare const FloatingWindow: typeof FloatingWindowBase;
|
|
52
52
|
/**
|
|
53
53
|
* Wrapper component around react-rnd.
|
|
54
54
|
* Provides dragging and resizing, an optional header, and a close button.
|
|
55
55
|
*/
|
|
56
|
-
export declare function
|
|
57
|
-
export type
|
|
56
|
+
export declare function FloatingWindowBase({ children, keyForSave: ks, position, size, overflow, zIndex, onUpdate, disableDragging, className, header, moveOnlyHeader, limit, onCLickClose, sizeByWindow }: tDivRndBase): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
export type DragBoxProps = {
|
|
58
58
|
/** Child element that should be draggable */
|
|
59
59
|
children: ReactNode;
|
|
60
60
|
/** Callback when the X coordinate changes */
|
|
@@ -88,5 +88,5 @@ export type Drag2Props = {
|
|
|
88
88
|
* Function only as a hook for parameter changes during movement, although it has its own component (for offset counting).
|
|
89
89
|
* Returns the distance traveled when moving the child element.
|
|
90
90
|
*/
|
|
91
|
-
export declare function
|
|
91
|
+
export declare function DragBox({ children, onX, onY, x, y, right, last, dragging, onStart, onStop }: DragBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
92
92
|
export {};
|
|
@@ -3,25 +3,25 @@ import React, { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
|
3
3
|
import { Rnd } from "react-rnd";
|
|
4
4
|
import { renderBy, updateBy } from "../../../updateBy";
|
|
5
5
|
import { ObservableMap } from "../../utils/observableMap";
|
|
6
|
-
// Map of all popup window sizes; observable -
|
|
7
|
-
export const
|
|
6
|
+
// Map of all popup window sizes; observable - memoryCache marks itself dirty on its mutations
|
|
7
|
+
export const floatingWindowMap = new ObservableMap();
|
|
8
8
|
// limit={{x:{min:0}, y:{min:0}}}
|
|
9
9
|
let k = 0;
|
|
10
10
|
const openWindows = { ar: [] };
|
|
11
11
|
// Freezes the subtree until update changes (intentionally ignores render closure changes) -
|
|
12
12
|
// the previous useMemo-in-callback semantics, but without calling a hook from an arbitrary place
|
|
13
13
|
const MemoChild = React.memo(({ update, render }) => render(update), (prev, next) => prev.update === next.update);
|
|
14
|
-
export const
|
|
14
|
+
export const FloatingWindow = (a) => {
|
|
15
15
|
const isFunc = typeof a.children === "function";
|
|
16
16
|
const renderChild = (update) => typeof a.children === "function" ? a.children(update) : a.children;
|
|
17
17
|
const ff = (update) => _jsx(MemoChild, { update: isFunc ? update : 0, render: renderChild });
|
|
18
|
-
return _jsx(
|
|
18
|
+
return _jsx(FloatingWindowBase, { ...a, children: ff });
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
21
|
* Wrapper component around react-rnd.
|
|
22
22
|
* Provides dragging and resizing, an optional header, and a close button.
|
|
23
23
|
*/
|
|
24
|
-
export function
|
|
24
|
+
export function FloatingWindowBase({ children, keyForSave: ks, position, size, overflow = true, zIndex = 9, onUpdate, disableDragging, className, header, moveOnlyHeader, limit, onCLickClose, sizeByWindow = true }) {
|
|
25
25
|
// NOTE: no implicit limit for onCLickClose windows. `limit` is parent-relative,
|
|
26
26
|
// so {y:{min:0}} pinned windows to their DOM parent's top: a window opened from a
|
|
27
27
|
// centered wrapper (ModalProvider / ModalWrapper at top:50%) could not be dragged
|
|
@@ -32,7 +32,7 @@ export function DivRndBase3({ children, keyForSave: ks, position, size, overflow
|
|
|
32
32
|
// If there is a key, store position and size data in the map
|
|
33
33
|
let map;
|
|
34
34
|
if (ks) {
|
|
35
|
-
map =
|
|
35
|
+
map = floatingWindowMap.get(ks) ?? floatingWindowMap.set(ks, { size: sizeDef, position: positionDef }).get(ks);
|
|
36
36
|
}
|
|
37
37
|
position = map?.position ?? positionDef;
|
|
38
38
|
size = map?.size ?? sizeDef;
|
|
@@ -101,7 +101,7 @@ export function DivRndBase3({ children, keyForSave: ks, position, size, overflow
|
|
|
101
101
|
// drag end commits geometry mutated in place - invisible to the map, so announce
|
|
102
102
|
// it; a no-move click also lands here, the save-side diff turns that into a no-op
|
|
103
103
|
if (ks)
|
|
104
|
-
|
|
104
|
+
floatingWindowMap.touch(ks);
|
|
105
105
|
};
|
|
106
106
|
// Touch
|
|
107
107
|
const touchMoveHandler = (e) => {
|
|
@@ -147,7 +147,7 @@ export function DivRndBase3({ children, keyForSave: ks, position, size, overflow
|
|
|
147
147
|
document.removeEventListener("touchmove", touchMoveHandler);
|
|
148
148
|
setB(false);
|
|
149
149
|
if (ks)
|
|
150
|
-
|
|
150
|
+
floatingWindowMap.touch(ks);
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
153
|
// If mouse dragging mode is active
|
|
@@ -235,7 +235,7 @@ export function DivRndBase3({ children, keyForSave: ks, position, size, overflow
|
|
|
235
235
|
setWidth(elementRef.offsetWidth);
|
|
236
236
|
setUpdate(update + 1);
|
|
237
237
|
if (ks)
|
|
238
|
-
|
|
238
|
+
floatingWindowMap.touch(ks);
|
|
239
239
|
}, onResize: (e, dir, elementRef, delta, pos) => {
|
|
240
240
|
onUpdate?.({ e, dir, elementRef, delta, position: pos });
|
|
241
241
|
}, position: { x, y }, size: { width, height }, default: {
|
|
@@ -271,7 +271,7 @@ export function DivRndBase3({ children, keyForSave: ks, position, size, overflow
|
|
|
271
271
|
* Function only as a hook for parameter changes during movement, although it has its own component (for offset counting).
|
|
272
272
|
* Returns the distance traveled when moving the child element.
|
|
273
273
|
*/
|
|
274
|
-
export function
|
|
274
|
+
export function DragBox({ children, onX, onY, x = 0, y = 0, right = false, last, dragging, onStart, onStop }) {
|
|
275
275
|
const offsetMouse = useRef({ x: 0, y: 0 });
|
|
276
276
|
const offsetTouch = useRef(null);
|
|
277
277
|
const [draggingMouse, setDraggingMouse] = useState(false);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function OutlineDragDemo(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
const ANIMATION_DURATION = 500; // animation duration in ms
|
|
4
|
-
|
|
5
|
-
export function DraggableOutlineDiv() {
|
|
4
|
+
export function OutlineDragDemo() {
|
|
6
5
|
const [isDragging, setIsDragging] = useState(false);
|
|
7
6
|
const [animationFinished, setAnimationFinished] = useState(false);
|
|
8
7
|
const timerRef = useRef(null);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Resizable } from "re-resizable";
|
|
3
3
|
import { ObservableMap } from "../../utils/observableMap";
|
|
4
|
-
// Memory for all column sizes; observable -
|
|
4
|
+
// Memory for all column sizes; observable - memoryCache marks itself dirty on its mutations
|
|
5
5
|
export const mapResiReact = new ObservableMap();
|
|
6
6
|
export function FResizableReact({ style, onResize, enable, children, keyForSave, onResizeStop, size = { height: 50, width: 50 }, minWidth, minHeight, maxWidth = "100%", maxHeight = "100%", moveWith = true, moveHeight = true }) {
|
|
7
7
|
let obj = size;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './OutlineDragDemo';
|
|
2
|
+
export * from './DragArea';
|
|
3
3
|
export * from './Resizable';
|
|
4
|
-
export * from './
|
|
4
|
+
export * from './FloatingWindow';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './OutlineDragDemo';
|
|
2
|
+
export * from './DragArea';
|
|
3
3
|
export * from './Resizable';
|
|
4
|
-
export * from './
|
|
4
|
+
export * from './FloatingWindow';
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function TextInputPanel({ callback, name, txt }: {
|
|
3
3
|
callback: (txt: string) => void;
|
|
4
4
|
name?: string;
|
|
5
5
|
txt?: string;
|
|
6
6
|
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function TextInputModal({ callback, name, outClick, keyForSave, txt }: Parameters<typeof TextInputPanel>[0] & {
|
|
8
8
|
outClick: () => any;
|
|
9
9
|
keyForSave?: string;
|
|
10
10
|
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function FileInputModal({ callback, name, outClick, keyForSave }: Parameters<typeof FileInputPanel>[0] & {
|
|
12
12
|
outClick: () => any;
|
|
13
13
|
keyForSave?: string;
|
|
14
14
|
}): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function FileInputPanel({ callback, name }: {
|
|
16
16
|
callback: (file: File | null) => void;
|
|
17
17
|
name?: string;
|
|
18
18
|
}): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function FreeModal({ outClick, children, zIndex, size, keyForSave }: {
|
|
20
20
|
zIndex?: number;
|
|
21
21
|
outClick: () => any;
|
|
22
22
|
children: React.JSX.Element;
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRef } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { OutsideClickArea } from "../hooks/useOutside";
|
|
4
|
+
import { FloatingWindow } from "./Dnd/FloatingWindow";
|
|
5
5
|
// Unified modal wrapper component
|
|
6
6
|
function ModalWrapper({ outClick, children, zIndex, size = { height: 150, width: 300 }, keyForSave, position }) {
|
|
7
7
|
const defaultPosition = position ?? { y: -(size.height / 2), x: -(size.width / 2) };
|
|
8
|
-
return _jsx(
|
|
8
|
+
return _jsx(OutsideClickArea, { outsideClick: outClick, style: { position: "absolute", top: "50%", left: "50%" }, children: _jsx(FloatingWindow, { keyForSave: keyForSave, size: size, zIndex: zIndex, position: defaultPosition, className: "fon border fonLight", moveOnlyHeader: true, children: children }) });
|
|
9
9
|
}
|
|
10
|
-
export function
|
|
10
|
+
export function TextInputPanel({ callback, name = "", txt = "" }) {
|
|
11
11
|
const txtName = useRef(txt);
|
|
12
12
|
return _jsxs("div", { className: "maxSize", style: { padding: 20, }, children: [_jsx("label", { children: name }), _jsx("input", { type: "text", style: { width: "100%" }, defaultValue: txtName.current, onChange: (e) => {
|
|
13
13
|
txtName.current = e.target.value;
|
|
14
14
|
} }), _jsx("div", { style: { marginTop: 20 }, className: "msTradeAlt msTradeActive", onClick: () => { callback(txtName.current); }, children: "send" })] });
|
|
15
15
|
}
|
|
16
|
-
export function
|
|
17
|
-
return _jsx(ModalWrapper, { outClick: outClick, keyForSave: keyForSave, size: { height: 150, width: 300 }, position: { y: -150, x: -250 }, children: _jsx(
|
|
16
|
+
export function TextInputModal({ callback, name, outClick, keyForSave = "TextInputModal", txt }) {
|
|
17
|
+
return _jsx(ModalWrapper, { outClick: outClick, keyForSave: keyForSave, size: { height: 150, width: 300 }, position: { y: -150, x: -250 }, children: _jsx(TextInputPanel, { callback: callback, name: name, txt: txt }) });
|
|
18
18
|
}
|
|
19
|
-
export function
|
|
20
|
-
return _jsx(ModalWrapper, { outClick: outClick, keyForSave: keyForSave, size: { height: 150, width: 300 }, position: { y: -150, x: -250 }, children: _jsx(
|
|
19
|
+
export function FileInputModal({ callback, name, outClick, keyForSave = "FileInputModal" }) {
|
|
20
|
+
return _jsx(ModalWrapper, { outClick: outClick, keyForSave: keyForSave, size: { height: 150, width: 300 }, position: { y: -150, x: -250 }, children: _jsx(FileInputPanel, { callback: callback, name: name }) });
|
|
21
21
|
}
|
|
22
|
-
export function
|
|
22
|
+
export function FileInputPanel({ callback, name = "" }) {
|
|
23
23
|
const file = useRef(null);
|
|
24
24
|
return _jsxs("div", { className: "maxSize", style: { padding: 20, }, children: [_jsx("label", { children: name }), _jsx("input", { type: "file", style: { width: "100%" }, onChange: (e) => {
|
|
25
25
|
file.current = e.target.files?.[0] ?? null;
|
|
26
26
|
} }), _jsx("div", { style: { marginTop: 20 }, className: "msTradeAlt msTradeActive", onClick: () => { callback(file.current); }, children: "send" })] });
|
|
27
27
|
}
|
|
28
|
-
export function
|
|
28
|
+
export function FreeModal({ outClick, children, zIndex, size = { height: 150, width: 300 }, keyForSave = "FreeModal" }) {
|
|
29
29
|
return _jsx(ModalWrapper, { outClick: outClick, keyForSave: keyForSave, size: size, zIndex: zIndex, children: children });
|
|
30
30
|
}
|
|
@@ -1,22 +1,42 @@
|
|
|
1
1
|
import React, { JSX } from 'react';
|
|
2
|
-
import { type MenuRightPosition, type
|
|
2
|
+
import { type MenuRightPosition, type MenuRightVerticalPosition } from "./RightMenuStore";
|
|
3
3
|
export type MenuElement = {
|
|
4
4
|
label: string;
|
|
5
5
|
subMenuContent: () => JSX.Element;
|
|
6
6
|
};
|
|
7
|
+
export type MenuRightTriggerState = {
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
isFixed: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type MenuRightTrigger = React.ReactNode | ((state: MenuRightTriggerState) => React.ReactNode);
|
|
12
|
+
export type MenuRightClassNames = Partial<{
|
|
13
|
+
container: string;
|
|
14
|
+
activeContainer: string;
|
|
15
|
+
trigger: string;
|
|
16
|
+
flyout: string;
|
|
17
|
+
flyoutUp: string;
|
|
18
|
+
list: string;
|
|
19
|
+
item: string;
|
|
20
|
+
itemActive: string;
|
|
21
|
+
submenu: string;
|
|
22
|
+
}>;
|
|
23
|
+
export type MenuRightStyles = Partial<Record<'container' | 'trigger' | 'flyout' | 'list' | 'item' | 'submenu', React.CSSProperties>>;
|
|
7
24
|
export type DropdownMenuProps = {
|
|
8
25
|
elements: MenuElement[];
|
|
9
26
|
style?: React.CSSProperties;
|
|
27
|
+
styles?: MenuRightStyles;
|
|
28
|
+
classNames?: MenuRightClassNames;
|
|
29
|
+
trigger?: MenuRightTrigger;
|
|
10
30
|
position?: MenuRightPosition;
|
|
11
|
-
|
|
31
|
+
verticalPosition?: MenuRightVerticalPosition;
|
|
12
32
|
keyForSave?: string;
|
|
13
33
|
};
|
|
14
34
|
export type MenuRightRenderProps = Omit<DropdownMenuProps, 'elements'>;
|
|
15
|
-
export declare function DropdownMenu({ elements, style, position: initialPosition,
|
|
16
|
-
export declare function
|
|
35
|
+
export declare function DropdownMenu({ elements, style, styles, classNames, trigger, position: initialPosition, verticalPosition: initialVerticalPosition, keyForSave }: DropdownMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export declare function createRightMenuController(): {
|
|
17
37
|
set(array: MenuElement[]): void;
|
|
18
38
|
delete(array: MenuElement[]): void;
|
|
19
39
|
get(): MenuElement[];
|
|
20
40
|
Render(props?: MenuRightRenderProps): import("react/jsx-runtime").JSX.Element;
|
|
21
41
|
};
|
|
22
|
-
export declare function
|
|
42
|
+
export declare function RightMenuDemo(): import("react/jsx-runtime").JSX.Element;
|