@uipath/apollo-react 6.45.3 → 6.47.0
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/canvas/components/Guardrails/builder-types.cjs +47 -0
- package/dist/canvas/components/Guardrails/builder-types.d.ts +129 -0
- package/dist/canvas/components/Guardrails/builder-types.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/builder-types.js +10 -0
- package/dist/canvas/components/Guardrails/builder-utils.cjs +144 -0
- package/dist/canvas/components/Guardrails/builder-utils.d.ts +18 -0
- package/dist/canvas/components/Guardrails/builder-utils.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/builder-utils.js +98 -0
- package/dist/canvas/components/Guardrails/components/enum-list-chips-field.cjs +85 -0
- package/dist/canvas/components/Guardrails/components/enum-list-chips-field.d.ts +3 -0
- package/dist/canvas/components/Guardrails/components/enum-list-chips-field.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/enum-list-chips-field.js +51 -0
- package/dist/canvas/components/Guardrails/components/escalate-action-fields.cjs +268 -0
- package/dist/canvas/components/Guardrails/components/escalate-action-fields.d.ts +23 -0
- package/dist/canvas/components/Guardrails/components/escalate-action-fields.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/escalate-action-fields.js +234 -0
- package/dist/canvas/components/Guardrails/components/field-shell.cjs +46 -0
- package/dist/canvas/components/Guardrails/components/field-shell.d.ts +7 -0
- package/dist/canvas/components/Guardrails/components/field-shell.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/field-shell.js +12 -0
- package/dist/canvas/components/Guardrails/components/guardrail-action-section.cjs +173 -0
- package/dist/canvas/components/Guardrails/components/guardrail-action-section.d.ts +22 -0
- package/dist/canvas/components/Guardrails/components/guardrail-action-section.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/guardrail-action-section.js +139 -0
- package/dist/canvas/components/Guardrails/components/guardrail-chip.cjs +63 -0
- package/dist/canvas/components/Guardrails/components/guardrail-chip.d.ts +11 -0
- package/dist/canvas/components/Guardrails/components/guardrail-chip.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/guardrail-chip.js +26 -0
- package/dist/canvas/components/Guardrails/components/guardrail-scope-selector.cjs +217 -0
- package/dist/canvas/components/Guardrails/components/guardrail-scope-selector.d.ts +15 -0
- package/dist/canvas/components/Guardrails/components/guardrail-scope-selector.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/guardrail-scope-selector.js +183 -0
- package/dist/canvas/components/Guardrails/components/guardrail-status-banner.cjs +61 -0
- package/dist/canvas/components/Guardrails/components/guardrail-status-banner.d.ts +6 -0
- package/dist/canvas/components/Guardrails/components/guardrail-status-banner.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/guardrail-status-banner.js +27 -0
- package/dist/canvas/components/Guardrails/components/map-enum-field.cjs +116 -0
- package/dist/canvas/components/Guardrails/components/map-enum-field.d.ts +3 -0
- package/dist/canvas/components/Guardrails/components/map-enum-field.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/map-enum-field.js +82 -0
- package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.cjs +69 -0
- package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.d.ts +10 -0
- package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.js +35 -0
- package/dist/canvas/components/Guardrails/components/parameter-label.cjs +60 -0
- package/dist/canvas/components/Guardrails/components/parameter-label.d.ts +11 -0
- package/dist/canvas/components/Guardrails/components/parameter-label.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/parameter-label.js +26 -0
- package/dist/canvas/components/Guardrails/form-schema-builder.cjs +246 -0
- package/dist/canvas/components/Guardrails/form-schema-builder.d.ts +15 -0
- package/dist/canvas/components/Guardrails/form-schema-builder.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/form-schema-builder.js +197 -0
- package/dist/canvas/components/Guardrails/guardrail-builder.cjs +369 -0
- package/dist/canvas/components/Guardrails/guardrail-builder.d.ts +41 -0
- package/dist/canvas/components/Guardrails/guardrail-builder.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/guardrail-builder.js +335 -0
- package/dist/canvas/components/Guardrails/guardrail-form-layout.cjs +138 -0
- package/dist/canvas/components/Guardrails/guardrail-form-layout.d.ts +24 -0
- package/dist/canvas/components/Guardrails/guardrail-form-layout.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/guardrail-form-layout.js +104 -0
- package/dist/canvas/components/Guardrails/guardrail-validator-form.cjs +199 -0
- package/dist/canvas/components/Guardrails/guardrail-validator-form.d.ts +3 -0
- package/dist/canvas/components/Guardrails/guardrail-validator-form.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/guardrail-validator-form.js +165 -0
- package/dist/canvas/components/Guardrails/i18n.cjs +436 -0
- package/dist/canvas/components/Guardrails/i18n.d.ts +76 -0
- package/dist/canvas/components/Guardrails/i18n.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/i18n.js +384 -0
- package/dist/canvas/components/Guardrails/index.cjs +112 -0
- package/dist/canvas/components/Guardrails/index.d.ts +16 -0
- package/dist/canvas/components/Guardrails/index.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/index.js +9 -0
- package/dist/canvas/components/Guardrails/render-parameter-bridge.cjs +60 -0
- package/dist/canvas/components/Guardrails/render-parameter-bridge.d.ts +13 -0
- package/dist/canvas/components/Guardrails/render-parameter-bridge.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/render-parameter-bridge.js +23 -0
- package/dist/canvas/components/Guardrails/types.cjs +18 -0
- package/dist/canvas/components/Guardrails/types.d.ts +69 -0
- package/dist/canvas/components/Guardrails/types.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/types.js +0 -0
- package/dist/canvas/components/Guardrails/use-metadata-form-bridge.cjs +144 -0
- package/dist/canvas/components/Guardrails/use-metadata-form-bridge.d.ts +13 -0
- package/dist/canvas/components/Guardrails/use-metadata-form-bridge.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/use-metadata-form-bridge.js +110 -0
- package/dist/canvas/components/Guardrails/utils.cjs +174 -0
- package/dist/canvas/components/Guardrails/utils.d.ts +9 -0
- package/dist/canvas/components/Guardrails/utils.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/utils.js +122 -0
- package/dist/canvas/components/index.cjs +41 -34
- package/dist/canvas/components/index.d.ts +1 -0
- package/dist/canvas/components/index.d.ts.map +1 -1
- package/dist/canvas/components/index.js +1 -0
- package/dist/canvas/locales/de.cjs +1 -1
- package/dist/canvas/locales/de.d.ts.map +1 -1
- package/dist/canvas/locales/de.js +1 -1
- package/dist/canvas/locales/en.cjs +1 -1
- package/dist/canvas/locales/en.d.ts.map +1 -1
- package/dist/canvas/locales/en.js +1 -1
- package/dist/canvas/locales/es-MX.cjs +1 -1
- package/dist/canvas/locales/es-MX.d.ts.map +1 -1
- package/dist/canvas/locales/es-MX.js +1 -1
- package/dist/canvas/locales/es.cjs +1 -1
- package/dist/canvas/locales/es.d.ts.map +1 -1
- package/dist/canvas/locales/es.js +1 -1
- package/dist/canvas/locales/fr.cjs +1 -1
- package/dist/canvas/locales/fr.d.ts.map +1 -1
- package/dist/canvas/locales/fr.js +1 -1
- package/dist/canvas/locales/ja.cjs +1 -1
- package/dist/canvas/locales/ja.d.ts.map +1 -1
- package/dist/canvas/locales/ja.js +1 -1
- package/dist/canvas/locales/ko.cjs +1 -1
- package/dist/canvas/locales/ko.d.ts.map +1 -1
- package/dist/canvas/locales/ko.js +1 -1
- package/dist/canvas/locales/pt-BR.cjs +1 -1
- package/dist/canvas/locales/pt-BR.d.ts.map +1 -1
- package/dist/canvas/locales/pt-BR.js +1 -1
- package/dist/canvas/locales/pt.cjs +1 -1
- package/dist/canvas/locales/pt.d.ts.map +1 -1
- package/dist/canvas/locales/pt.js +1 -1
- package/dist/canvas/locales/ro.cjs +1 -1
- package/dist/canvas/locales/ro.d.ts.map +1 -1
- package/dist/canvas/locales/ro.js +1 -1
- package/dist/canvas/locales/ru.cjs +1 -1
- package/dist/canvas/locales/ru.d.ts.map +1 -1
- package/dist/canvas/locales/ru.js +1 -1
- package/dist/canvas/locales/tr.cjs +1 -1
- package/dist/canvas/locales/tr.d.ts.map +1 -1
- package/dist/canvas/locales/tr.js +1 -1
- package/dist/canvas/locales/zh-CN.cjs +1 -1
- package/dist/canvas/locales/zh-CN.d.ts.map +1 -1
- package/dist/canvas/locales/zh-CN.js +1 -1
- package/dist/canvas/locales/zh-TW.cjs +1 -1
- package/dist/canvas/locales/zh-TW.d.ts.map +1 -1
- package/dist/canvas/locales/zh-TW.js +1 -1
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/i18n/index.cjs +5 -1
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +2 -1
- package/dist/icons/MaestroAutomate.cjs +71 -0
- package/dist/icons/MaestroAutomate.d.ts +7 -0
- package/dist/icons/MaestroAutomate.d.ts.map +1 -0
- package/dist/icons/MaestroAutomate.js +24 -0
- package/dist/icons/MaestroAutomateFlat.cjs +71 -0
- package/dist/icons/MaestroAutomateFlat.d.ts +7 -0
- package/dist/icons/MaestroAutomateFlat.d.ts.map +1 -0
- package/dist/icons/MaestroAutomateFlat.js +24 -0
- package/dist/icons/MaestroBpmn.cjs +71 -0
- package/dist/icons/MaestroBpmn.d.ts +7 -0
- package/dist/icons/MaestroBpmn.d.ts.map +1 -0
- package/dist/icons/MaestroBpmn.js +24 -0
- package/dist/icons/MaestroBpmnFlat.cjs +71 -0
- package/dist/icons/MaestroBpmnFlat.d.ts +7 -0
- package/dist/icons/MaestroBpmnFlat.d.ts.map +1 -0
- package/dist/icons/MaestroBpmnFlat.js +24 -0
- package/dist/icons/MaestroCase.cjs +71 -0
- package/dist/icons/MaestroCase.d.ts +7 -0
- package/dist/icons/MaestroCase.d.ts.map +1 -0
- package/dist/icons/MaestroCase.js +24 -0
- package/dist/icons/MaestroCaseFlat.cjs +71 -0
- package/dist/icons/MaestroCaseFlat.d.ts +7 -0
- package/dist/icons/MaestroCaseFlat.d.ts.map +1 -0
- package/dist/icons/MaestroCaseFlat.js +24 -0
- package/dist/icons/MaestroFlow.cjs +71 -0
- package/dist/icons/MaestroFlow.d.ts +7 -0
- package/dist/icons/MaestroFlow.d.ts.map +1 -0
- package/dist/icons/MaestroFlow.js +24 -0
- package/dist/icons/MaestroFlowFlat.cjs +71 -0
- package/dist/icons/MaestroFlowFlat.d.ts +7 -0
- package/dist/icons/MaestroFlowFlat.d.ts.map +1 -0
- package/dist/icons/MaestroFlowFlat.js +24 -0
- package/dist/icons/index.cjs +68 -4
- package/dist/icons/index.d.ts +8 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/index.js +9 -1
- package/dist/test/setup.d.ts.map +1 -1
- package/package.json +12 -4
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
ParameterLabel: ()=>ParameterLabel
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
31
|
+
function ParameterLabel({ paramDef, labels, htmlFor, asTextHeader = false, id }) {
|
|
32
|
+
const content = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
33
|
+
children: [
|
|
34
|
+
paramDef.label,
|
|
35
|
+
paramDef.required && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.RequiredIndicator, {}),
|
|
36
|
+
paramDef.tooltip && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.InfoTooltip, {
|
|
37
|
+
content: paramDef.tooltip,
|
|
38
|
+
"aria-label": labels.moreInformation
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
if (asTextHeader) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
43
|
+
id: id,
|
|
44
|
+
"data-slot": "guardrail-parameter-label",
|
|
45
|
+
className: "text-xs font-medium text-foreground",
|
|
46
|
+
children: content
|
|
47
|
+
});
|
|
48
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Label, {
|
|
49
|
+
id: id,
|
|
50
|
+
htmlFor: htmlFor,
|
|
51
|
+
children: content
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
exports.ParameterLabel = __webpack_exports__.ParameterLabel;
|
|
55
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
56
|
+
"ParameterLabel"
|
|
57
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
58
|
+
Object.defineProperty(exports, '__esModule', {
|
|
59
|
+
value: true
|
|
60
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GuardrailValidatorFormLabels } from '../i18n';
|
|
2
|
+
import type { GuardrailParameterDefinition } from '../types';
|
|
3
|
+
export interface ParameterLabelProps {
|
|
4
|
+
paramDef: GuardrailParameterDefinition;
|
|
5
|
+
labels: GuardrailValidatorFormLabels;
|
|
6
|
+
htmlFor?: string;
|
|
7
|
+
asTextHeader?: boolean;
|
|
8
|
+
id?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function ParameterLabel({ paramDef, labels, htmlFor, asTextHeader, id, }: ParameterLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=parameter-label.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameter-label.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Guardrails/components/parameter-label.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,4BAA4B,CAAC;IACvC,MAAM,EAAE,4BAA4B,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IAMvB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAGD,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,MAAM,EACN,OAAO,EACP,YAAoB,EACpB,EAAE,GACH,EAAE,mBAAmB,2CA0BrB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { InfoTooltip, Label, RequiredIndicator } from "@uipath/apollo-wind";
|
|
3
|
+
function ParameterLabel({ paramDef, labels, htmlFor, asTextHeader = false, id }) {
|
|
4
|
+
const content = /*#__PURE__*/ jsxs(Fragment, {
|
|
5
|
+
children: [
|
|
6
|
+
paramDef.label,
|
|
7
|
+
paramDef.required && /*#__PURE__*/ jsx(RequiredIndicator, {}),
|
|
8
|
+
paramDef.tooltip && /*#__PURE__*/ jsx(InfoTooltip, {
|
|
9
|
+
content: paramDef.tooltip,
|
|
10
|
+
"aria-label": labels.moreInformation
|
|
11
|
+
})
|
|
12
|
+
]
|
|
13
|
+
});
|
|
14
|
+
if (asTextHeader) return /*#__PURE__*/ jsx("div", {
|
|
15
|
+
id: id,
|
|
16
|
+
"data-slot": "guardrail-parameter-label",
|
|
17
|
+
className: "text-xs font-medium text-foreground",
|
|
18
|
+
children: content
|
|
19
|
+
});
|
|
20
|
+
return /*#__PURE__*/ jsx(Label, {
|
|
21
|
+
id: id,
|
|
22
|
+
htmlFor: htmlFor,
|
|
23
|
+
children: content
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export { ParameterLabel };
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
GUARDRAIL_ENUM_LIST_CHIPS_COMPONENT: ()=>GUARDRAIL_ENUM_LIST_CHIPS_COMPONENT,
|
|
28
|
+
GUARDRAIL_MAP_ENUM_COMPONENT: ()=>GUARDRAIL_MAP_ENUM_COMPONENT,
|
|
29
|
+
coerceGuardrailParameterValue: ()=>coerceGuardrailParameterValue,
|
|
30
|
+
GUARDRAIL_RENDER_PARAMETER_COMPONENT: ()=>GUARDRAIL_RENDER_PARAMETER_COMPONENT,
|
|
31
|
+
MAX_INLINE_ENUM_OPTIONS: ()=>MAX_INLINE_ENUM_OPTIONS,
|
|
32
|
+
buildGuardrailFormSchema: ()=>buildGuardrailFormSchema
|
|
33
|
+
});
|
|
34
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
35
|
+
const GUARDRAIL_ENUM_LIST_CHIPS_COMPONENT = 'guardrail-enum-list-chips';
|
|
36
|
+
const GUARDRAIL_MAP_ENUM_COMPONENT = 'guardrail-map-enum';
|
|
37
|
+
const GUARDRAIL_RENDER_PARAMETER_COMPONENT = 'guardrail-render-parameter';
|
|
38
|
+
const MAX_INLINE_ENUM_OPTIONS = 8;
|
|
39
|
+
function buildFieldValidation(def, labels) {
|
|
40
|
+
const validation = {};
|
|
41
|
+
const messages = {};
|
|
42
|
+
if (def.required) {
|
|
43
|
+
validation.required = true;
|
|
44
|
+
messages.required = labels.requiredError;
|
|
45
|
+
}
|
|
46
|
+
if ('number' === def.type) {
|
|
47
|
+
if (null != def.min) {
|
|
48
|
+
validation.min = def.min;
|
|
49
|
+
messages.min = (0, apollo_wind_namespaceObject.formatTemplate)(labels.minError, {
|
|
50
|
+
min: String(def.min)
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (null != def.max) {
|
|
54
|
+
validation.max = def.max;
|
|
55
|
+
messages.max = (0, apollo_wind_namespaceObject.formatTemplate)(labels.maxError, {
|
|
56
|
+
max: String(def.max)
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (0 === Object.keys(validation).length) return;
|
|
61
|
+
validation.messages = messages;
|
|
62
|
+
return validation;
|
|
63
|
+
}
|
|
64
|
+
function buildGuardrailFormSchema(definitions, labels, options) {
|
|
65
|
+
const initialById = new Map((options?.initialParameters ?? []).map((p)=>[
|
|
66
|
+
p.id,
|
|
67
|
+
p
|
|
68
|
+
]));
|
|
69
|
+
const fields = definitions.map((def)=>buildGuardrailField(def, definitions, labels, initialById, options));
|
|
70
|
+
return {
|
|
71
|
+
id: 'guardrail-validator-form',
|
|
72
|
+
title: '',
|
|
73
|
+
actions: [],
|
|
74
|
+
sections: [
|
|
75
|
+
{
|
|
76
|
+
id: 'parameters',
|
|
77
|
+
fields
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function customValueTypeFor(type) {
|
|
83
|
+
switch(type){
|
|
84
|
+
case 'text':
|
|
85
|
+
case 'enum':
|
|
86
|
+
return 'string';
|
|
87
|
+
case 'number':
|
|
88
|
+
return 'number';
|
|
89
|
+
case 'boolean':
|
|
90
|
+
return 'boolean';
|
|
91
|
+
case 'enum-list':
|
|
92
|
+
case 'text-list':
|
|
93
|
+
return 'string-array';
|
|
94
|
+
default:
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function buildGuardrailField(def, definitions, labels, initialById, options) {
|
|
99
|
+
const initial = initialById.get(def.id);
|
|
100
|
+
const base = {
|
|
101
|
+
name: def.id,
|
|
102
|
+
label: def.label,
|
|
103
|
+
tooltip: def.tooltip,
|
|
104
|
+
tooltipAriaLabel: labels.moreInformation,
|
|
105
|
+
validation: buildFieldValidation(def, labels)
|
|
106
|
+
};
|
|
107
|
+
if (options?.overriddenIds?.has(def.id)) return {
|
|
108
|
+
...base,
|
|
109
|
+
type: 'custom',
|
|
110
|
+
component: GUARDRAIL_RENDER_PARAMETER_COMPONENT,
|
|
111
|
+
valueType: customValueTypeFor(def.type),
|
|
112
|
+
defaultValue: initial?.value
|
|
113
|
+
};
|
|
114
|
+
switch(def.type){
|
|
115
|
+
case 'number':
|
|
116
|
+
return {
|
|
117
|
+
...base,
|
|
118
|
+
type: 'number',
|
|
119
|
+
min: def.min,
|
|
120
|
+
max: def.max,
|
|
121
|
+
step: def.step,
|
|
122
|
+
defaultValue: (initial?.$parameterType === 'number' ? initial.value : def.defaultValue) ?? 0
|
|
123
|
+
};
|
|
124
|
+
case 'text':
|
|
125
|
+
return {
|
|
126
|
+
...base,
|
|
127
|
+
type: 'textarea',
|
|
128
|
+
minRows: 3,
|
|
129
|
+
maxLength: def.maxLength,
|
|
130
|
+
defaultValue: initial?.$parameterType === 'text' ? initial.value : def.defaultValue ?? ''
|
|
131
|
+
};
|
|
132
|
+
case 'boolean':
|
|
133
|
+
return {
|
|
134
|
+
...base,
|
|
135
|
+
type: 'switch',
|
|
136
|
+
defaultValue: initial?.$parameterType === 'boolean' ? initial.value : def.defaultValue ?? false
|
|
137
|
+
};
|
|
138
|
+
case 'enum':
|
|
139
|
+
{
|
|
140
|
+
const current = initial?.$parameterType === 'enum' ? initial.value : def.defaultValue ?? '';
|
|
141
|
+
const catalog = (def.options ?? []).map((opt)=>({
|
|
142
|
+
value: opt,
|
|
143
|
+
label: def.optionLabels?.[opt] ?? opt
|
|
144
|
+
}));
|
|
145
|
+
const synthetic = options?.enumSyntheticValues?.[def.id];
|
|
146
|
+
const opts = synthetic && !catalog.some((opt)=>opt.value === synthetic) ? [
|
|
147
|
+
...catalog,
|
|
148
|
+
{
|
|
149
|
+
value: synthetic,
|
|
150
|
+
label: def.optionLabels?.[synthetic] ?? synthetic
|
|
151
|
+
}
|
|
152
|
+
] : catalog;
|
|
153
|
+
return {
|
|
154
|
+
...base,
|
|
155
|
+
type: 'select',
|
|
156
|
+
placeholder: labels.enumPlaceholder,
|
|
157
|
+
options: opts,
|
|
158
|
+
defaultValue: current
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
case 'enum-list':
|
|
162
|
+
{
|
|
163
|
+
const selected = initial?.$parameterType === 'enum-list' ? initial.value : def.defaultValue ?? [];
|
|
164
|
+
if ((def.options ?? []).length <= MAX_INLINE_ENUM_OPTIONS) return {
|
|
165
|
+
...base,
|
|
166
|
+
type: 'custom',
|
|
167
|
+
component: GUARDRAIL_ENUM_LIST_CHIPS_COMPONENT,
|
|
168
|
+
valueType: customValueTypeFor(def.type),
|
|
169
|
+
defaultValue: selected,
|
|
170
|
+
componentProps: {
|
|
171
|
+
paramDef: def,
|
|
172
|
+
labels
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
return {
|
|
176
|
+
...base,
|
|
177
|
+
type: 'multiselect',
|
|
178
|
+
placeholder: labels.enumListPlaceholder,
|
|
179
|
+
options: (def.options ?? []).map((opt)=>({
|
|
180
|
+
value: opt,
|
|
181
|
+
label: def.optionLabels?.[opt] ?? opt
|
|
182
|
+
})),
|
|
183
|
+
defaultValue: selected
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
case 'text-list':
|
|
187
|
+
return {
|
|
188
|
+
...base,
|
|
189
|
+
type: 'string-list',
|
|
190
|
+
maxItems: def.maxItems,
|
|
191
|
+
maxLength: def.maxLength,
|
|
192
|
+
minRows: 2,
|
|
193
|
+
addItemLabel: labels.addItem,
|
|
194
|
+
removeItemAriaLabel: labels.removeItem,
|
|
195
|
+
defaultValue: initial?.$parameterType === 'text-list' ? initial.value : def.defaultValue ?? []
|
|
196
|
+
};
|
|
197
|
+
case 'map-enum':
|
|
198
|
+
{
|
|
199
|
+
const sourceDef = def.keySource ? definitions.find((d)=>d.id === def.keySource) : void 0;
|
|
200
|
+
const sourceInitial = def.keySource ? initialById.get(def.keySource) : void 0;
|
|
201
|
+
const sourceSelection = sourceInitial?.$parameterType === 'enum-list' ? sourceInitial.value : sourceDef?.defaultValue;
|
|
202
|
+
return {
|
|
203
|
+
...base,
|
|
204
|
+
type: 'custom',
|
|
205
|
+
component: GUARDRAIL_MAP_ENUM_COMPONENT,
|
|
206
|
+
defaultValue: initial?.$parameterType === 'map-enum' ? initial.value : void 0,
|
|
207
|
+
componentProps: {
|
|
208
|
+
paramDef: def,
|
|
209
|
+
sourceDef,
|
|
210
|
+
labels,
|
|
211
|
+
sourceSelection
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function coerceGuardrailParameterValue(value, def) {
|
|
218
|
+
switch(def.type){
|
|
219
|
+
case 'number':
|
|
220
|
+
return 'number' != typeof value || Number.isNaN(value) ? 0 : value;
|
|
221
|
+
case 'text':
|
|
222
|
+
case 'enum':
|
|
223
|
+
return value ?? '';
|
|
224
|
+
case 'boolean':
|
|
225
|
+
return value ?? false;
|
|
226
|
+
default:
|
|
227
|
+
return value;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
exports.GUARDRAIL_ENUM_LIST_CHIPS_COMPONENT = __webpack_exports__.GUARDRAIL_ENUM_LIST_CHIPS_COMPONENT;
|
|
231
|
+
exports.GUARDRAIL_MAP_ENUM_COMPONENT = __webpack_exports__.GUARDRAIL_MAP_ENUM_COMPONENT;
|
|
232
|
+
exports.GUARDRAIL_RENDER_PARAMETER_COMPONENT = __webpack_exports__.GUARDRAIL_RENDER_PARAMETER_COMPONENT;
|
|
233
|
+
exports.MAX_INLINE_ENUM_OPTIONS = __webpack_exports__.MAX_INLINE_ENUM_OPTIONS;
|
|
234
|
+
exports.buildGuardrailFormSchema = __webpack_exports__.buildGuardrailFormSchema;
|
|
235
|
+
exports.coerceGuardrailParameterValue = __webpack_exports__.coerceGuardrailParameterValue;
|
|
236
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
237
|
+
"GUARDRAIL_ENUM_LIST_CHIPS_COMPONENT",
|
|
238
|
+
"GUARDRAIL_MAP_ENUM_COMPONENT",
|
|
239
|
+
"GUARDRAIL_RENDER_PARAMETER_COMPONENT",
|
|
240
|
+
"MAX_INLINE_ENUM_OPTIONS",
|
|
241
|
+
"buildGuardrailFormSchema",
|
|
242
|
+
"coerceGuardrailParameterValue"
|
|
243
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
244
|
+
Object.defineProperty(exports, '__esModule', {
|
|
245
|
+
value: true
|
|
246
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FormSchema } from '@uipath/apollo-wind';
|
|
2
|
+
import type { GuardrailValidatorFormLabels } from './i18n';
|
|
3
|
+
import type { GuardrailParameterDefinition, GuardrailValidatorParameter } from './types';
|
|
4
|
+
export declare const GUARDRAIL_ENUM_LIST_CHIPS_COMPONENT = "guardrail-enum-list-chips";
|
|
5
|
+
export declare const GUARDRAIL_MAP_ENUM_COMPONENT = "guardrail-map-enum";
|
|
6
|
+
export declare const GUARDRAIL_RENDER_PARAMETER_COMPONENT = "guardrail-render-parameter";
|
|
7
|
+
export declare const MAX_INLINE_ENUM_OPTIONS = 8;
|
|
8
|
+
export interface BuildGuardrailFormSchemaOptions {
|
|
9
|
+
overriddenIds?: ReadonlySet<string>;
|
|
10
|
+
initialParameters?: GuardrailValidatorParameter[];
|
|
11
|
+
enumSyntheticValues?: Record<string, string>;
|
|
12
|
+
}
|
|
13
|
+
export declare function buildGuardrailFormSchema(definitions: GuardrailParameterDefinition[], labels: GuardrailValidatorFormLabels, options?: BuildGuardrailFormSchemaOptions): FormSchema;
|
|
14
|
+
export declare function coerceGuardrailParameterValue(value: unknown, def: GuardrailParameterDefinition): unknown;
|
|
15
|
+
//# sourceMappingURL=form-schema-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-schema-builder.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/form-schema-builder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkC,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,QAAQ,CAAC;AAC3D,OAAO,KAAK,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAGzF,eAAO,MAAM,mCAAmC,8BAA8B,CAAC;AAC/E,eAAO,MAAM,4BAA4B,uBAAuB,CAAC;AACjE,eAAO,MAAM,oCAAoC,+BAA+B,CAAC;AAGjF,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,MAAM,WAAW,+BAA+B;IAE9C,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAMpC,iBAAiB,CAAC,EAAE,2BAA2B,EAAE,CAAC;IAMlD,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9C;AAkDD,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,4BAA4B,EAAE,EAC3C,MAAM,EAAE,4BAA4B,EACpC,OAAO,CAAC,EAAE,+BAA+B,GACxC,UAAU,CAaZ;AA0LD,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,4BAA4B,GAChC,OAAO,CAYT"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { formatTemplate } from "@uipath/apollo-wind";
|
|
2
|
+
const GUARDRAIL_ENUM_LIST_CHIPS_COMPONENT = 'guardrail-enum-list-chips';
|
|
3
|
+
const GUARDRAIL_MAP_ENUM_COMPONENT = 'guardrail-map-enum';
|
|
4
|
+
const GUARDRAIL_RENDER_PARAMETER_COMPONENT = 'guardrail-render-parameter';
|
|
5
|
+
const MAX_INLINE_ENUM_OPTIONS = 8;
|
|
6
|
+
function buildFieldValidation(def, labels) {
|
|
7
|
+
const validation = {};
|
|
8
|
+
const messages = {};
|
|
9
|
+
if (def.required) {
|
|
10
|
+
validation.required = true;
|
|
11
|
+
messages.required = labels.requiredError;
|
|
12
|
+
}
|
|
13
|
+
if ('number' === def.type) {
|
|
14
|
+
if (null != def.min) {
|
|
15
|
+
validation.min = def.min;
|
|
16
|
+
messages.min = formatTemplate(labels.minError, {
|
|
17
|
+
min: String(def.min)
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
if (null != def.max) {
|
|
21
|
+
validation.max = def.max;
|
|
22
|
+
messages.max = formatTemplate(labels.maxError, {
|
|
23
|
+
max: String(def.max)
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (0 === Object.keys(validation).length) return;
|
|
28
|
+
validation.messages = messages;
|
|
29
|
+
return validation;
|
|
30
|
+
}
|
|
31
|
+
function buildGuardrailFormSchema(definitions, labels, options) {
|
|
32
|
+
const initialById = new Map((options?.initialParameters ?? []).map((p)=>[
|
|
33
|
+
p.id,
|
|
34
|
+
p
|
|
35
|
+
]));
|
|
36
|
+
const fields = definitions.map((def)=>buildGuardrailField(def, definitions, labels, initialById, options));
|
|
37
|
+
return {
|
|
38
|
+
id: 'guardrail-validator-form',
|
|
39
|
+
title: '',
|
|
40
|
+
actions: [],
|
|
41
|
+
sections: [
|
|
42
|
+
{
|
|
43
|
+
id: 'parameters',
|
|
44
|
+
fields
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function customValueTypeFor(type) {
|
|
50
|
+
switch(type){
|
|
51
|
+
case 'text':
|
|
52
|
+
case 'enum':
|
|
53
|
+
return 'string';
|
|
54
|
+
case 'number':
|
|
55
|
+
return 'number';
|
|
56
|
+
case 'boolean':
|
|
57
|
+
return 'boolean';
|
|
58
|
+
case 'enum-list':
|
|
59
|
+
case 'text-list':
|
|
60
|
+
return 'string-array';
|
|
61
|
+
default:
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function buildGuardrailField(def, definitions, labels, initialById, options) {
|
|
66
|
+
const initial = initialById.get(def.id);
|
|
67
|
+
const base = {
|
|
68
|
+
name: def.id,
|
|
69
|
+
label: def.label,
|
|
70
|
+
tooltip: def.tooltip,
|
|
71
|
+
tooltipAriaLabel: labels.moreInformation,
|
|
72
|
+
validation: buildFieldValidation(def, labels)
|
|
73
|
+
};
|
|
74
|
+
if (options?.overriddenIds?.has(def.id)) return {
|
|
75
|
+
...base,
|
|
76
|
+
type: 'custom',
|
|
77
|
+
component: GUARDRAIL_RENDER_PARAMETER_COMPONENT,
|
|
78
|
+
valueType: customValueTypeFor(def.type),
|
|
79
|
+
defaultValue: initial?.value
|
|
80
|
+
};
|
|
81
|
+
switch(def.type){
|
|
82
|
+
case 'number':
|
|
83
|
+
return {
|
|
84
|
+
...base,
|
|
85
|
+
type: 'number',
|
|
86
|
+
min: def.min,
|
|
87
|
+
max: def.max,
|
|
88
|
+
step: def.step,
|
|
89
|
+
defaultValue: (initial?.$parameterType === 'number' ? initial.value : def.defaultValue) ?? 0
|
|
90
|
+
};
|
|
91
|
+
case 'text':
|
|
92
|
+
return {
|
|
93
|
+
...base,
|
|
94
|
+
type: 'textarea',
|
|
95
|
+
minRows: 3,
|
|
96
|
+
maxLength: def.maxLength,
|
|
97
|
+
defaultValue: initial?.$parameterType === 'text' ? initial.value : def.defaultValue ?? ''
|
|
98
|
+
};
|
|
99
|
+
case 'boolean':
|
|
100
|
+
return {
|
|
101
|
+
...base,
|
|
102
|
+
type: 'switch',
|
|
103
|
+
defaultValue: initial?.$parameterType === 'boolean' ? initial.value : def.defaultValue ?? false
|
|
104
|
+
};
|
|
105
|
+
case 'enum':
|
|
106
|
+
{
|
|
107
|
+
const current = initial?.$parameterType === 'enum' ? initial.value : def.defaultValue ?? '';
|
|
108
|
+
const catalog = (def.options ?? []).map((opt)=>({
|
|
109
|
+
value: opt,
|
|
110
|
+
label: def.optionLabels?.[opt] ?? opt
|
|
111
|
+
}));
|
|
112
|
+
const synthetic = options?.enumSyntheticValues?.[def.id];
|
|
113
|
+
const opts = synthetic && !catalog.some((opt)=>opt.value === synthetic) ? [
|
|
114
|
+
...catalog,
|
|
115
|
+
{
|
|
116
|
+
value: synthetic,
|
|
117
|
+
label: def.optionLabels?.[synthetic] ?? synthetic
|
|
118
|
+
}
|
|
119
|
+
] : catalog;
|
|
120
|
+
return {
|
|
121
|
+
...base,
|
|
122
|
+
type: 'select',
|
|
123
|
+
placeholder: labels.enumPlaceholder,
|
|
124
|
+
options: opts,
|
|
125
|
+
defaultValue: current
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
case 'enum-list':
|
|
129
|
+
{
|
|
130
|
+
const selected = initial?.$parameterType === 'enum-list' ? initial.value : def.defaultValue ?? [];
|
|
131
|
+
if ((def.options ?? []).length <= MAX_INLINE_ENUM_OPTIONS) return {
|
|
132
|
+
...base,
|
|
133
|
+
type: 'custom',
|
|
134
|
+
component: GUARDRAIL_ENUM_LIST_CHIPS_COMPONENT,
|
|
135
|
+
valueType: customValueTypeFor(def.type),
|
|
136
|
+
defaultValue: selected,
|
|
137
|
+
componentProps: {
|
|
138
|
+
paramDef: def,
|
|
139
|
+
labels
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
return {
|
|
143
|
+
...base,
|
|
144
|
+
type: 'multiselect',
|
|
145
|
+
placeholder: labels.enumListPlaceholder,
|
|
146
|
+
options: (def.options ?? []).map((opt)=>({
|
|
147
|
+
value: opt,
|
|
148
|
+
label: def.optionLabels?.[opt] ?? opt
|
|
149
|
+
})),
|
|
150
|
+
defaultValue: selected
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
case 'text-list':
|
|
154
|
+
return {
|
|
155
|
+
...base,
|
|
156
|
+
type: 'string-list',
|
|
157
|
+
maxItems: def.maxItems,
|
|
158
|
+
maxLength: def.maxLength,
|
|
159
|
+
minRows: 2,
|
|
160
|
+
addItemLabel: labels.addItem,
|
|
161
|
+
removeItemAriaLabel: labels.removeItem,
|
|
162
|
+
defaultValue: initial?.$parameterType === 'text-list' ? initial.value : def.defaultValue ?? []
|
|
163
|
+
};
|
|
164
|
+
case 'map-enum':
|
|
165
|
+
{
|
|
166
|
+
const sourceDef = def.keySource ? definitions.find((d)=>d.id === def.keySource) : void 0;
|
|
167
|
+
const sourceInitial = def.keySource ? initialById.get(def.keySource) : void 0;
|
|
168
|
+
const sourceSelection = sourceInitial?.$parameterType === 'enum-list' ? sourceInitial.value : sourceDef?.defaultValue;
|
|
169
|
+
return {
|
|
170
|
+
...base,
|
|
171
|
+
type: 'custom',
|
|
172
|
+
component: GUARDRAIL_MAP_ENUM_COMPONENT,
|
|
173
|
+
defaultValue: initial?.$parameterType === 'map-enum' ? initial.value : void 0,
|
|
174
|
+
componentProps: {
|
|
175
|
+
paramDef: def,
|
|
176
|
+
sourceDef,
|
|
177
|
+
labels,
|
|
178
|
+
sourceSelection
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function coerceGuardrailParameterValue(value, def) {
|
|
185
|
+
switch(def.type){
|
|
186
|
+
case 'number':
|
|
187
|
+
return 'number' != typeof value || Number.isNaN(value) ? 0 : value;
|
|
188
|
+
case 'text':
|
|
189
|
+
case 'enum':
|
|
190
|
+
return value ?? '';
|
|
191
|
+
case 'boolean':
|
|
192
|
+
return value ?? false;
|
|
193
|
+
default:
|
|
194
|
+
return value;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
export { GUARDRAIL_ENUM_LIST_CHIPS_COMPONENT, GUARDRAIL_MAP_ENUM_COMPONENT, GUARDRAIL_RENDER_PARAMETER_COMPONENT, MAX_INLINE_ENUM_OPTIONS, buildGuardrailFormSchema, coerceGuardrailParameterValue };
|