@selfcommunity/react-ui 0.11.0-alpha.35 → 0.11.0-alpha.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/Editor/nodes/HashtagNode.js +2 -0
- package/lib/cjs/components/Editor/nodes/MentionNode.js +2 -0
- package/lib/cjs/utils/buttonCounters.d.ts +1 -0
- package/lib/cjs/utils/buttonCounters.js +4 -3
- package/lib/esm/components/Editor/nodes/HashtagNode.js +2 -0
- package/lib/esm/components/Editor/nodes/MentionNode.js +2 -0
- package/lib/esm/utils/buttonCounters.d.ts +1 -0
- package/lib/esm/utils/buttonCounters.js +3 -2
- package/lib/umd/336.js +1 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +5 -5
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.numberFormatter = void 0;
|
|
3
|
+
exports.numberFormatter = exports.DEFAULT_COUNTERS_LIMIT = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
exports.DEFAULT_COUNTERS_LIMIT = 3;
|
|
5
6
|
function numberFormatter(num) {
|
|
6
|
-
const surplus = num -
|
|
7
|
+
const surplus = num === exports.DEFAULT_COUNTERS_LIMIT ? 1 : num < exports.DEFAULT_COUNTERS_LIMIT ? num : num - exports.DEFAULT_COUNTERS_LIMIT;
|
|
7
8
|
if (surplus > 999999) {
|
|
8
9
|
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["+", (Math.abs(surplus) / 1000000).toFixed(1), "M"] });
|
|
9
10
|
}
|
|
10
|
-
else if (
|
|
11
|
+
else if (surplus > 999) {
|
|
11
12
|
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["+", (Math.abs(surplus) / 1000).toFixed(1), "K"] });
|
|
12
13
|
}
|
|
13
14
|
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["+", surplus] });
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const DEFAULT_COUNTERS_LIMIT = 3;
|
|
2
3
|
export function numberFormatter(num) {
|
|
3
|
-
const surplus = num -
|
|
4
|
+
const surplus = num === DEFAULT_COUNTERS_LIMIT ? 1 : num < DEFAULT_COUNTERS_LIMIT ? num : num - DEFAULT_COUNTERS_LIMIT;
|
|
4
5
|
if (surplus > 999999) {
|
|
5
6
|
return _jsxs(_Fragment, { children: ["+", (Math.abs(surplus) / 1000000).toFixed(1), "M"] });
|
|
6
7
|
}
|
|
7
|
-
else if (
|
|
8
|
+
else if (surplus > 999) {
|
|
8
9
|
return _jsxs(_Fragment, { children: ["+", (Math.abs(surplus) / 1000).toFixed(1), "K"] });
|
|
9
10
|
}
|
|
10
11
|
return _jsxs(_Fragment, { children: ["+", surplus] });
|