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