@7365admin1/layer-common 4.35.1-staging.384 → 4.35.1-staging.385
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/package.json +1 -1
- package/utils/sp-inviter-row.ts +14 -3
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.35.1-staging.
|
|
5
|
+
"version": "4.35.1-staging.385",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|
package/utils/sp-inviter-row.ts
CHANGED
|
@@ -36,14 +36,25 @@ type TNatureOption = { title?: string; value?: string };
|
|
|
36
36
|
* else the label from the nature-of-business list, else the raw stored code
|
|
37
37
|
* ("security_agency") as a last resort. `useLocal` can hand back a plain
|
|
38
38
|
* array or a ref-like `{ value }` wrapper - read whichever shape was passed.
|
|
39
|
+
*
|
|
40
|
+
* `nature` is NOT always free text: both `_getServiceProviders` and the
|
|
41
|
+
* `customer.sites`-derived `getServiceProvidersForSite` aggregations in
|
|
42
|
+
* @7365admin1/core set it to `organization.nature`, the SAME raw code `type`
|
|
43
|
+
* carries ("security_agency") - not a human-typed description. Treating it as
|
|
44
|
+
* free text made the raw code win over the label lookup for every row, since
|
|
45
|
+
* `nature` is truthy whenever it is set at all. Only trust it as an override
|
|
46
|
+
* when it is NOT itself one of the known codes.
|
|
39
47
|
*/
|
|
40
48
|
export function spTypeLabel(type: string, nature: string | undefined, source: unknown): string {
|
|
41
|
-
if (nature && String(nature).trim()) return String(nature);
|
|
42
49
|
const list = (Array.isArray(source) ? source : (source as any)?.value) as
|
|
43
50
|
| TNatureOption[]
|
|
44
51
|
| undefined;
|
|
45
|
-
const
|
|
46
|
-
|
|
52
|
+
const codeMatch = (value?: string) => list?.find((x) => x.value === value);
|
|
53
|
+
|
|
54
|
+
if (nature && String(nature).trim() && !codeMatch(nature)) return String(nature);
|
|
55
|
+
|
|
56
|
+
const hit = codeMatch(type) ?? codeMatch(nature);
|
|
57
|
+
return hit?.title ?? type ?? nature ?? "-";
|
|
47
58
|
}
|
|
48
59
|
|
|
49
60
|
export function spDay(value?: string | null): string {
|