wenay-react2 1.0.7 → 1.0.10
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/lib/common/api.d.ts +10 -2
- package/lib/common/api.js +24 -5
- package/lib/common/src/components/Buttons/MiniButton.js +1 -1
- package/lib/common/src/components/Dnd/index.d.ts +1 -1
- package/lib/common/src/components/Dnd/index.js +1 -1
- package/lib/common/src/components/Input.js +5 -5
- package/lib/common/src/components/Menu/RightMenu.js +4 -3
- package/lib/common/src/components/Menu/index.d.ts +1 -1
- package/lib/common/src/components/Menu/index.js +1 -1
- package/lib/common/src/components/Modal/LeftModal.js +1 -1
- package/lib/common/src/components/Modal/Modal.js +1 -1
- package/lib/common/src/components/Modal/ModalContextProvider.js +1 -1
- package/lib/common/src/components/Modal/index.d.ts +1 -1
- package/lib/common/src/components/Modal/index.js +1 -1
- package/lib/common/src/components/ParametersEngine.js +5 -6
- package/lib/common/src/hooks/useOutside.d.ts +2 -2
- package/lib/common/src/hooks/useOutside.js +10 -14
- package/lib/common/src/logs/logs.js +2 -2
- package/lib/common/src/menu/menuR.js +1 -1
- package/lib/common/src/utils/inputAutoStep.d.ts +8 -1
- package/lib/common/src/utils/mapMemory.js +2 -1
- package/package.json +3 -3
- package/lib/common/src/components/index.d.ts +0 -9
- package/lib/common/src/components/index.js +0 -9
package/lib/common/api.d.ts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import "../style/menuRight.css";
|
|
2
2
|
import "../style/style.css";
|
|
3
|
-
export * from "./
|
|
3
|
+
export * from "./updateBy";
|
|
4
4
|
export * from "./src/hooks";
|
|
5
5
|
export * from "./src/styles";
|
|
6
|
+
export * from "./src/components/Dnd";
|
|
6
7
|
export * from "./src/utils";
|
|
8
|
+
export * from "./src/components/Buttons";
|
|
9
|
+
export * from "./src/components/MyResizeObserver";
|
|
10
|
+
export * from "./src/components/Other";
|
|
11
|
+
export * from "./src/components/Parameters";
|
|
12
|
+
export * from "./src/components/ParametersEngine";
|
|
13
|
+
export * from "./src/components/Input";
|
|
14
|
+
export * from "./src/components/Modal";
|
|
15
|
+
export * from "./src/components/Menu";
|
|
7
16
|
export * from "./src/menu/menu";
|
|
8
17
|
export * from "./src/menu/menuMouse";
|
|
9
18
|
export * from "./src/menu/menuR";
|
|
@@ -13,5 +22,4 @@ export * from "./src/logs/miniLogs";
|
|
|
13
22
|
export * from "./src/myChart/1/myChart";
|
|
14
23
|
export * from "./src/myChart/1/myChartTest";
|
|
15
24
|
export * from "./src/myChart/chartEngine/chartEngineReact";
|
|
16
|
-
export * from "./updateBy";
|
|
17
25
|
export declare function test(): number;
|
package/lib/common/api.js
CHANGED
|
@@ -1,23 +1,42 @@
|
|
|
1
1
|
// ... existing code ...
|
|
2
2
|
import "../style/menuRight.css";
|
|
3
3
|
import "../style/style.css";
|
|
4
|
-
//
|
|
5
|
-
export * from "./
|
|
4
|
+
// 1. БАЗОВЫЙ СЛОЙ - никаких зависимостей внутри проекта
|
|
5
|
+
export * from "./updateBy";
|
|
6
|
+
// 2. ХУКИ - зависят только от updateBy
|
|
6
7
|
export * from "./src/hooks";
|
|
8
|
+
// 3. СТИЛИ - независимые
|
|
7
9
|
export * from "./src/styles";
|
|
10
|
+
// 4. DND компоненты - зависят от updateBy
|
|
11
|
+
export * from "./src/components/Dnd";
|
|
12
|
+
// 5. UTILS - теперь зависят от Dnd (mapMemory импортирует ExRNDMap3, mapResiReact)
|
|
8
13
|
export * from "./src/utils";
|
|
9
|
-
//
|
|
14
|
+
// 6. БАЗОВЫЕ КОМПОНЕНТЫ - зависят от hooks
|
|
15
|
+
export * from "./src/components/Buttons";
|
|
16
|
+
export * from "./src/components/MyResizeObserver";
|
|
17
|
+
export * from "./src/components/Other";
|
|
18
|
+
// 7. Parameters - зависит от utils
|
|
19
|
+
export * from "./src/components/Parameters";
|
|
20
|
+
// 8. ParametersEngine - зависит от Parameters и utils
|
|
21
|
+
export * from "./src/components/ParametersEngine";
|
|
22
|
+
// 9. Input - зависит от hooks и Dnd
|
|
23
|
+
export * from "./src/components/Input";
|
|
24
|
+
// 10. Modal - зависит от Input и updateBy
|
|
25
|
+
export * from "./src/components/Modal";
|
|
26
|
+
// 11. Menu - зависит от hooks, Dnd и Modal
|
|
27
|
+
export * from "./src/components/Menu";
|
|
28
|
+
// 12. МЕНЮ - зависят от компонентов
|
|
10
29
|
export * from "./src/menu/menu";
|
|
11
30
|
export * from "./src/menu/menuMouse";
|
|
12
31
|
export * from "./src/menu/menuR";
|
|
32
|
+
// 13. ЛОГИ - зависят от utils/mapMemory, menu и components/ParametersEngine
|
|
13
33
|
export * from "./src/logs/logs";
|
|
14
34
|
export * from "./src/logs/logs3";
|
|
15
35
|
export * from "./src/logs/miniLogs";
|
|
36
|
+
// 14. ГРАФИКИ - самый высокий уровень
|
|
16
37
|
export * from "./src/myChart/1/myChart";
|
|
17
38
|
export * from "./src/myChart/1/myChartTest";
|
|
18
39
|
export * from "./src/myChart/chartEngine/chartEngineReact";
|
|
19
|
-
// Файлы в корне src/common
|
|
20
|
-
export * from "./updateBy";
|
|
21
40
|
export function test() {
|
|
22
41
|
return 5;
|
|
23
42
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Button } from "../../hooks";
|
|
2
|
+
import { Button } from "../../hooks/useOutside";
|
|
3
3
|
export function MiniButton({ name, arr, get, onClick, style }) {
|
|
4
4
|
const data = get();
|
|
5
5
|
const a = Object.values(data);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRef } from "react";
|
|
3
|
-
import { DivOutsideClick } from "../hooks";
|
|
4
|
-
import { DivRnd3 } from "./Dnd";
|
|
3
|
+
import { DivOutsideClick } from "../hooks/useOutside";
|
|
4
|
+
import { DivRnd3 } from "./Dnd/RNDFunc3";
|
|
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) };
|
|
@@ -10,14 +10,14 @@ function ModalWrapper({ outClick, children, zIndex, size = { height: 150, width:
|
|
|
10
10
|
export function InputPage({ 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
|
-
txtName.current = e.target.value;
|
|
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
16
|
export function InputPageModal({ callback, name, outClick, keyForSave = "InputPage2", txt }) {
|
|
17
|
-
return _jsx(ModalWrapper, { outClick: outClick, keyForSave: keyForSave, size: { height: 150, width: 300 }, position: { y: -150, x: -250 }, children: InputPage
|
|
17
|
+
return _jsx(ModalWrapper, { outClick: outClick, keyForSave: keyForSave, size: { height: 150, width: 300 }, position: { y: -150, x: -250 }, children: _jsx(InputPage, { callback: callback, name: name, txt: txt }) });
|
|
18
18
|
}
|
|
19
19
|
export function InputFileModal({ callback, name, outClick, keyForSave = "InputFile2" }) {
|
|
20
|
-
return _jsx(ModalWrapper, { outClick: outClick, keyForSave: keyForSave, size: { height: 150, width: 300 }, position: { y: -150, x: -250 }, children: InputFile
|
|
20
|
+
return _jsx(ModalWrapper, { outClick: outClick, keyForSave: keyForSave, size: { height: 150, width: 300 }, position: { y: -150, x: -250 }, children: _jsx(InputFile, { callback: callback, name: name }) });
|
|
21
21
|
}
|
|
22
22
|
export function InputFile({ callback, name = "" }) {
|
|
23
23
|
let file = null;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { sleepAsync } from 'wenay-common2';
|
|
4
|
-
import {
|
|
5
|
-
import { DivOutsideClick
|
|
6
|
-
import { DraggableOutlineDiv } from "../Dnd";
|
|
4
|
+
import { useDraggable } from "../../hooks/useDraggable";
|
|
5
|
+
import { DivOutsideClick } from "../../hooks/useOutside";
|
|
6
|
+
import { DraggableOutlineDiv } from "../Dnd/DraggableOutlineDiv";
|
|
7
|
+
import { GetModalFuncJSX } from "../Modal/Modal";
|
|
7
8
|
export function DropdownMenu({ elements, style, position: initialPosition = 'right', position2: initialPos2 = 'top' }) {
|
|
8
9
|
const [isOpen, setIsOpen] = useState(false);
|
|
9
10
|
const [isFixed, setIsFixed] = useState(false);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { colorGenerator2, sleepAsync } from "wenay-common2";
|
|
4
|
-
import { Drag22 } from "../Dnd";
|
|
5
4
|
import { renderBy, updateBy } from "../../../updateBy";
|
|
6
5
|
import { GetModalJSX } from "./Modal";
|
|
6
|
+
import { Drag22 } from "../Dnd/RNDFunc3";
|
|
7
7
|
function useViewport() {
|
|
8
8
|
const [width, setWidth] = useState(window.innerWidth);
|
|
9
9
|
useEffect(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx_1 } from "react/jsx-runtime";
|
|
2
|
-
import { InputPageModal } from "../Input";
|
|
3
2
|
import { renderBy, updateBy } from "../../../updateBy";
|
|
3
|
+
import { InputPageModal } from "../Input";
|
|
4
4
|
export function inputModal({ setModalJSX, func, name, txt }) {
|
|
5
5
|
setModalJSX(_jsx_1(InputPageModal, { callback: txt => {
|
|
6
6
|
func(txt);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useContext, useState } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
|
-
import { DivOutsideClick } from "../../hooks";
|
|
4
|
+
import { DivOutsideClick } from "../../hooks/useOutside";
|
|
5
5
|
// Контекст хранит только функцию setModal
|
|
6
6
|
const ModalContext = createContext(() => { });
|
|
7
7
|
export const ModalProvider = ({ children }) => {
|
|
@@ -27,12 +27,12 @@ function DivHover({ children, className, style }) {
|
|
|
27
27
|
}
|
|
28
28
|
function CheckBox(set, val, style) {
|
|
29
29
|
return _jsx("input", { type: "checkbox", style: { marginTop: "auto", marginBottom: "auto", ...style }, checked: val, onChange: (a) => {
|
|
30
|
-
set(a.
|
|
30
|
+
set(a.target.checked);
|
|
31
31
|
} });
|
|
32
32
|
}
|
|
33
33
|
function InputString(set, val, style) {
|
|
34
34
|
return _jsx("input", { type: "text", style: { marginTop: "auto", marginBottom: "auto", ...style }, value: val, onChange: (e) => {
|
|
35
|
-
set(e.
|
|
35
|
+
set(e.target.value);
|
|
36
36
|
} });
|
|
37
37
|
}
|
|
38
38
|
function InputTime(set, value, range) {
|
|
@@ -82,8 +82,6 @@ function InputTime(set, value, range) {
|
|
|
82
82
|
}, onMouseLeave: () => {
|
|
83
83
|
_ref?.blur();
|
|
84
84
|
} }) }), _jsx("input", { required: true, className: "toNumberInput inputCan", type: "number", style: { width: 18, marginLeft: -13, marginRight: 0 }, min: toNum(min), max: toNum(max), step: step, value: toNum(value), onInput: (e) => {
|
|
85
|
-
//console.log("value:",toNum(value),"->",e.currentTarget.value);
|
|
86
|
-
//<input type="number" value={this.vvv ?? 99} onInput={(e)=>{console.log(this.vvv= e.currentTarget.value); this.Refresh(); }}/>
|
|
87
85
|
const target = e.currentTarget;
|
|
88
86
|
setVal(Number(target.value));
|
|
89
87
|
},
|
|
@@ -126,9 +124,10 @@ function InputNumber(set, value, range) {
|
|
|
126
124
|
_inputNumStrMap.delete(range);
|
|
127
125
|
let _ref;
|
|
128
126
|
return _jsxs(_Fragment, { children: [_jsx("input", { type: "range", min: range.defaultMin ?? range.min, max: range.defaultMax ?? range.max, step: range.defaultStep ?? range.step, value: String(value), onInput: (e) => {
|
|
129
|
-
|
|
127
|
+
const current = e.currentTarget;
|
|
128
|
+
set(Number(current.value));
|
|
130
129
|
if (_ref)
|
|
131
|
-
_ref.step =
|
|
130
|
+
_ref.step = current.step;
|
|
132
131
|
}, ref: (ref) => {
|
|
133
132
|
if (ref) {
|
|
134
133
|
setResizeableElement(ref);
|
|
@@ -33,8 +33,8 @@ export declare const DivOutsideClick2: React.ForwardRefExoticComponent<React.HTM
|
|
|
33
33
|
status?: boolean;
|
|
34
34
|
zIndex?: number;
|
|
35
35
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
36
|
-
export declare function Button({ keySave, statusDef, outClick, ...data }: tButton):
|
|
36
|
+
export declare function Button({ keySave, statusDef, outClick, ...data }: tButton): import("react/jsx-runtime").JSX.Element;
|
|
37
37
|
export declare function ButtonHover(props: tButtonBase): import("react/jsx-runtime").JSX.Element;
|
|
38
38
|
export declare const ButtonOutClick: typeof Button;
|
|
39
|
-
export declare function ButtonAbs(
|
|
39
|
+
export declare function ButtonAbs(props: Parameters<typeof Button>[0]): import("react/jsx-runtime").JSX.Element;
|
|
40
40
|
export {};
|
|
@@ -42,16 +42,12 @@ export function Button({ keySave, statusDef, outClick, ...data }) {
|
|
|
42
42
|
if (keySave && saveStatus[keySave])
|
|
43
43
|
statusDef = saveStatus[keySave];
|
|
44
44
|
const state = useState(statusDef ?? false);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
outClick();
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
: ButtonBase({ ...data, state });
|
|
45
|
+
const handleOutsideClick = () => {
|
|
46
|
+
state[1](false);
|
|
47
|
+
if (typeof outClick == "function")
|
|
48
|
+
outClick();
|
|
49
|
+
};
|
|
50
|
+
return outClick ? (_jsx(DivOutsideClick, { status: state[0], outsideClick: handleOutsideClick, children: _jsx(ButtonBase, { ...data, state: state }) })) : (_jsx(ButtonBase, { ...data, state: state }));
|
|
55
51
|
}
|
|
56
52
|
export function ButtonHover(props) {
|
|
57
53
|
const [hover, setHover] = useState(false);
|
|
@@ -59,10 +55,10 @@ export function ButtonHover(props) {
|
|
|
59
55
|
_jsx("div", { style: { position: "absolute" }, children: typeof props.children == "function" ? props.children({ onClose: () => setHover(false) }) : props.children })] });
|
|
60
56
|
}
|
|
61
57
|
export const ButtonOutClick = ({ outClick = true, ...a }) => Button({ ...a, outClick });
|
|
62
|
-
export function ButtonAbs(
|
|
58
|
+
export function ButtonAbs(props) {
|
|
63
59
|
const children = (api) => _jsx("div", { style: { position: "relative" }, children: _jsx("div", { style: {
|
|
64
60
|
position: "absolute",
|
|
65
|
-
zIndex:
|
|
66
|
-
}, children: typeof
|
|
67
|
-
return Button
|
|
61
|
+
zIndex: props.zIndex ?? 9
|
|
62
|
+
}, children: typeof props.children == "function" ? props.children(api) : props.children }) });
|
|
63
|
+
return _jsx(Button, { ...props, children: children });
|
|
68
64
|
}
|
|
@@ -4,8 +4,8 @@ import { useCallback, useEffect, useRef } from "react";
|
|
|
4
4
|
import { copyToClipboard, Params, timeLocalToStr_hhmmss } from "wenay-common2";
|
|
5
5
|
import { renderBy, updateBy } from "../../updateBy";
|
|
6
6
|
import { mouseMenuApi } from "../menu/menuMouse";
|
|
7
|
-
import { staticGetAdd } from "../utils";
|
|
8
|
-
import { ParametersReact } from "../components";
|
|
7
|
+
import { staticGetAdd } from "../utils/mapMemory";
|
|
8
|
+
import { ParametersReact } from "../components/ParametersEngine";
|
|
9
9
|
const cashLogs = new Map();
|
|
10
10
|
const datumConst = {
|
|
11
11
|
map: cashLogs,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useEffect, useRef } from "react";
|
|
3
3
|
import { MenuBase } from "./menu";
|
|
4
|
-
import { DivOutsideClick } from "../hooks";
|
|
4
|
+
import { DivOutsideClick } from "../hooks/useOutside";
|
|
5
5
|
// Функция-обёртка для создания компонента MenuR и управления глобальной переменной `bb`
|
|
6
6
|
export function GetMenuR() {
|
|
7
7
|
let bb = false; // Глобальная переменная, предотвращающая множественное открытие меню (флаг активности)
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
interface IStepInputElement extends HTMLElement {
|
|
2
|
+
value: string;
|
|
3
|
+
step: string;
|
|
4
|
+
min: string;
|
|
5
|
+
max: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function SetAutoStepForElement(element: IStepInputElement, params?: {
|
|
2
8
|
minStep?: number | undefined;
|
|
3
9
|
maxStep?: number;
|
|
4
10
|
}): void;
|
|
11
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { deepClone } from "wenay-common2";
|
|
2
|
-
import { ExRNDMap3
|
|
2
|
+
import { ExRNDMap3 } from "../components/Dnd/RNDFunc3";
|
|
3
|
+
import { mapResiReact } from "../components/Dnd/Resizable";
|
|
3
4
|
const staticProps = new Map();
|
|
4
5
|
export function staticSet(key, data) {
|
|
5
6
|
if (!staticProps.has(key))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wenay-react2",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "Common react",
|
|
5
5
|
"strict": true,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"re-resizable": "^6.11.2",
|
|
23
23
|
"react": "^19.2.0",
|
|
24
24
|
"react-dom": "^19.2.0",
|
|
25
|
-
"react-rnd": "^10.5.
|
|
26
|
-
"wenay-common2": "^1.0.
|
|
25
|
+
"react-rnd": "^10.5.3",
|
|
26
|
+
"wenay-common2": "^1.0.28"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": "^19.2.0",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from './Buttons';
|
|
2
|
-
export * from './Dnd';
|
|
3
|
-
export * from './Menu';
|
|
4
|
-
export * from './Modal';
|
|
5
|
-
export * from './Input';
|
|
6
|
-
export * from './Parameters';
|
|
7
|
-
export * from './ParametersEngine';
|
|
8
|
-
export * from './MyResizeObserver';
|
|
9
|
-
export * from './Other';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from './Buttons';
|
|
2
|
-
export * from './Dnd';
|
|
3
|
-
export * from './Menu';
|
|
4
|
-
export * from './Modal';
|
|
5
|
-
export * from './Input';
|
|
6
|
-
export * from './Parameters';
|
|
7
|
-
export * from './ParametersEngine';
|
|
8
|
-
export * from './MyResizeObserver';
|
|
9
|
-
export * from './Other';
|