synapse-react-client 4.0.40 → 4.0.41

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.
Files changed (195) hide show
  1. package/dist/SWC.index.d.ts +1 -0
  2. package/dist/SWC.index.d.ts.map +1 -1
  3. package/dist/SWC.index.js +2 -1
  4. package/dist/SWC.index.js.map +1 -1
  5. package/dist/components/AccessRequirement/ImposeRestrictionDialog/ImposeRestrictionDialog.d.ts +1 -0
  6. package/dist/components/AccessRequirement/ImposeRestrictionDialog/ImposeRestrictionDialog.d.ts.map +1 -1
  7. package/dist/components/AccessRequirement/ImposeRestrictionDialog/ImposeRestrictionDialog.js +12 -12
  8. package/dist/components/AccessRequirement/ImposeRestrictionDialog/ImposeRestrictionDialog.js.map +1 -1
  9. package/dist/components/Aridhia/AridhiaAccessStatus.d.ts.map +1 -1
  10. package/dist/components/Aridhia/AridhiaAccessStatus.js +51 -48
  11. package/dist/components/Aridhia/AridhiaAccessStatus.js.map +1 -1
  12. package/dist/components/Authentication/Constants.d.ts +4 -0
  13. package/dist/components/Authentication/Constants.d.ts.map +1 -1
  14. package/dist/components/Authentication/Constants.js +5 -2
  15. package/dist/components/Authentication/Constants.js.map +1 -1
  16. package/dist/components/Authentication/RecoveryCodeGrid.d.ts.map +1 -1
  17. package/dist/components/Authentication/RecoveryCodeGrid.js +8 -1
  18. package/dist/components/Authentication/RecoveryCodeGrid.js.map +1 -1
  19. package/dist/components/Authentication/RegenerateBackupCodesWarning.js +4 -1
  20. package/dist/components/Authentication/RegenerateBackupCodesWarning.js.map +1 -1
  21. package/dist/components/Authentication/TOTPForm.d.ts.map +1 -1
  22. package/dist/components/Authentication/TOTPForm.js +20 -18
  23. package/dist/components/Authentication/TOTPForm.js.map +1 -1
  24. package/dist/components/Authentication/TwoFactorBackupCodes.d.ts.map +1 -1
  25. package/dist/components/Authentication/TwoFactorBackupCodes.js +41 -12
  26. package/dist/components/Authentication/TwoFactorBackupCodes.js.map +1 -1
  27. package/dist/components/Authentication/TwoFactorEnrollmentForm.d.ts.map +1 -1
  28. package/dist/components/Authentication/TwoFactorEnrollmentForm.js +74 -71
  29. package/dist/components/Authentication/TwoFactorEnrollmentForm.js.map +1 -1
  30. package/dist/components/DataGrid/components/ReorderColumnsDialog.d.ts.map +1 -1
  31. package/dist/components/DataGrid/components/ReorderColumnsDialog.js +43 -46
  32. package/dist/components/DataGrid/components/ReorderColumnsDialog.js.map +1 -1
  33. package/dist/components/FormTemplateEditor/ChoiceOptionsEditor.d.ts +11 -0
  34. package/dist/components/FormTemplateEditor/ChoiceOptionsEditor.d.ts.map +1 -0
  35. package/dist/components/FormTemplateEditor/ChoiceOptionsEditor.js +61 -0
  36. package/dist/components/FormTemplateEditor/ChoiceOptionsEditor.js.map +1 -0
  37. package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.d.ts +33 -0
  38. package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.d.ts.map +1 -0
  39. package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.js +187 -0
  40. package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.js.map +1 -0
  41. package/dist/components/FormTemplateEditor/FormTemplatePreview.d.ts +14 -0
  42. package/dist/components/FormTemplateEditor/FormTemplatePreview.d.ts.map +1 -0
  43. package/dist/components/FormTemplateEditor/FormTemplatePreview.js +83 -0
  44. package/dist/components/FormTemplateEditor/FormTemplatePreview.js.map +1 -0
  45. package/dist/components/FormTemplateEditor/JsonSchemaBodyEditor.d.ts +13 -0
  46. package/dist/components/FormTemplateEditor/JsonSchemaBodyEditor.d.ts.map +1 -0
  47. package/dist/components/FormTemplateEditor/JsonSchemaBodyEditor.js +33 -0
  48. package/dist/components/FormTemplateEditor/JsonSchemaBodyEditor.js.map +1 -0
  49. package/dist/components/FormTemplateEditor/formTemplateValidation.d.ts +32 -0
  50. package/dist/components/FormTemplateEditor/formTemplateValidation.d.ts.map +1 -0
  51. package/dist/components/FormTemplateEditor/formTemplateValidation.js +75 -0
  52. package/dist/components/FormTemplateEditor/formTemplateValidation.js.map +1 -0
  53. package/dist/components/FormTemplateEditor/schemaFieldUtils.d.ts +25 -0
  54. package/dist/components/FormTemplateEditor/schemaFieldUtils.d.ts.map +1 -0
  55. package/dist/components/FormTemplateEditor/schemaFieldUtils.js +66 -0
  56. package/dist/components/FormTemplateEditor/schemaFieldUtils.js.map +1 -0
  57. package/dist/components/FormTemplateEditor/useSaveFormTemplate.d.ts +28 -0
  58. package/dist/components/FormTemplateEditor/useSaveFormTemplate.d.ts.map +1 -0
  59. package/dist/components/FormTemplateEditor/useSaveFormTemplate.js +39 -0
  60. package/dist/components/FormTemplateEditor/useSaveFormTemplate.js.map +1 -0
  61. package/dist/components/FormTemplateEditor/utils.d.ts +21 -0
  62. package/dist/components/FormTemplateEditor/utils.d.ts.map +1 -0
  63. package/dist/components/FormTemplateEditor/utils.js +27 -0
  64. package/dist/components/FormTemplateEditor/utils.js.map +1 -0
  65. package/dist/components/JsonSchemaForm/CustomFormContext.d.ts +1 -1
  66. package/dist/components/JsonSchemaForm/CustomFormContext.d.ts.map +1 -1
  67. package/dist/components/JsonSchemaForm/JsonSchemaForm.css +1 -1
  68. package/dist/components/JsonSchemaForm/JsonSchemaForm.module.js +1 -1
  69. package/dist/components/JsonSchemaForm/JsonSchemaForm.module.js.map +1 -1
  70. package/dist/components/JsonSchemaForm/JsonSchemaForm.module.scss +6 -1
  71. package/dist/components/JsonSchemaForm/templates/RJSFInputLabel.d.ts.map +1 -1
  72. package/dist/components/JsonSchemaForm/templates/RJSFInputLabel.js +4 -0
  73. package/dist/components/JsonSchemaForm/templates/RJSFInputLabel.js.map +1 -1
  74. package/dist/components/QueryBuilder/FilterConditionRow.css +1 -1
  75. package/dist/components/QueryBuilder/FilterConditionRow.d.ts +2 -0
  76. package/dist/components/QueryBuilder/FilterConditionRow.d.ts.map +1 -1
  77. package/dist/components/QueryBuilder/FilterConditionRow.js +112 -109
  78. package/dist/components/QueryBuilder/FilterConditionRow.js.map +1 -1
  79. package/dist/components/QueryBuilder/FilterConditionRow.module.js +10 -11
  80. package/dist/components/QueryBuilder/FilterConditionRow.module.js.map +1 -1
  81. package/dist/components/QueryBuilder/FilterConditionRow.module.scss +0 -5
  82. package/dist/components/QueryBuilder/FilterGroupNode.css +1 -1
  83. package/dist/components/QueryBuilder/FilterGroupNode.d.ts +4 -0
  84. package/dist/components/QueryBuilder/FilterGroupNode.d.ts.map +1 -1
  85. package/dist/components/QueryBuilder/FilterGroupNode.js +85 -51
  86. package/dist/components/QueryBuilder/FilterGroupNode.js.map +1 -1
  87. package/dist/components/QueryBuilder/FilterGroupNode.module.js +10 -9
  88. package/dist/components/QueryBuilder/FilterGroupNode.module.js.map +1 -1
  89. package/dist/components/QueryBuilder/FilterGroupNode.module.scss +9 -0
  90. package/dist/components/QueryBuilder/QBDragHandle.d.ts +10 -0
  91. package/dist/components/QueryBuilder/QBDragHandle.d.ts.map +1 -0
  92. package/dist/components/QueryBuilder/QBDragHandle.js +22 -0
  93. package/dist/components/QueryBuilder/QBDragHandle.js.map +1 -0
  94. package/dist/components/QueryBuilder/QueryBuilderControls.d.ts.map +1 -1
  95. package/dist/components/QueryBuilder/QueryBuilderControls.js +112 -107
  96. package/dist/components/QueryBuilder/QueryBuilderControls.js.map +1 -1
  97. package/dist/components/QueryBuilder/qbTreeToReadable.js +11 -11
  98. package/dist/components/QueryBuilder/queryBuilderDnd.d.ts +27 -0
  99. package/dist/components/QueryBuilder/queryBuilderDnd.d.ts.map +1 -0
  100. package/dist/components/QueryBuilder/queryBuilderDnd.js +41 -0
  101. package/dist/components/QueryBuilder/queryBuilderDnd.js.map +1 -0
  102. package/dist/components/QueryBuilder/queryBuilderDrag.css +1 -0
  103. package/dist/components/QueryBuilder/queryBuilderDrag.module.js +8 -0
  104. package/dist/components/QueryBuilder/queryBuilderDrag.module.js.map +1 -0
  105. package/dist/components/QueryBuilder/queryBuilderDrag.module.scss +12 -0
  106. package/dist/components/QueryBuilder/queryBuilderOperations.d.ts +13 -0
  107. package/dist/components/QueryBuilder/queryBuilderOperations.d.ts.map +1 -1
  108. package/dist/components/QueryBuilder/queryBuilderOperations.js +39 -36
  109. package/dist/components/QueryBuilder/queryBuilderOperations.js.map +1 -1
  110. package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.d.ts.map +1 -1
  111. package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js +46 -47
  112. package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js.map +1 -1
  113. package/dist/components/entity/page/title_bar/EntityPageTitleBar.d.ts +0 -1
  114. package/dist/components/entity/page/title_bar/EntityPageTitleBar.d.ts.map +1 -1
  115. package/dist/components/entity/page/title_bar/EntityPageTitleBar.js +35 -36
  116. package/dist/components/entity/page/title_bar/EntityPageTitleBar.js.map +1 -1
  117. package/dist/components/styled/LeftRightPanel.d.ts.map +1 -1
  118. package/dist/components/styled/LeftRightPanel.js +19 -2
  119. package/dist/components/styled/LeftRightPanel.js.map +1 -1
  120. package/dist/mocks/accessRequirement/mockFormTemplates.d.ts +2 -2
  121. package/dist/mocks/accessRequirement/mockFormTemplates.d.ts.map +1 -1
  122. package/dist/mocks/accessRequirement/mockFormTemplates.js +7 -14
  123. package/dist/mocks/accessRequirement/mockFormTemplates.js.map +1 -1
  124. package/dist/mocks/accessRequirement/mockJsonSchemas.d.ts +4 -1
  125. package/dist/mocks/accessRequirement/mockJsonSchemas.d.ts.map +1 -1
  126. package/dist/mocks/accessRequirement/mockJsonSchemas.js +36 -15
  127. package/dist/mocks/accessRequirement/mockJsonSchemas.js.map +1 -1
  128. package/dist/mocks/msw/handlers/asyncJobHandlers.d.ts +41 -14
  129. package/dist/mocks/msw/handlers/asyncJobHandlers.d.ts.map +1 -1
  130. package/dist/mocks/msw/handlers/asyncJobHandlers.js +53 -44
  131. package/dist/mocks/msw/handlers/asyncJobHandlers.js.map +1 -1
  132. package/dist/mocks/msw/handlers/chatHandlers.d.ts.map +1 -1
  133. package/dist/mocks/msw/handlers/chatHandlers.js +19 -13
  134. package/dist/mocks/msw/handlers/chatHandlers.js.map +1 -1
  135. package/dist/mocks/msw/handlers/schemaHandlers.d.ts +2 -1
  136. package/dist/mocks/msw/handlers/schemaHandlers.d.ts.map +1 -1
  137. package/dist/mocks/msw/handlers/schemaHandlers.js +13 -7
  138. package/dist/mocks/msw/handlers/schemaHandlers.js.map +1 -1
  139. package/dist/mocks/msw/handlers/searchQueryHandlers.d.ts.map +1 -1
  140. package/dist/mocks/msw/handlers/searchQueryHandlers.js +24 -18
  141. package/dist/mocks/msw/handlers/searchQueryHandlers.js.map +1 -1
  142. package/dist/mocks/msw/handlers/tableQueryHandlers.d.ts.map +1 -1
  143. package/dist/mocks/msw/handlers/tableQueryHandlers.js +35 -16
  144. package/dist/mocks/msw/handlers/tableQueryHandlers.js.map +1 -1
  145. package/dist/synapse-queries/KeyFactory.d.ts +1 -2
  146. package/dist/synapse-queries/KeyFactory.d.ts.map +1 -1
  147. package/dist/synapse-queries/KeyFactory.js +2 -5
  148. package/dist/synapse-queries/KeyFactory.js.map +1 -1
  149. package/dist/synapse-queries/dataaccess/index.d.ts +0 -1
  150. package/dist/synapse-queries/dataaccess/index.d.ts.map +1 -1
  151. package/dist/synapse-queries/dataaccess/index.js +3 -4
  152. package/dist/synapse-queries/index.js +180 -184
  153. package/dist/synapse-queries/jsonschema/useCreateJsonSchema.d.ts +9 -0
  154. package/dist/synapse-queries/jsonschema/useCreateJsonSchema.d.ts.map +1 -0
  155. package/dist/synapse-queries/jsonschema/useCreateJsonSchema.js +22 -0
  156. package/dist/synapse-queries/jsonschema/useCreateJsonSchema.js.map +1 -0
  157. package/dist/testutils/vitest.setup.js +18 -9
  158. package/dist/testutils/vitest.setup.js.map +1 -1
  159. package/dist/tsconfig.build.tsbuildinfo +1 -1
  160. package/dist/utils/APIConstants.d.ts +1 -0
  161. package/dist/utils/APIConstants.d.ts.map +1 -1
  162. package/dist/utils/APIConstants.js +2 -2
  163. package/dist/utils/APIConstants.js.map +1 -1
  164. package/dist/utils/appendFinalQueryParamKey.d.ts.map +1 -1
  165. package/dist/utils/appendFinalQueryParamKey.js +4 -1
  166. package/dist/utils/appendFinalQueryParamKey.js.map +1 -1
  167. package/dist/utils/featureflag/FeatureFlags.d.ts +1 -0
  168. package/dist/utils/featureflag/FeatureFlags.d.ts.map +1 -1
  169. package/dist/utils/featureflag/FeatureFlags.js +1 -1
  170. package/dist/utils/featureflag/FeatureFlags.js.map +1 -1
  171. package/dist/utils/functions/ArrayUtils.d.ts +3 -0
  172. package/dist/utils/functions/ArrayUtils.d.ts.map +1 -1
  173. package/dist/utils/functions/ArrayUtils.js +7 -1
  174. package/dist/utils/functions/ArrayUtils.js.map +1 -1
  175. package/dist/utils/jsonschema/generateDataAccessSchema.d.ts +26 -0
  176. package/dist/utils/jsonschema/generateDataAccessSchema.d.ts.map +1 -0
  177. package/dist/utils/jsonschema/generateDataAccessSchema.js +28 -0
  178. package/dist/utils/jsonschema/generateDataAccessSchema.js.map +1 -0
  179. package/dist/utils/jsonschema/submissionContext.d.ts +86 -0
  180. package/dist/utils/jsonschema/submissionContext.d.ts.map +1 -0
  181. package/dist/utils/jsonschema/submissionContext.js +186 -0
  182. package/dist/utils/jsonschema/submissionContext.js.map +1 -0
  183. package/package.json +5 -3
  184. package/dist/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.d.ts +0 -6
  185. package/dist/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.d.ts.map +0 -1
  186. package/dist/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.js +0 -32
  187. package/dist/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.js.map +0 -1
  188. package/dist/components/entity/page/title_bar/TitleBarProperties.d.ts +0 -9
  189. package/dist/components/entity/page/title_bar/TitleBarProperties.d.ts.map +0 -1
  190. package/dist/components/entity/page/title_bar/TitleBarProperties.js +0 -24
  191. package/dist/components/entity/page/title_bar/TitleBarProperties.js.map +0 -1
  192. package/dist/synapse-queries/dataaccess/useGenerateDataAccessSchema.d.ts +0 -21
  193. package/dist/synapse-queries/dataaccess/useGenerateDataAccessSchema.d.ts.map +0 -1
  194. package/dist/synapse-queries/dataaccess/useGenerateDataAccessSchema.js +0 -34
  195. package/dist/synapse-queries/dataaccess/useGenerateDataAccessSchema.js.map +0 -1
