@nivaro/react 0.1.56 → 0.1.58
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/full.css +1 -1
- package/dist/index.d.ts +132 -2
- package/dist/index.js +15891 -15266
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1150,7 +1150,12 @@ declare interface MessageToken {
|
|
|
1150
1150
|
mention?: string;
|
|
1151
1151
|
}
|
|
1152
1152
|
|
|
1153
|
-
export declare function MyWorkView(
|
|
1153
|
+
export declare function MyWorkView({ notificationRoutes, onOpenPath }?: {
|
|
1154
|
+
/** Host page map so notification clicks land on real pages (reports, queues,
|
|
1155
|
+
* alerts…); without it only record targets are clickable. */
|
|
1156
|
+
notificationRoutes?: NotificationRouteMap_2;
|
|
1157
|
+
onOpenPath?: (path: string) => void;
|
|
1158
|
+
}): JSX.Element;
|
|
1154
1159
|
|
|
1155
1160
|
export declare const NavigationContext: React_2.Context<NavigationContextValue>;
|
|
1156
1161
|
|
|
@@ -1230,6 +1235,64 @@ export declare function NivaroProvider({ client, children }: {
|
|
|
1230
1235
|
*/
|
|
1231
1236
|
export declare function normalizeFieldType(rawType: string, iface: string | null, relation: FormFieldDescriptor['relation']): FormFieldType;
|
|
1232
1237
|
|
|
1238
|
+
/**
|
|
1239
|
+
* Every in-app notification must land somewhere meaningful — this is the ONE
|
|
1240
|
+
* resolver both bells, the notifications page, and My Work use to decide what
|
|
1241
|
+
* a click does. A row that resolves to null renders as plain text (no hover,
|
|
1242
|
+
* no cursor), which is the honest state for broadcast-style messages; it must
|
|
1243
|
+
* never render as a link that goes nowhere.
|
|
1244
|
+
*
|
|
1245
|
+
* Server writers use `collection` + `item` as the target: business collections
|
|
1246
|
+
* point at records (or the collection list when item is null), a handful of
|
|
1247
|
+
* system collections map to their owning pages, and the pseudo-collection
|
|
1248
|
+
* `__chat__` carries a chat room key.
|
|
1249
|
+
*/
|
|
1250
|
+
|
|
1251
|
+
export declare interface NotificationRouteMap {
|
|
1252
|
+
/** Record route for a business collection — return null when the host has none. */
|
|
1253
|
+
record: (collection: string, item: string) => string | null
|
|
1254
|
+
/** Collection listing (item-less business notifications, e.g. view digests). */
|
|
1255
|
+
list?: (collection: string) => string | null
|
|
1256
|
+
report?: (id: string) => string | null
|
|
1257
|
+
queue?: (id: string) => string | null
|
|
1258
|
+
dashboard?: (id: string) => string | null
|
|
1259
|
+
/** Alert-manager page (metric/anomaly/per-record alert notifications). */
|
|
1260
|
+
alerts?: () => string | null
|
|
1261
|
+
imports?: () => string | null
|
|
1262
|
+
issues?: () => string | null
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
/**
|
|
1266
|
+
* Every in-app notification must land somewhere meaningful — this is the ONE
|
|
1267
|
+
* resolver both bells, the notifications page, and My Work use to decide what
|
|
1268
|
+
* a click does. A row that resolves to null renders as plain text (no hover,
|
|
1269
|
+
* no cursor), which is the honest state for broadcast-style messages; it must
|
|
1270
|
+
* never render as a link that goes nowhere.
|
|
1271
|
+
*
|
|
1272
|
+
* Server writers use `collection` + `item` as the target: business collections
|
|
1273
|
+
* point at records (or the collection list when item is null), a handful of
|
|
1274
|
+
* system collections map to their owning pages, and the pseudo-collection
|
|
1275
|
+
* `__chat__` carries a chat room key.
|
|
1276
|
+
*/
|
|
1277
|
+
declare interface NotificationRouteMap_2 {
|
|
1278
|
+
/** Record route for a business collection — return null when the host has none. */
|
|
1279
|
+
record: (collection: string, item: string) => string | null;
|
|
1280
|
+
/** Collection listing (item-less business notifications, e.g. view digests). */
|
|
1281
|
+
list?: (collection: string) => string | null;
|
|
1282
|
+
report?: (id: string) => string | null;
|
|
1283
|
+
queue?: (id: string) => string | null;
|
|
1284
|
+
dashboard?: (id: string) => string | null;
|
|
1285
|
+
/** Alert-manager page (metric/anomaly/per-record alert notifications). */
|
|
1286
|
+
alerts?: () => string | null;
|
|
1287
|
+
imports?: () => string | null;
|
|
1288
|
+
issues?: () => string | null;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
export declare type NotificationTarget =
|
|
1292
|
+
| { type: 'path'; path: string }
|
|
1293
|
+
| { type: 'chat'; room: string }
|
|
1294
|
+
| null
|
|
1295
|
+
|
|
1233
1296
|
export declare function NumberField({ field, value, onChange, error, disabled, readOnly, inputId, errorId }: FieldComponentProps): JSX.Element;
|
|
1234
1297
|
|
|
1235
1298
|
declare interface O2MFieldInfo {
|
|
@@ -1567,7 +1630,9 @@ declare type RenderFieldProps = {
|
|
|
1567
1630
|
requiredParentLabel?: string | null;
|
|
1568
1631
|
};
|
|
1569
1632
|
|
|
1570
|
-
export declare function ReportView({ reportId, showFilterBar, dateRange, initialEntityFilters, refetchInterval, className, emptyState }: ReportViewProps
|
|
1633
|
+
export declare function ReportView({ reportId, showFilterBar, dateRange, initialEntityFilters, refetchInterval, className, emptyState, reportUrl }: ReportViewProps & {
|
|
1634
|
+
reportUrl?: (id: string) => string;
|
|
1635
|
+
}): JSX.Element;
|
|
1571
1636
|
|
|
1572
1637
|
/**
|
|
1573
1638
|
* ReportView — the full, styled, interactive Report Studio renderer for
|
|
@@ -1595,6 +1660,57 @@ export declare interface ReportViewProps {
|
|
|
1595
1660
|
emptyState?: React.ReactNode;
|
|
1596
1661
|
}
|
|
1597
1662
|
|
|
1663
|
+
export declare function resolveNotificationTarget(
|
|
1664
|
+
collection: string | null | undefined,
|
|
1665
|
+
item: string | null | undefined,
|
|
1666
|
+
routes: NotificationRouteMap
|
|
1667
|
+
): NotificationTarget {
|
|
1668
|
+
const c = collection?.trim()
|
|
1669
|
+
if (!c) return null
|
|
1670
|
+
const i = item != null && String(item).trim() !== '' ? String(item) : null
|
|
1671
|
+
|
|
1672
|
+
if (c === '__chat__') {
|
|
1673
|
+
// Opening a room needs a registered chat dock — without one there is no
|
|
1674
|
+
// chat surface to open, so the row stays plain.
|
|
1675
|
+
return i && canOpenChatRoom() ? { type: 'chat', room: i } : null
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
if (c === 'nivaro_report_defs') {
|
|
1679
|
+
const p = i ? routes.report?.(i) : null
|
|
1680
|
+
return p ? { type: 'path', path: p } : null
|
|
1681
|
+
}
|
|
1682
|
+
if (c === 'nivaro_queues') {
|
|
1683
|
+
const p = i ? routes.queue?.(i) : null
|
|
1684
|
+
return p ? { type: 'path', path: p } : null
|
|
1685
|
+
}
|
|
1686
|
+
if (c === 'nivaro_dashboards') {
|
|
1687
|
+
const p = i ? routes.dashboard?.(i) : null
|
|
1688
|
+
return p ? { type: 'path', path: p } : null
|
|
1689
|
+
}
|
|
1690
|
+
if (ALERT_COLLECTIONS.has(c)) {
|
|
1691
|
+
const p = routes.alerts?.()
|
|
1692
|
+
return p ? { type: 'path', path: p } : null
|
|
1693
|
+
}
|
|
1694
|
+
if (IMPORT_COLLECTIONS.has(c)) {
|
|
1695
|
+
const p = routes.imports?.()
|
|
1696
|
+
return p ? { type: 'path', path: p } : null
|
|
1697
|
+
}
|
|
1698
|
+
if (c === 'nivaro_issues') {
|
|
1699
|
+
const p = routes.issues?.()
|
|
1700
|
+
return p ? { type: 'path', path: p } : null
|
|
1701
|
+
}
|
|
1702
|
+
// Any other system collection has no user-facing page — plain row, never a
|
|
1703
|
+
// /collections/nivaro_* route that would 404 or 403.
|
|
1704
|
+
if (/^nivaro_/i.test(c) || /^directus_/i.test(c)) return null
|
|
1705
|
+
|
|
1706
|
+
if (i) {
|
|
1707
|
+
const p = routes.record(c, i)
|
|
1708
|
+
return p ? { type: 'path', path: p } : null
|
|
1709
|
+
}
|
|
1710
|
+
const p = routes.list?.(c)
|
|
1711
|
+
return p ? { type: 'path', path: p } : null
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1598
1714
|
export declare function RevisionsPanel({ collection, item, onRollback, triggerClassName, inlineTableFields, open, onOpenChange }: {
|
|
1599
1715
|
collection: string;
|
|
1600
1716
|
item: string;
|
|
@@ -1627,6 +1743,20 @@ export declare interface RoomInfo {
|
|
|
1627
1743
|
*/
|
|
1628
1744
|
declare type RoomOpener = (room: string, label?: string) => void;
|
|
1629
1745
|
|
|
1746
|
+
/** Convenience: run a resolved target (navigate or open the chat room). */
|
|
1747
|
+
export declare function runNotificationTarget(
|
|
1748
|
+
target: NotificationTarget,
|
|
1749
|
+
navigate: (path: string) => void
|
|
1750
|
+
): boolean {
|
|
1751
|
+
if (!target) return false
|
|
1752
|
+
if (target.type === 'chat') {
|
|
1753
|
+
openChatRoom(target.room)
|
|
1754
|
+
return true
|
|
1755
|
+
}
|
|
1756
|
+
navigate(target.path)
|
|
1757
|
+
return true
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1630
1760
|
export declare type SectionState = {
|
|
1631
1761
|
isCollapsed: (key: string) => boolean;
|
|
1632
1762
|
toggle: (key: string) => void;
|