@inceptionbg/iui 1.0.9 → 1.0.11
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/index.d.ts +45 -71
- package/dist/index.js +1 -1522
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,1523 +1,2 @@
|
|
|
1
|
-
import clsx from 'clsx';
|
|
2
|
-
export { default as clsx } from 'clsx';
|
|
3
|
-
import moment$1 from 'moment';
|
|
4
|
-
export { default as moment } from 'moment';
|
|
5
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
6
|
-
export { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
7
|
-
import { v4 } from 'uuid';
|
|
8
|
-
export { v4 as uuidv4 } from 'uuid';
|
|
9
|
-
import moment from 'moment/moment';
|
|
10
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
11
|
-
import { useState, useRef, useEffect, forwardRef, useCallback, cloneElement, Fragment as Fragment$1, createElement } from 'react';
|
|
12
|
-
import { createPortal } from 'react-dom';
|
|
13
|
-
import { useNavigate, Link, useLocation } from 'react-router-dom';
|
|
14
|
-
import { Calendar } from 'react-calendar';
|
|
15
|
-
import 'react-calendar/dist/Calendar.css';
|
|
16
|
-
import ReactSelect from 'react-select';
|
|
17
|
-
import { AsyncPaginate } from 'react-select-async-paginate';
|
|
18
|
-
import { useNavigate as useNavigate$1 } from 'react-router';
|
|
19
|
-
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
|
20
|
-
import { useTranslation } from 'react-i18next';
|
|
21
|
-
import axios from 'axios';
|
|
22
|
-
import jwtDecode from 'jwt-decode';
|
|
23
|
-
|
|
24
|
-
const formatDate = (date) => date ? moment(date).format(`DD.MM.YYYY.`) : '/';
|
|
25
|
-
const formatDateYMD = (date) => moment(date).format(`yyyy-MM-DD`);
|
|
26
|
-
const formatDateAndTime = (date, withSeconds) => date ? moment(date).format(`DD.MM.YYYY. HH:mm${withSeconds ? ':ss' : ''}`) : '/';
|
|
27
|
-
const formatTime = (date, withSeconds) => date ? moment(date).format(`HH:mm${withSeconds ? ':ss' : ''}`) : '/';
|
|
28
|
-
const dateAddDays = (date, addDays) => moment(date).add(addDays, 'days').toISOString();
|
|
29
|
-
const checkIfExpired = (date) => date ? moment(new Date()) > moment(date) : true;
|
|
30
|
-
const getCurrentDateFormatted = () => moment().format('DD.MM.YYYY.').toString();
|
|
31
|
-
const getCurrentDateFormattedYMD = () => moment().format('yyyy-MM-DD').toString();
|
|
32
|
-
const getDaysLeft = (date) => moment(date).diff(new Date(), 'days');
|
|
33
|
-
const formatYearMonth = (year, month) => `${year}-${month < 10 ? `0${month}` : month}`;
|
|
34
|
-
// export const getDayInputRegex = (max: number) =>
|
|
35
|
-
// `(0[1-9]|1[0-9]|2[0-${max === 28 ? "8" : "9"}]${
|
|
36
|
-
// max > 29 && `|3[0${max > 30 && "-1"}]`
|
|
37
|
-
// })`;
|
|
38
|
-
|
|
39
|
-
// export const toNumberOrZero = (value?: string | number) => (!!value ? +value : 0);
|
|
40
|
-
const formatCurrency = (number, minimumFractionDigits, maximumFractionDigits) => Number(number || 0).toLocaleString('sr-RS', {
|
|
41
|
-
minimumFractionDigits: minimumFractionDigits || 2,
|
|
42
|
-
maximumFractionDigits: maximumFractionDigits || 2,
|
|
43
|
-
});
|
|
44
|
-
const formatCurrencyNoDecimals = (number) =>
|
|
45
|
-
// number?.toString().replace(',', '.') || 0;
|
|
46
|
-
Number(number || 0).toLocaleString('sr-RS');
|
|
47
|
-
// export const formatDecimalNumber = (number?: string | number) =>
|
|
48
|
-
// number?.toString().replace('.', ',') || 0;
|
|
49
|
-
// export const roundTwoDecimals = (value?: string | number) =>
|
|
50
|
-
// !!value ? Math.round(+value * 100) / 100 : 0;
|
|
51
|
-
|
|
52
|
-
const maxChar = (str = '', maxLength = 30) => str.length > maxLength ? `${str.substring(0, maxLength)}...` : str;
|
|
53
|
-
|
|
54
|
-
const deleteProps = (obj, props) => {
|
|
55
|
-
let newObj = { ...obj };
|
|
56
|
-
props.forEach((e) => delete newObj[e]);
|
|
57
|
-
return newObj;
|
|
58
|
-
};
|
|
59
|
-
const deleteEmptyProps = (obj) => Object.entries(obj).reduce((a, [k, v]) => [null, undefined, ""].includes(v) ? a : ((a[k] = v), a), {});
|
|
60
|
-
const deleteEmptyPropsIncludingArray = (obj) => Object.entries(obj).reduce((a, [k, v]) => [null, undefined, ""].includes(v) || (Array.isArray(v) && !v.length)
|
|
61
|
-
? a
|
|
62
|
-
: ((a[k] = v), a), {});
|
|
63
|
-
const getActiveFilterNumber = (obj) => Object.keys(obj).length;
|
|
64
|
-
const getVisibleColumnsIds = (tableCols, isPrint) => tableCols.reduce((arr, col) => col.hidden ||
|
|
65
|
-
col.unavailable ||
|
|
66
|
-
(isPrint && ["select", "icons", "actions"].includes(col.id))
|
|
67
|
-
? arr
|
|
68
|
-
: arr.concat(col.id), []);
|
|
69
|
-
|
|
70
|
-
const Collapse = ({ isOpen, className, children }) => {
|
|
71
|
-
const [height, setHeight] = useState();
|
|
72
|
-
const ref = useRef(null);
|
|
73
|
-
useEffect(() => {
|
|
74
|
-
const observer = new ResizeObserver((entries) => {
|
|
75
|
-
const newHeight = Math.ceil(entries[0].contentRect.height);
|
|
76
|
-
setHeight(newHeight);
|
|
77
|
-
});
|
|
78
|
-
let observerRefValue;
|
|
79
|
-
if (ref.current) {
|
|
80
|
-
observerRefValue = ref.current;
|
|
81
|
-
observer.observe(observerRefValue);
|
|
82
|
-
}
|
|
83
|
-
return () => {
|
|
84
|
-
observerRefValue && observer.unobserve(observerRefValue);
|
|
85
|
-
};
|
|
86
|
-
}, [ref]);
|
|
87
|
-
return (jsx("div", { className: clsx("iui-colapse", className), style: { maxHeight: isOpen ? height : 0 }, children: jsx("div", { ref: ref, children: children }) }));
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const prefix$s = "fal";
|
|
91
|
-
const iconName$s = "angle-down";
|
|
92
|
-
const width$s = 384;
|
|
93
|
-
const height$s = 512;
|
|
94
|
-
const unicode$s = "f107";
|
|
95
|
-
const svgPathData$s = "M362.7 203.9l-159.1 144c-6.125 5.469-15.31 5.469-21.44 0L21.29 203.9C14.73 197.1 14.2 187.9 20.1 181.3C26.38 174.4 36.5 174.5 42.73 180.1L192 314.5l149.3-134.4c6.594-5.877 16.69-5.361 22.62 1.188C369.8 187.9 369.3 197.1 362.7 203.9z";
|
|
96
|
-
const faAngleDown = {
|
|
97
|
-
prefix: prefix$s,
|
|
98
|
-
iconName: iconName$s,
|
|
99
|
-
icon: [width$s, height$s, [], unicode$s, svgPathData$s],
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const prefix$r = "fal";
|
|
103
|
-
const iconName$r = "arrow-down-short-wide";
|
|
104
|
-
const width$r = 576;
|
|
105
|
-
const height$r = 512;
|
|
106
|
-
const unicode$r = "f884";
|
|
107
|
-
const svgPathData$r = "M304 208h128C440.8 208 448 200.8 448 192s-7.156-16-16-16h-128c-8.844 0-15.1 7.156-15.1 16S295.2 208 304 208zM304 336h192c8.844 0 16-7.156 16-16s-7.156-16-16-16h-192c-8.844 0-15.1 7.156-15.1 16S295.2 336 304 336zM304 80h64c8.844 0 16-7.156 16-16S376.8 48 368 48h-64c-8.844 0-15.1 7.156-15.1 16S295.2 80 304 80zM560 432h-256c-8.844 0-15.1 7.156-15.1 16S295.2 464 304 464h256c8.844 0 16-7.156 16-16S568.8 432 560 432zM224 352c-4.094 0-8.188 1.562-11.31 4.688L144 425.4V48C144 39.16 136.8 32 128 32S112 39.16 112 48v377.4l-68.69-68.69c-6.25-6.25-16.38-6.25-22.62 0s-6.25 16.38 0 22.62l96 96c6.25 6.25 16.38 6.25 22.62 0l96-96c6.25-6.25 6.25-16.38 0-22.62C232.2 353.6 228.1 352 224 352z";
|
|
108
|
-
const faArrowDownShortWide = {
|
|
109
|
-
prefix: prefix$r,
|
|
110
|
-
iconName: iconName$r,
|
|
111
|
-
icon: [width$r, height$r, [], unicode$r, svgPathData$r],
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const prefix$q = "fal";
|
|
115
|
-
const iconName$q = "arrow-down-wide-short";
|
|
116
|
-
const width$q = 576;
|
|
117
|
-
const height$q = 512;
|
|
118
|
-
const unicode$q = "f160";
|
|
119
|
-
const svgPathData$q = "M368 432h-64c-8.844 0-15.1 7.156-15.1 16S295.2 464 304 464h64c8.844 0 16-7.156 16-16S376.8 432 368 432zM432 304h-128c-8.844 0-15.1 7.156-15.1 16S295.2 336 304 336h128c8.844 0 16-7.156 16-16S440.8 304 432 304zM496 176h-192c-8.844 0-15.1 7.156-15.1 16S295.2 208 304 208h192C504.8 208 512 200.8 512 192S504.8 176 496 176zM560 48h-256c-8.844 0-15.1 7.156-15.1 16S295.2 80 304 80h256C568.8 80 576 72.84 576 64S568.8 48 560 48zM224 352c-4.094 0-8.188 1.562-11.31 4.688L144 425.4V48C144 39.16 136.8 32 128 32S112 39.16 112 48v377.4l-68.69-68.69c-6.25-6.25-16.38-6.25-22.62 0s-6.25 16.38 0 22.62l96 96c6.25 6.25 16.38 6.25 22.62 0l96-96c6.25-6.25 6.25-16.38 0-22.62C232.2 353.6 228.1 352 224 352z";
|
|
120
|
-
const faArrowDownWideShort = {
|
|
121
|
-
prefix: prefix$q,
|
|
122
|
-
iconName: iconName$q,
|
|
123
|
-
icon: [width$q, height$q, [], unicode$q, svgPathData$q],
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const prefix$p = "fal";
|
|
127
|
-
const iconName$p = "arrows-to-line";
|
|
128
|
-
const width$p = 448;
|
|
129
|
-
const height$p = 512;
|
|
130
|
-
const unicode$p = "e0a7";
|
|
131
|
-
const svgPathData$p = "M235.3 324.7C231.3 320.7 226.5 320 224 320s-7.299 .6547-11.33 4.698l-79.98 79.98C129.6 407.8 128 411.9 128 416c0 8.523 6.865 16 16 16c4.094 0 8.188-1.562 11.31-4.688L208 374.6V496c0 8.844 7.156 16 16 16s16-7.156 16-16v-121.4l52.69 52.69C295.8 430.4 299.9 432 304 432c9.139 0 16-7.477 16-16c0-4.094-1.562-8.188-4.688-11.31L235.3 324.7zM212.7 187.3C214.4 189 218.3 192 224 192s9.609-2.98 11.33-4.707l79.98-79.98C318.4 104.2 320 100.1 320 96c0-8.527-6.865-16-16-16c-4.094 0-8.188 1.562-11.31 4.688L240 137.4V16C240 7.156 232.8 0 224 0S208 7.156 208 16v121.4L155.3 84.69C152.2 81.56 148.1 80 144 80C134.9 80 128 87.47 128 96c0 4.094 1.562 8.188 4.688 11.31L212.7 187.3zM432 240h-416C7.156 240 0 247.1 0 255.1S7.156 272 16 272h416c8.844 0 16-7.165 16-16.01S440.8 240 432 240z";
|
|
132
|
-
const faArrowsToLine = {
|
|
133
|
-
prefix: prefix$p,
|
|
134
|
-
iconName: iconName$p,
|
|
135
|
-
icon: [width$p, height$p, [], unicode$p, svgPathData$p],
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const prefix$o = "fal";
|
|
139
|
-
const iconName$o = "arrows-up-down";
|
|
140
|
-
const width$o = 256;
|
|
141
|
-
const height$o = 512;
|
|
142
|
-
const unicode$o = "f07d";
|
|
143
|
-
const svgPathData$o = "M139.3 4.688l112 112C254.4 119.8 256 123.9 256 128s-1.562 8.188-4.688 11.31c-6.25 6.25-16.38 6.25-22.62 0L144 54.63v402.8l84.69-84.69c6.25-6.25 16.38-6.25 22.62 0C254.4 375.8 256 379.9 256 384s-1.562 8.188-4.688 11.31l-112 112c-6.25 6.25-16.38 6.25-22.62 0l-112-112c-6.25-6.25-6.25-16.38 0-22.62s16.38-6.25 22.62 0L112 457.4V54.63L27.31 139.3c-6.25 6.25-16.38 6.25-22.62 0s-6.25-16.38 0-22.62l112-112C122.9-1.562 133.1-1.562 139.3 4.688z";
|
|
144
|
-
const faArrowsUpDown = {
|
|
145
|
-
prefix: prefix$o,
|
|
146
|
-
iconName: iconName$o,
|
|
147
|
-
icon: [width$o, height$o, [], unicode$o, svgPathData$o],
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const prefix$n = "fal";
|
|
151
|
-
const iconName$n = "check";
|
|
152
|
-
const width$n = 512;
|
|
153
|
-
const height$n = 512;
|
|
154
|
-
const unicode$n = "f00c";
|
|
155
|
-
const svgPathData$n = "M475.3 123.3l-272 272C200.2 398.4 196.1 400 192 400s-8.188-1.562-11.31-4.688l-144-144c-6.25-6.25-6.25-16.38 0-22.62s16.38-6.25 22.62 0L192 361.4l260.7-260.7c6.25-6.25 16.38-6.25 22.62 0S481.6 117.1 475.3 123.3z";
|
|
156
|
-
const faCheck = {
|
|
157
|
-
prefix: prefix$n,
|
|
158
|
-
iconName: iconName$n,
|
|
159
|
-
icon: [width$n, height$n, [], unicode$n, svgPathData$n],
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
const prefix$m = "fal";
|
|
163
|
-
const iconName$m = "ellipsis-vertical";
|
|
164
|
-
const width$m = 128;
|
|
165
|
-
const height$m = 512;
|
|
166
|
-
const unicode$m = "f142";
|
|
167
|
-
const svgPathData$m = "M64 384C81.67 384 96 398.3 96 416C96 433.7 81.67 448 64 448C46.33 448 32 433.7 32 416C32 398.3 46.33 384 64 384zM64 224C81.67 224 96 238.3 96 256C96 273.7 81.67 288 64 288C46.33 288 32 273.7 32 256C32 238.3 46.33 224 64 224zM64 128C46.33 128 32 113.7 32 96C32 78.33 46.33 64 64 64C81.67 64 96 78.33 96 96C96 113.7 81.67 128 64 128z";
|
|
168
|
-
const faEllipsisVertical$1 = {
|
|
169
|
-
prefix: prefix$m,
|
|
170
|
-
iconName: iconName$m,
|
|
171
|
-
icon: [width$m, height$m, [], unicode$m, svgPathData$m],
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
const prefix$l = "fal";
|
|
175
|
-
const iconName$l = "xmark";
|
|
176
|
-
const width$l = 320;
|
|
177
|
-
const height$l = 512;
|
|
178
|
-
const unicode$l = "f00d";
|
|
179
|
-
const svgPathData$l = "M315.3 411.3c-6.253 6.253-16.37 6.253-22.63 0L160 278.6l-132.7 132.7c-6.253 6.253-16.37 6.253-22.63 0c-6.253-6.253-6.253-16.37 0-22.63L137.4 256L4.69 123.3c-6.253-6.253-6.253-16.37 0-22.63c6.253-6.253 16.37-6.253 22.63 0L160 233.4l132.7-132.7c6.253-6.253 16.37-6.253 22.63 0c6.253 6.253 6.253 16.37 0 22.63L182.6 256l132.7 132.7C321.6 394.9 321.6 405.1 315.3 411.3z";
|
|
180
|
-
const faXmark$1 = {
|
|
181
|
-
prefix: prefix$l,
|
|
182
|
-
iconName: iconName$l,
|
|
183
|
-
icon: [width$l, height$l, [], unicode$l, svgPathData$l],
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
const Accordions = ({ tabs: allTabs, initialValue, compact, className, }) => {
|
|
187
|
-
const tabs = allTabs.filter((tab) => !tab.hidden);
|
|
188
|
-
const [selected, setSelected] = useState(initialValue || "");
|
|
189
|
-
return !!tabs.length ? (jsx("div", { className: className, children: jsx("div", { className: "iui-accordions", children: tabs.map((tab) => (jsxs("div", { className: clsx("iui-accordion", {
|
|
190
|
-
selected: selected === tab.value,
|
|
191
|
-
compact,
|
|
192
|
-
}), children: [jsxs("div", { className: clsx("summary clickable", {
|
|
193
|
-
disabled: tab.disabled,
|
|
194
|
-
}), onClick: tab.disabled
|
|
195
|
-
? undefined
|
|
196
|
-
: () => setSelected(selected === tab.value ? "" : tab.value), children: [jsxs("div", { className: "flex center", children: [tab.icon && (jsx(FontAwesomeIcon, { icon: tab.icon, className: "iui-icon" })), tab.label] }), jsx(FontAwesomeIcon, { icon: tab.value === selected ? faArrowsToLine : faArrowsUpDown, className: "collapse-icon" })] }), jsx(Collapse, { isOpen: selected === tab.value, children: jsx("div", { className: "p-4", children: tab.component }) })] }, tab.value))) }) })) : null;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
const prefix$k = "far";
|
|
200
|
-
const iconName$k = "circle-check";
|
|
201
|
-
const width$k = 512;
|
|
202
|
-
const height$k = 512;
|
|
203
|
-
const unicode$k = "f058";
|
|
204
|
-
const svgPathData$k = "M335 175L224 286.1L176.1 239c-9.375-9.375-24.56-9.375-33.94 0s-9.375 24.56 0 33.94l64 64C211.7 341.7 217.8 344 224 344s12.28-2.344 16.97-7.031l128-128c9.375-9.375 9.375-24.56 0-33.94S344.4 165.7 335 175zM256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464z";
|
|
205
|
-
const faCircleCheck = {
|
|
206
|
-
prefix: prefix$k,
|
|
207
|
-
iconName: iconName$k,
|
|
208
|
-
icon: [width$k, height$k, [], unicode$k, svgPathData$k],
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
const prefix$j = "far";
|
|
212
|
-
const iconName$j = "circle-exclamation";
|
|
213
|
-
const width$j = 512;
|
|
214
|
-
const height$j = 512;
|
|
215
|
-
const unicode$j = "f06a";
|
|
216
|
-
const svgPathData$j = "M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464zM256 304c13.25 0 24-10.75 24-24v-128C280 138.8 269.3 128 256 128S232 138.8 232 152v128C232 293.3 242.8 304 256 304zM256 337.1c-17.36 0-31.44 14.08-31.44 31.44C224.6 385.9 238.6 400 256 400s31.44-14.08 31.44-31.44C287.4 351.2 273.4 337.1 256 337.1z";
|
|
217
|
-
const faCircleExclamation = {
|
|
218
|
-
prefix: prefix$j,
|
|
219
|
-
iconName: iconName$j,
|
|
220
|
-
icon: [width$j, height$j, [], unicode$j, svgPathData$j],
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
const prefix$i = "far";
|
|
224
|
-
const iconName$i = "circle-info";
|
|
225
|
-
const width$i = 512;
|
|
226
|
-
const height$i = 512;
|
|
227
|
-
const unicode$i = "f05a";
|
|
228
|
-
const svgPathData$i = "M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464zM296 336h-16V248C280 234.8 269.3 224 256 224H224C210.8 224 200 234.8 200 248S210.8 272 224 272h8v64h-16C202.8 336 192 346.8 192 360S202.8 384 216 384h80c13.25 0 24-10.75 24-24S309.3 336 296 336zM256 192c17.67 0 32-14.33 32-32c0-17.67-14.33-32-32-32S224 142.3 224 160C224 177.7 238.3 192 256 192z";
|
|
229
|
-
const faCircleInfo = {
|
|
230
|
-
prefix: prefix$i,
|
|
231
|
-
iconName: iconName$i,
|
|
232
|
-
icon: [width$i, height$i, [], unicode$i, svgPathData$i],
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
const prefix$h = "far";
|
|
236
|
-
const iconName$h = "triangle-exclamation";
|
|
237
|
-
const width$h = 512;
|
|
238
|
-
const height$h = 512;
|
|
239
|
-
const unicode$h = "f071";
|
|
240
|
-
const svgPathData$h = "M506.3 417l-213.3-364C284.8 39 270.4 32 256 32C241.6 32 227.2 39 218.1 53l-213.2 364C-10.59 444.9 9.851 480 42.74 480h426.6C502.1 480 522.6 445 506.3 417zM52.58 432L255.1 84.8L459.4 432H52.58zM256 337.1c-17.36 0-31.44 14.08-31.44 31.44c0 17.36 14.11 31.44 31.48 31.44s31.4-14.08 31.4-31.44C287.4 351.2 273.4 337.1 256 337.1zM232 184v96C232 293.3 242.8 304 256 304s24-10.75 24-24v-96C280 170.8 269.3 160 256 160S232 170.8 232 184z";
|
|
241
|
-
const faTriangleExclamation = {
|
|
242
|
-
prefix: prefix$h,
|
|
243
|
-
iconName: iconName$h,
|
|
244
|
-
icon: [width$h, height$h, [], unicode$h, svgPathData$h],
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
const infoIcons = {
|
|
248
|
-
error: faCircleExclamation,
|
|
249
|
-
success: faCircleCheck,
|
|
250
|
-
info: faCircleInfo,
|
|
251
|
-
warning: faTriangleExclamation,
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
const Alert = ({ text, severity, fitContent, className, children, }) => (jsxs("div", { className: clsx("iui-alert", severity, className, {
|
|
255
|
-
"width-fit": fitContent,
|
|
256
|
-
}), children: [jsx(FontAwesomeIcon, { icon: infoIcons[severity] }), text, children] }));
|
|
257
|
-
|
|
258
|
-
const NotificationBadge = ({ number, className, small, children,
|
|
259
|
-
// color = "primary",
|
|
260
|
-
}) => (jsxs("div", { className: "iui-badge-parent", children: [children, !!number && number > 0 && (jsx("div", { className: clsx("iui-badge primary", className, { small }), children: number > 99 ? "99+" : number }))] }));
|
|
261
|
-
|
|
262
|
-
const PillBadge = forwardRef(({ label, color, className }, ref) => (jsx("div", { ref: ref, className: clsx("iui-pill-badge", color, className), children: label })));
|
|
263
|
-
|
|
264
|
-
const Button = forwardRef(({ label, icon, iconEnd, onClick, disabled, primary, outlined, active, className, size = "m", buttonProps, }, ref) => (jsxs("button", { ref: ref, disabled: disabled, className: clsx("iui-btn", className, size, {
|
|
265
|
-
primary,
|
|
266
|
-
outlined,
|
|
267
|
-
active,
|
|
268
|
-
}), onClick: onClick, type: buttonProps?.type || onClick ? "button" : "submit", ...buttonProps, children: [icon && jsx(FontAwesomeIcon, { icon: icon }), jsx("div", { className: "iui-btn-label", children: label }), iconEnd && jsx(FontAwesomeIcon, { icon: iconEnd })] })));
|
|
269
|
-
|
|
270
|
-
const IconButton = forwardRef(({ icon, onClick, disabled, className, active, buttonProps,
|
|
271
|
-
// outlined,
|
|
272
|
-
// size = "m",
|
|
273
|
-
}, ref) => (jsx("button", { ref: ref, disabled: disabled, className: clsx("iui-btn iui-icon-btn", className, { active }), onClick: onClick, type: buttonProps?.type || onClick ? "button" : "submit", ...buttonProps, children: jsx(FontAwesomeIcon, { icon: icon }) })));
|
|
274
|
-
|
|
275
|
-
const ConditionalWrapper = ({ condition, wrapper, children }) => condition ? wrapper(children) : children;
|
|
276
|
-
|
|
277
|
-
const typeIcon = {
|
|
278
|
-
info: faCircleInfo,
|
|
279
|
-
error: faTriangleExclamation,
|
|
280
|
-
};
|
|
281
|
-
const Dialog = ({ title, titleEl, desc, descEl, isOpen, onClose, confirmButton, cancelButton, additionalButton, noBackgroundClick, noOverflow, type, size, noPadding, className, children, }) => {
|
|
282
|
-
const dialogRef = useRef(null);
|
|
283
|
-
const handleClose = useCallback(() => {
|
|
284
|
-
dialogRef.current?.classList.add("closing");
|
|
285
|
-
setTimeout(onClose, 200);
|
|
286
|
-
}, [dialogRef, onClose]);
|
|
287
|
-
useEffect(() => {
|
|
288
|
-
if (!noBackgroundClick) {
|
|
289
|
-
const handleClick = (ev) => ev.target === dialogRef.current && handleClose();
|
|
290
|
-
window.addEventListener("click", handleClick);
|
|
291
|
-
return () => window.removeEventListener("click", handleClick);
|
|
292
|
-
}
|
|
293
|
-
}, [noBackgroundClick, handleClose]);
|
|
294
|
-
return isOpen
|
|
295
|
-
? createPortal(jsx("div", { ref: dialogRef, className: "iui-dialog", children: jsx(ConditionalWrapper, { condition: !!confirmButton?.onFormSubmit, wrapper: (children) => (jsx("form", { onSubmit: (e) => {
|
|
296
|
-
e.preventDefault();
|
|
297
|
-
e.stopPropagation();
|
|
298
|
-
confirmButton.onFormSubmit();
|
|
299
|
-
!confirmButton.keepOpen && handleClose();
|
|
300
|
-
}, children: children })), children: jsxs("div", { className: clsx("iui-dialog-container", size, type, className), children: [title && jsx("h1", { children: title }), titleEl, jsxs("div", { className: clsx("iui-dialog-content", {
|
|
301
|
-
padding: !noPadding,
|
|
302
|
-
"no-overflow": noOverflow,
|
|
303
|
-
}), children: [type && jsx(FontAwesomeIcon, { icon: typeIcon[type] }), desc && jsx("p", { children: desc }), descEl, children] }), jsxs("div", { className: "iui-dialog-actions", children: [jsx(Button, { label: cancelButton?.label || (confirmButton ? "Otkaži" : "Ok"), icon: cancelButton?.icon, primary: !confirmButton, onClick: (e) => {
|
|
304
|
-
e.stopPropagation();
|
|
305
|
-
cancelButton?.onClick
|
|
306
|
-
? cancelButton.onClick()
|
|
307
|
-
: handleClose();
|
|
308
|
-
} }), additionalButton && (jsx(Button, { label: additionalButton.label, icon: additionalButton.icon, className: "ml-2", onClick: !!additionalButton.onClick
|
|
309
|
-
? (e) => {
|
|
310
|
-
e.stopPropagation();
|
|
311
|
-
additionalButton.onClick();
|
|
312
|
-
handleClose();
|
|
313
|
-
}
|
|
314
|
-
: undefined, disabled: additionalButton.disabled })), confirmButton && (jsx(Button, { label: confirmButton.label || "Potvrdi", icon: confirmButton.icon, primary: true, className: "ml-2", onClick: !!confirmButton.onClick
|
|
315
|
-
? (e) => {
|
|
316
|
-
e.stopPropagation();
|
|
317
|
-
confirmButton.onClick();
|
|
318
|
-
!confirmButton.keepOpen && handleClose();
|
|
319
|
-
}
|
|
320
|
-
: undefined, disabled: confirmButton.disabled }))] })] }) }) }), document.body)
|
|
321
|
-
: null;
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
const NoAccessInfo = ({ title, buttonLabel }) => {
|
|
325
|
-
const navigate = useNavigate();
|
|
326
|
-
return (jsxs("div", { className: "flex center column mt-5", children: [jsxs("svg", { id: "aa03ddf9-f8f2-4819-a4ce-be9b0a220741", "data-name": "Layer 1", xmlns: "http://www.w3.org/2000/svg", width: "40%", viewBox: "0 0 1119.60911 699", children: [jsx("title", { children: "No Access" }), jsx("circle", { cx: "292.60911", cy: "213", r: "213", fill: "#f2f2f2" }), jsx("path", { d: "M31.39089,151.64237c0,77.49789,48.6181,140.20819,108.70073,140.20819", transform: "translate(-31.39089 -100.5)", fill: "#2f2e41" }), jsx("path", { d: "M140.09162,291.85056c0-78.36865,54.255-141.78356,121.30372-141.78356", transform: "translate(-31.39089 -100.5)", fill: "#4191ff" }), jsx("path", { d: "M70.77521,158.66768c0,73.61476,31.00285,133.18288,69.31641,133.18288", transform: "translate(-31.39089 -100.5)", fill: "#4191ff" }), jsx("path", { d: "M140.09162,291.85056c0-100.13772,62.7103-181.16788,140.20819-181.16788", transform: "translate(-31.39089 -100.5)", fill: "#2f2e41" }), jsx("path", { d: "M117.22379,292.83905s15.41555-.47479,20.06141-3.783,23.713-7.2585,24.86553-1.95278,23.16671,26.38821,5.76263,26.5286-40.43935-2.711-45.07627-5.53549S117.22379,292.83905,117.22379,292.83905Z", transform: "translate(-31.39089 -100.5)", fill: "#a8a8a8" }), jsx("path", { d: "M168.224,311.78489c-17.40408.14042-40.43933-2.71094-45.07626-5.53548-3.53126-2.151-4.93843-9.86945-5.40926-13.43043-.32607.014-.51463.02-.51463.02s.97638,12.43276,5.61331,15.2573,27.67217,5.67589,45.07626,5.53547c5.02386-.04052,6.7592-1.82793,6.66391-4.47526C173.87935,310.756,171.96329,311.75474,168.224,311.78489Z", transform: "translate(-31.39089 -100.5)", opacity: "0.2" }), jsx("ellipse", { cx: "198.60911", cy: "424.5", rx: "187", ry: "25.43993", fill: "#3f3d56" }), jsx("ellipse", { cx: "198.60911", cy: "424.5", rx: "157", ry: "21.35866", opacity: "0.1" }), jsx("ellipse", { cx: "836.60911", cy: "660.5", rx: "283", ry: "38.5", fill: "#3f3d56" }), jsx("ellipse", { cx: "310.60911", cy: "645.5", rx: "170", ry: "23.12721", fill: "#3f3d56" }), jsx("path", { d: "M494,726.5c90,23,263-30,282-90", transform: "translate(-31.39089 -100.5)", fill: "none", stroke: "#2f2e41", strokeMiterlimit: "10", strokeWidth: "2" }), jsx("path", { d: "M341,359.5s130-36,138,80-107,149-17,172", transform: "translate(-31.39089 -100.5)", fill: "none", stroke: "#2f2e41", strokeMiterlimit: "10", strokeWidth: "2" }), jsx("path", { d: "M215.40233,637.78332s39.0723-10.82,41.47675,24.04449-32.15951,44.78287-5.10946,51.69566", transform: "translate(-31.39089 -100.5)", fill: "none", stroke: "#2f2e41", strokeMiterlimit: "10", strokeWidth: "2" }), jsx("path", { d: "M810.09554,663.73988,802.218,714.03505s-38.78182,20.60284-11.51335,21.20881,155.73324,0,155.73324,0,24.84461,0-14.54318-21.81478l-7.87756-52.719Z", transform: "translate(-31.39089 -100.5)", fill: "#2f2e41" }), jsx("path", { d: "M785.21906,734.69812c6.193-5.51039,16.9989-11.252,16.9989-11.252l7.87756-50.2952,113.9216.10717,7.87756,49.582c9.185,5.08711,14.8749,8.987,18.20362,11.97818,5.05882-1.15422,10.58716-5.44353-18.20362-21.38921l-7.87756-52.719-113.9216,3.02983L802.218,714.03506S769.62985,731.34968,785.21906,734.69812Z", transform: "translate(-31.39089 -100.5)", opacity: "0.1" }), jsx("rect", { x: "578.43291", y: "212.68859", width: "513.25314", height: "357.51989", rx: "18.04568", fill: "#2f2e41" }), jsx("rect", { x: "595.70294", y: "231.77652", width: "478.71308", height: "267.83694", fill: "#3f3d56" }), jsx("circle", { cx: "835.05948", cy: "223.29299", r: "3.02983", fill: "#f2f2f2" }), jsx("path", { d: "M1123.07694,621.32226V652.6628a18.04341,18.04341,0,0,1-18.04568,18.04568H627.86949A18.04341,18.04341,0,0,1,609.8238,652.6628V621.32226Z", transform: "translate(-31.39089 -100.5)", fill: "#2f2e41" }), jsx("polygon", { points: "968.978 667.466 968.978 673.526 642.968 673.526 642.968 668.678 643.417 667.466 651.452 645.651 962.312 645.651 968.978 667.466", fill: "#2f2e41" }), jsx("path", { d: "M1125.828,762.03359c-.59383,2.539-2.83591,5.21743-7.90178,7.75032-18.179,9.08949-55.1429-2.42386-55.1429-2.42386s-28.4804-4.84773-28.4804-17.573a22.72457,22.72457,0,0,1,2.49658-1.48459c7.64294-4.04351,32.98449-14.02122,77.9177.42248a18.73921,18.73921,0,0,1,8.54106,5.59715C1125.07908,756.45353,1126.50669,759.15715,1125.828,762.03359Z", transform: "translate(-31.39089 -100.5)", fill: "#2f2e41" }), jsx("path", { d: "M1125.828,762.03359c-22.251,8.526-42.0843,9.1622-62.43871-4.975-10.26507-7.12617-19.59089-8.88955-26.58979-8.75618,7.64294-4.04351,32.98449-14.02122,77.9177.42248a18.73921,18.73921,0,0,1,8.54106,5.59715C1125.07908,756.45353,1126.50669,759.15715,1125.828,762.03359Z", transform: "translate(-31.39089 -100.5)", opacity: "0.1" }), jsx("ellipse", { cx: "1066.53846", cy: "654.13477", rx: "7.87756", ry: "2.42386", fill: "#f2f2f2" }), jsx("circle", { cx: "835.05948", cy: "545.66686", r: "11.51335", fill: "#f2f2f2" }), jsx("polygon", { points: "968.978 667.466 968.978 673.526 642.968 673.526 642.968 668.678 643.417 667.466 968.978 667.466", opacity: "0.1" }), jsx("rect", { x: "108.60911", y: "159", width: "208", height: "242", fill: "#2f2e41" }), jsx("rect", { x: "87.60911", y: "135", width: "250", height: "86", fill: "#3f3d56" }), jsx("rect", { x: "87.60911", y: "237", width: "250", height: "86", fill: "#3f3d56" }), jsx("rect", { x: "87.60911", y: "339", width: "250", height: "86", fill: "#3f3d56" }), jsx("rect", { x: "271.60911", y: "150", width: "16", height: "16", fill: "#4191ff", opacity: "0.4" }), jsx("rect", { x: "294.60911", y: "150", width: "16", height: "16", fill: "#4191ff", opacity: "0.8" }), jsx("rect", { x: "317.60911", y: "150", width: "16", height: "16", fill: "#4191ff" }), jsx("rect", { x: "271.60911", y: "251", width: "16", height: "16", fill: "#4191ff", opacity: "0.4" }), jsx("rect", { x: "294.60911", y: "251", width: "16", height: "16", fill: "#4191ff", opacity: "0.8" }), jsx("rect", { x: "317.60911", y: "251", width: "16", height: "16", fill: "#4191ff" }), jsx("rect", { x: "271.60911", y: "352", width: "16", height: "16", fill: "#4191ff", opacity: "0.4" }), jsx("rect", { x: "294.60911", y: "352", width: "16", height: "16", fill: "#4191ff", opacity: "0.8" }), jsx("rect", { x: "317.60911", y: "352", width: "16", height: "16", fill: "#4191ff" }), jsx("circle", { cx: "316.60911", cy: "538", r: "79", fill: "#2f2e41" }), jsx("rect", { x: "280.60911", y: "600", width: "24", height: "43", fill: "#2f2e41" }), jsx("rect", { x: "328.60911", y: "600", width: "24", height: "43", fill: "#2f2e41" }), jsx("ellipse", { cx: "300.60911", cy: "643.5", rx: "20", ry: "7.5", fill: "#2f2e41" }), jsx("ellipse", { cx: "348.60911", cy: "642.5", rx: "20", ry: "7.5", fill: "#2f2e41" }), jsx("circle", { cx: "318.60911", cy: "518", r: "27", fill: "#fff" }), jsx("circle", { cx: "318.60911", cy: "518", r: "9", fill: "#3f3d56" }), jsx("path", { d: "M271.36733,565.03228c-6.37889-28.56758,14.01185-57.43392,45.544-64.47477s62.2651,10.41,68.644,38.9776-14.51861,39.10379-46.05075,46.14464S277.74622,593.59986,271.36733,565.03228Z", transform: "translate(-31.39089 -100.5)", fill: "#4191ff" }), jsx("ellipse", { cx: "417.21511", cy: "611.34365", rx: "39.5", ry: "12.40027", transform: "translate(-238.28665 112.98044) rotate(-23.17116)", fill: "#2f2e41" }), jsx("ellipse", { cx: "269.21511", cy: "664.34365", rx: "39.5", ry: "12.40027", transform: "translate(-271.07969 59.02084) rotate(-23.17116)", fill: "#2f2e41" }), jsx("path", { d: "M394,661.5c0,7.732-19.90861,23-42,23s-43-14.268-43-22,20.90861-6,43-6S394,653.768,394,661.5Z", transform: "translate(-31.39089 -100.5)", fill: "#fff" })] }), jsx("h1", { className: "fs-32 mt-5", children: title || "You have no access to this resource" }), jsx(Button, { label: buttonLabel || "Return to homepage", className: "mt-5", primary: true, size: "l", onClick: () => navigate("/") })] }));
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
const Checkbox = forwardRef(({ label, value, setValue, required, disabled, className, children }, ref) => (jsxs("label", { ref: ref, className: clsx("iui-checkbox clickable", className, { disabled }), children: [jsx("input", { required: required, disabled: disabled, type: "checkbox", checked: value, onChange: () => setValue(!value) }), jsx("svg", { className: clsx("icon", { selected: value }), focusable: "false", viewBox: "0 0 24 24", "aria-hidden": "true", children: value ? (jsx("path", { d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" })) : (jsx("path", { d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z" })) }), label ? jsx("p", { children: label }) : children] })));
|
|
330
|
-
|
|
331
|
-
const prefix$g = "far";
|
|
332
|
-
const iconName$g = "calendar";
|
|
333
|
-
const width$g = 448;
|
|
334
|
-
const height$g = 512;
|
|
335
|
-
const unicode$g = "f133";
|
|
336
|
-
const svgPathData$g = "M152 64H296V24C296 10.75 306.7 0 320 0C333.3 0 344 10.75 344 24V64H384C419.3 64 448 92.65 448 128V448C448 483.3 419.3 512 384 512H64C28.65 512 0 483.3 0 448V128C0 92.65 28.65 64 64 64H104V24C104 10.75 114.7 0 128 0C141.3 0 152 10.75 152 24V64zM48 448C48 456.8 55.16 464 64 464H384C392.8 464 400 456.8 400 448V192H48V448z";
|
|
337
|
-
const faCalendar = {
|
|
338
|
-
prefix: prefix$g,
|
|
339
|
-
iconName: iconName$g,
|
|
340
|
-
icon: [width$g, height$g, [], unicode$g, svgPathData$g],
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
const prefix$f = "fas";
|
|
344
|
-
const iconName$f = "xmark";
|
|
345
|
-
const width$f = 320;
|
|
346
|
-
const height$f = 512;
|
|
347
|
-
const unicode$f = "f00d";
|
|
348
|
-
const svgPathData$f = "M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z";
|
|
349
|
-
const faXmark = {
|
|
350
|
-
prefix: prefix$f,
|
|
351
|
-
iconName: iconName$f,
|
|
352
|
-
icon: [width$f, height$f, [], unicode$f, svgPathData$f],
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
const Menu = ({ isOpen, onClose, renderButton, placementX, placementY = "auto", size, className, children, }) => {
|
|
356
|
-
const menuRef = useRef(null);
|
|
357
|
-
const portalRef = useRef(null);
|
|
358
|
-
const containerRef = useRef(null);
|
|
359
|
-
const [offsets, setOffsets] = useState({
|
|
360
|
-
offsetLeft: 0,
|
|
361
|
-
offsetTop: 0,
|
|
362
|
-
});
|
|
363
|
-
const [maxHeight, setMaxHeight] = useState();
|
|
364
|
-
const recalculatePosition = useCallback(() => {
|
|
365
|
-
if (containerRef.current && menuRef.current) {
|
|
366
|
-
const containerRect = containerRef.current.getBoundingClientRect();
|
|
367
|
-
const menuRect = menuRef.current.getBoundingClientRect();
|
|
368
|
-
let offsetTop = containerRect.bottom + 5;
|
|
369
|
-
// let offsetTop = containerRect.bottom + document.documentElement.scrollTop + 5;
|
|
370
|
-
const offsetLeft = containerRect.left +
|
|
371
|
-
(placementX === "right" ? containerRect.width - menuRect.width : 0);
|
|
372
|
-
// + document.documentElement.scrollLeft;
|
|
373
|
-
if (placementY === "bottom") {
|
|
374
|
-
setMaxHeight(window.innerHeight - containerRect.bottom - 20);
|
|
375
|
-
}
|
|
376
|
-
if (placementY === "top") {
|
|
377
|
-
setMaxHeight(window.innerHeight - containerRect.top + 40
|
|
378
|
-
// - 2 * document.documentElement.scrollTop
|
|
379
|
-
);
|
|
380
|
-
}
|
|
381
|
-
// check for space on the bottom
|
|
382
|
-
if ((placementY === "auto" && offsetTop + menuRect.height > window.innerHeight) ||
|
|
383
|
-
placementY === "top") {
|
|
384
|
-
offsetTop = containerRect.top - menuRect.height - 5; //+ document.documentElement.scrollTop
|
|
385
|
-
}
|
|
386
|
-
setOffsets({ offsetTop, offsetLeft });
|
|
387
|
-
}
|
|
388
|
-
}, [menuRef, containerRef, placementX, placementY]);
|
|
389
|
-
useEffect(() => {
|
|
390
|
-
isOpen
|
|
391
|
-
? window.addEventListener("resize", recalculatePosition)
|
|
392
|
-
: window.removeEventListener("resize", recalculatePosition);
|
|
393
|
-
// Disable scroll & fix page resize on menu open
|
|
394
|
-
document.body.style.marginRight =
|
|
395
|
-
isOpen && window.innerWidth > document.body.clientWidth ? "19px" : "";
|
|
396
|
-
document.body.style.overflow = isOpen ? "hidden" : "";
|
|
397
|
-
recalculatePosition();
|
|
398
|
-
return () => {
|
|
399
|
-
window.removeEventListener("resize", recalculatePosition);
|
|
400
|
-
};
|
|
401
|
-
}, [isOpen, recalculatePosition]);
|
|
402
|
-
useEffect(() => {
|
|
403
|
-
const portal = portalRef.current;
|
|
404
|
-
const handleClick = (ev) => ev.target === portal && onClose();
|
|
405
|
-
isOpen
|
|
406
|
-
? portal?.addEventListener("click", handleClick)
|
|
407
|
-
: portal?.removeEventListener("click", handleClick);
|
|
408
|
-
return () => portal?.removeEventListener("click", handleClick);
|
|
409
|
-
}, [isOpen, onClose]);
|
|
410
|
-
return (jsxs(Fragment, { children: [renderButton(containerRef), isOpen
|
|
411
|
-
? createPortal(jsx("div", { ref: portalRef, className: "portal-background", children: jsx("div", { ref: menuRef, className: clsx("iui-menu", className, size), style: {
|
|
412
|
-
top: offsets.offsetTop + "px",
|
|
413
|
-
left: offsets.offsetLeft + "px",
|
|
414
|
-
maxHeight: maxHeight || undefined,
|
|
415
|
-
}, children: children }) }), document.body)
|
|
416
|
-
: null] }));
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
const InputWrapper = ({ label, shrink, focus, required, className, minWidth, helperText, error, children, }) => (jsxs("div", { className: clsx("iui-input-container", className, { error }), style: { minWidth }, children: [jsxs("fieldset", { className: clsx({ shrink, focus }), children: [!!label && jsx("label", { children: required && label ? `${label} *` : label }), !!label && jsx("legend", { children: required ? `${label} *` : label }), children] }), helperText && jsx("p", { className: "helper-text new-line", children: helperText })] }));
|
|
420
|
-
|
|
421
|
-
const options = {
|
|
422
|
-
day: {
|
|
423
|
-
placeholder: "dd",
|
|
424
|
-
regex: `^[0-9]{2}`,
|
|
425
|
-
},
|
|
426
|
-
month: {
|
|
427
|
-
placeholder: "mm",
|
|
428
|
-
regex: `^[0-9]{2}`,
|
|
429
|
-
},
|
|
430
|
-
year: {
|
|
431
|
-
placeholder: "yyyy",
|
|
432
|
-
regex: `^[0-9]{4}`,
|
|
433
|
-
},
|
|
434
|
-
};
|
|
435
|
-
const DatePartInput = forwardRef(({ value, setValue, setDate, values, required, disabled, autoFocus, min = 1, max, part, previousInput, nextInput, setFocus, }, ref) => {
|
|
436
|
-
const [isInvalid, setIsInvalid] = useState(false);
|
|
437
|
-
const inputRef = useRef(null);
|
|
438
|
-
useEffect(() => {
|
|
439
|
-
if (part === "year" && value.length !== 4) {
|
|
440
|
-
setIsInvalid(true);
|
|
441
|
-
}
|
|
442
|
-
else if (+value > max || +value < min) {
|
|
443
|
-
setIsInvalid(true);
|
|
444
|
-
}
|
|
445
|
-
else if (isInvalid) {
|
|
446
|
-
setIsInvalid(false);
|
|
447
|
-
}
|
|
448
|
-
}, [part, min, max, value, isInvalid]);
|
|
449
|
-
const regexTest = `^[0-9]{0,${max.toString().length}}$`;
|
|
450
|
-
const setValueHandler = (newValue) => {
|
|
451
|
-
if (!newValue) {
|
|
452
|
-
setValue("");
|
|
453
|
-
}
|
|
454
|
-
else if (new RegExp(regexTest).test(newValue)) {
|
|
455
|
-
setValue(newValue);
|
|
456
|
-
const year = part === "year" ? newValue : values.year;
|
|
457
|
-
const month = part === "month" ? newValue : values.month;
|
|
458
|
-
const day = part === "day" ? newValue : values.day;
|
|
459
|
-
if (day && month && year.length === 4) {
|
|
460
|
-
setDate(`${year}-${month.length === 2 ? month : `0${month}`}-${day.length === 2 ? day : `0${day}`}`);
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
};
|
|
464
|
-
return (jsx("input", { ref: ref || inputRef, value: value || "", onChange: (e) => setValueHandler(e.target.value), onClick: (e) => e.stopPropagation(), onKeyDown: (e) => {
|
|
465
|
-
if (e.key === "ArrowLeft") {
|
|
466
|
-
e.preventDefault();
|
|
467
|
-
previousInput?.select();
|
|
468
|
-
}
|
|
469
|
-
else if (e.key === "ArrowRight") {
|
|
470
|
-
e.preventDefault();
|
|
471
|
-
nextInput?.select();
|
|
472
|
-
}
|
|
473
|
-
}, onKeyUp: (e) => {
|
|
474
|
-
if (part !== "year" && isFinite(+e.key) && value.length === 2) {
|
|
475
|
-
nextInput?.select();
|
|
476
|
-
}
|
|
477
|
-
}, onFocus: (e) => {
|
|
478
|
-
setFocus(true);
|
|
479
|
-
e.target.select();
|
|
480
|
-
}, onBlur: () => setFocus(false), required: required, disabled: disabled, autoFocus: autoFocus, min: min, max: max, inputMode: "numeric", type: "number", tabIndex: part !== "day" ? -1 : undefined, placeholder: options[part].placeholder, pattern: options[part].regex, className: clsx({ error: isInvalid }), style: {
|
|
481
|
-
width: part === "year" && !value
|
|
482
|
-
? "4ch"
|
|
483
|
-
: part === "month" && !value
|
|
484
|
-
? 23
|
|
485
|
-
: `${value.length || 2}ch`,
|
|
486
|
-
} }));
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
const DateInput = forwardRef(({ label, date, setDate, required, disabled, autoFocus, helperText, error, className, calendarPlacementX, }, ref) => {
|
|
490
|
-
const [day, setDay] = useState(date?.split("-")[2] || "");
|
|
491
|
-
const [month, setMonth] = useState(date?.split("-")[1] || "");
|
|
492
|
-
const [year, setYear] = useState(date?.split("-")[0] || "");
|
|
493
|
-
const [isCalendarOpen, setIsCalendarOpen] = useState(false);
|
|
494
|
-
const [focus, setFocus] = useState(false);
|
|
495
|
-
const inputsRef = useRef(null);
|
|
496
|
-
const dayRef = useRef(null);
|
|
497
|
-
const monthRef = useRef(null);
|
|
498
|
-
const yearRef = useRef(null);
|
|
499
|
-
const maxDay = year && month ? new Date(+year, +month, 0).getDate() : 31;
|
|
500
|
-
useEffect(() => {
|
|
501
|
-
if (!date) {
|
|
502
|
-
setYear("");
|
|
503
|
-
setMonth("");
|
|
504
|
-
setDay("");
|
|
505
|
-
}
|
|
506
|
-
else if (![dayRef.current, monthRef.current, yearRef.current].includes(document.activeElement)) {
|
|
507
|
-
setYear(date.split("-")[0] || "");
|
|
508
|
-
setMonth(date.split("-")[1] || "");
|
|
509
|
-
setDay(date.split("-")[2] || "");
|
|
510
|
-
}
|
|
511
|
-
}, [date]);
|
|
512
|
-
return (jsx(InputWrapper, { label: label, shrink: true, focus: focus || isCalendarOpen, required: required, helperText: helperText, className: className, error: error, children: jsx(Menu, { isOpen: isCalendarOpen, onClose: () => setIsCalendarOpen(false), placementX: calendarPlacementX || "left", renderButton: (ref) => (jsxs("div", { ref: ref, className: clsx("date-input", { disabled }), children: [jsxs("div", { ref: inputsRef, className: "inputs", onClick: () => dayRef.current?.focus(), children: [jsx(DatePartInput, { ref: dayRef, value: day, setValue: setDay, setDate: setDate, values: { day, month, year }, required: required || !!month || !!year, disabled: disabled, autoFocus: autoFocus, max: maxDay, part: "day", nextInput: monthRef.current, setFocus: setFocus }), jsx("span", { children: "." }), jsx(DatePartInput, { ref: monthRef, value: month, setValue: setMonth, setDate: setDate, values: { day, month, year }, required: required || !!day || !!year, disabled: disabled, max: 12, part: "month", previousInput: dayRef.current, nextInput: yearRef.current, setFocus: setFocus }), jsx("span", { children: "." }), jsx(DatePartInput, { ref: yearRef, value: year, setValue: setYear, setDate: setDate, values: { day, month, year }, required: required || !!day || !!month, disabled: disabled, min: 1500, max: 2500, part: "year", previousInput: monthRef.current, setFocus: setFocus })] }), jsxs("div", { className: "flex", children: [jsx("div", { className: clsx("button", { disabled }), onClick: () => !disabled && setDate(""), children: jsx(FontAwesomeIcon, { icon: faXmark }) }), jsx("div", { className: clsx("button", { disabled }), onClick: () => !disabled && setIsCalendarOpen(!isCalendarOpen), children: jsx(FontAwesomeIcon, { icon: faCalendar }) })] })] })), children: jsx(Calendar, { value: date
|
|
513
|
-
? moment$1(date).isValid()
|
|
514
|
-
? new Date(date)
|
|
515
|
-
: new Date()
|
|
516
|
-
: null, onChange: (e) => {
|
|
517
|
-
const newDate = formatDateYMD(e);
|
|
518
|
-
setDate(newDate);
|
|
519
|
-
setIsCalendarOpen(false);
|
|
520
|
-
} }) }) }));
|
|
521
|
-
});
|
|
522
|
-
|
|
523
|
-
const LargeTextInput = forwardRef(({ label, value, setValue, required, disabled, autoFocus, rows, placeholder, helperText, className, inputProps, error, }, ref) => {
|
|
524
|
-
const [focus, setFocus] = useState(false);
|
|
525
|
-
const [isAutoFill, setIsAutoFill] = useState(false);
|
|
526
|
-
return (jsx(InputWrapper, { label: label, shrink: !!(value || placeholder || isAutoFill), focus: focus, required: required, helperText: helperText, className: className, error: error, children: jsx("textarea", { ref: ref, autoFocus: autoFocus, onFocus: () => {
|
|
527
|
-
setFocus(true);
|
|
528
|
-
isAutoFill && setIsAutoFill(false);
|
|
529
|
-
}, onBlur: () => setFocus(false), placeholder: required && placeholder ? `${placeholder} *` : placeholder, value: value || "", onChange: (e) => setValue(e.target.value), rows: rows, required: required, disabled: disabled, onAnimationStart: () => setIsAutoFill(true), ...inputProps }) }));
|
|
530
|
-
});
|
|
531
|
-
|
|
532
|
-
const TextInput = forwardRef(({ label, value, setValue, required, disabled, autoFocus, placeholder, helperText, className, inputProps, error, endButton, }, ref) => {
|
|
533
|
-
const [focus, setFocus] = useState(false);
|
|
534
|
-
const [isAutoFill, setIsAutoFill] = useState(false);
|
|
535
|
-
return (jsx(InputWrapper, { label: label, shrink: !!(value || placeholder || isAutoFill), focus: focus, required: required, helperText: helperText, className: className, error: error, children: jsxs("div", { className: clsx("flex align-center", { "with-end-button": endButton }), children: [jsx("input", { ref: ref, autoFocus: autoFocus, onFocus: () => {
|
|
536
|
-
setFocus(true);
|
|
537
|
-
isAutoFill && setIsAutoFill(false);
|
|
538
|
-
}, onBlur: () => setFocus(false), placeholder: required && placeholder ? `${placeholder} *` : placeholder, value: value || "", onChange: (e) => setValue(e.target.value), required: required, disabled: disabled, onAnimationStart: () => setIsAutoFill(true), ...inputProps }), endButton && (jsx(FontAwesomeIcon, { className: endButton.disabled ? "disabled" : undefined, icon: endButton.icon, onClick: !endButton.disabled ? endButton.onClick : undefined }))] }) }));
|
|
539
|
-
});
|
|
540
|
-
|
|
541
|
-
const NumberInput = forwardRef(({ value, setValue, label, required, disabled, autoFocus, placeholder, helperText, className, allowNegative, decimalPlaces, error, alignLeft, inputProps, }, ref) => {
|
|
542
|
-
const setValueHandler = (e) => {
|
|
543
|
-
if (decimalPlaces) {
|
|
544
|
-
(new RegExp(`^${allowNegative ? '-?' : ''}\\d*(?:[.,])?(\\d{1,${decimalPlaces}})?$`).test(e) ||
|
|
545
|
-
!e) &&
|
|
546
|
-
setValue(e ? e.replaceAll(',', '.') : e);
|
|
547
|
-
}
|
|
548
|
-
else {
|
|
549
|
-
(new RegExp(`^${allowNegative ? '-?' : ''}\\d*$`).test(e) || !e) && setValue(e);
|
|
550
|
-
}
|
|
551
|
-
};
|
|
552
|
-
return (jsx(TextInput, { ref: ref, value: value ? `${value}`.replaceAll('.', ',') : '', setValue: setValueHandler, label: label, required: required, disabled: disabled, placeholder: placeholder
|
|
553
|
-
? placeholder
|
|
554
|
-
: decimalPlaces
|
|
555
|
-
? `0.${'0'.repeat(decimalPlaces)}`
|
|
556
|
-
: '0', inputProps: {
|
|
557
|
-
className: alignLeft ? undefined : 'text-right',
|
|
558
|
-
pattern: `^${allowNegative ? '-?' : ''}\\d+${decimalPlaces ? `(?:[.,])?(\\d{1,${decimalPlaces}})?` : ''}$`,
|
|
559
|
-
lang: 'sr-RS',
|
|
560
|
-
inputMode: 'numeric',
|
|
561
|
-
...inputProps,
|
|
562
|
-
}, className: className, autoFocus: autoFocus, helperText: helperText, error: error }));
|
|
563
|
-
});
|
|
564
|
-
|
|
565
|
-
const prefix$e = "fad";
|
|
566
|
-
const iconName$e = "eye";
|
|
567
|
-
const width$e = 576;
|
|
568
|
-
const height$e = 512;
|
|
569
|
-
const unicode$e = "f06e";
|
|
570
|
-
const svgPathData$e = [
|
|
571
|
-
"M572.5 238.1C518.3 115.5 410.9 32 288 32S57.69 115.6 3.469 238.1C1.563 243.4 0 251 0 256c0 4.977 1.562 12.6 3.469 17.03C57.72 396.5 165.1 480 288 480s230.3-83.58 284.5-206.1C574.4 268.6 576 260.1 576 256C576 251 574.4 243.4 572.5 238.1zM432 256c0 79.45-64.47 144-143.9 144C208.6 400 144 335.5 144 256S208.5 112 288 112S432 176.5 432 256z",
|
|
572
|
-
"M288 160C285.7 160 282.4 160.4 279.5 160.8C284.8 170 288 180.6 288 192c0 35.35-28.65 64-64 64C212.6 256 201.1 252.7 192.7 247.5C192.4 250.5 192 253.6 192 256c0 52.1 43 96 96 96s96-42.99 96-95.99S340.1 160 288 160z",
|
|
573
|
-
];
|
|
574
|
-
const faEye = {
|
|
575
|
-
prefix: prefix$e,
|
|
576
|
-
iconName: iconName$e,
|
|
577
|
-
icon: [width$e, height$e, [], unicode$e, svgPathData$e],
|
|
578
|
-
};
|
|
579
|
-
|
|
580
|
-
const prefix$d = "fad";
|
|
581
|
-
const iconName$d = "eye-slash";
|
|
582
|
-
const width$d = 640;
|
|
583
|
-
const height$d = 512;
|
|
584
|
-
const unicode$d = "f070";
|
|
585
|
-
const svgPathData$d = [
|
|
586
|
-
"M149.2 91.63c49.62-37.69 108.1-59.62 170.8-59.62c122.9 0 230.3 83.53 284.5 206.1c1.906 4.43 3.469 12.05 3.469 17.03c0 4.957-1.562 12.6-3.469 17.03c-19.42 44.19-45.89 83.01-77.21 114.1l-81.27-63.69c11.09-20.4 17.95-43.44 17.95-68.27c0-79.48-64.5-144-143.1-144c-37.29 0-70.83 14.65-96.42 37.93L149.2 91.63zM319.1 160c-2.301 .0293-5.575 .4436-8.461 .7658C316.8 170 319.1 180.6 319.1 192c0 10.17-2.602 19.62-6.821 28.16l94.71 74.24c5.158-11.78 8.114-24.73 8.114-38.4C415.1 203 372.1 160 319.1 160zM319.1 352c-46.96 0-85.92-33.81-94.22-78.37l99.33 77.86C323.4 351.6 321.8 352 319.1 352zM373.6 389.5l74.5 58.4c-39.3 20.65-82.61 32.14-128.1 32.14c-122.9 0-230.3-83.53-284.5-206.1c-1.906-4.43-3.469-12.05-3.469-17.03c0-4.959 1.562-12.6 3.469-17.03c12.54-28.55 28.04-54.84 45.81-78.59l96.72 75.8C177.1 242.7 175.1 249.2 175.1 256c0 79.48 64.53 143.1 144 143.1C338.1 400 356.1 396.1 373.6 389.5z",
|
|
587
|
-
"M615.1 512c-5.188 0-10.39-1.651-14.8-5.12L9.188 42.89C-1.234 34.73-3.051 19.63 5.121 9.189c8.188-10.41 23.22-12.29 33.69-4.073l591.1 463.1c10.42 8.156 12.24 23.26 4.068 33.7C630.1 508.8 623.1 512 615.1 512z",
|
|
588
|
-
];
|
|
589
|
-
const faEyeSlash = {
|
|
590
|
-
prefix: prefix$d,
|
|
591
|
-
iconName: iconName$d,
|
|
592
|
-
icon: [width$d, height$d, [], unicode$d, svgPathData$d],
|
|
593
|
-
};
|
|
594
|
-
|
|
595
|
-
const PasswordInput = (props) => {
|
|
596
|
-
const [showPassword, setShowPassword] = useState(false);
|
|
597
|
-
return (jsx(TextInput, { ...props, inputProps: {
|
|
598
|
-
type: showPassword ? "text" : "password",
|
|
599
|
-
autoComplete: props.newPassword ? "new-password" : undefined,
|
|
600
|
-
...props.inputProps,
|
|
601
|
-
}, endButton: {
|
|
602
|
-
icon: showPassword ? faEyeSlash : faEye,
|
|
603
|
-
onClick: () => setShowPassword(!showPassword),
|
|
604
|
-
} }));
|
|
605
|
-
};
|
|
606
|
-
|
|
607
|
-
const Radio = forwardRef(({ label, value, selected, setSelected, disabled, className, children }, ref) => (jsxs("div", { ref: ref, className: clsx("iui-radio", className, selected === value ? "selected" : "clickable", { disabled }), onClick: selected !== value ? () => !disabled && setSelected(value) : undefined, children: [jsxs("div", { className: "iui-radio-icon", children: [jsx("svg", { className: clsx("icon", { selected: selected === value }), focusable: "false", viewBox: "0 0 24 24", "aria-hidden": "true", children: jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z" }) }), jsx("svg", { className: clsx("icon secondary", { selected: selected === value }), focusable: "false", viewBox: "0 0 24 24", "aria-hidden": "true", children: jsx("path", { d: "M8.465 8.465C9.37 7.56 10.62 7 12 7C14.76 7 17 9.24 17 12C17 13.38 16.44 14.63 15.535 15.535C14.63 16.44 13.38 17 12 17C9.24 17 7 14.76 7 12C7 10.62 7.56 9.37 8.465 8.465Z" }) })] }), label ? jsx("p", { children: label }) : children] })));
|
|
608
|
-
|
|
609
|
-
const createSelectStyles = (menuWidth) => ({
|
|
610
|
-
control: provided => ({
|
|
611
|
-
...provided,
|
|
612
|
-
border: 'none',
|
|
613
|
-
borderRadius: 12,
|
|
614
|
-
boxShadow: 'none',
|
|
615
|
-
minHeight: 36,
|
|
616
|
-
}),
|
|
617
|
-
valueContainer: (provided, state) => ({
|
|
618
|
-
...provided,
|
|
619
|
-
padding: state.isMulti ? '8px 14px' : '10px 14px',
|
|
620
|
-
fontSize: 13,
|
|
621
|
-
}),
|
|
622
|
-
menu: provided => ({
|
|
623
|
-
...provided,
|
|
624
|
-
marginTop: 2,
|
|
625
|
-
width: menuWidth || '100%',
|
|
626
|
-
minWidth: '100%',
|
|
627
|
-
borderRadius: 8,
|
|
628
|
-
boxShadow: `0px 5px 5px -3px rgb(0 0 0 / 20%), 0px 8px 10px 1px rgba(0, 0, 0, 0.14),
|
|
629
|
-
0px 3px 14px 2px rgba(0, 0, 0, 0.12);`,
|
|
630
|
-
}),
|
|
631
|
-
menuPortal: provided => ({ ...provided, zIndex: 1001 }),
|
|
632
|
-
input: provided => ({
|
|
633
|
-
...provided,
|
|
634
|
-
padding: 0,
|
|
635
|
-
margin: 0,
|
|
636
|
-
borderRadius: 12,
|
|
637
|
-
}),
|
|
638
|
-
option: (provided, state) => ({
|
|
639
|
-
...provided,
|
|
640
|
-
fontSize: 13,
|
|
641
|
-
backgroundColor: state.isSelected
|
|
642
|
-
? 'var(--primary) !important'
|
|
643
|
-
: state.isFocused
|
|
644
|
-
? '#eee !important'
|
|
645
|
-
: 'inherit',
|
|
646
|
-
}),
|
|
647
|
-
noOptionsMessage: provided => ({
|
|
648
|
-
...provided,
|
|
649
|
-
fontSize: 13,
|
|
650
|
-
fontStyle: 'italic',
|
|
651
|
-
}),
|
|
652
|
-
multiValue: provided => ({
|
|
653
|
-
...provided,
|
|
654
|
-
backgroundColor: 'var(--primary-o25)',
|
|
655
|
-
}),
|
|
656
|
-
});
|
|
657
|
-
const Select = ({ label, options, value, valuesMulti, onChange, required, disabled, placeholder = '', helperText, className, minWidth, menuWidth, autoFocus, isClearable, isOpen, openDirection = 'auto', noOptionsMessage, error, }) => {
|
|
658
|
-
const [focus, setFocus] = useState(false);
|
|
659
|
-
const ref = useRef(null);
|
|
660
|
-
return (jsxs(InputWrapper, { label: label, shrink: !!(value || valuesMulti?.length || placeholder), focus: focus, required: required, helperText: helperText, className: clsx('select-wrapper', className), minWidth: minWidth, error: error, children: [jsx(ReactSelect, { value: value || valuesMulti || null, options: options, onChange: onChange, placeholder: !label && required ? `${placeholder} *` : placeholder, className: className, styles: createSelectStyles(menuWidth), isDisabled: disabled, isOptionDisabled: (option) => option.disabled, isClearable: isClearable, isMulti: !!valuesMulti, menuIsOpen: isOpen, menuPlacement: openDirection, menuPortalTarget: document.querySelector('body'), ref: ref, onFocus: () => setFocus(true), onBlur: () => setFocus(false), autoFocus: autoFocus, noOptionsMessage: () => noOptionsMessage || 'Nema opcija' }), required && !disabled && (jsx("input", { className: "fake-input", required: true, tabIndex: -1, autoComplete: "off", value: value?.value || valuesMulti?.length || '', onChange: () => { }, onFocus: () => ref.current?.focus() }))] }));
|
|
661
|
-
};
|
|
662
|
-
|
|
663
|
-
const SelectAsyncPaginate = ({ label, value, valuesMulti, loadOptions, refresh, onChange, required, disabled, placeholder = "", helperText, className, minWidth, menuWidth, autoFocus, isMulti, isClearable, isOpen, openDirection = "auto", noOptionsMessage, error, }) => {
|
|
664
|
-
const [focus, setFocus] = useState(false);
|
|
665
|
-
const ref = useRef(null);
|
|
666
|
-
return (jsxs(InputWrapper, { label: label, shrink: !!(value || valuesMulti?.length || placeholder), focus: focus, required: required, helperText: helperText, className: clsx("select-wrapper", className), minWidth: minWidth, error: error, children: [jsx(AsyncPaginate, { value: value || valuesMulti || null, loadOptions: loadOptions, additional: { page: 0 }, onChange: onChange, placeholder: !label && required ? `${placeholder} *` : placeholder, className: className, styles: createSelectStyles(menuWidth), isDisabled: disabled, isOptionDisabled: (option) => option.disabled, isClearable: isClearable, isMulti: isMulti, menuIsOpen: isOpen, menuPlacement: openDirection, menuPortalTarget: document.querySelector("body"), selectRef: ref, onFocus: () => setFocus(true), onBlur: () => setFocus(false), autoFocus: autoFocus, noOptionsMessage: () => noOptionsMessage || "Nema opcija", cacheUniqs: refresh || undefined }), required && !disabled && (jsx("input", { className: "fake-input", required: true, tabIndex: -1, autoComplete: "off", value: value?.value || valuesMulti?.length || "", onChange: () => { }, onFocus: () => ref.current?.focus() }))] }));
|
|
667
|
-
};
|
|
668
|
-
|
|
669
|
-
const Loader = ({ isLoading, logo, fullWidth, children }) => (jsxs("div", { className: `iui-loader-container ${fullWidth ? "full-width" : "width-fit"}`, children: [jsx("div", { className: clsx("iui-loading-content", { opacity: isLoading }), children: children }), isLoading && (jsxs("div", { className: "iui-loader", children: [logo && jsx("img", { className: "iui-loader-logo", alt: "logo", src: logo }), jsx("progress", { className: "linear-progress" })] }))] }));
|
|
670
|
-
const FullScreenLoader = ({ isLoading, logo, }) => isLoading ? (jsx("div", { className: "full-screen-loader", children: jsxs("div", { className: "iui-loader", children: [logo && jsx("img", { className: "iui-loader-logo", alt: "logo", src: logo }), jsx("progress", { className: "linear-progress" })] }) })) : null;
|
|
671
|
-
const LazyLoader = ({ logo }) => (jsx("div", { className: "lazy-loader", children: jsxs("div", { className: "iui-loader", children: [logo && jsx("img", { className: "iui-loader-logo", alt: "logo", src: logo }), jsx("progress", { className: "linear-progress" })] }) }));
|
|
672
|
-
|
|
673
|
-
const MenuItem = ({ label, icon, iconRotation, onClick, to, disabled, withDevider, className, children, }) => (jsx("div", { className: clsx('iui-menu-item', className, {
|
|
674
|
-
clickable: !!onClick || !!to,
|
|
675
|
-
disabled,
|
|
676
|
-
'with-devider': withDevider,
|
|
677
|
-
}), onClick: disabled ? undefined : onClick, children: jsx(ConditionalWrapper, { condition: !disabled && !!to, wrapper: children => jsx(Link, { to: to, children: children }), children: jsxs("div", { className: "flex align-center", children: [icon && jsx(FontAwesomeIcon, { icon: icon, rotation: iconRotation, className: "mr-2" }), label && jsx("p", { className: "full-width", children: label }), children] }) }, label) }));
|
|
678
|
-
|
|
679
|
-
const Header = ({ moduleName, children }) => {
|
|
680
|
-
return (jsxs("div", { className: "iui-header", children: [jsx("div", { className: "flex gap-3 align-center", children: jsx("h1", { children: moduleName }) }), jsx("div", { className: "flex gap-2 align-center", children: children })] }));
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
const Tooltip = ({ label, position = "bottom", disabled, className, children, }) => {
|
|
684
|
-
const [newPosition, setNewPosition] = useState("");
|
|
685
|
-
const containerRef = useRef(null);
|
|
686
|
-
const tooltipRef = useRef(null);
|
|
687
|
-
useEffect(() => {
|
|
688
|
-
if (!disabled && !!label) {
|
|
689
|
-
const container = containerRef.current;
|
|
690
|
-
const tooltip = tooltipRef.current;
|
|
691
|
-
const onMouseEnter = () => {
|
|
692
|
-
if (container && tooltip) {
|
|
693
|
-
setAbsolutePosition(container, tooltip, position, setNewPosition);
|
|
694
|
-
tooltip?.classList.add("visible");
|
|
695
|
-
}
|
|
696
|
-
};
|
|
697
|
-
const onMouseLeave = () => tooltip?.classList.remove("visible");
|
|
698
|
-
container?.addEventListener("mouseenter", onMouseEnter);
|
|
699
|
-
container?.addEventListener("mouseleave", onMouseLeave);
|
|
700
|
-
return () => {
|
|
701
|
-
container?.removeEventListener("mouseenter", onMouseEnter);
|
|
702
|
-
container?.removeEventListener("mouseleave", onMouseLeave);
|
|
703
|
-
};
|
|
704
|
-
}
|
|
705
|
-
}, [disabled, label, position]);
|
|
706
|
-
return !!label && !disabled ? (jsxs(Fragment, { children: [cloneElement(children, { ref: containerRef }), createPortal(jsx("div", { ref: tooltipRef, className: clsx("tooltip-container", className), children: jsxs("div", { className: "tooltip", children: [jsx("div", { className: clsx("arrow", newPosition || position) }), jsx("div", { children: label })] }) }), document.body)] })) : (children);
|
|
707
|
-
};
|
|
708
|
-
const setAbsolutePosition = (containerEl, targetEl, position, setNewPosition) => {
|
|
709
|
-
const containerRect = containerEl.getBoundingClientRect();
|
|
710
|
-
const tooltipRect = targetEl.getBoundingClientRect();
|
|
711
|
-
if (position === "bottom" || position === "top") {
|
|
712
|
-
const bottom = Math.floor(containerRect.bottom + 16);
|
|
713
|
-
const top = Math.floor(containerRect.top - tooltipRect.height - 16);
|
|
714
|
-
const leftCenter = Math.floor(containerRect.left + containerRect.width / 2 - tooltipRect.width / 2);
|
|
715
|
-
const reverse = position === "top"
|
|
716
|
-
? top < 0
|
|
717
|
-
: bottom + tooltipRect.height > window.innerHeight;
|
|
718
|
-
setNewPosition(reverse ? (position === "bottom" ? "top" : "bottom") : "");
|
|
719
|
-
targetEl.style.top = `${position === "bottom" ? (reverse ? top : bottom) : reverse ? bottom : top}px`;
|
|
720
|
-
targetEl.style.left = `${leftCenter}px`;
|
|
721
|
-
}
|
|
722
|
-
else if (position === "right") {
|
|
723
|
-
targetEl.style.top =
|
|
724
|
-
Math.floor(containerRect.top + containerRect.height / 2 - tooltipRect.height / 2) + "px";
|
|
725
|
-
targetEl.style.left = Math.floor(containerRect.right + 16) + "px";
|
|
726
|
-
}
|
|
727
|
-
else if (position === "left") {
|
|
728
|
-
targetEl.style.top =
|
|
729
|
-
Math.floor(containerRect.top + containerRect.height / 2 - tooltipRect.height / 2) + "px";
|
|
730
|
-
targetEl.style.left =
|
|
731
|
-
Math.floor(containerRect.left - tooltipRect.width - 16) + "px";
|
|
732
|
-
}
|
|
733
|
-
};
|
|
734
|
-
|
|
735
|
-
const prefix$c = "fad";
|
|
736
|
-
const iconName$c = "circle-plus";
|
|
737
|
-
const width$c = 512;
|
|
738
|
-
const height$c = 512;
|
|
739
|
-
const unicode$c = "f055";
|
|
740
|
-
const svgPathData$c = [
|
|
741
|
-
"M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256C397.4 512 512 397.4 512 256S397.4 0 256 0zM352 280H280V352c0 13.2-10.8 24-23.1 24C242.8 376 232 365.2 232 352V280H160C146.8 280 136 269.2 136 256c0-13.2 10.8-24 24-24H232V160c0-13.2 10.8-24 24-24C269.2 136 280 146.8 280 160v72h72C365.2 232 376 242.8 376 256C376 269.2 365.2 280 352 280z",
|
|
742
|
-
"M352 280H280V352c0 13.2-10.8 24-23.1 24C242.8 376 232 365.2 232 352V280H160C146.8 280 136 269.2 136 256c0-13.2 10.8-24 24-24H232V160c0-13.2 10.8-24 24-24C269.2 136 280 146.8 280 160v72h72C365.2 232 376 242.8 376 256C376 269.2 365.2 280 352 280z",
|
|
743
|
-
];
|
|
744
|
-
const faPlusCircle = {
|
|
745
|
-
prefix: prefix$c,
|
|
746
|
-
iconName: iconName$c,
|
|
747
|
-
icon: [width$c, height$c, [], unicode$c, svgPathData$c],
|
|
748
|
-
};
|
|
749
|
-
|
|
750
|
-
const AddButton = ({ link }) => {
|
|
751
|
-
const navigate = useNavigate$1();
|
|
752
|
-
return (jsx(IconButton, { className: "add-button", icon: faPlusCircle, onClick: (e) => {
|
|
753
|
-
e.preventDefault();
|
|
754
|
-
navigate(link);
|
|
755
|
-
} }));
|
|
756
|
-
};
|
|
757
|
-
|
|
758
|
-
const SidebarItem = ({ label, icon, to, badge, menu, collapsed, }) => {
|
|
759
|
-
const { pathname } = useLocation();
|
|
760
|
-
return (jsxs(Fragment, { children: [jsx(ConditionalWrapper, { condition: !!to, wrapper: (children) => jsx(Link, { to: to, children: children }), children: jsxs("div", { onClick: menu
|
|
761
|
-
? () => menu.setOpenedMenu(label !== menu.openedMenu ? label : "")
|
|
762
|
-
: undefined, className: clsx("iui-sidebar-item clickable", {
|
|
763
|
-
active: to === pathname ||
|
|
764
|
-
(menu?.content.find((e) => e.to === pathname) &&
|
|
765
|
-
label !== menu?.openedMenu),
|
|
766
|
-
}), children: [jsxs("div", { className: "flex align-center", children: [jsx(FontAwesomeIcon, { icon: icon, className: "sidebar-icon" }), jsx("p", { className: clsx({ "content-hidden": collapsed }), children: label })] }), menu && (jsxs("div", { className: "flex align-center gap-1", children: [!!badge && (jsx("div", { className: "notification-badge", children: badge > 99 ? "99+" : badge })), jsx(FontAwesomeIcon, { icon: faAngleDown, className: clsx("sidebar-expand-icon", {
|
|
767
|
-
rotate: label === menu.openedMenu,
|
|
768
|
-
}) })] }))] }) }), menu && (jsx(Collapse, { className: clsx({ "content-hidden": collapsed }), isOpen: menu.openedMenu === label, children: menu.content.map(({ hidden, label, to, primary, badge, addUrl, tooltip }) => !hidden && (jsx(ConditionalWrapper, { condition: !!to, wrapper: (children) => jsx(Link, { to: to, children: children }), children: jsx(Tooltip, { label: tooltip, disabled: !tooltip, position: "right", children: jsxs("div", { className: clsx("iui-sidebar-sub-item", {
|
|
769
|
-
clickable: !!to,
|
|
770
|
-
active: to === pathname,
|
|
771
|
-
primary,
|
|
772
|
-
}), children: [jsx("p", { children: maxChar(label, 20) }), jsxs("div", { className: "flex align-center gap-1", children: [!!badge && (jsx("div", { className: "notification-badge", children: badge > 99 ? "99+" : badge })), !!addUrl && jsx(AddButton, { link: addUrl })] })] }) }) }, label))) }))] }));
|
|
773
|
-
};
|
|
774
|
-
|
|
775
|
-
const prefix$b = "fas";
|
|
776
|
-
const iconName$b = "angle-left";
|
|
777
|
-
const width$b = 256;
|
|
778
|
-
const height$b = 512;
|
|
779
|
-
const unicode$b = "f104";
|
|
780
|
-
const svgPathData$b = "M192 448c-8.188 0-16.38-3.125-22.62-9.375l-160-160c-12.5-12.5-12.5-32.75 0-45.25l160-160c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25L77.25 256l137.4 137.4c12.5 12.5 12.5 32.75 0 45.25C208.4 444.9 200.2 448 192 448z";
|
|
781
|
-
const faAngleLeft = {
|
|
782
|
-
prefix: prefix$b,
|
|
783
|
-
iconName: iconName$b,
|
|
784
|
-
icon: [width$b, height$b, [], unicode$b, svgPathData$b],
|
|
785
|
-
};
|
|
786
|
-
|
|
787
|
-
const Sidebar = ({ items, UserBox, logo,
|
|
788
|
-
// toggleText,
|
|
789
|
-
collapsed, setCollapsed, }) => {
|
|
790
|
-
const [itemsList, setItemsList] = useState([]);
|
|
791
|
-
const [openedMenu, setOpenedMenu] = useState("");
|
|
792
|
-
const sidebarRef = useRef(null);
|
|
793
|
-
useEffect(() => {
|
|
794
|
-
collapsed
|
|
795
|
-
? setTimeout(() => {
|
|
796
|
-
sidebarRef.current?.classList.add("sidebar-hover");
|
|
797
|
-
}, 300)
|
|
798
|
-
: sidebarRef.current?.classList.remove("sidebar-hover");
|
|
799
|
-
}, [collapsed]);
|
|
800
|
-
useEffect(() => {
|
|
801
|
-
// Filter out hidden items & items without visible content
|
|
802
|
-
const newItems = items.map((list) => list.filter((item) => !item.hidden &&
|
|
803
|
-
(item.to || item.content?.some((item) => !item.hidden))));
|
|
804
|
-
setItemsList(newItems);
|
|
805
|
-
}, [items, setItemsList]);
|
|
806
|
-
return (jsxs("div", { ref: sidebarRef, className: clsx("iui-sidebar", { collapsed }), children: [!!setCollapsed && (jsx("div", { className: clsx("sidebar-colapse", { collapsed }), children: jsx(IconButton, { icon: faAngleLeft, className: clsx("toggle-btn", { "fa-flip-horizontal": collapsed }), onClick: () => setCollapsed(!collapsed) }) })), UserBox, jsxs("div", { className: "iui-sidebar-content", children: [jsx("div", { className: "iui-sidebar-items", children: itemsList.map((e, i) => (jsxs(Fragment$1, { children: [i > 0 && !!e.length && jsx("hr", { className: "mx-3" }), e.map((item) => !item.hidden && (createElement(SidebarItem, { ...item, key: item.label, menu: item.content
|
|
807
|
-
? { content: item.content, openedMenu, setOpenedMenu }
|
|
808
|
-
: undefined, collapsed: collapsed })))] }, i))) }), logo && (jsx("div", { className: "flex center", children: jsx("img", { className: "sidebar-logo", src: logo, alt: "logo" }) }))] })] }));
|
|
809
|
-
};
|
|
810
|
-
|
|
811
|
-
const prefix$a = "far";
|
|
812
|
-
const iconName$a = "filter-circle-xmark";
|
|
813
|
-
const width$a = 576;
|
|
814
|
-
const height$a = 512;
|
|
815
|
-
const unicode$a = "e17b";
|
|
816
|
-
const svgPathData$a = "M432 224C352.5 224 288 288.5 288 368s64.47 144 144 144s144-64.47 144-144S511.5 224 432 224zM488.5 401.9c6.242 6.242 6.252 16.37 .0098 22.62c-6.24 6.242-16.37 6.231-22.62-.0113l-33.91-33.91l-33.91 33.91c-6.242 6.242-16.37 6.253-22.62 .0106s-6.232-16.37 .0098-22.62l33.91-33.91l-33.91-33.91c-6.242-6.242-6.251-16.37-.009-22.62s16.37-6.232 22.62 .0106l33.91 33.91l33.91-33.91c6.242-6.242 16.37-6.254 22.61-.0113s6.233 16.37-.009 22.62l-33.91 33.91L488.5 401.9zM223.1 340.7V272.2c0-7.369-2.539-14.51-7.191-20.22L50.77 48.04h410.4l-85.57 105.1c-7.77 9.545-7.061 23.42 1.643 32.13c10.06 10.06 26.62 9.219 35.6-1.812l88.61-108.8c11.26-13.46 13.7-31.89 6.225-47.92C500 10.23 483.8 0 465.3 0H46.65C28.21 0 11.97 10.23 4.283 26.71C-3.195 42.73-.7578 61.16 10.64 74.79l165.4 203.1v67.71c0 12.55 6.178 24.3 16.52 31.45l24.81 19.15C233.1 408.4 256 397.2 256 377.2c0-7.439-3.449-14.46-9.34-19L223.1 340.7z";
|
|
817
|
-
const faFilterCircleXmark = {
|
|
818
|
-
prefix: prefix$a,
|
|
819
|
-
iconName: iconName$a,
|
|
820
|
-
icon: [width$a, height$a, [], unicode$a, svgPathData$a],
|
|
821
|
-
};
|
|
822
|
-
|
|
823
|
-
const prefix$9 = "fas";
|
|
824
|
-
const iconName$9 = "magnifying-glass";
|
|
825
|
-
const width$9 = 512;
|
|
826
|
-
const height$9 = 512;
|
|
827
|
-
const unicode$9 = "f002";
|
|
828
|
-
const svgPathData$9 = "M500.3 443.7l-119.7-119.7c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723C99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9c53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0C515.9 484.7 515.9 459.3 500.3 443.7zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128c0 70.58-57.42 128-128 128S79.1 278.6 79.1 208z";
|
|
829
|
-
const faMagnifyingGlass = {
|
|
830
|
-
prefix: prefix$9,
|
|
831
|
-
iconName: iconName$9,
|
|
832
|
-
icon: [width$9, height$9, [], unicode$9, svgPathData$9],
|
|
833
|
-
};
|
|
834
|
-
|
|
835
|
-
const FilterItem = ({ item, translations }) => (jsxs("div", { className: "table-filter-item", children: [jsxs("p", { className: "label", children: ["\u2060", item.label] }), jsx("div", { className: "field", children: item.field }), jsx(Button, { label: translations?.filter?.Delete || "Delete", onClick: () => item.resetField(), size: "m" })] }, item.label));
|
|
836
|
-
|
|
837
|
-
const SetTableFilter = ({ columns, filters, additionalFilters, excludeFromSearch, searchData, setSearchData, onSubmit, resetData, isOpen, onClose, translations, }) => {
|
|
838
|
-
const visibleFilters = columns.reduce((arr, col) => !!filters[col] ? arr.concat(filters[col]) : arr, []);
|
|
839
|
-
return (jsxs(Dialog, { className: "iui-table-filter", title: translations?.filter?.Filter || "Filter", isOpen: isOpen, onClose: onClose, cancelButton: { icon: faXmark }, additionalButton: {
|
|
840
|
-
label: translations?.filter?.ResetFilter || "Reset Filter",
|
|
841
|
-
icon: faFilterCircleXmark,
|
|
842
|
-
onClick: () => {
|
|
843
|
-
setSearchData(resetData || {});
|
|
844
|
-
onSubmit(resetData || {});
|
|
845
|
-
},
|
|
846
|
-
disabled: resetData
|
|
847
|
-
? JSON.stringify(searchData) === JSON.stringify(resetData)
|
|
848
|
-
: Object.keys(searchData).length === 0,
|
|
849
|
-
}, confirmButton: {
|
|
850
|
-
label: translations?.filter?.Search || "Search",
|
|
851
|
-
icon: faMagnifyingGlass,
|
|
852
|
-
onFormSubmit: () => {
|
|
853
|
-
const data = deleteEmptyPropsIncludingArray(searchData);
|
|
854
|
-
onSubmit(excludeFromSearch ? deleteProps(data, excludeFromSearch) : data);
|
|
855
|
-
},
|
|
856
|
-
}, children: [jsx(Fragment, { children: visibleFilters?.map((item) => (jsx(FilterItem, { item: item, translations: translations }, item.label))) }), additionalFilters && jsx("div", { className: "pb-1", children: additionalFilters })] }));
|
|
857
|
-
};
|
|
858
|
-
|
|
859
|
-
const prefix$8 = "fas";
|
|
860
|
-
const iconName$8 = "angle-right";
|
|
861
|
-
const width$8 = 256;
|
|
862
|
-
const height$8 = 512;
|
|
863
|
-
const unicode$8 = "f105";
|
|
864
|
-
const svgPathData$8 = "M64 448c-8.188 0-16.38-3.125-22.62-9.375c-12.5-12.5-12.5-32.75 0-45.25L178.8 256L41.38 118.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0l160 160c12.5 12.5 12.5 32.75 0 45.25l-160 160C80.38 444.9 72.19 448 64 448z";
|
|
865
|
-
const faAngleRight = {
|
|
866
|
-
prefix: prefix$8,
|
|
867
|
-
iconName: iconName$8,
|
|
868
|
-
icon: [width$8, height$8, [], unicode$8, svgPathData$8],
|
|
869
|
-
};
|
|
870
|
-
|
|
871
|
-
const prefix$7 = "fas";
|
|
872
|
-
const iconName$7 = "rotate-right";
|
|
873
|
-
const width$7 = 512;
|
|
874
|
-
const height$7 = 512;
|
|
875
|
-
const unicode$7 = "f2f9";
|
|
876
|
-
const svgPathData$7 = "M468.9 32.11c13.87 0 27.18 10.77 27.18 27.04v145.9c0 10.59-8.584 19.17-19.17 19.17h-145.7c-16.28 0-27.06-13.32-27.06-27.2c0-6.634 2.461-13.4 7.96-18.9l45.12-45.14c-28.22-23.14-63.85-36.64-101.3-36.64c-88.09 0-159.8 71.69-159.8 159.8S167.8 415.9 255.9 415.9c73.14 0 89.44-38.31 115.1-38.31c18.48 0 31.97 15.04 31.97 31.96c0 35.04-81.59 70.41-147 70.41c-123.4 0-223.9-100.5-223.9-223.9S132.6 32.44 256 32.44c54.6 0 106.2 20.39 146.4 55.26l47.6-47.63C455.5 34.57 462.3 32.11 468.9 32.11z";
|
|
877
|
-
const faRotateRight = {
|
|
878
|
-
prefix: prefix$7,
|
|
879
|
-
iconName: iconName$7,
|
|
880
|
-
icon: [width$7, height$7, [], unicode$7, svgPathData$7],
|
|
881
|
-
};
|
|
882
|
-
|
|
883
|
-
const TableFooter = ({ limit, offset, setLimit, setOffset, totalRows, footerAction, customLimit, translations, }) => {
|
|
884
|
-
const handleChangeLimit = (event) => {
|
|
885
|
-
const newLimit = Math.floor(+event.target.value);
|
|
886
|
-
setLimit(newLimit);
|
|
887
|
-
setOffset(0);
|
|
888
|
-
};
|
|
889
|
-
const maxOffset = Math.ceil(totalRows / limit);
|
|
890
|
-
return (jsx("tfoot", { children: jsx("tr", { children: jsx("td", { colSpan: 1000, className: "no-border", children: jsxs("div", { className: `table-footer ${footerAction ? "justify-between" : "justify-right"}`, children: [!!footerAction && (jsx(IconButton, { icon: footerAction.icon || faRotateRight, onClick: footerAction.onClick })), jsxs("div", { className: "pagination", children: [jsxs("div", { className: "flex align-center", children: [jsx("p", { children: translations?.pagination?.rowsPerPage || "Rows per page" }), jsx("select", { value: limit, onChange: handleChangeLimit, children: (customLimit || [5, 10, 25, 50, 100]).map((e) => (jsx("option", { value: e, children: e
|
|
891
|
-
? e
|
|
892
|
-
: translations?.pagination?.allResults || "All results" }, e))) }), jsx("p", { className: "mr-4", children: limit
|
|
893
|
-
? `${offset * limit + 1}-${offset * limit + limit <= totalRows
|
|
894
|
-
? offset * limit + limit
|
|
895
|
-
: totalRows} ${translations?.pagination?.of || "of"} ${totalRows}`
|
|
896
|
-
: `${translations?.pagination?.allResults || "All results"} ${translations?.pagination?.of || "of"} ${totalRows} ` })] }), jsxs("div", { className: "flex align-center", children: [jsx("p", { children: `${translations?.pagination?.page || "Page"}: ${offset + 1}/${maxOffset}` }), jsx(IconButton, { className: "offset-button", disabled: offset < 1, icon: faAngleLeft, onClick: () => setOffset(offset - 1) }), jsx("input", { className: "offset-input", placeholder: `1-${maxOffset}`, onKeyUp: (e) => {
|
|
897
|
-
if (e.key === "Enter") {
|
|
898
|
-
const value = +e.target.value;
|
|
899
|
-
console.log(e);
|
|
900
|
-
if (typeof value === "number" &&
|
|
901
|
-
value >= 0 &&
|
|
902
|
-
value <= maxOffset)
|
|
903
|
-
setOffset(value - 1);
|
|
904
|
-
e.target.value = "";
|
|
905
|
-
}
|
|
906
|
-
} }), jsx(IconButton, { className: "offset-button", disabled: offset + 1 >= maxOffset, icon: faAngleRight, onClick: () => setOffset(offset + 1) })] })] })] }) }) }) }));
|
|
907
|
-
};
|
|
908
|
-
|
|
909
|
-
const HeaderTable = ({ tableCols, firstHeaderRow, secondHeaderRow, headerWrap, printTable, }) => {
|
|
910
|
-
return (jsxs("thead", { className: clsx("iui-table-head", { "no-wrap": !headerWrap }), children: [firstHeaderRow && (jsx("tr", { children: firstHeaderRow.map((col, i) => (jsx("th", { colSpan: col.colSpan, rowSpan: col.rowSpan, style: col.minWidth
|
|
911
|
-
? { minWidth: col.minWidth }
|
|
912
|
-
: col.width
|
|
913
|
-
? { width: col.width }
|
|
914
|
-
: undefined, hidden: col.hidden, children: jsx("p", { className: `full-width p-3 text-${col.align || "left"}`, children: col.label }) }, i))) })), jsx("tr", { children: (secondHeaderRow || tableCols)
|
|
915
|
-
.filter((col) => !col.hidden)
|
|
916
|
-
.map((col, i) => (jsx("th", { style: col.minWidth
|
|
917
|
-
? { minWidth: col.minWidth }
|
|
918
|
-
: col.width
|
|
919
|
-
? { width: col.width }
|
|
920
|
-
: undefined, children: jsxs("div", { className: "flex align-center", children: [jsx("p", { className: `full-width p-3 text-${col.align || "left"}`, children: col.label }), !printTable && jsx("div", { className: "vertical-separator" })] }) }, i))) })] }));
|
|
921
|
-
};
|
|
922
|
-
|
|
923
|
-
const prefix$6 = "fas";
|
|
924
|
-
const iconName$6 = "print";
|
|
925
|
-
const width$6 = 512;
|
|
926
|
-
const height$6 = 512;
|
|
927
|
-
const unicode$6 = "f02f";
|
|
928
|
-
const svgPathData$6 = "M448 192H64C28.65 192 0 220.7 0 256v96c0 17.67 14.33 32 32 32h32v96c0 17.67 14.33 32 32 32h320c17.67 0 32-14.33 32-32v-96h32c17.67 0 32-14.33 32-32V256C512 220.7 483.3 192 448 192zM384 448H128v-96h256V448zM432 296c-13.25 0-24-10.75-24-24c0-13.27 10.75-24 24-24s24 10.73 24 24C456 285.3 445.3 296 432 296zM128 64h229.5L384 90.51V160h64V77.25c0-8.484-3.375-16.62-9.375-22.62l-45.25-45.25C387.4 3.375 379.2 0 370.8 0H96C78.34 0 64 14.33 64 32v128h64V64z";
|
|
929
|
-
const faPrint = {
|
|
930
|
-
prefix: prefix$6,
|
|
931
|
-
iconName: iconName$6,
|
|
932
|
-
icon: [width$6, height$6, [], unicode$6, svgPathData$6],
|
|
933
|
-
};
|
|
934
|
-
|
|
935
|
-
const prefix$5 = "far";
|
|
936
|
-
const iconName$5 = "file-arrow-down";
|
|
937
|
-
const width$5 = 384;
|
|
938
|
-
const height$5 = 512;
|
|
939
|
-
const unicode$5 = "f56d";
|
|
940
|
-
const svgPathData$5 = "M216 342.1V240c0-13.25-10.75-24-24-24S168 226.8 168 240v102.1L128.1 303C124.3 298.3 118.2 296 112 296S99.72 298.3 95.03 303c-9.375 9.375-9.375 24.56 0 33.94l80 80c9.375 9.375 24.56 9.375 33.94 0l80-80c9.375-9.375 9.375-24.56 0-33.94s-24.56-9.375-33.94 0L216 342.1zM365.3 93.38l-74.63-74.64C278.6 6.742 262.3 0 245.4 0H64C28.65 0 0 28.65 0 64l.0065 384c0 35.34 28.65 64 64 64H320c35.2 0 64-28.8 64-64V138.6C384 121.7 377.3 105.4 365.3 93.38zM336 448c0 8.836-7.164 16-16 16H64.02c-8.838 0-16-7.164-16-16L48 64.13c0-8.836 7.164-16 16-16h160L224 128c0 17.67 14.33 32 32 32h79.1V448z";
|
|
941
|
-
const faFileArrowDown = {
|
|
942
|
-
prefix: prefix$5,
|
|
943
|
-
iconName: iconName$5,
|
|
944
|
-
icon: [width$5, height$5, [], unicode$5, svgPathData$5],
|
|
945
|
-
};
|
|
946
|
-
|
|
947
|
-
const TablePrint = ({ isOpen, onClose, columns, organization, filters, label, getPrintData, formatPrintData, saveXlsx, totals, translations, }) => {
|
|
948
|
-
const [data, setData] = useState([]);
|
|
949
|
-
const [offset, setOffset] = useState(0);
|
|
950
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
951
|
-
const cols = columns.filter((e) => e.id !== "actions");
|
|
952
|
-
useEffect(() => {
|
|
953
|
-
const root = window.document.getElementById("root");
|
|
954
|
-
root?.classList.add("hidden");
|
|
955
|
-
return () => {
|
|
956
|
-
root?.classList.remove("hidden");
|
|
957
|
-
};
|
|
958
|
-
}, []);
|
|
959
|
-
useEffect(() => {
|
|
960
|
-
setIsLoading(true);
|
|
961
|
-
getPrintData({ limit: 1000, offset })
|
|
962
|
-
.then((e) => {
|
|
963
|
-
setData((prevState) => {
|
|
964
|
-
const data = !!e.length ? formatPrintData(e) : [];
|
|
965
|
-
const newState = [...prevState, ...data];
|
|
966
|
-
e.totalRows > newState.length
|
|
967
|
-
? setOffset(offset + 1)
|
|
968
|
-
: setIsLoading(false);
|
|
969
|
-
return newState;
|
|
970
|
-
});
|
|
971
|
-
})
|
|
972
|
-
.catch(() => setIsLoading(false));
|
|
973
|
-
}, [offset, formatPrintData, getPrintData]);
|
|
974
|
-
return isOpen
|
|
975
|
-
? createPortal(jsxs("div", { className: "iui-print-dialog", children: [jsxs("div", { className: "content", children: [jsxs("div", { className: "flex justify-between", children: [organization ? (jsxs("div", { children: [jsx("p", { className: "name", children: organization.name }), organization.taxId && (jsx("p", { children: `${translations?.print?.TaxId || "Tax id"}: ${organization.taxId}` })), organization.registrationNumber && (jsx("p", { children: `${translations?.print?.RegistrationNumber ||
|
|
976
|
-
"Registration number"}: ${organization.registrationNumber}` })), organization.jbkjs && jsxs("p", { children: ["JBKJS: ", organization.jbkjs] }), organization.email && jsxs("p", { children: ["Email: ", organization.email] })] })) : (jsx("div", {})), jsx("div", { className: "mb-2 text-right", children: jsx("p", { children: `${translations?.print?.PrintDate || "Print date"}: ${getCurrentDateFormatted()}` }) })] }), jsx("h4", { className: "m-3 text-center", children: label }), filters && (jsxs("div", { className: "flex justify-between", children: [jsx("div", { children: filters.basic?.map((e) => !!e.value && (jsx("div", { className: "mb-2", children: jsx("p", { children: `${e.label}: ${e.value}` }) }))) }), filters.date && (jsx("div", { children: filters.date.map((e) => (!!e.from || !!e.to) && (jsx("div", { className: "mb-2 text-right", children: jsxs("p", { children: [e.label, " ", !!e.from &&
|
|
977
|
-
`${translations?.print?.from || "from"} ${formatDate(e.from)}`, " ", `${translations?.print?.to || "to"} ${formatDate(e.to || new Date().toString())}`] }) }))) }))] })), data && (jsxs("table", { width: "100%", className: "print-table", children: [jsx(HeaderTable, { tableCols: cols, headerWrap: true }), jsx("tbody", { children: jsxs(Fragment, { children: [data.map((row) => (jsx("tr", { children: cols.map((column) => (jsx("td", { align: row.cells[column.id].align || column.align, children: row.cells[column.id].printValue ||
|
|
978
|
-
row.cells[column.id].value }, column.id))) }, row.uuid))), !!totals && (jsx("tr", { children: cols.map(({ id: columnId }) => (jsx("td", { align: totals.cells[columnId]?.align || "right", colSpan: totals.cells[columnId]?.span, className: "py-3", children: jsx("strong", { children: totals.cells[columnId]?.value }) }, columnId))) }))] }) })] }))] }), jsxs("div", { className: "iui-print-actions no-print", children: [jsx(Button, { label: translations?.Cancel || "Cancel", icon: faXmark, onClick: (e) => {
|
|
979
|
-
e.stopPropagation();
|
|
980
|
-
onClose();
|
|
981
|
-
}, className: "mr-3" }), !!saveXlsx && (jsx(Button, { label: translations?.print?.SaveXlsx || "Save XLSX", icon: faFileArrowDown,
|
|
982
|
-
// outlined
|
|
983
|
-
onClick: () => saveXlsx(), className: "mr-3" })), jsx(Button, { label: translations?.print?.Print || "Print", icon: faPrint, primary: true, onClick: () => window.print() })] }), jsx(FullScreenLoader, { isLoading: isLoading })] }), document.body)
|
|
984
|
-
: null;
|
|
985
|
-
};
|
|
986
|
-
|
|
987
|
-
const prefix$4 = "fas";
|
|
988
|
-
const iconName$4 = "grip-dots-vertical";
|
|
989
|
-
const width$4 = 256;
|
|
990
|
-
const height$4 = 512;
|
|
991
|
-
const unicode$4 = "e411";
|
|
992
|
-
const svgPathData$4 = "M0 96C0 69.49 21.49 48 48 48C74.51 48 96 69.49 96 96C96 122.5 74.51 144 48 144C21.49 144 0 122.5 0 96zM0 256C0 229.5 21.49 208 48 208C74.51 208 96 229.5 96 256C96 282.5 74.51 304 48 304C21.49 304 0 282.5 0 256zM96 416C96 442.5 74.51 464 48 464C21.49 464 0 442.5 0 416C0 389.5 21.49 368 48 368C74.51 368 96 389.5 96 416zM160 96C160 69.49 181.5 48 208 48C234.5 48 256 69.49 256 96C256 122.5 234.5 144 208 144C181.5 144 160 122.5 160 96zM256 256C256 282.5 234.5 304 208 304C181.5 304 160 282.5 160 256C160 229.5 181.5 208 208 208C234.5 208 256 229.5 256 256zM160 416C160 389.5 181.5 368 208 368C234.5 368 256 389.5 256 416C256 442.5 234.5 464 208 464C181.5 464 160 442.5 160 416z";
|
|
993
|
-
const faGripDotsVertical = {
|
|
994
|
-
prefix: prefix$4,
|
|
995
|
-
iconName: iconName$4,
|
|
996
|
-
icon: [width$4, height$4, [], unicode$4, svgPathData$4],
|
|
997
|
-
};
|
|
998
|
-
|
|
999
|
-
const prefix$3 = "far";
|
|
1000
|
-
const iconName$3 = "arrow-right-arrow-left";
|
|
1001
|
-
const width$3 = 512;
|
|
1002
|
-
const height$3 = 512;
|
|
1003
|
-
const unicode$3 = "f0ec";
|
|
1004
|
-
const svgPathData$3 = "M488 344H79.24l74.29-79.63C162.6 254.7 162.1 239.5 152.4 230.5C142.7 221.4 127.5 221.9 118.5 231.6l-112 120c-8.625 9.219-8.625 23.53 0 32.75l112 120C123.2 509.4 129.6 512 136 512c5.875 0 11.75-2.125 16.38-6.469c9.688-9.031 10.22-24.22 1.156-33.91L79.24 392H488c13.25 0 24-10.75 24-24S501.3 344 488 344zM24 168h408.8l-74.29 79.63c-9.062 9.688-8.531 24.88 1.156 33.91c9.656 9.094 24.88 8.562 33.91-1.156l112-120c8.625-9.219 8.625-23.53 0-32.75l-112-120C388.8 2.562 382.4 0 376 0c-5.875 0-11.75 2.125-16.38 6.469c-9.688 9.031-10.22 24.22-1.156 33.91L432.8 120H24C10.75 120 0 130.8 0 144S10.75 168 24 168z";
|
|
1005
|
-
const faArrowRightArrowLeft = {
|
|
1006
|
-
prefix: prefix$3,
|
|
1007
|
-
iconName: iconName$3,
|
|
1008
|
-
icon: [width$3, height$3, [], unicode$3, svgPathData$3],
|
|
1009
|
-
};
|
|
1010
|
-
|
|
1011
|
-
const SetColumnsList = ({ columns, setColumns, isOpen, onClose, translations, }) => {
|
|
1012
|
-
const [hidden, setHidden] = useState([]);
|
|
1013
|
-
const [visible, setVisible] = useState([]);
|
|
1014
|
-
useEffect(() => {
|
|
1015
|
-
let hiddenCols = [];
|
|
1016
|
-
let visibleCols = [];
|
|
1017
|
-
columns.forEach((col) => col.id !== "actions" &&
|
|
1018
|
-
(!!col.hidden ? hiddenCols.push(col) : visibleCols.push(col)));
|
|
1019
|
-
setHidden(hiddenCols);
|
|
1020
|
-
setVisible(visibleCols);
|
|
1021
|
-
}, [columns]);
|
|
1022
|
-
const onDragEnd = ({ source, destination }) => {
|
|
1023
|
-
if (!destination)
|
|
1024
|
-
return;
|
|
1025
|
-
const hiddenCols = [...hidden];
|
|
1026
|
-
const visibleCols = [...visible];
|
|
1027
|
-
const destinationIsHidden = destination.droppableId === "hidden";
|
|
1028
|
-
const sourceList = source.droppableId === "hidden" ? hiddenCols : visibleCols;
|
|
1029
|
-
const destinationList = destinationIsHidden ? hiddenCols : visibleCols;
|
|
1030
|
-
const [removed] = sourceList.splice(source.index, 1);
|
|
1031
|
-
destinationList.splice(destination.index, 0, removed);
|
|
1032
|
-
if (source.droppableId !== destination.droppableId) {
|
|
1033
|
-
destinationList[destination.index].hidden = destinationIsHidden;
|
|
1034
|
-
setHidden(hiddenCols);
|
|
1035
|
-
setVisible(visibleCols);
|
|
1036
|
-
}
|
|
1037
|
-
else {
|
|
1038
|
-
destinationIsHidden ? setHidden(hiddenCols) : setVisible(visibleCols);
|
|
1039
|
-
}
|
|
1040
|
-
};
|
|
1041
|
-
const onSubmit = () => {
|
|
1042
|
-
setColumns([...visible, ...hidden]);
|
|
1043
|
-
onClose();
|
|
1044
|
-
};
|
|
1045
|
-
return (jsx(DragDropContext, { onDragEnd: onDragEnd, children: jsx(Dialog, { isOpen: isOpen, onClose: onClose, confirmButton: {
|
|
1046
|
-
label: translations?.Confirm || "Confirm",
|
|
1047
|
-
onClick: onSubmit,
|
|
1048
|
-
}, cancelButton: { label: translations?.Cancel || "Cancel" }, noBackgroundClick: true, children: jsxs("div", { className: "dual-list-container", children: [jsx("p", { className: "pb-3", children: translations?.columns?.DragDropListsInfo || "DragDropListsInfo" }), jsxs("div", { className: "dual-list-content", children: [jsxs("p", { className: "bold m-2", children: [translations?.columns?.HiddenColumns || "HiddenColumns", ":"] }), jsx("p", {}), jsxs("p", { className: "bold m-2", children: [translations?.columns?.SelectedColumns || "SelectedColumns", ":"] }), jsx(Droppable, { droppableId: "hidden", children: (provided) => (jsxs("div", { ...provided.droppableProps, ref: provided.innerRef, className: "list-box", children: [hidden.map((c, index) => (jsx(Draggable, { draggableId: c.id, index: index, children: (provided) => (jsxs("div", { className: "item", ref: provided.innerRef, ...provided.draggableProps, ...provided.dragHandleProps, style: {
|
|
1049
|
-
...provided.draggableProps.style,
|
|
1050
|
-
top: "unset",
|
|
1051
|
-
left: "unset",
|
|
1052
|
-
}, children: [c.label, jsx(FontAwesomeIcon, { icon: faGripDotsVertical })] })) }, c.id))), provided.placeholder] })) }), jsx("div", { className: "exchange-icon", children: jsx(FontAwesomeIcon, { icon: faArrowRightArrowLeft }) }), jsx(Droppable, { droppableId: "visible", children: (provided) => (jsxs("div", { ...provided.droppableProps, ref: provided.innerRef, className: "list-box", children: [visible.map((c, index) => (jsx(Draggable, { draggableId: c.id, index: index, children: (provided) => (jsxs("div", { className: "item", ref: provided.innerRef, ...provided.draggableProps, ...provided.dragHandleProps, style: {
|
|
1053
|
-
...provided.draggableProps.style,
|
|
1054
|
-
top: "unset",
|
|
1055
|
-
left: "unset",
|
|
1056
|
-
}, children: [c.label, jsx(FontAwesomeIcon, { icon: faGripDotsVertical })] })) }, c.id))), provided.placeholder] })) })] })] }) }) }));
|
|
1057
|
-
};
|
|
1058
|
-
|
|
1059
|
-
const SetSortList = ({ sortOptions, sort, setSort }) => (jsx(Fragment, { children: Object.keys(sortOptions).map((e) => (jsx(MenuItem, { className: "menu-item-m", onClick: () => setSort(sort === sortOptions[e].desc
|
|
1060
|
-
? sortOptions[e].asc
|
|
1061
|
-
: sortOptions[e].desc), children: jsxs("div", { className: "flex center justify-between full-width", children: [jsx("p", { className: "mr-5 mb-0", children: sortOptions[e].label }), sort === sortOptions[e].desc && (jsx(FontAwesomeIcon, { icon: faArrowDownWideShort })), sort === sortOptions[e].asc && (jsx(FontAwesomeIcon, { icon: faArrowDownShortWide }))] }) }, e))) }));
|
|
1062
|
-
|
|
1063
|
-
const prefix$2 = "fas";
|
|
1064
|
-
const iconName$2 = "caret-down";
|
|
1065
|
-
const width$2 = 320;
|
|
1066
|
-
const height$2 = 512;
|
|
1067
|
-
const unicode$2 = "f0d7";
|
|
1068
|
-
const svgPathData$2 = "M310.6 246.6l-127.1 128C176.4 380.9 168.2 384 160 384s-16.38-3.125-22.63-9.375l-127.1-128C.2244 237.5-2.516 223.7 2.438 211.8S19.07 192 32 192h255.1c12.94 0 24.62 7.781 29.58 19.75S319.8 237.5 310.6 246.6z";
|
|
1069
|
-
const faCaretDown = {
|
|
1070
|
-
prefix: prefix$2,
|
|
1071
|
-
iconName: iconName$2,
|
|
1072
|
-
icon: [width$2, height$2, [], unicode$2, svgPathData$2],
|
|
1073
|
-
};
|
|
1074
|
-
|
|
1075
|
-
const TableOptions = ({ columns, columnsData, filterData, sortData, printData, additionsalOptions, translations, }) => {
|
|
1076
|
-
const [opened, setOpened] = useState("");
|
|
1077
|
-
const onClose = () => setOpened("");
|
|
1078
|
-
return (jsxs("div", { className: "flex align-center gap-2 justify-between", children: [jsxs("div", { className: "flex align-center gap-2", children: [filterData && (jsxs(Fragment, { children: [jsx(NotificationBadge, { number: getActiveFilterNumber(filterData.search), small: true, children: jsx(Button, { label: translations?.filter?.Filter || "Filter", active: opened === "filter", onClick: () => setOpened("filter"), className: "table-options-btn", size: "s" }) }), opened === "filter" && (jsx(SetTableFilter, { ...filterData, isOpen: true, onClose: onClose, translations: translations }))] })), columnsData && (jsxs(Fragment, { children: [jsx(Button, { label: translations?.columns?.Columns || "Columns", active: opened === "columns", onClick: () => setOpened("columns"), className: "table-options-btn", size: "s" }), opened === "columns" && (jsx(SetColumnsList, { columns: columnsData.columns, setColumns: columnsData.setColumns, isOpen: true, onClose: onClose, translations: translations }))] })), sortData && (jsx(Menu, { renderButton: (ref) => (jsx(Button, { label: translations?.Sort || "Sort", iconEnd: faCaretDown, active: opened === "sort", onClick: () => setOpened("sort"), ref: ref, className: "table-options-btn", size: "s" })), isOpen: opened === "sort", onClose: onClose, size: sortData.menuSize, children: jsx(SetSortList, { ...sortData }) })), additionsalOptions] }), printData && (jsxs(Fragment, { children: [jsx(Button, { label: translations?.print?.PrintExport || "Print/Export", icon: faPrint, onClick: () => setOpened("print"), size: "s" }), opened === "print" && (jsx(TablePrint, { ...printData, isOpen: true, onClose: onClose, columns: columns, translations: translations }))] }))] }));
|
|
1079
|
-
};
|
|
1080
|
-
|
|
1081
|
-
const Table = ({ columns, setColumns, firstHeaderRow, secondHeaderRow, data: tableData, totals, loaderLogo, isLoading, headerWrap, serverSidePagination, customPagination, selectedRowUuid, translations, footerAction, hideFooter, showLastBorder, className, filterData, sortData, printData, additionsalOptions, selectedOptions, editable, }) => {
|
|
1082
|
-
const [limit, setLimit] = useState(customPagination?.defaultLimit || 5);
|
|
1083
|
-
const [offset, setOffset] = useState(0);
|
|
1084
|
-
const [cols, setCols] = useState([]);
|
|
1085
|
-
const [data, setData] = useState([]);
|
|
1086
|
-
const [extendedRow, setExtendedRow] = useState('');
|
|
1087
|
-
const [editableData, setEditableData] = useState({});
|
|
1088
|
-
useEffect(() => {
|
|
1089
|
-
setCols(
|
|
1090
|
-
// (editable
|
|
1091
|
-
// ? [
|
|
1092
|
-
// ...columns,
|
|
1093
|
-
// {
|
|
1094
|
-
// id: "actions",
|
|
1095
|
-
// label: translations?.editable?.Actions || "Actions",
|
|
1096
|
-
// align: "center",
|
|
1097
|
-
// width: "100px",
|
|
1098
|
-
// } as ITableColumn,
|
|
1099
|
-
// ]
|
|
1100
|
-
// :
|
|
1101
|
-
columns.filter(e => !e.hidden && !e.unavailable));
|
|
1102
|
-
}, [columns, editable, translations]);
|
|
1103
|
-
useEffect(() => {
|
|
1104
|
-
// const data = editable
|
|
1105
|
-
// ? tableData.map((e) => ({
|
|
1106
|
-
// ...e,
|
|
1107
|
-
// cells: {
|
|
1108
|
-
// ...e.cells,
|
|
1109
|
-
// actions: {
|
|
1110
|
-
// value: (
|
|
1111
|
-
// <ItemActionsMenu
|
|
1112
|
-
// item={e}
|
|
1113
|
-
// setSelectedItem={editable!.setSelectedItem}
|
|
1114
|
-
// t={(e) => e}
|
|
1115
|
-
// />
|
|
1116
|
-
// ),
|
|
1117
|
-
// },
|
|
1118
|
-
// },
|
|
1119
|
-
// }))
|
|
1120
|
-
// : tableData;
|
|
1121
|
-
setData(serverSidePagination || limit <= 0
|
|
1122
|
-
? tableData
|
|
1123
|
-
: tableData.slice(offset * limit, offset * limit + limit));
|
|
1124
|
-
}, [tableData, limit, offset, serverSidePagination]);
|
|
1125
|
-
const EditableRow = editable?.EditableRow;
|
|
1126
|
-
return (jsx(ConditionalWrapper, { condition: !!editable, wrapper: children => (jsx("form", { onSubmit: e => {
|
|
1127
|
-
e.preventDefault();
|
|
1128
|
-
editable.onSubmit(editableData, () => {
|
|
1129
|
-
editable.inputFocusRef?.current?.focus();
|
|
1130
|
-
setEditableData(editable.defaultDataValue || {});
|
|
1131
|
-
editable.setSelectedItem(null);
|
|
1132
|
-
});
|
|
1133
|
-
}, children: children })), children: jsx("div", { className: clsx('iui-table', className, { 'pb-3': data.length === 0 }), children: jsxs(Loader, { isLoading: !!isLoading, logo: loaderLogo, fullWidth: true, children: [(!!filterData || !!sortData || !!setColumns || !!printData) && (jsx(TableOptions, { columns: cols, columnsData: setColumns ? { columns, setColumns } : undefined, filterData: filterData, sortData: sortData, printData: printData, additionsalOptions: additionsalOptions, translations: translations })), selectedOptions, jsxs("table", { className: "full-width", children: [jsx(HeaderTable, { tableCols: cols, headerWrap: headerWrap, firstHeaderRow: firstHeaderRow, secondHeaderRow: secondHeaderRow }), jsxs("tbody", { className: hideFooter && !showLastBorder ? 'no-last-border' : undefined, children: [data.length ? (jsx(Fragment, { children: data.map(row => {
|
|
1134
|
-
const isExtended = row.extendable &&
|
|
1135
|
-
!row.extendable.isLoading &&
|
|
1136
|
-
extendedRow === row.uuid;
|
|
1137
|
-
return (jsxs(Fragment$1, { children: [!!EditableRow && row.uuid === editable?.selectedItem?.uuid ? (jsx(EditableRow, { columns: cols, data: editableData, setData: setEditableData, item: editable.selectedItem, clearItem: () => editable.setSelectedItem(null), defaultDataValue: editable.defaultDataValue, inputFocusRef: editable.inputFocusRef })) : (
|
|
1138
|
-
////// REGULAR ROW //////
|
|
1139
|
-
jsx("tr", { className: clsx(row.className, {
|
|
1140
|
-
selected: !!selectedRowUuid && selectedRowUuid === row.uuid,
|
|
1141
|
-
clickable: !!row.onRowClick || !!row.extendable,
|
|
1142
|
-
loading: row.extendable?.isLoading,
|
|
1143
|
-
}), onClick: e => {
|
|
1144
|
-
row.onRowClick && row.onRowClick(e);
|
|
1145
|
-
row.extendable &&
|
|
1146
|
-
setExtendedRow(extendedRow === row.uuid ? '' : row.uuid);
|
|
1147
|
-
}, children: cols.map(column => (jsx(Tooltip, { label: row.cells[column.id]?.tooltip, position: "top", disabled: !row.cells[column.id]?.tooltip, children: jsx("td", { "data-th": column.label ? column.label + ': ' : '/', align: row.cells[column.id]?.align || column.align, onClick: row.cells[column.id]?.onClick
|
|
1148
|
-
? e => {
|
|
1149
|
-
e.stopPropagation();
|
|
1150
|
-
row.cells[column.id]?.onClick(e);
|
|
1151
|
-
}
|
|
1152
|
-
: undefined, className: clsx(row.cells[column.id]?.className, {
|
|
1153
|
-
link: row.cells[column.id]?.link,
|
|
1154
|
-
'clickable-column': row.cells[column.id]?.onClick,
|
|
1155
|
-
'word-break': column.break,
|
|
1156
|
-
'no-border': isExtended,
|
|
1157
|
-
}), children: row.cells[column.id]?.value }) }, column.id))) })), isExtended && (jsx("tr", { children: jsx("td", { colSpan: cols.length, children: row.extendable.element }) }))] }, row.uuid));
|
|
1158
|
-
}) })) : (jsx("tr", { children: jsx("td", { className: "no-border", colSpan: cols.length, children: translations?.noDataText || 'No results' }) })), !!EditableRow && !editable.selectedItem && !editable.disabled && (jsx(EditableRow, { columns: cols, data: editableData, setData: setEditableData, defaultDataValue: editable.defaultDataValue, clearItem: () => editable.setSelectedItem(null), inputFocusRef: editable.inputFocusRef })), !!totals && !!data.length && (jsx("tr", { children: cols.map(({ id: columnId }) => (jsx("td", { align: totals.cells[columnId]?.align || 'right', colSpan: totals.cells[columnId]?.span, children: jsx("strong", { children: totals.cells[columnId]?.value }) }, columnId))) }))] }), !!data.length && !hideFooter && (jsx(TableFooter, { totalRows: serverSidePagination?.totalRows || tableData.length, customLimit: customPagination?.customLimit, limit: serverSidePagination?.limit || limit, offset: serverSidePagination?.offset || offset, setLimit: serverSidePagination?.setLimit || setLimit, setOffset: serverSidePagination?.setOffset || setOffset, footerAction: footerAction, translations: translations }))] })] }) }) }));
|
|
1159
|
-
};
|
|
1160
|
-
|
|
1161
|
-
const ItemActionsMenu = ({ item, setSelectedItem, setItemToDeleteUuid, actions, t = (e) => e, }) => {
|
|
1162
|
-
const [menuOpen, setMenuOpen] = useState(false);
|
|
1163
|
-
return (jsxs(Menu, { isOpen: menuOpen, onClose: () => setMenuOpen(false), placementX: "right", renderButton: (ref) => (jsx(IconButton, { ref: ref, icon: faEllipsisVertical$1, active: menuOpen, onClick: (e) => {
|
|
1164
|
-
e.stopPropagation();
|
|
1165
|
-
setMenuOpen(!menuOpen);
|
|
1166
|
-
} })), children: [!!setSelectedItem && (jsx(MenuItem, { onClick: () => {
|
|
1167
|
-
setSelectedItem(item);
|
|
1168
|
-
setMenuOpen(false);
|
|
1169
|
-
}, children: jsx("p", { children: t("Edit") }) })), actions?.map((action) => !action.hidden && (jsx(MenuItem, { disabled: !!action.disabled, onClick: () => {
|
|
1170
|
-
action.onClick(item.uuid);
|
|
1171
|
-
setMenuOpen(false);
|
|
1172
|
-
}, children: jsx("p", { children: action.label }) }, action.label))), !!setItemToDeleteUuid && (jsx(MenuItem, { onClick: () => {
|
|
1173
|
-
setItemToDeleteUuid(item.uuid);
|
|
1174
|
-
setMenuOpen(false);
|
|
1175
|
-
}, children: jsx("p", { children: t("Delete") }) }))] }));
|
|
1176
|
-
};
|
|
1177
|
-
|
|
1178
|
-
const ItemEditOptionsButtons = ({ setData, clearItem, inputFocusRef, defaultDataValue, }) => {
|
|
1179
|
-
return (jsxs("div", { className: "text-center", children: [jsx(IconButton, { icon: faCheck, className: "mr-1 p-1" }), jsx(IconButton, { icon: faXmark$1, className: "p-1", onClick: () => {
|
|
1180
|
-
setData(defaultDataValue || {});
|
|
1181
|
-
inputFocusRef?.current?.focus();
|
|
1182
|
-
clearItem();
|
|
1183
|
-
} })] }));
|
|
1184
|
-
};
|
|
1185
|
-
|
|
1186
|
-
const TableEditRow = ({ columns, defaultDataValue, data, setData, item, clearItem, inputFocusRef, }) => {
|
|
1187
|
-
useEffect(() => {
|
|
1188
|
-
inputFocusRef?.current?.focus();
|
|
1189
|
-
setData(item || {});
|
|
1190
|
-
}, [item, inputFocusRef, setData]);
|
|
1191
|
-
const rowData = {
|
|
1192
|
-
uuid: item?.uuid,
|
|
1193
|
-
cells: {
|
|
1194
|
-
...data,
|
|
1195
|
-
actions: {
|
|
1196
|
-
value: (jsx(ItemEditOptionsButtons, { setData: setData, clearItem: clearItem, defaultDataValue: defaultDataValue, inputFocusRef: inputFocusRef })),
|
|
1197
|
-
},
|
|
1198
|
-
},
|
|
1199
|
-
};
|
|
1200
|
-
return (jsx("tr", { className: "edit-row", children: columns.map(column => !column.hidden && (
|
|
1201
|
-
// !rowData.cells[column.id]?.hidden &&
|
|
1202
|
-
jsx("td", { align: column.align, colSpan: rowData.cells[column.id]?.span, children: rowData.cells[column.id]?.value }, column.id))) }));
|
|
1203
|
-
};
|
|
1204
|
-
|
|
1205
|
-
const Tabs = ({ tabs, initialValue, control, onChange, noWrap, className, classNameContent, }) => {
|
|
1206
|
-
const [selected, setSelected] = useState(initialValue || tabs[0].value);
|
|
1207
|
-
return !!tabs.length ? (jsxs("div", { className: className, children: [jsx("div", { className: "iui-tabs", children: tabs.map((tab) => !tab.hidden && (jsxs("div", { className: clsx("iui-tab clickable", {
|
|
1208
|
-
selected: (control?.value || selected) === tab.value,
|
|
1209
|
-
disabled: tab.disabled,
|
|
1210
|
-
"no-wrap": noWrap,
|
|
1211
|
-
}), onClick: tab.disabled
|
|
1212
|
-
? undefined
|
|
1213
|
-
: () => {
|
|
1214
|
-
!!control ? control.setValue(tab.value) : setSelected(tab.value);
|
|
1215
|
-
onChange && onChange(tab.value);
|
|
1216
|
-
}, children: [tab.icon && jsx(FontAwesomeIcon, { icon: tab.icon }), tab.label] }, tab.value))) }), tabs.map((tab) => !tab.hidden && (jsx("div", { className: clsx("iui-tab-content", classNameContent), hidden: tab.value !== (control?.value || selected), children: tab.component }, tab.value)))] })) : null;
|
|
1217
|
-
};
|
|
1218
|
-
|
|
1219
|
-
const prefix$1 = "fas";
|
|
1220
|
-
const iconName$1 = "arrow-left";
|
|
1221
|
-
const width$1 = 448;
|
|
1222
|
-
const height$1 = 512;
|
|
1223
|
-
const unicode$1 = "f060";
|
|
1224
|
-
const svgPathData$1 = "M447.1 256C447.1 273.7 433.7 288 416 288H109.3l105.4 105.4c12.5 12.5 12.5 32.75 0 45.25C208.4 444.9 200.2 448 192 448s-16.38-3.125-22.62-9.375l-160-160c-12.5-12.5-12.5-32.75 0-45.25l160-160c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25L109.3 224H416C433.7 224 447.1 238.3 447.1 256z";
|
|
1225
|
-
const faArrowLeft = {
|
|
1226
|
-
prefix: prefix$1,
|
|
1227
|
-
iconName: iconName$1,
|
|
1228
|
-
icon: [width$1, height$1, [], unicode$1, svgPathData$1],
|
|
1229
|
-
};
|
|
1230
|
-
|
|
1231
|
-
const FullPageWrapper = ({ title, description, actionButton, backButton, img, translations, children, }) => {
|
|
1232
|
-
const navigate = useNavigate();
|
|
1233
|
-
return (jsxs("div", { className: "full-page-container", children: [jsx("h1", { children: title }), jsx("h2", { children: description }), jsxs("div", { className: "content", children: [jsx(ConditionalWrapper, { condition: !!actionButton?.onFormSubmit, wrapper: (children) => (jsx("form", { onSubmit: (e) => {
|
|
1234
|
-
e.preventDefault();
|
|
1235
|
-
e.stopPropagation();
|
|
1236
|
-
actionButton?.onFormSubmit();
|
|
1237
|
-
}, children: children })), children: jsxs("div", { children: [jsx("div", { className: "children", children: children }), (!!actionButton || backButton) && (jsxs("div", { className: "flex", children: [backButton && (jsx(Button, { label: translations?.Back || "Back", icon: faArrowLeft, className: "mr-2", onClick: () => navigate(-1) })), !!actionButton && (jsx(Button, { label: actionButton.label, icon: actionButton.icon, onClick: actionButton.onClick, primary: !actionButton.regular }))] }))] }) }), img && (jsx("div", { className: "full-page-image", children: jsx("img", { src: img, alt: "ePismonosa" }) }))] })] }));
|
|
1238
|
-
};
|
|
1239
|
-
|
|
1240
|
-
const FormWrapper = ({ isLoading, noAccess, submitButton, otherButtons, className, children, }) => (jsxs("form", { className: clsx(className, { "form-disabled": isLoading }), onSubmit: (e) => {
|
|
1241
|
-
e.preventDefault();
|
|
1242
|
-
!submitButton.disabled && submitButton.onSubmit(e);
|
|
1243
|
-
}, children: [children, (!noAccess || otherButtons) && (jsxs("div", { className: "text-center mt-3 mb-2", children: [otherButtons?.map((e) => (jsx(Button, { label: e.label, icon: e.icon, disabled: isLoading || e.disabled, outlined: e.outlined, onClick: e.onClick, className: "mr-2" }, e.label))), !noAccess && (jsx(Button, { label: submitButton.label || "Submit", icon: submitButton.icon, disabled: isLoading || submitButton.disabled, outlined: !submitButton.primary, primary: submitButton.primary }))] }))] }));
|
|
1244
|
-
|
|
1245
|
-
const prefix = "fas";
|
|
1246
|
-
const iconName = "ellipsis-vertical";
|
|
1247
|
-
const width = 128;
|
|
1248
|
-
const height = 512;
|
|
1249
|
-
const unicode = "f142";
|
|
1250
|
-
const svgPathData = "M64 360C94.93 360 120 385.1 120 416C120 446.9 94.93 472 64 472C33.07 472 8 446.9 8 416C8 385.1 33.07 360 64 360zM64 200C94.93 200 120 225.1 120 256C120 286.9 94.93 312 64 312C33.07 312 8 286.9 8 256C8 225.1 33.07 200 64 200zM64 152C33.07 152 8 126.9 8 96C8 65.07 33.07 40 64 40C94.93 40 120 65.07 120 96C120 126.9 94.93 152 64 152z";
|
|
1251
|
-
const faEllipsisVertical = {
|
|
1252
|
-
prefix,
|
|
1253
|
-
iconName,
|
|
1254
|
-
icon: [width, height, [], unicode, svgPathData],
|
|
1255
|
-
};
|
|
1256
|
-
|
|
1257
|
-
const PageWrapper = ({ breadcrumbs, actions, moreActions, showBackButton, noAccess, isLoading, loaderLogo, footer, translations, children, }) => {
|
|
1258
|
-
const [isMoreActionsOpen, setIsMoreActionsOpen] = useState(false);
|
|
1259
|
-
const navigate = useNavigate();
|
|
1260
|
-
return (jsx(ConditionalWrapper, { condition: !!isLoading, wrapper: (children) => (jsx(Loader, { isLoading: true, logo: loaderLogo, fullWidth: true, children: children })), children: jsxs("div", { className: "page-container", children: [jsxs("div", { className: "page-header", children: [jsxs("div", { className: "flex align-center gap-3", children: [showBackButton && (jsx(IconButton, { icon: faArrowLeft, className: "c-primary", onClick: () => navigate(-1) })), jsx("div", { className: "breadcrumbs", children: breadcrumbs.map((e, i) => e && (jsx("h1", { children: i + 1 < breadcrumbs.length ? `${e} /` : e }, e))) })] }), !noAccess && (jsxs("div", { className: "flex align-center", children: [actions?.map((action) => !action.hidden && (jsx(ConditionalWrapper, { condition: !!action.to, wrapper: (children) => (jsx(Link, { to: action.to, children: children })), children: jsx(Button, { ...action, className: "ml-2" }, action.label) }, action.label))), !!moreActions?.length && (jsx(Menu, { isOpen: isMoreActionsOpen, onClose: () => setIsMoreActionsOpen(false), placementX: "right", renderButton: (ref) => (jsx(IconButton, { ref: ref, icon: faEllipsisVertical, active: isMoreActionsOpen, onClick: () => setIsMoreActionsOpen(!isMoreActionsOpen) })), children: moreActions.map((action) => !action.hidden && (jsx(MenuItem, { label: action.label, icon: action.icon, iconRotation: action.iconRotation, disabled: action.disabled, withDevider: true, to: action.to, onClick: action.onClick
|
|
1261
|
-
? () => {
|
|
1262
|
-
action.onClick();
|
|
1263
|
-
setIsMoreActionsOpen(false);
|
|
1264
|
-
}
|
|
1265
|
-
: undefined }, action.label))) }))] }))] }), jsxs("div", { className: "page-content", children: [jsx("div", { className: "flex-grow", children: !noAccess ? (children) : (jsx(NoAccessInfo, { title: translations?.NoAccessTitle, buttonLabel: translations?.ReturnToHomepage })) }), footer] })] }) }));
|
|
1266
|
-
};
|
|
1267
|
-
|
|
1268
|
-
const parseUrlSearch = (search) => {
|
|
1269
|
-
const urlSearchParams = new URLSearchParams(search);
|
|
1270
|
-
return Object.fromEntries(urlSearchParams.entries());
|
|
1271
|
-
};
|
|
1272
|
-
|
|
1273
|
-
const decodeToken = (token) => jwtDecode(token);
|
|
1274
|
-
|
|
1275
|
-
const lsGet = (key) => localStorage.getItem(key);
|
|
1276
|
-
const lsSet = (key, value) => localStorage.setItem(key, value);
|
|
1277
|
-
const lsRemove = (key) => localStorage.removeItem(key);
|
|
1278
|
-
// Organization
|
|
1279
|
-
const getDefaultOrgUuid = () => localStorage.getItem(`${lsGet("activeUser")}-defaultOrg`);
|
|
1280
|
-
const setDefaultOrgUuid = (organizationUuid) => localStorage.setItem(`${lsGet("activeUser")}-defaultOrg`, organizationUuid);
|
|
1281
|
-
const getActiveOrgUuid = () => localStorage.getItem(`${lsGet("activeUser")}-activeOrg`);
|
|
1282
|
-
const setActiveOrgUuid = (organizationUuid) => localStorage.setItem(`${lsGet("activeUser")}-activeOrg`, organizationUuid);
|
|
1283
|
-
// On logout
|
|
1284
|
-
const removeTokens = () => {
|
|
1285
|
-
lsRemove("token");
|
|
1286
|
-
lsRemove("refreshToken");
|
|
1287
|
-
};
|
|
1288
|
-
|
|
1289
|
-
const login = (data) => axiosInstance
|
|
1290
|
-
.post("/auth/token", data, {
|
|
1291
|
-
headers: {
|
|
1292
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
1293
|
-
noToast: true,
|
|
1294
|
-
public: true,
|
|
1295
|
-
},
|
|
1296
|
-
})
|
|
1297
|
-
.then(({ data }) => {
|
|
1298
|
-
lsSet("token", data.token);
|
|
1299
|
-
lsSet("refreshToken", data.refreshToken);
|
|
1300
|
-
lsSet("activeUser", decodeToken(data.token).userUuid);
|
|
1301
|
-
})
|
|
1302
|
-
.then(() => {
|
|
1303
|
-
const nextUrl = parseUrlSearch(window.location.search).nextUrl;
|
|
1304
|
-
window.location.href = nextUrl || "";
|
|
1305
|
-
});
|
|
1306
|
-
const logOut = (nextUrl, clearData) => {
|
|
1307
|
-
removeTokens();
|
|
1308
|
-
if (clearData) {
|
|
1309
|
-
lsRemove("activeUser");
|
|
1310
|
-
localStorage.removeItem(`${lsGet("activeUser")}-activeOrg`);
|
|
1311
|
-
}
|
|
1312
|
-
window.location.href = nextUrl
|
|
1313
|
-
? `/login?nextUrl=${window.location.pathname}`
|
|
1314
|
-
: "/login";
|
|
1315
|
-
};
|
|
1316
|
-
const loginWithCertificate = () => {
|
|
1317
|
-
return axiosInstance
|
|
1318
|
-
.post("/auth/certificate/token", undefined, {
|
|
1319
|
-
headers: { certificate: true, public: true },
|
|
1320
|
-
})
|
|
1321
|
-
.then(({ data }) => {
|
|
1322
|
-
lsSet("token", data.token);
|
|
1323
|
-
lsSet("activeUser", decodeToken(data.token).userUuid);
|
|
1324
|
-
})
|
|
1325
|
-
.then(() => {
|
|
1326
|
-
const nextUrl = parseUrlSearch(window.location.search).nextUrl;
|
|
1327
|
-
window.location.href = nextUrl || "";
|
|
1328
|
-
});
|
|
1329
|
-
};
|
|
1330
|
-
// export const getAuthData = (
|
|
1331
|
-
// organizationUuid?: string,
|
|
1332
|
-
// fetchOptions?: "USER"[]
|
|
1333
|
-
// ) =>
|
|
1334
|
-
// axiosInstance.get("/me", { params: { organizationUuid, fetchOptions } }).then(
|
|
1335
|
-
// ({ data }) =>
|
|
1336
|
-
// ({
|
|
1337
|
-
// ...data,
|
|
1338
|
-
// privilegesInsideOrganization: data.privilegesInsideOrganization
|
|
1339
|
-
// ? data.privilegesInsideOrganization.reduce(
|
|
1340
|
-
// (acc: IUserPrivileges, privilege: string) => ({
|
|
1341
|
-
// ...acc,
|
|
1342
|
-
// [privilege]: true,
|
|
1343
|
-
// }),
|
|
1344
|
-
// {}
|
|
1345
|
-
// )
|
|
1346
|
-
// : {},
|
|
1347
|
-
// } as {
|
|
1348
|
-
// user?: IUser;
|
|
1349
|
-
// userPreferences?: IUserPreferences;
|
|
1350
|
-
// organization?: IOrganization;
|
|
1351
|
-
// organizationSettings?: IOrganizationPrivileges;
|
|
1352
|
-
// userHasAccessToOrganization?: boolean;
|
|
1353
|
-
// privilegesInsideOrganization?: IUserPrivileges;
|
|
1354
|
-
// })
|
|
1355
|
-
// );
|
|
1356
|
-
const getNewTokens = (refreshToken) => {
|
|
1357
|
-
const formData = new FormData();
|
|
1358
|
-
formData.set("refreshToken", refreshToken);
|
|
1359
|
-
return axiosInstance
|
|
1360
|
-
.post("/auth/token", formData, {
|
|
1361
|
-
headers: {
|
|
1362
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
1363
|
-
public: true,
|
|
1364
|
-
noToast: true,
|
|
1365
|
-
},
|
|
1366
|
-
})
|
|
1367
|
-
.then(({ data }) => {
|
|
1368
|
-
lsSet("token", data.token);
|
|
1369
|
-
lsSet("refreshToken", data.refreshToken);
|
|
1370
|
-
})
|
|
1371
|
-
.catch(() => { });
|
|
1372
|
-
};
|
|
1373
|
-
const onRefreshToken = (setIsCertificateSessionAlmostExpired) => {
|
|
1374
|
-
const token = lsGet("token");
|
|
1375
|
-
const refreshToken = lsGet("refreshToken");
|
|
1376
|
-
const tokenDecoded = !!token && decodeToken(token);
|
|
1377
|
-
const now = Date.now();
|
|
1378
|
-
// If more then 70% of refresh token life has expired & refresh token is not expired
|
|
1379
|
-
if (!!tokenDecoded &&
|
|
1380
|
-
now < tokenDecoded.exp * 1000 &&
|
|
1381
|
-
tokenDecoded.exp * 1000 - now <
|
|
1382
|
-
(tokenDecoded.exp - tokenDecoded.iat) * 1000 * 0.3) {
|
|
1383
|
-
// If user is signed in without certificate, get new tokens
|
|
1384
|
-
if (!!refreshToken &&
|
|
1385
|
-
(!tokenDecoded.clientCertificate ||
|
|
1386
|
-
tokenDecoded.clientCertificate === "false")) {
|
|
1387
|
-
console.log("Get new token", new Date().toLocaleTimeString());
|
|
1388
|
-
return getNewTokens(refreshToken);
|
|
1389
|
-
// Else show dialog
|
|
1390
|
-
}
|
|
1391
|
-
else {
|
|
1392
|
-
return setIsCertificateSessionAlmostExpired(true);
|
|
1393
|
-
}
|
|
1394
|
-
}
|
|
1395
|
-
};
|
|
1396
|
-
|
|
1397
|
-
const axiosInstance = axios.create();
|
|
1398
|
-
const AxiosTokenHandler = ({ API_URL, CERTIFICATE_URL, children, }) => {
|
|
1399
|
-
const [isSessionExpired, setIsSessionExpired] = useState(false);
|
|
1400
|
-
const [isCertificateSessionAlmostExpired, setIsCertificateSessionAlmostExpired,] = useState(false);
|
|
1401
|
-
const [errors, setErrors] = useState([]);
|
|
1402
|
-
const [isSet, setIsSet] = useState(false);
|
|
1403
|
-
const { t } = useTranslation();
|
|
1404
|
-
// If User is NOT logged in with certificate, refresh token if near expiration
|
|
1405
|
-
useEffect(() => {
|
|
1406
|
-
const intervalId = setInterval(() => {
|
|
1407
|
-
!document.hidden && onRefreshToken(setIsCertificateSessionAlmostExpired);
|
|
1408
|
-
}, 5000);
|
|
1409
|
-
return () => {
|
|
1410
|
-
clearInterval(intervalId);
|
|
1411
|
-
};
|
|
1412
|
-
}, []);
|
|
1413
|
-
useEffect(() => {
|
|
1414
|
-
const reqInterceptor = axiosInstance.interceptors.request.use((config) => {
|
|
1415
|
-
config.baseURL = API_URL;
|
|
1416
|
-
if (config.headers.public) {
|
|
1417
|
-
config.headers = deleteProps(config.headers, ["public"]);
|
|
1418
|
-
if (config.headers.certificate) {
|
|
1419
|
-
config.headers = deleteProps(config.headers, ["certificate"]);
|
|
1420
|
-
config.baseURL =
|
|
1421
|
-
CERTIFICATE_URL?.replace("{random}", v4()) || "";
|
|
1422
|
-
}
|
|
1423
|
-
return config;
|
|
1424
|
-
}
|
|
1425
|
-
const token = config.headers.token || lsGet("token");
|
|
1426
|
-
const tokenDecoded = token && decodeToken(token);
|
|
1427
|
-
const controller = new AbortController();
|
|
1428
|
-
config.signal = controller.signal;
|
|
1429
|
-
// Logout user if token expired more then 4 hours ago
|
|
1430
|
-
if (!token || (Date.now() - tokenDecoded.exp * 1000) / 3600000 > 4) {
|
|
1431
|
-
controller.abort();
|
|
1432
|
-
logOut(true);
|
|
1433
|
-
}
|
|
1434
|
-
// Show popup if token expired
|
|
1435
|
-
else if (Date.now() > tokenDecoded.exp * 1000) {
|
|
1436
|
-
controller.abort();
|
|
1437
|
-
setIsSessionExpired(true);
|
|
1438
|
-
}
|
|
1439
|
-
else {
|
|
1440
|
-
// If Certificate request change baseUrl
|
|
1441
|
-
if (config.headers.certificate) {
|
|
1442
|
-
config.headers = deleteProps(config.headers, ["certificate"]);
|
|
1443
|
-
const certificateURL = CERTIFICATE_URL?.replace("{random}", v4()) || "";
|
|
1444
|
-
if (certificateURL) {
|
|
1445
|
-
config.baseURL = certificateURL;
|
|
1446
|
-
config.headers["x-epismonosa-user"] = tokenDecoded.sub;
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
config.headers.Authorization = `Bearer ${token}`;
|
|
1450
|
-
}
|
|
1451
|
-
return config;
|
|
1452
|
-
}, (error) => {
|
|
1453
|
-
console.log(1, "error: ", error);
|
|
1454
|
-
return Promise.reject(error);
|
|
1455
|
-
});
|
|
1456
|
-
const resInterceptor = axiosInstance.interceptors.response.use(undefined,
|
|
1457
|
-
// e => {
|
|
1458
|
-
// if (!e.config.headers?.noToast) {
|
|
1459
|
-
// if (e.config.headers?.toastType) {
|
|
1460
|
-
// setConfirm({
|
|
1461
|
-
// type: e.config.headers.toastType,
|
|
1462
|
-
// validation: e.config.headers.validation,
|
|
1463
|
-
// });
|
|
1464
|
-
// } else
|
|
1465
|
-
// switch (e.config.method) {
|
|
1466
|
-
// case 'post':
|
|
1467
|
-
// setConfirm({
|
|
1468
|
-
// type: 'Save',
|
|
1469
|
-
// validation: e.config.headers.validation,
|
|
1470
|
-
// });
|
|
1471
|
-
// break;
|
|
1472
|
-
// case 'put':
|
|
1473
|
-
// setConfirm({
|
|
1474
|
-
// type: 'Edit',
|
|
1475
|
-
// validation: e.config.headers.validation,
|
|
1476
|
-
// });
|
|
1477
|
-
// break;
|
|
1478
|
-
// }
|
|
1479
|
-
// }
|
|
1480
|
-
// return e;
|
|
1481
|
-
// },
|
|
1482
|
-
(error) => {
|
|
1483
|
-
if (error.config.signal?.aborted) {
|
|
1484
|
-
console.log("Request aborted");
|
|
1485
|
-
}
|
|
1486
|
-
else {
|
|
1487
|
-
const errors = error.response?.data.errors;
|
|
1488
|
-
const errorMessages = errors?.length
|
|
1489
|
-
? errors.map((e) => (e.errorCode && t(`Error${e.errorCode}`)) || e.errorMessage)
|
|
1490
|
-
: [t("ErrorMessage")];
|
|
1491
|
-
setErrors(errorMessages);
|
|
1492
|
-
}
|
|
1493
|
-
return Promise.reject(error);
|
|
1494
|
-
});
|
|
1495
|
-
setIsSet(true);
|
|
1496
|
-
return () => {
|
|
1497
|
-
setIsSet(false);
|
|
1498
|
-
axiosInstance.interceptors.request.eject(reqInterceptor);
|
|
1499
|
-
axiosInstance.interceptors.response.eject(resInterceptor);
|
|
1500
|
-
};
|
|
1501
|
-
}, []);
|
|
1502
|
-
return (jsxs(Fragment, { children: [isSet ? children : null, jsx(Dialog, { isOpen: isSessionExpired, onClose: () => setIsSessionExpired(false), cancelButton: {
|
|
1503
|
-
label: t("No"),
|
|
1504
|
-
// icon: faXmark,
|
|
1505
|
-
}, confirmButton: {
|
|
1506
|
-
label: t("Yes"),
|
|
1507
|
-
// icon: faCheck,
|
|
1508
|
-
onClick: () => logOut(true),
|
|
1509
|
-
}, title: t("SessionExpired"), desc: t("SessionExpiredInfo"), type: "info" }), jsx(Dialog, { isOpen: isCertificateSessionAlmostExpired, onClose: () => setIsCertificateSessionAlmostExpired(false), cancelButton: {
|
|
1510
|
-
label: t("Logout"),
|
|
1511
|
-
// icon: faXmark,
|
|
1512
|
-
onClick: () => logOut(true, true),
|
|
1513
|
-
}, confirmButton: {
|
|
1514
|
-
label: t("Yes"),
|
|
1515
|
-
// icon: faCheck,
|
|
1516
|
-
onClick: () => loginWithCertificate().catch(() => {
|
|
1517
|
-
setErrors([t("WrongCertificate")]);
|
|
1518
|
-
}),
|
|
1519
|
-
}, title: t("SessionWillExpire"), desc: t("SessionWillExpireInfo"), type: "info" }), jsx(Dialog, { isOpen: !!errors.length, onClose: () => setErrors([]), type: "error", children: jsx("div", { children: errors.map((e, i) => (jsxs(Fragment$1, { children: [i > 0 && jsx("hr", {}), jsx("div", { className: "text-center new-line", children: e })] }, e))) }) })] }));
|
|
1520
|
-
};
|
|
1521
|
-
|
|
1522
|
-
export { Accordions, Alert, AxiosTokenHandler, Button, Checkbox, Collapse, ConditionalWrapper, DateInput, Dialog, FormWrapper, FullPageWrapper, FullScreenLoader, Header, IconButton, ItemActionsMenu, ItemEditOptionsButtons, LargeTextInput, LazyLoader, Loader, Menu, MenuItem, NoAccessInfo, NotificationBadge, NumberInput, PageWrapper, PasswordInput, PillBadge, Radio, Select, SelectAsyncPaginate, SetTableFilter, Sidebar, Table, TableEditRow, TableFooter, Tabs, TextInput, Tooltip, axiosInstance, checkIfExpired, dateAddDays, deleteEmptyProps, deleteEmptyPropsIncludingArray, deleteProps, formatCurrency, formatCurrencyNoDecimals, formatDate, formatDateAndTime, formatTime, formatYearMonth, getActiveFilterNumber, getActiveOrgUuid, getCurrentDateFormattedYMD, getDaysLeft, getDefaultOrgUuid, getNewTokens, getVisibleColumnsIds, logOut, login, loginWithCertificate, lsGet, lsRemove, lsSet, maxChar, parseUrlSearch, setActiveOrgUuid, setDefaultOrgUuid };
|
|
1
|
+
import e from"clsx";export{default as clsx}from"clsx";import l from"moment";export{default as moment}from"moment";import{FontAwesomeIcon as i}from"@fortawesome/react-fontawesome";export{FontAwesomeIcon}from"@fortawesome/react-fontawesome";export{v4 as uuidv4}from"uuid";import a from"moment/moment";import{jsx as t,jsxs as n,Fragment as c}from"react/jsx-runtime";import{useState as r,useRef as o,useEffect as s,forwardRef as d,useCallback as m,cloneElement as u,Fragment as h}from"react";import{createPortal as p}from"react-dom";import{Calendar as f}from"react-calendar";import"react-calendar/dist/Calendar.css";import{useTranslation as b}from"react-i18next";import g from"react-select";import{AsyncPaginate as v}from"react-select-async-paginate";import{DragDropContext as C,Droppable as N,Draggable as x}from"react-beautiful-dnd";const y=e=>e?a(e).format("DD.MM.YYYY."):"/",w=(e,l)=>e?a(e).format("DD.MM.YYYY. HH:mm"+(l?":ss":"")):"/",k=(e,l)=>e?a(e).format("HH:mm"+(l?":ss":"")):"/",S=(e,l)=>a(e).add(l,"days").toISOString(),M=e=>!e||a(new Date)>a(e),z=()=>a().format("yyyy-MM-DD").toString(),L=e=>a(e).diff(new Date,"days"),D=(e,l)=>`${e}-${l<10?`0${l}`:l}`,$=(e,l,i)=>Number(e||0).toLocaleString("sr-RS",{minimumFractionDigits:l||2,maximumFractionDigits:i||2}),R=e=>Number(e||0).toLocaleString("sr-RS"),O=(e="",l=30)=>e.length>l?`${e.substring(0,l)}...`:e,F=(e,l)=>{let i={...e};return l.forEach((e=>delete i[e])),i},P=e=>Object.entries(e).reduce(((e,[l,i])=>([null,void 0,""].includes(i)||(e[l]=i),e)),{}),V=e=>Object.entries(e).reduce(((e,[l,i])=>([null,void 0,""].includes(i)||Array.isArray(i)&&!i.length||(e[l]=i),e)),{}),I=e=>Object.keys(e).length,H=(e,l)=>e.reduce(((e,i)=>i.hidden||i.unavailable||l&&["select","icons","actions"].includes(i.id)?e:e.concat(i.id)),[]),B=({isOpen:l,className:i,children:a})=>{const[n,c]=r(),d=o(null);return s((()=>{const e=new ResizeObserver((e=>{const l=Math.ceil(e[0].contentRect.height);c(l)}));let l;return d.current&&(l=d.current,e.observe(l)),()=>{l&&e.unobserve(l)}}),[d]),t("div",{className:e("iui-colapse",i),style:{maxHeight:l?n:0},children:t("div",{ref:d,children:a})})},E={prefix:"fal",iconName:"arrow-down-short-wide",icon:[576,512,[],"f884","M304 208h128C440.8 208 448 200.8 448 192s-7.156-16-16-16h-128c-8.844 0-15.1 7.156-15.1 16S295.2 208 304 208zM304 336h192c8.844 0 16-7.156 16-16s-7.156-16-16-16h-192c-8.844 0-15.1 7.156-15.1 16S295.2 336 304 336zM304 80h64c8.844 0 16-7.156 16-16S376.8 48 368 48h-64c-8.844 0-15.1 7.156-15.1 16S295.2 80 304 80zM560 432h-256c-8.844 0-15.1 7.156-15.1 16S295.2 464 304 464h256c8.844 0 16-7.156 16-16S568.8 432 560 432zM224 352c-4.094 0-8.188 1.562-11.31 4.688L144 425.4V48C144 39.16 136.8 32 128 32S112 39.16 112 48v377.4l-68.69-68.69c-6.25-6.25-16.38-6.25-22.62 0s-6.25 16.38 0 22.62l96 96c6.25 6.25 16.38 6.25 22.62 0l96-96c6.25-6.25 6.25-16.38 0-22.62C232.2 353.6 228.1 352 224 352z"]},W={prefix:"fal",iconName:"arrow-down-wide-short",icon:[576,512,[],"f160","M368 432h-64c-8.844 0-15.1 7.156-15.1 16S295.2 464 304 464h64c8.844 0 16-7.156 16-16S376.8 432 368 432zM432 304h-128c-8.844 0-15.1 7.156-15.1 16S295.2 336 304 336h128c8.844 0 16-7.156 16-16S440.8 304 432 304zM496 176h-192c-8.844 0-15.1 7.156-15.1 16S295.2 208 304 208h192C504.8 208 512 200.8 512 192S504.8 176 496 176zM560 48h-256c-8.844 0-15.1 7.156-15.1 16S295.2 80 304 80h256C568.8 80 576 72.84 576 64S568.8 48 560 48zM224 352c-4.094 0-8.188 1.562-11.31 4.688L144 425.4V48C144 39.16 136.8 32 128 32S112 39.16 112 48v377.4l-68.69-68.69c-6.25-6.25-16.38-6.25-22.62 0s-6.25 16.38 0 22.62l96 96c6.25 6.25 16.38 6.25 22.62 0l96-96c6.25-6.25 6.25-16.38 0-22.62C232.2 353.6 228.1 352 224 352z"]},q={prefix:"fal",iconName:"arrows-to-line",icon:[448,512,[],"e0a7","M235.3 324.7C231.3 320.7 226.5 320 224 320s-7.299 .6547-11.33 4.698l-79.98 79.98C129.6 407.8 128 411.9 128 416c0 8.523 6.865 16 16 16c4.094 0 8.188-1.562 11.31-4.688L208 374.6V496c0 8.844 7.156 16 16 16s16-7.156 16-16v-121.4l52.69 52.69C295.8 430.4 299.9 432 304 432c9.139 0 16-7.477 16-16c0-4.094-1.562-8.188-4.688-11.31L235.3 324.7zM212.7 187.3C214.4 189 218.3 192 224 192s9.609-2.98 11.33-4.707l79.98-79.98C318.4 104.2 320 100.1 320 96c0-8.527-6.865-16-16-16c-4.094 0-8.188 1.562-11.31 4.688L240 137.4V16C240 7.156 232.8 0 224 0S208 7.156 208 16v121.4L155.3 84.69C152.2 81.56 148.1 80 144 80C134.9 80 128 87.47 128 96c0 4.094 1.562 8.188 4.688 11.31L212.7 187.3zM432 240h-416C7.156 240 0 247.1 0 255.1S7.156 272 16 272h416c8.844 0 16-7.165 16-16.01S440.8 240 432 240z"]},T={prefix:"fal",iconName:"arrows-up-down",icon:[256,512,[],"f07d","M139.3 4.688l112 112C254.4 119.8 256 123.9 256 128s-1.562 8.188-4.688 11.31c-6.25 6.25-16.38 6.25-22.62 0L144 54.63v402.8l84.69-84.69c6.25-6.25 16.38-6.25 22.62 0C254.4 375.8 256 379.9 256 384s-1.562 8.188-4.688 11.31l-112 112c-6.25 6.25-16.38 6.25-22.62 0l-112-112c-6.25-6.25-6.25-16.38 0-22.62s16.38-6.25 22.62 0L112 457.4V54.63L27.31 139.3c-6.25 6.25-16.38 6.25-22.62 0s-6.25-16.38 0-22.62l112-112C122.9-1.562 133.1-1.562 139.3 4.688z"]},A={prefix:"fal",iconName:"check",icon:[512,512,[],"f00c","M475.3 123.3l-272 272C200.2 398.4 196.1 400 192 400s-8.188-1.562-11.31-4.688l-144-144c-6.25-6.25-6.25-16.38 0-22.62s16.38-6.25 22.62 0L192 361.4l260.7-260.7c6.25-6.25 16.38-6.25 22.62 0S481.6 117.1 475.3 123.3z"]},j={prefix:"fal",iconName:"ellipsis-vertical",icon:[128,512,[],"f142","M64 384C81.67 384 96 398.3 96 416C96 433.7 81.67 448 64 448C46.33 448 32 433.7 32 416C32 398.3 46.33 384 64 384zM64 224C81.67 224 96 238.3 96 256C96 273.7 81.67 288 64 288C46.33 288 32 273.7 32 256C32 238.3 46.33 224 64 224zM64 128C46.33 128 32 113.7 32 96C32 78.33 46.33 64 64 64C81.67 64 96 78.33 96 96C96 113.7 81.67 128 64 128z"]},Y={prefix:"fal",iconName:"xmark",icon:[320,512,[],"f00d","M315.3 411.3c-6.253 6.253-16.37 6.253-22.63 0L160 278.6l-132.7 132.7c-6.253 6.253-16.37 6.253-22.63 0c-6.253-6.253-6.253-16.37 0-22.63L137.4 256L4.69 123.3c-6.253-6.253-6.253-16.37 0-22.63c6.253-6.253 16.37-6.253 22.63 0L160 233.4l132.7-132.7c6.253-6.253 16.37-6.253 22.63 0c6.253 6.253 6.253 16.37 0 22.63L182.6 256l132.7 132.7C321.6 394.9 321.6 405.1 315.3 411.3z"]},U=({tabs:l,initialValue:a,compact:c,className:o})=>{const s=l.filter((e=>!e.hidden)),[d,m]=r(a||"");return s.length?t("div",{className:o,children:t("div",{className:"iui-accordions",children:s.map((l=>n("div",{className:e("iui-accordion",{selected:d===l.value,compact:c}),children:[n("div",{className:e("summary clickable",{disabled:l.disabled}),onClick:l.disabled?void 0:()=>m(d===l.value?"":l.value),children:[n("div",{className:"flex center",children:[l.icon&&t(i,{icon:l.icon,className:"iui-icon"}),l.label]}),t(i,{icon:l.value===d?q:T,className:"collapse-icon"})]}),t(B,{isOpen:d===l.value,children:t("div",{className:"p-4",children:l.component})})]},l.value)))})}):null},Z={prefix:"far",iconName:"circle-info",icon:[512,512,[],"f05a","M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464zM296 336h-16V248C280 234.8 269.3 224 256 224H224C210.8 224 200 234.8 200 248S210.8 272 224 272h8v64h-16C202.8 336 192 346.8 192 360S202.8 384 216 384h80c13.25 0 24-10.75 24-24S309.3 336 296 336zM256 192c17.67 0 32-14.33 32-32c0-17.67-14.33-32-32-32S224 142.3 224 160C224 177.7 238.3 192 256 192z"]},X={prefix:"far",iconName:"triangle-exclamation",icon:[512,512,[],"f071","M506.3 417l-213.3-364C284.8 39 270.4 32 256 32C241.6 32 227.2 39 218.1 53l-213.2 364C-10.59 444.9 9.851 480 42.74 480h426.6C502.1 480 522.6 445 506.3 417zM52.58 432L255.1 84.8L459.4 432H52.58zM256 337.1c-17.36 0-31.44 14.08-31.44 31.44c0 17.36 14.11 31.44 31.48 31.44s31.4-14.08 31.4-31.44C287.4 351.2 273.4 337.1 256 337.1zM232 184v96C232 293.3 242.8 304 256 304s24-10.75 24-24v-96C280 170.8 269.3 160 256 160S232 170.8 232 184z"]},K={error:{prefix:"far",iconName:"circle-exclamation",icon:[512,512,[],"f06a","M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464zM256 304c13.25 0 24-10.75 24-24v-128C280 138.8 269.3 128 256 128S232 138.8 232 152v128C232 293.3 242.8 304 256 304zM256 337.1c-17.36 0-31.44 14.08-31.44 31.44C224.6 385.9 238.6 400 256 400s31.44-14.08 31.44-31.44C287.4 351.2 273.4 337.1 256 337.1z"]},success:{prefix:"far",iconName:"circle-check",icon:[512,512,[],"f058","M335 175L224 286.1L176.1 239c-9.375-9.375-24.56-9.375-33.94 0s-9.375 24.56 0 33.94l64 64C211.7 341.7 217.8 344 224 344s12.28-2.344 16.97-7.031l128-128c9.375-9.375 9.375-24.56 0-33.94S344.4 165.7 335 175zM256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464z"]},info:Z,warning:X},J=({text:l,severity:a,fitContent:c,className:r,children:o})=>n("div",{className:e("iui-alert",a,r,{"width-fit":c}),children:[t(i,{icon:K[a]}),l,o]}),G=({number:l,className:i,small:a,children:c})=>n("div",{className:"iui-badge-parent",children:[c,!!l&&l>0&&t("div",{className:e("iui-badge primary",i,{small:a}),children:l>99?"99+":l})]}),Q=d((({label:l,color:i,className:a},n)=>t("div",{ref:n,className:e("iui-pill-badge",i,a),children:l}))),_=d((({label:l,icon:a,iconEnd:c,onClick:r,disabled:o,primary:s,outlined:d,active:m,className:u,size:h="m",buttonProps:p},f)=>n("button",{ref:f,disabled:o,className:e("iui-btn",u,h,{primary:s,outlined:d,active:m}),onClick:r,type:p?.type||r?"button":"submit",...p,children:[a&&t(i,{icon:a}),t("div",{className:"iui-btn-label",children:l}),c&&t(i,{icon:c})]}))),ee=d((({icon:l,onClick:a,disabled:n,className:c,active:r,buttonProps:o},s)=>t("button",{ref:s,disabled:n,className:e("iui-btn iui-icon-btn",c,{active:r}),onClick:a,type:o?.type||a?"button":"submit",...o,children:t(i,{icon:l})}))),le=({condition:e,wrapper:l,children:i})=>e?l(i):i,ie={info:Z,error:X},ae=({title:l,titleEl:a,desc:c,descEl:r,isOpen:d,onClose:u,confirmButton:h,cancelButton:f,additionalButton:b,noBackgroundClick:g,noOverflow:v,type:C,size:N,noPadding:x,className:y,children:w})=>{const k=o(null),S=m((()=>{k.current?.classList.add("closing"),setTimeout(u,200)}),[k,u]);return s((()=>{if(!g){const e=e=>e.target===k.current&&S();return window.addEventListener("click",e),()=>window.removeEventListener("click",e)}}),[g,S]),d?p(t("div",{ref:k,className:"iui-dialog",children:t(le,{condition:!!h?.onFormSubmit,wrapper:e=>t("form",{onSubmit:e=>{e.preventDefault(),e.stopPropagation(),h.onFormSubmit(),!h.keepOpen&&S()},children:e}),children:n("div",{className:e("iui-dialog-container",N,C,y),children:[l&&t("h1",{children:l}),a,n("div",{className:e("iui-dialog-content",{padding:!x,"no-overflow":v}),children:[C&&t(i,{icon:ie[C]}),c&&t("p",{children:c}),r,w]}),n("div",{className:"iui-dialog-actions",children:[t(_,{label:f?.label||(h?"Otkaži":"Ok"),icon:f?.icon,primary:!h,onClick:e=>{e.stopPropagation(),f?.onClick?f.onClick():S()}}),b&&t(_,{label:b.label,icon:b.icon,className:"ml-2",onClick:b.onClick?e=>{e.stopPropagation(),b.onClick(),S()}:void 0,disabled:b.disabled}),h&&t(_,{label:h.label||"Potvrdi",icon:h.icon,primary:!0,className:"ml-2",onClick:h.onClick?e=>{e.stopPropagation(),h.onClick(),!h.keepOpen&&S()}:void 0,disabled:h.disabled})]})]})})}),document.body):null},te=({title:e,buttonLabel:l})=>{const i=useNavigate();return n("div",{className:"flex center column mt-5",children:[n("svg",{id:"aa03ddf9-f8f2-4819-a4ce-be9b0a220741","data-name":"Layer 1",xmlns:"http://www.w3.org/2000/svg",width:"40%",viewBox:"0 0 1119.60911 699",children:[t("title",{children:"No Access"}),t("circle",{cx:"292.60911",cy:"213",r:"213",fill:"#f2f2f2"}),t("path",{d:"M31.39089,151.64237c0,77.49789,48.6181,140.20819,108.70073,140.20819",transform:"translate(-31.39089 -100.5)",fill:"#2f2e41"}),t("path",{d:"M140.09162,291.85056c0-78.36865,54.255-141.78356,121.30372-141.78356",transform:"translate(-31.39089 -100.5)",fill:"#4191ff"}),t("path",{d:"M70.77521,158.66768c0,73.61476,31.00285,133.18288,69.31641,133.18288",transform:"translate(-31.39089 -100.5)",fill:"#4191ff"}),t("path",{d:"M140.09162,291.85056c0-100.13772,62.7103-181.16788,140.20819-181.16788",transform:"translate(-31.39089 -100.5)",fill:"#2f2e41"}),t("path",{d:"M117.22379,292.83905s15.41555-.47479,20.06141-3.783,23.713-7.2585,24.86553-1.95278,23.16671,26.38821,5.76263,26.5286-40.43935-2.711-45.07627-5.53549S117.22379,292.83905,117.22379,292.83905Z",transform:"translate(-31.39089 -100.5)",fill:"#a8a8a8"}),t("path",{d:"M168.224,311.78489c-17.40408.14042-40.43933-2.71094-45.07626-5.53548-3.53126-2.151-4.93843-9.86945-5.40926-13.43043-.32607.014-.51463.02-.51463.02s.97638,12.43276,5.61331,15.2573,27.67217,5.67589,45.07626,5.53547c5.02386-.04052,6.7592-1.82793,6.66391-4.47526C173.87935,310.756,171.96329,311.75474,168.224,311.78489Z",transform:"translate(-31.39089 -100.5)",opacity:"0.2"}),t("ellipse",{cx:"198.60911",cy:"424.5",rx:"187",ry:"25.43993",fill:"#3f3d56"}),t("ellipse",{cx:"198.60911",cy:"424.5",rx:"157",ry:"21.35866",opacity:"0.1"}),t("ellipse",{cx:"836.60911",cy:"660.5",rx:"283",ry:"38.5",fill:"#3f3d56"}),t("ellipse",{cx:"310.60911",cy:"645.5",rx:"170",ry:"23.12721",fill:"#3f3d56"}),t("path",{d:"M494,726.5c90,23,263-30,282-90",transform:"translate(-31.39089 -100.5)",fill:"none",stroke:"#2f2e41",strokeMiterlimit:"10",strokeWidth:"2"}),t("path",{d:"M341,359.5s130-36,138,80-107,149-17,172",transform:"translate(-31.39089 -100.5)",fill:"none",stroke:"#2f2e41",strokeMiterlimit:"10",strokeWidth:"2"}),t("path",{d:"M215.40233,637.78332s39.0723-10.82,41.47675,24.04449-32.15951,44.78287-5.10946,51.69566",transform:"translate(-31.39089 -100.5)",fill:"none",stroke:"#2f2e41",strokeMiterlimit:"10",strokeWidth:"2"}),t("path",{d:"M810.09554,663.73988,802.218,714.03505s-38.78182,20.60284-11.51335,21.20881,155.73324,0,155.73324,0,24.84461,0-14.54318-21.81478l-7.87756-52.719Z",transform:"translate(-31.39089 -100.5)",fill:"#2f2e41"}),t("path",{d:"M785.21906,734.69812c6.193-5.51039,16.9989-11.252,16.9989-11.252l7.87756-50.2952,113.9216.10717,7.87756,49.582c9.185,5.08711,14.8749,8.987,18.20362,11.97818,5.05882-1.15422,10.58716-5.44353-18.20362-21.38921l-7.87756-52.719-113.9216,3.02983L802.218,714.03506S769.62985,731.34968,785.21906,734.69812Z",transform:"translate(-31.39089 -100.5)",opacity:"0.1"}),t("rect",{x:"578.43291",y:"212.68859",width:"513.25314",height:"357.51989",rx:"18.04568",fill:"#2f2e41"}),t("rect",{x:"595.70294",y:"231.77652",width:"478.71308",height:"267.83694",fill:"#3f3d56"}),t("circle",{cx:"835.05948",cy:"223.29299",r:"3.02983",fill:"#f2f2f2"}),t("path",{d:"M1123.07694,621.32226V652.6628a18.04341,18.04341,0,0,1-18.04568,18.04568H627.86949A18.04341,18.04341,0,0,1,609.8238,652.6628V621.32226Z",transform:"translate(-31.39089 -100.5)",fill:"#2f2e41"}),t("polygon",{points:"968.978 667.466 968.978 673.526 642.968 673.526 642.968 668.678 643.417 667.466 651.452 645.651 962.312 645.651 968.978 667.466",fill:"#2f2e41"}),t("path",{d:"M1125.828,762.03359c-.59383,2.539-2.83591,5.21743-7.90178,7.75032-18.179,9.08949-55.1429-2.42386-55.1429-2.42386s-28.4804-4.84773-28.4804-17.573a22.72457,22.72457,0,0,1,2.49658-1.48459c7.64294-4.04351,32.98449-14.02122,77.9177.42248a18.73921,18.73921,0,0,1,8.54106,5.59715C1125.07908,756.45353,1126.50669,759.15715,1125.828,762.03359Z",transform:"translate(-31.39089 -100.5)",fill:"#2f2e41"}),t("path",{d:"M1125.828,762.03359c-22.251,8.526-42.0843,9.1622-62.43871-4.975-10.26507-7.12617-19.59089-8.88955-26.58979-8.75618,7.64294-4.04351,32.98449-14.02122,77.9177.42248a18.73921,18.73921,0,0,1,8.54106,5.59715C1125.07908,756.45353,1126.50669,759.15715,1125.828,762.03359Z",transform:"translate(-31.39089 -100.5)",opacity:"0.1"}),t("ellipse",{cx:"1066.53846",cy:"654.13477",rx:"7.87756",ry:"2.42386",fill:"#f2f2f2"}),t("circle",{cx:"835.05948",cy:"545.66686",r:"11.51335",fill:"#f2f2f2"}),t("polygon",{points:"968.978 667.466 968.978 673.526 642.968 673.526 642.968 668.678 643.417 667.466 968.978 667.466",opacity:"0.1"}),t("rect",{x:"108.60911",y:"159",width:"208",height:"242",fill:"#2f2e41"}),t("rect",{x:"87.60911",y:"135",width:"250",height:"86",fill:"#3f3d56"}),t("rect",{x:"87.60911",y:"237",width:"250",height:"86",fill:"#3f3d56"}),t("rect",{x:"87.60911",y:"339",width:"250",height:"86",fill:"#3f3d56"}),t("rect",{x:"271.60911",y:"150",width:"16",height:"16",fill:"#4191ff",opacity:"0.4"}),t("rect",{x:"294.60911",y:"150",width:"16",height:"16",fill:"#4191ff",opacity:"0.8"}),t("rect",{x:"317.60911",y:"150",width:"16",height:"16",fill:"#4191ff"}),t("rect",{x:"271.60911",y:"251",width:"16",height:"16",fill:"#4191ff",opacity:"0.4"}),t("rect",{x:"294.60911",y:"251",width:"16",height:"16",fill:"#4191ff",opacity:"0.8"}),t("rect",{x:"317.60911",y:"251",width:"16",height:"16",fill:"#4191ff"}),t("rect",{x:"271.60911",y:"352",width:"16",height:"16",fill:"#4191ff",opacity:"0.4"}),t("rect",{x:"294.60911",y:"352",width:"16",height:"16",fill:"#4191ff",opacity:"0.8"}),t("rect",{x:"317.60911",y:"352",width:"16",height:"16",fill:"#4191ff"}),t("circle",{cx:"316.60911",cy:"538",r:"79",fill:"#2f2e41"}),t("rect",{x:"280.60911",y:"600",width:"24",height:"43",fill:"#2f2e41"}),t("rect",{x:"328.60911",y:"600",width:"24",height:"43",fill:"#2f2e41"}),t("ellipse",{cx:"300.60911",cy:"643.5",rx:"20",ry:"7.5",fill:"#2f2e41"}),t("ellipse",{cx:"348.60911",cy:"642.5",rx:"20",ry:"7.5",fill:"#2f2e41"}),t("circle",{cx:"318.60911",cy:"518",r:"27",fill:"#fff"}),t("circle",{cx:"318.60911",cy:"518",r:"9",fill:"#3f3d56"}),t("path",{d:"M271.36733,565.03228c-6.37889-28.56758,14.01185-57.43392,45.544-64.47477s62.2651,10.41,68.644,38.9776-14.51861,39.10379-46.05075,46.14464S277.74622,593.59986,271.36733,565.03228Z",transform:"translate(-31.39089 -100.5)",fill:"#4191ff"}),t("ellipse",{cx:"417.21511",cy:"611.34365",rx:"39.5",ry:"12.40027",transform:"translate(-238.28665 112.98044) rotate(-23.17116)",fill:"#2f2e41"}),t("ellipse",{cx:"269.21511",cy:"664.34365",rx:"39.5",ry:"12.40027",transform:"translate(-271.07969 59.02084) rotate(-23.17116)",fill:"#2f2e41"}),t("path",{d:"M394,661.5c0,7.732-19.90861,23-42,23s-43-14.268-43-22,20.90861-6,43-6S394,653.768,394,661.5Z",transform:"translate(-31.39089 -100.5)",fill:"#fff"})]}),t("h1",{className:"fs-32 mt-5",children:e||"You have no access to this resource"}),t(_,{label:l||"Return to homepage",className:"mt-5",primary:!0,size:"l",onClick:()=>i("/")})]})},ne=d((({label:l,value:i,setValue:a,required:c,disabled:r,className:o,children:s},d)=>n("label",{ref:d,className:e("iui-checkbox clickable",o,{disabled:r}),children:[t("input",{required:c,disabled:r,type:"checkbox",checked:i,onChange:()=>a(!i)}),t("svg",{className:e("icon",{selected:i}),focusable:"false",viewBox:"0 0 24 24","aria-hidden":"true",children:t("path",i?{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}:{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})}),l?t("p",{children:l}):s]}))),ce={prefix:"far",iconName:"calendar",icon:[448,512,[],"f133","M152 64H296V24C296 10.75 306.7 0 320 0C333.3 0 344 10.75 344 24V64H384C419.3 64 448 92.65 448 128V448C448 483.3 419.3 512 384 512H64C28.65 512 0 483.3 0 448V128C0 92.65 28.65 64 64 64H104V24C104 10.75 114.7 0 128 0C141.3 0 152 10.75 152 24V64zM48 448C48 456.8 55.16 464 64 464H384C392.8 464 400 456.8 400 448V192H48V448z"]},re={prefix:"fas",iconName:"xmark",icon:[320,512,[],"f00d","M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"]},oe=({isOpen:l,onClose:i,renderButton:a,placementX:d,placementY:u="auto",size:h,className:f,children:b})=>{const g=o(null),v=o(null),C=o(null),[N,x]=r({offsetLeft:0,offsetTop:0}),[y,w]=r(),k=m((()=>{if(C.current&&g.current){const e=C.current.getBoundingClientRect(),l=g.current.getBoundingClientRect();let i=e.bottom+5;const a=e.left+("right"===d?e.width-l.width:0);"bottom"===u&&w(window.innerHeight-e.bottom-20),"top"===u&&w(window.innerHeight-e.top+40),("auto"===u&&i+l.height>window.innerHeight||"top"===u)&&(i=e.top-l.height-5),x({offsetTop:i,offsetLeft:a})}}),[g,C,d,u]);return s((()=>(l?window.addEventListener("resize",k):window.removeEventListener("resize",k),document.body.style.marginRight=l&&window.innerWidth>document.body.clientWidth?"19px":"",document.body.style.overflow=l?"hidden":"",k(),()=>{window.removeEventListener("resize",k)})),[l,k]),s((()=>{const e=v.current,a=l=>l.target===e&&i();return l?e?.addEventListener("click",a):e?.removeEventListener("click",a),()=>e?.removeEventListener("click",a)}),[l,i]),n(c,{children:[a(C),l?p(t("div",{ref:v,className:"portal-background",children:t("div",{ref:g,className:e("iui-menu",f,h),style:{top:N.offsetTop+"px",left:N.offsetLeft+"px",maxHeight:y||void 0},children:b})}),document.body):null]})},se=({label:l,shrink:i,focus:a,required:c,className:r,minWidth:o,helperText:s,error:d,children:m})=>n("div",{className:e("iui-input-container",r,{error:d}),style:{minWidth:o},children:[n("fieldset",{className:e({shrink:i,focus:a}),children:[!!l&&t("label",{children:c&&l?`${l} *`:l}),!!l&&t("legend",{children:c?`${l} *`:l}),m]}),s&&t("p",{className:"helper-text new-line",children:s})]}),de={day:{placeholder:"dd",regex:"^[0-9]{2}"},month:{placeholder:"mm",regex:"^[0-9]{2}"},year:{placeholder:"yyyy",regex:"^[0-9]{4}"}},me=d((({value:l,setValue:i,setDate:a,values:n,required:c,disabled:d,autoFocus:m,min:u=1,max:h,part:p,previousInput:f,nextInput:b,setFocus:g},v)=>{const[C,N]=r(!1),x=o(null);s((()=>{"year"===p&&4!==l.length||+l>h||+l<u?N(!0):C&&N(!1)}),[p,u,h,l,C]);const y=`^[0-9]{0,${h.toString().length}}$`;return t("input",{ref:v||x,value:l||"",onChange:e=>(e=>{if(e){if(new RegExp(y).test(e)){i(e);const l="year"===p?e:n.year,t="month"===p?e:n.month,c="day"===p?e:n.day;c&&t&&4===l.length&&a(`${l}-${2===t.length?t:`0${t}`}-${2===c.length?c:`0${c}`}`)}}else i("")})(e.target.value),onClick:e=>e.stopPropagation(),onKeyDown:e=>{"ArrowLeft"===e.key?(e.preventDefault(),f?.select()):"ArrowRight"===e.key&&(e.preventDefault(),b?.select())},onKeyUp:e=>{"year"!==p&&isFinite(+e.key)&&2===l.length&&b?.select()},onFocus:e=>{g(!0),e.target.select()},onBlur:()=>g(!1),required:c,disabled:d,autoFocus:m,min:u,max:h,inputMode:"numeric",type:"number",tabIndex:"day"!==p?-1:void 0,placeholder:de[p].placeholder,pattern:de[p].regex,className:e({error:C}),style:{width:"year"!==p||l?"month"!==p||l?`${l.length||2}ch`:23:"4ch"}})})),ue=d((({label:c,date:d,setDate:m,required:u,disabled:h,autoFocus:p,helperText:b,error:g,className:v,calendarPlacementX:C},N)=>{const[x,y]=r(d?.split("-")[2]||""),[w,k]=r(d?.split("-")[1]||""),[S,M]=r(d?.split("-")[0]||""),[z,L]=r(!1),[D,$]=r(!1),R=o(null),O=o(null),F=o(null),P=o(null),V=S&&w?new Date(+S,+w,0).getDate():31;return s((()=>{d?[O.current,F.current,P.current].includes(document.activeElement)||(M(d.split("-")[0]||""),k(d.split("-")[1]||""),y(d.split("-")[2]||"")):(M(""),k(""),y(""))}),[d]),t(se,{label:c,shrink:!0,focus:D||z,required:u,helperText:b,className:v,error:g,children:t(oe,{isOpen:z,onClose:()=>L(!1),placementX:C||"left",renderButton:l=>n("div",{ref:l,className:e("date-input",{disabled:h}),children:[n("div",{ref:R,className:"inputs",onClick:()=>O.current?.focus(),children:[t(me,{ref:O,value:x,setValue:y,setDate:m,values:{day:x,month:w,year:S},required:u||!!w||!!S,disabled:h,autoFocus:p,max:V,part:"day",nextInput:F.current,setFocus:$}),t("span",{children:"."}),t(me,{ref:F,value:w,setValue:k,setDate:m,values:{day:x,month:w,year:S},required:u||!!x||!!S,disabled:h,max:12,part:"month",previousInput:O.current,nextInput:P.current,setFocus:$}),t("span",{children:"."}),t(me,{ref:P,value:S,setValue:M,setDate:m,values:{day:x,month:w,year:S},required:u||!!x||!!w,disabled:h,min:1500,max:2500,part:"year",previousInput:F.current,setFocus:$})]}),n("div",{className:"flex",children:[t("div",{className:e("button",{disabled:h}),onClick:()=>!h&&m(""),children:t(i,{icon:re})}),t("div",{className:e("button",{disabled:h}),onClick:()=>!h&&L(!z),children:t(i,{icon:ce})})]})]}),children:t(f,{value:d?l(d).isValid()?new Date(d):new Date:null,onChange:e=>{const l=(e=>a(e).format("yyyy-MM-DD"))(e);m(l),L(!1)}})})})})),he=d((({label:e,value:l,setValue:i,required:a,disabled:n,autoFocus:c,rows:o,placeholder:s,helperText:d,className:m,inputProps:u,error:h},p)=>{const[f,b]=r(!1),[g,v]=r(!1);return t(se,{label:e,shrink:!!(l||s||g),focus:f,required:a,helperText:d,className:m,error:h,children:t("textarea",{ref:p,autoFocus:c,onFocus:()=>{b(!0),g&&v(!1)},onBlur:()=>b(!1),placeholder:a&&s?`${s} *`:s,value:l||"",onChange:e=>i(e.target.value),rows:o,required:a,disabled:n,onAnimationStart:()=>v(!0),...u})})})),pe=d((({label:l,value:a,setValue:c,required:o,disabled:s,autoFocus:d,placeholder:m,helperText:u,className:h,inputProps:p,error:f,endButton:b},g)=>{const[v,C]=r(!1),[N,x]=r(!1);return t(se,{label:l,shrink:!!(a||m||N),focus:v,required:o,helperText:u,className:h,error:f,children:n("div",{className:e("flex align-center",{"with-end-button":b}),children:[t("input",{ref:g,autoFocus:d,onFocus:()=>{C(!0),N&&x(!1)},onBlur:()=>C(!1),placeholder:o&&m?`${m} *`:m,value:a||"",onChange:e=>c(e.target.value),required:o,disabled:s,onAnimationStart:()=>x(!0),...p}),b&&t(i,{className:b.disabled?"disabled":void 0,icon:b.icon,onClick:b.disabled?void 0:b.onClick})]})})})),fe=d((({value:e,setValue:l,label:i,required:a,disabled:n,autoFocus:c,placeholder:r,helperText:o,className:s,allowNegative:d,decimalPlaces:m,error:u,alignLeft:h,inputProps:p},f)=>t(pe,{ref:f,value:e?`${e}`.replaceAll(".",","):"",setValue:e=>{m?(new RegExp(`^${d?"-?":""}\\d*(?:[.,])?(\\d{1,${m}})?$`).test(e)||!e)&&l(e?e.replaceAll(",","."):e):(new RegExp(`^${d?"-?":""}\\d*$`).test(e)||!e)&&l(e)},label:i,required:a,disabled:n,placeholder:r||(m?`0.${"0".repeat(m)}`:"0"),inputProps:{className:h?void 0:"text-right",pattern:`^${d?"-?":""}\\d+${m?`(?:[.,])?(\\d{1,${m}})?`:""}$`,lang:"sr-RS",inputMode:"numeric",...p},className:s,autoFocus:c,helperText:o,error:u}))),be={prefix:"fad",iconName:"eye",icon:[576,512,[],"f06e",["M572.5 238.1C518.3 115.5 410.9 32 288 32S57.69 115.6 3.469 238.1C1.563 243.4 0 251 0 256c0 4.977 1.562 12.6 3.469 17.03C57.72 396.5 165.1 480 288 480s230.3-83.58 284.5-206.1C574.4 268.6 576 260.1 576 256C576 251 574.4 243.4 572.5 238.1zM432 256c0 79.45-64.47 144-143.9 144C208.6 400 144 335.5 144 256S208.5 112 288 112S432 176.5 432 256z","M288 160C285.7 160 282.4 160.4 279.5 160.8C284.8 170 288 180.6 288 192c0 35.35-28.65 64-64 64C212.6 256 201.1 252.7 192.7 247.5C192.4 250.5 192 253.6 192 256c0 52.1 43 96 96 96s96-42.99 96-95.99S340.1 160 288 160z"]]},ge={prefix:"fad",iconName:"eye-slash",icon:[640,512,[],"f070",["M149.2 91.63c49.62-37.69 108.1-59.62 170.8-59.62c122.9 0 230.3 83.53 284.5 206.1c1.906 4.43 3.469 12.05 3.469 17.03c0 4.957-1.562 12.6-3.469 17.03c-19.42 44.19-45.89 83.01-77.21 114.1l-81.27-63.69c11.09-20.4 17.95-43.44 17.95-68.27c0-79.48-64.5-144-143.1-144c-37.29 0-70.83 14.65-96.42 37.93L149.2 91.63zM319.1 160c-2.301 .0293-5.575 .4436-8.461 .7658C316.8 170 319.1 180.6 319.1 192c0 10.17-2.602 19.62-6.821 28.16l94.71 74.24c5.158-11.78 8.114-24.73 8.114-38.4C415.1 203 372.1 160 319.1 160zM319.1 352c-46.96 0-85.92-33.81-94.22-78.37l99.33 77.86C323.4 351.6 321.8 352 319.1 352zM373.6 389.5l74.5 58.4c-39.3 20.65-82.61 32.14-128.1 32.14c-122.9 0-230.3-83.53-284.5-206.1c-1.906-4.43-3.469-12.05-3.469-17.03c0-4.959 1.562-12.6 3.469-17.03c12.54-28.55 28.04-54.84 45.81-78.59l96.72 75.8C177.1 242.7 175.1 249.2 175.1 256c0 79.48 64.53 143.1 144 143.1C338.1 400 356.1 396.1 373.6 389.5z","M615.1 512c-5.188 0-10.39-1.651-14.8-5.12L9.188 42.89C-1.234 34.73-3.051 19.63 5.121 9.189c8.188-10.41 23.22-12.29 33.69-4.073l591.1 463.1c10.42 8.156 12.24 23.26 4.068 33.7C630.1 508.8 623.1 512 615.1 512z"]]},ve=e=>{const[l,i]=r(!1);return t(pe,{...e,inputProps:{type:l?"text":"password",autoComplete:e.newPassword?"new-password":void 0,...e.inputProps},endButton:{icon:l?ge:be,onClick:()=>i(!l)}})},Ce=d((({label:l,value:i,selected:a,setSelected:c,disabled:r,className:o,children:s},d)=>n("div",{ref:d,className:e("iui-radio",o,a===i?"selected":"clickable",{disabled:r}),onClick:a!==i?()=>!r&&c(i):void 0,children:[n("div",{className:"iui-radio-icon",children:[t("svg",{className:e("icon",{selected:a===i}),focusable:"false",viewBox:"0 0 24 24","aria-hidden":"true",children:t("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"})}),t("svg",{className:e("icon secondary",{selected:a===i}),focusable:"false",viewBox:"0 0 24 24","aria-hidden":"true",children:t("path",{d:"M8.465 8.465C9.37 7.56 10.62 7 12 7C14.76 7 17 9.24 17 12C17 13.38 16.44 14.63 15.535 15.535C14.63 16.44 13.38 17 12 17C9.24 17 7 14.76 7 12C7 10.62 7.56 9.37 8.465 8.465Z"})})]}),l?t("p",{children:l}):s]}))),Ne={prefix:"fas",iconName:"magnifying-glass",icon:[512,512,[],"f002","M500.3 443.7l-119.7-119.7c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723C99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9c53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0C515.9 484.7 515.9 459.3 500.3 443.7zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128c0 70.58-57.42 128-128 128S79.1 278.6 79.1 208z"]},xe=({onSearch:e,className:l})=>{const[i,a]=r(""),{t:n}=b();return t(pe,{className:l?`${l} w-300`:"w-300",inputProps:{"aria-label":"search",onKeyPress:l=>{"Enter"===l.key&&e(l.target.value)}},label:n("Search"),value:i,setValue:a,endButton:{icon:Ne,onClick:()=>e(i)}})},ye=e=>({control:e=>({...e,border:"none",borderRadius:12,boxShadow:"none",minHeight:36}),valueContainer:(e,l)=>({...e,padding:l.isMulti?"8px 14px":"10px 14px",fontSize:13}),menu:l=>({...l,marginTop:2,width:e||"100%",minWidth:"100%",borderRadius:8,boxShadow:"0px 5px 5px -3px rgb(0 0 0 / 20%), 0px 8px 10px 1px rgba(0, 0, 0, 0.14),\n 0px 3px 14px 2px rgba(0, 0, 0, 0.12);"}),menuPortal:e=>({...e,zIndex:1001}),input:e=>({...e,padding:0,margin:0,borderRadius:12}),option:(e,l)=>({...e,fontSize:13,backgroundColor:l.isSelected?"var(--primary) !important":l.isFocused?"#eee !important":"inherit"}),noOptionsMessage:e=>({...e,fontSize:13,fontStyle:"italic"}),multiValue:e=>({...e,backgroundColor:"var(--primary-o25)"})}),we=({label:l,options:i,value:a,valuesMulti:c,onChange:s,required:d,disabled:m,placeholder:u="",helperText:h,className:p,minWidth:f,menuWidth:b,autoFocus:v,isClearable:C,isOpen:N,openDirection:x="auto",noOptionsMessage:y,error:w})=>{const[k,S]=r(!1),M=o(null);return n(se,{label:l,shrink:!!(a||c?.length||u),focus:k,required:d,helperText:h,className:e("select-wrapper",p),minWidth:f,error:w,children:[t(g,{value:a||c||null,options:i,onChange:s,placeholder:!l&&d?`${u} *`:u,className:p,styles:ye(b),isDisabled:m,isOptionDisabled:e=>e.disabled,isClearable:C,isMulti:!!c,menuIsOpen:N,menuPlacement:x,menuPortalTarget:document.querySelector("body"),ref:M,onFocus:()=>S(!0),onBlur:()=>S(!1),autoFocus:v,noOptionsMessage:()=>y||"Nema opcija"}),d&&!m&&t("input",{className:"fake-input",required:!0,tabIndex:-1,autoComplete:"off",value:a?.value||c?.length||"",onChange:()=>{},onFocus:()=>M.current?.focus()})]})},ke=({label:l,value:i,valuesMulti:a,loadOptions:c,refresh:s,onChange:d,required:m,disabled:u,placeholder:h="",helperText:p,className:f,minWidth:b,menuWidth:g,autoFocus:C,isMulti:N,isClearable:x,isOpen:y,openDirection:w="auto",noOptionsMessage:k,error:S})=>{const[M,z]=r(!1),L=o(null);return n(se,{label:l,shrink:!!(i||a?.length||h),focus:M,required:m,helperText:p,className:e("select-wrapper",f),minWidth:b,error:S,children:[t(v,{value:i||a||null,loadOptions:c,additional:{page:0},onChange:d,placeholder:!l&&m?`${h} *`:h,className:f,styles:ye(g),isDisabled:u,isOptionDisabled:e=>e.disabled,isClearable:x,isMulti:N,menuIsOpen:y,menuPlacement:w,menuPortalTarget:document.querySelector("body"),selectRef:L,onFocus:()=>z(!0),onBlur:()=>z(!1),autoFocus:C,noOptionsMessage:()=>k||"Nema opcija",cacheUniqs:s||void 0}),m&&!u&&t("input",{className:"fake-input",required:!0,tabIndex:-1,autoComplete:"off",value:i?.value||a?.length||"",onChange:()=>{},onFocus:()=>L.current?.focus()})]})},Se=({isLoading:l,logo:i,fullWidth:a,children:c})=>n("div",{className:"iui-loader-container "+(a?"full-width":"width-fit"),children:[t("div",{className:e("iui-loading-content",{opacity:l}),children:c}),l&&n("div",{className:"iui-loader",children:[i&&t("img",{className:"iui-loader-logo",alt:"logo",src:i}),t("progress",{className:"linear-progress"})]})]}),Me=({isLoading:e,logo:l})=>e?t("div",{className:"full-screen-loader",children:n("div",{className:"iui-loader",children:[l&&t("img",{className:"iui-loader-logo",alt:"logo",src:l}),t("progress",{className:"linear-progress"})]})}):null,ze=({logo:e})=>t("div",{className:"lazy-loader",children:n("div",{className:"iui-loader",children:[e&&t("img",{className:"iui-loader-logo",alt:"logo",src:e}),t("progress",{className:"linear-progress"})]})}),Le=({label:l,icon:a,iconRotation:c,onClick:r,to:o,disabled:s,withDevider:d,className:m,children:u})=>t("div",{className:e("iui-menu-item",m,{clickable:!!r||!!o,disabled:s,"with-devider":d}),onClick:s?void 0:r,children:t(le,{condition:!s&&!!o,wrapper:e=>t(Link,{to:o,children:e}),children:n("div",{className:"flex align-center",children:[a&&t(i,{icon:a,rotation:c,className:"mr-2"}),l&&t("p",{className:"full-width",children:l}),u]})},l)}),De={prefix:"far",iconName:"filter-circle-xmark",icon:[576,512,[],"e17b","M432 224C352.5 224 288 288.5 288 368s64.47 144 144 144s144-64.47 144-144S511.5 224 432 224zM488.5 401.9c6.242 6.242 6.252 16.37 .0098 22.62c-6.24 6.242-16.37 6.231-22.62-.0113l-33.91-33.91l-33.91 33.91c-6.242 6.242-16.37 6.253-22.62 .0106s-6.232-16.37 .0098-22.62l33.91-33.91l-33.91-33.91c-6.242-6.242-6.251-16.37-.009-22.62s16.37-6.232 22.62 .0106l33.91 33.91l33.91-33.91c6.242-6.242 16.37-6.254 22.61-.0113s6.233 16.37-.009 22.62l-33.91 33.91L488.5 401.9zM223.1 340.7V272.2c0-7.369-2.539-14.51-7.191-20.22L50.77 48.04h410.4l-85.57 105.1c-7.77 9.545-7.061 23.42 1.643 32.13c10.06 10.06 26.62 9.219 35.6-1.812l88.61-108.8c11.26-13.46 13.7-31.89 6.225-47.92C500 10.23 483.8 0 465.3 0H46.65C28.21 0 11.97 10.23 4.283 26.71C-3.195 42.73-.7578 61.16 10.64 74.79l165.4 203.1v67.71c0 12.55 6.178 24.3 16.52 31.45l24.81 19.15C233.1 408.4 256 397.2 256 377.2c0-7.439-3.449-14.46-9.34-19L223.1 340.7z"]},$e=({item:e,translations:l})=>n("div",{className:"table-filter-item",children:[n("p",{className:"label",children:["",e.label]}),t("div",{className:"field",children:e.field}),t(_,{label:l?.filter?.Delete||"Delete",onClick:()=>e.resetField(),size:"m"})]},e.label),Re=({columns:e,filters:l,additionalFilters:i,excludeFromSearch:a,searchData:r,setSearchData:o,onSubmit:s,resetData:d,isOpen:m,onClose:u,translations:h})=>{const p=e.reduce(((e,i)=>l[i]?e.concat(l[i]):e),[]);return n(ae,{className:"iui-table-filter",title:h?.filter?.Filter||"Filter",isOpen:m,onClose:u,cancelButton:{icon:re},additionalButton:{label:h?.filter?.ResetFilter||"Reset Filter",icon:De,onClick:()=>{o(d||{}),s(d||{})},disabled:d?JSON.stringify(r)===JSON.stringify(d):0===Object.keys(r).length},confirmButton:{label:h?.filter?.Search||"Search",icon:Ne,onFormSubmit:()=>{const e=V(r);s(a?F(e,a):e)}},children:[t(c,{children:p?.map((e=>t($e,{item:e,translations:h},e.label)))}),i&&t("div",{className:"pb-1",children:i})]})},Oe=({label:l,position:i="bottom",disabled:a,className:d,children:m})=>{const[h,f]=r(""),b=o(null),g=o(null);return s((()=>{if(!a&&l){const e=b.current,l=g.current,a=()=>{e&&l&&(Fe(e,l,i,f),l?.classList.add("visible"))},t=()=>l?.classList.remove("visible");return e?.addEventListener("mouseenter",a),e?.addEventListener("mouseleave",t),()=>{e?.removeEventListener("mouseenter",a),e?.removeEventListener("mouseleave",t)}}}),[a,l,i]),l&&!a?n(c,{children:[u(m,{ref:b}),p(t("div",{ref:g,className:e("tooltip-container",d),children:n("div",{className:"tooltip",children:[t("div",{className:e("arrow",h||i)}),t("div",{children:l})]})}),document.body)]}):m},Fe=(e,l,i,a)=>{const t=e.getBoundingClientRect(),n=l.getBoundingClientRect();if("bottom"===i||"top"===i){const e=Math.floor(t.bottom+16),c=Math.floor(t.top-n.height-16),r=Math.floor(t.left+t.width/2-n.width/2),o="top"===i?c<0:e+n.height>window.innerHeight;a(o?"bottom"===i?"top":"bottom":""),l.style.top=`${"bottom"===i?o?c:e:o?e:c}px`,l.style.left=`${r}px`}else"right"===i?(l.style.top=Math.floor(t.top+t.height/2-n.height/2)+"px",l.style.left=Math.floor(t.right+16)+"px"):"left"===i&&(l.style.top=Math.floor(t.top+t.height/2-n.height/2)+"px",l.style.left=Math.floor(t.left-n.width-16)+"px")},Pe={prefix:"fas",iconName:"angle-left",icon:[256,512,[],"f104","M192 448c-8.188 0-16.38-3.125-22.62-9.375l-160-160c-12.5-12.5-12.5-32.75 0-45.25l160-160c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25L77.25 256l137.4 137.4c12.5 12.5 12.5 32.75 0 45.25C208.4 444.9 200.2 448 192 448z"]},Ve={prefix:"fas",iconName:"angle-right",icon:[256,512,[],"f105","M64 448c-8.188 0-16.38-3.125-22.62-9.375c-12.5-12.5-12.5-32.75 0-45.25L178.8 256L41.38 118.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0l160 160c12.5 12.5 12.5 32.75 0 45.25l-160 160C80.38 444.9 72.19 448 64 448z"]},Ie={prefix:"fas",iconName:"rotate-right",icon:[512,512,[],"f2f9","M468.9 32.11c13.87 0 27.18 10.77 27.18 27.04v145.9c0 10.59-8.584 19.17-19.17 19.17h-145.7c-16.28 0-27.06-13.32-27.06-27.2c0-6.634 2.461-13.4 7.96-18.9l45.12-45.14c-28.22-23.14-63.85-36.64-101.3-36.64c-88.09 0-159.8 71.69-159.8 159.8S167.8 415.9 255.9 415.9c73.14 0 89.44-38.31 115.1-38.31c18.48 0 31.97 15.04 31.97 31.96c0 35.04-81.59 70.41-147 70.41c-123.4 0-223.9-100.5-223.9-223.9S132.6 32.44 256 32.44c54.6 0 106.2 20.39 146.4 55.26l47.6-47.63C455.5 34.57 462.3 32.11 468.9 32.11z"]},He=({limit:e,offset:l,setLimit:i,setOffset:a,totalRows:c,footerAction:r,customLimit:o,translations:s})=>{const d=Math.ceil(c/e);return t("tfoot",{children:t("tr",{children:t("td",{colSpan:1e3,className:"no-border",children:n("div",{className:"table-footer "+(r?"justify-between":"justify-right"),children:[!!r&&t(ee,{icon:r.icon||Ie,onClick:r.onClick}),n("div",{className:"pagination",children:[n("div",{className:"flex align-center",children:[t("p",{children:s?.pagination?.rowsPerPage||"Rows per page"}),t("select",{value:e,onChange:e=>{const l=Math.floor(+e.target.value);i(l),a(0)},children:(o||[5,10,25,50,100]).map((e=>t("option",{value:e,children:e||(s?.pagination?.allResults||"All results")},e)))}),t("p",{className:"mr-4",children:e?`${l*e+1}-${l*e+e<=c?l*e+e:c} ${s?.pagination?.of||"of"} ${c}`:`${s?.pagination?.allResults||"All results"} ${s?.pagination?.of||"of"} ${c} `})]}),n("div",{className:"flex align-center",children:[t("p",{children:`${s?.pagination?.page||"Page"}: ${l+1}/${d}`}),t(ee,{className:"offset-button",disabled:l<1,icon:Pe,onClick:()=>a(l-1)}),t("input",{className:"offset-input",placeholder:`1-${d}`,onKeyUp:e=>{if("Enter"===e.key){const l=+e.target.value;console.log(e),"number"==typeof l&&l>=0&&l<=d&&a(l-1),e.target.value=""}}}),t(ee,{className:"offset-button",disabled:l+1>=d,icon:Ve,onClick:()=>a(l+1)})]})]})]})})})})},Be=({tableCols:l,firstHeaderRow:i,secondHeaderRow:a,headerWrap:c,printTable:r})=>n("thead",{className:e("iui-table-head",{"no-wrap":!c}),children:[i&&t("tr",{children:i.map(((e,l)=>t("th",{colSpan:e.colSpan,rowSpan:e.rowSpan,style:e.minWidth?{minWidth:e.minWidth}:e.width?{width:e.width}:void 0,hidden:e.hidden,children:t("p",{className:`full-width p-3 text-${e.align||"left"}`,children:e.label})},l)))}),t("tr",{children:(a||l).filter((e=>!e.hidden)).map(((e,l)=>t("th",{style:e.minWidth?{minWidth:e.minWidth}:e.width?{width:e.width}:void 0,children:n("div",{className:"flex align-center",children:[t("p",{className:`full-width p-3 text-${e.align||"left"}`,children:e.label}),!r&&t("div",{className:"vertical-separator"})]})},l)))})]}),Ee={prefix:"fas",iconName:"print",icon:[512,512,[],"f02f","M448 192H64C28.65 192 0 220.7 0 256v96c0 17.67 14.33 32 32 32h32v96c0 17.67 14.33 32 32 32h320c17.67 0 32-14.33 32-32v-96h32c17.67 0 32-14.33 32-32V256C512 220.7 483.3 192 448 192zM384 448H128v-96h256V448zM432 296c-13.25 0-24-10.75-24-24c0-13.27 10.75-24 24-24s24 10.73 24 24C456 285.3 445.3 296 432 296zM128 64h229.5L384 90.51V160h64V77.25c0-8.484-3.375-16.62-9.375-22.62l-45.25-45.25C387.4 3.375 379.2 0 370.8 0H96C78.34 0 64 14.33 64 32v128h64V64z"]},We={prefix:"far",iconName:"file-arrow-down",icon:[384,512,[],"f56d","M216 342.1V240c0-13.25-10.75-24-24-24S168 226.8 168 240v102.1L128.1 303C124.3 298.3 118.2 296 112 296S99.72 298.3 95.03 303c-9.375 9.375-9.375 24.56 0 33.94l80 80c9.375 9.375 24.56 9.375 33.94 0l80-80c9.375-9.375 9.375-24.56 0-33.94s-24.56-9.375-33.94 0L216 342.1zM365.3 93.38l-74.63-74.64C278.6 6.742 262.3 0 245.4 0H64C28.65 0 0 28.65 0 64l.0065 384c0 35.34 28.65 64 64 64H320c35.2 0 64-28.8 64-64V138.6C384 121.7 377.3 105.4 365.3 93.38zM336 448c0 8.836-7.164 16-16 16H64.02c-8.838 0-16-7.164-16-16L48 64.13c0-8.836 7.164-16 16-16h160L224 128c0 17.67 14.33 32 32 32h79.1V448z"]},qe=({isOpen:e,onClose:l,columns:i,organization:o,filters:d,label:m,getPrintData:u,formatPrintData:h,saveXlsx:f,totals:b,translations:g})=>{const[v,C]=r([]),[N,x]=r(0),[w,k]=r(!1),S=i.filter((e=>"actions"!==e.id));return s((()=>{const e=window.document.getElementById("root");return e?.classList.add("hidden"),()=>{e?.classList.remove("hidden")}}),[]),s((()=>{k(!0),u({limit:1e3,offset:N}).then((e=>{C((l=>{const i=[...l,...e.length?h(e):[]];return e.totalRows>i.length?x(N+1):k(!1),i}))})).catch((()=>k(!1)))}),[N,h,u]),e?p(n("div",{className:"iui-print-dialog",children:[n("div",{className:"content",children:[n("div",{className:"flex justify-between",children:[o?n("div",{children:[t("p",{className:"name",children:o.name}),o.taxId&&t("p",{children:`${g?.print?.TaxId||"Tax id"}: ${o.taxId}`}),o.registrationNumber&&t("p",{children:`${g?.print?.RegistrationNumber||"Registration number"}: ${o.registrationNumber}`}),o.jbkjs&&n("p",{children:["JBKJS: ",o.jbkjs]}),o.email&&n("p",{children:["Email: ",o.email]})]}):t("div",{}),t("div",{className:"mb-2 text-right",children:t("p",{children:`${g?.print?.PrintDate||"Print date"}: ${a().format("DD.MM.YYYY.").toString()}`})})]}),t("h4",{className:"m-3 text-center",children:m}),d&&n("div",{className:"flex justify-between",children:[t("div",{children:d.basic?.map((e=>!!e.value&&t("div",{className:"mb-2",children:t("p",{children:`${e.label}: ${e.value}`})})))}),d.date&&t("div",{children:d.date.map((e=>(!!e.from||!!e.to)&&t("div",{className:"mb-2 text-right",children:n("p",{children:[e.label," ",!!e.from&&`${g?.print?.from||"from"} ${y(e.from)}`," ",`${g?.print?.to||"to"} ${y(e.to||(new Date).toString())}`]})})))})]}),v&&n("table",{width:"100%",className:"print-table",children:[t(Be,{tableCols:S,headerWrap:!0}),t("tbody",{children:n(c,{children:[v.map((e=>t("tr",{children:S.map((l=>t("td",{align:e.cells[l.id].align||l.align,children:e.cells[l.id].printValue||e.cells[l.id].value},l.id)))},e.uuid))),!!b&&t("tr",{children:S.map((({id:e})=>t("td",{align:b.cells[e]?.align||"right",colSpan:b.cells[e]?.span,className:"py-3",children:t("strong",{children:b.cells[e]?.value})},e)))})]})})]})]}),n("div",{className:"iui-print-actions no-print",children:[t(_,{label:g?.Cancel||"Cancel",icon:re,onClick:e=>{e.stopPropagation(),l()},className:"mr-3"}),!!f&&t(_,{label:g?.print?.SaveXlsx||"Save XLSX",icon:We,onClick:()=>f(),className:"mr-3"}),t(_,{label:g?.print?.Print||"Print",icon:Ee,primary:!0,onClick:()=>window.print()})]}),t(Me,{isLoading:w})]}),document.body):null},Te={prefix:"fas",iconName:"grip-dots-vertical",icon:[256,512,[],"e411","M0 96C0 69.49 21.49 48 48 48C74.51 48 96 69.49 96 96C96 122.5 74.51 144 48 144C21.49 144 0 122.5 0 96zM0 256C0 229.5 21.49 208 48 208C74.51 208 96 229.5 96 256C96 282.5 74.51 304 48 304C21.49 304 0 282.5 0 256zM96 416C96 442.5 74.51 464 48 464C21.49 464 0 442.5 0 416C0 389.5 21.49 368 48 368C74.51 368 96 389.5 96 416zM160 96C160 69.49 181.5 48 208 48C234.5 48 256 69.49 256 96C256 122.5 234.5 144 208 144C181.5 144 160 122.5 160 96zM256 256C256 282.5 234.5 304 208 304C181.5 304 160 282.5 160 256C160 229.5 181.5 208 208 208C234.5 208 256 229.5 256 256zM160 416C160 389.5 181.5 368 208 368C234.5 368 256 389.5 256 416C256 442.5 234.5 464 208 464C181.5 464 160 442.5 160 416z"]},Ae={prefix:"far",iconName:"arrow-right-arrow-left",icon:[512,512,[],"f0ec","M488 344H79.24l74.29-79.63C162.6 254.7 162.1 239.5 152.4 230.5C142.7 221.4 127.5 221.9 118.5 231.6l-112 120c-8.625 9.219-8.625 23.53 0 32.75l112 120C123.2 509.4 129.6 512 136 512c5.875 0 11.75-2.125 16.38-6.469c9.688-9.031 10.22-24.22 1.156-33.91L79.24 392H488c13.25 0 24-10.75 24-24S501.3 344 488 344zM24 168h408.8l-74.29 79.63c-9.062 9.688-8.531 24.88 1.156 33.91c9.656 9.094 24.88 8.562 33.91-1.156l112-120c8.625-9.219 8.625-23.53 0-32.75l-112-120C388.8 2.562 382.4 0 376 0c-5.875 0-11.75 2.125-16.38 6.469c-9.688 9.031-10.22 24.22-1.156 33.91L432.8 120H24C10.75 120 0 130.8 0 144S10.75 168 24 168z"]},je=({columns:e,setColumns:l,isOpen:a,onClose:c,translations:o})=>{const[d,m]=r([]),[u,h]=r([]);s((()=>{let l=[],i=[];e.forEach((e=>"actions"!==e.id&&(e.hidden?l.push(e):i.push(e)))),m(l),h(i)}),[e]);return t(C,{onDragEnd:({source:e,destination:l})=>{if(!l)return;const i=[...d],a=[...u],t="hidden"===l.droppableId,n="hidden"===e.droppableId?i:a,c=t?i:a,[r]=n.splice(e.index,1);c.splice(l.index,0,r),e.droppableId!==l.droppableId?(c[l.index].hidden=t,m(i),h(a)):t?m(i):h(a)},children:t(ae,{isOpen:a,onClose:c,confirmButton:{label:o?.Confirm||"Confirm",onClick:()=>{l([...u,...d]),c()}},cancelButton:{label:o?.Cancel||"Cancel"},noBackgroundClick:!0,children:n("div",{className:"dual-list-container",children:[t("p",{className:"pb-3",children:o?.columns?.DragDropListsInfo||"DragDropListsInfo"}),n("div",{className:"dual-list-content",children:[n("p",{className:"bold m-2",children:[o?.columns?.HiddenColumns||"HiddenColumns",":"]}),t("p",{}),n("p",{className:"bold m-2",children:[o?.columns?.SelectedColumns||"SelectedColumns",":"]}),t(N,{droppableId:"hidden",children:e=>n("div",{...e.droppableProps,ref:e.innerRef,className:"list-box",children:[d.map(((e,l)=>t(x,{draggableId:e.id,index:l,children:l=>n("div",{className:"item",ref:l.innerRef,...l.draggableProps,...l.dragHandleProps,style:{...l.draggableProps.style,top:"unset",left:"unset"},children:[e.label,t(i,{icon:Te})]})},e.id))),e.placeholder]})}),t("div",{className:"exchange-icon",children:t(i,{icon:Ae})}),t(N,{droppableId:"visible",children:e=>n("div",{...e.droppableProps,ref:e.innerRef,className:"list-box",children:[u.map(((e,l)=>t(x,{draggableId:e.id,index:l,children:l=>n("div",{className:"item",ref:l.innerRef,...l.draggableProps,...l.dragHandleProps,style:{...l.draggableProps.style,top:"unset",left:"unset"},children:[e.label,t(i,{icon:Te})]})},e.id))),e.placeholder]})})]})]})})})},Ye=({sortOptions:e,sort:l,setSort:a})=>t(c,{children:Object.keys(e).map((c=>t(Le,{className:"menu-item-m",onClick:()=>a(l===e[c].desc?e[c].asc:e[c].desc),children:n("div",{className:"flex center justify-between full-width",children:[t("p",{className:"mr-5 mb-0",children:e[c].label}),l===e[c].desc&&t(i,{icon:W}),l===e[c].asc&&t(i,{icon:E})]})},c)))}),Ue={prefix:"fas",iconName:"caret-down",icon:[320,512,[],"f0d7","M310.6 246.6l-127.1 128C176.4 380.9 168.2 384 160 384s-16.38-3.125-22.63-9.375l-127.1-128C.2244 237.5-2.516 223.7 2.438 211.8S19.07 192 32 192h255.1c12.94 0 24.62 7.781 29.58 19.75S319.8 237.5 310.6 246.6z"]},Ze=({columns:e,columnsData:l,filterData:i,sortData:a,printData:o,additionsalOptions:s,translations:d})=>{const[m,u]=r(""),h=()=>u("");return n("div",{className:"flex align-center gap-2 justify-between",children:[n("div",{className:"flex align-center gap-2",children:[i&&n(c,{children:[t(G,{number:I(i.search),small:!0,children:t(_,{label:d?.filter?.Filter||"Filter",active:"filter"===m,onClick:()=>u("filter"),className:"table-options-btn",size:"s"})}),"filter"===m&&t(Re,{...i,isOpen:!0,onClose:h,translations:d})]}),l&&n(c,{children:[t(_,{label:d?.columns?.Columns||"Columns",active:"columns"===m,onClick:()=>u("columns"),className:"table-options-btn",size:"s"}),"columns"===m&&t(je,{columns:l.columns,setColumns:l.setColumns,isOpen:!0,onClose:h,translations:d})]}),a&&t(oe,{renderButton:e=>t(_,{label:d?.Sort||"Sort",iconEnd:Ue,active:"sort"===m,onClick:()=>u("sort"),ref:e,className:"table-options-btn",size:"s"}),isOpen:"sort"===m,onClose:h,size:a.menuSize,children:t(Ye,{...a})}),s]}),o&&n(c,{children:[t(_,{label:d?.print?.PrintExport||"Print/Export",icon:Ee,onClick:()=>u("print"),size:"s"}),"print"===m&&t(qe,{...o,isOpen:!0,onClose:h,columns:e,translations:d})]})]})},Xe=({columns:l,setColumns:i,firstHeaderRow:a,secondHeaderRow:o,data:d,totals:m,loaderLogo:u,isLoading:p,headerWrap:f,serverSidePagination:b,customPagination:g,selectedRowUuid:v,translations:C,footerAction:N,hideFooter:x,showLastBorder:y,className:w,filterData:k,sortData:S,printData:M,additionsalOptions:z,selectedOptions:L,editable:D})=>{const[$,R]=r(g?.defaultLimit||5),[O,F]=r(0),[P,V]=r([]),[I,H]=r([]),[B,E]=r(""),[W,q]=r({});s((()=>{V(l.filter((e=>!e.hidden&&!e.unavailable)))}),[l,D,C]),s((()=>{H(b||$<=0?d:d.slice(O*$,O*$+$))}),[d,$,O,b]);const T=D?.EditableRow;return t(le,{condition:!!D,wrapper:e=>t("form",{onSubmit:e=>{e.preventDefault(),D.onSubmit(W,(()=>{D.inputFocusRef?.current?.focus(),q(D.defaultDataValue||{}),D.setSelectedItem(null)}))},children:e}),children:t("div",{className:e("iui-table",w,{"pb-3":0===I.length}),children:n(Se,{isLoading:!!p,logo:u,fullWidth:!0,children:[(!!k||!!S||!!i||!!M)&&t(Ze,{columns:P,columnsData:i?{columns:l,setColumns:i}:void 0,filterData:k,sortData:S,printData:M,additionsalOptions:z,translations:C}),L,n("table",{className:"full-width",children:[t(Be,{tableCols:P,headerWrap:f,firstHeaderRow:a,secondHeaderRow:o}),n("tbody",{className:x&&!y?"no-last-border":void 0,children:[I.length?t(c,{children:I.map((l=>{const i=l.extendable&&!l.extendable.isLoading&&B===l.uuid;return n(h,{children:[T&&l.uuid===D?.selectedItem?.uuid?t(T,{columns:P,data:W,setData:q,item:D.selectedItem,clearItem:()=>D.setSelectedItem(null),defaultDataValue:D.defaultDataValue,inputFocusRef:D.inputFocusRef}):t("tr",{className:e(l.className,{selected:!!v&&v===l.uuid,clickable:!!l.onRowClick||!!l.extendable,loading:l.extendable?.isLoading}),onClick:e=>{l.onRowClick&&l.onRowClick(e),l.extendable&&E(B===l.uuid?"":l.uuid)},children:P.map((a=>t(Oe,{label:l.cells[a.id]?.tooltip,position:"top",disabled:!l.cells[a.id]?.tooltip,children:t("td",{"data-th":a.label?a.label+": ":"/",align:l.cells[a.id]?.align||a.align,onClick:l.cells[a.id]?.onClick?e=>{e.stopPropagation(),l.cells[a.id]?.onClick(e)}:void 0,className:e(l.cells[a.id]?.className,{link:l.cells[a.id]?.link,"clickable-column":l.cells[a.id]?.onClick,"word-break":a.break,"no-border":i}),children:l.cells[a.id]?.value})},a.id)))}),i&&t("tr",{children:t("td",{colSpan:P.length,children:l.extendable.element})})]},l.uuid)}))}):t("tr",{children:t("td",{className:"no-border",colSpan:P.length,children:C?.noDataText||"No results"})}),!!T&&!D.selectedItem&&!D.disabled&&t(T,{columns:P,data:W,setData:q,defaultDataValue:D.defaultDataValue,clearItem:()=>D.setSelectedItem(null),inputFocusRef:D.inputFocusRef}),!!m&&!!I.length&&t("tr",{children:P.map((({id:e})=>t("td",{align:m.cells[e]?.align||"right",colSpan:m.cells[e]?.span,children:t("strong",{children:m.cells[e]?.value})},e)))})]}),!!I.length&&!x&&t(He,{totalRows:b?.totalRows||d.length,customLimit:g?.customLimit,limit:b?.limit||$,offset:b?.offset||O,setLimit:b?.setLimit||R,setOffset:b?.setOffset||F,footerAction:N,translations:C})]})]})})})},Ke=({item:e,setSelectedItem:l,setItemToDeleteUuid:i,actions:a,t:c=(e=>e)})=>{const[o,s]=r(!1);return n(oe,{isOpen:o,onClose:()=>s(!1),placementX:"right",renderButton:e=>t(ee,{ref:e,icon:j,active:o,onClick:e=>{e.stopPropagation(),s(!o)}}),children:[!!l&&t(Le,{onClick:()=>{l(e),s(!1)},children:t("p",{children:c("Edit")})}),a?.map((l=>!l.hidden&&t(Le,{disabled:!!l.disabled,onClick:()=>{l.onClick(e.uuid),s(!1)},children:t("p",{children:l.label})},l.label))),!!i&&t(Le,{onClick:()=>{i(e.uuid),s(!1)},children:t("p",{children:c("Delete")})})]})},Je=({setData:e,clearItem:l,inputFocusRef:i,defaultDataValue:a})=>n("div",{className:"text-center",children:[t(ee,{icon:A,className:"mr-1 p-1"}),t(ee,{icon:Y,className:"p-1",onClick:()=>{e(a||{}),i?.current?.focus(),l()}})]}),Ge=({columns:e,defaultDataValue:l,data:i,setData:a,item:n,clearItem:c,inputFocusRef:r})=>{s((()=>{r?.current?.focus(),a(n||{})}),[n,r,a]);n?.uuid;const o={...i,actions:{value:t(Je,{setData:a,clearItem:c,defaultDataValue:l,inputFocusRef:r})}};return t("tr",{className:"edit-row",children:e.map((e=>!e.hidden&&t("td",{align:e.align,colSpan:o[e.id]?.span,children:o[e.id]?.value},e.id)))})},Qe=({tabs:l,initialValue:a,control:c,onChange:o,noWrap:s,className:d,classNameContent:m})=>{const[u,h]=r(a||l[0].value);return l.length?n("div",{className:d,children:[t("div",{className:"iui-tabs",children:l.map((l=>!l.hidden&&n("div",{className:e("iui-tab clickable",{selected:(c?.value||u)===l.value,disabled:l.disabled,"no-wrap":s}),onClick:l.disabled?void 0:()=>{c?c.setValue(l.value):h(l.value),o&&o(l.value)},children:[l.icon&&t(i,{icon:l.icon}),l.label]},l.value)))}),l.map((l=>!l.hidden&&t("div",{className:e("iui-tab-content",m),hidden:l.value!==(c?.value||u),children:l.component},l.value)))]}):null},_e={prefix:"fas",iconName:"arrow-left",icon:[448,512,[],"f060","M447.1 256C447.1 273.7 433.7 288 416 288H109.3l105.4 105.4c12.5 12.5 12.5 32.75 0 45.25C208.4 444.9 200.2 448 192 448s-16.38-3.125-22.62-9.375l-160-160c-12.5-12.5-12.5-32.75 0-45.25l160-160c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25L109.3 224H416C433.7 224 447.1 238.3 447.1 256z"]},el=({title:e,description:l,actionButton:i,backButton:a,img:c,translations:r,children:o})=>{const s=useNavigate();return n("div",{className:"full-page-container",children:[t("h1",{children:e}),t("h2",{children:l}),n("div",{className:"content",children:[t(le,{condition:!!i?.onFormSubmit,wrapper:e=>t("form",{onSubmit:e=>{e.preventDefault(),e.stopPropagation(),i?.onFormSubmit()},children:e}),children:n("div",{children:[t("div",{className:"children",children:o}),(!!i||a)&&n("div",{className:"flex",children:[a&&t(_,{label:r?.Back||"Back",icon:_e,className:"mr-2",onClick:()=>s(-1)}),!!i&&t(_,{label:i.label,icon:i.icon,onClick:i.onClick,primary:!i.regular})]})]})}),c&&t("div",{className:"full-page-image",children:t("img",{src:c,alt:"ePismonosa"})})]})]})},ll=({isLoading:l,noAccess:i,submitButton:a,otherButtons:c,className:r,children:o})=>n("form",{className:e(r,{"form-disabled":l}),onSubmit:e=>{e.preventDefault(),!a.disabled&&a.onSubmit(e)},children:[o,(!i||c)&&n("div",{className:"text-center mt-3 mb-2",children:[c?.map((e=>t(_,{label:e.label,icon:e.icon,disabled:l||e.disabled,outlined:e.outlined,onClick:e.onClick,className:"mr-2"},e.label))),!i&&t(_,{label:a.label||"Submit",icon:a.icon,disabled:l||a.disabled,outlined:!a.primary,primary:a.primary})]})]}),il={prefix:"fas",iconName:"ellipsis-vertical",icon:[128,512,[],"f142","M64 360C94.93 360 120 385.1 120 416C120 446.9 94.93 472 64 472C33.07 472 8 446.9 8 416C8 385.1 33.07 360 64 360zM64 200C94.93 200 120 225.1 120 256C120 286.9 94.93 312 64 312C33.07 312 8 286.9 8 256C8 225.1 33.07 200 64 200zM64 152C33.07 152 8 126.9 8 96C8 65.07 33.07 40 64 40C94.93 40 120 65.07 120 96C120 126.9 94.93 152 64 152z"]},al=({breadcrumbs:e,actions:l,moreActions:i,showBackButton:a,noAccess:c,isLoading:o,loaderLogo:s,footer:d,translations:m,children:u})=>{const[h,p]=r(!1),f=useNavigate();return t(le,{condition:!!o,wrapper:e=>t(Se,{isLoading:!0,logo:s,fullWidth:!0,children:e}),children:n("div",{className:"page-container",children:[n("div",{className:"page-header",children:[n("div",{className:"flex align-center gap-3",children:[a&&t(ee,{icon:_e,className:"c-primary",onClick:()=>f(-1)}),t("div",{className:"breadcrumbs",children:e.map(((l,i)=>l&&t("h1",{children:i+1<e.length?`${l} /`:l},l)))})]}),!c&&n("div",{className:"flex align-center",children:[l?.map((e=>!e.hidden&&t(le,{condition:!!e.to,wrapper:l=>t(Link,{to:e.to,children:l}),children:t(_,{...e,className:"ml-2"},e.label)},e.label))),!!i?.length&&t(oe,{isOpen:h,onClose:()=>p(!1),placementX:"right",renderButton:e=>t(ee,{ref:e,icon:il,active:h,onClick:()=>p(!h)}),children:i.map((e=>!e.hidden&&t(Le,{label:e.label,icon:e.icon,iconRotation:e.iconRotation,disabled:e.disabled,withDevider:!0,to:e.to,onClick:e.onClick?()=>{e.onClick(),p(!1)}:void 0},e.label)))})]})]}),n("div",{className:"page-content",children:[t("div",{className:"flex-grow",children:c?t(te,{title:m?.NoAccessTitle,buttonLabel:m?.ReturnToHomepage}):u}),d]})]})})},tl=e=>{const l=new URLSearchParams(e);return Object.fromEntries(l.entries())},nl=e=>localStorage.getItem(e),cl=(e,l)=>localStorage.setItem(e,l),rl=e=>localStorage.removeItem(e),ol=()=>localStorage.getItem(`${nl("activeUser")}-defaultOrg`),sl=e=>localStorage.setItem(`${nl("activeUser")}-defaultOrg`,e),dl=()=>localStorage.getItem(`${nl("activeUser")}-activeOrg`),ml=e=>localStorage.setItem(`${nl("activeUser")}-activeOrg`,e);export{U as Accordions,J as Alert,_ as Button,ne as Checkbox,B as Collapse,le as ConditionalWrapper,ue as DateInput,ae as Dialog,ll as FormWrapper,el as FullPageWrapper,Me as FullScreenLoader,ee as IconButton,Ke as ItemActionsMenu,Je as ItemEditOptionsButtons,he as LargeTextInput,ze as LazyLoader,Se as Loader,oe as Menu,Le as MenuItem,te as NoAccessInfo,G as NotificationBadge,fe as NumberInput,al as PageWrapper,ve as PasswordInput,Q as PillBadge,Ce as Radio,xe as SearchInput,we as Select,ke as SelectAsyncPaginate,Re as SetTableFilter,Xe as Table,Ge as TableEditRow,He as TableFooter,Qe as Tabs,pe as TextInput,Oe as Tooltip,M as checkIfExpired,S as dateAddDays,P as deleteEmptyProps,V as deleteEmptyPropsIncludingArray,F as deleteProps,$ as formatCurrency,R as formatCurrencyNoDecimals,y as formatDate,w as formatDateAndTime,k as formatTime,D as formatYearMonth,I as getActiveFilterNumber,dl as getActiveOrgUuid,z as getCurrentDateFormattedYMD,L as getDaysLeft,ol as getDefaultOrgUuid,H as getVisibleColumnsIds,nl as lsGet,rl as lsRemove,cl as lsSet,O as maxChar,tl as parseUrlSearch,ml as setActiveOrgUuid,sl as setDefaultOrgUuid};
|
|
1523
2
|
//# sourceMappingURL=index.js.map
|