@apexcura/ui-components 0.0.7-Beta1 → 0.0.7-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 +20 -10
- package/dist/index.d.ts +20 -10
- package/dist/index.js +95 -22
- package/dist/index.mjs +93 -22
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ type ElementType = {
|
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
prefix?: React.ReactNode;
|
|
9
9
|
type?: string;
|
|
10
|
-
value?: string | number | boolean |
|
|
10
|
+
value?: string | number | boolean | any[];
|
|
11
11
|
status?: "error" | "warning";
|
|
12
12
|
styles?: React.CSSProperties;
|
|
13
13
|
classNames?: string;
|
|
@@ -16,13 +16,16 @@ type ElementType = {
|
|
|
16
16
|
name?: string;
|
|
17
17
|
suffix?: React.ReactNode;
|
|
18
18
|
maxLength?: number;
|
|
19
|
+
fieldNames?: any[];
|
|
19
20
|
onChange?: (value: string | number | boolean | any[]) => void;
|
|
21
|
+
options: any[];
|
|
22
|
+
onFocusHandler: () => void;
|
|
20
23
|
};
|
|
21
24
|
|
|
22
|
-
interface ElementExecuterProps$
|
|
25
|
+
interface ElementExecuterProps$3 extends ElementType {
|
|
23
26
|
onChange: (value: string | number | boolean | any[]) => void;
|
|
24
27
|
}
|
|
25
|
-
declare const TextElement: (props: ElementExecuterProps$
|
|
28
|
+
declare const TextElement: (props: ElementExecuterProps$3) => React$1.JSX.Element;
|
|
26
29
|
|
|
27
30
|
interface InputData {
|
|
28
31
|
placeholder?: string;
|
|
@@ -36,24 +39,31 @@ interface PasswordProps {
|
|
|
36
39
|
}
|
|
37
40
|
declare const PasswordElement: React$1.FC<PasswordProps>;
|
|
38
41
|
|
|
39
|
-
interface ElementExecuterProps$
|
|
42
|
+
interface ElementExecuterProps$2 extends ElementType {
|
|
40
43
|
onChange: (value: string | number | boolean | any[]) => void;
|
|
41
44
|
}
|
|
42
|
-
declare const NumberElement: (props: ElementExecuterProps$
|
|
45
|
+
declare const NumberElement: (props: ElementExecuterProps$2) => React$1.JSX.Element;
|
|
43
46
|
|
|
44
|
-
interface ElementExecuterProps extends ElementType {
|
|
47
|
+
interface ElementExecuterProps$1 extends ElementType {
|
|
45
48
|
onChange: (value: string | number | boolean | any[]) => void;
|
|
46
49
|
}
|
|
47
|
-
declare const TextareaElement: (props: ElementExecuterProps) => React$1.JSX.Element;
|
|
50
|
+
declare const TextareaElement: (props: ElementExecuterProps$1) => React$1.JSX.Element;
|
|
48
51
|
|
|
49
52
|
declare const SelectElement: (props: ElementType) => React$1.JSX.Element;
|
|
50
53
|
|
|
51
|
-
declare const RadioElement: (props: ElementType) =>
|
|
54
|
+
declare const RadioElement: (props: ElementType) => React$1.JSX.Element;
|
|
52
55
|
|
|
53
56
|
declare const CheckboxElement: (props: ElementType) => React$1.JSX.Element;
|
|
54
57
|
|
|
55
|
-
|
|
58
|
+
interface ElementExecuterProps extends ElementType {
|
|
59
|
+
onChange: (value: string | number | boolean | any[]) => void;
|
|
60
|
+
}
|
|
61
|
+
declare const CkEditor: (props: ElementExecuterProps) => React$1.JSX.Element;
|
|
62
|
+
|
|
63
|
+
declare const SingleSelectElement: (props: ElementType) => React$1.JSX.Element;
|
|
64
|
+
|
|
65
|
+
declare const MultipleSelectElement: () => React$1.JSX.Element;
|
|
56
66
|
|
|
57
67
|
declare const ButtonElement: () => React$1.JSX.Element;
|
|
58
68
|
|
|
59
|
-
export { ButtonElement, CheckboxElement, CkEditor, NumberElement, PasswordElement, RadioElement, SelectElement, TextElement, TextareaElement };
|
|
69
|
+
export { ButtonElement, CheckboxElement, CkEditor, MultipleSelectElement, NumberElement, PasswordElement, RadioElement, SelectElement, SingleSelectElement, TextElement, TextareaElement };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ type ElementType = {
|
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
prefix?: React.ReactNode;
|
|
9
9
|
type?: string;
|
|
10
|
-
value?: string | number | boolean |
|
|
10
|
+
value?: string | number | boolean | any[];
|
|
11
11
|
status?: "error" | "warning";
|
|
12
12
|
styles?: React.CSSProperties;
|
|
13
13
|
classNames?: string;
|
|
@@ -16,13 +16,16 @@ type ElementType = {
|
|
|
16
16
|
name?: string;
|
|
17
17
|
suffix?: React.ReactNode;
|
|
18
18
|
maxLength?: number;
|
|
19
|
+
fieldNames?: any[];
|
|
19
20
|
onChange?: (value: string | number | boolean | any[]) => void;
|
|
21
|
+
options: any[];
|
|
22
|
+
onFocusHandler: () => void;
|
|
20
23
|
};
|
|
21
24
|
|
|
22
|
-
interface ElementExecuterProps$
|
|
25
|
+
interface ElementExecuterProps$3 extends ElementType {
|
|
23
26
|
onChange: (value: string | number | boolean | any[]) => void;
|
|
24
27
|
}
|
|
25
|
-
declare const TextElement: (props: ElementExecuterProps$
|
|
28
|
+
declare const TextElement: (props: ElementExecuterProps$3) => React$1.JSX.Element;
|
|
26
29
|
|
|
27
30
|
interface InputData {
|
|
28
31
|
placeholder?: string;
|
|
@@ -36,24 +39,31 @@ interface PasswordProps {
|
|
|
36
39
|
}
|
|
37
40
|
declare const PasswordElement: React$1.FC<PasswordProps>;
|
|
38
41
|
|
|
39
|
-
interface ElementExecuterProps$
|
|
42
|
+
interface ElementExecuterProps$2 extends ElementType {
|
|
40
43
|
onChange: (value: string | number | boolean | any[]) => void;
|
|
41
44
|
}
|
|
42
|
-
declare const NumberElement: (props: ElementExecuterProps$
|
|
45
|
+
declare const NumberElement: (props: ElementExecuterProps$2) => React$1.JSX.Element;
|
|
43
46
|
|
|
44
|
-
interface ElementExecuterProps extends ElementType {
|
|
47
|
+
interface ElementExecuterProps$1 extends ElementType {
|
|
45
48
|
onChange: (value: string | number | boolean | any[]) => void;
|
|
46
49
|
}
|
|
47
|
-
declare const TextareaElement: (props: ElementExecuterProps) => React$1.JSX.Element;
|
|
50
|
+
declare const TextareaElement: (props: ElementExecuterProps$1) => React$1.JSX.Element;
|
|
48
51
|
|
|
49
52
|
declare const SelectElement: (props: ElementType) => React$1.JSX.Element;
|
|
50
53
|
|
|
51
|
-
declare const RadioElement: (props: ElementType) =>
|
|
54
|
+
declare const RadioElement: (props: ElementType) => React$1.JSX.Element;
|
|
52
55
|
|
|
53
56
|
declare const CheckboxElement: (props: ElementType) => React$1.JSX.Element;
|
|
54
57
|
|
|
55
|
-
|
|
58
|
+
interface ElementExecuterProps extends ElementType {
|
|
59
|
+
onChange: (value: string | number | boolean | any[]) => void;
|
|
60
|
+
}
|
|
61
|
+
declare const CkEditor: (props: ElementExecuterProps) => React$1.JSX.Element;
|
|
62
|
+
|
|
63
|
+
declare const SingleSelectElement: (props: ElementType) => React$1.JSX.Element;
|
|
64
|
+
|
|
65
|
+
declare const MultipleSelectElement: () => React$1.JSX.Element;
|
|
56
66
|
|
|
57
67
|
declare const ButtonElement: () => React$1.JSX.Element;
|
|
58
68
|
|
|
59
|
-
export { ButtonElement, CheckboxElement, CkEditor, NumberElement, PasswordElement, RadioElement, SelectElement, TextElement, TextareaElement };
|
|
69
|
+
export { ButtonElement, CheckboxElement, CkEditor, MultipleSelectElement, NumberElement, PasswordElement, RadioElement, SelectElement, SingleSelectElement, TextElement, TextareaElement };
|
package/dist/index.js
CHANGED
|
@@ -33,10 +33,12 @@ __export(src_exports, {
|
|
|
33
33
|
ButtonElement: () => ButtonElement,
|
|
34
34
|
CheckboxElement: () => CheckboxElement,
|
|
35
35
|
CkEditor: () => CkEditor,
|
|
36
|
+
MultipleSelectElement: () => MultipleSelectElement,
|
|
36
37
|
NumberElement: () => NumberElement,
|
|
37
38
|
PasswordElement: () => PasswordElement,
|
|
38
39
|
RadioElement: () => RadioElement,
|
|
39
40
|
SelectElement: () => SelectElement,
|
|
41
|
+
SingleSelectElement: () => SingleSelectElement,
|
|
40
42
|
TextElement: () => TextElement,
|
|
41
43
|
TextareaElement: () => TextareaElement
|
|
42
44
|
});
|
|
@@ -149,11 +151,6 @@ var TextareaElement = (props) => {
|
|
|
149
151
|
// src/Components/SelectElement.tsx
|
|
150
152
|
var import_react5 = __toESM(require("react"));
|
|
151
153
|
var import_antd5 = require("antd");
|
|
152
|
-
var options = [
|
|
153
|
-
{ label: "female", value: "female" },
|
|
154
|
-
{ label: "male", value: "male" },
|
|
155
|
-
{ label: "other", value: "other" }
|
|
156
|
-
];
|
|
157
154
|
var labelRender = (props) => {
|
|
158
155
|
const { label, value } = props;
|
|
159
156
|
if (label) {
|
|
@@ -162,7 +159,7 @@ var labelRender = (props) => {
|
|
|
162
159
|
return /* @__PURE__ */ import_react5.default.createElement("span", null, "select gender");
|
|
163
160
|
};
|
|
164
161
|
var SelectElement = (props) => {
|
|
165
|
-
const
|
|
162
|
+
const handleChange3 = (value) => {
|
|
166
163
|
if (props.onChange) {
|
|
167
164
|
props.onChange(value);
|
|
168
165
|
}
|
|
@@ -171,7 +168,7 @@ var SelectElement = (props) => {
|
|
|
171
168
|
import_antd5.Select,
|
|
172
169
|
{
|
|
173
170
|
labelRender,
|
|
174
|
-
options,
|
|
171
|
+
options: props.fieldNames,
|
|
175
172
|
placeholder: props.placeholder,
|
|
176
173
|
allowClear: true,
|
|
177
174
|
defaultValue: props.defaultValue,
|
|
@@ -181,7 +178,7 @@ var SelectElement = (props) => {
|
|
|
181
178
|
style: props.styles,
|
|
182
179
|
className: props.classNames,
|
|
183
180
|
variant: props.variant,
|
|
184
|
-
onChange:
|
|
181
|
+
onChange: handleChange3
|
|
185
182
|
}
|
|
186
183
|
);
|
|
187
184
|
};
|
|
@@ -190,12 +187,12 @@ var SelectElement = (props) => {
|
|
|
190
187
|
var import_react6 = __toESM(require("react"));
|
|
191
188
|
var import_antd6 = require("antd");
|
|
192
189
|
var RadioElement = (props) => {
|
|
193
|
-
const
|
|
190
|
+
const handleChange3 = (e) => {
|
|
194
191
|
if (props && props.onChange) {
|
|
195
192
|
props.onChange(e.target.value);
|
|
196
193
|
}
|
|
197
194
|
};
|
|
198
|
-
/* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio.Group, { name: "radiogroup", defaultValue: 1 }, /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 1, onChange:
|
|
195
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio.Group, { name: "radiogroup", defaultValue: 1 }, /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 1, onChange: handleChange3 }, "A"), /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 2, onChange: handleChange3 }, "B"), /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 3, onChange: handleChange3 }, "C"), /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 4, onChange: handleChange3 }, "D"));
|
|
199
196
|
};
|
|
200
197
|
|
|
201
198
|
// src/Components/Checkbox.tsx
|
|
@@ -207,17 +204,17 @@ var defaultCheckedList = [];
|
|
|
207
204
|
var CheckboxElement = (props) => {
|
|
208
205
|
const [checkedList, setCheckedList] = (0, import_react7.useState)(defaultCheckedList);
|
|
209
206
|
const checkAll = plainOptions.length === checkedList.length;
|
|
210
|
-
const
|
|
211
|
-
const handleChange = (list) => {
|
|
207
|
+
const handleChange3 = (list) => {
|
|
212
208
|
setCheckedList(list);
|
|
213
209
|
if (props.onChange) {
|
|
214
|
-
props.onChange(
|
|
210
|
+
props.onChange(list);
|
|
215
211
|
}
|
|
216
212
|
};
|
|
217
213
|
const onHandleAllChanges = (e) => {
|
|
218
|
-
|
|
214
|
+
const newList = e.target.checked ? plainOptions : [];
|
|
215
|
+
setCheckedList(newList);
|
|
219
216
|
if (props.onChange) {
|
|
220
|
-
props.onChange(
|
|
217
|
+
props.onChange(newList);
|
|
221
218
|
}
|
|
222
219
|
};
|
|
223
220
|
return /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, /* @__PURE__ */ import_react7.default.createElement(
|
|
@@ -227,7 +224,6 @@ var CheckboxElement = (props) => {
|
|
|
227
224
|
id: props.name,
|
|
228
225
|
style: props.styles,
|
|
229
226
|
className: props.classNames,
|
|
230
|
-
indeterminate,
|
|
231
227
|
onChange: onHandleAllChanges,
|
|
232
228
|
checked: checkAll
|
|
233
229
|
},
|
|
@@ -240,7 +236,7 @@ var CheckboxElement = (props) => {
|
|
|
240
236
|
className: props.classNames,
|
|
241
237
|
options: plainOptions,
|
|
242
238
|
value: checkedList,
|
|
243
|
-
onChange:
|
|
239
|
+
onChange: handleChange3
|
|
244
240
|
}
|
|
245
241
|
));
|
|
246
242
|
};
|
|
@@ -249,17 +245,20 @@ var CheckboxElement = (props) => {
|
|
|
249
245
|
var import_react8 = require("react");
|
|
250
246
|
var import_tinymce_react = require("@tinymce/tinymce-react");
|
|
251
247
|
var import_react9 = __toESM(require("react"));
|
|
252
|
-
var CkEditor = () => {
|
|
248
|
+
var CkEditor = (props) => {
|
|
253
249
|
const editorRef = (0, import_react8.useRef)(null);
|
|
254
250
|
const log = () => {
|
|
255
251
|
if (editorRef.current) {
|
|
256
|
-
|
|
252
|
+
let content = editorRef.current.getContent();
|
|
253
|
+
if (props.onChange) {
|
|
254
|
+
props.onChange(content);
|
|
255
|
+
}
|
|
257
256
|
}
|
|
258
257
|
};
|
|
259
258
|
return /* @__PURE__ */ import_react9.default.createElement("div", null, /* @__PURE__ */ import_react9.default.createElement(
|
|
260
259
|
import_tinymce_react.Editor,
|
|
261
260
|
{
|
|
262
|
-
apiKey: "
|
|
261
|
+
apiKey: "rwpgt7maa54n0pe5mglhkl686p7h57sg6z636n6gf2mio1b9",
|
|
263
262
|
onInit: (_evt, editor) => {
|
|
264
263
|
if (editor)
|
|
265
264
|
editorRef.current = editor;
|
|
@@ -295,19 +294,93 @@ var CkEditor = () => {
|
|
|
295
294
|
), /* @__PURE__ */ import_react9.default.createElement("button", { onClick: log }, "Log editor content"));
|
|
296
295
|
};
|
|
297
296
|
|
|
298
|
-
// src/Components/
|
|
297
|
+
// src/Components/Select/SingleSelectElement.tsx
|
|
299
298
|
var import_react10 = __toESM(require("react"));
|
|
300
299
|
var import_antd8 = require("antd");
|
|
301
|
-
var
|
|
300
|
+
var onSearch = (value) => {
|
|
301
|
+
console.log("search:", value);
|
|
302
|
+
};
|
|
303
|
+
var filterOption = (input, option) => (option?.label ?? "").toLowerCase().includes(input.toLowerCase());
|
|
304
|
+
var handleChange = () => {
|
|
305
|
+
};
|
|
306
|
+
var SingleSelectElement = (props) => {
|
|
307
|
+
return /* @__PURE__ */ import_react10.default.createElement(
|
|
308
|
+
import_antd8.Select,
|
|
309
|
+
{
|
|
310
|
+
showSearch: true,
|
|
311
|
+
placeholder: props.placeholder,
|
|
312
|
+
optionFilterProp: "children",
|
|
313
|
+
onChange: handleChange,
|
|
314
|
+
onSearch,
|
|
315
|
+
filterOption,
|
|
316
|
+
onFocus: props.onFocusHandler,
|
|
317
|
+
options: props.options
|
|
318
|
+
}
|
|
319
|
+
);
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
// src/Components/Select/MultipleSelectElement.tsx
|
|
323
|
+
var import_react11 = __toESM(require("react"));
|
|
324
|
+
var import_antd9 = require("antd");
|
|
325
|
+
var handleChange2 = (value) => {
|
|
326
|
+
console.log(`selected ${value}`);
|
|
327
|
+
};
|
|
328
|
+
var options = [
|
|
329
|
+
{
|
|
330
|
+
label: "China",
|
|
331
|
+
value: "china",
|
|
332
|
+
emoji: "\u{1F1E8}\u{1F1F3}",
|
|
333
|
+
desc: "China (\u4E2D\u56FD)"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
label: "USA",
|
|
337
|
+
value: "usa",
|
|
338
|
+
emoji: "\u{1F1FA}\u{1F1F8}",
|
|
339
|
+
desc: "USA (\u7F8E\u56FD)"
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
label: "Japan",
|
|
343
|
+
value: "japan",
|
|
344
|
+
emoji: "\u{1F1EF}\u{1F1F5}",
|
|
345
|
+
desc: "Japan (\u65E5\u672C)"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
label: "Korea",
|
|
349
|
+
value: "korea",
|
|
350
|
+
emoji: "\u{1F1F0}\u{1F1F7}",
|
|
351
|
+
desc: "Korea (\u97E9\u56FD)"
|
|
352
|
+
}
|
|
353
|
+
];
|
|
354
|
+
var MultipleSelectElement = () => {
|
|
355
|
+
return /* @__PURE__ */ import_react11.default.createElement(
|
|
356
|
+
import_antd9.Select,
|
|
357
|
+
{
|
|
358
|
+
mode: "multiple",
|
|
359
|
+
style: { width: "100%" },
|
|
360
|
+
placeholder: "select one country",
|
|
361
|
+
defaultValue: ["china"],
|
|
362
|
+
onChange: handleChange2,
|
|
363
|
+
options,
|
|
364
|
+
optionRender: (option) => /* @__PURE__ */ import_react11.default.createElement(import_antd9.Space, null, /* @__PURE__ */ import_react11.default.createElement("span", { role: "img", "aria-label": option.data.label }, option.data.emoji), option.data.desc)
|
|
365
|
+
}
|
|
366
|
+
);
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
// src/Components/Button.tsx
|
|
370
|
+
var import_react12 = __toESM(require("react"));
|
|
371
|
+
var import_antd10 = require("antd");
|
|
372
|
+
var ButtonElement = () => /* @__PURE__ */ import_react12.default.createElement(import_antd10.Flex, { gap: "small" }, /* @__PURE__ */ import_react12.default.createElement(import_antd10.Button, { type: "primary" }, "Primary Button"));
|
|
302
373
|
// Annotate the CommonJS export names for ESM import in node:
|
|
303
374
|
0 && (module.exports = {
|
|
304
375
|
ButtonElement,
|
|
305
376
|
CheckboxElement,
|
|
306
377
|
CkEditor,
|
|
378
|
+
MultipleSelectElement,
|
|
307
379
|
NumberElement,
|
|
308
380
|
PasswordElement,
|
|
309
381
|
RadioElement,
|
|
310
382
|
SelectElement,
|
|
383
|
+
SingleSelectElement,
|
|
311
384
|
TextElement,
|
|
312
385
|
TextareaElement
|
|
313
386
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -105,11 +105,6 @@ var TextareaElement = (props) => {
|
|
|
105
105
|
// src/Components/SelectElement.tsx
|
|
106
106
|
import React5 from "react";
|
|
107
107
|
import { Select } from "antd";
|
|
108
|
-
var options = [
|
|
109
|
-
{ label: "female", value: "female" },
|
|
110
|
-
{ label: "male", value: "male" },
|
|
111
|
-
{ label: "other", value: "other" }
|
|
112
|
-
];
|
|
113
108
|
var labelRender = (props) => {
|
|
114
109
|
const { label, value } = props;
|
|
115
110
|
if (label) {
|
|
@@ -118,7 +113,7 @@ var labelRender = (props) => {
|
|
|
118
113
|
return /* @__PURE__ */ React5.createElement("span", null, "select gender");
|
|
119
114
|
};
|
|
120
115
|
var SelectElement = (props) => {
|
|
121
|
-
const
|
|
116
|
+
const handleChange3 = (value) => {
|
|
122
117
|
if (props.onChange) {
|
|
123
118
|
props.onChange(value);
|
|
124
119
|
}
|
|
@@ -127,7 +122,7 @@ var SelectElement = (props) => {
|
|
|
127
122
|
Select,
|
|
128
123
|
{
|
|
129
124
|
labelRender,
|
|
130
|
-
options,
|
|
125
|
+
options: props.fieldNames,
|
|
131
126
|
placeholder: props.placeholder,
|
|
132
127
|
allowClear: true,
|
|
133
128
|
defaultValue: props.defaultValue,
|
|
@@ -137,7 +132,7 @@ var SelectElement = (props) => {
|
|
|
137
132
|
style: props.styles,
|
|
138
133
|
className: props.classNames,
|
|
139
134
|
variant: props.variant,
|
|
140
|
-
onChange:
|
|
135
|
+
onChange: handleChange3
|
|
141
136
|
}
|
|
142
137
|
);
|
|
143
138
|
};
|
|
@@ -146,12 +141,12 @@ var SelectElement = (props) => {
|
|
|
146
141
|
import React6 from "react";
|
|
147
142
|
import { Radio } from "antd";
|
|
148
143
|
var RadioElement = (props) => {
|
|
149
|
-
const
|
|
144
|
+
const handleChange3 = (e) => {
|
|
150
145
|
if (props && props.onChange) {
|
|
151
146
|
props.onChange(e.target.value);
|
|
152
147
|
}
|
|
153
148
|
};
|
|
154
|
-
/* @__PURE__ */ React6.createElement(Radio.Group, { name: "radiogroup", defaultValue: 1 }, /* @__PURE__ */ React6.createElement(Radio, { value: 1, onChange:
|
|
149
|
+
return /* @__PURE__ */ React6.createElement(Radio.Group, { name: "radiogroup", defaultValue: 1 }, /* @__PURE__ */ React6.createElement(Radio, { value: 1, onChange: handleChange3 }, "A"), /* @__PURE__ */ React6.createElement(Radio, { value: 2, onChange: handleChange3 }, "B"), /* @__PURE__ */ React6.createElement(Radio, { value: 3, onChange: handleChange3 }, "C"), /* @__PURE__ */ React6.createElement(Radio, { value: 4, onChange: handleChange3 }, "D"));
|
|
155
150
|
};
|
|
156
151
|
|
|
157
152
|
// src/Components/Checkbox.tsx
|
|
@@ -163,17 +158,17 @@ var defaultCheckedList = [];
|
|
|
163
158
|
var CheckboxElement = (props) => {
|
|
164
159
|
const [checkedList, setCheckedList] = useState2(defaultCheckedList);
|
|
165
160
|
const checkAll = plainOptions.length === checkedList.length;
|
|
166
|
-
const
|
|
167
|
-
const handleChange = (list) => {
|
|
161
|
+
const handleChange3 = (list) => {
|
|
168
162
|
setCheckedList(list);
|
|
169
163
|
if (props.onChange) {
|
|
170
|
-
props.onChange(
|
|
164
|
+
props.onChange(list);
|
|
171
165
|
}
|
|
172
166
|
};
|
|
173
167
|
const onHandleAllChanges = (e) => {
|
|
174
|
-
|
|
168
|
+
const newList = e.target.checked ? plainOptions : [];
|
|
169
|
+
setCheckedList(newList);
|
|
175
170
|
if (props.onChange) {
|
|
176
|
-
props.onChange(
|
|
171
|
+
props.onChange(newList);
|
|
177
172
|
}
|
|
178
173
|
};
|
|
179
174
|
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
|
|
@@ -183,7 +178,6 @@ var CheckboxElement = (props) => {
|
|
|
183
178
|
id: props.name,
|
|
184
179
|
style: props.styles,
|
|
185
180
|
className: props.classNames,
|
|
186
|
-
indeterminate,
|
|
187
181
|
onChange: onHandleAllChanges,
|
|
188
182
|
checked: checkAll
|
|
189
183
|
},
|
|
@@ -196,7 +190,7 @@ var CheckboxElement = (props) => {
|
|
|
196
190
|
className: props.classNames,
|
|
197
191
|
options: plainOptions,
|
|
198
192
|
value: checkedList,
|
|
199
|
-
onChange:
|
|
193
|
+
onChange: handleChange3
|
|
200
194
|
}
|
|
201
195
|
));
|
|
202
196
|
};
|
|
@@ -205,17 +199,20 @@ var CheckboxElement = (props) => {
|
|
|
205
199
|
import { useRef } from "react";
|
|
206
200
|
import { Editor } from "@tinymce/tinymce-react";
|
|
207
201
|
import React8 from "react";
|
|
208
|
-
var CkEditor = () => {
|
|
202
|
+
var CkEditor = (props) => {
|
|
209
203
|
const editorRef = useRef(null);
|
|
210
204
|
const log = () => {
|
|
211
205
|
if (editorRef.current) {
|
|
212
|
-
|
|
206
|
+
let content = editorRef.current.getContent();
|
|
207
|
+
if (props.onChange) {
|
|
208
|
+
props.onChange(content);
|
|
209
|
+
}
|
|
213
210
|
}
|
|
214
211
|
};
|
|
215
212
|
return /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement(
|
|
216
213
|
Editor,
|
|
217
214
|
{
|
|
218
|
-
apiKey: "
|
|
215
|
+
apiKey: "rwpgt7maa54n0pe5mglhkl686p7h57sg6z636n6gf2mio1b9",
|
|
219
216
|
onInit: (_evt, editor) => {
|
|
220
217
|
if (editor)
|
|
221
218
|
editorRef.current = editor;
|
|
@@ -251,18 +248,92 @@ var CkEditor = () => {
|
|
|
251
248
|
), /* @__PURE__ */ React8.createElement("button", { onClick: log }, "Log editor content"));
|
|
252
249
|
};
|
|
253
250
|
|
|
254
|
-
// src/Components/
|
|
251
|
+
// src/Components/Select/SingleSelectElement.tsx
|
|
255
252
|
import React9 from "react";
|
|
253
|
+
import { Select as Select2 } from "antd";
|
|
254
|
+
var onSearch = (value) => {
|
|
255
|
+
console.log("search:", value);
|
|
256
|
+
};
|
|
257
|
+
var filterOption = (input, option) => (option?.label ?? "").toLowerCase().includes(input.toLowerCase());
|
|
258
|
+
var handleChange = () => {
|
|
259
|
+
};
|
|
260
|
+
var SingleSelectElement = (props) => {
|
|
261
|
+
return /* @__PURE__ */ React9.createElement(
|
|
262
|
+
Select2,
|
|
263
|
+
{
|
|
264
|
+
showSearch: true,
|
|
265
|
+
placeholder: props.placeholder,
|
|
266
|
+
optionFilterProp: "children",
|
|
267
|
+
onChange: handleChange,
|
|
268
|
+
onSearch,
|
|
269
|
+
filterOption,
|
|
270
|
+
onFocus: props.onFocusHandler,
|
|
271
|
+
options: props.options
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
// src/Components/Select/MultipleSelectElement.tsx
|
|
277
|
+
import React10 from "react";
|
|
278
|
+
import { Select as Select3, Space as Space2 } from "antd";
|
|
279
|
+
var handleChange2 = (value) => {
|
|
280
|
+
console.log(`selected ${value}`);
|
|
281
|
+
};
|
|
282
|
+
var options = [
|
|
283
|
+
{
|
|
284
|
+
label: "China",
|
|
285
|
+
value: "china",
|
|
286
|
+
emoji: "\u{1F1E8}\u{1F1F3}",
|
|
287
|
+
desc: "China (\u4E2D\u56FD)"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
label: "USA",
|
|
291
|
+
value: "usa",
|
|
292
|
+
emoji: "\u{1F1FA}\u{1F1F8}",
|
|
293
|
+
desc: "USA (\u7F8E\u56FD)"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
label: "Japan",
|
|
297
|
+
value: "japan",
|
|
298
|
+
emoji: "\u{1F1EF}\u{1F1F5}",
|
|
299
|
+
desc: "Japan (\u65E5\u672C)"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
label: "Korea",
|
|
303
|
+
value: "korea",
|
|
304
|
+
emoji: "\u{1F1F0}\u{1F1F7}",
|
|
305
|
+
desc: "Korea (\u97E9\u56FD)"
|
|
306
|
+
}
|
|
307
|
+
];
|
|
308
|
+
var MultipleSelectElement = () => {
|
|
309
|
+
return /* @__PURE__ */ React10.createElement(
|
|
310
|
+
Select3,
|
|
311
|
+
{
|
|
312
|
+
mode: "multiple",
|
|
313
|
+
style: { width: "100%" },
|
|
314
|
+
placeholder: "select one country",
|
|
315
|
+
defaultValue: ["china"],
|
|
316
|
+
onChange: handleChange2,
|
|
317
|
+
options,
|
|
318
|
+
optionRender: (option) => /* @__PURE__ */ React10.createElement(Space2, null, /* @__PURE__ */ React10.createElement("span", { role: "img", "aria-label": option.data.label }, option.data.emoji), option.data.desc)
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
// src/Components/Button.tsx
|
|
324
|
+
import React11 from "react";
|
|
256
325
|
import { Button as Button2, Flex as Flex2 } from "antd";
|
|
257
|
-
var ButtonElement = () => /* @__PURE__ */
|
|
326
|
+
var ButtonElement = () => /* @__PURE__ */ React11.createElement(Flex2, { gap: "small" }, /* @__PURE__ */ React11.createElement(Button2, { type: "primary" }, "Primary Button"));
|
|
258
327
|
export {
|
|
259
328
|
ButtonElement,
|
|
260
329
|
CheckboxElement,
|
|
261
330
|
CkEditor,
|
|
331
|
+
MultipleSelectElement,
|
|
262
332
|
NumberElement,
|
|
263
333
|
PasswordElement,
|
|
264
334
|
RadioElement,
|
|
265
335
|
SelectElement,
|
|
336
|
+
SingleSelectElement,
|
|
266
337
|
TextElement,
|
|
267
338
|
TextareaElement
|
|
268
339
|
};
|