bdsa-react-components 0.1.14 → 0.1.15

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.
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Utility functions for working with DSA items
3
+ */
4
+ /**
5
+ * Item interface representing a DSA item (file or folder)
6
+ */
7
+ export interface Item {
8
+ /** Item ID */
9
+ _id: string;
10
+ /** Item name */
11
+ name?: string;
12
+ /** Item type (e.g., 'file', 'folder') */
13
+ _modelType?: string;
14
+ /** Large image flag (can be at root level or in meta) */
15
+ largeImage?: boolean | string | object;
16
+ /** Metadata object */
17
+ meta?: {
18
+ /** Large image flag in metadata */
19
+ largeImage?: boolean | string | object;
20
+ [key: string]: unknown;
21
+ };
22
+ [key: string]: unknown;
23
+ }
24
+ /**
25
+ * Check if an item has the largeImage flag set
26
+ *
27
+ * This function checks BOTH the root level and meta.largeImage locations,
28
+ * as different DSA servers and configurations store this flag in different places.
29
+ *
30
+ * Based on actual DSA data, the largeImage flag is most commonly found at the root level,
31
+ * but this function checks both locations for maximum compatibility.
32
+ *
33
+ * @param item - The DSA item to check
34
+ * @returns true if the item has largeImage flag set (as true, 'true', or an object)
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * // Root level largeImage (most common)
39
+ * const item1 = { _id: '123', largeImage: true }
40
+ * hasLargeImage(item1) // => true
41
+ *
42
+ * // Object type largeImage (contains image metadata)
43
+ * const item2 = { _id: '456', largeImage: { width: 1024, height: 768 } }
44
+ * hasLargeImage(item2) // => true
45
+ *
46
+ * // Meta level largeImage (fallback location)
47
+ * const item3 = { _id: '789', meta: { largeImage: true } }
48
+ * hasLargeImage(item3) // => true
49
+ *
50
+ * // No largeImage flag
51
+ * const item4 = { _id: '000' }
52
+ * hasLargeImage(item4) // => false
53
+ * ```
54
+ */
55
+ export declare function hasLargeImage(item: Item): boolean;
56
+ /**
57
+ * Filter an array of items to only include those with largeImage flag
58
+ *
59
+ * @param items - Array of DSA items to filter
60
+ * @returns Filtered array containing only items with largeImage flag
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const items = [
65
+ * { _id: '1', name: 'image.svs', largeImage: true },
66
+ * { _id: '2', name: 'document.pdf' },
67
+ * { _id: '3', name: 'slide.tif', meta: { largeImage: true } }
68
+ * ]
69
+ *
70
+ * const imageItems = filterLargeImages(items)
71
+ * // => [{ _id: '1', ... }, { _id: '3', ... }]
72
+ * ```
73
+ */
74
+ export declare function filterLargeImages(items: Item[]): Item[];
75
+ //# sourceMappingURL=itemUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"itemUtils.d.ts","sourceRoot":"","sources":["../../src/utils/itemUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,IAAI;IACjB,cAAc;IACd,GAAG,EAAE,MAAM,CAAA;IACX,gBAAgB;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yDAAyD;IACzD,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;IACtC,sBAAsB;IACtB,IAAI,CAAC,EAAE;QACH,mCAAmC;QACnC,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;QACtC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KACzB,CAAA;IACD,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAqBjD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,CAEvD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bdsa-react-components",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Reusable React components for the Digital Slide Archive project",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",