feat: 턴 선택기에 복합 커맨드 선택 적용
- vue-multiselect 기반 - 초성 검색 - 이득, 불리 표기 - 불가 표기 - 선택후 단축 표기
This commit is contained in:
@@ -245,11 +245,6 @@ div.bar_out div.bar_in {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.commandBasic {
|
|
||||||
background-color: black;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.compensatePositive {
|
.compensatePositive {
|
||||||
color: skyblue;
|
color: skyblue;
|
||||||
}
|
}
|
||||||
@@ -258,10 +253,6 @@ div.bar_out div.bar_in {
|
|||||||
color: orange;
|
color: orange;
|
||||||
}
|
}
|
||||||
|
|
||||||
.compensateNeutral {
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.commandBasic.commandImpossible {
|
.commandBasic.commandImpossible {
|
||||||
background-color: red;
|
background-color: red;
|
||||||
color: white;
|
color: white;
|
||||||
|
|||||||
@@ -480,6 +480,7 @@ function getCommandTable(General $general){
|
|||||||
'compensation'=>$commandObj->getCompensationStyle(),
|
'compensation'=>$commandObj->getCompensationStyle(),
|
||||||
'possible'=>$commandObj->hasMinConditionMet(),
|
'possible'=>$commandObj->hasMinConditionMet(),
|
||||||
'title'=>$commandObj->getCommandDetailTitle(),
|
'title'=>$commandObj->getCommandDetailTitle(),
|
||||||
|
'simpleName'=>$commandObj->getName(),
|
||||||
'reqArg'=>$commandObj::$reqArg,
|
'reqArg'=>$commandObj::$reqArg,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ use sammo\MustNotBeReachedException;
|
|||||||
|
|
||||||
class che_랜덤임관 extends Command\GeneralCommand
|
class che_랜덤임관 extends Command\GeneralCommand
|
||||||
{
|
{
|
||||||
static protected $actionName = '랜덤임관';
|
static protected $actionName = '무작위 국가로 임관';
|
||||||
|
|
||||||
protected function argTest(): bool
|
protected function argTest(): bool
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ use sammo\CityConst;
|
|||||||
|
|
||||||
|
|
||||||
class che_장수대상임관 extends Command\GeneralCommand{
|
class che_장수대상임관 extends Command\GeneralCommand{
|
||||||
static protected $actionName = '따라 임관';
|
static protected $actionName = '장수를 따라 임관';
|
||||||
static public $reqArg = true;
|
static public $reqArg = true;
|
||||||
|
|
||||||
protected function argTest():bool{
|
protected function argTest():bool{
|
||||||
|
|||||||
+12
-12
@@ -247,26 +247,26 @@ div.bar_out div.bar_in {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.commandBasic {
|
|
||||||
background-color: black;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.compensatePositive {
|
.compensatePositive {
|
||||||
color: skyblue;
|
color: $cyan;
|
||||||
|
display: inline-block;
|
||||||
|
width: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.compensateNegative {
|
.compensateNegative {
|
||||||
color: orange;
|
color: $red;
|
||||||
|
display: inline-block;
|
||||||
|
width: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.compensateNeutral {
|
.compensateNeutral{
|
||||||
color: white;
|
display: inline-block;
|
||||||
|
width: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.commandBasic.commandImpossible {
|
.commandImpossible {
|
||||||
background-color: red;
|
color: $red;
|
||||||
color: white;
|
text-decoration: line-through $red;
|
||||||
}
|
}
|
||||||
|
|
||||||
.select2-selection--single.simple-select2-align-center .select2-selection__rendered {
|
.select2-selection--single.simple-select2-align-center .select2-selection__rendered {
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
@use "sass:math";
|
@use "sass:math";
|
||||||
|
$vue-multiselect-disabled-bg: $gray-400;
|
||||||
$vue-multiselect-disabled-color: $white;
|
|
||||||
$vue-multiselect-disabled-bg: $gray-700;
|
|
||||||
$form-select-color: $white;
|
|
||||||
$vue-multiselect-bg: $black;
|
|
||||||
$vue-multiselect-color: $white;
|
|
||||||
$vue-multiselect-tag-color: $white;
|
|
||||||
$vue-multiselect-spinner-color: $white;
|
|
||||||
|
|
||||||
$vue-multiselect-padding-x: $form-select-padding-x !default;
|
$vue-multiselect-padding-x: $form-select-padding-x !default;
|
||||||
$vue-multiselect-padding-y: $form-select-padding-y !default;
|
$vue-multiselect-padding-y: $form-select-padding-y !default;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
'white-space': 'nowrap',
|
'white-space': 'nowrap',
|
||||||
'font-size': `${Math.min(
|
'font-size': `${Math.min(
|
||||||
14,
|
14,
|
||||||
(70 / (`${turnObj.year ?? 1}`.length + 8)) * 1.8
|
(75 / (`${turnObj.year ?? 1}`.length + 8)) * 1.8
|
||||||
)}px`,
|
)}px`,
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
}"
|
}"
|
||||||
@@ -136,7 +136,7 @@
|
|||||||
:group-select="false"
|
:group-select="false"
|
||||||
group-values="values"
|
group-values="values"
|
||||||
group-label="category"
|
group-label="category"
|
||||||
label="title"
|
label="searchText"
|
||||||
track-by="value"
|
track-by="value"
|
||||||
open-direction="top"
|
open-direction="top"
|
||||||
:show-labels="false"
|
:show-labels="false"
|
||||||
@@ -149,7 +149,34 @@
|
|||||||
:maxHeight="400"
|
:maxHeight="400"
|
||||||
>
|
>
|
||||||
<template v-slot:noResult>검색 결과가 없습니다.</template>
|
<template v-slot:noResult>검색 결과가 없습니다.</template>
|
||||||
<template v-slot:option="props"><!--FIXME: 카테고리--><span :class="props.option.compensation>0?'compensatePositive':(props.option.compensation<0?'compensateNegative':'compensateNeutral')">{{ props.option.title }}</span></template>
|
<template v-slot:option="props"
|
||||||
|
><!--FIXME: 카테고리-->
|
||||||
|
<template v-if="props.option.title">
|
||||||
|
<span
|
||||||
|
class="compensatePositive"
|
||||||
|
v-if="props.option.compensation > 0"
|
||||||
|
>▲</span
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="compensateNegative"
|
||||||
|
v-else-if="props.option.compensation < 0"
|
||||||
|
>▼</span
|
||||||
|
>
|
||||||
|
<span class="compensateNeutral" v-else></span>
|
||||||
|
<span :class="[
|
||||||
|
props.option.possible?'':'commandImpossible',
|
||||||
|
]">
|
||||||
|
{{ props.option.title }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<template v-else-if="props.option.category">
|
||||||
|
{{ props.option.category }}
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<template v-slot:singleLabel="props">
|
||||||
|
{{ props.option.simpleName }}
|
||||||
|
</template>
|
||||||
</v-multiselect>
|
</v-multiselect>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3 d-grid">
|
<div class="col-3 d-grid">
|
||||||
@@ -167,16 +194,20 @@ import { stringifyUrl } from "query-string";
|
|||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
import { formatTime } from "./util/formatTime";
|
import { formatTime } from "./util/formatTime";
|
||||||
import { joinYearMonth } from "./util/joinYearMonth";
|
import { joinYearMonth } from "./util/joinYearMonth";
|
||||||
|
import { mb_strwidth } from "./util/mb_strwidth";
|
||||||
import { parseTime } from "./util/parseTime";
|
import { parseTime } from "./util/parseTime";
|
||||||
import { parseYearMonth } from "./util/parseYearMonth";
|
import { parseYearMonth } from "./util/parseYearMonth";
|
||||||
import { sammoAPI } from "./util/sammoAPI";
|
import { sammoAPI } from "./util/sammoAPI";
|
||||||
|
import { filter초성 } from "./util/filter초성";
|
||||||
|
|
||||||
type commandItem = {
|
type commandItem = {
|
||||||
value: string;
|
value: string;
|
||||||
title: string;
|
title: string;
|
||||||
compensation: number;
|
compensation: number;
|
||||||
|
simpleName: string;
|
||||||
possible: boolean;
|
possible: boolean;
|
||||||
reqArg: boolean;
|
reqArg: boolean;
|
||||||
|
searchText?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
declare const maxTurn: number;
|
declare const maxTurn: number;
|
||||||
@@ -251,7 +282,7 @@ export default defineComponent({
|
|||||||
this.serverNow = formatTime(serverNow, "HH:mm:ss");
|
this.serverNow = formatTime(serverNow, "HH:mm:ss");
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.updateNow();
|
this.updateNow();
|
||||||
}, 250);
|
}, 1000 - serverNow.getMilliseconds());
|
||||||
},
|
},
|
||||||
toggleTurn(turnIdx: number) {
|
toggleTurn(turnIdx: number) {
|
||||||
this.pressed[turnIdx] = !this.pressed[turnIdx];
|
this.pressed[turnIdx] = !this.pressed[turnIdx];
|
||||||
@@ -352,14 +383,22 @@ export default defineComponent({
|
|||||||
|
|
||||||
for (const obj of result.turn) {
|
for (const obj of result.turn) {
|
||||||
const [year, month] = parseYearMonth(yearMonth);
|
const [year, month] = parseYearMonth(yearMonth);
|
||||||
let tooltip: string | undefined = undefined;
|
let tooltip: string[] = [];
|
||||||
let style: Record<string, unknown> = {};
|
let style: Record<string, unknown> = {};
|
||||||
|
|
||||||
|
const brief = obj.brief;
|
||||||
|
|
||||||
if (yearMonth <= autorunLimitYearMonth) {
|
if (yearMonth <= autorunLimitYearMonth) {
|
||||||
if (obj.brief == "휴식") {
|
if (obj.brief == "휴식") {
|
||||||
obj.brief = "휴식<small>(자율 행동)</small>";
|
obj.brief = "휴식<small>(자율 행동)</small>";
|
||||||
}
|
}
|
||||||
style.color = "#aaffff";
|
style.color = "#aaffff";
|
||||||
tooltip = `자율 행동 기간: ${autorunLimitYear}년 ${autorunLimitMonth}월까지`;
|
|
||||||
|
tooltip.push(`자율 행동 기간: ${autorunLimitYear}년 ${autorunLimitMonth}월까지`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mb_strwidth(brief) > 22){
|
||||||
|
tooltip.push(brief);
|
||||||
}
|
}
|
||||||
|
|
||||||
reservedCommandList.push({
|
reservedCommandList.push({
|
||||||
@@ -367,7 +406,7 @@ export default defineComponent({
|
|||||||
year,
|
year,
|
||||||
month,
|
month,
|
||||||
time: formatTime(nextTurnTime, "HH:mm"),
|
time: formatTime(nextTurnTime, "HH:mm"),
|
||||||
tooltip,
|
tooltip: tooltip.length==0?undefined:tooltip.join("\n"),
|
||||||
style,
|
style,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -423,12 +462,21 @@ export default defineComponent({
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.updateNow();
|
this.updateNow();
|
||||||
}, 250);
|
}, 1000 - serverNowObj.getMilliseconds());
|
||||||
|
|
||||||
const pressed = Array.from<boolean>({ length: maxTurn }).fill(false);
|
const pressed = Array.from<boolean>({ length: maxTurn }).fill(false);
|
||||||
pressed[0] = true;
|
pressed[0] = true;
|
||||||
|
|
||||||
const selectedCommand = commandList[0].values[0];
|
const selectedCommand = commandList[0].values[0];
|
||||||
|
for(const subCategory of commandList){
|
||||||
|
for(const command of subCategory.values){
|
||||||
|
if(command.searchText){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const filteredText = filter초성(command.simpleName).replace(/\s+/g, '');
|
||||||
|
command.searchText = `${command.simpleName} ${filteredText}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const emptyTurn: TurnObjWithTime[] = Array.from<TurnObjWithTime>({
|
const emptyTurn: TurnObjWithTime[] = Array.from<TurnObjWithTime>({
|
||||||
length: maxTurn,
|
length: maxTurn,
|
||||||
@@ -473,7 +521,7 @@ export default defineComponent({
|
|||||||
.commandTable {
|
.commandTable {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(30px, 1fr) minmax(70px, 2.5fr) minmax(40px, 1fr) 5fr;
|
grid-template-columns: minmax(30px, 1fr) minmax(75px, 2.5fr) minmax(40px, 1fr) 5fr;
|
||||||
//30, 70, 37.65, 160
|
//30, 70, 37.65, 160
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,6 +529,11 @@ export default defineComponent({
|
|||||||
.commandPad {
|
.commandPad {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
|
|
||||||
|
.turn_pad {
|
||||||
|
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
.multiselect__content-wrapper {
|
.multiselect__content-wrapper {
|
||||||
width: 133.3%;
|
width: 133.3%;
|
||||||
}
|
}
|
||||||
@@ -532,5 +585,8 @@ export default defineComponent({
|
|||||||
|
|
||||||
.turn_pad .turn_text {
|
.turn_pad .turn_text {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
export function filter초성(text: string): string {
|
||||||
|
const 초성 = [
|
||||||
|
"ㄱ", "ㄲ", "ㄴ", "ㄷ", "ㄸ", "ㄹ", "ㅁ", "ㅂ", "ㅃ",
|
||||||
|
"ㅅ", "ㅆ", "ㅇ", "ㅈ", "ㅉ", "ㅊ", "ㅋ", "ㅌ", "ㅍ", "ㅎ"
|
||||||
|
];
|
||||||
|
const result: string[] = [];
|
||||||
|
for (const char of text) {
|
||||||
|
const code = (char.codePointAt(0) ?? 0) - 44032;
|
||||||
|
if (0 <= code && code < 11172) {
|
||||||
|
result.push(초성[~~(code / 588)]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
result.push(char);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.join('');
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user