@krak-stack/registry 0.10.3 → 0.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/components/ui/data-table.d.ts +18 -6
- package/dist/components/ui/data-table.js +97 -43
- package/dist/components/ui/form.d.ts +5 -5
- package/dist/services/events/client/audit-log-table.js +97 -43
- package/dist/services/webhooks/client/delivery-table.js +97 -43
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @krak-stack/registry
|
|
2
2
|
|
|
3
|
+
## 0.10.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Place gallery tags below the card name, before the description. Keep selection and drag controls above the name.
|
|
8
|
+
|
|
9
|
+
## 0.10.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Improve DataTable galleries with multiple tag columns, optional lazy-loaded cover images, and an initial view setting that respects saved preferences. Custom tag renderers no longer receive an extra badge wrapper. Existing single-tag configurations remain supported.
|
|
14
|
+
- 852280e: Update effect-form to 1.1.1 so date-only changes enable Save and unsaved-change detection.
|
|
15
|
+
|
|
3
16
|
## 0.10.3
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -281,6 +281,21 @@ export interface DataTableExportFeature {
|
|
|
281
281
|
actions?: readonly DataTableExportAction[];
|
|
282
282
|
onError?: (error: unknown, action: DataTableExportAction) => void;
|
|
283
283
|
}
|
|
284
|
+
export interface DataTableGalleryFeature<TData> {
|
|
285
|
+
name: string;
|
|
286
|
+
description?: string;
|
|
287
|
+
/** Column IDs in display order. Custom cell renderers own their presentation. */
|
|
288
|
+
tags?: readonly string[];
|
|
289
|
+
/** Legacy single-tag configuration. Used when tags is not supplied. */
|
|
290
|
+
tag?: string;
|
|
291
|
+
tagIcon?: ReactNode;
|
|
292
|
+
/** Optional cover image. Missing or failed images leave a text-only card. */
|
|
293
|
+
image?: {
|
|
294
|
+
getSrc: (row: TData) => string | null | undefined;
|
|
295
|
+
/** Omit for a decorative image; the card title already identifies the row. */
|
|
296
|
+
getAlt?: (row: TData) => string;
|
|
297
|
+
};
|
|
298
|
+
}
|
|
284
299
|
export interface DataTableFeatures<TData> {
|
|
285
300
|
toolbar?: false | {
|
|
286
301
|
/** Additional `MenubarMenu` controls rendered at the start of the toolbar. */
|
|
@@ -305,12 +320,7 @@ export interface DataTableFeatures<TData> {
|
|
|
305
320
|
items: readonly DataTableRowAction<TData>[];
|
|
306
321
|
};
|
|
307
322
|
export?: false | DataTableExportFeature;
|
|
308
|
-
gallery?: false |
|
|
309
|
-
name: string;
|
|
310
|
-
description?: string;
|
|
311
|
-
tag?: string;
|
|
312
|
-
tagIcon?: ReactNode;
|
|
313
|
-
};
|
|
323
|
+
gallery?: false | DataTableGalleryFeature<TData>;
|
|
314
324
|
grouping?: false | DataTableGroupingFeature<TData>;
|
|
315
325
|
reordering?: false | {
|
|
316
326
|
onReorder: (rows: TData[]) => void;
|
|
@@ -490,6 +500,8 @@ export interface DataTableProps<TData extends RowData> {
|
|
|
490
500
|
initialState?: Partial<DataTablePublicState> & {
|
|
491
501
|
/** Initial visibility defaults; saved user preferences take precedence. */
|
|
492
502
|
columnVisibility?: Readonly<Record<string, boolean>>;
|
|
503
|
+
/** Initial view only; a saved user preference takes precedence. */
|
|
504
|
+
view?: DataTableView;
|
|
493
505
|
};
|
|
494
506
|
locale?: string;
|
|
495
507
|
onStateChange?: (state: DataTablePublicState) => void;
|
|
@@ -3528,6 +3528,44 @@ var DataTableBody = ({
|
|
|
3528
3528
|
}, row.id))
|
|
3529
3529
|
});
|
|
3530
3530
|
};
|
|
3531
|
+
var GalleryImage = ({ src, alt }) => {
|
|
3532
|
+
const [failed, setFailed] = useState(false);
|
|
3533
|
+
if (failed)
|
|
3534
|
+
return null;
|
|
3535
|
+
return /* @__PURE__ */ jsx15("img", {
|
|
3536
|
+
src,
|
|
3537
|
+
alt,
|
|
3538
|
+
loading: "lazy",
|
|
3539
|
+
decoding: "async",
|
|
3540
|
+
className: "aspect-video w-full object-cover",
|
|
3541
|
+
onError: () => setFailed(true)
|
|
3542
|
+
});
|
|
3543
|
+
};
|
|
3544
|
+
var GalleryTag = ({
|
|
3545
|
+
row,
|
|
3546
|
+
column,
|
|
3547
|
+
icon,
|
|
3548
|
+
locale,
|
|
3549
|
+
labels
|
|
3550
|
+
}) => {
|
|
3551
|
+
const value = row.values.get(column.id);
|
|
3552
|
+
if ((value == null || value === "") && !column.colDef.cellRenderer)
|
|
3553
|
+
return null;
|
|
3554
|
+
const content = renderCell(row, column, locale, labels);
|
|
3555
|
+
return column.colDef.cellRenderer || column.colDef.valueFormatter ? /* @__PURE__ */ jsxs9("div", {
|
|
3556
|
+
className: "flex min-w-0 items-center gap-1",
|
|
3557
|
+
children: [
|
|
3558
|
+
icon,
|
|
3559
|
+
content
|
|
3560
|
+
]
|
|
3561
|
+
}) : /* @__PURE__ */ jsxs9(Badge, {
|
|
3562
|
+
variant: "secondary",
|
|
3563
|
+
children: [
|
|
3564
|
+
icon,
|
|
3565
|
+
content
|
|
3566
|
+
]
|
|
3567
|
+
});
|
|
3568
|
+
};
|
|
3531
3569
|
var GalleryCard = ({
|
|
3532
3570
|
tableAtom
|
|
3533
3571
|
}) => {
|
|
@@ -3538,14 +3576,17 @@ var GalleryCard = ({
|
|
|
3538
3576
|
const gallery = store.config.features.gallery;
|
|
3539
3577
|
if (!row || !gallery)
|
|
3540
3578
|
return null;
|
|
3541
|
-
const find = (id) => id ? model.
|
|
3579
|
+
const find = (id) => id ? model.columns.find((column) => column.id === id) : undefined;
|
|
3542
3580
|
const name = find(gallery.name);
|
|
3543
3581
|
const description = find(gallery.description);
|
|
3544
|
-
const
|
|
3582
|
+
const tagIds = [
|
|
3583
|
+
...new Set(gallery.tags ?? (gallery.tag ? [gallery.tag] : []))
|
|
3584
|
+
];
|
|
3585
|
+
const imageSrc = gallery.image?.getSrc(row.data);
|
|
3545
3586
|
const selection = store.config.features.selection;
|
|
3546
3587
|
const selectable = !!selection && (selection.isRowSelectable?.(row.data) ?? true);
|
|
3547
3588
|
const draggable = canDragRows(store);
|
|
3548
|
-
return /* @__PURE__ */
|
|
3589
|
+
return /* @__PURE__ */ jsxs9(Card, {
|
|
3549
3590
|
className: cn("data-[drop-position=before]:border-t-primary data-[drop-position=after]:border-b-primary relative gap-3 data-[drag-source=true]:opacity-40 data-[drop-position=after]:border-b-2 data-[drop-position=before]:border-t-2", store.config.onRowClicked && "cursor-pointer"),
|
|
3550
3591
|
"data-table-row": row.id,
|
|
3551
3592
|
onClick: () => store.config.onRowClicked?.(row.data),
|
|
@@ -3556,47 +3597,59 @@ var GalleryCard = ({
|
|
|
3556
3597
|
}
|
|
3557
3598
|
},
|
|
3558
3599
|
tabIndex: store.config.onRowClicked ? 0 : undefined,
|
|
3559
|
-
children:
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3600
|
+
children: [
|
|
3601
|
+
imageSrc ? /* @__PURE__ */ jsx15(GalleryImage, {
|
|
3602
|
+
src: imageSrc,
|
|
3603
|
+
alt: gallery.image?.getAlt?.(row.data) ?? ""
|
|
3604
|
+
}, imageSrc) : null,
|
|
3605
|
+
/* @__PURE__ */ jsxs9(CardHeader, {
|
|
3606
|
+
className: cn("relative", hasRowActionMenu(store) && "pr-12"),
|
|
3607
|
+
children: [
|
|
3608
|
+
selection || draggable ? /* @__PURE__ */ jsxs9("div", {
|
|
3609
|
+
className: "flex items-center gap-2",
|
|
3610
|
+
children: [
|
|
3611
|
+
selection ? /* @__PURE__ */ jsx15(Checkbox, {
|
|
3612
|
+
"aria-label": store.config.labels.selectRow,
|
|
3613
|
+
checked: !!store.state.rowSelection[row.id],
|
|
3614
|
+
disabled: !selectable,
|
|
3615
|
+
onCheckedChange: (checked) => toggleRow(store, setStore, row.id, checked),
|
|
3616
|
+
onClick: (event) => event.stopPropagation()
|
|
3617
|
+
}) : null,
|
|
3618
|
+
draggable ? /* @__PURE__ */ jsx15(DragHandle, {
|
|
3619
|
+
tableAtom
|
|
3620
|
+
}) : null
|
|
3621
|
+
]
|
|
3622
|
+
}) : null,
|
|
3623
|
+
/* @__PURE__ */ jsx15(CardTitle, {
|
|
3624
|
+
children: name ? renderCell(row, name, store.config.locale, store.config.labels) : row.id
|
|
3625
|
+
}),
|
|
3626
|
+
tagIds.length ? /* @__PURE__ */ jsx15("div", {
|
|
3627
|
+
className: "flex flex-wrap items-center gap-2",
|
|
3628
|
+
children: tagIds.map((id) => {
|
|
3629
|
+
const column = find(id);
|
|
3630
|
+
return column ? /* @__PURE__ */ jsx15(GalleryTag, {
|
|
3631
|
+
row,
|
|
3632
|
+
column,
|
|
3633
|
+
locale: store.config.locale,
|
|
3634
|
+
labels: store.config.labels,
|
|
3635
|
+
icon: id === gallery.tag ? gallery.tagIcon : undefined
|
|
3636
|
+
}, id) : null;
|
|
3637
|
+
})
|
|
3638
|
+
}) : null,
|
|
3639
|
+
description ? /* @__PURE__ */ jsx15("div", {
|
|
3640
|
+
className: "text-muted-foreground line-clamp-3 text-sm",
|
|
3641
|
+
children: renderCell(row, description, store.config.locale, store.config.labels)
|
|
3642
|
+
}) : null,
|
|
3643
|
+
hasRowActionMenu(store) ? /* @__PURE__ */ jsx15("div", {
|
|
3644
|
+
className: "absolute top-0 right-4",
|
|
3645
|
+
onClick: (event) => event.stopPropagation(),
|
|
3646
|
+
children: /* @__PURE__ */ jsx15(DataTableRowActionMenu, {
|
|
3573
3647
|
tableAtom
|
|
3574
|
-
})
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
renderCell(row, tag, store.config.locale, store.config.labels)
|
|
3580
|
-
]
|
|
3581
|
-
}) : null
|
|
3582
|
-
]
|
|
3583
|
-
}),
|
|
3584
|
-
/* @__PURE__ */ jsx15(CardTitle, {
|
|
3585
|
-
children: name ? renderCell(row, name, store.config.locale, store.config.labels) : row.id
|
|
3586
|
-
}),
|
|
3587
|
-
description ? /* @__PURE__ */ jsx15("div", {
|
|
3588
|
-
className: "text-muted-foreground line-clamp-3 text-sm",
|
|
3589
|
-
children: renderCell(row, description, store.config.locale, store.config.labels)
|
|
3590
|
-
}) : null,
|
|
3591
|
-
hasRowActionMenu(store) ? /* @__PURE__ */ jsx15("div", {
|
|
3592
|
-
className: "absolute top-4 right-4",
|
|
3593
|
-
onClick: (event) => event.stopPropagation(),
|
|
3594
|
-
children: /* @__PURE__ */ jsx15(DataTableRowActionMenu, {
|
|
3595
|
-
tableAtom
|
|
3596
|
-
})
|
|
3597
|
-
}) : null
|
|
3598
|
-
]
|
|
3599
|
-
})
|
|
3648
|
+
})
|
|
3649
|
+
}) : null
|
|
3650
|
+
]
|
|
3651
|
+
})
|
|
3652
|
+
]
|
|
3600
3653
|
});
|
|
3601
3654
|
};
|
|
3602
3655
|
var DataTableGallery = ({
|
|
@@ -3860,6 +3913,7 @@ var DataTable = (props) => {
|
|
|
3860
3913
|
schema: DataTablePersistedUiStateSchema,
|
|
3861
3914
|
defaultValue: () => ({
|
|
3862
3915
|
...persistedUiFromState(DEFAULT_UI_STATE),
|
|
3916
|
+
view: props.features?.gallery ? props.initialState?.view ?? "table" : "table",
|
|
3863
3917
|
grouping: props.features?.grouping ? props.features.grouping.initial ?? [] : []
|
|
3864
3918
|
})
|
|
3865
3919
|
});
|
|
@@ -145,7 +145,7 @@ declare const RevertButton: ({ locale, messages, original, }: {
|
|
|
145
145
|
messages?: FormMessageTranslations;
|
|
146
146
|
original: string;
|
|
147
147
|
}) => JSX.Element | undefined;
|
|
148
|
-
declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tanstack/
|
|
148
|
+
declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChange extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TSubmitMeta>(props: import("@tanstack/form-core").FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>) => import("@tanstack/react-form").AppFieldExtendedReactFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
|
|
149
149
|
readonly TextField: typeof TextField;
|
|
150
150
|
readonly TextAreaField: typeof TextAreaField;
|
|
151
151
|
readonly SelectField: typeof SelectField;
|
|
@@ -161,7 +161,7 @@ declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tans
|
|
|
161
161
|
readonly FormError: typeof FormError;
|
|
162
162
|
readonly FieldWrapper: typeof FieldWrapper;
|
|
163
163
|
readonly BlockNavigation: typeof BlockNavigation;
|
|
164
|
-
}>, withForm: <TFormData, TOnMount extends undefined | import("@tanstack/
|
|
164
|
+
}>, withForm: <TFormData, TOnMount extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChange extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TSubmitMeta, TRenderProps extends object = {}>({ render, props, }: import("@tanstack/react-form").WithFormProps<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
|
|
165
165
|
readonly TextField: typeof TextField;
|
|
166
166
|
readonly TextAreaField: typeof TextAreaField;
|
|
167
167
|
readonly SelectField: typeof SelectField;
|
|
@@ -178,7 +178,7 @@ declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tans
|
|
|
178
178
|
readonly FieldWrapper: typeof FieldWrapper;
|
|
179
179
|
readonly BlockNavigation: typeof BlockNavigation;
|
|
180
180
|
}, TRenderProps>) => import("react").FunctionComponent<import("react").PropsWithChildren<NoInfer<[unknown] extends [TRenderProps] ? any : TRenderProps> & {
|
|
181
|
-
form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<[unknown] extends [TFormData] ? any : TFormData, [import("@tanstack/
|
|
181
|
+
form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<[unknown] extends [TFormData] ? any : TFormData, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnMount] ? [TOnMount] extends [TOnMount & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnMount : TOnMount, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnChange] ? [TOnChange] extends [TOnChange & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnChange : TOnChange, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnChangeAsync] ? [TOnChangeAsync] extends [TOnChangeAsync & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnChangeAsync : TOnChangeAsync, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnBlur] ? [TOnBlur] extends [TOnBlur & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlur : TOnBlur, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnBlurAsync] ? [TOnBlurAsync] extends [TOnBlurAsync & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlurAsync : TOnBlurAsync, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnSubmit] ? [TOnSubmit] extends [TOnSubmit & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmit : TOnSubmit, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnSubmitAsync] ? [TOnSubmitAsync] extends [TOnSubmitAsync & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmitAsync : TOnSubmitAsync, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnDynamic] ? [TOnDynamic] extends [TOnDynamic & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamic : TOnDynamic, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnDynamicAsync] ? [TOnDynamicAsync] extends [TOnDynamicAsync & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamicAsync : TOnDynamicAsync, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnServer] ? [TOnServer] extends [TOnServer & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnServer : TOnServer, [unknown] extends [TSubmitMeta] ? any : TSubmitMeta, {
|
|
182
182
|
readonly TextField: typeof TextField;
|
|
183
183
|
readonly TextAreaField: typeof TextAreaField;
|
|
184
184
|
readonly SelectField: typeof SelectField;
|
|
@@ -211,8 +211,8 @@ declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tans
|
|
|
211
211
|
readonly FormError: typeof FormError;
|
|
212
212
|
readonly FieldWrapper: typeof FieldWrapper;
|
|
213
213
|
readonly BlockNavigation: typeof BlockNavigation;
|
|
214
|
-
}, TSubmitMeta, TRenderProps>) => <TFormData, TFields extends import("@tanstack/
|
|
215
|
-
form: import("@tanstack/react-form").AppFieldExtendedReactFieldGroupApi<unknown, TFormData, string | import("@tanstack/
|
|
214
|
+
}, TSubmitMeta, TRenderProps>) => <TFormData, TFields extends import("@tanstack/form-core").DeepKeysOfType<TFormData, TFieldGroupData | null | undefined> | import("@tanstack/form-core").FieldsMap<TFormData, TFieldGroupData>, TOnMount extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChange extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TFormSubmitMeta>(params: import("react").PropsWithChildren<NoInfer<TRenderProps> & {
|
|
215
|
+
form: import("@tanstack/react-form").AppFieldExtendedReactFieldGroupApi<unknown, TFormData, string | import("@tanstack/form-core").FieldsMap<unknown, TFormData>, any, any, any, any, any, any, any, any, any, any, unknown extends TSubmitMeta ? TFormSubmitMeta : TSubmitMeta, {
|
|
216
216
|
readonly TextField: typeof TextField;
|
|
217
217
|
readonly TextAreaField: typeof TextAreaField;
|
|
218
218
|
readonly SelectField: typeof SelectField;
|
|
@@ -3528,6 +3528,44 @@ var DataTableBody = ({
|
|
|
3528
3528
|
}, row.id))
|
|
3529
3529
|
});
|
|
3530
3530
|
};
|
|
3531
|
+
var GalleryImage = ({ src, alt }) => {
|
|
3532
|
+
const [failed, setFailed] = useState(false);
|
|
3533
|
+
if (failed)
|
|
3534
|
+
return null;
|
|
3535
|
+
return /* @__PURE__ */ jsx15("img", {
|
|
3536
|
+
src,
|
|
3537
|
+
alt,
|
|
3538
|
+
loading: "lazy",
|
|
3539
|
+
decoding: "async",
|
|
3540
|
+
className: "aspect-video w-full object-cover",
|
|
3541
|
+
onError: () => setFailed(true)
|
|
3542
|
+
});
|
|
3543
|
+
};
|
|
3544
|
+
var GalleryTag = ({
|
|
3545
|
+
row,
|
|
3546
|
+
column,
|
|
3547
|
+
icon,
|
|
3548
|
+
locale,
|
|
3549
|
+
labels
|
|
3550
|
+
}) => {
|
|
3551
|
+
const value = row.values.get(column.id);
|
|
3552
|
+
if ((value == null || value === "") && !column.colDef.cellRenderer)
|
|
3553
|
+
return null;
|
|
3554
|
+
const content = renderCell(row, column, locale, labels);
|
|
3555
|
+
return column.colDef.cellRenderer || column.colDef.valueFormatter ? /* @__PURE__ */ jsxs9("div", {
|
|
3556
|
+
className: "flex min-w-0 items-center gap-1",
|
|
3557
|
+
children: [
|
|
3558
|
+
icon,
|
|
3559
|
+
content
|
|
3560
|
+
]
|
|
3561
|
+
}) : /* @__PURE__ */ jsxs9(Badge, {
|
|
3562
|
+
variant: "secondary",
|
|
3563
|
+
children: [
|
|
3564
|
+
icon,
|
|
3565
|
+
content
|
|
3566
|
+
]
|
|
3567
|
+
});
|
|
3568
|
+
};
|
|
3531
3569
|
var GalleryCard = ({
|
|
3532
3570
|
tableAtom
|
|
3533
3571
|
}) => {
|
|
@@ -3538,14 +3576,17 @@ var GalleryCard = ({
|
|
|
3538
3576
|
const gallery = store.config.features.gallery;
|
|
3539
3577
|
if (!row || !gallery)
|
|
3540
3578
|
return null;
|
|
3541
|
-
const find = (id) => id ? model.
|
|
3579
|
+
const find = (id) => id ? model.columns.find((column) => column.id === id) : undefined;
|
|
3542
3580
|
const name = find(gallery.name);
|
|
3543
3581
|
const description = find(gallery.description);
|
|
3544
|
-
const
|
|
3582
|
+
const tagIds = [
|
|
3583
|
+
...new Set(gallery.tags ?? (gallery.tag ? [gallery.tag] : []))
|
|
3584
|
+
];
|
|
3585
|
+
const imageSrc = gallery.image?.getSrc(row.data);
|
|
3545
3586
|
const selection = store.config.features.selection;
|
|
3546
3587
|
const selectable = !!selection && (selection.isRowSelectable?.(row.data) ?? true);
|
|
3547
3588
|
const draggable = canDragRows(store);
|
|
3548
|
-
return /* @__PURE__ */
|
|
3589
|
+
return /* @__PURE__ */ jsxs9(Card, {
|
|
3549
3590
|
className: cn("data-[drop-position=before]:border-t-primary data-[drop-position=after]:border-b-primary relative gap-3 data-[drag-source=true]:opacity-40 data-[drop-position=after]:border-b-2 data-[drop-position=before]:border-t-2", store.config.onRowClicked && "cursor-pointer"),
|
|
3550
3591
|
"data-table-row": row.id,
|
|
3551
3592
|
onClick: () => store.config.onRowClicked?.(row.data),
|
|
@@ -3556,47 +3597,59 @@ var GalleryCard = ({
|
|
|
3556
3597
|
}
|
|
3557
3598
|
},
|
|
3558
3599
|
tabIndex: store.config.onRowClicked ? 0 : undefined,
|
|
3559
|
-
children:
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3600
|
+
children: [
|
|
3601
|
+
imageSrc ? /* @__PURE__ */ jsx15(GalleryImage, {
|
|
3602
|
+
src: imageSrc,
|
|
3603
|
+
alt: gallery.image?.getAlt?.(row.data) ?? ""
|
|
3604
|
+
}, imageSrc) : null,
|
|
3605
|
+
/* @__PURE__ */ jsxs9(CardHeader, {
|
|
3606
|
+
className: cn("relative", hasRowActionMenu(store) && "pr-12"),
|
|
3607
|
+
children: [
|
|
3608
|
+
selection || draggable ? /* @__PURE__ */ jsxs9("div", {
|
|
3609
|
+
className: "flex items-center gap-2",
|
|
3610
|
+
children: [
|
|
3611
|
+
selection ? /* @__PURE__ */ jsx15(Checkbox, {
|
|
3612
|
+
"aria-label": store.config.labels.selectRow,
|
|
3613
|
+
checked: !!store.state.rowSelection[row.id],
|
|
3614
|
+
disabled: !selectable,
|
|
3615
|
+
onCheckedChange: (checked) => toggleRow(store, setStore, row.id, checked),
|
|
3616
|
+
onClick: (event) => event.stopPropagation()
|
|
3617
|
+
}) : null,
|
|
3618
|
+
draggable ? /* @__PURE__ */ jsx15(DragHandle, {
|
|
3619
|
+
tableAtom
|
|
3620
|
+
}) : null
|
|
3621
|
+
]
|
|
3622
|
+
}) : null,
|
|
3623
|
+
/* @__PURE__ */ jsx15(CardTitle, {
|
|
3624
|
+
children: name ? renderCell(row, name, store.config.locale, store.config.labels) : row.id
|
|
3625
|
+
}),
|
|
3626
|
+
tagIds.length ? /* @__PURE__ */ jsx15("div", {
|
|
3627
|
+
className: "flex flex-wrap items-center gap-2",
|
|
3628
|
+
children: tagIds.map((id) => {
|
|
3629
|
+
const column = find(id);
|
|
3630
|
+
return column ? /* @__PURE__ */ jsx15(GalleryTag, {
|
|
3631
|
+
row,
|
|
3632
|
+
column,
|
|
3633
|
+
locale: store.config.locale,
|
|
3634
|
+
labels: store.config.labels,
|
|
3635
|
+
icon: id === gallery.tag ? gallery.tagIcon : undefined
|
|
3636
|
+
}, id) : null;
|
|
3637
|
+
})
|
|
3638
|
+
}) : null,
|
|
3639
|
+
description ? /* @__PURE__ */ jsx15("div", {
|
|
3640
|
+
className: "text-muted-foreground line-clamp-3 text-sm",
|
|
3641
|
+
children: renderCell(row, description, store.config.locale, store.config.labels)
|
|
3642
|
+
}) : null,
|
|
3643
|
+
hasRowActionMenu(store) ? /* @__PURE__ */ jsx15("div", {
|
|
3644
|
+
className: "absolute top-0 right-4",
|
|
3645
|
+
onClick: (event) => event.stopPropagation(),
|
|
3646
|
+
children: /* @__PURE__ */ jsx15(DataTableRowActionMenu, {
|
|
3573
3647
|
tableAtom
|
|
3574
|
-
})
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
renderCell(row, tag, store.config.locale, store.config.labels)
|
|
3580
|
-
]
|
|
3581
|
-
}) : null
|
|
3582
|
-
]
|
|
3583
|
-
}),
|
|
3584
|
-
/* @__PURE__ */ jsx15(CardTitle, {
|
|
3585
|
-
children: name ? renderCell(row, name, store.config.locale, store.config.labels) : row.id
|
|
3586
|
-
}),
|
|
3587
|
-
description ? /* @__PURE__ */ jsx15("div", {
|
|
3588
|
-
className: "text-muted-foreground line-clamp-3 text-sm",
|
|
3589
|
-
children: renderCell(row, description, store.config.locale, store.config.labels)
|
|
3590
|
-
}) : null,
|
|
3591
|
-
hasRowActionMenu(store) ? /* @__PURE__ */ jsx15("div", {
|
|
3592
|
-
className: "absolute top-4 right-4",
|
|
3593
|
-
onClick: (event) => event.stopPropagation(),
|
|
3594
|
-
children: /* @__PURE__ */ jsx15(DataTableRowActionMenu, {
|
|
3595
|
-
tableAtom
|
|
3596
|
-
})
|
|
3597
|
-
}) : null
|
|
3598
|
-
]
|
|
3599
|
-
})
|
|
3648
|
+
})
|
|
3649
|
+
}) : null
|
|
3650
|
+
]
|
|
3651
|
+
})
|
|
3652
|
+
]
|
|
3600
3653
|
});
|
|
3601
3654
|
};
|
|
3602
3655
|
var DataTableGallery = ({
|
|
@@ -3860,6 +3913,7 @@ var DataTable = (props) => {
|
|
|
3860
3913
|
schema: DataTablePersistedUiStateSchema,
|
|
3861
3914
|
defaultValue: () => ({
|
|
3862
3915
|
...persistedUiFromState(DEFAULT_UI_STATE),
|
|
3916
|
+
view: props.features?.gallery ? props.initialState?.view ?? "table" : "table",
|
|
3863
3917
|
grouping: props.features?.grouping ? props.features.grouping.initial ?? [] : []
|
|
3864
3918
|
})
|
|
3865
3919
|
});
|
|
@@ -3532,6 +3532,44 @@ var DataTableBody = ({
|
|
|
3532
3532
|
}, row.id))
|
|
3533
3533
|
});
|
|
3534
3534
|
};
|
|
3535
|
+
var GalleryImage = ({ src, alt }) => {
|
|
3536
|
+
const [failed, setFailed] = useState(false);
|
|
3537
|
+
if (failed)
|
|
3538
|
+
return null;
|
|
3539
|
+
return /* @__PURE__ */ jsx15("img", {
|
|
3540
|
+
src,
|
|
3541
|
+
alt,
|
|
3542
|
+
loading: "lazy",
|
|
3543
|
+
decoding: "async",
|
|
3544
|
+
className: "aspect-video w-full object-cover",
|
|
3545
|
+
onError: () => setFailed(true)
|
|
3546
|
+
});
|
|
3547
|
+
};
|
|
3548
|
+
var GalleryTag = ({
|
|
3549
|
+
row,
|
|
3550
|
+
column,
|
|
3551
|
+
icon,
|
|
3552
|
+
locale,
|
|
3553
|
+
labels
|
|
3554
|
+
}) => {
|
|
3555
|
+
const value = row.values.get(column.id);
|
|
3556
|
+
if ((value == null || value === "") && !column.colDef.cellRenderer)
|
|
3557
|
+
return null;
|
|
3558
|
+
const content = renderCell(row, column, locale, labels);
|
|
3559
|
+
return column.colDef.cellRenderer || column.colDef.valueFormatter ? /* @__PURE__ */ jsxs9("div", {
|
|
3560
|
+
className: "flex min-w-0 items-center gap-1",
|
|
3561
|
+
children: [
|
|
3562
|
+
icon,
|
|
3563
|
+
content
|
|
3564
|
+
]
|
|
3565
|
+
}) : /* @__PURE__ */ jsxs9(Badge, {
|
|
3566
|
+
variant: "secondary",
|
|
3567
|
+
children: [
|
|
3568
|
+
icon,
|
|
3569
|
+
content
|
|
3570
|
+
]
|
|
3571
|
+
});
|
|
3572
|
+
};
|
|
3535
3573
|
var GalleryCard = ({
|
|
3536
3574
|
tableAtom
|
|
3537
3575
|
}) => {
|
|
@@ -3542,14 +3580,17 @@ var GalleryCard = ({
|
|
|
3542
3580
|
const gallery = store.config.features.gallery;
|
|
3543
3581
|
if (!row || !gallery)
|
|
3544
3582
|
return null;
|
|
3545
|
-
const find = (id) => id ? model.
|
|
3583
|
+
const find = (id) => id ? model.columns.find((column) => column.id === id) : undefined;
|
|
3546
3584
|
const name = find(gallery.name);
|
|
3547
3585
|
const description = find(gallery.description);
|
|
3548
|
-
const
|
|
3586
|
+
const tagIds = [
|
|
3587
|
+
...new Set(gallery.tags ?? (gallery.tag ? [gallery.tag] : []))
|
|
3588
|
+
];
|
|
3589
|
+
const imageSrc = gallery.image?.getSrc(row.data);
|
|
3549
3590
|
const selection = store.config.features.selection;
|
|
3550
3591
|
const selectable = !!selection && (selection.isRowSelectable?.(row.data) ?? true);
|
|
3551
3592
|
const draggable = canDragRows(store);
|
|
3552
|
-
return /* @__PURE__ */
|
|
3593
|
+
return /* @__PURE__ */ jsxs9(Card, {
|
|
3553
3594
|
className: cn("data-[drop-position=before]:border-t-primary data-[drop-position=after]:border-b-primary relative gap-3 data-[drag-source=true]:opacity-40 data-[drop-position=after]:border-b-2 data-[drop-position=before]:border-t-2", store.config.onRowClicked && "cursor-pointer"),
|
|
3554
3595
|
"data-table-row": row.id,
|
|
3555
3596
|
onClick: () => store.config.onRowClicked?.(row.data),
|
|
@@ -3560,47 +3601,59 @@ var GalleryCard = ({
|
|
|
3560
3601
|
}
|
|
3561
3602
|
},
|
|
3562
3603
|
tabIndex: store.config.onRowClicked ? 0 : undefined,
|
|
3563
|
-
children:
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3604
|
+
children: [
|
|
3605
|
+
imageSrc ? /* @__PURE__ */ jsx15(GalleryImage, {
|
|
3606
|
+
src: imageSrc,
|
|
3607
|
+
alt: gallery.image?.getAlt?.(row.data) ?? ""
|
|
3608
|
+
}, imageSrc) : null,
|
|
3609
|
+
/* @__PURE__ */ jsxs9(CardHeader, {
|
|
3610
|
+
className: cn("relative", hasRowActionMenu(store) && "pr-12"),
|
|
3611
|
+
children: [
|
|
3612
|
+
selection || draggable ? /* @__PURE__ */ jsxs9("div", {
|
|
3613
|
+
className: "flex items-center gap-2",
|
|
3614
|
+
children: [
|
|
3615
|
+
selection ? /* @__PURE__ */ jsx15(Checkbox, {
|
|
3616
|
+
"aria-label": store.config.labels.selectRow,
|
|
3617
|
+
checked: !!store.state.rowSelection[row.id],
|
|
3618
|
+
disabled: !selectable,
|
|
3619
|
+
onCheckedChange: (checked) => toggleRow(store, setStore, row.id, checked),
|
|
3620
|
+
onClick: (event) => event.stopPropagation()
|
|
3621
|
+
}) : null,
|
|
3622
|
+
draggable ? /* @__PURE__ */ jsx15(DragHandle, {
|
|
3623
|
+
tableAtom
|
|
3624
|
+
}) : null
|
|
3625
|
+
]
|
|
3626
|
+
}) : null,
|
|
3627
|
+
/* @__PURE__ */ jsx15(CardTitle, {
|
|
3628
|
+
children: name ? renderCell(row, name, store.config.locale, store.config.labels) : row.id
|
|
3629
|
+
}),
|
|
3630
|
+
tagIds.length ? /* @__PURE__ */ jsx15("div", {
|
|
3631
|
+
className: "flex flex-wrap items-center gap-2",
|
|
3632
|
+
children: tagIds.map((id) => {
|
|
3633
|
+
const column = find(id);
|
|
3634
|
+
return column ? /* @__PURE__ */ jsx15(GalleryTag, {
|
|
3635
|
+
row,
|
|
3636
|
+
column,
|
|
3637
|
+
locale: store.config.locale,
|
|
3638
|
+
labels: store.config.labels,
|
|
3639
|
+
icon: id === gallery.tag ? gallery.tagIcon : undefined
|
|
3640
|
+
}, id) : null;
|
|
3641
|
+
})
|
|
3642
|
+
}) : null,
|
|
3643
|
+
description ? /* @__PURE__ */ jsx15("div", {
|
|
3644
|
+
className: "text-muted-foreground line-clamp-3 text-sm",
|
|
3645
|
+
children: renderCell(row, description, store.config.locale, store.config.labels)
|
|
3646
|
+
}) : null,
|
|
3647
|
+
hasRowActionMenu(store) ? /* @__PURE__ */ jsx15("div", {
|
|
3648
|
+
className: "absolute top-0 right-4",
|
|
3649
|
+
onClick: (event) => event.stopPropagation(),
|
|
3650
|
+
children: /* @__PURE__ */ jsx15(DataTableRowActionMenu, {
|
|
3577
3651
|
tableAtom
|
|
3578
|
-
})
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
renderCell(row, tag, store.config.locale, store.config.labels)
|
|
3584
|
-
]
|
|
3585
|
-
}) : null
|
|
3586
|
-
]
|
|
3587
|
-
}),
|
|
3588
|
-
/* @__PURE__ */ jsx15(CardTitle, {
|
|
3589
|
-
children: name ? renderCell(row, name, store.config.locale, store.config.labels) : row.id
|
|
3590
|
-
}),
|
|
3591
|
-
description ? /* @__PURE__ */ jsx15("div", {
|
|
3592
|
-
className: "text-muted-foreground line-clamp-3 text-sm",
|
|
3593
|
-
children: renderCell(row, description, store.config.locale, store.config.labels)
|
|
3594
|
-
}) : null,
|
|
3595
|
-
hasRowActionMenu(store) ? /* @__PURE__ */ jsx15("div", {
|
|
3596
|
-
className: "absolute top-4 right-4",
|
|
3597
|
-
onClick: (event) => event.stopPropagation(),
|
|
3598
|
-
children: /* @__PURE__ */ jsx15(DataTableRowActionMenu, {
|
|
3599
|
-
tableAtom
|
|
3600
|
-
})
|
|
3601
|
-
}) : null
|
|
3602
|
-
]
|
|
3603
|
-
})
|
|
3652
|
+
})
|
|
3653
|
+
}) : null
|
|
3654
|
+
]
|
|
3655
|
+
})
|
|
3656
|
+
]
|
|
3604
3657
|
});
|
|
3605
3658
|
};
|
|
3606
3659
|
var DataTableGallery = ({
|
|
@@ -3864,6 +3917,7 @@ var DataTable = (props) => {
|
|
|
3864
3917
|
schema: DataTablePersistedUiStateSchema,
|
|
3865
3918
|
defaultValue: () => ({
|
|
3866
3919
|
...persistedUiFromState(DEFAULT_UI_STATE),
|
|
3920
|
+
view: props.features?.gallery ? props.initialState?.view ?? "table" : "table",
|
|
3867
3921
|
grouping: props.features?.grouping ? props.features.grouping.initial ?? [] : []
|
|
3868
3922
|
})
|
|
3869
3923
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krak-stack/registry",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.5",
|
|
4
4
|
"description": "Tree-shakable KrakStack components and Effect services.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -412,7 +412,7 @@
|
|
|
412
412
|
"@effect/sql-pg": "^4.1.0",
|
|
413
413
|
"@iconify/react": "^6.0.2",
|
|
414
414
|
"@inlang/paraglide-js": "^2.19.0",
|
|
415
|
-
"@lucas-barake/effect-form": "1.1.
|
|
415
|
+
"@lucas-barake/effect-form": "1.1.1",
|
|
416
416
|
"@lucas-barake/effect-form-react": "1.1.0",
|
|
417
417
|
"@tanstack/highlight": "^0.0.10",
|
|
418
418
|
"@tanstack/react-form": "^1.33.0",
|