360 lines
10 KiB
JavaScript
360 lines
10 KiB
JavaScript
import {
|
|
Ripple
|
|
} from "./chunk-NMCVREUK.js";
|
|
import {
|
|
makeDensityProps,
|
|
useDensity
|
|
} from "./chunk-VQPKT5F7.js";
|
|
import {
|
|
VIcon
|
|
} from "./chunk-IFUDBK56.js";
|
|
import {
|
|
useBackgroundColor,
|
|
useTextColor
|
|
} from "./chunk-ZZ55KHRR.js";
|
|
import {
|
|
IconValue
|
|
} from "./chunk-472DNWSX.js";
|
|
import {
|
|
useProxiedModel
|
|
} from "./chunk-PVQHDZXM.js";
|
|
import {
|
|
VLabel
|
|
} from "./chunk-J5HFPFMJ.js";
|
|
import {
|
|
makeThemeProps
|
|
} from "./chunk-CYOEVGGH.js";
|
|
import {
|
|
deepEqual,
|
|
filterInputAttrs,
|
|
genericComponent,
|
|
getUid,
|
|
makeComponentProps,
|
|
matchesSelector,
|
|
propsFactory,
|
|
provideDefaults,
|
|
useRender,
|
|
wrapInArray
|
|
} from "./chunk-I4KGD5X4.js";
|
|
import {
|
|
Fragment,
|
|
computed,
|
|
createVNode,
|
|
inject,
|
|
mergeProps,
|
|
nextTick,
|
|
onScopeDispose,
|
|
provide,
|
|
ref,
|
|
resolveDirective,
|
|
shallowRef,
|
|
toRef,
|
|
withDirectives
|
|
} from "./chunk-PD2AWGJV.js";
|
|
|
|
// node_modules/vuetify/lib/components/VSelectionControl/VSelectionControl.mjs
|
|
import "C:/Users/Jeremy/Documents/Dev/Projects.cloudsucks.net/Vulture/VApp/node_modules/vuetify/lib/components/VSelectionControl/VSelectionControl.css";
|
|
|
|
// node_modules/vuetify/lib/components/VSelectionControlGroup/VSelectionControlGroup.mjs
|
|
import "C:/Users/Jeremy/Documents/Dev/Projects.cloudsucks.net/Vulture/VApp/node_modules/vuetify/lib/components/VSelectionControlGroup/VSelectionControlGroup.css";
|
|
var VSelectionControlGroupSymbol = Symbol.for("vuetify:selection-control-group");
|
|
var makeSelectionControlGroupProps = propsFactory({
|
|
color: String,
|
|
disabled: {
|
|
type: Boolean,
|
|
default: null
|
|
},
|
|
defaultsTarget: String,
|
|
error: Boolean,
|
|
id: String,
|
|
inline: Boolean,
|
|
falseIcon: IconValue,
|
|
trueIcon: IconValue,
|
|
ripple: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
multiple: {
|
|
type: Boolean,
|
|
default: null
|
|
},
|
|
name: String,
|
|
readonly: {
|
|
type: Boolean,
|
|
default: null
|
|
},
|
|
modelValue: null,
|
|
type: String,
|
|
valueComparator: {
|
|
type: Function,
|
|
default: deepEqual
|
|
},
|
|
...makeComponentProps(),
|
|
...makeDensityProps(),
|
|
...makeThemeProps()
|
|
}, "SelectionControlGroup");
|
|
var makeVSelectionControlGroupProps = propsFactory({
|
|
...makeSelectionControlGroupProps({
|
|
defaultsTarget: "VSelectionControl"
|
|
})
|
|
}, "VSelectionControlGroup");
|
|
var VSelectionControlGroup = genericComponent()({
|
|
name: "VSelectionControlGroup",
|
|
props: makeVSelectionControlGroupProps(),
|
|
emits: {
|
|
"update:modelValue": (value) => true
|
|
},
|
|
setup(props, _ref) {
|
|
let {
|
|
slots
|
|
} = _ref;
|
|
const modelValue = useProxiedModel(props, "modelValue");
|
|
const uid = getUid();
|
|
const id = computed(() => props.id || `v-selection-control-group-${uid}`);
|
|
const name = computed(() => props.name || id.value);
|
|
const updateHandlers = /* @__PURE__ */ new Set();
|
|
provide(VSelectionControlGroupSymbol, {
|
|
modelValue,
|
|
forceUpdate: () => {
|
|
updateHandlers.forEach((fn) => fn());
|
|
},
|
|
onForceUpdate: (cb) => {
|
|
updateHandlers.add(cb);
|
|
onScopeDispose(() => {
|
|
updateHandlers.delete(cb);
|
|
});
|
|
}
|
|
});
|
|
provideDefaults({
|
|
[props.defaultsTarget]: {
|
|
color: toRef(props, "color"),
|
|
disabled: toRef(props, "disabled"),
|
|
density: toRef(props, "density"),
|
|
error: toRef(props, "error"),
|
|
inline: toRef(props, "inline"),
|
|
modelValue,
|
|
multiple: computed(() => !!props.multiple || props.multiple == null && Array.isArray(modelValue.value)),
|
|
name,
|
|
falseIcon: toRef(props, "falseIcon"),
|
|
trueIcon: toRef(props, "trueIcon"),
|
|
readonly: toRef(props, "readonly"),
|
|
ripple: toRef(props, "ripple"),
|
|
type: toRef(props, "type"),
|
|
valueComparator: toRef(props, "valueComparator")
|
|
}
|
|
});
|
|
useRender(() => {
|
|
var _a;
|
|
return createVNode("div", {
|
|
"class": ["v-selection-control-group", {
|
|
"v-selection-control-group--inline": props.inline
|
|
}, props.class],
|
|
"style": props.style,
|
|
"role": props.type === "radio" ? "radiogroup" : void 0
|
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
});
|
|
return {};
|
|
}
|
|
});
|
|
|
|
// node_modules/vuetify/lib/components/VSelectionControl/VSelectionControl.mjs
|
|
var makeVSelectionControlProps = propsFactory({
|
|
label: String,
|
|
baseColor: String,
|
|
trueValue: null,
|
|
falseValue: null,
|
|
value: null,
|
|
...makeComponentProps(),
|
|
...makeSelectionControlGroupProps()
|
|
}, "VSelectionControl");
|
|
function useSelectionControl(props) {
|
|
const group = inject(VSelectionControlGroupSymbol, void 0);
|
|
const {
|
|
densityClasses
|
|
} = useDensity(props);
|
|
const modelValue = useProxiedModel(props, "modelValue");
|
|
const trueValue = computed(() => props.trueValue !== void 0 ? props.trueValue : props.value !== void 0 ? props.value : true);
|
|
const falseValue = computed(() => props.falseValue !== void 0 ? props.falseValue : false);
|
|
const isMultiple = computed(() => !!props.multiple || props.multiple == null && Array.isArray(modelValue.value));
|
|
const model = computed({
|
|
get() {
|
|
const val = group ? group.modelValue.value : modelValue.value;
|
|
return isMultiple.value ? wrapInArray(val).some((v) => props.valueComparator(v, trueValue.value)) : props.valueComparator(val, trueValue.value);
|
|
},
|
|
set(val) {
|
|
if (props.readonly) return;
|
|
const currentValue = val ? trueValue.value : falseValue.value;
|
|
let newVal = currentValue;
|
|
if (isMultiple.value) {
|
|
newVal = val ? [...wrapInArray(modelValue.value), currentValue] : wrapInArray(modelValue.value).filter((item) => !props.valueComparator(item, trueValue.value));
|
|
}
|
|
if (group) {
|
|
group.modelValue.value = newVal;
|
|
} else {
|
|
modelValue.value = newVal;
|
|
}
|
|
}
|
|
});
|
|
const {
|
|
textColorClasses,
|
|
textColorStyles
|
|
} = useTextColor(computed(() => {
|
|
if (props.error || props.disabled) return void 0;
|
|
return model.value ? props.color : props.baseColor;
|
|
}));
|
|
const {
|
|
backgroundColorClasses,
|
|
backgroundColorStyles
|
|
} = useBackgroundColor(computed(() => {
|
|
return model.value && !props.error && !props.disabled ? props.color : void 0;
|
|
}));
|
|
const icon = computed(() => model.value ? props.trueIcon : props.falseIcon);
|
|
return {
|
|
group,
|
|
densityClasses,
|
|
trueValue,
|
|
falseValue,
|
|
model,
|
|
textColorClasses,
|
|
textColorStyles,
|
|
backgroundColorClasses,
|
|
backgroundColorStyles,
|
|
icon
|
|
};
|
|
}
|
|
var VSelectionControl = genericComponent()({
|
|
name: "VSelectionControl",
|
|
directives: {
|
|
Ripple
|
|
},
|
|
inheritAttrs: false,
|
|
props: makeVSelectionControlProps(),
|
|
emits: {
|
|
"update:modelValue": (value) => true
|
|
},
|
|
setup(props, _ref) {
|
|
let {
|
|
attrs,
|
|
slots
|
|
} = _ref;
|
|
const {
|
|
group,
|
|
densityClasses,
|
|
icon,
|
|
model,
|
|
textColorClasses,
|
|
textColorStyles,
|
|
backgroundColorClasses,
|
|
backgroundColorStyles,
|
|
trueValue
|
|
} = useSelectionControl(props);
|
|
const uid = getUid();
|
|
const isFocused = shallowRef(false);
|
|
const isFocusVisible = shallowRef(false);
|
|
const input = ref();
|
|
const id = computed(() => props.id || `input-${uid}`);
|
|
const isInteractive = computed(() => !props.disabled && !props.readonly);
|
|
group == null ? void 0 : group.onForceUpdate(() => {
|
|
if (input.value) {
|
|
input.value.checked = model.value;
|
|
}
|
|
});
|
|
function onFocus(e) {
|
|
if (!isInteractive.value) return;
|
|
isFocused.value = true;
|
|
if (matchesSelector(e.target, ":focus-visible") !== false) {
|
|
isFocusVisible.value = true;
|
|
}
|
|
}
|
|
function onBlur() {
|
|
isFocused.value = false;
|
|
isFocusVisible.value = false;
|
|
}
|
|
function onClickLabel(e) {
|
|
e.stopPropagation();
|
|
}
|
|
function onInput(e) {
|
|
if (!isInteractive.value) return;
|
|
if (props.readonly && group) {
|
|
nextTick(() => group.forceUpdate());
|
|
}
|
|
model.value = e.target.checked;
|
|
}
|
|
useRender(() => {
|
|
var _a, _b;
|
|
const label = slots.label ? slots.label({
|
|
label: props.label,
|
|
props: {
|
|
for: id.value
|
|
}
|
|
}) : props.label;
|
|
const [rootAttrs, inputAttrs] = filterInputAttrs(attrs);
|
|
const inputNode = createVNode("input", mergeProps({
|
|
"ref": input,
|
|
"checked": model.value,
|
|
"disabled": !!props.disabled,
|
|
"id": id.value,
|
|
"onBlur": onBlur,
|
|
"onFocus": onFocus,
|
|
"onInput": onInput,
|
|
"aria-disabled": !!props.disabled,
|
|
"type": props.type,
|
|
"value": trueValue.value,
|
|
"name": props.name,
|
|
"aria-checked": props.type === "checkbox" ? model.value : void 0
|
|
}, inputAttrs), null);
|
|
return createVNode("div", mergeProps({
|
|
"class": ["v-selection-control", {
|
|
"v-selection-control--dirty": model.value,
|
|
"v-selection-control--disabled": props.disabled,
|
|
"v-selection-control--error": props.error,
|
|
"v-selection-control--focused": isFocused.value,
|
|
"v-selection-control--focus-visible": isFocusVisible.value,
|
|
"v-selection-control--inline": props.inline
|
|
}, densityClasses.value, props.class]
|
|
}, rootAttrs, {
|
|
"style": props.style
|
|
}), [createVNode("div", {
|
|
"class": ["v-selection-control__wrapper", textColorClasses.value],
|
|
"style": textColorStyles.value
|
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
|
|
backgroundColorClasses,
|
|
backgroundColorStyles
|
|
}), withDirectives(createVNode("div", {
|
|
"class": ["v-selection-control__input"]
|
|
}, [((_b = slots.input) == null ? void 0 : _b.call(slots, {
|
|
model,
|
|
textColorClasses,
|
|
textColorStyles,
|
|
backgroundColorClasses,
|
|
backgroundColorStyles,
|
|
inputNode,
|
|
icon: icon.value,
|
|
props: {
|
|
onFocus,
|
|
onBlur,
|
|
id: id.value
|
|
}
|
|
})) ?? createVNode(Fragment, null, [icon.value && createVNode(VIcon, {
|
|
"key": "icon",
|
|
"icon": icon.value
|
|
}, null), inputNode])]), [[resolveDirective("ripple"), props.ripple && [!props.disabled && !props.readonly, null, ["center", "circle"]]]])]), label && createVNode(VLabel, {
|
|
"for": id.value,
|
|
"onClick": onClickLabel
|
|
}, {
|
|
default: () => [label]
|
|
})]);
|
|
});
|
|
return {
|
|
isFocused,
|
|
input
|
|
};
|
|
}
|
|
});
|
|
|
|
export {
|
|
makeVSelectionControlProps,
|
|
VSelectionControl
|
|
};
|
|
//# sourceMappingURL=chunk-2SRC7F4H.js.map
|