@hunter-industries/hunter-components 0.0.89 → 0.0.90
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/hunter-components.js +41 -26
- package/dist/hunter-components.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/dist/types/components/Dropdown/Dropdown.vue.d.ts.map +1 -1
- package/dist/types/components/Dropdown/DropdownList/DropdownList.vue.d.ts +6 -2
- package/dist/types/components/Dropdown/DropdownList/DropdownList.vue.d.ts.map +1 -1
- package/dist/types/types/ui.d.ts +2 -0
- package/dist/types/types/ui.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -2809,7 +2809,8 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
2809
2809
|
id: {},
|
|
2810
2810
|
selected: {},
|
|
2811
2811
|
variant: {},
|
|
2812
|
-
showClearButton: { type: Boolean }
|
|
2812
|
+
showClearButton: { type: Boolean },
|
|
2813
|
+
listMaxHeight: {}
|
|
2813
2814
|
},
|
|
2814
2815
|
emits: ["selectOption"],
|
|
2815
2816
|
setup(__props, { emit: __emit }) {
|
|
@@ -2820,9 +2821,18 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
2820
2821
|
const listOptions = computed(
|
|
2821
2822
|
() => props.options.filter((item) => !item.placeholder) || []
|
|
2822
2823
|
);
|
|
2823
|
-
const
|
|
2824
|
+
const resolvedMaxHeight = computed(() => props.listMaxHeight ?? 244);
|
|
2825
|
+
const scrollStyle = computed(() => {
|
|
2826
|
+
if (!isScrollable.value)
|
|
2827
|
+
return void 0;
|
|
2828
|
+
return {
|
|
2829
|
+
maxHeight: `${resolvedMaxHeight.value}px`,
|
|
2830
|
+
overflowY: "auto"
|
|
2831
|
+
};
|
|
2832
|
+
});
|
|
2833
|
+
function handleSelectedOption(option) {
|
|
2824
2834
|
emit("selectOption", option);
|
|
2825
|
-
}
|
|
2835
|
+
}
|
|
2826
2836
|
return (_ctx, _cache) => {
|
|
2827
2837
|
return openBlock(), createElementBlock("div", {
|
|
2828
2838
|
id: `dropdown-list-${_ctx.id}`,
|
|
@@ -2832,7 +2842,8 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
2832
2842
|
createElementVNode("div", _hoisted_2$6, [
|
|
2833
2843
|
createElementVNode("ol", {
|
|
2834
2844
|
ref: "dropdown",
|
|
2835
|
-
class:
|
|
2845
|
+
class: "hunter-dropdown-ol",
|
|
2846
|
+
style: normalizeStyle(scrollStyle.value)
|
|
2836
2847
|
}, [
|
|
2837
2848
|
(openBlock(true), createElementBlock(Fragment, null, renderList(listOptions.value, (item) => {
|
|
2838
2849
|
return openBlock(), createElementBlock("li", {
|
|
@@ -2857,13 +2868,13 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
2857
2868
|
onClick: _cache[0] || (_cache[0] = ($event) => handleSelectedOption({ id: null, name: null }))
|
|
2858
2869
|
}, " Clear Selection ")) : createCommentVNode("", true)
|
|
2859
2870
|
])
|
|
2860
|
-
],
|
|
2871
|
+
], 4)
|
|
2861
2872
|
])
|
|
2862
2873
|
], 10, _hoisted_1$8);
|
|
2863
2874
|
};
|
|
2864
2875
|
}
|
|
2865
2876
|
});
|
|
2866
|
-
const DropdownList = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-
|
|
2877
|
+
const DropdownList = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-ce8d21c1"]]);
|
|
2867
2878
|
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
2868
2879
|
__name: "DropdownListWithFilter",
|
|
2869
2880
|
props: {
|
|
@@ -3074,7 +3085,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
3074
3085
|
dropdownClassName: {},
|
|
3075
3086
|
disabled: { type: Boolean },
|
|
3076
3087
|
scrollable: { type: Boolean },
|
|
3077
|
-
showClearButton: { type: Boolean }
|
|
3088
|
+
showClearButton: { type: Boolean },
|
|
3089
|
+
listMaxHeight: {}
|
|
3078
3090
|
},
|
|
3079
3091
|
emits: ["selectOption"],
|
|
3080
3092
|
setup(__props, { emit: __emit }) {
|
|
@@ -3092,11 +3104,11 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
3092
3104
|
const collapsed = ref(true);
|
|
3093
3105
|
const selectedItem = ref();
|
|
3094
3106
|
const dropdownButtonText = ref(
|
|
3095
|
-
props.defaultText || props.placeholderText ||
|
|
3107
|
+
props.defaultText || props.placeholderText || ""
|
|
3096
3108
|
);
|
|
3097
3109
|
watch(collapsed, (value) => {
|
|
3098
3110
|
if (value === false) {
|
|
3099
|
-
|
|
3111
|
+
document.addEventListener("click", handleOutsideClick);
|
|
3100
3112
|
} else {
|
|
3101
3113
|
document.removeEventListener("click", handleOutsideClick);
|
|
3102
3114
|
}
|
|
@@ -3109,34 +3121,35 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
3109
3121
|
const toggleDropdown = () => {
|
|
3110
3122
|
collapsed.value = !collapsed.value;
|
|
3111
3123
|
};
|
|
3112
|
-
|
|
3113
|
-
var _a;
|
|
3124
|
+
function handleSelectedOption(item) {
|
|
3114
3125
|
selectedItem.value = item;
|
|
3115
|
-
if (item.name === null && item.id === null) {
|
|
3116
|
-
dropdownButtonText.value = props.placeholderText ||
|
|
3126
|
+
if ((item == null ? void 0 : item.name) === null && (item == null ? void 0 : item.id) === null) {
|
|
3127
|
+
dropdownButtonText.value = props.placeholderText || "";
|
|
3117
3128
|
emit("selectOption", { id: null, name: null });
|
|
3118
|
-
return
|
|
3129
|
+
return;
|
|
3119
3130
|
}
|
|
3120
|
-
dropdownButtonText.value = item.name;
|
|
3131
|
+
dropdownButtonText.value = (item == null ? void 0 : item.name) ?? "";
|
|
3121
3132
|
setTimeout(() => {
|
|
3122
3133
|
collapsed.value = true;
|
|
3123
3134
|
}, 300);
|
|
3124
3135
|
emit("selectOption", item);
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3136
|
+
}
|
|
3137
|
+
function handleClearSelection() {
|
|
3138
|
+
selectedItem.value = null;
|
|
3139
|
+
dropdownButtonText.value = props.placeholderText || "";
|
|
3140
|
+
emit("selectOption", { id: null, name: null });
|
|
3141
|
+
collapsed.value = true;
|
|
3142
|
+
}
|
|
3143
|
+
function handleOutsideClick(e) {
|
|
3128
3144
|
var _a;
|
|
3129
3145
|
const target = e.target;
|
|
3130
3146
|
const btn = (_a = dropdownButton == null ? void 0 : dropdownButton.value) == null ? void 0 : _a.buttonEl;
|
|
3131
3147
|
if (!target || !btn || (target == null ? void 0 : target.id) !== (btn == null ? void 0 : btn.id)) {
|
|
3132
3148
|
collapsed.value = true;
|
|
3133
3149
|
}
|
|
3134
|
-
}
|
|
3150
|
+
}
|
|
3135
3151
|
onBeforeUnmount(() => {
|
|
3136
|
-
|
|
3137
|
-
"click",
|
|
3138
|
-
(e) => handleOutsideClick(e)
|
|
3139
|
-
);
|
|
3152
|
+
document.removeEventListener("click", handleOutsideClick);
|
|
3140
3153
|
});
|
|
3141
3154
|
return (_ctx, _cache) => {
|
|
3142
3155
|
var _a;
|
|
@@ -3171,14 +3184,16 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
3171
3184
|
variant: ((_a = _ctx.variant) == null ? void 0 : _a.includes("small")) ? "small" : "default",
|
|
3172
3185
|
"show-clear-button": _ctx.showClearButton,
|
|
3173
3186
|
scrollable: _ctx.scrollable,
|
|
3174
|
-
|
|
3175
|
-
|
|
3187
|
+
"list-max-height": _ctx.listMaxHeight,
|
|
3188
|
+
onSelectOption: handleSelectedOption,
|
|
3189
|
+
onClearSelection: handleClearSelection
|
|
3190
|
+
}, null, 8, ["options", "option-key", "collapsed", "selected", "variant", "show-clear-button", "scrollable", "list-max-height"])
|
|
3176
3191
|
], 8, _hoisted_1$5)
|
|
3177
3192
|
], 2);
|
|
3178
3193
|
};
|
|
3179
3194
|
}
|
|
3180
3195
|
});
|
|
3181
|
-
const Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-
|
|
3196
|
+
const Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-257d9ae4"]]);
|
|
3182
3197
|
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
3183
3198
|
__name: "ButtonDropdownColors",
|
|
3184
3199
|
props: {
|