react-graph-grid 0.1.4 → 0.1.5

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.
Files changed (88) hide show
  1. package/README.md +4 -0
  2. package/dist/index.esm.js +21 -0
  3. package/dist/index.js +56 -0
  4. package/dist/index10.esm.js +3844 -0
  5. package/dist/index10.js +3848 -0
  6. package/dist/index11.esm.js +4121 -0
  7. package/dist/index11.js +4125 -0
  8. package/dist/index12.esm.js +5238 -0
  9. package/dist/index12.js +5242 -0
  10. package/dist/index13.esm.js +5466 -0
  11. package/dist/index13.js +5470 -0
  12. package/dist/index14.esm.js +22 -0
  13. package/dist/index14.js +26 -0
  14. package/dist/index15.esm.js +402 -0
  15. package/dist/index15.js +403 -0
  16. package/dist/index16.esm.js +507 -0
  17. package/dist/index16.js +507 -0
  18. package/dist/index17.esm.js +256 -0
  19. package/dist/index17.js +257 -0
  20. package/dist/index18.esm.js +261 -0
  21. package/dist/index18.js +263 -0
  22. package/dist/index19.esm.js +623 -0
  23. package/dist/index19.js +624 -0
  24. package/dist/index2.esm.js +6 -0
  25. package/dist/index2.js +2 -0
  26. package/dist/index20.esm.js +219 -0
  27. package/dist/index20.js +220 -0
  28. package/dist/index21.esm.js +298 -0
  29. package/dist/index21.js +299 -0
  30. package/dist/index22.esm.js +662 -0
  31. package/dist/index22.js +663 -0
  32. package/dist/index23.esm.js +340 -0
  33. package/dist/index23.js +341 -0
  34. package/dist/index24.esm.js +269 -0
  35. package/dist/index24.js +270 -0
  36. package/dist/index25.esm.js +600 -0
  37. package/dist/index25.js +601 -0
  38. package/dist/index26.esm.js +245 -0
  39. package/dist/index26.js +246 -0
  40. package/dist/index27.esm.js +136 -0
  41. package/dist/index27.js +137 -0
  42. package/dist/index28.esm.js +70 -0
  43. package/dist/index28.js +70 -0
  44. package/dist/index29.esm.js +748 -0
  45. package/dist/index29.js +748 -0
  46. package/dist/index30.esm.js +363 -0
  47. package/dist/index30.js +363 -0
  48. package/dist/index4.esm.js +27 -0
  49. package/dist/index4.js +27 -0
  50. package/dist/index5.esm.js +35 -0
  51. package/dist/index5.js +39 -0
  52. package/dist/index6.esm.js +200 -0
  53. package/dist/index6.js +204 -0
  54. package/dist/index7.esm.js +9 -0
  55. package/dist/index7.js +13 -0
  56. package/dist/index8.esm.js +65 -0
  57. package/dist/index8.js +68 -0
  58. package/dist/index9.esm.js +102 -0
  59. package/dist/index9.js +103 -0
  60. package/{src/css/default.css → dist/react-graph-grid.css} +2 -1
  61. package/package.json +6 -3
  62. package/eslint.config.js +0 -29
  63. package/index.html +0 -13
  64. package/index.js +0 -19
  65. package/npm.aps +0 -0
  66. package/src/Base.jsx +0 -81
  67. package/src/Card.jsx +0 -333
  68. package/src/Dropdown.jsx +0 -339
  69. package/src/FieldEdit.jsx +0 -376
  70. package/src/Graph.jsx +0 -482
  71. package/src/Grid.jsx +0 -887
  72. package/src/GridCD.jsx +0 -180
  73. package/src/GridDB.jsx +0 -897
  74. package/src/GridFE.jsx +0 -753
  75. package/src/GridFL.jsx +0 -468
  76. package/src/GridGR.jsx +0 -311
  77. package/src/GridPK.jsx +0 -414
  78. package/src/Modal.jsx +0 -511
  79. package/src/Overlay.jsx +0 -140
  80. package/src/Tests/DebugApp.jsx +0 -334
  81. package/src/Tests/TestData.jsx +0 -251
  82. package/src/Themes/DefaultGridTheme.jsx +0 -36
  83. package/src/Themes/Images.jsx +0 -438
  84. package/src/Themes/Translate.jsx +0 -76
  85. package/src/css/default_.css +0 -945
  86. package/src/main.jsx +0 -10
  87. package/vite.config.js +0 -14
  88. /package/{public → dist}/IM.svg +0 -0
