@fastkit/vui 0.7.17 → 0.7.19

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
@@ -208,6 +208,30 @@ const {
208
208
  props: props$8,
209
209
  emits: emits$8
210
210
  } = vueKit.createFormControlSettings();
211
+ function createRequiredChipRenderer(required, props, vui = useVui()) {
212
+ return () => {
213
+ if (!required()) return;
214
+ let chip;
215
+ const {
216
+ requiredChip
217
+ } = props;
218
+ if (requiredChip === false) return;
219
+
220
+ if (requiredChip) {
221
+ if (typeof requiredChip === 'string') {
222
+ chip = requiredChip;
223
+ } else if (typeof requiredChip === 'function') {
224
+ chip = requiredChip();
225
+ }
226
+ }
227
+
228
+ if (chip === undefined) {
229
+ chip = vui.getRequiredChip();
230
+ }
231
+
232
+ return chip;
233
+ };
234
+ }
211
235
  const VFormControl = vue.defineComponent({
212
236
  name: 'VFormControl',
213
237
  props: { ...props$8,
@@ -238,6 +262,7 @@ const VFormControl = vue.defineComponent({
238
262
  'v-form-control--invalid': control.invalid,
239
263
  'v-form-control--valid': control.valid
240
264
  }, colorProvider.className(control.invalid && !control.readonly ? 'error' : 'primary')]);
265
+ const getRequiredChip = createRequiredChipRenderer(() => control.required, props, vui);
241
266
  return () => {
242
267
  const label = control.renderLabel();
243
268
  const message = control.renderMessage();
@@ -250,7 +275,7 @@ const VFormControl = vue.defineComponent({
250
275
  "onClick": ev => {
251
276
  ctx.emit('clickLabel', ev, control);
252
277
  }
253
- }, [label, control.required && vui.getRequiredChip(), hinttip && vue.createVNode(vueKit.VTooltip, {
278
+ }, [label, getRequiredChip(), hinttip && vue.createVNode(vueKit.VTooltip, {
254
279
  "top": true,
255
280
  "openOnHover": false
256
281
  }, {
@@ -322,7 +347,8 @@ function defineFormSelectorComponent(opts) {
322
347
  }],
323
348
  "label": this.label,
324
349
  "hint": this.hint,
325
- "hinttip": this.hinttip
350
+ "hinttip": this.hinttip,
351
+ "requiredChip": this.requiredChip
326
352
  }, { ...this.$slots,
327
353
  default: () => vue.createVNode("div", {
328
354
  "class": "v-form-selector__body"
@@ -2060,6 +2086,7 @@ const VSelect = vue.defineComponent({
2060
2086
  "hint": this.hint,
2061
2087
  "hinttip": this.hinttip,
2062
2088
  "hiddenInfo": this.hiddenInfo,
2089
+ "requiredChip": this.requiredChip,
2063
2090
  "onClickLabel": ev => {
2064
2091
  this.focus();
2065
2092
  }
@@ -2194,6 +2221,7 @@ const VTextField = vue.defineComponent({
2194
2221
  "label": this.label,
2195
2222
  "hint": this.hint,
2196
2223
  "hinttip": this.hinttip,
2224
+ "requiredChip": this.requiredChip,
2197
2225
  "onClickLabel": ev => {
2198
2226
  this.focus();
2199
2227
  }
@@ -2256,6 +2284,7 @@ const VTextarea = vue.defineComponent({
2256
2284
  "hint": this.hint,
2257
2285
  "hinttip": this.hinttip,
2258
2286
  "hiddenInfo": this.hiddenInfo,
2287
+ "requiredChip": this.requiredChip,
2259
2288
  "onClickLabel": ev => {
2260
2289
  this.focus();
2261
2290
  }
@@ -2479,6 +2508,7 @@ const VWysiwygEditor = vue.defineComponent({
2479
2508
  "hint": this.hint,
2480
2509
  "hinttip": this.hinttip,
2481
2510
  "hiddenInfo": this.hiddenInfo,
2511
+ "requiredChip": this.requiredChip,
2482
2512
  "onClickLabel": ev => {
2483
2513
  this.focus('start', {
2484
2514
  scrollIntoView: true
@@ -4371,6 +4401,7 @@ exports.createListTileProps = createListTileProps;
4371
4401
  exports.createNavigationItemProps = createNavigationItemProps;
4372
4402
  exports.createPaperBaseProps = createPaperBaseProps;
4373
4403
  exports.createPaperProps = createPaperProps;
4404
+ exports.createRequiredChipRenderer = createRequiredChipRenderer;
4374
4405
  exports.defineFormSelectorComponent = defineFormSelectorComponent;
4375
4406
  exports.iconProps = iconProps;
4376
4407
  exports.installVuiPlugin = installVuiPlugin;
@@ -208,6 +208,30 @@ const {
208
208
  props: props$8,
209
209
  emits: emits$8
210
210
  } = vueKit.createFormControlSettings();
211
+ function createRequiredChipRenderer(required, props, vui = useVui()) {
212
+ return () => {
213
+ if (!required()) return;
214
+ let chip;
215
+ const {
216
+ requiredChip
217
+ } = props;
218
+ if (requiredChip === false) return;
219
+
220
+ if (requiredChip) {
221
+ if (typeof requiredChip === 'string') {
222
+ chip = requiredChip;
223
+ } else if (typeof requiredChip === 'function') {
224
+ chip = requiredChip();
225
+ }
226
+ }
227
+
228
+ if (chip === undefined) {
229
+ chip = vui.getRequiredChip();
230
+ }
231
+
232
+ return chip;
233
+ };
234
+ }
211
235
  const VFormControl = vue.defineComponent({
212
236
  name: 'VFormControl',
213
237
  props: { ...props$8,
@@ -238,6 +262,7 @@ const VFormControl = vue.defineComponent({
238
262
  'v-form-control--invalid': control.invalid,
239
263
  'v-form-control--valid': control.valid
240
264
  }, colorProvider.className(control.invalid && !control.readonly ? 'error' : 'primary')]);
265
+ const getRequiredChip = createRequiredChipRenderer(() => control.required, props, vui);
241
266
  return () => {
242
267
  const label = control.renderLabel();
243
268
  const message = control.renderMessage();
@@ -250,7 +275,7 @@ const VFormControl = vue.defineComponent({
250
275
  "onClick": ev => {
251
276
  ctx.emit('clickLabel', ev, control);
252
277
  }
253
- }, [label, control.required && vui.getRequiredChip(), hinttip && vue.createVNode(vueKit.VTooltip, {
278
+ }, [label, getRequiredChip(), hinttip && vue.createVNode(vueKit.VTooltip, {
254
279
  "top": true,
255
280
  "openOnHover": false
256
281
  }, {
@@ -322,7 +347,8 @@ function defineFormSelectorComponent(opts) {
322
347
  }],
323
348
  "label": this.label,
324
349
  "hint": this.hint,
325
- "hinttip": this.hinttip
350
+ "hinttip": this.hinttip,
351
+ "requiredChip": this.requiredChip
326
352
  }, { ...this.$slots,
327
353
  default: () => vue.createVNode("div", {
328
354
  "class": "v-form-selector__body"
@@ -2060,6 +2086,7 @@ const VSelect = vue.defineComponent({
2060
2086
  "hint": this.hint,
2061
2087
  "hinttip": this.hinttip,
2062
2088
  "hiddenInfo": this.hiddenInfo,
2089
+ "requiredChip": this.requiredChip,
2063
2090
  "onClickLabel": ev => {
2064
2091
  this.focus();
2065
2092
  }
@@ -2194,6 +2221,7 @@ const VTextField = vue.defineComponent({
2194
2221
  "label": this.label,
2195
2222
  "hint": this.hint,
2196
2223
  "hinttip": this.hinttip,
2224
+ "requiredChip": this.requiredChip,
2197
2225
  "onClickLabel": ev => {
2198
2226
  this.focus();
2199
2227
  }
@@ -2256,6 +2284,7 @@ const VTextarea = vue.defineComponent({
2256
2284
  "hint": this.hint,
2257
2285
  "hinttip": this.hinttip,
2258
2286
  "hiddenInfo": this.hiddenInfo,
2287
+ "requiredChip": this.requiredChip,
2259
2288
  "onClickLabel": ev => {
2260
2289
  this.focus();
2261
2290
  }
@@ -2479,6 +2508,7 @@ const VWysiwygEditor = vue.defineComponent({
2479
2508
  "hint": this.hint,
2480
2509
  "hinttip": this.hinttip,
2481
2510
  "hiddenInfo": this.hiddenInfo,
2511
+ "requiredChip": this.requiredChip,
2482
2512
  "onClickLabel": ev => {
2483
2513
  this.focus('start', {
2484
2514
  scrollIntoView: true
@@ -4371,6 +4401,7 @@ exports.createListTileProps = createListTileProps;
4371
4401
  exports.createNavigationItemProps = createNavigationItemProps;
4372
4402
  exports.createPaperBaseProps = createPaperBaseProps;
4373
4403
  exports.createPaperProps = createPaperProps;
4404
+ exports.createRequiredChipRenderer = createRequiredChipRenderer;
4374
4405
  exports.defineFormSelectorComponent = defineFormSelectorComponent;
4375
4406
  exports.iconProps = iconProps;
4376
4407
  exports.installVuiPlugin = installVuiPlugin;
package/dist/vui.d.ts CHANGED
@@ -48,6 +48,7 @@ import { RawTextareaAutosizeSettings } from '@fastkit/vue-kit';
48
48
  import { Ref } from 'vue';
49
49
  import { RendererElement } from 'vue';
50
50
  import { RendererNode } from 'vue';
51
+ import { RequiredChipSource } from '@fastkit/vue-kit';
51
52
  import { ResolvedFormSelectorItemData } from '@fastkit/vue-kit';
52
53
  import { ResolveRawSlots } from '@fastkit/vue-kit';
53
54
  import { ResolveRawSlots as ResolveRawSlots_2 } from '@fastkit/vue-utils';
@@ -805,6 +806,10 @@ export declare function createPaperProps(): {
805
806
  elevation: PropType<VuiElevationValue>;
806
807
  };
807
808
 
809
+ export declare function createRequiredChipRenderer(required: () => boolean, props: {
810
+ requiredChip?: RequiredChipSource;
811
+ }, vui?: VuiService): () => VNodeChild;
812
+
808
813
  declare function createTextFieldProps(): {
809
814
  'v-slots': PropType<ResolveRawSlots<FormControlSlots & InputBoxSlots>>;
810
815
  size: {
@@ -843,6 +848,7 @@ declare function createTextFieldProps(): {
843
848
  invalid: BooleanConstructor;
844
849
  valid: BooleanConstructor;
845
850
  hiddenInfo: BooleanConstructor;
851
+ requiredChip: PropType<RequiredChipSource>;
846
852
  type: {
847
853
  type: PropType<"number" | "search" | "email" | "tel" | "url" | "color" | "date" | "datetime-local" | "month" | "password" | "text" | "time">;
848
854
  default: string;
@@ -959,6 +965,7 @@ export declare function defineFormSelectorComponent(opts: DefineFormSelectorComp
959
965
  invalid: BooleanConstructor;
960
966
  valid: BooleanConstructor;
961
967
  hiddenInfo: BooleanConstructor;
968
+ requiredChip: PropType<RequiredChipSource>;
962
969
  multiple: {
963
970
  type: BooleanConstructor;
964
971
  default: boolean;
@@ -1067,6 +1074,7 @@ export declare function defineFormSelectorComponent(opts: DefineFormSelectorComp
1067
1074
  invalid?: unknown;
1068
1075
  valid?: unknown;
1069
1076
  hiddenInfo?: unknown;
1077
+ requiredChip?: unknown;
1070
1078
  multiple?: unknown;
1071
1079
  items?: unknown;
1072
1080
  name?: unknown;
@@ -1113,6 +1121,7 @@ export declare function defineFormSelectorComponent(opts: DefineFormSelectorComp
1113
1121
  hint?: VNodeChildOrSlot<any>;
1114
1122
  hinttip?: string | boolean | (() => VNodeChild) | undefined;
1115
1123
  infoAppends?: VNodeChildOrSlot<any>;
1124
+ requiredChip?: RequiredChipSource | undefined;
1116
1125
  size?: "sm" | "md" | "lg" | undefined;
1117
1126
  "v-slots"?: ResolveRawSlots<FormControlSlots> | undefined;
1118
1127
  }> & {
@@ -3595,6 +3604,7 @@ export declare const VCheckboxGroup: DefineComponent<{
3595
3604
  invalid: BooleanConstructor;
3596
3605
  valid: BooleanConstructor;
3597
3606
  hiddenInfo: BooleanConstructor;
3607
+ requiredChip: PropType<RequiredChipSource>;
3598
3608
  multiple: {
3599
3609
  type: BooleanConstructor;
3600
3610
  default: boolean;
@@ -3703,6 +3713,7 @@ export declare const VCheckboxGroup: DefineComponent<{
3703
3713
  invalid?: unknown;
3704
3714
  valid?: unknown;
3705
3715
  hiddenInfo?: unknown;
3716
+ requiredChip?: unknown;
3706
3717
  multiple?: unknown;
3707
3718
  items?: unknown;
3708
3719
  name?: unknown;
@@ -3749,6 +3760,7 @@ export declare const VCheckboxGroup: DefineComponent<{
3749
3760
  hint?: VNodeChildOrSlot<any>;
3750
3761
  hinttip?: string | boolean | (() => VNodeChild) | undefined;
3751
3762
  infoAppends?: VNodeChildOrSlot<any>;
3763
+ requiredChip?: RequiredChipSource | undefined;
3752
3764
  size?: "sm" | "md" | "lg" | undefined;
3753
3765
  "v-slots"?: ResolveRawSlots<FormControlSlots> | undefined;
3754
3766
  }> & {
@@ -4661,6 +4673,7 @@ export declare const VFormControl: DefineComponent<{
4661
4673
  invalid: BooleanConstructor;
4662
4674
  valid: BooleanConstructor;
4663
4675
  hiddenInfo: BooleanConstructor;
4676
+ requiredChip: PropType<RequiredChipSource>;
4664
4677
  }, () => JSX.Element, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
4665
4678
  clickLabel: (ev: MouseEvent, formControl: FormControl) => boolean;
4666
4679
  }, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{
@@ -4684,6 +4697,7 @@ export declare const VFormControl: DefineComponent<{
4684
4697
  invalid?: unknown;
4685
4698
  valid?: unknown;
4686
4699
  hiddenInfo?: unknown;
4700
+ requiredChip?: unknown;
4687
4701
  } & {
4688
4702
  validating: boolean;
4689
4703
  pending: boolean;
@@ -4705,6 +4719,7 @@ export declare const VFormControl: DefineComponent<{
4705
4719
  hint?: VNodeChildOrSlot<any>;
4706
4720
  hinttip?: string | boolean | (() => VNodeChild) | undefined;
4707
4721
  infoAppends?: VNodeChildOrSlot<any>;
4722
+ requiredChip?: RequiredChipSource | undefined;
4708
4723
  "v-slots"?: ResolveRawSlots<FormControlSlots & {
4709
4724
  default: FormControl;
4710
4725
  }> | undefined;
@@ -7595,6 +7610,7 @@ export declare const VRadioGroup: DefineComponent<{
7595
7610
  invalid: BooleanConstructor;
7596
7611
  valid: BooleanConstructor;
7597
7612
  hiddenInfo: BooleanConstructor;
7613
+ requiredChip: PropType<RequiredChipSource>;
7598
7614
  multiple: {
7599
7615
  type: BooleanConstructor;
7600
7616
  default: boolean;
@@ -7703,6 +7719,7 @@ export declare const VRadioGroup: DefineComponent<{
7703
7719
  invalid?: unknown;
7704
7720
  valid?: unknown;
7705
7721
  hiddenInfo?: unknown;
7722
+ requiredChip?: unknown;
7706
7723
  multiple?: unknown;
7707
7724
  items?: unknown;
7708
7725
  name?: unknown;
@@ -7749,6 +7766,7 @@ export declare const VRadioGroup: DefineComponent<{
7749
7766
  hint?: VNodeChildOrSlot<any>;
7750
7767
  hinttip?: string | boolean | (() => VNodeChild) | undefined;
7751
7768
  infoAppends?: VNodeChildOrSlot<any>;
7769
+ requiredChip?: RequiredChipSource | undefined;
7752
7770
  size?: "sm" | "md" | "lg" | undefined;
7753
7771
  "v-slots"?: ResolveRawSlots<FormControlSlots> | undefined;
7754
7772
  }> & {
@@ -7823,6 +7841,7 @@ export declare const VSelect: DefineComponent<{
7823
7841
  invalid: BooleanConstructor;
7824
7842
  valid: BooleanConstructor;
7825
7843
  hiddenInfo: BooleanConstructor;
7844
+ requiredChip: PropType<RequiredChipSource>;
7826
7845
  multiple: {
7827
7846
  type: BooleanConstructor;
7828
7847
  default: boolean;
@@ -7937,6 +7956,7 @@ export declare const VSelect: DefineComponent<{
7937
7956
  invalid?: unknown;
7938
7957
  valid?: unknown;
7939
7958
  hiddenInfo?: unknown;
7959
+ requiredChip?: unknown;
7940
7960
  multiple?: unknown;
7941
7961
  items?: unknown;
7942
7962
  name?: unknown;
@@ -7981,6 +8001,7 @@ export declare const VSelect: DefineComponent<{
7981
8001
  hint?: VNodeChildOrSlot<any>;
7982
8002
  hinttip?: string | boolean | (() => VNodeChild) | undefined;
7983
8003
  infoAppends?: VNodeChildOrSlot<any>;
8004
+ requiredChip?: RequiredChipSource | undefined;
7984
8005
  startAdornment?: VNodeChildOrSlot<any>;
7985
8006
  endAdornment?: VNodeChildOrSlot<any>;
7986
8007
  variant?: "flat" | "outlined" | "filled" | undefined;
@@ -8184,6 +8205,7 @@ export declare const VSwitchGroup: DefineComponent<{
8184
8205
  invalid: BooleanConstructor;
8185
8206
  valid: BooleanConstructor;
8186
8207
  hiddenInfo: BooleanConstructor;
8208
+ requiredChip: PropType<RequiredChipSource>;
8187
8209
  multiple: {
8188
8210
  type: BooleanConstructor;
8189
8211
  default: boolean;
@@ -8292,6 +8314,7 @@ export declare const VSwitchGroup: DefineComponent<{
8292
8314
  invalid?: unknown;
8293
8315
  valid?: unknown;
8294
8316
  hiddenInfo?: unknown;
8317
+ requiredChip?: unknown;
8295
8318
  multiple?: unknown;
8296
8319
  items?: unknown;
8297
8320
  name?: unknown;
@@ -8338,6 +8361,7 @@ export declare const VSwitchGroup: DefineComponent<{
8338
8361
  hint?: VNodeChildOrSlot<any>;
8339
8362
  hinttip?: string | boolean | (() => VNodeChild) | undefined;
8340
8363
  infoAppends?: VNodeChildOrSlot<any>;
8364
+ requiredChip?: RequiredChipSource | undefined;
8341
8365
  size?: "sm" | "md" | "lg" | undefined;
8342
8366
  "v-slots"?: ResolveRawSlots<FormControlSlots> | undefined;
8343
8367
  }> & {
@@ -8483,6 +8507,7 @@ export declare const VTextarea: DefineComponent<{
8483
8507
  invalid: BooleanConstructor;
8484
8508
  valid: BooleanConstructor;
8485
8509
  hiddenInfo: BooleanConstructor;
8510
+ requiredChip: PropType<RequiredChipSource>;
8486
8511
  autosize: PropType<RawTextareaAutosizeSettings>;
8487
8512
  rows: {
8488
8513
  default: number | undefined;
@@ -8596,6 +8621,7 @@ export declare const VTextarea: DefineComponent<{
8596
8621
  invalid?: unknown;
8597
8622
  valid?: unknown;
8598
8623
  hiddenInfo?: unknown;
8624
+ requiredChip?: unknown;
8599
8625
  autosize?: unknown;
8600
8626
  rows?: unknown;
8601
8627
  mask?: unknown;
@@ -8661,6 +8687,7 @@ export declare const VTextarea: DefineComponent<{
8661
8687
  hint?: VNodeChildOrSlot<any>;
8662
8688
  hinttip?: string | boolean | (() => VNodeChild) | undefined;
8663
8689
  infoAppends?: VNodeChildOrSlot<any>;
8690
+ requiredChip?: RequiredChipSource | undefined;
8664
8691
  startAdornment?: VNodeChildOrSlot<any>;
8665
8692
  endAdornment?: VNodeChildOrSlot<any>;
8666
8693
  variant?: "flat" | "outlined" | "filled" | undefined;
@@ -8737,6 +8764,7 @@ export declare const VTextField: DefineComponent<{
8737
8764
  invalid: BooleanConstructor;
8738
8765
  valid: BooleanConstructor;
8739
8766
  hiddenInfo: BooleanConstructor;
8767
+ requiredChip: PropType<RequiredChipSource>;
8740
8768
  type: {
8741
8769
  type: PropType<"number" | "search" | "email" | "tel" | "url" | "color" | "date" | "datetime-local" | "month" | "password" | "text" | "time">;
8742
8770
  default: string;
@@ -8854,6 +8882,7 @@ export declare const VTextField: DefineComponent<{
8854
8882
  invalid?: unknown;
8855
8883
  valid?: unknown;
8856
8884
  hiddenInfo?: unknown;
8885
+ requiredChip?: unknown;
8857
8886
  type?: unknown;
8858
8887
  masked?: unknown;
8859
8888
  typed?: unknown;
@@ -8923,6 +8952,7 @@ export declare const VTextField: DefineComponent<{
8923
8952
  hint?: VNodeChildOrSlot<any>;
8924
8953
  hinttip?: string | boolean | (() => VNodeChild) | undefined;
8925
8954
  infoAppends?: VNodeChildOrSlot<any>;
8955
+ requiredChip?: RequiredChipSource | undefined;
8926
8956
  startAdornment?: VNodeChildOrSlot<any>;
8927
8957
  endAdornment?: VNodeChildOrSlot<any>;
8928
8958
  variant?: "flat" | "outlined" | "filled" | undefined;
@@ -10107,6 +10137,7 @@ export declare const VWysiwygEditor: DefineComponent<{
10107
10137
  invalid: BooleanConstructor;
10108
10138
  valid: BooleanConstructor;
10109
10139
  hiddenInfo: BooleanConstructor;
10140
+ requiredChip: PropType<RequiredChipSource>;
10110
10141
  minlength: (StringConstructor | NumberConstructor)[];
10111
10142
  maxlength: (StringConstructor | NumberConstructor)[];
10112
10143
  pattern: (StringConstructor | RegExpConstructor)[];
@@ -10215,6 +10246,7 @@ export declare const VWysiwygEditor: DefineComponent<{
10215
10246
  invalid?: unknown;
10216
10247
  valid?: unknown;
10217
10248
  hiddenInfo?: unknown;
10249
+ requiredChip?: unknown;
10218
10250
  minlength?: unknown;
10219
10251
  maxlength?: unknown;
10220
10252
  pattern?: unknown;
@@ -10279,6 +10311,7 @@ export declare const VWysiwygEditor: DefineComponent<{
10279
10311
  hint?: VNodeChildOrSlot<any>;
10280
10312
  hinttip?: string | boolean | (() => VNodeChild) | undefined;
10281
10313
  infoAppends?: VNodeChildOrSlot<any>;
10314
+ requiredChip?: RequiredChipSource | undefined;
10282
10315
  startAdornment?: VNodeChildOrSlot<any>;
10283
10316
  endAdornment?: VNodeChildOrSlot<any>;
10284
10317
  variant?: "flat" | "outlined" | "filled" | undefined;
package/dist/vui.mjs CHANGED
@@ -203,6 +203,30 @@ const {
203
203
  props: props$8,
204
204
  emits: emits$8
205
205
  } = createFormControlSettings();
206
+ function createRequiredChipRenderer(required, props, vui = useVui()) {
207
+ return () => {
208
+ if (!required()) return;
209
+ let chip;
210
+ const {
211
+ requiredChip
212
+ } = props;
213
+ if (requiredChip === false) return;
214
+
215
+ if (requiredChip) {
216
+ if (typeof requiredChip === 'string') {
217
+ chip = requiredChip;
218
+ } else if (typeof requiredChip === 'function') {
219
+ chip = requiredChip();
220
+ }
221
+ }
222
+
223
+ if (chip === undefined) {
224
+ chip = vui.getRequiredChip();
225
+ }
226
+
227
+ return chip;
228
+ };
229
+ }
206
230
  const VFormControl = defineComponent({
207
231
  name: 'VFormControl',
208
232
  props: { ...props$8,
@@ -233,6 +257,7 @@ const VFormControl = defineComponent({
233
257
  'v-form-control--invalid': control.invalid,
234
258
  'v-form-control--valid': control.valid
235
259
  }, colorProvider.className(control.invalid && !control.readonly ? 'error' : 'primary')]);
260
+ const getRequiredChip = createRequiredChipRenderer(() => control.required, props, vui);
236
261
  return () => {
237
262
  const label = control.renderLabel();
238
263
  const message = control.renderMessage();
@@ -245,7 +270,7 @@ const VFormControl = defineComponent({
245
270
  "onClick": ev => {
246
271
  ctx.emit('clickLabel', ev, control);
247
272
  }
248
- }, [label, control.required && vui.getRequiredChip(), hinttip && createVNode(VTooltip, {
273
+ }, [label, getRequiredChip(), hinttip && createVNode(VTooltip, {
249
274
  "top": true,
250
275
  "openOnHover": false
251
276
  }, {
@@ -317,7 +342,8 @@ function defineFormSelectorComponent(opts) {
317
342
  }],
318
343
  "label": this.label,
319
344
  "hint": this.hint,
320
- "hinttip": this.hinttip
345
+ "hinttip": this.hinttip,
346
+ "requiredChip": this.requiredChip
321
347
  }, { ...this.$slots,
322
348
  default: () => createVNode("div", {
323
349
  "class": "v-form-selector__body"
@@ -2055,6 +2081,7 @@ const VSelect = defineComponent({
2055
2081
  "hint": this.hint,
2056
2082
  "hinttip": this.hinttip,
2057
2083
  "hiddenInfo": this.hiddenInfo,
2084
+ "requiredChip": this.requiredChip,
2058
2085
  "onClickLabel": ev => {
2059
2086
  this.focus();
2060
2087
  }
@@ -2189,6 +2216,7 @@ const VTextField = defineComponent({
2189
2216
  "label": this.label,
2190
2217
  "hint": this.hint,
2191
2218
  "hinttip": this.hinttip,
2219
+ "requiredChip": this.requiredChip,
2192
2220
  "onClickLabel": ev => {
2193
2221
  this.focus();
2194
2222
  }
@@ -2251,6 +2279,7 @@ const VTextarea = defineComponent({
2251
2279
  "hint": this.hint,
2252
2280
  "hinttip": this.hinttip,
2253
2281
  "hiddenInfo": this.hiddenInfo,
2282
+ "requiredChip": this.requiredChip,
2254
2283
  "onClickLabel": ev => {
2255
2284
  this.focus();
2256
2285
  }
@@ -2474,6 +2503,7 @@ const VWysiwygEditor = defineComponent({
2474
2503
  "hint": this.hint,
2475
2504
  "hinttip": this.hinttip,
2476
2505
  "hiddenInfo": this.hiddenInfo,
2506
+ "requiredChip": this.requiredChip,
2477
2507
  "onClickLabel": ev => {
2478
2508
  this.focus('start', {
2479
2509
  scrollIntoView: true
@@ -4285,4 +4315,4 @@ function installVuiPlugin(app, opts) {
4285
4315
  return app.use(VuiPlugin, opts);
4286
4316
  }
4287
4317
 
4288
- export { CONTROL_FIELD_VARIANTS, CONTROL_SIZES, PAGINATION_ALIGNS, VApp, VBreadcrumbs, VButton, VButtonGroup, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VContentSwitcher, VDataTable, VDrawerLayout, VForm, VFormControl, VGridContainer, VGridItem, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, VSwitch, VSwitchGroup, VTabs, VTextField, VTextarea, VToolbar, VToolbarEdge, VToolbarMenu, VToolbarTitle, VUI_CHECKBOX_GROUP_SYMBOL, VUI_CHECKBOX_SYMBOL, VUI_FORM_SYMBOL, VUI_OPTION_SYMBOL, VUI_RADIO_GROUP_SYMBOL, VUI_RADIO_SYMBOL, VUI_SELECT_SYMBOL, VUI_SWITCH_GROUP_SYMBOL, VUI_SWITCH_SYMBOL, VUI_TEXTAREA_SYMBOL, VUI_TEXT_FIELD_SYMBOL, VUI_WYSIWYG_EDITOR_SYMBOL, VWysiwygEditor, VuiColorProviderInjectionKey, VuiControlFieldInjectionKey, VuiControlInjectionKey, VuiInjectionKey, VuiPlugin, VuiService, WysiwygBulletListTool, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygOrderedListTool, WysiwygTextColorTool, configureDataTableDefaults, createCardProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
4318
+ export { CONTROL_FIELD_VARIANTS, CONTROL_SIZES, PAGINATION_ALIGNS, VApp, VBreadcrumbs, VButton, VButtonGroup, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VContentSwitcher, VDataTable, VDrawerLayout, VForm, VFormControl, VGridContainer, VGridItem, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, VSwitch, VSwitchGroup, VTabs, VTextField, VTextarea, VToolbar, VToolbarEdge, VToolbarMenu, VToolbarTitle, VUI_CHECKBOX_GROUP_SYMBOL, VUI_CHECKBOX_SYMBOL, VUI_FORM_SYMBOL, VUI_OPTION_SYMBOL, VUI_RADIO_GROUP_SYMBOL, VUI_RADIO_SYMBOL, VUI_SELECT_SYMBOL, VUI_SWITCH_GROUP_SYMBOL, VUI_SWITCH_SYMBOL, VUI_TEXTAREA_SYMBOL, VUI_TEXT_FIELD_SYMBOL, VUI_WYSIWYG_EDITOR_SYMBOL, VWysiwygEditor, VuiColorProviderInjectionKey, VuiControlFieldInjectionKey, VuiControlInjectionKey, VuiInjectionKey, VuiPlugin, VuiService, WysiwygBulletListTool, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygOrderedListTool, WysiwygTextColorTool, configureDataTableDefaults, createCardProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, createRequiredChipRenderer, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastkit/vui",
3
- "version": "0.7.17",
3
+ "version": "0.7.19",
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.17",
36
- "@fastkit/icon-font": "0.7.17",
37
- "@fastkit/tiny-logger": "0.7.17",
38
- "@fastkit/vite-kit": "0.7.17",
39
- "@fastkit/vue-kit": "0.7.17",
35
+ "@fastkit/color-scheme": "0.7.19",
36
+ "@fastkit/icon-font": "0.7.19",
37
+ "@fastkit/tiny-logger": "0.7.19",
38
+ "@fastkit/vite-kit": "0.7.19",
39
+ "@fastkit/vue-kit": "0.7.19",
40
40
  "@tiptap/extension-link": "^2.0.0-beta.35",
41
41
  "@tiptap/extension-underline": "^2.0.0-beta.22",
42
42
  "@tiptap/starter-kit": "^2.0.0-beta.168",
@@ -1,5 +1,5 @@
1
1
  import './VFormControl.scss';
2
- import { computed, defineComponent } from 'vue';
2
+ import { computed, defineComponent, VNodeChild } from 'vue';
3
3
  import {
4
4
  createFormControlSettings,
5
5
  useFormControl,
@@ -7,13 +7,41 @@ import {
7
7
  defineSlotsProps,
8
8
  FormControl,
9
9
  renderSlotOrEmpty,
10
+ RequiredChipSource,
10
11
  } from '@fastkit/vue-kit';
11
12
  import { useVuiColorProvider, useVui } from '../../injections';
13
+ import type { VuiService } from '../../service';
12
14
  import { VIcon } from '../VIcon';
13
15
  import { VTooltip } from '../kits';
14
16
 
15
17
  const { props, emits } = createFormControlSettings();
16
18
 
19
+ export function createRequiredChipRenderer(
20
+ required: () => boolean,
21
+ props: {
22
+ requiredChip?: RequiredChipSource;
23
+ },
24
+ vui: VuiService = useVui(),
25
+ ) {
26
+ return () => {
27
+ if (!required()) return;
28
+ let chip: VNodeChild;
29
+ const { requiredChip } = props;
30
+ if (requiredChip === false) return;
31
+ if (requiredChip) {
32
+ if (typeof requiredChip === 'string') {
33
+ chip = requiredChip;
34
+ } else if (typeof requiredChip === 'function') {
35
+ chip = requiredChip();
36
+ }
37
+ }
38
+ if (chip === undefined) {
39
+ chip = vui.getRequiredChip();
40
+ }
41
+ return chip;
42
+ };
43
+ }
44
+
17
45
  export const VFormControl = defineComponent({
18
46
  name: 'VFormControl',
19
47
  props: {
@@ -27,7 +55,6 @@ export const VFormControl = defineComponent({
27
55
  emits,
28
56
  setup(props, ctx) {
29
57
  const vui = useVui();
30
-
31
58
  const control = useFormControl(props, ctx, {
32
59
  hinttipPrepend: () => (
33
60
  <VIcon
@@ -60,6 +87,12 @@ export const VFormControl = defineComponent({
60
87
  ),
61
88
  ]);
62
89
 
90
+ const getRequiredChip = createRequiredChipRenderer(
91
+ () => control.required,
92
+ props,
93
+ vui,
94
+ );
95
+
63
96
  return () => {
64
97
  const label = control.renderLabel();
65
98
  const message = control.renderMessage();
@@ -75,7 +108,7 @@ export const VFormControl = defineComponent({
75
108
  ctx.emit('clickLabel', ev, control);
76
109
  }}>
77
110
  {label}
78
- {control.required && vui.getRequiredChip()}
111
+ {getRequiredChip()}
79
112
  {hinttip && (
80
113
  <VTooltip
81
114
  top
@@ -117,6 +117,7 @@ export const VSelect = defineComponent({
117
117
  hint={this.hint}
118
118
  hinttip={this.hinttip}
119
119
  hiddenInfo={this.hiddenInfo}
120
+ requiredChip={this.requiredChip}
120
121
  onClickLabel={(ev) => {
121
122
  this.focus();
122
123
  }}
@@ -66,6 +66,7 @@ export const VTextField = defineComponent({
66
66
  label={this.label}
67
67
  hint={this.hint}
68
68
  hinttip={this.hinttip}
69
+ requiredChip={this.requiredChip}
69
70
  onClickLabel={(ev) => {
70
71
  this.focus();
71
72
  }}
@@ -59,6 +59,7 @@ export const VTextarea = defineComponent({
59
59
  hint={this.hint}
60
60
  hinttip={this.hinttip}
61
61
  hiddenInfo={this.hiddenInfo}
62
+ requiredChip={this.requiredChip}
62
63
  onClickLabel={(ev) => {
63
64
  this.focus();
64
65
  }}
@@ -237,6 +237,7 @@ export const VWysiwygEditor = defineComponent({
237
237
  hint={this.hint}
238
238
  hinttip={this.hinttip}
239
239
  hiddenInfo={this.hiddenInfo}
240
+ requiredChip={this.requiredChip}
240
241
  onClickLabel={(ev) => {
241
242
  this.focus('start', { scrollIntoView: true });
242
243
  }}
@@ -76,6 +76,7 @@ export function defineFormSelectorComponent(
76
76
  label={this.label}
77
77
  hint={this.hint}
78
78
  hinttip={this.hinttip}
79
+ requiredChip={this.requiredChip}
79
80
  v-slots={{
80
81
  ...this.$slots,
81
82
  default: () => (
Binary file
package/src/.DS_Store DELETED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file