@firecms/core 3.1.0-canary.1df3b2c → 3.1.0-canary.9e89e98

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.
@@ -7,16 +7,11 @@ export type ViewModeToggleProps = {
7
7
  viewMode?: ViewMode;
8
8
  onViewModeChange?: (mode: ViewMode) => void;
9
9
  /**
10
- * Whether Kanban view mode is available for this collection.
11
- * Should be true when collection.kanban is set with a valid enum property.
10
+ * Which view modes are enabled for this collection.
11
+ * Only these modes will appear in the toggle.
12
+ * Defaults to all three: ["table", "cards", "kanban"].
12
13
  */
13
- kanbanEnabled?: boolean;
14
- /**
15
- * Whether a plugin exists that can configure Kanban (e.g., collection editor).
16
- * When true, Kanban option is always shown (enabled or not based on kanbanEnabled).
17
- * When false, Kanban option is shown but disabled.
18
- */
19
- hasKanbanConfigPlugin?: boolean;
14
+ enabledViews?: ViewMode[];
20
15
  /**
21
16
  * Current size for card/table views
22
17
  */
@@ -46,4 +41,4 @@ export type ViewModeToggleProps = {
46
41
  */
47
42
  onKanbanPropertyChange?: (property: string) => void;
48
43
  };
49
- export declare function ViewModeToggle({ viewMode, onViewModeChange, kanbanEnabled, hasKanbanConfigPlugin, size, onSizeChanged, open, onOpenChange, kanbanPropertyOptions, selectedKanbanProperty, onKanbanPropertyChange }: ViewModeToggleProps): import("react/jsx-runtime").JSX.Element | null;
44
+ export declare function ViewModeToggle({ viewMode, onViewModeChange, enabledViews, size, onSizeChanged, open, onOpenChange, kanbanPropertyOptions, selectedKanbanProperty, onKanbanPropertyChange }: ViewModeToggleProps): import("react/jsx-runtime").JSX.Element | null;
package/dist/index.es.js CHANGED
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { c } from "react-compiler-runtime";
3
3
  import * as React from "react";
4
4
  import React__default, { useState, useRef, useEffect, useContext, useCallback, useMemo, createElement, createRef, createContext, forwardRef, memo, useLayoutEffect } from "react";
5
- import { getColorSchemeForSeed, CHIP_COLORS, FunctionsIcon, CircleIcon, iconKeys, coolIconKeys, Icon, Tooltip, ErrorIcon, Typography, IconButton, ContentCopyIcon, OpenInNewIcon, DescriptionIcon, cls, Skeleton, Chip, defaultBorderMixin, KeyboardTabIcon, Checkbox, AccountCircleIcon, Markdown, TextareaAutosize, focusedDisabled, MultiSelect, MultiSelectItem, Select, SelectItem, BooleanSwitch, DateTimeField, paperMixin, EditIcon, DoNotDisturbOnIcon, Menu, MenuItem, MoreVertIcon, Badge, CircularProgress, SearchBar, ArrowUpwardIcon, Popover, FilterListIcon, Button, CenteredView, AssignmentIcon, Label, CloseIcon, TextField, BooleanSwitchWithLabel, useOutsideAlerter, Dialog, DialogTitle, DialogContent, DialogActions, FileCopyIcon, DeleteIcon, AddIcon, StarIcon, Collapse, ExpandablePanel, ArrowForwardIcon, Card, cardMixin, cardClickableMixin, Container, getColorSchemeForKey, RefreshIcon, ViewColumnIcon, ViewKanbanIcon, AppsIcon, ListIcon, ToggleButtonGroup, LoadingButton, WarningIcon, KeyboardArrowDownIcon, VisibilityIcon, CheckIcon, CancelIcon, Alert, NotesIcon, InfoIcon, fieldBackgroundMixin, RemoveIcon, fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, ArrowDropDownIcon, FilterListOffIcon, SearchIcon, Avatar, DarkModeIcon, LightModeIcon, BrightnessMediumIcon, LogoutIcon, HandleIcon, KeyboardArrowUpIcon, debounce, AutoAwesomeIcon, OpenInFullIcon, Sheet, Tab, Tabs, CodeIcon, ExpandMoreIcon, ViewStreamIcon, RepeatIcon, BallotIcon, ScheduleIcon, AddLinkIcon, LinkIcon, DriveFolderUploadIcon, UploadFileIcon, FormatListNumberedIcon, NumbersIcon, PersonIcon, ListAltIcon, FlagIcon, MailIcon, HttpIcon, FormatQuoteIcon, SubjectIcon, ShortTextIcon, MenuIcon, ChevronLeftIcon } from "@firecms/ui";
5
+ import { getColorSchemeForSeed, CHIP_COLORS, FunctionsIcon, CircleIcon, iconKeys, coolIconKeys, Icon, Tooltip, ErrorIcon, Typography, IconButton, ContentCopyIcon, OpenInNewIcon, DescriptionIcon, cls, Skeleton, Chip, defaultBorderMixin, KeyboardTabIcon, Checkbox, AccountCircleIcon, Markdown, TextareaAutosize, focusedDisabled, MultiSelect, MultiSelectItem, Select, SelectItem, BooleanSwitch, DateTimeField, paperMixin, EditIcon, DoNotDisturbOnIcon, Menu, MenuItem, MoreVertIcon, Badge, CircularProgress, SearchBar, ArrowUpwardIcon, Popover, FilterListIcon, Button, CenteredView, AssignmentIcon, Label, CloseIcon, TextField, BooleanSwitchWithLabel, useOutsideAlerter, Dialog, DialogTitle, DialogContent, DialogActions, FileCopyIcon, DeleteIcon, AddIcon, StarIcon, Collapse, ExpandablePanel, ArrowForwardIcon, Card, cardMixin, cardClickableMixin, Container, getColorSchemeForKey, RefreshIcon, ToggleButtonGroup, ViewColumnIcon, ViewKanbanIcon, AppsIcon, ListIcon, LoadingButton, WarningIcon, KeyboardArrowDownIcon, VisibilityIcon, CheckIcon, CancelIcon, Alert, NotesIcon, InfoIcon, fieldBackgroundMixin, RemoveIcon, fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, ArrowDropDownIcon, FilterListOffIcon, SearchIcon, Avatar, DarkModeIcon, LightModeIcon, BrightnessMediumIcon, LogoutIcon, HandleIcon, KeyboardArrowUpIcon, debounce, AutoAwesomeIcon, OpenInFullIcon, Sheet, Tab, Tabs, CodeIcon, ExpandMoreIcon, ViewStreamIcon, RepeatIcon, BallotIcon, ScheduleIcon, AddLinkIcon, LinkIcon, DriveFolderUploadIcon, UploadFileIcon, FormatListNumberedIcon, NumbersIcon, PersonIcon, ListAltIcon, FlagIcon, MailIcon, HttpIcon, FormatQuoteIcon, SubjectIcon, ShortTextIcon, MenuIcon, ChevronLeftIcon } from "@firecms/ui";
6
6
  import { SnackbarProvider as SnackbarProvider$1, useSnackbar } from "notistack";
7
7
  import hash from "object-hash";
8
8
  import { getIn, setIn, useFormex, useCreateFormex, Formex, Field } from "@firecms/formex";
@@ -18344,13 +18344,13 @@ function EntityCollectionBoardView({
18344
18344
  ] })
