@thx/controls 15.3.0 → 16.0.0-alpha.23
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/LICENSE +1 -1
- package/dist/esm/date/LocalDatePicker/LocalDatePicker.js +118 -0
- package/dist/esm/date/LocalDatePicker/MaskedDateInput.js +50 -0
- package/dist/esm/date/LocalMonthSelect/LocalMonthSelect.js +68 -0
- package/dist/esm/date/LocalTimePicker/LocalTimePicker.js +120 -0
- package/dist/esm/date/LocalTimePicker/MaskedTimeInput.js +46 -0
- package/dist/esm/date/MonthDayPicker/MonthDayPicker.js +130 -0
- package/dist/esm/date/MonthYearPicker/MonthYearPicker.js +119 -0
- package/dist/esm/date/YearSelect/YearSelect.js +87 -0
- package/dist/esm/form/TForm/TForm.js +28 -0
- package/dist/esm/form/TForm/useTForm.js +121 -0
- package/dist/esm/index.js +31 -0
- package/dist/esm/inputs/CreditCardInput/CreditCardInput.js +69 -0
- package/dist/esm/inputs/CreditCardInput/CreditCardNumberInput.js +105 -0
- package/dist/esm/inputs/MaskedInput/MaskedInput.js +45 -0
- package/dist/esm/inputs/MaskedInput/useMaskedInput.js +76 -0
- package/dist/esm/inputs/PhoneInput/PhoneInput.js +48 -0
- package/dist/esm/inputs/RadioGroup/RadioGroup.js +50 -0
- package/dist/esm/inputs/Scriptel/Scriptel.js +51 -0
- package/dist/esm/inputs/Scriptel/ScriptelContext.js +5 -0
- package/dist/esm/inputs/Scriptel/scriptel/enums.js +20 -0
- package/dist/esm/inputs/Scriptel/scriptel/index.js +92 -0
- package/dist/esm/inputs/Scriptel/withScriptel.js +25 -0
- package/dist/esm/inputs/ScriptelInput/ScriptelInput.js +69 -0
- package/dist/esm/inputs/SinInput/SinInput.js +83 -0
- package/dist/esm/inputs/TableInput/DropdownCell.js +54 -0
- package/dist/esm/inputs/TableInput/HoverCell.js +32 -0
- package/dist/esm/inputs/TableInput/MoneyCell.js +11 -0
- package/dist/esm/inputs/TableInput/MoneyEditCell.js +29 -0
- package/dist/esm/inputs/TableInput/MoneySumFooter.js +13 -0
- package/dist/esm/inputs/TableInput/StringEditCell.js +52 -0
- package/dist/esm/inputs/TableInput/TableInput.js +77 -0
- package/dist/esm/inputs/TableInput/addRowOnTab.js +12 -0
- package/dist/esm/money/MoneyCurrencyInput/MoneyCurrencyInput.js +80 -0
- package/dist/esm/money/MoneyInput/MoneyInput.js +56 -0
- package/dist/esm/money/useMoneyInput.js +76 -0
- package/dist/esm/step/FormStep.js +16 -0
- package/dist/esm/step/Step.js +8 -0
- package/dist/esm/step/StepProvider.js +114 -0
- package/dist/esm/step/stepContext.js +9 -0
- package/dist/esm/step/useStep.js +9 -0
- package/dist/{date → types/date}/DatePicker/index.d.ts +0 -0
- package/dist/{date → types/date}/LocalDatePicker/LocalDatePicker.d.ts +0 -0
- package/dist/{date → types/date}/LocalDatePicker/MaskedDateInput.d.ts +0 -0
- package/dist/{date → types/date}/LocalDatePicker/index.d.ts +0 -0
- package/dist/{date → types/date}/LocalMonthSelect/LocalMonthSelect.d.ts +0 -0
- package/dist/{date → types/date}/LocalMonthSelect/index.d.ts +0 -0
- package/dist/{date → types/date}/LocalTimePicker/LocalTimePicker.d.ts +0 -0
- package/dist/{date → types/date}/LocalTimePicker/MaskedTimeInput.d.ts +0 -0
- package/dist/{date → types/date}/LocalTimePicker/index.d.ts +0 -0
- package/dist/{date → types/date}/MonthDayPicker/MonthDayPicker.d.ts +0 -0
- package/dist/{date → types/date}/MonthDayPicker/index.d.ts +0 -0
- package/dist/{date → types/date}/MonthYearPicker/MonthYearPicker.d.ts +0 -0
- package/dist/{date → types/date}/MonthYearPicker/index.d.ts +0 -0
- package/dist/{date → types/date}/YearSelect/YearSelect.d.ts +0 -0
- package/dist/{date → types/date}/YearSelect/index.d.ts +0 -0
- package/dist/{form → types/form}/TForm/TForm.d.ts +0 -0
- package/dist/{form → types/form}/TForm/index.d.ts +0 -0
- package/dist/{form → types/form}/TForm/types.d.ts +0 -0
- package/dist/{form → types/form}/TForm/useTForm.d.ts +0 -0
- package/dist/{index.d.ts → types/index.d.ts} +2 -1
- package/dist/{inputs → types/inputs}/CreditCardInput/CreditCardInput.d.ts +0 -0
- package/dist/{inputs → types/inputs}/CreditCardInput/CreditCardNumberInput.d.ts +0 -0
- package/dist/{inputs → types/inputs}/CreditCardInput/index.d.ts +0 -0
- package/dist/{inputs → types/inputs}/MaskedInput/MaskedInput.d.ts +0 -0
- package/dist/{inputs → types/inputs}/MaskedInput/index.d.ts +0 -0
- package/dist/{inputs → types/inputs}/MaskedInput/useMaskedInput.d.ts +0 -0
- package/dist/{inputs → types/inputs}/PhoneInput/PhoneInput.d.ts +0 -0
- package/dist/{inputs → types/inputs}/PhoneInput/index.d.ts +0 -0
- package/dist/{inputs → types/inputs}/RadioGroup/RadioGroup.d.ts +0 -0
- package/dist/{inputs → types/inputs}/RadioGroup/index.d.ts +0 -0
- package/dist/{inputs → types/inputs}/Scriptel/Scriptel.d.ts +0 -0
- package/dist/{inputs → types/inputs}/Scriptel/ScriptelContext.d.ts +0 -0
- package/dist/{inputs → types/inputs}/Scriptel/index.d.ts +0 -0
- package/dist/{inputs → types/inputs}/Scriptel/scriptel/classes.d.ts +0 -0
- package/dist/{inputs → types/inputs}/Scriptel/scriptel/enums.d.ts +0 -0
- package/dist/{inputs → types/inputs}/Scriptel/scriptel/index.d.ts +0 -0
- package/dist/{inputs → types/inputs}/Scriptel/scriptel/messages.d.ts +0 -0
- package/dist/{inputs → types/inputs}/Scriptel/withScriptel.d.ts +0 -0
- package/dist/{inputs → types/inputs}/ScriptelInput/ScriptelInput.d.ts +0 -0
- package/dist/{inputs → types/inputs}/ScriptelInput/index.d.ts +0 -0
- package/dist/{inputs → types/inputs}/SinInput/SinInput.d.ts +0 -0
- package/dist/{inputs → types/inputs}/SinInput/index.d.ts +0 -0
- package/dist/{inputs → types/inputs}/TableInput/DropdownCell.d.ts +0 -0
- package/dist/{inputs → types/inputs}/TableInput/HoverCell.d.ts +0 -0
- package/dist/{inputs → types/inputs}/TableInput/MoneyCell.d.ts +0 -0
- package/dist/{inputs → types/inputs}/TableInput/MoneyEditCell.d.ts +0 -0
- package/dist/{inputs → types/inputs}/TableInput/MoneySumFooter.d.ts +0 -0
- package/dist/{inputs → types/inputs}/TableInput/StringEditCell.d.ts +0 -0
- package/dist/{inputs → types/inputs}/TableInput/TableInput.d.ts +0 -0
- package/dist/{inputs → types/inputs}/TableInput/addRowOnTab.d.ts +0 -0
- package/dist/{inputs → types/inputs}/TableInput/index.d.ts +0 -0
- package/dist/{money → types/money}/MoneyCurrencyInput/MoneyCurrencyInput.d.ts +0 -0
- package/dist/{money → types/money}/MoneyCurrencyInput/index.d.ts +0 -0
- package/dist/{money → types/money}/MoneyInput/MoneyInput.d.ts +0 -0
- package/dist/{money → types/money}/MoneyInput/index.d.ts +0 -0
- package/dist/{money → types/money}/useMoneyInput.d.ts +0 -0
- package/dist/{step → types/step}/FormStep.d.ts +0 -0
- package/dist/{step → types/step}/Step.d.ts +0 -0
- package/dist/{step → types/step}/StepProvider.d.ts +0 -0
- package/dist/{step → types/step}/index.d.ts +0 -0
- package/dist/{step → types/step}/stepContext.d.ts +0 -0
- package/dist/{step → types/step}/useStep.d.ts +0 -0
- package/package.json +25 -26
- package/dist/index.js +0 -5460
- package/dist/index.min.js +0 -2
- package/dist/index.min.js.map +0 -1
- package/index.js +0 -7
package/LICENSE
CHANGED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { toDate, toLocalDate } from '@thx/date';
|
|
2
|
+
import debug from 'debug';
|
|
3
|
+
import DatePicker from 'react-datepicker';
|
|
4
|
+
import { MaskedDateInput } from './MaskedDateInput.js';
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __defProps = Object.defineProperties;
|
|
8
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
9
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
debug("thx.controls.date.LocalDatePicker");
|
|
38
|
+
function LocalDatePicker(props) {
|
|
39
|
+
const _a = props, {
|
|
40
|
+
minDate,
|
|
41
|
+
maxDate,
|
|
42
|
+
value,
|
|
43
|
+
onChange,
|
|
44
|
+
onBlur,
|
|
45
|
+
as,
|
|
46
|
+
action,
|
|
47
|
+
actionPosition,
|
|
48
|
+
className,
|
|
49
|
+
error,
|
|
50
|
+
fluid,
|
|
51
|
+
focus,
|
|
52
|
+
icon,
|
|
53
|
+
iconPosition,
|
|
54
|
+
inverted,
|
|
55
|
+
label,
|
|
56
|
+
labelPosition,
|
|
57
|
+
loading,
|
|
58
|
+
size,
|
|
59
|
+
tabIndex,
|
|
60
|
+
transparent
|
|
61
|
+
} = _a, rest = __objRest(_a, [
|
|
62
|
+
"minDate",
|
|
63
|
+
"maxDate",
|
|
64
|
+
"value",
|
|
65
|
+
"onChange",
|
|
66
|
+
"onBlur",
|
|
67
|
+
"as",
|
|
68
|
+
"action",
|
|
69
|
+
"actionPosition",
|
|
70
|
+
"className",
|
|
71
|
+
"error",
|
|
72
|
+
"fluid",
|
|
73
|
+
"focus",
|
|
74
|
+
"icon",
|
|
75
|
+
"iconPosition",
|
|
76
|
+
"inverted",
|
|
77
|
+
"label",
|
|
78
|
+
"labelPosition",
|
|
79
|
+
"loading",
|
|
80
|
+
"size",
|
|
81
|
+
"tabIndex",
|
|
82
|
+
"transparent"
|
|
83
|
+
]);
|
|
84
|
+
const selected = value ? toDate(value) : null;
|
|
85
|
+
const inputProps = {
|
|
86
|
+
as,
|
|
87
|
+
action,
|
|
88
|
+
actionPosition,
|
|
89
|
+
className,
|
|
90
|
+
error,
|
|
91
|
+
fluid,
|
|
92
|
+
focus,
|
|
93
|
+
icon,
|
|
94
|
+
iconPosition,
|
|
95
|
+
inverted,
|
|
96
|
+
label,
|
|
97
|
+
labelPosition,
|
|
98
|
+
loading,
|
|
99
|
+
size,
|
|
100
|
+
tabIndex,
|
|
101
|
+
transparent
|
|
102
|
+
};
|
|
103
|
+
return /* @__PURE__ */ React.createElement(DatePicker, __spreadProps(__spreadValues({}, rest), {
|
|
104
|
+
selected,
|
|
105
|
+
onChange: (date) => {
|
|
106
|
+
if (onChange)
|
|
107
|
+
onChange(date ? toLocalDate(date) : null);
|
|
108
|
+
},
|
|
109
|
+
onBlur,
|
|
110
|
+
customInput: /* @__PURE__ */ React.createElement(MaskedDateInput, __spreadProps(__spreadValues({}, inputProps), {
|
|
111
|
+
onBlur
|
|
112
|
+
})),
|
|
113
|
+
minDate: minDate ? toDate(minDate) : null,
|
|
114
|
+
maxDate: maxDate ? toDate(maxDate) : null
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { LocalDatePicker };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import debug from 'debug';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { MaskedInput } from '../../inputs/MaskedInput/MaskedInput.js';
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __defProps = Object.defineProperties;
|
|
7
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __objRest = (source, exclude) => {
|
|
25
|
+
var target = {};
|
|
26
|
+
for (var prop in source)
|
|
27
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
if (source != null && __getOwnPropSymbols)
|
|
30
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
};
|
|
36
|
+
debug("thx.controls.date.LocalDatePicker.MaskedDateInput");
|
|
37
|
+
function MaskedDateInputInner(props, ref) {
|
|
38
|
+
const _a = props, { onChange, name } = _a, rest = __objRest(_a, ["onChange", "name"]);
|
|
39
|
+
return /* @__PURE__ */ React.createElement(MaskedInput, __spreadProps(__spreadValues({}, rest), {
|
|
40
|
+
name,
|
|
41
|
+
mask: { alias: "datetime", inputFormat: "mm/dd/yyyy" },
|
|
42
|
+
onChange: (value) => {
|
|
43
|
+
if (onChange)
|
|
44
|
+
onChange({ target: { value: value || "" } });
|
|
45
|
+
}
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
const MaskedDateInput = forwardRef(MaskedDateInputInner);
|
|
49
|
+
|
|
50
|
+
export { MaskedDateInput };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { LocalDate } from '@js-joda/core';
|
|
2
|
+
import debug from 'debug';
|
|
3
|
+
import { Select } from 'semantic-ui-react';
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
debug("thx.controls.date.LocalMonthSelect");
|
|
34
|
+
const monthOptions = [
|
|
35
|
+
{ text: "January", value: 1, key: 1 },
|
|
36
|
+
{ text: "February", value: 2, key: 2 },
|
|
37
|
+
{ text: "March", value: 3, key: 3 },
|
|
38
|
+
{ text: "April", value: 4, key: 4 },
|
|
39
|
+
{ text: "May", value: 5, key: 5 },
|
|
40
|
+
{ text: "June", value: 6, key: 6 },
|
|
41
|
+
{ text: "July", value: 7, key: 7 },
|
|
42
|
+
{ text: "August", value: 8, key: 8 },
|
|
43
|
+
{ text: "September", value: 9, key: 9 },
|
|
44
|
+
{ text: "October", value: 10, key: 10 },
|
|
45
|
+
{ text: "November", value: 11, key: 11 },
|
|
46
|
+
{ text: "December", value: 12, key: 12 }
|
|
47
|
+
];
|
|
48
|
+
function LocalMonthSelect(props) {
|
|
49
|
+
const _a = props, { value, onChange, year, handleBlur } = _a, rest = __objRest(_a, ["value", "onChange", "year", "handleBlur"]);
|
|
50
|
+
const theYear = year || LocalDate.now().year();
|
|
51
|
+
return /* @__PURE__ */ React.createElement(Select, __spreadValues({
|
|
52
|
+
placeholder: "Select Month",
|
|
53
|
+
options: monthOptions,
|
|
54
|
+
value: value ? value.monthValue() : "",
|
|
55
|
+
onChange: (ev, v) => {
|
|
56
|
+
if (onChange) {
|
|
57
|
+
if (typeof v.value === "number") {
|
|
58
|
+
onChange(v ? LocalDate.of(theYear, v.value, 1) : null);
|
|
59
|
+
} else {
|
|
60
|
+
onChange(null);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
onBlur: handleBlur
|
|
65
|
+
}, rest));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { LocalMonthSelect };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { LocalTime } from '@js-joda/core';
|
|
2
|
+
import { toDate, toLocalTime } from '@thx/date';
|
|
3
|
+
import debug from 'debug';
|
|
4
|
+
import DatePicker from 'react-datepicker';
|
|
5
|
+
import { MaskedTimeInput } from './MaskedTimeInput.js';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __defProps = Object.defineProperties;
|
|
9
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
10
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
13
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
+
var __spreadValues = (a, b) => {
|
|
15
|
+
for (var prop in b || (b = {}))
|
|
16
|
+
if (__hasOwnProp.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
if (__getOwnPropSymbols)
|
|
19
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
20
|
+
if (__propIsEnum.call(b, prop))
|
|
21
|
+
__defNormalProp(a, prop, b[prop]);
|
|
22
|
+
}
|
|
23
|
+
return a;
|
|
24
|
+
};
|
|
25
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
26
|
+
var __objRest = (source, exclude) => {
|
|
27
|
+
var target = {};
|
|
28
|
+
for (var prop in source)
|
|
29
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
30
|
+
target[prop] = source[prop];
|
|
31
|
+
if (source != null && __getOwnPropSymbols)
|
|
32
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
33
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
34
|
+
target[prop] = source[prop];
|
|
35
|
+
}
|
|
36
|
+
return target;
|
|
37
|
+
};
|
|
38
|
+
debug("thx.controls.date.LocalTimePicker");
|
|
39
|
+
function LocalTimePicker(props) {
|
|
40
|
+
const _a = props, {
|
|
41
|
+
value,
|
|
42
|
+
onChange,
|
|
43
|
+
as,
|
|
44
|
+
action,
|
|
45
|
+
actionPosition,
|
|
46
|
+
className,
|
|
47
|
+
disabled,
|
|
48
|
+
error,
|
|
49
|
+
fluid,
|
|
50
|
+
focus,
|
|
51
|
+
icon,
|
|
52
|
+
iconPosition,
|
|
53
|
+
inverted,
|
|
54
|
+
label,
|
|
55
|
+
labelPosition,
|
|
56
|
+
loading,
|
|
57
|
+
size,
|
|
58
|
+
tabIndex,
|
|
59
|
+
transparent
|
|
60
|
+
} = _a, rest = __objRest(_a, [
|
|
61
|
+
"value",
|
|
62
|
+
"onChange",
|
|
63
|
+
"as",
|
|
64
|
+
"action",
|
|
65
|
+
"actionPosition",
|
|
66
|
+
"className",
|
|
67
|
+
"disabled",
|
|
68
|
+
"error",
|
|
69
|
+
"fluid",
|
|
70
|
+
"focus",
|
|
71
|
+
"icon",
|
|
72
|
+
"iconPosition",
|
|
73
|
+
"inverted",
|
|
74
|
+
"label",
|
|
75
|
+
"labelPosition",
|
|
76
|
+
"loading",
|
|
77
|
+
"size",
|
|
78
|
+
"tabIndex",
|
|
79
|
+
"transparent"
|
|
80
|
+
]);
|
|
81
|
+
let selected;
|
|
82
|
+
if (typeof value === "number")
|
|
83
|
+
selected = toDate(LocalTime.ofSecondOfDay(value));
|
|
84
|
+
else
|
|
85
|
+
selected = value ? toDate(value) : null;
|
|
86
|
+
const inputProps = {
|
|
87
|
+
as,
|
|
88
|
+
action,
|
|
89
|
+
actionPosition,
|
|
90
|
+
className,
|
|
91
|
+
disabled,
|
|
92
|
+
error,
|
|
93
|
+
fluid,
|
|
94
|
+
focus,
|
|
95
|
+
icon,
|
|
96
|
+
iconPosition,
|
|
97
|
+
inverted,
|
|
98
|
+
label,
|
|
99
|
+
labelPosition,
|
|
100
|
+
loading,
|
|
101
|
+
size,
|
|
102
|
+
tabIndex,
|
|
103
|
+
transparent
|
|
104
|
+
};
|
|
105
|
+
return /* @__PURE__ */ React.createElement(DatePicker, __spreadProps(__spreadValues({}, rest), {
|
|
106
|
+
selected,
|
|
107
|
+
onChange: (date) => {
|
|
108
|
+
if (onChange)
|
|
109
|
+
onChange(date ? toLocalTime(date) : null);
|
|
110
|
+
},
|
|
111
|
+
showTimeSelect: true,
|
|
112
|
+
showTimeSelectOnly: true,
|
|
113
|
+
timeIntervals: 15,
|
|
114
|
+
timeCaption: "Time",
|
|
115
|
+
dateFormat: "hh:mm aa",
|
|
116
|
+
customInput: /* @__PURE__ */ React.createElement(MaskedTimeInput, __spreadValues({}, inputProps))
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export { LocalTimePicker };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import debug from 'debug';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { MaskedInput } from '../../inputs/MaskedInput/MaskedInput.js';
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
debug("thx.controls.date.LocalTimePicker.MaskedTimeInput");
|
|
34
|
+
function MaskedTimeInputInner(props, ref) {
|
|
35
|
+
const _a = props, { onChange } = _a, rest = __objRest(_a, ["onChange"]);
|
|
36
|
+
return /* @__PURE__ */ React.createElement(MaskedInput, __spreadValues({
|
|
37
|
+
mask: { alias: "datetime", inputFormat: "hh:MM TT" },
|
|
38
|
+
onChange: (value) => {
|
|
39
|
+
if (onChange)
|
|
40
|
+
onChange({ target: { value: value || "" } });
|
|
41
|
+
}
|
|
42
|
+
}, rest));
|
|
43
|
+
}
|
|
44
|
+
const MaskedTimeInput = forwardRef(MaskedTimeInputInner);
|
|
45
|
+
|
|
46
|
+
export { MaskedTimeInput };
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { toDate, toLocalDate } from '@thx/date';
|
|
2
|
+
import debug from 'debug';
|
|
3
|
+
import { Input } from 'semantic-ui-react';
|
|
4
|
+
import DatePicker from 'react-datepicker';
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __defProps = Object.defineProperties;
|
|
8
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
9
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
debug("thx.controls.date.MonthDayPicker");
|
|
38
|
+
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
39
|
+
function MonthDayHeader(props) {
|
|
40
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
41
|
+
className: "react-datepicker__current-month"
|
|
42
|
+
}, months[props.date.getMonth()]), /* @__PURE__ */ React.createElement("button", {
|
|
43
|
+
type: "button",
|
|
44
|
+
className: "react-datepicker__navigation react-datepicker__navigation--previous",
|
|
45
|
+
"aria-label": "Previous Month",
|
|
46
|
+
onClick: props.decreaseMonth,
|
|
47
|
+
disabled: props.prevMonthButtonDisabled
|
|
48
|
+
}, "Previous Month"), /* @__PURE__ */ React.createElement("button", {
|
|
49
|
+
type: "button",
|
|
50
|
+
className: "react-datepicker__navigation react-datepicker__navigation--next",
|
|
51
|
+
"aria-label": "Next Month",
|
|
52
|
+
onClick: props.increaseMonth,
|
|
53
|
+
disabled: props.nextMonthButtonDisabled
|
|
54
|
+
}, "Next Month"));
|
|
55
|
+
}
|
|
56
|
+
function MonthDayPicker(props) {
|
|
57
|
+
const _a = props, {
|
|
58
|
+
value,
|
|
59
|
+
onChange,
|
|
60
|
+
as,
|
|
61
|
+
action,
|
|
62
|
+
actionPosition,
|
|
63
|
+
className,
|
|
64
|
+
disabled,
|
|
65
|
+
error,
|
|
66
|
+
fluid,
|
|
67
|
+
focus,
|
|
68
|
+
icon,
|
|
69
|
+
iconPosition,
|
|
70
|
+
inverted,
|
|
71
|
+
label,
|
|
72
|
+
labelPosition,
|
|
73
|
+
loading,
|
|
74
|
+
size,
|
|
75
|
+
tabIndex,
|
|
76
|
+
transparent
|
|
77
|
+
} = _a, rest = __objRest(_a, [
|
|
78
|
+
"value",
|
|
79
|
+
"onChange",
|
|
80
|
+
"as",
|
|
81
|
+
"action",
|
|
82
|
+
"actionPosition",
|
|
83
|
+
"className",
|
|
84
|
+
"disabled",
|
|
85
|
+
"error",
|
|
86
|
+
"fluid",
|
|
87
|
+
"focus",
|
|
88
|
+
"icon",
|
|
89
|
+
"iconPosition",
|
|
90
|
+
"inverted",
|
|
91
|
+
"label",
|
|
92
|
+
"labelPosition",
|
|
93
|
+
"loading",
|
|
94
|
+
"size",
|
|
95
|
+
"tabIndex",
|
|
96
|
+
"transparent"
|
|
97
|
+
]);
|
|
98
|
+
const selected = value ? toDate(value) : null;
|
|
99
|
+
const inputProps = {
|
|
100
|
+
as,
|
|
101
|
+
action,
|
|
102
|
+
actionPosition,
|
|
103
|
+
className,
|
|
104
|
+
disabled,
|
|
105
|
+
error,
|
|
106
|
+
fluid,
|
|
107
|
+
focus,
|
|
108
|
+
icon,
|
|
109
|
+
iconPosition,
|
|
110
|
+
inverted,
|
|
111
|
+
label,
|
|
112
|
+
labelPosition,
|
|
113
|
+
loading,
|
|
114
|
+
size,
|
|
115
|
+
tabIndex,
|
|
116
|
+
transparent
|
|
117
|
+
};
|
|
118
|
+
return /* @__PURE__ */ React.createElement(DatePicker, __spreadProps(__spreadValues({}, rest), {
|
|
119
|
+
selected,
|
|
120
|
+
onChange: (date) => {
|
|
121
|
+
if (onChange)
|
|
122
|
+
onChange(date ? toLocalDate(date) : null);
|
|
123
|
+
},
|
|
124
|
+
customInput: /* @__PURE__ */ React.createElement(Input, __spreadValues({}, inputProps)),
|
|
125
|
+
renderCustomHeader: MonthDayHeader,
|
|
126
|
+
dateFormat: "MMMM d"
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export { MonthDayPicker };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { LocalDate } from '@js-joda/core';
|
|
2
|
+
import { toDate, toLocalDate } from '@thx/date';
|
|
3
|
+
import debug from 'debug';
|
|
4
|
+
import { Input } from 'semantic-ui-react';
|
|
5
|
+
import DatePicker from 'react-datepicker';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __defProps = Object.defineProperties;
|
|
9
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
10
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
13
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
+
var __spreadValues = (a, b) => {
|
|
15
|
+
for (var prop in b || (b = {}))
|
|
16
|
+
if (__hasOwnProp.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
if (__getOwnPropSymbols)
|
|
19
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
20
|
+
if (__propIsEnum.call(b, prop))
|
|
21
|
+
__defNormalProp(a, prop, b[prop]);
|
|
22
|
+
}
|
|
23
|
+
return a;
|
|
24
|
+
};
|
|
25
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
26
|
+
var __objRest = (source, exclude) => {
|
|
27
|
+
var target = {};
|
|
28
|
+
for (var prop in source)
|
|
29
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
30
|
+
target[prop] = source[prop];
|
|
31
|
+
if (source != null && __getOwnPropSymbols)
|
|
32
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
33
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
34
|
+
target[prop] = source[prop];
|
|
35
|
+
}
|
|
36
|
+
return target;
|
|
37
|
+
};
|
|
38
|
+
debug("thx.controls.date.MonthYearPicker");
|
|
39
|
+
function MonthYearPicker(props) {
|
|
40
|
+
const _a = props, {
|
|
41
|
+
value,
|
|
42
|
+
onChange,
|
|
43
|
+
as,
|
|
44
|
+
action,
|
|
45
|
+
actionPosition,
|
|
46
|
+
className,
|
|
47
|
+
disabled,
|
|
48
|
+
error,
|
|
49
|
+
fluid,
|
|
50
|
+
focus,
|
|
51
|
+
icon,
|
|
52
|
+
iconPosition,
|
|
53
|
+
inverted,
|
|
54
|
+
label,
|
|
55
|
+
labelPosition,
|
|
56
|
+
loading,
|
|
57
|
+
size,
|
|
58
|
+
tabIndex,
|
|
59
|
+
transparent,
|
|
60
|
+
minDate,
|
|
61
|
+
maxDate
|
|
62
|
+
} = _a, rest = __objRest(_a, [
|
|
63
|
+
"value",
|
|
64
|
+
"onChange",
|
|
65
|
+
"as",
|
|
66
|
+
"action",
|
|
67
|
+
"actionPosition",
|
|
68
|
+
"className",
|
|
69
|
+
"disabled",
|
|
70
|
+
"error",
|
|
71
|
+
"fluid",
|
|
72
|
+
"focus",
|
|
73
|
+
"icon",
|
|
74
|
+
"iconPosition",
|
|
75
|
+
"inverted",
|
|
76
|
+
"label",
|
|
77
|
+
"labelPosition",
|
|
78
|
+
"loading",
|
|
79
|
+
"size",
|
|
80
|
+
"tabIndex",
|
|
81
|
+
"transparent",
|
|
82
|
+
"minDate",
|
|
83
|
+
"maxDate"
|
|
84
|
+
]);
|
|
85
|
+
const selected = value ? toDate(value) : null;
|
|
86
|
+
const inputProps = {
|
|
87
|
+
as,
|
|
88
|
+
action,
|
|
89
|
+
actionPosition,
|
|
90
|
+
className,
|
|
91
|
+
disabled,
|
|
92
|
+
error,
|
|
93
|
+
fluid,
|
|
94
|
+
focus,
|
|
95
|
+
icon,
|
|
96
|
+
iconPosition,
|
|
97
|
+
inverted,
|
|
98
|
+
label,
|
|
99
|
+
labelPosition,
|
|
100
|
+
loading,
|
|
101
|
+
size,
|
|
102
|
+
tabIndex,
|
|
103
|
+
transparent
|
|
104
|
+
};
|
|
105
|
+
return /* @__PURE__ */ React.createElement(DatePicker, __spreadProps(__spreadValues({}, rest), {
|
|
106
|
+
selected,
|
|
107
|
+
onChange: (date) => {
|
|
108
|
+
if (onChange)
|
|
109
|
+
onChange(date ? toLocalDate(date) : void 0);
|
|
110
|
+
},
|
|
111
|
+
customInput: /* @__PURE__ */ React.createElement(Input, __spreadValues({}, inputProps)),
|
|
112
|
+
dateFormat: "MMMM yyyy",
|
|
113
|
+
showMonthYearPicker: true,
|
|
114
|
+
minDate: toDate((minDate == null ? void 0 : minDate.withDayOfMonth(1)) || LocalDate.ofEpochDay(0)),
|
|
115
|
+
maxDate: toDate((maxDate == null ? void 0 : maxDate.plusMonths(1).withDayOfMonth(1).minusDays(1)) || LocalDate.now().plusYears(20))
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export { MonthYearPicker };
|