@deskhero/dh_ui 1.59.5 → 2.0.0

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
@@ -23097,7 +23097,7 @@ const _hoisted_3$g = { class: "caption" };
23097
23097
  const _hoisted_4$c = { class: "min-caption" };
23098
23098
  const _hoisted_5$8 = { class: "bar-inner" };
23099
23099
  const _hoisted_6$8 = ["min", "max", "step", "value"];
23100
- const _hoisted_7$7 = { class: "caption" };
23100
+ const _hoisted_7$8 = { class: "caption" };
23101
23101
  const _hoisted_8$3 = { class: "max-caption" };
23102
23102
  const _hoisted_9$3 = {
23103
23103
  key: 0,
@@ -23164,7 +23164,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
23164
23164
  onMousedown: _cache[7] || (_cache[7] = (...args) => $options.onRightThumbMousedown && $options.onRightThumbMousedown(...args)),
23165
23165
  onTouchstart: _cache[8] || (_cache[8] = (...args) => $options.onRightThumbMousedown && $options.onRightThumbMousedown(...args))
23166
23166
  }, [
23167
- createElementVNode("div", _hoisted_7$7, [
23167
+ createElementVNode("div", _hoisted_7$8, [
23168
23168
  createElementVNode("span", _hoisted_8$3, toDisplayString($props.maxCaption || $options.barMaxVal), 1)
23169
23169
  ])
23170
23170
  ], 32),
@@ -23419,7 +23419,7 @@ const _hoisted_3$f = {
23419
23419
  const _hoisted_4$b = { class: "input-group sb-input" };
23420
23420
  const _hoisted_5$7 = ["disabled", "max", "value"];
23421
23421
  const _hoisted_6$7 = { class: "input-group sb-input" };
23422
- const _hoisted_7$6 = ["disabled", "max", "min", "value"];
23422
+ const _hoisted_7$7 = ["disabled", "max", "min", "value"];
23423
23423
  function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
23424
23424
  const _component_Bar = resolveComponent("Bar");
23425
23425
  const _component_MultiRangeSlider = resolveComponent("MultiRangeSlider");
@@ -23477,7 +23477,7 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
23477
23477
  type: "number",
23478
23478
  value: _ctx.getMaxKey,
23479
23479
  onInput: _cache[1] || (_cache[1] = ($event) => _ctx.changeMax($event))
23480
- }, null, 40, _hoisted_7$6)
23480
+ }, null, 40, _hoisted_7$7)
23481
23481
  ])
23482
23482
  ])) : createCommentVNode("", true),
23483
23483
  renderSlot(_ctx.$slots, "input", {}, void 0, true),
@@ -23500,7 +23500,7 @@ const _hoisted_3$e = { class: "dp__multi" };
23500
23500
  const _hoisted_4$a = ["value"];
23501
23501
  const _hoisted_5$6 = ["value"];
23502
23502
  const _hoisted_6$6 = /* @__PURE__ */ createTextVNode(" Back ");
23503
- const _hoisted_7$5 = ["onClick"];
23503
+ const _hoisted_7$6 = ["onClick"];
23504
23504
  const _hoisted_8$2 = ["onClick"];
23505
23505
  const _hoisted_9$2 = ["onClick"];
23506
23506
  const _hoisted_10$2 = ["onClick"];
@@ -23671,7 +23671,7 @@ const _sfc_main$o = {
23671
23671
  (openBlock(), createBlock(Teleport, { to: "#tags" }, [
23672
23672
  createElementVNode("span", {
23673
23673
  onClick: ($event) => presetDateRange(range)
23674
- }, toDisplayString(label), 9, _hoisted_7$5)
23674
+ }, toDisplayString(label), 9, _hoisted_7$6)
23675
23675
  ]))
23676
23676
  ]),
