@carto/ps-react-ui 4.4.2 → 4.5.0
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/download-config-DemuQ3Jm.js +56 -0
- package/dist/download-config-DemuQ3Jm.js.map +1 -0
- package/dist/error-Cj8eUMrl.js +40 -0
- package/dist/error-Cj8eUMrl.js.map +1 -0
- package/dist/formatter-B9Bxn1k7.js +6 -0
- package/dist/formatter-B9Bxn1k7.js.map +1 -0
- package/dist/no-data-DkIt7Qt1.js +61 -0
- package/dist/no-data-DkIt7Qt1.js.map +1 -0
- package/dist/row-D4VOhcNI.js +34 -0
- package/dist/row-D4VOhcNI.js.map +1 -0
- package/dist/series-Bola3CmD.js +90 -0
- package/dist/series-Bola3CmD.js.map +1 -0
- package/dist/styles-Y8q7Jff3.js +118 -0
- package/dist/styles-Y8q7Jff3.js.map +1 -0
- package/dist/types/widgets/actions/brush-toggle/types.d.ts +8 -2
- package/dist/types/widgets/category/components/category-row-multi.d.ts +2 -1
- package/dist/types/widgets/category/components/category-row-single.d.ts +2 -1
- package/dist/types/widgets/category/types.d.ts +1 -0
- package/dist/types/widgets/echart/shared-resize-observer.d.ts +12 -0
- package/dist/types/widgets/echart/types.d.ts +2 -0
- package/dist/types/widgets/histogram/config.d.ts +15 -3
- package/dist/types/widgets/histogram/index.d.ts +2 -1
- package/dist/types/widgets/histogram/types.d.ts +6 -3
- package/dist/types/widgets/stores/index.d.ts +2 -1
- package/dist/types/widgets/stores/types.d.ts +2 -0
- package/dist/types/widgets/stores/use-widget-selector.d.ts +35 -0
- package/dist/types/widgets/stores/widget-store-performance.test.d.ts +1 -0
- package/dist/types/widgets/stores/widget-store.d.ts +49 -27
- package/dist/types/widgets/table/types.d.ts +1 -1
- package/dist/types/widgets/utils/chart-config/index.d.ts +1 -1
- package/dist/types/widgets/utils/chart-config/option-builders.d.ts +13 -8
- package/dist/types/widgets/utils/formatter.d.ts +1 -0
- package/dist/types/widgets/utils/index.d.ts +1 -1
- package/dist/use-widget-ref-BFazQvJK.js +22 -0
- package/dist/use-widget-ref-BFazQvJK.js.map +1 -0
- package/dist/use-widget-selector-DqRmWQ1K.js +12 -0
- package/dist/use-widget-selector-DqRmWQ1K.js.map +1 -0
- package/dist/widget-store-CIrb9RKP.js +263 -0
- package/dist/widget-store-CIrb9RKP.js.map +1 -0
- package/dist/widgets/actions.js +799 -817
- package/dist/widgets/actions.js.map +1 -1
- package/dist/widgets/bar.js +53 -47
- package/dist/widgets/bar.js.map +1 -1
- package/dist/widgets/category.js +261 -255
- package/dist/widgets/category.js.map +1 -1
- package/dist/widgets/echart.js +109 -99
- package/dist/widgets/echart.js.map +1 -1
- package/dist/widgets/error.js +1 -1
- package/dist/widgets/formula.js +71 -63
- package/dist/widgets/formula.js.map +1 -1
- package/dist/widgets/histogram.js +119 -80
- package/dist/widgets/histogram.js.map +1 -1
- package/dist/widgets/loader.js +53 -60
- package/dist/widgets/loader.js.map +1 -1
- package/dist/widgets/markdown.js +51 -50
- package/dist/widgets/markdown.js.map +1 -1
- package/dist/widgets/no-data.js +1 -1
- package/dist/widgets/pie.js +111 -99
- package/dist/widgets/pie.js.map +1 -1
- package/dist/widgets/range.js +146 -144
- package/dist/widgets/range.js.map +1 -1
- package/dist/widgets/scatterplot.js +50 -44
- package/dist/widgets/scatterplot.js.map +1 -1
- package/dist/widgets/skeleton-loader.js +18 -17
- package/dist/widgets/skeleton-loader.js.map +1 -1
- package/dist/widgets/spread.js +110 -94
- package/dist/widgets/spread.js.map +1 -1
- package/dist/widgets/stores.js +5 -2
- package/dist/widgets/stores.js.map +1 -1
- package/dist/widgets/table.js +422 -436
- package/dist/widgets/table.js.map +1 -1
- package/dist/widgets/timeseries.js +52 -46
- package/dist/widgets/timeseries.js.map +1 -1
- package/dist/widgets/toolbar-actions.js +101 -6693
- package/dist/widgets/toolbar-actions.js.map +1 -1
- package/dist/widgets/utils.js +16 -14
- package/dist/widgets/utils.js.map +1 -1
- package/dist/widgets/wrapper.js +156 -158
- package/dist/widgets/wrapper.js.map +1 -1
- package/dist/widgets.js +4 -4
- package/package.json +5 -4
- package/src/hooks/use-widget-ref.ts +3 -4
- package/src/widgets/README.md +3 -3
- package/src/widgets/actions/brush-toggle/brush-toggle.tsx +60 -79
- package/src/widgets/actions/brush-toggle/types.ts +8 -2
- package/src/widgets/actions/change-column/change-column.tsx +15 -15
- package/src/widgets/actions/change-column/sortable-column-item.tsx +3 -1
- package/src/widgets/actions/download/download.tsx +4 -3
- package/src/widgets/actions/fullscreen/fullscreen.tsx +7 -11
- package/src/widgets/actions/lock-selection/lock-selection.tsx +12 -15
- package/src/widgets/actions/relative-data/relative-data.tsx +22 -26
- package/src/widgets/actions/searcher/searcher-toggle.tsx +11 -12
- package/src/widgets/actions/searcher/searcher.tsx +20 -21
- package/src/widgets/actions/stack-toggle/stack-toggle.tsx +15 -21
- package/src/widgets/actions/zoom-toggle/zoom-toggle.tsx +27 -43
- package/src/widgets/bar/config.ts +22 -14
- package/src/widgets/category/category-ui.tsx +31 -27
- package/src/widgets/category/components/category-row-multi.tsx +6 -2
- package/src/widgets/category/components/category-row-single.tsx +5 -1
- package/src/widgets/category/types.ts +1 -0
- package/src/widgets/echart/echart-ui.test.tsx +20 -16
- package/src/widgets/echart/echart-ui.tsx +6 -12
- package/src/widgets/echart/echart.tsx +13 -27
- package/src/widgets/echart/shared-resize-observer.ts +45 -0
- package/src/widgets/echart/types.ts +2 -0
- package/src/widgets/error/error.tsx +7 -9
- package/src/widgets/formula/components/prefix.tsx +4 -6
- package/src/widgets/formula/components/row.tsx +4 -4
- package/src/widgets/formula/components/series.tsx +4 -6
- package/src/widgets/formula/components/suffix.tsx +4 -6
- package/src/widgets/formula/components/value.tsx +9 -16
- package/src/widgets/histogram/config.ts +101 -20
- package/src/widgets/histogram/index.ts +6 -1
- package/src/widgets/histogram/types.ts +9 -3
- package/src/widgets/loader/loader.tsx +31 -44
- package/src/widgets/markdown/markdown.tsx +4 -7
- package/src/widgets/no-data/no-data.tsx +7 -10
- package/src/widgets/pie/config.ts +17 -5
- package/src/widgets/range/components/range-item.tsx +20 -18
- package/src/widgets/scatterplot/config.ts +8 -3
- package/src/widgets/skeleton-loader/skeleton-loader.tsx +2 -5
- package/src/widgets/spread/components/max-value.tsx +14 -16
- package/src/widgets/spread/components/min-value.tsx +14 -16
- package/src/widgets/stores/index.ts +2 -1
- package/src/widgets/stores/types.ts +2 -0
- package/src/widgets/stores/use-widget-selector.ts +47 -0
- package/src/widgets/stores/widget-store-performance.test.ts +750 -0
- package/src/widgets/stores/widget-store.test.ts +81 -0
- package/src/widgets/stores/widget-store.ts +225 -44
- package/src/widgets/table/config.ts +0 -1
- package/src/widgets/table/hooks/use-pagination.ts +28 -52
- package/src/widgets/table/hooks/use-selection.ts +20 -24
- package/src/widgets/table/hooks/use-sort.ts +22 -39
- package/src/widgets/table/types.ts +1 -1
- package/src/widgets/timeseries/config.ts +21 -13
- package/src/widgets/utils/chart-config/index.ts +1 -1
- package/src/widgets/utils/chart-config/option-builders.ts +22 -12
- package/src/widgets/utils/formatter.ts +2 -1
- package/src/widgets/utils/index.ts +1 -1
- package/src/widgets/wrapper/wrapper-ui.tsx +12 -13
- package/src/widgets/wrapper/wrapper.tsx +4 -6
- package/dist/error-CEkRPccv.js +0 -39
- package/dist/error-CEkRPccv.js.map +0 -1
- package/dist/formatter-B1Xh8XDH.js +0 -5
- package/dist/formatter-B1Xh8XDH.js.map +0 -1
- package/dist/no-data-hR3KcJ-_.js +0 -60
- package/dist/no-data-hR3KcJ-_.js.map +0 -1
- package/dist/row-DTCV0Ocm.js +0 -35
- package/dist/row-DTCV0Ocm.js.map +0 -1
- package/dist/series-CYNOu2Ju.js +0 -91
- package/dist/series-CYNOu2Ju.js.map +0 -1
- package/dist/styles-C_8vOEep.js +0 -167
- package/dist/styles-C_8vOEep.js.map +0 -1
- package/dist/use-widget-ref-wtFLDFCD.js +0 -25
- package/dist/use-widget-ref-wtFLDFCD.js.map +0 -1
- package/dist/widget-store-CzDt8oSK.js +0 -163
- package/dist/widget-store-CzDt8oSK.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useMemo } from 'react'
|
|
2
2
|
import type { TableRow, TableWidgetState } from '../types'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { widgetStoreActions } from '../../stores/widget-store'
|
|
4
|
+
import { useWidgetSelector } from '../../stores/use-widget-selector'
|
|
5
5
|
|
|
6
6
|
export interface UseSelectionOptions {
|
|
7
7
|
/** Callback when selection changes */
|
|
@@ -48,14 +48,10 @@ export function useSelection(
|
|
|
48
48
|
): UseSelectionResult {
|
|
49
49
|
const { onSelectionChange } = options ?? {}
|
|
50
50
|
|
|
51
|
-
// Get store
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
useShallow((state) => {
|
|
56
|
-
const widget = state.widgets[widgetId] as TableWidgetState | undefined
|
|
57
|
-
return widget?.selected
|
|
58
|
-
}),
|
|
51
|
+
// Get store state
|
|
52
|
+
const selected = useWidgetSelector(
|
|
53
|
+
widgetId,
|
|
54
|
+
(w) => (w as TableWidgetState | undefined)?.selected,
|
|
59
55
|
)
|
|
60
56
|
|
|
61
57
|
// Use store values with fallback to empty array
|
|
@@ -91,14 +87,14 @@ export function useSelection(
|
|
|
91
87
|
// Toggle selection of a single row
|
|
92
88
|
const toggleRow = useCallback(
|
|
93
89
|
(id: string | number) => {
|
|
94
|
-
const widget = getWidget<TableWidgetState>(widgetId)
|
|
90
|
+
const widget = widgetStoreActions.getWidget<TableWidgetState>(widgetId)
|
|
95
91
|
const currentSelected = widget?.selected ?? []
|
|
96
92
|
|
|
97
93
|
const newSelected = currentSelected.includes(id)
|
|
98
94
|
? currentSelected.filter((s) => s !== id)
|
|
99
95
|
: [...currentSelected, id]
|
|
100
96
|
|
|
101
|
-
setWidget<TableWidgetState>(widgetId, {
|
|
97
|
+
widgetStoreActions.setWidget<TableWidgetState>(widgetId, {
|
|
102
98
|
selected: newSelected,
|
|
103
99
|
})
|
|
104
100
|
|
|
@@ -106,13 +102,13 @@ export function useSelection(
|
|
|
106
102
|
onSelectionChange(newSelected)
|
|
107
103
|
}
|
|
108
104
|
},
|
|
109
|
-
[
|
|
105
|
+
[widgetId, onSelectionChange],
|
|
110
106
|
)
|
|
111
107
|
|
|
112
108
|
// Toggle selection of all provided rows
|
|
113
109
|
const toggleAll = useCallback(
|
|
114
110
|
(rows: TableRow[]) => {
|
|
115
|
-
const widget = getWidget<TableWidgetState>(widgetId)
|
|
111
|
+
const widget = widgetStoreActions.getWidget<TableWidgetState>(widgetId)
|
|
116
112
|
const currentSelected = widget?.selected ?? []
|
|
117
113
|
|
|
118
114
|
const rowIds = rows.map((row) => row.id)
|
|
@@ -122,7 +118,7 @@ export function useSelection(
|
|
|
122
118
|
? currentSelected.filter((id) => !rowIds.includes(id))
|
|
123
119
|
: [...new Set([...currentSelected, ...rowIds])]
|
|
124
120
|
|
|
125
|
-
setWidget<TableWidgetState>(widgetId, {
|
|
121
|
+
widgetStoreActions.setWidget<TableWidgetState>(widgetId, {
|
|
126
122
|
selected: newSelected,
|
|
127
123
|
})
|
|
128
124
|
|
|
@@ -130,18 +126,18 @@ export function useSelection(
|
|
|
130
126
|
onSelectionChange(newSelected)
|
|
131
127
|
}
|
|
132
128
|
},
|
|
133
|
-
[
|
|
129
|
+
[widgetId, onSelectionChange],
|
|
134
130
|
)
|
|
135
131
|
|
|
136
132
|
// Select specific rows
|
|
137
133
|
const selectRows = useCallback(
|
|
138
134
|
(ids: (string | number)[]) => {
|
|
139
|
-
const widget = getWidget<TableWidgetState>(widgetId)
|
|
135
|
+
const widget = widgetStoreActions.getWidget<TableWidgetState>(widgetId)
|
|
140
136
|
const currentSelected = widget?.selected ?? []
|
|
141
137
|
|
|
142
138
|
const newSelected = [...new Set([...currentSelected, ...ids])]
|
|
143
139
|
|
|
144
|
-
setWidget<TableWidgetState>(widgetId, {
|
|
140
|
+
widgetStoreActions.setWidget<TableWidgetState>(widgetId, {
|
|
145
141
|
selected: newSelected,
|
|
146
142
|
})
|
|
147
143
|
|
|
@@ -149,18 +145,18 @@ export function useSelection(
|
|
|
149
145
|
onSelectionChange(newSelected)
|
|
150
146
|
}
|
|
151
147
|
},
|
|
152
|
-
[
|
|
148
|
+
[widgetId, onSelectionChange],
|
|
153
149
|
)
|
|
154
150
|
|
|
155
151
|
// Deselect specific rows
|
|
156
152
|
const deselectRows = useCallback(
|
|
157
153
|
(ids: (string | number)[]) => {
|
|
158
|
-
const widget = getWidget<TableWidgetState>(widgetId)
|
|
154
|
+
const widget = widgetStoreActions.getWidget<TableWidgetState>(widgetId)
|
|
159
155
|
const currentSelected = widget?.selected ?? []
|
|
160
156
|
|
|
161
157
|
const newSelected = currentSelected.filter((id) => !ids.includes(id))
|
|
162
158
|
|
|
163
|
-
setWidget<TableWidgetState>(widgetId, {
|
|
159
|
+
widgetStoreActions.setWidget<TableWidgetState>(widgetId, {
|
|
164
160
|
selected: newSelected,
|
|
165
161
|
})
|
|
166
162
|
|
|
@@ -168,21 +164,21 @@ export function useSelection(
|
|
|
168
164
|
onSelectionChange(newSelected)
|
|
169
165
|
}
|
|
170
166
|
},
|
|
171
|
-
[
|
|
167
|
+
[widgetId, onSelectionChange],
|
|
172
168
|
)
|
|
173
169
|
|
|
174
170
|
// Clear all selections
|
|
175
171
|
const clearSelection = useCallback(() => {
|
|
176
172
|
const newSelected: (string | number)[] = []
|
|
177
173
|
|
|
178
|
-
setWidget<TableWidgetState>(widgetId, {
|
|
174
|
+
widgetStoreActions.setWidget<TableWidgetState>(widgetId, {
|
|
179
175
|
selected: newSelected,
|
|
180
176
|
})
|
|
181
177
|
|
|
182
178
|
if (onSelectionChange) {
|
|
183
179
|
onSelectionChange(newSelected)
|
|
184
180
|
}
|
|
185
|
-
}, [
|
|
181
|
+
}, [widgetId, onSelectionChange])
|
|
186
182
|
|
|
187
183
|
return {
|
|
188
184
|
selectedIds,
|
|
@@ -6,8 +6,8 @@ import type {
|
|
|
6
6
|
TableWidgetState,
|
|
7
7
|
} from '../types'
|
|
8
8
|
import { sortData } from '../helpers'
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { widgetStoreActions } from '../../stores/widget-store'
|
|
10
|
+
import { useWidgetSelector } from '../../stores/use-widget-selector'
|
|
11
11
|
import { DEFAULT_COLUMN_ID, DEFAULT_DIRECTION } from '../config'
|
|
12
12
|
|
|
13
13
|
export interface UseSortResult<T> extends SortState {
|
|
@@ -43,42 +43,25 @@ export function useSort<T extends TableRow>(
|
|
|
43
43
|
widgetId: string,
|
|
44
44
|
data: T[],
|
|
45
45
|
): UseSortResult<T> {
|
|
46
|
-
// Get store
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
!!
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
(state.widgets[widgetId] as TableWidgetState | undefined)?.sort
|
|
59
|
-
?.columnId ?? DEFAULT_COLUMN_ID,
|
|
60
|
-
),
|
|
61
|
-
)
|
|
62
|
-
const direction = useWidgetStore(
|
|
63
|
-
useShallow(
|
|
64
|
-
(state) =>
|
|
65
|
-
(state.widgets[widgetId] as TableWidgetState | undefined)?.sort
|
|
66
|
-
?.direction ?? DEFAULT_DIRECTION,
|
|
67
|
-
),
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
const mode = useWidgetStore(
|
|
71
|
-
useShallow((state) => {
|
|
72
|
-
const widget = state.widgets[widgetId] as TableWidgetState | undefined
|
|
73
|
-
return widget?.mode
|
|
74
|
-
}),
|
|
46
|
+
// Get store state
|
|
47
|
+
const { sortEnabled, columnId, direction, mode } = useWidgetSelector(
|
|
48
|
+
widgetId,
|
|
49
|
+
(w) => {
|
|
50
|
+
const widget = w as TableWidgetState | undefined
|
|
51
|
+
return {
|
|
52
|
+
sortEnabled: !!widget?.sort,
|
|
53
|
+
columnId: widget?.sort?.columnId ?? DEFAULT_COLUMN_ID,
|
|
54
|
+
direction: widget?.sort?.direction ?? DEFAULT_DIRECTION,
|
|
55
|
+
mode: widget?.mode,
|
|
56
|
+
}
|
|
57
|
+
},
|
|
75
58
|
)
|
|
76
59
|
|
|
77
60
|
// Toggle sort on a column
|
|
78
61
|
const toggleSort = useCallback(
|
|
79
62
|
(toggleColumnId: string) => {
|
|
80
63
|
// Read current state directly from store to avoid stale closures
|
|
81
|
-
const widget = getWidget<TableWidgetState>(widgetId)
|
|
64
|
+
const widget = widgetStoreActions.getWidget<TableWidgetState>(widgetId)
|
|
82
65
|
const currentColumnId = widget?.sort?.columnId ?? DEFAULT_COLUMN_ID
|
|
83
66
|
const currentDirection = widget?.sort?.direction ?? DEFAULT_DIRECTION
|
|
84
67
|
|
|
@@ -89,42 +72,42 @@ export function useSort<T extends TableRow>(
|
|
|
89
72
|
newDirection = currentDirection === 'asc' ? 'desc' : 'asc'
|
|
90
73
|
}
|
|
91
74
|
|
|
92
|
-
setWidget<TableWidgetState>(widgetId, {
|
|
75
|
+
widgetStoreActions.setWidget<TableWidgetState>(widgetId, {
|
|
93
76
|
sort: {
|
|
94
77
|
columnId: toggleColumnId,
|
|
95
78
|
direction: newDirection,
|
|
96
79
|
},
|
|
97
80
|
})
|
|
98
81
|
},
|
|
99
|
-
[
|
|
82
|
+
[widgetId],
|
|
100
83
|
)
|
|
101
84
|
|
|
102
85
|
// Set sort state directly
|
|
103
86
|
const setSort = useCallback(
|
|
104
87
|
(newColumnId: string | null, newDirection: SortDirection) => {
|
|
105
|
-
setWidget<TableWidgetState>(widgetId, {
|
|
88
|
+
widgetStoreActions.setWidget<TableWidgetState>(widgetId, {
|
|
106
89
|
sort: {
|
|
107
90
|
columnId: newColumnId,
|
|
108
91
|
direction: newDirection,
|
|
109
92
|
},
|
|
110
93
|
})
|
|
111
94
|
},
|
|
112
|
-
[
|
|
95
|
+
[widgetId],
|
|
113
96
|
)
|
|
114
97
|
|
|
115
98
|
// Clear sort
|
|
116
99
|
const clearSort = useCallback(() => {
|
|
117
|
-
const widget = getWidget<TableWidgetState>(widgetId)
|
|
100
|
+
const widget = widgetStoreActions.getWidget<TableWidgetState>(widgetId)
|
|
118
101
|
if (!widget?.sort) return
|
|
119
102
|
|
|
120
|
-
setWidget<TableWidgetState>(widgetId, {
|
|
103
|
+
widgetStoreActions.setWidget<TableWidgetState>(widgetId, {
|
|
121
104
|
sort: {
|
|
122
105
|
...widget.sort,
|
|
123
106
|
columnId: null,
|
|
124
107
|
direction: 'asc',
|
|
125
108
|
},
|
|
126
109
|
})
|
|
127
|
-
}, [
|
|
110
|
+
}, [widgetId])
|
|
128
111
|
|
|
129
112
|
// Sorted data for local mode
|
|
130
113
|
const sortedData = useMemo(() => {
|
|
@@ -84,7 +84,7 @@ export interface TableWidgetConfig {
|
|
|
84
84
|
/** Enable row selection with checkboxes */
|
|
85
85
|
selectable?: boolean
|
|
86
86
|
/** Currently selected row IDs */
|
|
87
|
-
selected
|
|
87
|
+
selected?: (string | number)[]
|
|
88
88
|
/** Pagination and sort mode: local (client-side) or remote (server-side) */
|
|
89
89
|
mode: Mode
|
|
90
90
|
/** Pagination configuration */
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
createTooltipFormatter,
|
|
16
16
|
createChartDownloadConfig,
|
|
17
17
|
applyYAxisFormatter,
|
|
18
|
+
applyXAxisFormatter,
|
|
18
19
|
} from '../utils/chart-config'
|
|
19
20
|
|
|
20
21
|
export const timeseriesDownloadConfig =
|
|
@@ -33,6 +34,7 @@ export function timeseriesConfig(
|
|
|
33
34
|
type: 'timeseries',
|
|
34
35
|
option: mergeEchartWidgetConfig(getCommonOptions(props), getOption(props)),
|
|
35
36
|
formatter: props.formatter,
|
|
37
|
+
labelFormatter: props.labelFormatter,
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
|
|
@@ -40,6 +42,7 @@ function getOption({
|
|
|
40
42
|
data = [],
|
|
41
43
|
theme,
|
|
42
44
|
formatter,
|
|
45
|
+
labelFormatter,
|
|
43
46
|
}: TimeseriesConfig): EchartOptionsProps {
|
|
44
47
|
const hasLegend = (data?.length ?? 0) > 1
|
|
45
48
|
|
|
@@ -73,7 +76,7 @@ function getOption({
|
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
return {
|
|
76
|
-
legend: buildLegendConfig(hasLegend),
|
|
79
|
+
legend: buildLegendConfig({ hasLegend, labelFormatter }),
|
|
77
80
|
grid: {
|
|
78
81
|
...buildGridConfig(hasLegend, theme),
|
|
79
82
|
outerBounds: {
|
|
@@ -82,18 +85,21 @@ function getOption({
|
|
|
82
85
|
top: parseInt(theme.spacing(2)),
|
|
83
86
|
},
|
|
84
87
|
},
|
|
85
|
-
xAxis:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
xAxis: applyXAxisFormatter(
|
|
89
|
+
{
|
|
90
|
+
type: 'category',
|
|
91
|
+
axisTick: {
|
|
92
|
+
alignWithLabel: true,
|
|
93
|
+
},
|
|
94
|
+
axisLabel: {
|
|
95
|
+
show: true,
|
|
96
|
+
showMaxLabel: true,
|
|
97
|
+
showMinLabel: true,
|
|
98
|
+
rotate: 45,
|
|
99
|
+
},
|
|
89
100
|
},
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
showMaxLabel: true,
|
|
93
|
-
showMinLabel: true,
|
|
94
|
-
rotate: 45,
|
|
95
|
-
},
|
|
96
|
-
},
|
|
101
|
+
labelFormatter,
|
|
102
|
+
),
|
|
97
103
|
yAxis: applyYAxisFormatter(yAxis, formatter),
|
|
98
104
|
tooltip: {
|
|
99
105
|
formatter: createTooltipFormatter((item) => {
|
|
@@ -108,7 +114,9 @@ function getOption({
|
|
|
108
114
|
|
|
109
115
|
const marker = typeof item.marker === 'string' ? item.marker : ''
|
|
110
116
|
const seriesName = item.seriesName ? `${item.seriesName}: ` : ''
|
|
111
|
-
const name =
|
|
117
|
+
const name = labelFormatter
|
|
118
|
+
? String(labelFormatter(item.name ?? ''))
|
|
119
|
+
: (item.name ?? '')
|
|
112
120
|
|
|
113
121
|
return { name, seriesName, marker, value: formattedValue }
|
|
114
122
|
}),
|
|
@@ -26,10 +26,18 @@ export function niceNum(value: number): number {
|
|
|
26
26
|
/**
|
|
27
27
|
* Builds standard legend configuration for chart widgets
|
|
28
28
|
*
|
|
29
|
-
* @param
|
|
29
|
+
* @param params - Legend configuration parameters
|
|
30
|
+
* @param params.hasLegend - Whether to show the legend
|
|
31
|
+
* @param params.labelFormatter - Optional formatter for legend item names
|
|
30
32
|
* @returns Legend configuration object
|
|
31
33
|
*/
|
|
32
|
-
export function buildLegendConfig(
|
|
34
|
+
export function buildLegendConfig({
|
|
35
|
+
hasLegend,
|
|
36
|
+
labelFormatter,
|
|
37
|
+
}: {
|
|
38
|
+
hasLegend: boolean
|
|
39
|
+
labelFormatter?: (value: string | number) => string | number
|
|
40
|
+
}): LegendComponentOption {
|
|
33
41
|
return {
|
|
34
42
|
show: hasLegend,
|
|
35
43
|
icon: 'circle' as const,
|
|
@@ -37,6 +45,9 @@ export function buildLegendConfig(hasLegend: boolean): LegendComponentOption {
|
|
|
37
45
|
bottom: 0,
|
|
38
46
|
orient: 'horizontal',
|
|
39
47
|
type: 'scroll',
|
|
48
|
+
...(labelFormatter && {
|
|
49
|
+
formatter: (name: string) => String(labelFormatter(name)),
|
|
50
|
+
}),
|
|
40
51
|
}
|
|
41
52
|
}
|
|
42
53
|
|
|
@@ -101,25 +112,24 @@ export function createAxisLabelFormatter(
|
|
|
101
112
|
}
|
|
102
113
|
|
|
103
114
|
/**
|
|
104
|
-
* Applies
|
|
105
|
-
*
|
|
115
|
+
* Applies labelFormatter to xAxis configuration
|
|
116
|
+
* Applies to any xAxis regardless of axis type (category, value, etc.)
|
|
106
117
|
*
|
|
107
118
|
* @param xAxis - Existing xAxis configuration
|
|
108
|
-
* @param
|
|
109
|
-
* @returns Updated xAxis configuration
|
|
119
|
+
* @param labelFormatter - Optional labelFormatter function from widget config
|
|
120
|
+
* @returns Updated xAxis configuration
|
|
110
121
|
*/
|
|
111
122
|
export function applyXAxisFormatter(
|
|
112
123
|
xAxis: unknown,
|
|
113
|
-
formatter?: (value: number) => string,
|
|
124
|
+
formatter?: (value: string | number) => string | number,
|
|
114
125
|
) {
|
|
115
|
-
let axisFormatter = createAxisLabelFormatter(formatter)
|
|
116
|
-
|
|
117
126
|
const xAxisIsObject = xAxis && !Array.isArray(xAxis)
|
|
118
127
|
const xAxisTyped = xAxis as { type?: string; axisLabel?: unknown }
|
|
119
128
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
129
|
+
const axisFormatter =
|
|
130
|
+
formatter && xAxisIsObject
|
|
131
|
+
? (value: string | number) => String(formatter(value))
|
|
132
|
+
: undefined
|
|
123
133
|
|
|
124
134
|
return {
|
|
125
135
|
...xAxisTyped,
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export const defaultFormatter = (value: number) => value
|
|
1
|
+
export const defaultFormatter = (value: number) => String(value)
|
|
2
|
+
export const defaultLabelFormatter = (value: string | number) => value
|
|
@@ -9,8 +9,7 @@ import { Title } from './components/title'
|
|
|
9
9
|
import type { WrapperState, WrapperUIProps } from './types'
|
|
10
10
|
import { Options } from './components/options'
|
|
11
11
|
import { Actions } from './components/actions'
|
|
12
|
-
import {
|
|
13
|
-
import { useShallow } from 'zustand/shallow'
|
|
12
|
+
import { useWidgetSelector } from '../stores/use-widget-selector'
|
|
14
13
|
|
|
15
14
|
const EMPTY_ACTIONS: NonNullable<WrapperUIProps['actions']> = []
|
|
16
15
|
const EMPTY_OPTIONS: NonNullable<WrapperUIProps['options']> = []
|
|
@@ -38,17 +37,17 @@ export function WrapperUI({
|
|
|
38
37
|
options = EMPTY_OPTIONS,
|
|
39
38
|
onChangeCollapsed,
|
|
40
39
|
}: WrapperUIProps) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
// Single consolidated subscription instead of 4 separate ones.
|
|
41
|
+
const { title, collapsed, disabled, isFetching } = useWidgetSelector(
|
|
42
|
+
id,
|
|
43
|
+
(w) => {
|
|
44
|
+
return {
|
|
45
|
+
title: (w as WrapperState | undefined)?.title,
|
|
46
|
+
collapsed: (w as WrapperState | undefined)?.collapsed,
|
|
47
|
+
disabled: (w as WrapperState | undefined)?.disabled,
|
|
48
|
+
isFetching: w?.isFetching,
|
|
49
|
+
}
|
|
50
|
+
},
|
|
52
51
|
)
|
|
53
52
|
|
|
54
53
|
return (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { WrapperProps, WrapperState } from './types'
|
|
2
2
|
import { WrapperUI } from './wrapper-ui'
|
|
3
|
-
import {
|
|
3
|
+
import { widgetStoreActions } from '../stores/widget-store'
|
|
4
4
|
import { useLayoutEffect } from 'react'
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -29,22 +29,20 @@ export function WidgetWrapper({
|
|
|
29
29
|
children,
|
|
30
30
|
onChangeCollapsed,
|
|
31
31
|
}: WrapperProps) {
|
|
32
|
-
const setWidget = useWidgetStore((state) => state.setWidget)
|
|
33
|
-
|
|
34
32
|
useLayoutEffect(() => {
|
|
35
|
-
setWidget<WrapperState>(id, {
|
|
33
|
+
widgetStoreActions.setWidget<WrapperState>(id, {
|
|
36
34
|
collapsed: defaultCollapsed,
|
|
37
35
|
disabled,
|
|
38
36
|
title,
|
|
39
37
|
})
|
|
40
|
-
}, [defaultCollapsed, disabled, title, id
|
|
38
|
+
}, [defaultCollapsed, disabled, title, id])
|
|
41
39
|
|
|
42
40
|
const handleChangeCollapsed = (
|
|
43
41
|
event: React.SyntheticEvent<Element, Event>,
|
|
44
42
|
expanded: boolean,
|
|
45
43
|
) => {
|
|
46
44
|
onChangeCollapsed?.(event, expanded)
|
|
47
|
-
setWidget<WrapperState>(id, { collapsed: !expanded })
|
|
45
|
+
widgetStoreActions.setWidget<WrapperState>(id, { collapsed: !expanded })
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
return (
|
package/dist/error-CEkRPccv.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { jsx as x, jsxs as A } from "react/jsx-runtime";
|
|
2
|
-
import { c as W } from "react/compiler-runtime";
|
|
3
|
-
import { AlertTitle as j, Alert as y } from "@mui/material";
|
|
4
|
-
import { u as g } from "./widget-store-CzDt8oSK.js";
|
|
5
|
-
import { useShallow as f } from "zustand/shallow";
|
|
6
|
-
function T(m) {
|
|
7
|
-
const e = W(11), {
|
|
8
|
-
id: r,
|
|
9
|
-
children: a,
|
|
10
|
-
title: h,
|
|
11
|
-
description: p
|
|
12
|
-
} = m;
|
|
13
|
-
let o;
|
|
14
|
-
e[0] !== r ? (o = (t) => t.widgets[r]?.isLoading, e[0] = r, e[1] = o) : o = e[1];
|
|
15
|
-
const u = g(f(o));
|
|
16
|
-
let s;
|
|
17
|
-
e[2] !== r ? (s = (t) => t.widgets[r]?.isFetching, e[2] = r, e[3] = s) : s = e[3];
|
|
18
|
-
const w = g(f(s));
|
|
19
|
-
let l;
|
|
20
|
-
e[4] !== r ? (l = (t) => t.widgets[r]?.error, e[4] = r, e[5] = l) : l = e[5];
|
|
21
|
-
const c = g(f(l));
|
|
22
|
-
if (u || w)
|
|
23
|
-
return a;
|
|
24
|
-
if (c) {
|
|
25
|
-
const t = h ?? c.title ?? "Error", d = p ?? c.message ?? "An error occurred while loading the widget. Please try again.";
|
|
26
|
-
let i;
|
|
27
|
-
e[6] !== t ? (i = /* @__PURE__ */ x(j, { children: t }), e[6] = t, e[7] = i) : i = e[7];
|
|
28
|
-
let n;
|
|
29
|
-
return e[8] !== d || e[9] !== i ? (n = /* @__PURE__ */ A(y, { severity: "error", children: [
|
|
30
|
-
i,
|
|
31
|
-
d
|
|
32
|
-
] }), e[8] = d, e[9] = i, e[10] = n) : n = e[10], n;
|
|
33
|
-
}
|
|
34
|
-
return a;
|
|
35
|
-
}
|
|
36
|
-
export {
|
|
37
|
-
T as W
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=error-CEkRPccv.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-CEkRPccv.js","sources":["../src/widgets/error/error.tsx"],"sourcesContent":["import { Alert, AlertTitle } from '@mui/material'\nimport { useWidgetStore } from '../stores/widget-store'\nimport { useShallow } from 'zustand/shallow'\nimport type { WidgetErrorProps } from './types'\n\n/**\n * Displays an error alert when a widget encounters an error during data loading. Reads error state from the widget store and hides errors during loading/fetching to prevent flashing.\n *\n * @example\n * ```tsx\n * <WidgetError id=\"my-widget\">\n * <WidgetContent />\n * </WidgetError>\n * ```\n */\nexport function WidgetError({\n id,\n children,\n title: titleProp,\n description,\n}: WidgetErrorProps) {\n const isLoading = useWidgetStore(\n useShallow((state) => state.widgets[id]?.isLoading),\n )\n const isFetching = useWidgetStore(\n useShallow((state) => state.widgets[id]?.isFetching),\n )\n const error = useWidgetStore(useShallow((state) => state.widgets[id]?.error))\n\n // Don't show error during loading/fetching states\n if (isLoading || isFetching) {\n return children\n }\n\n // Show error UI if error exists\n if (error) {\n const errorTitle = titleProp ?? error.title ?? 'Error'\n const errorMessage =\n description ??\n error.message ??\n 'An error occurred while loading the widget. Please try again.'\n\n return (\n <Alert severity='error'>\n <AlertTitle>{errorTitle}</AlertTitle>\n {errorMessage}\n </Alert>\n )\n }\n\n // No error, render children\n return children\n}\n"],"names":["WidgetError","t0","$","_c","id","children","title","titleProp","description","t1","state","widgets","isLoading","useWidgetStore","useShallow","t2","state_0","isFetching","t3","state_1","error","errorTitle","errorMessage","message","t4","AlertTitle","t5","jsxs","Alert"],"mappings":";;;;;AAeO,SAAAA,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA,GAAqB;AAAA,IAAAC,IAAAA;AAAAA,IAAAC,UAAAA;AAAAA,IAAAC,OAAAC;AAAAA,IAAAC,aAAAA;AAAAA,EAAAA,IAAAP;AAKT,MAAAQ;AAAA,EAAAP,SAAAE,KAEJK,IAAAC,CAAAA,MAAWA,EAAKC,QAASP,CAAE,GAAYQ,WAAAV,OAAAE,GAAAF,OAAAO,KAAAA,IAAAP,EAAA,CAAA;AADpD,QAAAU,IAAkBC,EAChBC,EAAWL,CAAuC,CACpD;AAAC,MAAAM;AAAA,EAAAb,SAAAE,KAEYW,IAAAC,CAAAA,MAAWN,EAAKC,QAASP,CAAE,GAAaa,YAAAf,OAAAE,GAAAF,OAAAa,KAAAA,IAAAb,EAAA,CAAA;AADrD,QAAAe,IAAmBJ,EACjBC,EAAWC,CAAwC,CACrD;AAAC,MAAAG;AAAA,EAAAhB,SAAAE,KACuCc,IAAAC,CAAAA,MAAWT,EAAKC,QAASP,CAAE,GAAQgB,OAAAlB,OAAAE,GAAAF,OAAAgB,KAAAA,IAAAhB,EAAA,CAAA;AAA3E,QAAAkB,IAAcP,EAAeC,EAAWI,CAAmC,CAAC;AAG5E,MAAIN,KAAAK;AAAuB,WAClBZ;AAIT,MAAIe,GAAK;AACP,UAAAC,IAAmBd,KAAaa,EAAKd,SAAlB,SACnBgB,IACEd,KACAY,EAAKG,WADL;AAE+D,QAAAC;AAAA,IAAAtB,SAAAmB,KAI7DG,sBAACC,kBAAuB,GAAavB,OAAAmB,GAAAnB,OAAAsB,KAAAA,IAAAtB,EAAA,CAAA;AAAA,QAAAwB;AAAA,WAAAxB,EAAA,CAAA,MAAAoB,KAAApB,SAAAsB,KADvCE,IAAA,gBAAAC,EAACC,GAAA,EAAe,UAAA,SACdJ,UAAAA;AAAAA,MAAAA;AAAAA,MACCF;AAAAA,IAAAA,GACH,GAAQpB,OAAAoB,GAAApB,OAAAsB,GAAAtB,QAAAwB,KAAAA,IAAAxB,EAAA,EAAA,GAHRwB;AAAAA,EAGQ;AAEX,SAGMrB;AAAQ;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatter-B1Xh8XDH.js","sources":["../src/widgets/utils/formatter.ts"],"sourcesContent":["export const defaultFormatter = (value: number) => value.toString()\n"],"names":["defaultFormatter","value","toString"],"mappings":"AAAO,MAAMA,IAAmBA,CAACC,MAAkBA,EAAMC,SAAAA;"}
|
package/dist/no-data-hR3KcJ-_.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { jsx as h, jsxs as A } from "react/jsx-runtime";
|
|
2
|
-
import { c as T } from "react/compiler-runtime";
|
|
3
|
-
import { Typography as x, Box as E } from "@mui/material";
|
|
4
|
-
import { useShallow as c } from "zustand/shallow";
|
|
5
|
-
import { u as p } from "./widget-store-CzDt8oSK.js";
|
|
6
|
-
const W = {
|
|
7
|
-
root: {
|
|
8
|
-
display: "flex",
|
|
9
|
-
flexDirection: "column",
|
|
10
|
-
gap: 1,
|
|
11
|
-
// 8px
|
|
12
|
-
paddingTop: 1,
|
|
13
|
-
// 8px
|
|
14
|
-
paddingBottom: 2,
|
|
15
|
-
// 16px
|
|
16
|
-
paddingX: 2,
|
|
17
|
-
// 16px
|
|
18
|
-
width: "100%",
|
|
19
|
-
minHeight: "100%"
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
function S(r) {
|
|
23
|
-
const t = T(13), {
|
|
24
|
-
id: i,
|
|
25
|
-
children: u,
|
|
26
|
-
title: y,
|
|
27
|
-
description: g,
|
|
28
|
-
isEmpty: m
|
|
29
|
-
} = r, f = y === void 0 ? "No data available" : y, d = g === void 0 ? "There are no results for the combination of filters applied to your data. Try tweaking your filters, or zoom and pan the map to adjust filters" : g, v = m === void 0 ? k : m;
|
|
30
|
-
let n;
|
|
31
|
-
t[0] !== i ? (n = (e) => e.widgets[i]?.isLoading, t[0] = i, t[1] = n) : n = t[1];
|
|
32
|
-
const w = p(c(n));
|
|
33
|
-
let s;
|
|
34
|
-
t[2] !== i ? (s = (e) => e.widgets[i]?.isFetching, t[2] = i, t[3] = s) : s = t[3];
|
|
35
|
-
const b = p(c(s));
|
|
36
|
-
let l;
|
|
37
|
-
t[4] !== i ? (l = (e) => e.widgets[i]?.data, t[4] = i, t[5] = l) : l = t[5];
|
|
38
|
-
const j = p(c(l));
|
|
39
|
-
if (w || b)
|
|
40
|
-
return u;
|
|
41
|
-
if (v(j)) {
|
|
42
|
-
let e;
|
|
43
|
-
t[6] !== f ? (e = /* @__PURE__ */ h(x, { variant: "body2", color: "text.primary", children: f }), t[6] = f, t[7] = e) : e = t[7];
|
|
44
|
-
let o;
|
|
45
|
-
t[8] !== d ? (o = /* @__PURE__ */ h(x, { variant: "caption", color: "text.secondary", children: d }), t[8] = d, t[9] = o) : o = t[9];
|
|
46
|
-
let a;
|
|
47
|
-
return t[10] !== e || t[11] !== o ? (a = /* @__PURE__ */ A(E, { sx: W.root, children: [
|
|
48
|
-
e,
|
|
49
|
-
o
|
|
50
|
-
] }), t[10] = e, t[11] = o, t[12] = a) : a = t[12], a;
|
|
51
|
-
}
|
|
52
|
-
return u;
|
|
53
|
-
}
|
|
54
|
-
function k(r) {
|
|
55
|
-
return r == null ? !0 : Array.isArray(r) ? !!(r.length === 0 || r.every((t) => Array.isArray(t) && t.length === 0)) : typeof r == "object" ? Object.keys(r).length === 0 : !1;
|
|
56
|
-
}
|
|
57
|
-
export {
|
|
58
|
-
S as W
|
|
59
|
-
};
|
|
60
|
-
//# sourceMappingURL=no-data-hR3KcJ-_.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-data-hR3KcJ-_.js","sources":["../src/widgets/no-data/style.ts","../src/widgets/no-data/no-data.tsx"],"sourcesContent":["import type { SxProps, Theme } from '@mui/material'\n\n/**\n * Styles for NoData component matching Figma design specifications\n * Design reference: node 5781-11028\n */\nexport const styles: Record<string, SxProps<Theme>> = {\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: 1, // 8px\n paddingTop: 1, // 8px\n paddingBottom: 2, // 16px\n paddingX: 2, // 16px\n width: '100%',\n minHeight: '100%',\n },\n}\n","import { Box, Typography } from '@mui/material'\nimport { useShallow } from 'zustand/shallow'\nimport { useWidgetStore } from '../stores/widget-store'\nimport type { WidgetNoDataProps } from './types'\nimport { styles } from './style'\n\n/**\n * NoData wrapper component that displays empty state UI when widget has no data\n *\n * Integrates with widget store to check loading/fetching state and data availability.\n * Works in conjunction with SkeletonLoader for complete loading/empty state handling.\n *\n * @example Basic usage\n * ```tsx\n * <NoData id=\"my-widget\">\n * <WidgetContent id=\"my-widget\" />\n * </NoData>\n * ```\n *\n * @example With SkeletonLoader\n * ```tsx\n * <SkeletonLoader id=\"my-widget\" Skeleton={MySkeleton}>\n * <NoData id=\"my-widget\">\n * <WidgetContent id=\"my-widget\" />\n * </NoData>\n * </SkeletonLoader>\n * ```\n *\n * @example With custom messages\n * ```tsx\n * <NoData\n * id=\"my-widget\"\n * title=\"No results found\"\n * description=\"Try adjusting your filters\"\n * >\n * <WidgetContent id=\"my-widget\" />\n * </NoData>\n * ```\n */\nexport function WidgetNoData({\n id,\n children,\n title = 'No data available',\n description = 'There are no results for the combination of filters applied to your data. Try tweaking your filters, or zoom and pan the map to adjust filters',\n isEmpty = defaultIsEmpty,\n}: WidgetNoDataProps) {\n // Subscribe to widget store with selective subscription for optimal performance\n const isLoading = useWidgetStore(\n useShallow((state) => state.widgets[id]?.isLoading),\n )\n const isFetching = useWidgetStore(\n useShallow((state) => state.widgets[id]?.isFetching),\n )\n const data = useWidgetStore(useShallow((state) => state.widgets[id]?.data))\n\n // If loading or fetching, show children\n // SkeletonLoader handles loading state, this allows proper composition\n if (isLoading || isFetching) {\n return children\n }\n\n // Check if data is empty\n if (isEmpty(data)) {\n return (\n <Box sx={styles.root}>\n <Typography variant='body2' color='text.primary'>\n {title}\n </Typography>\n <Typography variant='caption' color='text.secondary'>\n {description}\n </Typography>\n </Box>\n )\n }\n\n // Data exists, render children\n return children\n}\n\n/**\n * Default function to determine if data is empty\n * Handles various data structures commonly used in widgets\n */\nfunction defaultIsEmpty(data: unknown): boolean {\n // Null or undefined\n if (data == null) {\n return true\n }\n\n // Arrays (most common case)\n if (Array.isArray(data)) {\n // Empty array\n if (data.length === 0) {\n return true\n }\n\n // Array of arrays (CategoryWidget pattern: [[],[]])\n // Check if all inner arrays are empty\n if (data.every((item) => Array.isArray(item) && item.length === 0)) {\n return true\n }\n\n return false\n }\n\n // Objects\n if (typeof data === 'object') {\n return Object.keys(data).length === 0\n }\n\n // Primitives (numbers, strings, booleans) are considered valid data\n return false\n}\n"],"names":["styles","root","display","flexDirection","gap","paddingTop","paddingBottom","paddingX","width","minHeight","WidgetNoData","t0","$","_c","id","children","title","t1","description","t2","isEmpty","t3","undefined","defaultIsEmpty","t4","state","widgets","isLoading","useWidgetStore","useShallow","t5","state_0","isFetching","t6","state_1","data","t7","Typography","t8","t9","Box","Array","isArray","length","every","item","Object","keys"],"mappings":";;;;;AAMO,MAAMA,IAAyC;AAAA,EACpDC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTC,eAAe;AAAA,IACfC,KAAK;AAAA;AAAA,IACLC,YAAY;AAAA;AAAA,IACZC,eAAe;AAAA;AAAA,IACfC,UAAU;AAAA;AAAA,IACVC,OAAO;AAAA,IACPC,WAAW;AAAA,EAAA;AAEf;ACsBO,SAAAC,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA,GAAsB;AAAA,IAAAC,IAAAA;AAAAA,IAAAC,UAAAA;AAAAA,IAAAC,OAAAC;AAAAA,IAAAC,aAAAC;AAAAA,IAAAC,SAAAC;AAAAA,EAAAA,IAAAV,GAG3BK,IAAAC,MAAAK,SAAA,sBAAAL,GACAC,IAAAC,MAAAG,SAAA,mJAAAH,GACAC,IAAAC,MAAAC,SAAAC,IAAAF;AAAwB,MAAAG;AAAA,EAAAZ,SAAAE,KAIXU,IAAAC,CAAAA,MAAWA,EAAKC,QAASZ,CAAE,GAAYa,WAAAf,OAAAE,GAAAF,OAAAY,KAAAA,IAAAZ,EAAA,CAAA;AADpD,QAAAe,IAAkBC,EAChBC,EAAWL,CAAuC,CACpD;AAAC,MAAAM;AAAA,EAAAlB,SAAAE,KAEYgB,IAAAC,CAAAA,MAAWN,EAAKC,QAASZ,CAAE,GAAakB,YAAApB,OAAAE,GAAAF,OAAAkB,KAAAA,IAAAlB,EAAA,CAAA;AADrD,QAAAoB,IAAmBJ,EACjBC,EAAWC,CAAwC,CACrD;AAAC,MAAAG;AAAA,EAAArB,SAAAE,KACsCmB,IAAAC,CAAAA,MAAWT,EAAKC,QAASZ,CAAE,GAAOqB,MAAAvB,OAAAE,GAAAF,OAAAqB,KAAAA,IAAArB,EAAA,CAAA;AAAzE,QAAAuB,IAAaP,EAAeC,EAAWI,CAAkC,CAAC;AAI1E,MAAIN,KAAAK;AAAuB,WAClBjB;AAIT,MAAIK,EAAQe,CAAI,GAAC;AAAA,QAAAC;AAAA,IAAAxB,SAAAI,KAGXoB,sBAACC,GAAA,EAAmB,SAAA,SAAc,OAAA,gBAC/BrB,UAAAA,GACH,GAAaJ,OAAAI,GAAAJ,OAAAwB,KAAAA,IAAAxB,EAAA,CAAA;AAAA,QAAA0B;AAAA,IAAA1B,SAAAM,KACboB,sBAACD,GAAA,EAAmB,SAAA,WAAgB,OAAA,kBACjCnB,UAAAA,GACH,GAAaN,OAAAM,GAAAN,OAAA0B,KAAAA,IAAA1B,EAAA,CAAA;AAAA,QAAA2B;AAAA,WAAA3B,EAAA,EAAA,MAAAwB,KAAAxB,UAAA0B,KANfC,sBAACC,GAAA,EAAQ,IAAAxC,EAAMC,MACbmC,UAAAA;AAAAA,MAAAA;AAAAA,MAGAE;AAAAA,IAAAA,GAGF,GAAM1B,QAAAwB,GAAAxB,QAAA0B,GAAA1B,QAAA2B,KAAAA,IAAA3B,EAAA,EAAA,GAPN2B;AAAAA,EAOM;AAET,SAGMxB;AAAQ;AAOjB,SAASQ,EAAeY,GAAwB;AAE9C,SAAIA,KAAQ,OACH,KAILM,MAAMC,QAAQP,CAAI,IAEhBA,GAAAA,EAAKQ,WAAW,KAMhBR,EAAKS,MAAOC,CAAAA,MAASJ,MAAMC,QAAQG,CAAI,KAAKA,EAAKF,WAAW,CAAC,KAQ/D,OAAOR,KAAS,WACXW,OAAOC,KAAKZ,CAAI,EAAEQ,WAAW,IAI/B;AACT;"}
|