cleek 2.3.50 → 2.3.51

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/cleek.es.js CHANGED
@@ -19002,7 +19002,7 @@ const _hoisted_1$4 = ["disabled"];
19002
19002
  const _hoisted_2$2 = ["value"];
19003
19003
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
19004
19004
  props: {
19005
- modelValue: { default: null, type: [Boolean, Number, Object, Array, String] },
19005
+ modelValue: { default: null },
19006
19006
  prop: { type: String, default: void 0 },
19007
19007
  reduceValueProp: { type: String, default: "id" },
19008
19008
  reduceNameProp: { type: String, default: "name" },
@@ -19053,9 +19053,18 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
19053
19053
  });
19054
19054
  return list;
19055
19055
  });
19056
+ const isClearBtnVisible = computed$2(() => {
19057
+ if (props.notClearable)
19058
+ return false;
19059
+ if (valueIsDefault.value)
19060
+ return false;
19061
+ return true;
19062
+ });
19056
19063
  const computedClassSelect = computed$2(() => {
19057
19064
  const list = [];
19058
19065
  list.push(functions.getGroupClass(props, windowWidth.value));
19066
+ if (isClearBtnVisible.value)
19067
+ list.push("clear-able");
19059
19068
  return list;
19060
19069
  });
19061
19070
  const computedStyle = computed$2(() => {
@@ -19082,12 +19091,16 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
19082
19091
  return props.searchable;
19083
19092
  });
19084
19093
  const realClearValue = computed$2(() => {
19094
+ if (props.clearValue !== "auto")
19095
+ return props.clearValue;
19085
19096
  switch (typeof props.modelValue) {
19086
19097
  case "number":
19087
19098
  return 0;
19088
19099
  case "string":
19089
19100
  return "";
19090
19101
  case "object":
19102
+ if (!props.modelValue)
19103
+ return null;
19091
19104
  if (props.modelValue.constructor === Array)
19092
19105
  return [];
19093
19106
  return {};
@@ -19095,7 +19108,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
19095
19108
  return null;
19096
19109
  }
19097
19110
  });
19098
- computed$2(() => {
19111
+ const valueIsDefault = computed$2(() => {
19112
+ if (props.clearValue !== "auto")
19113
+ return value.value === props.clearValue;
19099
19114
  switch (typeof props.modelValue) {
19100
19115
  case "number":
19101
19116
  return props.modelValue === 0;
@@ -19139,8 +19154,15 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
19139
19154
  class: "ck-select",
19140
19155
  style: normalizeStyle(unref$1(computedStyle))
19141
19156
  }, [
19142
- __props.label ? (openBlock(), createBlock(ckLabel, {
19157
+ unref$1(isClearBtnVisible) ? (openBlock(), createElementBlock("div", {
19143
19158
  key: 0,
19159
+ class: "ck-select__clear-btn",
19160
+ onClick: _cache[0] || (_cache[0] = ($event) => value.value = unref$1(realClearValue))
19161
+ }, [
19162
+ createVNode(ckIcon, { icon: "times" })
19163
+ ])) : createCommentVNode("", true),
19164
+ __props.label ? (openBlock(), createBlock(ckLabel, {
19165
+ key: 1,
19144
19166
  align: __props.labelAlign,
19145
19167
  for: "ck-input"
19146
19168
  }, {
@@ -19150,11 +19172,11 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
19150
19172
  _: 1
19151
19173
  }, 8, ["align"])) : createCommentVNode("", true),
19152
19174
  withDirectives(createElementVNode("select", {
19153
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef$1(value) ? value.value = $event : null),
19175
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef$1(value) ? value.value = $event : null),
19154
19176
  class: normalizeClass(unref$1(computedClassSelect)),
19155
19177
  disabled: __props.disabled,
19156
- onClick: _cache[1] || (_cache[1] = ($event) => onClick($event)),
19157
- onChange: _cache[2] || (_cache[2] = ($event) => onChange2($event))
19178
+ onClick: _cache[2] || (_cache[2] = ($event) => onClick($event)),
19179
+ onChange: _cache[3] || (_cache[3] = ($event) => onChange2($event))
19158
19180
  }, [
19159
19181
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref$1(filteredOptions), (option) => {
19160
19182
  return openBlock(), createElementBlock("option", {
@@ -19169,7 +19191,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
19169
19191
  };
19170
19192
  }
19171
19193
  });
19172
- var ckSelect = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-7c5ab996"]]);
19194
+ var ckSelect = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-bf9787dc"]]);
19173
19195
  var ckSwitch_vue_vue_type_style_index_0_scoped_true_lang = "";
19174
19196
  const _withScopeId = (n) => (pushScopeId("data-v-7e2f20c4"), n = n(), popScopeId(), n);
19175
19197
  const _hoisted_1$3 = ["disabled"];