tycho-components 0.21.6 → 0.21.9
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/common/AppForm/AppForm.js +1 -1
- package/dist/common/AppForm/AppFormField.d.ts +1 -0
- package/dist/functions/DateUtils.d.ts +6 -0
- package/dist/functions/DateUtils.js +14 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/vendor/index.d.ts +10 -0
- package/dist/vendor/index.js +7 -0
- package/package.json +7 -6
|
@@ -25,7 +25,7 @@ export default function AppForm({ fields, form, prefix, onChangeFunctions = {},
|
|
|
25
25
|
const loadOptions = runtimeLoadOptions[field.attr];
|
|
26
26
|
if (!loadOptions)
|
|
27
27
|
return null;
|
|
28
|
-
return (_jsx(AsyncSelectField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled, required: field.required, multiple: field.multiple, freeSolo: field.freeSolo, loadOptions: loadOptions, placeholder: field.title, noOptionsText: field.translation, onChange: (_attr, value) => handleChange?.(value) }, name));
|
|
28
|
+
return (_jsx(AsyncSelectField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled, required: field.required, multiple: field.multiple, freeSolo: field.freeSolo, minQueryLength: field.minQueryLength, loadOptions: loadOptions, placeholder: field.title, noOptionsText: field.translation, onChange: (_attr, value) => handleChange?.(value) }, name));
|
|
29
29
|
}
|
|
30
30
|
if (field.type === 'select') {
|
|
31
31
|
const selectOptions = getOptions(field.attr) || field.options || [];
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import { format } from 'date-fns';
|
|
1
2
|
declare function extractDateFromMongoId(id: string, time?: boolean): string;
|
|
2
3
|
declare const DateUtils: {
|
|
3
4
|
millis: () => number;
|
|
4
5
|
formatDate: (date: Date | null, fmt: string) => string;
|
|
6
|
+
format: typeof format;
|
|
7
|
+
parseISOString: (s: string) => Date;
|
|
8
|
+
isValidDate: (date: Date) => boolean;
|
|
9
|
+
parseDate: (dateStr: string, formatStr: string, referenceDate?: Date) => Date;
|
|
10
|
+
addSecondsToDate: (date: Date, seconds: number) => Date;
|
|
5
11
|
parseTime: (time: number) => string;
|
|
6
12
|
extractDateFromMongoId: typeof extractDateFromMongoId;
|
|
7
13
|
formatDateTime: (isoDateStr: string, outputFormat: string) => string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { addSeconds, parseISO } from 'date-fns';
|
|
2
|
-
import { format } from 'date-fns-tz';
|
|
1
|
+
import { addSeconds, format, isValid, parse, parseISO, } from 'date-fns';
|
|
2
|
+
import { format as formatTz } from 'date-fns-tz';
|
|
3
3
|
const millis = () => new Date().getTime();
|
|
4
4
|
const formatDateTime = (isoDateStr, outputFormat) => {
|
|
5
5
|
if (!isoDateStr)
|
|
6
6
|
return '';
|
|
7
7
|
try {
|
|
8
8
|
const parsedDate = parseISO(isoDateStr);
|
|
9
|
-
return
|
|
9
|
+
return formatTz(parsedDate, outputFormat);
|
|
10
10
|
}
|
|
11
11
|
catch (error) {
|
|
12
12
|
console.error('Invalid date or format:', error);
|
|
@@ -16,8 +16,12 @@ const formatDateTime = (isoDateStr, outputFormat) => {
|
|
|
16
16
|
const formatDate = (date, fmt) => {
|
|
17
17
|
if (!date)
|
|
18
18
|
return '';
|
|
19
|
-
return
|
|
19
|
+
return formatTz(date, fmt);
|
|
20
20
|
};
|
|
21
|
+
const parseISOString = (s) => parseISO(s);
|
|
22
|
+
const isValidDate = (date) => isValid(date);
|
|
23
|
+
const parseDate = (dateStr, formatStr, referenceDate) => parse(dateStr, formatStr, referenceDate ?? new Date());
|
|
24
|
+
const addSecondsToDate = (date, seconds) => addSeconds(date, seconds);
|
|
21
25
|
const parseTime = (time) => {
|
|
22
26
|
if (time == null || time <= 0)
|
|
23
27
|
return '00:00:00.000';
|
|
@@ -30,12 +34,17 @@ function extractDateFromMongoId(id, time) {
|
|
|
30
34
|
const timestampInMilliseconds = parseInt(hexTimestamp, 16) * 1000;
|
|
31
35
|
const dtf = time ? `${DATE_PATTERN} ${TIME_PATTERN}` : DATE_PATTERN;
|
|
32
36
|
const date = addSeconds(new Date(0), timestampInMilliseconds / 1000);
|
|
33
|
-
const formattedDate =
|
|
37
|
+
const formattedDate = formatTz(date, dtf);
|
|
34
38
|
return formattedDate;
|
|
35
39
|
}
|
|
36
40
|
const DateUtils = {
|
|
37
41
|
millis,
|
|
38
42
|
formatDate,
|
|
43
|
+
format,
|
|
44
|
+
parseISOString,
|
|
45
|
+
isValidDate,
|
|
46
|
+
parseDate,
|
|
47
|
+
addSecondsToDate,
|
|
39
48
|
parseTime,
|
|
40
49
|
extractDateFromMongoId,
|
|
41
50
|
formatDateTime,
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as cx } from 'classnames';
|
|
2
|
+
export * as yup from 'yup';
|
|
3
|
+
export { yupResolver } from '@hookform/resolvers/yup';
|
|
4
|
+
export type { ColumnDef, PaginationState } from '@tanstack/react-table';
|
|
5
|
+
export type { Core as CytoscapeCore } from 'cytoscape';
|
|
6
|
+
export { default as cytoscape } from 'cytoscape';
|
|
7
|
+
export type { EdgeDefinition, EdgeSingular, NodeDefinition, NodeSingular, Position, StylesheetCSS, } from 'cytoscape';
|
|
8
|
+
export { default as cytoscapeDagre } from 'cytoscape-dagre';
|
|
9
|
+
export { default as cytoscapeNodeHtmlLabel } from 'cytoscape-node-html-label';
|
|
10
|
+
export { format as formatTz, toZonedTime, } from 'date-fns-tz';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as cx } from 'classnames';
|
|
2
|
+
export * as yup from 'yup';
|
|
3
|
+
export { yupResolver } from '@hookform/resolvers/yup';
|
|
4
|
+
export { default as cytoscape } from 'cytoscape';
|
|
5
|
+
export { default as cytoscapeDagre } from 'cytoscape-dagre';
|
|
6
|
+
export { default as cytoscapeNodeHtmlLabel } from 'cytoscape-node-html-label';
|
|
7
|
+
export { format as formatTz, toZonedTime, } from 'date-fns-tz';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tycho-components",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.21.
|
|
4
|
+
"version": "0.21.9",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -46,10 +46,12 @@
|
|
|
46
46
|
"dist/"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
+
"@hookform/resolvers": "^5.2.2",
|
|
49
50
|
"@tanstack/react-table": "^8.20.6",
|
|
50
51
|
"axios": "^1.13.6",
|
|
51
52
|
"classnames": "^2.5.1",
|
|
52
53
|
"cytoscape": "^3.28.1",
|
|
54
|
+
"cytoscape-dagre": "^2.5.0",
|
|
53
55
|
"cytoscape-node-html-label": "^1.2.2",
|
|
54
56
|
"date-fns": "^4.1.0",
|
|
55
57
|
"date-fns-tz": "^3.2.0",
|
|
@@ -62,12 +64,12 @@
|
|
|
62
64
|
"react-easy-edit": "^2.0.0",
|
|
63
65
|
"react-loading": "^2.0.3",
|
|
64
66
|
"react-simple-keyboard": "^3.8.66",
|
|
65
|
-
"simple-keyboard-layouts": "^3.4.82"
|
|
67
|
+
"simple-keyboard-layouts": "^3.4.82",
|
|
68
|
+
"yup": "^1.2.0"
|
|
66
69
|
},
|
|
67
70
|
"peerDependencies": {
|
|
68
71
|
"@emotion/react": "^11.13.3",
|
|
69
72
|
"@emotion/styled": "^11.13.0",
|
|
70
|
-
"@hookform/resolvers": "^5.2.2",
|
|
71
73
|
"@mui/icons-material": "7.3.0",
|
|
72
74
|
"@mui/material": "7.3.0",
|
|
73
75
|
"i18next": "^23.3.0",
|
|
@@ -78,10 +80,9 @@
|
|
|
78
80
|
"react-i18next": "^13.0.2",
|
|
79
81
|
"react-router-dom": "^6.14.2",
|
|
80
82
|
"react-toastify": "^9.1.3",
|
|
81
|
-
"tycho-storybook": "0.8.
|
|
83
|
+
"tycho-storybook": "0.8.3",
|
|
82
84
|
"wavesurfer-react": "^2.2.2",
|
|
83
|
-
"wavesurfer.js": "^6.6.3"
|
|
84
|
-
"yup": "^1.2.0"
|
|
85
|
+
"wavesurfer.js": "^6.6.3"
|
|
85
86
|
},
|
|
86
87
|
"devDependencies": {
|
|
87
88
|
"@storybook/addon-docs": "^10.1.11",
|