@fastkit/vui 0.7.48 → 0.7.52

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
@@ -2684,6 +2684,48 @@ const VTextField = vue.defineComponent({
2684
2684
 
2685
2685
  });
2686
2686
 
2687
+ const VNumberField = vue.defineComponent({
2688
+ name: 'VNumberField',
2689
+ props: { ...undefined,
2690
+ modelValue: {
2691
+ type: Number,
2692
+ default: null
2693
+ }
2694
+ },
2695
+ emits: { ...undefined,
2696
+ 'update:modelValue': value => true,
2697
+ change: value => true
2698
+ },
2699
+
2700
+ setup(props, ctx) {
2701
+ const toString = value => {
2702
+ if (value == null) return '';
2703
+ return String(value);
2704
+ };
2705
+
2706
+ const toNumber = value => {
2707
+ if (value == null) return null;
2708
+ if (typeof value === 'number') return value;
2709
+ if (value.trim() === '') return null;
2710
+ return Number(value);
2711
+ };
2712
+
2713
+ return () => {
2714
+ return vue.createVNode(VTextField, vue.mergeProps(ctx.attrs, {
2715
+ "type": "number",
2716
+ "modelValue": toString(props.modelValue),
2717
+ "onUpdate:modelValue": value => {
2718
+ ctx.emit('update:modelValue', toNumber(value));
2719
+ },
2720
+ "onChange": value => {
2721
+ ctx.emit('change', toNumber(value));
2722
+ }
2723
+ }), ctx.slots);
2724
+ };
2725
+ }
2726
+
2727
+ });
2728
+
2687
2729
  const {
2688
2730
  props: props$1,
2689
2731
  emits: emits$1
@@ -2822,7 +2864,10 @@ const VWysiwygEditor = vue.defineComponent({
2822
2864
 
2823
2865
  vue.watch(() => inputControl.canOperation, updateEditable);
2824
2866
  vue.watch(() => props.modelValue, modelValue => {
2825
- editor.value && editor.value.commands.setContent(modelValue == null ? '' : modelValue);
2867
+ const $editor = editor.value;
2868
+ if (!$editor) return;
2869
+ $editor.commands.setContent(modelValue == null ? '' : modelValue);
2870
+ textRef.value = $editor.getText();
2826
2871
  });
2827
2872
  const editor = vue3.useEditor({
2828
2873
  onCreate: ({
@@ -3156,13 +3201,16 @@ const {
3156
3201
  } = vueKit.createFormSettings({
3157
3202
  nodeType: VUI_FORM_SYMBOL
3158
3203
  });
3159
- const VForm = vue.defineComponent({
3160
- name: 'VForm',
3161
- props: { ...props,
3204
+ function createVFormProps() {
3205
+ return { ...props,
3162
3206
  ...createControlProps(),
3163
3207
  ...vueKit.defineSlotsProps() // disableAutoScroll: Boolean,
3164
3208
 
3165
- },
3209
+ };
3210
+ }
3211
+ const VForm = vue.defineComponent({
3212
+ name: 'VForm',
3213
+ props: createVFormProps(),
3166
3214
  emits,
3167
3215
 
3168
3216
  setup(props, ctx) {
@@ -4947,6 +4995,7 @@ exports.VIcon = VIcon;
4947
4995
  exports.VListTile = VListTile;
4948
4996
  exports.VNavigation = VNavigation;
4949
4997
  exports.VNavigationItem = VNavigationItem;
4998
+ exports.VNumberField = VNumberField;
4950
4999
  exports.VOption = VOption;
4951
5000
  exports.VOptionGroup = VOptionGroup;
4952
5001
  exports.VPagination = VPagination;
@@ -5003,6 +5052,7 @@ exports.createNavigationItemProps = createNavigationItemProps;
5003
5052
  exports.createPaperBaseProps = createPaperBaseProps;
5004
5053
  exports.createPaperProps = createPaperProps;
5005
5054
  exports.createRequiredChipRenderer = createRequiredChipRenderer;
5055
+ exports.createVFormProps = createVFormProps;
5006
5056
  exports.defineFormSelectorComponent = defineFormSelectorComponent;
5007
5057
  exports.iconProps = iconProps;
5008
5058
  exports.installVuiPlugin = installVuiPlugin;
@@ -2684,6 +2684,48 @@ const VTextField = vue.defineComponent({
2684
2684
 
2685
2685
  });
2686
2686
 
2687
+ const VNumberField = vue.defineComponent({
2688
+ name: 'VNumberField',
2689
+ props: { ...undefined,
2690
+ modelValue: {
2691
+ type: Number,
2692
+ default: null
2693
+ }
2694
+ },
2695
+ emits: { ...undefined,
2696
+ 'update:modelValue': value => true,
2697
+ change: value => true
2698
+ },
2699
+
2700
+ setup(props, ctx) {
2701
+ const toString = value => {
2702
+ if (value == null) return '';
2703
+ return String(value);
2704
+ };
2705
+
2706
+ const toNumber = value => {
2707
+ if (value == null) return null;
2708
+ if (typeof value === 'number') return value;
2709
+ if (value.trim() === '') return null;
2710
+ return Number(value);
2711
+ };
2712
+
2713
+ return () => {
2714
+ return vue.createVNode(VTextField, vue.mergeProps(ctx.attrs, {
2715
+ "type": "number",
2716
+ "modelValue": toString(props.modelValue),
2717
+ "onUpdate:modelValue": value => {
2718
+ ctx.emit('update:modelValue', toNumber(value));
2719
+ },
2720
+ "onChange": value => {
2721
+ ctx.emit('change', toNumber(value));
2722
+ }
2723
+ }), ctx.slots);
2724
+ };
2725
+ }
2726
+
2727
+ });
2728
+
2687
2729
  const {
2688
2730
  props: props$1,
2689
2731
  emits: emits$1
@@ -2822,7 +2864,10 @@ const VWysiwygEditor = vue.defineComponent({
2822
2864
 
2823
2865
  vue.watch(() => inputControl.canOperation, updateEditable);
2824
2866
  vue.watch(() => props.modelValue, modelValue => {
2825
- editor.value && editor.value.commands.setContent(modelValue == null ? '' : modelValue);
2867
+ const $editor = editor.value;
2868
+ if (!$editor) return;
2869
+ $editor.commands.setContent(modelValue == null ? '' : modelValue);
2870
+ textRef.value = $editor.getText();
2826
2871
  });
2827
2872
  const editor = vue3.useEditor({
2828
2873
  onCreate: ({
@@ -3156,13 +3201,16 @@ const {
3156
3201
  } = vueKit.createFormSettings({
3157
3202
  nodeType: VUI_FORM_SYMBOL
3158
3203
  });
3159
- const VForm = vue.defineComponent({
3160
- name: 'VForm',
3161
- props: { ...props,
3204
+ function createVFormProps() {
3205
+ return { ...props,
3162
3206
  ...createControlProps(),
3163
3207
  ...vueKit.defineSlotsProps() // disableAutoScroll: Boolean,
3164
3208
 
3165
- },
3209
+ };
3210
+ }
3211
+ const VForm = vue.defineComponent({
3212
+ name: 'VForm',
3213
+ props: createVFormProps(),
3166
3214
  emits,
3167
3215
 
3168
3216
  setup(props, ctx) {
@@ -4947,6 +4995,7 @@ exports.VIcon = VIcon;
4947
4995
  exports.VListTile = VListTile;
4948
4996
  exports.VNavigation = VNavigation;
4949
4997
  exports.VNavigationItem = VNavigationItem;
4998
+ exports.VNumberField = VNumberField;
4950
4999
  exports.VOption = VOption;
4951
5000
  exports.VOptionGroup = VOptionGroup;
4952
5001
  exports.VPagination = VPagination;
@@ -5003,6 +5052,7 @@ exports.createNavigationItemProps = createNavigationItemProps;
5003
5052
  exports.createPaperBaseProps = createPaperBaseProps;
5004
5053
  exports.createPaperProps = createPaperProps;
5005
5054
  exports.createRequiredChipRenderer = createRequiredChipRenderer;
5055
+ exports.createVFormProps = createVFormProps;
5006
5056
  exports.defineFormSelectorComponent = defineFormSelectorComponent;
5007
5057
  exports.iconProps = iconProps;
5008
5058
  exports.installVuiPlugin = installVuiPlugin;
package/dist/vui.d.ts CHANGED
@@ -70,6 +70,7 @@ import { TextableCounterSettings } from '@fastkit/vue-kit';
70
70
  import { TextareaAutosizeSettings } from '@fastkit/vue-kit';
71
71
  import { TextareaControl } from '@fastkit/vue-kit';
72
72
  import { TextInputControl } from '@fastkit/vue-kit';
73
+ import { TextInputEmits } from '@fastkit/vue-kit';
73
74
  import { TypedSlot } from '@fastkit/vue-kit';
74
75
  import { UnderlineOptions } from '@tiptap/extension-underline';
75
76
  import { UnwrapNestedRefs } from 'vue';
@@ -998,6 +999,44 @@ declare function createTextFieldProps(): {
998
999
  errorMessages: PropType<string | string[]>;
999
1000
  };
1000
1001
 
1002
+ export declare function createVFormProps(): {
1003
+ 'v-slots': PropType<ResolveRawSlots<VFormSlots>>;
1004
+ size: {
1005
+ type: PropType<"sm" | "md" | "lg">;
1006
+ validator: (value: any) => boolean;
1007
+ };
1008
+ action: PropType<FormAction>;
1009
+ autoValidate: {
1010
+ type: BooleanConstructor;
1011
+ default: boolean;
1012
+ };
1013
+ submiting: BooleanConstructor;
1014
+ disableAutoScroll: BooleanConstructor;
1015
+ name: StringConstructor;
1016
+ modelValue: Prop<unknown, unknown>;
1017
+ tabindex: {
1018
+ type: (StringConstructor | NumberConstructor)[];
1019
+ default: number;
1020
+ };
1021
+ autofocus: BooleanConstructor;
1022
+ disabled: BooleanConstructor;
1023
+ readonly: BooleanConstructor;
1024
+ spellcheck: BooleanConstructor;
1025
+ viewonly: BooleanConstructor;
1026
+ required: BooleanConstructor;
1027
+ clearable: BooleanConstructor;
1028
+ validateTiming: {
1029
+ type: PropType<ValidateTiming>;
1030
+ default: ValidateTiming;
1031
+ };
1032
+ rules: {
1033
+ type: PropType<RecursiveArray<Rule<any>>>;
1034
+ default: () => never[];
1035
+ };
1036
+ error: BooleanConstructor;
1037
+ errorMessages: PropType<string | string[]>;
1038
+ };
1039
+
1001
1040
  declare const DATA_TABLE_DEFAULTS: {
1002
1041
  itemKey: string;
1003
1042
  pageQuery: string;
@@ -2247,8 +2286,12 @@ export declare function splitAttrs(attrs: ImgHTMLAttributes): {
2247
2286
  img: ImgHTMLAttributes;
2248
2287
  };
2249
2288
 
2289
+ export declare type TextFieldEmits = TextInputEmits;
2290
+
2250
2291
  export declare type TextFieldInput = ExtractPropInput<ReturnType<typeof createTextFieldProps>>;
2251
2292
 
2293
+ export declare type TextFieldPropsOptions = ReturnType<typeof createTextFieldProps>;
2294
+
2252
2295
  declare type ToggleableIconHook = (gen: IconGenerator, ctx: boolean) => VNodeChild;
2253
2296
 
2254
2297
  export declare function useControl(props: ControlProps, opts?: UseControlProviderOptions): ControlProvider;
@@ -6251,6 +6294,201 @@ export declare const VNavigationItem: DefineComponent<{
6251
6294
  ariaCurrentValue: "page" | "step" | "location" | "date" | "time" | "true" | "false" | undefined;
6252
6295
  }>;
6253
6296
 
6297
+ export declare const VNumberField: DefineComponent<{
6298
+ modelValue: {
6299
+ type: PropType<number | null>;
6300
+ default: null;
6301
+ };
6302
+ name: StringConstructor;
6303
+ autofocus: BooleanConstructor;
6304
+ disabled: BooleanConstructor;
6305
+ readonly: BooleanConstructor;
6306
+ spellcheck: BooleanConstructor;
6307
+ viewonly: BooleanConstructor;
6308
+ required: BooleanConstructor;
6309
+ clearable: BooleanConstructor;
6310
+ error: BooleanConstructor;
6311
+ tabindex: {
6312
+ type: (StringConstructor | NumberConstructor)[];
6313
+ default: number;
6314
+ };
6315
+ validateTiming: {
6316
+ type: PropType<ValidateTiming>;
6317
+ default: ValidateTiming;
6318
+ };
6319
+ rules: {
6320
+ type: PropType<RecursiveArray<Rule<any>>>;
6321
+ default: () => never[];
6322
+ };
6323
+ errorMessages: PropType<string | string[]>;
6324
+ autocomplete: PropType<boolean | "name" | "off" | "on" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "email" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "language" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "url" | "photo">;
6325
+ placeholder: StringConstructor;
6326
+ limit: BooleanConstructor;
6327
+ minlength: (StringConstructor | NumberConstructor)[];
6328
+ maxlength: (StringConstructor | NumberConstructor)[];
6329
+ pattern: (StringConstructor | RegExpConstructor)[];
6330
+ autocapitalize: PropType<FormAutoCapitalize>;
6331
+ finishings: PropType<RawTextableFinishingProp>;
6332
+ counter: PropType<string | number | boolean>;
6333
+ counterValue: PropType<(value: string) => number>;
6334
+ masked: StringConstructor;
6335
+ unmasked: StringConstructor;
6336
+ typed: (StringConstructor | NumberConstructor | DateConstructor)[];
6337
+ validating: BooleanConstructor;
6338
+ pending: BooleanConstructor;
6339
+ focused: BooleanConstructor;
6340
+ dirty: BooleanConstructor;
6341
+ pristine: BooleanConstructor;
6342
+ touched: BooleanConstructor;
6343
+ untouched: BooleanConstructor;
6344
+ invalid: BooleanConstructor;
6345
+ valid: BooleanConstructor;
6346
+ hiddenInfo: BooleanConstructor;
6347
+ errors: {
6348
+ type: PropType<FormNodeError[]>;
6349
+ default: () => FormNodeError[];
6350
+ };
6351
+ nodeControl: PropType<FormNodeControl<any, any>>;
6352
+ label: PropType<VNodeChildOrSlot<any>>;
6353
+ hint: PropType<VNodeChildOrSlot<any>>;
6354
+ hinttip: PropType<FormControlHinttip>;
6355
+ hinttipDelay: PropType<FormControlHinttipDelay>;
6356
+ infoAppends: PropType<VNodeChildOrSlot<any>>;
6357
+ requiredChip: PropType<RequiredChipSource>;
6358
+ startAdornment: PropType<VNodeChildOrSlot<any>>;
6359
+ endAdornment: PropType<VNodeChildOrSlot<any>>;
6360
+ variant: {
6361
+ type: PropType<"flat" | "outlined" | "filled">;
6362
+ validator: (value: any) => boolean;
6363
+ };
6364
+ size: {
6365
+ type: PropType<"sm" | "md" | "lg">;
6366
+ validator: (value: any) => boolean;
6367
+ };
6368
+ 'v-slots': PropType<ResolveRawSlots<FormControlSlots & InputBoxSlots>>;
6369
+ mask: PropType<any>;
6370
+ }, () => JSX.Element, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
6371
+ 'update:modelValue': (value: number | null) => true;
6372
+ change: (value: number | null) => true;
6373
+ blur: (ev: FocusEvent) => boolean;
6374
+ accept: (ev: IMaskEvent) => boolean;
6375
+ complete: (ev: IMaskEvent) => boolean;
6376
+ 'update:masked': (maskedValue: string) => boolean;
6377
+ 'update:typed': (typedValue: IMaskTypedValue | undefined) => boolean;
6378
+ 'update:unmasked': (unmaskedValue: string) => boolean;
6379
+ 'update:errors': (errors: FormNodeError[]) => boolean;
6380
+ focus: (ev: FocusEvent) => boolean;
6381
+ }, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
6382
+ modelValue: {
6383
+ type: PropType<number | null>;
6384
+ default: null;
6385
+ };
6386
+ name: StringConstructor;
6387
+ autofocus: BooleanConstructor;
6388
+ disabled: BooleanConstructor;
6389
+ readonly: BooleanConstructor;
6390
+ spellcheck: BooleanConstructor;
6391
+ viewonly: BooleanConstructor;
6392
+ required: BooleanConstructor;
6393
+ clearable: BooleanConstructor;
6394
+ error: BooleanConstructor;
6395
+ tabindex: {
6396
+ type: (StringConstructor | NumberConstructor)[];
6397
+ default: number;
6398
+ };
6399
+ validateTiming: {
6400
+ type: PropType<ValidateTiming>;
6401
+ default: ValidateTiming;
6402
+ };
6403
+ rules: {
6404
+ type: PropType<RecursiveArray<Rule<any>>>;
6405
+ default: () => never[];
6406
+ };
6407
+ errorMessages: PropType<string | string[]>;
6408
+ autocomplete: PropType<boolean | "name" | "off" | "on" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "email" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "language" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "url" | "photo">;
6409
+ placeholder: StringConstructor;
6410
+ limit: BooleanConstructor;
6411
+ minlength: (StringConstructor | NumberConstructor)[];
6412
+ maxlength: (StringConstructor | NumberConstructor)[];
6413
+ pattern: (StringConstructor | RegExpConstructor)[];
6414
+ autocapitalize: PropType<FormAutoCapitalize>;
6415
+ finishings: PropType<RawTextableFinishingProp>;
6416
+ counter: PropType<string | number | boolean>;
6417
+ counterValue: PropType<(value: string) => number>;
6418
+ masked: StringConstructor;
6419
+ unmasked: StringConstructor;
6420
+ typed: (StringConstructor | NumberConstructor | DateConstructor)[];
6421
+ validating: BooleanConstructor;
6422
+ pending: BooleanConstructor;
6423
+ focused: BooleanConstructor;
6424
+ dirty: BooleanConstructor;
6425
+ pristine: BooleanConstructor;
6426
+ touched: BooleanConstructor;
6427
+ untouched: BooleanConstructor;
6428
+ invalid: BooleanConstructor;
6429
+ valid: BooleanConstructor;
6430
+ hiddenInfo: BooleanConstructor;
6431
+ errors: {
6432
+ type: PropType<FormNodeError[]>;
6433
+ default: () => FormNodeError[];
6434
+ };
6435
+ nodeControl: PropType<FormNodeControl<any, any>>;
6436
+ label: PropType<VNodeChildOrSlot<any>>;
6437
+ hint: PropType<VNodeChildOrSlot<any>>;
6438
+ hinttip: PropType<FormControlHinttip>;
6439
+ hinttipDelay: PropType<FormControlHinttipDelay>;
6440
+ infoAppends: PropType<VNodeChildOrSlot<any>>;
6441
+ requiredChip: PropType<RequiredChipSource>;
6442
+ startAdornment: PropType<VNodeChildOrSlot<any>>;
6443
+ endAdornment: PropType<VNodeChildOrSlot<any>>;
6444
+ variant: {
6445
+ type: PropType<"flat" | "outlined" | "filled">;
6446
+ validator: (value: any) => boolean;
6447
+ };
6448
+ size: {
6449
+ type: PropType<"sm" | "md" | "lg">;
6450
+ validator: (value: any) => boolean;
6451
+ };
6452
+ 'v-slots': PropType<ResolveRawSlots<FormControlSlots & InputBoxSlots>>;
6453
+ mask: PropType<any>;
6454
+ }>> & {
6455
+ onBlur?: ((ev: FocusEvent) => any) | undefined;
6456
+ onChange?: ((value: number | null) => any) | undefined;
6457
+ "onUpdate:modelValue"?: ((value: number | null) => any) | undefined;
6458
+ onAccept?: ((ev: IMaskEvent) => any) | undefined;
6459
+ onComplete?: ((ev: IMaskEvent) => any) | undefined;
6460
+ "onUpdate:masked"?: ((maskedValue: string) => any) | undefined;
6461
+ "onUpdate:typed"?: ((typedValue: IMaskTypedValue | undefined) => any) | undefined;
6462
+ "onUpdate:unmasked"?: ((unmaskedValue: string) => any) | undefined;
6463
+ "onUpdate:errors"?: ((errors: FormNodeError[]) => any) | undefined;
6464
+ onFocus?: ((ev: FocusEvent) => any) | undefined;
6465
+ }, {
6466
+ autofocus: boolean;
6467
+ disabled: boolean;
6468
+ readonly: boolean;
6469
+ spellcheck: boolean;
6470
+ viewonly: boolean;
6471
+ required: boolean;
6472
+ clearable: boolean;
6473
+ error: boolean;
6474
+ modelValue: number | null;
6475
+ tabindex: string | number;
6476
+ validateTiming: ValidateTiming;
6477
+ rules: RecursiveArray<Rule<any>>;
6478
+ limit: boolean;
6479
+ validating: boolean;
6480
+ pending: boolean;
6481
+ focused: boolean;
6482
+ dirty: boolean;
6483
+ pristine: boolean;
6484
+ touched: boolean;
6485
+ untouched: boolean;
6486
+ invalid: boolean;
6487
+ valid: boolean;
6488
+ hiddenInfo: boolean;
6489
+ errors: FormNodeError[];
6490
+ }>;
6491
+
6254
6492
  export declare const VOption: DefineComponent<{
6255
6493
  size: {
6256
6494
  type: PropType<"sm" | "md" | "lg">;
package/dist/vui.mjs CHANGED
@@ -2679,6 +2679,48 @@ const VTextField = defineComponent({
2679
2679
 
2680
2680
  });
2681
2681
 
2682
+ const VNumberField = defineComponent({
2683
+ name: 'VNumberField',
2684
+ props: { ...undefined,
2685
+ modelValue: {
2686
+ type: Number,
2687
+ default: null
2688
+ }
2689
+ },
2690
+ emits: { ...undefined,
2691
+ 'update:modelValue': value => true,
2692
+ change: value => true
2693
+ },
2694
+
2695
+ setup(props, ctx) {
2696
+ const toString = value => {
2697
+ if (value == null) return '';
2698
+ return String(value);
2699
+ };
2700
+
2701
+ const toNumber = value => {
2702
+ if (value == null) return null;
2703
+ if (typeof value === 'number') return value;
2704
+ if (value.trim() === '') return null;
2705
+ return Number(value);
2706
+ };
2707
+
2708
+ return () => {
2709
+ return createVNode(VTextField, mergeProps(ctx.attrs, {
2710
+ "type": "number",
2711
+ "modelValue": toString(props.modelValue),
2712
+ "onUpdate:modelValue": value => {
2713
+ ctx.emit('update:modelValue', toNumber(value));
2714
+ },
2715
+ "onChange": value => {
2716
+ ctx.emit('change', toNumber(value));
2717
+ }
2718
+ }), ctx.slots);
2719
+ };
2720
+ }
2721
+
2722
+ });
2723
+
2682
2724
  const {
2683
2725
  props: props$1,
2684
2726
  emits: emits$1
@@ -2817,7 +2859,10 @@ const VWysiwygEditor = defineComponent({
2817
2859
 
2818
2860
  watch(() => inputControl.canOperation, updateEditable);
2819
2861
  watch(() => props.modelValue, modelValue => {
2820
- editor.value && editor.value.commands.setContent(modelValue == null ? '' : modelValue);
2862
+ const $editor = editor.value;
2863
+ if (!$editor) return;
2864
+ $editor.commands.setContent(modelValue == null ? '' : modelValue);
2865
+ textRef.value = $editor.getText();
2821
2866
  });
2822
2867
  const editor = useEditor({
2823
2868
  onCreate: ({
@@ -3151,13 +3196,16 @@ const {
3151
3196
  } = createFormSettings({
3152
3197
  nodeType: VUI_FORM_SYMBOL
3153
3198
  });
3154
- const VForm = defineComponent({
3155
- name: 'VForm',
3156
- props: { ...props,
3199
+ function createVFormProps() {
3200
+ return { ...props,
3157
3201
  ...createControlProps(),
3158
3202
  ...defineSlotsProps() // disableAutoScroll: Boolean,
3159
3203
 
3160
- },
3204
+ };
3205
+ }
3206
+ const VForm = defineComponent({
3207
+ name: 'VForm',
3208
+ props: createVFormProps(),
3161
3209
  emits,
3162
3210
 
3163
3211
  setup(props, ctx) {
@@ -4908,4 +4956,4 @@ function installVuiPlugin(app, opts) {
4908
4956
  return app.use(VuiPlugin, opts);
4909
4957
  }
4910
4958
 
4911
- export { AVATAR_SIZES, CHIP_SIZES, CONTROL_FIELD_VARIANTS, CONTROL_SIZES, PAGINATION_ALIGNS, VApp, VAvatar, VBreadcrumbs, VBusyImage, VButton, VButtonGroup, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VChip, VContentSwitcher, VDataTable, VDrawerLayout, VForm, VFormControl, VGridContainer, VGridItem, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, VSkeltonLoaderBone, 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, createAvatarProps, createCardProps, createChipProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, createRequiredChipRenderer, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, mergeVuiPluginOptions, mergeVuiServiceIconSettings, mergeVuiServiceOptions, mergeVuiServiceUISettings, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, resolveRawWysiwygEditorTools, splitAttrs, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
4959
+ export { AVATAR_SIZES, CHIP_SIZES, CONTROL_FIELD_VARIANTS, CONTROL_SIZES, PAGINATION_ALIGNS, VApp, VAvatar, VBreadcrumbs, VBusyImage, VButton, VButtonGroup, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VChip, VContentSwitcher, VDataTable, VDrawerLayout, VForm, VFormControl, VGridContainer, VGridItem, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VNumberField, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, VSkeltonLoaderBone, 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, createAvatarProps, createCardProps, createChipProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, createRequiredChipRenderer, createVFormProps, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, mergeVuiPluginOptions, mergeVuiServiceIconSettings, mergeVuiServiceOptions, mergeVuiServiceUISettings, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, resolveRawWysiwygEditorTools, splitAttrs, 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.48",
3
+ "version": "0.7.52",
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.48",
36
- "@fastkit/icon-font": "0.7.48",
37
- "@fastkit/tiny-logger": "0.7.48",
38
- "@fastkit/vite-kit": "0.7.48",
39
- "@fastkit/vue-kit": "0.7.48",
35
+ "@fastkit/color-scheme": "0.7.52",
36
+ "@fastkit/icon-font": "0.7.52",
37
+ "@fastkit/tiny-logger": "0.7.52",
38
+ "@fastkit/vite-kit": "0.7.52",
39
+ "@fastkit/vue-kit": "0.7.52",
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",
Binary file
@@ -18,14 +18,18 @@ export interface VFormSlots {
18
18
  default: VueForm;
19
19
  }
20
20
 
21
- export const VForm = defineComponent({
22
- name: 'VForm',
23
- props: {
21
+ export function createVFormProps() {
22
+ return {
24
23
  ...props,
25
24
  ...createControlProps(),
26
25
  ...defineSlotsProps<VFormSlots>(),
27
26
  // disableAutoScroll: Boolean,
28
- },
27
+ };
28
+ }
29
+
30
+ export const VForm = defineComponent({
31
+ name: 'VForm',
32
+ props: createVFormProps(),
29
33
  emits,
30
34
  setup(props, ctx) {
31
35
  const vui = useVui();
@@ -0,0 +1,55 @@
1
+ import { defineComponent, PropType } from 'vue';
2
+ import {
3
+ VTextField,
4
+ TextFieldPropsOptions,
5
+ TextFieldEmits,
6
+ } from '../VTextField/VTextField';
7
+
8
+ export const VNumberField = defineComponent({
9
+ name: 'VNumberField',
10
+ props: {
11
+ ...(undefined as unknown as Omit<TextFieldPropsOptions, 'type'>),
12
+ modelValue: {
13
+ type: Number as PropType<number | null>,
14
+ default: null,
15
+ },
16
+ },
17
+ emits: {
18
+ ...(undefined as unknown as Omit<
19
+ TextFieldEmits,
20
+ 'update:modelValue' | 'change'
21
+ >),
22
+ 'update:modelValue': (value: number | null) => true,
23
+ change: (value: number | null) => true,
24
+ },
25
+ setup(props, ctx) {
26
+ const toString = (value?: string | number | null): string => {
27
+ if (value == null) return '';
28
+ return String(value);
29
+ };
30
+
31
+ const toNumber = (value?: string | number | null): number | null => {
32
+ if (value == null) return null;
33
+ if (typeof value === 'number') return value;
34
+ if (value.trim() === '') return null;
35
+ return Number(value);
36
+ };
37
+
38
+ return () => {
39
+ return (
40
+ <VTextField
41
+ {...ctx.attrs}
42
+ type="number"
43
+ modelValue={toString(props.modelValue)}
44
+ onUpdate:modelValue={(value) => {
45
+ ctx.emit('update:modelValue', toNumber(value));
46
+ }}
47
+ onChange={(value) => {
48
+ ctx.emit('change', toNumber(value));
49
+ }}
50
+ v-slots={ctx.slots}
51
+ />
52
+ );
53
+ };
54
+ },
55
+ });
@@ -0,0 +1 @@
1
+ export * from './VNumberField';
@@ -6,6 +6,7 @@ import {
6
6
  createFormControlProps,
7
7
  FormControlSlots,
8
8
  defineSlotsProps,
9
+ TextInputEmits,
9
10
  } from '@fastkit/vue-kit';
10
11
  import { VFormControl } from '../VFormControl';
11
12
  import {
@@ -36,6 +37,10 @@ function createTextFieldProps() {
36
37
  };
37
38
  }
38
39
 
40
+ export type TextFieldPropsOptions = ReturnType<typeof createTextFieldProps>;
41
+
42
+ export type TextFieldEmits = TextInputEmits;
43
+
39
44
  export type TextFieldInput = ExtractPropInput<
40
45
  ReturnType<typeof createTextFieldProps>
41
46
  >;
@@ -99,10 +99,10 @@ export const VWysiwygEditor = defineComponent({
99
99
  watch(
100
100
  () => props.modelValue,
101
101
  (modelValue) => {
102
- editor.value &&
103
- editor.value.commands.setContent(
104
- modelValue == null ? '' : modelValue,
105
- );
102
+ const $editor = editor.value;
103
+ if (!$editor) return;
104
+ $editor.commands.setContent(modelValue == null ? '' : modelValue);
105
+ textRef.value = $editor.getText();
106
106
  },
107
107
  );
108
108
 
@@ -26,6 +26,7 @@ export * from './VOption';
26
26
  export * from './VOptionGroup';
27
27
  export * from './VSelect';
28
28
  export * from './VTextField';
29
+ export * from './VNumberField';
29
30
  export * from './VTextarea';
30
31
  export * from './VWysiwygEditor';
31
32
  export * from './VForm';