goodteditor-ui 2.0.1 → 2.0.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goodteditor-ui",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "main": "index.js",
5
5
  "homepage": "https://goodt-ui.netlify.app/",
6
6
  "scripts": {
@@ -33,7 +33,7 @@
33
33
  "less": "^3.13.1",
34
34
  "netlify-cli": "^5.0.1",
35
35
  "vue-styleguidist": "^4.72.4",
36
- "vite": "^6.0.0",
36
+ "vite": "^5.4.11",
37
37
  "@vitejs/plugin-vue": "^5.1.2"
38
38
  },
39
39
  "peerDependencies": {
@@ -79,18 +79,18 @@ export default {
79
79
  render() {
80
80
  const { wrapTag, slotNames, gridStyle, getSlotStyle, $slots } = this;
81
81
  const children = slotNames.reduce((acc, name) => {
82
- const slot = $slots[name]?.();
82
+ const slot = $slots[name];
83
83
  if (!slot) {
84
84
  return acc;
85
85
  }
86
86
  const slotChild = slot({ style: getSlotStyle(name) });
87
- return {
87
+ return [
88
88
  ...acc,
89
- [name]: wrapTag
89
+ wrapTag
90
90
  ? h(wrapTag, { style: getSlotStyle(name), key: name }, slotChild)
91
91
  : slotChild,
92
- };
93
- }, {});
92
+ ];
93
+ }, []);
94
94
  return h('div', { class: 'ui-grid', style: gridStyle }, children);
95
95
  },
96
96
  };
@@ -88,19 +88,19 @@ export default {
88
88
  },
89
89
  render() {
90
90
  const { breakpoint, width, height } = this;
91
- /*
91
+ /**
92
92
  @slot Page data slot
93
93
  @binding {string} breakpoint breakpoint name
94
94
  @binding {number} width current container width (px)
95
95
  @binding {number} height current container height (px)
96
96
  */
97
- const content = this.$slots.default?.() != null
97
+ const content = this.$slots.default != null
98
98
  ? this.$slots.default({ breakpoint, width, height })
99
99
  : null;
100
100
  if (content?.length > 1) {
101
101
  return h('div', 'Slot content should have one child');
102
102
  }
103
- return content;
103
+ return h('div', content);
104
104
  },
105
105
  };
106
106
  </script>
@@ -108,7 +108,32 @@
108
108
  </template>
109
109
  <template #option="{ option, index, cursorIndex }">
110
110
  <!--
111
- @slot Label slot for single mode
111
+ @slot before option slot
112
+ @binding {Object} option option
113
+ @binding {any} value option's value
114
+ @binding {String} label option's label
115
+ @binding {Number} index option's index
116
+ @binding {Boolean} isSelected option selection status
117
+ @binding {Number} cursorIndex current cursor index
118
+ @binding {Function} selectOption function that selects option
119
+ @binding {Function} deselectOption function that deselects option
120
+ @binding {Function} toggleOption function that toggles option selection
121
+ -->
122
+ <slot
123
+ name="option:before"
124
+ v-bind="{
125
+ option,
126
+ value: getOptionValue(option),
127
+ label: getOptionLabel(option),
128
+ index,
129
+ cursorIndex,
130
+ isSelected: isOptionSelected(option),
131
+ selectOption,
132
+ deselectOption,
133
+ toggleOption
134
+ }"></slot>
135
+ <!--
136
+ @slot option slot mode
112
137
  @binding {Object} option option
113
138
  @binding {any} value option's value
114
139
  @binding {String} label option's label
@@ -168,7 +193,7 @@
168
193
  </div>
169
194
  <div class="text-truncate" style="min-height: calc(var(--line-height) * 1rem)" v-else>
170
195
  <!--
171
- @slot select option label slot
196
+ @slot option content slot
172
197
  -->
173
198
  <slot
174
199
  name="option-label"
@@ -185,6 +210,31 @@
185
210
  </div>
186
211
  </li>
187
212
  </slot>
213
+ <!--
214
+ @slot after option slot
215
+ @binding {Object} option option
216
+ @binding {any} value option's value
217
+ @binding {String} label option's label
218
+ @binding {Number} index option's index
219
+ @binding {Boolean} isSelected option selection status
220
+ @binding {Number} cursorIndex current cursor index
221
+ @binding {Function} selectOption function that selects option
222
+ @binding {Function} deselectOption function that deselects option
223
+ @binding {Function} toggleOption function that toggles option selection
224
+ -->
225
+ <slot
226
+ name="option:after"
227
+ v-bind="{
228
+ option,
229
+ value: getOptionValue(option),
230
+ label: getOptionLabel(option),
231
+ index,
232
+ isSelected: isOptionSelected(option),
233
+ cursorIndex,
234
+ selectOption,
235
+ deselectOption,
236
+ toggleOption
237
+ }"></slot>
188
238
  </template>
189
239
  <template #footer>
190
240
  <!--
@@ -350,7 +400,9 @@ export default {
350
400
  importModel(model) {
351
401
  const { options, isValueOfOption } = this;
352
402
  const models = [model].flat();
353
- const optionsSelected = options.filter((option) => models.some((modelItem) => isValueOfOption(option, modelItem)));
403
+ const optionsSelected = options.filter((option) =>
404
+ models.some((modelItem) => isValueOfOption(option, modelItem))
405
+ );
354
406
  if (optionsSelected.length > 0) {
355
407
  this.dataListCursorIndex = this.getOptionIndex(optionsSelected[0]);
356
408
  this.optionsSelected = this.multiple ? optionsSelected : [optionsSelected[0]];