@apexcura/ui-components 0.0.9-Beta0 → 0.0.9-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 CHANGED
@@ -18,7 +18,8 @@ type ElementType = {
18
18
  maxLength?: number;
19
19
  fieldNames?: any[];
20
20
  onChange?: (value: string | number | boolean | any[]) => void;
21
- dropDownOptions: any[];
21
+ dropDownOptions?: any[];
22
+ id?: number;
22
23
  };
23
24
 
24
25
  interface ElementExecuterProps$3 extends ElementType {
@@ -65,4 +66,6 @@ declare const MultipleSelectElement: (props: ElementType) => React$1.JSX.Element
65
66
 
66
67
  declare const ButtonElement: () => React$1.JSX.Element;
67
68
 
68
- export { ButtonElement, CheckboxElement, CkEditor, MultipleSelectElement, NumberElement, PasswordElement, RadioElement, SelectElement, SingleSelectElement, TextElement, TextareaElement };
69
+ declare const AddMoreTable: (props: ElementType) => React$1.JSX.Element;
70
+
71
+ export { AddMoreTable, ButtonElement, CheckboxElement, CkEditor, MultipleSelectElement, NumberElement, PasswordElement, RadioElement, SelectElement, SingleSelectElement, TextElement, TextareaElement };
package/dist/index.d.ts CHANGED
@@ -18,7 +18,8 @@ type ElementType = {
18
18
  maxLength?: number;
19
19
  fieldNames?: any[];
20
20
  onChange?: (value: string | number | boolean | any[]) => void;
21
- dropDownOptions: any[];
21
+ dropDownOptions?: any[];
22
+ id?: number;
22
23
  };
23
24
 
24
25
  interface ElementExecuterProps$3 extends ElementType {
@@ -65,4 +66,6 @@ declare const MultipleSelectElement: (props: ElementType) => React$1.JSX.Element
65
66
 
66
67
  declare const ButtonElement: () => React$1.JSX.Element;
67
68
 
68
- export { ButtonElement, CheckboxElement, CkEditor, MultipleSelectElement, NumberElement, PasswordElement, RadioElement, SelectElement, SingleSelectElement, TextElement, TextareaElement };
69
+ declare const AddMoreTable: (props: ElementType) => React$1.JSX.Element;
70
+
71
+ export { AddMoreTable, ButtonElement, CheckboxElement, CkEditor, MultipleSelectElement, NumberElement, PasswordElement, RadioElement, SelectElement, SingleSelectElement, TextElement, TextareaElement };
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
+ AddMoreTable: () => AddMoreTable,
33
34
  ButtonElement: () => ButtonElement,
34
35
  CheckboxElement: () => CheckboxElement,
35
36
  CkEditor: () => CkEditor,
@@ -188,8 +189,10 @@ var import_react6 = __toESM(require("react"));
188
189
  var import_antd6 = require("antd");
189
190
  var RadioElement = (props) => {
190
191
  const handleChange = (e) => {
191
- if (props && props.onChange) {
192
- props.onChange(e.target.value);
192
+ if (props.onChange) {
193
+ const selectedVal = e.target.value;
194
+ const selectedOptions = [{ id: selectedVal, value: selectedVal }];
195
+ props.onChange(selectedOptions);
193
196
  }
194
197
  };
195
198
  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: handleChange }, "A"), /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 2, onChange: handleChange }, "B"), /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 3, onChange: handleChange }, "C"), /* @__PURE__ */ import_react6.default.createElement(import_antd6.Radio, { value: 4, onChange: handleChange }, "D"));
