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