@keenmate/svelte-treeview 1.1.0-beta.3 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,9 +4,9 @@ The most elaborate treeview for svelte on earth (or even in our galaxy).
4
4
 
5
5
  ## Features
6
6
 
7
- - load new nodes whne expanding
8
- - customization of all object properties
9
- - checkboxes enabled on whole tree or based on property
7
+ - load new nodes when expanding
8
+ - choose what object properties to use to get necessary information (id, path, ...)
9
+ - enable checkboxes on whole tree or just per node
10
10
  - recursive seletion mode, where leafes can be selected
11
11
  - build-in support for search
12
12
  - drag and drop functionality controlable per node
@@ -17,7 +17,9 @@ The most elaborate treeview for svelte on earth (or even in our galaxy).
17
17
 
18
18
  install the package `@keenmate/svelte-treeview` using your favourite package manager.
19
19
 
20
- **Font awesome is required for expand/collapse icons.**
20
+ > [!warning]
21
+ > **Font awesome is required for expand/collapse icons.**
22
+ > If you wish to not use FA, you need to change all icons in classes properties
21
23
 
22
24
  ## Minimal usage
23
25
 
@@ -44,10 +46,11 @@ You can specify which keys to use for what properties by setting **props**.
44
46
 
45
47
  For more examples see `src/routes/`
46
48
 
47
- ## NodeId and NodePath
48
-
49
- By default, nodeId uses same property is nodePath.
50
- You can change this by setting nodoId in prosp.
49
+ > [!note]
50
+ > Both **id** and **path** is required for tree to work.
51
+ > By default tree uses nodePath property for both.
52
+ > So if you change propery fro path, you need to also change id property.
53
+ > You can change both using props attribute.
51
54
 
52
55
  ## Properties
53
56
 
@@ -82,10 +85,14 @@ You can change this by setting nodoId in prosp.
82
85
  ## Custom classes
83
86
 
84
87
  ## Drag and drop
88
+ > [!NOTE]
89
+ > In memory drag and drop is not yet supported. Tree just dispatches `moved` event with dragged node(`node`), target node (`target`) and insertion type (`insertType`).
90
+ > In future, this package will export function, that will allow you to easily compute new tree on frontend.
91
+
85
92
 
86
93
  ## Keyboard navigation
87
94
 
88
95
  Enable keyboard navigation by setting `useKeyboardNavigation` to true.
89
96
 
90
97
  Use arrows to navigata tree. First you need to focus some node,
91
- you can use `focusNode` to do that. Use Enter or Space to select checkbox.
98
+ you can use `focusNode` to do that. Use Enter or Space to select checkbox.
@@ -127,10 +127,10 @@ function getHighlighMode(node, highlightedNode, insertionType) {
127
127
  type="button"
128
128
  tabindex="-1"
129
129
  >
130
- <i class="fa-fw arrow {expanded ? classes.collapseIcon : classes.expandIcon}" />
130
+ <i class="fixed-icon arrow {expanded ? classes.collapseIcon : classes.expandIcon}" />
131
131
  </button>
132
132
  {:else}
133
- <span class="fa-fw" />
133
+ <span class="fixed-icon" />
134
134
  {/if}
135
135
 
136
136
  <Checkbox
@@ -151,7 +151,7 @@ function getHighlighMode(node, highlightedNode, insertionType) {
151
151
  on:dragover|stopPropagation={(e) =>
152
152
  handleDragOver(e, node, liElements[getNodeId(node)], true)}
153
153
  >
154
- <i class="fa-fw {classes.nestIcon}" />
154
+ <i class="fixed-icon {classes.nestIcon}" />
155
155
 
156
156
  {#if effectiveHighlight === InsertionType.nest}
157
157
  <slot name="nest-highlight" />
@@ -509,4 +509,9 @@ function debugLog(...data) {
509
509
  }
510
510
  :global(.treeview) :global(.expansion-button) {
511
511
  all: unset;
512
+ }
513
+ :global(.treeview) :global(.fixed-icon) {
514
+ text-align: center;
515
+ width: 1.25em;
516
+ min-width: 1.25em;
512
517
  }</style>
@@ -103,3 +103,8 @@ $treeview-lines: solid black 1px
103
103
  cursor: grab
104
104
  .expansion-button
105
105
  all: unset
106
+ .fixed-icon
107
+ text-align: center
108
+ width: 1.25em
109
+ // fix deformation on small screens
110
+ min-width: 1.25em
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keenmate/svelte-treeview",
3
- "version": "1.1.0-beta.3",
3
+ "version": "1.1.1",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",
@@ -70,4 +70,4 @@
70
70
  "lodash.uniqby": "^4.7.0",
71
71
  "svelte-highlight": "^7.6.1"
72
72
  }
73
- }
73
+ }