@@ -207,7 +210,10 @@ var CheckboxElement = (props) => {
207
210
  const handleChange = (list) => {
208
211
  setCheckedList(list);
209
212
  if (props.onChange) {
210
- props.onChange(list);
213
+ const selectedOptions = list.map((value) => {
214
+ return { id: list.indexOf(value), value };
215
+ });
216
+ props.onChange(selectedOptions);
211
217
  }
212
218
  };
213
219
  const onHandleAllChanges = (e) => {
@@ -302,9 +308,11 @@ var onSearch = (value) => {
302
308
  };
303
309
  var filterOption = (input, option) => (option?.label ?? "").toLowerCase().includes(input.toLowerCase());
304
310
  var SingleSelectElement = (props) => {
305
- const handleChange = (value) => {
311
+ const handleChange = (values) => {
306
312
  if (props.onChange) {
307
- props.onChange(value);
313
+ const option = props.dropDownOptions?.find((option2) => String(option2.title) === values);
314
+ const selectedOption = { id: option?.id, value: values };
315
+ props.onChange([selectedOption]);
308
316
  }
309
317
  };
310
318
  return /* @__PURE__ */ import_react10.default.createElement(
@@ -316,7 +324,7 @@ var SingleSelectElement = (props) => {
316
324
  onChange: handleChange,
317
325
  onSearch,
318
326
  filterOption,
319
- options: props.dropDownOptions?.map((eachOption) => ({ label: String(eachOption.title), value: String(eachOption.title) }))
327
+ options: props.dropDownOptions?.map((eachOption) => ({ label: String(eachOption.title), value: String(eachOption.title), id: String(eachOption.id) }))
320
328
  }
321
329
  );
322
330
  };
@@ -325,9 +333,13 @@ var SingleSelectElement = (props) => {
325
333
  var import_react11 = __toESM(require("react"));
326
334
  var import_antd9 = require("antd");
327
335
  var MultipleSelectElement = (props) => {
328
- const handleChange = (value) => {
336
+ const handleChange = (values) => {
329
337
  if (props.onChange) {
330
- props.onChange(value);
338
+ const selectedOptions = values.map((value) => {
339
+ const option = props.dropDownOptions?.find((option2) => String(option2.title) === value);
340
+ return { id: option?.id, value };
341
+ });
342
+ props.onChange(selectedOptions);
331
343
  }
332
344
  };
333
345
  return /* @__PURE__ */ import_react11.default.createElement(
@@ -345,8 +357,44 @@ var MultipleSelectElement = (props) => {
345
357
  var import_react12 = __toESM(require("react"));
346
358
  var import_antd10 = require("antd");
347
359
  var ButtonElement = () => /* @__PURE__ */ import_react12.default.createElement(import_antd10.Flex, { gap: "small" }, /* @__PURE__ */ import_react12.default.createElement(import_antd10.Button, { type: "primary" }, "Primary Button"));
360
+
361
+ // src/Components/AddMoreTable.tsx
362
+ var import_react13 = __toESM(require("react"));
363
+ var import_antd11 = require("antd");
364
+ var AddMoreTable = (props) => {
365
+ const columns = [
366
+ { title: "Name", dataIndex: "name", key: "name" },
367
+ { title: "Platform", dataIndex: "platform", key: "platform" },
368
+ { title: "Version", dataIndex: "version", key: "version" },
369
+ { title: "Upgraded", dataIndex: "upgradeNum", key: "upgradeNum" },
370
+ { title: "Creator", dataIndex: "creator", key: "creator" },
371
+ { title: "Date", dataIndex: "createdAt", key: "createdAt" },
372
+ { title: "Action", key: "operation", render: () => /* @__PURE__ */ import_react13.default.createElement("a", null, "Publish") }
373
+ ];
374
+ const data = [];
375
+ for (let i = 0; i < 3; ++i) {
376
+ data.push({
377
+ key: i.toString(),
378
+ name: "Screen",
379
+ platform: "iOS",
380
+ version: "10.3.4.5654",
381
+ upgradeNum: 500,
382
+ creator: "Jack",
383
+ createdAt: "2014-12-24 23:12:00"
384
+ });
385
+ }
386
+ return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement(
387
+ import_antd11.Table,
388
+ {
389
+ columns,
390
+ expandable: { defaultExpandedRowKeys: ["0"] },
391
+ dataSource: data
392
+ }
393
+ ));
394
+ };
348
395
  // Annotate the CommonJS export names for ESM import in node:
349
396
  0 && (module.exports = {
397
+ AddMoreTable,
350
398
  ButtonElement,
351
399
  CheckboxElement,
352
400
  CkEditor,
package/dist/index.mjs CHANGED
@@ -142,8 +142,10 @@ import React6 from "react";
142
142
  import { Radio } from "antd";
143
143
  var RadioElement = (props) => {
144
144
  const handleChange = (e) => {
145
- if (props && props.onChange) {
146
- props.onChange(e.target.value);
145
+ if (props.onChange) {
146
+ const selectedVal = e.target.value;
147
+ const selectedOptions = [{ id: selectedVal, value: selectedVal }];
148
+ props.onChange(selectedOptions);
147
149
  }
148
150
  };
149
151
  return /* @__PURE__ */ React6.createElement(Radio.Group, { name: "radiogroup", defaultValue: 1 }, /* @__PURE__ */ React6.createElement(Radio, { value: 1, onChange: handleChange }, "A"), /* @__PURE__ */ React6.createElement(Radio, { value: 2, onChange: handleChange }, "B"), /* @__PURE__ */ React6.createElement(Radio, { value: 3, onChange: handleChange }, "C"), /* @__PURE__ */ React6.createElement(Radio, { value: 4, onChange: handleChange }, "D"));
@@ -161,7 +163,10 @@ var CheckboxElement = (props) => {
161
163
  const handleChange = (list) => {
162
164
  setCheckedList(list);
163
165
  if (props.onChange) {
164
- props.onChange(list);
166
+ const selectedOptions = list.map((value) => {
167
+ return { id: list.indexOf(value), value };
168
+ });
169
+ props.onChange(selectedOptions);
165
170
  }
166
171
  };
167
172
  const onHandleAllChanges = (e) => {
@@ -256,9 +261,11 @@ var onSearch = (value) => {
256
261
  };
257
262
  var filterOption = (input, option) => (option?.label ?? "").toLowerCase().includes(input.toLowerCase());
258
263
  var SingleSelectElement = (props) => {
259
- const handleChange = (value) => {
264
+ const handleChange = (values) => {
260
265
  if (props.onChange) {
261
- props.onChange(value);
266
+ const option = props.dropDownOptions?.find((option2) => String(option2.title) === values);
267
+ const selectedOption = { id: option?.id, value: values };
268
+ props.onChange([selectedOption]);
262
269
  }
263
270
  };
264
271
  return /* @__PURE__ */ React9.createElement(
@@ -270,7 +277,7 @@ var SingleSelectElement = (props) => {
270
277
  onChange: handleChange,
271
278
  onSearch,
272
279
  filterOption,
273
- options: props.dropDownOptions?.map((eachOption) => ({ label: String(eachOption.title), value: String(eachOption.title) }))
280
+ options: props.dropDownOptions?.map((eachOption) => ({ label: String(eachOption.title), value: String(eachOption.title), id: String(eachOption.id) }))
274
281
  }
275
282
  );
276
283
  };
@@ -279,9 +286,13 @@ var SingleSelectElement = (props) => {
279
286
  import React10 from "react";
280
287
  import { Select as Select3 } from "antd";
281
288
  var MultipleSelectElement = (props) => {
282
- const handleChange = (value) => {
289
+ const handleChange = (values) => {
283
290
  if (props.onChange) {
284
- props.onChange(value);
291
+ const selectedOptions = values.map((value) => {
292
+ const option = props.dropDownOptions?.find((option2) => String(option2.title) === value);
293
+ return { id: option?.id, value };
294
+ });
295
+ props.onChange(selectedOptions);
285
296
  }
286
297
  };
287
298
  return /* @__PURE__ */ React10.createElement(
@@ -299,7 +310,43 @@ var MultipleSelectElement = (props) => {
299
310
  import React11 from "react";
300
311
  import { Button as Button2, Flex as Flex2 } from "antd";
301
312
  var ButtonElement = () => /* @__PURE__ */ React11.createElement(Flex2, { gap: "small" }, /* @__PURE__ */ React11.createElement(Button2, { type: "primary" }, "Primary Button"));
313
+
314
+ // src/Components/AddMoreTable.tsx
315
+ import React12 from "react";
316
+ import { Table } from "antd";
317
+ var AddMoreTable = (props) => {
318
+ const columns = [
319
+ { title: "Name", dataIndex: "name", key: "name" },
320
+ { title: "Platform", dataIndex: "platform", key: "platform" },
321
+ { title: "Version", dataIndex: "version", key: "version" },
322
+ { title: "Upgraded", dataIndex: "upgradeNum", key: "upgradeNum" },
323
+ { title: "Creator", dataIndex: "creator", key: "creator" },
324
+ { title: "Date", dataIndex: "createdAt", key: "createdAt" },
325
+ { title: "Action", key: "operation", render: () => /* @__PURE__ */ React12.createElement("a", null, "Publish") }
326
+ ];
327
+ const data = [];
328
+ for (let i = 0; i < 3; ++i) {
329
+ data.push({
330
+ key: i.toString(),
331
+ name: "Screen",
332
+ platform: "iOS",
333
+ version: "10.3.4.5654",
334
+ upgradeNum: 500,
335
+ creator: "Jack",
336
+ createdAt: "2014-12-24 23:12:00"
337
+ });
338
+ }
339
+ return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
340
+ Table,
341
+ {
342
+ columns,
343
+ expandable: { defaultExpandedRowKeys: ["0"] },
344
+ dataSource: data
345
+ }
346
+ ));
347
+ };
302
348
  export {
349
+ AddMoreTable,
303
350
  ButtonElement,
304
351
  CheckboxElement,
305
352
  CkEditor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.9-Beta0",
3
+ "version": "0.0.9-Beta10",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",