@genesislcap/foundation-forms 14.354.0 → 14.354.1

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.
@@ -523,6 +523,198 @@
523
523
  }
524
524
  ]
525
525
  },
526
+ {
527
+ "kind": "javascript-module",
528
+ "path": "src/jsonforms/json-forms.ts",
529
+ "declarations": [
530
+ {
531
+ "kind": "class",
532
+ "description": "",
533
+ "name": "JSONForms",
534
+ "members": [
535
+ {
536
+ "kind": "field",
537
+ "name": "submitted",
538
+ "type": {
539
+ "text": "boolean"
540
+ }
541
+ },
542
+ {
543
+ "kind": "field",
544
+ "name": "prefix"
545
+ },
546
+ {
547
+ "kind": "method",
548
+ "name": "prefixChanged"
549
+ },
550
+ {
551
+ "kind": "field",
552
+ "name": "jsonforms"
553
+ },
554
+ {
555
+ "kind": "field",
556
+ "name": "i18n"
557
+ },
558
+ {
559
+ "kind": "field",
560
+ "name": "uichemaToUse"
561
+ },
562
+ {
563
+ "kind": "field",
564
+ "name": "schema"
565
+ },
566
+ {
567
+ "kind": "method",
568
+ "name": "schemaChanged"
569
+ },
570
+ {
571
+ "kind": "field",
572
+ "name": "uischema",
573
+ "type": {
574
+ "text": "UISchemaElement"
575
+ }
576
+ },
577
+ {
578
+ "kind": "method",
579
+ "name": "uischemaChanged"
580
+ },
581
+ {
582
+ "kind": "field",
583
+ "name": "data"
584
+ },
585
+ {
586
+ "kind": "method",
587
+ "name": "dataChanged"
588
+ },
589
+ {
590
+ "kind": "field",
591
+ "name": "renderers",
592
+ "type": {
593
+ "text": "JsonFormsRendererRegistryEntry[]"
594
+ }
595
+ },
596
+ {
597
+ "kind": "method",
598
+ "name": "renderersChanged"
599
+ },
600
+ {
601
+ "kind": "field",
602
+ "name": "validationMode",
603
+ "type": {
604
+ "text": "ValidationMode"
605
+ }
606
+ },
607
+ {
608
+ "kind": "method",
609
+ "name": "validationModeChanged"
610
+ },
611
+ {
612
+ "kind": "field",
613
+ "name": "ajv",
614
+ "type": {
615
+ "text": "Ajv"
616
+ }
617
+ },
618
+ {
619
+ "kind": "method",
620
+ "name": "ajvChanged"
621
+ },
622
+ {
623
+ "kind": "field",
624
+ "name": "readonly",
625
+ "type": {
626
+ "text": "boolean"
627
+ }
628
+ },
629
+ {
630
+ "kind": "method",
631
+ "name": "readonlyChanged"
632
+ },
633
+ {
634
+ "kind": "field",
635
+ "name": "config",
636
+ "type": {
637
+ "text": "any"
638
+ }
639
+ },
640
+ {
641
+ "kind": "method",
642
+ "name": "configChanged"
643
+ },
644
+ {
645
+ "kind": "field",
646
+ "name": "props",
647
+ "type": {
648
+ "text": "RendererProps"
649
+ },
650
+ "readonly": true
651
+ },
652
+ {
653
+ "kind": "field",
654
+ "name": "dispatch"
655
+ },
656
+ {
657
+ "kind": "field",
658
+ "name": "validate",
659
+ "description": "Performs client-side validation by running the validator defined in the UI schema.",
660
+ "parameters": [
661
+ {
662
+ "description": "the UI schema",
663
+ "name": "uischema"
664
+ }
665
+ ],
666
+ "return": {
667
+ "type": {
668
+ "text": ""
669
+ }
670
+ }
671
+ },
672
+ {
673
+ "kind": "method",
674
+ "name": "copyUISchemaToClipboard"
675
+ }
676
+ ],
677
+ "attributes": [
678
+ {
679
+ "type": {
680
+ "text": "boolean"
681
+ },
682
+ "fieldName": "submitted"
683
+ },
684
+ {
685
+ "type": {
686
+ "text": "boolean"
687
+ },
688
+ "fieldName": "readonly"
689
+ }
690
+ ],
691
+ "superclass": {
692
+ "name": "FASTElement",
693
+ "package": "@microsoft/fast-element"
694
+ },
695
+ "tagName": "json-forms",
696
+ "customElement": true
697
+ }
698
+ ],
699
+ "exports": [
700
+ {
701
+ "kind": "js",
702
+ "name": "JSONForms",
703
+ "declaration": {
704
+ "name": "JSONForms",
705
+ "module": "src/jsonforms/json-forms.ts"
706
+ }
707
+ },
708
+ {
709
+ "kind": "custom-element-definition",
710
+ "name": "json-forms",
711
+ "declaration": {
712
+ "name": "JSONForms",
713
+ "module": "src/jsonforms/json-forms.ts"
714
+ }
715
+ }
716
+ ]
717
+ },
526
718
  {
527
719
  "kind": "javascript-module",
528
720
  "path": "src/filters/filters.styles.ts",
@@ -1007,198 +1199,6 @@
1007
1199
  }
