wenay-react2 1.0.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/lib/common/api.d.ts +17 -0
- package/lib/common/api.js +24 -0
- package/lib/common/src/components/Buttons/MiniButton.d.ts +17 -0
- package/lib/common/src/components/Buttons/MiniButton.js +18 -0
- package/lib/common/src/components/Buttons/index.d.ts +1 -0
- package/lib/common/src/components/Buttons/index.js +1 -0
- package/lib/common/src/components/Dnd/DraggableOutlineDiv.d.ts +1 -0
- package/lib/common/src/components/Dnd/DraggableOutlineDiv.js +31 -0
- package/lib/common/src/components/Dnd/RNDFunc.d.ts +13 -0
- package/lib/common/src/components/Dnd/RNDFunc.js +111 -0
- package/lib/common/src/components/Dnd/RNDFunc3.d.ts +81 -0
- package/lib/common/src/components/Dnd/RNDFunc3.js +380 -0
- package/lib/common/src/components/Dnd/Resizable.d.ts +15 -0
- package/lib/common/src/components/Dnd/Resizable.js +36 -0
- package/lib/common/src/components/Dnd/index.d.ts +4 -0
- package/lib/common/src/components/Dnd/index.js +4 -0
- package/lib/common/src/components/Input.d.ts +28 -0
- package/lib/common/src/components/Input.js +30 -0
- package/lib/common/src/components/Menu/RightMenu.d.ts +22 -0
- package/lib/common/src/components/Menu/RightMenu.js +179 -0
- package/lib/common/src/components/Menu/StickerMenu.d.ts +5 -0
- package/lib/common/src/components/Menu/StickerMenu.js +110 -0
- package/lib/common/src/components/Menu/index.d.ts +2 -0
- package/lib/common/src/components/Menu/index.js +2 -0
- package/lib/common/src/components/Modal/LeftModal.d.ts +58 -0
- package/lib/common/src/components/Modal/LeftModal.js +284 -0
- package/lib/common/src/components/Modal/Modal.d.ts +31 -0
- package/lib/common/src/components/Modal/Modal.js +104 -0
- package/lib/common/src/components/Modal/index.d.ts +2 -0
- package/lib/common/src/components/Modal/index.js +2 -0
- package/lib/common/src/components/MyResizeObserver.d.ts +10 -0
- package/lib/common/src/components/MyResizeObserver.js +94 -0
- package/lib/common/src/components/Other.d.ts +9 -0
- package/lib/common/src/components/Other.js +31 -0
- package/lib/common/src/components/Parameters.d.ts +10 -0
- package/lib/common/src/components/Parameters.js +24 -0
- package/lib/common/src/components/ParametersEngine.d.ts +8 -0
- package/lib/common/src/components/ParametersEngine.js +373 -0
- package/lib/common/src/components/index.d.ts +9 -0
- package/lib/common/src/components/index.js +9 -0
- package/lib/common/src/hooks/index.d.ts +3 -0
- package/lib/common/src/hooks/index.js +3 -0
- package/lib/common/src/hooks/useAddDownAnyKey.d.ts +5 -0
- package/lib/common/src/hooks/useAddDownAnyKey.js +22 -0
- package/lib/common/src/hooks/useDraggable.d.ts +15 -0
- package/lib/common/src/hooks/useDraggable.js +134 -0
- package/lib/common/src/hooks/useOutside.d.ts +40 -0
- package/lib/common/src/hooks/useOutside.js +68 -0
- package/lib/common/src/logs/logs.d.ts +163 -0
- package/lib/common/src/logs/logs.js +249 -0
- package/lib/common/src/logs/logs3.d.ts +63 -0
- package/lib/common/src/logs/logs3.js +245 -0
- package/lib/common/src/logs/miniLogs.d.ts +5 -0
- package/lib/common/src/logs/miniLogs.js +51 -0
- package/lib/common/src/menu/menu.d.ts +72 -0
- package/lib/common/src/menu/menu.js +230 -0
- package/lib/common/src/menu/menuMouse.d.ts +21 -0
- package/lib/common/src/menu/menuMouse.js +32 -0
- package/lib/common/src/menu/menuR.d.ts +17 -0
- package/lib/common/src/menu/menuR.js +116 -0
- package/lib/common/src/myChart/1/myChart.d.ts +40 -0
- package/lib/common/src/myChart/1/myChart.js +306 -0
- package/lib/common/src/myChart/1/myChartTest.d.ts +1 -0
- package/lib/common/src/myChart/1/myChartTest.js +45 -0
- package/lib/common/src/myChart/chartEngine/chartEngineReact.d.ts +164 -0
- package/lib/common/src/myChart/chartEngine/chartEngineReact.js +834 -0
- package/lib/common/src/styles/index.d.ts +1 -0
- package/lib/common/src/styles/index.js +1 -0
- package/lib/common/src/styles/styleGrid.d.ts +20 -0
- package/lib/common/src/styles/styleGrid.js +50 -0
- package/lib/common/src/utils/applyTransactionAsyncUpdate.d.ts +42 -0
- package/lib/common/src/utils/applyTransactionAsyncUpdate.js +97 -0
- package/lib/common/src/utils/arrayPromise.d.ts +5 -0
- package/lib/common/src/utils/arrayPromise.js +16 -0
- package/lib/common/src/utils/cache.d.ts +31 -0
- package/lib/common/src/utils/cache.js +119 -0
- package/lib/common/src/utils/index.d.ts +6 -0
- package/lib/common/src/utils/index.js +6 -0
- package/lib/common/src/utils/inputAutoStep.d.ts +4 -0
- package/lib/common/src/utils/inputAutoStep.js +79 -0
- package/lib/common/src/utils/mapMemory.d.ts +26 -0
- package/lib/common/src/utils/mapMemory.js +72 -0
- package/lib/common/src/utils/pageVisibilityContext.d.ts +5 -0
- package/lib/common/src/utils/pageVisibilityContext.js +18 -0
- package/lib/common/updateBy.d.ts +12 -0
- package/lib/common/updateBy.js +88 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/style/menuRight.css +139 -0
- package/lib/style/style.css +334 -0
- package/lib/tsconfig.json +6 -0
- package/package.json +50 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as _jsx_1 } from "react/jsx-runtime";
|
|
2
|
+
import { InputPageModal } from "../Input";
|
|
3
|
+
import { renderBy, updateBy } from "../../../updateBy";
|
|
4
|
+
export function inputModal({ setModalJSX, func, name, txt }) {
|
|
5
|
+
setModalJSX(_jsx_1(InputPageModal, { callback: txt => {
|
|
6
|
+
func(txt);
|
|
7
|
+
setModalJSX(null);
|
|
8
|
+
}, outClick: () => setModalJSX(null), name: name ?? "name", txt: txt }));
|
|
9
|
+
}
|
|
10
|
+
export function confirmModal({ setModalJSX, func }) {
|
|
11
|
+
setModalJSX(_jsx_1(InputPageModal, { callback: txt => {
|
|
12
|
+
if (txt == "111")
|
|
13
|
+
func();
|
|
14
|
+
setModalJSX(null);
|
|
15
|
+
}, outClick: () => setModalJSX(null), name: "password 111" }));
|
|
16
|
+
}
|
|
17
|
+
export function GetModalJSX() {
|
|
18
|
+
const data = (() => {
|
|
19
|
+
let _jsx = null;
|
|
20
|
+
let _jsxArr = [];
|
|
21
|
+
let key = 0;
|
|
22
|
+
const check = (jsx) => _jsxArr.findIndex(e => e.jsx == jsx);
|
|
23
|
+
return {
|
|
24
|
+
set(jsx) {
|
|
25
|
+
_jsx = jsx;
|
|
26
|
+
renderBy(data);
|
|
27
|
+
},
|
|
28
|
+
set JSX(jsx) {
|
|
29
|
+
_jsx = jsx;
|
|
30
|
+
renderBy(data);
|
|
31
|
+
},
|
|
32
|
+
get JSX() { return _jsx; },
|
|
33
|
+
Render() {
|
|
34
|
+
updateBy(data);
|
|
35
|
+
return _jsx;
|
|
36
|
+
},
|
|
37
|
+
addJSX(jsx) {
|
|
38
|
+
const c = check(jsx);
|
|
39
|
+
if (c == -1) {
|
|
40
|
+
_jsxArr.push({ jsx, key: key++ });
|
|
41
|
+
renderBy(data);
|
|
42
|
+
}
|
|
43
|
+
return jsx;
|
|
44
|
+
},
|
|
45
|
+
dellBy(jsx) {
|
|
46
|
+
const c = check(jsx);
|
|
47
|
+
if (c != -1) {
|
|
48
|
+
_jsxArr.splice(c, 1);
|
|
49
|
+
renderBy(data);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
get arrJSX() { return _jsxArr.map(e => _jsx_1("div", { children: e.jsx }, e.key)); },
|
|
53
|
+
RenderArr() {
|
|
54
|
+
updateBy(data);
|
|
55
|
+
return _jsxArr.map(e => _jsx_1("div", { children: e.jsx }, e.key));
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
})();
|
|
59
|
+
return data;
|
|
60
|
+
}
|
|
61
|
+
export function GetModalFuncJSX() {
|
|
62
|
+
const data = (() => {
|
|
63
|
+
let _jsx = null;
|
|
64
|
+
let _jsxArr = [];
|
|
65
|
+
let key = 0;
|
|
66
|
+
const check = (jsx) => _jsxArr.findIndex(e => e.jsx == jsx);
|
|
67
|
+
return {
|
|
68
|
+
set(jsx) {
|
|
69
|
+
_jsx = jsx;
|
|
70
|
+
renderBy(data);
|
|
71
|
+
},
|
|
72
|
+
set JSX(jsx) {
|
|
73
|
+
_jsx = jsx;
|
|
74
|
+
renderBy(data);
|
|
75
|
+
},
|
|
76
|
+
get JSX() { return _jsx; },
|
|
77
|
+
Render() {
|
|
78
|
+
updateBy(data);
|
|
79
|
+
return _jsx ? _jsx() : null;
|
|
80
|
+
},
|
|
81
|
+
addJSX(jsx) {
|
|
82
|
+
const c = check(jsx);
|
|
83
|
+
if (c == -1) {
|
|
84
|
+
_jsxArr.push({ jsx, key: key++ });
|
|
85
|
+
renderBy(data);
|
|
86
|
+
}
|
|
87
|
+
return jsx;
|
|
88
|
+
},
|
|
89
|
+
dellBy(jsx) {
|
|
90
|
+
const c = check(jsx);
|
|
91
|
+
if (c != -1) {
|
|
92
|
+
_jsxArr.splice(c, 1);
|
|
93
|
+
renderBy(data);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
get arrJSX() { return _jsxArr.map(e => e.jsx && _jsx_1("div", { children: e.jsx() }, e.key)); },
|
|
97
|
+
RenderArr() {
|
|
98
|
+
updateBy(data);
|
|
99
|
+
return _jsxArr.map(e => e.jsx && _jsx_1("div", { children: e.jsx() }, e.key));
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
})();
|
|
103
|
+
return data;
|
|
104
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ObserveID = {
|
|
2
|
+
readonly [Symbol.species]: ObserveID;
|
|
3
|
+
};
|
|
4
|
+
export declare class CResizeObserver {
|
|
5
|
+
#private;
|
|
6
|
+
add(element: Element, onResize: () => void): ObserveID;
|
|
7
|
+
delete(id: ObserveID): void;
|
|
8
|
+
}
|
|
9
|
+
export declare function setResizeableElement(el: HTMLElement): HTMLElement | undefined;
|
|
10
|
+
export declare function removeResizeableElement(el: HTMLElement): void;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Класс для отслеживания изменения размеров элементов
|
|
2
|
+
export class CResizeObserver {
|
|
3
|
+
#idMap = new WeakMap();
|
|
4
|
+
#funcMap = new WeakMap();
|
|
5
|
+
#observer = typeof ResizeObserver !== "undefined"
|
|
6
|
+
? new ResizeObserver((entries) => {
|
|
7
|
+
for (let entry of entries) {
|
|
8
|
+
let functions = this.#funcMap.get(entry.target);
|
|
9
|
+
if (functions)
|
|
10
|
+
for (let func of functions)
|
|
11
|
+
func();
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
: null;
|
|
15
|
+
add(element, onResize) {
|
|
16
|
+
let functions = this.#funcMap.get(element);
|
|
17
|
+
if (!functions) {
|
|
18
|
+
this.#funcMap.set(element, functions = []);
|
|
19
|
+
this.#observer?.observe(element);
|
|
20
|
+
}
|
|
21
|
+
functions.push(onResize);
|
|
22
|
+
let id = new class {
|
|
23
|
+
[Symbol.species] = this; //{} as ObserveID
|
|
24
|
+
}();
|
|
25
|
+
this.#idMap.set(id, { element, func: onResize });
|
|
26
|
+
return id;
|
|
27
|
+
}
|
|
28
|
+
delete(id) {
|
|
29
|
+
let data = this.#idMap.get(id);
|
|
30
|
+
if (!data)
|
|
31
|
+
return;
|
|
32
|
+
this.#idMap.delete(id);
|
|
33
|
+
let el = data.element;
|
|
34
|
+
let functions = this.#funcMap.get(el);
|
|
35
|
+
let i = functions.indexOf(data.func);
|
|
36
|
+
if (i >= 0)
|
|
37
|
+
functions.splice(i, 1);
|
|
38
|
+
if (functions.length == 0) {
|
|
39
|
+
this.#funcMap.delete(el);
|
|
40
|
+
this.#observer?.unobserve(el);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const global_resizeObserver = new CResizeObserver();
|
|
45
|
+
const resizeableElementMap = new WeakMap();
|
|
46
|
+
// Задаём автоматическое изменение размеров элемента в зависимости от размеров родительского элемента
|
|
47
|
+
//
|
|
48
|
+
export function setResizeableElement(el) {
|
|
49
|
+
const parent = el.parentElement;
|
|
50
|
+
if (!parent)
|
|
51
|
+
return;
|
|
52
|
+
const parentParent = parent.parentElement; // на один уровень выше
|
|
53
|
+
if (!parentParent)
|
|
54
|
+
return;
|
|
55
|
+
const lastEl = parent.lastElementChild;
|
|
56
|
+
if (!lastEl)
|
|
57
|
+
return;
|
|
58
|
+
let defaultWidth;
|
|
59
|
+
const existing = resizeableElementMap.get(el);
|
|
60
|
+
if (existing)
|
|
61
|
+
global_resizeObserver.delete(existing);
|
|
62
|
+
const observerId = global_resizeObserver.add(parentParent, () => {
|
|
63
|
+
let lastRangeDelta = 0;
|
|
64
|
+
let i = 0;
|
|
65
|
+
//console.log("###",el.style.width, el.clientWidth);
|
|
66
|
+
for (let width = el.clientWidth;;) { //} width>=20; width--) {
|
|
67
|
+
let rangeDelta = Math.floor(lastEl.getBoundingClientRect().right - parentParent.getBoundingClientRect().right - 0);
|
|
68
|
+
if (rangeDelta == 0)
|
|
69
|
+
break;
|
|
70
|
+
if (lastRangeDelta && rangeDelta * lastRangeDelta < 0)
|
|
71
|
+
break;
|
|
72
|
+
lastRangeDelta = rangeDelta;
|
|
73
|
+
if (rangeDelta > 0)
|
|
74
|
+
width--;
|
|
75
|
+
else
|
|
76
|
+
width++;
|
|
77
|
+
defaultWidth ??= el.clientWidth;
|
|
78
|
+
if (width < 10 || width > defaultWidth)
|
|
79
|
+
break;
|
|
80
|
+
el.style.width = width + "px";
|
|
81
|
+
//console.log(i+": "+numEl.getBoundingClientRect().right,"<", parentParent.getBoundingClientRect().right, rangeEl.clientWidth); //numEl.clientLeft, numEl.clientWidth);
|
|
82
|
+
i++;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
resizeableElementMap.set(el, observerId);
|
|
86
|
+
return el;
|
|
87
|
+
}
|
|
88
|
+
export function removeResizeableElement(el) {
|
|
89
|
+
const id = resizeableElementMap.get(el);
|
|
90
|
+
if (!id)
|
|
91
|
+
return;
|
|
92
|
+
global_resizeObserver.delete(id);
|
|
93
|
+
resizeableElementMap.delete(el);
|
|
94
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Params } from "wenay-common2";
|
|
2
|
+
export declare function EditParams2<TParams extends Params.IParamsExpandableReadonly = Params.IParamsExpandableReadonly>({ onSave, params: paramsDef }: {
|
|
3
|
+
params: () => Promise<TParams>;
|
|
4
|
+
onSave?: (params: TParams) => any;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function EditParams3<TParams extends Params.IParamsExpandableReadonly = Params.IParamsExpandableReadonly>({ onSave, params: paramsDef }: {
|
|
7
|
+
params: () => Promise<TParams[]>;
|
|
8
|
+
onSave?: (params: TParams[]) => any;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { ParametersReact } from "./ParametersEngine";
|
|
4
|
+
export function EditParams2({ onSave, params: paramsDef }) {
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
paramsDef().then(e => {
|
|
7
|
+
setParamsD(e);
|
|
8
|
+
});
|
|
9
|
+
}, [true]);
|
|
10
|
+
const [paramsD, setParamsD] = useState(null);
|
|
11
|
+
const params = useRef(null);
|
|
12
|
+
return _jsxs("div", { className: "maxSize", children: [paramsD && _jsx(ParametersReact, { params: paramsD, onChange: e => params.current = e }), onSave && _jsx("div", { className: "msTradeActive msTradeAlt", onClick: async () => {
|
|
13
|
+
const t = params.current || paramsD;
|
|
14
|
+
if (t)
|
|
15
|
+
onSave?.(t);
|
|
16
|
+
}, children: "save" })] });
|
|
17
|
+
}
|
|
18
|
+
export function EditParams3({ onSave, params: paramsDef }) {
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
paramsDef().then(e => {
|
|
21
|
+
setParams(e);
|
|
22
|
+
});
|
|
23
|
+
}, [true]);
|
|
24
|
+
const [params, setParams] = useState(null);
|
|
25
|
+
return _jsxs("div", { className: "maxSize", children: [params && params.map((z, i) => _jsx(ParametersReact, { params: z, onChange: e => {
|
|
26
|
+
params[i] = z;
|
|
27
|
+
setParams(params);
|
|
28
|
+
} }, i)), onSave && _jsx("div", { className: "msTradeActive msTradeAlt", onClick: async () => {
|
|
29
|
+
params && onSave?.(params);
|
|
30
|
+
}, children: "save" })] });
|
|
31
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
|
+
export declare function FButton(name: string | ReactElement): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function FNameButton(type: boolean, name: string | ReactElement): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function CParameter(props: {
|
|
5
|
+
name: ReactElement | string;
|
|
6
|
+
children?: React.ReactNode | readonly React.ReactNode[];
|
|
7
|
+
style?: React.CSSProperties | undefined;
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
commentary?: string[];
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
//вид кнопки
|
|
4
|
+
export function FButton(name) {
|
|
5
|
+
return _jsxs("div", { className: "", style: { width: "100%" }, children: [" ", name] });
|
|
6
|
+
}
|
|
7
|
+
//стрелка для кнопки
|
|
8
|
+
export function FNameButton(type, name) { return FButton(_jsx("p", { className: "toPTextIndicator", children: (type ? "▼ " : "▶ ") + name })); }
|
|
9
|
+
export function CParameter(props) {
|
|
10
|
+
const [hovered, setHovered] = React.useState(false); // Состояние для отслеживания наведения мышки
|
|
11
|
+
return (_jsxs("div", { className: "toLine LeftMenuParameters toIndicatorMenuButton", style: { position: "relative" }, children: [_jsx("div", { className: "toLine", style: { width: "auto", ...props.style }, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), children: props.name }), _jsx("div", { className: "toLine toRight", style: props.enabled === false ? { opacity: 0.5 } : {}, children: props.children }), hovered && props.commentary?.length && (_jsx("div", { className: "commentary", style: {
|
|
12
|
+
marginTop: "5px",
|
|
13
|
+
fontSize: "12px",
|
|
14
|
+
color: "gray",
|
|
15
|
+
position: "absolute", // Можно сделать абсолютно спозиционированным
|
|
16
|
+
bottom: "-20px", // Сдвигаем вниз, чтобы не перекрывать основной контент
|
|
17
|
+
left: "0",
|
|
18
|
+
backgroundColor: "white", // Чтобы выделялось на фоне
|
|
19
|
+
padding: "2px 4px",
|
|
20
|
+
border: "1px solid lightgray",
|
|
21
|
+
borderRadius: "4px",
|
|
22
|
+
zIndex: 10,
|
|
23
|
+
}, children: props.commentary.join("\n") }))] }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Params } from "wenay-common2";
|
|
2
|
+
export declare function ParametersReact<TParams extends Params.IParamsExpandableReadonly = Params.IParamsExpandableReadonly>(data: {
|
|
3
|
+
params: TParams;
|
|
4
|
+
expandStatus?: boolean;
|
|
5
|
+
expandStatusLvl?: number;
|
|
6
|
+
onChange: (params: TParams) => void;
|
|
7
|
+
onExpand?: (params: TParams) => void;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|