@qoretechnologies/reqraft 0.10.38-pr.96.g9405cd1 → 0.10.38

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.
@@ -49,7 +49,73 @@ export declare const isCompleteTemplateToken: (value?: unknown) => value is stri
49
49
  * template-offering input (build #123 review). Word segments cannot contain
50
50
  * `{`, so `:{` inside a complete token always starts a braced segment. */
51
51
  export declare const isBracedTemplateToken: (value?: unknown) => value is string;
52
+ /**
53
+ * The longest catalogue item whose path is a PREFIX of `value`, plus the part
54
+ * of the path it does not cover.
55
+ *
56
+ * A catalogue can only offer what the action's output type declares, so it
57
+ * stops at a list: `choices` is offered, `choices[0].message.content` is not —
58
+ * an operator hand-extends the path past the named field. Such a value has no
59
+ * item to match and used to render as its own raw token. Naming it by its
60
+ * nearest ancestor (`Choices[0].message.content`) keeps the chip readable
61
+ * without inventing a catalogue entry that does not exist.
62
+ *
63
+ * The match must break at a path boundary (`.` or `[`) so `choicesOther` is
64
+ * never named after `choices`, and the token keys must agree so a `$config:`
65
+ * item never names a `$data:` value.
66
+ */
67
+ export declare const findTemplateByPath: (templates: IReqoreFormTemplates, value: string) => {
68
+ item: TReqoreDropdownItem;
69
+ remainder: string;
70
+ } | undefined;
52
71
  export declare const findTemplate: (templates: IReqoreFormTemplates, value: string) => TReqoreDropdownItem | undefined;
72
+ /**
73
+ * The one answer to "what is this reference called?", so a value reads the
74
+ * same in the picker chip, the read-only tag and the compact row's summary.
75
+ * Exact match first (aliases included), then the nearest catalogue ancestor
76
+ * for a hand-extended path, and finally the raw token — which is honest when
77
+ * the catalogue holds nothing that explains the value.
78
+ */
79
+ export declare const resolveTemplateLabel: (templates: IReqoreFormTemplates | undefined, value: string) => {
80
+ label: string;
81
+ item?: TReqoreDropdownItem;
82
+ };
83
+ /**
84
+ * What to call a reference when the catalogue explains nothing about it — the
85
+ * reference's own path, with the token wrapper stripped:
86
+ * `$data:{dc_ai_reply.choices[0].message.content}` reads as
87
+ * `dc_ai_reply.choices[0].message.content`.
88
+ *
89
+ * Surfaces exist with no catalogue at all (the Automation Hub template preview
90
+ * never fetches one), and there the raw token is the only thing left to show.
91
+ * Showing it as `$data:{…}` renders a value as code; showing the path renders
92
+ * it as a name, which is the honest floor.
93
+ */
94
+ export declare const getTemplateReferencePath: (value: string) => string;
95
+ /**
96
+ * The best available name for a reference, for a surface that must show
97
+ * something readable no matter what: the catalogue's name when it has one,
98
+ * otherwise the bare path. `resolveTemplateLabel` keeps falling back to the
99
+ * raw token, because a picker that cannot resolve a value should say exactly
100
+ * what the value is.
101
+ */
102
+ export declare const describeTemplateReference: (templates: IReqoreFormTemplates | undefined, value: string) => {
103
+ label: string;
104
+ item?: TReqoreDropdownItem;
105
+ };
106
+ export type TTemplateTextSegment = {
107
+ kind: 'text';
108
+ text: string;
109
+ } | {
110
+ kind: 'token';
111
+ text: string;
112
+ };
113
+ /**
114
+ * Splits prose that embeds template tokens into its literal and token parts —
115
+ * `trim("$data:{…}")` becomes `trim("`, the token, `")`. Used to chip the
116
+ * references inside a rendered expression instead of printing them raw.
117
+ */
118
+ export declare const splitTemplateTokens: (text?: string) => TTemplateTextSegment[];
53
119
  export declare const filterTemplatesByType: (templates?: IReqoreFormTemplates, fieldType?: string, hasArgSchema?: boolean) => IReqoreFormTemplates;
54
120
  interface ITemplateItemPayload {
55
121
  display_name?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/helpers/templates.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AACzF,OAAO,EACL,mBAAmB,EAEpB,MAAM,wDAAwD,CAAC;AAMhE;;;;;;;;GAQG;AACH,eAAO,MAAM,+BAA+B,MAAM,CAAC;AAEnD;;;GAGG;AAEH,MAAM,MAAM,aAAa,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,cA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AY,CAAC,EAAE,MAAM,CAAC;QACtB,KAAK,CAAC,EAAE,oBAAoB,EAAE,CAAC;QAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,eAAO,MAAM,cAAc,eACb,iBAAiB,KAC5B,oBAAoB,GAAG,SAgJzB,CAAC"}
@@ -20,7 +20,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
20
20
  return to.concat(ar || Array.prototype.slice.call(from));
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.buildTemplates = exports.filterTemplatesByType = exports.findTemplate = exports.isBracedTemplateToken = exports.isCompleteTemplateToken = exports.TEMPLATE_TOKEN_SOURCE = exports.getTemplateValue = exports.getTemplateKey = exports.isValueTemplate = exports.getTemplateTagStyle = exports.TEMPLATE_EXAMPLE_PREVIEW_LENGTH = void 0;
23
+ exports.buildTemplates = exports.filterTemplatesByType = exports.splitTemplateTokens = exports.describeTemplateReference = exports.getTemplateReferencePath = exports.resolveTemplateLabel = exports.findTemplate = exports.findTemplateByPath = exports.isBracedTemplateToken = exports.isCompleteTemplateToken = exports.TEMPLATE_TOKEN_SOURCE = exports.getTemplateValue = exports.getTemplateKey = exports.isValueTemplate = exports.getTemplateTagStyle = exports.TEMPLATE_EXAMPLE_PREVIEW_LENGTH = void 0;
24
24
  var reqore_1 = require("@qoretechnologies/reqore");
25
25
  var lodash_1 = require("lodash");
26
26
  var react_1 = require("react");
@@ -112,6 +112,61 @@ var matchesTemplateValue = function (item, value) {
112
112
  return item.value === value ||
113
113
  !!((_b = (_a = item.metadata) === null || _a === void 0 ? void 0 : _a.aliasValues) === null || _b === void 0 ? void 0 : _b.includes(value));
114
114
  };
115
+ /** Splits `$data:{a.b.c}` into its key (`$data`) and inner path (`a.b.c`). */
116
+ var TEMPLATE_TOKEN_PATH = /^(\$[A-Za-z_][\w-]*):\{(.*)\}$/;
117
+ var getTokenPath = function (value) {
118
+ var match = typeof value === 'string' ? TEMPLATE_TOKEN_PATH.exec(value) : null;
119
+ return match ? { key: match[1], path: match[2] } : undefined;
120
+ };
121
+ /**
122
+ * The longest catalogue item whose path is a PREFIX of `value`, plus the part
123
+ * of the path it does not cover.
124
+ *
125
+ * A catalogue can only offer what the action's output type declares, so it
126
+ * stops at a list: `choices` is offered, `choices[0].message.content` is not —
127
+ * an operator hand-extends the path past the named field. Such a value has no
128
+ * item to match and used to render as its own raw token. Naming it by its
129
+ * nearest ancestor (`Choices[0].message.content`) keeps the chip readable
130
+ * without inventing a catalogue entry that does not exist.
131
+ *
132
+ * The match must break at a path boundary (`.` or `[`) so `choicesOther` is
133
+ * never named after `choices`, and the token keys must agree so a `$config:`
134
+ * item never names a `$data:` value.
135
+ */
136
+ var findTemplateByPath = function (templates, value) {
137
+ var ref = getTokenPath(value);
138
+ if (!ref)
139
+ return undefined;
140
+ var best;
141
+ var consider = function (item, candidate) {
142
+ var itemPath = getTokenPath(candidate);
143
+ if (!itemPath || itemPath.key !== ref.key || !ref.path.startsWith(itemPath.path)) {
144
+ return;
145
+ }
146
+ var boundary = ref.path[itemPath.path.length];
147
+ if (boundary !== '.' && boundary !== '[') {
148
+ return;
149
+ }
150
+ if (!best || itemPath.path.length > best.path.length) {
151
+ best = { item: item, path: itemPath.path, remainder: ref.path.slice(itemPath.path.length) };
152
+ }
153
+ };
154
+ var walk = function (items) {
155
+ items === null || items === void 0 ? void 0 : items.forEach(function (item) {
156
+ var _a, _b;
157
+ consider(item, item.value);
158
+ (_b = (_a = item.metadata) === null || _a === void 0 ? void 0 : _a.aliasValues) === null || _b === void 0 ? void 0 : _b.forEach(function (alias) {
159
+ return consider(item, alias);
160
+ });
161
+ if (item.items) {
162
+ walk(item.items);
163
+ }
164
+ });
165
+ };
166
+ walk(templates === null || templates === void 0 ? void 0 : templates.items);
167
+ return best ? { item: best.item, remainder: best.remainder } : undefined;
168
+ };
169
+ exports.findTemplateByPath = findTemplateByPath;
115
170
  var findTemplate = function (templates, value) {
116
171
  if (!value)
117
172
  return undefined;
@@ -131,6 +186,93 @@ var findTemplate = function (templates, value) {
131
186
  return result;
132
187
  };
133
188
  exports.findTemplate = findTemplate;
189
+ /**
190
+ * Joins a catalogue item's name to the part of the path it does not cover.
191
+ * A field step reads as a step (`Choices › message`), while an array index
192
+ * binds to the name it indexes (`Choices[0]`) rather than floating off it.
193
+ */
194
+ var composeExtendedLabel = function (label, remainder) {
195
+ return remainder.startsWith('.') ? "".concat(label, " \u203A ").concat(remainder.slice(1)) : "".concat(label).concat(remainder);
196
+ };
197
+ /**
198
+ * The one answer to "what is this reference called?", so a value reads the
199
+ * same in the picker chip, the read-only tag and the compact row's summary.
200
+ * Exact match first (aliases included), then the nearest catalogue ancestor
201
+ * for a hand-extended path, and finally the raw token — which is honest when
202
+ * the catalogue holds nothing that explains the value.
203
+ */
204
+ var resolveTemplateLabel = function (templates, value) {
205
+ if (!templates || !value) {
206
+ return { label: value };
207
+ }
208
+ var exact = (0, exports.findTemplate)(templates, value);
209
+ if (exact) {
210
+ return { label: exact.label || value, item: exact };
211
+ }
212
+ var extended = (0, exports.findTemplateByPath)(templates, value);
213
+ if (extended) {
214
+ return {
215
+ label: composeExtendedLabel(extended.item.label, extended.remainder),
216
+ item: extended.item,
217
+ };
218
+ }
219
+ return { label: value };
220
+ };
221
+ exports.resolveTemplateLabel = resolveTemplateLabel;
222
+ /**
223
+ * What to call a reference when the catalogue explains nothing about it — the
224
+ * reference's own path, with the token wrapper stripped:
225
+ * `$data:{dc_ai_reply.choices[0].message.content}` reads as
226
+ * `dc_ai_reply.choices[0].message.content`.
227
+ *
228
+ * Surfaces exist with no catalogue at all (the Automation Hub template preview
229
+ * never fetches one), and there the raw token is the only thing left to show.
230
+ * Showing it as `$data:{…}` renders a value as code; showing the path renders
231
+ * it as a name, which is the honest floor.
232
+ */
233
+ var getTemplateReferencePath = function (value) { var _a, _b; return (_b = (_a = getTokenPath(value)) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : value; };
234
+ exports.getTemplateReferencePath = getTemplateReferencePath;
235
+ /**
236
+ * The best available name for a reference, for a surface that must show
237
+ * something readable no matter what: the catalogue's name when it has one,
238
+ * otherwise the bare path. `resolveTemplateLabel` keeps falling back to the
239
+ * raw token, because a picker that cannot resolve a value should say exactly
240
+ * what the value is.
241
+ */
242
+ var describeTemplateReference = function (templates, value) {
243
+ var resolved = (0, exports.resolveTemplateLabel)(templates, value);
244
+ return resolved.item ? resolved : { label: (0, exports.getTemplateReferencePath)(value) };
245
+ };
246
+ exports.describeTemplateReference = describeTemplateReference;
247
+ var EMBEDDED_TEMPLATE_TOKEN = new RegExp(exports.TEMPLATE_TOKEN_SOURCE, 'g');
248
+ /**
249
+ * Splits prose that embeds template tokens into its literal and token parts —
250
+ * `trim("$data:{…}")` becomes `trim("`, the token, `")`. Used to chip the
251
+ * references inside a rendered expression instead of printing them raw.
252
+ */
253
+ var splitTemplateTokens = function (text) {
254
+ if (!text) {
255
+ return [];
256
+ }
257
+ var segments = [];
258
+ var lastIndex = 0;
259
+ // A fresh regex per call: a shared /g instance carries `lastIndex` between
260
+ // calls and would skip tokens on the second string it is given.
261
+ var pattern = new RegExp(EMBEDDED_TEMPLATE_TOKEN.source, 'g');
262
+ var match;
263
+ while ((match = pattern.exec(text)) !== null) {
264
+ if (match.index > lastIndex) {
265
+ segments.push({ kind: 'text', text: text.slice(lastIndex, match.index) });
266
+ }
267
+ segments.push({ kind: 'token', text: match[0] });
268
+ lastIndex = match.index + match[0].length;
269
+ }
270
+ if (lastIndex < text.length) {
271
+ segments.push({ kind: 'text', text: text.slice(lastIndex) });
272
+ }
273
+ return segments;
274
+ };
275
+ exports.splitTemplateTokens = splitTemplateTokens;
134
276
  // Ported verbatim from qorus-ide `helpers/functions.tsx` (FIELD_STACK_REPORT
135
277
  // batch) — the previous reqraft version used naive badge equality; the IDE
136
278
  // routes compatibility through `areQorusTypesCompatible` (int↔string coercion
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/helpers/templates.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAsD;AAMtD,iCAAyC;AACzC,+BAAsC;AACtC,0FAAwG;AACxG,6CAAwD;AAExD;;;;;;;;GAQG;AACU,QAAA,+BAA+B,GAAG,GAAG,CAAC;AAS5C,IAAM,mBAAmB,GAAG,UACjC,IAAoB;IAEpB,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,cAAc;QAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IACvD,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO;QAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAChD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC,CAAC;AANW,QAAA,mBAAmB,uBAM9B;AAEK,IAAM,eAAe,GAAG,UAAC,KAAa;IAC3C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACtD,CAAC,CAAC;AALW,QAAA,eAAe,mBAK1B;AAEK,IAAM,cAAc,GAAG,UAAC,KAAa;IACnC,IAAA,GAAG,GAAI,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAApB,CAAqB;IAC/B,OAAO,GAAG,CAAC,OAAO,CAAC,GAAG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ACJ,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC,CACF;IAzFD,CAyFC,CAAC;IAEJ,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CACjC,UAAC,EAUA;gBATC,YAAY,kBAAA,EACZ,KAAK,WAAA,EACL,GAAG,SAAA,EACH,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,OAAO,aAAA,EACP,gBAAgB,sBAAA,EAChB,SAAS,eAAA,EACT,IAAI,UAAA;YACqB,OAAA,CAAC;gBAC1B,KAAK,EAAE,YAAY;gBACnB,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,KAAK;gBACX,WAAW,EAAE,KAAK;gBAClB,OAAO,EAAE,IAAI;gBACb,aAAa,EAAE;oBACb,KAAK,EAAE,IAAI;iBACZ;gBACD,KAAK,EAAE,GAAG;gBACV,QAAQ,EAAE;oBACR,QAAQ,EAAE,SAAS;iBACpB;gBACD,KAAK,EAAE,YAAY,CACjB,KAAK,EACL,GAAG,EACH,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,SAAS,CACV;aACF,CAAC;QAvByB,CAuBzB,CACH;KACsB,CAAC;AAC5B,CAAC,CAAC;AAlJW,QAAA,cAAc,kBAkJzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qoretechnologies/reqraft",
3
- "version": "0.10.38-pr.96.g9405cd1",
3
+ "version": "0.10.38",
4
4
  "description": "ReQraft is a collection of React components and hooks that are used across Qore Technologies' products made using the ReQore component library from Qore.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,6 +22,8 @@ import {
22
22
  findTemplate,
23
23
  getTemplateTagStyle,
24
24
  isValueTemplate,
25
+ describeTemplateReference,
26
+ splitTemplateTokens,
25
27
  TTemplateMeta,
26
28
  } from '../../../helpers/templates';
27
29
  import { richtextToSegments } from '../../../helpers/common';
@@ -385,6 +387,49 @@ export const CompactRow = memo(
385
387
  }
386
388
  }
387
389
 
390
+ // An expression summarises to one line of text, and a template reference
391
+ // inside it printed as its own raw token — `$data:{…}` renders a value as
392
+ // code where a name belongs. Chip every reference here, on the richtext
393
+ // branch's pattern above, so the wrapper (`trim(`…`)`) still reads as the
394
+ // text it is while the reference reads as a name.
395
+ //
396
+ // Unconditionally: a surface with no catalogue (the Automation Hub
397
+ // template preview never fetches one) still shows the reference's own
398
+ // path, which is the point — a conditional chip is no chip at all
399
+ // exactly where the raw token looks worst.
400
+ if ((field as { is_expression?: boolean })?.is_expression && formatted) {
401
+ const segments = splitTemplateTokens(formatted);
402
+ const named = segments.map((segment) =>
403
+ segment.kind === 'token' ?
404
+ { ...segment, ...describeTemplateReference(templates, segment.text) }
405
+ : segment
406
+ );
407
+
408
+ if (named.some((segment) => segment.kind === 'token')) {
409
+ return (
410
+ <span style={{ ...wrapStyle, gap: 4, overflow: 'hidden' }}>
411
+ {named.map((segment, index) =>
412
+ segment.kind === 'token' ?
413
+ <ReqoreTag
414
+ key={index}
415
+ size='tiny'
416
+ // Inherit the row's font size so the chip shares a baseline
417
+ // with the text around it — see the richtext branch above.
418
+ style={{ fontSize: 'inherit' }}
419
+ icon='ExchangeDollarLine'
420
+ label={segment.label}
421
+ tooltip={segment.text}
422
+ {...getTemplateTagStyle(segment.item?.metadata as TTemplateMeta | undefined)}
423
+ />
424
+ : <span key={index} style={{ whiteSpace: 'pre' }}>
425
+ {segment.text}
426
+ </span>
427
+ )}
428
+ </span>
429
+ );
430
+ }
431
+ }
432
+
388
433
  return formatted;
389
434
  };
390
435
 
@@ -2862,9 +2862,10 @@ export const CompactMultiSelectEditing: Story = {
2862
2862
  },
2863
2863
  play: async () => {
2864
2864
  await _testsWaitForText('Audiences');
2865
- // Read row joins the selected items.
2866
- await _testsWaitForText('orders');
2867
- await _testsClickText('orders');
2865
+ // Read row joins the selected items, labelled the way the picker labels
2866
+ // them (`Orders`) rather than the way they are stored (`orders`).
2867
+ await _testsWaitForText('Orders');
2868
+ await _testsClickText('Orders');
2868
2869
  await waitFor(() => expect(document.querySelector('.options-readfirst-card')).toBeTruthy(), {
2869
2870
  timeout: 10000,
2870
2871
  });
@@ -3648,8 +3649,16 @@ export const CompactExpressions: Story = {
3648
3649
  play: async () => {
3649
3650
  const stop = startDpqlMockLsp();
3650
3651
  try {
3651
- // Read-first: the offline DPQL summary of the AST.
3652
- await _testsWaitForText('"$local:name" == "John"');
3652
+ // Read-first: the offline DPQL summary of the AST — the literals read as
3653
+ // the text they are, and the template reference reads as a chip rather
3654
+ // than as its raw `$local:name` token inside the string.
3655
+ await waitFor(() => {
3656
+ const chip = Array.from(document.querySelectorAll('.reqore-tag')).find((tag) =>
3657
+ tag.textContent?.includes('$local:name')
3658
+ );
3659
+ expect(chip, 'the reference in the summary renders as a chip').toBeTruthy();
3660
+ });
3661
+ await _testsWaitForText('" == "John"');
3653
3662
 
3654
3663
  // Drill in → the card hosts the ExpressionField (Visual builder).
3655
3664
  await fireEvent.click(
@@ -4406,7 +4415,8 @@ export const CompactFieldTypes: Story = {
4406
4415
  await _testsWaitForText('0 0 * * *'); // cron
4407
4416
  await _testsWaitForText('Python'); // select → allowed_value display label
4408
4417
  await _testsWaitForText('Medium'); // enum → allowed_value display label
4409
- await _testsWaitForText('orders, batch'); // multi-select joined
4418
+ // multi-select joined, labelled the way the picker labels them
4419
+ await _testsWaitForText('Orders, Batch');
4410
4420
  await _testsWaitForText('a, b'); // list joined
4411
4421
  await _testsWaitForText('x, y, z'); // YAML-serialized list summarised
4412
4422
  await _testsWaitForText('#0000FF'); // colour → uppercase hex
@@ -4420,8 +4430,15 @@ export const CompactFieldTypes: Story = {
4420
4430
  // than a raw hash key-count.
4421
4431
  await _testsWaitForText('512MiB');
4422
4432
  await _testsWaitForText(/example_customer_addresses/);
4423
- // Expression field → read-first shows the offline DPQL summary of the AST.
4424
- await _testsWaitForText('"$local:name" == "John"');
4433
+ // Expression field → read-first shows the offline DPQL summary of the AST,
4434
+ // with the template reference inside it chipped rather than printed raw.
4435
+ await waitFor(() => {
4436
+ const chip = Array.from(document.querySelectorAll('.reqore-tag')).find((tag) =>
4437
+ tag.textContent?.includes('$local:name')
4438
+ );
4439
+ expect(chip, 'the reference in the summary renders as a chip').toBeTruthy();
4440
+ });
4441
+ await _testsWaitForText('" == "John"');
4425
4442
  await expect(document.querySelectorAll('.options-readfirst-card')).toHaveLength(0);
4426
4443
 
4427
4444
  // A hash renders its read-first preview (the structured tree by default)
@@ -5915,3 +5932,144 @@ export const CompactRowMarkdownWithoutRenderer: Story = {
5915
5932
  expect(descText).not.toContain('**');
5916
5933
  },
5917
5934
  };
5935
+
5936
+ /**
5937
+ * The read-first summary of an EXPRESSION: it renders to one line of text, and
5938
+ * a template reference inside it used to print as its own raw token — the same
5939
+ * reference the editor shows as a named chip. This is the Save Reply row of the
5940
+ * Discord assistant template, whose value is
5941
+ * `trim($data:{dc_ai_reply.choices[0].message.content})`.
5942
+ */
5943
+ export const CompactExpressionTemplateChips: Story = {
5944
+ parameters: {
5945
+ docs: {
5946
+ description: {
5947
+ story:
5948
+ 'Renders a compact read-first row whose value is an expression wrapping a template reference — the reference renders as a named chip inside the summary text (trim("Choices[0].message.content")) rather than as its raw $data token.',
5949
+ },
5950
+ },
5951
+ chromatic: { disable: true },
5952
+ },
5953
+ render: () => (
5954
+ <FormEngine
5955
+ compact
5956
+ name='exprChips'
5957
+ stringTemplates={
5958
+ {
5959
+ items: [
5960
+ {
5961
+ label: 'Generate AI Reply',
5962
+ items: [
5963
+ {
5964
+ label: 'Choices',
5965
+ value: '$data:{3.choices}',
5966
+ metadata: { aliasValues: ['$data:{dc_ai_reply.choices}'] },
5967
+ },
5968
+ ],
5969
+ },
5970
+ ],
5971
+ } as any
5972
+ }
5973
+ options={
5974
+ {
5975
+ reply: {
5976
+ type: 'string',
5977
+ display_name: 'Value',
5978
+ desc: 'The new value for the variable',
5979
+ supports_expressions: true,
5980
+ required: true,
5981
+ },
5982
+ } as unknown as IQorusFormSchema
5983
+ }
5984
+ value={
5985
+ {
5986
+ reply: {
5987
+ type: 'string',
5988
+ is_expression: true,
5989
+ value: {
5990
+ exp: 'trim',
5991
+ args: [{ type: 'string', value: '$data:{dc_ai_reply.choices[0].message.content}' }],
5992
+ },
5993
+ },
5994
+ } as any
5995
+ }
5996
+ onChange={fn()}
5997
+ />
5998
+ ),
5999
+ play: async () => {
6000
+ // The summary keeps its literal text…
6001
+ await _testsWaitForText('trim("', undefined, 1);
6002
+ // …and the reference inside it is a named chip, not the raw token.
6003
+ await waitFor(() => {
6004
+ const chip = Array.from(document.querySelectorAll('.reqore-tag')).find((tag) =>
6005
+ tag.textContent?.includes('Choices[0].message.content')
6006
+ );
6007
+ expect(chip, 'the reference renders as a named chip in the summary').toBeTruthy();
6008
+ });
6009
+ const raw = Array.from(document.querySelectorAll('.readfirst-row')).filter((row) =>
6010
+ row.textContent?.includes('$data:{')
6011
+ );
6012
+ expect(raw, 'the row prints no raw token').toHaveLength(0);
6013
+ },
6014
+ };
6015
+
6016
+ /**
6017
+ * The same row on a surface with NO template catalogue — the Automation Hub
6018
+ * template preview, which never fetches one. There is no name to resolve the
6019
+ * reference to, so the chip carries the reference's own path: the wrapper still
6020
+ * reads as `trim("…")` text, and the reference stops reading as code.
6021
+ */
6022
+ export const CompactExpressionWithoutCatalogue: Story = {
6023
+ parameters: {
6024
+ docs: {
6025
+ description: {
6026
+ story:
6027
+ 'Renders a compact read-first row whose value is an expression wrapping a template reference, with no templates supplied — the reference still renders as a chip carrying its own path (dc_ai_reply.choices[0].message.content) rather than the raw $data token.',
6028
+ },
6029
+ },
6030
+ chromatic: { disable: true },
6031
+ },
6032
+ render: () => (
6033
+ <FormEngine
6034
+ compact
6035
+ name='exprNoCatalogue'
6036
+ options={
6037
+ {
6038
+ reply: {
6039
+ type: 'string',
6040
+ display_name: 'Value',
6041
+ desc: 'The new value for the variable',
6042
+ supports_expressions: true,
6043
+ required: true,
6044
+ },
6045
+ } as unknown as IQorusFormSchema
6046
+ }
6047
+ value={
6048
+ {
6049
+ reply: {
6050
+ type: 'string',
6051
+ is_expression: true,
6052
+ value: {
6053
+ exp: 'trim',
6054
+ args: [{ type: 'string', value: '$data:{dc_ai_reply.choices[0].message.content}' }],
6055
+ },
6056
+ },
6057
+ } as any
6058
+ }
6059
+ onChange={fn()}
6060
+ />
6061
+ ),
6062
+ play: async () => {
6063
+ await _testsWaitForText('trim("', undefined, 1);
6064
+ await waitFor(() => {
6065
+ const chip = Array.from(document.querySelectorAll('.reqore-tag')).find((tag) =>
6066
+ tag.textContent?.includes('dc_ai_reply.choices[0].message.content')
6067
+ );
6068
+ expect(chip, 'the reference chips even with no catalogue').toBeTruthy();
6069
+ });
6070
+ const raw = Array.from(document.querySelectorAll('.readfirst-row')).filter((row) =>
6071
+ row.textContent?.includes('$data:{')
6072
+ );
6073
+ expect(raw, 'the row prints no raw token').toHaveLength(0);
6074
+ },
6075
+ };
@@ -134,15 +134,40 @@ export const shouldAutoCollapseCompactOption = (
134
134
  (isCompactBooleanOption(schema) || isFixedCompactAllowedValueOption(schema));
135
135
 
136
136
  /** Prefer the matching allowed_values entry's display_name (fallback `name`)
137
- * over the raw stored value. */
137
+ * over the raw stored value.
138
+ *
139
+ * A LIST carries its options under `element_allowed_values` — they constrain
140
+ * each element, not the list itself — so a multi-select that was missing here
141
+ * printed what it stores rather than what you picked: `orders, batch` for
142
+ * fields whose picker reads "Orders, Batch". The gap shows worst exactly where
143
+ * allowed values earn their keep, since the stored form is often not readable
144
+ * at all (a permission code, `PO_REQUIRE_TYPES`, an app-specific id). */
138
145
  const findAllowedOption = (value: unknown, schema?: TQorusFormFieldSchema): any | undefined => {
139
- const s = schema as { allowed_values?: any[]; items?: any[] } | undefined;
140
- const options = s?.allowed_values?.length ? s.allowed_values : s?.items;
146
+ const s = schema as
147
+ | { allowed_values?: any[]; element_allowed_values?: any[]; items?: any[] }
148
+ | undefined;
149
+ const options =
150
+ (s?.allowed_values?.length && s.allowed_values) ||
151
+ (s?.element_allowed_values?.length && s.element_allowed_values) ||
152
+ s?.items;
141
153
  if (!options?.length) {
142
154
  return undefined;
143
155
  }
156
+ // A stored element can be the bare value or the typed `{type, value}`
157
+ // envelope the form engine round-trips; match either against either.
158
+ const stored =
159
+ value && typeof value === 'object' && 'value' in (value as Record<string, unknown>) ?
160
+ (value as Record<string, unknown>).value
161
+ : value;
162
+
144
163
  return options.find(
145
- (option) => option?.value?.value === value || option?.value === value || option?.name === value
164
+ (option) =>
165
+ option?.value?.value === value ||
166
+ option?.value === value ||
167
+ option?.name === value ||
168
+ option?.value?.value === stored ||
169
+ option?.value === stored ||
170
+ option?.name === stored
146
171
  );
147
172
  };
148
173
 
@@ -2,7 +2,11 @@ import { ReqoreTag, ReqoreTagGroup } from '@qoretechnologies/reqore';
2
2
  import { IReqoreFormTemplates } from '@qoretechnologies/reqore/dist/components/Textarea';
3
3
  import { TSizes } from '@qoretechnologies/reqore/dist/constants/sizes';
4
4
  import { memo } from 'react';
5
- import { findTemplate, getTemplateTagStyle, TTemplateMeta } from '../../../../helpers/templates';
5
+ import {
6
+ getTemplateTagStyle,
7
+ describeTemplateReference,
8
+ TTemplateMeta,
9
+ } from '../../../../helpers/templates';
6
10
 
7
11
  export interface IReadOnlyTemplateTagProps {
8
12
  /** The template reference value, e.g. `$local:test`. */
@@ -22,14 +26,14 @@ export interface IReadOnlyTemplateTagProps {
22
26
  */
23
27
  export const ReadOnlyTemplateTag = memo(
24
28
  ({ value, templates, size }: IReadOnlyTemplateTagProps) => {
25
- const template = templates ? findTemplate(templates, value) : undefined;
26
- const metadata = template?.metadata as TTemplateMeta | undefined;
29
+ const { label, item } = describeTemplateReference(templates, value);
30
+ const metadata = item?.metadata as TTemplateMeta | undefined;
27
31
  return (
28
32
  <ReqoreTagGroup size={size}>
29
33
  <ReqoreTag
30
34
  icon='ExchangeDollarLine'
31
35
  leftIconProps={{ image: metadata?.image }}
32
- label={template?.label || value}
36
+ label={label}
33
37
  tooltip={value}
34
38
  {...getTemplateTagStyle(metadata)}
35
39
  />