Skip to content

Commit

Permalink
feat: added KInputNumber component(#375)
Browse files Browse the repository at this point in the history
feat: added KInputNumber component
  • Loading branch information
baiwusanyu-c committed Dec 27, 2023
2 parents 713aad6 + fd70793 commit e3be2bc
Show file tree
Hide file tree
Showing 27 changed files with 1,566 additions and 45 deletions.
22 changes: 20 additions & 2 deletions components/Form/__test__/__snapshots__/form.spec.ts.snap

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions components/Form/__test__/fixture/disabled.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
import { KCheckboxGroup } from '@ikun-ui/checkbox-group';
import { KSelect } from '@ikun-ui/select';
import { KSlider } from '@ikun-ui/slider';
import { KInputNumber } from '@ikun-ui/input-number';
const initValue = {
KInput: 'KInput',
KSwitch: true,
KRate: 4,
KInputNumber: 4,
KRadio: '3',
KCheckbox: ['2'],
KSelect: { label: '不知明镜里', value: '不知', id: '3' },
Expand Down Expand Up @@ -40,6 +42,9 @@
<KFormItem field="KRate" label="KRate">
<KRate clearable />
</KFormItem>
<KFormItem field="KInputNumber" label="KInputNumber">
<KInputNumber />
</KFormItem>
<KFormItem field="KRadio" label="KRadio">
<KRadioGroup>
<KRadio uid="1">KRadio 1</KRadio>
Expand Down
8 changes: 8 additions & 0 deletions components/Form/__test__/fixture/getForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { KCheckboxGroup } from '@ikun-ui/checkbox-group';
import { KSelect } from '@ikun-ui/select';
import { createEventDispatcher } from 'svelte';
import { KInputNumber } from '@ikun-ui/input-number';
export let initValue = {};
let KFormInst: KForm | undefined = undefined;
const dataList = [
Expand All @@ -23,6 +24,10 @@
{ required: true, msg: 'KInput required' },
{ min: 3, max: 5, msg: 'KInput 3 ~5' }
],
KInputNumber: [
{ required: true, msg: 'KInputNumber required' },
{ min: 3, max: 5, msg: 'KInputNumber 3 ~5' }
],
KSwitch: [
{
required: true,
Expand Down Expand Up @@ -84,6 +89,9 @@
<KFormItem field="KRate" label="KRate">
<KRate clearable />
</KFormItem>
<KFormItem field="KInputNumber" label="KInputNumber">
<KInputNumber />
</KFormItem>
<KFormItem field="KRadio" label="KRadio">
<KRadioGroup>
<KRadio uid="1">KRadio 1</KRadio>
Expand Down
5 changes: 5 additions & 0 deletions components/Form/__test__/fixture/init.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
import { KSelect } from '@ikun-ui/select';
import { onMount } from 'svelte';
import { KSlider } from '@ikun-ui/slider';
import { KInputNumber } from '@ikun-ui/input-number';
const initValue = {
KInput: 'KInput',
KSwitch: true,
KRate: 4,
KInputNumber: 4,
KRadio: '3',
KCheckbox: ['2'],
KSelect: { label: '不知明镜里', value: '不知', id: '3' },
Expand Down Expand Up @@ -46,6 +48,9 @@
<KFormItem field="KRate" label="KRate">
<KRate clearable />
</KFormItem>
<KFormItem field="KInputNumber" label="KInputNumber">
<KInputNumber />
</KFormItem>
<KFormItem field="KRadio" label="KRadio">
<KRadioGroup>
<KRadio uid="1">KRadio 1</KRadio>
Expand Down
8 changes: 8 additions & 0 deletions components/Form/__test__/fixture/resetForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import { KSelect } from '@ikun-ui/select';
import { createEventDispatcher } from 'svelte';
import { KSlider } from '@ikun-ui/slider';
import { KInputNumber } from '@ikun-ui/input-number';
export let initValue = {};
let KFormInst: KForm | undefined = undefined;
const dataList = [
Expand All @@ -24,6 +25,10 @@
{ required: true, msg: 'KInput required' },
{ min: 3, max: 5, msg: 'KInput 3 ~5' }
],
KInputNumber: [
{ required: true, msg: 'KInputNumber required' },
{ min: 3, max: 5, msg: 'KInputNumber 3 ~5' }
],
KSwitch: [
{
required: true,
Expand Down Expand Up @@ -97,6 +102,9 @@
<KFormItem field="KRate" label="KRate">
<KRate clearable />
</KFormItem>
<KFormItem field="KInputNumber" label="KInputNumber">
<KInputNumber />
</KFormItem>
<KFormItem field="KRadio" label="KRadio">
<KRadioGroup>
<KRadio uid="1">KRadio 1</KRadio>
Expand Down
10 changes: 10 additions & 0 deletions components/Form/__test__/fixture/setForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
import { KCheckboxGroup } from '@ikun-ui/checkbox-group';
import { KSelect } from '@ikun-ui/select';
import { createEventDispatcher } from 'svelte';
import { KInputNumber } from '@ikun-ui/input-number';
export let isValidate = true;
export let initValue = {
KInput: 'KInput',
KSwitch: true,
KRate: null,
KInputNumber: 3,
KRadio: '',
KCheckbox: [],
KSelect: null,
Expand All @@ -32,6 +34,10 @@
{ required: true, msg: 'KInput required' },
{ min: 3, max: 5, msg: 'KInput 3 ~5' }
],
KInputNumber: [
{ required: true, msg: 'KInputNumber required' },
{ min: 3, max: 5, msg: 'KInputNumber 3 ~5' }
],
KSwitch: [
{
required: true,
Expand Down Expand Up @@ -93,6 +99,7 @@
},
KRadio: '1',
KCheckbox: ['1'],
KInputNumber: 4,
KSelect: {
label: '白发三千丈',
value: '白发',
Expand Down Expand Up @@ -130,6 +137,9 @@
<KRadio uid="4" disabled>KRadio 4</KRadio>
</KRadioGroup>
</KFormItem>
<KFormItem field="KInputNumber" label="KInputNumber">
<KInputNumber />
</KFormItem>
<KFormItem field="KCheckbox" label="KCheckbox">
<KCheckboxGroup>
<KCheckbox uid="1">KCheckbox 1</KCheckbox>
Expand Down
5 changes: 5 additions & 0 deletions components/Form/__test__/fixture/size.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
import { KCheckboxGroup } from '@ikun-ui/checkbox-group';
import { KSelect } from '@ikun-ui/select';
import { KSlider } from '@ikun-ui/slider';
import { KInputNumber } from '@ikun-ui/input-number';
const initValue = {
KInput: 'KInput',
KSwitch: true,
KRate: 4,
KInputNumber: 4,
KRadio: '3',
KCheckbox: ['2'],
KSelect: { label: '不知明镜里', value: '不知', id: '3' },
Expand Down Expand Up @@ -40,6 +42,9 @@
<KFormItem field="KRate" label="KRate">
<KRate clearable />
</KFormItem>
<KFormItem field="KInputNumber" label="KInputNumber">
<KInputNumber />
</KFormItem>
<KFormItem field="KRadio" label="KRadio">
<KRadioGroup>
<KRadio uid="1">KRadio 1</KRadio>
Expand Down
11 changes: 10 additions & 1 deletion components/Form/__test__/fixture/validateEvent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
import { KCheckboxGroup } from '@ikun-ui/checkbox-group';
import { KSelect } from '@ikun-ui/select';
import { createEventDispatcher } from 'svelte';
import { KInputNumber } from '@ikun-ui/input-number';
const initValue = {
KInput: 'KInput',
KSwitch: true,
KRate: null,
KInputNumber: 3,
KRadio: '',
KCheckbox: [],
KSelect: null,
Expand All @@ -31,6 +33,10 @@
{ required: true, msg: 'KInput required' },
{ min: 3, max: 5, msg: 'KInput 3 ~5' }
],
KInputNumber: [
{ required: true, msg: 'KInputNumber required' },
{ min: 3, max: 5, msg: 'KInputNumber 3 ~5' }
],
KSwitch: [
{
required: true,
Expand Down Expand Up @@ -75,7 +81,7 @@
};
const dispatch = createEventDispatcher();
const handleValidate = (data) => {
const handleValidate = (data: any) => {
dispatch('getRes', data);
};
</script>
Expand All @@ -90,6 +96,9 @@
<KFormItem field="KRate" label="KRate">
<KRate clearable />
</KFormItem>
<KFormItem field="KInputNumber" label="KInputNumber">
<KInputNumber />
</KFormItem>
<KFormItem field="KRadio" label="KRadio">
<KRadioGroup>
<KRadio uid="1">KRadio 1</KRadio>
Expand Down
9 changes: 9 additions & 0 deletions components/Form/__test__/fixture/validateForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
import { KCheckboxGroup } from '@ikun-ui/checkbox-group';
import { KSelect } from '@ikun-ui/select';
import { createEventDispatcher } from 'svelte';
import { KInputNumber } from '@ikun-ui/input-number';
const initValue = {
KInput: 'KInput',
KSwitch: true,
KInputNumber: 2,
KRate: null,
KRadio: '',
KCheckbox: [],
Expand All @@ -31,6 +33,10 @@
{ required: true, msg: 'KInput required' },
{ min: 3, max: 5, msg: 'KInput 3 ~5' }
],
KInputNumber: [
{ required: true, msg: 'KInputNumber required' },
{ min: 3, max: 5, msg: 'KInputNumber 3 ~5' }
],
KSwitch: [
{
required: true,
Expand Down Expand Up @@ -98,6 +104,9 @@
<KFormItem field="KRate" label="KRate">
<KRate clearable />
</KFormItem>
<KFormItem field="KInputNumber" label="KInputNumber">
<KInputNumber />
</KFormItem>
<KFormItem field="KRadio" label="KRadio">
<KRadioGroup>
<KRadio uid="1">KRadio 1</KRadio>
Expand Down
Loading

0 comments on commit e3be2bc

Please sign in to comment.