@tsed/react-formio 1.10.6 → 1.10.10
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/.eslintrc +7 -2
- package/dist/components/modal/removeModal.component.d.ts +3 -2
- package/dist/components/table/components/defaultCell.component.d.ts +2 -0
- package/dist/components/table/index.d.ts +1 -1
- package/dist/index.js +43 -18
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +39 -15
- package/dist/index.modern.js.map +1 -1
- package/package.json +5 -4
- package/src/components/card/card.component.spec.tsx +2 -2
- package/src/components/card/card.component.tsx +2 -4
- package/src/components/form/useForm.hook.ts +11 -0
- package/src/components/form-builder/formBuilder.component.tsx +2 -0
- package/src/components/forms-table/components/formCell.component.tsx +2 -2
- package/src/components/modal/modal.component.spec.tsx +3 -3
- package/src/components/modal/modal.component.tsx +6 -1
- package/src/components/modal/modal.stories.tsx +5 -21
- package/src/components/modal/removeModal.component.tsx +11 -4
- package/src/components/react-component/reactComponent.component.tsx +1 -0
- package/src/components/table/components/{cell.component.tsx → defaultCell.component.tsx} +4 -1
- package/src/components/table/components/defaultOperationButton.component.tsx +2 -2
- package/src/components/table/index.ts +1 -1
- package/src/components/table/table.component.tsx +16 -5
- package/src/components/table/utils/mapFormToColumns.tsx +6 -3
- package/src/components/tabs/tabs.component.stories.tsx +1 -1
- package/dist/components/table/components/cell.component.d.ts +0 -2
package/.eslintrc
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
"prettier/react",
|
|
8
8
|
"plugin:@typescript-eslint/recommended",
|
|
9
9
|
"prettier/@typescript-eslint",
|
|
10
|
-
"plugin:prettier/recommended"
|
|
10
|
+
"plugin:prettier/recommended",
|
|
11
|
+
"plugin:react/recommended",
|
|
12
|
+
"plugin:jsx-a11y/recommended"
|
|
11
13
|
],
|
|
12
14
|
"env": {
|
|
13
15
|
"node": true,
|
|
@@ -31,12 +33,15 @@
|
|
|
31
33
|
"react/prop-types": 0,
|
|
32
34
|
"react/jsx-handler-names": 0,
|
|
33
35
|
"react/jsx-fragments": 0,
|
|
36
|
+
"react/no-unescaped-entities": 0,
|
|
34
37
|
"react/no-unused-prop-types": 0,
|
|
38
|
+
"react/display-name": 1,
|
|
35
39
|
"no-unused-vars": "off",
|
|
36
40
|
"@typescript-eslint/no-explicit-any": 0,
|
|
37
41
|
"@typescript-eslint/explicit-function-return-type": 0,
|
|
38
42
|
"@typescript-eslint/camelcase": 0,
|
|
39
43
|
"@typescript-eslint/no-empty-function": 0,
|
|
40
|
-
"import/export": 0
|
|
44
|
+
"import/export": 0,
|
|
45
|
+
"jsx-a11y/no-autofocus": 1
|
|
41
46
|
}
|
|
42
47
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
2
|
import { ModalProps } from "./modal.component";
|
|
3
3
|
export interface RemoveModalProps extends ModalProps {
|
|
4
4
|
valueToCompare: string;
|
|
5
5
|
itemType?: string;
|
|
6
6
|
i18n?: (f: string) => string;
|
|
7
|
+
maxWidth?: string;
|
|
7
8
|
}
|
|
8
|
-
export declare function RemoveModal(props: RemoveModalProps): JSX.Element;
|
|
9
|
+
export declare function RemoveModal({ maxWidth, children, ...props }: PropsWithChildren<RemoveModalProps>): JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./utils/useOperations.hook";
|
|
2
|
-
export * from "./components/cell.component";
|
|
3
2
|
export * from "./components/defaultArrowSort.component";
|
|
3
|
+
export * from "./components/defaultCell.component";
|
|
4
4
|
export * from "./components/defaultCellHeader.component";
|
|
5
5
|
export * from "./components/defaultCellHeader.component";
|
|
6
6
|
export * from "./components/defaultCellOperations.component";
|
package/dist/index.js
CHANGED
|
@@ -2102,7 +2102,7 @@ function DefaultOperationButton(props) {
|
|
|
2102
2102
|
i18n = _props$i18n === void 0 ? function (f) {
|
|
2103
2103
|
return f;
|
|
2104
2104
|
} : _props$i18n;
|
|
2105
|
-
return React__default['default'].createElement("
|
|
2105
|
+
return React__default['default'].createElement("button", {
|
|
2106
2106
|
className: classnames(className, ["btn", buttonOutline && "outline", buttonType].filter(Boolean).join("-"), "btn-" + buttonSize),
|
|
2107
2107
|
onClick: stopPropagationWrapper(function () {
|
|
2108
2108
|
return onClick(action);
|
|
@@ -2305,19 +2305,24 @@ function Table(props) {
|
|
|
2305
2305
|
className: classnames("table-group table-responsive", className)
|
|
2306
2306
|
}, React__default['default'].createElement("table", Object.assign({
|
|
2307
2307
|
className: "table table-striped table-hover"
|
|
2308
|
-
}, tableInstance.getTableProps()), React__default['default'].createElement("thead", null, tableInstance.headerGroups.map(function (headerGroup) {
|
|
2309
|
-
return React__default['default'].createElement("tr", Object.assign({
|
|
2310
|
-
|
|
2308
|
+
}, tableInstance.getTableProps()), React__default['default'].createElement("thead", null, tableInstance.headerGroups.map(function (headerGroup, i) {
|
|
2309
|
+
return React__default['default'].createElement("tr", Object.assign({
|
|
2310
|
+
key: "tableInstance.headerGroups" + i
|
|
2311
|
+
}, headerGroup.getHeaderGroupProps()), headerGroup.headers.map(function (column) {
|
|
2312
|
+
return React__default['default'].createElement("th", Object.assign({
|
|
2313
|
+
key: "tableInstance.headers.column." + column.id
|
|
2314
|
+
}, column.getHeaderProps()), React__default['default'].createElement(CellHeader, {
|
|
2311
2315
|
column: column
|
|
2312
2316
|
}));
|
|
2313
2317
|
}));
|
|
2314
|
-
})), !isLoading ? React__default['default'].createElement("tbody", Object.assign({}, tableInstance.getTableBodyProps()), tableInstance.page.map(function (row
|
|
2318
|
+
})), !isLoading ? React__default['default'].createElement("tbody", Object.assign({}, tableInstance.getTableBodyProps()), tableInstance.page.map(function (row) {
|
|
2315
2319
|
tableInstance.prepareRow(row);
|
|
2316
2320
|
return React__default['default'].createElement("tr", Object.assign({
|
|
2321
|
+
key: "tableInstance.page." + row.id,
|
|
2317
2322
|
onClick: function onClick() {
|
|
2318
2323
|
return _onClick(row.original, "row");
|
|
2319
2324
|
}
|
|
2320
|
-
}, row.getRowProps()), row.cells.map(function (cell) {
|
|
2325
|
+
}, row.getRowProps()), row.cells.map(function (cell, i) {
|
|
2321
2326
|
var _cell$column = cell.column,
|
|
2322
2327
|
hidden = _cell$column.hidden,
|
|
2323
2328
|
colspan = _cell$column.colspan;
|
|
@@ -2327,6 +2332,7 @@ function Table(props) {
|
|
|
2327
2332
|
}
|
|
2328
2333
|
|
|
2329
2334
|
return React__default['default'].createElement("td", Object.assign({
|
|
2335
|
+
key: "tableInstance.page.cells." + (cell.value || "value") + "." + i,
|
|
2330
2336
|
colSpan: colspan
|
|
2331
2337
|
}, cell.getCellProps()), cell.render("Cell"));
|
|
2332
2338
|
}));
|
|
@@ -2463,11 +2469,10 @@ function Card(_ref) {
|
|
|
2463
2469
|
}, React__default['default'].createElement("div", {
|
|
2464
2470
|
className: "card-header "
|
|
2465
2471
|
}, React__default['default'].createElement("h4", {
|
|
2466
|
-
className: "card-title"
|
|
2467
|
-
role: "card-heading"
|
|
2472
|
+
className: "card-title"
|
|
2468
2473
|
}, label)), React__default['default'].createElement("div", {
|
|
2469
2474
|
className: "card-body",
|
|
2470
|
-
role: "
|
|
2475
|
+
role: "article"
|
|
2471
2476
|
}, children));
|
|
2472
2477
|
}
|
|
2473
2478
|
|
|
@@ -2561,6 +2566,16 @@ var useForm = function useForm(props) {
|
|
|
2561
2566
|
createWebForm(src, options);
|
|
2562
2567
|
}
|
|
2563
2568
|
}, [src]);
|
|
2569
|
+
React.useEffect(function () {
|
|
2570
|
+
if (form) {
|
|
2571
|
+
createWebForm(form, options);
|
|
2572
|
+
}
|
|
2573
|
+
|
|
2574
|
+
return function () {
|
|
2575
|
+
isLoaded.current = false;
|
|
2576
|
+
instance.current && instance.current.destroy(true);
|
|
2577
|
+
};
|
|
2578
|
+
}, []);
|
|
2564
2579
|
React.useEffect(function () {
|
|
2565
2580
|
props.onSubmit && events.current.set("onSubmit", props.onSubmit);
|
|
2566
2581
|
}, [props.onSubmit, events]);
|
|
@@ -9019,7 +9034,7 @@ function FormsCell(props) {
|
|
|
9019
9034
|
}, React__default['default'].createElement("i", {
|
|
9020
9035
|
className: classnames(iconClass(undefined, "history"), "mr-1")
|
|
9021
9036
|
}), React__default['default'].createElement("span", null, "Updated ", moment(form.modified).fromNow())), (form.tags || []).map(function (tag, index) {
|
|
9022
|
-
return React__default['default'].createElement("
|
|
9037
|
+
return React__default['default'].createElement("button", {
|
|
9023
9038
|
key: index,
|
|
9024
9039
|
className: 'badge badge-hover bg-secondary mr-1',
|
|
9025
9040
|
onClick: stopPropagationWrapper(function () {
|
|
@@ -9132,6 +9147,7 @@ function Modal(_ref) {
|
|
|
9132
9147
|
}
|
|
9133
9148
|
|
|
9134
9149
|
return React__default['default'].createElement("div", {
|
|
9150
|
+
role: "dialog",
|
|
9135
9151
|
className: "formio-dialog formio-dialog-theme-default " + className
|
|
9136
9152
|
}, React__default['default'].createElement("div", {
|
|
9137
9153
|
className: 'formio-dialog-overlay',
|
|
@@ -9172,7 +9188,9 @@ function RemoveModalFooter(_ref) {
|
|
|
9172
9188
|
onSubmit = _ref.onSubmit,
|
|
9173
9189
|
onClose = _ref.onClose,
|
|
9174
9190
|
_ref$i18n = _ref.i18n,
|
|
9175
|
-
i18n = _ref$i18n === void 0 ?
|
|
9191
|
+
i18n = _ref$i18n === void 0 ? function (f) {
|
|
9192
|
+
return f;
|
|
9193
|
+
} : _ref$i18n;
|
|
9176
9194
|
return React__default['default'].createElement("div", {
|
|
9177
9195
|
className: "flex items-center justify-center bg-white p-2"
|
|
9178
9196
|
}, React__default['default'].createElement("button", {
|
|
@@ -9193,9 +9211,14 @@ function RemoveModalFooter(_ref) {
|
|
|
9193
9211
|
}), i18n("Remove")));
|
|
9194
9212
|
}
|
|
9195
9213
|
|
|
9196
|
-
function RemoveModal(
|
|
9214
|
+
function RemoveModal(_ref2) {
|
|
9197
9215
|
var _props$itemType, _props$itemType2;
|
|
9198
9216
|
|
|
9217
|
+
var _ref2$maxWidth = _ref2.maxWidth,
|
|
9218
|
+
maxWidth = _ref2$maxWidth === void 0 ? "300px" : _ref2$maxWidth,
|
|
9219
|
+
children = _ref2.children,
|
|
9220
|
+
props = _objectWithoutPropertiesLoose(_ref2, ["maxWidth", "children"]);
|
|
9221
|
+
|
|
9199
9222
|
var _props$i18n = props.i18n,
|
|
9200
9223
|
i18n = _props$i18n === void 0 ? noop__default['default'] : _props$i18n;
|
|
9201
9224
|
|
|
@@ -9204,8 +9227,9 @@ function RemoveModal(props) {
|
|
|
9204
9227
|
setValue = _useState[1];
|
|
9205
9228
|
|
|
9206
9229
|
return React__default['default'].createElement(Modal, Object.assign({}, props, {
|
|
9230
|
+
className: classnames(props.className, "formio-dialog-theme-remove"),
|
|
9207
9231
|
style: {
|
|
9208
|
-
maxWidth:
|
|
9232
|
+
maxWidth: maxWidth
|
|
9209
9233
|
},
|
|
9210
9234
|
title: "Drop " + ((_props$itemType = props.itemType) == null ? void 0 : _props$itemType.toLowerCase()),
|
|
9211
9235
|
value: value,
|
|
@@ -9214,7 +9238,7 @@ function RemoveModal(props) {
|
|
|
9214
9238
|
className: "px-4 pt-3 pb-5"
|
|
9215
9239
|
}, React__default['default'].createElement("div", {
|
|
9216
9240
|
className: "pb-1"
|
|
9217
|
-
}, i18n("To drop"), " ", React__default['default'].createElement("strong", null, props.valueToCompare), ",\xA0", i18n("type the"), "\xA0", React__default['default'].createElement("strong", null, "\"", (_props$itemType2 = props.itemType) == null ? void 0 : _props$itemType2.toLowerCase(), "\""), "\xA0", i18n("name"), " ", React__default['default'].createElement("strong", null, "\"", props.valueToCompare, "\""), "."), React__default['default'].createElement(InputText, {
|
|
9241
|
+
}, children, i18n("To drop"), " ", React__default['default'].createElement("strong", null, props.valueToCompare), ",\xA0", i18n("type the"), "\xA0", React__default['default'].createElement("strong", null, "\"", (_props$itemType2 = props.itemType) == null ? void 0 : _props$itemType2.toLowerCase(), "\""), "\xA0", i18n("name"), " ", React__default['default'].createElement("strong", null, "\"", props.valueToCompare, "\""), "."), React__default['default'].createElement(InputText, {
|
|
9218
9242
|
name: 'remove',
|
|
9219
9243
|
value: value,
|
|
9220
9244
|
onChange: function onChange(name, value) {
|
|
@@ -22639,6 +22663,7 @@ var ReactComponent = /*#__PURE__*/function (_Components$component) {
|
|
|
22639
22663
|
;
|
|
22640
22664
|
|
|
22641
22665
|
_proto.attachReact = function attachReact(element) {
|
|
22666
|
+
// eslint-disable-next-line react/no-render-return-value
|
|
22642
22667
|
return reactDom.render(this.renderReact(), element);
|
|
22643
22668
|
}
|
|
22644
22669
|
/**
|
|
@@ -22723,7 +22748,7 @@ var ReactComponent = /*#__PURE__*/function (_Components$component) {
|
|
|
22723
22748
|
return ReactComponent;
|
|
22724
22749
|
}(formiojs.Components.components.field);
|
|
22725
22750
|
|
|
22726
|
-
function
|
|
22751
|
+
function DefaultCell(_ref) {
|
|
22727
22752
|
var value = _ref.value,
|
|
22728
22753
|
_ref$render = _ref.render,
|
|
22729
22754
|
render = _ref$render === void 0 ? function (f) {
|
|
@@ -22755,8 +22780,8 @@ function mapFormToColumns(form) {
|
|
|
22755
22780
|
var column = {
|
|
22756
22781
|
Header: component.label || component.title || component.key,
|
|
22757
22782
|
accessor: "data." + component.key,
|
|
22758
|
-
Cell: function Cell
|
|
22759
|
-
return React__default['default'].createElement(
|
|
22783
|
+
Cell: function Cell(props) {
|
|
22784
|
+
return React__default['default'].createElement(DefaultCell, Object.assign({}, props, {
|
|
22760
22785
|
render: function render(value) {
|
|
22761
22786
|
return cmp.asString(value);
|
|
22762
22787
|
}
|
|
@@ -22975,8 +23000,8 @@ exports.ActionsTable = ActionsTable;
|
|
|
22975
23000
|
exports.Alert = Alert;
|
|
22976
23001
|
exports.ButtonTab = ButtonTab;
|
|
22977
23002
|
exports.Card = Card;
|
|
22978
|
-
exports.Cell = Cell;
|
|
22979
23003
|
exports.DefaultArrowSort = DefaultArrowSort;
|
|
23004
|
+
exports.DefaultCell = DefaultCell;
|
|
22980
23005
|
exports.DefaultCellHeader = DefaultCellHeader;
|
|
22981
23006
|
exports.DefaultCellOperations = DefaultCellOperations;
|
|
22982
23007
|
exports.DefaultColumnFilter = DefaultColumnFilter;
|