@cranberry-money/shared-utils 8.17.5 → 8.17.7
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/auth.d.ts +1 -25
- package/dist/auth.d.ts.map +1 -1
- package/dist/badge-status.d.ts +2 -6
- package/dist/badge-status.d.ts.map +1 -1
- package/dist/badge.d.ts +1 -9
- package/dist/badge.d.ts.map +1 -1
- package/dist/instruments.d.ts +1 -30
- package/dist/instruments.d.ts.map +1 -1
- package/dist/validation.d.ts +1 -13
- package/dist/validation.d.ts.map +1 -1
- package/dist/withdrawal.d.ts +1 -9
- package/dist/withdrawal.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/allocations.d.ts +0 -18
- package/dist/allocations.js +0 -20
- package/dist/cash-account.d.ts +0 -43
- package/dist/cash-account.d.ts.map +0 -1
- package/dist/cash-account.js +0 -52
- package/dist/collections.d.ts +0 -81
- package/dist/collections.d.ts.map +0 -1
- package/dist/collections.js +0 -127
- package/dist/country.d.ts +0 -108
- package/dist/country.d.ts.map +0 -1
- package/dist/country.js +0 -116
- package/dist/currency.d.ts +0 -99
- package/dist/currency.d.ts.map +0 -1
- package/dist/currency.js +0 -128
- package/dist/dashboard.d.ts +0 -72
- package/dist/dashboard.js +0 -121
- package/dist/date.d.ts.map +0 -1
- package/dist/date.js +0 -91
- package/dist/document.d.ts +0 -38
- package/dist/document.d.ts.map +0 -1
- package/dist/document.js +0 -56
- package/dist/downloads.d.ts +0 -46
- package/dist/downloads.d.ts.map +0 -1
- package/dist/downloads.js +0 -91
- package/dist/filters.d.ts +0 -121
- package/dist/filters.d.ts.map +0 -1
- package/dist/filters.js +0 -206
- package/dist/formatting.d.ts +0 -59
- package/dist/formatting.d.ts.map +0 -1
- package/dist/formatting.js +0 -81
- package/dist/holdings.d.ts +0 -79
- package/dist/holdings.js +0 -139
- package/dist/index.d.ts +0 -36
- package/dist/index.js +0 -68
- package/dist/industry.d.ts +0 -128
- package/dist/industry.d.ts.map +0 -1
- package/dist/industry.js +0 -152
- package/dist/investment-preference.d.ts +0 -25
- package/dist/investment-preference.js +0 -33
- package/dist/numbers.d.ts +0 -72
- package/dist/numbers.d.ts.map +0 -1
- package/dist/numbers.js +0 -101
- package/dist/portfolio-template.d.ts +0 -57
- package/dist/portfolio-template.d.ts.map +0 -1
- package/dist/portfolio-template.js +0 -60
- package/dist/portfolio.d.ts +0 -68
- package/dist/portfolio.d.ts.map +0 -1
- package/dist/portfolio.js +0 -87
- package/dist/sector.d.ts +0 -124
- package/dist/sector.d.ts.map +0 -1
- package/dist/sector.js +0 -134
- package/dist/stock-exchange.d.ts +0 -89
- package/dist/stock-exchange.d.ts.map +0 -1
- package/dist/stock-exchange.js +0 -101
- package/dist/tax-residency.d.ts +0 -67
- package/dist/tax-residency.d.ts.map +0 -1
- package/dist/tax-residency.js +0 -70
- package/dist/text.d.ts.map +0 -1
- package/dist/text.js +0 -25
- package/dist/withdrawal-status.d.ts +0 -72
- package/dist/withdrawal-status.d.ts.map +0 -1
- package/dist/withdrawal-status.js +0 -127
package/dist/date.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Date and time formatting utility functions
|
|
3
|
-
*
|
|
4
|
-
* This module provides pure functions for formatting dates and times
|
|
5
|
-
* in various formats suitable for display in the application.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Formats a date string to a localized date
|
|
9
|
-
*
|
|
10
|
-
* @param dateString - ISO date string or null
|
|
11
|
-
* @param fallback - Fallback text when date is null (default: 'No expiry')
|
|
12
|
-
* @returns Formatted date string
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* formatDate('2024-03-15') // '3/15/2024' (in en-US)
|
|
17
|
-
* formatDate(null) // 'No expiry'
|
|
18
|
-
* formatDate(null, 'Not set') // 'Not set'
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export function formatDate(dateString, fallback = 'No expiry') {
|
|
22
|
-
if (!dateString)
|
|
23
|
-
return fallback;
|
|
24
|
-
return new Date(dateString).toLocaleDateString();
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Formats a date string to a short date format (e.g., "Jan 15")
|
|
28
|
-
*
|
|
29
|
-
* @param dateString - ISO date string
|
|
30
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
31
|
-
* @returns Formatted short date string
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```typescript
|
|
35
|
-
* formatShortDate('2024-01-15') // 'Jan 15'
|
|
36
|
-
* formatShortDate('2024-12-25', 'en-US') // 'Dec 25'
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export function formatShortDate(dateString, locale = 'en-AU') {
|
|
40
|
-
const date = new Date(dateString);
|
|
41
|
-
return date.toLocaleDateString(locale, {
|
|
42
|
-
month: 'short',
|
|
43
|
-
day: 'numeric',
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Formats a date string to a time format (24-hour)
|
|
48
|
-
*
|
|
49
|
-
* @param dateString - ISO date string
|
|
50
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
51
|
-
* @returns Formatted time string in 24-hour format
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```typescript
|
|
55
|
-
* formatTime('2024-01-15T14:30:00') // '14:30'
|
|
56
|
-
* formatTime('2024-01-15T09:05:00') // '09:05'
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
export function formatTime(dateString, locale = 'en-AU') {
|
|
60
|
-
return new Date(dateString).toLocaleTimeString(locale, {
|
|
61
|
-
hour: '2-digit',
|
|
62
|
-
minute: '2-digit',
|
|
63
|
-
hour12: false,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Formats a date string to a combined short date and time format
|
|
68
|
-
*
|
|
69
|
-
* @param dateString - ISO date string
|
|
70
|
-
* @param locale - Locale for formatting (default: 'en-AU')
|
|
71
|
-
* @returns Formatted string like "Jan 15 14:30"
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```typescript
|
|
75
|
-
* formatDateTime('2024-01-15T14:30:00') // 'Jan 15 14:30'
|
|
76
|
-
* formatDateTime('2024-12-25T09:00:00', 'en-US') // 'Dec 25 09:00'
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
79
|
-
export function formatDateTime(dateString, locale = 'en-AU') {
|
|
80
|
-
const date = new Date(dateString);
|
|
81
|
-
const shortDate = date.toLocaleDateString(locale, {
|
|
82
|
-
month: 'short',
|
|
83
|
-
day: 'numeric',
|
|
84
|
-
});
|
|
85
|
-
const time = date.toLocaleTimeString(locale, {
|
|
86
|
-
hour: '2-digit',
|
|
87
|
-
minute: '2-digit',
|
|
88
|
-
hour12: false,
|
|
89
|
-
});
|
|
90
|
-
return `${shortDate} ${time}`;
|
|
91
|
-
}
|
package/dist/document.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generate filename for document downloads
|
|
3
|
-
*
|
|
4
|
-
* @param documentType - Type of the document
|
|
5
|
-
* @param documentUuid - UUID of the document
|
|
6
|
-
* @returns Timestamped filename with .pdf extension
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* generateDocumentFilename('agreement', '123-456-789');
|
|
10
|
-
* // returns 'agreement-123-456-789-2024-03-15-10-30-45.pdf'
|
|
11
|
-
*/
|
|
12
|
-
export declare const generateDocumentFilename: (documentType: string, documentUuid: string) => string;
|
|
13
|
-
/**
|
|
14
|
-
* Format document type for display
|
|
15
|
-
*
|
|
16
|
-
* @param documentType - Document type to format
|
|
17
|
-
* @returns Human-readable document type label
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* formatDocumentType('mda'); // returns 'Management Discussion & Analysis'
|
|
21
|
-
* formatDocumentType('soa'); // returns 'Statement of Account'
|
|
22
|
-
* formatDocumentType('agreement'); // returns 'Agreement'
|
|
23
|
-
* formatDocumentType('custom'); // returns 'Custom' (capitalized)
|
|
24
|
-
*/
|
|
25
|
-
export declare const formatDocumentType: (documentType: string) => string;
|
|
26
|
-
/**
|
|
27
|
-
* Format document status for display
|
|
28
|
-
*
|
|
29
|
-
* @param status - Status to format
|
|
30
|
-
* @returns Formatted status string
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* formatDocumentStatus('pending_review'); // returns 'Pending Review'
|
|
34
|
-
* formatDocumentStatus('active'); // returns 'Active'
|
|
35
|
-
* formatDocumentStatus('archived'); // returns 'Archived'
|
|
36
|
-
*/
|
|
37
|
-
export declare const formatDocumentStatus: (status: string) => string;
|
|
38
|
-
//# sourceMappingURL=document.d.ts.map
|
package/dist/document.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,GAAI,cAAc,MAAM,EAAE,cAAc,MAAM,KAAG,MAErF,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,GAAI,cAAc,MAAM,KAAG,MAgBzD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,KAAG,MAErD,CAAC"}
|
package/dist/document.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { generateTimestampedFilename } from './downloads';
|
|
2
|
-
import { formatStatus } from './formatting';
|
|
3
|
-
import { DOCUMENT_TYPE_MDA, DOCUMENT_TYPE_SOA, DOCUMENT_TYPE_AGREEMENT, DOCUMENT_TYPE_LABELS, } from '@cranberry-money/shared-constants';
|
|
4
|
-
/**
|
|
5
|
-
* Generate filename for document downloads
|
|
6
|
-
*
|
|
7
|
-
* @param documentType - Type of the document
|
|
8
|
-
* @param documentUuid - UUID of the document
|
|
9
|
-
* @returns Timestamped filename with .pdf extension
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* generateDocumentFilename('agreement', '123-456-789');
|
|
13
|
-
* // returns 'agreement-123-456-789-2024-03-15-10-30-45.pdf'
|
|
14
|
-
*/
|
|
15
|
-
export const generateDocumentFilename = (documentType, documentUuid) => {
|
|
16
|
-
return generateTimestampedFilename(`${documentType}-${documentUuid}`, 'pdf');
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Format document type for display
|
|
20
|
-
*
|
|
21
|
-
* @param documentType - Document type to format
|
|
22
|
-
* @returns Human-readable document type label
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* formatDocumentType('mda'); // returns 'Management Discussion & Analysis'
|
|
26
|
-
* formatDocumentType('soa'); // returns 'Statement of Account'
|
|
27
|
-
* formatDocumentType('agreement'); // returns 'Agreement'
|
|
28
|
-
* formatDocumentType('custom'); // returns 'Custom' (capitalized)
|
|
29
|
-
*/
|
|
30
|
-
export const formatDocumentType = (documentType) => {
|
|
31
|
-
const lowerType = documentType.toLowerCase();
|
|
32
|
-
if (lowerType === DOCUMENT_TYPE_MDA && DOCUMENT_TYPE_LABELS[DOCUMENT_TYPE_MDA]) {
|
|
33
|
-
return DOCUMENT_TYPE_LABELS[DOCUMENT_TYPE_MDA];
|
|
34
|
-
}
|
|
35
|
-
if (lowerType === DOCUMENT_TYPE_SOA && DOCUMENT_TYPE_LABELS[DOCUMENT_TYPE_SOA]) {
|
|
36
|
-
return DOCUMENT_TYPE_LABELS[DOCUMENT_TYPE_SOA];
|
|
37
|
-
}
|
|
38
|
-
if (lowerType === DOCUMENT_TYPE_AGREEMENT && DOCUMENT_TYPE_LABELS[DOCUMENT_TYPE_AGREEMENT]) {
|
|
39
|
-
return DOCUMENT_TYPE_LABELS[DOCUMENT_TYPE_AGREEMENT];
|
|
40
|
-
}
|
|
41
|
-
return documentType.charAt(0).toUpperCase() + documentType.slice(1);
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Format document status for display
|
|
45
|
-
*
|
|
46
|
-
* @param status - Status to format
|
|
47
|
-
* @returns Formatted status string
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* formatDocumentStatus('pending_review'); // returns 'Pending Review'
|
|
51
|
-
* formatDocumentStatus('active'); // returns 'Active'
|
|
52
|
-
* formatDocumentStatus('archived'); // returns 'Archived'
|
|
53
|
-
*/
|
|
54
|
-
export const formatDocumentStatus = (status) => {
|
|
55
|
-
return formatStatus(status);
|
|
56
|
-
};
|
package/dist/downloads.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File download utilities
|
|
3
|
-
* Browser-based file download functionality
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Download a blob as a file
|
|
7
|
-
* Creates a temporary download link and triggers the download
|
|
8
|
-
* @param blob - The blob to download
|
|
9
|
-
* @param filename - The filename for the downloaded file
|
|
10
|
-
*/
|
|
11
|
-
export declare function downloadBlob(blob: Blob, filename: string): void;
|
|
12
|
-
/**
|
|
13
|
-
* Download text content as a file
|
|
14
|
-
* @param content - Text content to download
|
|
15
|
-
* @param filename - The filename for the downloaded file
|
|
16
|
-
* @param mimeType - MIME type for the file (default: text/plain)
|
|
17
|
-
*/
|
|
18
|
-
export declare function downloadTextFile(content: string, filename: string, mimeType?: string): void;
|
|
19
|
-
/**
|
|
20
|
-
* Download JSON data as a file
|
|
21
|
-
* @param data - JavaScript object to serialize and download
|
|
22
|
-
* @param filename - The filename for the downloaded file (should end with .json)
|
|
23
|
-
*/
|
|
24
|
-
export declare function downloadJsonFile(data: unknown, filename: string): void;
|
|
25
|
-
/**
|
|
26
|
-
* Generate a timestamped filename
|
|
27
|
-
* @param baseName - Base name for the file (without extension)
|
|
28
|
-
* @param extension - File extension (with or without leading dot)
|
|
29
|
-
* @param includeTime - Whether to include time in timestamp (default: false)
|
|
30
|
-
* @returns Timestamped filename
|
|
31
|
-
*/
|
|
32
|
-
export declare function generateTimestampedFilename(baseName: string, extension: string, includeTime?: boolean): string;
|
|
33
|
-
/**
|
|
34
|
-
* Download data URL as a file
|
|
35
|
-
* @param dataUrl - Data URL (data:mime/type;base64,data)
|
|
36
|
-
* @param filename - The filename for the downloaded file
|
|
37
|
-
*/
|
|
38
|
-
export declare function downloadDataUrl(dataUrl: string, filename: string): void;
|
|
39
|
-
/**
|
|
40
|
-
* Download CSV data as a file
|
|
41
|
-
* @param data - Array of objects to convert to CSV
|
|
42
|
-
* @param filename - The filename for the downloaded file (should end with .csv)
|
|
43
|
-
* @param headers - Optional custom headers (uses object keys if not provided)
|
|
44
|
-
*/
|
|
45
|
-
export declare function downloadCsvFile<T extends Record<string, unknown>>(data: T[], filename: string, headers?: string[]): void;
|
|
46
|
-
//# sourceMappingURL=downloads.d.ts.map
|
package/dist/downloads.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"downloads.d.ts","sourceRoot":"","sources":["../src/downloads.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAS/D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAqB,GAAG,IAAI,CAGzG;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAGtE;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,GAAE,OAAe,GAAG,MAAM,CASrH;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAOvE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/D,IAAI,EAAE,CAAC,EAAE,EACT,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,EAAE,GACjB,IAAI,CAqBN"}
|
package/dist/downloads.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File download utilities
|
|
3
|
-
* Browser-based file download functionality
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Download a blob as a file
|
|
7
|
-
* Creates a temporary download link and triggers the download
|
|
8
|
-
* @param blob - The blob to download
|
|
9
|
-
* @param filename - The filename for the downloaded file
|
|
10
|
-
*/
|
|
11
|
-
export function downloadBlob(blob, filename) {
|
|
12
|
-
const url = window.URL.createObjectURL(blob);
|
|
13
|
-
const link = document.createElement('a');
|
|
14
|
-
link.href = url;
|
|
15
|
-
link.setAttribute('download', filename);
|
|
16
|
-
document.body.appendChild(link);
|
|
17
|
-
link.click();
|
|
18
|
-
document.body.removeChild(link);
|
|
19
|
-
window.URL.revokeObjectURL(url);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Download text content as a file
|
|
23
|
-
* @param content - Text content to download
|
|
24
|
-
* @param filename - The filename for the downloaded file
|
|
25
|
-
* @param mimeType - MIME type for the file (default: text/plain)
|
|
26
|
-
*/
|
|
27
|
-
export function downloadTextFile(content, filename, mimeType = 'text/plain') {
|
|
28
|
-
const blob = new Blob([content], { type: mimeType });
|
|
29
|
-
downloadBlob(blob, filename);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Download JSON data as a file
|
|
33
|
-
* @param data - JavaScript object to serialize and download
|
|
34
|
-
* @param filename - The filename for the downloaded file (should end with .json)
|
|
35
|
-
*/
|
|
36
|
-
export function downloadJsonFile(data, filename) {
|
|
37
|
-
const jsonString = JSON.stringify(data, null, 2);
|
|
38
|
-
downloadTextFile(jsonString, filename, 'application/json');
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Generate a timestamped filename
|
|
42
|
-
* @param baseName - Base name for the file (without extension)
|
|
43
|
-
* @param extension - File extension (with or without leading dot)
|
|
44
|
-
* @param includeTime - Whether to include time in timestamp (default: false)
|
|
45
|
-
* @returns Timestamped filename
|
|
46
|
-
*/
|
|
47
|
-
export function generateTimestampedFilename(baseName, extension, includeTime = false) {
|
|
48
|
-
const now = new Date();
|
|
49
|
-
const dateString = now.toISOString().split('T')[0]; // YYYY-MM-DD
|
|
50
|
-
const timeString = now.toTimeString().split(' ')[0]?.replace(/:/g, '-') || '00-00-00'; // HH-MM-SS
|
|
51
|
-
const cleanExtension = extension.startsWith('.') ? extension : `.${extension}`;
|
|
52
|
-
const timestamp = includeTime ? `${dateString}-${timeString}` : dateString;
|
|
53
|
-
return `${baseName}-${timestamp}${cleanExtension}`;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Download data URL as a file
|
|
57
|
-
* @param dataUrl - Data URL (data:mime/type;base64,data)
|
|
58
|
-
* @param filename - The filename for the downloaded file
|
|
59
|
-
*/
|
|
60
|
-
export function downloadDataUrl(dataUrl, filename) {
|
|
61
|
-
const link = document.createElement('a');
|
|
62
|
-
link.href = dataUrl;
|
|
63
|
-
link.setAttribute('download', filename);
|
|
64
|
-
document.body.appendChild(link);
|
|
65
|
-
link.click();
|
|
66
|
-
document.body.removeChild(link);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Download CSV data as a file
|
|
70
|
-
* @param data - Array of objects to convert to CSV
|
|
71
|
-
* @param filename - The filename for the downloaded file (should end with .csv)
|
|
72
|
-
* @param headers - Optional custom headers (uses object keys if not provided)
|
|
73
|
-
*/
|
|
74
|
-
export function downloadCsvFile(data, filename, headers) {
|
|
75
|
-
if (data.length === 0) {
|
|
76
|
-
throw new Error('Cannot create CSV from empty data array');
|
|
77
|
-
}
|
|
78
|
-
const csvHeaders = headers || Object.keys(data[0] || {});
|
|
79
|
-
const csvRows = data.map(row => csvHeaders
|
|
80
|
-
.map(header => {
|
|
81
|
-
const value = row[header];
|
|
82
|
-
// Escape commas and quotes in CSV values
|
|
83
|
-
const stringValue = String(value ?? '');
|
|
84
|
-
return stringValue.includes(',') || stringValue.includes('"')
|
|
85
|
-
? `"${stringValue.replace(/"/g, '""')}"`
|
|
86
|
-
: stringValue;
|
|
87
|
-
})
|
|
88
|
-
.join(','));
|
|
89
|
-
const csvContent = [csvHeaders.join(','), ...csvRows].join('\n');
|
|
90
|
-
downloadTextFile(csvContent, filename, 'text/csv');
|
|
91
|
-
}
|
package/dist/filters.d.ts
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared utility functions for filter operations
|
|
3
|
-
* Generic, reusable filter functions for managing filter states
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Checks if any filters are active
|
|
7
|
-
* @param filters - The filter object to check
|
|
8
|
-
* @param excludeFields - Fields to exclude from the active check (default: ['searchQuery'])
|
|
9
|
-
* @returns true if any filters are active, false otherwise
|
|
10
|
-
*/
|
|
11
|
-
export declare function hasActiveFilters<T extends Record<string, unknown>>(filters: T, excludeFields?: (keyof T)[]): boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Counts the number of active filters
|
|
14
|
-
* @param filters - The filter object to count
|
|
15
|
-
* @param excludeFields - Fields to exclude from the count (default: ['searchQuery'])
|
|
16
|
-
* @returns The number of active filters
|
|
17
|
-
*/
|
|
18
|
-
export declare function countActiveFilters<T extends Record<string, unknown>>(filters: T, excludeFields?: (keyof T)[]): number;
|
|
19
|
-
/**
|
|
20
|
-
* Clears all filters except specified fields
|
|
21
|
-
* @param filters - The filter object to clear
|
|
22
|
-
* @param preserveFields - Fields to preserve when clearing (default: [])
|
|
23
|
-
* @returns A new filter object with cleared values
|
|
24
|
-
*/
|
|
25
|
-
export declare function clearAllFilters<T extends Record<string, unknown>>(filters: T, preserveFields?: (keyof T)[]): Partial<T>;
|
|
26
|
-
/**
|
|
27
|
-
* Type-safe filter update helper
|
|
28
|
-
* @param currentFilters - The current filter state
|
|
29
|
-
* @param updates - The updates to apply
|
|
30
|
-
* @returns A new filter object with updates applied
|
|
31
|
-
*/
|
|
32
|
-
export declare function updateFilters<T extends Record<string, unknown>>(currentFilters: T, updates: Partial<T>): T;
|
|
33
|
-
/**
|
|
34
|
-
* Checks if a filter value is empty
|
|
35
|
-
* @param value - The value to check
|
|
36
|
-
* @returns true if the value is empty, false otherwise
|
|
37
|
-
*/
|
|
38
|
-
export declare function isFilterEmpty(value: unknown): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Removes empty filter values from an object
|
|
41
|
-
* @param filters - The filter object to clean
|
|
42
|
-
* @returns A new filter object with empty values removed
|
|
43
|
-
*/
|
|
44
|
-
export declare function removeEmptyFilters<T extends Record<string, unknown>>(filters: T): Partial<T>;
|
|
45
|
-
/**
|
|
46
|
-
* Merges two filter objects, with the second object taking precedence
|
|
47
|
-
* @param baseFilters - The base filter object
|
|
48
|
-
* @param overrideFilters - The override filter object
|
|
49
|
-
* @returns A new merged filter object
|
|
50
|
-
*/
|
|
51
|
-
export declare function mergeFilters<T extends Record<string, unknown>>(baseFilters: T, overrideFilters: Partial<T>): T;
|
|
52
|
-
/**
|
|
53
|
-
* Compares two filter objects for equality
|
|
54
|
-
* @param filters1 - The first filter object
|
|
55
|
-
* @param filters2 - The second filter object
|
|
56
|
-
* @returns true if the filters are equal, false otherwise
|
|
57
|
-
*/
|
|
58
|
-
export declare function areFiltersEqual<T extends Record<string, unknown>>(filters1: T, filters2: T): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Creates a filter predicate function from a filter object
|
|
61
|
-
* @param filters - The filter object to create a predicate from
|
|
62
|
-
* @returns A predicate function that tests if an item matches the filters
|
|
63
|
-
*/
|
|
64
|
-
export declare function createFilterPredicate<T extends Record<string, unknown>, U extends Record<string, unknown>>(filters: T): (item: U) => boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Check if any instrument filters are active (excluding searchQuery)
|
|
67
|
-
* Common pattern for instrument filter checking across applications
|
|
68
|
-
* @param filters - The instrument filter object to check
|
|
69
|
-
* @returns true if any non-search filters are active
|
|
70
|
-
*/
|
|
71
|
-
export declare function hasActiveInstrumentFilters<T extends Record<string, unknown>>(filters: T): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Count active instrument filters (excluding searchQuery)
|
|
74
|
-
* Common pattern for instrument filter counting across applications
|
|
75
|
-
* @param filters - The instrument filter object to count
|
|
76
|
-
* @returns number of active non-search filters
|
|
77
|
-
*/
|
|
78
|
-
export declare function countActiveInstrumentFilters<T extends Record<string, unknown>>(filters: T): number;
|
|
79
|
-
/**
|
|
80
|
-
* Check if any trade filters are active (excluding searchQuery)
|
|
81
|
-
* Common pattern for trade filter checking across applications
|
|
82
|
-
* @param filters - The trade filter object to check
|
|
83
|
-
* @returns true if any non-search filters are active
|
|
84
|
-
*/
|
|
85
|
-
export declare function hasActiveTradeFilters<T extends Record<string, unknown>>(filters: T): boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Count active trade filters (excluding searchQuery)
|
|
88
|
-
* Common pattern for trade filter counting across applications
|
|
89
|
-
* @param filters - The trade filter object to count
|
|
90
|
-
* @returns number of active non-search filters
|
|
91
|
-
*/
|
|
92
|
-
export declare function countActiveTradeFilters<T extends Record<string, unknown>>(filters: T): number;
|
|
93
|
-
/**
|
|
94
|
-
* Check if any transaction filters are active (excluding searchQuery)
|
|
95
|
-
* Common pattern for transaction filter checking across applications
|
|
96
|
-
* @param filters - The transaction filter object to check
|
|
97
|
-
* @returns true if any non-search filters are active
|
|
98
|
-
*/
|
|
99
|
-
export declare function hasActiveTransactionFilters<T extends Record<string, unknown>>(filters: T): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Count active transaction filters (excluding searchQuery)
|
|
102
|
-
* Common pattern for transaction filter counting across applications
|
|
103
|
-
* @param filters - The transaction filter object to count
|
|
104
|
-
* @returns number of active non-search filters
|
|
105
|
-
*/
|
|
106
|
-
export declare function countActiveTransactionFilters<T extends Record<string, unknown>>(filters: T): number;
|
|
107
|
-
/**
|
|
108
|
-
* Check if any target trade filters are active (excluding searchQuery)
|
|
109
|
-
* Common pattern for target trade filter checking across applications
|
|
110
|
-
* @param filters - The target trade filter object to check
|
|
111
|
-
* @returns true if any non-search filters are active
|
|
112
|
-
*/
|
|
113
|
-
export declare function hasActiveTargetTradeFilters<T extends Record<string, unknown>>(filters: T): boolean;
|
|
114
|
-
/**
|
|
115
|
-
* Count active target trade filters (excluding searchQuery)
|
|
116
|
-
* Common pattern for target trade filter counting across applications
|
|
117
|
-
* @param filters - The target trade filter object to count
|
|
118
|
-
* @returns number of active non-search filters
|
|
119
|
-
*/
|
|
120
|
-
export declare function countActiveTargetTradeFilters<T extends Record<string, unknown>>(filters: T): number;
|
|
121
|
-
//# sourceMappingURL=filters.d.ts.map
|
package/dist/filters.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../src/filters.ts"],"names":[],"mappings":"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"}
|
package/dist/filters.js
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared utility functions for filter operations
|
|
3
|
-
* Generic, reusable filter functions for managing filter states
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Checks if any filters are active
|
|
7
|
-
* @param filters - The filter object to check
|
|
8
|
-
* @param excludeFields - Fields to exclude from the active check (default: ['searchQuery'])
|
|
9
|
-
* @returns true if any filters are active, false otherwise
|
|
10
|
-
*/
|
|
11
|
-
export function hasActiveFilters(filters, excludeFields = ['searchQuery']) {
|
|
12
|
-
const relevantEntries = Object.entries(filters).filter(([key]) => !excludeFields.includes(key));
|
|
13
|
-
return relevantEntries.some(([, value]) => value !== undefined && value !== null && value !== '' && !(Array.isArray(value) && value.length === 0));
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Counts the number of active filters
|
|
17
|
-
* @param filters - The filter object to count
|
|
18
|
-
* @param excludeFields - Fields to exclude from the count (default: ['searchQuery'])
|
|
19
|
-
* @returns The number of active filters
|
|
20
|
-
*/
|
|
21
|
-
export function countActiveFilters(filters, excludeFields = ['searchQuery']) {
|
|
22
|
-
const relevantEntries = Object.entries(filters).filter(([key]) => !excludeFields.includes(key));
|
|
23
|
-
return relevantEntries.filter(([, value]) => value !== undefined && value !== null && value !== '' && !(Array.isArray(value) && value.length === 0)).length;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Clears all filters except specified fields
|
|
27
|
-
* @param filters - The filter object to clear
|
|
28
|
-
* @param preserveFields - Fields to preserve when clearing (default: [])
|
|
29
|
-
* @returns A new filter object with cleared values
|
|
30
|
-
*/
|
|
31
|
-
export function clearAllFilters(filters, preserveFields = []) {
|
|
32
|
-
const clearedFilters = {};
|
|
33
|
-
// Preserve specified fields
|
|
34
|
-
preserveFields.forEach(field => {
|
|
35
|
-
if (field in filters) {
|
|
36
|
-
clearedFilters[field] = filters[field];
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
return clearedFilters;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Type-safe filter update helper
|
|
43
|
-
* @param currentFilters - The current filter state
|
|
44
|
-
* @param updates - The updates to apply
|
|
45
|
-
* @returns A new filter object with updates applied
|
|
46
|
-
*/
|
|
47
|
-
export function updateFilters(currentFilters, updates) {
|
|
48
|
-
return { ...currentFilters, ...updates };
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Checks if a filter value is empty
|
|
52
|
-
* @param value - The value to check
|
|
53
|
-
* @returns true if the value is empty, false otherwise
|
|
54
|
-
*/
|
|
55
|
-
export function isFilterEmpty(value) {
|
|
56
|
-
return (value === undefined ||
|
|
57
|
-
value === null ||
|
|
58
|
-
value === '' ||
|
|
59
|
-
(Array.isArray(value) && value.length === 0) ||
|
|
60
|
-
(typeof value === 'object' && value !== null && Object.keys(value).length === 0));
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Removes empty filter values from an object
|
|
64
|
-
* @param filters - The filter object to clean
|
|
65
|
-
* @returns A new filter object with empty values removed
|
|
66
|
-
*/
|
|
67
|
-
export function removeEmptyFilters(filters) {
|
|
68
|
-
const cleanedFilters = {};
|
|
69
|
-
Object.keys(filters).forEach(key => {
|
|
70
|
-
const value = filters[key];
|
|
71
|
-
if (!isFilterEmpty(value)) {
|
|
72
|
-
cleanedFilters[key] = value;
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
return cleanedFilters;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Merges two filter objects, with the second object taking precedence
|
|
79
|
-
* @param baseFilters - The base filter object
|
|
80
|
-
* @param overrideFilters - The override filter object
|
|
81
|
-
* @returns A new merged filter object
|
|
82
|
-
*/
|
|
83
|
-
export function mergeFilters(baseFilters, overrideFilters) {
|
|
84
|
-
return { ...baseFilters, ...overrideFilters };
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Compares two filter objects for equality
|
|
88
|
-
* @param filters1 - The first filter object
|
|
89
|
-
* @param filters2 - The second filter object
|
|
90
|
-
* @returns true if the filters are equal, false otherwise
|
|
91
|
-
*/
|
|
92
|
-
export function areFiltersEqual(filters1, filters2) {
|
|
93
|
-
const keys1 = Object.keys(filters1);
|
|
94
|
-
const keys2 = Object.keys(filters2);
|
|
95
|
-
if (keys1.length !== keys2.length) {
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
return keys1.every(key => {
|
|
99
|
-
const value1 = filters1[key];
|
|
100
|
-
const value2 = filters2[key];
|
|
101
|
-
if (Array.isArray(value1) && Array.isArray(value2)) {
|
|
102
|
-
return value1.length === value2.length && value1.every((v, i) => v === value2[i]);
|
|
103
|
-
}
|
|
104
|
-
return value1 === value2;
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Creates a filter predicate function from a filter object
|
|
109
|
-
* @param filters - The filter object to create a predicate from
|
|
110
|
-
* @returns A predicate function that tests if an item matches the filters
|
|
111
|
-
*/
|
|
112
|
-
export function createFilterPredicate(filters) {
|
|
113
|
-
const activeFilters = removeEmptyFilters(filters);
|
|
114
|
-
const filterEntries = Object.entries(activeFilters);
|
|
115
|
-
if (filterEntries.length === 0) {
|
|
116
|
-
return () => true;
|
|
117
|
-
}
|
|
118
|
-
return (item) => {
|
|
119
|
-
return filterEntries.every(([key, filterValue]) => {
|
|
120
|
-
const itemValue = item[key];
|
|
121
|
-
if (Array.isArray(filterValue)) {
|
|
122
|
-
return filterValue.includes(itemValue);
|
|
123
|
-
}
|
|
124
|
-
if (typeof filterValue === 'string' && typeof itemValue === 'string') {
|
|
125
|
-
return itemValue.toLowerCase().includes(filterValue.toLowerCase());
|
|
126
|
-
}
|
|
127
|
-
return itemValue === filterValue;
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
// ============================================================================
|
|
132
|
-
// Common Filter Patterns
|
|
133
|
-
// Pre-configured utilities for common filter use cases
|
|
134
|
-
// ============================================================================
|
|
135
|
-
/**
|
|
136
|
-
* Check if any instrument filters are active (excluding searchQuery)
|
|
137
|
-
* Common pattern for instrument filter checking across applications
|
|
138
|
-
* @param filters - The instrument filter object to check
|
|
139
|
-
* @returns true if any non-search filters are active
|
|
140
|
-
*/
|
|
141
|
-
export function hasActiveInstrumentFilters(filters) {
|
|
142
|
-
return hasActiveFilters(filters, ['searchQuery']);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Count active instrument filters (excluding searchQuery)
|
|
146
|
-
* Common pattern for instrument filter counting across applications
|
|
147
|
-
* @param filters - The instrument filter object to count
|
|
148
|
-
* @returns number of active non-search filters
|
|
149
|
-
*/
|
|
150
|
-
export function countActiveInstrumentFilters(filters) {
|
|
151
|
-
return countActiveFilters(filters, ['searchQuery']);
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Check if any trade filters are active (excluding searchQuery)
|
|
155
|
-
* Common pattern for trade filter checking across applications
|
|
156
|
-
* @param filters - The trade filter object to check
|
|
157
|
-
* @returns true if any non-search filters are active
|
|
158
|
-
*/
|
|
159
|
-
export function hasActiveTradeFilters(filters) {
|
|
160
|
-
return hasActiveFilters(filters, ['searchQuery']);
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Count active trade filters (excluding searchQuery)
|
|
164
|
-
* Common pattern for trade filter counting across applications
|
|
165
|
-
* @param filters - The trade filter object to count
|
|
166
|
-
* @returns number of active non-search filters
|
|
167
|
-
*/
|
|
168
|
-
export function countActiveTradeFilters(filters) {
|
|
169
|
-
return countActiveFilters(filters, ['searchQuery']);
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Check if any transaction filters are active (excluding searchQuery)
|
|
173
|
-
* Common pattern for transaction filter checking across applications
|
|
174
|
-
* @param filters - The transaction filter object to check
|
|
175
|
-
* @returns true if any non-search filters are active
|
|
176
|
-
*/
|
|
177
|
-
export function hasActiveTransactionFilters(filters) {
|
|
178
|
-
return hasActiveFilters(filters, ['searchQuery']);
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Count active transaction filters (excluding searchQuery)
|
|
182
|
-
* Common pattern for transaction filter counting across applications
|
|
183
|
-
* @param filters - The transaction filter object to count
|
|
184
|
-
* @returns number of active non-search filters
|
|
185
|
-
*/
|
|
186
|
-
export function countActiveTransactionFilters(filters) {
|
|
187
|
-
return countActiveFilters(filters, ['searchQuery']);
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Check if any target trade filters are active (excluding searchQuery)
|
|
191
|
-
* Common pattern for target trade filter checking across applications
|
|
192
|
-
* @param filters - The target trade filter object to check
|
|
193
|
-
* @returns true if any non-search filters are active
|
|
194
|
-
*/
|
|
195
|
-
export function hasActiveTargetTradeFilters(filters) {
|
|
196
|
-
return hasActiveFilters(filters, ['searchQuery']);
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Count active target trade filters (excluding searchQuery)
|
|
200
|
-
* Common pattern for target trade filter counting across applications
|
|
201
|
-
* @param filters - The target trade filter object to count
|
|
202
|
-
* @returns number of active non-search filters
|
|
203
|
-
*/
|
|
204
|
-
export function countActiveTargetTradeFilters(filters) {
|
|
205
|
-
return countActiveFilters(filters, ['searchQuery']);
|
|
206
|
-
}
|