react-input-material 0.0.407 → 0.0.410
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/components/FileInput.js +1 -1
- package/components/FileInput.styles.css +2 -2
- package/components/GenericInput.js +1 -1
- package/components/GenericInput.module.css +13 -0
- package/components/GenericInput.styles.css +1 -1
- package/components/GenericInput.tsx +161 -66
- package/components/Inputs.js +1 -1
- package/components/Inputs.styles.css +1 -1
- package/components/Interval.js +1 -1
- package/components/Interval.styles.css +1 -1
- package/index.js +1 -1
- package/index.styles.css +2 -2
- package/package.json +1 -1
- package/type.d.ts +4 -4
|
@@ -195,7 +195,6 @@ export const TINYMCE_DEFAULT_OPTIONS:Partial<TinyMCEOptions> = {
|
|
|
195
195
|
'fullscreen',
|
|
196
196
|
'link',
|
|
197
197
|
'code',
|
|
198
|
-
'hr',
|
|
199
198
|
'nonbreaking',
|
|
200
199
|
'searchreplace',
|
|
201
200
|
'visualblocks'
|
|
@@ -213,7 +212,7 @@ export const TINYMCE_DEFAULT_OPTIONS:Partial<TinyMCEOptions> = {
|
|
|
213
212
|
`.trim(),
|
|
214
213
|
toolbar2: `
|
|
215
214
|
alignleft aligncenter alignright alignjustify outdent indent |
|
|
216
|
-
link
|
|
215
|
+
link nonbreaking bullist numlist bold italic underline strikethrough
|
|
217
216
|
`.trim(),
|
|
218
217
|
trim: true
|
|
219
218
|
/* eslint-enable camelcase */
|
|
@@ -1006,6 +1005,7 @@ export const GenericInputInner = function<Type = unknown>(
|
|
|
1006
1005
|
transformer,
|
|
1007
1006
|
/*
|
|
1008
1007
|
NOTE: Handle two cases:
|
|
1008
|
+
|
|
1009
1009
|
1. Representation has to be determine initially
|
|
1010
1010
|
(-> usually no focus).
|
|
1011
1011
|
2. Representation was set from the outside
|
|
@@ -2470,9 +2470,28 @@ GenericInput.transformer = {
|
|
|
2470
2470
|
NaN,
|
|
2471
2471
|
type: 'text'
|
|
2472
2472
|
},
|
|
2473
|
+
|
|
2473
2474
|
date: {
|
|
2474
|
-
format: {final: {transform: (
|
|
2475
|
-
value
|
|
2475
|
+
format: {final: {transform: (
|
|
2476
|
+
value:Date|number|string,
|
|
2477
|
+
configuration:DefaultProperties<number>,
|
|
2478
|
+
transformer:InputDataTransformation
|
|
2479
|
+
):string => {
|
|
2480
|
+
if (typeof value !== 'number')
|
|
2481
|
+
if (transformer.date.parse)
|
|
2482
|
+
value = transformer.date.parse(
|
|
2483
|
+
value, configuration, transformer
|
|
2484
|
+
)
|
|
2485
|
+
else {
|
|
2486
|
+
const parsedDate:number = value instanceof Date ?
|
|
2487
|
+
value.getTime() / 1000 :
|
|
2488
|
+
Date.parse(value)
|
|
2489
|
+
if (isNaN(parsedDate)) {
|
|
2490
|
+
const parsedFloat:number = parseFloat(value as string)
|
|
2491
|
+
value = isNaN(parsedFloat) ? 0 : parsedFloat
|
|
2492
|
+
} else
|
|
2493
|
+
value = parsedDate / 1000
|
|
2494
|
+
}
|
|
2476
2495
|
|
|
2477
2496
|
if (value === Infinity)
|
|
2478
2497
|
return 'Infinitely far in the future'
|
|
@@ -2486,19 +2505,47 @@ GenericInput.transformer = {
|
|
|
2486
2505
|
|
|
2487
2506
|
return formattedValue.substring(0, formattedValue.indexOf('T'))
|
|
2488
2507
|
}}},
|
|
2489
|
-
parse: (value:Date|number|string):number =>
|
|
2490
|
-
typeof value === 'number'
|
|
2491
|
-
value
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2508
|
+
parse: (value:Date|number|string):number => {
|
|
2509
|
+
if (typeof value === 'number')
|
|
2510
|
+
return value
|
|
2511
|
+
|
|
2512
|
+
if (value instanceof Date)
|
|
2513
|
+
return value.getTime() / 1000
|
|
2514
|
+
|
|
2515
|
+
const parsedDate:number = Date.parse(value)
|
|
2516
|
+
if (isNaN(parsedDate)) {
|
|
2517
|
+
const parsedFloat:number = parseFloat(value)
|
|
2518
|
+
if (isNaN(parsedFloat))
|
|
2519
|
+
return 0
|
|
2520
|
+
|
|
2521
|
+
return parsedFloat
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
return parsedDate / 1000
|
|
2525
|
+
}
|
|
2497
2526
|
},
|
|
2498
2527
|
// TODO respect local to utc conversion.
|
|
2499
2528
|
'datetime-local': {
|
|
2500
|
-
format: {final: {transform: (
|
|
2501
|
-
value
|
|
2529
|
+
format: {final: {transform: (
|
|
2530
|
+
value:Date|number|string,
|
|
2531
|
+
configuration:DefaultProperties<number>,
|
|
2532
|
+
transformer:InputDataTransformation
|
|
2533
|
+
):string => {
|
|
2534
|
+
if (typeof value !== 'number')
|
|
2535
|
+
if (transformer['datetime-local'].parse)
|
|
2536
|
+
value = transformer['datetime-local'].parse(
|
|
2537
|
+
value, configuration, transformer
|
|
2538
|
+
)
|
|
2539
|
+
else {
|
|
2540
|
+
const parsedDate:number = value instanceof Date ?
|
|
2541
|
+
value.getTime() / 1000 :
|
|
2542
|
+
Date.parse(value)
|
|
2543
|
+
if (isNaN(parsedDate)) {
|
|
2544
|
+
const parsedFloat:number = parseFloat(value as string)
|
|
2545
|
+
value = isNaN(parsedFloat) ? 0 : parsedFloat
|
|
2546
|
+
} else
|
|
2547
|
+
value = parsedDate / 1000
|
|
2548
|
+
}
|
|
2502
2549
|
|
|
2503
2550
|
if (value === Infinity)
|
|
2504
2551
|
return 'Infinitely far in the future'
|
|
@@ -2513,68 +2560,116 @@ GenericInput.transformer = {
|
|
|
2513
2560
|
return formattedValue.substring(0, formattedValue.length - 1)
|
|
2514
2561
|
}}},
|
|
2515
2562
|
parse: (
|
|
2516
|
-
value:number|string,
|
|
2563
|
+
value:Date|number|string,
|
|
2517
2564
|
configuration:DefaultProperties<number>,
|
|
2518
2565
|
transformer:InputDataTransformation
|
|
2519
|
-
):number =>
|
|
2520
|
-
transformer.date.parse
|
|
2521
|
-
transformer.date.parse(
|
|
2522
|
-
|
|
2566
|
+
):number => {
|
|
2567
|
+
if (transformer.date.parse)
|
|
2568
|
+
return transformer.date.parse(
|
|
2569
|
+
value, configuration, transformer
|
|
2570
|
+
)
|
|
2571
|
+
|
|
2572
|
+
if (value instanceof Date)
|
|
2573
|
+
return value.getTime() / 1000
|
|
2574
|
+
|
|
2575
|
+
const parsedDate:number = Date.parse(value as string)
|
|
2576
|
+
if (isNaN(parsedDate)) {
|
|
2577
|
+
const parsedFloat:number = parseFloat(value as string)
|
|
2578
|
+
if (isNaN(parsedFloat))
|
|
2579
|
+
return 0
|
|
2580
|
+
|
|
2581
|
+
return parsedFloat
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
return parsedDate / 1000
|
|
2585
|
+
}
|
|
2523
2586
|
},
|
|
2524
2587
|
time: {
|
|
2525
|
-
format: {
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2588
|
+
format: {
|
|
2589
|
+
final: {transform: (
|
|
2590
|
+
value:Date|number|string,
|
|
2591
|
+
configuration:DefaultProperties<number>,
|
|
2592
|
+
transformer:InputDataTransformation
|
|
2593
|
+
):string => {
|
|
2594
|
+
if (typeof value !== 'number')
|
|
2595
|
+
if (transformer.time.parse)
|
|
2596
|
+
value = transformer.time.parse(
|
|
2597
|
+
value, configuration, transformer
|
|
2598
|
+
)
|
|
2599
|
+
else {
|
|
2600
|
+
const parsedDate:number = value instanceof Date ?
|
|
2601
|
+
value.getTime() / 1000 :
|
|
2602
|
+
Date.parse(value)
|
|
2603
|
+
if (isNaN(parsedDate)) {
|
|
2604
|
+
const parsedFloat:number =
|
|
2605
|
+
parseFloat(value as string)
|
|
2606
|
+
value = isNaN(parsedFloat) ? 0 : parsedFloat
|
|
2607
|
+
} else
|
|
2608
|
+
value = parsedDate / 1000
|
|
2609
|
+
}
|
|
2529
2610
|
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2611
|
+
if (value === Infinity)
|
|
2612
|
+
return 'Infinitely far in the future'
|
|
2613
|
+
if (value === -Infinity)
|
|
2614
|
+
return 'Infinitely early in the past'
|
|
2615
|
+
if (!isFinite(value))
|
|
2616
|
+
return ''
|
|
2536
2617
|
|
|
2537
|
-
|
|
2538
|
-
|
|
2618
|
+
let formattedValue:string =
|
|
2619
|
+
(new Date(Math.round(value * 1000))).toISOString()
|
|
2539
2620
|
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2621
|
+
formattedValue = formattedValue.substring(
|
|
2622
|
+
formattedValue.indexOf('T') + 1, formattedValue.length - 1
|
|
2623
|
+
)
|
|
2543
2624
|
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
)
|
|
2549
|
-
return formattedValue.substring(
|
|
2550
|
-
0, formattedValue.lastIndexOf(':')
|
|
2625
|
+
if (
|
|
2626
|
+
configuration.step &&
|
|
2627
|
+
configuration.step >= 60 &&
|
|
2628
|
+
(configuration.step % 60) === 0
|
|
2551
2629
|
)
|
|
2630
|
+
return formattedValue.substring(
|
|
2631
|
+
0, formattedValue.lastIndexOf(':')
|
|
2632
|
+
)
|
|
2552
2633
|
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
value
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
)
|
|
2577
|
-
|
|
2634
|
+
return formattedValue
|
|
2635
|
+
}}
|
|
2636
|
+
},
|
|
2637
|
+
parse: (value:Date|number|string):number => {
|
|
2638
|
+
if (typeof value === 'number')
|
|
2639
|
+
return value
|
|
2640
|
+
|
|
2641
|
+
if (value instanceof Date)
|
|
2642
|
+
return value.getTime() / 1000
|
|
2643
|
+
|
|
2644
|
+
const parsedDate:number = Date.parse(value)
|
|
2645
|
+
if (isNaN(parsedDate)) {
|
|
2646
|
+
const parsedFloat:number = parseFloat(value.replace(
|
|
2647
|
+
/^([0-9]{2}):([0-9]{2})(:([0-9]{2}(\.[0-9]+)?))?$/,
|
|
2648
|
+
(
|
|
2649
|
+
_match:string,
|
|
2650
|
+
hour:string,
|
|
2651
|
+
minute:string,
|
|
2652
|
+
secondsSuffix?:string,
|
|
2653
|
+
seconds?:string,
|
|
2654
|
+
_millisecondsSuffix?:string
|
|
2655
|
+
):string =>
|
|
2656
|
+
String(
|
|
2657
|
+
parseInt(hour) *
|
|
2658
|
+
60 ** 2 +
|
|
2659
|
+
parseInt(minute) *
|
|
2660
|
+
60 +
|
|
2661
|
+
(secondsSuffix ? parseFloat(seconds!) : 0)
|
|
2662
|
+
)
|
|
2663
|
+
))
|
|
2664
|
+
|
|
2665
|
+
if (isNaN(parsedFloat))
|
|
2666
|
+
return 0
|
|
2667
|
+
|
|
2668
|
+
return parsedFloat
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2671
|
+
return parsedDate / 1000
|
|
2672
|
+
}
|
|
2578
2673
|
},
|
|
2579
2674
|
|
|
2580
2675
|
float: {
|