lew-ui 1.0.21 → 1.0.24

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.
Binary file
package/dist/lew.es.ts CHANGED
@@ -1304,9 +1304,9 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1304
1304
  for (let i2 = 0; i2 <= val.length - 1; i2++) {
1305
1305
  let length = val.charCodeAt(i2);
1306
1306
  if (length >= 0 && length <= 128) {
1307
- len += 1;
1307
+ len += 0.5;
1308
1308
  } else {
1309
- len += 2;
1309
+ len += 1;
1310
1310
  }
1311
1311
  }
1312
1312
  return Math.trunc(len);
@@ -1731,8 +1731,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1731
1731
  },
1732
1732
  required: true,
1733
1733
  validator: (value) => {
1734
- const hasNameKey = value.every((option) => Object.keys(option).includes("name"));
1735
- const hasIdKey = value.every((option) => Object.keys(option).includes("id"));
1734
+ const hasNameKey = value.every((option) => Object.keys(option).includes("label"));
1735
+ const hasIdKey = value.every((option) => Object.keys(option).includes("value"));
1736
1736
  return hasNameKey && hasIdKey;
1737
1737
  }
1738
1738
  }
@@ -1740,19 +1740,17 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1740
1740
  emits: ["update:modelValue"],
1741
1741
  setup(__props, { emit }) {
1742
1742
  const props = __props;
1743
- const check = (optionId, checked) => {
1743
+ const check = (_value, checked) => {
1744
1744
  let updatedValue = [...props.modelValue];
1745
- optionId = Number(optionId);
1746
1745
  if (checked) {
1747
- updatedValue.push(optionId);
1746
+ updatedValue.push(_value);
1748
1747
  } else {
1749
- updatedValue.splice(updatedValue.indexOf(optionId), 1);
1748
+ updatedValue.splice(updatedValue.indexOf(_value), 1);
1750
1749
  }
1751
1750
  emit("update:modelValue", updatedValue);
1752
1751
  };
1753
- const getChecked = (optionId) => {
1754
- optionId = Number(optionId);
1755
- return props.modelValue.includes(optionId);
1752
+ const getChecked = (_value) => {
1753
+ return props.modelValue.includes(_value);
1756
1754
  };
1757
1755
  return (_ctx, _cache) => {
1758
1756
  const _component_lew_flex = resolveComponent("lew-flex");
@@ -1764,13 +1762,13 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1764
1762
  default: withCtx(() => [
1765
1763
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
1766
1764
  return openBlock(), createBlock(LewCheckbox, {
1767
- key: option.id,
1765
+ key: option.value,
1768
1766
  block: __props.block,
1769
1767
  iconable: __props.iconable,
1770
1768
  round: __props.round,
1771
- label: option.name,
1772
- checked: getChecked(option.id),
1773
- onChange: ($event) => check(option.id, $event)
1769
+ label: option.label,
1770
+ checked: getChecked(option.value),
1771
+ onChange: ($event) => check(option.value, $event)
1774
1772
  }, null, 8, ["block", "iconable", "round", "label", "checked", "onChange"]);
1775
1773
  }), 128))
1776
1774
  ]),
@@ -1847,9 +1845,9 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
1847
1845
  __name: "LewRadioboxGroup",
1848
1846
  props: {
1849
1847
  modelValue: {
1850
- type: Number,
1848
+ type: String,
1851
1849
  default: () => {
1852
- return 0;
1850
+ return "";
1853
1851
  },
1854
1852
  required: true
1855
1853
  },
@@ -1874,16 +1872,16 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
1874
1872
  },
1875
1873
  required: true,
1876
1874
  validator: (value) => {
1877
- const hasNameKey = value.every((option) => Object.keys(option).includes("name"));
1878
- const hasIdKey = value.every((option) => Object.keys(option).includes("id"));
1875
+ const hasNameKey = value.every((option) => Object.keys(option).includes("label"));
1876
+ const hasIdKey = value.every((option) => Object.keys(option).includes("value"));
1879
1877
  return hasNameKey && hasIdKey;
1880
1878
  }
1881
1879
  }
1882
1880
  },
1883
1881
  emits: ["update:modelValue"],
1884
1882
  setup(__props, { emit }) {
1885
- const check = (optionId) => {
1886
- emit("update:modelValue", Number(optionId));
1883
+ const check = (_value) => {
1884
+ emit("update:modelValue", _value);
1887
1885
  };
1888
1886
  return (_ctx, _cache) => {
1889
1887
  const _component_lew_flex = resolveComponent("lew-flex");
@@ -1895,12 +1893,12 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
1895
1893
  default: withCtx(() => [
1896
1894
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
1897
1895
  return openBlock(), createBlock(LewRadio, {
1898
- key: option.id,
1896
+ key: option.value,
1899
1897
  block: __props.block,
1900
1898
  iconable: __props.iconable,
1901
- label: option.name,
1902
- checked: __props.modelValue == option.id,
1903
- "onUpdate:checked": ($event) => check(option.id)
1899
+ label: option.label,
1900
+ checked: __props.modelValue == option.value,
1901
+ "onUpdate:checked": ($event) => check(option.value)
1904
1902
  }, null, 8, ["block", "iconable", "label", "checked", "onUpdate:checked"]);
1905
1903
  }), 128))
1906
1904
  ]),