@arquimedes.co/eureka-forms 2.0.81 → 2.0.83

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.
@@ -5,6 +5,7 @@ export interface GBaseStep {
5
5
  type: string;
6
6
  editable?: boolean;
7
7
  partial?: boolean;
8
+ clientInfoType?: string;
8
9
  dependencies?: string[];
9
10
  condition?: Condition;
10
11
  }
package/dist/App/App.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Classifier, Form } from '../@Types/Form';
3
3
  import './App.css';
4
- import { CustomStep } from '../FormSteps/CustomStep';
4
+ import { CustomStep, CustomStepProps } from '../FormSteps/CustomStep';
5
5
  import { EditorState } from 'draft-js';
6
6
  export interface AppProps {
7
7
  /** If the app is currently a widget */
@@ -37,6 +37,7 @@ export interface AppProps {
37
37
  url: string;
38
38
  caseNumber: string;
39
39
  }, renderIcon: () => JSX.Element, renderConfirmation: (state?: EditorState) => JSX.Element | void, renderLink: () => JSX.Element | void, onClose: () => void) => JSX.Element;
40
+ customClientInfoStep?: (props: CustomStepProps) => JSX.Element;
40
41
  /** Custom function to call on send */
41
42
  customSubmit?: (values: Record<string, unknown>, reload: () => void) => Promise<void>;
42
43
  /** Custom submit function, when passed it is called */
package/dist/App/App.js CHANGED
@@ -74,6 +74,7 @@ function App(_a) {
74
74
  sendLabel: props.sendLabel,
75
75
  fetchDownloadUrl: props.fetchDownloadUrl,
76
76
  customStepProps: (_g = props.customStepProps) !== null && _g !== void 0 ? _g : {},
77
+ customClientInfoStep: props.customClientInfoStep,
77
78
  } }, { children: _jsx("div", __assign({ className: styles.container }, { children: _jsx(FormComponent, { form: form, reload: reload, branding: branding, apiKey: props.apiKey, isWidget: !!isWidget, customSteps: customSteps, containerRef: containerRef, setSubmit: props.setSubmit, customSubmit: props.customSubmit, scrollToTop: props.scrollToTop, customSubmitBtns: props.customSubmitBtns, customConfirmation: props.customConfirmation }) })) })));
78
79
  }
79
80
  }
@@ -1,9 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { CustomStep } from '../FormSteps/CustomStep';
2
+ import { CustomStep, CustomStepProps } from '../FormSteps/CustomStep';
3
3
  export interface CustomContextData {
4
4
  sendLabel?: string;
5
5
  customStepProps: Record<string, unknown>;
6
6
  customSteps: Record<string, CustomStep>;
7
+ customClientInfoStep?: (props: CustomStepProps) => JSX.Element;
7
8
  /** Function to call on postview to fetch the download url of a file */
8
9
  fetchDownloadUrl?: (S3Key: string, fileName: string) => Promise<string>;
9
10
  }
@@ -20,7 +20,8 @@ export interface CustomStep {
20
20
  calcDependencyValue?: (step: any, value: any) => any;
21
21
  }
22
22
  interface CustomStepComponentProps extends StepProps {
23
- customStep: CustomStep;
23
+ customComponent: (props: CustomStepProps) => JSX.Element;
24
+ customProps?: Record<string, any>;
24
25
  }
25
- declare function CustomStepComponent({ customStep, ...props }: CustomStepComponentProps): JSX.Element;
26
+ declare function CustomStepComponent({ customComponent, customProps, ...props }: CustomStepComponentProps): JSX.Element;
26
27
  export default CustomStepComponent;
@@ -26,14 +26,13 @@ import CustomStepPropsContext from '../Contexts/CustomContext';
26
26
  import { useContext } from 'react';
27
27
  import { useStepDependency } from './StepHooks';
28
28
  function CustomStepComponent(_a) {
29
- var _b;
30
- var customStep = _a.customStep, props = __rest(_a, ["customStep"]);
29
+ var customComponent = _a.customComponent, _b = _a.customProps, customProps = _b === void 0 ? {} : _b, props = __rest(_a, ["customComponent", "customProps"]);
31
30
  var form = useContext(FormContext);
32
31
  var global = useAppSelector(function (state) { return state.global; });
33
32
  var customStepProps = useContext(CustomStepPropsContext).customStepProps;
34
33
  var dependencyStore = useAppSelector(function (state) { return state.site.dependencies; });
35
34
  var widthStats = useAppSelector(function (state) { return state.widthStats; });
36
35
  var dependencyInfo = useStepDependency(props.step, undefined);
37
- return customStep.component(__assign(__assign(__assign(__assign(__assign({}, global), dependencyInfo), props), { dependencyStore: dependencyStore, widthStats: widthStats, form: form, customStepProps: customStepProps }), ((_b = customStep.componentProps) !== null && _b !== void 0 ? _b : {})));
36
+ return customComponent(__assign(__assign(__assign(__assign(__assign({}, global), dependencyInfo), props), { dependencyStore: dependencyStore, widthStats: widthStats, form: form, customStepProps: customStepProps }), customProps));
38
37
  }
