@qoretechnologies/reqraft 0.10.41-pr.95.g294e5aa → 0.10.41
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/.claude/CLAUDE.md +12 -0
- package/.tasks/INDEX.md +1 -0
- package/.tasks/TEMPLATE_TOKEN_GRAMMAR.md +72 -0
- package/dist/components/codeSize/index.d.ts +37 -0
- package/dist/components/codeSize/index.d.ts.map +1 -0
- package/dist/components/codeSize/index.js +87 -0
- package/dist/components/codeSize/index.js.map +1 -0
- package/dist/components/form/engine/CompactRow.d.ts +20 -1
- package/dist/components/form/engine/CompactRow.d.ts.map +1 -1
- package/dist/components/form/engine/CompactRow.js +284 -42
- package/dist/components/form/engine/CompactRow.js.map +1 -1
- package/dist/components/form/engine/CompactToolbar.d.ts.map +1 -1
- package/dist/components/form/engine/CompactToolbar.js +72 -72
- package/dist/components/form/engine/CompactToolbar.js.map +1 -1
- package/dist/components/form/engine/FormEngine.d.ts +48 -1
- package/dist/components/form/engine/FormEngine.d.ts.map +1 -1
- package/dist/components/form/engine/FormEngine.js +163 -75
- package/dist/components/form/engine/FormEngine.js.map +1 -1
- package/dist/components/form/engine/_structuredData/SchemaDataView.d.ts.map +1 -1
- package/dist/components/form/engine/_structuredData/SchemaDataView.js +102 -87
- package/dist/components/form/engine/_structuredData/SchemaDataView.js.map +1 -1
- package/dist/components/form/engine/compactRowStyles.d.ts +2 -0
- package/dist/components/form/engine/compactRowStyles.d.ts.map +1 -1
- package/dist/components/form/engine/compactRowStyles.js +22 -5
- package/dist/components/form/engine/compactRowStyles.js.map +1 -1
- package/dist/components/form/engine/compactToolbarContext.d.ts +8 -0
- package/dist/components/form/engine/compactToolbarContext.d.ts.map +1 -1
- package/dist/components/form/engine/compactToolbarContext.js.map +1 -1
- package/dist/components/form/engine/readFirst.d.ts +57 -1
- package/dist/components/form/engine/readFirst.d.ts.map +1 -1
- package/dist/components/form/engine/readFirst.js +143 -4
- package/dist/components/form/engine/readFirst.js.map +1 -1
- package/dist/components/form/fields/Field.d.ts.map +1 -1
- package/dist/components/form/fields/Field.js +1 -1
- package/dist/components/form/fields/Field.js.map +1 -1
- package/dist/components/form/fields/allowed-values/AllowedValues.d.ts +12 -2
- package/dist/components/form/fields/allowed-values/AllowedValues.d.ts.map +1 -1
- package/dist/components/form/fields/allowed-values/AllowedValues.js +16 -6
- package/dist/components/form/fields/allowed-values/AllowedValues.js.map +1 -1
- package/dist/components/form/fields/array/ArrayAuto.d.ts.map +1 -1
- package/dist/components/form/fields/array/ArrayAuto.js +44 -26
- package/dist/components/form/fields/array/ArrayAuto.js.map +1 -1
- package/dist/components/form/fields/array/ArrayAutoField.d.ts.map +1 -1
- package/dist/components/form/fields/array/ArrayAutoField.js +42 -25
- package/dist/components/form/fields/array/ArrayAutoField.js.map +1 -1
- package/dist/components/form/fields/auto/AutoFormField.d.ts.map +1 -1
- package/dist/components/form/fields/auto/AutoFormField.js +32 -4
- package/dist/components/form/fields/auto/AutoFormField.js.map +1 -1
- package/dist/components/form/fields/long-string/LongString.d.ts +9 -1
- package/dist/components/form/fields/long-string/LongString.d.ts.map +1 -1
- package/dist/components/form/fields/long-string/LongString.js +25 -4
- package/dist/components/form/fields/long-string/LongString.js.map +1 -1
- package/dist/components/form/fields/template/ExampleValueModal.d.ts +29 -0
- package/dist/components/form/fields/template/ExampleValueModal.d.ts.map +1 -0
- package/dist/components/form/fields/template/ExampleValueModal.js +122 -0
- package/dist/components/form/fields/template/ExampleValueModal.js.map +1 -0
- package/dist/components/form/fields/template/ReadOnlyTemplateTag.d.ts.map +1 -1
- package/dist/components/form/fields/template/ReadOnlyTemplateTag.js +3 -3
- package/dist/components/form/fields/template/ReadOnlyTemplateTag.js.map +1 -1
- package/dist/components/form/fields/template/TemplateField.d.ts.map +1 -1
- package/dist/components/form/fields/template/TemplateField.js +35 -6
- package/dist/components/form/fields/template/TemplateField.js.map +1 -1
- package/dist/components/form/fields/template/__fixtures__/longExampleValue.d.ts +2 -0
- package/dist/components/form/fields/template/__fixtures__/longExampleValue.d.ts.map +1 -0
- package/dist/components/form/fields/template/__fixtures__/longExampleValue.js +9 -0
- package/dist/components/form/fields/template/__fixtures__/longExampleValue.js.map +1 -0
- package/dist/components/form/index.d.ts +1 -0
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/index.js +1 -0
- package/dist/components/form/index.js.map +1 -1
- package/dist/helpers/common.d.ts +8 -1
- package/dist/helpers/common.d.ts.map +1 -1
- package/dist/helpers/common.js +9 -1
- package/dist/helpers/common.js.map +1 -1
- package/dist/helpers/optionUiTypes.d.ts +30 -0
- package/dist/helpers/optionUiTypes.d.ts.map +1 -0
- package/dist/helpers/optionUiTypes.js +148 -0
- package/dist/helpers/optionUiTypes.js.map +1 -0
- package/dist/helpers/options.d.ts +19 -0
- package/dist/helpers/options.d.ts.map +1 -1
- package/dist/helpers/options.js +25 -1
- package/dist/helpers/options.js.map +1 -1
- package/dist/helpers/providerValue.d.ts +68 -0
- package/dist/helpers/providerValue.d.ts.map +1 -0
- package/dist/helpers/providerValue.js +50 -0
- package/dist/helpers/providerValue.js.map +1 -0
- package/dist/helpers/singleLineString.d.ts +37 -0
- package/dist/helpers/singleLineString.d.ts.map +1 -0
- package/dist/helpers/singleLineString.js +66 -0
- package/dist/helpers/singleLineString.js.map +1 -0
- package/dist/helpers/templates.d.ts +100 -0
- package/dist/helpers/templates.d.ts.map +1 -1
- package/dist/helpers/templates.js +237 -4
- package/dist/helpers/templates.js.map +1 -1
- package/dist/helpers/validations.d.ts +103 -2
- package/dist/helpers/validations.d.ts.map +1 -1
- package/dist/helpers/validations.js +858 -91
- package/dist/helpers/validations.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/codeSize/index.tsx +79 -0
- package/src/components/form/engine/CompactRow.tsx +407 -34
- package/src/components/form/engine/CompactToolbar.tsx +105 -98
- package/src/components/form/engine/FormEngine.stories.tsx +863 -12
- package/src/components/form/engine/FormEngine.tsx +183 -33
- package/src/components/form/engine/_structuredData/SchemaDataView.stories.tsx +110 -103
- package/src/components/form/engine/_structuredData/SchemaDataView.tsx +132 -80
- package/src/components/form/engine/compactRowStyles.ts +44 -1
- package/src/components/form/engine/compactToolbarContext.ts +8 -0
- package/src/components/form/engine/readFirst.ts +163 -4
- package/src/components/form/fields/Field.tsx +3 -1
- package/src/components/form/fields/allowed-values/AllowedValues.tsx +24 -2
- package/src/components/form/fields/array/ArrayAuto.tsx +23 -4
- package/src/components/form/fields/array/ArrayAutoField.stories.tsx +134 -0
- package/src/components/form/fields/array/ArrayAutoField.tsx +22 -4
- package/src/components/form/fields/auto/AutoFormField.tsx +31 -1
- package/src/components/form/fields/long-string/LongString.tsx +46 -5
- package/src/components/form/fields/schema-definition/SchemaDefinitionField.stories.tsx +5 -0
- package/src/components/form/fields/template/ExampleValueModal.stories.tsx +114 -0
- package/src/components/form/fields/template/ExampleValueModal.tsx +99 -0
- package/src/components/form/fields/template/ReadOnlyTemplateTag.tsx +8 -4
- package/src/components/form/fields/template/TemplateField.stories.tsx +314 -1
- package/src/components/form/fields/template/TemplateField.tsx +47 -8
- package/src/components/form/fields/template/__fixtures__/longExampleValue.ts +7 -0
- package/src/components/form/index.tsx +1 -0
- package/src/helpers/common.ts +11 -1
- package/src/helpers/optionUiTypes.ts +153 -0
- package/src/helpers/options.ts +23 -0
- package/src/helpers/providerValue.ts +125 -0
- package/src/helpers/singleLineString.ts +61 -0
- package/src/helpers/templates.ts +272 -3
- package/src/helpers/validations.ts +1177 -109
- package/src/hooks/useWebSocket/useWebsocket.stories.tsx +23 -2
- package/src/index.tsx +2 -0
|
@@ -93,11 +93,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
93
93
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
94
94
|
};
|
|
95
95
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
96
|
-
exports.CompactRow = void 0;
|
|
96
|
+
exports.CompactRow = exports.richtextItemText = void 0;
|
|
97
97
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
98
98
|
var reqore_1 = require("@qoretechnologies/reqore");
|
|
99
99
|
var optionActions_1 = require("./optionActions");
|
|
100
100
|
var flatten_1 = __importDefault(require("lodash/flatten"));
|
|
101
|
+
var isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
101
102
|
var size_1 = __importDefault(require("lodash/size"));
|
|
102
103
|
var react_1 = __importStar(require("react"));
|
|
103
104
|
var use_context_selector_1 = require("use-context-selector");
|
|
@@ -105,6 +106,7 @@ var validations_1 = require("../../../helpers/validations");
|
|
|
105
106
|
var templates_1 = require("../../../helpers/templates");
|
|
106
107
|
var common_1 = require("../../../helpers/common");
|
|
107
108
|
var ReadOnlyTemplateTag_1 = require("../fields/template/ReadOnlyTemplateTag");
|
|
109
|
+
var codeSize_1 = require("../../codeSize");
|
|
108
110
|
var Description_1 = require("../../Description");
|
|
109
111
|
var markdownRendererContext_1 = require("../../Description/markdownRendererContext");
|
|
110
112
|
var FocusedEditing_1 = require("../../FocusedEditing");
|
|
@@ -176,13 +178,40 @@ var MAX_INLINE_OPTION_ACTIONS = 2;
|
|
|
176
178
|
// One read-first row: label | value | action collapsed; the real editor (the
|
|
177
179
|
// classic renderOption) expanded. `hidden` = search-surfaced optional —
|
|
178
180
|
// activating the row adds the field first.
|
|
181
|
+
/**
|
|
182
|
+
* The text inside a rich-text envelope, when a list item is one.
|
|
183
|
+
*
|
|
184
|
+
* An option like Gmail's `to` is `type: "list"`, `element_type: "string"`,
|
|
185
|
+
* `supports_templates: true`: each element is a plain string that may carry
|
|
186
|
+
* template tags, so its editor is a rich-text one and the element value arrives
|
|
187
|
+
* wrapped as `{type: "richtext", value: [{type: "paragraph", …}]}`.
|
|
188
|
+
*
|
|
189
|
+
* That envelope is a string in a coat, not structured data. The hash-list test
|
|
190
|
+
* unwraps `item.value`, found the Slate document — an object — and classed a
|
|
191
|
+
* list of email addresses as a list of hashes, so the row drew an expandable
|
|
192
|
+
* `type / children / text` tree instead of the address the operator typed.
|
|
193
|
+
*/
|
|
194
|
+
var richtextItemText = function (item) {
|
|
195
|
+
return item && typeof item === 'object' && item.type === 'richtext' ?
|
|
196
|
+
(0, common_1.richtextToString)(item.value)
|
|
197
|
+
: undefined;
|
|
198
|
+
};
|
|
199
|
+
exports.richtextItemText = richtextItemText;
|
|
179
200
|
exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
180
201
|
var _b;
|
|
181
|
-
var _c, _d, _e, _f, _g, _h, _j, _k;
|
|
182
|
-
var optionName = _a.optionName, optionField = _a.optionField,
|
|
202
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
203
|
+
var optionName = _a.optionName, optionField = _a.optionField, _o = _a.hidden, hidden = _o === void 0 ? false : _o, _p = _a.clustered, clustered = _p === void 0 ? false : _p, _q = _a.clusterFirst, clusterFirst = _q === void 0 ? false : _q, _r = _a.clusterLast, clusterLast = _r === void 0 ? false : _r, absorbedFields = _a.absorbedFields;
|
|
183
204
|
var readOnly = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.readOnly; });
|
|
184
205
|
var commitMode = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.commitMode; });
|
|
185
206
|
var options = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.options; });
|
|
207
|
+
// An absorbed field keeps its own name — it is a different field, not a
|
|
208
|
+
// property of its host — so the label comes from its schema exactly as it
|
|
209
|
+
// would on its own row.
|
|
210
|
+
var getAbsorbedLabel = function (absorbedName) {
|
|
211
|
+
var _a;
|
|
212
|
+
return ((_a = options === null || options === void 0 ? void 0 : options[absorbedName]) === null || _a === void 0 ? void 0 : _a.display_name) ||
|
|
213
|
+
absorbedName;
|
|
214
|
+
};
|
|
186
215
|
var codePreviewRenderer = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.codePreviewRenderer; });
|
|
187
216
|
var markdownRenderer = (0, markdownRendererContext_1.useMarkdownRenderer)();
|
|
188
217
|
var operators = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.operators; });
|
|
@@ -229,6 +258,26 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
229
258
|
// renderer when it supplied one, reqraft's own otherwise.
|
|
230
259
|
// Value-cell content: colour adds a swatch, file an icon + size; hash keeps
|
|
231
260
|
// its "N fields" summary (sub-fields reveal beneath the row).
|
|
261
|
+
/**
|
|
262
|
+
* Flattens the line breaks in one prose segment of a richtext SUMMARY.
|
|
263
|
+
*
|
|
264
|
+
* The read-first row is a single line: every other value type reaches it
|
|
265
|
+
* through `whiteSpace: 'nowrap'`, which collapses newlines for free. The
|
|
266
|
+
* richtext branch is the only one that opts into `'pre'` — it has to, or the
|
|
267
|
+
* spaces that separate a word from the chip beside it are dropped — and `pre`
|
|
268
|
+
* also honours the newlines, which `nowrap` would have eaten.
|
|
269
|
+
*
|
|
270
|
+
* So a genuinely multi-line value (an alert rule's Gmail message body is five
|
|
271
|
+
* `\n`-separated lines) gave each segment after the first a blank first line.
|
|
272
|
+
* The wrapper centres its items, so a two-line-tall box centred against
|
|
273
|
+
* one-line chips put every word 12px below the chip beside it, and the row
|
|
274
|
+
* read as a staircase. Measured on supah: prose boxes 30px against 14px chips.
|
|
275
|
+
*
|
|
276
|
+
* A space, not nothing: consecutive prose segments are merged before they get
|
|
277
|
+
* here, so a value with a break and no chip between its lines would otherwise
|
|
278
|
+
* lose the word boundary entirely.
|
|
279
|
+
*/
|
|
280
|
+
var collapseSummaryBreaks = function (text) { return text.replace(/\s*\r?\n\s*/g, ' '); };
|
|
232
281
|
var renderReadFirstValue = function (field, schema, formatted) {
|
|
233
282
|
var valueType = (0, readFirst_1.getValueType)(field, schema);
|
|
234
283
|
var wrapStyle = {
|
|
@@ -267,9 +316,18 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
267
316
|
// see `showCodePreview` below. Keeps the row height fixed while making
|
|
268
317
|
// multi-line source readable without opening the full editor.
|
|
269
318
|
if (valueType === 'code-editor' && typeof (field === null || field === void 0 ? void 0 : field.value) === 'string') {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
319
|
+
// An absorbed sibling has no row of its own, so a COLLAPSED host has to
|
|
320
|
+
// carry its value or it disappears from the form entirely when closed.
|
|
321
|
+
// It reads as a chip beside the size chip — "Qore · 62 lines" — which
|
|
322
|
+
// is the same summary the read-only interface pages already show.
|
|
323
|
+
return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreControlGroup, { gapSize: 'tiny', verticalAlign: 'center', wrap: true, children: (absorbedFields !== null && absorbedFields !== void 0 ? absorbedFields : []).map(function (absorbedName) {
|
|
324
|
+
var _a;
|
|
325
|
+
var absorbedValue = (_a = availableOptions === null || availableOptions === void 0 ? void 0 : availableOptions[absorbedName]) === null || _a === void 0 ? void 0 : _a.value;
|
|
326
|
+
if (absorbedValue === undefined || absorbedValue === null || absorbedValue === '') {
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { className: 'options-readfirst-absorbed-tag', size: 'small', minimal: true, label: String(absorbedValue), tooltip: getAbsorbedLabel(absorbedName) }, absorbedName));
|
|
330
|
+
}) }));
|
|
273
331
|
}
|
|
274
332
|
// Markdown read summary: the row prints the value's prose (the markdown
|
|
275
333
|
// markers are stripped by `formatOptionValue`), so a multi-line document
|
|
@@ -303,6 +361,14 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
303
361
|
(0, templates_1.isValueTemplate)(field.value)) {
|
|
304
362
|
return (0, jsx_runtime_1.jsx)(ReadOnlyTemplateTag_1.ReadOnlyTemplateTag, { value: field.value, templates: templates, size: 'small' });
|
|
305
363
|
}
|
|
364
|
+
// A LIST whose elements are rich-text envelopes is a list of strings, so it
|
|
365
|
+
// reads as those strings. Without this the row fell through to the generic
|
|
366
|
+
// list summary and printed a bare count ("1 item") above the structured
|
|
367
|
+
// tree, never the address itself.
|
|
368
|
+
if (Array.isArray(field === null || field === void 0 ? void 0 : field.value) && field.value.some(function (item) { return (0, exports.richtextItemText)(item) !== undefined; })) {
|
|
369
|
+
var texts = field.value.map(function (item) { var _a; return (_a = (0, exports.richtextItemText)(item)) !== null && _a !== void 0 ? _a : String(item !== null && item !== void 0 ? item : ''); });
|
|
370
|
+
return (0, jsx_runtime_1.jsx)("span", { style: textStyle, children: texts.filter(function (text) { return text !== ''; }).join(', ') });
|
|
371
|
+
}
|
|
306
372
|
// Richtext read-first summary: inline $-chips for embedded template tags
|
|
307
373
|
// with the prose around them (the IDE intent scheme via getTemplateTagStyle),
|
|
308
374
|
// kept lightweight instead of mounting the full editor — that lives in the
|
|
@@ -322,6 +388,33 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
322
388
|
// size makes centring align the baselines too, at whatever font
|
|
323
389
|
// size the consuming app uses.
|
|
324
390
|
style: { fontSize: 'inherit' }, icon: 'ExchangeDollarLine', label: segment.text || segment.value, tooltip: segment.value }, (0, templates_1.getTemplateTagStyle)((_a = (templates ? (0, templates_1.findTemplate)(templates, segment.value || '') : undefined)) === null || _a === void 0 ? void 0 : _a.metadata)), index)
|
|
391
|
+
: (0, jsx_runtime_1.jsx)("span", { style: { whiteSpace: 'pre' }, children: collapseSummaryBreaks(segment.text) }, index);
|
|
392
|
+
}) }));
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
// An expression summarises to one line of text, and a template reference
|
|
396
|
+
// inside it printed as its own raw token — `$data:{…}` renders a value as
|
|
397
|
+
// code where a name belongs. Chip every reference here, on the richtext
|
|
398
|
+
// branch's pattern above, so the wrapper (`trim(`…`)`) still reads as the
|
|
399
|
+
// text it is while the reference reads as a name.
|
|
400
|
+
//
|
|
401
|
+
// Unconditionally: a surface with no catalogue (the Automation Hub
|
|
402
|
+
// template preview never fetches one) still shows the reference's own
|
|
403
|
+
// path, which is the point — a conditional chip is no chip at all
|
|
404
|
+
// exactly where the raw token looks worst.
|
|
405
|
+
if ((field === null || field === void 0 ? void 0 : field.is_expression) && formatted) {
|
|
406
|
+
var segments = (0, templates_1.splitTemplateTokens)(formatted);
|
|
407
|
+
var named = segments.map(function (segment) {
|
|
408
|
+
return segment.kind === 'token' ? __assign(__assign({}, segment), (0, templates_1.describeTemplateReference)(templates, segment.text)) : segment;
|
|
409
|
+
});
|
|
410
|
+
if (named.some(function (segment) { return segment.kind === 'token'; })) {
|
|
411
|
+
return ((0, jsx_runtime_1.jsx)("span", { style: __assign(__assign({}, wrapStyle), { gap: 4, overflow: 'hidden' }), children: named.map(function (segment, index) {
|
|
412
|
+
var _a;
|
|
413
|
+
return segment.kind === 'token' ?
|
|
414
|
+
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, __assign({ size: 'tiny',
|
|
415
|
+
// Inherit the row's font size so the chip shares a baseline
|
|
416
|
+
// with the text around it — see the richtext branch above.
|
|
417
|
+
style: { fontSize: 'inherit' }, icon: 'ExchangeDollarLine', label: segment.label, tooltip: segment.text }, (0, templates_1.getTemplateTagStyle)((_a = segment.item) === null || _a === void 0 ? void 0 : _a.metadata)), index)
|
|
325
418
|
: (0, jsx_runtime_1.jsx)("span", { style: { whiteSpace: 'pre' }, children: segment.text }, index);
|
|
326
419
|
}) }));
|
|
327
420
|
}
|
|
@@ -344,14 +437,14 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
344
437
|
// hover-gated button is unreachable without a hover — and anything past the
|
|
345
438
|
// inline cap overflows regardless, so a consumer injecting ten actions can
|
|
346
439
|
// never push the row's value out of view.
|
|
347
|
-
var
|
|
440
|
+
var _s = react_1.default.useMemo(function () {
|
|
348
441
|
return collapseOptionActions ?
|
|
349
442
|
[[], injectedOptionActions]
|
|
350
443
|
: [
|
|
351
444
|
injectedOptionActions.slice(0, MAX_INLINE_OPTION_ACTIONS),
|
|
352
445
|
injectedOptionActions.slice(MAX_INLINE_OPTION_ACTIONS),
|
|
353
446
|
];
|
|
354
|
-
}, [collapseOptionActions, injectedOptionActions]), inlineOptionActions =
|
|
447
|
+
}, [collapseOptionActions, injectedOptionActions]), inlineOptionActions = _s[0], menuOptionActions = _s[1];
|
|
355
448
|
var injectedOptionActionMenuItems = react_1.default.useMemo(function () {
|
|
356
449
|
return menuOptionActions.map(function (action, index) {
|
|
357
450
|
var _a, _b;
|
|
@@ -462,6 +555,38 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
462
555
|
}, 60);
|
|
463
556
|
return function () { return window.clearTimeout(id); };
|
|
464
557
|
}, [isExpanded, optionName, autoFocusNameRef]);
|
|
558
|
+
// What the field held when it was opened — the baseline Cancel restores.
|
|
559
|
+
//
|
|
560
|
+
// Deliberately NOT `originalValue`, which is the whole form's load-time
|
|
561
|
+
// snapshot. That answers "undo every change ever made to this field", which
|
|
562
|
+
// is a different question from "forget what I just typed"; a Cancel sitting
|
|
563
|
+
// next to Done has to mean the second one, or it silently throws away edits
|
|
564
|
+
// the user made earlier and had already accepted.
|
|
565
|
+
//
|
|
566
|
+
// The dependency list is `isExpanded` alone on purpose: adding the value
|
|
567
|
+
// would re-take the snapshot on every keystroke, leaving nothing to cancel.
|
|
568
|
+
var editEntryValue = react_1.default.useRef(undefined);
|
|
569
|
+
react_1.default.useEffect(function () {
|
|
570
|
+
if (isExpanded) {
|
|
571
|
+
editEntryValue.current = { value: optionField === null || optionField === void 0 ? void 0 : optionField.value, type: optionField === null || optionField === void 0 ? void 0 : optionField.type };
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
editEntryValue.current = undefined;
|
|
575
|
+
}
|
|
576
|
+
}, [isExpanded]);
|
|
577
|
+
// True while the open editor holds something other than what it opened with.
|
|
578
|
+
var editedSinceOpened = isExpanded &&
|
|
579
|
+
!!editEntryValue.current &&
|
|
580
|
+
!(0, isEqual_1.default)(editEntryValue.current.value, optionField === null || optionField === void 0 ? void 0 : optionField.value);
|
|
581
|
+
// Discard whatever was typed since the field was opened and close it. Used
|
|
582
|
+
// by both the Cancel button and Escape, so the two cannot diverge.
|
|
583
|
+
var cancelEdit = react_1.default.useCallback(function () {
|
|
584
|
+
var snapshot = editEntryValue.current;
|
|
585
|
+
if (snapshot && !(0, isEqual_1.default)(snapshot.value, optionField === null || optionField === void 0 ? void 0 : optionField.value)) {
|
|
586
|
+
handleValueChange(optionName, snapshot.value, snapshot.type);
|
|
587
|
+
}
|
|
588
|
+
toggleExpandedOption(optionName);
|
|
589
|
+
}, [handleValueChange, optionField === null || optionField === void 0 ? void 0 : optionField.value, optionName, toggleExpandedOption]);
|
|
465
590
|
// The sub-schema describing this field's value, when it has one. A value the
|
|
466
591
|
// form knows the shape of is previewed THROUGH that shape (see
|
|
467
592
|
// `SchemaDataView`); only genuinely undescribed data falls through to the
|
|
@@ -479,7 +604,7 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
479
604
|
// below an early return, so a hook placed there would run conditionally.
|
|
480
605
|
var rawArgSchema = schema === null || schema === void 0 ? void 0 : schema.arg_schema;
|
|
481
606
|
var argSchemaId = typeof rawArgSchema === 'string' ? rawArgSchema : undefined;
|
|
482
|
-
var
|
|
607
|
+
var _t = react_1.default.useState(undefined), resolvedArgSchema = _t[0], setResolvedArgSchema = _t[1];
|
|
483
608
|
// Only worth a request when there is a described value to preview: a row whose
|
|
484
609
|
// value is unset or scalar renders no inset, so fetching its schema would buy
|
|
485
610
|
// a round trip per row and show nothing. `query` caches GETs, so rows sharing
|
|
@@ -515,6 +640,18 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
515
640
|
}, [argSchemaId, valueLooksStructured]);
|
|
516
641
|
var previewArgSchema = argSchemaId ? resolvedArgSchema : rawArgSchema;
|
|
517
642
|
var previewWithSchema = react_1.default.useMemo(function () { return (0, SchemaDataView_1.canRenderWithSchema)(optionField === null || optionField === void 0 ? void 0 : optionField.value, previewArgSchema); }, [optionField === null || optionField === void 0 ? void 0 : optionField.value, previewArgSchema]);
|
|
643
|
+
// The form-load revert: back to the value the FORM was loaded with.
|
|
644
|
+
//
|
|
645
|
+
// In an open editor this is offered only when it would do something
|
|
646
|
+
// `cancelEditButton` does not — that is, when the field was already
|
|
647
|
+
// modified BEFORE it was opened, so "undo this edit" and "undo every edit"
|
|
648
|
+
// are different answers. On the usual path (open an untouched field, type,
|
|
649
|
+
// change your mind) the two are identical, and two buttons with the same
|
|
650
|
+
// effect and different names are worse than one.
|
|
651
|
+
//
|
|
652
|
+
// It is unconditional on the READ row, where it renders inline in the
|
|
653
|
+
// status-dot column — there is no edit in progress there to cancel, so the
|
|
654
|
+
// whole-field revert is the only undo that makes sense.
|
|
518
655
|
var revertButton = changed ?
|
|
519
656
|
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreButton, { className: 'options-readfirst-revert', size: 'small', flat: true, minimal: true, icon: 'HistoryLine', tooltip: 'Revert changes', onClick: function (e) {
|
|
520
657
|
var _a, _b, _c, _d;
|
|
@@ -560,6 +697,27 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
560
697
|
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { className: 'options-readfirst-draft', label: 'Draft', intent: 'warning', icon: 'EditLine', size: 'tiny', minimal: true, fixed: true, flat: true, compact: true, effect: { uppercase: true, spaced: 1 } })
|
|
561
698
|
: null;
|
|
562
699
|
var isPassiveCloseAction = fixedAllowedValueOption || readOnly;
|
|
700
|
+
// Cancel — the counterpart to Done, and the answer to "how do I get out of
|
|
701
|
+
// here without keeping this". Done was the only way to leave an open field,
|
|
702
|
+
// so every way out committed: the check, clicking away, and Escape (which
|
|
703
|
+
// closed without discarding, so it committed too, silently).
|
|
704
|
+
//
|
|
705
|
+
// Shown only while there is something to discard. On an untouched field
|
|
706
|
+
// Cancel and Done would do exactly the same thing, and two buttons that
|
|
707
|
+
// differ in name but not in effect are worse than one.
|
|
708
|
+
//
|
|
709
|
+
// Not offered when the close action is passive (read-only, or a fixed
|
|
710
|
+
// choice) — nothing can have been typed, so there is nothing to cancel.
|
|
711
|
+
var cancelEditButton = !isPassiveCloseAction && editedSinceOpened ?
|
|
712
|
+
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreButton, { className: 'options-readfirst-cancel', size: 'small', flat: true, minimal: true, fixed: true, icon: 'CloseLine', intent: 'warning', "aria-label": 'Cancel edit', tooltip: 'Cancel edit \u2014 discard the changes made since this field was opened', onClick: function (event) {
|
|
713
|
+
event.stopPropagation();
|
|
714
|
+
cancelEdit();
|
|
715
|
+
} })
|
|
716
|
+
: null;
|
|
717
|
+
// See `revertButton` above for why this is conditional in the edit row.
|
|
718
|
+
var openedWithFormLoadValue = !editEntryValue.current ||
|
|
719
|
+
(0, isEqual_1.default)(editEntryValue.current.value, (_f = (_e = originalValue.current) === null || _e === void 0 ? void 0 : _e[optionName]) === null || _f === void 0 ? void 0 : _f.value);
|
|
720
|
+
var editRowRevertButton = openedWithFormLoadValue ? null : revertButton;
|
|
563
721
|
var closeExpandedFieldButton = ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreButton, { className: 'options-readfirst-done', size: 'small', intent: !isPassiveCloseAction ? 'success' : undefined, flat: isPassiveCloseAction, minimal: isPassiveCloseAction, fixed: true, icon: isPassiveCloseAction ? 'CloseLine' : 'CheckLine', "aria-label": isPassiveCloseAction ? 'Close field' : 'Done', tooltip: isPassiveCloseAction ? 'Close field' : 'Done', onClick: function () { return toggleExpandedOption(optionName); } }));
|
|
564
722
|
// Info tiers: Tier 1 (danger/warning + dependency hints) must be visible
|
|
565
723
|
// without interaction; Tier 2 (info/success, default notes) sits behind ⓘ.
|
|
@@ -618,7 +776,12 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
618
776
|
handleOptionLabelClick(optionName);
|
|
619
777
|
} })
|
|
620
778
|
: null;
|
|
621
|
-
|
|
779
|
+
// The gap rides on the message itself rather than on the panel around it:
|
|
780
|
+
// the panel is a vertical ReqoreControlGroup, which owns its own layout and
|
|
781
|
+
// stacks children flush, and the class rule that used to carry a 4px gap
|
|
782
|
+
// never reached this element at all — which is why two messages read as one
|
|
783
|
+
// two-tone block with no space between them.
|
|
784
|
+
var renderInfoStrip = function (m, index) { return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreMessage, { size: 'small', opaque: false, flat: true, intent: m.intent, title: m.title, style: { marginBottom: 8 }, children: m.content }, "".concat(m.content, "-").concat(index))); };
|
|
622
785
|
var reasonColor = function (intent) {
|
|
623
786
|
var _a;
|
|
624
787
|
return intent === 'danger' ? cDanger
|
|
@@ -632,7 +795,7 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
632
795
|
// wrapper AND the inline editor, so the rail/node/highlight persist across
|
|
633
796
|
// view↔edit. The node is opaque (it masks the rail behind it); hovering any
|
|
634
797
|
// member lights up the whole group via the shared highlight state.
|
|
635
|
-
var clusterGroup = clustered ? (
|
|
798
|
+
var clusterGroup = clustered ? (_g = schema === null || schema === void 0 ? void 0 : schema.required_groups) === null || _g === void 0 ? void 0 : _g[0] : undefined;
|
|
636
799
|
var clusterMembers = clusterGroup ? requiredGroupsInfo.members[clusterGroup] || [] : [];
|
|
637
800
|
// The group is fulfilled once any member is set — the whole rail then reads
|
|
638
801
|
// success (not just the satisfying node).
|
|
@@ -673,12 +836,56 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
673
836
|
},
|
|
674
837
|
]
|
|
675
838
|
: []), true), injectedOptionActionMenuItems, true) }));
|
|
839
|
+
// The absorbed siblings' controls, rendered inside this row.
|
|
840
|
+
//
|
|
841
|
+
// Each keeps its own label so it is still identifiable — it is a different
|
|
842
|
+
// field, not a property of this one — but it sits inside this row's
|
|
843
|
+
// container, above the editor, so the pair reads as the single decision it
|
|
844
|
+
// is. `renderOption` is the same function the row uses for its own editor,
|
|
845
|
+
// so an absorbed field renders exactly as it would have on its own row.
|
|
846
|
+
var absorbedNodes = (absorbedFields === null || absorbedFields === void 0 ? void 0 : absorbedFields.length) ?
|
|
847
|
+
absorbedFields
|
|
848
|
+
.map(function (absorbedName) {
|
|
849
|
+
var absorbedField = availableOptions === null || availableOptions === void 0 ? void 0 : availableOptions[absorbedName];
|
|
850
|
+
if (!absorbedField)
|
|
851
|
+
return null;
|
|
852
|
+
return (
|
|
853
|
+
// No label element of its own: the editor now heads itself with
|
|
854
|
+
// the field's name (see FieldAllowedValuesCheckGroup), so a label
|
|
855
|
+
// beside it printed the same word twice.
|
|
856
|
+
(0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledAbsorbedField, { className: 'options-readfirst-absorbed', children: (0, jsx_runtime_1.jsx)("div", { style: { minWidth: 0, flex: 1 }, children: renderOption(absorbedName, absorbedField, 'small', true) }) }, absorbedName));
|
|
857
|
+
})
|
|
858
|
+
.filter(Boolean)
|
|
859
|
+
: null;
|
|
860
|
+
// Declared here rather than beside the hash rows below: the `isExpanded`
|
|
861
|
+
// branch returns before that point, and its editor needs to know whether it is
|
|
862
|
+
// holding code.
|
|
863
|
+
var valueType = (0, readFirst_1.getValueType)(optionField, schema);
|
|
864
|
+
// How much source there is describes the FIELD, not its value, so the count
|
|
865
|
+
// sits under the field's name — the same rule `lineCountNote` already
|
|
866
|
+
// follows for a multi-line markdown value, and the same reason: the value
|
|
867
|
+
// column carries the value and nothing else. It renders on the read row and
|
|
868
|
+
// the open one alike, because "how much code is here?" is a question that
|
|
869
|
+
// outlives opening the editor.
|
|
870
|
+
//
|
|
871
|
+
// It is a plain monospaced note rather than a tag, and deliberately the same
|
|
872
|
+
// one `lineCountNote` renders: both answer "how big is this field's value?"
|
|
873
|
+
// in the same corner of the same column, so stating one as a chip and the
|
|
874
|
+
// other as text made two spellings of one idea.
|
|
875
|
+
var codeSizeNode = valueType === 'code-editor' &&
|
|
876
|
+
typeof (optionField === null || optionField === void 0 ? void 0 : optionField.value) === 'string' &&
|
|
877
|
+
optionField.value !== '' ?
|
|
878
|
+
(function () {
|
|
879
|
+
var _a = (0, codeSize_1.describeCodeSize)(optionField.value), lines = _a.lines, chars = _a.chars;
|
|
880
|
+
return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreP, { className: 'options-readfirst-label-code-size', size: 'tiny', effect: { opacity: 0.45, textAlign: 'left' }, style: { fontFamily: 'monospace' }, children: "".concat((0, codeSize_1.formatCodeChars)(chars), " ").concat((0, codeSize_1.formatCodeLines)(lines)) }));
|
|
881
|
+
})()
|
|
882
|
+
: null;
|
|
676
883
|
if (isExpanded) {
|
|
677
884
|
if (inlineEditable) {
|
|
678
885
|
var collapse_1 = function () { return toggleExpandedOption(optionName); };
|
|
679
886
|
var editingRow = ((0, jsx_runtime_1.jsxs)("div", __assign({ "data-field": optionName, className: 'readfirst-row readfirst-row-editing options-readfirst-inline options-readfirst-value', style: readRowHeights.current[optionName] ?
|
|
680
887
|
{ minHeight: readRowHeights.current[optionName] }
|
|
681
|
-
: undefined }, clusterHoverProps, { children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledLabelBlock, { children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledRowLabel, { role: 'button', tabIndex: 0, "aria-label": "Collapse ".concat(label), title: (schema === null || schema === void 0 ? void 0 : schema.short_desc) || undefined, "$color": cKey, "$pointer": true, onClick: collapse_1, onKeyDown: function (event) {
|
|
888
|
+
: undefined }, clusterHoverProps, { children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledLabelBlock, { className: 'options-readfirst-label-block', children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledRowLabel, { role: 'button', tabIndex: 0, "aria-label": "Collapse ".concat(label), title: (schema === null || schema === void 0 ? void 0 : schema.short_desc) || undefined, "$color": cKey, "$pointer": true, onClick: collapse_1, onKeyDown: function (event) {
|
|
682
889
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
683
890
|
event.preventDefault();
|
|
684
891
|
collapse_1();
|
|
@@ -687,12 +894,18 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
687
894
|
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: 'Asterisk', color: 'danger', size: '10px' })
|
|
688
895
|
: null, helpIcon] }), labelShortDesc ?
|
|
689
896
|
(0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledLabelDesc, { className: 'options-readfirst-label-desc', size: 'small', effect: { opacity: 0.55 }, children: labelShortDesc })
|
|
690
|
-
: null] }), (0, jsx_runtime_1.
|
|
897
|
+
: null, codeSizeNode] }), (0, jsx_runtime_1.jsxs)("div", { ref: editorRef, style: { minWidth: 0 }, onKeyDown: function (event) {
|
|
691
898
|
if (event.key === 'Escape') {
|
|
692
899
|
event.stopPropagation();
|
|
693
|
-
|
|
900
|
+
// Escape discards. It used to call `collapse()`, which closed
|
|
901
|
+
// the field and KEPT whatever had been typed — the one
|
|
902
|
+
// keystroke every editor treats as "get me out of this
|
|
903
|
+
// without saving" was the quietest way to commit.
|
|
904
|
+
cancelEdit();
|
|
694
905
|
}
|
|
695
|
-
}, children:
|
|
906
|
+
}, children: [panelMessages.length ?
|
|
907
|
+
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreControlGroup, { className: 'options-readfirst-info-panel', vertical: true, fluid: true, gapSize: 'normal', children: panelMessages.map(renderInfoStrip) })
|
|
908
|
+
: null, absorbedNodes, renderOption(optionName, optionField, 'small', true)] }), (0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledRowActions, { children: [draftChip, editRowRevertButton, cancelEditButton, clearValueButton, inlineOptionActions.map(function (action, index) {
|
|
696
909
|
return renderInjectedOptionAction(action, index);
|
|
697
910
|
}), moreMenu, closeExpandedFieldButton] }), clusterNode] }), optionName));
|
|
698
911
|
// ALWAYS wrap the editing row in the same StyledColumn so its parent stays
|
|
@@ -711,10 +924,10 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
711
924
|
var cardBadges = schemaBadge !== undefined && schemaBadge !== null ?
|
|
712
925
|
(Array.isArray(schemaBadge) ? schemaBadge : [schemaBadge])
|
|
713
926
|
: [];
|
|
714
|
-
var cardActions = ((
|
|
927
|
+
var cardActions = ((_h = schema === null || schema === void 0 ? void 0 : schema.actions) === null || _h === void 0 ? void 0 : _h.filter(function (action) { return !!action && typeof action === 'object'; })) || [];
|
|
715
928
|
var cardTags = ((schema === null || schema === void 0 ? void 0 : schema.tags) || []);
|
|
716
929
|
var schemaIntentColor = (schema === null || schema === void 0 ? void 0 : schema.intent) ?
|
|
717
|
-
(
|
|
930
|
+
(_j = theme === null || theme === void 0 ? void 0 : theme.intents) === null || _j === void 0 ? void 0 : _j[schema.intent]
|
|
718
931
|
: undefined;
|
|
719
932
|
return ((0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledEditCard, { "data-field": optionName, className: COMPACT_SINGLE_VALUE_TYPES.has(editType) ?
|
|
720
933
|
'options-readfirst-card options-readfirst-card-single'
|
|
@@ -743,7 +956,7 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
743
956
|
return renderInjectedOptionAction(action, index);
|
|
744
957
|
}), hasValue && !readOnly ?
|
|
745
958
|
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreButton, { size: 'small', icon: 'DeleteBinLine', minimal: true, flat: true, fixed: true, intent: 'danger', className: 'options-readfirst-clear', "aria-label": 'Clear value', tooltip: 'Clear value', onClick: confirmClearValue })
|
|
746
|
-
: null, moreMenu, closeExpandedFieldButton] })] }), (0, jsx_runtime_1.jsxs)(FocusedEditing_1.FocusedEditing, { isFullscreen: focusedEditing === optionName, onClose: function () { return setFocusedEditing(undefined); }, description: (schema === null || schema === void 0 ? void 0 : schema.display_name) || optionName, children: [focusedEditing === optionName ?
|
|
959
|
+
: null, moreMenu, closeExpandedFieldButton] })] }), absorbedNodes, (0, jsx_runtime_1.jsxs)(FocusedEditing_1.FocusedEditing, { isFullscreen: focusedEditing === optionName, onClose: function () { return setFocusedEditing(undefined); }, description: (schema === null || schema === void 0 ? void 0 : schema.display_name) || optionName, children: [focusedEditing === optionName ?
|
|
747
960
|
(0, jsx_runtime_1.jsx)(Description_1.Description, { longDescription: schema === null || schema === void 0 ? void 0 : schema.desc, shortDescription: schema === null || schema === void 0 ? void 0 : schema.short_desc, longDescriptionShownByDefault: true })
|
|
748
961
|
: null, renderOption(optionName, optionField)] })] }, optionName));
|
|
749
962
|
}
|
|
@@ -757,7 +970,6 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
757
970
|
: []), true);
|
|
758
971
|
// A hash row reveals its sub-fields as read-only sub-rows under a "view
|
|
759
972
|
// more" disclosure; the row itself still expands the real editor on click.
|
|
760
|
-
var valueType = (0, readFirst_1.getValueType)(optionField, schema);
|
|
761
973
|
var hashEntries = (!hidden &&
|
|
762
974
|
(valueType === 'hash' || valueType === 'free-hash') &&
|
|
763
975
|
(schema === null || schema === void 0 ? void 0 : schema.ui_type) !== 'schema-definition') ?
|
|
@@ -772,6 +984,9 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
772
984
|
Array.isArray(optionField === null || optionField === void 0 ? void 0 : optionField.value) &&
|
|
773
985
|
optionField.value.length > 0 &&
|
|
774
986
|
optionField.value.some(function (item) {
|
|
987
|
+
if ((0, exports.richtextItemText)(item) !== undefined) {
|
|
988
|
+
return false;
|
|
989
|
+
}
|
|
775
990
|
var inner = item && typeof item === 'object' && 'value' in item ?
|
|
776
991
|
item.value
|
|
777
992
|
: item;
|
|
@@ -787,6 +1002,18 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
787
1002
|
valueType === 'code-editor' &&
|
|
788
1003
|
typeof (optionField === null || optionField === void 0 ? void 0 : optionField.value) === 'string' &&
|
|
789
1004
|
optionField.value.length > 0;
|
|
1005
|
+
// A richtext value that renders as CHIPS is drawn in full by the row itself:
|
|
1006
|
+
// the chips are the value, and the reader is looking straight at it. The
|
|
1007
|
+
// native `title` below would then hover the raw source of the very thing the
|
|
1008
|
+
// chips replace ("[$fsminput:severity] $fsminput:alert_code") — and, because
|
|
1009
|
+
// each chip carries its own Reqore tooltip, hovering one fires BOTH: the chip
|
|
1010
|
+
// popover and the row's browser tooltip, in different places, saying almost
|
|
1011
|
+
// the same thing. Only the popover shows up in a screenshot, which is what
|
|
1012
|
+
// made the pair hard to report.
|
|
1013
|
+
var showsTemplateChips = !hidden &&
|
|
1014
|
+
valueType === 'richtext' &&
|
|
1015
|
+
Array.isArray(optionField === null || optionField === void 0 ? void 0 : optionField.value) &&
|
|
1016
|
+
(0, common_1.richtextToSegments)(optionField.value).some(function (segment) { return segment.kind === 'tag'; });
|
|
790
1017
|
// Markdown reads the same way for the same reason: the row itself can only
|
|
791
1018
|
// show a line of text, and for markdown that line is the SOURCE — the reader
|
|
792
1019
|
// gets `## ` and `**` where the point of the value is what it looks like
|
|
@@ -820,32 +1047,42 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
820
1047
|
var typeLabel = showFieldTypes ?
|
|
821
1048
|
"<".concat((schema === null || schema === void 0 ? void 0 : schema.ui_type) || (schema === null || schema === void 0 ? void 0 : schema.type) || 'auto').concat((schema === null || schema === void 0 ? void 0 : schema.ui_element_type) ? "[".concat(schema.ui_element_type, "]") : '', ">")
|
|
822
1049
|
: null;
|
|
823
|
-
//
|
|
824
|
-
//
|
|
1050
|
+
// A `readonly` field is one the system owns — an assigned id, a recorded
|
|
1051
|
+
// provenance. The server states that on the field itself; only the older
|
|
1052
|
+
// compat projection also mapped it to `disabled`, so on this path the form
|
|
1053
|
+
// was handed `readonly` alone and rendered an editable control for a value
|
|
1054
|
+
// no answer of the user's can change.
|
|
1055
|
+
var fieldReadonly = !!(schema === null || schema === void 0 ? void 0 : schema.readonly);
|
|
1056
|
+
// Disabled rows (schema flag, readonly, or unmet deps) can't open — a lock +
|
|
1057
|
+
// reason renders instead. Form-level readOnly still opens in view mode (Close).
|
|
825
1058
|
var fieldDisabled = !hidden &&
|
|
826
1059
|
!readOnly &&
|
|
827
1060
|
(!!(schema === null || schema === void 0 ? void 0 : schema.disabled) ||
|
|
1061
|
+
fieldReadonly ||
|
|
828
1062
|
!(0, validations_1.hasAllDependenciesFullfilled)(schema === null || schema === void 0 ? void 0 : schema.depends_on, availableOptions, options || {}));
|
|
829
|
-
var fieldDisabledReason = (schema === null || schema === void 0 ? void 0 : schema.disabled) ? 'This field is disabled'
|
|
1063
|
+
var fieldDisabledReason = (schema === null || schema === void 0 ? void 0 : schema.disabled) ? 'This field is disabled'
|
|
1064
|
+
: fieldReadonly ? 'Set by Qorus — not editable'
|
|
1065
|
+
: 'Disabled — dependencies are not fulfilled';
|
|
830
1066
|
// Dependency contract: top-level entries must ALL hold; a nested array
|
|
831
|
-
// means ANY of its entries; `name=value` requires that exact value
|
|
832
|
-
|
|
1067
|
+
// means ANY of its entries; `name=value` requires that exact value, and
|
|
1068
|
+
// `name!=value` requires any other answer. Parsed by the same helper the
|
|
1069
|
+
// predicate uses, so the lock cannot describe a rule the form does not apply.
|
|
1070
|
+
var dependencyEntries = fieldDisabled && !(schema === null || schema === void 0 ? void 0 : schema.disabled) && !fieldReadonly ?
|
|
833
1071
|
((schema === null || schema === void 0 ? void 0 : schema.depends_on) || [])
|
|
834
1072
|
: [];
|
|
835
1073
|
var describeDependency = function (dep) {
|
|
836
1074
|
var _a, _b;
|
|
837
|
-
var
|
|
838
|
-
var depName = eqIndex === -1 ? dep : dep.slice(0, eqIndex);
|
|
839
|
-
var expected = eqIndex === -1 ? undefined : dep.slice(eqIndex + 1);
|
|
1075
|
+
var _c = (0, validations_1.parseDependency)(dep), depName = _c.name, op = _c.op, expected = _c.value;
|
|
840
1076
|
var depLabel = ((_a = options === null || options === void 0 ? void 0 : options[depName]) === null || _a === void 0 ? void 0 : _a.display_name) || depName;
|
|
841
1077
|
var depValue = (_b = availableOptions === null || availableOptions === void 0 ? void 0 : availableOptions[depName]) === null || _b === void 0 ? void 0 : _b.value;
|
|
842
1078
|
return {
|
|
843
1079
|
name: depName,
|
|
844
1080
|
exists: !!(options === null || options === void 0 ? void 0 : options[depName]),
|
|
845
|
-
label:
|
|
846
|
-
fulfilled:
|
|
847
|
-
|
|
848
|
-
|
|
1081
|
+
label: !op ? depLabel : "".concat(depLabel, " ").concat(op === '=' ? '=' : '≠', " ").concat(expected),
|
|
1082
|
+
fulfilled: !op ? !(0, readFirst_1.isOptionValueEmpty)(depValue)
|
|
1083
|
+
: depValue == null ? false
|
|
1084
|
+
: op === '=' ? String(depValue) === expected
|
|
1085
|
+
: String(depValue) !== expected,
|
|
849
1086
|
};
|
|
850
1087
|
};
|
|
851
1088
|
var depHighlightNames = (0, flatten_1.default)(dependencyEntries)
|
|
@@ -895,7 +1132,7 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
895
1132
|
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: schema === null || schema === void 0 ? void 0 : schema.icon, image: schema === null || schema === void 0 ? void 0 : schema.image, size: '14px', className: 'options-readfirst-row-icon' })
|
|
896
1133
|
: null;
|
|
897
1134
|
var rowSchemaIntentColor = (schema === null || schema === void 0 ? void 0 : schema.intent) ?
|
|
898
|
-
(
|
|
1135
|
+
(_k = theme === null || theme === void 0 ? void 0 : theme.intents) === null || _k === void 0 ? void 0 : _k[schema.intent]
|
|
899
1136
|
: undefined;
|
|
900
1137
|
var rowStripeColor = (showStripe ? intentColor : undefined) || rowSchemaIntentColor;
|
|
901
1138
|
// Intent stripe on the block ROOT so it spans the field's whole territory:
|
|
@@ -910,7 +1147,7 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
910
1147
|
// boxes — so the dot and the box can never disagree). Hidden (not-yet-added)
|
|
911
1148
|
// and dependency-locked rows show no dot (the add/lock affordance speaks for
|
|
912
1149
|
// them). worstIntent already folds in schema + validation messages.
|
|
913
|
-
var cSuccess = (
|
|
1150
|
+
var cSuccess = (_l = theme === null || theme === void 0 ? void 0 : theme.intents) === null || _l === void 0 ? void 0 : _l.success;
|
|
914
1151
|
var rowStatus = (0, readFirst_1.getReadFirstStatus)({
|
|
915
1152
|
empty: empty,
|
|
916
1153
|
required: required,
|
|
@@ -928,34 +1165,39 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
928
1165
|
event.preventDefault();
|
|
929
1166
|
activate(event);
|
|
930
1167
|
}
|
|
931
|
-
} }, clusterHoverProps, { children: [clusterNode, (0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledLabelBlock, { children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledRowLabel, { title: (schema === null || schema === void 0 ? void 0 : schema.short_desc) || undefined, "$color": cKey, children: [rowChromeIcon, (0, jsx_runtime_1.jsxs)("span", { className: 'options-readfirst-label-text', style: { minWidth: 0 }, children: [label, required ?
|
|
1168
|
+
} }, clusterHoverProps, { children: [clusterNode, (0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledLabelBlock, { className: 'options-readfirst-label-block', children: [(0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledRowLabel, { title: (schema === null || schema === void 0 ? void 0 : schema.short_desc) || undefined, "$color": cKey, children: [rowChromeIcon, (0, jsx_runtime_1.jsxs)("span", { className: 'options-readfirst-label-text', style: { minWidth: 0 }, children: [label, required ?
|
|
932
1169
|
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: 'Asterisk', color: 'danger', size: '10px', margin: 'left', marginSize: 'tiny' })
|
|
933
1170
|
: null, helpIcon] }), typeLabel ?
|
|
934
1171
|
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { size: 'tiny', minimal: true, label: typeLabel, labelEffect: { opacity: 0.55 } })
|
|
935
1172
|
: null] }), showLabelDesc ?
|
|
936
1173
|
(0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledLabelDesc, { className: 'options-readfirst-label-desc', size: 'small', effect: { opacity: 0.55 }, children: labelShortDesc })
|
|
937
|
-
: null, lineCountNote ?
|
|
1174
|
+
: null, codeSizeNode, lineCountNote ?
|
|
938
1175
|
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreP, { className: 'options-readfirst-label-lines', size: 'tiny', effect: { opacity: 0.45, textAlign: 'left' }, style: { fontFamily: 'monospace' }, children: lineCountNote })
|
|
939
1176
|
: null] }), (0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledRowValue
|
|
940
1177
|
// A code field draws its whole value in the preview below, with
|
|
941
1178
|
// "Show more" for the rest, so a hover carrying the same text is
|
|
942
1179
|
// noise -- and a native tooltip holding a few hundred lines is
|
|
943
|
-
// unreadable anyway.
|
|
944
|
-
//
|
|
1180
|
+
// unreadable anyway. A chipped richtext value is the same case: the row
|
|
1181
|
+
// already draws it in full, and its chips carry their own tooltips.
|
|
1182
|
+
// Every other value keeps its hover, which is the only way to read one
|
|
1183
|
+
// that the row had to truncate.
|
|
945
1184
|
, {
|
|
946
1185
|
// A code field draws its whole value in the preview below, with
|
|
947
1186
|
// "Show more" for the rest, so a hover carrying the same text is
|
|
948
1187
|
// noise -- and a native tooltip holding a few hundred lines is
|
|
949
|
-
// unreadable anyway.
|
|
950
|
-
//
|
|
1188
|
+
// unreadable anyway. A chipped richtext value is the same case: the row
|
|
1189
|
+
// already draws it in full, and its chips carry their own tooltips.
|
|
1190
|
+
// Every other value keeps its hover, which is the only way to read one
|
|
1191
|
+
// that the row had to truncate.
|
|
951
1192
|
title: (!empty &&
|
|
952
1193
|
!hidden &&
|
|
953
1194
|
!showCodePreview &&
|
|
954
1195
|
!showMarkdownPreview &&
|
|
1196
|
+
!showsTemplateChips &&
|
|
955
1197
|
typeof formatted === 'string') ?
|
|
956
1198
|
formatted
|
|
957
|
-
: undefined, "$color": empty || hidden ? "".concat(cMuted, "66") : cKey, "$empty": empty || hidden, children: [showMarkdownPreview || previewWithSchema ? null : ((0, jsx_runtime_1.jsx)("span", { className: 'options-readfirst-valuetext', children: hidden || empty ? '—' : renderReadFirstValue(optionField, schema, formatted) })), valueReasons.map(function (m, i) { return ((0, jsx_runtime_1.jsx)("span", { className: 'options-readfirst-reason', style: { color: reasonColor(m.intent) }, children: m.content }, "".concat(m.content, "-").concat(i))); }), panelMessages.length ?
|
|
958
|
-
(0, jsx_runtime_1.jsx)(
|
|
1199
|
+
: undefined, "$color": empty || hidden ? "".concat(cMuted, "66") : cKey, "$empty": empty || hidden, children: [showMarkdownPreview || (previewWithSchema && showStructuredPreview) ? null : ((0, jsx_runtime_1.jsx)("span", { className: 'options-readfirst-valuetext', children: hidden || empty ? '—' : renderReadFirstValue(optionField, schema, formatted) })), valueReasons.map(function (m, i) { return ((0, jsx_runtime_1.jsx)("span", { className: 'options-readfirst-reason', style: { color: reasonColor(m.intent) }, children: m.content }, "".concat(m.content, "-").concat(i))); }), panelMessages.length ?
|
|
1200
|
+
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreControlGroup, { className: 'options-readfirst-info-panel', vertical: true, fluid: true, gapSize: 'normal', children: panelMessages.map(renderInfoStrip) })
|
|
959
1201
|
: null, showStructuredPreview ?
|
|
960
1202
|
// The inset lives inside the row now, so a click on a value chip would
|
|
961
1203
|
// bubble to the row's onClick and fire activate() a SECOND time (the
|
|
@@ -998,7 +1240,7 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
998
1240
|
// consumer that registers nothing — the heading is
|
|
999
1241
|
// accented either way, just in the theme's own colour
|
|
1000
1242
|
// rather than one this library picked.
|
|
1001
|
-
accent: ((
|
|
1243
|
+
accent: ((_m = theme === null || theme === void 0 ? void 0 : theme.intents) === null || _m === void 0 ? void 0 : _m.custom1) || cInfo,
|
|
1002
1244
|
}, onItemClick: function () { return activate(); } })
|
|
1003
1245
|
: (0, jsx_runtime_1.jsx)(StructuredDataView_1.StructuredDataView, { value: optionField === null || optionField === void 0 ? void 0 : optionField.value, collapsibleRoot: false, showTypes: showFieldTypes, defaultExpandDepth: 2, onItemClick: function () { return activate(); } }) }) }) })
|
|
1004
1246
|
: null, showCodePreview ?
|