@nar-bus/ui-shared 1.21.2 → 1.22.0
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.
|
@@ -3,7 +3,26 @@ export type OrderCreateMode = "single" | "bulk";
|
|
|
3
3
|
export type OrderCreateTargetEntity = "MODEM" | "METER";
|
|
4
4
|
export interface BulkOrderSubmitPayload {
|
|
5
5
|
orderType: OrderType;
|
|
6
|
+
/**
|
|
7
|
+
* RAW form params — every value is a string, structured ones still
|
|
8
|
+
* JSON-encoded. Kept as-is for backward compatibility.
|
|
9
|
+
*
|
|
10
|
+
* PREFER `processRequest` for anything sent to the backend: a param whose value
|
|
11
|
+
* is a JSON-encoded array/object (`ioInterfaces`, `astroRelay`, `directives`, …)
|
|
12
|
+
* must reach the API as a REAL array/object, and this field does not do that.
|
|
13
|
+
*/
|
|
6
14
|
params: Record<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Params with JSON-encoded values decoded — the same shape single mode POSTs as
|
|
17
|
+
* `processRequest`.
|
|
18
|
+
*
|
|
19
|
+
* NB-RELAY-PARAM-01: single mode has decoded these since FIX-166, but bulk mode
|
|
20
|
+
* forwarded `params` untouched, so a bulk relay change shipped
|
|
21
|
+
* `ioInterfaces: "[{\"id\":1,...}]"` as a STRING and the backend could not build
|
|
22
|
+
* `List<IoInterfaceInfo>` from it — the same empty-command failure the key fix
|
|
23
|
+
* addresses in single mode. Consumers should send this object.
|
|
24
|
+
*/
|
|
25
|
+
processRequest: Record<string, unknown>;
|
|
7
26
|
priority: OrderPriority;
|
|
8
27
|
targetModemIds: number[];
|
|
9
28
|
}
|
|
@@ -24,6 +43,27 @@ export interface OrderCreateSheetProps {
|
|
|
24
43
|
value: string;
|
|
25
44
|
label: string;
|
|
26
45
|
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Options for the relay pickers (`GATEWAY_RELAY_QUERY` / `GATEWAY_RELAY_CHANGE`).
|
|
48
|
+
*
|
|
49
|
+
* - **single mode — omit it.** The forms resolve the list themselves from
|
|
50
|
+
* `/api/modems/{modemId}/relays`.
|
|
51
|
+
* - **bulk mode — REQUIRED.** There are N target modems and no single
|
|
52
|
+
* `modemId`, so the pickers cannot self-resolve: without this prop the relay
|
|
53
|
+
* dropdown is empty and the operator cannot add a single row.
|
|
54
|
+
*
|
|
55
|
+
* `value` MUST be the relay's `relayNo` (physical channel), NOT
|
|
56
|
+
* `RelayAssignment.id` (database row id) — `relayNo` is what becomes
|
|
57
|
+
* `IoInterfaceInfo.id` in the MASS command, so `{ id: 42, relayNo: 1 }` must
|
|
58
|
+
* yield `value: "1"`. Getting this wrong commands the wrong relay.
|
|
59
|
+
*
|
|
60
|
+
* Passing an array (even an empty one) is treated as a deliberate override and
|
|
61
|
+
* suppresses the fetch.
|
|
62
|
+
*/
|
|
63
|
+
relayOptions?: Array<{
|
|
64
|
+
value: string;
|
|
65
|
+
label: string;
|
|
66
|
+
}>;
|
|
27
67
|
/**
|
|
28
68
|
* Single-mode only — fired once after a submit in which at least one order
|
|
29
69
|
* was created (never on total failure). `order` is the first successful
|
|
@@ -94,5 +134,5 @@ export interface OrderCreateSheetProps {
|
|
|
94
134
|
cancel?: string;
|
|
95
135
|
};
|
|
96
136
|
}
|
|
97
|
-
export declare function OrderCreateSheet({ open, onClose, mode, modemId, modemSlug, meterId, meterSlug, modemOptions, meterOptions, onOrderCreated, bulkTargetModemIds, bulkTargetEntity, onBulkSubmit, bulkCopy, singleSubmitCopy, confirmOnDiscard, discardConfirmCopy, }: OrderCreateSheetProps): import("react").JSX.Element;
|
|
137
|
+
export declare function OrderCreateSheet({ open, onClose, mode, modemId, modemSlug, meterId, meterSlug, modemOptions, meterOptions, relayOptions, onOrderCreated, bulkTargetModemIds, bulkTargetEntity, onBulkSubmit, bulkCopy, singleSubmitCopy, confirmOnDiscard, discardConfirmCopy, }: OrderCreateSheetProps): import("react").JSX.Element;
|
|
98
138
|
//# sourceMappingURL=OrderCreateSheet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderCreateSheet.d.ts","sourceRoot":"","sources":["../../src/components/OrderCreateSheet.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,KAAK,EAAE,SAAS,EAAiB,aAAa,EAC/C,MAAM,UAAU,CAAC;AAiBlB,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEhD,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,OAAO,CAAC;AAExD,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,QAAQ,EAAE,aAAa,CAAC;IACxB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;
|
|
1
|
+
{"version":3,"file":"OrderCreateSheet.d.ts","sourceRoot":"","sources":["../../src/components/OrderCreateSheet.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,KAAK,EAAE,SAAS,EAAiB,aAAa,EAC/C,MAAM,UAAU,CAAC;AAiBlB,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEhD,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,OAAO,CAAC;AAExD,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,SAAS,CAAC;IACrB;;;;;;;OAOG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B;;;;;;;;;OASG;IACH,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,QAAQ,EAAE,aAAa,CAAC;IACxB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAmBD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,gFAAgF;IAChF,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,OAA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ACF;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAwCD,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,OAAO,EACP,IAAe,EACf,OAAO,EACP,SAAS,EACT,OAAO,EACP,SAAS,EACT,YAAiB,EACjB,YAAiB,EAIjB,YAAY,EACZ,cAAc,EACd,kBAAuB,EACvB,gBAA0B,EAC1B,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,gBAAuB,EACvB,kBAAkB,GACnB,EAAE,qBAAqB,+BA4TvB"}
|
|
@@ -1,14 +1,42 @@
|
|
|
1
1
|
interface FormProps {
|
|
2
2
|
params: Record<string, string>;
|
|
3
3
|
onChange: (key: string, value: string) => void;
|
|
4
|
+
/**
|
|
5
|
+
* Relay picker options. OPTIONAL override — when omitted the form fetches the
|
|
6
|
+
* modem's relays itself from `/api/modems/{modemId}/relays` (see
|
|
7
|
+
* `useRelayOptions`). Supply this only to bypass that fetch.
|
|
8
|
+
*
|
|
9
|
+
* `value` MUST be the relay's `relayNo` (the physical channel), NOT
|
|
10
|
+
* `RelayAssignment.id` (the database row id) — `relayNo` is what becomes
|
|
11
|
+
* `IoInterfaceInfo.id` in the MASS command. The two differ: a record
|
|
12
|
+
* `{ id: 42, relayNo: 1 }` must yield `value: "1"`.
|
|
13
|
+
*/
|
|
4
14
|
relayOptions?: Array<{
|
|
5
15
|
value: string;
|
|
6
16
|
label: string;
|
|
7
17
|
}>;
|
|
18
|
+
/** Modem whose relays to offer. Ignored when `relayOptions` is supplied. */
|
|
19
|
+
modemId?: number;
|
|
8
20
|
}
|
|
9
21
|
/** RelayQueryForm — select relays to query */
|
|
10
|
-
export declare function RelayQueryForm({ params, onChange, relayOptions }: FormProps): import("react").JSX.Element;
|
|
11
|
-
/** RelayChangeForm — select relays and set ON/OFF status
|
|
12
|
-
|
|
22
|
+
export declare function RelayQueryForm({ params, onChange, relayOptions, modemId }: FormProps): import("react").JSX.Element;
|
|
23
|
+
/** RelayChangeForm — select relays and set ON/OFF status
|
|
24
|
+
*
|
|
25
|
+
* NB-RELAY-PARAM-01 (N+17, LHA-645): this form used to emit
|
|
26
|
+
* `onChange("ioInterfaceChanges", ...)` with `status: "true" | "false"` and a
|
|
27
|
+
* STRING id. MassCommandBuilder reads `ctx.params.get("ioInterfaces")` and
|
|
28
|
+
* converts to `List<IoInterfaceInfo>` (`status` = Integer 1/0), so the key never
|
|
29
|
+
* matched: `get("ioInterfaces")` returned null and the relay command reached the
|
|
30
|
+
* device with an EMPTY ioInterfaces list. Fixed here: key, id type and status type.
|
|
31
|
+
*
|
|
32
|
+
* The JSON.stringify stays. The shared order-forms `FormProps.onChange` contract
|
|
33
|
+
* is string-valued across all 11 forms, and OrderCreateSheet's FIX-166
|
|
34
|
+
* parsedParams loop parses any `[`/`{`-leading param back before the POST — so a
|
|
35
|
+
* REAL array goes on the wire, exactly as it already does for astroRelay
|
|
36
|
+
* (pinned by OrderCreateSheet.astro-wire.test.tsx, and now by
|
|
37
|
+
* OrderCreateSheet.relay-wire.test.tsx). Widening the onChange signature to carry
|
|
38
|
+
* a live array would break all 11 forms and buy nothing.
|
|
39
|
+
*/
|
|
40
|
+
export declare function RelayChangeForm({ params, onChange, relayOptions, modemId }: FormProps): import("react").JSX.Element;
|
|
13
41
|
export {};
|
|
14
42
|
//# sourceMappingURL=RelayForms.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelayForms.d.ts","sourceRoot":"","sources":["../../../src/components/order-forms/RelayForms.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RelayForms.d.ts","sourceRoot":"","sources":["../../../src/components/order-forms/RelayForms.tsx"],"names":[],"mappings":"AASA,UAAU,SAAS;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvD,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAiED,8CAA8C;AAC9C,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,SAAS,+BAiBpF;AAiCD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,SAAS,+BA+GrF"}
|