@micromerce/formbuilder-react 1.0.980 → 1.0.982

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.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * COP-3182 — a form value as it may appear inside a query that is evaluated as JavaScript.
3
+ *
4
+ * Values are entered by users and the query runs in everyone's browser, so a value must never
5
+ * become code. `before` / `after` are the characters around the placeholder: inside quotes the
6
+ * value is escaped as string content (the query author already wrote the quotes), anywhere else
7
+ * a number stays a number and everything else becomes a JSON literal.
8
+ */
9
+ declare const toScriptLiteral: (value: unknown, before?: string, after?: string) => string;
10
+ export default toScriptLiteral;
@@ -1,8 +1,10 @@
1
1
  interface IUseDependentProps {
2
2
  query?: string | null;
3
3
  objectPathId?: string | null;
4
+ /** Turns a value into what replaces its placeholder; by default the value as it is. */
5
+ toLiteral?: (value: unknown, before: string, after: string) => string;
4
6
  }
5
- declare const useDependent: ({ query, objectPathId }: IUseDependentProps) => {
7
+ declare const useDependent: ({ query, objectPathId, toLiteral }: IUseDependentProps) => {
6
8
  dependentControls: (string | undefined)[];
7
9
  resolvedQuery: string;
8
10
  isDisabled: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromerce/formbuilder-react",
3
- "version": "1.0.980",
3
+ "version": "1.0.982",
4
4
  "description": "creates a form based on configuration",
5
5
  "main": "dist/formbuilder.js",
6
6
  "types": "dist/index.d.ts",