@@ -615,7 +615,14 @@ class BooleanElement extends Option01 {
615
615
}
616
616
617
617
[ $toHTML ] ( availableSpace ) {
618
- return HTMLResult . success ( this [ $content ] === 1 ) ;
618
+ return HTMLResult . success ( {
619
+ name : "span" ,
620
+ attributes : {
621
+ class : [ "xfaRich" ] ,
622
+ style : { } ,
623
+ } ,
624
+ value : this [ $content ] === 1 ,
625
+ } ) ;
619
626
}
620
627
}
621
628
@@ -1257,11 +1264,19 @@ class DateElement extends ContentObject {
1257
1264
}
1258
1265
1259
1266
[ $finalize ] ( ) {
1260
- this [ $content ] = new Date ( this [ $content ] . trim ( ) ) ;
1267
+ const date = this [ $content ] . trim ( ) ;
1268
+ this [ $content ] = date ? new Date ( date ) : null ;
1261
1269
}
1262
1270
1263
1271
[ $toHTML ] ( availableSpace ) {
1264
- return HTMLResult . success ( this [ $content ] . toString ( ) ) ;
1272
+ return HTMLResult . success ( {
1273
+ name : "span" ,
1274
+ attributes : {
1275
+ class : [ "xfaRich" ] ,
1276
+ style : { } ,
1277
+ } ,
1278
+ value : this [ $content ] ? this [ $content ] . toString ( ) : "" ,
1279
+ } ) ;
1265
1280
}
1266
1281
}
1267
1282
@@ -1275,11 +1290,19 @@ class DateTime extends ContentObject {
1275
1290
}
1276
1291
1277
1292
[ $finalize ] ( ) {
1278
- this [ $content ] = new Date ( this [ $content ] . trim ( ) ) ;
1293
+ const date = this [ $content ] . trim ( ) ;
1294
+ this [ $content ] = date ? new Date ( date ) : null ;
1279
1295
}
1280
1296
1281
1297
[ $toHTML ] ( availableSpace ) {
1282
- return HTMLResult . success ( this [ $content ] . toString ( ) ) ;
1298
+ return HTMLResult . success ( {
1299
+ name : "span" ,
1300
+ attributes : {
1301
+ class : [ "xfaRich" ] ,
1302
+ style : { } ,
1303
+ } ,
1304
+ value : this [ $content ] ? this [ $content ] . toString ( ) : "" ,
1305
+ } ) ;
1283
1306
}
1284
1307
}
1285
1308
@@ -1351,9 +1374,14 @@ class Decimal extends ContentObject {
1351
1374
}
1352
1375
1353
1376
[ $toHTML ] ( availableSpace ) {
1354
- return HTMLResult . success (
1355
- this [ $content ] !== null ? this [ $content ] . toString ( ) : ""
1356
- ) ;
1377
+ return HTMLResult . success ( {
1378
+ name : "span" ,
1379
+ attributes : {
1380
+ class : [ "xfaRich" ] ,
1381
+ style : { } ,
1382
+ } ,
1383
+ value : this [ $content ] !== null ? this [ $content ] . toString ( ) : "" ,
1384
+ } ) ;
1357
1385
}
1358
1386
}
1359
1387
@@ -2365,12 +2393,12 @@ class Field extends XFAObject {
2365
2393
if ( this . ui . imageEdit ) {
2366
2394
ui . children . push ( this . value [ $toHTML ] ( ) . html ) ;
2367
2395
} else if ( ! this . ui . button ) {
2368
- const value = this . value [ $toHTML ] ( ) . html ;
2396
+ const value = this . value [ $toHTML ] ( ) . html . value ;
2369
2397
if ( value ) {
2370
2398
if ( ui . children [ 0 ] . name === "textarea" ) {
2371
- ui . children [ 0 ] . attributes . textContent = value . value ;
2399
+ ui . children [ 0 ] . attributes . textContent = value ;
2372
2400
} else {
2373
- ui . children [ 0 ] . attributes . value = value . value ;
2401
+ ui . children [ 0 ] . attributes . value = value ;
2374
2402
}
2375
2403
}
2376
2404
}
@@ -2522,9 +2550,14 @@ class Float extends ContentObject {
2522
2550
}
2523
2551
2524
2552
[ $toHTML ] ( availableSpace ) {
2525
- return HTMLResult . success (
2526
- this [ $content ] !== null ? this [ $content ] . toString ( ) : ""
2527
- ) ;
2553
+ return HTMLResult . success ( {
2554
+ name : "span" ,
2555
+ attributes : {
2556
+ class : [ "xfaRich" ] ,
2557
+ style : { } ,
2558
+ } ,
2559
+ value : this [ $content ] !== null ? this [ $content ] . toString ( ) : "" ,
2560
+ } ) ;
2528
2561
}
2529
2562
}
2530
2563
@@ -2812,9 +2845,14 @@ class Integer extends ContentObject {
2812
2845
}
2813
2846
2814
2847
[ $toHTML ] ( availableSpace ) {
2815
- return HTMLResult . success (
2816
- this [ $content ] !== null ? this [ $content ] . toString ( ) : ""
2817
- ) ;
2848
+ return HTMLResult . success ( {
2849
+ name : "span" ,
2850
+ attributes : {
2851
+ class : [ "xfaRich" ] ,
2852
+ style : { } ,
2853
+ } ,
2854
+ value : this [ $content ] !== null ? this [ $content ] . toString ( ) : "" ,
2855
+ } ) ;
2818
2856
}
2819
2857
}
2820
2858
@@ -4782,12 +4820,20 @@ class Time extends StringObject {
4782
4820
}
4783
4821
4784
4822
[ $finalize ] ( ) {
4785
- // TODO
4786
- this [ $content ] = new Date ( this [ $content ] ) ;
4823
+ // TODO.
4824
+ const date = this [ $content ] . trim ( ) ;
4825
+ this [ $content ] = date ? new Date ( date ) : null ;
4787
4826
}
4788
4827
4789
4828
[ $toHTML ] ( availableSpace ) {
4790
- return HTMLResult . success ( this [ $content ] . toString ( ) ) ;
4829
+ return HTMLResult . success ( {
4830
+ name : "span" ,
4831
+ attributes : {
4832
+ class : [ "xfaRich" ] ,
4833
+ style : { } ,
4834
+ } ,
4835
+ value : this [ $content ] ? this [ $content ] . toString ( ) : "" ,
4836
+ } ) ;
4791
4837
}
4792
4838
}
4793
4839
0 commit comments