mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-22 06:54:08 +01:00
🎨 Add some currency formatting support to database numeric fields https://github.com/siyuan-note/siyuan/issues/15232
This commit is contained in:
parent
53e8733848
commit
9a9f1229b4
2 changed files with 133 additions and 10 deletions
|
|
@ -158,6 +158,69 @@ export const formatNumber = (options: {
|
|||
oldFormat: options.oldFormat,
|
||||
avPanelElement: options.avPanelElement,
|
||||
});
|
||||
addFormatItem({
|
||||
menu,
|
||||
protyle: options.protyle,
|
||||
colId: options.colId,
|
||||
avID: options.avID,
|
||||
format: "THB",
|
||||
oldFormat: options.oldFormat,
|
||||
avPanelElement: options.avPanelElement,
|
||||
});
|
||||
addFormatItem({
|
||||
menu,
|
||||
protyle: options.protyle,
|
||||
colId: options.colId,
|
||||
avID: options.avID,
|
||||
format: "AUD",
|
||||
oldFormat: options.oldFormat,
|
||||
avPanelElement: options.avPanelElement,
|
||||
});
|
||||
addFormatItem({
|
||||
menu,
|
||||
protyle: options.protyle,
|
||||
colId: options.colId,
|
||||
avID: options.avID,
|
||||
format: "HKD",
|
||||
oldFormat: options.oldFormat,
|
||||
avPanelElement: options.avPanelElement,
|
||||
});
|
||||
addFormatItem({
|
||||
menu,
|
||||
protyle: options.protyle,
|
||||
colId: options.colId,
|
||||
avID: options.avID,
|
||||
format: "TWD",
|
||||
oldFormat: options.oldFormat,
|
||||
avPanelElement: options.avPanelElement,
|
||||
});
|
||||
addFormatItem({
|
||||
menu,
|
||||
protyle: options.protyle,
|
||||
colId: options.colId,
|
||||
avID: options.avID,
|
||||
format: "MOP",
|
||||
oldFormat: options.oldFormat,
|
||||
avPanelElement: options.avPanelElement,
|
||||
});
|
||||
addFormatItem({
|
||||
menu,
|
||||
protyle: options.protyle,
|
||||
colId: options.colId,
|
||||
avID: options.avID,
|
||||
format: "SGD",
|
||||
oldFormat: options.oldFormat,
|
||||
avPanelElement: options.avPanelElement,
|
||||
});
|
||||
addFormatItem({
|
||||
menu,
|
||||
protyle: options.protyle,
|
||||
colId: options.colId,
|
||||
avID: options.avID,
|
||||
format: "NZD",
|
||||
oldFormat: options.oldFormat,
|
||||
avPanelElement: options.avPanelElement,
|
||||
});
|
||||
const rect = options.element.getBoundingClientRect();
|
||||
menu.open({
|
||||
x: rect.left,
|
||||
|
|
@ -196,5 +259,19 @@ export const getLabelByNumberFormat = (format: string) => {
|
|||
return window.siyuan.languages.numberFormatCanadianDollar;
|
||||
case "franc":
|
||||
return window.siyuan.languages.numberFormatFranc;
|
||||
case "THB":
|
||||
return window.siyuan.languages.numberFormatTHB;
|
||||
case "AUD":
|
||||
return window.siyuan.languages.numberFormatAUD;
|
||||
case "HKD":
|
||||
return window.siyuan.languages.numberFormatHKD;
|
||||
case "TWD":
|
||||
return window.siyuan.languages.numberFormatTWD;
|
||||
case "MOP":
|
||||
return window.siyuan.languages.numberFormatMOP;
|
||||
case "SGD":
|
||||
return window.siyuan.languages.numberFormatSGD;
|
||||
case "NZD":
|
||||
return window.siyuan.languages.numberFormatNZD;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue