@fastkit/vui 0.7.44 → 0.7.46

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/dist/vui.cjs.js CHANGED
@@ -355,6 +355,9 @@ function defineFormSelectorComponent(opts) {
355
355
  },
356
356
 
357
357
  render() {
358
+ const {
359
+ selectorControl
360
+ } = this;
358
361
  return vue.createVNode(VFormControl, {
359
362
  "nodeControl": this.nodeControl,
360
363
  "focused": this.nodeControl.focused,
@@ -369,14 +372,20 @@ function defineFormSelectorComponent(opts) {
369
372
  }, { ...this.$slots,
370
373
  default: () => vue.createVNode("div", {
371
374
  "class": "v-form-selector__body"
372
- }, [this.propItems.map(attrs => itemRenderer({
373
- attrs: { ...attrs,
374
- key: attrs.value
375
- },
376
- slots: {
377
- default: () => attrs.label(this.selectorControl)
378
- }
379
- })), vueKit.renderSlotOrEmpty(this.$slots, 'default')])
375
+ }, [this.propItems.map(attrs => {
376
+ const selected = selectorControl.isSelected(attrs.value);
377
+ return itemRenderer({
378
+ selected,
379
+ control: selectorControl,
380
+ attrs: { ...attrs,
381
+ modelValue: selected,
382
+ key: attrs.value
383
+ },
384
+ slots: {
385
+ default: () => attrs.label(this.selectorControl)
386
+ }
387
+ });
388
+ }), vueKit.renderSlotOrEmpty(this.$slots, 'default')])
380
389
  });
381
390
  }
382
391
 
@@ -355,6 +355,9 @@ function defineFormSelectorComponent(opts) {
355
355
  },
356
356
 
357
357
  render() {
358
+ const {
359
+ selectorControl
360
+ } = this;
358
361
  return vue.createVNode(VFormControl, {
359
362
  "nodeControl": this.nodeControl,
360
363
  "focused": this.nodeControl.focused,
@@ -369,14 +372,20 @@ function defineFormSelectorComponent(opts) {
369
372
  }, { ...this.$slots,
370
373
  default: () => vue.createVNode("div", {
371
374
  "class": "v-form-selector__body"
372
- }, [this.propItems.map(attrs => itemRenderer({
373
- attrs: { ...attrs,
374
- key: attrs.value
375
- },
376
- slots: {
377
- default: () => attrs.label(this.selectorControl)
378
- }
379
- })), vueKit.renderSlotOrEmpty(this.$slots, 'default')])
375
+ }, [this.propItems.map(attrs => {
376
+ const selected = selectorControl.isSelected(attrs.value);
377
+ return itemRenderer({
378
+ selected,
379
+ control: selectorControl,
380
+ attrs: { ...attrs,
381
+ modelValue: selected,
382
+ key: attrs.value
383
+ },
384
+ slots: {
385
+ default: () => attrs.label(this.selectorControl)
386
+ }
387
+ });
388
+ }), vueKit.renderSlotOrEmpty(this.$slots, 'default')])
380
389
  });
381
390
  }
382
391
 