@@ -0,0 +1,83 @@
1
+ import { JsonSchemaForm as e } from "../JsonSchemaForm/JsonSchemaForm.js";
2
+ import { generateDataAccessSchema as t } from "../../utils/jsonschema/generateDataAccessSchema.js";
3
+ import { useMemo as n, useState as r } from "react";
4
+ import { Box as i, Paper as a, Step as o, StepButton as s, Stepper as c, ToggleButton as l, ToggleButtonGroup as u, Typography as d } from "@mui/material";
5
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
6
+ import { DataAccessRequestType as h } from "@sage-bionetworks/synapse-client";
7
+ //#region src/components/FormTemplateEditor/FormTemplatePreview.tsx
8
+ function g({ template: g, jsonSchema: _ }) {
9
+ let [v, y] = r(0), [b, x] = r(h.REQUEST), { steps: S } = n(() => t(g, _, b), [
10
+ g,
11
+ _,
12
+ b
13
+ ]);
14
+ if (S.length === 0) return /* @__PURE__ */ p(a, {
15
+ variant: "outlined",
16
+ sx: { p: 2 },
17
+ children: /* @__PURE__ */ p(i, {
18
+ sx: {
19
+ py: 4,
20
+ textAlign: "center"
21
+ },
22
+ children: /* @__PURE__ */ p(d, {
23
+ variant: "body2",
24
+ color: "text.secondary",
25
+ children: "Add at least one step with a bound field to preview the form."
26
+ })
27
+ })
28
+ });
29
+ let C = Math.min(v, S.length - 1), w = S[C], T = w.jsonSchema.title ?? "", E = w.jsonSchema.description ?? "";
30
+ return /* @__PURE__ */ m(a, {
31
+ variant: "outlined",
32
+ sx: { p: 2 },
33
+ children: [
34
+ /* @__PURE__ */ m(u, {
35
+ value: b,
36
+ exclusive: !0,
37
+ size: "small",
38
+ onChange: (e, t) => {
39
+ t && x(t);
40
+ },
41
+ sx: { mb: 2 },
42
+ children: [/* @__PURE__ */ p(l, {
43
+ value: h.REQUEST,
44
+ children: "Request"
45
+ }), /* @__PURE__ */ p(l, {
46
+ value: h.RENEWAL,
47
+ children: "Renewal"
48
+ })]
49
+ }),
50
+ S.length > 1 && /* @__PURE__ */ p(c, {
51
+ activeStep: C,
52
+ nonLinear: !0,
53
+ sx: { mb: 2 },
54
+ children: S.map((e, t) => /* @__PURE__ */ p(o, { children: /* @__PURE__ */ p(s, {
55
+ onClick: () => y(t),
56
+ children: e.jsonSchema.title ?? `Step ${t + 1}`
57
+ }) }, t))
58
+ }),
59
+ T && /* @__PURE__ */ p(d, {
60
+ variant: "h6",
61
+ gutterBottom: !0,
62
+ children: T
63
+ }),
64
+ E && /* @__PURE__ */ p(d, {
65
+ variant: "body2",
66
+ color: "text.secondary",
67
+ sx: { mb: 2 },
68
+ children: E
69
+ }),
70
+ /* @__PURE__ */ p(e, {
71
+ schema: w.jsonSchema,
72
+ uiSchema: w.uiSchema,
73
+ formContext: { descriptionVariant: "inline" },
74
+ children: /* @__PURE__ */ p(f, {}),
75
+ liveValidate: !1
76
+ })
77
+ ]
78
+ });
79
+ }
80
+ //#endregion
81
+ export { g as FormTemplatePreview };
82
+
83
+ //# sourceMappingURL=FormTemplatePreview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormTemplatePreview.js","names":[],"sources":["../../../src/components/FormTemplateEditor/FormTemplatePreview.tsx"],"sourcesContent":["import { JsonSchemaForm } from '@/components/JsonSchemaForm/JsonSchemaForm'\nimport { generateDataAccessSchema } from '@/utils/jsonschema/generateDataAccessSchema'\nimport {\n DataAccessRequestType,\n FormTemplate,\n} from '@sage-bionetworks/synapse-client'\nimport {\n Box,\n Paper,\n Step,\n StepButton,\n Stepper,\n ToggleButton,\n ToggleButtonGroup,\n Typography,\n} from '@mui/material'\nimport { RJSFSchema } from '@rjsf/utils'\nimport { useMemo, useState } from 'react'\n\ntype FormTemplatePreviewProps = {\n template: FormTemplate\n jsonSchema: RJSFSchema\n}\n\n/**\n * Renders a live preview of how a FormTemplate + its referenced JSON Schema will appear to a\n * requester. Computed client-side against the unsaved draft, purely to give ACT instant feedback\n * while editing.\n */\nexport function FormTemplatePreview({\n template,\n jsonSchema,\n}: FormTemplatePreviewProps) {\n const [activeStep, setActiveStep] = useState(0)\n const [requestType, setRequestType] = useState<DataAccessRequestType>(\n DataAccessRequestType.REQUEST,\n )\n\n const { steps } = useMemo(\n () => generateDataAccessSchema(template, jsonSchema, requestType),\n [template, jsonSchema, requestType],\n )\n\n if (steps.length === 0) {\n return (\n <Paper variant=\"outlined\" sx={{ p: 2 }}>\n <Box sx={{ py: 4, textAlign: 'center' }}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n Add at least one step with a bound field to preview the form.\n </Typography>\n </Box>\n </Paper>\n )\n }\n\n const safeIndex = Math.min(activeStep, steps.length - 1)\n const currentStep = steps[safeIndex]\n const title = (currentStep.jsonSchema.title as string) ?? ''\n const description = (currentStep.jsonSchema.description as string) ?? ''\n\n return (\n <Paper variant=\"outlined\" sx={{ p: 2 }}>\n <ToggleButtonGroup\n value={requestType}\n exclusive\n size=\"small\"\n onChange={(_, next: DataAccessRequestType | null) => {\n if (next) setRequestType(next)\n }}\n sx={{ mb: 2 }}\n >\n <ToggleButton value={DataAccessRequestType.REQUEST}>\n Request\n </ToggleButton>\n <ToggleButton value={DataAccessRequestType.RENEWAL}>\n Renewal\n </ToggleButton>\n </ToggleButtonGroup>\n\n {steps.length > 1 && (\n <Stepper activeStep={safeIndex} nonLinear sx={{ mb: 2 }}>\n {steps.map((step, index) => (\n <Step key={index}>\n <StepButton onClick={() => setActiveStep(index)}>\n {(step.jsonSchema.title as string) ?? `Step ${index + 1}`}\n </StepButton>\n </Step>\n ))}\n </Stepper>\n )}\n\n {title && (\n <Typography variant=\"h6\" gutterBottom>\n {title}\n </Typography>\n )}\n {description && (\n <Typography variant=\"body2\" color=\"text.secondary\" sx={{ mb: 2 }}>\n {description}\n </Typography>\n )}\n <JsonSchemaForm\n schema={currentStep.jsonSchema}\n uiSchema={currentStep.uiSchema}\n formContext={{ descriptionVariant: 'inline' }}\n children={<></>}\n liveValidate={false}\n />\n </Paper>\n )\n}\n"],"mappings":";;;;;;;AA6BA,SAAgB,EAAoB,EAClC,aACA,iBAC2B;CAC3B,IAAM,CAAC,GAAY,KAAiB,EAAS,CAAC,GACxC,CAAC,GAAa,KAAkB,EACpC,EAAsB,OACxB,GAEM,EAAE,aAAU,QACV,EAAyB,GAAU,GAAY,CAAW,GAChE;EAAC;EAAU;EAAY;CAAW,CACpC;CAEA,IAAI,EAAM,WAAW,GACnB,OACE,kBAAC,GAAD;EAAO,SAAQ;EAAW,IAAI,EAAE,GAAG,EAAE;YACnC,kBAAC,GAAD;GAAK,IAAI;IAAE,IAAI;IAAG,WAAW;GAAS;aACpC,kBAAC,GAAD;IAAY,SAAQ;IAAQ,OAAM;cAAiB;GAEvC,CAAA;EACT,CAAA;CACA,CAAA;CAIX,IAAM,IAAY,KAAK,IAAI,GAAY,EAAM,SAAS,CAAC,GACjD,IAAc,EAAM,IACpB,IAAS,EAAY,WAAW,SAAoB,IACpD,IAAe,EAAY,WAAW,eAA0B;CAEtE,OACE,kBAAC,GAAD;EAAO,SAAQ;EAAW,IAAI,EAAE,GAAG,EAAE;YAArC;GACE,kBAAC,GAAD;IACE,OAAO;IACP,WAAA;IACA,MAAK;IACL,WAAW,GAAG,MAAuC;KACnD,AAAI,KAAM,EAAe,CAAI;IAC/B;IACA,IAAI,EAAE,IAAI,EAAE;cAPd,CASE,kBAAC,GAAD;KAAc,OAAO,EAAsB;eAAS;IAEtC,CAAA,GACd,kBAAC,GAAD;KAAc,OAAO,EAAsB;eAAS;IAEtC,CAAA,CACG;;GAElB,EAAM,SAAS,KACd,kBAAC,GAAD;IAAS,YAAY;IAAW,WAAA;IAAU,IAAI,EAAE,IAAI,EAAE;cACnD,EAAM,KAAK,GAAM,MAChB,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;KAAY,eAAe,EAAc,CAAK;eAC1C,EAAK,WAAW,SAAoB,QAAQ,IAAQ;IAC5C,CAAA,EACR,GAJK,CAIL,CACP;GACM,CAAA;GAGV,KACC,kBAAC,GAAD;IAAY,SAAQ;IAAK,cAAA;cACtB;GACS,CAAA;GAEb,KACC,kBAAC,GAAD;IAAY,SAAQ;IAAQ,OAAM;IAAiB,IAAI,EAAE,IAAI,EAAE;cAC5D;GACS,CAAA;GAEd,kBAAC,GAAD;IACE,QAAQ,EAAY;IACpB,UAAU,EAAY;IACtB,aAAa,EAAE,oBAAoB,SAAS;IAC5C,UAAU,kBAAA,GAAA,CAAI,CAAA;IACd,cAAc;GACf,CAAA;EACI;;AAEX"}
@@ -0,0 +1,13 @@
1
+ import { RJSFSchema } from '@rjsf/utils';
2
+ type JsonSchemaBodyEditorProps = {
3
+ value: RJSFSchema;
4
+ onChange: (next: RJSFSchema) => void;
5
+ };
6
+ /**
7
+ * Edits a JSON Schema as raw JSON. Calls `onChange` only when the text parses; otherwise shows
8
+ * the parse error. `value` is read only on mount, so remount with a new `key` to load a
9
+ * different schema.
10
+ */
11
+ export declare function JsonSchemaBodyEditor({ value, onChange, }: JsonSchemaBodyEditorProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
13
+ //# sourceMappingURL=JsonSchemaBodyEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonSchemaBodyEditor.d.ts","sourceRoot":"","sources":["../../../src/components/FormTemplateEditor/JsonSchemaBodyEditor.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGxC,KAAK,yBAAyB,GAAG;IAC/B,KAAK,EAAE,UAAU,CAAA;IACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAA;CACrC,CAAA;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,QAAQ,GACT,EAAE,yBAAyB,2CAgC3B"}
@@ -0,0 +1,33 @@
1
+ import { useState as e } from "react";
2
+ import { TextField as t } from "@mui/material";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region src/components/FormTemplateEditor/JsonSchemaBodyEditor.tsx
5
+ function r({ value: r, onChange: i }) {
6
+ let [a, o] = e(() => JSON.stringify(r, null, 2)), [s, c] = e(null), l = (e) => {
7
+ o(e);
8
+ try {
9
+ let t = JSON.parse(e);
10
+ c(null), i(t);
11
+ } catch (e) {
12
+ c(e instanceof Error ? e.message : "Invalid JSON");
13
+ }
14
+ };
15
+ return /* @__PURE__ */ n(t, {
16
+ label: "Raw JSON Schema",
17
+ value: a,
18
+ onChange: (e) => l(e.target.value),
19
+ error: !!s,
20
+ helperText: s ?? " ",
21
+ multiline: !0,
22
+ rows: 14,
23
+ fullWidth: !0,
24
+ slotProps: { input: { sx: {
25
+ fontFamily: "monospace",
26
+ fontSize: "0.85rem"
27
+ } } }
28
+ });
29
+ }
30
+ //#endregion
31
+ export { r as JsonSchemaBodyEditor };
32
+
33
+ //# sourceMappingURL=JsonSchemaBodyEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonSchemaBodyEditor.js","names":[],"sources":["../../../src/components/FormTemplateEditor/JsonSchemaBodyEditor.tsx"],"sourcesContent":["import { TextField } from '@mui/material'\nimport { RJSFSchema } from '@rjsf/utils'\nimport { useState } from 'react'\n\ntype JsonSchemaBodyEditorProps = {\n value: RJSFSchema\n onChange: (next: RJSFSchema) => void\n}\n\n/**\n * Edits a JSON Schema as raw JSON. Calls `onChange` only when the text parses; otherwise shows\n * the parse error. `value` is read only on mount, so remount with a new `key` to load a\n * different schema.\n */\nexport function JsonSchemaBodyEditor({\n value,\n onChange,\n}: JsonSchemaBodyEditorProps) {\n const [text, setText] = useState(() => JSON.stringify(value, null, 2))\n const [error, setError] = useState<string | null>(null)\n\n const handleChange = (next: string) => {\n setText(next)\n try {\n const parsed = JSON.parse(next)\n setError(null)\n onChange(parsed)\n } catch (e) {\n setError(e instanceof Error ? e.message : 'Invalid JSON')\n }\n }\n\n return (\n <TextField\n label=\"Raw JSON Schema\"\n value={text}\n onChange={e => handleChange(e.target.value)}\n error={!!error}\n helperText={error ?? ' '}\n multiline\n rows={14}\n fullWidth\n slotProps={{\n input: {\n sx: { fontFamily: 'monospace', fontSize: '0.85rem' },\n },\n }}\n />\n )\n}\n"],"mappings":";;;;AAcA,SAAgB,EAAqB,EACnC,UACA,eAC4B;CAC5B,IAAM,CAAC,GAAM,KAAW,QAAe,KAAK,UAAU,GAAO,MAAM,CAAC,CAAC,GAC/D,CAAC,GAAO,KAAY,EAAwB,IAAI,GAEhD,KAAgB,MAAiB;EACrC,EAAQ,CAAI;EACZ,IAAI;GACF,IAAM,IAAS,KAAK,MAAM,CAAI;GAE9B,AADA,EAAS,IAAI,GACb,EAAS,CAAM;EACjB,SAAS,GAAG;GACV,EAAS,aAAa,QAAQ,EAAE,UAAU,cAAc;EAC1D;CACF;CAEA,OACE,kBAAC,GAAD;EACE,OAAM;EACN,OAAO;EACP,WAAU,MAAK,EAAa,EAAE,OAAO,KAAK;EAC1C,OAAO,CAAC,CAAC;EACT,YAAY,KAAS;EACrB,WAAA;EACA,MAAM;EACN,WAAA;EACA,WAAW,EACT,OAAO,EACL,IAAI;GAAE,YAAY;GAAa,UAAU;EAAU,EACrD,EACF;CACD,CAAA;AAEL"}
@@ -0,0 +1,32 @@
1
+ import { RJSFSchema } from '@rjsf/utils';
2
+ import { FormTemplateStep } from '@sage-bionetworks/synapse-client';
3
+ /**
4
+ * A property is a "leaf" — the only kind a `FormTemplateField.schemaPath` may address — when it
5
+ * is not itself a nested object schema with its own `properties`. The simple editor only ever
6
+ * authors leaves, but the raw JSON Schema escape hatch can produce a nested object.
7
+ */
8
+ export declare function isLeafSchemaProperty(subSchema: RJSFSchema): boolean;
9
+ /**
10
+ * Whether a field's `uiDefinition` (an RJSF `UiSchema` fragment) declares a `ui:widget`
11
+ * incompatible with the resolved property's type/format. An empty or widget-less `uiDefinition`
12
+ * is always compatible — there is nothing to conflict with.
13
+ */
14
+ export declare function isUiHintCompatible(subSchema: RJSFSchema, uiDefinition: unknown): boolean;
15
+ export type FormTemplateFieldValidationError = {
16
+ /** Index of the step/field slot this error is anchored to. Omitted for an error against a
17
+ * schema-required property that isn't bound to any field -- there is no slot to anchor it to. */
18
+ stepIndex?: number;
19
+ fieldIndex?: number;
20
+ schemaPath: string;
21
+ message: string;
22
+ };
23
+ /**
24
+ * Replicates the three rules the server enforces on `FormTemplateField` at create/update time
25
+ * (see the `FormTemplateField` doc comment), so the editor can block save and point the error at
26
+ * the offending field before ever reaching the server: the server only returns a flat,
27
+ * concatenated message, not per-field errors. Also flags a schema property the server will
28
+ * require (per its resolved submission context) that no field in the template binds to -- the
29
+ * server accepts this silently, but the requester would then be unable to satisfy it.
30
+ */
31
+ export declare function validateFormTemplateFields(steps: FormTemplateStep[], jsonSchema: RJSFSchema): FormTemplateFieldValidationError[];
32
+ //# sourceMappingURL=formTemplateValidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formTemplateValidation.d.ts","sourceRoot":"","sources":["../../../src/components/FormTemplateEditor/formTemplateValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAEL,gBAAgB,EACjB,MAAM,kCAAkC,CAAA;AAQzC;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAEnE;AAiBD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,UAAU,EACrB,YAAY,EAAE,OAAO,GACpB,OAAO,CAOT;AAED,MAAM,MAAM,gCAAgC,GAAG;IAC7C;qGACiG;IACjG,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,gBAAgB,EAAE,EACzB,UAAU,EAAE,UAAU,GACrB,gCAAgC,EAAE,CAoEpC"}
@@ -0,0 +1,75 @@
1
+ import { listResolvedSchemaProperties as e, pointerToPropertyKey as t, propertyKeyToPointer as n, resolveSchemaPropertyAtPointer as r } from "../../utils/jsonschema/submissionContext.js";
2
+ //#region src/components/FormTemplateEditor/formTemplateValidation.ts
3
+ function i(e) {
4
+ return !(e.type === "object" && e.properties != null);
5
+ }
6
+ var a = {
7
+ textarea: (e) => e.type === "string" && !e.enum,
8
+ password: (e) => e.type === "string" && !e.enum,
9
+ radio: (e) => (e.type === "string" || e.type === "boolean") && !!e.enum || e.type === "boolean",
10
+ select: (e) => e.type === "string" && !!e.enum,
11
+ checkboxes: (e) => e.type === "array",
12
+ checkbox: (e) => e.type === "boolean",
13
+ updown: (e) => e.type === "number" || e.type === "integer",
14
+ range: (e) => e.type === "number" || e.type === "integer"
15
+ };
16
+ function o(e, t) {
17
+ let n = t?.["ui:widget"];
18
+ if (typeof n != "string") return !0;
19
+ let r = a[n];
20
+ return r ? r(e) : !0;
21
+ }
22
+ function s(a, s) {
23
+ let c = [], l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set();
24
+ a.forEach((e, n) => {
25
+ e.fields.forEach((e, a) => {
26
+ let { schemaPath: d } = e;
27
+ if (l.has(d)) {
28
+ c.push({
29
+ stepIndex: n,
30
+ fieldIndex: a,
31
+ schemaPath: d,
32
+ message: `"${d}" is already bound to another field in this template.`
33
+ });
34
+ return;
35
+ }
36
+ l.add(d);
37
+ let f = t(d);
38
+ f && u.add(f);
39
+ let p = r(s, d)?.subSchema;
40
+ if (!p) {
41
+ c.push({
42
+ stepIndex: n,
43
+ fieldIndex: a,
44
+ schemaPath: d,
45
+ message: `"${d}" does not resolve to a property in the schema.`
46
+ });
47
+ return;
48
+ }
49
+ if (!i(p)) {
50
+ c.push({
51
+ stepIndex: n,
52
+ fieldIndex: a,
53
+ schemaPath: d,
54
+ message: `"${d}" is a nested object, not a single field.`
55
+ });
56
+ return;
57
+ }
58
+ o(p, e.uiDefinition) || c.push({
59
+ stepIndex: n,
60
+ fieldIndex: a,
61
+ schemaPath: d,
62
+ message: `The UI hint for "${d}" is incompatible with its property type.`
63
+ });
64
+ });
65
+ });
66
+ for (let t of e(s)) t.isRequired && !u.has(t.propertyKey) && c.push({
67
+ schemaPath: n(t.propertyKey),
68
+ message: `"${t.propertyKey}" is required by the schema but is not bound to any field in this template.`
69
+ });
70
+ return c;
71
+ }
72
+ //#endregion
73
+ export { i as isLeafSchemaProperty, o as isUiHintCompatible, s as validateFormTemplateFields };
74
+
75
+ //# sourceMappingURL=formTemplateValidation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formTemplateValidation.js","names":[],"sources":["../../../src/components/FormTemplateEditor/formTemplateValidation.ts"],"sourcesContent":["import { RJSFSchema } from '@rjsf/utils'\nimport {\n FormTemplateField,\n FormTemplateStep,\n} from '@sage-bionetworks/synapse-client'\nimport {\n listResolvedSchemaProperties,\n pointerToPropertyKey,\n propertyKeyToPointer,\n resolveSchemaPropertyAtPointer,\n} from '@/utils/jsonschema/submissionContext'\n\n/**\n * A property is a \"leaf\" — the only kind a `FormTemplateField.schemaPath` may address — when it\n * is not itself a nested object schema with its own `properties`. The simple editor only ever\n * authors leaves, but the raw JSON Schema escape hatch can produce a nested object.\n */\nexport function isLeafSchemaProperty(subSchema: RJSFSchema): boolean {\n return !(subSchema.type === 'object' && subSchema.properties != null)\n}\n\n/** RJSF `ui:widget` names compatible with each JSON Schema property shape. */\nconst WIDGET_COMPATIBILITY: Record<string, (subSchema: RJSFSchema) => boolean> =\n {\n textarea: s => s.type === 'string' && !s.enum,\n password: s => s.type === 'string' && !s.enum,\n radio: s =>\n ((s.type === 'string' || s.type === 'boolean') && !!s.enum) ||\n s.type === 'boolean',\n select: s => s.type === 'string' && !!s.enum,\n checkboxes: s => s.type === 'array',\n checkbox: s => s.type === 'boolean',\n updown: s => s.type === 'number' || s.type === 'integer',\n range: s => s.type === 'number' || s.type === 'integer',\n }\n\n/**\n * Whether a field's `uiDefinition` (an RJSF `UiSchema` fragment) declares a `ui:widget`\n * incompatible with the resolved property's type/format. An empty or widget-less `uiDefinition`\n * is always compatible — there is nothing to conflict with.\n */\nexport function isUiHintCompatible(\n subSchema: RJSFSchema,\n uiDefinition: unknown,\n): boolean {\n const widget = (uiDefinition as Record<string, unknown> | undefined)?.[\n 'ui:widget'\n ]\n if (typeof widget !== 'string') return true\n const isCompatible = WIDGET_COMPATIBILITY[widget]\n return isCompatible ? isCompatible(subSchema) : true\n}\n\nexport type FormTemplateFieldValidationError = {\n /** Index of the step/field slot this error is anchored to. Omitted for an error against a\n * schema-required property that isn't bound to any field -- there is no slot to anchor it to. */\n stepIndex?: number\n fieldIndex?: number\n schemaPath: string\n message: string\n}\n\n/**\n * Replicates the three rules the server enforces on `FormTemplateField` at create/update time\n * (see the `FormTemplateField` doc comment), so the editor can block save and point the error at\n * the offending field before ever reaching the server: the server only returns a flat,\n * concatenated message, not per-field errors. Also flags a schema property the server will\n * require (per its resolved submission context) that no field in the template binds to -- the\n * server accepts this silently, but the requester would then be unable to satisfy it.\n */\nexport function validateFormTemplateFields(\n steps: FormTemplateStep[],\n jsonSchema: RJSFSchema,\n): FormTemplateFieldValidationError[] {\n const errors: FormTemplateFieldValidationError[] = []\n const seenSchemaPaths = new Set<string>()\n const boundPropertyKeys = new Set<string>()\n\n steps.forEach((step, stepIndex) => {\n step.fields.forEach((field: FormTemplateField, fieldIndex: number) => {\n const { schemaPath } = field\n\n if (seenSchemaPaths.has(schemaPath)) {\n errors.push({\n stepIndex,\n fieldIndex,\n schemaPath,\n message: `\"${schemaPath}\" is already bound to another field in this template.`,\n })\n return\n }\n seenSchemaPaths.add(schemaPath)\n\n const propertyKey = pointerToPropertyKey(schemaPath)\n if (propertyKey) boundPropertyKeys.add(propertyKey)\n\n const subSchema = resolveSchemaPropertyAtPointer(\n jsonSchema,\n schemaPath,\n )?.subSchema\n if (!subSchema) {\n errors.push({\n stepIndex,\n fieldIndex,\n schemaPath,\n message: `\"${schemaPath}\" does not resolve to a property in the schema.`,\n })\n return\n }\n\n if (!isLeafSchemaProperty(subSchema)) {\n errors.push({\n stepIndex,\n fieldIndex,\n schemaPath,\n message: `\"${schemaPath}\" is a nested object, not a single field.`,\n })\n return\n }\n\n if (!isUiHintCompatible(subSchema, field.uiDefinition)) {\n errors.push({\n stepIndex,\n fieldIndex,\n schemaPath,\n message: `The UI hint for \"${schemaPath}\" is incompatible with its property type.`,\n })\n }\n })\n })\n\n for (const property of listResolvedSchemaProperties(jsonSchema)) {\n if (property.isRequired && !boundPropertyKeys.has(property.propertyKey)) {\n errors.push({\n schemaPath: propertyKeyToPointer(property.propertyKey),\n message: `\"${property.propertyKey}\" is required by the schema but is not bound to any field in this template.`,\n })\n }\n }\n\n return errors\n}\n"],"mappings":";;AAiBA,SAAgB,EAAqB,GAAgC;CACnE,OAAO,EAAE,EAAU,SAAS,YAAY,EAAU,cAAc;AAClE;AAGA,IAAM,IACJ;CACE,WAAU,MAAK,EAAE,SAAS,YAAY,CAAC,EAAE;CACzC,WAAU,MAAK,EAAE,SAAS,YAAY,CAAC,EAAE;CACzC,QAAO,OACH,EAAE,SAAS,YAAY,EAAE,SAAS,cAAc,CAAC,CAAC,EAAE,QACtD,EAAE,SAAS;CACb,SAAQ,MAAK,EAAE,SAAS,YAAY,CAAC,CAAC,EAAE;CACxC,aAAY,MAAK,EAAE,SAAS;CAC5B,WAAU,MAAK,EAAE,SAAS;CAC1B,SAAQ,MAAK,EAAE,SAAS,YAAY,EAAE,SAAS;CAC/C,QAAO,MAAK,EAAE,SAAS,YAAY,EAAE,SAAS;AAChD;AAOF,SAAgB,EACd,GACA,GACS;CACT,IAAM,IAAU,IACd;CAEF,IAAI,OAAO,KAAW,UAAU,OAAO;CACvC,IAAM,IAAe,EAAqB;CAC1C,OAAO,IAAe,EAAa,CAAS,IAAI;AAClD;AAmBA,SAAgB,EACd,GACA,GACoC;CACpC,IAAM,IAA6C,CAAC,GAC9C,oBAAkB,IAAI,IAAY,GAClC,oBAAoB,IAAI,IAAY;CAE1C,EAAM,SAAS,GAAM,MAAc;EACjC,EAAK,OAAO,SAAS,GAA0B,MAAuB;GACpE,IAAM,EAAE,kBAAe;GAEvB,IAAI,EAAgB,IAAI,CAAU,GAAG;IACnC,EAAO,KAAK;KACV;KACA;KACA;KACA,SAAS,IAAI,EAAW;IAC1B,CAAC;IACD;GACF;GACA,EAAgB,IAAI,CAAU;GAE9B,IAAM,IAAc,EAAqB,CAAU;GACnD,AAAI,KAAa,EAAkB,IAAI,CAAW;GAElD,IAAM,IAAY,EAChB,GACA,CACF,GAAG;GACH,IAAI,CAAC,GAAW;IACd,EAAO,KAAK;KACV;KACA;KACA;KACA,SAAS,IAAI,EAAW;IAC1B,CAAC;IACD;GACF;GAEA,IAAI,CAAC,EAAqB,CAAS,GAAG;IACpC,EAAO,KAAK;KACV;KACA;KACA;KACA,SAAS,IAAI,EAAW;IAC1B,CAAC;IACD;GACF;GAEA,AAAK,EAAmB,GAAW,EAAM,YAAY,KACnD,EAAO,KAAK;IACV;IACA;IACA;IACA,SAAS,oBAAoB,EAAW;GAC1C,CAAC;EAEL,CAAC;CACH,CAAC;CAED,KAAK,IAAM,KAAY,EAA6B,CAAU,GAC5D,AAAI,EAAS,cAAc,CAAC,EAAkB,IAAI,EAAS,WAAW,KACpE,EAAO,KAAK;EACV,YAAY,EAAqB,EAAS,WAAW;EACrD,SAAS,IAAI,EAAS,YAAY;CACpC,CAAC;CAIL,OAAO;AACT"}
@@ -0,0 +1,25 @@
1
+ import { RJSFSchema } from '@rjsf/utils';
2
+ /**
3
+ * The set of property shapes the simple editor knows how to author. Anything
4
+ * outside this set surfaces in the UI as "advanced" and must be edited via the
5
+ * raw JSON Schema view.
6
+ */
7
+ export type SimpleFieldType = 'text' | 'number' | 'boolean' | 'choice' | 'file';
8
+ export declare const FIELD_TYPE_OPTIONS: {
9
+ value: SimpleFieldType;
10
+ label: string;
11
+ }[];
12
+ export declare function detectFieldType(prop: RJSFSchema | undefined): SimpleFieldType | null;
13
+ export declare function fieldTypeLabel(type: SimpleFieldType | null): string;
14
+ /** Build a fresh schema body for the given simple type, preserving label and help text. */
15
+ export declare function applyFieldType(prev: RJSFSchema, type: SimpleFieldType): RJSFSchema;
16
+ /** Derive a unique camelCase JSON property key from a display title. */
17
+ export declare function generatePropertyKey(title: string, existingKeys: Set<string>): string;
18
+ /**
19
+ * Sanitize a manually-typed property key: strip characters that aren't
20
+ * valid in a JSON Schema property key used as a JS identifier, preserving
21
+ * the editor's casing (unlike `generatePropertyKey`, which derives a
22
+ * camelCase key from a display title).
23
+ */
24
+ export declare function sanitizePropertyKey(raw: string): string;
25
+ //# sourceMappingURL=schemaFieldUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaFieldUtils.d.ts","sourceRoot":"","sources":["../../../src/components/FormTemplateEditor/schemaFieldUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAA;AAE/E,eAAO,MAAM,kBAAkB,EAAE;IAAE,KAAK,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAMzE,CAAA;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,GAAG,SAAS,GAC3B,eAAe,GAAG,IAAI,CAQxB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,GAAG,MAAM,CAGnE;AAED,2FAA2F;AAC3F,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,eAAe,GACpB,UAAU,CA4BZ;AAED,wEAAwE;AACxE,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,GACxB,MAAM,CAiBR;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGvD"}
@@ -0,0 +1,66 @@
1
+ //#region src/components/FormTemplateEditor/schemaFieldUtils.ts
2
+ var e = [
3
+ {
4
+ value: "text",
5
+ label: "Text"
6
+ },
7
+ {
8
+ value: "number",
9
+ label: "Number"
10
+ },
11
+ {
12
+ value: "boolean",
13
+ label: "Yes / No"
14
+ },
15
+ {
16
+ value: "choice",
17
+ label: "Multiple choice"
18
+ },
19
+ {
20
+ value: "file",
21
+ label: "File upload"
22
+ }
23
+ ];
24
+ function t(e) {
25
+ return !e || typeof e != "object" ? null : e.format === "synapse-filehandle-id" ? "file" : e.type === "string" && Array.isArray(e.enum) ? "choice" : e.type === "string" && !e.format ? "text" : e.type === "number" || e.type === "integer" ? "number" : e.type === "boolean" ? "boolean" : null;
26
+ }
27
+ function n(t) {
28
+ return t === null ? "Advanced" : e.find((e) => e.value === t)?.label ?? "Advanced";
29
+ }
30
+ function r(e, t) {
31
+ let n = {
32
+ title: e.title,
33
+ description: e.description
34
+ };
35
+ switch (t) {
36
+ case "text":
37
+ n.type = "string";
38
+ break;
39
+ case "number":
40
+ n.type = "number";
41
+ break;
42
+ case "boolean":
43
+ n.type = "boolean";
44
+ break;
45
+ case "choice":
46
+ n.type = "string", n.enum = Array.isArray(e.enum) && e.enum.length > 0 ? e.enum : ["Option 1"];
47
+ break;
48
+ case "file":
49
+ n.type = "number", n.format = "synapse-filehandle-id";
50
+ break;
51
+ }
52
+ return n;
53
+ }
54
+ function i(e, t) {
55
+ let n = e.toLowerCase().replace(/[^a-z0-9\s]/g, "").trim().split(/\s+/).filter(Boolean).map((e, t) => t === 0 ? e : e.charAt(0).toUpperCase() + e.slice(1)).join("") || "field", r = n, i = 1;
56
+ for (; t.has(r);) i += 1, r = `${n}${i}`;
57
+ return r;
58
+ }
59
+ function a(e) {
60
+ let t = e.replace(/[^A-Za-z0-9_]/g, "");
61
+ return /^[0-9]/.test(t) ? `_${t}` : t;
62
+ }
63
+ //#endregion
64
+ export { e as FIELD_TYPE_OPTIONS, r as applyFieldType, t as detectFieldType, n as fieldTypeLabel, i as generatePropertyKey, a as sanitizePropertyKey };
65
+
66
+ //# sourceMappingURL=schemaFieldUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaFieldUtils.js","names":[],"sources":["../../../src/components/FormTemplateEditor/schemaFieldUtils.ts"],"sourcesContent":["import { RJSFSchema } from '@rjsf/utils'\n\n/**\n * The set of property shapes the simple editor knows how to author. Anything\n * outside this set surfaces in the UI as \"advanced\" and must be edited via the\n * raw JSON Schema view.\n */\nexport type SimpleFieldType = 'text' | 'number' | 'boolean' | 'choice' | 'file'\n\nexport const FIELD_TYPE_OPTIONS: { value: SimpleFieldType; label: string }[] = [\n { value: 'text', label: 'Text' },\n { value: 'number', label: 'Number' },\n { value: 'boolean', label: 'Yes / No' },\n { value: 'choice', label: 'Multiple choice' },\n { value: 'file', label: 'File upload' },\n]\n\nexport function detectFieldType(\n prop: RJSFSchema | undefined,\n): SimpleFieldType | null {\n if (!prop || typeof prop !== 'object') return null\n if (prop.format === 'synapse-filehandle-id') return 'file'\n if (prop.type === 'string' && Array.isArray(prop.enum)) return 'choice'\n if (prop.type === 'string' && !prop.format) return 'text'\n if (prop.type === 'number' || prop.type === 'integer') return 'number'\n if (prop.type === 'boolean') return 'boolean'\n return null\n}\n\nexport function fieldTypeLabel(type: SimpleFieldType | null): string {\n if (type === null) return 'Advanced'\n return FIELD_TYPE_OPTIONS.find(opt => opt.value === type)?.label ?? 'Advanced'\n}\n\n/** Build a fresh schema body for the given simple type, preserving label and help text. */\nexport function applyFieldType(\n prev: RJSFSchema,\n type: SimpleFieldType,\n): RJSFSchema {\n const next: RJSFSchema = {\n title: prev.title,\n description: prev.description,\n }\n switch (type) {\n case 'text':\n next.type = 'string'\n break\n case 'number':\n next.type = 'number'\n break\n case 'boolean':\n next.type = 'boolean'\n break\n case 'choice':\n next.type = 'string'\n next.enum =\n Array.isArray(prev.enum) && prev.enum.length > 0\n ? prev.enum\n : ['Option 1']\n break\n case 'file':\n next.type = 'number'\n next.format = 'synapse-filehandle-id'\n break\n }\n return next\n}\n\n/** Derive a unique camelCase JSON property key from a display title. */\nexport function generatePropertyKey(\n title: string,\n existingKeys: Set<string>,\n): string {\n const base =\n title\n .toLowerCase()\n .replace(/[^a-z0-9\\s]/g, '')\n .trim()\n .split(/\\s+/)\n .filter(Boolean)\n .map((w, i) => (i === 0 ? w : w.charAt(0).toUpperCase() + w.slice(1)))\n .join('') || 'field'\n let key = base\n let i = 1\n while (existingKeys.has(key)) {\n i += 1\n key = `${base}${i}`\n }\n return key\n}\n\n/**\n * Sanitize a manually-typed property key: strip characters that aren't\n * valid in a JSON Schema property key used as a JS identifier, preserving\n * the editor's casing (unlike `generatePropertyKey`, which derives a\n * camelCase key from a display title).\n */\nexport function sanitizePropertyKey(raw: string): string {\n const stripped = raw.replace(/[^A-Za-z0-9_]/g, '')\n return /^[0-9]/.test(stripped) ? `_${stripped}` : stripped\n}\n"],"mappings":";AASA,IAAa,IAAkE;CAC7E;EAAE,OAAO;EAAQ,OAAO;CAAO;CAC/B;EAAE,OAAO;EAAU,OAAO;CAAS;CACnC;EAAE,OAAO;EAAW,OAAO;CAAW;CACtC;EAAE,OAAO;EAAU,OAAO;CAAkB;CAC5C;EAAE,OAAO;EAAQ,OAAO;CAAc;AACxC;AAEA,SAAgB,EACd,GACwB;CAOxB,OANI,CAAC,KAAQ,OAAO,KAAS,WAAiB,OAC1C,EAAK,WAAW,0BAAgC,SAChD,EAAK,SAAS,YAAY,MAAM,QAAQ,EAAK,IAAI,IAAU,WAC3D,EAAK,SAAS,YAAY,CAAC,EAAK,SAAe,SAC/C,EAAK,SAAS,YAAY,EAAK,SAAS,YAAkB,WAC1D,EAAK,SAAS,YAAkB,YAC7B;AACT;AAEA,SAAgB,EAAe,GAAsC;CAEnE,OADI,MAAS,OAAa,aACnB,EAAmB,MAAK,MAAO,EAAI,UAAU,CAAI,GAAG,SAAS;AACtE;AAGA,SAAgB,EACd,GACA,GACY;CACZ,IAAM,IAAmB;EACvB,OAAO,EAAK;EACZ,aAAa,EAAK;CACpB;CACA,QAAQ,GAAR;EACE,KAAK;GACH,EAAK,OAAO;GACZ;EACF,KAAK;GACH,EAAK,OAAO;GACZ;EACF,KAAK;GACH,EAAK,OAAO;GACZ;EACF,KAAK;GAEH,AADA,EAAK,OAAO,UACZ,EAAK,OACH,MAAM,QAAQ,EAAK,IAAI,KAAK,EAAK,KAAK,SAAS,IAC3C,EAAK,OACL,CAAC,UAAU;GACjB;EACF,KAAK;GAEH,AADA,EAAK,OAAO,UACZ,EAAK,SAAS;GACd;CACJ;CACA,OAAO;AACT;AAGA,SAAgB,EACd,GACA,GACQ;CACR,IAAM,IACJ,EACG,YAAY,EACZ,QAAQ,gBAAgB,EAAE,EAC1B,KAAK,EACL,MAAM,KAAK,EACX,OAAO,OAAO,EACd,KAAK,GAAG,MAAO,MAAM,IAAI,IAAI,EAAE,OAAO,CAAC,EAAE,YAAY,IAAI,EAAE,MAAM,CAAC,CAAE,EACpE,KAAK,EAAE,KAAK,SACb,IAAM,GACN,IAAI;CACR,OAAO,EAAa,IAAI,CAAG,IAEzB,AADA,KAAK,GACL,IAAM,GAAG,IAAO;CAElB,OAAO;AACT;AAQA,SAAgB,EAAoB,GAAqB;CACvD,IAAM,IAAW,EAAI,QAAQ,kBAAkB,EAAE;CACjD,OAAO,SAAS,KAAK,CAAQ,IAAI,IAAI,MAAa;AACpD"}
@@ -0,0 +1,28 @@
1
+ import { FormTemplate } from '@sage-bionetworks/synapse-client';
2
+ import { SynapseClientError } from '@sage-bionetworks/synapse-client/util/SynapseClientError';
3
+ import { RJSFSchema } from '@rjsf/utils';
4
+ import { UseMutationOptions } from '@tanstack/react-query';
5
+ import { EditableFormTemplateStep } from './utils';
6
+ import { FormTemplateFieldValidationError } from './formTemplateValidation';
7
+ export type SaveFormTemplateDraftParams = {
8
+ initialTemplate?: FormTemplate;
9
+ initialJsonSchema?: RJSFSchema;
10
+ name: string;
11
+ jsonSchema: RJSFSchema;
12
+ steps: EditableFormTemplateStep[];
13
+ };
14
+ export type SaveFormTemplateDraftResult = {
15
+ ok: true;
16
+ template: FormTemplate;
17
+ } | {
18
+ ok: false;
19
+ validationErrors: FormTemplateFieldValidationError[];
20
+ };
21
+ /**
22
+ * Owns the create-schema, create-template, and update-template mutations, and sequences them
23
+ * into a single save mutation. A validation failure resolves as `{ ok: false, validationErrors }`
24
+ * rather than rejecting; a network failure (including a 412 conflict from a concurrent edit)
25
+ * rejects normally, surfaced via the returned mutation's `error`.
26
+ */
27
+ export declare function useSaveFormTemplate(options?: Omit<UseMutationOptions<SaveFormTemplateDraftResult, SynapseClientError, SaveFormTemplateDraftParams>, 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<SaveFormTemplateDraftResult, SynapseClientError, SaveFormTemplateDraftParams, unknown>;
28
+ //# sourceMappingURL=useSaveFormTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSaveFormTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/FormTemplateEditor/useSaveFormTemplate.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,YAAY,EAAc,MAAM,kCAAkC,CAAA;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0DAA0D,CAAA;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,OAAO,EAAe,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AACvE,OAAO,EAAE,wBAAwB,EAAuB,MAAM,SAAS,CAAA;AACvE,OAAO,EACL,gCAAgC,EAEjC,MAAM,0BAA0B,CAAA;AAEjC,MAAM,MAAM,2BAA2B,GAAG;IACxC,eAAe,CAAC,EAAE,YAAY,CAAA;IAC9B,iBAAiB,CAAC,EAAE,UAAU,CAAA;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,UAAU,CAAA;IACtB,KAAK,EAAE,wBAAwB,EAAE,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,2BAA2B,GACnC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,GACpC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,gBAAgB,EAAE,gCAAgC,EAAE,CAAA;CAAE,CAAA;AAEvE;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,CAAC,EAAE,IAAI,CACZ,kBAAkB,CAChB,2BAA2B,EAC3B,kBAAkB,EAClB,2BAA2B,CAC5B,EACD,YAAY,CACb,4IAuDF"}
@@ -0,0 +1,39 @@
1
+ import { useCreateFormTemplate as e, useUpdateFormTemplate as t } from "../../synapse-queries/dataaccess/useFormTemplate.js";
2
+ import { useCreateJsonSchema as n } from "../../synapse-queries/jsonschema/useCreateJsonSchema.js";
3
+ import { validateFormTemplateFields as r } from "./formTemplateValidation.js";
4
+ import { toFormTemplateSteps as i } from "./utils.js";
5
+ import { useMutation as a } from "@tanstack/react-query";
6
+ import o from "lodash-es/isEqual";
7
+ //#region src/components/FormTemplateEditor/useSaveFormTemplate.ts
8
+ function s(s) {
9
+ let c = n(), l = e(), u = t();
10
+ return a({
11
+ ...s,
12
+ mutationFn: async (e) => {
13
+ let t = i(e.steps), n = r(t, e.jsonSchema);
14
+ if (n.length > 0) return {
15
+ ok: !1,
16
+ validationErrors: n
17
+ };
18
+ let a = e.initialTemplate?.schema$id ?? "";
19
+ (!o(e.jsonSchema, e.initialJsonSchema) || !a) && (a = (await c.mutateAsync(e.jsonSchema)).newVersionInfo.$id);
20
+ let s = {
21
+ ...e.initialTemplate,
22
+ name: e.name,
23
+ schema$id: a,
24
+ steps: t
25
+ };
26
+ return {
27
+ ok: !0,
28
+ template: e.initialTemplate?.id ? await u.mutateAsync({
29
+ templateId: e.initialTemplate.id,
30
+ formTemplate: s
31
+ }) : await l.mutateAsync(s)
32
+ };
33
+ }
34
+ });
35
+ }
36
+ //#endregion
37
+ export { s as useSaveFormTemplate };
38
+
39
+ //# sourceMappingURL=useSaveFormTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSaveFormTemplate.js","names":[],"sources":["../../../src/components/FormTemplateEditor/useSaveFormTemplate.ts"],"sourcesContent":["/*\n * Network orchestration for saving a FormTemplate draft: pre-flight client-side validation\n * (mirroring the server's per-field rules, since the server only returns a flat message),\n * registering a new JSON Schema version when the schema body changed, and creating or updating\n * the FormTemplate against that schema version.\n */\nimport { useCreateJsonSchema } from '@/synapse-queries/jsonschema/useCreateJsonSchema'\nimport {\n useCreateFormTemplate,\n useUpdateFormTemplate,\n} from '@/synapse-queries/dataaccess/useFormTemplate'\nimport { FormTemplate, JsonSchema } from '@sage-bionetworks/synapse-client'\nimport { SynapseClientError } from '@sage-bionetworks/synapse-client/util/SynapseClientError'\nimport { RJSFSchema } from '@rjsf/utils'\nimport isEqual from 'lodash-es/isEqual'\nimport { useMutation, UseMutationOptions } from '@tanstack/react-query'\nimport { EditableFormTemplateStep, toFormTemplateSteps } from './utils'\nimport {\n FormTemplateFieldValidationError,\n validateFormTemplateFields,\n} from './formTemplateValidation'\n\nexport type SaveFormTemplateDraftParams = {\n initialTemplate?: FormTemplate\n initialJsonSchema?: RJSFSchema\n name: string\n jsonSchema: RJSFSchema\n steps: EditableFormTemplateStep[]\n}\n\nexport type SaveFormTemplateDraftResult =\n | { ok: true; template: FormTemplate }\n | { ok: false; validationErrors: FormTemplateFieldValidationError[] }\n\n/**\n * Owns the create-schema, create-template, and update-template mutations, and sequences them\n * into a single save mutation. A validation failure resolves as `{ ok: false, validationErrors }`\n * rather than rejecting; a network failure (including a 412 conflict from a concurrent edit)\n * rejects normally, surfaced via the returned mutation's `error`.\n */\nexport function useSaveFormTemplate(\n options?: Omit<\n UseMutationOptions<\n SaveFormTemplateDraftResult,\n SynapseClientError,\n SaveFormTemplateDraftParams\n >,\n 'mutationFn'\n >,\n) {\n const createSchema = useCreateJsonSchema()\n const createTemplate = useCreateFormTemplate()\n const updateTemplate = useUpdateFormTemplate()\n\n return useMutation<\n SaveFormTemplateDraftResult,\n SynapseClientError,\n SaveFormTemplateDraftParams\n >({\n ...options,\n mutationFn: async params => {\n const formTemplateSteps = toFormTemplateSteps(params.steps)\n\n const validationErrors = validateFormTemplateFields(\n formTemplateSteps,\n params.jsonSchema,\n )\n if (validationErrors.length > 0) {\n return { ok: false, validationErrors }\n }\n\n // The schema registry has no update operation — every save that changed the schema body\n // registers a fresh, immutable version. Re-registering an unchanged body would still create\n // an unnecessary version, so skip it when the draft's schema matches what was last resolved.\n let schema$id = params.initialTemplate?.schema$id ?? ''\n const schemaChanged = !isEqual(\n params.jsonSchema,\n params.initialJsonSchema,\n )\n if (schemaChanged || !schema$id) {\n const response = await createSchema.mutateAsync(\n params.jsonSchema as JsonSchema,\n )\n schema$id = response.newVersionInfo!.$id!\n }\n\n const formTemplate: FormTemplate = {\n ...params.initialTemplate,\n name: params.name,\n schema$id,\n steps: formTemplateSteps,\n }\n\n const template = params.initialTemplate?.id\n ? await updateTemplate.mutateAsync({\n templateId: params.initialTemplate.id,\n formTemplate,\n })\n : await createTemplate.mutateAsync(formTemplate)\n\n return { ok: true, template }\n },\n })\n}\n"],"mappings":";;;;;;;AAwCA,SAAgB,EACd,GAQA;CACA,IAAM,IAAe,EAAoB,GACnC,IAAiB,EAAsB,GACvC,IAAiB,EAAsB;CAE7C,OAAO,EAIL;EACA,GAAG;EACH,YAAY,OAAM,MAAU;GAC1B,IAAM,IAAoB,EAAoB,EAAO,KAAK,GAEpD,IAAmB,EACvB,GACA,EAAO,UACT;GACA,IAAI,EAAiB,SAAS,GAC5B,OAAO;IAAE,IAAI;IAAO;GAAiB;GAMvC,IAAI,IAAY,EAAO,iBAAiB,aAAa;GAKrD,CAAI,CAJmB,EACrB,EAAO,YACP,EAAO,iBACT,KACqB,CAAC,OAIpB,KAAY,MAHW,EAAa,YAClC,EAAO,UACT,GACqB,eAAgB;GAGvC,IAAM,IAA6B;IACjC,GAAG,EAAO;IACV,MAAM,EAAO;IACb;IACA,OAAO;GACT;GASA,OAAO;IAAE,IAAI;IAAM,UAPF,EAAO,iBAAiB,KACrC,MAAM,EAAe,YAAY;KAC/B,YAAY,EAAO,gBAAgB;KACnC;IACF,CAAC,IACD,MAAM,EAAe,YAAY,CAAY;GAErB;EAC9B;CACF,CAAC;AACH"}
@@ -0,0 +1,21 @@
1
+ import { FormTemplateStep } from '@sage-bionetworks/synapse-client';
2
+ export { moveItem } from '@/utils/functions/ArrayUtils';
3
+ /**
4
+ * A `FormTemplateStep` with a client-only stable identity, used as a React
5
+ * key and drag-and-drop sortable id. Steps have no natural unique field
6
+ * (unlike fields, whose identity is their `schemaPath`), so the editor
7
+ * tracks one here. `uiKey` never leaves this component tree — strip it with
8
+ * `toFormTemplateSteps` before handing steps back to a caller.
9
+ */
10
+ export type EditableFormTemplateStep = FormTemplateStep & {
11
+ uiKey: string;
12
+ };
13
+ /** Create a new empty step with a fresh identity. */
14
+ export declare function createEditableStep(): EditableFormTemplateStep;
15
+ /** Attach a fresh identity to each step loaded from outside the editor. */
16
+ export declare function toEditableSteps(steps: FormTemplateStep[]): EditableFormTemplateStep[];
17
+ /** Strip the client-only identity before handing steps back to a caller. */
18
+ export declare function toFormTemplateSteps(steps: EditableFormTemplateStep[]): FormTemplateStep[];
19
+ /** Normalize a JSON pointer (ensure leading slash). */
20
+ export declare function normalizePointer(p: string): string;
21
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/FormTemplateEditor/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAEnE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAIvD;;;;;;GAMG;AACH,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3E,qDAAqD;AACrD,wBAAgB,kBAAkB,IAAI,wBAAwB,CAO7D;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,CAC7B,KAAK,EAAE,gBAAgB,EAAE,GACxB,wBAAwB,EAAE,CAE5B;AAED,4EAA4E;AAC5E,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,wBAAwB,EAAE,GAChC,gBAAgB,EAAE,CAEpB;AAED,uDAAuD;AACvD,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAGlD"}
@@ -0,0 +1,27 @@
1
+ import { moveItem as e } from "../../utils/functions/ArrayUtils.js";
2
+ //#region src/components/FormTemplateEditor/utils.ts
3
+ var t = 0;
4
+ function n() {
5
+ return {
6
+ title: "New Step",
7
+ description: "",
8
+ fields: [],
9
+ uiKey: `step-${t++}`
10
+ };
11
+ }
12
+ function r(e) {
13
+ return e.map((e) => ({
14
+ ...e,
15
+ uiKey: `step-${t++}`
16
+ }));
17
+ }
18
+ function i(e) {
19
+ return e.map(({ uiKey: e, ...t }) => t);
20
+ }
21
+ function a(e) {
22
+ return e && (e.startsWith("/") ? e : `/${e}`);
23
+ }
24
+ //#endregion
25
+ export { n as createEditableStep, e as moveItem, a as normalizePointer, r as toEditableSteps, i as toFormTemplateSteps };
26
+
27
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../../src/components/FormTemplateEditor/utils.ts"],"sourcesContent":["import { FormTemplateStep } from '@sage-bionetworks/synapse-client'\n\nexport { moveItem } from '@/utils/functions/ArrayUtils'\n\nlet nextUiKeySeq = 0\n\n/**\n * A `FormTemplateStep` with a client-only stable identity, used as a React\n * key and drag-and-drop sortable id. Steps have no natural unique field\n * (unlike fields, whose identity is their `schemaPath`), so the editor\n * tracks one here. `uiKey` never leaves this component tree — strip it with\n * `toFormTemplateSteps` before handing steps back to a caller.\n */\nexport type EditableFormTemplateStep = FormTemplateStep & { uiKey: string }\n\n/** Create a new empty step with a fresh identity. */\nexport function createEditableStep(): EditableFormTemplateStep {\n return {\n title: 'New Step',\n description: '',\n fields: [],\n uiKey: `step-${nextUiKeySeq++}`,\n }\n}\n\n/** Attach a fresh identity to each step loaded from outside the editor. */\nexport function toEditableSteps(\n steps: FormTemplateStep[],\n): EditableFormTemplateStep[] {\n return steps.map(step => ({ ...step, uiKey: `step-${nextUiKeySeq++}` }))\n}\n\n/** Strip the client-only identity before handing steps back to a caller. */\nexport function toFormTemplateSteps(\n steps: EditableFormTemplateStep[],\n): FormTemplateStep[] {\n return steps.map(({ uiKey: _uiKey, ...rest }) => rest)\n}\n\n/** Normalize a JSON pointer (ensure leading slash). */\nexport function normalizePointer(p: string): string {\n if (!p) return p\n return p.startsWith('/') ? p : `/${p}`\n}\n"],"mappings":";;AAIA,IAAI,IAAe;AAYnB,SAAgB,IAA+C;CAC7D,OAAO;EACL,OAAO;EACP,aAAa;EACb,QAAQ,CAAC;EACT,OAAO,QAAQ;CACjB;AACF;AAGA,SAAgB,EACd,GAC4B;CAC5B,OAAO,EAAM,KAAI,OAAS;EAAE,GAAG;EAAM,OAAO,QAAQ;CAAiB,EAAE;AACzE;AAGA,SAAgB,EACd,GACoB;CACpB,OAAO,EAAM,KAAK,EAAE,OAAO,GAAQ,GAAG,QAAW,CAAI;AACvD;AAGA,SAAgB,EAAiB,GAAmB;CAElD,OADK,MACE,EAAE,WAAW,GAAG,IAAI,IAAI,IAAI;AACrC"}
@@ -13,7 +13,7 @@ export interface CustomFormContext extends FormContextType {
13
13
  /**
14
14
  * Allows varying the appearance of descriptions in the UI as either a popover or an expand/collapse control
15
15
  */
16
- descriptionVariant?: 'popover' | 'expand';
16
+ descriptionVariant?: 'popover' | 'expand' | 'inline';
17
17
  /**
18
18
  * Allows varying the format of the description in the UI. If 'table', then the description and type are both shown
19
19
  * in a table format. If 'string', then the description is shown as a string.
@@ -1 +1 @@
1
- {"version":3,"file":"CustomFormContext.d.ts","sourceRoot":"","sources":["../../../src/components/JsonSchemaForm/CustomFormContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD;;;;;;;;OAQG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAA;IAEtC;;OAEG;IACH,kBAAkB,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;IAEzC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAEtC;;OAEG;IACH,gCAAgC,CAAC,EAAE,OAAO,CAAA;IAE1C;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAE3B;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,aAAa,GAAG,UAAU,CAAA;CAC3C"}
1
+ {"version":3,"file":"CustomFormContext.d.ts","sourceRoot":"","sources":["../../../src/components/JsonSchemaForm/CustomFormContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD;;;;;;;;OAQG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAA;IAEtC;;OAEG;IACH,kBAAkB,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;IAEpD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAEtC;;OAEG;IACH,gCAAgC,CAAC,EAAE,OAAO,CAAA;IAE1C;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAE3B;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,aAAa,GAAG,UAAU,CAAA;CAC3C"}
@@ -1 +1 @@
1
- ._jsonSchemaForm_sosz4_1{grid-template-rows:auto auto auto auto auto;margin-bottom:15px;display:grid}._jsonSchemaForm_sosz4_1 .react-select-container>.form-control{height:53.33px}._jsonSchemaForm_sosz4_1 .form-group.rjsf-field-array{margin-bottom:0}._jsonSchemaForm_sosz4_1 .form-control{height:unset}._jsonSchemaForm_sosz4_1 .MuiTextField-root:not(.datetime-picker){display:flex}._jsonSchemaForm_sosz4_1 .rjsf-array-item .LabelContainer{display:none!important}._jsonSchemaForm_sosz4_1>.form-group{grid-row-start:1}._jsonSchemaForm_sosz4_1>hr{grid-row-start:4;width:100%}._jsonSchemaForm_sosz4_1 .row{padding:0 10px}._jsonSchemaForm_sosz4_1 .rjsf-field-array>.field-description{margin-top:0;margin-bottom:8px}._jsonSchemaForm_sosz4_1 .rjsf-array-item .field-description,._jsonSchemaForm_sosz4_1 .rjsf-array-item .HelpButton{display:none}._jsonSchemaForm_sosz4_1 .rjsf-array-item .form-control,._jsonSchemaForm_sosz4_1 .rjsf-array-item .react-select-container{grid-row-start:widget}._jsonSchemaForm_sosz4_1 .rjsf-array-item div{grid-row-start:errors}._jsonSchemaForm_sosz4_1 .LabelContainer{display:flex}._jsonSchemaForm_sosz4_1 .LabelContainer label{flex-grow:1}._jsonSchemaForm_sosz4_1 .LabelContainer label span.required{color:var(--synapse-red-required);margin-left:2px}._jsonSchemaForm_sosz4_1 select{background-color:var(--synapse-gray-light)}._jsonSchemaForm_sosz4_1 .rjsf-field-array>.rjsf-array-item>label.form-label{display:none}._jsonSchemaForm_sosz4_1 .HelpButton{float:right;cursor:pointer;margin:0 0 .5rem}._jsonSchemaForm_sosz4_1 table.FieldDescriptionTable tr th,._jsonSchemaForm_sosz4_1 table.FieldDescriptionTable tr td{vertical-align:middle;padding:3px 0}._jsonSchemaForm_sosz4_1 table.FieldDescriptionTable tr th .field-description,._jsonSchemaForm_sosz4_1 table.FieldDescriptionTable tr td .field-description{margin-bottom:0}._jsonSchemaForm_sosz4_1 table.FieldDescriptionTable tr th{color:var(--synapse-text-color-disabled);padding-right:25px;font-weight:400}
1
+ ._jsonSchemaForm_zdhfc_1{grid-template-rows:auto auto auto auto auto;margin-bottom:15px;display:grid}._jsonSchemaForm_zdhfc_1 .react-select-container>.form-control{height:53.33px}._jsonSchemaForm_zdhfc_1 .form-group.rjsf-field-array{margin-bottom:0}._jsonSchemaForm_zdhfc_1 .form-control{height:unset}._jsonSchemaForm_zdhfc_1 .MuiTextField-root:not(.datetime-picker){display:flex}._jsonSchemaForm_zdhfc_1 .rjsf-array-item .LabelContainer{display:none!important}._jsonSchemaForm_zdhfc_1>.form-group{grid-row-start:1}._jsonSchemaForm_zdhfc_1>hr{grid-row-start:4;width:100%}._jsonSchemaForm_zdhfc_1 .row{padding:0 10px}._jsonSchemaForm_zdhfc_1 .field-description-inline{margin-bottom:8px}._jsonSchemaForm_zdhfc_1 .rjsf-field-array>.field-description{margin-top:0;margin-bottom:8px}._jsonSchemaForm_zdhfc_1 .rjsf-array-item .field-description,._jsonSchemaForm_zdhfc_1 .rjsf-array-item .field-description-inline,._jsonSchemaForm_zdhfc_1 .rjsf-array-item .HelpButton{display:none}._jsonSchemaForm_zdhfc_1 .rjsf-array-item .form-control,._jsonSchemaForm_zdhfc_1 .rjsf-array-item .react-select-container{grid-row-start:widget}._jsonSchemaForm_zdhfc_1 .rjsf-array-item div{grid-row-start:errors}._jsonSchemaForm_zdhfc_1 .LabelContainer{display:flex}._jsonSchemaForm_zdhfc_1 .LabelContainer label{flex-grow:1}._jsonSchemaForm_zdhfc_1 .LabelContainer label span.required{color:var(--synapse-red-required);margin-left:2px}._jsonSchemaForm_zdhfc_1 select{background-color:var(--synapse-gray-light)}._jsonSchemaForm_zdhfc_1 .rjsf-field-array>.rjsf-array-item>label.form-label{display:none}._jsonSchemaForm_zdhfc_1 .HelpButton{float:right;cursor:pointer;margin:0 0 .5rem}._jsonSchemaForm_zdhfc_1 table.FieldDescriptionTable tr th,._jsonSchemaForm_zdhfc_1 table.FieldDescriptionTable tr td{vertical-align:middle;padding:3px 0}._jsonSchemaForm_zdhfc_1 table.FieldDescriptionTable tr th .field-description,._jsonSchemaForm_zdhfc_1 table.FieldDescriptionTable tr td .field-description{margin-bottom:0}._jsonSchemaForm_zdhfc_1 table.FieldDescriptionTable tr th{color:var(--synapse-text-color-disabled);padding-right:25px;font-weight:400}
@@ -1,4 +1,4 @@
1
- import './JsonSchemaForm.css';var e = { jsonSchemaForm: "_jsonSchemaForm_sosz4_1" };
1
+ import './JsonSchemaForm.css';var e = { jsonSchemaForm: "_jsonSchemaForm_zdhfc_1" };
2
2
  //#endregion
3
3
  export { e as default };
4
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"JsonSchemaForm.module.js","names":[],"sources":["../../../src/components/JsonSchemaForm/JsonSchemaForm.module.scss"],"sourcesContent":[".jsonSchemaForm {\n display: grid;\n // We can't rearrange the order of the HTML elements, so we use grid rows to reorder them.\n grid-template-rows: auto auto auto auto auto;\n margin-bottom: 15px;\n\n :global(.react-select-container) > :global(.form-control) {\n height: 53.33px;\n }\n\n :global(.form-group.rjsf-field-array) {\n margin-bottom: 0px;\n }\n\n :global(.form-control) {\n height: unset;\n }\n\n :global(.MuiTextField-root):not(:global(.datetime-picker)) {\n display: flex;\n }\n\n :global(.rjsf-array-item) :global(.LabelContainer) {\n display: none !important;\n }\n\n > :global(.form-group) {\n grid-row-start: 1;\n }\n\n > hr {\n grid-row-start: 4;\n width: 100%;\n }\n\n :global(.row) {\n padding: 0px 10px;\n }\n\n :global(.rjsf-field-array) > :global(.field-description) {\n margin-top: 0px;\n margin-bottom: 8px;\n }\n\n :global(.rjsf-array-item) {\n :global(.field-description) {\n display: none;\n }\n\n :global(.HelpButton) {\n display: none;\n }\n\n :global(.form-control),\n :global(.react-select-container) {\n grid-row-start: widget;\n }\n\n div {\n grid-row-start: errors;\n }\n }\n\n :global(.LabelContainer) {\n display: flex;\n label {\n flex-grow: 1;\n span:global(.required) {\n color: var(--synapse-red-required);\n margin-left: 2px;\n }\n }\n }\n\n select {\n background-color: var(--synapse-gray-light);\n }\n\n :global(.rjsf-field-array)\n > :global(.rjsf-array-item)\n > label:global(.form-label) {\n display: none;\n }\n\n :global(.HelpButton) {\n float: right;\n margin: 0 0 0.5rem;\n cursor: pointer;\n }\n\n table:global(.FieldDescriptionTable) {\n tr {\n th,\n td {\n padding: 3px 0px;\n vertical-align: middle;\n\n :global(.field-description) {\n margin-bottom: 0;\n }\n }\n th {\n padding-right: 25px;\n font-weight: 400;\n color: var(--synapse-text-color-disabled);\n }\n }\n }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"JsonSchemaForm.module.js","names":[],"sources":["../../../src/components/JsonSchemaForm/JsonSchemaForm.module.scss"],"sourcesContent":[".jsonSchemaForm {\n display: grid;\n // We can't rearrange the order of the HTML elements, so we use grid rows to reorder them.\n grid-template-rows: auto auto auto auto auto;\n margin-bottom: 15px;\n\n :global(.react-select-container) > :global(.form-control) {\n height: 53.33px;\n }\n\n :global(.form-group.rjsf-field-array) {\n margin-bottom: 0px;\n }\n\n :global(.form-control) {\n height: unset;\n }\n\n :global(.MuiTextField-root):not(:global(.datetime-picker)) {\n display: flex;\n }\n\n :global(.rjsf-array-item) :global(.LabelContainer) {\n display: none !important;\n }\n\n > :global(.form-group) {\n grid-row-start: 1;\n }\n\n > hr {\n grid-row-start: 4;\n width: 100%;\n }\n\n :global(.row) {\n padding: 0px 10px;\n }\n\n :global(.field-description-inline) {\n margin-bottom: 8px;\n }\n\n :global(.rjsf-field-array) > :global(.field-description) {\n margin-top: 0px;\n margin-bottom: 8px;\n }\n\n :global(.rjsf-array-item) {\n :global(.field-description),\n :global(.field-description-inline) {\n display: none;\n }\n\n :global(.HelpButton) {\n display: none;\n }\n\n :global(.form-control),\n :global(.react-select-container) {\n grid-row-start: widget;\n }\n\n div {\n grid-row-start: errors;\n }\n }\n\n :global(.LabelContainer) {\n display: flex;\n label {\n flex-grow: 1;\n span:global(.required) {\n color: var(--synapse-red-required);\n margin-left: 2px;\n }\n }\n }\n\n select {\n background-color: var(--synapse-gray-light);\n }\n\n :global(.rjsf-field-array)\n > :global(.rjsf-array-item)\n > label:global(.form-label) {\n display: none;\n }\n\n :global(.HelpButton) {\n float: right;\n margin: 0 0 0.5rem;\n cursor: pointer;\n }\n\n table:global(.FieldDescriptionTable) {\n tr {\n th,\n td {\n padding: 3px 0px;\n vertical-align: middle;\n\n :global(.field-description) {\n margin-bottom: 0;\n }\n }\n th {\n padding-right: 25px;\n font-weight: 400;\n color: var(--synapse-text-color-disabled);\n }\n }\n }\n}\n"],"mappings":""}
@@ -37,13 +37,18 @@
37
37
  padding: 0px 10px;
38
38
  }
39
39
 
40
+ :global(.field-description-inline) {
41
+ margin-bottom: 8px;
42
+ }
43
+
40
44
  :global(.rjsf-field-array) > :global(.field-description) {
41
45
  margin-top: 0px;
42
46
  margin-bottom: 8px;
43
47
  }
44
48
 
45
49
  :global(.rjsf-array-item) {
46
- :global(.field-description) {
50
+ :global(.field-description),
51
+ :global(.field-description-inline) {
47
52
  display: none;
48
53
  }
49
54
 
@@ -1 +1 @@
1
- {"version":3,"file":"RJSFInputLabel.d.ts","sourceRoot":"","sources":["../../../../src/components/JsonSchemaForm/templates/RJSFInputLabel.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,eAAe,EACf,QAAQ,EACR,UAAU,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,iBAAiB,EAAY,MAAM,OAAO,CAAA;AAEnD,KAAK,mBAAmB,CACtB,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,IAC7B,iBAAiB,CAAC;IACpB;wBACoB;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,sCAAsC;IACtC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,4CAA4C;IAC5C,WAAW,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,4BAA4B;IAC5B,QAAQ,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;CAC5B,CAAC,CAAA;AAEF;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAmDpC"}
1
+ {"version":3,"file":"RJSFInputLabel.d.ts","sourceRoot":"","sources":["../../../../src/components/JsonSchemaForm/templates/RJSFInputLabel.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,eAAe,EACf,QAAQ,EACR,UAAU,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,iBAAiB,EAAY,MAAM,OAAO,CAAA;AAEnD,KAAK,mBAAmB,CACtB,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,IAC7B,iBAAiB,CAAC;IACpB;wBACoB;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,sCAAsC;IACtC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,4CAA4C;IAC5C,WAAW,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,4BAA4B;IAC5B,QAAQ,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;CAC5B,CAAC,CAAA;AAEF;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,CAAC,GAAG,GAAG,EACP,CAAC,SAAS,gBAAgB,GAAG,UAAU,EACvC,CAAC,SAAS,eAAe,GAAG,GAAG,EAC/B,KAAK,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,2CAsDpC"}