@micromerce/formbuilder-react 1.0.991 → 1.0.993
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.
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* COP-3182 — a form value as it may appear inside a query that is evaluated as JavaScript.
|
|
3
3
|
*
|
|
4
4
|
* Values are entered by users and the query runs in everyone's browser, so a value must never
|
|
5
|
-
* become code. `
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* become code. `offset` is where its placeholder starts in `query`: inside a string the value is
|
|
6
|
+
* escaped as string content (the query author already wrote the quotes), anywhere else a number
|
|
7
|
+
* stays a number and everything else becomes a JSON literal. A query whose quotes do not balance
|
|
8
|
+
* (or that hides one, like the regex /'/) is refused rather than guessed.
|
|
8
9
|
*/
|
|
9
|
-
declare const toScriptLiteral: (value: unknown,
|
|
10
|
+
declare const toScriptLiteral: (value: unknown, query?: string, offset?: number) => string;
|
|
10
11
|
export default toScriptLiteral;
|
|
@@ -2,7 +2,7 @@ interface IUseDependentProps {
|
|
|
2
2
|
query?: string | null;
|
|
3
3
|
objectPathId?: string | null;
|
|
4
4
|
/** Turns a value into what replaces its placeholder; by default the value as it is. */
|
|
5
|
-
toLiteral?: (value: unknown,
|
|
5
|
+
toLiteral?: (value: unknown, query: string, offset: number) => string;
|
|
6
6
|
}
|
|
7
7
|
declare const useDependent: ({ query, objectPathId, toLiteral }: IUseDependentProps) => {
|
|
8
8
|
dependentControls: (string | undefined)[];
|