@maif/react-forms 1.0.56 → 1.0.59
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/README.md +4 -1
- package/lib/esm/index.js +104 -374
- package/lib/index.css +360 -0
- package/lib/index.js +105 -374
- package/package.json +4 -6
package/lib/esm/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import 'fs';
|
|
1
2
|
import * as yup from 'yup';
|
|
2
|
-
import React, { useState,
|
|
3
|
+
import React, { useState, useRef, useEffect, useImperativeHandle } from 'react';
|
|
3
4
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
4
5
|
import classNames from 'classnames';
|
|
6
|
+
import deepEqual from 'fast-deep-equal';
|
|
5
7
|
import { Eye, EyeOff, PlusCircle, MinusCircle, Trash2, ChevronDown, ChevronUp, HelpCircle, Loader, Upload } from 'react-feather';
|
|
6
8
|
import { useFormContext, useController, useForm, FormProvider, Controller, useFieldArray, useWatch } from 'react-hook-form';
|
|
7
9
|
import { DatePicker } from 'react-rainbow-components';
|
|
8
10
|
import ReactToolTip from 'react-tooltip';
|
|
9
11
|
import { v4 } from 'uuid';
|
|
10
|
-
import { createUseStyles } from 'react-jss';
|
|
11
12
|
import CreatableSelect from 'react-select/creatable';
|
|
12
13
|
import Select from 'react-select';
|
|
13
|
-
import
|
|
14
|
+
import hash$1 from 'object-hash';
|
|
14
15
|
import showdown from 'showdown';
|
|
15
16
|
import '@fortawesome/fontawesome-free/css/all.css';
|
|
16
17
|
import 'highlight.js/styles/monokai.css';
|
|
@@ -75,7 +76,7 @@ var _matches = function matches() {
|
|
|
75
76
|
return function (r) {
|
|
76
77
|
return r.matches(regexp, {
|
|
77
78
|
message: message,
|
|
78
|
-
excludeEmptyString:
|
|
79
|
+
excludeEmptyString: true
|
|
79
80
|
});
|
|
80
81
|
};
|
|
81
82
|
}; //string & number
|
|
@@ -532,279 +533,12 @@ function _nonIterableRest() {
|
|
|
532
533
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
533
534
|
}
|
|
534
535
|
|
|
535
|
-
var _switch_button_on, _style;
|
|
536
|
-
|
|
537
|
-
var buttonOutline = function buttonOutline(color, darker) {
|
|
538
|
-
return {
|
|
539
|
-
color: color,
|
|
540
|
-
borderColor: color,
|
|
541
|
-
"&:hover": {
|
|
542
|
-
color: '#fff',
|
|
543
|
-
backgroundColor: color,
|
|
544
|
-
borderColor: darker
|
|
545
|
-
},
|
|
546
|
-
"&.active": {
|
|
547
|
-
color: '#fff',
|
|
548
|
-
backgroundColor: color,
|
|
549
|
-
borderColor: darker
|
|
550
|
-
}
|
|
551
|
-
};
|
|
552
|
-
};
|
|
553
|
-
|
|
554
|
-
var style = (_style = {
|
|
555
|
-
input: {
|
|
556
|
-
display: "block",
|
|
557
|
-
width: "100%",
|
|
558
|
-
padding: "8px 12px",
|
|
559
|
-
fontSize: "1rem",
|
|
560
|
-
color: "#495057",
|
|
561
|
-
border: "1px solid #ced4da",
|
|
562
|
-
borderRadius: 4,
|
|
563
|
-
"&[readonly]": {
|
|
564
|
-
backgroundColor: "#e9ecef",
|
|
565
|
-
opacity: 1
|
|
566
|
-
}
|
|
567
|
-
},
|
|
568
|
-
btn: {
|
|
569
|
-
borderRadius: 5,
|
|
570
|
-
padding: 10,
|
|
571
|
-
fontSize: "1rem",
|
|
572
|
-
cursor: "pointer",
|
|
573
|
-
borderWidth: '1px',
|
|
574
|
-
backgroundColor: '#fff',
|
|
575
|
-
'&:disabled': {
|
|
576
|
-
opacity: .6,
|
|
577
|
-
cursor: 'not-allowed'
|
|
578
|
-
}
|
|
579
|
-
},
|
|
580
|
-
btn_sm: {
|
|
581
|
-
fontSize: "0.875rem",
|
|
582
|
-
padding: ".25rem .5rem",
|
|
583
|
-
lineHeight: "1.5",
|
|
584
|
-
borderRadius: ".2rem"
|
|
585
|
-
},
|
|
586
|
-
btn_group: {
|
|
587
|
-
"& > button:not(:last-child)": {
|
|
588
|
-
borderTopRightRadius: 0,
|
|
589
|
-
borderBottomRightRadius: 0
|
|
590
|
-
},
|
|
591
|
-
"& > button:not(:first-child)": {
|
|
592
|
-
borderTopLeftRadius: 0,
|
|
593
|
-
borderBottomLeftRadius: 0
|
|
594
|
-
}
|
|
595
|
-
},
|
|
596
|
-
btn_red: buttonOutline("#dc3545", "#bd2130"),
|
|
597
|
-
btn_green: buttonOutline("#28a745", "#1e7e34"),
|
|
598
|
-
btn_blue: buttonOutline("#007bff", "#0069d9"),
|
|
599
|
-
btn_grey: buttonOutline("#6c757d", "#5c636a"),
|
|
600
|
-
txt_red: {
|
|
601
|
-
color: "#dc3545"
|
|
602
|
-
},
|
|
603
|
-
ml_5: {
|
|
604
|
-
marginLeft: 5
|
|
605
|
-
},
|
|
606
|
-
ml_10: {
|
|
607
|
-
marginLeft: 10
|
|
608
|
-
},
|
|
609
|
-
mr_5: {
|
|
610
|
-
marginRight: 5
|
|
611
|
-
},
|
|
612
|
-
mr_10: {
|
|
613
|
-
marginRight: 10
|
|
614
|
-
},
|
|
615
|
-
mt_5: {
|
|
616
|
-
marginTop: 5
|
|
617
|
-
},
|
|
618
|
-
mt_10: {
|
|
619
|
-
marginTop: 10
|
|
620
|
-
},
|
|
621
|
-
mt_20: {
|
|
622
|
-
marginTop: 20
|
|
623
|
-
},
|
|
624
|
-
mb_5: {
|
|
625
|
-
marginBottom: 5
|
|
626
|
-
},
|
|
627
|
-
mb_10: {
|
|
628
|
-
marginBottom: 10
|
|
629
|
-
},
|
|
630
|
-
mb_20: {
|
|
631
|
-
marginBottom: 20
|
|
632
|
-
},
|
|
633
|
-
pt_15: {
|
|
634
|
-
paddingTop: 15
|
|
635
|
-
},
|
|
636
|
-
p_15: {
|
|
637
|
-
padding: 15
|
|
638
|
-
},
|
|
639
|
-
pr_15: {
|
|
640
|
-
paddingRight: 15
|
|
641
|
-
},
|
|
642
|
-
w_100: {
|
|
643
|
-
width: '100%'
|
|
644
|
-
},
|
|
645
|
-
w_50: {
|
|
646
|
-
width: '50%'
|
|
647
|
-
},
|
|
648
|
-
d_none: {
|
|
649
|
-
display: "none"
|
|
650
|
-
},
|
|
651
|
-
flexWrap: {
|
|
652
|
-
flexWrap: 'wrap'
|
|
653
|
-
},
|
|
654
|
-
flex: {
|
|
655
|
-
display: "flex"
|
|
656
|
-
},
|
|
657
|
-
flexColumn: {
|
|
658
|
-
flexDirection: "column"
|
|
659
|
-
},
|
|
660
|
-
flex_grow_1: {
|
|
661
|
-
flexGrow: 1
|
|
662
|
-
},
|
|
663
|
-
jc_between: {
|
|
664
|
-
justifyContent: "space-between"
|
|
665
|
-
},
|
|
666
|
-
jc_end: {
|
|
667
|
-
justifyContent: "end"
|
|
668
|
-
},
|
|
669
|
-
jc_flex_end: {
|
|
670
|
-
justifyContent: "flex-end"
|
|
671
|
-
},
|
|
672
|
-
jc_flex_start: {
|
|
673
|
-
justifyContent: "flex-start"
|
|
674
|
-
},
|
|
675
|
-
ac_center: {
|
|
676
|
-
alignContent: "center"
|
|
677
|
-
},
|
|
678
|
-
ai_center: {
|
|
679
|
-
alignItems: "center"
|
|
680
|
-
},
|
|
681
|
-
cursor_pointer: {
|
|
682
|
-
cursor: "pointer"
|
|
683
|
-
},
|
|
684
|
-
cursor_not_allowed: {
|
|
685
|
-
cursor: "not-allowed"
|
|
686
|
-
},
|
|
687
|
-
collapse: {
|
|
688
|
-
display: "flex",
|
|
689
|
-
justifyContent: "space-between",
|
|
690
|
-
cursor: "pointer"
|
|
691
|
-
},
|
|
692
|
-
collapse_label: {
|
|
693
|
-
fontWeight: "bold",
|
|
694
|
-
marginTop: 7
|
|
695
|
-
}
|
|
696
|
-
}, _defineProperty$1(_style, "collapse_label", {
|
|
697
|
-
fontWeight: "bold",
|
|
698
|
-
marginTop: 7
|
|
699
|
-
}), _defineProperty$1(_style, "collapse_error", {
|
|
700
|
-
color: '#dc3545'
|
|
701
|
-
}), _defineProperty$1(_style, "datepicker", {
|
|
702
|
-
"& input": {
|
|
703
|
-
borderRadius: "4px"
|
|
704
|
-
}
|
|
705
|
-
}), _defineProperty$1(_style, "code", {}), _defineProperty$1(_style, "input__boolean__on", {
|
|
706
|
-
color: "MediumSeaGreen"
|
|
707
|
-
}), _defineProperty$1(_style, "input__boolean__off", {
|
|
708
|
-
color: "tomato"
|
|
709
|
-
}), _defineProperty$1(_style, "input__invalid", {
|
|
710
|
-
borderColor: '#dc3545 !important'
|
|
711
|
-
}), _defineProperty$1(_style, "feedback", {
|
|
712
|
-
width: "100%",
|
|
713
|
-
marginTop: ".25rem",
|
|
714
|
-
fontSize: "80%"
|
|
715
|
-
}), _defineProperty$1(_style, "display__none", {
|
|
716
|
-
display: "none"
|
|
717
|
-
}), _defineProperty$1(_style, "collapse__inline", {
|
|
718
|
-
"& .form-group+.form-group": {
|
|
719
|
-
marginLeft: '20px'
|
|
720
|
-
}
|
|
721
|
-
}), _defineProperty$1(_style, "nestedform__border", {
|
|
722
|
-
borderLeft: '2px solid lightGray',
|
|
723
|
-
paddingLeft: '0.5rem',
|
|
724
|
-
marginLeft: '0.5rem',
|
|
725
|
-
marginBottom: '.5rem',
|
|
726
|
-
paddingBottom: '1rem',
|
|
727
|
-
marginRight: '.5rem',
|
|
728
|
-
paddingRight: '2.5rem'
|
|
729
|
-
}), _defineProperty$1(_style, "border__error", {
|
|
730
|
-
borderColor: "#dc3545"
|
|
731
|
-
}), _defineProperty$1(_style, "btn_for_descriptionToolbar", {
|
|
732
|
-
textAlign: "left",
|
|
733
|
-
cursor: "pointer",
|
|
734
|
-
height: "22px",
|
|
735
|
-
padding: "4px",
|
|
736
|
-
border: "none",
|
|
737
|
-
background: "none",
|
|
738
|
-
color: "#242729",
|
|
739
|
-
marginRight: "5px",
|
|
740
|
-
marginLeft: "5px"
|
|
741
|
-
}), _defineProperty$1(_style, "content_switch_button_on", {
|
|
742
|
-
width: "35px",
|
|
743
|
-
height: "22px",
|
|
744
|
-
borderRadius: "20px",
|
|
745
|
-
display: "flex",
|
|
746
|
-
marginTop: "10px",
|
|
747
|
-
backgroundColor: "green",
|
|
748
|
-
border: "1px solid green",
|
|
749
|
-
justifyContent: "flex-end"
|
|
750
|
-
}), _defineProperty$1(_style, "content_switch_button_off", {
|
|
751
|
-
width: "35px",
|
|
752
|
-
height: "22px",
|
|
753
|
-
borderRadius: "20px",
|
|
754
|
-
display: "flex",
|
|
755
|
-
marginTop: "10px",
|
|
756
|
-
backgroundColor: "#dc3545",
|
|
757
|
-
border: "1px solid #dc3545",
|
|
758
|
-
justifyContent: "flex-start"
|
|
759
|
-
}), _defineProperty$1(_style, "content_switch_button_null", {
|
|
760
|
-
width: "35px",
|
|
761
|
-
height: "22px",
|
|
762
|
-
borderRadius: "20px",
|
|
763
|
-
display: "flex",
|
|
764
|
-
marginTop: "10px",
|
|
765
|
-
backgroundColor: "#fff",
|
|
766
|
-
border: "1px solid #dfdfdf",
|
|
767
|
-
justifyContent: "flex-start"
|
|
768
|
-
}), _defineProperty$1(_style, "switch_button_on", (_switch_button_on = {
|
|
769
|
-
backgroundColor: "#fff",
|
|
770
|
-
borderRadius: "20px",
|
|
771
|
-
cursor: "pointer",
|
|
772
|
-
width: "20px",
|
|
773
|
-
height: "20px"
|
|
774
|
-
}, _defineProperty$1(_switch_button_on, "backgroundColor", "#fff"), _defineProperty$1(_switch_button_on, "borderRadius", "20px"), _switch_button_on)), _defineProperty$1(_style, "switch_button_off", {
|
|
775
|
-
backgroundColor: "#fff",
|
|
776
|
-
borderRadius: "20px",
|
|
777
|
-
cursor: "pointer",
|
|
778
|
-
width: "20px",
|
|
779
|
-
height: "20px",
|
|
780
|
-
border: "1px solid #dfdfdf",
|
|
781
|
-
boxShadow: "1px 0px 5px 0px rgba(0, 0, 0, 0.3)"
|
|
782
|
-
}), _defineProperty$1(_style, "switch_button_null", {
|
|
783
|
-
backgroundColor: "#fff",
|
|
784
|
-
borderRadius: "20px",
|
|
785
|
-
cursor: "pointer",
|
|
786
|
-
width: "22px",
|
|
787
|
-
height: "22px",
|
|
788
|
-
marginTop: "-1px",
|
|
789
|
-
marginLeft: "-1px",
|
|
790
|
-
border: "1px solid #dfdfdf",
|
|
791
|
-
boxShadow: "1px 0px 5px 0px rgba(0, 0, 0, 0.3)"
|
|
792
|
-
}), _style);
|
|
793
|
-
|
|
794
|
-
var useCustomStyle = function useCustomStyle() {
|
|
795
|
-
var overrideStyle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
796
|
-
var useStyle = createUseStyles(_objectSpread2$1(_objectSpread2$1({}, style), overrideStyle));
|
|
797
|
-
var classes = useStyle();
|
|
798
|
-
return classes;
|
|
799
|
-
};
|
|
800
|
-
|
|
801
536
|
var BooleanInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
802
537
|
var _classNames;
|
|
803
538
|
|
|
804
539
|
var onChange = _ref.onChange,
|
|
805
540
|
value = _ref.value,
|
|
806
541
|
readOnly = _ref.readOnly;
|
|
807
|
-
var classes = useCustomStyle();
|
|
808
542
|
|
|
809
543
|
var handleClick = function handleClick(value) {
|
|
810
544
|
if (!readOnly) {
|
|
@@ -813,28 +547,28 @@ var BooleanInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
813
547
|
};
|
|
814
548
|
|
|
815
549
|
return /*#__PURE__*/React.createElement("div", {
|
|
816
|
-
className: classNames((_classNames = {}, _defineProperty$1(_classNames,
|
|
550
|
+
className: classNames((_classNames = {}, _defineProperty$1(_classNames, 'mrf-cursor_pointer', !readOnly), _defineProperty$1(_classNames, 'mrf-cursor_not_allowed', readOnly), _classNames))
|
|
817
551
|
}, !!value && /*#__PURE__*/React.createElement("div", {
|
|
818
|
-
className: classNames(
|
|
552
|
+
className: classNames('mrf-content_switch_button_on'),
|
|
819
553
|
onClick: function onClick() {
|
|
820
554
|
return handleClick(false);
|
|
821
555
|
}
|
|
822
556
|
}, /*#__PURE__*/React.createElement("div", {
|
|
823
|
-
className: classNames(
|
|
557
|
+
className: classNames('mrf-switch_button_on')
|
|
824
558
|
})), !value && value !== null && /*#__PURE__*/React.createElement("div", {
|
|
825
|
-
className: classNames(
|
|
559
|
+
className: classNames('mrf-content_switch_button_off'),
|
|
826
560
|
onClick: function onClick() {
|
|
827
561
|
return handleClick(true);
|
|
828
562
|
}
|
|
829
563
|
}, /*#__PURE__*/React.createElement("div", {
|
|
830
|
-
className: classNames(
|
|
564
|
+
className: classNames('mrf-switch_button_off')
|
|
831
565
|
})), value === null && /*#__PURE__*/React.createElement("div", {
|
|
832
|
-
className: classNames(
|
|
566
|
+
className: classNames('mrf-content_switch_button_null'),
|
|
833
567
|
onClick: function onClick() {
|
|
834
568
|
return handleClick(true);
|
|
835
569
|
}
|
|
836
570
|
}, /*#__PURE__*/React.createElement("div", {
|
|
837
|
-
className: classNames(
|
|
571
|
+
className: classNames('mrf-switch_button_null')
|
|
838
572
|
})));
|
|
839
573
|
});
|
|
840
574
|
|
|
@@ -846,30 +580,28 @@ var Collapse = function Collapse(props) {
|
|
|
846
580
|
collapsed = _useState2[0],
|
|
847
581
|
setCollapsed = _useState2[1];
|
|
848
582
|
|
|
849
|
-
var classes = useCustomStyle();
|
|
850
|
-
|
|
851
583
|
var toggle = function toggle(e) {
|
|
852
584
|
if (e && e.preventDefault) e.stopPropagation();
|
|
853
585
|
setCollapsed(!collapsed);
|
|
854
586
|
};
|
|
855
587
|
|
|
856
588
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("hr", {
|
|
857
|
-
className: classNames(_defineProperty$1({},
|
|
589
|
+
className: classNames(_defineProperty$1({}, 'mrf-collapse_error', props.errored))
|
|
858
590
|
}), /*#__PURE__*/React.createElement("div", {
|
|
859
|
-
className: "
|
|
591
|
+
className: "mrf-cursor_pointer mrf-flex mrf-jc_between",
|
|
860
592
|
onClick: toggle
|
|
861
593
|
}, /*#__PURE__*/React.createElement("span", {
|
|
862
|
-
className: classNames(
|
|
594
|
+
className: classNames('mrf-collapse_label', _defineProperty$1({}, 'mrf-collapse_error', props.errored))
|
|
863
595
|
}, props.label), /*#__PURE__*/React.createElement("button", {
|
|
864
596
|
type: "button",
|
|
865
|
-
className: classNames(
|
|
597
|
+
className: classNames('mrf-btn', 'mrf-btn_sm', 'mrf-ml_5', _defineProperty$1({}, 'mrf-collapse_error', props.errored)),
|
|
866
598
|
onClick: toggle
|
|
867
599
|
}, !!collapsed && /*#__PURE__*/React.createElement(Eye, {
|
|
868
600
|
size: 16
|
|
869
601
|
}), !collapsed && /*#__PURE__*/React.createElement(EyeOff, {
|
|
870
602
|
size: 16
|
|
871
603
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
872
|
-
className: classNames(
|
|
604
|
+
className: classNames('mrf-ml_10', (_classNames4 = {}, _defineProperty$1(_classNames4, 'mrf-display__none', !!collapsed), _defineProperty$1(_classNames4, 'mrf-flex', !!props.inline), _defineProperty$1(_classNames4, 'mrf-collapse__inline', !!props.inline), _classNames4))
|
|
873
605
|
}, props.children), props.lineEnd && /*#__PURE__*/React.createElement("hr", null));
|
|
874
606
|
};
|
|
875
607
|
|
|
@@ -940,6 +672,25 @@ var arrayFlatten = function arrayFlatten(array) {
|
|
|
940
672
|
var isDefined = function isDefined(value) {
|
|
941
673
|
return value !== null && value !== undefined;
|
|
942
674
|
};
|
|
675
|
+
var useHashEffect = function useHashEffect(func, deps) {
|
|
676
|
+
var isFirst = useRef(true);
|
|
677
|
+
var prevDeps = useRef(deps);
|
|
678
|
+
useEffect(function () {
|
|
679
|
+
if (isFirst.current) {
|
|
680
|
+
func();
|
|
681
|
+
isFirst.current = false;
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
var depsHash = hash$1(deps);
|
|
686
|
+
var prevDepsHash = hash$1(prevDeps.current);
|
|
687
|
+
|
|
688
|
+
if (depsHash !== prevDepsHash) {
|
|
689
|
+
prevDeps.current = deps;
|
|
690
|
+
func();
|
|
691
|
+
}
|
|
692
|
+
}, [deps]);
|
|
693
|
+
};
|
|
943
694
|
|
|
944
695
|
var valueToSelectOption = function valueToSelectOption(value) {
|
|
945
696
|
var possibleValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
@@ -977,7 +728,6 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function (props, _) {
|
|
|
977
728
|
var _useFormContext = useFormContext(),
|
|
978
729
|
getValues = _useFormContext.getValues;
|
|
979
730
|
|
|
980
|
-
var classes = useCustomStyle();
|
|
981
731
|
var possibleValues = (props.possibleValues || []).map(function (v) {
|
|
982
732
|
return props.transformer ? typeof props.transformer === 'function' ? props.transformer(v) : {
|
|
983
733
|
label: v[props.transformer.label],
|
|
@@ -1103,7 +853,7 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function (props, _) {
|
|
|
1103
853
|
key: idx,
|
|
1104
854
|
type: "button",
|
|
1105
855
|
disabled: props.disabled,
|
|
1106
|
-
className: classNames(props.className,
|
|
856
|
+
className: classNames(props.className, 'mrf-btn mrf-btn_grey mrf-ml_5', {
|
|
1107
857
|
active: active
|
|
1108
858
|
}),
|
|
1109
859
|
onClick: function onClick() {
|
|
@@ -1250,13 +1000,12 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1250
1000
|
onChange(newState);
|
|
1251
1001
|
};
|
|
1252
1002
|
|
|
1253
|
-
var classes = useCustomStyle();
|
|
1254
1003
|
return /*#__PURE__*/React.createElement("div", {
|
|
1255
1004
|
className: props.className
|
|
1256
1005
|
}, Object.keys(internalState || {}).length === 0 && /*#__PURE__*/React.createElement("button", {
|
|
1257
1006
|
disabled: props.disabled,
|
|
1258
1007
|
type: "button",
|
|
1259
|
-
className:
|
|
1008
|
+
className: "mrf-flex mrf-btn mrf-btn_blue mrf-btn_sm",
|
|
1260
1009
|
onClick: addFirst
|
|
1261
1010
|
}, /*#__PURE__*/React.createElement(PlusCircle, null)), Object.entries(internalState || {}).map(function (_ref9, idx) {
|
|
1262
1011
|
var _ref10 = _slicedToArray(_ref9, 2),
|
|
@@ -1266,12 +1015,12 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1266
1015
|
value = _ref10$.value;
|
|
1267
1016
|
|
|
1268
1017
|
return /*#__PURE__*/React.createElement("div", {
|
|
1269
|
-
className:
|
|
1018
|
+
className: "mrf-flex mrf-mt_5",
|
|
1270
1019
|
key: idx
|
|
1271
1020
|
}, /*#__PURE__*/React.createElement("input", {
|
|
1272
1021
|
disabled: props.disabled,
|
|
1273
1022
|
type: "text",
|
|
1274
|
-
className:
|
|
1023
|
+
className: "mrf-w_50 mrf-input",
|
|
1275
1024
|
placeholder: props.placeholderKey,
|
|
1276
1025
|
value: key,
|
|
1277
1026
|
onChange: function onChange(e) {
|
|
@@ -1280,7 +1029,7 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1280
1029
|
}), /*#__PURE__*/React.createElement("input", {
|
|
1281
1030
|
disabled: props.disabled,
|
|
1282
1031
|
type: "text",
|
|
1283
|
-
className:
|
|
1032
|
+
className: "mrf-w_50 mrf-input",
|
|
1284
1033
|
placeholder: props.placeholderValue,
|
|
1285
1034
|
value: value,
|
|
1286
1035
|
onChange: function onChange(e) {
|
|
@@ -1289,14 +1038,14 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1289
1038
|
}), /*#__PURE__*/React.createElement("button", {
|
|
1290
1039
|
disabled: props.disabled,
|
|
1291
1040
|
type: "button",
|
|
1292
|
-
className:
|
|
1041
|
+
className: "mrf-flex mrf-btn mrf-btn_red mrf-btn_sm mrf-ml_10",
|
|
1293
1042
|
onClick: function onClick() {
|
|
1294
1043
|
return remove(id);
|
|
1295
1044
|
}
|
|
1296
1045
|
}, /*#__PURE__*/React.createElement(MinusCircle, null)), idx === Object.keys(internalState).length - 1 && /*#__PURE__*/React.createElement("button", {
|
|
1297
1046
|
disabled: props.disabled,
|
|
1298
1047
|
type: "button",
|
|
1299
|
-
className:
|
|
1048
|
+
className: "mrf-flex mrf-btn mrf-btn_blue mrf-btn_sm mrf-ml_5",
|
|
1300
1049
|
onClick: addNext
|
|
1301
1050
|
}, /*#__PURE__*/React.createElement(PlusCircle, null)));
|
|
1302
1051
|
}));
|
|
@@ -28693,7 +28442,7 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28693
28442
|
}];
|
|
28694
28443
|
|
|
28695
28444
|
var showPreview = function showPreview() {
|
|
28696
|
-
var parent = _toConsumableArray$1(document.getElementsByClassName('preview'));
|
|
28445
|
+
var parent = _toConsumableArray$1(document.getElementsByClassName('mrf-preview'));
|
|
28697
28446
|
|
|
28698
28447
|
if (parent.length > 0) _toConsumableArray$1(parent[0].querySelectorAll('pre code')).forEach(function (block) {
|
|
28699
28448
|
return hljs.highlightElement(block);
|
|
@@ -28701,7 +28450,6 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28701
28450
|
};
|
|
28702
28451
|
|
|
28703
28452
|
var injectButtons = function injectButtons() {
|
|
28704
|
-
var classes = useCustomStyle();
|
|
28705
28453
|
return commands.map(function (command, idx) {
|
|
28706
28454
|
if (command.component) {
|
|
28707
28455
|
return command.component(idx);
|
|
@@ -28709,7 +28457,7 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28709
28457
|
|
|
28710
28458
|
return /*#__PURE__*/React.createElement("button", {
|
|
28711
28459
|
type: "button",
|
|
28712
|
-
className: classNames(
|
|
28460
|
+
className: classNames('mrf-btn_for_descriptionToolbar'),
|
|
28713
28461
|
"aria-label": command.name,
|
|
28714
28462
|
title: command.name,
|
|
28715
28463
|
key: "toolbar-btn-".concat(idx),
|
|
@@ -28737,7 +28485,6 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28737
28485
|
});
|
|
28738
28486
|
};
|
|
28739
28487
|
|
|
28740
|
-
var classes = useCustomStyle();
|
|
28741
28488
|
return /*#__PURE__*/React.createElement("div", {
|
|
28742
28489
|
className: classNames(props.className)
|
|
28743
28490
|
}, !props.readOnly && /*#__PURE__*/React.createElement("div", {
|
|
@@ -28746,7 +28493,7 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28746
28493
|
}
|
|
28747
28494
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
|
|
28748
28495
|
type: "button",
|
|
28749
|
-
className:
|
|
28496
|
+
className: "mrf-btn mrf-btn_sm",
|
|
28750
28497
|
style: {
|
|
28751
28498
|
color: !preview ? '#7f96af' : 'white',
|
|
28752
28499
|
backgroundColor: preview ? '#7f96af' : 'white'
|
|
@@ -28756,7 +28503,7 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28756
28503
|
}
|
|
28757
28504
|
}, "Write"), /*#__PURE__*/React.createElement("button", {
|
|
28758
28505
|
type: "button",
|
|
28759
|
-
className:
|
|
28506
|
+
className: "mrf-btn mrf-btn_sm mrf-ml_5",
|
|
28760
28507
|
style: {
|
|
28761
28508
|
color: preview ? '#7f96af' : 'white',
|
|
28762
28509
|
backgroundColor: preview ? 'white' : '#7f96af'
|
|
@@ -28765,13 +28512,13 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28765
28512
|
return setPreview(true);
|
|
28766
28513
|
}
|
|
28767
28514
|
}, "Preview"))), /*#__PURE__*/React.createElement("div", {
|
|
28768
|
-
className:
|
|
28515
|
+
className: "mrf-flex mrf-flexWrap"
|
|
28769
28516
|
}, injectButtons())), !preview && /*#__PURE__*/React.createElement(CodeInput, _extends({}, props, {
|
|
28770
28517
|
setRef: function setRef(e) {
|
|
28771
28518
|
return ref.current = e;
|
|
28772
28519
|
}
|
|
28773
28520
|
})), preview && /*#__PURE__*/React.createElement("div", {
|
|
28774
|
-
className: "preview",
|
|
28521
|
+
className: "mrf-preview",
|
|
28775
28522
|
dangerouslySetInnerHTML: {
|
|
28776
28523
|
__html: converter.makeHtml(props.value)
|
|
28777
28524
|
}
|
|
@@ -29055,9 +28802,9 @@ var usePrevious = function usePrevious(value) {
|
|
|
29055
28802
|
};
|
|
29056
28803
|
|
|
29057
28804
|
var BasicWrapper = function BasicWrapper(_ref) {
|
|
29058
|
-
var entry = _ref.entry
|
|
29059
|
-
|
|
29060
|
-
label = _ref.label,
|
|
28805
|
+
var entry = _ref.entry;
|
|
28806
|
+
_ref.className;
|
|
28807
|
+
var label = _ref.label,
|
|
29061
28808
|
help = _ref.help,
|
|
29062
28809
|
children = _ref.children,
|
|
29063
28810
|
render = _ref.render;
|
|
@@ -29066,7 +28813,6 @@ var BasicWrapper = function BasicWrapper(_ref) {
|
|
|
29066
28813
|
return children;
|
|
29067
28814
|
}
|
|
29068
28815
|
|
|
29069
|
-
var classes = useCustomStyle();
|
|
29070
28816
|
var id = v4();
|
|
29071
28817
|
|
|
29072
28818
|
var _useFormContext = useFormContext(),
|
|
@@ -29094,19 +28840,19 @@ var BasicWrapper = function BasicWrapper(_ref) {
|
|
|
29094
28840
|
}
|
|
29095
28841
|
|
|
29096
28842
|
return /*#__PURE__*/React.createElement("div", {
|
|
29097
|
-
className: "
|
|
28843
|
+
className: "mrf-mt_10",
|
|
29098
28844
|
style: {
|
|
29099
28845
|
position: 'relative'
|
|
29100
28846
|
}
|
|
29101
28847
|
}, label && /*#__PURE__*/React.createElement("label", {
|
|
29102
|
-
className: "
|
|
28848
|
+
className: "mrf-flex mrf-ai_center mrf-mb_5",
|
|
29103
28849
|
htmlFor: entry
|
|
29104
28850
|
}, /*#__PURE__*/React.createElement("span", null, label), help && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ReactToolTip, {
|
|
29105
28851
|
html: true,
|
|
29106
28852
|
place: 'bottom',
|
|
29107
28853
|
id: id
|
|
29108
28854
|
}), /*#__PURE__*/React.createElement("span", {
|
|
29109
|
-
className: "
|
|
28855
|
+
className: "mrf-flex mrf-ai_center",
|
|
29110
28856
|
"data-html": true,
|
|
29111
28857
|
"data-tip": help,
|
|
29112
28858
|
"data-for": id
|
|
@@ -29118,7 +28864,7 @@ var BasicWrapper = function BasicWrapper(_ref) {
|
|
|
29118
28864
|
cursor: 'help'
|
|
29119
28865
|
}
|
|
29120
28866
|
})))), children, error && /*#__PURE__*/React.createElement("div", {
|
|
29121
|
-
className: classNames(
|
|
28867
|
+
className: classNames('mrf-feedback', _defineProperty$1({}, 'mrf-txt_red', errorDisplayed))
|
|
29122
28868
|
}, error.message));
|
|
29123
28869
|
};
|
|
29124
28870
|
|
|
@@ -29262,15 +29008,12 @@ var Watcher = function Watcher(_ref6) {
|
|
|
29262
29008
|
schema = _ref6.schema,
|
|
29263
29009
|
onSubmit = _ref6.onSubmit,
|
|
29264
29010
|
handleSubmit = _ref6.handleSubmit;
|
|
29265
|
-
_ref6.getValues;
|
|
29266
|
-
_ref6.watch;
|
|
29267
29011
|
var data = useWatch({
|
|
29268
29012
|
control: control
|
|
29269
29013
|
});
|
|
29270
|
-
|
|
29271
|
-
useEffect(function () {
|
|
29014
|
+
useHashEffect(function () {
|
|
29272
29015
|
if (!!options.autosubmit) {
|
|
29273
|
-
|
|
29016
|
+
handleSubmit(function () {
|
|
29274
29017
|
onSubmit(cleanOutputArray(data, schema));
|
|
29275
29018
|
})();
|
|
29276
29019
|
}
|
|
@@ -29297,13 +29040,12 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29297
29040
|
onSubmit = _ref7.onSubmit,
|
|
29298
29041
|
_ref7$onError = _ref7.onError,
|
|
29299
29042
|
onError = _ref7$onError === void 0 ? function () {} : _ref7$onError,
|
|
29300
|
-
footer = _ref7.footer
|
|
29301
|
-
_ref7
|
|
29302
|
-
|
|
29303
|
-
className = _ref7.className,
|
|
29043
|
+
footer = _ref7.footer;
|
|
29044
|
+
_ref7.style;
|
|
29045
|
+
var className = _ref7.className,
|
|
29304
29046
|
_ref7$options = _ref7.options,
|
|
29305
29047
|
options = _ref7$options === void 0 ? {} : _ref7$options;
|
|
29306
|
-
|
|
29048
|
+
_ref7.nostyle;
|
|
29307
29049
|
var formFlow = flow || Object.keys(schema);
|
|
29308
29050
|
|
|
29309
29051
|
var maybeCustomHttpClient = function maybeCustomHttpClient(url, method) {
|
|
@@ -29360,12 +29102,8 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29360
29102
|
trigger = methods.trigger,
|
|
29361
29103
|
getValues = methods.getValues,
|
|
29362
29104
|
watch = methods.watch;
|
|
29363
|
-
|
|
29364
|
-
|
|
29365
|
-
useEffect(function () {
|
|
29366
|
-
if (prev && prevSchema && !deepEqual(value, prev) || !deepEqual(schema, prevSchema)) {
|
|
29367
|
-
_reset(_objectSpread2$1({}, cleanInputArray(value, defaultValues, flow, schema)));
|
|
29368
|
-
}
|
|
29105
|
+
useHashEffect(function () {
|
|
29106
|
+
_reset(_objectSpread2$1({}, cleanInputArray(value, defaultValues, flow, schema)));
|
|
29369
29107
|
}, [value, schema]);
|
|
29370
29108
|
|
|
29371
29109
|
var functionalProperty = function functionalProperty(entry, prop) {
|
|
@@ -29403,7 +29141,7 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29403
29141
|
handleSubmit: _handleSubmit,
|
|
29404
29142
|
watch: methods.watch
|
|
29405
29143
|
}), /*#__PURE__*/React.createElement("form", {
|
|
29406
|
-
className: className || "
|
|
29144
|
+
className: className || "mrf-pr_15 mrf-w_100",
|
|
29407
29145
|
onSubmit: _handleSubmit(function (data) {
|
|
29408
29146
|
var clean = cleanOutputArray(data, schema);
|
|
29409
29147
|
onSubmit(clean);
|
|
@@ -29470,8 +29208,6 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29470
29208
|
var Footer = function Footer(props) {
|
|
29471
29209
|
var _props$actions, _props$actions$submit, _props$actions2, _props$actions2$submi, _props$actions3, _props$actions3$cance, _props$actions5, _props$actions5$cance, _props$actions6, _props$actions6$reset, _props$actions7, _props$actions7$reset, _props$actions8, _props$actions8$submi;
|
|
29472
29210
|
|
|
29473
|
-
var classes = useCustomStyle();
|
|
29474
|
-
|
|
29475
29211
|
if (props.render) {
|
|
29476
29212
|
return props.render({
|
|
29477
29213
|
reset: props.reset,
|
|
@@ -29481,9 +29217,9 @@ var Footer = function Footer(props) {
|
|
|
29481
29217
|
|
|
29482
29218
|
var isSubmitDisplayed = ((_props$actions = props.actions) === null || _props$actions === void 0 ? void 0 : (_props$actions$submit = _props$actions.submit) === null || _props$actions$submit === void 0 ? void 0 : _props$actions$submit.display) === undefined ? true : !!((_props$actions2 = props.actions) !== null && _props$actions2 !== void 0 && (_props$actions2$submi = _props$actions2.submit) !== null && _props$actions2$submi !== void 0 && _props$actions2$submi.display);
|
|
29483
29219
|
return /*#__PURE__*/React.createElement("div", {
|
|
29484
|
-
className: "
|
|
29220
|
+
className: "mrf-flex mrf-jc_end mrf-mt_5"
|
|
29485
29221
|
}, ((_props$actions3 = props.actions) === null || _props$actions3 === void 0 ? void 0 : (_props$actions3$cance = _props$actions3.cancel) === null || _props$actions3$cance === void 0 ? void 0 : _props$actions3$cance.display) && /*#__PURE__*/React.createElement("button", {
|
|
29486
|
-
className: "
|
|
29222
|
+
className: "mrf-btn mrf-btn_red",
|
|
29487
29223
|
type: "button",
|
|
29488
29224
|
onClick: function onClick() {
|
|
29489
29225
|
var _props$actions4;
|
|
@@ -29491,11 +29227,11 @@ var Footer = function Footer(props) {
|
|
|
29491
29227
|
return (_props$actions4 = props.actions) === null || _props$actions4 === void 0 ? void 0 : _props$actions4.cancel.action();
|
|
29492
29228
|
}
|
|
29493
29229
|
}, ((_props$actions5 = props.actions) === null || _props$actions5 === void 0 ? void 0 : (_props$actions5$cance = _props$actions5.cancel) === null || _props$actions5$cance === void 0 ? void 0 : _props$actions5$cance.label) || 'Cancel'), ((_props$actions6 = props.actions) === null || _props$actions6 === void 0 ? void 0 : (_props$actions6$reset = _props$actions6.reset) === null || _props$actions6$reset === void 0 ? void 0 : _props$actions6$reset.display) && /*#__PURE__*/React.createElement("button", {
|
|
29494
|
-
className: "
|
|
29230
|
+
className: "mrf-btn mrf-btn_red",
|
|
29495
29231
|
type: "button",
|
|
29496
29232
|
onClick: props.reset
|
|
29497
29233
|
}, ((_props$actions7 = props.actions) === null || _props$actions7 === void 0 ? void 0 : (_props$actions7$reset = _props$actions7.reset) === null || _props$actions7$reset === void 0 ? void 0 : _props$actions7$reset.label) || 'Reset'), isSubmitDisplayed && /*#__PURE__*/React.createElement("button", {
|
|
29498
|
-
className: "
|
|
29234
|
+
className: "mrf-btn mrf-btn_green mrf-ml_10",
|
|
29499
29235
|
type: "submit"
|
|
29500
29236
|
}, ((_props$actions8 = props.actions) === null || _props$actions8 === void 0 ? void 0 : (_props$actions8$submi = _props$actions8.submit) === null || _props$actions8$submi === void 0 ? void 0 : _props$actions8$submi.label) || 'Save'));
|
|
29501
29237
|
};
|
|
@@ -29512,7 +29248,6 @@ var Step = function Step(_ref8) {
|
|
|
29512
29248
|
functionalProperty = _ref8.functionalProperty,
|
|
29513
29249
|
parent = _ref8.parent,
|
|
29514
29250
|
onAfterChange = _ref8.onAfterChange;
|
|
29515
|
-
var classes = useCustomStyle();
|
|
29516
29251
|
|
|
29517
29252
|
var _useFormContext2 = useFormContext(),
|
|
29518
29253
|
_useFormContext2$form = _useFormContext2.formState,
|
|
@@ -29670,7 +29405,7 @@ var Step = function Step(_ref8) {
|
|
|
29670
29405
|
errorDisplayed: errorDisplayed
|
|
29671
29406
|
}, /*#__PURE__*/React.createElement("textarea", {
|
|
29672
29407
|
type: "text",
|
|
29673
|
-
className: classNames(
|
|
29408
|
+
className: classNames('mrf-input', step.className, _defineProperty$1({}, 'mrf-mrf-input__invalid', errorDisplayed))
|
|
29674
29409
|
}));
|
|
29675
29410
|
|
|
29676
29411
|
case format.code:
|
|
@@ -29682,7 +29417,7 @@ var Step = function Step(_ref8) {
|
|
|
29682
29417
|
entry: entry,
|
|
29683
29418
|
errorDisplayed: errorDisplayed
|
|
29684
29419
|
}, /*#__PURE__*/React.createElement(Component, {
|
|
29685
|
-
className: classNames(_defineProperty$1({},
|
|
29420
|
+
className: classNames(step.className, _defineProperty$1({}, 'mrf-input__invalid', errorDisplayed))
|
|
29686
29421
|
}));
|
|
29687
29422
|
|
|
29688
29423
|
case format.markdown:
|
|
@@ -29692,7 +29427,7 @@ var Step = function Step(_ref8) {
|
|
|
29692
29427
|
entry: entry,
|
|
29693
29428
|
errorDisplayed: errorDisplayed
|
|
29694
29429
|
}, /*#__PURE__*/React.createElement(MarkdownInput, {
|
|
29695
|
-
className: classNames(_defineProperty$1({},
|
|
29430
|
+
className: classNames(step.className, _defineProperty$1({}, 'mrf-input__invalid', errorDisplayed))
|
|
29696
29431
|
}));
|
|
29697
29432
|
|
|
29698
29433
|
case format.buttonsSelect:
|
|
@@ -29704,7 +29439,7 @@ var Step = function Step(_ref8) {
|
|
|
29704
29439
|
entry: entry,
|
|
29705
29440
|
errorDisplayed: errorDisplayed
|
|
29706
29441
|
}, /*#__PURE__*/React.createElement(SelectInput, _extends({
|
|
29707
|
-
className: classNames(
|
|
29442
|
+
className: classNames('mrf-flex_grow_1', step.className, _defineProperty$1({}, 'mrf-input__invalid', errorDisplayed)),
|
|
29708
29443
|
disabled: functionalProperty(entry, step.disabled)
|
|
29709
29444
|
}, step.props, {
|
|
29710
29445
|
possibleValues: step.options,
|
|
@@ -29725,7 +29460,7 @@ var Step = function Step(_ref8) {
|
|
|
29725
29460
|
errorDisplayed: errorDisplayed
|
|
29726
29461
|
}, /*#__PURE__*/React.createElement("input", {
|
|
29727
29462
|
type: step.format || 'text',
|
|
29728
|
-
className: classNames(
|
|
29463
|
+
className: classNames('mrf-input', step.className, _defineProperty$1({}, 'mrf-input__invalid', errorDisplayed))
|
|
29729
29464
|
}));
|
|
29730
29465
|
}
|
|
29731
29466
|
|
|
@@ -29739,7 +29474,7 @@ var Step = function Step(_ref8) {
|
|
|
29739
29474
|
entry: entry,
|
|
29740
29475
|
errorDisplayed: errorDisplayed
|
|
29741
29476
|
}, /*#__PURE__*/React.createElement(SelectInput, _extends({
|
|
29742
|
-
className: classNames(
|
|
29477
|
+
className: classNames('mrf-content', step.className, _defineProperty$1({}, 'mrf-input__invalid', errorDisplayed))
|
|
29743
29478
|
}, step.props, {
|
|
29744
29479
|
possibleValues: step.options,
|
|
29745
29480
|
httpClient: httpClient,
|
|
@@ -29759,7 +29494,7 @@ var Step = function Step(_ref8) {
|
|
|
29759
29494
|
errorDisplayed: errorDisplayed
|
|
29760
29495
|
}, /*#__PURE__*/React.createElement("input", {
|
|
29761
29496
|
type: step.format || 'number',
|
|
29762
|
-
className: classNames(
|
|
29497
|
+
className: classNames('mrf-input', step.className, _defineProperty$1({}, 'mrf-input__invalid', errorDisplayed))
|
|
29763
29498
|
}));
|
|
29764
29499
|
}
|
|
29765
29500
|
|
|
@@ -29769,7 +29504,7 @@ var Step = function Step(_ref8) {
|
|
|
29769
29504
|
entry: entry,
|
|
29770
29505
|
errorDisplayed: errorDisplayed
|
|
29771
29506
|
}, /*#__PURE__*/React.createElement(BooleanInput, {
|
|
29772
|
-
className: classNames(_defineProperty$1({},
|
|
29507
|
+
className: classNames(step.className, _defineProperty$1({}, 'mrf-input__invalid', errorDisplayed))
|
|
29773
29508
|
}));
|
|
29774
29509
|
|
|
29775
29510
|
case type.object:
|
|
@@ -29782,7 +29517,7 @@ var Step = function Step(_ref8) {
|
|
|
29782
29517
|
entry: entry,
|
|
29783
29518
|
errorDisplayed: errorDisplayed
|
|
29784
29519
|
}, /*#__PURE__*/React.createElement(SelectInput, _extends({
|
|
29785
|
-
className: classNames(
|
|
29520
|
+
className: classNames('mrf-flex_grow_1', step.className, _defineProperty$1({}, 'mrf-input__invalid', errorDisplayed))
|
|
29786
29521
|
}, step.props, {
|
|
29787
29522
|
possibleValues: step.options,
|
|
29788
29523
|
httpClient: httpClient,
|
|
@@ -29835,7 +29570,7 @@ var Step = function Step(_ref8) {
|
|
|
29835
29570
|
errorDisplayed: errorDisplayed,
|
|
29836
29571
|
component: function component(field, props) {
|
|
29837
29572
|
return /*#__PURE__*/React.createElement(CodeInput, _extends({}, props, {
|
|
29838
|
-
className: classNames(_defineProperty$1({},
|
|
29573
|
+
className: classNames(step.className, _defineProperty$1({}, 'mrf-input__invalid', error)),
|
|
29839
29574
|
onChange: function onChange(e) {
|
|
29840
29575
|
_readOnlyError("errorDisplayed");
|
|
29841
29576
|
var v;
|
|
@@ -29867,7 +29602,7 @@ var Step = function Step(_ref8) {
|
|
|
29867
29602
|
entry: entry,
|
|
29868
29603
|
errorDisplayed: errorDisplayed
|
|
29869
29604
|
}, /*#__PURE__*/React.createElement(ObjectInput, {
|
|
29870
|
-
className: classNames(_defineProperty$1({},
|
|
29605
|
+
className: classNames(step.className, _defineProperty$1({}, 'mrf-input__invalid', errorDisplayed))
|
|
29871
29606
|
}));
|
|
29872
29607
|
}
|
|
29873
29608
|
|
|
@@ -29878,7 +29613,7 @@ var Step = function Step(_ref8) {
|
|
|
29878
29613
|
entry: entry,
|
|
29879
29614
|
errorDisplayed: errorDisplayed
|
|
29880
29615
|
}, /*#__PURE__*/React.createElement(DatePicker, {
|
|
29881
|
-
className: classNames(
|
|
29616
|
+
className: classNames('mrf-datepicker', step.className, _defineProperty$1({}, 'mrf-input__invalid', errorDisplayed)),
|
|
29882
29617
|
formatStyle: "large"
|
|
29883
29618
|
}));
|
|
29884
29619
|
|
|
@@ -29915,24 +29650,24 @@ var Step = function Step(_ref8) {
|
|
|
29915
29650
|
|
|
29916
29651
|
var files = field.value || [];
|
|
29917
29652
|
return /*#__PURE__*/React.createElement("div", {
|
|
29918
|
-
className: classNames(
|
|
29653
|
+
className: classNames('mrf-flex', 'mrf-ai_center', step.className, _defineProperty$1({}, 'mrf-input__invalid', error))
|
|
29919
29654
|
}, /*#__PURE__*/React.createElement("input", {
|
|
29920
29655
|
ref: function ref(r) {
|
|
29921
29656
|
return setInput(r);
|
|
29922
29657
|
},
|
|
29923
29658
|
type: "file",
|
|
29924
29659
|
multiple: true,
|
|
29925
|
-
className:
|
|
29660
|
+
className: "mrf-d_none",
|
|
29926
29661
|
onChange: setFiles
|
|
29927
29662
|
}), /*#__PURE__*/React.createElement("button", {
|
|
29928
29663
|
type: "button",
|
|
29929
|
-
className: "
|
|
29664
|
+
className: "mrf-btn mrf-btn_sm mrf-flex mrf-ai_center",
|
|
29930
29665
|
disabled: uploading || functionalProperty(entry, step.disabled),
|
|
29931
29666
|
onClick: trigger
|
|
29932
29667
|
}, uploading && /*#__PURE__*/React.createElement(Loader, null), !uploading && /*#__PURE__*/React.createElement(Upload, null), /*#__PURE__*/React.createElement("span", {
|
|
29933
|
-
className: ""
|
|
29668
|
+
className: "mrf-ml_5"
|
|
29934
29669
|
}, "Select file(s)")), /*#__PURE__*/React.createElement("span", {
|
|
29935
|
-
className: ""
|
|
29670
|
+
className: "mrf-ml_5"
|
|
29936
29671
|
}, files.length <= 0 ? 'No files selected' : files.map(function (r) {
|
|
29937
29672
|
return r.name;
|
|
29938
29673
|
}).join(" , ")));
|
|
@@ -29954,7 +29689,7 @@ var Step = function Step(_ref8) {
|
|
|
29954
29689
|
entry: entry,
|
|
29955
29690
|
component: function component(field, props) {
|
|
29956
29691
|
return /*#__PURE__*/React.createElement(CodeInput, _extends({}, props, {
|
|
29957
|
-
className: classNames(_defineProperty$1({},
|
|
29692
|
+
className: classNames(_defineProperty$1({}, 'mrf-input__invalid', error)),
|
|
29958
29693
|
onChange: function onChange(v) {
|
|
29959
29694
|
field.onChange(v);
|
|
29960
29695
|
option(step.onChange).map(function (onChange) {
|
|
@@ -29980,7 +29715,6 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
29980
29715
|
step = _ref11.step,
|
|
29981
29716
|
component = _ref11.component,
|
|
29982
29717
|
disabled = _ref11.disabled;
|
|
29983
|
-
var classes = useCustomStyle();
|
|
29984
29718
|
|
|
29985
29719
|
var _useFormContext3 = useFormContext(),
|
|
29986
29720
|
getValues = _useFormContext3.getValues,
|
|
@@ -30013,7 +29747,7 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
30013
29747
|
return /*#__PURE__*/React.createElement("div", {
|
|
30014
29748
|
key: field.id
|
|
30015
29749
|
}, /*#__PURE__*/React.createElement("div", {
|
|
30016
|
-
className:
|
|
29750
|
+
className: "mrf-ai_center mrf-mt_5",
|
|
30017
29751
|
style: {
|
|
30018
29752
|
position: 'relative'
|
|
30019
29753
|
}
|
|
@@ -30032,7 +29766,7 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
30032
29766
|
top: '2px',
|
|
30033
29767
|
right: 0
|
|
30034
29768
|
},
|
|
30035
|
-
className:
|
|
29769
|
+
className: "mrf-btn mrf-btn_red mrf-btn_sm mrf-ml_5",
|
|
30036
29770
|
disabled: disabled,
|
|
30037
29771
|
onClick: function onClick() {
|
|
30038
29772
|
remove(idx);
|
|
@@ -30042,10 +29776,10 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
30042
29776
|
size: 16
|
|
30043
29777
|
}))));
|
|
30044
29778
|
}), /*#__PURE__*/React.createElement("div", {
|
|
30045
|
-
className:
|
|
29779
|
+
className: "mrf-flex mrf-jc_flex_end"
|
|
30046
29780
|
}, /*#__PURE__*/React.createElement("button", {
|
|
30047
29781
|
type: "button",
|
|
30048
|
-
className: classNames(
|
|
29782
|
+
className: classNames('mrf-btn', 'mrf-btn_blue', 'mrf-btn_sm', 'mrf-mt_5', _defineProperty$1({}, 'mrf-input__invalid', errorDisplayed)),
|
|
30049
29783
|
onClick: function onClick() {
|
|
30050
29784
|
var newValue = cleanInputArray({}, getValues(entry), step.flow, step.schema);
|
|
30051
29785
|
append({
|
|
@@ -30062,7 +29796,7 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
30062
29796
|
},
|
|
30063
29797
|
disabled: disabled
|
|
30064
29798
|
}, "Add"), error && /*#__PURE__*/React.createElement("div", {
|
|
30065
|
-
className: "invalid-feedback"
|
|
29799
|
+
className: "mrf-invalid-feedback"
|
|
30066
29800
|
}, error.message)));
|
|
30067
29801
|
};
|
|
30068
29802
|
|
|
@@ -30090,17 +29824,16 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30090
29824
|
collapsed = _useState8[0],
|
|
30091
29825
|
setCollapsed = _useState8[1];
|
|
30092
29826
|
|
|
30093
|
-
var classes = useCustomStyle();
|
|
30094
29827
|
useWatch(step === null || step === void 0 ? void 0 : (_step$conditionalSche = step.conditionalSchema) === null || _step$conditionalSche === void 0 ? void 0 : _step$conditionalSche.ref);
|
|
30095
29828
|
var schemaAndFlow = option(step.conditionalSchema).map(function (condiSchema) {
|
|
30096
29829
|
var ref = option(condiSchema.ref).map(function (ref) {
|
|
30097
29830
|
return getValues(ref);
|
|
30098
29831
|
}).getOrNull();
|
|
30099
|
-
var
|
|
29832
|
+
var rawValues = getValues();
|
|
30100
29833
|
var filterSwitch = condiSchema["switch"].find(function (s) {
|
|
30101
29834
|
if (typeof s.condition === 'function') {
|
|
30102
29835
|
return s.condition({
|
|
30103
|
-
|
|
29836
|
+
rawValues: rawValues,
|
|
30104
29837
|
ref: ref
|
|
30105
29838
|
});
|
|
30106
29839
|
} else {
|
|
@@ -30121,15 +29854,12 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30121
29854
|
schema: schema,
|
|
30122
29855
|
flow: flow
|
|
30123
29856
|
});
|
|
30124
|
-
|
|
30125
|
-
|
|
30126
|
-
|
|
30127
|
-
|
|
30128
|
-
|
|
30129
|
-
|
|
30130
|
-
});
|
|
30131
|
-
}
|
|
30132
|
-
}, [prevSchema, schemaAndFlow.schema]);
|
|
29857
|
+
useHashEffect(function () {
|
|
29858
|
+
var def = getDefaultValues(schemaAndFlow.flow, schemaAndFlow.schema, getValues(parent));
|
|
29859
|
+
setValue(parent, def, {
|
|
29860
|
+
shouldValidate: false
|
|
29861
|
+
});
|
|
29862
|
+
}, [schemaAndFlow.schema]);
|
|
30133
29863
|
var computedSandF = schemaAndFlow.flow.reduce(function (acc, entry) {
|
|
30134
29864
|
var step = schemaAndFlow.schema[entry];
|
|
30135
29865
|
var visibleStep = option(step).map(function (s) {
|
|
@@ -30160,13 +29890,13 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30160
29890
|
return x.visibleStep;
|
|
30161
29891
|
}).length >= 1 && step.label !== null;
|
|
30162
29892
|
return /*#__PURE__*/React.createElement("div", {
|
|
30163
|
-
className: classNames((_classNames17 = {}, _defineProperty$1(_classNames17,
|
|
29893
|
+
className: classNames((_classNames17 = {}, _defineProperty$1(_classNames17, 'mrf-nestedform__border', bordered), _defineProperty$1(_classNames17, 'mrf-border__error', !!errorDisplayed), _classNames17)),
|
|
30164
29894
|
style: {
|
|
30165
29895
|
position: 'relative'
|
|
30166
29896
|
}
|
|
30167
29897
|
}, !!step.collapsable && schemaAndFlow.flow.length > 1 && collapsed && /*#__PURE__*/React.createElement(ChevronDown, {
|
|
30168
29898
|
size: 30,
|
|
30169
|
-
className:
|
|
29899
|
+
className: "mrf-cursor_pointer",
|
|
30170
29900
|
style: {
|
|
30171
29901
|
position: 'absolute',
|
|
30172
29902
|
top: -35,
|
|
@@ -30179,7 +29909,7 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30179
29909
|
}
|
|
30180
29910
|
}), !!step.collapsable && schemaAndFlow.flow.length > 1 && !collapsed && /*#__PURE__*/React.createElement(ChevronUp, {
|
|
30181
29911
|
size: 30,
|
|
30182
|
-
className:
|
|
29912
|
+
className: "mrf-cursor_pointer",
|
|
30183
29913
|
style: {
|
|
30184
29914
|
position: 'absolute',
|
|
30185
29915
|
top: -35,
|
|
@@ -30202,7 +29932,7 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30202
29932
|
|
|
30203
29933
|
return /*#__PURE__*/React.createElement(BasicWrapper, {
|
|
30204
29934
|
key: "".concat(entry, ".").concat(idx),
|
|
30205
|
-
className: classNames(_defineProperty$1({},
|
|
29935
|
+
className: classNames(_defineProperty$1({}, 'mrf-display__none', collapsed && !step.visibleOnCollapse || !visibleStep)),
|
|
30206
29936
|
entry: "".concat(parent, ".").concat(entry),
|
|
30207
29937
|
label: functionalProperty(entry, (step === null || step === void 0 ? void 0 : step.label) === null ? null : (step === null || step === void 0 ? void 0 : step.label) || entry),
|
|
30208
29938
|
help: step.help,
|