@maif/react-forms 1.0.55 → 1.0.58
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 +41 -9
- package/lib/esm/index.js +137 -397
- package/lib/index.css +360 -0
- package/lib/index.js +138 -397
- 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';
|
|
@@ -74,7 +75,8 @@ var _matches = function matches() {
|
|
|
74
75
|
var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "This field does not match the pattern";
|
|
75
76
|
return function (r) {
|
|
76
77
|
return r.matches(regexp, {
|
|
77
|
-
message: message
|
|
78
|
+
message: message,
|
|
79
|
+
excludeEmptyString: true
|
|
78
80
|
});
|
|
79
81
|
};
|
|
80
82
|
}; //string & number
|
|
@@ -215,7 +217,7 @@ var _oneOf = function oneOf(arrayOfValues) {
|
|
|
215
217
|
return function (r) {
|
|
216
218
|
return r.oneOf(arrayOfValues.map(maybeRef), message);
|
|
217
219
|
};
|
|
218
|
-
};
|
|
220
|
+
}; //todo: rename by notOneOf
|
|
219
221
|
|
|
220
222
|
var _blacklist = function blacklist(arrayOfValues) {
|
|
221
223
|
var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "This value can't include the following values ".concat(arrayOfValues.join(', '));
|
|
@@ -531,279 +533,12 @@ function _nonIterableRest() {
|
|
|
531
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.");
|
|
532
534
|
}
|
|
533
535
|
|
|
534
|
-
var _switch_button_on, _style;
|
|
535
|
-
|
|
536
|
-
var buttonOutline = function buttonOutline(color, darker) {
|
|
537
|
-
return {
|
|
538
|
-
color: color,
|
|
539
|
-
borderColor: color,
|
|
540
|
-
"&:hover": {
|
|
541
|
-
color: '#fff',
|
|
542
|
-
backgroundColor: color,
|
|
543
|
-
borderColor: darker
|
|
544
|
-
},
|
|
545
|
-
"&.active": {
|
|
546
|
-
color: '#fff',
|
|
547
|
-
backgroundColor: color,
|
|
548
|
-
borderColor: darker
|
|
549
|
-
}
|
|
550
|
-
};
|
|
551
|
-
};
|
|
552
|
-
|
|
553
|
-
var style = (_style = {
|
|
554
|
-
input: {
|
|
555
|
-
display: "block",
|
|
556
|
-
width: "100%",
|
|
557
|
-
padding: "8px 12px",
|
|
558
|
-
fontSize: "1rem",
|
|
559
|
-
color: "#495057",
|
|
560
|
-
border: "1px solid #ced4da",
|
|
561
|
-
borderRadius: 4,
|
|
562
|
-
"&[readonly]": {
|
|
563
|
-
backgroundColor: "#e9ecef",
|
|
564
|
-
opacity: 1
|
|
565
|
-
}
|
|
566
|
-
},
|
|
567
|
-
btn: {
|
|
568
|
-
borderRadius: 5,
|
|
569
|
-
padding: 10,
|
|
570
|
-
fontSize: "1rem",
|
|
571
|
-
cursor: "pointer",
|
|
572
|
-
borderWidth: '1px',
|
|
573
|
-
backgroundColor: '#fff',
|
|
574
|
-
'&:disabled': {
|
|
575
|
-
opacity: .6,
|
|
576
|
-
cursor: 'not-allowed'
|
|
577
|
-
}
|
|
578
|
-
},
|
|
579
|
-
btn_sm: {
|
|
580
|
-
fontSize: "0.875rem",
|
|
581
|
-
padding: ".25rem .5rem",
|
|
582
|
-
lineHeight: "1.5",
|
|
583
|
-
borderRadius: ".2rem"
|
|
584
|
-
},
|
|
585
|
-
btn_group: {
|
|
586
|
-
"& > button:not(:last-child)": {
|
|
587
|
-
borderTopRightRadius: 0,
|
|
588
|
-
borderBottomRightRadius: 0
|
|
589
|
-
},
|
|
590
|
-
"& > button:not(:first-child)": {
|
|
591
|
-
borderTopLeftRadius: 0,
|
|
592
|
-
borderBottomLeftRadius: 0
|
|
593
|
-
}
|
|
594
|
-
},
|
|
595
|
-
btn_red: buttonOutline("#dc3545", "#bd2130"),
|
|
596
|
-
btn_green: buttonOutline("#28a745", "#1e7e34"),
|
|
597
|
-
btn_blue: buttonOutline("#007bff", "#0069d9"),
|
|
598
|
-
btn_grey: buttonOutline("#6c757d", "#5c636a"),
|
|
599
|
-
txt_red: {
|
|
600
|
-
color: "#dc3545"
|
|
601
|
-
},
|
|
602
|
-
ml_5: {
|
|
603
|
-
marginLeft: 5
|
|
604
|
-
},
|
|
605
|
-
ml_10: {
|
|
606
|
-
marginLeft: 10
|
|
607
|
-
},
|
|
608
|
-
mr_5: {
|
|
609
|
-
marginRight: 5
|
|
610
|
-
},
|
|
611
|
-
mr_10: {
|
|
612
|
-
marginRight: 10
|
|
613
|
-
},
|
|
614
|
-
mt_5: {
|
|
615
|
-
marginTop: 5
|
|
616
|
-
},
|
|
617
|
-
mt_10: {
|
|
618
|
-
marginTop: 10
|
|
619
|
-
},
|
|
620
|
-
mt_20: {
|
|
621
|
-
marginTop: 20
|
|
622
|
-
},
|
|
623
|
-
mb_5: {
|
|
624
|
-
marginBottom: 5
|
|
625
|
-
},
|
|
626
|
-
mb_10: {
|
|
627
|
-
marginBottom: 10
|
|
628
|
-
},
|
|
629
|
-
mb_20: {
|
|
630
|
-
marginBottom: 20
|
|
631
|
-
},
|
|
632
|
-
pt_15: {
|
|
633
|
-
paddingTop: 15
|
|
634
|
-
},
|
|
635
|
-
p_15: {
|
|
636
|
-
padding: 15
|
|
637
|
-
},
|
|
638
|
-
pr_15: {
|
|
639
|
-
paddingRight: 15
|
|
640
|
-
},
|
|
641
|
-
w_100: {
|
|
642
|
-
width: '100%'
|
|
643
|
-
},
|
|
644
|
-
w_50: {
|
|
645
|
-
width: '50%'
|
|
646
|
-
},
|
|
647
|
-
d_none: {
|
|
648
|
-
display: "none"
|
|
649
|
-
},
|
|
650
|
-
flexWrap: {
|
|
651
|
-
flexWrap: 'wrap'
|
|
652
|
-
},
|
|
653
|
-
flex: {
|
|
654
|
-
display: "flex"
|
|
655
|
-
},
|
|
656
|
-
flexColumn: {
|
|
657
|
-
flexDirection: "column"
|
|
658
|
-
},
|
|
659
|
-
flex_grow_1: {
|
|
660
|
-
flexGrow: 1
|
|
661
|
-
},
|
|
662
|
-
jc_between: {
|
|
663
|
-
justifyContent: "space-between"
|
|
664
|
-
},
|
|
665
|
-
jc_end: {
|
|
666
|
-
justifyContent: "end"
|
|
667
|
-
},
|
|
668
|
-
jc_flex_end: {
|
|
669
|
-
justifyContent: "flex-end"
|
|
670
|
-
},
|
|
671
|
-
jc_flex_start: {
|
|
672
|
-
justifyContent: "flex-start"
|
|
673
|
-
},
|
|
674
|
-
ac_center: {
|
|
675
|
-
alignContent: "center"
|
|
676
|
-
},
|
|
677
|
-
ai_center: {
|
|
678
|
-
alignItems: "center"
|
|
679
|
-
},
|
|
680
|
-
cursor_pointer: {
|
|
681
|
-
cursor: "pointer"
|
|
682
|
-
},
|
|
683
|
-
cursor_not_allowed: {
|
|
684
|
-
cursor: "not-allowed"
|
|
685
|
-
},
|
|
686
|
-
collapse: {
|
|
687
|
-
display: "flex",
|
|
688
|
-
justifyContent: "space-between",
|
|
689
|
-
cursor: "pointer"
|
|
690
|
-
},
|
|
691
|
-
collapse_label: {
|
|
692
|
-
fontWeight: "bold",
|
|
693
|
-
marginTop: 7
|
|
694
|
-
}
|
|
695
|
-
}, _defineProperty$1(_style, "collapse_label", {
|
|
696
|
-
fontWeight: "bold",
|
|
697
|
-
marginTop: 7
|
|
698
|
-
}), _defineProperty$1(_style, "collapse_error", {
|
|
699
|
-
color: '#dc3545'
|
|
700
|
-
}), _defineProperty$1(_style, "datepicker", {
|
|
701
|
-
"& input": {
|
|
702
|
-
borderRadius: "4px"
|
|
703
|
-
}
|
|
704
|
-
}), _defineProperty$1(_style, "code", {}), _defineProperty$1(_style, "input__boolean__on", {
|
|
705
|
-
color: "MediumSeaGreen"
|
|
706
|
-
}), _defineProperty$1(_style, "input__boolean__off", {
|
|
707
|
-
color: "tomato"
|
|
708
|
-
}), _defineProperty$1(_style, "input__invalid", {
|
|
709
|
-
borderColor: '#dc3545 !important'
|
|
710
|
-
}), _defineProperty$1(_style, "feedback", {
|
|
711
|
-
width: "100%",
|
|
712
|
-
marginTop: ".25rem",
|
|
713
|
-
fontSize: "80%"
|
|
714
|
-
}), _defineProperty$1(_style, "display__none", {
|
|
715
|
-
display: "none"
|
|
716
|
-
}), _defineProperty$1(_style, "collapse__inline", {
|
|
717
|
-
"& .form-group+.form-group": {
|
|
718
|
-
marginLeft: '20px'
|
|
719
|
-
}
|
|
720
|
-
}), _defineProperty$1(_style, "nestedform__border", {
|
|
721
|
-
borderLeft: '2px solid lightGray',
|
|
722
|
-
paddingLeft: '0.5rem',
|
|
723
|
-
marginLeft: '0.5rem',
|
|
724
|
-
marginBottom: '.5rem',
|
|
725
|
-
paddingBottom: '1rem',
|
|
726
|
-
marginRight: '.5rem',
|
|
727
|
-
paddingRight: '2.5rem'
|
|
728
|
-
}), _defineProperty$1(_style, "border__error", {
|
|
729
|
-
borderColor: "#dc3545"
|
|
730
|
-
}), _defineProperty$1(_style, "btn_for_descriptionToolbar", {
|
|
731
|
-
textAlign: "left",
|
|
732
|
-
cursor: "pointer",
|
|
733
|
-
height: "22px",
|
|
734
|
-
padding: "4px",
|
|
735
|
-
border: "none",
|
|
736
|
-
background: "none",
|
|
737
|
-
color: "#242729",
|
|
738
|
-
marginRight: "5px",
|
|
739
|
-
marginLeft: "5px"
|
|
740
|
-
}), _defineProperty$1(_style, "content_switch_button_on", {
|
|
741
|
-
width: "35px",
|
|
742
|
-
height: "22px",
|
|
743
|
-
borderRadius: "20px",
|
|
744
|
-
display: "flex",
|
|
745
|
-
marginTop: "10px",
|
|
746
|
-
backgroundColor: "green",
|
|
747
|
-
border: "1px solid green",
|
|
748
|
-
justifyContent: "flex-end"
|
|
749
|
-
}), _defineProperty$1(_style, "content_switch_button_off", {
|
|
750
|
-
width: "35px",
|
|
751
|
-
height: "22px",
|
|
752
|
-
borderRadius: "20px",
|
|
753
|
-
display: "flex",
|
|
754
|
-
marginTop: "10px",
|
|
755
|
-
backgroundColor: "#dc3545",
|
|
756
|
-
border: "1px solid #dc3545",
|
|
757
|
-
justifyContent: "flex-start"
|
|
758
|
-
}), _defineProperty$1(_style, "content_switch_button_null", {
|
|
759
|
-
width: "35px",
|
|
760
|
-
height: "22px",
|
|
761
|
-
borderRadius: "20px",
|
|
762
|
-
display: "flex",
|
|
763
|
-
marginTop: "10px",
|
|
764
|
-
backgroundColor: "#fff",
|
|
765
|
-
border: "1px solid #dfdfdf",
|
|
766
|
-
justifyContent: "flex-start"
|
|
767
|
-
}), _defineProperty$1(_style, "switch_button_on", (_switch_button_on = {
|
|
768
|
-
backgroundColor: "#fff",
|
|
769
|
-
borderRadius: "20px",
|
|
770
|
-
cursor: "pointer",
|
|
771
|
-
width: "20px",
|
|
772
|
-
height: "20px"
|
|
773
|
-
}, _defineProperty$1(_switch_button_on, "backgroundColor", "#fff"), _defineProperty$1(_switch_button_on, "borderRadius", "20px"), _switch_button_on)), _defineProperty$1(_style, "switch_button_off", {
|
|
774
|
-
backgroundColor: "#fff",
|
|
775
|
-
borderRadius: "20px",
|
|
776
|
-
cursor: "pointer",
|
|
777
|
-
width: "20px",
|
|
778
|
-
height: "20px",
|
|
779
|
-
border: "1px solid #dfdfdf",
|
|
780
|
-
boxShadow: "1px 0px 5px 0px rgba(0, 0, 0, 0.3)"
|
|
781
|
-
}), _defineProperty$1(_style, "switch_button_null", {
|
|
782
|
-
backgroundColor: "#fff",
|
|
783
|
-
borderRadius: "20px",
|
|
784
|
-
cursor: "pointer",
|
|
785
|
-
width: "22px",
|
|
786
|
-
height: "22px",
|
|
787
|
-
marginTop: "-1px",
|
|
788
|
-
marginLeft: "-1px",
|
|
789
|
-
border: "1px solid #dfdfdf",
|
|
790
|
-
boxShadow: "1px 0px 5px 0px rgba(0, 0, 0, 0.3)"
|
|
791
|
-
}), _style);
|
|
792
|
-
|
|
793
|
-
var useCustomStyle = function useCustomStyle() {
|
|
794
|
-
var overrideStyle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
795
|
-
var useStyle = createUseStyles(_objectSpread2$1(_objectSpread2$1({}, style), overrideStyle));
|
|
796
|
-
var classes = useStyle();
|
|
797
|
-
return classes;
|
|
798
|
-
};
|
|
799
|
-
|
|
800
536
|
var BooleanInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
801
537
|
var _classNames;
|
|
802
538
|
|
|
803
539
|
var onChange = _ref.onChange,
|
|
804
540
|
value = _ref.value,
|
|
805
541
|
readOnly = _ref.readOnly;
|
|
806
|
-
var classes = useCustomStyle();
|
|
807
542
|
|
|
808
543
|
var handleClick = function handleClick(value) {
|
|
809
544
|
if (!readOnly) {
|
|
@@ -812,28 +547,28 @@ var BooleanInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
812
547
|
};
|
|
813
548
|
|
|
814
549
|
return /*#__PURE__*/React.createElement("div", {
|
|
815
|
-
className: classNames((_classNames = {}, _defineProperty$1(_classNames,
|
|
550
|
+
className: classNames((_classNames = {}, _defineProperty$1(_classNames, 'cursor_pointer', !readOnly), _defineProperty$1(_classNames, 'cursor_not_allowed', readOnly), _classNames))
|
|
816
551
|
}, !!value && /*#__PURE__*/React.createElement("div", {
|
|
817
|
-
className: classNames(
|
|
552
|
+
className: classNames('content_switch_button_on'),
|
|
818
553
|
onClick: function onClick() {
|
|
819
554
|
return handleClick(false);
|
|
820
555
|
}
|
|
821
556
|
}, /*#__PURE__*/React.createElement("div", {
|
|
822
|
-
className: classNames(
|
|
557
|
+
className: classNames('switch_button_on')
|
|
823
558
|
})), !value && value !== null && /*#__PURE__*/React.createElement("div", {
|
|
824
|
-
className: classNames(
|
|
559
|
+
className: classNames('content_switch_button_off'),
|
|
825
560
|
onClick: function onClick() {
|
|
826
561
|
return handleClick(true);
|
|
827
562
|
}
|
|
828
563
|
}, /*#__PURE__*/React.createElement("div", {
|
|
829
|
-
className: classNames(
|
|
564
|
+
className: classNames('switch_button_off')
|
|
830
565
|
})), value === null && /*#__PURE__*/React.createElement("div", {
|
|
831
|
-
className: classNames(
|
|
566
|
+
className: classNames('content_switch_button_null'),
|
|
832
567
|
onClick: function onClick() {
|
|
833
568
|
return handleClick(true);
|
|
834
569
|
}
|
|
835
570
|
}, /*#__PURE__*/React.createElement("div", {
|
|
836
|
-
className: classNames(
|
|
571
|
+
className: classNames('switch_button_null')
|
|
837
572
|
})));
|
|
838
573
|
});
|
|
839
574
|
|
|
@@ -845,30 +580,28 @@ var Collapse = function Collapse(props) {
|
|
|
845
580
|
collapsed = _useState2[0],
|
|
846
581
|
setCollapsed = _useState2[1];
|
|
847
582
|
|
|
848
|
-
var classes = useCustomStyle();
|
|
849
|
-
|
|
850
583
|
var toggle = function toggle(e) {
|
|
851
584
|
if (e && e.preventDefault) e.stopPropagation();
|
|
852
585
|
setCollapsed(!collapsed);
|
|
853
586
|
};
|
|
854
587
|
|
|
855
588
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("hr", {
|
|
856
|
-
className: classNames(_defineProperty$1({},
|
|
589
|
+
className: classNames(_defineProperty$1({}, 'collapse_error', props.errored))
|
|
857
590
|
}), /*#__PURE__*/React.createElement("div", {
|
|
858
|
-
className: "
|
|
591
|
+
className: "cursor_pointer flex jc_between",
|
|
859
592
|
onClick: toggle
|
|
860
593
|
}, /*#__PURE__*/React.createElement("span", {
|
|
861
|
-
className: classNames(
|
|
594
|
+
className: classNames('collapse_label', _defineProperty$1({}, 'collapse_error', props.errored))
|
|
862
595
|
}, props.label), /*#__PURE__*/React.createElement("button", {
|
|
863
596
|
type: "button",
|
|
864
|
-
className: classNames(
|
|
597
|
+
className: classNames('btn', 'btn_sm', 'ml_5', _defineProperty$1({}, 'collapse_error', props.errored)),
|
|
865
598
|
onClick: toggle
|
|
866
599
|
}, !!collapsed && /*#__PURE__*/React.createElement(Eye, {
|
|
867
600
|
size: 16
|
|
868
601
|
}), !collapsed && /*#__PURE__*/React.createElement(EyeOff, {
|
|
869
602
|
size: 16
|
|
870
603
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
871
|
-
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))
|
|
872
605
|
}, props.children), props.lineEnd && /*#__PURE__*/React.createElement("hr", null));
|
|
873
606
|
};
|
|
874
607
|
|
|
@@ -936,6 +669,28 @@ var arrayFlatten = function arrayFlatten(array) {
|
|
|
936
669
|
|
|
937
670
|
return array;
|
|
938
671
|
};
|
|
672
|
+
var isDefined = function isDefined(value) {
|
|
673
|
+
return value !== null && value !== undefined;
|
|
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
|
+
};
|
|
939
694
|
|
|
940
695
|
var valueToSelectOption = function valueToSelectOption(value) {
|
|
941
696
|
var possibleValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
@@ -973,7 +728,6 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function (props, _) {
|
|
|
973
728
|
var _useFormContext = useFormContext(),
|
|
974
729
|
getValues = _useFormContext.getValues;
|
|
975
730
|
|
|
976
|
-
var classes = useCustomStyle();
|
|
977
731
|
var possibleValues = (props.possibleValues || []).map(function (v) {
|
|
978
732
|
return props.transformer ? typeof props.transformer === 'function' ? props.transformer(v) : {
|
|
979
733
|
label: v[props.transformer.label],
|
|
@@ -1099,7 +853,7 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function (props, _) {
|
|
|
1099
853
|
key: idx,
|
|
1100
854
|
type: "button",
|
|
1101
855
|
disabled: props.disabled,
|
|
1102
|
-
className: classNames(props.className,
|
|
856
|
+
className: classNames(props.className, 'btn btn_grey ml_5', {
|
|
1103
857
|
active: active
|
|
1104
858
|
}),
|
|
1105
859
|
onClick: function onClick() {
|
|
@@ -1116,7 +870,6 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function (props, _) {
|
|
|
1116
870
|
value: value,
|
|
1117
871
|
isDisabled: props.disabled,
|
|
1118
872
|
placeholder: props.placeholder,
|
|
1119
|
-
isClearable: true,
|
|
1120
873
|
onChange: onChange,
|
|
1121
874
|
options: values,
|
|
1122
875
|
onCreateOption: function onCreateOption(option) {
|
|
@@ -1131,7 +884,6 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function (props, _) {
|
|
|
1131
884
|
name: "".concat(props.label, "-search"),
|
|
1132
885
|
isLoading: loading,
|
|
1133
886
|
value: value,
|
|
1134
|
-
isClearable: true,
|
|
1135
887
|
defaultValue: value,
|
|
1136
888
|
isDisabled: props.disabled,
|
|
1137
889
|
placeholder: props.placeholder,
|
|
@@ -1248,13 +1000,12 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1248
1000
|
onChange(newState);
|
|
1249
1001
|
};
|
|
1250
1002
|
|
|
1251
|
-
var classes = useCustomStyle();
|
|
1252
1003
|
return /*#__PURE__*/React.createElement("div", {
|
|
1253
1004
|
className: props.className
|
|
1254
1005
|
}, Object.keys(internalState || {}).length === 0 && /*#__PURE__*/React.createElement("button", {
|
|
1255
1006
|
disabled: props.disabled,
|
|
1256
1007
|
type: "button",
|
|
1257
|
-
className:
|
|
1008
|
+
className: "flex btn btn_blue btn_sm",
|
|
1258
1009
|
onClick: addFirst
|
|
1259
1010
|
}, /*#__PURE__*/React.createElement(PlusCircle, null)), Object.entries(internalState || {}).map(function (_ref9, idx) {
|
|
1260
1011
|
var _ref10 = _slicedToArray(_ref9, 2),
|
|
@@ -1264,12 +1015,12 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1264
1015
|
value = _ref10$.value;
|
|
1265
1016
|
|
|
1266
1017
|
return /*#__PURE__*/React.createElement("div", {
|
|
1267
|
-
className:
|
|
1018
|
+
className: "flex mt_5",
|
|
1268
1019
|
key: idx
|
|
1269
1020
|
}, /*#__PURE__*/React.createElement("input", {
|
|
1270
1021
|
disabled: props.disabled,
|
|
1271
1022
|
type: "text",
|
|
1272
|
-
className:
|
|
1023
|
+
className: "w_50 input",
|
|
1273
1024
|
placeholder: props.placeholderKey,
|
|
1274
1025
|
value: key,
|
|
1275
1026
|
onChange: function onChange(e) {
|
|
@@ -1278,7 +1029,7 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1278
1029
|
}), /*#__PURE__*/React.createElement("input", {
|
|
1279
1030
|
disabled: props.disabled,
|
|
1280
1031
|
type: "text",
|
|
1281
|
-
className:
|
|
1032
|
+
className: "w_50 input",
|
|
1282
1033
|
placeholder: props.placeholderValue,
|
|
1283
1034
|
value: value,
|
|
1284
1035
|
onChange: function onChange(e) {
|
|
@@ -1287,14 +1038,14 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1287
1038
|
}), /*#__PURE__*/React.createElement("button", {
|
|
1288
1039
|
disabled: props.disabled,
|
|
1289
1040
|
type: "button",
|
|
1290
|
-
className:
|
|
1041
|
+
className: "flex btn btn_red btn_sm ml_10",
|
|
1291
1042
|
onClick: function onClick() {
|
|
1292
1043
|
return remove(id);
|
|
1293
1044
|
}
|
|
1294
1045
|
}, /*#__PURE__*/React.createElement(MinusCircle, null)), idx === Object.keys(internalState).length - 1 && /*#__PURE__*/React.createElement("button", {
|
|
1295
1046
|
disabled: props.disabled,
|
|
1296
1047
|
type: "button",
|
|
1297
|
-
className:
|
|
1048
|
+
className: "flex btn btn_blue btn_sm ml_5",
|
|
1298
1049
|
onClick: addNext
|
|
1299
1050
|
}, /*#__PURE__*/React.createElement(PlusCircle, null)));
|
|
1300
1051
|
}));
|
|
@@ -28699,7 +28450,6 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28699
28450
|
};
|
|
28700
28451
|
|
|
28701
28452
|
var injectButtons = function injectButtons() {
|
|
28702
|
-
var classes = useCustomStyle();
|
|
28703
28453
|
return commands.map(function (command, idx) {
|
|
28704
28454
|
if (command.component) {
|
|
28705
28455
|
return command.component(idx);
|
|
@@ -28707,7 +28457,7 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28707
28457
|
|
|
28708
28458
|
return /*#__PURE__*/React.createElement("button", {
|
|
28709
28459
|
type: "button",
|
|
28710
|
-
className: classNames(
|
|
28460
|
+
className: classNames('btn_for_descriptionToolbar'),
|
|
28711
28461
|
"aria-label": command.name,
|
|
28712
28462
|
title: command.name,
|
|
28713
28463
|
key: "toolbar-btn-".concat(idx),
|
|
@@ -28735,7 +28485,6 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28735
28485
|
});
|
|
28736
28486
|
};
|
|
28737
28487
|
|
|
28738
|
-
var classes = useCustomStyle();
|
|
28739
28488
|
return /*#__PURE__*/React.createElement("div", {
|
|
28740
28489
|
className: classNames(props.className)
|
|
28741
28490
|
}, !props.readOnly && /*#__PURE__*/React.createElement("div", {
|
|
@@ -28744,7 +28493,7 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28744
28493
|
}
|
|
28745
28494
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
|
|
28746
28495
|
type: "button",
|
|
28747
|
-
className:
|
|
28496
|
+
className: "btn btn_sm",
|
|
28748
28497
|
style: {
|
|
28749
28498
|
color: !preview ? '#7f96af' : 'white',
|
|
28750
28499
|
backgroundColor: preview ? '#7f96af' : 'white'
|
|
@@ -28754,7 +28503,7 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28754
28503
|
}
|
|
28755
28504
|
}, "Write"), /*#__PURE__*/React.createElement("button", {
|
|
28756
28505
|
type: "button",
|
|
28757
|
-
className:
|
|
28506
|
+
className: "btn btn_sm ml_5",
|
|
28758
28507
|
style: {
|
|
28759
28508
|
color: preview ? '#7f96af' : 'white',
|
|
28760
28509
|
backgroundColor: preview ? 'white' : '#7f96af'
|
|
@@ -28763,7 +28512,7 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28763
28512
|
return setPreview(true);
|
|
28764
28513
|
}
|
|
28765
28514
|
}, "Preview"))), /*#__PURE__*/React.createElement("div", {
|
|
28766
|
-
className:
|
|
28515
|
+
className: "flex flexWrap"
|
|
28767
28516
|
}, injectButtons())), !preview && /*#__PURE__*/React.createElement(CodeInput, _extends({}, props, {
|
|
28768
28517
|
setRef: function setRef(e) {
|
|
28769
28518
|
return ref.current = e;
|
|
@@ -28963,15 +28712,14 @@ var CustomizableInput$1 = /*#__PURE__*/React.memo(function (props) {
|
|
|
28963
28712
|
return prev.field.value === next.field.value && next.errorDisplayed === prev.errorDisplayed;
|
|
28964
28713
|
});
|
|
28965
28714
|
var ControlledInput = function ControlledInput(_ref) {
|
|
28966
|
-
var
|
|
28967
|
-
step = _ref.step,
|
|
28715
|
+
var step = _ref.step,
|
|
28968
28716
|
entry = _ref.entry,
|
|
28969
28717
|
children = _ref.children,
|
|
28970
28718
|
component = _ref.component,
|
|
28971
28719
|
errorDisplayed = _ref.errorDisplayed;
|
|
28972
28720
|
|
|
28973
28721
|
var _useController = useController({
|
|
28974
|
-
defaultValue: defaultValue
|
|
28722
|
+
defaultValue: isDefined(step.defaultValue) ? step.defaultValue : null,
|
|
28975
28723
|
name: entry
|
|
28976
28724
|
}),
|
|
28977
28725
|
field = _useController.field;
|
|
@@ -29054,9 +28802,9 @@ var usePrevious = function usePrevious(value) {
|
|
|
29054
28802
|
};
|
|
29055
28803
|
|
|
29056
28804
|
var BasicWrapper = function BasicWrapper(_ref) {
|
|
29057
|
-
var entry = _ref.entry
|
|
29058
|
-
|
|
29059
|
-
label = _ref.label,
|
|
28805
|
+
var entry = _ref.entry;
|
|
28806
|
+
_ref.className;
|
|
28807
|
+
var label = _ref.label,
|
|
29060
28808
|
help = _ref.help,
|
|
29061
28809
|
children = _ref.children,
|
|
29062
28810
|
render = _ref.render;
|
|
@@ -29065,7 +28813,6 @@ var BasicWrapper = function BasicWrapper(_ref) {
|
|
|
29065
28813
|
return children;
|
|
29066
28814
|
}
|
|
29067
28815
|
|
|
29068
|
-
var classes = useCustomStyle();
|
|
29069
28816
|
var id = v4();
|
|
29070
28817
|
|
|
29071
28818
|
var _useFormContext = useFormContext(),
|
|
@@ -29093,19 +28840,19 @@ var BasicWrapper = function BasicWrapper(_ref) {
|
|
|
29093
28840
|
}
|
|
29094
28841
|
|
|
29095
28842
|
return /*#__PURE__*/React.createElement("div", {
|
|
29096
|
-
className: "
|
|
28843
|
+
className: "mt_10",
|
|
29097
28844
|
style: {
|
|
29098
28845
|
position: 'relative'
|
|
29099
28846
|
}
|
|
29100
28847
|
}, label && /*#__PURE__*/React.createElement("label", {
|
|
29101
|
-
className: "
|
|
28848
|
+
className: "flex ai_center mb_5",
|
|
29102
28849
|
htmlFor: entry
|
|
29103
28850
|
}, /*#__PURE__*/React.createElement("span", null, label), help && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ReactToolTip, {
|
|
29104
28851
|
html: true,
|
|
29105
28852
|
place: 'bottom',
|
|
29106
28853
|
id: id
|
|
29107
28854
|
}), /*#__PURE__*/React.createElement("span", {
|
|
29108
|
-
className: "
|
|
28855
|
+
className: "flex ai_center",
|
|
29109
28856
|
"data-html": true,
|
|
29110
28857
|
"data-tip": help,
|
|
29111
28858
|
"data-for": id
|
|
@@ -29117,7 +28864,7 @@ var BasicWrapper = function BasicWrapper(_ref) {
|
|
|
29117
28864
|
cursor: 'help'
|
|
29118
28865
|
}
|
|
29119
28866
|
})))), children, error && /*#__PURE__*/React.createElement("div", {
|
|
29120
|
-
className: classNames(
|
|
28867
|
+
className: classNames('feedback', _defineProperty$1({}, 'txt_red', errorDisplayed))
|
|
29121
28868
|
}, error.message));
|
|
29122
28869
|
};
|
|
29123
28870
|
|
|
@@ -29131,8 +28878,8 @@ var CustomizableInput = function CustomizableInput(props) {
|
|
|
29131
28878
|
return props.children;
|
|
29132
28879
|
};
|
|
29133
28880
|
|
|
29134
|
-
var defaultVal = function defaultVal(value, array, defaultValue) {
|
|
29135
|
-
if (
|
|
28881
|
+
var defaultVal = function defaultVal(value, array, defaultValue, type) {
|
|
28882
|
+
if (isDefined(defaultValue)) return defaultValue;
|
|
29136
28883
|
if (!!array) return [];
|
|
29137
28884
|
return value;
|
|
29138
28885
|
};
|
|
@@ -29169,9 +28916,17 @@ var cleanInputArray = function cleanInputArray(obj, defaultValues, flow, subSche
|
|
|
29169
28916
|
key = _ref5[0],
|
|
29170
28917
|
step = _ref5[1];
|
|
29171
28918
|
|
|
29172
|
-
var v;
|
|
29173
|
-
|
|
29174
|
-
if (
|
|
28919
|
+
var v = null;
|
|
28920
|
+
|
|
28921
|
+
if (obj) {
|
|
28922
|
+
v = obj[key];
|
|
28923
|
+
}
|
|
28924
|
+
|
|
28925
|
+
var maybeDefaultValue = defaultValues[key];
|
|
28926
|
+
|
|
28927
|
+
if (!v && isDefined(maybeDefaultValue)) {
|
|
28928
|
+
v = maybeDefaultValue;
|
|
28929
|
+
}
|
|
29175
28930
|
|
|
29176
28931
|
if (step.array && !step.render) {
|
|
29177
28932
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, (v || []).map(function (value) {
|
|
@@ -29253,15 +29008,12 @@ var Watcher = function Watcher(_ref6) {
|
|
|
29253
29008
|
schema = _ref6.schema,
|
|
29254
29009
|
onSubmit = _ref6.onSubmit,
|
|
29255
29010
|
handleSubmit = _ref6.handleSubmit;
|
|
29256
|
-
_ref6.getValues;
|
|
29257
|
-
_ref6.watch;
|
|
29258
29011
|
var data = useWatch({
|
|
29259
29012
|
control: control
|
|
29260
29013
|
});
|
|
29261
|
-
|
|
29262
|
-
useEffect(function () {
|
|
29014
|
+
useHashEffect(function () {
|
|
29263
29015
|
if (!!options.autosubmit) {
|
|
29264
|
-
|
|
29016
|
+
handleSubmit(function () {
|
|
29265
29017
|
onSubmit(cleanOutputArray(data, schema));
|
|
29266
29018
|
})();
|
|
29267
29019
|
}
|
|
@@ -29288,13 +29040,12 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29288
29040
|
onSubmit = _ref7.onSubmit,
|
|
29289
29041
|
_ref7$onError = _ref7.onError,
|
|
29290
29042
|
onError = _ref7$onError === void 0 ? function () {} : _ref7$onError,
|
|
29291
|
-
footer = _ref7.footer
|
|
29292
|
-
_ref7
|
|
29293
|
-
|
|
29294
|
-
className = _ref7.className,
|
|
29043
|
+
footer = _ref7.footer;
|
|
29044
|
+
_ref7.style;
|
|
29045
|
+
var className = _ref7.className,
|
|
29295
29046
|
_ref7$options = _ref7.options,
|
|
29296
29047
|
options = _ref7$options === void 0 ? {} : _ref7$options;
|
|
29297
|
-
|
|
29048
|
+
_ref7.nostyle;
|
|
29298
29049
|
var formFlow = flow || Object.keys(schema);
|
|
29299
29050
|
|
|
29300
29051
|
var maybeCustomHttpClient = function maybeCustomHttpClient(url, method) {
|
|
@@ -29333,16 +29084,15 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29333
29084
|
|
|
29334
29085
|
var _useState = useState(false),
|
|
29335
29086
|
_useState2 = _slicedToArray(_useState, 2),
|
|
29336
|
-
initialReseted = _useState2[0]
|
|
29337
|
-
|
|
29087
|
+
initialReseted = _useState2[0];
|
|
29088
|
+
_useState2[1]; // useEffect(() => {
|
|
29089
|
+
// reset(cleanInputArray(value, defaultValues, flow, schema))
|
|
29090
|
+
// setReset(true)
|
|
29091
|
+
// }, [reset])
|
|
29338
29092
|
|
|
29339
|
-
useEffect(function () {
|
|
29340
|
-
_reset(cleanInputArray(value, defaultValues, flow, schema));
|
|
29341
29093
|
|
|
29342
|
-
setReset(true);
|
|
29343
|
-
}, [_reset]);
|
|
29344
29094
|
useEffect(function () {
|
|
29345
|
-
|
|
29095
|
+
trigger();
|
|
29346
29096
|
}, [trigger, initialReseted]);
|
|
29347
29097
|
var _handleSubmit = methods.handleSubmit,
|
|
29348
29098
|
_methods$formState = methods.formState;
|
|
@@ -29352,12 +29102,8 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29352
29102
|
trigger = methods.trigger,
|
|
29353
29103
|
getValues = methods.getValues,
|
|
29354
29104
|
watch = methods.watch;
|
|
29355
|
-
|
|
29356
|
-
|
|
29357
|
-
useEffect(function () {
|
|
29358
|
-
if (!deepEqual(value, prev) || !deepEqual(schema, prevSchema)) {
|
|
29359
|
-
_reset(_objectSpread2$1({}, cleanInputArray(value, defaultValues, flow, schema)));
|
|
29360
|
-
}
|
|
29105
|
+
useHashEffect(function () {
|
|
29106
|
+
_reset(_objectSpread2$1({}, cleanInputArray(value, defaultValues, flow, schema)));
|
|
29361
29107
|
}, [value, schema]);
|
|
29362
29108
|
|
|
29363
29109
|
var functionalProperty = function functionalProperty(entry, prop) {
|
|
@@ -29395,7 +29141,7 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29395
29141
|
handleSubmit: _handleSubmit,
|
|
29396
29142
|
watch: methods.watch
|
|
29397
29143
|
}), /*#__PURE__*/React.createElement("form", {
|
|
29398
|
-
className: className || "
|
|
29144
|
+
className: className || "pr_15 w_100",
|
|
29399
29145
|
onSubmit: _handleSubmit(function (data) {
|
|
29400
29146
|
var clean = cleanOutputArray(data, schema);
|
|
29401
29147
|
onSubmit(clean);
|
|
@@ -29462,8 +29208,6 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29462
29208
|
var Footer = function Footer(props) {
|
|
29463
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;
|
|
29464
29210
|
|
|
29465
|
-
var classes = useCustomStyle();
|
|
29466
|
-
|
|
29467
29211
|
if (props.render) {
|
|
29468
29212
|
return props.render({
|
|
29469
29213
|
reset: props.reset,
|
|
@@ -29473,9 +29217,9 @@ var Footer = function Footer(props) {
|
|
|
29473
29217
|
|
|
29474
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);
|
|
29475
29219
|
return /*#__PURE__*/React.createElement("div", {
|
|
29476
|
-
className: "
|
|
29220
|
+
className: "flex jc_end mt_5"
|
|
29477
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", {
|
|
29478
|
-
className: "
|
|
29222
|
+
className: "btn btn_red",
|
|
29479
29223
|
type: "button",
|
|
29480
29224
|
onClick: function onClick() {
|
|
29481
29225
|
var _props$actions4;
|
|
@@ -29483,11 +29227,11 @@ var Footer = function Footer(props) {
|
|
|
29483
29227
|
return (_props$actions4 = props.actions) === null || _props$actions4 === void 0 ? void 0 : _props$actions4.cancel.action();
|
|
29484
29228
|
}
|
|
29485
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", {
|
|
29486
|
-
className: "
|
|
29230
|
+
className: "btn btn_red",
|
|
29487
29231
|
type: "button",
|
|
29488
29232
|
onClick: props.reset
|
|
29489
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", {
|
|
29490
|
-
className: "
|
|
29234
|
+
className: "btn btn_green ml_10",
|
|
29491
29235
|
type: "submit"
|
|
29492
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'));
|
|
29493
29237
|
};
|
|
@@ -29504,7 +29248,6 @@ var Step = function Step(_ref8) {
|
|
|
29504
29248
|
functionalProperty = _ref8.functionalProperty,
|
|
29505
29249
|
parent = _ref8.parent,
|
|
29506
29250
|
onAfterChange = _ref8.onAfterChange;
|
|
29507
|
-
var classes = useCustomStyle();
|
|
29508
29251
|
|
|
29509
29252
|
var _useFormContext2 = useFormContext(),
|
|
29510
29253
|
_useFormContext2$form = _useFormContext2.formState,
|
|
@@ -29662,7 +29405,7 @@ var Step = function Step(_ref8) {
|
|
|
29662
29405
|
errorDisplayed: errorDisplayed
|
|
29663
29406
|
}, /*#__PURE__*/React.createElement("textarea", {
|
|
29664
29407
|
type: "text",
|
|
29665
|
-
className: classNames(
|
|
29408
|
+
className: classNames('input', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29666
29409
|
}));
|
|
29667
29410
|
|
|
29668
29411
|
case format.code:
|
|
@@ -29674,7 +29417,7 @@ var Step = function Step(_ref8) {
|
|
|
29674
29417
|
entry: entry,
|
|
29675
29418
|
errorDisplayed: errorDisplayed
|
|
29676
29419
|
}, /*#__PURE__*/React.createElement(Component, {
|
|
29677
|
-
className: classNames(_defineProperty$1({},
|
|
29420
|
+
className: classNames(step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29678
29421
|
}));
|
|
29679
29422
|
|
|
29680
29423
|
case format.markdown:
|
|
@@ -29684,7 +29427,7 @@ var Step = function Step(_ref8) {
|
|
|
29684
29427
|
entry: entry,
|
|
29685
29428
|
errorDisplayed: errorDisplayed
|
|
29686
29429
|
}, /*#__PURE__*/React.createElement(MarkdownInput, {
|
|
29687
|
-
className: classNames(_defineProperty$1({},
|
|
29430
|
+
className: classNames(step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29688
29431
|
}));
|
|
29689
29432
|
|
|
29690
29433
|
case format.buttonsSelect:
|
|
@@ -29695,9 +29438,10 @@ var Step = function Step(_ref8) {
|
|
|
29695
29438
|
step: step,
|
|
29696
29439
|
entry: entry,
|
|
29697
29440
|
errorDisplayed: errorDisplayed
|
|
29698
|
-
}, /*#__PURE__*/React.createElement(SelectInput, {
|
|
29699
|
-
className: classNames(
|
|
29700
|
-
disabled: functionalProperty(entry, step.disabled)
|
|
29441
|
+
}, /*#__PURE__*/React.createElement(SelectInput, _extends({
|
|
29442
|
+
className: classNames('flex_grow_1', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed)),
|
|
29443
|
+
disabled: functionalProperty(entry, step.disabled)
|
|
29444
|
+
}, step.props, {
|
|
29701
29445
|
possibleValues: step.options,
|
|
29702
29446
|
httpClient: httpClient,
|
|
29703
29447
|
isMulti: step.isMulti,
|
|
@@ -29705,7 +29449,7 @@ var Step = function Step(_ref8) {
|
|
|
29705
29449
|
transformer: step.transformer,
|
|
29706
29450
|
buttons: step.format === format.buttonsSelect,
|
|
29707
29451
|
optionsFrom: step.optionsFrom
|
|
29708
|
-
}));
|
|
29452
|
+
})));
|
|
29709
29453
|
}
|
|
29710
29454
|
|
|
29711
29455
|
default:
|
|
@@ -29716,7 +29460,7 @@ var Step = function Step(_ref8) {
|
|
|
29716
29460
|
errorDisplayed: errorDisplayed
|
|
29717
29461
|
}, /*#__PURE__*/React.createElement("input", {
|
|
29718
29462
|
type: step.format || 'text',
|
|
29719
|
-
className: classNames(
|
|
29463
|
+
className: classNames('input', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29720
29464
|
}));
|
|
29721
29465
|
}
|
|
29722
29466
|
|
|
@@ -29729,8 +29473,9 @@ var Step = function Step(_ref8) {
|
|
|
29729
29473
|
step: step,
|
|
29730
29474
|
entry: entry,
|
|
29731
29475
|
errorDisplayed: errorDisplayed
|
|
29732
|
-
}, /*#__PURE__*/React.createElement(SelectInput, {
|
|
29733
|
-
className: classNames(
|
|
29476
|
+
}, /*#__PURE__*/React.createElement(SelectInput, _extends({
|
|
29477
|
+
className: classNames('content', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29478
|
+
}, step.props, {
|
|
29734
29479
|
possibleValues: step.options,
|
|
29735
29480
|
httpClient: httpClient,
|
|
29736
29481
|
isMulti: step.isMulti,
|
|
@@ -29739,7 +29484,7 @@ var Step = function Step(_ref8) {
|
|
|
29739
29484
|
transformer: step.transformer,
|
|
29740
29485
|
buttons: step.format === format.buttonsSelect,
|
|
29741
29486
|
optionsFrom: step.optionsFrom
|
|
29742
|
-
}));
|
|
29487
|
+
})));
|
|
29743
29488
|
|
|
29744
29489
|
default:
|
|
29745
29490
|
return /*#__PURE__*/React.createElement(ControlledInput, {
|
|
@@ -29749,18 +29494,17 @@ var Step = function Step(_ref8) {
|
|
|
29749
29494
|
errorDisplayed: errorDisplayed
|
|
29750
29495
|
}, /*#__PURE__*/React.createElement("input", {
|
|
29751
29496
|
type: step.format || 'number',
|
|
29752
|
-
className: classNames(
|
|
29497
|
+
className: classNames('input', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29753
29498
|
}));
|
|
29754
29499
|
}
|
|
29755
29500
|
|
|
29756
29501
|
case type.bool:
|
|
29757
29502
|
return /*#__PURE__*/React.createElement(ControlledInput, {
|
|
29758
|
-
defaultValue: defaultValue,
|
|
29759
29503
|
step: step,
|
|
29760
29504
|
entry: entry,
|
|
29761
29505
|
errorDisplayed: errorDisplayed
|
|
29762
29506
|
}, /*#__PURE__*/React.createElement(BooleanInput, {
|
|
29763
|
-
className: classNames(_defineProperty$1({},
|
|
29507
|
+
className: classNames(step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29764
29508
|
}));
|
|
29765
29509
|
|
|
29766
29510
|
case type.object:
|
|
@@ -29772,8 +29516,9 @@ var Step = function Step(_ref8) {
|
|
|
29772
29516
|
step: step,
|
|
29773
29517
|
entry: entry,
|
|
29774
29518
|
errorDisplayed: errorDisplayed
|
|
29775
|
-
}, /*#__PURE__*/React.createElement(SelectInput, {
|
|
29776
|
-
className: classNames(
|
|
29519
|
+
}, /*#__PURE__*/React.createElement(SelectInput, _extends({
|
|
29520
|
+
className: classNames('flex_grow_1', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29521
|
+
}, step.props, {
|
|
29777
29522
|
possibleValues: step.options,
|
|
29778
29523
|
httpClient: httpClient,
|
|
29779
29524
|
isMulti: step.isMulti,
|
|
@@ -29782,7 +29527,7 @@ var Step = function Step(_ref8) {
|
|
|
29782
29527
|
transformer: step.transformer,
|
|
29783
29528
|
buttons: step.format === format.buttonsSelect,
|
|
29784
29529
|
optionsFrom: step.optionsFrom
|
|
29785
|
-
}));
|
|
29530
|
+
})));
|
|
29786
29531
|
|
|
29787
29532
|
case format.form:
|
|
29788
29533
|
//todo: disabled ?
|
|
@@ -29825,7 +29570,7 @@ var Step = function Step(_ref8) {
|
|
|
29825
29570
|
errorDisplayed: errorDisplayed,
|
|
29826
29571
|
component: function component(field, props) {
|
|
29827
29572
|
return /*#__PURE__*/React.createElement(CodeInput, _extends({}, props, {
|
|
29828
|
-
className: classNames(_defineProperty$1({},
|
|
29573
|
+
className: classNames(step.className, _defineProperty$1({}, 'input__invalid', error)),
|
|
29829
29574
|
onChange: function onChange(e) {
|
|
29830
29575
|
_readOnlyError("errorDisplayed");
|
|
29831
29576
|
var v;
|
|
@@ -29857,7 +29602,7 @@ var Step = function Step(_ref8) {
|
|
|
29857
29602
|
entry: entry,
|
|
29858
29603
|
errorDisplayed: errorDisplayed
|
|
29859
29604
|
}, /*#__PURE__*/React.createElement(ObjectInput, {
|
|
29860
|
-
className: classNames(_defineProperty$1({},
|
|
29605
|
+
className: classNames(step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29861
29606
|
}));
|
|
29862
29607
|
}
|
|
29863
29608
|
|
|
@@ -29868,7 +29613,7 @@ var Step = function Step(_ref8) {
|
|
|
29868
29613
|
entry: entry,
|
|
29869
29614
|
errorDisplayed: errorDisplayed
|
|
29870
29615
|
}, /*#__PURE__*/React.createElement(DatePicker, {
|
|
29871
|
-
className: classNames(
|
|
29616
|
+
className: classNames('datepicker', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed)),
|
|
29872
29617
|
formatStyle: "large"
|
|
29873
29618
|
}));
|
|
29874
29619
|
|
|
@@ -29905,24 +29650,24 @@ var Step = function Step(_ref8) {
|
|
|
29905
29650
|
|
|
29906
29651
|
var files = field.value || [];
|
|
29907
29652
|
return /*#__PURE__*/React.createElement("div", {
|
|
29908
|
-
className: classNames(
|
|
29653
|
+
className: classNames('flex', 'ai_center', step.className, _defineProperty$1({}, 'input__invalid', error))
|
|
29909
29654
|
}, /*#__PURE__*/React.createElement("input", {
|
|
29910
29655
|
ref: function ref(r) {
|
|
29911
29656
|
return setInput(r);
|
|
29912
29657
|
},
|
|
29913
29658
|
type: "file",
|
|
29914
29659
|
multiple: true,
|
|
29915
|
-
className:
|
|
29660
|
+
className: 'd_none',
|
|
29916
29661
|
onChange: setFiles
|
|
29917
29662
|
}), /*#__PURE__*/React.createElement("button", {
|
|
29918
29663
|
type: "button",
|
|
29919
|
-
className: "
|
|
29664
|
+
className: "btn btn_sm flex ai_center",
|
|
29920
29665
|
disabled: uploading || functionalProperty(entry, step.disabled),
|
|
29921
29666
|
onClick: trigger
|
|
29922
29667
|
}, uploading && /*#__PURE__*/React.createElement(Loader, null), !uploading && /*#__PURE__*/React.createElement(Upload, null), /*#__PURE__*/React.createElement("span", {
|
|
29923
|
-
className: ""
|
|
29668
|
+
className: "ml_5"
|
|
29924
29669
|
}, "Select file(s)")), /*#__PURE__*/React.createElement("span", {
|
|
29925
|
-
className: ""
|
|
29670
|
+
className: "ml_5"
|
|
29926
29671
|
}, files.length <= 0 ? 'No files selected' : files.map(function (r) {
|
|
29927
29672
|
return r.name;
|
|
29928
29673
|
}).join(" , ")));
|
|
@@ -29944,7 +29689,7 @@ var Step = function Step(_ref8) {
|
|
|
29944
29689
|
entry: entry,
|
|
29945
29690
|
component: function component(field, props) {
|
|
29946
29691
|
return /*#__PURE__*/React.createElement(CodeInput, _extends({}, props, {
|
|
29947
|
-
className: classNames(_defineProperty$1({},
|
|
29692
|
+
className: classNames(_defineProperty$1({}, 'input__invalid', error)),
|
|
29948
29693
|
onChange: function onChange(v) {
|
|
29949
29694
|
field.onChange(v);
|
|
29950
29695
|
option(step.onChange).map(function (onChange) {
|
|
@@ -29970,7 +29715,6 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
29970
29715
|
step = _ref11.step,
|
|
29971
29716
|
component = _ref11.component,
|
|
29972
29717
|
disabled = _ref11.disabled;
|
|
29973
|
-
var classes = useCustomStyle();
|
|
29974
29718
|
|
|
29975
29719
|
var _useFormContext3 = useFormContext(),
|
|
29976
29720
|
getValues = _useFormContext3.getValues,
|
|
@@ -30003,7 +29747,7 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
30003
29747
|
return /*#__PURE__*/React.createElement("div", {
|
|
30004
29748
|
key: field.id
|
|
30005
29749
|
}, /*#__PURE__*/React.createElement("div", {
|
|
30006
|
-
className: classNames(
|
|
29750
|
+
className: classNames('ai_center', 'mt_5'),
|
|
30007
29751
|
style: {
|
|
30008
29752
|
position: 'relative'
|
|
30009
29753
|
}
|
|
@@ -30022,7 +29766,7 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
30022
29766
|
top: '2px',
|
|
30023
29767
|
right: 0
|
|
30024
29768
|
},
|
|
30025
|
-
className: classNames(
|
|
29769
|
+
className: classNames('btn', 'btn_red', 'btn_sm', 'ml_5'),
|
|
30026
29770
|
disabled: disabled,
|
|
30027
29771
|
onClick: function onClick() {
|
|
30028
29772
|
remove(idx);
|
|
@@ -30032,10 +29776,10 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
30032
29776
|
size: 16
|
|
30033
29777
|
}))));
|
|
30034
29778
|
}), /*#__PURE__*/React.createElement("div", {
|
|
30035
|
-
className: classNames(
|
|
29779
|
+
className: classNames('flex', 'jc_flex_end')
|
|
30036
29780
|
}, /*#__PURE__*/React.createElement("button", {
|
|
30037
29781
|
type: "button",
|
|
30038
|
-
className: classNames(
|
|
29782
|
+
className: classNames('btn', 'btn_blue', 'btn_sm', 'mt_5', _defineProperty$1({}, 'input__invalid', errorDisplayed)),
|
|
30039
29783
|
onClick: function onClick() {
|
|
30040
29784
|
var newValue = cleanInputArray({}, getValues(entry), step.flow, step.schema);
|
|
30041
29785
|
append({
|
|
@@ -30080,17 +29824,16 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30080
29824
|
collapsed = _useState8[0],
|
|
30081
29825
|
setCollapsed = _useState8[1];
|
|
30082
29826
|
|
|
30083
|
-
var classes = useCustomStyle();
|
|
30084
29827
|
useWatch(step === null || step === void 0 ? void 0 : (_step$conditionalSche = step.conditionalSchema) === null || _step$conditionalSche === void 0 ? void 0 : _step$conditionalSche.ref);
|
|
30085
29828
|
var schemaAndFlow = option(step.conditionalSchema).map(function (condiSchema) {
|
|
30086
29829
|
var ref = option(condiSchema.ref).map(function (ref) {
|
|
30087
29830
|
return getValues(ref);
|
|
30088
29831
|
}).getOrNull();
|
|
30089
|
-
var
|
|
29832
|
+
var rawValues = getValues();
|
|
30090
29833
|
var filterSwitch = condiSchema["switch"].find(function (s) {
|
|
30091
29834
|
if (typeof s.condition === 'function') {
|
|
30092
29835
|
return s.condition({
|
|
30093
|
-
|
|
29836
|
+
rawValues: rawValues,
|
|
30094
29837
|
ref: ref
|
|
30095
29838
|
});
|
|
30096
29839
|
} else {
|
|
@@ -30111,15 +29854,12 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30111
29854
|
schema: schema,
|
|
30112
29855
|
flow: flow
|
|
30113
29856
|
});
|
|
30114
|
-
|
|
30115
|
-
|
|
30116
|
-
|
|
30117
|
-
|
|
30118
|
-
|
|
30119
|
-
|
|
30120
|
-
});
|
|
30121
|
-
}
|
|
30122
|
-
}, [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]);
|
|
30123
29863
|
var computedSandF = schemaAndFlow.flow.reduce(function (acc, entry) {
|
|
30124
29864
|
var step = schemaAndFlow.schema[entry];
|
|
30125
29865
|
var visibleStep = option(step).map(function (s) {
|
|
@@ -30150,13 +29890,13 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30150
29890
|
return x.visibleStep;
|
|
30151
29891
|
}).length >= 1 && step.label !== null;
|
|
30152
29892
|
return /*#__PURE__*/React.createElement("div", {
|
|
30153
|
-
className: classNames((_classNames17 = {}, _defineProperty$1(_classNames17,
|
|
29893
|
+
className: classNames((_classNames17 = {}, _defineProperty$1(_classNames17, 'nestedform__border', bordered), _defineProperty$1(_classNames17, 'border__error', !!errorDisplayed), _classNames17)),
|
|
30154
29894
|
style: {
|
|
30155
29895
|
position: 'relative'
|
|
30156
29896
|
}
|
|
30157
29897
|
}, !!step.collapsable && schemaAndFlow.flow.length > 1 && collapsed && /*#__PURE__*/React.createElement(ChevronDown, {
|
|
30158
29898
|
size: 30,
|
|
30159
|
-
className:
|
|
29899
|
+
className: 'cursor_pointer',
|
|
30160
29900
|
style: {
|
|
30161
29901
|
position: 'absolute',
|
|
30162
29902
|
top: -35,
|
|
@@ -30169,7 +29909,7 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30169
29909
|
}
|
|
30170
29910
|
}), !!step.collapsable && schemaAndFlow.flow.length > 1 && !collapsed && /*#__PURE__*/React.createElement(ChevronUp, {
|
|
30171
29911
|
size: 30,
|
|
30172
|
-
className:
|
|
29912
|
+
className: 'cursor_pointer',
|
|
30173
29913
|
style: {
|
|
30174
29914
|
position: 'absolute',
|
|
30175
29915
|
top: -35,
|
|
@@ -30192,7 +29932,7 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30192
29932
|
|
|
30193
29933
|
return /*#__PURE__*/React.createElement(BasicWrapper, {
|
|
30194
29934
|
key: "".concat(entry, ".").concat(idx),
|
|
30195
|
-
className: classNames(_defineProperty$1({},
|
|
29935
|
+
className: classNames(_defineProperty$1({}, 'display__none', collapsed && !step.visibleOnCollapse || !visibleStep)),
|
|
30196
29936
|
entry: "".concat(parent, ".").concat(entry),
|
|
30197
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),
|
|
30198
29938
|
help: step.help,
|