@unifiedsoftware/react-ui 1.0.3 → 1.0.4
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.mts +107 -7
- package/dist/index.d.ts +107 -7
- package/dist/index.js +644 -150
- package/dist/index.mjs +622 -142
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -33,45 +33,510 @@ var __objRest = (source, exclude) => {
|
|
|
33
33
|
// src/components/Button/Button.tsx
|
|
34
34
|
import clsx from "clsx";
|
|
35
35
|
import { forwardRef } from "react";
|
|
36
|
+
import { RiLoader4Line } from "react-icons/ri";
|
|
37
|
+
|
|
38
|
+
// src/constants/index.ts
|
|
39
|
+
var PREFIX_CLS = "us-";
|
|
40
|
+
|
|
41
|
+
// src/components/Button/Button.tsx
|
|
36
42
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
37
|
-
var prefixCls = "us-";
|
|
38
43
|
var Button = forwardRef(
|
|
39
44
|
(_a, ref) => {
|
|
40
|
-
var _b = _a, {
|
|
45
|
+
var _b = _a, {
|
|
46
|
+
as: Component = "button",
|
|
47
|
+
children,
|
|
48
|
+
className,
|
|
49
|
+
role = "presentation",
|
|
50
|
+
variant = "text",
|
|
51
|
+
color = "primary",
|
|
52
|
+
size = "md",
|
|
53
|
+
prefix,
|
|
54
|
+
suffix,
|
|
55
|
+
loading
|
|
56
|
+
} = _b, rest = __objRest(_b, [
|
|
57
|
+
"as",
|
|
58
|
+
"children",
|
|
59
|
+
"className",
|
|
60
|
+
"role",
|
|
61
|
+
"variant",
|
|
62
|
+
"color",
|
|
63
|
+
"size",
|
|
64
|
+
"prefix",
|
|
65
|
+
"suffix",
|
|
66
|
+
"loading"
|
|
67
|
+
]);
|
|
41
68
|
return /* @__PURE__ */ jsxs(
|
|
42
69
|
Component,
|
|
43
70
|
__spreadProps(__spreadValues({
|
|
44
71
|
ref,
|
|
45
72
|
className: clsx(
|
|
46
|
-
`${
|
|
73
|
+
`${PREFIX_CLS}button`,
|
|
47
74
|
{
|
|
48
|
-
[`${
|
|
49
|
-
[`${
|
|
50
|
-
[`${
|
|
75
|
+
[`${PREFIX_CLS}button--${variant}`]: variant,
|
|
76
|
+
[`${PREFIX_CLS}button--${color}`]: color,
|
|
77
|
+
[`${PREFIX_CLS}button--${size}`]: size
|
|
51
78
|
},
|
|
52
79
|
className
|
|
53
|
-
)
|
|
80
|
+
),
|
|
81
|
+
role
|
|
54
82
|
}, rest), {
|
|
55
83
|
children: [
|
|
56
|
-
/* @__PURE__ */ jsx("div", { className: `${
|
|
57
|
-
/* @__PURE__ */ jsx(
|
|
58
|
-
children
|
|
84
|
+
/* @__PURE__ */ jsx("div", { className: `${PREFIX_CLS}overlay` }),
|
|
85
|
+
loading ? /* @__PURE__ */ jsx(RiLoader4Line, { className: `${PREFIX_CLS}icon ${PREFIX_CLS}animation-spin` }) : prefix,
|
|
86
|
+
/* @__PURE__ */ jsx("div", { className: `${PREFIX_CLS}button__content`, children }),
|
|
87
|
+
suffix
|
|
59
88
|
]
|
|
60
89
|
})
|
|
61
90
|
);
|
|
62
91
|
}
|
|
63
92
|
);
|
|
64
93
|
|
|
65
|
-
// src/components/
|
|
94
|
+
// src/components/Collapse/Collapse.tsx
|
|
95
|
+
import { Children, useEffect, useRef, useState } from "react";
|
|
96
|
+
|
|
97
|
+
// src/components/Collapse/CollapseContext.tsx
|
|
98
|
+
import { createContext, useContext } from "react";
|
|
99
|
+
var CollapseContext = createContext(null);
|
|
100
|
+
var useCollapse = () => {
|
|
101
|
+
const context = useContext(CollapseContext);
|
|
102
|
+
if (!context) {
|
|
103
|
+
throw new Error("`useCollapse` must be used within a `<Collapse />`");
|
|
104
|
+
}
|
|
105
|
+
return context;
|
|
106
|
+
};
|
|
107
|
+
var CollapseContext_default = CollapseContext;
|
|
108
|
+
|
|
109
|
+
// src/components/Collapse/Collapse.tsx
|
|
110
|
+
import { jsxs as jsxs2 } from "react/jsx-runtime";
|
|
111
|
+
var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
|
|
112
|
+
const collapseRef = useRef(null);
|
|
113
|
+
const [selfIsOpen, setSelfIsOpen] = useState(isOpen != null ? isOpen : false);
|
|
114
|
+
const [heightAuto, setHeightAuto] = useState(false);
|
|
115
|
+
const [trigger, content] = Children.toArray(children);
|
|
116
|
+
const handleOpen = () => {
|
|
117
|
+
setSelfIsOpen(true);
|
|
118
|
+
onOpen == null ? void 0 : onOpen();
|
|
119
|
+
};
|
|
120
|
+
const handleClose = () => {
|
|
121
|
+
setSelfIsOpen(false);
|
|
122
|
+
onClose == null ? void 0 : onClose();
|
|
123
|
+
};
|
|
124
|
+
const handleToggle = () => {
|
|
125
|
+
setSelfIsOpen((prevState) => !prevState);
|
|
126
|
+
onToggle == null ? void 0 : onToggle();
|
|
127
|
+
};
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
if (isOpen !== void 0) {
|
|
130
|
+
setSelfIsOpen(isOpen);
|
|
131
|
+
}
|
|
132
|
+
setTimeout(() => {
|
|
133
|
+
if (isOpen) {
|
|
134
|
+
setHeightAuto(true);
|
|
135
|
+
} else {
|
|
136
|
+
setHeightAuto(false);
|
|
137
|
+
}
|
|
138
|
+
}, 100);
|
|
139
|
+
}, [isOpen]);
|
|
140
|
+
return /* @__PURE__ */ jsxs2(
|
|
141
|
+
CollapseContext_default.Provider,
|
|
142
|
+
{
|
|
143
|
+
value: {
|
|
144
|
+
collapseRef,
|
|
145
|
+
isOpen: selfIsOpen,
|
|
146
|
+
heightAuto,
|
|
147
|
+
onOpen: handleOpen,
|
|
148
|
+
onClose: handleClose,
|
|
149
|
+
onToggle: handleToggle
|
|
150
|
+
},
|
|
151
|
+
children: [
|
|
152
|
+
trigger,
|
|
153
|
+
content
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
};
|
|
158
|
+
var Collapse_default = Collapse;
|
|
159
|
+
|
|
160
|
+
// src/components/Collapse/CollapseContent.tsx
|
|
66
161
|
import clsx2 from "clsx";
|
|
162
|
+
import { Children as Children2, cloneElement, forwardRef as forwardRef2 } from "react";
|
|
163
|
+
var CollapseContent = forwardRef2(({ children }, ref) => {
|
|
164
|
+
var _a, _b;
|
|
165
|
+
const { collapseRef, isOpen, heightAuto } = useCollapse();
|
|
166
|
+
const child = Children2.only(children);
|
|
167
|
+
return cloneElement(child, __spreadProps(__spreadValues({}, child.props), {
|
|
168
|
+
ref: (node) => {
|
|
169
|
+
collapseRef.current = node;
|
|
170
|
+
if (ref !== null) {
|
|
171
|
+
ref.current = node;
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
style: __spreadProps(__spreadValues({}, child.props.style), {
|
|
175
|
+
height: isOpen && heightAuto ? "auto" : isOpen ? (_a = collapseRef.current) == null ? void 0 : _a.scrollHeight : !isOpen && heightAuto ? (_b = collapseRef.current) == null ? void 0 : _b.scrollHeight : 0
|
|
176
|
+
}),
|
|
177
|
+
className: clsx2(`${PREFIX_CLS}collapse`, child.props.className)
|
|
178
|
+
}));
|
|
179
|
+
});
|
|
180
|
+
var CollapseContent_default = CollapseContent;
|
|
181
|
+
|
|
182
|
+
// src/components/Collapse/CollapseTrigger.tsx
|
|
183
|
+
import { Children as Children3, cloneElement as cloneElement2, forwardRef as forwardRef3 } from "react";
|
|
184
|
+
var CollapseTrigger = forwardRef3(({ children }, ref) => {
|
|
185
|
+
const { collapseRef, onToggle } = useCollapse();
|
|
186
|
+
const child = Children3.only(children);
|
|
187
|
+
return cloneElement2(child, __spreadValues({
|
|
188
|
+
ref,
|
|
189
|
+
onClick: (event) => {
|
|
190
|
+
var _a, _b;
|
|
191
|
+
if (!collapseRef.current) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
onToggle();
|
|
195
|
+
(_b = (_a = child.props).onClick) == null ? void 0 : _b.call(_a, event);
|
|
196
|
+
}
|
|
197
|
+
}, child.props));
|
|
198
|
+
});
|
|
199
|
+
var CollapseTrigger_default = CollapseTrigger;
|
|
200
|
+
|
|
201
|
+
// src/components/Menu/Menu.tsx
|
|
202
|
+
import clsx6 from "clsx";
|
|
203
|
+
import { useEffect as useEffect4, useMemo as useMemo3, useState as useState4 } from "react";
|
|
204
|
+
|
|
205
|
+
// src/components/Menu/MenuContext.tsx
|
|
206
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
207
|
+
var MenuContext = createContext2(null);
|
|
208
|
+
var useMenu = () => {
|
|
209
|
+
const context = useContext2(MenuContext);
|
|
210
|
+
if (!context) {
|
|
211
|
+
throw new Error("`useMenu` must be used within a `<Menu />`");
|
|
212
|
+
}
|
|
213
|
+
return context;
|
|
214
|
+
};
|
|
215
|
+
var MenuContext_default = MenuContext;
|
|
216
|
+
|
|
217
|
+
// src/components/Menu/MenuGroup.tsx
|
|
218
|
+
import clsx5 from "clsx";
|
|
219
|
+
import { useMemo as useMemo2 } from "react";
|
|
220
|
+
|
|
221
|
+
// src/components/Menu/MenuItem.tsx
|
|
222
|
+
import clsx3 from "clsx";
|
|
223
|
+
import { forwardRef as forwardRef4, useContext as useContext4, useEffect as useEffect2, useState as useState2 } from "react";
|
|
224
|
+
|
|
225
|
+
// src/components/Menu/MenuValueContext.tsx
|
|
226
|
+
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
227
|
+
var MenuValueContext = createContext3([]);
|
|
228
|
+
var useMenuItemValue = () => {
|
|
229
|
+
const context = useContext3(MenuValueContext);
|
|
230
|
+
if (!context) {
|
|
231
|
+
throw new Error("`useMenuValue` must be used within a `<MenuValueContext.Provider />`");
|
|
232
|
+
}
|
|
233
|
+
return context;
|
|
234
|
+
};
|
|
235
|
+
var MenuValueContext_default = MenuValueContext;
|
|
236
|
+
|
|
237
|
+
// src/components/Menu/MenuItem.tsx
|
|
238
|
+
import { jsx as jsx2, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
239
|
+
var MenuItem = forwardRef4(
|
|
240
|
+
(_a, ref) => {
|
|
241
|
+
var _b = _a, { as: Component = "div", className, style, value, title, icon, level = 1, disabled, onClick } = _b, rest = __objRest(_b, ["as", "className", "style", "value", "title", "icon", "level", "disabled", "onClick"]);
|
|
242
|
+
const { value: menuValue, openMode, onChange, onOpen } = useMenu();
|
|
243
|
+
const values = useContext4(MenuValueContext_default);
|
|
244
|
+
const mergedValues = [...values, value];
|
|
245
|
+
const [openMounted, setOpenMounted] = useState2(false);
|
|
246
|
+
const handleClick = (event) => {
|
|
247
|
+
if (value !== void 0) {
|
|
248
|
+
onChange(mergedValues);
|
|
249
|
+
}
|
|
250
|
+
onClick == null ? void 0 : onClick(event);
|
|
251
|
+
};
|
|
252
|
+
useEffect2(() => {
|
|
253
|
+
if (openMode === "automatic" && menuValue.length > 0 && menuValue[menuValue.length - 1] === value && !openMounted) {
|
|
254
|
+
onOpen(values);
|
|
255
|
+
onChange(mergedValues);
|
|
256
|
+
setOpenMounted(true);
|
|
257
|
+
}
|
|
258
|
+
}, [value, menuValue, openMode, openMounted]);
|
|
259
|
+
return /* @__PURE__ */ jsxs3(
|
|
260
|
+
Component,
|
|
261
|
+
__spreadProps(__spreadValues({
|
|
262
|
+
ref,
|
|
263
|
+
className: clsx3(
|
|
264
|
+
`${PREFIX_CLS}menu-item`,
|
|
265
|
+
{
|
|
266
|
+
[`${PREFIX_CLS}menu-item--selected`]: menuValue.includes(value),
|
|
267
|
+
[`${PREFIX_CLS}menu-item--disabled`]: disabled
|
|
268
|
+
},
|
|
269
|
+
className
|
|
270
|
+
),
|
|
271
|
+
style: __spreadValues({
|
|
272
|
+
paddingLeft: level <= 1 ? `var(--${PREFIX_CLS}menu-item-padding-x)` : `calc(${level} * var(--${PREFIX_CLS}menu-item-padding-level))`
|
|
273
|
+
}, style),
|
|
274
|
+
onClick: handleClick
|
|
275
|
+
}, rest), {
|
|
276
|
+
children: [
|
|
277
|
+
/* @__PURE__ */ jsx2("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ jsx2("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
|
|
278
|
+
icon && /* @__PURE__ */ jsx2("div", { className: `${PREFIX_CLS}menu-item__icon`, children: icon }),
|
|
279
|
+
/* @__PURE__ */ jsx2("div", { className: `${PREFIX_CLS}menu-item__content`, children: /* @__PURE__ */ jsx2("span", { className: `${PREFIX_CLS}menu-item__title`, children: title }) })
|
|
280
|
+
]
|
|
281
|
+
})
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
MenuItem.displayName = "MenuItem";
|
|
286
|
+
var MenuItem_default = MenuItem;
|
|
287
|
+
|
|
288
|
+
// src/components/Menu/MenuSubmenu.tsx
|
|
289
|
+
import clsx4 from "clsx";
|
|
290
|
+
import { useContext as useContext5, useEffect as useEffect3, useMemo, useState as useState3 } from "react";
|
|
291
|
+
import { MdKeyboardArrowDown, MdKeyboardArrowUp } from "react-icons/md";
|
|
292
|
+
|
|
293
|
+
// src/components/Menu/utils.ts
|
|
294
|
+
var getOpenValuesByPathname = (pathname) => {
|
|
295
|
+
return pathname.split("/").reduce((previousValue, currentValue) => {
|
|
296
|
+
const previousPath = previousValue[previousValue.length - 1];
|
|
297
|
+
if (previousPath != void 0) {
|
|
298
|
+
previousValue.push(previousPath + "/" + currentValue);
|
|
299
|
+
} else {
|
|
300
|
+
previousValue.push("");
|
|
301
|
+
}
|
|
302
|
+
return previousValue;
|
|
303
|
+
}, []);
|
|
304
|
+
};
|
|
305
|
+
var addOrRemoveValueInArray = (array, value) => {
|
|
306
|
+
const index = array.indexOf(value);
|
|
307
|
+
const newArray = [...array];
|
|
308
|
+
if (index === -1) {
|
|
309
|
+
newArray.push(value);
|
|
310
|
+
} else {
|
|
311
|
+
newArray.splice(index, 1);
|
|
312
|
+
}
|
|
313
|
+
return newArray;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
// src/components/Menu/MenuSubmenu.tsx
|
|
317
|
+
import { jsx as jsx3, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
318
|
+
var MenuSubmenu = (_a) => {
|
|
319
|
+
var _b = _a, {
|
|
320
|
+
children,
|
|
321
|
+
className,
|
|
322
|
+
style,
|
|
323
|
+
value,
|
|
324
|
+
title,
|
|
325
|
+
icon,
|
|
326
|
+
level = 1,
|
|
327
|
+
items,
|
|
328
|
+
onClick
|
|
329
|
+
} = _b, rest = __objRest(_b, [
|
|
330
|
+
"children",
|
|
331
|
+
"className",
|
|
332
|
+
"style",
|
|
333
|
+
"value",
|
|
334
|
+
"title",
|
|
335
|
+
"icon",
|
|
336
|
+
"level",
|
|
337
|
+
"items",
|
|
338
|
+
"onClick"
|
|
339
|
+
]);
|
|
340
|
+
const { value: menuValue, openValues, expandMode, openMode, onOpen } = useMenu();
|
|
341
|
+
const values = useContext5(MenuValueContext_default);
|
|
342
|
+
const isOpen = openValues.includes(value);
|
|
343
|
+
const mergedValues = [...values, value];
|
|
344
|
+
const [openMounted, setOpenMounted] = useState3(false);
|
|
345
|
+
const content = useMemo(() => {
|
|
346
|
+
return items == null ? void 0 : items.map((_a2, index) => {
|
|
347
|
+
var _b2 = _a2, { type } = _b2, item = __objRest(_b2, ["type"]);
|
|
348
|
+
return type === "item" ? /* @__PURE__ */ jsx3(MenuItem_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : type === "submenu" ? /* @__PURE__ */ jsx3(MenuSubmenu, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : type === "group" ? /* @__PURE__ */ jsx3(MenuGroup_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : /* @__PURE__ */ jsx3(MenuItem_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index);
|
|
349
|
+
});
|
|
350
|
+
}, [items]);
|
|
351
|
+
const handleClick = (event) => {
|
|
352
|
+
if (expandMode === "multiple") {
|
|
353
|
+
const updatedOpenValues = addOrRemoveValueInArray(openValues, value);
|
|
354
|
+
onOpen(updatedOpenValues);
|
|
355
|
+
} else {
|
|
356
|
+
if (isOpen) {
|
|
357
|
+
const updatedOpenValues = addOrRemoveValueInArray(mergedValues, value);
|
|
358
|
+
onOpen(updatedOpenValues);
|
|
359
|
+
} else {
|
|
360
|
+
const updatedOpenValues = addOrRemoveValueInArray(values, value);
|
|
361
|
+
onOpen(updatedOpenValues);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
onClick == null ? void 0 : onClick(event);
|
|
365
|
+
};
|
|
366
|
+
useEffect3(() => {
|
|
367
|
+
if (openMode === "automatic" && menuValue.length > 0 && menuValue[menuValue.length - 1] === value && !openMounted) {
|
|
368
|
+
onOpen(values);
|
|
369
|
+
setOpenMounted(true);
|
|
370
|
+
}
|
|
371
|
+
}, [value, menuValue, openMode, openMounted]);
|
|
372
|
+
return /* @__PURE__ */ jsx3(MenuValueContext_default.Provider, { value: mergedValues, children: /* @__PURE__ */ jsx3("div", { className: clsx4(`${PREFIX_CLS}menu-submenu`), children: /* @__PURE__ */ jsxs4(Collapse_default, { isOpen, children: [
|
|
373
|
+
/* @__PURE__ */ jsx3(CollapseTrigger_default, { children: /* @__PURE__ */ jsxs4(
|
|
374
|
+
"div",
|
|
375
|
+
__spreadProps(__spreadValues({
|
|
376
|
+
className: clsx4(
|
|
377
|
+
`${PREFIX_CLS}menu-item`,
|
|
378
|
+
{
|
|
379
|
+
[`${PREFIX_CLS}menu-item--selected`]: menuValue.includes(value) || items && mergedValues.includes(menuValue)
|
|
380
|
+
},
|
|
381
|
+
className
|
|
382
|
+
),
|
|
383
|
+
style: __spreadValues({
|
|
384
|
+
paddingLeft: level <= 1 ? `var(--${PREFIX_CLS}menu-item-padding-x)` : `calc(${level} * var(--${PREFIX_CLS}menu-item-padding-level))`
|
|
385
|
+
}, style),
|
|
386
|
+
onClick: handleClick
|
|
387
|
+
}, rest), {
|
|
388
|
+
children: [
|
|
389
|
+
/* @__PURE__ */ jsx3("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ jsx3("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
|
|
390
|
+
icon && /* @__PURE__ */ jsx3("div", { className: `${PREFIX_CLS}menu-item__icon`, children: icon }),
|
|
391
|
+
/* @__PURE__ */ jsx3("div", { className: `${PREFIX_CLS}menu-item__content`, children: /* @__PURE__ */ jsx3("span", { className: `${PREFIX_CLS}menu-item__title`, children: title }) }),
|
|
392
|
+
/* @__PURE__ */ jsx3("div", { className: `${PREFIX_CLS}menu-item__icon`, children: isOpen ? /* @__PURE__ */ jsx3(MdKeyboardArrowUp, { className: `${PREFIX_CLS}icon` }) : /* @__PURE__ */ jsx3(MdKeyboardArrowDown, { className: `${PREFIX_CLS}icon` }) })
|
|
393
|
+
]
|
|
394
|
+
})
|
|
395
|
+
) }),
|
|
396
|
+
/* @__PURE__ */ jsx3(CollapseContent_default, { children: /* @__PURE__ */ jsx3(
|
|
397
|
+
"ul",
|
|
398
|
+
{
|
|
399
|
+
className: clsx4(`${PREFIX_CLS}menu`, {
|
|
400
|
+
[`${PREFIX_CLS}menu-open`]: !open
|
|
401
|
+
}),
|
|
402
|
+
children: content || children
|
|
403
|
+
}
|
|
404
|
+
) })
|
|
405
|
+
] }) }) });
|
|
406
|
+
};
|
|
407
|
+
var MenuSubmenu_default = MenuSubmenu;
|
|
408
|
+
|
|
409
|
+
// src/components/Menu/MenuGroup.tsx
|
|
410
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
411
|
+
var MenuGroup = (_a) => {
|
|
412
|
+
var _b = _a, {
|
|
413
|
+
children,
|
|
414
|
+
className,
|
|
415
|
+
style,
|
|
416
|
+
title,
|
|
417
|
+
icon,
|
|
418
|
+
level = 1,
|
|
419
|
+
items
|
|
420
|
+
} = _b, rest = __objRest(_b, [
|
|
421
|
+
"children",
|
|
422
|
+
"className",
|
|
423
|
+
"style",
|
|
424
|
+
"title",
|
|
425
|
+
"icon",
|
|
426
|
+
"level",
|
|
427
|
+
"items"
|
|
428
|
+
]);
|
|
429
|
+
const content = useMemo2(() => {
|
|
430
|
+
return items == null ? void 0 : items.map((_a2, index) => {
|
|
431
|
+
var _b2 = _a2, { type } = _b2, item = __objRest(_b2, ["type"]);
|
|
432
|
+
return type === "item" ? /* @__PURE__ */ jsx4(MenuItem_default, __spreadValues({}, item), index) : type === "submenu" ? /* @__PURE__ */ jsx4(MenuSubmenu_default, __spreadValues({}, item), index) : /* @__PURE__ */ jsx4(MenuItem_default, __spreadValues({}, item), index);
|
|
433
|
+
});
|
|
434
|
+
}, [items]);
|
|
435
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
436
|
+
/* @__PURE__ */ jsxs5(
|
|
437
|
+
"div",
|
|
438
|
+
__spreadProps(__spreadValues({
|
|
439
|
+
className: clsx5(`${PREFIX_CLS}menu-group`, className),
|
|
440
|
+
style: __spreadValues({
|
|
441
|
+
paddingLeft: level <= 1 ? `var(--${PREFIX_CLS}menu-group-padding-x)` : `calc(${level} * var(--${PREFIX_CLS}menu-group-padding-level))`
|
|
442
|
+
}, style)
|
|
443
|
+
}, rest), {
|
|
444
|
+
children: [
|
|
445
|
+
icon && /* @__PURE__ */ jsx4("div", { className: `${PREFIX_CLS}menu-group__icon`, children: icon }),
|
|
446
|
+
/* @__PURE__ */ jsx4("div", { className: `${PREFIX_CLS}menu-group__content`, children: /* @__PURE__ */ jsx4("span", { className: `${PREFIX_CLS}menu-group__title`, children: title }) })
|
|
447
|
+
]
|
|
448
|
+
})
|
|
449
|
+
),
|
|
450
|
+
content || children
|
|
451
|
+
] });
|
|
452
|
+
};
|
|
453
|
+
var MenuGroup_default = MenuGroup;
|
|
454
|
+
|
|
455
|
+
// src/components/Menu/Menu.tsx
|
|
456
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
457
|
+
var Menu = (_a) => {
|
|
458
|
+
var _b = _a, {
|
|
459
|
+
children,
|
|
460
|
+
value: valueProp,
|
|
461
|
+
defaultValue,
|
|
462
|
+
openValues: openValuesProp,
|
|
463
|
+
expandMode = "multiple",
|
|
464
|
+
openMode = "manual",
|
|
465
|
+
items,
|
|
466
|
+
onChange,
|
|
467
|
+
onOpen
|
|
468
|
+
} = _b, rest = __objRest(_b, [
|
|
469
|
+
"children",
|
|
470
|
+
"value",
|
|
471
|
+
"defaultValue",
|
|
472
|
+
"openValues",
|
|
473
|
+
"expandMode",
|
|
474
|
+
"openMode",
|
|
475
|
+
"items",
|
|
476
|
+
"onChange",
|
|
477
|
+
"onOpen"
|
|
478
|
+
]);
|
|
479
|
+
var _a2;
|
|
480
|
+
const [selfValue, setSelfValue] = useState4((_a2 = valueProp != null ? valueProp : defaultValue) != null ? _a2 : []);
|
|
481
|
+
const [selfOpenValues, setSelfOpenValues] = useState4(openValuesProp != null ? openValuesProp : []);
|
|
482
|
+
const content = useMemo3(() => {
|
|
483
|
+
return items == null ? void 0 : items.map((_a3, index) => {
|
|
484
|
+
var _b2 = _a3, { type } = _b2, item = __objRest(_b2, ["type"]);
|
|
485
|
+
return type === "item" ? /* @__PURE__ */ jsx5(MenuItem_default, __spreadValues({}, item), index) : type === "submenu" ? /* @__PURE__ */ jsx5(MenuSubmenu_default, __spreadValues({}, item), index) : type === "group" ? /* @__PURE__ */ jsx5(MenuGroup_default, __spreadValues({}, item), index) : /* @__PURE__ */ jsx5(MenuItem_default, __spreadValues({}, item), index);
|
|
486
|
+
});
|
|
487
|
+
}, [items]);
|
|
488
|
+
const handleChange = (value) => {
|
|
489
|
+
if (valueProp !== void 0) {
|
|
490
|
+
onChange == null ? void 0 : onChange(value);
|
|
491
|
+
} else {
|
|
492
|
+
setSelfValue(value);
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
const handleOpen = (values) => {
|
|
496
|
+
if (openValuesProp !== void 0) {
|
|
497
|
+
onOpen == null ? void 0 : onOpen(values);
|
|
498
|
+
} else {
|
|
499
|
+
setSelfOpenValues(values);
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
useEffect4(() => {
|
|
503
|
+
if (valueProp !== void 0) {
|
|
504
|
+
setSelfValue(valueProp);
|
|
505
|
+
}
|
|
506
|
+
}, [valueProp]);
|
|
507
|
+
useEffect4(() => {
|
|
508
|
+
if (openValuesProp !== void 0) {
|
|
509
|
+
setSelfOpenValues(openValuesProp);
|
|
510
|
+
}
|
|
511
|
+
}, [openValuesProp]);
|
|
512
|
+
return /* @__PURE__ */ jsx5(
|
|
513
|
+
MenuContext_default.Provider,
|
|
514
|
+
{
|
|
515
|
+
value: {
|
|
516
|
+
value: selfValue,
|
|
517
|
+
openValues: selfOpenValues,
|
|
518
|
+
expandMode,
|
|
519
|
+
openMode,
|
|
520
|
+
onOpen: handleOpen,
|
|
521
|
+
onChange: handleChange
|
|
522
|
+
},
|
|
523
|
+
children: /* @__PURE__ */ jsx5("div", __spreadProps(__spreadValues({ className: clsx6(`${PREFIX_CLS}menu`) }, rest), { children: content || children }))
|
|
524
|
+
}
|
|
525
|
+
);
|
|
526
|
+
};
|
|
527
|
+
Menu.displayName = "Menu";
|
|
528
|
+
var Menu_default = Menu;
|
|
529
|
+
|
|
530
|
+
// src/components/Tabs/Tab.tsx
|
|
531
|
+
import clsx7 from "clsx";
|
|
67
532
|
import mergeRefs from "merge-refs";
|
|
68
|
-
import { forwardRef as
|
|
533
|
+
import { forwardRef as forwardRef5, useEffect as useEffect5, useRef as useRef2 } from "react";
|
|
69
534
|
|
|
70
535
|
// src/components/Tabs/TabsContext.ts
|
|
71
|
-
import { createContext, useContext } from "react";
|
|
72
|
-
var TabsContext =
|
|
536
|
+
import { createContext as createContext4, useContext as useContext6 } from "react";
|
|
537
|
+
var TabsContext = createContext4(null);
|
|
73
538
|
var useTabs = () => {
|
|
74
|
-
const context =
|
|
539
|
+
const context = useContext6(TabsContext);
|
|
75
540
|
if (!context) {
|
|
76
541
|
throw new Error("`useTabs` must be used within a `<Tabs />`");
|
|
77
542
|
}
|
|
@@ -79,12 +544,11 @@ var useTabs = () => {
|
|
|
79
544
|
};
|
|
80
545
|
|
|
81
546
|
// src/components/Tabs/Tab.tsx
|
|
82
|
-
import { jsx as
|
|
83
|
-
var
|
|
84
|
-
var Tab = forwardRef2(
|
|
547
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
548
|
+
var Tab = forwardRef5(
|
|
85
549
|
(_a, ref) => {
|
|
86
|
-
var _b = _a, { as: Component = "div", children, className, value, onClick } = _b, rest = __objRest(_b, ["as", "children", "className", "value", "onClick"]);
|
|
87
|
-
const tabRef =
|
|
550
|
+
var _b = _a, { as: Component = "div", children, className, role = "presentation", value, onClick } = _b, rest = __objRest(_b, ["as", "children", "className", "role", "value", "onClick"]);
|
|
551
|
+
const tabRef = useRef2(null);
|
|
88
552
|
const tabs = useTabs();
|
|
89
553
|
const handleClick = (event) => {
|
|
90
554
|
const previousTab = tabs.previousTabRef.current;
|
|
@@ -92,8 +556,8 @@ var Tab = forwardRef2(
|
|
|
92
556
|
if (!currentTab)
|
|
93
557
|
return;
|
|
94
558
|
if (previousTab) {
|
|
95
|
-
const previousIndicator = previousTab.querySelector(`.${
|
|
96
|
-
const currentIndicator = currentTab.querySelector(`.${
|
|
559
|
+
const previousIndicator = previousTab.querySelector(`.${PREFIX_CLS}tab__indicator`);
|
|
560
|
+
const currentIndicator = currentTab.querySelector(`.${PREFIX_CLS}tab__indicator`);
|
|
97
561
|
if (!previousIndicator || !currentIndicator)
|
|
98
562
|
return;
|
|
99
563
|
const from = {};
|
|
@@ -120,55 +584,57 @@ var Tab = forwardRef2(
|
|
|
120
584
|
tabs.onChange(value);
|
|
121
585
|
onClick == null ? void 0 : onClick(event);
|
|
122
586
|
};
|
|
123
|
-
|
|
587
|
+
useEffect5(() => {
|
|
124
588
|
if (value === tabs.value) {
|
|
125
589
|
tabs.previousTabRef.current = tabRef.current;
|
|
126
590
|
}
|
|
127
591
|
}, []);
|
|
128
|
-
return /* @__PURE__ */
|
|
592
|
+
return /* @__PURE__ */ jsxs6(
|
|
129
593
|
Component,
|
|
130
594
|
__spreadProps(__spreadValues({
|
|
131
595
|
ref: mergeRefs(tabRef, ref),
|
|
132
|
-
className:
|
|
596
|
+
className: clsx7(`${PREFIX_CLS}tab`, { [`${PREFIX_CLS}tab--selected`]: value === tabs.value }, className),
|
|
597
|
+
role,
|
|
133
598
|
onClick: handleClick
|
|
134
599
|
}, rest), {
|
|
135
|
-
children:
|
|
136
|
-
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
|
|
600
|
+
children: [
|
|
601
|
+
/* @__PURE__ */ jsx6("div", { className: `${PREFIX_CLS}overlay` }),
|
|
602
|
+
/* @__PURE__ */ jsx6("div", { className: `${PREFIX_CLS}tab__content`, children }),
|
|
603
|
+
/* @__PURE__ */ jsx6("div", { className: `${PREFIX_CLS}tab__indicator` })
|
|
604
|
+
]
|
|
139
605
|
})
|
|
140
606
|
);
|
|
141
607
|
}
|
|
142
608
|
);
|
|
143
609
|
|
|
144
610
|
// src/components/Tabs/Tabs.tsx
|
|
145
|
-
import
|
|
146
|
-
import { useEffect as
|
|
147
|
-
import { jsx as
|
|
148
|
-
var
|
|
611
|
+
import clsx8 from "clsx";
|
|
612
|
+
import { useEffect as useEffect6, useRef as useRef3, useState as useState5 } from "react";
|
|
613
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
614
|
+
var prefixCls = "us-";
|
|
149
615
|
var Tabs = (_a) => {
|
|
150
616
|
var _b = _a, { children, className, value, defaultValue, onChange } = _b, rest = __objRest(_b, ["children", "className", "value", "defaultValue", "onChange"]);
|
|
151
|
-
const previousTabRef =
|
|
152
|
-
const [selfValue, setSelfValue] =
|
|
617
|
+
const previousTabRef = useRef3(null);
|
|
618
|
+
const [selfValue, setSelfValue] = useState5(value != null ? value : defaultValue);
|
|
153
619
|
const handleChange = (value2) => {
|
|
154
620
|
setSelfValue(value2);
|
|
155
621
|
onChange == null ? void 0 : onChange(value2);
|
|
156
622
|
};
|
|
157
|
-
|
|
623
|
+
useEffect6(() => {
|
|
158
624
|
if (value !== void 0) {
|
|
159
625
|
setSelfValue(value);
|
|
160
626
|
}
|
|
161
627
|
}, [value]);
|
|
162
|
-
return /* @__PURE__ */
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */
|
|
628
|
+
return /* @__PURE__ */ jsxs7(TabsContext.Provider, { value: { previousTabRef, value: selfValue, onChange: handleChange }, children: [
|
|
629
|
+
/* @__PURE__ */ jsx7("div", __spreadProps(__spreadValues({ className: clsx8(`${prefixCls}tabs`, className) }, rest), { children })),
|
|
630
|
+
/* @__PURE__ */ jsx7("div", { className: `${prefixCls}divider` })
|
|
165
631
|
] });
|
|
166
632
|
};
|
|
167
633
|
|
|
168
634
|
// src/components/DropdownEnumList.tsx
|
|
169
635
|
import { DropDownList } from "@progress/kendo-react-dropdowns";
|
|
170
|
-
import { useEffect as
|
|
171
|
-
import { Fragment, jsx as
|
|
636
|
+
import { useEffect as useEffect7, useState as useState6 } from "react";
|
|
637
|
+
import { Fragment as Fragment2, jsx as jsx8 } from "react/jsx-runtime";
|
|
172
638
|
function parsearDataForComboBox(array, key, text, itemAll = false) {
|
|
173
639
|
const dataForComboBox = [];
|
|
174
640
|
if (itemAll)
|
|
@@ -203,16 +669,16 @@ function EnumToArray(typeEnum, replaceGuionForSpace = true, description) {
|
|
|
203
669
|
return values;
|
|
204
670
|
}
|
|
205
671
|
var DropEnumList = ({ dataEnum, description, onChange, width, defaultValue }) => {
|
|
206
|
-
const [value, setValue] =
|
|
207
|
-
const [data, setData] =
|
|
208
|
-
|
|
672
|
+
const [value, setValue] = useState6("");
|
|
673
|
+
const [data, setData] = useState6([]);
|
|
674
|
+
useEffect7(() => {
|
|
209
675
|
setData(
|
|
210
676
|
parsearDataForComboBox(EnumToArray(dataEnum, true, description), "value", "label", false).sort(
|
|
211
677
|
(a, b) => Number(a.key) - Number(b.key)
|
|
212
678
|
)
|
|
213
679
|
);
|
|
214
680
|
}, []);
|
|
215
|
-
|
|
681
|
+
useEffect7(() => {
|
|
216
682
|
if (data.length > 0) {
|
|
217
683
|
setValue(data.filter((x) => x.key == defaultValue)[0]);
|
|
218
684
|
}
|
|
@@ -221,7 +687,7 @@ var DropEnumList = ({ dataEnum, description, onChange, width, defaultValue }) =>
|
|
|
221
687
|
onChange(e);
|
|
222
688
|
setValue(e);
|
|
223
689
|
};
|
|
224
|
-
return /* @__PURE__ */
|
|
690
|
+
return /* @__PURE__ */ jsx8(Fragment2, { children: /* @__PURE__ */ jsx8(
|
|
225
691
|
DropDownList,
|
|
226
692
|
{
|
|
227
693
|
className: "d-inline-block align-middle mr-2",
|
|
@@ -242,22 +708,22 @@ var DropEnumList = ({ dataEnum, description, onChange, width, defaultValue }) =>
|
|
|
242
708
|
};
|
|
243
709
|
|
|
244
710
|
// src/contexts/BreadCrumbContext.tsx
|
|
245
|
-
import { createContext as
|
|
711
|
+
import { createContext as createContext5, useState as useState8 } from "react";
|
|
246
712
|
|
|
247
713
|
// src/hooks/useLocalStorage.tsx
|
|
248
|
-
import { useCallback, useEffect as
|
|
714
|
+
import { useCallback, useEffect as useEffect9, useState as useState7 } from "react";
|
|
249
715
|
|
|
250
716
|
// src/hooks/useEventListener.tsx
|
|
251
|
-
import { useRef as
|
|
717
|
+
import { useRef as useRef4 } from "react";
|
|
252
718
|
|
|
253
719
|
// src/hooks/useIsomorphicLayoutEffect.tsx
|
|
254
|
-
import { useEffect as
|
|
255
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect :
|
|
720
|
+
import { useEffect as useEffect8, useLayoutEffect } from "react";
|
|
721
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect8;
|
|
256
722
|
var useIsomorphicLayoutEffect_default = useIsomorphicLayoutEffect;
|
|
257
723
|
|
|
258
724
|
// src/hooks/useEventListener.tsx
|
|
259
725
|
function useEventListener(handler) {
|
|
260
|
-
const savedHandler =
|
|
726
|
+
const savedHandler = useRef4(handler);
|
|
261
727
|
useIsomorphicLayoutEffect_default(() => {
|
|
262
728
|
savedHandler.current = handler;
|
|
263
729
|
}, [handler]);
|
|
@@ -278,7 +744,7 @@ function useLocalStorage(key, initialValue) {
|
|
|
278
744
|
return initialValue;
|
|
279
745
|
}
|
|
280
746
|
}, [initialValue, key]);
|
|
281
|
-
const [storedValue, setStoredValue] =
|
|
747
|
+
const [storedValue, setStoredValue] = useState7(readValue);
|
|
282
748
|
const setValue = useCallback(
|
|
283
749
|
(value) => {
|
|
284
750
|
if (typeof window == "undefined") {
|
|
@@ -295,7 +761,7 @@ function useLocalStorage(key, initialValue) {
|
|
|
295
761
|
},
|
|
296
762
|
[key, storedValue]
|
|
297
763
|
);
|
|
298
|
-
|
|
764
|
+
useEffect9(() => {
|
|
299
765
|
setStoredValue(readValue());
|
|
300
766
|
}, []);
|
|
301
767
|
const handleStorageChange = useCallback(() => {
|
|
@@ -315,15 +781,15 @@ function parseJSON(value) {
|
|
|
315
781
|
}
|
|
316
782
|
|
|
317
783
|
// src/contexts/BreadCrumbContext.tsx
|
|
318
|
-
import { jsx as
|
|
319
|
-
var BreadCrumbContext =
|
|
784
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
785
|
+
var BreadCrumbContext = createContext5({});
|
|
320
786
|
var BreadCrumbContextProvider = ({ children }) => {
|
|
321
787
|
const [active, setActive] = useLocalStorage("@active", "");
|
|
322
788
|
const [path, setPath] = useLocalStorage("@path", "/");
|
|
323
789
|
const [goBack, setGoBack] = useLocalStorage("@goBack", false);
|
|
324
790
|
const [pathChild, setPathChild] = useLocalStorage("@pathChild", "");
|
|
325
|
-
const [routes, setRoutes] =
|
|
326
|
-
return /* @__PURE__ */
|
|
791
|
+
const [routes, setRoutes] = useState8([]);
|
|
792
|
+
return /* @__PURE__ */ jsx9(
|
|
327
793
|
BreadCrumbContext.Provider,
|
|
328
794
|
{
|
|
329
795
|
value: {
|
|
@@ -344,18 +810,18 @@ var BreadCrumbContextProvider = ({ children }) => {
|
|
|
344
810
|
};
|
|
345
811
|
|
|
346
812
|
// src/contexts/DrawerContext.tsx
|
|
347
|
-
import { createContext as
|
|
348
|
-
import { jsx as
|
|
349
|
-
var DrawerContext =
|
|
813
|
+
import { createContext as createContext6, useState as useState9 } from "react";
|
|
814
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
815
|
+
var DrawerContext = createContext6({});
|
|
350
816
|
var DrawerContextProvider = ({ children }) => {
|
|
351
|
-
const [active, setActive] =
|
|
352
|
-
return /* @__PURE__ */
|
|
817
|
+
const [active, setActive] = useState9(false);
|
|
818
|
+
return /* @__PURE__ */ jsx10(DrawerContext.Provider, { value: { active, setActive }, children });
|
|
353
819
|
};
|
|
354
820
|
|
|
355
821
|
// src/contexts/HistoryContext.tsx
|
|
356
|
-
import { createContext as
|
|
357
|
-
import { jsx as
|
|
358
|
-
var HistoryContext =
|
|
822
|
+
import { createContext as createContext7 } from "react";
|
|
823
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
824
|
+
var HistoryContext = createContext7({});
|
|
359
825
|
var HistoryContextProvider = ({ children }) => {
|
|
360
826
|
const [list, setList] = useLocalStorage("@list_paths", []);
|
|
361
827
|
const updateList = (value) => {
|
|
@@ -367,40 +833,40 @@ var HistoryContextProvider = ({ children }) => {
|
|
|
367
833
|
})
|
|
368
834
|
);
|
|
369
835
|
};
|
|
370
|
-
return /* @__PURE__ */
|
|
836
|
+
return /* @__PURE__ */ jsx11(HistoryContext.Provider, { value: { list, updateList }, children });
|
|
371
837
|
};
|
|
372
838
|
|
|
373
839
|
// src/contexts/SidebarMainContext.tsx
|
|
374
|
-
import { createContext as
|
|
375
|
-
import { jsx as
|
|
376
|
-
var SidebarMainContext =
|
|
840
|
+
import { createContext as createContext8, useState as useState10 } from "react";
|
|
841
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
842
|
+
var SidebarMainContext = createContext8({});
|
|
377
843
|
var SidebarMainContextProvider = ({ children }) => {
|
|
378
|
-
const [
|
|
379
|
-
return /* @__PURE__ */
|
|
844
|
+
const [open2, setOpen] = useState10(true);
|
|
845
|
+
return /* @__PURE__ */ jsx12(SidebarMainContext.Provider, { value: { open: open2, setOpen }, children });
|
|
380
846
|
};
|
|
381
847
|
|
|
382
848
|
// src/contexts/GlobalProvider.tsx
|
|
383
|
-
import { jsx as
|
|
849
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
384
850
|
function GlobalProvider({ children }) {
|
|
385
|
-
return /* @__PURE__ */
|
|
851
|
+
return /* @__PURE__ */ jsx13(HistoryContextProvider, { children: /* @__PURE__ */ jsx13(BreadCrumbContextProvider, { children: /* @__PURE__ */ jsx13(SidebarMainContextProvider, { children: /* @__PURE__ */ jsx13(DrawerContextProvider, { children }) }) }) });
|
|
386
852
|
}
|
|
387
853
|
|
|
388
854
|
// src/hooks/usePrevious.tsx
|
|
389
|
-
import { useEffect as
|
|
855
|
+
import { useEffect as useEffect10, useRef as useRef5 } from "react";
|
|
390
856
|
var usePrevious = (value) => {
|
|
391
|
-
const ref =
|
|
392
|
-
|
|
857
|
+
const ref = useRef5();
|
|
858
|
+
useEffect10(() => {
|
|
393
859
|
ref.current = value;
|
|
394
860
|
});
|
|
395
861
|
return ref.current;
|
|
396
862
|
};
|
|
397
863
|
|
|
398
864
|
// src/hooks/useStep.tsx
|
|
399
|
-
import { useCallback as useCallback2, useMemo, useState as
|
|
865
|
+
import { useCallback as useCallback2, useMemo as useMemo4, useState as useState11 } from "react";
|
|
400
866
|
var useStep = (maxStep) => {
|
|
401
|
-
const [currentStep, setCurrentStep] =
|
|
402
|
-
const canGoToNextStep =
|
|
403
|
-
const canGoToPrevStep =
|
|
867
|
+
const [currentStep, setCurrentStep] = useState11(1);
|
|
868
|
+
const canGoToNextStep = useMemo4(() => currentStep + 1 <= maxStep, [currentStep, maxStep]);
|
|
869
|
+
const canGoToPrevStep = useMemo4(() => currentStep - 1 >= 1, [currentStep]);
|
|
404
870
|
const setStep = useCallback2(
|
|
405
871
|
(step) => {
|
|
406
872
|
const newStep = step instanceof Function ? step(currentStep) : step;
|
|
@@ -439,7 +905,7 @@ var useStep = (maxStep) => {
|
|
|
439
905
|
};
|
|
440
906
|
|
|
441
907
|
// src/layout/AppBreadcrumb.tsx
|
|
442
|
-
import { useContext as
|
|
908
|
+
import { useContext as useContext7, useEffect as useEffect11 } from "react";
|
|
443
909
|
import { MdClose } from "react-icons/md";
|
|
444
910
|
import { VscChevronRight } from "react-icons/vsc";
|
|
445
911
|
import { Link as Link3 } from "react-router-dom";
|
|
@@ -485,7 +951,7 @@ var TitlePage = styled.div`
|
|
|
485
951
|
// src/styled-components/menu.ts
|
|
486
952
|
import { Link } from "react-router-dom";
|
|
487
953
|
import styled2 from "styled-components";
|
|
488
|
-
var
|
|
954
|
+
var MenuItem2 = styled2(Link)`
|
|
489
955
|
text-decoration: none;
|
|
490
956
|
color: black;
|
|
491
957
|
display: flex;
|
|
@@ -864,48 +1330,48 @@ var CloseIcon = styled6.button`
|
|
|
864
1330
|
`;
|
|
865
1331
|
|
|
866
1332
|
// src/layout/AppBreadcrumb.tsx
|
|
867
|
-
import { jsx as
|
|
1333
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
868
1334
|
var AppBreadCrumb = ({ title, paths }) => {
|
|
869
|
-
const { setRoutes } =
|
|
870
|
-
|
|
1335
|
+
const { setRoutes } = useContext7(BreadCrumbContext);
|
|
1336
|
+
useEffect11(() => {
|
|
871
1337
|
if (!(paths == null ? void 0 : paths.length))
|
|
872
1338
|
return;
|
|
873
1339
|
setRoutes(paths != null ? paths : []);
|
|
874
1340
|
}, []);
|
|
875
|
-
return /* @__PURE__ */
|
|
1341
|
+
return /* @__PURE__ */ jsx14(BreadCrumbTitle, { children: title != null ? title : "Home" });
|
|
876
1342
|
};
|
|
877
1343
|
var AppBreadCrumbNav = ({
|
|
878
1344
|
paths,
|
|
879
1345
|
onPush
|
|
880
1346
|
}) => {
|
|
881
|
-
const { active, path, routes, setRoutes } =
|
|
882
|
-
const { updateList } =
|
|
883
|
-
|
|
1347
|
+
const { active, path, routes, setRoutes } = useContext7(BreadCrumbContext);
|
|
1348
|
+
const { updateList } = useContext7(HistoryContext);
|
|
1349
|
+
useEffect11(() => {
|
|
884
1350
|
updateList({ name: active, path });
|
|
885
1351
|
}, [path, active]);
|
|
886
|
-
|
|
1352
|
+
useEffect11(() => {
|
|
887
1353
|
setRoutes(paths != null ? paths : []);
|
|
888
1354
|
}, [paths]);
|
|
889
|
-
return /* @__PURE__ */
|
|
890
|
-
/* @__PURE__ */
|
|
891
|
-
/* @__PURE__ */
|
|
892
|
-
routes.length > 0 && /* @__PURE__ */
|
|
1355
|
+
return /* @__PURE__ */ jsxs8(Breadcrumb, { children: [
|
|
1356
|
+
/* @__PURE__ */ jsxs8("div", { className: "d-flex align-items-center", children: [
|
|
1357
|
+
/* @__PURE__ */ jsx14(Link3, { to: "/", className: "link", children: "HOME" }),
|
|
1358
|
+
routes.length > 0 && /* @__PURE__ */ jsx14(VscChevronRight, { color: "black" }),
|
|
893
1359
|
routes.length > 0 ? routes.map((i, idx, arr) => {
|
|
894
1360
|
if (i.route === -1) {
|
|
895
|
-
return /* @__PURE__ */
|
|
1361
|
+
return /* @__PURE__ */ jsxs8("span", { className: "link", onClick: () => onPush(-1), children: [
|
|
896
1362
|
i.title,
|
|
897
1363
|
" ",
|
|
898
|
-
idx + 1 === arr.length ? "" : /* @__PURE__ */
|
|
1364
|
+
idx + 1 === arr.length ? "" : /* @__PURE__ */ jsx14(VscChevronRight, { color: "black" })
|
|
899
1365
|
] }, idx);
|
|
900
1366
|
}
|
|
901
|
-
return /* @__PURE__ */
|
|
1367
|
+
return /* @__PURE__ */ jsxs8(Link3, { to: i.route, className: "link", children: [
|
|
902
1368
|
i.title,
|
|
903
1369
|
" ",
|
|
904
|
-
idx + 1 === arr.length ? "" : /* @__PURE__ */
|
|
1370
|
+
idx + 1 === arr.length ? "" : /* @__PURE__ */ jsx14(VscChevronRight, { color: "black" })
|
|
905
1371
|
] }, idx);
|
|
906
1372
|
}) : ""
|
|
907
1373
|
] }),
|
|
908
|
-
/* @__PURE__ */
|
|
1374
|
+
/* @__PURE__ */ jsx14(
|
|
909
1375
|
CloseIcon,
|
|
910
1376
|
{
|
|
911
1377
|
onClick: () => {
|
|
@@ -916,21 +1382,21 @@ var AppBreadCrumbNav = ({
|
|
|
916
1382
|
}
|
|
917
1383
|
onPush(`${routes && routes[(routes == null ? void 0 : routes.length) - 2].route}`);
|
|
918
1384
|
},
|
|
919
|
-
children: /* @__PURE__ */
|
|
1385
|
+
children: /* @__PURE__ */ jsx14(MdClose, { fontSize: 20 })
|
|
920
1386
|
}
|
|
921
1387
|
)
|
|
922
1388
|
] });
|
|
923
1389
|
};
|
|
924
1390
|
|
|
925
1391
|
// src/layout/AppLoader.tsx
|
|
926
|
-
import { useEffect as
|
|
1392
|
+
import { useEffect as useEffect12 } from "react";
|
|
927
1393
|
import ReactDOM from "react-dom";
|
|
928
|
-
import { jsx as
|
|
1394
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
929
1395
|
var LoaderGrid = () => {
|
|
930
|
-
const Loader = /* @__PURE__ */
|
|
931
|
-
/* @__PURE__ */
|
|
932
|
-
/* @__PURE__ */
|
|
933
|
-
/* @__PURE__ */
|
|
1396
|
+
const Loader = /* @__PURE__ */ jsxs9("div", { className: "k-loading-mask", children: [
|
|
1397
|
+
/* @__PURE__ */ jsx15("span", { className: "k-loading-text", children: "Loading" }),
|
|
1398
|
+
/* @__PURE__ */ jsx15("div", { className: "k-loading-image" }),
|
|
1399
|
+
/* @__PURE__ */ jsx15("div", { className: "k-loading-color" })
|
|
934
1400
|
] });
|
|
935
1401
|
const gridContent = document && document.querySelector(".k-grid-content");
|
|
936
1402
|
const reportContent = document && document.querySelector(".loading-report");
|
|
@@ -939,12 +1405,12 @@ var LoaderGrid = () => {
|
|
|
939
1405
|
var AppLoader = (props) => {
|
|
940
1406
|
const { type = "grid", parent, minDuration } = props;
|
|
941
1407
|
const parentEl = type === "grid" ? document.querySelector(parent != null ? parent : ".k-grid-container") : parent ? document.querySelector(parent) : null;
|
|
942
|
-
const Loading = /* @__PURE__ */
|
|
943
|
-
/* @__PURE__ */
|
|
944
|
-
/* @__PURE__ */
|
|
945
|
-
/* @__PURE__ */
|
|
1408
|
+
const Loading = /* @__PURE__ */ jsxs9("div", { className: `${type}-loading k-loading-mask`, children: [
|
|
1409
|
+
/* @__PURE__ */ jsx15("span", { className: "k-loading-text", children: "Loading" }),
|
|
1410
|
+
/* @__PURE__ */ jsx15("div", { className: "k-loading-image" }),
|
|
1411
|
+
/* @__PURE__ */ jsx15("div", { className: "k-loading-color" })
|
|
946
1412
|
] });
|
|
947
|
-
|
|
1413
|
+
useEffect12(() => {
|
|
948
1414
|
if (type === "button") {
|
|
949
1415
|
const loadingEl = document.createElement("div");
|
|
950
1416
|
loadingEl.className = "icon button-loading k-loading-mask";
|
|
@@ -983,7 +1449,7 @@ var AppLoader = (props) => {
|
|
|
983
1449
|
import { Dropdown } from "react-bootstrap";
|
|
984
1450
|
import { BsArrowsFullscreen } from "react-icons/bs";
|
|
985
1451
|
import { FiCheckCircle, FiFilter, FiPlusSquare, FiRefreshCcw, FiSave } from "react-icons/fi";
|
|
986
|
-
import { jsx as
|
|
1452
|
+
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
987
1453
|
var NavOptions = ({
|
|
988
1454
|
exportExcel,
|
|
989
1455
|
customButtons,
|
|
@@ -993,27 +1459,27 @@ var NavOptions = ({
|
|
|
993
1459
|
onClear,
|
|
994
1460
|
onExpandScreen
|
|
995
1461
|
}) => {
|
|
996
|
-
return /* @__PURE__ */
|
|
997
|
-
onCreate && /* @__PURE__ */
|
|
998
|
-
/* @__PURE__ */
|
|
1462
|
+
return /* @__PURE__ */ jsxs10(MenuOptions, { children: [
|
|
1463
|
+
onCreate && /* @__PURE__ */ jsxs10("button", { className: "button-option", onClick: onCreate, children: [
|
|
1464
|
+
/* @__PURE__ */ jsx16(FiPlusSquare, { className: "icon" }),
|
|
999
1465
|
" ",
|
|
1000
|
-
/* @__PURE__ */
|
|
1466
|
+
/* @__PURE__ */ jsx16("span", { className: "text", children: "New" })
|
|
1001
1467
|
] }),
|
|
1002
|
-
onRefresh && /* @__PURE__ */
|
|
1003
|
-
/* @__PURE__ */
|
|
1468
|
+
onRefresh && /* @__PURE__ */ jsxs10("button", { className: "button-option", onClick: onRefresh, children: [
|
|
1469
|
+
/* @__PURE__ */ jsx16(FiRefreshCcw, { className: "icon" }),
|
|
1004
1470
|
" ",
|
|
1005
|
-
/* @__PURE__ */
|
|
1471
|
+
/* @__PURE__ */ jsx16("span", { className: "text", children: "Refresh" })
|
|
1006
1472
|
] }),
|
|
1007
|
-
exportExcel && exportExcel.length > 0 && /* @__PURE__ */
|
|
1008
|
-
/* @__PURE__ */
|
|
1473
|
+
exportExcel && exportExcel.length > 0 && /* @__PURE__ */ jsxs10(Dropdown, { className: "button-option", children: [
|
|
1474
|
+
/* @__PURE__ */ jsxs10(
|
|
1009
1475
|
Dropdown.Toggle,
|
|
1010
1476
|
{
|
|
1011
1477
|
id: "btnExport",
|
|
1012
1478
|
className: "p-2 bg-light text-dark border-0 font-weight-bold",
|
|
1013
1479
|
title: "Export to Excel",
|
|
1014
1480
|
children: [
|
|
1015
|
-
/* @__PURE__ */
|
|
1016
|
-
/* @__PURE__ */
|
|
1481
|
+
/* @__PURE__ */ jsx16(FiSave, { className: "icon" }),
|
|
1482
|
+
/* @__PURE__ */ jsx16(
|
|
1017
1483
|
"span",
|
|
1018
1484
|
{
|
|
1019
1485
|
style: {
|
|
@@ -1027,45 +1493,45 @@ var NavOptions = ({
|
|
|
1027
1493
|
]
|
|
1028
1494
|
}
|
|
1029
1495
|
),
|
|
1030
|
-
/* @__PURE__ */
|
|
1031
|
-
return /* @__PURE__ */
|
|
1032
|
-
/* @__PURE__ */
|
|
1496
|
+
/* @__PURE__ */ jsx16(Dropdown.Menu, { children: exportExcel.map((item, index) => {
|
|
1497
|
+
return /* @__PURE__ */ jsxs10(Dropdown.Item, { onClick: item.onAction, children: [
|
|
1498
|
+
/* @__PURE__ */ jsx16("i", { className: `${item.classNameIcon} mr-2` }),
|
|
1033
1499
|
" ",
|
|
1034
1500
|
item.title
|
|
1035
1501
|
] }, index);
|
|
1036
1502
|
}) })
|
|
1037
1503
|
] }),
|
|
1038
|
-
onSelect && /* @__PURE__ */
|
|
1039
|
-
/* @__PURE__ */
|
|
1504
|
+
onSelect && /* @__PURE__ */ jsxs10("button", { className: "button-option", onClick: onSelect, children: [
|
|
1505
|
+
/* @__PURE__ */ jsx16(FiCheckCircle, { className: "icon" }),
|
|
1040
1506
|
" ",
|
|
1041
|
-
/* @__PURE__ */
|
|
1507
|
+
/* @__PURE__ */ jsx16("span", { className: "text", children: "Select All" })
|
|
1042
1508
|
] }),
|
|
1043
|
-
onClear && /* @__PURE__ */
|
|
1044
|
-
/* @__PURE__ */
|
|
1509
|
+
onClear && /* @__PURE__ */ jsxs10("button", { className: "button-option", onClick: onClear, children: [
|
|
1510
|
+
/* @__PURE__ */ jsx16(FiFilter, { className: "icon" }),
|
|
1045
1511
|
" ",
|
|
1046
|
-
/* @__PURE__ */
|
|
1512
|
+
/* @__PURE__ */ jsx16("span", { className: "text", children: "Clear Filters" })
|
|
1047
1513
|
] }),
|
|
1048
|
-
onExpandScreen && /* @__PURE__ */
|
|
1049
|
-
/* @__PURE__ */
|
|
1514
|
+
onExpandScreen && /* @__PURE__ */ jsxs10("button", { className: "button-option", onClick: onExpandScreen, children: [
|
|
1515
|
+
/* @__PURE__ */ jsx16(BsArrowsFullscreen, { className: "icon" }),
|
|
1050
1516
|
" ",
|
|
1051
|
-
/* @__PURE__ */
|
|
1517
|
+
/* @__PURE__ */ jsx16("span", { className: "text", children: "Full Page" })
|
|
1052
1518
|
] }),
|
|
1053
1519
|
customButtons == null ? void 0 : customButtons.map((custom, index) => {
|
|
1054
1520
|
if (custom.render) {
|
|
1055
1521
|
return custom.render;
|
|
1056
1522
|
}
|
|
1057
|
-
return /* @__PURE__ */
|
|
1058
|
-
custom.Icon !== void 0 && /* @__PURE__ */
|
|
1059
|
-
/* @__PURE__ */
|
|
1523
|
+
return /* @__PURE__ */ jsxs10("button", { className: "button-option", onClick: custom.onAction, children: [
|
|
1524
|
+
custom.Icon !== void 0 && /* @__PURE__ */ jsx16(custom.Icon, { className: "icon" }),
|
|
1525
|
+
/* @__PURE__ */ jsx16("span", { className: "text", children: custom.title })
|
|
1060
1526
|
] }, index);
|
|
1061
1527
|
})
|
|
1062
1528
|
] });
|
|
1063
1529
|
};
|
|
1064
1530
|
|
|
1065
1531
|
// src/layout/title.tsx
|
|
1066
|
-
import { jsx as
|
|
1532
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1067
1533
|
var Title = ({ title }) => {
|
|
1068
|
-
return /* @__PURE__ */
|
|
1534
|
+
return /* @__PURE__ */ jsx17(TitlePage, { children: title != null ? title : "Home" });
|
|
1069
1535
|
};
|
|
1070
1536
|
export {
|
|
1071
1537
|
AppBreadCrumb,
|
|
@@ -1077,6 +1543,10 @@ export {
|
|
|
1077
1543
|
Breadcrumb,
|
|
1078
1544
|
Button,
|
|
1079
1545
|
CloseIcon,
|
|
1546
|
+
Collapse_default as Collapse,
|
|
1547
|
+
CollapseContent_default as CollapseContent,
|
|
1548
|
+
CollapseContext_default as CollapseContext,
|
|
1549
|
+
CollapseTrigger_default as CollapseTrigger,
|
|
1080
1550
|
DrawerContext,
|
|
1081
1551
|
DrawerContextProvider,
|
|
1082
1552
|
DropEnumList,
|
|
@@ -1087,9 +1557,15 @@ export {
|
|
|
1087
1557
|
ItemSidebar,
|
|
1088
1558
|
LoaderGrid,
|
|
1089
1559
|
Main,
|
|
1090
|
-
|
|
1560
|
+
Menu_default as Menu,
|
|
1561
|
+
MenuContext_default as MenuContext,
|
|
1562
|
+
MenuGroup_default as MenuGroup,
|
|
1563
|
+
MenuItem_default as MenuItem,
|
|
1564
|
+
MenuItem2 as MenuItems,
|
|
1091
1565
|
MenuOptions,
|
|
1566
|
+
MenuSubmenu_default as MenuSubmenu,
|
|
1092
1567
|
MenuTitle,
|
|
1568
|
+
MenuValueContext_default as MenuValueContext,
|
|
1093
1569
|
NavOptions,
|
|
1094
1570
|
Navbar,
|
|
1095
1571
|
SidebarMainContext,
|
|
@@ -1098,7 +1574,11 @@ export {
|
|
|
1098
1574
|
Tab,
|
|
1099
1575
|
Tabs,
|
|
1100
1576
|
Title,
|
|
1577
|
+
getOpenValuesByPathname,
|
|
1578
|
+
useCollapse,
|
|
1101
1579
|
useLocalStorage,
|
|
1580
|
+
useMenu,
|
|
1581
|
+
useMenuItemValue,
|
|
1102
1582
|
usePrevious,
|
|
1103
1583
|
useStep
|
|
1104
1584
|
};
|