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,68 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
3
|
+
export const StyleOtherRow = { display: "flex", flexDirection: "row", flex: "auto 1 1" };
|
|
4
|
+
export const StyleOtherColum = { display: "flex", flexDirection: "column", flex: "auto 0 1" };
|
|
5
|
+
export function useOutside({ outsideClick, ref = useRef(null), status = true }) {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (status) {
|
|
8
|
+
function handleClickOutside(event) {
|
|
9
|
+
if (ref.current && event.target instanceof Node && !ref.current.contains(event.target))
|
|
10
|
+
outsideClick();
|
|
11
|
+
}
|
|
12
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
13
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
14
|
+
}
|
|
15
|
+
}, [ref, status, outsideClick]);
|
|
16
|
+
return ref;
|
|
17
|
+
}
|
|
18
|
+
export const DivOutsideClick = React.forwardRef(({ children, outsideClick, zIndex, style = {}, status = true, ...other }, forwardedRef) => {
|
|
19
|
+
const style2 = zIndex ? { ...style, zIndex } : style;
|
|
20
|
+
const internalRef = useOutside({ outsideClick: outsideClick, status });
|
|
21
|
+
// Combine refs if forwardedRef is provided
|
|
22
|
+
const ref = forwardedRef
|
|
23
|
+
? (node) => {
|
|
24
|
+
internalRef.current = node;
|
|
25
|
+
if (typeof forwardedRef === 'function') {
|
|
26
|
+
forwardedRef(node);
|
|
27
|
+
}
|
|
28
|
+
else if (forwardedRef) {
|
|
29
|
+
forwardedRef.current = node;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
: internalRef;
|
|
33
|
+
return _jsx("div", { ref: ref, style: style2, ...other, children: children });
|
|
34
|
+
});
|
|
35
|
+
// Deprecated: Use DivOutsideClick instead
|
|
36
|
+
export const DivOutsideClick2 = DivOutsideClick;
|
|
37
|
+
function ButtonBase({ children, button, style = {}, className = "", state: [a, setA] }) {
|
|
38
|
+
return _jsxs("div", { style: { position: "relative", width: "min-content", ...style }, className: className, children: [_jsx("div", { onClick: () => setA(!a), children: typeof button == "function" ? button(a) : button }), a && (typeof children == "function" ? children({ onClose: () => setA(!a) }) : children)] });
|
|
39
|
+
}
|
|
40
|
+
const saveStatus = {};
|
|
41
|
+
export function Button({ keySave, statusDef, outClick, ...data }) {
|
|
42
|
+
if (keySave && saveStatus[keySave])
|
|
43
|
+
statusDef = saveStatus[keySave];
|
|
44
|
+
const state = useState(statusDef ?? false);
|
|
45
|
+
return outClick ? DivOutsideClick({
|
|
46
|
+
status: state[0],
|
|
47
|
+
children: ButtonBase({ ...data, state }),
|
|
48
|
+
outsideClick: () => {
|
|
49
|
+
state[1](false);
|
|
50
|
+
if (typeof outClick == "function")
|
|
51
|
+
outClick();
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
: ButtonBase({ ...data, state });
|
|
55
|
+
}
|
|
56
|
+
export function ButtonHover(props) {
|
|
57
|
+
const [hover, setHover] = useState(false);
|
|
58
|
+
return _jsxs("div", { onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), style: { position: "relative" }, children: [typeof props.button == "function" ? props.button(hover) : props.button, hover &&
|
|
59
|
+
_jsx("div", { style: { position: "absolute" }, children: typeof props.children == "function" ? props.children({ onClose: () => setHover(false) }) : props.children })] });
|
|
60
|
+
}
|
|
61
|
+
export const ButtonOutClick = ({ outClick = true, ...a }) => Button({ ...a, outClick });
|
|
62
|
+
export function ButtonAbs(...a) {
|
|
63
|
+
const children = (api) => _jsx("div", { style: { position: "relative" }, children: _jsx("div", { style: {
|
|
64
|
+
position: "absolute",
|
|
65
|
+
zIndex: a[0]?.zIndex ?? 9
|
|
66
|
+
}, children: typeof a[0].children == "function" ? a[0].children(api) : a[0].children }) });
|
|
67
|
+
return Button({ ...a[0], children });
|
|
68
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { Params } from "wenay-common2";
|
|
2
|
+
type tLogsInput<T extends object> = T & {
|
|
3
|
+
id: string;
|
|
4
|
+
var?: number;
|
|
5
|
+
time: Date;
|
|
6
|
+
txt: string;
|
|
7
|
+
};
|
|
8
|
+
declare const getSettingLogs: () => {
|
|
9
|
+
minVarLogs: {
|
|
10
|
+
name: string;
|
|
11
|
+
range: {
|
|
12
|
+
min: number;
|
|
13
|
+
max: number;
|
|
14
|
+
step: number;
|
|
15
|
+
};
|
|
16
|
+
value: number;
|
|
17
|
+
};
|
|
18
|
+
minVarMessage: {
|
|
19
|
+
name: string;
|
|
20
|
+
range: {
|
|
21
|
+
min: number;
|
|
22
|
+
max: number;
|
|
23
|
+
step: number;
|
|
24
|
+
};
|
|
25
|
+
value: number;
|
|
26
|
+
};
|
|
27
|
+
timeShow: {
|
|
28
|
+
name: string;
|
|
29
|
+
range: {
|
|
30
|
+
min: number;
|
|
31
|
+
max: number;
|
|
32
|
+
step: number;
|
|
33
|
+
};
|
|
34
|
+
value: number;
|
|
35
|
+
};
|
|
36
|
+
show: {
|
|
37
|
+
name: string;
|
|
38
|
+
value: boolean;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export declare function getLogsApi<T extends object = {}>(setting: {
|
|
42
|
+
limit?: number;
|
|
43
|
+
limitPer: number;
|
|
44
|
+
varMin?: number;
|
|
45
|
+
}): {
|
|
46
|
+
addLogs(a: tLogsInput<T>): void;
|
|
47
|
+
params: {
|
|
48
|
+
def: () => {
|
|
49
|
+
minVarLogs: {
|
|
50
|
+
name: string;
|
|
51
|
+
range: {
|
|
52
|
+
min: number;
|
|
53
|
+
max: number;
|
|
54
|
+
step: number;
|
|
55
|
+
};
|
|
56
|
+
value: number;
|
|
57
|
+
};
|
|
58
|
+
minVarMessage: {
|
|
59
|
+
name: string;
|
|
60
|
+
range: {
|
|
61
|
+
min: number;
|
|
62
|
+
max: number;
|
|
63
|
+
step: number;
|
|
64
|
+
};
|
|
65
|
+
value: number;
|
|
66
|
+
};
|
|
67
|
+
timeShow: {
|
|
68
|
+
name: string;
|
|
69
|
+
range: {
|
|
70
|
+
min: number;
|
|
71
|
+
max: number;
|
|
72
|
+
step: number;
|
|
73
|
+
};
|
|
74
|
+
value: number;
|
|
75
|
+
};
|
|
76
|
+
show: {
|
|
77
|
+
name: string;
|
|
78
|
+
value: boolean;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
get(): {
|
|
82
|
+
minVarLogs: number;
|
|
83
|
+
minVarMessage: number;
|
|
84
|
+
timeShow: number;
|
|
85
|
+
show: boolean;
|
|
86
|
+
} & {
|
|
87
|
+
readonly [key: number]: void;
|
|
88
|
+
};
|
|
89
|
+
set(a: Params.SimpleParams<ReturnType<typeof getSettingLogs>>): void;
|
|
90
|
+
};
|
|
91
|
+
React: {
|
|
92
|
+
Setting: ({}: {}) => import("react/jsx-runtime").JSX.Element;
|
|
93
|
+
Message: typeof MessageEventLogs;
|
|
94
|
+
PageLogs: typeof PageLogs;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export declare const logsApi: {
|
|
98
|
+
addLogs(a: {
|
|
99
|
+
id: string;
|
|
100
|
+
var?: number;
|
|
101
|
+
time: Date;
|
|
102
|
+
txt: string;
|
|
103
|
+
}): void;
|
|
104
|
+
params: {
|
|
105
|
+
def: () => {
|
|
106
|
+
minVarLogs: {
|
|
107
|
+
name: string;
|
|
108
|
+
range: {
|
|
109
|
+
min: number;
|
|
110
|
+
max: number;
|
|
111
|
+
step: number;
|
|
112
|
+
};
|
|
113
|
+
value: number;
|
|
114
|
+
};
|
|
115
|
+
minVarMessage: {
|
|
116
|
+
name: string;
|
|
117
|
+
range: {
|
|
118
|
+
min: number;
|
|
119
|
+
max: number;
|
|
120
|
+
step: number;
|
|
121
|
+
};
|
|
122
|
+
value: number;
|
|
123
|
+
};
|
|
124
|
+
timeShow: {
|
|
125
|
+
name: string;
|
|
126
|
+
range: {
|
|
127
|
+
min: number;
|
|
128
|
+
max: number;
|
|
129
|
+
step: number;
|
|
130
|
+
};
|
|
131
|
+
value: number;
|
|
132
|
+
};
|
|
133
|
+
show: {
|
|
134
|
+
name: string;
|
|
135
|
+
value: boolean;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
get(): {
|
|
139
|
+
minVarLogs: number;
|
|
140
|
+
minVarMessage: number;
|
|
141
|
+
timeShow: number;
|
|
142
|
+
show: boolean;
|
|
143
|
+
} & {
|
|
144
|
+
readonly [key: number]: void;
|
|
145
|
+
};
|
|
146
|
+
set(a: Params.SimpleParams<ReturnType<typeof getSettingLogs>>): void;
|
|
147
|
+
};
|
|
148
|
+
React: {
|
|
149
|
+
Setting: ({}: {}) => import("react/jsx-runtime").JSX.Element;
|
|
150
|
+
Message: typeof MessageEventLogs;
|
|
151
|
+
PageLogs: typeof PageLogs;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
export declare function PageLogs({ update }: {
|
|
155
|
+
update?: number;
|
|
156
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
157
|
+
export declare function MessageEventLogs({ zIndex }: {
|
|
158
|
+
zIndex?: number;
|
|
159
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
160
|
+
export declare function PageLogs2({ update }: {
|
|
161
|
+
update?: number;
|
|
162
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
163
|
+
export {};
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AgGridReact } from "ag-grid-react";
|
|
3
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
4
|
+
import { copyToClipboard, Params, timeLocalToStr_hhmmss } from "wenay-common2";
|
|
5
|
+
import { renderBy, updateBy } from "../../updateBy";
|
|
6
|
+
import { mouseMenuApi } from "../menu/menuMouse";
|
|
7
|
+
import { staticGetAdd } from "../utils";
|
|
8
|
+
import { ParametersReact } from "../components";
|
|
9
|
+
const cashLogs = new Map();
|
|
10
|
+
const datumConst = {
|
|
11
|
+
map: cashLogs,
|
|
12
|
+
};
|
|
13
|
+
const datumMiniConst = {
|
|
14
|
+
last: []
|
|
15
|
+
};
|
|
16
|
+
const getSettingLogs = () => ({
|
|
17
|
+
minVarLogs: { name: "мин. важность для оповещения", range: { min: 0, max: 25, step: 1 }, value: 0 },
|
|
18
|
+
minVarMessage: { name: "мин. важность для таблицы логов", range: { min: 0, max: 25, step: 1 }, value: 0 },
|
|
19
|
+
timeShow: { name: "время отображение на экране", range: { min: 1, max: 20, step: 1 }, value: 2 },
|
|
20
|
+
show: { name: "отображать", value: true }
|
|
21
|
+
});
|
|
22
|
+
const settingLogs = { params: Params.GetSimpleParams(getSettingLogs()) };
|
|
23
|
+
// varMin - минимальная важность
|
|
24
|
+
export function getLogsApi(setting) {
|
|
25
|
+
const datum = staticGetAdd("settingLogs", settingLogs);
|
|
26
|
+
function addToArr(arr, data, limit) {
|
|
27
|
+
arr.unshift(data);
|
|
28
|
+
if (arr.length > limit)
|
|
29
|
+
arr.length = limit;
|
|
30
|
+
}
|
|
31
|
+
let num = 0;
|
|
32
|
+
const SettingLogsReact = ({}) => _jsx(ParametersReact
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
, {
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
params: Params.mergeParamValuesToInfos(getSettingLogs(), datum.params), onChange: (e) => {
|
|
37
|
+
datum.params = Params.GetSimpleParams(e);
|
|
38
|
+
renderBy(datum);
|
|
39
|
+
} });
|
|
40
|
+
return {
|
|
41
|
+
addLogs(a) {
|
|
42
|
+
addToArr(datumMiniConst.last, { ...a, num: num++ }, 50);
|
|
43
|
+
addToArr(datumConst.map.get(a.id) ?? datumConst.map.set(a.id, []).get(a.id), { ...a, num: num++ }, setting.limitPer);
|
|
44
|
+
renderBy(datumConst);
|
|
45
|
+
renderBy(datumMiniConst);
|
|
46
|
+
},
|
|
47
|
+
params: {
|
|
48
|
+
def: getSettingLogs,
|
|
49
|
+
get() { return datum.params; },
|
|
50
|
+
set(a) {
|
|
51
|
+
datum.params = a;
|
|
52
|
+
renderBy(datumMiniConst);
|
|
53
|
+
renderBy(datumConst);
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
React: {
|
|
57
|
+
Setting: SettingLogsReact,
|
|
58
|
+
Message: MessageEventLogs,
|
|
59
|
+
PageLogs: PageLogs
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export const logsApi = getLogsApi({ limitPer: 500 });
|
|
64
|
+
function InputSettingLogs({}) {
|
|
65
|
+
const datum = staticGetAdd("settingLogs", settingLogs);
|
|
66
|
+
return _jsx(ParametersReact
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
, {
|
|
69
|
+
// @ts-ignore
|
|
70
|
+
params: Params.mergeParamValuesToInfos(getSettingLogs(), datum.params), onChange: (e) => {
|
|
71
|
+
datum.params = Params.GetSimpleParams(e);
|
|
72
|
+
renderBy(datum);
|
|
73
|
+
} });
|
|
74
|
+
}
|
|
75
|
+
export function PageLogs({ update }) {
|
|
76
|
+
const datumFull = datumConst;
|
|
77
|
+
const rowData = [...datumFull.map.values()].flatMap(e => e.map(e => ({
|
|
78
|
+
...e,
|
|
79
|
+
time: (e.time)
|
|
80
|
+
})));
|
|
81
|
+
const datum = datumMiniConst;
|
|
82
|
+
const setting = staticGetAdd("settingLogs", settingLogs);
|
|
83
|
+
const apiGrid = useRef(null);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
apiGrid.current?.api.sizeColumnsToFit();
|
|
86
|
+
}, [update]);
|
|
87
|
+
updateBy(setting, () => {
|
|
88
|
+
if (setting.params.minVarLogs) {
|
|
89
|
+
apiGrid.current?.api.setFilterModel({
|
|
90
|
+
var: {
|
|
91
|
+
filterType: 'number',
|
|
92
|
+
type: 'greaterThanOrEqual',
|
|
93
|
+
filter: setting.params.minVarLogs
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
apiGrid.current?.api.destroyFilter("var");
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
updateBy(datum, () => {
|
|
102
|
+
const data = datum.last[0];
|
|
103
|
+
console.log({ data });
|
|
104
|
+
if (data) { // data.time timeLocalToStr_yyyymmdd_hhmmss_ms
|
|
105
|
+
apiGrid.current?.api.applyTransactionAsync({
|
|
106
|
+
add: [
|
|
107
|
+
{
|
|
108
|
+
...data,
|
|
109
|
+
time: data.time
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
const Main = useCallback(() => {
|
|
116
|
+
const columns = [
|
|
117
|
+
{
|
|
118
|
+
field: "time",
|
|
119
|
+
sort: "desc",
|
|
120
|
+
width: 50,
|
|
121
|
+
valueFormatter: (e) => e.value.time ? timeLocalToStr_hhmmss(e.value.time) : e.value.time
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
field: "id",
|
|
125
|
+
width: 20,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
field: "var",
|
|
129
|
+
width: 50,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
field: "type1",
|
|
133
|
+
width: 50,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
field: "type2",
|
|
137
|
+
width: 50,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
field: "type3",
|
|
141
|
+
width: 50,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
field: "txt",
|
|
145
|
+
wrapText: true,
|
|
146
|
+
autoHeight: true,
|
|
147
|
+
width: 350
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
field: "address",
|
|
151
|
+
width: 150,
|
|
152
|
+
},
|
|
153
|
+
];
|
|
154
|
+
return _jsx("div", { className: "maxSize", children: _jsx(AgGridReact
|
|
155
|
+
// className = "ag-theme-alpine-dark ag-theme-alpine2" // ag-theme-alpine-dark3
|
|
156
|
+
, {
|
|
157
|
+
// className = "ag-theme-alpine-dark ag-theme-alpine2" // ag-theme-alpine-dark3
|
|
158
|
+
suppressCellFocus: true, onGridReady: (a) => {
|
|
159
|
+
apiGrid.current = a; //as GridReadyEvent<tColum>
|
|
160
|
+
apiGrid.current.api.sizeColumnsToFit();
|
|
161
|
+
if (setting.params.minVarLogs) {
|
|
162
|
+
apiGrid.current.api.setFilterModel({
|
|
163
|
+
var: {
|
|
164
|
+
filterType: 'number',
|
|
165
|
+
type: 'greaterThanOrEqual',
|
|
166
|
+
filter: setting.params.minVarLogs
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}, onSortChanged: (e) => {
|
|
171
|
+
}, defaultColDef: {
|
|
172
|
+
headerClass: () => ("gridTable-header"),
|
|
173
|
+
resizable: true,
|
|
174
|
+
cellStyle: { textAlign: "center" },
|
|
175
|
+
sortable: true,
|
|
176
|
+
filter: true,
|
|
177
|
+
wrapText: true,
|
|
178
|
+
}, headerHeight: 30, rowHeight: 26, autoSizePadding: 1, rowData: rowData, columnDefs: columns, onCellMouseDown: (e) => {
|
|
179
|
+
// @ts-ignore
|
|
180
|
+
if (e.event?.button == 2) {
|
|
181
|
+
// copyToClipboard(e.value)
|
|
182
|
+
mouseMenuApi.map.set("sym", [
|
|
183
|
+
{
|
|
184
|
+
name: "copy", onClick: () => { copyToClipboard(e.value); }
|
|
185
|
+
}
|
|
186
|
+
]);
|
|
187
|
+
}
|
|
188
|
+
} }) });
|
|
189
|
+
}, [true]);
|
|
190
|
+
return _jsx(Main, {});
|
|
191
|
+
}
|
|
192
|
+
function Message({ logs }) {
|
|
193
|
+
let red = (logs.var ?? 0) * 10;
|
|
194
|
+
if (red > 255)
|
|
195
|
+
red = 255;
|
|
196
|
+
return _jsxs("div", { className: "testAnime", style: { width: "200px", color: "rgb(255,255,255)", height: "auto", marginTop: "10px", borderRight: "5px solid #5D9FFA", background: `rgb(${red},73,35)` }, children: [_jsx("p", { style: { textAlign: "center", fontSize: "10px", marginBottom: "1px" }, children: "оповещение" }), _jsx("hr", { style: {
|
|
197
|
+
backgroundImage: "linear-gradient(to right, transparent, rgba(255, 255, 255, 1), transparent)",
|
|
198
|
+
border: 0,
|
|
199
|
+
height: "1px",
|
|
200
|
+
margin: "0 0 0 0",
|
|
201
|
+
boxSizing: "content-box",
|
|
202
|
+
display: "block"
|
|
203
|
+
} }), _jsx("div", { style: { textAlign: "right", marginRight: "10px", height: "auto", overflowWrap: "break-word", textOverflow: "ellipsis" }, children: typeof logs.txt == "object" ? JSON.stringify(logs.txt) : logs.txt }), _jsx("p", { style: { float: "inline-end", textAlign: "right", marginRight: "10px" }, children: (new Date()).toLocaleDateString() })] });
|
|
204
|
+
}
|
|
205
|
+
const tt = {};
|
|
206
|
+
let r = 0;
|
|
207
|
+
export function MessageEventLogs({ zIndex }) {
|
|
208
|
+
let max = 8;
|
|
209
|
+
const setting = staticGetAdd("settingLogs", settingLogs);
|
|
210
|
+
updateBy(tt);
|
|
211
|
+
updateBy(datumMiniConst, () => {
|
|
212
|
+
const last = datumMiniConst.last[0];
|
|
213
|
+
if (setting.params.minVarMessage && (!last.var || last.var < setting.params.minVarMessage))
|
|
214
|
+
return;
|
|
215
|
+
let key = String(r++);
|
|
216
|
+
tt[key] = _jsx("div", { className: "example-exit", children: _jsx(Message, { logs: last }) }, key);
|
|
217
|
+
setTimeout(() => {
|
|
218
|
+
if (tt[key]) {
|
|
219
|
+
delete tt[key];
|
|
220
|
+
if (Object.values(tt).length < max)
|
|
221
|
+
renderBy(tt);
|
|
222
|
+
}
|
|
223
|
+
}, setting.params.timeShow ? setting.params.timeShow * 1000 : 2000);
|
|
224
|
+
renderBy(tt);
|
|
225
|
+
});
|
|
226
|
+
const tr = [...Object.values(tt)].reverse().slice(0, 10);
|
|
227
|
+
return _jsxs("div", { style: { maxHeight: "50vh", position: "absolute", right: "1px", zIndex }, children: [tr && _jsx("div", { onClick: () => { setting.params.show = !setting.params.show; renderBy(tt); }, style: { margin: 3, padding: 3, right: 0, position: "absolute", zIndex: 120,
|
|
228
|
+
...setting.params.show ?
|
|
229
|
+
{ background: "rgb(58,58,58)", fontSize: "25px" } :
|
|
230
|
+
{ background: "rgb(144,60,60)" }
|
|
231
|
+
}, children: setting.params.show ? "X" : "log" }), tr && _jsx("div", { children: setting.params.show ? [...Object.values(tt)].reverse().slice(0, 10) : null })] });
|
|
232
|
+
}
|
|
233
|
+
const defPageBase = {
|
|
234
|
+
keyPage: "PageLogs"
|
|
235
|
+
};
|
|
236
|
+
const pages = [
|
|
237
|
+
{ name: "message", key: "PageLogs", page: PageLogs },
|
|
238
|
+
{ name: "setting", key: "InputSettingLogs", page: InputSettingLogs },
|
|
239
|
+
];
|
|
240
|
+
const map = Object.fromEntries(pages.map(e => [e.key, e.page]));
|
|
241
|
+
export function PageLogs2({ update }) {
|
|
242
|
+
const datum = defPageBase;
|
|
243
|
+
updateBy(datum);
|
|
244
|
+
const Page = map[datum.keyPage];
|
|
245
|
+
return _jsxs("div", { className: "maxSize", style: { display: "flex", flexDirection: "column" }, children: [_jsx("div", { style: { width: "100%" }, children: _jsx("div", { style: { display: "flex", justifyContent: "center" }, children: pages.map((e, i) => (_jsx("div", { onClick: (z) => {
|
|
246
|
+
datum.keyPage = e.key;
|
|
247
|
+
renderBy(datum);
|
|
248
|
+
}, className: datum.keyPage == e.key ? "msTradeAlt msTradeActive" : "msTradeAlt", children: e.name }, i))) }) }), _jsx("div", { className: "maxSize", children: Page && _jsx(Page, { update: update }, datum.keyPage) })] });
|
|
249
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/** -----------------------------
|
|
3
|
+
* 1. Типы для логов
|
|
4
|
+
* -----------------------------
|
|
5
|
+
*/
|
|
6
|
+
export interface tLogsInput<T extends object = {}> {
|
|
7
|
+
id: string;
|
|
8
|
+
var?: number;
|
|
9
|
+
time: Date;
|
|
10
|
+
txt: string;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
export interface tLogs<T extends object = {}> extends tLogsInput<T> {
|
|
14
|
+
num: number;
|
|
15
|
+
}
|
|
16
|
+
/** -----------------------------
|
|
17
|
+
* 3. Интерфейс контекста
|
|
18
|
+
* -----------------------------
|
|
19
|
+
*/
|
|
20
|
+
interface LogsContextValue {
|
|
21
|
+
logs: tLogs[];
|
|
22
|
+
addLog: (input: tLogsInput) => void;
|
|
23
|
+
minVarLogs: number;
|
|
24
|
+
setMinVarLogs: (value: number) => void;
|
|
25
|
+
minVarMessage: number;
|
|
26
|
+
setMinVarMessage: (value: number) => void;
|
|
27
|
+
timeShow: number;
|
|
28
|
+
setTimeShow: (value: number) => void;
|
|
29
|
+
showMessages: boolean;
|
|
30
|
+
setShowMessages: (value: boolean) => void;
|
|
31
|
+
}
|
|
32
|
+
export declare function LogsProvider({ children }: {
|
|
33
|
+
children: React.ReactNode;
|
|
34
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
/** -----------------------------
|
|
36
|
+
* 5. Хук для удобного доступа к контексту
|
|
37
|
+
* -----------------------------
|
|
38
|
+
*/
|
|
39
|
+
export declare function useLogsContext(): LogsContextValue;
|
|
40
|
+
/** -----------------------------
|
|
41
|
+
* 6. Компонент LogsTable
|
|
42
|
+
* (аналог PageLogs)
|
|
43
|
+
* -----------------------------
|
|
44
|
+
*/
|
|
45
|
+
export declare function LogsTable(): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export declare function LogsNotifications(): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
/** -----------------------------
|
|
48
|
+
* 8. Компонент LogsSettings
|
|
49
|
+
* (аналог InputSettingLogs)
|
|
50
|
+
* -----------------------------
|
|
51
|
+
*/
|
|
52
|
+
export declare function LogsSettings(): import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
/** -----------------------------
|
|
54
|
+
* 9. MainPage — вкладки (Таблица / Настройки)
|
|
55
|
+
* -----------------------------
|
|
56
|
+
*/
|
|
57
|
+
export declare function MainPage(): import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
/** -----------------------------
|
|
59
|
+
* 10. Корневой компонент App
|
|
60
|
+
* -----------------------------
|
|
61
|
+
*/
|
|
62
|
+
export default function AppLogs(): import("react/jsx-runtime").JSX.Element;
|
|
63
|
+
export {};
|