From 9494c30c9f5c2ed199a85c2c7c0aa43551f97c81 Mon Sep 17 00:00:00 2001 From: samunohito <46447427+samunohito@users.noreply.github.com> Date: Mon, 22 Jan 2024 10:37:44 +0900 Subject: [PATCH] wip --- packages/frontend/package.json | 4 +- .../frontend/src/components/grid/MkCell.vue | 26 ++++ .../frontend/src/components/grid/MkGrid.vue | 98 +++++++++++++++ .../frontend/src/components/grid/MkRow.vue | 23 ++++ .../frontend/src/components/grid/types.ts | 35 ++++++ .../pages/admin/custom-emojis-grid-emoji.vue | 40 ------ .../pages/admin/custom-emojis-grid.impl.ts | 23 ++-- .../src/pages/admin/custom-emojis-grid.vue | 117 ++++++------------ 8 files changed, 231 insertions(+), 135 deletions(-) create mode 100644 packages/frontend/src/components/grid/MkCell.vue create mode 100644 packages/frontend/src/components/grid/MkGrid.vue create mode 100644 packages/frontend/src/components/grid/MkRow.vue create mode 100644 packages/frontend/src/components/grid/types.ts delete mode 100644 packages/frontend/src/pages/admin/custom-emojis-grid-emoji.vue diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 6ca06ad9bc..3f0727eaae 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -53,9 +53,9 @@ "json5": "2.2.3", "matter-js": "0.19.0", "mfm-js": "0.24.0", + "misskey-bubble-game": "workspace:*", "misskey-js": "workspace:*", "misskey-reversi": "workspace:*", - "misskey-bubble-game": "workspace:*", "photoswipe": "5.4.3", "punycode": "2.3.1", "rollup": "4.9.1", @@ -115,8 +115,6 @@ "@vitest/coverage-v8": "0.34.6", "@vue/runtime-core": "3.4.3", "acorn": "8.11.2", - "ag-grid-community": "^31.0.2", - "ag-grid-vue3": "^31.0.2", "blueimp-load-image": "^5.16.0", "cross-env": "7.0.3", "cypress": "13.6.1", diff --git a/packages/frontend/src/components/grid/MkCell.vue b/packages/frontend/src/components/grid/MkCell.vue new file mode 100644 index 0000000000..e29431c0a2 --- /dev/null +++ b/packages/frontend/src/components/grid/MkCell.vue @@ -0,0 +1,26 @@ + + + + + diff --git a/packages/frontend/src/components/grid/MkGrid.vue b/packages/frontend/src/components/grid/MkGrid.vue new file mode 100644 index 0000000000..a5f82406e8 --- /dev/null +++ b/packages/frontend/src/components/grid/MkGrid.vue @@ -0,0 +1,98 @@ + + + + + diff --git a/packages/frontend/src/components/grid/MkRow.vue b/packages/frontend/src/components/grid/MkRow.vue new file mode 100644 index 0000000000..5e25681b7a --- /dev/null +++ b/packages/frontend/src/components/grid/MkRow.vue @@ -0,0 +1,23 @@ + + + + + diff --git a/packages/frontend/src/components/grid/types.ts b/packages/frontend/src/components/grid/types.ts new file mode 100644 index 0000000000..2834255f48 --- /dev/null +++ b/packages/frontend/src/components/grid/types.ts @@ -0,0 +1,35 @@ +export type CellValue = string | boolean | number | undefined | null + +export type CellAddress = { + row: number; + col: number; +} + +export type GridCell = { + address: CellAddress; + value: CellValue; + columnSetting: ColumnSetting; +} + +export type ColumnType = 'text' | 'number' | 'date' | 'boolean' | 'image'; + +export type ColumnSetting = { + bindTo: string; + title?: string; + type: ColumnType; + width?: number | 'auto'; + editable?: boolean; +}; + +export type DataSource = Record; + +export type GridColumn = { + index: number; + setting: ColumnSetting; + cells: GridCell[]; +} + +export type GridRow = { + index: number; + cells: GridCell[]; +} diff --git a/packages/frontend/src/pages/admin/custom-emojis-grid-emoji.vue b/packages/frontend/src/pages/admin/custom-emojis-grid-emoji.vue deleted file mode 100644 index 126f28057f..0000000000 --- a/packages/frontend/src/pages/admin/custom-emojis-grid-emoji.vue +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - diff --git a/packages/frontend/src/pages/admin/custom-emojis-grid.impl.ts b/packages/frontend/src/pages/admin/custom-emojis-grid.impl.ts index 8191cf1f80..64795da57d 100644 --- a/packages/frontend/src/pages/admin/custom-emojis-grid.impl.ts +++ b/packages/frontend/src/pages/admin/custom-emojis-grid.impl.ts @@ -5,9 +5,9 @@ export class GridItem { readonly url?: string; readonly blob?: Blob; - public aliases: string; public name: string; public category: string; + public aliases: string; public license: string; public isSensitive: boolean; public localOnly: boolean; @@ -15,13 +15,13 @@ export class GridItem { private readonly origin: string; - private constructor( + constructor( id: string | undefined, url: string | undefined = undefined, blob: Blob | undefined = undefined, - aliases: string, name: string, category: string, + aliases: string, license: string, isSensitive: boolean, localOnly: boolean, @@ -43,22 +43,15 @@ export class GridItem { } static ofEmojiDetailed(it: Misskey.entities.EmojiDetailed): GridItem { - return new GridItem( - it.id, - it.url, - undefined, - it.aliases.join(', '), - it.name, - it.category ?? '', - it.license ?? '', - it.isSensitive, - it.localOnly, - it.roleIdsThatCanBeUsedThisEmojiAsReaction.join(', '), - ); + return new GridItem(it.id, it.url, undefined, it.name, it.category ?? '', it.aliases.join(', '), it.license ?? '', it.isSensitive, it.localOnly, it.roleIdsThatCanBeUsedThisEmojiAsReaction.join(', ')); } public get edited(): boolean { const { origin, ..._this } = this; return JSON.stringify(_this) !== origin; } + + public asRecord(): Record { + return this as Record; + } } diff --git a/packages/frontend/src/pages/admin/custom-emojis-grid.vue b/packages/frontend/src/pages/admin/custom-emojis-grid.vue index 111363c878..2227d3e8ec 100644 --- a/packages/frontend/src/pages/admin/custom-emojis-grid.vue +++ b/packages/frontend/src/pages/admin/custom-emojis-grid.vue @@ -5,104 +5,67 @@
- - +
-