@har-analyzer/components 0.0.18 → 0.0.19
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/dist/assets/har-entries-viewer.css +1 -0
- package/dist/chunks/index.js +496 -477
- package/dist/chunks/index2.js +31 -20
- package/dist/components/close-overlay.d.ts +5 -0
- package/dist/components/complete-padding.d.ts +2 -0
- package/dist/components/enhanced-table.d.ts +3 -1
- package/dist/components/r2-layout/fgl.d.ts +10 -0
- package/dist/components/r2-layout/index.d.ts +22 -0
- package/dist/features/view-har-entry/index.d.ts +4 -1
- package/dist/har-entries-viewer.js +648 -146
- package/dist/utils/common.d.ts +3 -0
- package/dist/view-har-entry.js +3 -2
- package/package.json +2 -2
- package/dist/components/enhanced-board/constants/i18n.d.ts +0 -26
- package/dist/components/enhanced-board/index.d.ts +0 -13
|
@@ -1,169 +1,671 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import z from "
|
|
4
|
-
import N from "@cloudscape-design/
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { d as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
resizeHandleAriaDescription: "Use Space or Enter to activate resize, arrow keys to move, Space or Enter to submit, or Escape to discard. Be sure to temporarily disable any screen reader navigation feature that may interfere with the functionality of the arrow keys."
|
|
14
|
-
};
|
|
15
|
-
function p(n, t, r) {
|
|
16
|
-
const a = t.length > 0 ? `Conflicts with ${t.map((d) => d.id).join(", ")}.` : "", m = r.length > 0 ? `Disturbed ${r.length} items.` : "";
|
|
17
|
-
return [n, a, m].filter(Boolean).join(" ");
|
|
18
|
-
}
|
|
19
|
-
const M = {
|
|
20
|
-
liveAnnouncementDndStarted: (n) => n === "resize" ? "Resizing" : "Dragging",
|
|
21
|
-
liveAnnouncementDndItemReordered: (n) => {
|
|
22
|
-
const t = `column ${n.placement.x + 1}`, r = `row ${n.placement.y + 1}`;
|
|
23
|
-
return p(
|
|
24
|
-
`Item moved to ${n.direction === "horizontal" ? t : r}.`,
|
|
25
|
-
n.conflicts,
|
|
26
|
-
n.disturbed
|
|
27
|
-
);
|
|
28
|
-
},
|
|
29
|
-
liveAnnouncementDndItemResized: (n) => {
|
|
30
|
-
const t = n.isMinimalColumnsReached ? " (minimal)" : "", r = n.isMinimalRowsReached ? " (minimal)" : "", a = n.direction === "horizontal" ? `columns ${n.placement.width}${t}` : `rows ${n.placement.height}${r}`;
|
|
31
|
-
return p(`Item resized to ${a}.`, n.conflicts, n.disturbed);
|
|
32
|
-
},
|
|
33
|
-
liveAnnouncementDndItemInserted: (n) => {
|
|
34
|
-
const t = `column ${n.placement.x + 1}`, r = `row ${n.placement.y + 1}`;
|
|
35
|
-
return p(`Item inserted to ${t}, ${r}.`, n.conflicts, n.disturbed);
|
|
36
|
-
},
|
|
37
|
-
liveAnnouncementDndCommitted: (n) => `${n} committed`,
|
|
38
|
-
liveAnnouncementDndDiscarded: (n) => `${n} discarded`,
|
|
39
|
-
liveAnnouncementItemRemoved: (n) => p(`Removed item ${n.item.id}.`, [], n.disturbed),
|
|
40
|
-
navigationAriaLabel: "Board navigation",
|
|
41
|
-
navigationAriaDescription: "Click on non-empty item to move focus over",
|
|
42
|
-
navigationItemAriaLabel: (n) => n ? n.id : "Empty"
|
|
43
|
-
};
|
|
44
|
-
function V(n) {
|
|
45
|
-
const {
|
|
46
|
-
components: t,
|
|
47
|
-
definitions: r,
|
|
48
|
-
onDefinitionsChange: a,
|
|
49
|
-
empty: m
|
|
50
|
-
} = n;
|
|
51
|
-
return /* @__PURE__ */ l(
|
|
52
|
-
z,
|
|
1
|
+
import { jsx as C, jsxs as q, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { colorBorderDividerDefault as B, borderWidthField as K, borderRadiusContainer as Y } from "@cloudscape-design/design-tokens";
|
|
3
|
+
import { useMemo as z, useRef as O, useEffect as D, useCallback as G, useState as P } from "react";
|
|
4
|
+
import N from "@cloudscape-design/components/button";
|
|
5
|
+
import V from "@cloudscape-design/components/box";
|
|
6
|
+
import { L as X } from "./chunks/index.js";
|
|
7
|
+
import { D as $, V as Z } from "./chunks/index2.js";
|
|
8
|
+
import { d as H } from "./chunks/har.js";
|
|
9
|
+
import './assets/har-entries-viewer.css';function J(E) {
|
|
10
|
+
const { onClose: e } = E;
|
|
11
|
+
return /* @__PURE__ */ C(
|
|
12
|
+
"div",
|
|
53
13
|
{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const e = t[f];
|
|
60
|
-
if (typeof e == "function") {
|
|
61
|
-
const i = e(I);
|
|
62
|
-
h = i.content, o = i.onRemove;
|
|
63
|
-
} else
|
|
64
|
-
h = e?.content, o = e?.onRemove;
|
|
65
|
-
return /* @__PURE__ */ l(
|
|
66
|
-
N,
|
|
67
|
-
{
|
|
68
|
-
disableContentPaddings: !0,
|
|
69
|
-
i18nStrings: P,
|
|
70
|
-
settings: o && /* @__PURE__ */ l(B, { variant: "icon", iconName: "close", onClick: o }),
|
|
71
|
-
children: h
|
|
72
|
-
}
|
|
73
|
-
);
|
|
14
|
+
style: {
|
|
15
|
+
position: "absolute",
|
|
16
|
+
top: 0,
|
|
17
|
+
right: 0,
|
|
18
|
+
zIndex: 1
|
|
74
19
|
},
|
|
75
|
-
|
|
76
|
-
|
|
20
|
+
children: /* @__PURE__ */ C(
|
|
21
|
+
N,
|
|
22
|
+
{
|
|
23
|
+
variant: "icon",
|
|
24
|
+
iconName: "close",
|
|
25
|
+
onClick: e
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
function Q({ children: E }) {
|
|
32
|
+
return /* @__PURE__ */ C(V, { padding: "m", children: E });
|
|
33
|
+
}
|
|
34
|
+
class T {
|
|
35
|
+
constructor(e, t) {
|
|
36
|
+
this.layouts = /* @__PURE__ */ new Map(), this.editable = !1, this.layoutChangeCallback = () => {
|
|
37
|
+
}, this.selectionChangeCallback = () => {
|
|
38
|
+
}, this.selection = /* @__PURE__ */ new Set(), this.dragPointerId = 0, this.dragStartTime = 0, this.dragStartX = 0, this.dragStartY = 0, this.dragEndX = 0, this.dragEndY = 0, this.dragging = !1, this.preventClick = !1, this.renderRequested = !1, this.layoutFlag = !0, this.selectionFlag = !0, this.metaFlag = !0, this.manipulationCache = /* @__PURE__ */ new WeakMap(), this.fn = this.constructor, this._handleMouseDown = this.handleMouseDown.bind(this), this._handleMouseMove = this.handleMouseMove.bind(this), this._handleMouseUp = this.handleMouseUp.bind(this), this._handlePointerDown = this.handlePointerDown.bind(this), this._handlePointerMove = this.handlePointerMove.bind(this), this._handlePointerUp = this.handlePointerUp.bind(this), this._handleClick = this.handleClick.bind(this), this._handleKeyUp = this.handleKeyUp.bind(this), this.container = e, this.containerWidth = e.offsetWidth, this.breakpoints = this.fn.compileBreakpoints(t), this.resizeObserver = new ResizeObserver(() => this.handleResize()), this.resizeObserver.observe(this.container), this.addEventListeners();
|
|
39
|
+
}
|
|
40
|
+
setConfig(e) {
|
|
41
|
+
this.breakpoints = this.fn.compileBreakpoints(e);
|
|
42
|
+
for (const [t, n] of this.layouts) {
|
|
43
|
+
const s = this.getBreakpoint(t);
|
|
44
|
+
this.fn.repairLayout(n, s.columns) !== n && (this.layouts.set(t, this.fn.repairLayout(n, s.columns)), this.layoutChangeCallback(n, s.name));
|
|
45
|
+
}
|
|
46
|
+
this.layoutFlag = !0, this.selectionFlag = !0, this.metaFlag = !0, this.requestRender();
|
|
47
|
+
}
|
|
48
|
+
setLayout(e, t) {
|
|
49
|
+
const n = this.getBreakpoint(t), s = this.layouts.get(n.name);
|
|
50
|
+
if (e !== s) {
|
|
51
|
+
this.layouts.set(n.name, this.fn.repairLayout(e, n.columns)), this.layoutChangeCallback(e, n.name);
|
|
52
|
+
for (const a of this.breakpoints)
|
|
53
|
+
this.layouts.has(a.name) || (this.layouts.set(a.name, this.fn.repairLayout(e, a.columns)), this.layoutChangeCallback(e, a.name));
|
|
54
|
+
this.layoutFlag = !0, this.requestRender();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
setEditable(e) {
|
|
58
|
+
this.editable = e, this.selectionFlag = !0, this.metaFlag = !0, this.requestRender();
|
|
59
|
+
}
|
|
60
|
+
onLayoutChange(e) {
|
|
61
|
+
this.layoutChangeCallback = e;
|
|
62
|
+
}
|
|
63
|
+
onSelectionChange(e) {
|
|
64
|
+
this.selectionChangeCallback = e;
|
|
65
|
+
}
|
|
66
|
+
setSelection(e) {
|
|
67
|
+
ee(e, this.selection) || (this.selection = e, this.selectionChangeCallback(this.selection), this.selectionFlag = !0, this.requestRender());
|
|
68
|
+
}
|
|
69
|
+
toggleSelection(e, t = !1) {
|
|
70
|
+
this.selection.has(e) ? this.selection.delete(e) : (t && this.selection.clear(), this.selection.add(e)), this.selectionChangeCallback(this.selection), this.selectionFlag = !0, this.requestRender();
|
|
71
|
+
}
|
|
72
|
+
clearSelection() {
|
|
73
|
+
this.selection.size > 0 && (this.selection.clear(), this.selectionChangeCallback(this.selection), this.selectionFlag = !0, this.requestRender());
|
|
74
|
+
}
|
|
75
|
+
getBreakpoint(e) {
|
|
76
|
+
const t = this.breakpoints;
|
|
77
|
+
if (e) {
|
|
78
|
+
const n = t.find((s) => s.name === e);
|
|
79
|
+
if (n)
|
|
80
|
+
return n;
|
|
81
|
+
}
|
|
82
|
+
return t.find((n) => n.maxWidth >= this.containerWidth);
|
|
83
|
+
}
|
|
84
|
+
//
|
|
85
|
+
requestRender() {
|
|
86
|
+
this.renderRequested || (this.renderRequested = !0, requestAnimationFrame(() => this.render()));
|
|
87
|
+
}
|
|
88
|
+
render() {
|
|
89
|
+
this.renderRequested = !1;
|
|
90
|
+
const e = this.getBreakpoint(), t = this.getNextLayout();
|
|
91
|
+
(this.layoutFlag || t !== this.lastLayoutToRender) && (this.fn.renderLayout(this.container, t, e), this.layoutFlag = !1, this.lastLayoutToRender = t), this.selectionFlag && (this.renderSelection(), this.selectionFlag = !1), this.metaFlag && (this.renderMeta(), this.metaFlag = !1);
|
|
92
|
+
}
|
|
93
|
+
renderSelection() {
|
|
94
|
+
const e = this.container.children;
|
|
95
|
+
for (let t = 0, n = e.length; t < n; ++t) {
|
|
96
|
+
const s = e[t];
|
|
97
|
+
s instanceof HTMLElement && s.classList.toggle("-selected", this.selection.has(s.dataset.key));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
renderMeta() {
|
|
101
|
+
const { container: e, editable: t, dragging: n, resizeHandle: s } = this;
|
|
102
|
+
e.classList.toggle("-editable", t), e.classList.toggle("-moving", n && !s), e.classList.toggle("-resizing", n && !!s);
|
|
103
|
+
const a = e.ownerDocument.documentElement;
|
|
104
|
+
a.classList.toggle("_hide-selection", n), a.classList.toggle("_force-cursor", !!s);
|
|
105
|
+
const g = this.fn.getResizeCursor(s);
|
|
106
|
+
a.style.getPropertyValue("--force-cursor") !== g && a.style.setProperty("--force-cursor", g);
|
|
107
|
+
}
|
|
108
|
+
//
|
|
109
|
+
getNextLayout() {
|
|
110
|
+
const e = this.getBreakpoint(), t = this.layouts.get(e.name);
|
|
111
|
+
if (!t)
|
|
112
|
+
return [];
|
|
113
|
+
if (!this.dragging)
|
|
114
|
+
return t;
|
|
115
|
+
const n = this.dragEndX - this.dragStartX, s = this.dragEndY - this.dragStartY, g = this.fn.getColumnWidth(this.containerWidth, e.columns, e.columnGap) + e.columnGap, u = e.rowHeight + e.rowGap, f = R(n / g), p = R(s / u);
|
|
116
|
+
if (f === 0 && p === 0)
|
|
117
|
+
return t;
|
|
118
|
+
let i = this.manipulationCache.get(t);
|
|
119
|
+
i || (i = /* @__PURE__ */ new Map(), this.manipulationCache.set(t, i));
|
|
120
|
+
const l = `${Array.from(this.selection).join(",")}@${f},${p}@${this.resizeHandle}`, o = i.get(l);
|
|
121
|
+
if (o)
|
|
122
|
+
return o;
|
|
123
|
+
const r = this.resizeHandle ? this.fn.resizeItems(t, e.columns, this.selection, f, p, this.resizeHandle) : this.fn.moveItems(t, e.columns, this.selection, f, p);
|
|
124
|
+
return i.set(l, r), r;
|
|
125
|
+
}
|
|
126
|
+
//
|
|
127
|
+
handleResize() {
|
|
128
|
+
this.containerWidth = this.container.offsetWidth, this.layoutFlag = !0, this.requestRender();
|
|
129
|
+
}
|
|
130
|
+
handleMouseDown(e) {
|
|
131
|
+
if (this.editable === !1 || e.pointerType !== "mouse" || e.button !== 0)
|
|
132
|
+
return;
|
|
133
|
+
this.dragStartTime = Date.now(), this.dragStartX = this.dragEndX = e.pageX, this.dragStartY = this.dragEndY = e.pageY;
|
|
134
|
+
const t = this.getTargetElement(e);
|
|
135
|
+
t && (this.resizeHandle = this.checkResizeHandle(t, e), this.dragKey = t.dataset.key);
|
|
136
|
+
}
|
|
137
|
+
handleMouseMove(e) {
|
|
138
|
+
if (this.editable !== !1 && e.pointerType === "mouse") {
|
|
139
|
+
if (this.dragEndX = e.pageX, this.dragEndY = e.pageY, this.metaFlag = !0, this.requestRender(), !this.dragKey) {
|
|
140
|
+
const t = this.getTargetElement(e);
|
|
141
|
+
this.resizeHandle = t ? this.checkResizeHandle(t, e) : void 0;
|
|
142
|
+
}
|
|
143
|
+
!this.dragging && this.dragKey && (I(this.dragEndX - this.dragStartX) > this.fn.DRAG_THRESHOLD || I(this.dragEndY - this.dragStartY) > this.fn.DRAG_THRESHOLD) && (this.dragging = !0, (!this.selection.has(this.dragKey) || this.resizeHandle) && this.setSelection(new Set(this.dragKey)));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
handleMouseUp(e) {
|
|
147
|
+
this.editable !== !1 && (e.pointerType !== "mouse" || e.button !== 0 || (this.setLayout(this.getNextLayout()), this.resetDrag()));
|
|
148
|
+
}
|
|
149
|
+
handlePointerDown(e) {
|
|
150
|
+
if (this.editable === !1 || e.pointerType === "mouse" || this.dragPointerId)
|
|
151
|
+
return;
|
|
152
|
+
this.dragPointerId = e.pointerId, this.dragStartTime = Date.now(), this.dragStartX = this.dragEndX = e.pageX, this.dragStartY = this.dragEndY = e.pageY;
|
|
153
|
+
const t = this.getTargetElement(e);
|
|
154
|
+
t?.dataset.key && this.selection.has(t.dataset.key) && (this.dragging = !0, this.resizeHandle = this.checkResizeHandle(t, e), this.requestRender());
|
|
155
|
+
}
|
|
156
|
+
handlePointerMove(e) {
|
|
157
|
+
this.editable !== !1 && e.pointerType !== "mouse" && e.pointerId === this.dragPointerId && (this.dragEndX = e.pageX, this.dragEndY = e.pageY, this.metaFlag = !0, this.requestRender());
|
|
158
|
+
}
|
|
159
|
+
handlePointerUp(e) {
|
|
160
|
+
if (this.editable !== !1 && e.pointerType !== "mouse" && e.pointerId === this.dragPointerId) {
|
|
161
|
+
if (this.dragStartTime > Date.now() - this.fn.TAP_DELAY && I(this.dragEndX - this.dragStartX) < this.fn.TAP_THRESHOLD && I(this.dragEndY - this.dragStartY) < this.fn.TAP_THRESHOLD) {
|
|
162
|
+
const t = this.getTargetElement(e);
|
|
163
|
+
t?.dataset.key ? this.toggleSelection(t.dataset.key, !0) : this.clearSelection();
|
|
164
|
+
} else
|
|
165
|
+
this.setLayout(this.getNextLayout());
|
|
166
|
+
this.resetDrag();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
handleClick(e) {
|
|
170
|
+
if (this.editable !== !1)
|
|
171
|
+
if (this.preventClick)
|
|
172
|
+
this.preventClick = !1, e.preventDefault(), e.stopImmediatePropagation();
|
|
173
|
+
else {
|
|
174
|
+
!e.ctrlKey && !e.metaKey && this.clearSelection();
|
|
175
|
+
const t = this.getTargetElement(e);
|
|
176
|
+
t?.dataset.key && this.toggleSelection(t.dataset.key);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
handleKeyUp(e) {
|
|
180
|
+
if (this.editable !== !1)
|
|
181
|
+
switch (e.key) {
|
|
182
|
+
case "Escape":
|
|
183
|
+
this.layoutFlag = !0, this.clearSelection(), this.resetDrag();
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
resetDrag() {
|
|
188
|
+
if (this.dragging) {
|
|
189
|
+
try {
|
|
190
|
+
const e = (document.defaultView || window).getSelection();
|
|
191
|
+
e && e.type !== "Caret" && e.removeAllRanges();
|
|
192
|
+
} catch {
|
|
193
|
+
}
|
|
194
|
+
this.preventClick = !0;
|
|
195
|
+
}
|
|
196
|
+
this.dragPointerId = 0, this.dragging = !1, this.dragKey = void 0, this.resizeHandle = void 0, this.metaFlag = !0, this.requestRender();
|
|
197
|
+
}
|
|
198
|
+
getTargetElement(e) {
|
|
199
|
+
if (e.target instanceof Element) {
|
|
200
|
+
const t = e.target.closest(".fast-grid-layout > .item");
|
|
201
|
+
if (t) {
|
|
202
|
+
if (t.classList.contains("-static"))
|
|
203
|
+
return;
|
|
204
|
+
if (t.classList.contains("-selected") || !e.target.closest(".fast-grid-layout .content, button, input, textarea, select"))
|
|
205
|
+
return t;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
checkResizeHandle(e, t) {
|
|
210
|
+
const n = this.fn.checkResizeHandle(e.getBoundingClientRect(), t.clientX, t.clientY, this.fn.RESIZE_THRESHOLD);
|
|
211
|
+
switch (n) {
|
|
212
|
+
case "n":
|
|
213
|
+
case "ne":
|
|
214
|
+
case "nw":
|
|
215
|
+
return;
|
|
216
|
+
default:
|
|
217
|
+
return n;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
//
|
|
221
|
+
disconnect() {
|
|
222
|
+
this.selection = /* @__PURE__ */ new Set(), this.resetDrag(), this.renderSelection(), this.renderMeta(), this.resizeObserver.unobserve(this.container), this.removeEventListeners();
|
|
223
|
+
}
|
|
224
|
+
addEventListeners() {
|
|
225
|
+
this.container.addEventListener("pointerdown", this._handleMouseDown), window.addEventListener("pointermove", this._handleMouseMove, U), window.addEventListener("pointerup", this._handleMouseUp), window.addEventListener("pointercancel", this._handleMouseUp), this.container.addEventListener("pointerdown", this._handlePointerDown), window.addEventListener("pointermove", this._handlePointerMove, U), window.addEventListener("pointerup", this._handlePointerUp), window.addEventListener("pointercancel", this._handlePointerUp), window.addEventListener("click", this._handleClick, W), window.addEventListener("keyup", this._handleKeyUp);
|
|
226
|
+
}
|
|
227
|
+
removeEventListeners() {
|
|
228
|
+
this.container.removeEventListener("pointerdown", this._handleMouseDown), window.removeEventListener("pointermove", this._handleMouseMove), window.removeEventListener("pointerup", this._handleMouseUp), window.removeEventListener("pointercancel", this._handleMouseUp), this.container.removeEventListener("pointerdown", this._handlePointerDown), window.removeEventListener("pointermove", this._handlePointerMove), window.removeEventListener("pointerup", this._handlePointerUp), window.removeEventListener("pointercancel", this._handlePointerUp), window.removeEventListener("click", this._handleClick, W), window.removeEventListener("keyup", this._handleKeyUp);
|
|
229
|
+
}
|
|
230
|
+
static compileBreakpoints(e) {
|
|
231
|
+
var t, n, s, a, g, u, f;
|
|
232
|
+
const l = Object.entries((t = e.breakpoints) !== null && t !== void 0 ? t : {}).map(([o, r]) => {
|
|
233
|
+
var m, d, h, c, y, v, k, w, _, b, S, A;
|
|
234
|
+
return {
|
|
235
|
+
name: o,
|
|
236
|
+
maxWidth: r.maxWidth,
|
|
237
|
+
columns: (d = (m = r.columns) !== null && m !== void 0 ? m : e.columns) !== null && d !== void 0 ? d : 12,
|
|
238
|
+
rowHeight: (c = (h = r.rowHeight) !== null && h !== void 0 ? h : e.rowHeight) !== null && c !== void 0 ? c : 30,
|
|
239
|
+
rowGap: (w = (k = (v = (y = r.rowGap) !== null && y !== void 0 ? y : r.gap) !== null && v !== void 0 ? v : e.rowGap) !== null && k !== void 0 ? k : e.gap) !== null && w !== void 0 ? w : 0,
|
|
240
|
+
columnGap: (A = (S = (b = (_ = r.columnGap) !== null && _ !== void 0 ? _ : r.gap) !== null && b !== void 0 ? b : e.columnGap) !== null && S !== void 0 ? S : e.gap) !== null && A !== void 0 ? A : 0
|
|
241
|
+
};
|
|
242
|
+
}).sort((o, r) => o.maxWidth - r.maxWidth);
|
|
243
|
+
return l.push({
|
|
244
|
+
name: "default",
|
|
245
|
+
maxWidth: 1 / 0,
|
|
246
|
+
columns: (n = e.columns) !== null && n !== void 0 ? n : 12,
|
|
247
|
+
rowHeight: (s = e.rowHeight) !== null && s !== void 0 ? s : 30,
|
|
248
|
+
rowGap: (g = (a = e.rowGap) !== null && a !== void 0 ? a : e.gap) !== null && g !== void 0 ? g : 0,
|
|
249
|
+
columnGap: (f = (u = e.columnGap) !== null && u !== void 0 ? u : e.gap) !== null && f !== void 0 ? f : 0
|
|
250
|
+
}), l;
|
|
251
|
+
}
|
|
252
|
+
static renderLayout(e, t, n) {
|
|
253
|
+
const { columns: s, columnGap: a, rowGap: g, rowHeight: u } = n, f = e.offsetWidth, i = this.getColumnWidth(f, s, a) + a, l = u + g;
|
|
254
|
+
e.classList.add("fast-grid-layout");
|
|
255
|
+
const o = /* @__PURE__ */ new Map();
|
|
256
|
+
for (let d = 0, h = t.length; d < h; ++d) {
|
|
257
|
+
const c = t[d];
|
|
258
|
+
o.set(c.i, c);
|
|
259
|
+
}
|
|
260
|
+
let r = 0;
|
|
261
|
+
for (let d = 0, h = e.children.length; d < h; ++d) {
|
|
262
|
+
const c = e.children[d];
|
|
263
|
+
if (!(c instanceof HTMLElement))
|
|
264
|
+
continue;
|
|
265
|
+
c.dataset.key || (c.dataset.key = d.toString());
|
|
266
|
+
const y = c.dataset.key, v = o.get(y);
|
|
267
|
+
if (!v)
|
|
268
|
+
continue;
|
|
269
|
+
c.classList.add("item"), c.classList.toggle("-dynamic", !v.static), c.classList.toggle("-static", !!v.static);
|
|
270
|
+
const k = v.y + v.h;
|
|
271
|
+
k > r && (r = k);
|
|
272
|
+
const w = R(v.w * i - a) + "px", _ = R(v.h * l - g) + "px", b = "translate(" + R(v.x * i) + "px, " + R(v.y * l) + "px)";
|
|
273
|
+
c.style.width !== w && (c.style.width = w), c.style.height !== _ && (c.style.height = _), c.style.transform !== b && (c.style.transform = b);
|
|
274
|
+
}
|
|
275
|
+
const m = R(r * l - g) + "px";
|
|
276
|
+
e.style.height !== m && (e.style.height = m);
|
|
277
|
+
}
|
|
278
|
+
static getColumnWidth(e, t, n) {
|
|
279
|
+
return (e - (t - 1) * n) / t;
|
|
280
|
+
}
|
|
281
|
+
static checkResizeHandle(e, t, n, s) {
|
|
282
|
+
const a = n - e.top < s, g = e.right - t < s, u = e.bottom - n < s, f = t - e.left < s;
|
|
283
|
+
if (u)
|
|
284
|
+
return g ? "se" : f ? "sw" : "s";
|
|
285
|
+
if (g)
|
|
286
|
+
return a ? "ne" : "e";
|
|
287
|
+
if (f)
|
|
288
|
+
return a ? "nw" : "w";
|
|
289
|
+
if (a)
|
|
290
|
+
return "n";
|
|
291
|
+
}
|
|
292
|
+
static getResizeCursor(e) {
|
|
293
|
+
switch (e) {
|
|
294
|
+
case "n":
|
|
295
|
+
case "s":
|
|
296
|
+
return "ns-resize";
|
|
297
|
+
case "e":
|
|
298
|
+
case "w":
|
|
299
|
+
return "ew-resize";
|
|
300
|
+
case "ne":
|
|
301
|
+
case "sw":
|
|
302
|
+
return "nesw-resize";
|
|
303
|
+
case "se":
|
|
304
|
+
case "nw":
|
|
305
|
+
return "nwse-resize";
|
|
306
|
+
default:
|
|
307
|
+
return "";
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Moves the specified items (in grid units).
|
|
312
|
+
* Returns a new layout if modified.
|
|
313
|
+
*/
|
|
314
|
+
static moveItems(e, t, n, s, a) {
|
|
315
|
+
if (s === 0 && a === 0 || n.size === 0)
|
|
316
|
+
return e;
|
|
317
|
+
let g = e;
|
|
318
|
+
for (let u = 0, f = e.length; u < f; ++u) {
|
|
319
|
+
const p = e[u];
|
|
320
|
+
if (n.has(p.i)) {
|
|
321
|
+
const i = p.x + s, l = p.y + a;
|
|
322
|
+
(p.x !== i || p.y !== l) && (g === e && (g = e.slice(0)), g[u] = Object.assign(Object.assign({}, p), { x: i, y: l }));
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return g === e ? e : this.repairLayout(g, t, n);
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Resizes the specified item (in grid units).
|
|
329
|
+
* Returns a new layout if modified.
|
|
330
|
+
*/
|
|
331
|
+
static resizeItems(e, t, n, s, a, g) {
|
|
332
|
+
if (s === 0 && a === 0 || n.size === 0)
|
|
333
|
+
return e;
|
|
334
|
+
let u = e;
|
|
335
|
+
for (let f = 0, p = e.length; f < p; ++f) {
|
|
336
|
+
const i = e[f];
|
|
337
|
+
if (n.has(i.i)) {
|
|
338
|
+
const { maxW: l = t, maxH: o = 1 / 0 } = i;
|
|
339
|
+
let { x: r, y: m, w: d, h } = i;
|
|
340
|
+
const c = r + d, y = m + h, v = t - r;
|
|
341
|
+
switch (g) {
|
|
342
|
+
case "n":
|
|
343
|
+
h = L(h - a, 1, o), m = L(m + a, 0, y - 1);
|
|
344
|
+
break;
|
|
345
|
+
case "e":
|
|
346
|
+
d = L(d + s, 1, x(l, v));
|
|
347
|
+
break;
|
|
348
|
+
case "s":
|
|
349
|
+
h = L(h + a, 1, o);
|
|
350
|
+
break;
|
|
351
|
+
case "w":
|
|
352
|
+
d = L(d - s, 1, x(l, c)), r = L(r + s, 0, c - 1);
|
|
353
|
+
break;
|
|
354
|
+
case "ne":
|
|
355
|
+
d = L(d + s, 1, x(l, v)), h = L(h - a, 1, o), m = L(m + a, 0, y - 1);
|
|
356
|
+
break;
|
|
357
|
+
case "se":
|
|
358
|
+
d = L(d + s, 1, x(l, v)), h = L(h + a, 1, o);
|
|
359
|
+
break;
|
|
360
|
+
case "sw":
|
|
361
|
+
d = L(d - s, 1, x(l, c)), h = L(h + a, 1, o), r = L(r + s, 0, c - 1);
|
|
362
|
+
break;
|
|
363
|
+
case "nw":
|
|
364
|
+
d = L(d - s, 1, x(l, c)), h = L(h - a, 1, o), r = L(r + s, 0, c - 1), m = L(m + a, 0, y - 1);
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
(i.x !== r || i.y !== m || i.w !== d || i.h !== h) && (u === e && (u = e.slice(0)), u[f] = Object.assign(Object.assign({}, i), { x: r, y: m, w: d, h }));
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return u === e ? e : this.repairLayout(u, t, n);
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Fixes overlaps, gaps, and layout out of bounds.
|
|
374
|
+
* Returns a new layout if there was anything to repair.
|
|
375
|
+
*/
|
|
376
|
+
static repairLayout(e, t, n) {
|
|
377
|
+
const s = e.slice(0).sort((i, l) => {
|
|
378
|
+
if (i.y < l.y)
|
|
379
|
+
return -1;
|
|
380
|
+
if (i.y > l.y)
|
|
381
|
+
return 1;
|
|
382
|
+
if (n) {
|
|
383
|
+
if (n.has(i.i)) {
|
|
384
|
+
if (!n.has(l.i))
|
|
385
|
+
return -1;
|
|
386
|
+
} else if (n.has(l.i))
|
|
387
|
+
return 1;
|
|
388
|
+
}
|
|
389
|
+
return i.x < l.x ? -1 : i.x > l.x ? 1 : 0;
|
|
390
|
+
}), a = s.filter((i) => i.static), g = a.length;
|
|
391
|
+
let u = !1, f = 0;
|
|
392
|
+
const p = Array(t);
|
|
393
|
+
for (let i = 0; i < t; ++i)
|
|
394
|
+
p[i] = 0;
|
|
395
|
+
for (let i = 0, l = s.length; i < l; i++) {
|
|
396
|
+
let o = this.repairItem(s[i], t);
|
|
397
|
+
const r = o.x + o.w;
|
|
398
|
+
if (o.static)
|
|
399
|
+
++f;
|
|
400
|
+
else {
|
|
401
|
+
let d = 1 / 0;
|
|
402
|
+
for (let c = o.x; c < r; ++c) {
|
|
403
|
+
const y = o.y - p[c];
|
|
404
|
+
y < d && (d = y);
|
|
405
|
+
}
|
|
406
|
+
let h = o.y - d;
|
|
407
|
+
for (let c = f; c < g; ++c) {
|
|
408
|
+
const y = a[c];
|
|
409
|
+
if (y.y >= h + o.h)
|
|
410
|
+
break;
|
|
411
|
+
//staticItem.y < yNext + item.h && // This is implied above.
|
|
412
|
+
y.y + y.h > h && y.x < o.x + o.w && y.x + y.w > o.x && (h = y.y + y.h, c = f);
|
|
413
|
+
}
|
|
414
|
+
o.y !== h && (o = Object.assign(Object.assign({}, o), { y: h })), o !== s[i] && (s[i] = o, u = !0);
|
|
415
|
+
}
|
|
416
|
+
const m = o.y + o.h;
|
|
417
|
+
for (let d = o.x; d < r; ++d)
|
|
418
|
+
p[d] < m && (p[d] = m);
|
|
419
|
+
}
|
|
420
|
+
return u ? s : e;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Repair bounds of the given item to fit the given config.
|
|
424
|
+
* Returns a new item if there was anything to repair.
|
|
425
|
+
*/
|
|
426
|
+
static repairItem(e, t) {
|
|
427
|
+
const { minW: n = 1, maxW: s = t, minH: a = 1, maxH: g = 1 / 0 } = e;
|
|
428
|
+
let { x: u, y: f, w: p, h: i } = e;
|
|
429
|
+
return p = L(p, n, x(s, t)), i = L(i, a, g), u = L(u, 0, t - p), f < 0 && (f = 0), e.x === u && e.y === f && e.w === p && e.h === i ? e : Object.assign(Object.assign({}, e), { x: u, y: f, w: p, h: i });
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
T.RESIZE_THRESHOLD = 10;
|
|
433
|
+
T.TAP_DELAY = 250;
|
|
434
|
+
T.TAP_THRESHOLD = 10;
|
|
435
|
+
T.DRAG_THRESHOLD = 7;
|
|
436
|
+
function ee(E, e) {
|
|
437
|
+
if (E === e)
|
|
438
|
+
return !0;
|
|
439
|
+
if (E.size !== e.size)
|
|
440
|
+
return !1;
|
|
441
|
+
for (const t of E)
|
|
442
|
+
if (!e.has(t))
|
|
443
|
+
return !1;
|
|
444
|
+
return !0;
|
|
445
|
+
}
|
|
446
|
+
function L(E, e, t) {
|
|
447
|
+
return E < e ? e : E > t ? t : E;
|
|
448
|
+
}
|
|
449
|
+
const I = Math.abs, x = Math.min, R = Math.round, W = { capture: !0 }, U = { passive: !0 };
|
|
450
|
+
function te(E) {
|
|
451
|
+
const {
|
|
452
|
+
layout: e,
|
|
453
|
+
onChange: t,
|
|
454
|
+
totalColumns: n = 12,
|
|
455
|
+
gap: s = 0,
|
|
456
|
+
rowHeight: a = 120,
|
|
457
|
+
children: g
|
|
458
|
+
} = E, u = z(() => ({
|
|
459
|
+
columns: n,
|
|
460
|
+
gap: s,
|
|
461
|
+
rowHeight: a
|
|
462
|
+
}), [n, s, a]), f = O(null), p = O(null);
|
|
463
|
+
return D(() => {
|
|
464
|
+
if (!f.current)
|
|
465
|
+
return;
|
|
466
|
+
const i = new T(f.current, u);
|
|
467
|
+
return i.setEditable(!0), i.setLayout(e), i.onLayoutChange(t), p.current = i, () => {
|
|
468
|
+
i.disconnect();
|
|
469
|
+
};
|
|
470
|
+
}, []), D(() => {
|
|
471
|
+
p.current?.setConfig(u);
|
|
472
|
+
}, [u]), D(() => {
|
|
473
|
+
const i = p.current;
|
|
474
|
+
i?.onLayoutChange(() => {
|
|
475
|
+
}), i?.setLayout(e), i?.onLayoutChange(t);
|
|
476
|
+
}, [e, t]), /* @__PURE__ */ C("div", { ref: f, children: g });
|
|
477
|
+
}
|
|
478
|
+
const ie = 12;
|
|
479
|
+
function ne(E) {
|
|
480
|
+
const {
|
|
481
|
+
layoutDefinitions: e,
|
|
482
|
+
onRender: t,
|
|
483
|
+
onChange: n,
|
|
484
|
+
layoutItemStyle: s = {},
|
|
485
|
+
totalColumns: a = ie,
|
|
486
|
+
gap: g
|
|
487
|
+
} = E, u = z(() => e.map((i) => {
|
|
488
|
+
const { id: l, props: o } = i, r = t(l, o);
|
|
489
|
+
return /* @__PURE__ */ C(
|
|
490
|
+
"div",
|
|
491
|
+
{
|
|
492
|
+
"data-key": l,
|
|
493
|
+
style: {
|
|
494
|
+
overflow: "scroll",
|
|
495
|
+
...s
|
|
496
|
+
},
|
|
497
|
+
children: r
|
|
77
498
|
},
|
|
78
|
-
|
|
499
|
+
l
|
|
500
|
+
);
|
|
501
|
+
}), [e, s, t]), f = z(() => e.map((i) => {
|
|
502
|
+
const {
|
|
503
|
+
id: l,
|
|
504
|
+
props: o,
|
|
505
|
+
...r
|
|
506
|
+
} = i;
|
|
507
|
+
return {
|
|
508
|
+
i: l,
|
|
509
|
+
...r
|
|
510
|
+
};
|
|
511
|
+
}), [e]), p = G((i) => {
|
|
512
|
+
const l = i.map((o) => {
|
|
513
|
+
const {
|
|
514
|
+
i: r,
|
|
515
|
+
...m
|
|
516
|
+
} = o, d = e.find((h) => h.id === r);
|
|
517
|
+
if (!d)
|
|
518
|
+
throw new Error(`No existing cell definition found for layout item with id ${r}`);
|
|
519
|
+
return {
|
|
520
|
+
id: r,
|
|
521
|
+
...m,
|
|
522
|
+
props: d.props
|
|
523
|
+
};
|
|
524
|
+
});
|
|
525
|
+
n(l);
|
|
526
|
+
}, [e, n]);
|
|
527
|
+
return /* @__PURE__ */ C(
|
|
528
|
+
te,
|
|
529
|
+
{
|
|
530
|
+
totalColumns: a,
|
|
531
|
+
gap: g,
|
|
532
|
+
layout: f,
|
|
533
|
+
onChange: p,
|
|
534
|
+
children: u
|
|
79
535
|
}
|
|
80
536
|
);
|
|
81
537
|
}
|
|
82
|
-
const
|
|
83
|
-
rowSpan: 4,
|
|
84
|
-
columnSpan: 12
|
|
85
|
-
}, u = "har-entries-viewer", S = "view-har-entry", x = [
|
|
538
|
+
const F = "list-har-entries", M = 12, se = [
|
|
86
539
|
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
540
|
+
x: 0,
|
|
541
|
+
y: 0,
|
|
542
|
+
w: 12,
|
|
543
|
+
h: 4,
|
|
544
|
+
id: "0",
|
|
545
|
+
props: {
|
|
546
|
+
instanceId: F
|
|
92
547
|
}
|
|
93
548
|
}
|
|
94
549
|
];
|
|
95
|
-
function
|
|
550
|
+
function fe(E) {
|
|
96
551
|
const {
|
|
97
|
-
harEntries:
|
|
98
|
-
tableTitle:
|
|
99
|
-
} =
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
if (!
|
|
104
|
-
return
|
|
105
|
-
const
|
|
106
|
-
(
|
|
552
|
+
harEntries: e,
|
|
553
|
+
tableTitle: t
|
|
554
|
+
} = E, [n, s] = P([]), [a, g] = P(se), [u, f] = P($);
|
|
555
|
+
D(() => {
|
|
556
|
+
const i = new Set(e.map(H));
|
|
557
|
+
s((l) => {
|
|
558
|
+
if (!l.length)
|
|
559
|
+
return l;
|
|
560
|
+
const o = l.filter(
|
|
561
|
+
(r) => i.has(H(r))
|
|
107
562
|
);
|
|
108
|
-
return
|
|
563
|
+
return o.length === l.length ? l : o;
|
|
109
564
|
});
|
|
110
|
-
}, [
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
565
|
+
}, [e]), D(() => {
|
|
566
|
+
const i = n.map(H), l = new Set(i);
|
|
567
|
+
g((o) => {
|
|
568
|
+
let r = o.filter(({ props: { instanceId: w } }) => l.has(w) || w === F);
|
|
569
|
+
const m = new Set(r.map(({ props: { instanceId: w } }) => w)), d = i.filter((w) => !m.has(w));
|
|
570
|
+
if (!d.length)
|
|
571
|
+
return r;
|
|
572
|
+
let h = {
|
|
573
|
+
x: 0,
|
|
574
|
+
y: 0,
|
|
575
|
+
w: 6,
|
|
576
|
+
h: 4
|
|
577
|
+
};
|
|
578
|
+
const c = o.at(-1), y = r.at(-1);
|
|
579
|
+
if (c && (h = {
|
|
580
|
+
x: c.x,
|
|
581
|
+
y: c.y,
|
|
582
|
+
w: c.w,
|
|
583
|
+
h: c.h
|
|
584
|
+
}), y && c?.props.instanceId === y.props.instanceId && (h.x = h.x + h.w), o.length === 1 && r.length === 1) {
|
|
585
|
+
const w = r[0], _ = w.x + w.w;
|
|
586
|
+
let b = M - _, S = w.x + b;
|
|
587
|
+
b || (b = M / 2, S = b, r = [
|
|
588
|
+
{
|
|
589
|
+
...w,
|
|
590
|
+
x: 0,
|
|
591
|
+
y: 0,
|
|
592
|
+
w: b
|
|
593
|
+
}
|
|
594
|
+
]), h = {
|
|
595
|
+
x: S,
|
|
596
|
+
y: 0,
|
|
597
|
+
w: b,
|
|
598
|
+
h: w.h
|
|
131
599
|
};
|
|
132
|
-
}
|
|
600
|
+
}
|
|
601
|
+
const v = d.map((w) => {
|
|
602
|
+
h.x >= M && (h.x = 0, h.y += h.h);
|
|
603
|
+
const _ = {
|
|
604
|
+
w: h.w,
|
|
605
|
+
h: h.h,
|
|
606
|
+
x: h.x,
|
|
607
|
+
y: h.y,
|
|
608
|
+
props: {
|
|
609
|
+
instanceId: w
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
return h.x = h.x + h.w, _;
|
|
613
|
+
}), k = [...r, ...v].map((w, _) => ({
|
|
614
|
+
...w,
|
|
615
|
+
id: String(_)
|
|
616
|
+
}));
|
|
617
|
+
return console.warn({ layoutDefinitions: k }), k;
|
|
133
618
|
});
|
|
134
|
-
}, [])
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
619
|
+
}, [n]);
|
|
620
|
+
const p = G((i, { instanceId: l }) => {
|
|
621
|
+
if (l === F)
|
|
622
|
+
return /* @__PURE__ */ C(Q, { children: /* @__PURE__ */ C(
|
|
623
|
+
X,
|
|
138
624
|
{
|
|
139
|
-
title:
|
|
140
|
-
harEntries:
|
|
141
|
-
selectedHAREntries:
|
|
142
|
-
onSelectionChange:
|
|
625
|
+
title: t,
|
|
626
|
+
harEntries: e,
|
|
627
|
+
selectedHAREntries: n,
|
|
628
|
+
onSelectionChange: s
|
|
143
629
|
}
|
|
144
|
-
) })
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
630
|
+
) });
|
|
631
|
+
const o = n.find((r) => H(r) === l);
|
|
632
|
+
if (o)
|
|
633
|
+
return /* @__PURE__ */ q(j, { children: [
|
|
634
|
+
/* @__PURE__ */ C(
|
|
635
|
+
J,
|
|
636
|
+
{
|
|
637
|
+
onClose: () => {
|
|
638
|
+
s((r) => r.filter((m) => H(m) !== l));
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
),
|
|
642
|
+
/* @__PURE__ */ C(
|
|
643
|
+
Z,
|
|
644
|
+
{
|
|
645
|
+
harEntry: o,
|
|
646
|
+
initialSelectedTabId: u,
|
|
647
|
+
onSelectedTabIdChange: n.length === 1 ? f : void 0
|
|
648
|
+
}
|
|
649
|
+
)
|
|
650
|
+
] });
|
|
651
|
+
}, [n, t, e, u]);
|
|
652
|
+
return /* @__PURE__ */ C(
|
|
653
|
+
ne,
|
|
160
654
|
{
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
655
|
+
totalColumns: M,
|
|
656
|
+
gap: 16,
|
|
657
|
+
layoutItemStyle: {
|
|
658
|
+
borderRadius: Y,
|
|
659
|
+
borderWidth: K,
|
|
660
|
+
borderColor: B,
|
|
661
|
+
borderStyle: "solid"
|
|
662
|
+
},
|
|
663
|
+
layoutDefinitions: a,
|
|
664
|
+
onRender: p,
|
|
665
|
+
onChange: g
|
|
164
666
|
}
|
|
165
667
|
);
|
|
166
668
|
}
|
|
167
669
|
export {
|
|
168
|
-
|
|
670
|
+
fe as default
|
|
169
671
|
};
|