@vue-js-cron/vuetify
Version:
Cron editor for vuetify
179 lines (178 loc) • 4.84 kB
JavaScript
import { cronCoreProps as e, selectProps as t, setupCron as n, setupSelect as r } from "@vue-js-cron/core";
import { Fragment as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createSlots as c, createTextVNode as l, createVNode as u, defineComponent as d, mergeProps as f, openBlock as p, renderList as m, resolveComponent as h, toDisplayString as g, withCtx as _, withModifiers as v } from "vue";
//#region src/components/select.vue?vue&type=script&lang.ts
var y = {
inheritAttrs: !1,
name: "CustomSelect",
props: {
...t(),
menuProps: {
type: Object,
default: () => {}
},
chipProps: {
type: Object,
default: () => {}
}
},
emits: ["update:model-value"],
setup(e, t) {
return r(e, () => e.modelValue, t);
},
methods: { chipIcon() {
return null;
} }
}, b = (e, t) => {
let n = e.__vccOpts || e;
for (let [e, r] of t) n[e] = r;
return n;
};
//#endregion
//#region src/components/select.vue
function x(e, t, n, r, d, y) {
let b = h("v-icon"), x = h("v-list-item"), S = h("v-col"), C = h("v-row"), w = h("v-list"), T = h("v-menu"), E = h("v-chip");
return p(), a(E, f(n.chipProps, { disabled: e.disabled }), c({
default: _(() => [l(" " + g(e.selection ?? e.selectedStr) + " ", 1), u(T, f({ activator: "parent" }, n.menuProps), {
default: _(() => [u(w, { class: "pa-0 ma-0" }, {
default: _(() => [(p(!0), s(i, null, m(e.itemRows, (t, n) => (p(), a(C, {
key: n,
"no-gutters": ""
}, {
default: _(() => [(p(!0), s(i, null, m(t, (t, n) => (p(), a(S, { key: n }, {
default: _(() => [t ? (p(), a(x, {
key: 0,
class: "vcron-v-item",
onClick: (n) => e.select(t),
active: e.has(t)
}, {
default: _(() => [l(g(t.text), 1)]),
_: 2
}, 1032, ["onClick", "active"])) : o("", !0)]),
_: 2
}, 1024))), 128))]),
_: 2
}, 1024))), 128))]),
_: 1
})]),
_: 1
}, 16)]),
_: 2
}, [!e.disabled && e.clearable && !e.isEmpty ? {
name: "append",
fn: _(() => [u(b, {
class: "ms-1 me-n1",
size: "small",
icon: n.chipProps.closeIcon ?? n.chipProps["close-icon"] ?? "mdi-close",
onClick: t[0] ||= v((t) => e.clear(), ["stop"])
}, null, 8, ["icon"])]),
key: "0"
} : void 0]), 1040, ["disabled"]);
}
var S = /*#__PURE__*/ b(y, [["render", x]]), C = () => ({
chipProps: {
type: Object,
default() {
return {};
}
},
...e()
}), w = d({
name: "CronVuetify",
components: { CustomSelect: S },
props: C(),
emits: [
"update:model-value",
"update:period",
"error"
],
setup(e, t) {
return n(e, t);
}
}), T = { style: { display: "inline-block" } };
function E(e, t, n, r, c, d) {
let f = h("v-col"), v = h("custom-select"), y = h("v-row");
return p(), s("div", T, [u(y, {
align: "baseline",
dense: ""
}, {
default: _(() => [
e.period.prefix.value ? (p(), a(f, {
key: 0,
class: "flex-grow-0"
}, {
default: _(() => [l(g(e.period.prefix.value), 1)]),
_: 1
})) : o("", !0),
u(f, { cols: "auto" }, {
default: _(() => [u(v, {
"model-value": e.period.selected.value.id,
"item-value": "id",
items: e.period.items,
"onUpdate:modelValue": t[0] ||= (t) => e.period.select(t),
disabled: e.disabled,
"chip-props": e.chipProps
}, null, 8, [
"model-value",
"items",
"disabled",
"chip-props"
])]),
_: 1
}),
e.period.suffix.value ? (p(), a(f, {
key: 1,
class: "flex-grow-0"
}, {
default: _(() => [l(g(e.period.suffix.value), 1)]),
_: 1
})) : o("", !0),
(p(!0), s(i, null, m(e.selected, (t) => (p(), s(i, { key: t.id }, [
t.prefix.value ? (p(), a(f, {
key: 0,
class: "flex-grow-0"
}, {
default: _(() => [l(g(t.prefix.value), 1)]),
_: 2
}, 1024)) : o("", !0),
u(f, { cols: "auto" }, {
default: _(() => [u(v, {
"model-value": t.selected.value,
"onUpdate:modelValue": (e) => t.select(e),
items: t.items,
cols: e.cols[t.id] || 1,
selection: t.text.value,
multiple: "",
clearable: e.clearable,
disabled: e.disabled,
"chip-props": e.chipProps,
"menu-props": { closeOnContentClick: !1 }
}, null, 8, [
"model-value",
"onUpdate:modelValue",
"items",
"cols",
"selection",
"clearable",
"disabled",
"chip-props"
])]),
_: 2
}, 1024),
t.suffix.value ? (p(), a(f, {
key: 1,
class: "flex-grow-0"
}, {
default: _(() => [l(g(t.suffix.value), 1)]),
_: 2
}, 1024)) : o("", !0)
], 64))), 128))
]),
_: 1
})]);
}
var D = /*#__PURE__*/ b(w, [["render", E]]), O = { install: (e) => {
e.component("CronVuetify", D);
} };
//#endregion
export { D as CronVuetify, O as CronVuetifyPlugin, O as default, C as cronVuetifyProps };
//# sourceMappingURL=vuetify.js.map