fix: listview column resize, phone column & max capping

This commit is contained in:
Ritvik Sardana
2026-06-29 18:02:33 +05:30
parent 4a072f4664
commit c4b07a935d
7 changed files with 18 additions and 9 deletions
+4 -1
View File
@@ -817,7 +817,10 @@ function handleScrollPosition() {
}, 200);
}
function handleColumnResize() {
function handleColumnResize({ key, width, save } = {}) {
const column = columns.value.find((c) => c.key === key);
if (column) column.width = width;
if (!save) return;
isViewUpdated.value = true;
defaultParams.columns = columns.value;
if (!defaultParams.is_default) return;
+8 -1
View File
@@ -10,7 +10,9 @@
/>
<div
class="flex flex-col h-full gap-1.5"
:class="[isMobileView && 'flex-1 items-center justify-center']"
:class="[
(isMobileView || !hasDocInfo) && 'flex-1 items-center justify-center',
]"
>
<div class="flex gap-2 items-center">
<p class="font-medium text-ink-gray-8 text-xl">
@@ -56,6 +58,7 @@
<script setup lang="ts">
import { useScreenSize } from "@/composables/screen";
import { Avatar, Badge, Tooltip, type AvatarProps } from "frappe-ui";
import { computed } from "vue";
interface DocInfoItem {
icon?: any;
@@ -83,4 +86,8 @@ const props = withDefaults(
);
const { isMobileView } = useScreenSize();
const hasDocInfo = computed(() => {
return props.docInfo?.some((item) => item.value) ?? false;
});
</script>
+1 -1
View File
@@ -54,7 +54,7 @@ const options = computed(() => {
},
},
mobile_no: {
prefix: PhoneIcon,
prefix: ({ row }) => (row.mobile_no ? h(PhoneIcon) : null),
},
},
emptyState: {
+1 -1
View File
@@ -60,7 +60,7 @@ const options = computed(() => {
},
},
mobile_no: {
prefix: PhoneIcon,
prefix: ({ row }) => (row.mobile_no ? h(PhoneIcon) : null),
},
},
emptyState: {
+3 -1
View File
@@ -891,9 +891,11 @@ export function buildPercentageChange(
}
const isPositive = value > 0;
const isGood = negativeIsBetter ? !isPositive : isPositive;
// Cap the magnitude at 100% so large swings (e.g. +3186%) stay readable.
const capped = Math.min(Math.abs(value), 100);
return {
icon: isPositive ? "lucide-arrow-up-right" : "lucide-arrow-down-left",
value: isPositive ? `+${value}` : value,
value: isPositive ? `+${capped}` : `-${capped}`,
color: isGood ? "text-ink-green-3" : "text-ink-red-3",
};
}
-3
View File
@@ -4,9 +4,6 @@
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false,
"target": "es2022",
"module": "esnext",
"moduleResolution":"node",
"jsx": "preserve",
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
+1 -1
View File
@@ -99,7 +99,7 @@ export default defineConfig(async ({ mode }) => {
alias: {
"@": path.resolve(__dirname, "src"),
"tailwind.config.js": path.resolve(__dirname, "tailwind.config.js"),
...localFrappeUIAliases,
// ...localFrappeUIAliases,
},
dedupe: [
"prosemirror-view",