react-input-material 0.0.408 → 0.0.411
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 -70
- package/components/Inputs.js +1 -1
- package/components/Inputs.styles.css +1 -1
- package/components/Inputs.tsx +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 +38 -38
|
@@ -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
|
|
@@ -2142,6 +2142,7 @@ export const GenericInputInner = function<Type = unknown>(
|
|
|
2142
2142
|
<Suspense fallback={
|
|
2143
2143
|
<CircularProgress size="large" />
|
|
2144
2144
|
}>
|
|
2145
|
+
{/*TODO prevent on key enter propagation!*/}
|
|
2145
2146
|
<CodeEditor
|
|
2146
2147
|
{...genericProperties as
|
|
2147
2148
|
CodeEditorProps
|
|
@@ -2472,8 +2473,26 @@ GenericInput.transformer = {
|
|
|
2472
2473
|
},
|
|
2473
2474
|
|
|
2474
2475
|
date: {
|
|
2475
|
-
format: {final: {transform: (
|
|
2476
|
-
value
|
|
2476
|
+
format: {final: {transform: (
|
|
2477
|
+
value:Date|number|string,
|
|
2478
|
+
configuration:DefaultProperties<number>,
|
|
2479
|
+
transformer:InputDataTransformation
|
|
2480
|
+
):string => {
|
|
2481
|
+
if (typeof value !== 'number')
|
|
2482
|
+
if (transformer.date.parse)
|
|
2483
|
+
value = transformer.date.parse(
|
|
2484
|
+
value, configuration, transformer
|
|
2485
|
+
)
|
|
2486
|
+
else {
|
|
2487
|
+
const parsedDate:number = value instanceof Date ?
|
|
2488
|
+
value.getTime() / 1000 :
|
|
2489
|
+
Date.parse(value)
|
|
2490
|
+
if (isNaN(parsedDate)) {
|
|
2491
|
+
const parsedFloat:number = parseFloat(value as string)
|
|
2492
|
+
value = isNaN(parsedFloat) ? 0 : parsedFloat
|
|
2493
|
+
} else
|
|
2494
|
+
value = parsedDate / 1000
|
|
2495
|
+
}
|
|
2477
2496
|
|
|
2478
2497
|
if (value === Infinity)
|
|
2479
2498
|
return 'Infinitely far in the future'
|
|
@@ -2487,19 +2506,47 @@ GenericInput.transformer = {
|
|
|
2487
2506
|
|
|
2488
2507
|
return formattedValue.substring(0, formattedValue.indexOf('T'))
|
|
2489
2508
|
}}},
|
|
2490
|
-
parse: (value:Date|number|string):number =>
|
|
2491
|
-
typeof value === 'number'
|
|
2492
|
-
value
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2509
|
+
parse: (value:Date|number|string):number => {
|
|
2510
|
+
if (typeof value === 'number')
|
|
2511
|
+
return value
|
|
2512
|
+
|
|
2513
|
+
if (value instanceof Date)
|
|
2514
|
+
return value.getTime() / 1000
|
|
2515
|
+
|
|
2516
|
+
const parsedDate:number = Date.parse(value)
|
|
2517
|
+
if (isNaN(parsedDate)) {
|
|
2518
|
+
const parsedFloat:number = parseFloat(value)
|
|
2519
|
+
if (isNaN(parsedFloat))
|
|
2520
|
+
return 0
|
|
2521
|
+
|
|
2522
|
+
return parsedFloat
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
return parsedDate / 1000
|
|
2526
|
+
}
|
|
2498
2527
|
},
|
|
2499
2528
|
// TODO respect local to utc conversion.
|
|
2500
2529
|
'datetime-local': {
|
|
2501
|
-
format: {final: {transform: (
|
|
2502
|
-
value
|
|
2530
|
+
format: {final: {transform: (
|
|
2531
|
+
value:Date|number|string,
|
|
2532
|
+
configuration:DefaultProperties<number>,
|
|
2533
|
+
transformer:InputDataTransformation
|
|
2534
|
+
):string => {
|
|
2535
|
+
if (typeof value !== 'number')
|
|
2536
|
+
if (transformer['datetime-local'].parse)
|
|
2537
|
+
value = transformer['datetime-local'].parse(
|
|
2538
|
+
value, configuration, transformer
|
|
2539
|
+
)
|
|
2540
|
+
else {
|
|
2541
|
+
const parsedDate:number = value instanceof Date ?
|
|
2542
|
+
value.getTime() / 1000 :
|
|
2543
|
+
Date.parse(value)
|
|
2544
|
+
if (isNaN(parsedDate)) {
|
|
2545
|
+
const parsedFloat:number = parseFloat(value as string)
|
|
2546
|
+
value = isNaN(parsedFloat) ? 0 : parsedFloat
|
|
2547
|
+
} else
|
|
2548
|
+
value = parsedDate / 1000
|
|
2549
|
+
}
|
|
2503
2550
|
|
|
2504
2551
|
if (value === Infinity)
|
|
2505
2552
|
return 'Infinitely far in the future'
|
|
@@ -2514,72 +2561,116 @@ GenericInput.transformer = {
|
|
|
2514
2561
|
return formattedValue.substring(0, formattedValue.length - 1)
|
|
2515
2562
|
}}},
|
|
2516
2563
|
parse: (
|
|
2517
|
-
value:number|string,
|
|
2564
|
+
value:Date|number|string,
|
|
2518
2565
|
configuration:DefaultProperties<number>,
|
|
2519
2566
|
transformer:InputDataTransformation
|
|
2520
|
-
):number =>
|
|
2521
|
-
transformer.date.parse
|
|
2522
|
-
transformer.date.parse(
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2567
|
+
):number => {
|
|
2568
|
+
if (transformer.date.parse)
|
|
2569
|
+
return transformer.date.parse(
|
|
2570
|
+
value, configuration, transformer
|
|
2571
|
+
)
|
|
2572
|
+
|
|
2573
|
+
if (value instanceof Date)
|
|
2574
|
+
return value.getTime() / 1000
|
|
2575
|
+
|
|
2576
|
+
const parsedDate:number = Date.parse(value as string)
|
|
2577
|
+
if (isNaN(parsedDate)) {
|
|
2578
|
+
const parsedFloat:number = parseFloat(value as string)
|
|
2579
|
+
if (isNaN(parsedFloat))
|
|
2580
|
+
return 0
|
|
2581
|
+
|
|
2582
|
+
return parsedFloat
|
|
2583
|
+
}
|
|
2584
|
+
|
|
2585
|
+
return parsedDate / 1000
|
|
2586
|
+
}
|
|
2526
2587
|
},
|
|
2527
2588
|
time: {
|
|
2528
|
-
format: {
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2589
|
+
format: {
|
|
2590
|
+
final: {transform: (
|
|
2591
|
+
value:Date|number|string,
|
|
2592
|
+
configuration:DefaultProperties<number>,
|
|
2593
|
+
transformer:InputDataTransformation
|
|
2594
|
+
):string => {
|
|
2595
|
+
if (typeof value !== 'number')
|
|
2596
|
+
if (transformer.time.parse)
|
|
2597
|
+
value = transformer.time.parse(
|
|
2598
|
+
value, configuration, transformer
|
|
2599
|
+
)
|
|
2600
|
+
else {
|
|
2601
|
+
const parsedDate:number = value instanceof Date ?
|
|
2602
|
+
value.getTime() / 1000 :
|
|
2603
|
+
Date.parse(value)
|
|
2604
|
+
if (isNaN(parsedDate)) {
|
|
2605
|
+
const parsedFloat:number =
|
|
2606
|
+
parseFloat(value as string)
|
|
2607
|
+
value = isNaN(parsedFloat) ? 0 : parsedFloat
|
|
2608
|
+
} else
|
|
2609
|
+
value = parsedDate / 1000
|
|
2610
|
+
}
|
|
2532
2611
|
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2612
|
+
if (value === Infinity)
|
|
2613
|
+
return 'Infinitely far in the future'
|
|
2614
|
+
if (value === -Infinity)
|
|
2615
|
+
return 'Infinitely early in the past'
|
|
2616
|
+
if (!isFinite(value))
|
|
2617
|
+
return ''
|
|
2539
2618
|
|
|
2540
|
-
|
|
2541
|
-
|
|
2619
|
+
let formattedValue:string =
|
|
2620
|
+
(new Date(Math.round(value * 1000))).toISOString()
|
|
2542
2621
|
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2622
|
+
formattedValue = formattedValue.substring(
|
|
2623
|
+
formattedValue.indexOf('T') + 1, formattedValue.length - 1
|
|
2624
|
+
)
|
|
2546
2625
|
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
)
|
|
2552
|
-
return formattedValue.substring(
|
|
2553
|
-
0, formattedValue.lastIndexOf(':')
|
|
2626
|
+
if (
|
|
2627
|
+
configuration.step &&
|
|
2628
|
+
configuration.step >= 60 &&
|
|
2629
|
+
(configuration.step % 60) === 0
|
|
2554
2630
|
)
|
|
2631
|
+
return formattedValue.substring(
|
|
2632
|
+
0, formattedValue.lastIndexOf(':')
|
|
2633
|
+
)
|
|
2555
2634
|
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
value
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2635
|
+
return formattedValue
|
|
2636
|
+
}}
|
|
2637
|
+
},
|
|
2638
|
+
parse: (value:Date|number|string):number => {
|
|
2639
|
+
if (typeof value === 'number')
|
|
2640
|
+
return value
|
|
2641
|
+
|
|
2642
|
+
if (value instanceof Date)
|
|
2643
|
+
return value.getTime() / 1000
|
|
2644
|
+
|
|
2645
|
+
const parsedDate:number = Date.parse(value)
|
|
2646
|
+
if (isNaN(parsedDate)) {
|
|
2647
|
+
const parsedFloat:number = parseFloat(value.replace(
|
|
2648
|
+
/^([0-9]{2}):([0-9]{2})(:([0-9]{2}(\.[0-9]+)?))?$/,
|
|
2649
|
+
(
|
|
2650
|
+
_match:string,
|
|
2651
|
+
hour:string,
|
|
2652
|
+
minute:string,
|
|
2653
|
+
secondsSuffix?:string,
|
|
2654
|
+
seconds?:string,
|
|
2655
|
+
_millisecondsSuffix?:string
|
|
2656
|
+
):string =>
|
|
2657
|
+
String(
|
|
2658
|
+
parseInt(hour) *
|
|
2659
|
+
60 ** 2 +
|
|
2660
|
+
parseInt(minute) *
|
|
2661
|
+
60 +
|
|
2662
|
+
(secondsSuffix ? parseFloat(seconds!) : 0)
|
|
2663
|
+
)
|
|
2664
|
+
))
|
|
2665
|
+
|
|
2666
|
+
if (isNaN(parsedFloat))
|
|
2667
|
+
return 0
|
|
2668
|
+
|
|
2669
|
+
return parsedFloat
|
|
2670
|
+
}
|
|
2671
|
+
|
|
2672
|
+
return parsedDate / 1000
|
|
2673
|
+
}
|
|
2583
2674
|
},
|
|
2584
2675
|
|
|
2585
2676
|
float: {
|