@genesislcap/foundation-forms 15.19.2 → 15.19.3

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.
@@ -44,6 +44,9 @@ export declare function filterReviewSections(sections: ReviewSection[], query: s
44
44
  * Looks up the display label for a raw value from `options.data` (used by segmented,
45
45
  * radio group, connected-select, and enum-with-explicit-data renderers). Honors
46
46
  * `options.valueField`/`options.labelField` when set, defaulting to `value`/`label`.
47
+ * When `options.labelRowFormatter` is set, it's applied to the matched row instead of
48
+ * reading `labelField` off it directly — the same formatter `OptionsDatasource.rowToOption`
49
+ * applies when rendering this row as a dropdown option, so review agrees with the control.
47
50
  * Returns `null` when no match found.
48
51
  * @internal
49
52
  */
@@ -53,8 +56,13 @@ export declare function resolveOptionLabel(raw: any, options: any): string | nul
53
56
  * `options.allOptionsResourceName` (a Data Server/Request Server resource) rather than a
54
57
  * static `options.data` array — e.g. `ConnectedSelectControlRenderer` in async/remote mode.
55
58
  * Fetches a single row via a criteria-filtered snapshot matching `valueField === raw`,
56
- * then reads `labelField` off the returned row. Returns `null` when there's no resource
57
- * to query, the resource can't be reached, or no row matches.
59
+ * then reads `labelField` off the returned row. When `options.labelRowFormatter` is set,
60
+ * it's applied to the fetched row instead matching `OptionsDatasource.rowToOption`, which
61
+ * prefers `labelRowFormatter(row)` over `row[labelField]` when rendering dropdown options —
62
+ * so review agrees with what the control itself would show. Since the formatter can read any
63
+ * field off the row (not just `labelField`), the row is fetched unrestricted (no `fields`
64
+ * filter) whenever a formatter is present. Returns `null` when there's no resource to query,
65
+ * the resource can't be reached, or no row matches.
58
66
  * @internal
59
67
  */
60
68
  export declare function resolveResourceOptionLabel(raw: any, options: any): Promise<string | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"review-utils.d.ts","sourceRoot":"","sources":["../../../src/utils/review-utils.ts"],"names":[],"mappings":"AASA,cAAc;AACd,MAAM,MAAM,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,CA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jB,MAAM,EAAE,GAAG,EACX,eAAe,CAAC,EAAE,GAAG,GACpB,MAAM,GAAG,OAAO,EAAE,GAAG,IAAI,CAY3B;AAqED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,GAAG,GAAG,CAEpE;AAYD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAwBvD"}
