@tsed/react-formio 1.10.4 → 1.10.8

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.
@@ -1,8 +1,9 @@
1
- /// <reference types="react" />
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;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function DefaultCell({ value, render }: any): 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
@@ -2510,16 +2510,12 @@ var useForm = function useForm(props) {
2510
2510
 
2511
2511
  if ( // eslint-disable-next-line no-prototype-builtins
2512
2512
  props.hasOwnProperty(funcName) && typeof funcs[funcName] === "function") {
2513
- if (["onSubmit", "onSubmitDone"].includes(funcName)) {
2514
- funcs[funcName].apply(funcs, args);
2515
- } else {
2516
- if (!events.current.has(funcName)) {
2517
- var fn = callLast(funcs[funcName], 100);
2518
- events.current.set(funcName, fn);
2519
- }
2520
-
2521
- events.current.get(funcName).apply(void 0, args);
2513
+ if (!events.current.has(funcName)) {
2514
+ var fn = callLast(funcs[funcName], 100);
2515
+ events.current.set(funcName, fn);
2522
2516
  }
2517
+
2518
+ events.current.get(funcName).apply(void 0, args);
2523
2519
  }
2524
2520
  }
2525
2521
  });
@@ -2534,7 +2530,6 @@ var useForm = function useForm(props) {
2534
2530
  });
2535
2531
  }
2536
2532
 
2537
- React.useEffect(function () {}, []);
2538
2533
  return instance.current;
2539
2534
  };
2540
2535
 
@@ -2566,6 +2561,22 @@ var useForm = function useForm(props) {
2566
2561
  createWebForm(src, options);
2567
2562
  }
2568
2563
  }, [src]);
2564
+ React.useEffect(function () {
2565
+ if (form) {
2566
+ createWebForm(form, options);
2567
+ }
2568
+
2569
+ return function () {
2570
+ isLoaded.current = false;
2571
+ instance.current && instance.current.destroy(true);
2572
+ };
2573
+ }, []);
2574
+ React.useEffect(function () {
2575
+ props.onSubmit && events.current.set("onSubmit", props.onSubmit);
2576
+ }, [props.onSubmit, events]);
2577
+ React.useEffect(function () {
2578
+ props.onSubmitDone && events.current.set("onSubmitDone", props.onSubmitDone);
2579
+ }, [props.onSubmitDone, events]);
2569
2580
  return {
2570
2581
  element: element
2571
2582
  };
@@ -9192,9 +9203,14 @@ function RemoveModalFooter(_ref) {
9192
9203
  }), i18n("Remove")));
9193
9204
  }
9194
9205
 
9195
- function RemoveModal(props) {
9206
+ function RemoveModal(_ref2) {
9196
9207
  var _props$itemType, _props$itemType2;
9197
9208
 
9209
+ var _ref2$maxWidth = _ref2.maxWidth,
9210
+ maxWidth = _ref2$maxWidth === void 0 ? "300px" : _ref2$maxWidth,
9211
+ children = _ref2.children,
9212
+ props = _objectWithoutPropertiesLoose(_ref2, ["maxWidth", "children"]);
9213
+
9198
9214
  var _props$i18n = props.i18n,
9199
9215
  i18n = _props$i18n === void 0 ? noop__default['default'] : _props$i18n;
9200
9216
 
@@ -9203,8 +9219,9 @@ function RemoveModal(props) {
9203
9219
  setValue = _useState[1];
9204
9220
 
9205
9221
  return React__default['default'].createElement(Modal, Object.assign({}, props, {
9222
+ className: classnames(props.className, "formio-dialog-theme-remove"),
9206
9223
  style: {
9207
- maxWidth: "300px"
9224
+ maxWidth: maxWidth
9208
9225
  },
9209
9226
  title: "Drop " + ((_props$itemType = props.itemType) == null ? void 0 : _props$itemType.toLowerCase()),
9210
9227
  value: value,
@@ -9213,7 +9230,7 @@ function RemoveModal(props) {
9213
9230
  className: "px-4 pt-3 pb-5"
9214
9231
  }, React__default['default'].createElement("div", {
9215
9232
  className: "pb-1"
9216
- }, 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, {
9233
+ }, 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, {
9217
9234
  name: 'remove',
9218
9235
  value: value,
9219
9236
  onChange: function onChange(name, value) {
@@ -22722,7 +22739,7 @@ var ReactComponent = /*#__PURE__*/function (_Components$component) {
22722
22739
  return ReactComponent;
22723
22740
  }(formiojs.Components.components.field);
22724
22741
 
22725
- function Cell(_ref) {
22742
+ function DefaultCell(_ref) {
22726
22743
  var value = _ref.value,
22727
22744
  _ref$render = _ref.render,
22728
22745
  render = _ref$render === void 0 ? function (f) {
@@ -22754,8 +22771,8 @@ function mapFormToColumns(form) {
22754
22771
  var column = {
22755
22772
  Header: component.label || component.title || component.key,
22756
22773
  accessor: "data." + component.key,
22757
- Cell: function Cell$1(props) {
22758
- return React__default['default'].createElement(Cell, Object.assign({}, props, {
22774
+ Cell: function Cell(props) {
22775
+ return React__default['default'].createElement(DefaultCell, Object.assign({}, props, {
22759
22776
  render: function render(value) {
22760
22777
  return cmp.asString(value);
22761
22778
  }
@@ -22974,8 +22991,8 @@ exports.ActionsTable = ActionsTable;
22974
22991
  exports.Alert = Alert;
22975
22992
  exports.ButtonTab = ButtonTab;
22976
22993
  exports.Card = Card;
22977
- exports.Cell = Cell;
22978
22994
  exports.DefaultArrowSort = DefaultArrowSort;
22995
+ exports.DefaultCell = DefaultCell;
22979
22996
  exports.DefaultCellHeader = DefaultCellHeader;
22980
22997
  exports.DefaultCellOperations = DefaultCellOperations;
22981
22998
  exports.DefaultColumnFilter = DefaultColumnFilter;