From 8447dd7ae67fea47a3533f2ba32d7933739fb7f2 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 17 Jan 2026 22:16:30 +0800 Subject: [PATCH] support pasting amount on number pad sheet for non-ios device --- src/components/mobile/NumberPadSheet.vue | 66 ++++++++++++++++++--- src/locales/de.json | 1 + src/locales/en.json | 1 + src/locales/es.json | 1 + src/locales/fr.json | 1 + src/locales/it.json | 1 + src/locales/ja.json | 1 + src/locales/kn.json | 1 + src/locales/ko.json | 1 + src/locales/nl.json | 1 + src/locales/pt_BR.json | 1 + src/locales/ru.json | 1 + src/locales/sl.json | 1 + src/locales/th.json | 1 + src/locales/tr.json | 1 + src/locales/uk.json | 1 + src/locales/vi.json | 1 + src/locales/zh_Hans.json | 1 + src/locales/zh_Hant.json | 1 + src/styles/mobile/font-size-default.scss | 5 ++ src/styles/mobile/font-size-large.scss | 5 ++ src/styles/mobile/font-size-small.scss | 5 ++ src/styles/mobile/font-size-x-large.scss | 5 ++ src/styles/mobile/font-size-xx-large.scss | 5 ++ src/styles/mobile/font-size-xxx-large.scss | 5 ++ src/styles/mobile/font-size-xxxx-large.scss | 5 ++ 26 files changed, 112 insertions(+), 7 deletions(-) diff --git a/src/components/mobile/NumberPadSheet.vue b/src/components/mobile/NumberPadSheet.vue index 733b83e9..85894fe9 100644 --- a/src/components/mobile/NumberPadSheet.vue +++ b/src/components/mobile/NumberPadSheet.vue @@ -6,9 +6,17 @@
{{ hint }}
-
- {{ currentDisplay }} +
+ {{ currentDisplay }}
+ + + + + + +
{{ digits[7] }} @@ -111,7 +119,8 @@ const isSupportClipboard = !!navigator.clipboard; const previousValue = ref(''); const currentSymbol = ref(''); const currentValue = ref(getInitedStringValue(props.modelValue, props.flipNegative)); -const pasteingAmount = ref(false); +const pastingAmount = ref(false); +const showPastePopover = ref(false); const numeralSystem = computed(() => getCurrentNumeralSystemType()); @@ -317,15 +326,17 @@ function clear(): void { } function paste(): void { - if (!isiOS() || !isSupportClipboard || pasteingAmount.value) { - pasteingAmount.value = false; + showPastePopover.value = false; + + if (pastingAmount.value) { + pastingAmount.value = false; return; } - pasteingAmount.value = true; + pastingAmount.value = true; navigator.clipboard.readText().then(text => { - pasteingAmount.value = false; + pastingAmount.value = false; if (!text) { return; @@ -354,6 +365,7 @@ function paste(): void { currentValue.value = getStringValue(parsedAmount, false); }).catch(error => { + pastingAmount.value = false; logger.error('failed to read clipboard text', error); }); } @@ -431,6 +443,18 @@ function onSheetClosed(): void { close(); } +function onDisplayValueClick(): void { + if (!isSupportClipboard) { + return; + } + + if (isiOS()) { + paste(); + } else { + showPastePopover.value = true; + } +} + watch(() => props.flipNegative, (newValue) => { currentValue.value = getInitedStringValue(props.modelValue, newValue); }); @@ -519,4 +543,32 @@ watch(() => props.flipNegative, (newValue) => { .numpad-button-text-confirm { font-size: var(--ebk-numpad-confirm-button-font-size); } + +.numpad-paste-popover.popover { + width: auto; + + .numpad-paste-popover-context-menu-list.list { + :first-child li:first-child a { + &.active-state { + border-radius: unset; + } + + > .item-content { + min-height: var(--ebk-popover-context-menu-min-height); + + > .item-inner { + min-height: var(--ebk-popover-context-menu-min-height); + padding-top: var(--ebk-popover-context-menu-vertical-padding); + padding-bottom: var(--ebk-popover-context-menu-vertical-padding); + padding-left: var(--ebk-popover-context-menu-left-padding); + padding-right: var(--ebk-popover-context-menu-right-padding); + + > .item-title { + font-size: var(--ebk-popover-context-menu-button-font-size); + } + } + } + } + } +} diff --git a/src/locales/de.json b/src/locales/de.json index d3bffda4..13a72562 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -1482,6 +1482,7 @@ "Example": "Example", "Token": "Token", "Copy": "Kopieren", + "Paste": "Paste", "Visible": "Sichtbar", "Show": "Anzeigen", "Hide": "Verbergen", diff --git a/src/locales/en.json b/src/locales/en.json index 06e9e119..481f8028 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1482,6 +1482,7 @@ "Example": "Example", "Token": "Token", "Copy": "Copy", + "Paste": "Paste", "Visible": "Visible", "Show": "Show", "Hide": "Hide", diff --git a/src/locales/es.json b/src/locales/es.json index 7d9c127b..877f9220 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -1482,6 +1482,7 @@ "Example": "Example", "Token": "Token", "Copy": "Copiar", + "Paste": "Paste", "Visible": "Visible", "Show": "Mostrar", "Hide": "Ocultar", diff --git a/src/locales/fr.json b/src/locales/fr.json index e8ecd3a4..240fbb3c 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -1482,6 +1482,7 @@ "Example": "Example", "Token": "Jeton", "Copy": "Copier", + "Paste": "Paste", "Visible": "Visible", "Show": "Afficher", "Hide": "Masquer", diff --git a/src/locales/it.json b/src/locales/it.json index 44e343a0..476ca0ac 100644 --- a/src/locales/it.json +++ b/src/locales/it.json @@ -1482,6 +1482,7 @@ "Example": "Example", "Token": "Token", "Copy": "Copia", + "Paste": "Paste", "Visible": "Visibile", "Show": "Mostra", "Hide": "Nascondi", diff --git a/src/locales/ja.json b/src/locales/ja.json index 146b95af..0ffa9dea 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -1482,6 +1482,7 @@ "Example": "Example", "Token": "Token", "Copy": "コピー", + "Paste": "Paste", "Visible": "見える", "Show": "表示", "Hide": "非表示", diff --git a/src/locales/kn.json b/src/locales/kn.json index d0787b7c..3078e5ce 100644 --- a/src/locales/kn.json +++ b/src/locales/kn.json @@ -1482,6 +1482,7 @@ "Example": "ಉದಾಹರಣೆ", "Token": "ಟೋಕನ್", "Copy": "ನಕಲಿಸು", + "Paste": "Paste", "Visible": "ಗೋಚರಿಸು", "Show": "ತೋರಿಸು", "Hide": "ಮರೆಮಾಡು", diff --git a/src/locales/ko.json b/src/locales/ko.json index 7e8066a9..235f49b0 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -1482,6 +1482,7 @@ "Example": "Example", "Token": "토큰", "Copy": "복사", + "Paste": "Paste", "Visible": "표시", "Show": "보기", "Hide": "숨기기", diff --git a/src/locales/nl.json b/src/locales/nl.json index ba51ff06..ac77d739 100644 --- a/src/locales/nl.json +++ b/src/locales/nl.json @@ -1482,6 +1482,7 @@ "Example": "Example", "Token": "Token", "Copy": "Kopiëren", + "Paste": "Paste", "Visible": "Zichtbaar", "Show": "Tonen", "Hide": "Verbergen", diff --git a/src/locales/pt_BR.json b/src/locales/pt_BR.json index a5319fa4..7ca0cb18 100644 --- a/src/locales/pt_BR.json +++ b/src/locales/pt_BR.json @@ -1482,6 +1482,7 @@ "Example": "Example", "Token": "Token", "Copy": "Copiar", + "Paste": "Paste", "Visible": "Visível", "Show": "Mostrar", "Hide": "Ocultar", diff --git a/src/locales/ru.json b/src/locales/ru.json index 3d917eca..d14bc872 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -1482,6 +1482,7 @@ "Example": "Example", "Token": "Token", "Copy": "Копировать", + "Paste": "Paste", "Visible": "Видимый", "Show": "Показать", "Hide": "Скрыть", diff --git a/src/locales/sl.json b/src/locales/sl.json index 6898f930..91060827 100644 --- a/src/locales/sl.json +++ b/src/locales/sl.json @@ -1482,6 +1482,7 @@ "Example": "Primer", "Token": "Žeton", "Copy": "Kopiraj", + "Paste": "Paste", "Visible": "Vidno", "Show": "Prikaži", "Hide": "Skrij", diff --git a/src/locales/th.json b/src/locales/th.json index e532e0f9..2183c09d 100644 --- a/src/locales/th.json +++ b/src/locales/th.json @@ -1482,6 +1482,7 @@ "Example": "Example", "Token": "โทเค็น", "Copy": "คัดลอก", + "Paste": "Paste", "Visible": "มองเห็น", "Show": "แสดง", "Hide": "ซ่อน", diff --git a/src/locales/tr.json b/src/locales/tr.json index 6019d24c..c3687f2e 100644 --- a/src/locales/tr.json +++ b/src/locales/tr.json @@ -1482,6 +1482,7 @@ "Example": "Örnek", "Token": "Jeton", "Copy": "Kopyala", + "Paste": "Paste", "Visible": "Görünür", "Show": "Göster", "Hide": "Gizle", diff --git a/src/locales/uk.json b/src/locales/uk.json index 502a66c4..71fa9487 100644 --- a/src/locales/uk.json +++ b/src/locales/uk.json @@ -1482,6 +1482,7 @@ "Example": "Example", "Token": "Token", "Copy": "Копіювати", + "Paste": "Paste", "Visible": "Видимий", "Show": "Показати", "Hide": "Сховати", diff --git a/src/locales/vi.json b/src/locales/vi.json index c738a9f6..3335b24d 100644 --- a/src/locales/vi.json +++ b/src/locales/vi.json @@ -1482,6 +1482,7 @@ "Example": "Example", "Token": "Token", "Copy": "Sao chép", + "Paste": "Paste", "Visible": "Hiển thị", "Show": "Hiển thị", "Hide": "Ẩn", diff --git a/src/locales/zh_Hans.json b/src/locales/zh_Hans.json index 28f09f62..b80d6443 100644 --- a/src/locales/zh_Hans.json +++ b/src/locales/zh_Hans.json @@ -1482,6 +1482,7 @@ "Example": "示例", "Token": "令牌", "Copy": "复制", + "Paste": "粘贴", "Visible": "可见", "Show": "显示", "Hide": "隐藏", diff --git a/src/locales/zh_Hant.json b/src/locales/zh_Hant.json index e4935a88..79db16f0 100644 --- a/src/locales/zh_Hant.json +++ b/src/locales/zh_Hant.json @@ -1482,6 +1482,7 @@ "Example": "範例", "Token": "令牌", "Copy": "複製", + "Paste": "貼上", "Visible": "可見", "Show": "顯示", "Hide": "隱藏", diff --git a/src/styles/mobile/font-size-default.scss b/src/styles/mobile/font-size-default.scss index aef95563..3e05a239 100644 --- a/src/styles/mobile/font-size-default.scss +++ b/src/styles/mobile/font-size-default.scss @@ -62,6 +62,11 @@ --ebk-large-footer-font-size: 13px; --ebk-sheet-title-font-size: 18px; --ebk-popover-list-group-title-height: 29px; + --ebk-popover-context-menu-min-height: 40px; + --ebk-popover-context-menu-vertical-padding: 12px; + --ebk-popover-context-menu-left-padding: 4px; + --ebk-popover-context-menu-right-padding: 20px; + --ebk-popover-context-menu-button-font-size: 15px; --ebk-numpad-value-height: 50px; --ebk-numpad-value-small-font-size: 20px; --ebk-numpad-value-normal-font-size: 22px; diff --git a/src/styles/mobile/font-size-large.scss b/src/styles/mobile/font-size-large.scss index 61b41e7f..f68b52b4 100644 --- a/src/styles/mobile/font-size-large.scss +++ b/src/styles/mobile/font-size-large.scss @@ -62,6 +62,11 @@ --ebk-large-footer-font-size: 14px; --ebk-sheet-title-font-size: 19px; --ebk-popover-list-group-title-height: 30px; + --ebk-popover-context-menu-min-height: 42px; + --ebk-popover-context-menu-vertical-padding: 13px; + --ebk-popover-context-menu-left-padding: 4px; + --ebk-popover-context-menu-right-padding: 22px; + --ebk-popover-context-menu-button-font-size: 16px; --ebk-numpad-value-height: 52px; --ebk-numpad-value-small-font-size: 21px; --ebk-numpad-value-normal-font-size: 23px; diff --git a/src/styles/mobile/font-size-small.scss b/src/styles/mobile/font-size-small.scss index 0678e2c7..2c4f5d38 100644 --- a/src/styles/mobile/font-size-small.scss +++ b/src/styles/mobile/font-size-small.scss @@ -62,6 +62,11 @@ --ebk-large-footer-font-size: 13px; --ebk-sheet-title-font-size: 18px; --ebk-popover-list-group-title-height: 28px; + --ebk-popover-context-menu-min-height: 38px; + --ebk-popover-context-menu-vertical-padding: 11px; + --ebk-popover-context-menu-left-padding: 4px; + --ebk-popover-context-menu-right-padding: 18px; + --ebk-popover-context-menu-button-font-size: 14px; --ebk-numpad-value-height: 50px; --ebk-numpad-value-small-font-size: 20px; --ebk-numpad-value-normal-font-size: 22px; diff --git a/src/styles/mobile/font-size-x-large.scss b/src/styles/mobile/font-size-x-large.scss index 226036d9..4bdd2d33 100644 --- a/src/styles/mobile/font-size-x-large.scss +++ b/src/styles/mobile/font-size-x-large.scss @@ -62,6 +62,11 @@ --ebk-large-footer-font-size: 15px; --ebk-sheet-title-font-size: 20px; --ebk-popover-list-group-title-height: 32px; + --ebk-popover-context-menu-min-height: 46px; + --ebk-popover-context-menu-vertical-padding: 15px; + --ebk-popover-context-menu-left-padding: 8px; + --ebk-popover-context-menu-right-padding: 26px; + --ebk-popover-context-menu-button-font-size: 17px; --ebk-numpad-value-height: 54px; --ebk-numpad-value-small-font-size: 22px; --ebk-numpad-value-normal-font-size: 24px; diff --git a/src/styles/mobile/font-size-xx-large.scss b/src/styles/mobile/font-size-xx-large.scss index fba029b4..df6150c1 100644 --- a/src/styles/mobile/font-size-xx-large.scss +++ b/src/styles/mobile/font-size-xx-large.scss @@ -62,6 +62,11 @@ --ebk-large-footer-font-size: 16px; --ebk-sheet-title-font-size: 22px; --ebk-popover-list-group-title-height: 34px; + --ebk-popover-context-menu-min-height: 48px; + --ebk-popover-context-menu-vertical-padding: 15px; + --ebk-popover-context-menu-left-padding: 10px; + --ebk-popover-context-menu-right-padding: 28px; + --ebk-popover-context-menu-button-font-size: 18px; --ebk-numpad-value-height: 60px; --ebk-numpad-value-small-font-size: 22px; --ebk-numpad-value-normal-font-size: 26px; diff --git a/src/styles/mobile/font-size-xxx-large.scss b/src/styles/mobile/font-size-xxx-large.scss index 33599ec0..71d84aa1 100644 --- a/src/styles/mobile/font-size-xxx-large.scss +++ b/src/styles/mobile/font-size-xxx-large.scss @@ -62,6 +62,11 @@ --ebk-large-footer-font-size: 18px; --ebk-sheet-title-font-size: 24px; --ebk-popover-list-group-title-height: 36px; + --ebk-popover-context-menu-min-height: 50px; + --ebk-popover-context-menu-vertical-padding: 15px; + --ebk-popover-context-menu-left-padding: 11px; + --ebk-popover-context-menu-right-padding: 29px; + --ebk-popover-context-menu-button-font-size: 19px; --ebk-numpad-value-height: 60px; --ebk-numpad-value-small-font-size: 24px; --ebk-numpad-value-normal-font-size: 28px; diff --git a/src/styles/mobile/font-size-xxxx-large.scss b/src/styles/mobile/font-size-xxxx-large.scss index 66e468a1..1a868673 100644 --- a/src/styles/mobile/font-size-xxxx-large.scss +++ b/src/styles/mobile/font-size-xxxx-large.scss @@ -62,6 +62,11 @@ --ebk-large-footer-font-size: 20px; --ebk-sheet-title-font-size: 26px; --ebk-popover-list-group-title-height: 38px; + --ebk-popover-context-menu-min-height: 54px; + --ebk-popover-context-menu-vertical-padding: 16px; + --ebk-popover-context-menu-left-padding: 12px; + --ebk-popover-context-menu-right-padding: 30px; + --ebk-popover-context-menu-button-font-size: 21px; --ebk-numpad-value-height: 60px; --ebk-numpad-value-small-font-size: 26px; --ebk-numpad-value-normal-font-size: 26px;