@maif/react-forms 1.0.56 → 1.0.57
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 +126 -390
- package/lib/index.css +360 -0
- package/lib/index.js +127 -390
- 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, 'cursor_pointer', !readOnly), _defineProperty$1(_classNames, 'cursor_not_allowed', readOnly), _classNames))
|
|
817
551
|
}, !!value && /*#__PURE__*/React.createElement("div", {
|
|
818
|
-
className: classNames(
|
|
552
|
+
className: classNames('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('switch_button_on')
|
|
824
558
|
})), !value && value !== null && /*#__PURE__*/React.createElement("div", {
|
|
825
|
-
className: classNames(
|
|
559
|
+
className: classNames('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('switch_button_off')
|
|
831
565
|
})), value === null && /*#__PURE__*/React.createElement("div", {
|
|
832
|
-
className: classNames(
|
|
566
|
+
className: classNames('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('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({}, 'collapse_error', props.errored))
|
|
858
590
|
}), /*#__PURE__*/React.createElement("div", {
|
|
859
|
-
className: "
|
|
591
|
+
className: "cursor_pointer flex jc_between",
|
|
860
592
|
onClick: toggle
|
|
861
593
|
}, /*#__PURE__*/React.createElement("span", {
|
|
862
|
-
className: classNames(
|
|
594
|
+
className: classNames('collapse_label', _defineProperty$1({}, 'collapse_error', props.errored))
|
|
863
595
|
}, props.label), /*#__PURE__*/React.createElement("button", {
|
|
864
596
|
type: "button",
|
|
865
|
-
className: classNames(
|
|
597
|
+
className: classNames('btn', 'btn_sm', 'ml_5', _defineProperty$1({}, '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('ml_10', (_classNames4 = {}, _defineProperty$1(_classNames4, 'display__none', !!collapsed), _defineProperty$1(_classNames4, 'flex', !!props.inline), _defineProperty$1(_classNames4, '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, 'btn btn_grey 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: "flex btn btn_blue 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: "flex 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: "w_50 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: "w_50 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: "flex btn btn_red btn_sm 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: "flex btn btn_blue btn_sm ml_5",
|
|
1300
1049
|
onClick: addNext
|
|
1301
1050
|
}, /*#__PURE__*/React.createElement(PlusCircle, null)));
|
|
1302
1051
|
}));
|
|
@@ -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('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: "btn 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: "btn btn_sm ml_5",
|
|
28760
28507
|
style: {
|
|
28761
28508
|
color: preview ? '#7f96af' : 'white',
|
|
28762
28509
|
backgroundColor: preview ? 'white' : '#7f96af'
|
|
@@ -28765,7 +28512,7 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28765
28512
|
return setPreview(true);
|
|
28766
28513
|
}
|
|
28767
28514
|
}, "Preview"))), /*#__PURE__*/React.createElement("div", {
|
|
28768
|
-
className:
|
|
28515
|
+
className: "flex flexWrap"
|
|
28769
28516
|
}, injectButtons())), !preview && /*#__PURE__*/React.createElement(CodeInput, _extends({}, props, {
|
|
28770
28517
|
setRef: function setRef(e) {
|
|
28771
28518
|
return ref.current = e;
|
|
@@ -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: "mt_10",
|
|
29098
28844
|
style: {
|
|
29099
28845
|
position: 'relative'
|
|
29100
28846
|
}
|
|
29101
28847
|
}, label && /*#__PURE__*/React.createElement("label", {
|
|
29102
|
-
className: "
|
|
28848
|
+
className: "flex ai_center 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: "flex 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('feedback', _defineProperty$1({}, '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,14 +29040,19 @@ 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
|
-
|
|
29307
|
-
|
|
29048
|
+
_ref7.nostyle;
|
|
29049
|
+
|
|
29050
|
+
var _useState = useState(schema),
|
|
29051
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
29052
|
+
calcSchema = _useState2[0];
|
|
29053
|
+
_useState2[1];
|
|
29054
|
+
|
|
29055
|
+
var formFlow = flow || Object.keys(calcSchema);
|
|
29308
29056
|
|
|
29309
29057
|
var maybeCustomHttpClient = function maybeCustomHttpClient(url, method) {
|
|
29310
29058
|
//todo: if present props.resolve()
|
|
@@ -29321,7 +29069,7 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29321
29069
|
});
|
|
29322
29070
|
};
|
|
29323
29071
|
|
|
29324
|
-
var defaultValues = getDefaultValues(formFlow,
|
|
29072
|
+
var defaultValues = getDefaultValues(formFlow, calcSchema, value); //FIXME: get real schema through the switch
|
|
29325
29073
|
|
|
29326
29074
|
var _resolver = function resolver(rawData) {
|
|
29327
29075
|
var _getShapeAndDependenc2 = getShapeAndDependencies(formFlow, schema, [], rawData),
|
|
@@ -29340,10 +29088,10 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29340
29088
|
mode: 'onChange'
|
|
29341
29089
|
});
|
|
29342
29090
|
|
|
29343
|
-
var
|
|
29344
|
-
|
|
29345
|
-
initialReseted =
|
|
29346
|
-
|
|
29091
|
+
var _useState3 = useState(false),
|
|
29092
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
29093
|
+
initialReseted = _useState4[0];
|
|
29094
|
+
_useState4[1]; // useEffect(() => {
|
|
29347
29095
|
// reset(cleanInputArray(value, defaultValues, flow, schema))
|
|
29348
29096
|
// setReset(true)
|
|
29349
29097
|
// }, [reset])
|
|
@@ -29360,13 +29108,9 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29360
29108
|
trigger = methods.trigger,
|
|
29361
29109
|
getValues = methods.getValues,
|
|
29362
29110
|
watch = methods.watch;
|
|
29363
|
-
|
|
29364
|
-
|
|
29365
|
-
|
|
29366
|
-
if (prev && prevSchema && !deepEqual(value, prev) || !deepEqual(schema, prevSchema)) {
|
|
29367
|
-
_reset(_objectSpread2$1({}, cleanInputArray(value, defaultValues, flow, schema)));
|
|
29368
|
-
}
|
|
29369
|
-
}, [value, schema]);
|
|
29111
|
+
useHashEffect(function () {
|
|
29112
|
+
_reset(_objectSpread2$1({}, cleanInputArray(value, defaultValues, flow, schema)));
|
|
29113
|
+
}, [value, calcSchema]);
|
|
29370
29114
|
|
|
29371
29115
|
var functionalProperty = function functionalProperty(entry, prop) {
|
|
29372
29116
|
if (typeof prop === 'function') {
|
|
@@ -29403,7 +29147,7 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29403
29147
|
handleSubmit: _handleSubmit,
|
|
29404
29148
|
watch: methods.watch
|
|
29405
29149
|
}), /*#__PURE__*/React.createElement("form", {
|
|
29406
|
-
className: className || "
|
|
29150
|
+
className: className || "pr_15 w_100",
|
|
29407
29151
|
onSubmit: _handleSubmit(function (data) {
|
|
29408
29152
|
var clean = cleanOutputArray(data, schema);
|
|
29409
29153
|
onSubmit(clean);
|
|
@@ -29470,8 +29214,6 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29470
29214
|
var Footer = function Footer(props) {
|
|
29471
29215
|
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
29216
|
|
|
29473
|
-
var classes = useCustomStyle();
|
|
29474
|
-
|
|
29475
29217
|
if (props.render) {
|
|
29476
29218
|
return props.render({
|
|
29477
29219
|
reset: props.reset,
|
|
@@ -29481,9 +29223,9 @@ var Footer = function Footer(props) {
|
|
|
29481
29223
|
|
|
29482
29224
|
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
29225
|
return /*#__PURE__*/React.createElement("div", {
|
|
29484
|
-
className: "
|
|
29226
|
+
className: "flex jc_end mt_5"
|
|
29485
29227
|
}, ((_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: "
|
|
29228
|
+
className: "btn btn_red",
|
|
29487
29229
|
type: "button",
|
|
29488
29230
|
onClick: function onClick() {
|
|
29489
29231
|
var _props$actions4;
|
|
@@ -29491,11 +29233,11 @@ var Footer = function Footer(props) {
|
|
|
29491
29233
|
return (_props$actions4 = props.actions) === null || _props$actions4 === void 0 ? void 0 : _props$actions4.cancel.action();
|
|
29492
29234
|
}
|
|
29493
29235
|
}, ((_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: "
|
|
29236
|
+
className: "btn btn_red",
|
|
29495
29237
|
type: "button",
|
|
29496
29238
|
onClick: props.reset
|
|
29497
29239
|
}, ((_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: "
|
|
29240
|
+
className: "btn btn_green ml_10",
|
|
29499
29241
|
type: "submit"
|
|
29500
29242
|
}, ((_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
29243
|
};
|
|
@@ -29512,7 +29254,6 @@ var Step = function Step(_ref8) {
|
|
|
29512
29254
|
functionalProperty = _ref8.functionalProperty,
|
|
29513
29255
|
parent = _ref8.parent,
|
|
29514
29256
|
onAfterChange = _ref8.onAfterChange;
|
|
29515
|
-
var classes = useCustomStyle();
|
|
29516
29257
|
|
|
29517
29258
|
var _useFormContext2 = useFormContext(),
|
|
29518
29259
|
_useFormContext2$form = _useFormContext2.formState,
|
|
@@ -29670,7 +29411,7 @@ var Step = function Step(_ref8) {
|
|
|
29670
29411
|
errorDisplayed: errorDisplayed
|
|
29671
29412
|
}, /*#__PURE__*/React.createElement("textarea", {
|
|
29672
29413
|
type: "text",
|
|
29673
|
-
className: classNames(
|
|
29414
|
+
className: classNames('input', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29674
29415
|
}));
|
|
29675
29416
|
|
|
29676
29417
|
case format.code:
|
|
@@ -29682,7 +29423,7 @@ var Step = function Step(_ref8) {
|
|
|
29682
29423
|
entry: entry,
|
|
29683
29424
|
errorDisplayed: errorDisplayed
|
|
29684
29425
|
}, /*#__PURE__*/React.createElement(Component, {
|
|
29685
|
-
className: classNames(_defineProperty$1({},
|
|
29426
|
+
className: classNames(step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29686
29427
|
}));
|
|
29687
29428
|
|
|
29688
29429
|
case format.markdown:
|
|
@@ -29692,7 +29433,7 @@ var Step = function Step(_ref8) {
|
|
|
29692
29433
|
entry: entry,
|
|
29693
29434
|
errorDisplayed: errorDisplayed
|
|
29694
29435
|
}, /*#__PURE__*/React.createElement(MarkdownInput, {
|
|
29695
|
-
className: classNames(_defineProperty$1({},
|
|
29436
|
+
className: classNames(step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29696
29437
|
}));
|
|
29697
29438
|
|
|
29698
29439
|
case format.buttonsSelect:
|
|
@@ -29704,7 +29445,7 @@ var Step = function Step(_ref8) {
|
|
|
29704
29445
|
entry: entry,
|
|
29705
29446
|
errorDisplayed: errorDisplayed
|
|
29706
29447
|
}, /*#__PURE__*/React.createElement(SelectInput, _extends({
|
|
29707
|
-
className: classNames(
|
|
29448
|
+
className: classNames('flex_grow_1', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed)),
|
|
29708
29449
|
disabled: functionalProperty(entry, step.disabled)
|
|
29709
29450
|
}, step.props, {
|
|
29710
29451
|
possibleValues: step.options,
|
|
@@ -29725,7 +29466,7 @@ var Step = function Step(_ref8) {
|
|
|
29725
29466
|
errorDisplayed: errorDisplayed
|
|
29726
29467
|
}, /*#__PURE__*/React.createElement("input", {
|
|
29727
29468
|
type: step.format || 'text',
|
|
29728
|
-
className: classNames(
|
|
29469
|
+
className: classNames('input', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29729
29470
|
}));
|
|
29730
29471
|
}
|
|
29731
29472
|
|
|
@@ -29739,7 +29480,7 @@ var Step = function Step(_ref8) {
|
|
|
29739
29480
|
entry: entry,
|
|
29740
29481
|
errorDisplayed: errorDisplayed
|
|
29741
29482
|
}, /*#__PURE__*/React.createElement(SelectInput, _extends({
|
|
29742
|
-
className: classNames(
|
|
29483
|
+
className: classNames('content', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29743
29484
|
}, step.props, {
|
|
29744
29485
|
possibleValues: step.options,
|
|
29745
29486
|
httpClient: httpClient,
|
|
@@ -29759,7 +29500,7 @@ var Step = function Step(_ref8) {
|
|
|
29759
29500
|
errorDisplayed: errorDisplayed
|
|
29760
29501
|
}, /*#__PURE__*/React.createElement("input", {
|
|
29761
29502
|
type: step.format || 'number',
|
|
29762
|
-
className: classNames(
|
|
29503
|
+
className: classNames('input', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29763
29504
|
}));
|
|
29764
29505
|
}
|
|
29765
29506
|
|
|
@@ -29769,7 +29510,7 @@ var Step = function Step(_ref8) {
|
|
|
29769
29510
|
entry: entry,
|
|
29770
29511
|
errorDisplayed: errorDisplayed
|
|
29771
29512
|
}, /*#__PURE__*/React.createElement(BooleanInput, {
|
|
29772
|
-
className: classNames(_defineProperty$1({},
|
|
29513
|
+
className: classNames(steop.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29773
29514
|
}));
|
|
29774
29515
|
|
|
29775
29516
|
case type.object:
|
|
@@ -29782,7 +29523,7 @@ var Step = function Step(_ref8) {
|
|
|
29782
29523
|
entry: entry,
|
|
29783
29524
|
errorDisplayed: errorDisplayed
|
|
29784
29525
|
}, /*#__PURE__*/React.createElement(SelectInput, _extends({
|
|
29785
|
-
className: classNames(
|
|
29526
|
+
className: classNames('flex_grow_1', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29786
29527
|
}, step.props, {
|
|
29787
29528
|
possibleValues: step.options,
|
|
29788
29529
|
httpClient: httpClient,
|
|
@@ -29835,7 +29576,7 @@ var Step = function Step(_ref8) {
|
|
|
29835
29576
|
errorDisplayed: errorDisplayed,
|
|
29836
29577
|
component: function component(field, props) {
|
|
29837
29578
|
return /*#__PURE__*/React.createElement(CodeInput, _extends({}, props, {
|
|
29838
|
-
className: classNames(_defineProperty$1({},
|
|
29579
|
+
className: classNames(step.className, _defineProperty$1({}, 'input__invalid', error)),
|
|
29839
29580
|
onChange: function onChange(e) {
|
|
29840
29581
|
_readOnlyError("errorDisplayed");
|
|
29841
29582
|
var v;
|
|
@@ -29867,7 +29608,7 @@ var Step = function Step(_ref8) {
|
|
|
29867
29608
|
entry: entry,
|
|
29868
29609
|
errorDisplayed: errorDisplayed
|
|
29869
29610
|
}, /*#__PURE__*/React.createElement(ObjectInput, {
|
|
29870
|
-
className: classNames(_defineProperty$1({},
|
|
29611
|
+
className: classNames(step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29871
29612
|
}));
|
|
29872
29613
|
}
|
|
29873
29614
|
|
|
@@ -29878,7 +29619,7 @@ var Step = function Step(_ref8) {
|
|
|
29878
29619
|
entry: entry,
|
|
29879
29620
|
errorDisplayed: errorDisplayed
|
|
29880
29621
|
}, /*#__PURE__*/React.createElement(DatePicker, {
|
|
29881
|
-
className: classNames(
|
|
29622
|
+
className: classNames('datepicker', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed)),
|
|
29882
29623
|
formatStyle: "large"
|
|
29883
29624
|
}));
|
|
29884
29625
|
|
|
@@ -29892,15 +29633,15 @@ var Step = function Step(_ref8) {
|
|
|
29892
29633
|
var FileInput = function FileInput(_ref10) {
|
|
29893
29634
|
var onChange = _ref10.onChange;
|
|
29894
29635
|
|
|
29895
|
-
var
|
|
29896
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
29897
|
-
uploading = _useState4[0],
|
|
29898
|
-
setUploading = _useState4[1];
|
|
29899
|
-
|
|
29900
|
-
var _useState5 = useState(undefined),
|
|
29636
|
+
var _useState5 = useState(false),
|
|
29901
29637
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
29902
|
-
|
|
29903
|
-
|
|
29638
|
+
uploading = _useState6[0],
|
|
29639
|
+
setUploading = _useState6[1];
|
|
29640
|
+
|
|
29641
|
+
var _useState7 = useState(undefined),
|
|
29642
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
29643
|
+
input = _useState8[0],
|
|
29644
|
+
setInput = _useState8[1];
|
|
29904
29645
|
|
|
29905
29646
|
var setFiles = function setFiles(e) {
|
|
29906
29647
|
var files = e.target.files;
|
|
@@ -29915,24 +29656,24 @@ var Step = function Step(_ref8) {
|
|
|
29915
29656
|
|
|
29916
29657
|
var files = field.value || [];
|
|
29917
29658
|
return /*#__PURE__*/React.createElement("div", {
|
|
29918
|
-
className: classNames(
|
|
29659
|
+
className: classNames('flex', 'ai_center', step.className, _defineProperty$1({}, 'input__invalid', error))
|
|
29919
29660
|
}, /*#__PURE__*/React.createElement("input", {
|
|
29920
29661
|
ref: function ref(r) {
|
|
29921
29662
|
return setInput(r);
|
|
29922
29663
|
},
|
|
29923
29664
|
type: "file",
|
|
29924
29665
|
multiple: true,
|
|
29925
|
-
className:
|
|
29666
|
+
className: 'd_none',
|
|
29926
29667
|
onChange: setFiles
|
|
29927
29668
|
}), /*#__PURE__*/React.createElement("button", {
|
|
29928
29669
|
type: "button",
|
|
29929
|
-
className: "
|
|
29670
|
+
className: "btn btn_sm flex ai_center",
|
|
29930
29671
|
disabled: uploading || functionalProperty(entry, step.disabled),
|
|
29931
29672
|
onClick: trigger
|
|
29932
29673
|
}, uploading && /*#__PURE__*/React.createElement(Loader, null), !uploading && /*#__PURE__*/React.createElement(Upload, null), /*#__PURE__*/React.createElement("span", {
|
|
29933
|
-
className: ""
|
|
29674
|
+
className: "ml_5"
|
|
29934
29675
|
}, "Select file(s)")), /*#__PURE__*/React.createElement("span", {
|
|
29935
|
-
className: ""
|
|
29676
|
+
className: "ml_5"
|
|
29936
29677
|
}, files.length <= 0 ? 'No files selected' : files.map(function (r) {
|
|
29937
29678
|
return r.name;
|
|
29938
29679
|
}).join(" , ")));
|
|
@@ -29954,7 +29695,7 @@ var Step = function Step(_ref8) {
|
|
|
29954
29695
|
entry: entry,
|
|
29955
29696
|
component: function component(field, props) {
|
|
29956
29697
|
return /*#__PURE__*/React.createElement(CodeInput, _extends({}, props, {
|
|
29957
|
-
className: classNames(_defineProperty$1({},
|
|
29698
|
+
className: classNames(_defineProperty$1({}, 'input__invalid', error)),
|
|
29958
29699
|
onChange: function onChange(v) {
|
|
29959
29700
|
field.onChange(v);
|
|
29960
29701
|
option(step.onChange).map(function (onChange) {
|
|
@@ -29980,7 +29721,6 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
29980
29721
|
step = _ref11.step,
|
|
29981
29722
|
component = _ref11.component,
|
|
29982
29723
|
disabled = _ref11.disabled;
|
|
29983
|
-
var classes = useCustomStyle();
|
|
29984
29724
|
|
|
29985
29725
|
var _useFormContext3 = useFormContext(),
|
|
29986
29726
|
getValues = _useFormContext3.getValues,
|
|
@@ -30013,7 +29753,7 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
30013
29753
|
return /*#__PURE__*/React.createElement("div", {
|
|
30014
29754
|
key: field.id
|
|
30015
29755
|
}, /*#__PURE__*/React.createElement("div", {
|
|
30016
|
-
className: classNames(
|
|
29756
|
+
className: classNames('ai_center', 'mt_5'),
|
|
30017
29757
|
style: {
|
|
30018
29758
|
position: 'relative'
|
|
30019
29759
|
}
|
|
@@ -30032,7 +29772,7 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
30032
29772
|
top: '2px',
|
|
30033
29773
|
right: 0
|
|
30034
29774
|
},
|
|
30035
|
-
className: classNames(
|
|
29775
|
+
className: classNames('btn', 'btn_red', 'btn_sm', 'ml_5'),
|
|
30036
29776
|
disabled: disabled,
|
|
30037
29777
|
onClick: function onClick() {
|
|
30038
29778
|
remove(idx);
|
|
@@ -30042,10 +29782,10 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
30042
29782
|
size: 16
|
|
30043
29783
|
}))));
|
|
30044
29784
|
}), /*#__PURE__*/React.createElement("div", {
|
|
30045
|
-
className: classNames(
|
|
29785
|
+
className: classNames('flex', 'jc_flex_end')
|
|
30046
29786
|
}, /*#__PURE__*/React.createElement("button", {
|
|
30047
29787
|
type: "button",
|
|
30048
|
-
className: classNames(
|
|
29788
|
+
className: classNames('btn', 'btn_blue', 'btn_sm', 'mt_5', _defineProperty$1({}, 'input__invalid', errorDisplayed)),
|
|
30049
29789
|
onClick: function onClick() {
|
|
30050
29790
|
var newValue = cleanInputArray({}, getValues(entry), step.flow, step.schema);
|
|
30051
29791
|
append({
|
|
@@ -30085,22 +29825,21 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30085
29825
|
setValue = _useFormContext4.setValue,
|
|
30086
29826
|
watch = _useFormContext4.watch;
|
|
30087
29827
|
|
|
30088
|
-
var
|
|
30089
|
-
|
|
30090
|
-
collapsed =
|
|
30091
|
-
setCollapsed =
|
|
29828
|
+
var _useState9 = useState(!!step.collapsed),
|
|
29829
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
29830
|
+
collapsed = _useState10[0],
|
|
29831
|
+
setCollapsed = _useState10[1];
|
|
30092
29832
|
|
|
30093
|
-
var classes = useCustomStyle();
|
|
30094
29833
|
useWatch(step === null || step === void 0 ? void 0 : (_step$conditionalSche = step.conditionalSchema) === null || _step$conditionalSche === void 0 ? void 0 : _step$conditionalSche.ref);
|
|
30095
29834
|
var schemaAndFlow = option(step.conditionalSchema).map(function (condiSchema) {
|
|
30096
29835
|
var ref = option(condiSchema.ref).map(function (ref) {
|
|
30097
29836
|
return getValues(ref);
|
|
30098
29837
|
}).getOrNull();
|
|
30099
|
-
var
|
|
29838
|
+
var rawValues = getValues();
|
|
30100
29839
|
var filterSwitch = condiSchema["switch"].find(function (s) {
|
|
30101
29840
|
if (typeof s.condition === 'function') {
|
|
30102
29841
|
return s.condition({
|
|
30103
|
-
|
|
29842
|
+
rawValues: rawValues,
|
|
30104
29843
|
ref: ref
|
|
30105
29844
|
});
|
|
30106
29845
|
} else {
|
|
@@ -30121,15 +29860,12 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30121
29860
|
schema: schema,
|
|
30122
29861
|
flow: flow
|
|
30123
29862
|
});
|
|
30124
|
-
|
|
30125
|
-
|
|
30126
|
-
|
|
30127
|
-
|
|
30128
|
-
|
|
30129
|
-
|
|
30130
|
-
});
|
|
30131
|
-
}
|
|
30132
|
-
}, [prevSchema, schemaAndFlow.schema]);
|
|
29863
|
+
useHashEffect(function () {
|
|
29864
|
+
var def = getDefaultValues(schemaAndFlow.flow, schemaAndFlow.schema, getValues(parent));
|
|
29865
|
+
setValue(parent, def, {
|
|
29866
|
+
shouldValidate: false
|
|
29867
|
+
});
|
|
29868
|
+
}, [schemaAndFlow.schema]);
|
|
30133
29869
|
var computedSandF = schemaAndFlow.flow.reduce(function (acc, entry) {
|
|
30134
29870
|
var step = schemaAndFlow.schema[entry];
|
|
30135
29871
|
var visibleStep = option(step).map(function (s) {
|
|
@@ -30160,13 +29896,13 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30160
29896
|
return x.visibleStep;
|
|
30161
29897
|
}).length >= 1 && step.label !== null;
|
|
30162
29898
|
return /*#__PURE__*/React.createElement("div", {
|
|
30163
|
-
className: classNames((_classNames17 = {}, _defineProperty$1(_classNames17,
|
|
29899
|
+
className: classNames((_classNames17 = {}, _defineProperty$1(_classNames17, 'nestedform__border', bordered), _defineProperty$1(_classNames17, 'border__error', !!errorDisplayed), _classNames17)),
|
|
30164
29900
|
style: {
|
|
30165
29901
|
position: 'relative'
|
|
30166
29902
|
}
|
|
30167
29903
|
}, !!step.collapsable && schemaAndFlow.flow.length > 1 && collapsed && /*#__PURE__*/React.createElement(ChevronDown, {
|
|
30168
29904
|
size: 30,
|
|
30169
|
-
className:
|
|
29905
|
+
className: 'cursor_pointer',
|
|
30170
29906
|
style: {
|
|
30171
29907
|
position: 'absolute',
|
|
30172
29908
|
top: -35,
|
|
@@ -30179,7 +29915,7 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30179
29915
|
}
|
|
30180
29916
|
}), !!step.collapsable && schemaAndFlow.flow.length > 1 && !collapsed && /*#__PURE__*/React.createElement(ChevronUp, {
|
|
30181
29917
|
size: 30,
|
|
30182
|
-
className:
|
|
29918
|
+
className: 'cursor_pointer',
|
|
30183
29919
|
style: {
|
|
30184
29920
|
position: 'absolute',
|
|
30185
29921
|
top: -35,
|
|
@@ -30202,7 +29938,7 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30202
29938
|
|
|
30203
29939
|
return /*#__PURE__*/React.createElement(BasicWrapper, {
|
|
30204
29940
|
key: "".concat(entry, ".").concat(idx),
|
|
30205
|
-
className: classNames(_defineProperty$1({},
|
|
29941
|
+
className: classNames(_defineProperty$1({}, 'display__none', collapsed && !step.visibleOnCollapse || !visibleStep)),
|
|
30206
29942
|
entry: "".concat(parent, ".").concat(entry),
|
|
30207
29943
|
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
29944
|
help: step.help,
|