@deskhero/dh_ui 1.59.5 → 2.0.1

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,64 @@ 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 > 20) {
24946
+ return selected.value.substring(0, 17) + "...";
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
+ setLabel();
24934
24958
  });
24959
+ watch(() => props.selectedOption, (newValue) => {
24960
+ if (newValue) {
24961
+ selectedIndex.value = getOptionIndex(newValue);
24962
+ } else {
24963
+ selectedIndex.value = 0;
24964
+ }
24965
+ setLabel();
24966
+ }, { deep: true });
24935
24967
  function update() {
24936
- emit("update", name.value.value, selected.value, props.inputIndex);
24968
+ emit("update", name.value.value, props.options[selectedIndex.value]);
24969
+ }
24970
+ function clear2() {
24971
+ emit("clear");
24972
+ }
24973
+ function setLabel() {
24974
+ selected.value = props.options[selectedIndex.value][props.labelProp];
24975
+ }
24976
+ function getOptionIndex(option) {
24977
+ return props.options.findIndex((e2) => e2[props.valueProp] === option[props.valueProp]);
24937
24978
  }
24938
- watch(() => props.inputFirstValue, (value) => {
24939
- name.value.value = value;
24940
- emit("update", name.value.value, selected.value, props.inputIndex);
24941
- });
24942
24979
  return (_ctx, _cache) => {
24943
24980
  return openBlock(), createElementBlock("div", _hoisted_1$d, [
24944
24981
  createElementVNode("input", {
@@ -24964,37 +25001,46 @@ const _sfc_main$d = {
24964
25001
  createElementVNode("div", {
24965
25002
  class: normalizeClass(["custom__select_selected", { "custom__select--open": open.value }]),
24966
25003
  onClick: _cache[0] || (_cache[0] = ($event) => open.value = !open.value)
24967
- }, toDisplayString(selected.value), 3),
24968
- typeof __props.list[0] === "object" ? (openBlock(), createElementBlock("div", {
25004
+ }, toDisplayString(unref(displayText)), 3),
25005
+ typeof __props.options[0] === "object" ? (openBlock(), createElementBlock("div", {
24969
25006
  key: 0,
24970
25007
  class: normalizeClass(["custom__select_items", { "custom__select--hide": !open.value }])
24971
25008
  }, [
24972
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.list, (option, index) => {
25009
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
24973
25010
  return openBlock(), createElementBlock("div", {
24974
25011
  key: index,
24975
25012
  onClick: ($event) => {
24976
25013
  selected.value = option[__props.labelProp];
25014
+ selectedIndex.value = index;
24977
25015
  open.value = false;
24978
25016
  update();
24979
25017
  }
24980
25018
  }, toDisplayString(option[__props.labelProp]), 9, _hoisted_5$3);
24981
25019
  }), 128))
24982
25020
  ], 2)) : createCommentVNode("", true),
24983
- typeof __props.list[0] === "string" ? (openBlock(), createElementBlock("div", {
25021
+ typeof __props.options[0] === "string" ? (openBlock(), createElementBlock("div", {
24984
25022
  key: 1,
24985
25023
  class: normalizeClass(["custom__select_items", { "custom__select--hide": !open.value }])
24986
25024
  }, [
24987
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.list, (option, index) => {
25025
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
24988
25026
  return openBlock(), createElementBlock("div", {
24989
25027
  key: index,
24990
25028
  onClick: ($event) => {
24991
25029
  selected.value = option;
25030
+ selectedIndex.value = index;
24992
25031
  open.value = false;
24993
25032
  update();
24994
25033
  }
24995
25034
  }, toDisplayString(option), 9, _hoisted_6$3);
24996
25035
  }), 128))
24997
- ], 2)) : createCommentVNode("", true)
25036
+ ], 2)) : createCommentVNode("", true),
25037
+ props.isClearable ? (openBlock(), createElementBlock("div", _hoisted_7$3, [
25038
+ createVNode(DhButton, {
25039
+ icon: "close",
25040
+ onClick: clear2,
25041
+ color: "ghost"
25042
+ })
25043
+ ])) : createCommentVNode("", true)
24998
25044
  ], 40, _hoisted_4$7)
24999
25045
  ])