18345
18345
  ] });
18346
18346
  }
18347
+ const ALL_VIEW_MODES = ["table", "cards", "kanban"];
18347
18348
  function ViewModeToggle(t0) {
18348
- const $ = c(42);
18349
+ const $ = c(36);
18349
18350
  const {
18350
18351
  viewMode: t1,
18351
18352
  onViewModeChange,
18352
- kanbanEnabled: t2,
18353
- hasKanbanConfigPlugin: t3,
18353
+ enabledViews: t2,
18354
18354
  size,
18355
18355
  onSizeChanged,
18356
18356
  open,
@@ -18360,14 +18360,13 @@ function ViewModeToggle(t0) {
18360
18360
  onKanbanPropertyChange
18361
18361
  } = t0;
18362
18362
  const viewMode = t1 === void 0 ? "table" : t1;
18363
- const kanbanEnabled = t2 === void 0 ? false : t2;
18364
- const hasKanbanConfigPlugin = t3 === void 0 ? false : t3;
18363
+ const enabledViews = t2 === void 0 ? ALL_VIEW_MODES : t2;
18365
18364
  if (!onViewModeChange) {
18366
18365
  return null;
18367
18366
  }
18368
- let t4;
18367
+ let t3;
18369
18368
  if ($[0] !== viewMode) {
18370
- t4 = () => {
18369
+ t3 = () => {
18371
18370
  if (viewMode === "kanban") {
18372
18371
  return /* @__PURE__ */ jsx(ViewKanbanIcon, { size: "small" });
18373
18372
  }
@@ -18377,14 +18376,14 @@ function ViewModeToggle(t0) {
18377
18376
  return /* @__PURE__ */ jsx(ListIcon, { size: "small" });
18378
18377
  };
18379
18378
  $[0] = viewMode;
18380
- $[1] = t4;
18379
+ $[1] = t3;
18381
18380
  } else {
18382
- t4 = $[1];
18381
+ t3 = $[1];
18383
18382
  }
18384
- const getViewModeIcon = t4;
18385
- let t5;
18383
+ const getViewModeIcon = t3;
18384
+ let t4;
18386
18385
  if ($[2] !== viewMode) {
18387
- t5 = () => {
18386
+ t4 = () => {
18388
18387
  if (viewMode === "kanban") {
18389
18388
  return "Board";
18390
18389
  }
@@ -18394,177 +18393,151 @@ function ViewModeToggle(t0) {
18394
18393
  return "List";
18395
18394
  };
18396
18395
  $[2] = viewMode;
18397
- $[3] = t5;
18396
+ $[3] = t4;
18398
18397
  } else {
18399
- t5 = $[3];
18398
+ t4 = $[3];
18400
18399
  }
18401
- const getViewModeName = t5;
18402
- const showKanban = kanbanEnabled || hasKanbanConfigPlugin;
18400
+ const getViewModeName = t4;
18403
18401
  const showSizeSelector = size && onSizeChanged && (viewMode === "table" || viewMode === "cards");
18404
18402
  const showKanbanPropertySelector = viewMode === "kanban" && kanbanPropertyOptions && kanbanPropertyOptions.length > 0 && onKanbanPropertyChange;
18403
+ let t5;
18405
18404
  let t6;
18406
- let t7;
18407
18405
  if ($[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
18408
- t7 = {
18409
- value: "table",
18410
- label: "List",
18411
- icon: /* @__PURE__ */ jsx(ListIcon, { size: "small" })
18412
- };
18413
- $[4] = t7;
18406
+ t6 = /* @__PURE__ */ jsx(ListIcon, { size: "small" });
18407
+ $[4] = t6;
18414
18408
  } else {
18415
- t7 = $[4];
18409
+ t6 = $[4];
18416
18410
  }
18417
- let t8;
18418
- if ($[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
18419
- t8 = {
18411
+ let t7;
18412
+ if ($[5] !== enabledViews) {
18413
+ const allOptions = [{
18414
+ value: "table",
18415
+ label: "List",
18416
+ icon: t6
18417
+ }, {
18420
18418
  value: "cards",
18421
18419
  label: "Cards",
18422
18420
  icon: /* @__PURE__ */ jsx(AppsIcon, { size: "small" })
18423
- };
18424
- $[5] = t8;
18421
+ }, {
18422
+ value: "kanban",
18423
+ label: "Board",
18424
+ icon: /* @__PURE__ */ jsx(ViewKanbanIcon, { size: "small" })
18425
+ }];
18426
+ t7 = allOptions.filter((option) => enabledViews.includes(option.value));
18427
+ $[5] = enabledViews;
18428
+ $[6] = t7;
18425
18429
  } else {
18426
- t8 = $[5];
18430
+ t7 = $[6];
18427
18431
  }
18428
- let options;
18429
- if ($[6] !== hasKanbanConfigPlugin || $[7] !== kanbanEnabled || $[8] !== showKanban) {
18430
- options = [t7, t8];
18431
- if (showKanban) {
18432
- let t92;
18433
- if ($[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
18434
- t92 = /* @__PURE__ */ jsx(ViewKanbanIcon, { size: "small" });
18435
- $[10] = t92;
18436
- } else {
18437
- t92 = $[10];
18438
- }
18439
- const t102 = !kanbanEnabled && !hasKanbanConfigPlugin;
18440
- let t112;
18441
- if ($[11] !== t102) {
18442
- t112 = {
18443
- value: "kanban",
18444
- label: "Board",
18445
- icon: t92,
18446
- disabled: t102
18447
- };
18448
- $[11] = t102;
18449
- $[12] = t112;
18450
- } else {
18451
- t112 = $[12];
18452
- }
18453
- options.push(t112);
18454
- }
18455
- $[6] = hasKanbanConfigPlugin;
18456
- $[7] = kanbanEnabled;
18457
- $[8] = showKanban;
18458
- $[9] = options;
18432
+ t5 = t7;
18433
+ const viewModeOptions = t5;
18434
+ if (viewModeOptions.length <= 1 && !showSizeSelector) {
18435
+ return null;
18436
+ }
18437
+ let t8;
18438
+ if ($[7] !== getViewModeIcon) {
18439
+ t8 = getViewModeIcon();
18440
+ $[7] = getViewModeIcon;
18441
+ $[8] = t8;
18459
18442
  } else {
18460
- options = $[9];
18443
+ t8 = $[8];
18461
18444
  }
18462
- t6 = options;
18463
- const viewModeOptions = t6;
18464
- let t9;
18465
- if ($[13] !== getViewModeIcon) {
18466
- t9 = getViewModeIcon();
18467
- $[13] = getViewModeIcon;
18468
- $[14] = t9;
18445
+ const t9 = getViewModeName();
18446
+ let t10;
18447
+ if ($[9] !== t9) {
18448
+ t10 = /* @__PURE__ */ jsx("span", { className: "ml-1 text-sm", children: t9 });
18449
+ $[9] = t9;
18450
+ $[10] = t10;
18469
18451
  } else {
18470
- t9 = $[14];
18452
+ t10 = $[10];
18471
18453
  }
18472
- const t10 = getViewModeName();
18473
18454
  let t11;
18474
- if ($[15] !== t10) {
18475
- t11 = /* @__PURE__ */ jsx("span", { className: "ml-1 text-sm", children: t10 });
18476
- $[15] = t10;
18477
- $[16] = t11;
18455
+ if ($[11] !== t10 || $[12] !== t8) {
18456
+ t11 = /* @__PURE__ */ jsxs(Button, { size: "small", children: [
18457
+ t8,
18458
+ t10
18459
+ ] });
18460
+ $[11] = t10;
18461
+ $[12] = t8;
18462
+ $[13] = t11;
18478
18463
  } else {
18479
- t11 = $[16];
18464
+ t11 = $[13];
18480
18465
  }
18481
18466
  let t12;
18482
- if ($[17] !== t11 || $[18] !== t9) {
18483
- t12 = /* @__PURE__ */ jsxs(Button, { size: "small", children: [
18484
- t9,
18485
- t11
18486
- ] });
18487
- $[17] = t11;
18488
- $[18] = t9;
18489
- $[19] = t12;
18467
+ if ($[14] !== onViewModeChange || $[15] !== viewMode || $[16] !== viewModeOptions) {
18468
+ t12 = viewModeOptions.length > 1 && /* @__PURE__ */ jsx(ToggleButtonGroup, { value: viewMode, onValueChange: onViewModeChange, options: viewModeOptions });
18469
+ $[14] = onViewModeChange;
18470
+ $[15] = viewMode;
18471
+ $[16] = viewModeOptions;
18472
+ $[17] = t12;
18490
18473
  } else {
18491
- t12 = $[19];
18474
+ t12 = $[17];
18492
18475
  }
18493
18476
  let t13;
18494
- if ($[20] !== onViewModeChange || $[21] !== viewMode || $[22] !== viewModeOptions) {
18495
- t13 = /* @__PURE__ */ jsx(ToggleButtonGroup, { value: viewMode, onValueChange: onViewModeChange, options: viewModeOptions });
18496
- $[20] = onViewModeChange;
18497
- $[21] = viewMode;
18498
- $[22] = viewModeOptions;
18499
- $[23] = t13;
18500
- } else {
18501
- t13 = $[23];
18502
- }
18503
- let t14;
18504
- if ($[24] !== onSizeChanged || $[25] !== showSizeSelector || $[26] !== size) {
18505
- t14 = showSizeSelector && /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center justify-between gap-2", children: [
18477
+ if ($[18] !== onSizeChanged || $[19] !== showSizeSelector || $[20] !== size) {
18478
+ t13 = showSizeSelector && /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center justify-between gap-2", children: [
18506
18479
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-surface-600 dark:text-surface-300", children: [
18507
18480
  /* @__PURE__ */ jsx(ViewColumnIcon, { size: "small" }),
18508
18481
  /* @__PURE__ */ jsx("span", { children: "Size" })
18509
18482
  ] }),
18510
18483
  /* @__PURE__ */ jsx(Select, { value: size, size: "small", className: "w-20", onValueChange: (v) => onSizeChanged?.(v), renderValue: _temp$e, children: ["xs", "s", "m", "l", "xl"].map(_temp2$5) })
18511
18484
  ] });
18512
- $[24] = onSizeChanged;
18513
- $[25] = showSizeSelector;
18514
- $[26] = size;
18515
- $[27] = t14;
18485
+ $[18] = onSizeChanged;
18486
+ $[19] = showSizeSelector;
18487
+ $[20] = size;
18488
+ $[21] = t13;
18516
18489
  } else {
18517
- t14 = $[27];
18490
+ t13 = $[21];
18518
18491
  }
18519
- let t15;
18520
- if ($[28] !== kanbanPropertyOptions || $[29] !== onKanbanPropertyChange || $[30] !== selectedKanbanProperty || $[31] !== showKanbanPropertySelector) {
18521
- t15 = showKanbanPropertySelector && /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center justify-between gap-2", children: [
18492
+ let t14;
18493
+ if ($[22] !== kanbanPropertyOptions || $[23] !== onKanbanPropertyChange || $[24] !== selectedKanbanProperty || $[25] !== showKanbanPropertySelector) {
18494
+ t14 = showKanbanPropertySelector && /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center justify-between gap-2", children: [
18522
18495
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-surface-600 dark:text-surface-300", children: [
18523
18496
  /* @__PURE__ */ jsx(ViewKanbanIcon, { size: "small" }),
18524
18497
  /* @__PURE__ */ jsx("span", { children: "Group by" })
18525
18498
  ] }),
18526
18499
  /* @__PURE__ */ jsx(Select, { value: selectedKanbanProperty, size: "small", className: "w-32", onValueChange: (v_1) => onKanbanPropertyChange?.(v_1), renderValue: (v_2) => {
18527
- const option = kanbanPropertyOptions?.find((o) => o.key === v_2);
18528
- return /* @__PURE__ */ jsx("span", { className: "font-medium truncate", children: option?.label ?? v_2 });
18500
+ const option_0 = kanbanPropertyOptions?.find((o) => o.key === v_2);
18501
+ return /* @__PURE__ */ jsx("span", { className: "font-medium truncate", children: option_0?.label ?? v_2 });
18529
18502
  }, children: kanbanPropertyOptions?.map(_temp3$3) })
18530
18503
  ] });
18531
- $[28] = kanbanPropertyOptions;
18532
- $[29] = onKanbanPropertyChange;
18533
- $[30] = selectedKanbanProperty;
18534
- $[31] = showKanbanPropertySelector;
18535
- $[32] = t15;
18504
+ $[22] = kanbanPropertyOptions;
18505
+ $[23] = onKanbanPropertyChange;
18506
+ $[24] = selectedKanbanProperty;
18507
+ $[25] = showKanbanPropertySelector;
18508
+ $[26] = t14;
18536
18509
  } else {
18537
- t15 = $[32];
18510
+ t14 = $[26];
18538
18511
  }
18539
- let t16;
18540
- if ($[33] !== t13 || $[34] !== t14 || $[35] !== t15) {
18541
- t16 = /* @__PURE__ */ jsxs("div", { className: "p-3 flex flex-col gap-3 min-w-[240px]", children: [
18512
+ let t15;
18513
+ if ($[27] !== t12 || $[28] !== t13 || $[29] !== t14) {
18514
+ t15 = /* @__PURE__ */ jsxs("div", { className: "p-3 flex flex-col gap-3 min-w-[240px]", children: [
18515
+ t12,
18542
18516
  t13,
18543
- t14,
18544
- t15
18517
+ t14
18545
18518
  ] });
18546
- $[33] = t13;
18547
- $[34] = t14;
18548
- $[35] = t15;
18549
- $[36] = t16;
18519
+ $[27] = t12;
18520
+ $[28] = t13;
18521
+ $[29] = t14;
18522
+ $[30] = t15;
18550
18523
  } else {
18551
- t16 = $[36];
18524
+ t15 = $[30];
18552
18525
  }
18553
- let t17;
18554
- if ($[37] !== onOpenChange || $[38] !== open || $[39] !== t12 || $[40] !== t16) {
18555
- t17 = /* @__PURE__ */ jsx(Popover, { open, onOpenChange, modal: true, trigger: t12, children: t16 });
18556
- $[37] = onOpenChange;
18557
- $[38] = open;
18558
- $[39] = t12;
18559
- $[40] = t16;
18560
- $[41] = t17;
18526
+ let t16;
18527
+ if ($[31] !== onOpenChange || $[32] !== open || $[33] !== t11 || $[34] !== t15) {
18528
+ t16 = /* @__PURE__ */ jsx(Popover, { open, onOpenChange, modal: true, trigger: t11, children: t15 });
18529
+ $[31] = onOpenChange;
18530
+ $[32] = open;
18531
+ $[33] = t11;
18532
+ $[34] = t15;
18533
+ $[35] = t16;
18561
18534
  } else {
18562
- t17 = $[41];
18535
+ t16 = $[35];
18563
18536
  }
18564
- return t17;
18537
+ return t16;
18565
18538
  }
18566
- function _temp3$3(option_0) {
18567
- return /* @__PURE__ */ jsx(SelectItem, { value: option_0.key, children: option_0.label }, option_0.key);
18539
+ function _temp3$3(option_1) {
18540
+ return /* @__PURE__ */ jsx(SelectItem, { value: option_1.key, children: option_1.label }, option_1.key);
18568
18541
  }
18569
18542
  function _temp2$5(s) {
18570
18543
  return /* @__PURE__ */ jsx(SelectItem, { value: s, className: "font-medium text-center", children: s.toUpperCase() }, s);
@@ -24565,24 +24538,26 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
24565
24538
  propertyConfigs: customizationController.propertyConfigs,
24566
24539
  authController
24567
24540
  }), [collection, fullPath]);
24568
- const kanbanEnabled = useMemo(() => {
24569
- if (!collection.kanban?.columnProperty) return false;
24570
- const property_0 = getPropertyInPath(resolvedCollection.properties, collection.kanban.columnProperty);
24571
- if (!property_0 || !("dataType" in property_0) || property_0.dataType !== "string") return false;
24572
- return Boolean(property_0.enumValues);
24573
- }, [collection.kanban?.columnProperty, resolvedCollection.properties]);
24574
- const hasKanbanConfigPlugin = useMemo(() => {
24575
- return customizationController.plugins?.some((plugin_0) => plugin_0.collectionView?.KanbanSetupComponent) ?? false;
24576
- }, [customizationController.plugins]);
24541
+ const hasEnumProperty = useMemo(() => {
24542
+ const properties = resolvedCollection.properties;
24543
+ return Object.values(properties).some((prop) => prop && prop.dataType === "string" && prop.enumValues);
24544
+ }, [resolvedCollection.properties]);
24545
+ const enabledViews = useMemo(() => {
24546
+ const configured = collection.enabledViews ?? ["table", "cards", "kanban"];
24547
+ if (!hasEnumProperty) {
24548
+ return configured.filter((v) => v !== "kanban");
24549
+ }
24550
+ return configured;
24551
+ }, [collection.enabledViews, hasEnumProperty]);
24577
24552
  const kanbanPropertyOptions = useMemo(() => {
24578
24553
  const options = [];
24579
- const properties = resolvedCollection.properties;
24580
- for (const [key_0, property_1] of Object.entries(properties)) {
24581
- const prop = property_1;
24582
- if (prop && prop.dataType === "string" && prop.enumValues) {
24554
+ const properties_0 = resolvedCollection.properties;
24555
+ for (const [key_0, property_0] of Object.entries(properties_0)) {
24556
+ const prop_0 = property_0;
24557
+ if (prop_0 && prop_0.dataType === "string" && prop_0.enumValues) {
24583
24558
  options.push({
24584
24559
  key: key_0,
24585
- label: prop.name || key_0
24560
+ label: prop_0.name || key_0
24586
24561
  });
24587
24562
  }
24588
24563
  }
@@ -24610,11 +24585,11 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
24610
24585
  }
24611
24586
  }
24612
24587
  }, [kanbanPropertyOptions, selectedKanbanProperty, getSavedKanbanProperty, collection.kanban?.columnProperty]);
24613
- const onKanbanPropertyChange = useCallback((property_2) => {
24614
- setSelectedKanbanProperty(property_2);
24588
+ const onKanbanPropertyChange = useCallback((property_1) => {
24589
+ setSelectedKanbanProperty(property_1);
24615
24590
  if (userConfigPersistence) {
24616
24591
  onCollectionModifiedForUser(fullPath, {
24617
- kanbanColumnProperty: property_2
24592
+ kanbanColumnProperty: property_1
24618
24593
  });
24619
24594
  }
24620
24595
  }, [userConfigPersistence, onCollectionModifiedForUser, fullPath]);
@@ -24729,15 +24704,15 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
24729
24704
  }, [docsCount, fullPath, breadcrumbs.updateCount]);
24730
24705
  const countFetcher = /* @__PURE__ */ jsx(EntitiesCount, { fullPath, collection, filter: tableController.filterValues, sortBy: tableController.sortBy, onCountChange: setDocsCount });
24731
24706
  const buildAdditionalHeaderWidget = useCallback(({
24732
- property: property_3,
24707
+ property: property_2,
24733
24708
  propertyKey: propertyKey_1,
24734
24709
  onHover
24735
24710
  }) => {
24736
24711
  const collection_4 = collectionRef.current;
24737
24712
  if (!customizationController.plugins) return null;
24738
- return /* @__PURE__ */ jsx(Fragment, { children: customizationController.plugins.filter((plugin_1) => plugin_1.collectionView?.HeaderAction).map((plugin_2, i) => {
24739
- const HeaderAction = plugin_2.collectionView.HeaderAction;
24740
- return /* @__PURE__ */ jsx(HeaderAction, { onHover, propertyKey: propertyKey_1, property: property_3, fullPath, collection: collection_4, tableController, parentCollectionIds: parentCollectionIds ?? [] }, `plugin_header_action_${i}`);
24713
+ return /* @__PURE__ */ jsx(Fragment, { children: customizationController.plugins.filter((plugin_0) => plugin_0.collectionView?.HeaderAction).map((plugin_1, i) => {
24714
+ const HeaderAction = plugin_1.collectionView.HeaderAction;
24715
+ return /* @__PURE__ */ jsx(HeaderAction, { onHover, propertyKey: propertyKey_1, property: property_2, fullPath, collection: collection_4, tableController, parentCollectionIds: parentCollectionIds ?? [] }, `plugin_header_action_${i}`);
24741
24716
  }) });
24742
24717
  }, [customizationController.plugins, fullPath, parentCollectionIds]);
24743
24718
  const addColumnComponentInternal = AddColumnComponent ? function() {
@@ -24755,11 +24730,11 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
24755
24730
  parentCollectionIds
24756
24731
  });
24757
24732
  const [viewModePopoverOpen, setViewModePopoverOpen] = useState(false);
24758
- const viewModeToggleElement = /* @__PURE__ */ jsx(ViewModeToggle, { viewMode, onViewModeChange, kanbanEnabled, hasKanbanConfigPlugin, size: viewMode === "table" ? tableSize : viewMode === "cards" ? cardSize : void 0, onSizeChanged: viewMode === "table" ? onTableSizeChanged : viewMode === "cards" ? setCardSize : void 0, open: viewModePopoverOpen, onOpenChange: setViewModePopoverOpen, kanbanPropertyOptions, selectedKanbanProperty, onKanbanPropertyChange });
24733
+ const viewModeToggleElement = /* @__PURE__ */ jsx(ViewModeToggle, { viewMode, onViewModeChange, enabledViews, size: viewMode === "table" ? tableSize : viewMode === "cards" ? cardSize : void 0, onSizeChanged: viewMode === "table" ? onTableSizeChanged : viewMode === "cards" ? setCardSize : void 0, open: viewModePopoverOpen, onOpenChange: setViewModePopoverOpen, kanbanPropertyOptions, selectedKanbanProperty, onKanbanPropertyChange });
24759
24734
  return /* @__PURE__ */ jsxs("div", { className: cls("overflow-hidden h-full w-full rounded-md flex flex-col", className), ref: containerRef, children: [
24760
24735
  countFetcher,
24761
24736
  /* @__PURE__ */ jsx(CollectionTableToolbar, { loading: tableController.dataLoading, onTextSearch: textSearchEnabled && textSearchInitialised ? tableController.setSearchString : void 0, onTextSearchClick: textSearchEnabled && !textSearchInitialised ? onTextSearchClick : void 0, textSearchLoading, viewModeToggle: viewModeToggleElement, actionsStart: /* @__PURE__ */ jsx(EntityCollectionViewStartActions, { parentCollectionIds: parentCollectionIds ?? [], collection, tableController, path: fullPath, relativePath: collection.path, selectionController: usedSelectionController, collectionEntitiesCount: docsCount, resolvedProperties: resolvedCollection.properties }), actions: /* @__PURE__ */ jsx(EntityCollectionViewActions, { parentCollectionIds: parentCollectionIds ?? [], collection, tableController, onMultipleDeleteClick, onNewClick, path: fullPath, relativePath: collection.path, selectionController: usedSelectionController, selectionEnabled, collectionEntitiesCount: docsCount }) }),
24762
- viewMode === "kanban" && (kanbanEnabled || hasKanbanConfigPlugin) ? /* @__PURE__ */ jsx(EntityCollectionBoardView, { collection, tableController, fullPath, parentCollectionIds, columnProperty: selectedKanbanProperty, onEntityClick, selectionController: usedSelectionController, selectionEnabled, highlightedEntities: highlightedEntity ? [highlightedEntity] : [], deletedEntities, emptyComponent: canCreateEntities && tableController.filterValues === void 0 && tableController.sortBy === void 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center", children: [
24737
+ viewMode === "kanban" && enabledViews.includes("kanban") ? /* @__PURE__ */ jsx(EntityCollectionBoardView, { collection, tableController, fullPath, parentCollectionIds, columnProperty: selectedKanbanProperty, onEntityClick, selectionController: usedSelectionController, selectionEnabled, highlightedEntities: highlightedEntity ? [highlightedEntity] : [], deletedEntities, emptyComponent: canCreateEntities && tableController.filterValues === void 0 && tableController.sortBy === void 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center", children: [
24763
24738
  /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: "So empty..." }),
24764
24739
  /* @__PURE__ */ jsxs(Button, { onClick: onNewClick, className: "mt-4", children: [
24765
24740
  /* @__PURE__ */ jsx(AddIcon, {}),
@@ -24786,8 +24761,8 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
24786
24761
  });
24787
24762
  setLocalPropertiesOrder(newPropertiesOrder);
24788
24763
  if (customizationController?.plugins) {
24789
- customizationController.plugins.filter((plugin_3) => plugin_3.collectionView?.onColumnsReorder).forEach((plugin_4) => {
24790
- plugin_4.collectionView.onColumnsReorder({
24764
+ customizationController.plugins.filter((plugin_2) => plugin_2.collectionView?.onColumnsReorder).forEach((plugin_3) => {
24765
+ plugin_3.collectionView.onColumnsReorder({
24791
24766
  fullPath,
24792
24767
  parentCollectionIds: parentCollectionIds ?? [],
24793
24768
  collection,