@@ -0,0 +1,22 @@
1
+ import { __commonJSMin } from "./index2.esm.js";
2
+ import { require_react_dom_server_legacy_browser_production } from "./index10.esm.js";
3
+ import { require_react_dom_server_browser_production } from "./index11.esm.js";
4
+ import { require_react_dom_server_legacy_browser_development } from "./index12.esm.js";
5
+ import { require_react_dom_server_browser_development } from "./index13.esm.js";
6
+ var require_server_browser = /* @__PURE__ */ __commonJSMin(((exports) => {
7
+ var l, s;
8
+ if (process.env.NODE_ENV === "production") {
9
+ l = require_react_dom_server_legacy_browser_production();
10
+ s = require_react_dom_server_browser_production();
11
+ } else {
12
+ l = require_react_dom_server_legacy_browser_development();
13
+ s = require_react_dom_server_browser_development();
14
+ }
15
+ exports.version = l.version;
16
+ exports.renderToString = l.renderToString;
17
+ exports.renderToStaticMarkup = l.renderToStaticMarkup;
18
+ exports.renderToReadableStream = s.renderToReadableStream;
19
+ exports.resume = s.resume;
20
+ }));
21
+ export default require_server_browser();
22
+ export { require_server_browser };
@@ -0,0 +1,26 @@
1
+ const require_rolldown_runtime = require("./index2.js");
2
+ const require_react_dom_server_legacy_browser_production$1 = require("./index10.js");
3
+ const require_react_dom_server_browser_production$1 = require("./index11.js");
4
+ const require_react_dom_server_legacy_browser_development$1 = require("./index12.js");
5
+ const require_react_dom_server_browser_development$1 = require("./index13.js");
6
+ var require_server_browser = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
7
+ var l, s;
8
+ if (process.env.NODE_ENV === "production") {
9
+ l = require_react_dom_server_legacy_browser_production$1.default;
10
+ s = require_react_dom_server_browser_production$1.default;
11
+ } else {
12
+ l = require_react_dom_server_legacy_browser_development$1.default;
13
+ s = require_react_dom_server_browser_development$1.default;
14
+ }
15
+ exports.version = l.version;
16
+ exports.renderToString = l.renderToString;
17
+ exports.renderToStaticMarkup = l.renderToStaticMarkup;
18
+ exports.renderToReadableStream = s.renderToReadableStream;
19
+ exports.resume = s.resume;
20
+ }));
21
+ Object.defineProperty(exports, "default", {
22
+ enumerable: true,
23
+ get: function() {
24
+ return require_server_browser();
25
+ }
26
+ });
@@ -0,0 +1,402 @@
1
+ import { require_jsx_runtime } from "./index7.esm.js";
2
+ import { BaseComponent, log } from "./index8.esm.js";
3
+ import { Overlay, OverlayClass } from "./index9.esm.js";
4
+ import { require_server_browser } from "./index14.esm.js";
5
+ import { useEffect, useState } from "react";
6
+ var import_server_browser = require_server_browser();
7
+ var import_jsx_runtime = require_jsx_runtime();
8
+ function Modal(props) {
9
+ let wnd = null;
10
+ const [wndState, setState] = useState({
11
+ wnd,
12
+ ind: 0
13
+ });
14
+ const oldWnd = wndState.wnd;
15
+ wnd = oldWnd && oldWnd.uid === props.uid ? oldWnd : new ModalClass(props);
16
+ if (props.init) props.init(wnd);
17
+ wnd.refreshState = function() {
18
+ setState({
19
+ wnd,
20
+ ind: wnd.stateind++
21
+ });
22
+ };
23
+ useEffect(() => {
24
+ wnd.setupEvents();
25
+ return () => {
26
+ wnd.clearEvents();
27
+ };
28
+ }, [wnd]);
29
+ return wnd.render();
30
+ }
31
+ var ModalClass = class ModalClass extends BaseComponent {
32
+ constructor(props) {
33
+ super(props);
34
+ const wnd = this;
35
+ wnd.uid = props.uid;
36
+ wnd.opt = {};
37
+ wnd.id = ModalClass._seq++;
38
+ wnd.opt.keyAdd = props.keyAdd;
39
+ wnd.opt.zInd = props.zInd || ++OverlayClass._zInd;
40
+ wnd.opt.pos = props.pos || {
41
+ x: 0,
42
+ y: 0,
43
+ w: "100%",
44
+ h: "100%"
45
+ };
46
+ wnd.opt.isModal = props.isModal != null ? props.isModal : true;
47
+ wnd.opt.closeWhenClick = props.closeWhenClick;
48
+ wnd.opt.closeWhenEscape = props.closeWhenEscape;
49
+ wnd.opt.closeWhenMiss = props.closeWhenMiss && wnd.opt.isModal;
50
+ wnd.opt.closeWhenMouseLeave = props.closeWhenMouseLeave;
51
+ wnd.opt.onMouseEnter = props.onMouseEnter;
52
+ wnd.opt.onMouseLeave = props.onMouseLeave;
53
+ wnd.opt.resizable = props.resizable != null ? props.resizable : true;
54
+ wnd.opt.draggable = props.draggable != null ? props.draggable : true;
55
+ wnd.opt.hiddenOverlay = props.hiddenOverlay;
56
+ wnd.opt.noHeader = props.noHeader;
57
+ wnd.opt.noFooter = props.noFooter;
58
+ wnd.opt.noPadding = props.noPadding;
59
+ wnd.opt.noBodyOverflow = props.noBodyOverflow;
60
+ wnd.opt.margin = props.margin;
61
+ wnd.opt.padding = props.padding;
62
+ wnd.opt.windowClass = props.windowClass;
63
+ wnd.opt.bodyClass = props.bodyClass || BaseComponent.theme.modalBodyClass || "modal-window-body";
64
+ wnd.opt.headerClass = props.headerClass || BaseComponent.theme.modalHeaderClass || "modal-window-header";
65
+ wnd.opt.footerClass = props.footerClass || BaseComponent.theme.modalFooterClass || "modal-window-footer";
66
+ wnd.opt.footerButtonClass = props.footerButtonClass || BaseComponent.theme.modalFooterButtonClass || "modal-window-footer-button";
67
+ wnd.opt.titleClass = props.titleClass || BaseComponent.theme.modalTitleClass || "modal-window-header-title";
68
+ wnd.opt.title = props.title;
69
+ wnd.opt.pos.x = !isNaN(wnd.opt.pos.x) ? wnd.opt.pos.x + "px" : wnd.opt.pos.x;
70
+ wnd.opt.pos.y = !isNaN(wnd.opt.pos.y) ? wnd.opt.pos.y + "px" : wnd.opt.pos.y;
71
+ wnd.opt.pos.w = !isNaN(wnd.opt.pos.w) ? wnd.opt.pos.w + "px" : wnd.opt.pos.w;
72
+ wnd.opt.pos.h = !isNaN(wnd.opt.pos.h) ? wnd.opt.pos.h + "px" : wnd.opt.pos.h;
73
+ wnd.opt.pos.minW = !isNaN(wnd.opt.pos.minW) ? wnd.opt.pos.minW + "px" : wnd.opt.pos.minW;
74
+ wnd.opt.pos.minH = !isNaN(wnd.opt.pos.minH) ? wnd.opt.pos.minH + "px" : wnd.opt.pos.minH;
75
+ wnd.opt.pos.maxW = !isNaN(wnd.opt.pos.maxW) ? wnd.opt.pos.maxW + "px" : wnd.opt.pos.maxW;
76
+ wnd.opt.pos.maxH = !isNaN(wnd.opt.pos.maxH) ? wnd.opt.pos.maxH + "px" : wnd.opt.pos.maxH;
77
+ wnd.onClose = props.onClose;
78
+ wnd.opt.dimensionsByContent = props.dimensionsByContent;
79
+ wnd.renderContent = props.renderContent || function() {
80
+ return null;
81
+ };
82
+ wnd.buttons = [];
83
+ if (props.footerButtons) {
84
+ wnd.buttonsDict = {};
85
+ let seq = 0;
86
+ for (let btn of props.footerButtons) {
87
+ btn._ind = seq++;
88
+ wnd.buttonsDict[btn._ind] = btn;
89
+ wnd.buttons.push(btn);
90
+ }
91
+ }
92
+ wnd.visible = props.visible != null ? props.visible : true;
93
+ wnd.stateind = 0;
94
+ }
95
+ static _isFake = false;
96
+ static _seq = 0;
97
+ render() {
98
+ const wnd = this;
99
+ if (!wnd.visible) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
100
+ if (wnd.opt.dimensionsByContent) {
101
+ const rect = wnd.getDimensionsByContent(wnd.opt.margin, wnd.opt.padding);
102
+ wnd.opt.pos.w = rect.w || wnd.opt.pos.w;
103
+ wnd.opt.pos.h = rect.h || wnd.opt.pos.h;
104
+ if (wnd.opt.pos.maxX != null && parseInt(wnd.opt.pos.x) > wnd.opt.pos.maxX) wnd.opt.pos.x = wnd.opt.pos.maxX - Math.max(wnd.opt.pos.w, parseInt(wnd.opt.pos.minW) || 0) + "px";
105
+ }
106
+ if (wnd.opt.isModal || wnd.opt.closeWhenMiss) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Overlay, {
107
+ renderChild: (zInd) => {
108
+ return wnd.renderSelf(zInd++);
109
+ },
110
+ closeWhenClick: wnd.opt.closeWhenMiss,
111
+ init: (ovl) => ovl.visible = wnd.visible,
112
+ onClose: () => wnd.close(),
113
+ isHidden: wnd.opt.hiddenOverlay
114
+ }) });
115
+ return wnd.renderSelf();
116
+ }
117
+ renderSelf(zInd) {
118
+ const wnd = this;
119
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
120
+ id: `window_${wnd.id}_`,
121
+ style: {
122
+ width: wnd.opt.pos.w,
123
+ height: wnd.opt.pos.h,
124
+ top: wnd.opt.pos.y,
125
+ left: wnd.opt.pos.x,
126
+ minWidth: wnd.opt.pos.minW || "",
127
+ minHeight: wnd.opt.pos.minH || "",
128
+ maxWidth: wnd.opt.pos.maxW || "",
129
+ maxHeight: wnd.opt.pos.maxH || "",
130
+ zIndex: zInd || wnd.opt.zInd,
131
+ display: "flex",
132
+ flexDirection: "column",
133
+ justifyContent: "space-between",
134
+ position: "fixed",
135
+ overflow: "hidden",
136
+ backgroundColor: "white",
137
+ border: "1px solid"
138
+ },
139
+ className: `modal-window-wnd ${wnd.opt.windowClass || ""}`,
140
+ onMouseLeave: (e) => wnd.onMouseLeave(e),
141
+ onMouseEnter: (e) => wnd.onMouseEnter(e),
142
+ children: [
143
+ wnd.opt.noHeader ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}) : wnd.renderHeader(),
144
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
145
+ "wnd-body": 1,
146
+ className: wnd.opt.bodyClass,
147
+ style: {
148
+ padding: wnd.opt.noPadding ? "0" : "",
149
+ overflow: wnd.opt.noBodyOverflow ? "hidden" : "auto",
150
+ height: "100%"
151
+ },
152
+ children: wnd.renderContent(wnd)
153
+ }, `window_${wnd.id}_body_`),
154
+ wnd.opt.noFooter ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}) : wnd.renderFooter(),
155
+ !wnd.opt.resizable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}) : wnd.renderResizables()
156
+ ]
157
+ }, `window_${wnd.id}_${wnd.opt.keyAdd != null ? wnd.opt.keyAdd : ""}_`) });
158
+ }
159
+ renderHeader() {
160
+ const wnd = this;
161
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
162
+ "wnd-header": 1,
163
+ className: wnd.opt.headerClass,
164
+ style: {
165
+ display: "flex",
166
+ flexWrap: "nowrap",
167
+ justifyContent: "space-between"
168
+ },
169
+ onMouseDown: (e) => wnd.mouseDownDrag(e),
170
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", {
171
+ className: wnd.opt.titleClass,
172
+ style: { margin: "0.5em 0 0.5em 1.5em" },
173
+ children: wnd.opt.title || ""
174
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
175
+ "wnd-btn": `close_${wnd.id}_`,
176
+ type: "button",
177
+ className: "close",
178
+ style: {
179
+ color: "black",
180
+ lineHeight: "1",
181
+ fontWeight: "21px",
182
+ border: "none"
183
+ },
184
+ onClick: () => wnd.close(),
185
+ children: "×"
186
+ })]
187
+ }, `window_${wnd.id}_header_`);
188
+ }
189
+ renderFooter() {
190
+ const wnd = this;
191
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
192
+ "wnd-footer": 1,
193
+ className: wnd.opt.footerClass,
194
+ onMouseDown: (e) => wnd.mouseDownDrag(e),
195
+ style: {
196
+ display: "flex",
197
+ flexWrap: "nowrap",
198
+ justifyContent: "space-between",
199
+ alignItems: "center"
200
+ },
201
+ children: wnd.buttons.map((btn, ind) => {
202
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
203
+ "wnd-btn": `button_${wnd.id}_${btn._ind}_`,
204
+ className: wnd.opt.footerButtonClass,
205
+ title: btn.title,
206
+ onClick: btn.onClick ? (e) => btn.onClick(e) : null,
207
+ disabled: btn.getDisabled ? btn.getDisabled() : false,
208
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { className: btn.imageClass }), btn.title]
209
+ }, `window_${wnd.id}_${btn._ind}_${ind}_button_`);
210
+ })
211
+ }, `window_${wnd.id}_footer_`);
212
+ }
213
+ renderResizables() {
214
+ const wnd = this;
215
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
216
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
217
+ "wnd-rsz-y": wnd.id,
218
+ style: {
219
+ position: "absolute",
220
+ left: "-1px",
221
+ bottom: "-6px",
222
+ cursor: "s-resize",
223
+ height: "12px",
224
+ width: "calc(100% - 10px)",
225
+ zIndex: wnd.opt.zInd + 5
226
+ },
227
+ onMouseDown: (e) => wnd.mouseDownResize(e)
228
+ }, `wnd-rsz-y_${wnd.id}_`),
229
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
230
+ "wnd-rsz-x": wnd.id,
231
+ style: {
232
+ position: "absolute",
233
+ right: "-6px",
234
+ top: "-1px",
235
+ cursor: "e-resize",
236
+ height: "calc(100% - 10px)",
237
+ width: "12px",
238
+ zIndex: wnd.opt.zInd + 5
239
+ },
240
+ onMouseDown: (e) => wnd.mouseDownResize(e)
241
+ }, `wnd-rsz-x_${wnd.id}_`),
242
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
243
+ "wnd-rsz-xy": wnd.id,
244
+ style: {
245
+ position: "absolute",
246
+ right: "-5px",
247
+ bottom: "-5px",
248
+ cursor: "se-resize",
249
+ height: "16px",
250
+ width: "16px",
251
+ zIndex: wnd.opt.zInd + 5
252
+ },
253
+ onMouseDown: (e) => wnd.mouseDownResize(e)
254
+ }, `wnd-rsz-xy_${wnd.id}_`)
255
+ ] });
256
+ }
257
+ close() {
258
+ const wnd = this;
259
+ if (wnd.onClose) {
260
+ const ev = { self: wnd };
261
+ wnd.onClose(ev);
262
+ if (ev.cancel) return;
263
+ }
264
+ wnd.visible = false;
265
+ wnd.refreshState();
266
+ }
267
+ show(e) {
268
+ const wnd = this;
269
+ wnd.visible = true;
270
+ if (e) {
271
+ wnd.opt.pos.x = e.clientX;
272
+ wnd.opt.pos.y = e.clientY;
273
+ }
274
+ wnd.refreshState();
275
+ }
276
+ getDimensionsByContent(margin, padding) {
277
+ const wnd = this;
278
+ const renderFake = function() {
279
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
280
+ wnd.opt.noHeader ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}) : wnd.renderHeader(),
281
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
282
+ "wnd-body": 1,
283
+ className: wnd.opt.bodyClass,
284
+ style: { padding: wnd.opt.noPadding ? "0" : "" },
285
+ children: wnd.renderContent(wnd, "fake")
286
+ }, `window_${wnd.id}_body_`),
287
+ wnd.opt.noFooter ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}) : wnd.renderFooter(),
288
+ !wnd.opt.resizable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}) : wnd.renderResizables()
289
+ ] });
290
+ };
291
+ const res = {
292
+ w: 0,
293
+ h: 0
294
+ };
295
+ ModalClass._isFake = true;
296
+ const fakeDiv = document.createElement("div");
297
+ fakeDiv.style.opacity = 0;
298
+ fakeDiv.style.position = "fixed";
299
+ fakeDiv.style.height = "auto";
300
+ fakeDiv.style.margin = margin || "";
301
+ fakeDiv.style.padding = padding || "";
302
+ fakeDiv.innerHTML = (0, import_server_browser.renderToStaticMarkup)(renderFake());
303
+ document.body.append(fakeDiv);
304
+ const rect = getComputedStyle(fakeDiv);
305
+ res.w = parseInt(rect.width) + 2;
306
+ res.h = parseInt(rect.height) + 2;
307
+ fakeDiv.remove();
308
+ ModalClass._isFake = false;
309
+ return res;
310
+ }
311
+ setupEvents() {
312
+ const wnd = this;
313
+ function onKeyDown(e) {
314
+ const key = e && e.key ? e.key.toLowerCase() : "";
315
+ if ((key === "esc" || key === "escape") && wnd.opt.closeWhenEscape === true) wnd.close();
316
+ }
317
+ document.addEventListener("keydown", onKeyDown);
318
+ wnd.clearEvents = function() {
319
+ document.removeEventListener("keydown", onKeyDown);
320
+ };
321
+ }
322
+ onMouseLeave() {
323
+ const wnd = this;
324
+ if (wnd.opt.onMouseLeave) wnd.opt.onMouseLeave(wnd);
325
+ if (wnd.opt.closeWhenMouseLeave) wnd.close();
326
+ }
327
+ onMouseEnter(e) {
328
+ const wnd = this;
329
+ if (wnd.opt.onMouseEnter) wnd.opt.onMouseEnter(e);
330
+ }
331
+ mouseDownDrag(e) {
332
+ const wnd = this;
333
+ if (!wnd.visible || !wnd.opt.draggable) return;
334
+ if (e.target.tagName !== "DIV") return;
335
+ const pos = wnd.opt.pos;
336
+ const elem = document.getElementById(`window_${wnd.id}_`);
337
+ if (!elem) {
338
+ log(`Elem window_${wnd.id}_ not found!`);
339
+ return;
340
+ }
341
+ const rect = elem.getBoundingClientRect();
342
+ const shiftX = e.pageX - rect.left;
343
+ const shiftY = e.pageY - rect.top;
344
+ moveAt(e.pageX, e.pageY);
345
+ function moveAt(pageX, pageY) {
346
+ pos.x = pageX - shiftX;
347
+ pos.y = pageY - shiftY;
348
+ elem.style.left = pos.x + "px";
349
+ elem.style.top = pos.y + "px";
350
+ }
351
+ function onMouseMove(e$1) {
352
+ moveAt(e$1.pageX, e$1.pageY);
353
+ }
354
+ document.addEventListener("mousemove", onMouseMove);
355
+ document.addEventListener("mouseup", onMouseUp);
356
+ function onMouseUp() {
357
+ document.removeEventListener("mousemove", onMouseMove);
358
+ document.removeEventListener("mouseup", onMouseUp);
359
+ elem.ondragstart = null;
360
+ }
361
+ elem.ondragstart = function() {
362
+ return false;
363
+ };
364
+ }
365
+ mouseDownResize(e) {
366
+ const wnd = this;
367
+ if (!wnd.visible || !wnd.opt.resizable) return;
368
+ const pos = wnd.opt.pos;
369
+ const elem = document.getElementById(`window_${wnd.id}_`);
370
+ const cs = getComputedStyle(elem);
371
+ const [initW, initH] = [parseInt(cs.width), parseInt(cs.height)];
372
+ const shiftX = e.target.hasAttribute("wnd-rsz-x") || e.target.hasAttribute("wnd-rsz-xy") ? e.pageX : -1;
373
+ const shiftY = e.target.hasAttribute("wnd-rsz-y") || e.target.hasAttribute("wnd-rsz-xy") ? e.pageY : -1;
374
+ resize(e.pageX, e.pageY);
375
+ function resize(pageX, pageY) {
376
+ if (shiftX > 0) {
377
+ const w = initW + pageX - shiftX;
378
+ pos.w = (!pos.maxW || w <= pos.maxW) && (!pos.minW || w >= pos.minW) ? w : pos.w;
379
+ elem.style.width = pos.w + "px";
380
+ }
381
+ if (shiftY > 0) {
382
+ const h = initH + pageY - shiftY;
383
+ pos.h = (!pos.maxH || h <= pos.maxH) && (!pos.minH || h >= pos.minH) ? h : pos.h;
384
+ elem.style.height = pos.h + "px";
385
+ }
386
+ }
387
+ function onMouseMove(e$1) {
388
+ resize(e$1.pageX, e$1.pageY);
389
+ }
390
+ document.addEventListener("mousemove", onMouseMove);
391
+ document.addEventListener("mouseup", onMouseUp);
392
+ elem.ondragstart = function() {
393
+ return false;
394
+ };
395
+ function onMouseUp() {
396
+ document.removeEventListener("mousemove", onMouseMove);
397
+ document.removeEventListener("mouseup", onMouseUp);
398
+ elem.ondragstart = null;
399
+ }
400
+ }
401
+ };
402
+ export { Modal, ModalClass };