25000
25046
  ]);
@@ -25009,7 +25055,13 @@ const _sfc_main$c = {
25009
25055
  props: {
25010
25056
  labelProp: {
25011
25057
  type: String,
25012
- default: "Label"
25058
+ required: false,
25059
+ default: "label"
25060
+ },
25061
+ valueProp: {
25062
+ type: String,
25063
+ required: false,
25064
+ default: "id"
25013
25065
  },
25014
25066
  icon: {
25015
25067
  type: String,
@@ -25017,6 +25069,7 @@ const _sfc_main$c = {
25017
25069
  },
25018
25070
  placeholderInput: {
25019
25071
  type: String,
25072
+ required: false,
25020
25073
  default: "Enter value"
25021
25074
  },
25022
25075
  tabindex: {
@@ -25024,48 +25077,42 @@ const _sfc_main$c = {
25024
25077
  required: false,
25025
25078
  default: 0
25026
25079
  },
25027
- inputIndex: {
25028
- type: Number,
25029
- required: false,
25030
- default: 0
25031
- },
25032
25080
  inputWidth: {
25033
25081
  type: String,
25034
25082
  required: false,
25035
25083
  default: "75%"
25036
25084
  },
25037
- multipleProp: {
25085
+ value: {
25038
25086
  type: Array,
25039
25087
  required: true
25040
25088
  },
25041
- inputFirstValue: {
25042
- type: String,
25043
- required: false,
25044
- default: null
25089
+ options: {
25090
+ type: Array,
25091
+ required: true
25045
25092
  }
25046
25093
  },
25047
25094
  emits: ["update"],
25048
25095
  setup(__props, { emit }) {
25049
25096
  const props = __props;
25050
- const multiple = reactive(props.multipleProp);
25051
- function updateDropdown(name, email, index) {
25097
+ const multiple = reactive(props.value);
25098
+ function updateDropdown(index, input, option) {
25052
25099
  if (multiple) {
25053
- multiple.map((item) => {
25054
- if (item.id === index) {
25055
- item.input = name;
25056
- item.optionSelected = email;
25057
- }
25058
- });
25100
+ multiple[index].input = input;
25101
+ multiple[index].selectedOption = option;
25102
+ emit("update", multiple);
25103
+ }
25104
+ }
25105
+ function removeItem(index) {
25106
+ if (multiple.length > 1) {
25107
+ multiple.splice(index, 1);
25059
25108
  emit("update", multiple);
25060
25109
  }
25061
25110
  }
25062
25111
  function addMultiple() {
25063
25112
  if (multiple) {
25064
25113
  multiple.push({
25065
- id: multiple.length + 1,
25066
- list: multiple[0].list,
25067
25114
  input: null,
25068
- optionSelected: null
25115
+ selectedOption: null
25069
25116
  });
25070
25117
  }
25071
25118
  }
@@ -25087,15 +25134,18 @@ const _sfc_main$c = {
25087
25134
  return openBlock(), createBlock(_sfc_main$d, {
25088
25135
  key: index,
25089
25136
  icon: props.icon,
25090
- "input-first-value": props.inputFirstValue,
25091
- "input-index": item.id,
25137
+ "selected-option": item.selectedOption,
25092
25138
  "input-value": item.input,
25093
25139
  "input-width": props.inputWidth,
25094
- list: item.list,
25140
+ options: props.options,
25095
25141
  "placeholder-input": props.placeholderInput,
25096
25142
  tabindex: props.tabindex,
25097
- onUpdate: updateDropdown
25098
- }, null, 8, ["icon", "input-first-value", "input-index", "input-value", "input-width", "list", "placeholder-input", "tabindex"]);
25143
+ onUpdate: (input, label, optionId) => updateDropdown(index, input, label),
25144
+ "label-prop": props.labelProp,
25145
+ "value-prop": props.valueProp,
25146
+ "is-clearable": "",
25147
+ onClear: ($event) => removeItem(index)
25148
+ }, null, 8, ["icon", "selected-option", "input-value", "input-width", "options", "placeholder-input", "tabindex", "onUpdate", "label-prop", "value-prop", "onClear"]);
25099
25149
  }), 128))
25100
25150
  ], 64);
25101
25151
  };