@sanity/orderable-document-list 1.0.0-v3-studio.4 → 1.0.0-v3-studio.6
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 +5 -8
- package/lib/index.esm.js +2 -0
- package/lib/index.esm.js.map +1 -0
- package/lib/index.js +1 -824
- package/lib/index.js.map +1 -1
- package/lib/src/index.d.ts +44 -0
- package/package.json +35 -29
- package/sanity.json +8 -0
- package/src/helpers/resetOrder.ts +1 -1
- package/v2-incompatible.js +11 -0
- package/lib/index.d.ts +0 -31
- package/lib/index.d.ts.map +0 -1
- package/lib/index.modern.js +0 -816
- package/lib/index.modern.js.map +0 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -190,8 +190,7 @@ Put simply it updates the position of an individual – or many – Documents in
|
|
|
190
190
|
|
|
191
191
|
## License
|
|
192
192
|
|
|
193
|
-
MIT
|
|
194
|
-
See LICENSE
|
|
193
|
+
MIT-licensed. See LICENSE.
|
|
195
194
|
|
|
196
195
|
## Develop & test
|
|
197
196
|
|
|
@@ -199,13 +198,11 @@ This plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)
|
|
|
199
198
|
with default configuration for build & watch scripts.
|
|
200
199
|
|
|
201
200
|
See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)
|
|
202
|
-
on how to run this plugin with hotreload in the studio.
|
|
201
|
+
on how to run this plugin with hotreload in the studio.
|
|
203
202
|
|
|
204
|
-
|
|
203
|
+
### Release new version
|
|
205
204
|
|
|
206
|
-
Run ["CI & Release" workflow](https://github.com/sanity-io/orderable-document-list/actions).
|
|
207
|
-
Make sure to select the
|
|
208
|
-
|
|
209
|
-
Version will be automatically bumped based on [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) since the last release.
|
|
205
|
+
Run ["CI & Release" workflow](https://github.com/sanity-io/orderable-document-list/actions/workflows/main.yml).
|
|
206
|
+
Make sure to select the v3 branch and check "Release new version".
|
|
210
207
|
|
|
211
208
|
Semantic release will only release on configured branches, so it is safe to run release on any branch.
|
package/lib/index.esm.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?e(Object(i),!0).forEach((function(e){n(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}import{defineField as r,useSchema as i,SanityPreview as o,useClient as s}from"sanity";import{LexoRank as l}from"lexorank";import{DragHandleIcon as d,ChevronUpIcon as a,ChevronDownIcon as c,GenerateIcon as u,SortIcon as p}from"@sanity/icons";import{jsxs as h,jsx as g,Fragment as m}from"react/jsx-runtime";import f,{useContext as y,useState as v,useEffect as b,useCallback as w,useMemo as k,Component as R}from"react";import{Flex as O,Box as x,Text as I,Button as S,useToast as _,Card as D,Spinner as j,Stack as E}from"@sanity/ui";import{DragDropContext as P,Droppable as L,Draggable as T}from"react-beautiful-dnd";import{usePaneRouter as C}from"sanity/desk";const $=e=>{if(!(null==e?void 0:e.type))throw new Error("\n type must be provided.\n Example: orderRankField({type: 'category'})\n ");const{type:n}=e;return r(t(t({title:"Order Rank",readOnly:!0,hidden:!0},e),{},{name:"orderRank",type:"string",initialValue:async(e,t)=>{let{getClient:r}=t;return function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const t=e?l.parse(e):l.min();return t.genNext().genNext().value}(await r({apiVersion:"2021-09-01"}).fetch("*[_type == $type]|order(@[$order] desc)[0][$order]",{type:n,order:"orderRank"}))}}))},z={title:"Ordered",name:"ordered",by:[{field:"orderRank",direction:"asc"}]},N=f.createContext({});function V(e){let{doc:t,increment:n,entities:r,handleSelect:s,index:l,isFirst:u,isLast:p}=e;const{showIncrements:m}=y(N),f=i();return h(O,{align:"center",children:[g(x,{paddingX:3,style:{flexShrink:0},children:g(I,{size:4,children:g(d,{})})}),m&&h(O,{style:{flexShrink:0},align:"center",gap:1,paddingRight:1,children:[g(S,{padding:2,mode:"ghost",onClick:()=>n(l,l+-1,t._id,r),disabled:u,icon:a}),g(S,{padding:2,mode:"ghost",disabled:p,onClick:()=>n(l,l+1,t._id,r),icon:c})]}),g(S,{style:{width:"100%"},padding:2,mode:"bleed",onClick:e=>s(t._id,l,e.nativeEvent),children:g(O,{flex:1,align:"center",children:g(x,{flex:1,children:g(o,{layout:"default",value:t,schemaType:f.get(t._type)})})})})]})}function B(e,t){return e.orderRank<t.orderRank?-1:e.orderRank>t.orderRank?1:0}function U(){return s({apiVersion:"2021-09-01"})}function F(e){let{data:n,type:r,listIsUpdating:i,setListIsUpdating:o}=e;const s=_(),d=C(),{navigateIntent:a}=d,[c,u]=v(n);b((()=>{i||u(n)}),[n]);const[p,m]=v(""),[f,y]=v([]),R=w((()=>y([])),[y]),O=w(((e,t,n)=>{const i=f.includes(e),o=n.shiftKey,s=-1!==navigator.appVersion.indexOf("Win")?n.ctrlKey:n.metaKey;let l=[];if(!o&&!s)return a("edit",{id:e,type:r}),y([e]);if(o&&!i){const n=f[f.length-1],r=c.findIndex((e=>e._id===n)),i=t<r?t:r,o=t>r?t:r,s=c.filter(((e,t)=>t>i&&t<o)).map((e=>e._id));l=[...f,...s,e]}else l=i?f.filter((t=>t!==e)):[...f,e];return y(l)}),[y,a,c,f,r]),I=U(),S=w((async(e,t)=>{const n=I.transaction();e.forEach((e=>{let[t,r]=e;return n.patch(t,r)})),await n.commit().then((e=>{R(),m(""),o(!1),s.push({title:"".concat(1===e.results.length?"1 Document":"".concat(e.results.length," Documents")," Reordered"),status:"success",description:t})})).catch((()=>{m(""),o(!1),s.push({title:"Reordering failed",status:"error"})}))}),[I,m,R,o,s]),j=w(((e,t)=>{m("");const{source:n,destination:r,draggableId:i}=null!=e?e:{};if((null==n?void 0:n.index)===(null==r?void 0:r.index))return;if(!(null==t?void 0:t.length)||!i)return;const s=(null==f?void 0:f.length)?f:[i];if(!(null==s?void 0:s.length))return;o(!0),y(s);const{newOrder:d,patches:a,message:c}=(e=>{let{entities:t,selectedIds:n,source:r,destination:i,debug:o=!1}=e;const s=r.index,d=i.index,a=s>d,c=t.filter((e=>n.includes(e._id))),u=["Moved",1===c.length?"1 Document":"".concat(c.length," Documents"),a?"up":"down","from position","".concat(s+1," to ").concat(d+1)].join(" "),{all:p,selected:h}=t.reduce(((e,r,i)=>{var o,s,u,p;if(n.includes(r._id))return{all:e.all,selected:e.selected};if(i===d){const n=i-1,d=(null==(o=t[n])?void 0:o.orderRank)?l.parse(null==(s=t[n])?void 0:s.orderRank):l.min(),h=l.parse(t[i].orderRank),g=i+1,m=(null==(u=t[g])?void 0:u.orderRank)?l.parse(null==(p=t[g])?void 0:p.orderRank):l.max();let f=a?d.between(h):h.between(m);for(let e=0;e<c.length;e+=1)c[e].orderRank=f.value,f=a?f.between(h):f.between(m);return{all:a?[...e.all,...c,r]:[...e.all,r,...c],selected:c}}return{all:[...e.all,r],selected:e.selected}}),{all:[],selected:[]}),g=h.map((e=>[e._id,{set:{orderRank:e.orderRank}}]));return{newOrder:p.sort(B),patches:g,message:u}})({entities:t,selectedIds:s,source:n,destination:r});(null==d?void 0:d.length)&&u(d),(null==a?void 0:a.length)&&S(a,c)}),[f,m,y,S,o]),E=w((e=>{const t=e.draggableId;f.includes(t)||R(),m(t)}),[f,R,m]),$=w(((e,t,n,r)=>j({draggableId:n,source:{index:e},destination:{index:t}},r)),[j]),z=w((e=>{"Escape"===e.key&&R()}),[R]);b((()=>(window.addEventListener("keydown",z),()=>{window.removeEventListener("keydown",z)})),[z]);const N=k((()=>{if(!c.length)return[];const e=c.map((e=>e.orderRank));return e.filter(((t,n)=>e.indexOf(t)!==n))}),[c]),F=w((e=>j(e,c)),[c,j]);return g(P,{onDragStart:E,onDragEnd:F,children:g(L,{droppableId:"documentSortZone",children:e=>h("div",t(t({},e.droppableProps),{},{ref:e.innerRef,children:[c.map(((e,n)=>g(T,{draggableId:e._id,index:n,children:(r,o)=>{const s=f.includes(e._id),l=o.isDragging,d=Boolean(!l&&p&&s),a=i&&s,u=Boolean(!e.orderRank),h=(e=>{const{isDuplicate:t,isGhosting:n,isDragging:r,isSelected:i}=e;return n?"transparent":r||i?"primary":t?"caution":void 0})({isDuplicate:N.includes(e.orderRank),isGhosting:d,isDragging:l,isSelected:s});return g("div",t(t(t({ref:r.innerRef},r.draggableProps),r.dragHandleProps),{},{style:u?{opacity:.2,pointerEvents:"none"}:(m=r.draggableProps.style,y=a,t({userSelect:"none",transition:"opacity 500ms ease-in-out",opacity:y?.2:1,pointerEvents:y?"none":void 0},m)),children:g(x,{paddingBottom:1,children:g(D,{tone:h,shadow:l?2:void 0,radius:2,children:g(V,{doc:e,entities:c,handleSelect:O,increment:$,index:n,isFirst:0===n,isLast:n===c.length-1})})})}));var m,y}},"".concat(e._id,"-").concat(e.orderRank)))),e.placeholder]}))})})}function K(e){let{children:t}=e;return g(x,{padding:3,children:g(D,{padding:4,radius:2,shadow:1,tone:"caution",children:g(I,{children:t})})})}const G={};function H(e){let{type:t,filter:n,params:r=G}=e;const[i,o]=v(!0),[s,l]=v(!1),[d,a]=v([]),c=U();b((()=>{const e="*[_type == $type ".concat(n?"&& ".concat(n):"","]|order(@[$order] asc){\n _id, _type, ").concat("orderRank","\n }"),l=Object.assign(r,{type:t,order:"orderRank"});let u;const p=async()=>{c.fetch(e,l).then((e=>{const t=e.reduce(((t,n)=>{if(!n._id.startsWith("drafts.")){return e.some((e=>e._id==="drafts.".concat(n._id)))?t:[...t,n]}return[...t,n]}),[]);a(t),i&&o(!1)}))};return s||d.length||(async()=>{o(!0),await p(),u||(u=c.listen(e,l).subscribe((()=>p())))})(),()=>null==u?void 0:u.unsubscribe()}),[t]);const u=k((()=>d.length?d.filter((e=>!e.orderRank)).length:0),[d]);return i?g(O,{style:{width:"100%",height:"100%"},align:"center",justify:"center",children:g(j,{})}):h(E,{space:1,style:{overflow:"scroll",height:"100%"},children:[u>0&&h(K,{children:[u,"/",d.length," Documents have no Order. Select"," ",g("strong",{children:"Reset Order"})," from the Menu above to fix."]}),g(x,{padding:1,children:g(F,{data:d,type:t,listIsUpdating:s,setListIsUpdating:l})})]})}function M(e){let{type:t,showIncrements:n,resetOrderTransaction:r,filter:o,params:s}=e;const l=_(),d=i();b((()=>{(null==r?void 0:r.title)&&(null==r?void 0:r.status)&&l.push(r)}),[r,l]);const a=k((()=>{if(!t)return h(m,{children:["No ",g("code",{children:"type"})," was configured"]});const e=d.get(t);return e?"fields"in e&&e.fields.some((e=>"orderRank"===(null==e?void 0:e.name)))?"fields"in e&&e.fields.some((e=>{var t;return"orderRank"===(null==e?void 0:e.name)&&"string"!==(null==(t=null==e?void 0:e.type)?void 0:t.name)}))?h(m,{children:[g("code",{children:"orderRank"})," field on Schema ",g("code",{children:t})," must be"," ",g("code",{children:"string"})," type"]}):"":h(m,{children:["Schema ",g("code",{children:t})," must have an ",g("code",{children:"orderRank"})," field of type"," ",g("code",{children:"string"})]}):h(m,{children:["Schema ",g("code",{children:t})," not found"]})}),[t,d]);return a?g(K,{children:a}):g(N.Provider,{value:{showIncrements:n},children:g(H,{type:t,filter:o,params:s})})}class W extends R{constructor(e){super(e),this.actionHandlers={showIncrements:()=>{this.setState((e=>({showIncrements:!e.showIncrements})))},resetOrder:async()=>{var e;this.setState((()=>({resetOrderTransaction:{status:"info",title:"Reordering started...",closable:!0}})));const t=await async function(){let e=arguments.length>1?arguments[1]:void 0;const t="*[_type == $type]|order(@[$order] asc)._id",n={type:arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",order:"orderRank"},r=await e.fetch(t,n);if(!r.length)return null;const i=e.transaction();let o=l.min();for(let e=0;e<r.length;e+=1)o=o.genNext().genNext(),i.patch(r[e],{set:{orderRank:o.value}});return i.commit().then((e=>e)).catch((e=>e))}(this.props.options.type,this.props.options.client),n=null==(e=null==t?void 0:t.results)?void 0:e.length;this.setState((()=>({resetOrderTransaction:{status:n?"success":"info",title:n?"Reordered ".concat(1===t.results.length?"Document":"Documents"):"Reordering failed",closable:!0}})))}},this.state={showIncrements:!1,resetOrderTransaction:{}}}render(){var e,t,n,r,i,o;const s=null==(t=null==(e=null==this?void 0:this.props)?void 0:e.options)?void 0:t.type;return s?g(M,{filter:null==(r=null==(n=null==this?void 0:this.props)?void 0:n.options)?void 0:r.filter,params:null==(o=null==(i=null==this?void 0:this.props)?void 0:i.options)?void 0:o.params,type:s,showIncrements:this.state.showIncrements,resetOrderTransaction:this.state.resetOrderTransaction}):null}}function X(e){var t,n;if(!(null==e?void 0:e.type)||!e.context||!e.S)throw new Error("\n type, context and S (StructureBuilder) must be provided.\n context and S are available when configuring structure.\n Example: orderableDocumentListDeskItem({type: 'category'})\n ");const{type:r,filter:i,params:o,title:s,icon:l,id:d,context:a,S:c}=e,{schema:h,getClient:g}=a,m=g({apiVersion:"2021-09-01"}),f=null!=s?s:"Orderable ".concat(r),y=null!=d?d:"orderable-".concat(r),v=null!=l?l:p,b=null!=(n=null==(t=h.get(r))?void 0:t.title)?n:r;return c.listItem().title(f).id(y).icon(v).child(Object.assign(c.documentTypeList(r).serialize(),{__preserveInstance:!0,key:y,type:"component",component:W,options:{type:r,filter:i,params:o,client:m},menuItems:[c.menuItem().title("Create new ".concat(b)).intent({type:"create",params:{type:r}}).serialize(),c.menuItem().title("Reset Order").icon(u).action("resetOrder").serialize(),c.menuItem().title("Show Increments").icon(p).action("showIncrements").serialize()]})).serialize()}export{$ as orderRankField,z as orderRankOrdering,X as orderableDocumentListDeskItem};
|
|
2
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/fields/orderRankField.ts","../src/helpers/constants.ts","../src/helpers/initialRank.ts","../src/fields/orderRankOrdering.ts","../src/OrderableContext.ts","../src/Document.tsx","../src/helpers/reorderDocuments.ts","../src/helpers/client.ts","../src/DraggableList.tsx","../src/Feedback.tsx","../src/DocumentListQuery.tsx","../src/DocumentListWrapper.tsx","../src/OrderableDocumentList.tsx","../src/helpers/resetOrder.ts","../src/desk-structure/orderableDocumentListDeskItem.ts"],"sourcesContent":["import {type ConfigContext, defineField} from 'sanity'\nimport {ORDER_FIELD_NAME} from '../helpers/constants'\nimport initialRank from '../helpers/initialRank'\n\nexport type SchemaContext = Omit<ConfigContext, 'schema' | 'currentUser' | 'client'>\n\nexport interface RankFieldConfig {\n type: string\n}\n\nexport const orderRankField = (config: RankFieldConfig) => {\n if (!config?.type) {\n throw new Error(\n `\n type must be provided.\n Example: orderRankField({type: 'category'})\n `\n )\n }\n\n const {type} = config\n return defineField({\n title: 'Order Rank',\n readOnly: true,\n hidden: true,\n ...config,\n name: ORDER_FIELD_NAME,\n type: 'string',\n initialValue: async (p, {getClient}) => {\n const lastDocOrderRank = await getClient({apiVersion: '2021-09-01'}).fetch(\n `*[_type == $type]|order(@[$order] desc)[0][$order]`,\n {type, order: ORDER_FIELD_NAME}\n )\n return initialRank(lastDocOrderRank)\n },\n })\n}\n","export const ORDER_FIELD_NAME = `orderRank` as const\n","import {LexoRank} from 'lexorank'\n\n// Use in initial value field by passing in the rank value of the last document\n// If not value passed, generate a sensibly low rank\nexport default function initialRank(lastRankValue = ``): string {\n const lastRank = lastRankValue ? LexoRank.parse(lastRankValue) : LexoRank.min()\n const nextRank = lastRank.genNext().genNext()\n\n return (nextRank as any).value\n}\n","import {ORDER_FIELD_NAME} from '../helpers/constants'\n\nexport const orderRankOrdering = {\n title: 'Ordered',\n name: 'ordered',\n by: [{field: ORDER_FIELD_NAME, direction: 'asc'}],\n}\n","import React from 'react'\n\nexport interface OrderableContextValue {\n showIncrements?: boolean\n}\n\nexport const OrderableContext = React.createContext<OrderableContextValue>({})\n","import React, {useContext} from 'react'\nimport {ChevronDownIcon, ChevronUpIcon, DragHandleIcon} from '@sanity/icons'\nimport {Box, Button, Flex, Text} from '@sanity/ui'\n\nimport {useSchema, SanityDocument, SchemaType, SanityPreview as Preview} from 'sanity'\nimport {OrderableContext} from './OrderableContext'\n\nexport interface DocumentProps {\n doc: SanityDocument\n entities: SanityDocument[]\n handleSelect: (docId: string, index: number, event: MouseEvent) => void\n increment: (index: number, nextIndex: number, docId: string, entities: SanityDocument[]) => void\n index: number\n isFirst: boolean\n isLast: boolean\n}\n\nexport default function Document({\n doc,\n increment,\n entities,\n handleSelect,\n index,\n isFirst,\n isLast,\n}: DocumentProps) {\n const {showIncrements} = useContext(OrderableContext)\n const schema = useSchema()\n return (\n <Flex align=\"center\">\n <Box paddingX={3} style={{flexShrink: 0}}>\n <Text size={4}>\n <DragHandleIcon />\n </Text>\n </Box>\n {showIncrements && (\n <Flex style={{flexShrink: 0}} align=\"center\" gap={1} paddingRight={1}>\n <Button\n padding={2}\n mode=\"ghost\"\n onClick={() => increment(index, index + -1, doc._id, entities)}\n disabled={isFirst}\n icon={ChevronUpIcon}\n />\n <Button\n padding={2}\n mode=\"ghost\"\n disabled={isLast}\n onClick={() => increment(index, index + 1, doc._id, entities)}\n icon={ChevronDownIcon}\n />\n </Flex>\n )}\n <Button\n style={{width: `100%`}}\n padding={2}\n mode=\"bleed\"\n onClick={(e) => handleSelect(doc._id, index, e.nativeEvent)}\n >\n <Flex flex={1} align=\"center\">\n <Box flex={1}>\n <Preview\n layout=\"default\"\n value={doc}\n schemaType={schema.get(doc._type) as SchemaType}\n />\n </Box>\n </Flex>\n </Button>\n </Flex>\n )\n}\n","import {LexoRank} from 'lexorank'\nimport type {PatchOperations, SanityDocument} from 'sanity'\nimport {ORDER_FIELD_NAME} from './constants'\n\nexport interface MaifestArgs {\n entities: SanityDocument[]\n selectedItems: SanityDocument[]\n isMovingUp: boolean\n curIndex: number\n nextIndex: number\n prevIndex: number\n}\n\nexport interface ReorderArgs {\n entities: SanityDocument[]\n selectedIds: string[]\n source: any\n destination: any\n debug?: boolean\n}\n\nfunction lexicographicalSort(a: {[ORDER_FIELD_NAME]: string}, b: {[ORDER_FIELD_NAME]: string}) {\n if (a[ORDER_FIELD_NAME] < b[ORDER_FIELD_NAME]) {\n return -1\n }\n if (a[ORDER_FIELD_NAME] > b[ORDER_FIELD_NAME]) {\n return 1\n }\n return 0\n}\n\nexport const reorderDocuments = ({\n entities,\n selectedIds,\n source,\n destination,\n debug = false,\n}: ReorderArgs) => {\n const startIndex = source.index\n const endIndex = destination.index\n const isMovingUp = startIndex > endIndex\n const selectedItems = entities.filter((item) => selectedIds.includes(item._id))\n const message = [\n `Moved`,\n selectedItems.length === 1 ? `1 Document` : `${selectedItems.length} Documents`,\n isMovingUp ? `up` : `down`,\n `from position`,\n `${startIndex + 1} to ${endIndex + 1}`,\n ].join(' ')\n\n const {all, selected} = entities.reduce(\n (acc, cur, curIndex) => {\n // Selected items get spread in below, so skip them here\n if (selectedIds.includes(cur._id)) {\n return {all: acc.all, selected: acc.selected}\n }\n\n // Drop seleced items in\n if (curIndex === endIndex) {\n const prevIndex = curIndex - 1\n const prevRank = entities[prevIndex]?.[ORDER_FIELD_NAME]\n ? LexoRank.parse(entities[prevIndex]?.[ORDER_FIELD_NAME] as string)\n : LexoRank.min()\n\n const curRank = LexoRank.parse(entities[curIndex][ORDER_FIELD_NAME] as string)\n\n const nextIndex = curIndex + 1\n const nextRank = entities[nextIndex]?.[ORDER_FIELD_NAME]\n ? LexoRank.parse(entities[nextIndex]?.[ORDER_FIELD_NAME] as string)\n : LexoRank.max()\n\n let betweenRank = isMovingUp ? prevRank.between(curRank) : curRank.between(nextRank)\n\n // For each selected item, assign a new orderRank between now and next\n for (let selectedIndex = 0; selectedIndex < selectedItems.length; selectedIndex += 1) {\n selectedItems[selectedIndex][ORDER_FIELD_NAME] = (betweenRank as any).value as string\n betweenRank = isMovingUp ? betweenRank.between(curRank) : betweenRank.between(nextRank)\n }\n\n return {\n // The `all` array gets sorted by order field later anyway\n // so that this probably isn't necessary ¯\\_(ツ)_/¯\n all: isMovingUp\n ? [...acc.all, ...selectedItems, cur]\n : [...acc.all, cur, ...selectedItems],\n selected: selectedItems,\n }\n }\n\n return {all: [...acc.all, cur], selected: acc.selected}\n },\n {all: [] as SanityDocument[], selected: [] as SanityDocument[]}\n )\n\n const patches: [string, PatchOperations][] = selected.map((doc) => {\n return [\n doc._id,\n {\n set: {\n [ORDER_FIELD_NAME]: doc[ORDER_FIELD_NAME],\n },\n },\n ]\n })\n\n // Safety-check to make sure everything is in order\n const allSorted = (all as unknown as {[ORDER_FIELD_NAME]: string}[]).sort(lexicographicalSort)\n\n return {newOrder: allSorted, patches, message}\n}\n","import {useClient} from 'sanity'\n\nexport function useSanityClient() {\n return useClient({apiVersion: '2021-09-01'})\n}\n","import React, {useEffect, useState, useMemo, useCallback, CSSProperties} from 'react'\nimport {DragDropContext, Draggable, Droppable, type DropResult} from 'react-beautiful-dnd'\nimport {Box, Card, useToast} from '@sanity/ui'\nimport {usePaneRouter} from 'sanity/desk'\nimport type {SanityDocument, PatchOperations} from 'sanity'\nimport Document from './Document'\nimport {reorderDocuments} from './helpers/reorderDocuments'\nimport {ORDER_FIELD_NAME} from './helpers/constants'\nimport {useSanityClient} from './helpers/client'\n\nconst getItemStyle = (\n draggableStyle: CSSProperties | undefined,\n itemIsUpdating: boolean\n): CSSProperties => ({\n userSelect: 'none',\n transition: `opacity 500ms ease-in-out`,\n opacity: itemIsUpdating ? 0.2 : 1,\n pointerEvents: itemIsUpdating ? `none` : undefined,\n ...draggableStyle,\n})\n\nconst cardTone = (settings: ListSetting) => {\n const {isDuplicate, isGhosting, isDragging, isSelected} = settings\n\n if (isGhosting) return `transparent`\n if (isDragging || isSelected) return `primary`\n if (isDuplicate) return `caution`\n\n return undefined\n}\n\ninterface ListSetting {\n isDuplicate: boolean\n isGhosting: boolean\n isDragging: boolean\n isSelected: boolean\n}\n\nexport interface DraggableListProps {\n data: SanityDocument[]\n type: string\n listIsUpdating: boolean\n setListIsUpdating: (val: boolean) => void\n}\n\nexport default function DraggableList({\n data,\n type,\n listIsUpdating,\n setListIsUpdating,\n}: DraggableListProps) {\n const toast = useToast()\n const router = usePaneRouter()\n const {navigateIntent} = router\n\n // Maintains local state order before transaction completes\n const [orderedData, setOrderedData] = useState<SanityDocument[]>(data)\n\n // Update local state when documents change from an outside source\n useEffect(() => {\n if (!listIsUpdating) setOrderedData(data)\n /* eslint-disable-next-line react-hooks/exhaustive-deps */\n }, [data])\n\n const [draggingId, setDraggingId] = useState(``)\n const [selectedIds, setSelectedIds] = useState<string[]>([])\n\n const clearSelected = useCallback(() => setSelectedIds([]), [setSelectedIds])\n\n const handleSelect = useCallback(\n (clickedId: string, index: number, nativeEvent: MouseEvent) => {\n const isSelected = selectedIds.includes(clickedId)\n const selectMultiple = nativeEvent.shiftKey\n const isUsingWindows = navigator.appVersion.indexOf('Win') !== -1\n const selectAdditional = isUsingWindows ? nativeEvent.ctrlKey : nativeEvent.metaKey\n\n let updatedIds = []\n\n // No modifier keys pressed during click:\n // - update selected to just this one\n // - open document\n if (!selectMultiple && !selectAdditional) {\n navigateIntent('edit', {id: clickedId, type})\n return setSelectedIds([clickedId])\n }\n\n // Shift key was held, add id's between last selected and this one\n // ...before adding this one\n if (selectMultiple && !isSelected) {\n const lastSelectedId = selectedIds[selectedIds.length - 1]\n const lastSelectedIndex = orderedData.findIndex((item) => item._id === lastSelectedId)\n\n const firstSelected = index < lastSelectedIndex ? index : lastSelectedIndex\n const lastSelected = index > lastSelectedIndex ? index : lastSelectedIndex\n\n const betweenIds = orderedData\n .filter((item, itemIndex) => itemIndex > firstSelected && itemIndex < lastSelected)\n .map((item) => item._id)\n\n updatedIds = [...selectedIds, ...betweenIds, clickedId]\n } else if (isSelected) {\n // Toggle off a single id\n updatedIds = selectedIds.filter((id) => id !== clickedId)\n } else {\n // Toggle on a single id\n updatedIds = [...selectedIds, clickedId]\n }\n\n return setSelectedIds(updatedIds)\n },\n [setSelectedIds, navigateIntent, orderedData, selectedIds, type]\n )\n\n const client = useSanityClient()\n\n const transactPatches = useCallback(\n async (patches: [string, PatchOperations][], message: string) => {\n const transaction = client.transaction()\n\n patches.forEach(([docId, ops]) => transaction.patch(docId, ops))\n\n await transaction\n .commit()\n .then((updated) => {\n clearSelected()\n setDraggingId(``)\n setListIsUpdating(false)\n toast.push({\n title: `${\n updated.results.length === 1 ? `1 Document` : `${updated.results.length} Documents`\n } Reordered`,\n status: `success`,\n description: message,\n })\n })\n .catch(() => {\n setDraggingId(``)\n setListIsUpdating(false)\n toast.push({\n title: `Reordering failed`,\n status: `error`,\n })\n })\n },\n [client, setDraggingId, clearSelected, setListIsUpdating, toast]\n )\n\n const handleDragEnd = useCallback(\n (result: DropResult | undefined, entities: SanityDocument[]) => {\n setDraggingId(``)\n\n const {source, destination, draggableId} = result ?? {}\n\n // Don't do anything if nothing changed\n if (source?.index === destination?.index) return\n\n // Don't do anything if we don't have the entitites\n if (!entities?.length || !draggableId) return\n\n // A document can be dragged without being one-of-many-selected\n const effectedIds = selectedIds?.length ? selectedIds : [draggableId]\n\n // Don't do anything if we don't have ids to effect\n if (!effectedIds?.length) return\n\n // Update state to update styles + prevent data refetching\n setListIsUpdating(true)\n setSelectedIds(effectedIds)\n\n const {newOrder, patches, message} = reorderDocuments({\n entities,\n selectedIds: effectedIds,\n source,\n destination,\n })\n\n // Update local state\n if (newOrder?.length) {\n setOrderedData(newOrder as any)\n }\n\n // Transact new order patches\n if (patches?.length) {\n transactPatches(patches, message)\n }\n },\n [selectedIds, setDraggingId, setSelectedIds, transactPatches, setListIsUpdating]\n )\n\n const handleDragStart = useCallback(\n (start: {draggableId: string}) => {\n const id = start.draggableId\n const selected = selectedIds.includes(id)\n\n // if dragging an item that is not selected - unselect all items\n if (!selected) clearSelected()\n\n setDraggingId(id)\n },\n [selectedIds, clearSelected, setDraggingId]\n )\n\n // Move one document up or down one place, by fake invoking the drag function\n const incrementIndex = useCallback(\n (shiftFrom: number, shiftTo: number, id: string, entities: SanityDocument[]) => {\n const result = {\n draggableId: id,\n source: {index: shiftFrom},\n destination: {index: shiftTo},\n }\n\n return handleDragEnd(result as DropResult, entities)\n },\n [handleDragEnd]\n )\n\n const onWindowKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n clearSelected()\n }\n },\n [clearSelected]\n )\n\n useEffect(() => {\n window.addEventListener('keydown', onWindowKeyDown)\n\n return () => {\n window.removeEventListener('keydown', onWindowKeyDown)\n }\n }, [onWindowKeyDown])\n\n // Find all items with duplicate order field\n const duplicateOrders = useMemo(() => {\n if (!orderedData.length) return []\n\n const orderField = orderedData.map((item) => item[ORDER_FIELD_NAME])\n\n return orderField.filter((item, index) => orderField.indexOf(item) !== index)\n }, [orderedData])\n\n const onDragEnd = useCallback(\n (result: DropResult) => handleDragEnd(result, orderedData),\n [orderedData, handleDragEnd]\n )\n\n return (\n <DragDropContext onDragStart={handleDragStart} onDragEnd={onDragEnd}>\n <Droppable droppableId=\"documentSortZone\">\n {(provided) => (\n <div {...provided.droppableProps} ref={provided.innerRef}>\n {orderedData.map((item, index) => (\n <Draggable\n key={`${item._id}-${item[ORDER_FIELD_NAME]}`}\n draggableId={item._id}\n index={index}\n // onClick={(event) => handleDraggableClick(event, provided, snapshot)}\n >\n {(innerProvided, innerSnapshot) => {\n const isSelected = selectedIds.includes(item._id)\n const isDragging = innerSnapshot.isDragging\n const isGhosting = Boolean(!isDragging && draggingId && isSelected)\n const isUpdating = listIsUpdating && isSelected\n const isDisabled = Boolean(!item[ORDER_FIELD_NAME])\n const isDuplicate = duplicateOrders.includes(item[ORDER_FIELD_NAME])\n const tone = cardTone({isDuplicate, isGhosting, isDragging, isSelected})\n\n return (\n <div\n ref={innerProvided.innerRef}\n {...innerProvided.draggableProps}\n {...innerProvided.dragHandleProps}\n style={\n isDisabled\n ? {opacity: 0.2, pointerEvents: `none`}\n : getItemStyle(innerProvided.draggableProps.style, isUpdating)\n }\n >\n <Box paddingBottom={1}>\n <Card tone={tone} shadow={isDragging ? 2 : undefined} radius={2}>\n <Document\n doc={item}\n entities={orderedData}\n handleSelect={handleSelect}\n increment={incrementIndex}\n index={index}\n isFirst={index === 0}\n isLast={index === orderedData.length - 1}\n />\n </Card>\n </Box>\n </div>\n )\n }}\n </Draggable>\n ))}\n {provided.placeholder}\n </div>\n )}\n </Droppable>\n </DragDropContext>\n )\n}\n","import React, {PropsWithChildren} from 'react'\nimport {Box, Card, Text} from '@sanity/ui'\n\nexport default function Feedback({children}: PropsWithChildren<{}>) {\n return (\n <Box padding={3}>\n <Card padding={4} radius={2} shadow={1} tone=\"caution\">\n <Text>{children}</Text>\n </Card>\n </Box>\n )\n}\n","import React, {useEffect, useMemo, useState} from 'react'\nimport {Box, Flex, Spinner, Stack} from '@sanity/ui'\n\nimport type {SanityDocument} from 'sanity'\nimport DraggableList from './DraggableList'\nimport {ORDER_FIELD_NAME} from './helpers/constants'\nimport Feedback from './Feedback'\nimport {useSanityClient} from './helpers/client'\n\nexport interface DocumentListQueryProps {\n type: string\n filter?: string\n params?: Record<string, unknown>\n}\n\n//rxjs Subscription does not seem to comply with sanity client subscribe anymore\ntype ClientSubscription = ReturnType<\n ReturnType<ReturnType<typeof useSanityClient>['listen']>['subscribe']\n>\n\nconst DEFAULT_PARAMS = {}\n\nexport default function DocumentListQuery({\n type,\n filter,\n params = DEFAULT_PARAMS,\n}: DocumentListQueryProps) {\n const [isLoading, setIsLoading] = useState(true)\n const [listIsUpdating, setListIsUpdating] = useState(false)\n const [data, setData] = useState<SanityDocument[]>([])\n\n const client = useSanityClient()\n\n useEffect(() => {\n const query = `*[_type == $type ${filter ? `&& ${filter}` : ''}]|order(@[$order] asc){\n _id, _type, ${ORDER_FIELD_NAME}\n }`\n const queryParams = Object.assign(params, {type, order: ORDER_FIELD_NAME})\n let subscription: ClientSubscription | undefined\n\n // eslint-disable-next-line require-await\n const fetchData = async () => {\n client.fetch<SanityDocument[]>(query, queryParams).then((documents) => {\n // Remove published document from list if draft also exists\n const filteredDocuments = documents.reduce((acc, cur) => {\n if (!cur._id.startsWith(`drafts.`)) {\n // eslint-disable-next-line max-nested-callbacks\n const alsoHasDraft = documents.some((doc) => doc._id === `drafts.${cur._id}`)\n\n return alsoHasDraft ? acc : [...acc, cur]\n }\n\n return [...acc, cur]\n }, [] as SanityDocument[])\n\n setData(filteredDocuments)\n\n if (isLoading) {\n setIsLoading(false)\n }\n })\n }\n\n const prepareData = async () => {\n setIsLoading(true)\n\n await fetchData()\n\n if (!subscription) {\n subscription = client.listen(query, queryParams).subscribe(() => fetchData())\n }\n }\n\n // Get data but only if a document isn't being patched or we don't yet have data\n if (!listIsUpdating && !data.length) {\n prepareData()\n }\n\n return () => subscription?.unsubscribe()\n /* eslint-disable-next-line react-hooks/exhaustive-deps */\n }, [type])\n\n const unorderedDataCount = useMemo(\n () => (data.length ? data.filter((doc) => !doc[ORDER_FIELD_NAME]).length : 0),\n [data]\n )\n\n if (isLoading)\n return (\n <Flex style={{width: `100%`, height: `100%`}} align=\"center\" justify=\"center\">\n <Spinner />\n </Flex>\n )\n\n return (\n <Stack space={1} style={{overflow: `scroll`, height: `100%`}}>\n {unorderedDataCount > 0 && (\n <Feedback>\n {unorderedDataCount}/{data.length} Documents have no Order. Select{' '}\n <strong>Reset Order</strong> from the Menu above to fix.\n </Feedback>\n )}\n <Box padding={1}>\n <DraggableList\n data={data}\n type={type}\n listIsUpdating={listIsUpdating}\n setListIsUpdating={setListIsUpdating}\n />\n </Box>\n </Stack>\n )\n}\n","import React, {useEffect, useMemo} from 'react'\nimport {useToast} from '@sanity/ui'\n\nimport {useSchema} from 'sanity'\nimport type {ToastParams} from '@sanity/ui'\nimport DocumentListQuery from './DocumentListQuery'\nimport {OrderableContext} from './OrderableContext'\n\nimport {ORDER_FIELD_NAME} from './helpers/constants'\nimport Feedback from './Feedback'\n\nexport interface DocumentListWrapperProps {\n showIncrements: boolean\n type: string\n resetOrderTransaction: ToastParams\n filter?: string\n params?: Record<string, unknown>\n}\n\n// 1. Validate first that the schema has been configured for ordering\n// 2. Setup context for showIncrements\nexport default function DocumentListWrapper({\n type,\n showIncrements,\n resetOrderTransaction,\n filter,\n params,\n}: DocumentListWrapperProps) {\n const toast = useToast()\n const schema = useSchema()\n\n useEffect(() => {\n if (resetOrderTransaction?.title && resetOrderTransaction?.status) {\n toast.push(resetOrderTransaction)\n }\n }, [resetOrderTransaction, toast])\n\n const schemaIsInvalid = useMemo(() => {\n // Option not passed\n if (!type) {\n return (\n <>\n No <code>type</code> was configured\n </>\n )\n }\n\n const typeSchema = schema.get(type)\n\n // Schema not found\n if (!typeSchema) {\n return (\n <>\n Schema <code>{type}</code> not found\n </>\n )\n }\n\n // Schema lacks an order field\n if (\n !('fields' in typeSchema) ||\n !typeSchema.fields.some((field) => field?.name === ORDER_FIELD_NAME)\n ) {\n return (\n <>\n Schema <code>{type}</code> must have an <code>{ORDER_FIELD_NAME}</code> field of type{' '}\n <code>string</code>\n </>\n )\n }\n\n // Schema's order field is not a string\n if (\n 'fields' in typeSchema &&\n typeSchema.fields.some(\n (field) => field?.name === ORDER_FIELD_NAME && field?.type?.name !== 'string'\n )\n ) {\n return (\n <>\n <code>{ORDER_FIELD_NAME}</code> field on Schema <code>{type}</code> must be{' '}\n <code>string</code> type\n </>\n )\n }\n\n return ''\n }, [type, schema])\n\n if (schemaIsInvalid) {\n return <Feedback>{schemaIsInvalid}</Feedback>\n }\n\n return (\n <OrderableContext.Provider value={{showIncrements}}>\n <DocumentListQuery type={type} filter={filter} params={params} />\n </OrderableContext.Provider>\n )\n}\n","import React, {Component} from 'react'\n\nimport {SanityClient} from '@sanity/client'\nimport type {ToastParams} from '@sanity/ui'\nimport DocumentListWrapper from './DocumentListWrapper'\nimport {resetOrder} from './helpers/resetOrder'\n\nexport interface OrderableDocumentListProps {\n options: {\n type: string\n client: SanityClient,\n filter?: string,\n params?: Record<string, unknown>\n }\n}\n\ninterface State {\n showIncrements: boolean\n resetOrderTransaction: ToastParams\n}\n\n// Must use a Class Component here so the actionHandlers can be called\nexport default class OrderableDocumentList extends Component<OrderableDocumentListProps, State> {\n constructor(props: OrderableDocumentListProps) {\n super(props)\n this.state = {\n showIncrements: false,\n resetOrderTransaction: {},\n }\n }\n\n actionHandlers = {\n showIncrements: () => {\n this.setState((state) => ({\n showIncrements: !state.showIncrements,\n }))\n },\n\n resetOrder: async () => {\n this.setState(() => ({\n resetOrderTransaction: {\n status: `info`,\n title: `Reordering started...`,\n closable: true,\n },\n }))\n\n const update = await resetOrder(this.props.options.type, this.props.options.client)\n\n const reorderWasSuccessful = update?.results?.length\n\n this.setState(() => ({\n resetOrderTransaction: {\n status: reorderWasSuccessful ? `success` : `info`,\n title: reorderWasSuccessful\n ? `Reordered ${update.results.length === 1 ? `Document` : `Documents`}`\n : `Reordering failed`,\n closable: true,\n },\n }))\n },\n }\n\n render() {\n const type = this?.props?.options?.type\n if (!type) {\n return null\n }\n return (\n <DocumentListWrapper\n filter={this?.props?.options?.filter}\n params={this?.props?.options?.params}\n type={type}\n showIncrements={this.state.showIncrements}\n resetOrderTransaction={this.state.resetOrderTransaction}\n />\n )\n }\n}\n","import {LexoRank} from 'lexorank'\nimport {SanityClient} from '@sanity/client'\nimport {ORDER_FIELD_NAME} from './constants'\n// Function to wipe and re-do ordering with LexoRank\n// Will at least attempt to start with the current order\nexport async function resetOrder(type = ``, client: SanityClient) {\n const query = `*[_type == $type]|order(@[$order] asc)._id`\n const queryParams = {type, order: ORDER_FIELD_NAME}\n const documents = await client.fetch(query, queryParams)\n\n if (!documents.length) {\n return null\n }\n\n const transaction = client.transaction()\n let aLexoRank = LexoRank.min()\n\n for (let index = 0; index < documents.length; index += 1) {\n // Generate next rank before even the first document so there's room to move!\n aLexoRank = aLexoRank.genNext().genNext()\n\n transaction.patch(documents[index], {\n set: {[ORDER_FIELD_NAME]: (aLexoRank as any).value as string},\n })\n }\n\n return transaction\n .commit()\n .then((update) => update)\n .catch((err) => err)\n}\n","import {GenerateIcon, SortIcon} from '@sanity/icons'\nimport type {ConfigContext} from 'sanity'\n\nimport {ComponentType} from 'react'\nimport {StructureBuilder} from 'sanity/desk'\nimport OrderableDocumentList from '../OrderableDocumentList'\n\nexport interface OrderableListConfig {\n type: string\n id?: string\n title?: string\n icon?: ComponentType\n params?: Record<string, unknown>\n filter?: string\n context: ConfigContext\n S: StructureBuilder\n}\n\nexport function orderableDocumentListDeskItem(config: OrderableListConfig) {\n if (!config?.type || !config.context || !config.S) {\n throw new Error(`\n type, context and S (StructureBuilder) must be provided.\n context and S are available when configuring structure.\n Example: orderableDocumentListDeskItem({type: 'category'})\n `)\n }\n\n const {type, filter, params, title, icon, id, context, S} = config\n const {schema, getClient} = context\n const client = getClient({apiVersion: '2021-09-01'})\n\n const listTitle = title ?? `Orderable ${type}`\n const listId = id ?? `orderable-${type}`\n const listIcon = icon ?? SortIcon\n const typeTitle = schema.get(type)?.title ?? type\n\n return S.listItem()\n .title(listTitle)\n .id(listId)\n .icon(listIcon)\n .child(\n Object.assign(S.documentTypeList(type).serialize(), {\n // Prevents the component from re-rendering when switching documents\n __preserveInstance: true,\n // Prevents the component from NOT re-rendering when switching listItems\n key: listId,\n\n type: 'component',\n component: OrderableDocumentList,\n options: {type, filter, params, client},\n menuItems: [\n S.menuItem()\n .title(`Create new ${typeTitle}`)\n .intent({type: 'create', params: {type}})\n .serialize(),\n S.menuItem().title(`Reset Order`).icon(GenerateIcon).action(`resetOrder`).serialize(),\n S.menuItem().title(`Show Increments`).icon(SortIcon).action(`showIncrements`).serialize(),\n ],\n })\n )\n .serialize()\n}\n"],"names":["orderRankField","config","type","Error","defineField","_objectSpread","title","readOnly","hidden","name","initialValue","async","p","_ref","getClient","lastRankValue","lastRank","LexoRank","parse","min","genNext","value","initialRank","apiVersion","fetch","order","orderRankOrdering","by","field","direction","OrderableContext","React","createContext","Document","_ref2","doc","increment","entities","handleSelect","index","isFirst","isLast","showIncrements","useContext","schema","useSchema","jsxs","Flex","align","children","jsx","Box","paddingX","style","flexShrink","Text","size","DragHandleIcon","gap","paddingRight","Button","padding","mode","onClick","_id","disabled","icon","ChevronUpIcon","ChevronDownIcon","width","e","nativeEvent","flex","Preview","layout","schemaType","get","_type","lexicographicalSort","a","b","useSanityClient","useClient","DraggableList","_ref4","data","listIsUpdating","setListIsUpdating","toast","useToast","router","usePaneRouter","navigateIntent","orderedData","setOrderedData","useState","useEffect","draggingId","setDraggingId","selectedIds","setSelectedIds","clearSelected","useCallback","clickedId","isSelected","includes","selectMultiple","shiftKey","selectAdditional","navigator","appVersion","indexOf","ctrlKey","metaKey","updatedIds","id","lastSelectedId","length","lastSelectedIndex","findIndex","item","firstSelected","lastSelected","betweenIds","filter","itemIndex","map","client","transactPatches","patches","message","transaction","forEach","_ref5","docId","ops","patch","commit","then","updated","push","results","concat","status","description","catch","handleDragEnd","result","source","destination","draggableId","effectedIds","newOrder","_ref3","debug","startIndex","endIndex","isMovingUp","selectedItems","join","all","selected","reduce","acc","cur","curIndex","_a","_b","_c","_d","prevIndex","prevRank","curRank","nextIndex","nextRank","max","betweenRank","between","selectedIndex","set","orderRank","sort","reorderDocuments","handleDragStart","start","incrementIndex","shiftFrom","shiftTo","onWindowKeyDown","event","key","window","addEventListener","removeEventListener","duplicateOrders","useMemo","orderField","onDragEnd","DragDropContext","onDragStart","Droppable","droppableId","provided","droppableProps","ref","innerRef","Draggable","innerProvided","innerSnapshot","isDragging","isGhosting","Boolean","isUpdating","isDisabled","tone","settings","isDuplicate","cardTone","draggableProps","dragHandleProps","opacity","pointerEvents","draggableStyle","itemIsUpdating","userSelect","transition","paddingBottom","Card","shadow","radius","placeholder","Feedback","_ref6","DEFAULT_PARAMS","DocumentListQuery","_ref7","params","isLoading","setIsLoading","setData","query","ORDER_FIELD_NAME","queryParams","Object","assign","subscription","fetchData","documents","filteredDocuments","startsWith","some","listen","subscribe","prepareData","unsubscribe","unorderedDataCount","height","justify","Spinner","Stack","space","overflow","DocumentListWrapper","_ref8","resetOrderTransaction","schemaIsInvalid","Fragment","typeSchema","fields","Provider","OrderableDocumentList","Component","constructor","props","super","this","actionHandlers","setState","state","resetOrder","closable","update","arguments","undefined","aLexoRank","err","options","reorderWasSuccessful","render","_e","_f","orderableDocumentListDeskItem","context","S","listTitle","listId","listIcon","SortIcon","typeTitle","listItem","child","documentTypeList","serialize","__preserveInstance","component","menuItems","menuItem","intent","GenerateIcon","action"],"mappings":"y0CAUa,MAAAA,EAAkBC,IACzB,WAACA,WAAQC,MACX,MAAM,IAAIC,MAKV,6FAGI,MAAAD,KAACA,GAAQD,EACf,OAAOG,EAAYC,EAAAA,EAAA,CACjBC,MAAO,aACPC,UAAU,EACVC,QAAQ,GACLP,GAAA,CAAA,EAAA,CACHQ,KC1B4B,YD2B5BP,KAAM,SACNQ,aAAcC,MAAOC,EAAmBC,KAAA,IAAhBC,UAACA,GAAeD,EAKtC,OE7BkB,WAAwC,IAA5BE,4DAClC,MAAMC,EAAWD,EAAgBE,EAASC,MAAMH,GAAiBE,EAASE,MAG1E,OAFiBH,EAASI,UAAUA,UAEXC,KAC3B,CFwBaC,OAJwBR,EAAU,CAACS,WAAY,eAAeC,MAEnE,qDAAA,CAACtB,OAAMuB,MC/BiB,cDiCS,IAEtC,EGjCUC,EAAoB,CAC/BpB,MAAO,UACPG,KAAM,UACNkB,GAAI,CAAC,CAACC,MFLwB,YEKCC,UAAW,SCC/BC,EAAmBC,EAAMC,cAAqC,ICW3E,SAAwBC,EAQNC,GAAA,IAReC,IAC/BA,EAAAC,UACAA,EAAAC,SACAA,EAAAC,aACAA,EAAAC,MACAA,EAAAC,QACAA,EAAAC,OACAA,GACgBP,EAChB,MAAMQ,eAACA,GAAkBC,EAAWb,GAC9Bc,EAASC,IACf,OACGC,EAAAC,EAAA,CAAKC,MAAM,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