@wisemen/wise-crm-web 2.0.0-alpha.41 → 2.0.0-alpha.43

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/README.md CHANGED
@@ -125,9 +125,25 @@ useWiseCrmConfig().init({
125
125
  | Field | Description |
126
126
  | ------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
127
127
  | `key` | Unique per entity; used to cache the badge's data. |
128
- | `getData` | Receives `{ uuid }` and resolves to the badge label. Resolve to `null` or `''` to hide the badge. |
128
+ | `getData` | Receives `{ uuid }` and resolves to the badge label, or to `{ label, color?, variant?, icon?, dot? }` when the style depends on the data. Resolve to `null` or an empty label to hide the badge. |
129
129
  | `color`, `variant`, `icon`, `dot` | Optional, passed to `UIBadge`. Defaults match the built-in badges (`gray`, `translucent`). |
130
130
 
131
+ Styles returned from `getData` override the ones on the badge, for example to color a score by its value:
132
+
133
+ ```ts
134
+ {
135
+ key: 'credit-score',
136
+ getData: async ({ uuid }) => {
137
+ const { score, isHealthy } = await CreditService.getForBusiness(uuid)
138
+
139
+ return {
140
+ label: t('crm.business.badges.credit_score', { score }),
141
+ color: isHealthy ? 'success' : 'error',
142
+ }
143
+ },
144
+ }
145
+ ```
146
+
131
147
  Type the arrays with `WiseCrmBusinessHeaderBadge`, `WiseCrmIndividualHeaderBadge` or `WiseCrmDealHeaderBadge`; `uuid` is then a `WiseCrmBusinessUuid`, `WiseCrmIndividualUuid` or `WiseCrmDealUuid`.
132
148
 
133
149
  - The label is rendered as is, so translate it in `getData`. Badges refetch when the locale changes. Long labels are truncated with a tooltip.
@@ -1,8 +1,8 @@
1
1
  import { defineComponent as n, openBlock as o, createBlock as r, unref as s, withCtx as a, createVNode as u } from "vue";
2
2
  import { useRouteParams as m } from "@vueuse/router";
3
- import { _ as p } from "./index-DEBSTcsW.js";
3
+ import { _ as p } from "./index-Hc4kvsaE.js";
4
4
  import { br as c } from "./uuid.util-SYJY4Bt5.js";
5
- import { _ } from "./CrmDetailView.vue_vue_type_script_setup_true_lang-Xwd_IT_R.js";
5
+ import { _ } from "./CrmDetailView.vue_vue_type_script_setup_true_lang-C2Pnl58E.js";
6
6
  const x = /* @__PURE__ */ n({
7
7
  __name: "BusinessDetailView",
8
8
  props: {
@@ -1,7 +1,7 @@
1
- import { defineComponent as v, ref as h, unref as e, openBlock as d, createElementBlock as u, createElementVNode as t, renderSlot as x, createVNode as r, withCtx as f, Fragment as y, renderList as g, createBlock as w, toValue as m, createCommentVNode as b } from "vue";
1
+ import { defineComponent as v, ref as h, unref as e, openBlock as d, createElementBlock as u, createElementVNode as t, renderSlot as x, createVNode as r, withCtx as f, Fragment as w, renderList as y, createBlock as g, toValue as m, createCommentVNode as b } from "vue";
2
2
  import { onKeyStroke as C } from "@vueuse/core";
3
3
  import { UITabsRouterLink as k, UITabsRouterLinkItem as R, UIIconButton as B } from "@wisemen/vue-core-design-system";
4
- import { h as E, j as I, $ as T, ad as V } from "./index-DEBSTcsW.js";
4
+ import { h as E, j as I, $ as T, ad as V } from "./index-Hc4kvsaE.js";
5
5
  import { useRoute as $, RouterView as j } from "vue-router";
6
6
  class A {
7
7
  /**
@@ -19,7 +19,7 @@ class A {
19
19
  return !1;
20
20
  }
21
21
  }
22
- const H = { key: 0 }, U = { class: "flex h-dvh w-dvw flex-1 overflow-hidden" }, z = { class: "flex h-full min-w-100 flex-col" }, L = { class: "flex size-full flex-1 justify-center overflow-hidden bg-secondary" }, N = { class: "flex w-full flex-col" }, S = { class: "grid w-full grid-cols-3 p-lg" }, D = { class: "flex items-center justify-center" }, F = { class: "flex items-center justify-end" }, K = { class: "size-full overflow-y-auto" }, P = /* @__PURE__ */ v({
22
+ const H = { key: 0 }, U = { class: "flex h-dvh w-dvw flex-1 overflow-hidden" }, z = { class: "flex h-full min-w-100 flex-col" }, L = { class: "flex size-full flex-1 justify-center overflow-hidden bg-secondary" }, N = { class: "flex w-full flex-col" }, S = { class: "grid w-full grid-cols-[1fr_auto_1fr] p-lg" }, D = { class: "flex min-w-0 items-center justify-center" }, F = { class: "flex items-center justify-end" }, K = { class: "size-full overflow-y-auto" }, P = /* @__PURE__ */ v({
23
23
  __name: "CrmDetailView",
24
24
  props: {
25
25
  entityType: {},
@@ -45,9 +45,12 @@ const H = { key: 0 }, U = { class: "flex h-dvh w-dvw flex-1 overflow-hidden" },
45
45
  t("div", S, [
46
46
  n[1] || (n[1] = t("div", null, null, -1)),
47
47
  t("div", D, [
48
- r(e(k), { variant: "button-border" }, {
48
+ r(e(k), {
49
+ variant: "button-border",
50
+ class: "min-w-0"
51
+ }, {
49
52
  default: f(() => [
50
- (d(!0), u(y, null, g(a.tabs, (s) => (d(), w(e(R), {
53
+ (d(!0), u(w, null, y(a.tabs, (s) => (d(), g(e(R), {
51
54
  key: m(s.label),
52
55
  label: m(s.label),
53
56
  to: {
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as y, openBlock as t, createElementBlock as _, createElementVNode as s, createBlock as o, resolveDynamicComponent as x, unref as e, toDisplayString as p, createVNode as r, withCtx as n, createCommentVNode as f, Fragment as b, renderList as w, normalizeClass as k, computed as I } from "vue";
2
2
  import { useRouteParams as U } from "@vueuse/router";
3
3
  import { useOffsetInfiniteQuery as M } from "@wisemen/vue-core-api-utils";
4
- import { M as z, u as E, a as L, T as j, b as B, W as F, F as T, c as S, D as h, g as A, d as D, m as N, e as V, A as H } from "./index-DEBSTcsW.js";
4
+ import { M as z, u as E, a as L, T as j, b as B, W as F, F as T, c as S, D as h, g as A, d as D, m as N, e as V, A as H } from "./index-Hc4kvsaE.js";
5
5
  import { UIIconButton as Q, UIEmptyState as q, UIBadge as P } from "@wisemen/vue-core-design-system";
6
6
  import { AnimatePresence as W, Motion as O } from "motion-v";
7
7
  import { AccordionRoot as R, AccordionItem as G, AccordionHeader as J, AccordionTrigger as K, AccordionContent as X } from "reka-ui";