schummar-table 0.46.9 → 0.47.2
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/chunk-CTAAG5j7.js +13 -0
- package/dist/chunk-pbleEpgJ.cjs +44 -0
- package/dist/csvExporter-BGoiph1b.cjs +41 -0
- package/dist/csvExporter-BGoiph1b.cjs.map +1 -0
- package/dist/csvExporter-DRm4V8We.js +35 -0
- package/dist/csvExporter-DRm4V8We.js.map +1 -0
- package/dist/csvExporter.cjs +2 -78
- package/dist/csvExporter.d.cts +15 -13
- package/dist/csvExporter.d.ts +15 -13
- package/dist/csvExporter.js +3 -8
- package/dist/excelExporter.cjs +18 -38
- package/dist/excelExporter.cjs.map +1 -1
- package/dist/excelExporter.d.cts +7 -6
- package/dist/excelExporter.d.ts +7 -5
- package/dist/excelExporter.js +16 -19
- package/dist/excelExporter.js.map +1 -1
- package/dist/exporter-BxgFAyWA.d.ts +24 -0
- package/dist/exporter-ztSF5GbY.d.cts +24 -0
- package/dist/index.cjs +3422 -5328
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +207 -168
- package/dist/index.d.ts +205 -168
- package/dist/index.js +3378 -4413
- package/dist/index.js.map +1 -1
- package/dist/mui4Theme.cjs +62 -905
- package/dist/mui4Theme.cjs.map +1 -1
- package/dist/mui4Theme.d.cts +14 -10
- package/dist/mui4Theme.d.ts +14 -10
- package/dist/mui4Theme.js +54 -77
- package/dist/mui4Theme.js.map +1 -1
- package/dist/mui5Theme.cjs +62 -901
- package/dist/mui5Theme.cjs.map +1 -1
- package/dist/mui5Theme.d.cts +14 -10
- package/dist/mui5Theme.d.ts +14 -10
- package/dist/mui5Theme.js +57 -76
- package/dist/mui5Theme.js.map +1 -1
- package/dist/tableSettings-BxCzVAiu.cjs +740 -0
- package/dist/tableSettings-BxCzVAiu.cjs.map +1 -0
- package/dist/tableSettings-C5bAcuVw.js +675 -0
- package/dist/tableSettings-C5bAcuVw.js.map +1 -0
- package/dist/types-CemO-cBr.d.ts +433 -0
- package/dist/types-lBtXAU-l.d.cts +433 -0
- package/package.json +30 -70
- package/dist/chunk-EEBUKP6F.js +0 -64
- package/dist/chunk-EEBUKP6F.js.map +0 -1
- package/dist/chunk-NTYYITKA.js +0 -803
- package/dist/chunk-NTYYITKA.js.map +0 -1
- package/dist/chunk-WFCJ3D3G.js +0 -47
- package/dist/chunk-WFCJ3D3G.js.map +0 -1
- package/dist/csvExporter.cjs.map +0 -1
- package/dist/csvExporter.js.map +0 -1
- package/dist/exporter-u6SatTo6.d.cts +0 -22
- package/dist/exporter-u6SatTo6.d.ts +0 -22
- package/dist/types-CADdapzE.d.cts +0 -437
- package/dist/types-DNdXIGcn.d.ts +0 -437
|
@@ -0,0 +1,675 @@
|
|
|
1
|
+
import { CsvExporter } from "./csvExporter-DRm4V8We.js";
|
|
2
|
+
import React, { createContext, useCallback, useContext, useDebugValue, useEffect, useLayoutEffect, useMemo, useRef } from "react";
|
|
3
|
+
import { applyPatches, enableMapSet, enablePatches, freeze, produce } from "immer";
|
|
4
|
+
import { css } from "@emotion/react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
6
|
+
import { createPortal } from "react-dom";
|
|
7
|
+
|
|
8
|
+
//#region node_modules/schummar-state/dist/es/store.js
|
|
9
|
+
var react = function equal(a, b) {
|
|
10
|
+
if (a === b) return true;
|
|
11
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
12
|
+
if (a.constructor !== b.constructor) return false;
|
|
13
|
+
var length, i, keys;
|
|
14
|
+
if (Array.isArray(a)) {
|
|
15
|
+
length = a.length;
|
|
16
|
+
if (length != b.length) return false;
|
|
17
|
+
for (i = length; i-- !== 0;) if (!equal(a[i], b[i])) return false;
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
if (a instanceof Map && b instanceof Map) {
|
|
21
|
+
if (a.size !== b.size) return false;
|
|
22
|
+
for (i of a.entries()) if (!b.has(i[0])) return false;
|
|
23
|
+
for (i of a.entries()) if (!equal(i[1], b.get(i[0]))) return false;
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
if (a instanceof Set && b instanceof Set) {
|
|
27
|
+
if (a.size !== b.size) return false;
|
|
28
|
+
for (i of a.entries()) if (!b.has(i[0])) return false;
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
|
32
|
+
length = a.length;
|
|
33
|
+
if (length != b.length) return false;
|
|
34
|
+
for (i = length; i-- !== 0;) if (a[i] !== b[i]) return false;
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
38
|
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
39
|
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
40
|
+
keys = Object.keys(a);
|
|
41
|
+
length = keys.length;
|
|
42
|
+
if (length !== Object.keys(b).length) return false;
|
|
43
|
+
for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
44
|
+
for (i = length; i-- !== 0;) {
|
|
45
|
+
var key = keys[i];
|
|
46
|
+
if (key === "_owner" && a.$$typeof) continue;
|
|
47
|
+
if (!equal(a[key], b[key])) return false;
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
return a !== a && b !== b;
|
|
52
|
+
};
|
|
53
|
+
function createSelector(stringSelector) {
|
|
54
|
+
const parts = stringSelector.split(".");
|
|
55
|
+
return (state) => parts.reduce((v$1, p$2) => v$1 instanceof Object && p$2 in v$1 ? v$1[p$2] : void 0, state);
|
|
56
|
+
}
|
|
57
|
+
function setWithSelector(state, stringSelector, value) {
|
|
58
|
+
const parts = stringSelector.split(".");
|
|
59
|
+
const prefix = parts.slice(0, -1);
|
|
60
|
+
const last = parts[parts.length - 1];
|
|
61
|
+
for (const part of prefix) if (state instanceof Object && part in state) state = state[part];
|
|
62
|
+
else throw Error(`Could not set ${stringSelector} because path ${stringSelector} doesn't exist`);
|
|
63
|
+
if (state instanceof Object) state[last] = value;
|
|
64
|
+
else throw Error(`Could not set ${stringSelector} because path ${stringSelector} doesn't exist`);
|
|
65
|
+
}
|
|
66
|
+
function throttle$1(fn, ms) {
|
|
67
|
+
let last = 0;
|
|
68
|
+
let lastArgs;
|
|
69
|
+
let timeout;
|
|
70
|
+
function run() {
|
|
71
|
+
const args = lastArgs;
|
|
72
|
+
last = Date.now();
|
|
73
|
+
lastArgs = void 0;
|
|
74
|
+
timeout = void 0;
|
|
75
|
+
fn(...args);
|
|
76
|
+
}
|
|
77
|
+
return function(...args) {
|
|
78
|
+
const now = Date.now();
|
|
79
|
+
lastArgs = args;
|
|
80
|
+
if (timeout);
|
|
81
|
+
else if (now < last + ms) timeout = setTimeout(run, last + ms - now);
|
|
82
|
+
else run();
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const RESTART_UPDATE = Symbol("RESTART_UPDATE");
|
|
86
|
+
var Store$1 = class {
|
|
87
|
+
constructor(state, { log = (...data) => console.error(...data) } = {}) {
|
|
88
|
+
this.state = state;
|
|
89
|
+
this.subscriptions = /* @__PURE__ */ new Set();
|
|
90
|
+
this.batchCounter = 0;
|
|
91
|
+
this.reactions = /* @__PURE__ */ new Set();
|
|
92
|
+
this.patches = new Array();
|
|
93
|
+
freeze(state, true);
|
|
94
|
+
enableMapSet();
|
|
95
|
+
enablePatches();
|
|
96
|
+
this.options = { log };
|
|
97
|
+
}
|
|
98
|
+
getState() {
|
|
99
|
+
return this.state;
|
|
100
|
+
}
|
|
101
|
+
update(update) {
|
|
102
|
+
this.checkLock();
|
|
103
|
+
this.state = produce(this.state, (draft) => update(draft, this.state), (patches) => this.patches.push(...patches));
|
|
104
|
+
this.notify();
|
|
105
|
+
}
|
|
106
|
+
set(state) {
|
|
107
|
+
this.checkLock();
|
|
108
|
+
this.state = produce(this.state, () => state, (patches) => this.patches.push(...patches));
|
|
109
|
+
this.notify();
|
|
110
|
+
}
|
|
111
|
+
applyPatches(patches) {
|
|
112
|
+
this.checkLock();
|
|
113
|
+
this.state = applyPatches(this.state, patches);
|
|
114
|
+
this.patches.push(...patches);
|
|
115
|
+
this.notify();
|
|
116
|
+
}
|
|
117
|
+
batchUpdates(fn) {
|
|
118
|
+
try {
|
|
119
|
+
this.batchCounter++;
|
|
120
|
+
fn();
|
|
121
|
+
} finally {
|
|
122
|
+
this.batchCounter--;
|
|
123
|
+
if (this.batchCounter === 0) this.notify();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
subscribe(...args) {
|
|
127
|
+
let selector, listener, options;
|
|
128
|
+
if (args[1] instanceof Function) {
|
|
129
|
+
[selector, listener, options] = args;
|
|
130
|
+
if (typeof selector === "string") selector = createSelector(selector);
|
|
131
|
+
} else [selector, listener, options] = [(x) => x, ...args];
|
|
132
|
+
const { runNow = true, throttle: throttle$1$1 = 0, compare = react } = options != null ? options : {};
|
|
133
|
+
const throttledListener = throttle$1$1 ? throttle$1(listener, throttle$1$1) : listener;
|
|
134
|
+
let value = selector(this.state);
|
|
135
|
+
const internalListener = (state, _patches, init) => {
|
|
136
|
+
try {
|
|
137
|
+
const oldValue = value;
|
|
138
|
+
value = selector(state);
|
|
139
|
+
if (!init && compare(value, oldValue)) return;
|
|
140
|
+
(init ? listener : throttledListener)(value, oldValue, this.state);
|
|
141
|
+
} catch (e$1) {
|
|
142
|
+
this.options.log("Failed to execute listener:", e$1);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
this.subscriptions.add(internalListener);
|
|
146
|
+
if (runNow) internalListener(this.state, [], true);
|
|
147
|
+
return () => {
|
|
148
|
+
this.subscriptions.delete(internalListener);
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
addReaction(...args) {
|
|
152
|
+
let selector, reaction, options;
|
|
153
|
+
if (args[1] instanceof Function) {
|
|
154
|
+
[selector, reaction, options] = args;
|
|
155
|
+
if (typeof selector === "string") selector = createSelector(selector);
|
|
156
|
+
} else [selector, reaction, options] = [(x) => x, ...args];
|
|
157
|
+
const { runNow = true, compare = react } = options != null ? options : {};
|
|
158
|
+
let value = selector(this.state);
|
|
159
|
+
const internalListener = (init) => {
|
|
160
|
+
let hasChanged = false;
|
|
161
|
+
try {
|
|
162
|
+
this.lock = "reaction";
|
|
163
|
+
const oldValue = value;
|
|
164
|
+
value = selector(this.state);
|
|
165
|
+
if (!init && compare(value, oldValue)) return;
|
|
166
|
+
this.state = produce(this.state, (draft) => reaction(value, draft, this.state, oldValue), (patches) => {
|
|
167
|
+
hasChanged = true;
|
|
168
|
+
this.patches.push(...patches);
|
|
169
|
+
});
|
|
170
|
+
} catch (e$1) {
|
|
171
|
+
this.options.log("Failed to execute reaction:", e$1);
|
|
172
|
+
} finally {
|
|
173
|
+
delete this.lock;
|
|
174
|
+
}
|
|
175
|
+
if (hasChanged && !init) throw RESTART_UPDATE;
|
|
176
|
+
if (hasChanged && init) this.notify();
|
|
177
|
+
};
|
|
178
|
+
this.reactions.add(internalListener);
|
|
179
|
+
if (runNow) internalListener(true);
|
|
180
|
+
return () => {
|
|
181
|
+
this.reactions.delete(internalListener);
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
subscribePatches(listener) {
|
|
185
|
+
const internalListener = (_state, patches) => {
|
|
186
|
+
try {
|
|
187
|
+
listener(patches);
|
|
188
|
+
} catch (e$1) {
|
|
189
|
+
this.options.log("Failed to execute patch listener:", e$1);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
this.subscriptions.add(internalListener);
|
|
193
|
+
return () => {
|
|
194
|
+
this.subscriptions.delete(internalListener);
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
checkLock() {
|
|
198
|
+
if (this.lock === "reaction") throw Error("You cannot call update from within a reaction. Use the passed draft instead.");
|
|
199
|
+
}
|
|
200
|
+
notify() {
|
|
201
|
+
if (this.batchCounter > 0 || this.patches.length === 0) return;
|
|
202
|
+
try {
|
|
203
|
+
for (const reaction of this.reactions) reaction();
|
|
204
|
+
} catch (e$1) {
|
|
205
|
+
return this.notify();
|
|
206
|
+
}
|
|
207
|
+
const patches = this.patches;
|
|
208
|
+
this.patches = [];
|
|
209
|
+
this.batchUpdates(() => {
|
|
210
|
+
for (const subscription of this.subscriptions) subscription(this.state, patches);
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region node_modules/schummar-state/dist/es/react.js
|
|
217
|
+
var __defProp = Object.defineProperty;
|
|
218
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
219
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
220
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
221
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
222
|
+
enumerable: true,
|
|
223
|
+
configurable: true,
|
|
224
|
+
writable: true,
|
|
225
|
+
value
|
|
226
|
+
}) : obj[key] = value;
|
|
227
|
+
var __spreadValues = (a2, b) => {
|
|
228
|
+
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a2, prop, b[prop]);
|
|
229
|
+
if (__getOwnPropSymbols) {
|
|
230
|
+
for (var prop of __getOwnPropSymbols(b)) if (__propIsEnum.call(b, prop)) __defNormalProp(a2, prop, b[prop]);
|
|
231
|
+
}
|
|
232
|
+
return a2;
|
|
233
|
+
};
|
|
234
|
+
var withSelector = { exports: {} };
|
|
235
|
+
var withSelector_production_min = {};
|
|
236
|
+
var shim = { exports: {} };
|
|
237
|
+
var useSyncExternalStoreShim_production_min = {};
|
|
238
|
+
/** @license React vundefined
|
|
239
|
+
* use-sync-external-store-shim.production.min.js
|
|
240
|
+
*
|
|
241
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
242
|
+
*
|
|
243
|
+
* This source code is licensed under the MIT license found in the
|
|
244
|
+
* LICENSE file in the root directory of this source tree.
|
|
245
|
+
*/
|
|
246
|
+
var e = React;
|
|
247
|
+
function h$1(a2, b) {
|
|
248
|
+
return a2 === b && (a2 !== 0 || 1 / a2 === 1 / b) || a2 !== a2 && b !== b;
|
|
249
|
+
}
|
|
250
|
+
var k = typeof Object.is === "function" ? Object.is : h$1, l = e.useState, m = e.useEffect, n$1 = e.useLayoutEffect, p$1 = e.useDebugValue;
|
|
251
|
+
function q$1(a2, b) {
|
|
252
|
+
var d = b(), f = l({ inst: {
|
|
253
|
+
value: d,
|
|
254
|
+
getSnapshot: b
|
|
255
|
+
} }), c = f[0].inst, g = f[1];
|
|
256
|
+
n$1(function() {
|
|
257
|
+
c.value = d;
|
|
258
|
+
c.getSnapshot = b;
|
|
259
|
+
r$1(c) && g({ inst: c });
|
|
260
|
+
}, [
|
|
261
|
+
a2,
|
|
262
|
+
d,
|
|
263
|
+
b
|
|
264
|
+
]);
|
|
265
|
+
m(function() {
|
|
266
|
+
r$1(c) && g({ inst: c });
|
|
267
|
+
return a2(function() {
|
|
268
|
+
r$1(c) && g({ inst: c });
|
|
269
|
+
});
|
|
270
|
+
}, [a2]);
|
|
271
|
+
p$1(d);
|
|
272
|
+
return d;
|
|
273
|
+
}
|
|
274
|
+
function r$1(a2) {
|
|
275
|
+
var b = a2.getSnapshot;
|
|
276
|
+
a2 = a2.value;
|
|
277
|
+
try {
|
|
278
|
+
var d = b();
|
|
279
|
+
return !k(a2, d);
|
|
280
|
+
} catch (f) {
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
function t$1(a2, b) {
|
|
285
|
+
return b();
|
|
286
|
+
}
|
|
287
|
+
var u$1 = typeof window === "undefined" || typeof window.document === "undefined" || typeof window.document.createElement === "undefined" ? t$1 : q$1;
|
|
288
|
+
useSyncExternalStoreShim_production_min.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : u$1;
|
|
289
|
+
shim.exports = useSyncExternalStoreShim_production_min;
|
|
290
|
+
/** @license React vundefined
|
|
291
|
+
* use-sync-external-store-shim/with-selector.production.min.js
|
|
292
|
+
*
|
|
293
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
294
|
+
*
|
|
295
|
+
* This source code is licensed under the MIT license found in the
|
|
296
|
+
* LICENSE file in the root directory of this source tree.
|
|
297
|
+
*/
|
|
298
|
+
var h = React, n = shim.exports;
|
|
299
|
+
function p(a2, b) {
|
|
300
|
+
return a2 === b && (a2 !== 0 || 1 / a2 === 1 / b) || a2 !== a2 && b !== b;
|
|
301
|
+
}
|
|
302
|
+
var q = typeof Object.is === "function" ? Object.is : p, r = n.useSyncExternalStore, t = h.useRef, u = h.useEffect, v = h.useMemo, w = h.useDebugValue;
|
|
303
|
+
withSelector_production_min.useSyncExternalStoreWithSelector = function(a2, b, e2, l2, g) {
|
|
304
|
+
var c = t(null);
|
|
305
|
+
if (c.current === null) {
|
|
306
|
+
var f = {
|
|
307
|
+
hasValue: false,
|
|
308
|
+
value: null
|
|
309
|
+
};
|
|
310
|
+
c.current = f;
|
|
311
|
+
} else f = c.current;
|
|
312
|
+
c = v(function() {
|
|
313
|
+
function a3(a4) {
|
|
314
|
+
if (!c2) {
|
|
315
|
+
c2 = true;
|
|
316
|
+
d2 = a4;
|
|
317
|
+
a4 = l2(a4);
|
|
318
|
+
if (g !== void 0 && f.hasValue) {
|
|
319
|
+
var b2 = f.value;
|
|
320
|
+
if (g(b2, a4)) return k2 = b2;
|
|
321
|
+
}
|
|
322
|
+
return k2 = a4;
|
|
323
|
+
}
|
|
324
|
+
b2 = k2;
|
|
325
|
+
if (q(d2, a4)) return b2;
|
|
326
|
+
var e3 = l2(a4);
|
|
327
|
+
if (g !== void 0 && g(b2, e3)) return b2;
|
|
328
|
+
d2 = a4;
|
|
329
|
+
return k2 = e3;
|
|
330
|
+
}
|
|
331
|
+
var c2 = false, d2, k2, m2 = e2 === void 0 ? null : e2;
|
|
332
|
+
return [function() {
|
|
333
|
+
return a3(b());
|
|
334
|
+
}, m2 === null ? void 0 : function() {
|
|
335
|
+
return a3(m2());
|
|
336
|
+
}];
|
|
337
|
+
}, [
|
|
338
|
+
b,
|
|
339
|
+
e2,
|
|
340
|
+
l2,
|
|
341
|
+
g
|
|
342
|
+
]);
|
|
343
|
+
var d = r(a2, c[0], c[1]);
|
|
344
|
+
u(function() {
|
|
345
|
+
f.hasValue = true;
|
|
346
|
+
f.value = d;
|
|
347
|
+
}, [d]);
|
|
348
|
+
w(d);
|
|
349
|
+
return d;
|
|
350
|
+
};
|
|
351
|
+
withSelector.exports = withSelector_production_min;
|
|
352
|
+
function useStoreState(store, ...args) {
|
|
353
|
+
var _a, _b, _c, _d;
|
|
354
|
+
let selector, options;
|
|
355
|
+
if (args[0] instanceof Function) {
|
|
356
|
+
selector = args[0];
|
|
357
|
+
options = (_a = args[1]) != null ? _a : {};
|
|
358
|
+
} else if (typeof args[0] === "string") {
|
|
359
|
+
selector = createSelector(args[0]);
|
|
360
|
+
options = (_b = args[1]) != null ? _b : {};
|
|
361
|
+
} else {
|
|
362
|
+
selector = (x) => x;
|
|
363
|
+
options = (_c = args[0]) != null ? _c : {};
|
|
364
|
+
}
|
|
365
|
+
const subscribe = useCallback((listener) => {
|
|
366
|
+
return store.subscribe((x) => x, listener, {
|
|
367
|
+
throttle: options.throttle,
|
|
368
|
+
runNow: false,
|
|
369
|
+
compare: (a2, b) => a2 === b
|
|
370
|
+
});
|
|
371
|
+
}, [store, options.throttle]);
|
|
372
|
+
const getSnapshot = useCallback(() => store.getState(), [store]);
|
|
373
|
+
const value = withSelector.exports.useSyncExternalStoreWithSelector(subscribe, getSnapshot, getSnapshot, selector, (_d = options.compare) != null ? _d : react);
|
|
374
|
+
useDebugValue(value);
|
|
375
|
+
return value;
|
|
376
|
+
}
|
|
377
|
+
function useStoreProp(store, selector) {
|
|
378
|
+
const value = useStoreState(store, selector);
|
|
379
|
+
const update = (value2) => store.update((state) => setWithSelector(state, selector, value2));
|
|
380
|
+
return [value, update];
|
|
381
|
+
}
|
|
382
|
+
var Store = class extends Store$1 {
|
|
383
|
+
useState(...args) {
|
|
384
|
+
return useStoreState(this, ...args);
|
|
385
|
+
}
|
|
386
|
+
useProp(selector) {
|
|
387
|
+
return useStoreProp(this, selector);
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
var StoreScope = class {
|
|
391
|
+
constructor(defaultValue) {
|
|
392
|
+
this.defaultValue = defaultValue;
|
|
393
|
+
this.Provider = ({ children, store }) => {
|
|
394
|
+
const _store = useMemo(() => store != null ? store : new Store(this.defaultValue), [store]);
|
|
395
|
+
return /* @__PURE__ */ React.createElement(this.context.Provider, { value: _store }, children);
|
|
396
|
+
};
|
|
397
|
+
this.withScope = (Component) => {
|
|
398
|
+
return (args) => /* @__PURE__ */ React.createElement(this.Provider, null, /* @__PURE__ */ React.createElement(Component, __spreadValues({}, args)));
|
|
399
|
+
};
|
|
400
|
+
this.context = createContext(new Store(defaultValue));
|
|
401
|
+
}
|
|
402
|
+
useStore() {
|
|
403
|
+
return useContext(this.context);
|
|
404
|
+
}
|
|
405
|
+
useState(...args) {
|
|
406
|
+
return useStoreState(this.useStore(), ...args);
|
|
407
|
+
}
|
|
408
|
+
useProp(selector) {
|
|
409
|
+
return useStoreProp(this.useStore(), selector);
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/misc/throttle.ts
|
|
415
|
+
function throttle(function_, ms) {
|
|
416
|
+
let last = 0;
|
|
417
|
+
let lastArgs;
|
|
418
|
+
let timeout;
|
|
419
|
+
function run() {
|
|
420
|
+
const args = lastArgs;
|
|
421
|
+
last = Date.now();
|
|
422
|
+
lastArgs = void 0;
|
|
423
|
+
timeout = void 0;
|
|
424
|
+
function_(...args);
|
|
425
|
+
}
|
|
426
|
+
return Object.assign(function(...args) {
|
|
427
|
+
const now = Date.now();
|
|
428
|
+
lastArgs = args;
|
|
429
|
+
if (timeout) {} else if (now < last + ms) timeout = setTimeout(run, last + ms - now);
|
|
430
|
+
else run();
|
|
431
|
+
}, {
|
|
432
|
+
flush() {
|
|
433
|
+
if (lastArgs) run();
|
|
434
|
+
},
|
|
435
|
+
cancel() {
|
|
436
|
+
if (timeout) clearTimeout(timeout);
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
//#endregion
|
|
442
|
+
//#region src/theme/defaultTheme/defaultClasses.ts
|
|
443
|
+
const cell = css({
|
|
444
|
+
padding: `calc(var(--spacing) * 0.1) calc(2 * var(--spacing))`,
|
|
445
|
+
display: "flex",
|
|
446
|
+
alignItems: "center",
|
|
447
|
+
borderBottom: "1px solid var(--table-border-light-color)",
|
|
448
|
+
whiteSpace: "nowrap",
|
|
449
|
+
overflow: "hidden",
|
|
450
|
+
"&:empty": { padding: 0 }
|
|
451
|
+
});
|
|
452
|
+
const defaultClasses = {
|
|
453
|
+
table: css({
|
|
454
|
+
position: "relative",
|
|
455
|
+
display: "grid",
|
|
456
|
+
color: "var(--table-text-color)"
|
|
457
|
+
}),
|
|
458
|
+
cell,
|
|
459
|
+
cellFill: css({ borderBottom: "1px solid var(--table-border-light-color)" }),
|
|
460
|
+
headerCell: css(cell, {
|
|
461
|
+
borderBottom: "1px solid var(--table-border-color)",
|
|
462
|
+
background: "var(--table-background-color)",
|
|
463
|
+
"&:not(:empty)": { padding: `var(--spacing) 0 var(--spacing) calc(2 * var(--spacing))` }
|
|
464
|
+
}),
|
|
465
|
+
footerCell: css(cell, {
|
|
466
|
+
padding: `var(--spacing) calc(2 * var(--spacing))`,
|
|
467
|
+
borderTop: "1px solid var(--table-border-color)",
|
|
468
|
+
borderBottom: "none",
|
|
469
|
+
background: "var(--table-background-color)"
|
|
470
|
+
}),
|
|
471
|
+
firstCell: css({ justifyContent: "start" }),
|
|
472
|
+
sticky: css({
|
|
473
|
+
position: "sticky",
|
|
474
|
+
top: 0,
|
|
475
|
+
zIndex: 2
|
|
476
|
+
}),
|
|
477
|
+
stickyBottom: css({
|
|
478
|
+
position: "sticky",
|
|
479
|
+
bottom: 0,
|
|
480
|
+
zIndex: 2
|
|
481
|
+
}),
|
|
482
|
+
headerFill: css({
|
|
483
|
+
borderBottom: "1px solid var(--table-border-color)",
|
|
484
|
+
background: "var(--table-background-color)"
|
|
485
|
+
}),
|
|
486
|
+
footerFill: css({
|
|
487
|
+
borderTop: "1px solid var(--table-border-color)",
|
|
488
|
+
background: "var(--table-background-color)"
|
|
489
|
+
}),
|
|
490
|
+
text: css({
|
|
491
|
+
minWidth: 0,
|
|
492
|
+
overflow: "hidden",
|
|
493
|
+
textOverflow: "ellipsis"
|
|
494
|
+
}),
|
|
495
|
+
card: css({
|
|
496
|
+
borderRadius: 4,
|
|
497
|
+
boxShadow: "0px 3px 14px 2px rgb(0 0 0 / 12%)",
|
|
498
|
+
background: "var(--table-background-color)"
|
|
499
|
+
}),
|
|
500
|
+
clearFiltersButton: css({
|
|
501
|
+
padding: `0 calc(2 * var(--spacing))`,
|
|
502
|
+
fontWeight: "bold",
|
|
503
|
+
position: "sticky",
|
|
504
|
+
left: 0,
|
|
505
|
+
maxWidth: "fit-content",
|
|
506
|
+
gridColumn: "2/-1",
|
|
507
|
+
button: {
|
|
508
|
+
color: "var(--primaryMain) !important",
|
|
509
|
+
border: "solid 1px",
|
|
510
|
+
borderColor: "var(--primaryMain) !important",
|
|
511
|
+
margin: "var(--spacing)"
|
|
512
|
+
}
|
|
513
|
+
}),
|
|
514
|
+
details: css(cell, {
|
|
515
|
+
gridColumn: "1 / -1",
|
|
516
|
+
whiteSpace: "normal"
|
|
517
|
+
})
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
//#endregion
|
|
521
|
+
//#region src/theme/defaultTheme/popover.tsx
|
|
522
|
+
const MAX_OFFSET = 20;
|
|
523
|
+
const Popover = ({ anchorEl, open, hidden, onClose, children, className, backdropClassName, align }) => {
|
|
524
|
+
const probe = useRef(null);
|
|
525
|
+
const backdrop = useRef(null);
|
|
526
|
+
const popper = useRef(null);
|
|
527
|
+
useLayoutEffect(() => {
|
|
528
|
+
if (!anchorEl || !open) {
|
|
529
|
+
popper.current?.style.setProperty("visibility", "hidden");
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
function check() {
|
|
533
|
+
if (!anchorEl) return;
|
|
534
|
+
const { left: anchorLeft, bottom: anchorBottom, width: anchorWidth } = anchorEl.getBoundingClientRect();
|
|
535
|
+
const viewportWidth = document.documentElement.clientWidth;
|
|
536
|
+
const viewportHeight = document.documentElement.clientHeight;
|
|
537
|
+
const { width: popperWidth = 0, height: popperHeight = 0 } = popper.current?.getBoundingClientRect() ?? {};
|
|
538
|
+
const marginLeft = parseFloat(getComputedStyle(popper.current ?? document.body).marginLeft);
|
|
539
|
+
const marginRight = parseFloat(getComputedStyle(popper.current ?? document.body).marginRight);
|
|
540
|
+
const marginTop = parseFloat(getComputedStyle(popper.current ?? document.body).marginTop);
|
|
541
|
+
const marginBottom = parseFloat(getComputedStyle(popper.current ?? document.body).marginBottom);
|
|
542
|
+
const next = {
|
|
543
|
+
left: align === "center" ? anchorLeft + anchorWidth / 2 - popperWidth / 2 : anchorLeft - Math.min(popperWidth ? popperWidth / 2 : Number.POSITIVE_INFINITY, MAX_OFFSET),
|
|
544
|
+
top: anchorBottom
|
|
545
|
+
};
|
|
546
|
+
if (next.left < marginLeft) next.left = marginLeft;
|
|
547
|
+
if (next.left > viewportWidth - popperWidth - marginLeft - marginRight) next.left = viewportWidth - popperWidth - marginLeft - marginRight;
|
|
548
|
+
if (next.top < marginTop) next.top = marginTop;
|
|
549
|
+
if (next.top > viewportHeight - popperHeight - marginTop - marginBottom) next.top = viewportHeight - popperHeight - marginTop - marginBottom;
|
|
550
|
+
popper.current?.style.setProperty("visibility", "visible");
|
|
551
|
+
popper.current?.style.setProperty("left", `${next.left}px`);
|
|
552
|
+
popper.current?.style.setProperty("top", `${next.top}px`);
|
|
553
|
+
popper.current?.style.setProperty("--margin-x", `${marginLeft + marginRight}px`);
|
|
554
|
+
popper.current?.style.setProperty("--margin-y", `${marginTop + marginBottom}px`);
|
|
555
|
+
}
|
|
556
|
+
const checkThrottled = throttle(check, 16);
|
|
557
|
+
check();
|
|
558
|
+
const handle = setInterval(checkThrottled, 1e3);
|
|
559
|
+
window.addEventListener("resize", checkThrottled);
|
|
560
|
+
window.addEventListener("scroll", checkThrottled, true);
|
|
561
|
+
return () => {
|
|
562
|
+
clearInterval(handle);
|
|
563
|
+
window.removeEventListener("resize", checkThrottled);
|
|
564
|
+
window.removeEventListener("scroll", checkThrottled, true);
|
|
565
|
+
};
|
|
566
|
+
}, [
|
|
567
|
+
anchorEl,
|
|
568
|
+
open,
|
|
569
|
+
align
|
|
570
|
+
]);
|
|
571
|
+
useLayoutEffect(() => {
|
|
572
|
+
if (!open) return;
|
|
573
|
+
const ancestors = [];
|
|
574
|
+
for (let node = probe.current?.parentElement; node; node = node.parentElement) ancestors.push(node);
|
|
575
|
+
for (const node of ancestors.reverse()) {
|
|
576
|
+
const value = document.defaultView?.getComputedStyle(node).getPropertyValue("z-index");
|
|
577
|
+
if (value && !Number.isNaN(Number(value))) {
|
|
578
|
+
const newZIndex = Number(value) + 1;
|
|
579
|
+
if (backdrop.current && !(Number(document.defaultView?.getComputedStyle(backdrop.current).getPropertyValue("z-index")) > newZIndex)) backdrop.current?.style.setProperty("z-index", newZIndex.toString());
|
|
580
|
+
if (popper.current && !(Number(document.defaultView?.getComputedStyle(popper.current).getPropertyValue("z-index")) > newZIndex + 1)) popper.current?.style.setProperty("z-index", (newZIndex + 1).toString());
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}, [anchorEl, open]);
|
|
585
|
+
if (!open) return null;
|
|
586
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
587
|
+
ref: probe,
|
|
588
|
+
css: { display: "none" }
|
|
589
|
+
}), createPortal(/* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
590
|
+
ref: backdrop,
|
|
591
|
+
className: backdropClassName,
|
|
592
|
+
css: [{
|
|
593
|
+
position: "fixed",
|
|
594
|
+
left: 0,
|
|
595
|
+
right: 0,
|
|
596
|
+
top: 0,
|
|
597
|
+
bottom: 0
|
|
598
|
+
}, hidden && { display: "none" }],
|
|
599
|
+
onClick: () => onClose()
|
|
600
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
601
|
+
ref: popper,
|
|
602
|
+
className,
|
|
603
|
+
css: [
|
|
604
|
+
defaultClasses.card,
|
|
605
|
+
{
|
|
606
|
+
position: "fixed",
|
|
607
|
+
maxWidth: [`calc(100vw - (100vw - 100%) - var(--margin-x))`, `calc(100dvw - (100dvw - 100%) - var(--margin-x))`],
|
|
608
|
+
maxHeight: [`calc(100vh - (100vh - 100%) - var(--margin-x))`, `calc(100dvh - (100dvh - 100%) - var(--margin-x))`],
|
|
609
|
+
margin: 10,
|
|
610
|
+
zIndex: 1,
|
|
611
|
+
overflowY: "auto",
|
|
612
|
+
color: "var(--table-text-color)",
|
|
613
|
+
visibility: "hidden"
|
|
614
|
+
},
|
|
615
|
+
hidden && { display: "none" }
|
|
616
|
+
],
|
|
617
|
+
children
|
|
618
|
+
})] }), document.body)] });
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region src/theme/tableTheme.tsx
|
|
623
|
+
const globalTableTheme = new Store({});
|
|
624
|
+
function configureTableTheme(tableTheme) {
|
|
625
|
+
globalTableTheme.set(tableTheme);
|
|
626
|
+
}
|
|
627
|
+
function mergeThemes(...themes) {
|
|
628
|
+
return {
|
|
629
|
+
text: Object.assign({}, ...themes.map((theme) => theme.text)),
|
|
630
|
+
classes: Object.assign({}, ...themes.map((theme) => theme.classes)),
|
|
631
|
+
styles: Object.assign({}, ...themes.map((theme) => theme.styles)),
|
|
632
|
+
components: Object.assign({}, ...themes.map((theme) => theme.components)),
|
|
633
|
+
icons: Object.assign({}, ...themes.map((theme) => theme.icons)),
|
|
634
|
+
colors: {
|
|
635
|
+
primary: Object.assign({}, ...themes.map((theme) => theme.colors?.primary)),
|
|
636
|
+
secondary: Object.assign({}, ...themes.map((theme) => theme.colors?.secondary)),
|
|
637
|
+
blocked: Object.assign({}, ...themes.map((theme) => theme.colors?.blocked)),
|
|
638
|
+
background: themes.map((theme) => theme.colors?.background).reverse().find((x) => x !== void 0),
|
|
639
|
+
text: themes.map((theme) => theme.colors?.text).reverse().find((x) => x !== void 0),
|
|
640
|
+
border: themes.map((theme) => theme.colors?.border).reverse().find((x) => x !== void 0),
|
|
641
|
+
borderLight: themes.map((theme) => theme.colors?.borderLight).reverse().find((x) => x !== void 0)
|
|
642
|
+
},
|
|
643
|
+
spacing: themes.map((theme) => theme.spacing).reverse().find((x) => x !== void 0)
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
//#endregion
|
|
648
|
+
//#region src/misc/tableSettings.tsx
|
|
649
|
+
const TableSettingsContext = createContext({
|
|
650
|
+
theme: {},
|
|
651
|
+
exporters: [{
|
|
652
|
+
action: "copy",
|
|
653
|
+
exporter: new CsvExporter()
|
|
654
|
+
}, {
|
|
655
|
+
action: "download",
|
|
656
|
+
exporter: new CsvExporter()
|
|
657
|
+
}]
|
|
658
|
+
});
|
|
659
|
+
function TableSettingsProvider({ theme, exporters, additionalExporters, children }) {
|
|
660
|
+
const inherited = useContext(TableSettingsContext);
|
|
661
|
+
theme ??= inherited.theme;
|
|
662
|
+
exporters ??= inherited.exporters;
|
|
663
|
+
if (additionalExporters) exporters = [...exporters, ...additionalExporters];
|
|
664
|
+
return /* @__PURE__ */ jsx(TableSettingsContext.Provider, {
|
|
665
|
+
value: {
|
|
666
|
+
theme,
|
|
667
|
+
exporters
|
|
668
|
+
},
|
|
669
|
+
children
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
//#endregion
|
|
674
|
+
export { Popover, Store, StoreScope, TableSettingsContext, TableSettingsProvider, configureTableTheme, defaultClasses, globalTableTheme, mergeThemes, throttle };
|
|
675
|
+
//# sourceMappingURL=tableSettings-C5bAcuVw.js.map
|