@abgov/jsonforms-components 1.2.2 → 1.2.4

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/index.esm.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import { withAjvProps, materialSliderControlTester, MaterialSliderControl, materialObjectControlTester, MaterialObjectRenderer, materialAllOfControlTester, MaterialAllOfRenderer, materialAnyOfControlTester, MaterialAnyOfRenderer, materialOneOfControlTester, MaterialOneOfRenderer, materialOneOfRadioGroupControlTester, MaterialOneOfRadioGroupControl, materialOneOfEnumControlTester, MaterialOneOfEnumControl, materialHorizontalLayoutTester, materialVerticalLayoutTester, materialArrayLayoutTester, MaterialArrayLayout, materialAnyOfStringOrEnumControlTester, MaterialAnyOfStringOrEnumControl, materialEnumArrayRendererTester, MaterialEnumArrayRenderer, materialBooleanCellTester, MaterialBooleanCell, materialBooleanToggleCellTester, MaterialBooleanToggleCell, materialEnumCellTester, MaterialEnumCell, materialOneOfEnumCellTester, MaterialOneOfEnumCell } from '@jsonforms/material-renderers';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
- import { GoAFormItem, GoAInput, GoATextArea, GoACallout, GoAInputDate, GoAInputDateTime, GoAInputTime, GoADropdown, GoADropdownItem, GoARadioGroup, GoARadioItem, GoACheckbox, GoAFormStepper, GoAFormStep, GoAPages, GoAButton, GoAIconButton, GoAFileUploadInput, GoAModal, GoACircularProgress, GoAGrid, GoAContainer, GoAButtonGroup, GoADetails } from '@abgov/react-components';
3
+ import { GoAFormItem, GoACallout, GoAInputDate, GoAInput, GoATextArea, GoAInputDateTime, GoAInputTime, GoADropdown, GoADropdownItem, GoARadioGroup, GoARadioItem, GoACheckbox, GoAFormStepper, GoAFormStep, GoAPages, GoAButton, GoAIconButton, GoAFileUploadInput, GoAModal, GoACircularProgress, GoAGrid, GoAContainer, GoAButtonGroup, GoADetails } from '@abgov/react-components';
4
4
  import { Hidden, Typography, FormHelperText } from '@mui/material';
5
- import { rankWith, isStringControl, and, optionIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, isEnumControl, isBooleanControl, isDescriptionHidden, isVisible, isEnabled, deriveLabelForUISchemaElement, uiTypeIs, schemaTypeIs, formatIs, createDefaultValue, Paths, or, isObjectArrayControl, isPrimitiveArrayControl, withIncreasedRank, hasType, isControl, isCategorization, isLayout } from '@jsonforms/core';
5
+ import styled from 'styled-components';
6
+ import { rankWith, isDateControl, isStringControl, and, optionIs, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, isEnumControl, isBooleanControl, isDescriptionHidden, isVisible, isEnabled, deriveLabelForUISchemaElement, uiTypeIs, schemaTypeIs, formatIs, createDefaultValue, Paths, or, isObjectArrayControl, isPrimitiveArrayControl, withIncreasedRank, hasType, isControl, isCategorization, isLayout } from '@jsonforms/core';
6
7
  import { withJsonFormsControlProps, withJsonFormsEnumProps, withTranslateProps, withJsonFormsLayoutProps, JsonFormsDispatch, useJsonForms, withJsonFormsArrayLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
7
8
  import React, { createContext, useEffect, useState, useMemo, useContext, useCallback } from 'react';
8
9
  import merge from 'lodash/merge';
9
10
  import axios from 'axios';
10
11
  import TextField from '@mui/material/TextField';
11
12
  import Autocomplete from '@mui/material/Autocomplete';
12
- import styled from 'styled-components';
13
13
  import isEmpty from 'lodash/isEmpty';
14
14
  import range from 'lodash/range';
15
15
 
@@ -1739,6 +1739,12 @@ $$3({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }
1739
1739
  assign: assign
1740
1740
  });
1741
1741
 
1742
+ let _$6 = t => t,
1743
+ _t$6;
1744
+ const FormFieldWrapper = styled.div(_t$6 || (_t$6 = _$6`
1745
+ margin-bottom: var(--goa-space-l);
1746
+ `));
1747
+
1742
1748
  var anObject$3 = anObject$9;
1743
1749
 
1744
1750
  // `RegExp.prototype.flags` getter implementation
@@ -2389,16 +2395,126 @@ const GoAInputBaseControl = props => {
2389
2395
  }