@@ -118,6 +118,9 @@ export function filterReviewSections(sections, query) {
118
118
  * Looks up the display label for a raw value from `options.data` (used by segmented,
119
119
  * radio group, connected-select, and enum-with-explicit-data renderers). Honors
120
120
  * `options.valueField`/`options.labelField` when set, defaulting to `value`/`label`.
121
+ * When `options.labelRowFormatter` is set, it's applied to the matched row instead of
122
+ * reading `labelField` off it directly — the same formatter `OptionsDatasource.rowToOption`
123
+ * applies when rendering this row as a dropdown option, so review agrees with the control.
121
124
  * Returns `null` when no match found.
122
125
  * @internal
123
126
  */
@@ -128,38 +131,51 @@ export function resolveOptionLabel(raw, options) {
128
131
  const valueKey = (_a = options.valueField) !== null && _a !== void 0 ? _a : 'value';
129
132
  const labelKey = (_b = options.labelField) !== null && _b !== void 0 ? _b : 'label';
130
133
  const entry = options.data.find((item) => item[valueKey] === raw);
131
- return (_c = entry === null || entry === void 0 ? void 0 : entry[labelKey]) !== null && _c !== void 0 ? _c : null;
134
+ if (!entry)
135
+ return null;
136
+ return options.labelRowFormatter ? options.labelRowFormatter(entry) : ((_c = entry[labelKey]) !== null && _c !== void 0 ? _c : null);
132
137
  }
133
138
  /**
134
139
  * Resolves the display label for a connected-select field backed by
135
140
  * `options.allOptionsResourceName` (a Data Server/Request Server resource) rather than a
136
141
  * static `options.data` array — e.g. `ConnectedSelectControlRenderer` in async/remote mode.
137
142
  * Fetches a single row via a criteria-filtered snapshot matching `valueField === raw`,
138
- * then reads `labelField` off the returned row. Returns `null` when there's no resource
139
- * to query, the resource can't be reached, or no row matches.
143
+ * then reads `labelField` off the returned row. When `options.labelRowFormatter` is set,
144
+ * it's applied to the fetched row instead matching `OptionsDatasource.rowToOption`, which
145
+ * prefers `labelRowFormatter(row)` over `row[labelField]` when rendering dropdown options —
146
+ * so review agrees with what the control itself would show. Since the formatter can read any
147
+ * field off the row (not just `labelField`), the row is fetched unrestricted (no `fields`
148
+ * filter) whenever a formatter is present. Returns `null` when there's no resource to query,
149
+ * the resource can't be reached, or no row matches.
140
150
  * @internal
141
151
  */
142
152
  export function resolveResourceOptionLabel(raw, options) {
143
153
  return __awaiter(this, void 0, void 0, function* () {
144
- var _a, _b, _c, _d;
154
+ var _a, _b, _c;
145
155
  const resourceName = options === null || options === void 0 ? void 0 : options.allOptionsResourceName;
146
156
  if (!resourceName || raw === undefined || raw === null || raw === '')
147
157
  return null;
148
158
  const valueField = (_a = options.valueField) !== null && _a !== void 0 ? _a : 'value';
149
159
  const labelField = (_b = options.labelField) !== null && _b !== void 0 ? _b : 'label';
160
+ const labelRowFormatter = options.labelRowFormatter;
150
161
  const datasource = getDatasource();
151
162
  try {
152
163
  const criteria = new CriteriaBuilder()
153
164
  .withExpression(new ExpressionBuilder().withField(valueField).withValue(raw).build())
154
165
  .build();
155
- const initialized = yield datasource.init(Object.assign(Object.assign({}, options.datasourceConfig), { resourceName,
156
- criteria, isSnapshot: true, maxRows: 1, fields: valueField === labelField ? valueField : `${valueField} ${labelField}` }));
166
+ const initialized = yield datasource.init(Object.assign(Object.assign(Object.assign({}, options.datasourceConfig), { resourceName,
167
+ criteria, isSnapshot: true, maxRows: 1 }), (labelRowFormatter
168
+ ? {}
169
+ : { fields: valueField === labelField ? valueField : `${valueField} ${labelField}` })));
157
170
  if (!initialized)
158
171
  return null;
159
172
  const rows = yield datasource.snapshotFiltered();
160
- return (_d = (_c = rows === null || rows === void 0 ? void 0 : rows[0]) === null || _c === void 0 ? void 0 : _c[labelField]) !== null && _d !== void 0 ? _d : null;
173
+ const row = rows === null || rows === void 0 ? void 0 : rows[0];
174
+ if (!row)
175
+ return null;
176
+ return labelRowFormatter ? labelRowFormatter(row) : ((_c = row[labelField]) !== null && _c !== void 0 ? _c : null);
161
177
  }
162
- catch (_e) {
178
+ catch (_d) {
163
179
  return null;
164
180
  }
165
181
  finally {
@@ -2507,6 +2507,9 @@ export declare function resolveEnumLabel(raw: any, fieldName: string, schema: an
2507
2507
  * Looks up the display label for a raw value from `options.data` (used by segmented,
2508
2508
  * radio group, connected-select, and enum-with-explicit-data renderers). Honors
2509
2509
  * `options.valueField`/`options.labelField` when set, defaulting to `value`/`label`.
2510
+ * When `options.labelRowFormatter` is set, it's applied to the matched row instead of
2511
+ * reading `labelField` off it directly — the same formatter `OptionsDatasource.rowToOption`
2512
+ * applies when rendering this row as a dropdown option, so review agrees with the control.
2510
2513
  * Returns `null` when no match found.
2511
2514
  * @internal
2512
2515
  */
@@ -2517,8 +2520,13 @@ export declare function resolveOptionLabel(raw: any, options: any): string | nul
2517
2520
  * `options.allOptionsResourceName` (a Data Server/Request Server resource) rather than a
2518
2521
  * static `options.data` array — e.g. `ConnectedSelectControlRenderer` in async/remote mode.
2519
2522
  * Fetches a single row via a criteria-filtered snapshot matching `valueField === raw`,
2520
- * then reads `labelField` off the returned row. Returns `null` when there's no resource
2521
- * to query, the resource can't be reached, or no row matches.
2523
+ * then reads `labelField` off the returned row. When `options.labelRowFormatter` is set,
2524
+ * it's applied to the fetched row instead matching `OptionsDatasource.rowToOption`, which
2525
+ * prefers `labelRowFormatter(row)` over `row[labelField]` when rendering dropdown options —
2526
+ * so review agrees with what the control itself would show. Since the formatter can read any
2527
+ * field off the row (not just `labelField`), the row is fetched unrestricted (no `fields`
2528
+ * filter) whenever a formatter is present. Returns `null` when there's no resource to query,
2529
+ * the resource can't be reached, or no row matches.
2522
2530
  * @internal
2523
2531
  */
2524
2532
  export declare function resolveResourceOptionLabel(raw: any, options: any): Promise<string | null>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-forms",
3
3
  "description": "Genesis Foundation Forms",
4
- "version": "15.19.2",
4
+ "version": "15.19.3",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -59,13 +59,13 @@
59
59
  }
60
60
  },
61
61
  "devDependencies": {
62
- "@genesislcap/foundation-testing": "15.19.2",
63
- "@genesislcap/genx": "15.19.2",
64
- "@genesislcap/rollup-builder": "15.19.2",
65
- "@genesislcap/ts-builder": "15.19.2",
66
- "@genesislcap/uvu-playwright-builder": "15.19.2",
67
- "@genesislcap/vite-builder": "15.19.2",
68
- "@genesislcap/webpack-builder": "15.19.2",
62
+ "@genesislcap/foundation-testing": "15.19.3",
63
+ "@genesislcap/genx": "15.19.3",
64
+ "@genesislcap/rollup-builder": "15.19.3",
65
+ "@genesislcap/ts-builder": "15.19.3",
66
+ "@genesislcap/uvu-playwright-builder": "15.19.3",
67
+ "@genesislcap/vite-builder": "15.19.3",
68
+ "@genesislcap/webpack-builder": "15.19.3",
69
69
  "@types/json-schema": "^7.0.11",
70
70
  "@types/papaparse": "^5.3.14"
71
71
  },
@@ -82,12 +82,12 @@
82
82
  }
83
83
  },
84
84
  "dependencies": {
85
- "@genesislcap/foundation-comms": "15.19.2",
86
- "@genesislcap/foundation-criteria": "15.19.2",
87
- "@genesislcap/foundation-logger": "15.19.2",
88
- "@genesislcap/foundation-notifications": "15.19.2",
89
- "@genesislcap/foundation-ui": "15.19.2",
90
- "@genesislcap/foundation-utils": "15.19.2",
85
+ "@genesislcap/foundation-comms": "15.19.3",
86
+ "@genesislcap/foundation-criteria": "15.19.3",
87
+ "@genesislcap/foundation-logger": "15.19.3",
88
+ "@genesislcap/foundation-notifications": "15.19.3",
89
+ "@genesislcap/foundation-ui": "15.19.3",
90
+ "@genesislcap/foundation-utils": "15.19.3",
91
91
  "@json-schema-tools/dereferencer": "^1.6.1",
92
92
  "@jsonforms/core": "^3.2.1",
93
93
  "@microsoft/fast-components": "2.30.6",