@tsed/react-formio 2.0.3 → 2.1.0
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/coverage.json +4 -4
- package/dist/components/actions-table/actionsTable.component.d.ts +1 -1
- package/dist/components/form-access/formAccess.component.d.ts +1 -1
- package/dist/components/form-edit/formEdit.stories.d.ts +1 -1
- package/dist/components/forms-table/formsTable.component.d.ts +1 -1
- package/dist/components/submissions-table/submissionsTable.component.d.ts +1 -1
- package/dist/components/table/components/defaultCells.component.d.ts +4 -0
- package/dist/components/table/components/defaultRow.component.d.ts +12 -0
- package/dist/components/table/components/dragNDropContainer.d.ts +4 -0
- package/dist/components/table/hooks/useCustomTable.hook.d.ts +187 -0
- package/dist/components/table/hooks/useDragnDropRow.hook.d.ts +266 -0
- package/dist/components/table/index.d.ts +2 -1
- package/dist/components/table/table.component.d.ts +2 -71
- package/dist/components/table/table.stories.d.ts +25 -0
- package/dist/components/table/utils/swapElements.d.ts +1 -0
- package/dist/components/table/utils/swapElements.spec.d.ts +1 -0
- package/dist/index.js +315 -88
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +445 -225
- package/dist/index.modern.js.map +1 -1
- package/package.json +5 -3
- package/src/components/actions-table/actionsTable.component.tsx +2 -1
- package/src/components/form-access/formAccess.component.tsx +1 -1
- package/src/components/form-edit/formEdit.stories.tsx +2 -2
- package/src/components/forms-table/formsTable.component.tsx +2 -1
- package/src/components/forms-table/formsTable.stories.tsx +2 -2
- package/src/components/submissions-table/submissionsTable.component.tsx +2 -1
- package/src/components/table/components/defaultCells.component.tsx +21 -0
- package/src/components/table/components/defaultRow.component.tsx +50 -0
- package/src/components/table/components/dragNDropContainer.tsx +7 -0
- package/src/components/table/hooks/useCustomTable.hook.tsx +231 -0
- package/src/components/table/hooks/useDragnDropRow.hook.ts +80 -0
- package/src/components/table/index.ts +2 -1
- package/src/components/table/table.component.tsx +83 -233
- package/src/components/table/table.stories.tsx +56 -0
- package/src/components/table/utils/swapElements.spec.ts +7 -0
- package/src/components/table/utils/swapElements.ts +7 -0
- /package/dist/components/table/{utils → hooks}/useOperations.hook.d.ts +0 -0
- /package/src/components/table/{utils → hooks}/useOperations.hook.tsx +0 -0
package/dist/index.modern.js
CHANGED
|
@@ -3,11 +3,13 @@ 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, { useRef, useEffect, useState, useMemo, useCallback, useReducer } from 'react';
|
|
6
|
+
import React$1, { 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';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
|
+
import { DndProvider, useDrop, useDrag } from 'react-dnd';
|
|
12
|
+
import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
11
13
|
import { useTable, useFilters, useGroupBy, useSortBy, usePagination } from 'react-table';
|
|
12
14
|
import AllComponents from 'formiojs/components';
|
|
13
15
|
import cloneDeep from 'lodash/cloneDeep';
|
|
@@ -126,27 +128,27 @@ function FormControl({
|
|
|
126
128
|
label,
|
|
127
129
|
className
|
|
128
130
|
}) {
|
|
129
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
131
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
130
132
|
"data-testid": name && `form-group-${name}`,
|
|
131
133
|
id: `form-group-${name || ""}`,
|
|
132
134
|
className: classnames("form-group", className)
|
|
133
|
-
}, label && /*#__PURE__*/React.createElement("label", {
|
|
135
|
+
}, label && /*#__PURE__*/React$1.createElement("label", {
|
|
134
136
|
htmlFor: name,
|
|
135
137
|
"data-testid": "form-control-label",
|
|
136
138
|
className: `col-form-label ${required ? " field-required" : ""}`
|
|
137
|
-
}, label), /*#__PURE__*/React.createElement("div", {
|
|
139
|
+
}, label), /*#__PURE__*/React$1.createElement("div", {
|
|
138
140
|
className: "input-group"
|
|
139
|
-
}, prefix && /*#__PURE__*/React.createElement("div", {
|
|
141
|
+
}, prefix && /*#__PURE__*/React$1.createElement("div", {
|
|
140
142
|
className: "input-group-prepend"
|
|
141
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
143
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
142
144
|
className: "input-group-text",
|
|
143
145
|
"data-testid": "form-control-prefix"
|
|
144
|
-
}, prefix)), children, suffix && /*#__PURE__*/React.createElement("div", {
|
|
146
|
+
}, prefix)), children, suffix && /*#__PURE__*/React$1.createElement("div", {
|
|
145
147
|
className: "input-group-append"
|
|
146
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
148
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
147
149
|
className: "input-group-text",
|
|
148
150
|
"data-testid": "form-control-suffix"
|
|
149
|
-
}, suffix))), description && /*#__PURE__*/React.createElement("div", {
|
|
151
|
+
}, suffix))), description && /*#__PURE__*/React$1.createElement("div", {
|
|
150
152
|
"data-testid": "form-control-description",
|
|
151
153
|
className: "form-text text-muted"
|
|
152
154
|
}, description));
|
|
@@ -194,7 +196,7 @@ function Select(_ref) {
|
|
|
194
196
|
label: placeholder,
|
|
195
197
|
value: ""
|
|
196
198
|
}, ...choices];
|
|
197
|
-
return /*#__PURE__*/React.createElement(FormControl, {
|
|
199
|
+
return /*#__PURE__*/React$1.createElement(FormControl, {
|
|
198
200
|
name: name,
|
|
199
201
|
label: label,
|
|
200
202
|
required: required,
|
|
@@ -202,7 +204,7 @@ function Select(_ref) {
|
|
|
202
204
|
prefix: prefix,
|
|
203
205
|
suffix: suffix,
|
|
204
206
|
shadow: false
|
|
205
|
-
}, /*#__PURE__*/React.createElement("select", _extends({
|
|
207
|
+
}, /*#__PURE__*/React$1.createElement("select", _extends({
|
|
206
208
|
ref: ref
|
|
207
209
|
}, props, {
|
|
208
210
|
"data-testid": `select_${name}`,
|
|
@@ -219,7 +221,7 @@ function Select(_ref) {
|
|
|
219
221
|
label,
|
|
220
222
|
value
|
|
221
223
|
}) => {
|
|
222
|
-
return /*#__PURE__*/React.createElement("option", {
|
|
224
|
+
return /*#__PURE__*/React$1.createElement("option", {
|
|
223
225
|
key: String(value),
|
|
224
226
|
label: label,
|
|
225
227
|
value: value
|
|
@@ -235,6 +237,15 @@ Select.propTypes = {
|
|
|
235
237
|
choices: PropTypes.array.isRequired
|
|
236
238
|
};
|
|
237
239
|
|
|
240
|
+
function DrapNDropContainer({
|
|
241
|
+
enableDragNDrop,
|
|
242
|
+
children
|
|
243
|
+
}) {
|
|
244
|
+
return enableDragNDrop ? /*#__PURE__*/React.createElement(DndProvider, {
|
|
245
|
+
backend: HTML5Backend
|
|
246
|
+
}, children) : /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
247
|
+
}
|
|
248
|
+
|
|
238
249
|
const LEFT_PAGE = "LEFT";
|
|
239
250
|
const RIGHT_PAGE = "RIGHT";
|
|
240
251
|
function range(from, to, step = 1) {
|
|
@@ -286,7 +297,7 @@ function PaginationButton(props) {
|
|
|
286
297
|
active
|
|
287
298
|
} = props,
|
|
288
299
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
289
|
-
return /*#__PURE__*/React.createElement(Component, _extends({}, otherProps, {
|
|
300
|
+
return /*#__PURE__*/React$1.createElement(Component, _extends({}, otherProps, {
|
|
290
301
|
"data-testid": "pagination-button",
|
|
291
302
|
disabled: disabled,
|
|
292
303
|
className: classnames("page-link", disabled ? "disabled" : "", active ? "" : "", props.className)
|
|
@@ -317,55 +328,55 @@ function Pagination(props) {
|
|
|
317
328
|
value,
|
|
318
329
|
label: value
|
|
319
330
|
}));
|
|
320
|
-
return /*#__PURE__*/React.createElement("nav", {
|
|
331
|
+
return /*#__PURE__*/React$1.createElement("nav", {
|
|
321
332
|
"aria-label": "Page navigation",
|
|
322
333
|
className: classnames("pagination-group -mb-3", className)
|
|
323
|
-
}, /*#__PURE__*/React.createElement("ul", {
|
|
334
|
+
}, /*#__PURE__*/React$1.createElement("ul", {
|
|
324
335
|
className: "pagination mb-3 mr-3"
|
|
325
|
-
}, /*#__PURE__*/React.createElement("li", {
|
|
336
|
+
}, /*#__PURE__*/React$1.createElement("li", {
|
|
326
337
|
className: classnames("page-item", !canPreviousPage && "disabled")
|
|
327
|
-
}, /*#__PURE__*/React.createElement(PaginationButton, {
|
|
338
|
+
}, /*#__PURE__*/React$1.createElement(PaginationButton, {
|
|
328
339
|
tabIndex: -1,
|
|
329
340
|
disabled: !canPreviousPage,
|
|
330
341
|
onClick: () => previousPage()
|
|
331
342
|
}, i18n("Previous"))), pageNumbers.map(page => {
|
|
332
343
|
if ([LEFT_PAGE, RIGHT_PAGE].includes(page)) {
|
|
333
|
-
return /*#__PURE__*/React.createElement("li", {
|
|
344
|
+
return /*#__PURE__*/React$1.createElement("li", {
|
|
334
345
|
className: "page-item",
|
|
335
346
|
key: page
|
|
336
|
-
}, /*#__PURE__*/React.createElement(PaginationButton, {
|
|
347
|
+
}, /*#__PURE__*/React$1.createElement(PaginationButton, {
|
|
337
348
|
"aria-hidden": "true"
|
|
338
349
|
}, "..."));
|
|
339
350
|
}
|
|
340
351
|
const active = page - 1 === pageIndex;
|
|
341
|
-
return /*#__PURE__*/React.createElement("li", {
|
|
352
|
+
return /*#__PURE__*/React$1.createElement("li", {
|
|
342
353
|
className: classnames("page-item", active && "active"),
|
|
343
354
|
key: page
|
|
344
|
-
}, /*#__PURE__*/React.createElement(PaginationButton, {
|
|
355
|
+
}, /*#__PURE__*/React$1.createElement(PaginationButton, {
|
|
345
356
|
tabIndex: pageIndex,
|
|
346
357
|
active: active,
|
|
347
358
|
onClick: () => gotoPage(page - 1)
|
|
348
359
|
}, page));
|
|
349
|
-
}), /*#__PURE__*/React.createElement("li", {
|
|
360
|
+
}), /*#__PURE__*/React$1.createElement("li", {
|
|
350
361
|
className: classnames("page-item", !canNextPage && "disabled")
|
|
351
|
-
}, /*#__PURE__*/React.createElement(PaginationButton, {
|
|
362
|
+
}, /*#__PURE__*/React$1.createElement(PaginationButton, {
|
|
352
363
|
tabIndex: pageNumbers.length,
|
|
353
364
|
disabled: !canNextPage,
|
|
354
365
|
onClick: () => nextPage()
|
|
355
|
-
}, i18n("Next")))), /*#__PURE__*/React.createElement("li", {
|
|
366
|
+
}, i18n("Next")))), /*#__PURE__*/React$1.createElement("li", {
|
|
356
367
|
className: "mb-3 mr-3 flex items-center"
|
|
357
|
-
}, /*#__PURE__*/React.createElement(Select, {
|
|
368
|
+
}, /*#__PURE__*/React$1.createElement(Select, {
|
|
358
369
|
name: "page",
|
|
359
370
|
value: pageSize,
|
|
360
371
|
choices: choices,
|
|
361
372
|
onChange: (name, value) => {
|
|
362
373
|
setPageSize(+value);
|
|
363
374
|
}
|
|
364
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
375
|
+
}), /*#__PURE__*/React$1.createElement("span", {
|
|
365
376
|
className: "ml-3"
|
|
366
|
-
}, i18n("items per page"))), pageOptions && /*#__PURE__*/React.createElement("li", {
|
|
377
|
+
}, i18n("items per page"))), pageOptions && /*#__PURE__*/React$1.createElement("li", {
|
|
367
378
|
className: "mb-3 flex items-center"
|
|
368
|
-
}, /*#__PURE__*/React.createElement("span", null, i18n("Page"), "\xA0"), /*#__PURE__*/React.createElement("strong", null, pageIndex + 1, " of ", pageOptions.length)));
|
|
379
|
+
}, /*#__PURE__*/React$1.createElement("span", null, i18n("Page"), "\xA0"), /*#__PURE__*/React$1.createElement("strong", null, pageIndex + 1, " of ", pageOptions.length)));
|
|
369
380
|
}
|
|
370
381
|
|
|
371
382
|
function DefaultArrowSort({
|
|
@@ -375,9 +386,9 @@ function DefaultArrowSort({
|
|
|
375
386
|
isSorted,
|
|
376
387
|
isSortedDesc
|
|
377
388
|
} = column;
|
|
378
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
389
|
+
return /*#__PURE__*/React$1.createElement("span", {
|
|
379
390
|
className: "table-arrow-sort"
|
|
380
|
-
}, isSorted ? /*#__PURE__*/React.createElement("i", {
|
|
391
|
+
}, isSorted ? /*#__PURE__*/React$1.createElement("i", {
|
|
381
392
|
className: iconClass(undefined, isSortedDesc ? "sort-up" : "sort-down")
|
|
382
393
|
}) : "");
|
|
383
394
|
}
|
|
@@ -385,15 +396,163 @@ function DefaultArrowSort({
|
|
|
385
396
|
function DefaultCellHeader({
|
|
386
397
|
column
|
|
387
398
|
}) {
|
|
388
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
399
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
389
400
|
className: "table-cell-header"
|
|
390
|
-
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
401
|
+
}, /*#__PURE__*/React$1.createElement("div", _extends({
|
|
391
402
|
className: "table-cell-header__label"
|
|
392
|
-
}, column.getSortByToggleProps()), /*#__PURE__*/React.createElement("span", null, column.render("Header")), column.render("ArrowSort")), column.canFilter ? /*#__PURE__*/React.createElement("div", {
|
|
403
|
+
}, column.getSortByToggleProps()), /*#__PURE__*/React$1.createElement("span", null, column.render("Header")), column.render("ArrowSort")), column.canFilter ? /*#__PURE__*/React$1.createElement("div", {
|
|
393
404
|
className: "table-cell-header__filter"
|
|
394
405
|
}, column.render("Filter")) : null);
|
|
395
406
|
}
|
|
396
407
|
|
|
408
|
+
const _excluded$2 = ["onDrag", "onDrop", "index"];
|
|
409
|
+
const DND_ITEM_TYPE = "row";
|
|
410
|
+
function useDndRow(_ref) {
|
|
411
|
+
let {
|
|
412
|
+
onDrag,
|
|
413
|
+
onDrop,
|
|
414
|
+
index
|
|
415
|
+
} = _ref,
|
|
416
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
417
|
+
const dropRef = useRef(null);
|
|
418
|
+
const dragRef = useRef(null);
|
|
419
|
+
const [, drop] = useDrop({
|
|
420
|
+
accept: DND_ITEM_TYPE,
|
|
421
|
+
drop(item) {
|
|
422
|
+
onDrop(item);
|
|
423
|
+
},
|
|
424
|
+
hover(item, monitor) {
|
|
425
|
+
if (!dropRef.current) {
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
const dragIndex = item.index;
|
|
429
|
+
const hoverIndex = index;
|
|
430
|
+
// Don't replace items with themselves
|
|
431
|
+
if (dragIndex === hoverIndex) {
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
// Determine rectangle on screen
|
|
435
|
+
const hoverBoundingRect = dropRef.current.getBoundingClientRect();
|
|
436
|
+
// Get vertical middle
|
|
437
|
+
const hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
|
|
438
|
+
// Determine mouse position
|
|
439
|
+
const clientOffset = monitor.getClientOffset();
|
|
440
|
+
if (!clientOffset) {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
// Get pixels to the top
|
|
444
|
+
const hoverClientY = clientOffset.y - hoverBoundingRect.top;
|
|
445
|
+
// Only perform the move when the mouse has crossed half of the items height
|
|
446
|
+
// When dragging downwards, only move when the cursor is below 50%
|
|
447
|
+
// When dragging upwards, only move when the cursor is above 50%
|
|
448
|
+
// Dragging downwards
|
|
449
|
+
if (dragIndex < hoverIndex && hoverClientY < hoverMiddleY) {
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
// Dragging upwards
|
|
453
|
+
if (dragIndex > hoverIndex && hoverClientY > hoverMiddleY) {
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
// Time to actually perform the action
|
|
457
|
+
onDrag(dragIndex, hoverIndex);
|
|
458
|
+
// Note: we're mutating the monitor item here!
|
|
459
|
+
// Generally it's better to avoid mutations,
|
|
460
|
+
// but it's good here for the sake of performance
|
|
461
|
+
// to avoid expensive index searches.
|
|
462
|
+
item.index = hoverIndex;
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
const [{
|
|
466
|
+
isDragging
|
|
467
|
+
}, drag, preview] = useDrag(() => ({
|
|
468
|
+
type: DND_ITEM_TYPE,
|
|
469
|
+
item: {
|
|
470
|
+
index
|
|
471
|
+
},
|
|
472
|
+
collect: monitor => ({
|
|
473
|
+
isDragging: monitor.isDragging()
|
|
474
|
+
})
|
|
475
|
+
}));
|
|
476
|
+
const opacity = isDragging ? 0 : 1;
|
|
477
|
+
preview(drop(dropRef));
|
|
478
|
+
drag(dragRef);
|
|
479
|
+
return _extends({}, props, {
|
|
480
|
+
opacity,
|
|
481
|
+
isDragging,
|
|
482
|
+
dropRef,
|
|
483
|
+
dragRef
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
function DefaultCells({
|
|
488
|
+
row
|
|
489
|
+
}) {
|
|
490
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, row.cells.map((cell, i) => {
|
|
491
|
+
const {
|
|
492
|
+
hidden,
|
|
493
|
+
colspan
|
|
494
|
+
} = cell.column;
|
|
495
|
+
if (hidden) {
|
|
496
|
+
return null;
|
|
497
|
+
}
|
|
498
|
+
return /*#__PURE__*/React.createElement("td", _extends({
|
|
499
|
+
colSpan: colspan
|
|
500
|
+
}, cell.getCellProps(), {
|
|
501
|
+
key: `tableInstance.page.cells.${cell.value || "value"}.${i}`
|
|
502
|
+
}), cell.render("Cell"));
|
|
503
|
+
}));
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
const _excluded$3 = ["onClick", "row", "enableDragNDrop", "onDrop", "onDrag"];
|
|
507
|
+
function DefaultDndRow(props) {
|
|
508
|
+
const {
|
|
509
|
+
isDragging,
|
|
510
|
+
dragRef,
|
|
511
|
+
dropRef,
|
|
512
|
+
opacity
|
|
513
|
+
} = useDndRow(props);
|
|
514
|
+
return /*#__PURE__*/React$1.createElement("tr", {
|
|
515
|
+
ref: dropRef,
|
|
516
|
+
style: {
|
|
517
|
+
opacity
|
|
518
|
+
}
|
|
519
|
+
}, /*#__PURE__*/React$1.createElement("td", {
|
|
520
|
+
ref: dragRef,
|
|
521
|
+
role: "cell",
|
|
522
|
+
style: {
|
|
523
|
+
cursor: isDragging ? "grabbing" : "grab"
|
|
524
|
+
},
|
|
525
|
+
className: "align-middle"
|
|
526
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
527
|
+
className: "flex items-center justify-center"
|
|
528
|
+
}, /*#__PURE__*/React$1.createElement("i", {
|
|
529
|
+
className: classnames(iconClass(undefined, "dots-vertical-rounded"))
|
|
530
|
+
}))), /*#__PURE__*/React$1.createElement(DefaultCells, props));
|
|
531
|
+
}
|
|
532
|
+
function DefaultRow(_ref) {
|
|
533
|
+
let {
|
|
534
|
+
onClick,
|
|
535
|
+
row,
|
|
536
|
+
enableDragNDrop,
|
|
537
|
+
onDrop,
|
|
538
|
+
onDrag
|
|
539
|
+
} = _ref,
|
|
540
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
541
|
+
const opts = _extends({}, props, {
|
|
542
|
+
onClick: () => onClick(row.original, "row")
|
|
543
|
+
}, row.getRowProps());
|
|
544
|
+
if (enableDragNDrop) {
|
|
545
|
+
return /*#__PURE__*/React$1.createElement(DefaultDndRow, _extends({}, opts, {
|
|
546
|
+
row: row,
|
|
547
|
+
onDrag: onDrag,
|
|
548
|
+
onDrop: onDrop
|
|
549
|
+
}));
|
|
550
|
+
}
|
|
551
|
+
return /*#__PURE__*/React$1.createElement("tr", opts, /*#__PURE__*/React$1.createElement(DefaultCells, {
|
|
552
|
+
row: row
|
|
553
|
+
}));
|
|
554
|
+
}
|
|
555
|
+
|
|
397
556
|
function callLast(fn, time) {
|
|
398
557
|
let last = null;
|
|
399
558
|
return (...args) => {
|
|
@@ -405,7 +564,7 @@ function callLast(fn, time) {
|
|
|
405
564
|
};
|
|
406
565
|
}
|
|
407
566
|
|
|
408
|
-
const _excluded$
|
|
567
|
+
const _excluded$4 = ["name", "value", "label", "onChange", "required", "size", "type", "prefix", "suffix", "description", "className", "placeholder"];
|
|
409
568
|
function InputText(_ref) {
|
|
410
569
|
let {
|
|
411
570
|
name,
|
|
@@ -421,13 +580,13 @@ function InputText(_ref) {
|
|
|
421
580
|
className,
|
|
422
581
|
placeholder
|
|
423
582
|
} = _ref,
|
|
424
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
583
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
425
584
|
const [localValue, setValue] = useState(value);
|
|
426
585
|
const change = useMemo(() => onChange && callLast(onChange, 300), [onChange]);
|
|
427
586
|
useEffect(() => {
|
|
428
587
|
setValue(value);
|
|
429
588
|
}, [value]);
|
|
430
|
-
return /*#__PURE__*/React.createElement(FormControl, {
|
|
589
|
+
return /*#__PURE__*/React$1.createElement(FormControl, {
|
|
431
590
|
name: name,
|
|
432
591
|
label: label,
|
|
433
592
|
required: required,
|
|
@@ -435,7 +594,7 @@ function InputText(_ref) {
|
|
|
435
594
|
prefix: prefix,
|
|
436
595
|
suffix: suffix,
|
|
437
596
|
className: className
|
|
438
|
-
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
597
|
+
}, /*#__PURE__*/React$1.createElement("input", _extends({
|
|
439
598
|
type: type || "text"
|
|
440
599
|
}, props, {
|
|
441
600
|
"data-testid": `input_${name}`,
|
|
@@ -479,7 +638,7 @@ function DefaultColumnFilter(props) {
|
|
|
479
638
|
setFilterId(id);
|
|
480
639
|
setFilter(value || undefined);
|
|
481
640
|
}, [id, setValue, setFilterId, setFilter]);
|
|
482
|
-
return /*#__PURE__*/React.createElement(InputText, {
|
|
641
|
+
return /*#__PURE__*/React$1.createElement(InputText, {
|
|
483
642
|
size: "sm",
|
|
484
643
|
id: id,
|
|
485
644
|
name: id,
|
|
@@ -491,6 +650,12 @@ function DefaultColumnFilter(props) {
|
|
|
491
650
|
});
|
|
492
651
|
}
|
|
493
652
|
|
|
653
|
+
const swapElements = (myArray, index1, index2) => {
|
|
654
|
+
myArray = [...myArray];
|
|
655
|
+
[myArray[index1], myArray[index2]] = [myArray[index2], myArray[index1]];
|
|
656
|
+
return myArray;
|
|
657
|
+
};
|
|
658
|
+
|
|
494
659
|
const stopPropagationWrapper = fn => event => {
|
|
495
660
|
event.stopPropagation();
|
|
496
661
|
fn();
|
|
@@ -508,17 +673,17 @@ function DefaultOperationButton(props) {
|
|
|
508
673
|
title = "",
|
|
509
674
|
i18n = f => f
|
|
510
675
|
} = props;
|
|
511
|
-
return /*#__PURE__*/React.createElement("button", {
|
|
676
|
+
return /*#__PURE__*/React$1.createElement("button", {
|
|
512
677
|
className: classnames(className, ["btn", buttonOutline && "outline", buttonType].filter(Boolean).join("-"), `btn-${buttonSize}`),
|
|
513
678
|
onClick: stopPropagationWrapper(() => onClick(action))
|
|
514
|
-
}, icon ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("i", {
|
|
679
|
+
}, icon ? /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("i", {
|
|
515
680
|
className: iconClass(undefined, icon)
|
|
516
|
-
}), " ", title && " ") : null, title && /*#__PURE__*/React.createElement("span", {
|
|
681
|
+
}), " ", title && " ") : null, title && /*#__PURE__*/React$1.createElement("span", {
|
|
517
682
|
className: icon && title ? "ml-1" : ""
|
|
518
683
|
}, i18n(title)));
|
|
519
684
|
}
|
|
520
685
|
|
|
521
|
-
const _excluded$
|
|
686
|
+
const _excluded$5 = ["OperationButton"];
|
|
522
687
|
function DefaultCellOperations({
|
|
523
688
|
operations,
|
|
524
689
|
row,
|
|
@@ -527,7 +692,7 @@ function DefaultCellOperations({
|
|
|
527
692
|
i18n
|
|
528
693
|
}) {
|
|
529
694
|
const data = row.original;
|
|
530
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
695
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
531
696
|
className: "btn-group"
|
|
532
697
|
}, operations.filter(({
|
|
533
698
|
permissionsResolver
|
|
@@ -535,8 +700,8 @@ function DefaultCellOperations({
|
|
|
535
700
|
let {
|
|
536
701
|
OperationButton = DefaultOperationButton
|
|
537
702
|
} = _ref,
|
|
538
|
-
operation = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
539
|
-
return /*#__PURE__*/React.createElement(OperationButton, _extends({
|
|
703
|
+
operation = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
704
|
+
return /*#__PURE__*/React$1.createElement(OperationButton, _extends({
|
|
540
705
|
key: operation.action
|
|
541
706
|
}, operation, {
|
|
542
707
|
onClick: action => onClick(data, action),
|
|
@@ -562,10 +727,10 @@ function useOperations({
|
|
|
562
727
|
return [...columns, {
|
|
563
728
|
id: "operations",
|
|
564
729
|
groupByBoundary: true,
|
|
565
|
-
Header: () => /*#__PURE__*/React.createElement("div", {
|
|
730
|
+
Header: () => /*#__PURE__*/React$1.createElement("div", {
|
|
566
731
|
className: "text-center"
|
|
567
732
|
}, i18n("Operations")),
|
|
568
|
-
Cell: props => /*#__PURE__*/React.createElement(CellOperations, _extends({}, props, {
|
|
733
|
+
Cell: props => /*#__PURE__*/React$1.createElement(CellOperations, _extends({}, props, {
|
|
569
734
|
operations: operations,
|
|
570
735
|
onClick: onClick,
|
|
571
736
|
ctx: ctx,
|
|
@@ -576,7 +741,7 @@ function useOperations({
|
|
|
576
741
|
};
|
|
577
742
|
}
|
|
578
743
|
|
|
579
|
-
const _excluded$
|
|
744
|
+
const _excluded$6 = ["children", "className", "columns", "data", "onChange", "onClick", "onDrag", "onDrop", "operations", "pageSizes", "filters", "filterId", "pageSize", "pageIndex", "sortBy", "isLoading", "disableFilters", "disablePagination", "ArrowSort", "ColumnFilter", "EmptyData", "Loader", "Pagination", "Row", "CellHeader", "CellOperations", "i18n"];
|
|
580
745
|
function getOperationCallback(operations, onClick) {
|
|
581
746
|
return (data, action) => {
|
|
582
747
|
const operation = operations.find(operation => operation.action === action || operation.alias === action);
|
|
@@ -586,17 +751,17 @@ function getOperationCallback(operations, onClick) {
|
|
|
586
751
|
};
|
|
587
752
|
}
|
|
588
753
|
function DefaultLoader() {
|
|
589
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
754
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
590
755
|
className: "text-center p-2 pb-4 font-bold"
|
|
591
756
|
}, "Loading in progress");
|
|
592
757
|
}
|
|
593
758
|
function DefaultEmptyData() {
|
|
594
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
759
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
595
760
|
className: "text-center p-2 pb-4 font-bold"
|
|
596
761
|
}, "No data found");
|
|
597
762
|
}
|
|
598
763
|
const hooks = [useFilters, useGroupBy, useSortBy, usePagination];
|
|
599
|
-
function
|
|
764
|
+
function useCustomTable(props) {
|
|
600
765
|
const {
|
|
601
766
|
children,
|
|
602
767
|
className = "",
|
|
@@ -604,6 +769,8 @@ function Table(props) {
|
|
|
604
769
|
data,
|
|
605
770
|
onChange = noop,
|
|
606
771
|
onClick = noop,
|
|
772
|
+
onDrag = noop,
|
|
773
|
+
onDrop = noop,
|
|
607
774
|
operations = [],
|
|
608
775
|
pageSizes = [10, 25, 50, 100],
|
|
609
776
|
filters: controlledFilters,
|
|
@@ -619,23 +786,32 @@ function Table(props) {
|
|
|
619
786
|
EmptyData = DefaultEmptyData,
|
|
620
787
|
Loader = DefaultLoader,
|
|
621
788
|
Pagination: Pagination$1 = Pagination,
|
|
789
|
+
Row = DefaultRow,
|
|
622
790
|
CellHeader = DefaultCellHeader,
|
|
623
791
|
CellOperations,
|
|
624
792
|
i18n = f => f
|
|
625
793
|
} = props,
|
|
626
|
-
ctx = _objectWithoutPropertiesLoose(props, _excluded$
|
|
794
|
+
ctx = _objectWithoutPropertiesLoose(props, _excluded$6);
|
|
627
795
|
const _onClick = getOperationCallback(operations, onClick);
|
|
628
|
-
const defaultColumn = React.useMemo(() => ({
|
|
796
|
+
const defaultColumn = React$1.useMemo(() => ({
|
|
629
797
|
// Let's set up our default Filter UI
|
|
630
798
|
Filter: ColumnFilter,
|
|
631
799
|
ArrowSort
|
|
632
800
|
}), [ColumnFilter, ArrowSort]);
|
|
633
|
-
const [filterId, setFilterId] = React.useState(controlledFilterId);
|
|
801
|
+
const [filterId, setFilterId] = React$1.useState(controlledFilterId);
|
|
802
|
+
// DND
|
|
803
|
+
const [records, setRecords] = useState(data);
|
|
804
|
+
const _onDrag = (dragIndex, hoverIndex) => {
|
|
805
|
+
const newRecords = swapElements([...records], dragIndex, hoverIndex);
|
|
806
|
+
setRecords(newRecords);
|
|
807
|
+
onDrag(newRecords);
|
|
808
|
+
};
|
|
634
809
|
const tableInstance = useTable(_extends({}, props, {
|
|
635
810
|
columns,
|
|
636
811
|
data,
|
|
637
812
|
ctx,
|
|
638
813
|
defaultColumn,
|
|
814
|
+
// getRowId,
|
|
639
815
|
initialState: _extends({}, props.initialState || {}, {
|
|
640
816
|
filters: controlledFilters || [],
|
|
641
817
|
pageIndex: controlledPageIndex || 0,
|
|
@@ -664,7 +840,7 @@ function Table(props) {
|
|
|
664
840
|
filters
|
|
665
841
|
}
|
|
666
842
|
} = tableInstance;
|
|
667
|
-
React.useEffect(() => {
|
|
843
|
+
React$1.useEffect(() => {
|
|
668
844
|
onChange({
|
|
669
845
|
pageIndex,
|
|
670
846
|
pageSize,
|
|
@@ -673,50 +849,94 @@ function Table(props) {
|
|
|
673
849
|
filterId
|
|
674
850
|
});
|
|
675
851
|
}, [onChange, pageIndex, pageSize, sortBy, filters, filterId]);
|
|
852
|
+
return _extends({}, props, {
|
|
853
|
+
className,
|
|
854
|
+
tableInstance,
|
|
855
|
+
CellHeader,
|
|
856
|
+
isLoading,
|
|
857
|
+
onClick: _onClick,
|
|
858
|
+
Loader,
|
|
859
|
+
EmptyData,
|
|
860
|
+
Row,
|
|
861
|
+
data,
|
|
862
|
+
disablePagination,
|
|
863
|
+
Pagination: Pagination$1,
|
|
864
|
+
pageIndex,
|
|
865
|
+
pageSize,
|
|
866
|
+
pageSizes,
|
|
867
|
+
setPageSize,
|
|
868
|
+
i18n,
|
|
869
|
+
children,
|
|
870
|
+
onDrag: _onDrag,
|
|
871
|
+
onDrop: onDrop
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
function Table(props) {
|
|
876
|
+
const {
|
|
877
|
+
className,
|
|
878
|
+
tableInstance,
|
|
879
|
+
CellHeader,
|
|
880
|
+
isLoading,
|
|
881
|
+
onClick,
|
|
882
|
+
Loader,
|
|
883
|
+
EmptyData,
|
|
884
|
+
Row,
|
|
885
|
+
data,
|
|
886
|
+
disablePagination,
|
|
887
|
+
Pagination,
|
|
888
|
+
pageIndex,
|
|
889
|
+
pageSize,
|
|
890
|
+
pageSizes,
|
|
891
|
+
setPageSize,
|
|
892
|
+
i18n,
|
|
893
|
+
enableDragNDrop,
|
|
894
|
+
children,
|
|
895
|
+
onDrag,
|
|
896
|
+
onDrop
|
|
897
|
+
} = useCustomTable(props);
|
|
676
898
|
// Render the UI for your table
|
|
677
|
-
return /*#__PURE__*/React.createElement(
|
|
899
|
+
return /*#__PURE__*/React$1.createElement(DrapNDropContainer, {
|
|
900
|
+
enableDragNDrop: enableDragNDrop
|
|
901
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
678
902
|
className: classnames("table-group table-responsive", className)
|
|
679
|
-
}, /*#__PURE__*/React.createElement("table", _extends({
|
|
903
|
+
}, /*#__PURE__*/React$1.createElement("table", _extends({
|
|
680
904
|
className: "table table-striped table-hover"
|
|
681
|
-
}, tableInstance.getTableProps()), /*#__PURE__*/React.createElement("thead", null, tableInstance.headerGroups.map((headerGroup, i) => /*#__PURE__*/React.createElement("tr", _extends({}, headerGroup.getHeaderGroupProps(), {
|
|
905
|
+
}, tableInstance.getTableProps()), /*#__PURE__*/React$1.createElement("thead", null, tableInstance.headerGroups.map((headerGroup, i) => /*#__PURE__*/React$1.createElement("tr", _extends({}, headerGroup.getHeaderGroupProps(), {
|
|
682
906
|
key: `tableInstance.headerGroups${i}`
|
|
683
|
-
}),
|
|
907
|
+
}), enableDragNDrop ? /*#__PURE__*/React$1.createElement("th", {
|
|
908
|
+
role: "columnheader",
|
|
909
|
+
className: "text-center"
|
|
910
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
911
|
+
className: "table-cell-header"
|
|
912
|
+
})) : null, headerGroup.headers.map(column => /*#__PURE__*/React$1.createElement("th", _extends({}, column.getHeaderProps(), {
|
|
684
913
|
key: `tableInstance.headers.column.${column.id}`
|
|
685
|
-
}), /*#__PURE__*/React.createElement(CellHeader, {
|
|
914
|
+
}), /*#__PURE__*/React$1.createElement(CellHeader, {
|
|
686
915
|
column: column
|
|
687
|
-
})))))), !isLoading ? /*#__PURE__*/React.createElement("tbody", tableInstance.getTableBodyProps(), tableInstance.page.map(row => {
|
|
916
|
+
})))))), !isLoading ? /*#__PURE__*/React$1.createElement("tbody", tableInstance.getTableBodyProps(), tableInstance.page.map((row, index) => {
|
|
688
917
|
tableInstance.prepareRow(row);
|
|
689
|
-
return /*#__PURE__*/React.createElement(
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
return null;
|
|
700
|
-
}
|
|
701
|
-
return /*#__PURE__*/React.createElement("td", _extends({
|
|
702
|
-
colSpan: colspan
|
|
703
|
-
}, cell.getCellProps(), {
|
|
704
|
-
key: `tableInstance.page.cells.${cell.value || "value"}.${i}`
|
|
705
|
-
}), cell.render("Cell"));
|
|
706
|
-
}));
|
|
707
|
-
})) : null), isLoading ? /*#__PURE__*/React.createElement(Loader, null) : null, !data.length ? /*#__PURE__*/React.createElement(EmptyData, null) : null, !isLoading && data.length && !disablePagination ? /*#__PURE__*/React.createElement("div", {
|
|
918
|
+
return /*#__PURE__*/React$1.createElement(Row, {
|
|
919
|
+
index: index,
|
|
920
|
+
enableDragNDrop: enableDragNDrop,
|
|
921
|
+
onClick: onClick,
|
|
922
|
+
row: row,
|
|
923
|
+
key: `tableInstance.page.${row.id}`,
|
|
924
|
+
onDrag: onDrag,
|
|
925
|
+
onDrop: onDrop
|
|
926
|
+
});
|
|
927
|
+
})) : null), isLoading ? /*#__PURE__*/React$1.createElement(Loader, null) : null, !data.length ? /*#__PURE__*/React$1.createElement(EmptyData, null) : null, !isLoading && data.length && !disablePagination ? /*#__PURE__*/React$1.createElement("div", {
|
|
708
928
|
className: "overflow-hidden"
|
|
709
|
-
}, /*#__PURE__*/React.createElement(Pagination
|
|
929
|
+
}, /*#__PURE__*/React$1.createElement(Pagination, _extends({}, tableInstance, {
|
|
710
930
|
className: "text-sm",
|
|
711
931
|
pageIndex: pageIndex,
|
|
712
932
|
pageSize: pageSize,
|
|
713
933
|
pageSizes: pageSizes,
|
|
714
934
|
setPageSize: setPageSize,
|
|
715
935
|
i18n: i18n
|
|
716
|
-
}))) : null, children);
|
|
936
|
+
}))) : null, children));
|
|
717
937
|
}
|
|
718
938
|
|
|
719
|
-
const _excluded$
|
|
939
|
+
const _excluded$7 = ["disableFilters", "disablePagination", "availableActions", "onAddAction"];
|
|
720
940
|
function ActionsTable(_ref) {
|
|
721
941
|
let {
|
|
722
942
|
disableFilters = true,
|
|
@@ -724,7 +944,7 @@ function ActionsTable(_ref) {
|
|
|
724
944
|
availableActions = [],
|
|
725
945
|
onAddAction = noop
|
|
726
946
|
} = _ref,
|
|
727
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
947
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
728
948
|
const {
|
|
729
949
|
i18n = f => f
|
|
730
950
|
} = props;
|
|
@@ -734,13 +954,13 @@ function ActionsTable(_ref) {
|
|
|
734
954
|
accessor: "title",
|
|
735
955
|
id: "title"
|
|
736
956
|
}];
|
|
737
|
-
return /*#__PURE__*/React.createElement(Table, _extends({}, props, {
|
|
957
|
+
return /*#__PURE__*/React$1.createElement(Table, _extends({}, props, {
|
|
738
958
|
disableFilters: disableFilters,
|
|
739
959
|
disablePagination: disablePagination,
|
|
740
960
|
columns: columns
|
|
741
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
961
|
+
}), /*#__PURE__*/React$1.createElement("div", {
|
|
742
962
|
className: "pagination-group"
|
|
743
|
-
}, /*#__PURE__*/React.createElement(Select, {
|
|
963
|
+
}, /*#__PURE__*/React$1.createElement(Select, {
|
|
744
964
|
name: "actions",
|
|
745
965
|
value: currentAction,
|
|
746
966
|
choices: [{
|
|
@@ -748,15 +968,15 @@ function ActionsTable(_ref) {
|
|
|
748
968
|
value: ""
|
|
749
969
|
}].concat(availableActions),
|
|
750
970
|
onChange: (name, action) => setAction(action)
|
|
751
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
971
|
+
}), /*#__PURE__*/React$1.createElement("div", {
|
|
752
972
|
className: "pl-3"
|
|
753
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
973
|
+
}, /*#__PURE__*/React$1.createElement("button", {
|
|
754
974
|
"data-testid": "submit",
|
|
755
975
|
disabled: currentAction === "",
|
|
756
976
|
className: "btn btn-success",
|
|
757
977
|
onClick: () => currentAction && onAddAction(currentAction),
|
|
758
978
|
type: "submit"
|
|
759
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
979
|
+
}, /*#__PURE__*/React$1.createElement("i", {
|
|
760
980
|
className: classnames(iconClass(undefined, "plus"), "mr-1")
|
|
761
981
|
}), " ", i18n("Add action")))));
|
|
762
982
|
}
|
|
@@ -771,9 +991,9 @@ function formatError(error) {
|
|
|
771
991
|
if (Object.prototype.hasOwnProperty.call(error, "errors")) {
|
|
772
992
|
return Object.keys(error.errors).map((key, index) => {
|
|
773
993
|
const item = error.errors[key];
|
|
774
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
994
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
775
995
|
key: index
|
|
776
|
-
}, /*#__PURE__*/React.createElement("strong", null, item.name, " (", item.path, ")"), " ", "- ", item.message);
|
|
996
|
+
}, /*#__PURE__*/React$1.createElement("strong", null, item.name, " (", item.path, ")"), " ", "- ", item.message);
|
|
777
997
|
});
|
|
778
998
|
}
|
|
779
999
|
// If this is a standard error.
|
|
@@ -783,7 +1003,7 @@ function formatError(error) {
|
|
|
783
1003
|
// If this is a joy validation error.
|
|
784
1004
|
if (Object.prototype.hasOwnProperty.call(error, "name") && error.name === "ValidationError") {
|
|
785
1005
|
return error.details.map((item, index) => {
|
|
786
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1006
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
787
1007
|
key: index
|
|
788
1008
|
}, item.message);
|
|
789
1009
|
});
|
|
@@ -801,7 +1021,7 @@ function Alert({
|
|
|
801
1021
|
if (!error || Array.isArray(error) && !error.length) {
|
|
802
1022
|
return null;
|
|
803
1023
|
}
|
|
804
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1024
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
805
1025
|
className: `alert alert-${type}`,
|
|
806
1026
|
role: "alert"
|
|
807
1027
|
}, formatError(error));
|
|
@@ -812,19 +1032,19 @@ function Card({
|
|
|
812
1032
|
label,
|
|
813
1033
|
className
|
|
814
1034
|
}) {
|
|
815
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1035
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
816
1036
|
className: classnames("card", className)
|
|
817
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
1037
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
818
1038
|
className: "card-header "
|
|
819
|
-
}, /*#__PURE__*/React.createElement("h4", {
|
|
1039
|
+
}, /*#__PURE__*/React$1.createElement("h4", {
|
|
820
1040
|
className: "card-title"
|
|
821
|
-
}, label)), /*#__PURE__*/React.createElement("div", {
|
|
1041
|
+
}, label)), /*#__PURE__*/React$1.createElement("div", {
|
|
822
1042
|
className: "card-body",
|
|
823
1043
|
role: "article"
|
|
824
1044
|
}, children));
|
|
825
1045
|
}
|
|
826
1046
|
|
|
827
|
-
const _excluded$
|
|
1047
|
+
const _excluded$8 = ["src", "form", "options", "submission", "url"];
|
|
828
1048
|
function useEvent(event, callback, events) {
|
|
829
1049
|
useEffect(() => {
|
|
830
1050
|
if (callback) {
|
|
@@ -875,7 +1095,7 @@ function useForm(props) {
|
|
|
875
1095
|
submission,
|
|
876
1096
|
url
|
|
877
1097
|
} = props,
|
|
878
|
-
funcs = _objectWithoutPropertiesLoose(props, _excluded$
|
|
1098
|
+
funcs = _objectWithoutPropertiesLoose(props, _excluded$8);
|
|
879
1099
|
const element = useRef();
|
|
880
1100
|
const isLoaded = useRef();
|
|
881
1101
|
const instance = useRef();
|
|
@@ -974,7 +1194,7 @@ function Form(props) {
|
|
|
974
1194
|
const {
|
|
975
1195
|
element
|
|
976
1196
|
} = useForm(props);
|
|
977
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1197
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
978
1198
|
"data-testid": `formioContainer${props.name || ""}`,
|
|
979
1199
|
ref: element,
|
|
980
1200
|
className: props.className
|
|
@@ -1274,7 +1494,7 @@ function NamedFormAccess({
|
|
|
1274
1494
|
children
|
|
1275
1495
|
}) {
|
|
1276
1496
|
const [isValid, setIsValid] = useState(true);
|
|
1277
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form, {
|
|
1497
|
+
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(Form, {
|
|
1278
1498
|
name: name,
|
|
1279
1499
|
form: form[name],
|
|
1280
1500
|
submission: submissions[name],
|
|
@@ -1288,11 +1508,11 @@ function NamedFormAccess({
|
|
|
1288
1508
|
setIsValid(isValid);
|
|
1289
1509
|
},
|
|
1290
1510
|
options: options
|
|
1291
|
-
}), /*#__PURE__*/React.createElement("button", {
|
|
1511
|
+
}), /*#__PURE__*/React$1.createElement("button", {
|
|
1292
1512
|
disabled: !isValid,
|
|
1293
1513
|
className: "mt-5 btn btn-primary",
|
|
1294
1514
|
onClick: onSubmit
|
|
1295
|
-
}, "Save access"), children, /*#__PURE__*/React.createElement("div", {
|
|
1515
|
+
}, "Save access"), children, /*#__PURE__*/React$1.createElement("div", {
|
|
1296
1516
|
className: "alert alert-warning mt-5"
|
|
1297
1517
|
}, "Elevated permissions allow users to access and modify other user's entities. Assign with caution."));
|
|
1298
1518
|
}
|
|
@@ -1305,43 +1525,43 @@ function FormAccess(props) {
|
|
|
1305
1525
|
onChange,
|
|
1306
1526
|
onSubmit
|
|
1307
1527
|
} = useFormAccess(props);
|
|
1308
|
-
return /*#__PURE__*/React.createElement("div", null, props.children, /*#__PURE__*/React.createElement("div", {
|
|
1528
|
+
return /*#__PURE__*/React$1.createElement("div", null, props.children, /*#__PURE__*/React$1.createElement("div", {
|
|
1309
1529
|
className: "flex mb-5"
|
|
1310
|
-
}, /*#__PURE__*/React.createElement(Card, {
|
|
1530
|
+
}, /*#__PURE__*/React$1.createElement(Card, {
|
|
1311
1531
|
label: "Manage submission access",
|
|
1312
1532
|
className: "flex-1"
|
|
1313
|
-
}, /*#__PURE__*/React.createElement(NamedFormAccess, {
|
|
1533
|
+
}, /*#__PURE__*/React$1.createElement(NamedFormAccess, {
|
|
1314
1534
|
name: "submissionAccess",
|
|
1315
1535
|
form: form,
|
|
1316
1536
|
submissions: submissions,
|
|
1317
1537
|
onChange: onChange,
|
|
1318
1538
|
onSubmit: onSubmit,
|
|
1319
1539
|
options: options
|
|
1320
|
-
}, props.children)), /*#__PURE__*/React.createElement("div", {
|
|
1540
|
+
}, props.children)), /*#__PURE__*/React$1.createElement("div", {
|
|
1321
1541
|
className: "w-1/4 pl-4"
|
|
1322
|
-
}, /*#__PURE__*/React.createElement(Card, {
|
|
1542
|
+
}, /*#__PURE__*/React$1.createElement(Card, {
|
|
1323
1543
|
label: "About Submission Data Permissions"
|
|
1324
|
-
}, /*#__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", {
|
|
1544
|
+
}, /*#__PURE__*/React$1.createElement("p", null, "Submission Data Permissions allow you to control who can create, view, and modify form submission data."), /*#__PURE__*/React$1.createElement("ul", {
|
|
1325
1545
|
className: "mt-5 pl-7 list-disc"
|
|
1326
|
-
}, /*#__PURE__*/React.createElement("li", {
|
|
1546
|
+
}, /*#__PURE__*/React$1.createElement("li", {
|
|
1327
1547
|
className: "pb-2"
|
|
1328
|
-
}, /*#__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", {
|
|
1548
|
+
}, /*#__PURE__*/React$1.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$1.createElement("li", null, /*#__PURE__*/React$1.createElement("strong", null, "All Permissions"), " - These permissions apply to all submission data regardless of who owns it."))))), /*#__PURE__*/React$1.createElement("div", {
|
|
1329
1549
|
className: "flex mb-5"
|
|
1330
|
-
}, /*#__PURE__*/React.createElement(Card, {
|
|
1550
|
+
}, /*#__PURE__*/React$1.createElement(Card, {
|
|
1331
1551
|
label: `Manage ${type} definition access`,
|
|
1332
1552
|
className: "flex-1"
|
|
1333
|
-
}, /*#__PURE__*/React.createElement(NamedFormAccess, {
|
|
1553
|
+
}, /*#__PURE__*/React$1.createElement(NamedFormAccess, {
|
|
1334
1554
|
name: "access",
|
|
1335
1555
|
form: form,
|
|
1336
1556
|
submissions: submissions,
|
|
1337
1557
|
onChange: onChange,
|
|
1338
1558
|
onSubmit: onSubmit,
|
|
1339
1559
|
options: options
|
|
1340
|
-
}, props.children)), /*#__PURE__*/React.createElement("div", {
|
|
1560
|
+
}, props.children)), /*#__PURE__*/React$1.createElement("div", {
|
|
1341
1561
|
className: "w-1/4 pl-4"
|
|
1342
|
-
}, /*#__PURE__*/React.createElement(Card, {
|
|
1562
|
+
}, /*#__PURE__*/React$1.createElement(Card, {
|
|
1343
1563
|
label: "About Form Definition Access"
|
|
1344
|
-
}, /*#__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.")))));
|
|
1564
|
+
}, /*#__PURE__*/React$1.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$1.createElement("p", null, "Typically you will want to allow all of your roles to be able to Read the form definition."), /*#__PURE__*/React$1.createElement("p", null, "Each form also has an owner at ", /*#__PURE__*/React$1.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.")))));
|
|
1345
1565
|
}
|
|
1346
1566
|
FormAccess.propTypes = {
|
|
1347
1567
|
type: PropTypes.string.isRequired,
|
|
@@ -1352,13 +1572,13 @@ FormAccess.propTypes = {
|
|
|
1352
1572
|
onSubmit: PropTypes.func
|
|
1353
1573
|
};
|
|
1354
1574
|
|
|
1355
|
-
const _excluded$
|
|
1575
|
+
const _excluded$9 = ["action"],
|
|
1356
1576
|
_excluded2 = ["actionInfo", "children", "onSubmit", "options"];
|
|
1357
1577
|
function mapData(options, defaults) {
|
|
1358
1578
|
return _extends({}, defaults, options);
|
|
1359
1579
|
}
|
|
1360
1580
|
function mapSettingsForm(_ref) {
|
|
1361
|
-
let settingsForm = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1581
|
+
let settingsForm = _objectWithoutPropertiesLoose(_ref, _excluded$9);
|
|
1362
1582
|
FormioUtils.eachComponent(settingsForm.components, component => {
|
|
1363
1583
|
const resourceExclude = "";
|
|
1364
1584
|
if (component.type === "resourcefields") {
|
|
@@ -1396,7 +1616,7 @@ function FormAction(_ref2) {
|
|
|
1396
1616
|
}
|
|
1397
1617
|
};
|
|
1398
1618
|
})();
|
|
1399
|
-
return /*#__PURE__*/React.createElement("div", null, children, /*#__PURE__*/React.createElement(Form, {
|
|
1619
|
+
return /*#__PURE__*/React$1.createElement("div", null, children, /*#__PURE__*/React$1.createElement(Form, {
|
|
1400
1620
|
form: form,
|
|
1401
1621
|
submission: submission,
|
|
1402
1622
|
onSubmit: onSubmit,
|
|
@@ -1434,7 +1654,7 @@ async function createBuilder(el, {
|
|
|
1434
1654
|
console.error(er);
|
|
1435
1655
|
}
|
|
1436
1656
|
}
|
|
1437
|
-
class FormBuilder extends React.Component {
|
|
1657
|
+
class FormBuilder extends React$1.Component {
|
|
1438
1658
|
constructor(props) {
|
|
1439
1659
|
super(props);
|
|
1440
1660
|
this.elRef = void 0;
|
|
@@ -1512,12 +1732,12 @@ class FormBuilder extends React.Component {
|
|
|
1512
1732
|
});
|
|
1513
1733
|
}
|
|
1514
1734
|
render() {
|
|
1515
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1735
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
1516
1736
|
ref: ref => {
|
|
1517
1737
|
this.elRef = ref;
|
|
1518
1738
|
},
|
|
1519
1739
|
onClick: e => e.stopPropagation()
|
|
1520
|
-
}, /*#__PURE__*/React.createElement("div", null));
|
|
1740
|
+
}, /*#__PURE__*/React$1.createElement("div", null));
|
|
1521
1741
|
}
|
|
1522
1742
|
}
|
|
1523
1743
|
FormBuilder.defaultProps = {
|
|
@@ -1586,37 +1806,37 @@ function FormEditCTAs({
|
|
|
1586
1806
|
placement: "top",
|
|
1587
1807
|
title: t("Reset all changes")
|
|
1588
1808
|
});
|
|
1589
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1809
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
1590
1810
|
className: "form-edit__actions"
|
|
1591
|
-
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
|
|
1811
|
+
}, /*#__PURE__*/React$1.createElement("div", null, /*#__PURE__*/React$1.createElement("button", {
|
|
1592
1812
|
className: `btn btn-primary btn-save flex ${disabled ? "disabled" : ""}`,
|
|
1593
1813
|
disabled: disabled,
|
|
1594
1814
|
onClick: () => !disabled && onSubmit && onSubmit()
|
|
1595
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
1815
|
+
}, /*#__PURE__*/React$1.createElement("i", {
|
|
1596
1816
|
className: `mr-1 ${iconClass(options.iconset, "save")}`
|
|
1597
|
-
}), saveText), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
|
|
1817
|
+
}), saveText), /*#__PURE__*/React$1.createElement("div", null, /*#__PURE__*/React$1.createElement("button", {
|
|
1598
1818
|
className: `btn btn-light btn-undo ${hasUndo ? "" : "disabled"}`,
|
|
1599
1819
|
onClick: () => onUndo && onUndo(),
|
|
1600
1820
|
ref: undoTooltipRef
|
|
1601
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
1821
|
+
}, /*#__PURE__*/React$1.createElement("i", {
|
|
1602
1822
|
className: iconClass(options.iconset, "undo")
|
|
1603
|
-
})), /*#__PURE__*/React.createElement("button", {
|
|
1823
|
+
})), /*#__PURE__*/React$1.createElement("button", {
|
|
1604
1824
|
className: `btn btn-light btn-redo ${hasRedo ? "" : "disabled"}`,
|
|
1605
1825
|
onClick: () => onRedo && onRedo(),
|
|
1606
1826
|
ref: redoTooltipRef
|
|
1607
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
1827
|
+
}, /*#__PURE__*/React$1.createElement("i", {
|
|
1608
1828
|
className: iconClass(options.iconset, "redo")
|
|
1609
|
-
}))), /*#__PURE__*/React.createElement("div", null, onCopy && /*#__PURE__*/React.createElement("button", {
|
|
1829
|
+
}))), /*#__PURE__*/React$1.createElement("div", null, onCopy && /*#__PURE__*/React$1.createElement("button", {
|
|
1610
1830
|
className: "btn btn-light",
|
|
1611
1831
|
onClick: () => onCopy(),
|
|
1612
1832
|
ref: copyTooltipRef
|
|
1613
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
1833
|
+
}, /*#__PURE__*/React$1.createElement("i", {
|
|
1614
1834
|
className: iconClass(options.iconset, "copy")
|
|
1615
|
-
})), /*#__PURE__*/React.createElement("button", {
|
|
1835
|
+
})), /*#__PURE__*/React$1.createElement("button", {
|
|
1616
1836
|
className: `btn btn-light btn-reset`,
|
|
1617
1837
|
onClick: () => onReset && onReset(),
|
|
1618
1838
|
ref: resetTooltipRef
|
|
1619
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
1839
|
+
}, /*#__PURE__*/React$1.createElement("i", {
|
|
1620
1840
|
className: iconClass(options.iconset, "reset")
|
|
1621
1841
|
})))));
|
|
1622
1842
|
}
|
|
@@ -1631,7 +1851,7 @@ FormEditCTAs.propTypes = {
|
|
|
1631
1851
|
onReset: PropTypes.func
|
|
1632
1852
|
};
|
|
1633
1853
|
|
|
1634
|
-
const _excluded$
|
|
1854
|
+
const _excluded$a = ["name", "value", "label", "onChange", "required", "description", "prefix", "suffix"];
|
|
1635
1855
|
function InputTags(_ref) {
|
|
1636
1856
|
let {
|
|
1637
1857
|
name,
|
|
@@ -1643,7 +1863,7 @@ function InputTags(_ref) {
|
|
|
1643
1863
|
prefix,
|
|
1644
1864
|
suffix
|
|
1645
1865
|
} = _ref,
|
|
1646
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1866
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
|
1647
1867
|
const ref = useRef();
|
|
1648
1868
|
useEffect(() => {
|
|
1649
1869
|
const instance = new Choices(ref.current, {
|
|
@@ -1662,14 +1882,14 @@ function InputTags(_ref) {
|
|
|
1662
1882
|
instance.destroy();
|
|
1663
1883
|
};
|
|
1664
1884
|
}, []);
|
|
1665
|
-
return /*#__PURE__*/React.createElement(FormControl, {
|
|
1885
|
+
return /*#__PURE__*/React$1.createElement(FormControl, {
|
|
1666
1886
|
name: name,
|
|
1667
1887
|
label: label,
|
|
1668
1888
|
required: required,
|
|
1669
1889
|
description: description,
|
|
1670
1890
|
prefix: prefix,
|
|
1671
1891
|
suffix: suffix
|
|
1672
|
-
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
1892
|
+
}, /*#__PURE__*/React$1.createElement("input", _extends({
|
|
1673
1893
|
ref: ref,
|
|
1674
1894
|
type: "text"
|
|
1675
1895
|
}, props, {
|
|
@@ -1706,11 +1926,11 @@ function FormParameters({
|
|
|
1706
1926
|
baseUrl = window.location.origin
|
|
1707
1927
|
}) {
|
|
1708
1928
|
const hasTypeChoices = typeChoices && typeChoices.length > 1;
|
|
1709
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1929
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
1710
1930
|
className: `form-edit__settings ${className}`
|
|
1711
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
1931
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
1712
1932
|
className: "w-1/3"
|
|
1713
|
-
}, /*#__PURE__*/React.createElement(InputText, {
|
|
1933
|
+
}, /*#__PURE__*/React$1.createElement(InputText, {
|
|
1714
1934
|
label: "Title",
|
|
1715
1935
|
placeholder: "Enter the form title",
|
|
1716
1936
|
name: "title",
|
|
@@ -1718,9 +1938,9 @@ function FormParameters({
|
|
|
1718
1938
|
value: form.title,
|
|
1719
1939
|
disabled: !!readonly["title"],
|
|
1720
1940
|
onChange: onChange
|
|
1721
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
1941
|
+
})), /*#__PURE__*/React$1.createElement("div", {
|
|
1722
1942
|
className: "w-1/3"
|
|
1723
|
-
}, /*#__PURE__*/React.createElement(InputText, {
|
|
1943
|
+
}, /*#__PURE__*/React$1.createElement(InputText, {
|
|
1724
1944
|
label: "Name",
|
|
1725
1945
|
placeholder: "Enter the form machine name",
|
|
1726
1946
|
name: "name",
|
|
@@ -1728,16 +1948,16 @@ function FormParameters({
|
|
|
1728
1948
|
disabled: !!readonly["name"],
|
|
1729
1949
|
value: form.name,
|
|
1730
1950
|
onChange: onChange
|
|
1731
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
1951
|
+
})), /*#__PURE__*/React$1.createElement("div", {
|
|
1732
1952
|
className: "w-1/3"
|
|
1733
|
-
}, /*#__PURE__*/React.createElement(InputText, {
|
|
1953
|
+
}, /*#__PURE__*/React$1.createElement(InputText, {
|
|
1734
1954
|
label: "Path",
|
|
1735
1955
|
placeholder: "example",
|
|
1736
1956
|
name: "path",
|
|
1737
1957
|
className: "mb-0",
|
|
1738
|
-
description: /*#__PURE__*/React.createElement("span", {
|
|
1958
|
+
description: /*#__PURE__*/React$1.createElement("span", {
|
|
1739
1959
|
className: "text-xxs flex items-center"
|
|
1740
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
1960
|
+
}, /*#__PURE__*/React$1.createElement("i", {
|
|
1741
1961
|
className: "bx bx-link ml-1 mr-1"
|
|
1742
1962
|
}), `${baseUrl}/${form.path}`),
|
|
1743
1963
|
required: true,
|
|
@@ -1748,26 +1968,26 @@ function FormParameters({
|
|
|
1748
1968
|
width: "120px"
|
|
1749
1969
|
},
|
|
1750
1970
|
onChange: onChange
|
|
1751
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
1971
|
+
})), /*#__PURE__*/React$1.createElement("div", {
|
|
1752
1972
|
className: "w-1/3"
|
|
1753
|
-
}, /*#__PURE__*/React.createElement(Select, {
|
|
1973
|
+
}, /*#__PURE__*/React$1.createElement(Select, {
|
|
1754
1974
|
label: "Display as",
|
|
1755
1975
|
name: "display",
|
|
1756
1976
|
disabled: !!readonly["display"],
|
|
1757
1977
|
value: form.display,
|
|
1758
1978
|
choices: displayChoices,
|
|
1759
1979
|
onChange: onChange
|
|
1760
|
-
})), hasTypeChoices && /*#__PURE__*/React.createElement("div", {
|
|
1980
|
+
})), hasTypeChoices && /*#__PURE__*/React$1.createElement("div", {
|
|
1761
1981
|
className: "w-1/3"
|
|
1762
|
-
}, /*#__PURE__*/React.createElement(Select, {
|
|
1982
|
+
}, /*#__PURE__*/React$1.createElement(Select, {
|
|
1763
1983
|
label: "Type",
|
|
1764
1984
|
name: "type",
|
|
1765
1985
|
value: form.type,
|
|
1766
1986
|
choices: typeChoices,
|
|
1767
1987
|
onChange: onChange
|
|
1768
|
-
})), enableTags && /*#__PURE__*/React.createElement("div", {
|
|
1988
|
+
})), enableTags && /*#__PURE__*/React$1.createElement("div", {
|
|
1769
1989
|
className: "w-1/3"
|
|
1770
|
-
}, /*#__PURE__*/React.createElement(InputTags, {
|
|
1990
|
+
}, /*#__PURE__*/React$1.createElement(InputTags, {
|
|
1771
1991
|
label: "Tags",
|
|
1772
1992
|
name: "tags",
|
|
1773
1993
|
value: form.tags,
|
|
@@ -1934,14 +2154,14 @@ function FormEdit(props) {
|
|
|
1934
2154
|
options = {},
|
|
1935
2155
|
builder
|
|
1936
2156
|
} = props;
|
|
1937
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
2157
|
+
return /*#__PURE__*/React$1.createElement("div", null, /*#__PURE__*/React$1.createElement("div", {
|
|
1938
2158
|
className: "form-edit"
|
|
1939
|
-
}, /*#__PURE__*/React.createElement(FormParameters, _extends({}, props, {
|
|
2159
|
+
}, /*#__PURE__*/React$1.createElement(FormParameters, _extends({}, props, {
|
|
1940
2160
|
className: "",
|
|
1941
2161
|
key: `form-settings-${form._id}`,
|
|
1942
2162
|
form: form,
|
|
1943
2163
|
onChange: setChange
|
|
1944
|
-
})), /*#__PURE__*/React.createElement(FormEditCTAs, _extends({}, props, {
|
|
2164
|
+
})), /*#__PURE__*/React$1.createElement(FormEditCTAs, _extends({}, props, {
|
|
1945
2165
|
className: "",
|
|
1946
2166
|
key: `form-edit-ctas-${form._id}`,
|
|
1947
2167
|
options: options,
|
|
@@ -1953,7 +2173,7 @@ function FormEdit(props) {
|
|
|
1953
2173
|
onReset: reset,
|
|
1954
2174
|
onCopy: onCopy,
|
|
1955
2175
|
onSubmit: onSubmit
|
|
1956
|
-
}))), /*#__PURE__*/React.createElement(FormBuilder, {
|
|
2176
|
+
}))), /*#__PURE__*/React$1.createElement(FormBuilder, {
|
|
1957
2177
|
key: `form-builder-${form._id}`,
|
|
1958
2178
|
components: form.components,
|
|
1959
2179
|
display: form.display,
|
|
@@ -2095,12 +2315,12 @@ function FormSettings(props) {
|
|
|
2095
2315
|
isValid
|
|
2096
2316
|
} = useFormSettings(props);
|
|
2097
2317
|
const i18n = options.i18n || (f => f);
|
|
2098
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Form, {
|
|
2318
|
+
return /*#__PURE__*/React$1.createElement("div", null, /*#__PURE__*/React$1.createElement(Form, {
|
|
2099
2319
|
form: form,
|
|
2100
2320
|
submission: submission,
|
|
2101
2321
|
onChange: onChange,
|
|
2102
2322
|
options: options
|
|
2103
|
-
}), /*#__PURE__*/React.createElement("button", {
|
|
2323
|
+
}), /*#__PURE__*/React$1.createElement("button", {
|
|
2104
2324
|
"data-testid": "submit",
|
|
2105
2325
|
disabled: !isValid,
|
|
2106
2326
|
className: "mt-5 btn btn-primary",
|
|
@@ -2125,7 +2345,7 @@ function SelectColumnFilter({
|
|
|
2125
2345
|
label: value,
|
|
2126
2346
|
value
|
|
2127
2347
|
}));
|
|
2128
|
-
return /*#__PURE__*/React.createElement(Select, {
|
|
2348
|
+
return /*#__PURE__*/React$1.createElement(Select, {
|
|
2129
2349
|
key: `filter-${column.id}`,
|
|
2130
2350
|
name: `filter-${column.id}`,
|
|
2131
2351
|
size: "sm",
|
|
@@ -6667,40 +6887,40 @@ function FormsCell(props) {
|
|
|
6667
6887
|
original: form
|
|
6668
6888
|
}
|
|
6669
6889
|
} = props;
|
|
6670
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
6890
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
6671
6891
|
className: "p-1"
|
|
6672
|
-
}, /*#__PURE__*/React.createElement("h4", {
|
|
6892
|
+
}, /*#__PURE__*/React$1.createElement("h4", {
|
|
6673
6893
|
className: "text-primary text-lg flex items-center"
|
|
6674
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
6894
|
+
}, /*#__PURE__*/React$1.createElement("i", {
|
|
6675
6895
|
className: classnames(iconClass(undefined, icon), "mr-1")
|
|
6676
|
-
}), form.title), /*#__PURE__*/React.createElement("ul", {
|
|
6896
|
+
}), form.title), /*#__PURE__*/React$1.createElement("ul", {
|
|
6677
6897
|
className: "reset-list text-gray-500"
|
|
6678
|
-
}, /*#__PURE__*/React.createElement("li", {
|
|
6898
|
+
}, /*#__PURE__*/React$1.createElement("li", {
|
|
6679
6899
|
className: "text-sm"
|
|
6680
|
-
}, "Name: ", form.name || form.machineName), /*#__PURE__*/React.createElement("li", {
|
|
6900
|
+
}, "Name: ", form.name || form.machineName), /*#__PURE__*/React$1.createElement("li", {
|
|
6681
6901
|
className: "mt-5"
|
|
6682
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
6902
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
6683
6903
|
className: "badge bg-light mr-1"
|
|
6684
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
6904
|
+
}, /*#__PURE__*/React$1.createElement("i", {
|
|
6685
6905
|
className: classnames(iconClass(undefined, "history"), "mr-1")
|
|
6686
|
-
}), /*#__PURE__*/React.createElement("span", null, "Updated ", moment(form.modified).fromNow())), (form.tags || []).map((tag, index) => /*#__PURE__*/React.createElement("button", {
|
|
6906
|
+
}), /*#__PURE__*/React$1.createElement("span", null, "Updated ", moment(form.modified).fromNow())), (form.tags || []).map((tag, index) => /*#__PURE__*/React$1.createElement("button", {
|
|
6687
6907
|
key: index,
|
|
6688
6908
|
className: "badge badge-hover bg-secondary mr-1",
|
|
6689
6909
|
onClick: stopPropagationWrapper(() => {
|
|
6690
6910
|
props.setFilter("tags", tag);
|
|
6691
6911
|
props.gotoPage(0);
|
|
6692
6912
|
})
|
|
6693
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
6913
|
+
}, /*#__PURE__*/React$1.createElement("i", {
|
|
6694
6914
|
className: classnames(iconClass(undefined, "tags"), "mr-1")
|
|
6695
6915
|
}), tag)))));
|
|
6696
6916
|
}
|
|
6697
6917
|
|
|
6698
|
-
const _excluded$
|
|
6918
|
+
const _excluded$b = ["Cell"];
|
|
6699
6919
|
function FormsTable(_ref) {
|
|
6700
6920
|
let {
|
|
6701
6921
|
Cell
|
|
6702
6922
|
} = _ref,
|
|
6703
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
6923
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
|
|
6704
6924
|
const {
|
|
6705
6925
|
i18n = f => f,
|
|
6706
6926
|
tags
|
|
@@ -6710,7 +6930,7 @@ function FormsTable(_ref) {
|
|
|
6710
6930
|
Header: i18n("Title"),
|
|
6711
6931
|
accessor: "title",
|
|
6712
6932
|
id: "title",
|
|
6713
|
-
Cell: props => /*#__PURE__*/React.createElement(FormCell, _extends({}, props, {
|
|
6933
|
+
Cell: props => /*#__PURE__*/React$1.createElement(FormCell, _extends({}, props, {
|
|
6714
6934
|
icon: props.icon,
|
|
6715
6935
|
i18n: i18n
|
|
6716
6936
|
})),
|
|
@@ -6721,13 +6941,13 @@ function FormsTable(_ref) {
|
|
|
6721
6941
|
accessor: "tags",
|
|
6722
6942
|
id: "tags",
|
|
6723
6943
|
hidden: true,
|
|
6724
|
-
Filter: props => tags && tags.length ? /*#__PURE__*/React.createElement(SelectColumnFilter, _extends({}, props, {
|
|
6944
|
+
Filter: props => tags && tags.length ? /*#__PURE__*/React$1.createElement(SelectColumnFilter, _extends({}, props, {
|
|
6725
6945
|
column: _extends({}, props.columns, {
|
|
6726
6946
|
choices: tags
|
|
6727
6947
|
})
|
|
6728
|
-
})) : /*#__PURE__*/React.createElement(DefaultColumnFilter, props)
|
|
6948
|
+
})) : /*#__PURE__*/React$1.createElement(DefaultColumnFilter, props)
|
|
6729
6949
|
}];
|
|
6730
|
-
return /*#__PURE__*/React.createElement(Table, _extends({}, props, {
|
|
6950
|
+
return /*#__PURE__*/React$1.createElement(Table, _extends({}, props, {
|
|
6731
6951
|
columns: columns
|
|
6732
6952
|
}));
|
|
6733
6953
|
}
|
|
@@ -6739,9 +6959,9 @@ function Loader({
|
|
|
6739
6959
|
className = ""
|
|
6740
6960
|
}) {
|
|
6741
6961
|
if (isActive) {
|
|
6742
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
6962
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
6743
6963
|
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)
|
|
6744
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
6964
|
+
}, /*#__PURE__*/React$1.createElement("span", {
|
|
6745
6965
|
"data-testid": `icon_${icon}`,
|
|
6746
6966
|
color: color,
|
|
6747
6967
|
className: `text-11xl ${iconClass(undefined, icon, true)}`
|
|
@@ -6756,7 +6976,7 @@ Loader.propTypes = {
|
|
|
6756
6976
|
className: PropTypes.string
|
|
6757
6977
|
};
|
|
6758
6978
|
|
|
6759
|
-
const _excluded$
|
|
6979
|
+
const _excluded$c = ["show", "children", "closeModal", "onClose", "title", "footer", "style", "className"];
|
|
6760
6980
|
function useModal() {
|
|
6761
6981
|
const [show, setShowModal] = useState(false);
|
|
6762
6982
|
return {
|
|
@@ -6781,7 +7001,7 @@ function Modal(_ref) {
|
|
|
6781
7001
|
style,
|
|
6782
7002
|
className = ""
|
|
6783
7003
|
} = _ref,
|
|
6784
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
7004
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
|
|
6785
7005
|
const titleRef = useRef();
|
|
6786
7006
|
const footerRef = useRef();
|
|
6787
7007
|
const [maxHeight, setMaxHeight] = useState();
|
|
@@ -6801,35 +7021,35 @@ function Modal(_ref) {
|
|
|
6801
7021
|
if (!show) {
|
|
6802
7022
|
return null;
|
|
6803
7023
|
}
|
|
6804
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
7024
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
6805
7025
|
role: "dialog",
|
|
6806
7026
|
className: `formio-dialog formio-dialog-theme-default ${className}`
|
|
6807
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
7027
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
6808
7028
|
className: "formio-dialog-overlay",
|
|
6809
7029
|
onClick: onClickClose
|
|
6810
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
7030
|
+
}), /*#__PURE__*/React$1.createElement("div", {
|
|
6811
7031
|
style: style,
|
|
6812
7032
|
className: "formio-dialog-content"
|
|
6813
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
7033
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
6814
7034
|
className: "formio-dialog-wrapper"
|
|
6815
|
-
}, title ? /*#__PURE__*/React.createElement("div", {
|
|
7035
|
+
}, title ? /*#__PURE__*/React$1.createElement("div", {
|
|
6816
7036
|
className: "formio-dialog-title",
|
|
6817
7037
|
ref: titleRef,
|
|
6818
7038
|
"data-testid": "modalTitle"
|
|
6819
|
-
}, title) : null, /*#__PURE__*/React.createElement("div", {
|
|
7039
|
+
}, title) : null, /*#__PURE__*/React$1.createElement("div", {
|
|
6820
7040
|
className: "formio-dialog-body",
|
|
6821
7041
|
style: {
|
|
6822
7042
|
maxHeight
|
|
6823
7043
|
},
|
|
6824
7044
|
"data-testid": "modalBody"
|
|
6825
|
-
}, show && children), ModalFooter ? /*#__PURE__*/React.createElement("div", {
|
|
7045
|
+
}, show && children), ModalFooter ? /*#__PURE__*/React$1.createElement("div", {
|
|
6826
7046
|
className: "formio-dialog-footer",
|
|
6827
7047
|
ref: footerRef,
|
|
6828
7048
|
"data-testid": "modalFooter"
|
|
6829
|
-
}, /*#__PURE__*/React.createElement(ModalFooter, _extends({}, props, {
|
|
7049
|
+
}, /*#__PURE__*/React$1.createElement(ModalFooter, _extends({}, props, {
|
|
6830
7050
|
closeModal: closeModal,
|
|
6831
7051
|
onClose: onClickClose
|
|
6832
|
-
}))) : null), /*#__PURE__*/React.createElement("button", {
|
|
7052
|
+
}))) : null), /*#__PURE__*/React$1.createElement("button", {
|
|
6833
7053
|
className: "formio-dialog-close float-right btn btn-secondary btn-sm",
|
|
6834
7054
|
"aria-label": "close",
|
|
6835
7055
|
"data-testid": "closeModal",
|
|
@@ -6837,7 +7057,7 @@ function Modal(_ref) {
|
|
|
6837
7057
|
})));
|
|
6838
7058
|
}
|
|
6839
7059
|
|
|
6840
|
-
const _excluded$
|
|
7060
|
+
const _excluded$d = ["maxWidth", "children"];
|
|
6841
7061
|
function RemoveModalFooter({
|
|
6842
7062
|
value,
|
|
6843
7063
|
valueToCompare,
|
|
@@ -6845,13 +7065,13 @@ function RemoveModalFooter({
|
|
|
6845
7065
|
onClose,
|
|
6846
7066
|
i18n = f => f
|
|
6847
7067
|
}) {
|
|
6848
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
7068
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
6849
7069
|
className: "flex items-center justify-center bg-white p-2"
|
|
6850
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
7070
|
+
}, /*#__PURE__*/React$1.createElement("button", {
|
|
6851
7071
|
"data-testid": "customCloseModal",
|
|
6852
7072
|
className: "btn btn-outline-dark mx-2",
|
|
6853
7073
|
onClick: onClose
|
|
6854
|
-
}, i18n("Cancel")), /*#__PURE__*/React.createElement("button", {
|
|
7074
|
+
}, i18n("Cancel")), /*#__PURE__*/React$1.createElement("button", {
|
|
6855
7075
|
disabled: valueToCompare !== value,
|
|
6856
7076
|
"data-testid": "customSubmitModal",
|
|
6857
7077
|
className: "btn btn-danger mx-2",
|
|
@@ -6860,7 +7080,7 @@ function RemoveModalFooter({
|
|
|
6860
7080
|
onSubmit(e);
|
|
6861
7081
|
}
|
|
6862
7082
|
}
|
|
6863
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
7083
|
+
}, /*#__PURE__*/React$1.createElement("i", {
|
|
6864
7084
|
className: classnames(iconClass(undefined, "trash"), "mr-2")
|
|
6865
7085
|
}), i18n("Remove")));
|
|
6866
7086
|
}
|
|
@@ -6870,12 +7090,12 @@ function RemoveModal(_ref) {
|
|
|
6870
7090
|
maxWidth = "300px",
|
|
6871
7091
|
children
|
|
6872
7092
|
} = _ref,
|
|
6873
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
7093
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
|
|
6874
7094
|
const {
|
|
6875
7095
|
i18n = noop
|
|
6876
7096
|
} = props;
|
|
6877
7097
|
const [value, setValue] = useState();
|
|
6878
|
-
return /*#__PURE__*/React.createElement(Modal, _extends({}, props, {
|
|
7098
|
+
return /*#__PURE__*/React$1.createElement(Modal, _extends({}, props, {
|
|
6879
7099
|
className: classnames(props.className, "formio-dialog-theme-remove"),
|
|
6880
7100
|
style: {
|
|
6881
7101
|
maxWidth
|
|
@@ -6883,11 +7103,11 @@ function RemoveModal(_ref) {
|
|
|
6883
7103
|
title: `Drop ${(_props$itemType = props.itemType) == null ? void 0 : _props$itemType.toLowerCase()}`,
|
|
6884
7104
|
value: value,
|
|
6885
7105
|
footer: RemoveModalFooter
|
|
6886
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
7106
|
+
}), /*#__PURE__*/React$1.createElement("div", {
|
|
6887
7107
|
className: "px-4 pt-3 pb-5"
|
|
6888
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
7108
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
6889
7109
|
className: "pb-1"
|
|
6890
|
-
}, 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, {
|
|
7110
|
+
}, children, i18n("To drop"), " ", /*#__PURE__*/React$1.createElement("strong", null, props.valueToCompare), ",\xA0", i18n("type the"), "\xA0", /*#__PURE__*/React$1.createElement("strong", null, "\"", (_props$itemType2 = props.itemType) == null ? void 0 : _props$itemType2.toLowerCase(), "\""), "\xA0", i18n("name"), " ", /*#__PURE__*/React$1.createElement("strong", null, "\"", props.valueToCompare, "\""), "."), /*#__PURE__*/React$1.createElement(InputText, {
|
|
6891
7111
|
name: "remove",
|
|
6892
7112
|
value: value,
|
|
6893
7113
|
onChange: (name, value) => setValue(value)
|
|
@@ -7068,17 +7288,17 @@ function DefaultCell({
|
|
|
7068
7288
|
render = f => f
|
|
7069
7289
|
}) {
|
|
7070
7290
|
if (value === undefined) {
|
|
7071
|
-
return /*#__PURE__*/React.createElement("span", null);
|
|
7291
|
+
return /*#__PURE__*/React$1.createElement("span", null);
|
|
7072
7292
|
}
|
|
7073
7293
|
const rendered = render(value);
|
|
7074
7294
|
if (value !== rendered) {
|
|
7075
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
7295
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
7076
7296
|
dangerouslySetInnerHTML: {
|
|
7077
7297
|
__html: rendered
|
|
7078
7298
|
}
|
|
7079
7299
|
});
|
|
7080
7300
|
}
|
|
7081
|
-
return /*#__PURE__*/React.createElement("span", null, String(value));
|
|
7301
|
+
return /*#__PURE__*/React$1.createElement("span", null, String(value));
|
|
7082
7302
|
}
|
|
7083
7303
|
|
|
7084
7304
|
function mapFormToColumns(form) {
|
|
@@ -7089,7 +7309,7 @@ function mapFormToColumns(form) {
|
|
|
7089
7309
|
const column = {
|
|
7090
7310
|
Header: component.label || component.title || component.key,
|
|
7091
7311
|
accessor: `data.${component.key}`,
|
|
7092
|
-
Cell: props => /*#__PURE__*/React.createElement(DefaultCell, _extends({}, props, {
|
|
7312
|
+
Cell: props => /*#__PURE__*/React$1.createElement(DefaultCell, _extends({}, props, {
|
|
7093
7313
|
render: value => cmp.asString(value)
|
|
7094
7314
|
}))
|
|
7095
7315
|
};
|
|
@@ -7103,14 +7323,14 @@ function mapFormToColumns(form) {
|
|
|
7103
7323
|
return columns;
|
|
7104
7324
|
}
|
|
7105
7325
|
|
|
7106
|
-
const _excluded$
|
|
7326
|
+
const _excluded$e = ["form"];
|
|
7107
7327
|
function SubmissionsTable(_ref) {
|
|
7108
7328
|
let {
|
|
7109
7329
|
form
|
|
7110
7330
|
} = _ref,
|
|
7111
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
7331
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$e);
|
|
7112
7332
|
const columns = form && mapFormToColumns(form);
|
|
7113
|
-
return /*#__PURE__*/React.createElement(Table, _extends({}, props, {
|
|
7333
|
+
return /*#__PURE__*/React$1.createElement(Table, _extends({}, props, {
|
|
7114
7334
|
columns: columns
|
|
7115
7335
|
}));
|
|
7116
7336
|
}
|
|
@@ -7123,7 +7343,7 @@ function SliderColumnFilter({
|
|
|
7123
7343
|
id
|
|
7124
7344
|
}
|
|
7125
7345
|
}) {
|
|
7126
|
-
const [min, max] = React.useMemo(() => {
|
|
7346
|
+
const [min, max] = React$1.useMemo(() => {
|
|
7127
7347
|
let min = preFilteredRows.length ? preFilteredRows[0].values[id] : 0;
|
|
7128
7348
|
let max = preFilteredRows.length ? preFilteredRows[0].values[id] : 0;
|
|
7129
7349
|
preFilteredRows.forEach(row => {
|
|
@@ -7132,7 +7352,7 @@ function SliderColumnFilter({
|
|
|
7132
7352
|
});
|
|
7133
7353
|
return [min, max];
|
|
7134
7354
|
}, [id, preFilteredRows]);
|
|
7135
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", {
|
|
7355
|
+
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("input", {
|
|
7136
7356
|
type: "range",
|
|
7137
7357
|
min: min,
|
|
7138
7358
|
max: max,
|
|
@@ -7140,12 +7360,12 @@ function SliderColumnFilter({
|
|
|
7140
7360
|
onChange: e => {
|
|
7141
7361
|
setFilter(parseInt(e.target.value, 10));
|
|
7142
7362
|
}
|
|
7143
|
-
}), /*#__PURE__*/React.createElement("button", {
|
|
7363
|
+
}), /*#__PURE__*/React$1.createElement("button", {
|
|
7144
7364
|
onClick: () => setFilter(undefined)
|
|
7145
7365
|
}, "Off"));
|
|
7146
7366
|
}
|
|
7147
7367
|
|
|
7148
|
-
const _excluded$
|
|
7368
|
+
const _excluded$f = ["style", "current", "items", "children", "HeaderChildren", "AddButton", "Button", "className", "onClick", "i18n"];
|
|
7149
7369
|
function ButtonTab({
|
|
7150
7370
|
icon,
|
|
7151
7371
|
back,
|
|
@@ -7156,18 +7376,18 @@ function ButtonTab({
|
|
|
7156
7376
|
className,
|
|
7157
7377
|
after
|
|
7158
7378
|
}) {
|
|
7159
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
7379
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
7160
7380
|
title: "button-wrapper",
|
|
7161
7381
|
className: classnames("tw-tabs__button-wrapper", isActive ? "-active" : "", back ? "-back" : "", className)
|
|
7162
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
7382
|
+
}, /*#__PURE__*/React$1.createElement("button", {
|
|
7163
7383
|
title: "button-tab",
|
|
7164
7384
|
className: classnames("tw-tabs__button", reverse ? "-reverse" : "", isActive ? "-active" : "", back ? "-back" : ""),
|
|
7165
7385
|
onClick: onClick
|
|
7166
|
-
}, icon && /*#__PURE__*/React.createElement("i", {
|
|
7386
|
+
}, icon && /*#__PURE__*/React$1.createElement("i", {
|
|
7167
7387
|
className: classnames(iconClass(undefined, icon), "tw-tabs__button-icon")
|
|
7168
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
7388
|
+
}), /*#__PURE__*/React$1.createElement("span", {
|
|
7169
7389
|
className: "tw-tabs__button-label"
|
|
7170
|
-
}, children), after), /*#__PURE__*/React.createElement("div", {
|
|
7390
|
+
}, children), after), /*#__PURE__*/React$1.createElement("div", {
|
|
7171
7391
|
className: classnames("tw-tabs__button-border", isActive ? "-active" : "")
|
|
7172
7392
|
}));
|
|
7173
7393
|
}
|
|
@@ -7184,19 +7404,19 @@ function Tabs(_ref) {
|
|
|
7184
7404
|
onClick,
|
|
7185
7405
|
i18n = f => f
|
|
7186
7406
|
} = _ref,
|
|
7187
|
-
additionalProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
7188
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
7407
|
+
additionalProps = _objectWithoutPropertiesLoose(_ref, _excluded$f);
|
|
7408
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
7189
7409
|
"data-testid": "tabs-comp",
|
|
7190
7410
|
className: `tw-tabs ${className}`,
|
|
7191
7411
|
style: style
|
|
7192
|
-
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("nav", {
|
|
7412
|
+
}, /*#__PURE__*/React$1.createElement("div", null, /*#__PURE__*/React$1.createElement("nav", {
|
|
7193
7413
|
className: "tw-tabs__header"
|
|
7194
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
7414
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
7195
7415
|
className: "tw-tabs__header-wrapper"
|
|
7196
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
7416
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
7197
7417
|
className: "tw-tabs__header-border"
|
|
7198
7418
|
}), items.filter(item => item.label || item.icon).map((item, index) => {
|
|
7199
|
-
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
7419
|
+
return /*#__PURE__*/React$1.createElement(Button, _extends({
|
|
7200
7420
|
key: index,
|
|
7201
7421
|
back: item.back,
|
|
7202
7422
|
isActive: (current == null ? void 0 : current.action) === item.action,
|
|
@@ -7205,11 +7425,11 @@ function Tabs(_ref) {
|
|
|
7205
7425
|
onClick && onClick(item);
|
|
7206
7426
|
}
|
|
7207
7427
|
}, additionalProps, item), i18n(item.label || ""));
|
|
7208
|
-
}), AddButton && /*#__PURE__*/React.createElement(AddButton, _extends({}, additionalProps, {
|
|
7428
|
+
}), AddButton && /*#__PURE__*/React$1.createElement(AddButton, _extends({}, additionalProps, {
|
|
7209
7429
|
current: current
|
|
7210
|
-
})))), HeaderChildren && /*#__PURE__*/React.createElement(HeaderChildren, _extends({}, additionalProps, {
|
|
7430
|
+
})))), HeaderChildren && /*#__PURE__*/React$1.createElement(HeaderChildren, _extends({}, additionalProps, {
|
|
7211
7431
|
current: current
|
|
7212
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
7432
|
+
}))), /*#__PURE__*/React$1.createElement("div", {
|
|
7213
7433
|
title: "tab-body",
|
|
7214
7434
|
className: "tw-tabs__body"
|
|
7215
7435
|
}, children));
|
|
@@ -7231,5 +7451,5 @@ function mapPagination({
|
|
|
7231
7451
|
};
|
|
7232
7452
|
}
|
|
7233
7453
|
|
|
7234
|
-
export { ActionsTable, Alert, ButtonTab, Card, DefaultArrowSort, DefaultCell, DefaultCellHeader, DefaultCellOperations, DefaultColumnFilter, DefaultOperationButton, Form, FormAccess, FormAction, FormBuilder, FormControl, FormEdit, FormEditCTAs, FormParameters, FormSettings, FormsTable, InputTags, InputText, Loader, Modal, Pagination, ReactComponent, RemoveModal, Select, SelectColumnFilter, SliderColumnFilter, SubmissionsTable, Table, Tabs, callLast, defaultDisplayChoices, iconClass, mapPagination, stopPropagationWrapper, useForm, useFormEdit, useModal, useOperations, useTooltip };
|
|
7454
|
+
export { ActionsTable, Alert, ButtonTab, Card, DefaultArrowSort, DefaultCell, DefaultCellHeader, DefaultCellOperations, DefaultColumnFilter, DefaultOperationButton, Form, FormAccess, FormAction, FormBuilder, FormControl, FormEdit, FormEditCTAs, FormParameters, FormSettings, FormsTable, InputTags, InputText, Loader, Modal, Pagination, ReactComponent, RemoveModal, Select, SelectColumnFilter, SliderColumnFilter, SubmissionsTable, Table, Tabs, callLast, defaultDisplayChoices, getOperationCallback, iconClass, mapPagination, stopPropagationWrapper, useCustomTable, useForm, useFormEdit, useModal, useOperations, useTooltip };
|
|
7235
7455
|
//# sourceMappingURL=index.modern.js.map
|