@arpproject/recrate 0.1.7 → 0.1.9
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/dist/index.d.ts +3 -2
- package/dist/recrate.css +4 -4
- package/dist/recrate.es.js +34674 -114061
- package/package.json +41 -32
- package/.eslintrc.json +0 -37
- package/.storybook/main.ts +0 -40
- package/.storybook/preview.tsx +0 -46
- package/babel.config.json +0 -5
- package/docker-compose.yml +0 -30
- package/docs/.nojekyll +0 -1
- package/docs/assets/highlight.css +0 -99
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1448
- package/docs/classes/src_crate_builder_CrateManager_crate_manager.CrateManager.html +0 -240
- package/docs/classes/src_crate_builder_CrateManager_profile_manager.ProfileManager.html +0 -42
- package/docs/classes/src_crate_builder_editor_state.EditorState.html +0 -28
- package/docs/classes/src_crate_builder_types.CrateManagerType.html +0 -57
- package/docs/classes/src_crate_builder_types.ProfileManagerType.html +0 -13
- package/docs/functions/src_crate_builder_CrateManager_lib.isURL.html +0 -2
- package/docs/functions/src_crate_builder_CrateManager_lib.mintNewCrate.html +0 -3
- package/docs/functions/src_crate_builder_CrateManager_lib.normalise.html +0 -5
- package/docs/functions/src_crate_builder_CrateManager_lib.normaliseEntityType.html +0 -1
- package/docs/index.html +0 -58
- package/docs/interfaces/src_crate_builder_types.NormalisedCrate.html +0 -3
- package/docs/interfaces/src_crate_builder_types.NormalisedEntityDefinition.html +0 -4
- package/docs/interfaces/src_crate_builder_types.NormalisedProfile.html +0 -9
- package/docs/interfaces/src_crate_builder_types.ProfileLayout.html +0 -2
- package/docs/interfaces/src_crate_builder_types.ProfileLayoutGroup.html +0 -9
- package/docs/interfaces/src_crate_builder_types.UnverifiedCrate.html +0 -3
- package/docs/interfaces/src_crate_builder_types.UnverifiedEntityDefinition.html +0 -4
- package/docs/modules/src_crate_builder_CrateManager_crate_manager.html +0 -2
- package/docs/modules/src_crate_builder_CrateManager_lib.html +0 -6
- package/docs/modules/src_crate_builder_CrateManager_profile_manager.html +0 -2
- package/docs/modules/src_crate_builder_editor_state.html +0 -2
- package/docs/modules/src_crate_builder_types.html +0 -16
- package/docs/types/src_crate_builder_types.EntityReference.html +0 -1
- package/docs/types/src_crate_builder_types.NormalisedContext.html +0 -1
- package/docs/types/src_crate_builder_types.PrimitiveType.html +0 -1
- package/docs/types/src_crate_builder_types.ProfileAssociation.html +0 -1
- package/docs/types/src_crate_builder_types.ProfileInput.html +0 -1
- package/docs/types/src_crate_builder_types.UnverifiedContext.html +0 -1
- package/docs/variables/src_crate_builder_CrateManager_lib.urlProtocols.html +0 -1
- package/index.html +0 -13
- package/load-data-packs.cjs +0 -38
- package/postcss.config.cjs +0 -6
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -43
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/marker-icon.png +0 -0
- package/public/marker-shadow.png +0 -0
- package/public/robots.txt +0 -3
- package/react-app-env.d.ts +0 -1
- package/rollup.config.js +0 -26
- package/src/app/App.tsx +0 -13
- package/src/app/EmbeddedComponent.tsx +0 -432
- package/src/app/index.html +0 -20
- package/src/app/index.tsx +0 -19
- package/src/app/lookup.ts +0 -141
- package/src/app/override-styles.css +0 -96
- package/src/crate-builder/CrateManager/contexts/1.1-context.jsonld +0 -2660
- package/src/crate-builder/CrateManager/contexts/1.2-DRAFT-context.jsonld +0 -2918
- package/src/crate-builder/CrateManager/contexts.ts +0 -42
- package/src/crate-builder/CrateManager/crate-manager-benchmarking.spec.ts +0 -31
- package/src/crate-builder/CrateManager/crate-manager-loading-exporting.spec.ts +0 -431
- package/src/crate-builder/CrateManager/crate-manager-operations.spec.ts +0 -298
- package/src/crate-builder/CrateManager/crate-manager.spec.ts +0 -2336
- package/src/crate-builder/CrateManager/crate-manager.ts +0 -2111
- package/src/crate-builder/CrateManager/lib.spec.ts +0 -133
- package/src/crate-builder/CrateManager/lib.ts +0 -170
- package/src/crate-builder/CrateManager/profile-manager.spec.ts +0 -593
- package/src/crate-builder/CrateManager/profile-manager.ts +0 -367
- package/src/crate-builder/CrateManager/schema-type-definitions.json +0 -35122
- package/src/crate-builder/CrateManager/validate-identifier.spec.ts +0 -82
- package/src/crate-builder/CrateManager/validate-identifier.ts +0 -65
- package/src/crate-builder/RenderEntity/Add.tsx +0 -249
- package/src/crate-builder/RenderEntity/AddControl.stories.tsx +0 -126
- package/src/crate-builder/RenderEntity/AddControl.tsx +0 -84
- package/src/crate-builder/RenderEntity/AutoComplete.tsx +0 -215
- package/src/crate-builder/RenderEntity/BulkAdd.tsx +0 -136
- package/src/crate-builder/RenderEntity/DeleteProperty.tsx +0 -33
- package/src/crate-builder/RenderEntity/DialogAddProperty.tsx +0 -83
- package/src/crate-builder/RenderEntity/DialogBrowseEntities.tsx +0 -136
- package/src/crate-builder/RenderEntity/DialogEditContext.tsx +0 -107
- package/src/crate-builder/RenderEntity/DialogPreviewCrate.tsx +0 -54
- package/src/crate-builder/RenderEntity/DialogSaveCrateAsTemplate.tsx +0 -65
- package/src/crate-builder/RenderEntity/DialogSaveEntityTemplate.tsx +0 -87
- package/src/crate-builder/RenderEntity/DisplayPropertyName.stories.tsx +0 -30
- package/src/crate-builder/RenderEntity/DisplayPropertyName.tsx +0 -21
- package/src/crate-builder/RenderEntity/EntityId.tsx +0 -75
- package/src/crate-builder/RenderEntity/EntityName.tsx +0 -49
- package/src/crate-builder/RenderEntity/EntityProperty.tsx +0 -188
- package/src/crate-builder/RenderEntity/EntityPropertyInstance.tsx +0 -255
- package/src/crate-builder/RenderEntity/EntityType.tsx +0 -95
- package/src/crate-builder/RenderEntity/ItemLink.tsx +0 -37
- package/src/crate-builder/RenderEntity/PaginateLinkedEntities.stories.tsx +0 -43
- package/src/crate-builder/RenderEntity/PaginateLinkedEntities.tsx +0 -141
- package/src/crate-builder/RenderEntity/PropertyHelp.tsx +0 -39
- package/src/crate-builder/RenderEntity/RenderControls.tsx +0 -278
- package/src/crate-builder/RenderEntity/RenderLinkedItem.tsx +0 -139
- package/src/crate-builder/RenderEntity/RenderPropertyHelp.tsx +0 -41
- package/src/crate-builder/RenderEntity/RenderReverseConnections.tsx +0 -150
- package/src/crate-builder/RenderEntity/RenderTypes.tsx +0 -102
- package/src/crate-builder/RenderEntity/Shell2.tsx +0 -576
- package/src/crate-builder/RenderEntity/UnlinkEntity.tsx +0 -30
- package/src/crate-builder/RenderEntity/auto-complete.lib.ts +0 -184
- package/src/crate-builder/RenderEntity/keys.ts +0 -4
- package/src/crate-builder/RenderEntity/layout.spec.js +0 -593
- package/src/crate-builder/RenderEntity/layout.ts +0 -220
- package/src/crate-builder/Shell.tsx +0 -337
- package/src/crate-builder/component.css +0 -65
- package/src/crate-builder/editor-state.ts +0 -114
- package/src/crate-builder/emotionCache.ts +0 -8
- package/src/crate-builder/helpers.ts +0 -16
- package/src/crate-builder/i18n.ts +0 -22
- package/src/crate-builder/lib/validate-iri.js +0 -69
- package/src/crate-builder/lib/validate-iri.ts +0 -57
- package/src/crate-builder/locales/en.js +0 -149
- package/src/crate-builder/locales/hu.js +0 -147
- package/src/crate-builder/primitives/Boolean.stories.tsx +0 -33
- package/src/crate-builder/primitives/Boolean.tsx +0 -67
- package/src/crate-builder/primitives/Date.stories.tsx +0 -32
- package/src/crate-builder/primitives/Date.tsx +0 -58
- package/src/crate-builder/primitives/DateTime.stories.tsx +0 -32
- package/src/crate-builder/primitives/DateTime.tsx +0 -64
- package/src/crate-builder/primitives/Geo.stories.tsx +0 -57
- package/src/crate-builder/primitives/Geo.tsx +0 -225
- package/src/crate-builder/primitives/Map.SelectArea.js +0 -359
- package/src/crate-builder/primitives/Map.stories.tsx +0 -61
- package/src/crate-builder/primitives/Map.tsx +0 -124
- package/src/crate-builder/primitives/Number.stories.tsx +0 -74
- package/src/crate-builder/primitives/Number.tsx +0 -166
- package/src/crate-builder/primitives/Select.stories.tsx +0 -66
- package/src/crate-builder/primitives/Select.tsx +0 -121
- package/src/crate-builder/primitives/SelectObject.stories.tsx +0 -29
- package/src/crate-builder/primitives/SelectObject.tsx +0 -105
- package/src/crate-builder/primitives/SelectUrl.stories.tsx +0 -42
- package/src/crate-builder/primitives/SelectUrl.tsx +0 -110
- package/src/crate-builder/primitives/Text.stories.tsx +0 -106
- package/src/crate-builder/primitives/Text.tsx +0 -197
- package/src/crate-builder/primitives/Time.stories.tsx +0 -38
- package/src/crate-builder/primitives/Time.tsx +0 -71
- package/src/crate-builder/primitives/Url.stories.tsx +0 -43
- package/src/crate-builder/primitives/Url.tsx +0 -75
- package/src/crate-builder/primitives/Value.stories.tsx +0 -37
- package/src/crate-builder/primitives/Value.tsx +0 -30
- package/src/crate-builder/primitives/date-libs.ts +0 -12
- package/src/crate-builder/profile-schema.json +0 -145
- package/src/crate-builder/property-definitions.ts +0 -78
- package/src/crate-builder/recrate.css +0 -3
- package/src/crate-builder/store.ts +0 -14
- package/src/crate-builder/tailwind.css +0 -5
- package/src/crate-builder/types.d.ts +0 -318
- package/src/examples/collection/collections-entity-example.json +0 -131
- package/src/examples/collection/crate-builder-entity-example.json +0 -33
- package/src/examples/item/complex-collection/ro-crate-metadata.json +0 -174
- package/src/examples/item/complex-item/ro-crate-metadata.json +0 -769
- package/src/examples/item/crate-with-language.json +0 -38
- package/src/examples/item/empty/ro-crate-metadata.json +0 -20
- package/src/examples/item/item-with-relationship-and-action/ro-crate-metadata.json +0 -66
- package/src/examples/item/large-crate/ro-crate-metadata.json +0 -5762
- package/src/examples/item/multiple-types/ro-crate-metadata.json +0 -20
- package/src/examples/item/ridiculously-big-collection/ro-crate-metadata.json +0 -162977
- package/src/examples/profile/aroma.complex.profile.json +0 -11098
- package/src/examples/profile/aroma.profile.json +0 -9158
- package/src/examples/profile/nyingarn-item-profile.json +0 -426
- package/src/examples/profile/profile-to-test-inverse-associations.json +0 -73
- package/src/examples/profile/profile-to-test-multiple-types.json +0 -31
- package/src/examples/profile/profile-with-all-primitives-and-groups.json +0 -207
- package/src/examples/profile/profile-with-all-primitives.json +0 -244
- package/src/examples/profile/profile-with-constraints.json +0 -446
- package/src/examples/profile/profile-with-resolve.json +0 -57
- package/src/examples/profile/vocabulary-creation-profile.json +0 -231
- package/src/images.d.ts +0 -5
- package/src/index.ts +0 -12
- package/src/types.ts +0 -104
- package/tailwind.config.js +0 -21
- package/tsconfig.app.json +0 -31
- package/tsconfig.json +0 -26
- package/typedoc.json +0 -11
- package/update-deps.sh +0 -4
- package/vite-env.d.ts +0 -1
- package/vite.config.ts +0 -46
|
@@ -1,593 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect, beforeAll, beforeEach, vi } from "vitest";
|
|
2
|
-
import { ProfileManager } from "../CrateManager/profile-manager";
|
|
3
|
-
import { applyLayout } from "./layout";
|
|
4
|
-
|
|
5
|
-
describe("Test layout handling", () => {
|
|
6
|
-
test("layout test 1", async () => {
|
|
7
|
-
// Test profile without layout
|
|
8
|
-
const profile = {
|
|
9
|
-
classes: {
|
|
10
|
-
Dataset: {
|
|
11
|
-
definition: "override",
|
|
12
|
-
subClassOf: [],
|
|
13
|
-
inputs: [
|
|
14
|
-
{
|
|
15
|
-
id: "https://schema.org/author",
|
|
16
|
-
name: "author",
|
|
17
|
-
type: ["Person", "Organisation"],
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
const pm = new ProfileManager({ profile });
|
|
24
|
-
const configuration = {
|
|
25
|
-
readonly: false,
|
|
26
|
-
};
|
|
27
|
-
let entity = {
|
|
28
|
-
"@id": "./",
|
|
29
|
-
"@type": ["Dataset"],
|
|
30
|
-
name: "Dataset",
|
|
31
|
-
};
|
|
32
|
-
let renderTabs, missingRequiredData, tabs;
|
|
33
|
-
|
|
34
|
-
({ renderTabs, missingRequiredData, entity, tabs } = applyLayout({
|
|
35
|
-
configuration,
|
|
36
|
-
entity,
|
|
37
|
-
extraProperties: [],
|
|
38
|
-
profileManager: pm,
|
|
39
|
-
}));
|
|
40
|
-
expect(renderTabs).toBeTruthy;
|
|
41
|
-
expect(missingRequiredData).toBeFalsy;
|
|
42
|
-
expect(tabs).toEqual([]);
|
|
43
|
-
});
|
|
44
|
-
test("layout test 2", async () => {
|
|
45
|
-
// Test profile with layout. About tab with author prop
|
|
46
|
-
const profile = {
|
|
47
|
-
layouts: [
|
|
48
|
-
{
|
|
49
|
-
appliesTo: ["Dataset"],
|
|
50
|
-
about: { label: "About" },
|
|
51
|
-
overflow: {
|
|
52
|
-
label: "Other",
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
classes: {
|
|
57
|
-
Dataset: {
|
|
58
|
-
definition: "override",
|
|
59
|
-
subClassOf: [],
|
|
60
|
-
inputs: [
|
|
61
|
-
{
|
|
62
|
-
id: "https://schema.org/author",
|
|
63
|
-
name: "author",
|
|
64
|
-
type: ["Person", "Organisation"],
|
|
65
|
-
group: "about",
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
const pm = new ProfileManager({ profile });
|
|
72
|
-
const configuration = {
|
|
73
|
-
readonly: false,
|
|
74
|
-
};
|
|
75
|
-
let entity = {
|
|
76
|
-
"@id": "./",
|
|
77
|
-
"@type": ["Dataset"],
|
|
78
|
-
name: "Dataset",
|
|
79
|
-
};
|
|
80
|
-
let renderTabs, missingRequiredData, tabs;
|
|
81
|
-
|
|
82
|
-
({ renderTabs, missingRequiredData, entity, tabs } = applyLayout({
|
|
83
|
-
configuration,
|
|
84
|
-
entity,
|
|
85
|
-
extraProperties: [],
|
|
86
|
-
profileManager: pm,
|
|
87
|
-
}));
|
|
88
|
-
expect(renderTabs).toBeTruthy;
|
|
89
|
-
expect(missingRequiredData).toBeFalsy;
|
|
90
|
-
expect(tabs).toMatchObject([
|
|
91
|
-
{
|
|
92
|
-
label: "About",
|
|
93
|
-
name: "about",
|
|
94
|
-
inputs: [
|
|
95
|
-
{
|
|
96
|
-
id: "https://schema.org/author",
|
|
97
|
-
name: "author",
|
|
98
|
-
type: ["Person", "Organisation"],
|
|
99
|
-
group: "about",
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
missingRequiredData: false,
|
|
103
|
-
hasData: false,
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
label: "Other",
|
|
107
|
-
name: "overflow",
|
|
108
|
-
inputs: [],
|
|
109
|
-
missingRequiredData: false,
|
|
110
|
-
hasData: false,
|
|
111
|
-
},
|
|
112
|
-
]);
|
|
113
|
-
});
|
|
114
|
-
test("layout test 3", async () => {
|
|
115
|
-
// Test profile with layout. About tab with author prop.
|
|
116
|
-
// Grouping defined in the layout.
|
|
117
|
-
const profile = {
|
|
118
|
-
layouts: [
|
|
119
|
-
{
|
|
120
|
-
appliesTo: ["Dataset"],
|
|
121
|
-
about: { label: "About", properties: ["author"] },
|
|
122
|
-
overflow: {
|
|
123
|
-
label: "Other",
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
classes: {
|
|
128
|
-
Dataset: {
|
|
129
|
-
definition: "override",
|
|
130
|
-
subClassOf: [],
|
|
131
|
-
inputs: [
|
|
132
|
-
{
|
|
133
|
-
id: "https://schema.org/author",
|
|
134
|
-
name: "author",
|
|
135
|
-
type: ["Person", "Organisation"],
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
};
|
|
141
|
-
const pm = new ProfileManager({ profile });
|
|
142
|
-
const configuration = {
|
|
143
|
-
readonly: false,
|
|
144
|
-
};
|
|
145
|
-
let entity = {
|
|
146
|
-
"@id": "./",
|
|
147
|
-
"@type": ["Dataset"],
|
|
148
|
-
name: "Dataset",
|
|
149
|
-
};
|
|
150
|
-
let renderTabs, missingRequiredData, tabs;
|
|
151
|
-
|
|
152
|
-
({ renderTabs, missingRequiredData, entity, tabs } = applyLayout({
|
|
153
|
-
configuration,
|
|
154
|
-
entity,
|
|
155
|
-
extraProperties: [],
|
|
156
|
-
profileManager: pm,
|
|
157
|
-
}));
|
|
158
|
-
expect(renderTabs).toBeTruthy;
|
|
159
|
-
expect(missingRequiredData).toBeFalsy;
|
|
160
|
-
// console.log(JSON.stringify(tabs, null, 2));
|
|
161
|
-
expect(tabs).toMatchObject([
|
|
162
|
-
{
|
|
163
|
-
label: "About",
|
|
164
|
-
name: "about",
|
|
165
|
-
inputs: [
|
|
166
|
-
{
|
|
167
|
-
id: "https://schema.org/author",
|
|
168
|
-
name: "author",
|
|
169
|
-
type: ["Person", "Organisation"],
|
|
170
|
-
},
|
|
171
|
-
],
|
|
172
|
-
missingRequiredData: false,
|
|
173
|
-
hasData: false,
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
label: "Other",
|
|
177
|
-
name: "overflow",
|
|
178
|
-
inputs: [],
|
|
179
|
-
missingRequiredData: false,
|
|
180
|
-
hasData: false,
|
|
181
|
-
},
|
|
182
|
-
]);
|
|
183
|
-
});
|
|
184
|
-
test("layout test 4", async () => {
|
|
185
|
-
// Test profile with layout. About tab with author and contributor.
|
|
186
|
-
// Grouping defined on prop and in layout.
|
|
187
|
-
const profile = {
|
|
188
|
-
layouts: [
|
|
189
|
-
{
|
|
190
|
-
appliesTo: ["Dataset"],
|
|
191
|
-
about: { label: "About", properties: ["author"] },
|
|
192
|
-
overflow: {
|
|
193
|
-
label: "Other",
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
classes: {
|
|
198
|
-
Dataset: {
|
|
199
|
-
definition: "override",
|
|
200
|
-
subClassOf: [],
|
|
201
|
-
inputs: [
|
|
202
|
-
{
|
|
203
|
-
id: "https://schema.org/author",
|
|
204
|
-
name: "author",
|
|
205
|
-
type: ["Person", "Organisation"],
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
id: "https://schema.org/contributor",
|
|
209
|
-
name: "contributor",
|
|
210
|
-
type: ["Person", "Organisation"],
|
|
211
|
-
group: "about",
|
|
212
|
-
},
|
|
213
|
-
],
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
|
-
};
|
|
217
|
-
const pm = new ProfileManager({ profile });
|
|
218
|
-
const configuration = {
|
|
219
|
-
readonly: false,
|
|
220
|
-
};
|
|
221
|
-
let entity = {
|
|
222
|
-
"@id": "./",
|
|
223
|
-
"@type": ["Dataset"],
|
|
224
|
-
name: "Dataset",
|
|
225
|
-
};
|
|
226
|
-
let renderTabs, missingRequiredData, tabs;
|
|
227
|
-
|
|
228
|
-
({ renderTabs, missingRequiredData, entity, tabs } = applyLayout({
|
|
229
|
-
configuration,
|
|
230
|
-
entity,
|
|
231
|
-
extraProperties: [],
|
|
232
|
-
profileManager: pm,
|
|
233
|
-
}));
|
|
234
|
-
expect(renderTabs).toBeTruthy;
|
|
235
|
-
expect(missingRequiredData).toBeFalsy;
|
|
236
|
-
// console.log(JSON.stringify(tabs, null, 2));
|
|
237
|
-
expect(tabs).toMatchObject([
|
|
238
|
-
{
|
|
239
|
-
label: "About",
|
|
240
|
-
name: "about",
|
|
241
|
-
inputs: [
|
|
242
|
-
{
|
|
243
|
-
id: "https://schema.org/author",
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
id: "https://schema.org/contributor",
|
|
247
|
-
},
|
|
248
|
-
],
|
|
249
|
-
missingRequiredData: false,
|
|
250
|
-
hasData: false,
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
label: "Other",
|
|
254
|
-
name: "overflow",
|
|
255
|
-
inputs: [],
|
|
256
|
-
missingRequiredData: false,
|
|
257
|
-
hasData: false,
|
|
258
|
-
},
|
|
259
|
-
]);
|
|
260
|
-
});
|
|
261
|
-
test("layout test 5", async () => {
|
|
262
|
-
// Test profile with layout. About tab with author and contributor.
|
|
263
|
-
// Grouping defined on prop and in layout. Non existant group for contributor.
|
|
264
|
-
const profile = {
|
|
265
|
-
layouts: [
|
|
266
|
-
{
|
|
267
|
-
appliesTo: ["Dataset"],
|
|
268
|
-
about: { label: "About", properties: ["author"] },
|
|
269
|
-
overflow: {
|
|
270
|
-
label: "Other",
|
|
271
|
-
},
|
|
272
|
-
},
|
|
273
|
-
],
|
|
274
|
-
classes: {
|
|
275
|
-
Dataset: {
|
|
276
|
-
definition: "override",
|
|
277
|
-
subClassOf: [],
|
|
278
|
-
inputs: [
|
|
279
|
-
{
|
|
280
|
-
id: "https://schema.org/author",
|
|
281
|
-
name: "author",
|
|
282
|
-
type: ["Person", "Organisation"],
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
id: "https://schema.org/contributor",
|
|
286
|
-
name: "contributor",
|
|
287
|
-
type: ["Person", "Organisation"],
|
|
288
|
-
group: "nonexistent",
|
|
289
|
-
},
|
|
290
|
-
],
|
|
291
|
-
},
|
|
292
|
-
},
|
|
293
|
-
};
|
|
294
|
-
const pm = new ProfileManager({ profile });
|
|
295
|
-
const configuration = {
|
|
296
|
-
readonly: false,
|
|
297
|
-
};
|
|
298
|
-
let entity = {
|
|
299
|
-
"@id": "./",
|
|
300
|
-
"@type": ["Dataset"],
|
|
301
|
-
name: "Dataset",
|
|
302
|
-
};
|
|
303
|
-
let renderTabs, missingRequiredData, tabs;
|
|
304
|
-
|
|
305
|
-
({ renderTabs, missingRequiredData, entity, tabs } = applyLayout({
|
|
306
|
-
configuration,
|
|
307
|
-
entity,
|
|
308
|
-
extraProperties: [],
|
|
309
|
-
profileManager: pm,
|
|
310
|
-
}));
|
|
311
|
-
expect(renderTabs).toBeTruthy;
|
|
312
|
-
expect(missingRequiredData).toBeFalsy;
|
|
313
|
-
// console.log(JSON.stringify(tabs, null, 2));
|
|
314
|
-
expect(tabs).toMatchObject([
|
|
315
|
-
{
|
|
316
|
-
label: "About",
|
|
317
|
-
name: "about",
|
|
318
|
-
inputs: [
|
|
319
|
-
{
|
|
320
|
-
id: "https://schema.org/author",
|
|
321
|
-
},
|
|
322
|
-
],
|
|
323
|
-
missingRequiredData: false,
|
|
324
|
-
hasData: false,
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
label: "Other",
|
|
328
|
-
name: "overflow",
|
|
329
|
-
inputs: [
|
|
330
|
-
{
|
|
331
|
-
id: "https://schema.org/contributor",
|
|
332
|
-
},
|
|
333
|
-
],
|
|
334
|
-
missingRequiredData: false,
|
|
335
|
-
hasData: false,
|
|
336
|
-
},
|
|
337
|
-
]);
|
|
338
|
-
});
|
|
339
|
-
test("layout test 6", async () => {
|
|
340
|
-
// Test profile with layout. About tab with author. Parent class with props.
|
|
341
|
-
// Grouping defined on props.
|
|
342
|
-
const profile = {
|
|
343
|
-
layouts: [
|
|
344
|
-
{
|
|
345
|
-
appliesTo: ["Dataset"],
|
|
346
|
-
about: { label: "About", properties: ["author"] },
|
|
347
|
-
overflow: {
|
|
348
|
-
label: "Other",
|
|
349
|
-
},
|
|
350
|
-
},
|
|
351
|
-
],
|
|
352
|
-
classes: {
|
|
353
|
-
CreativeWork: {
|
|
354
|
-
definition: "inherit",
|
|
355
|
-
subClassOf: [],
|
|
356
|
-
inputs: [
|
|
357
|
-
{
|
|
358
|
-
id: "https://schema.org/contributor",
|
|
359
|
-
name: "contributor",
|
|
360
|
-
type: ["Person", "Organisation"],
|
|
361
|
-
group: "about",
|
|
362
|
-
},
|
|
363
|
-
],
|
|
364
|
-
},
|
|
365
|
-
Dataset: {
|
|
366
|
-
definition: "inherit",
|
|
367
|
-
subClassOf: ["CreativeWork"],
|
|
368
|
-
inputs: [
|
|
369
|
-
{
|
|
370
|
-
id: "https://schema.org/author",
|
|
371
|
-
name: "author",
|
|
372
|
-
type: ["Person", "Organisation"],
|
|
373
|
-
group: "about",
|
|
374
|
-
},
|
|
375
|
-
],
|
|
376
|
-
},
|
|
377
|
-
},
|
|
378
|
-
};
|
|
379
|
-
const pm = new ProfileManager({ profile });
|
|
380
|
-
const configuration = {
|
|
381
|
-
readonly: false,
|
|
382
|
-
};
|
|
383
|
-
let entity = {
|
|
384
|
-
"@id": "./",
|
|
385
|
-
"@type": ["Dataset"],
|
|
386
|
-
name: "Dataset",
|
|
387
|
-
};
|
|
388
|
-
let renderTabs, missingRequiredData, tabs;
|
|
389
|
-
|
|
390
|
-
({ renderTabs, missingRequiredData, entity, tabs } = applyLayout({
|
|
391
|
-
configuration,
|
|
392
|
-
entity,
|
|
393
|
-
extraProperties: [],
|
|
394
|
-
profileManager: pm,
|
|
395
|
-
}));
|
|
396
|
-
expect(renderTabs).toBeTruthy;
|
|
397
|
-
expect(missingRequiredData).toBeFalsy;
|
|
398
|
-
// console.log(JSON.stringify(tabs, null, 2));
|
|
399
|
-
expect(tabs).toMatchObject([
|
|
400
|
-
{
|
|
401
|
-
label: "About",
|
|
402
|
-
name: "about",
|
|
403
|
-
inputs: [
|
|
404
|
-
{
|
|
405
|
-
id: "https://schema.org/author",
|
|
406
|
-
},
|
|
407
|
-
{
|
|
408
|
-
id: "https://schema.org/contributor",
|
|
409
|
-
},
|
|
410
|
-
],
|
|
411
|
-
missingRequiredData: false,
|
|
412
|
-
hasData: false,
|
|
413
|
-
},
|
|
414
|
-
{
|
|
415
|
-
label: "Other",
|
|
416
|
-
name: "overflow",
|
|
417
|
-
inputs: [],
|
|
418
|
-
missingRequiredData: false,
|
|
419
|
-
hasData: false,
|
|
420
|
-
},
|
|
421
|
-
]);
|
|
422
|
-
});
|
|
423
|
-
test("layout test 7", async () => {
|
|
424
|
-
// Test profile with layout. About tab with author. Parent class with props.
|
|
425
|
-
// Grouping defined on props. Ordering as per properties array.
|
|
426
|
-
const profile = {
|
|
427
|
-
layouts: [
|
|
428
|
-
{
|
|
429
|
-
appliesTo: ["Dataset"],
|
|
430
|
-
about: { label: "About", properties: ["contributor"] },
|
|
431
|
-
overflow: {
|
|
432
|
-
label: "Other",
|
|
433
|
-
},
|
|
434
|
-
},
|
|
435
|
-
],
|
|
436
|
-
classes: {
|
|
437
|
-
CreativeWork: {
|
|
438
|
-
definition: "inherit",
|
|
439
|
-
subClassOf: [],
|
|
440
|
-
inputs: [
|
|
441
|
-
{
|
|
442
|
-
id: "https://schema.org/contributor",
|
|
443
|
-
name: "contributor",
|
|
444
|
-
type: ["Person", "Organisation"],
|
|
445
|
-
group: "about",
|
|
446
|
-
},
|
|
447
|
-
],
|
|
448
|
-
},
|
|
449
|
-
Dataset: {
|
|
450
|
-
definition: "inherit",
|
|
451
|
-
subClassOf: ["CreativeWork"],
|
|
452
|
-
inputs: [
|
|
453
|
-
{
|
|
454
|
-
id: "https://schema.org/author",
|
|
455
|
-
name: "author",
|
|
456
|
-
type: ["Person", "Organisation"],
|
|
457
|
-
group: "about",
|
|
458
|
-
},
|
|
459
|
-
],
|
|
460
|
-
},
|
|
461
|
-
},
|
|
462
|
-
};
|
|
463
|
-
const pm = new ProfileManager({ profile });
|
|
464
|
-
const configuration = {
|
|
465
|
-
readonly: false,
|
|
466
|
-
};
|
|
467
|
-
let entity = {
|
|
468
|
-
"@id": "./",
|
|
469
|
-
"@type": ["Dataset"],
|
|
470
|
-
name: "Dataset",
|
|
471
|
-
};
|
|
472
|
-
let renderTabs, missingRequiredData, tabs;
|
|
473
|
-
|
|
474
|
-
({ renderTabs, missingRequiredData, entity, tabs } = applyLayout({
|
|
475
|
-
configuration,
|
|
476
|
-
entity,
|
|
477
|
-
extraProperties: [],
|
|
478
|
-
profileManager: pm,
|
|
479
|
-
}));
|
|
480
|
-
expect(renderTabs).toBeTruthy;
|
|
481
|
-
expect(missingRequiredData).toBeFalsy;
|
|
482
|
-
// console.log(JSON.stringify(tabs, null, 2));
|
|
483
|
-
expect(tabs).toMatchObject([
|
|
484
|
-
{
|
|
485
|
-
label: "About",
|
|
486
|
-
name: "about",
|
|
487
|
-
inputs: [
|
|
488
|
-
{
|
|
489
|
-
id: "https://schema.org/contributor",
|
|
490
|
-
},
|
|
491
|
-
{
|
|
492
|
-
id: "https://schema.org/author",
|
|
493
|
-
},
|
|
494
|
-
],
|
|
495
|
-
missingRequiredData: false,
|
|
496
|
-
hasData: false,
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
label: "Other",
|
|
500
|
-
name: "overflow",
|
|
501
|
-
inputs: [],
|
|
502
|
-
missingRequiredData: false,
|
|
503
|
-
hasData: false,
|
|
504
|
-
},
|
|
505
|
-
]);
|
|
506
|
-
});
|
|
507
|
-
test("layout test 8", async () => {
|
|
508
|
-
// Test profile with layout. About tab with author. Parent class with props.
|
|
509
|
-
// Grouping defined on props. Ordering as per properties array.
|
|
510
|
-
// Property on entity not defined in profile.
|
|
511
|
-
const profile = {
|
|
512
|
-
layouts: [
|
|
513
|
-
{
|
|
514
|
-
appliesTo: ["Dataset"],
|
|
515
|
-
about: { label: "About", properties: ["contributor"] },
|
|
516
|
-
overflow: {
|
|
517
|
-
label: "Other",
|
|
518
|
-
},
|
|
519
|
-
},
|
|
520
|
-
],
|
|
521
|
-
classes: {
|
|
522
|
-
CreativeWork: {
|
|
523
|
-
definition: "inherit",
|
|
524
|
-
subClassOf: [],
|
|
525
|
-
inputs: [
|
|
526
|
-
{
|
|
527
|
-
id: "https://schema.org/contributor",
|
|
528
|
-
name: "contributor",
|
|
529
|
-
type: ["Person", "Organisation"],
|
|
530
|
-
group: "about",
|
|
531
|
-
},
|
|
532
|
-
],
|
|
533
|
-
},
|
|
534
|
-
Dataset: {
|
|
535
|
-
definition: "inherit",
|
|
536
|
-
subClassOf: ["CreativeWork"],
|
|
537
|
-
inputs: [
|
|
538
|
-
{
|
|
539
|
-
id: "https://schema.org/author",
|
|
540
|
-
name: "author",
|
|
541
|
-
type: ["Person", "Organisation"],
|
|
542
|
-
group: "about",
|
|
543
|
-
},
|
|
544
|
-
],
|
|
545
|
-
},
|
|
546
|
-
},
|
|
547
|
-
};
|
|
548
|
-
const pm = new ProfileManager({ profile });
|
|
549
|
-
const configuration = {
|
|
550
|
-
readonly: false,
|
|
551
|
-
};
|
|
552
|
-
let entity = {
|
|
553
|
-
"@id": "./",
|
|
554
|
-
"@type": ["Dataset"],
|
|
555
|
-
name: "Dataset",
|
|
556
|
-
participant: { "@id": "#P", "@type": "Person", name: "#P" },
|
|
557
|
-
};
|
|
558
|
-
let renderTabs, missingRequiredData, tabs;
|
|
559
|
-
|
|
560
|
-
({ renderTabs, missingRequiredData, entity, tabs } = applyLayout({
|
|
561
|
-
configuration,
|
|
562
|
-
entity,
|
|
563
|
-
extraProperties: [],
|
|
564
|
-
profileManager: pm,
|
|
565
|
-
}));
|
|
566
|
-
expect(renderTabs).toBeTruthy;
|
|
567
|
-
expect(missingRequiredData).toBeFalsy;
|
|
568
|
-
// console.log(JSON.stringify(tabs, null, 2));
|
|
569
|
-
expect(tabs).toMatchObject([
|
|
570
|
-
{
|
|
571
|
-
label: "About",
|
|
572
|
-
name: "about",
|
|
573
|
-
inputs: [
|
|
574
|
-
{
|
|
575
|
-
id: "https://schema.org/contributor",
|
|
576
|
-
},
|
|
577
|
-
{
|
|
578
|
-
id: "https://schema.org/author",
|
|
579
|
-
},
|
|
580
|
-
],
|
|
581
|
-
missingRequiredData: false,
|
|
582
|
-
hasData: false,
|
|
583
|
-
},
|
|
584
|
-
{
|
|
585
|
-
label: "Other",
|
|
586
|
-
name: "overflow",
|
|
587
|
-
inputs: [{ name: "participant" }],
|
|
588
|
-
missingRequiredData: false,
|
|
589
|
-
hasData: false,
|
|
590
|
-
},
|
|
591
|
-
]);
|
|
592
|
-
});
|
|
593
|
-
});
|