@sanity/hierarchical-document-list 1.1.0 → 2.0.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/LICENSE +1 -1
- package/README.md +95 -59
- package/dist/index.d.ts +240 -0
- package/dist/index.esm.js +151 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +151 -0
- package/dist/index.js.map +1 -0
- package/package.json +82 -51
- package/sanity.json +2 -6
- package/src/TreeDeskStructure.tsx +80 -0
- package/src/TreeInputComponent.tsx +41 -0
- package/src/components/DeskWarning.tsx +40 -0
- package/src/components/DocumentInNode.tsx +133 -0
- package/src/components/DocumentPreviewStatus.tsx +70 -0
- package/src/components/NodeActions.tsx +85 -0
- package/src/components/NodeContentRenderer.tsx +141 -0
- package/src/components/PlaceholderDropzone.tsx +45 -0
- package/src/components/TreeEditor.tsx +167 -0
- package/{lib/components/TreeEditorErrorBoundary.d.ts → src/components/TreeEditorErrorBoundary.tsx} +2 -4
- package/src/components/TreeNodeRenderer.tsx +37 -0
- package/src/components/TreeNodeRendererScaffold.tsx +193 -0
- package/src/createDeskHierarchy.tsx +110 -0
- package/src/createHierarchicalSchemas.tsx +151 -0
- package/src/hooks/useAllItems.ts +119 -0
- package/src/hooks/useLocalTree.ts +40 -0
- package/src/hooks/useTreeOperations.ts +25 -0
- package/src/hooks/useTreeOperationsProvider.ts +86 -0
- package/src/index.ts +25 -0
- package/src/schemas/hierarchy.tree.ts +19 -0
- package/src/types.ts +148 -0
- package/src/utils/flatDataToTree.ts +20 -0
- package/src/utils/getAdjescentNodes.ts +30 -0
- package/src/utils/getCommonTreeProps.tsx +28 -0
- package/src/utils/getTreeHeight.ts +10 -0
- package/src/utils/gradientPatchAdapter.ts +43 -0
- package/src/utils/idUtils.ts +7 -0
- package/src/utils/injectNodeTypeInPatches.ts +60 -0
- package/src/utils/moveItemInArray.ts +26 -0
- package/src/utils/throwError.ts +9 -0
- package/src/utils/treeData.tsx +119 -0
- package/src/utils/treePatches.ts +171 -0
- package/v2-incompatible.js +11 -0
- package/.husky/commit-msg +0 -4
- package/.husky/pre-commit +0 -4
- package/.idea/hierarchical-document-list.iml +0 -11
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -7
- package/.idea/vcs.xml +0 -6
- package/CHANGELOG.md +0 -15
- package/commitlint.config.js +0 -3
- package/lib/TreeDeskStructure.d.ts +0 -8
- package/lib/TreeDeskStructure.js +0 -96
- package/lib/TreeInputComponent.d.ts +0 -19
- package/lib/TreeInputComponent.js +0 -50
- package/lib/components/DeskWarning.d.ts +0 -6
- package/lib/components/DeskWarning.js +0 -46
- package/lib/components/DocumentInNode.d.ts +0 -11
- package/lib/components/DocumentInNode.js +0 -81
- package/lib/components/DocumentPreviewStatus.d.ts +0 -7
- package/lib/components/DocumentPreviewStatus.js +0 -39
- package/lib/components/NodeActions.d.ts +0 -10
- package/lib/components/NodeActions.js +0 -61
- package/lib/components/NodeContentRenderer.d.ts +0 -8
- package/lib/components/NodeContentRenderer.js +0 -105
- package/lib/components/PlaceholderDropzone.d.ts +0 -9
- package/lib/components/PlaceholderDropzone.js +0 -30
- package/lib/components/SuppressedDnDManager.d.ts +0 -2
- package/lib/components/SuppressedDnDManager.js +0 -59
- package/lib/components/TreeEditor.d.ts +0 -12
- package/lib/components/TreeEditor.js +0 -74
- package/lib/components/TreeEditorErrorBoundary.js +0 -74
- package/lib/components/TreeNodeRenderer.d.ts +0 -3
- package/lib/components/TreeNodeRenderer.js +0 -59
- package/lib/components/TreeNodeRendererScaffold.d.ts +0 -4
- package/lib/components/TreeNodeRendererScaffold.js +0 -44
- package/lib/createDeskHierarchy.d.ts +0 -14
- package/lib/createDeskHierarchy.js +0 -84
- package/lib/createHierarchicalSchemas.d.ts +0 -98
- package/lib/createHierarchicalSchemas.js +0 -138
- package/lib/hooks/useAllItems.d.ts +0 -7
- package/lib/hooks/useAllItems.js +0 -119
- package/lib/hooks/useLocalTree.d.ts +0 -17
- package/lib/hooks/useLocalTree.js +0 -59
- package/lib/hooks/useTreeOperations.d.ts +0 -9
- package/lib/hooks/useTreeOperations.js +0 -39
- package/lib/hooks/useTreeOperationsProvider.d.ts +0 -14
- package/lib/hooks/useTreeOperationsProvider.js +0 -85
- package/lib/index.d.ts +0 -3
- package/lib/index.js +0 -12
- package/lib/schemas/hierarchy.tree.d.ts +0 -13
- package/lib/schemas/hierarchy.tree.js +0 -19
- package/lib/types.d.ts +0 -128
- package/lib/types.js +0 -2
- package/lib/utils/flatDataToTree.d.ts +0 -6
- package/lib/utils/flatDataToTree.js +0 -26
- package/lib/utils/getAdjescentNodes.d.ts +0 -12
- package/lib/utils/getAdjescentNodes.js +0 -19
- package/lib/utils/getCommonTreeProps.d.ts +0 -7
- package/lib/utils/getCommonTreeProps.js +0 -33
- package/lib/utils/getTreeHeight.d.ts +0 -3
- package/lib/utils/getTreeHeight.js +0 -11
- package/lib/utils/gradientPatchAdapter.d.ts +0 -4
- package/lib/utils/gradientPatchAdapter.js +0 -40
- package/lib/utils/idUtils.d.ts +0 -2
- package/lib/utils/idUtils.js +0 -13
- package/lib/utils/injectNodeTypeInPatches.d.ts +0 -12
- package/lib/utils/injectNodeTypeInPatches.js +0 -59
- package/lib/utils/moveItemInArray.d.ts +0 -5
- package/lib/utils/moveItemInArray.js +0 -26
- package/lib/utils/throwError.d.ts +0 -7
- package/lib/utils/throwError.js +0 -12
- package/lib/utils/treeData.d.ts +0 -18
- package/lib/utils/treeData.js +0 -118
- package/lib/utils/treePatches.d.ts +0 -15
- package/lib/utils/treePatches.js +0 -171
- package/lint-staged.config.js +0 -4
- package/screenshot-1.jpg +0 -0
- package/tsconfig.json +0 -20
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# sanity-plugin-hierarchical-document-list
|
|
2
2
|
|
|
3
|
+
> This is a **Sanity Studio v3** plugin.
|
|
4
|
+
|
|
3
5
|
Plugin for visually organizing documents as hierarchies in the [Sanity studio](https://www.sanity.io/docs/sanity-studio). Applications include:
|
|
4
6
|
|
|
5
7
|
- Tables of content - such as a book's sections and chapters
|
|
@@ -8,53 +10,100 @@ Plugin for visually organizing documents as hierarchies in the [Sanity studio](h
|
|
|
8
10
|
|
|
9
11
|

|
|
10
12
|
|
|
11
|
-
⚠️ **Compatibility:** This plugin requires Sanity Studio [version
|
|
13
|
+
⚠️ **Compatibility:** This plugin requires Sanity Studio [version 3.3.0](https://github.com/sanity-io/sanity/releases/tag/v3.3.0) or higher.
|
|
12
14
|
|
|
13
15
|
If you're looking for a way to order documents on a flat list, refer to [@sanity/orderable-document-list](https://github.com/sanity-io/orderable-document-list).
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
16
20
|
|
|
17
21
|
```bash
|
|
18
22
|
# From the root of your sanity project
|
|
19
|
-
|
|
23
|
+
npm i @sanity/hierarchical-document-list
|
|
20
24
|
```
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
## Usage
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
### 1. Add the plugin and the default documentType to the sanity.config.ts
|
|
25
29
|
|
|
26
30
|
```js
|
|
27
|
-
//
|
|
28
|
-
import
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
export default (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
documentId: 'main-table-of-contents',
|
|
41
|
-
|
|
42
|
-
// Document types editors should be able to include in the hierarchy
|
|
43
|
-
referenceTo: ['site.page', 'site.post', 'docs.article', 'social.youtubeVideo'],
|
|
44
|
-
|
|
45
|
-
// ❓ Optional: provide filters and/or parameters for narrowing which documents can be added
|
|
46
|
-
referenceOptions: {
|
|
47
|
-
filter: 'status in $acceptedStatuses',
|
|
48
|
-
filterParams: {
|
|
49
|
-
acceptedStatuses: ['published', 'approved']
|
|
50
|
-
}
|
|
51
|
-
},
|
|
31
|
+
// sanity.config.js
|
|
32
|
+
import {defineConfig} from 'sanity'
|
|
33
|
+
import {hierarchicalDocumentList, hierarchyTree} from '@sanity/hierarchical-document-list'
|
|
34
|
+
|
|
35
|
+
export default defineConfig({
|
|
36
|
+
// ...
|
|
37
|
+
plugins: [hierarchicalDocumentList()],
|
|
38
|
+
schema: {
|
|
39
|
+
types: [
|
|
40
|
+
//...,
|
|
41
|
+
hierarchyTree
|
|
42
|
+
]
|
|
43
|
+
}
|
|
52
44
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
})
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 2. Add one or more hierarchy documents to your Structure Builder.
|
|
49
|
+
|
|
50
|
+
💡 _To learn about custom desk structures, refer to the [Structure Builder docs](https://www.sanity.io/docs/overview-structure-builder)._
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
// sanity.config.ts
|
|
54
|
+
import {defineConfig} from 'sanity'
|
|
55
|
+
import {deskTool} from 'sanity/desk'
|
|
56
|
+
import {createDeskHierarchy, hierarchicalDocumentList, hierarchyTree} from '@sanity/hierarchical-document-list'
|
|
57
|
+
|
|
58
|
+
export default defineConfig({
|
|
59
|
+
// ...
|
|
60
|
+
plugins: [
|
|
61
|
+
deskTool({
|
|
62
|
+
// NOTE: I'n V3 you MUST pass S and Context along to createDeskHierarchy as props
|
|
63
|
+
structure: (S, context) => S.list()
|
|
64
|
+
.title('Content')
|
|
65
|
+
.items([
|
|
66
|
+
...S.documentTypeListItems(), // or whatever other structure you have
|
|
67
|
+
createDeskHierarchy({
|
|
68
|
+
//prop drill S and context:
|
|
69
|
+
S,
|
|
70
|
+
context,
|
|
71
|
+
|
|
72
|
+
//configure plugin
|
|
73
|
+
|
|
74
|
+
title: 'Main table of contents',
|
|
75
|
+
|
|
76
|
+
// The hierarchy will be stored in this document ID 👇
|
|
77
|
+
documentId: 'main-table-of-contents',
|
|
78
|
+
|
|
79
|
+
// Document types editors should be able to include in the hierarchy
|
|
80
|
+
referenceTo: ['site.page', 'site.post', 'docs.article', 'social.youtubeVideo'],
|
|
81
|
+
|
|
82
|
+
// ❓ Optional: provide filters and/or parameters for narrowing which documents can be added
|
|
83
|
+
referenceOptions: {
|
|
84
|
+
filter: 'status in $acceptedStatuses',
|
|
85
|
+
filterParams: {
|
|
86
|
+
acceptedStatuses: ['published', 'approved']
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
// ❓ Optional: limit the depth of your hierarachies
|
|
91
|
+
maxDepth: 3,
|
|
92
|
+
|
|
93
|
+
// ❓ Optional: subarray of referenceTo, when it should not be possible to create new types from all referenceTo types
|
|
94
|
+
creatableTypes: ['site.page']
|
|
95
|
+
})
|
|
96
|
+
])
|
|
97
|
+
}),
|
|
98
|
+
hierarchicalDocumentList()
|
|
99
|
+
],
|
|
100
|
+
schema: {
|
|
101
|
+
types: [
|
|
102
|
+
//...,
|
|
103
|
+
hierarchyTree
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
})
|
|
58
107
|
```
|
|
59
108
|
|
|
60
109
|
## How it works
|
|
@@ -296,34 +345,21 @@ We're considering adapting this input to support any type of nest-able data, not
|
|
|
296
345
|
|
|
297
346
|
MIT-licensed. See LICENSE.
|
|
298
347
|
|
|
299
|
-
##
|
|
348
|
+
## License
|
|
300
349
|
|
|
301
|
-
|
|
302
|
-
npm/yarn link does not integrate correctly with StructureBuilder and schema part registration in
|
|
303
|
-
the Studio.
|
|
350
|
+
[MIT](LICENSE) © Sanity
|
|
304
351
|
|
|
305
|
-
|
|
352
|
+
## Develop & test
|
|
306
353
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
3. In Sanity Studio:
|
|
310
|
-
1. Run `yalc link @sanity/hierarchical-document-list`
|
|
311
|
-
2. Run `yarn install` (installs the dependencies for the plugin)
|
|
312
|
-
3. Ensure `"@sanity/hierarchical-document-list"` is present in `sanity.json` plugins array.
|
|
313
|
-
4. Configure the plugin for structure as documented above
|
|
354
|
+
This plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)
|
|
355
|
+
with default configuration for build & watch scripts.
|
|
314
356
|
|
|
315
|
-
|
|
357
|
+
See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)
|
|
358
|
+
on how to run this plugin with hotreload in the studio.
|
|
316
359
|
|
|
317
|
-
###
|
|
360
|
+
### Release new version
|
|
318
361
|
|
|
319
|
-
|
|
320
|
-
|
|
362
|
+
Run ["CI & Release" workflow](https://github.com/sanity-io/hierarchical-document-list/actions/workflows/main.yml).
|
|
363
|
+
Make sure to select the main branch and check "Release new version".
|
|
321
364
|
|
|
322
|
-
|
|
323
|
-
* `npm run release`
|
|
324
|
-
* runs [standard-version](https://www.npmjs.com/package/standard-version) which will bump version according to semver, commit and tag
|
|
325
|
-
* feel free to inspect the results in package.json and git log before continuing
|
|
326
|
-
* `npm publish`
|
|
327
|
-
* Will clean, lint and build before finally publishing to npm.
|
|
328
|
-
* After publishing, you should push with tags:
|
|
329
|
-
* `git push --follow-tags`
|
|
365
|
+
Semantic release will only release on configured branches, so it is safe to run release on any branch.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import {ArraySchemaType} from 'sanity'
|
|
2
|
+
import type {ConfigContext} from 'sanity'
|
|
3
|
+
import {DocumentDefinition} from 'sanity'
|
|
4
|
+
import {Plugin as Plugin_2} from 'sanity'
|
|
5
|
+
import {PreviewConfig} from 'sanity'
|
|
6
|
+
import * as React_2 from 'react'
|
|
7
|
+
import {StructureBuilder} from 'sanity/desk'
|
|
8
|
+
|
|
9
|
+
export declare function createDeskHierarchy(props: TreeProps): any
|
|
10
|
+
|
|
11
|
+
export declare function createHierarchicalSchemas(options: SchemaOptions): (
|
|
12
|
+
| {
|
|
13
|
+
name: string
|
|
14
|
+
title: string
|
|
15
|
+
type: string
|
|
16
|
+
fields: (
|
|
17
|
+
| {
|
|
18
|
+
name: string
|
|
19
|
+
type: string
|
|
20
|
+
}
|
|
21
|
+
| {
|
|
22
|
+
name: string
|
|
23
|
+
type: string
|
|
24
|
+
title: string
|
|
25
|
+
fields: (
|
|
26
|
+
| {
|
|
27
|
+
name: string
|
|
28
|
+
type: string
|
|
29
|
+
weak?: undefined
|
|
30
|
+
to?: undefined
|
|
31
|
+
options?: undefined
|
|
32
|
+
}
|
|
33
|
+
| {
|
|
34
|
+
name: string
|
|
35
|
+
type: string
|
|
36
|
+
weak: boolean
|
|
37
|
+
to: {
|
|
38
|
+
type: string
|
|
39
|
+
}[]
|
|
40
|
+
options:
|
|
41
|
+
| {
|
|
42
|
+
filter?: string | undefined
|
|
43
|
+
filterParams?: Record<string, unknown> | undefined
|
|
44
|
+
}
|
|
45
|
+
| undefined
|
|
46
|
+
}
|
|
47
|
+
)[]
|
|
48
|
+
}
|
|
49
|
+
)[]
|
|
50
|
+
}
|
|
51
|
+
| {
|
|
52
|
+
name: string
|
|
53
|
+
title: string
|
|
54
|
+
type: string
|
|
55
|
+
of: (
|
|
56
|
+
| {
|
|
57
|
+
name: string
|
|
58
|
+
title: string
|
|
59
|
+
type: string
|
|
60
|
+
fields: (
|
|
61
|
+
| {
|
|
62
|
+
name: string
|
|
63
|
+
type: string
|
|
64
|
+
}
|
|
65
|
+
| {
|
|
66
|
+
name: string
|
|
67
|
+
type: string
|
|
68
|
+
title: string
|
|
69
|
+
fields: (
|
|
70
|
+
| {
|
|
71
|
+
name: string
|
|
72
|
+
type: string
|
|
73
|
+
weak?: undefined
|
|
74
|
+
to?: undefined
|
|
75
|
+
options?: undefined
|
|
76
|
+
}
|
|
77
|
+
| {
|
|
78
|
+
name: string
|
|
79
|
+
type: string
|
|
80
|
+
weak: boolean
|
|
81
|
+
to: {
|
|
82
|
+
type: string
|
|
83
|
+
}[]
|
|
84
|
+
options:
|
|
85
|
+
| {
|
|
86
|
+
filter?: string | undefined
|
|
87
|
+
filterParams?: Record<string, unknown> | undefined
|
|
88
|
+
}
|
|
89
|
+
| undefined
|
|
90
|
+
}
|
|
91
|
+
)[]
|
|
92
|
+
}
|
|
93
|
+
)[]
|
|
94
|
+
}
|
|
95
|
+
| {
|
|
96
|
+
type: string
|
|
97
|
+
}
|
|
98
|
+
)[]
|
|
99
|
+
}
|
|
100
|
+
| {
|
|
101
|
+
name: string | undefined
|
|
102
|
+
title: string
|
|
103
|
+
type: string
|
|
104
|
+
liveEdit: boolean
|
|
105
|
+
fields: (Omit<ArraySchemaType<unknown>, 'type' | 'of' | 'jsonType'> & {
|
|
106
|
+
type: string
|
|
107
|
+
inputComponent: React_2.FC<any>
|
|
108
|
+
of?: any[] | undefined
|
|
109
|
+
})[]
|
|
110
|
+
preview: {
|
|
111
|
+
select: {
|
|
112
|
+
id: string
|
|
113
|
+
tree: string
|
|
114
|
+
}
|
|
115
|
+
prepare({id, tree}: {id: string; tree: unknown[]}): Record<string, string>
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
)[]
|
|
119
|
+
|
|
120
|
+
export declare function flatDataToTree(data: StoredTreeItem[]): TreeItemWithChildren[]
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Usage in `sanity.config.ts` (or .js)
|
|
124
|
+
*
|
|
125
|
+
* ```ts
|
|
126
|
+
* import {defineConfig} from 'sanity'
|
|
127
|
+
* import {hierarchicalDocumentList} from '@sanity/hierarchical-document-list'
|
|
128
|
+
*
|
|
129
|
+
* export default defineConfig({
|
|
130
|
+
* // ...
|
|
131
|
+
* plugins: [hierarchicalDocumentList()],
|
|
132
|
+
* })
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
export declare const hierarchicalDocumentList: Plugin_2<void>
|
|
136
|
+
|
|
137
|
+
export declare const hierarchyTree: {
|
|
138
|
+
type: 'document'
|
|
139
|
+
name: 'hierarchy.tree'
|
|
140
|
+
} & Omit<DocumentDefinition, 'preview'> & {
|
|
141
|
+
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
declare const INTERNAL_NODE_TYPE: string
|
|
145
|
+
|
|
146
|
+
declare const INTERNAL_NODE_VALUE_TYPE: string
|
|
147
|
+
|
|
148
|
+
declare interface SanityReference {
|
|
149
|
+
_type: 'reference'
|
|
150
|
+
_ref: string
|
|
151
|
+
_weak?: boolean
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
declare type SchemaOptions = Omit<TreeDeskStructureProps, 'documentId' | 'maxDepth'>
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Objects saved to tree documents in Sanity's Content Lake
|
|
158
|
+
*/
|
|
159
|
+
declare interface StoredTreeItem {
|
|
160
|
+
_key: string
|
|
161
|
+
_type: typeof INTERNAL_NODE_TYPE | string
|
|
162
|
+
value?: {
|
|
163
|
+
_type: typeof INTERNAL_NODE_VALUE_TYPE | string
|
|
164
|
+
reference?: SanityReference
|
|
165
|
+
docType?: string
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* _key of parent node
|
|
169
|
+
*/
|
|
170
|
+
parent?: string | null
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
declare interface TreeDeskStructureProps extends TreeInputOptions {
|
|
174
|
+
/**
|
|
175
|
+
* _id of the document that will hold the tree data.
|
|
176
|
+
*/
|
|
177
|
+
documentId: string
|
|
178
|
+
/**
|
|
179
|
+
* (Optional)
|
|
180
|
+
* Key for the field representing the hierarchical tree inside the document.
|
|
181
|
+
* `tree` by default.
|
|
182
|
+
*/
|
|
183
|
+
fieldKeyInDocument?: string
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
declare interface TreeInputOptions {
|
|
187
|
+
/**
|
|
188
|
+
* What document types this hierarchy can refer to.
|
|
189
|
+
* Similar to the `to` property of the [reference field](https://www.sanity.io/docs/reference-type).
|
|
190
|
+
*/
|
|
191
|
+
referenceTo: string[]
|
|
192
|
+
/**
|
|
193
|
+
* Used to provide fine-grained filtering for documents.
|
|
194
|
+
*/
|
|
195
|
+
referenceOptions?: {
|
|
196
|
+
/**
|
|
197
|
+
* Static filter to apply to tree document queries.
|
|
198
|
+
*/
|
|
199
|
+
filter?: string
|
|
200
|
+
/**
|
|
201
|
+
* Parameters / variables to pass to the GROQ query ran to fetch documents.
|
|
202
|
+
*/
|
|
203
|
+
filterParams?: Record<string, unknown>
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* How deep should editors be allowed to nest items.
|
|
207
|
+
*/
|
|
208
|
+
maxDepth?: number
|
|
209
|
+
/**
|
|
210
|
+
* Schema type for your hierarchical documents.
|
|
211
|
+
* Refer to documentation on how to provide these schemas in your studio.
|
|
212
|
+
*
|
|
213
|
+
* Defautlt: 'hierarchy.tree' - this schema is bundled with the plugin
|
|
214
|
+
*/
|
|
215
|
+
documentType?: string
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
declare interface TreeItemWithChildren extends StoredTreeItem {
|
|
219
|
+
children?: TreeItemWithChildren[]
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export declare interface TreeProps extends TreeDeskStructureProps {
|
|
223
|
+
/**
|
|
224
|
+
* Visible title above the tree.
|
|
225
|
+
* Also used as the label in the desk list item.
|
|
226
|
+
*/
|
|
227
|
+
title: string
|
|
228
|
+
/**
|
|
229
|
+
* Optional icon for rendering the item in the desk structure.
|
|
230
|
+
*/
|
|
231
|
+
icon?: any
|
|
232
|
+
context?: ConfigContext | any
|
|
233
|
+
S?: StructureBuilder | any
|
|
234
|
+
/**
|
|
235
|
+
* Restrict document types that can be created.
|
|
236
|
+
*/
|
|
237
|
+
creatableTypes?: string[]
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export {}
|