@apexcura/ui-components 0.0.12-Beta99 → 0.0.13-Beta0
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.css +3 -28
- package/dist/index.d.mts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +202 -35
- package/dist/index.mjs +193 -27
- package/package.json +4 -1
package/dist/index.css
CHANGED
|
@@ -338,27 +338,18 @@ video {
|
|
|
338
338
|
.m-\[10px\] {
|
|
339
339
|
margin: 10px;
|
|
340
340
|
}
|
|
341
|
+
.flex {
|
|
342
|
+
display: flex;
|
|
343
|
+
}
|
|
341
344
|
.table {
|
|
342
345
|
display: table;
|
|
343
346
|
}
|
|
344
|
-
.h-\[40px\] {
|
|
345
|
-
height: 40px;
|
|
346
|
-
}
|
|
347
|
-
.w-\[126px\] {
|
|
348
|
-
width: 126px;
|
|
349
|
-
}
|
|
350
347
|
.rounded-\[8px\] {
|
|
351
348
|
border-radius: 8px;
|
|
352
349
|
}
|
|
353
|
-
.rounded-full {
|
|
354
|
-
border-radius: 9999px;
|
|
355
|
-
}
|
|
356
350
|
.border {
|
|
357
351
|
border-width: 1px;
|
|
358
352
|
}
|
|
359
|
-
.border-none {
|
|
360
|
-
border-style: none;
|
|
361
|
-
}
|
|
362
353
|
.border-\[\#919191\] {
|
|
363
354
|
--tw-border-opacity: 1;
|
|
364
355
|
border-color: rgb(145 145 145 / var(--tw-border-opacity));
|
|
@@ -375,10 +366,6 @@ video {
|
|
|
375
366
|
--tw-bg-opacity: 1;
|
|
376
367
|
background-color: rgb(242 242 242 / var(--tw-bg-opacity));
|
|
377
368
|
}
|
|
378
|
-
.bg-purple-800 {
|
|
379
|
-
--tw-bg-opacity: 1;
|
|
380
|
-
background-color: rgb(107 33 168 / var(--tw-bg-opacity));
|
|
381
|
-
}
|
|
382
369
|
.p-\[6px\] {
|
|
383
370
|
padding: 6px;
|
|
384
371
|
}
|
|
@@ -392,10 +379,6 @@ video {
|
|
|
392
379
|
--tw-text-opacity: 1;
|
|
393
380
|
color: rgb(0 0 0 / var(--tw-text-opacity));
|
|
394
381
|
}
|
|
395
|
-
.text-white {
|
|
396
|
-
--tw-text-opacity: 1;
|
|
397
|
-
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
398
|
-
}
|
|
399
382
|
.shadow-\[0px_0px_1px_1px_\#919191\] {
|
|
400
383
|
--tw-shadow: 0px 0px 1px 1px #919191;
|
|
401
384
|
--tw-shadow-colored: 0px 0px 1px 1px var(--tw-shadow-color);
|
|
@@ -412,14 +395,6 @@ video {
|
|
|
412
395
|
var(--tw-ring-shadow, 0 0 #0000),
|
|
413
396
|
var(--tw-shadow);
|
|
414
397
|
}
|
|
415
|
-
.shadow-lg {
|
|
416
|
-
--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
417
|
-
--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);
|
|
418
|
-
box-shadow:
|
|
419
|
-
var(--tw-ring-offset-shadow, 0 0 #0000),
|
|
420
|
-
var(--tw-ring-shadow, 0 0 #0000),
|
|
421
|
-
var(--tw-shadow);
|
|
422
|
-
}
|
|
423
398
|
.filter {
|
|
424
399
|
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
|
|
425
400
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React$1 from 'react';
|
|
2
|
+
import { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
2
3
|
|
|
3
4
|
type ElementType = {
|
|
4
5
|
[x: string]: any;
|
|
@@ -11,7 +12,8 @@ type ElementType = {
|
|
|
11
12
|
disabled?: boolean;
|
|
12
13
|
prefix?: React.ReactNode;
|
|
13
14
|
type?: string;
|
|
14
|
-
|
|
15
|
+
size?: SizeType;
|
|
16
|
+
value?: string | number | boolean | any[] | null | undefined;
|
|
15
17
|
status?: "error" | "warning";
|
|
16
18
|
styles?: React.CSSProperties;
|
|
17
19
|
variant?: "outlined" | "borderless" | "filled";
|
|
@@ -21,6 +23,7 @@ type ElementType = {
|
|
|
21
23
|
maxLength?: number;
|
|
22
24
|
fieldNames?: any[];
|
|
23
25
|
fields?: any[];
|
|
26
|
+
schema?: any[];
|
|
24
27
|
options?: any[];
|
|
25
28
|
onChange?: (value: string | number | boolean | object | any[]) => void;
|
|
26
29
|
dropDownOptions?: any[];
|
|
@@ -38,7 +41,7 @@ type ElementType = {
|
|
|
38
41
|
primaryText?: string;
|
|
39
42
|
secondaryText?: string;
|
|
40
43
|
count?: number;
|
|
41
|
-
icon?:
|
|
44
|
+
icon?: string;
|
|
42
45
|
placement?: string;
|
|
43
46
|
profileImage?: string;
|
|
44
47
|
buttonClassName?: string;
|
|
@@ -48,6 +51,8 @@ type ElementType = {
|
|
|
48
51
|
element?: string;
|
|
49
52
|
secondTextClassName?: string;
|
|
50
53
|
iconsClassName?: string;
|
|
54
|
+
labelClassName?: string;
|
|
55
|
+
containerClassName?: string;
|
|
51
56
|
};
|
|
52
57
|
|
|
53
58
|
interface ElementExecuterProps$3 extends ElementType {
|
|
@@ -104,4 +109,6 @@ declare const TableElement: (props: ElementType) => React$1.JSX.Element;
|
|
|
104
109
|
|
|
105
110
|
declare const DatePickerElement: (props: ElementType) => React$1.JSX.Element;
|
|
106
111
|
|
|
107
|
-
|
|
112
|
+
declare const DateRangePickerElement: (props: ElementType) => React$1.JSX.Element;
|
|
113
|
+
|
|
114
|
+
export { AddMoreTable, ButtonElement, CheckboxElement, CkEditor, DatePickerElement, DateRangePickerElement, MultipleSelectElement, Navbar, NumberElement, PasswordElement, RadioElement, SelectElement, Sidebar, SingleSelectElement, TableElement, TextElement, TextareaElement };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React$1 from 'react';
|
|
2
|
+
import { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
2
3
|
|
|
3
4
|
type ElementType = {
|
|
4
5
|
[x: string]: any;
|
|
@@ -11,7 +12,8 @@ type ElementType = {
|
|
|
11
12
|
disabled?: boolean;
|
|
12
13
|
prefix?: React.ReactNode;
|
|
13
14
|
type?: string;
|
|
14
|
-
|
|
15
|
+
size?: SizeType;
|
|
16
|
+
value?: string | number | boolean | any[] | null | undefined;
|
|
15
17
|
status?: "error" | "warning";
|
|
16
18
|
styles?: React.CSSProperties;
|
|
17
19
|
variant?: "outlined" | "borderless" | "filled";
|
|
@@ -21,6 +23,7 @@ type ElementType = {
|
|
|
21
23
|
maxLength?: number;
|
|
22
24
|
fieldNames?: any[];
|
|
23
25
|
fields?: any[];
|
|
26
|
+
schema?: any[];
|
|
24
27
|
options?: any[];
|
|
25
28
|
onChange?: (value: string | number | boolean | object | any[]) => void;
|
|
26
29
|
dropDownOptions?: any[];
|
|
@@ -38,7 +41,7 @@ type ElementType = {
|
|
|
38
41
|
primaryText?: string;
|
|
39
42
|
secondaryText?: string;
|
|
40
43
|
count?: number;
|
|
41
|
-
icon?:
|
|
44
|
+
icon?: string;
|
|
42
45
|
placement?: string;
|
|
43
46
|
profileImage?: string;
|
|
44
47
|
buttonClassName?: string;
|
|
@@ -48,6 +51,8 @@ type ElementType = {
|
|
|
48
51
|
element?: string;
|
|
49
52
|
secondTextClassName?: string;
|
|
50
53
|
iconsClassName?: string;
|
|
54
|
+
labelClassName?: string;
|
|
55
|
+
containerClassName?: string;
|
|
51
56
|
};
|
|
52
57
|
|
|
53
58
|
interface ElementExecuterProps$3 extends ElementType {
|
|
@@ -104,4 +109,6 @@ declare const TableElement: (props: ElementType) => React$1.JSX.Element;
|
|
|
104
109
|
|
|
105
110
|
declare const DatePickerElement: (props: ElementType) => React$1.JSX.Element;
|
|
106
111
|
|
|
107
|
-
|
|
112
|
+
declare const DateRangePickerElement: (props: ElementType) => React$1.JSX.Element;
|
|
113
|
+
|
|
114
|
+
export { AddMoreTable, ButtonElement, CheckboxElement, CkEditor, DatePickerElement, DateRangePickerElement, MultipleSelectElement, Navbar, NumberElement, PasswordElement, RadioElement, SelectElement, Sidebar, SingleSelectElement, TableElement, TextElement, TextareaElement };
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,7 @@ __export(src_exports, {
|
|
|
35
35
|
CheckboxElement: () => CheckboxElement,
|
|
36
36
|
CkEditor: () => CkEditor,
|
|
37
37
|
DatePickerElement: () => DatePickerElement,
|
|
38
|
+
DateRangePickerElement: () => DateRangePickerElement,
|
|
38
39
|
MultipleSelectElement: () => MultipleSelectElement,
|
|
39
40
|
Navbar: () => Navbar,
|
|
40
41
|
NumberElement: () => NumberElement,
|
|
@@ -53,7 +54,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
53
54
|
var import_react = __toESM(require("react"));
|
|
54
55
|
var import_antd = require("antd");
|
|
55
56
|
var TextElement = (props) => {
|
|
56
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("label", { htmlFor: props.name }, props.label), /* @__PURE__ */ import_react.default.createElement(
|
|
57
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, props.label && /* @__PURE__ */ import_react.default.createElement("label", { htmlFor: props.name }, props.label), /* @__PURE__ */ import_react.default.createElement(
|
|
57
58
|
import_antd.Input,
|
|
58
59
|
{
|
|
59
60
|
placeholder: props.placeholder,
|
|
@@ -189,7 +190,6 @@ var SelectElement = (props) => {
|
|
|
189
190
|
// src/Components/RadioElement.tsx
|
|
190
191
|
var import_react6 = __toESM(require("react"));
|
|
191
192
|
var import_antd6 = require("antd");
|
|
192
|
-
var containerClassName = " ";
|
|
193
193
|
var radioDefaultStyle = "bg-[#F2F2F2] border border-[#919191] rounded-[8px] m-[10px] hover:bg-[#F2F2F2] text-center text-black shadow-[0px_0px_1px_1px_#919191]";
|
|
194
194
|
var radioSelectedDefaultStyle = "bg-[#E2D6F8] border border-[#B8A4DE] rounded-[8px] p-[6px] m-[10px] shadow-[0px_0px_1px_1px_#B8A4DE] text-center text-black shadow-[0px_0px_1px_1px_#919191]";
|
|
195
195
|
var RadioElement = (props) => {
|
|
@@ -208,14 +208,14 @@ var RadioElement = (props) => {
|
|
|
208
208
|
}
|
|
209
209
|
};
|
|
210
210
|
const getButtonStyle = (option) => {
|
|
211
|
-
return selectedValue === option.value ? `${radioSelectedDefaultStyle} ${
|
|
211
|
+
return selectedValue === option.value ? `${radioSelectedDefaultStyle} ${props.activeClassName}` : `${radioDefaultStyle} ${props.className}`;
|
|
212
212
|
};
|
|
213
|
-
return /* @__PURE__ */ import_react6.default.createElement("div", { className: containerClassName }, /* @__PURE__ */ import_react6.default.createElement("p",
|
|
213
|
+
return /* @__PURE__ */ import_react6.default.createElement("div", { className: props.containerClassName }, props.label && /* @__PURE__ */ import_react6.default.createElement("p", { className: props.labelClassName }, props.label), /* @__PURE__ */ import_react6.default.createElement(
|
|
214
214
|
import_antd6.Radio.Group,
|
|
215
215
|
{
|
|
216
216
|
onChange: handleChange,
|
|
217
217
|
optionType,
|
|
218
|
-
className: props.
|
|
218
|
+
className: props.radioGroupClassName,
|
|
219
219
|
value: selectedValue
|
|
220
220
|
},
|
|
221
221
|
props.options && props.options.map((option) => /* @__PURE__ */ import_react6.default.createElement(
|
|
@@ -388,25 +388,24 @@ var MultipleSelectElement = (props) => {
|
|
|
388
388
|
|
|
389
389
|
// src/Components/Button.tsx
|
|
390
390
|
var import_react12 = __toESM(require("react"));
|
|
391
|
-
var import_antd10 = require("antd");
|
|
392
|
-
var defaultClassName = "w-[126px] h-[40px] bg-purple-800 text-white rounded-full shadow-lg submit border-none";
|
|
393
391
|
var ButtonElement = (props) => {
|
|
394
392
|
const handleClick = typeof props.action === "string" ? () => {
|
|
395
393
|
console.log("Performing action:", props.action);
|
|
396
394
|
} : props.action;
|
|
397
395
|
return /* @__PURE__ */ import_react12.default.createElement(
|
|
398
|
-
|
|
396
|
+
"button",
|
|
399
397
|
{
|
|
400
398
|
onClick: handleClick,
|
|
401
|
-
className: `${
|
|
399
|
+
className: `${props.className ? props.className : ""}`
|
|
402
400
|
},
|
|
401
|
+
props.icon && /* @__PURE__ */ import_react12.default.createElement("img", { src: props.icon }),
|
|
403
402
|
props.label
|
|
404
403
|
);
|
|
405
404
|
};
|
|
406
405
|
|
|
407
406
|
// src/Components/AddMoreTable.tsx
|
|
408
407
|
var import_react13 = __toESM(require("react"));
|
|
409
|
-
var
|
|
408
|
+
var import_antd10 = require("antd");
|
|
410
409
|
var import_icons2 = require("@ant-design/icons");
|
|
411
410
|
var AddMoreTable = (props) => {
|
|
412
411
|
const { thead, tbody } = props;
|
|
@@ -501,13 +500,13 @@ var AddMoreTable = (props) => {
|
|
|
501
500
|
eachRow.variable_data.forEach((variable, subIndex) => {
|
|
502
501
|
Object.keys(variable).forEach((key) => {
|
|
503
502
|
if (key === "SubRows") {
|
|
504
|
-
rowData[`${key}`] = /* @__PURE__ */ import_react13.default.createElement("div", { key: subIndex }, eachRow.variable_data.length > 1 && /* @__PURE__ */ import_react13.default.createElement(
|
|
503
|
+
rowData[`${key}`] = /* @__PURE__ */ import_react13.default.createElement("div", { key: subIndex }, eachRow.variable_data.length > 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd10.Button, { onClick: () => onHandleSubRowsDelete(rowIndex, subIndex) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.DeleteOutlined, null)), subIndex === eachRow.variable_data.length - 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd10.Button, { onClick: () => onHandleSubRowsAdd(rowIndex) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)));
|
|
505
504
|
} else {
|
|
506
505
|
rowData[`${key}`] = renderInputElement(variable[key]);
|
|
507
506
|
}
|
|
508
507
|
});
|
|
509
508
|
});
|
|
510
|
-
rowData.actions = /* @__PURE__ */ import_react13.default.createElement("div", null, /* @__PURE__ */ import_react13.default.createElement(
|
|
509
|
+
rowData.actions = /* @__PURE__ */ import_react13.default.createElement("div", null, /* @__PURE__ */ import_react13.default.createElement(import_antd10.Button, { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.DeleteOutlined, null)), rowIndex === rows.length - 1 && /* @__PURE__ */ import_react13.default.createElement(import_antd10.Button, { onClick: onHandleRows }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)));
|
|
511
510
|
console.log("=====rowdata", rowData);
|
|
512
511
|
return rowData;
|
|
513
512
|
});
|
|
@@ -524,7 +523,7 @@ var AddMoreTable = (props) => {
|
|
|
524
523
|
});
|
|
525
524
|
}
|
|
526
525
|
return /* @__PURE__ */ import_react13.default.createElement(
|
|
527
|
-
|
|
526
|
+
import_antd10.Table,
|
|
528
527
|
{
|
|
529
528
|
columns,
|
|
530
529
|
dataSource,
|
|
@@ -545,7 +544,7 @@ var Sidebar = (props) => {
|
|
|
545
544
|
return /* @__PURE__ */ import_react14.default.createElement("div", { className: props.className, key: props.name }, /* @__PURE__ */ import_react14.default.createElement("div", null, /* @__PURE__ */ import_react14.default.createElement("img", { src: props.img, alt: "logo" })), /* @__PURE__ */ import_react14.default.createElement("ul", { className: props.listClassName }, props.items?.map((item) => {
|
|
546
545
|
return /* @__PURE__ */ import_react14.default.createElement("li", { onClick: () => {
|
|
547
546
|
handleChange(item);
|
|
548
|
-
}, key: item.label, className: `${props.listItemClassName} ${item.active && props.activeClassName}` }, /* @__PURE__ */ import_react14.default.createElement("
|
|
547
|
+
}, key: item.label, className: `${props.listItemClassName} ${item.active && props.activeClassName}` }, /* @__PURE__ */ import_react14.default.createElement("img", { src: item.icon, className: props.className }), /* @__PURE__ */ import_react14.default.createElement("p", null, item.label));
|
|
549
548
|
})));
|
|
550
549
|
};
|
|
551
550
|
|
|
@@ -554,25 +553,25 @@ var import_react18 = __toESM(require("react"));
|
|
|
554
553
|
|
|
555
554
|
// src/Components/Notification.tsx
|
|
556
555
|
var import_react15 = __toESM(require("react"));
|
|
557
|
-
var
|
|
556
|
+
var import_antd11 = require("antd");
|
|
558
557
|
var import_io = require("react-icons/io");
|
|
559
558
|
var popoverContentStyle = {
|
|
560
559
|
minWidth: "300px",
|
|
561
560
|
maxWidth: "100%"
|
|
562
561
|
};
|
|
563
562
|
var Notification = (props) => /* @__PURE__ */ import_react15.default.createElement(
|
|
564
|
-
|
|
563
|
+
import_antd11.Popover,
|
|
565
564
|
{
|
|
566
565
|
className: props.className,
|
|
567
566
|
content: /* @__PURE__ */ import_react15.default.createElement("div", { style: popoverContentStyle }, " ", /* @__PURE__ */ import_react15.default.createElement(
|
|
568
|
-
|
|
567
|
+
import_antd11.List,
|
|
569
568
|
{
|
|
570
569
|
itemLayout: "horizontal",
|
|
571
570
|
dataSource: props.items,
|
|
572
|
-
renderItem: (item, index) => /* @__PURE__ */ import_react15.default.createElement(
|
|
573
|
-
|
|
571
|
+
renderItem: (item, index) => /* @__PURE__ */ import_react15.default.createElement(import_antd11.List.Item, { key: item.text }, /* @__PURE__ */ import_react15.default.createElement(
|
|
572
|
+
import_antd11.List.Item.Meta,
|
|
574
573
|
{
|
|
575
|
-
avatar: /* @__PURE__ */ import_react15.default.createElement(
|
|
574
|
+
avatar: /* @__PURE__ */ import_react15.default.createElement(import_antd11.Avatar, { src: `https://api.dicebear.com/7.x/miniavs/svg?seed=${index}` }),
|
|
576
575
|
title: item.text,
|
|
577
576
|
description: item.time
|
|
578
577
|
}
|
|
@@ -582,7 +581,7 @@ var Notification = (props) => /* @__PURE__ */ import_react15.default.createEleme
|
|
|
582
581
|
trigger: "focus",
|
|
583
582
|
placement: "bottomRight"
|
|
584
583
|
},
|
|
585
|
-
/* @__PURE__ */ import_react15.default.createElement(
|
|
584
|
+
/* @__PURE__ */ import_react15.default.createElement(import_antd11.Button, { className: props.buttonClassName }, /* @__PURE__ */ import_react15.default.createElement(import_antd11.Badge, { size: "small", count: props.count }, /* @__PURE__ */ import_react15.default.createElement("span", { className: props.iconsClassName }, /* @__PURE__ */ import_react15.default.createElement(import_io.IoIosNotifications, null))))
|
|
586
585
|
);
|
|
587
586
|
|
|
588
587
|
// src/Components/SpanElement.tsx
|
|
@@ -591,9 +590,9 @@ var SpanElement = (props) => /* @__PURE__ */ import_react16.default.createElemen
|
|
|
591
590
|
|
|
592
591
|
// src/Components/Profile.tsx
|
|
593
592
|
var import_react17 = __toESM(require("react"));
|
|
594
|
-
var
|
|
593
|
+
var import_antd12 = require("antd");
|
|
595
594
|
var import_icons3 = require("@ant-design/icons");
|
|
596
|
-
var Profile = (props) => /* @__PURE__ */ import_react17.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react17.default.createElement(
|
|
595
|
+
var Profile = (props) => /* @__PURE__ */ import_react17.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react17.default.createElement(import_antd12.Avatar, { style: { backgroundColor: "#87d068", marginRight: "10px" }, icon: /* @__PURE__ */ import_react17.default.createElement(import_icons3.UserOutlined, null) }), /* @__PURE__ */ import_react17.default.createElement("div", { className: props.profileSubClassName }, /* @__PURE__ */ import_react17.default.createElement("p", null, props.primaryText), /* @__PURE__ */ import_react17.default.createElement("p", { className: props.secondTextClassName }, " ", props.secondaryText)));
|
|
597
596
|
|
|
598
597
|
// src/Components/Navbar.tsx
|
|
599
598
|
var Navbar = (props) => {
|
|
@@ -610,31 +609,198 @@ var Navbar = (props) => {
|
|
|
610
609
|
};
|
|
611
610
|
|
|
612
611
|
// src/Components/TableElement.tsx
|
|
613
|
-
var
|
|
612
|
+
var import_react21 = __toESM(require("react"));
|
|
614
613
|
var import_antd14 = require("antd");
|
|
614
|
+
|
|
615
|
+
// src/Components/Model.tsx
|
|
616
|
+
var import_react20 = __toESM(require("react"));
|
|
617
|
+
var import_antd13 = require("antd");
|
|
618
|
+
|
|
619
|
+
// src/Components/ModelBody.tsx
|
|
620
|
+
var import_react19 = __toESM(require("react"));
|
|
621
|
+
var ModelBody = (props) => {
|
|
622
|
+
return /* @__PURE__ */ import_react19.default.createElement("div", { className: props.modalContent && props.modalContent.className }, props.modalContent && props.modalContent.fields.map((eachField) => {
|
|
623
|
+
if (eachField.element === "div") {
|
|
624
|
+
return /* @__PURE__ */ import_react19.default.createElement("div", { className: eachField.className }, eachField.label);
|
|
625
|
+
} else if (eachField.element === "input-radio") {
|
|
626
|
+
return /* @__PURE__ */ import_react19.default.createElement("div", { className: eachField.className }, /* @__PURE__ */ import_react19.default.createElement(RadioElement, { ...eachField }));
|
|
627
|
+
} else if (eachField.element === "button") {
|
|
628
|
+
return /* @__PURE__ */ import_react19.default.createElement("div", { className: eachField.className }, /* @__PURE__ */ import_react19.default.createElement(ButtonElement, { ...eachField }));
|
|
629
|
+
} else {
|
|
630
|
+
return null;
|
|
631
|
+
}
|
|
632
|
+
}));
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
// src/Components/Model.tsx
|
|
636
|
+
var ModelElement = (props) => {
|
|
637
|
+
const { model, onCancel, selectedRecord, columns } = props;
|
|
638
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
639
|
+
import_antd13.Modal,
|
|
640
|
+
{
|
|
641
|
+
centered: true,
|
|
642
|
+
open: model,
|
|
643
|
+
onCancel,
|
|
644
|
+
footer: null,
|
|
645
|
+
width: 850,
|
|
646
|
+
title: /* @__PURE__ */ import_react20.default.createElement(
|
|
647
|
+
"div",
|
|
648
|
+
{
|
|
649
|
+
style: {
|
|
650
|
+
display: "flex",
|
|
651
|
+
flexWrap: "wrap",
|
|
652
|
+
padding: "20px",
|
|
653
|
+
width: "full",
|
|
654
|
+
margin: "-10px"
|
|
655
|
+
}
|
|
656
|
+
},
|
|
657
|
+
Object.entries(selectedRecord).map(([key, value]) => {
|
|
658
|
+
const record = columns.filter((eachColumn) => eachColumn.key === key);
|
|
659
|
+
return record.length > 0 ? /* @__PURE__ */ import_react20.default.createElement("p", { style: { fontWeight: "500", padding: "10px" }, key }, /* @__PURE__ */ import_react20.default.createElement("span", { style: { fontWeight: "200", color: "gray", paddingRight: "10px" } }, record[0].title), String(value)) : "";
|
|
660
|
+
})
|
|
661
|
+
)
|
|
662
|
+
},
|
|
663
|
+
/* @__PURE__ */ import_react20.default.createElement(ModelBody, { ...props })
|
|
664
|
+
);
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
// src/Components/TableElement.tsx
|
|
615
668
|
var TableElement = (props) => {
|
|
616
669
|
const { thead, tbody } = props;
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
const
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
670
|
+
const [selectedRecord, setSelectedRecord] = (0, import_react21.useState)({});
|
|
671
|
+
const [model, setModel] = (0, import_react21.useState)(false);
|
|
672
|
+
const handleChange = (record) => {
|
|
673
|
+
if (props.onChange) {
|
|
674
|
+
props.onChange(record);
|
|
675
|
+
}
|
|
676
|
+
};
|
|
677
|
+
let columns = [];
|
|
678
|
+
if (thead) {
|
|
679
|
+
columns = [
|
|
680
|
+
{
|
|
681
|
+
title: "#",
|
|
682
|
+
dataIndex: "#",
|
|
683
|
+
key: "#"
|
|
684
|
+
},
|
|
685
|
+
...thead.map((col, ind) => ({
|
|
686
|
+
title: col.label,
|
|
687
|
+
dataIndex: col.name,
|
|
688
|
+
key: col.key,
|
|
689
|
+
sorter: {
|
|
690
|
+
compare: (a, b) => {
|
|
691
|
+
if (typeof a[col.key] === "number" && typeof a[col.key] === "number") {
|
|
692
|
+
return a[col.key] - b[col.key];
|
|
693
|
+
} else if (typeof a[col.key] === "string" && typeof a[col.key] === "string") {
|
|
694
|
+
return a[col.key].localeCompare(b[col.key]);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}))
|
|
699
|
+
];
|
|
700
|
+
}
|
|
701
|
+
const dataSource = tbody && tbody.map((row, index) => ({
|
|
702
|
+
...row,
|
|
703
|
+
[columns[0].key]: index + 1
|
|
623
704
|
}));
|
|
624
|
-
|
|
705
|
+
const count = dataSource ? dataSource.length : 0;
|
|
706
|
+
return /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, /* @__PURE__ */ import_react21.default.createElement(
|
|
707
|
+
import_antd14.Table,
|
|
708
|
+
{
|
|
709
|
+
pagination: {
|
|
710
|
+
showTotal: (total) => `Total: ${total} items`,
|
|
711
|
+
total: count,
|
|
712
|
+
showSizeChanger: count > 10
|
|
713
|
+
},
|
|
714
|
+
dataSource,
|
|
715
|
+
columns,
|
|
716
|
+
bordered: true,
|
|
717
|
+
size: props.size && props.size,
|
|
718
|
+
onRow: (record) => {
|
|
719
|
+
return {
|
|
720
|
+
onClick: () => {
|
|
721
|
+
setSelectedRecord(record);
|
|
722
|
+
handleChange(record);
|
|
723
|
+
setModel(true);
|
|
724
|
+
},
|
|
725
|
+
style: { cursor: "pointer" }
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
), model && /* @__PURE__ */ import_react21.default.createElement(ModelElement, { selectedRecord, ...props, columns, model, onCancel: () => setModel(false) }));
|
|
625
730
|
};
|
|
626
731
|
|
|
627
732
|
// src/Components/DatePicker.tsx
|
|
628
|
-
var
|
|
733
|
+
var import_react22 = __toESM(require("react"));
|
|
629
734
|
var import_antd15 = require("antd");
|
|
630
735
|
var import_icons4 = require("@ant-design/icons");
|
|
736
|
+
var import_moment = __toESM(require("moment"));
|
|
631
737
|
var DatePickerElement = (props) => {
|
|
632
|
-
const
|
|
738
|
+
const [date, setDate] = (0, import_react22.useState)(null);
|
|
739
|
+
const handleChange = (date2, dateString) => {
|
|
740
|
+
console.log("date---------", date2);
|
|
741
|
+
console.log("datestring", dateString);
|
|
742
|
+
if (date2) {
|
|
743
|
+
const formattedDate = dateString;
|
|
744
|
+
console.log("formattedDate-----------------", formattedDate);
|
|
745
|
+
setDate(date2);
|
|
746
|
+
console.log("changedDate------------", date2);
|
|
747
|
+
if (props.onChange) {
|
|
748
|
+
props.onChange(formattedDate);
|
|
749
|
+
}
|
|
750
|
+
} else {
|
|
751
|
+
setDate(null);
|
|
752
|
+
if (props.onChange) {
|
|
753
|
+
props.onChange("");
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
};
|
|
757
|
+
const onHandleDecrement = () => {
|
|
758
|
+
const currentDate = date || (0, import_moment.default)();
|
|
759
|
+
const newDate = (0, import_moment.default)(currentDate).subtract(1, "days");
|
|
760
|
+
setDate(newDate);
|
|
633
761
|
if (props.onChange) {
|
|
634
|
-
props.onChange(
|
|
762
|
+
props.onChange(newDate.format("lll"));
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
const onHandleIncrement = () => {
|
|
766
|
+
const currentDate = date || (0, import_moment.default)();
|
|
767
|
+
const newDate = (0, import_moment.default)(currentDate).add(1, "days");
|
|
768
|
+
setDate(newDate);
|
|
769
|
+
if (props.onChange) {
|
|
770
|
+
props.onChange(newDate.format("lll"));
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", null, /* @__PURE__ */ import_react22.default.createElement("button", { onClick: onHandleDecrement }, /* @__PURE__ */ import_react22.default.createElement(import_icons4.LeftOutlined, null)), /* @__PURE__ */ import_react22.default.createElement(
|
|
774
|
+
import_antd15.DatePicker,
|
|
775
|
+
{
|
|
776
|
+
placeholder: props.placeholder,
|
|
777
|
+
value: date,
|
|
778
|
+
variant: "borderless",
|
|
779
|
+
onChange: handleChange
|
|
780
|
+
}
|
|
781
|
+
), /* @__PURE__ */ import_react22.default.createElement("button", { onClick: onHandleIncrement }, /* @__PURE__ */ import_react22.default.createElement(import_icons4.RightOutlined, null)));
|
|
782
|
+
};
|
|
783
|
+
|
|
784
|
+
// src/Components/DateRangePickerElement.tsx
|
|
785
|
+
var import_react23 = __toESM(require("react"));
|
|
786
|
+
var import_antd16 = require("antd");
|
|
787
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
788
|
+
var DateRangePickerElement = (props) => {
|
|
789
|
+
const { RangePicker } = import_antd16.DatePicker;
|
|
790
|
+
const handleChange = (dates, dateStrings) => {
|
|
791
|
+
if (dates && props.onChange) {
|
|
792
|
+
props.onChange(dateStrings);
|
|
793
|
+
} else {
|
|
794
|
+
console.log("Clear");
|
|
635
795
|
}
|
|
636
796
|
};
|
|
637
|
-
|
|
797
|
+
const rangePresets = [
|
|
798
|
+
{ label: "Last 7 Days", value: [(0, import_dayjs.default)().add(-7, "d"), (0, import_dayjs.default)()] },
|
|
799
|
+
{ label: "Last 14 Days", value: [(0, import_dayjs.default)().add(-14, "d"), (0, import_dayjs.default)()] },
|
|
800
|
+
{ label: "Last 30 Days", value: [(0, import_dayjs.default)().add(-30, "d"), (0, import_dayjs.default)()] },
|
|
801
|
+
{ label: "Last 90 Days", value: [(0, import_dayjs.default)().add(-90, "d"), (0, import_dayjs.default)()] }
|
|
802
|
+
];
|
|
803
|
+
return /* @__PURE__ */ import_react23.default.createElement(import_antd16.Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ import_react23.default.createElement(RangePicker, { presets: rangePresets, onChange: handleChange }));
|
|
638
804
|
};
|
|
639
805
|
// Annotate the CommonJS export names for ESM import in node:
|
|
640
806
|
0 && (module.exports = {
|
|
@@ -643,6 +809,7 @@ var DatePickerElement = (props) => {
|
|
|
643
809
|
CheckboxElement,
|
|
644
810
|
CkEditor,
|
|
645
811
|
DatePickerElement,
|
|
812
|
+
DateRangePickerElement,
|
|
646
813
|
MultipleSelectElement,
|
|
647
814
|
Navbar,
|
|
648
815
|
NumberElement,
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Input as AntInput } from "antd";
|
|
4
4
|
var TextElement = (props) => {
|
|
5
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("label", { htmlFor: props.name }, props.label), /* @__PURE__ */ React.createElement(
|
|
5
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, props.label && /* @__PURE__ */ React.createElement("label", { htmlFor: props.name }, props.label), /* @__PURE__ */ React.createElement(
|
|
6
6
|
AntInput,
|
|
7
7
|
{
|
|
8
8
|
placeholder: props.placeholder,
|
|
@@ -138,7 +138,6 @@ var SelectElement = (props) => {
|
|
|
138
138
|
// src/Components/RadioElement.tsx
|
|
139
139
|
import React6, { useState as useState2 } from "react";
|
|
140
140
|
import { Radio } from "antd";
|
|
141
|
-
var containerClassName = " ";
|
|
142
141
|
var radioDefaultStyle = "bg-[#F2F2F2] border border-[#919191] rounded-[8px] m-[10px] hover:bg-[#F2F2F2] text-center text-black shadow-[0px_0px_1px_1px_#919191]";
|
|
143
142
|
var radioSelectedDefaultStyle = "bg-[#E2D6F8] border border-[#B8A4DE] rounded-[8px] p-[6px] m-[10px] shadow-[0px_0px_1px_1px_#B8A4DE] text-center text-black shadow-[0px_0px_1px_1px_#919191]";
|
|
144
143
|
var RadioElement = (props) => {
|
|
@@ -157,14 +156,14 @@ var RadioElement = (props) => {
|
|
|
157
156
|
}
|
|
158
157
|
};
|
|
159
158
|
const getButtonStyle = (option) => {
|
|
160
|
-
return selectedValue === option.value ? `${radioSelectedDefaultStyle} ${
|
|
159
|
+
return selectedValue === option.value ? `${radioSelectedDefaultStyle} ${props.activeClassName}` : `${radioDefaultStyle} ${props.className}`;
|
|
161
160
|
};
|
|
162
|
-
return /* @__PURE__ */ React6.createElement("div", { className: containerClassName }, /* @__PURE__ */ React6.createElement("p",
|
|
161
|
+
return /* @__PURE__ */ React6.createElement("div", { className: props.containerClassName }, props.label && /* @__PURE__ */ React6.createElement("p", { className: props.labelClassName }, props.label), /* @__PURE__ */ React6.createElement(
|
|
163
162
|
Radio.Group,
|
|
164
163
|
{
|
|
165
164
|
onChange: handleChange,
|
|
166
165
|
optionType,
|
|
167
|
-
className: props.
|
|
166
|
+
className: props.radioGroupClassName,
|
|
168
167
|
value: selectedValue
|
|
169
168
|
},
|
|
170
169
|
props.options && props.options.map((option) => /* @__PURE__ */ React6.createElement(
|
|
@@ -337,25 +336,24 @@ var MultipleSelectElement = (props) => {
|
|
|
337
336
|
|
|
338
337
|
// src/Components/Button.tsx
|
|
339
338
|
import React11 from "react";
|
|
340
|
-
import { Button as Button2 } from "antd";
|
|
341
|
-
var defaultClassName = "w-[126px] h-[40px] bg-purple-800 text-white rounded-full shadow-lg submit border-none";
|
|
342
339
|
var ButtonElement = (props) => {
|
|
343
340
|
const handleClick = typeof props.action === "string" ? () => {
|
|
344
341
|
console.log("Performing action:", props.action);
|
|
345
342
|
} : props.action;
|
|
346
343
|
return /* @__PURE__ */ React11.createElement(
|
|
347
|
-
|
|
344
|
+
"button",
|
|
348
345
|
{
|
|
349
346
|
onClick: handleClick,
|
|
350
|
-
className: `${
|
|
347
|
+
className: `${props.className ? props.className : ""}`
|
|
351
348
|
},
|
|
349
|
+
props.icon && /* @__PURE__ */ React11.createElement("img", { src: props.icon }),
|
|
352
350
|
props.label
|
|
353
351
|
);
|
|
354
352
|
};
|
|
355
353
|
|
|
356
354
|
// src/Components/AddMoreTable.tsx
|
|
357
355
|
import React12, { useEffect, useState as useState4 } from "react";
|
|
358
|
-
import { Table, Button as
|
|
356
|
+
import { Table, Button as Button2 } from "antd";
|
|
359
357
|
import { PlusOutlined, DeleteOutlined } from "@ant-design/icons";
|
|
360
358
|
var AddMoreTable = (props) => {
|
|
361
359
|
const { thead, tbody } = props;
|
|
@@ -450,13 +448,13 @@ var AddMoreTable = (props) => {
|
|
|
450
448
|
eachRow.variable_data.forEach((variable, subIndex) => {
|
|
451
449
|
Object.keys(variable).forEach((key) => {
|
|
452
450
|
if (key === "SubRows") {
|
|
453
|
-
rowData[`${key}`] = /* @__PURE__ */ React12.createElement("div", { key: subIndex }, eachRow.variable_data.length > 1 && /* @__PURE__ */ React12.createElement(
|
|
451
|
+
rowData[`${key}`] = /* @__PURE__ */ React12.createElement("div", { key: subIndex }, eachRow.variable_data.length > 1 && /* @__PURE__ */ React12.createElement(Button2, { onClick: () => onHandleSubRowsDelete(rowIndex, subIndex) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), subIndex === eachRow.variable_data.length - 1 && /* @__PURE__ */ React12.createElement(Button2, { onClick: () => onHandleSubRowsAdd(rowIndex) }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)));
|
|
454
452
|
} else {
|
|
455
453
|
rowData[`${key}`] = renderInputElement(variable[key]);
|
|
456
454
|
}
|
|
457
455
|
});
|
|
458
456
|
});
|
|
459
|
-
rowData.actions = /* @__PURE__ */ React12.createElement("div", null, /* @__PURE__ */ React12.createElement(
|
|
457
|
+
rowData.actions = /* @__PURE__ */ React12.createElement("div", null, /* @__PURE__ */ React12.createElement(Button2, { onClick: () => onHandleDelete(eachRow.id) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), rowIndex === rows.length - 1 && /* @__PURE__ */ React12.createElement(Button2, { onClick: onHandleRows }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)));
|
|
460
458
|
console.log("=====rowdata", rowData);
|
|
461
459
|
return rowData;
|
|
462
460
|
});
|
|
@@ -494,7 +492,7 @@ var Sidebar = (props) => {
|
|
|
494
492
|
return /* @__PURE__ */ React13.createElement("div", { className: props.className, key: props.name }, /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("img", { src: props.img, alt: "logo" })), /* @__PURE__ */ React13.createElement("ul", { className: props.listClassName }, props.items?.map((item) => {
|
|
495
493
|
return /* @__PURE__ */ React13.createElement("li", { onClick: () => {
|
|
496
494
|
handleChange(item);
|
|
497
|
-
}, key: item.label, className: `${props.listItemClassName} ${item.active && props.activeClassName}` }, /* @__PURE__ */ React13.createElement("
|
|
495
|
+
}, key: item.label, className: `${props.listItemClassName} ${item.active && props.activeClassName}` }, /* @__PURE__ */ React13.createElement("img", { src: item.icon, className: props.className }), /* @__PURE__ */ React13.createElement("p", null, item.label));
|
|
498
496
|
})));
|
|
499
497
|
};
|
|
500
498
|
|
|
@@ -503,7 +501,7 @@ import React17 from "react";
|
|
|
503
501
|
|
|
504
502
|
// src/Components/Notification.tsx
|
|
505
503
|
import React14 from "react";
|
|
506
|
-
import { Popover, Badge, Button as
|
|
504
|
+
import { Popover, Badge, Button as Button3, Avatar, List } from "antd";
|
|
507
505
|
import { IoIosNotifications } from "react-icons/io";
|
|
508
506
|
var popoverContentStyle = {
|
|
509
507
|
minWidth: "300px",
|
|
@@ -531,7 +529,7 @@ var Notification = (props) => /* @__PURE__ */ React14.createElement(
|
|
|
531
529
|
trigger: "focus",
|
|
532
530
|
placement: "bottomRight"
|
|
533
531
|
},
|
|
534
|
-
/* @__PURE__ */ React14.createElement(
|
|
532
|
+
/* @__PURE__ */ React14.createElement(Button3, { className: props.buttonClassName }, /* @__PURE__ */ React14.createElement(Badge, { size: "small", count: props.count }, /* @__PURE__ */ React14.createElement("span", { className: props.iconsClassName }, /* @__PURE__ */ React14.createElement(IoIosNotifications, null))))
|
|
535
533
|
);
|
|
536
534
|
|
|
537
535
|
// src/Components/SpanElement.tsx
|
|
@@ -559,31 +557,198 @@ var Navbar = (props) => {
|
|
|
559
557
|
};
|
|
560
558
|
|
|
561
559
|
// src/Components/TableElement.tsx
|
|
562
|
-
import
|
|
560
|
+
import React20, { useState as useState5 } from "react";
|
|
563
561
|
import { Table as Table2 } from "antd";
|
|
562
|
+
|
|
563
|
+
// src/Components/Model.tsx
|
|
564
|
+
import React19 from "react";
|
|
565
|
+
import { Modal } from "antd";
|
|
566
|
+
|
|
567
|
+
// src/Components/ModelBody.tsx
|
|
568
|
+
import React18 from "react";
|
|
569
|
+
var ModelBody = (props) => {
|
|
570
|
+
return /* @__PURE__ */ React18.createElement("div", { className: props.modalContent && props.modalContent.className }, props.modalContent && props.modalContent.fields.map((eachField) => {
|
|
571
|
+
if (eachField.element === "div") {
|
|
572
|
+
return /* @__PURE__ */ React18.createElement("div", { className: eachField.className }, eachField.label);
|
|
573
|
+
} else if (eachField.element === "input-radio") {
|
|
574
|
+
return /* @__PURE__ */ React18.createElement("div", { className: eachField.className }, /* @__PURE__ */ React18.createElement(RadioElement, { ...eachField }));
|
|
575
|
+
} else if (eachField.element === "button") {
|
|
576
|
+
return /* @__PURE__ */ React18.createElement("div", { className: eachField.className }, /* @__PURE__ */ React18.createElement(ButtonElement, { ...eachField }));
|
|
577
|
+
} else {
|
|
578
|
+
return null;
|
|
579
|
+
}
|
|
580
|
+
}));
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
// src/Components/Model.tsx
|
|
584
|
+
var ModelElement = (props) => {
|
|
585
|
+
const { model, onCancel, selectedRecord, columns } = props;
|
|
586
|
+
return /* @__PURE__ */ React19.createElement(
|
|
587
|
+
Modal,
|
|
588
|
+
{
|
|
589
|
+
centered: true,
|
|
590
|
+
open: model,
|
|
591
|
+
onCancel,
|
|
592
|
+
footer: null,
|
|
593
|
+
width: 850,
|
|
594
|
+
title: /* @__PURE__ */ React19.createElement(
|
|
595
|
+
"div",
|
|
596
|
+
{
|
|
597
|
+
style: {
|
|
598
|
+
display: "flex",
|
|
599
|
+
flexWrap: "wrap",
|
|
600
|
+
padding: "20px",
|
|
601
|
+
width: "full",
|
|
602
|
+
margin: "-10px"
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
Object.entries(selectedRecord).map(([key, value]) => {
|
|
606
|
+
const record = columns.filter((eachColumn) => eachColumn.key === key);
|
|
607
|
+
return record.length > 0 ? /* @__PURE__ */ React19.createElement("p", { style: { fontWeight: "500", padding: "10px" }, key }, /* @__PURE__ */ React19.createElement("span", { style: { fontWeight: "200", color: "gray", paddingRight: "10px" } }, record[0].title), String(value)) : "";
|
|
608
|
+
})
|
|
609
|
+
)
|
|
610
|
+
},
|
|
611
|
+
/* @__PURE__ */ React19.createElement(ModelBody, { ...props })
|
|
612
|
+
);
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
// src/Components/TableElement.tsx
|
|
564
616
|
var TableElement = (props) => {
|
|
565
617
|
const { thead, tbody } = props;
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
const
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
618
|
+
const [selectedRecord, setSelectedRecord] = useState5({});
|
|
619
|
+
const [model, setModel] = useState5(false);
|
|
620
|
+
const handleChange = (record) => {
|
|
621
|
+
if (props.onChange) {
|
|
622
|
+
props.onChange(record);
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
let columns = [];
|
|
626
|
+
if (thead) {
|
|
627
|
+
columns = [
|
|
628
|
+
{
|
|
629
|
+
title: "#",
|
|
630
|
+
dataIndex: "#",
|
|
631
|
+
key: "#"
|
|
632
|
+
},
|
|
633
|
+
...thead.map((col, ind) => ({
|
|
634
|
+
title: col.label,
|
|
635
|
+
dataIndex: col.name,
|
|
636
|
+
key: col.key,
|
|
637
|
+
sorter: {
|
|
638
|
+
compare: (a, b) => {
|
|
639
|
+
if (typeof a[col.key] === "number" && typeof a[col.key] === "number") {
|
|
640
|
+
return a[col.key] - b[col.key];
|
|
641
|
+
} else if (typeof a[col.key] === "string" && typeof a[col.key] === "string") {
|
|
642
|
+
return a[col.key].localeCompare(b[col.key]);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}))
|
|
647
|
+
];
|
|
648
|
+
}
|
|
649
|
+
const dataSource = tbody && tbody.map((row, index) => ({
|
|
650
|
+
...row,
|
|
651
|
+
[columns[0].key]: index + 1
|
|
572
652
|
}));
|
|
573
|
-
|
|
653
|
+
const count = dataSource ? dataSource.length : 0;
|
|
654
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
|
|
655
|
+
Table2,
|
|
656
|
+
{
|
|
657
|
+
pagination: {
|
|
658
|
+
showTotal: (total) => `Total: ${total} items`,
|
|
659
|
+
total: count,
|
|
660
|
+
showSizeChanger: count > 10
|
|
661
|
+
},
|
|
662
|
+
dataSource,
|
|
663
|
+
columns,
|
|
664
|
+
bordered: true,
|
|
665
|
+
size: props.size && props.size,
|
|
666
|
+
onRow: (record) => {
|
|
667
|
+
return {
|
|
668
|
+
onClick: () => {
|
|
669
|
+
setSelectedRecord(record);
|
|
670
|
+
handleChange(record);
|
|
671
|
+
setModel(true);
|
|
672
|
+
},
|
|
673
|
+
style: { cursor: "pointer" }
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
), model && /* @__PURE__ */ React20.createElement(ModelElement, { selectedRecord, ...props, columns, model, onCancel: () => setModel(false) }));
|
|
574
678
|
};
|
|
575
679
|
|
|
576
680
|
// src/Components/DatePicker.tsx
|
|
577
|
-
import
|
|
681
|
+
import React21, { useState as useState6 } from "react";
|
|
578
682
|
import { DatePicker } from "antd";
|
|
579
683
|
import { LeftOutlined, RightOutlined } from "@ant-design/icons";
|
|
684
|
+
import moment from "moment";
|
|
580
685
|
var DatePickerElement = (props) => {
|
|
581
|
-
const
|
|
686
|
+
const [date, setDate] = useState6(null);
|
|
687
|
+
const handleChange = (date2, dateString) => {
|
|
688
|
+
console.log("date---------", date2);
|
|
689
|
+
console.log("datestring", dateString);
|
|
690
|
+
if (date2) {
|
|
691
|
+
const formattedDate = dateString;
|
|
692
|
+
console.log("formattedDate-----------------", formattedDate);
|
|
693
|
+
setDate(date2);
|
|
694
|
+
console.log("changedDate------------", date2);
|
|
695
|
+
if (props.onChange) {
|
|
696
|
+
props.onChange(formattedDate);
|
|
697
|
+
}
|
|
698
|
+
} else {
|
|
699
|
+
setDate(null);
|
|
700
|
+
if (props.onChange) {
|
|
701
|
+
props.onChange("");
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
const onHandleDecrement = () => {
|
|
706
|
+
const currentDate = date || moment();
|
|
707
|
+
const newDate = moment(currentDate).subtract(1, "days");
|
|
708
|
+
setDate(newDate);
|
|
582
709
|
if (props.onChange) {
|
|
583
|
-
props.onChange(
|
|
710
|
+
props.onChange(newDate.format("lll"));
|
|
711
|
+
}
|
|
712
|
+
};
|
|
713
|
+
const onHandleIncrement = () => {
|
|
714
|
+
const currentDate = date || moment();
|
|
715
|
+
const newDate = moment(currentDate).add(1, "days");
|
|
716
|
+
setDate(newDate);
|
|
717
|
+
if (props.onChange) {
|
|
718
|
+
props.onChange(newDate.format("lll"));
|
|
719
|
+
}
|
|
720
|
+
};
|
|
721
|
+
return /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("button", { onClick: onHandleDecrement }, /* @__PURE__ */ React21.createElement(LeftOutlined, null)), /* @__PURE__ */ React21.createElement(
|
|
722
|
+
DatePicker,
|
|
723
|
+
{
|
|
724
|
+
placeholder: props.placeholder,
|
|
725
|
+
value: date,
|
|
726
|
+
variant: "borderless",
|
|
727
|
+
onChange: handleChange
|
|
728
|
+
}
|
|
729
|
+
), /* @__PURE__ */ React21.createElement("button", { onClick: onHandleIncrement }, /* @__PURE__ */ React21.createElement(RightOutlined, null)));
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
// src/Components/DateRangePickerElement.tsx
|
|
733
|
+
import React22 from "react";
|
|
734
|
+
import { DatePicker as DatePicker2, Space as Space2 } from "antd";
|
|
735
|
+
import dayjs from "dayjs";
|
|
736
|
+
var DateRangePickerElement = (props) => {
|
|
737
|
+
const { RangePicker } = DatePicker2;
|
|
738
|
+
const handleChange = (dates, dateStrings) => {
|
|
739
|
+
if (dates && props.onChange) {
|
|
740
|
+
props.onChange(dateStrings);
|
|
741
|
+
} else {
|
|
742
|
+
console.log("Clear");
|
|
584
743
|
}
|
|
585
744
|
};
|
|
586
|
-
|
|
745
|
+
const rangePresets = [
|
|
746
|
+
{ label: "Last 7 Days", value: [dayjs().add(-7, "d"), dayjs()] },
|
|
747
|
+
{ label: "Last 14 Days", value: [dayjs().add(-14, "d"), dayjs()] },
|
|
748
|
+
{ label: "Last 30 Days", value: [dayjs().add(-30, "d"), dayjs()] },
|
|
749
|
+
{ label: "Last 90 Days", value: [dayjs().add(-90, "d"), dayjs()] }
|
|
750
|
+
];
|
|
751
|
+
return /* @__PURE__ */ React22.createElement(Space2, { direction: "vertical", size: 12 }, /* @__PURE__ */ React22.createElement(RangePicker, { presets: rangePresets, onChange: handleChange }));
|
|
587
752
|
};
|
|
588
753
|
export {
|
|
589
754
|
AddMoreTable,
|
|
@@ -591,6 +756,7 @@ export {
|
|
|
591
756
|
CheckboxElement,
|
|
592
757
|
CkEditor,
|
|
593
758
|
DatePickerElement,
|
|
759
|
+
DateRangePickerElement,
|
|
594
760
|
MultipleSelectElement,
|
|
595
761
|
Navbar,
|
|
596
762
|
NumberElement,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apexcura/ui-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13-Beta0",
|
|
4
4
|
"description": "Apex cura React components library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"apex cura",
|
|
@@ -48,9 +48,12 @@
|
|
|
48
48
|
"node": ">=18.0.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
+
"@apexcura/ui-components": "^0.0.11-Beta256",
|
|
51
52
|
"@tinymce/tinymce-react": "^5.0.1",
|
|
52
53
|
"autoprefixer": "^10.4.19",
|
|
54
|
+
"date-fns": "^3.6.0",
|
|
53
55
|
"esbuild": "^0.21.4",
|
|
56
|
+
"moment": "^2.30.1",
|
|
54
57
|
"postcss": "^8.4.38",
|
|
55
58
|
"postcss-import": "^16.1.0",
|
|
56
59
|
"react-icons": "^5.2.1",
|