crack
This commit is contained in:
parent
e70d407ccb
commit
b8e9c94166
|
@ -20,7 +20,6 @@ const updateTable = ():TableRecipe | undefined => {
|
|||
const hot = (hotTableComponent.value.hotInstance as Handsontable)
|
||||
const build = it.BuildTable()
|
||||
hot.updateSettings(build.settings)
|
||||
hot.updateData(build.data)
|
||||
return build
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ import numbro from 'numbro';
|
|||
import { textRenderer } from "handsontable/renderers"
|
||||
import { TricksterInventory, TricksterItem } from "./trickster"
|
||||
import Core from "handsontable/core";
|
||||
import { RefStore } from "../state/state";
|
||||
|
||||
|
||||
export const BasicColumns = [
|
||||
|
@ -52,6 +53,7 @@ const c = (a:ColumnName | ColumnInfo):ColumnName => {
|
|||
}
|
||||
}
|
||||
export const LazyColumn = c;
|
||||
|
||||
export const ColumnSorter = (a:ColumnName | ColumnInfo, b: ColumnName | ColumnInfo):number => {
|
||||
let n1 = ColumnNames.indexOf(c(a))
|
||||
let n2 = ColumnNames.indexOf(c(b))
|
||||
|
@ -64,6 +66,8 @@ export const ColumnSorter = (a:ColumnName | ColumnInfo, b: ColumnName | ColumnI
|
|||
export interface ColumnInfo {
|
||||
name: ColumnName
|
||||
displayName:string
|
||||
|
||||
options?:(item:TricksterItem, r:RefStore)=>string[]
|
||||
renderer?:any
|
||||
filtering?:boolean
|
||||
writable?:boolean
|
||||
|
@ -97,10 +101,28 @@ class Name implements ColumnInfo {
|
|||
name:ColumnName = "Name"
|
||||
displayName = "Name"
|
||||
filtering = true
|
||||
renderer = nameRenderer
|
||||
getter(item:TricksterItem):(string|number){
|
||||
return item.item_name
|
||||
}
|
||||
}
|
||||
function nameRenderer(instance:any, td:any, row:any, col:any, prop:any, value:any, cellProperties:any) {
|
||||
const stringifiedValue = Handsontable.helper.stringify(value);
|
||||
let showText = stringifiedValue;
|
||||
const div= document.createElement('div');
|
||||
div.innerHTML = showText
|
||||
div.title = showText
|
||||
div.style.maxWidth = "20ch"
|
||||
div.style.textOverflow = "ellipsis"
|
||||
div.style.overflow= "hidden"
|
||||
div.style.whiteSpace= "nowrap"
|
||||
Handsontable.dom.addEvent(div, 'mousedown', event =>{
|
||||
event!.preventDefault();
|
||||
});
|
||||
Handsontable.dom.empty(td);
|
||||
td.appendChild(div);
|
||||
td.classList.add("htLeft")
|
||||
}
|
||||
|
||||
class Count implements ColumnInfo {
|
||||
name:ColumnName = "Count"
|
||||
|
@ -116,11 +138,23 @@ class Move implements ColumnInfo {
|
|||
name:ColumnName = "Move"
|
||||
displayName = "Target"
|
||||
writable = true
|
||||
options = getMoveTargets
|
||||
getter(item:TricksterItem):(string|number){
|
||||
return "-"
|
||||
}
|
||||
}
|
||||
|
||||
const getMoveTargets = (item:TricksterItem, r:RefStore):string[] => {
|
||||
let out:string[] = [];
|
||||
for(const k of r.invs.value.keys()) {
|
||||
out.push(k)
|
||||
}
|
||||
out.push("")
|
||||
out.push("")
|
||||
out.push("!TRASH")
|
||||
return out
|
||||
}
|
||||
|
||||
class MoveCount implements ColumnInfo {
|
||||
name:ColumnName = "MoveCount"
|
||||
displayName = "Move #"
|
||||
|
@ -140,7 +174,6 @@ function moveCountRenderer(instance:Core, td:any, row:number, col:number, prop:a
|
|||
const cellFormatPattern = numericFormat && numericFormat.pattern;
|
||||
const className = cellProperties.className || '';
|
||||
const classArr = className.length ? className.split(' ') : [];
|
||||
|
||||
if (typeof cellCulture !== 'undefined' && !numbro.languages()[cellCulture]) {
|
||||
const shortTag:any = cellCulture.replace('-', '');
|
||||
const langData = (numbro as any)[shortTag];
|
||||
|
@ -149,7 +182,6 @@ function moveCountRenderer(instance:Core, td:any, row:number, col:number, prop:a
|
|||
numbro.registerLanguage(langData);
|
||||
}
|
||||
}
|
||||
|
||||
const totalCount = Number(instance.getCell(row,col-1)?.innerHTML)
|
||||
numbro.setLanguage(cellCulture);
|
||||
const num = numbro(newValue)
|
||||
|
@ -168,7 +200,6 @@ function moveCountRenderer(instance:Core, td:any, row:number, col:number, prop:a
|
|||
if (classArr.indexOf('htNumeric') < 0) {
|
||||
classArr.push('htNumeric');
|
||||
}
|
||||
|
||||
cellProperties.className = classArr.join(' ');
|
||||
|
||||
td.dir = 'ltr';
|
||||
|
@ -177,7 +208,6 @@ function moveCountRenderer(instance:Core, td:any, row:number, col:number, prop:a
|
|||
newValue = ""
|
||||
}
|
||||
textRenderer(instance, td, row, col, prop, newValue, cellProperties);
|
||||
|
||||
}
|
||||
|
||||
class Equip implements ColumnInfo {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
//}
|
||||
|
||||
import { ColumnSet } from "./table"
|
||||
import { dummyChar, TricksterInventory } from "./trickster"
|
||||
|
||||
export const ARRAY_SEPERATOR = ","
|
||||
|
||||
|
@ -46,4 +47,7 @@ export const StoreColSet = {
|
|||
Murder: (s:ColumnSet):string=>Array.from(s.s.values()).join(as),
|
||||
Revive: (s:string):ColumnSet=>new ColumnSet(s.split(as))
|
||||
}
|
||||
|
||||
export const StoreInvs = {
|
||||
Murder: (s:Map<string,TricksterInventory>):string=>Array.from(s.keys()).join(as),
|
||||
Revive: (s:string):Map<string,TricksterInventory>=>new Map(s.split(as).map((x)=>[x, dummyChar(x)])),
|
||||
}
|
||||
|
|
|
@ -165,10 +165,6 @@ export const DefaultSettings = ():HotTableProps=>{
|
|||
filters: true,
|
||||
manualRowMove: false,
|
||||
manualColumnMove: false,
|
||||
autoColumnSize: {
|
||||
syncLimit: 1000,
|
||||
useHeaders: true,
|
||||
},
|
||||
allowInsertRow: false,
|
||||
allowInsertColumn: false,
|
||||
allowRemoveRow: false,
|
||||
|
|
|
@ -2,7 +2,7 @@ import { defineStore, storeToRefs } from 'pinia'
|
|||
import { getCookie, setCookie } from 'typescript-cookie'
|
||||
import { useCookies } from 'vue3-cookies'
|
||||
import { BasicColumns, ColumnInfo, ColumnName, Columns, DetailsColumns, MoveColumns } from '../lib/columns'
|
||||
import { Reviver, StoreColSet, StoreStr, StoreStrSet } from '../lib/storage'
|
||||
import { Reviver, StoreColSet, StoreInvs, StoreStr, StoreStrSet } from '../lib/storage'
|
||||
import { ColumnSet } from '../lib/table'
|
||||
import { TricksterInventory } from '../lib/trickster'
|
||||
import { nameCookie} from '../session_storage'
|
||||
|
@ -36,6 +36,7 @@ export const useStore = defineStore('state', {
|
|||
})
|
||||
|
||||
export const StoreReviver = {
|
||||
invs: StoreInvs,
|
||||
accounts: StoreStrSet,
|
||||
activeTable: StoreStr,
|
||||
screen: StoreStr,
|
||||
|
|
Loading…
Reference in New Issue