@arquimedes.co/eureka-forms 0.2.33-test → 0.2.34-test
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/dist/App.d.ts
CHANGED
|
@@ -21,12 +21,14 @@ export interface AppProps {
|
|
|
21
21
|
customSteps?: Record<string, CustomStep>;
|
|
22
22
|
/** Function to call on postview to fetch the download url of a file */
|
|
23
23
|
fetchDownloadUrl?: (S3Key: string, fileName: string) => Promise<string>;
|
|
24
|
+
/** Function to call after the confimation dialog has been closed */
|
|
25
|
+
handleConfirmed?: Function;
|
|
24
26
|
}
|
|
25
27
|
export interface CustomStep {
|
|
26
28
|
component: ReactNode;
|
|
27
29
|
updateValue: (idStep: string, values: Record<string, any>, form: Form) => void;
|
|
28
30
|
}
|
|
29
|
-
declare function App({ apiKey, domain, preview, formData, postview, isWidget, internal, valuesData, customSteps, ...others }: AppProps): JSX.Element;
|
|
31
|
+
declare function App({ apiKey, domain, preview, formData, postview, isWidget, internal, valuesData, customSteps, handleConfirmed, ...others }: AppProps): JSX.Element;
|
|
30
32
|
export default App;
|
|
31
33
|
export declare enum SIZES {
|
|
32
34
|
SMALL = "SMALL",
|
package/dist/App.js
CHANGED
|
@@ -67,7 +67,7 @@ import StepTypes from './constants/FormStepTypes';
|
|
|
67
67
|
import axiosInstance from './AxiosAPI';
|
|
68
68
|
function App(_a) {
|
|
69
69
|
var _this = this;
|
|
70
|
-
var apiKey = _a.apiKey, domain = _a.domain, preview = _a.preview, formData = _a.formData, postview = _a.postview, isWidget = _a.isWidget, internal = _a.internal, valuesData = _a.valuesData, customSteps = _a.customSteps, others = __rest(_a, ["apiKey", "domain", "preview", "formData", "postview", "isWidget", "internal", "valuesData", "customSteps"]);
|
|
70
|
+
var apiKey = _a.apiKey, domain = _a.domain, preview = _a.preview, formData = _a.formData, postview = _a.postview, isWidget = _a.isWidget, internal = _a.internal, valuesData = _a.valuesData, customSteps = _a.customSteps, handleConfirmed = _a.handleConfirmed, others = __rest(_a, ["apiKey", "domain", "preview", "formData", "postview", "isWidget", "internal", "valuesData", "customSteps", "handleConfirmed"]);
|
|
71
71
|
var _b = useState(undefined), form = _b[0], setForm = _b[1];
|
|
72
72
|
var _c = useState({}), originalValues = _c[0], setOriginalValues = _c[1];
|
|
73
73
|
var _d = useState(undefined), organizationInfo = _d[0], setOrganizationInfo = _d[1];
|
|
@@ -211,6 +211,9 @@ function App(_a) {
|
|
|
211
211
|
setTimeout(function () {
|
|
212
212
|
setForm(tempForm);
|
|
213
213
|
}, 100);
|
|
214
|
+
if (handleConfirmed) {
|
|
215
|
+
handleConfirmed();
|
|
216
|
+
}
|
|
214
217
|
}, postview: postview === true, internal: internal === true, apiKey: apiKey, domain: domain, originalValues: originalValues, containerRef: containerRef, organization: organizationInfo, customSteps: customSteps !== null && customSteps !== void 0 ? customSteps : {} }), void 0) }), void 0));
|
|
215
218
|
}
|
|
216
219
|
}
|
|
@@ -32,6 +32,21 @@ import DateFnsUtils from '@date-io/date-fns';
|
|
|
32
32
|
import { createGenerateClassName, createTheme, StylesProvider, ThemeProvider, } from '@material-ui/core';
|
|
33
33
|
import { SEED } from '../../constants/MaterialClassNameSeed';
|
|
34
34
|
import InternalFormStyle from '../../constants/InternalFormStyle';
|
|
35
|
+
import enLocale from 'date-fns/locale/en-US';
|
|
36
|
+
import esLocale from 'date-fns/locale/es';
|
|
37
|
+
var localeMap = {
|
|
38
|
+
en: enLocale,
|
|
39
|
+
'en-US': enLocale,
|
|
40
|
+
es: esLocale,
|
|
41
|
+
};
|
|
42
|
+
var getNavigatorLanguage = function () {
|
|
43
|
+
return navigator.languages && navigator.languages.length
|
|
44
|
+
? navigator.languages[0]
|
|
45
|
+
: navigator.userLanguage ||
|
|
46
|
+
navigator.language ||
|
|
47
|
+
navigator.browserLanguage ||
|
|
48
|
+
'es';
|
|
49
|
+
};
|
|
35
50
|
var blockSize = 210;
|
|
36
51
|
var spacingSize = 20;
|
|
37
52
|
var blockNum = 4;
|
|
@@ -93,6 +108,7 @@ var generateClassName = createGenerateClassName({
|
|
|
93
108
|
productionPrefix: 'efjss',
|
|
94
109
|
});
|
|
95
110
|
function FormTypeComponent(_a) {
|
|
111
|
+
var _b;
|
|
96
112
|
var props = __rest(_a, []);
|
|
97
113
|
var renderTypes = function () {
|
|
98
114
|
switch (props.form.type) {
|
|
@@ -109,7 +125,7 @@ function FormTypeComponent(_a) {
|
|
|
109
125
|
};
|
|
110
126
|
switch (props.formStyle.type) {
|
|
111
127
|
case FormStyleTypes.MATERIAL:
|
|
112
|
-
return (_jsx(StylesProvider, __assign({ generateClassName: generateClassName }, { children: _jsx(ThemeProvider, __assign({ theme: muiTheme }, { children: _jsx(MuiPickersUtilsProvider, __assign({ utils: DateFnsUtils }, { children: renderTypes() }), void 0) }), void 0) }), void 0));
|
|
128
|
+
return (_jsx(StylesProvider, __assign({ generateClassName: generateClassName }, { children: _jsx(ThemeProvider, __assign({ theme: muiTheme }, { children: _jsx(MuiPickersUtilsProvider, __assign({ utils: DateFnsUtils, locale: (_b = localeMap[getNavigatorLanguage()]) !== null && _b !== void 0 ? _b : localeMap.es }, { children: renderTypes() }), void 0) }), void 0) }), void 0));
|
|
113
129
|
default:
|
|
114
130
|
return renderTypes();
|
|
115
131
|
}
|
|
@@ -36,7 +36,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
36
36
|
return t;
|
|
37
37
|
};
|
|
38
38
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
39
|
-
import React from 'react';
|
|
39
|
+
import React, { cloneElement } from 'react';
|
|
40
40
|
import { makeStyles } from '@material-ui/core/styles';
|
|
41
41
|
import CalendarTodayRoundedIcon from '@material-ui/icons/CalendarTodayRounded';
|
|
42
42
|
import { KeyboardDatePicker, } from '@material-ui/pickers';
|
|
@@ -158,7 +158,7 @@ var useDatePickerDialogStyles = function (props) {
|
|
|
158
158
|
}); });
|
|
159
159
|
};
|
|
160
160
|
function CustomDatePicker(_a) {
|
|
161
|
-
var _b = _a.focusColor, focusColor = _b === void 0 ? '#3d5a7f' : _b, _c = _a.outlineColor, outlineColor = _c === void 0 ? '#0000003b' : _c, _d = _a.backgroundColor, backgroundColor = _d === void 0 ? 'white' : _d, innerBackgroundColor = _a.innerBackgroundColor, _e = _a.textColor, textColor = _e === void 0 ? '#293241' : _e, _f = _a.errorColor, errorColor = _f === void 0 ? '#cc2936' : _f, _g = _a.borderRadius, borderRadius = _g === void 0 ? 10 : _g, _h = _a.padding, padding = _h === void 0 ? '6px 12px' : _h, _j = _a.fontSize, fontSize = _j === void 0 ? '1rem' : _j, _k = _a.shrunkenFontSize, shrunkenFontSize = _k === void 0 ? '1rem' : _k, _l = _a.fontWeight, fontWeight = _l === void 0 ? '300' : _l, _m = _a.showIcon, showIcon = _m === void 0 ? true : _m, _o = _a.cantEdit, cantEdit = _o === void 0 ? false : _o, required = _a.required, others = __rest(_a, ["focusColor", "outlineColor", "backgroundColor", "innerBackgroundColor", "textColor", "errorColor", "borderRadius", "padding", "fontSize", "shrunkenFontSize", "fontWeight", "showIcon", "cantEdit", "required"]);
|
|
161
|
+
var _b = _a.focusColor, focusColor = _b === void 0 ? '#3d5a7f' : _b, _c = _a.outlineColor, outlineColor = _c === void 0 ? '#0000003b' : _c, _d = _a.backgroundColor, backgroundColor = _d === void 0 ? 'white' : _d, innerBackgroundColor = _a.innerBackgroundColor, _e = _a.textColor, textColor = _e === void 0 ? '#293241' : _e, _f = _a.errorColor, errorColor = _f === void 0 ? '#cc2936' : _f, _g = _a.borderRadius, borderRadius = _g === void 0 ? 10 : _g, _h = _a.padding, padding = _h === void 0 ? '6px 12px' : _h, _j = _a.fontSize, fontSize = _j === void 0 ? '1rem' : _j, _k = _a.shrunkenFontSize, shrunkenFontSize = _k === void 0 ? '1rem' : _k, _l = _a.fontWeight, fontWeight = _l === void 0 ? '300' : _l, _m = _a.showIcon, showIcon = _m === void 0 ? true : _m, _o = _a.cantEdit, cantEdit = _o === void 0 ? false : _o, onChange = _a.onChange, required = _a.required, others = __rest(_a, ["focusColor", "outlineColor", "backgroundColor", "innerBackgroundColor", "textColor", "errorColor", "borderRadius", "padding", "fontSize", "shrunkenFontSize", "fontWeight", "showIcon", "cantEdit", "onChange", "required"]);
|
|
162
162
|
var classes = useDatePickerStyles({
|
|
163
163
|
padding: padding,
|
|
164
164
|
cantEdit: cantEdit,
|
|
@@ -217,10 +217,10 @@ function CustomDatePicker(_a) {
|
|
|
217
217
|
shrunkenFontSize: shrunkenFontSize,
|
|
218
218
|
fontWeight: fontWeight,
|
|
219
219
|
})();
|
|
220
|
-
return (_jsx(KeyboardDatePicker, __assign({}, others, { inputVariant: "outlined", size: "small", disabled: cantEdit, fullWidth: true, placeholder: "
|
|
220
|
+
return (_jsx(KeyboardDatePicker, __assign({}, others, { inputVariant: "outlined", size: "small", disabled: cantEdit, fullWidth: true, onChange: onChange, placeholder: "PPP", format: "PPP", required: required, keyboardIcon: showIcon ? (_jsx(CalendarTodayRoundedIcon, { fontSize: "inherit" }, void 0)) : null, InputLabelProps: { classes: labelClasses }, DialogProps: {
|
|
221
221
|
disableEnforceFocus: true,
|
|
222
222
|
className: datePicker,
|
|
223
|
-
cancelLabel: '
|
|
223
|
+
cancelLabel: '',
|
|
224
224
|
} //Fixes the typescript declaration of the library: https://material-ui-pickers.dev/api/KeyboardDatePicker
|
|
225
225
|
, InputProps: {
|
|
226
226
|
required: required,
|
|
@@ -228,6 +228,13 @@ function CustomDatePicker(_a) {
|
|
|
228
228
|
disabled: cantEdit,
|
|
229
229
|
}, FormHelperTextProps: {
|
|
230
230
|
classes: helperTextStyles,
|
|
231
|
+
}, renderDay: function (day, selectedDate, dayInCurrentMonth, dayComponent) {
|
|
232
|
+
if (!day) {
|
|
233
|
+
return dayComponent;
|
|
234
|
+
}
|
|
235
|
+
return (_jsx("div", __assign({ onClick: function () {
|
|
236
|
+
onChange(day);
|
|
237
|
+
} }, { children: cloneElement(dayComponent) }), void 0));
|
|
231
238
|
}, variant: "dialog" }), void 0));
|
|
232
239
|
}
|
|
233
240
|
/**
|
package/package.json
CHANGED