@maif/react-forms 1.0.54 → 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 +41 -9
- package/lib/esm/index.js +182 -418
- package/lib/index.css +360 -0
- package/lib/index.js +182 -417
- 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
|
-
import {
|
|
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] : [];
|
|
@@ -970,7 +725,9 @@ var valueToSelectOption = function valueToSelectOption(value) {
|
|
|
970
725
|
};
|
|
971
726
|
|
|
972
727
|
var SelectInput = /*#__PURE__*/React.forwardRef(function (props, _) {
|
|
973
|
-
var
|
|
728
|
+
var _useFormContext = useFormContext(),
|
|
729
|
+
getValues = _useFormContext.getValues;
|
|
730
|
+
|
|
974
731
|
var possibleValues = (props.possibleValues || []).map(function (v) {
|
|
975
732
|
return props.transformer ? typeof props.transformer === 'function' ? props.transformer(v) : {
|
|
976
733
|
label: v[props.transformer.label],
|
|
@@ -1009,9 +766,24 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function (props, _) {
|
|
|
1009
766
|
|
|
1010
767
|
if (cond) {
|
|
1011
768
|
setLoading(true);
|
|
1012
|
-
var promise
|
|
1013
|
-
|
|
1014
|
-
|
|
769
|
+
var promise;
|
|
770
|
+
|
|
771
|
+
if (isPromise(props.optionsFrom)) {
|
|
772
|
+
promise = props.optionsFrom;
|
|
773
|
+
} else if (typeof props.optionsFrom === 'function') {
|
|
774
|
+
var result = props.optionsFrom({
|
|
775
|
+
rawValues: getValues(),
|
|
776
|
+
value: getValues(props.id)
|
|
777
|
+
});
|
|
778
|
+
promise = isPromise(result) ? result : props.httpClient(result, 'GET').then(function (r) {
|
|
779
|
+
return r.json();
|
|
780
|
+
});
|
|
781
|
+
} else {
|
|
782
|
+
promise = props.httpClient(props.optionsFrom, 'GET').then(function (r) {
|
|
783
|
+
return r.json();
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
|
|
1015
787
|
promise.then(function (values) {
|
|
1016
788
|
return values.map(function (x) {
|
|
1017
789
|
return props.transformer ? props.transformer(x) : valueToSelectOption(x, values, props.isMulti, props.transformer);
|
|
@@ -1081,7 +853,7 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function (props, _) {
|
|
|
1081
853
|
key: idx,
|
|
1082
854
|
type: "button",
|
|
1083
855
|
disabled: props.disabled,
|
|
1084
|
-
className: classNames(props.className,
|
|
856
|
+
className: classNames(props.className, 'btn btn_grey ml_5', {
|
|
1085
857
|
active: active
|
|
1086
858
|
}),
|
|
1087
859
|
onClick: function onClick() {
|
|
@@ -1098,7 +870,6 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function (props, _) {
|
|
|
1098
870
|
value: value,
|
|
1099
871
|
isDisabled: props.disabled,
|
|
1100
872
|
placeholder: props.placeholder,
|
|
1101
|
-
isClearable: true,
|
|
1102
873
|
onChange: onChange,
|
|
1103
874
|
options: values,
|
|
1104
875
|
onCreateOption: function onCreateOption(option) {
|
|
@@ -1113,7 +884,6 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function (props, _) {
|
|
|
1113
884
|
name: "".concat(props.label, "-search"),
|
|
1114
885
|
isLoading: loading,
|
|
1115
886
|
value: value,
|
|
1116
|
-
isClearable: true,
|
|
1117
887
|
defaultValue: value,
|
|
1118
888
|
isDisabled: props.disabled,
|
|
1119
889
|
placeholder: props.placeholder,
|
|
@@ -1230,13 +1000,12 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1230
1000
|
onChange(newState);
|
|
1231
1001
|
};
|
|
1232
1002
|
|
|
1233
|
-
var classes = useCustomStyle();
|
|
1234
1003
|
return /*#__PURE__*/React.createElement("div", {
|
|
1235
1004
|
className: props.className
|
|
1236
1005
|
}, Object.keys(internalState || {}).length === 0 && /*#__PURE__*/React.createElement("button", {
|
|
1237
1006
|
disabled: props.disabled,
|
|
1238
1007
|
type: "button",
|
|
1239
|
-
className:
|
|
1008
|
+
className: "flex btn btn_blue btn_sm",
|
|
1240
1009
|
onClick: addFirst
|
|
1241
1010
|
}, /*#__PURE__*/React.createElement(PlusCircle, null)), Object.entries(internalState || {}).map(function (_ref9, idx) {
|
|
1242
1011
|
var _ref10 = _slicedToArray(_ref9, 2),
|
|
@@ -1246,12 +1015,12 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1246
1015
|
value = _ref10$.value;
|
|
1247
1016
|
|
|
1248
1017
|
return /*#__PURE__*/React.createElement("div", {
|
|
1249
|
-
className:
|
|
1018
|
+
className: "flex mt_5",
|
|
1250
1019
|
key: idx
|
|
1251
1020
|
}, /*#__PURE__*/React.createElement("input", {
|
|
1252
1021
|
disabled: props.disabled,
|
|
1253
1022
|
type: "text",
|
|
1254
|
-
className:
|
|
1023
|
+
className: "w_50 input",
|
|
1255
1024
|
placeholder: props.placeholderKey,
|
|
1256
1025
|
value: key,
|
|
1257
1026
|
onChange: function onChange(e) {
|
|
@@ -1260,7 +1029,7 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1260
1029
|
}), /*#__PURE__*/React.createElement("input", {
|
|
1261
1030
|
disabled: props.disabled,
|
|
1262
1031
|
type: "text",
|
|
1263
|
-
className:
|
|
1032
|
+
className: "w_50 input",
|
|
1264
1033
|
placeholder: props.placeholderValue,
|
|
1265
1034
|
value: value,
|
|
1266
1035
|
onChange: function onChange(e) {
|
|
@@ -1269,14 +1038,14 @@ var ObjectInput = function ObjectInput(props) {
|
|
|
1269
1038
|
}), /*#__PURE__*/React.createElement("button", {
|
|
1270
1039
|
disabled: props.disabled,
|
|
1271
1040
|
type: "button",
|
|
1272
|
-
className:
|
|
1041
|
+
className: "flex btn btn_red btn_sm ml_10",
|
|
1273
1042
|
onClick: function onClick() {
|
|
1274
1043
|
return remove(id);
|
|
1275
1044
|
}
|
|
1276
1045
|
}, /*#__PURE__*/React.createElement(MinusCircle, null)), idx === Object.keys(internalState).length - 1 && /*#__PURE__*/React.createElement("button", {
|
|
1277
1046
|
disabled: props.disabled,
|
|
1278
1047
|
type: "button",
|
|
1279
|
-
className:
|
|
1048
|
+
className: "flex btn btn_blue btn_sm ml_5",
|
|
1280
1049
|
onClick: addNext
|
|
1281
1050
|
}, /*#__PURE__*/React.createElement(PlusCircle, null)));
|
|
1282
1051
|
}));
|
|
@@ -28681,7 +28450,6 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28681
28450
|
};
|
|
28682
28451
|
|
|
28683
28452
|
var injectButtons = function injectButtons() {
|
|
28684
|
-
var classes = useCustomStyle();
|
|
28685
28453
|
return commands.map(function (command, idx) {
|
|
28686
28454
|
if (command.component) {
|
|
28687
28455
|
return command.component(idx);
|
|
@@ -28689,7 +28457,7 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28689
28457
|
|
|
28690
28458
|
return /*#__PURE__*/React.createElement("button", {
|
|
28691
28459
|
type: "button",
|
|
28692
|
-
className: classNames(
|
|
28460
|
+
className: classNames('btn_for_descriptionToolbar'),
|
|
28693
28461
|
"aria-label": command.name,
|
|
28694
28462
|
title: command.name,
|
|
28695
28463
|
key: "toolbar-btn-".concat(idx),
|
|
@@ -28717,7 +28485,6 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28717
28485
|
});
|
|
28718
28486
|
};
|
|
28719
28487
|
|
|
28720
|
-
var classes = useCustomStyle();
|
|
28721
28488
|
return /*#__PURE__*/React.createElement("div", {
|
|
28722
28489
|
className: classNames(props.className)
|
|
28723
28490
|
}, !props.readOnly && /*#__PURE__*/React.createElement("div", {
|
|
@@ -28726,7 +28493,7 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28726
28493
|
}
|
|
28727
28494
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
|
|
28728
28495
|
type: "button",
|
|
28729
|
-
className:
|
|
28496
|
+
className: "btn btn_sm",
|
|
28730
28497
|
style: {
|
|
28731
28498
|
color: !preview ? '#7f96af' : 'white',
|
|
28732
28499
|
backgroundColor: preview ? '#7f96af' : 'white'
|
|
@@ -28736,7 +28503,7 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28736
28503
|
}
|
|
28737
28504
|
}, "Write"), /*#__PURE__*/React.createElement("button", {
|
|
28738
28505
|
type: "button",
|
|
28739
|
-
className:
|
|
28506
|
+
className: "btn btn_sm ml_5",
|
|
28740
28507
|
style: {
|
|
28741
28508
|
color: preview ? '#7f96af' : 'white',
|
|
28742
28509
|
backgroundColor: preview ? 'white' : '#7f96af'
|
|
@@ -28745,7 +28512,7 @@ var MarkdownInput = function MarkdownInput(props) {
|
|
|
28745
28512
|
return setPreview(true);
|
|
28746
28513
|
}
|
|
28747
28514
|
}, "Preview"))), /*#__PURE__*/React.createElement("div", {
|
|
28748
|
-
className:
|
|
28515
|
+
className: "flex flexWrap"
|
|
28749
28516
|
}, injectButtons())), !preview && /*#__PURE__*/React.createElement(CodeInput, _extends({}, props, {
|
|
28750
28517
|
setRef: function setRef(e) {
|
|
28751
28518
|
return ref.current = e;
|
|
@@ -28945,15 +28712,14 @@ var CustomizableInput$1 = /*#__PURE__*/React.memo(function (props) {
|
|
|
28945
28712
|
return prev.field.value === next.field.value && next.errorDisplayed === prev.errorDisplayed;
|
|
28946
28713
|
});
|
|
28947
28714
|
var ControlledInput = function ControlledInput(_ref) {
|
|
28948
|
-
var
|
|
28949
|
-
step = _ref.step,
|
|
28715
|
+
var step = _ref.step,
|
|
28950
28716
|
entry = _ref.entry,
|
|
28951
28717
|
children = _ref.children,
|
|
28952
28718
|
component = _ref.component,
|
|
28953
28719
|
errorDisplayed = _ref.errorDisplayed;
|
|
28954
28720
|
|
|
28955
28721
|
var _useController = useController({
|
|
28956
|
-
defaultValue: defaultValue
|
|
28722
|
+
defaultValue: isDefined(step.defaultValue) ? step.defaultValue : null,
|
|
28957
28723
|
name: entry
|
|
28958
28724
|
}),
|
|
28959
28725
|
field = _useController.field;
|
|
@@ -29036,9 +28802,9 @@ var usePrevious = function usePrevious(value) {
|
|
|
29036
28802
|
};
|
|
29037
28803
|
|
|
29038
28804
|
var BasicWrapper = function BasicWrapper(_ref) {
|
|
29039
|
-
var entry = _ref.entry
|
|
29040
|
-
|
|
29041
|
-
label = _ref.label,
|
|
28805
|
+
var entry = _ref.entry;
|
|
28806
|
+
_ref.className;
|
|
28807
|
+
var label = _ref.label,
|
|
29042
28808
|
help = _ref.help,
|
|
29043
28809
|
children = _ref.children,
|
|
29044
28810
|
render = _ref.render;
|
|
@@ -29047,7 +28813,6 @@ var BasicWrapper = function BasicWrapper(_ref) {
|
|
|
29047
28813
|
return children;
|
|
29048
28814
|
}
|
|
29049
28815
|
|
|
29050
|
-
var classes = useCustomStyle();
|
|
29051
28816
|
var id = v4();
|
|
29052
28817
|
|
|
29053
28818
|
var _useFormContext = useFormContext(),
|
|
@@ -29075,19 +28840,19 @@ var BasicWrapper = function BasicWrapper(_ref) {
|
|
|
29075
28840
|
}
|
|
29076
28841
|
|
|
29077
28842
|
return /*#__PURE__*/React.createElement("div", {
|
|
29078
|
-
className: "
|
|
28843
|
+
className: "mt_10",
|
|
29079
28844
|
style: {
|
|
29080
28845
|
position: 'relative'
|
|
29081
28846
|
}
|
|
29082
28847
|
}, label && /*#__PURE__*/React.createElement("label", {
|
|
29083
|
-
className: "
|
|
28848
|
+
className: "flex ai_center mb_5",
|
|
29084
28849
|
htmlFor: entry
|
|
29085
28850
|
}, /*#__PURE__*/React.createElement("span", null, label), help && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ReactToolTip, {
|
|
29086
28851
|
html: true,
|
|
29087
28852
|
place: 'bottom',
|
|
29088
28853
|
id: id
|
|
29089
28854
|
}), /*#__PURE__*/React.createElement("span", {
|
|
29090
|
-
className: "
|
|
28855
|
+
className: "flex ai_center",
|
|
29091
28856
|
"data-html": true,
|
|
29092
28857
|
"data-tip": help,
|
|
29093
28858
|
"data-for": id
|
|
@@ -29099,7 +28864,7 @@ var BasicWrapper = function BasicWrapper(_ref) {
|
|
|
29099
28864
|
cursor: 'help'
|
|
29100
28865
|
}
|
|
29101
28866
|
})))), children, error && /*#__PURE__*/React.createElement("div", {
|
|
29102
|
-
className: classNames(
|
|
28867
|
+
className: classNames('feedback', _defineProperty$1({}, 'txt_red', errorDisplayed))
|
|
29103
28868
|
}, error.message));
|
|
29104
28869
|
};
|
|
29105
28870
|
|
|
@@ -29113,8 +28878,8 @@ var CustomizableInput = function CustomizableInput(props) {
|
|
|
29113
28878
|
return props.children;
|
|
29114
28879
|
};
|
|
29115
28880
|
|
|
29116
|
-
var defaultVal = function defaultVal(value, array, defaultValue) {
|
|
29117
|
-
if (
|
|
28881
|
+
var defaultVal = function defaultVal(value, array, defaultValue, type) {
|
|
28882
|
+
if (isDefined(defaultValue)) return defaultValue;
|
|
29118
28883
|
if (!!array) return [];
|
|
29119
28884
|
return value;
|
|
29120
28885
|
};
|
|
@@ -29151,9 +28916,17 @@ var cleanInputArray = function cleanInputArray(obj, defaultValues, flow, subSche
|
|
|
29151
28916
|
key = _ref5[0],
|
|
29152
28917
|
step = _ref5[1];
|
|
29153
28918
|
|
|
29154
|
-
var v;
|
|
29155
|
-
|
|
29156
|
-
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
|
+
}
|
|
29157
28930
|
|
|
29158
28931
|
if (step.array && !step.render) {
|
|
29159
28932
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, (v || []).map(function (value) {
|
|
@@ -29235,15 +29008,12 @@ var Watcher = function Watcher(_ref6) {
|
|
|
29235
29008
|
schema = _ref6.schema,
|
|
29236
29009
|
onSubmit = _ref6.onSubmit,
|
|
29237
29010
|
handleSubmit = _ref6.handleSubmit;
|
|
29238
|
-
_ref6.getValues;
|
|
29239
|
-
_ref6.watch;
|
|
29240
29011
|
var data = useWatch({
|
|
29241
29012
|
control: control
|
|
29242
29013
|
});
|
|
29243
|
-
|
|
29244
|
-
useEffect(function () {
|
|
29014
|
+
useHashEffect(function () {
|
|
29245
29015
|
if (!!options.autosubmit) {
|
|
29246
|
-
|
|
29016
|
+
handleSubmit(function () {
|
|
29247
29017
|
onSubmit(cleanOutputArray(data, schema));
|
|
29248
29018
|
})();
|
|
29249
29019
|
}
|
|
@@ -29270,14 +29040,19 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29270
29040
|
onSubmit = _ref7.onSubmit,
|
|
29271
29041
|
_ref7$onError = _ref7.onError,
|
|
29272
29042
|
onError = _ref7$onError === void 0 ? function () {} : _ref7$onError,
|
|
29273
|
-
footer = _ref7.footer
|
|
29274
|
-
_ref7
|
|
29275
|
-
|
|
29276
|
-
className = _ref7.className,
|
|
29043
|
+
footer = _ref7.footer;
|
|
29044
|
+
_ref7.style;
|
|
29045
|
+
var className = _ref7.className,
|
|
29277
29046
|
_ref7$options = _ref7.options,
|
|
29278
29047
|
options = _ref7$options === void 0 ? {} : _ref7$options;
|
|
29279
|
-
|
|
29280
|
-
|
|
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);
|
|
29281
29056
|
|
|
29282
29057
|
var maybeCustomHttpClient = function maybeCustomHttpClient(url, method) {
|
|
29283
29058
|
//todo: if present props.resolve()
|
|
@@ -29294,7 +29069,7 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29294
29069
|
});
|
|
29295
29070
|
};
|
|
29296
29071
|
|
|
29297
|
-
var defaultValues = getDefaultValues(formFlow,
|
|
29072
|
+
var defaultValues = getDefaultValues(formFlow, calcSchema, value); //FIXME: get real schema through the switch
|
|
29298
29073
|
|
|
29299
29074
|
var _resolver = function resolver(rawData) {
|
|
29300
29075
|
var _getShapeAndDependenc2 = getShapeAndDependencies(formFlow, schema, [], rawData),
|
|
@@ -29313,18 +29088,17 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29313
29088
|
mode: 'onChange'
|
|
29314
29089
|
});
|
|
29315
29090
|
|
|
29316
|
-
var
|
|
29317
|
-
|
|
29318
|
-
initialReseted =
|
|
29319
|
-
|
|
29091
|
+
var _useState3 = useState(false),
|
|
29092
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
29093
|
+
initialReseted = _useState4[0];
|
|
29094
|
+
_useState4[1]; // useEffect(() => {
|
|
29095
|
+
// reset(cleanInputArray(value, defaultValues, flow, schema))
|
|
29096
|
+
// setReset(true)
|
|
29097
|
+
// }, [reset])
|
|
29320
29098
|
|
|
29321
|
-
useEffect(function () {
|
|
29322
|
-
_reset(cleanInputArray(value, defaultValues, flow, schema));
|
|
29323
29099
|
|
|
29324
|
-
setReset(true);
|
|
29325
|
-
}, [_reset]);
|
|
29326
29100
|
useEffect(function () {
|
|
29327
|
-
|
|
29101
|
+
trigger();
|
|
29328
29102
|
}, [trigger, initialReseted]);
|
|
29329
29103
|
var _handleSubmit = methods.handleSubmit,
|
|
29330
29104
|
_methods$formState = methods.formState;
|
|
@@ -29334,13 +29108,9 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29334
29108
|
trigger = methods.trigger,
|
|
29335
29109
|
getValues = methods.getValues,
|
|
29336
29110
|
watch = methods.watch;
|
|
29337
|
-
|
|
29338
|
-
|
|
29339
|
-
|
|
29340
|
-
if (!deepEqual(value, prev) || !deepEqual(schema, prevSchema)) {
|
|
29341
|
-
_reset(_objectSpread2$1({}, cleanInputArray(value, defaultValues, flow, schema)));
|
|
29342
|
-
}
|
|
29343
|
-
}, [value, schema]);
|
|
29111
|
+
useHashEffect(function () {
|
|
29112
|
+
_reset(_objectSpread2$1({}, cleanInputArray(value, defaultValues, flow, schema)));
|
|
29113
|
+
}, [value, calcSchema]);
|
|
29344
29114
|
|
|
29345
29115
|
var functionalProperty = function functionalProperty(entry, prop) {
|
|
29346
29116
|
if (typeof prop === 'function') {
|
|
@@ -29377,7 +29147,7 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29377
29147
|
handleSubmit: _handleSubmit,
|
|
29378
29148
|
watch: methods.watch
|
|
29379
29149
|
}), /*#__PURE__*/React.createElement("form", {
|
|
29380
|
-
className: className || "
|
|
29150
|
+
className: className || "pr_15 w_100",
|
|
29381
29151
|
onSubmit: _handleSubmit(function (data) {
|
|
29382
29152
|
var clean = cleanOutputArray(data, schema);
|
|
29383
29153
|
onSubmit(clean);
|
|
@@ -29444,8 +29214,6 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
|
29444
29214
|
var Footer = function Footer(props) {
|
|
29445
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;
|
|
29446
29216
|
|
|
29447
|
-
var classes = useCustomStyle();
|
|
29448
|
-
|
|
29449
29217
|
if (props.render) {
|
|
29450
29218
|
return props.render({
|
|
29451
29219
|
reset: props.reset,
|
|
@@ -29455,9 +29223,9 @@ var Footer = function Footer(props) {
|
|
|
29455
29223
|
|
|
29456
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);
|
|
29457
29225
|
return /*#__PURE__*/React.createElement("div", {
|
|
29458
|
-
className: "
|
|
29226
|
+
className: "flex jc_end mt_5"
|
|
29459
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", {
|
|
29460
|
-
className: "
|
|
29228
|
+
className: "btn btn_red",
|
|
29461
29229
|
type: "button",
|
|
29462
29230
|
onClick: function onClick() {
|
|
29463
29231
|
var _props$actions4;
|
|
@@ -29465,11 +29233,11 @@ var Footer = function Footer(props) {
|
|
|
29465
29233
|
return (_props$actions4 = props.actions) === null || _props$actions4 === void 0 ? void 0 : _props$actions4.cancel.action();
|
|
29466
29234
|
}
|
|
29467
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", {
|
|
29468
|
-
className: "
|
|
29236
|
+
className: "btn btn_red",
|
|
29469
29237
|
type: "button",
|
|
29470
29238
|
onClick: props.reset
|
|
29471
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", {
|
|
29472
|
-
className: "
|
|
29240
|
+
className: "btn btn_green ml_10",
|
|
29473
29241
|
type: "submit"
|
|
29474
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'));
|
|
29475
29243
|
};
|
|
@@ -29486,7 +29254,6 @@ var Step = function Step(_ref8) {
|
|
|
29486
29254
|
functionalProperty = _ref8.functionalProperty,
|
|
29487
29255
|
parent = _ref8.parent,
|
|
29488
29256
|
onAfterChange = _ref8.onAfterChange;
|
|
29489
|
-
var classes = useCustomStyle();
|
|
29490
29257
|
|
|
29491
29258
|
var _useFormContext2 = useFormContext(),
|
|
29492
29259
|
_useFormContext2$form = _useFormContext2.formState,
|
|
@@ -29644,7 +29411,7 @@ var Step = function Step(_ref8) {
|
|
|
29644
29411
|
errorDisplayed: errorDisplayed
|
|
29645
29412
|
}, /*#__PURE__*/React.createElement("textarea", {
|
|
29646
29413
|
type: "text",
|
|
29647
|
-
className: classNames(
|
|
29414
|
+
className: classNames('input', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29648
29415
|
}));
|
|
29649
29416
|
|
|
29650
29417
|
case format.code:
|
|
@@ -29656,7 +29423,7 @@ var Step = function Step(_ref8) {
|
|
|
29656
29423
|
entry: entry,
|
|
29657
29424
|
errorDisplayed: errorDisplayed
|
|
29658
29425
|
}, /*#__PURE__*/React.createElement(Component, {
|
|
29659
|
-
className: classNames(_defineProperty$1({},
|
|
29426
|
+
className: classNames(step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29660
29427
|
}));
|
|
29661
29428
|
|
|
29662
29429
|
case format.markdown:
|
|
@@ -29666,7 +29433,7 @@ var Step = function Step(_ref8) {
|
|
|
29666
29433
|
entry: entry,
|
|
29667
29434
|
errorDisplayed: errorDisplayed
|
|
29668
29435
|
}, /*#__PURE__*/React.createElement(MarkdownInput, {
|
|
29669
|
-
className: classNames(_defineProperty$1({},
|
|
29436
|
+
className: classNames(step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29670
29437
|
}));
|
|
29671
29438
|
|
|
29672
29439
|
case format.buttonsSelect:
|
|
@@ -29677,9 +29444,10 @@ var Step = function Step(_ref8) {
|
|
|
29677
29444
|
step: step,
|
|
29678
29445
|
entry: entry,
|
|
29679
29446
|
errorDisplayed: errorDisplayed
|
|
29680
|
-
}, /*#__PURE__*/React.createElement(SelectInput, {
|
|
29681
|
-
className: classNames(
|
|
29682
|
-
disabled: functionalProperty(entry, step.disabled)
|
|
29447
|
+
}, /*#__PURE__*/React.createElement(SelectInput, _extends({
|
|
29448
|
+
className: classNames('flex_grow_1', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed)),
|
|
29449
|
+
disabled: functionalProperty(entry, step.disabled)
|
|
29450
|
+
}, step.props, {
|
|
29683
29451
|
possibleValues: step.options,
|
|
29684
29452
|
httpClient: httpClient,
|
|
29685
29453
|
isMulti: step.isMulti,
|
|
@@ -29687,7 +29455,7 @@ var Step = function Step(_ref8) {
|
|
|
29687
29455
|
transformer: step.transformer,
|
|
29688
29456
|
buttons: step.format === format.buttonsSelect,
|
|
29689
29457
|
optionsFrom: step.optionsFrom
|
|
29690
|
-
}));
|
|
29458
|
+
})));
|
|
29691
29459
|
}
|
|
29692
29460
|
|
|
29693
29461
|
default:
|
|
@@ -29698,7 +29466,7 @@ var Step = function Step(_ref8) {
|
|
|
29698
29466
|
errorDisplayed: errorDisplayed
|
|
29699
29467
|
}, /*#__PURE__*/React.createElement("input", {
|
|
29700
29468
|
type: step.format || 'text',
|
|
29701
|
-
className: classNames(
|
|
29469
|
+
className: classNames('input', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29702
29470
|
}));
|
|
29703
29471
|
}
|
|
29704
29472
|
|
|
@@ -29711,8 +29479,9 @@ var Step = function Step(_ref8) {
|
|
|
29711
29479
|
step: step,
|
|
29712
29480
|
entry: entry,
|
|
29713
29481
|
errorDisplayed: errorDisplayed
|
|
29714
|
-
}, /*#__PURE__*/React.createElement(SelectInput, {
|
|
29715
|
-
className: classNames(
|
|
29482
|
+
}, /*#__PURE__*/React.createElement(SelectInput, _extends({
|
|
29483
|
+
className: classNames('content', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29484
|
+
}, step.props, {
|
|
29716
29485
|
possibleValues: step.options,
|
|
29717
29486
|
httpClient: httpClient,
|
|
29718
29487
|
isMulti: step.isMulti,
|
|
@@ -29721,7 +29490,7 @@ var Step = function Step(_ref8) {
|
|
|
29721
29490
|
transformer: step.transformer,
|
|
29722
29491
|
buttons: step.format === format.buttonsSelect,
|
|
29723
29492
|
optionsFrom: step.optionsFrom
|
|
29724
|
-
}));
|
|
29493
|
+
})));
|
|
29725
29494
|
|
|
29726
29495
|
default:
|
|
29727
29496
|
return /*#__PURE__*/React.createElement(ControlledInput, {
|
|
@@ -29731,18 +29500,17 @@ var Step = function Step(_ref8) {
|
|
|
29731
29500
|
errorDisplayed: errorDisplayed
|
|
29732
29501
|
}, /*#__PURE__*/React.createElement("input", {
|
|
29733
29502
|
type: step.format || 'number',
|
|
29734
|
-
className: classNames(
|
|
29503
|
+
className: classNames('input', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29735
29504
|
}));
|
|
29736
29505
|
}
|
|
29737
29506
|
|
|
29738
29507
|
case type.bool:
|
|
29739
29508
|
return /*#__PURE__*/React.createElement(ControlledInput, {
|
|
29740
|
-
defaultValue: defaultValue,
|
|
29741
29509
|
step: step,
|
|
29742
29510
|
entry: entry,
|
|
29743
29511
|
errorDisplayed: errorDisplayed
|
|
29744
29512
|
}, /*#__PURE__*/React.createElement(BooleanInput, {
|
|
29745
|
-
className: classNames(_defineProperty$1({},
|
|
29513
|
+
className: classNames(steop.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29746
29514
|
}));
|
|
29747
29515
|
|
|
29748
29516
|
case type.object:
|
|
@@ -29754,8 +29522,9 @@ var Step = function Step(_ref8) {
|
|
|
29754
29522
|
step: step,
|
|
29755
29523
|
entry: entry,
|
|
29756
29524
|
errorDisplayed: errorDisplayed
|
|
29757
|
-
}, /*#__PURE__*/React.createElement(SelectInput, {
|
|
29758
|
-
className: classNames(
|
|
29525
|
+
}, /*#__PURE__*/React.createElement(SelectInput, _extends({
|
|
29526
|
+
className: classNames('flex_grow_1', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29527
|
+
}, step.props, {
|
|
29759
29528
|
possibleValues: step.options,
|
|
29760
29529
|
httpClient: httpClient,
|
|
29761
29530
|
isMulti: step.isMulti,
|
|
@@ -29764,7 +29533,7 @@ var Step = function Step(_ref8) {
|
|
|
29764
29533
|
transformer: step.transformer,
|
|
29765
29534
|
buttons: step.format === format.buttonsSelect,
|
|
29766
29535
|
optionsFrom: step.optionsFrom
|
|
29767
|
-
}));
|
|
29536
|
+
})));
|
|
29768
29537
|
|
|
29769
29538
|
case format.form:
|
|
29770
29539
|
//todo: disabled ?
|
|
@@ -29807,7 +29576,7 @@ var Step = function Step(_ref8) {
|
|
|
29807
29576
|
errorDisplayed: errorDisplayed,
|
|
29808
29577
|
component: function component(field, props) {
|
|
29809
29578
|
return /*#__PURE__*/React.createElement(CodeInput, _extends({}, props, {
|
|
29810
|
-
className: classNames(_defineProperty$1({},
|
|
29579
|
+
className: classNames(step.className, _defineProperty$1({}, 'input__invalid', error)),
|
|
29811
29580
|
onChange: function onChange(e) {
|
|
29812
29581
|
_readOnlyError("errorDisplayed");
|
|
29813
29582
|
var v;
|
|
@@ -29839,7 +29608,7 @@ var Step = function Step(_ref8) {
|
|
|
29839
29608
|
entry: entry,
|
|
29840
29609
|
errorDisplayed: errorDisplayed
|
|
29841
29610
|
}, /*#__PURE__*/React.createElement(ObjectInput, {
|
|
29842
|
-
className: classNames(_defineProperty$1({},
|
|
29611
|
+
className: classNames(step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed))
|
|
29843
29612
|
}));
|
|
29844
29613
|
}
|
|
29845
29614
|
|
|
@@ -29850,7 +29619,7 @@ var Step = function Step(_ref8) {
|
|
|
29850
29619
|
entry: entry,
|
|
29851
29620
|
errorDisplayed: errorDisplayed
|
|
29852
29621
|
}, /*#__PURE__*/React.createElement(DatePicker, {
|
|
29853
|
-
className: classNames(
|
|
29622
|
+
className: classNames('datepicker', step.className, _defineProperty$1({}, 'input__invalid', errorDisplayed)),
|
|
29854
29623
|
formatStyle: "large"
|
|
29855
29624
|
}));
|
|
29856
29625
|
|
|
@@ -29864,15 +29633,15 @@ var Step = function Step(_ref8) {
|
|
|
29864
29633
|
var FileInput = function FileInput(_ref10) {
|
|
29865
29634
|
var onChange = _ref10.onChange;
|
|
29866
29635
|
|
|
29867
|
-
var
|
|
29868
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
29869
|
-
uploading = _useState4[0],
|
|
29870
|
-
setUploading = _useState4[1];
|
|
29871
|
-
|
|
29872
|
-
var _useState5 = useState(undefined),
|
|
29636
|
+
var _useState5 = useState(false),
|
|
29873
29637
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
29874
|
-
|
|
29875
|
-
|
|
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];
|
|
29876
29645
|
|
|
29877
29646
|
var setFiles = function setFiles(e) {
|
|
29878
29647
|
var files = e.target.files;
|
|
@@ -29887,24 +29656,24 @@ var Step = function Step(_ref8) {
|
|
|
29887
29656
|
|
|
29888
29657
|
var files = field.value || [];
|
|
29889
29658
|
return /*#__PURE__*/React.createElement("div", {
|
|
29890
|
-
className: classNames(
|
|
29659
|
+
className: classNames('flex', 'ai_center', step.className, _defineProperty$1({}, 'input__invalid', error))
|
|
29891
29660
|
}, /*#__PURE__*/React.createElement("input", {
|
|
29892
29661
|
ref: function ref(r) {
|
|
29893
29662
|
return setInput(r);
|
|
29894
29663
|
},
|
|
29895
29664
|
type: "file",
|
|
29896
29665
|
multiple: true,
|
|
29897
|
-
className:
|
|
29666
|
+
className: 'd_none',
|
|
29898
29667
|
onChange: setFiles
|
|
29899
29668
|
}), /*#__PURE__*/React.createElement("button", {
|
|
29900
29669
|
type: "button",
|
|
29901
|
-
className: "
|
|
29670
|
+
className: "btn btn_sm flex ai_center",
|
|
29902
29671
|
disabled: uploading || functionalProperty(entry, step.disabled),
|
|
29903
29672
|
onClick: trigger
|
|
29904
29673
|
}, uploading && /*#__PURE__*/React.createElement(Loader, null), !uploading && /*#__PURE__*/React.createElement(Upload, null), /*#__PURE__*/React.createElement("span", {
|
|
29905
|
-
className: ""
|
|
29674
|
+
className: "ml_5"
|
|
29906
29675
|
}, "Select file(s)")), /*#__PURE__*/React.createElement("span", {
|
|
29907
|
-
className: ""
|
|
29676
|
+
className: "ml_5"
|
|
29908
29677
|
}, files.length <= 0 ? 'No files selected' : files.map(function (r) {
|
|
29909
29678
|
return r.name;
|
|
29910
29679
|
}).join(" , ")));
|
|
@@ -29926,7 +29695,7 @@ var Step = function Step(_ref8) {
|
|
|
29926
29695
|
entry: entry,
|
|
29927
29696
|
component: function component(field, props) {
|
|
29928
29697
|
return /*#__PURE__*/React.createElement(CodeInput, _extends({}, props, {
|
|
29929
|
-
className: classNames(_defineProperty$1({},
|
|
29698
|
+
className: classNames(_defineProperty$1({}, 'input__invalid', error)),
|
|
29930
29699
|
onChange: function onChange(v) {
|
|
29931
29700
|
field.onChange(v);
|
|
29932
29701
|
option(step.onChange).map(function (onChange) {
|
|
@@ -29952,7 +29721,6 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
29952
29721
|
step = _ref11.step,
|
|
29953
29722
|
component = _ref11.component,
|
|
29954
29723
|
disabled = _ref11.disabled;
|
|
29955
|
-
var classes = useCustomStyle();
|
|
29956
29724
|
|
|
29957
29725
|
var _useFormContext3 = useFormContext(),
|
|
29958
29726
|
getValues = _useFormContext3.getValues,
|
|
@@ -29985,7 +29753,7 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
29985
29753
|
return /*#__PURE__*/React.createElement("div", {
|
|
29986
29754
|
key: field.id
|
|
29987
29755
|
}, /*#__PURE__*/React.createElement("div", {
|
|
29988
|
-
className: classNames(
|
|
29756
|
+
className: classNames('ai_center', 'mt_5'),
|
|
29989
29757
|
style: {
|
|
29990
29758
|
position: 'relative'
|
|
29991
29759
|
}
|
|
@@ -30004,7 +29772,7 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
30004
29772
|
top: '2px',
|
|
30005
29773
|
right: 0
|
|
30006
29774
|
},
|
|
30007
|
-
className: classNames(
|
|
29775
|
+
className: classNames('btn', 'btn_red', 'btn_sm', 'ml_5'),
|
|
30008
29776
|
disabled: disabled,
|
|
30009
29777
|
onClick: function onClick() {
|
|
30010
29778
|
remove(idx);
|
|
@@ -30014,10 +29782,10 @@ var ArrayStep = function ArrayStep(_ref11) {
|
|
|
30014
29782
|
size: 16
|
|
30015
29783
|
}))));
|
|
30016
29784
|
}), /*#__PURE__*/React.createElement("div", {
|
|
30017
|
-
className: classNames(
|
|
29785
|
+
className: classNames('flex', 'jc_flex_end')
|
|
30018
29786
|
}, /*#__PURE__*/React.createElement("button", {
|
|
30019
29787
|
type: "button",
|
|
30020
|
-
className: classNames(
|
|
29788
|
+
className: classNames('btn', 'btn_blue', 'btn_sm', 'mt_5', _defineProperty$1({}, 'input__invalid', errorDisplayed)),
|
|
30021
29789
|
onClick: function onClick() {
|
|
30022
29790
|
var newValue = cleanInputArray({}, getValues(entry), step.flow, step.schema);
|
|
30023
29791
|
append({
|
|
@@ -30057,22 +29825,21 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30057
29825
|
setValue = _useFormContext4.setValue,
|
|
30058
29826
|
watch = _useFormContext4.watch;
|
|
30059
29827
|
|
|
30060
|
-
var
|
|
30061
|
-
|
|
30062
|
-
collapsed =
|
|
30063
|
-
setCollapsed =
|
|
29828
|
+
var _useState9 = useState(!!step.collapsed),
|
|
29829
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
29830
|
+
collapsed = _useState10[0],
|
|
29831
|
+
setCollapsed = _useState10[1];
|
|
30064
29832
|
|
|
30065
|
-
var classes = useCustomStyle();
|
|
30066
29833
|
useWatch(step === null || step === void 0 ? void 0 : (_step$conditionalSche = step.conditionalSchema) === null || _step$conditionalSche === void 0 ? void 0 : _step$conditionalSche.ref);
|
|
30067
29834
|
var schemaAndFlow = option(step.conditionalSchema).map(function (condiSchema) {
|
|
30068
29835
|
var ref = option(condiSchema.ref).map(function (ref) {
|
|
30069
29836
|
return getValues(ref);
|
|
30070
29837
|
}).getOrNull();
|
|
30071
|
-
var
|
|
29838
|
+
var rawValues = getValues();
|
|
30072
29839
|
var filterSwitch = condiSchema["switch"].find(function (s) {
|
|
30073
29840
|
if (typeof s.condition === 'function') {
|
|
30074
29841
|
return s.condition({
|
|
30075
|
-
|
|
29842
|
+
rawValues: rawValues,
|
|
30076
29843
|
ref: ref
|
|
30077
29844
|
});
|
|
30078
29845
|
} else {
|
|
@@ -30093,15 +29860,12 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30093
29860
|
schema: schema,
|
|
30094
29861
|
flow: flow
|
|
30095
29862
|
});
|
|
30096
|
-
|
|
30097
|
-
|
|
30098
|
-
|
|
30099
|
-
|
|
30100
|
-
|
|
30101
|
-
|
|
30102
|
-
});
|
|
30103
|
-
}
|
|
30104
|
-
}, [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]);
|
|
30105
29869
|
var computedSandF = schemaAndFlow.flow.reduce(function (acc, entry) {
|
|
30106
29870
|
var step = schemaAndFlow.schema[entry];
|
|
30107
29871
|
var visibleStep = option(step).map(function (s) {
|
|
@@ -30132,13 +29896,13 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30132
29896
|
return x.visibleStep;
|
|
30133
29897
|
}).length >= 1 && step.label !== null;
|
|
30134
29898
|
return /*#__PURE__*/React.createElement("div", {
|
|
30135
|
-
className: classNames((_classNames17 = {}, _defineProperty$1(_classNames17,
|
|
29899
|
+
className: classNames((_classNames17 = {}, _defineProperty$1(_classNames17, 'nestedform__border', bordered), _defineProperty$1(_classNames17, 'border__error', !!errorDisplayed), _classNames17)),
|
|
30136
29900
|
style: {
|
|
30137
29901
|
position: 'relative'
|
|
30138
29902
|
}
|
|
30139
29903
|
}, !!step.collapsable && schemaAndFlow.flow.length > 1 && collapsed && /*#__PURE__*/React.createElement(ChevronDown, {
|
|
30140
29904
|
size: 30,
|
|
30141
|
-
className:
|
|
29905
|
+
className: 'cursor_pointer',
|
|
30142
29906
|
style: {
|
|
30143
29907
|
position: 'absolute',
|
|
30144
29908
|
top: -35,
|
|
@@ -30151,7 +29915,7 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30151
29915
|
}
|
|
30152
29916
|
}), !!step.collapsable && schemaAndFlow.flow.length > 1 && !collapsed && /*#__PURE__*/React.createElement(ChevronUp, {
|
|
30153
29917
|
size: 30,
|
|
30154
|
-
className:
|
|
29918
|
+
className: 'cursor_pointer',
|
|
30155
29919
|
style: {
|
|
30156
29920
|
position: 'absolute',
|
|
30157
29921
|
top: -35,
|
|
@@ -30174,7 +29938,7 @@ var NestedForm = function NestedForm(_ref12) {
|
|
|
30174
29938
|
|
|
30175
29939
|
return /*#__PURE__*/React.createElement(BasicWrapper, {
|
|
30176
29940
|
key: "".concat(entry, ".").concat(idx),
|
|
30177
|
-
className: classNames(_defineProperty$1({},
|
|
29941
|
+
className: classNames(_defineProperty$1({}, 'display__none', collapsed && !step.visibleOnCollapse || !visibleStep)),
|
|
30178
29942
|
entry: "".concat(parent, ".").concat(entry),
|
|
30179
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),
|
|
30180
29944
|
help: step.help,
|