package/dist/vui.d.ts CHANGED
@@ -1164,7 +1164,10 @@ export declare interface DefineFormSelectorComponentOptions {
1164
1164
  nodeType: string;
1165
1165
  className: string;
1166
1166
  itemRenderer: (ctx: {
1167
+ control: FormSelectorControl;
1168
+ selected: boolean;
1167
1169
  attrs: ResolvedFormSelectorItemData & {
1170
+ modelValue: boolean;
1168
1171
  key: string | number;
1169
1172
  };
1170
1173
  slots: {
package/dist/vui.mjs CHANGED
@@ -350,6 +350,9 @@ function defineFormSelectorComponent(opts) {
350
350
  },
351
351
 
352
352
  render() {
353
+ const {
354
+ selectorControl
355
+ } = this;
353
356
  return createVNode(VFormControl, {
354
357
  "nodeControl": this.nodeControl,
355
358
  "focused": this.nodeControl.focused,
@@ -364,14 +367,20 @@ function defineFormSelectorComponent(opts) {
364
367
  }, { ...this.$slots,
365
368
  default: () => createVNode("div", {
366
369
  "class": "v-form-selector__body"
367
- }, [this.propItems.map(attrs => itemRenderer({
368
- attrs: { ...attrs,
369
- key: attrs.value
370
- },
371
- slots: {
372
- default: () => attrs.label(this.selectorControl)
373
- }
374
- })), renderSlotOrEmpty(this.$slots, 'default')])
370
+ }, [this.propItems.map(attrs => {
371
+ const selected = selectorControl.isSelected(attrs.value);
372
+ return itemRenderer({
373
+ selected,
374
+ control: selectorControl,
375
+ attrs: { ...attrs,
376
+ modelValue: selected,
377
+ key: attrs.value
378
+ },
379
+ slots: {
380
+ default: () => attrs.label(this.selectorControl)
381
+ }
382
+ });
383
+ }), renderSlotOrEmpty(this.$slots, 'default')])
375
384
  });
376
385
  }
377
386
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastkit/vui",
3
- "version": "0.7.44",
3
+ "version": "0.7.46",
4
4
  "description": "@fastkit/vui",
5
5
  "buildOptions": {
6
6
  "name": "Vui",
@@ -32,11 +32,11 @@
32
32
  "vue": "^3.2.26"
33
33
  },
34
34
  "dependencies": {
35
- "@fastkit/color-scheme": "0.7.44",
36
- "@fastkit/icon-font": "0.7.44",
37
- "@fastkit/tiny-logger": "0.7.44",
38
- "@fastkit/vite-kit": "0.7.44",
39
- "@fastkit/vue-kit": "0.7.44",
35
+ "@fastkit/color-scheme": "0.7.46",
36
+ "@fastkit/icon-font": "0.7.46",
37
+ "@fastkit/tiny-logger": "0.7.46",
38
+ "@fastkit/vite-kit": "0.7.46",
39
+ "@fastkit/vue-kit": "0.7.46",
40
40
  "@tiptap/extension-link": "^2.0.0-beta.36",
41
41
  "@tiptap/extension-underline": "^2.0.0-beta.23",
42
42
  "@tiptap/starter-kit": "^2.0.0-beta.183",
@@ -7,6 +7,7 @@ import {
7
7
  createFormSelectorSettings,
8
8
  FormControlSlots,
9
9
  useFormSelectorControl,
10
+ FormSelectorControl,
10
11
  ResolvedFormSelectorItemData,
11
12
  FormNodeControl,
12
13
  renderSlotOrEmpty,
@@ -20,7 +21,12 @@ export interface DefineFormSelectorComponentOptions {
20
21
  nodeType: string;
21
22
  className: string;
22
23
  itemRenderer: (ctx: {
23
- attrs: ResolvedFormSelectorItemData & { key: string | number };
24
+ control: FormSelectorControl;
25
+ selected: boolean;
26
+ attrs: ResolvedFormSelectorItemData & {
27
+ modelValue: boolean;
28
+ key: string | number;
29
+ };
24
30
  slots: {
25
31
  default: TypedSlot<FormNodeControl>;
26
32
  };
@@ -60,6 +66,7 @@ export function defineFormSelectorComponent(
60
66
  };
61
67
  },
62
68
  render() {
69
+ const { selectorControl } = this;
63
70
  return (
64
71
  <VFormControl
65
72
  nodeControl={this.nodeControl}
@@ -81,17 +88,21 @@ export function defineFormSelectorComponent(
81
88
  ...this.$slots,
82
89
  default: () => (
83
90
  <div class="v-form-selector__body">
84
- {this.propItems.map((attrs) =>
85
- itemRenderer({
91
+ {this.propItems.map((attrs) => {
92
+ const selected = selectorControl.isSelected(attrs.value);
93
+ return itemRenderer({
94
+ selected,
95
+ control: selectorControl,
86
96
  attrs: {
87
97
  ...attrs,
98
+ modelValue: selected,
88
99
  key: attrs.value,
89
100
  },
90
101
  slots: {
91
102
  default: () => attrs.label(this.selectorControl),
92
103
  },
93
- }),
94
- )}
104
+ });
105
+ })}
95
106
  {renderSlotOrEmpty(this.$slots, 'default')}
96
107
  </div>
97
108
  ),