2390
2396
  return jsx(Hidden, {
2391
2397
  xsUp: !visible,
2392
- children: jsx(GoAFormItem, {
2393
- requirement: required ? 'required' : undefined,
2394
- error: modifiedErrors,
2395
- label: (props === null || props === void 0 ? void 0 : props.noLabel) === true ? '' : labelToUpdate,
2396
- helpText: typeof ((_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.help) === 'string' ? (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.help : '',
2397
- children: jsx(InnerComponent, Object.assign({}, props))
2398
+ children: jsx(FormFieldWrapper, {
2399
+ children: jsx(GoAFormItem, {
2400
+ requirement: required ? 'required' : undefined,
2401
+ error: modifiedErrors,
2402
+ label: (props === null || props === void 0 ? void 0 : props.noLabel) === true ? '' : labelToUpdate,
2403
+ helpText: typeof ((_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.help) === 'string' ? (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.help : '',
2404
+ children: jsx(InnerComponent, Object.assign({}, props))
2405
+ })
2398
2406
  })
2399
2407
  });
2400
2408
  };
2401
2409
 
2410
+ /**
2411
+ * Used internally by registered Controls, the MessageControl
2412
+ * is used to display an error message if a component cannot be rendered
2413
+ * due to input errors - typically from options.componentProps.
2414
+ *
2415
+ * NOTE: The component itself is not, and should not, be registered.
2416
+ *
2417
+ * @param message the message to be displayed
2418
+ *
2419
+ * @returns component for displaying the message in the correct style
2420
+ */
2421
+ // TODO: Add styling
2422
+ const MessageControl = message => {
2423
+ return jsx(GoACallout, {
2424
+ type: "emergency",
2425
+ children: message
2426
+ });
2427
+ };
2428
+
2429
+ const errMalformedDate = (scope, type) => {
2430
+ return `${type}-date for variable '${scope}' has an incorrect format.`;
2431
+ };
2432
+ const standardizeDate = date => {
2433
+ try {
2434
+ const stdDate = new Date(date).toISOString().substring(0, 10);
2435
+ return stdDate;
2436
+ } catch (e) {
2437
+ return undefined;
2438
+ }
2439
+ };
2440
+ const isValidDateFormat = date => {
2441
+ const standardized = standardizeDate(date);
2442
+ return standardized !== undefined;
2443
+ };
2444
+ const invalidDateFormat = (scope, type) => {
2445
+ return MessageControl(errMalformedDate(scope, type));
2446
+ };
2447
+ const reformatDateProps = props => {
2448
+ if (props) {
2449
+ if ('min' in props && typeof props.min === 'string') {
2450
+ props['min'] = standardizeDate(props.min);
2451
+ }
2452
+ if ('max' in props && typeof props.max === 'string') {
2453
+ props['max'] = standardizeDate(props.max);
2454
+ }
2455
+ }
2456
+ return props;
2457
+ };
2458
+ const GoADateInput = props => {
2459
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2460
+ const {
2461
+ data,
2462
+ config,
2463
+ id,
2464
+ enabled,
2465
+ uischema,
2466
+ path,
2467
+ handleChange,
2468
+ label
2469
+ } = props;
2470
+ const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
2471
+ const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
2472
+ const minDate = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.min;
2473
+ if (minDate && !isValidDateFormat(minDate)) {
2474
+ return invalidDateFormat(uischema.scope, 'Min');
2475
+ }
2476
+ const maxDate = (_g = (_f = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _f === void 0 ? void 0 : _f.componentProps) === null || _g === void 0 ? void 0 : _g.max;
2477
+ if (maxDate && !isValidDateFormat(maxDate)) {
2478
+ return invalidDateFormat(uischema.scope, 'Max');
2479
+ }
2480
+ return jsx(GoAInputDate, Object.assign({
2481
+ error: checkFieldValidity(props).length > 0,
2482
+ width: "100%",
2483
+ name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
2484
+ value: standardizeDate(data) || '',
2485
+ testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
2486
+ disabled: !enabled,
2487
+ readonly: readOnly,
2488
+ onChange: (name, value) => {
2489
+ onChangeForDateControl({
2490
+ name,
2491
+ value,
2492
+ controlProps: props
2493
+ });
2494
+ },
2495
+ onKeyPress: (name, value, key) => {
2496
+ onKeyPressForDateControl({
2497
+ name,
2498
+ value,
2499
+ key,
2500
+ controlProps: props
2501
+ });
2502
+ },
2503
+ onBlur: (name, value) => {
2504
+ onBlurForDateControl({
2505
+ name,
2506
+ value,
2507
+ controlProps: props
2508
+ });
2509
+ }
2510
+ }, reformatDateProps((_h = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _h === void 0 ? void 0 : _h.componentProps)));
2511
+ };
2512
+ const GoADateControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
2513
+ input: GoADateInput
2514
+ }));
2515
+ const GoADateControlTester = rankWith(4, isDateControl);
2516
+ const GoAInputDateControl = withJsonFormsControlProps(GoADateControl);
2517
+
2402
2518
  /**
2403
2519
  * Checks input controls data value to determine is required and has any data.
2404
2520
  * @param props - The JsonForm control props
@@ -2419,9 +2535,242 @@ const isRequiredAndHasNoData = props => {
2419
2535
  const isNotKeyPressTabOrShift = key => {
2420
2536
  return !(key === 'Tab' || key === 'Shift') && key !== undefined;
2421
2537
  };
2538
+ /**
2539
+ * Helper function to process onKeyPress events for text controls.
2540
+ * @param props - EventKeyPressControlProps
2541
+ */
2542
+ const onKeyPressForTextControl = props => {
2543
+ const {
2544
+ key,
2545
+ value,
2546
+ controlProps
2547
+ } = props;
2548
+ const {
2549
+ handleChange,
2550
+ path
2551
+ } = controlProps;
2552
+ if (isNotKeyPressTabOrShift(key)) {
2553
+ handleChange(path, value);
2554
+ }
2555
+ };
2556
+ /**
2557
+ * Helper functions to process onKeyPress events for Numeric controls.
2558
+ * @param props - EventKeyPressControlProps
2559
+ */
2560
+ const onKeyPressNumericControl = props => {
2561
+ const {
2562
+ value,
2563
+ key,
2564
+ controlProps
2565
+ } = props;
2566
+ const {
2567
+ handleChange,
2568
+ path
2569
+ } = controlProps;
2570
+ if (isNotKeyPressTabOrShift(key)) {
2571
+ let newValue = '';
2572
+ if (value !== '') {
2573
+ newValue = +value;
2574
+ }
2575
+ handleChange(path, newValue);
2576
+ }
2577
+ };
2578
+ /**
2579
+ * Helper function to process onKeyPress events for Time controls
2580
+ * @param props - EventKeyPressControlProps
2581
+ */
2582
+ const onKeyPressForTimeControl = props => {
2583
+ const {
2584
+ controlProps,
2585
+ key
2586
+ } = props;
2587
+ const {
2588
+ value
2589
+ } = props;
2590
+ const {
2591
+ handleChange,
2592
+ path
2593
+ } = controlProps;
2594
+ if (isNotKeyPressTabOrShift(key)) {
2595
+ handleChange(path, value);
2596
+ }
2597
+ };
2598
+ /**
2599
+ * Helper function to process onKeyPress events for Date/Date Time controls
2600
+ * @param props - EventKeyPressControlProps
2601
+ */
2602
+ const onKeyPressForDateControl = props => {
2603
+ const {
2604
+ controlProps,
2605
+ key
2606
+ } = props;
2607
+ let {
2608
+ value
2609
+ } = props;
2610
+ const {
2611
+ handleChange,
2612
+ path
2613
+ } = controlProps;
2614
+ if (isNotKeyPressTabOrShift(key)) {
2615
+ value = standardizeDate(value) || '';
2616
+ handleChange(path, value);
2617
+ }
2618
+ };
2619
+ /**
2620
+ * Helper function to process onBlur events for text controls.
2621
+ * @param props - EventBlurControlProps
2622
+ */
2623
+ const onBlurForTextControl = props => {
2624
+ const {
2625
+ value,
2626
+ controlProps
2627
+ } = props;
2628
+ const {
2629
+ handleChange,
2630
+ path
2631
+ } = controlProps;
2632
+ if (isRequiredAndHasNoData(controlProps)) {
2633
+ handleChange(path, value);
2634
+ }
2635
+ };
2636
+ /**
2637
+ * Helper function to process onBlur events for Numeric controls.
2638
+ * @param props - EventBlurControlProps
2639
+ */
2640
+ const onBlurForNumericControl = props => {
2641
+ const {
2642
+ value,
2643
+ controlProps
2644
+ } = props;
2645
+ const {
2646
+ handleChange,
2647
+ path
2648
+ } = controlProps;
2649
+ if (isRequiredAndHasNoData(controlProps)) {
2650
+ let newValue = '';
2651
+ if (value !== '') {
2652
+ newValue = +value;
2653
+ }
2654
+ handleChange(path, newValue);
2655
+ }
2656
+ };
2657
+ /**
2658
+ * Helper function to process for onBlur event for Date/Date Time controls
2659
+ * @param props - EventBlurControlProps
2660
+ */
2661
+ const onBlurForDateControl = props => {
2662
+ const {
2663
+ controlProps
2664
+ } = props;
2665
+ let {
2666
+ value
2667
+ } = props;
2668
+ const {
2669
+ handleChange,
2670
+ path
2671
+ } = controlProps;
2672
+ if (isRequiredAndHasNoData(controlProps)) {
2673
+ value = standardizeDate(value) || '';
2674
+ handleChange(path, value);
2675
+ }
2676
+ };
2677
+ /**
2678
+ * Helper function to process for onBlur event for time controls
2679
+ * @param props - EventBlurControlProps
2680
+ */
2681
+ const onBlurForTimeControl = props => {
2682
+ const {
2683
+ controlProps
2684
+ } = props;
2685
+ const {
2686
+ value
2687
+ } = props;
2688
+ const {
2689
+ handleChange,
2690
+ path
2691
+ } = controlProps;
2692
+ if (isRequiredAndHasNoData(controlProps)) {
2693
+ handleChange(path, value);
2694
+ }
2695
+ };
2696
+ /**
2697
+ * Helper function to process onChange event for Date controls.
2698
+ * @param props - EventChangeControlProps
2699
+ */
2700
+ const onChangeForDateControl = props => {
2701
+ let {
2702
+ value
2703
+ } = props;
2704
+ const {
2705
+ controlProps
2706
+ } = props;
2707
+ const {
2708
+ handleChange,
2709
+ path,
2710
+ data
2711
+ } = controlProps;
2712
+ if (value && value !== null) {
2713
+ value = standardizeDate(value) || '';
2714
+ if (value !== data) {
2715
+ handleChange(path, value);
2716
+ }
2717
+ }
2718
+ };
2719
+ /**
2720
+ * Helper function to process onChange event for Date controls.
2721
+ * @param props - EventChangeControlProps
2722
+ */
2723
+ const onChangeForDateTimeControl = props => {
2724
+ var _a;
2725
+ let {
2726
+ value
2727
+ } = props;
2728
+ const {
2729
+ controlProps
2730
+ } = props;
2731
+ const {
2732
+ handleChange,
2733
+ path,
2734
+ data
2735
+ } = controlProps;
2736
+ if (value && value !== null) {
2737
+ value = isValidDate(value) ? (_a = new Date(value)) === null || _a === void 0 ? void 0 : _a.toISOString() : '';
2738
+ if (data !== value) {
2739
+ handleChange(path, value);
2740
+ }
2741
+ }
2742
+ };
2743
+ /**
2744
+ * Helper function to process onChange event for Number/Integer controls.
2745
+ * @param props - EventChangeControlProps
2746
+ */
2747
+ const onChangeForNumericControl = props => {
2748
+ const {
2749
+ value
2750
+ } = props;
2751
+ const {
2752
+ controlProps
2753
+ } = props;
2754
+ const {
2755
+ handleChange,
2756
+ path,
2757
+ data
2758
+ } = controlProps;
2759
+ if (value && value !== null) {
2760
+ //Prevents handleChange from executing if the data has not changed
2761
+ //so the component will not re render.
2762
+ if (data !== +value) {
2763
+ let newValue = '';
2764
+ if (value !== '') {
2765
+ newValue = +value;
2766
+ }
2767
+ handleChange(path, newValue);
2768
+ }
2769
+ }
2770
+ };
2422
2771
 
2423
2772
  const GoAInputText = props => {
2424
- var _a, _b, _c, _d;
2773
+ var _a, _b, _c, _d, _e, _f, _g;
2425
2774
  const {
2426
2775
  data,
2427
2776
  config,
@@ -2439,12 +2788,14 @@ const GoAInputText = props => {
2439
2788
  const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
2440
2789
  const errorsFormInput = checkFieldValidity(props);
2441
2790
  const autoCapitalize = ((_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.autoCapitalize) === true || ((_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.autoCapitalize) === true;
2791
+ const readOnly = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.readOnly) !== null && _f !== void 0 ? _f : false;
2442
2792
  return jsx(GoAInput, Object.assign({
2443
2793
  error: errorsFormInput.length > 0,
2444
2794
  type: appliedUiSchemaOptions.format === 'password' ? 'password' : 'text',
2445
2795
  disabled: !enabled,
2446
2796
  value: data,
2447
2797
  width: '100%',
2798
+ readonly: readOnly,
2448
2799
  placeholder: placeholder,
2449
2800
  // maxLength={appliedUiSchemaOptions?.maxLength}
2450
2801
  name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
@@ -2454,24 +2805,21 @@ const GoAInputText = props => {
2454
2805
  // side effect that causes the validation to render when it shouldnt.
2455
2806
  onChange: (name, value) => {},
2456
2807
  onKeyPress: (name, value, key) => {
2457
- if (isNotKeyPressTabOrShift(key)) {
2458
- if (autoCapitalize === true) {
2459
- handleChange(path, value.toUpperCase());
2460
- } else {
2461
- handleChange(path, value);
2462
- }
2463
- }
2808
+ onKeyPressForTextControl({
2809
+ name,
2810
+ value: autoCapitalize ? value.toUpperCase() : value,
2811
+ key,
2812
+ controlProps: props
2813
+ });
2464
2814
  },
2465
2815
  onBlur: (name, value) => {
2466
- if (isRequiredAndHasNoData(props)) {
2467
- if (autoCapitalize) {
2468
- handleChange(path, value.toUpperCase());
2469
- } else {
2470
- handleChange(path, value);
2471
- }
2472
- }
2816
+ onBlurForTextControl({
2817
+ name,
2818
+ controlProps: props,
2819
+ value: autoCapitalize ? value.toUpperCase() : value
2820
+ });
2473
2821
  }
2474
- }, (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps));
2822
+ }, (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps));
2475
2823
  };
2476
2824
  const GoATextControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
2477
2825
  input: GoAInputText
@@ -2480,7 +2828,7 @@ const GoATextControlTester = rankWith(1, isStringControl);
2480
2828
  const GoAInputTextControl = withJsonFormsControlProps(GoATextControl);
2481
2829
 
2482
2830
  const MultiLineText = props => {
2483
- var _a, _b, _c, _d;
2831
+ var _a, _b, _c, _d, _e, _f, _g;
2484
2832
  // eslint-disable-next-line
2485
2833
  const {
2486
2834
  data,
@@ -2497,10 +2845,12 @@ const MultiLineText = props => {
2497
2845
  const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
2498
2846
  const errorsFormInput = checkFieldValidity(props);
2499
2847
  const autoCapitalize = ((_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.autoCapitalize) === true || ((_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.autoCapitalize) === true;
2848
+ const readOnly = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.readOnly) !== null && _f !== void 0 ? _f : false;
2500
2849
  return jsx(GoATextArea, Object.assign({
2501
2850
  error: errorsFormInput.length > 0,
2502
2851
  value: data,
2503
2852
  disabled: !enabled,
2853
+ readOnly: readOnly,
2504
2854
  placeholder: placeholder,
2505
2855
  testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
2506
2856
  name: `${label || path}-text-area`,
@@ -2508,19 +2858,18 @@ const MultiLineText = props => {
2508
2858
  // Note: Paul Jan-09-2023. The latest ui-component come with the maxCount. We need to uncomment the following line when the component is updated
2509
2859
  // maxCount={schema.maxLength || 256}
2510
2860
  onKeyPress: (name, value, key) => {
2511
- if (isNotKeyPressTabOrShift(key)) {
2512
- if (autoCapitalize === true) {
2513
- handleChange(path, value.toUpperCase());
2514
- } else {
2515
- handleChange(path, value);
2516
- }
2517
- }
2861
+ onKeyPressForTextControl({
2862
+ name,
2863
+ value: autoCapitalize ? value.toUpperCase() : value,
2864
+ key,
2865
+ controlProps: props
2866
+ });
2518
2867
  },
2519
2868
  // Dont use handleChange in the onChange event, use the keyPress or onBlur.
2520
2869
  // If you use it onChange along with keyPress event it will cause a
2521
2870
  // side effect that causes the validation to render when it shouldnt.
2522
- onChange: () => {}
2523
- }, (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps));
2871
+ onChange: (name, value) => {}
2872
+ }, (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps));
2524
2873
  };
2525
2874
  const MultiLineTextControlInput = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
2526
2875
  input: MultiLineText
@@ -2528,108 +2877,8 @@ const MultiLineTextControlInput = props => jsx(GoAInputBaseControl, Object.assig
2528
2877
  const MultiLineTextControlTester = rankWith(3, and(isStringControl, optionIs('multi', true)));
2529
2878
  const MultiLineTextControl = withJsonFormsControlProps(MultiLineTextControlInput);
2530
2879
 
2531
- /**
2532
- * Used internally by registered Controls, the MessageControl
2533
- * is used to display an error message if a component cannot be rendered
2534
- * due to input errors - typically from options.componentProps.
2535
- *
2536
- * NOTE: The component itself is not, and should not, be registered.
2537
- *
2538
- * @param message the message to be displayed
2539
- *
2540
- * @returns component for displaying the message in the correct style
2541
- */
2542
- // TODO: Add styling
2543
- const MessageControl = message => {
2544
- return jsx(GoACallout, {
2545
- type: "emergency",
2546
- children: message
2547
- });
2548
- };
2549
-
2550
- const errMalformedDate = (scope, type) => {
2551
- return `${type}-date for variable '${scope}' has an incorrect format.`;
2552
- };
2553
- const standardizeDate = date => {
2554
- try {
2555
- const stdDate = new Date(date).toISOString().substring(0, 10);
2556
- return stdDate;
2557
- } catch (e) {
2558
- return undefined;
2559
- }
2560
- };
2561
- const isValidDateFormat = date => {
2562
- const standardized = standardizeDate(date);
2563
- return standardized !== undefined;
2564
- };
2565
- const invalidDateFormat = (scope, type) => {
2566
- return MessageControl(errMalformedDate(scope, type));
2567
- };
2568
- const reformatDateProps = props => {
2569
- if (props) {
2570
- if ('min' in props && typeof props.min === 'string') {
2571
- props['min'] = standardizeDate(props.min);
2572
- }
2573
- if ('max' in props && typeof props.max === 'string') {
2574
- props['max'] = standardizeDate(props.max);
2575
- }
2576
- }
2577
- return props;
2578
- };
2579
- const GoADateInput = props => {
2580
- var _a, _b, _c, _d, _e;
2581
- const {
2582
- data,
2583
- config,
2584
- id,
2585
- enabled,
2586
- uischema,
2587
- path,
2588
- handleChange,
2589
- label
2590
- } = props;
2591
- const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
2592
- const minDate = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.min;
2593
- if (minDate && !isValidDateFormat(minDate)) {
2594
- return invalidDateFormat(uischema.scope, 'Min');
2595
- }
2596
- const maxDate = (_d = (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.componentProps) === null || _d === void 0 ? void 0 : _d.max;
2597
- if (maxDate && !isValidDateFormat(maxDate)) {
2598
- return invalidDateFormat(uischema.scope, 'Max');
2599
- }
2600
- return jsx(GoAInputDate, Object.assign({
2601
- error: checkFieldValidity(props).length > 0,
2602
- width: "100%",
2603
- name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
2604
- value: standardizeDate(data) || '',
2605
- testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
2606
- disabled: !enabled,
2607
- // Don't use handleChange in the onChange event, use the keyPress or onBlur.
2608
- // If you use it onChange along with keyPress event it will cause a
2609
- // side effect that causes the validation to render when it shouldn't.
2610
- onChange: (name, value) => {},
2611
- onKeyPress: (name, value, key) => {
2612
- if (isNotKeyPressTabOrShift(key)) {
2613
- value = standardizeDate(value) || '';
2614
- handleChange(path, value);
2615
- }
2616
- },
2617
- onBlur: (name, value) => {
2618
- if (isRequiredAndHasNoData(props)) {
2619
- value = standardizeDate(value) || '';
2620
- handleChange(path, value);
2621
- }
2622
- }
2623
- }, reformatDateProps((_e = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _e === void 0 ? void 0 : _e.componentProps)));
2624
- };
2625
- const GoADateControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
2626
- input: GoADateInput
2627
- }));
2628
- const GoADateControlTester = rankWith(4, isDateControl);
2629
- const GoAInputDateControl = withJsonFormsControlProps(GoADateControl);
2630
-
2631
2880
  const GoANumberInput = props => {
2632
- var _a;
2881
+ var _a, _b, _c, _d;
2633
2882
  // eslint-disable-next-line
2634
2883
  const {
2635
2884
  data,
@@ -2650,11 +2899,13 @@ const GoANumberInput = props => {
2650
2899
  const StepValue = clonedSchema.multipleOf ? clonedSchema.multipleOf : 0.01;
2651
2900
  const MinValue = clonedSchema.minimum ? clonedSchema.minimum : '';
2652
2901
  const MaxValue = clonedSchema.exclusiveMaximum ? clonedSchema.exclusiveMaximum : '';
2902
+ const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
2653
2903
  const errorsFormInput = checkFieldValidity(props);
2654
2904
  return jsx(GoAInput, Object.assign({
2655
2905
  type: "number",
2656
2906
  error: errorsFormInput.length > 0,
2657
2907
  disabled: !enabled,
2908
+ readonly: readOnly,
2658
2909
  value: InputValue,
2659
2910
  placeholder: placeholder,
2660
2911
  step: StepValue,
@@ -2664,27 +2915,28 @@ const GoANumberInput = props => {
2664
2915
  name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
2665
2916
  testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
2666
2917
  onKeyPress: (name, value, key) => {
2667
- if (isNotKeyPressTabOrShift(key)) {
2668
- let newValue = '';
2669
- if (value !== '') {
2670
- newValue = +value;
2671
- }
2672
- handleChange(path, newValue);
2673
- }
2918
+ onKeyPressNumericControl({
2919
+ name,
2920
+ value,
2921
+ key,
2922
+ controlProps: props
2923
+ });
2674
2924
  },
2675
2925
  onBlur: (name, value) => {
2676
- if (isRequiredAndHasNoData(props)) {
2677
- let newValue = '';
2678
- if (value !== '') {
2679
- newValue = +value;
2680
- }
2681
- handleChange(path, newValue);
2682
- }
2926
+ onBlurForNumericControl({
2927
+ name,
2928
+ value,
2929
+ controlProps: props
2930
+ });
2683
2931
  },
2684
- //Dont trigger the handleChange event on the onChange event as it will cause
2685
- //issue with the error message from displaying, use keyPress or the onBlur event instead
2686
- onChange: (name, value) => {}
2687
- }, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps));
2932
+ onChange: (name, value) => {
2933
+ onChangeForNumericControl({
2934
+ name,
2935
+ value,
2936
+ controlProps: props
2937
+ });
2938
+ }
2939
+ }, (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps));
2688
2940
  };
2689
2941
  const GoANumberControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
2690
2942
  input: GoANumberInput
@@ -2693,7 +2945,7 @@ const GoANumberControlTester = rankWith(2, isNumberControl);
2693
2945
  const GoAInputNumberControl = withJsonFormsControlProps(GoANumberControl);
2694
2946
 
2695
2947
  const GoAInputInteger = props => {
2696
- var _a;
2948
+ var _a, _b, _c, _d;
2697
2949
  // eslint-disable-next-line
2698
2950
  const {
2699
2951
  data,
@@ -2714,12 +2966,14 @@ const GoAInputInteger = props => {
2714
2966
  const StepValue = clonedSchema.multipleOf ? clonedSchema.multipleOf : 0;
2715
2967
  const MinValue = clonedSchema.minimum ? clonedSchema.minimum : '';
2716
2968
  const MaxValue = clonedSchema.exclusiveMaximum ? clonedSchema.exclusiveMaximum : '';
2969
+ const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
2717
2970
  const errorsFormInput = checkFieldValidity(props);
2718
2971
  return jsx(GoAInput, Object.assign({
2719
2972
  type: "number",
2720
2973
  error: errorsFormInput.length > 0,
2721
2974
  width: "100%",
2722
2975
  disabled: !enabled,
2976
+ readonly: readOnly,
2723
2977
  value: InputValue,
2724
2978
  step: StepValue,
2725
2979
  min: MinValue,
@@ -2728,27 +2982,28 @@ const GoAInputInteger = props => {
2728
2982
  name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
2729
2983
  testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
2730
2984
  onKeyPress: (name, value, key) => {
2731
- if (isNotKeyPressTabOrShift(key)) {
2732
- let newValue = '';
2733
- if (value !== '') {
2734
- newValue = +value;
2735
- }
2736
- handleChange(path, newValue);
2737
- }
2985
+ onKeyPressNumericControl({
2986
+ name,
2987
+ value,
2988
+ key,
2989
+ controlProps: props
2990
+ });
2738
2991
  },
2739
2992
  onBlur: (name, value) => {
2740
- if (isRequiredAndHasNoData(props)) {
2741
- let newValue = '';
2742
- if (value !== '') {
2743
- newValue = +value;
2744
- }
2745
- handleChange(path, newValue);
2746
- }
2993
+ onBlurForNumericControl({
2994
+ name,
2995
+ value,
2996
+ controlProps: props
2997
+ });
2747
2998
  },
2748
- //Dont trigger the handleChange event on the onChange event as it will cause
2749
- //issue with the error message from displaying, use keyPress or the onBlur event instead
2750
- onChange: (name, value) => {}
2751
- }, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps));
2999
+ onChange: (name, value) => {
3000
+ onChangeForNumericControl({
3001
+ name,
3002
+ value,
3003
+ controlProps: props
3004
+ });
3005
+ }
3006
+ }, (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps));
2752
3007
  };
2753
3008
  const GoAIntegerControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
2754
3009
  input: GoAInputInteger
@@ -2757,7 +3012,7 @@ const GoAIntegerControlTester = rankWith(2, isIntegerControl);
2757
3012
  const GoAInputIntegerControl = withJsonFormsControlProps(GoAIntegerControl);
2758
3013
 
2759
3014
  const GoADateTimeInput = props => {
2760
- var _a;
3015
+ var _a, _b, _c, _d;
2761
3016
  // eslint-disable-next-line
2762
3017
  const {
2763
3018
  data,
@@ -2773,6 +3028,7 @@ const GoADateTimeInput = props => {
2773
3028
  label
2774
3029
  } = props;
2775
3030
  const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
3031
+ const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
2776
3032
  return jsx(GoAInputDateTime, Object.assign({
2777
3033
  error: checkFieldValidity(props).length > 0,
2778
3034
  width: "100%",
@@ -2780,24 +3036,30 @@ const GoADateTimeInput = props => {
2780
3036
  value: data ? new Date(data).toISOString() : '',
2781
3037
  testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
2782
3038
  disabled: !enabled,
2783
- // Dont use handleChange in the onChange event, use the keyPress or onBlur.
2784
- // If you use it onChange along with keyPress event it will cause a
2785
- // side effect that causes the validation to render when it shouldnt.
2786
- onChange: (name, value) => {},
3039
+ readonly: readOnly,
3040
+ onChange: (name, value) => {
3041
+ onChangeForDateTimeControl({
3042
+ name,
3043
+ value,
3044
+ controlProps: props
3045
+ });
3046
+ },
2787
3047
  onKeyPress: (name, value, key) => {
2788
- var _a;
2789
- if (isNotKeyPressTabOrShift(key)) {
2790
- value = isValidDate(value) ? (_a = new Date(value)) === null || _a === void 0 ? void 0 : _a.toISOString() : '';
2791
- handleChange(path, value);
2792
- }
3048
+ onKeyPressForDateControl({
3049
+ name,
3050
+ value,
3051
+ key,
3052
+ controlProps: props
3053
+ });
2793
3054
  },
2794
3055
  onBlur: (name, value) => {
2795
- if (isRequiredAndHasNoData(props)) {
2796
- value = isValidDate(value) ? new Date(value).toISOString() : '';
2797
- handleChange(path, value);
2798
- }
3056
+ onBlurForDateControl({
3057
+ name,
3058
+ value,
3059
+ controlProps: props
3060
+ });
2799
3061
  }
2800
- }, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps));
3062
+ }, (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps));
2801
3063
  };
2802
3064
  const GoADateTimeControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
2803
3065
  input: GoADateTimeInput
@@ -2806,7 +3068,7 @@ const GoADateTimeControlTester = rankWith(2, isDateTimeControl);
2806
3068
  const GoAInputDateTimeControl = withJsonFormsControlProps(GoADateTimeControl);
2807
3069
 
2808
3070
  const GoATimeInput = props => {
2809
- var _a;
3071
+ var _a, _b, _c, _d;
2810
3072
  // eslint-disable-next-line
2811
3073
  const {
2812
3074
  data,
@@ -2822,6 +3084,7 @@ const GoATimeInput = props => {
2822
3084
  } = props;
2823
3085
  const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
2824
3086
  (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
3087
+ const readOnly = (_c = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.readOnly) !== null && _c !== void 0 ? _c : false;
2825
3088
  const errorsFormInput = checkFieldValidity(props);
2826
3089
  return jsx(GoAInputTime, Object.assign({
2827
3090
  error: errorsFormInput.length > 0,
@@ -2830,22 +3093,28 @@ const GoATimeInput = props => {
2830
3093
  step: 1,
2831
3094
  width: "100%",
2832
3095
  disabled: !enabled,
3096
+ readonly: readOnly,
2833
3097
  testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
2834
3098
  onBlur: (name, value) => {
2835
- if (isRequiredAndHasNoData(props)) {
2836
- handleChange(path, value);
2837
- }
3099
+ onBlurForTimeControl({
3100
+ name,
3101
+ value,
3102
+ controlProps: props
3103
+ });
2838
3104
  },
2839
3105
  // Dont use handleChange in the onChange event, use the keyPress or onBlur.
2840
3106
  // If you use it onChange along with keyPress event it will cause a
2841
3107
  // side effect that causes the validation to render when it shouldnt.
2842
3108
  onChange: (name, value) => {},
2843
3109
  onKeyPress: (name, value, key) => {
2844
- if (isNotKeyPressTabOrShift(key)) {
2845
- handleChange(path, value);
2846
- }
3110
+ onKeyPressForTimeControl({
3111
+ name,
3112
+ value,
3113
+ key,
3114
+ controlProps: props
3115
+ });
2847
3116
  }
2848
- }, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps));
3117
+ }, (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps));
2849
3118
  };
2850
3119
  const GoATimeControl = props => jsx(GoAInputBaseControl, Object.assign({}, props, {
2851
3120
  input: GoATimeInput
@@ -4443,7 +4712,7 @@ const GoAGroupControlComponent = props => {
4443
4712
  const group = uischema;
4444
4713
  return jsx(Hidden, {
4445
4714
  xsUp: !visible,
4446
- children: jsx(GoAContainer, Object.assign({}, group.options, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps, {
4715
+ children: jsx(GoAContainer, Object.assign({}, (_a = group.options) === null || _a === void 0 ? void 0 : _a.componentProps, {
4447
4716
  children: renderLayoutElements(group.elements, schema, path, enabled, renderers, cells)
4448
4717
  }))
4449
4718
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
6
6
  "repository": "https://github.com/GovAlta/adsp-monorepo",
@@ -1,9 +1,10 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { CellProps, WithClassname, ControlProps, RankedTester } from '@jsonforms/core';
3
3
  import { WithInputProps } from './type';
4
4
  export type GoAInputDateProps = CellProps & WithClassname & WithInputProps;
5
5
  export declare const errMalformedDate: (scope: string, type: string) => string;
6
+ export declare const standardizeDate: (date: Date | string) => string | undefined;
6
7
  export declare const GoADateInput: (props: GoAInputDateProps) => JSX.Element;
7
8
  export declare const GoADateControl: (props: ControlProps) => import("react/jsx-runtime").JSX.Element;
8
9
  export declare const GoADateControlTester: RankedTester;
9
- export declare const GoAInputDateControl: React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
10
+ export declare const GoAInputDateControl: import("react").ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { CellProps, WithClassname, ControlProps, RankedTester } from '@jsonforms/core';
3
3
  import { WithInputProps } from './type';
4
4
  export type GoAInputMultiLineTextProps = CellProps & WithClassname & WithInputProps;
5
5
  export declare const MultiLineText: (props: GoAInputMultiLineTextProps) => JSX.Element;
6
6
  export declare const MultiLineTextControlInput: (props: ControlProps) => import("react/jsx-runtime").JSX.Element;
7
7
  export declare const MultiLineTextControlTester: RankedTester;
8
- export declare const MultiLineTextControl: React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
8
+ export declare const MultiLineTextControl: import("react").ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { CellProps, WithClassname, ControlProps, RankedTester } from '@jsonforms/core';
3
3
  import { WithInputProps } from './type';
4
4
  export type GoAInputNumberProps = CellProps & WithClassname & WithInputProps;
5
5
  export declare const GoANumberInput: (props: GoAInputNumberProps) => JSX.Element;
6
6
  export declare const GoANumberControl: (props: ControlProps) => import("react/jsx-runtime").JSX.Element;
7
7
  export declare const GoANumberControlTester: RankedTester;
8
- export declare const GoAInputNumberControl: React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
8
+ export declare const GoAInputNumberControl: import("react").ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { CellProps, WithClassname, ControlProps, RankedTester } from '@jsonforms/core';
3
3
  import { WithInputProps } from './type';
4
4
  export type GoAInputTextProps = CellProps & WithClassname & WithInputProps;
5
5
  export declare const GoAInputText: (props: GoAInputTextProps) => JSX.Element;
6
6
  export declare const GoATextControl: (props: ControlProps) => import("react/jsx-runtime").JSX.Element;
7
7
  export declare const GoATextControlTester: RankedTester;
8
- export declare const GoAInputTextControl: React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
8
+ export declare const GoAInputTextControl: import("react").ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { CellProps, WithClassname, ControlProps, RankedTester } from '@jsonforms/core';
3
3
  import { WithInputProps } from './type';
4
4
  export type GoAInputTimeProps = CellProps & WithClassname & WithInputProps;
5
5
  export declare const GoATimeInput: (props: GoAInputTimeProps) => JSX.Element;
6
6
  export declare const GoATimeControl: (props: ControlProps) => import("react/jsx-runtime").JSX.Element;
7
7
  export declare const GoATimeControlTester: RankedTester;
8
- export declare const GoAInputTimeControl: React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
8
+ export declare const GoAInputTimeControl: import("react").ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
@@ -0,0 +1 @@
1
+ export declare const FormFieldWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,3 +1,32 @@
1
+ import { ControlProps } from '@jsonforms/core';
1
2
  export interface WithInputProps {
2
3
  label?: string;
3
4
  }
5
+ /**
6
+ * Base event control props to handle event controls
7
+ */
8
+ export interface EventControlProps {
9
+ controlProps: ControlProps;
10
+ }
11
+ /**
12
+ * Change event props to handle on change event controls
13
+ */
14
+ export interface EventChangeControlProps extends EventControlProps {
15
+ name: string;
16
+ value: string | Date;
17
+ }
18
+ /**
19
+ * KeyPress event props to handle event controls
20
+ */
21
+ export interface EventKeyPressControlProps extends EventControlProps {
22
+ name: string;
23
+ value: string | Date;
24
+ key: string;
25
+ }
26
+ /**
27
+ * Blur event props to handle event controls
28
+ */
29
+ export interface EventBlurControlProps extends EventControlProps {
30
+ name: string;
31
+ value: string | Date;
32
+ }
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { LayoutProps, RankedTester } from '@jsonforms/core';
3
3
  export declare const groupTester: RankedTester;
4
+ export declare const GoAGroupControlComponent: (props: LayoutProps) => JSX.Element;
4
5
  export declare const GoAGroupLayoutTester: RankedTester;
5
6
  export declare const GoAGroupControl: React.ComponentType<LayoutProps & import("@jsonforms/core").OwnPropsOfLayout>;
@@ -1,4 +1,5 @@
1
1
  import { ControlProps } from '@jsonforms/core';
2
+ import { EventBlurControlProps, EventChangeControlProps, EventKeyPressControlProps } from '../Controls/Inputs/type';
2
3
  /**
3
4
  * Checks input controls data value to determine is required and has any data.
4
5
  * @param props - The JsonForm control props
@@ -11,3 +12,58 @@ export declare const isRequiredAndHasNoData: (props: ControlProps) => boolean |
11
12
  * @returns true if the key pressed is not a shift or tab key being pressed, otherwise false
12
13
  */
13
14
  export declare const isNotKeyPressTabOrShift: (key: string) => boolean;
15
+ /**
16
+ * Helper function to process onKeyPress events for text controls.
17
+ * @param props - EventKeyPressControlProps
18
+ */
19
+ export declare const onKeyPressForTextControl: (props: EventKeyPressControlProps) => void;
20
+ /**
21
+ * Helper functions to process onKeyPress events for Numeric controls.
22
+ * @param props - EventKeyPressControlProps
23
+ */
24
+ export declare const onKeyPressNumericControl: (props: EventKeyPressControlProps) => void;
25
+ /**
26
+ * Helper function to process onKeyPress events for Time controls
27
+ * @param props - EventKeyPressControlProps
28
+ */
29
+ export declare const onKeyPressForTimeControl: (props: EventKeyPressControlProps) => void;
30
+ /**
31
+ * Helper function to process onKeyPress events for Date/Date Time controls
32
+ * @param props - EventKeyPressControlProps
33
+ */
34
+ export declare const onKeyPressForDateControl: (props: EventKeyPressControlProps) => void;
35
+ /**
36
+ * Helper function to process onBlur events for text controls.
37
+ * @param props - EventBlurControlProps
38
+ */
39
+ export declare const onBlurForTextControl: (props: EventBlurControlProps) => void;
40
+ /**
41
+ * Helper function to process onBlur events for Numeric controls.
42
+ * @param props - EventBlurControlProps
43
+ */
44
+ export declare const onBlurForNumericControl: (props: EventBlurControlProps) => void;
45
+ /**
46
+ * Helper function to process for onBlur event for Date/Date Time controls
47
+ * @param props - EventBlurControlProps
48
+ */
49
+ export declare const onBlurForDateControl: (props: EventBlurControlProps) => void;
50
+ /**
51
+ * Helper function to process for onBlur event for time controls
52
+ * @param props - EventBlurControlProps
53
+ */
54
+ export declare const onBlurForTimeControl: (props: EventBlurControlProps) => void;
55
+ /**
56
+ * Helper function to process onChange event for Date controls.
57
+ * @param props - EventChangeControlProps
58
+ */
59
+ export declare const onChangeForDateControl: (props: EventChangeControlProps) => void;
60
+ /**
61
+ * Helper function to process onChange event for Date controls.
62
+ * @param props - EventChangeControlProps
63
+ */
64
+ export declare const onChangeForDateTimeControl: (props: EventChangeControlProps) => void;
65
+ /**
66
+ * Helper function to process onChange event for Number/Integer controls.
67
+ * @param props - EventChangeControlProps
68
+ */
69
+ export declare const onChangeForNumericControl: (props: EventChangeControlProps) => void;