23677
23677
  week: withCtx(({ label, range, presetDateRange }) => [
@@ -23810,7 +23810,7 @@ const _hoisted_3$d = { key: 0 };
23810
23810
  const _hoisted_4$9 = { class: "list-none" };
23811
23811
  const _hoisted_5$5 = ["checked"];
23812
23812
  const _hoisted_6$5 = ["checked"];
23813
- const _hoisted_7$4 = ["checked"];
23813
+ const _hoisted_7$5 = ["checked"];
23814
23814
  function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
23815
23815
  const _component_dh_icon = resolveComponent("dh-icon");
23816
23816
  return openBlock(), createElementBlock("div", _hoisted_1$n, [
@@ -23855,7 +23855,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
23855
23855
  name: "number_filter",
23856
23856
  type: "radio",
23857
23857
  onChange: _cache[3] || (_cache[3] = ($event) => _ctx.excludeFilter())
23858
- }, null, 40, _hoisted_7$4),
23858
+ }, null, 40, _hoisted_7$5),
23859
23859
  createTextVNode(" " + toDisplayString(_ctx.excludeText), 1)
23860
23860
  ])
23861
23861
  ])
@@ -24439,7 +24439,7 @@ const _hoisted_3$a = { class: "file__upload_list_item" };
24439
24439
  const _hoisted_4$8 = { class: "file__upload_list_item_label" };
24440
24440
  const _hoisted_5$4 = ["title"];
24441
24441
  const _hoisted_6$4 = /* @__PURE__ */ createElementVNode("br", null, null, -1);
24442
- const _hoisted_7$3 = ["href"];
24442
+ const _hoisted_7$4 = ["href"];
24443
24443
  const _hoisted_8$1 = {
24444
24444
  key: 1,
24445
24445
  class: "file__upload_items"
@@ -24739,7 +24739,7 @@ const _sfc_main$e = {
24739
24739
  "icon-name": "download",
24740
24740
  size: 24
24741
24741
  })
