@rokkit/core 1.0.0-next.13 → 1.0.0-next.15
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/package.json +1 -1
- package/src/actions/hierarchy.js +7 -16
- package/src/items/Link.svelte +1 -1
- package/src/items/Node.svelte +1 -1
- package/src/items/Pill.svelte +21 -7
package/package.json
CHANGED
package/src/actions/hierarchy.js
CHANGED
|
@@ -135,6 +135,13 @@ export function movePrevious(path) {
|
|
|
135
135
|
return path
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
/**
|
|
139
|
+
*
|
|
140
|
+
* @param {Array<integer>} indices
|
|
141
|
+
* @param {Array<*>} items
|
|
142
|
+
* @param {import('../constants').FieldMapping} fields
|
|
143
|
+
* @returns
|
|
144
|
+
*/
|
|
138
145
|
export function pathFromIndices(indices, items, fields) {
|
|
139
146
|
let path = []
|
|
140
147
|
let fragment
|
|
@@ -171,19 +178,3 @@ export function findItem(items, indices, fields) {
|
|
|
171
178
|
}
|
|
172
179
|
return item
|
|
173
180
|
}
|
|
174
|
-
|
|
175
|
-
// export function getNodeFromIndices(indices, items, fields) {
|
|
176
|
-
// let fragment
|
|
177
|
-
// indices.map((index, level) => {
|
|
178
|
-
// if (level === 0) {
|
|
179
|
-
// fragment = { index, items, fields }
|
|
180
|
-
// } else {
|
|
181
|
-
// fragment = {
|
|
182
|
-
// index,
|
|
183
|
-
// items: fragment.items[fragment.index][fragment.fields.children],
|
|
184
|
-
// fields: fragment.fields.fields ?? fragment.fields
|
|
185
|
-
// }
|
|
186
|
-
// }
|
|
187
|
-
// })
|
|
188
|
-
// return indices.length === 0 ? null : fragment.items[fragment.index]
|
|
189
|
-
// }
|
package/src/items/Link.svelte
CHANGED
package/src/items/Node.svelte
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
33
33
|
<node
|
|
34
34
|
id={'id-' + path.join('-')}
|
|
35
|
-
class="flex flex-row h-
|
|
35
|
+
class="flex flex-row min-h-5 items-center cursor-pointer select-none"
|
|
36
36
|
class:is-selected={selected}
|
|
37
37
|
aria-selected={selected}
|
|
38
38
|
role="option"
|
package/src/items/Pill.svelte
CHANGED
|
@@ -1,19 +1,33 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { createEventDispatcher } from 'svelte'
|
|
3
|
-
import { defaultStateIcons } from '../constants'
|
|
4
|
-
|
|
3
|
+
import { defaultFields, defaultStateIcons } from '../constants'
|
|
4
|
+
import Text from './Text.svelte'
|
|
5
5
|
const dispatch = createEventDispatcher()
|
|
6
6
|
|
|
7
|
-
export let
|
|
8
|
-
export let fields
|
|
7
|
+
export let value
|
|
8
|
+
export let fields = defaultFields
|
|
9
|
+
export let using = { default: Text }
|
|
10
|
+
export let removable = false
|
|
9
11
|
|
|
10
12
|
function handleClick() {
|
|
11
|
-
dispatch('remove',
|
|
13
|
+
dispatch('remove', value)
|
|
12
14
|
}
|
|
15
|
+
$: component =
|
|
16
|
+
typeof value == 'object'
|
|
17
|
+
? using[value[fields.component] ?? 'default']
|
|
18
|
+
: using.default
|
|
19
|
+
$: console.log(value, component)
|
|
13
20
|
</script>
|
|
14
21
|
|
|
15
22
|
<pill class="flex flex-row items-center">
|
|
16
|
-
|
|
23
|
+
<item class="flex flex-row items-center">
|
|
24
|
+
<svelte:component this={component} content={value} {fields} />
|
|
25
|
+
</item>
|
|
17
26
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
18
|
-
|
|
27
|
+
{#if removable}
|
|
28
|
+
<icon
|
|
29
|
+
class="{defaultStateIcons.action.remove} cursor-pointer"
|
|
30
|
+
on:click={handleClick}
|
|
31
|
+
/>
|
|
32
|
+
{/if}
|
|
19
33
|
</pill>
|