Skip to content

Commit 21d932a

Browse files
committed
deploy ts files
1 parent 277487f commit 21d932a

18 files changed

+122
-264
lines changed

.npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@my-org:registry=https://npm.pkg.github.com/
2+
git-checks=false

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# FN-Scheme
22
#### Form schema component for Naive UI framework. Generate form from json like formkit schema component
33

4+
P.S. alternative @chronicstone/vue-sweetforms
5+
46
- Package type: `es`
5-
- Original size: `~14.2kb`
6-
- Bzip + minify: `~80.4kb`
77

88

99
#### TREE

components.d.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@ export {}
99

1010
declare module '@vue/runtime-core' {
1111
export interface GlobalComponents {
12-
FnSchema: typeof import('./src/components/fn-schema.vue')['default']
12+
FnSchema: typeof import('./src/lib/components/fn-schema.vue')['default']
13+
FnUploadDnd: typeof import('./src/lib/components/naive-ui/fn-upload-dnd.vue')['default']
1314
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
14-
Test: typeof import('./src/components/test.vue')['default']
15+
NIcon: typeof import('naive-ui')['NIcon']
16+
NP: typeof import('naive-ui')['NP']
17+
NText: typeof import('naive-ui')['NText']
18+
NUpload: typeof import('naive-ui')['NUpload']
19+
NUploadDnd: typeof import('./src/lib/components/naive-ui/n-upload-dnd.vue')['default']
20+
Test: typeof import('./src/lib/components/test.vue')['default']
1521
}
1622
}

package.json

+20-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
11
{
2-
"name": "fn-forms",
3-
"private": true,
4-
"version": "0.0.0",
5-
"type": "module",
2+
"name": "@francyfox/fn-forms",
3+
"description": "Naive UI component. Generate form from json like formkit schema component",
4+
"author": "hellisart <7info7web@gmail.com>",
5+
"private": false,
6+
"version": "0.0.1",
7+
"license": "MIT",
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/francyfox/fn-forms.git"
11+
},
612
"scripts": {
713
"dev": "vite",
814
"build": "vue-tsc && vite build",
915
"preview": "vite preview"
1016
},
17+
"publishConfig": {
18+
"access": "public"
19+
},
20+
"keywords": [
21+
"naive ui component",
22+
"form generator"
23+
],
24+
"files": [
25+
"src/lib"
26+
],
1127
"dependencies": {
1228
"deepmerge": "^4.3.1",
1329
"naive-ui": "^2.34.3",

src/App.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import Test from './components/test.vue';
2+
import Test from './lib/components/test.vue';
33
</script>
44

55
<template>

src/components/test-schema.ts

-158
This file was deleted.

src/components/test.vue

-29
This file was deleted.

src/index.ts

-13
This file was deleted.

src/components/fn-schema.vue src/lib/components/fn-schema.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import naiveUISchemaRender, { NaiveUISchema } from '../module/schema/schema.parser.ts';
2+
import naiveUISchemaRender, { NaiveUISchema } from 'src/lib/module/schema/schema.parser.ts';
33
44
const props = withDefaults(defineProps<{
55
data: any,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<script setup lang="ts">
2+
import { NUploadDragger } from 'naive-ui/es/upload';
3+
import { NIcon } from 'naive-ui/es/icon';
4+
5+
withDefaults(defineProps<{
6+
icon?: string
7+
}>(), {
8+
icon: null,
9+
});
10+
</script>
11+
12+
<template>
13+
<n-upload-dragger>
14+
<div v-if="icon" style="margin-bottom: 12px">
15+
<n-icon size="48" :depth="3">
16+
<component :is="icon"/>
17+
</n-icon>
18+
</div>
19+
<n-text style="font-size: 16px">
20+
<slot name="title"/>
21+
</n-text>
22+
<n-p depth="3" style="margin: 8px 0 0 0">
23+
<slot name="desc"/>
24+
</n-p>
25+
</n-upload-dragger>
26+
</template>
27+
28+
<style scoped>
29+
30+
</style>

src/helper/helper.path.ts src/lib/helper/helper.path.ts

-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
export const toPascalCase = (str: string) => {
2-
return str.replace(/\w+/g, function (w) {
3-
return w[0].toUpperCase() + w.slice(1).toLowerCase();
4-
});
5-
};
6-
71
export function resolve(path: string, obj: object, separator = '.'): any {
82
const properties = Array.isArray(path) ? path : path.split(separator);
93
// @ts-ignore

src/lib/index.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import FnSchema from './components/fn-schema.vue';
2+
import { NaiveUITypes } from './module/schema/schema.model';
3+
import naiveUISchemaRender, { NaiveUISchema } from './module/schema/schema.parser';
4+
5+
export {
6+
FnSchema,
7+
NaiveUITypes,
8+
naiveUISchemaRender,
9+
};
10+
11+
export type {
12+
NaiveUISchema,
13+
};

src/module/schema/schema.model.ts src/lib/module/schema/schema.model.ts

+11-9
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ export enum NaiveUITypes {
1010
Radio = 'n-radio',
1111
RadioGroup = 'n-radio-group',
1212
Switch = 'n-switch',
13-
DynamicTags = 'n-dynamic-tags'
13+
DynamicTags = 'n-dynamic-tags',
14+
Upload = 'n-upload',
15+
UploadDnd = 'fn-upload-dnd'
1416
}
1517

1618
export const sortComponentsByAction = {
@@ -20,24 +22,24 @@ export const sortComponentsByAction = {
2022
NaiveUITypes.Select.valueOf(),
2123
NaiveUITypes.RadioGroup.valueOf(),
2224
NaiveUITypes.Switch.valueOf(),
23-
NaiveUITypes.DynamicTags.valueOf()
25+
NaiveUITypes.DynamicTags.valueOf(),
2426
],
2527
change: [
2628
NaiveUITypes.Radio.valueOf(),
2729
],
2830
checked: [
2931
NaiveUITypes.Checkbox.valueOf(),
3032
],
31-
}
33+
};
3234

33-
export const hasValueAction = (v: string) => sortComponentsByAction.value.includes(v)
34-
export const hasCheckedAction = (v: string) => sortComponentsByAction.checked.includes(v)
35-
export const hasChangeAction = (v: string) => sortComponentsByAction.change.includes(v)
35+
export const hasValueAction = (v: string) => sortComponentsByAction.value.includes(v);
36+
export const hasCheckedAction = (v: string) => sortComponentsByAction.checked.includes(v);
37+
export const hasChangeAction = (v: string) => sortComponentsByAction.change.includes(v);
3638

37-
export const hasActions = (v:string) => Object.values(sortComponentsByAction)
39+
export const hasActions = (v: string) => Object.values(sortComponentsByAction)
3840
.some((i) => {
39-
return i.includes(v)
40-
})
41+
return i.includes(v);
42+
});
4143

4244
export type NaiveUISchema = NaiveUISchemaEl[]
4345

0 commit comments

Comments
 (0)