@apexcura/ui-components 0.0.9-Beta5 → 0.0.9-Beta7

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,7 @@ 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
22
  };
23
23
 
24
24
  interface ElementExecuterProps$3 extends ElementType {
package/dist/index.d.ts CHANGED
@@ -18,7 +18,7 @@ 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
22
  };
23
23
 
24
24
  interface ElementExecuterProps$3 extends ElementType {
package/dist/index.js CHANGED
@@ -188,8 +188,10 @@ var import_react6 = __toESM(require("react"));
188
188
  var import_antd6 = require("antd");
189
189
  var RadioElement = (props) => {
190
190
  const handleChange = (e) => {
191
- if (props && props.onChange) {
192
- props.onChange(e.target.value);
191
+ if (props.onChange) {
192
+ const selectedVal = e.target.value;
193
+ const selectedOptions = [{ id: selectedVal, value: selectedVal }];
194
+ props.onChange(selectedOptions);
193
195
  }
194
196
  };
195
197
  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 +209,10 @@ var CheckboxElement = (props) => {
207
209
  const handleChange = (list) => {
208
210
  setCheckedList(list);
209
211
  if (props.onChange) {
210
- props.onChange(list);
212
+ const selectedOptions = list.map((value) => {
213
+ return { id: list.indexOf(value), value };
214
+ });
215
+ props.onChange(selectedOptions);
211
216
  }
212
217
  };
213
218
  const onHandleAllChanges = (e) => {
@@ -302,9 +307,11 @@ var onSearch = (value) => {
302
307
  };
303
308
  var filterOption = (input, option) => (option?.label ?? "").toLowerCase().includes(input.toLowerCase());
304
309
  var SingleSelectElement = (props) => {
305
- const handleChange = (value) => {
310
+ const handleChange = (values) => {
306
311
  if (props.onChange) {
307
- props.onChange(value);
312
+ const option = props.dropDownOptions?.find((option2) => String(option2.title) === values);
313
+ const selectedOption = { id: option?.id, value: values };
314
+ props.onChange([selectedOption]);
308
315
  }
309
316
  };
310
317
  return /* @__PURE__ */ import_react10.default.createElement(
@@ -316,7 +323,7 @@ var SingleSelectElement = (props) => {
316
323
  onChange: handleChange,
317
324
  onSearch,
318
325
  filterOption,
319
- options: props.dropDownOptions?.map((eachOption) => ({ label: String(eachOption.title), value: String(eachOption.title) }))
326
+ options: props.dropDownOptions?.map((eachOption) => ({ label: String(eachOption.title), value: String(eachOption.title), id: String(eachOption.id) }))
320
327
  }
321
328
  );
322
329
  };
@@ -328,7 +335,7 @@ var MultipleSelectElement = (props) => {
328
335
  const handleChange = (values) => {
329
336
  if (props.onChange) {
330
337
  const selectedOptions = values.map((value) => {
331
- const option = props.dropDownOptions.find((option2) => String(option2.title) === value);
338
+ const option = props.dropDownOptions?.find((option2) => String(option2.title) === value);
332
339
  return { id: option?.id, value };
333
340
  });
334
341
  props.onChange(selectedOptions);
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
  };
@@ -282,7 +289,7 @@ var MultipleSelectElement = (props) => {
282
289
  const handleChange = (values) => {
283
290
  if (props.onChange) {
284
291
  const selectedOptions = values.map((value) => {
285
- const option = props.dropDownOptions.find((option2) => String(option2.title) === value);
292
+ const option = props.dropDownOptions?.find((option2) => String(option2.title) === value);
286
293
  return { id: option?.id, value };
287
294
  });
288
295
  props.onChange(selectedOptions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.9-Beta5",
3
+ "version": "0.0.9-Beta7",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",