reactivated 0.30.0 → 0.30.1-a1538

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 (74) hide show
  1. package/dist/build.client.mjs +69 -0
  2. package/dist/build.client.mjs.map +1 -0
  3. package/dist/build.renderer.mjs +73 -0
  4. package/dist/build.renderer.mjs.map +1 -0
  5. package/dist/client.js +4 -11
  6. package/dist/client.js.map +1 -1
  7. package/dist/components/Form.js +5 -12
  8. package/dist/components/Form.js.map +1 -1
  9. package/dist/components/Widget.d.ts +0 -1
  10. package/dist/components/Widget.js +2 -21
  11. package/dist/components/Widget.js.map +1 -1
  12. package/dist/context.js +5 -10
  13. package/dist/context.js.map +1 -1
  14. package/dist/eslintrc.js +3 -0
  15. package/dist/eslintrc.js.map +1 -1
  16. package/dist/forms/index.d.ts +31 -13
  17. package/dist/forms/index.js +189 -171
  18. package/dist/forms/index.js.map +1 -1
  19. package/dist/forms/widgets.d.ts +2 -0
  20. package/dist/forms/widgets.js +11 -24
  21. package/dist/forms/widgets.js.map +1 -1
  22. package/dist/generated.d.ts +10 -0
  23. package/dist/generated.js +1 -2
  24. package/dist/generated.js.map +1 -1
  25. package/dist/generator/constants.mjs +24 -0
  26. package/dist/generator/constants.mjs.map +1 -0
  27. package/dist/generator.mjs +293 -0
  28. package/dist/generator.mjs.map +1 -0
  29. package/dist/index.js +2 -18
  30. package/dist/index.js.map +1 -1
  31. package/dist/{linaria.js → linaria.mjs} +45 -50
  32. package/dist/linaria.mjs.map +1 -0
  33. package/dist/models.js +1 -2
  34. package/dist/renderer.d.ts +3 -3
  35. package/dist/renderer.js +27 -40
  36. package/dist/renderer.js.map +1 -1
  37. package/dist/rpc.d.ts +58 -0
  38. package/dist/rpc.js +126 -0
  39. package/dist/rpc.js.map +1 -0
  40. package/dist/types.js +1 -2
  41. package/package.json +13 -6
  42. package/scripts/setup_environment.sh +1 -1
  43. package/src/{build.client.tsx → build.client.mts} +3 -2
  44. package/src/{build.renderer.tsx → build.renderer.mts} +12 -5
  45. package/src/components/Widget.tsx +0 -13
  46. package/src/eslintrc.tsx +4 -0
  47. package/src/forms/index.tsx +154 -43
  48. package/src/forms/widgets.tsx +4 -1
  49. package/src/generated.tsx +10 -0
  50. package/src/generator.mts +350 -0
  51. package/src/{linaria.tsx → linaria.mts} +19 -1
  52. package/src/renderer.tsx +11 -8
  53. package/src/rpc.tsx +207 -0
  54. package/tsconfig.json +3 -2
  55. package/dist/babel.config.d.ts +0 -12
  56. package/dist/babel.config.js +0 -17
  57. package/dist/babel.config.js.map +0 -1
  58. package/dist/build.client.js +0 -105
  59. package/dist/build.client.js.map +0 -1
  60. package/dist/build.renderer.js +0 -104
  61. package/dist/build.renderer.js.map +0 -1
  62. package/dist/generator/constants.js +0 -29
  63. package/dist/generator/constants.js.map +0 -1
  64. package/dist/generator.js +0 -156
  65. package/dist/generator.js.map +0 -1
  66. package/dist/linaria.js.map +0 -1
  67. package/src/babel.config.tsx +0 -14
  68. package/src/generator.tsx +0 -182
  69. /package/dist/{build.client.d.ts → build.client.d.mts} +0 -0
  70. /package/dist/{build.renderer.d.ts → build.renderer.d.mts} +0 -0
  71. /package/dist/generator/{constants.d.ts → constants.d.mts} +0 -0
  72. /package/dist/{generator.d.ts → generator.d.mts} +0 -0
  73. /package/dist/{linaria.d.ts → linaria.d.mts} +0 -0
  74. /package/src/generator/{constants.tsx → constants.mts} +0 -0
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+ import linaria from "./linaria.mjs";
3
+ import { vanillaExtractPlugin } from "@vanilla-extract/esbuild-plugin";
4
+ import * as esbuild from "esbuild";
5
+ import ImportGlobPlugin from "esbuild-plugin-import-glob";
6
+ const entryNames = process.argv.slice(2);
7
+ const entryPoints = Object.fromEntries(entryNames.map((entry) => [entry, `./client/${entry}.tsx`]));
8
+ const production = process.env.NODE_ENV === "production";
9
+ const identifiers = production ? "short" : "debug";
10
+ const env = {
11
+ NODE_ENV: production ? "production" : "development",
12
+ BUILD_VERSION: process.env.BUILD_VERSION,
13
+ TAG_VERSION: process.env.TAG_VERSION,
14
+ };
15
+ esbuild
16
+ .context({
17
+ entryPoints,
18
+ bundle: true,
19
+ // We use terser to minify because esbuild breaks safari sourcemaps.
20
+ // It's likely a Safari bug, but terser seems to work for some reason.
21
+ minify: false,
22
+ // Related to sourcemaps as well in Safari.
23
+ legalComments: "none",
24
+ platform: "browser",
25
+ outdir: "./static/dist",
26
+ sourcemap: true,
27
+ target: "es2018",
28
+ preserveSymlinks: true,
29
+ external: ["moment", "@client/generated/images"],
30
+ define: {
31
+ // You need both. The one from the stringified JSON is not picked
32
+ // up during the build process.
33
+ "process.env.NODE_ENV": production ? '"production"' : '"development"',
34
+ process: JSON.stringify({ env }),
35
+ // Redux persist needs this.
36
+ global: "{}",
37
+ },
38
+ loader: {
39
+ ".gif": "file",
40
+ ".jpeg": "file",
41
+ ".jpg": "file",
42
+ ".png": "file",
43
+ ".svg": "file",
44
+ ".ttf": "file",
45
+ ".woff": "file",
46
+ ".woff2": "file",
47
+ },
48
+ plugins: [
49
+ // ESM imports make this weird.
50
+ ImportGlobPlugin.default(),
51
+ // We manually pass in identifiers because the client is not
52
+ // minified by esbuild but the renderer is, so class names could
53
+ // differ.
54
+ // Instead of set it manually instead of relying on minification
55
+ // settings.
56
+ vanillaExtractPlugin({ identifiers }),
57
+ linaria({ sourceMap: true, esbuildOptions: { sourcemap: "inline" } }),
58
+ ],
59
+ })
60
+ .then(async (context) => {
61
+ if (production === false) {
62
+ context.watch();
63
+ }
64
+ else {
65
+ await context.rebuild();
66
+ process.exit();
67
+ }
68
+ });
69
+ //# sourceMappingURL=build.client.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.client.mjs","sourceRoot":"","sources":["../src/build.client.mts"],"names":[],"mappings":";AAEA,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,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;KACf;IACD,MAAM,EAAE;QACJ,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE,MAAM;KACnB;IACD,OAAO,EAAE;QACL,+BAA+B;QAC9B,gBAA+D,CAAC,OAAO,EAAE;QAC1E,4DAA4D;QAC5D,gEAAgE;QAChE,UAAU;QACV,gEAAgE;QAChE,YAAY;QACZ,oBAAoB,CAAC,EAAC,WAAW,EAAC,CAAC;QACnC,OAAO,CAAC,EAAC,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE,EAAC,SAAS,EAAE,QAAQ,EAAC,EAAC,CAAC;KACpE;CACJ,CAAC;KACD,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACpB,IAAI,UAAU,KAAK,KAAK,EAAE;QACtB,OAAO,CAAC,KAAK,EAAE,CAAC;KACnB;SAAM;QACH,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACxB,OAAO,CAAC,IAAI,EAAE,CAAC;KAClB;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env node
2
+ import linaria from "./linaria.mjs";
3
+ import { vanillaExtractPlugin } from "@vanilla-extract/esbuild-plugin";
4
+ import * as esbuild from "esbuild";
5
+ import ImportGlobPlugin from "esbuild-plugin-import-glob";
6
+ import path from "path";
7
+ import { createRequire } from "module";
8
+ let server = null;
9
+ const CACHE_KEY = `${process.cwd()}/node_modules/_reactivated/renderer.js`;
10
+ const production = process.env.NODE_ENV === "production";
11
+ const identifiers = production ? "short" : "debug";
12
+ const restartServer = async () => {
13
+ if (server != null) {
14
+ server.close();
15
+ }
16
+ const modulePath = path.resolve(CACHE_KEY);
17
+ // https://ar.al/2021/02/22/cache-busting-in-node.js-dynamic-esm-imports/
18
+ const require = createRequire(import.meta.url);
19
+ delete require.cache[CACHE_KEY];
20
+ server = require(CACHE_KEY).server;
21
+ };
22
+ esbuild
23
+ .context({
24
+ stdin: {
25
+ contents: `
26
+ export {server, currentTime} from "reactivated/dist/renderer";
27
+ `,
28
+ resolveDir: process.cwd(),
29
+ loader: "ts",
30
+ },
31
+ minify: production,
32
+ bundle: true,
33
+ platform: "node",
34
+ outfile: "./node_modules/_reactivated/renderer.js",
35
+ sourcemap: true,
36
+ target: "es2018",
37
+ preserveSymlinks: true,
38
+ // Needed so _reactivated is included in renderer.tsx regardless
39
+ // of the location of reactivated being in the cwd node_modules or
40
+ // above as in monorepos.
41
+ nodePaths: [`${process.cwd()}/node_modules`],
42
+ plugins: [
43
+ // ESM imports make this weird.
44
+ ImportGlobPlugin.default(),
45
+ // We manually pass in identifiers because the client is not
46
+ // minified by esbuild but the renderer is, so class names could
47
+ // differ.
48
+ // Instead of set it manually instead of relying on minification
49
+ // settings.
50
+ vanillaExtractPlugin({ identifiers }),
51
+ linaria({ sourceMap: true }),
52
+ {
53
+ name: "restartServer",
54
+ setup: (build) => {
55
+ if (production === false) {
56
+ build.onEnd((result) => {
57
+ restartServer();
58
+ });
59
+ }
60
+ },
61
+ },
62
+ ],
63
+ })
64
+ .then(async (context) => {
65
+ if (production === false) {
66
+ context.watch();
67
+ }
68
+ else {
69
+ await context.rebuild();
70
+ process.exit();
71
+ }
72
+ });
73
+ //# sourceMappingURL=build.renderer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.renderer.mjs","sourceRoot":"","sources":["../src/build.renderer.mts"],"names":[],"mappings":";AAEA,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAG1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,aAAa,EAAC,MAAM,QAAQ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;QAChE,YAAY;QACZ,oBAAoB,CAAC,EAAC,WAAW,EAAC,CAAC;QACnC,OAAO,CAAC,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC;QAC1B;YACI,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACb,IAAI,UAAU,KAAK,KAAK,EAAE;oBACtB,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE;wBACnB,aAAa,EAAE,CAAC;oBACpB,CAAC,CAAC,CAAC;iBACN;YACL,CAAC;SACJ;KACJ;CACJ,CAAC;KACD,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACpB,IAAI,UAAU,KAAK,KAAK,EAAE;QACtB,OAAO,CAAC,KAAK,EAAE,CAAC;KACnB;SAAM;QACH,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACxB,OAAO,CAAC,IAAI,EAAE,CAAC;KAClB;AACL,CAAC,CAAC,CAAC"}
package/dist/client.js CHANGED
@@ -1,19 +1,12 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.bootstrap = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const react_dom_1 = require("react-dom");
1
+ import React from "react";
2
+ import { hydrate } from "react-dom";
9
3
  const props = window.__PRELOADED_STATE__;
