@truedat/df 5.17.2 → 5.18.0

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 (25) hide show
  1. package/package.json +4 -4
  2. package/src/components/DynamicFormViewer.js +39 -2
  3. package/src/messages/en.js +1 -0
  4. package/src/messages/es.js +1 -0
  5. package/src/templates/components/Template.js +64 -16
  6. package/src/templates/components/TemplateFilters.js +56 -0
  7. package/src/templates/components/TemplateRoutes.js +17 -11
  8. package/src/templates/components/Templates.js +45 -21
  9. package/src/templates/components/TemplatesContext.js +66 -0
  10. package/src/templates/components/TemplatesTable.js +113 -0
  11. package/src/templates/components/__tests__/TemplatesTable.spec.js +29 -0
  12. package/src/templates/components/__tests__/__snapshots__/Template.spec.js.snap +54 -16
  13. package/src/templates/components/__tests__/__snapshots__/TemplatesTable.spec.js.snap +3 -0
  14. package/src/templates/components/templateForm/FieldForm.js +2 -0
  15. package/src/templates/components/templateForm/TemplateForm.js +14 -9
  16. package/src/templates/components/templateForm/TemplateFormActions.js +21 -38
  17. package/src/templates/components/templateForm/__tests__/TemplateForm.spec.js +2 -1
  18. package/src/templates/components/templateForm/__tests__/TemplateFormActions.spec.js +0 -2
  19. package/src/templates/components/templateForm/__tests__/__snapshots__/TemplateForm.spec.js.snap +38 -12
  20. package/src/templates/components/templateForm/__tests__/__snapshots__/TemplateFormActions.spec.js.snap +34 -109
  21. package/src/templates/components/TemplateCards.js +0 -57
  22. package/src/templates/components/TemplateTabs.js +0 -40
  23. package/src/templates/components/__tests__/TemplateCards.spec.js +0 -34
  24. package/src/templates/components/__tests__/__snapshots__/TemplateCards.spec.js.snap +0 -62
  25. package/src/templates/components/scopes.js +0 -8
@@ -1,34 +0,0 @@
1
- import React from "react";
2
- import { shallowWithIntl } from "@truedat/test/intl-stub";
3
- import { TemplateCards } from "../TemplateCards";
4
-
5
- jest.mock("react-router-dom", () => ({
6
- ...jest.requireActual("react-router-dom"),
7
- useLocation: () => ({
8
- hash: "",
9
- key: "v5q3jz",
10
- pathname: "/templates",
11
- search: "?scope=bg"
12
- })
13
- }));
14
-
15
- describe("<TemplateCards />", () => {
16
- const templates = [
17
- {
18
- scope: "bg",
19
- name: "testbg",
20
- label: "testbg"
21
- },
22
- {
23
- scope: "dq",
24
- name: "testdq",
25
- label: "testdq"
26
- }
27
- ];
28
- const props = { templates };
29
-
30
- it("matches the latest snapshot", () => {
31
- const wrapper = shallowWithIntl(<TemplateCards {...props} />);
32
- expect(wrapper).toMatchSnapshot();
33
- });
34
- });
@@ -1,62 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<TemplateCards /> matches the latest snapshot 1`] = `
4
- <CardGroup>
5
- <Card
6
- as={
7
- {
8
- "$$typeof": Symbol(react.forward_ref),
9
- "displayName": "Link",
10
- "propTypes": {
11
- "innerRef": [Function],
12
- "onClick": [Function],
13
- "replace": [Function],
14
- "target": [Function],
15
- "to": [Function],
16
- },
17
- "render": [Function],
18
- }
19
- }
20
- className="create template"
21
- link={true}
22
- to="/templates/new"
23
- >
24
- <CardContent
25
- textAlign="center"
26
- >
27
- <CardHeader>
28
- <MemoizedFormattedMessage
29
- id="templates.actions.create"
30
- />
31
- </CardHeader>
32
- <CardDescription>
33
- <IconGroup
34
- as="i"
35
- floated="left"
36
- size="big"
37
- >
38
- <Icon
39
- as="i"
40
- name="file outline"
41
- />
42
- <Icon
43
- as="i"
44
- corner={true}
45
- name="add"
46
- />
47
- </IconGroup>
48
- </CardDescription>
49
- </CardContent>
50
- </Card>
51
- <TemplateCard
52
- key="0"
53
- template={
54
- {
55
- "label": "testbg",
56
- "name": "testbg",
57
- "scope": "bg",
58
- }
59
- }
60
- />
61
- </CardGroup>
62
- `;
@@ -1,8 +0,0 @@
1
- import _ from "lodash/fp";
2
-
3
- export const validScope = (scope) => _.negate(_.includes(scope))(["cx", "ca"]);
4
- export const filterScope = (scope) => (validScope(scope) ? scope : null);
5
- export const filterScopeWithTemplates = (scope, templates) =>
6
- validScope(scope) && _.flow(_.map("scope"), _.includes(scope))(templates)
7
- ? scope
8
- : null;