Some checks failed
🚀 Deploy - Demo / deployment (push) Has been cancelled
- 웹훅 URL을 https://admin.youtooplay.com/webhook로 변경 - Nginx 리버스 프록시 설정 파일 추가 - 배포 가이드 업데이트
422 lines
13 KiB
JavaScript
422 lines
13 KiB
JavaScript
import { computed, createVNode, mergeProps, shallowRef, ref, withDirectives, Fragment, resolveDirective, inject, nextTick, provide, onScopeDispose, toRef } from 'vue';
|
|
import { g as genericComponent, p as propsFactory, n as useProxiedModel, a5 as getUid, a as useRender, aK as filterInputAttrs, r as omit, I as IconValue, af as Ripple, s as VIcon, m as makeComponentProps, ai as useDensity, w as wrapInArray, at as useTextColor, a0 as useBackgroundColor, A as matchesSelector, K as makeThemeProps, P as makeDensityProps, U as deepEqual, G as provideDefaults } from './server.mjs';
|
|
import { c as useFocus, d as VInput, e as makeVInputProps, b as VLabel } from './VTextField-Bxu4ONGD.mjs';
|
|
|
|
const VSelectionControlGroupSymbol = Symbol.for("vuetify:selection-control-group");
|
|
const makeSelectionControlGroupProps = propsFactory({
|
|
color: String,
|
|
disabled: {
|
|
type: Boolean,
|
|
default: null
|
|
},
|
|
defaultsTarget: String,
|
|
error: Boolean,
|
|
id: String,
|
|
inline: Boolean,
|
|
falseIcon: IconValue,
|
|
trueIcon: IconValue,
|
|
ripple: {
|
|
type: [Boolean, Object],
|
|
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");
|
|
const makeVSelectionControlGroupProps = propsFactory({
|
|
...makeSelectionControlGroupProps({
|
|
defaultsTarget: "VSelectionControl"
|
|
})
|
|
}, "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 {};
|
|
}
|
|
});
|
|
const 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 : props.baseColor;
|
|
}));
|
|
const icon = computed(() => model.value ? props.trueIcon : props.falseIcon);
|
|
return {
|
|
group,
|
|
densityClasses,
|
|
trueValue,
|
|
falseValue,
|
|
model,
|
|
textColorClasses,
|
|
textColorStyles,
|
|
backgroundColorClasses,
|
|
backgroundColorStyles,
|
|
icon
|
|
};
|
|
}
|
|
const 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) !== false) {
|
|
isFocusVisible.value = true;
|
|
}
|
|
}
|
|
function onBlur() {
|
|
isFocused.value = false;
|
|
isFocusVisible.value = false;
|
|
}
|
|
function onClickLabel(e) {
|
|
e.stopPropagation();
|
|
}
|
|
function onInput(e) {
|
|
if (!isInteractive.value) {
|
|
if (input.value) {
|
|
input.value.checked = model.value;
|
|
}
|
|
return;
|
|
}
|
|
if (props.readonly && group) {
|
|
nextTick(() => group.forceUpdate());
|
|
}
|
|
model.value = e.target.checked;
|
|
}
|
|
useRender(() => {
|
|
var _a2;
|
|
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,
|
|
"aria-label": props.label,
|
|
"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"]
|
|
}, [(_a2 = (_b = slots.input) == null ? void 0 : _b.call(slots, {
|
|
model,
|
|
textColorClasses,
|
|
textColorStyles,
|
|
backgroundColorClasses,
|
|
backgroundColorStyles,
|
|
inputNode,
|
|
icon: icon.value,
|
|
props: {
|
|
onFocus,
|
|
onBlur,
|
|
id: id.value
|
|
}
|
|
})) != null ? _a2 : 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
|
|
};
|
|
}
|
|
});
|
|
const makeVCheckboxBtnProps = propsFactory({
|
|
indeterminate: Boolean,
|
|
indeterminateIcon: {
|
|
type: IconValue,
|
|
default: "$checkboxIndeterminate"
|
|
},
|
|
...makeVSelectionControlProps({
|
|
falseIcon: "$checkboxOff",
|
|
trueIcon: "$checkboxOn"
|
|
})
|
|
}, "VCheckboxBtn");
|
|
const VCheckboxBtn = genericComponent()({
|
|
name: "VCheckboxBtn",
|
|
props: makeVCheckboxBtnProps(),
|
|
emits: {
|
|
"update:modelValue": (value) => true,
|
|
"update:indeterminate": (value) => true
|
|
},
|
|
setup(props, _ref) {
|
|
let {
|
|
slots
|
|
} = _ref;
|
|
const indeterminate = useProxiedModel(props, "indeterminate");
|
|
const model = useProxiedModel(props, "modelValue");
|
|
function onChange(v) {
|
|
if (indeterminate.value) {
|
|
indeterminate.value = false;
|
|
}
|
|
}
|
|
const falseIcon = computed(() => {
|
|
return indeterminate.value ? props.indeterminateIcon : props.falseIcon;
|
|
});
|
|
const trueIcon = computed(() => {
|
|
return indeterminate.value ? props.indeterminateIcon : props.trueIcon;
|
|
});
|
|
useRender(() => {
|
|
const controlProps = omit(VSelectionControl.filterProps(props), ["modelValue"]);
|
|
return createVNode(VSelectionControl, mergeProps(controlProps, {
|
|
"modelValue": model.value,
|
|
"onUpdate:modelValue": [($event) => model.value = $event, onChange],
|
|
"class": ["v-checkbox-btn", props.class],
|
|
"style": props.style,
|
|
"type": "checkbox",
|
|
"falseIcon": falseIcon.value,
|
|
"trueIcon": trueIcon.value,
|
|
"aria-checked": indeterminate.value ? "mixed" : void 0
|
|
}), slots);
|
|
});
|
|
return {};
|
|
}
|
|
});
|
|
const makeVCheckboxProps = propsFactory({
|
|
...makeVInputProps(),
|
|
...omit(makeVCheckboxBtnProps(), ["inline"])
|
|
}, "VCheckbox");
|
|
const VCheckbox = genericComponent()({
|
|
name: "VCheckbox",
|
|
inheritAttrs: false,
|
|
props: makeVCheckboxProps(),
|
|
emits: {
|
|
"update:modelValue": (value) => true,
|
|
"update:focused": (focused) => true
|
|
},
|
|
setup(props, _ref) {
|
|
let {
|
|
attrs,
|
|
slots
|
|
} = _ref;
|
|
const model = useProxiedModel(props, "modelValue");
|
|
const {
|
|
isFocused,
|
|
focus,
|
|
blur
|
|
} = useFocus(props);
|
|
const uid = getUid();
|
|
const id = computed(() => props.id || `checkbox-${uid}`);
|
|
useRender(() => {
|
|
const [rootAttrs, controlAttrs] = filterInputAttrs(attrs);
|
|
const inputProps = VInput.filterProps(props);
|
|
const checkboxProps = VCheckboxBtn.filterProps(props);
|
|
return createVNode(VInput, mergeProps({
|
|
"class": ["v-checkbox", props.class]
|
|
}, rootAttrs, inputProps, {
|
|
"modelValue": model.value,
|
|
"onUpdate:modelValue": ($event) => model.value = $event,
|
|
"id": id.value,
|
|
"focused": isFocused.value,
|
|
"style": props.style
|
|
}), {
|
|
...slots,
|
|
default: (_ref2) => {
|
|
let {
|
|
id: id2,
|
|
messagesId,
|
|
isDisabled,
|
|
isReadonly,
|
|
isValid
|
|
} = _ref2;
|
|
return createVNode(VCheckboxBtn, mergeProps(checkboxProps, {
|
|
"id": id2.value,
|
|
"aria-describedby": messagesId.value,
|
|
"disabled": isDisabled.value,
|
|
"readonly": isReadonly.value
|
|
}, controlAttrs, {
|
|
"error": isValid.value === false,
|
|
"modelValue": model.value,
|
|
"onUpdate:modelValue": ($event) => model.value = $event,
|
|
"onFocus": focus,
|
|
"onBlur": blur
|
|
}), slots);
|
|
}
|
|
});
|
|
});
|
|
return {};
|
|
}
|
|
});
|
|
|
|
export { VCheckbox as V, VCheckboxBtn as a };
|