@ctsy/layui-vue
Version:
a component library for Vue 3 base on layui-vue
887 lines (886 loc) • 30.1 kB
JavaScript
import { defineComponent, ref, resolveComponent, openBlock, createElementBlock, withModifiers, normalizeClass, createVNode, withCtx, createElementVNode, normalizeStyle, toRef, unref } from "vue";
var index = "";
const traps = {
mousemoveoutside: new WeakMap(),
clickoutside: new WeakMap()
};
function createTrapHandler(name, el, originalHandler) {
if (name === "mousemoveoutside") {
const moveHandler = (e) => {
if (el.contains(e.target))
return;
originalHandler(e);
};
return {
mousemove: moveHandler,
touchstart: moveHandler
};
} else if (name === "clickoutside") {
let mouseDownOutside = false;
const downHandler = (e) => {
mouseDownOutside = !el.contains(e.target);
};
const upHanlder = (e) => {
if (!mouseDownOutside)
return;
if (el.contains(e.target))
return;
originalHandler(e);
};
return {
mousedown: downHandler,
mouseup: upHanlder,
touchstart: downHandler,
touchend: upHanlder
};
}
console.error(`[evtd/create-trap-handler]: name \`${name}\` is invalid. This could be a bug of evtd.`);
return {};
}
function ensureTrapHandlers(name, el, handler) {
const handlers = traps[name];
let elHandlers = handlers.get(el);
if (elHandlers === void 0) {
handlers.set(el, elHandlers = new WeakMap());
}
let trapHandler = elHandlers.get(handler);
if (trapHandler === void 0) {
elHandlers.set(handler, trapHandler = createTrapHandler(name, el, handler));
}
return trapHandler;
}
function trapOn(name, el, handler, options) {
if (name === "mousemoveoutside" || name === "clickoutside") {
const trapHandlers = ensureTrapHandlers(name, el, handler);
Object.keys(trapHandlers).forEach((key) => {
on(key, document, trapHandlers[key], options);
});
return true;
}
return false;
}
function trapOff(name, el, handler, options) {
if (name === "mousemoveoutside" || name === "clickoutside") {
const trapHandlers = ensureTrapHandlers(name, el, handler);
Object.keys(trapHandlers).forEach((key) => {
off(key, document, trapHandlers[key], options);
});
return true;
}
return false;
}
function createDelegate() {
if (typeof window === "undefined") {
return {
on: () => {
},
off: () => {
}
};
}
const propagationStopped = new WeakMap();
const immediatePropagationStopped = new WeakMap();
function trackPropagation() {
propagationStopped.set(this, true);
}
function trackImmediate() {
propagationStopped.set(this, true);
immediatePropagationStopped.set(this, true);
}
function spy(event, propName, fn) {
const source = event[propName];
event[propName] = function() {
fn.apply(event, arguments);
return source.apply(event, arguments);
};
return event;
}
function unspy(event, propName) {
event[propName] = Event.prototype[propName];
}
const currentTargets = new WeakMap();
const currentTargetDescriptor = Object.getOwnPropertyDescriptor(Event.prototype, "currentTarget");
function getCurrentTarget() {
var _a;
return (_a = currentTargets.get(this)) !== null && _a !== void 0 ? _a : null;
}
function defineCurrentTarget(event, getter) {
if (currentTargetDescriptor === void 0)
return;
Object.defineProperty(event, "currentTarget", {
configurable: true,
enumerable: true,
get: getter !== null && getter !== void 0 ? getter : currentTargetDescriptor.get
});
}
const phaseToTypeToElToHandlers = {
bubble: {},
capture: {}
};
const typeToWindowEventHandlers = {};
function createUnifiedHandler() {
const delegeteHandler = function(e) {
const { type, eventPhase, target, bubbles } = e;
if (eventPhase === 2)
return;
const phase = eventPhase === 1 ? "capture" : "bubble";
let cursor = target;
const path = [];
while (true) {
if (cursor === null)
cursor = window;
path.push(cursor);
if (cursor === window) {
break;
}
cursor = cursor.parentNode || null;
}
const captureElToHandlers = phaseToTypeToElToHandlers.capture[type];
const bubbleElToHandlers = phaseToTypeToElToHandlers.bubble[type];
spy(e, "stopPropagation", trackPropagation);
spy(e, "stopImmediatePropagation", trackImmediate);
defineCurrentTarget(e, getCurrentTarget);
if (phase === "capture") {
if (captureElToHandlers === void 0)
return;
for (let i = path.length - 1; i >= 0; --i) {
if (propagationStopped.has(e))
break;
const target2 = path[i];
const handlers = captureElToHandlers.get(target2);
if (handlers !== void 0) {
currentTargets.set(e, target2);
for (const handler of handlers) {
if (immediatePropagationStopped.has(e))
break;
handler(e);
}
}
if (i === 0 && !bubbles && bubbleElToHandlers !== void 0) {
const bubbleHandlers = bubbleElToHandlers.get(target2);
if (bubbleHandlers !== void 0) {
for (const handler of bubbleHandlers) {
if (immediatePropagationStopped.has(e))
break;
handler(e);
}
}
}
}
} else if (phase === "bubble") {
if (bubbleElToHandlers === void 0)
return;
for (let i = 0; i < path.length; ++i) {
if (propagationStopped.has(e))
break;
const target2 = path[i];
const handlers = bubbleElToHandlers.get(target2);
if (handlers !== void 0) {
currentTargets.set(e, target2);
for (const handler of handlers) {
if (immediatePropagationStopped.has(e))
break;
handler(e);
}
}
}
}
unspy(e, "stopPropagation");
unspy(e, "stopImmediatePropagation");
defineCurrentTarget(e);
};
delegeteHandler.displayName = "evtdUnifiedHandler";
return delegeteHandler;
}
function createUnifiedWindowEventHandler() {
const delegateHandler = function(e) {
const { type, eventPhase } = e;
if (eventPhase !== 2)
return;
const handlers = typeToWindowEventHandlers[type];
if (handlers === void 0)
return;
handlers.forEach((handler) => handler(e));
};
delegateHandler.displayName = "evtdUnifiedWindowEventHandler";
return delegateHandler;
}
const unifiedHandler = createUnifiedHandler();
const unfiendWindowEventHandler = createUnifiedWindowEventHandler();
function ensureElToHandlers(phase, type) {
const phaseHandlers = phaseToTypeToElToHandlers[phase];
if (phaseHandlers[type] === void 0) {
phaseHandlers[type] = new Map();
window.addEventListener(type, unifiedHandler, phase === "capture");
}
return phaseHandlers[type];
}
function ensureWindowEventHandlers(type) {
const windowEventHandlers = typeToWindowEventHandlers[type];
if (windowEventHandlers === void 0) {
typeToWindowEventHandlers[type] = new Set();
window.addEventListener(type, unfiendWindowEventHandler);
}
return typeToWindowEventHandlers[type];
}
function ensureHandlers(elToHandlers, el) {
let elHandlers = elToHandlers.get(el);
if (elHandlers === void 0) {
elToHandlers.set(el, elHandlers = new Set());
}
return elHandlers;
}
function handlerExist(el, phase, type, handler) {
const elToHandlers = phaseToTypeToElToHandlers[phase][type];
if (elToHandlers !== void 0) {
const handlers = elToHandlers.get(el);
if (handlers !== void 0) {
if (handlers.has(handler))
return true;
}
}
return false;
}
function windowEventHandlerExist(type, handler) {
const handlers = typeToWindowEventHandlers[type];
if (handlers !== void 0) {
if (handlers.has(handler)) {
return true;
}
}
return false;
}
function on2(type, el, handler, options) {
let mergedHandler;
if (typeof options === "object" && options.once === true) {
mergedHandler = (e) => {
off2(type, el, mergedHandler, options);
handler(e);
};
} else {
mergedHandler = handler;
}
const trapped = trapOn(type, el, mergedHandler, options);
if (trapped)
return;
const phase = options === true || typeof options === "object" && options.capture === true ? "capture" : "bubble";
const elToHandlers = ensureElToHandlers(phase, type);
const handlers = ensureHandlers(elToHandlers, el);
if (!handlers.has(mergedHandler))
handlers.add(mergedHandler);
if (el === window) {
const windowEventHandlers = ensureWindowEventHandlers(type);
if (!windowEventHandlers.has(mergedHandler)) {
windowEventHandlers.add(mergedHandler);
}
}
}
function off2(type, el, handler, options) {
const trapped = trapOff(type, el, handler, options);
if (trapped)
return;
const capture = options === true || typeof options === "object" && options.capture === true;
const phase = capture ? "capture" : "bubble";
const elToHandlers = ensureElToHandlers(phase, type);
const handlers = ensureHandlers(elToHandlers, el);
if (el === window) {
const mirrorPhase = capture ? "bubble" : "capture";
if (!handlerExist(el, mirrorPhase, type, handler) && windowEventHandlerExist(type, handler)) {
const windowEventHandlers = typeToWindowEventHandlers[type];
windowEventHandlers.delete(handler);
if (windowEventHandlers.size === 0) {
window.removeEventListener(type, unfiendWindowEventHandler);
typeToWindowEventHandlers[type] = void 0;
}
}
}
if (handlers.has(handler))
handlers.delete(handler);
if (handlers.size === 0) {
elToHandlers.delete(el);
}
if (elToHandlers.size === 0) {
window.removeEventListener(type, unifiedHandler, phase === "capture");
phaseToTypeToElToHandlers[phase][type] = void 0;
}
}
return {
on: on2,
off: off2
};
}
const { on, off } = createDelegate();
function throttle(func) {
let timer = null;
return function(args) {
if (!timer) {
timer = setTimeout(() => {
timer = null;
func(args);
}, 30);
}
};
}
function handle_select(e) {
e.preventDefault();
}
const _hoisted_1$4 = ["onMousedown"];
const _hoisted_2$4 = /* @__PURE__ */ createElementVNode("div", { class: "layui-slider-line-v" }, null, -1);
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
props: {
val: { default: 0 },
disabled: { type: Boolean, default: false },
step: { default: 0 },
min: { default: 0 },
max: { default: 100 }
},
emits: ["link-val-hook"],
setup(__props, { emit }) {
const props = __props;
const moveAction = throttle(standardMove);
function handle_mouseup() {
off("selectstart", document, handle_select);
off("mouseup", window, handle_mouseup);
off("mousemove", window, moveAction);
tooptipHide.value = true;
}
function handle_mousedown() {
on("selectstart", window, handle_select, { once: true });
on("mouseup", window, handle_mouseup);
on("mousemove", window, moveAction);
}
const tracker = ref(null);
let standard_style = ref(props.val);
const tooptipHide = ref(true);
function standardMove(e) {
tooptipHide.value = false;
if (!tracker.value) {
return;
}
let tracker_rect = tracker.value.getBoundingClientRect();
let origin_left = tracker_rect.left;
let point_left = e.clientX;
let distance = point_left - origin_left;
if (distance < props.min) {
standard_style.value = props.min;
} else {
let rate = distance / tracker_rect.width * 100;
calcWithStep(rate, standard_style);
if (standard_style.value > props.max) {
standard_style.value = props.max;
}
}
emit("link-val-hook", standard_style.value);
}
function calcWithStep(rate, val) {
if (typeof rate === "undefined")
return false;
if (typeof val.value === "number") {
let r = rate - val.value;
if (Math.abs(r) < props.step) {
return false;
}
if (props.step === 0)
val.value = Math.floor(rate);
if (r < 0 && props.step !== 0) {
val.value -= props.step;
} else {
val.value += props.step;
}
}
}
return (_ctx, _cache) => {
const _component_lay_tooltip = resolveComponent("lay-tooltip");
return openBlock(), createElementBlock("div", {
ref_key: "tracker",
ref: tracker,
onMousedown: withModifiers(handle_mousedown, ["stop"]),
class: normalizeClass(["layui-slider-track-v", [__props.disabled ? "layui-slider-disabled" : ""]])
}, [
createVNode(_component_lay_tooltip, {
content: "" + __props.val,
"is-can-hide": tooptipHide.value
}, {
default: withCtx(() => [
createElementVNode("div", {
style: normalizeStyle({ left: __props.val + "%" }),
class: normalizeClass(["layui-slider-btn-v", [__props.disabled ? "layui-slider-disabled disable-btn" : ""]])
}, null, 6)
]),
_: 1
}, 8, ["content", "is-can-hide"]),
createElementVNode("div", {
style: normalizeStyle({ width: __props.val + "%" }),
class: normalizeClass(["layui-slider-rate-v", [__props.disabled ? "layui-slider-disabled disable-line" : ""]])
}, null, 6),
_hoisted_2$4
], 42, _hoisted_1$4);
};
}
});
const _hoisted_1$3 = ["onMousedown"];
const _hoisted_2$3 = /* @__PURE__ */ createElementVNode("div", { class: "layui-slider-line-v" }, null, -1);
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
props: {
rangeValue: null,
disabled: { type: Boolean, default: false },
step: { default: 0 },
min: { default: 0 },
max: { default: 100 }
},
emits: ["link-val-hook"],
setup(__props, { emit }) {
const props = __props;
let rv = toRef(props, "rangeValue");
const moveAction = throttle(rangeMove);
let currbtn = -1;
function handle_mousedown() {
currbtn = -1;
tooptipHide.value = false;
on("selectstart", window, handle_select2, { once: true });
on("mouseup", window, handle_mouseup);
on("mousemove", window, moveAction);
}
function handle_mouseup() {
tooptipHide.value = true;
off("selectstart", document, handle_select2);
off("mouseup", window, handle_mouseup);
off("mousemove", window, moveAction);
}
function handle_select2(e) {
e.preventDefault();
}
const tracker = ref(null);
const tooptipHide = ref(true);
function rangeMove(e) {
if (!tracker.value) {
return;
}
let tracker_rect = tracker.value.getBoundingClientRect();
let origin_left = tracker_rect.left;
let point_left = e.clientX;
let distance = point_left - origin_left;
if (distance < props.min) {
rv.value[0] = props.min;
} else {
let rate = distance / tracker_rect.width * 100;
let idx = -1;
if (currbtn === -1) {
currbtn = moveNeighbors(Math.floor(rate), rv);
idx = currbtn;
} else {
idx = currbtn;
}
calcWithStep(rate, rv, idx);
if (rv.value[1] > props.max) {
rv.value[1] = props.max;
}
if (rv.value[0] < props.min) {
rv.value[0] = props.min;
}
}
emit("link-val-hook", rv.value);
}
function moveNeighbors(rate, rangeValues) {
let d1 = Math.abs(rate - rangeValues.value[0]);
let d2 = Math.abs(rate - rangeValues.value[1]);
if (d1 > d2) {
return 1;
} else {
return 0;
}
}
function calcWithStep(rate, val, idx = -1) {
if (typeof rate === "undefined")
return false;
if (typeof val.value === "object") {
let r = rate - val.value[idx];
if (Math.abs(r) < props.step) {
return false;
}
if (props.step === 0)
val.value[idx] = Math.floor(rate);
if (Array.isArray(val.value)) {
if (r < 0 && props.step !== 0) {
val.value[idx] -= props.step;
} else {
val.value[idx] += props.step;
}
cross(val);
}
}
}
function cross(val) {
if (val.value[0] > val.value[1]) {
let tmp = val.value[0];
val.value[0] = val.value[1];
val.value[1] = tmp;
currbtn = currbtn === 0 ? 1 : 0;
}
}
return (_ctx, _cache) => {
const _component_lay_tooltip = resolveComponent("lay-tooltip");
return openBlock(), createElementBlock("div", {
ref_key: "tracker",
ref: tracker,
onMousedown: withModifiers(handle_mousedown, ["stop"]),
class: normalizeClass(["layui-slider-srange", [__props.disabled ? "layui-slider-disabled" : ""]])
}, [
createVNode(_component_lay_tooltip, {
content: "" + unref(rv)[0],
"is-can-hide": tooptipHide.value
}, {
default: withCtx(() => [
createElementVNode("div", {
style: normalizeStyle({ left: unref(rv)[0] + "%" }),
class: normalizeClass(["layui-slider-btn-v", [props.disabled ? "layui-slider-disabled disable-btn" : ""]])
}, null, 6)
]),
_: 1
}, 8, ["content", "is-can-hide"]),
createVNode(_component_lay_tooltip, {
content: "" + unref(rv)[1],
"is-can-hide": tooptipHide.value
}, {
default: withCtx(() => [
createElementVNode("div", {
style: normalizeStyle({ left: unref(rv)[1] + "%" }),
class: normalizeClass(["layui-slider-btn-v", [props.disabled ? "layui-slider-disabled disable-btn" : ""]])
}, null, 6)
]),
_: 1
}, 8, ["content", "is-can-hide"]),
_hoisted_2$3,
createElementVNode("div", {
style: normalizeStyle({
width: unref(rv)[1] - unref(rv)[0] + "%",
left: unref(rv)[0] + "%"
}),
class: normalizeClass(["layui-slider-rate-v", [props.disabled ? "layui-slider-disabled disable-line" : ""]])
}, null, 6)
], 42, _hoisted_1$3);
};
}
});
const _hoisted_1$2 = { class: "layui-slider-vertical" };
const _hoisted_2$2 = ["onMousedown"];
const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("div", { class: "layui-slider-vertical-line" }, null, -1);
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
props: {
val: { default: 0 },
disabled: { type: Boolean, default: true },
step: { default: 0 },
min: { default: 0 },
max: { default: 100 }
},
emits: ["link-val-hook"],
setup(__props, { emit }) {
const props = __props;
const moveAction = throttle(verticalMove);
function handle_mouseup() {
off("selectstart", document, handle_select2);
off("mouseup", window, handle_mouseup);
off("mousemove", window, moveAction);
tooptipHide.value = true;
}
function handle_select2(e) {
e.preventDefault();
}
function handle_mousedown() {
on("selectstart", window, handle_select2, { once: true });
on("mouseup", window, handle_mouseup);
on("mousemove", window, moveAction);
}
const tracker = ref(null);
let vertical_style = ref(props.val);
const tooptipHide = ref(true);
function verticalMove(e) {
tooptipHide.value = false;
if (!tracker.value) {
return;
}
let tracker_rect = tracker.value.getBoundingClientRect();
let origin_bottom = tracker_rect.bottom;
let point_bottom = e.clientY;
let distance = (point_bottom - origin_bottom) * -1;
if (distance < props.min) {
vertical_style.value = props.min;
} else {
let rate = distance / tracker_rect.height * 100;
calcWithStep(rate, vertical_style);
if (vertical_style.value > props.max) {
vertical_style.value = props.max;
}
}
emit("link-val-hook", vertical_style.value);
}
function calcWithStep(rate, val) {
if (typeof rate === "undefined")
return false;
if (typeof val.value === "number") {
let r = rate - val.value;
if (Math.abs(r) < props.step) {
return false;
}
if (props.step === 0)
val.value = Math.floor(rate);
if (r < 0 && props.step !== 0) {
val.value -= props.step;
} else {
val.value += props.step;
}
}
}
return (_ctx, _cache) => {
const _component_lay_tooltip = resolveComponent("lay-tooltip");
return openBlock(), createElementBlock("div", _hoisted_1$2, [
createElementVNode("div", {
onMousedown: withModifiers(handle_mousedown, ["stop"]),
ref_key: "tracker",
ref: tracker,
class: normalizeClass([[__props.disabled ? "layui-slider-disabled" : ""], "layui-slider-vertical-track"])
}, [
createVNode(_component_lay_tooltip, {
content: "" + __props.val,
"is-can-hide": tooptipHide.value
}, {
default: withCtx(() => [
createElementVNode("div", {
style: normalizeStyle({ bottom: __props.val + "%" }),
class: normalizeClass([[props.disabled ? "layui-slider-disabled disable-btn" : ""], "layui-slider-vertical-btn"])
}, null, 6)
]),
_: 1
}, 8, ["content", "is-can-hide"]),
createElementVNode("div", {
style: normalizeStyle({ height: __props.val + "%" }),
class: normalizeClass([[props.disabled ? "layui-slider-disabled disable-line" : ""], "layui-slider-vertical-rate"])
}, null, 6),
_hoisted_3$2
], 42, _hoisted_2$2)
]);
};
}
});
const _hoisted_1$1 = { class: "layui-slider-vertical" };
const _hoisted_2$1 = ["onMousedown"];
const _hoisted_3$1 = /* @__PURE__ */ createElementVNode("div", { class: "layui-slider-vertical-line" }, null, -1);
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
props: {
rangeValue: null,
disabled: { type: Boolean, default: false },
step: { default: 0 },
min: { default: 0 },
max: { default: 100 }
},
emits: ["link-val-hook"],
setup(__props, { emit }) {
const props = __props;
let rv = toRef(props, "rangeValue");
const moveAction = throttle(rangeMove);
let currbtn = -1;
function handle_mousedown() {
currbtn = -1;
tooptipHide.value = false;
on("selectstart", window, handle_select2, { once: true });
on("mouseup", window, handle_mouseup);
on("mousemove", window, moveAction);
}
function handle_mouseup() {
tooptipHide.value = true;
off("selectstart", document, handle_select2);
off("mouseup", window, handle_mouseup);
off("mousemove", window, moveAction);
}
function handle_select2(e) {
e.preventDefault();
}
const tracker = ref(null);
const tooptipHide = ref(true);
function rangeMove(e) {
if (!tracker.value) {
return;
}
let tracker_rect = tracker.value.getBoundingClientRect();
let origin_bottom = tracker_rect.bottom;
let point_bottom = e.clientY;
let distance = (point_bottom - origin_bottom) * -1;
if (distance < props.min) {
rv.value[0] = props.min;
} else {
let rate = distance / tracker_rect.height * 100;
let idx = -1;
if (currbtn === -1) {
currbtn = moveNeighbors(Math.floor(rate), rv);
idx = currbtn;
} else {
idx = currbtn;
}
calcWithStep(rate, rv, idx);
if (rv.value[1] > props.max) {
rv.value[1] = props.max;
}
if (rv.value[0] < props.min) {
rv.value[0] = props.min;
}
}
emit("link-val-hook", rv.value);
}
function moveNeighbors(rate, rangeValues) {
let d1 = Math.abs(rate - rangeValues.value[0]);
let d2 = Math.abs(rate - rangeValues.value[1]);
if (d1 > d2) {
return 1;
} else {
return 0;
}
}
function calcWithStep(rate, val, idx = -1) {
if (typeof rate === "undefined")
return false;
if (typeof val.value === "object") {
let r = rate - val.value[idx];
if (Math.abs(r) < props.step) {
return false;
}
if (props.step === 0)
val.value[idx] = Math.floor(rate);
if (Array.isArray(val.value)) {
if (r < 0 && props.step !== 0) {
val.value[idx] -= props.step;
} else {
val.value[idx] += props.step;
}
cross(val);
}
}
}
function cross(val) {
if (val.value[0] > val.value[1]) {
let tmp = val.value[0];
val.value[0] = val.value[1];
val.value[1] = tmp;
currbtn = currbtn === 0 ? 1 : 0;
}
}
return (_ctx, _cache) => {
const _component_lay_tooltip = resolveComponent("lay-tooltip");
return openBlock(), createElementBlock("div", _hoisted_1$1, [
createElementVNode("div", {
ref_key: "tracker",
ref: tracker,
onMousedown: withModifiers(handle_mousedown, ["stop"]),
class: normalizeClass(["layui-slider-vrange", [__props.disabled ? "layui-slider-disabled" : ""]])
}, [
createVNode(_component_lay_tooltip, {
content: "" + unref(rv)[1],
"is-can-hide": tooptipHide.value
}, {
default: withCtx(() => [
createElementVNode("div", {
style: normalizeStyle({ bottom: unref(rv)[1] + "%" }),
class: normalizeClass(["layui-slider-vertical-btn", [props.disabled ? "layui-slider-disabled disable-btn" : ""]])
}, null, 6)
]),
_: 1
}, 8, ["content", "is-can-hide"]),
createVNode(_component_lay_tooltip, {
content: "" + unref(rv)[0],
"is-can-hide": tooptipHide.value
}, {
default: withCtx(() => [
createElementVNode("div", {
style: normalizeStyle({ bottom: unref(rv)[0] + "%" }),
class: normalizeClass(["layui-slider-vertical-btn", [props.disabled ? "layui-slider-disabled disable-btn" : ""]])
}, null, 6)
]),
_: 1
}, 8, ["content", "is-can-hide"]),
_hoisted_3$1,
createElementVNode("div", {
style: normalizeStyle({
height: unref(rv)[1] - unref(rv)[0] + "%",
bottom: unref(rv)[0] + "%"
}),
class: normalizeClass(["layui-slider-vertical-rate", [props.disabled ? "layui-slider-disabled disable-line" : ""]])
}, null, 6)
], 42, _hoisted_2$1)
]);
};
}
});
const _hoisted_1 = { key: 0 };
const _hoisted_2 = { key: 0 };
const _hoisted_3 = { key: 1 };
const _hoisted_4 = { key: 1 };
const _hoisted_5 = { key: 0 };
const _hoisted_6 = { key: 1 };
const _sfc_main = /* @__PURE__ */ defineComponent({
props: {
vertical: { type: Boolean, default: false },
modelValue: { default: 0 },
min: { default: 0 },
max: { default: 100 },
step: { default: 0 },
disabled: { type: Boolean, default: false },
range: { type: Boolean },
rangeValue: null
},
emits: ["update:modelValue"],
setup(__props, { emit }) {
const props = __props;
let rangeValues = toRef(props, "rangeValue");
function valHook(val) {
emit("update:modelValue", val);
}
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", null, [
__props.vertical ? (openBlock(), createElementBlock("div", _hoisted_1, [
__props.range ? (openBlock(), createElementBlock("div", _hoisted_2, [
createVNode(_sfc_main$1, {
step: __props.step,
onLinkValHook: valHook,
disabled: __props.disabled,
rangeValue: unref(rangeValues),
min: __props.min,
max: __props.max
}, null, 8, ["step", "disabled", "rangeValue", "min", "max"])
])) : (openBlock(), createElementBlock("div", _hoisted_3, [
createVNode(_sfc_main$2, {
step: __props.step,
onLinkValHook: valHook,
disabled: __props.disabled,
val: __props.modelValue,
min: __props.min,
max: __props.max
}, null, 8, ["step", "disabled", "val", "min", "max"])
]))
])) : (openBlock(), createElementBlock("div", _hoisted_4, [
__props.range ? (openBlock(), createElementBlock("div", _hoisted_5, [
createVNode(_sfc_main$3, {
step: __props.step,
onLinkValHook: valHook,
disabled: __props.disabled,
rangeValue: unref(rangeValues),
min: __props.min,
max: __props.max
}, null, 8, ["step", "disabled", "rangeValue", "min", "max"])
])) : (openBlock(), createElementBlock("div", _hoisted_6, [
createVNode(_sfc_main$4, {
val: __props.modelValue,
onLinkValHook: valHook,
disabled: __props.disabled,
step: __props.step,
min: __props.min,
max: __props.max
}, null, 8, ["val", "disabled", "step", "min", "max"])
]))
]))
]);
};
}
});
_sfc_main.install = (app) => {
app.component(_sfc_main.name, _sfc_main);
};
export { _sfc_main as default };