@@ -16,11 +16,6 @@ const configurable = true;
1616/* Служебные функции */
1717/* -------------------------------------------------------------------------- */
1818
19- /**
20- *
21- * @param siblings
22- * @param parent
23- */
2419const getItems = ( siblings : unObject [ ] , parent ?: unObject ) =>
2520 [ ...siblings ] . reverse ( ) . map ( ( node ) => ( { node, parent, siblings } ) ) ,
2621 uid = ( ) => {
@@ -34,19 +29,6 @@ const getItems = (siblings: unObject[], parent?: unObject) =>
3429/* Композабл для работы с древовидным объектом */
3530/* -------------------------------------------------------------------------- */
3631
37- /**
38- *
39- * @param tree
40- * @param root0
41- * @param root0.branch
42- * @param root0.children
43- * @param root0.id
44- * @param root0.index
45- * @param root0.next
46- * @param root0.parent
47- * @param root0.prev
48- * @param root0.siblings
49- */
5032export default (
5133 tree : unObject [ ] ,
5234 {
@@ -66,39 +48,27 @@ export default (
6648
6749 const properties : PropertyDescriptorMap = {
6850 [ keyBranch ] : {
69- /**
70- *
71- */
7251 get ( this : unObject ) {
7352 const ret = [ this ] ;
7453 while ( ret [ 0 ] ?. [ keyParent ] ) ret . unshift ( ret [ 0 ] [ keyParent ] as unObject ) ;
7554 return ret ;
7655 } ,
7756 } ,
7857 [ keyIndex ] : {
79- /**
80- *
81- */
8258 get ( this : unObject ) {
8359 return ( this [ keySiblings ] as unObject [ ] ) . findIndex (
8460 ( sibling ) => this [ keyId ] === sibling [ keyId ] ,
8561 ) ;
8662 } ,
8763 } ,
8864 [ keyNext ] : {
89- /**
90- *
91- */
9265 get ( this : unObject ) {
9366 return ( this [ keySiblings ] as unObject [ ] ) [
9467 ( this [ keyIndex ] as number ) + 1
9568 ] ;
9669 } ,
9770 } ,
9871 [ keyPrev ] : {
99- /**
100- *
101- */
10272 get ( this : unObject ) {
10373 return ( this [ keySiblings ] as unObject [ ] ) [
10474 ( this [ keyIndex ] as number ) - 1
@@ -111,10 +81,6 @@ export default (
11181 /* Формирование массива элементов дерева простого и ассоциативного */
11282 /* -------------------------------------------------------------------------- */
11383
114- /**
115- *
116- * @param nodes
117- */
11884 const getNodes = function * ( nodes : unObject [ ] ) {
11985 const stack = getItems ( nodes ) ;
12086 while ( stack . length ) {
@@ -152,11 +118,6 @@ export default (
152118 /* Служебная функция для выполнения действия над элементом дерева */
153119 /* -------------------------------------------------------------------------- */
154120
155- /**
156- *
157- * @param pId
158- * @param action
159- */
160121 const run = ( pId : string , action : string ) => {
161122 const the = nodesMap . value [ pId ] ;
162123 if ( the ) {
@@ -234,42 +195,14 @@ export default (
234195 /* -------------------------------------------------------------------------- */
235196
236197 return {
237- /**
238- *
239- * @param pId
240- */
241198 add : ( pId : string ) => run ( pId , "add" ) ,
242- /**
243- *
244- * @param pId
245- */
246199 addChild : ( pId : string ) => run ( pId , "addChild" ) ,
247- /**
248- *
249- * @param pId
250- */
251200 down : ( pId : string ) => run ( pId , "down" ) ,
252- /**
253- *
254- * @param pId
255- */
256201 left : ( pId : string ) => run ( pId , "left" ) ,
257202 nodes,
258203 nodesMap,
259- /**
260- *
261- * @param pId
262- */
263204 remove : ( pId : string ) => run ( pId , "remove" ) ,
264- /**
265- *
266- * @param pId
267- */
268205 right : ( pId : string ) => run ( pId , "right" ) ,
269- /**
270- *
271- * @param pId
272- */
273206 up : ( pId : string ) => run ( pId , "up" ) ,
274207 } ;
275208} ;
0 commit comments