sanity-plugin-taxonomy-manager 4.3.0 → 4.4.2
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/README.md +10 -11
- package/lib/index.esm.esm.js +48 -48
- package/lib/index.esm.esm.js.map +1 -1
- package/lib/index.esm.mjs +48 -48
- package/lib/index.esm.mjs.map +1 -1
- package/lib/index.js +22 -22
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/baseIriField.module.css +10 -12
- package/src/skosConcept.module.css +9 -11
package/README.md
CHANGED
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
The Taxonomy Manager document schema is based on the [World Wide Web Consortium](https://www.w3.org/) (W3C) [Simple Knowledge Organization Scheme](https://www.w3.org/TR/skos-reference/) (SKOS) recommendation. Concept and concept scheme editor tools include standard SKOS properties, hints for creating consistent concepts and vocabularies, and validation functions for preventing consistency errors. -->
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
| ----------------------------------------------------------------------- |
|
|
12
|
+

|
|
14
13
|
|
|
15
14
|
## Documentation
|
|
16
15
|
|
|
@@ -116,7 +115,7 @@ export default defineConfig({
|
|
|
116
115
|
|
|
117
116
|
## Contributing
|
|
118
117
|
|
|
119
|
-
|
|
118
|
+
See something that could be improved (or a bug that should be fixed)? Please feel free to pitch in.
|
|
120
119
|
|
|
121
120
|
- This plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)
|
|
122
121
|
with default configuration for build & watch scripts.
|
|
@@ -149,8 +148,8 @@ graph BT
|
|
|
149
148
|
<i style="color: gray; font-size: small">uses SchemeContext</i>
|
|
150
149
|
<i style="color: gray; font-size: small">uses TreeContext</i>
|
|
151
150
|
]-->TreeStructure.tsx
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
Concepts.tsx[
|
|
152
|
+
Concepts.tsx
|
|
154
153
|
<i style="color: gray; font-size: small">uses SchemeContext</i>
|
|
155
154
|
<i style="color: gray; font-size: small">uses TreeContext</i>
|
|
156
155
|
]-->TreeStructure.tsx
|
|
@@ -158,13 +157,13 @@ graph BT
|
|
|
158
157
|
|
|
159
158
|
%% Sequence below maintains RTL ordering:
|
|
160
159
|
ConceptDetailLink.tsx-->TopConcepts.tsx
|
|
161
|
-
ConceptDetailLink.tsx-->
|
|
160
|
+
ConceptDetailLink.tsx-->Concepts.tsx
|
|
162
161
|
|
|
163
162
|
ChildConcepts.tsx-->TopConcepts.tsx
|
|
164
|
-
ChildConcepts.tsx-->
|
|
163
|
+
ChildConcepts.tsx-->Concepts.tsx
|
|
165
164
|
Children.tsx-->ChildConcepts.tsx
|
|
166
165
|
|
|
167
|
-
ConceptDetailDialogue.tsx-->
|
|
166
|
+
ConceptDetailDialogue.tsx-->Concepts.tsx
|
|
168
167
|
ConceptDetailDialogue.tsx-->TopConcepts.tsx
|
|
169
168
|
|
|
170
169
|
ConceptDetailLink.tsx-->Children.tsx
|
|
@@ -204,13 +203,13 @@ graph BT
|
|
|
204
203
|
<i style="color: gray; font-size: small">uses SchemeContext</i>
|
|
205
204
|
<i style="color: gray; font-size: small">uses TreeContext</i>
|
|
206
205
|
]-->TreeStructure.tsx
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
Concepts.tsx[
|
|
207
|
+
Concepts.tsx
|
|
209
208
|
<i style="color: gray; font-size: small">uses SchemeContext</i>
|
|
210
209
|
<i style="color: gray; font-size: small">uses TreeContext</i>
|
|
211
210
|
]-->TreeStructure.tsx
|
|
212
211
|
ChildConcepts.tsx-->TopConcepts.tsx
|
|
213
|
-
ChildConcepts.tsx-->
|
|
212
|
+
ChildConcepts.tsx-->Concepts.tsx
|
|
214
213
|
Children.tsx-->ChildConcepts.tsx
|
|
215
214
|
end
|
|
216
215
|
end
|
package/lib/index.esm.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{useFormValue as e,set as t,useDocumentStore as n,useClient as i,isPublishedId as r,usePerspective as o,isDraftId as c,isVersionId as a,unset as s,defineField as d,defineType as l,defineArrayMember as p,useSchema as h,getPublishedId as m,Preview as u,definePlugin as f}from"sanity";import{usePaneRouter as g,structureTool as y}from"sanity/structure";import{useCallback as b,useState as C,useRef as w,useEffect as v,useMemo as _,createContext as I,useContext as x}from"react";import{jsxs as k,jsx as V,Fragment as T}from"react/jsx-runtime";import{isVersionId as S,getVersionNameFromId as N,getVersionId as H,DocumentId as
|
|
1
|
+
import{useFormValue as e,set as t,useDocumentStore as n,useClient as i,isPublishedId as r,usePerspective as o,isDraftId as c,isVersionId as a,unset as s,defineField as d,defineType as l,defineArrayMember as p,useSchema as h,getPublishedId as m,Preview as u,definePlugin as f}from"sanity";import{usePaneRouter as g,structureTool as y}from"sanity/structure";import{useCallback as b,useState as C,useRef as w,useEffect as v,useMemo as _,createContext as I,useContext as x}from"react";import{jsxs as k,jsx as V,Fragment as T}from"react/jsx-runtime";import{isVersionId as S,getVersionNameFromId as N,getVersionId as H,DocumentId as z,getDraftId as L,getPublishedId as $}from"@sanity/id-utils";import{Stack as P,Text as O,useToast as E,Inline as M,Button as A,Card as R,Flex as D,Box as B,Tooltip as Z,Dialog as F,Label as j,Badge as U,TextInput as K,TextArea as q,Spinner as G,Container as W,Grid as Q}from"@sanity/ui";import{InfoOutlineIcon as Y,TrashIcon as J,AddCircleIcon as X,ErrorOutlineIcon as ee,ToggleArrowRightIcon as te,AddIcon as ne,WarningOutlineIcon as ie,EditIcon as re,DocumentsIcon as oe}from"@sanity/icons";import{nanoid as ce}from"nanoid";import{styled as ae,css as se}from"styled-components";import de from"react-fast-compare";import{distinctUntilChanged as le,catchError as pe}from"rxjs/operators";import{RouterContext as he}from"sanity/router";import{AiOutlineTags as me,AiOutlineTag as ue}from"react-icons/ai";const fe=e=>{const{onChange:n}=e,i=E(),r=b(()=>{n(t(ce(6))),i.push({status:"success",title:"Identifier created.",closable:!0})},[n,i]);/* @__PURE__ */
|
|
2
2
|
return V(P,{space:2,children:/* @__PURE__ */V(M,{space:[3,3,4],children:/* @__PURE__ */V(A,{tone:"primary",fontSize:2,onClick:r,text:"Generate Identifier"})})})};var ge=Object.defineProperty,ye=Object.getOwnPropertySymbols,be=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,we=(e,t,n)=>t in e?ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ve=(e,t)=>{for(var n in t||(t={}))be.call(t,n)&&we(e,n,t[n]);if(ye)for(var n of ye(t))Ce.call(t,n)&&we(e,n,t[n]);return e};const _e={tone:"primary"};function Ie(e){const{title:t,description:n,icon:i,tone:r,children:o}=ve(ve({},_e),e);/* @__PURE__ */
|
|
3
|
-
return V(R,{tone:r,padding:4,radius:3,border:!0,children:/* @__PURE__ */k(D,{children:[i?"display icon":null,o||/* @__PURE__ */V(
|
|
3
|
+
return V(R,{tone:r,padding:4,radius:3,border:!0,children:/* @__PURE__ */k(D,{children:[i?"display icon":null,o||/* @__PURE__ */V(B,{flex:1,children:/* @__PURE__ */k(P,{space:4,children:[t?/* @__PURE__ */V(O,{weight:"semibold",children:t}):null,n?/* @__PURE__ */V(O,{size:2,children:n}):null]})})]})})}var xe=Object.defineProperty,ke=Object.getOwnPropertySymbols,Ve=Object.prototype.hasOwnProperty,Te=Object.prototype.propertyIsEnumerable,Se=(e,t,n)=>t in e?xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ne=(e,t)=>{for(var n in t||(t={}))Ve.call(t,n)&&Se(e,n,t[n]);if(ke)for(var n of ke(t))Te.call(t,n)&&Se(e,n,t[n]);return e};ae((e={})=>/* @__PURE__ */V(R,Ne({as:"table"},e)))(()=>se`
|
|
4
4
|
display: table;
|
|
5
5
|
width: 100%;
|
|
6
6
|
border-collapse: collapse;
|
|
@@ -21,56 +21,56 @@ return V(R,{tone:r,padding:4,radius:3,border:!0,children:/* @__PURE__ */k(D,{chi
|
|
|
21
21
|
&:not([hidden]) {
|
|
22
22
|
display: table-cell;
|
|
23
23
|
}
|
|
24
|
-
`);const He={},
|
|
25
|
-
/* @__PURE__ */V(
|
|
24
|
+
`);const He={},ze={apiVersion:"v2023-05-01"};function Le(e){const t=_(()=>JSON.stringify(e||{}),[e]);return _(()=>JSON.parse(t),[t])}function $e(e,{params:t=He,options:i=ze,initialValue:r=null}){const[o,c]=C(!0),[a,s]=C(!1),[d,l]=C(r),p=Le(t),h=Le(i),m=w(null),u=n();return v(()=>{if(e&&!a&&!m.current)try{m.current=u.listenQuery(e,p,h).pipe(le(de),pe(e=>(console.error(e),s(e),c(!1),l(null),e))).subscribe(e=>{l(t=>de(t,e)?t:e),c(!1),s(!1)})}catch(e){console.error(e),c(!1),s(e)}return a&&m.current&&m.current.unsubscribe(),()=>{var e;m.current&&(null==(e=m?.current)||e.unsubscribe(),m.current=null)}},[e,a,p,h,u]),{data:d,loading:o,error:a}}const Pe=I(null),Oe=I({editControls:!1}),Ee=I(void 0),Me=(e=1)=>{let t="^.^.concepts[]._ref",n=1;for(;e>n;)t=`^.${t}`,n++;return e>6?"":`"childConcepts": *[_id in ${t} && ^._id in broader[]._ref]|order(prefLabel)\n {\n "id": _id,\n "level": ${e},\n _originalId,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Me(e+1)||""}\n }`};var Ae,Re=new Uint8Array(16);function De(){if(!Ae&&!(Ae=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ae(Re)}for(var Be=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Ze=[],Fe=0;Fe<256;++Fe)Ze.push((Fe+256).toString(16).substr(1));function je(e,t,n){var i=(e=e||{}).random||(e.rng||De)();return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Ze[e[t+0]]+Ze[e[t+1]]+Ze[e[t+2]]+Ze[e[t+3]]+"-"+Ze[e[t+4]]+Ze[e[t+5]]+"-"+Ze[e[t+6]]+Ze[e[t+7]]+"-"+Ze[e[t+8]]+Ze[e[t+9]]+"-"+Ze[e[t+10]]+Ze[e[t+11]]+Ze[e[t+12]]+Ze[e[t+13]]+Ze[e[t+14]]+Ze[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&Be.test(e)}(n))throw TypeError("Stringified UUID is invalid");return n}(i)}function Ue(e){const t=E(),n=i({apiVersion:"2025-02-19"}),o=function(){const e=x(he),{routerPanesState:t,groupIndex:n}=g();return b(i=>{if(!e||!i)return;const r=[...t];r.splice(n+1,n+1,[{id:i,params:{type:"skosConcept"}}]);const o=e.resolvePathFromState({panes:r});e.navigateUrl({path:o})},[e,t,n])}(),c=e.displayed.baseIri;return b((i,a)=>{const{id:s,_originalId:d=""}=a||{},l=S(e.displayed._id),p=l?N(e.displayed._id):void 0,h=l?H(z(e.displayed._id),p):L(z(e.displayed._id)),m=l?H(z(je()),p):L(z(je())),u={_id:m,_type:"skosConcept",conceptId:`${ce(6)}`,prefLabel:"",baseIri:c,broader:[],related:[]};if(s){const e=r(z(d));u.broader=[{_key:je(),_ref:$(z(s)),_type:"reference",_weak:!e,_strengthenOnPublish:e?void 0:{type:"skosConcept",template:{id:"skosConcept"}}}]}const f={_ref:$(m),_type:"reference",_key:je(),_strengthenOnPublish:{type:"skosConcept",template:{id:"skosConcept"}},_weak:!0};n.transaction().createIfNotExists({...e.displayed,_id:h}).create(u).patch(h,e=>"topConcept"===i?e.setIfMissing({topConcepts:[]}).append("topConcepts",[f]):e.setIfMissing({concepts:[]}).append("concepts",[f])).commit({autoGenerateArrayKeys:!0}).then(e=>{t.push({closable:!0,status:"success",title:"Created new concept"}),o(m)}).catch(e=>{t.push({closable:!0,status:"error",title:"Error creating concept",description:e instanceof Error?e.message:"Unknown error occurred"})})},[e.displayed,n,c,t,o])}function Ke(e){const t=E(),n=i({apiVersion:"2025-02-19"});return b((i,r,o)=>{const c="topConcept"==r?"topConcepts":"concepts",a=S(e.displayed._id),s=a?N(e.displayed._id):void 0,d=a?H(z(e.displayed._id),s):L(z(e.displayed._id));n.transaction().createIfNotExists({...e.displayed,_id:d}).patch(d,e=>e.unset([`${c}[_ref=="${i}"]`])).commit().then(e=>{t.push({closable:!0,status:"success",title:(o?`"${o}"`:"Concept")+" removed from scheme"})}).catch(e=>{t.push({closable:!0,status:"error",title:"Error removing concept",description:e instanceof Error?e.message:"Unknown error occurred"})})},[n,e.displayed,t])}const qe=({title:e,message:t})=>/* @__PURE__ */k(P,{space:2,children:[
|
|
25
|
+
/* @__PURE__ */V(j,{size:1,children:e}),
|
|
26
26
|
/* @__PURE__ */V(O,{size:2,muted:!0,style:{whiteSpace:"pre-wrap"},children:t})]}),Ge=({concept:e})=>{const[t,n]=C(!1),i=b(()=>n(!1),[]),r=b(()=>n(!0),[]);return e&&(e.definition||e.example||e.scopeNote)?/* @__PURE__ */k(T,{children:[
|
|
27
|
-
/* @__PURE__ */V(
|
|
28
|
-
return V(
|
|
29
|
-
return V(
|
|
30
|
-
return V(T,{children:i&&/* @__PURE__ */V(
|
|
27
|
+
/* @__PURE__ */V(Z,{delay:{open:750},content:/* @__PURE__ */V(B,{padding:1,sizing:"content",children:/* @__PURE__ */V(O,{muted:!0,size:1,children:"View concept details"})}),fallbackPlacements:["right","left"],placement:"top",portal:!0,children:/* @__PURE__ */V(A,{icon:Y,mode:"bleed",onClick:r,tone:"default"})}),t&&/* @__PURE__ */V(F,{header:e.prefLabel,id:"dialog-example",onClose:i,zOffset:1e3,width:1,children:/* @__PURE__ */V(B,{padding:4,paddingTop:2,paddingBottom:5,children:/* @__PURE__ */k(P,{space:4,children:[e.definition&&/* @__PURE__ */V(qe,{title:"Definition",message:e.definition}),e.example&&/* @__PURE__ */V(qe,{title:"Examples",message:e.example}),e.scopeNote&&/* @__PURE__ */V(qe,{title:"Scope Notes",message:e.scopeNote})]})})})]}):null};function We({concept:e,topConcept:t=!1,orphan:n=!1}){const i=x(he),{routerPanesState:r,groupIndex:o}=g(),{id:c,prefLabel:a}=e??{},s=a||"[new concept]",d=b(()=>{if(!i||!c)return;const e=[...r];e.splice(o+1,o+1,[{id:c,params:{type:"skosConcept"}}]);const t=i.resolvePathFromState({panes:e});i.navigateUrl({path:t})},[c,i,r,o]);/* @__PURE__ */
|
|
28
|
+
return V(Z,{delay:{open:750},content:/* @__PURE__ */V(B,{padding:1,sizing:"content",children:/* @__PURE__ */V(O,{muted:!0,size:1,children:`View "${a}"`})}),fallbackPlacements:["right","left"],placement:"top",children:/* @__PURE__ */V(A,{mode:"bleed",paddingLeft:0,onClick:d,width:"fill",justify:"flex-start",children:/* @__PURE__ */k(O,{size:2,weight:t?"bold":"regular",textOverflow:"ellipsis",children:[s,(t||n)&&/* @__PURE__ */V(U,{fontSize:0,marginLeft:3,style:{verticalAlign:"middle"},children:t?"top concept":"orphan"})]})})})}const Qe=({action:e,handler:t})=>{const n={add:{message:"Add a child concept below this concept",icon:X,tone:"positive"},remove:{message:"Remove this concept from this scheme",icon:J,tone:"critical"}};/* @__PURE__ */
|
|
29
|
+
return V(Z,{delay:{open:750},content:/* @__PURE__ */V(B,{padding:1,sizing:"content",children:/* @__PURE__ */V(O,{muted:!0,size:1,children:n[e].message})}),fallbackPlacements:["right","left"],placement:"top",children:/* @__PURE__ */V(A,{icon:n[e].icon,mode:"bleed",onClick:t,tone:n[e].tone,"aria-label":"Remove this concept from this scheme"})})};function Ye({concept:e,topConcept:t=!1,orphan:n=!1,selectConcept:i}){const{prefLabel:r,id:o,_originalId:c}=e??{},a=r||"[new concept]",s=b(()=>{i&&i({_ref:o,_type:"reference",_originalId:c})},[o,c,i]);/* @__PURE__ */
|
|
30
|
+
return V(T,{children:i&&/* @__PURE__ */V(Z,{delay:{open:750},content:/* @__PURE__ */V(B,{padding:1,sizing:"content",children:/* @__PURE__ */V(O,{muted:!0,size:1,children:`Select "${r}"`})}),fallbackPlacements:["right","left","bottom"],placement:"top",portal:!0,children:/* @__PURE__ */V(A,{mode:"bleed",paddingLeft:0,onClick:s,width:"fill",justify:"flex-start",children:/* @__PURE__ */k(O,{size:2,weight:t?"bold":"regular",textOverflow:"ellipsis",children:[a,(t||n)&&/* @__PURE__ */V(U,{fontSize:0,marginLeft:3,style:{verticalAlign:"middle"},children:t?"top concept":"orphan"})]})})})})}const Je=({message:e,title:t,type:n})=>{const[i,r]=C(!1),o=b(()=>r(!1),[]),c=b(()=>r(!0),[]);/* @__PURE__ */
|
|
31
31
|
return k(T,{children:[
|
|
32
|
-
/* @__PURE__ */V(
|
|
32
|
+
/* @__PURE__ */V(Z,{delay:{open:750},content:/* @__PURE__ */V(B,{padding:1,sizing:"content",children:/* @__PURE__ */V(O,{muted:!0,size:1,children:t})}),fallbackPlacements:["right","left"],placement:"top",portal:!0,children:/* @__PURE__ */V(A,{icon:"error"==n?ee:Y,mode:"bleed",onClick:c,tone:{info:"default",warn:"caution",error:"critical"}[n]})}),i&&/* @__PURE__ */V(F,{header:t,id:"dialog-example",onClose:o,zOffset:1e3,width:1,children:/* @__PURE__ */V(B,{padding:4,paddingBottom:5,children:/* @__PURE__ */V(O,{children:e})})})]})};function Xe(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&!(typeof document>"u")){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}function et({handler:e,visibility:t}){/* @__PURE__ */
|
|
33
33
|
return V(A,{icon:te,mode:"bleed","aria-expanded":"open"==t,onClick:e,className:"ToggleButton-module_toggleButton__4X-Gs"})}Xe(".ToggleButton-module_toggleButton__4X-Gs[aria-expanded='true'] svg {\n rotate: 90deg;\n}");const tt=({concept:e,selectConcept:t,inputComponent:n=!1})=>{const i=x(Pe)||{},r=x(Ee),{globalVisibility:{treeVisibility:o}={treeVisibility:"open"}}=x(Oe)||{},c=Ue(i),a=Ke(i),s=b(()=>{c("concept",e)},[e,c]),d=b(()=>{a(e.id,"concept",e?.prefLabel)},[e.id,e?.prefLabel,a]),[l,p]=C(o||"open"),h=b(()=>{"open"==l?p("closed"):"closed"==l&&p("open")},[l]);/* @__PURE__ */
|
|
34
|
-
return k(
|
|
34
|
+
return k(B,{className:l,children:[
|
|
35
35
|
/* @__PURE__ */k(D,{align:"center",justify:"space-between",wrap:"nowrap",children:[
|
|
36
|
-
/* @__PURE__ */k(D,{align:"center",gap:0,flex:1,style:{minWidth:0},children:[e?.childConcepts&&e.childConcepts.length>0&&/* @__PURE__ */V(et,{handler:h,visibility:l}),!e?.prefLabel&&/* @__PURE__ */V(
|
|
37
|
-
/* @__PURE__ */V(
|
|
38
|
-
/* @__PURE__ */V(
|
|
36
|
+
/* @__PURE__ */k(D,{align:"center",gap:0,flex:1,style:{minWidth:0},children:[e?.childConcepts&&e.childConcepts.length>0&&/* @__PURE__ */V(et,{handler:h,visibility:l}),!e?.prefLabel&&/* @__PURE__ */V(B,{flex:1,marginLeft:e?.childConcepts&&0!=e.childConcepts.length?0:5,children:/* @__PURE__ */V(We,{concept:e})}),e?.prefLabel&&/* @__PURE__ */V(B,{flex:1,marginLeft:e?.childConcepts&&0!=e.childConcepts.length?0:5,children:n?/* @__PURE__ */V(Ye,{concept:e,selectConcept:t}):/* @__PURE__ */V(We,{concept:e})})]}),n&&/* @__PURE__ */V(Ge,{concept:e}),!n&&"published"!==r&&e?.level&&e.level<5&&/* @__PURE__ */k(M,{children:[
|
|
37
|
+
/* @__PURE__ */V(Qe,{action:"add",handler:s}),
|
|
38
|
+
/* @__PURE__ */V(Qe,{action:"remove",handler:d})]}),!n&&"published"!==r&&0==e.childConcepts?.length&&5==e.level&&/* @__PURE__ */k(M,{children:[
|
|
39
39
|
/* @__PURE__ */V(Je,{type:"warn",title:"Taxonomy Manager structure notice",message:"This concept is at the maximum Taxonomy Manager hierarchy depth of 5 levels. Additional child terms are not shown in the hierarchy tree."}),
|
|
40
|
-
/* @__PURE__ */V(
|
|
41
|
-
/* @__PURE__ */V(Je,{type:"error",title:"Taxonomy Manager structure warning",message:"This concept has unlisted child concepts. The maximum validated hierarchy depth is 5 levels."}),!n&&"published"!==r&&/* @__PURE__ */V(
|
|
42
|
-
/* @__PURE__ */V(
|
|
43
|
-
return k(
|
|
40
|
+
/* @__PURE__ */V(Qe,{action:"remove",handler:d})]}),e?.childConcepts&&e?.childConcepts?.length>0&&5==e.level&&/* @__PURE__ */k(M,{children:[
|
|
41
|
+
/* @__PURE__ */V(Je,{type:"error",title:"Taxonomy Manager structure warning",message:"This concept has unlisted child concepts. The maximum validated hierarchy depth is 5 levels."}),!n&&"published"!==r&&/* @__PURE__ */V(Qe,{action:"remove",handler:d})]})]}),e?.childConcepts&&e.childConcepts.length>0&&e?.level&&e.level<5&&/* @__PURE__ */V(nt,{concepts:e.childConcepts,selectConcept:t,inputComponent:n,childVisibility:l})]})},nt=({concepts:e,inputComponent:t=!1,selectConcept:n,childVisibility:i})=>
|
|
42
|
+
/* @__PURE__ */V(B,{marginLeft:4,marginTop:2,display:"closed"==i?"none":"block",children:/* @__PURE__ */V(P,{space:3,children:e.map(e=>/* @__PURE__ */V(tt,{concept:e,selectConcept:n,inputComponent:t},e.id))})}),it=({concept:e,treeVisibility:t,inputComponent:n,selectConcept:i})=>{const r=x(Pe)||{},o=x(Ee),c=!!r.displayed?.topConcepts?.length&&!n,a=Ue(r),s=Ke(r),[d,l]=C(t),p=b(()=>{"open"==d?l("closed"):"closed"==d&&l("open")},[d]),h=b(()=>{a("concept",e)},[e,a]),m=b(()=>{s(e.id,"concept",e?.prefLabel)},[e.id,e?.prefLabel,s]);/* @__PURE__ */
|
|
43
|
+
return k(B,{className:d,children:[
|
|
44
44
|
/* @__PURE__ */k(D,{align:"center",justify:"space-between",wrap:"nowrap",children:[
|
|
45
|
-
/* @__PURE__ */k(D,{align:"center",gap:0,flex:1,style:{minWidth:0},children:[e?.childConcepts&&e.childConcepts.length>0&&/* @__PURE__ */V(et,{handler:p,visibility:d}),!e?.prefLabel&&/* @__PURE__ */V(
|
|
46
|
-
/* @__PURE__ */V(
|
|
47
|
-
/* @__PURE__ */V(
|
|
45
|
+
/* @__PURE__ */k(D,{align:"center",gap:0,flex:1,style:{minWidth:0},children:[e?.childConcepts&&e.childConcepts.length>0&&/* @__PURE__ */V(et,{handler:p,visibility:d}),!e?.prefLabel&&/* @__PURE__ */V(B,{flex:1,marginLeft:e?.childConcepts&&0!=e.childConcepts.length?0:5,children:/* @__PURE__ */V(We,{concept:e,orphan:c})}),e?.prefLabel&&/* @__PURE__ */V(B,{flex:1,marginLeft:e?.childConcepts&&0!=e.childConcepts.length?0:5,children:n?/* @__PURE__ */V(Ye,{concept:e,selectConcept:i,orphan:c}):/* @__PURE__ */V(We,{concept:e,orphan:c})})]}),n&&/* @__PURE__ */V(Ge,{concept:e}),!n&&"published"!==o&&/* @__PURE__ */k(M,{children:[
|
|
46
|
+
/* @__PURE__ */V(Qe,{action:"add",handler:h}),
|
|
47
|
+
/* @__PURE__ */V(Qe,{action:"remove",handler:m})]})]}),e?.childConcepts&&e.childConcepts.length>0&&/* @__PURE__ */V(nt,{concepts:e.childConcepts,selectConcept:i,inputComponent:n,childVisibility:d})]})},rt=({document:e})=>{const[t,n]=C(!1),[r,o]=C(""),[c,a]=C(""),s=b(()=>n(!1),[]),d=b(()=>n(!0),[]),l=b(e=>{o(e.currentTarget.value)},[]),p=b(e=>{a(e.currentTarget.value)},[]),h=function(){const e=E(),t=i({apiVersion:"2021-10-21"});return b((n,i,r)=>{const o=n.displayed?._id,c=n.displayed?.baseIri,a=n.displayed?.schemeId,s={_id:`drafts.${o}`,_type:"skosConceptScheme",schemeId:a,baseIri:c,title:i,description:r||""};t.createIfNotExists(s).then(t=>r?e.push({closable:!0,status:"success",title:"Title and Description added."}):e.push({closable:!0,status:"success",title:"Title added."})).catch(t=>{e.push({closable:!0,status:"error",title:"There has been an error",description:t.message})})},[t,e])}(),m=b(()=>{h(e,r,c)},[h,c,e,r]);/* @__PURE__ */
|
|
48
48
|
return k("div",{style:{marginTop:"2rem"},children:[
|
|
49
49
|
/* @__PURE__ */V(R,{padding:[3,3,4],radius:2,shadow:1,tone:"primary",children:/* @__PURE__ */k(P,{space:6,children:[
|
|
50
50
|
/* @__PURE__ */k(P,{space:4,children:[
|
|
51
|
-
/* @__PURE__ */V(
|
|
51
|
+
/* @__PURE__ */V(j,{size:4,children:"New Concept Scheme"}),
|
|
52
52
|
/* @__PURE__ */V(O,{size:2,children:'To start using hierarchy view taxonomy builder, first give your concept scheme a name and optional description. You can also use the "Editor" tab to add concepts to the tree manually.'})]}),
|
|
53
|
-
/* @__PURE__ */V(A,{tone:"primary",fontSize:2,icon:ne,onClick:d,text:"Add Title"})]})}),t&&/* @__PURE__ */V(
|
|
53
|
+
/* @__PURE__ */V(A,{tone:"primary",fontSize:2,icon:ne,onClick:d,text:"Add Title"})]})}),t&&/* @__PURE__ */V(F,{header:"Title & Description",id:"title-description",onClose:s,zOffset:1e3,width:1,children:/* @__PURE__ */V(B,{padding:4,children:/* @__PURE__ */k(P,{space:4,children:[
|
|
54
54
|
/* @__PURE__ */k(P,{space:2,children:[
|
|
55
|
-
/* @__PURE__ */V(
|
|
55
|
+
/* @__PURE__ */V(j,{size:1,children:"Title"}),
|
|
56
56
|
/* @__PURE__ */V(O,{size:1,muted:!0,children:"Describe the concept scheme in one or two words."})]}),
|
|
57
57
|
/* @__PURE__ */V(K,{fontSize:2,onChange:l,padding:3,placeholder:"",value:r}),
|
|
58
58
|
/* @__PURE__ */k(P,{space:2,children:[
|
|
59
|
-
/* @__PURE__ */V(
|
|
59
|
+
/* @__PURE__ */V(j,{size:1,children:"Description (optional)"}),
|
|
60
60
|
/* @__PURE__ */V(O,{size:1,muted:!0,children:"Describe the intended use of this concept scheme."})]}),
|
|
61
61
|
/* @__PURE__ */V(q,{fontSize:2,onChange:p,padding:3,placeholder:"",value:c,rows:3}),
|
|
62
62
|
/* @__PURE__ */V(A,{tone:"primary",fontSize:2,onClick:m,text:"Save"})]})})})]})},ot=()=>/* @__PURE__ */V("div",{style:{marginTop:"2rem"},children:/* @__PURE__ */V(R,{padding:[3,3,4],radius:2,shadow:1,tone:"primary",children:/* @__PURE__ */k(P,{space:4,children:[
|
|
63
|
-
/* @__PURE__ */V(
|
|
63
|
+
/* @__PURE__ */V(j,{size:4,children:"No Concepts"}),
|
|
64
64
|
/* @__PURE__ */V(O,{size:2,children:"There are not yet any concepts assigned to this scheme. To create a multi-level hierarchy with specific entry points, create Top Concepts first, then add child concepts to them. To create a flat list of concepts, create Concepts directly."})]})})}),ct=({concept:e,treeVisibility:t,inputComponent:n,selectConcept:i})=>{const r=x(Pe)||{},o=x(Ee),c=Ue(r),a=Ke(r),[s,d]=C(t),l=b(()=>{"open"==s?d("closed"):"closed"==s&&d("open")},[s]),p=b(()=>{c("concept",e)},[e,c]),h=b(()=>{a(e?.id,"topConcept",e?.prefLabel)},[e?.id,e?.prefLabel,a]);/* @__PURE__ */
|
|
65
|
-
return k(
|
|
65
|
+
return k(B,{className:s,children:[
|
|
66
66
|
/* @__PURE__ */k(D,{align:"center",justify:"space-between",wrap:"nowrap",children:[
|
|
67
|
-
/* @__PURE__ */k(D,{align:"center",gap:0,flex:1,style:{minWidth:0},children:[e?.childConcepts&&e.childConcepts.length>0&&/* @__PURE__ */V(et,{handler:l,visibility:s}),!e?.prefLabel&&/* @__PURE__ */V(
|
|
68
|
-
/* @__PURE__ */V(
|
|
69
|
-
/* @__PURE__ */V(
|
|
67
|
+
/* @__PURE__ */k(D,{align:"center",gap:0,flex:1,style:{minWidth:0},children:[e?.childConcepts&&e.childConcepts.length>0&&/* @__PURE__ */V(et,{handler:l,visibility:s}),!e?.prefLabel&&/* @__PURE__ */V(B,{flex:1,marginLeft:e?.childConcepts&&0!=e.childConcepts.length?0:5,children:/* @__PURE__ */V(We,{concept:e,topConcept:!0})}),e?.prefLabel&&/* @__PURE__ */V(B,{flex:1,marginLeft:e?.childConcepts&&0!=e.childConcepts.length?0:5,children:n?/* @__PURE__ */V(Ye,{concept:e,selectConcept:i,topConcept:!0}):/* @__PURE__ */V(We,{concept:e,topConcept:!0})})]}),n&&/* @__PURE__ */V(Ge,{concept:e}),!n&&"published"!==o&&/* @__PURE__ */k(M,{children:[
|
|
68
|
+
/* @__PURE__ */V(Qe,{action:"add",handler:p}),
|
|
69
|
+
/* @__PURE__ */V(Qe,{action:"remove",handler:h})]})]}),e?.childConcepts&&e.childConcepts.length>0&&/* @__PURE__ */V(nt,{concepts:e.childConcepts,selectConcept:i,inputComponent:n,childVisibility:s})]})},at=({concepts:e,inputComponent:t,selectConcept:n})=>{const{globalVisibility:{treeId:i,treeVisibility:r}={treeId:123,treeVisibility:"open"}}=x(Oe)||{};return e?.topConcepts?.length||e?.concepts?.length?/* @__PURE__ */V(B,{paddingTop:4,children:/* @__PURE__ */k(P,{space:3,style:{listStyle:"none",paddingLeft:"0",marginBlockStart:"0"},children:[e.topConcepts?.map(e=>/* @__PURE__ */V(ct,{concept:e,treeVisibility:r,inputComponent:t,selectConcept:n},`${e?.id}+${i}`)),e.concepts?.filter(e=>e?.isOrphan).map(e=>/* @__PURE__ */V(it,{concept:e,treeVisibility:r,inputComponent:t,selectConcept:n},`${e.id}+${i}`))]})}):/* @__PURE__ */V(ot,{})},st=({branchId:e="",selectConcept:t,inputComponent:n,expanded:i})=>{const r=x(Pe)||{},o=$(r.displayed?._id),c=x(Ee),a=i?"open":"closed",{data:s,loading:d,error:l}=$e({fetch:`\n select($branchId != null => \n *[_id == $id][0] {\n _updatedAt,\n "concepts": concepts[$branchId in @->broader[]->.conceptId]->|order(prefLabel) {\n "id": _id,\n "level": 0,\n "isOrphan": true,\n _originalId,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Me()||""}\n }\n },\n *[_id == $id][0] {\n _updatedAt,\n "topConcepts":topConcepts[]->|order(prefLabel){\n "id": _id,\n "level": 0,\n _originalId,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Me()||""}\n }, \n "concepts": concepts[]->|order(prefLabel){\n "id": _id,\n "level": 0,\n "isOrphan": \n coalesce(\n !array::intersects(\n broader[]._ref, (\n coalesce(^.concepts[]._ref, []) + coalesce(^.topConcepts[]._ref, [])\n )\n ), \n true),\n _originalId,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Me()||""}\n }\n }\n )`,listen:'*[_type == "skosConcept" || _id == $id]'},{params:{id:o,branchId:e},options:{perspective:void 0===c?"drafts":[c]}});return d?/* @__PURE__ */V(B,{padding:5,children:/* @__PURE__ */k(D,{align:"center",direction:"column",gap:5,height:"fill",justify:"center",style:{paddingTop:"1rem"},children:[
|
|
70
70
|
/* @__PURE__ */V(G,{muted:!0}),
|
|
71
|
-
/* @__PURE__ */V(O,{muted:!0,size:1,children:"Loading hierarchy…"})]})}):l?(console.warn(l),/* @__PURE__ */V(
|
|
71
|
+
/* @__PURE__ */V(O,{muted:!0,size:1,children:"Loading hierarchy…"})]})}):l?(console.warn(l),/* @__PURE__ */V(B,{padding:4,children:/* @__PURE__ */V(R,{padding:[3],radius:2,shadow:1,tone:"caution",children:/* @__PURE__ */V(O,{size:1,children:"There was a problem loading terms. Please check the scheme configuration and try again."})})})):s?/* @__PURE__ */V(Oe.Provider,{value:{globalVisibility:{treeId:"123",treeVisibility:a}},children:/* @__PURE__ */V(B,{padding:4,paddingTop:0,children:/* @__PURE__ */V(at,{concepts:s,inputComponent:n||!1,selectConcept:t||(()=>{})})})}):/* @__PURE__ */V(B,{padding:4,children:/* @__PURE__ */V(R,{padding:[3],radius:2,shadow:1,tone:"caution",children:/* @__PURE__ */V(O,{size:1,children:"This configuration does not have any terms associated with it. Please check the scheme and branch supplied and try again."})})})},dt=({inputComponent:e=!1,branchId:t="",selectConcept:n})=>{const i=x(Pe)||{},r=$(i.displayed?._id),o=x(Ee),c=Ue(i),a=b(()=>{c("topConcept")},[c]),s=b(()=>{c("concept")},[c]),[d,l]=C({treeId:ce(6),treeVisibility:"open"}),p=b(()=>{l({treeId:ce(6),treeVisibility:"open"})},[]),h=b(()=>{l({treeId:ce(6),treeVisibility:"closed"})},[]),{data:m,loading:u,error:f}=$e({fetch:`*[_id == $id][0] {\n _updatedAt,\n "topConcepts": topConcepts[]->|order(prefLabel) {\n "id": _id,\n "level": 0,\n _originalId,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Me()||""}\n },\n "concepts": concepts[]->|order(prefLabel) {\n "id": _id,\n "level": 0,\n "isOrphan": \n coalesce(\n !array::intersects(\n broader[]._ref, (\n coalesce(^.concepts[]._ref, []) + coalesce(^.topConcepts[]._ref, [])\n )\n ),\n true),\n _originalId,\n prefLabel,\n definition,\n example,\n scopeNote,\n ${Me()||""}\n }\n }`,listen:'*[_type == "skosConcept" || _type == "skosConceptScheme" ]'},{params:{id:r,branchId:t},options:{perspective:void 0===o?"drafts":[o]}});return u?/* @__PURE__ */V(B,{padding:4,paddingTop:6,children:/* @__PURE__ */k(D,{align:"center",direction:"column",gap:5,height:"fill",justify:"center",children:[
|
|
72
72
|
/* @__PURE__ */V(G,{muted:!0}),
|
|
73
|
-
/* @__PURE__ */V(O,{muted:!0,size:1,children:"Loading hierarchy…"})]})}):f?(console.error(f),/* @__PURE__ */V("div",{children:"Error here"})):m?/* @__PURE__ */V(Oe.Provider,{value:{globalVisibility:d},children:/* @__PURE__ */V(
|
|
73
|
+
/* @__PURE__ */V(O,{muted:!0,size:1,children:"Loading hierarchy…"})]})}):f?(console.error(f),/* @__PURE__ */V("div",{children:"Error here"})):m?/* @__PURE__ */V(Oe.Provider,{value:{globalVisibility:d},children:/* @__PURE__ */V(B,{padding:4,children:/* @__PURE__ */k(T,{children:[
|
|
74
74
|
/* @__PURE__ */V(P,{space:4,children:/* @__PURE__ */V(R,{borderBottom:!0,paddingBottom:1,display:"flex",flex:1,children:/* @__PURE__ */k(D,{justify:"space-between",flex:1,children:[
|
|
75
75
|
/* @__PURE__ */V(R,{children:(m.topConcepts?.filter(e=>(e?.childConcepts?.length??0)>0).length>0||m.concepts?.filter(e=>(e?.childConcepts?.length??0)>0).length>0)&&/* @__PURE__ */k(M,{space:1,children:[
|
|
76
76
|
/* @__PURE__ */V(A,{text:"Collapse",paddingY:2,mode:"bleed",onClick:h}),
|
|
@@ -80,36 +80,36 @@ return k(Z,{className:s,children:[
|
|
|
80
80
|
/* @__PURE__ */V(A,{text:"Add Top Concept",icon:X,mode:"bleed",tone:"positive",paddingY:2,onClick:a}),
|
|
81
81
|
/* @__PURE__ */V(A,{text:"Add Concept",icon:X,mode:"bleed",tone:"positive",paddingY:2,onClick:s})]})})]})})}),
|
|
82
82
|
/* @__PURE__ */V(at,{concepts:m,inputComponent:e,selectConcept:n||(()=>{})})]})})}):/* @__PURE__ */V(rt,{document:i})},lt=({document:e,branchId:t,inputComponent:n=!1,selectConcept:i,expanded:r})=>{const{selectedPerspectiveName:c}=o();/* @__PURE__ */
|
|
83
|
-
return V(Pe.Provider,{value:e||{},children:/* @__PURE__ */V(Ee.Provider,{value:c,children:n?/* @__PURE__ */V(st,{inputComponent:n,branchId:t,selectConcept:i,expanded:r}):/* @__PURE__ */k(W,{width:1,children:[e?.displayed?.description&&/* @__PURE__ */V(
|
|
83
|
+
return V(Pe.Provider,{value:e||{},children:/* @__PURE__ */V(Ee.Provider,{value:c,children:n?/* @__PURE__ */V(st,{inputComponent:n,branchId:t,selectConcept:i,expanded:r}):/* @__PURE__ */k(W,{width:1,children:[e?.displayed?.description&&/* @__PURE__ */V(B,{padding:4,paddingTop:6,children:/* @__PURE__ */V(P,{space:4,children:/* @__PURE__ */k(P,{space:2,children:[
|
|
84
84
|
/* @__PURE__ */V(O,{size:1,weight:"semibold",children:"Description"}),
|
|
85
85
|
/* @__PURE__ */V(O,{size:2,muted:!0,children:e?.displayed.description})]})})}),
|
|
86
|
-
/* @__PURE__ */V(dt,{inputComponent:n,branchId:t})]})})})};function pt(t){const n=i({apiVersion:"2025-02-19"}),r=e(["_id"]),{name:a,title:s}=t,d=S(r),l=c(r),{selectedPerspectiveName:p}=o(),[h,m]=C(!0),[u,f]=C(!0),[g,y]=C(!1),[w,_]=C({}),[I,x]=C(),{schemeId:T,branchId:N=null}=I?.params||{},{filter:H}=t.schemaType.options;v(()=>{(async function(){try{const e=await H({getClient:()=>n});x(e),f(!1)}catch(e){console.error("Error fetching filter values: ",e)}})().catch(e=>console.error("Error fetching filter values: ",e))},[H,n]),v(()=>{T&&n.fetch(`{"displayed": *[schemeId == "${T}"][0]}`).then(e=>{e?.displayed&&(_(e),m(!1))}).catch(e=>console.warn(e))},[n,T]);const
|
|
87
|
-
/* @__PURE__ */V(
|
|
86
|
+
/* @__PURE__ */V(dt,{inputComponent:n,branchId:t})]})})})};function pt(t){const n=i({apiVersion:"2025-02-19"}),r=e(["_id"]),{name:a,title:s}=t,d=S(r),l=c(r),{selectedPerspectiveName:p}=o(),[h,m]=C(!0),[u,f]=C(!0),[g,y]=C(!1),[w,_]=C({}),[I,x]=C(),{schemeId:T,branchId:N=null}=I?.params||{},{filter:H}=t.schemaType.options;v(()=>{(async function(){try{const e=await H({getClient:()=>n});x(e),f(!1)}catch(e){console.error("Error fetching filter values: ",e)}})().catch(e=>console.error("Error fetching filter values: ",e))},[H,n]),v(()=>{T&&n.fetch(`{"displayed": *[schemeId == "${T}"][0]}`).then(e=>{e?.displayed&&(_(e),m(!1))}).catch(e=>console.warn(e))},[n,T]);const z=b(()=>{y(!0)},[]),L=b(()=>{y(!1)},[]),$=b(e=>{(c(e?._originalId)||S(e?._originalId))&&(e._strengthenOnPublish={type:"skosConcept",template:{id:"skosConcept"}},e._weak=!0),delete e._originalId,l||d?n.patch(r).set({[a]:e}).commit().then(()=>y(!1)).catch(e=>console.error(e)):n.fetch(`*[_id == "${r}"][0]`).then(t=>{t._id=`drafts.${t._id}`,t[a]=e,n.create(t).catch(e=>console.error("Error creating draft: ",e))}).then(()=>y(!1)).catch(e=>console.error(e))},[n,r,l,d,a]);return t.schemaType.options?.filter?0===t.schemaType.options?.filter.length?/* @__PURE__ */k(P,{space:3,children:[t.renderDefault(t),
|
|
87
|
+
/* @__PURE__ */V(B,{padding:4,children:/* @__PURE__ */V(R,{padding:[3],radius:2,shadow:1,tone:"caution",children:/* @__PURE__ */k(O,{size:1,children:["There was a problem loading your filter settings. Please check the"," ",
|
|
88
88
|
/* @__PURE__ */V("code",{children:"schemeFilter()"})," or ",
|
|
89
|
-
/* @__PURE__ */V("code",{children:"branchFilter()"})," configuration for the"," ",s," field."]})})})]}):h||u?/* @__PURE__ */V(
|
|
89
|
+
/* @__PURE__ */V("code",{children:"branchFilter()"})," configuration for the"," ",s," field."]})})})]}):h||u?/* @__PURE__ */V(B,{padding:5,children:/* @__PURE__ */k(D,{align:"center",direction:"column",gap:5,height:"fill",justify:"center",style:{paddingTop:"1rem"},children:[
|
|
90
90
|
/* @__PURE__ */V(G,{muted:!0}),
|
|
91
91
|
/* @__PURE__ */V(O,{muted:!0,size:1,children:"Loading input component…"})]})}):/* @__PURE__ */k(P,{space:3,children:[t.renderDefault(t),
|
|
92
|
-
/* @__PURE__ */V(
|
|
93
|
-
/* @__PURE__ */V(
|
|
92
|
+
/* @__PURE__ */V(Q,{columns:1,gap:3,children:/* @__PURE__ */V(A,{disabled:"published"===p,text:"Browse Taxonomy Tree",mode:"ghost",onClick:z})}),g&&/* @__PURE__ */V(F,{header:s,id:"concept-select-dialog",onClose:L,zOffset:900,width:1,children:/* @__PURE__ */V(B,{padding:10,children:/* @__PURE__ */V(lt,{document:w,branchId:N,inputComponent:!0,selectConcept:$,expanded:I?.expanded})})})]}):/* @__PURE__ */k(P,{space:3,children:[t.renderDefault(t),
|
|
93
|
+
/* @__PURE__ */V(B,{padding:4,children:/* @__PURE__ */V(R,{padding:[3],radius:2,shadow:1,tone:"caution",children:/* @__PURE__ */k(O,{size:1,children:["The ",
|
|
94
94
|
/* @__PURE__ */V("code",{children:"ReferenceHierarchyInput()"})," component must be used with an accompanying"," ",
|
|
95
95
|
/* @__PURE__ */V("code",{children:"schemeFilter()"})," or ",
|
|
96
|
-
/* @__PURE__ */V("code",{children:"branchFilter()"}),". Please add an appropriate filter to the configuration for the ",s," field."]})})})]})}function ht(t){const n=i({apiVersion:"2025-02-19"}),r=e(["_id"]),{name:s,title:d,value:l=[]}=t,p=a(r),h=c(r),{selectedPerspectiveName:m}=o(),[u,f]=C(!0),[g,y]=C(!0),[w,_]=C(!1),[I,x]=C({}),[T,S]=C(),{schemeId:N,branchId:H=null}=T?.params||{},{filter:
|
|
97
|
-
/* @__PURE__ */V(
|
|
96
|
+
/* @__PURE__ */V("code",{children:"branchFilter()"}),". Please add an appropriate filter to the configuration for the ",s," field."]})})})]})}function ht(t){const n=i({apiVersion:"2025-02-19"}),r=e(["_id"]),{name:s,title:d,value:l=[]}=t,p=a(r),h=c(r),{selectedPerspectiveName:m}=o(),[u,f]=C(!0),[g,y]=C(!0),[w,_]=C(!1),[I,x]=C({}),[T,S]=C(),{schemeId:N,branchId:H=null}=T?.params||{},{filter:z}=t.schemaType.of[0].options,L=E();v(()=>{(async function(){try{const e=await z({getClient:()=>n});S(e),y(!1)}catch(e){console.error("Error fetching filter values: ",e)}})().catch(e=>console.error("Error fetching filter values: ",e))},[z,n]),v(()=>{N&&n.fetch(`{"displayed": *[schemeId == "${N}"][0]}`).then(e=>{e?.displayed&&(x(e),f(!1))}).catch(e=>console.warn(e))},[n,N]);const $=b(()=>{_(!0)},[]),M=b(()=>{_(!1)},[]),Z=b(e=>{if((c(e?._originalId)||a(e?._originalId))&&(e._strengthenOnPublish={type:"skosConcept",template:{id:"skosConcept"}},e._weak=!0),delete e._originalId,l?.map(e=>e._ref).includes(e._ref))return _(!1),void L.push({status:"warning",title:"Taxonomy Term Not Added",description:"The selected concept is already included in this field.",duration:5e3,closable:!0});h||p?n.patch(r).setIfMissing({[s]:[]}).append(s,[e]).commit({autoGenerateArrayKeys:!0}).then(()=>_(!1)).catch(e=>console.error(e)):n.fetch(`*[_id == "${r}"][0]`).then(e=>{e._id=`drafts.${e._id}`,n.create(e).catch(e=>console.error("Error creating draft: ",e))}).then(()=>{n.patch(`drafts.${r}`).setIfMissing({[s]:[]}).append(s,[e]).commit({autoGenerateArrayKeys:!0}).then(()=>_(!1)).catch(e=>console.error(e))}).catch(e=>console.error(e))},[l,h,p,n,r,L,s]);return t.schemaType.of[0].options?.filter?0===t.schemaType.of[0].options?.filter?.length?/* @__PURE__ */k(P,{space:3,children:[t.renderDefault(t),
|
|
97
|
+
/* @__PURE__ */V(B,{padding:4,children:/* @__PURE__ */V(R,{padding:[3],radius:2,shadow:1,tone:"caution",children:/* @__PURE__ */k(O,{size:1,children:["There was a problem loading your filter settings. Please check the"," ",
|
|
98
98
|
/* @__PURE__ */V("code",{children:"schemeFilter()"})," or ",
|
|
99
99
|
/* @__PURE__ */V("code",{children:"branchFilter()"})," configuration for the"," ",d," field."]})})})]}):t.schemaType.of.length>1?/* @__PURE__ */k(P,{space:3,children:[t.renderDefault(t),
|
|
100
100
|
/* @__PURE__ */V(R,{padding:[3],radius:2,shadow:1,tone:"caution",children:/* @__PURE__ */V(P,{space:4,children:/* @__PURE__ */k(P,{space:2,children:[
|
|
101
|
-
/* @__PURE__ */V(
|
|
101
|
+
/* @__PURE__ */V(j,{size:2,children:"Input Component Not Supported for Multi-Schema Arrays"}),
|
|
102
102
|
/* @__PURE__ */k(O,{size:1,children:["The Sanity Taxonomy Manager Hierarchy Input Component is not designed to support array inputs with more than one schema type. Please see the"," ",
|
|
103
|
-
/* @__PURE__ */V("a",{href:"https://sanitytaxonomymanager.com",children:"Taxonomy Manager docs"})," for more information."]})]})})})]}):u||g?/* @__PURE__ */V(
|
|
103
|
+
/* @__PURE__ */V("a",{href:"https://sanitytaxonomymanager.com",children:"Taxonomy Manager docs"})," for more information."]})]})})})]}):u||g?/* @__PURE__ */V(B,{padding:5,children:/* @__PURE__ */k(D,{align:"center",direction:"column",gap:5,height:"fill",justify:"center",style:{paddingTop:"1rem"},children:[
|
|
104
104
|
/* @__PURE__ */V(G,{muted:!0}),
|
|
105
105
|
/* @__PURE__ */V(O,{muted:!0,size:1,children:"Loading input component…"})]})}):/* @__PURE__ */k(P,{space:3,children:[t.renderDefault(t),
|
|
106
|
-
/* @__PURE__ */V(
|
|
107
|
-
/* @__PURE__ */V(
|
|
106
|
+
/* @__PURE__ */V(Q,{columns:1,gap:3,children:/* @__PURE__ */V(A,{disabled:"published"===m,text:"Browse Taxonomy Tree",mode:"ghost",onClick:$})}),w&&/* @__PURE__ */V(F,{header:d,id:"concept-select-dialog",onClose:M,zOffset:900,width:1,children:/* @__PURE__ */V(B,{children:/* @__PURE__ */V(lt,{document:I,branchId:H,inputComponent:!0,selectConcept:Z,expanded:T?.expanded})})})]}):/* @__PURE__ */k(P,{space:3,children:[t.renderDefault(t),
|
|
107
|
+
/* @__PURE__ */V(B,{padding:4,children:/* @__PURE__ */V(R,{padding:[3],radius:2,shadow:1,tone:"caution",children:/* @__PURE__ */k(O,{size:1,children:["The ",
|
|
108
108
|
/* @__PURE__ */V("code",{children:"ArrayHierarchyInput()"})," component must be used with an accompanying"," ",
|
|
109
109
|
/* @__PURE__ */V("code",{children:"schemeFilter()"})," or ",
|
|
110
110
|
/* @__PURE__ */V("code",{children:"branchFilter()"}),". Please add an appropriate filter to the configuration for the ",d," field."]})})})]})}const mt=e=>{const{onChange:t}=e,n=E(),i=b(()=>{t(s()),n.push({status:"success",title:"Value removed.",duration:2500,closable:!0})},[t,n]);/* @__PURE__ */
|
|
111
111
|
return V(P,{space:2,children:/* @__PURE__ */k(M,{space:[3,3,4],children:[e.renderDefault(e),
|
|
112
|
-
/* @__PURE__ */V(A,{tone:"primary",fontSize:2,onClick:i,text:"Remove Value"})]})})},ut=e=>{const{schemeId:t}=e||{};if(!t||"string"!=typeof t)throw new Error("Invalid or missing schemeId: scheme Id must be a string");return async n=>{const i=n?.getClient({apiVersion:"2025-02-19"});if(!i)throw new Error("Client not available");const{concepts:r,topConcepts:o}=await i.fetch(`{\n "concepts": *[_type=="skosConceptScheme" && schemeId == "${t}"].concepts[]._ref,\n "topConcepts": *[_type=="skosConceptScheme" && schemeId == "${t}"].topConcepts[]._ref\n }`);return{filter:"(_id in $concepts\n || _id in $topConcepts)",params:{concepts:r,topConcepts:o,schemeId:t},expanded:e?.expanded}}},ft=e=>{const{schemeId:t,branchId:n=null}=e||{};if(!t||"string"!=typeof t)throw new Error("Invalid or missing schemeId: scheme Id must be a string");if(!n||"string"!=typeof n)throw new Error("Invalid or missing branchId: branch Id must be a string");return async i=>{const r=i?.getClient({apiVersion:"2023-01-01"});if(!r)throw new Error("Client not available");const{concepts:o}=await r.fetch('{ \n "concepts": *[\n _id in *[_type=="skosConceptScheme" && schemeId == $schemeId].concepts[]._ref\n && ($branchId in broader[]->conceptId\n || $branchId in broader[]->broader[]->conceptId\n || $branchId in broader[]->broader[]->broader[]->conceptId\n || $branchId in broader[]->broader[]->broader[]->broader[]->conceptId\n || $branchId in broader[]->broader[]->broader[]->broader[]->broader[]->conceptId)\n ]._id\n }',{schemeId:t,branchId:n});return{filter:"_id in $concepts",params:{concepts:o,schemeId:t,branchId:n},expanded:e?.expanded}}};Xe("details.baseIriField-module_description__Ac-QT
|
|
112
|
+
/* @__PURE__ */V(A,{tone:"primary",fontSize:2,onClick:i,text:"Remove Value"})]})})},ut=e=>{const{schemeId:t}=e||{};if(!t||"string"!=typeof t)throw new Error("Invalid or missing schemeId: scheme Id must be a string");return async n=>{const i=n?.getClient({apiVersion:"2025-02-19"});if(!i)throw new Error("Client not available");const{concepts:r,topConcepts:o}=await i.fetch(`{\n "concepts": *[_type=="skosConceptScheme" && schemeId == "${t}"].concepts[]._ref,\n "topConcepts": *[_type=="skosConceptScheme" && schemeId == "${t}"].topConcepts[]._ref\n }`);return{filter:"(_id in $concepts\n || _id in $topConcepts)",params:{concepts:r,topConcepts:o,schemeId:t},expanded:e?.expanded}}},ft=e=>{const{schemeId:t,branchId:n=null}=e||{};if(!t||"string"!=typeof t)throw new Error("Invalid or missing schemeId: scheme Id must be a string");if(!n||"string"!=typeof n)throw new Error("Invalid or missing branchId: branch Id must be a string");return async i=>{const r=i?.getClient({apiVersion:"2023-01-01"});if(!r)throw new Error("Client not available");const{concepts:o}=await r.fetch('{ \n "concepts": *[\n _id in *[_type=="skosConceptScheme" && schemeId == $schemeId].concepts[]._ref\n && ($branchId in broader[]->conceptId\n || $branchId in broader[]->broader[]->conceptId\n || $branchId in broader[]->broader[]->broader[]->conceptId\n || $branchId in broader[]->broader[]->broader[]->broader[]->conceptId\n || $branchId in broader[]->broader[]->broader[]->broader[]->broader[]->conceptId)\n ]._id\n }',{schemeId:t,branchId:n});return{filter:"_id in $concepts",params:{concepts:o,schemeId:t,branchId:n},expanded:e?.expanded}}};Xe("details.baseIriField-module_description__Ac-QT summary {\n cursor: pointer;\n}\ndetails.baseIriField-module_description__Ac-QT div {\n margin-top: 0.5rem;\n margin-left: 0.75rem;\n}\ndetails.baseIriField-module_description__Ac-QT div svg {\n padding-right: 0.25rem;\n}\n");var gt=[d({name:"baseIri",title:"Base URI",type:"url",validation:e=>e.required().error("Please supply a base URI in the format 'http://example.com/'"),description:/* @__PURE__ */k("details",{className:"baseIriField-module_description__Ac-QT",children:[
|
|
113
113
|
/* @__PURE__ */V("summary",{children:"The root URI (Uniform Resource Identifier) used to create unique concept identifiers."}),
|
|
114
114
|
/* @__PURE__ */k("div",{children:["Unique identifiers allow for the clear an unambiguous identification of concepts across namespaces, for example between ",
|
|
115
115
|
/* @__PURE__ */V("code",{children:"https://shipparts.com/vocab#Bow"})," and ",
|
|
@@ -118,7 +118,7 @@ return V(P,{space:2,children:/* @__PURE__ */k(M,{space:[3,3,4],children:[e.rende
|
|
|
118
118
|
/* @__PURE__ */V("div",{children:"For new Concepts and Concept Schemes, the Base URI field is pre-populated based on the most recently used Base URI value."})]}),components:{input:function(t){const n=e(["conceptId"]),i=e(["schemeId"]);/* @__PURE__ */
|
|
119
119
|
return k(P,{space:2,children:[t.renderDefault(t),
|
|
120
120
|
/* @__PURE__ */V(O,{muted:!0,size:1,children:/* @__PURE__ */k(T,{children:[
|
|
121
|
-
/* @__PURE__ */V("strong",{children:"RDF URI: "}),t.value?t.value:"[base URI not defined] ",n||i||" [identifier not assigned]"]})})]})}}})],yt="skosConcept-module_description__B9ciz";Xe("details.skosConcept-module_description__B9ciz
|
|
121
|
+
/* @__PURE__ */V("strong",{children:"RDF URI: "}),t.value?t.value:"[base URI not defined] ",n||i||" [identifier not assigned]"]})})]})}}})],yt="skosConcept-module_description__B9ciz";Xe("details.skosConcept-module_description__B9ciz summary {\n cursor: pointer;\n}\ndetails.skosConcept-module_description__B9ciz div {\n margin-top: 0.5rem;\n margin-left: 0.75rem;\n}\ndetails.skosConcept-module_description__B9ciz div svg {\n padding-right: 0.25rem;\n}");const bt=({document:e})=>({filter:"!(_id in $broader || _id in $related || _id == $self)",params:{self:$(z(e._id)),broader:Array.isArray(e?.broader)?e.broader.map(({_ref:e})=>e):[],related:Array.isArray(e?.related)?e.related.map(({_ref:e})=>e):[]}});function Ct(e,t=[]){return l({name:"skosConcept",title:"Concept",type:"document",icon:me,initialValue:async(t,n)=>{if(e)return{baseIri:e,broader:[],related:[]};const{getClient:i}=n;return{baseIri:await i({apiVersion:"2021-03-25"}).fetch("\n *[(_type == 'skosConcept' || _type == 'skosConceptScheme') && defined(baseIri)]| order(_createdAt desc)[0].baseIri\n ")??void 0,broader:[],related:[]}},fields:[d({name:"prefLabel",title:"Preferred Label",type:"string",description:"The preferred lexical label for this concept.",validation:e=>e.required().custom((e,t)=>{const{getClient:n}=t;return n({apiVersion:"2025-06-10"}).withConfig({perspective:"raw"}).fetch(`*[_type == "skosConcept" && prefLabel == "${e}" && !(_id in path("drafts.**") || _id in path("versions.**"))][0]._id`).then(e=>!(e&&!t.document?._id.includes(e))||"Preferred Label must be unique.")})}),d({name:"definition",title:"Definition",type:"text",description:/* @__PURE__ */k("details",{className:yt,children:[
|
|
122
122
|
/* @__PURE__ */V("summary",{children:"A complete explanation of the intended meaning of the concept."}),
|
|
123
123
|
/* @__PURE__ */k("div",{children:[
|
|
124
124
|
/* @__PURE__ */k("kbd",{children:["Example: documentation",
|
|
@@ -167,8 +167,8 @@ return k(P,{space:2,children:[t.renderDefault(t),
|
|
|
167
167
|
/* @__PURE__ */V("br",{}),"Change Note: \"Moved from under 'fruits' to under 'vegetables' by Horace Gray\""]}),
|
|
168
168
|
/* @__PURE__ */k("p",{children:["For more information on the recommended usage of the SKOS documentation properties, see",
|
|
169
169
|
/* @__PURE__ */k("a",{href:"https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation",target:"_blank",rel:"noreferrer",children:[" ","W3C SKOS Primer: 2.4 Documentary Notes"]})]})]})]}),rows:3})],orderings:[{title:"Top Concepts",name:"topConcept",by:[{field:"topConcept",direction:"desc"},{field:"prefLabel",direction:"asc"}]},{title:"Preferred Label",name:"prefLabel",by:[{field:"prefLabel",direction:"asc"}]}],preview:{select:{title:"prefLabel"},prepare:({title:e})=>({title:e,media:ue})}})}function wt(){/* @__PURE__ */
|
|
170
|
-
return V("svg",{"data-sanity-icon":!0,width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:/* @__PURE__ */V("path",{d:"M5.5 6.5V5.9H4.9V6.5H5.5ZM11.5 6.5H12.1V5.9H11.5V6.5ZM5.5 9H4.9V9.6H5.5V9ZM11.5 9V9.6H12.1V9H11.5ZM13.5 11V10.4H12.9V11H13.5ZM19.5 11H20.1V10.4H19.5V11ZM13.5 13.5H12.9V14.1H13.5V13.5ZM19.5 13.5V14.1H20.1V13.5H19.5ZM13.5 16V15.4H12.9V16H13.5ZM19.5 16H20.1V15.4H19.5V16ZM13.5 18.5H12.9V19.1H13.5V18.5ZM19.5 18.5V19.1H20.1V18.5H19.5ZM5.5 7.1H11.5V5.9H5.5V7.1ZM6.1 9V6.5H4.9V9H6.1ZM11.5 8.4H5.5V9.6H11.5V8.4ZM10.9 6.5V9H12.1V6.5H10.9ZM13.5 11.6H19.5V10.4H13.5V11.6ZM14.1 13.5V11H12.9V13.5H14.1ZM19.5 12.9H13.5V14.1H19.5V12.9ZM18.9 11V13.5H20.1V11H18.9ZM13.5 16.6H19.5V15.4H13.5V16.6ZM14.1 18.5V16H12.9V18.5H14.1ZM19.5 17.9H13.5V19.1H19.5V17.9ZM18.9 16V18.5H20.1V16H18.9ZM8 17.85H13.5V16.65H8V17.85ZM8 12.85H13.5V11.65H8V12.85ZM7.9 9.5V17.85H9.1V9.5H7.9Z",fill:"currentColor"})})}function vt(e,t=[]){return l({name:"skosConceptScheme",title:"Concept Scheme",type:"document",icon:wt,initialValue:async(t,n)=>{if(e)return{baseIri:e};const{getClient:i}=n;return{baseIri:await i({apiVersion:"2021-03-25"}).fetch("\n *[(_type == 'skosConcept' || _type == 'skosConceptScheme') && defined(baseIri)]| order(_createdAt desc)[0].baseIri\n ")??void 0}},fields:[d({name:"title",title:"Title",type:"string",description:"Taxonomy schemes group concepts into defined sets, such as thesauri, classification schemes, or facets. Concepts may belong to many (or no) concept schemes, and you may create as many (or few) concept schemes as you like"}),d({name:"description",title:"Description",type:"text",rows:5,description:"Describe the intended use of this scheme."}),d({name:"controls",title:"Concept Management Controls",deprecated:{reason:"This field was used for a previous version of the plugin and is no longer needed. Remove the value to hide this field."},type:"boolean",readOnly:!0,hidden:({document:e})=>void 0===e?.controls,components:{input:mt}}),...gt,d({name:"schemeId",title:"Identifier",description:"This scheme does not yet have a unique identifier.",type:"string",initialValue:()=>`${ce(6)}`,hidden:({document:e})=>!!e?.schemeId,readOnly:({document:e})=>!!e?.schemeId,components:{input:fe}}),d({name:"topConcepts",title:"Top Concepts",type:"array",validation:e=>e.unique(),of:[p({type:"reference",to:[{type:"skosConcept"}]})],options:{sortable:!1}}),d({name:"concepts",title:"Concepts",type:"array",validation:e=>e.unique(),of:[p({type:"reference",to:[{type:"skosConcept"}]})],options:{sortable:!1}}),...t],preview:{select:{title:"title"},prepare:({title:e})=>({title:e,media:wt})}})}const _t=/_key\s*==\s*['"](.*)['"]/,It=/^\d*:\d*$/,xt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,kt=/_key\s*==\s*['"](.*)['"]/;function Vt(e){if("string"!=typeof e)throw new Error("Path is not a string");const t=e.match(xt);if(!t)throw new Error("Invalid path string");return t.map(Tt)}function Tt(e){return function(e){return"number"==typeof e||"string"==typeof e&&/^\[\d+\]$/.test(e)}(e)?function(e){return Number(e.replace(/[^\d]/g,""))}(e):function(e){return"string"==typeof e?_t.test(e.trim()):"object"==typeof e&&"_key"in e}(e)?function(e){return{_key:e.match(kt)[1]}}(e):function(e){if("string"==typeof e&&It.test(e))return!0;if(!Array.isArray(e)||2!==e.length)return!1;const[t,n]=e;return!("number"!=typeof t&&""!==t||"number"!=typeof n&&""!==n)}(e)?function(e){const[t,n]=e.split(":").map(e=>""===e?e:Number(e));return[t,n]}(e):e}const St=({document:e})=>{const{selectedPerspectiveName:t}=o(),{routerPanesState:n,groupIndex:i,handleEditReference:r}=g(),c=h(),a=m(e.displayed?._id??""),s=b((e,t)=>{const o=n[i+1]?.[0].params||{},{parentRefPath:c}=o;r({id:e,type:t,parentRefPath:c?Vt(c):[""],template:{id:e}})},[n,i,r]),{data:d,loading:l,error:p}=$e('*[!(_type in ["skosConcept","skosConceptScheme"]) && references($refId)]{_id,_type,title}',{params:{refId:a},options:{perspective:t?[t]:"drafts"}});return l?/* @__PURE__ */V(
|
|
170
|
+
return V("svg",{"data-sanity-icon":!0,width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:/* @__PURE__ */V("path",{d:"M5.5 6.5V5.9H4.9V6.5H5.5ZM11.5 6.5H12.1V5.9H11.5V6.5ZM5.5 9H4.9V9.6H5.5V9ZM11.5 9V9.6H12.1V9H11.5ZM13.5 11V10.4H12.9V11H13.5ZM19.5 11H20.1V10.4H19.5V11ZM13.5 13.5H12.9V14.1H13.5V13.5ZM19.5 13.5V14.1H20.1V13.5H19.5ZM13.5 16V15.4H12.9V16H13.5ZM19.5 16H20.1V15.4H19.5V16ZM13.5 18.5H12.9V19.1H13.5V18.5ZM19.5 18.5V19.1H20.1V18.5H19.5ZM5.5 7.1H11.5V5.9H5.5V7.1ZM6.1 9V6.5H4.9V9H6.1ZM11.5 8.4H5.5V9.6H11.5V8.4ZM10.9 6.5V9H12.1V6.5H10.9ZM13.5 11.6H19.5V10.4H13.5V11.6ZM14.1 13.5V11H12.9V13.5H14.1ZM19.5 12.9H13.5V14.1H19.5V12.9ZM18.9 11V13.5H20.1V11H18.9ZM13.5 16.6H19.5V15.4H13.5V16.6ZM14.1 18.5V16H12.9V18.5H14.1ZM19.5 17.9H13.5V19.1H19.5V17.9ZM18.9 16V18.5H20.1V16H18.9ZM8 17.85H13.5V16.65H8V17.85ZM8 12.85H13.5V11.65H8V12.85ZM7.9 9.5V17.85H9.1V9.5H7.9Z",fill:"currentColor"})})}function vt(e,t=[]){return l({name:"skosConceptScheme",title:"Concept Scheme",type:"document",icon:wt,initialValue:async(t,n)=>{if(e)return{baseIri:e};const{getClient:i}=n;return{baseIri:await i({apiVersion:"2021-03-25"}).fetch("\n *[(_type == 'skosConcept' || _type == 'skosConceptScheme') && defined(baseIri)]| order(_createdAt desc)[0].baseIri\n ")??void 0}},fields:[d({name:"title",title:"Title",type:"string",description:"Taxonomy schemes group concepts into defined sets, such as thesauri, classification schemes, or facets. Concepts may belong to many (or no) concept schemes, and you may create as many (or few) concept schemes as you like"}),d({name:"description",title:"Description",type:"text",rows:5,description:"Describe the intended use of this scheme."}),d({name:"controls",title:"Concept Management Controls",deprecated:{reason:"This field was used for a previous version of the plugin and is no longer needed. Remove the value to hide this field."},type:"boolean",readOnly:!0,hidden:({document:e})=>void 0===e?.controls,components:{input:mt}}),...gt,d({name:"schemeId",title:"Identifier",description:"This scheme does not yet have a unique identifier.",type:"string",initialValue:()=>`${ce(6)}`,hidden:({document:e})=>!!e?.schemeId,readOnly:({document:e})=>!!e?.schemeId,components:{input:fe}}),d({name:"topConcepts",title:"Top Concepts",type:"array",validation:e=>e.unique(),of:[p({type:"reference",to:[{type:"skosConcept"}]})],options:{sortable:!1}}),d({name:"concepts",title:"Concepts",type:"array",validation:e=>e.unique(),of:[p({type:"reference",to:[{type:"skosConcept"}]})],options:{sortable:!1}}),...t],preview:{select:{title:"title"},prepare:({title:e})=>({title:e,media:wt})}})}const _t=/_key\s*==\s*['"](.*)['"]/,It=/^\d*:\d*$/,xt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,kt=/_key\s*==\s*['"](.*)['"]/;function Vt(e){if("string"!=typeof e)throw new Error("Path is not a string");const t=e.match(xt);if(!t)throw new Error("Invalid path string");return t.map(Tt)}function Tt(e){return function(e){return"number"==typeof e||"string"==typeof e&&/^\[\d+\]$/.test(e)}(e)?function(e){return Number(e.replace(/[^\d]/g,""))}(e):function(e){return"string"==typeof e?_t.test(e.trim()):"object"==typeof e&&"_key"in e}(e)?function(e){return{_key:e.match(kt)[1]}}(e):function(e){if("string"==typeof e&&It.test(e))return!0;if(!Array.isArray(e)||2!==e.length)return!1;const[t,n]=e;return!("number"!=typeof t&&""!==t||"number"!=typeof n&&""!==n)}(e)?function(e){const[t,n]=e.split(":").map(e=>""===e?e:Number(e));return[t,n]}(e):e}const St=({document:e})=>{const{selectedPerspectiveName:t}=o(),{routerPanesState:n,groupIndex:i,handleEditReference:r}=g(),c=h(),a=m(e.displayed?._id??""),s=b((e,t)=>{const o=n[i+1]?.[0].params||{},{parentRefPath:c}=o;r({id:e,type:t,parentRefPath:c?Vt(c):[""],template:{id:e}})},[n,i,r]),{data:d,loading:l,error:p}=$e('*[!(_type in ["skosConcept","skosConceptScheme"]) && references($refId)]{_id,_type,title}',{params:{refId:a},options:{perspective:t?[t]:"drafts"}});return l?/* @__PURE__ */V(B,{padding:5,children:/* @__PURE__ */k(D,{align:"center",direction:"column",gap:5,height:"fill",justify:"center",style:{paddingTop:"1rem"},children:[
|
|
171
171
|
/* @__PURE__ */V(G,{muted:!0}),
|
|
172
|
-
/* @__PURE__ */V(O,{muted:!0,size:1,children:"Loading usage…"})]})}):p?/* @__PURE__ */V(P,{padding:4,space:5,children:/* @__PURE__ */V(Ie,{tone:"caution",children:"There was en error fetching use data"})}):d?.length?/* @__PURE__ */V(
|
|
172
|
+
/* @__PURE__ */V(O,{muted:!0,size:1,children:"Loading usage…"})]})}):p?/* @__PURE__ */V(P,{padding:4,space:5,children:/* @__PURE__ */V(Ie,{tone:"caution",children:"There was en error fetching use data"})}):d?.length?/* @__PURE__ */V(B,{padding:4,paddingTop:4,children:/* @__PURE__ */k(P,{space:2,children:[
|
|
173
173
|
/* @__PURE__ */V(R,{borderBottom:!0,paddingTop:3,paddingBottom:3,children:/* @__PURE__ */V(M,{paddingTop:1,children:/* @__PURE__ */k(O,{weight:"semibold",muted:!0,size:1,children:["Resource count (all schemes): ",d.length]})})}),
|
|
174
|
-
/* @__PURE__ */V(P,{space:1,children:d?.map(e=>{const t=c.get(e._type);return t&&/* @__PURE__ */V(A,{onClick:()=>s(e._id,e._type),padding:2,mode:"bleed",children:/* @__PURE__ */V(u,{value:e,schemaType:t,layout:"block"})},e._id)})})]})}):/* @__PURE__ */V(P,{padding:4,space:5,children:/* @__PURE__ */V(Ie,{children:"This concept is not currently in use"})})},Nt=e=>e.list().title("Taxonomy Manager").items([e.documentTypeListItem("skosConceptScheme").title("Concept Schemes"),e.documentTypeListItem("skosConcept").title("Concepts")]),Ht=(e,{schemaType:t})=>{switch(t){case"skosConceptScheme":return e.document().views([e.view.component(lt).title("Tree View").icon(wt),e.view.form().icon(re)]);case"skosConcept":return e.document().views([e.view.form().icon(re),e.view.component(St).title("Tagged Resources").icon(oe)]);default:return e.document().views([e.view.form().icon(re)])}},
|
|
174
|
+
/* @__PURE__ */V(P,{space:1,children:d?.map(e=>{const t=c.get(e._type);return t&&/* @__PURE__ */V(A,{onClick:()=>s(e._id,e._type),padding:2,mode:"bleed",children:/* @__PURE__ */V(u,{value:e,schemaType:t,layout:"block"})},e._id)})})]})}):/* @__PURE__ */V(P,{padding:4,space:5,children:/* @__PURE__ */V(Ie,{children:"This concept is not currently in use"})})},Nt=e=>e.list().title("Taxonomy Manager").items([e.documentTypeListItem("skosConceptScheme").title("Concept Schemes"),e.documentTypeListItem("skosConcept").title("Concepts")]),Ht=(e,{schemaType:t})=>{switch(t){case"skosConceptScheme":return e.document().views([e.view.component(lt).title("Tree View").icon(wt),e.view.form().icon(re)]);case"skosConcept":return e.document().views([e.view.form().icon(re),e.view.component(St).title("Tagged Resources").icon(oe)]);default:return e.document().views([e.view.form().icon(re)])}},zt=f(e=>{const{baseUri:t,customConceptFields:n,customSchemeFields:i}=e||{};return{name:"taxonomyManager",options:e,schema:{types:[Ct(t,n),vt(t,i)]},plugins:[y({name:"taxonomy",title:"Taxonomy",structure:Nt,defaultDocumentNode:Ht,icon:wt})]}});export{ht as ArrayHierarchyInput,pt as ReferenceHierarchyInput,lt as TreeView,ft as branchFilter,ut as schemeFilter,zt as taxonomyManager};//# sourceMappingURL=index.esm.esm.js.map
|