@deskhero/dh_ui 2.0.2 → 2.0.3

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/dh_ui.es.js CHANGED
@@ -27439,7 +27439,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
27439
27439
  }
27440
27440
  script.render = render$1;
27441
27441
  script.__file = "src/Multiselect.vue";
27442
- var default_css_vue_type_style_index_0_src_7d0bffcb_lang = "";
27442
+ var default_css_vue_type_style_index_0_src_af046b06_lang = "";
27443
27443
  var InputList_vue_vue_type_style_index_1_lang = "";
27444
27444
  const _hoisted_1$9 = /* @__PURE__ */ createElementVNode("img", {
27445
27445
  alt: "",
@@ -27447,7 +27447,7 @@ const _hoisted_1$9 = /* @__PURE__ */ createElementVNode("img", {
27447
27447
  src: _imports_0
27448
27448
  }, null, -1);
27449
27449
  const _hoisted_2$9 = { class: "list__item_text" };
27450
- const _hoisted_3$6 = /* @__PURE__ */ createElementVNode("div", { id: "list" }, null, -1);
27450
+ const _hoisted_3$6 = ["id"];
27451
27451
  const _sfc_main$a = {
27452
27452
  __name: "InputList",
27453
27453
  props: {
@@ -27470,18 +27470,46 @@ const _sfc_main$a = {
27470
27470
  selectItems: {
27471
27471
  type: Array,
27472
27472
  required: true
27473
+ },
27474
+ canClear: {
27475
+ type: Boolean,
27476
+ required: false,
27477
+ default: true
27478
+ },
27479
+ placeholder: {
27480
+ type: String,
27481
+ required: false,
27482
+ default: "Start typing..."
27473
27483
  }
27474
27484
  },
27475
- emits: ["update"],
27485
+ emits: ["update", "select", "deselect", "clear"],
27476
27486
  setup(__props, { emit }) {
27477
27487
  const props = __props;
27478
27488
  useCssVars((_ctx) => ({
27479
- "1c1e0897": __props.maxHeight
27489
+ "07bf1a7a": __props.maxHeight
27480
27490
  }));
27481
27491
  const inputVal = ref([]);
27482
- function update() {
27483
- emit("update", inputVal.value);
27492
+ const uniqueId = ref("");
27493
+ function select(v) {
27494
+ emit("select", v);
27484
27495
  }
27496
+ function deselect(v) {
27497
+ emit("deselect", v);
27498
+ }
27499
+ function update(v) {
27500
+ emit("update", v);
27501
+ }
27502
+ function clear2() {
27503
+ emit("clear");
27504
+ }
27505
+ function generateUniqueId() {
27506
+ const timestamp = Date.now().toString(36);
27507
+ const randomNum = Math.random().toString(36).substring(2, 9);
27508
+ return timestamp + randomNum;
27509
+ }
27510
+ onMounted(() => {
27511
+ uniqueId.value = generateUniqueId();
27512
+ });
27485
27513
  watch(() => props.selectItems, (oldValue, newValue) => {
27486
27514
  if (!oldValue) {
27487
27515
  return;
@@ -27503,17 +27531,22 @@ const _sfc_main$a = {
27503
27531
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputVal.value = $event),
27504
27532
  label: __props.labelProp,
27505
27533
  mode: "tags",
27534
+ canClear: props.canClear,
27506
27535
  native: false,
27507
27536
  object: true,
27508
27537
  options: __props.list,
27509
- placeholder: "Start typing a name",
27538
+ placeholder: props.placeholder,
27510
27539
  searchable: true,
27511
27540
  "value-prop": __props.idProp,
27512
- onDeselect: update,
27513
- onSelect: update
27541
+ onChange: _cache[1] || (_cache[1] = (v) => update(v)),
27542
+ onDeselect: _cache[2] || (_cache[2] = (v) => deselect(v)),
27543
+ onSelect: _cache[3] || (_cache[3] = (v) => select(v)),
27544
+ onClear: _cache[4] || (_cache[4] = ($event) => clear2())
27514
27545
  }, {
27515
27546
  tag: withCtx(({ option, handleTagRemove, disabled }) => [
27516
- (openBlock(), createBlock(Teleport, { to: "#list" }, [
27547
+ (openBlock(), createBlock(Teleport, {
27548
+ to: "#" + uniqueId.value
27549
+ }, [
27517
27550
  createElementVNode("div", {
27518
27551
  class: normalizeClass(["list__item", { "is-disabled": disabled }])
27519
27552
  }, [
@@ -27527,11 +27560,11 @@ const _sfc_main$a = {
27527
27560
  }, null, 8, ["onClick"]),
27528
27561
  renderSlot(_ctx.$slots, "default")
27529
27562
  ], 2)
27530
- ]))
27563
+ ], 8, ["to"]))
27531
27564
  ]),
27532
27565
  _: 3
27533
- }, 8, ["modelValue", "label", "options", "value-prop"]),
27534
- _hoisted_3$6
27566
+ }, 8, ["modelValue", "label", "canClear", "options", "placeholder", "value-prop"]),
27567
+ createElementVNode("div", { id: uniqueId.value }, null, 8, _hoisted_3$6)
27535
27568
  ], 64);
27536
27569
  };
27537
27570
  }