@almadar/ui 4.21.0 → 4.22.1
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/avl/index.cjs +17 -13
- package/dist/avl/index.js +17 -13
- package/dist/components/index.cjs +17 -13
- package/dist/components/index.js +17 -13
- package/dist/components/molecules/Accordion.d.ts +5 -1
- package/dist/components/molecules/CalendarGrid.d.ts +8 -5
- package/dist/components/molecules/Card.d.ts +3 -3
- package/dist/components/molecules/Carousel.d.ts +4 -1
- package/dist/components/molecules/DataGrid.d.ts +9 -3
- package/dist/components/molecules/DataList.d.ts +9 -3
- package/dist/components/molecules/EmptyState.d.ts +2 -1
- package/dist/components/molecules/ErrorState.d.ts +2 -1
- package/dist/components/molecules/MapView.d.ts +7 -3
- package/dist/components/molecules/Modal.d.ts +2 -1
- package/dist/components/molecules/Pagination.d.ts +7 -2
- package/dist/components/molecules/SidePanel.d.ts +2 -1
- package/dist/components/molecules/Tabs.d.ts +4 -1
- package/dist/components/molecules/Toast.d.ts +3 -2
- package/dist/components/molecules/WizardProgress.d.ts +4 -1
- package/dist/components/molecules/game/ActionButtons.d.ts +5 -1
- package/dist/components/molecules/game/CraftingRecipe.d.ts +4 -1
- package/dist/components/molecules/game/DPad.d.ts +5 -1
- package/dist/components/molecules/game/DialogueBox.d.ts +7 -5
- package/dist/components/molecules/game/InventoryGrid.d.ts +4 -1
- package/dist/components/molecules/game/InventoryPanel.d.ts +12 -6
- package/dist/components/molecules/game/IsometricCanvas.d.ts +13 -4
- package/dist/components/molecules/game/PlatformerCanvas.d.ts +9 -4
- package/dist/components/organisms/GraphCanvas.d.ts +4 -2
- package/dist/components/organisms/MediaGallery.d.ts +4 -1
- package/dist/components/organisms/PageHeader.d.ts +2 -1
- package/dist/components/organisms/Sidebar.d.ts +6 -3
- package/dist/components/organisms/SignaturePad.d.ts +5 -2
- package/dist/components/organisms/game/BattleBoard.d.ts +20 -8
- package/dist/components/organisms/game/CanvasEffect.d.ts +2 -1
- package/dist/components/organisms/game/CastleBoard.d.ts +14 -3
- package/dist/components/organisms/game/GameCanvas3D.d.ts +52 -8
- package/dist/components/organisms/game/TraitSlot.d.ts +7 -2
- package/dist/components/organisms/game/WorldMapBoard.d.ts +22 -5
- package/dist/components/organisms/game/hooks/useBattleState.d.ts +19 -7
- package/dist/components/organisms/game/puzzles/builder/BuilderBoard.d.ts +5 -1
- package/dist/components/organisms/game/puzzles/classifier/ClassifierBoard.d.ts +5 -1
- package/dist/components/organisms/game/puzzles/debugger/DebuggerBoard.d.ts +5 -1
- package/dist/components/organisms/game/puzzles/event-handler/EventHandlerBoard.d.ts +5 -2
- package/dist/components/organisms/game/puzzles/negotiator/NegotiatorBoard.d.ts +5 -1
- package/dist/components/organisms/game/puzzles/sequencer/SequencerBoard.d.ts +8 -2
- package/dist/components/organisms/game/puzzles/simulator/SimulatorBoard.d.ts +5 -1
- package/dist/components/organisms/game/puzzles/state-architect/StateArchitectBoard.d.ts +6 -2
- package/dist/components/organisms/game/three/hooks/useGameCanvas3DEvents.d.ts +52 -8
- package/dist/providers/index.cjs +17 -13
- package/dist/providers/index.js +17 -13
- package/dist/runtime/index.cjs +17 -13
- package/dist/runtime/index.js +17 -13
- package/package.json +2 -2
|
@@ -1,12 +1,24 @@
|
|
|
1
|
+
import type { EventEmit } from '@almadar/core';
|
|
1
2
|
import type { BattleUnit, BattlePhase } from '../BattleBoard';
|
|
2
3
|
export interface BattleStateEventConfig {
|
|
3
|
-
tileClickEvent?:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
tileClickEvent?: EventEmit<{
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}>;
|
|
8
|
+
unitClickEvent?: EventEmit<{
|
|
9
|
+
unitId: string;
|
|
10
|
+
}>;
|
|
11
|
+
endTurnEvent?: EventEmit<Record<string, never>>;
|
|
12
|
+
cancelEvent?: EventEmit<Record<string, never>>;
|
|
13
|
+
gameEndEvent?: EventEmit<{
|
|
14
|
+
result: 'victory' | 'defeat';
|
|
15
|
+
}>;
|
|
16
|
+
playAgainEvent?: EventEmit<Record<string, never>>;
|
|
17
|
+
attackEvent?: EventEmit<{
|
|
18
|
+
attackerId: string;
|
|
19
|
+
targetId: string;
|
|
20
|
+
damage: number;
|
|
21
|
+
}>;
|
|
10
22
|
}
|
|
11
23
|
export interface BattleStateCallbacks {
|
|
12
24
|
/** Called when a unit attacks another */
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* Events emitted via completeEvent (default UI:PUZZLE_COMPLETE).
|
|
10
10
|
*/
|
|
11
11
|
import React from 'react';
|
|
12
|
+
import type { EventEmit } from '@almadar/core';
|
|
12
13
|
import type { EntityDisplayProps } from '../../../types';
|
|
13
14
|
export interface BuilderComponent {
|
|
14
15
|
id: string;
|
|
@@ -44,7 +45,10 @@ export interface BuilderPuzzleEntity {
|
|
|
44
45
|
}
|
|
45
46
|
export interface BuilderBoardProps extends Omit<EntityDisplayProps, 'entity'> {
|
|
46
47
|
entity: BuilderPuzzleEntity;
|
|
47
|
-
completeEvent?:
|
|
48
|
+
completeEvent?: EventEmit<{
|
|
49
|
+
success: boolean;
|
|
50
|
+
attempts: number;
|
|
51
|
+
}>;
|
|
48
52
|
}
|
|
49
53
|
export declare function BuilderBoard({ entity, completeEvent, className, }: BuilderBoardProps): React.JSX.Element;
|
|
50
54
|
export declare namespace BuilderBoard {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* Events emitted via completeEvent (default UI:PUZZLE_COMPLETE).
|
|
11
11
|
*/
|
|
12
12
|
import React from 'react';
|
|
13
|
+
import type { EventEmit } from '@almadar/core';
|
|
13
14
|
import type { EntityDisplayProps } from '../../../types';
|
|
14
15
|
export interface ClassifierItem {
|
|
15
16
|
id: string;
|
|
@@ -45,7 +46,10 @@ export interface ClassifierPuzzleEntity {
|
|
|
45
46
|
}
|
|
46
47
|
export interface ClassifierBoardProps extends Omit<EntityDisplayProps, 'entity'> {
|
|
47
48
|
entity: ClassifierPuzzleEntity;
|
|
48
|
-
completeEvent?:
|
|
49
|
+
completeEvent?: EventEmit<{
|
|
50
|
+
success: boolean;
|
|
51
|
+
attempts: number;
|
|
52
|
+
}>;
|
|
49
53
|
}
|
|
50
54
|
export declare function ClassifierBoard({ entity, completeEvent, className, }: ClassifierBoardProps): React.JSX.Element;
|
|
51
55
|
export declare namespace ClassifierBoard {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* Events emitted via completeEvent (default UI:PUZZLE_COMPLETE).
|
|
10
10
|
*/
|
|
11
11
|
import React from 'react';
|
|
12
|
+
import type { EventEmit } from '@almadar/core';
|
|
12
13
|
import type { EntityDisplayProps } from '../../../types';
|
|
13
14
|
export interface DebuggerLine {
|
|
14
15
|
id: string;
|
|
@@ -37,7 +38,10 @@ export interface DebuggerPuzzleEntity {
|
|
|
37
38
|
}
|
|
38
39
|
export interface DebuggerBoardProps extends Omit<EntityDisplayProps, 'entity'> {
|
|
39
40
|
entity: DebuggerPuzzleEntity;
|
|
40
|
-
completeEvent?:
|
|
41
|
+
completeEvent?: EventEmit<{
|
|
42
|
+
success: boolean;
|
|
43
|
+
attempts: number;
|
|
44
|
+
}>;
|
|
41
45
|
}
|
|
42
46
|
export declare function DebuggerBoard({ entity, completeEvent, className, }: DebuggerBoardProps): React.JSX.Element;
|
|
43
47
|
export declare namespace DebuggerBoard {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* @packageDocumentation
|
|
12
12
|
*/
|
|
13
13
|
import React from 'react';
|
|
14
|
+
import type { EventEmit } from '@almadar/core';
|
|
14
15
|
import type { EntityDisplayProps } from '../../../types';
|
|
15
16
|
import { type PuzzleObjectDef } from './ObjectRulePanel';
|
|
16
17
|
export interface EventHandlerPuzzleEntity {
|
|
@@ -44,9 +45,11 @@ export interface EventHandlerBoardProps extends Omit<EntityDisplayProps, 'entity
|
|
|
44
45
|
/** Playback speed in ms per event */
|
|
45
46
|
stepDurationMs?: number;
|
|
46
47
|
/** Emits UI:{playEvent} */
|
|
47
|
-
playEvent?: string
|
|
48
|
+
playEvent?: EventEmit<Record<string, never>>;
|
|
48
49
|
/** Emits UI:{completeEvent} with { success } */
|
|
49
|
-
completeEvent?:
|
|
50
|
+
completeEvent?: EventEmit<{
|
|
51
|
+
success: boolean;
|
|
52
|
+
}>;
|
|
50
53
|
}
|
|
51
54
|
export declare function EventHandlerBoard({ entity, stepDurationMs, playEvent, completeEvent, className, }: EventHandlerBoardProps): React.JSX.Element;
|
|
52
55
|
export declare namespace EventHandlerBoard {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* Events emitted via completeEvent (default UI:PUZZLE_COMPLETE).
|
|
12
12
|
*/
|
|
13
13
|
import React from 'react';
|
|
14
|
+
import type { EventEmit } from '@almadar/core';
|
|
14
15
|
import type { EntityDisplayProps } from '../../../types';
|
|
15
16
|
export interface NegotiatorAction {
|
|
16
17
|
id: string;
|
|
@@ -46,7 +47,10 @@ export interface NegotiatorPuzzleEntity {
|
|
|
46
47
|
}
|
|
47
48
|
export interface NegotiatorBoardProps extends Omit<EntityDisplayProps, 'entity'> {
|
|
48
49
|
entity: NegotiatorPuzzleEntity;
|
|
49
|
-
completeEvent?:
|
|
50
|
+
completeEvent?: EventEmit<{
|
|
51
|
+
success: boolean;
|
|
52
|
+
score: number;
|
|
53
|
+
}>;
|
|
50
54
|
}
|
|
51
55
|
export declare function NegotiatorBoard({ entity, completeEvent, className, }: NegotiatorBoardProps): React.JSX.Element;
|
|
52
56
|
export declare namespace NegotiatorBoard {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* @packageDocumentation
|
|
19
19
|
*/
|
|
20
20
|
import React from 'react';
|
|
21
|
+
import type { EventEmit } from '@almadar/core';
|
|
21
22
|
import type { SlotItemData } from '../../TraitSlot';
|
|
22
23
|
import type { EntityDisplayProps } from '../../../types';
|
|
23
24
|
export interface SequencerPuzzleEntity {
|
|
@@ -61,9 +62,14 @@ export interface SequencerBoardProps extends Omit<EntityDisplayProps, 'entity'>
|
|
|
61
62
|
/** Playback speed in ms per step */
|
|
62
63
|
stepDurationMs?: number;
|
|
63
64
|
/** Emits UI:{playEvent} with { sequence: string[] } */
|
|
64
|
-
playEvent?:
|
|
65
|
+
playEvent?: EventEmit<{
|
|
66
|
+
sequence: string[];
|
|
67
|
+
}>;
|
|
65
68
|
/** Emits UI:{completeEvent} with { success: boolean } */
|
|
66
|
-
completeEvent?:
|
|
69
|
+
completeEvent?: EventEmit<{
|
|
70
|
+
success: boolean;
|
|
71
|
+
sequence: string[];
|
|
72
|
+
}>;
|
|
67
73
|
}
|
|
68
74
|
export declare function SequencerBoard({ entity, categoryColors, stepDurationMs, playEvent, completeEvent, className, }: SequencerBoardProps): React.JSX.Element;
|
|
69
75
|
export declare namespace SequencerBoard {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* Events emitted via completeEvent (default UI:PUZZLE_COMPLETE).
|
|
11
11
|
*/
|
|
12
12
|
import React from 'react';
|
|
13
|
+
import type { EventEmit } from '@almadar/core';
|
|
13
14
|
import type { EntityDisplayProps } from '../../../types';
|
|
14
15
|
export interface SimulatorParameter {
|
|
15
16
|
id: string;
|
|
@@ -46,7 +47,10 @@ export interface SimulatorPuzzleEntity {
|
|
|
46
47
|
}
|
|
47
48
|
export interface SimulatorBoardProps extends Omit<EntityDisplayProps, 'entity'> {
|
|
48
49
|
entity: SimulatorPuzzleEntity;
|
|
49
|
-
completeEvent?:
|
|
50
|
+
completeEvent?: EventEmit<{
|
|
51
|
+
success: boolean;
|
|
52
|
+
attempts: number;
|
|
53
|
+
}>;
|
|
50
54
|
}
|
|
51
55
|
export declare function SimulatorBoard({ entity, completeEvent, className, }: SimulatorBoardProps): React.JSX.Element;
|
|
52
56
|
export declare namespace SimulatorBoard {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
10
|
import React from 'react';
|
|
11
|
+
import type { EventEmit } from '@almadar/core';
|
|
11
12
|
import type { EntityDisplayProps } from '../../../types';
|
|
12
13
|
import { type VariableDef } from './VariablePanel';
|
|
13
14
|
export interface StateArchitectTransition {
|
|
@@ -65,9 +66,12 @@ export interface StateArchitectBoardProps extends Omit<EntityDisplayProps, 'enti
|
|
|
65
66
|
/** Playback speed */
|
|
66
67
|
stepDurationMs?: number;
|
|
67
68
|
/** Emits UI:{testEvent} */
|
|
68
|
-
testEvent?: string
|
|
69
|
+
testEvent?: EventEmit<Record<string, never>>;
|
|
69
70
|
/** Emits UI:{completeEvent} with { success, passedTests } */
|
|
70
|
-
completeEvent?:
|
|
71
|
+
completeEvent?: EventEmit<{
|
|
72
|
+
success: boolean;
|
|
73
|
+
passedTests: number;
|
|
74
|
+
}>;
|
|
71
75
|
}
|
|
72
76
|
export declare function StateArchitectBoard({ entity, stepDurationMs, testEvent, completeEvent, className, }: StateArchitectBoardProps): React.JSX.Element;
|
|
73
77
|
export declare namespace StateArchitectBoard {
|
|
@@ -1,21 +1,65 @@
|
|
|
1
|
+
import type { EventEmit } from '@almadar/core';
|
|
1
2
|
import type { IsometricTile, IsometricUnit, IsometricFeature } from '../../types/isometric';
|
|
2
3
|
export interface GameCanvas3DEventConfig {
|
|
3
4
|
/** Event name for tile clicks */
|
|
4
|
-
tileClickEvent?:
|
|
5
|
+
tileClickEvent?: EventEmit<{
|
|
6
|
+
tileId: string;
|
|
7
|
+
x: number;
|
|
8
|
+
z: number;
|
|
9
|
+
type?: string;
|
|
10
|
+
terrain?: string;
|
|
11
|
+
elevation?: number;
|
|
12
|
+
}>;
|
|
5
13
|
/** Event name for unit clicks */
|
|
6
|
-
unitClickEvent?:
|
|
14
|
+
unitClickEvent?: EventEmit<{
|
|
15
|
+
unitId: string;
|
|
16
|
+
x: number;
|
|
17
|
+
z: number;
|
|
18
|
+
unitType?: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
team?: string;
|
|
21
|
+
faction?: string;
|
|
22
|
+
health?: number;
|
|
23
|
+
maxHealth?: number;
|
|
24
|
+
}>;
|
|
7
25
|
/** Event name for feature clicks */
|
|
8
|
-
featureClickEvent?:
|
|
26
|
+
featureClickEvent?: EventEmit<{
|
|
27
|
+
featureId: string;
|
|
28
|
+
x: number;
|
|
29
|
+
z: number;
|
|
30
|
+
type?: string;
|
|
31
|
+
elevation?: number;
|
|
32
|
+
}>;
|
|
9
33
|
/** Event name for canvas clicks */
|
|
10
|
-
canvasClickEvent?:
|
|
34
|
+
canvasClickEvent?: EventEmit<{
|
|
35
|
+
clientX: number;
|
|
36
|
+
clientY: number;
|
|
37
|
+
button: number;
|
|
38
|
+
}>;
|
|
11
39
|
/** Event name for tile hover */
|
|
12
|
-
tileHoverEvent?:
|
|
40
|
+
tileHoverEvent?: EventEmit<{
|
|
41
|
+
tileId: string;
|
|
42
|
+
x: number;
|
|
43
|
+
z: number;
|
|
44
|
+
type?: string;
|
|
45
|
+
}>;
|
|
13
46
|
/** Event name for tile leave */
|
|
14
|
-
tileLeaveEvent?: string
|
|
47
|
+
tileLeaveEvent?: EventEmit<Record<string, never>>;
|
|
15
48
|
/** Event name for unit animation changes */
|
|
16
|
-
unitAnimationEvent?:
|
|
49
|
+
unitAnimationEvent?: EventEmit<{
|
|
50
|
+
unitId: string;
|
|
51
|
+
state: string;
|
|
52
|
+
timestamp: number;
|
|
53
|
+
}>;
|
|
17
54
|
/** Event name for camera changes */
|
|
18
|
-
cameraChangeEvent?:
|
|
55
|
+
cameraChangeEvent?: EventEmit<{
|
|
56
|
+
position: {
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
z: number;
|
|
60
|
+
};
|
|
61
|
+
timestamp: number;
|
|
62
|
+
}>;
|
|
19
63
|
}
|
|
20
64
|
/** Minimal mouse event interface — satisfied by both React.MouseEvent and ThreeEvent<MouseEvent> */
|
|
21
65
|
export interface MinimalMouseEvent {
|
package/dist/providers/index.cjs
CHANGED
|
@@ -18692,6 +18692,7 @@ function formatValue(value, format) {
|
|
|
18692
18692
|
function DataGrid({
|
|
18693
18693
|
entity,
|
|
18694
18694
|
fields,
|
|
18695
|
+
columns,
|
|
18695
18696
|
itemActions,
|
|
18696
18697
|
cols,
|
|
18697
18698
|
gap = "md",
|
|
@@ -18713,6 +18714,7 @@ function DataGrid({
|
|
|
18713
18714
|
const { t } = useTranslate();
|
|
18714
18715
|
const [selectedIds, setSelectedIds] = React115.useState(/* @__PURE__ */ new Set());
|
|
18715
18716
|
const [visibleCount, setVisibleCount] = React115.useState(pageSize || Infinity);
|
|
18717
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
18716
18718
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
18717
18719
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
18718
18720
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -18740,9 +18742,9 @@ function DataGrid({
|
|
|
18740
18742
|
return next;
|
|
18741
18743
|
});
|
|
18742
18744
|
}, [data, selectionEvent, eventBus]);
|
|
18743
|
-
const titleField =
|
|
18744
|
-
const badgeFields =
|
|
18745
|
-
const bodyFields =
|
|
18745
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
18746
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
18747
|
+
const bodyFields = fieldDefs.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
|
|
18746
18748
|
const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
|
|
18747
18749
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
18748
18750
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -18755,7 +18757,7 @@ function DataGrid({
|
|
|
18755
18757
|
};
|
|
18756
18758
|
const hasRenderProp = typeof children === "function";
|
|
18757
18759
|
React115.useEffect(() => {
|
|
18758
|
-
if (data.length > 0 && !hasRenderProp &&
|
|
18760
|
+
if (data.length > 0 && !hasRenderProp && fieldDefs.length === 0) {
|
|
18759
18761
|
const renderItemRaw = schemaRenderItem;
|
|
18760
18762
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
18761
18763
|
dataGridLog.warn("renderItem-unresolved", {
|
|
@@ -18763,7 +18765,7 @@ function DataGrid({
|
|
|
18763
18765
|
renderItemIsFnLambda: isFnLambda
|
|
18764
18766
|
});
|
|
18765
18767
|
}
|
|
18766
|
-
}, [data, hasRenderProp, schemaRenderItem,
|
|
18768
|
+
}, [data, hasRenderProp, schemaRenderItem, fieldDefs]);
|
|
18767
18769
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
18768
18770
|
const colsClass = cols ? {
|
|
18769
18771
|
1: "grid-cols-1",
|
|
@@ -19068,6 +19070,7 @@ function groupData(items, field) {
|
|
|
19068
19070
|
function DataList({
|
|
19069
19071
|
entity,
|
|
19070
19072
|
fields,
|
|
19073
|
+
columns,
|
|
19071
19074
|
itemActions,
|
|
19072
19075
|
gap = "none",
|
|
19073
19076
|
variant = "default",
|
|
@@ -19097,6 +19100,7 @@ function DataList({
|
|
|
19097
19100
|
const eventBus = useEventBus();
|
|
19098
19101
|
const { t } = useTranslate();
|
|
19099
19102
|
const [visibleCount, setVisibleCount] = React115__namespace.default.useState(pageSize || Infinity);
|
|
19103
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
19100
19104
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
19101
19105
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
19102
19106
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -19111,7 +19115,7 @@ function DataList({
|
|
|
19111
19115
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
19112
19116
|
dataListLog.warn("renderItem-unresolved", {
|
|
19113
19117
|
rowCount: data.length,
|
|
19114
|
-
fieldsCount:
|
|
19118
|
+
fieldsCount: fieldDefs.length,
|
|
19115
19119
|
renderItemTypeOf,
|
|
19116
19120
|
renderItemIsArray: Array.isArray(renderItemRaw),
|
|
19117
19121
|
renderItemIsFnLambda: isFnLambda,
|
|
@@ -19120,11 +19124,11 @@ function DataList({
|
|
|
19120
19124
|
sampleRowKeys: sampleKeys
|
|
19121
19125
|
});
|
|
19122
19126
|
}
|
|
19123
|
-
}, [data, hasRenderProp, schemaRenderItem, children,
|
|
19124
|
-
const titleField =
|
|
19125
|
-
const badgeFields =
|
|
19126
|
-
const progressFields =
|
|
19127
|
-
const bodyFields =
|
|
19127
|
+
}, [data, hasRenderProp, schemaRenderItem, children, fieldDefs]);
|
|
19128
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
19129
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
19130
|
+
const progressFields = fieldDefs.filter((f3) => f3.variant === "progress");
|
|
19131
|
+
const bodyFields = fieldDefs.filter(
|
|
19128
19132
|
(f3) => f3 !== titleField && !badgeFields.includes(f3) && !progressFields.includes(f3)
|
|
19129
19133
|
);
|
|
19130
19134
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -19156,7 +19160,7 @@ function DataList({
|
|
|
19156
19160
|
if (isMessage) {
|
|
19157
19161
|
const items2 = data.map((item) => item);
|
|
19158
19162
|
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
19159
|
-
const contentField = titleField?.name ??
|
|
19163
|
+
const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
|
|
19160
19164
|
return /* @__PURE__ */ jsxRuntime.jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxRuntime.jsxs(React115__namespace.default.Fragment, { children: [
|
|
19161
19165
|
group.label && /* @__PURE__ */ jsxRuntime.jsx(Divider, { label: group.label, className: "my-2" }),
|
|
19162
19166
|
group.items.map((itemData, index) => {
|
|
@@ -19164,7 +19168,7 @@ function DataList({
|
|
|
19164
19168
|
const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
|
|
19165
19169
|
const isSent = Boolean(currentUser && sender === currentUser);
|
|
19166
19170
|
const content = getNestedValue(itemData, contentField);
|
|
19167
|
-
const timestampField =
|
|
19171
|
+
const timestampField = fieldDefs.find((f3) => f3.format === "date");
|
|
19168
19172
|
const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
|
|
19169
19173
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19170
19174
|
Box,
|
package/dist/providers/index.js
CHANGED
|
@@ -18647,6 +18647,7 @@ function formatValue(value, format) {
|
|
|
18647
18647
|
function DataGrid({
|
|
18648
18648
|
entity,
|
|
18649
18649
|
fields,
|
|
18650
|
+
columns,
|
|
18650
18651
|
itemActions,
|
|
18651
18652
|
cols,
|
|
18652
18653
|
gap = "md",
|
|
@@ -18668,6 +18669,7 @@ function DataGrid({
|
|
|
18668
18669
|
const { t } = useTranslate();
|
|
18669
18670
|
const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
|
|
18670
18671
|
const [visibleCount, setVisibleCount] = useState(pageSize || Infinity);
|
|
18672
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
18671
18673
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
18672
18674
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
18673
18675
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -18695,9 +18697,9 @@ function DataGrid({
|
|
|
18695
18697
|
return next;
|
|
18696
18698
|
});
|
|
18697
18699
|
}, [data, selectionEvent, eventBus]);
|
|
18698
|
-
const titleField =
|
|
18699
|
-
const badgeFields =
|
|
18700
|
-
const bodyFields =
|
|
18700
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
18701
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
18702
|
+
const bodyFields = fieldDefs.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
|
|
18701
18703
|
const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
|
|
18702
18704
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
18703
18705
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -18710,7 +18712,7 @@ function DataGrid({
|
|
|
18710
18712
|
};
|
|
18711
18713
|
const hasRenderProp = typeof children === "function";
|
|
18712
18714
|
useEffect(() => {
|
|
18713
|
-
if (data.length > 0 && !hasRenderProp &&
|
|
18715
|
+
if (data.length > 0 && !hasRenderProp && fieldDefs.length === 0) {
|
|
18714
18716
|
const renderItemRaw = schemaRenderItem;
|
|
18715
18717
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
18716
18718
|
dataGridLog.warn("renderItem-unresolved", {
|
|
@@ -18718,7 +18720,7 @@ function DataGrid({
|
|
|
18718
18720
|
renderItemIsFnLambda: isFnLambda
|
|
18719
18721
|
});
|
|
18720
18722
|
}
|
|
18721
|
-
}, [data, hasRenderProp, schemaRenderItem,
|
|
18723
|
+
}, [data, hasRenderProp, schemaRenderItem, fieldDefs]);
|
|
18722
18724
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
18723
18725
|
const colsClass = cols ? {
|
|
18724
18726
|
1: "grid-cols-1",
|
|
@@ -19023,6 +19025,7 @@ function groupData(items, field) {
|
|
|
19023
19025
|
function DataList({
|
|
19024
19026
|
entity,
|
|
19025
19027
|
fields,
|
|
19028
|
+
columns,
|
|
19026
19029
|
itemActions,
|
|
19027
19030
|
gap = "none",
|
|
19028
19031
|
variant = "default",
|
|
@@ -19052,6 +19055,7 @@ function DataList({
|
|
|
19052
19055
|
const eventBus = useEventBus();
|
|
19053
19056
|
const { t } = useTranslate();
|
|
19054
19057
|
const [visibleCount, setVisibleCount] = React115__default.useState(pageSize || Infinity);
|
|
19058
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
19055
19059
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
19056
19060
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
19057
19061
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -19066,7 +19070,7 @@ function DataList({
|
|
|
19066
19070
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
19067
19071
|
dataListLog.warn("renderItem-unresolved", {
|
|
19068
19072
|
rowCount: data.length,
|
|
19069
|
-
fieldsCount:
|
|
19073
|
+
fieldsCount: fieldDefs.length,
|
|
19070
19074
|
renderItemTypeOf,
|
|
19071
19075
|
renderItemIsArray: Array.isArray(renderItemRaw),
|
|
19072
19076
|
renderItemIsFnLambda: isFnLambda,
|
|
@@ -19075,11 +19079,11 @@ function DataList({
|
|
|
19075
19079
|
sampleRowKeys: sampleKeys
|
|
19076
19080
|
});
|
|
19077
19081
|
}
|
|
19078
|
-
}, [data, hasRenderProp, schemaRenderItem, children,
|
|
19079
|
-
const titleField =
|
|
19080
|
-
const badgeFields =
|
|
19081
|
-
const progressFields =
|
|
19082
|
-
const bodyFields =
|
|
19082
|
+
}, [data, hasRenderProp, schemaRenderItem, children, fieldDefs]);
|
|
19083
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
19084
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
19085
|
+
const progressFields = fieldDefs.filter((f3) => f3.variant === "progress");
|
|
19086
|
+
const bodyFields = fieldDefs.filter(
|
|
19083
19087
|
(f3) => f3 !== titleField && !badgeFields.includes(f3) && !progressFields.includes(f3)
|
|
19084
19088
|
);
|
|
19085
19089
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -19111,7 +19115,7 @@ function DataList({
|
|
|
19111
19115
|
if (isMessage) {
|
|
19112
19116
|
const items2 = data.map((item) => item);
|
|
19113
19117
|
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
19114
|
-
const contentField = titleField?.name ??
|
|
19118
|
+
const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
|
|
19115
19119
|
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React115__default.Fragment, { children: [
|
|
19116
19120
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
|
|
19117
19121
|
group.items.map((itemData, index) => {
|
|
@@ -19119,7 +19123,7 @@ function DataList({
|
|
|
19119
19123
|
const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
|
|
19120
19124
|
const isSent = Boolean(currentUser && sender === currentUser);
|
|
19121
19125
|
const content = getNestedValue(itemData, contentField);
|
|
19122
|
-
const timestampField =
|
|
19126
|
+
const timestampField = fieldDefs.find((f3) => f3.format === "date");
|
|
19123
19127
|
const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
|
|
19124
19128
|
return /* @__PURE__ */ jsx(
|
|
19125
19129
|
Box,
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -18468,6 +18468,7 @@ function formatValue(value, format) {
|
|
|
18468
18468
|
function DataGrid({
|
|
18469
18469
|
entity,
|
|
18470
18470
|
fields,
|
|
18471
|
+
columns,
|
|
18471
18472
|
itemActions,
|
|
18472
18473
|
cols,
|
|
18473
18474
|
gap = "md",
|
|
@@ -18489,6 +18490,7 @@ function DataGrid({
|
|
|
18489
18490
|
const { t } = useTranslate();
|
|
18490
18491
|
const [selectedIds, setSelectedIds] = React113.useState(/* @__PURE__ */ new Set());
|
|
18491
18492
|
const [visibleCount, setVisibleCount] = React113.useState(pageSize || Infinity);
|
|
18493
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
18492
18494
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
18493
18495
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
18494
18496
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -18516,9 +18518,9 @@ function DataGrid({
|
|
|
18516
18518
|
return next;
|
|
18517
18519
|
});
|
|
18518
18520
|
}, [data, selectionEvent, eventBus]);
|
|
18519
|
-
const titleField =
|
|
18520
|
-
const badgeFields =
|
|
18521
|
-
const bodyFields =
|
|
18521
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
18522
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
18523
|
+
const bodyFields = fieldDefs.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
|
|
18522
18524
|
const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
|
|
18523
18525
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
18524
18526
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -18531,7 +18533,7 @@ function DataGrid({
|
|
|
18531
18533
|
};
|
|
18532
18534
|
const hasRenderProp = typeof children === "function";
|
|
18533
18535
|
React113.useEffect(() => {
|
|
18534
|
-
if (data.length > 0 && !hasRenderProp &&
|
|
18536
|
+
if (data.length > 0 && !hasRenderProp && fieldDefs.length === 0) {
|
|
18535
18537
|
const renderItemRaw = schemaRenderItem;
|
|
18536
18538
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
18537
18539
|
dataGridLog.warn("renderItem-unresolved", {
|
|
@@ -18539,7 +18541,7 @@ function DataGrid({
|
|
|
18539
18541
|
renderItemIsFnLambda: isFnLambda
|
|
18540
18542
|
});
|
|
18541
18543
|
}
|
|
18542
|
-
}, [data, hasRenderProp, schemaRenderItem,
|
|
18544
|
+
}, [data, hasRenderProp, schemaRenderItem, fieldDefs]);
|
|
18543
18545
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
18544
18546
|
const colsClass = cols ? {
|
|
18545
18547
|
1: "grid-cols-1",
|
|
@@ -18844,6 +18846,7 @@ function groupData(items, field) {
|
|
|
18844
18846
|
function DataList({
|
|
18845
18847
|
entity,
|
|
18846
18848
|
fields,
|
|
18849
|
+
columns,
|
|
18847
18850
|
itemActions,
|
|
18848
18851
|
gap = "none",
|
|
18849
18852
|
variant = "default",
|
|
@@ -18873,6 +18876,7 @@ function DataList({
|
|
|
18873
18876
|
const eventBus = useEventBus();
|
|
18874
18877
|
const { t } = useTranslate();
|
|
18875
18878
|
const [visibleCount, setVisibleCount] = React113__namespace.default.useState(pageSize || Infinity);
|
|
18879
|
+
const fieldDefs = fields ?? columns ?? [];
|
|
18876
18880
|
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
18877
18881
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
18878
18882
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
@@ -18887,7 +18891,7 @@ function DataList({
|
|
|
18887
18891
|
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
18888
18892
|
dataListLog.warn("renderItem-unresolved", {
|
|
18889
18893
|
rowCount: data.length,
|
|
18890
|
-
fieldsCount:
|
|
18894
|
+
fieldsCount: fieldDefs.length,
|
|
18891
18895
|
renderItemTypeOf,
|
|
18892
18896
|
renderItemIsArray: Array.isArray(renderItemRaw),
|
|
18893
18897
|
renderItemIsFnLambda: isFnLambda,
|
|
@@ -18896,11 +18900,11 @@ function DataList({
|
|
|
18896
18900
|
sampleRowKeys: sampleKeys
|
|
18897
18901
|
});
|
|
18898
18902
|
}
|
|
18899
|
-
}, [data, hasRenderProp, schemaRenderItem, children,
|
|
18900
|
-
const titleField =
|
|
18901
|
-
const badgeFields =
|
|
18902
|
-
const progressFields =
|
|
18903
|
-
const bodyFields =
|
|
18903
|
+
}, [data, hasRenderProp, schemaRenderItem, children, fieldDefs]);
|
|
18904
|
+
const titleField = fieldDefs.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fieldDefs[0];
|
|
18905
|
+
const badgeFields = fieldDefs.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
18906
|
+
const progressFields = fieldDefs.filter((f3) => f3.variant === "progress");
|
|
18907
|
+
const bodyFields = fieldDefs.filter(
|
|
18904
18908
|
(f3) => f3 !== titleField && !badgeFields.includes(f3) && !progressFields.includes(f3)
|
|
18905
18909
|
);
|
|
18906
18910
|
const handleActionClick = (action, itemData) => (e) => {
|
|
@@ -18932,7 +18936,7 @@ function DataList({
|
|
|
18932
18936
|
if (isMessage) {
|
|
18933
18937
|
const items2 = data.map((item) => item);
|
|
18934
18938
|
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
18935
|
-
const contentField = titleField?.name ??
|
|
18939
|
+
const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
|
|
18936
18940
|
return /* @__PURE__ */ jsxRuntime.jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxRuntime.jsxs(React113__namespace.default.Fragment, { children: [
|
|
18937
18941
|
group.label && /* @__PURE__ */ jsxRuntime.jsx(Divider, { label: group.label, className: "my-2" }),
|
|
18938
18942
|
group.items.map((itemData, index) => {
|
|
@@ -18940,7 +18944,7 @@ function DataList({
|
|
|
18940
18944
|
const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
|
|
18941
18945
|
const isSent = Boolean(currentUser && sender === currentUser);
|
|
18942
18946
|
const content = getNestedValue(itemData, contentField);
|
|
18943
|
-
const timestampField =
|
|
18947
|
+
const timestampField = fieldDefs.find((f3) => f3.format === "date");
|
|
18944
18948
|
const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
|
|
18945
18949
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18946
18950
|
Box,
|