@tsed/react-formio 2.1.0 → 2.1.2
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/dist/index.js +49 -46
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +194 -191
- package/dist/index.modern.js.map +1 -1
- package/package.json +3 -3
- package/src/components/table/components/defaultCells.component.tsx +1 -0
- package/src/components/table/components/dragNDropContainer.tsx +1 -1
- package/src/components/table/hooks/useCustomTable.hook.tsx +6 -1
package/dist/index.modern.js
CHANGED
|
@@ -3,7 +3,7 @@ export { default as WebformBuilder } from 'formiojs/WebformBuilder';
|
|
|
3
3
|
export { default as Wizard } from 'formiojs/Wizard';
|
|
4
4
|
export { default as WizardBuilder } from 'formiojs/WizardBuilder';
|
|
5
5
|
import noop from 'lodash/noop';
|
|
6
|
-
import React
|
|
6
|
+
import React, { useRef, useEffect, useState, useMemo, useCallback, useReducer } from 'react';
|
|
7
7
|
import { Templates, Form as Form$1, Components } from 'formiojs';
|
|
8
8
|
export { Components, Formio, Templates, Utils } from 'formiojs';
|
|
9
9
|
import Choices from '@formio/choices.js';
|
|
@@ -128,27 +128,27 @@ function FormControl({
|
|
|
128
128
|
label,
|
|
129
129
|
className
|
|
130
130
|
}) {
|
|
131
|
-
return /*#__PURE__*/React
|
|
131
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
132
132
|
"data-testid": name && `form-group-${name}`,
|
|
133
133
|
id: `form-group-${name || ""}`,
|
|
134
134
|
className: classnames("form-group", className)
|
|
135
|
-
}, label && /*#__PURE__*/React
|
|
135
|
+
}, label && /*#__PURE__*/React.createElement("label", {
|
|
136
136
|
htmlFor: name,
|
|
137
137
|
"data-testid": "form-control-label",
|
|
138
138
|
className: `col-form-label ${required ? " field-required" : ""}`
|
|
139
|
-
}, label), /*#__PURE__*/React
|
|
139
|
+
}, label), /*#__PURE__*/React.createElement("div", {
|
|
140
140
|
className: "input-group"
|
|
141
|
-
}, prefix && /*#__PURE__*/React
|
|
141
|
+
}, prefix && /*#__PURE__*/React.createElement("div", {
|
|
142
142
|
className: "input-group-prepend"
|
|
143
|
-
}, /*#__PURE__*/React
|
|
143
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
144
144
|
className: "input-group-text",
|
|
145
145
|
"data-testid": "form-control-prefix"
|
|
146
|
-
}, prefix)), children, suffix && /*#__PURE__*/React
|
|
146
|
+
}, prefix)), children, suffix && /*#__PURE__*/React.createElement("div", {
|
|
147
147
|
className: "input-group-append"
|
|
148
|
-
}, /*#__PURE__*/React
|
|
148
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
149
149
|
className: "input-group-text",
|
|
150
150
|
"data-testid": "form-control-suffix"
|
|
151
|
-
}, suffix))), description && /*#__PURE__*/React
|
|
151
|
+
}, suffix))), description && /*#__PURE__*/React.createElement("div", {
|
|
152
152
|
"data-testid": "form-control-description",
|
|
153
153
|
className: "form-text text-muted"
|
|
154
154
|
}, description));
|
|
@@ -196,7 +196,7 @@ function Select(_ref) {
|
|
|
196
196
|
label: placeholder,
|
|
197
197
|
value: ""
|
|
198
198
|
}, ...choices];
|
|
199
|
-
return /*#__PURE__*/React
|
|
199
|
+
return /*#__PURE__*/React.createElement(FormControl, {
|
|
200
200
|
name: name,
|
|
201
201
|
label: label,
|
|
202
202
|
required: required,
|
|
@@ -204,7 +204,7 @@ function Select(_ref) {
|
|
|
204
204
|
prefix: prefix,
|
|
205
205
|
suffix: suffix,
|
|
206
206
|
shadow: false
|
|
207
|
-
}, /*#__PURE__*/React
|
|
207
|
+
}, /*#__PURE__*/React.createElement("select", _extends({
|
|
208
208
|
ref: ref
|
|
209
209
|
}, props, {
|
|
210
210
|
"data-testid": `select_${name}`,
|
|
@@ -221,7 +221,7 @@ function Select(_ref) {
|
|
|
221
221
|
label,
|
|
222
222
|
value
|
|
223
223
|
}) => {
|
|
224
|
-
return /*#__PURE__*/React
|
|
224
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
225
225
|
key: String(value),
|
|
226
226
|
label: label,
|
|
227
227
|
value: value
|
|
@@ -297,7 +297,7 @@ function PaginationButton(props) {
|
|
|
297
297
|
active
|
|
298
298
|
} = props,
|
|
299
299
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
300
|
-
return /*#__PURE__*/React
|
|
300
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, otherProps, {
|
|
301
301
|
"data-testid": "pagination-button",
|
|
302
302
|
disabled: disabled,
|
|
303
303
|
className: classnames("page-link", disabled ? "disabled" : "", active ? "" : "", props.className)
|
|
@@ -328,55 +328,55 @@ function Pagination(props) {
|
|
|
328
328
|
value,
|
|
329
329
|
label: value
|
|
330
330
|
}));
|
|
331
|
-
return /*#__PURE__*/React
|
|
331
|
+
return /*#__PURE__*/React.createElement("nav", {
|
|
332
332
|
"aria-label": "Page navigation",
|
|
333
333
|
className: classnames("pagination-group -mb-3", className)
|
|
334
|
-
}, /*#__PURE__*/React
|
|
334
|
+
}, /*#__PURE__*/React.createElement("ul", {
|
|
335
335
|
className: "pagination mb-3 mr-3"
|
|
336
|
-
}, /*#__PURE__*/React
|
|
336
|
+
}, /*#__PURE__*/React.createElement("li", {
|
|
337
337
|
className: classnames("page-item", !canPreviousPage && "disabled")
|
|
338
|
-
}, /*#__PURE__*/React
|
|
338
|
+
}, /*#__PURE__*/React.createElement(PaginationButton, {
|
|
339
339
|
tabIndex: -1,
|
|
340
340
|
disabled: !canPreviousPage,
|
|
341
341
|
onClick: () => previousPage()
|
|
342
342
|
}, i18n("Previous"))), pageNumbers.map(page => {
|
|
343
343
|
if ([LEFT_PAGE, RIGHT_PAGE].includes(page)) {
|
|
344
|
-
return /*#__PURE__*/React
|
|
344
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
345
345
|
className: "page-item",
|
|
346
346
|
key: page
|
|
347
|
-
}, /*#__PURE__*/React
|
|
347
|
+
}, /*#__PURE__*/React.createElement(PaginationButton, {
|
|
348
348
|
"aria-hidden": "true"
|
|
349
349
|
}, "..."));
|
|
350
350
|
}
|
|
351
351
|
const active = page - 1 === pageIndex;
|
|
352
|
-
return /*#__PURE__*/React
|
|
352
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
353
353
|
className: classnames("page-item", active && "active"),
|
|
354
354
|
key: page
|
|
355
|
-
}, /*#__PURE__*/React
|
|
355
|
+
}, /*#__PURE__*/React.createElement(PaginationButton, {
|
|
356
356
|
tabIndex: pageIndex,
|
|
357
357
|
active: active,
|
|
358
358
|
onClick: () => gotoPage(page - 1)
|
|
359
359
|
}, page));
|
|
360
|
-
}), /*#__PURE__*/React
|
|
360
|
+
}), /*#__PURE__*/React.createElement("li", {
|
|
361
361
|
className: classnames("page-item", !canNextPage && "disabled")
|
|
362
|
-
}, /*#__PURE__*/React
|
|
362
|
+
}, /*#__PURE__*/React.createElement(PaginationButton, {
|
|
363
363
|
tabIndex: pageNumbers.length,
|
|
364
364
|
disabled: !canNextPage,
|
|
365
365
|
onClick: () => nextPage()
|
|
366
|
-
}, i18n("Next")))), /*#__PURE__*/React
|
|
366
|
+
}, i18n("Next")))), /*#__PURE__*/React.createElement("li", {
|
|
367
367
|
className: "mb-3 mr-3 flex items-center"
|
|
368
|
-
}, /*#__PURE__*/React
|
|
368
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
369
369
|
name: "page",
|
|
370
370
|
value: pageSize,
|
|
371
371
|
choices: choices,
|
|
372
372
|
onChange: (name, value) => {
|
|
373
373
|
setPageSize(+value);
|
|
374
374
|
}
|
|
375
|
-
}), /*#__PURE__*/React
|
|
375
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
376
376
|
className: "ml-3"
|
|
377
|
-
}, i18n("items per page"))), pageOptions && /*#__PURE__*/React
|
|
377
|
+
}, i18n("items per page"))), pageOptions && /*#__PURE__*/React.createElement("li", {
|
|
378
378
|
className: "mb-3 flex items-center"
|
|
379
|
-
}, /*#__PURE__*/React
|
|
379
|
+
}, /*#__PURE__*/React.createElement("span", null, i18n("Page"), "\xA0"), /*#__PURE__*/React.createElement("strong", null, pageIndex + 1, " of ", pageOptions.length)));
|
|
380
380
|
}
|
|
381
381
|
|
|
382
382
|
function DefaultArrowSort({
|
|
@@ -386,9 +386,9 @@ function DefaultArrowSort({
|
|
|
386
386
|
isSorted,
|
|
387
387
|
isSortedDesc
|
|
388
388
|
} = column;
|
|
389
|
-
return /*#__PURE__*/React
|
|
389
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
390
390
|
className: "table-arrow-sort"
|
|
391
|
-
}, isSorted ? /*#__PURE__*/React
|
|
391
|
+
}, isSorted ? /*#__PURE__*/React.createElement("i", {
|
|
392
392
|
className: iconClass(undefined, isSortedDesc ? "sort-up" : "sort-down")
|
|
393
393
|
}) : "");
|
|
394
394
|
}
|
|
@@ -396,11 +396,11 @@ function DefaultArrowSort({
|
|
|
396
396
|
function DefaultCellHeader({
|
|
397
397
|
column
|
|
398
398
|
}) {
|
|
399
|
-
return /*#__PURE__*/React
|
|
399
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
400
400
|
className: "table-cell-header"
|
|
401
|
-
}, /*#__PURE__*/React
|
|
401
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
402
402
|
className: "table-cell-header__label"
|
|
403
|
-
}, column.getSortByToggleProps()), /*#__PURE__*/React
|
|
403
|
+
}, column.getSortByToggleProps()), /*#__PURE__*/React.createElement("span", null, column.render("Header")), column.render("ArrowSort")), column.canFilter ? /*#__PURE__*/React.createElement("div", {
|
|
404
404
|
className: "table-cell-header__filter"
|
|
405
405
|
}, column.render("Filter")) : null);
|
|
406
406
|
}
|
|
@@ -511,23 +511,23 @@ function DefaultDndRow(props) {
|
|
|
511
511
|
dropRef,
|
|
512
512
|
opacity
|
|
513
513
|
} = useDndRow(props);
|
|
514
|
-
return /*#__PURE__*/React
|
|
514
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
515
515
|
ref: dropRef,
|
|
516
516
|
style: {
|
|
517
517
|
opacity
|
|
518
518
|
}
|
|
519
|
-
}, /*#__PURE__*/React
|
|
519
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
520
520
|
ref: dragRef,
|
|
521
521
|
role: "cell",
|
|
522
522
|
style: {
|
|
523
523
|
cursor: isDragging ? "grabbing" : "grab"
|
|
524
524
|
},
|
|
525
525
|
className: "align-middle"
|
|
526
|
-
}, /*#__PURE__*/React
|
|
526
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
527
527
|
className: "flex items-center justify-center"
|
|
528
|
-
}, /*#__PURE__*/React
|
|
528
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
529
529
|
className: classnames(iconClass(undefined, "dots-vertical-rounded"))
|
|
530
|
-
}))), /*#__PURE__*/React
|
|
530
|
+
}))), /*#__PURE__*/React.createElement(DefaultCells, props));
|
|
531
531
|
}
|
|
532
532
|
function DefaultRow(_ref) {
|
|
533
533
|
let {
|
|
@@ -542,13 +542,13 @@ function DefaultRow(_ref) {
|
|
|
542
542
|
onClick: () => onClick(row.original, "row")
|
|
543
543
|
}, row.getRowProps());
|
|
544
544
|
if (enableDragNDrop) {
|
|
545
|
-
return /*#__PURE__*/React
|
|
545
|
+
return /*#__PURE__*/React.createElement(DefaultDndRow, _extends({}, opts, {
|
|
546
546
|
row: row,
|
|
547
547
|
onDrag: onDrag,
|
|
548
548
|
onDrop: onDrop
|
|
549
549
|
}));
|
|
550
550
|
}
|
|
551
|
-
return /*#__PURE__*/React
|
|
551
|
+
return /*#__PURE__*/React.createElement("tr", opts, /*#__PURE__*/React.createElement(DefaultCells, {
|
|
552
552
|
row: row
|
|
553
553
|
}));
|
|
554
554
|
}
|
|
@@ -586,7 +586,7 @@ function InputText(_ref) {
|
|
|
586
586
|
useEffect(() => {
|
|
587
587
|
setValue(value);
|
|
588
588
|
}, [value]);
|
|
589
|
-
return /*#__PURE__*/React
|
|
589
|
+
return /*#__PURE__*/React.createElement(FormControl, {
|
|
590
590
|
name: name,
|
|
591
591
|
label: label,
|
|
592
592
|
required: required,
|
|
@@ -594,7 +594,7 @@ function InputText(_ref) {
|
|
|
594
594
|
prefix: prefix,
|
|
595
595
|
suffix: suffix,
|
|
596
596
|
className: className
|
|
597
|
-
}, /*#__PURE__*/React
|
|
597
|
+
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
598
598
|
type: type || "text"
|
|
599
599
|
}, props, {
|
|
600
600
|
"data-testid": `input_${name}`,
|
|
@@ -638,7 +638,7 @@ function DefaultColumnFilter(props) {
|
|
|
638
638
|
setFilterId(id);
|
|
639
639
|
setFilter(value || undefined);
|
|
640
640
|
}, [id, setValue, setFilterId, setFilter]);
|
|
641
|
-
return /*#__PURE__*/React
|
|
641
|
+
return /*#__PURE__*/React.createElement(InputText, {
|
|
642
642
|
size: "sm",
|
|
643
643
|
id: id,
|
|
644
644
|
name: id,
|
|
@@ -673,12 +673,12 @@ function DefaultOperationButton(props) {
|
|
|
673
673
|
title = "",
|
|
674
674
|
i18n = f => f
|
|
675
675
|
} = props;
|
|
676
|
-
return /*#__PURE__*/React
|
|
676
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
677
677
|
className: classnames(className, ["btn", buttonOutline && "outline", buttonType].filter(Boolean).join("-"), `btn-${buttonSize}`),
|
|
678
678
|
onClick: stopPropagationWrapper(() => onClick(action))
|
|
679
|
-
}, icon ? /*#__PURE__*/React
|
|
679
|
+
}, icon ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("i", {
|
|
680
680
|
className: iconClass(undefined, icon)
|
|
681
|
-
}), " ", title && " ") : null, title && /*#__PURE__*/React
|
|
681
|
+
}), " ", title && " ") : null, title && /*#__PURE__*/React.createElement("span", {
|
|
682
682
|
className: icon && title ? "ml-1" : ""
|
|
683
683
|
}, i18n(title)));
|
|
684
684
|
}
|
|
@@ -692,7 +692,7 @@ function DefaultCellOperations({
|
|
|
692
692
|
i18n
|
|
693
693
|
}) {
|
|
694
694
|
const data = row.original;
|
|
695
|
-
return /*#__PURE__*/React
|
|
695
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
696
696
|
className: "btn-group"
|
|
697
697
|
}, operations.filter(({
|
|
698
698
|
permissionsResolver
|
|
@@ -701,7 +701,7 @@ function DefaultCellOperations({
|
|
|
701
701
|
OperationButton = DefaultOperationButton
|
|
702
702
|
} = _ref,
|
|
703
703
|
operation = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
704
|
-
return /*#__PURE__*/React
|
|
704
|
+
return /*#__PURE__*/React.createElement(OperationButton, _extends({
|
|
705
705
|
key: operation.action
|
|
706
706
|
}, operation, {
|
|
707
707
|
onClick: action => onClick(data, action),
|
|
@@ -727,10 +727,10 @@ function useOperations({
|
|
|
727
727
|
return [...columns, {
|
|
728
728
|
id: "operations",
|
|
729
729
|
groupByBoundary: true,
|
|
730
|
-
Header: () => /*#__PURE__*/React
|
|
730
|
+
Header: () => /*#__PURE__*/React.createElement("div", {
|
|
731
731
|
className: "text-center"
|
|
732
732
|
}, i18n("Operations")),
|
|
733
|
-
Cell: props => /*#__PURE__*/React
|
|
733
|
+
Cell: props => /*#__PURE__*/React.createElement(CellOperations, _extends({}, props, {
|
|
734
734
|
operations: operations,
|
|
735
735
|
onClick: onClick,
|
|
736
736
|
ctx: ctx,
|
|
@@ -751,12 +751,12 @@ function getOperationCallback(operations, onClick) {
|
|
|
751
751
|
};
|
|
752
752
|
}
|
|
753
753
|
function DefaultLoader() {
|
|
754
|
-
return /*#__PURE__*/React
|
|
754
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
755
755
|
className: "text-center p-2 pb-4 font-bold"
|
|
756
756
|
}, "Loading in progress");
|
|
757
757
|
}
|
|
758
758
|
function DefaultEmptyData() {
|
|
759
|
-
return /*#__PURE__*/React
|
|
759
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
760
760
|
className: "text-center p-2 pb-4 font-bold"
|
|
761
761
|
}, "No data found");
|
|
762
762
|
}
|
|
@@ -793,14 +793,17 @@ function useCustomTable(props) {
|
|
|
793
793
|
} = props,
|
|
794
794
|
ctx = _objectWithoutPropertiesLoose(props, _excluded$6);
|
|
795
795
|
const _onClick = getOperationCallback(operations, onClick);
|
|
796
|
-
const defaultColumn = React
|
|
796
|
+
const defaultColumn = React.useMemo(() => ({
|
|
797
797
|
// Let's set up our default Filter UI
|
|
798
798
|
Filter: ColumnFilter,
|
|
799
799
|
ArrowSort
|
|
800
800
|
}), [ColumnFilter, ArrowSort]);
|
|
801
|
-
const [filterId, setFilterId] = React
|
|
801
|
+
const [filterId, setFilterId] = React.useState(controlledFilterId);
|
|
802
802
|
// DND
|
|
803
803
|
const [records, setRecords] = useState(data);
|
|
804
|
+
useEffect(() => {
|
|
805
|
+
setRecords(data);
|
|
806
|
+
}, [data]);
|
|
804
807
|
const _onDrag = (dragIndex, hoverIndex) => {
|
|
805
808
|
const newRecords = swapElements([...records], dragIndex, hoverIndex);
|
|
806
809
|
setRecords(newRecords);
|
|
@@ -840,7 +843,7 @@ function useCustomTable(props) {
|
|
|
840
843
|
filters
|
|
841
844
|
}
|
|
842
845
|
} = tableInstance;
|
|
843
|
-
React
|
|
846
|
+
React.useEffect(() => {
|
|
844
847
|
onChange({
|
|
845
848
|
pageIndex,
|
|
846
849
|
pageSize,
|
|
@@ -896,26 +899,26 @@ function Table(props) {
|
|
|
896
899
|
onDrop
|
|
897
900
|
} = useCustomTable(props);
|
|
898
901
|
// Render the UI for your table
|
|
899
|
-
return /*#__PURE__*/React
|
|
902
|
+
return /*#__PURE__*/React.createElement(DrapNDropContainer, {
|
|
900
903
|
enableDragNDrop: enableDragNDrop
|
|
901
|
-
}, /*#__PURE__*/React
|
|
904
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
902
905
|
className: classnames("table-group table-responsive", className)
|
|
903
|
-
}, /*#__PURE__*/React
|
|
906
|
+
}, /*#__PURE__*/React.createElement("table", _extends({
|
|
904
907
|
className: "table table-striped table-hover"
|
|
905
|
-
}, tableInstance.getTableProps()), /*#__PURE__*/React
|
|
908
|
+
}, tableInstance.getTableProps()), /*#__PURE__*/React.createElement("thead", null, tableInstance.headerGroups.map((headerGroup, i) => /*#__PURE__*/React.createElement("tr", _extends({}, headerGroup.getHeaderGroupProps(), {
|
|
906
909
|
key: `tableInstance.headerGroups${i}`
|
|
907
|
-
}), enableDragNDrop ? /*#__PURE__*/React
|
|
910
|
+
}), enableDragNDrop ? /*#__PURE__*/React.createElement("th", {
|
|
908
911
|
role: "columnheader",
|
|
909
912
|
className: "text-center"
|
|
910
|
-
}, /*#__PURE__*/React
|
|
913
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
911
914
|
className: "table-cell-header"
|
|
912
|
-
})) : null, headerGroup.headers.map(column => /*#__PURE__*/React
|
|
915
|
+
})) : null, headerGroup.headers.map(column => /*#__PURE__*/React.createElement("th", _extends({}, column.getHeaderProps(), {
|
|
913
916
|
key: `tableInstance.headers.column.${column.id}`
|
|
914
|
-
}), /*#__PURE__*/React
|
|
917
|
+
}), /*#__PURE__*/React.createElement(CellHeader, {
|
|
915
918
|
column: column
|
|
916
|
-
})))))), !isLoading ? /*#__PURE__*/React
|
|
919
|
+
})))))), !isLoading ? /*#__PURE__*/React.createElement("tbody", tableInstance.getTableBodyProps(), tableInstance.page.map((row, index) => {
|
|
917
920
|
tableInstance.prepareRow(row);
|
|
918
|
-
return /*#__PURE__*/React
|
|
921
|
+
return /*#__PURE__*/React.createElement(Row, {
|
|
919
922
|
index: index,
|
|
920
923
|
enableDragNDrop: enableDragNDrop,
|
|
921
924
|
onClick: onClick,
|
|
@@ -924,9 +927,9 @@ function Table(props) {
|
|
|
924
927
|
onDrag: onDrag,
|
|
925
928
|
onDrop: onDrop
|
|
926
929
|
});
|
|
927
|
-
})) : null), isLoading ? /*#__PURE__*/React
|
|
930
|
+
})) : null), isLoading ? /*#__PURE__*/React.createElement(Loader, null) : null, !data.length ? /*#__PURE__*/React.createElement(EmptyData, null) : null, !isLoading && data.length && !disablePagination ? /*#__PURE__*/React.createElement("div", {
|
|
928
931
|
className: "overflow-hidden"
|
|
929
|
-
}, /*#__PURE__*/React
|
|
932
|
+
}, /*#__PURE__*/React.createElement(Pagination, _extends({}, tableInstance, {
|
|
930
933
|
className: "text-sm",
|
|
931
934
|
pageIndex: pageIndex,
|
|
932
935
|
pageSize: pageSize,
|
|
@@ -954,13 +957,13 @@ function ActionsTable(_ref) {
|
|
|
954
957
|
accessor: "title",
|
|
955
958
|
id: "title"
|
|
956
959
|
}];
|
|
957
|
-
return /*#__PURE__*/React
|
|
960
|
+
return /*#__PURE__*/React.createElement(Table, _extends({}, props, {
|
|
958
961
|
disableFilters: disableFilters,
|
|
959
962
|
disablePagination: disablePagination,
|
|
960
963
|
columns: columns
|
|
961
|
-
}), /*#__PURE__*/React
|
|
964
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
962
965
|
className: "pagination-group"
|
|
963
|
-
}, /*#__PURE__*/React
|
|
966
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
964
967
|
name: "actions",
|
|
965
968
|
value: currentAction,
|
|
966
969
|
choices: [{
|
|
@@ -968,15 +971,15 @@ function ActionsTable(_ref) {
|
|
|
968
971
|
value: ""
|
|
969
972
|
}].concat(availableActions),
|
|
970
973
|
onChange: (name, action) => setAction(action)
|
|
971
|
-
}), /*#__PURE__*/React
|
|
974
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
972
975
|
className: "pl-3"
|
|
973
|
-
}, /*#__PURE__*/React
|
|
976
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
974
977
|
"data-testid": "submit",
|
|
975
978
|
disabled: currentAction === "",
|
|
976
979
|
className: "btn btn-success",
|
|
977
980
|
onClick: () => currentAction && onAddAction(currentAction),
|
|
978
981
|
type: "submit"
|
|
979
|
-
}, /*#__PURE__*/React
|
|
982
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
980
983
|
className: classnames(iconClass(undefined, "plus"), "mr-1")
|
|
981
984
|
}), " ", i18n("Add action")))));
|
|
982
985
|
}
|
|
@@ -991,9 +994,9 @@ function formatError(error) {
|
|
|
991
994
|
if (Object.prototype.hasOwnProperty.call(error, "errors")) {
|
|
992
995
|
return Object.keys(error.errors).map((key, index) => {
|
|
993
996
|
const item = error.errors[key];
|
|
994
|
-
return /*#__PURE__*/React
|
|
997
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
995
998
|
key: index
|
|
996
|
-
}, /*#__PURE__*/React
|
|
999
|
+
}, /*#__PURE__*/React.createElement("strong", null, item.name, " (", item.path, ")"), " ", "- ", item.message);
|
|
997
1000
|
});
|
|
998
1001
|
}
|
|
999
1002
|
// If this is a standard error.
|
|
@@ -1003,7 +1006,7 @@ function formatError(error) {
|
|
|
1003
1006
|
// If this is a joy validation error.
|
|
1004
1007
|
if (Object.prototype.hasOwnProperty.call(error, "name") && error.name === "ValidationError") {
|
|
1005
1008
|
return error.details.map((item, index) => {
|
|
1006
|
-
return /*#__PURE__*/React
|
|
1009
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1007
1010
|
key: index
|
|
1008
1011
|
}, item.message);
|
|
1009
1012
|
});
|
|
@@ -1021,7 +1024,7 @@ function Alert({
|
|
|
1021
1024
|
if (!error || Array.isArray(error) && !error.length) {
|
|
1022
1025
|
return null;
|
|
1023
1026
|
}
|
|
1024
|
-
return /*#__PURE__*/React
|
|
1027
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1025
1028
|
className: `alert alert-${type}`,
|
|
1026
1029
|
role: "alert"
|
|
1027
1030
|
}, formatError(error));
|
|
@@ -1032,13 +1035,13 @@ function Card({
|
|
|
1032
1035
|
label,
|
|
1033
1036
|
className
|
|
1034
1037
|
}) {
|
|
1035
|
-
return /*#__PURE__*/React
|
|
1038
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1036
1039
|
className: classnames("card", className)
|
|
1037
|
-
}, /*#__PURE__*/React
|
|
1040
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1038
1041
|
className: "card-header "
|
|
1039
|
-
}, /*#__PURE__*/React
|
|
1042
|
+
}, /*#__PURE__*/React.createElement("h4", {
|
|
1040
1043
|
className: "card-title"
|
|
1041
|
-
}, label)), /*#__PURE__*/React
|
|
1044
|
+
}, label)), /*#__PURE__*/React.createElement("div", {
|
|
1042
1045
|
className: "card-body",
|
|
1043
1046
|
role: "article"
|
|
1044
1047
|
}, children));
|
|
@@ -1194,7 +1197,7 @@ function Form(props) {
|
|
|
1194
1197
|
const {
|
|
1195
1198
|
element
|
|
1196
1199
|
} = useForm(props);
|
|
1197
|
-
return /*#__PURE__*/React
|
|
1200
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1198
1201
|
"data-testid": `formioContainer${props.name || ""}`,
|
|
1199
1202
|
ref: element,
|
|
1200
1203
|
className: props.className
|
|
@@ -1494,7 +1497,7 @@ function NamedFormAccess({
|
|
|
1494
1497
|
children
|
|
1495
1498
|
}) {
|
|
1496
1499
|
const [isValid, setIsValid] = useState(true);
|
|
1497
|
-
return /*#__PURE__*/React
|
|
1500
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form, {
|
|
1498
1501
|
name: name,
|
|
1499
1502
|
form: form[name],
|
|
1500
1503
|
submission: submissions[name],
|
|
@@ -1508,11 +1511,11 @@ function NamedFormAccess({
|
|
|
1508
1511
|
setIsValid(isValid);
|
|
1509
1512
|
},
|
|
1510
1513
|
options: options
|
|
1511
|
-
}), /*#__PURE__*/React
|
|
1514
|
+
}), /*#__PURE__*/React.createElement("button", {
|
|
1512
1515
|
disabled: !isValid,
|
|
1513
1516
|
className: "mt-5 btn btn-primary",
|
|
1514
1517
|
onClick: onSubmit
|
|
1515
|
-
}, "Save access"), children, /*#__PURE__*/React
|
|
1518
|
+
}, "Save access"), children, /*#__PURE__*/React.createElement("div", {
|
|
1516
1519
|
className: "alert alert-warning mt-5"
|
|
1517
1520
|
}, "Elevated permissions allow users to access and modify other user's entities. Assign with caution."));
|
|
1518
1521
|
}
|
|
@@ -1525,43 +1528,43 @@ function FormAccess(props) {
|
|
|
1525
1528
|
onChange,
|
|
1526
1529
|
onSubmit
|
|
1527
1530
|
} = useFormAccess(props);
|
|
1528
|
-
return /*#__PURE__*/React
|
|
1531
|
+
return /*#__PURE__*/React.createElement("div", null, props.children, /*#__PURE__*/React.createElement("div", {
|
|
1529
1532
|
className: "flex mb-5"
|
|
1530
|
-
}, /*#__PURE__*/React
|
|
1533
|
+
}, /*#__PURE__*/React.createElement(Card, {
|
|
1531
1534
|
label: "Manage submission access",
|
|
1532
1535
|
className: "flex-1"
|
|
1533
|
-
}, /*#__PURE__*/React
|
|
1536
|
+
}, /*#__PURE__*/React.createElement(NamedFormAccess, {
|
|
1534
1537
|
name: "submissionAccess",
|
|
1535
1538
|
form: form,
|
|
1536
1539
|
submissions: submissions,
|
|
1537
1540
|
onChange: onChange,
|
|
1538
1541
|
onSubmit: onSubmit,
|
|
1539
1542
|
options: options
|
|
1540
|
-
}, props.children)), /*#__PURE__*/React
|
|
1543
|
+
}, props.children)), /*#__PURE__*/React.createElement("div", {
|
|
1541
1544
|
className: "w-1/4 pl-4"
|
|
1542
|
-
}, /*#__PURE__*/React
|
|
1545
|
+
}, /*#__PURE__*/React.createElement(Card, {
|
|
1543
1546
|
label: "About Submission Data Permissions"
|
|
1544
|
-
}, /*#__PURE__*/React
|
|
1547
|
+
}, /*#__PURE__*/React.createElement("p", null, "Submission Data Permissions allow you to control who can create, view, and modify form submission data."), /*#__PURE__*/React.createElement("ul", {
|
|
1545
1548
|
className: "mt-5 pl-7 list-disc"
|
|
1546
|
-
}, /*#__PURE__*/React
|
|
1549
|
+
}, /*#__PURE__*/React.createElement("li", {
|
|
1547
1550
|
className: "pb-2"
|
|
1548
|
-
}, /*#__PURE__*/React
|
|
1551
|
+
}, /*#__PURE__*/React.createElement("strong", null, "Own Permissions"), " - These permissions apply if the user is the original creator of the submission data and is listed as the owner of the submission in submission.owner. This allows users to create and edit their own submission data without seeing other user's data."), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("strong", null, "All Permissions"), " - These permissions apply to all submission data regardless of who owns it."))))), /*#__PURE__*/React.createElement("div", {
|
|
1549
1552
|
className: "flex mb-5"
|
|
1550
|
-
}, /*#__PURE__*/React
|
|
1553
|
+
}, /*#__PURE__*/React.createElement(Card, {
|
|
1551
1554
|
label: `Manage ${type} definition access`,
|
|
1552
1555
|
className: "flex-1"
|
|
1553
|
-
}, /*#__PURE__*/React
|
|
1556
|
+
}, /*#__PURE__*/React.createElement(NamedFormAccess, {
|
|
1554
1557
|
name: "access",
|
|
1555
1558
|
form: form,
|
|
1556
1559
|
submissions: submissions,
|
|
1557
1560
|
onChange: onChange,
|
|
1558
1561
|
onSubmit: onSubmit,
|
|
1559
1562
|
options: options
|
|
1560
|
-
}, props.children)), /*#__PURE__*/React
|
|
1563
|
+
}, props.children)), /*#__PURE__*/React.createElement("div", {
|
|
1561
1564
|
className: "w-1/4 pl-4"
|
|
1562
|
-
}, /*#__PURE__*/React
|
|
1565
|
+
}, /*#__PURE__*/React.createElement(Card, {
|
|
1563
1566
|
label: "About Form Definition Access"
|
|
1564
|
-
}, /*#__PURE__*/React
|
|
1567
|
+
}, /*#__PURE__*/React.createElement("p", null, "These permissions allow you to give access to a single form's JSON definition so they can render the form."), /*#__PURE__*/React.createElement("p", null, "Typically you will want to allow all of your roles to be able to Read the form definition."), /*#__PURE__*/React.createElement("p", null, "Each form also has an owner at ", /*#__PURE__*/React.createElement("strong", null, "form.owner"), " which is the user who created the form. In some applications users are allowed to create their own forms. In those cases it is helpful to have Owner based permissions as well.")))));
|
|
1565
1568
|
}
|
|
1566
1569
|
FormAccess.propTypes = {
|
|
1567
1570
|
type: PropTypes.string.isRequired,
|
|
@@ -1616,7 +1619,7 @@ function FormAction(_ref2) {
|
|
|
1616
1619
|
}
|
|
1617
1620
|
};
|
|
1618
1621
|
})();
|
|
1619
|
-
return /*#__PURE__*/React
|
|
1622
|
+
return /*#__PURE__*/React.createElement("div", null, children, /*#__PURE__*/React.createElement(Form, {
|
|
1620
1623
|
form: form,
|
|
1621
1624
|
submission: submission,
|
|
1622
1625
|
onSubmit: onSubmit,
|
|
@@ -1654,7 +1657,7 @@ async function createBuilder(el, {
|
|
|
1654
1657
|
console.error(er);
|
|
1655
1658
|
}
|
|
1656
1659
|
}
|
|
1657
|
-
class FormBuilder extends React
|
|
1660
|
+
class FormBuilder extends React.Component {
|
|
1658
1661
|
constructor(props) {
|
|
1659
1662
|
super(props);
|
|
1660
1663
|
this.elRef = void 0;
|
|
@@ -1732,12 +1735,12 @@ class FormBuilder extends React$1.Component {
|
|
|
1732
1735
|
});
|
|
1733
1736
|
}
|
|
1734
1737
|
render() {
|
|
1735
|
-
return /*#__PURE__*/React
|
|
1738
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1736
1739
|
ref: ref => {
|
|
1737
1740
|
this.elRef = ref;
|
|
1738
1741
|
},
|
|
1739
1742
|
onClick: e => e.stopPropagation()
|
|
1740
|
-
}, /*#__PURE__*/React
|
|
1743
|
+
}, /*#__PURE__*/React.createElement("div", null));
|
|
1741
1744
|
}
|
|
1742
1745
|
}
|
|
1743
1746
|
FormBuilder.defaultProps = {
|
|
@@ -1806,37 +1809,37 @@ function FormEditCTAs({
|
|
|
1806
1809
|
placement: "top",
|
|
1807
1810
|
title: t("Reset all changes")
|
|
1808
1811
|
});
|
|
1809
|
-
return /*#__PURE__*/React
|
|
1812
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1810
1813
|
className: "form-edit__actions"
|
|
1811
|
-
}, /*#__PURE__*/React
|
|
1814
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
|
|
1812
1815
|
className: `btn btn-primary btn-save flex ${disabled ? "disabled" : ""}`,
|
|
1813
1816
|
disabled: disabled,
|
|
1814
1817
|
onClick: () => !disabled && onSubmit && onSubmit()
|
|
1815
|
-
}, /*#__PURE__*/React
|
|
1818
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
1816
1819
|
className: `mr-1 ${iconClass(options.iconset, "save")}`
|
|
1817
|
-
}), saveText), /*#__PURE__*/React
|
|
1820
|
+
}), saveText), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
|
|
1818
1821
|
className: `btn btn-light btn-undo ${hasUndo ? "" : "disabled"}`,
|
|
1819
1822
|
onClick: () => onUndo && onUndo(),
|
|
1820
1823
|
ref: undoTooltipRef
|
|
1821
|
-
}, /*#__PURE__*/React
|
|
1824
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
1822
1825
|
className: iconClass(options.iconset, "undo")
|
|
1823
|
-
})), /*#__PURE__*/React
|
|
1826
|
+
})), /*#__PURE__*/React.createElement("button", {
|
|
1824
1827
|
className: `btn btn-light btn-redo ${hasRedo ? "" : "disabled"}`,
|
|
1825
1828
|
onClick: () => onRedo && onRedo(),
|
|
1826
1829
|
ref: redoTooltipRef
|
|
1827
|
-
}, /*#__PURE__*/React
|
|
1830
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
1828
1831
|
className: iconClass(options.iconset, "redo")
|
|
1829
|
-
}))), /*#__PURE__*/React
|
|
1832
|
+
}))), /*#__PURE__*/React.createElement("div", null, onCopy && /*#__PURE__*/React.createElement("button", {
|
|
1830
1833
|
className: "btn btn-light",
|
|
1831
1834
|
onClick: () => onCopy(),
|
|
1832
1835
|
ref: copyTooltipRef
|
|
1833
|
-
}, /*#__PURE__*/React
|
|
1836
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
1834
1837
|
className: iconClass(options.iconset, "copy")
|
|
1835
|
-
})), /*#__PURE__*/React
|
|
1838
|
+
})), /*#__PURE__*/React.createElement("button", {
|
|
1836
1839
|
className: `btn btn-light btn-reset`,
|
|
1837
1840
|
onClick: () => onReset && onReset(),
|
|
1838
1841
|
ref: resetTooltipRef
|
|
1839
|
-
}, /*#__PURE__*/React
|
|
1842
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
1840
1843
|
className: iconClass(options.iconset, "reset")
|
|
1841
1844
|
})))));
|
|
1842
1845
|
}
|
|
@@ -1882,14 +1885,14 @@ function InputTags(_ref) {
|
|
|
1882
1885
|
instance.destroy();
|
|
1883
1886
|
};
|
|
1884
1887
|
}, []);
|
|
1885
|
-
return /*#__PURE__*/React
|
|
1888
|
+
return /*#__PURE__*/React.createElement(FormControl, {
|
|
1886
1889
|
name: name,
|
|
1887
1890
|
label: label,
|
|
1888
1891
|
required: required,
|
|
1889
1892
|
description: description,
|
|
1890
1893
|
prefix: prefix,
|
|
1891
1894
|
suffix: suffix
|
|
1892
|
-
}, /*#__PURE__*/React
|
|
1895
|
+
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
1893
1896
|
ref: ref,
|
|
1894
1897
|
type: "text"
|
|
1895
1898
|
}, props, {
|
|
@@ -1926,11 +1929,11 @@ function FormParameters({
|
|
|
1926
1929
|
baseUrl = window.location.origin
|
|
1927
1930
|
}) {
|
|
1928
1931
|
const hasTypeChoices = typeChoices && typeChoices.length > 1;
|
|
1929
|
-
return /*#__PURE__*/React
|
|
1932
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1930
1933
|
className: `form-edit__settings ${className}`
|
|
1931
|
-
}, /*#__PURE__*/React
|
|
1934
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1932
1935
|
className: "w-1/3"
|
|
1933
|
-
}, /*#__PURE__*/React
|
|
1936
|
+
}, /*#__PURE__*/React.createElement(InputText, {
|
|
1934
1937
|
label: "Title",
|
|
1935
1938
|
placeholder: "Enter the form title",
|
|
1936
1939
|
name: "title",
|
|
@@ -1938,9 +1941,9 @@ function FormParameters({
|
|
|
1938
1941
|
value: form.title,
|
|
1939
1942
|
disabled: !!readonly["title"],
|
|
1940
1943
|
onChange: onChange
|
|
1941
|
-
})), /*#__PURE__*/React
|
|
1944
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
1942
1945
|
className: "w-1/3"
|
|
1943
|
-
}, /*#__PURE__*/React
|
|
1946
|
+
}, /*#__PURE__*/React.createElement(InputText, {
|
|
1944
1947
|
label: "Name",
|
|
1945
1948
|
placeholder: "Enter the form machine name",
|
|
1946
1949
|
name: "name",
|
|
@@ -1948,16 +1951,16 @@ function FormParameters({
|
|
|
1948
1951
|
disabled: !!readonly["name"],
|
|
1949
1952
|
value: form.name,
|
|
1950
1953
|
onChange: onChange
|
|
1951
|
-
})), /*#__PURE__*/React
|
|
1954
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
1952
1955
|
className: "w-1/3"
|
|
1953
|
-
}, /*#__PURE__*/React
|
|
1956
|
+
}, /*#__PURE__*/React.createElement(InputText, {
|
|
1954
1957
|
label: "Path",
|
|
1955
1958
|
placeholder: "example",
|
|
1956
1959
|
name: "path",
|
|
1957
1960
|
className: "mb-0",
|
|
1958
|
-
description: /*#__PURE__*/React
|
|
1961
|
+
description: /*#__PURE__*/React.createElement("span", {
|
|
1959
1962
|
className: "text-xxs flex items-center"
|
|
1960
|
-
}, /*#__PURE__*/React
|
|
1963
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
1961
1964
|
className: "bx bx-link ml-1 mr-1"
|
|
1962
1965
|
}), `${baseUrl}/${form.path}`),
|
|
1963
1966
|
required: true,
|
|
@@ -1968,26 +1971,26 @@ function FormParameters({
|
|
|
1968
1971
|
width: "120px"
|
|
1969
1972
|
},
|
|
1970
1973
|
onChange: onChange
|
|
1971
|
-
})), /*#__PURE__*/React
|
|
1974
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
1972
1975
|
className: "w-1/3"
|
|
1973
|
-
}, /*#__PURE__*/React
|
|
1976
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
1974
1977
|
label: "Display as",
|
|
1975
1978
|
name: "display",
|
|
1976
1979
|
disabled: !!readonly["display"],
|
|
1977
1980
|
value: form.display,
|
|
1978
1981
|
choices: displayChoices,
|
|
1979
1982
|
onChange: onChange
|
|
1980
|
-
})), hasTypeChoices && /*#__PURE__*/React
|
|
1983
|
+
})), hasTypeChoices && /*#__PURE__*/React.createElement("div", {
|
|
1981
1984
|
className: "w-1/3"
|
|
1982
|
-
}, /*#__PURE__*/React
|
|
1985
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
1983
1986
|
label: "Type",
|
|
1984
1987
|
name: "type",
|
|
1985
1988
|
value: form.type,
|
|
1986
1989
|
choices: typeChoices,
|
|
1987
1990
|
onChange: onChange
|
|
1988
|
-
})), enableTags && /*#__PURE__*/React
|
|
1991
|
+
})), enableTags && /*#__PURE__*/React.createElement("div", {
|
|
1989
1992
|
className: "w-1/3"
|
|
1990
|
-
}, /*#__PURE__*/React
|
|
1993
|
+
}, /*#__PURE__*/React.createElement(InputTags, {
|
|
1991
1994
|
label: "Tags",
|
|
1992
1995
|
name: "tags",
|
|
1993
1996
|
value: form.tags,
|
|
@@ -2154,14 +2157,14 @@ function FormEdit(props) {
|
|
|
2154
2157
|
options = {},
|
|
2155
2158
|
builder
|
|
2156
2159
|
} = props;
|
|
2157
|
-
return /*#__PURE__*/React
|
|
2160
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
2158
2161
|
className: "form-edit"
|
|
2159
|
-
}, /*#__PURE__*/React
|
|
2162
|
+
}, /*#__PURE__*/React.createElement(FormParameters, _extends({}, props, {
|
|
2160
2163
|
className: "",
|
|
2161
2164
|
key: `form-settings-${form._id}`,
|
|
2162
2165
|
form: form,
|
|
2163
2166
|
onChange: setChange
|
|
2164
|
-
})), /*#__PURE__*/React
|
|
2167
|
+
})), /*#__PURE__*/React.createElement(FormEditCTAs, _extends({}, props, {
|
|
2165
2168
|
className: "",
|
|
2166
2169
|
key: `form-edit-ctas-${form._id}`,
|
|
2167
2170
|
options: options,
|
|
@@ -2173,7 +2176,7 @@ function FormEdit(props) {
|
|
|
2173
2176
|
onReset: reset,
|
|
2174
2177
|
onCopy: onCopy,
|
|
2175
2178
|
onSubmit: onSubmit
|
|
2176
|
-
}))), /*#__PURE__*/React
|
|
2179
|
+
}))), /*#__PURE__*/React.createElement(FormBuilder, {
|
|
2177
2180
|
key: `form-builder-${form._id}`,
|
|
2178
2181
|
components: form.components,
|
|
2179
2182
|
display: form.display,
|
|
@@ -2315,12 +2318,12 @@ function FormSettings(props) {
|
|
|
2315
2318
|
isValid
|
|
2316
2319
|
} = useFormSettings(props);
|
|
2317
2320
|
const i18n = options.i18n || (f => f);
|
|
2318
|
-
return /*#__PURE__*/React
|
|
2321
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Form, {
|
|
2319
2322
|
form: form,
|
|
2320
2323
|
submission: submission,
|
|
2321
2324
|
onChange: onChange,
|
|
2322
2325
|
options: options
|
|
2323
|
-
}), /*#__PURE__*/React
|
|
2326
|
+
}), /*#__PURE__*/React.createElement("button", {
|
|
2324
2327
|
"data-testid": "submit",
|
|
2325
2328
|
disabled: !isValid,
|
|
2326
2329
|
className: "mt-5 btn btn-primary",
|
|
@@ -2345,7 +2348,7 @@ function SelectColumnFilter({
|
|
|
2345
2348
|
label: value,
|
|
2346
2349
|
value
|
|
2347
2350
|
}));
|
|
2348
|
-
return /*#__PURE__*/React
|
|
2351
|
+
return /*#__PURE__*/React.createElement(Select, {
|
|
2349
2352
|
key: `filter-${column.id}`,
|
|
2350
2353
|
name: `filter-${column.id}`,
|
|
2351
2354
|
size: "sm",
|
|
@@ -6887,30 +6890,30 @@ function FormsCell(props) {
|
|
|
6887
6890
|
original: form
|
|
6888
6891
|
}
|
|
6889
6892
|
} = props;
|
|
6890
|
-
return /*#__PURE__*/React
|
|
6893
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
6891
6894
|
className: "p-1"
|
|
6892
|
-
}, /*#__PURE__*/React
|
|
6895
|
+
}, /*#__PURE__*/React.createElement("h4", {
|
|
6893
6896
|
className: "text-primary text-lg flex items-center"
|
|
6894
|
-
}, /*#__PURE__*/React
|
|
6897
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
6895
6898
|
className: classnames(iconClass(undefined, icon), "mr-1")
|
|
6896
|
-
}), form.title), /*#__PURE__*/React
|
|
6899
|
+
}), form.title), /*#__PURE__*/React.createElement("ul", {
|
|
6897
6900
|
className: "reset-list text-gray-500"
|
|
6898
|
-
}, /*#__PURE__*/React
|
|
6901
|
+
}, /*#__PURE__*/React.createElement("li", {
|
|
6899
6902
|
className: "text-sm"
|
|
6900
|
-
}, "Name: ", form.name || form.machineName), /*#__PURE__*/React
|
|
6903
|
+
}, "Name: ", form.name || form.machineName), /*#__PURE__*/React.createElement("li", {
|
|
6901
6904
|
className: "mt-5"
|
|
6902
|
-
}, /*#__PURE__*/React
|
|
6905
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
6903
6906
|
className: "badge bg-light mr-1"
|
|
6904
|
-
}, /*#__PURE__*/React
|
|
6907
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
6905
6908
|
className: classnames(iconClass(undefined, "history"), "mr-1")
|
|
6906
|
-
}), /*#__PURE__*/React
|
|
6909
|
+
}), /*#__PURE__*/React.createElement("span", null, "Updated ", moment(form.modified).fromNow())), (form.tags || []).map((tag, index) => /*#__PURE__*/React.createElement("button", {
|
|
6907
6910
|
key: index,
|
|
6908
6911
|
className: "badge badge-hover bg-secondary mr-1",
|
|
6909
6912
|
onClick: stopPropagationWrapper(() => {
|
|
6910
6913
|
props.setFilter("tags", tag);
|
|
6911
6914
|
props.gotoPage(0);
|
|
6912
6915
|
})
|
|
6913
|
-
}, /*#__PURE__*/React
|
|
6916
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
6914
6917
|
className: classnames(iconClass(undefined, "tags"), "mr-1")
|
|
6915
6918
|
}), tag)))));
|
|
6916
6919
|
}
|
|
@@ -6930,7 +6933,7 @@ function FormsTable(_ref) {
|
|
|
6930
6933
|
Header: i18n("Title"),
|
|
6931
6934
|
accessor: "title",
|
|
6932
6935
|
id: "title",
|
|
6933
|
-
Cell: props => /*#__PURE__*/React
|
|
6936
|
+
Cell: props => /*#__PURE__*/React.createElement(FormCell, _extends({}, props, {
|
|
6934
6937
|
icon: props.icon,
|
|
6935
6938
|
i18n: i18n
|
|
6936
6939
|
})),
|
|
@@ -6941,13 +6944,13 @@ function FormsTable(_ref) {
|
|
|
6941
6944
|
accessor: "tags",
|
|
6942
6945
|
id: "tags",
|
|
6943
6946
|
hidden: true,
|
|
6944
|
-
Filter: props => tags && tags.length ? /*#__PURE__*/React
|
|
6947
|
+
Filter: props => tags && tags.length ? /*#__PURE__*/React.createElement(SelectColumnFilter, _extends({}, props, {
|
|
6945
6948
|
column: _extends({}, props.columns, {
|
|
6946
6949
|
choices: tags
|
|
6947
6950
|
})
|
|
6948
|
-
})) : /*#__PURE__*/React
|
|
6951
|
+
})) : /*#__PURE__*/React.createElement(DefaultColumnFilter, props)
|
|
6949
6952
|
}];
|
|
6950
|
-
return /*#__PURE__*/React
|
|
6953
|
+
return /*#__PURE__*/React.createElement(Table, _extends({}, props, {
|
|
6951
6954
|
columns: columns
|
|
6952
6955
|
}));
|
|
6953
6956
|
}
|
|
@@ -6959,9 +6962,9 @@ function Loader({
|
|
|
6959
6962
|
className = ""
|
|
6960
6963
|
}) {
|
|
6961
6964
|
if (isActive) {
|
|
6962
|
-
return /*#__PURE__*/React
|
|
6965
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
6963
6966
|
className: classnames("opacity-85 z-20 flex items-center justify-center p-5 absolute top-0 right-0 left-0 bottom-0 bg-white", className)
|
|
6964
|
-
}, /*#__PURE__*/React
|
|
6967
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
6965
6968
|
"data-testid": `icon_${icon}`,
|
|
6966
6969
|
color: color,
|
|
6967
6970
|
className: `text-11xl ${iconClass(undefined, icon, true)}`
|
|
@@ -7021,35 +7024,35 @@ function Modal(_ref) {
|
|
|
7021
7024
|
if (!show) {
|
|
7022
7025
|
return null;
|
|
7023
7026
|
}
|
|
7024
|
-
return /*#__PURE__*/React
|
|
7027
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
7025
7028
|
role: "dialog",
|
|
7026
7029
|
className: `formio-dialog formio-dialog-theme-default ${className}`
|
|
7027
|
-
}, /*#__PURE__*/React
|
|
7030
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
7028
7031
|
className: "formio-dialog-overlay",
|
|
7029
7032
|
onClick: onClickClose
|
|
7030
|
-
}), /*#__PURE__*/React
|
|
7033
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
7031
7034
|
style: style,
|
|
7032
7035
|
className: "formio-dialog-content"
|
|
7033
|
-
}, /*#__PURE__*/React
|
|
7036
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
7034
7037
|
className: "formio-dialog-wrapper"
|
|
7035
|
-
}, title ? /*#__PURE__*/React
|
|
7038
|
+
}, title ? /*#__PURE__*/React.createElement("div", {
|
|
7036
7039
|
className: "formio-dialog-title",
|
|
7037
7040
|
ref: titleRef,
|
|
7038
7041
|
"data-testid": "modalTitle"
|
|
7039
|
-
}, title) : null, /*#__PURE__*/React
|
|
7042
|
+
}, title) : null, /*#__PURE__*/React.createElement("div", {
|
|
7040
7043
|
className: "formio-dialog-body",
|
|
7041
7044
|
style: {
|
|
7042
7045
|
maxHeight
|
|
7043
7046
|
},
|
|
7044
7047
|
"data-testid": "modalBody"
|
|
7045
|
-
}, show && children), ModalFooter ? /*#__PURE__*/React
|
|
7048
|
+
}, show && children), ModalFooter ? /*#__PURE__*/React.createElement("div", {
|
|
7046
7049
|
className: "formio-dialog-footer",
|
|
7047
7050
|
ref: footerRef,
|
|
7048
7051
|
"data-testid": "modalFooter"
|
|
7049
|
-
}, /*#__PURE__*/React
|
|
7052
|
+
}, /*#__PURE__*/React.createElement(ModalFooter, _extends({}, props, {
|
|
7050
7053
|
closeModal: closeModal,
|
|
7051
7054
|
onClose: onClickClose
|
|
7052
|
-
}))) : null), /*#__PURE__*/React
|
|
7055
|
+
}))) : null), /*#__PURE__*/React.createElement("button", {
|
|
7053
7056
|
className: "formio-dialog-close float-right btn btn-secondary btn-sm",
|
|
7054
7057
|
"aria-label": "close",
|
|
7055
7058
|
"data-testid": "closeModal",
|
|
@@ -7065,13 +7068,13 @@ function RemoveModalFooter({
|
|
|
7065
7068
|
onClose,
|
|
7066
7069
|
i18n = f => f
|
|
7067
7070
|
}) {
|
|
7068
|
-
return /*#__PURE__*/React
|
|
7071
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
7069
7072
|
className: "flex items-center justify-center bg-white p-2"
|
|
7070
|
-
}, /*#__PURE__*/React
|
|
7073
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
7071
7074
|
"data-testid": "customCloseModal",
|
|
7072
7075
|
className: "btn btn-outline-dark mx-2",
|
|
7073
7076
|
onClick: onClose
|
|
7074
|
-
}, i18n("Cancel")), /*#__PURE__*/React
|
|
7077
|
+
}, i18n("Cancel")), /*#__PURE__*/React.createElement("button", {
|
|
7075
7078
|
disabled: valueToCompare !== value,
|
|
7076
7079
|
"data-testid": "customSubmitModal",
|
|
7077
7080
|
className: "btn btn-danger mx-2",
|
|
@@ -7080,7 +7083,7 @@ function RemoveModalFooter({
|
|
|
7080
7083
|
onSubmit(e);
|
|
7081
7084
|
}
|
|
7082
7085
|
}
|
|
7083
|
-
}, /*#__PURE__*/React
|
|
7086
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
7084
7087
|
className: classnames(iconClass(undefined, "trash"), "mr-2")
|
|
7085
7088
|
}), i18n("Remove")));
|
|
7086
7089
|
}
|
|
@@ -7095,7 +7098,7 @@ function RemoveModal(_ref) {
|
|
|
7095
7098
|
i18n = noop
|
|
7096
7099
|
} = props;
|
|
7097
7100
|
const [value, setValue] = useState();
|
|
7098
|
-
return /*#__PURE__*/React
|
|
7101
|
+
return /*#__PURE__*/React.createElement(Modal, _extends({}, props, {
|
|
7099
7102
|
className: classnames(props.className, "formio-dialog-theme-remove"),
|
|
7100
7103
|
style: {
|
|
7101
7104
|
maxWidth
|
|
@@ -7103,11 +7106,11 @@ function RemoveModal(_ref) {
|
|
|
7103
7106
|
title: `Drop ${(_props$itemType = props.itemType) == null ? void 0 : _props$itemType.toLowerCase()}`,
|
|
7104
7107
|
value: value,
|
|
7105
7108
|
footer: RemoveModalFooter
|
|
7106
|
-
}), /*#__PURE__*/React
|
|
7109
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
7107
7110
|
className: "px-4 pt-3 pb-5"
|
|
7108
|
-
}, /*#__PURE__*/React
|
|
7111
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
7109
7112
|
className: "pb-1"
|
|
7110
|
-
}, children, i18n("To drop"), " ", /*#__PURE__*/React
|
|
7113
|
+
}, children, i18n("To drop"), " ", /*#__PURE__*/React.createElement("strong", null, props.valueToCompare), ",\xA0", i18n("type the"), "\xA0", /*#__PURE__*/React.createElement("strong", null, "\"", (_props$itemType2 = props.itemType) == null ? void 0 : _props$itemType2.toLowerCase(), "\""), "\xA0", i18n("name"), " ", /*#__PURE__*/React.createElement("strong", null, "\"", props.valueToCompare, "\""), "."), /*#__PURE__*/React.createElement(InputText, {
|
|
7111
7114
|
name: "remove",
|
|
7112
7115
|
value: value,
|
|
7113
7116
|
onChange: (name, value) => setValue(value)
|
|
@@ -7288,17 +7291,17 @@ function DefaultCell({
|
|
|
7288
7291
|
render = f => f
|
|
7289
7292
|
}) {
|
|
7290
7293
|
if (value === undefined) {
|
|
7291
|
-
return /*#__PURE__*/React
|
|
7294
|
+
return /*#__PURE__*/React.createElement("span", null);
|
|
7292
7295
|
}
|
|
7293
7296
|
const rendered = render(value);
|
|
7294
7297
|
if (value !== rendered) {
|
|
7295
|
-
return /*#__PURE__*/React
|
|
7298
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
7296
7299
|
dangerouslySetInnerHTML: {
|
|
7297
7300
|
__html: rendered
|
|
7298
7301
|
}
|
|
7299
7302
|
});
|
|
7300
7303
|
}
|
|
7301
|
-
return /*#__PURE__*/React
|
|
7304
|
+
return /*#__PURE__*/React.createElement("span", null, String(value));
|
|
7302
7305
|
}
|
|
7303
7306
|
|
|
7304
7307
|
function mapFormToColumns(form) {
|
|
@@ -7309,7 +7312,7 @@ function mapFormToColumns(form) {
|
|
|
7309
7312
|
const column = {
|
|
7310
7313
|
Header: component.label || component.title || component.key,
|
|
7311
7314
|
accessor: `data.${component.key}`,
|
|
7312
|
-
Cell: props => /*#__PURE__*/React
|
|
7315
|
+
Cell: props => /*#__PURE__*/React.createElement(DefaultCell, _extends({}, props, {
|
|
7313
7316
|
render: value => cmp.asString(value)
|
|
7314
7317
|
}))
|
|
7315
7318
|
};
|
|
@@ -7330,7 +7333,7 @@ function SubmissionsTable(_ref) {
|
|
|
7330
7333
|
} = _ref,
|
|
7331
7334
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$e);
|
|
7332
7335
|
const columns = form && mapFormToColumns(form);
|
|
7333
|
-
return /*#__PURE__*/React
|
|
7336
|
+
return /*#__PURE__*/React.createElement(Table, _extends({}, props, {
|
|
7334
7337
|
columns: columns
|
|
7335
7338
|
}));
|
|
7336
7339
|
}
|
|
@@ -7343,7 +7346,7 @@ function SliderColumnFilter({
|
|
|
7343
7346
|
id
|
|
7344
7347
|
}
|
|
7345
7348
|
}) {
|
|
7346
|
-
const [min, max] = React
|
|
7349
|
+
const [min, max] = React.useMemo(() => {
|
|
7347
7350
|
let min = preFilteredRows.length ? preFilteredRows[0].values[id] : 0;
|
|
7348
7351
|
let max = preFilteredRows.length ? preFilteredRows[0].values[id] : 0;
|
|
7349
7352
|
preFilteredRows.forEach(row => {
|
|
@@ -7352,7 +7355,7 @@ function SliderColumnFilter({
|
|
|
7352
7355
|
});
|
|
7353
7356
|
return [min, max];
|
|
7354
7357
|
}, [id, preFilteredRows]);
|
|
7355
|
-
return /*#__PURE__*/React
|
|
7358
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", {
|
|
7356
7359
|
type: "range",
|
|
7357
7360
|
min: min,
|
|
7358
7361
|
max: max,
|
|
@@ -7360,7 +7363,7 @@ function SliderColumnFilter({
|
|
|
7360
7363
|
onChange: e => {
|
|
7361
7364
|
setFilter(parseInt(e.target.value, 10));
|
|
7362
7365
|
}
|
|
7363
|
-
}), /*#__PURE__*/React
|
|
7366
|
+
}), /*#__PURE__*/React.createElement("button", {
|
|
7364
7367
|
onClick: () => setFilter(undefined)
|
|
7365
7368
|
}, "Off"));
|
|
7366
7369
|
}
|
|
@@ -7376,18 +7379,18 @@ function ButtonTab({
|
|
|
7376
7379
|
className,
|
|
7377
7380
|
after
|
|
7378
7381
|
}) {
|
|
7379
|
-
return /*#__PURE__*/React
|
|
7382
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
7380
7383
|
title: "button-wrapper",
|
|
7381
7384
|
className: classnames("tw-tabs__button-wrapper", isActive ? "-active" : "", back ? "-back" : "", className)
|
|
7382
|
-
}, /*#__PURE__*/React
|
|
7385
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
7383
7386
|
title: "button-tab",
|
|
7384
7387
|
className: classnames("tw-tabs__button", reverse ? "-reverse" : "", isActive ? "-active" : "", back ? "-back" : ""),
|
|
7385
7388
|
onClick: onClick
|
|
7386
|
-
}, icon && /*#__PURE__*/React
|
|
7389
|
+
}, icon && /*#__PURE__*/React.createElement("i", {
|
|
7387
7390
|
className: classnames(iconClass(undefined, icon), "tw-tabs__button-icon")
|
|
7388
|
-
}), /*#__PURE__*/React
|
|
7391
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
7389
7392
|
className: "tw-tabs__button-label"
|
|
7390
|
-
}, children), after), /*#__PURE__*/React
|
|
7393
|
+
}, children), after), /*#__PURE__*/React.createElement("div", {
|
|
7391
7394
|
className: classnames("tw-tabs__button-border", isActive ? "-active" : "")
|
|
7392
7395
|
}));
|
|
7393
7396
|
}
|
|
@@ -7405,18 +7408,18 @@ function Tabs(_ref) {
|
|
|
7405
7408
|
i18n = f => f
|
|
7406
7409
|
} = _ref,
|
|
7407
7410
|
additionalProps = _objectWithoutPropertiesLoose(_ref, _excluded$f);
|
|
7408
|
-
return /*#__PURE__*/React
|
|
7411
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
7409
7412
|
"data-testid": "tabs-comp",
|
|
7410
7413
|
className: `tw-tabs ${className}`,
|
|
7411
7414
|
style: style
|
|
7412
|
-
}, /*#__PURE__*/React
|
|
7415
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("nav", {
|
|
7413
7416
|
className: "tw-tabs__header"
|
|
7414
|
-
}, /*#__PURE__*/React
|
|
7417
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
7415
7418
|
className: "tw-tabs__header-wrapper"
|
|
7416
|
-
}, /*#__PURE__*/React
|
|
7419
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
7417
7420
|
className: "tw-tabs__header-border"
|
|
7418
7421
|
}), items.filter(item => item.label || item.icon).map((item, index) => {
|
|
7419
|
-
return /*#__PURE__*/React
|
|
7422
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
7420
7423
|
key: index,
|
|
7421
7424
|
back: item.back,
|
|
7422
7425
|
isActive: (current == null ? void 0 : current.action) === item.action,
|
|
@@ -7425,11 +7428,11 @@ function Tabs(_ref) {
|
|
|
7425
7428
|
onClick && onClick(item);
|
|
7426
7429
|
}
|
|
7427
7430
|
}, additionalProps, item), i18n(item.label || ""));
|
|
7428
|
-
}), AddButton && /*#__PURE__*/React
|
|
7431
|
+
}), AddButton && /*#__PURE__*/React.createElement(AddButton, _extends({}, additionalProps, {
|
|
7429
7432
|
current: current
|
|
7430
|
-
})))), HeaderChildren && /*#__PURE__*/React
|
|
7433
|
+
})))), HeaderChildren && /*#__PURE__*/React.createElement(HeaderChildren, _extends({}, additionalProps, {
|
|
7431
7434
|
current: current
|
|
7432
|
-
}))), /*#__PURE__*/React
|
|
7435
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
7433
7436
|
title: "tab-body",
|
|
7434
7437
|
className: "tw-tabs__body"
|
|
7435
7438
|
}, children));
|