feat(WIP): vue-multiselect
This commit is contained in:
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
declare module 'vue-multiselect' {
|
||||
// Type definitions for Vue-Multislect 2.1.0
|
||||
// Definitions by: Akshay Jat https://github.com/akki-jat
|
||||
|
||||
import { VueConstructor } from 'vue';
|
||||
|
||||
|
||||
declare class Multiselect extends VueConstructor { }
|
||||
declare class multiselectMixin extends VueConstructor { }
|
||||
declare class pointerMixin extends VueConstructor { }
|
||||
|
||||
export default Multiselect;
|
||||
export { Multiselect, multiselectMixin, pointerMixin };
|
||||
}
|
||||
@@ -129,7 +129,18 @@
|
||||
</div>
|
||||
<div class="row gx-0">
|
||||
<div class="col-9 d-grid">
|
||||
<b-form-select v-model="selectedCommand"
|
||||
<v-multiselect
|
||||
v-model="selectedCommand"
|
||||
:allow-empty="false"
|
||||
:options="compiledCommandList"
|
||||
:group-select="true"
|
||||
group-values="values"
|
||||
group-label="category"
|
||||
label="title"
|
||||
track-by="value"
|
||||
>
|
||||
</v-multiselect>
|
||||
<!--<b-form-select v-model="selectedCommand"
|
||||
><b-form-select-option-group
|
||||
v-for="cgroup in commandList"
|
||||
:key="cgroup['category']"
|
||||
@@ -142,7 +153,7 @@
|
||||
}}{{ citem.possible ? "" : "(불가)" }}</b-form-select-option
|
||||
>
|
||||
</b-form-select-option-group></b-form-select
|
||||
>
|
||||
>-->
|
||||
</div>
|
||||
<div class="col-3 d-grid">
|
||||
<b-button @click="reserveCommand()" variant="primary">실행</b-button>
|
||||
@@ -163,6 +174,7 @@ import { parseTime } from "./util/parseTime";
|
||||
import { parseYearMonth } from "./util/parseYearMonth";
|
||||
import { sammoAPI } from "./util/sammoAPI";
|
||||
import { unwrap_any } from "./util/unwrap_any";
|
||||
|
||||
type commandItem = {
|
||||
title: string;
|
||||
compensation: number;
|
||||
@@ -419,7 +431,7 @@ export default defineComponent({
|
||||
const pressed = Array.from<boolean>({ length: maxTurn }).fill(false);
|
||||
pressed[0] = true;
|
||||
|
||||
const selectedCommand = "휴식";
|
||||
const selectedCommand = "휴식";//FIXME: 새 구성에 따르면 Object임.
|
||||
|
||||
const emptyTurn: TurnObjWithTime[] = Array.from<TurnObjWithTime>({
|
||||
length: maxTurn,
|
||||
@@ -432,12 +444,43 @@ export default defineComponent({
|
||||
time: "",
|
||||
});
|
||||
|
||||
const compiledCommandList: {
|
||||
category: string;
|
||||
values: {
|
||||
title: string;
|
||||
value: null | string;
|
||||
reqArg: boolean,
|
||||
possible?: boolean;
|
||||
compensation?: number;
|
||||
}[];
|
||||
}[] = [];
|
||||
for (const category of commandList) {
|
||||
|
||||
const categoryList: (typeof compiledCommandList)[0]['values'] = [];
|
||||
for (const [commandValue, commandInfo] of Object.entries(
|
||||
category.values
|
||||
)) {
|
||||
categoryList.push({
|
||||
reqArg: commandInfo.reqArg,
|
||||
title: commandInfo.title,
|
||||
value: commandValue,
|
||||
possible: commandInfo.possible,
|
||||
compensation: commandInfo.compensation,
|
||||
});
|
||||
}
|
||||
compiledCommandList.push({
|
||||
category: category.category,
|
||||
values: categoryList,
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
maxTurn,
|
||||
flippedMaxTurn: 16,
|
||||
viewMaxTurn: 16,
|
||||
maxPushTurn,
|
||||
commandList,
|
||||
compiledCommandList,
|
||||
serverNow: formatTime(serverNowObj, "HH:mm:ss"),
|
||||
timeDiff,
|
||||
pressed,
|
||||
@@ -456,6 +499,7 @@ export default defineComponent({
|
||||
@import "../scss/variables.scss";
|
||||
@import "../scss/bootswatch_custom_variables.scss";
|
||||
@import "../../node_modules/bootstrap5/scss/bootstrap-utilities.scss";
|
||||
@import "vue-select/src/scss/vue-select.scss";
|
||||
|
||||
.commandPad {
|
||||
background-color: $gray-900;
|
||||
@@ -491,7 +535,7 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
.month_pad:hover{
|
||||
.month_pad:hover {
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@ import { createApp } from 'vue'
|
||||
import ReservedCommand from './ReservedCommand.vue';
|
||||
import BootstrapVue3 from 'bootstrap-vue-3'
|
||||
import { setAxiosXMLHttpRequest } from './util/setAxiosXMLHttpRequest';
|
||||
|
||||
import Multiselect from 'vue-multiselect';
|
||||
|
||||
setAxiosXMLHttpRequest();
|
||||
|
||||
createApp(ReservedCommand).use(BootstrapVue3).mount('#reservedCommandList')
|
||||
createApp(ReservedCommand).use(BootstrapVue3).component('v-multiselect', Multiselect).mount('#reservedCommandList')
|
||||
Reference in New Issue
Block a user