@tsed/react-formio 1.11.2 → 1.12.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.
Files changed (141) hide show
  1. package/.env +2 -1
  2. package/craco.config.js +11 -1
  3. package/dist/components/alert/alert.component.spec.d.ts +1 -0
  4. package/dist/components/alert/alert.stories.d.ts +15 -0
  5. package/dist/components/form-action/formAction.stories.d.ts +90 -414
  6. package/dist/components/input-text/inputText.component.d.ts +1 -1
  7. package/dist/components/input-text/inputText.component.spec.d.ts +1 -0
  8. package/dist/components/select/select.component.spec.d.ts +1 -0
  9. package/dist/components/tabs/tabs.component.spec.d.ts +1 -0
  10. package/dist/index.js +60 -30
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.modern.js +59 -31
  13. package/dist/index.modern.js.map +1 -1
  14. package/jest.config.js +1 -1
  15. package/package.json +5 -9
  16. package/readme.md +74 -79
  17. package/src/components/__fixtures__/form-schema.json +10 -42
  18. package/src/components/__fixtures__/form.fixture.json +1 -1
  19. package/src/components/actions-table/actionsTable.component.spec.tsx +4 -13
  20. package/src/components/actions-table/actionsTable.component.tsx +3 -11
  21. package/src/components/alert/alert.component.spec.tsx +97 -0
  22. package/src/components/alert/alert.component.tsx +2 -8
  23. package/src/components/alert/alert.stories.tsx +17 -0
  24. package/src/components/card/card.component.tsx +1 -5
  25. package/src/components/form/form.component.tsx +1 -7
  26. package/src/components/form/useForm.hook.ts +4 -13
  27. package/src/components/form-access/formAccess.component.tsx +19 -82
  28. package/src/components/form-access/formAccess.schema.ts +7 -23
  29. package/src/components/form-access/formAccess.stories.tsx +2 -9
  30. package/src/components/form-access/formAccess.utils.spec.ts +4 -22
  31. package/src/components/form-access/formAccess.utils.ts +7 -29
  32. package/src/components/form-action/formAction.component.tsx +3 -19
  33. package/src/components/form-action/formAction.stories.tsx +251 -672
  34. package/src/components/form-builder/formBuilder.component.tsx +4 -13
  35. package/src/components/form-builder/formBuilder.stories.tsx +12 -24
  36. package/src/components/form-control/formControl.component.tsx +2 -8
  37. package/src/components/form-edit/formCtas.component.tsx +5 -23
  38. package/src/components/form-edit/formEdit.component.tsx +2 -20
  39. package/src/components/form-edit/formEdit.reducer.ts +2 -8
  40. package/src/components/form-edit/formEdit.stories.tsx +3 -15
  41. package/src/components/form-edit/formParameters.component.tsx +3 -20
  42. package/src/components/form-edit/useFormEdit.hook.ts +2 -9
  43. package/src/components/form-settings/formSettings.component.spec.tsx +2 -9
  44. package/src/components/form-settings/formSettings.component.tsx +6 -34
  45. package/src/components/form-settings/formSettings.stories.tsx +1 -6
  46. package/src/components/form-settings/formSettings.utils.spec.ts +1 -4
  47. package/src/components/form-settings/formSettings.utils.ts +2 -7
  48. package/src/components/forms-table/components/formCell.component.tsx +2 -6
  49. package/src/components/forms-table/formsTable.component.tsx +2 -7
  50. package/src/components/input-tags/inputTags.component.tsx +10 -34
  51. package/src/components/input-tags/inputTags.stories.tsx +4 -14
  52. package/src/components/input-text/inputText.component.spec.tsx +56 -0
  53. package/src/components/input-text/inputText.component.tsx +4 -5
  54. package/src/components/input-text/inputText.stories.tsx +6 -26
  55. package/src/components/loader/loader.component.tsx +2 -11
  56. package/src/components/modal/modal.component.spec.tsx +8 -14
  57. package/src/components/modal/modal.component.tsx +6 -27
  58. package/src/components/modal/modal.stories.tsx +1 -5
  59. package/src/components/modal/removeModal.component.tsx +4 -22
  60. package/src/components/pagination/pagination.component.spec.tsx +12 -38
  61. package/src/components/pagination/pagination.component.tsx +8 -41
  62. package/src/components/pagination/pagination.stories.tsx +1 -5
  63. package/src/components/react-component/reactComponent.component.tsx +3 -11
  64. package/src/components/select/select.component.spec.tsx +86 -0
  65. package/src/components/select/select.component.tsx +11 -15
  66. package/src/components/select/select.stories.tsx +6 -26
  67. package/src/components/submissions-table/submissionsTable.component.tsx +1 -3
  68. package/src/components/submissions-table/submissionsTable.stories.tsx +1 -1
  69. package/src/components/table/components/defaultArrowSort.component.tsx +1 -10
  70. package/src/components/table/components/defaultCell.component.tsx +1 -4
  71. package/src/components/table/components/defaultCellHeader.component.tsx +4 -14
  72. package/src/components/table/components/defaultCellOperations.component.tsx +14 -25
  73. package/src/components/table/components/defaultOperationButton.component.tsx +2 -10
  74. package/src/components/table/filters/defaultColumnFilter.component.spec.tsx +1 -1
  75. package/src/components/table/filters/selectColumnFilter.component.spec.tsx +2 -10
  76. package/src/components/table/filters/selectColumnFilter.component.tsx +2 -6
  77. package/src/components/table/table.component.tsx +13 -53
  78. package/src/components/table/table.stories.tsx +1 -1
  79. package/src/components/table/utils/getPageNumbers.ts +3 -11
  80. package/src/components/table/utils/mapFormToColumns.tsx +14 -22
  81. package/src/components/table/utils/useOperations.hook.tsx +2 -12
  82. package/src/components/tabs/tabs.component.spec.tsx +86 -0
  83. package/src/components/tabs/tabs.component.stories.tsx +2 -9
  84. package/src/components/tabs/tabs.component.tsx +9 -43
  85. package/src/interfaces/Operation.ts +1 -4
  86. package/src/react-table.d.ts +9 -28
  87. package/src/stores/action/action.actions.ts +31 -33
  88. package/src/stores/action/action.reducers.spec.ts +1 -8
  89. package/src/stores/action/action.reducers.ts +1 -8
  90. package/src/stores/action/action.selectors.ts +1 -2
  91. package/src/stores/action-info/action-info.actions.spec.ts +1 -5
  92. package/src/stores/action-info/action-info.actions.ts +16 -19
  93. package/src/stores/action-info/action-info.reducers.spec.ts +1 -6
  94. package/src/stores/action-info/action-info.reducers.ts +1 -6
  95. package/src/stores/action-info/action-info.selectors.ts +1 -4
  96. package/src/stores/actions/actions.actions.spec.ts +1 -6
  97. package/src/stores/actions/actions.actions.ts +16 -19
  98. package/src/stores/actions/actions.reducers.spec.ts +1 -6
  99. package/src/stores/actions/actions.reducers.ts +1 -6
  100. package/src/stores/actions/actions.selectors.ts +2 -4
  101. package/src/stores/auth/auth.reducers.ts +1 -4
  102. package/src/stores/auth/auth.selectors.spec.ts +1 -5
  103. package/src/stores/auth/auth.selectors.ts +3 -6
  104. package/src/stores/auth/auth.utils.tsx +2 -8
  105. package/src/stores/auth/getAccess.action.spec.ts +11 -54
  106. package/src/stores/auth/getAccess.action.ts +1 -6
  107. package/src/stores/auth/initAuth.action.ts +15 -17
  108. package/src/stores/form/form.actions.spec.ts +8 -39
  109. package/src/stores/form/form.actions.ts +55 -64
  110. package/src/stores/form/form.reducers.spec.ts +1 -7
  111. package/src/stores/form/form.reducers.ts +1 -8
  112. package/src/stores/form/form.selectors.ts +1 -2
  113. package/src/stores/forms/forms.actions.spec.ts +5 -18
  114. package/src/stores/forms/forms.actions.ts +17 -21
  115. package/src/stores/forms/forms.reducers.spec.ts +1 -6
  116. package/src/stores/forms/forms.reducers.ts +2 -13
  117. package/src/stores/forms/forms.selectors.ts +2 -4
  118. package/src/stores/index.spec.ts +6 -9
  119. package/src/stores/root/root.selectors.spec.ts +1 -6
  120. package/src/stores/root/root.selectors.ts +6 -24
  121. package/src/stores/submission/submission.actions.spec.ts +11 -33
  122. package/src/stores/submission/submission.actions.ts +57 -66
  123. package/src/stores/submission/submission.reducers.spec.ts +17 -27
  124. package/src/stores/submission/submission.reducers.ts +1 -4
  125. package/src/stores/submission/submission.selectors.ts +1 -4
  126. package/src/stores/submissions/submissions.actions.spec.ts +5 -18
  127. package/src/stores/submissions/submissions.actions.ts +17 -26
  128. package/src/stores/submissions/submissions.reducers.spec.ts +3 -12
  129. package/src/stores/submissions/submissions.reducers.ts +3 -17
  130. package/src/stores/submissions/submissions.selectors.spec.ts +1 -4
  131. package/src/stores/submissions/submissions.selectors.ts +2 -4
  132. package/src/utils/getEventValue.ts +1 -4
  133. package/src/utils/iconClass.ts +2 -10
  134. package/src/utils/mapPagination.ts +1 -6
  135. package/src/utils/mapRequestParams.ts +2 -12
  136. package/src/utils/url.test.ts +4 -12
  137. package/src/utils/url.ts +2 -7
  138. package/tsconfig.json +4 -12
  139. package/tsconfig.test.json +1 -1
  140. package/.eslintrc +0 -47
  141. package/.prettierrc +0 -10
