@addsign/moje-agenda-shared-lib 0.0.53 → 0.0.57
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/assets/tailwind.css +40 -2
- package/dist/components/Calendar.js +9 -4
- package/dist/components/Calendar.js.map +1 -1
- package/dist/components/ConfirmationModalDialog.js +2 -2
- package/dist/components/datatable/DataTable.js +1 -1
- package/dist/components/datatable/DataTableServer.js +198 -186
- package/dist/components/datatable/DataTableServer.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBar.js +5 -48
- package/dist/components/form/AutocompleteSearchBar.js.map +1 -1
- package/dist/components/form/FileInput.js +3 -3
- package/dist/components/form/FileInput.js.map +1 -1
- package/dist/components/form/FormField.js +1 -1
- package/dist/components/form/InputField.d.ts +6 -0
- package/dist/components/form/InputField.js +144 -0
- package/dist/components/form/InputField.js.map +1 -0
- package/dist/components/form/PositionsSelectorSingle.js +15 -9
- package/dist/components/form/PositionsSelectorSingle.js.map +1 -1
- package/dist/components/form/SelectField.d.ts +8 -0
- package/dist/components/form/SelectField.js +142 -0
- package/dist/components/form/SelectField.js.map +1 -0
- package/dist/{iconBase-BY_L6Cb_.js → iconBase-B8_TsgYI.js} +8 -8
- package/dist/{iconBase-BY_L6Cb_.js.map → iconBase-B8_TsgYI.js.map} +1 -1
- package/dist/{index-ZA1ctELQ.js → index-BDqNIr_C.js} +13 -13
- package/dist/{index-ZA1ctELQ.js.map → index-BDqNIr_C.js.map} +1 -1
- package/dist/{index-DPrqKh-7.js → index-DUTU8Jwr.js} +2 -2
- package/dist/{index-DPrqKh-7.js.map → index-DUTU8Jwr.js.map} +1 -1
- package/dist/types.d.ts +19 -0
- package/dist/useClickAway-CH9ykBsx.js +49 -0
- package/dist/useClickAway-CH9ykBsx.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef, useEffect } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { b as MdClose } from "../../index-BDqNIr_C.js";
|
|
4
4
|
import '../../assets/tailwind.css';/* empty css */
|
|
5
5
|
import "../../contexts/FederationContext.js";
|
|
6
6
|
import { useFederationContext } from "../../contexts/useFederationContext.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IFormFieldGlobalProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
export interface IInputFieldProps extends IFormFieldGlobalProps {
|
|
4
|
+
maxLength?: number;
|
|
5
|
+
}
|
|
6
|
+
export default function InputField({ label, name, value, description, onInputChange, placeholder, className, register, type, disabled, maxLength, errors, }: IInputFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { b as MdClose } from "../../index-BDqNIr_C.js";
|
|
4
|
+
import { u as useClickAway } from "../../useClickAway-CH9ykBsx.js";
|
|
5
|
+
function InputField({
|
|
6
|
+
label,
|
|
7
|
+
name,
|
|
8
|
+
value,
|
|
9
|
+
description,
|
|
10
|
+
onInputChange,
|
|
11
|
+
placeholder,
|
|
12
|
+
className,
|
|
13
|
+
register,
|
|
14
|
+
type,
|
|
15
|
+
disabled,
|
|
16
|
+
maxLength,
|
|
17
|
+
errors = {}
|
|
18
|
+
}) {
|
|
19
|
+
var _a;
|
|
20
|
+
const wrapperRef = React.useRef(null);
|
|
21
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
22
|
+
const handleClear = (e) => {
|
|
23
|
+
onInputChange({
|
|
24
|
+
...e,
|
|
25
|
+
target: {
|
|
26
|
+
value: "",
|
|
27
|
+
name
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
const fallbackRef = React.useRef(null);
|
|
32
|
+
const {
|
|
33
|
+
ref: registeredRef = fallbackRef,
|
|
34
|
+
onBlur: formOnBlur = () => {
|
|
35
|
+
},
|
|
36
|
+
...rest
|
|
37
|
+
} = register ? register(name) : {};
|
|
38
|
+
const ref = registeredRef || fallbackRef;
|
|
39
|
+
const handleSetFocus = () => {
|
|
40
|
+
console.log(
|
|
41
|
+
"%clibcomponents\formInputField.tsx:44 handleSetFocus",
|
|
42
|
+
"color: #007acc;"
|
|
43
|
+
);
|
|
44
|
+
setIsFocused(true);
|
|
45
|
+
ref.current.focus();
|
|
46
|
+
};
|
|
47
|
+
useClickAway(wrapperRef, () => {
|
|
48
|
+
console.log(
|
|
49
|
+
"%clibcomponents\formInputField.tsx:48 clickAway",
|
|
50
|
+
"color: #007acc;"
|
|
51
|
+
);
|
|
52
|
+
setIsFocused(false);
|
|
53
|
+
});
|
|
54
|
+
const hangleChange = (e) => {
|
|
55
|
+
onInputChange(e);
|
|
56
|
+
setIsFocused(false);
|
|
57
|
+
};
|
|
58
|
+
const renderInput = () => {
|
|
59
|
+
switch (type) {
|
|
60
|
+
case "textarea":
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
"textarea",
|
|
63
|
+
{
|
|
64
|
+
id: name,
|
|
65
|
+
className: "grow shrink basis-0 text-gray-900 text-sm font-normal leading-tight focus:border-none ",
|
|
66
|
+
disabled,
|
|
67
|
+
value: value || "",
|
|
68
|
+
rows: 3,
|
|
69
|
+
...rest,
|
|
70
|
+
ref,
|
|
71
|
+
onChange: (e) => hangleChange(e),
|
|
72
|
+
onFocus: () => setIsFocused(true),
|
|
73
|
+
maxLength: maxLength || 4e3,
|
|
74
|
+
onBlur: (e) => {
|
|
75
|
+
formOnBlur(e);
|
|
76
|
+
setIsFocused(false);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
default:
|
|
81
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
82
|
+
"input",
|
|
83
|
+
{
|
|
84
|
+
className: "text-gray-900 text-sm font-medium leading-normal text-ellipsis overflow-hidden w-full",
|
|
85
|
+
id: name,
|
|
86
|
+
readOnly: disabled,
|
|
87
|
+
value: value || "",
|
|
88
|
+
type,
|
|
89
|
+
...rest,
|
|
90
|
+
ref,
|
|
91
|
+
placeholder,
|
|
92
|
+
onChange: (e) => hangleChange(e),
|
|
93
|
+
onFocus: () => setIsFocused(true),
|
|
94
|
+
onBlur: (e) => {
|
|
95
|
+
formOnBlur(e);
|
|
96
|
+
setIsFocused(false);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
) });
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
className: "min-h-30 flex-col justify-start items-start gap-1.5 w-full relative " + className,
|
|
106
|
+
ref: wrapperRef,
|
|
107
|
+
id: "component",
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ jsxs("div", { className: "self-stretch flex-col justify-start items-start gap-1.5 flex", children: [
|
|
110
|
+
label && /* @__PURE__ */ jsx("div", { className: "text-slate-700 text-sm font-medium leading-tight", children: label }),
|
|
111
|
+
/* @__PURE__ */ jsxs(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
className: `self-stretch w-full px-3 py-1 bg-white rounded-lg border justify-start items-center gap-0 inline-flex outline-none
|
|
115
|
+
${isFocused ? "outline-4 outline-indigo-200 outline-offset-0 border-indigo-300 " : ""}`,
|
|
116
|
+
onClick: handleSetFocus,
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ jsx("div", { className: "grow shrink basis-0 min-h-5 xl:min-h-[32px] justify-start items-center gap-0 flex whitespace-nowrap w-[calc(100%-40px)] ", children: renderInput() }),
|
|
119
|
+
value && /* @__PURE__ */ jsxs(
|
|
120
|
+
"div",
|
|
121
|
+
{
|
|
122
|
+
className: "w-6 h-6 relative cursor-pointer ",
|
|
123
|
+
onClick: handleClear,
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center hover:bg-gray-100 w-6 rounded-full text-lg", children: /* @__PURE__ */ jsx(MdClose, {}) }),
|
|
126
|
+
" "
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
] }),
|
|
134
|
+
description && !isFocused && /* @__PURE__ */ jsx("div", { className: "self-stretch text-slate-600 text-sm font-normal leading-tight", children: description }),
|
|
135
|
+
" ",
|
|
136
|
+
errors[name] && /* @__PURE__ */ jsx("div", { className: "HintText self-stretch text-red-600 text-sm font-normal leading-tight", children: (_a = errors[name]) == null ? void 0 : _a.message })
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
) });
|
|
140
|
+
}
|
|
141
|
+
export {
|
|
142
|
+
InputField as default
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=InputField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputField.js","sources":["../../../lib/components/form/InputField.tsx"],"sourcesContent":["import * as React from \"react\";\r\nimport { IFormFieldGlobalProps } from \"../../types\";\r\nimport { MdClose } from \"react-icons/md\";\r\nimport { useClickAway } from \"react-use\";\r\n\r\nexport interface IInputFieldProps extends IFormFieldGlobalProps {\r\n maxLength?: number;\r\n}\r\n\r\nexport default function InputField({\r\n label,\r\n name,\r\n value,\r\n description,\r\n onInputChange,\r\n placeholder,\r\n className,\r\n register,\r\n type,\r\n disabled,\r\n maxLength,\r\n errors = {},\r\n}: IInputFieldProps) {\r\n const wrapperRef = React.useRef(null);\r\n const [isFocused, setIsFocused] = React.useState(false);\r\n const handleClear = (e: any) => {\r\n value;\r\n onInputChange({\r\n ...e,\r\n target: {\r\n value: \"\",\r\n name: name,\r\n },\r\n });\r\n };\r\n const fallbackRef = React.useRef(null);\r\n const {\r\n ref: registeredRef = fallbackRef,\r\n onBlur: formOnBlur = () => {} /* default function */,\r\n ...rest\r\n } = register ? register(name) : {};\r\n\r\n const ref = registeredRef || fallbackRef;\r\n const handleSetFocus = () => {\r\n console.log(\r\n \"%clibcomponents\\formInputField.tsx:44 handleSetFocus\",\r\n \"color: #007acc;\"\r\n );\r\n setIsFocused(true);\r\n ref.current.focus();\r\n };\r\n useClickAway(wrapperRef, () => {\r\n console.log(\r\n \"%clibcomponents\\formInputField.tsx:48 clickAway\",\r\n \"color: #007acc;\"\r\n );\r\n setIsFocused(false);\r\n });\r\n\r\n const hangleChange = (e: any) => {\r\n onInputChange(e);\r\n setIsFocused(false);\r\n };\r\n\r\n const renderInput = () => {\r\n switch (type) {\r\n case \"textarea\":\r\n return (\r\n <textarea\r\n id={name}\r\n className=\"grow shrink basis-0 text-gray-900 text-sm font-normal leading-tight focus:border-none \"\r\n disabled={disabled}\r\n value={value || \"\"}\r\n rows={3}\r\n {...rest} // Spread the rest of register's return value\r\n ref={ref}\r\n onChange={(e) => hangleChange(e)}\r\n onFocus={() => setIsFocused(true)}\r\n maxLength={maxLength || 4000}\r\n // Combine custom onBlur with form's onBlur\r\n onBlur={(e) => {\r\n formOnBlur(e); // Call React Hook Form's onBlur\r\n setIsFocused(false); // Then call your custom onBlur logic\r\n }}\r\n />\r\n );\r\n default:\r\n return (\r\n <>\r\n <input\r\n className=\"text-gray-900 text-sm font-medium leading-normal text-ellipsis overflow-hidden w-full\"\r\n id={name}\r\n readOnly={disabled}\r\n value={value || \"\"}\r\n type={type}\r\n {...rest} // Spread the rest of register's return value\r\n ref={ref}\r\n placeholder={placeholder}\r\n onChange={(e) => hangleChange(e)}\r\n onFocus={() => setIsFocused(true)}\r\n // Combine custom onBlur with form's onBlur\r\n onBlur={(e) => {\r\n formOnBlur(e); // Call React Hook Form's onBlur\r\n setIsFocused(false); // Then call your custom onBlur logic\r\n }}\r\n />\r\n </>\r\n );\r\n }\r\n };\r\n\r\n return (\r\n <>\r\n <div\r\n className={\r\n \"min-h-30 flex-col justify-start items-start gap-1.5 w-full relative \" +\r\n className\r\n }\r\n ref={wrapperRef}\r\n id=\"component\"\r\n >\r\n <div className=\"self-stretch flex-col justify-start items-start gap-1.5 flex\">\r\n {label && (\r\n <div className=\"text-slate-700 text-sm font-medium leading-tight\">\r\n {label}\r\n </div>\r\n )}\r\n <div\r\n className={`self-stretch w-full px-3 py-1 bg-white rounded-lg border justify-start items-center gap-0 inline-flex outline-none \r\n ${isFocused ? \"outline-4 outline-indigo-200 outline-offset-0 border-indigo-300 \" : \"\"}`}\r\n onClick={handleSetFocus}\r\n >\r\n <div className=\"grow shrink basis-0 min-h-5 xl:min-h-[32px] justify-start items-center gap-0 flex whitespace-nowrap w-[calc(100%-40px)] \">\r\n {renderInput()}\r\n </div>\r\n {value && (\r\n <div\r\n className=\"w-6 h-6 relative cursor-pointer \"\r\n onClick={handleClear}\r\n >\r\n <div className=\"absolute inset-0 flex items-center justify-center hover:bg-gray-100 w-6 rounded-full text-lg\">\r\n <MdClose />\r\n </div>{\" \"}\r\n </div>\r\n )}\r\n </div>\r\n </div>\r\n {description && !isFocused && (\r\n <div className=\"self-stretch text-slate-600 text-sm font-normal leading-tight\">\r\n {description}\r\n </div>\r\n )}{\" \"}\r\n {errors[name] && (\r\n <div className=\"HintText self-stretch text-red-600 text-sm font-normal leading-tight\">\r\n {errors[name]?.message}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n );\r\n}\r\n"],"names":[],"mappings":";;;;AASA,SAAwB,WAAW;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,CAAC;AACZ,GAAqB;;AACb,QAAA,aAAa,MAAM,OAAO,IAAI;AACpC,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,KAAK;AAChD,QAAA,cAAc,CAAC,MAAW;AAEhB,kBAAA;AAAA,MACZ,GAAG;AAAA,MACH,QAAQ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
import AutocompleteSearchBar from "./AutocompleteSearchBar.js";
|
|
6
6
|
import FormField from "./FormField.js";
|
|
7
|
-
import {
|
|
7
|
+
import { j as MdCheck } from "../../index-BDqNIr_C.js";
|
|
8
8
|
import SectionTitle from "../layout/SectionTitle.js";
|
|
9
9
|
import "../../contexts/FederationContext.js";
|
|
10
10
|
import { useFederationContext } from "../../contexts/useFederationContext.js";
|
|
11
11
|
import { getFullName } from "../../utils/getFullName.js";
|
|
12
|
-
import {
|
|
13
|
-
import { G as GenIcon } from "../../iconBase-BY_L6Cb_.js";
|
|
12
|
+
import { G as GenIcon } from "../../iconBase-B8_TsgYI.js";
|
|
14
13
|
function CiEdit(props) {
|
|
15
14
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "g", "attr": { "id": "Edit" }, "child": [{ "tag": "g", "attr": {}, "child": [{ "tag": "path", "attr": { "d": "M3.548,20.938h16.9a.5.5,0,0,0,0-1H3.548a.5.5,0,0,0,0,1Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M9.71,17.18a2.587,2.587,0,0,0,1.12-.65l9.54-9.54a1.75,1.75,0,0,0,0-2.47l-.94-.93a1.788,1.788,0,0,0-2.47,0L7.42,13.12a2.473,2.473,0,0,0-.64,1.12L6.04,17a.737.737,0,0,0,.19.72.767.767,0,0,0,.53.22Zm.41-1.36a1.468,1.468,0,0,1-.67.39l-.97.26-1-1,.26-.97a1.521,1.521,0,0,1,.39-.67l.38-.37,1.99,1.99Zm1.09-1.08L9.22,12.75l6.73-6.73,1.99,1.99Zm8.45-8.45L18.65,7.3,16.66,5.31l1.01-1.02a.748.748,0,0,1,1.06,0l.93.94A.754.754,0,0,1,19.66,6.29Z" }, "child": [] }] }] }] })(props);
|
|
16
15
|
}
|
|
@@ -22,13 +21,13 @@ function PositionsSelectorSingle({
|
|
|
22
21
|
disabled,
|
|
23
22
|
initDepartmentId
|
|
24
23
|
}) {
|
|
24
|
+
var _a;
|
|
25
25
|
const [isModalOpen, setModalOpen] = useState(false);
|
|
26
26
|
const [department, setDepartment] = useState("");
|
|
27
27
|
const [positions, setPositions] = useState([]);
|
|
28
28
|
const [selectedPositionEmployee, setSelectedPositionEmployee] = useState();
|
|
29
29
|
const [storedPositionEmployee, setStoredPositionEmployee] = useState();
|
|
30
|
-
const
|
|
31
|
-
const apiClient = federationContext == null ? void 0 : federationContext.apiClient;
|
|
30
|
+
const apiClient = (_a = useFederationContext()) == null ? void 0 : _a.apiClient;
|
|
32
31
|
useEffect(() => {
|
|
33
32
|
const handleKeyDown = (event) => {
|
|
34
33
|
if (event.key === "Escape") {
|
|
@@ -58,6 +57,13 @@ function PositionsSelectorSingle({
|
|
|
58
57
|
setModalOpen(false);
|
|
59
58
|
};
|
|
60
59
|
const handleSelectedPositionEmployee = (position) => {
|
|
60
|
+
console.log(
|
|
61
|
+
"%csrcsharedPositionsSelectorSingle.tsx:54 position",
|
|
62
|
+
"color: #007acc;",
|
|
63
|
+
position,
|
|
64
|
+
selectedPositionEmployee,
|
|
65
|
+
position.id == (selectedPositionEmployee == null ? void 0 : selectedPositionEmployee.id)
|
|
66
|
+
);
|
|
61
67
|
if (!selectedPositionEmployee || position.id !== (selectedPositionEmployee == null ? void 0 : selectedPositionEmployee.id)) {
|
|
62
68
|
setSelectedPositionEmployee(position);
|
|
63
69
|
} else {
|
|
@@ -65,6 +71,7 @@ function PositionsSelectorSingle({
|
|
|
65
71
|
}
|
|
66
72
|
};
|
|
67
73
|
const handleDepartmentChange = (e) => {
|
|
74
|
+
console.log("%csrcsharedTransferListModal.tsx:109 e", "color: #007acc;", e);
|
|
68
75
|
setDepartment(e);
|
|
69
76
|
};
|
|
70
77
|
useEffect(() => {
|
|
@@ -72,14 +79,13 @@ function PositionsSelectorSingle({
|
|
|
72
79
|
apiClient.get(
|
|
73
80
|
"os/positions/employees?maxResults=1000&departmentId=" + department
|
|
74
81
|
).then((response) => {
|
|
75
|
-
var
|
|
76
|
-
setPositions((
|
|
82
|
+
var _a2;
|
|
83
|
+
setPositions((_a2 = response.data) == null ? void 0 : _a2.content);
|
|
77
84
|
}).catch((error) => {
|
|
78
85
|
console.error(
|
|
79
86
|
"There was an error fetching positions/employees",
|
|
80
87
|
error
|
|
81
88
|
);
|
|
82
|
-
handleErrors(error, federationContext.emitter);
|
|
83
89
|
});
|
|
84
90
|
}
|
|
85
91
|
}, [apiClient, department, isModalOpen]);
|
|
@@ -150,7 +156,7 @@ function PositionsSelectorSingle({
|
|
|
150
156
|
showId: true
|
|
151
157
|
}
|
|
152
158
|
) }),
|
|
153
|
-
/* @__PURE__ */ jsx("div", { className: "col-span-12 h-[400px]
|
|
159
|
+
/* @__PURE__ */ jsx("div", { className: "col-span-12 h-[400px]", children: /* @__PURE__ */ jsxs("div", { className: "pt-4 w-full ", children: [
|
|
154
160
|
/* @__PURE__ */ jsx("div", { className: "text-slate-700 text-sm leading-tight font-medium my-4", children: "Nalezené pozice:" }),
|
|
155
161
|
positions.map((position) => /* @__PURE__ */ jsx(
|
|
156
162
|
"div",
|