summaryrefslogtreecommitdiff
path: root/packages/client/src/components/ui
diff options
context:
space:
mode:
authortamaina <tamaina@hotmail.co.jp>2022-05-28 01:31:23 +0900
committertamaina <tamaina@hotmail.co.jp>2022-05-28 01:31:23 +0900
commitfa99d9c6fee3a7d6f72e254e0aa55972cd6538fb (patch)
tree43d941bbacc9cfaa911fc785fce0b34af4ef6fcc /packages/client/src/components/ui
parentMerge branch 'develop' into pizzax-indexeddb (diff)
parentfix(docs): correct information for drive upload (#8736) (diff)
downloadmisskey-fa99d9c6fee3a7d6f72e254e0aa55972cd6538fb.tar.gz
misskey-fa99d9c6fee3a7d6f72e254e0aa55972cd6538fb.tar.bz2
misskey-fa99d9c6fee3a7d6f72e254e0aa55972cd6538fb.zip
Merge branch 'develop' into pizzax-indexeddb
Diffstat (limited to 'packages/client/src/components/ui')
-rw-r--r--packages/client/src/components/ui/button.vue14
-rw-r--r--packages/client/src/components/ui/context-menu.vue6
-rw-r--r--packages/client/src/components/ui/folder.vue2
-rw-r--r--packages/client/src/components/ui/menu.vue2
-rw-r--r--packages/client/src/components/ui/modal-window.vue8
-rw-r--r--packages/client/src/components/ui/pagination.vue23
-rw-r--r--packages/client/src/components/ui/popup-menu.vue2
-rw-r--r--packages/client/src/components/ui/window.vue54
8 files changed, 61 insertions, 50 deletions
diff --git a/packages/client/src/components/ui/button.vue b/packages/client/src/components/ui/button.vue
index c7b6c8ba96..fe8f1c7cca 100644
--- a/packages/client/src/components/ui/button.vue
+++ b/packages/client/src/components/ui/button.vue
@@ -90,7 +90,7 @@ export default defineComponent({
}
},
methods: {
- onMousedown(e: MouseEvent) {
+ onMousedown(evt: MouseEvent) {
function distance(p, q) {
return Math.hypot(p.x - q.x, p.y - q.y);
}
@@ -104,18 +104,18 @@ export default defineComponent({
return Math.max(dist1, dist2, dist3, dist4) * 2;
}
- const rect = e.target.getBoundingClientRect();
+ const rect = evt.target.getBoundingClientRect();
const ripple = document.createElement('div');
- ripple.style.top = (e.clientY - rect.top - 1).toString() + 'px';
- ripple.style.left = (e.clientX - rect.left - 1).toString() + 'px';
+ ripple.style.top = (evt.clientY - rect.top - 1).toString() + 'px';
+ ripple.style.left = (evt.clientX - rect.left - 1).toString() + 'px';
this.$refs.ripples.appendChild(ripple);
- const circleCenterX = e.clientX - rect.left;
- const circleCenterY = e.clientY - rect.top;
+ const circleCenterX = evt.clientX - rect.left;
+ const circleCenterY = evt.clientY - rect.top;
- const scale = calcCircleScale(e.target.clientWidth, e.target.clientHeight, circleCenterX, circleCenterY);
+ const scale = calcCircleScale(evt.target.clientWidth, evt.target.clientHeight, circleCenterX, circleCenterY);
window.setTimeout(() => {
ripple.style.transform = 'scale(' + (scale / 2) + ')';
diff --git a/packages/client/src/components/ui/context-menu.vue b/packages/client/src/components/ui/context-menu.vue
index f491b43b46..e637d361cf 100644
--- a/packages/client/src/components/ui/context-menu.vue
+++ b/packages/client/src/components/ui/context-menu.vue
@@ -19,7 +19,7 @@ const props = defineProps<{
}>();
const emit = defineEmits<{
- (e: 'closed'): void;
+ (ev: 'closed'): void;
}>();
let rootEl = $ref<HTMLDivElement>();
@@ -63,8 +63,8 @@ onBeforeUnmount(() => {
}
});
-function onMousedown(e: Event) {
- if (!contains(rootEl, e.target) && (rootEl != e.target)) emit('closed');
+function onMousedown(evt: Event) {
+ if (!contains(rootEl, evt.target) && (rootEl !== evt.target)) emit('closed');
}
</script>
diff --git a/packages/client/src/components/ui/folder.vue b/packages/client/src/components/ui/folder.vue
index fe1602b2bb..7daa82cbd3 100644
--- a/packages/client/src/components/ui/folder.vue
+++ b/packages/client/src/components/ui/folder.vue
@@ -23,7 +23,7 @@
<script lang="ts">
import { defineComponent } from 'vue';
-import * as tinycolor from 'tinycolor2';
+import tinycolor from 'tinycolor2';
const localStoragePrefix = 'ui:folder:';
diff --git a/packages/client/src/components/ui/menu.vue b/packages/client/src/components/ui/menu.vue
index a93cc8cda8..ca56048262 100644
--- a/packages/client/src/components/ui/menu.vue
+++ b/packages/client/src/components/ui/menu.vue
@@ -60,7 +60,7 @@ const props = defineProps<{
}>();
const emit = defineEmits<{
- (e: 'close'): void;
+ (ev: 'close'): void;
}>();
let itemsEl = $ref<HTMLDivElement>();
diff --git a/packages/client/src/components/ui/modal-window.vue b/packages/client/src/components/ui/modal-window.vue
index b4b8c2b965..6de29c83fa 100644
--- a/packages/client/src/components/ui/modal-window.vue
+++ b/packages/client/src/components/ui/modal-window.vue
@@ -79,10 +79,10 @@ export default defineComponent({
this.$refs.modal.close();
},
- onKeydown(e) {
- if (e.which === 27) { // Esc
- e.preventDefault();
- e.stopPropagation();
+ onKeydown(evt) {
+ if (evt.which === 27) { // Esc
+ evt.preventDefault();
+ evt.stopPropagation();
this.close();
}
},
diff --git a/packages/client/src/components/ui/pagination.vue b/packages/client/src/components/ui/pagination.vue
index ac6f59c332..c081e06acd 100644
--- a/packages/client/src/components/ui/pagination.vue
+++ b/packages/client/src/components/ui/pagination.vue
@@ -14,8 +14,14 @@
</div>
<div v-else ref="rootEl">
+ <div v-show="pagination.reversed && more" key="_more_" class="cxiknjgy _gap">
+ <MkButton v-if="!moreFetching" class="button" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }" primary @click="fetchMoreAhead">
+ {{ $ts.loadMore }}
+ </MkButton>
+ <MkLoading v-else class="loading"/>
+ </div>
<slot :items="items"></slot>
- <div v-show="more" key="_more_" class="cxiknjgy _gap">
+ <div v-show="!pagination.reversed && more" key="_more_" class="cxiknjgy _gap">
<MkButton v-if="!moreFetching" v-appear="($store.state.enableInfiniteScroll && !disableAutoLoad) ? fetchMore : null" class="button" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }" primary @click="fetchMore">
{{ $ts.loadMore }}
</MkButton>
@@ -62,7 +68,7 @@ const props = withDefaults(defineProps<{
});
const emit = defineEmits<{
- (e: 'queue', count: number): void;
+ (ev: 'queue', count: number): void;
}>();
type Item = { id: string; [another: string]: unknown; };
@@ -106,7 +112,7 @@ const init = async (): Promise<void> => {
offset.value = res.length;
error.value = false;
fetching.value = false;
- }, e => {
+ }, err => {
error.value = true;
fetching.value = false;
});
@@ -149,7 +155,7 @@ const fetchMore = async (): Promise<void> => {
}
offset.value += res.length;
moreFetching.value = false;
- }, e => {
+ }, err => {
moreFetching.value = false;
});
};
@@ -177,7 +183,7 @@ const fetchMoreAhead = async (): Promise<void> => {
}
offset.value += res.length;
moreFetching.value = false;
- }, e => {
+ }, err => {
moreFetching.value = false;
});
};
@@ -244,6 +250,11 @@ const append = (item: Item): void => {
items.value.push(item);
};
+const removeItem = (finder: (item: Item) => boolean) => {
+ const i = items.value.findIndex(finder);
+ items.value.splice(i, 1);
+};
+
const updateItem = (id: Item['id'], replacer: (old: Item) => Item): void => {
const i = items.value.findIndex(item => item.id === id);
items.value[i] = replacer(items.value[i]);
@@ -273,9 +284,9 @@ defineExpose({
queue,
backed,
reload,
- fetchMoreAhead,
prepend,
append,
+ removeItem,
updateItem,
});
</script>
diff --git a/packages/client/src/components/ui/popup-menu.vue b/packages/client/src/components/ui/popup-menu.vue
index 8d6c1b5695..2bc7030d77 100644
--- a/packages/client/src/components/ui/popup-menu.vue
+++ b/packages/client/src/components/ui/popup-menu.vue
@@ -19,7 +19,7 @@ defineProps<{
}>();
const emit = defineEmits<{
- (e: 'closed'): void;
+ (ev: 'closed'): void;
}>();
let modal = $ref<InstanceType<typeof MkModal>>();
diff --git a/packages/client/src/components/ui/window.vue b/packages/client/src/components/ui/window.vue
index fa32ecfdef..2066cf579d 100644
--- a/packages/client/src/components/ui/window.vue
+++ b/packages/client/src/components/ui/window.vue
@@ -139,10 +139,10 @@ export default defineComponent({
this.showing = false;
},
- onKeydown(e) {
- if (e.which === 27) { // Esc
- e.preventDefault();
- e.stopPropagation();
+ onKeydown(evt) {
+ if (evt.which === 27) { // Esc
+ evt.preventDefault();
+ evt.stopPropagation();
this.close();
}
},
@@ -162,15 +162,15 @@ export default defineComponent({
this.top();
},
- onHeaderMousedown(e) {
+ onHeaderMousedown(evt) {
const main = this.$el as any;
if (!contains(main, document.activeElement)) main.focus();
const position = main.getBoundingClientRect();
- const clickX = e.touches && e.touches.length > 0 ? e.touches[0].clientX : e.clientX;
- const clickY = e.touches && e.touches.length > 0 ? e.touches[0].clientY : e.clientY;
+ const clickX = evt.touches && evt.touches.length > 0 ? evt.touches[0].clientX : evt.clientX;
+ const clickY = evt.touches && evt.touches.length > 0 ? evt.touches[0].clientY : evt.clientY;
const moveBaseX = clickX - position.left;
const moveBaseY = clickY - position.top;
const browserWidth = window.innerWidth;
@@ -204,10 +204,10 @@ export default defineComponent({
},
// 上ハンドル掴み時
- onTopHandleMousedown(e) {
+ onTopHandleMousedown(evt) {
const main = this.$el as any;
- const base = e.clientY;
+ const base = evt.clientY;
const height = parseInt(getComputedStyle(main, '').height, 10);
const top = parseInt(getComputedStyle(main, '').top, 10);
@@ -230,10 +230,10 @@ export default defineComponent({
},
// 右ハンドル掴み時
- onRightHandleMousedown(e) {
+ onRightHandleMousedown(evt) {
const main = this.$el as any;
- const base = e.clientX;
+ const base = evt.clientX;
const width = parseInt(getComputedStyle(main, '').width, 10);
const left = parseInt(getComputedStyle(main, '').left, 10);
const browserWidth = window.innerWidth;
@@ -254,10 +254,10 @@ export default defineComponent({
},
// 下ハンドル掴み時
- onBottomHandleMousedown(e) {
+ onBottomHandleMousedown(evt) {
const main = this.$el as any;
- const base = e.clientY;
+ const base = evt.clientY;
const height = parseInt(getComputedStyle(main, '').height, 10);
const top = parseInt(getComputedStyle(main, '').top, 10);
const browserHeight = window.innerHeight;
@@ -278,10 +278,10 @@ export default defineComponent({
},
// 左ハンドル掴み時
- onLeftHandleMousedown(e) {
+ onLeftHandleMousedown(evt) {
const main = this.$el as any;
- const base = e.clientX;
+ const base = evt.clientX;
const width = parseInt(getComputedStyle(main, '').width, 10);
const left = parseInt(getComputedStyle(main, '').left, 10);
@@ -304,27 +304,27 @@ export default defineComponent({
},
// 左上ハンドル掴み時
- onTopLeftHandleMousedown(e) {
- this.onTopHandleMousedown(e);
- this.onLeftHandleMousedown(e);
+ onTopLeftHandleMousedown(evt) {
+ this.onTopHandleMousedown(evt);
+ this.onLeftHandleMousedown(evt);
},
// 右上ハンドル掴み時
- onTopRightHandleMousedown(e) {
- this.onTopHandleMousedown(e);
- this.onRightHandleMousedown(e);
+ onTopRightHandleMousedown(evt) {
+ this.onTopHandleMousedown(evt);
+ this.onRightHandleMousedown(evt);
},
// 右下ハンドル掴み時
- onBottomRightHandleMousedown(e) {
- this.onBottomHandleMousedown(e);
- this.onRightHandleMousedown(e);
+ onBottomRightHandleMousedown(evt) {
+ this.onBottomHandleMousedown(evt);
+ this.onRightHandleMousedown(evt);
},
// 左下ハンドル掴み時
- onBottomLeftHandleMousedown(e) {
- this.onBottomHandleMousedown(e);
- this.onLeftHandleMousedown(e);
+ onBottomLeftHandleMousedown(evt) {
+ this.onBottomHandleMousedown(evt);
+ this.onLeftHandleMousedown(evt);
},
// 高さを適用