@qoretechnologies/reqraft 0.10.36 → 0.10.37-pr.95.g4e65c57
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/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 +6 -1
- package/dist/components/form/engine/CompactRow.d.ts.map +1 -1
- package/dist/components/form/engine/CompactRow.js +259 -19
- package/dist/components/form/engine/CompactRow.js.map +1 -1
- package/dist/components/form/engine/FormEngine.d.ts +20 -0
- package/dist/components/form/engine/FormEngine.d.ts.map +1 -1
- package/dist/components/form/engine/FormEngine.js +137 -24
- package/dist/components/form/engine/FormEngine.js.map +1 -1
- package/dist/components/form/engine/_structuredData/SchemaDataView.d.ts +37 -0
- package/dist/components/form/engine/_structuredData/SchemaDataView.d.ts.map +1 -0
- package/dist/components/form/engine/_structuredData/SchemaDataView.js +307 -0
- package/dist/components/form/engine/_structuredData/SchemaDataView.js.map +1 -0
- package/dist/components/form/engine/compactRowStyles.d.ts +13 -0
- package/dist/components/form/engine/compactRowStyles.d.ts.map +1 -1
- package/dist/components/form/engine/compactRowStyles.js +30 -5
- package/dist/components/form/engine/compactRowStyles.js.map +1 -1
- package/dist/components/form/engine/readFirst.d.ts +66 -1
- package/dist/components/form/engine/readFirst.d.ts.map +1 -1
- package/dist/components/form/engine/readFirst.js +175 -5
- package/dist/components/form/engine/readFirst.js.map +1 -1
- package/dist/components/form/fields/array/ArrayAuto.d.ts.map +1 -1
- package/dist/components/form/fields/array/ArrayAuto.js +51 -21
- 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 +4 -0
- package/dist/components/form/fields/auto/AutoFormField.d.ts.map +1 -1
- package/dist/components/form/fields/auto/AutoFormField.js +8 -1
- package/dist/components/form/fields/auto/AutoFormField.js.map +1 -1
- package/dist/helpers/validations.d.ts +14 -0
- package/dist/helpers/validations.d.ts.map +1 -1
- package/dist/helpers/validations.js +58 -3
- package/dist/helpers/validations.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- 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 +313 -24
- package/src/components/form/engine/FormEngine.stories.tsx +487 -14
- package/src/components/form/engine/FormEngine.tsx +142 -8
- package/src/components/form/engine/_structuredData/SchemaDataView.stories.tsx +129 -0
- package/src/components/form/engine/_structuredData/SchemaDataView.tsx +594 -0
- package/src/components/form/engine/compactRowStyles.ts +44 -2
- package/src/components/form/engine/readFirst.ts +201 -5
- package/src/components/form/fields/array/ArrayAuto.tsx +35 -4
- package/src/components/form/fields/array/ArrayAutoField.stories.tsx +53 -0
- package/src/components/form/fields/array/ArrayAutoField.tsx +22 -4
- package/src/components/form/fields/auto/AutoFormField.tsx +11 -0
- package/src/helpers/validations.ts +59 -2
- package/src/index.tsx +1 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IReqoreTagProps } from '@qoretechnologies/reqore/dist/components/Tag';
|
|
3
|
+
export interface IReqraftCodeSize {
|
|
4
|
+
/** Number of lines, counting a trailing newline's empty last line. */
|
|
5
|
+
lines: number;
|
|
6
|
+
/** Number of characters (UTF-16 code units, as `String.length` reports). */
|
|
7
|
+
chars: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Measure a block of code. Split out from the tag so the numbers can be
|
|
11
|
+
* asserted without rendering, and reused by callers that want to phrase the
|
|
12
|
+
* size themselves.
|
|
13
|
+
*
|
|
14
|
+
* An empty string is one line of zero characters, which is what an editor
|
|
15
|
+
* showing it displays — not zero lines.
|
|
16
|
+
*/
|
|
17
|
+
export declare function describeCodeSize(code: string): IReqraftCodeSize;
|
|
18
|
+
/** `4 lines` / `1 line` — the label half of the chip. */
|
|
19
|
+
export declare function formatCodeLines(lines: number): string;
|
|
20
|
+
/** `92 chars` / `1 char` — the key half of the chip. */
|
|
21
|
+
export declare function formatCodeChars(chars: number): string;
|
|
22
|
+
/**
|
|
23
|
+
* The chip as plain `ReqoreTag` props. Needed wherever a host takes tag
|
|
24
|
+
* *props* rather than an element — a `ReqorePanel` `badge`, a button badge —
|
|
25
|
+
* which is most of Reqore's badge surface.
|
|
26
|
+
*/
|
|
27
|
+
export declare function codeSizeTagProps(code: string): IReqoreTagProps;
|
|
28
|
+
export interface IReqraftCodeSizeTagProps extends Omit<IReqoreTagProps, 'label' | 'labelKey'> {
|
|
29
|
+
/** The code being summarised. */
|
|
30
|
+
code: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* `N chars | N lines` chip summarising a block of source. Every prop of
|
|
34
|
+
* `ReqoreTag` passes through except the two labels, which are the point.
|
|
35
|
+
*/
|
|
36
|
+
export declare const ReqraftCodeSizeTag: import("react").MemoExoticComponent<({ code, ...rest }: IReqraftCodeSizeTagProps) => import("react/jsx-runtime").JSX.Element>;
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/codeSize/index.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAG/E,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAE/D;AAED,yDAAyD;AACzD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wDAAwD;AACxD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAW9D;AAED,MAAM,WAAW,wBACf,SAAQ,IAAI,CAAC,eAAe,EAAE,OAAO,GAAG,UAAU,CAAC;IACnD,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,0DACT,wBAAwB,6CAK7C,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.ReqraftCodeSizeTag = exports.codeSizeTagProps = exports.formatCodeChars = exports.formatCodeLines = exports.describeCodeSize = void 0;
|
|
26
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
|
+
// Copyright 2026 Qore Technologies, s.r.o.
|
|
28
|
+
// How much code is there? — the one answer, rendered one way.
|
|
29
|
+
//
|
|
30
|
+
// A read-only view of source has to say something about the code it is not
|
|
31
|
+
// showing in full: how many lines, how much text. The compact form engine
|
|
32
|
+
// grew that chip first (a `code-editor` value's read summary); detail pages
|
|
33
|
+
// outside the form engine want the identical affordance. It lives here so
|
|
34
|
+
// there is one renderer rather than one per caller, each drifting in
|
|
35
|
+
// pluralisation, icon and intent.
|
|
36
|
+
var reqore_1 = require("@qoretechnologies/reqore");
|
|
37
|
+
var react_1 = require("react");
|
|
38
|
+
/**
|
|
39
|
+
* Measure a block of code. Split out from the tag so the numbers can be
|
|
40
|
+
* asserted without rendering, and reused by callers that want to phrase the
|
|
41
|
+
* size themselves.
|
|
42
|
+
*
|
|
43
|
+
* An empty string is one line of zero characters, which is what an editor
|
|
44
|
+
* showing it displays — not zero lines.
|
|
45
|
+
*/
|
|
46
|
+
function describeCodeSize(code) {
|
|
47
|
+
return { lines: code.split('\n').length, chars: code.length };
|
|
48
|
+
}
|
|
49
|
+
exports.describeCodeSize = describeCodeSize;
|
|
50
|
+
/** `4 lines` / `1 line` — the label half of the chip. */
|
|
51
|
+
function formatCodeLines(lines) {
|
|
52
|
+
return "".concat(lines, " ").concat(lines === 1 ? 'line' : 'lines');
|
|
53
|
+
}
|
|
54
|
+
exports.formatCodeLines = formatCodeLines;
|
|
55
|
+
/** `92 chars` / `1 char` — the key half of the chip. */
|
|
56
|
+
function formatCodeChars(chars) {
|
|
57
|
+
return "".concat(chars, " ").concat(chars === 1 ? 'char' : 'chars');
|
|
58
|
+
}
|
|
59
|
+
exports.formatCodeChars = formatCodeChars;
|
|
60
|
+
/**
|
|
61
|
+
* The chip as plain `ReqoreTag` props. Needed wherever a host takes tag
|
|
62
|
+
* *props* rather than an element — a `ReqorePanel` `badge`, a button badge —
|
|
63
|
+
* which is most of Reqore's badge surface.
|
|
64
|
+
*/
|
|
65
|
+
function codeSizeTagProps(code) {
|
|
66
|
+
var _a = describeCodeSize(code), lines = _a.lines, chars = _a.chars;
|
|
67
|
+
return {
|
|
68
|
+
size: 'small',
|
|
69
|
+
minimal: true,
|
|
70
|
+
intent: 'info',
|
|
71
|
+
icon: 'CodeLine',
|
|
72
|
+
label: formatCodeLines(lines),
|
|
73
|
+
labelKey: formatCodeChars(chars),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
exports.codeSizeTagProps = codeSizeTagProps;
|
|
77
|
+
/**
|
|
78
|
+
* `N chars | N lines` chip summarising a block of source. Every prop of
|
|
79
|
+
* `ReqoreTag` passes through except the two labels, which are the point.
|
|
80
|
+
*/
|
|
81
|
+
exports.ReqraftCodeSizeTag = (0, react_1.memo)(function (_a) {
|
|
82
|
+
var code = _a.code, rest = __rest(_a, ["code"]);
|
|
83
|
+
var _b = codeSizeTagProps(code), label = _b.label, labelKey = _b.labelKey, defaults = __rest(_b, ["label", "labelKey"]);
|
|
84
|
+
return (0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, __assign({}, defaults, rest, { label: label, labelKey: labelKey }));
|
|
85
|
+
});
|
|
86
|
+
exports.ReqraftCodeSizeTag.displayName = 'ReqraftCodeSizeTag';
|
|
87
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/codeSize/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA2C;AAC3C,8DAA8D;AAC9D,EAAE;AACF,2EAA2E;AAC3E,0EAA0E;AAC1E,4EAA4E;AAC5E,0EAA0E;AAC1E,qEAAqE;AACrE,kCAAkC;AAElC,mDAAqD;AAErD,+BAA6B;AAS7B;;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAAC,IAAY;IAC3C,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;AAChE,CAAC;AAFD,4CAEC;AAED,yDAAyD;AACzD,SAAgB,eAAe,CAAC,KAAa;IAC3C,OAAO,UAAG,KAAK,cAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAE,CAAC;AACtD,CAAC;AAFD,0CAEC;AAED,wDAAwD;AACxD,SAAgB,eAAe,CAAC,KAAa;IAC3C,OAAO,UAAG,KAAK,cAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAE,CAAC;AACtD,CAAC;AAFD,0CAEC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,IAAY;IACrC,IAAA,KAAmB,gBAAgB,CAAC,IAAI,CAAC,EAAvC,KAAK,WAAA,EAAE,KAAK,WAA2B,CAAC;IAEhD,OAAO;QACL,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC;QAC7B,QAAQ,EAAE,eAAe,CAAC,KAAK,CAAC;KACjC,CAAC;AACJ,CAAC;AAXD,4CAWC;AAQD;;;GAGG;AACU,QAAA,kBAAkB,GAAG,IAAA,YAAI,EACpC,UAAC,EAA2C;IAAzC,IAAA,IAAI,UAAA,EAAK,IAAI,cAAf,QAAiB,CAAF;IACd,IAAM,KAAmC,gBAAgB,CAAC,IAAI,CAAC,EAAvD,KAAK,WAAA,EAAE,QAAQ,cAAA,EAAK,QAAQ,cAA9B,qBAAgC,CAAyB,CAAC;IAEhE,OAAO,uBAAC,kBAAS,eAAK,QAAQ,EAAM,IAAI,IAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,IAAI,CAAC;AACjF,CAAC,CACF,CAAC;AACF,0BAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAC"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { IQorusFormField } from '@qoretechnologies/ts-toolkit';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
export declare const CompactRow: React.MemoExoticComponent<({ optionName, optionField, hidden, clustered, clusterFirst, clusterLast, }: {
|
|
3
|
+
export declare const CompactRow: React.MemoExoticComponent<({ optionName, optionField, hidden, clustered, clusterFirst, clusterLast, absorbedFields, }: {
|
|
4
4
|
optionName: string;
|
|
5
5
|
optionField: IQorusFormField;
|
|
6
6
|
hidden?: boolean;
|
|
7
|
+
/** Siblings this row renders inside its own container instead of leaving
|
|
8
|
+
* them a row each — declared by the schema's `absorb_fields`. The pair it
|
|
9
|
+
* exists for is a code editor and its language: one decision, so one
|
|
10
|
+
* element. */
|
|
11
|
+
absorbedFields?: string[];
|
|
7
12
|
clustered?: boolean;
|
|
8
13
|
clusterFirst?: boolean;
|
|
9
14
|
clusterLast?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompactRow.d.ts","sourceRoot":"","sources":["../../../../src/components/form/engine/CompactRow.tsx"],"names":[],"mappings":"AAcA,OAAO,
|
|
1
|
+
{"version":3,"file":"CompactRow.d.ts","sourceRoot":"","sources":["../../../../src/components/form/engine/CompactRow.tsx"],"names":[],"mappings":"AAcA,OAAO,EACL,eAAe,EAIhB,MAAM,8BAA8B,CAAC;AAItC,OAAO,KAAe,MAAM,OAAO,CAAC;AAqHpC,eAAO,MAAM,UAAU,yHASlB;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,eAAe,CAAC;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;mBAGe;IACf,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAI1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,6CAivDF,CAAC"}
|
|
@@ -33,6 +33,42 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
33
33
|
__setModuleDefault(result, mod);
|
|
34
34
|
return result;
|
|
35
35
|
};
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
47
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
|
+
function step(op) {
|
|
50
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
51
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
52
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
53
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
|
+
switch (op[0]) {
|
|
55
|
+
case 0: case 1: t = op; break;
|
|
56
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
57
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
58
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
59
|
+
default:
|
|
60
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
61
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
62
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
63
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
64
|
+
if (t[2]) _.ops.pop();
|
|
65
|
+
_.trys.pop(); continue;
|
|
66
|
+
}
|
|
67
|
+
op = body.call(thisArg, _);
|
|
68
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
69
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
|
+
}
|
|
71
|
+
};
|
|
36
72
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
37
73
|
var t = {};
|
|
38
74
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -62,6 +98,7 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
62
98
|
var reqore_1 = require("@qoretechnologies/reqore");
|
|
63
99
|
var optionActions_1 = require("./optionActions");
|
|
64
100
|
var flatten_1 = __importDefault(require("lodash/flatten"));
|
|
101
|
+
var isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
65
102
|
var size_1 = __importDefault(require("lodash/size"));
|
|
66
103
|
var react_1 = __importStar(require("react"));
|
|
67
104
|
var use_context_selector_1 = require("use-context-selector");
|
|
@@ -69,12 +106,15 @@ var validations_1 = require("../../../helpers/validations");
|
|
|
69
106
|
var templates_1 = require("../../../helpers/templates");
|
|
70
107
|
var common_1 = require("../../../helpers/common");
|
|
71
108
|
var ReadOnlyTemplateTag_1 = require("../fields/template/ReadOnlyTemplateTag");
|
|
109
|
+
var codeSize_1 = require("../../codeSize");
|
|
72
110
|
var Description_1 = require("../../Description");
|
|
73
111
|
var markdownRendererContext_1 = require("../../Description/markdownRendererContext");
|
|
74
112
|
var FocusedEditing_1 = require("../../FocusedEditing");
|
|
75
113
|
var compactRowContext_1 = require("./compactRowContext");
|
|
76
114
|
var compactRowStyles_1 = require("./compactRowStyles");
|
|
77
115
|
var OptionFieldMessages_1 = require("./OptionFieldMessages");
|
|
116
|
+
var SchemaDataView_1 = require("./_structuredData/SchemaDataView");
|
|
117
|
+
var fetch_1 = require("../../../utils/fetch");
|
|
78
118
|
var readFirst_1 = require("./readFirst");
|
|
79
119
|
var StructuredDataView_1 = require("./_structuredData/StructuredDataView");
|
|
80
120
|
/**
|
|
@@ -140,11 +180,19 @@ var MAX_INLINE_OPTION_ACTIONS = 2;
|
|
|
140
180
|
// activating the row adds the field first.
|
|
141
181
|
exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
142
182
|
var _b;
|
|
143
|
-
var _c, _d, _e, _f, _g, _h, _j;
|
|
144
|
-
var optionName = _a.optionName, optionField = _a.optionField,
|
|
183
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
184
|
+
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;
|
|
145
185
|
var readOnly = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.readOnly; });
|
|
146
186
|
var commitMode = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.commitMode; });
|
|
147
187
|
var options = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.options; });
|
|
188
|
+
// An absorbed field keeps its own name — it is a different field, not a
|
|
189
|
+
// property of its host — so the label comes from its schema exactly as it
|
|
190
|
+
// would on its own row.
|
|
191
|
+
var getAbsorbedLabel = function (absorbedName) {
|
|
192
|
+
var _a;
|
|
193
|
+
return ((_a = options === null || options === void 0 ? void 0 : options[absorbedName]) === null || _a === void 0 ? void 0 : _a.display_name) ||
|
|
194
|
+
absorbedName;
|
|
195
|
+
};
|
|
148
196
|
var codePreviewRenderer = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.codePreviewRenderer; });
|
|
149
197
|
var markdownRenderer = (0, markdownRendererContext_1.useMarkdownRenderer)();
|
|
150
198
|
var operators = (0, use_context_selector_1.useContextSelector)(compactRowContext_1.CompactRowContext, function (v) { return v.operators; });
|
|
@@ -229,9 +277,18 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
229
277
|
// see `showCodePreview` below. Keeps the row height fixed while making
|
|
230
278
|
// multi-line source readable without opening the full editor.
|
|
231
279
|
if (valueType === 'code-editor' && typeof (field === null || field === void 0 ? void 0 : field.value) === 'string') {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
280
|
+
// An absorbed sibling has no row of its own, so a COLLAPSED host has to
|
|
281
|
+
// carry its value or it disappears from the form entirely when closed.
|
|
282
|
+
// It reads as a chip beside the size chip — "Qore · 62 lines" — which
|
|
283
|
+
// is the same summary the read-only interface pages already show.
|
|
284
|
+
return ((0, jsx_runtime_1.jsxs)(reqore_1.ReqoreControlGroup, { gapSize: 'tiny', verticalAlign: 'center', wrap: true, children: [(absorbedFields !== null && absorbedFields !== void 0 ? absorbedFields : []).map(function (absorbedName) {
|
|
285
|
+
var _a;
|
|
286
|
+
var absorbedValue = (_a = availableOptions === null || availableOptions === void 0 ? void 0 : availableOptions[absorbedName]) === null || _a === void 0 ? void 0 : _a.value;
|
|
287
|
+
if (absorbedValue === undefined || absorbedValue === null || absorbedValue === '') {
|
|
288
|
+
return null;
|
|
289
|
+
}
|
|
290
|
+
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));
|
|
291
|
+
}), (0, jsx_runtime_1.jsx)(codeSize_1.ReqraftCodeSizeTag, { code: field.value })] }));
|
|
235
292
|
}
|
|
236
293
|
// Markdown read summary: the row prints the value's prose (the markdown
|
|
237
294
|
// markers are stripped by `formatOptionValue`), so a multi-line document
|
|
@@ -306,14 +363,14 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
306
363
|
// hover-gated button is unreachable without a hover — and anything past the
|
|
307
364
|
// inline cap overflows regardless, so a consumer injecting ten actions can
|
|
308
365
|
// never push the row's value out of view.
|
|
309
|
-
var
|
|
366
|
+
var _s = react_1.default.useMemo(function () {
|
|
310
367
|
return collapseOptionActions ?
|
|
311
368
|
[[], injectedOptionActions]
|
|
312
369
|
: [
|
|
313
370
|
injectedOptionActions.slice(0, MAX_INLINE_OPTION_ACTIONS),
|
|
314
371
|
injectedOptionActions.slice(MAX_INLINE_OPTION_ACTIONS),
|
|
315
372
|
];
|
|
316
|
-
}, [collapseOptionActions, injectedOptionActions]), inlineOptionActions =
|
|
373
|
+
}, [collapseOptionActions, injectedOptionActions]), inlineOptionActions = _s[0], menuOptionActions = _s[1];
|
|
317
374
|
var injectedOptionActionMenuItems = react_1.default.useMemo(function () {
|
|
318
375
|
return menuOptionActions.map(function (action, index) {
|
|
319
376
|
var _a, _b;
|
|
@@ -424,6 +481,103 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
424
481
|
}, 60);
|
|
425
482
|
return function () { return window.clearTimeout(id); };
|
|
426
483
|
}, [isExpanded, optionName, autoFocusNameRef]);
|
|
484
|
+
// What the field held when it was opened — the baseline Cancel restores.
|
|
485
|
+
//
|
|
486
|
+
// Deliberately NOT `originalValue`, which is the whole form's load-time
|
|
487
|
+
// snapshot. That answers "undo every change ever made to this field", which
|
|
488
|
+
// is a different question from "forget what I just typed"; a Cancel sitting
|
|
489
|
+
// next to Done has to mean the second one, or it silently throws away edits
|
|
490
|
+
// the user made earlier and had already accepted.
|
|
491
|
+
//
|
|
492
|
+
// The dependency list is `isExpanded` alone on purpose: adding the value
|
|
493
|
+
// would re-take the snapshot on every keystroke, leaving nothing to cancel.
|
|
494
|
+
var editEntryValue = react_1.default.useRef(undefined);
|
|
495
|
+
react_1.default.useEffect(function () {
|
|
496
|
+
if (isExpanded) {
|
|
497
|
+
editEntryValue.current = { value: optionField === null || optionField === void 0 ? void 0 : optionField.value, type: optionField === null || optionField === void 0 ? void 0 : optionField.type };
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
editEntryValue.current = undefined;
|
|
501
|
+
}
|
|
502
|
+
}, [isExpanded]);
|
|
503
|
+
// True while the open editor holds something other than what it opened with.
|
|
504
|
+
var editedSinceOpened = isExpanded &&
|
|
505
|
+
!!editEntryValue.current &&
|
|
506
|
+
!(0, isEqual_1.default)(editEntryValue.current.value, optionField === null || optionField === void 0 ? void 0 : optionField.value);
|
|
507
|
+
// Discard whatever was typed since the field was opened and close it. Used
|
|
508
|
+
// by both the Cancel button and Escape, so the two cannot diverge.
|
|
509
|
+
var cancelEdit = react_1.default.useCallback(function () {
|
|
510
|
+
var snapshot = editEntryValue.current;
|
|
511
|
+
if (snapshot && !(0, isEqual_1.default)(snapshot.value, optionField === null || optionField === void 0 ? void 0 : optionField.value)) {
|
|
512
|
+
handleValueChange(optionName, snapshot.value, snapshot.type);
|
|
513
|
+
}
|
|
514
|
+
toggleExpandedOption(optionName);
|
|
515
|
+
}, [handleValueChange, optionField === null || optionField === void 0 ? void 0 : optionField.value, optionName, toggleExpandedOption]);
|
|
516
|
+
// The sub-schema describing this field's value, when it has one. A value the
|
|
517
|
+
// form knows the shape of is previewed THROUGH that shape (see
|
|
518
|
+
// `SchemaDataView`); only genuinely undescribed data falls through to the
|
|
519
|
+
// untyped data tree.
|
|
520
|
+
//
|
|
521
|
+
// The server does NOT inline that sub-schema. `encodeFieldsForUi()` registers
|
|
522
|
+
// it and sends an id string in its place, which the consumer fetches back —
|
|
523
|
+
// exactly what AutoFormField does to build the editor ("Some arg schemas are
|
|
524
|
+
// not provided as objects, but as strings so we need to fetch them"). A
|
|
525
|
+
// preview that understood only the inline object therefore fell through to
|
|
526
|
+
// the untyped tree for every field a real server describes: the schema view
|
|
527
|
+
// worked against hand-written story fixtures and nowhere else.
|
|
528
|
+
//
|
|
529
|
+
// Resolved here rather than beside the preview it feeds: the preview renders
|
|
530
|
+
// below an early return, so a hook placed there would run conditionally.
|
|
531
|
+
var rawArgSchema = schema === null || schema === void 0 ? void 0 : schema.arg_schema;
|
|
532
|
+
var argSchemaId = typeof rawArgSchema === 'string' ? rawArgSchema : undefined;
|
|
533
|
+
var _t = react_1.default.useState(undefined), resolvedArgSchema = _t[0], setResolvedArgSchema = _t[1];
|
|
534
|
+
// Only worth a request when there is a described value to preview: a row whose
|
|
535
|
+
// value is unset or scalar renders no inset, so fetching its schema would buy
|
|
536
|
+
// a round trip per row and show nothing. `query` caches GETs, so rows sharing
|
|
537
|
+
// an id (every row of one list) cost one request between them.
|
|
538
|
+
var valueLooksStructured = !!(optionField === null || optionField === void 0 ? void 0 : optionField.value) && typeof optionField.value === 'object';
|
|
539
|
+
react_1.default.useEffect(function () {
|
|
540
|
+
if (!argSchemaId || !valueLooksStructured) {
|
|
541
|
+
return undefined;
|
|
542
|
+
}
|
|
543
|
+
var cancelled = false;
|
|
544
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
545
|
+
var response;
|
|
546
|
+
return __generator(this, function (_a) {
|
|
547
|
+
switch (_a.label) {
|
|
548
|
+
case 0: return [4 /*yield*/, (0, fetch_1.query)({
|
|
549
|
+
url: "dataprovider/arg_schemas/".concat(argSchemaId),
|
|
550
|
+
method: 'GET',
|
|
551
|
+
})];
|
|
552
|
+
case 1:
|
|
553
|
+
response = _a.sent();
|
|
554
|
+
// A failed fetch is not an error state here: the preview simply stays the
|
|
555
|
+
// untyped tree, which is what it was before the schema view existed.
|
|
556
|
+
if (!cancelled && response.ok) {
|
|
557
|
+
setResolvedArgSchema(response.data);
|
|
558
|
+
}
|
|
559
|
+
return [2 /*return*/];
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
}); })();
|
|
563
|
+
return function () {
|
|
564
|
+
cancelled = true;
|
|
565
|
+
};
|
|
566
|
+
}, [argSchemaId, valueLooksStructured]);
|
|
567
|
+
var previewArgSchema = argSchemaId ? resolvedArgSchema : rawArgSchema;
|
|
568
|
+
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]);
|
|
569
|
+
// The form-load revert: back to the value the FORM was loaded with.
|
|
570
|
+
//
|
|
571
|
+
// In an open editor this is offered only when it would do something
|
|
572
|
+
// `cancelEditButton` does not — that is, when the field was already
|
|
573
|
+
// modified BEFORE it was opened, so "undo this edit" and "undo every edit"
|
|
574
|
+
// are different answers. On the usual path (open an untouched field, type,
|
|
575
|
+
// change your mind) the two are identical, and two buttons with the same
|
|
576
|
+
// effect and different names are worse than one.
|
|
577
|
+
//
|
|
578
|
+
// It is unconditional on the READ row, where it renders inline in the
|
|
579
|
+
// status-dot column — there is no edit in progress there to cancel, so the
|
|
580
|
+
// whole-field revert is the only undo that makes sense.
|
|
427
581
|
var revertButton = changed ?
|
|
428
582
|
(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) {
|
|
429
583
|
var _a, _b, _c, _d;
|
|
@@ -469,6 +623,27 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
469
623
|
(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 } })
|
|
470
624
|
: null;
|
|
471
625
|
var isPassiveCloseAction = fixedAllowedValueOption || readOnly;
|
|
626
|
+
// Cancel — the counterpart to Done, and the answer to "how do I get out of
|
|
627
|
+
// here without keeping this". Done was the only way to leave an open field,
|
|
628
|
+
// so every way out committed: the check, clicking away, and Escape (which
|
|
629
|
+
// closed without discarding, so it committed too, silently).
|
|
630
|
+
//
|
|
631
|
+
// Shown only while there is something to discard. On an untouched field
|
|
632
|
+
// Cancel and Done would do exactly the same thing, and two buttons that
|
|
633
|
+
// differ in name but not in effect are worse than one.
|
|
634
|
+
//
|
|
635
|
+
// Not offered when the close action is passive (read-only, or a fixed
|
|
636
|
+
// choice) — nothing can have been typed, so there is nothing to cancel.
|
|
637
|
+
var cancelEditButton = !isPassiveCloseAction && editedSinceOpened ?
|
|
638
|
+
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreButton, { className: 'options-readfirst-cancel', size: 'small', flat: 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) {
|
|
639
|
+
event.stopPropagation();
|
|
640
|
+
cancelEdit();
|
|
641
|
+
} })
|
|
642
|
+
: null;
|
|
643
|
+
// See `revertButton` above for why this is conditional in the edit row.
|
|
644
|
+
var openedWithFormLoadValue = !editEntryValue.current ||
|
|
645
|
+
(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);
|
|
646
|
+
var editRowRevertButton = openedWithFormLoadValue ? null : revertButton;
|
|
472
647
|
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); } }));
|
|
473
648
|
// Info tiers: Tier 1 (danger/warning + dependency hints) must be visible
|
|
474
649
|
// without interaction; Tier 2 (info/success, default notes) sits behind ⓘ.
|
|
@@ -541,7 +716,7 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
541
716
|
// wrapper AND the inline editor, so the rail/node/highlight persist across
|
|
542
717
|
// view↔edit. The node is opaque (it masks the rail behind it); hovering any
|
|
543
718
|
// member lights up the whole group via the shared highlight state.
|
|
544
|
-
var clusterGroup = clustered ? (
|
|
719
|
+
var clusterGroup = clustered ? (_g = schema === null || schema === void 0 ? void 0 : schema.required_groups) === null || _g === void 0 ? void 0 : _g[0] : undefined;
|
|
545
720
|
var clusterMembers = clusterGroup ? requiredGroupsInfo.members[clusterGroup] || [] : [];
|
|
546
721
|
// The group is fulfilled once any member is set — the whole rail then reads
|
|
547
722
|
// success (not just the satisfying node).
|
|
@@ -582,6 +757,27 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
582
757
|
},
|
|
583
758
|
]
|
|
584
759
|
: []), true), injectedOptionActionMenuItems, true) }));
|
|
760
|
+
// The absorbed siblings' controls, rendered inside this row.
|
|
761
|
+
//
|
|
762
|
+
// Each keeps its own label so it is still identifiable — it is a different
|
|
763
|
+
// field, not a property of this one — but it sits inside this row's
|
|
764
|
+
// container, above the editor, so the pair reads as the single decision it
|
|
765
|
+
// is. `renderOption` is the same function the row uses for its own editor,
|
|
766
|
+
// so an absorbed field renders exactly as it would have on its own row.
|
|
767
|
+
var absorbedNodes = (absorbedFields === null || absorbedFields === void 0 ? void 0 : absorbedFields.length) ?
|
|
768
|
+
absorbedFields
|
|
769
|
+
.map(function (absorbedName) {
|
|
770
|
+
var absorbedField = availableOptions === null || availableOptions === void 0 ? void 0 : availableOptions[absorbedName];
|
|
771
|
+
if (!absorbedField)
|
|
772
|
+
return null;
|
|
773
|
+
return ((0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledAbsorbedField, { className: 'options-readfirst-absorbed', children: [(0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledAbsorbedLabel, { size: 'small', effect: { opacity: 0.6 }, children: getAbsorbedLabel(absorbedName) }), (0, jsx_runtime_1.jsx)("div", { style: { minWidth: 0, flex: 1 }, children: renderOption(absorbedName, absorbedField, 'small', true) })] }, absorbedName));
|
|
774
|
+
})
|
|
775
|
+
.filter(Boolean)
|
|
776
|
+
: null;
|
|
777
|
+
// Declared here rather than beside the hash rows below: the `isExpanded`
|
|
778
|
+
// branch returns before that point, and its editor needs to know whether it is
|
|
779
|
+
// holding code.
|
|
780
|
+
var valueType = (0, readFirst_1.getValueType)(optionField, schema);
|
|
585
781
|
if (isExpanded) {
|
|
586
782
|
if (inlineEditable) {
|
|
587
783
|
var collapse_1 = function () { return toggleExpandedOption(optionName); };
|
|
@@ -596,12 +792,18 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
596
792
|
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: 'Asterisk', color: 'danger', size: '10px' })
|
|
597
793
|
: null, helpIcon] }), labelShortDesc ?
|
|
598
794
|
(0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledLabelDesc, { className: 'options-readfirst-label-desc', size: 'small', effect: { opacity: 0.55 }, children: labelShortDesc })
|
|
599
|
-
: null] }), (0, jsx_runtime_1.
|
|
795
|
+
: null] }), (0, jsx_runtime_1.jsxs)("div", { ref: editorRef, style: { minWidth: 0 }, onKeyDown: function (event) {
|
|
600
796
|
if (event.key === 'Escape') {
|
|
601
797
|
event.stopPropagation();
|
|
602
|
-
|
|
798
|
+
// Escape discards. It used to call `collapse()`, which closed
|
|
799
|
+
// the field and KEPT whatever had been typed — the one
|
|
800
|
+
// keystroke every editor treats as "get me out of this
|
|
801
|
+
// without saving" was the quietest way to commit.
|
|
802
|
+
cancelEdit();
|
|
603
803
|
}
|
|
604
|
-
}, children:
|
|
804
|
+
}, children: [absorbedNodes, valueType === 'code-editor' && typeof (optionField === null || optionField === void 0 ? void 0 : optionField.value) === 'string' ?
|
|
805
|
+
(0, jsx_runtime_1.jsx)("div", { className: 'options-readfirst-editing-summary', children: (0, jsx_runtime_1.jsx)(codeSize_1.ReqraftCodeSizeTag, { code: optionField.value }) })
|
|
806
|
+
: null, renderOption(optionName, optionField, 'small', true)] }), (0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledRowActions, { children: [draftChip, editRowRevertButton, cancelEditButton, clearValueButton, inlineOptionActions.map(function (action, index) {
|
|
605
807
|
return renderInjectedOptionAction(action, index);
|
|
606
808
|
}), moreMenu, closeExpandedFieldButton] }), clusterNode] }), optionName));
|
|
607
809
|
// ALWAYS wrap the editing row in the same StyledColumn so its parent stays
|
|
@@ -620,10 +822,10 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
620
822
|
var cardBadges = schemaBadge !== undefined && schemaBadge !== null ?
|
|
621
823
|
(Array.isArray(schemaBadge) ? schemaBadge : [schemaBadge])
|
|
622
824
|
: [];
|
|
623
|
-
var cardActions = ((
|
|
825
|
+
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'; })) || [];
|
|
624
826
|
var cardTags = ((schema === null || schema === void 0 ? void 0 : schema.tags) || []);
|
|
625
827
|
var schemaIntentColor = (schema === null || schema === void 0 ? void 0 : schema.intent) ?
|
|
626
|
-
(
|
|
828
|
+
(_j = theme === null || theme === void 0 ? void 0 : theme.intents) === null || _j === void 0 ? void 0 : _j[schema.intent]
|
|
627
829
|
: undefined;
|
|
628
830
|
return ((0, jsx_runtime_1.jsxs)(compactRowStyles_1.StyledEditCard, { "data-field": optionName, className: COMPACT_SINGLE_VALUE_TYPES.has(editType) ?
|
|
629
831
|
'options-readfirst-card options-readfirst-card-single'
|
|
@@ -652,7 +854,7 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
652
854
|
return renderInjectedOptionAction(action, index);
|
|
653
855
|
}), hasValue && !readOnly ?
|
|
654
856
|
(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 })
|
|
655
|
-
: 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 ?
|
|
857
|
+
: 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 ?
|
|
656
858
|
(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 })
|
|
657
859
|
: null, renderOption(optionName, optionField)] })] }, optionName));
|
|
658
860
|
}
|
|
@@ -666,7 +868,6 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
666
868
|
: []), true);
|
|
667
869
|
// A hash row reveals its sub-fields as read-only sub-rows under a "view
|
|
668
870
|
// more" disclosure; the row itself still expands the real editor on click.
|
|
669
|
-
var valueType = (0, readFirst_1.getValueType)(optionField, schema);
|
|
670
871
|
var hashEntries = (!hidden &&
|
|
671
872
|
(valueType === 'hash' || valueType === 'free-hash') &&
|
|
672
873
|
(schema === null || schema === void 0 ? void 0 : schema.ui_type) !== 'schema-definition') ?
|
|
@@ -804,7 +1005,7 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
804
1005
|
(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' })
|
|
805
1006
|
: null;
|
|
806
1007
|
var rowSchemaIntentColor = (schema === null || schema === void 0 ? void 0 : schema.intent) ?
|
|
807
|
-
(
|
|
1008
|
+
(_k = theme === null || theme === void 0 ? void 0 : theme.intents) === null || _k === void 0 ? void 0 : _k[schema.intent]
|
|
808
1009
|
: undefined;
|
|
809
1010
|
var rowStripeColor = (showStripe ? intentColor : undefined) || rowSchemaIntentColor;
|
|
810
1011
|
// Intent stripe on the block ROOT so it spans the field's whole territory:
|
|
@@ -819,7 +1020,7 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
819
1020
|
// boxes — so the dot and the box can never disagree). Hidden (not-yet-added)
|
|
820
1021
|
// and dependency-locked rows show no dot (the add/lock affordance speaks for
|
|
821
1022
|
// them). worstIntent already folds in schema + validation messages.
|
|
822
|
-
var cSuccess = (
|
|
1023
|
+
var cSuccess = (_l = theme === null || theme === void 0 ? void 0 : theme.intents) === null || _l === void 0 ? void 0 : _l.success;
|
|
823
1024
|
var rowStatus = (0, readFirst_1.getReadFirstStatus)({
|
|
824
1025
|
empty: empty,
|
|
825
1026
|
required: required,
|
|
@@ -863,14 +1064,53 @@ exports.CompactRow = (0, react_1.memo)(function (_a) {
|
|
|
863
1064
|
!showMarkdownPreview &&
|
|
864
1065
|
typeof formatted === 'string') ?
|
|
865
1066
|
formatted
|
|
866
|
-
: undefined, "$color": empty || hidden ? "".concat(cMuted, "66") : cKey, "$empty": empty || hidden, children: [showMarkdownPreview ? 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 ?
|
|
1067
|
+
: 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 ?
|
|
867
1068
|
(0, jsx_runtime_1.jsx)("div", { className: 'options-readfirst-info-panel', children: panelMessages.map(renderInfoStrip) })
|
|
868
1069
|
: null, showStructuredPreview ?
|
|
869
1070
|
// The inset lives inside the row now, so a click on a value chip would
|
|
870
1071
|
// bubble to the row's onClick and fire activate() a SECOND time (the
|
|
871
1072
|
// chip's onItemClick already calls it) — toggling the editor shut again.
|
|
872
1073
|
// Stop the bubble here; the chip's own handler still opens the editor.
|
|
873
|
-
(0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledRowInset, { className: 'options-readfirst-inset', onClick: function (e) { return e.stopPropagation(); }, children: (0, jsx_runtime_1.jsx)(reqore_1.ReqoreCollapsibleContent
|
|
1074
|
+
(0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledRowInset, { className: 'options-readfirst-inset', onClick: function (e) { return e.stopPropagation(); }, children: (0, jsx_runtime_1.jsx)(reqore_1.ReqoreCollapsibleContent
|
|
1075
|
+
// The schema view spends more height per datum than a data tree
|
|
1076
|
+
// does — a labelled row rather than a packed chip — but there is
|
|
1077
|
+
// far less of it to read, so it gets enough room to show a
|
|
1078
|
+
// couple of complete items instead of fading out mid-row. A tree
|
|
1079
|
+
// of unknown depth keeps the tighter cap.
|
|
1080
|
+
, {
|
|
1081
|
+
// The schema view spends more height per datum than a data tree
|
|
1082
|
+
// does — a labelled row rather than a packed chip — but there is
|
|
1083
|
+
// far less of it to read, so it gets enough room to show a
|
|
1084
|
+
// couple of complete items instead of fading out mid-row. A tree
|
|
1085
|
+
// of unknown depth keeps the tighter cap.
|
|
1086
|
+
maxCollapsedHeight: previewWithSchema ? 140 : 96, buttonProps: { className: 'options-readfirst-viewmore' }, children: (0, jsx_runtime_1.jsx)("div", { className: 'options-readfirst-structured', children: previewWithSchema ?
|
|
1087
|
+
// The form already knows this value's shape, names and
|
|
1088
|
+
// choices, so the preview says it rather than making the
|
|
1089
|
+
// reader decode it: "Scheme Type — Default RBAC", not a data
|
|
1090
|
+
// tree announcing "Object · 1 field" over `type: default`.
|
|
1091
|
+
(0, jsx_runtime_1.jsx)(SchemaDataView_1.SchemaDataView, { value: optionField === null || optionField === void 0 ? void 0 : optionField.value, schema: previewArgSchema, showTypes: showFieldTypes, colors: {
|
|
1092
|
+
key: cKey,
|
|
1093
|
+
muted: cMuted,
|
|
1094
|
+
// Deliberately stronger than `cDivider`. That tier is for
|
|
1095
|
+
// decorative hairlines between rows, where being nearly
|
|
1096
|
+
// invisible is the point. This rule is load-bearing — it
|
|
1097
|
+
// is the only thing saying which fields belong to which
|
|
1098
|
+
// numbered item — so it gets the muted tier at partial
|
|
1099
|
+
// alpha: quiet, but actually visible.
|
|
1100
|
+
border: "".concat(cMuted, "66"),
|
|
1101
|
+
// The identity accent for each item's heading.
|
|
1102
|
+
//
|
|
1103
|
+
// `custom1` first: BRAND_DESIGN §1 says apps may register
|
|
1104
|
+
// their own named intents and reference them like the
|
|
1105
|
+
// built-ins, and that is where a product's own accent
|
|
1106
|
+
// lives (qorus-ide registers its brand purple there).
|
|
1107
|
+
// Falling back to `info` keeps this working for a
|
|
1108
|
+
// consumer that registers nothing — the heading is
|
|
1109
|
+
// accented either way, just in the theme's own colour
|
|
1110
|
+
// rather than one this library picked.
|
|
1111
|
+
accent: ((_m = theme === null || theme === void 0 ? void 0 : theme.intents) === null || _m === void 0 ? void 0 : _m.custom1) || cInfo,
|
|
1112
|
+
}, onItemClick: function () { return activate(); } })
|
|
1113
|
+
: (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(); } }) }) }) })
|
|
874
1114
|
: null, showCodePreview ?
|
|
875
1115
|
(0, jsx_runtime_1.jsx)(compactRowStyles_1.StyledRowInset, { className: 'options-readfirst-inset options-readfirst-code-inset', onClick: function (e) { return e.stopPropagation(); }, children: (0, jsx_runtime_1.jsx)(reqore_1.ReqoreCollapsibleContent, { maxCollapsedHeight: 96, buttonProps: { className: 'options-readfirst-viewmore' }, children: codePreviewRenderer ?
|
|
876
1116
|
codePreviewRenderer({
|