@vobs/table 1.2.1 → 1.3.0
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/column-settings.cjs +119 -697
- package/dist/column-settings.cjs.map +1 -1
- package/dist/column-settings.js +70 -655
- package/dist/column-settings.js.map +1 -1
- package/dist/data-table.cjs +205 -1077
- package/dist/data-table.cjs.map +1 -1
- package/dist/data-table.js +126 -1005
- package/dist/data-table.js.map +1 -1
- package/dist/icons.cjs +31 -822
- package/dist/icons.cjs.map +1 -1
- package/dist/icons.js +5 -818
- package/dist/icons.js.map +1 -1
- package/dist/index.cjs +303 -1178
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +224 -1099
- package/dist/index.js.map +1 -1
- package/dist/persistence.cjs +30 -6
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.js +5 -3
- package/dist/persistence.js.map +1 -1
- package/dist/types.cjs +18 -2
- package/dist/types.cjs.map +1 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +1 -1
- package/dist/utils.cjs +64 -388
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +25 -365
- package/dist/utils.js.map +1 -1
- package/package.json +5 -5
package/dist/data-table.cjs
CHANGED
|
@@ -1,691 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __VOBS_CJS_FILE_URL = require("url").pathToFileURL(__filename).href;
|
|
2
|
+
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
7
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var signalNames = /* @__PURE__ */ new WeakMap();
|
|
9
|
-
function hasDebugHooks() {
|
|
10
|
-
return activeDebugHooks !== null;
|
|
11
|
-
}
|
|
12
|
-
__name(hasDebugHooks, "hasDebugHooks");
|
|
13
|
-
function setSignalDebugName(signal, name) {
|
|
14
|
-
signalNames.set(signal, name);
|
|
15
|
-
invokeDebug("signalNamed", signal, name);
|
|
16
|
-
}
|
|
17
|
-
__name(setSignalDebugName, "setSignalDebugName");
|
|
18
|
-
function invokeDebug(name, ...args) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
__name(invokeDebug, "invokeDebug");
|
|
22
|
-
|
|
23
|
-
// packages/reactivity/src/owner.ts
|
|
24
|
-
var currentOwner = null;
|
|
25
|
-
var nextOwnerId = 1;
|
|
26
|
-
var ownerNames = /* @__PURE__ */ new WeakMap();
|
|
27
|
-
function createOwner() {
|
|
28
|
-
const parent = currentOwner;
|
|
29
|
-
let disposed = parent?.disposed ?? false;
|
|
30
|
-
const children = [];
|
|
31
|
-
const cleanups = [];
|
|
32
|
-
const errorHandlers = /* @__PURE__ */ new Set();
|
|
33
|
-
const owner = {
|
|
34
|
-
id: `owner-${nextOwnerId++}`,
|
|
35
|
-
parent,
|
|
36
|
-
children,
|
|
37
|
-
depth: (parent?.depth ?? -1) + 1,
|
|
38
|
-
get disposed() {
|
|
39
|
-
return disposed;
|
|
40
|
-
},
|
|
41
|
-
run(fn) {
|
|
42
|
-
if (disposed) throw new Error("Vobs: \u5DF2\u9500\u6BC1\u7684 Owner \u4E0D\u80FD\u7EE7\u7EED\u8FD0\u884C");
|
|
43
|
-
const previous = currentOwner;
|
|
44
|
-
currentOwner = owner;
|
|
45
|
-
try {
|
|
46
|
-
return fn();
|
|
47
|
-
} finally {
|
|
48
|
-
currentOwner = previous;
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
addCleanup(cleanup) {
|
|
52
|
-
if (disposed) {
|
|
53
|
-
cleanup();
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
cleanups.push(cleanup);
|
|
57
|
-
},
|
|
58
|
-
onDispose(cleanup) {
|
|
59
|
-
owner.addCleanup(cleanup);
|
|
60
|
-
},
|
|
61
|
-
onError(handler) {
|
|
62
|
-
errorHandlers.add(handler);
|
|
63
|
-
const remove = /* @__PURE__ */ __name(() => errorHandlers.delete(handler), "remove");
|
|
64
|
-
owner.addCleanup(remove);
|
|
65
|
-
return remove;
|
|
66
|
-
},
|
|
67
|
-
handleError(error) {
|
|
68
|
-
for (const handler of [...errorHandlers].reverse()) {
|
|
69
|
-
try {
|
|
70
|
-
handler(error);
|
|
71
|
-
return true;
|
|
72
|
-
} catch (handlerError) {
|
|
73
|
-
return parent?.handleError(handlerError) ?? false;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return parent?.handleError(error) ?? false;
|
|
77
|
-
},
|
|
78
|
-
dispose() {
|
|
79
|
-
if (disposed) return;
|
|
80
|
-
disposed = true;
|
|
81
|
-
for (const child of [...children]) child.dispose();
|
|
82
|
-
children.length = 0;
|
|
83
|
-
let firstError;
|
|
84
|
-
for (let index = cleanups.length - 1; index >= 0; index--) {
|
|
85
|
-
try {
|
|
86
|
-
cleanups[index]();
|
|
87
|
-
} catch (error) {
|
|
88
|
-
firstError ?? (firstError = error);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
cleanups.length = 0;
|
|
92
|
-
if (parent) {
|
|
93
|
-
const index = parent.children.indexOf(owner);
|
|
94
|
-
if (index >= 0) parent.children.splice(index, 1);
|
|
95
|
-
}
|
|
96
|
-
if (firstError) throw firstError;
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
if (parent && !parent.disposed) parent.children.push(owner);
|
|
100
|
-
return owner;
|
|
101
|
-
}
|
|
102
|
-
__name(createOwner, "createOwner");
|
|
103
|
-
function setOwnerDebugName(owner, name) {
|
|
104
|
-
ownerNames.set(owner, name);
|
|
105
|
-
}
|
|
106
|
-
__name(setOwnerDebugName, "setOwnerDebugName");
|
|
107
|
-
function getCurrentOwner() {
|
|
108
|
-
return currentOwner;
|
|
109
|
-
}
|
|
110
|
-
__name(getCurrentOwner, "getCurrentOwner");
|
|
111
|
-
|
|
112
|
-
// packages/reactivity/src/signal.ts
|
|
113
|
-
var currentSubscriber = null;
|
|
114
|
-
function getCurrentSubscriber() {
|
|
115
|
-
return currentSubscriber;
|
|
116
|
-
}
|
|
117
|
-
__name(getCurrentSubscriber, "getCurrentSubscriber");
|
|
118
|
-
function setCurrentSubscriber(subscriber) {
|
|
119
|
-
currentSubscriber = subscriber;
|
|
120
|
-
}
|
|
121
|
-
__name(setCurrentSubscriber, "setCurrentSubscriber");
|
|
122
|
-
function trackDependency(dependency) {
|
|
123
|
-
if (!currentSubscriber || currentSubscriber.disposed) return;
|
|
124
|
-
!currentSubscriber.dependencies.has(dependency);
|
|
125
|
-
currentSubscriber.dependencies.add(dependency);
|
|
126
|
-
}
|
|
127
|
-
__name(trackDependency, "trackDependency");
|
|
128
|
-
function state(initialValue, debugName) {
|
|
129
|
-
let value = initialValue;
|
|
130
|
-
let disposed = false;
|
|
131
|
-
const subscribers = /* @__PURE__ */ new Set();
|
|
132
|
-
const signalInstance = {
|
|
133
|
-
get value() {
|
|
134
|
-
const subscriber = getCurrentSubscriber();
|
|
135
|
-
if (subscriber && !subscriber.disposed) {
|
|
136
|
-
subscribers.add(subscriber);
|
|
137
|
-
trackDependency(signalInstance);
|
|
138
|
-
}
|
|
139
|
-
return value;
|
|
140
|
-
},
|
|
141
|
-
set value(nextValue) {
|
|
142
|
-
if (disposed || Object.is(value, nextValue)) return;
|
|
143
|
-
value = nextValue;
|
|
144
|
-
for (const subscriber of [...subscribers]) subscriber.notify();
|
|
145
|
-
},
|
|
146
|
-
unsubscribe(subscriber) {
|
|
147
|
-
subscribers.delete(subscriber);
|
|
148
|
-
},
|
|
149
|
-
// 与 `.value =` 赋值同一条路径:判等短路、debug hook、notify 全部一致。
|
|
150
|
-
// 以闭包实现,可安全地作为回调直接传递(无 this 绑定问题)。
|
|
151
|
-
set(next) {
|
|
152
|
-
signalInstance.value = next;
|
|
153
|
-
},
|
|
154
|
-
dispose() {
|
|
155
|
-
if (disposed) return;
|
|
156
|
-
disposed = true;
|
|
157
|
-
subscribers.clear();
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
const owner = getCurrentOwner();
|
|
161
|
-
owner?.addCleanup(signalInstance.dispose);
|
|
162
|
-
if (debugName?.trim()) setSignalDebugName(signalInstance, debugName.trim());
|
|
163
|
-
return signalInstance;
|
|
164
|
-
}
|
|
165
|
-
__name(state, "state");
|
|
166
|
-
|
|
167
|
-
// packages/reactivity/src/scheduler.ts
|
|
168
|
-
var _Scheduler = class _Scheduler {
|
|
169
|
-
constructor() {
|
|
170
|
-
this.dirtyEffects = /* @__PURE__ */ new Set();
|
|
171
|
-
this.lowPriorityEffects = /* @__PURE__ */ new Set();
|
|
172
|
-
// flush 不可重入(flushing 标志保证),缓冲数组可在轮次间安全复用,避免每轮分配。
|
|
173
|
-
this.normalBuffer = [];
|
|
174
|
-
this.lowBuffer = [];
|
|
175
|
-
this.flushing = false;
|
|
176
|
-
this.scheduled = false;
|
|
177
|
-
this.batchDepth = 0;
|
|
178
|
-
}
|
|
179
|
-
schedule(effect2) {
|
|
180
|
-
if (effect2.disposed) return;
|
|
181
|
-
this.dirtyEffects.add(effect2);
|
|
182
|
-
this.lowPriorityEffects.delete(effect2);
|
|
183
|
-
this.ensureScheduled();
|
|
184
|
-
}
|
|
185
|
-
/** Queue an effect behind normal updates while preserving deterministic order. */
|
|
186
|
-
scheduleLow(effect2) {
|
|
187
|
-
if (effect2.disposed) return;
|
|
188
|
-
if (!this.dirtyEffects.has(effect2)) this.lowPriorityEffects.add(effect2);
|
|
189
|
-
this.ensureScheduled();
|
|
190
|
-
}
|
|
191
|
-
ensureScheduled() {
|
|
192
|
-
if (this.batchDepth === 0 && !this.flushing && !this.scheduled) {
|
|
193
|
-
this.scheduled = true;
|
|
194
|
-
queueMicrotask(() => {
|
|
195
|
-
this.scheduled = false;
|
|
196
|
-
this.flush();
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
remove(effect2) {
|
|
201
|
-
this.dirtyEffects.delete(effect2);
|
|
202
|
-
this.lowPriorityEffects.delete(effect2);
|
|
203
|
-
}
|
|
204
|
-
batch(fn) {
|
|
205
|
-
this.batchDepth++;
|
|
206
|
-
try {
|
|
207
|
-
return fn();
|
|
208
|
-
} finally {
|
|
209
|
-
this.batchDepth--;
|
|
210
|
-
if (this.batchDepth === 0) this.flush();
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
flush() {
|
|
214
|
-
if (this.flushing || this.batchDepth > 0) return;
|
|
215
|
-
this.flushing = true;
|
|
216
|
-
let rounds = 0;
|
|
217
|
-
let firstError;
|
|
218
|
-
let hasError = false;
|
|
219
|
-
try {
|
|
220
|
-
while (this.dirtyEffects.size > 0 || this.lowPriorityEffects.size > 0) {
|
|
221
|
-
if (++rounds > 100) {
|
|
222
|
-
this.dirtyEffects.clear();
|
|
223
|
-
this.lowPriorityEffects.clear();
|
|
224
|
-
throw new Error("Vobs: \u54CD\u5E94\u5F0F\u66F4\u65B0\u8D85\u8FC7 100 \u8F6E\uFF0C\u53EF\u80FD\u5B58\u5728\u5FAA\u73AF\u4F9D\u8D56");
|
|
225
|
-
}
|
|
226
|
-
this.collectRunnable(this.dirtyEffects, this.normalBuffer);
|
|
227
|
-
this.collectRunnable(this.lowPriorityEffects, this.lowBuffer);
|
|
228
|
-
sortEffects(this.normalBuffer);
|
|
229
|
-
sortEffects(this.lowBuffer);
|
|
230
|
-
for (const effect2 of this.normalBuffer) {
|
|
231
|
-
try {
|
|
232
|
-
effect2.run();
|
|
233
|
-
} catch (error) {
|
|
234
|
-
if (!hasError) {
|
|
235
|
-
firstError = error;
|
|
236
|
-
hasError = true;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
for (const effect2 of this.lowBuffer) {
|
|
241
|
-
try {
|
|
242
|
-
effect2.run();
|
|
243
|
-
} catch (error) {
|
|
244
|
-
if (!hasError) {
|
|
245
|
-
firstError = error;
|
|
246
|
-
hasError = true;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
this.normalBuffer.length = 0;
|
|
251
|
-
this.lowBuffer.length = 0;
|
|
252
|
-
}
|
|
253
|
-
} finally {
|
|
254
|
-
this.normalBuffer.length = 0;
|
|
255
|
-
this.lowBuffer.length = 0;
|
|
256
|
-
this.flushing = false;
|
|
257
|
-
}
|
|
258
|
-
if (hasError) throw firstError;
|
|
259
|
-
}
|
|
260
|
-
/** 收集未 disposed 的 effect 并清空源集合;run() 期间新调度的 effect 留给下一轮。 */
|
|
261
|
-
collectRunnable(source, target) {
|
|
262
|
-
for (const effect2 of source) {
|
|
263
|
-
if (!effect2.disposed) target.push(effect2);
|
|
264
|
-
}
|
|
265
|
-
source.clear();
|
|
266
|
-
}
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
267
11
|
};
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
__name(sortEffects, "sortEffects");
|
|
276
|
-
var scheduler = new Scheduler();
|
|
277
|
-
|
|
278
|
-
// packages/reactivity/src/effect.ts
|
|
279
|
-
var nextEffectOrder = 1;
|
|
280
|
-
function cleanupDependencies(subscriber) {
|
|
281
|
-
for (const dependency of subscriber.dependencies) {
|
|
282
|
-
dependency.unsubscribe(subscriber);
|
|
283
|
-
}
|
|
284
|
-
subscriber.dependencies.clear();
|
|
285
|
-
}
|
|
286
|
-
__name(cleanupDependencies, "cleanupDependencies");
|
|
287
|
-
function effect(callback) {
|
|
288
|
-
const owner = getCurrentOwner();
|
|
289
|
-
let cleanup;
|
|
290
|
-
let dirty = true;
|
|
291
|
-
let disposed = false;
|
|
292
|
-
const eff = {
|
|
293
|
-
order: nextEffectOrder++,
|
|
294
|
-
depth: owner?.depth ?? 0,
|
|
295
|
-
dependencies: /* @__PURE__ */ new Set(),
|
|
296
|
-
get disposed() {
|
|
297
|
-
return disposed;
|
|
298
|
-
},
|
|
299
|
-
notify() {
|
|
300
|
-
if (disposed || dirty) return;
|
|
301
|
-
dirty = true;
|
|
302
|
-
scheduler.schedule(eff);
|
|
303
|
-
},
|
|
304
|
-
run() {
|
|
305
|
-
if (disposed || !dirty) return;
|
|
306
|
-
dirty = false;
|
|
307
|
-
const previousCleanup = cleanup;
|
|
308
|
-
cleanup = void 0;
|
|
309
|
-
let cleanupError;
|
|
310
|
-
if (previousCleanup) {
|
|
311
|
-
try {
|
|
312
|
-
previousCleanup();
|
|
313
|
-
} catch (error) {
|
|
314
|
-
const handled2 = owner?.handleError(error) ?? false;
|
|
315
|
-
if (!handled2) cleanupError = error;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
cleanupDependencies(eff);
|
|
319
|
-
const previous = getCurrentSubscriber();
|
|
320
|
-
setCurrentSubscriber(eff);
|
|
321
|
-
let thrown;
|
|
322
|
-
let handled = false;
|
|
323
|
-
try {
|
|
324
|
-
const result = owner ? owner.run(callback) : callback();
|
|
325
|
-
cleanup = typeof result === "function" ? result : void 0;
|
|
326
|
-
} catch (error) {
|
|
327
|
-
thrown = error;
|
|
328
|
-
handled = owner?.handleError(error) ?? false;
|
|
329
|
-
if (!handled) throw error;
|
|
330
|
-
} finally {
|
|
331
|
-
setCurrentSubscriber(previous);
|
|
332
|
-
}
|
|
333
|
-
if (cleanupError && !thrown) throw cleanupError;
|
|
334
|
-
},
|
|
335
|
-
scheduleLow() {
|
|
336
|
-
if (disposed || dirty) return;
|
|
337
|
-
dirty = true;
|
|
338
|
-
scheduler.scheduleLow(eff);
|
|
339
|
-
},
|
|
340
|
-
dispose() {
|
|
341
|
-
if (disposed) return;
|
|
342
|
-
disposed = true;
|
|
343
|
-
dirty = false;
|
|
344
|
-
scheduler.remove(eff);
|
|
345
|
-
const previousCleanup = cleanup;
|
|
346
|
-
cleanup = void 0;
|
|
347
|
-
let cleanupError;
|
|
348
|
-
if (previousCleanup) {
|
|
349
|
-
try {
|
|
350
|
-
previousCleanup();
|
|
351
|
-
} catch (error) {
|
|
352
|
-
const handled = owner?.handleError(error) ?? false;
|
|
353
|
-
if (!handled) cleanupError = error;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
cleanupDependencies(eff);
|
|
357
|
-
if (cleanupError) throw cleanupError;
|
|
358
|
-
}
|
|
359
|
-
};
|
|
360
|
-
owner?.addCleanup(eff.dispose);
|
|
361
|
-
eff.run();
|
|
362
|
-
return eff;
|
|
363
|
-
}
|
|
364
|
-
__name(effect, "effect");
|
|
365
|
-
|
|
366
|
-
// packages/runtime/src/debug.ts
|
|
367
|
-
var activeRuntimeDebugHooks = null;
|
|
368
|
-
function getRuntimeDebugHooks() {
|
|
369
|
-
return activeRuntimeDebugHooks;
|
|
370
|
-
}
|
|
371
|
-
__name(getRuntimeDebugHooks, "getRuntimeDebugHooks");
|
|
372
|
-
function invokeRuntimeDebug(name, ...args) {
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
__name(invokeRuntimeDebug, "invokeRuntimeDebug");
|
|
376
|
-
function readDebugValue(read) {
|
|
377
|
-
try {
|
|
378
|
-
return read();
|
|
379
|
-
} catch {
|
|
380
|
-
return "[Uninspectable]";
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
__name(readDebugValue, "readDebugValue");
|
|
384
|
-
function describeDebugNode(node) {
|
|
385
|
-
if (!node || typeof node !== "object") return "node";
|
|
386
|
-
const value = node;
|
|
387
|
-
const name = typeof value.tagName === "string" ? value.tagName.toLowerCase() : typeof value.nodeName === "string" ? value.nodeName.toLowerCase() : "node";
|
|
388
|
-
const id = typeof value.id === "string" && value.id ? `#${value.id}` : "";
|
|
389
|
-
const className = typeof value.className === "string" && value.className ? `.${value.className.trim().split(/\s+/).filter(Boolean).join(".")}` : "";
|
|
390
|
-
return `${name}${id}${className}`;
|
|
391
|
-
}
|
|
392
|
-
__name(describeDebugNode, "describeDebugNode");
|
|
393
|
-
|
|
394
|
-
// packages/runtime/src/hmr.ts
|
|
395
|
-
var globalTarget = globalThis;
|
|
396
|
-
var hmrGlobal = globalTarget.__VOBS_HMR__ ?? { modules: /* @__PURE__ */ new Map() };
|
|
397
|
-
globalTarget.__VOBS_HMR__ = hmrGlobal;
|
|
398
|
-
function registerHmrInstance(moduleId, instance) {
|
|
399
|
-
const instances = getModule(moduleId).instances;
|
|
400
|
-
instances.add(instance);
|
|
401
|
-
return () => instances.delete(instance);
|
|
402
|
-
}
|
|
403
|
-
__name(registerHmrInstance, "registerHmrInstance");
|
|
404
|
-
function markHmrInstanceMounted(node, parent) {
|
|
405
|
-
const instance = hmrInstances.get(node);
|
|
406
|
-
if (instance) instance.parent = parent;
|
|
407
|
-
}
|
|
408
|
-
__name(markHmrInstanceMounted, "markHmrInstanceMounted");
|
|
409
|
-
function getModule(moduleId) {
|
|
410
|
-
let module = hmrGlobal.modules.get(moduleId);
|
|
411
|
-
if (!module) {
|
|
412
|
-
module = { components: /* @__PURE__ */ new Map(), state: /* @__PURE__ */ new Map(), instances: /* @__PURE__ */ new Set() };
|
|
413
|
-
hmrGlobal.modules.set(moduleId, module);
|
|
414
|
-
}
|
|
415
|
-
return module;
|
|
416
|
-
}
|
|
417
|
-
__name(getModule, "getModule");
|
|
418
|
-
var hmrInstances = /* @__PURE__ */ new WeakMap();
|
|
419
|
-
function associateHmrInstance(node, instance) {
|
|
420
|
-
hmrInstances.set(node, instance);
|
|
421
|
-
}
|
|
422
|
-
__name(associateHmrInstance, "associateHmrInstance");
|
|
423
|
-
var nodeOwners = /* @__PURE__ */ new WeakMap();
|
|
424
|
-
var eventBindings = /* @__PURE__ */ new WeakMap();
|
|
425
|
-
function getRenderer() {
|
|
426
|
-
{
|
|
427
|
-
throw new Error("\u6E32\u67D3\u5668\u672A\u521D\u59CB\u5316");
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
__name(getRenderer, "getRenderer");
|
|
431
|
-
function createText(content) {
|
|
432
|
-
return getRenderer().createText(content);
|
|
433
|
-
}
|
|
434
|
-
__name(createText, "createText");
|
|
435
|
-
function createElement(tag) {
|
|
436
|
-
return getRenderer().createElement(tag);
|
|
437
|
-
}
|
|
438
|
-
__name(createElement, "createElement");
|
|
439
|
-
function createComment(content) {
|
|
440
|
-
return getRenderer().createComment(content);
|
|
441
|
-
}
|
|
442
|
-
__name(createComment, "createComment");
|
|
443
|
-
function insertBefore(parent, child, anchor) {
|
|
444
|
-
if (isVobsFragment(child)) {
|
|
445
|
-
child.mount(parent, isVobsFragment(anchor) ? anchor.start : anchor);
|
|
446
|
-
return;
|
|
447
|
-
}
|
|
448
|
-
getRenderer().insertBefore(parent, child, isVobsFragment(anchor) ? anchor.start : anchor);
|
|
449
|
-
markHmrInstanceMounted(child, parent);
|
|
450
|
-
}
|
|
451
|
-
__name(insertBefore, "insertBefore");
|
|
452
|
-
function removeChild(parent, child) {
|
|
453
|
-
disposeNodeOwner(child);
|
|
454
|
-
if (isVobsFragment(child)) {
|
|
455
|
-
child.unmount(parent);
|
|
456
|
-
return;
|
|
457
|
-
}
|
|
458
|
-
getRenderer().removeChild(parent, child);
|
|
459
|
-
}
|
|
460
|
-
__name(removeChild, "removeChild");
|
|
461
|
-
function setProperty(node, key, value) {
|
|
462
|
-
getRenderer().setProperty(node, key, value);
|
|
463
|
-
}
|
|
464
|
-
__name(setProperty, "setProperty");
|
|
465
|
-
function setAttribute(node, key, value) {
|
|
466
|
-
getRenderer().setAttribute(node, key, value);
|
|
467
|
-
}
|
|
468
|
-
__name(setAttribute, "setAttribute");
|
|
469
|
-
function addEventListener(node, event, handler) {
|
|
470
|
-
const renderer = getRenderer();
|
|
471
|
-
const owner = getCurrentOwner();
|
|
472
|
-
let bindings = eventBindings.get(node);
|
|
473
|
-
if (!bindings) {
|
|
474
|
-
bindings = /* @__PURE__ */ new Map();
|
|
475
|
-
eventBindings.set(node, bindings);
|
|
476
|
-
}
|
|
477
|
-
const previous = bindings.get(event);
|
|
478
|
-
if (previous && previous.original === handler && previous.owner === owner) return;
|
|
479
|
-
if (previous) renderer.removeEventListener(node, event, previous.handler);
|
|
480
|
-
const listener = owner ? (reason) => {
|
|
481
|
-
try {
|
|
482
|
-
owner.run(() => handler(reason));
|
|
483
|
-
} catch (error) {
|
|
484
|
-
const handled = owner.handleError(error);
|
|
485
|
-
invokeRuntimeDebug("error", {
|
|
486
|
-
error,
|
|
487
|
-
owner,
|
|
488
|
-
phase: "event",
|
|
489
|
-
handled,
|
|
490
|
-
recovery: handled ? "handled" : "propagated"
|
|
491
|
-
});
|
|
492
|
-
if (!handled) throw error;
|
|
493
|
-
}
|
|
494
|
-
} : handler;
|
|
495
|
-
const binding = { handler: listener, owner, original: handler };
|
|
496
|
-
bindings.set(event, binding);
|
|
497
|
-
renderer.addEventListener(node, event, listener);
|
|
498
|
-
owner?.onDispose(() => {
|
|
499
|
-
if (bindings?.get(event) !== binding) return;
|
|
500
|
-
bindings.delete(event);
|
|
501
|
-
renderer.removeEventListener(node, event, listener);
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
__name(addEventListener, "addEventListener");
|
|
505
|
-
function createComponent(component, props, source) {
|
|
506
|
-
const owner = createOwner();
|
|
507
|
-
const componentName = component.displayName || component.name || "anonymous";
|
|
508
|
-
setOwnerDebugName(owner, source ? `${componentName} (${source.file}:${source.line}:${source.column})` : componentName);
|
|
509
|
-
owner.onError((reason) => {
|
|
510
|
-
attachSourceLocation(reason, source);
|
|
511
|
-
attachComponentContext(reason, componentName, owner.id);
|
|
512
|
-
throw reason;
|
|
513
|
-
});
|
|
514
|
-
let node;
|
|
515
|
-
try {
|
|
516
|
-
node = owner.run(() => component(props));
|
|
517
|
-
} catch (error) {
|
|
518
|
-
owner.dispose();
|
|
519
|
-
attachSourceLocation(error, source);
|
|
520
|
-
attachComponentContext(error, componentName, owner.id);
|
|
521
|
-
throw error;
|
|
522
|
-
}
|
|
523
|
-
associateNodeOwner(node, owner);
|
|
524
|
-
const hmrKey = component.hmrKey;
|
|
525
|
-
if (hmrKey) {
|
|
526
|
-
const instance = {
|
|
527
|
-
node,
|
|
528
|
-
parent: null,
|
|
529
|
-
refresh() {
|
|
530
|
-
const previous = instance.node;
|
|
531
|
-
const next = owner.run(() => component(props));
|
|
532
|
-
if (instance.parent && !isVobsFragment(previous) && !isVobsFragment(next)) {
|
|
533
|
-
getRenderer().insertBefore(instance.parent, next, previous);
|
|
534
|
-
getRenderer().removeChild(instance.parent, previous);
|
|
535
|
-
}
|
|
536
|
-
nodeOwners.delete(previous);
|
|
537
|
-
nodeOwners.set(next, owner);
|
|
538
|
-
associateHmrInstance(next, instance);
|
|
539
|
-
instance.node = next;
|
|
540
|
-
}
|
|
541
|
-
};
|
|
542
|
-
associateHmrInstance(node, instance);
|
|
543
|
-
const separator = hmrKey.lastIndexOf(":");
|
|
544
|
-
const moduleId = separator < 0 ? hmrKey : hmrKey.slice(0, separator);
|
|
545
|
-
const cleanup = registerHmrInstance(moduleId, instance);
|
|
546
|
-
owner.onDispose(cleanup);
|
|
547
|
-
}
|
|
548
|
-
return node;
|
|
549
|
-
}
|
|
550
|
-
__name(createComponent, "createComponent");
|
|
551
|
-
function attachSourceLocation(reason, source) {
|
|
552
|
-
if (!source || (!reason || typeof reason !== "object" && typeof reason !== "function")) return;
|
|
553
|
-
const error = reason;
|
|
554
|
-
if (error.vobsSource) return;
|
|
555
|
-
try {
|
|
556
|
-
Object.defineProperty(error, "vobsSource", {
|
|
557
|
-
configurable: true,
|
|
558
|
-
enumerable: false,
|
|
559
|
-
value: source,
|
|
560
|
-
writable: false
|
|
561
|
-
});
|
|
562
|
-
} catch {
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
__name(attachSourceLocation, "attachSourceLocation");
|
|
566
|
-
function attachComponentContext(reason, component, ownerId) {
|
|
567
|
-
if (!reason || typeof reason !== "object" && typeof reason !== "function") return;
|
|
568
|
-
const error = reason;
|
|
569
|
-
try {
|
|
570
|
-
if (!error.vobsComponent) Object.defineProperty(error, "vobsComponent", { configurable: true, enumerable: false, value: component, writable: false });
|
|
571
|
-
if (!error.vobsOwnerId) Object.defineProperty(error, "vobsOwnerId", { configurable: true, enumerable: false, value: ownerId, writable: false });
|
|
572
|
-
} catch {
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
__name(attachComponentContext, "attachComponentContext");
|
|
576
|
-
function createBlock(factory) {
|
|
577
|
-
const owner = createOwner();
|
|
578
|
-
setOwnerDebugName(owner, "dynamic");
|
|
579
|
-
let node;
|
|
580
|
-
try {
|
|
581
|
-
node = owner.run(factory);
|
|
582
|
-
} catch (error) {
|
|
583
|
-
owner.dispose();
|
|
584
|
-
throw error;
|
|
585
|
-
}
|
|
586
|
-
if (!node) {
|
|
587
|
-
owner.dispose();
|
|
588
|
-
return null;
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
589
17
|
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}
|
|
593
|
-
__name(createBlock, "createBlock");
|
|
594
|
-
function associateNodeOwner(node, owner) {
|
|
595
|
-
nodeOwners.set(node, owner);
|
|
596
|
-
}
|
|
597
|
-
__name(associateNodeOwner, "associateNodeOwner");
|
|
598
|
-
function disposeNodeOwner(node) {
|
|
599
|
-
const owner = nodeOwners.get(node);
|
|
600
|
-
if (!owner) return;
|
|
601
|
-
nodeOwners.delete(node);
|
|
602
|
-
owner.dispose();
|
|
603
|
-
}
|
|
604
|
-
__name(disposeNodeOwner, "disposeNodeOwner");
|
|
605
|
-
|
|
606
|
-
// packages/runtime/src/fragment.ts
|
|
607
|
-
function createFragment(factory) {
|
|
608
|
-
const start = createComment("vobs:fragment:start");
|
|
609
|
-
const end = createComment("vobs:fragment:end");
|
|
610
|
-
let parent = null;
|
|
611
|
-
let initialized = false;
|
|
612
|
-
const owner = getCurrentOwner();
|
|
613
|
-
const fragment = {
|
|
614
|
-
kind: "vobs-fragment",
|
|
615
|
-
start,
|
|
616
|
-
end,
|
|
617
|
-
mount(nextParent, anchor) {
|
|
618
|
-
if (parent && parent !== nextParent) {
|
|
619
|
-
throw new Error("Vobs Fragment: \u4E0D\u80FD\u8DE8\u7236\u8282\u70B9\u79FB\u52A8 Fragment");
|
|
620
|
-
}
|
|
621
|
-
if (initialized) {
|
|
622
|
-
moveRange(nextParent, start, end, anchor);
|
|
623
|
-
return;
|
|
624
|
-
}
|
|
625
|
-
const renderer = getRenderer();
|
|
626
|
-
renderer.insertBefore(nextParent, start, anchor);
|
|
627
|
-
renderer.insertBefore(nextParent, end, anchor);
|
|
628
|
-
parent = nextParent;
|
|
629
|
-
initialized = true;
|
|
630
|
-
if (owner) owner.run(() => factory(nextParent, end));
|
|
631
|
-
else factory(nextParent, end);
|
|
632
|
-
},
|
|
633
|
-
unmount(nextParent) {
|
|
634
|
-
if (!initialized || parent !== nextParent) {
|
|
635
|
-
throw new Error("Vobs Fragment: Fragment \u4E0D\u5C5E\u4E8E\u6307\u5B9A\u7236\u8282\u70B9");
|
|
636
|
-
}
|
|
637
|
-
const renderer = getRenderer();
|
|
638
|
-
let current = renderer.nextSibling(start);
|
|
639
|
-
while (current && current !== end) {
|
|
640
|
-
const next = renderer.nextSibling(current);
|
|
641
|
-
renderer.removeChild(nextParent, current);
|
|
642
|
-
current = next;
|
|
643
|
-
}
|
|
644
|
-
renderer.removeChild(nextParent, start);
|
|
645
|
-
renderer.removeChild(nextParent, end);
|
|
646
|
-
parent = null;
|
|
647
|
-
initialized = false;
|
|
648
|
-
}
|
|
649
|
-
};
|
|
650
|
-
return fragment;
|
|
651
|
-
}
|
|
652
|
-
__name(createFragment, "createFragment");
|
|
653
|
-
function isVobsFragment(value) {
|
|
654
|
-
return Boolean(value) && typeof value === "object" && value.kind === "vobs-fragment";
|
|
655
|
-
}
|
|
656
|
-
__name(isVobsFragment, "isVobsFragment");
|
|
657
|
-
function moveRange(parent, start, end, anchor) {
|
|
658
|
-
const renderer = getRenderer();
|
|
659
|
-
const nodes = [start];
|
|
660
|
-
let current = renderer.nextSibling(start);
|
|
661
|
-
while (current) {
|
|
662
|
-
nodes.push(current);
|
|
663
|
-
if (current === end) break;
|
|
664
|
-
current = renderer.nextSibling(current);
|
|
665
|
-
}
|
|
666
|
-
if (nodes[nodes.length - 1] !== end) {
|
|
667
|
-
throw new Error("Vobs Fragment: \u627E\u4E0D\u5230\u7ED3\u675F\u951A\u70B9");
|
|
668
|
-
}
|
|
669
|
-
for (const node of nodes) renderer.insertBefore(parent, node, anchor);
|
|
670
|
-
}
|
|
671
|
-
__name(moveRange, "moveRange");
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
672
21
|
|
|
673
|
-
// packages/
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
if (current) removeChild(parent, current);
|
|
682
|
-
current = next;
|
|
683
|
-
if (current) insertBefore(parent, current, marker);
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
__name(insertDynamic, "insertDynamic");
|
|
22
|
+
// packages/table/src/data-table.ts
|
|
23
|
+
var data_table_exports = {};
|
|
24
|
+
__export(data_table_exports, {
|
|
25
|
+
KitDataTable: () => KitDataTable
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(data_table_exports);
|
|
28
|
+
var import_reactivity2 = require("@vobs/reactivity");
|
|
29
|
+
var import_vobs3 = require("@vobs/vobs");
|
|
687
30
|
|
|
688
31
|
// packages/table/src/utils.ts
|
|
32
|
+
var import_reactivity = require("@vobs/reactivity");
|
|
33
|
+
var import_vobs = require("@vobs/vobs");
|
|
689
34
|
function readProp(props, name, fallback) {
|
|
690
35
|
const value = Reflect.get(props, name);
|
|
691
36
|
return value === void 0 ? fallback : value;
|
|
@@ -696,29 +41,29 @@ function hasProp(props, name) {
|
|
|
696
41
|
}
|
|
697
42
|
__name(hasProp, "hasProp");
|
|
698
43
|
function bindClassList(root, props, classes) {
|
|
699
|
-
effect(() => {
|
|
44
|
+
(0, import_reactivity.effect)(() => {
|
|
700
45
|
const userClasses = [readString(props, "class"), readString(props, "className")];
|
|
701
|
-
setAttribute(root, "class", [...classes(), ...userClasses].filter(Boolean).join(" "));
|
|
46
|
+
(0, import_vobs.setAttribute)(root, "class", [...classes(), ...userClasses].filter(Boolean).join(" "));
|
|
702
47
|
});
|
|
703
48
|
}
|
|
704
49
|
__name(bindClassList, "bindClassList");
|
|
705
50
|
function bindCommonAttributes(root, props, skip) {
|
|
706
51
|
const ignored = /* @__PURE__ */ new Set([...skip, "class", "className", "style", "children"]);
|
|
707
|
-
effect(() => {
|
|
52
|
+
(0, import_reactivity.effect)(() => {
|
|
708
53
|
for (const name of Object.keys(props)) {
|
|
709
54
|
if (ignored.has(name) || name.startsWith("on")) continue;
|
|
710
55
|
if (name !== "id" && name !== "title" && name !== "role" && name !== "tabIndex" && !name.startsWith("aria-") && !name.startsWith("data-")) continue;
|
|
711
56
|
const value = Reflect.get(props, name);
|
|
712
57
|
if (value === void 0 || value === null || value === false) removeAttribute(root, normalizeAttributeName(name));
|
|
713
|
-
else setAttribute(root, normalizeAttributeName(name), String(value));
|
|
58
|
+
else (0, import_vobs.setAttribute)(root, normalizeAttributeName(name), String(value));
|
|
714
59
|
}
|
|
715
60
|
});
|
|
716
61
|
}
|
|
717
62
|
__name(bindCommonAttributes, "bindCommonAttributes");
|
|
718
63
|
function bindStyle(root, props, internal = () => "") {
|
|
719
|
-
effect(() => {
|
|
64
|
+
(0, import_reactivity.effect)(() => {
|
|
720
65
|
const value = [internal(), readString(props, "style")].filter(Boolean).join("; ");
|
|
721
|
-
if (value) setAttribute(root, "style", value);
|
|
66
|
+
if (value) (0, import_vobs.setAttribute)(root, "style", value);
|
|
722
67
|
else removeAttribute(root, "style");
|
|
723
68
|
});
|
|
724
69
|
}
|
|
@@ -726,12 +71,12 @@ __name(bindStyle, "bindStyle");
|
|
|
726
71
|
function resolveSlot(value) {
|
|
727
72
|
const resolved = typeof value === "function" ? value() : value;
|
|
728
73
|
if (resolved === void 0 || resolved === null) return null;
|
|
729
|
-
if (typeof resolved === "string" || typeof resolved === "number") return createText(String(resolved));
|
|
74
|
+
if (typeof resolved === "string" || typeof resolved === "number") return (0, import_vobs.createText)(String(resolved));
|
|
730
75
|
if (Array.isArray(resolved)) {
|
|
731
|
-
return createFragment((parent, anchor) => {
|
|
76
|
+
return (0, import_vobs.createFragment)((parent, anchor) => {
|
|
732
77
|
for (const child of resolved) {
|
|
733
78
|
const node = resolveSlot(child);
|
|
734
|
-
if (node) insertBefore(parent, node, anchor);
|
|
79
|
+
if (node) (0, import_vobs.insertBefore)(parent, node, anchor);
|
|
735
80
|
}
|
|
736
81
|
});
|
|
737
82
|
}
|
|
@@ -740,7 +85,7 @@ function resolveSlot(value) {
|
|
|
740
85
|
__name(resolveSlot, "resolveSlot");
|
|
741
86
|
function setOptionalAttribute(node, name, value) {
|
|
742
87
|
if (value === void 0 || value === null || value === false || value === "") removeAttribute(node, name);
|
|
743
|
-
else setAttribute(node, name, String(value));
|
|
88
|
+
else (0, import_vobs.setAttribute)(node, name, String(value));
|
|
744
89
|
}
|
|
745
90
|
__name(setOptionalAttribute, "setOptionalAttribute");
|
|
746
91
|
function normalizePixels(value) {
|
|
@@ -826,234 +171,16 @@ function removeAttribute(node, name) {
|
|
|
826
171
|
}
|
|
827
172
|
__name(removeAttribute, "removeAttribute");
|
|
828
173
|
|
|
829
|
-
// packages/ui/src/utils.ts
|
|
830
|
-
function readProp2(props, name, fallback) {
|
|
831
|
-
const value = Reflect.get(props, name);
|
|
832
|
-
return value === void 0 ? fallback : value;
|
|
833
|
-
}
|
|
834
|
-
__name(readProp2, "readProp");
|
|
835
|
-
function hasProp2(props, name) {
|
|
836
|
-
return name in props;
|
|
837
|
-
}
|
|
838
|
-
__name(hasProp2, "hasProp");
|
|
839
|
-
function mountSlot(parent, props, propName) {
|
|
840
|
-
insertDynamic(parent, null, () => resolveSlot2(Reflect.get(props, propName)));
|
|
841
|
-
}
|
|
842
|
-
__name(mountSlot, "mountSlot");
|
|
843
|
-
function resolveSlot2(value) {
|
|
844
|
-
const resolved = typeof value === "function" ? value() : value;
|
|
845
|
-
if (resolved === void 0 || resolved === null || resolved === false) return null;
|
|
846
|
-
if (typeof resolved === "string" || typeof resolved === "number") return createText(String(resolved));
|
|
847
|
-
if (Array.isArray(resolved)) {
|
|
848
|
-
const children = resolved;
|
|
849
|
-
return createFragment((parent, anchor) => {
|
|
850
|
-
for (const child of children) {
|
|
851
|
-
const node = resolveSlot2(child);
|
|
852
|
-
if (node) insertBefore(parent, node, anchor);
|
|
853
|
-
}
|
|
854
|
-
});
|
|
855
|
-
}
|
|
856
|
-
return resolved;
|
|
857
|
-
}
|
|
858
|
-
__name(resolveSlot2, "resolveSlot");
|
|
859
|
-
|
|
860
|
-
// packages/icon-core/src/index.ts
|
|
861
|
-
function createSvgIconNode(source, props = {}, options = {}) {
|
|
862
|
-
const root = createElement("span");
|
|
863
|
-
effect(() => {
|
|
864
|
-
updateSvgIconNode(root, typeof source === "function" ? source() : source, props, options);
|
|
865
|
-
});
|
|
866
|
-
return root;
|
|
867
|
-
}
|
|
868
|
-
__name(createSvgIconNode, "createSvgIconNode");
|
|
869
|
-
function updateSvgIconNode(root, definition, props, options) {
|
|
870
|
-
const size = readProp3(props, "size", void 0);
|
|
871
|
-
const width = readProp3(props, "width", size);
|
|
872
|
-
const height = readProp3(props, "height", size);
|
|
873
|
-
const normalizedWidth = normalizeSvgLength(width);
|
|
874
|
-
const normalizedHeight = normalizeSvgLength(height);
|
|
875
|
-
const userClass = [
|
|
876
|
-
readProp3(props, "class", void 0),
|
|
877
|
-
readProp3(props, "className", void 0)
|
|
878
|
-
].filter(hasText).join(" ");
|
|
879
|
-
const className = [options.class, options.className, userClass].filter(hasText).join(" ");
|
|
880
|
-
setAttribute(root, "class", className);
|
|
881
|
-
const internalStyle = size === void 0 ? "" : `width: ${normalizeCssLength(size)}; height: ${normalizeCssLength(size)}`;
|
|
882
|
-
const userStyle = readProp3(props, "style", void 0);
|
|
883
|
-
const style = [internalStyle, userStyle].filter(hasText).join("; ");
|
|
884
|
-
setOptionalAttribute2(root, "style", style || void 0);
|
|
885
|
-
const managedAttributes = /* @__PURE__ */ new Map();
|
|
886
|
-
for (const name of Object.keys(props)) {
|
|
887
|
-
if (name === "class" || name === "className" || name === "style" || name === "children") continue;
|
|
888
|
-
if (!name.startsWith("aria-") && !name.startsWith("data-") && !["id", "title", "role", "tabIndex"].includes(name)) continue;
|
|
889
|
-
const value = Reflect.get(props, name);
|
|
890
|
-
if (value === void 0 || value === null || value === false) continue;
|
|
891
|
-
managedAttributes.set(name === "tabIndex" ? "tabindex" : name, String(value));
|
|
892
|
-
}
|
|
893
|
-
for (const [name, value] of managedAttributes) setAttribute(root, name, value);
|
|
894
|
-
clearStaleAttributes(root, managedAttributes);
|
|
895
|
-
const title = readProp3(props, "title", void 0);
|
|
896
|
-
const ariaLabel = Reflect.get(props, "aria-label");
|
|
897
|
-
const decorative = readProp3(props, "decorative", title === void 0 && ariaLabel === void 0);
|
|
898
|
-
setOptionalAttribute2(root, "aria-hidden", decorative ? "true" : void 0);
|
|
899
|
-
setOptionalAttribute2(root, "aria-label", ariaLabel === void 0 ? title : void 0);
|
|
900
|
-
setOptionalAttribute2(root, "data-icon-name", options.dataIconName ?? definition?.name);
|
|
901
|
-
setOptionalAttribute2(root, "color", readProp3(props, "color", void 0));
|
|
902
|
-
if (!definition) {
|
|
903
|
-
setProperty(root, "innerHTML", "");
|
|
904
|
-
return;
|
|
905
|
-
}
|
|
906
|
-
const svgAttributes = {
|
|
907
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
908
|
-
viewBox: definition.viewBox ?? "0 0 24 24",
|
|
909
|
-
...options.defaultSvgAttributes,
|
|
910
|
-
...definition.attributes,
|
|
911
|
-
...normalizedWidth === void 0 ? {} : { width: normalizedWidth },
|
|
912
|
-
...normalizedHeight === void 0 ? {} : { height: normalizedHeight },
|
|
913
|
-
...readProp3(props, "color", void 0) === void 0 ? {} : { color: readProp3(props, "color", void 0) },
|
|
914
|
-
...readProp3(props, "stroke", void 0) === void 0 ? {} : { stroke: readProp3(props, "stroke", void 0) },
|
|
915
|
-
...readProp3(props, "fill", void 0) === void 0 ? {} : { fill: readProp3(props, "fill", void 0) },
|
|
916
|
-
...readProp3(props, "strokeWidth", void 0) === void 0 ? {} : { "stroke-width": readProp3(props, "strokeWidth", void 0) }
|
|
917
|
-
};
|
|
918
|
-
const markup = Object.entries(svgAttributes).filter(([, value]) => value !== void 0).map(([name, value]) => `${name}="${escapeXml(String(value))}"`).join(" ");
|
|
919
|
-
const titleMarkup = title === void 0 ? "" : `<title>${escapeXml(title)}</title>`;
|
|
920
|
-
setProperty(root, "innerHTML", `<svg ${markup} aria-hidden="true">${titleMarkup}${definition.body}</svg>`);
|
|
921
|
-
}
|
|
922
|
-
__name(updateSvgIconNode, "updateSvgIconNode");
|
|
923
|
-
function readProp3(props, name, fallback) {
|
|
924
|
-
const value = Reflect.get(props, name);
|
|
925
|
-
return value === void 0 ? fallback : value;
|
|
926
|
-
}
|
|
927
|
-
__name(readProp3, "readProp");
|
|
928
|
-
function hasText(value) {
|
|
929
|
-
return value !== void 0 && value.trim() !== "";
|
|
930
|
-
}
|
|
931
|
-
__name(hasText, "hasText");
|
|
932
|
-
function normalizeSvgLength(value) {
|
|
933
|
-
if (value === void 0) return void 0;
|
|
934
|
-
return typeof value === "number" ? String(value) : value;
|
|
935
|
-
}
|
|
936
|
-
__name(normalizeSvgLength, "normalizeSvgLength");
|
|
937
|
-
function normalizeCssLength(value) {
|
|
938
|
-
return typeof value === "number" || /^\d+(?:\.\d+)?$/u.test(value) ? `${value}px` : value;
|
|
939
|
-
}
|
|
940
|
-
__name(normalizeCssLength, "normalizeCssLength");
|
|
941
|
-
function setOptionalAttribute2(node, name, value) {
|
|
942
|
-
if (value === void 0 || value === null || value === false || value === "") {
|
|
943
|
-
node.removeAttribute(name);
|
|
944
|
-
return;
|
|
945
|
-
}
|
|
946
|
-
setAttribute(node, name, String(value));
|
|
947
|
-
}
|
|
948
|
-
__name(setOptionalAttribute2, "setOptionalAttribute");
|
|
949
|
-
function clearStaleAttributes(node, next) {
|
|
950
|
-
const previous = node.__vobsIconAttributes ?? /* @__PURE__ */ new Set();
|
|
951
|
-
for (const name of previous) {
|
|
952
|
-
if (!next.has(name)) node.removeAttribute(name);
|
|
953
|
-
}
|
|
954
|
-
node.__vobsIconAttributes = new Set(next.keys());
|
|
955
|
-
}
|
|
956
|
-
__name(clearStaleAttributes, "clearStaleAttributes");
|
|
957
|
-
function escapeXml(value) {
|
|
958
|
-
return value.replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">").replace(/"/gu, """);
|
|
959
|
-
}
|
|
960
|
-
__name(escapeXml, "escapeXml");
|
|
961
|
-
|
|
962
|
-
// packages/ui/src/icon.ts
|
|
963
|
-
function Icon(props = {}) {
|
|
964
|
-
const root = createSvgIconNode(() => {
|
|
965
|
-
const definition = resolveIcon(
|
|
966
|
-
readProp2(props, "icon", void 0) ?? readProp2(props, "name", void 0)
|
|
967
|
-
);
|
|
968
|
-
if (!definition) {
|
|
969
|
-
if (hasProp2(props, "children")) return void 0;
|
|
970
|
-
throw new Error("Vobs UI: Icon requires a registered `name` or an `icon` definition");
|
|
971
|
-
}
|
|
972
|
-
return iconDefinitionToSvg(definition);
|
|
973
|
-
}, props, {
|
|
974
|
-
class: "vui-icon icon",
|
|
975
|
-
defaultSvgAttributes: {
|
|
976
|
-
fill: "none",
|
|
977
|
-
stroke: "currentColor",
|
|
978
|
-
"stroke-width": 2,
|
|
979
|
-
"stroke-linecap": "butt",
|
|
980
|
-
"stroke-linejoin": "miter"
|
|
981
|
-
}
|
|
982
|
-
});
|
|
983
|
-
if (hasProp2(props, "children")) mountSlot(root, props, "children");
|
|
984
|
-
return root;
|
|
985
|
-
}
|
|
986
|
-
__name(Icon, "Icon");
|
|
987
|
-
function iconDefinitionToSvg(definition) {
|
|
988
|
-
return {
|
|
989
|
-
name: definition.name,
|
|
990
|
-
body: definition.path,
|
|
991
|
-
viewBox: definition.viewBox
|
|
992
|
-
};
|
|
993
|
-
}
|
|
994
|
-
__name(iconDefinitionToSvg, "iconDefinitionToSvg");
|
|
995
|
-
var VUI_ICON_PATHS = {
|
|
996
|
-
search: '<circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/>',
|
|
997
|
-
check: '<polyline points="4 12 10 18 20 6"/>',
|
|
998
|
-
x: '<line x1="6" y1="6" x2="18" y2="18"/><line x1="18" y1="6" x2="6" y2="18"/>',
|
|
999
|
-
plus: '<line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>',
|
|
1000
|
-
minus: '<line x1="5" y1="12" x2="19" y2="12"/>',
|
|
1001
|
-
"chevron-right": '<polyline points="9 6 15 12 9 18"/>',
|
|
1002
|
-
"chevron-down": '<polyline points="6 9 12 15 18 9"/>',
|
|
1003
|
-
"chevron-up": '<polyline points="6 15 12 9 18 15"/>',
|
|
1004
|
-
"chevron-left": '<polyline points="15 6 9 12 15 18"/>',
|
|
1005
|
-
"arrow-left": '<line x1="20" y1="12" x2="4" y2="12"/><polyline points="10 6 4 12 10 18"/>',
|
|
1006
|
-
"arrow-right": '<line x1="4" y1="12" x2="20" y2="12"/><polyline points="14 6 20 12 14 18"/>',
|
|
1007
|
-
"arrow-up": '<line x1="12" y1="20" x2="12" y2="4"/><polyline points="6 10 12 4 18 10"/>',
|
|
1008
|
-
"arrow-down": '<line x1="12" y1="4" x2="12" y2="20"/><polyline points="6 14 12 20 18 14"/>',
|
|
1009
|
-
atom: '<circle cx="12" cy="12" r="2"/><ellipse cx="12" cy="12" rx="10" ry="4"/><ellipse cx="12" cy="12" rx="10" ry="4" transform="rotate(60 12 12)"/><ellipse cx="12" cy="12" rx="10" ry="4" transform="rotate(120 12 12)"/>',
|
|
1010
|
-
globe: '<circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"/>',
|
|
1011
|
-
"arrow-expand": '<polyline points="14 4 20 4 20 10"/><line x1="14" y1="10" x2="20" y2="4"/><polyline points="10 20 4 20 4 14"/><line x1="10" y1="14" x2="4" y2="20"/>',
|
|
1012
|
-
"arrow-minimize": '<polyline points="20 4 14 10 20 10"/><line x1="14" y1="10" x2="14" y2="4"/><polyline points="4 20 10 14 4 14"/><line x1="10" y1="14" x2="10" y2="20"/>',
|
|
1013
|
-
"check-circle": '<circle cx="12" cy="12" r="9"/><polyline points="8 12 11 15 16 9"/>',
|
|
1014
|
-
"alert-circle": '<circle cx="12" cy="12" r="9"/><line x1="12" y1="8" x2="12" y2="13"/><line x1="12" y1="16" x2="12" y2="16.01"/>',
|
|
1015
|
-
"alert-triangle": '<path d="M12 3 22 20 2 20 Z"/><line x1="12" y1="10" x2="12" y2="15"/><line x1="12" y1="18" x2="12" y2="18.01"/>',
|
|
1016
|
-
info: '<circle cx="12" cy="12" r="9"/><line x1="12" y1="11" x2="12" y2="16"/><line x1="12" y1="8" x2="12" y2="8.01"/>',
|
|
1017
|
-
home: '<polygon points="3 11 12 3 21 11 21 21 14 21 14 14 10 14 10 21 3 21 3 11"/>',
|
|
1018
|
-
user: '<path d="M4 21v-1a6 6 0 0 1 6-6h4a6 6 0 0 1 6 6v1"/><circle cx="12" cy="8" r="4"/>',
|
|
1019
|
-
settings: '<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/>',
|
|
1020
|
-
menu: '<line x1="4" y1="6" x2="20" y2="6"/><line x1="4" y1="12" x2="20" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/>',
|
|
1021
|
-
"more-h": '<circle cx="5" cy="12" r="1.5" fill="currentColor"/><circle cx="12" cy="12" r="1.5" fill="currentColor"/><circle cx="19" cy="12" r="1.5" fill="currentColor"/>',
|
|
1022
|
-
calendar: '<rect x="3" y="5" width="18" height="16"/><line x1="3" y1="10" x2="21" y2="10"/><line x1="8" y1="3" x2="8" y2="7"/><line x1="16" y1="3" x2="16" y2="7"/>',
|
|
1023
|
-
filter: '<polygon points="3 4 21 4 14 12 14 20 10 18 10 12 3 4"/>',
|
|
1024
|
-
sort: '<path d="M8 20V4"/><polyline points="4 8 8 4 12 8"/><path d="M16 4v16"/><polyline points="12 16 16 20 20 16"/>',
|
|
1025
|
-
edit: '<path d="M4 20h4l10-10-4-4L4 16v4z"/><path d="M14 6l4 4"/>',
|
|
1026
|
-
trash: '<polyline points="4 6 20 6"/><path d="M6 6v14h12V6"/><path d="M9 6V4h6v2"/><line x1="10" y1="10" x2="10" y2="17"/><line x1="14" y1="10" x2="14" y2="17"/>',
|
|
1027
|
-
download: '<path d="M12 3v12"/><polyline points="7 10 12 15 17 10"/><line x1="3" y1="21" x2="21" y2="21"/>',
|
|
1028
|
-
upload: '<path d="M12 21V6"/><polyline points="7 11 12 6 17 11"/><line x1="3" y1="21" x2="21" y2="21"/>',
|
|
1029
|
-
pause: '<line x1="9" y1="5" x2="9" y2="19"/><line x1="15" y1="5" x2="15" y2="19"/>',
|
|
1030
|
-
play: '<polygon points="8 5 19 12 8 19 8 5"/>',
|
|
1031
|
-
refresh: '<polyline points="21 4 21 10 15 10"/><polyline points="3 20 3 14 9 14"/><path d="M20.5 9A9 9 0 0 0 5 5.5L3 7M3.5 15A9 9 0 0 0 19 18.5L21 17"/>',
|
|
1032
|
-
bell: '<path d="M6 8a6 6 0 0 1 12 0c0 7 3 8 3 8H3s3-1 3-8z"/><path d="M10 21a2 2 0 0 0 4 0"/>',
|
|
1033
|
-
folder: '<path d="M3 6h6l2 3h10v10H3z"/>',
|
|
1034
|
-
code: '<polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/>',
|
|
1035
|
-
sparkles: '<path d="M12 3l1.8 4.2L18 9l-4.2 1.8L12 15l-1.8-4.2L6 9l4.2-1.8L12 3z"/><path d="M19 14l1 2.2 2.2 1-2.2 1L19 20.4l-1-2.2-2.2-1 2.2-1L19 14z"/>',
|
|
1036
|
-
zap: '<polygon points="13 2 4 14 12 14 11 22 20 10 12 10 13 2"/>',
|
|
1037
|
-
sun: '<circle cx="12" cy="12" r="4"/><line x1="12" y1="2" x2="12" y2="5"/><line x1="12" y1="19" x2="12" y2="22"/><line x1="2" y1="12" x2="5" y2="12"/><line x1="19" y1="12" x2="22" y2="12"/><line x1="4.6" y1="4.6" x2="6.7" y2="6.7"/><line x1="17.3" y1="17.3" x2="19.4" y2="19.4"/><line x1="4.6" y1="19.4" x2="6.7" y2="17.3"/><line x1="17.3" y1="6.7" x2="19.4" y2="4.6"/>',
|
|
1038
|
-
moon: '<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/>',
|
|
1039
|
-
terminal: '<polyline points="4 7 9 12 4 17"/><line x1="12" y1="17" x2="20" y2="17"/>'
|
|
1040
|
-
};
|
|
1041
|
-
var iconRegistry = new Map(
|
|
1042
|
-
Object.entries(VUI_ICON_PATHS).map(([name, path]) => [name, { name, path }])
|
|
1043
|
-
);
|
|
1044
|
-
function resolveIcon(icon) {
|
|
1045
|
-
return typeof icon === "string" ? iconRegistry.get(icon) : icon;
|
|
1046
|
-
}
|
|
1047
|
-
__name(resolveIcon, "resolveIcon");
|
|
1048
|
-
|
|
1049
174
|
// packages/table/src/icons.ts
|
|
175
|
+
var import_vobs2 = require("@vobs/vobs");
|
|
176
|
+
var import_ui = require("@vobs/ui");
|
|
1050
177
|
function defaultIcons() {
|
|
1051
178
|
return {
|
|
1052
|
-
ascending: /* @__PURE__ */ __name(() => createComponent(Icon, { name: "chevron-up" }), "ascending"),
|
|
1053
|
-
descending: /* @__PURE__ */ __name(() => createComponent(Icon, { name: "chevron-down" }), "descending"),
|
|
1054
|
-
unsorted: /* @__PURE__ */ __name(() => createComponent(Icon, { name: "sort" }), "unsorted"),
|
|
1055
|
-
previous: /* @__PURE__ */ __name(() => createComponent(Icon, { name: "chevron-left" }), "previous"),
|
|
1056
|
-
next: /* @__PURE__ */ __name(() => createComponent(Icon, { name: "chevron-right" }), "next")
|
|
179
|
+
ascending: /* @__PURE__ */ __name(() => (0, import_vobs2.createComponent)(import_ui.Icon, { name: "chevron-up" }), "ascending"),
|
|
180
|
+
descending: /* @__PURE__ */ __name(() => (0, import_vobs2.createComponent)(import_ui.Icon, { name: "chevron-down" }), "descending"),
|
|
181
|
+
unsorted: /* @__PURE__ */ __name(() => (0, import_vobs2.createComponent)(import_ui.Icon, { name: "sort" }), "unsorted"),
|
|
182
|
+
previous: /* @__PURE__ */ __name(() => (0, import_vobs2.createComponent)(import_ui.Icon, { name: "chevron-left" }), "previous"),
|
|
183
|
+
next: /* @__PURE__ */ __name(() => (0, import_vobs2.createComponent)(import_ui.Icon, { name: "chevron-right" }), "next")
|
|
1057
184
|
};
|
|
1058
185
|
}
|
|
1059
186
|
__name(defaultIcons, "defaultIcons");
|
|
@@ -1066,15 +193,15 @@ var DEFAULT_ROW_HEIGHT = 40;
|
|
|
1066
193
|
var DEFAULT_VIRTUAL_HEIGHT = 400;
|
|
1067
194
|
var textCollator = new Intl.Collator(void 0, { numeric: true, sensitivity: "base" });
|
|
1068
195
|
function KitDataTable(props = {}) {
|
|
1069
|
-
const root = createElement("section");
|
|
1070
|
-
const toolbar = createElement("div");
|
|
1071
|
-
const viewport = createElement("div");
|
|
1072
|
-
const table = createElement("table");
|
|
1073
|
-
const head = createElement("thead");
|
|
1074
|
-
const body = createElement("tbody");
|
|
1075
|
-
const footer = createElement("footer");
|
|
1076
|
-
const scrollTop = state(0);
|
|
1077
|
-
internalQueries.set(props, state({
|
|
196
|
+
const root = (0, import_vobs3.createElement)("section");
|
|
197
|
+
const toolbar = (0, import_vobs3.createElement)("div");
|
|
198
|
+
const viewport = (0, import_vobs3.createElement)("div");
|
|
199
|
+
const table = (0, import_vobs3.createElement)("table");
|
|
200
|
+
const head = (0, import_vobs3.createElement)("thead");
|
|
201
|
+
const body = (0, import_vobs3.createElement)("tbody");
|
|
202
|
+
const footer = (0, import_vobs3.createElement)("footer");
|
|
203
|
+
const scrollTop = (0, import_reactivity2.state)(0);
|
|
204
|
+
internalQueries.set(props, (0, import_reactivity2.state)({
|
|
1078
205
|
page: 1,
|
|
1079
206
|
pageSize: DEFAULT_PAGE_SIZE,
|
|
1080
207
|
sort: null,
|
|
@@ -1123,79 +250,79 @@ function KitDataTable(props = {}) {
|
|
|
1123
250
|
"onVisibleColumnIdsChange"
|
|
1124
251
|
]);
|
|
1125
252
|
bindStyle(root, props);
|
|
1126
|
-
setAttribute(toolbar, "class", "vobs-data-table__toolbar");
|
|
1127
|
-
setAttribute(viewport, "class", "vobs-data-table__viewport");
|
|
1128
|
-
setAttribute(viewport, "data-vobs-scrollable", "true");
|
|
1129
|
-
setAttribute(table, "class", "vobs-data-table__table");
|
|
1130
|
-
setAttribute(footer, "class", "vobs-data-table__footer");
|
|
1131
|
-
if (hasProp(props, "toolbar")) insertDynamic(toolbar, null, () => resolveSlot(readProp(props, "toolbar", void 0)));
|
|
1132
|
-
effect(() => {
|
|
1133
|
-
setProperty(toolbar, "hidden", !hasProp(props, "toolbar"));
|
|
253
|
+
(0, import_vobs3.setAttribute)(toolbar, "class", "vobs-data-table__toolbar");
|
|
254
|
+
(0, import_vobs3.setAttribute)(viewport, "class", "vobs-data-table__viewport");
|
|
255
|
+
(0, import_vobs3.setAttribute)(viewport, "data-vobs-scrollable", "true");
|
|
256
|
+
(0, import_vobs3.setAttribute)(table, "class", "vobs-data-table__table");
|
|
257
|
+
(0, import_vobs3.setAttribute)(footer, "class", "vobs-data-table__footer");
|
|
258
|
+
if (hasProp(props, "toolbar")) (0, import_vobs3.insertDynamic)(toolbar, null, () => resolveSlot(readProp(props, "toolbar", void 0)));
|
|
259
|
+
(0, import_reactivity2.effect)(() => {
|
|
260
|
+
(0, import_vobs3.setProperty)(toolbar, "hidden", !hasProp(props, "toolbar"));
|
|
1134
261
|
});
|
|
1135
|
-
effect(() => {
|
|
262
|
+
(0, import_reactivity2.effect)(() => {
|
|
1136
263
|
const virtual = readProp(props, "virtual", false);
|
|
1137
|
-
setProperty(viewport, "tabIndex", virtual ? 0 : -1);
|
|
1138
|
-
setAttribute(viewport, "style", virtual ? `max-height: ${normalizeHeight(readProp(props, "virtualHeight", DEFAULT_VIRTUAL_HEIGHT))}; overflow: auto` : "");
|
|
264
|
+
(0, import_vobs3.setProperty)(viewport, "tabIndex", virtual ? 0 : -1);
|
|
265
|
+
(0, import_vobs3.setAttribute)(viewport, "style", virtual ? `max-height: ${normalizeHeight(readProp(props, "virtualHeight", DEFAULT_VIRTUAL_HEIGHT))}; overflow: auto` : "");
|
|
1139
266
|
});
|
|
1140
|
-
addEventListener(viewport, "scroll", () => {
|
|
267
|
+
(0, import_vobs3.addEventListener)(viewport, "scroll", () => {
|
|
1141
268
|
scrollTop.value = viewport.scrollTop;
|
|
1142
269
|
});
|
|
1143
|
-
insertDynamic(head, null, () => createHeader(props));
|
|
1144
|
-
insertDynamic(body, null, () => createBody(props, scrollTop.value));
|
|
1145
|
-
insertBefore(table, head, null);
|
|
1146
|
-
insertBefore(table, body, null);
|
|
1147
|
-
insertBefore(viewport, table, null);
|
|
1148
|
-
insertDynamic(footer, null, () => createFooter(props));
|
|
1149
|
-
effect(() => {
|
|
1150
|
-
setProperty(footer, "hidden", !shouldShowFooter(props));
|
|
270
|
+
(0, import_vobs3.insertDynamic)(head, null, () => createHeader(props));
|
|
271
|
+
(0, import_vobs3.insertDynamic)(body, null, () => createBody(props, scrollTop.value));
|
|
272
|
+
(0, import_vobs3.insertBefore)(table, head, null);
|
|
273
|
+
(0, import_vobs3.insertBefore)(table, body, null);
|
|
274
|
+
(0, import_vobs3.insertBefore)(viewport, table, null);
|
|
275
|
+
(0, import_vobs3.insertDynamic)(footer, null, () => createFooter(props));
|
|
276
|
+
(0, import_reactivity2.effect)(() => {
|
|
277
|
+
(0, import_vobs3.setProperty)(footer, "hidden", !shouldShowFooter(props));
|
|
1151
278
|
});
|
|
1152
|
-
insertBefore(root, toolbar, null);
|
|
1153
|
-
insertBefore(root, viewport, null);
|
|
1154
|
-
insertBefore(root, footer, null);
|
|
279
|
+
(0, import_vobs3.insertBefore)(root, toolbar, null);
|
|
280
|
+
(0, import_vobs3.insertBefore)(root, viewport, null);
|
|
281
|
+
(0, import_vobs3.insertBefore)(root, footer, null);
|
|
1155
282
|
return root;
|
|
1156
283
|
}
|
|
1157
284
|
__name(KitDataTable, "KitDataTable");
|
|
1158
285
|
function createHeader(props) {
|
|
1159
286
|
const columns = visibleColumns(props);
|
|
1160
|
-
return createFragment((parent, anchor) => {
|
|
1161
|
-
const row = createElement("tr");
|
|
287
|
+
return (0, import_vobs3.createFragment)((parent, anchor) => {
|
|
288
|
+
const row = (0, import_vobs3.createElement)("tr");
|
|
1162
289
|
for (const column of columns) {
|
|
1163
|
-
const cell = createElement("th");
|
|
1164
|
-
setAttribute(cell, "scope", "col");
|
|
1165
|
-
setAttribute(cell, "data-column-id", column.id);
|
|
290
|
+
const cell = (0, import_vobs3.createElement)("th");
|
|
291
|
+
(0, import_vobs3.setAttribute)(cell, "scope", "col");
|
|
292
|
+
(0, import_vobs3.setAttribute)(cell, "data-column-id", column.id);
|
|
1166
293
|
applyColumnStyle(cell, column, readProp(props, "columnSettings", void 0));
|
|
1167
|
-
if (column.sortable) insertBefore(cell, createSortButton(props, column, cell), null);
|
|
1168
|
-
else insertBefore(cell, createText(column.label), null);
|
|
1169
|
-
insertBefore(row, cell, null);
|
|
294
|
+
if (column.sortable) (0, import_vobs3.insertBefore)(cell, createSortButton(props, column, cell), null);
|
|
295
|
+
else (0, import_vobs3.insertBefore)(cell, (0, import_vobs3.createText)(column.label), null);
|
|
296
|
+
(0, import_vobs3.insertBefore)(row, cell, null);
|
|
1170
297
|
}
|
|
1171
|
-
insertBefore(parent, row, anchor);
|
|
298
|
+
(0, import_vobs3.insertBefore)(parent, row, anchor);
|
|
1172
299
|
});
|
|
1173
300
|
}
|
|
1174
301
|
__name(createHeader, "createHeader");
|
|
1175
302
|
function createSortButton(props, column, cell) {
|
|
1176
|
-
const button = createElement("button");
|
|
1177
|
-
const label = createElement("span");
|
|
1178
|
-
const icon = createElement("span");
|
|
1179
|
-
setAttribute(button, "type", "button");
|
|
1180
|
-
setAttribute(button, "class", "vobs-data-table__sort");
|
|
1181
|
-
setAttribute(button, "aria-label", `Sort by ${column.label}`);
|
|
1182
|
-
setAttribute(label, "class", "vobs-data-table__sort-label");
|
|
1183
|
-
setAttribute(icon, "class", "vobs-data-table__sort-icon");
|
|
1184
|
-
insertBefore(label, createText(column.label), null);
|
|
1185
|
-
insertDynamic(icon, null, () => resolveSlot(sortIcon(props, currentSort(props), column.id)));
|
|
1186
|
-
effect(() => {
|
|
303
|
+
const button = (0, import_vobs3.createElement)("button");
|
|
304
|
+
const label = (0, import_vobs3.createElement)("span");
|
|
305
|
+
const icon = (0, import_vobs3.createElement)("span");
|
|
306
|
+
(0, import_vobs3.setAttribute)(button, "type", "button");
|
|
307
|
+
(0, import_vobs3.setAttribute)(button, "class", "vobs-data-table__sort");
|
|
308
|
+
(0, import_vobs3.setAttribute)(button, "aria-label", `Sort by ${column.label}`);
|
|
309
|
+
(0, import_vobs3.setAttribute)(label, "class", "vobs-data-table__sort-label");
|
|
310
|
+
(0, import_vobs3.setAttribute)(icon, "class", "vobs-data-table__sort-icon");
|
|
311
|
+
(0, import_vobs3.insertBefore)(label, (0, import_vobs3.createText)(column.label), null);
|
|
312
|
+
(0, import_vobs3.insertDynamic)(icon, null, () => resolveSlot(sortIcon(props, currentSort(props), column.id)));
|
|
313
|
+
(0, import_reactivity2.effect)(() => {
|
|
1187
314
|
const sort = currentSort(props);
|
|
1188
315
|
const direction = sort?.columnId === column.id ? sort.direction : void 0;
|
|
1189
316
|
setOptionalAttribute(cell, "aria-sort", direction ? direction === "asc" ? "ascending" : "descending" : void 0);
|
|
1190
317
|
setOptionalAttribute(cell, "data-sort-direction", direction);
|
|
1191
318
|
});
|
|
1192
|
-
addEventListener(button, "click", () => {
|
|
319
|
+
(0, import_vobs3.addEventListener)(button, "click", () => {
|
|
1193
320
|
const current = currentSort(props);
|
|
1194
321
|
const next = current?.columnId === column.id ? current.direction === "asc" ? createSort(column, "desc") : null : createSort(column, "asc");
|
|
1195
322
|
emitQuery(props, { ...currentQuery(props), sort: next, page: 1 });
|
|
1196
323
|
});
|
|
1197
|
-
insertBefore(button, label, null);
|
|
1198
|
-
insertBefore(button, icon, null);
|
|
324
|
+
(0, import_vobs3.insertBefore)(button, label, null);
|
|
325
|
+
(0, import_vobs3.insertBefore)(button, icon, null);
|
|
1199
326
|
return button;
|
|
1200
327
|
}
|
|
1201
328
|
__name(createSortButton, "createSortButton");
|
|
@@ -1207,73 +334,73 @@ function createBody(props, scrollTop) {
|
|
|
1207
334
|
if (page.rows.length === 0) return createStateRow(props, "empty");
|
|
1208
335
|
const columns = visibleColumns(props);
|
|
1209
336
|
const window = resolveWindow(props, page.rows.length, scrollTop);
|
|
1210
|
-
const fragment = createFragment((parent, anchor) => {
|
|
1211
|
-
if (window.before > 0) insertBefore(parent, createSpacerRow(columns.length, window.before), anchor);
|
|
337
|
+
const fragment = (0, import_vobs3.createFragment)((parent, anchor) => {
|
|
338
|
+
if (window.before > 0) (0, import_vobs3.insertBefore)(parent, createSpacerRow(columns.length, window.before), anchor);
|
|
1212
339
|
for (let index = window.start; index < window.end; index++) {
|
|
1213
|
-
insertBefore(parent, createRow(props, page.rows[index], index, columns), anchor);
|
|
340
|
+
(0, import_vobs3.insertBefore)(parent, createRow(props, page.rows[index], index, columns), anchor);
|
|
1214
341
|
}
|
|
1215
|
-
if (window.after > 0) insertBefore(parent, createSpacerRow(columns.length, window.after), anchor);
|
|
342
|
+
if (window.after > 0) (0, import_vobs3.insertBefore)(parent, createSpacerRow(columns.length, window.after), anchor);
|
|
1216
343
|
});
|
|
1217
344
|
return fragment;
|
|
1218
345
|
}
|
|
1219
346
|
__name(createBody, "createBody");
|
|
1220
347
|
function createStateRow(props, kind, error) {
|
|
1221
|
-
const row = createElement("tr");
|
|
1222
|
-
const cell = createElement("td");
|
|
1223
|
-
setAttribute(cell, "class", `vobs-data-table__state vobs-data-table__state--${kind}`);
|
|
1224
|
-
setAttribute(cell, "colspan", String(Math.max(1, visibleColumns(props).length)));
|
|
348
|
+
const row = (0, import_vobs3.createElement)("tr");
|
|
349
|
+
const cell = (0, import_vobs3.createElement)("td");
|
|
350
|
+
(0, import_vobs3.setAttribute)(cell, "class", `vobs-data-table__state vobs-data-table__state--${kind}`);
|
|
351
|
+
(0, import_vobs3.setAttribute)(cell, "colspan", String(Math.max(1, visibleColumns(props).length)));
|
|
1225
352
|
let content;
|
|
1226
353
|
if (kind === "error") {
|
|
1227
354
|
const fallback = readProp(props, "error", void 0);
|
|
1228
355
|
const resource = readProp(props, "resource", void 0);
|
|
1229
|
-
content = fallback ? resolveSlot(fallback(error, () => resource?.refetch() ?? Promise.resolve())) : createText(error?.message ?? "Unable to load data");
|
|
356
|
+
content = fallback ? resolveSlot(fallback(error, () => resource?.refetch() ?? Promise.resolve())) : (0, import_vobs3.createText)(error?.message ?? "Unable to load data");
|
|
1230
357
|
} else {
|
|
1231
|
-
content = resolveSlot(readProp(props, kind, void 0)) ?? createText(kind === "loading" ? "Loading..." : "No data");
|
|
358
|
+
content = resolveSlot(readProp(props, kind, void 0)) ?? (0, import_vobs3.createText)(kind === "loading" ? "Loading..." : "No data");
|
|
1232
359
|
}
|
|
1233
|
-
if (content) insertBefore(cell, content, null);
|
|
1234
|
-
insertBefore(row, cell, null);
|
|
360
|
+
if (content) (0, import_vobs3.insertBefore)(cell, content, null);
|
|
361
|
+
(0, import_vobs3.insertBefore)(row, cell, null);
|
|
1235
362
|
return row;
|
|
1236
363
|
}
|
|
1237
364
|
__name(createStateRow, "createStateRow");
|
|
1238
365
|
function createRow(props, row, index, columns) {
|
|
1239
|
-
const tableRow = createElement("tr");
|
|
366
|
+
const tableRow = (0, import_vobs3.createElement)("tr");
|
|
1240
367
|
const rowKey = readProp(props, "rowKey", void 0);
|
|
1241
368
|
if (rowKey) setOptionalAttribute(tableRow, "data-row-key", rowKey(row, index));
|
|
1242
369
|
const onRowClick = readProp(props, "onRowClick", void 0);
|
|
1243
370
|
if (onRowClick) {
|
|
1244
|
-
setProperty(tableRow, "tabIndex", 0);
|
|
1245
|
-
setAttribute(tableRow, "data-clickable", "true");
|
|
1246
|
-
addEventListener(tableRow, "click", () => onRowClick(row, index));
|
|
371
|
+
(0, import_vobs3.setProperty)(tableRow, "tabIndex", 0);
|
|
372
|
+
(0, import_vobs3.setAttribute)(tableRow, "data-clickable", "true");
|
|
373
|
+
(0, import_vobs3.addEventListener)(tableRow, "click", () => onRowClick(row, index));
|
|
1247
374
|
}
|
|
1248
375
|
for (const column of columns) {
|
|
1249
|
-
const cell = createElement("td");
|
|
1250
|
-
setAttribute(cell, "data-column-id", column.id);
|
|
376
|
+
const cell = (0, import_vobs3.createElement)("td");
|
|
377
|
+
(0, import_vobs3.setAttribute)(cell, "data-column-id", column.id);
|
|
1251
378
|
applyColumnStyle(cell, column, readProp(props, "columnSettings", void 0));
|
|
1252
|
-
insertDynamic(cell, null, () => resolveSlot(column.render ? column.render(row, index) : column.key === void 0 ? void 0 : readRowValue(row, column.key)));
|
|
1253
|
-
insertBefore(tableRow, cell, null);
|
|
379
|
+
(0, import_vobs3.insertDynamic)(cell, null, () => resolveSlot(column.render ? column.render(row, index) : column.key === void 0 ? void 0 : readRowValue(row, column.key)));
|
|
380
|
+
(0, import_vobs3.insertBefore)(tableRow, cell, null);
|
|
1254
381
|
}
|
|
1255
382
|
return tableRow;
|
|
1256
383
|
}
|
|
1257
384
|
__name(createRow, "createRow");
|
|
1258
385
|
function createSpacerRow(columnCount, height) {
|
|
1259
|
-
const row = createElement("tr");
|
|
1260
|
-
const cell = createElement("td");
|
|
1261
|
-
setAttribute(cell, "class", "vobs-data-table__spacer");
|
|
1262
|
-
setAttribute(cell, "colspan", String(Math.max(1, columnCount)));
|
|
1263
|
-
setAttribute(cell, "style", `height: ${height}px`);
|
|
1264
|
-
insertBefore(row, cell, null);
|
|
386
|
+
const row = (0, import_vobs3.createElement)("tr");
|
|
387
|
+
const cell = (0, import_vobs3.createElement)("td");
|
|
388
|
+
(0, import_vobs3.setAttribute)(cell, "class", "vobs-data-table__spacer");
|
|
389
|
+
(0, import_vobs3.setAttribute)(cell, "colspan", String(Math.max(1, columnCount)));
|
|
390
|
+
(0, import_vobs3.setAttribute)(cell, "style", `height: ${height}px`);
|
|
391
|
+
(0, import_vobs3.insertBefore)(row, cell, null);
|
|
1265
392
|
return row;
|
|
1266
393
|
}
|
|
1267
394
|
__name(createSpacerRow, "createSpacerRow");
|
|
1268
395
|
function createFooter(props) {
|
|
1269
396
|
const custom = readProp(props, "footer", void 0);
|
|
1270
|
-
if (custom !== void 0) return resolveSlot(custom) ?? createText("");
|
|
397
|
+
if (custom !== void 0) return resolveSlot(custom) ?? (0, import_vobs3.createText)("");
|
|
1271
398
|
const pagination = resolvePaginationState(props);
|
|
1272
|
-
const root = createElement("div");
|
|
1273
|
-
const summary = createElement("span");
|
|
1274
|
-
setAttribute(root, "class", "vobs-data-table__footer-content");
|
|
1275
|
-
setAttribute(summary, "class", "vobs-data-table__summary");
|
|
1276
|
-
insertBefore(summary, createText(pageLabel(
|
|
399
|
+
const root = (0, import_vobs3.createElement)("div");
|
|
400
|
+
const summary = (0, import_vobs3.createElement)("span");
|
|
401
|
+
(0, import_vobs3.setAttribute)(root, "class", "vobs-data-table__footer-content");
|
|
402
|
+
(0, import_vobs3.setAttribute)(summary, "class", "vobs-data-table__summary");
|
|
403
|
+
(0, import_vobs3.insertBefore)(summary, (0, import_vobs3.createText)(pageLabel(
|
|
1277
404
|
props,
|
|
1278
405
|
pagination.page,
|
|
1279
406
|
pagination.pageCount,
|
|
@@ -1282,8 +409,8 @@ function createFooter(props) {
|
|
|
1282
409
|
pagination.pageSize
|
|
1283
410
|
)), null);
|
|
1284
411
|
const actions = hasProp(props, "pagination") ? createCustomPagination(props, pagination) : createPagination(props, pagination);
|
|
1285
|
-
insertBefore(root, summary, null);
|
|
1286
|
-
if (actions) insertBefore(root, actions, null);
|
|
412
|
+
(0, import_vobs3.insertBefore)(root, summary, null);
|
|
413
|
+
if (actions) (0, import_vobs3.insertBefore)(root, actions, null);
|
|
1287
414
|
return root;
|
|
1288
415
|
}
|
|
1289
416
|
__name(createFooter, "createFooter");
|
|
@@ -1304,38 +431,38 @@ function createCustomPagination(props, pagination) {
|
|
|
1304
431
|
}
|
|
1305
432
|
__name(createCustomPagination, "createCustomPagination");
|
|
1306
433
|
function createPagination(props, pagination) {
|
|
1307
|
-
const root = createElement("div");
|
|
434
|
+
const root = (0, import_vobs3.createElement)("div");
|
|
1308
435
|
const mode = readProp(props, "paginationMode", "simple");
|
|
1309
|
-
setAttribute(root, "class", "vobs-data-table__pagination");
|
|
1310
|
-
setAttribute(root, "data-mode", mode);
|
|
1311
|
-
insertBefore(root, createPageButton(props, "previous", pagination), null);
|
|
436
|
+
(0, import_vobs3.setAttribute)(root, "class", "vobs-data-table__pagination");
|
|
437
|
+
(0, import_vobs3.setAttribute)(root, "data-mode", mode);
|
|
438
|
+
(0, import_vobs3.insertBefore)(root, createPageButton(props, "previous", pagination), null);
|
|
1312
439
|
if (mode !== "simple") {
|
|
1313
|
-
const pages = createElement("div");
|
|
1314
|
-
setAttribute(pages, "class", "vobs-data-table__pagination-pages");
|
|
440
|
+
const pages = (0, import_vobs3.createElement)("div");
|
|
441
|
+
(0, import_vobs3.setAttribute)(pages, "class", "vobs-data-table__pagination-pages");
|
|
1315
442
|
for (const item of buildPaginationItems(pagination.page, pagination.pageCount)) {
|
|
1316
|
-
insertBefore(pages, typeof item === "number" ? createPageNumberButton(props, item, pagination.page) : createPageEllipsis(item), null);
|
|
443
|
+
(0, import_vobs3.insertBefore)(pages, typeof item === "number" ? createPageNumberButton(props, item, pagination.page) : createPageEllipsis(item), null);
|
|
1317
444
|
}
|
|
1318
|
-
insertBefore(root, pages, null);
|
|
445
|
+
(0, import_vobs3.insertBefore)(root, pages, null);
|
|
1319
446
|
}
|
|
1320
|
-
insertBefore(root, createPageButton(props, "next", pagination), null);
|
|
1321
|
-
if (mode === "all") insertBefore(root, createJumpControl(props, pagination), null);
|
|
1322
|
-
insertBefore(root, createPageSizeControl(props, pagination), null);
|
|
447
|
+
(0, import_vobs3.insertBefore)(root, createPageButton(props, "next", pagination), null);
|
|
448
|
+
if (mode === "all") (0, import_vobs3.insertBefore)(root, createJumpControl(props, pagination), null);
|
|
449
|
+
(0, import_vobs3.insertBefore)(root, createPageSizeControl(props, pagination), null);
|
|
1323
450
|
return root;
|
|
1324
451
|
}
|
|
1325
452
|
__name(createPagination, "createPagination");
|
|
1326
453
|
function createPageButton(props, direction, pagination) {
|
|
1327
|
-
const button = createElement("button");
|
|
454
|
+
const button = (0, import_vobs3.createElement)("button");
|
|
1328
455
|
const label = direction === "previous" ? readProp(props, "previousLabel", "Previous") : readProp(props, "nextLabel", "Next");
|
|
1329
456
|
const disabled = direction === "previous" ? pagination.page <= 1 : pagination.page >= pagination.pageCount;
|
|
1330
|
-
setAttribute(button, "type", "button");
|
|
1331
|
-
setAttribute(button, "class", "vobs-data-table__page-button");
|
|
1332
|
-
setAttribute(button, "aria-label", label);
|
|
1333
|
-
setProperty(button, "disabled", disabled);
|
|
457
|
+
(0, import_vobs3.setAttribute)(button, "type", "button");
|
|
458
|
+
(0, import_vobs3.setAttribute)(button, "class", "vobs-data-table__page-button");
|
|
459
|
+
(0, import_vobs3.setAttribute)(button, "aria-label", label);
|
|
460
|
+
(0, import_vobs3.setProperty)(button, "disabled", disabled);
|
|
1334
461
|
const icons = resolveIcons(props);
|
|
1335
462
|
const icon = direction === "previous" ? icons.previous : icons.next;
|
|
1336
463
|
const node = icon === void 0 ? void 0 : resolveSlot(icon);
|
|
1337
|
-
if (node) insertBefore(button, node, null);
|
|
1338
|
-
addEventListener(button, "click", () => {
|
|
464
|
+
if (node) (0, import_vobs3.insertBefore)(button, node, null);
|
|
465
|
+
(0, import_vobs3.addEventListener)(button, "click", () => {
|
|
1339
466
|
if (disabled) return;
|
|
1340
467
|
const query = currentQuery(props);
|
|
1341
468
|
goToPage(props, direction === "previous" ? query.page - 1 : query.page + 1, pagination.pageCount);
|
|
@@ -1344,83 +471,83 @@ function createPageButton(props, direction, pagination) {
|
|
|
1344
471
|
}
|
|
1345
472
|
__name(createPageButton, "createPageButton");
|
|
1346
473
|
function createPageNumberButton(props, page, currentPage) {
|
|
1347
|
-
const button = createElement("button");
|
|
474
|
+
const button = (0, import_vobs3.createElement)("button");
|
|
1348
475
|
const active = page === currentPage;
|
|
1349
|
-
setAttribute(button, "type", "button");
|
|
1350
|
-
setAttribute(button, "class", `vobs-data-table__page-button${active ? " is-active" : ""}`);
|
|
1351
|
-
setAttribute(button, "aria-label", `Page ${page}`);
|
|
1352
|
-
if (active) setAttribute(button, "aria-current", "page");
|
|
1353
|
-
insertBefore(button, createText(String(page)), null);
|
|
1354
|
-
addEventListener(button, "click", () => goToPage(props, page, resolvePaginationState(props).pageCount));
|
|
476
|
+
(0, import_vobs3.setAttribute)(button, "type", "button");
|
|
477
|
+
(0, import_vobs3.setAttribute)(button, "class", `vobs-data-table__page-button${active ? " is-active" : ""}`);
|
|
478
|
+
(0, import_vobs3.setAttribute)(button, "aria-label", `Page ${page}`);
|
|
479
|
+
if (active) (0, import_vobs3.setAttribute)(button, "aria-current", "page");
|
|
480
|
+
(0, import_vobs3.insertBefore)(button, (0, import_vobs3.createText)(String(page)), null);
|
|
481
|
+
(0, import_vobs3.addEventListener)(button, "click", () => goToPage(props, page, resolvePaginationState(props).pageCount));
|
|
1355
482
|
return button;
|
|
1356
483
|
}
|
|
1357
484
|
__name(createPageNumberButton, "createPageNumberButton");
|
|
1358
485
|
function createPageEllipsis(side) {
|
|
1359
|
-
const ellipsis = createElement("span");
|
|
1360
|
-
setAttribute(ellipsis, "class", "vobs-data-table__page-ellipsis");
|
|
1361
|
-
setAttribute(ellipsis, "aria-hidden", "true");
|
|
1362
|
-
setAttribute(ellipsis, "data-side", side);
|
|
1363
|
-
insertBefore(ellipsis, createText("..."), null);
|
|
486
|
+
const ellipsis = (0, import_vobs3.createElement)("span");
|
|
487
|
+
(0, import_vobs3.setAttribute)(ellipsis, "class", "vobs-data-table__page-ellipsis");
|
|
488
|
+
(0, import_vobs3.setAttribute)(ellipsis, "aria-hidden", "true");
|
|
489
|
+
(0, import_vobs3.setAttribute)(ellipsis, "data-side", side);
|
|
490
|
+
(0, import_vobs3.insertBefore)(ellipsis, (0, import_vobs3.createText)("..."), null);
|
|
1364
491
|
return ellipsis;
|
|
1365
492
|
}
|
|
1366
493
|
__name(createPageEllipsis, "createPageEllipsis");
|
|
1367
494
|
function createJumpControl(props, pagination) {
|
|
1368
|
-
const root = createElement("form");
|
|
1369
|
-
const label = createElement("label");
|
|
1370
|
-
const input = createElement("input");
|
|
1371
|
-
const submit = createElement("button");
|
|
495
|
+
const root = (0, import_vobs3.createElement)("form");
|
|
496
|
+
const label = (0, import_vobs3.createElement)("label");
|
|
497
|
+
const input = (0, import_vobs3.createElement)("input");
|
|
498
|
+
const submit = (0, import_vobs3.createElement)("button");
|
|
1372
499
|
const jumpLabel = readProp(props, "jumpToLabel", "Go to");
|
|
1373
|
-
setAttribute(root, "class", "vobs-data-table__pagination-jump");
|
|
1374
|
-
setAttribute(label, "class", "vobs-data-table__jump-label");
|
|
1375
|
-
setAttribute(input, "class", "vobs-data-table__jump-input");
|
|
1376
|
-
setAttribute(input, "type", "text");
|
|
1377
|
-
setAttribute(input, "inputmode", "numeric");
|
|
1378
|
-
setAttribute(input, "pattern", "[0-9]*");
|
|
1379
|
-
setAttribute(input, "autocomplete", "off");
|
|
1380
|
-
setAttribute(input, "aria-label", jumpLabel);
|
|
1381
|
-
setAttribute(input, "placeholder", readProp(props, "jumpToPlaceholder", "Page"));
|
|
1382
|
-
setProperty(input, "value", String(pagination.page));
|
|
1383
|
-
setAttribute(submit, "type", "submit");
|
|
1384
|
-
setAttribute(submit, "class", "vobs-data-table__page-button vobs-data-table__jump-submit");
|
|
1385
|
-
setAttribute(submit, "aria-label", readProp(props, "jumpToSubmitLabel", "Go"));
|
|
1386
|
-
insertBefore(label, createText(jumpLabel), null);
|
|
1387
|
-
insertBefore(label, input, null);
|
|
1388
|
-
insertBefore(submit, createText(readProp(props, "jumpToSubmitLabel", "Go")), null);
|
|
1389
|
-
addEventListener(input, "input", () => {
|
|
500
|
+
(0, import_vobs3.setAttribute)(root, "class", "vobs-data-table__pagination-jump");
|
|
501
|
+
(0, import_vobs3.setAttribute)(label, "class", "vobs-data-table__jump-label");
|
|
502
|
+
(0, import_vobs3.setAttribute)(input, "class", "vobs-data-table__jump-input");
|
|
503
|
+
(0, import_vobs3.setAttribute)(input, "type", "text");
|
|
504
|
+
(0, import_vobs3.setAttribute)(input, "inputmode", "numeric");
|
|
505
|
+
(0, import_vobs3.setAttribute)(input, "pattern", "[0-9]*");
|
|
506
|
+
(0, import_vobs3.setAttribute)(input, "autocomplete", "off");
|
|
507
|
+
(0, import_vobs3.setAttribute)(input, "aria-label", jumpLabel);
|
|
508
|
+
(0, import_vobs3.setAttribute)(input, "placeholder", readProp(props, "jumpToPlaceholder", "Page"));
|
|
509
|
+
(0, import_vobs3.setProperty)(input, "value", String(pagination.page));
|
|
510
|
+
(0, import_vobs3.setAttribute)(submit, "type", "submit");
|
|
511
|
+
(0, import_vobs3.setAttribute)(submit, "class", "vobs-data-table__page-button vobs-data-table__jump-submit");
|
|
512
|
+
(0, import_vobs3.setAttribute)(submit, "aria-label", readProp(props, "jumpToSubmitLabel", "Go"));
|
|
513
|
+
(0, import_vobs3.insertBefore)(label, (0, import_vobs3.createText)(jumpLabel), null);
|
|
514
|
+
(0, import_vobs3.insertBefore)(label, input, null);
|
|
515
|
+
(0, import_vobs3.insertBefore)(submit, (0, import_vobs3.createText)(readProp(props, "jumpToSubmitLabel", "Go")), null);
|
|
516
|
+
(0, import_vobs3.addEventListener)(input, "input", () => {
|
|
1390
517
|
const value = input.value.replace(/[^0-9]/gu, "");
|
|
1391
|
-
if (value !== input.value) setProperty(input, "value", value);
|
|
518
|
+
if (value !== input.value) (0, import_vobs3.setProperty)(input, "value", value);
|
|
1392
519
|
});
|
|
1393
|
-
addEventListener(root, "submit", (event) => {
|
|
520
|
+
(0, import_vobs3.addEventListener)(root, "submit", (event) => {
|
|
1394
521
|
event.preventDefault();
|
|
1395
522
|
if (!/^\d+$/u.test(input.value)) return;
|
|
1396
523
|
const requested = Number(input.value);
|
|
1397
524
|
if (!Number.isSafeInteger(requested)) return;
|
|
1398
525
|
goToPage(props, requested, pagination.pageCount);
|
|
1399
526
|
});
|
|
1400
|
-
insertBefore(root, label, null);
|
|
1401
|
-
insertBefore(root, submit, null);
|
|
527
|
+
(0, import_vobs3.insertBefore)(root, label, null);
|
|
528
|
+
(0, import_vobs3.insertBefore)(root, submit, null);
|
|
1402
529
|
return root;
|
|
1403
530
|
}
|
|
1404
531
|
__name(createJumpControl, "createJumpControl");
|
|
1405
532
|
function createPageSizeControl(props, pagination) {
|
|
1406
|
-
const root = createElement("label");
|
|
1407
|
-
const select = createElement("select");
|
|
533
|
+
const root = (0, import_vobs3.createElement)("label");
|
|
534
|
+
const select = (0, import_vobs3.createElement)("select");
|
|
1408
535
|
const label = readProp(props, "pageSizeLabel", "Rows per page");
|
|
1409
|
-
setAttribute(root, "class", "vobs-data-table__page-size");
|
|
1410
|
-
setAttribute(select, "class", "vobs-data-table__page-size-select");
|
|
1411
|
-
setAttribute(select, "aria-label", label);
|
|
1412
|
-
insertBefore(root, createText(label), null);
|
|
536
|
+
(0, import_vobs3.setAttribute)(root, "class", "vobs-data-table__page-size");
|
|
537
|
+
(0, import_vobs3.setAttribute)(select, "class", "vobs-data-table__page-size-select");
|
|
538
|
+
(0, import_vobs3.setAttribute)(select, "aria-label", label);
|
|
539
|
+
(0, import_vobs3.insertBefore)(root, (0, import_vobs3.createText)(label), null);
|
|
1413
540
|
for (const optionValue of pageSizeOptions(props, pagination.pageSize)) {
|
|
1414
|
-
const option = createElement("option");
|
|
1415
|
-
setAttribute(option, "value", String(optionValue));
|
|
1416
|
-
setProperty(option, "textContent", String(optionValue));
|
|
1417
|
-
insertBefore(select, option, null);
|
|
541
|
+
const option = (0, import_vobs3.createElement)("option");
|
|
542
|
+
(0, import_vobs3.setAttribute)(option, "value", String(optionValue));
|
|
543
|
+
(0, import_vobs3.setProperty)(option, "textContent", String(optionValue));
|
|
544
|
+
(0, import_vobs3.insertBefore)(select, option, null);
|
|
1418
545
|
}
|
|
1419
|
-
setProperty(select, "value", String(pagination.pageSize));
|
|
1420
|
-
addEventListener(select, "change", () => {
|
|
546
|
+
(0, import_vobs3.setProperty)(select, "value", String(pagination.pageSize));
|
|
547
|
+
(0, import_vobs3.addEventListener)(select, "change", () => {
|
|
1421
548
|
setPageSize(props, Number(select.value));
|
|
1422
549
|
});
|
|
1423
|
-
insertBefore(root, select, null);
|
|
550
|
+
(0, import_vobs3.insertBefore)(root, select, null);
|
|
1424
551
|
return root;
|
|
1425
552
|
}
|
|
1426
553
|
__name(createPageSizeControl, "createPageSizeControl");
|
|
@@ -1649,7 +776,7 @@ function applyColumnStyle(cell, column, settings) {
|
|
|
1649
776
|
normalizePixels(width) ? `width: ${normalizePixels(width)}` : "",
|
|
1650
777
|
normalizePixels(column.minWidth) ? `min-width: ${normalizePixels(column.minWidth)}` : ""
|
|
1651
778
|
].filter(Boolean).join("; ");
|
|
1652
|
-
if (styles) setAttribute(cell, "style", styles);
|
|
779
|
+
if (styles) (0, import_vobs3.setAttribute)(cell, "style", styles);
|
|
1653
780
|
setOptionalAttribute(cell, "data-align", column.align);
|
|
1654
781
|
}
|
|
1655
782
|
__name(applyColumnStyle, "applyColumnStyle");
|
|
@@ -1665,7 +792,8 @@ function readRowValue(row, key) {
|
|
|
1665
792
|
return row === null || row === void 0 ? void 0 : Reflect.get(row, key);
|
|
1666
793
|
}
|
|
1667
794
|
__name(readRowValue, "readRowValue");
|
|
1668
|
-
|
|
1669
|
-
exports
|
|
1670
|
-
|
|
795
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
796
|
+
0 && (module.exports = {
|
|
797
|
+
KitDataTable
|
|
798
|
+
});
|
|
1671
799
|
//# sourceMappingURL=data-table.cjs.map
|