1008
1200
  ]
1009
1201
  },
1010
- {
1011
- "kind": "javascript-module",
1012
- "path": "src/jsonforms/json-forms.ts",
1013
- "declarations": [
1014
- {
1015
- "kind": "class",
1016
- "description": "",
1017
- "name": "JSONForms",
1018
- "members": [
1019
- {
1020
- "kind": "field",
1021
- "name": "submitted",
1022
- "type": {
1023
- "text": "boolean"
1024
- }
1025
- },
1026
- {
1027
- "kind": "field",
1028
- "name": "prefix"
1029
- },
1030
- {
1031
- "kind": "method",
1032
- "name": "prefixChanged"
1033
- },
1034
- {
1035
- "kind": "field",
1036
- "name": "jsonforms"
1037
- },
1038
- {
1039
- "kind": "field",
1040
- "name": "i18n"
1041
- },
1042
- {
1043
- "kind": "field",
1044
- "name": "uichemaToUse"
1045
- },
1046
- {
1047
- "kind": "field",
1048
- "name": "schema"
1049
- },
1050
- {
1051
- "kind": "method",
1052
- "name": "schemaChanged"
1053
- },
1054
- {
1055
- "kind": "field",
1056
- "name": "uischema",
1057
- "type": {
1058
- "text": "UISchemaElement"
1059
- }
1060
- },
1061
- {
1062
- "kind": "method",
1063
- "name": "uischemaChanged"
1064
- },
1065
- {
1066
- "kind": "field",
1067
- "name": "data"
1068
- },
1069
- {
1070
- "kind": "method",
1071
- "name": "dataChanged"
1072
- },
1073
- {
1074
- "kind": "field",
1075
- "name": "renderers",
1076
- "type": {
1077
- "text": "JsonFormsRendererRegistryEntry[]"
1078
- }
1079
- },
1080
- {
1081
- "kind": "method",
1082
- "name": "renderersChanged"
1083
- },
1084
- {
1085
- "kind": "field",
1086
- "name": "validationMode",
1087
- "type": {
1088
- "text": "ValidationMode"
1089
- }
1090
- },
1091
- {
1092
- "kind": "method",
1093
- "name": "validationModeChanged"
1094
- },
1095
- {
1096
- "kind": "field",
1097
- "name": "ajv",
1098
- "type": {
1099
- "text": "Ajv"
1100
- }
1101
- },
1102
- {
1103
- "kind": "method",
1104
- "name": "ajvChanged"
1105
- },
1106
- {
1107
- "kind": "field",
1108
- "name": "readonly",
1109
- "type": {
1110
- "text": "boolean"
1111
- }
1112
- },
1113
- {
1114
- "kind": "method",
1115
- "name": "readonlyChanged"
1116
- },
1117
- {
1118
- "kind": "field",
1119
- "name": "config",
1120
- "type": {
1121
- "text": "any"
1122
- }
1123
- },
1124
- {
1125
- "kind": "method",
1126
- "name": "configChanged"
1127
- },
1128
- {
1129
- "kind": "field",
1130
- "name": "props",
1131
- "type": {
1132
- "text": "RendererProps"
1133
- },
1134
- "readonly": true
1135
- },
1136
- {
1137
- "kind": "field",
1138
- "name": "dispatch"
1139
- },
1140
- {
1141
- "kind": "field",
1142
- "name": "validate",
1143
- "description": "Performs client-side validation by running the validator defined in the UI schema.",
1144
- "parameters": [
1145
- {
1146
- "description": "the UI schema",
1147
- "name": "uischema"
1148
- }
1149
- ],
1150
- "return": {
1151
- "type": {
1152
- "text": ""
1153
- }
1154
- }
1155
- },
1156
- {
1157
- "kind": "method",
1158
- "name": "copyUISchemaToClipboard"
1159
- }
1160
- ],
1161
- "attributes": [
1162
- {
1163
- "type": {
1164
- "text": "boolean"
1165
- },
1166
- "fieldName": "submitted"
1167
- },
1168
- {
1169
- "type": {
1170
- "text": "boolean"
1171
- },
1172
- "fieldName": "readonly"
1173
- }
1174
- ],
1175
- "superclass": {
1176
- "name": "FASTElement",
1177
- "package": "@microsoft/fast-element"
1178
- },
1179
- "tagName": "json-forms",
1180
- "customElement": true
1181
- }
1182
- ],
1183
- "exports": [
1184
- {
1185
- "kind": "js",
1186
- "name": "JSONForms",
1187
- "declaration": {
1188
- "name": "JSONForms",
1189
- "module": "src/jsonforms/json-forms.ts"
1190
- }
1191
- },
1192
- {
1193
- "kind": "custom-element-definition",
1194
- "name": "json-forms",
1195
- "declaration": {
1196
- "name": "JSONForms",
1197
- "module": "src/jsonforms/json-forms.ts"
1198
- }
1199
- }
1200
- ]
1201
- },
1202
1202
  {
1203
1203
  "kind": "javascript-module",
1204
1204
  "path": "src/utils/confirmation-dialog-utils.ts",
@@ -1 +1 @@
1
- {"version":3,"file":"FilterDateControlRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/FilterDateControlRenderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,eAAO,MAAM,2BAA2B,GAAI,SAAQ,MAAe,6DAuDlE,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,aAM5C,CAAC"}
1
+ {"version":3,"file":"FilterDateControlRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/FilterDateControlRenderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA6B5C,eAAO,MAAM,2BAA2B,GAAI,SAAQ,MAAe,6DAmFlE,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,aAM5C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"FilterNumberControlRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/FilterNumberControlRenderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,eAAO,MAAM,mCAAmC,GAAI,SAAQ,MAAe,6DAyD1E,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,aAM9C,CAAC"}
1
+ {"version":3,"file":"FilterNumberControlRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/FilterNumberControlRenderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,eAAO,MAAM,mCAAmC,GAAI,SAAQ,MAAe,6DA0D1E,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,aAM9C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"FilterTimeControlRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/FilterTimeControlRenderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,eAAO,MAAM,2BAA2B,GAAI,SAAQ,MAAe,6DA0DlE,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,aAM5C,CAAC"}
1
+ {"version":3,"file":"FilterTimeControlRenderer.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/renderers/FilterTimeControlRenderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,eAAO,MAAM,2BAA2B,GAAI,SAAQ,MAAe,6DAiElE,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,aAM5C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"isDate.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/testers/isDate.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,kCAOvB,CAAC"}
1
+ {"version":3,"file":"isDate.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/testers/isDate.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,WAAW,kCAUvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"isOneOfNumber.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/testers/isOneOfNumber.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,kCAKzB,CAAC"}
1
+ {"version":3,"file":"isOneOfNumber.d.ts","sourceRoot":"","sources":["../../../../src/jsonforms/testers/isOneOfNumber.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,aAAa,kCAYzB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../../src/utils/filters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAkC,MAAM,kCAAkC,CAAC;AAM9F,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,aAAa,EAAE,UAAU,EAAE,CAAC;IAC5B,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,GAAG,gBA8E7C,CAAC"}
1
+ {"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../../src/utils/filters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAkC,MAAM,kCAAkC,CAAC;AAE9F,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,aAAa,EAAE,UAAU,EAAE,CAAC;IAC5B,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,GAAG,gBAoF7C,CAAC"}
@@ -1,61 +1,100 @@
1
1
  import { mapStateToControlProps, rankWith } from '@jsonforms/core';
2
2
  import { html } from '@microsoft/fast-element';
3
+ import { GenesisType } from '../../utils';
3
4
  import { isOneOfDate } from '../testers/isDate';
4
5
  import { DATE_CONTROL_RANK } from './RenderersRanks';
6
+ /**
7
+ * @internal
8
+ */
9
+ const typeSwitch = (control) => { var _a; return ((_a = control.schema) === null || _a === void 0 ? void 0 : _a.genesisType) === GenesisType.DATETIME ? 'datetime-local' : 'date'; };
10
+ /**
11
+ * Formats a timestamp value for date/datetime-local input
12
+ * @internal
13
+ */
14
+ const formatDateValue = (timestamp, inputType) => {
15
+ if (timestamp === undefined || timestamp === null)
16
+ return '';
17
+ const date = new Date(timestamp);
18
+ const padded = (dateComponent) => dateComponent.toString().padStart(2, '0');
19
+ const year = date.getFullYear();
20
+ const month = padded(date.getMonth() + 1);
21
+ const day = padded(date.getDate());
22
+ const hour = padded(date.getHours());
23
+ const minute = padded(date.getMinutes());
24
+ return `${year}-${month}-${day}` + (inputType === 'datetime-local' ? `T${hour}:${minute}` : '');
25
+ };
5
26
  export const DateControlRendererTemplate = (prefix = 'zero') => html `
6
27
  <template>
7
28
  <control-wrapper :control=${(x) => x.control} ?submitted=${(x) => x.submitted} prefix="${prefix}">
8
29
  <${prefix}-text-field
9
30
  :value=${(x) => {
10
- var _a, _b;
11
- return ((_a = x.control.data) === null || _a === void 0 ? void 0 : _a.min) === undefined || ((_b = x.control.data) === null || _b === void 0 ? void 0 : _b.min) === null
12
- ? ''
13
- : new Intl.DateTimeFormat('fr-CA', {
14
- year: 'numeric',
15
- month: '2-digit',
16
- day: '2-digit',
17
- timeZone: 'UTC',
18
- }).format(x.control.data.min);
31
+ var _a;
32
+ const inputType = typeSwitch(x.control);
33
+ return formatDateValue((_a = x.control.data) === null || _a === void 0 ? void 0 : _a.min, inputType);
19
34
  }}
20
35
  id=${(x) => `min-${x.control.path}`}
21
- type="date"
36
+ type="${(x) => typeSwitch(x.control)}"
22
37
  data-test-id=${(x) => `min-${x.control.path}`}
23
38
  tabindex="${(x) => { var _a, _b; return (_b = (_a = x.control.uischema) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.tabIndex; }}"
24
39
  @blur=${(x, c) => {
25
- var _a, _b;
26
- const value = c.event.target.control.valueAsNumber;
40
+ var _a, _b, _c;
41
+ const target = c.event.target;
42
+ const inputValue = target.value;
43
+ const inputType = typeSwitch(x.control);
44
+ let minValue;
45
+ if (inputValue) {
46
+ minValue = new Date(inputValue).getTime();
47
+ }
48
+ const maxValue = ((_a = x.control.data) === null || _a === void 0 ? void 0 : _a.max) !== undefined &&
49
+ minValue !== undefined &&
50
+ ((_b = x.control.data) === null || _b === void 0 ? void 0 : _b.max) < minValue
51
+ ? undefined
52
+ : (_c = x.control.data) === null || _c === void 0 ? void 0 : _c.max;
27
53
  x.control.handleChange(x.control.path, {
28
- min: value ? value : undefined,
29
- max: ((_a = x.control.data) === null || _a === void 0 ? void 0 : _a.max) < value ? undefined : (_b = x.control.data) === null || _b === void 0 ? void 0 : _b.max,
30
- type: 'date',
54
+ min: minValue,
55
+ max: maxValue,
56
+ type: inputType === 'datetime-local' ? 'datetime' : 'date',
31
57
  });
32
58
  x.onBlur();
33
59
  }}
34
60
  style="width: 100%"
35
61
  ></${prefix}-text-field>
62
+ <span
63
+ style="
64
+ font-size: xx-large;
65
+ color: var(--neutral-stroke-divider-rest);
66
+ padding: calc(var(--design-unit) * 1px);"
67
+ >
68
+ -
69
+ </span>
36
70
  <${prefix}-text-field
37
71
  :value=${(x) => {
38
- var _a, _b;
39
- return ((_a = x.control.data) === null || _a === void 0 ? void 0 : _a.max) === undefined || ((_b = x.control.data) === null || _b === void 0 ? void 0 : _b.max) === null
40
- ? ''
41
- : new Intl.DateTimeFormat('fr-CA', {
42
- year: 'numeric',
43
- month: '2-digit',
44
- day: '2-digit',
45
- timeZone: 'UTC',
46
- }).format(x.control.data.max);
72
+ var _a;
73
+ const inputType = typeSwitch(x.control);
74
+ return formatDateValue((_a = x.control.data) === null || _a === void 0 ? void 0 : _a.max, inputType);
47
75
  }}
48
76
  id=${(x) => `max-${x.control.path}`}
49
- type="date"
77
+ type="${(x) => typeSwitch(x.control)}"
50
78
  data-test-id=${(x) => `max-${x.control.path}`}
51
79
  tabindex="${(x) => { var _a, _b; return (_b = (_a = x.control.uischema) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.tabIndex; }}"
52
80
  @blur=${(x, c) => {
53
- var _a, _b;
54
- const value = c.event.target.control.valueAsNumber;
81
+ var _a, _b, _c;
82
+ const target = c.event.target;
83
+ const inputValue = target.value;
84
+ const inputType = typeSwitch(x.control);
85
+ let maxValue;
86
+ if (inputValue) {
87
+ maxValue = new Date(inputValue).getTime();
88
+ }
89
+ const minValue = ((_a = x.control.data) === null || _a === void 0 ? void 0 : _a.min) !== undefined &&
90
+ maxValue !== undefined &&
91
+ ((_b = x.control.data) === null || _b === void 0 ? void 0 : _b.min) > maxValue
92
+ ? undefined
93
+ : (_c = x.control.data) === null || _c === void 0 ? void 0 : _c.min;
55
94
  x.control.handleChange(x.control.path, {
56
- min: ((_a = x.control.data) === null || _a === void 0 ? void 0 : _a.min) > value ? undefined : (_b = x.control.data) === null || _b === void 0 ? void 0 : _b.min,
57
- max: value ? value : undefined,
58
- type: 'date',
95
+ min: minValue,
96
+ max: maxValue,
97
+ type: inputType === 'datetime-local' ? 'datetime' : 'date',
59
98
  });
60
99
  x.onBlur();
61
100
  }}
@@ -29,7 +29,8 @@ export const FilterNumberControlRendererTemplate = (prefix = 'zero') => html `
29
29
  <span
30
30
  style="
31
31
  font-size: xx-large;
32
- color: rgb(135, 155, 166);"
32
+ color: var(--neutral-stroke-divider-rest);
33
+ padding: calc(var(--design-unit) * 1px);"
33
34
  >
34
35
  -
35
36
  </span>
@@ -36,7 +36,14 @@ export const TimeControlRendererTemplate = (prefix = 'zero') => html `
36
36
  }}
37
37
  style="width: 100%"
38
38
  ></${prefix}-text-field>
39
-
39
+ <span
40
+ style="
41
+ font-size: xx-large;
42
+ color: var(--neutral-stroke-divider-rest);
43
+ padding: calc(var(--design-unit) * 1px);"
44
+ >
45
+ -
46
+ </span>
40
47
  <${prefix}-text-field
41
48
  :value=${(x) => {
42
49
  var _a;
@@ -1,5 +1,8 @@
1
1
  import { or, schemaMatches } from '@jsonforms/core';
2
+ import { GenesisType } from '../../utils/types';
2
3
  const isDateDescription = (s) => s.description === 'org.joda.time.DateTime';
3
4
  const isDate = schemaMatches(isDateDescription);
4
- export const isOneOfDate = or(isDate, schemaMatches((schema) => schema.hasOwnProperty('oneOf') &&
5
- schema.oneOf.some((s) => s.description === 'org.joda.time.DateTime')));
5
+ const isDateGenesisType = (s) => s.genesisType === GenesisType.DATE || s.genesisType === GenesisType.DATETIME;
6
+ const isDateByGenesisType = schemaMatches(isDateGenesisType);
7
+ export const isOneOfDate = or(isDate, isDateByGenesisType, schemaMatches((schema) => schema.hasOwnProperty('oneOf') &&
8
+ schema.oneOf.some((s) => s.description === 'org.joda.time.DateTime' || isDateGenesisType(s))));
@@ -1,5 +1,12 @@
1
- import { hasType, schemaMatches } from '@jsonforms/core';
1
+ import { hasType, or, schemaMatches } from '@jsonforms/core';
2
+ import { GenesisType } from '../../utils/types';
2
3
  const hasTypeNumberOrInteger = (schema) => hasType(schema, 'number') || hasType(schema, 'integer');
3
- export const isOneOfNumber = schemaMatches((schema) => hasTypeNumberOrInteger(schema) ||
4
+ const isNumberGenesisType = (s) => s.genesisType === GenesisType.DOUBLE ||
5
+ s.genesisType === GenesisType.INT ||
6
+ s.genesisType === GenesisType.SHORT ||
7
+ s.genesisType === GenesisType.LONG ||
8
+ s.genesisType === GenesisType.BIGDECIMAL;
9
+ const isNumberByGenesisType = schemaMatches(isNumberGenesisType);
10
+ export const isOneOfNumber = or(schemaMatches((schema) => hasTypeNumberOrInteger(schema) ||
4
11
  (schema.hasOwnProperty('oneOf') &&
5
- schema.oneOf.some((s) => hasTypeNumberOrInteger(s))));
12
+ schema.oneOf.some((s) => hasTypeNumberOrInteger(s)))), isNumberByGenesisType, schemaMatches((schema) => schema.hasOwnProperty('oneOf') && schema.oneOf.some((s) => isNumberGenesisType(s))));
@@ -1,7 +1,4 @@
1
1
  import { ExpressionBuilder, Serialisers } from '@genesislcap/foundation-criteria';
2
- const hour = 23;
3
- const minute = 59;
4
- const sec = 999;
5
2
  /**
6
3
  * Creates a expressions/criteria from given payload
7
4
  * @internal
@@ -37,6 +34,12 @@ export const createExpressions = (payload) => {
37
34
  ...expressions.dateOptions,
38
35
  ];
39
36
  }
37
+ if (value.type == 'datetime') {
38
+ expressions.dateOptions = [
39
+ ...dateNumberExpressions(key, value, 'datetime'),
40
+ ...expressions.dateOptions,
41
+ ];
42
+ }
40
43
  if (value.type == 'time') {
41
44
  expressions.dateOptions = [
42
45
  ...dateNumberExpressions(key, value, 'time'),
@@ -106,6 +109,13 @@ const dateNumberExpressions = (key, value, type) => {
106
109
  endSerialiser = Serialisers.dateIsLessEqual;
107
110
  break;
108
111
  }
112
+ case 'datetime': {
113
+ startValue = value.min ? convertTimestampToDateTime(value.min) : undefined;
114
+ endValue = value.max ? convertTimestampToDateTime(value.max) : undefined;
115
+ startSerialiser = Serialisers.dateTimeIsGreaterEqual;
116
+ endSerialiser = Serialisers.dateTimeIsLessEqual;
117
+ break;
118
+ }
109
119
  case 'number':
110
120
  default: {
111
121
  startValue = value.min;
@@ -135,11 +145,23 @@ const dateNumberExpressions = (key, value, type) => {
135
145
  return expressions;
136
146
  };
137
147
  const convertTimestampToDate = (timestamp) => {
138
- const months = (new Date(timestamp).getUTCMonth() + 1).toString().padStart(2, '0');
139
- const days = new Date(timestamp).getUTCDate().toString().padStart(2, '0');
140
- const year = new Date(timestamp).getUTCFullYear().toString();
148
+ const months = (new Date(timestamp).getMonth() + 1).toString().padStart(2, '0');
149
+ const days = new Date(timestamp).getDate().toString().padStart(2, '0');
150
+ const year = new Date(timestamp).getFullYear().toString();
141
151
  return [year, months, days].join('');
142
152
  };
153
+ const convertTimestampToDateTime = (timestamp) => {
154
+ const date = new Date(timestamp);
155
+ const year = date.getFullYear().toString();
156
+ const months = (date.getMonth() + 1).toString().padStart(2, '0');
157
+ const days = date.getDate().toString().padStart(2, '0');
158
+ const hours = date.getHours().toString().padStart(2, '0');
159
+ const minutes = date.getMinutes().toString().padStart(2, '0');
160
+ const seconds = date.getSeconds().toString().padStart(2, '0');
161
+ const datePart = [year, months, days].join('');
162
+ const timePart = [hours, minutes, seconds].join(':');
163
+ return `${datePart}-${timePart}`;
164
+ };
143
165
  const convertTimeToDateTime = (time) => {
144
166
  const [hours, minutes] = time.split(':').map(Number);
145
167
  const today = new Date();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-forms",
3
3
  "description": "Genesis Foundation Forms",
4
- "version": "14.354.0",
4
+ "version": "14.354.1",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -48,22 +48,22 @@
48
48
  }
49
49
  },
50
50
  "devDependencies": {
51
- "@genesislcap/foundation-testing": "14.354.0",
52
- "@genesislcap/genx": "14.354.0",
53
- "@genesislcap/rollup-builder": "14.354.0",
54
- "@genesislcap/ts-builder": "14.354.0",
55
- "@genesislcap/uvu-playwright-builder": "14.354.0",
56
- "@genesislcap/vite-builder": "14.354.0",
57
- "@genesislcap/webpack-builder": "14.354.0",
51
+ "@genesislcap/foundation-testing": "14.354.1",
52
+ "@genesislcap/genx": "14.354.1",
53
+ "@genesislcap/rollup-builder": "14.354.1",
54
+ "@genesislcap/ts-builder": "14.354.1",
55
+ "@genesislcap/uvu-playwright-builder": "14.354.1",
56
+ "@genesislcap/vite-builder": "14.354.1",
57
+ "@genesislcap/webpack-builder": "14.354.1",
58
58
  "@types/json-schema": "^7.0.11"
59
59
  },
60
60
  "dependencies": {
61
- "@genesislcap/foundation-comms": "14.354.0",
62
- "@genesislcap/foundation-criteria": "14.354.0",
63
- "@genesislcap/foundation-logger": "14.354.0",
64
- "@genesislcap/foundation-notifications": "14.354.0",
65
- "@genesislcap/foundation-ui": "14.354.0",
66
- "@genesislcap/foundation-utils": "14.354.0",
61
+ "@genesislcap/foundation-comms": "14.354.1",
62
+ "@genesislcap/foundation-criteria": "14.354.1",
63
+ "@genesislcap/foundation-logger": "14.354.1",
64
+ "@genesislcap/foundation-notifications": "14.354.1",
65
+ "@genesislcap/foundation-ui": "14.354.1",
66
+ "@genesislcap/foundation-utils": "14.354.1",
67
67
  "@json-schema-tools/dereferencer": "^1.6.1",
68
68
  "@jsonforms/core": "^3.2.1",
69
69
  "@microsoft/fast-components": "2.30.6",
@@ -84,5 +84,5 @@
84
84
  "access": "public"
85
85
  },
86
86
  "customElements": "dist/custom-elements.json",
87
- "gitHead": "a039dbb62a416e049fb61d2e2451bac4c2e56950"
87
+ "gitHead": "f895bab2961a8d114d896536c573bd8eb46dff12"
88
88
  }