@nocobase/flow-engine 2.1.31 → 2.2.0-alpha.10
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/lib/JSRunner.d.ts +1 -0
- package/lib/JSRunner.js +110 -20
- package/lib/components/FlowContextSelector.js +55 -12
- package/lib/components/FormItem.js +11 -7
- package/lib/components/MobilePopup.style.js +16 -5
- package/lib/components/variables/VariableHybridInput.d.ts +9 -0
- package/lib/components/variables/VariableHybridInput.js +146 -17
- package/lib/components/variables/VariableInput.js +19 -7
- package/lib/components/variables/VariableTag.js +48 -36
- package/lib/components/variables/types.d.ts +21 -0
- package/lib/flowContext.js +11 -1
- package/lib/flowI18n.js +3 -3
- package/lib/runjs-context/helpers.js +12 -5
- package/lib/types.d.ts +3 -1
- package/lib/types.js +1 -0
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +0 -11
- package/lib/utils/resolveRunJSObjectValues.js +3 -2
- package/lib/utils/runjsModuleLoader.js +0 -30
- package/package.json +4 -4
- package/src/JSRunner.ts +112 -25
- package/src/__tests__/JSRunner.test.ts +4 -5
- package/src/__tests__/flowI18n.test.ts +11 -0
- package/src/components/FlowContextSelector.tsx +66 -11
- package/src/components/FormItem.tsx +12 -7
- package/src/components/MobilePopup.style.ts +22 -6
- package/src/components/__tests__/FormItem.test.tsx +17 -2
- package/src/components/__tests__/MobilePopup.style.test.tsx +103 -0
- package/src/components/variables/VariableHybridInput.tsx +185 -14
- package/src/components/variables/VariableInput.tsx +32 -7
- package/src/components/variables/VariableTag.tsx +51 -37
- package/src/components/variables/__tests__/FlowContextSelector.test.tsx +60 -3
- package/src/components/variables/__tests__/VariableHybridInput.test.tsx +212 -0
- package/src/components/variables/__tests__/VariableInput.test.tsx +202 -6
- package/src/components/variables/__tests__/VariableTag.test.tsx +80 -0
- package/src/components/variables/types.ts +21 -0
- package/src/flowContext.ts +11 -1
- package/src/flowI18n.ts +8 -3
- package/src/runjs-context/helpers.ts +12 -6
- package/src/types.ts +2 -0
- package/src/utils/index.ts +0 -9
- package/src/utils/resolveRunJSObjectValues.ts +5 -2
- package/src/utils/runjsModuleLoader.ts +0 -32
- package/lib/utils/safeGlobals.d.ts +0 -28
- package/lib/utils/safeGlobals.js +0 -367
- package/src/utils/__tests__/runjsRequireAsyncAutoWhitelist.test.ts +0 -38
- package/src/utils/__tests__/safeGlobals.test.ts +0 -106
- package/src/utils/safeGlobals.ts +0 -406
package/lib/JSRunner.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export interface JSRunnerOptions {
|
|
|
27
27
|
* 3. Fallback keeps v1-compatible behavior (enabled).
|
|
28
28
|
*/
|
|
29
29
|
export declare function shouldPreprocessRunJSTemplates(options?: Pick<JSRunnerOptions, 'preprocessTemplates' | 'version'>): boolean;
|
|
30
|
+
export declare const RUNJS_ALLOWED_BARE_GLOBAL_NAMES: readonly ["ctx", "console", "window", "document", "navigator", "setTimeout", "clearTimeout", "setInterval", "clearInterval", "Array", "ArrayBuffer", "BigInt", "BigInt64Array", "BigUint64Array", "Boolean", "DataView", "Date", "Error", "EvalError", "FinalizationRegistry", "Float32Array", "Float64Array", "Int8Array", "Int16Array", "Int32Array", "Map", "Math", "Number", "Object", "Promise", "Proxy", "RangeError", "ReferenceError", "Reflect", "RegExp", "Set", "String", "Symbol", "SyntaxError", "TypeError", "URIError", "Uint8Array", "Uint8ClampedArray", "Uint16Array", "Uint32Array", "WeakMap", "WeakRef", "WeakSet", "JSON", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", "isFinite", "isNaN", "parseFloat", "parseInt", "undefined", "NaN", "Infinity", "fetch", "localStorage", "sessionStorage", "XMLHttpRequest", "WebSocket", "Worker", "SharedWorker", "ServiceWorker", "BroadcastChannel", "EventSource", "indexedDB", "caches", "Function", "eval", "globalThis", "Intl", "Blob", "URL", "location"];
|
|
30
31
|
export declare class JSRunner {
|
|
31
32
|
private globals;
|
|
32
33
|
private timeoutMs;
|
package/lib/JSRunner.js
CHANGED
|
@@ -28,6 +28,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
28
28
|
var JSRunner_exports = {};
|
|
29
29
|
__export(JSRunner_exports, {
|
|
30
30
|
JSRunner: () => JSRunner,
|
|
31
|
+
RUNJS_ALLOWED_BARE_GLOBAL_NAMES: () => RUNJS_ALLOWED_BARE_GLOBAL_NAMES,
|
|
31
32
|
shouldPreprocessRunJSTemplates: () => shouldPreprocessRunJSTemplates
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(JSRunner_exports);
|
|
@@ -40,6 +41,113 @@ function shouldPreprocessRunJSTemplates(options) {
|
|
|
40
41
|
return (options == null ? void 0 : options.version) !== "v2";
|
|
41
42
|
}
|
|
42
43
|
__name(shouldPreprocessRunJSTemplates, "shouldPreprocessRunJSTemplates");
|
|
44
|
+
const RUNJS_BROWSER_GLOBAL_NAMES = [
|
|
45
|
+
"fetch",
|
|
46
|
+
"localStorage",
|
|
47
|
+
"sessionStorage",
|
|
48
|
+
"XMLHttpRequest",
|
|
49
|
+
"WebSocket",
|
|
50
|
+
"Worker",
|
|
51
|
+
"SharedWorker",
|
|
52
|
+
"ServiceWorker",
|
|
53
|
+
"BroadcastChannel",
|
|
54
|
+
"EventSource",
|
|
55
|
+
"indexedDB",
|
|
56
|
+
"caches",
|
|
57
|
+
"Function",
|
|
58
|
+
"eval",
|
|
59
|
+
"globalThis",
|
|
60
|
+
"Intl",
|
|
61
|
+
"Blob",
|
|
62
|
+
"URL",
|
|
63
|
+
"location"
|
|
64
|
+
];
|
|
65
|
+
const RUNJS_ALLOWED_BARE_GLOBAL_NAMES = [
|
|
66
|
+
"ctx",
|
|
67
|
+
"console",
|
|
68
|
+
"window",
|
|
69
|
+
"document",
|
|
70
|
+
"navigator",
|
|
71
|
+
"setTimeout",
|
|
72
|
+
"clearTimeout",
|
|
73
|
+
"setInterval",
|
|
74
|
+
"clearInterval",
|
|
75
|
+
"Array",
|
|
76
|
+
"ArrayBuffer",
|
|
77
|
+
"BigInt",
|
|
78
|
+
"BigInt64Array",
|
|
79
|
+
"BigUint64Array",
|
|
80
|
+
"Boolean",
|
|
81
|
+
"DataView",
|
|
82
|
+
"Date",
|
|
83
|
+
"Error",
|
|
84
|
+
"EvalError",
|
|
85
|
+
"FinalizationRegistry",
|
|
86
|
+
"Float32Array",
|
|
87
|
+
"Float64Array",
|
|
88
|
+
"Int8Array",
|
|
89
|
+
"Int16Array",
|
|
90
|
+
"Int32Array",
|
|
91
|
+
"Map",
|
|
92
|
+
"Math",
|
|
93
|
+
"Number",
|
|
94
|
+
"Object",
|
|
95
|
+
"Promise",
|
|
96
|
+
"Proxy",
|
|
97
|
+
"RangeError",
|
|
98
|
+
"ReferenceError",
|
|
99
|
+
"Reflect",
|
|
100
|
+
"RegExp",
|
|
101
|
+
"Set",
|
|
102
|
+
"String",
|
|
103
|
+
"Symbol",
|
|
104
|
+
"SyntaxError",
|
|
105
|
+
"TypeError",
|
|
106
|
+
"URIError",
|
|
107
|
+
"Uint8Array",
|
|
108
|
+
"Uint8ClampedArray",
|
|
109
|
+
"Uint16Array",
|
|
110
|
+
"Uint32Array",
|
|
111
|
+
"WeakMap",
|
|
112
|
+
"WeakRef",
|
|
113
|
+
"WeakSet",
|
|
114
|
+
"JSON",
|
|
115
|
+
"decodeURI",
|
|
116
|
+
"decodeURIComponent",
|
|
117
|
+
"encodeURI",
|
|
118
|
+
"encodeURIComponent",
|
|
119
|
+
"isFinite",
|
|
120
|
+
"isNaN",
|
|
121
|
+
"parseFloat",
|
|
122
|
+
"parseInt",
|
|
123
|
+
"undefined",
|
|
124
|
+
"NaN",
|
|
125
|
+
"Infinity",
|
|
126
|
+
...RUNJS_BROWSER_GLOBAL_NAMES
|
|
127
|
+
];
|
|
128
|
+
function collectRunJSBrowserGlobals(providedGlobals = {}) {
|
|
129
|
+
const windowGlobal = providedGlobals.window;
|
|
130
|
+
if (!windowGlobal || typeof windowGlobal !== "object") {
|
|
131
|
+
return {};
|
|
132
|
+
}
|
|
133
|
+
const windowRecord = windowGlobal;
|
|
134
|
+
const globals = {};
|
|
135
|
+
RUNJS_BROWSER_GLOBAL_NAMES.forEach((name) => {
|
|
136
|
+
if (Object.prototype.hasOwnProperty.call(providedGlobals, name)) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
const value = windowRecord[name];
|
|
141
|
+
if (typeof value === "undefined") {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
globals[name] = name === "fetch" && typeof value === "function" ? value.bind(windowGlobal) : value;
|
|
145
|
+
} catch {
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
return globals;
|
|
149
|
+
}
|
|
150
|
+
__name(collectRunJSBrowserGlobals, "collectRunJSBrowserGlobals");
|
|
43
151
|
const BARE_CTX_TEMPLATE_RE = /(^|[=(:,[\s)])(\{\{\s*(ctx(?:\.|\[|\?\.)[^}]*)\s*\}\})/m;
|
|
44
152
|
function extractDeprecatedCtxTemplateUsage(code) {
|
|
45
153
|
const src = String(code || "");
|
|
@@ -78,7 +186,6 @@ const _JSRunner = class _JSRunner {
|
|
|
78
186
|
globals;
|
|
79
187
|
timeoutMs;
|
|
80
188
|
constructor(options = {}) {
|
|
81
|
-
var _a, _b;
|
|
82
189
|
const bindWindowFn = /* @__PURE__ */ __name((key) => {
|
|
83
190
|
if (typeof window !== "undefined" && typeof window[key] === "function") {
|
|
84
191
|
return window[key].bind(window);
|
|
@@ -87,25 +194,7 @@ const _JSRunner = class _JSRunner {
|
|
|
87
194
|
return typeof fn === "function" ? fn.bind(globalThis) : fn;
|
|
88
195
|
}, "bindWindowFn");
|
|
89
196
|
const providedGlobals = options.globals || {};
|
|
90
|
-
const liftedGlobals =
|
|
91
|
-
if (!Object.prototype.hasOwnProperty.call(providedGlobals, "Blob")) {
|
|
92
|
-
try {
|
|
93
|
-
const blobCtor = (_a = providedGlobals.window) == null ? void 0 : _a.Blob;
|
|
94
|
-
if (typeof blobCtor !== "undefined") {
|
|
95
|
-
liftedGlobals.Blob = blobCtor;
|
|
96
|
-
}
|
|
97
|
-
} catch {
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (!Object.prototype.hasOwnProperty.call(providedGlobals, "URL")) {
|
|
101
|
-
try {
|
|
102
|
-
const urlCtor = (_b = providedGlobals.window) == null ? void 0 : _b.URL;
|
|
103
|
-
if (typeof urlCtor !== "undefined") {
|
|
104
|
-
liftedGlobals.URL = urlCtor;
|
|
105
|
-
}
|
|
106
|
-
} catch {
|
|
107
|
-
}
|
|
108
|
-
}
|
|
197
|
+
const liftedGlobals = collectRunJSBrowserGlobals(providedGlobals);
|
|
109
198
|
this.globals = {
|
|
110
199
|
console,
|
|
111
200
|
setTimeout: bindWindowFn("setTimeout"),
|
|
@@ -169,5 +258,6 @@ let JSRunner = _JSRunner;
|
|
|
169
258
|
// Annotate the CommonJS export names for ESM import in node:
|
|
170
259
|
0 && (module.exports = {
|
|
171
260
|
JSRunner,
|
|
261
|
+
RUNJS_ALLOWED_BARE_GLOBAL_NAMES,
|
|
172
262
|
shouldPreprocessRunJSTemplates
|
|
173
263
|
});
|
|
@@ -57,6 +57,15 @@ const cascaderPopupAutoHeightClassName = import_css.css`
|
|
|
57
57
|
max-height: 50vh;
|
|
58
58
|
}
|
|
59
59
|
`;
|
|
60
|
+
function getMetaNodeTooltip(meta) {
|
|
61
|
+
if (!meta) {
|
|
62
|
+
return void 0;
|
|
63
|
+
}
|
|
64
|
+
const metaWithTooltip = meta;
|
|
65
|
+
const options = meta.options;
|
|
66
|
+
return metaWithTooltip.tooltip ?? (options == null ? void 0 : options.tooltip);
|
|
67
|
+
}
|
|
68
|
+
__name(getMetaNodeTooltip, "getMetaNodeTooltip");
|
|
60
69
|
const normalizePath = /* @__PURE__ */ __name((path) => {
|
|
61
70
|
if (!Array.isArray(path)) {
|
|
62
71
|
return void 0;
|
|
@@ -90,6 +99,7 @@ const FlowContextSelectorComponent = /* @__PURE__ */ __name(({
|
|
|
90
99
|
value,
|
|
91
100
|
onChange,
|
|
92
101
|
children,
|
|
102
|
+
active,
|
|
93
103
|
metaTree,
|
|
94
104
|
showSearch = false,
|
|
95
105
|
parseValueToPath: customParseValueToPath = import_utils.parseValueToPath,
|
|
@@ -97,6 +107,7 @@ const FlowContextSelectorComponent = /* @__PURE__ */ __name(({
|
|
|
97
107
|
open,
|
|
98
108
|
onlyLeafSelectable = false,
|
|
99
109
|
ignoreFieldNames,
|
|
110
|
+
dropdownFooter,
|
|
100
111
|
...cascaderProps
|
|
101
112
|
}) => {
|
|
102
113
|
const { token } = import_antd.theme.useToken();
|
|
@@ -111,15 +122,27 @@ const FlowContextSelectorComponent = /* @__PURE__ */ __name(({
|
|
|
111
122
|
const disabled = meta ? !!(typeof meta.disabled === "function" ? meta.disabled() : meta.disabled) : false;
|
|
112
123
|
const disabledReason = meta ? typeof meta.disabledReason === "function" ? meta.disabledReason() : meta.disabledReason : void 0;
|
|
113
124
|
const baseLabel = typeof o.label === "string" ? flowCtx.t(o.label) : o.label;
|
|
114
|
-
const
|
|
125
|
+
const labelText = typeof baseLabel === "string" ? baseLabel : String(o.value);
|
|
126
|
+
const tooltip = getMetaNodeTooltip(meta);
|
|
127
|
+
const tooltipTitle = disabled ? disabledReason || tooltip || flowCtx.t("This variable is not available") : tooltip;
|
|
128
|
+
const label = tooltipTitle ? /* @__PURE__ */ import_react.default.createElement("span", null, baseLabel, /* @__PURE__ */ import_react.default.createElement(
|
|
115
129
|
import_antd.Tooltip,
|
|
116
130
|
{
|
|
117
|
-
title:
|
|
118
|
-
placement: "
|
|
119
|
-
|
|
131
|
+
title: typeof tooltipTitle === "string" ? flowCtx.t(tooltipTitle) : tooltipTitle,
|
|
132
|
+
placement: "top",
|
|
133
|
+
classNames: { root: "flow-variable-tip" },
|
|
120
134
|
destroyTooltipOnHide: true
|
|
121
135
|
},
|
|
122
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
136
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
137
|
+
import_icons.QuestionCircleOutlined,
|
|
138
|
+
{
|
|
139
|
+
"aria-label": `${labelText} tooltip`,
|
|
140
|
+
style: {
|
|
141
|
+
marginLeft: token.marginXXS,
|
|
142
|
+
color: disabled ? token.colorTextDisabled : token.colorTextDescription
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
)
|
|
123
146
|
)) : baseLabel;
|
|
124
147
|
return {
|
|
125
148
|
...o,
|
|
@@ -129,7 +152,7 @@ const FlowContextSelectorComponent = /* @__PURE__ */ __name(({
|
|
|
129
152
|
};
|
|
130
153
|
});
|
|
131
154
|
},
|
|
132
|
-
[flowCtx]
|
|
155
|
+
[flowCtx, token.colorTextDescription, token.colorTextDisabled, token.marginXXS]
|
|
133
156
|
);
|
|
134
157
|
const [updateFlag, setUpdateFlag] = (0, import_react.useState)(0);
|
|
135
158
|
const [searchText, setSearchText] = (0, import_react.useState)("");
|
|
@@ -219,9 +242,9 @@ const FlowContextSelectorComponent = /* @__PURE__ */ __name(({
|
|
|
219
242
|
(0, import_utils.preloadContextSelectorPath)(options, pathToPreload, triggerUpdate);
|
|
220
243
|
}, [options, pathToPreload, triggerUpdate]);
|
|
221
244
|
const defaultChildren = (0, import_react.useMemo)(() => {
|
|
222
|
-
const hasSelected = currentPath && currentPath.length > 0;
|
|
223
|
-
return /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { type: hasSelected ? "primary" : "default", style: defaultButtonStyle }, "x");
|
|
224
|
-
}, [currentPath]);
|
|
245
|
+
const hasSelected = active ?? Boolean(currentPath && currentPath.length > 0);
|
|
246
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { type: hasSelected ? "primary" : "default", style: defaultButtonStyle, disabled: cascaderProps.disabled }, "x");
|
|
247
|
+
}, [active, cascaderProps.disabled, currentPath]);
|
|
225
248
|
const handleChange = (0, import_react.useCallback)(
|
|
226
249
|
(selectedValues, selectedOptions) => {
|
|
227
250
|
const lastOption = selectedOptions == null ? void 0 : selectedOptions[selectedOptions.length - 1];
|
|
@@ -289,12 +312,32 @@ const FlowContextSelectorComponent = /* @__PURE__ */ __name(({
|
|
|
289
312
|
},
|
|
290
313
|
[cascaderOnDropdownVisibleChange, open]
|
|
291
314
|
);
|
|
315
|
+
const footerNode = (0, import_react.useMemo)(() => {
|
|
316
|
+
if (dropdownFooter !== void 0) {
|
|
317
|
+
return dropdownFooter;
|
|
318
|
+
}
|
|
319
|
+
if (onlyLeafSelectable) {
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
323
|
+
"div",
|
|
324
|
+
{
|
|
325
|
+
className: import_css.css`
|
|
326
|
+
padding: 6px 12px;
|
|
327
|
+
color: ${token.colorTextDescription};
|
|
328
|
+
border-top: 1px solid ${token.colorSplit};
|
|
329
|
+
font-size: ${token.fontSizeSM}px;
|
|
330
|
+
`
|
|
331
|
+
},
|
|
332
|
+
flowCtx.t("Double click to choose entire object")
|
|
333
|
+
);
|
|
334
|
+
}, [dropdownFooter, onlyLeafSelectable, token, flowCtx]);
|
|
292
335
|
const renderDropdown = (0, import_react.useCallback)(
|
|
293
336
|
(menu) => {
|
|
294
337
|
const cascaderMenuNode = cascaderDropdownRender ? cascaderDropdownRender(menu) : menu;
|
|
295
338
|
const cascaderMenu = import_react.default.isValidElement(cascaderMenuNode) ? cascaderMenuNode : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, cascaderMenuNode);
|
|
296
339
|
if (!isSearchEnabled || children === null) {
|
|
297
|
-
return cascaderMenu;
|
|
340
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, cascaderMenu, footerNode);
|
|
298
341
|
}
|
|
299
342
|
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: cascaderSearchInputClassName }, /* @__PURE__ */ import_react.default.createElement(
|
|
300
343
|
import_antd.Input,
|
|
@@ -306,9 +349,9 @@ const FlowContextSelectorComponent = /* @__PURE__ */ __name(({
|
|
|
306
349
|
onChange: (e) => setSearchText(e.target.value),
|
|
307
350
|
onKeyDown: (e) => e.stopPropagation()
|
|
308
351
|
}
|
|
309
|
-
)), cascaderMenu);
|
|
352
|
+
)), cascaderMenu, footerNode);
|
|
310
353
|
},
|
|
311
|
-
[cascaderDropdownRender, cascaderSearchInputClassName, children, flowCtx, isSearchEnabled, searchText]
|
|
354
|
+
[cascaderDropdownRender, cascaderSearchInputClassName, children, flowCtx, isSearchEnabled, searchText, footerNode]
|
|
312
355
|
);
|
|
313
356
|
const inlinePlaceholder = typeof restCascaderProps.placeholder === "string" ? restCascaderProps.placeholder : flowCtx.t("Search");
|
|
314
357
|
const hasSelectedPath = Array.isArray(effectivePath) && effectivePath.length > 0;
|
|
@@ -77,14 +77,18 @@ const formItemPropKeys = [
|
|
|
77
77
|
"required",
|
|
78
78
|
"showLabel"
|
|
79
79
|
];
|
|
80
|
+
const modelInternalPropKeys = ["globalSort"];
|
|
80
81
|
const FormItem = /* @__PURE__ */ __name(({
|
|
81
82
|
children,
|
|
82
83
|
showLabel = true,
|
|
83
84
|
labelWidth,
|
|
84
85
|
...rest
|
|
85
86
|
}) => {
|
|
87
|
+
const forwardedRest = Object.fromEntries(
|
|
88
|
+
Object.entries(rest).filter(([key]) => !modelInternalPropKeys.includes(key))
|
|
89
|
+
);
|
|
86
90
|
const childProps = Object.fromEntries(
|
|
87
|
-
Object.entries(
|
|
91
|
+
Object.entries(forwardedRest).filter(([key]) => !formItemPropKeys.includes(key))
|
|
88
92
|
);
|
|
89
93
|
const processedChildren = typeof children === "function" ? children : import_react.default.Children.map(children, (child) => {
|
|
90
94
|
if (import_react.default.isValidElement(child)) {
|
|
@@ -92,7 +96,7 @@ const FormItem = /* @__PURE__ */ __name(({
|
|
|
92
96
|
}
|
|
93
97
|
return child;
|
|
94
98
|
});
|
|
95
|
-
const { label, labelWrap, colon = true, layout } =
|
|
99
|
+
const { label, labelWrap, colon = true, layout } = forwardedRest;
|
|
96
100
|
const effectiveLabelWrap = !layout || layout === "vertical" ? true : labelWrap;
|
|
97
101
|
const labelColStyle = layout === "vertical" ? { width: labelWidth, ...verticalFormItemLabelStyle } : { width: labelWidth };
|
|
98
102
|
const renderLabel = /* @__PURE__ */ __name(() => {
|
|
@@ -136,15 +140,15 @@ const FormItem = /* @__PURE__ */ __name(({
|
|
|
136
140
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
137
141
|
import_antd.Form.Item,
|
|
138
142
|
{
|
|
139
|
-
...
|
|
140
|
-
style: { ...formItemStyle, ...
|
|
143
|
+
...forwardedRest,
|
|
144
|
+
style: { ...formItemStyle, ...forwardedRest.style },
|
|
141
145
|
labelCol: { style: labelColStyle },
|
|
142
146
|
layout,
|
|
143
147
|
label: renderLabel(),
|
|
144
148
|
colon: false,
|
|
145
|
-
extra:
|
|
146
|
-
tooltip:
|
|
147
|
-
title:
|
|
149
|
+
extra: forwardedRest.extra && /* @__PURE__ */ import_react.default.createElement("span", { style: { whiteSpace: "pre-wrap" } }, forwardedRest.extra),
|
|
150
|
+
tooltip: forwardedRest.tooltip && {
|
|
151
|
+
title: forwardedRest.tooltip,
|
|
148
152
|
overlayInnerStyle: { whiteSpace: "pre-line" }
|
|
149
153
|
}
|
|
150
154
|
},
|
|
@@ -96,9 +96,17 @@ const genStyleHook = /* @__PURE__ */ __name((component, styleFn) => {
|
|
|
96
96
|
return [genCommonStyle(token, prefixCls), styleInterpolation];
|
|
97
97
|
}
|
|
98
98
|
);
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
const wrapSSRDeps = [theme2, token, hashId, prefixCls, iconPrefixCls, rootPrefixCls, props];
|
|
100
|
+
const wrapSSRCacheRef = (0, import_react.useRef)();
|
|
101
|
+
const currentCache = wrapSSRCacheRef.current;
|
|
102
|
+
let memoizedWrapSSR = (currentCache == null ? void 0 : currentCache.wrapSSR) || wrapSSR;
|
|
103
|
+
if (!currentCache || wrapSSRDeps.some((dep, index) => dep !== currentCache.deps[index])) {
|
|
104
|
+
wrapSSRCacheRef.current = {
|
|
105
|
+
deps: wrapSSRDeps,
|
|
106
|
+
wrapSSR
|
|
107
|
+
};
|
|
108
|
+
memoizedWrapSSR = wrapSSR;
|
|
109
|
+
}
|
|
102
110
|
return {
|
|
103
111
|
wrapSSR: memoizedWrapSSR,
|
|
104
112
|
hashId,
|
|
@@ -112,7 +120,7 @@ const useMobileActionDrawerStyle = genStyleHook("nb-mobile-action-drawer", (toke
|
|
|
112
120
|
return {
|
|
113
121
|
[componentCls]: {
|
|
114
122
|
".nb-mobile-action-drawer-header": {
|
|
115
|
-
height: "var(--nb-mobile-page-header-height)",
|
|
123
|
+
height: "var(--nb-mobile-page-header-height, 46px)",
|
|
116
124
|
display: "flex",
|
|
117
125
|
alignItems: "center",
|
|
118
126
|
justifyContent: "space-between",
|
|
@@ -149,7 +157,10 @@ const useMobileActionDrawerStyle = genStyleHook("nb-mobile-action-drawer", (toke
|
|
|
149
157
|
".nb-mobile-action-drawer-body": {
|
|
150
158
|
borderTopLeftRadius: 8,
|
|
151
159
|
borderTopRightRadius: 8,
|
|
152
|
-
maxHeight: "calc(
|
|
160
|
+
maxHeight: "calc(100vh - var(--nb-mobile-page-header-height, 46px))",
|
|
161
|
+
"@supports (height: 100dvh)": {
|
|
162
|
+
maxHeight: "calc(100dvh - var(--nb-mobile-page-header-height, 46px))"
|
|
163
|
+
},
|
|
153
164
|
overflowY: "auto",
|
|
154
165
|
overflowX: "hidden",
|
|
155
166
|
backgroundColor: token.colorBgLayout,
|
|
@@ -17,11 +17,20 @@ export interface VariableHybridInputProps {
|
|
|
17
17
|
value?: string;
|
|
18
18
|
onChange?: (value: string) => void;
|
|
19
19
|
disabled?: boolean;
|
|
20
|
+
readOnly?: boolean;
|
|
20
21
|
placeholder?: string;
|
|
21
22
|
addonBefore?: React.ReactNode;
|
|
22
23
|
metaTree?: MetaTreeNode[] | (() => MetaTreeNode[] | Promise<MetaTreeNode[]>);
|
|
23
24
|
converters?: VariableHybridInputConverters;
|
|
24
25
|
style?: React.CSSProperties;
|
|
25
26
|
className?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Validation status — turns the input border red (`error`) or amber
|
|
29
|
+
* (`warning`). Usually omitted: when rendered inside an antd `Form.Item`, the
|
|
30
|
+
* status is read automatically from `FormItemInputContext`, so dropping this
|
|
31
|
+
* into a `Form.Item` with failing rules colours the border with no extra
|
|
32
|
+
* wiring. An explicit prop wins over the inherited form status.
|
|
33
|
+
*/
|
|
34
|
+
status?: 'error' | 'warning';
|
|
26
35
|
}
|
|
27
36
|
export declare const VariableHybridInput: React.NamedExoticComponent<VariableHybridInputProps>;
|