fix: listview column resize, phone column & max capping
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -54,7 +54,7 @@ const options = computed(() => {
|
||||
},
|
||||
},
|
||||
mobile_no: {
|
||||
prefix: PhoneIcon,
|
||||
prefix: ({ row }) => (row.mobile_no ? h(PhoneIcon) : null),
|
||||
},
|
||||
},
|
||||
emptyState: {
|
||||
|
||||
@@ -60,7 +60,7 @@ const options = computed(() => {
|
||||
},
|
||||
},
|
||||
mobile_no: {
|
||||
prefix: PhoneIcon,
|
||||
prefix: ({ row }) => (row.mobile_no ? h(PhoneIcon) : null),
|
||||
},
|
||||
},
|
||||
emptyState: {
|
||||
|
||||
+3
-1
@@ -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",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"allowUnreachableCode": false,
|
||||
"target": "es2022",
|
||||
"module": "esnext",
|
||||
"moduleResolution":"node",
|
||||
"jsx": "preserve",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
|
||||
+1
-1
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user