@questpie/admin 3.2.4 → 3.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/blocks/block-renderer.d.mts +2 -2
- package/dist/client/blocks/block-renderer.mjs +164 -339
- package/dist/client/components/actions/action-button.mjs +9 -9
- package/dist/client/components/actions/action-dialog.mjs +195 -493
- package/dist/client/components/actions/confirmation-dialog.mjs +44 -159
- package/dist/client/components/actions/header-actions.mjs +73 -165
- package/dist/client/components/admin-link.d.mts +2 -2
- package/dist/client/components/admin-link.mjs +40 -126
- package/dist/client/components/auth/auth-loading.mjs +9 -44
- package/dist/client/components/blocks/block-canvas.mjs +31 -95
- package/dist/client/components/blocks/block-editor-context.mjs +13 -57
- package/dist/client/components/blocks/block-editor-layout.mjs +72 -166
- package/dist/client/components/blocks/block-editor-provider.mjs +184 -245
- package/dist/client/components/blocks/block-fields-renderer.mjs +54 -229
- package/dist/client/components/blocks/block-insert-button.mjs +49 -165
- package/dist/client/components/blocks/block-item-menu.mjs +102 -301
- package/dist/client/components/blocks/block-item.mjs +136 -370
- package/dist/client/components/blocks/block-library-sidebar.mjs +103 -230
- package/dist/client/components/blocks/block-tree.mjs +12 -68
- package/dist/client/components/blocks/block-type-icon.mjs +14 -56
- package/dist/client/components/brand-logo.mjs +35 -149
- package/dist/client/components/component-renderer.mjs +42 -118
- package/dist/client/components/error-boundary.mjs +14 -58
- package/dist/client/components/fields/array-field.mjs +209 -521
- package/dist/client/components/fields/asset-preview-field.mjs +41 -141
- package/dist/client/components/fields/blocks-field/blocks-field.mjs +60 -156
- package/dist/client/components/fields/boolean-field.mjs +29 -59
- package/dist/client/components/fields/date-field.mjs +7 -37
- package/dist/client/components/fields/datetime-field.mjs +7 -38
- package/dist/client/components/fields/email-field.mjs +25 -54
- package/dist/client/components/fields/field-wrapper.mjs +30 -105
- package/dist/client/components/fields/json-field.mjs +94 -296
- package/dist/client/components/fields/locale-badge.mjs +6 -15
- package/dist/client/components/fields/number-field.mjs +27 -60
- package/dist/client/components/fields/object-array-field.mjs +283 -659
- package/dist/client/components/fields/object-field.mjs +165 -633
- package/dist/client/components/fields/relation/displays/cards-display.mjs +106 -220
- package/dist/client/components/fields/relation/displays/chips-display.mjs +78 -150
- package/dist/client/components/fields/relation/displays/grid-display.mjs +92 -186
- package/dist/client/components/fields/relation/displays/list-display.mjs +122 -239
- package/dist/client/components/fields/relation/displays/table-display.mjs +70 -244
- package/dist/client/components/fields/relation/relation-items-display.mjs +30 -126
- package/dist/client/components/fields/relation-field.mjs +10 -66
- package/dist/client/components/fields/relation-picker.mjs +18 -18
- package/dist/client/components/fields/relation-select.mjs +12 -12
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +80 -180
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +2 -2
- package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
- package/dist/client/components/fields/rich-text-editor/index.mjs +195 -513
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +61 -111
- package/dist/client/components/fields/rich-text-editor/table-controls.mjs +105 -415
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs +256 -511
- package/dist/client/components/fields/rich-text-field.mjs +14 -53
- package/dist/client/components/fields/select-field.mjs +61 -72
- package/dist/client/components/fields/text-field.mjs +26 -59
- package/dist/client/components/fields/textarea-field.mjs +26 -58
- package/dist/client/components/fields/time-field.mjs +7 -35
- package/dist/client/components/fields/upload-field.mjs +47 -165
- package/dist/client/components/filter-builder/columns-tab.mjs +80 -280
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs +197 -540
- package/dist/client/components/filter-builder/filters-tab.mjs +96 -386
- package/dist/client/components/filter-builder/saved-views-tab.mjs +133 -351
- package/dist/client/components/history-sidebar.mjs +285 -605
- package/dist/client/components/layout/field-layout-renderer.mjs +106 -254
- package/dist/client/components/locale-switcher.mjs +106 -228
- package/dist/client/components/media/media-grid.mjs +84 -273
- package/dist/client/components/media/media-picker-dialog.mjs +176 -476
- package/dist/client/components/preview/live-preview-mode.mjs +233 -458
- package/dist/client/components/preview/preview-pane.mjs +22 -22
- package/dist/client/components/primitives/asset-preview.mjs +290 -666
- package/dist/client/components/primitives/checkbox-input.mjs +9 -35
- package/dist/client/components/primitives/date-input.mjs +109 -327
- package/dist/client/components/primitives/dropzone.mjs +209 -336
- package/dist/client/components/primitives/field-select-control.mjs +12 -80
- package/dist/client/components/primitives/number-input.mjs +4 -4
- package/dist/client/components/primitives/select-multi.mjs +229 -572
- package/dist/client/components/primitives/select-single.mjs +179 -499
- package/dist/client/components/primitives/time-input.mjs +43 -117
- package/dist/client/components/primitives/toggle-input.mjs +9 -29
- package/dist/client/components/sheets/resource-sheet.mjs +61 -70
- package/dist/client/components/ui/accordion.mjs +35 -155
- package/dist/client/components/ui/alert.mjs +13 -68
- package/dist/client/components/ui/badge.mjs +9 -51
- package/dist/client/components/ui/button.mjs +8 -54
- package/dist/client/components/ui/card.mjs +37 -193
- package/dist/client/components/ui/checkbox.mjs +12 -68
- package/dist/client/components/ui/command.mjs +48 -219
- package/dist/client/components/ui/dialog.mjs +50 -262
- package/dist/client/components/ui/drawer.mjs +55 -259
- package/dist/client/components/ui/dropdown-menu.mjs +86 -427
- package/dist/client/components/ui/empty-state.mjs +28 -98
- package/dist/client/components/ui/field.mjs +73 -309
- package/dist/client/components/ui/input-group.mjs +42 -167
- package/dist/client/components/ui/input.mjs +7 -37
- package/dist/client/components/ui/kbd.mjs +6 -36
- package/dist/client/components/ui/label.mjs +7 -37
- package/dist/client/components/ui/popover.mjs +34 -169
- package/dist/client/components/ui/responsive-dialog.mjs +67 -273
- package/dist/client/components/ui/scroll-fade.mjs +63 -158
- package/dist/client/components/ui/search-input.mjs +33 -100
- package/dist/client/components/ui/select.mjs +72 -393
- package/dist/client/components/ui/separator.mjs +7 -38
- package/dist/client/components/ui/sheet.mjs +49 -269
- package/dist/client/components/ui/sidebar.mjs +171 -690
- package/dist/client/components/ui/skeleton.mjs +7 -38
- package/dist/client/components/ui/sonner.mjs +11 -42
- package/dist/client/components/ui/switch.mjs +9 -45
- package/dist/client/components/ui/table.mjs +48 -266
- package/dist/client/components/ui/tabs.mjs +26 -139
- package/dist/client/components/ui/textarea.mjs +6 -32
- package/dist/client/components/ui/tooltip.mjs +27 -129
- package/dist/client/components/widgets/chart-widget.mjs +174 -522
- package/dist/client/components/widgets/progress-widget.mjs +66 -172
- package/dist/client/components/widgets/quick-actions-widget.mjs +102 -261
- package/dist/client/components/widgets/recent-items-widget.mjs +69 -195
- package/dist/client/components/widgets/stats-widget.mjs +41 -175
- package/dist/client/components/widgets/table-widget.mjs +9 -9
- package/dist/client/components/widgets/timeline-widget.mjs +86 -226
- package/dist/client/components/widgets/value-widget.mjs +74 -381
- package/dist/client/components/widgets/widget-empty-state.mjs +26 -76
- package/dist/client/components/widgets/widget-skeletons.mjs +138 -421
- package/dist/client/contexts/focus-context.mjs +63 -146
- package/dist/client/hooks/typed-hooks.mjs +241 -701
- package/dist/client/hooks/use-action.mjs +62 -198
- package/dist/client/hooks/use-admin-config.mjs +5 -35
- package/dist/client/hooks/use-admin-preferences.mjs +16 -88
- package/dist/client/hooks/use-admin-routes.mjs +22 -56
- package/dist/client/hooks/use-audit-history.mjs +21 -69
- package/dist/client/hooks/use-brand.mjs +1 -9
- package/dist/client/hooks/use-collection-fields.mjs +17 -57
- package/dist/client/hooks/use-collection-meta.mjs +12 -44
- package/dist/client/hooks/use-collection-schema.mjs +10 -33
- package/dist/client/hooks/use-collection-validation.mjs +23 -53
- package/dist/client/hooks/use-collection.mjs +194 -614
- package/dist/client/hooks/use-current-user.mjs +0 -1
- package/dist/client/hooks/use-field-hooks.mjs +10 -10
- package/dist/client/hooks/use-field-options.mjs +61 -202
- package/dist/client/hooks/use-global-fields.mjs +14 -46
- package/dist/client/hooks/use-global-meta.mjs +9 -30
- package/dist/client/hooks/use-global-schema.mjs +9 -30
- package/dist/client/hooks/use-global.mjs +63 -219
- package/dist/client/hooks/use-locks.mjs +117 -325
- package/dist/client/hooks/use-media-query.mjs +16 -36
- package/dist/client/hooks/use-prefill-params.mjs +0 -1
- package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
- package/dist/client/hooks/use-reactive-fields.mjs +1 -1
- package/dist/client/hooks/use-reactive-prop.mjs +65 -223
- package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
- package/dist/client/hooks/use-saved-views.mjs +22 -103
- package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
- package/dist/client/hooks/use-search.mjs +31 -143
- package/dist/client/hooks/use-server-actions.mjs +18 -50
- package/dist/client/hooks/use-server-validation.mjs +72 -166
- package/dist/client/hooks/use-server-widget-data.mjs +7 -33
- package/dist/client/hooks/use-setup-status.mjs +12 -25
- package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
- package/dist/client/hooks/use-transition-stage.mjs +8 -38
- package/dist/client/hooks/use-upload.mjs +54 -152
- package/dist/client/hooks/use-validation-error-map.mjs +6 -26
- package/dist/client/hooks/use-view-state.mjs +187 -437
- package/dist/client/i18n/hooks.mjs +65 -197
- package/dist/client/lib/render-profiler.mjs +14 -41
- package/dist/client/preview/block-scope-context.mjs +14 -36
- package/dist/client/preview/preview-banner.d.mts +2 -2
- package/dist/client/preview/preview-banner.mjs +42 -108
- package/dist/client/preview/preview-field.d.mts +4 -4
- package/dist/client/preview/preview-field.mjs +167 -348
- package/dist/client/preview/use-collection-preview.mjs +121 -215
- package/dist/client/runtime/content-locales-provider.mjs +31 -83
- package/dist/client/runtime/locale-scope.mjs +22 -63
- package/dist/client/runtime/provider.mjs +100 -255
- package/dist/client/runtime/translations-provider.mjs +41 -107
- package/dist/client/scope/picker.mjs +86 -321
- package/dist/client/scope/provider.mjs +8 -17
- package/dist/client/utils/build-field-definitions-from-schema.mjs +4 -2
- package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
- package/dist/client/views/auth/accept-invite-form.mjs +121 -412
- package/dist/client/views/auth/auth-layout.d.mts +3 -3
- package/dist/client/views/auth/auth-layout.mjs +104 -284
- package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
- package/dist/client/views/auth/forgot-password-form.mjs +94 -325
- package/dist/client/views/auth/invite-form.mjs +107 -442
- package/dist/client/views/auth/login-form.d.mts +2 -2
- package/dist/client/views/auth/login-form.mjs +116 -337
- package/dist/client/views/auth/reset-password-form.d.mts +2 -2
- package/dist/client/views/auth/reset-password-form.mjs +128 -453
- package/dist/client/views/auth/setup-form.d.mts +2 -2
- package/dist/client/views/auth/setup-form.mjs +140 -478
- package/dist/client/views/collection/auto-form-fields.mjs +243 -615
- package/dist/client/views/collection/bulk-action-toolbar.mjs +212 -379
- package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
- package/dist/client/views/collection/cells/primitive-cells.mjs +116 -356
- package/dist/client/views/collection/cells/relation-cells.mjs +86 -233
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +142 -371
- package/dist/client/views/collection/cells/shared/relation-chip.mjs +35 -131
- package/dist/client/views/collection/cells/upload-cells.mjs +60 -177
- package/dist/client/views/collection/columns/build-columns.mjs +8 -48
- package/dist/client/views/collection/field-renderer.mjs +58 -182
- package/dist/client/views/collection/form-view.mjs +284 -518
- package/dist/client/views/collection/table-view.mjs +231 -463
- package/dist/client/views/collection/view-skeletons.mjs +112 -237
- package/dist/client/views/common/global-search.mjs +241 -560
- package/dist/client/views/dashboard/dashboard-grid.mjs +256 -775
- package/dist/client/views/dashboard/dashboard-widget.mjs +38 -126
- package/dist/client/views/dashboard/widget-card.mjs +61 -269
- package/dist/client/views/globals/global-form-view.mjs +477 -1301
- package/dist/client/views/layout/admin-layout-provider.mjs +28 -88
- package/dist/client/views/layout/admin-layout.mjs +83 -246
- package/dist/client/views/layout/admin-router.mjs +458 -1274
- package/dist/client/views/layout/admin-sidebar.mjs +510 -1292
- package/dist/client/views/layout/admin-theme.mjs +30 -64
- package/dist/client/views/layout/admin-view-layout.mjs +40 -144
- package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
- package/dist/client/views/pages/accept-invite-page.mjs +95 -290
- package/dist/client/views/pages/dashboard-page.d.mts +2 -2
- package/dist/client/views/pages/dashboard-page.mjs +11 -57
- package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
- package/dist/client/views/pages/forgot-password-page.mjs +31 -83
- package/dist/client/views/pages/invite-page.d.mts +2 -2
- package/dist/client/views/pages/invite-page.mjs +35 -90
- package/dist/client/views/pages/login-page.d.mts +2 -2
- package/dist/client/views/pages/login-page.mjs +41 -121
- package/dist/client/views/pages/reset-password-page.d.mts +2 -2
- package/dist/client/views/pages/reset-password-page.mjs +46 -173
- package/dist/client/views/pages/setup-page.d.mts +2 -2
- package/dist/client/views/pages/setup-page.mjs +33 -95
- package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
- package/dist/server/adapters/index.d.mts +2 -0
- package/dist/server/adapters/nextjs.d.mts +1 -0
- package/dist/server/auth-helpers.d.mts +1 -0
- package/dist/server/modules/admin/.generated/module.d.mts +1 -0
- package/dist/server/modules/admin/collections/account.d.mts +46 -46
- package/dist/server/modules/admin/collections/admin-locks.d.mts +50 -50
- package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
- package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
- package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
- package/dist/server/modules/admin/collections/assets.d.mts +39 -39
- package/dist/server/modules/admin/collections/session.d.mts +42 -42
- package/dist/server/modules/admin/collections/user.d.mts +62 -62
- package/dist/server/modules/admin/collections/verification.d.mts +23 -23
- package/dist/server/modules/admin/index.d.mts +20 -19
- package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
- package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
- package/dist/server/modules/admin/routes/locales.d.mts +2 -2
- package/dist/server/modules/admin/routes/preview.d.mts +11 -11
- package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
- package/dist/server/modules/admin/routes/setup.d.mts +7 -7
- package/dist/server/modules/admin/routes/translations.d.mts +4 -4
- package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +45 -45
- package/dist/server/modules/audit/.generated/module.d.mts +6 -6
- package/dist/server/modules/audit/collections/audit-log.d.mts +78 -78
- package/dist/server/modules/audit/jobs/audit-cleanup.d.mts +2 -2
- package/dist/server.d.mts +2 -0
- package/package.json +3 -5
|
@@ -44,7 +44,6 @@ import { useRealtimeHighlight } from "../../hooks/use-realtime-highlight.mjs";
|
|
|
44
44
|
import { useDeleteSavedView, useSaveView, useSavedViews } from "../../hooks/use-saved-views.mjs";
|
|
45
45
|
import { useViewState } from "../../hooks/use-view-state.mjs";
|
|
46
46
|
import { BulkActionToolbar } from "./bulk-action-toolbar.mjs";
|
|
47
|
-
import { c } from "react/compiler-runtime";
|
|
48
47
|
import { Icon } from "@iconify/react";
|
|
49
48
|
import * as React from "react";
|
|
50
49
|
import { Suspense, useMemo, useState } from "react";
|
|
@@ -70,64 +69,24 @@ const REORDER_DROP_ANIMATION = {
|
|
|
70
69
|
duration: REORDER_DROP_DURATION,
|
|
71
70
|
easing: REORDER_MOVE_EASING
|
|
72
71
|
};
|
|
73
|
-
function UploadCollectionButton(
|
|
74
|
-
const $ = c(13);
|
|
75
|
-
const { collection, onUploaded } = t0;
|
|
72
|
+
function UploadCollectionButton({ collection, onUploaded }) {
|
|
76
73
|
const { t } = useTranslation();
|
|
77
74
|
const [open, setOpen] = React.useState(false);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Button, {
|
|
76
|
+
variant: "default",
|
|
77
|
+
size: "sm",
|
|
78
|
+
className: "gap-2",
|
|
79
|
+
onClick: () => setOpen(true),
|
|
80
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
83
81
|
icon: "ph:cloud-arrow-up",
|
|
84
82
|
className: "size-3.5"
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
let t3;
|
|
93
|
-
if ($[2] !== t) {
|
|
94
|
-
t3 = t("common.upload");
|
|
95
|
-
$[2] = t;
|
|
96
|
-
$[3] = t3;
|
|
97
|
-
} else t3 = $[3];
|
|
98
|
-
let t4;
|
|
99
|
-
if ($[4] !== t3) {
|
|
100
|
-
t4 = /* @__PURE__ */ jsxs(Button, {
|
|
101
|
-
variant: "default",
|
|
102
|
-
size: "sm",
|
|
103
|
-
className: "gap-2",
|
|
104
|
-
onClick: t1,
|
|
105
|
-
children: [t2, t3]
|
|
106
|
-
});
|
|
107
|
-
$[4] = t3;
|
|
108
|
-
$[5] = t4;
|
|
109
|
-
} else t4 = $[5];
|
|
110
|
-
let t5;
|
|
111
|
-
if ($[6] !== collection || $[7] !== onUploaded || $[8] !== open) {
|
|
112
|
-
t5 = /* @__PURE__ */ jsx(UploadCollectionSheet, {
|
|
113
|
-
open,
|
|
114
|
-
onOpenChange: setOpen,
|
|
115
|
-
collection,
|
|
116
|
-
onUploaded
|
|
117
|
-
});
|
|
118
|
-
$[6] = collection;
|
|
119
|
-
$[7] = onUploaded;
|
|
120
|
-
$[8] = open;
|
|
121
|
-
$[9] = t5;
|
|
122
|
-
} else t5 = $[9];
|
|
123
|
-
let t6;
|
|
124
|
-
if ($[10] !== t4 || $[11] !== t5) {
|
|
125
|
-
t6 = /* @__PURE__ */ jsxs(Fragment, { children: [t4, t5] });
|
|
126
|
-
$[10] = t4;
|
|
127
|
-
$[11] = t5;
|
|
128
|
-
$[12] = t6;
|
|
129
|
-
} else t6 = $[12];
|
|
130
|
-
return t6;
|
|
83
|
+
}), t("common.upload")]
|
|
84
|
+
}), /* @__PURE__ */ jsx(UploadCollectionSheet, {
|
|
85
|
+
open,
|
|
86
|
+
onOpenChange: setOpen,
|
|
87
|
+
collection,
|
|
88
|
+
onUploaded
|
|
89
|
+
})] });
|
|
131
90
|
}
|
|
132
91
|
function UploadCollectionSheet({ open, onOpenChange, collection, onUploaded }) {
|
|
133
92
|
const { t } = useTranslation();
|
|
@@ -218,8 +177,8 @@ function UploadCollectionSheet({ open, onOpenChange, collection, onUploaded }) {
|
|
|
218
177
|
collection,
|
|
219
178
|
itemId: editAssetId,
|
|
220
179
|
open: !!editAssetId,
|
|
221
|
-
onOpenChange: (
|
|
222
|
-
if (!
|
|
180
|
+
onOpenChange: (nextOpen) => {
|
|
181
|
+
if (!nextOpen) setEditAssetId(null);
|
|
223
182
|
},
|
|
224
183
|
onSave: () => {
|
|
225
184
|
onUploaded?.();
|
|
@@ -328,247 +287,68 @@ function getGroupSortIndex(value, field) {
|
|
|
328
287
|
}
|
|
329
288
|
const ReorderRowContext = React.createContext(null);
|
|
330
289
|
function ReorderHandle() {
|
|
331
|
-
const $ = c(9);
|
|
332
290
|
const sortable = React.useContext(ReorderRowContext);
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
if ($[2] !== sortable?.listeners) {
|
|
342
|
-
t2 = sortable?.listeners ?? {};
|
|
343
|
-
$[2] = sortable?.listeners;
|
|
344
|
-
$[3] = t2;
|
|
345
|
-
} else t2 = $[3];
|
|
346
|
-
let t3;
|
|
347
|
-
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
348
|
-
t3 = /* @__PURE__ */ jsx(Icon, {
|
|
291
|
+
return /* @__PURE__ */ jsx("button", {
|
|
292
|
+
type: "button",
|
|
293
|
+
ref: sortable?.setActivatorNodeRef,
|
|
294
|
+
className: "text-muted-foreground/50 hover:text-muted-foreground focus-visible:ring-ring/40 flex h-8 w-full cursor-grab touch-none items-center justify-center rounded-md transition-colors select-none focus-visible:ring-2 focus-visible:outline-none active:cursor-grabbing",
|
|
295
|
+
"aria-label": "Drag to reorder",
|
|
296
|
+
...sortable?.attributes ?? {},
|
|
297
|
+
...sortable?.listeners ?? {},
|
|
298
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
349
299
|
icon: "ph:dots-six-vertical",
|
|
350
300
|
className: "size-3.5"
|
|
351
|
-
})
|
|
352
|
-
|
|
353
|
-
} else t3 = $[4];
|
|
354
|
-
let t4;
|
|
355
|
-
if ($[5] !== t0 || $[6] !== t1 || $[7] !== t2) {
|
|
356
|
-
t4 = /* @__PURE__ */ jsx("button", {
|
|
357
|
-
type: "button",
|
|
358
|
-
ref: t0,
|
|
359
|
-
className: "text-muted-foreground/50 hover:text-muted-foreground focus-visible:ring-ring/40 flex h-8 w-full cursor-grab touch-none items-center justify-center rounded-md transition-colors select-none focus-visible:ring-2 focus-visible:outline-none active:cursor-grabbing",
|
|
360
|
-
"aria-label": "Drag to reorder",
|
|
361
|
-
...t1,
|
|
362
|
-
...t2,
|
|
363
|
-
children: t3
|
|
364
|
-
});
|
|
365
|
-
$[5] = t0;
|
|
366
|
-
$[6] = t1;
|
|
367
|
-
$[7] = t2;
|
|
368
|
-
$[8] = t4;
|
|
369
|
-
} else t4 = $[8];
|
|
370
|
-
return t4;
|
|
301
|
+
})
|
|
302
|
+
});
|
|
371
303
|
}
|
|
372
|
-
function ReorderDragOverlay(
|
|
373
|
-
const $ = c(24);
|
|
374
|
-
const { row, columns, rect } = t0;
|
|
304
|
+
function ReorderDragOverlay({ row, columns, rect }) {
|
|
375
305
|
if (!row) return null;
|
|
376
|
-
|
|
377
|
-
let t2;
|
|
378
|
-
let t3;
|
|
379
|
-
let t4;
|
|
380
|
-
let t5;
|
|
381
|
-
if ($[0] !== columns || $[1] !== rect?.height || $[2] !== rect?.width || $[3] !== row) {
|
|
382
|
-
const cells = row.getVisibleCells?.() ?? [];
|
|
383
|
-
t4 = "bg-background text-foreground ring-border-strong pointer-events-none overflow-hidden rounded-md shadow-xl ring-1";
|
|
384
|
-
const t6$1 = rect?.width;
|
|
385
|
-
const t7$1 = rect?.height;
|
|
386
|
-
if ($[9] !== t6$1 || $[10] !== t7$1) {
|
|
387
|
-
t5 = {
|
|
388
|
-
width: t6$1,
|
|
389
|
-
height: t7$1
|
|
390
|
-
};
|
|
391
|
-
$[9] = t6$1;
|
|
392
|
-
$[10] = t7$1;
|
|
393
|
-
$[11] = t5;
|
|
394
|
-
} else t5 = $[11];
|
|
395
|
-
t1 = "grid h-full items-center";
|
|
396
|
-
let t8;
|
|
397
|
-
if ($[12] !== columns) {
|
|
398
|
-
t8 = columns.map(_temp3).join(" ");
|
|
399
|
-
$[12] = columns;
|
|
400
|
-
$[13] = t8;
|
|
401
|
-
} else t8 = $[13];
|
|
402
|
-
if ($[14] !== t8) {
|
|
403
|
-
t2 = { gridTemplateColumns: t8 };
|
|
404
|
-
$[14] = t8;
|
|
405
|
-
$[15] = t2;
|
|
406
|
-
} else t2 = $[15];
|
|
407
|
-
t3 = cells.map(_temp4);
|
|
408
|
-
$[0] = columns;
|
|
409
|
-
$[1] = rect?.height;
|
|
410
|
-
$[2] = rect?.width;
|
|
411
|
-
$[3] = row;
|
|
412
|
-
$[4] = t1;
|
|
413
|
-
$[5] = t2;
|
|
414
|
-
$[6] = t3;
|
|
415
|
-
$[7] = t4;
|
|
416
|
-
$[8] = t5;
|
|
417
|
-
} else {
|
|
418
|
-
t1 = $[4];
|
|
419
|
-
t2 = $[5];
|
|
420
|
-
t3 = $[6];
|
|
421
|
-
t4 = $[7];
|
|
422
|
-
t5 = $[8];
|
|
423
|
-
}
|
|
424
|
-
let t6;
|
|
425
|
-
if ($[16] !== t1 || $[17] !== t2 || $[18] !== t3) {
|
|
426
|
-
t6 = /* @__PURE__ */ jsx("div", {
|
|
427
|
-
className: t1,
|
|
428
|
-
style: t2,
|
|
429
|
-
children: t3
|
|
430
|
-
});
|
|
431
|
-
$[16] = t1;
|
|
432
|
-
$[17] = t2;
|
|
433
|
-
$[18] = t3;
|
|
434
|
-
$[19] = t6;
|
|
435
|
-
} else t6 = $[19];
|
|
436
|
-
let t7;
|
|
437
|
-
if ($[20] !== t4 || $[21] !== t5 || $[22] !== t6) {
|
|
438
|
-
t7 = /* @__PURE__ */ jsx("div", {
|
|
439
|
-
className: t4,
|
|
440
|
-
style: t5,
|
|
441
|
-
children: t6
|
|
442
|
-
});
|
|
443
|
-
$[20] = t4;
|
|
444
|
-
$[21] = t5;
|
|
445
|
-
$[22] = t6;
|
|
446
|
-
$[23] = t7;
|
|
447
|
-
} else t7 = $[23];
|
|
448
|
-
return t7;
|
|
449
|
-
}
|
|
450
|
-
function _temp4(cell, index) {
|
|
306
|
+
const cells = row.getVisibleCells?.() ?? [];
|
|
451
307
|
return /* @__PURE__ */ jsx("div", {
|
|
452
|
-
className:
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
308
|
+
className: "bg-background text-foreground ring-border-strong pointer-events-none overflow-hidden rounded-md shadow-xl ring-1",
|
|
309
|
+
style: {
|
|
310
|
+
width: rect?.width,
|
|
311
|
+
height: rect?.height
|
|
312
|
+
},
|
|
313
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
314
|
+
className: "grid h-full items-center",
|
|
315
|
+
style: { gridTemplateColumns: columns.map((column) => `${getColumnSize(column, 120)}px`).join(" ") },
|
|
316
|
+
children: cells.map((cell, index) => /* @__PURE__ */ jsx("div", {
|
|
317
|
+
className: cn("min-w-0 truncate px-3 py-1.5 text-sm whitespace-nowrap tabular-nums", index === 0 && "px-1.5 text-center"),
|
|
318
|
+
children: index === 0 ? /* @__PURE__ */ jsx(Icon, {
|
|
319
|
+
icon: "ph:dots-six-vertical",
|
|
320
|
+
className: "text-muted-foreground mx-auto size-3.5"
|
|
321
|
+
}) : flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
322
|
+
}, cell.id))
|
|
323
|
+
})
|
|
324
|
+
});
|
|
461
325
|
}
|
|
462
|
-
function SortableTableRow(
|
|
463
|
-
const
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
let id;
|
|
467
|
-
let props;
|
|
468
|
-
if ($[0] !== t0) {
|
|
469
|
-
({id, className, children, ...props} = t0);
|
|
470
|
-
$[0] = t0;
|
|
471
|
-
$[1] = children;
|
|
472
|
-
$[2] = className;
|
|
473
|
-
$[3] = id;
|
|
474
|
-
$[4] = props;
|
|
475
|
-
} else {
|
|
476
|
-
children = $[1];
|
|
477
|
-
className = $[2];
|
|
478
|
-
id = $[3];
|
|
479
|
-
props = $[4];
|
|
480
|
-
}
|
|
481
|
-
let t1;
|
|
482
|
-
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
483
|
-
t1 = {
|
|
326
|
+
function SortableTableRow({ id, className, children, ...props }) {
|
|
327
|
+
const { attributes, listeners, setNodeRef, setActivatorNodeRef, transform, transition, isDragging } = useSortable({
|
|
328
|
+
id,
|
|
329
|
+
transition: {
|
|
484
330
|
duration: REORDER_DROP_DURATION,
|
|
485
331
|
easing: REORDER_MOVE_EASING
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
transition:
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
$[8] = className;
|
|
504
|
-
$[9] = t3;
|
|
505
|
-
$[10] = t4;
|
|
506
|
-
} else t4 = $[10];
|
|
507
|
-
let t5;
|
|
508
|
-
if ($[11] !== isDragging || $[12] !== transform) {
|
|
509
|
-
t5 = isDragging ? void 0 : CSS.Transform.toString(transform);
|
|
510
|
-
$[11] = isDragging;
|
|
511
|
-
$[12] = transform;
|
|
512
|
-
$[13] = t5;
|
|
513
|
-
} else t5 = $[13];
|
|
514
|
-
const t6 = isDragging ? void 0 : transition;
|
|
515
|
-
let t7;
|
|
516
|
-
if ($[14] !== props.style) {
|
|
517
|
-
t7 = props.style ?? {};
|
|
518
|
-
$[14] = props.style;
|
|
519
|
-
$[15] = t7;
|
|
520
|
-
} else t7 = $[15];
|
|
521
|
-
let t8;
|
|
522
|
-
if ($[16] !== t5 || $[17] !== t6 || $[18] !== t7) {
|
|
523
|
-
t8 = {
|
|
524
|
-
transform: t5,
|
|
525
|
-
transition: t6,
|
|
526
|
-
...t7
|
|
527
|
-
};
|
|
528
|
-
$[16] = t5;
|
|
529
|
-
$[17] = t6;
|
|
530
|
-
$[18] = t7;
|
|
531
|
-
$[19] = t8;
|
|
532
|
-
} else t8 = $[19];
|
|
533
|
-
let t9;
|
|
534
|
-
if ($[20] !== attributes || $[21] !== listeners || $[22] !== setActivatorNodeRef) {
|
|
535
|
-
t9 = {
|
|
536
|
-
attributes,
|
|
537
|
-
listeners,
|
|
538
|
-
setActivatorNodeRef
|
|
539
|
-
};
|
|
540
|
-
$[20] = attributes;
|
|
541
|
-
$[21] = listeners;
|
|
542
|
-
$[22] = setActivatorNodeRef;
|
|
543
|
-
$[23] = t9;
|
|
544
|
-
} else t9 = $[23];
|
|
545
|
-
let t10;
|
|
546
|
-
if ($[24] !== children || $[25] !== t9) {
|
|
547
|
-
t10 = /* @__PURE__ */ jsx(ReorderRowContext.Provider, {
|
|
548
|
-
value: t9,
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
return /* @__PURE__ */ jsx(TableRow, {
|
|
335
|
+
ref: setNodeRef,
|
|
336
|
+
className: cn("select-none", isDragging && "bg-muted/[0.18] opacity-35", className),
|
|
337
|
+
style: {
|
|
338
|
+
transform: isDragging ? void 0 : CSS.Transform.toString(transform),
|
|
339
|
+
transition: isDragging ? void 0 : transition,
|
|
340
|
+
...props.style ?? {}
|
|
341
|
+
},
|
|
342
|
+
...props,
|
|
343
|
+
children: /* @__PURE__ */ jsx(ReorderRowContext.Provider, {
|
|
344
|
+
value: {
|
|
345
|
+
attributes,
|
|
346
|
+
listeners,
|
|
347
|
+
setActivatorNodeRef
|
|
348
|
+
},
|
|
549
349
|
children
|
|
550
|
-
})
|
|
551
|
-
|
|
552
|
-
$[25] = t9;
|
|
553
|
-
$[26] = t10;
|
|
554
|
-
} else t10 = $[26];
|
|
555
|
-
let t11;
|
|
556
|
-
if ($[27] !== props || $[28] !== setNodeRef || $[29] !== t10 || $[30] !== t4 || $[31] !== t8) {
|
|
557
|
-
t11 = /* @__PURE__ */ jsx(TableRow, {
|
|
558
|
-
ref: setNodeRef,
|
|
559
|
-
className: t4,
|
|
560
|
-
style: t8,
|
|
561
|
-
...props,
|
|
562
|
-
children: t10
|
|
563
|
-
});
|
|
564
|
-
$[27] = props;
|
|
565
|
-
$[28] = setNodeRef;
|
|
566
|
-
$[29] = t10;
|
|
567
|
-
$[30] = t4;
|
|
568
|
-
$[31] = t8;
|
|
569
|
-
$[32] = t11;
|
|
570
|
-
} else t11 = $[32];
|
|
571
|
-
return t11;
|
|
350
|
+
})
|
|
351
|
+
});
|
|
572
352
|
}
|
|
573
353
|
/**
|
|
574
354
|
* TableView - Default table-based list view for collections
|
|
@@ -597,22 +377,10 @@ function SortableTableRow(t0) {
|
|
|
597
377
|
* ```
|
|
598
378
|
*/
|
|
599
379
|
function TableView(props) {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
$[0] = t0;
|
|
605
|
-
} else t0 = $[0];
|
|
606
|
-
let t1;
|
|
607
|
-
if ($[1] !== props) {
|
|
608
|
-
t1 = /* @__PURE__ */ jsx(Suspense, {
|
|
609
|
-
fallback: t0,
|
|
610
|
-
children: /* @__PURE__ */ jsx(TableViewInner, { ...props })
|
|
611
|
-
});
|
|
612
|
-
$[1] = props;
|
|
613
|
-
$[2] = t1;
|
|
614
|
-
} else t1 = $[2];
|
|
615
|
-
return t1;
|
|
380
|
+
return /* @__PURE__ */ jsx(Suspense, {
|
|
381
|
+
fallback: /* @__PURE__ */ jsx(TableViewSkeleton, {}),
|
|
382
|
+
children: /* @__PURE__ */ jsx(TableViewInner, { ...props })
|
|
383
|
+
});
|
|
616
384
|
}
|
|
617
385
|
/**
|
|
618
386
|
* Inner component that uses Suspense queries.
|
|
@@ -744,41 +512,41 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
744
512
|
if (Array.isArray(val)) return val.length === 0;
|
|
745
513
|
return false;
|
|
746
514
|
};
|
|
747
|
-
const normalizeSelectValue = (
|
|
515
|
+
const normalizeSelectValue = (val, fieldOptions) => {
|
|
748
516
|
const optionsList = fieldOptions?.options;
|
|
749
|
-
if (!optionsList) return
|
|
517
|
+
if (!optionsList) return val;
|
|
750
518
|
const map = new Map(flattenOptions(optionsList).map((opt) => [String(opt.value), opt.value]));
|
|
751
519
|
const mapValue = (item) => map.get(String(item)) ?? item;
|
|
752
|
-
if (Array.isArray(
|
|
753
|
-
if (
|
|
754
|
-
return mapValue(
|
|
520
|
+
if (Array.isArray(val)) return val.map(mapValue);
|
|
521
|
+
if (val === void 0 || val === null) return val;
|
|
522
|
+
return mapValue(val);
|
|
755
523
|
};
|
|
756
|
-
const coerceValue = (
|
|
757
|
-
if (!fieldDef) return
|
|
524
|
+
const coerceValue = (val, fieldDef) => {
|
|
525
|
+
if (!fieldDef) return val;
|
|
758
526
|
const fieldType = fieldDef?.name ?? "text";
|
|
759
|
-
const
|
|
760
|
-
if (fieldType === "number" && typeof
|
|
761
|
-
const parsed = Number(
|
|
762
|
-
return Number.isNaN(parsed) ?
|
|
527
|
+
const fieldOptions = fieldDef?.["~options"] ?? {};
|
|
528
|
+
if (fieldType === "number" && typeof val === "string") {
|
|
529
|
+
const parsed = Number(val);
|
|
530
|
+
return Number.isNaN(parsed) ? val : parsed;
|
|
763
531
|
}
|
|
764
|
-
if ((fieldType === "checkbox" || fieldType === "switch") && typeof
|
|
765
|
-
if (
|
|
766
|
-
if (
|
|
532
|
+
if ((fieldType === "checkbox" || fieldType === "switch") && typeof val === "string") {
|
|
533
|
+
if (val === "true") return true;
|
|
534
|
+
if (val === "false") return false;
|
|
767
535
|
}
|
|
768
|
-
if (fieldType === "select") return normalizeSelectValue(
|
|
769
|
-
return
|
|
536
|
+
if (fieldType === "select") return normalizeSelectValue(val, fieldOptions);
|
|
537
|
+
return val;
|
|
770
538
|
};
|
|
771
|
-
const toArray = (
|
|
772
|
-
if (Array.isArray(
|
|
773
|
-
if (
|
|
774
|
-
return [
|
|
539
|
+
const toArray = (val) => {
|
|
540
|
+
if (Array.isArray(val)) return val;
|
|
541
|
+
if (val === void 0 || val === null || val === "") return [];
|
|
542
|
+
return [val];
|
|
775
543
|
};
|
|
776
|
-
const buildRelationCondition = (operator,
|
|
544
|
+
const buildRelationCondition = (operator, val, relationType) => {
|
|
777
545
|
const isMultiple = relationType === "multiple";
|
|
778
|
-
const ids = toArray(
|
|
546
|
+
const ids = toArray(val);
|
|
779
547
|
switch (operator) {
|
|
780
|
-
case "equals": return isMultiple ? { some: { id:
|
|
781
|
-
case "not_equals": return isMultiple ? { none: { id:
|
|
548
|
+
case "equals": return isMultiple ? { some: { id: val } } : { is: { id: val } };
|
|
549
|
+
case "not_equals": return isMultiple ? { none: { id: val } } : { isNot: { id: val } };
|
|
782
550
|
case "in": return isMultiple ? { some: { id: { in: ids } } } : { is: { id: { in: ids } } };
|
|
783
551
|
case "not_in": return isMultiple ? { none: { id: { in: ids } } } : { isNot: { id: { in: ids } } };
|
|
784
552
|
case "some": return { some: { id: { in: ids } } };
|
|
@@ -790,63 +558,63 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
790
558
|
}
|
|
791
559
|
};
|
|
792
560
|
for (const filter of viewState.config.filters) {
|
|
793
|
-
const { field
|
|
794
|
-
if (!
|
|
795
|
-
const
|
|
796
|
-
const
|
|
797
|
-
const
|
|
798
|
-
const relationName =
|
|
561
|
+
const { field, operator, value } = filter;
|
|
562
|
+
if (!field || field === "_title") continue;
|
|
563
|
+
const fieldDef = resolvedFields?.[field];
|
|
564
|
+
const fieldType = fieldDef?.name ?? "text";
|
|
565
|
+
const fieldOptions = fieldDef?.["~options"] ?? {};
|
|
566
|
+
const relationName = fieldType === "relation" ? fieldOptions.relationName ?? field : void 0;
|
|
799
567
|
const hasRelation = relationName && (relationNames.length === 0 || relationNames.includes(relationName));
|
|
800
|
-
const isRelationField =
|
|
801
|
-
if (
|
|
802
|
-
const normalizedValue = coerceValue(value,
|
|
568
|
+
const isRelationField = fieldType === "relation" && !!hasRelation;
|
|
569
|
+
if (operator !== "is_empty" && operator !== "is_not_empty" && isEmptyValue(value)) continue;
|
|
570
|
+
const normalizedValue = coerceValue(value, fieldDef);
|
|
803
571
|
if (isRelationField && relationName) {
|
|
804
|
-
const condition = buildRelationCondition(
|
|
572
|
+
const condition = buildRelationCondition(operator, normalizedValue, fieldOptions.type === "multiple" ? "multiple" : "single");
|
|
805
573
|
if (condition) whereConditions[relationName] = condition;
|
|
806
574
|
continue;
|
|
807
575
|
}
|
|
808
|
-
switch (
|
|
576
|
+
switch (operator) {
|
|
809
577
|
case "equals":
|
|
810
|
-
whereConditions[
|
|
578
|
+
whereConditions[field] = normalizedValue;
|
|
811
579
|
break;
|
|
812
580
|
case "not_equals":
|
|
813
|
-
whereConditions[
|
|
581
|
+
whereConditions[field] = { ne: normalizedValue };
|
|
814
582
|
break;
|
|
815
583
|
case "contains":
|
|
816
|
-
whereConditions[
|
|
584
|
+
whereConditions[field] = { contains: normalizedValue };
|
|
817
585
|
break;
|
|
818
586
|
case "not_contains":
|
|
819
|
-
whereConditions[
|
|
587
|
+
whereConditions[field] = { notIlike: `%${normalizedValue}%` };
|
|
820
588
|
break;
|
|
821
589
|
case "starts_with":
|
|
822
|
-
whereConditions[
|
|
590
|
+
whereConditions[field] = { startsWith: normalizedValue };
|
|
823
591
|
break;
|
|
824
592
|
case "ends_with":
|
|
825
|
-
whereConditions[
|
|
593
|
+
whereConditions[field] = { endsWith: normalizedValue };
|
|
826
594
|
break;
|
|
827
595
|
case "greater_than":
|
|
828
|
-
whereConditions[
|
|
596
|
+
whereConditions[field] = { gt: normalizedValue };
|
|
829
597
|
break;
|
|
830
598
|
case "less_than":
|
|
831
|
-
whereConditions[
|
|
599
|
+
whereConditions[field] = { lt: normalizedValue };
|
|
832
600
|
break;
|
|
833
601
|
case "greater_than_or_equal":
|
|
834
|
-
whereConditions[
|
|
602
|
+
whereConditions[field] = { gte: normalizedValue };
|
|
835
603
|
break;
|
|
836
604
|
case "less_than_or_equal":
|
|
837
|
-
whereConditions[
|
|
605
|
+
whereConditions[field] = { lte: normalizedValue };
|
|
838
606
|
break;
|
|
839
607
|
case "in":
|
|
840
|
-
whereConditions[
|
|
608
|
+
whereConditions[field] = { in: Array.isArray(normalizedValue) ? normalizedValue : [normalizedValue] };
|
|
841
609
|
break;
|
|
842
610
|
case "not_in":
|
|
843
|
-
whereConditions[
|
|
611
|
+
whereConditions[field] = { notIn: Array.isArray(normalizedValue) ? normalizedValue : [normalizedValue] };
|
|
844
612
|
break;
|
|
845
613
|
case "is_empty":
|
|
846
|
-
whereConditions[
|
|
614
|
+
whereConditions[field] = { isNull: true };
|
|
847
615
|
break;
|
|
848
616
|
case "is_not_empty":
|
|
849
|
-
whereConditions[
|
|
617
|
+
whereConditions[field] = { isNotNull: true };
|
|
850
618
|
break;
|
|
851
619
|
}
|
|
852
620
|
}
|
|
@@ -898,12 +666,12 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
898
666
|
const groupableNames = groupingConfig?.fields ?? [];
|
|
899
667
|
if (groupableNames.length === 0) return [];
|
|
900
668
|
const groupableSet = new Set(groupableNames);
|
|
901
|
-
return availableFields.filter((
|
|
669
|
+
return availableFields.filter((field) => groupableSet.has(field.name));
|
|
902
670
|
}, [availableFields, groupingConfig?.fields]);
|
|
903
671
|
const visibleColumnDefs = useMemo(() => {
|
|
904
672
|
const selectCol = {
|
|
905
673
|
id: "_select",
|
|
906
|
-
header: ({ table:
|
|
674
|
+
header: ({ table: t$1 }) => {
|
|
907
675
|
if (isReorderMode) return /* @__PURE__ */ jsx("div", {
|
|
908
676
|
className: "text-muted-foreground/60 flex h-8 items-center justify-center",
|
|
909
677
|
title: "Order",
|
|
@@ -913,16 +681,16 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
913
681
|
className: "size-3.5"
|
|
914
682
|
})
|
|
915
683
|
});
|
|
916
|
-
const isAllSelected =
|
|
917
|
-
const isSomeSelected =
|
|
684
|
+
const isAllSelected = t$1.getIsAllPageRowsSelected();
|
|
685
|
+
const isSomeSelected = t$1.getIsSomePageRowsSelected();
|
|
918
686
|
return /* @__PURE__ */ jsx("div", {
|
|
919
687
|
role: "presentation",
|
|
920
688
|
onClick: (e) => e.stopPropagation(),
|
|
921
|
-
onKeyDown: (
|
|
689
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
922
690
|
children: /* @__PURE__ */ jsx(Checkbox, {
|
|
923
691
|
checked: isAllSelected,
|
|
924
692
|
indeterminate: !isAllSelected && isSomeSelected,
|
|
925
|
-
onCheckedChange: (checked) =>
|
|
693
|
+
onCheckedChange: (checked) => t$1.toggleAllPageRowsSelected(!!checked),
|
|
926
694
|
"aria-label": "Select all"
|
|
927
695
|
})
|
|
928
696
|
});
|
|
@@ -931,12 +699,12 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
931
699
|
if (isReorderMode) return /* @__PURE__ */ jsx(ReorderHandle, {});
|
|
932
700
|
return /* @__PURE__ */ jsx("div", {
|
|
933
701
|
role: "presentation",
|
|
934
|
-
onClick: (
|
|
935
|
-
onKeyDown: (
|
|
702
|
+
onClick: (e) => e.stopPropagation(),
|
|
703
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
936
704
|
children: /* @__PURE__ */ jsx(Checkbox, {
|
|
937
705
|
checked: row.getIsSelected(),
|
|
938
706
|
disabled: !row.getCanSelect(),
|
|
939
|
-
onCheckedChange: (
|
|
707
|
+
onCheckedChange: (checked) => row.toggleSelected(!!checked),
|
|
940
708
|
"aria-label": "Select row"
|
|
941
709
|
})
|
|
942
710
|
});
|
|
@@ -948,13 +716,13 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
948
716
|
const titleFieldName = collectionMeta?.title?.fieldName;
|
|
949
717
|
const titleColName = collectionMeta?.title?.type === "field" && titleFieldName ? titleFieldName : "_title";
|
|
950
718
|
const orderedColumns = [selectCol];
|
|
951
|
-
const titleCol = columns.find((c
|
|
719
|
+
const titleCol = columns.find((c) => c.accessorKey === titleColName || c.id === titleColName);
|
|
952
720
|
if (titleCol) orderedColumns.push(titleCol);
|
|
953
|
-
const columnsToShow = viewState.config.visibleColumns.length > 0 ? viewState.config.visibleColumns : defaultColumns.length > 0 ? defaultColumns : columns.map((
|
|
721
|
+
const columnsToShow = viewState.config.visibleColumns.length > 0 ? viewState.config.visibleColumns : defaultColumns.length > 0 ? defaultColumns : columns.map((c) => c.accessorKey || c.id).filter(Boolean);
|
|
954
722
|
const columnMap = /* @__PURE__ */ new Map();
|
|
955
|
-
for (const
|
|
956
|
-
const key =
|
|
957
|
-
if (key) columnMap.set(key,
|
|
723
|
+
for (const c of columns) {
|
|
724
|
+
const key = c.accessorKey || c.id;
|
|
725
|
+
if (key) columnMap.set(key, c);
|
|
958
726
|
}
|
|
959
727
|
for (const colName of columnsToShow) {
|
|
960
728
|
if (colName === titleColName) continue;
|
|
@@ -967,19 +735,19 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
967
735
|
className: "sr-only",
|
|
968
736
|
children: t("common.actions")
|
|
969
737
|
}),
|
|
970
|
-
cell: ({ row
|
|
738
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("div", {
|
|
971
739
|
role: "presentation",
|
|
972
740
|
className: "flex justify-end gap-1",
|
|
973
741
|
onClick: (event) => event.stopPropagation(),
|
|
974
|
-
onKeyDown: (
|
|
742
|
+
onKeyDown: (event) => event.stopPropagation(),
|
|
975
743
|
children: actions.row.map((action) => /* @__PURE__ */ jsx(ActionButton, {
|
|
976
744
|
action,
|
|
977
745
|
collection,
|
|
978
|
-
item:
|
|
746
|
+
item: row.original,
|
|
979
747
|
helpers: actionHelpers,
|
|
980
748
|
size: "icon-sm",
|
|
981
749
|
iconOnly: true,
|
|
982
|
-
onOpenDialog: (
|
|
750
|
+
onOpenDialog: (dialogAction$1) => openDialog(dialogAction$1, row.original)
|
|
983
751
|
}, action.id))
|
|
984
752
|
}),
|
|
985
753
|
size: 72,
|
|
@@ -1037,26 +805,26 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
1037
805
|
return;
|
|
1038
806
|
}
|
|
1039
807
|
setOptimisticOrderIds((current) => {
|
|
1040
|
-
const itemIds = items.map((
|
|
808
|
+
const itemIds = items.map((item) => String(item.id));
|
|
1041
809
|
if (!current) return itemIds;
|
|
1042
810
|
const knownIds = new Set(itemIds);
|
|
1043
811
|
const next = current.filter((id) => knownIds.has(id));
|
|
1044
|
-
for (const
|
|
812
|
+
for (const id of itemIds) if (!next.includes(id)) next.push(id);
|
|
1045
813
|
return next;
|
|
1046
814
|
});
|
|
1047
815
|
}, [isReorderMode, items]);
|
|
1048
816
|
const filteredItems = useMemo(() => {
|
|
1049
817
|
if (!isReorderMode || !optimisticOrderIds) return items;
|
|
1050
|
-
const itemsById = new Map(items.map((
|
|
818
|
+
const itemsById = new Map(items.map((item) => [String(item.id), item]));
|
|
1051
819
|
const seen = /* @__PURE__ */ new Set();
|
|
1052
|
-
const ordered = optimisticOrderIds.map((
|
|
1053
|
-
const
|
|
1054
|
-
if (
|
|
1055
|
-
return
|
|
820
|
+
const ordered = optimisticOrderIds.map((id) => {
|
|
821
|
+
const item = itemsById.get(id);
|
|
822
|
+
if (item) seen.add(id);
|
|
823
|
+
return item;
|
|
1056
824
|
}).filter(Boolean);
|
|
1057
|
-
for (const
|
|
1058
|
-
const
|
|
1059
|
-
if (!seen.has(
|
|
825
|
+
for (const item of items) {
|
|
826
|
+
const id = String(item.id);
|
|
827
|
+
if (!seen.has(id)) ordered.push(item);
|
|
1060
828
|
}
|
|
1061
829
|
return ordered;
|
|
1062
830
|
}, [
|
|
@@ -1111,7 +879,7 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
1111
879
|
onSortingChange: handleSortingChange,
|
|
1112
880
|
enableRowSelection: true,
|
|
1113
881
|
onRowSelectionChange: setRowSelection,
|
|
1114
|
-
getRowId: (
|
|
882
|
+
getRowId: (row) => row.id,
|
|
1115
883
|
state: {
|
|
1116
884
|
sorting,
|
|
1117
885
|
rowSelection
|
|
@@ -1121,31 +889,31 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
1121
889
|
const visibleLeafColumns = table.getVisibleLeafColumns();
|
|
1122
890
|
const selectColumnWidth = getColumnSize(visibleLeafColumns[0], 40);
|
|
1123
891
|
const titleColumnWidth = getColumnSize(visibleLeafColumns[1], 360);
|
|
1124
|
-
const sortableRowIds = useMemo(() => tableRows.map((
|
|
1125
|
-
const activeReorderRow = useMemo(() => activeReorderId ? tableRows.find((
|
|
892
|
+
const sortableRowIds = useMemo(() => tableRows.map((row) => String(row.id)), [tableRows]);
|
|
893
|
+
const activeReorderRow = useMemo(() => activeReorderId ? tableRows.find((row) => String(row.id) === activeReorderId) : null, [activeReorderId, tableRows]);
|
|
1126
894
|
const reorderSensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 4 } }), useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }));
|
|
1127
|
-
const handleReorderDragStart = React.useCallback((
|
|
1128
|
-
const initialRect =
|
|
895
|
+
const handleReorderDragStart = React.useCallback((event) => {
|
|
896
|
+
const initialRect = event.active.rect.current.initial;
|
|
1129
897
|
clearReorderOverlay();
|
|
1130
898
|
reorderStartOrderIdsRef.current = sortableRowIds;
|
|
1131
|
-
setActiveReorderId(String(
|
|
899
|
+
setActiveReorderId(String(event.active.id));
|
|
1132
900
|
setActiveReorderRect(initialRect ? {
|
|
1133
901
|
width: initialRect.width,
|
|
1134
902
|
height: initialRect.height
|
|
1135
903
|
} : null);
|
|
1136
|
-
setOptimisticOrderIds((
|
|
904
|
+
setOptimisticOrderIds((current) => current ?? sortableRowIds);
|
|
1137
905
|
}, [clearReorderOverlay, sortableRowIds]);
|
|
1138
906
|
const handleReorderDragCancel = React.useCallback(() => {
|
|
1139
907
|
setOptimisticOrderIds(reorderStartOrderIdsRef.current);
|
|
1140
908
|
clearReorderOverlay();
|
|
1141
909
|
reorderStartOrderIdsRef.current = null;
|
|
1142
910
|
}, [clearReorderOverlay]);
|
|
1143
|
-
const handleReorderDragEnd = React.useCallback(async (
|
|
911
|
+
const handleReorderDragEnd = React.useCallback(async (event) => {
|
|
1144
912
|
if (updateBatchMutation.isPending) {
|
|
1145
913
|
clearReorderOverlay();
|
|
1146
914
|
return;
|
|
1147
915
|
}
|
|
1148
|
-
const { active
|
|
916
|
+
const { active, over } = event;
|
|
1149
917
|
const previousOrderIds = reorderStartOrderIdsRef.current ?? sortableRowIds;
|
|
1150
918
|
reorderStartOrderIdsRef.current = null;
|
|
1151
919
|
if (!over) {
|
|
@@ -1154,8 +922,8 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
1154
922
|
return;
|
|
1155
923
|
}
|
|
1156
924
|
let nextOrderIds = previousOrderIds;
|
|
1157
|
-
if (
|
|
1158
|
-
const oldIndex = previousOrderIds.indexOf(String(
|
|
925
|
+
if (active.id !== over.id) {
|
|
926
|
+
const oldIndex = previousOrderIds.indexOf(String(active.id));
|
|
1159
927
|
const newIndex = previousOrderIds.indexOf(String(over.id));
|
|
1160
928
|
if (oldIndex === -1 || newIndex === -1 || oldIndex === newIndex) {
|
|
1161
929
|
clearReorderOverlay(REORDER_DROP_DURATION);
|
|
@@ -1169,11 +937,11 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
1169
937
|
}
|
|
1170
938
|
setOptimisticOrderIds(nextOrderIds);
|
|
1171
939
|
clearReorderOverlay(REORDER_DROP_DURATION);
|
|
1172
|
-
const rowsById = new Map(tableRows.map((
|
|
1173
|
-
const reorderedRows = nextOrderIds.map((
|
|
940
|
+
const rowsById = new Map(tableRows.map((row) => [String(row.id), row]));
|
|
941
|
+
const reorderedRows = nextOrderIds.map((id) => rowsById.get(id)).filter((row) => !!row);
|
|
1174
942
|
try {
|
|
1175
|
-
await updateBatchMutation.mutateAsync({ updates: reorderedRows.map((
|
|
1176
|
-
id: String(
|
|
943
|
+
await updateBatchMutation.mutateAsync({ updates: reorderedRows.map((row, index) => ({
|
|
944
|
+
id: String(row.id),
|
|
1177
945
|
data: { [orderField]: (index + 1) * orderStep }
|
|
1178
946
|
})) });
|
|
1179
947
|
actionHelpers.toast.success(t("collection.orderSaved"));
|
|
@@ -1194,59 +962,59 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
1194
962
|
]);
|
|
1195
963
|
const groupedRowModel = useMemo(() => {
|
|
1196
964
|
const rows = tableRows;
|
|
1197
|
-
const
|
|
1198
|
-
if (!
|
|
965
|
+
const groupBy = viewState.config.groupBy;
|
|
966
|
+
if (!groupBy) return rows.map((row) => ({
|
|
1199
967
|
type: "row",
|
|
1200
|
-
row
|
|
968
|
+
row
|
|
1201
969
|
}));
|
|
1202
|
-
const groupField = groupableFields.find((
|
|
970
|
+
const groupField = groupableFields.find((field) => field.name === groupBy);
|
|
1203
971
|
const collapsedGroups = new Set(viewState.config.collapsedGroups ?? []);
|
|
1204
972
|
const serverGroups = !isSearching ? listData?.groups : void 0;
|
|
1205
973
|
if (serverGroups?.length) {
|
|
1206
|
-
const
|
|
974
|
+
const rowsById = new Map(rows.map((row) => [row.id, row]));
|
|
1207
975
|
return serverGroups.flatMap((group) => {
|
|
1208
976
|
const label = stringifyGroupValue(group.value, groupField, resolveText, t, uiLocale, t("common.noValue"));
|
|
1209
|
-
const groupKey = `${
|
|
977
|
+
const groupKey = `${groupBy}:${label}`;
|
|
1210
978
|
const collapsed = collapsedGroups.has(groupKey);
|
|
1211
|
-
const groupRows = (group.docs ?? []).map((doc) =>
|
|
979
|
+
const groupRows = (group.docs ?? []).map((doc) => rowsById.get(String(doc.id))).filter(Boolean);
|
|
1212
980
|
return [{
|
|
1213
981
|
type: "group",
|
|
1214
982
|
key: groupKey,
|
|
1215
983
|
label,
|
|
1216
984
|
count: group.count,
|
|
1217
985
|
collapsed
|
|
1218
|
-
}, ...collapsed ? [] : groupRows.map((
|
|
986
|
+
}, ...collapsed ? [] : groupRows.map((row) => ({
|
|
1219
987
|
type: "row",
|
|
1220
|
-
row
|
|
988
|
+
row
|
|
1221
989
|
}))];
|
|
1222
990
|
});
|
|
1223
991
|
}
|
|
1224
992
|
const groups = /* @__PURE__ */ new Map();
|
|
1225
|
-
for (const
|
|
1226
|
-
const valueLabel = stringifyGroupValue(
|
|
1227
|
-
const
|
|
1228
|
-
const
|
|
1229
|
-
if (
|
|
1230
|
-
|
|
993
|
+
for (const row of rows) {
|
|
994
|
+
const valueLabel = stringifyGroupValue(row.original?.[groupBy], groupField, resolveText, t, uiLocale, t("common.noValue"));
|
|
995
|
+
const groupKey = `${groupBy}:${valueLabel}`;
|
|
996
|
+
const group = groups.get(groupKey);
|
|
997
|
+
if (group) {
|
|
998
|
+
group.rows.push(row);
|
|
1231
999
|
continue;
|
|
1232
1000
|
}
|
|
1233
|
-
groups.set(
|
|
1001
|
+
groups.set(groupKey, {
|
|
1234
1002
|
label: valueLabel,
|
|
1235
|
-
rows: [
|
|
1236
|
-
sortIndex: getGroupSortIndex(
|
|
1003
|
+
rows: [row],
|
|
1004
|
+
sortIndex: getGroupSortIndex(row.original?.[groupBy], groupField)
|
|
1237
1005
|
});
|
|
1238
1006
|
}
|
|
1239
|
-
return Array.from(groups.entries()).sort(([, a], [, b]) => a.sortIndex - b.sortIndex).flatMap(([
|
|
1240
|
-
const
|
|
1007
|
+
return Array.from(groups.entries()).sort(([, a], [, b]) => a.sortIndex - b.sortIndex).flatMap(([key, group]) => {
|
|
1008
|
+
const collapsed = collapsedGroups.has(key);
|
|
1241
1009
|
return [{
|
|
1242
1010
|
type: "group",
|
|
1243
|
-
key
|
|
1244
|
-
label:
|
|
1245
|
-
count:
|
|
1246
|
-
collapsed
|
|
1247
|
-
}, ...
|
|
1011
|
+
key,
|
|
1012
|
+
label: group.label,
|
|
1013
|
+
count: group.rows.length,
|
|
1014
|
+
collapsed
|
|
1015
|
+
}, ...collapsed ? [] : group.rows.map((row) => ({
|
|
1248
1016
|
type: "row",
|
|
1249
|
-
row
|
|
1017
|
+
row
|
|
1250
1018
|
}))];
|
|
1251
1019
|
});
|
|
1252
1020
|
}, [
|
|
@@ -1260,22 +1028,22 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
1260
1028
|
t,
|
|
1261
1029
|
uiLocale
|
|
1262
1030
|
]);
|
|
1263
|
-
const handleSaveView = (name,
|
|
1031
|
+
const handleSaveView = (name, config$1) => {
|
|
1264
1032
|
saveViewMutation.mutate({
|
|
1265
1033
|
name,
|
|
1266
|
-
configuration:
|
|
1034
|
+
configuration: config$1
|
|
1267
1035
|
});
|
|
1268
1036
|
};
|
|
1269
1037
|
const handleDeleteView = (viewId) => {
|
|
1270
1038
|
deleteViewMutation.mutate(viewId);
|
|
1271
1039
|
};
|
|
1272
|
-
const handleRowClick = (
|
|
1273
|
-
navigate(`${basePath}/collections/${collection}/${
|
|
1040
|
+
const handleRowClick = (item) => {
|
|
1041
|
+
navigate(`${basePath}/collections/${collection}/${item.id}`);
|
|
1274
1042
|
};
|
|
1275
|
-
const handleBulkDelete = React.useCallback(async (
|
|
1276
|
-
const results = await Promise.allSettled(
|
|
1043
|
+
const handleBulkDelete = React.useCallback(async (ids) => {
|
|
1044
|
+
const results = await Promise.allSettled(ids.map((id) => deleteMutation.mutateAsync({ id })));
|
|
1277
1045
|
const successCount = results.filter((r) => r.status === "fulfilled").length;
|
|
1278
|
-
const failCount = results.filter((
|
|
1046
|
+
const failCount = results.filter((r) => r.status === "rejected").length;
|
|
1279
1047
|
if (failCount === 0) actionHelpers.toast.success(t("collection.bulkDeleteSuccess", { count: successCount }));
|
|
1280
1048
|
else if (successCount === 0) actionHelpers.toast.error(t("collection.bulkDeleteError"));
|
|
1281
1049
|
else actionHelpers.toast.warning(t("collection.bulkDeletePartial", {
|
|
@@ -1287,15 +1055,15 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
1287
1055
|
actionHelpers,
|
|
1288
1056
|
t
|
|
1289
1057
|
]);
|
|
1290
|
-
const handleBulkRestore = React.useCallback(async (
|
|
1291
|
-
const
|
|
1292
|
-
const
|
|
1293
|
-
const
|
|
1294
|
-
if (
|
|
1295
|
-
else if (
|
|
1058
|
+
const handleBulkRestore = React.useCallback(async (ids) => {
|
|
1059
|
+
const results = await Promise.allSettled(ids.map((id) => restoreMutation.mutateAsync({ id })));
|
|
1060
|
+
const successCount = results.filter((r) => r.status === "fulfilled").length;
|
|
1061
|
+
const failCount = results.filter((r) => r.status === "rejected").length;
|
|
1062
|
+
if (failCount === 0) actionHelpers.toast.success(t("collection.bulkRestoreSuccess", { count: successCount }));
|
|
1063
|
+
else if (successCount === 0) actionHelpers.toast.error(t("collection.bulkRestoreError"));
|
|
1296
1064
|
else actionHelpers.toast.warning(t("collection.bulkRestorePartial", {
|
|
1297
|
-
success:
|
|
1298
|
-
failed:
|
|
1065
|
+
success: successCount,
|
|
1066
|
+
failed: failCount
|
|
1299
1067
|
}));
|
|
1300
1068
|
}, [
|
|
1301
1069
|
restoreMutation,
|
|
@@ -1404,7 +1172,7 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
1404
1172
|
actions: actions.header,
|
|
1405
1173
|
collection,
|
|
1406
1174
|
helpers: actionHelpers,
|
|
1407
|
-
onOpenDialog: (
|
|
1175
|
+
onOpenDialog: (action) => openDialog(action)
|
|
1408
1176
|
})
|
|
1409
1177
|
] })
|
|
1410
1178
|
}),
|
|
@@ -1416,7 +1184,7 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
1416
1184
|
className: "max-w-xl",
|
|
1417
1185
|
children: /* @__PURE__ */ jsx(SearchInput, {
|
|
1418
1186
|
value: searchTerm,
|
|
1419
|
-
onChange: (
|
|
1187
|
+
onChange: (e) => setSearchTerm(e.target.value),
|
|
1420
1188
|
onClear: () => setSearchTerm(""),
|
|
1421
1189
|
placeholder: t("common.search"),
|
|
1422
1190
|
containerClassName: "h-10"
|
|
@@ -1460,7 +1228,7 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
1460
1228
|
helpers: actionHelpers,
|
|
1461
1229
|
totalCount: isSearching ? searchData?.total : listData?.totalDocs,
|
|
1462
1230
|
pageCount: filteredItems.length,
|
|
1463
|
-
onOpenDialog: (
|
|
1231
|
+
onOpenDialog: (action, items$1) => openDialog(action, items$1),
|
|
1464
1232
|
onBulkDelete: handleBulkDelete,
|
|
1465
1233
|
onBulkRestore: handleBulkRestore,
|
|
1466
1234
|
filterCount: viewState.config.filters.length,
|
|
@@ -1551,28 +1319,28 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
1551
1319
|
})
|
|
1552
1320
|
]
|
|
1553
1321
|
}, entry.key);
|
|
1554
|
-
const
|
|
1555
|
-
const isRowDeleted = !!
|
|
1322
|
+
const row = entry.row;
|
|
1323
|
+
const isRowDeleted = !!row.original?.deletedAt;
|
|
1556
1324
|
return /* @__PURE__ */ jsx(isReorderMode ? SortableTableRow : TableRow, {
|
|
1557
|
-
id: String(
|
|
1558
|
-
"data-state":
|
|
1559
|
-
className: cn("group", isReorderMode && "bg-muted/[0.18]", isHighlighted(
|
|
1560
|
-
children:
|
|
1561
|
-
const
|
|
1562
|
-
const
|
|
1563
|
-
const
|
|
1325
|
+
id: String(row.id),
|
|
1326
|
+
"data-state": row.getIsSelected() && "selected",
|
|
1327
|
+
className: cn("group", isReorderMode && "bg-muted/[0.18]", isHighlighted(row.id) && "animate-realtime-pulse", isRowDeleted && "opacity-50"),
|
|
1328
|
+
children: row.getVisibleCells().map((cell, cellIndex) => {
|
|
1329
|
+
const isCheckboxCol = cellIndex === 0;
|
|
1330
|
+
const columnWidth = getColumnSize(cell.column, isCheckboxCol ? 40 : 120);
|
|
1331
|
+
const stickyLeft = cellIndex < STICKY_TABLE_COLUMN_COUNT ? getStickyLeftOffset(visibleLeafColumns, cellIndex) : void 0;
|
|
1564
1332
|
const isTitleCol = cellIndex === 1;
|
|
1565
1333
|
return /* @__PURE__ */ jsx(TableCell, {
|
|
1566
|
-
stickyLeft
|
|
1334
|
+
stickyLeft,
|
|
1567
1335
|
showStickyBorder: cellIndex === STICKY_TABLE_COLUMN_COUNT - 1,
|
|
1568
|
-
className:
|
|
1569
|
-
style: getColumnSizeStyle(
|
|
1336
|
+
className: isCheckboxCol ? "w-9 min-w-9 px-1.5" : void 0,
|
|
1337
|
+
style: getColumnSizeStyle(columnWidth),
|
|
1570
1338
|
children: isTitleCol ? /* @__PURE__ */ jsxs("div", {
|
|
1571
1339
|
className: "flex min-w-0 items-center gap-2",
|
|
1572
1340
|
children: [
|
|
1573
1341
|
/* @__PURE__ */ jsx("button", {
|
|
1574
1342
|
type: "button",
|
|
1575
|
-
onClick: () => handleRowClick(
|
|
1343
|
+
onClick: () => handleRowClick(row.original),
|
|
1576
1344
|
disabled: isReorderMode,
|
|
1577
1345
|
className: cn("decoration-muted-foreground/50 hover:decoration-foreground max-w-full min-w-0 text-left underline underline-offset-2 transition-colors disabled:cursor-default disabled:no-underline", !isReorderMode && "cursor-pointer"),
|
|
1578
1346
|
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
@@ -1584,14 +1352,14 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
1584
1352
|
className: "size-3"
|
|
1585
1353
|
}), t("common.deleted")]
|
|
1586
1354
|
}),
|
|
1587
|
-
isDocLocked(
|
|
1588
|
-
const lock = getLock(
|
|
1589
|
-
const
|
|
1355
|
+
isDocLocked(row.id) && (() => {
|
|
1356
|
+
const lock = getLock(row.id);
|
|
1357
|
+
const user$1 = lock ? getLockUser(lock) : null;
|
|
1590
1358
|
return /* @__PURE__ */ jsxs("span", {
|
|
1591
1359
|
className: "text-muted-foreground bg-muted inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-xs",
|
|
1592
|
-
title:
|
|
1593
|
-
children: [
|
|
1594
|
-
src:
|
|
1360
|
+
title: user$1?.name ?? user$1?.email ?? "Someone is editing",
|
|
1361
|
+
children: [user$1?.image ? /* @__PURE__ */ jsx("img", {
|
|
1362
|
+
src: user$1.image,
|
|
1595
1363
|
alt: "",
|
|
1596
1364
|
className: "image-outline size-4 rounded-full"
|
|
1597
1365
|
}) : /* @__PURE__ */ jsx(Icon, {
|
|
@@ -1599,7 +1367,7 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
1599
1367
|
className: "size-3"
|
|
1600
1368
|
}), /* @__PURE__ */ jsx("span", {
|
|
1601
1369
|
className: "max-w-20 truncate",
|
|
1602
|
-
children:
|
|
1370
|
+
children: user$1?.name?.split(" ")[0] ?? t("table.editing")
|
|
1603
1371
|
})]
|
|
1604
1372
|
});
|
|
1605
1373
|
})()
|
|
@@ -1607,7 +1375,7 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
1607
1375
|
}) : flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
1608
1376
|
}, cell.id);
|
|
1609
1377
|
})
|
|
1610
|
-
},
|
|
1378
|
+
}, row.id);
|
|
1611
1379
|
}) })
|
|
1612
1380
|
})
|
|
1613
1381
|
]
|
|
@@ -1651,7 +1419,7 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
1651
1419
|
children: t("table.show")
|
|
1652
1420
|
}), /* @__PURE__ */ jsxs(Select, {
|
|
1653
1421
|
value: String(viewState.config.pagination?.pageSize ?? 25),
|
|
1654
|
-
onValueChange: (
|
|
1422
|
+
onValueChange: (value) => viewState.setPageSize(Number(value)),
|
|
1655
1423
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
1656
1424
|
className: "h-8 w-[70px]",
|
|
1657
1425
|
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
@@ -1757,7 +1525,7 @@ function TableViewInner({ collection, config, viewConfig, navigate, basePath = "
|
|
|
1757
1525
|
}),
|
|
1758
1526
|
dialogAction && /* @__PURE__ */ jsx(ActionDialog, {
|
|
1759
1527
|
open: !!dialogAction,
|
|
1760
|
-
onOpenChange: (
|
|
1528
|
+
onOpenChange: (open) => !open && closeDialog(),
|
|
1761
1529
|
action: dialogAction,
|
|
1762
1530
|
collection,
|
|
1763
1531
|
item: dialogItem,
|