@krak-stack/assets 0.1.6 → 0.1.7
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/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/dist/components/asset-input/html.d.ts +4 -2
- package/dist/components/asset-input/html.js +301 -276
- package/dist/components/asset-input/index.d.ts +51 -0
- package/dist/components/asset-input/react.d.ts +1 -1
- package/dist/components/asset-input/react.js +61 -33
- package/dist/components/asset-input/schema.d.ts +15 -0
- package/dist/components/asset-table/html.js +903 -843
- package/dist/components/asset-table/index.d.ts +99 -0
- package/dist/components/asset-table/react.d.ts +3 -2
- package/dist/components/asset-table/react.js +191 -115
- package/dist/services/assets/library.d.ts +55 -0
- package/dist/services/assets/library.d.ts.map +1 -1
- package/dist/services/assets/library.js +37 -16
- package/dist/services/assets/library.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,114 +1,10 @@
|
|
|
1
1
|
// ../assets/src/components/asset-table/html.ts
|
|
2
|
-
import { Redacted as Redacted8, Schema as
|
|
2
|
+
import { Redacted as Redacted8, Schema as Schema25 } from "effect";
|
|
3
3
|
import { AsyncResult as AsyncResult3 } from "effect/reactivity";
|
|
4
4
|
|
|
5
5
|
// ../assets/src/components/asset-input/html.ts
|
|
6
|
-
import { Effect as Effect4, Layer, Redacted as Redacted4
|
|
6
|
+
import { Effect as Effect4, Layer, Redacted as Redacted4 } from "effect";
|
|
7
7
|
import { AsyncResult as AsyncResult2 } from "effect/reactivity";
|
|
8
|
-
|
|
9
|
-
// ../assets/src/services/assets/library.ts
|
|
10
|
-
import {
|
|
11
|
-
Context,
|
|
12
|
-
Schema
|
|
13
|
-
} from "effect";
|
|
14
|
-
import { AsyncResult } from "effect/reactivity";
|
|
15
|
-
import { Component, Query, UiSchema, View } from "effect/ui";
|
|
16
|
-
var AssetLibraryAccessSchema = Schema.Struct({
|
|
17
|
-
scopeKey: Schema.NonEmptyString,
|
|
18
|
-
permissions: Schema.Array(Schema.Literals(["list", "read", "create", "update", "delete"]))
|
|
19
|
-
}).annotate({ identifier: "AssetLibraryAccess" });
|
|
20
|
-
var AssetListQuerySchema = Schema.Struct({
|
|
21
|
-
search: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(200))),
|
|
22
|
-
kind: Schema.optionalKey(Schema.Literals(["image", "video", "caption", "document"]))
|
|
23
|
-
}).annotate({ identifier: "AssetListQuery" });
|
|
24
|
-
var AssetListItemSchema = Schema.Struct({
|
|
25
|
-
id: Schema.String.check(Schema.isUUID()),
|
|
26
|
-
name: Schema.NonEmptyString,
|
|
27
|
-
mimeType: Schema.NonEmptyString,
|
|
28
|
-
byteSize: Schema.Int,
|
|
29
|
-
createdAt: Schema.Date,
|
|
30
|
-
updatedAt: Schema.Date,
|
|
31
|
-
url: Schema.optionalKey(Schema.String)
|
|
32
|
-
}).annotate({ identifier: "AssetListItem" });
|
|
33
|
-
var AssetStatsSchema = Schema.Struct({
|
|
34
|
-
assetCount: Schema.Int,
|
|
35
|
-
storageUsedBytes: Schema.Int
|
|
36
|
-
}).annotate({ identifier: "AssetStats" });
|
|
37
|
-
var AssetListSchema = Schema.Struct({
|
|
38
|
-
items: Schema.Array(AssetListItemSchema),
|
|
39
|
-
stats: AssetStatsSchema
|
|
40
|
-
}).annotate({ identifier: "AssetList" });
|
|
41
|
-
var AssetListArgsSchema = Schema.Struct({
|
|
42
|
-
...AssetListQuerySchema.fields,
|
|
43
|
-
scopeKey: Schema.NonEmptyString,
|
|
44
|
-
showFiles: Schema.Boolean
|
|
45
|
-
}).annotate({ identifier: "AssetListArgs" });
|
|
46
|
-
var AssetListError = Schema.Literals([
|
|
47
|
-
"unauthorized",
|
|
48
|
-
"forbidden",
|
|
49
|
-
"unavailable"
|
|
50
|
-
]).annotate({ identifier: "AssetListError" });
|
|
51
|
-
|
|
52
|
-
class AssetList extends Query.Service()("@krak-stack/assets/AssetList", {
|
|
53
|
-
args: AssetListArgsSchema,
|
|
54
|
-
success: AssetListSchema,
|
|
55
|
-
error: AssetListError,
|
|
56
|
-
staleTime: "30 seconds"
|
|
57
|
-
}) {
|
|
58
|
-
}
|
|
59
|
-
var assetListArgs = (scopeKey, permissions, query = {}) => permissions.includes("list") ? { ...query, scopeKey, showFiles: permissions.includes("read") } : undefined;
|
|
60
|
-
var AssetLibrarySnapshot = Schema.Struct({
|
|
61
|
-
data: Schema.NullOr(AssetListSchema),
|
|
62
|
-
status: Schema.Literals(["idle", "loading", "ready", "failed"])
|
|
63
|
-
}).annotate({ identifier: "AssetLibrarySnapshot" });
|
|
64
|
-
var AssetLibraryMessage = UiSchema.TaggedEnum({
|
|
65
|
-
LibraryChanged: { library: AssetLibrarySnapshot }
|
|
66
|
-
}).annotate({ identifier: "AssetLibraryMessage" });
|
|
67
|
-
var emptyAssetLibrary = { data: null, status: "idle" };
|
|
68
|
-
var libraryQuery = (result) => AssetLibraryMessage.LibraryChanged({
|
|
69
|
-
library: AsyncResult.isSuccess(result) ? { data: result.value, status: "ready" } : {
|
|
70
|
-
data: null,
|
|
71
|
-
status: AsyncResult.isFailure(result) ? "failed" : "loading"
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
var options = {
|
|
75
|
-
name: "AssetLibraryModel",
|
|
76
|
-
props: Schema.Struct({ access: AssetLibraryAccessSchema }).annotate({
|
|
77
|
-
identifier: "AssetLibraryModelProps"
|
|
78
|
-
}),
|
|
79
|
-
model: AssetLibrarySnapshot,
|
|
80
|
-
message: AssetLibraryMessage,
|
|
81
|
-
restore: false,
|
|
82
|
-
queries: {
|
|
83
|
-
library: {
|
|
84
|
-
query: AssetList,
|
|
85
|
-
dropPrevious: true,
|
|
86
|
-
args: ({ props }) => assetListArgs(props.access.scopeKey, props.access.permissions),
|
|
87
|
-
onChange: libraryQuery
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
var definition = Component.define(options);
|
|
92
|
-
var AssetLibraryModel = definition.make({
|
|
93
|
-
init: () => emptyAssetLibrary,
|
|
94
|
-
update: definition.update({ LibraryChanged: (_, { library }) => library }),
|
|
95
|
-
view: () => View.text("")
|
|
96
|
-
});
|
|
97
|
-
var AssetUploadTransportMessages = {
|
|
98
|
-
en: {
|
|
99
|
-
rejected: "The file did not pass the security scan.",
|
|
100
|
-
failed: "The file could not be published."
|
|
101
|
-
},
|
|
102
|
-
fr: {
|
|
103
|
-
rejected: "Le fichier n’a pas passé l’analyse de sécurité.",
|
|
104
|
-
failed: "Impossible de publier le fichier."
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
class AssetLibraryActions extends Context.Service()("@krak-stack/assets/AssetLibraryActions") {
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// ../assets/src/components/asset-input/html.ts
|
|
112
8
|
import { Component as Component7 } from "effect/ui";
|
|
113
9
|
import { Html as Html4 } from "effect/ui/html";
|
|
114
10
|
import { Dialog, Field } from "effect/ui/kit";
|
|
@@ -124,8 +20,8 @@ import {
|
|
|
124
20
|
import { FieldLabel, FieldRoot } from "@/components/effectcn/field";
|
|
125
21
|
|
|
126
22
|
// ../../src/components/file-input/html.ts
|
|
127
|
-
import { Effect
|
|
128
|
-
import { Component as
|
|
23
|
+
import { Effect, Redacted as Redacted2, Schema as Schema3, Stream } from "effect";
|
|
24
|
+
import { Component as Component2, Mount } from "effect/ui";
|
|
129
25
|
import { Html } from "effect/ui/html";
|
|
130
26
|
import { Button, buttonVariants } from "@/components/effectcn/button";
|
|
131
27
|
import {
|
|
@@ -279,42 +175,42 @@ var fileType = (mimeType) => {
|
|
|
279
175
|
};
|
|
280
176
|
|
|
281
177
|
// ../../src/components/file-input/index.ts
|
|
282
|
-
import { Redacted, Schema as
|
|
283
|
-
import { Component
|
|
178
|
+
import { Redacted, Schema as Schema2 } from "effect";
|
|
179
|
+
import { Component, UiSchema } from "effect/ui";
|
|
284
180
|
|
|
285
181
|
// ../../src/components/file-input/schema.ts
|
|
286
|
-
import { Schema
|
|
287
|
-
var AcceptLabel =
|
|
288
|
-
var FilePickerFilesSchema =
|
|
289
|
-
var FileInputClassesOverridesSchema =
|
|
290
|
-
var FilePickerPropsSchema =
|
|
291
|
-
classes:
|
|
292
|
-
accept:
|
|
293
|
-
canClear:
|
|
294
|
-
file:
|
|
295
|
-
files:
|
|
296
|
-
id:
|
|
297
|
-
image:
|
|
298
|
-
alt:
|
|
299
|
-
height:
|
|
300
|
-
src:
|
|
301
|
-
width:
|
|
182
|
+
import { Schema, Struct } from "effect";
|
|
183
|
+
var AcceptLabel = Schema.declare((value) => typeof value === "function").annotate({ identifier: "FilePickerAcceptLabel" });
|
|
184
|
+
var FilePickerFilesSchema = Schema.Redacted(Schema.Array(Schema.File)).annotate({ identifier: "FilePickerFiles" });
|
|
185
|
+
var FileInputClassesOverridesSchema = Schema.Record(Schema.Literals(Struct.keys(fileInputClasses)), Schema.optionalKey(Schema.String)).annotate({ identifier: "FileInputClassesOverrides" });
|
|
186
|
+
var FilePickerPropsSchema = Schema.Struct({
|
|
187
|
+
classes: Schema.optional(FileInputClassesOverridesSchema),
|
|
188
|
+
accept: Schema.optional(Schema.String),
|
|
189
|
+
canClear: Schema.optional(Schema.Boolean),
|
|
190
|
+
file: Schema.optional(Schema.File),
|
|
191
|
+
files: Schema.optional(Schema.Array(Schema.File)),
|
|
192
|
+
id: Schema.String,
|
|
193
|
+
image: Schema.optional(Schema.Struct({
|
|
194
|
+
alt: Schema.String,
|
|
195
|
+
height: Schema.Number,
|
|
196
|
+
src: Schema.optional(Schema.String),
|
|
197
|
+
width: Schema.Number
|
|
302
198
|
}).annotate({ identifier: "FilePickerImage" })),
|
|
303
|
-
invalid:
|
|
304
|
-
locale:
|
|
305
|
-
messages:
|
|
306
|
-
accepts:
|
|
307
|
-
chooseFile:
|
|
308
|
-
chooseFiles:
|
|
309
|
-
deleteFile:
|
|
310
|
-
dropFile:
|
|
311
|
-
dropFiles:
|
|
312
|
-
replaceFile:
|
|
199
|
+
invalid: Schema.optional(Schema.Boolean),
|
|
200
|
+
locale: Schema.optional(Schema.String),
|
|
201
|
+
messages: Schema.optional(Schema.Record(Schema.String, Schema.Struct({
|
|
202
|
+
accepts: Schema.optional(AcceptLabel),
|
|
203
|
+
chooseFile: Schema.optional(Schema.String),
|
|
204
|
+
chooseFiles: Schema.optional(Schema.String),
|
|
205
|
+
deleteFile: Schema.optional(Schema.String),
|
|
206
|
+
dropFile: Schema.optional(Schema.String),
|
|
207
|
+
dropFiles: Schema.optional(Schema.String),
|
|
208
|
+
replaceFile: Schema.optional(Schema.String)
|
|
313
209
|
}).annotate({ identifier: "FilePickerMessageOverrides" }))),
|
|
314
|
-
multiple:
|
|
315
|
-
name:
|
|
316
|
-
required:
|
|
317
|
-
showImageThumbnails:
|
|
210
|
+
multiple: Schema.optional(Schema.Boolean),
|
|
211
|
+
name: Schema.String,
|
|
212
|
+
required: Schema.optional(Schema.Boolean),
|
|
213
|
+
showImageThumbnails: Schema.optionalKey(Schema.Boolean)
|
|
318
214
|
}).annotate({ identifier: "FilePickerProps" });
|
|
319
215
|
|
|
320
216
|
// ../../src/components/file-input/index.ts
|
|
@@ -365,17 +261,17 @@ var fileDescription = (file, locale) => [
|
|
|
365
261
|
].filter(Boolean).join(" · ");
|
|
366
262
|
var filePickerKey = ({ name, size, lastModified }) => `${name}:${size}:${lastModified}`;
|
|
367
263
|
var mergePickedFiles = (files, added) => Array.from(new Map([...files, ...added].map((file) => [filePickerKey(file), file])).values());
|
|
368
|
-
var FilePickerMessage =
|
|
264
|
+
var FilePickerMessage = UiSchema.TaggedEnum({
|
|
369
265
|
Selected: { files: FilePickerFilesSchema },
|
|
370
266
|
Dropped: { files: FilePickerFilesSchema },
|
|
371
|
-
Removed: { index:
|
|
267
|
+
Removed: { index: Schema2.Int },
|
|
372
268
|
Cleared: {},
|
|
373
269
|
Blurred: {},
|
|
374
270
|
DragEntered: {},
|
|
375
271
|
DragLeft: {}
|
|
376
272
|
}).annotate({ identifier: "FilePickerMessage" });
|
|
377
|
-
var FilePickerEvents =
|
|
378
|
-
Change: { file:
|
|
273
|
+
var FilePickerEvents = UiSchema.TaggedEnum({
|
|
274
|
+
Change: { file: Schema2.Redacted(Schema2.File) },
|
|
379
275
|
FilesChange: { files: FilePickerFilesSchema },
|
|
380
276
|
Clear: {},
|
|
381
277
|
Blur: {}
|
|
@@ -383,7 +279,7 @@ var FilePickerEvents = UiSchema2.TaggedEnum({
|
|
|
383
279
|
var filePickerOptions = {
|
|
384
280
|
name: "FilePicker",
|
|
385
281
|
props: FilePickerPropsSchema,
|
|
386
|
-
model:
|
|
282
|
+
model: Schema2.Int,
|
|
387
283
|
message: FilePickerMessage,
|
|
388
284
|
events: FilePickerEvents,
|
|
389
285
|
restore: false
|
|
@@ -405,7 +301,7 @@ var selectFiles = ($, files, dropped) => {
|
|
|
405
301
|
};
|
|
406
302
|
var filePickerBehaviours = {
|
|
407
303
|
init: () => 0,
|
|
408
|
-
update:
|
|
304
|
+
update: Component.define(filePickerOptions).update({
|
|
409
305
|
Selected: ($, { files }) => selectFiles($, Redacted.value(files), false),
|
|
410
306
|
Dropped: ($, { files }) => selectFiles($, Redacted.value(files), true),
|
|
411
307
|
Removed: ($, { index }) => $.set($.model).emit(FilePickerEvents.FilesChange({
|
|
@@ -446,25 +342,25 @@ var fileIcons = {
|
|
|
446
342
|
};
|
|
447
343
|
var fileTypeIconRenderer = (mimeType) => fileIcons[fileType(mimeType)];
|
|
448
344
|
var FileTypeIcon = (h, mimeType) => fileTypeIconRenderer(mimeType)(h, { size: 18 });
|
|
449
|
-
var PreviewFile = Mount.make("FilePickerPreviewFile", { args: { file:
|
|
345
|
+
var PreviewFile = Mount.make("FilePickerPreviewFile", { args: { file: Schema3.Redacted(Schema3.File) } }, (image, _, changes) => Effect.gen(function* () {
|
|
450
346
|
let url;
|
|
451
|
-
yield*
|
|
347
|
+
yield* Effect.addFinalizer(() => Effect.sync(() => {
|
|
452
348
|
if (url)
|
|
453
349
|
URL.revokeObjectURL(url);
|
|
454
350
|
}));
|
|
455
|
-
yield* changes.pipe(Stream.runForEach(({ file }) =>
|
|
351
|
+
yield* changes.pipe(Stream.runForEach(({ file }) => Effect.sync(() => {
|
|
456
352
|
if (url)
|
|
457
353
|
URL.revokeObjectURL(url);
|
|
458
354
|
url = URL.createObjectURL(Redacted2.value(file));
|
|
459
355
|
image.src = url;
|
|
460
356
|
})));
|
|
461
|
-
return
|
|
357
|
+
return Component2.noop;
|
|
462
358
|
}));
|
|
463
359
|
var FileThumbnail = (h, file) => fileType(file.type) === "image" ? h.img.class("size-9 shrink-0 rounded-md object-cover").attr("alt", "").onMount(PreviewFile({ file: Redacted2.make(file) })) : FileTypeIcon(h, file.type);
|
|
464
|
-
var props =
|
|
360
|
+
var props = Schema3.Struct({
|
|
465
361
|
...filePickerOptions.props.fields,
|
|
466
|
-
title:
|
|
467
|
-
showAcceptHint:
|
|
362
|
+
title: Schema3.String,
|
|
363
|
+
showAcceptHint: Schema3.optionalKey(Schema3.Boolean)
|
|
468
364
|
}).annotate({ identifier: "FilePickerHtmlProps" });
|
|
469
365
|
var FileInput = Html.component({
|
|
470
366
|
...filePickerOptions,
|
|
@@ -516,7 +412,7 @@ var FileInput = Html.component({
|
|
|
516
412
|
import { krakstackLocaleRead as krakstackLocaleRead4 } from "@krak-stack/registry/krakstack-provider/html";
|
|
517
413
|
|
|
518
414
|
// ../../src/components/upload-attachment/html.ts
|
|
519
|
-
import { Schema as
|
|
415
|
+
import { Schema as Schema6 } from "effect";
|
|
520
416
|
import { Html as Html2 } from "effect/ui/html";
|
|
521
417
|
import { Button as Button2 } from "@/components/effectcn/button";
|
|
522
418
|
import { krakstackLocaleRead as krakstackLocaleRead2 } from "@krak-stack/registry/krakstack-provider/html";
|
|
@@ -542,49 +438,49 @@ var resolveUploadAttachmentClasses = (overrides) => ({
|
|
|
542
438
|
});
|
|
543
439
|
|
|
544
440
|
// ../../src/components/upload-attachment/index.ts
|
|
545
|
-
import { Schema as
|
|
546
|
-
import { Component as
|
|
441
|
+
import { Schema as Schema5 } from "effect";
|
|
442
|
+
import { Component as Component3, UiSchema as UiSchema2 } from "effect/ui";
|
|
547
443
|
|
|
548
444
|
// ../../src/components/upload-attachment/schema.ts
|
|
549
|
-
import { Schema as
|
|
550
|
-
var UploadAttachmentStateSchema =
|
|
551
|
-
|
|
552
|
-
status:
|
|
445
|
+
import { Schema as Schema4, Struct as Struct2 } from "effect";
|
|
446
|
+
var UploadAttachmentStateSchema = Schema4.Union([
|
|
447
|
+
Schema4.Struct({
|
|
448
|
+
status: Schema4.Literals(["idle", "processing", "done", "cancelled"])
|
|
553
449
|
}),
|
|
554
|
-
|
|
555
|
-
status:
|
|
556
|
-
progress:
|
|
450
|
+
Schema4.Struct({
|
|
451
|
+
status: Schema4.Literal("uploading"),
|
|
452
|
+
progress: Schema4.optional(Schema4.Number)
|
|
557
453
|
}),
|
|
558
|
-
|
|
454
|
+
Schema4.Struct({ status: Schema4.Literal("error"), message: Schema4.String })
|
|
559
455
|
]).annotate({ identifier: "UploadAttachmentState" });
|
|
560
|
-
var Messages =
|
|
561
|
-
idle:
|
|
562
|
-
uploading:
|
|
563
|
-
processing:
|
|
564
|
-
done:
|
|
565
|
-
cancelled:
|
|
566
|
-
cancel:
|
|
567
|
-
retry:
|
|
568
|
-
remove:
|
|
456
|
+
var Messages = Schema4.Struct({
|
|
457
|
+
idle: Schema4.String,
|
|
458
|
+
uploading: Schema4.String,
|
|
459
|
+
processing: Schema4.String,
|
|
460
|
+
done: Schema4.String,
|
|
461
|
+
cancelled: Schema4.String,
|
|
462
|
+
cancel: Schema4.String,
|
|
463
|
+
retry: Schema4.String,
|
|
464
|
+
remove: Schema4.String
|
|
569
465
|
}).annotate({ identifier: "UploadAttachmentMessages" });
|
|
570
|
-
var UploadAttachmentClassesOverridesSchema =
|
|
571
|
-
var UploadAttachmentPropsSchema =
|
|
572
|
-
classes:
|
|
573
|
-
name:
|
|
574
|
-
description:
|
|
466
|
+
var UploadAttachmentClassesOverridesSchema = Schema4.Record(Schema4.Literals(Struct2.keys(uploadAttachmentClasses)), Schema4.optionalKey(Schema4.String)).annotate({ identifier: "UploadAttachmentClassesOverrides" });
|
|
467
|
+
var UploadAttachmentPropsSchema = Schema4.Struct({
|
|
468
|
+
classes: Schema4.optional(UploadAttachmentClassesOverridesSchema),
|
|
469
|
+
name: Schema4.String,
|
|
470
|
+
description: Schema4.optional(Schema4.String),
|
|
575
471
|
state: UploadAttachmentStateSchema,
|
|
576
|
-
disabled:
|
|
577
|
-
className:
|
|
578
|
-
locale:
|
|
579
|
-
messages:
|
|
580
|
-
idle:
|
|
581
|
-
uploading:
|
|
582
|
-
processing:
|
|
583
|
-
done:
|
|
584
|
-
cancelled:
|
|
585
|
-
cancel:
|
|
586
|
-
retry:
|
|
587
|
-
remove:
|
|
472
|
+
disabled: Schema4.optional(Schema4.Boolean),
|
|
473
|
+
className: Schema4.optional(Schema4.String),
|
|
474
|
+
locale: Schema4.optional(Schema4.String),
|
|
475
|
+
messages: Schema4.optional(Schema4.Record(Schema4.String, Messages.mapFields((fields) => ({
|
|
476
|
+
idle: Schema4.optional(fields.idle),
|
|
477
|
+
uploading: Schema4.optional(fields.uploading),
|
|
478
|
+
processing: Schema4.optional(fields.processing),
|
|
479
|
+
done: Schema4.optional(fields.done),
|
|
480
|
+
cancelled: Schema4.optional(fields.cancelled),
|
|
481
|
+
cancel: Schema4.optional(fields.cancel),
|
|
482
|
+
retry: Schema4.optional(fields.retry),
|
|
483
|
+
remove: Schema4.optional(fields.remove)
|
|
588
484
|
}))))
|
|
589
485
|
}).annotate({ identifier: "UploadAttachmentProps" });
|
|
590
486
|
|
|
@@ -625,7 +521,7 @@ var getUploadAttachmentPresentation = (state, locale = "en", messages) => {
|
|
|
625
521
|
status: state.status === "error" ? state.message : copy[state.status]
|
|
626
522
|
};
|
|
627
523
|
};
|
|
628
|
-
var UploadAttachmentAction =
|
|
524
|
+
var UploadAttachmentAction = UiSchema2.TaggedEnum({
|
|
629
525
|
Cancel: {},
|
|
630
526
|
Retry: {},
|
|
631
527
|
Remove: {}
|
|
@@ -633,7 +529,7 @@ var UploadAttachmentAction = UiSchema3.TaggedEnum({
|
|
|
633
529
|
var uploadAttachmentOptions = {
|
|
634
530
|
name: "UploadAttachment",
|
|
635
531
|
props: UploadAttachmentPropsSchema,
|
|
636
|
-
model:
|
|
532
|
+
model: Schema5.Null,
|
|
637
533
|
message: UploadAttachmentAction,
|
|
638
534
|
events: UploadAttachmentAction,
|
|
639
535
|
restore: false
|
|
@@ -645,7 +541,7 @@ var update = ($, action) => {
|
|
|
645
541
|
};
|
|
646
542
|
var uploadAttachmentBehaviours = {
|
|
647
543
|
init: () => null,
|
|
648
|
-
update:
|
|
544
|
+
update: Component3.define(uploadAttachmentOptions).update({
|
|
649
545
|
Cancel: update,
|
|
650
546
|
Retry: update,
|
|
651
547
|
Remove: update
|
|
@@ -653,11 +549,11 @@ var uploadAttachmentBehaviours = {
|
|
|
653
549
|
};
|
|
654
550
|
|
|
655
551
|
// ../../src/components/upload-attachment/html.ts
|
|
656
|
-
var props2 =
|
|
552
|
+
var props2 = Schema6.Struct({
|
|
657
553
|
...uploadAttachmentOptions.props.fields,
|
|
658
|
-
canCancel:
|
|
659
|
-
canRetry:
|
|
660
|
-
canRemove:
|
|
554
|
+
canCancel: Schema6.optional(Schema6.Boolean),
|
|
555
|
+
canRetry: Schema6.optional(Schema6.Boolean),
|
|
556
|
+
canRemove: Schema6.optional(Schema6.Boolean)
|
|
661
557
|
}).annotate({ identifier: "UploadAttachmentHtmlProps" });
|
|
662
558
|
var UploadAttachment = Html2.component({
|
|
663
559
|
...uploadAttachmentOptions,
|
|
@@ -729,65 +625,65 @@ var resolveVirtualizedComboboxClasses = (overrides) => ({
|
|
|
729
625
|
});
|
|
730
626
|
|
|
731
627
|
// ../../src/components/virtualized-combobox/index.ts
|
|
732
|
-
import { Schema as
|
|
733
|
-
import { Component as
|
|
628
|
+
import { Schema as Schema8 } from "effect";
|
|
629
|
+
import { Component as Component4, UiSchema as UiSchema3 } from "effect/ui";
|
|
734
630
|
|
|
735
631
|
// ../../src/components/virtualized-combobox/schema.ts
|
|
736
|
-
import { Predicate, Schema as
|
|
737
|
-
var Icon =
|
|
738
|
-
var VirtualizedComboboxOptionSchema =
|
|
739
|
-
value:
|
|
740
|
-
label:
|
|
741
|
-
description:
|
|
742
|
-
imageSrc:
|
|
743
|
-
icon:
|
|
632
|
+
import { Predicate, Schema as Schema7, Struct as Struct3 } from "effect";
|
|
633
|
+
var Icon = Schema7.declare((value) => Predicate.isFunction(value)).annotate({ identifier: "VirtualizedComboboxIcon" });
|
|
634
|
+
var VirtualizedComboboxOptionSchema = Schema7.Struct({
|
|
635
|
+
value: Schema7.String.pipe(Schema7.mutableKey),
|
|
636
|
+
label: Schema7.String.pipe(Schema7.mutableKey),
|
|
637
|
+
description: Schema7.optionalKey(Schema7.String),
|
|
638
|
+
imageSrc: Schema7.optionalKey(Schema7.String),
|
|
639
|
+
icon: Schema7.optionalKey(Icon)
|
|
744
640
|
}).annotate({ identifier: "VirtualizedComboboxOption" });
|
|
745
|
-
var VirtualizedComboboxLabelsSchema =
|
|
746
|
-
clear:
|
|
747
|
-
search:
|
|
748
|
-
selectMore:
|
|
641
|
+
var VirtualizedComboboxLabelsSchema = Schema7.Struct({
|
|
642
|
+
clear: Schema7.optionalKey(Schema7.String),
|
|
643
|
+
search: Schema7.optionalKey(Schema7.String),
|
|
644
|
+
selectMore: Schema7.optionalKey(Schema7.String)
|
|
749
645
|
}).annotate({ identifier: "VirtualizedComboboxLabels" });
|
|
750
|
-
var VirtualizedComboboxClassesOverridesSchema =
|
|
751
|
-
var VirtualizedComboboxSharedPropsSchema =
|
|
752
|
-
classes:
|
|
753
|
-
ariaLabel:
|
|
754
|
-
ariaInvalid:
|
|
755
|
-
contentClassName:
|
|
756
|
-
disabled:
|
|
757
|
-
items:
|
|
758
|
-
locale:
|
|
759
|
-
open:
|
|
760
|
-
searchValue:
|
|
761
|
-
triggerId:
|
|
646
|
+
var VirtualizedComboboxClassesOverridesSchema = Schema7.Record(Schema7.Literals(Struct3.keys(virtualizedComboboxClasses)), Schema7.optionalKey(Schema7.String)).annotate({ identifier: "VirtualizedComboboxClassesOverrides" });
|
|
647
|
+
var VirtualizedComboboxSharedPropsSchema = Schema7.Struct({
|
|
648
|
+
classes: Schema7.optional(VirtualizedComboboxClassesOverridesSchema),
|
|
649
|
+
ariaLabel: Schema7.String,
|
|
650
|
+
ariaInvalid: Schema7.optionalKey(Schema7.Boolean),
|
|
651
|
+
contentClassName: Schema7.optionalKey(Schema7.String),
|
|
652
|
+
disabled: Schema7.optionalKey(Schema7.Boolean),
|
|
653
|
+
items: Schema7.Array(VirtualizedComboboxOptionSchema),
|
|
654
|
+
locale: Schema7.optionalKey(Schema7.String),
|
|
655
|
+
open: Schema7.optionalKey(Schema7.Boolean),
|
|
656
|
+
searchValue: Schema7.optionalKey(Schema7.String),
|
|
657
|
+
triggerId: Schema7.optionalKey(Schema7.String)
|
|
762
658
|
}).annotate({ identifier: "VirtualizedComboboxSharedProps" });
|
|
763
659
|
var htmlFields = {
|
|
764
660
|
...VirtualizedComboboxSharedPropsSchema.fields,
|
|
765
|
-
emptyLabel:
|
|
766
|
-
placeholder:
|
|
767
|
-
triggerLabel:
|
|
768
|
-
triggerIcon:
|
|
769
|
-
itemHeight:
|
|
770
|
-
filter:
|
|
771
|
-
messages:
|
|
661
|
+
emptyLabel: Schema7.String,
|
|
662
|
+
placeholder: Schema7.String,
|
|
663
|
+
triggerLabel: Schema7.optionalKey(Schema7.String),
|
|
664
|
+
triggerIcon: Schema7.optionalKey(Icon),
|
|
665
|
+
itemHeight: Schema7.optionalKey(Schema7.Int.check(Schema7.isGreaterThan(0))),
|
|
666
|
+
filter: Schema7.optionalKey(Schema7.Literals(["contains", "none"])),
|
|
667
|
+
messages: Schema7.optionalKey(Schema7.Record(Schema7.String, Schema7.Struct({
|
|
772
668
|
...VirtualizedComboboxLabelsSchema.fields,
|
|
773
|
-
selected:
|
|
669
|
+
selected: Schema7.optionalKey(Schema7.String)
|
|
774
670
|
})))
|
|
775
671
|
};
|
|
776
|
-
var VirtualizedComboboxPropsSchema =
|
|
777
|
-
|
|
672
|
+
var VirtualizedComboboxPropsSchema = Schema7.Union([
|
|
673
|
+
Schema7.Struct({
|
|
778
674
|
...htmlFields,
|
|
779
|
-
multiple:
|
|
780
|
-
value:
|
|
675
|
+
multiple: Schema7.optionalKey(Schema7.Literal(false)),
|
|
676
|
+
value: Schema7.NullOr(VirtualizedComboboxOptionSchema)
|
|
781
677
|
}),
|
|
782
|
-
|
|
678
|
+
Schema7.Struct({
|
|
783
679
|
...htmlFields,
|
|
784
|
-
multiple:
|
|
785
|
-
value:
|
|
680
|
+
multiple: Schema7.Literal(true),
|
|
681
|
+
value: Schema7.Array(VirtualizedComboboxOptionSchema)
|
|
786
682
|
})
|
|
787
683
|
]).annotate({ identifier: "VirtualizedComboboxProps" });
|
|
788
684
|
|
|
789
685
|
// ../../src/components/virtualized-combobox/index.ts
|
|
790
|
-
var isText =
|
|
686
|
+
var isText = Schema8.is(Schema8.String);
|
|
791
687
|
var defaultMessages3 = {
|
|
792
688
|
en: {
|
|
793
689
|
clear: "Clear selection",
|
|
@@ -845,36 +741,36 @@ var selectionEntries = (items, selected, groupSelections, labels) => {
|
|
|
845
741
|
];
|
|
846
742
|
};
|
|
847
743
|
var events = {
|
|
848
|
-
OpenChanged: { open:
|
|
849
|
-
SearchChanged: { searchValue:
|
|
744
|
+
OpenChanged: { open: Schema8.Boolean },
|
|
745
|
+
SearchChanged: { searchValue: Schema8.String },
|
|
850
746
|
ValueChanged: {
|
|
851
|
-
value:
|
|
747
|
+
value: Schema8.NullOr(Schema8.Union([Schema8.String, Schema8.Array(Schema8.String)]))
|
|
852
748
|
}
|
|
853
749
|
};
|
|
854
750
|
var selectionId = (value) => isText(value) ? value : null;
|
|
855
751
|
var selectionIds = (value) => isText(value) ? [value] : value ?? [];
|
|
856
|
-
var VirtualizedComboboxEvents =
|
|
752
|
+
var VirtualizedComboboxEvents = UiSchema3.TaggedEnum(events).annotate({
|
|
857
753
|
identifier: "VirtualizedComboboxEvents"
|
|
858
754
|
});
|
|
859
|
-
var VirtualizedComboboxMessage =
|
|
755
|
+
var VirtualizedComboboxMessage = UiSchema3.TaggedEnum({
|
|
860
756
|
...events,
|
|
861
|
-
Highlighted: { value:
|
|
862
|
-
ImageFailed: { src:
|
|
757
|
+
Highlighted: { value: Schema8.String },
|
|
758
|
+
ImageFailed: { src: Schema8.String }
|
|
863
759
|
}).annotate({ identifier: "VirtualizedComboboxMessage" });
|
|
864
760
|
var virtualizedComboboxOptions = {
|
|
865
761
|
name: "VirtualizedCombobox",
|
|
866
762
|
props: VirtualizedComboboxPropsSchema,
|
|
867
|
-
model:
|
|
868
|
-
open:
|
|
869
|
-
searchValue:
|
|
870
|
-
failedImages:
|
|
871
|
-
highlight:
|
|
763
|
+
model: Schema8.Struct({
|
|
764
|
+
open: Schema8.Boolean,
|
|
765
|
+
searchValue: Schema8.String,
|
|
766
|
+
failedImages: Schema8.Array(Schema8.String),
|
|
767
|
+
highlight: Schema8.NullOr(Schema8.Struct({ value: Schema8.String, id: Schema8.Int }))
|
|
872
768
|
}).annotate({ identifier: "VirtualizedComboboxModel" }),
|
|
873
769
|
message: VirtualizedComboboxMessage,
|
|
874
770
|
events: VirtualizedComboboxEvents,
|
|
875
771
|
restore: false
|
|
876
772
|
};
|
|
877
|
-
var update2 =
|
|
773
|
+
var update2 = Component4.define(virtualizedComboboxOptions).update({
|
|
878
774
|
OpenChanged: ($, { open }) => $.set({
|
|
879
775
|
...$.model,
|
|
880
776
|
open: $.props.open === undefined ? open : $.model.open,
|
|
@@ -1017,11 +913,11 @@ var VirtualizedCombobox = Html3.component({
|
|
|
1017
913
|
import { FolderOpen, X as X2 } from "@krak-stack/registry/lucide-effect";
|
|
1018
914
|
|
|
1019
915
|
// ../assets/src/services/assets/url.ts
|
|
1020
|
-
import { Schema as
|
|
916
|
+
import { Schema as Schema10 } from "effect";
|
|
1021
917
|
|
|
1022
918
|
// ../assets/src/services/assets/schema.ts
|
|
1023
|
-
import { Schema as
|
|
1024
|
-
var AssetHttpUrl =
|
|
919
|
+
import { Schema as Schema9 } from "effect";
|
|
920
|
+
var AssetHttpUrl = Schema9.String.check(Schema9.makeFilter((value) => {
|
|
1025
921
|
if (!/^https?:\/\/[^/]/i.test(value) || /[\s\\]/u.test(value))
|
|
1026
922
|
return false;
|
|
1027
923
|
try {
|
|
@@ -1031,11 +927,11 @@ var AssetHttpUrl = Schema10.String.check(Schema10.makeFilter((value) => {
|
|
|
1031
927
|
return false;
|
|
1032
928
|
}
|
|
1033
929
|
})).annotate({ identifier: "AssetHttpUrl" });
|
|
1034
|
-
var AssetRelativeUrl =
|
|
930
|
+
var AssetRelativeUrl = Schema9.String.check(Schema9.isPattern(/^\/(?!\/)[^\s\\]*$/u)).annotate({ identifier: "AssetRelativeUrl" });
|
|
1035
931
|
|
|
1036
932
|
// ../assets/src/services/assets/url.ts
|
|
1037
|
-
var isAssetHttpUrl =
|
|
1038
|
-
var isAssetRelativeUrl =
|
|
933
|
+
var isAssetHttpUrl = Schema10.is(AssetHttpUrl);
|
|
934
|
+
var isAssetRelativeUrl = Schema10.is(AssetRelativeUrl);
|
|
1039
935
|
var assetUrl = ({ url }) => isAssetHttpUrl(url) || isAssetRelativeUrl(url) ? url : undefined;
|
|
1040
936
|
var assetImage = (asset) => {
|
|
1041
937
|
const url = asset.mimeType.trim().toLowerCase().startsWith("image/") ? assetUrl(asset) : undefined;
|
|
@@ -1050,6 +946,125 @@ var assetImage = (asset) => {
|
|
|
1050
946
|
import { Effect as Effect3, Queue, Redacted as Redacted3, Schema as Schema13, Stream as Stream2 } from "effect";
|
|
1051
947
|
import { Command, Component as Component6, UiSchema as UiSchema5 } from "effect/ui";
|
|
1052
948
|
|
|
949
|
+
// ../assets/src/services/assets/library.ts
|
|
950
|
+
import {
|
|
951
|
+
Context,
|
|
952
|
+
Effect as Effect2,
|
|
953
|
+
Schema as Schema11
|
|
954
|
+
} from "effect";
|
|
955
|
+
import { AsyncResult } from "effect/reactivity";
|
|
956
|
+
import { Component as Component5, Query, UiSchema as UiSchema4, View } from "effect/ui";
|
|
957
|
+
var AssetLibraryAccessSchema = Schema11.Struct({
|
|
958
|
+
scopeKey: Schema11.NonEmptyString,
|
|
959
|
+
permissions: Schema11.Array(Schema11.Literals(["list", "read", "create", "update", "delete"]))
|
|
960
|
+
}).annotate({ identifier: "AssetLibraryAccess" });
|
|
961
|
+
var AssetListQuerySchema = Schema11.Struct({
|
|
962
|
+
search: Schema11.optionalKey(Schema11.String.check(Schema11.isMaxLength(200))),
|
|
963
|
+
kind: Schema11.optionalKey(Schema11.Literals(["image", "video", "caption", "document"]))
|
|
964
|
+
}).annotate({ identifier: "AssetListQuery" });
|
|
965
|
+
var AssetListItemSchema = Schema11.Struct({
|
|
966
|
+
id: Schema11.String.check(Schema11.isUUID()),
|
|
967
|
+
name: Schema11.NonEmptyString,
|
|
968
|
+
mimeType: Schema11.NonEmptyString,
|
|
969
|
+
byteSize: Schema11.Int,
|
|
970
|
+
createdAt: Schema11.Date,
|
|
971
|
+
updatedAt: Schema11.Date,
|
|
972
|
+
url: Schema11.optionalKey(Schema11.String)
|
|
973
|
+
}).annotate({ identifier: "AssetListItem" });
|
|
974
|
+
var AssetStatsSchema = Schema11.Struct({
|
|
975
|
+
assetCount: Schema11.Int,
|
|
976
|
+
storageUsedBytes: Schema11.Int
|
|
977
|
+
}).annotate({ identifier: "AssetStats" });
|
|
978
|
+
var AssetListSchema = Schema11.Struct({
|
|
979
|
+
items: Schema11.Array(AssetListItemSchema),
|
|
980
|
+
stats: AssetStatsSchema
|
|
981
|
+
}).annotate({ identifier: "AssetList" });
|
|
982
|
+
var AssetListArgsSchema = Schema11.Struct({
|
|
983
|
+
...AssetListQuerySchema.fields,
|
|
984
|
+
scopeKey: Schema11.NonEmptyString,
|
|
985
|
+
showFiles: Schema11.Boolean
|
|
986
|
+
}).annotate({ identifier: "AssetListArgs" });
|
|
987
|
+
var AssetListError = Schema11.Literals([
|
|
988
|
+
"unauthorized",
|
|
989
|
+
"forbidden",
|
|
990
|
+
"unavailable"
|
|
991
|
+
]).annotate({ identifier: "AssetListError" });
|
|
992
|
+
|
|
993
|
+
class AssetList extends Query.Service()("@krak-stack/assets/AssetList", {
|
|
994
|
+
args: AssetListArgsSchema,
|
|
995
|
+
success: AssetListSchema,
|
|
996
|
+
error: AssetListError,
|
|
997
|
+
staleTime: "30 seconds"
|
|
998
|
+
}) {
|
|
999
|
+
}
|
|
1000
|
+
var disabledAssetListLayer = AssetList.toLayer(() => Effect2.fail("unavailable"));
|
|
1001
|
+
var assetListArgs = (scopeKey, permissions, query = {}) => permissions.includes("list") ? { ...query, scopeKey, showFiles: permissions.includes("read") } : undefined;
|
|
1002
|
+
var assetLibraryQuery = (getAccess) => ({
|
|
1003
|
+
query: AssetList,
|
|
1004
|
+
dropPrevious: true,
|
|
1005
|
+
args: ({ props }) => {
|
|
1006
|
+
const access = getAccess(props);
|
|
1007
|
+
return access && assetListArgs(access.scopeKey, access.permissions);
|
|
1008
|
+
}
|
|
1009
|
+
});
|
|
1010
|
+
var AssetLibraryPropsSchema = Schema11.Struct({
|
|
1011
|
+
access: AssetLibraryAccessSchema
|
|
1012
|
+
}).annotate({ identifier: "AssetLibraryModelProps" });
|
|
1013
|
+
var AssetLibrarySnapshot = Schema11.Struct({
|
|
1014
|
+
data: Schema11.NullOr(AssetListSchema),
|
|
1015
|
+
status: Schema11.Literals(["idle", "loading", "ready", "failed"])
|
|
1016
|
+
}).annotate({ identifier: "AssetLibrarySnapshot" });
|
|
1017
|
+
var AssetLibraryMessage = UiSchema4.TaggedEnum({
|
|
1018
|
+
LibraryChanged: { library: AssetLibrarySnapshot }
|
|
1019
|
+
}).annotate({ identifier: "AssetLibraryMessage" });
|
|
1020
|
+
var emptyAssetLibrary = { data: null, status: "idle" };
|
|
1021
|
+
var assetLibrarySnapshot = (result) => AsyncResult.isSuccess(result) ? { data: result.value, status: "ready" } : {
|
|
1022
|
+
data: null,
|
|
1023
|
+
status: AsyncResult.isFailure(result) ? "failed" : "loading"
|
|
1024
|
+
};
|
|
1025
|
+
var libraryQuery = (result) => AssetLibraryMessage.LibraryChanged({ library: assetLibrarySnapshot(result) });
|
|
1026
|
+
var assetLibraryOptions = {
|
|
1027
|
+
name: "AssetLibraryView",
|
|
1028
|
+
props: AssetLibraryPropsSchema,
|
|
1029
|
+
model: Schema11.Null,
|
|
1030
|
+
message: Schema11.Never,
|
|
1031
|
+
restore: false,
|
|
1032
|
+
queries: {
|
|
1033
|
+
library: assetLibraryQuery((props) => props.access)
|
|
1034
|
+
}
|
|
1035
|
+
};
|
|
1036
|
+
var options = {
|
|
1037
|
+
...assetLibraryOptions,
|
|
1038
|
+
name: "AssetLibraryModel",
|
|
1039
|
+
model: AssetLibrarySnapshot,
|
|
1040
|
+
message: AssetLibraryMessage,
|
|
1041
|
+
queries: {
|
|
1042
|
+
library: {
|
|
1043
|
+
...assetLibraryOptions.queries.library,
|
|
1044
|
+
onChange: libraryQuery
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
};
|
|
1048
|
+
var definition = Component5.define(options);
|
|
1049
|
+
var AssetLibraryModel = definition.make({
|
|
1050
|
+
init: () => emptyAssetLibrary,
|
|
1051
|
+
update: definition.update({ LibraryChanged: (_, { library }) => library }),
|
|
1052
|
+
view: () => View.text("")
|
|
1053
|
+
});
|
|
1054
|
+
var AssetUploadTransportMessages = {
|
|
1055
|
+
en: {
|
|
1056
|
+
rejected: "The file did not pass the security scan.",
|
|
1057
|
+
failed: "The file could not be published."
|
|
1058
|
+
},
|
|
1059
|
+
fr: {
|
|
1060
|
+
rejected: "Le fichier n’a pas passé l’analyse de sécurité.",
|
|
1061
|
+
failed: "Impossible de publier le fichier."
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
|
|
1065
|
+
class AssetLibraryActions extends Context.Service()("@krak-stack/assets/AssetLibraryActions") {
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1053
1068
|
// ../assets/src/components/asset-input/schema.ts
|
|
1054
1069
|
import { Schema as Schema12 } from "effect";
|
|
1055
1070
|
var AssetInputItemSchema = Schema12.Struct({
|
|
@@ -1104,6 +1119,7 @@ var AssetInputPropsSchema = Schema12.Struct({
|
|
|
1104
1119
|
}))),
|
|
1105
1120
|
uploader: Schema12.optionalKey(AssetUploadPropsSchema)
|
|
1106
1121
|
}).annotate({ identifier: "AssetInputProps" });
|
|
1122
|
+
var AssetInputPickerPropsSchema = AssetInputPropsSchema.mapFields(({ assets, access, value }) => ({ assets, access, value })).annotate({ identifier: "AssetInputPickerProps" });
|
|
1107
1123
|
var AssetUploadJobSchema = Schema12.Struct({
|
|
1108
1124
|
id: Schema12.Int,
|
|
1109
1125
|
file: Schema12.Redacted(Schema12.File),
|
|
@@ -1120,6 +1136,20 @@ var AssetUploadJobSchema = Schema12.Struct({
|
|
|
1120
1136
|
}).annotate({ identifier: "AssetUploadJob" });
|
|
1121
1137
|
|
|
1122
1138
|
// ../assets/src/components/asset-input/index.ts
|
|
1139
|
+
var assetInputPickerOptions = {
|
|
1140
|
+
name: "AssetInputPicker",
|
|
1141
|
+
props: AssetInputPickerPropsSchema,
|
|
1142
|
+
model: Schema13.Null,
|
|
1143
|
+
message: Schema13.Never,
|
|
1144
|
+
restore: false,
|
|
1145
|
+
queries: {
|
|
1146
|
+
library: assetLibraryQuery((props) => props.assets === undefined && props.value !== undefined ? props.access : undefined)
|
|
1147
|
+
}
|
|
1148
|
+
};
|
|
1149
|
+
var assetInputPickerBehaviours = {
|
|
1150
|
+
init: () => null,
|
|
1151
|
+
update: () => null
|
|
1152
|
+
};
|
|
1123
1153
|
var inputCopy = {
|
|
1124
1154
|
en: {
|
|
1125
1155
|
placeholder: "Choose asset",
|
|
@@ -1388,22 +1418,11 @@ var assetUploadState = (job, copy) => {
|
|
|
1388
1418
|
var AssetInputView = Html4.component({
|
|
1389
1419
|
...assetInputOptions,
|
|
1390
1420
|
slots: ["uploadAction"],
|
|
1391
|
-
reads: { localeConfig: krakstackLocaleRead4 }
|
|
1392
|
-
queries: {
|
|
1393
|
-
library: {
|
|
1394
|
-
query: AssetList,
|
|
1395
|
-
dropPrevious: true,
|
|
1396
|
-
args: ({ props }) => props.assets === undefined && props.value !== undefined && props.access ? assetListArgs(props.access.scopeKey, props.access.permissions) : undefined
|
|
1397
|
-
}
|
|
1398
|
-
}
|
|
1421
|
+
reads: { localeConfig: krakstackLocaleRead4 }
|
|
1399
1422
|
}).make({
|
|
1400
1423
|
...assetInputBehaviours,
|
|
1401
1424
|
view: (h, model) => {
|
|
1402
|
-
const
|
|
1403
|
-
const p = {
|
|
1404
|
-
...h.props,
|
|
1405
|
-
assets: h.props.assets ?? (h.props.value !== undefined && h.props.access?.permissions.includes("list") ? AsyncResult2.isSuccess(result) ? result.value.items : [] : undefined)
|
|
1406
|
-
};
|
|
1425
|
+
const p = h.props;
|
|
1407
1426
|
const locale = p.locale ?? h.reads.localeConfig?.locale ?? "en";
|
|
1408
1427
|
const labels = assetInputMessages(locale, p.messages);
|
|
1409
1428
|
const upload = p.uploader;
|
|
@@ -1519,25 +1538,31 @@ var AssetInputView = Html4.component({
|
|
|
1519
1538
|
var connectedUpload = (props) => Layer.unwrap(Effect4.context().pipe(Effect4.map((context) => assetUploadLayer(libraryUpload(Effect4.runPromiseWith(context), props.locale ?? "en", props.replaceId)))));
|
|
1520
1539
|
var ConnectedAssetInput = AssetInputView.pipe(Component7.provide(connectedUpload));
|
|
1521
1540
|
var AssetInput = Html4.component({
|
|
1541
|
+
...assetInputPickerOptions,
|
|
1522
1542
|
name: "AssetInputConnection",
|
|
1523
1543
|
props: assetInputOptions.props,
|
|
1524
|
-
model: Schema14.Null,
|
|
1525
1544
|
message: AssetInputEvents,
|
|
1526
1545
|
events: AssetInputEvents,
|
|
1527
1546
|
slots: ["uploadAction"],
|
|
1528
|
-
reads: { localeConfig: krakstackLocaleRead4 }
|
|
1529
|
-
restore: false
|
|
1547
|
+
reads: { localeConfig: krakstackLocaleRead4 }
|
|
1530
1548
|
}).make({
|
|
1531
|
-
|
|
1549
|
+
...assetInputPickerBehaviours,
|
|
1532
1550
|
update: ($, event) => $.emit(event),
|
|
1533
1551
|
view: (h) => {
|
|
1534
|
-
const { access, uploader, replaceId } = h.props;
|
|
1552
|
+
const { access, uploader, replaceId, value } = h.props;
|
|
1553
|
+
const result = h.queries.library;
|
|
1554
|
+
const assets = h.props.assets ?? (value !== undefined && access?.permissions.includes("list") ? AsyncResult2.isSuccess(result) ? result.value.items : [] : undefined);
|
|
1535
1555
|
const connected = !uploader && access?.permissions.includes(replaceId ? "update" : "create");
|
|
1536
1556
|
const Input = connected ? ConnectedAssetInput : AssetInputView;
|
|
1537
1557
|
const locale = h.props.locale ?? h.reads.localeConfig?.locale ?? "en";
|
|
1538
1558
|
return Input(h, {
|
|
1539
1559
|
key: JSON.stringify([access?.scopeKey, connected, replaceId, locale]),
|
|
1540
|
-
props: {
|
|
1560
|
+
props: {
|
|
1561
|
+
...h.props,
|
|
1562
|
+
...assets === undefined ? {} : { assets },
|
|
1563
|
+
locale,
|
|
1564
|
+
...connected ? { uploader: {} } : {}
|
|
1565
|
+
},
|
|
1541
1566
|
slots: h.slots,
|
|
1542
1567
|
onEmit: (event) => event
|
|
1543
1568
|
});
|
|
@@ -1550,7 +1575,7 @@ import { Html as Html8 } from "effect/ui/html";
|
|
|
1550
1575
|
import { Dialog as Dialog2 } from "effect/ui/kit";
|
|
1551
1576
|
|
|
1552
1577
|
// ../../src/components/copy-button/html.ts
|
|
1553
|
-
import { Schema as
|
|
1578
|
+
import { Schema as Schema16 } from "effect";
|
|
1554
1579
|
import { Component as Component9 } from "effect/ui";
|
|
1555
1580
|
import { Html as Html5 } from "effect/ui/html";
|
|
1556
1581
|
import { Button as Button4 } from "@/components/effectcn/button";
|
|
@@ -1558,17 +1583,17 @@ import { krakstackLocaleRead as krakstackLocaleRead5 } from "@krak-stack/registr
|
|
|
1558
1583
|
import { Check as Check2, Copy, TriangleAlert as TriangleAlert2 } from "@krak-stack/registry/lucide-effect";
|
|
1559
1584
|
|
|
1560
1585
|
// ../../src/components/copy-button/index.ts
|
|
1561
|
-
import { Effect as Effect5, Redacted as Redacted5, Schema as
|
|
1562
|
-
import { Command as Command2, Component as Component8, UiSchema as UiSchema6
|
|
1586
|
+
import { Effect as Effect5, Redacted as Redacted5, Schema as Schema15 } from "effect";
|
|
1587
|
+
import { Command as Command2, Component as Component8, UiSchema as UiSchema6 } from "effect/ui";
|
|
1563
1588
|
|
|
1564
1589
|
// ../../src/components/copy-button/schema.ts
|
|
1565
|
-
import { Schema as
|
|
1566
|
-
var MessageOverrides =
|
|
1567
|
-
copy:
|
|
1568
|
-
copied:
|
|
1569
|
-
copyFailed:
|
|
1590
|
+
import { Schema as Schema14 } from "effect";
|
|
1591
|
+
var MessageOverrides = Schema14.Struct({
|
|
1592
|
+
copy: Schema14.optional(Schema14.String),
|
|
1593
|
+
copied: Schema14.optional(Schema14.String),
|
|
1594
|
+
copyFailed: Schema14.optional(Schema14.String)
|
|
1570
1595
|
}).annotate({ identifier: "CopyButtonMessageOverrides" });
|
|
1571
|
-
var CopyButtonTranslations =
|
|
1596
|
+
var CopyButtonTranslations = Schema14.Record(Schema14.String, Schema14.UndefinedOr(MessageOverrides));
|
|
1572
1597
|
var copyButtonVariants = [
|
|
1573
1598
|
"default",
|
|
1574
1599
|
"secondary",
|
|
@@ -1577,18 +1602,21 @@ var copyButtonVariants = [
|
|
|
1577
1602
|
"destructive",
|
|
1578
1603
|
"link"
|
|
1579
1604
|
];
|
|
1580
|
-
var
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1605
|
+
var ClipboardFailureCause = Schema14.Redacted(Schema14.Unknown, {
|
|
1606
|
+
disallowJsonEncode: true
|
|
1607
|
+
}).annotate({ identifier: "ClipboardFailureCause" });
|
|
1608
|
+
var CopyButtonModelProps = Schema14.Struct({
|
|
1609
|
+
value: Schema14.Redacted(Schema14.String, { disallowJsonEncode: true }),
|
|
1610
|
+
disabled: Schema14.optional(Schema14.Boolean),
|
|
1611
|
+
resetDelay: Schema14.optional(Schema14.Finite)
|
|
1584
1612
|
}).annotate({ identifier: "CopyButtonModelProps" });
|
|
1585
|
-
var copyButtonSharedProps =
|
|
1613
|
+
var copyButtonSharedProps = Schema14.Struct({
|
|
1586
1614
|
...CopyButtonModelProps.fields,
|
|
1587
|
-
valueDescription:
|
|
1588
|
-
copyVariant:
|
|
1589
|
-
variant:
|
|
1590
|
-
locale:
|
|
1591
|
-
messages:
|
|
1615
|
+
valueDescription: Schema14.optional(Schema14.String),
|
|
1616
|
+
copyVariant: Schema14.optional(Schema14.Literals(["default", "sm", "large"])),
|
|
1617
|
+
variant: Schema14.optional(Schema14.Literals(copyButtonVariants)),
|
|
1618
|
+
locale: Schema14.optional(Schema14.String),
|
|
1619
|
+
messages: Schema14.optional(CopyButtonTranslations)
|
|
1592
1620
|
}).annotate({ identifier: "CopyButtonSharedProps" });
|
|
1593
1621
|
|
|
1594
1622
|
// ../../src/components/copy-button/index.ts
|
|
@@ -1604,46 +1632,53 @@ var copyButtonMessages = (locale = "en", translations) => ({
|
|
|
1604
1632
|
var copyButtonLabel = (copy, description) => description ? `${copy} ${description}` : copy;
|
|
1605
1633
|
var CopyButtonMessage = UiSchema6.TaggedEnum({
|
|
1606
1634
|
Pressed: {},
|
|
1607
|
-
Finished: {
|
|
1635
|
+
Finished: {
|
|
1636
|
+
success: Schema15.Boolean,
|
|
1637
|
+
cause: Schema15.optionalKey(ClipboardFailureCause)
|
|
1638
|
+
},
|
|
1608
1639
|
Reset: {}
|
|
1609
1640
|
}).annotate({ identifier: "CopyButtonMessage" });
|
|
1641
|
+
var CopyButtonEvent = UiSchema6.TaggedEnum({
|
|
1642
|
+
Copied: {},
|
|
1643
|
+
CopyFailed: { cause: Schema15.optionalKey(ClipboardFailureCause) }
|
|
1644
|
+
}).annotate({ identifier: "CopyButtonEvent" });
|
|
1610
1645
|
|
|
1611
1646
|
class WriteClipboard extends Command2.Service()("copy-button/WriteClipboard", {
|
|
1612
1647
|
args: {
|
|
1613
|
-
value:
|
|
1648
|
+
value: Schema15.Redacted(Schema15.String, { disallowJsonEncode: true })
|
|
1614
1649
|
},
|
|
1615
1650
|
success: CopyButtonMessage
|
|
1616
1651
|
}) {
|
|
1617
|
-
static layerFromWrite = (write) => WriteClipboard.toLayer(({ value }) => Effect5.tryPromise(
|
|
1652
|
+
static layerFromWrite = (write) => WriteClipboard.toLayer(({ value }) => Effect5.tryPromise({
|
|
1653
|
+
try: () => write(Redacted5.value(value)),
|
|
1654
|
+
catch: Redacted5.make
|
|
1655
|
+
}).pipe(Effect5.match({
|
|
1618
1656
|
onSuccess: () => CopyButtonMessage.Finished({ success: true }),
|
|
1619
|
-
onFailure: () => CopyButtonMessage.Finished({ success: false })
|
|
1657
|
+
onFailure: (cause) => CopyButtonMessage.Finished({ success: false, cause })
|
|
1620
1658
|
})));
|
|
1621
1659
|
static browser = WriteClipboard.layerFromWrite((value) => navigator.clipboard.writeText(value));
|
|
1622
1660
|
}
|
|
1623
|
-
var ResetClipboardFeedback = Command2.make("copy-button/ResetFeedback", { args: { delay:
|
|
1661
|
+
var ResetClipboardFeedback = Command2.make("copy-button/ResetFeedback", { args: { delay: Schema15.Number }, mode: "switch" }, ({ delay }) => Effect5.sleep(Math.max(0, delay)).pipe(Effect5.as(CopyButtonMessage.Reset())));
|
|
1624
1662
|
var copyButtonOptions = {
|
|
1625
1663
|
name: "CopyButton",
|
|
1626
1664
|
props: CopyButtonModelProps,
|
|
1627
|
-
model:
|
|
1628
|
-
status:
|
|
1665
|
+
model: Schema15.Struct({
|
|
1666
|
+
status: Schema15.Literals(["idle", "copied", "failed"])
|
|
1629
1667
|
}).annotate({ identifier: "CopyButtonModel" }),
|
|
1630
1668
|
message: CopyButtonMessage,
|
|
1669
|
+
events: CopyButtonEvent,
|
|
1631
1670
|
restore: false
|
|
1632
1671
|
};
|
|
1633
1672
|
var Definition = Component8.define(copyButtonOptions);
|
|
1634
1673
|
var update4 = Definition.update({
|
|
1635
1674
|
Pressed: ($) => $.props.disabled ? $.model : $.run(WriteClipboard.make({ value: $.props.value })),
|
|
1636
|
-
Finished: ($, { success }) => $.evolve({ status: success ? "copied" : "failed" }).run(ResetClipboardFeedback.make({ delay: $.props.resetDelay ?? 1500 })),
|
|
1675
|
+
Finished: ($, { success, cause }) => $.evolve({ status: success ? "copied" : "failed" }).run(ResetClipboardFeedback.make({ delay: $.props.resetDelay ?? 1500 })).emit(success ? CopyButtonEvent.Copied() : CopyButtonEvent.CopyFailed(cause === undefined ? {} : { cause })),
|
|
1637
1676
|
Reset: ($) => $.evolve({ status: "idle" })
|
|
1638
1677
|
});
|
|
1639
1678
|
var copyButtonBehaviours = {
|
|
1640
1679
|
init: () => ({ status: "idle" }),
|
|
1641
1680
|
update: update4
|
|
1642
1681
|
};
|
|
1643
|
-
var CopyButtonModel = Definition.make({
|
|
1644
|
-
...copyButtonBehaviours,
|
|
1645
|
-
view: () => View2.text("")
|
|
1646
|
-
});
|
|
1647
1682
|
var copyButtonStatus = (status, copy, description) => {
|
|
1648
1683
|
if (status === "idle")
|
|
1649
1684
|
return "";
|
|
@@ -1652,11 +1687,11 @@ var copyButtonStatus = (status, copy, description) => {
|
|
|
1652
1687
|
};
|
|
1653
1688
|
|
|
1654
1689
|
// ../../src/components/copy-button/html.ts
|
|
1655
|
-
var Props =
|
|
1690
|
+
var Props = Schema16.Struct({
|
|
1656
1691
|
...copyButtonSharedProps.fields,
|
|
1657
|
-
accessibleLabel:
|
|
1658
|
-
variant:
|
|
1659
|
-
className:
|
|
1692
|
+
accessibleLabel: Schema16.optionalKey(Schema16.String),
|
|
1693
|
+
variant: Schema16.optionalKey(Schema16.Literals([...copyButtonVariants, "brand"])),
|
|
1694
|
+
className: Schema16.optionalKey(Schema16.String)
|
|
1660
1695
|
}).annotate({ identifier: "CopyButtonHtmlProps" });
|
|
1661
1696
|
var CopyButton = Html5.component({
|
|
1662
1697
|
...copyButtonOptions,
|
|
@@ -1691,7 +1726,7 @@ import {
|
|
|
1691
1726
|
import { inputVariants } from "@/components/effectcn/input";
|
|
1692
1727
|
|
|
1693
1728
|
// ../../src/components/data-table/html.ts
|
|
1694
|
-
import { Array as Arr, Schema as
|
|
1729
|
+
import { Array as Arr, Schema as Schema22, Stream as Stream4 } from "effect";
|
|
1695
1730
|
import { Mount as Mount2, UiSchema as UiSchema9 } from "effect/ui";
|
|
1696
1731
|
import { Html as Html7 } from "effect/ui/html";
|
|
1697
1732
|
import { Checkbox, Menu, Menubar, Select as Select2, VirtualList as VirtualList2 } from "effect/ui/kit";
|
|
@@ -1769,51 +1804,51 @@ var resolvePaginationClasses = (overrides) => ({
|
|
|
1769
1804
|
});
|
|
1770
1805
|
|
|
1771
1806
|
// ../../src/components/pagination/index.ts
|
|
1772
|
-
import { Schema as
|
|
1807
|
+
import { Schema as Schema18 } from "effect";
|
|
1773
1808
|
import { Component as Component10, UiSchema as UiSchema7 } from "effect/ui";
|
|
1774
1809
|
|
|
1775
1810
|
// ../../src/components/pagination/schema.ts
|
|
1776
|
-
import { Schema as
|
|
1777
|
-
var Labels =
|
|
1778
|
-
pageSize:
|
|
1779
|
-
goToFirstPage:
|
|
1780
|
-
goToPreviousPage:
|
|
1781
|
-
goToNextPage:
|
|
1782
|
-
goToLastPage:
|
|
1811
|
+
import { Schema as Schema17, Struct as Struct4 } from "effect";
|
|
1812
|
+
var Labels = Schema17.Struct({
|
|
1813
|
+
pageSize: Schema17.optional(Schema17.String),
|
|
1814
|
+
goToFirstPage: Schema17.optional(Schema17.String),
|
|
1815
|
+
goToPreviousPage: Schema17.optional(Schema17.String),
|
|
1816
|
+
goToNextPage: Schema17.optional(Schema17.String),
|
|
1817
|
+
goToLastPage: Schema17.optional(Schema17.String)
|
|
1783
1818
|
}).annotate({ identifier: "PaginationLabelOverrides" });
|
|
1784
|
-
var Translations =
|
|
1785
|
-
var PaginationClassesOverridesSchema =
|
|
1786
|
-
var PaginationPropsSchema =
|
|
1787
|
-
classes:
|
|
1788
|
-
className:
|
|
1789
|
-
pageSizeContentClassName:
|
|
1790
|
-
compact:
|
|
1791
|
-
locale:
|
|
1792
|
-
messages:
|
|
1793
|
-
page:
|
|
1794
|
-
pageCount:
|
|
1795
|
-
pageSize:
|
|
1796
|
-
pageSizes:
|
|
1797
|
-
selectedRows:
|
|
1798
|
-
showResults:
|
|
1799
|
-
totalRows:
|
|
1819
|
+
var Translations = Schema17.Record(Schema17.String, Schema17.UndefinedOr(Labels));
|
|
1820
|
+
var PaginationClassesOverridesSchema = Schema17.Record(Schema17.Literals(Struct4.keys(paginationClasses)), Schema17.optionalKey(Schema17.String)).annotate({ identifier: "PaginationClassesOverrides" });
|
|
1821
|
+
var PaginationPropsSchema = Schema17.Struct({
|
|
1822
|
+
classes: Schema17.optional(PaginationClassesOverridesSchema),
|
|
1823
|
+
className: Schema17.optional(Schema17.String),
|
|
1824
|
+
pageSizeContentClassName: Schema17.optional(Schema17.String),
|
|
1825
|
+
compact: Schema17.optional(Schema17.Boolean),
|
|
1826
|
+
locale: Schema17.optional(Schema17.String),
|
|
1827
|
+
messages: Schema17.optional(Translations),
|
|
1828
|
+
page: Schema17.Int,
|
|
1829
|
+
pageCount: Schema17.Int,
|
|
1830
|
+
pageSize: Schema17.Int,
|
|
1831
|
+
pageSizes: Schema17.optional(Schema17.Array(Schema17.Int)),
|
|
1832
|
+
selectedRows: Schema17.optional(Schema17.Int),
|
|
1833
|
+
showResults: Schema17.optional(Schema17.Boolean),
|
|
1834
|
+
totalRows: Schema17.Int
|
|
1800
1835
|
}).annotate({ identifier: "PaginationProps" });
|
|
1801
1836
|
|
|
1802
1837
|
// ../../src/components/pagination/index.ts
|
|
1803
1838
|
var PaginationMessage = UiSchema7.TaggedEnum({
|
|
1804
1839
|
Opened: {},
|
|
1805
1840
|
Closed: {},
|
|
1806
|
-
PageRequested: { page:
|
|
1807
|
-
SizeRequested: { pageSize:
|
|
1841
|
+
PageRequested: { page: Schema18.Int },
|
|
1842
|
+
SizeRequested: { pageSize: Schema18.Int }
|
|
1808
1843
|
}).annotate({ identifier: "PaginationMessage" });
|
|
1809
1844
|
var PaginationEvents = UiSchema7.TaggedEnum({
|
|
1810
|
-
PageChanged: { page:
|
|
1811
|
-
PageSizeChanged: { pageSize:
|
|
1845
|
+
PageChanged: { page: Schema18.Int },
|
|
1846
|
+
PageSizeChanged: { pageSize: Schema18.Int }
|
|
1812
1847
|
}).annotate({ identifier: "PaginationEvents" });
|
|
1813
1848
|
var paginationOptions = {
|
|
1814
1849
|
name: "Pagination",
|
|
1815
1850
|
props: PaginationPropsSchema,
|
|
1816
|
-
model:
|
|
1851
|
+
model: Schema18.Boolean,
|
|
1817
1852
|
message: PaginationMessage,
|
|
1818
1853
|
events: PaginationEvents,
|
|
1819
1854
|
restore: false
|
|
@@ -1963,7 +1998,7 @@ import {
|
|
|
1963
1998
|
DateTime,
|
|
1964
1999
|
Effect as Effect6,
|
|
1965
2000
|
Option,
|
|
1966
|
-
Schema as
|
|
2001
|
+
Schema as Schema19,
|
|
1967
2002
|
SchemaGetter,
|
|
1968
2003
|
SchemaIssue,
|
|
1969
2004
|
SchemaTransformation
|
|
@@ -1975,25 +2010,25 @@ var parseSortParam = (sort) => {
|
|
|
1975
2010
|
}
|
|
1976
2011
|
return { id, direction: sort.startsWith("-") ? "desc" : "asc" };
|
|
1977
2012
|
};
|
|
1978
|
-
var SortDirection =
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
]).pipe(
|
|
2013
|
+
var SortDirection = Schema19.Union([
|
|
2014
|
+
Schema19.Literal("asc"),
|
|
2015
|
+
Schema19.Literal("desc")
|
|
2016
|
+
]).pipe(Schema19.annotate({
|
|
1982
2017
|
identifier: "SortDirection",
|
|
1983
2018
|
title: "Sort Direction",
|
|
1984
2019
|
description: "Sort direction for list query results.",
|
|
1985
2020
|
examples: ["asc", "desc"]
|
|
1986
2021
|
}));
|
|
1987
|
-
var SortParam =
|
|
1988
|
-
id:
|
|
2022
|
+
var SortParam = Schema19.Struct({
|
|
2023
|
+
id: Schema19.NonEmptyString,
|
|
1989
2024
|
direction: SortDirection
|
|
1990
|
-
}).pipe(
|
|
2025
|
+
}).pipe(Schema19.annotate({
|
|
1991
2026
|
identifier: "SortParam",
|
|
1992
2027
|
title: "Sort Parameter",
|
|
1993
2028
|
description: "Decoded sort parameter with a field id and direction.",
|
|
1994
2029
|
examples: [{ id: "publicName", direction: "asc" }]
|
|
1995
2030
|
}));
|
|
1996
|
-
var SortParamFromString =
|
|
2031
|
+
var SortParamFromString = Schema19.String.pipe(Schema19.decodeTo(SortParam, SchemaTransformation.transformEffect({
|
|
1997
2032
|
decode: (sort) => {
|
|
1998
2033
|
const sortParam = parseSortParam(sort);
|
|
1999
2034
|
if (!sortParam) {
|
|
@@ -2002,13 +2037,13 @@ var SortParamFromString = Schema20.String.pipe(Schema20.decodeTo(SortParam, Sche
|
|
|
2002
2037
|
return Effect6.succeed(sortParam);
|
|
2003
2038
|
},
|
|
2004
2039
|
encode: (sort) => Effect6.succeed(sort.direction === "desc" ? `-${sort.id}` : sort.id)
|
|
2005
|
-
})),
|
|
2040
|
+
})), Schema19.annotate({
|
|
2006
2041
|
identifier: "SortParamFromString",
|
|
2007
2042
|
title: "Sort Parameter From String",
|
|
2008
2043
|
description: 'URL encoded single sort parameter where descending fields are prefixed with "-".',
|
|
2009
2044
|
examples: [{ id: "publicName", direction: "asc" }]
|
|
2010
2045
|
}));
|
|
2011
|
-
var SortParamsFromString =
|
|
2046
|
+
var SortParamsFromString = Schema19.String.pipe(Schema19.decodeTo(Schema19.Array(SortParam), SchemaTransformation.transformEffect({
|
|
2012
2047
|
decode: (sort) => {
|
|
2013
2048
|
if (sort === "")
|
|
2014
2049
|
return Effect6.succeed([]);
|
|
@@ -2023,8 +2058,8 @@ var SortParamsFromString = Schema20.String.pipe(Schema20.decodeTo(Schema20.Array
|
|
|
2023
2058
|
}
|
|
2024
2059
|
return Effect6.succeed(sortParams);
|
|
2025
2060
|
},
|
|
2026
|
-
encode: (sort) => Effect6.succeed(sort.map((part) =>
|
|
2027
|
-
})),
|
|
2061
|
+
encode: (sort) => Effect6.succeed(sort.map((part) => Schema19.encodeSync(SortParamFromString)(part)).join(","))
|
|
2062
|
+
})), Schema19.annotate({
|
|
2028
2063
|
identifier: "SortParamsFromString",
|
|
2029
2064
|
title: "Sort Parameters From String",
|
|
2030
2065
|
description: 'URL encoded sort parameters where descending fields are prefixed with "-" and multiple fields are comma-separated.',
|
|
@@ -2035,68 +2070,68 @@ var SortParamsFromString = Schema20.String.pipe(Schema20.decodeTo(Schema20.Array
|
|
|
2035
2070
|
]
|
|
2036
2071
|
]
|
|
2037
2072
|
}));
|
|
2038
|
-
var SortParamsArray =
|
|
2039
|
-
var SortParams =
|
|
2073
|
+
var SortParamsArray = Schema19.Array(SortParam);
|
|
2074
|
+
var SortParams = Schema19.declare(Schema19.is(SortParamsArray), {
|
|
2040
2075
|
identifier: "SortParams",
|
|
2041
|
-
toCodec: () =>
|
|
2042
|
-
toCodecStringTree: () =>
|
|
2076
|
+
toCodec: () => Schema19.link()(SortParamsArray, SchemaTransformation.passthrough()),
|
|
2077
|
+
toCodecStringTree: () => Schema19.link()(SortParamsFromString, SchemaTransformation.passthrough())
|
|
2043
2078
|
});
|
|
2044
|
-
var TextFilterOperator =
|
|
2079
|
+
var TextFilterOperator = Schema19.Literals([
|
|
2045
2080
|
"contains",
|
|
2046
2081
|
"equals",
|
|
2047
2082
|
"startsWith",
|
|
2048
2083
|
"endsWith"
|
|
2049
2084
|
]).annotate({ identifier: "TextFilterOperator" });
|
|
2050
|
-
var FilterCalendarDate =
|
|
2051
|
-
var ColumnFilter =
|
|
2052
|
-
|
|
2053
|
-
id:
|
|
2054
|
-
kind:
|
|
2085
|
+
var FilterCalendarDate = Schema19.String.check(Schema19.isPattern(/^\d{4}-\d{2}-\d{2}$/), Schema19.makeFilter((value) => Option.exists(DateTime.make(value), (date) => DateTime.formatIsoDateUtc(date) === value))).annotate({ identifier: "FilterCalendarDate" });
|
|
2086
|
+
var ColumnFilter = Schema19.Union([
|
|
2087
|
+
Schema19.Struct({
|
|
2088
|
+
id: Schema19.NonEmptyString,
|
|
2089
|
+
kind: Schema19.Literal("text"),
|
|
2055
2090
|
operator: TextFilterOperator,
|
|
2056
|
-
value:
|
|
2091
|
+
value: Schema19.NonEmptyString
|
|
2057
2092
|
}),
|
|
2058
|
-
|
|
2059
|
-
id:
|
|
2060
|
-
kind:
|
|
2061
|
-
min:
|
|
2062
|
-
max:
|
|
2063
|
-
}).check(
|
|
2064
|
-
|
|
2065
|
-
id:
|
|
2066
|
-
kind:
|
|
2067
|
-
from:
|
|
2068
|
-
to:
|
|
2069
|
-
}).check(
|
|
2070
|
-
|
|
2071
|
-
id:
|
|
2072
|
-
kind:
|
|
2073
|
-
value:
|
|
2093
|
+
Schema19.Struct({
|
|
2094
|
+
id: Schema19.NonEmptyString,
|
|
2095
|
+
kind: Schema19.Literal("number"),
|
|
2096
|
+
min: Schema19.optional(Schema19.Finite),
|
|
2097
|
+
max: Schema19.optional(Schema19.Finite)
|
|
2098
|
+
}).check(Schema19.makeFilter((range) => (range.min !== undefined || range.max !== undefined) && (range.min === undefined || range.max === undefined || range.min <= range.max))),
|
|
2099
|
+
Schema19.Struct({
|
|
2100
|
+
id: Schema19.NonEmptyString,
|
|
2101
|
+
kind: Schema19.Literal("date"),
|
|
2102
|
+
from: Schema19.optional(FilterCalendarDate),
|
|
2103
|
+
to: Schema19.optional(FilterCalendarDate)
|
|
2104
|
+
}).check(Schema19.makeFilter((range) => (range.from !== undefined || range.to !== undefined) && (range.from === undefined || range.to === undefined || range.from <= range.to))),
|
|
2105
|
+
Schema19.Struct({
|
|
2106
|
+
id: Schema19.NonEmptyString,
|
|
2107
|
+
kind: Schema19.Literal("boolean"),
|
|
2108
|
+
value: Schema19.Boolean
|
|
2074
2109
|
}),
|
|
2075
|
-
|
|
2076
|
-
id:
|
|
2077
|
-
kind:
|
|
2078
|
-
values:
|
|
2110
|
+
Schema19.Struct({
|
|
2111
|
+
id: Schema19.NonEmptyString,
|
|
2112
|
+
kind: Schema19.Literal("values"),
|
|
2113
|
+
values: Schema19.NonEmptyArray(Schema19.String)
|
|
2079
2114
|
})
|
|
2080
2115
|
]).annotate({ identifier: "ColumnFilter" });
|
|
2081
|
-
var ColumnFiltersArray =
|
|
2082
|
-
var ColumnFilters =
|
|
2116
|
+
var ColumnFiltersArray = Schema19.Array(ColumnFilter);
|
|
2117
|
+
var ColumnFilters = Schema19.declare(Schema19.is(ColumnFiltersArray), {
|
|
2083
2118
|
identifier: "ColumnFilters",
|
|
2084
|
-
toCodec: () =>
|
|
2085
|
-
toCodecStringTree: () =>
|
|
2119
|
+
toCodec: () => Schema19.link()(ColumnFiltersArray, SchemaTransformation.passthrough()),
|
|
2120
|
+
toCodecStringTree: () => Schema19.link()(Schema19.fromJsonString(ColumnFiltersArray), SchemaTransformation.passthrough())
|
|
2086
2121
|
});
|
|
2087
2122
|
var DEFAULT_PAGE_SIZE = 100;
|
|
2088
|
-
var Query3 =
|
|
2089
|
-
page:
|
|
2123
|
+
var Query3 = Schema19.Struct({
|
|
2124
|
+
page: Schema19.optional(Schema19.Union([Schema19.Finite, Schema19.FiniteFromString]).check(Schema19.isInt(), Schema19.isGreaterThanOrEqualTo(0))).pipe(Schema19.decodeTo(Schema19.Int.check(Schema19.isGreaterThanOrEqualTo(0)), {
|
|
2090
2125
|
decode: SchemaGetter.withDefault(Effect6.succeed(0)),
|
|
2091
2126
|
encode: SchemaGetter.transformOptional(Option.filter((page) => page !== 0))
|
|
2092
2127
|
})),
|
|
2093
|
-
pageSize:
|
|
2128
|
+
pageSize: Schema19.optional(Schema19.Union([Schema19.Finite, Schema19.FiniteFromString]).check(Schema19.isInt(), Schema19.isBetween({ minimum: 1, maximum: 100 }))).pipe(Schema19.decodeTo(Schema19.Int.check(Schema19.isBetween({ minimum: 1, maximum: 100 })), {
|
|
2094
2129
|
decode: SchemaGetter.withDefault(Effect6.succeed(DEFAULT_PAGE_SIZE)),
|
|
2095
2130
|
encode: SchemaGetter.transformOptional(Option.filter((pageSize) => pageSize !== DEFAULT_PAGE_SIZE))
|
|
2096
2131
|
})),
|
|
2097
|
-
globalFilter:
|
|
2098
|
-
sort:
|
|
2099
|
-
filters:
|
|
2132
|
+
globalFilter: Schema19.optional(Schema19.String),
|
|
2133
|
+
sort: Schema19.optional(SortParams),
|
|
2134
|
+
filters: Schema19.optional(ColumnFilters)
|
|
2100
2135
|
}).annotate({
|
|
2101
2136
|
identifier: "Query",
|
|
2102
2137
|
title: "Query",
|
|
@@ -2113,13 +2148,13 @@ var Query3 = Schema20.Struct({
|
|
|
2113
2148
|
}
|
|
2114
2149
|
]
|
|
2115
2150
|
});
|
|
2116
|
-
var QueryStandard =
|
|
2117
|
-
var PaginationMeta =
|
|
2118
|
-
page:
|
|
2119
|
-
pageSize:
|
|
2120
|
-
total:
|
|
2121
|
-
pageCount:
|
|
2122
|
-
}).pipe(
|
|
2151
|
+
var QueryStandard = Schema19.toStandardSchemaV1(Query3);
|
|
2152
|
+
var PaginationMeta = Schema19.Struct({
|
|
2153
|
+
page: Schema19.Int,
|
|
2154
|
+
pageSize: Schema19.Int,
|
|
2155
|
+
total: Schema19.Int,
|
|
2156
|
+
pageCount: Schema19.Int
|
|
2157
|
+
}).pipe(Schema19.annotate({
|
|
2123
2158
|
identifier: "PaginationMeta",
|
|
2124
2159
|
title: "Pagination Metadata",
|
|
2125
2160
|
description: "Pagination metadata returned with a paginated list response.",
|
|
@@ -2149,16 +2184,24 @@ import {
|
|
|
2149
2184
|
} from "@krak-stack/registry/lucide-effect";
|
|
2150
2185
|
|
|
2151
2186
|
// ../../src/components/data-table/index.ts
|
|
2152
|
-
import { DateTime as DateTime3, Effect as Effect7, Option as Option3, Redacted as Redacted6, Schema as
|
|
2187
|
+
import { DateTime as DateTime3, Effect as Effect7, Option as Option3, Redacted as Redacted6, Schema as Schema21, Stream as Stream3 } from "effect";
|
|
2153
2188
|
import { Csv } from "effect/encoding";
|
|
2154
2189
|
import { Command as Command3, Component as Component11, Subscription, UiSchema as UiSchema8 } from "effect/ui";
|
|
2155
2190
|
|
|
2156
2191
|
// ../../src/components/data-table/schema.ts
|
|
2157
|
-
import { DateTime as DateTime2, Option as Option2, Predicate as Predicate2, Schema as
|
|
2192
|
+
import { DateTime as DateTime2, Option as Option2, Predicate as Predicate2, Schema as Schema20, Struct as Struct5, Tuple } from "effect";
|
|
2158
2193
|
|
|
2159
2194
|
// ../../src/components/data-table/classes.ts
|
|
2195
|
+
var tableListEntryClasses = {
|
|
2196
|
+
menuItem: "min-h-0 px-2 py-1.5 text-sm leading-5",
|
|
2197
|
+
detail: "flex min-w-0 flex-1 items-center gap-2 text-left",
|
|
2198
|
+
avatar: "bg-secondary text-secondary-foreground flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-full",
|
|
2199
|
+
image: "size-full object-cover"
|
|
2200
|
+
};
|
|
2160
2201
|
var booleanCellControl = "flex min-h-16 w-full items-center justify-start px-2 in-[[data-slot=table-cell]]:absolute in-[[data-slot=table-cell]]:inset-0 in-[[data-slot=table-cell]]:min-h-0 has-[:focus-visible]:outline-2 has-[:focus-visible]:-outline-offset-2 has-[:focus-visible]:outline-ring";
|
|
2161
2202
|
var cellTriggerFocus = "focus-visible:ring-0 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring";
|
|
2203
|
+
var tableSurfaceContext = "in-[[role=dialog]]:[--data-table-dialog-surface:var(--popover)]";
|
|
2204
|
+
var tableSurface = "bg-[color:var(--data-table-surface,var(--data-table-dialog-surface,var(--background)))]";
|
|
2162
2205
|
var tableBadgeTones = {
|
|
2163
2206
|
success: "border-emerald-200 bg-emerald-100 text-emerald-900 dark:border-emerald-900/50 dark:bg-emerald-950/50 dark:text-emerald-200",
|
|
2164
2207
|
info: "border-blue-200 bg-blue-100 text-blue-900 dark:border-blue-900/50 dark:bg-blue-950/50 dark:text-blue-200",
|
|
@@ -2176,11 +2219,11 @@ var tableClasses = {
|
|
|
2176
2219
|
cell: "overflow-hidden",
|
|
2177
2220
|
cellContent: "min-w-0 wrap-anywhere",
|
|
2178
2221
|
actionTrigger: `size-8 ${cellTriggerFocus}`,
|
|
2179
|
-
actionsCell:
|
|
2222
|
+
actionsCell: `sticky right-0 z-20 w-10 min-w-10 cursor-default p-0 transition-colors ${tableSurface} group-hover/row:bg-[color-mix(in_oklab,var(--muted)_50%,var(--data-table-surface,var(--data-table-dialog-surface,var(--background))))]`,
|
|
2180
2223
|
actionsAlign: "flex min-h-12 items-center justify-end pe-1",
|
|
2181
2224
|
row: "h-16 [&:where(:not(:last-child))>td]:border-b",
|
|
2182
2225
|
header: "relative h-12 p-0",
|
|
2183
|
-
stickyHeader:
|
|
2226
|
+
stickyHeader: `sticky top-0 z-30 ${tableSurface}`,
|
|
2184
2227
|
stickyHeaderRule: "after:border-border after:pointer-events-none after:absolute after:inset-x-0 after:bottom-0 after:border-b",
|
|
2185
2228
|
headerTrigger: `absolute inset-0 h-full w-full min-w-0 justify-start rounded-none px-2 pe-4 ${cellTriggerFocus}`,
|
|
2186
2229
|
resizeHandle: "absolute inset-y-0 right-0 z-10 w-2 cursor-col-resize touch-none outline-none after:absolute after:inset-y-3 after:right-0 after:w-px after:bg-border hover:after:w-0.5 hover:after:bg-primary/60 focus-visible:after:w-0.5 focus-visible:after:bg-ring",
|
|
@@ -2196,129 +2239,130 @@ var tableClasses = {
|
|
|
2196
2239
|
referenceName: "truncate font-medium",
|
|
2197
2240
|
referenceDescription: "text-muted-foreground truncate text-xs"
|
|
2198
2241
|
};
|
|
2199
|
-
var tableResultsFooterClass =
|
|
2242
|
+
var tableResultsFooterClass = `${tableSurface} text-muted-foreground sticky bottom-0 z-30 shrink-0 border-t px-2 py-2 text-sm`;
|
|
2200
2243
|
var resolveTableClasses = (overrides) => ({
|
|
2201
2244
|
...tableClasses,
|
|
2202
2245
|
...overrides
|
|
2203
2246
|
});
|
|
2204
2247
|
|
|
2205
2248
|
// ../../src/components/data-table/schema.ts
|
|
2206
|
-
var TableClassesOverridesSchema =
|
|
2207
|
-
var DataTableCommonPropsSchema =
|
|
2208
|
-
classes:
|
|
2209
|
-
className:
|
|
2210
|
-
locale:
|
|
2249
|
+
var TableClassesOverridesSchema = Schema20.Record(Schema20.Literals(Struct5.keys(tableClasses)), Schema20.optionalKey(Schema20.String)).annotate({ identifier: "TableClassesOverrides" });
|
|
2250
|
+
var DataTableCommonPropsSchema = Schema20.Struct({
|
|
2251
|
+
classes: Schema20.optional(TableClassesOverridesSchema),
|
|
2252
|
+
className: Schema20.optionalKey(Schema20.String),
|
|
2253
|
+
locale: Schema20.optionalKey(Schema20.String)
|
|
2211
2254
|
}).annotate({ identifier: "DataTableCommonProps" });
|
|
2212
|
-
var DataTableSortSchema =
|
|
2213
|
-
id:
|
|
2214
|
-
direction:
|
|
2255
|
+
var DataTableSortSchema = Schema20.Struct({
|
|
2256
|
+
id: Schema20.NonEmptyString,
|
|
2257
|
+
direction: Schema20.Literals(["asc", "desc"])
|
|
2215
2258
|
}).annotate({ identifier: "DataTableSort" });
|
|
2216
2259
|
var queryFields = {
|
|
2217
|
-
page:
|
|
2218
|
-
pageSize:
|
|
2219
|
-
globalFilter:
|
|
2220
|
-
sort:
|
|
2221
|
-
filters:
|
|
2260
|
+
page: Schema20.Int.check(Schema20.isGreaterThanOrEqualTo(0)),
|
|
2261
|
+
pageSize: Schema20.Int.check(Schema20.isBetween({ minimum: 1, maximum: 100 })),
|
|
2262
|
+
globalFilter: Schema20.optional(Schema20.String),
|
|
2263
|
+
sort: Schema20.optional(Schema20.Array(DataTableSortSchema)),
|
|
2264
|
+
filters: Schema20.optional(Schema20.Array(ColumnFilter))
|
|
2222
2265
|
};
|
|
2223
|
-
var DataTableQuerySchema =
|
|
2266
|
+
var DataTableQuerySchema = Schema20.Struct(queryFields).annotate({
|
|
2224
2267
|
identifier: "DataTableQuery"
|
|
2225
2268
|
});
|
|
2226
|
-
var PageSizes =
|
|
2227
|
-
var DataTableCommonFeaturesSchema =
|
|
2228
|
-
search:
|
|
2229
|
-
filtering:
|
|
2230
|
-
sorting:
|
|
2231
|
-
columnVisibility:
|
|
2269
|
+
var PageSizes = Schema20.NonEmptyArray(Schema20.Int.check(Schema20.isBetween({ minimum: 1, maximum: 100 })));
|
|
2270
|
+
var DataTableCommonFeaturesSchema = Schema20.Struct({
|
|
2271
|
+
search: Schema20.optionalKey(Schema20.Boolean),
|
|
2272
|
+
filtering: Schema20.optionalKey(Schema20.Boolean),
|
|
2273
|
+
sorting: Schema20.optionalKey(Schema20.Boolean),
|
|
2274
|
+
columnVisibility: Schema20.optionalKey(Schema20.Boolean)
|
|
2232
2275
|
});
|
|
2233
|
-
var PaginationSchema =
|
|
2234
|
-
|
|
2235
|
-
mode:
|
|
2236
|
-
pageSizes:
|
|
2276
|
+
var PaginationSchema = Schema20.Union([
|
|
2277
|
+
Schema20.Struct({
|
|
2278
|
+
mode: Schema20.optionalKey(Schema20.Literal("client")),
|
|
2279
|
+
pageSizes: Schema20.optionalKey(PageSizes)
|
|
2237
2280
|
}).annotate({ identifier: "DataTableClientPagination" }),
|
|
2238
|
-
|
|
2239
|
-
mode:
|
|
2240
|
-
rowCount:
|
|
2241
|
-
pageSizes:
|
|
2281
|
+
Schema20.Struct({
|
|
2282
|
+
mode: Schema20.Literal("server"),
|
|
2283
|
+
rowCount: Schema20.Int.check(Schema20.isGreaterThanOrEqualTo(0)),
|
|
2284
|
+
pageSizes: Schema20.optionalKey(PageSizes)
|
|
2242
2285
|
}).annotate({ identifier: "DataTableServerPagination" })
|
|
2243
2286
|
]);
|
|
2244
|
-
var DataTableItemSchema =
|
|
2245
|
-
value:
|
|
2246
|
-
label:
|
|
2287
|
+
var DataTableItemSchema = Schema20.Struct({
|
|
2288
|
+
value: Schema20.NonEmptyString,
|
|
2289
|
+
label: Schema20.String,
|
|
2290
|
+
imageSrc: Schema20.optionalKey(Schema20.String)
|
|
2247
2291
|
}).annotate({ identifier: "DataTableItem" });
|
|
2248
|
-
var TableIconSchema =
|
|
2249
|
-
var DataTableReferenceSchema =
|
|
2250
|
-
label:
|
|
2251
|
-
description:
|
|
2252
|
-
imageSrc:
|
|
2292
|
+
var TableIconSchema = Schema20.declare((value) => Predicate2.isFunction(value)).annotate({ identifier: "DataTableIcon" });
|
|
2293
|
+
var DataTableReferenceSchema = Schema20.Struct({
|
|
2294
|
+
label: Schema20.String,
|
|
2295
|
+
description: Schema20.optionalKey(Schema20.String),
|
|
2296
|
+
imageSrc: Schema20.optionalKey(Schema20.NullOr(Schema20.String))
|
|
2253
2297
|
}).annotate({ identifier: "DataTableReference" });
|
|
2254
|
-
var CalendarDate =
|
|
2255
|
-
var isCalendarDate =
|
|
2256
|
-
var InstantString =
|
|
2257
|
-
var DataTableDateInputSchema =
|
|
2258
|
-
|
|
2259
|
-
|
|
2298
|
+
var CalendarDate = Schema20.String.check(Schema20.isPattern(/^\d{4}-\d{2}-\d{2}$/), Schema20.makeFilter((value) => Option2.exists(DateTime2.make(value), (date) => DateTime2.formatIsoDateUtc(date) === value))).annotate({ identifier: "DataTableCalendarDate" });
|
|
2299
|
+
var isCalendarDate = Schema20.is(CalendarDate);
|
|
2300
|
+
var InstantString = Schema20.String.check(Schema20.isPattern(/^\d{4}-\d{2}-\d{2}T(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/), Schema20.makeFilter((value) => isCalendarDate(value.slice(0, 10)))).annotate({ identifier: "DataTableInstantString" });
|
|
2301
|
+
var DataTableDateInputSchema = Schema20.Union([
|
|
2302
|
+
Schema20.Date,
|
|
2303
|
+
Schema20.Int,
|
|
2260
2304
|
CalendarDate,
|
|
2261
2305
|
InstantString
|
|
2262
2306
|
]).annotate({ identifier: "DataTableDateInput" });
|
|
2263
|
-
var DateStyle =
|
|
2264
|
-
var DataTableDateFormatSchema =
|
|
2265
|
-
locale:
|
|
2266
|
-
timeZone:
|
|
2267
|
-
dateStyle:
|
|
2268
|
-
exportFormat:
|
|
2307
|
+
var DateStyle = Schema20.Literals(["full", "long", "medium", "short"]);
|
|
2308
|
+
var DataTableDateFormatSchema = Schema20.Struct({
|
|
2309
|
+
locale: Schema20.optionalKey(Schema20.String),
|
|
2310
|
+
timeZone: Schema20.optionalKey(Schema20.String),
|
|
2311
|
+
dateStyle: Schema20.optionalKey(DateStyle),
|
|
2312
|
+
exportFormat: Schema20.optionalKey(Schema20.Literals(["iso", "formatted"]))
|
|
2269
2313
|
}).annotate({ identifier: "DataTableDateFormat" });
|
|
2270
|
-
var DataTableDateTimeFormatSchema =
|
|
2314
|
+
var DataTableDateTimeFormatSchema = Schema20.Struct({
|
|
2271
2315
|
...DataTableDateFormatSchema.fields,
|
|
2272
|
-
timeStyle:
|
|
2273
|
-
hour12:
|
|
2316
|
+
timeStyle: Schema20.optionalKey(DateStyle),
|
|
2317
|
+
hour12: Schema20.optionalKey(Schema20.Boolean)
|
|
2274
2318
|
}).annotate({ identifier: "DataTableDateTimeFormat" });
|
|
2275
|
-
var DataTableCellValueSchema =
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2319
|
+
var DataTableCellValueSchema = Schema20.NullOr(Schema20.Union([
|
|
2320
|
+
Schema20.String,
|
|
2321
|
+
Schema20.Boolean,
|
|
2322
|
+
Schema20.Finite,
|
|
2323
|
+
Schema20.Array(DataTableItemSchema),
|
|
2280
2324
|
DataTableReferenceSchema
|
|
2281
2325
|
])).annotate({ identifier: "DataTableCellValue" });
|
|
2282
|
-
var DataTableActionSchema =
|
|
2283
|
-
id:
|
|
2284
|
-
name:
|
|
2285
|
-
variant:
|
|
2286
|
-
disabled:
|
|
2326
|
+
var DataTableActionSchema = Schema20.Struct({
|
|
2327
|
+
id: Schema20.NonEmptyString,
|
|
2328
|
+
name: Schema20.String,
|
|
2329
|
+
variant: Schema20.optionalKey(Schema20.Literals(["default", "destructive"])),
|
|
2330
|
+
disabled: Schema20.optionalKey(Schema20.Boolean)
|
|
2287
2331
|
}).annotate({ identifier: "DataTableAction" });
|
|
2288
|
-
var DataTableRowActionSchema =
|
|
2332
|
+
var DataTableRowActionSchema = Schema20.Struct({
|
|
2289
2333
|
...DataTableActionSchema.fields,
|
|
2290
|
-
icon:
|
|
2334
|
+
icon: Schema20.optionalKey(TableIconSchema)
|
|
2291
2335
|
}).annotate({ identifier: "DataTableRowAction" });
|
|
2292
|
-
var DataTableRowSchema =
|
|
2293
|
-
id:
|
|
2294
|
-
label:
|
|
2295
|
-
cells:
|
|
2296
|
-
actions:
|
|
2297
|
-
primaryActionId:
|
|
2298
|
-
groups:
|
|
2299
|
-
selectable:
|
|
2300
|
-
disabledColumnIds:
|
|
2336
|
+
var DataTableRowSchema = Schema20.Struct({
|
|
2337
|
+
id: Schema20.NonEmptyString,
|
|
2338
|
+
label: Schema20.String,
|
|
2339
|
+
cells: Schema20.Record(Schema20.String, DataTableCellValueSchema),
|
|
2340
|
+
actions: Schema20.optionalKey(Schema20.Array(DataTableRowActionSchema)),
|
|
2341
|
+
primaryActionId: Schema20.optionalKey(Schema20.String),
|
|
2342
|
+
groups: Schema20.optionalKey(Schema20.Record(Schema20.String, Schema20.Array(Schema20.String))),
|
|
2343
|
+
selectable: Schema20.optionalKey(Schema20.Boolean),
|
|
2344
|
+
disabledColumnIds: Schema20.optionalKey(Schema20.Array(Schema20.String))
|
|
2301
2345
|
}).annotate({ identifier: "DataTableRow" });
|
|
2302
2346
|
var column = {
|
|
2303
|
-
id:
|
|
2304
|
-
headerName:
|
|
2305
|
-
sortable:
|
|
2306
|
-
hideable:
|
|
2307
|
-
export:
|
|
2308
|
-
width:
|
|
2309
|
-
minWidth:
|
|
2310
|
-
maxWidth:
|
|
2311
|
-
resizable:
|
|
2312
|
-
truncate:
|
|
2313
|
-
searchable:
|
|
2314
|
-
filterable:
|
|
2315
|
-
emptyLabel:
|
|
2316
|
-
nulls:
|
|
2347
|
+
id: Schema20.NonEmptyString,
|
|
2348
|
+
headerName: Schema20.String,
|
|
2349
|
+
sortable: Schema20.optionalKey(Schema20.Boolean),
|
|
2350
|
+
hideable: Schema20.optionalKey(Schema20.Boolean),
|
|
2351
|
+
export: Schema20.optionalKey(Schema20.Boolean),
|
|
2352
|
+
width: Schema20.optionalKey(Schema20.Number),
|
|
2353
|
+
minWidth: Schema20.optionalKey(Schema20.Number),
|
|
2354
|
+
maxWidth: Schema20.optionalKey(Schema20.Number),
|
|
2355
|
+
resizable: Schema20.optionalKey(Schema20.Boolean),
|
|
2356
|
+
truncate: Schema20.optionalKey(Schema20.Boolean),
|
|
2357
|
+
searchable: Schema20.optionalKey(Schema20.Boolean),
|
|
2358
|
+
filterable: Schema20.optionalKey(Schema20.Boolean),
|
|
2359
|
+
emptyLabel: Schema20.optionalKey(Schema20.String),
|
|
2360
|
+
nulls: Schema20.optionalKey(Schema20.Literals(["first", "last"]))
|
|
2317
2361
|
};
|
|
2318
|
-
var DataTableBadgeOptionSchema =
|
|
2319
|
-
value:
|
|
2320
|
-
label:
|
|
2321
|
-
variant:
|
|
2362
|
+
var DataTableBadgeOptionSchema = Schema20.Struct({
|
|
2363
|
+
value: Schema20.NonEmptyString,
|
|
2364
|
+
label: Schema20.optionalKey(Schema20.String),
|
|
2365
|
+
variant: Schema20.optionalKey(Schema20.Literals([
|
|
2322
2366
|
"default",
|
|
2323
2367
|
"secondary",
|
|
2324
2368
|
"outline",
|
|
@@ -2328,214 +2372,216 @@ var DataTableBadgeOptionSchema = Schema21.Struct({
|
|
|
2328
2372
|
"muted"
|
|
2329
2373
|
]))
|
|
2330
2374
|
}).annotate({ identifier: "DataTableBadgeOption" });
|
|
2331
|
-
var DataTableBadgeOptionsSchema =
|
|
2332
|
-
options:
|
|
2375
|
+
var DataTableBadgeOptionsSchema = Schema20.Struct({
|
|
2376
|
+
options: Schema20.optionalKey(Schema20.Array(DataTableBadgeOptionSchema.mapFields((fields) => ({
|
|
2333
2377
|
...fields,
|
|
2334
|
-
icon:
|
|
2378
|
+
icon: Schema20.optionalKey(TableIconSchema)
|
|
2335
2379
|
}))))
|
|
2336
2380
|
}).annotate({ identifier: "DataTableBadgeOptions" });
|
|
2337
|
-
var DataTableFieldSchema =
|
|
2338
|
-
|
|
2381
|
+
var DataTableFieldSchema = Schema20.Union([
|
|
2382
|
+
Schema20.Struct({
|
|
2339
2383
|
...column,
|
|
2340
|
-
type:
|
|
2341
|
-
display:
|
|
2342
|
-
typeOptions:
|
|
2384
|
+
type: Schema20.Literal("text"),
|
|
2385
|
+
display: Schema20.optionalKey(Schema20.Literal("badge")),
|
|
2386
|
+
typeOptions: Schema20.optionalKey(DataTableBadgeOptionsSchema)
|
|
2343
2387
|
}),
|
|
2344
|
-
|
|
2388
|
+
Schema20.Struct({
|
|
2345
2389
|
...column,
|
|
2346
|
-
type:
|
|
2347
|
-
typeOptions:
|
|
2348
|
-
locale:
|
|
2349
|
-
format:
|
|
2350
|
-
style:
|
|
2351
|
-
currency:
|
|
2352
|
-
unit:
|
|
2353
|
-
notation:
|
|
2354
|
-
minimumFractionDigits:
|
|
2355
|
-
maximumFractionDigits:
|
|
2356
|
-
exportFormat:
|
|
2390
|
+
type: Schema20.Literal("number"),
|
|
2391
|
+
typeOptions: Schema20.optionalKey(Schema20.Struct({
|
|
2392
|
+
locale: Schema20.optionalKey(Schema20.String),
|
|
2393
|
+
format: Schema20.optionalKey(Schema20.Literal("bytes")),
|
|
2394
|
+
style: Schema20.optionalKey(Schema20.Literals(["decimal", "percent", "currency", "unit"])),
|
|
2395
|
+
currency: Schema20.optionalKey(Schema20.String),
|
|
2396
|
+
unit: Schema20.optionalKey(Schema20.String),
|
|
2397
|
+
notation: Schema20.optionalKey(Schema20.Literals(["standard", "scientific", "engineering", "compact"])),
|
|
2398
|
+
minimumFractionDigits: Schema20.optionalKey(Schema20.Int.check(Schema20.isBetween({ minimum: 0, maximum: 20 }))),
|
|
2399
|
+
maximumFractionDigits: Schema20.optionalKey(Schema20.Int.check(Schema20.isBetween({ minimum: 0, maximum: 20 }))),
|
|
2400
|
+
exportFormat: Schema20.optionalKey(Schema20.Literals(["raw", "formatted"]))
|
|
2357
2401
|
}).annotate({ identifier: "DataTableNumberFormat" }))
|
|
2358
2402
|
}),
|
|
2359
|
-
|
|
2403
|
+
Schema20.Struct({
|
|
2360
2404
|
...column,
|
|
2361
|
-
type:
|
|
2362
|
-
typeOptions:
|
|
2363
|
-
imageVariant:
|
|
2364
|
-
|
|
2405
|
+
type: Schema20.Literal("reference"),
|
|
2406
|
+
typeOptions: Schema20.optionalKey(Schema20.Struct({
|
|
2407
|
+
imageVariant: Schema20.optionalKey(Schema20.Literals(["circle", "square"])),
|
|
2408
|
+
appearance: Schema20.optionalKey(Schema20.Literal("resource")),
|
|
2409
|
+
fallbackIcons: Schema20.optionalKey(Schema20.Record(Schema20.String, TableIconSchema))
|
|
2365
2410
|
}).annotate({ identifier: "DataTableReferenceOptions" }))
|
|
2366
2411
|
}),
|
|
2367
|
-
|
|
2412
|
+
Schema20.Struct({
|
|
2368
2413
|
...column,
|
|
2369
|
-
type:
|
|
2370
|
-
typeOptions:
|
|
2414
|
+
type: Schema20.Literal("date"),
|
|
2415
|
+
typeOptions: Schema20.optionalKey(DataTableDateFormatSchema)
|
|
2371
2416
|
}),
|
|
2372
|
-
|
|
2417
|
+
Schema20.Struct({
|
|
2373
2418
|
...column,
|
|
2374
|
-
type:
|
|
2375
|
-
typeOptions:
|
|
2419
|
+
type: Schema20.Literal("dateTime"),
|
|
2420
|
+
typeOptions: Schema20.optionalKey(DataTableDateTimeFormatSchema)
|
|
2376
2421
|
}),
|
|
2377
|
-
|
|
2422
|
+
Schema20.Struct({
|
|
2378
2423
|
...column,
|
|
2379
|
-
type:
|
|
2380
|
-
editable:
|
|
2381
|
-
typeOptions:
|
|
2382
|
-
trueLabel:
|
|
2383
|
-
falseLabel:
|
|
2384
|
-
exportFormat:
|
|
2424
|
+
type: Schema20.Literal("boolean"),
|
|
2425
|
+
editable: Schema20.optionalKey(Schema20.Boolean),
|
|
2426
|
+
typeOptions: Schema20.optionalKey(Schema20.Struct({
|
|
2427
|
+
trueLabel: Schema20.optionalKey(Schema20.String),
|
|
2428
|
+
falseLabel: Schema20.optionalKey(Schema20.String),
|
|
2429
|
+
exportFormat: Schema20.optionalKey(Schema20.Literals(["raw", "formatted"]))
|
|
2385
2430
|
}).annotate({ identifier: "DataTableBooleanFormat" }))
|
|
2386
2431
|
}),
|
|
2387
|
-
|
|
2432
|
+
Schema20.Struct({
|
|
2388
2433
|
...column,
|
|
2389
|
-
type:
|
|
2390
|
-
filterOptions:
|
|
2391
|
-
options:
|
|
2392
|
-
allowRemove:
|
|
2393
|
-
itemActions:
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2434
|
+
type: Schema20.Literal("list"),
|
|
2435
|
+
filterOptions: Schema20.optionalKey(Schema20.Array(DataTableItemSchema)),
|
|
2436
|
+
options: Schema20.optionalKey(Schema20.Array(DataTableItemSchema)),
|
|
2437
|
+
allowRemove: Schema20.optionalKey(Schema20.Boolean),
|
|
2438
|
+
itemActions: Schema20.optionalKey(Schema20.Array(DataTableActionSchema)),
|
|
2439
|
+
itemActionIcons: Schema20.optionalKey(Schema20.Record(Schema20.String, TableIconSchema)),
|
|
2440
|
+
display: Schema20.optionalKey(Schema20.Literals(["list", "icon", "badge"])),
|
|
2441
|
+
visibleCount: Schema20.optionalKey(Schema20.Int.check(Schema20.isGreaterThanOrEqualTo(0))),
|
|
2442
|
+
actionsLabel: Schema20.optionalKey(Schema20.String),
|
|
2443
|
+
manageLabel: Schema20.optionalKey(Schema20.String)
|
|
2398
2444
|
})
|
|
2399
2445
|
]).annotate({ identifier: "DataTableField" });
|
|
2400
|
-
var DataTableColumnSchema = DataTableFieldSchema.mapMembers(Tuple.map(
|
|
2401
|
-
fields:
|
|
2446
|
+
var DataTableColumnSchema = DataTableFieldSchema.mapMembers(Tuple.map(Schema20.fieldsAssign({
|
|
2447
|
+
fields: Schema20.optionalKey(Schema20.Array(DataTableFieldSchema))
|
|
2402
2448
|
}))).annotate({ identifier: "DataTableColumn" });
|
|
2403
|
-
var DataTableLabelsSchema =
|
|
2404
|
-
actions:
|
|
2405
|
-
addItem:
|
|
2406
|
-
listDetails:
|
|
2407
|
-
empty:
|
|
2408
|
-
filters:
|
|
2409
|
-
filtersClear:
|
|
2410
|
-
filterColumn:
|
|
2411
|
-
filterClear:
|
|
2412
|
-
filterApply:
|
|
2413
|
-
filterValue:
|
|
2414
|
-
filterOperator:
|
|
2415
|
-
filterContains:
|
|
2416
|
-
filterEquals:
|
|
2417
|
-
filterStartsWith:
|
|
2418
|
-
filterEndsWith:
|
|
2419
|
-
filterMin:
|
|
2420
|
-
filterMax:
|
|
2421
|
-
filterFrom:
|
|
2422
|
-
filterTo:
|
|
2423
|
-
filterTrue:
|
|
2424
|
-
filterFalse:
|
|
2425
|
-
filterInvalid:
|
|
2426
|
-
columns:
|
|
2427
|
-
sortBy:
|
|
2428
|
-
hideColumn:
|
|
2429
|
-
loading:
|
|
2430
|
-
removeItem:
|
|
2431
|
-
search:
|
|
2432
|
-
selectAllRows:
|
|
2433
|
-
selectRow:
|
|
2434
|
-
selected:
|
|
2435
|
-
sortAsc:
|
|
2436
|
-
sortDesc:
|
|
2437
|
-
sortClear:
|
|
2438
|
-
view:
|
|
2439
|
-
tableView:
|
|
2440
|
-
galleryView:
|
|
2441
|
-
groupBy:
|
|
2442
|
-
export:
|
|
2443
|
-
exportFailed:
|
|
2444
|
-
moveUp:
|
|
2445
|
-
moveDown:
|
|
2446
|
-
reorder:
|
|
2447
|
-
refresh:
|
|
2448
|
-
resize:
|
|
2449
|
+
var DataTableLabelsSchema = Schema20.Struct({
|
|
2450
|
+
actions: Schema20.optionalKey(Schema20.String),
|
|
2451
|
+
addItem: Schema20.optionalKey(Schema20.String),
|
|
2452
|
+
listDetails: Schema20.optionalKey(Schema20.String),
|
|
2453
|
+
empty: Schema20.optionalKey(Schema20.String),
|
|
2454
|
+
filters: Schema20.optionalKey(Schema20.String),
|
|
2455
|
+
filtersClear: Schema20.optionalKey(Schema20.String),
|
|
2456
|
+
filterColumn: Schema20.optionalKey(Schema20.String),
|
|
2457
|
+
filterClear: Schema20.optionalKey(Schema20.String),
|
|
2458
|
+
filterApply: Schema20.optionalKey(Schema20.String),
|
|
2459
|
+
filterValue: Schema20.optionalKey(Schema20.String),
|
|
2460
|
+
filterOperator: Schema20.optionalKey(Schema20.String),
|
|
2461
|
+
filterContains: Schema20.optionalKey(Schema20.String),
|
|
2462
|
+
filterEquals: Schema20.optionalKey(Schema20.String),
|
|
2463
|
+
filterStartsWith: Schema20.optionalKey(Schema20.String),
|
|
2464
|
+
filterEndsWith: Schema20.optionalKey(Schema20.String),
|
|
2465
|
+
filterMin: Schema20.optionalKey(Schema20.String),
|
|
2466
|
+
filterMax: Schema20.optionalKey(Schema20.String),
|
|
2467
|
+
filterFrom: Schema20.optionalKey(Schema20.String),
|
|
2468
|
+
filterTo: Schema20.optionalKey(Schema20.String),
|
|
2469
|
+
filterTrue: Schema20.optionalKey(Schema20.String),
|
|
2470
|
+
filterFalse: Schema20.optionalKey(Schema20.String),
|
|
2471
|
+
filterInvalid: Schema20.optionalKey(Schema20.String),
|
|
2472
|
+
columns: Schema20.optionalKey(Schema20.String),
|
|
2473
|
+
sortBy: Schema20.optionalKey(Schema20.String),
|
|
2474
|
+
hideColumn: Schema20.optionalKey(Schema20.String),
|
|
2475
|
+
loading: Schema20.optionalKey(Schema20.String),
|
|
2476
|
+
removeItem: Schema20.optionalKey(Schema20.String),
|
|
2477
|
+
search: Schema20.optionalKey(Schema20.String),
|
|
2478
|
+
selectAllRows: Schema20.optionalKey(Schema20.String),
|
|
2479
|
+
selectRow: Schema20.optionalKey(Schema20.String),
|
|
2480
|
+
selected: Schema20.optionalKey(Schema20.String),
|
|
2481
|
+
sortAsc: Schema20.optionalKey(Schema20.String),
|
|
2482
|
+
sortDesc: Schema20.optionalKey(Schema20.String),
|
|
2483
|
+
sortClear: Schema20.optionalKey(Schema20.String),
|
|
2484
|
+
view: Schema20.optionalKey(Schema20.String),
|
|
2485
|
+
tableView: Schema20.optionalKey(Schema20.String),
|
|
2486
|
+
galleryView: Schema20.optionalKey(Schema20.String),
|
|
2487
|
+
groupBy: Schema20.optionalKey(Schema20.String),
|
|
2488
|
+
export: Schema20.optionalKey(Schema20.String),
|
|
2489
|
+
exportFailed: Schema20.optionalKey(Schema20.String),
|
|
2490
|
+
moveUp: Schema20.optionalKey(Schema20.String),
|
|
2491
|
+
moveDown: Schema20.optionalKey(Schema20.String),
|
|
2492
|
+
reorder: Schema20.optionalKey(Schema20.String),
|
|
2493
|
+
refresh: Schema20.optionalKey(Schema20.String),
|
|
2494
|
+
resize: Schema20.optionalKey(Schema20.String)
|
|
2449
2495
|
}).annotate({ identifier: "DataTableLabels" });
|
|
2450
|
-
var DataTableViewSchema =
|
|
2451
|
-
var DataTablePreferencesSchema =
|
|
2452
|
-
columnVisibility:
|
|
2453
|
-
columnSizing:
|
|
2454
|
-
grouping:
|
|
2496
|
+
var DataTableViewSchema = Schema20.Literals(["table", "gallery"]);
|
|
2497
|
+
var DataTablePreferencesSchema = Schema20.Struct({
|
|
2498
|
+
columnVisibility: Schema20.Record(Schema20.String, Schema20.Boolean),
|
|
2499
|
+
columnSizing: Schema20.Record(Schema20.String, Schema20.Finite),
|
|
2500
|
+
grouping: Schema20.optionalKey(Schema20.Array(Schema20.String)),
|
|
2455
2501
|
view: DataTableViewSchema
|
|
2456
2502
|
}).annotate({ identifier: "DataTablePersistedUiState" });
|
|
2457
|
-
var GroupField =
|
|
2458
|
-
id:
|
|
2459
|
-
label:
|
|
2460
|
-
actionsLabel:
|
|
2461
|
-
groups:
|
|
2462
|
-
id:
|
|
2463
|
-
label:
|
|
2464
|
-
empty:
|
|
2503
|
+
var GroupField = Schema20.Struct({
|
|
2504
|
+
id: Schema20.NonEmptyString,
|
|
2505
|
+
label: Schema20.String,
|
|
2506
|
+
actionsLabel: Schema20.optionalKey(Schema20.String),
|
|
2507
|
+
groups: Schema20.optionalKey(Schema20.Array(Schema20.Struct({
|
|
2508
|
+
id: Schema20.String,
|
|
2509
|
+
label: Schema20.String,
|
|
2510
|
+
empty: Schema20.optionalKey(Schema20.String)
|
|
2465
2511
|
}).annotate({ identifier: "DataTableGroupLabel" }))),
|
|
2466
|
-
actions:
|
|
2467
|
-
movable:
|
|
2512
|
+
actions: Schema20.optionalKey(Schema20.Array(DataTableActionSchema)),
|
|
2513
|
+
movable: Schema20.optionalKey(Schema20.Boolean)
|
|
2468
2514
|
}).annotate({ identifier: "DataTableGroupField" });
|
|
2469
|
-
var DataTablePropsSchema =
|
|
2515
|
+
var DataTablePropsSchema = Schema20.Struct({
|
|
2470
2516
|
...DataTableCommonPropsSchema.fields,
|
|
2471
|
-
label:
|
|
2472
|
-
rowData:
|
|
2473
|
-
rowActivation:
|
|
2474
|
-
columnDefs:
|
|
2475
|
-
status:
|
|
2476
|
-
loading:
|
|
2477
|
-
empty:
|
|
2478
|
-
error:
|
|
2517
|
+
label: Schema20.String,
|
|
2518
|
+
rowData: Schema20.Array(DataTableRowSchema),
|
|
2519
|
+
rowActivation: Schema20.optionalKey(Schema20.Boolean),
|
|
2520
|
+
columnDefs: Schema20.Array(DataTableColumnSchema),
|
|
2521
|
+
status: Schema20.optionalKey(Schema20.Struct({
|
|
2522
|
+
loading: Schema20.optionalKey(Schema20.Boolean),
|
|
2523
|
+
empty: Schema20.optionalKey(Schema20.String),
|
|
2524
|
+
error: Schema20.optionalKey(Schema20.String)
|
|
2479
2525
|
})),
|
|
2480
|
-
sort:
|
|
2481
|
-
sortMode:
|
|
2482
|
-
search:
|
|
2483
|
-
columnFilters:
|
|
2484
|
-
state:
|
|
2485
|
-
features:
|
|
2526
|
+
sort: Schema20.optionalKey(Schema20.Array(DataTableSortSchema)),
|
|
2527
|
+
sortMode: Schema20.optionalKey(Schema20.Literals(["client", "server"])),
|
|
2528
|
+
search: Schema20.optionalKey(Schema20.Boolean),
|
|
2529
|
+
columnFilters: Schema20.optionalKey(Schema20.Boolean),
|
|
2530
|
+
state: Schema20.optionalKey(DataTableQuerySchema),
|
|
2531
|
+
features: Schema20.optionalKey(Schema20.Struct({
|
|
2486
2532
|
...DataTableCommonFeaturesSchema.fields,
|
|
2487
|
-
pagination:
|
|
2488
|
-
grouping:
|
|
2489
|
-
initial:
|
|
2490
|
-
fields:
|
|
2533
|
+
pagination: Schema20.optionalKey(Schema20.Union([Schema20.Literal(false), PaginationSchema])),
|
|
2534
|
+
grouping: Schema20.optionalKey(Schema20.Struct({
|
|
2535
|
+
initial: Schema20.optionalKey(Schema20.Array(Schema20.String)),
|
|
2536
|
+
fields: Schema20.Array(GroupField)
|
|
2491
2537
|
}).annotate({ identifier: "DataTableGrouping" })),
|
|
2492
|
-
gallery:
|
|
2493
|
-
name:
|
|
2494
|
-
description:
|
|
2495
|
-
image:
|
|
2496
|
-
tags:
|
|
2538
|
+
gallery: Schema20.optionalKey(Schema20.Struct({
|
|
2539
|
+
name: Schema20.String,
|
|
2540
|
+
description: Schema20.optionalKey(Schema20.String),
|
|
2541
|
+
image: Schema20.optionalKey(Schema20.String),
|
|
2542
|
+
tags: Schema20.optionalKey(Schema20.Array(Schema20.String))
|
|
2497
2543
|
}).annotate({ identifier: "DataTableGallery" })),
|
|
2498
|
-
reordering:
|
|
2499
|
-
export:
|
|
2500
|
-
baseName:
|
|
2501
|
-
scope:
|
|
2502
|
-
builtIn:
|
|
2503
|
-
actions:
|
|
2504
|
-
pending:
|
|
2505
|
-
failed:
|
|
2544
|
+
reordering: Schema20.optionalKey(Schema20.Boolean),
|
|
2545
|
+
export: Schema20.optionalKey(Schema20.Struct({
|
|
2546
|
+
baseName: Schema20.String,
|
|
2547
|
+
scope: Schema20.optionalKey(Schema20.Literals(["filteredRows", "currentPage"])),
|
|
2548
|
+
builtIn: Schema20.optionalKey(Schema20.Boolean),
|
|
2549
|
+
actions: Schema20.optionalKey(Schema20.Array(DataTableActionSchema)),
|
|
2550
|
+
pending: Schema20.optionalKey(Schema20.Boolean),
|
|
2551
|
+
failed: Schema20.optionalKey(Schema20.Boolean)
|
|
2506
2552
|
}).annotate({ identifier: "DataTableExport" })),
|
|
2507
|
-
refresh:
|
|
2508
|
-
virtualization:
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
scroll:
|
|
2512
|
-
height:
|
|
2513
|
-
estimateRowHeight:
|
|
2514
|
-
overscan:
|
|
2553
|
+
refresh: Schema20.optionalKey(Schema20.Boolean),
|
|
2554
|
+
virtualization: Schema20.optionalKey(Schema20.Union([
|
|
2555
|
+
Schema20.Boolean,
|
|
2556
|
+
Schema20.Struct({
|
|
2557
|
+
scroll: Schema20.optionalKey(Schema20.Literals(["table", "internal", "page"])),
|
|
2558
|
+
height: Schema20.optionalKey(Schema20.Int.check(Schema20.isGreaterThan(0))),
|
|
2559
|
+
estimateRowHeight: Schema20.optionalKey(Schema20.Int.check(Schema20.isGreaterThan(0))),
|
|
2560
|
+
overscan: Schema20.optionalKey(Schema20.Int.check(Schema20.isGreaterThanOrEqualTo(0)))
|
|
2515
2561
|
}).annotate({ identifier: "DataTableVirtualization" })
|
|
2516
2562
|
]))
|
|
2517
2563
|
}).annotate({ identifier: "DataTableHtmlFeatures" })),
|
|
2518
|
-
initialState:
|
|
2564
|
+
initialState: Schema20.optionalKey(Schema20.Struct({
|
|
2519
2565
|
...queryFields,
|
|
2520
|
-
page:
|
|
2521
|
-
pageSize:
|
|
2522
|
-
columnVisibility:
|
|
2523
|
-
view:
|
|
2566
|
+
page: Schema20.optional(queryFields.page),
|
|
2567
|
+
pageSize: Schema20.optional(queryFields.pageSize),
|
|
2568
|
+
columnVisibility: Schema20.optionalKey(Schema20.Record(Schema20.String, Schema20.Boolean)),
|
|
2569
|
+
view: Schema20.optionalKey(DataTableViewSchema)
|
|
2524
2570
|
}).annotate({ identifier: "DataTableInitialQuery" })),
|
|
2525
|
-
pagination:
|
|
2526
|
-
selection:
|
|
2527
|
-
selectedRowIds:
|
|
2528
|
-
bulkActionsLabel:
|
|
2529
|
-
bulkActions:
|
|
2571
|
+
pagination: Schema20.optionalKey(PaginationSchema),
|
|
2572
|
+
selection: Schema20.optionalKey(Schema20.Struct({
|
|
2573
|
+
selectedRowIds: Schema20.optionalKey(Schema20.Array(Schema20.String)),
|
|
2574
|
+
bulkActionsLabel: Schema20.optionalKey(Schema20.String),
|
|
2575
|
+
bulkActions: Schema20.optionalKey(Schema20.Array(DataTableActionSchema))
|
|
2530
2576
|
})),
|
|
2531
|
-
messages:
|
|
2577
|
+
messages: Schema20.optionalKey(Schema20.Record(Schema20.String, DataTableLabelsSchema))
|
|
2532
2578
|
}).annotate({ identifier: "DataTableProps" });
|
|
2533
|
-
var DataTableFilterDraftSchema =
|
|
2534
|
-
id:
|
|
2535
|
-
primary:
|
|
2536
|
-
secondary:
|
|
2579
|
+
var DataTableFilterDraftSchema = Schema20.Struct({
|
|
2580
|
+
id: Schema20.String,
|
|
2581
|
+
primary: Schema20.String,
|
|
2582
|
+
secondary: Schema20.String,
|
|
2537
2583
|
operator: TextFilterOperator,
|
|
2538
|
-
values:
|
|
2584
|
+
values: Schema20.Array(Schema20.String)
|
|
2539
2585
|
}).annotate({ identifier: "DataTableFilterDraft" });
|
|
2540
2586
|
|
|
2541
2587
|
// ../../src/components/data-table/index.ts
|
|
@@ -2644,11 +2690,11 @@ var htmlDataTableMessages = (locale, messages) => {
|
|
|
2644
2690
|
};
|
|
2645
2691
|
};
|
|
2646
2692
|
var compareTableText = (left, right, locale) => left.localeCompare(right, locale, { numeric: true, sensitivity: "base" });
|
|
2647
|
-
var isTableText =
|
|
2648
|
-
var isTableNumber =
|
|
2649
|
-
var isTableBoolean =
|
|
2650
|
-
var isTableReference =
|
|
2651
|
-
var isTableList =
|
|
2693
|
+
var isTableText = Schema21.is(Schema21.String);
|
|
2694
|
+
var isTableNumber = Schema21.is(Schema21.Finite);
|
|
2695
|
+
var isTableBoolean = Schema21.is(Schema21.Boolean);
|
|
2696
|
+
var isTableReference = Schema21.is(DataTableReferenceSchema);
|
|
2697
|
+
var isTableList = Schema21.is(Schema21.Array(DataTableItemSchema));
|
|
2652
2698
|
var tableInitials = (label) => label.trim().split(/\s+/).slice(0, 2).map((word) => word.slice(0, 1)).join("").toLocaleUpperCase();
|
|
2653
2699
|
var formatBytes2 = (bytes, locale) => {
|
|
2654
2700
|
const [unit, scale] = bytes >= 1024 ** 2 ? ["megabyte", 1024 ** 2] : bytes >= 1024 ? ["kilobyte", 1024] : ["byte", 1];
|
|
@@ -2663,7 +2709,7 @@ var formatNumberValue = (value, options, defaultLocale = "en") => {
|
|
|
2663
2709
|
return format === "bytes" ? formatBytes2(value, locale ?? defaultLocale) : new Intl.NumberFormat(locale ?? defaultLocale, intlOptions).format(value);
|
|
2664
2710
|
};
|
|
2665
2711
|
var tableBooleanLabel = (value, options) => (value ? options?.trueLabel : options?.falseLabel) ?? String(value);
|
|
2666
|
-
var decodeDateInput =
|
|
2712
|
+
var decodeDateInput = Schema21.decodeUnknownOption(DataTableDateInputSchema);
|
|
2667
2713
|
var resolveDate = (value, type) => Option3.getOrUndefined(Option3.flatMap(decodeDateInput(value), (input) => {
|
|
2668
2714
|
const calendarOnly = isCalendarDate(input);
|
|
2669
2715
|
if (calendarOnly && type === "dateTime")
|
|
@@ -2867,144 +2913,144 @@ var resolveTablePage = (rowCount, query) => {
|
|
|
2867
2913
|
return { page, pageCount, start, end: start + pageSize };
|
|
2868
2914
|
};
|
|
2869
2915
|
var edit = UiSchema8.TaggedEnum({
|
|
2870
|
-
SetBoolean: { value:
|
|
2871
|
-
AddItem: { itemId:
|
|
2872
|
-
RemoveItem: { itemId:
|
|
2916
|
+
SetBoolean: { value: Schema21.Boolean },
|
|
2917
|
+
AddItem: { itemId: Schema21.String },
|
|
2918
|
+
RemoveItem: { itemId: Schema21.String }
|
|
2873
2919
|
}).annotate({ identifier: "DataTableEdit" });
|
|
2874
2920
|
var DataTableEdit = edit;
|
|
2875
2921
|
var eventFields = {
|
|
2876
|
-
RowActivated: { rowId:
|
|
2922
|
+
RowActivated: { rowId: Schema21.String },
|
|
2877
2923
|
ItemActionRequested: {
|
|
2878
|
-
rowId:
|
|
2879
|
-
columnId:
|
|
2880
|
-
itemId:
|
|
2881
|
-
actionId:
|
|
2924
|
+
rowId: Schema21.String,
|
|
2925
|
+
columnId: Schema21.String,
|
|
2926
|
+
itemId: Schema21.String,
|
|
2927
|
+
actionId: Schema21.String
|
|
2882
2928
|
},
|
|
2883
2929
|
RefreshRequested: {},
|
|
2884
|
-
ExportRequested: { actionId:
|
|
2930
|
+
ExportRequested: { actionId: Schema21.String },
|
|
2885
2931
|
GroupActionRequested: {
|
|
2886
|
-
fieldId:
|
|
2887
|
-
groupId:
|
|
2888
|
-
actionId:
|
|
2932
|
+
fieldId: Schema21.String,
|
|
2933
|
+
groupId: Schema21.String,
|
|
2934
|
+
actionId: Schema21.String
|
|
2889
2935
|
},
|
|
2890
2936
|
GroupMoveRequested: {
|
|
2891
|
-
rowId:
|
|
2892
|
-
fieldId:
|
|
2893
|
-
groupId:
|
|
2937
|
+
rowId: Schema21.String,
|
|
2938
|
+
fieldId: Schema21.String,
|
|
2939
|
+
groupId: Schema21.String
|
|
2894
2940
|
},
|
|
2895
|
-
RowsReordered: { rowIds:
|
|
2941
|
+
RowsReordered: { rowIds: Schema21.Array(Schema21.String) },
|
|
2896
2942
|
StateChanged: { state: DataTableQuerySchema },
|
|
2897
|
-
SortChanged: { sort:
|
|
2898
|
-
SelectionChanged: { selectedRowIds:
|
|
2899
|
-
CellEditRequested: { rowId:
|
|
2900
|
-
RowActionRequested: { rowId:
|
|
2943
|
+
SortChanged: { sort: Schema21.Array(DataTableSortSchema) },
|
|
2944
|
+
SelectionChanged: { selectedRowIds: Schema21.Array(Schema21.String) },
|
|
2945
|
+
CellEditRequested: { rowId: Schema21.String, columnId: Schema21.String, edit },
|
|
2946
|
+
RowActionRequested: { rowId: Schema21.String, actionId: Schema21.String },
|
|
2901
2947
|
BulkActionRequested: {
|
|
2902
|
-
rowIds:
|
|
2903
|
-
actionId:
|
|
2948
|
+
rowIds: Schema21.Array(Schema21.String),
|
|
2949
|
+
actionId: Schema21.String
|
|
2904
2950
|
}
|
|
2905
2951
|
};
|
|
2906
2952
|
var DataTableEvents = UiSchema8.TaggedEnum(eventFields).annotate({
|
|
2907
2953
|
identifier: "DataTableEvents"
|
|
2908
2954
|
});
|
|
2909
2955
|
var DataTableMessage = UiSchema8.TaggedEnum({
|
|
2910
|
-
ReferenceImageFailed: { src:
|
|
2956
|
+
ReferenceImageFailed: { src: Schema21.String },
|
|
2911
2957
|
RowActivated: eventFields.RowActivated,
|
|
2912
|
-
PreferencesLoaded: { preferences:
|
|
2958
|
+
PreferencesLoaded: { preferences: Schema21.NullOr(DataTablePreferencesSchema) },
|
|
2913
2959
|
ItemActionRequested: eventFields.ItemActionRequested,
|
|
2914
2960
|
BuiltInExportRequested: {
|
|
2915
|
-
format:
|
|
2916
|
-
locale:
|
|
2961
|
+
format: Schema21.Literals(["csv", "json"]),
|
|
2962
|
+
locale: Schema21.optionalKey(Schema21.String)
|
|
2917
2963
|
},
|
|
2918
2964
|
ExportStarted: {},
|
|
2919
|
-
ExportFinished: { failed:
|
|
2965
|
+
ExportFinished: { failed: Schema21.Boolean },
|
|
2920
2966
|
RefreshRequested: {},
|
|
2921
2967
|
ExportRequested: eventFields.ExportRequested,
|
|
2922
2968
|
GroupActionRequested: eventFields.GroupActionRequested,
|
|
2923
2969
|
GroupMoveRequested: eventFields.GroupMoveRequested,
|
|
2924
2970
|
ReorderRequested: {
|
|
2925
|
-
rowId:
|
|
2926
|
-
targetId:
|
|
2927
|
-
after:
|
|
2971
|
+
rowId: Schema21.String,
|
|
2972
|
+
targetId: Schema21.String,
|
|
2973
|
+
after: Schema21.Boolean
|
|
2928
2974
|
},
|
|
2929
|
-
DragStarted: { rowId:
|
|
2975
|
+
DragStarted: { rowId: Schema21.String },
|
|
2930
2976
|
DragEnded: {},
|
|
2931
|
-
DragDropped: { targetId:
|
|
2932
|
-
GroupDropped: { fieldId:
|
|
2977
|
+
DragDropped: { targetId: Schema21.String },
|
|
2978
|
+
GroupDropped: { fieldId: Schema21.String, groupId: Schema21.String },
|
|
2933
2979
|
ViewPicked: { view: DataTableViewSchema },
|
|
2934
|
-
GroupingToggled: { fieldId:
|
|
2935
|
-
GroupToggled: { key:
|
|
2936
|
-
ColumnResized: { id:
|
|
2937
|
-
ColumnResizeReset: { id:
|
|
2938
|
-
ResizeStarted: { id:
|
|
2939
|
-
ResizeMoved: { x:
|
|
2940
|
-
ResizeEnded: { pointerId:
|
|
2941
|
-
ColumnFiltersCleared: { id:
|
|
2942
|
-
ColumnSortCleared: { id:
|
|
2980
|
+
GroupingToggled: { fieldId: Schema21.String },
|
|
2981
|
+
GroupToggled: { key: Schema21.String },
|
|
2982
|
+
ColumnResized: { id: Schema21.String, delta: Schema21.Finite },
|
|
2983
|
+
ColumnResizeReset: { id: Schema21.String },
|
|
2984
|
+
ResizeStarted: { id: Schema21.String, x: Schema21.Finite, pointerId: Schema21.Int },
|
|
2985
|
+
ResizeMoved: { x: Schema21.Finite, pointerId: Schema21.Int },
|
|
2986
|
+
ResizeEnded: { pointerId: Schema21.Int },
|
|
2987
|
+
ColumnFiltersCleared: { id: Schema21.String },
|
|
2988
|
+
ColumnSortCleared: { id: Schema21.String },
|
|
2943
2989
|
CellEditRequested: eventFields.CellEditRequested,
|
|
2944
2990
|
RowActionRequested: eventFields.RowActionRequested,
|
|
2945
|
-
MenuOpened: { key:
|
|
2946
|
-
MenuClosed: { key:
|
|
2947
|
-
MenuQueryChanged: { key:
|
|
2991
|
+
MenuOpened: { key: Schema21.String },
|
|
2992
|
+
MenuClosed: { key: Schema21.String },
|
|
2993
|
+
MenuQueryChanged: { key: Schema21.String, query: Schema21.String },
|
|
2948
2994
|
SubmenuOpened: {
|
|
2949
|
-
key:
|
|
2950
|
-
filterColumnId:
|
|
2995
|
+
key: Schema21.String,
|
|
2996
|
+
filterColumnId: Schema21.optionalKey(Schema21.String)
|
|
2951
2997
|
},
|
|
2952
|
-
SubmenuClosed: { key:
|
|
2953
|
-
SearchChanged: { value:
|
|
2998
|
+
SubmenuClosed: { key: Schema21.String },
|
|
2999
|
+
SearchChanged: { value: Schema21.String },
|
|
2954
3000
|
FilterInputChanged: {
|
|
2955
|
-
field:
|
|
2956
|
-
value:
|
|
3001
|
+
field: Schema21.Literals(["primary", "secondary"]),
|
|
3002
|
+
value: Schema21.String
|
|
2957
3003
|
},
|
|
2958
3004
|
FilterOperatorChanged: { operator: TextFilterOperator },
|
|
2959
|
-
FilterValueToggled: { value:
|
|
3005
|
+
FilterValueToggled: { value: Schema21.String, checked: Schema21.Boolean },
|
|
2960
3006
|
FilterApplied: {},
|
|
2961
3007
|
ColumnFilterChanged: {
|
|
2962
|
-
id:
|
|
2963
|
-
filter:
|
|
3008
|
+
id: Schema21.String,
|
|
3009
|
+
filter: Schema21.NullOr(ColumnFilter)
|
|
2964
3010
|
},
|
|
2965
3011
|
FilterCleared: {},
|
|
2966
3012
|
FiltersCleared: {},
|
|
2967
|
-
PageRequested: { page:
|
|
3013
|
+
PageRequested: { page: Schema21.Int },
|
|
2968
3014
|
ServerPageInvalidated: {},
|
|
2969
|
-
PageSizeRequested: { pageSize:
|
|
3015
|
+
PageSizeRequested: { pageSize: Schema21.Int },
|
|
2970
3016
|
SortRequested: {
|
|
2971
|
-
columnId:
|
|
2972
|
-
direction:
|
|
3017
|
+
columnId: Schema21.String,
|
|
3018
|
+
direction: Schema21.NullOr(DataTableSortSchema.fields.direction)
|
|
2973
3019
|
},
|
|
2974
|
-
ColumnVisibilityChanged: { id:
|
|
3020
|
+
ColumnVisibilityChanged: { id: Schema21.String, visible: Schema21.Boolean },
|
|
2975
3021
|
SelectionRequested: {
|
|
2976
|
-
rowIds:
|
|
2977
|
-
checked:
|
|
3022
|
+
rowIds: Schema21.Array(Schema21.String),
|
|
3023
|
+
checked: Schema21.Boolean
|
|
2978
3024
|
},
|
|
2979
|
-
BulkActionRequested: { actionId:
|
|
3025
|
+
BulkActionRequested: { actionId: Schema21.String }
|
|
2980
3026
|
}).annotate({ identifier: "DataTableMessage" });
|
|
2981
3027
|
var dataTableOptions = {
|
|
2982
3028
|
name: "DataTable",
|
|
2983
3029
|
props: DataTablePropsSchema,
|
|
2984
|
-
model:
|
|
2985
|
-
menu:
|
|
2986
|
-
submenu:
|
|
2987
|
-
menuQuery:
|
|
2988
|
-
failedImages:
|
|
2989
|
-
selectedRowIds:
|
|
3030
|
+
model: Schema21.Struct({
|
|
3031
|
+
menu: Schema21.NullOr(Schema21.String),
|
|
3032
|
+
submenu: Schema21.NullOr(Schema21.String),
|
|
3033
|
+
menuQuery: Schema21.String,
|
|
3034
|
+
failedImages: Schema21.Array(Schema21.String),
|
|
3035
|
+
selectedRowIds: Schema21.Array(Schema21.String),
|
|
2990
3036
|
query: DataTableQuerySchema,
|
|
2991
|
-
preferencesLoaded:
|
|
2992
|
-
columnVisibility:
|
|
2993
|
-
columnSizing:
|
|
3037
|
+
preferencesLoaded: Schema21.Boolean,
|
|
3038
|
+
columnVisibility: Schema21.Record(Schema21.String, Schema21.Boolean),
|
|
3039
|
+
columnSizing: Schema21.Record(Schema21.String, Schema21.Finite),
|
|
2994
3040
|
view: DataTableViewSchema,
|
|
2995
|
-
grouping:
|
|
2996
|
-
collapsedGroups:
|
|
2997
|
-
dragging:
|
|
2998
|
-
exporting:
|
|
2999
|
-
exportFailed:
|
|
3000
|
-
resizing:
|
|
3001
|
-
id:
|
|
3002
|
-
x:
|
|
3003
|
-
width:
|
|
3004
|
-
pointerId:
|
|
3041
|
+
grouping: Schema21.Array(Schema21.String),
|
|
3042
|
+
collapsedGroups: Schema21.Record(Schema21.String, Schema21.Boolean),
|
|
3043
|
+
dragging: Schema21.NullOr(Schema21.String),
|
|
3044
|
+
exporting: Schema21.Boolean,
|
|
3045
|
+
exportFailed: Schema21.Boolean,
|
|
3046
|
+
resizing: Schema21.NullOr(Schema21.Struct({
|
|
3047
|
+
id: Schema21.String,
|
|
3048
|
+
x: Schema21.Finite,
|
|
3049
|
+
width: Schema21.Finite,
|
|
3050
|
+
pointerId: Schema21.Int
|
|
3005
3051
|
}).annotate({ identifier: "DataTableResizeSession" })),
|
|
3006
|
-
filterDraft:
|
|
3007
|
-
invalidFilter:
|
|
3052
|
+
filterDraft: Schema21.NullOr(DataTableFilterDraftSchema),
|
|
3053
|
+
invalidFilter: Schema21.Boolean
|
|
3008
3054
|
}).annotate({ identifier: "DataTableModel" }),
|
|
3009
3055
|
message: DataTableMessage,
|
|
3010
3056
|
events: DataTableEvents,
|
|
@@ -3036,9 +3082,9 @@ var serverPageCorrection = (props, model) => {
|
|
|
3036
3082
|
return { requested: query.page, page, size: query.pageSize };
|
|
3037
3083
|
};
|
|
3038
3084
|
var tablePreferencesKey = (pathname, columns, gallery) => `data-table:${pathname}:${columns.join(",")}:${gallery ? "gallery" : "table"}:ui`;
|
|
3039
|
-
var preferencesJson =
|
|
3040
|
-
var decodePreferences =
|
|
3041
|
-
var encodePreferences =
|
|
3085
|
+
var preferencesJson = Schema21.fromJsonString(DataTablePreferencesSchema);
|
|
3086
|
+
var decodePreferences = Schema21.decodeUnknownOption(preferencesJson);
|
|
3087
|
+
var encodePreferences = Schema21.encodeSync(preferencesJson);
|
|
3042
3088
|
var readTablePreferences = (key, host = globalThis.window) => {
|
|
3043
3089
|
try {
|
|
3044
3090
|
return Option3.getOrNull(decodePreferences(host?.localStorage.getItem(key)));
|
|
@@ -3162,8 +3208,8 @@ var tableFilterDraft = (id, current) => ({
|
|
|
3162
3208
|
operator: current?.kind === "text" ? current.operator : "contains",
|
|
3163
3209
|
values: current?.kind === "values" ? current.values : []
|
|
3164
3210
|
});
|
|
3165
|
-
var decodeFilter =
|
|
3166
|
-
var decodeBound =
|
|
3211
|
+
var decodeFilter = Schema21.decodeUnknownOption(ColumnFilter);
|
|
3212
|
+
var decodeBound = Schema21.decodeOption(Schema21.FiniteFromString);
|
|
3167
3213
|
var parseTableFilterDraft = (kind, {
|
|
3168
3214
|
id,
|
|
3169
3215
|
primary,
|
|
@@ -3282,9 +3328,9 @@ var tableExportValue = (column, row, locale) => {
|
|
|
3282
3328
|
};
|
|
3283
3329
|
var DownloadTable = Command3.make("DataTable/Download", {
|
|
3284
3330
|
args: {
|
|
3285
|
-
filename:
|
|
3286
|
-
content:
|
|
3287
|
-
type:
|
|
3331
|
+
filename: Schema21.String,
|
|
3332
|
+
content: Schema21.Redacted(Schema21.String, { disallowJsonEncode: true }),
|
|
3333
|
+
type: Schema21.String
|
|
3288
3334
|
}
|
|
3289
3335
|
}, ({ filename, content, type }) => Effect7.try(() => downloadTableBlob(Redacted6.value(content), type, filename)).pipe(Effect7.match({
|
|
3290
3336
|
onSuccess: () => DataTableMessage.ExportFinished({ failed: false }),
|
|
@@ -3604,13 +3650,13 @@ var badgeVariants = {
|
|
|
3604
3650
|
destructive: "bg-destructive/10 text-destructive dark:bg-destructive/20"
|
|
3605
3651
|
};
|
|
3606
3652
|
var badgeClass = "inline-flex items-center gap-1 rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap";
|
|
3607
|
-
var isTextFilterOperator =
|
|
3653
|
+
var isTextFilterOperator = Schema22.is(TextFilterOperator);
|
|
3608
3654
|
var RowDrag = "application/x-krakstack-table-row";
|
|
3609
3655
|
var PersistPreferences = Mount2.makeStream("DataTable/PersistPreferences", {
|
|
3610
3656
|
args: {
|
|
3611
|
-
columns:
|
|
3612
|
-
gallery:
|
|
3613
|
-
preferences:
|
|
3657
|
+
columns: Schema22.Array(Schema22.String),
|
|
3658
|
+
gallery: Schema22.Boolean,
|
|
3659
|
+
preferences: Schema22.NullOr(DataTablePreferencesSchema)
|
|
3614
3660
|
}
|
|
3615
3661
|
}, (element, initial, changes) => Stream4.make(initial).pipe(Stream4.concat(changes), Stream4.map(({ columns, gallery, preferences }) => {
|
|
3616
3662
|
const host = element.ownerDocument.defaultView;
|
|
@@ -3624,20 +3670,20 @@ var PersistPreferences = Mount2.makeStream("DataTable/PersistPreferences", {
|
|
|
3624
3670
|
});
|
|
3625
3671
|
}), Stream4.filter((message) => message !== undefined)));
|
|
3626
3672
|
var FilterSelectMessage = UiSchema9.TaggedEnum({
|
|
3627
|
-
OpenChanged: { open:
|
|
3628
|
-
Picked: { value:
|
|
3673
|
+
OpenChanged: { open: Schema22.Boolean },
|
|
3674
|
+
Picked: { value: Schema22.String }
|
|
3629
3675
|
});
|
|
3630
3676
|
var FilterSelectEvent = UiSchema9.TaggedEnum({
|
|
3631
|
-
Changed: { value:
|
|
3677
|
+
Changed: { value: Schema22.String }
|
|
3632
3678
|
});
|
|
3633
3679
|
var FilterSelect = Html7.component({
|
|
3634
3680
|
name: "DataTableFilterSelect",
|
|
3635
|
-
props:
|
|
3636
|
-
label:
|
|
3637
|
-
value:
|
|
3638
|
-
items:
|
|
3681
|
+
props: Schema22.Struct({
|
|
3682
|
+
label: Schema22.String,
|
|
3683
|
+
value: Schema22.String,
|
|
3684
|
+
items: Schema22.Array(Schema22.Struct({ value: Schema22.String, label: Schema22.String }))
|
|
3639
3685
|
}),
|
|
3640
|
-
model:
|
|
3686
|
+
model: Schema22.Boolean,
|
|
3641
3687
|
message: FilterSelectMessage,
|
|
3642
3688
|
events: FilterSelectEvent,
|
|
3643
3689
|
restore: false
|
|
@@ -3732,6 +3778,7 @@ var DataTable = Html7.component({
|
|
|
3732
3778
|
csv: FileText2,
|
|
3733
3779
|
json: FileJson2
|
|
3734
3780
|
};
|
|
3781
|
+
const listAvatar = (label, imageSrc) => h.span.attr("aria-hidden", "true").class(tableListEntryClasses.avatar).children(imageSrc && !model.failedImages.includes(imageSrc) ? h.img.class(tableListEntryClasses.image).attrs({ src: imageSrc, alt: "", loading: "lazy" }).on("error", DataTableMessage.ReferenceImageFailed({ src: imageSrc })) : tableInitials(label));
|
|
3735
3782
|
const indicator = (icon) => icon ? icons[icon](h, { size: 16, className: "shrink-0" }) : undefined;
|
|
3736
3783
|
const menu = (key, label, accessibleLabel, items, inBar = false, searchLabel, pending = false, presentation) => Menu(h, {
|
|
3737
3784
|
key,
|
|
@@ -3800,7 +3847,9 @@ var DataTable = Html7.component({
|
|
|
3800
3847
|
childSearch,
|
|
3801
3848
|
icon,
|
|
3802
3849
|
rowIcon,
|
|
3803
|
-
separatorBefore
|
|
3850
|
+
separatorBefore,
|
|
3851
|
+
detail,
|
|
3852
|
+
keepOpen
|
|
3804
3853
|
}) => {
|
|
3805
3854
|
if (children || filterEditor) {
|
|
3806
3855
|
const subitems = children ?? [];
|
|
@@ -3836,8 +3885,9 @@ var DataTable = Html7.component({
|
|
|
3836
3885
|
}
|
|
3837
3886
|
},
|
|
3838
3887
|
view: (submenu) => h.div.children(separatorBefore && MenuSeparator(h, menu), MenuSubTrigger(h, menu, submenu, {
|
|
3839
|
-
value: id
|
|
3840
|
-
|
|
3888
|
+
value: id,
|
|
3889
|
+
class: relationship ? tableListEntryClasses.menuItem : undefined
|
|
3890
|
+
}).children(indicator(icon), detail ?? name), MenuPositioner(h, submenu).children(MenuPopup(h, submenu).children(childSearch && MenuInput(h, submenu, {
|
|
3841
3891
|
placeholder: copy.addItem
|
|
3842
3892
|
}), childSearch && MenuEmpty(h, submenu)?.children(copy.empty), filterEditor && model.submenu === subkey && filterEditor(), submenu.list(h.div).children(subitems.map(({
|
|
3843
3893
|
id,
|
|
@@ -3845,6 +3895,7 @@ var DataTable = Html7.component({
|
|
|
3845
3895
|
variant,
|
|
3846
3896
|
keepOpen,
|
|
3847
3897
|
icon,
|
|
3898
|
+
rowIcon,
|
|
3848
3899
|
checked,
|
|
3849
3900
|
radio,
|
|
3850
3901
|
separatorBefore
|
|
@@ -3855,14 +3906,18 @@ var DataTable = Html7.component({
|
|
|
3855
3906
|
};
|
|
3856
3907
|
const part = radio ? MenuRadioItem(h, submenu, options) : checked !== undefined ? MenuCheckboxItem(h, submenu, options) : MenuItem(h, submenu, {
|
|
3857
3908
|
...options,
|
|
3858
|
-
variant
|
|
3909
|
+
variant,
|
|
3910
|
+
class: relationship ? tableListEntryClasses.menuItem : undefined
|
|
3859
3911
|
});
|
|
3860
|
-
const content = part.children(
|
|
3912
|
+
const content = part.children(rowIcon?.(h, {
|
|
3913
|
+
size: 16,
|
|
3914
|
+
className: "shrink-0"
|
|
3915
|
+
}), indicator(icon), name);
|
|
3861
3916
|
return separatorBefore ? h.div.children(MenuSeparator(h, submenu), content) : content;
|
|
3862
3917
|
})))))
|
|
3863
3918
|
});
|
|
3864
3919
|
}
|
|
3865
|
-
const element = h.div.class(cn("data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground relative flex min-h-[30px] cursor-default items-center gap-2 rounded-sm px-2 whitespace-nowrap outline-none select-none data-[disabled]:opacity-45", variant === "destructive" && "text-destructive data-[highlighted]:bg-destructive/10 data-[highlighted]:text-destructive"));
|
|
3920
|
+
const element = h.div.class(cn("data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground relative flex min-h-[30px] cursor-default items-center gap-2 rounded-sm px-2 whitespace-nowrap outline-none select-none data-[disabled]:opacity-45", variant === "destructive" && "text-destructive data-[highlighted]:bg-destructive/10 data-[highlighted]:text-destructive", relationship && tableListEntryClasses.menuItem));
|
|
3866
3921
|
const part = radio ? menu.radioItem({ element, value: id }) : checked !== undefined ? menu.checkboxItem({
|
|
3867
3922
|
element,
|
|
3868
3923
|
value: id,
|
|
@@ -3870,9 +3925,9 @@ var DataTable = Html7.component({
|
|
|
3870
3925
|
}) : menu.item({
|
|
3871
3926
|
element,
|
|
3872
3927
|
value: id,
|
|
3873
|
-
closeOnClick: !searchLabel
|
|
3928
|
+
closeOnClick: !searchLabel && !keepOpen
|
|
3874
3929
|
});
|
|
3875
|
-
const content = part.children(rowIcon?.(h, { size: 16, className: "shrink-0" }), checked !== undefined && h.span.attr("aria-hidden", "true").class("w-3").children(checked ? "✓" : ""), indicator(icon), name);
|
|
3930
|
+
const content = part.children(rowIcon?.(h, { size: 16, className: "shrink-0" }), checked !== undefined && h.span.attr("aria-hidden", "true").class("w-3").children(checked ? "✓" : ""), indicator(icon), detail ?? name);
|
|
3876
3931
|
return separatorBefore ? h.div.children(MenuSeparator(h, menu), content) : content;
|
|
3877
3932
|
})))));
|
|
3878
3933
|
}
|
|
@@ -3995,7 +4050,7 @@ var DataTable = Html7.component({
|
|
|
3995
4050
|
const image = value.imageSrc && !model.failedImages.includes(value.imageSrc) ? value.imageSrc : undefined;
|
|
3996
4051
|
const fallbackIcons = column.typeOptions?.fallbackIcons;
|
|
3997
4052
|
const fallbackIcon = fallbackIcons && Object.hasOwn(fallbackIcons, row.id) ? fallbackIcons[row.id] : undefined;
|
|
3998
|
-
return h.div.class(tableClasses.reference).children(h.span.class(cn(tableClasses.referenceAvatar, column.typeOptions?.imageVariant === "square" ? "rounded-md" : "rounded-full")).children((!image || !fallbackIcon) && h.span.attr("aria-hidden", "true").children(fallbackIcon?.(h, { size: 16 }) ?? tableInitials(value.label)), image && h.img.attrs({
|
|
4053
|
+
return h.div.class(tableClasses.reference).children(h.span.class(cn(tableClasses.referenceAvatar, column.typeOptions?.imageVariant === "square" ? "rounded-md" : "rounded-full", column.typeOptions?.appearance === "resource" && (image ? "bg-background border" : "bg-primary text-primary-foreground"))).children((!image || !fallbackIcon) && h.span.attr("aria-hidden", "true").children(fallbackIcon?.(h, { size: 16 }) ?? tableInitials(value.label)), image && h.img.attrs({
|
|
3999
4054
|
src: image,
|
|
4000
4055
|
alt: "",
|
|
4001
4056
|
loading: "lazy"
|
|
@@ -4046,13 +4101,15 @@ var DataTable = Html7.component({
|
|
|
4046
4101
|
}
|
|
4047
4102
|
if (column.display && !column.options && !column.allowRemove) {
|
|
4048
4103
|
const label = column.actionsLabel ?? (column.itemActions?.length ? copy.actions : copy.listDetails);
|
|
4049
|
-
const summary = column.display === "icon" ? h.span.class("flex min-w-0 items-center
|
|
4050
|
-
return !current.length ? empty : h.div.class("min-w-0").children(menu(keyOf("items", row.id, column.id), label, `${label}: ${row.label}`, current.map(({ value, label }) => ({
|
|
4104
|
+
const summary = column.display === "icon" ? h.span.class("flex min-w-0 items-center overflow-hidden").children(visible.map(({ value, label, imageSrc }) => h.span.key(value).attr("title", label).class("-ml-1 first:ml-0 inline-flex").children(listAvatar(label, imageSrc))), overflow > 0 && h.span.class("bg-secondary text-secondary-foreground -ml-1 flex size-8 shrink-0 items-center justify-center rounded-full").children(`+${overflow}`)) : column.display === "badge" ? badgeSummary() : h.span.class("min-w-0 truncate").children(`${visible.map(({ label }) => label).join(", ")}${overflow > 0 ? ` +${overflow}` : ""}`);
|
|
4105
|
+
return !current.length ? empty : h.div.class("min-w-0").children(menu(keyOf("items", row.id, column.id), label, `${label}: ${row.label}`, current.map(({ value, label, imageSrc }) => ({
|
|
4051
4106
|
id: value,
|
|
4052
4107
|
name: label,
|
|
4108
|
+
detail: column.display === "icon" ? h.span.class(tableListEntryClasses.detail).children(listAvatar(label, imageSrc), h.span.class("truncate").children(label)) : undefined,
|
|
4053
4109
|
...column.itemActions?.length ? {
|
|
4054
4110
|
children: column.itemActions.map((action) => ({
|
|
4055
4111
|
...action,
|
|
4112
|
+
rowIcon: column.itemActionIcons?.[action.id],
|
|
4056
4113
|
message: DataTableMessage.ItemActionRequested({
|
|
4057
4114
|
rowId: row.id,
|
|
4058
4115
|
columnId: column.id,
|
|
@@ -4060,13 +4117,14 @@ var DataTable = Html7.component({
|
|
|
4060
4117
|
actionId: action.id
|
|
4061
4118
|
})
|
|
4062
4119
|
}))
|
|
4063
|
-
} : {
|
|
4120
|
+
} : { keepOpen: true }
|
|
4064
4121
|
})), false, undefined, false, { relationship: summary }));
|
|
4065
4122
|
}
|
|
4066
4123
|
const used = new Set(current.map(({ value }) => value));
|
|
4067
4124
|
const add = (column.options ?? []).filter(({ value }) => !used.has(value));
|
|
4068
4125
|
return h.div.class("grid gap-1").children(current.length > 0 ? h.ul.class("flex flex-wrap gap-1").children(current.map(({ value, label }) => h.li.key(value).class(column.display === "badge" ? cn(badgeClass, badgeVariants.secondary) : "bg-muted rounded-sm ps-2 inline-flex items-center gap-1").children(label, !!column.itemActions?.length && menu(keyOf("item", row.id, column.id, value), copy.actions, `${copy.actions}: ${label} — ${row.label}`, column.itemActions.map((action) => ({
|
|
4069
4126
|
...action,
|
|
4127
|
+
rowIcon: column.itemActionIcons?.[action.id],
|
|
4070
4128
|
message: DataTableMessage.ItemActionRequested({
|
|
4071
4129
|
rowId: row.id,
|
|
4072
4130
|
columnId: column.id,
|
|
@@ -4174,7 +4232,7 @@ var DataTable = Html7.component({
|
|
|
4174
4232
|
];
|
|
4175
4233
|
});
|
|
4176
4234
|
};
|
|
4177
|
-
return h.section.class(cn("min-w-0 gap-2", fillHeight ? "flex min-h-0 flex-1 flex-col" : "grid", props.className)).onMount(PersistPreferences({
|
|
4235
|
+
return h.section.class(cn("min-w-0 gap-2", tableSurfaceContext, fillHeight ? "flex min-h-0 flex-1 flex-col" : "grid", props.className)).onMount(PersistPreferences({
|
|
4178
4236
|
columns: props.columnDefs.map(({ id }) => id),
|
|
4179
4237
|
gallery: !!features.gallery,
|
|
4180
4238
|
preferences: tablePreferences(model)
|
|
@@ -4447,18 +4505,18 @@ import { krakstackLocaleRead as krakstackLocaleRead8 } from "@krak-stack/registr
|
|
|
4447
4505
|
import { Download as Download2, Link2, RefreshCw as RefreshCw2, Trash2 } from "@krak-stack/registry/lucide-effect";
|
|
4448
4506
|
|
|
4449
4507
|
// ../assets/src/components/asset-table/schema.ts
|
|
4450
|
-
import { Schema as
|
|
4451
|
-
var AssetTableItemSchema =
|
|
4452
|
-
id:
|
|
4453
|
-
name:
|
|
4454
|
-
mimeType:
|
|
4455
|
-
byteSize:
|
|
4456
|
-
createdAt:
|
|
4457
|
-
updatedAt:
|
|
4458
|
-
url:
|
|
4508
|
+
import { Schema as Schema23 } from "effect";
|
|
4509
|
+
var AssetTableItemSchema = Schema23.Struct({
|
|
4510
|
+
id: Schema23.NonEmptyString,
|
|
4511
|
+
name: Schema23.String,
|
|
4512
|
+
mimeType: Schema23.String,
|
|
4513
|
+
byteSize: Schema23.Finite,
|
|
4514
|
+
createdAt: Schema23.Date,
|
|
4515
|
+
updatedAt: Schema23.Date,
|
|
4516
|
+
url: Schema23.optionalKey(Schema23.String)
|
|
4459
4517
|
}).annotate({ identifier: "AssetTableItem" });
|
|
4460
|
-
var text2 =
|
|
4461
|
-
var AssetTableMessagesSchema =
|
|
4518
|
+
var text2 = Schema23.optionalKey(Schema23.String);
|
|
4519
|
+
var AssetTableMessagesSchema = Schema23.Record(Schema23.String, Schema23.Struct({
|
|
4462
4520
|
id: text2,
|
|
4463
4521
|
name: text2,
|
|
4464
4522
|
type: text2,
|
|
@@ -4478,14 +4536,14 @@ var AssetTableMessagesSchema = Schema24.Record(Schema24.String, Schema24.Struct(
|
|
|
4478
4536
|
copyLinkUnavailable: text2,
|
|
4479
4537
|
close: text2
|
|
4480
4538
|
})).annotate({ identifier: "AssetTableMessages" });
|
|
4481
|
-
var AssetTablePropsSchema =
|
|
4482
|
-
assets:
|
|
4483
|
-
access:
|
|
4539
|
+
var AssetTablePropsSchema = Schema23.Struct({
|
|
4540
|
+
assets: Schema23.optionalKey(Schema23.Array(AssetTableItemSchema)),
|
|
4541
|
+
access: Schema23.optionalKey(AssetLibraryAccessSchema),
|
|
4484
4542
|
locale: text2,
|
|
4485
4543
|
timeZone: text2,
|
|
4486
|
-
messages:
|
|
4544
|
+
messages: Schema23.optionalKey(AssetTableMessagesSchema)
|
|
4487
4545
|
}).annotate({ identifier: "AssetTableProps" });
|
|
4488
|
-
var AssetActionSchema =
|
|
4546
|
+
var AssetActionSchema = Schema23.Literals([
|
|
4489
4547
|
"download",
|
|
4490
4548
|
"copyLink",
|
|
4491
4549
|
"replace",
|
|
@@ -4493,18 +4551,18 @@ var AssetActionSchema = Schema24.Literals([
|
|
|
4493
4551
|
]).annotate({ identifier: "AssetAction" });
|
|
4494
4552
|
|
|
4495
4553
|
// ../assets/src/components/asset-table/index.ts
|
|
4496
|
-
import { Effect as Effect8, Redacted as Redacted7, Schema as
|
|
4554
|
+
import { Effect as Effect8, Redacted as Redacted7, Schema as Schema24 } from "effect";
|
|
4497
4555
|
import { Command as Command4, Component as Component12, UiSchema as UiSchema10 } from "effect/ui";
|
|
4498
4556
|
var Manage = UiSchema10.TaggedEnum({
|
|
4499
|
-
Replace: { id:
|
|
4500
|
-
Delete: { ids:
|
|
4501
|
-
Deleted: { failed:
|
|
4502
|
-
ActionRequested: { action: AssetActionSchema, assetId:
|
|
4503
|
-
DeleteSelected: { assetIds:
|
|
4557
|
+
Replace: { id: Schema24.NullOr(Schema24.String) },
|
|
4558
|
+
Delete: { ids: Schema24.Array(Schema24.String) },
|
|
4559
|
+
Deleted: { failed: Schema24.Boolean },
|
|
4560
|
+
ActionRequested: { action: AssetActionSchema, assetId: Schema24.String },
|
|
4561
|
+
DeleteSelected: { assetIds: Schema24.Array(Schema24.String) }
|
|
4504
4562
|
});
|
|
4505
4563
|
|
|
4506
4564
|
class RemoveAssetRows extends Command4.Service()("asset-table/DeleteAssets", {
|
|
4507
|
-
args: { ids:
|
|
4565
|
+
args: { ids: Schema24.Array(Schema24.String) },
|
|
4508
4566
|
success: Manage
|
|
4509
4567
|
}) {
|
|
4510
4568
|
static layer = this.toLayer(Effect8.map(AssetLibraryActions, (transport) => ({ ids }) => transport.remove(ids).pipe(Effect8.match({
|
|
@@ -4514,18 +4572,28 @@ class RemoveAssetRows extends Command4.Service()("asset-table/DeleteAssets", {
|
|
|
4514
4572
|
}
|
|
4515
4573
|
var assetTableManagementOptions = {
|
|
4516
4574
|
name: "AssetTableManagement",
|
|
4517
|
-
model:
|
|
4518
|
-
replaceId:
|
|
4519
|
-
deleting:
|
|
4520
|
-
failed:
|
|
4575
|
+
model: Schema24.Struct({
|
|
4576
|
+
replaceId: Schema24.NullOr(Schema24.String),
|
|
4577
|
+
deleting: Schema24.Boolean,
|
|
4578
|
+
failed: Schema24.Boolean
|
|
4521
4579
|
}),
|
|
4522
4580
|
message: Manage,
|
|
4523
4581
|
events: UiSchema10.TaggedEnum({
|
|
4524
|
-
ActionRequested: { action: AssetActionSchema, assetId:
|
|
4525
|
-
DeleteSelected: { assetIds:
|
|
4582
|
+
ActionRequested: { action: AssetActionSchema, assetId: Schema24.String },
|
|
4583
|
+
DeleteSelected: { assetIds: Schema24.Array(Schema24.String) }
|
|
4526
4584
|
}),
|
|
4527
4585
|
restore: false
|
|
4528
4586
|
};
|
|
4587
|
+
var assetTableLibraryOptions = {
|
|
4588
|
+
name: "AssetTableLibraryRead",
|
|
4589
|
+
props: AssetTablePropsSchema,
|
|
4590
|
+
model: Schema24.Null,
|
|
4591
|
+
message: Schema24.Never,
|
|
4592
|
+
restore: false,
|
|
4593
|
+
queries: {
|
|
4594
|
+
library: assetLibraryQuery((props) => props.assets === undefined ? props.access : undefined)
|
|
4595
|
+
}
|
|
4596
|
+
};
|
|
4529
4597
|
var management = Component12.define(assetTableManagementOptions);
|
|
4530
4598
|
var managementUpdate = management.update({
|
|
4531
4599
|
Replace: ($, { id }) => $.evolve({ replaceId: id }),
|
|
@@ -4602,16 +4670,16 @@ var AssetTableEvents = assetTableManagementOptions.events.annotate({
|
|
|
4602
4670
|
identifier: "AssetTableEvents"
|
|
4603
4671
|
});
|
|
4604
4672
|
var AssetTableMessage = UiSchema10.TaggedEnum({
|
|
4605
|
-
ActionRequested: { action: AssetActionSchema, assetId:
|
|
4606
|
-
DeleteSelected: { assetIds:
|
|
4607
|
-
BuiltinRequested: { action: AssetActionSchema, assetId:
|
|
4608
|
-
CopyFinished: { assetId:
|
|
4673
|
+
ActionRequested: { action: AssetActionSchema, assetId: Schema24.String },
|
|
4674
|
+
DeleteSelected: { assetIds: Schema24.Array(Schema24.String) },
|
|
4675
|
+
BuiltinRequested: { action: AssetActionSchema, assetId: Schema24.String },
|
|
4676
|
+
CopyFinished: { assetId: Schema24.String, success: Schema24.Boolean },
|
|
4609
4677
|
Dismiss: {}
|
|
4610
4678
|
}).annotate({ identifier: "AssetTableMessage" });
|
|
4611
4679
|
var downloadAsset = Command4.make("asset-table/Download", {
|
|
4612
4680
|
args: {
|
|
4613
|
-
url:
|
|
4614
|
-
name:
|
|
4681
|
+
url: Schema24.Redacted(Schema24.String, { disallowJsonEncode: true }),
|
|
4682
|
+
name: Schema24.String
|
|
4615
4683
|
}
|
|
4616
4684
|
}, ({ url, name }) => Effect8.sync(() => {
|
|
4617
4685
|
const link = document.createElement("a");
|
|
@@ -4632,10 +4700,10 @@ var downloadAsset = Command4.make("asset-table/Download", {
|
|
|
4632
4700
|
var assetTableOptions = {
|
|
4633
4701
|
name: "AssetTable",
|
|
4634
4702
|
props: AssetTablePropsSchema,
|
|
4635
|
-
model:
|
|
4636
|
-
copyLinkAssetId:
|
|
4637
|
-
copying:
|
|
4638
|
-
copied:
|
|
4703
|
+
model: Schema24.Struct({
|
|
4704
|
+
copyLinkAssetId: Schema24.NullOr(Schema24.String),
|
|
4705
|
+
copying: Schema24.NullOr(Schema24.String),
|
|
4706
|
+
copied: Schema24.Boolean
|
|
4639
4707
|
}).annotate({ identifier: "AssetTableModel" }),
|
|
4640
4708
|
message: AssetTableMessage,
|
|
4641
4709
|
events: AssetTableEvents,
|
|
@@ -4693,12 +4761,12 @@ var actionIcons = {
|
|
|
4693
4761
|
};
|
|
4694
4762
|
var props3 = AssetTablePropsSchema.mapFields((fields) => ({
|
|
4695
4763
|
...fields,
|
|
4696
|
-
actions:
|
|
4697
|
-
bulkDelete:
|
|
4698
|
-
status:
|
|
4699
|
-
loading:
|
|
4700
|
-
error:
|
|
4701
|
-
empty:
|
|
4764
|
+
actions: Schema25.optionalKey(Schema25.Array(AssetActionSchema)),
|
|
4765
|
+
bulkDelete: Schema25.optionalKey(Schema25.Boolean),
|
|
4766
|
+
status: Schema25.optionalKey(Schema25.Struct({
|
|
4767
|
+
loading: Schema25.optionalKey(Schema25.Boolean),
|
|
4768
|
+
error: Schema25.optionalKey(Schema25.String),
|
|
4769
|
+
empty: Schema25.optionalKey(Schema25.String)
|
|
4702
4770
|
}))
|
|
4703
4771
|
})).annotate({ identifier: "AssetTableHtmlProps" });
|
|
4704
4772
|
var ConnectedAssetTable = Html8.component({
|
|
@@ -4706,15 +4774,7 @@ var ConnectedAssetTable = Html8.component({
|
|
|
4706
4774
|
name: "AssetTableLibrary",
|
|
4707
4775
|
props: props3,
|
|
4708
4776
|
reads: { localeConfig: krakstackLocaleRead8 },
|
|
4709
|
-
queries:
|
|
4710
|
-
library: {
|
|
4711
|
-
query: AssetList,
|
|
4712
|
-
dropPrevious: true,
|
|
4713
|
-
args: ({
|
|
4714
|
-
props
|
|
4715
|
-
}) => props.assets === undefined && props.access ? assetListArgs(props.access.scopeKey, props.access.permissions) : undefined
|
|
4716
|
-
}
|
|
4717
|
-
}
|
|
4777
|
+
queries: assetTableLibraryOptions.queries
|
|
4718
4778
|
}).make({
|
|
4719
4779
|
...assetTableManagementBehaviours,
|
|
4720
4780
|
view: (h, model) => {
|
|
@@ -4771,7 +4831,7 @@ var ConnectedAssetTable = Html8.component({
|
|
|
4771
4831
|
var AssetTable = Html8.component({
|
|
4772
4832
|
name: "AssetTableConnection",
|
|
4773
4833
|
props: props3,
|
|
4774
|
-
model:
|
|
4834
|
+
model: Schema25.Null,
|
|
4775
4835
|
message: AssetTableEvents,
|
|
4776
4836
|
events: AssetTableEvents,
|
|
4777
4837
|
restore: false
|
|
@@ -4902,7 +4962,7 @@ var AssetTableView = Html8.component({
|
|
|
4902
4962
|
} : undefined
|
|
4903
4963
|
},
|
|
4904
4964
|
onEmit: (event) => {
|
|
4905
|
-
if (event._tag === "RowActionRequested" &&
|
|
4965
|
+
if (event._tag === "RowActionRequested" && Schema25.is(AssetActionSchema)(event.actionId))
|
|
4906
4966
|
return (actions.includes(event.actionId) ? AssetTableMessage.ActionRequested : AssetTableMessage.BuiltinRequested)({
|
|
4907
4967
|
action: event.actionId,
|
|
4908
4968
|
assetId: event.rowId
|