24742
- ], 8, _hoisted_7$3),
24742
+ ], 8, _hoisted_7$4),
24743
24743
  createVNode(DhIcon, {
24744
24744
  class: "file__upload_list_delete",
24745
24745
  "icon-name": "delete",
@@ -24878,23 +24878,34 @@ const _hoisted_3$9 = { class: "input__dropdown_second" };
24878
24878
  const _hoisted_4$7 = ["tabindex"];
24879
24879
  const _hoisted_5$3 = ["onClick"];
24880
24880
  const _hoisted_6$3 = ["onClick"];
24881
+ const _hoisted_7$3 = {
24882
+ key: 2,
24883
+ class: "button__clear"
24884
+ };
24881
24885
  const _sfc_main$d = {
24882
24886
  __name: "InputDropdown",
24883
24887
  props: {
24884
- list: {
24888
+ options: {
24885
24889
  type: Array,
24886
24890
  required: true
24887
24891
  },
24888
24892
  labelProp: {
24889
24893
  type: String,
24894
+ required: false,
24890
24895
  default: "label"
24891
24896
  },
24897
+ valueProp: {
24898
+ type: String,
24899
+ required: false,
24900
+ default: "id"
24901
+ },
24892
24902
  icon: {
24893
24903
  type: String,
24894
24904
  required: true
24895
24905
  },
24896
24906
  placeholderInput: {
24897
24907
  type: String,
24908
+ required: false,
24898
24909
  default: "Enter value"
24899
24910
  },
24900
24911
  tabindex: {
@@ -24907,38 +24918,53 @@ const _sfc_main$d = {
24907
24918
  required: false,
24908
24919
  default: ""
24909
24920
  },
24910
- inputIndex: {
24911
- type: Number,
24912
- required: false,
24913
- default: 0
24914
- },
24915
24921
  inputWidth: {
24916
24922
  type: String,
24917
24923
  required: false,
24918
24924
  default: "75%"
24919
24925
  },
24920
- inputFirstValue: {
24921
- type: String,
24926
+ selectedOption: {
24927
+ type: Object,
24922
24928
  required: false,
24923
24929
  default: null
24930
+ },
24931
+ isClearable: {
24932
+ type: Boolean,
24933
+ required: false,
24934
+ default: false
24924
24935
  }
24925
24936
  },
24926
- emits: ["update"],
24937
+ emits: ["update", "clear"],
24927
24938
  setup(__props, { emit }) {
24928
24939
  const props = __props;
24929
- const selected = ref(props.list[0].label);
24940
+ const selectedIndex = ref(0);
24941
+ const selected = ref("");
24930
24942
  const open = ref(false);
24931
- const name = ref(null);
24943
+ const name = ref("");
24944
+ const displayText = computed(() => {
24945
+ if (selected.value.length > 23) {
24946
+ return selected.value.substring(0, 20) + "...";
24947
+ }
24948
+ return selected.value;
24949
+ });
24932
24950
  onMounted(() => {
24933
- emit("update", "", selected.value);
24951
+ if (props.inputValue) {
24952
+ name.value.value = props.inputValue;
24953
+ }
24954
+ if (props.selectedOption) {
24955
+ selectedIndex.value = getOptionIndex(props.selectedOption);
24956
+ }
24957
+ selected.value = props.options[selectedIndex.value].label;
24934
24958
  });
24935
24959
  function update() {
24936
- emit("update", name.value.value, selected.value, props.inputIndex);
24960
+ emit("update", name.value.value, props.options[selectedIndex.value]);
24961
+ }
24962
+ function clear2() {
24963
+ emit("clear");
24964
+ }
24965
+ function getOptionIndex(option) {
24966
+ return props.options.findIndex((e2) => e2[props.valueProp] === option[props.valueProp]);
24937
24967
  }
24938
- watch(() => props.inputFirstValue, (value) => {
24939
- name.value.value = value;
24940
- emit("update", name.value.value, selected.value, props.inputIndex);
24941
- });
24942
24968
  return (_ctx, _cache) => {
24943
24969
  return openBlock(), createElementBlock("div", _hoisted_1$d, [
24944
24970
  createElementVNode("input", {
@@ -24964,37 +24990,46 @@ const _sfc_main$d = {
24964
24990
  createElementVNode("div", {
24965
24991
  class: normalizeClass(["custom__select_selected", { "custom__select--open": open.value }]),
24966
24992
  onClick: _cache[0] || (_cache[0] = ($event) => open.value = !open.value)
24967
- }, toDisplayString(selected.value), 3),
24968
- typeof __props.list[0] === "object" ? (openBlock(), createElementBlock("div", {
24993
+ }, toDisplayString(unref(displayText)), 3),
24994
+ typeof __props.options[0] === "object" ? (openBlock(), createElementBlock("div", {
24969
24995
  key: 0,
24970
24996
  class: normalizeClass(["custom__select_items", { "custom__select--hide": !open.value }])
24971
24997
  }, [
24972
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.list, (option, index) => {
24998
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
24973
24999
  return openBlock(), createElementBlock("div", {
24974
25000
  key: index,
24975
25001
  onClick: ($event) => {
24976
25002
  selected.value = option[__props.labelProp];
25003
+ selectedIndex.value = index;
24977
25004
  open.value = false;
24978
25005
  update();
24979
25006
  }
24980
25007
  }, toDisplayString(option[__props.labelProp]), 9, _hoisted_5$3);
24981
25008
  }), 128))
24982
25009
  ], 2)) : createCommentVNode("", true),
24983
- typeof __props.list[0] === "string" ? (openBlock(), createElementBlock("div", {
25010
+ typeof __props.options[0] === "string" ? (openBlock(), createElementBlock("div", {
24984
25011
  key: 1,
24985
25012
  class: normalizeClass(["custom__select_items", { "custom__select--hide": !open.value }])
24986
25013
  }, [
24987
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.list, (option, index) => {
25014
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
24988
25015
  return openBlock(), createElementBlock("div", {
24989
25016
  key: index,
24990
25017
  onClick: ($event) => {
24991
25018
  selected.value = option;
25019
+ selectedIndex.value = index;
24992
25020
  open.value = false;
24993
25021
  update();
24994
25022
  }
24995
25023
  }, toDisplayString(option), 9, _hoisted_6$3);
24996
25024
  }), 128))
24997
- ], 2)) : createCommentVNode("", true)
25025
+ ], 2)) : createCommentVNode("", true),
25026
+ props.isClearable ? (openBlock(), createElementBlock("div", _hoisted_7$3, [
25027
+ createVNode(DhButton, {
25028
+ icon: "close",
25029
+ onClick: clear2,
25030
+ color: "ghost"
25031
+ })
25032
+ ])) : createCommentVNode("", true)
24998
25033
  ], 40, _hoisted_4$7)
24999
25034
  ])
25000
25035
  ]);
@@ -25009,7 +25044,13 @@ const _sfc_main$c = {
25009
25044
  props: {
25010
25045
  labelProp: {
25011
25046
  type: String,
25012
- default: "Label"
25047
+ required: false,
25048
+ default: "label"
25049
+ },
25050
+ valueProp: {
25051
+ type: String,
25052
+ required: false,
25053
+ default: "id"
25013
25054
  },
25014
25055
  icon: {
25015
25056
  type: String,
@@ -25017,6 +25058,7 @@ const _sfc_main$c = {
25017
25058
  },
25018
25059
  placeholderInput: {
25019
25060
  type: String,
25061
+ required: false,
25020
25062
  default: "Enter value"
25021
25063
  },
25022
25064
  tabindex: {
@@ -25024,48 +25066,41 @@ const _sfc_main$c = {
25024
25066
  required: false,
25025
25067
  default: 0
25026
25068
  },
25027
- inputIndex: {
25028
- type: Number,
25029
- required: false,
25030
- default: 0
25031
- },
25032
25069
  inputWidth: {
25033
25070
  type: String,
25034
25071
  required: false,
25035
25072
  default: "75%"
25036
25073
  },
25037
- multipleProp: {
25074
+ value: {
25038
25075
  type: Array,
25039
25076
  required: true
25040
25077
  },
25041
- inputFirstValue: {
25042
- type: String,
25043
- required: false,
25044
- default: null
25078
+ options: {
25079
+ type: Array,
25080
+ required: true
25045
25081
  }
25046
25082
  },
25047
25083
  emits: ["update"],
25048
25084
  setup(__props, { emit }) {
25049
25085
  const props = __props;
25050
- const multiple = reactive(props.multipleProp);
25051
- function updateDropdown(name, email, index) {
25086
+ const multiple = reactive(props.value);
25087
+ function updateDropdown(index, input, option) {
25052
25088
  if (multiple) {
25053
- multiple.map((item) => {
25054
- if (item.id === index) {
25055
- item.input = name;
25056
- item.optionSelected = email;
25057
- }
25058
- });
25089
+ multiple[index].input = input;
25090
+ multiple[index].selectedOption = option;
25059
25091
  emit("update", multiple);
25060
25092
  }
25061
25093
  }
25094
+ function removeItem(index) {
25095
+ if (multiple.length > 1) {
25096
+ multiple.splice(index, 1);
25097
+ }
25098
+ }
25062
25099
  function addMultiple() {
25063
25100
  if (multiple) {
25064
25101
  multiple.push({
25065
- id: multiple.length + 1,
25066
- list: multiple[0].list,
25067
25102
  input: null,
25068
- optionSelected: null
25103
+ selectedOption: null
25069
25104
  });
25070
25105
  }
25071
25106
  }
@@ -25087,15 +25122,18 @@ const _sfc_main$c = {
25087
25122
  return openBlock(), createBlock(_sfc_main$d, {
25088
25123
  key: index,
25089
25124
  icon: props.icon,
25090
- "input-first-value": props.inputFirstValue,
25091
- "input-index": item.id,
25125
+ "selected-option": item.selectedOption,
25092
25126
  "input-value": item.input,
25093
25127
  "input-width": props.inputWidth,
25094
- list: item.list,
25128
+ options: props.options,
25095
25129
  "placeholder-input": props.placeholderInput,
25096
25130
  tabindex: props.tabindex,
25097
- onUpdate: updateDropdown
25098
- }, null, 8, ["icon", "input-first-value", "input-index", "input-value", "input-width", "list", "placeholder-input", "tabindex"]);
25131
+ onUpdate: (input, label, optionId) => updateDropdown(index, input, label),
25132
+ "label-prop": props.labelProp,
25133
+ "value-prop": props.valueProp,
25134
+ "is-clearable": "",
25135
+ onClear: ($event) => removeItem(index)
25136
+ }, null, 8, ["icon", "selected-option", "input-value", "input-width", "options", "placeholder-input", "tabindex", "onUpdate", "label-prop", "value-prop", "onClear"]);
25099
25137
  }), 128))
25100
25138
  ], 64);
25101
25139
  };