@astroapps/forms-core 2.0.0 → 2.0.2
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/lib/index.cjs +7 -2
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +10 -3
- package/lib/index.js.map +1 -1
- package/package.json +3 -2
- package/src/defaultSchemaInterface.ts +8 -1
- package/src/resolveChildren.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astroapps/forms-core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.cjs",
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"clsx": "^1 || ^2",
|
|
30
30
|
"uuid": "^10.0.0",
|
|
31
|
-
"jsonata": "^2.0.4"
|
|
31
|
+
"jsonata": "^2.0.4",
|
|
32
|
+
"@internationalized/date": "^3.10.0"
|
|
32
33
|
},
|
|
33
34
|
"peerDependencies": {
|
|
34
35
|
"@astroapps/controls": "^1.4.0"
|
|
@@ -9,11 +9,18 @@ import { SchemaInterface } from "./schemaInterface";
|
|
|
9
9
|
import { SchemaDataNode } from "./schemaDataNode";
|
|
10
10
|
import { SchemaNode } from "./schemaNode";
|
|
11
11
|
import { Control, ControlSetup } from "@astroapps/controls";
|
|
12
|
+
import { parseDateTime as pdt } from "@internationalized/date";
|
|
12
13
|
|
|
13
14
|
export class DefaultSchemaInterface implements SchemaInterface {
|
|
14
15
|
constructor(
|
|
15
16
|
protected boolStrings: [string, string] = ["No", "Yes"],
|
|
16
|
-
protected parseDateTime: (s: string) => number = (s) =>
|
|
17
|
+
protected parseDateTime: (s: string) => number = (s) => {
|
|
18
|
+
try {
|
|
19
|
+
return pdt(s).toDate("UTC").getTime();
|
|
20
|
+
} catch (e) {
|
|
21
|
+
return Number.NaN;
|
|
22
|
+
}
|
|
23
|
+
},
|
|
17
24
|
) {}
|
|
18
25
|
|
|
19
26
|
parseToMillis(field: SchemaField, v: string): number {
|
package/src/resolveChildren.ts
CHANGED
|
@@ -104,7 +104,7 @@ export function resolveArrayChildren(
|
|
|
104
104
|
const childCount = childNodes.length;
|
|
105
105
|
const singleChild = childCount === 1 ? childNodes[0] : null;
|
|
106
106
|
return data.control.as<any[]>().elements.map((x, i) => ({
|
|
107
|
-
childKey: x.uniqueId,
|
|
107
|
+
childKey: x.uniqueId + "/" + i,
|
|
108
108
|
create: () => ({
|
|
109
109
|
definition: !childCount
|
|
110
110
|
? ({
|