39
38
  export default CustomStepComponent;
@@ -38,7 +38,7 @@ import EntityValuePickerStep from './EntityValueStep/EntityValuePickerStep';
38
38
  import MapperStep from './MapperStep/MapperStep';
39
39
  import CollapsibleStep from './CollapsibleStep/CollapsibleStep';
40
40
  import ApiSelectorStep from './ApiSelectorStep/ApiSelectorStep';
41
- import CustomStep from './CustomStep';
41
+ import CustomStepComponent from './CustomStep';
42
42
  import { useAppSelector } from '../hooks';
43
43
  import { useContext } from 'react';
44
44
  import CustomContext from '../Contexts/CustomContext';
@@ -52,7 +52,7 @@ function StepComponent(_a) {
52
52
  return _jsx("div", {});
53
53
  }
54
54
  var _c = useAppSelector(function (state) { return state.global; }), postview = _c.postview, partial = _c.partial;
55
- var customSteps = useContext(CustomContext).customSteps;
55
+ var _d = useContext(CustomContext), customSteps = _d.customSteps, customClientInfoStep = _d.customClientInfoStep;
56
56
  var originalValue = useAppSelector(function (state) {
57
57
  return selectOriginalValue(state, step);
58
58
  });
@@ -67,7 +67,10 @@ function StepComponent(_a) {
67
67
  return _jsx("div", {});
68
68
  }
69
69
  if (customStep) {
70
- return (_jsx(CustomStep, __assign({}, props, { step: step, editable: editable, customStep: customStep })));
70
+ return (_jsx(CustomStepComponent, __assign({}, props, { customComponent: customStep.component, customProps: customStep.componentProps, step: step, editable: editable })));
71
+ }
72
+ if (customClientInfoStep && step.clientInfoType) {
73
+ return (_jsx(CustomStepComponent, __assign({}, props, { customComponent: customClientInfoStep, step: step, editable: editable })));
71
74
  }
72
75
  switch (step.type) {
73
76
  case FormStepTypes.TITLE: {
@@ -254,18 +254,23 @@ function CustomSelect(_a) {
254
254
  : {
255
255
  margin: containerMargin,
256
256
  }, fullWidth: true, required: required, error: error }, { children: [label && (_jsx(InputLabel, __assign({ classes: labelClasses }, { children: label }))), _jsx(Select, __assign({}, others, { innerRef: ref, title: calcTimeString(value), value: value ? 0 : '', IconComponent: ScheduleRoundedIcon, onClose: function () {
257
- setOpen(false);
257
+ if (!cantEdit)
258
+ setOpen(false);
258
259
  }, onOpen: function () {
260
+ if (cantEdit)
261
+ return;
259
262
  setOpen(true);
260
263
  if (required)
261
264
  handleChange(value !== null && value !== void 0 ? value : {});
262
265
  }, onFocus: function (e) {
263
266
  var _a;
264
- if (!((_a = e.relatedTarget) === null || _a === void 0 ? void 0 : _a.closest('.EF-MuiPaper-root'))) {
267
+ if (!((_a = e.relatedTarget) === null || _a === void 0 ? void 0 : _a.closest('.EF-MuiPaper-root')) &&
268
+ !cantEdit) {
265
269
  setOpen(true);
266
270
  }
267
271
  }, onBlur: function () {
268
- setOpen(false);
272
+ if (!cantEdit)
273
+ setOpen(false);
269
274
  }, input: _jsx(OutlinedInput, { disabled: cantEdit, name: label, label: label ? calcLabel() : undefined, classes: outlinedInputClasses }), renderValue: function () {
270
275
  return calcTimeString(value);
271
276
  }, MenuProps: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arquimedes.co/eureka-forms",
3
3
  "repository": "git://github.com/Arquimede5/Eureka-Forms.git",
4
- "version": "2.0.81",
4
+ "version": "2.0.83",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",