@qoretechnologies/reqraft 0.10.73 → 0.10.74-pr.161.g30d8f78
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.map +1 -1
- package/dist/components/codeSize/index.js +3 -2
- package/dist/components/codeSize/index.js.map +1 -1
- package/dist/components/dpqlEditor/DpqlEditor.d.ts.map +1 -1
- package/dist/components/dpqlEditor/DpqlEditor.js +5 -3
- package/dist/components/dpqlEditor/DpqlEditor.js.map +1 -1
- package/dist/components/dpqlEditor/dpqlCompletions.d.ts +2 -2
- package/dist/components/dpqlEditor/dpqlCompletions.d.ts.map +1 -1
- package/dist/components/dpqlEditor/dpqlCompletions.js +15 -8
- package/dist/components/dpqlEditor/dpqlCompletions.js.map +1 -1
- package/dist/components/dpqlEditor/useDpqlSession.d.ts.map +1 -1
- package/dist/components/dpqlEditor/useDpqlSession.js +3 -2
- package/dist/components/dpqlEditor/useDpqlSession.js.map +1 -1
- package/dist/components/form/engine/CompactRow.d.ts.map +1 -1
- package/dist/components/form/engine/CompactRow.js +55 -39
- 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 +27 -25
- package/dist/components/form/engine/CompactToolbar.js.map +1 -1
- package/dist/components/form/engine/FormEngine.d.ts +20 -1
- package/dist/components/form/engine/FormEngine.d.ts.map +1 -1
- package/dist/components/form/engine/FormEngine.js +92 -34
- package/dist/components/form/engine/FormEngine.js.map +1 -1
- package/dist/components/form/engine/HiddenFieldsNote.d.ts.map +1 -1
- package/dist/components/form/engine/HiddenFieldsNote.js +2 -3
- package/dist/components/form/engine/HiddenFieldsNote.js.map +1 -1
- package/dist/components/form/engine/OptionFieldMessages.d.ts +11 -0
- package/dist/components/form/engine/OptionFieldMessages.d.ts.map +1 -1
- package/dist/components/form/engine/OptionFieldMessages.js +23 -10
- package/dist/components/form/engine/OptionFieldMessages.js.map +1 -1
- package/dist/components/form/engine/OptionsHelpDialog.d.ts.map +1 -1
- package/dist/components/form/engine/OptionsHelpDialog.js +5 -4
- package/dist/components/form/engine/OptionsHelpDialog.js.map +1 -1
- package/dist/components/form/engine/_structuredData/StructuredDataView.d.ts.map +1 -1
- package/dist/components/form/engine/_structuredData/StructuredDataView.js +3 -2
- package/dist/components/form/engine/_structuredData/StructuredDataView.js.map +1 -1
- package/dist/components/form/engine/optionActions.d.ts.map +1 -1
- package/dist/components/form/engine/optionActions.js +3 -2
- package/dist/components/form/engine/optionActions.js.map +1 -1
- package/dist/components/form/engine/readFirst.d.ts.map +1 -1
- package/dist/components/form/engine/readFirst.js +18 -18
- package/dist/components/form/engine/readFirst.js.map +1 -1
- package/dist/components/form/expressions/builder/argumentLabel.d.ts +11 -0
- package/dist/components/form/expressions/builder/argumentLabel.d.ts.map +1 -1
- package/dist/components/form/expressions/builder/argumentLabel.js +52 -22
- package/dist/components/form/expressions/builder/argumentLabel.js.map +1 -1
- package/dist/components/form/expressions/builder/argumentWrapper.d.ts.map +1 -1
- package/dist/components/form/expressions/builder/argumentWrapper.js +7 -1
- package/dist/components/form/expressions/builder/argumentWrapper.js.map +1 -1
- package/dist/components/form/expressions/builder/index.d.ts.map +1 -1
- package/dist/components/form/expressions/builder/index.js +128 -97
- package/dist/components/form/expressions/builder/index.js.map +1 -1
- package/dist/components/form/expressions/expressionOperands.d.ts.map +1 -1
- package/dist/components/form/expressions/expressionOperands.js +20 -7
- package/dist/components/form/expressions/expressionOperands.js.map +1 -1
- package/dist/components/form/expressions/useExpressionType.d.ts +11 -0
- package/dist/components/form/expressions/useExpressionType.d.ts.map +1 -1
- package/dist/components/form/expressions/useExpressionType.js +96 -7
- package/dist/components/form/expressions/useExpressionType.js.map +1 -1
- package/dist/components/form/fields/rich-text/RichText.d.ts.map +1 -1
- package/dist/components/form/fields/rich-text/RichText.js +5 -3
- package/dist/components/form/fields/rich-text/RichText.js.map +1 -1
- package/dist/components/form/fields/rich-text/useTemplateTags.d.ts.map +1 -1
- package/dist/components/form/fields/rich-text/useTemplateTags.js +6 -3
- package/dist/components/form/fields/rich-text/useTemplateTags.js.map +1 -1
- package/dist/components/form/fields/template/TemplateBrowser.d.ts.map +1 -1
- package/dist/components/form/fields/template/TemplateBrowser.js +3 -1
- package/dist/components/form/fields/template/TemplateBrowser.js.map +1 -1
- package/dist/components/form/fields/template/TemplateField.d.ts +3 -44
- package/dist/components/form/fields/template/TemplateField.d.ts.map +1 -1
- package/dist/components/form/fields/template/TemplateField.js +34 -50
- package/dist/components/form/fields/template/TemplateField.js.map +1 -1
- package/dist/components/form/fields/template/TemplatePicker.d.ts.map +1 -1
- package/dist/components/form/fields/template/TemplatePicker.js +23 -21
- package/dist/components/form/fields/template/TemplatePicker.js.map +1 -1
- package/dist/components/form/fields/template/referenceNames.d.ts +1 -1
- package/dist/components/form/fields/template/referenceNames.d.ts.map +1 -1
- package/dist/components/form/fields/template/referenceNames.js +4 -2
- package/dist/components/form/fields/template/referenceNames.js.map +1 -1
- package/dist/components/smartEditor/CompletionMenu.d.ts.map +1 -1
- package/dist/components/smartEditor/CompletionMenu.js +27 -8
- package/dist/components/smartEditor/CompletionMenu.js.map +1 -1
- package/dist/components/smartEditor/SmartEditor.d.ts.map +1 -1
- package/dist/components/smartEditor/SmartEditor.js +12 -8
- package/dist/components/smartEditor/SmartEditor.js.map +1 -1
- package/dist/components/smartEditor/contextTitle.d.ts.map +1 -1
- package/dist/components/smartEditor/contextTitle.js +3 -1
- package/dist/components/smartEditor/contextTitle.js.map +1 -1
- package/dist/components/smartEditor/templateCompletions.d.ts +1 -1
- package/dist/components/smartEditor/templateCompletions.d.ts.map +1 -1
- package/dist/components/smartEditor/templateCompletions.js +22 -11
- package/dist/components/smartEditor/templateCompletions.js.map +1 -1
- package/dist/components/smartEditor/useEditingAids.d.ts.map +1 -1
- package/dist/components/smartEditor/useEditingAids.js +12 -10
- package/dist/components/smartEditor/useEditingAids.js.map +1 -1
- package/dist/components/smartEditor/useLspAutocomplete.d.ts +4 -1
- package/dist/components/smartEditor/useLspAutocomplete.d.ts.map +1 -1
- package/dist/components/smartEditor/useLspAutocomplete.js +30 -42
- package/dist/components/smartEditor/useLspAutocomplete.js.map +1 -1
- package/dist/helpers/expressions.d.ts +33 -1
- package/dist/helpers/expressions.d.ts.map +1 -1
- package/dist/helpers/expressions.js +74 -8
- package/dist/helpers/expressions.js.map +1 -1
- package/dist/helpers/noDescription.d.ts +1 -1
- package/dist/helpers/noDescription.d.ts.map +1 -1
- package/dist/helpers/noDescription.js +2 -1
- package/dist/helpers/noDescription.js.map +1 -1
- package/dist/helpers/qorusTypeCatalogue.d.ts +6 -0
- package/dist/helpers/qorusTypeCatalogue.d.ts.map +1 -1
- package/dist/helpers/qorusTypeCatalogue.js +29 -1
- package/dist/helpers/qorusTypeCatalogue.js.map +1 -1
- package/dist/helpers/reqraftLabels.d.ts +344 -0
- package/dist/helpers/reqraftLabels.d.ts.map +1 -0
- package/dist/helpers/reqraftLabels.js +411 -0
- package/dist/helpers/reqraftLabels.js.map +1 -0
- package/dist/helpers/templateCatalogue.d.ts.map +1 -1
- package/dist/helpers/templateCatalogue.js +4 -3
- package/dist/helpers/templateCatalogue.js.map +1 -1
- package/dist/helpers/templateTree.d.ts +4 -13
- package/dist/helpers/templateTree.d.ts.map +1 -1
- package/dist/helpers/templateTree.js +56 -49
- package/dist/helpers/templateTree.js.map +1 -1
- package/dist/helpers/templates.d.ts.map +1 -1
- package/dist/helpers/templates.js +5 -5
- package/dist/helpers/templates.js.map +1 -1
- package/dist/hooks/useTemplates.d.ts.map +1 -1
- package/dist/hooks/useTemplates.js +23 -3
- package/dist/hooks/useTemplates.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
|
@@ -9,8 +9,10 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
9
9
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ExpressionBuilderArgumentLabel = void 0;
|
|
12
|
+
exports.ExpressionBuilderArgumentLabel = exports.ExpressionBuilderArgumentRuntimeNote = exports.useArgumentKnownWhenItRuns = void 0;
|
|
13
13
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
14
|
+
var qorusTypeCatalogue_1 = require("../../../../helpers/qorusTypeCatalogue");
|
|
15
|
+
var reqraftLabels_1 = require("../../../../helpers/reqraftLabels");
|
|
14
16
|
var reqore_1 = require("@qoretechnologies/reqore");
|
|
15
17
|
var lodash_1 = require("lodash");
|
|
16
18
|
var expressions_1 = require("../../../../helpers/expressions");
|
|
@@ -20,8 +22,28 @@ var useReadableIntentShade_1 = require("../../../../hooks/useReadableIntentShade
|
|
|
20
22
|
var useReadableOpacity_1 = require("../../../../hooks/useReadableOpacity");
|
|
21
23
|
var readableColors_1 = require("../../../../helpers/readableColors");
|
|
22
24
|
var useExpressionType_1 = require("../useExpressionType");
|
|
25
|
+
/**
|
|
26
|
+
* Whether an argument holds an expression whose type the server can tell only when it runs (`known: false`, as of a
|
|
27
|
+
* template that reads the incoming data). Such an argument is not judged against the type it takes; the value says
|
|
28
|
+
* instead that it depends on the incoming data (`ExpressionBuilderArgumentRuntimeNote`).
|
|
29
|
+
*/
|
|
30
|
+
var useArgumentKnownWhenItRuns = function (arg) {
|
|
31
|
+
var served = (0, useExpressionType_1.useExpressionType)((arg === null || arg === void 0 ? void 0 : arg.is_expression) ? arg.value : undefined);
|
|
32
|
+
return !!(arg === null || arg === void 0 ? void 0 : arg.is_expression) && (served === null || served === void 0 ? void 0 : served.known) === false;
|
|
33
|
+
};
|
|
34
|
+
exports.useArgumentKnownWhenItRuns = useArgumentKnownWhenItRuns;
|
|
35
|
+
/**
|
|
36
|
+
* Said under an argument's value when that value depends on the incoming data: plain words, on the value they are
|
|
37
|
+
* about, rather than a type name in the argument's header (qlip review of #161: the users are supply chain managers).
|
|
38
|
+
*/
|
|
39
|
+
var ExpressionBuilderArgumentRuntimeNote = function () {
|
|
40
|
+
var hintOpacity = (0, useReadableOpacity_1.useReadableOpacity)(0.5);
|
|
41
|
+
var engineLabels = (0, reqraftLabels_1.useReqraftLabels)().formEngine;
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)(reqore_1.ReqoreP, { size: 'tiny', className: 'expression-arg-runtime-note', effect: { italic: true, weight: 'light', opacity: hintOpacity }, children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: 'InformationLine', size: '10px', margin: 'right' }), engineLabels.knownWhenItRuns] }));
|
|
43
|
+
};
|
|
44
|
+
exports.ExpressionBuilderArgumentRuntimeNote = ExpressionBuilderArgumentRuntimeNote;
|
|
23
45
|
var ExpressionBuilderArgumentLabel = function (_a) {
|
|
24
|
-
var _b;
|
|
46
|
+
var _b, _c;
|
|
25
47
|
var label = _a.label, arg = _a.arg, schema = _a.schema, expressions = _a.expressions, type = _a.type;
|
|
26
48
|
// the type and the hint after a name, light and softer: as soft as they still read (qorus#646)
|
|
27
49
|
var hintOpacity = (0, useReadableOpacity_1.useReadableOpacity)(0.5);
|
|
@@ -30,8 +52,10 @@ var ExpressionBuilderArgumentLabel = function (_a) {
|
|
|
30
52
|
var warningMark = (0, useReadableIntentShade_1.useReadableIntentShade)('warning', readableColors_1.READABLE_ICON);
|
|
31
53
|
var pendingMark = (0, useReadableIntentShade_1.useReadableIntentShade)('pending', readableColors_1.READABLE_ICON);
|
|
32
54
|
var types = (0, useQorusTypes_1.useQorusTypes)();
|
|
33
|
-
// an expression's type is the server's (getArgumentType reads it); this re-renders the label when it arrives
|
|
34
|
-
|
|
55
|
+
// an expression's type is the server's (getArgumentType reads it); this re-renders the label when it arrives. The
|
|
56
|
+
// server cannot tell some operations' type before they run (`known: false`): such a value is not judged here, and
|
|
57
|
+
// the note under it says it depends on the incoming data
|
|
58
|
+
var knownWhenItRuns = (0, exports.useArgumentKnownWhenItRuns)(arg);
|
|
35
59
|
if (!schema) {
|
|
36
60
|
return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreP, { size: 'tiny', effect: {
|
|
37
61
|
uppercase: true,
|
|
@@ -47,15 +71,15 @@ var ExpressionBuilderArgumentLabel = function (_a) {
|
|
|
47
71
|
type === 'any';
|
|
48
72
|
var acceptedTypes = (0, lodash_1.uniq)(__spreadArray(__spreadArray([], types.getExactMatches(schema.ui_type), true), types.getAcceptedTypes(schema.ui_type), true));
|
|
49
73
|
/** The types this argument takes, named inside a sentence: "a whole number or a number" (qorus#646). */
|
|
50
|
-
var acceptedTypeNames = (
|
|
74
|
+
var acceptedTypeNames = (_b = (0, qorusTypeCatalogue_1.typesInASentence)(acceptedTypes, function (t) { return types.getTypeSentenceForm(t); })) !== null && _b !== void 0 ? _b : '';
|
|
51
75
|
/* `arg` is optional — an operand the author has not filled in yet has no
|
|
52
76
|
entry at all, and a literal carried straight from a parse can be the null
|
|
53
77
|
literal itself. Both were dereferenced unguarded here, which took the whole
|
|
54
78
|
expression editor down to its error boundary rather than drawing an empty
|
|
55
79
|
argument. */
|
|
56
|
-
var
|
|
80
|
+
var _d = (arg === null || arg === void 0 ? void 0 : arg.is_expression) ?
|
|
57
81
|
(0, validations_1.validateFieldWithResult)('expression', arg, { expressions: expressions })
|
|
58
|
-
: (0, validations_1.validateFieldWithResult)(argumentType, arg === null || arg === void 0 ? void 0 : arg.value, schema, !schema.required), isValid =
|
|
82
|
+
: (0, validations_1.validateFieldWithResult)(argumentType, arg === null || arg === void 0 ? void 0 : arg.value, schema, !schema.required), isValid = _d.isValid, reason = _d.reason;
|
|
59
83
|
return ((0, jsx_runtime_1.jsxs)(reqore_1.ReqoreP, { size: 'tiny', effect: {
|
|
60
84
|
uppercase: true,
|
|
61
85
|
spaced: 1,
|
|
@@ -63,29 +87,35 @@ var ExpressionBuilderArgumentLabel = function (_a) {
|
|
|
63
87
|
}, children: [!isValid && ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: 'ErrorWarningLine', color: dangerMark, size: '10px', margin: 'right' })), schema.display_name && ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreSpan, { effect: {
|
|
64
88
|
opacity: 1,
|
|
65
89
|
underline: !isValid || !matchesType ? 'underline solid red' : undefined,
|
|
66
|
-
}, tooltip: isValid
|
|
67
|
-
|
|
68
|
-
|
|
90
|
+
}, tooltip: isValid ?
|
|
91
|
+
!matchesType ?
|
|
92
|
+
"This value is not ".concat(acceptedTypeNames, ". Put it inside an expression that converts it")
|
|
69
93
|
: undefined
|
|
70
94
|
: reason, children: schema.display_name })), ' ', schema.required && (0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: 'Asterisk', color: dangerMark, size: '10px' }), " ", label, (0, jsx_runtime_1.jsxs)(reqore_1.ReqoreSpan, { effect: {
|
|
71
95
|
italic: true,
|
|
72
96
|
weight: 'light',
|
|
73
97
|
opacity: hintOpacity,
|
|
74
|
-
}, children: ['[', types.getTypeDisplayName(schema.ui_type, schema.base_type)] }), !matchesType ?
|
|
98
|
+
}, children: ['[', types.getTypeDisplayName(schema.ui_type, schema.base_type)] }), !matchesType ?
|
|
99
|
+
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: 'ErrorWarningLine', color: warningMark, size: '10px', margin: 'both' })
|
|
100
|
+
: null, (!knownWhenItRuns &&
|
|
101
|
+
(argumentType || ((arg === null || arg === void 0 ? void 0 : arg.is_expression) && ((_c = arg.value) === null || _c === void 0 ? void 0 : _c.exp))) &&
|
|
75
102
|
types.getTypeDisplayName(argumentType) !==
|
|
76
103
|
types.getTypeDisplayName(schema.ui_type, schema.base_type) &&
|
|
77
|
-
!matchesTypeExactly
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
104
|
+
!matchesTypeExactly) ?
|
|
105
|
+
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [matchesType ?
|
|
106
|
+
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreIcon, { icon: 'CheckLine', color: pendingMark, size: '10px', margin: 'both', tooltip: 'The type fits; Qorus may convert the value' })
|
|
107
|
+
: null, (0, jsx_runtime_1.jsx)(reqore_1.ReqoreSpan, { effect: {
|
|
108
|
+
italic: true,
|
|
109
|
+
weight: 'light',
|
|
110
|
+
opacity: 1,
|
|
111
|
+
underline: 'underline 1px dotted',
|
|
112
|
+
}, intent: matchesType ? 'pending' : 'warning', tooltip: matchesType ? 'The type fits; Qorus may convert the value'
|
|
113
|
+
: acceptedTypeNames ?
|
|
114
|
+
// the sentence starts with them
|
|
86
115
|
"".concat(acceptedTypeNames.charAt(0).toUpperCase()).concat(acceptedTypeNames.slice(1), " is needed here")
|
|
87
|
-
|
|
88
|
-
'A value of another type is needed here', children: types.getTypeDisplayName(argumentType) })] })
|
|
116
|
+
// a place whose types are not known names none
|
|
117
|
+
: 'A value of another type is needed here', children: types.getTypeDisplayName(argumentType) })] })
|
|
118
|
+
: null, (0, jsx_runtime_1.jsx)(reqore_1.ReqoreSpan, { effect: {
|
|
89
119
|
italic: true,
|
|
90
120
|
weight: 'light',
|
|
91
121
|
opacity: hintOpacity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argumentLabel.js","sourceRoot":"","sources":["../../../../../src/components/form/expressions/builder/argumentLabel.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAA2E;AAC3E,
|
|
1
|
+
{"version":3,"file":"argumentLabel.js","sourceRoot":"","sources":["../../../../../src/components/form/expressions/builder/argumentLabel.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6EAA0E;AAC1E,mEAAqE;AACrE,mDAA2E;AAC3E,iCAA8B;AAC9B,+DAAuF;AACvF,+DAA0E;AAC1E,iEAAgE;AAChE,mFAAkF;AAClF,2EAA0E;AAC1E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S,EAC3C,OAAO,EACL,WAAW,CAAC,CAAC,CAAC,4CAA4C;gCAC1D,CAAC,CAAC,iBAAiB,CAAC,CAAC;oCACnB,gCAAgC;oCAChC,UAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,SAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,oBAAiB;oCAC1F,+CAA+C;oCACjD,CAAC,CAAC,wCAAwC,YAG3C,KAAK,CAAC,kBAAkB,CAAC,YAAY,CAAC,GAC5B,IACZ;gBACL,CAAC,CAAC,IAAI,EACN,uBAAC,mBAAU,IACT,MAAM,EAAE;oBACN,MAAM,EAAE,IAAI;oBACZ,MAAM,EAAE,OAAO;oBACf,OAAO,EAAE,WAAW;iBACrB,YAEA,GAAG,GACO,IACL,CACX,CAAC;AACJ,CAAC,CAAC;AAxJW,QAAA,8BAA8B,kCAwJzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argumentWrapper.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/expressions/builder/argumentWrapper.tsx"],"names":[],"mappings":";AAUA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"argumentWrapper.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/expressions/builder/argumentWrapper.tsx"],"names":[],"mappings":";AAUA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,UAAU,CAAC;AA4BlB,MAAM,WAAW,sCAAsC;IACrD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,GAAG,CAAC,EAAE,WAAW,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAClD,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,yBAAyB,EAAE,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,eAAO,MAAM,gCAAgC,qPAoBxC,sCAAsC,6CAsK1C,CAAC"}
|
|
@@ -40,6 +40,8 @@ exports.ExpressionBuilderArgumentWrapper = (0, react_1.memo)(function (_a) {
|
|
|
40
40
|
var children = _a.children, schema = _a.schema, arg = _a.arg, onRemoveArgClick = _a.onRemoveArgClick, hasMultipleArgs = _a.hasMultipleArgs, expressions = _a.expressions, label = _a.label, readOnly = _a.readOnly, fluid = _a.fluid, reorder = _a.reorder, _b = _a.argIndex, argIndex = _b === void 0 ? 0 : _b, _c = _a.argCount, argCount = _c === void 0 ? 0 : _c, dragOver = _a.dragOver, onMoveArg = _a.onMoveArg, onArgDragStart = _a.onArgDragStart, onArgDragOver = _a.onArgDragOver, onArgDrop = _a.onArgDrop, onArgDragEnd = _a.onArgDragEnd;
|
|
41
41
|
var theme = (0, reqore_1.useReqoreTheme)();
|
|
42
42
|
var type = (arg === null || arg === void 0 ? void 0 : arg.type) || (schema === null || schema === void 0 ? void 0 : schema.ui_type) || 'context';
|
|
43
|
+
// an expression whose type only shows when it runs: the note under its value says so
|
|
44
|
+
var knownWhenItRuns = (0, argumentLabel_1.useArgumentKnownWhenItRuns)(arg);
|
|
43
45
|
var draggable = !!(reorder === null || reorder === void 0 ? void 0 : reorder.includes('dragHandle'));
|
|
44
46
|
// Only the grip is `draggable`, so a drag never starts from inside the
|
|
45
47
|
// field and text selection there is untouched; the drag image is the
|
|
@@ -86,7 +88,11 @@ exports.ExpressionBuilderArgumentWrapper = (0, react_1.memo)(function (_a) {
|
|
|
86
88
|
onClick: function () { return onMoveArg === null || onMoveArg === void 0 ? void 0 : onMoveArg(argIndex, target); },
|
|
87
89
|
}); }) }))] })); };
|
|
88
90
|
if (arg === null || arg === void 0 ? void 0 : arg.is_expression) {
|
|
89
|
-
return (
|
|
91
|
+
return (
|
|
92
|
+
// the value comes first; a note on it (that it depends on the incoming data) is under it
|
|
93
|
+
(0, jsx_runtime_1.jsxs)(reqore_1.ReqoreControlGroup, __assign({ vertical: true, fluid: true, gapSize: 'small', className: 'expression-arg' }, dragProps, { children: [(0, jsx_runtime_1.jsxs)(reqore_1.ReqoreControlGroup, { verticalAlign: 'center', gapSize: 'small', children: [(0, jsx_runtime_1.jsx)(argumentLabel_1.ExpressionBuilderArgumentLabel, { arg: arg, schema: schema, label: label || '', expressions: expressions, type: type }), reorder && renderReorderControls()] }), (0, jsx_runtime_1.jsx)(reqore_1.ReqorePanel, { minimal: true, fluid: true, wrapperPadding: 'top', responsiveTitle: false, responsiveActions: false, size: 'small', flat: true, padded: false, transparent: true, children: children }), knownWhenItRuns ?
|
|
94
|
+
(0, jsx_runtime_1.jsx)(argumentLabel_1.ExpressionBuilderArgumentRuntimeNote, {})
|
|
95
|
+
: null] })));
|
|
90
96
|
}
|
|
91
97
|
return ((0, jsx_runtime_1.jsxs)(reqore_1.ReqoreControlGroup, __assign({ vertical: true, wrap: true, fluid: fluid, size: 'small', className: 'expression-arg',
|
|
92
98
|
// the builder gives a value just added the focus here when it has no text field (see `focusNewArgIn`)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argumentWrapper.js","sourceRoot":"","sources":["../../../../../src/components/form/expressions/builder/argumentWrapper.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,mDAMkC;AAClC,+BAA6B;AAC7B,wEAAuC;AACvC,qDAAqD;AAOrD,
|
|
1
|
+
{"version":3,"file":"argumentWrapper.js","sourceRoot":"","sources":["../../../../../src/components/form/expressions/builder/argumentWrapper.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,mDAMkC;AAClC,+BAA6B;AAC7B,wEAAuC;AACvC,qDAAqD;AAOrD,iDAIyB;AAEzB;;;;;;;;;GASG;AACH,IAAM,qBAAqB,GAAG,IAAA,2BAAM,EAAC,2BAAkB,CAAC,4MAAA,yIASvD,IAAA,CAAC;AA2BW,QAAA,gCAAgC,GAAG,IAAA,YAAI,EAClD,UAAC,EAmBwC;QAlBvC,QAAQ,cAAA,EACR,MAAM,YAAA,EACN,GAAG,SAAA,EACH,gBAAgB,sBAAA,EAChB,eAAe,qBAAA,EACf,WAAW,iBAAA,EACX,KAAK,WAAA,EACL,QAAQ,cAAA,EACR,KAAK,WAAA,EACL,OAAO,aAAA,EACP,gBAAY,EAAZ,QAAQ,mBAAG,CAAC,KAAA,EACZ,gBAAY,EAAZ,QAAQ,mBAAG,CAAC,KAAA,EACZ,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,cAAc,oBAAA,EACd,aAAa,mBAAA,EACb,SAAS,eAAA,EACT,YAAY,kBAAA;IAEZ,IAAM,KAAK,GAAG,IAAA,uBAAc,GAAE,CAAC;IAC/B,IAAM,IAAI,GAAG,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,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,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,IAAK,SAAS,CAAC,KAAK,cAEzE,uBAAC,8CAA8B,IAC7B,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,GACxB,EAIF,wBAAC,qBAAqB,IAAC,aAAa,EAAC,YAAY,EAAC,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,QAAC,SAAS,EAAC,sBAAsB,aACnG,OAAO,IAAI,qBAAqB,EAAE,EAClC,QAAQ,EACR,eAAe,IAAI,CAClB,uBAAC,qBAAY,IACX,OAAO,QACP,MAAM,EAAC,QAAQ,EACf,OAAO,QACP,KAAK,QACL,SAAS,EAAC,uBAAuB,EACjC,IAAI,EAAC,eAAe,EACpB,IAAI,QACJ,WAAW,QACX,OAAO,EAAC,iBAAiB,EACzB,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,QAAQ,GAClB,CACH,IACqB,KACL,CACtB,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/expressions/builder/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/expressions/builder/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAGpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG1D,OAAO,KAAmE,MAAM,OAAO,CAAC;AAGxF,OAAO,EAcL,cAAc,EAGf,MAAM,iCAAiC,CAAC;AAoBzC,OAAO,EAEL,WAAW,EACX,iBAAiB,EAGjB,kBAAkB,EAEnB,MAAM,UAAU,CAAC;AAqBlB,MAAM,WAAW,uBAAuB;IACtC,cAAc,CAA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AC,EAAE,MAAM,CAAC;IACd;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EACT,kBAAkB,EAAE,GACpB,CAAC,CAAC,OAAO,EAAE;QACT,kBAAkB,CAAC,EAAE,iBAAiB,CAAC;QACvC,KAAK,CAAC,EAAE,WAAW,CAAC;KACrB,KAAK,kBAAkB,EAAE,CAAC,CAAC;CACjC;AAiBD,MAAM,WAAW,gBAAiB,SAAQ,uBAAuB;CAAG;AAEpE,eAAO,MAAM,UAAU,qRAsBpB,gBAAgB,4CAqzClB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,SAAU,OAAO,SAAS,MAAM,GAAG,SAAS,KAAG,MAGM,CAAC;AAErF,eAAO,MAAM,iBAAiB,gTAwB3B,uBAAuB,4CAmPzB,CAAC"}
|
|
@@ -63,6 +63,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
63
63
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
64
|
exports.ExpressionBuilder = exports.noOperationYetText = exports.Expression = void 0;
|
|
65
65
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
66
|
+
var qorusTypeCatalogue_1 = require("../../../../helpers/qorusTypeCatalogue");
|
|
66
67
|
var reqore_1 = require("@qoretechnologies/reqore");
|
|
67
68
|
var lodash_1 = require("lodash");
|
|
68
69
|
var polished_1 = require("polished");
|
|
@@ -127,8 +128,8 @@ var Expression = function (_a) {
|
|
|
127
128
|
// gets this card's context — exactly what the IDE's `AiAssistanceAction`
|
|
128
129
|
// captured when it was built inline here.
|
|
129
130
|
var resolvedExtraActions = (0, react_1.useMemo)(function () {
|
|
130
|
-
return typeof extraActions === 'function'
|
|
131
|
-
|
|
131
|
+
return typeof extraActions === 'function' ?
|
|
132
|
+
extraActions({ selectedExpression: selectedExpression, value: value })
|
|
132
133
|
: (extraActions !== null && extraActions !== void 0 ? extraActions : []);
|
|
133
134
|
}, [extraActions, selectedExpression, JSON.stringify(value)]);
|
|
134
135
|
// The type the expression gives is the server's, the same as everywhere else in Qorus
|
|
@@ -136,16 +137,39 @@ var Expression = function (_a) {
|
|
|
136
137
|
// `ui_type` is compared with the types this place takes, which are UI types; what the expression gives is
|
|
137
138
|
// named, and judged as a condition, by the type's own name, as the Text view names it (`inferred_type`:
|
|
138
139
|
// "a whole number", where the UI type of every number is `number`).
|
|
140
|
+
// the types of the templates this builder offers go with every question of an expression's type
|
|
141
|
+
var templateList = (0, react_1.useId)();
|
|
142
|
+
(0, react_1.useMemo)(function () { return (0, useExpressionType_1.registerTemplateTypes)(localTemplates, templateList); }, [localTemplates, templateList]);
|
|
143
|
+
(0, react_1.useEffect)(function () { return function () { return (0, useExpressionType_1.unregisterTemplateTypes)(templateList); }; }, [templateList]);
|
|
139
144
|
var serverType = (0, useExpressionType_1.useExpressionType)(value.value);
|
|
140
145
|
var expressionReturnType = serverType === null || serverType === void 0 ? void 0 : serverType.ui_type;
|
|
141
146
|
var expressionGivesType = serverType === null || serverType === void 0 ? void 0 : serverType.inferred_type;
|
|
147
|
+
// Each operand as the reader knows it - a template by its label, a value quoted, an operation by its name - with the
|
|
148
|
+
// type it gives: a nested operation's is the server's, a value's the type it is entered as. A mismatch names the
|
|
149
|
+
// operand its type comes from.
|
|
150
|
+
var operands = (0, react_1.useMemo)(function () {
|
|
151
|
+
var _a, _b;
|
|
152
|
+
return ((_b = (_a = value.value) === null || _a === void 0 ? void 0 : _a.args) !== null && _b !== void 0 ? _b : []).map(function (arg) {
|
|
153
|
+
var _a, _b, _c, _d;
|
|
154
|
+
if (arg === null || arg === void 0 ? void 0 : arg.is_expression) {
|
|
155
|
+
var operation = (_a = expressions.value) === null || _a === void 0 ? void 0 : _a.find(function (exp) { var _a; return exp.name === ((_a = arg.value) === null || _a === void 0 ? void 0 : _a.exp); });
|
|
156
|
+
return {
|
|
157
|
+
label: (operation === null || operation === void 0 ? void 0 : operation.display_name) ? "\"".concat(operation.display_name, "\"") : undefined,
|
|
158
|
+
type: (_b = (0, useExpressionType_1.getCachedExpressionType)(arg.value)) === null || _b === void 0 ? void 0 : _b.inferred_type,
|
|
159
|
+
isOperation: true,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
label: (0, expressions_1.operandLabel)(arg === null || arg === void 0 ? void 0 : arg.value, (_d = (_c = (0, templates_1.findTemplate)(localTemplates, arg === null || arg === void 0 ? void 0 : arg.value)) === null || _c === void 0 ? void 0 : _c.label) === null || _d === void 0 ? void 0 : _d.toString(), arg === null || arg === void 0 ? void 0 : arg.type),
|
|
164
|
+
type: arg === null || arg === void 0 ? void 0 : arg.type,
|
|
165
|
+
};
|
|
166
|
+
});
|
|
167
|
+
}, [JSON.stringify(value), JSON.stringify(expressions.value), localTemplates, serverType]);
|
|
142
168
|
// An empty card gives nothing, which is known without asking: it does not fit a place that takes something.
|
|
143
169
|
var typeNotKnownYet = !!((_c = value.value) === null || _c === void 0 ? void 0 : _c.exp) && !serverType;
|
|
144
170
|
// the type(s) this place takes, named inside a sentence: their sentence forms; none where no type is known
|
|
145
171
|
// (qorus#646)
|
|
146
|
-
var expectedReturnTypeText = (0,
|
|
147
|
-
return types.getTypeSentenceForm(type, returnBaseType);
|
|
148
|
-
})).join(' or ') || undefined;
|
|
172
|
+
var expectedReturnTypeText = (0, qorusTypeCatalogue_1.typesInASentence)((0, lodash_1.isArray)(returnType) ? returnType : [returnType], function (type) { return types.getTypeSentenceForm(type, returnBaseType); });
|
|
149
173
|
// Server Handler expressions is either defined by the option
|
|
150
174
|
// then it's always the first level
|
|
151
175
|
// Or if the first argument is a field (data_role: 'record') or the first selected expression is
|
|
@@ -309,8 +333,8 @@ var Expression = function (_a) {
|
|
|
309
333
|
falling back to the builder's own type gave the first value of a condition (the builder's `bool`)
|
|
310
334
|
or of an untyped builder (`context`) a type it is not, which rendered as "Unknown type!" once an
|
|
311
335
|
untyped operand was written as text. */
|
|
312
|
-
var firstParamType = (firstArgument === null || firstArgument === void 0 ? void 0 : firstArgument.is_expression)
|
|
313
|
-
|
|
336
|
+
var firstParamType = (firstArgument === null || firstArgument === void 0 ? void 0 : firstArgument.is_expression) ?
|
|
337
|
+
firstArgSchema === null || firstArgSchema === void 0 ? void 0 : firstArgSchema.ui_type
|
|
314
338
|
: (firstArgument === null || firstArgument === void 0 ? void 0 : firstArgument.type) ||
|
|
315
339
|
((0, optionUiTypes_1.isUntypedOptionType)(firstArgSchema === null || firstArgSchema === void 0 ? void 0 : firstArgSchema.ui_type) ? firstArgSchema === null || firstArgSchema === void 0 ? void 0 : firstArgSchema.ui_type : undefined) ||
|
|
316
340
|
type ||
|
|
@@ -394,8 +418,8 @@ var Expression = function (_a) {
|
|
|
394
418
|
(condition !== 'error' &&
|
|
395
419
|
(typeNotKnownYet ||
|
|
396
420
|
expressionReturnType === 'any' ||
|
|
397
|
-
((0, lodash_1.isArray)(returnType)
|
|
398
|
-
|
|
421
|
+
((0, lodash_1.isArray)(returnType) ?
|
|
422
|
+
(0, expressions_1.areQorusTypesCompatible)(returnType, expressionReturnType, types.value, returnBaseType)
|
|
399
423
|
: returnType === 'auto' ||
|
|
400
424
|
returnType === 'any' ||
|
|
401
425
|
returnType === 'context' ||
|
|
@@ -433,13 +457,18 @@ var Expression = function (_a) {
|
|
|
433
457
|
groups: exp.groups,
|
|
434
458
|
}); })
|
|
435
459
|
.filter(function (exp) {
|
|
436
|
-
return serverExpression
|
|
437
|
-
?
|
|
438
|
-
: (firstArgument === null || firstArgument === void 0 ? void 0 : firstArgument.value) && !isFirstArgumentField
|
|
439
|
-
? !exp.from_server
|
|
460
|
+
return serverExpression ? exp.from_server || exp.from_both
|
|
461
|
+
: (firstArgument === null || firstArgument === void 0 ? void 0 : firstArgument.value) && !isFirstArgumentField ? !exp.from_server
|
|
440
462
|
: true;
|
|
441
463
|
});
|
|
442
|
-
}, [
|
|
464
|
+
}, [
|
|
465
|
+
JSON.stringify(expressions.value),
|
|
466
|
+
serverExpression,
|
|
467
|
+
level,
|
|
468
|
+
isChild,
|
|
469
|
+
returnType,
|
|
470
|
+
(_j = value === null || value === void 0 ? void 0 : value.value) === null || _j === void 0 ? void 0 : _j.exp,
|
|
471
|
+
]);
|
|
443
472
|
// SEAM (reqraft): reqraft's `SelectFormField` calls `onChange(value)` with
|
|
444
473
|
// the value directly (the IDE's Select used `(name, value)`).
|
|
445
474
|
var handleOperatorChange = (0, react_1.useCallback)(function (value) {
|
|
@@ -662,8 +691,8 @@ var Expression = function (_a) {
|
|
|
662
691
|
show: level === 0,
|
|
663
692
|
onClick: function () { return setShowSummary(!showSummary); },
|
|
664
693
|
icon: 'InformationLine',
|
|
665
|
-
tooltip: showSummary
|
|
666
|
-
|
|
694
|
+
tooltip: showSummary ?
|
|
695
|
+
'Hide explanation of this expression'
|
|
667
696
|
: 'Show explanation of this expression',
|
|
668
697
|
fixed: true,
|
|
669
698
|
},
|
|
@@ -737,93 +766,95 @@ var Expression = function (_a) {
|
|
|
737
766
|
setConfirmDialogData(undefined);
|
|
738
767
|
},
|
|
739
768
|
},
|
|
740
|
-
], children: confirmDialogData.children })), showSummary && ((0, jsx_runtime_1.jsx)(renderTemplate_1.ExpressionRenderTemplate, { exp: value, expressions: expressions.value, templates: localTemplates })), nothingChosenYet ?
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
, {
|
|
769
|
+
], children: confirmDialogData.children })), showSummary && ((0, jsx_runtime_1.jsx)(renderTemplate_1.ExpressionRenderTemplate, { exp: value, expressions: expressions.value, templates: localTemplates })), nothingChosenYet ?
|
|
770
|
+
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreMessage, { size: 'small', opaque: false, intent: 'info', className: 'expression-no-operation-yet', children: (0, exports.noOperationYetText)(false, takesText) })
|
|
771
|
+
: (0, jsx_runtime_1.jsxs)(reqore_1.ReqoreControlGroup
|
|
744
772
|
// On a phone every operand is a full-width row, so the group spans
|
|
745
773
|
// the panel; on desktop it hugs its content and wraps.
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
:
|
|
758
|
-
|
|
759
|
-
:
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
// (FormEngine with templates off) the IDE original crashes on
|
|
775
|
-
// `{}.items.filter`.
|
|
776
|
-
var filteredTemplates = (_a = templates === null || templates === void 0 ? void 0 : templates.items) === null || _a === void 0 ? void 0 : _a.filter(function (item) {
|
|
774
|
+
, {
|
|
775
|
+
// On a phone every operand is a full-width row, so the group spans
|
|
776
|
+
// the panel; on desktop it hugs its content and wraps.
|
|
777
|
+
fluid: phone, style: { maxWidth: '100%' }, wrap: true, verticalAlign: 'flex-start', size: 'normal', gapSize: 'big', children: [(firstArgSchema === null || firstArgSchema === void 0 ? void 0 : firstArgSchema.label_before) && ((0, jsx_runtime_1.jsx)(argumentDetail_1.ExpressionArgumentDetail, { label: firstArgSchema.label_before })), (0, jsx_runtime_1.jsx)(argumentWrapper_1.ExpressionBuilderArgumentWrapper, { expressions: expressions.value, arg: firstArgument, schema: firstArgSchema, onTypeChange: handleUpdateTypeChange, onRemoveArgClick: handleRemoveFirstArg, hasMultipleArgs: removeArgInline, fluid: phone, readOnly: readOnly, reorder: argReorderSurfaces, argIndex: 0, argCount: argCount, dragOver: isDragOverArg(0), onMoveArg: moveVarArg, onArgDragStart: handleArgDragStart, onArgDragOver: handleArgDragOver, onArgDrop: handleArgDrop, onArgDragEnd: handleArgDragEnd, children: (0, jsx_runtime_1.jsx)(TemplateField_1.TemplateField, { component: AutoFormField_1.AutoFormField, componentOverrides: componentOverrides,
|
|
778
|
+
// an operand's text is as wide as what it holds, and gives way to its row
|
|
779
|
+
textWidth: 'content',
|
|
780
|
+
// SEAM (reqraft): an operand that becomes an expression mounts
|
|
781
|
+
// its own builder through this TemplateField — hand the host's
|
|
782
|
+
// actions on, or nesting silently drops them (the group
|
|
783
|
+
// recursion below already forwards them).
|
|
784
|
+
extraActions: extraActions, minimal: true, label: serverAndQorusExpression ? 'Select Template Or Field'
|
|
785
|
+
: serverExpression ?
|
|
786
|
+
'Select Field'
|
|
787
|
+
: qorusExpression ?
|
|
788
|
+
'Select Template'
|
|
789
|
+
: 'Select Template Or Field', allowFunctions: !serverExpression &&
|
|
790
|
+
!!selectedExpression &&
|
|
791
|
+
!(firstArgSchema === null || firstArgSchema === void 0 ? void 0 : firstArgSchema.allowed_values) &&
|
|
792
|
+
!(firstArgSchema === null || firstArgSchema === void 0 ? void 0 : firstArgSchema.element_allowed_values), level: level + 1, type: firstParamType, defaultType: (firstArgument === null || firstArgument === void 0 ? void 0 : firstArgument.allowed_values) || (firstArgument === null || firstArgument === void 0 ? void 0 : firstArgument.element_allowed_values) ?
|
|
793
|
+
firstArgument === null || firstArgument === void 0 ? void 0 : firstArgument.type.base_type
|
|
794
|
+
: firstParamType,
|
|
795
|
+
// an argument of a type the catalogue does not list takes what its base type takes
|
|
796
|
+
returnType: types.getAcceptedTypes(firstArgSchema === null || firstArgSchema === void 0 ? void 0 : firstArgSchema.ui_type, firstArgSchema === null || firstArgSchema === void 0 ? void 0 : firstArgSchema.base_type), value: firstArgument === null || firstArgument === void 0 ? void 0 : firstArgument.value, isFunction: firstArgument === null || firstArgument === void 0 ? void 0 : firstArgument.is_expression, onChange: handleFirstParamChange, templates: localTemplates, allowTemplates: true, filterTemplatesByType: false, allowCustomValues: !!(firstArgument === null || firstArgument === void 0 ? void 0 : firstArgument.allowed_values) ||
|
|
797
|
+
!!(firstArgument === null || firstArgument === void 0 ? void 0 : firstArgument.element_allowed_values) ||
|
|
798
|
+
// an untyped operand is written as text from the start, as a typed one is once
|
|
799
|
+
// it has a type: a template chosen into it is a chip, with text around it
|
|
800
|
+
((!!(firstArgument === null || firstArgument === void 0 ? void 0 : firstArgument.type) || (0, optionUiTypes_1.isUntypedOptionType)(firstArgSchema === null || firstArgSchema === void 0 ? void 0 : firstArgSchema.ui_type)) &&
|
|
801
|
+
!serverExpression), filterTemplatesFunc: function (templates) {
|
|
777
802
|
var _a;
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
803
|
+
// PORT NOTE: `?.` on `items` added — with no templates at all
|
|
804
|
+
// (FormEngine with templates off) the IDE original crashes on
|
|
805
|
+
// `{}.items.filter`.
|
|
806
|
+
var filteredTemplates = (_a = templates === null || templates === void 0 ? void 0 : templates.items) === null || _a === void 0 ? void 0 : _a.filter(function (item) {
|
|
807
|
+
var _a;
|
|
808
|
+
return serverExpression ? ((_a = item.metadata) === null || _a === void 0 ? void 0 : _a.dataRole) === 'record' : true;
|
|
809
|
+
});
|
|
810
|
+
return __assign(__assign({}, templates), { items: filteredTemplates });
|
|
811
|
+
}, fluid: phone, fixed: !phone, disableManagement: true, disabled: readOnly, allowed_values: firstArgSchema === null || firstArgSchema === void 0 ? void 0 : firstArgSchema.allowed_values, element_allowed_values: firstArgSchema === null || firstArgSchema === void 0 ? void 0 : firstArgSchema.element_allowed_values, menuItems: isExpressionServerHandled ? undefined : (buildCustomTemplateItems(firstArgSchema, function (type, removeTemplate) {
|
|
784
812
|
removeTemplate === null || removeTemplate === void 0 ? void 0 : removeTemplate();
|
|
785
813
|
updateArg(undefined, 0, type.name === 'context' ? undefined : type.name);
|
|
786
|
-
}), menuActions: argMenuActions === null || argMenuActions === void 0 ? void 0 : argMenuActions[0], menuTrailingItems: argRemoveMenuItems === null || argRemoveMenuItems === void 0 ? void 0 : argRemoveMenuItems[0], reorder: props.reorder, expressions: props.expressions, expressions_url: expressionsUrl }, "".concat(argsGeneration, "-").concat(firstParamType).concat(selectedExpression === null || selectedExpression === void 0 ? void 0 : selectedExpression.name)) }), (firstArgSchema === null || firstArgSchema === void 0 ? void 0 : firstArgSchema.label_after) && ((0, jsx_runtime_1.jsx)(argumentDetail_1.ExpressionArgumentDetail, { label: firstArgSchema.label_after })), selectedExpression
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
814
|
+
})), menuActions: argMenuActions === null || argMenuActions === void 0 ? void 0 : argMenuActions[0], menuTrailingItems: argRemoveMenuItems === null || argRemoveMenuItems === void 0 ? void 0 : argRemoveMenuItems[0], reorder: props.reorder, expressions: props.expressions, expressions_url: expressionsUrl }, "".concat(argsGeneration, "-").concat(firstParamType).concat(selectedExpression === null || selectedExpression === void 0 ? void 0 : selectedExpression.name)) }), (firstArgSchema === null || firstArgSchema === void 0 ? void 0 : firstArgSchema.label_after) && ((0, jsx_runtime_1.jsx)(argumentDetail_1.ExpressionArgumentDetail, { label: firstArgSchema.label_after })), selectedExpression ?
|
|
815
|
+
restOfArgs === null || restOfArgs === void 0 ? void 0 : restOfArgs.map(function (arg, index) {
|
|
816
|
+
var _a, _b, _c, _d, _f, _g, _h;
|
|
817
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(arg === null || arg === void 0 ? void 0 : arg.label_before) && (0, jsx_runtime_1.jsx)(argumentDetail_1.ExpressionArgumentDetail, { label: arg.label_before }), (0, jsx_runtime_1.jsx)(argumentWrapper_1.ExpressionBuilderArgumentWrapper, { readOnly: readOnly, expressions: expressions.value, arg: __assign(__assign({}, rest[index]), { type: (0, expressions_1.getArgumentType)(expressions.value, rest[index], arg) }), schema: arg, onTypeChange: function (value) {
|
|
818
|
+
updateArg(undefined, index + 1, value === 'context' ? undefined : value);
|
|
819
|
+
}, onRemoveArgClick: function () {
|
|
820
|
+
removeVarArg(index + 1);
|
|
821
|
+
}, hasMultipleArgs: removeArgInline, fluid: phone, reorder: argReorderSurfaces, argIndex: index + 1, argCount: argCount, dragOver: isDragOverArg(index + 1), onMoveArg: moveVarArg, onArgDragStart: handleArgDragStart, onArgDragOver: handleArgDragOver, onArgDrop: handleArgDrop, onArgDragEnd: handleArgDragEnd, children: (0, jsx_runtime_1.jsx)(TemplateField_1.TemplateField, { minimal: true, component: AutoFormField_1.AutoFormField, componentOverrides: componentOverrides, textWidth: 'content',
|
|
822
|
+
// SEAM (reqraft): same as the first operand above.
|
|
823
|
+
extraActions: extraActions, level: level + 1, allowFunctions: !(arg === null || arg === void 0 ? void 0 : arg.allowed_values) && !(arg === null || arg === void 0 ? void 0 : arg.element_allowed_values), isFunction: (_a = rest[index]) === null || _a === void 0 ? void 0 : _a.is_expression,
|
|
824
|
+
// An empty argument has no value to take a type from; fall
|
|
825
|
+
// back to the type the catalogue declares for it, as the
|
|
826
|
+
// first-argument mount already does. Without this an
|
|
827
|
+
// empty bool argument rendered as an untyped `auto` field
|
|
828
|
+
// — a type picker under a label that already said
|
|
829
|
+
// "true or false" — and an empty `any` argument never
|
|
830
|
+
// qualified for the template-selector default, because
|
|
831
|
+
// that rule reads `type`, and `type` was undefined.
|
|
832
|
+
type: (_c = (_b = rest[index]) === null || _b === void 0 ? void 0 : _b.type) !== null && _c !== void 0 ? _c : arg.ui_type, defaultType: arg.allowed_values || arg.element_allowed_values ?
|
|
833
|
+
arg.ui_type
|
|
834
|
+
: ((_f = (_d = rest[index]) === null || _d === void 0 ? void 0 : _d.type) !== null && _f !== void 0 ? _f : arg.ui_type),
|
|
835
|
+
// an argument of a type the catalogue does not list takes what its base type takes
|
|
836
|
+
returnType: types.getAcceptedTypes(arg.ui_type, arg.base_type), canBeNull: false, value: (_g = rest[index]) === null || _g === void 0 ? void 0 : _g.value, templates: localTemplates, allowTemplates: !(arg === null || arg === void 0 ? void 0 : arg.allowed_values) && !(arg === null || arg === void 0 ? void 0 : arg.element_allowed_values), filterTemplatesByType: false, allowCustomValues: !!arg.allowed_values ||
|
|
837
|
+
!!arg.element_allowed_values ||
|
|
838
|
+
!!((_h = rest[index]) === null || _h === void 0 ? void 0 : _h.type) ||
|
|
839
|
+
!!arg.default_value ||
|
|
840
|
+
// an untyped operand is written as text from the start (see the first operand)
|
|
841
|
+
(0, optionUiTypes_1.isUntypedOptionType)(arg.ui_type), onChange: (function (_name, value, type, isFunction) {
|
|
842
|
+
updateArg(value, index + 1, isFunction ? undefined : type, isFunction);
|
|
843
|
+
}), fluid: phone, fixed: !phone, disableManagement: true, disabled: readOnly, menuItems: buildCustomTemplateItems(arg, function (type, removeTemplate) {
|
|
844
|
+
removeTemplate === null || removeTemplate === void 0 ? void 0 : removeTemplate();
|
|
845
|
+
updateArg(undefined, index + 1, type.name === 'context' ? undefined : type.name);
|
|
846
|
+
}), menuActions: argMenuActions === null || argMenuActions === void 0 ? void 0 : argMenuActions[index + 1], menuTrailingItems: argRemoveMenuItems === null || argRemoveMenuItems === void 0 ? void 0 : argRemoveMenuItems[index + 1], reorder: props.reorder, expressions: props.expressions, expressions_url: expressionsUrl, allowed_values: arg === null || arg === void 0 ? void 0 : arg.allowed_values, element_allowed_values: arg === null || arg === void 0 ? void 0 : arg.element_allowed_values, ui_element_type: arg === null || arg === void 0 ? void 0 : arg.ui_element_type }, "".concat(argsGeneration, "-").concat(index, "-").concat(arg.ui_type, "-").concat(arg.display_name, "-").concat(level + 1)) }), (arg === null || arg === void 0 ? void 0 : arg.label_after) && (0, jsx_runtime_1.jsx)(argumentDetail_1.ExpressionArgumentDetail, { label: arg.label_after })] }, "".concat(argsGeneration, "-").concat(index, "-").concat(arg.ui_type, "-").concat(arg.display_name)));
|
|
847
|
+
})
|
|
848
|
+
: null, canAddArg && ((0, jsx_runtime_1.jsx)(argumentSlot_1.ExpressionBuilderAddArgumentSlot, { argumentName: (_r = selectedExpression.args[0]) === null || _r === void 0 ? void 0 : _r.display_name, disabled: !(0, validations_1.validateField)('expression', value, { expressions: expressions.value }), droppable: isSlotDropTarget, dragOver: isDragOverArg(argCount), onClick: handleAddArgumentClick, onDragOver: handleSlotDragOver, onDrop: handleSlotDrop }))] }), partVerdict && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreVerticalSpacer, { height: 5 }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { minimal: true, className: 'expression-condition-part-verdict', "data-verdict": partVerdict, icon: partVerdict === 'error' ? 'ErrorWarningLine' : 'AlertLine', intent: partVerdict === 'error' ? 'danger' : 'warning', size: 'tiny', wrap: true, label: (_s = part === null || part === void 0 ? void 0 : part.message) !== null && _s !== void 0 ? _s : (partVerdict === 'error' ?
|
|
821
849
|
(0, expressions_1.conditionErrorText)(types.getTypeSentenceForm((0, expressions_1.conditionBaseType)(part.type)), part.type)
|
|
822
850
|
: (0, expressions_1.conditionByTruthinessText)(part.type)) })] })), condition === 'warning' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreVerticalSpacer, { height: 5 }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { minimal: true, className: 'expression-condition-verdict', icon: 'AlertLine', intent: 'warning', size: 'tiny', wrap: true,
|
|
823
851
|
// the server's words for the whole condition, where it said any; the same rule's own otherwise
|
|
824
|
-
label: conditionMessage !== null && conditionMessage !== void 0 ? conditionMessage : (0, expressions_1.conditionByTruthinessText)(expressionGivesType) })] })), !isReturnTypeMatching && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreVerticalSpacer, { height: 5 }), takesCondition && !!expressionGivesType && (0, expressions_1.isTextOrDateType)(expressionGivesType) ?
|
|
825
|
-
|
|
826
|
-
|
|
852
|
+
label: conditionMessage !== null && conditionMessage !== void 0 ? conditionMessage : (0, expressions_1.conditionByTruthinessText)(expressionGivesType) })] })), !isReturnTypeMatching && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreVerticalSpacer, { height: 5 }), takesCondition && !!expressionGivesType && (0, expressions_1.isTextOrDateType)(expressionGivesType) ?
|
|
853
|
+
// a condition that gives text, a date or a time: say how to make it one
|
|
854
|
+
(0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { minimal: true, className: 'expression-condition-verdict', icon: 'ErrorWarningLine', intent: 'danger', size: 'tiny', wrap: true, label: (_t = (level === 0 ? conditionMessage : undefined)) !== null && _t !== void 0 ? _t : (0, expressions_1.conditionErrorText)(types.getTypeSentenceForm((0, expressions_1.conditionBaseType)(expressionGivesType)), expressionGivesType) })
|
|
855
|
+
: (0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { minimal: true, icon: 'ErrorWarningLine', intent: 'danger', size: 'tiny', wrap: true, label: (0, expressions_1.expressionTypeMismatchText)(expressionGivesType ? types.getTypeSentenceForm(expressionGivesType) : undefined, expectedReturnTypeText, (0, expressions_1.expressionTypeSource)(expressionGivesType, operands, function (type) { return types.getTypeSentenceForm(type); }, selectedExpression)) })] })), selectedExpression && !validationData.isValid ?
|
|
856
|
+
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreVerticalSpacer, { height: 5 }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { minimal: true, icon: 'ErrorWarningLine', intent: 'danger', size: 'tiny', wrap: true, label: validationData.reason || 'Qorus could not check this expression.' })] })
|
|
857
|
+
: null, noOperationYet && !readOnly && !nothingChosenYet ?
|
|
827
858
|
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreVerticalSpacer, { height: 5 }), (0, jsx_runtime_1.jsx)(reqore_1.ReqoreTag, { minimal: true, className: 'expression-no-operation-yet', icon: 'ErrorWarningLine', intent: 'warning', size: 'tiny', wrap: true, label: (0, exports.noOperationYetText)(isChild || level > 0, takesText) })] })
|
|
828
859
|
: null] }));
|
|
829
860
|
};
|
|
@@ -931,8 +962,8 @@ var ExpressionBuilder = function (_a) {
|
|
|
931
962
|
show: level === 0,
|
|
932
963
|
onClick: function () { return setShowSummary(!showSummary); },
|
|
933
964
|
icon: 'InformationLine',
|
|
934
|
-
tooltip: showSummary
|
|
935
|
-
|
|
965
|
+
tooltip: showSummary ?
|
|
966
|
+
'Hide explanation of this expression'
|
|
936
967
|
: 'Show explanation of this expression',
|
|
937
968
|
fixed: true,
|
|
938
969
|
},
|