@questpie/admin 3.0.2 → 3.0.4
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/README.md +34 -5
- package/dist/client/blocks/block-renderer.d.mts +2 -2
- package/dist/client/blocks/block-renderer.mjs +4 -1
- package/dist/client/builder/types/action-types.d.mts +31 -3
- package/dist/client/builder/types/collection-types.d.mts +140 -0
- package/dist/client/builder/types/ui-config.d.mts +16 -2
- package/dist/client/builder/types/views.d.mts +57 -0
- package/dist/client/builder/types/widget-types.d.mts +5 -0
- package/dist/client/components/actions/action-button.mjs +137 -199
- package/dist/client/components/actions/action-dialog.mjs +198 -156
- package/dist/client/components/actions/confirmation-dialog.mjs +2 -2
- package/dist/client/components/actions/header-actions.mjs +52 -53
- package/dist/client/components/admin-link.d.mts +2 -2
- package/dist/client/components/auth/auth-loading.mjs +41 -18
- package/dist/client/components/blocks/block-fields-renderer.mjs +64 -28
- package/dist/client/components/blocks/block-insert-button.mjs +4 -4
- package/dist/client/components/blocks/block-item.mjs +2 -2
- package/dist/client/components/blocks/block-library-sidebar.mjs +2 -2
- package/dist/client/components/component-renderer.mjs +1 -1
- package/dist/client/components/fields/array-field.mjs +14 -14
- package/dist/client/components/fields/asset-preview-field.mjs +1 -1
- package/dist/client/components/fields/blocks-field/blocks-field.mjs +84 -104
- package/dist/client/components/fields/json-field.mjs +2 -2
- package/dist/client/components/fields/object-array-field.mjs +22 -22
- package/dist/client/components/fields/object-field.mjs +5 -5
- package/dist/client/components/fields/relation/displays/cards-display.mjs +16 -9
- package/dist/client/components/fields/relation/displays/chips-display.mjs +15 -12
- package/dist/client/components/fields/relation/displays/grid-display.mjs +15 -11
- package/dist/client/components/fields/relation/displays/list-display.mjs +33 -20
- package/dist/client/components/fields/relation/displays/table-display.mjs +62 -93
- package/dist/client/components/fields/relation/relation-items-display.mjs +1 -1
- package/dist/client/components/fields/relation-picker.mjs +7 -6
- package/dist/client/components/fields/relation-select.mjs +71 -47
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +392 -82
- package/dist/client/components/fields/rich-text-editor/extensions.mjs +54 -23
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +24 -50
- package/dist/client/components/fields/rich-text-editor/image-upload.mjs +66 -0
- package/dist/client/components/fields/rich-text-editor/index.d.mts +38 -0
- package/dist/client/components/fields/rich-text-editor/index.mjs +637 -376
- package/dist/client/components/fields/rich-text-editor/link-utils.mjs +26 -0
- package/dist/client/components/fields/rich-text-editor/presets.d.mts +10 -0
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +27 -6
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs +464 -346
- package/dist/client/components/fields/rich-text-editor/types.d.mts +77 -0
- package/dist/client/components/fields/upload-field.mjs +45 -49
- package/dist/client/components/filter-builder/columns-tab.mjs +69 -62
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs +473 -308
- package/dist/client/components/filter-builder/filters-tab.mjs +109 -82
- package/dist/client/components/filter-builder/saved-views-tab.mjs +300 -198
- package/dist/client/components/history-sidebar.mjs +850 -340
- package/dist/client/components/layout/field-layout-renderer.mjs +6 -5
- package/dist/client/components/locale-switcher.mjs +8 -8
- package/dist/client/components/media/media-grid.mjs +12 -9
- package/dist/client/components/media/media-picker-dialog.mjs +242 -230
- package/dist/client/components/preview/live-preview-mode.mjs +1 -1
- package/dist/client/components/primitives/asset-preview.mjs +37 -22
- package/dist/client/components/primitives/date-input.mjs +212 -249
- package/dist/client/components/primitives/dropzone.mjs +192 -159
- package/dist/client/components/primitives/field-select-control.mjs +93 -0
- package/dist/client/components/primitives/select-multi.mjs +251 -230
- package/dist/client/components/primitives/select-single.mjs +345 -290
- package/dist/client/components/primitives/time-input.mjs +2 -2
- package/dist/client/components/sheets/resource-sheet.mjs +2 -0
- package/dist/client/components/ui/accordion.mjs +4 -4
- package/dist/client/components/ui/alert.mjs +3 -3
- package/dist/client/components/ui/badge.mjs +4 -4
- package/dist/client/components/ui/button.mjs +47 -37
- package/dist/client/components/ui/card.mjs +2 -2
- package/dist/client/components/ui/checkbox.mjs +1 -1
- package/dist/client/components/ui/command.mjs +5 -5
- package/dist/client/components/ui/dialog.mjs +3 -3
- package/dist/client/components/ui/drawer.mjs +1 -1
- package/dist/client/components/ui/dropdown-menu.mjs +157 -15
- package/dist/client/components/ui/empty-state.mjs +88 -59
- package/dist/client/components/ui/field.mjs +2 -2
- package/dist/client/components/ui/input-group.mjs +3 -3
- package/dist/client/components/ui/input.mjs +1 -1
- package/dist/client/components/ui/kbd.mjs +1 -1
- package/dist/client/components/ui/label.mjs +1 -1
- package/dist/client/components/ui/popover.mjs +19 -11
- package/dist/client/components/ui/scroll-fade.mjs +170 -0
- package/dist/client/components/ui/search-input.mjs +1 -1
- package/dist/client/components/ui/select.mjs +129 -27
- package/dist/client/components/ui/sheet.mjs +54 -34
- package/dist/client/components/ui/sidebar.mjs +15 -14
- package/dist/client/components/ui/skeleton.mjs +28 -12
- package/dist/client/components/ui/switch.mjs +2 -2
- package/dist/client/components/ui/table.mjs +82 -74
- package/dist/client/components/ui/tabs.mjs +26 -31
- package/dist/client/components/ui/textarea.mjs +1 -1
- package/dist/client/components/ui/tooltip.mjs +1 -1
- package/dist/client/components/widgets/chart-widget.mjs +134 -96
- package/dist/client/components/widgets/progress-widget.mjs +59 -34
- package/dist/client/components/widgets/quick-actions-widget.mjs +184 -113
- package/dist/client/components/widgets/recent-items-widget.mjs +144 -102
- package/dist/client/components/widgets/stats-widget.mjs +91 -72
- package/dist/client/components/widgets/table-widget.mjs +159 -246
- package/dist/client/components/widgets/timeline-widget.mjs +66 -43
- package/dist/client/components/widgets/value-widget.mjs +261 -152
- package/dist/client/components/widgets/widget-empty-state.mjs +88 -0
- package/dist/client/components/widgets/widget-skeletons.mjs +53 -20
- package/dist/client/contexts/focus-context.d.mts +2 -2
- package/dist/client/hooks/use-action.mjs +63 -55
- package/dist/client/hooks/use-audit-history.mjs +1 -65
- package/dist/client/hooks/use-collection-validation.mjs +36 -23
- package/dist/client/hooks/use-collection.mjs +96 -1
- package/dist/client/hooks/use-saved-views.mjs +70 -49
- package/dist/client/hooks/use-server-actions.mjs +59 -40
- package/dist/client/hooks/use-server-validation.mjs +156 -41
- package/dist/client/hooks/use-server-widget-data.mjs +1 -1
- package/dist/client/hooks/use-setup-status.d.mts +3 -3
- package/dist/client/hooks/use-setup-status.mjs +2 -2
- package/dist/client/hooks/use-transition-stage.mjs +2 -10
- package/dist/client/hooks/use-validation-error-map.mjs +31 -13
- package/dist/client/hooks/use-view-state.mjs +238 -174
- package/dist/client/i18n/date-locale.mjs +33 -0
- package/dist/client/i18n/hooks.mjs +17 -1
- package/dist/client/lib/utils.mjs +3 -2
- package/dist/client/preview/block-scope-context.d.mts +2 -2
- package/dist/client/preview/preview-banner.d.mts +2 -2
- package/dist/client/preview/preview-field.d.mts +4 -4
- package/dist/client/preview/preview-field.mjs +2 -2
- package/dist/client/runtime/provider.mjs +8 -1
- package/dist/client/runtime/translations-provider.mjs +1 -1
- package/dist/client/scope/picker.d.mts +2 -2
- package/dist/client/scope/provider.d.mts +2 -2
- package/dist/client/styles/base.css +1022 -0
- package/dist/client/styles/index.css +3 -589
- package/dist/client/utils/auto-expand-fields.mjs +4 -2
- package/dist/client/utils/keyboard-shortcuts.mjs +26 -0
- package/dist/client/utils/use-lazy-component.mjs +80 -0
- package/dist/client/views/auth/auth-layout.d.mts +18 -11
- package/dist/client/views/auth/auth-layout.mjs +291 -80
- package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
- package/dist/client/views/auth/forgot-password-form.mjs +2 -2
- package/dist/client/views/auth/login-form.d.mts +2 -2
- package/dist/client/views/auth/login-form.mjs +1 -1
- package/dist/client/views/auth/reset-password-form.d.mts +2 -2
- package/dist/client/views/auth/reset-password-form.mjs +2 -2
- package/dist/client/views/auth/setup-form.d.mts +2 -2
- package/dist/client/views/collection/auto-form-fields.mjs +11 -9
- package/dist/client/views/collection/bulk-action-toolbar.mjs +173 -138
- package/dist/client/views/collection/cells/complex-cells.mjs +22 -22
- package/dist/client/views/collection/cells/primitive-cells.mjs +1 -1
- package/dist/client/views/collection/cells/relation-cells.mjs +147 -129
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +224 -278
- package/dist/client/views/collection/cells/shared/relation-chip.mjs +64 -36
- package/dist/client/views/collection/cells/upload-cells.mjs +199 -9
- package/dist/client/views/collection/columns/build-columns.mjs +29 -9
- package/dist/client/views/collection/columns/column-defaults.mjs +2 -2
- package/dist/client/views/collection/field-renderer.mjs +50 -89
- package/dist/client/views/collection/form-view.mjs +237 -227
- package/dist/client/views/collection/table-view.mjs +1162 -229
- package/dist/client/views/collection/view-skeletons.mjs +222 -79
- package/dist/client/views/common/global-search.mjs +29 -18
- package/dist/client/views/dashboard/dashboard-grid.mjs +678 -501
- package/dist/client/views/dashboard/dashboard-widget.mjs +6 -3
- package/dist/client/views/dashboard/widget-card.mjs +23 -14
- package/dist/client/views/globals/global-form-view.mjs +634 -589
- package/dist/client/views/layout/admin-layout-provider.mjs +67 -70
- package/dist/client/views/layout/admin-layout.d.mts +3 -6
- package/dist/client/views/layout/admin-layout.mjs +149 -172
- package/dist/client/views/layout/admin-router.mjs +747 -544
- package/dist/client/views/layout/admin-sidebar.d.mts +38 -1
- package/dist/client/views/layout/admin-sidebar.mjs +751 -591
- package/dist/client/views/layout/admin-theme.d.mts +10 -0
- package/dist/client/views/layout/admin-theme.mjs +84 -0
- package/dist/client/views/layout/admin-view-layout.mjs +161 -0
- package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
- package/dist/client/views/pages/accept-invite-page.mjs +49 -26
- package/dist/client/views/pages/dashboard-page.d.mts +2 -2
- package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
- package/dist/client/views/pages/forgot-password-page.mjs +2 -19
- package/dist/client/views/pages/invite-page.d.mts +2 -2
- package/dist/client/views/pages/invite-page.mjs +2 -19
- package/dist/client/views/pages/login-page.d.mts +3 -3
- package/dist/client/views/pages/login-page.mjs +4 -21
- package/dist/client/views/pages/reset-password-page.d.mts +2 -2
- package/dist/client/views/pages/reset-password-page.mjs +3 -20
- package/dist/client/views/pages/setup-page.d.mts +2 -2
- package/dist/client/views/pages/setup-page.mjs +3 -20
- package/dist/client.d.mts +6 -2
- package/dist/client.mjs +2 -1
- package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
- package/dist/index.d.mts +6 -2
- package/dist/index.mjs +2 -1
- package/dist/server/augmentation/dashboard.d.mts +67 -3
- package/dist/server/augmentation/form-layout.d.mts +21 -0
- package/dist/server/augmentation/index.d.mts +1 -1
- package/dist/server/codegen/admin-client-template.mjs +4 -0
- package/dist/server/fields/blocks.d.mts +1 -1
- package/dist/server/fields/blocks.mjs +12 -0
- package/dist/server/fields/rich-text.d.mts +1 -1
- package/dist/server/fields/rich-text.mjs +8 -0
- package/dist/server/i18n/index.mjs +17 -1
- package/dist/server/i18n/messages/cs.mjs +23 -0
- package/dist/server/i18n/messages/de.mjs +23 -0
- package/dist/server/i18n/messages/en.mjs +64 -1
- package/dist/server/i18n/messages/es.mjs +23 -0
- package/dist/server/i18n/messages/fr.mjs +23 -0
- package/dist/server/i18n/messages/pl.mjs +23 -0
- package/dist/server/i18n/messages/pt.mjs +23 -0
- package/dist/server/i18n/messages/sk.mjs +83 -1
- package/dist/server/modules/admin/block/introspection.mjs +4 -1
- package/dist/server/modules/admin/block/prefetch.mjs +12 -2
- package/dist/server/modules/admin/collections/account.d.mts +50 -50
- package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
- 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 +64 -64
- package/dist/server/modules/admin/collections/assets.d.mts +20 -20
- package/dist/server/modules/admin/collections/assets.mjs +0 -1
- package/dist/server/modules/admin/collections/session.d.mts +42 -42
- package/dist/server/modules/admin/collections/user.d.mts +40 -28
- package/dist/server/modules/admin/collections/user.mjs +40 -9
- package/dist/server/modules/admin/collections/verification.d.mts +36 -36
- package/dist/server/modules/admin/dto/admin-config.dto.mjs +2 -0
- package/dist/server/modules/admin/factories.mjs +7 -18
- package/dist/server/modules/admin/index.d.mts +1 -1
- package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
- package/dist/server/modules/admin/routes/admin-config.mjs +34 -16
- package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
- package/dist/server/modules/admin/routes/execute-action.mjs +33 -0
- 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 +10 -10
- package/dist/server/modules/admin/routes/setup.mjs +7 -7
- package/dist/server/modules/admin/routes/translations.d.mts +4 -4
- package/dist/server/modules/admin/routes/translations.mjs +5 -1
- package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
- package/dist/server/modules/admin-preferences/collections/admin-preferences.mjs +1 -1
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +25 -25
- package/dist/server/modules/audit/.generated/module.d.mts +7 -7
- package/dist/server/modules/audit/.generated/module.mjs +1 -1
- package/dist/server/modules/audit/collections/audit-log.d.mts +39 -39
- package/dist/server/modules/audit/collections/audit-log.mjs +1 -1
- package/dist/server/modules/audit/config/app.mjs +99 -42
- package/dist/server/modules/audit/jobs/audit-cleanup.mjs +1 -1
- package/dist/server/plugin.mjs +4 -2
- package/dist/server/proxy-factories.d.mts +4 -3
- package/dist/server/proxy-factories.mjs +34 -8
- package/dist/shared/types/saved-views.types.d.mts +2 -0
- package/package.json +6 -4
- package/dist/client/components/fields/rich-text-editor/link-popover.mjs +0 -85
- package/dist/client/components/ui/spinner.mjs +0 -52
- package/dist/client/components/ui/toolbar.mjs +0 -136
- package/dist/client/contexts/breadcrumb-context.mjs +0 -60
- package/dist/client/views/layout/admin-topbar.mjs +0 -236
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ QUESTPIE follows a **server-first** architecture. All schema, layout, and behavi
|
|
|
8
8
|
|
|
9
9
|
| Layer | Package | Defines |
|
|
10
10
|
| ---------- | ------------------------------------- | ----------------------------------------------------------------- |
|
|
11
|
-
| **Server** | `questpie` + `@questpie/admin/server` | Schema, fields, access, hooks, sidebar, dashboard, branding
|
|
11
|
+
| **Server** | `questpie` + `@questpie/admin/server` | Schema, fields, access, hooks, sidebar, dashboard, branding name |
|
|
12
12
|
| **Client** | `@questpie/admin/client` | Field renderers, view renderers, component registry, UI overrides |
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
@@ -39,7 +39,7 @@ import { adminModule } from "@questpie/admin/server";
|
|
|
39
39
|
export default [adminModule] as const;
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
Branding, sidebar, dashboard, and admin locale are configured via `config/admin.ts`:
|
|
42
|
+
Branding name, sidebar, dashboard, and admin locale are configured via `config/admin.ts`:
|
|
43
43
|
|
|
44
44
|
```ts
|
|
45
45
|
// config/admin.ts
|
|
@@ -255,15 +255,44 @@ export default function AdminRoute() {
|
|
|
255
255
|
|
|
256
256
|
### 4. Tailwind CSS
|
|
257
257
|
|
|
258
|
-
Import admin
|
|
258
|
+
Import the admin base stylesheet and scan the admin package:
|
|
259
259
|
|
|
260
260
|
```css
|
|
261
261
|
@import "tailwindcss";
|
|
262
|
-
@import "@questpie/admin/styles/index.css";
|
|
262
|
+
@import "@questpie/admin/client/styles/index.css";
|
|
263
263
|
|
|
264
264
|
@source "../node_modules/@questpie/admin/dist";
|
|
265
265
|
```
|
|
266
266
|
|
|
267
|
+
`index.css` is an alias for `base.css`; import `base.css` directly when you want explicit control.
|
|
268
|
+
|
|
269
|
+
## Chrome Overrides (File-First)
|
|
270
|
+
|
|
271
|
+
Place component files in `questpie/admin/components/` to override specific UI chrome without changing your app shell:
|
|
272
|
+
|
|
273
|
+
| File | What it overrides |
|
|
274
|
+
| ---------------------------- | -------------------------------------- |
|
|
275
|
+
| `admin-sidebar-brand.tsx` | Sidebar logo + name area |
|
|
276
|
+
| `admin-sidebar-nav-item.tsx` | Each navigation item row |
|
|
277
|
+
| `admin-auth-layout.tsx` | Auth page wrapper (login, reset, etc.) |
|
|
278
|
+
|
|
279
|
+
```tsx title="questpie/admin/components/admin-sidebar-brand.tsx"
|
|
280
|
+
import type { AdminSidebarBrandProps } from "@questpie/admin/client";
|
|
281
|
+
|
|
282
|
+
export default function MyBrand({ name, collapsed }: AdminSidebarBrandProps) {
|
|
283
|
+
return (
|
|
284
|
+
<div className="flex items-center gap-2">
|
|
285
|
+
<img src="/logo.svg" alt={name} className="size-6 shrink-0" />
|
|
286
|
+
{!collapsed && <span className="font-bold">{name}</span>}
|
|
287
|
+
</div>
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
These files are discovered by codegen exactly like any other component file — no factory call needed, just a default export.
|
|
293
|
+
|
|
294
|
+
For these reserved override files, default-export a React component (sync or `React.lazy(...)`). Do **not** default-export a raw `() => import("...")` loader function.
|
|
295
|
+
|
|
267
296
|
## Block Editor
|
|
268
297
|
|
|
269
298
|
The admin includes a full drag-and-drop block editor. Blocks are defined server-side:
|
|
@@ -353,7 +382,7 @@ import {
|
|
|
353
382
|
import { adminModule, auditModule } from "@questpie/admin/server";
|
|
354
383
|
|
|
355
384
|
// Styles
|
|
356
|
-
import "@questpie/admin/styles/index.css";
|
|
385
|
+
import "@questpie/admin/client/styles/index.css";
|
|
357
386
|
```
|
|
358
387
|
|
|
359
388
|
## Component Stack
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BlockContent } from "./types.mjs";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime19 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/client/blocks/block-renderer.d.ts
|
|
6
6
|
|
|
@@ -40,6 +40,6 @@ declare function BlockRenderer({
|
|
|
40
40
|
selectedBlockId,
|
|
41
41
|
onBlockClick,
|
|
42
42
|
className
|
|
43
|
-
}: BlockRendererProps):
|
|
43
|
+
}: BlockRendererProps): react_jsx_runtime19.JSX.Element | null;
|
|
44
44
|
//#endregion
|
|
45
45
|
export { BlockRenderer, BlockRendererProps };
|
|
@@ -22,7 +22,7 @@ function BlockRenderer(t0) {
|
|
|
22
22
|
t3 = Symbol.for("react.early_return_sentinel");
|
|
23
23
|
bb0: {
|
|
24
24
|
function renderBlock(node) {
|
|
25
|
-
const renderFn = renderers[node.type];
|
|
25
|
+
const renderFn = renderers[node.type] ?? renderers[kebabToCamelCase(node.type)];
|
|
26
26
|
if (!renderFn) {
|
|
27
27
|
if (process.env.NODE_ENV !== "production") console.warn(`[BlockRenderer] No renderer found for block type "${node.type}"`);
|
|
28
28
|
return null;
|
|
@@ -100,6 +100,9 @@ function BlockRenderer(t0) {
|
|
|
100
100
|
} else t4 = $[10];
|
|
101
101
|
return t4;
|
|
102
102
|
}
|
|
103
|
+
function kebabToCamelCase(value) {
|
|
104
|
+
return value.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
|
|
105
|
+
}
|
|
103
106
|
|
|
104
107
|
//#endregion
|
|
105
108
|
export { BlockRenderer };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { I18nText } from "../../i18n/types.mjs";
|
|
2
2
|
import { IconComponent, MaybeLazyComponent } from "./common.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { FieldInstance } from "../field/field.mjs";
|
|
4
4
|
import { ComponentReference } from "../../../server/augmentation/common.mjs";
|
|
5
5
|
import "../../../server/augmentation.mjs";
|
|
6
6
|
|
|
@@ -127,7 +127,7 @@ interface ActionFormConfig<TItem = any> {
|
|
|
127
127
|
/** Dialog description */
|
|
128
128
|
description?: I18nText;
|
|
129
129
|
/** Form fields using FieldDefinition */
|
|
130
|
-
fields: Record<string,
|
|
130
|
+
fields: Record<string, FieldInstance>;
|
|
131
131
|
/** Default values */
|
|
132
132
|
defaultValues?: Record<string, any>;
|
|
133
133
|
/** Submit handler */
|
|
@@ -222,5 +222,33 @@ interface ActionDefinition<TItem = any> {
|
|
|
222
222
|
/** Confirmation dialog before executing */
|
|
223
223
|
confirmation?: ConfirmationConfig;
|
|
224
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Header actions configuration with primary/secondary split
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```ts
|
|
230
|
+
* header: {
|
|
231
|
+
* primary: [a.create()], // Shown as buttons
|
|
232
|
+
* secondary: [a.action({...})], // Shown in dropdown menu
|
|
233
|
+
* }
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
interface HeaderActionsConfig<TItem = any> {
|
|
237
|
+
/** Actions shown as buttons */
|
|
238
|
+
primary?: ActionDefinition<TItem>[];
|
|
239
|
+
/** Actions shown in dropdown menu */
|
|
240
|
+
secondary?: ActionDefinition<TItem>[];
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Collection actions configuration for list views
|
|
244
|
+
*/
|
|
245
|
+
interface ActionsConfig<TItem = any> {
|
|
246
|
+
/** Actions displayed in the header area (create, import, etc.) */
|
|
247
|
+
header?: HeaderActionsConfig<TItem>;
|
|
248
|
+
/** Actions displayed per row in list/table views */
|
|
249
|
+
row?: ActionDefinition<TItem>[];
|
|
250
|
+
/** Actions for bulk operations on selected items (deleteMany, duplicate, etc.) */
|
|
251
|
+
bulk?: ActionDefinition<TItem>[];
|
|
252
|
+
}
|
|
225
253
|
//#endregion
|
|
226
|
-
export { ActionDefinition };
|
|
254
|
+
export { ActionDefinition, ActionsConfig };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import "../../i18n/types.mjs";
|
|
2
|
+
import { MaybeLazyComponent } from "./common.mjs";
|
|
3
|
+
import "../field/field.mjs";
|
|
4
|
+
import "../../../server/augmentation.mjs";
|
|
5
|
+
import "../admin.mjs";
|
|
6
|
+
import { ActionsConfig } from "./action-types.mjs";
|
|
7
|
+
|
|
8
|
+
//#region src/client/builder/types/collection-types.d.ts
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Column configuration for list views
|
|
12
|
+
* Can be a simple field name or detailed config object
|
|
13
|
+
*/
|
|
14
|
+
type ColumnConfig<TFieldNames extends string = string> = TFieldNames | ColumnConfigObject<TFieldNames>;
|
|
15
|
+
/**
|
|
16
|
+
* Detailed column configuration object
|
|
17
|
+
*/
|
|
18
|
+
interface ColumnConfigObject<TFieldNames extends string = string> {
|
|
19
|
+
/**
|
|
20
|
+
* Field name to display
|
|
21
|
+
*/
|
|
22
|
+
field: TFieldNames;
|
|
23
|
+
/**
|
|
24
|
+
* Custom header label (defaults to field label)
|
|
25
|
+
*/
|
|
26
|
+
header?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Column width (CSS value like "200px", "20%", etc.)
|
|
29
|
+
*/
|
|
30
|
+
width?: string | number;
|
|
31
|
+
/**
|
|
32
|
+
* Minimum column width
|
|
33
|
+
*/
|
|
34
|
+
minWidth?: string | number;
|
|
35
|
+
/**
|
|
36
|
+
* Maximum column width
|
|
37
|
+
*/
|
|
38
|
+
maxWidth?: string | number;
|
|
39
|
+
/**
|
|
40
|
+
* Enable sorting for this column
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
43
|
+
sortable?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Custom cell renderer component
|
|
46
|
+
* Overrides the field's default cell component
|
|
47
|
+
*/
|
|
48
|
+
cell?: MaybeLazyComponent;
|
|
49
|
+
/**
|
|
50
|
+
* Column visibility
|
|
51
|
+
* Can be a boolean or function for conditional visibility
|
|
52
|
+
*/
|
|
53
|
+
visible?: boolean | ((row: any) => boolean);
|
|
54
|
+
/**
|
|
55
|
+
* Custom CSS class for column cells
|
|
56
|
+
*/
|
|
57
|
+
className?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Text alignment
|
|
60
|
+
*/
|
|
61
|
+
align?: "left" | "center" | "right";
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* List view configuration
|
|
65
|
+
*/
|
|
66
|
+
interface ListViewConfig<TFieldNames extends string = string> {
|
|
67
|
+
/**
|
|
68
|
+
* Columns to display (field names or column configs)
|
|
69
|
+
*/
|
|
70
|
+
columns?: ColumnConfig<TFieldNames>[];
|
|
71
|
+
/**
|
|
72
|
+
* Relations to include in query
|
|
73
|
+
*/
|
|
74
|
+
with?: string[];
|
|
75
|
+
/**
|
|
76
|
+
* Default sort
|
|
77
|
+
*/
|
|
78
|
+
defaultSort?: {
|
|
79
|
+
field: TFieldNames;
|
|
80
|
+
direction: "asc" | "desc";
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Enables reorder mode for this list.
|
|
84
|
+
* Requires a numeric field named `order` on the collection.
|
|
85
|
+
*/
|
|
86
|
+
orderable?: boolean | {
|
|
87
|
+
direction?: "asc" | "desc";
|
|
88
|
+
step?: number;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Enable search
|
|
92
|
+
* @default true
|
|
93
|
+
*/
|
|
94
|
+
searchable?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Searchable fields (defaults to all text-like fields)
|
|
97
|
+
*/
|
|
98
|
+
searchFields?: TFieldNames[];
|
|
99
|
+
/**
|
|
100
|
+
* Enable row selection
|
|
101
|
+
* @default false
|
|
102
|
+
*/
|
|
103
|
+
selectable?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Enable pagination
|
|
106
|
+
* @default true
|
|
107
|
+
*/
|
|
108
|
+
paginated?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Enable realtime invalidation for list queries.
|
|
111
|
+
* Falls back to AdminProvider realtime config when undefined.
|
|
112
|
+
*/
|
|
113
|
+
realtime?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Default page size
|
|
116
|
+
* @default 25
|
|
117
|
+
*/
|
|
118
|
+
pageSize?: number;
|
|
119
|
+
/**
|
|
120
|
+
* Available page size options
|
|
121
|
+
* @default [10, 25, 50, 100]
|
|
122
|
+
*/
|
|
123
|
+
pageSizeOptions?: number[];
|
|
124
|
+
/**
|
|
125
|
+
* Client-side grouping options for the current fetched page.
|
|
126
|
+
* Counts are page-local until a server aggregate API exists.
|
|
127
|
+
*/
|
|
128
|
+
grouping?: {
|
|
129
|
+
fields: TFieldNames[];
|
|
130
|
+
defaultField?: TFieldNames;
|
|
131
|
+
defaultCollapsed?: boolean;
|
|
132
|
+
showCounts?: boolean;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Actions configuration for list view
|
|
136
|
+
*/
|
|
137
|
+
actions?: ActionsConfig;
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
export { ListViewConfig };
|
|
@@ -49,6 +49,8 @@ type DashboardLayoutItem = WidgetConfig | DashboardSection | DashboardTabs;
|
|
|
49
49
|
*/
|
|
50
50
|
interface DashboardSection {
|
|
51
51
|
type: "section";
|
|
52
|
+
/** Stable section ID */
|
|
53
|
+
id?: string;
|
|
52
54
|
/** Section label */
|
|
53
55
|
label?: DynamicI18nText;
|
|
54
56
|
/** Section description */
|
|
@@ -63,6 +65,8 @@ interface DashboardSection {
|
|
|
63
65
|
layout?: "grid" | "stack";
|
|
64
66
|
/** Grid columns (for grid layout) */
|
|
65
67
|
columns?: number;
|
|
68
|
+
/** Fixed row height for widgets in this section */
|
|
69
|
+
rowHeight?: number | string;
|
|
66
70
|
/** Gap between items */
|
|
67
71
|
gap?: number;
|
|
68
72
|
/** Section items */
|
|
@@ -94,12 +98,14 @@ interface DashboardSection {
|
|
|
94
98
|
*/
|
|
95
99
|
interface DashboardTabs {
|
|
96
100
|
type: "tabs";
|
|
101
|
+
/** Stable tabs group ID */
|
|
102
|
+
id?: string;
|
|
97
103
|
/** Tab configurations */
|
|
98
104
|
tabs: DashboardTabConfig[];
|
|
99
105
|
/** Default active tab ID */
|
|
100
106
|
defaultTab?: string;
|
|
101
|
-
/**
|
|
102
|
-
|
|
107
|
+
/** Custom CSS class */
|
|
108
|
+
className?: string;
|
|
103
109
|
}
|
|
104
110
|
/**
|
|
105
111
|
* Single tab configuration
|
|
@@ -113,6 +119,12 @@ interface DashboardTabConfig {
|
|
|
113
119
|
icon?: IconComponent | ComponentReference;
|
|
114
120
|
/** Tab items (widgets or sections) */
|
|
115
121
|
items: DashboardLayoutItem[];
|
|
122
|
+
/** Grid columns for this tab */
|
|
123
|
+
columns?: number;
|
|
124
|
+
/** Fixed row height for widgets in this tab */
|
|
125
|
+
rowHeight?: number | string;
|
|
126
|
+
/** Gap between tab items */
|
|
127
|
+
gap?: number;
|
|
116
128
|
/** Badge text (e.g., count) */
|
|
117
129
|
badge?: string | number;
|
|
118
130
|
}
|
|
@@ -128,6 +140,8 @@ interface DashboardConfig {
|
|
|
128
140
|
description?: DynamicI18nText;
|
|
129
141
|
/** Grid columns (default: 4) */
|
|
130
142
|
columns?: number;
|
|
143
|
+
/** Fixed row height for dashboard widgets */
|
|
144
|
+
rowHeight?: number | string;
|
|
131
145
|
/** Gap between widgets */
|
|
132
146
|
gap?: number;
|
|
133
147
|
/** Dashboard items - widgets, sections, or tabs */
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ComponentRegistry, FormViewConfig } from "./field-types.mjs";
|
|
2
|
+
import { ListViewConfig } from "./collection-types.mjs";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/client/builder/types/views.d.ts
|
|
6
|
+
type ViewBaseProps = {
|
|
7
|
+
navigate: (path: string) => void;
|
|
8
|
+
basePath?: string;
|
|
9
|
+
config?: Record<string, any>;
|
|
10
|
+
viewConfig?: ListViewConfig | FormViewConfig;
|
|
11
|
+
registry?: ComponentRegistry;
|
|
12
|
+
};
|
|
13
|
+
interface CollectionListViewProps {
|
|
14
|
+
collection: string;
|
|
15
|
+
baseFindOptions?: any;
|
|
16
|
+
realtime?: boolean;
|
|
17
|
+
headerActions?: React.ReactNode;
|
|
18
|
+
onRowClick?: (item: any) => void;
|
|
19
|
+
config?: ViewBaseProps["config"];
|
|
20
|
+
viewConfig?: ListViewConfig;
|
|
21
|
+
navigate: ViewBaseProps["navigate"];
|
|
22
|
+
basePath?: ViewBaseProps["basePath"];
|
|
23
|
+
}
|
|
24
|
+
interface CollectionFormViewProps {
|
|
25
|
+
collection: string;
|
|
26
|
+
id?: string;
|
|
27
|
+
title?: string;
|
|
28
|
+
headerActions?: React.ReactNode;
|
|
29
|
+
onSuccess?: (data?: any) => void;
|
|
30
|
+
onCancel?: () => void;
|
|
31
|
+
onError?: (error: Error) => void;
|
|
32
|
+
defaultValues?: Record<string, any>;
|
|
33
|
+
allCollectionsConfig?: Record<string, any>;
|
|
34
|
+
config?: ViewBaseProps["config"];
|
|
35
|
+
viewConfig?: FormViewConfig;
|
|
36
|
+
navigate: ViewBaseProps["navigate"];
|
|
37
|
+
basePath?: ViewBaseProps["basePath"];
|
|
38
|
+
registry?: ViewBaseProps["registry"];
|
|
39
|
+
children?: React.ReactNode;
|
|
40
|
+
}
|
|
41
|
+
interface GlobalFormViewProps {
|
|
42
|
+
global: string;
|
|
43
|
+
title?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
headerActions?: React.ReactNode;
|
|
46
|
+
onSuccess?: (data?: any) => void;
|
|
47
|
+
onError?: (error: Error) => void;
|
|
48
|
+
allGlobalsConfig?: Record<string, any>;
|
|
49
|
+
config?: ViewBaseProps["config"];
|
|
50
|
+
viewConfig?: FormViewConfig;
|
|
51
|
+
navigate: ViewBaseProps["navigate"];
|
|
52
|
+
basePath?: ViewBaseProps["basePath"];
|
|
53
|
+
registry?: ViewBaseProps["registry"];
|
|
54
|
+
children?: React.ReactNode;
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { CollectionFormViewProps, CollectionListViewProps, GlobalFormViewProps };
|
|
@@ -42,6 +42,11 @@ interface BaseWidgetConfig {
|
|
|
42
42
|
* Column span (1-12)
|
|
43
43
|
*/
|
|
44
44
|
span?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Row span in the dashboard tile grid.
|
|
47
|
+
* A widget with span=2 and rowSpan=2 renders as a 2x2 tile.
|
|
48
|
+
*/
|
|
49
|
+
rowSpan?: number;
|
|
45
50
|
/**
|
|
46
51
|
* Grid position (for dashboard layouts)
|
|
47
52
|
*/
|