@vc-shell/framework 2.5.0-pr341.2eb87f6 → 2.5.0-pr343.9724376

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.
@@ -0,0 +1,23 @@
1
+ import type { IBaseProperty } from "./types";
2
+ /**
3
+ * Which control `VcDynamicProperty` renders for a property.
4
+ *
5
+ * This exists because the choice was encoded twice: once here in effect, as a
6
+ * chain of sixteen ordered `v-else-if` conditions in the template, and once in
7
+ * `resolveStrategy`, which decides how the value is read and written. The two
8
+ * chains had opposite precedence — the template tested `dictionary` first,
9
+ * `resolveStrategy` tests `Measure` first — so they disagreed.
10
+ *
11
+ * A `Measure` property carrying a dictionary got the dictionary `VcSelect`,
12
+ * while `measureStrategy` read `values[0].value` and wrote
13
+ * `{ value, unitOfMeasureId }`. The select works in `valueId`, so it showed
14
+ * nothing selected and stored no dictionary reference, and the unit could not
15
+ * be set at all. `Boolean` with a dictionary diverged the same way.
16
+ *
17
+ * Precedence here mirrors `resolveStrategy` exactly. The strategy is the data
18
+ * contract — non-UI code reads through it — so the control follows it, not the
19
+ * other way round.
20
+ */
21
+ export type ControlKind = "dictionary" | "measure" | "boolean" | "datetime" | "long-text" | "number" | "number-multivalue" | "integer" | "integer-multivalue" | "short-text" | "short-text-multivalue" | "multivalue-dictionary" | "color" | "color-dictionary" | "color-multivalue" | "color-multivalue-dictionary" | "unsupported";
22
+ export declare function resolveControlKind(property: IBaseProperty): ControlKind;
23
+ //# sourceMappingURL=resolveControlKind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveControlKind.d.ts","sourceRoot":"","sources":["../../../../core/composables/useDynamicProperties/resolveControlKind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,WAAW,GACnB,YAAY,GACZ,SAAS,GACT,SAAS,GACT,UAAU,GACV,WAAW,GACX,QAAQ,GACR,mBAAmB,GACnB,SAAS,GACT,oBAAoB,GACpB,YAAY,GACZ,uBAAuB,GACvB,uBAAuB,GACvB,OAAO,GACP,kBAAkB,GAClB,kBAAkB,GAClB,6BAA6B,GAC7B,aAAa,CAAC;AAElB,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,aAAa,GAAG,WAAW,CAwCvE"}
@@ -6,6 +6,25 @@ export interface LatestRequest {
6
6
  complete(): void;
7
7
  }
8
8
  export interface UseLatestRequestReturn {
9
+ /**
10
+ * Runs a request and hands back its result only while it is still the newest.
11
+ * A superseded request resolves to `undefined`, so the caller returns early
12
+ * instead of writing a stale answer:
13
+ *
14
+ * ```ts
15
+ * const result = await search.latest(client.searchProducts(criteria));
16
+ * if (!result) return;
17
+ * searchResult.value = result;
18
+ * ```
19
+ *
20
+ * This is `begin`/`isCurrent`/`complete` with the bookkeeping folded in —
21
+ * there is no `finally` to forget. Reach for `begin` directly only when the
22
+ * request and the check cannot sit in the same function.
23
+ *
24
+ * Rejections propagate untouched. `undefined` means superseded, so a request
25
+ * whose own successful result is `undefined` needs `begin` instead.
26
+ */
27
+ latest<T>(request: Promise<T>): Promise<T | undefined>;
9
28
  /** Starts a request and supersedes any earlier one. */
10
29
  begin(): LatestRequest;
11
30
  /** Supersedes the in-flight request without starting a new one — e.g. on selection change. */
@@ -23,17 +42,15 @@ export interface UseLatestRequestReturn {
23
42
  * const search = useLatestRequest();
24
43
  *
25
44
  * async function load(criteria) {
26
- * const request = search.begin();
27
- * try {
28
- * const result = await api.search(criteria);
29
- * if (!request.isCurrent()) return; // a newer search won
30
- * items.value = result;
31
- * } finally {
32
- * request.complete();
33
- * }
45
+ * const result = await search.latest(api.search(criteria));
46
+ * if (!result) return; // a newer search won
47
+ * items.value = result;
34
48
  * }
35
49
  * ```
36
50
  *
51
+ * `begin` is the same thing with the bookkeeping exposed, for the cases where
52
+ * the request and the check cannot sit in the same function.
53
+ *
37
54
  * This discards the late result rather than cancelling the request: the
38
55
  * generated API clients build their own `RequestInit` and take no `AbortSignal`,
39
56
  * so there is nothing to cancel through. Aborting would additionally save the
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useLatestRequest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/E,MAAM,WAAW,aAAa;IAC5B,2FAA2F;IAC3F,SAAS,IAAI,OAAO,CAAC;IACrB,0FAA0F;IAC1F,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,uDAAuD;IACvD,KAAK,IAAI,aAAa,CAAC;IACvB,8FAA8F;IAC9F,UAAU,IAAI,IAAI,CAAC;IACnB,2FAA2F;IAC3F,OAAO,IAAI,IAAI,CAAC;IAChB,sDAAsD;IACtD,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,gBAAgB,IAAI,sBAAsB,CA2CzD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useLatestRequest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/E,MAAM,WAAW,aAAa;IAC5B,2FAA2F;IAC3F,SAAS,IAAI,OAAO,CAAC;IACrB,0FAA0F;IAC1F,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IACvD,uDAAuD;IACvD,KAAK,IAAI,aAAa,CAAC;IACvB,8FAA8F;IAC9F,UAAU,IAAI,IAAI,CAAC;IACnB,2FAA2F;IAC3F,OAAO,IAAI,IAAI,CAAC;IAChB,sDAAsD;IACtD,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,IAAI,sBAAsB,CAsDzD"}