x25 17.2.23 → 17.2.26

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.
@@ -3,7 +3,7 @@ declare type LoadingPropTypes = {
3
3
  readonly error?: any;
4
4
  readonly timedOut: boolean;
5
5
  readonly pastDelay: boolean;
6
- readonly retry: () => void;
6
+ readonly retry: () => any;
7
7
  };
8
- declare const RouteLoading: ({ error, retry, timedOut, }: LoadingPropTypes) => JSX.Element;
8
+ declare const RouteLoading: ({ error: theError, retry, pastDelay, timedOut }: LoadingPropTypes) => JSX.Element | null;
9
9
  export default RouteLoading;
@@ -4,37 +4,54 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var react_1 = __importDefault(require("react"));
7
+ var TheError_1 = __importDefault(require("../dev/TheError"));
8
+ var Error_1 = require("../Messages/Error");
7
9
  var Loading_1 = require("../Messages/Loading");
8
10
  var utility_1 = require("../utility");
9
- var index_1 = require("./index");
10
- var
11
- // type FireErrorPropTypes = {
12
- // error: any;
13
- // };
14
- // import SimulatedException from "./SimulatedException";
15
- // IgnoreThisNode = ({
16
- // error: {
17
- // message,
18
- // stack,
19
- // },
20
- // }: FireErrorPropTypes) => {
21
- // throw new SimulatedException(message, stack);
22
- // },
23
- // <ErrorBoundary>
24
- // <IgnoreThisNode error={error} />
25
- // </ErrorBoundary>
26
- RouteLoading = function (_a) {
27
- var error = _a.error, retry = _a.retry, timedOut = _a.timedOut;
28
- if (error) {
29
- return (react_1.default.createElement(index_1.ErrorBoundary, null));
11
+ var SimulatedException_1 = __importDefault(require("./SimulatedException"));
12
+ var RouteLoading = function (_a) {
13
+ var theError = _a.error, retry = _a.retry, pastDelay = _a.pastDelay, timedOut = _a.timedOut;
14
+ if (theError) {
15
+ if (theError.name === "ChunkLoadError") {
16
+ return (react_1.default.createElement(Error_1.LargeErrorMessage, { message: utility_1.words.ThereWasAProblem, onRetry: retry }));
17
+ }
18
+ // eslint-disable-next-line no-undef
19
+ if (process.env.NODE_ENV === "development") {
20
+ return (react_1.default.createElement(TheError_1.default, { error: theError, refresh: retry }));
21
+ }
22
+ throw new SimulatedException_1.default(theError);
30
23
  }
31
- if (timedOut) {
24
+ else if (timedOut) {
32
25
  return (react_1.default.createElement("div", null,
33
26
  utility_1.words.ItLoadsSlower,
34
27
  react_1.default.createElement("button", { className: "btn btn-primary btn-block", onClick: retry, type: "button" }, utility_1.words.TryAgain)));
35
28
  }
36
- return (react_1.default.createElement("div", { className: "mt-3" },
37
- react_1.default.createElement(Loading_1.LoadingMessage, { message: utility_1.words.PleaseWait })));
29
+ else if (pastDelay) {
30
+ // When the loader has taken longer than the delay
31
+ return (react_1.default.createElement("div", { className: "mt-3" },
32
+ react_1.default.createElement(Loading_1.LoadingMessage, { message: utility_1.words.PleaseWait })));
33
+ }
34
+ // When the loader has just started
35
+ return null;
36
+ // if (error) {
37
+ // return (
38
+ // <ErrorBoundary />
39
+ // );
40
+ // }
41
+ // if (timedOut) {
42
+ // return (
43
+ // <div>{words.ItLoadsSlower}
44
+ // <button className="btn btn-primary btn-block" onClick={retry} type="button">
45
+ // {words.TryAgain}
46
+ // </button>
47
+ // </div>
48
+ // );
49
+ // }
50
+ // return (
51
+ // <div className="mt-3">
52
+ // <LoadingMessage message={words.PleaseWait} />
53
+ // </div>
54
+ // )
38
55
  };
39
56
  exports.default = RouteLoading;
40
57
  //# sourceMappingURL=RouteLoading.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RouteLoading.js","sourceRoot":"","sources":["../../src/Async/RouteLoading.tsx"],"names":[],"mappings":";;;;;AAMA,gDAA0B;AAC1B,+CAAqD;AACrD,sCAAmC;AACnC,iCAAwC;AAExC;AAEE,8BAA8B;AAC9B,gBAAgB;AAChB,KAAK;AACL,yDAAyD;AACzD,sBAAsB;AACtB,eAAe;AACf,iBAAiB;AACjB,eAAe;AACf,SAAS;AACT,gCAAgC;AAChC,oDAAoD;A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AC;SACH;QAED,MAAM,IAAI,4BAAkB,CAAC,QAAQ,CAAC,CAAC;KACxC;SAAM,IAAI,QAAQ,EAAE;QACnB,OAAO,CACL;YAAM,eAAK,CAAC,aAAa;YACvB,0CACE,SAAS,EAAC,2BAA2B,EACrC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAC,QAAQ,IAAE,eAAK,CAAC,QAAQ,CACtC,CACL,CACP,CAAC;KACH;SAAM,IAAI,SAAS,EAAE;QACpB,kDAAkD;QAClD,OAAO,CACL,uCAAK,SAAS,EAAC,MAAM;YACnB,8BAAC,wBAAc,IAAC,OAAO,EAAE,eAAK,CAAC,UAAU,GAAI,CACzC,CACP,CAAC;KACH;IAED,mCAAmC;IACnC,OAAO,IAAI,CAAC;IAEZ,eAAe;IACf,aAAa;IACb,wBAAwB;IACxB,OAAO;IACP,IAAI;IAEJ,kBAAkB;IAClB,aAAa;IACb,iCAAiC;IACjC,qFAAqF;IACrF,2BAA2B;IAC3B,kBAAkB;IAClB,aAAa;IACb,OAAO;IACP,IAAI;IAEJ,WAAW;IACX,2BAA2B;IAC3B,oDAAoD;IACpD,WAAW;IACX,MAAM;AACR,CAAC,CAAC;AAEJ,kBAAe,YAAY,CAAC"}
@@ -1,8 +1,6 @@
1
- declare class CustomError<Message extends string, Stack extends string> extends Error {
2
- constructor(message: Message, stack: Stack);
1
+ declare class CustomError extends Error {
2
+ constructor(theError: any);
3
3
  }
4
- declare type Message = string;
5
- declare type Stack = string;
6
- declare class SimulatedException extends CustomError<Message, Stack> {
4
+ declare class SimulatedException extends CustomError {
7
5
  }
8
6
  export default SimulatedException;
@@ -18,11 +18,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  /* eslint-disable max-classes-per-file */
19
19
  var CustomError = /** @class */ (function (_super) {
20
20
  __extends(CustomError, _super);
21
- function CustomError(message, stack) {
22
- var _this = _super.call(this, message) || this;
23
- _this.message = message;
24
- _this.name = message;
25
- _this.stack = stack;
21
+ function CustomError(theError) {
22
+ var _this = _super.call(this, theError) || this;
23
+ _this.message = theError.message;
24
+ _this.name = theError.name;
25
+ _this.stack = theError.stack;
26
26
  return _this;
27
27
  }
28
28
  return CustomError;
@@ -1 +1 @@
1
- {"version":3,"file":"SimulatedException.js","sourceRoot":"","sources":["../../src/Async/SimulatedException.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yCAAyC;AACzC;IAAwE,+BAAK;IAC3E,qBAAa,OAAgB,EAAE,KAAY;QAA3C,YACE,kBAAM,OAAO,CAAC,SAIf;QAHC,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,KAAI,CAAC,IAAI,GAAG,OAAO,CAAC;QACpB,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;;IACrB,CAAC;IAEH,kBAAC;AAAD,CAAC,AARD,CAAwE,KAAK,GAQ5E;AAKD;IAAiC,sCAA2B;IAA5D;;IAA8D,CAAC;IAAD,yBAAC;AAAD,CAAC,AAA/D,CAAiC,WAAW,GAAmB;AAE/D,kBAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"SimulatedException.js","sourceRoot":"","sources":["../../src/Async/SimulatedException.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yCAAyC;AACzC;IAA0B,+BAAK;IAC7B,qBAAa,QAAc;QAA3B,YACE,kBAAM,QAAQ,CAAC,SAIhB;QAHC,KAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;QAChC,KAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;QAC1B,KAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;;IAC9B,CAAC;IAEH,kBAAC;AAAD,CAAC,AARD,CAA0B,KAAK,GAQ9B;AAGD;IAAiC,sCAAW;IAA5C;;IAA8C,CAAC;IAAD,yBAAC;AAAD,CAAC,AAA/C,CAAiC,WAAW,GAAG;AAE/C,kBAAe,kBAAkB,CAAC"}
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare type DateInputPropTypes = {
2
3
  readonly customClass?: any;
3
4
  readonly input: any;
@@ -16,21 +17,5 @@ declare type DateInputPropTypes = {
16
17
  readonly onChange?: (event: any) => void;
17
18
  readonly onRegisterRef?: (callback: (node: any) => void) => void;
18
19
  };
19
- declare type DateInputStateTypes = {
20
- value: string;
21
- };
22
- import React from "react";
23
- export declare class DateInput extends React.Component<DateInputPropTypes, DateInputStateTypes> {
24
- static defaultProps: {
25
- formatValue: (raw: string) => string;
26
- normalizeValue: (raw: string) => string;
27
- };
28
- state: DateInputStateTypes;
29
- handleBlur: () => void;
30
- handleKeyDown: (event: any) => void;
31
- handleChange: ({ target: { value } }: any) => void;
32
- UNSAFE_componentWillReceiveProps(nextProps: DateInputPropTypes): void;
33
- constructor(props: DateInputPropTypes);
34
- render(): JSX.Element;
35
- }
20
+ export declare const DateInput: (props: DateInputPropTypes) => JSX.Element;
36
21
  export {};
@@ -1,20 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable react/no-unsafe */
3
- var __extends = (this && this.__extends) || (function () {
4
- var extendStatics = function (d, b) {
5
- extendStatics = Object.setPrototypeOf ||
6
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
8
- return extendStatics(d, b);
9
- };
10
- return function (d, b) {
11
- if (typeof b !== "function" && b !== null)
12
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
13
- extendStatics(d, b);
14
- function __() { this.constructor = d; }
15
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
16
- };
17
- })();
18
2
  var __assign = (this && this.__assign) || function () {
19
3
  __assign = Object.assign || function(t) {
20
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -34,82 +18,47 @@ exports.DateInput = void 0;
34
18
  var react_1 = __importDefault(require("react"));
35
19
  var classnames_1 = __importDefault(require("classnames"));
36
20
  var utility_1 = require("../utility");
37
- var normalizeRawDate = function (raw) {
38
- /* eslint-disable no-magic-numbers */
39
- if ((0, utility_1.isValidDate)(raw)) {
40
- return (0, utility_1.normalizeDate)(raw);
21
+ var validation_1 = require("../utility/validation");
22
+ var addZeroIfNeeded = function (raw) {
23
+ var nrOfElements = 3, canAddZero = ((typeof raw === "string") &&
24
+ (raw.split(".").length === nrOfElements));
25
+ if (!canAddZero) {
26
+ return raw;
27
+ }
28
+ var perform = function (value) { return (value.length === 1 ? "0".concat(value) : value); }, parts = raw.split("."), part1 = perform(parts[0]), part2 = perform(parts[1]), part3 = parts[2], newValue = [part1, part2, part3].join(".");
29
+ if ((0, validation_1.isValidDate)(newValue)) {
30
+ return newValue;
41
31
  }
42
32
  return raw;
33
+ }, normalizeRawDate = function (raw) {
34
+ if ((0, validation_1.isValidDate)(raw)) {
35
+ return (0, utility_1.normalizeDate)(raw);
36
+ }
37
+ return "";
43
38
  }, formatRawDate = function (raw) {
44
- /* eslint-disable no-magic-numbers */
45
39
  if (typeof raw !== "undefined") {
46
40
  return (0, utility_1.formatDate)(raw);
47
41
  }
48
42
  return "";
49
43
  };
50
- var DateInput = /** @class */ (function (_super) {
51
- __extends(DateInput, _super);
52
- function DateInput(props) {
53
- var _this = _super.call(this, props) || this;
54
- _this.state = {
55
- value: formatRawDate(props.input.value),
56
- };
57
- _this.handleKeyDown = function (event) {
58
- if (event.key === "Enter") {
59
- _this.handleBlur();
60
- }
61
- };
62
- _this.handleBlur = function () {
63
- var onBlur = _this.props.input.onBlur, _a = _this.props, input = _a.input, normalizeValue = _a.normalizeValue, currentValue = _this.state.value, normalizedValue = normalizeValue(currentValue), shouldRenderAgain = normalizedValue !== "" && currentValue !== normalizedValue;
64
- input.onChange(normalizedValue);
65
- /*
66
- * Swallow the event to prevent Redux Form from
67
- * extracting the form value
68
- */
69
- onBlur();
70
- if (shouldRenderAgain) {
71
- _this.setState({
72
- value: (0, utility_1.formatDate)(normalizedValue),
73
- });
74
- }
75
- };
76
- _this.handleChange = function (_a) {
77
- var value = _a.target.value;
78
- _this.props.input.onChange();
79
- /*
80
- * Update the internal state to trigger a re-render
81
- * using the formatted value
82
- */
83
- _this.setState({
84
- value: value,
85
- });
86
- };
87
- return _this;
88
- }
89
- DateInput.prototype.UNSAFE_componentWillReceiveProps = function (nextProps) {
90
- var newValue = nextProps.input.value, currentValue = this.state.value, shouldRenderAgain = (0, utility_1.isValidDate)(newValue) && currentValue !== newValue;
91
- if (newValue === "") {
92
- this.setState({
93
- value: "",
94
- });
95
- }
96
- if (shouldRenderAgain) {
97
- this.setState({
98
- value: (0, utility_1.formatDate)(newValue),
99
- });
44
+ var DateInput = function (props) {
45
+ var customClass = props.customClass, input = props.input, onRegisterRef = props.onRegisterRef, tabIndex = props.tabIndex, placeholder = props.placeholder, _a = props.meta, submitting = _a.submitting, touched = _a.touched, error = _a.error, _b = react_1.default.useState(input.value), value = _b[0], setValue = _b[1], valueToShow = formatRawDate(value), updateValue = function (targetValue) {
46
+ var normalizedValue = normalizeRawDate(addZeroIfNeeded(targetValue));
47
+ setValue(targetValue);
48
+ props.input.onChange(normalizedValue);
49
+ }, handleBlur = function (_a) {
50
+ var targetValue = _a.target.value;
51
+ var newValue = addZeroIfNeeded(targetValue), hasChanged = targetValue !== newValue;
52
+ if (hasChanged) {
53
+ updateValue(newValue);
100
54
  }
55
+ }, handleChange = function (_a) {
56
+ var targetValue = _a.target.value;
57
+ updateValue(targetValue);
101
58
  };
102
- DateInput.prototype.render = function () {
103
- var _a = this.props, customClass = _a.customClass, input = _a.input, onRegisterRef = _a.onRegisterRef, _b = _a.meta, submitting = _b.submitting, touched = _b.touched, error = _b.error, tabIndex = _a.tabIndex, formatValue = _a.formatValue, placeholder = _a.placeholder;
104
- return (react_1.default.createElement("input", __assign({}, input, { className: (0, classnames_1.default)("form-control ".concat(customClass || ""), {
105
- "is-invalid": touched && error,
106
- }), disabled: submitting, id: input.name, onBlur: this.handleBlur, onChange: this.handleChange, onKeyDown: this.handleKeyDown, placeholder: placeholder || utility_1.words.DateFormat, ref: onRegisterRef, tabIndex: tabIndex, type: "text", value: formatValue(this.state.value) })));
107
- };
108
- DateInput.defaultProps = {
109
- formatValue: formatRawDate,
110
- normalizeValue: normalizeRawDate,
111
- };
112
- return DateInput;
113
- }(react_1.default.Component));
59
+ return (react_1.default.createElement("input", __assign({}, input, { className: (0, classnames_1.default)("form-control ".concat(customClass || ""), {
60
+ "is-invalid": touched && error,
61
+ }), disabled: submitting, id: input.name, onBlur: handleBlur, onChange: handleChange, placeholder: placeholder || utility_1.words.DateFormat, ref: onRegisterRef, tabIndex: tabIndex, type: "text", value: valueToShow })));
62
+ };
114
63
  exports.DateInput = DateInput;
115
64
  //# sourceMappingURL=DateInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateInput.js","sourceRoot":"","sources":["../../src/Inputs/DateInput.tsx"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBpC,gDAA0B;AAC1B,0DAAoC;AACpC,sCAA2E;AAG3E,IAAM,gBAAgB,GAAG,UAAC,GAAW;IACnC,qCAAqC;IACnC,IAAI,IAAA,qBAAW,EAAC,GAAG,CAAC,EAAE;QACpB,OAAO,IAAA,uBAAa,EAAC,GAAG,CAAC,CAAC;KAC3B;IAED,OAAO,GAAG,CAAC;AACb,CAAC,EAED,aAAa,GAAG,UAAC,GAAW;IAC5B,qCAAqC;IACnC,IAAI,OAAO,GAAG,KAAK,WAAW,EAAE;QAC9B,OAAO,IAAA,oBAAU,EAAC,GAAG,CAAC,CAAC;KACxB;IAED,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEJ;IAA+B,6BAAwD;IAmCrF,mBAAa,KAAyB;QAAtC,YACE,kBAAM,KAAK,CAAC,SAuDb;QAtDC,KAAI,CAAC,KAAK,GAAG;YACX,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;SACxC,CAAC;QAEF,KAAI,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EAAE,WAAW,IAAI,eAAK,CAAC,UAAU,EAC5C,GAAG,EAAE,aAAa,EAClB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,WAAW,IAClB,CACH,CAAC;AACJ,CAAC,CAAC;AAlDW,QAAA,SAAS,aAkDpB"}
@@ -1,14 +1,12 @@
1
- declare type DateTemplatePropTypes = {
1
+ /// <reference types="react" />
2
+ declare type DateInputPropTypes = {
2
3
  readonly customClass?: any;
3
4
  readonly input: any;
4
- readonly label?: string;
5
5
  readonly meta: {
6
6
  error?: string;
7
7
  submitting: boolean;
8
8
  touched: boolean;
9
9
  };
10
- readonly left?: string;
11
- readonly right?: string;
12
10
  readonly placeholder?: string;
13
11
  readonly value?: string;
14
12
  readonly tabIndex?: string;
@@ -18,22 +16,9 @@ declare type DateTemplatePropTypes = {
18
16
  readonly onBlur?: () => void;
19
17
  readonly onChange?: (event: any) => void;
20
18
  readonly onRegisterRef?: (callback: (node: any) => void) => void;
19
+ right?: string;
20
+ left?: string;
21
+ label: string;
21
22
  };
22
- declare type DateTemplateStateTypes = {
23
- value: string;
24
- };
25
- import React from "react";
26
- export declare class DateTemplate extends React.Component<DateTemplatePropTypes, DateTemplateStateTypes> {
27
- static defaultProps: {
28
- formatValue: (raw: string) => string;
29
- normalizeValue: (raw: string) => string;
30
- };
31
- state: DateTemplateStateTypes;
32
- handleBlur: () => void;
33
- handleKeyDown: (event: any) => void;
34
- handleChange: ({ target: { value } }: any) => void;
35
- UNSAFE_componentWillReceiveProps(nextProps: DateTemplatePropTypes): void;
36
- constructor(props: DateTemplatePropTypes);
37
- render(): JSX.Element;
38
- }
23
+ export declare const DateTemplate: (props: DateInputPropTypes) => JSX.Element;
39
24
  export {};
@@ -1,20 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable react/no-unsafe */
3
- var __extends = (this && this.__extends) || (function () {
4
- var extendStatics = function (d, b) {
5
- extendStatics = Object.setPrototypeOf ||
6
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
8
- return extendStatics(d, b);
9
- };
10
- return function (d, b) {
11
- if (typeof b !== "function" && b !== null)
12
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
13
- extendStatics(d, b);
14
- function __() { this.constructor = d; }
15
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
16
- };
17
- })();
18
2
  var __assign = (this && this.__assign) || function () {
19
3
  __assign = Object.assign || function(t) {
20
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -34,88 +18,51 @@ exports.DateTemplate = void 0;
34
18
  var react_1 = __importDefault(require("react"));
35
19
  var classnames_1 = __importDefault(require("classnames"));
36
20
  var utility_1 = require("../utility");
37
- var normalizeRawDate = function (raw) {
38
- /* eslint-disable no-magic-numbers */
39
- if ((0, utility_1.isValidDate)(raw)) {
40
- return (0, utility_1.normalizeDate)(raw);
21
+ var validation_1 = require("../utility/validation");
22
+ var addZeroIfNeeded = function (raw) {
23
+ var nrOfElements = 3, canAddZero = ((typeof raw === "string") &&
24
+ (raw.split(".").length === nrOfElements));
25
+ if (!canAddZero) {
26
+ return raw;
27
+ }
28
+ var perform = function (value) { return (value.length === 1 ? "0".concat(value) : value); }, parts = raw.split("."), part1 = perform(parts[0]), part2 = perform(parts[1]), part3 = parts[2], newValue = [part1, part2, part3].join(".");
29
+ if ((0, validation_1.isValidDate)(newValue)) {
30
+ return newValue;
41
31
  }
42
32
  return raw;
33
+ }, normalizeRawDate = function (raw) {
34
+ if ((0, validation_1.isValidDate)(raw)) {
35
+ return (0, utility_1.normalizeDate)(raw);
36
+ }
37
+ return "";
43
38
  }, formatRawDate = function (raw) {
44
- /* eslint-disable no-magic-numbers */
45
39
  if (typeof raw !== "undefined") {
46
40
  return (0, utility_1.formatDate)(raw);
47
41
  }
48
42
  return "";
49
43
  };
50
- var DateTemplate = /** @class */ (function (_super) {
51
- __extends(DateTemplate, _super);
52
- function DateTemplate(props) {
53
- var _this = _super.call(this, props) || this;
54
- _this.state = {
55
- value: formatRawDate(props.input.value),
56
- };
57
- _this.handleKeyDown = function (event) {
58
- if (event.key === "Enter") {
59
- _this.handleBlur();
60
- }
61
- };
62
- _this.handleBlur = function () {
63
- var onBlur = _this.props.input.onBlur, _a = _this.props, input = _a.input, normalizeValue = _a.normalizeValue, currentValue = _this.state.value, normalizedValue = normalizeValue(currentValue), shouldRenderAgain = normalizedValue !== "" && currentValue !== normalizedValue;
64
- input.onChange(normalizedValue);
65
- /*
66
- * Swallow the event to prevent Redux Form from
67
- * extracting the form value
68
- */
69
- onBlur();
70
- if (shouldRenderAgain) {
71
- _this.setState({
72
- value: (0, utility_1.formatDate)(normalizedValue),
73
- });
74
- }
75
- };
76
- _this.handleChange = function (_a) {
77
- var value = _a.target.value;
78
- _this.props.input.onChange();
79
- /*
80
- * Update the internal state to trigger a re-render
81
- * using the formatted value
82
- */
83
- _this.setState({
84
- value: value,
85
- });
86
- };
87
- return _this;
88
- }
89
- DateTemplate.prototype.UNSAFE_componentWillReceiveProps = function (nextProps) {
90
- var newValue = nextProps.input.value, currentValue = this.state.value, shouldRenderAgain = (0, utility_1.isValidDate)(newValue) && currentValue !== newValue;
91
- if (newValue === "") {
92
- this.setState({
93
- value: "",
94
- });
95
- }
96
- if (shouldRenderAgain) {
97
- this.setState({
98
- value: (0, utility_1.formatDate)(newValue),
99
- });
44
+ var DateTemplate = function (props) {
45
+ var customClass = props.customClass, input = props.input, onRegisterRef = props.onRegisterRef, tabIndex = props.tabIndex, placeholder = props.placeholder, _a = props.meta, submitting = _a.submitting, touched = _a.touched, error = _a.error, right = props.right, left = props.left, label = props.label, _b = react_1.default.useState(input.value), value = _b[0], setValue = _b[1], valueToShow = formatRawDate(value), updateValue = function (targetValue) {
46
+ var normalizedValue = normalizeRawDate(addZeroIfNeeded(targetValue));
47
+ setValue(targetValue);
48
+ props.input.onChange(normalizedValue);
49
+ }, handleBlur = function (_a) {
50
+ var targetValue = _a.target.value;
51
+ var newValue = addZeroIfNeeded(targetValue), hasChanged = targetValue !== newValue;
52
+ if (hasChanged) {
53
+ updateValue(newValue);
100
54
  }
55
+ }, handleChange = function (_a) {
56
+ var targetValue = _a.target.value;
57
+ updateValue(targetValue);
101
58
  };
102
- DateTemplate.prototype.render = function () {
103
- var _a = this.props, customClass = _a.customClass, input = _a.input, label = _a.label, onRegisterRef = _a.onRegisterRef, _b = _a.meta, submitting = _b.submitting, touched = _b.touched, error = _b.error, left = _a.left, right = _a.right, tabIndex = _a.tabIndex, formatValue = _a.formatValue, placeholder = _a.placeholder;
104
- return (react_1.default.createElement("div", { className: (0, classnames_1.default)("form-group row", {
105
- "is-invalid": touched && error,
106
- }) },
107
- react_1.default.createElement("label", { className: "".concat(left ? left : "col-md-4 text-md-right", " form-control-label"), htmlFor: input.name }, label),
108
- react_1.default.createElement("div", { className: right ? right : "col-md-8" },
109
- react_1.default.createElement("input", __assign({}, input, { "aria-label": label, className: (0, classnames_1.default)("form-control ".concat(customClass || ""), {
110
- "is-invalid": touched && error,
111
- }), disabled: submitting, id: input.name, onBlur: this.handleBlur, onChange: this.handleChange, onKeyDown: this.handleKeyDown, placeholder: placeholder || utility_1.words.DateFormat, ref: onRegisterRef, tabIndex: tabIndex, type: "text", value: formatValue(this.state.value) })),
112
- react_1.default.createElement("div", { className: "invalid-feedback" }, touched && error && (react_1.default.createElement("span", null, error))))));
113
- };
114
- DateTemplate.defaultProps = {
115
- formatValue: formatRawDate,
116
- normalizeValue: normalizeRawDate,
117
- };
118
- return DateTemplate;
119
- }(react_1.default.Component));
59
+ return (react_1.default.createElement("div", { className: (0, classnames_1.default)("form-group row", { "is-invalid": touched && error }) },
60
+ react_1.default.createElement("label", { className: "".concat(left ? left : "col-md-4 text-md-right", " form-control-label"), htmlFor: input.name }, label),
61
+ react_1.default.createElement("div", { className: right ? right : "col-md-8" },
62
+ react_1.default.createElement("input", __assign({}, input, { "aria-label": label, className: (0, classnames_1.default)("form-control ".concat(customClass || ""), {
63
+ "is-invalid": touched && error,
64
+ }), disabled: submitting, id: input.name, onBlur: handleBlur, onChange: handleChange, placeholder: placeholder || utility_1.words.DateFormat, ref: onRegisterRef, tabIndex: tabIndex, type: "text", value: valueToShow })),
65
+ react_1.default.createElement("div", { className: "invalid-feedback" }, touched && error && (react_1.default.createElement("span", null, error))))));
66
+ };
120
67
  exports.DateTemplate = DateTemplate;
121
68
  //# sourceMappingURL=DateTemplate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateTemplate.js","sourceRoot":"","sources":["../../src/Inputs/DateTemplate.tsx"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BpC,gDAA0B;AAC1B,0DAAoC;AACpC,sCAA2E;AAG3E,IAAM,gBAAgB,GAAG,UAAC,GAAW;IACnC,qCAAqC;IACnC,IAAI,IAAA,qBAAW,EAAC,GAAG,CAAC,EAAE;QACpB,OAAO,IAAA,uBAAa,EAAC,GAAG,CAAC,CAAC;KAC3B;IAED,OAAO,GAAG,CAAC;AACb,CAAC,EAED,aAAa,GAAG,UAAC,GAAW;IAC5B,qCAAqC;IACnC,IAAI,OAAO,GAAG,KAAK,WAAW,EAAE;QAC9B,OAAO,IAAA,oBAAU,EAAC,GAAG,CAAC,CAAC;KACxB;IAED,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEJ;IAAkC,gCAA8D;IAoC9F,sBAAa,KAA4B;QAAzC,YACE,kBAAM,KAAK,CAAC,SAuDb;QAtDC,KAAI,CAAC,KAAK,GAAG;YACX,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;SACxC,CAAC;QAEF,KAAI,CAAC,aAAa,GAAG,UAAC,KAAU;YAC9B,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE;gBACzB,KAAI,CAAC,UAAU,EAAE,CAAC;aACnB;QACH,CA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AW,KAAK,QAAQ,CAAC;QAExC,IAAI,UAAU,EAAE;YACd,WAAW,CAAC,QAAQ,CAAC,CAAC;SACvB;IACH,CAAC,EAED,YAAY,GAAG,UAAC,EAAwC;YAApB,WAAW,kBAAA;QAC7C,WAAW,CAAC,WAAW,CAAC,CAAC;IAC3B,CAAC,CAAC;IAEJ,OAAO,CACL,uCACE,SAAS,EAAE,IAAA,oBAAU,EAAC,gBAAgB,EAAE,EAAE,YAAY,EAAE,OAAO,IAAI,KAAK,EAAE,CAAC;QAC3E,yCACE,SAAS,EAAE,UAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,wBAAwB,wBAAqB,EACzE,OAAO,EAAE,KAAK,CAAC,IAAI,IAClB,KAAK,CACA;QACR,uCAAK,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU;YACxC,oDACM,KAAK,kBACG,KAAK,EACjB,SAAS,EAAE,IAAA,oBAAU,EAAC,uBAAgB,WAAW,IAAI,EAAE,CAAE,EAAE;oBACzD,YAAY,EAAE,OAAO,IAAI,KAAK;iBAC/B,CAAC,EACF,QAAQ,EAAE,UAAU,EACpB,EAAE,EAAE,KAAK,CAAC,IAAI,EACd,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,WAAW,IAAI,eAAK,CAAC,UAAU,EAC5C,GAAG,EAAE,aAAa,EAClB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,WAAW,IAClB;YACF,uCACE,SAAS,EAAC,kBAAkB,IAC3B,OAAO,IAAI,KAAK,IAAI,CACnB,4CACG,KAAK,CACD,CACR,CACG,CACF,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AArEW,QAAA,YAAY,gBAqEvB"}
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ /// <reference types="react" />
2
2
  declare type TypeInputPropTypes = {
3
3
  readonly change: (event: any) => void;
4
4
  readonly value: any;
@@ -10,19 +10,5 @@ declare type TypeInputPropTypes = {
10
10
  readonly name?: string;
11
11
  readonly placeholder?: string;
12
12
  };
13
- declare type TypeInputStateTypes = {
14
- value: string;
15
- isWaiting: boolean;
16
- };
17
- export declare class DelayInputChange extends React.Component<TypeInputPropTypes, TypeInputStateTypes> {
18
- state: TypeInputStateTypes;
19
- timeout: any;
20
- delayChange: (event: any) => void;
21
- handleKeyPressed: (event: any) => void;
22
- stopWaiting: (value: string) => void;
23
- UNSAFE_componentWillReceiveProps(nextProps: TypeInputPropTypes): void;
24
- constructor(props: TypeInputPropTypes);
25
- shouldComponentUpdate(nextProps: TypeInputPropTypes, nextState: TypeInputStateTypes): boolean;
26
- render(): JSX.Element;
27
- }
13
+ export declare const DelayInputChange: (props: TypeInputPropTypes) => JSX.Element;
28
14
  export {};