@likable-hair/svelte 3.0.73 → 3.0.75

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.
@@ -135,16 +135,45 @@ $:
135
135
  <slot name="append" item={item} {doUpdateItem}>
136
136
  </slot>
137
137
  </svelte:fragment>
138
+ <svelte:fragment slot="title" let:item let:doUpdateItem>
139
+ <slot name="title" item={item} {doUpdateItem}>
140
+ <input
141
+ value={item.title}
142
+ on:input|stopPropagation={(e) => {
143
+ // @ts-ignore
144
+ const { value } = e.target
145
+
146
+ item.title = value
147
+ doUpdateItem({
148
+ ...item,
149
+ title: value
150
+ }, {})
151
+
152
+ dispatch('input', {
153
+ item: item
154
+ })
155
+ }}
156
+ />
157
+ </slot>
158
+ </svelte:fragment>
138
159
  </TreeEditorItem>
139
160
  {/each}
140
161
  </ul>
141
162
  {/key}
142
163
 
143
164
  <style>
144
-
145
165
  .main-ul {
146
166
  padding: 0px;
147
167
  padding-bottom: 30px;
148
168
  list-style: none;
149
169
  }
170
+
171
+ input {
172
+ outline: none;
173
+ background-color: transparent;
174
+ font-size: inherit;
175
+ font-weight: inherit;
176
+ color: inherit;
177
+ border: none
178
+ }
150
179
  </style>
@@ -41,8 +41,12 @@ declare const __propDef: {
41
41
  };
42
42
  slots: {
43
43
  append: {
44
- item: Item;
45
- doUpdateItem: (item: Item, inputData: any) => void;
44
+ item: any;
45
+ doUpdateItem: any;
46
+ };
47
+ title: {
48
+ item: any;
49
+ doUpdateItem: any;
46
50
  };
47
51
  };
48
52
  };
@@ -43,9 +43,10 @@ $:
43
43
  if (!!subItems)
44
44
  initSortable();
45
45
  function doUpdateItem(item, inputData) {
46
- if (!updateItem)
47
- return;
48
- let newItem = updateItem({ item, inputData });
46
+ let newItem = item;
47
+ if (!!updateItem) {
48
+ newItem = updateItem({ item, inputData });
49
+ }
49
50
  dispatch("input", { item: newItem });
50
51
  }
51
52
  </script>
@@ -68,25 +69,31 @@ function doUpdateItem(item, inputData) {
68
69
  on:click={() => expanded = !expanded}
69
70
  >
70
71
  <Icon
71
- name="mdi-chevron-down"
72
+ name="mdi-chevron-right"
72
73
  ></Icon>
73
74
  </Button>
74
75
  </div>
75
76
  {/if}
76
77
  {#if editable}
77
- <input
78
- bind:value={title}
79
- on:input|stopPropagation={(e) => {
80
- dispatch('input', {
81
- item: currentItem
82
- })
83
- }}
84
- />
78
+ <slot name="title" item={currentItem} {doUpdateItem}>
79
+ <input
80
+ bind:value={title}
81
+ on:input|stopPropagation={(e) => {
82
+ dispatch('input', {
83
+ item: currentItem
84
+ })
85
+ }}
86
+ />
87
+ </slot>
85
88
  {:else}
86
89
  {title}
87
90
  {/if}
88
- <slot name="append" item={currentItem} {doUpdateItem}>
89
- </slot>
91
+ {#if !!$$slots.append}
92
+ <div style:margin-left="auto">
93
+ <slot name="append" item={currentItem} {doUpdateItem}>
94
+ </slot>
95
+ </div>
96
+ {/if}
90
97
  </div>
91
98
  <ul
92
99
  class="list-container"
@@ -116,7 +123,33 @@ function doUpdateItem(item, inputData) {
116
123
  }}
117
124
  on:input
118
125
  on:click
119
- ></svelte:self>
126
+ >
127
+ <svelte:fragment slot="append" let:item let:doUpdateItem >
128
+ <slot name="append" item={item} {doUpdateItem}>
129
+ </slot>
130
+ </svelte:fragment>
131
+ <svelte:fragment slot="title" let:item let:doUpdateItem>
132
+ <slot name="title" item={item} {doUpdateItem}>
133
+ <input
134
+ value={item.title}
135
+ on:input|stopPropagation={(e) => {
136
+ // @ts-ignore
137
+ const { value } = e.target
138
+
139
+ item.title = value
140
+ doUpdateItem({
141
+ ...item,
142
+ title: value
143
+ }, {})
144
+
145
+ dispatch('input', {
146
+ item: item
147
+ })
148
+ }}
149
+ />
150
+ </slot>
151
+ </svelte:fragment>
152
+ </svelte:self>
120
153
  {/each}
121
154
  {/if}
122
155
  </ul>
@@ -126,6 +159,7 @@ function doUpdateItem(item, inputData) {
126
159
  ul {
127
160
  min-height: 10px;
128
161
  list-style: none;
162
+ padding-inline-start: 30px;
129
163
  }
130
164
 
131
165
  .card-container {
@@ -161,7 +195,7 @@ function doUpdateItem(item, inputData) {
161
195
  }
162
196
 
163
197
  .button-container.reversed {
164
- transform: rotate(-90deg);
198
+ transform: rotate(90deg);
165
199
  }
166
200
 
167
201
  input {
@@ -37,9 +37,13 @@ declare const __propDef: {
37
37
  [evt: string]: CustomEvent<any>;
38
38
  };
39
39
  slots: {
40
+ title: {
41
+ item: any;
42
+ doUpdateItem: any;
43
+ };
40
44
  append: {
41
- item: Item;
42
- doUpdateItem: (item: Item, inputData: any) => void;
45
+ item: any;
46
+ doUpdateItem: any;
43
47
  };
44
48
  };
45
49
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@likable-hair/svelte",
3
3
  "description": "A Svelte component for likablehair",
4
- "version": "3.0.73",
4
+ "version": "3.0.75",
5
5
  "scripts": {
6
6
  "host": "vite --host",
7
7
  "dev": "vite dev",