@tsed/react-formio 1.13.7-rc.1 → 1.14.1

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/package.json CHANGED
@@ -1,25 +1,10 @@
1
1
  {
2
2
  "name": "@tsed/react-formio",
3
- "version": "1.13.7-rc.1",
3
+ "version": "1.14.1",
4
4
  "description": "Provide a react formio wrapper. Written in TypeScript.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.modern.js",
7
7
  "source": "src/index.ts",
8
- "exports": {
9
- ".": {
10
- "node": {
11
- "module": "./dist/index.modern.js",
12
- "require": "./dist/index.js",
13
- "import": "./dist/index.modern.js"
14
- },
15
- "browser": {
16
- "import": "./dist/index.modern.js",
17
- "require": "./dist/index.js"
18
- },
19
- "default": "./dist/index.js"
20
- },
21
- "./package.json": "./package.json"
22
- },
23
8
  "scripts": {
24
9
  "lint": "eslint \"**/*.{js,jsx,ts,tsx}\"",
25
10
  "lint:fix": "yarn lint --fix",
@@ -29,7 +14,7 @@
29
14
  "watch": "microbundle watch --no-compress --format modern,cjs --jsx React.createElement --jsxFragment React.Fragment --globals react/jsx-runtime=jsx"
30
15
  },
31
16
  "dependencies": {
32
- "@tsed/redux-utils": "1.13.7-rc.1",
17
+ "@tsed/redux-utils": "1.14.1",
33
18
  "eventemitter2": "^6.4.3",
34
19
  "prop-types": "^15.7.2"
35
20
  },
@@ -44,8 +29,8 @@
44
29
  "tooltip.js": ">=1.3.3"
45
30
  },
46
31
  "devDependencies": {
47
- "@tsed/tailwind": "1.13.7-rc.1",
48
- "@tsed/tailwind-formio": "1.13.7-rc.1"
32
+ "@tsed/tailwind": "1.14.1",
33
+ "@tsed/tailwind-formio": "1.14.1"
49
34
  },
50
35
  "repository": "https://github.com/TypedProject/tsed-formio",
51
36
  "bugs": {
@@ -19,6 +19,8 @@ export interface FormParametersProps {
19
19
  displayChoices?: { label: string; value: any }[];
20
20
  enableTags?: boolean;
21
21
  className?: string;
22
+ baseUrl?: string;
23
+ readonly?: Record<string, boolean>;
22
24
  }
23
25
 
24
26
  export function FormParameters({
@@ -27,7 +29,9 @@ export function FormParameters({
27
29
  enableTags = true,
28
30
  typeChoices = [],
29
31
  displayChoices = defaultDisplayChoices,
30
- className = ""
32
+ className = "",
33
+ readonly = {},
34
+ baseUrl = window.location.origin
31
35
  }: FormParametersProps): ReactElement {
32
36
  const hasTypeChoices = typeChoices && typeChoices.length > 1;
33
37
 
@@ -40,6 +44,7 @@ export function FormParameters({
40
44
  name={"title"}
41
45
  required={true}
42
46
  value={form.title}
47
+ disabled={!!readonly["title"]}
43
48
  onChange={onChange}
44
49
  />
45
50
  </div>
@@ -49,6 +54,7 @@ export function FormParameters({
49
54
  placeholder='Enter the form machine name'
50
55
  name={"name"}
51
56
  required={true}
57
+ disabled={!!readonly["name"]}
52
58
  value={form.name}
53
59
  onChange={onChange}
54
60
  />
@@ -62,17 +68,25 @@ export function FormParameters({
62
68
  description={
63
69
  <span className={"text-xxs flex items-center"}>
64
70
  <i className={"bx bx-link ml-1 mr-1"} />
65
- {window.location.origin + "/" + form.path}
71
+ {`${baseUrl}/${form.path}`}
66
72
  </span>
67
73
  }
68
74
  required={true}
69
75
  value={form.path}
76
+ disabled={!!readonly["path"]}
70
77
  style={{ textTransform: "lowercase", width: "120px" }}
71
78
  onChange={onChange}
72
79
  />
73
80
  </div>
74
81
  <div className={"w-1/3"}>
75
- <Select label={"Display as"} name={"display"} value={form.display} choices={displayChoices} onChange={onChange} />
82
+ <Select
83
+ label={"Display as"}
84
+ name={"display"}
85
+ disabled={!!readonly["display"]}
86
+ value={form.display}
87
+ choices={displayChoices}
88
+ onChange={onChange}
89
+ />
76
90
  </div>
77
91
  {hasTypeChoices && (
78
92
  <div className={"w-1/3"}>
@@ -1,3 +1,4 @@
1
+ import cloneDeep from "lodash/cloneDeep";
1
2
  import { useEffect, useReducer } from "react";
2
3
 
3
4
  import { FormSchema } from "../../interfaces/FormSchema";
@@ -47,7 +48,7 @@ export function useFormEdit(props: UseFormEditHookProps) {
47
48
  };
48
49
 
49
50
  return {
50
- form: current,
51
+ form: cloneDeep(current),
51
52
  redo,
52
53
  undo,
53
54
  reset,