package/dist/index.js CHANGED
@@ -130,6 +130,9 @@ function _defineProperties(target, props) {
130
130
  function _createClass(Constructor, protoProps, staticProps) {
131
131
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
132
132
  if (staticProps) _defineProperties(Constructor, staticProps);
133
+ Object.defineProperty(Constructor, "prototype", {
134
+ writable: false
135
+ });
133
136
  return Constructor;
134
137
  }
135
138
 
@@ -1725,8 +1728,7 @@ function Select(_ref) {
1725
1728
  _onChange = _ref.onChange,
1726
1729
  required = _ref.required,
1727
1730
  value = _ref.value,
1728
- _ref$choices = _ref.choices,
1729
- choices = _ref$choices === void 0 ? [] : _ref$choices,
1731
+ choices = _ref.choices,
1730
1732
  description = _ref.description,
1731
1733
  placeholder = _ref.placeholder,
1732
1734
  prefix = _ref.prefix,
@@ -2001,7 +2003,8 @@ function InputText(_ref) {
2001
2003
  suffix = _ref.suffix,
2002
2004
  description = _ref.description,
2003
2005
  className = _ref.className,
2004
- props = _objectWithoutPropertiesLoose(_ref, ["name", "value", "label", "onChange", "required", "size", "type", "prefix", "suffix", "description", "className"]);
2006
+ placeholder = _ref.placeholder,
2007
+ props = _objectWithoutPropertiesLoose(_ref, ["name", "value", "label", "onChange", "required", "size", "type", "prefix", "suffix", "description", "className", "placeholder"]);
2005
2008
 
2006
2009
  var _useState = React.useState(value),
2007
2010
  localValue = _useState[0],
@@ -2028,7 +2031,8 @@ function InputText(_ref) {
2028
2031
  className: classnames("form-control", size && "form-control-" + size),
2029
2032
  id: name,
2030
2033
  required: required,
2031
- value: localValue || "",
2034
+ value: localValue || placeholder || "",
2035
+ placeholder: placeholder,
2032
2036
  onChange: function onChange(event) {
2033
2037
  var value = getEventValue(event);
2034
2038
  setValue(value);
@@ -3192,7 +3196,8 @@ var FormBuilder = /*#__PURE__*/function (_React$Component) {
3192
3196
  var _this$builderRef;
3193
3197
 
3194
3198
  (_this$builderRef = this.builderRef) == null ? void 0 : _this$builderRef.destroy();
3195
- };
3199
+ } // eslint-disable-next-line react/no-deprecated
3200
+ ;
3196
3201
 
3197
3202
  _proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
3198
3203
  try {
@@ -3986,9 +3991,10 @@ var moment = createCommonjsModule(function (module, exports) {
3986
3991
 
3987
3992
  function map(arr, fn) {
3988
3993
  var res = [],
3989
- i;
3994
+ i,
3995
+ arrLen = arr.length;
3990
3996
 
3991
- for (i = 0; i < arr.length; ++i) {
3997
+ for (i = 0; i < arrLen; ++i) {
3992
3998
  res.push(fn(arr[i], i));
3993
3999
  }
3994
4000
 
@@ -4107,7 +4113,10 @@ var moment = createCommonjsModule(function (module, exports) {
4107
4113
  updateInProgress = false;
4108
4114
 
4109
4115
  function copyConfig(to, from) {
4110
- var i, prop, val;
4116
+ var i,
4117
+ prop,
4118
+ val,
4119
+ momentPropertiesLen = momentProperties.length;
4111
4120
 
4112
4121
  if (!isUndefined(from._isAMomentObject)) {
4113
4122
  to._isAMomentObject = from._isAMomentObject;
@@ -4149,8 +4158,8 @@ var moment = createCommonjsModule(function (module, exports) {
4149
4158
  to._locale = from._locale;
4150
4159
  }
4151
4160
 
4152
- if (momentProperties.length > 0) {
4153
- for (i = 0; i < momentProperties.length; i++) {
4161
+ if (momentPropertiesLen > 0) {
4162
+ for (i = 0; i < momentPropertiesLen; i++) {
4154
4163
  prop = momentProperties[i];
4155
4164
  val = from[prop];
4156
4165
 
@@ -4202,9 +4211,10 @@ var moment = createCommonjsModule(function (module, exports) {
4202
4211
  var args = [],
4203
4212
  arg,
4204
4213
  i,
4205
- key;
4214
+ key,
4215
+ argLen = arguments.length;
4206
4216
 
4207
- for (i = 0; i < arguments.length; i++) {
4217
+ for (i = 0; i < argLen; i++) {
4208
4218
  arg = '';
4209
4219
 
4210
4220
  if (typeof arguments[i] === 'object') {
@@ -4634,9 +4644,10 @@ var moment = createCommonjsModule(function (module, exports) {
4634
4644
  if (typeof units === 'object') {
4635
4645
  units = normalizeObjectUnits(units);
4636
4646
  var prioritized = getPrioritizedUnits(units),
4637
- i;
4647
+ i,
4648
+ prioritizedLen = prioritized.length;
4638
4649
 
4639
- for (i = 0; i < prioritized.length; i++) {
4650
+ for (i = 0; i < prioritizedLen; i++) {
4640
4651
  this[prioritized[i].unit](units[prioritized[i].unit]);
4641
4652
  }
4642
4653
  } else {
@@ -4717,7 +4728,8 @@ var moment = createCommonjsModule(function (module, exports) {
4717
4728
 
4718
4729
  function addParseToken(token, callback) {
4719
4730
  var i,
4720
- func = callback;
4731
+ func = callback,
4732
+ tokenLen;
4721
4733
 
4722
4734
  if (typeof token === 'string') {
4723
4735
  token = [token];
@@ -4729,7 +4741,9 @@ var moment = createCommonjsModule(function (module, exports) {
4729
4741
  };
4730
4742
  }
4731
4743
 
4732
- for (i = 0; i < token.length; i++) {
4744
+ tokenLen = token.length;
4745
+
4746
+ for (i = 0; i < tokenLen; i++) {
4733
4747
  tokens[token[i]] = func;
4734
4748
  }
4735
4749
  }
@@ -5815,11 +5829,16 @@ var moment = createCommonjsModule(function (module, exports) {
5815
5829
  return globalLocale;
5816
5830
  }
5817
5831
 
5832
+ function isLocaleNameSane(name) {
5833
+ // Prevent names that look like filesystem paths, i.e contain '/' or '\'
5834
+ return name.match('^[^/\\\\]*$') != null;
5835
+ }
5836
+
5818
5837
  function loadLocale(name) {
5819
5838
  var oldLocale = null,
5820
5839
  aliasedRequire; // TODO: Find a better way to register and load all the locales in Node
5821
5840
 
5822
- if (locales[name] === undefined && 'object' !== 'undefined' && module && module.exports) {
5841
+ if (locales[name] === undefined && 'object' !== 'undefined' && module && module.exports && isLocaleNameSane(name)) {
5823
5842
  try {
5824
5843
  oldLocale = globalLocale._abbr;
5825
5844
  aliasedRequire = commonjsRequire;
@@ -6051,12 +6070,14 @@ var moment = createCommonjsModule(function (module, exports) {
6051
6070
  allowTime,
6052
6071
  dateFormat,
6053
6072
  timeFormat,
6054
- tzFormat;
6073
+ tzFormat,
6074
+ isoDatesLen = isoDates.length,
6075
+ isoTimesLen = isoTimes.length;
6055
6076
 
6056
6077
  if (match) {
6057
6078
  getParsingFlags(config).iso = true;
6058
6079
 
6059
- for (i = 0, l = isoDates.length; i < l; i++) {
6080
+ for (i = 0, l = isoDatesLen; i < l; i++) {
6060
6081
  if (isoDates[i][1].exec(match[1])) {
6061
6082
  dateFormat = isoDates[i][0];
6062
6083
  allowTime = isoDates[i][2] !== false;
@@ -6070,7 +6091,7 @@ var moment = createCommonjsModule(function (module, exports) {
6070
6091
  }
6071
6092
 
6072
6093
  if (match[3]) {
6073
- for (i = 0, l = isoTimes.length; i < l; i++) {
6094
+ for (i = 0, l = isoTimesLen; i < l; i++) {
6074
6095
  if (isoTimes[i][1].exec(match[3])) {
6075
6096
  // match[2] should be 'T' or space
6076
6097
  timeFormat = (match[2] || ' ') + isoTimes[i][0];
@@ -6406,10 +6427,12 @@ var moment = createCommonjsModule(function (module, exports) {
6406
6427
  skipped,
6407
6428
  stringLength = string.length,
6408
6429
  totalParsedInputLength = 0,
6409
- era;
6430
+ era,
6431
+ tokenLen;
6410
6432
  tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
6433
+ tokenLen = tokens.length;
6411
6434
 
6412
- for (i = 0; i < tokens.length; i++) {
6435
+ for (i = 0; i < tokenLen; i++) {
6413
6436
  token = tokens[i];
6414
6437
  parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
6415
6438
 
@@ -6502,15 +6525,16 @@ var moment = createCommonjsModule(function (module, exports) {
6502
6525
  i,
6503
6526
  currentScore,
6504
6527
  validFormatFound,
6505
- bestFormatIsValid = false;
6528
+ bestFormatIsValid = false,
6529
+ configfLen = config._f.length;
6506
6530
 
6507
- if (config._f.length === 0) {
6531
+ if (configfLen === 0) {
6508
6532
  getParsingFlags(config).invalidFormat = true;
6509
6533
  config._d = new Date(NaN);
6510
6534
  return;
6511
6535
  }
6512
6536
 
6513
- for (i = 0; i < config._f.length; i++) {
6537
+ for (i = 0; i < configfLen; i++) {
6514
6538
  currentScore = 0;
6515
6539
  validFormatFound = false;
6516
6540
  tempConfig = copyConfig({}, config);
@@ -6732,7 +6756,8 @@ var moment = createCommonjsModule(function (module, exports) {
6732
6756
  function isDurationValid(m) {
6733
6757
  var key,
6734
6758
  unitHasDecimal = false,
6735
- i;
6759
+ i,
6760
+ orderLen = ordering.length;
6736
6761
 
6737
6762
  for (key in m) {
6738
6763
  if (hasOwnProp(m, key) && !(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
@@ -6740,7 +6765,7 @@ var moment = createCommonjsModule(function (module, exports) {
6740
6765
  }
6741
6766
  }
6742
6767
 
6743
- for (i = 0; i < ordering.length; ++i) {
6768
+ for (i = 0; i < orderLen; ++i) {
6744
6769
  if (m[ordering[i]]) {
6745
6770
  if (unitHasDecimal) {
6746
6771
  return false; // only allow non-integers for smallest unit
@@ -7228,9 +7253,10 @@ var moment = createCommonjsModule(function (module, exports) {
7228
7253
  propertyTest = false,
7229
7254
  properties = ['years', 'year', 'y', 'months', 'month', 'M', 'days', 'day', 'd', 'dates', 'date', 'D', 'hours', 'hour', 'h', 'minutes', 'minute', 'm', 'seconds', 'second', 's', 'milliseconds', 'millisecond', 'ms'],
7230
7255
  i,
7231
- property;
7256
+ property,
7257
+ propertyLen = properties.length;
7232
7258
 
7233
- for (i = 0; i < properties.length; i += 1) {
7259
+ for (i = 0; i < propertyLen; i += 1) {
7234
7260
  property = properties[i];
7235
7261
  propertyTest = propertyTest || hasOwnProp(input, property);
7236
7262
  }
@@ -8972,7 +8998,7 @@ var moment = createCommonjsModule(function (module, exports) {
8972
8998
  config._d = new Date(toInt(input));
8973
8999
  }); //! moment.js
8974
9000
 
8975
- hooks.version = '2.29.1';
9001
+ hooks.version = '2.29.3';
8976
9002
  setHookCallback(createLocal);
8977
9003
  hooks.fn = proto;
8978
9004
  hooks.min = min;
@@ -9586,8 +9612,10 @@ function ButtonTab(_ref) {
9586
9612
  className = _ref.className,
9587
9613
  after = _ref.after;
9588
9614
  return React__default['default'].createElement("div", {
9615
+ title: 'button-wrapper',
9589
9616
  className: classnames("tw-tabs__button-wrapper", isActive ? "-active" : "", back ? "-back" : "", className)
9590
9617
  }, React__default['default'].createElement("button", {
9618
+ title: 'button-tab',
9591
9619
  className: classnames("tw-tabs__button", reverse ? "-reverse" : "", isActive ? "-active" : "", back ? "-back" : ""),
9592
9620
  onClick: onClick
9593
9621
  }, icon && React__default['default'].createElement("i", {
@@ -9617,6 +9645,7 @@ function Tabs(_ref2) {
9617
9645
  additionalProps = _objectWithoutPropertiesLoose(_ref2, ["style", "current", "items", "children", "HeaderChildren", "AddButton", "Button", "className", "onClick", "i18n"]);
9618
9646
 
9619
9647
  return React__default['default'].createElement("div", {
9648
+ "data-testid": 'tabs-comp',
9620
9649
  className: "tw-tabs " + className,
9621
9650
  style: style
9622
9651
  }, React__default['default'].createElement("div", null, React__default['default'].createElement("nav", {
@@ -9642,6 +9671,7 @@ function Tabs(_ref2) {
9642
9671
  })))), HeaderChildren && React__default['default'].createElement(HeaderChildren, Object.assign({}, additionalProps, {
9643
9672
  current: current
9644
9673
  }))), React__default['default'].createElement("div", {
9674
+ title: "tab-body",
9645
9675
  className: "tw-tabs__body"
9646
9676
  }, children));
9647
9677
  }