10
4
  if (module.hot) {
11
5
  module.hot.accept();
12
6
  }
13
7
  // tslint:disable-next-line
14
8
  const Template = require("client/templates/" + props.template_name + ".tsx").default;
15
- const bootstrap = () => {
16
- (0, react_dom_1.hydrate)(react_1.default.createElement(Template, Object.assign({}, props)), document.getElementById("root"));
9
+ export const bootstrap = () => {
10
+ hydrate(React.createElement(Template, { ...props }), document.getElementById("root"));
17
11
  };
18
- exports.bootstrap = bootstrap;
19
12
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,yCAAkC;AAElC,MAAM,KAAK,GAAI,MAAc,CAAC,mBAAmB,CAAC;AAElD,IAAK,MAAc,CAAC,GAAG,EAAE;IACpB,MAAc,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;CAChC;AAED,2BAA2B;AAC3B,MAAM,QAAQ,GAAG,OAAO,CAAC,mBAAmB,GAAG,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC,CAAC,OAAO,CAAC;AAE9E,MAAM,SAAS,GAAG,GAAG,EAAE;IAC1B,IAAA,mBAAO,EAAC,8BAAC,QAAQ,oBAAK,KAAK,EAAI,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;AACtE,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB"}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAElC,MAAM,KAAK,GAAI,MAAc,CAAC,mBAAmB,CAAC;AAElD,IAAK,MAAc,CAAC,GAAG,EAAE;IACpB,MAAc,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;CAChC;AAED,2BAA2B;AAC3B,MAAM,QAAQ,GAAG,OAAO,CAAC,mBAAmB,GAAG,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC,CAAC,OAAO,CAAC;AAErF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE;IAC1B,OAAO,CAAC,oBAAC,QAAQ,OAAK,KAAK,GAAI,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;AACtE,CAAC,CAAC"}
@@ -1,14 +1,7 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
1
+ import React from "react";
2
+ export const ManagementForm = ({ formSet, }) => {
3
+ return (React.createElement(React.Fragment, null,
4
+ React.createElement("input", { type: "hidden", name: `${formSet.prefix}-INITIAL_FORMS`, value: formSet.initial_form_count }),
5
+ React.createElement("input", { type: "hidden", name: `${formSet.prefix}-TOTAL_FORMS`, value: formSet.total_form_count })));
4
6
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ManagementForm = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const ManagementForm = ({ formSet, }) => {
9
- return (react_1.default.createElement(react_1.default.Fragment, null,
10
- react_1.default.createElement("input", { type: "hidden", name: `${formSet.prefix}-INITIAL_FORMS`, value: formSet.initial_form_count }),
11
- react_1.default.createElement("input", { type: "hidden", name: `${formSet.prefix}-TOTAL_FORMS`, value: formSet.total_form_count })));
12
- };
13
- exports.ManagementForm = ManagementForm;
14
7
  //# sourceMappingURL=Form.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Form.js","sourceRoot":"","sources":["../../src/components/Form.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAqDnB,MAAM,cAAc,GAAG,CAAqB,EAC/C,OAAO,GAGV,EAAE,EAAE;IACD,OAAO,CACH;QACI,yCACI,IAAI,EAAC,QAAQ,EACb,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,gBAAgB,EACvC,KAAK,EAAE,OAAO,CAAC,kBAAkB,GACnC;QACF,yCACI,IAAI,EAAC,QAAQ,EACb,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,cAAc,EACrC,KAAK,EAAE,OAAO,CAAC,gBAAgB,GACjC,CACH,CACN,CAAC;AACN,CAAC,CAAC;AAnBW,QAAA,cAAc,kBAmBzB"}
1
+ {"version":3,"file":"Form.js","sourceRoot":"","sources":["../../src/components/Form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAqD1B,MAAM,CAAC,MAAM,cAAc,GAAG,CAAqB,EAC/C,OAAO,GAGV,EAAE,EAAE;IACD,OAAO,CACH;QACI,+BACI,IAAI,EAAC,QAAQ,EACb,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,gBAAgB,EACvC,KAAK,EAAE,OAAO,CAAC,kBAAkB,GACnC;QACF,+BACI,IAAI,EAAC,QAAQ,EACb,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,cAAc,EACrC,KAAK,EAAE,OAAO,CAAC,gBAAgB,GACjC,CACH,CACN,CAAC;AACN,CAAC,CAAC"}
@@ -120,7 +120,6 @@ export interface SelectDateWidget extends BaseWidget {
120
120
  template_name: "django/forms/widgets/select_date.html";
121
121
  }
122
122
  export type WidgetType = TextInput | URLInput | NumberInput | CheckboxInput | PasswordInput | EmailInput | HiddenInput | Textarea | Select | Autocomplete | SelectMultiple | DateInput | SelectDateWidget | ClearableFileInput;
123
- export declare const getValue: (optgroup: Optgroup) => string | number;
124
123
  export declare const getValueForSelect: (widget: Select | Autocomplete | SelectMultiple) => string | string[];
125
124
  export declare const isHidden: (widget: WidgetType) => boolean;
126
125
  export {};
@@ -1,25 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isHidden = exports.getValueForSelect = exports.getValue = void 0;
4
1
  const TEXTAREA_ROWS = 10;
5
2
  function isMultiple(widget) {
6
3
  return "multiple" in widget.attrs;
7
4
  }
8
- const getValue = (optgroup) => {
9
- const rawValue = optgroup[1][0].value;
10
- if (rawValue == null) {
11
- return "";
12
- }
13
- else if (rawValue === true) {
14
- return "True";
15
- }
16
- else if (rawValue === false) {
17
- return "False";
18
- }
19
- return rawValue;
20
- };
21
- exports.getValue = getValue;
22
- const getValueForSelect = (widget) => {
5
+ export const getValueForSelect = (widget) => {
23
6
  if (isMultiple(widget)) {
24
7
  return widget.value;
25
8
  }
@@ -27,7 +10,5 @@ const getValueForSelect = (widget) => {
27
10
  return widget.value == null ? "" : widget.value[0];
28
11
  }
29
12
  };
30
- exports.getValueForSelect = getValueForSelect;
31
- const isHidden = (widget) => "type" in widget && widget.type === "hidden";
32
- exports.isHidden = isHidden;
13
+ export const isHidden = (widget) => "type" in widget && widget.type === "hidden";
33
14
  //# sourceMappingURL=Widget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Widget.js","sourceRoot":"","sources":["../../src/components/Widget.tsx"],"names":[],"mappings":";;;AAEA,MAAM,aAAa,GAAG,EAAE,CAAC;AA4HzB,SAAS,UAAU,CACf,MAAa;IAEb,OAAO,UAAU,IAAI,MAAM,CAAC,KAAK,CAAC;AACtC,CAAC;AAiDM,MAAM,QAAQ,GAAG,CAAC,QAAkB,EAAE,EAAE;IAC3C,MAAM,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAEtC,IAAI,QAAQ,IAAI,IAAI,EAAE;QAClB,OAAO,EAAE,CAAC;KACb;SAAM,IAAI,QAAQ,KAAK,IAAI,EAAE;QAC1B,OAAO,MAAM,CAAC;KACjB;SAAM,IAAI,QAAQ,KAAK,KAAK,EAAE;QAC3B,OAAO,OAAO,CAAC;KAClB;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC;AAXW,QAAA,QAAQ,YAWnB;AAEK,MAAM,iBAAiB,GAAG,CAAC,MAA8C,EAAE,EAAE;IAChF,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE;QACpB,OAAO,MAAM,CAAC,KAAK,CAAC;KACvB;SAAM;QACH,OAAO,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACtD;AACL,CAAC,CAAC;AANW,QAAA,iBAAiB,qBAM5B;AAEK,MAAM,QAAQ,GAAG,CAAC,MAAkB,EAAE,EAAE,CAC3C,MAAM,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;AADpC,QAAA,QAAQ,YAC4B"}
1
+ {"version":3,"file":"Widget.js","sourceRoot":"","sources":["../../src/components/Widget.tsx"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,EAAE,CAAC;AA4HzB,SAAS,UAAU,CACf,MAAa;IAEb,OAAO,UAAU,IAAI,MAAM,CAAC,KAAK,CAAC;AACtC,CAAC;AAiDD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAA8C,EAAE,EAAE;IAChF,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE;QACpB,OAAO,MAAM,CAAC,KAAK,CAAC;KACvB;SAAM;QACH,OAAO,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACtD;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,MAAkB,EAAE,EAAE,CAC3C,MAAM,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC"}
package/dist/context.js CHANGED
@@ -1,14 +1,9 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const react_1 = __importDefault(require("react"));
7
- exports.default = () => {
8
- const Context = react_1.default.createContext(null);
1
+ import React from "react";
2
+ export default () => {
3
+ const Context = React.createContext(null);
9
4
  const Provider = (props) => {
10
- const [value, setValue] = react_1.default.useState(props.value);
11
- return (react_1.default.createElement(Context.Provider, { value: Object.assign(Object.assign({}, value), { setValue }) }, props.children));
5
+ const [value, setValue] = React.useState(props.value);
6
+ return (React.createElement(Context.Provider, { value: { ...value, setValue } }, props.children));
12
7
  };
13
8
  const getServerData = () => {
14
9
  const props = window.__PRELOADED_PROPS__;
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAE1B,kBAAe,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K,GAA6B,MAAc,CAAC,mBAAmB,CAAC;QAC3E,MAAM,OAAO,GAAc,MAAc,CAAC,qBAAqB,CAAC;QAEhE,OAAO,EAAC,KAAK,EAAE,OAAO,EAAC,CAAC;IAC5B,CAAC,CAAC;IAEF,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAC,CAAC;AAC9C,CAAC,CAAC"}
package/dist/eslintrc.js CHANGED
@@ -79,6 +79,9 @@ module.exports = {
79
79
  "unused-imports/no-unused-vars": "error",
80
80
  "@typescript-eslint/explicit-module-boundary-types": "off",
81
81
  "@typescript-eslint/no-non-null-assertion": "off",
82
+ // For when we do RPC calls and forget to call await on the promise
83
+ // to check against a null return.
84
+ "@typescript-eslint/no-unnecessary-condition": "error",
82
85
  // We use empty callbacks that are no-ops sometimes.
83
86
  "@typescript-eslint/no-empty-function": ["error", { allow: ["arrowFunctions"] }],
84
87
  // Typescript additions
@@ -1 +1 @@
1
- {"version":3,"file":"eslintrc.js","sourceRoot":"","sources":["../src/eslintrc.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG;IACb,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,2BAA2B;IACnC,aAAa,EAAE;QACX,OAAO,EAAE,CAAC,iBAAiB,CAAC;KAC/B;IACD,OAAO,EAAE,CAAC,oBAAoB,EAAE,gBAAgB,CAAC;IACjD,QAAQ,EAAE;QACN,KAAK,EAAE;YACH,OAAO,EAAE,QAAQ;SACpB;QACD,iBAAiB,EAAE,YAAY;KAClC;IACD,KAAK,EAAE;QACH,cAAc,EAAE,CAAC,OAAO,EAAE,EAAC,qBAAqB,EAAE,IAAI,EAAC,CAAC;QAExD,kCAAkC;QAClC,kBAAkB,EAAE,CAAC;QACrB,cAAc,EAAE,CAAC;QACjB,sBAAsB,EAAE,CAAC;QAEzB,gEAAgE;QAChE,wDAAwD;QACxD,4BAA4B,EAAE,CAAC;QAC/B,mCAAmC,EAAE,CAAC;QAEtC,6BAA6B,EAAE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KACvD;IACD,OAAO,EAAE;QACL,oBAAoB;QACpB,0BAA0B;QAC1B,gCAAgC;QAChC,uCAAuC;QACvC,+DAA+D;QAC/D,UAAU;QACV,0BAA0B;QAC1B,sBAAsB;QACtB,wBAAwB;KAC3B;CACJ,CAAC"}
@@ -67,17 +67,14 @@ export interface FormHandler<T extends FieldMap> {
67
67
  hiddenFields: FieldHandler<DjangoFormsWidgetsHiddenInput>[];
68
68
  nonFieldErrors: string[] | null;
69
69
  setValue: <K extends keyof T>(name: K, value: FormValues<T>[K]) => void;
70
+ setValues: (values: FormValues<T>) => void;
70
71
  setErrors: (errors: FormErrors<T>) => void;
71
72
  iterate: (iterator: Array<Extract<keyof T, string>>, callback: (fieldName: keyof T, field: FieldHandler<T[keyof T]["widget"]>) => React.ReactNode) => React.ReactNode[];
72
73
  reset: () => void;
73
74
  }
74
75
  export declare const getInitialFormState: <T extends FieldMap<WidgetLike>>(form: FormLike<T, WidgetLike>) => FormValues<T>;
75
- export declare const getInitialFormSetState: <T extends FieldMap<WidgetLike>>(forms: FormLike<T, WidgetLike>[]) => {
76
- [k: string]: FormValues<T>;
77
- };
78
- export declare const getInitialFormSetErrors: <T extends FieldMap<WidgetLike>>(forms: FormLike<T, WidgetLike>[]) => {
79
- [k: string]: { [P in keyof T]?: string[] | undefined; } | null;
80
- };
76
+ export declare const getInitialFormSetState: <T extends FieldMap<WidgetLike>>(forms: FormLike<T, WidgetLike>[], initial?: FormValues<T>[] | undefined) => FormValues<T>[];
77
+ export declare const getInitialFormSetErrors: <T extends FieldMap<WidgetLike>>(forms: FormLike<T, WidgetLike>[]) => ({ [P in keyof T]?: string[] | undefined; } | null)[];
81
78
  export declare const getFormHandler: <T extends FieldMap<WidgetLike>>({ form, values, initial, errors, setValues, setErrors, ...options }: {
82
79
  form: FormLike<T, WidgetLike>;
83
80
  values: FormValues<T>;
@@ -88,11 +85,13 @@ export declare const getFormHandler: <T extends FieldMap<WidgetLike>>({ form, va
88
85
  fieldInterceptor?: ((fieldName: keyof T, field: FieldHandler<T[keyof T]["widget"]>, values: FormValues<T>) => FieldHandler<T[keyof T]["widget"]>) | undefined;
89
86
  changeInterceptor?: ((name: keyof T, prevValues: FormValues<T>, nextValues: FormValues<T>) => FormValues<T>) | undefined;
90
87
  }) => FormHandler<T>;
91
- export declare const useForm: <T extends FieldMap<WidgetLike>>({ form, ...options }: {
88
+ export declare const useForm: <T extends FieldMap<WidgetLike>, S extends (keyof T)[] = [], R extends { [P in Exclude<keyof T, S[number]>]: T[P]; } = { [P_1 in Exclude<keyof T, S[number]>]: T[P_1]; }>(options: {
92
89
  form: FormLike<T, WidgetLike>;
93
- fieldInterceptor?: ((fieldName: keyof T, field: FieldHandler<T[keyof T]["widget"]>, values: FormValues<T>) => FieldHandler<T[keyof T]["widget"]>) | undefined;
94
- changeInterceptor?: ((name: keyof T, prevValues: FormValues<T>, nextValues: FormValues<T>) => FormValues<T>) | undefined;
95
- }) => FormHandler<T>;
90
+ initial?: Partial<FormValues<R>> | undefined;
91
+ exclude?: [...S] | undefined;
92
+ fieldInterceptor?: ((fieldName: keyof R, field: FieldHandler<R[keyof R]["widget"]>, values: FormValues<R>) => FieldHandler<R[keyof R]["widget"]>) | undefined;
93
+ changeInterceptor?: ((name: keyof R, prevValues: FormValues<R>, nextValues: FormValues<R>) => FormValues<R>) | undefined;
94
+ }) => FormHandler<R>;
96
95
  export type CreateFieldHandler<T> = T extends {
97
96
  tag: string;
98
97
  name: string;
@@ -151,15 +150,18 @@ export declare const ManagementForm: <T extends FieldMap<WidgetLike>>({ formSet,
151
150
  export declare const useFormSet: <T extends FieldMap<WidgetLike>>(options: {
152
151
  formSet: FormSetLike<T, WidgetLike>;
153
152
  onAddForm?: ((form: FormLike<T, WidgetLike>) => void) | undefined;
153
+ initial?: FormValues<T>[] | undefined;
154
154
  fieldInterceptor?: ((fieldName: keyof T, field: FieldHandler<T[keyof T]["widget"]>, values: FormValues<T>) => FieldHandler<T[keyof T]["widget"]>) | undefined;
155
155
  changeInterceptor?: ((name: keyof T, prevValues: FormValues<T>, nextValues: FormValues<T>) => FormValues<T>) | undefined;
156
156
  }) => {
157
157
  schema: FormSetLike<T, WidgetLike>;
158
- values: Partial<{
159
- [k: string]: FormValues<T>;
160
- }>;
158
+ values: FormValues<T>[];
161
159
  forms: FormHandler<T>[];
162
160
  addForm: () => void;
161
+ clear: () => void;
162
+ setFormsAndValues: (values: FormValues<T>[]) => void;
163
+ setErrors: React.Dispatch<React.SetStateAction<({ [P in keyof T]?: string[] | undefined; } | null)[]>>;
164
+ setValues: React.Dispatch<React.SetStateAction<FormValues<T>[]>>;
163
165
  };
164
166
  export declare const bindWidgetType: <W extends WidgetLike>() => {
165
167
  createRenderer: <TProps = Record<never, never>>(callback: (field: FieldHandler<W>, props: TProps) => React.ReactNode) => {
@@ -181,4 +183,20 @@ export declare const FormSet: <T extends FieldMap<DjangoFormsWidgetsHiddenInput
181
183
  formSet: FormSetLike<T, WidgetLike>;
182
184
  as: "p" | "table";
183
185
  }) => JSX.Element;
186
+ export type UnknownFormValues<T extends FieldMap> = {
187
+ [K in keyof T]: T[K] extends {
188
+ enum: unknown;
189
+ } ? T[K]["enum"] | null : unknown;
190
+ };
191
+ export type FormOrFormSetValues<T> = T extends {
192
+ tag: "FormGroup";
193
+ } ? Omit<{
194
+ [K in keyof T]: FormOrFormSetValues<T[K]>;
195
+ }, "tag"> : T extends FormLike<any> ? UnknownFormValues<T["fields"]> : T extends FormSetLike<any> ? Array<UnknownFormValues<T["empty_form"]["fields"]>> : T extends null ? null : never;
196
+ export type FormOrFormSetErrors<T> = T extends {
197
+ tag: "FormGroup";
198
+ } ? Omit<{
199
+ [K in keyof T]?: FormOrFormSetErrors<T[K]>;
200
+ }, "tag"> : T extends FormLike<any> ? NonNullable<T["errors"]> : T extends FormSetLike<any> ? Array<NonNullable<T["empty_form"]["errors"]>> : T extends null ? null : never;
201
+ export declare const getValue: (optgroup: [null, [import("../generated").ReactivatedTypesOptgroupMember], number]) => string | number;
184
202
  export {};