@sanity/orderable-document-list 1.2.2 → 1.3.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.
- package/LICENSE +1 -1
- package/lib/index.cjs +499 -0
- package/lib/index.cjs.map +1 -0
- package/lib/index.d.cts +36 -0
- package/lib/index.d.ts +5 -13
- package/lib/index.js +428 -712
- package/lib/index.js.map +1 -1
- package/package.json +41 -40
- package/src/Document.tsx +4 -4
- package/src/DocumentListQuery.tsx +7 -9
- package/src/DocumentListWrapper.tsx +4 -5
- package/src/DraggableList.tsx +41 -44
- package/src/OrderableContext.ts +2 -2
- package/src/OrderableDocumentList.tsx +3 -3
- package/src/desk-structure/orderableDocumentListDeskItem.ts +5 -5
- package/src/fields/orderRankField.ts +10 -9
- package/src/fields/orderRankOrdering.ts +1 -1
- package/src/helpers/client.ts +2 -2
- package/src/helpers/initialRank.ts +2 -2
- package/src/helpers/reorderDocuments.ts +8 -8
- package/src/helpers/resetOrder.ts +17 -12
- package/lib/index.esm.js +0 -778
- package/lib/index.esm.js.map +0 -1
package/lib/index.d.cts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type {ComponentType} from 'react'
|
|
2
|
+
import type {ConfigContext} from 'sanity'
|
|
3
|
+
import {ListItem} from 'sanity/structure'
|
|
4
|
+
import {MenuItem} from 'sanity/structure'
|
|
5
|
+
import type {SortOrdering} from 'sanity'
|
|
6
|
+
import {StringDefinition} from 'sanity'
|
|
7
|
+
import {StructureBuilder} from 'sanity/structure'
|
|
8
|
+
|
|
9
|
+
declare type NewItemPosition = 'after' | 'before'
|
|
10
|
+
|
|
11
|
+
export declare function orderableDocumentListDeskItem(config: OrderableListConfig): ListItem
|
|
12
|
+
|
|
13
|
+
export declare interface OrderableListConfig {
|
|
14
|
+
type: string
|
|
15
|
+
id?: string
|
|
16
|
+
title?: string
|
|
17
|
+
icon?: ComponentType
|
|
18
|
+
params?: Record<string, unknown>
|
|
19
|
+
filter?: string
|
|
20
|
+
menuItems?: MenuItem[]
|
|
21
|
+
createIntent?: boolean
|
|
22
|
+
context: ConfigContext
|
|
23
|
+
S: StructureBuilder
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export declare const orderRankField: (config: RankFieldConfig) => StringDefinition
|
|
27
|
+
|
|
28
|
+
export declare const orderRankOrdering: SortOrdering
|
|
29
|
+
|
|
30
|
+
export declare interface RankFieldConfig
|
|
31
|
+
extends Omit<StringDefinition, 'name' | 'type' | 'initialValue'> {
|
|
32
|
+
type: string
|
|
33
|
+
newItemPosition?: NewItemPosition
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export {}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {ComponentType} from 'react'
|
|
1
|
+
import type {ComponentType} from 'react'
|
|
2
2
|
import type {ConfigContext} from 'sanity'
|
|
3
|
-
import {FieldDefinitionBase} from 'sanity'
|
|
4
3
|
import {ListItem} from 'sanity/structure'
|
|
5
4
|
import {MenuItem} from 'sanity/structure'
|
|
6
|
-
import {SortOrdering} from 'sanity'
|
|
5
|
+
import type {SortOrdering} from 'sanity'
|
|
7
6
|
import {StringDefinition} from 'sanity'
|
|
8
7
|
import {StructureBuilder} from 'sanity/structure'
|
|
9
|
-
import {WidenInitialValue} from 'sanity'
|
|
10
|
-
import {WidenValidation} from 'sanity'
|
|
11
8
|
|
|
12
9
|
declare type NewItemPosition = 'after' | 'before'
|
|
13
10
|
|
|
@@ -26,17 +23,12 @@ export declare interface OrderableListConfig {
|
|
|
26
23
|
S: StructureBuilder
|
|
27
24
|
}
|
|
28
25
|
|
|
29
|
-
export declare const orderRankField: (config: RankFieldConfig) =>
|
|
30
|
-
type: 'string'
|
|
31
|
-
name: 'orderRank'
|
|
32
|
-
} & Omit<StringDefinition, 'preview'> &
|
|
33
|
-
FieldDefinitionBase &
|
|
34
|
-
WidenValidation &
|
|
35
|
-
WidenInitialValue
|
|
26
|
+
export declare const orderRankField: (config: RankFieldConfig) => StringDefinition
|
|
36
27
|
|
|
37
28
|
export declare const orderRankOrdering: SortOrdering
|
|
38
29
|
|
|
39
|
-
export declare interface RankFieldConfig
|
|
30
|
+
export declare interface RankFieldConfig
|
|
31
|
+
extends Omit<StringDefinition, 'name' | 'type' | 'initialValue'> {
|
|
40
32
|
type: string
|
|
41
33
|
newItemPosition?: NewItemPosition
|
|
42
34
|
}
|