2020-11-26 23:00:27 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  server  from  "../../services/server.js" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  treeCache  from  "../../services/tree_cache.js" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  treeService  from  "../../services/tree.js" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  linkService  from  "../../services/link.js" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  attributeAutocompleteService  from  "../../services/attribute_autocomplete.js" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  noteAutocompleteService  from  "../../services/note_autocomplete.js" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  promotedAttributeDefinitionParser  from  '../../services/promoted_attribute_definition_parser.js' ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  TabAwareWidget  from  "../tab_aware_widget.js" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  SpacedUpdate  from  "../../services/spaced_update.js" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  utils  from  "../../services/utils.js" ;  
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								const  TPL  =  ` 
  
						 
					
						
							
								
									
										
										
										
											2020-07-14 23:29:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								< div  class = "attr-detail" >  
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    < style > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        . attr - detail  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            display :  block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            background - color :  var ( -- accented - background - color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            border :  1 px  solid  var ( -- main - border - color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            border - radius :  4 px ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            z - index :  1000 ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-14 23:29:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            padding :  15 px ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            position :  absolute ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            width :  500 px ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            max - height :  600 px ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            overflow :  auto ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-27 14:54:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            box - shadow :  10 px  10 px  93 px  - 25 px  black ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        
							 
						 
					
						
							
								
									
										
										
										
											2020-08-23 23:38:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        . attr - help  td  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            color :  var ( -- muted - text - color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            padding :  5 px ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        . related - notes - list  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            padding - left :  20 px ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            margin - top :  10 px ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            margin - bottom :  10 px ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        . attr - edit - table  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            width :  100 % ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        . attr - edit - table  th  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            text - align :  left ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        . attr - edit - table  td  input  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            width :  100 % ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-03 22:27:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        . close - attr - detail - button  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            font - size :  x - large ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cursor :  pointer ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-19 18:05:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            position :  relative ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            top :  - 2 px ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-03 22:27:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        . attr - save - delete - button - container  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            display :  flex ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            margin - top :  15 px ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-19 17:59:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        . attr - detail  input [ readonly ]  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            background - color :  var ( -- accented - background - color )  ! important ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    < / s t y l e > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-19 18:05:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    < div  style = "display: flex; justify-content: space-between; margin-bottom: 8px;" > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 00:09:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < h5  class = "attr-detail-title" > < / h 5 > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-03 22:27:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        
							 
						 
					
						
							
								
									
										
										
										
											2020-09-02 16:40:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < span  class = "bx bx-x close-attr-detail-button"  title = "Cancel changes and close" > < / s p a n > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-03 22:27:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    < / d i v > 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-05 23:53:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    < div  class = "attr-is-owned-by" > < / d i v > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    < table  class = "attr-edit-table" > 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-17 20:58:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < tr  title = "Attribute name can be composed of alphanumeric characters, colon and underscore only" > 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            < th > Name : < / t h > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            < td > < input  type = "text"  class = "attr-input-name form-control"  / > < / t d > 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        < / t r > 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-23 23:38:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < tr  class = "attr-help" > < / t r > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < tr  class = "attr-row-value" > 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            < th > Value : < / t h > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            < td > < input  type = "text"  class = "attr-input-value form-control"  / > < / t d > 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        < / t r > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < tr  class = "attr-row-target-note" > 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-23 23:38:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            < th  title = "Relation is a named connection between source note and target note." > Target  note : < / t h > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 00:15:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            < td > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                < div  class = "input-group" > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    < input  type = "text"  class = "attr-input-target-note form-control"  / > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 00:15:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                < / d i v > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            < / t d > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < / t r > 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-23 23:38:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < tr  class = "attr-row-promoted" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            title = "Promoted attribute is displayed prominently on the note." > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 00:09:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            < th > Promoted : < / t h > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            < td > < input  type = "checkbox"  class = "attr-input-promoted form-control form-control-sm"  / > < / t d > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 00:09:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < / t r > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < tr  class = "attr-row-multiplicity" > 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-23 23:38:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            < th  title = "Multiplicity defines how many attributes of the same name can be created - at max 1 or more than 1." > Multiplicity : < / t h > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 00:09:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            < td > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                < select  class = "attr-input-multiplicity form-control" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                  < option  value = "single" > Single  value < / o p t i o n > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                  < option  value = "multi" > Multi  value < / o p t i o n > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 00:09:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                < / s e l e c t > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            < / t d > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < / t r > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < tr  class = "attr-row-label-type" > 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-23 23:38:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            < th  title = "Type of the label will help Trilium to choose suitable interface to enter the label value." > Type : < / t h > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 00:09:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            < td > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                < select  class = "attr-input-label-type form-control" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                  < option  value = "text" > Text < / o p t i o n > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                  < option  value = "number" > Number < / o p t i o n > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                  < option  value = "boolean" > Boolean < / o p t i o n > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                  < option  value = "date" > Date < / o p t i o n > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                  < option  value = "url" > URL < / o p t i o n > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 00:09:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                < / s e l e c t > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            < / t d > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < / t r > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < tr  class = "attr-row-number-precision" > 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-23 23:38:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            < th  title = "What number of digits after floating point should be available in the value setting interface." > Precision : < / t h > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            < td > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                < div  class = "input-group" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    < input  type = "number"  class = "form-control attr-input-number-precision"  style = "text-align: right" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    < div  class = "input-group-append" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        < span  class = "input-group-text" > digits < / s p a n > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    < / d i v > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                < / d i v > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            < / t d > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < / t r > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < tr  class = "attr-row-inverse-relation" > 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-23 23:38:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            < th  title = "Optional setting to define to which relation is this one opposite. Example: Father - Son are inverse relations to each other." > Inverse  relation : < / t h > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 00:09:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            < td > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                < div  class = "input-group" > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    < input  type = "text"  class = "attr-input-inverse-relation form-control"  / > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 00:09:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                < / d i v > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            < / t d > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < / t r > 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-23 23:38:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < tr  title = "Inheritable attribute will be inherited to all descendants under this tree." > 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            < th > Inheritable : < / t h > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            < td > < input  type = "checkbox"  class = "attr-input-inheritable form-control form-control-sm"  / > < / t d > 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        < / t r > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    < / t a b l e > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    < div  class = "attr-save-delete-button-container" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < button  class = "btn btn-primary btn-sm attr-save-changes-and-close-button"  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            style = "flex-grow: 1; margin-right: 20px" > 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-01 22:47:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            Save  &  close  < kbd > Ctrl + Enter < / k b d > < / b u t t o n > 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < button  class = "btn btn-secondary btn-sm attr-delete-button" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            Delete < / b u t t o n > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    < / d i v > 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-23 00:19:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-14 23:29:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    < div  class = "related-notes-container" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < br / > 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-14 23:29:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < h5  class = "related-notes-tile" > Other  notes  with  this  label < / h 5 > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < ul  class = "related-notes-list" > < / u l > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < div  class = "related-notes-more-notes" > < / d i v > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    < / d i v > 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< / d i v > ` ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								const  DISPLAYED _NOTES  =  10 ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 00:09:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								const  ATTR _TITLES  =  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    "label" :  "Label detail" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    "label-definition" :  "Label definition detail" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    "relation" :  "Relation detail" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    "relation-definition" :  "Relation definition detail" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-17 23:54:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								const  ATTR _NAME _MATCHER  =  new  RegExp ( "^[\\p{L}\\p{N}_:]+$" ,  "u" ) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-23 23:38:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								const  ATTR _HELP  =  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    "label" :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "disableVersioning" :  "disables auto-versioning. Useful for e.g. large, but unimportant notes - e.g. large JS libraries used for scripting" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "calendarRoot" :  "marks note which should be used as root for day notes. Only one should be marked as such." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "archived" :  "notes with this label won't be visible by default in search results (also in Jump To, Add Link dialogs etc)." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "excludeFromExport" :  "notes (with their sub-tree) won't be included in any note export" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "run" :  ` defines on which events script should run. Possible values are:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                < ul > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    < li > frontendStartup  -  when  Trilium  frontend  starts  up  ( or  is  refreshed ) . < / l i > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    < li > backendStartup  -  when  Trilium  backend  starts  up < / l i > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    < li > hourly  -  run  once  an  hour < / l i > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    < li > daily  -  run  once  a  day < / l i > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                < / u l > ` , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "disableInclusion" :  "scripts with this label won't be included into parent script execution." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "sorted" :  "keeps child notes sorted by title alphabetically" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "hidePromotedAttributes" :  "Hide promoted attributes on this note" , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-02 16:40:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        "readOnly" :  "editor is in read only mode. Works only for text and code notes." , 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-23 23:38:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        "autoReadOnlyDisabled" :  "text/code notes can be set automatically into read mode when they are too large. You can disable this behavior on per-note basis by adding this label to the note" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "appCss" :  "marks CSS notes which are loaded into the Trilium application and can thus be used to modify Trilium's looks." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "appTheme" :  "marks CSS notes which are full Trilium themes and are thus available in Trilium options." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "cssClass" :  "value of this label is then added as CSS class to the node representing given note in the tree. This can be useful for advanced theming. Can be used in template notes." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "iconClass" :  "value of this label is added as a CSS class to the icon on the tree which can help visually distinguish the notes in the tree. Example might be bx bx-home - icons are taken from boxicons. Can be used in template notes." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "bookZoomLevel" :  'applies only to book note and sets the "zoom level" (how many notes fit on 1 row)' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "customRequestHandler" :  'see <a href="javascript:" data-help-page="Custom request handler">Custom request handler</a>' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "customResourceProvider" :  'see <a href="javascript:" data-help-page="Custom request handler">Custom request handler</a>' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    "relation" :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "runOnNoteCreation" :  "executes when note is created on backend" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "runOnNoteTitleChange" :  "executes when note title is changed (includes note creation as well)" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "runOnNoteChange" :  "executes when note is changed (includes note creation as well)" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "runOnChildNoteCreation" :  "executes when new note is created under this note" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "runOnAttributeCreation" :  "executes when new attribute is created under this note" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "runOnAttributeChange" :  "executes when attribute is changed under this note" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "template" :  "attached note's attributes will be inherited even without parent-child relationship. See template for details." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "renderNote" :  'notes of type "render HTML note" will be rendered using a code note (HTML or script) and it is necessary to point using this relation to which note should be rendered' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "widget" :  "target of this relation will be executed and rendered as a widget in the sidebar" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								export  default  class  AttributeDetailWidget  extends  TabAwareWidget  {  
						 
					
						
							
								
									
										
										
										
											2020-08-17 20:58:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    async  refresh ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-05 21:51:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // switching note/tab should close the widget
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-15 21:24:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    doRender ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-14 23:00:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . relatedNotesSpacedUpdate  =  new  SpacedUpdate ( async  ( )  =>  this . updateRelatedNotes ( ) ,  1000 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        this . $widget  =  $ ( TPL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-01 22:47:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        utils . bindElShortcut ( this . $widget ,  'ctrl+return' ,  ( )  =>  this . saveAndClose ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-02 16:40:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        utils . bindElShortcut ( this . $widget ,  'esc' ,  ( )  =>  this . cancelAndClose ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-01 22:47:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-17 20:58:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . contentSized ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-14 23:29:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 00:09:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $title  =  this . $widget . find ( '.attr-detail-title' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $inputName  =  this . $widget . find ( '.attr-input-name' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-14 23:00:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $inputName . on ( 'keyup' ,  ( )  =>  this . userEditedAttribute ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-21 20:18:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $inputName . on ( 'change' ,  ( )  =>  this . userEditedAttribute ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $inputName . on ( 'autocomplete:closed' ,  ( )  =>  this . userEditedAttribute ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $inputName . on ( 'focus' ,  ( )  =>  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-26 00:04:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            attributeAutocompleteService . initAttributeNameAutocomplete ( { 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                $el :  this . $inputName , 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-26 00:04:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                attributeType :  ( )  =>  [ 'relation' ,  'relation-definition' ] . includes ( this . attrType )  ?  'relation'  :  'label' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                open :  true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $rowValue  =  this . $widget . find ( '.attr-row-value' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $inputValue  =  this . $widget . find ( '.attr-input-value' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-14 23:00:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $inputValue . on ( 'keyup' ,  ( )  =>  this . userEditedAttribute ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-13 12:11:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $inputValue . on ( 'change' ,  ( )  =>  this . userEditedAttribute ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $inputValue . on ( 'autocomplete:closed' ,  ( )  =>  this . userEditedAttribute ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $inputValue . on ( 'focus' ,  ( )  =>  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-26 00:04:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            attributeAutocompleteService . initLabelValueAutocomplete ( { 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                $el :  this . $inputValue , 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-26 00:04:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                open :  true , 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                nameCallback :  ( )  =>  this . $inputName . val ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-26 00:04:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $rowPromoted  =  this . $widget . find ( '.attr-row-promoted' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $inputPromoted  =  this . $widget . find ( '.attr-input-promoted' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-14 23:00:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $inputPromoted . on ( 'change' ,  ( )  =>  this . userEditedAttribute ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $rowMultiplicity  =  this . $widget . find ( '.attr-row-multiplicity' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $inputMultiplicity  =  this . $widget . find ( '.attr-input-multiplicity' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-14 23:00:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $inputMultiplicity . on ( 'change' ,  ( )  =>  this . userEditedAttribute ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 00:15:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $rowLabelType  =  this . $widget . find ( '.attr-row-label-type' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $inputLabelType  =  this . $widget . find ( '.attr-input-label-type' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-14 23:00:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $inputLabelType . on ( 'change' ,  ( )  =>  this . userEditedAttribute ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 00:15:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $rowNumberPrecision  =  this . $widget . find ( '.attr-row-number-precision' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $inputNumberPrecision  =  this . $widget . find ( '.attr-input-number-precision' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-14 23:00:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $inputNumberPrecision . on ( 'change' ,  ( )  =>  this . userEditedAttribute ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 00:09:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $rowInverseRelation  =  this . $widget . find ( '.attr-row-inverse-relation' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $inputInverseRelation  =  this . $widget . find ( '.attr-input-inverse-relation' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-14 23:00:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $inputInverseRelation . on ( 'keyup' ,  ( )  =>  this . userEditedAttribute ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 00:15:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $rowTargetNote  =  this . $widget . find ( '.attr-row-target-note' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $inputTargetNote  =  this . $widget . find ( '.attr-input-target-note' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        noteAutocompleteService . initNoteAutocomplete ( this . $inputTargetNote ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:08:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            . on ( 'autocomplete:noteselected' ,  ( event ,  suggestion ,  dataset )  =>  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 00:15:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                if  ( ! suggestion . notePath )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-26 16:05:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                const  pathChunks  =  suggestion . notePath . split ( '/' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                this . attribute . value  =  pathChunks [ pathChunks . length  -  1 ] ;  // noteId
 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 00:15:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                this . triggerCommand ( 'updateAttributeList' ,  {  attributes :  this . allAttributes  } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-14 23:00:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                this . updateRelatedNotes ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 00:15:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $inputInheritable  =  this . $widget . find ( '.attr-input-inheritable' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-14 23:00:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $inputInheritable . on ( 'change' ,  ( )  =>  this . userEditedAttribute ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 23:27:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-03 22:27:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $closeAttrDetailButton  =  this . $widget . find ( '.close-attr-detail-button' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-02 16:40:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $closeAttrDetailButton . on ( 'click' ,  ( )  =>  this . cancelAndClose ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-05 23:53:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $attrIsOwnedBy  =  this . $widget . find ( '.attr-is-owned-by' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $attrSaveDeleteButtonContainer  =  this . $widget . find ( '.attr-save-delete-button-container' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-23 00:19:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $saveAndCloseButton  =  this . $widget . find ( '.attr-save-changes-and-close-button' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-01 22:47:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $saveAndCloseButton . on ( 'click' ,  ( )  =>  this . saveAndClose ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-23 00:19:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $deleteButton  =  this . $widget . find ( '.attr-delete-button' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $deleteButton . on ( 'click' ,  async  ( )  =>  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            await  this . triggerCommand ( 'updateAttributeList' ,  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                attributes :  this . allAttributes . filter ( attr  =>  attr  !==  this . attribute ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            await  this . triggerCommand ( 'saveAttributes' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            this . hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-23 23:38:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $attrHelp  =  this . $widget . find ( '.attr-help' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $relatedNotesContainer  =  this . $widget . find ( '.related-notes-container' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $relatedNotesTitle  =  this . $relatedNotesContainer . find ( '.related-notes-tile' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $relatedNotesList  =  this . $relatedNotesContainer . find ( '.related-notes-list' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $relatedNotesMoreNotes  =  this . $relatedNotesContainer . find ( '.related-notes-more-notes' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-03 22:27:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $ ( window ) . on ( 'mouseup' ,  e  =>  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 00:15:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( ! $ ( e . target ) . closest ( this . $widget [ 0 ] ) . length 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-19 17:59:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                &&  ! $ ( e . target ) . closest ( ".algolia-autocomplete" ) . length 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                &&  ! $ ( e . target ) . closest ( "#context-menu-container" ) . length )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-03 22:27:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                this . hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-01 22:47:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    async  showAttributeDetail ( { allAttributes ,  attribute ,  isOwned ,  x ,  y ,  focus } )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-05 23:53:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( ! attribute )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            this . hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-17 23:54:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-04 23:35:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        utils . saveFocusedElement ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . attrType  =  this . getAttrType ( attribute ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-14 23:00:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  attrName  = 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            this . attrType  ===  'label-definition'  ?  attribute . name . substr ( 6 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                :  ( this . attrType  ===  'relation-definition'  ?  attribute . name . substr ( 9 )  :  attribute . name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  definition  =  this . attrType . endsWith ( '-definition' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ?  promotedAttributeDefinitionParser . parse ( attribute . value ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            :  { } ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 00:09:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $title . text ( ATTR _TITLES [ this . attrType ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 00:09:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-09 23:59:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . allAttributes  =  allAttributes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . attribute  =  attribute ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-15 21:24:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // can be slightly slower so just make it async
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . updateRelatedNotes ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $attrSaveDeleteButtonContainer . toggle ( ! ! isOwned ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-11 22:52:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-05 23:53:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( isOwned )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            this . $attrIsOwnedBy . hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            this . $attrIsOwnedBy 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . show ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-11 22:52:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . empty ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-05 23:53:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . append ( attribute . type  ===  'label'  ?  'Label'  :  'Relation' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . append ( ' is owned by note ' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . append ( await  linkService . createNoteLink ( attribute . noteId ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $inputName 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-22 23:42:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            . val ( attrName ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 00:15:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            . attr ( 'readonly' ,  ( )  =>  ! isOwned ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $rowValue . toggle ( this . attrType  ===  'label' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $rowTargetNote . toggle ( this . attrType  ===  'relation' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $rowPromoted . toggle ( [ 'label-definition' ,  'relation-definition' ] . includes ( this . attrType ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $inputPromoted 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            . prop ( "checked" ,  ! ! definition . isPromoted ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            . attr ( 'disabled' ,  ( )  =>  ! isOwned ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $rowMultiplicity . toggle ( [ 'label-definition' ,  'relation-definition' ] . includes ( this . attrType ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $inputMultiplicity 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            . val ( definition . multiplicity ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            . attr ( 'disabled' ,  ( )  =>  ! isOwned ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $rowLabelType . toggle ( this . attrType  ===  'label-definition' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $inputLabelType 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            . val ( definition . labelType ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            . attr ( 'disabled' ,  ( )  =>  ! isOwned ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $rowNumberPrecision . toggle ( this . attrType  ===  'label-definition'  &&  definition . labelType  ===  'number' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $inputNumberPrecision 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            . val ( definition . numberPrecision ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            . attr ( 'disabled' ,  ( )  =>  ! isOwned ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 00:09:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $rowInverseRelation . toggle ( this . attrType  ===  'relation-definition' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . $inputInverseRelation 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            . val ( definition . inverseRelation ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            . attr ( 'disabled' ,  ( )  =>  ! isOwned ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-05 23:53:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 00:15:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( attribute . type  ===  'label' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            this . $inputValue 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 00:15:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . val ( attribute . value ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . attr ( 'readonly' ,  ( )  =>  ! isOwned ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else  if  ( attribute . type  ===  'relation' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            this . $inputTargetNote 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 00:15:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . attr ( 'readonly' ,  ( )  =>  ! isOwned ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-04 23:35:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . val ( "" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . setSelectedNotePath ( "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( attribute . value )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                const  targetNote  =  await  treeCache . getNote ( attribute . value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if  ( targetNote )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    this . $inputTargetNote 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        . val ( targetNote  ?  targetNote . title  :  "" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        . setSelectedNotePath ( attribute . value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 00:15:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $inputInheritable 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-14 23:29:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            . prop ( "checked" ,  ! ! attribute . isInheritable ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            . attr ( 'disabled' ,  ( )  =>  ! isOwned ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-23 23:38:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . updateHelp ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-14 23:29:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . toggleInt ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 23:27:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-17 23:54:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  offset  =  this . parent . $widget . offset ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-02 16:06:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  detPosition  =  this . getDetailPosition ( x ,  offset ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-17 23:54:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-02 16:06:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $widget 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            . css ( "left" ,  detPosition . left ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            . css ( "right" ,  detPosition . right ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            . css ( "top" ,  y  -  offset . top  +  70 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            . css ( "max-height" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                this . $widget . outerHeight ( )  +  y  >  $ ( window ) . height ( )  -  50 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    ?  $ ( window ) . height ( )  -  y  -  50 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    :  10000 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-28 15:38:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-02 16:06:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( focus  ===  'name' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            this . $inputName 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . trigger ( 'focus' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . trigger ( 'select' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-28 15:38:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-02 16:06:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-28 15:38:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-02 16:06:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    getDetailPosition ( x ,  offset )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        let  left  =  x  -  offset . left  -  this . $widget . outerWidth ( )  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        let  right  =  "" ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-26 00:09:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-02 16:06:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( left  <  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            left  =  10 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            const  rightEdge  =  left  +  this . $widget . outerWidth ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-01 22:47:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-02 16:06:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( rightEdge  >  this . parent . $widget . outerWidth ( )  -  10 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                left  =  "" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                right  =  10 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-01 22:47:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-02 16:06:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  { left ,  right } ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-04 23:35:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    async  saveAndClose ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        await  this . triggerCommand ( 'saveAttributes' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        utils . focusSavedElement ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    async  cancelAndClose ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        await  this . triggerCommand ( 'reloadAttributes' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        utils . focusSavedElement ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    userEditedAttribute ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . updateAttributeInEditor ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . updateHelp ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . relatedNotesSpacedUpdate . scheduleUpdate ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    updateHelp ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  attrName  =  this . $inputName . val ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( this . attrType  in  ATTR _HELP  &&  attrName  in  ATTR _HELP [ this . attrType ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            this . $attrHelp 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . empty ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . append ( $ ( "<td colspan=2>" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . append ( $ ( "<strong>" ) . text ( attrName ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . append ( " - " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . append ( ATTR _HELP [ this . attrType ] [ attrName ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            this . $attrHelp . empty ( ) . hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-14 23:00:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    async  updateRelatedNotes ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        let  { results ,  count }  =  await  server . post ( 'search-related' ,  this . attribute ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        for  ( const  res  of  results )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            res . noteId  =  res . notePathArray [ res . notePathArray . length  -  1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        results  =  results . filter ( ( { noteId } )  =>  noteId  !==  this . noteId ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( results . length  ===  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            this . $relatedNotesContainer . hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            this . $relatedNotesContainer . show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            this . $relatedNotesTitle . text ( ` Other notes with  ${ this . attribute . type }  name " ${ this . attribute . name } " ` ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            this . $relatedNotesList . empty ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            const  displayedResults  =  results . length  <=  DISPLAYED _NOTES  ?  results  :  results . slice ( 0 ,  DISPLAYED _NOTES ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            const  displayedNotes  =  await  treeCache . getNotes ( displayedResults . map ( res  =>  res . noteId ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            for  ( const  note  of  displayedNotes )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                const  notePath  =  treeService . getSomeNotePath ( note ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                const  $noteLink  =  await  linkService . createNoteLink ( notePath ,  { showNotePath :  true } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                this . $relatedNotesList . append ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    $ ( "<li>" ) . append ( $noteLink ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( results . length  >  DISPLAYED _NOTES )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                this . $relatedNotesMoreNotes . show ( ) . text ( ` ... and  ${ count  -  DISPLAYED _NOTES }  more. ` ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                this . $relatedNotesMoreNotes . hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 00:09:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    getAttrType ( attribute )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( attribute . type  ===  'label' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( attribute . name . startsWith ( 'label:' ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                return  "label-definition" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            }  else  if  ( attribute . name . startsWith ( 'relation:' ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                return  "relation-definition" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                return  "label" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else  if  ( attribute . type  ===  'relation' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  "relation" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            this . $title . text ( '' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-22 23:58:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    updateAttributeInEditor ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        let  attrName  =  this . $inputName . val ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-22 23:42:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-17 23:54:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( ! ATTR _NAME _MATCHER . test ( attrName ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            // invalid characters are simply ignored (from user perspective they are not even entered)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            attrName  =  attrName . replace ( /[^\p{L}\p{N}_:]/ug ,  "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            this . $inputName . val ( attrName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-22 23:42:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( this . attrType  ===  'label-definition' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            attrName  =  'label:'  +  attrName ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  if  ( this . attrType  ===  'relation-definition' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            attrName  =  'relation:'  +  attrName ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . attribute . name  =  attrName ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . attribute . isInheritable  =  this . $inputInheritable . is ( ":checked" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-22 23:58:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( this . attrType . endsWith ( '-definition' ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            this . attribute . value  =  this . buildDefinitionValue ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-12 23:39:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        else  if  ( this . attrType  ===  'relation' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            this . attribute . value  =  this . $inputTargetNote . getSelectedNoteId ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-12 23:39:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-22 23:58:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        else  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            this . attribute . value  =  this . $inputValue . val ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-22 23:58:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . triggerCommand ( 'updateAttributeList' ,  {  attributes :  this . allAttributes  } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-22 23:58:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    buildDefinitionValue ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  props  =  [ ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( this . $inputPromoted . is ( ":checked" ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            props . push ( "promoted" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        props . push ( this . $inputMultiplicity . val ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( this . attrType  ===  'label-definition' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            props . push ( this . $inputLabelType . val ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-23 00:19:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( this . $inputLabelType . val ( )  ===  'number'  &&  this . $inputNumberPrecision . val ( )  !==  '' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                props . push ( 'precision='  +  this . $inputNumberPrecision . val ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-23 00:19:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        }  else  if  ( this . attrType  ===  'relation-definition'  &&  this . $inputInverseRelation . val ( ) . trim ( ) . length  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            props . push ( "inverse="  +  this . $inputInverseRelation . val ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . $rowNumberPrecision . toggle ( 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            this . attrType  ===  'label-definition' 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            &&  this . $inputLabelType . val ( )  ===  'number' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-18 23:45:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-22 23:58:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  props . join ( "," ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-09 23:59:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    hide ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . toggleInt ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    createNoteLink ( noteId )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  $ ( "<a>" ,  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            href :  '#'  +  noteId , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            class :  'reference-link' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'data-note-path' :  noteId 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:23:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    async  noteSwitched ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-26 22:17:39 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}