@apexcura/ui-components 0.0.13-Beta17 → 0.0.13-Beta2
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 +6 -9
- package/dist/index.d.ts +6 -9
- package/dist/index.js +15 -36
- package/dist/index.mjs +15 -35
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -25,8 +25,7 @@ type ElementType = {
|
|
|
25
25
|
fields?: any[];
|
|
26
26
|
schema?: any[];
|
|
27
27
|
options?: any[];
|
|
28
|
-
onChange?: (value: string | number | boolean | object | any[]
|
|
29
|
-
onClick?: () => void;
|
|
28
|
+
onChange?: (value: string | number | boolean | object | any[]) => void;
|
|
30
29
|
dropDownOptions?: any[];
|
|
31
30
|
id?: number;
|
|
32
31
|
thead?: any[];
|
|
@@ -57,7 +56,7 @@ type ElementType = {
|
|
|
57
56
|
};
|
|
58
57
|
|
|
59
58
|
interface ElementExecuterProps$3 extends ElementType {
|
|
60
|
-
onChange: (value: string | number | boolean | object | any[]
|
|
59
|
+
onChange: (value: string | number | boolean | object | any[]) => void;
|
|
61
60
|
}
|
|
62
61
|
declare const TextElement: (props: ElementExecuterProps$3) => React$1.JSX.Element;
|
|
63
62
|
|
|
@@ -74,12 +73,12 @@ interface PasswordProps {
|
|
|
74
73
|
declare const PasswordElement: React$1.FC<PasswordProps>;
|
|
75
74
|
|
|
76
75
|
interface ElementExecuterProps$2 extends ElementType {
|
|
77
|
-
onChange: (value: string | number | object | boolean | any[]
|
|
76
|
+
onChange: (value: string | number | object | boolean | any[]) => void;
|
|
78
77
|
}
|
|
79
78
|
declare const NumberElement: (props: ElementExecuterProps$2) => React$1.JSX.Element;
|
|
80
79
|
|
|
81
80
|
interface ElementExecuterProps$1 extends ElementType {
|
|
82
|
-
onChange: (value: string | number | boolean | object | any[]
|
|
81
|
+
onChange: (value: string | number | boolean | object | any[]) => void;
|
|
83
82
|
}
|
|
84
83
|
declare const TextareaElement: (props: ElementExecuterProps$1) => React$1.JSX.Element;
|
|
85
84
|
|
|
@@ -90,7 +89,7 @@ declare const RadioElement: (props: ElementType) => React$1.JSX.Element;
|
|
|
90
89
|
declare const CheckboxElement: (props: ElementType) => React$1.JSX.Element;
|
|
91
90
|
|
|
92
91
|
interface ElementExecuterProps extends ElementType {
|
|
93
|
-
onChange: (value: string | number | object | boolean | any[]
|
|
92
|
+
onChange: (value: string | number | object | boolean | any[]) => void;
|
|
94
93
|
}
|
|
95
94
|
declare const CkEditor: (props: ElementExecuterProps) => React$1.JSX.Element;
|
|
96
95
|
|
|
@@ -112,6 +111,4 @@ declare const DatePickerElement: (props: ElementType) => React$1.JSX.Element;
|
|
|
112
111
|
|
|
113
112
|
declare const DateRangePickerElement: (props: ElementType) => React$1.JSX.Element;
|
|
114
113
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
export { AddMoreTable, ButtonElement, CheckboxElement, CkEditor, DatePickerElement, DateRangePickerElement, MultipleSelectElement, Navbar, NumberElement, PasswordElement, RadioElement, SelectElement, Sidebar, SingleSelectElement, TableElement, TextElement, TextareaElement, UploadElement };
|
|
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
|
@@ -25,8 +25,7 @@ type ElementType = {
|
|
|
25
25
|
fields?: any[];
|
|
26
26
|
schema?: any[];
|
|
27
27
|
options?: any[];
|
|
28
|
-
onChange?: (value: string | number | boolean | object | any[]
|
|
29
|
-
onClick?: () => void;
|
|
28
|
+
onChange?: (value: string | number | boolean | object | any[]) => void;
|
|
30
29
|
dropDownOptions?: any[];
|
|
31
30
|
id?: number;
|
|
32
31
|
thead?: any[];
|
|
@@ -57,7 +56,7 @@ type ElementType = {
|
|
|
57
56
|
};
|
|
58
57
|
|
|
59
58
|
interface ElementExecuterProps$3 extends ElementType {
|
|
60
|
-
onChange: (value: string | number | boolean | object | any[]
|
|
59
|
+
onChange: (value: string | number | boolean | object | any[]) => void;
|
|
61
60
|
}
|
|
62
61
|
declare const TextElement: (props: ElementExecuterProps$3) => React$1.JSX.Element;
|
|
63
62
|
|
|
@@ -74,12 +73,12 @@ interface PasswordProps {
|
|
|
74
73
|
declare const PasswordElement: React$1.FC<PasswordProps>;
|
|
75
74
|
|
|
76
75
|
interface ElementExecuterProps$2 extends ElementType {
|
|
77
|
-
onChange: (value: string | number | object | boolean | any[]
|
|
76
|
+
onChange: (value: string | number | object | boolean | any[]) => void;
|
|
78
77
|
}
|
|
79
78
|
declare const NumberElement: (props: ElementExecuterProps$2) => React$1.JSX.Element;
|
|
80
79
|
|
|
81
80
|
interface ElementExecuterProps$1 extends ElementType {
|
|
82
|
-
onChange: (value: string | number | boolean | object | any[]
|
|
81
|
+
onChange: (value: string | number | boolean | object | any[]) => void;
|
|
83
82
|
}
|
|
84
83
|
declare const TextareaElement: (props: ElementExecuterProps$1) => React$1.JSX.Element;
|
|
85
84
|
|
|
@@ -90,7 +89,7 @@ declare const RadioElement: (props: ElementType) => React$1.JSX.Element;
|
|
|
90
89
|
declare const CheckboxElement: (props: ElementType) => React$1.JSX.Element;
|
|
91
90
|
|
|
92
91
|
interface ElementExecuterProps extends ElementType {
|
|
93
|
-
onChange: (value: string | number | object | boolean | any[]
|
|
92
|
+
onChange: (value: string | number | object | boolean | any[]) => void;
|
|
94
93
|
}
|
|
95
94
|
declare const CkEditor: (props: ElementExecuterProps) => React$1.JSX.Element;
|
|
96
95
|
|
|
@@ -112,6 +111,4 @@ declare const DatePickerElement: (props: ElementType) => React$1.JSX.Element;
|
|
|
112
111
|
|
|
113
112
|
declare const DateRangePickerElement: (props: ElementType) => React$1.JSX.Element;
|
|
114
113
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
export { AddMoreTable, ButtonElement, CheckboxElement, CkEditor, DatePickerElement, DateRangePickerElement, MultipleSelectElement, Navbar, NumberElement, PasswordElement, RadioElement, SelectElement, Sidebar, SingleSelectElement, TableElement, TextElement, TextareaElement, UploadElement };
|
|
114
|
+
export { AddMoreTable, ButtonElement, CheckboxElement, CkEditor, DatePickerElement, DateRangePickerElement, MultipleSelectElement, Navbar, NumberElement, PasswordElement, RadioElement, SelectElement, Sidebar, SingleSelectElement, TableElement, TextElement, TextareaElement };
|
package/dist/index.js
CHANGED
|
@@ -46,8 +46,7 @@ __export(src_exports, {
|
|
|
46
46
|
SingleSelectElement: () => SingleSelectElement,
|
|
47
47
|
TableElement: () => TableElement,
|
|
48
48
|
TextElement: () => TextElement,
|
|
49
|
-
TextareaElement: () => TextareaElement
|
|
50
|
-
UploadElement: () => UploadElement
|
|
49
|
+
TextareaElement: () => TextareaElement
|
|
51
50
|
});
|
|
52
51
|
module.exports = __toCommonJS(src_exports);
|
|
53
52
|
|
|
@@ -216,6 +215,7 @@ var RadioElement = (props) => {
|
|
|
216
215
|
value: selectedValue
|
|
217
216
|
},
|
|
218
217
|
props.options && props.options.map((option) => {
|
|
218
|
+
console.log(option);
|
|
219
219
|
return /* @__PURE__ */ import_react6.default.createElement(
|
|
220
220
|
import_antd6.Radio,
|
|
221
221
|
{
|
|
@@ -238,19 +238,22 @@ var RadioElement = (props) => {
|
|
|
238
238
|
var import_react7 = __toESM(require("react"));
|
|
239
239
|
var import_antd7 = require("antd");
|
|
240
240
|
var CheckboxGroup = import_antd7.Checkbox.Group;
|
|
241
|
+
var plainOptions = ["Apple", "Pear", "Orange"];
|
|
241
242
|
var defaultCheckedList = [];
|
|
242
243
|
var CheckboxElement = (props) => {
|
|
243
244
|
const [checkedList, setCheckedList] = (0, import_react7.useState)(defaultCheckedList);
|
|
244
|
-
const checkAll =
|
|
245
|
+
const checkAll = plainOptions.length === checkedList.length;
|
|
245
246
|
const handleChange = (list) => {
|
|
246
247
|
setCheckedList(list);
|
|
247
248
|
if (props.onChange) {
|
|
248
|
-
const selectedOptions =
|
|
249
|
+
const selectedOptions = list.map((value) => {
|
|
250
|
+
return { id: list.indexOf(value), value };
|
|
251
|
+
});
|
|
249
252
|
props.onChange(selectedOptions);
|
|
250
253
|
}
|
|
251
254
|
};
|
|
252
255
|
const onHandleAllChanges = (e) => {
|
|
253
|
-
const newList = e.target.checked ?
|
|
256
|
+
const newList = e.target.checked ? plainOptions : [];
|
|
254
257
|
setCheckedList(newList);
|
|
255
258
|
if (props.onChange) {
|
|
256
259
|
props.onChange(newList);
|
|
@@ -267,13 +270,13 @@ var CheckboxElement = (props) => {
|
|
|
267
270
|
checked: checkAll
|
|
268
271
|
},
|
|
269
272
|
"Check all"
|
|
270
|
-
), /* @__PURE__ */ import_react7.default.createElement(
|
|
273
|
+
), /* @__PURE__ */ import_react7.default.createElement(import_antd7.Divider, null), /* @__PURE__ */ import_react7.default.createElement(
|
|
271
274
|
CheckboxGroup,
|
|
272
275
|
{
|
|
273
276
|
disabled: props.disabled,
|
|
274
277
|
style: props.styles,
|
|
275
278
|
className: props.className,
|
|
276
|
-
options:
|
|
279
|
+
options: plainOptions,
|
|
277
280
|
value: checkedList,
|
|
278
281
|
onChange: handleChange
|
|
279
282
|
}
|
|
@@ -388,10 +391,13 @@ var MultipleSelectElement = (props) => {
|
|
|
388
391
|
// src/Components/Button.tsx
|
|
389
392
|
var import_react12 = __toESM(require("react"));
|
|
390
393
|
var ButtonElement = (props) => {
|
|
394
|
+
const handleClick = typeof props.action === "string" ? () => {
|
|
395
|
+
console.log("Performing action:", props.action);
|
|
396
|
+
} : props.action;
|
|
391
397
|
return /* @__PURE__ */ import_react12.default.createElement(
|
|
392
398
|
"button",
|
|
393
399
|
{
|
|
394
|
-
onClick:
|
|
400
|
+
onClick: handleClick,
|
|
395
401
|
className: `${props.className ? props.className : ""}`
|
|
396
402
|
},
|
|
397
403
|
props.icon && /* @__PURE__ */ import_react12.default.createElement("img", { src: props.icon }),
|
|
@@ -798,32 +804,6 @@ var DateRangePickerElement = (props) => {
|
|
|
798
804
|
];
|
|
799
805
|
return /* @__PURE__ */ import_react23.default.createElement(import_antd16.Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ import_react23.default.createElement(RangePicker, { presets: rangePresets, onChange: handleChange }));
|
|
800
806
|
};
|
|
801
|
-
|
|
802
|
-
// src/Components/UploadElement.tsx
|
|
803
|
-
var import_react24 = __toESM(require("react"));
|
|
804
|
-
var import_icons5 = require("@ant-design/icons");
|
|
805
|
-
var import_antd17 = require("antd");
|
|
806
|
-
var uploadProps = {
|
|
807
|
-
name: "file",
|
|
808
|
-
multiple: true,
|
|
809
|
-
// action: 'https://660d2bd96ddfa2943b33731c.mockapi.io/api/upload',
|
|
810
|
-
headers: {
|
|
811
|
-
authorization: "authorization-text"
|
|
812
|
-
},
|
|
813
|
-
onChange(info) {
|
|
814
|
-
if (info.file.status !== "uploading") {
|
|
815
|
-
console.log(info.file, info.fileList);
|
|
816
|
-
}
|
|
817
|
-
if (info.file.status === "done") {
|
|
818
|
-
import_antd17.message.success(`${info.file.name} file uploaded successfully`);
|
|
819
|
-
} else if (info.file.status === "error") {
|
|
820
|
-
import_antd17.message.error(`${info.file.name} file upload failed.`);
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
};
|
|
824
|
-
var UploadElement = (props) => {
|
|
825
|
-
return /* @__PURE__ */ import_react24.default.createElement(import_antd17.Upload, { ...uploadProps }, /* @__PURE__ */ import_react24.default.createElement(import_antd17.Button, { icon: /* @__PURE__ */ import_react24.default.createElement(import_icons5.UploadOutlined, null) }, "Click to Upload"));
|
|
826
|
-
};
|
|
827
807
|
// Annotate the CommonJS export names for ESM import in node:
|
|
828
808
|
0 && (module.exports = {
|
|
829
809
|
AddMoreTable,
|
|
@@ -842,6 +822,5 @@ var UploadElement = (props) => {
|
|
|
842
822
|
SingleSelectElement,
|
|
843
823
|
TableElement,
|
|
844
824
|
TextElement,
|
|
845
|
-
TextareaElement
|
|
846
|
-
UploadElement
|
|
825
|
+
TextareaElement
|
|
847
826
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -163,6 +163,7 @@ var RadioElement = (props) => {
|
|
|
163
163
|
value: selectedValue
|
|
164
164
|
},
|
|
165
165
|
props.options && props.options.map((option) => {
|
|
166
|
+
console.log(option);
|
|
166
167
|
return /* @__PURE__ */ React6.createElement(
|
|
167
168
|
Radio,
|
|
168
169
|
{
|
|
@@ -183,21 +184,24 @@ var RadioElement = (props) => {
|
|
|
183
184
|
|
|
184
185
|
// src/Components/Checkbox.tsx
|
|
185
186
|
import React7, { useState as useState3 } from "react";
|
|
186
|
-
import { Checkbox } from "antd";
|
|
187
|
+
import { Checkbox, Divider } from "antd";
|
|
187
188
|
var CheckboxGroup = Checkbox.Group;
|
|
189
|
+
var plainOptions = ["Apple", "Pear", "Orange"];
|
|
188
190
|
var defaultCheckedList = [];
|
|
189
191
|
var CheckboxElement = (props) => {
|
|
190
192
|
const [checkedList, setCheckedList] = useState3(defaultCheckedList);
|
|
191
|
-
const checkAll =
|
|
193
|
+
const checkAll = plainOptions.length === checkedList.length;
|
|
192
194
|
const handleChange = (list) => {
|
|
193
195
|
setCheckedList(list);
|
|
194
196
|
if (props.onChange) {
|
|
195
|
-
const selectedOptions =
|
|
197
|
+
const selectedOptions = list.map((value) => {
|
|
198
|
+
return { id: list.indexOf(value), value };
|
|
199
|
+
});
|
|
196
200
|
props.onChange(selectedOptions);
|
|
197
201
|
}
|
|
198
202
|
};
|
|
199
203
|
const onHandleAllChanges = (e) => {
|
|
200
|
-
const newList = e.target.checked ?
|
|
204
|
+
const newList = e.target.checked ? plainOptions : [];
|
|
201
205
|
setCheckedList(newList);
|
|
202
206
|
if (props.onChange) {
|
|
203
207
|
props.onChange(newList);
|
|
@@ -214,13 +218,13 @@ var CheckboxElement = (props) => {
|
|
|
214
218
|
checked: checkAll
|
|
215
219
|
},
|
|
216
220
|
"Check all"
|
|
217
|
-
), /* @__PURE__ */ React7.createElement(
|
|
221
|
+
), /* @__PURE__ */ React7.createElement(Divider, null), /* @__PURE__ */ React7.createElement(
|
|
218
222
|
CheckboxGroup,
|
|
219
223
|
{
|
|
220
224
|
disabled: props.disabled,
|
|
221
225
|
style: props.styles,
|
|
222
226
|
className: props.className,
|
|
223
|
-
options:
|
|
227
|
+
options: plainOptions,
|
|
224
228
|
value: checkedList,
|
|
225
229
|
onChange: handleChange
|
|
226
230
|
}
|
|
@@ -335,10 +339,13 @@ var MultipleSelectElement = (props) => {
|
|
|
335
339
|
// src/Components/Button.tsx
|
|
336
340
|
import React11 from "react";
|
|
337
341
|
var ButtonElement = (props) => {
|
|
342
|
+
const handleClick = typeof props.action === "string" ? () => {
|
|
343
|
+
console.log("Performing action:", props.action);
|
|
344
|
+
} : props.action;
|
|
338
345
|
return /* @__PURE__ */ React11.createElement(
|
|
339
346
|
"button",
|
|
340
347
|
{
|
|
341
|
-
onClick:
|
|
348
|
+
onClick: handleClick,
|
|
342
349
|
className: `${props.className ? props.className : ""}`
|
|
343
350
|
},
|
|
344
351
|
props.icon && /* @__PURE__ */ React11.createElement("img", { src: props.icon }),
|
|
@@ -745,32 +752,6 @@ var DateRangePickerElement = (props) => {
|
|
|
745
752
|
];
|
|
746
753
|
return /* @__PURE__ */ React22.createElement(Space2, { direction: "vertical", size: 12 }, /* @__PURE__ */ React22.createElement(RangePicker, { presets: rangePresets, onChange: handleChange }));
|
|
747
754
|
};
|
|
748
|
-
|
|
749
|
-
// src/Components/UploadElement.tsx
|
|
750
|
-
import React23 from "react";
|
|
751
|
-
import { UploadOutlined } from "@ant-design/icons";
|
|
752
|
-
import { Button as Button4, message, Upload } from "antd";
|
|
753
|
-
var uploadProps = {
|
|
754
|
-
name: "file",
|
|
755
|
-
multiple: true,
|
|
756
|
-
// action: 'https://660d2bd96ddfa2943b33731c.mockapi.io/api/upload',
|
|
757
|
-
headers: {
|
|
758
|
-
authorization: "authorization-text"
|
|
759
|
-
},
|
|
760
|
-
onChange(info) {
|
|
761
|
-
if (info.file.status !== "uploading") {
|
|
762
|
-
console.log(info.file, info.fileList);
|
|
763
|
-
}
|
|
764
|
-
if (info.file.status === "done") {
|
|
765
|
-
message.success(`${info.file.name} file uploaded successfully`);
|
|
766
|
-
} else if (info.file.status === "error") {
|
|
767
|
-
message.error(`${info.file.name} file upload failed.`);
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
};
|
|
771
|
-
var UploadElement = (props) => {
|
|
772
|
-
return /* @__PURE__ */ React23.createElement(Upload, { ...uploadProps }, /* @__PURE__ */ React23.createElement(Button4, { icon: /* @__PURE__ */ React23.createElement(UploadOutlined, null) }, "Click to Upload"));
|
|
773
|
-
};
|
|
774
755
|
export {
|
|
775
756
|
AddMoreTable,
|
|
776
757
|
ButtonElement,
|
|
@@ -788,6 +769,5 @@ export {
|
|
|
788
769
|
SingleSelectElement,
|
|
789
770
|
TableElement,
|
|
790
771
|
TextElement,
|
|
791
|
-
TextareaElement
|
|
792
|
-
UploadElement
|
|
772
|
+
TextareaElement
|
|
793
773
|
};
|