mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-20 02:26:39 +08:00
feat(projects): add example for pro-naive-ui.
This commit is contained in:
parent
9a294204a2
commit
ff83d333a5
@ -19,6 +19,7 @@ export function setupElegantRouter() {
|
||||
'document_vite',
|
||||
'document_unocss',
|
||||
'document_naive',
|
||||
'document_pro-naive',
|
||||
'document_antd',
|
||||
'document_alova'
|
||||
]
|
||||
|
@ -6,6 +6,7 @@ import Icons from 'unplugin-icons/vite';
|
||||
import IconsResolver from 'unplugin-icons/resolver';
|
||||
import Components from 'unplugin-vue-components/vite';
|
||||
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
|
||||
import { ProNaiveUIResolver } from 'pro-naive-ui-resolver';
|
||||
import { FileSystemIconLoader } from 'unplugin-icons/loaders';
|
||||
|
||||
export function setupUnplugin(viteEnv: Env.ImportMeta) {
|
||||
@ -32,6 +33,7 @@ export function setupUnplugin(viteEnv: Env.ImportMeta) {
|
||||
types: [{ from: 'vue-router', names: ['RouterLink', 'RouterView'] }],
|
||||
resolvers: [
|
||||
NaiveUiResolver(),
|
||||
ProNaiveUIResolver(),
|
||||
IconsResolver({ customCollections: [collectionName], componentPrefix: VITE_ICON_PREFIX })
|
||||
]
|
||||
}),
|
||||
|
@ -78,6 +78,7 @@
|
||||
"pinia": "3.0.1",
|
||||
"pinyin-pro": "3.26.0",
|
||||
"print-js": "1.6.0",
|
||||
"pro-naive-ui": "^2.1.2",
|
||||
"swiper": "11.2.5",
|
||||
"tailwind-merge": "3.0.2",
|
||||
"typeit": "8.8.7",
|
||||
@ -114,6 +115,7 @@
|
||||
"eslint-plugin-vue": "10.0.0",
|
||||
"kolorist": "1.8.0",
|
||||
"lint-staged": "15.5.0",
|
||||
"pro-naive-ui-resolver": "^1.0.2",
|
||||
"sass": "1.86.0",
|
||||
"simple-git-hooks": "2.11.1",
|
||||
"tsx": "4.19.3",
|
||||
|
111
pnpm-lock.yaml
111
pnpm-lock.yaml
@ -101,6 +101,9 @@ importers:
|
||||
print-js:
|
||||
specifier: 1.6.0
|
||||
version: 1.6.0
|
||||
pro-naive-ui:
|
||||
specifier: ^2.1.2
|
||||
version: 2.1.2(naive-ui@2.41.0(vue@3.5.13(typescript@5.8.2)))(vue@3.5.13(typescript@5.8.2))
|
||||
swiper:
|
||||
specifier: 11.2.5
|
||||
version: 11.2.5
|
||||
@ -204,6 +207,9 @@ importers:
|
||||
lint-staged:
|
||||
specifier: 15.5.0
|
||||
version: 15.5.0
|
||||
pro-naive-ui-resolver:
|
||||
specifier: ^1.0.2
|
||||
version: 1.0.2
|
||||
sass:
|
||||
specifier: 1.86.0
|
||||
version: 1.86.0
|
||||
@ -1521,6 +1527,9 @@ packages:
|
||||
'@types/web-animations-js@2.2.16':
|
||||
resolution: {integrity: sha512-ATELeWMFwj8eQiH0KmvsCl1V2lu/qx/CjOBmv4ADSZS5u8r4reMyjCXtxG7khqyiwH3IOMNdrON/Ugn94OUcRA==}
|
||||
|
||||
'@types/web-bluetooth@0.0.20':
|
||||
resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==}
|
||||
|
||||
'@types/web-bluetooth@0.0.21':
|
||||
resolution: {integrity: sha512-oIQLCGWtcFZy2JW77j9k8nHzAOpqMHLQejDA48XXMWH6tjCQHz5RCFz1bzsmROyL6PUm+LLnUiI4BCn221inxA==}
|
||||
|
||||
@ -1619,6 +1628,9 @@ packages:
|
||||
peerDependencies:
|
||||
vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0
|
||||
|
||||
'@vicons/antd@0.13.0':
|
||||
resolution: {integrity: sha512-yrUGoUSz2BbGupk9ghQOahc04n5H3MwUDM9pVPsLh9U1uqB47oRWZvYRiZaT1JKPqgTgSE6BXcVw4i9MOF4M+g==}
|
||||
|
||||
'@visactor/vchart-theme@1.12.2':
|
||||
resolution: {integrity: sha512-r298TUdK+CKbHGVYWgQnNSEB5uqpFvF2/aMNZ/2POQnd2CovAPJOx2nTE6hAcOn8rra2FwJ2xF8AyP1O5OhrTw==}
|
||||
peerDependencies:
|
||||
@ -1809,14 +1821,23 @@ packages:
|
||||
peerDependencies:
|
||||
vue: ^3.5.0
|
||||
|
||||
'@vueuse/core@11.3.0':
|
||||
resolution: {integrity: sha512-7OC4Rl1f9G8IT6rUfi9JrKiXy4bfmHhZ5x2Ceojy0jnd3mHNEvV4JaRygH362ror6/NZ+Nl+n13LPzGiPN8cKA==}
|
||||
|
||||
'@vueuse/core@13.0.0':
|
||||
resolution: {integrity: sha512-rkgb4a8/0b234lMGCT29WkCjPfsX0oxrIRR7FDndRoW3FsaC9NBzefXg/9TLhAgwM11f49XnutshM4LzJBrQ5g==}
|
||||
peerDependencies:
|
||||
vue: ^3.5.0
|
||||
|
||||
'@vueuse/metadata@11.3.0':
|
||||
resolution: {integrity: sha512-pwDnDspTqtTo2HwfLw4Rp6yywuuBdYnPYDq+mO38ZYKGebCUQC/nVj/PXSiK9HX5otxLz8Fn7ECPbjiRz2CC3g==}
|
||||
|
||||
'@vueuse/metadata@13.0.0':
|
||||
resolution: {integrity: sha512-TRNksqmvtvqsuHf7bbgH9OSXEV2b6+M3BSN4LR5oxWKykOFT9gV78+C2/0++Pq9KCp9KQ1OQDPvGlWNQpOb2Mw==}
|
||||
|
||||
'@vueuse/shared@11.3.0':
|
||||
resolution: {integrity: sha512-P8gSSWQeucH5821ek2mn/ciCk+MS/zoRKqdQIM3bHq6p7GXDAJLmnRRKmF5F65sAVJIfzQlwR3aDzwCn10s8hA==}
|
||||
|
||||
'@vueuse/shared@13.0.0':
|
||||
resolution: {integrity: sha512-9MiHhAPw+sqCF/RLo8V6HsjRqEdNEWVpDLm2WBRW2G/kSQjb8X901sozXpSCaeLG0f7TEfMrT4XNaA5m1ez7Dg==}
|
||||
peerDependencies:
|
||||
@ -4442,6 +4463,22 @@ packages:
|
||||
print-js@1.6.0:
|
||||
resolution: {integrity: sha512-BfnOIzSKbqGRtO4o0rnj/K3681BSd2QUrsIZy/+WdCIugjIswjmx3lDEZpXB2ruGf9d4b3YNINri81+J0FsBWg==}
|
||||
|
||||
pro-composables@3.3.0:
|
||||
resolution: {integrity: sha512-lsd14qzKVI7FxsNgm06TMKhjKtgkbp0DEI1W2maHnQOinWXuNBnwh2NyKMBOCDJnRzlOW4QSSrt/YdIfjh01FQ==}
|
||||
peerDependencies:
|
||||
vue: '>= 3.3.0'
|
||||
|
||||
pro-naive-ui-resolver@1.0.2:
|
||||
resolution: {integrity: sha512-CEPDm2B4RSIxtVWdN+mlXNs8rQ4EQi5mp2x4ZTLgVhcvvC3v0NwxqHtjjR+swqGcBbKJ0ZN4/UlkxRIgd3+AdA==}
|
||||
engines: {node: '>=18.12.0'}
|
||||
|
||||
pro-naive-ui@2.1.2:
|
||||
resolution: {integrity: sha512-Ec9t2D9TNNp1ghPEsq5zMqZfgwyepbcyECapyrvIuL13DRcBoFF0HBZGFOZWa3jZ+qkYuntJWBAuCUQNqe9vyw==}
|
||||
engines: {node: '>=18.12.0'}
|
||||
peerDependencies:
|
||||
naive-ui: ^2.38.2
|
||||
vue: '>= 3.3.0'
|
||||
|
||||
progress@2.0.3:
|
||||
resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
@ -4785,6 +4822,9 @@ packages:
|
||||
resolution: {integrity: sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
sortablejs@1.15.6:
|
||||
resolution: {integrity: sha512-aNfiuwMEpfBM/CN6LY0ibyhxPfPbyFeBTYJKCvzkJ2GkUpazIt3H+QIPAMHwqQ7tMKaHz1Qj+rJJCqljnf4p3A==}
|
||||
|
||||
source-map-js@1.2.1:
|
||||
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@ -5336,6 +5376,17 @@ packages:
|
||||
'@vue/composition-api':
|
||||
optional: true
|
||||
|
||||
vue-demi@0.14.10:
|
||||
resolution: {integrity: sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==}
|
||||
engines: {node: '>=12'}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
'@vue/composition-api': ^1.0.0-rc.1
|
||||
vue: ^3.0.0-0 || ^2.6.0
|
||||
peerDependenciesMeta:
|
||||
'@vue/composition-api':
|
||||
optional: true
|
||||
|
||||
vue-draggable-plus@0.6.0:
|
||||
resolution: {integrity: sha512-G5TSfHrt9tX9EjdG49InoFJbt2NYk0h3kgjgKxkFWr3ulIUays0oFObr5KZ8qzD4+QnhtALiRwIqY6qul4egqw==}
|
||||
peerDependencies:
|
||||
@ -6731,6 +6782,8 @@ snapshots:
|
||||
|
||||
'@types/web-animations-js@2.2.16': {}
|
||||
|
||||
'@types/web-bluetooth@0.0.20': {}
|
||||
|
||||
'@types/web-bluetooth@0.0.21': {}
|
||||
|
||||
'@typescript-eslint/eslint-plugin@8.26.1(@typescript-eslint/parser@8.26.1(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.22.0(jiti@2.4.2))(typescript@5.8.2)':
|
||||
@ -6907,6 +6960,7 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- vue
|
||||
|
||||
'@vicons/antd@0.13.0': {}
|
||||
'@visactor/vchart-theme@1.12.2(@visactor/vchart@1.13.7)':
|
||||
dependencies:
|
||||
'@visactor/vchart': 1.13.7
|
||||
@ -7305,6 +7359,16 @@ snapshots:
|
||||
'@vueuse/shared': 13.0.0(vue@3.5.13(typescript@5.8.2))
|
||||
vue: 3.5.13(typescript@5.8.2)
|
||||
|
||||
'@vueuse/core@11.3.0(vue@3.5.13(typescript@5.8.2))':
|
||||
dependencies:
|
||||
'@types/web-bluetooth': 0.0.20
|
||||
'@vueuse/metadata': 11.3.0
|
||||
'@vueuse/shared': 11.3.0(vue@3.5.13(typescript@5.8.2))
|
||||
vue-demi: 0.14.10(vue@3.5.13(typescript@5.8.2))
|
||||
transitivePeerDependencies:
|
||||
- '@vue/composition-api'
|
||||
- vue
|
||||
|
||||
'@vueuse/core@13.0.0(vue@3.5.13(typescript@5.8.2))':
|
||||
dependencies:
|
||||
'@types/web-bluetooth': 0.0.21
|
||||
@ -7312,8 +7376,17 @@ snapshots:
|
||||
'@vueuse/shared': 13.0.0(vue@3.5.13(typescript@5.8.2))
|
||||
vue: 3.5.13(typescript@5.8.2)
|
||||
|
||||
'@vueuse/metadata@11.3.0': {}
|
||||
|
||||
'@vueuse/metadata@13.0.0': {}
|
||||
|
||||
'@vueuse/shared@11.3.0(vue@3.5.13(typescript@5.8.2))':
|
||||
dependencies:
|
||||
vue-demi: 0.14.10(vue@3.5.13(typescript@5.8.2))
|
||||
transitivePeerDependencies:
|
||||
- '@vue/composition-api'
|
||||
- vue
|
||||
|
||||
'@vueuse/shared@13.0.0(vue@3.5.13(typescript@5.8.2))':
|
||||
dependencies:
|
||||
vue: 3.5.13(typescript@5.8.2)
|
||||
@ -10207,6 +10280,38 @@ snapshots:
|
||||
|
||||
print-js@1.6.0: {}
|
||||
|
||||
pro-composables@3.3.0(vue@3.5.13(typescript@5.8.2)):
|
||||
dependencies:
|
||||
'@types/lodash-es': 4.17.12
|
||||
'@vueuse/core': 11.3.0(vue@3.5.13(typescript@5.8.2))
|
||||
lodash-es: 4.17.21
|
||||
type-fest: 4.37.0
|
||||
vue: 3.5.13(typescript@5.8.2)
|
||||
transitivePeerDependencies:
|
||||
- '@vue/composition-api'
|
||||
|
||||
pro-naive-ui-resolver@1.0.2: {}
|
||||
|
||||
pro-naive-ui@2.1.2(naive-ui@2.41.0(vue@3.5.13(typescript@5.8.2)))(vue@3.5.13(typescript@5.8.2)):
|
||||
dependencies:
|
||||
'@css-render/plugin-bem': 0.15.14(css-render@0.15.14)
|
||||
'@css-render/vue3-ssr': 0.15.14(vue@3.5.13(typescript@5.8.2))
|
||||
'@types/lodash-es': 4.17.12
|
||||
'@types/sortablejs': 1.15.8
|
||||
'@vicons/antd': 0.13.0
|
||||
'@vueuse/core': 11.3.0(vue@3.5.13(typescript@5.8.2))
|
||||
css-render: 0.15.14
|
||||
date-fns: 3.6.0
|
||||
lodash-es: 4.17.21
|
||||
naive-ui: 2.41.0(vue@3.5.13(typescript@5.8.2))
|
||||
pro-composables: 3.3.0(vue@3.5.13(typescript@5.8.2))
|
||||
sortablejs: 1.15.6
|
||||
type-fest: 4.37.0
|
||||
vooks: 0.2.12(vue@3.5.13(typescript@5.8.2))
|
||||
vue: 3.5.13(typescript@5.8.2)
|
||||
transitivePeerDependencies:
|
||||
- '@vue/composition-api'
|
||||
|
||||
progress@2.0.3: {}
|
||||
|
||||
prompts@2.4.2:
|
||||
@ -10622,6 +10727,8 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
sortablejs@1.15.6: {}
|
||||
|
||||
source-map-js@1.2.1: {}
|
||||
|
||||
source-map-resolve@0.5.3:
|
||||
@ -11222,6 +11329,10 @@ snapshots:
|
||||
dependencies:
|
||||
vue: 3.5.13(typescript@5.8.2)
|
||||
|
||||
vue-demi@0.14.10(vue@3.5.13(typescript@5.8.2)):
|
||||
dependencies:
|
||||
vue: 3.5.13(typescript@5.8.2)
|
||||
|
||||
vue-draggable-plus@0.6.0(@types/sortablejs@1.15.8):
|
||||
dependencies:
|
||||
'@types/sortablejs': 1.15.8
|
||||
|
@ -170,6 +170,7 @@ const local: App.I18n.Schema = {
|
||||
document_vite: 'Vite Document',
|
||||
document_unocss: 'UnoCSS Document',
|
||||
document_naive: 'Naive UI Document',
|
||||
'document_pro-naive': 'Pro Naive UI Document',
|
||||
document_antd: 'Ant Design Vue Document',
|
||||
document_alova: 'Alova Document',
|
||||
'user-center': 'User Center',
|
||||
@ -179,6 +180,14 @@ const local: App.I18n.Schema = {
|
||||
alova_request: 'Alova Request',
|
||||
alova_user: 'User List',
|
||||
alova_scenes: 'Scenario Request',
|
||||
'pro-naive': 'Pro Naive Example',
|
||||
'pro-naive_form': 'Form',
|
||||
'pro-naive_form_basic': 'Basic Form',
|
||||
'pro-naive_form_query': 'Query Form',
|
||||
'pro-naive_form_step': 'Step Form',
|
||||
'pro-naive_table': 'Table',
|
||||
'pro-naive_table_remote': 'Remote',
|
||||
'pro-naive_table_row-edit': 'Row Edit',
|
||||
function_tab: 'Tab',
|
||||
'function_multi-tab': 'Multi Tab',
|
||||
'function_hide-child': 'Hide Child',
|
||||
@ -370,6 +379,82 @@ const local: App.I18n.Schema = {
|
||||
triggerAllRequest: 'Manually Trigger All Automated Requests'
|
||||
}
|
||||
},
|
||||
proNaive: {
|
||||
form: {
|
||||
basic: {
|
||||
title: 'Basic Example',
|
||||
appName: 'ApplicationName',
|
||||
appStatus: 'ApplicationStatus',
|
||||
createTime: 'CreateTime',
|
||||
responseDate: 'ResponseDate',
|
||||
specificationInfo: 'SpecificationInfo',
|
||||
specificate: 'Specificate',
|
||||
specificationName: 'SpecificationName',
|
||||
specificationValue: 'SpecificationValue',
|
||||
specificationColorRed: 'Red',
|
||||
specificationColorOrange: 'Orange',
|
||||
addSpecificateItem: 'Add Specificate Item',
|
||||
fillValue: 'FillValue',
|
||||
reset: 'Reset',
|
||||
submit: 'Submit',
|
||||
add: 'Add',
|
||||
delete: 'Delete',
|
||||
color: 'Color',
|
||||
normal: 'Normal',
|
||||
anomaly: 'Anomaly'
|
||||
},
|
||||
query: {
|
||||
title1: 'Query Example, which expands by default',
|
||||
title2: 'Query Example, which fold by default, and two lines are retained when folding',
|
||||
appName: 'ApplicationName',
|
||||
appStatus: 'ApplicationStatus',
|
||||
createTime: 'CreateTime',
|
||||
responseDate: 'ResponseDate',
|
||||
endDate: 'EndDate',
|
||||
field: 'Field'
|
||||
},
|
||||
step: {
|
||||
title: 'Step Form',
|
||||
step1: {
|
||||
title: 'Form 1',
|
||||
field: 'Form 1 field',
|
||||
nextStep: 'Next Step'
|
||||
},
|
||||
step2: {
|
||||
title: 'Form 2',
|
||||
field: 'Form 2 field',
|
||||
prevStep: 'Prev Step',
|
||||
submit: 'Submit'
|
||||
}
|
||||
}
|
||||
},
|
||||
table: {
|
||||
remote: {
|
||||
filterCondition: 'Filter Condition',
|
||||
name: 'Name',
|
||||
createTime: 'CreateTime',
|
||||
responseTime: 'ResponseTime',
|
||||
title: 'Remote Loading',
|
||||
replicableText: 'Replicable Text',
|
||||
tags: 'Tags',
|
||||
dateFormatting: 'Date Formatting',
|
||||
image: 'Image'
|
||||
},
|
||||
rowEdit: {
|
||||
title: 'Edit Table',
|
||||
reset: 'Reset',
|
||||
submit: 'Submit',
|
||||
edit: 'Edit',
|
||||
delete: 'Delete',
|
||||
save: 'Save',
|
||||
task: 'Task',
|
||||
score: 'Score',
|
||||
time: 'Time',
|
||||
name: 'Name',
|
||||
action: 'Action'
|
||||
}
|
||||
}
|
||||
},
|
||||
manage: {
|
||||
common: {
|
||||
status: {
|
||||
|
@ -170,6 +170,7 @@ const local: App.I18n.Schema = {
|
||||
document_vite: 'Vite文档',
|
||||
document_unocss: 'UnoCSS文档',
|
||||
document_naive: 'Naive UI文档',
|
||||
'document_pro-naive': 'Pro Naive UI文档',
|
||||
document_antd: 'Ant Design Vue文档',
|
||||
document_alova: 'Alova文档',
|
||||
'user-center': '个人中心',
|
||||
@ -179,6 +180,14 @@ const local: App.I18n.Schema = {
|
||||
alova_request: 'alova请求',
|
||||
alova_user: '用户列表',
|
||||
alova_scenes: '场景化请求',
|
||||
'pro-naive': 'Pro Naive UI 示例',
|
||||
'pro-naive_form': '表单',
|
||||
'pro-naive_form_basic': '基础表单',
|
||||
'pro-naive_form_query': '查询表单',
|
||||
'pro-naive_form_step': '分步表单',
|
||||
'pro-naive_table': '表格',
|
||||
'pro-naive_table_remote': '远程加载',
|
||||
'pro-naive_table_row-edit': '行编辑',
|
||||
function_tab: '标签页',
|
||||
'function_multi-tab': '多标签页',
|
||||
'function_hide-child': '隐藏子菜单',
|
||||
@ -370,6 +379,82 @@ const local: App.I18n.Schema = {
|
||||
triggerAllRequest: '手动触发所有自动请求'
|
||||
}
|
||||
},
|
||||
proNaive: {
|
||||
form: {
|
||||
basic: {
|
||||
title: '基础示例',
|
||||
appName: '应用名称',
|
||||
appStatus: '应用状态',
|
||||
createTime: '创建时间',
|
||||
responseDate: '响应日期',
|
||||
specificationInfo: '规格信息',
|
||||
specificate: '规格',
|
||||
specificationName: '规格名',
|
||||
specificationValue: '规格值',
|
||||
specificationColorRed: '红',
|
||||
specificationColorOrange: '橙',
|
||||
addSpecificateItem: '添加规格项',
|
||||
fillValue: '填充值',
|
||||
reset: '重置',
|
||||
submit: '提交',
|
||||
add: '新建',
|
||||
delete: '删除',
|
||||
color: '颜色',
|
||||
normal: '正常',
|
||||
anomaly: '异常'
|
||||
},
|
||||
query: {
|
||||
title1: '查询表单,默认展开',
|
||||
title2: '查询表单,默认折叠,折叠时保留2行',
|
||||
appName: '应用名称',
|
||||
appStatus: '应用状态',
|
||||
createTime: '创建时间',
|
||||
responseDate: '响应日期',
|
||||
endDate: '结束日期',
|
||||
field: '字段'
|
||||
},
|
||||
step: {
|
||||
title: '分步表单',
|
||||
step1: {
|
||||
title: '表单1',
|
||||
field: '表单1字段',
|
||||
nextStep: '下一步'
|
||||
},
|
||||
step2: {
|
||||
title: '表单2',
|
||||
field: '表单2字段',
|
||||
prevStep: '上一步',
|
||||
submit: '提交'
|
||||
}
|
||||
}
|
||||
},
|
||||
table: {
|
||||
remote: {
|
||||
filterCondition: '筛选条件',
|
||||
name: '名称',
|
||||
createTime: '创建时间',
|
||||
responseTime: '响应时间',
|
||||
title: '远程加载',
|
||||
replicableText: '可复制文本',
|
||||
tags: 'tags',
|
||||
dateFormatting: '日期格式化',
|
||||
image: '图片'
|
||||
},
|
||||
rowEdit: {
|
||||
title: '编辑表格',
|
||||
reset: '重置',
|
||||
submit: '提交',
|
||||
edit: '编辑',
|
||||
delete: '删除',
|
||||
save: '保存',
|
||||
task: '任务',
|
||||
score: '评分',
|
||||
time: '时间',
|
||||
name: '名称',
|
||||
action: '操作'
|
||||
}
|
||||
}
|
||||
},
|
||||
manage: {
|
||||
common: {
|
||||
status: {
|
||||
|
11
src/main.ts
11
src/main.ts
@ -1,6 +1,13 @@
|
||||
import { createApp } from 'vue';
|
||||
import './plugins/assets';
|
||||
import { setupAppVersionNotification, setupDayjs, setupIconifyOffline, setupLoading, setupNProgress } from './plugins';
|
||||
import {
|
||||
setupAppVersionNotification,
|
||||
setupDayjs,
|
||||
setupIconifyOffline,
|
||||
setupLoading,
|
||||
setupNProgress,
|
||||
setupProNaiveComponents
|
||||
} from './plugins';
|
||||
import { setupStore } from './store';
|
||||
import { setupRouter } from './router';
|
||||
import { setupI18n } from './locales';
|
||||
@ -21,6 +28,8 @@ async function setupApp() {
|
||||
|
||||
await setupRouter(app);
|
||||
|
||||
setupProNaiveComponents(app);
|
||||
|
||||
setupI18n(app);
|
||||
|
||||
setupAppVersionNotification();
|
||||
|
10
src/plugins/components.ts
Normal file
10
src/plugins/components.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import type { App } from 'vue';
|
||||
import { ProDate, ProDateTime, ProInput, ProRate, create } from 'pro-naive-ui';
|
||||
|
||||
/** pro-naive-ui 支持配置表单的按需加载,所以需要注册 */
|
||||
export function setupProNaiveComponents(app: App) {
|
||||
const proNaive = create({
|
||||
components: [ProInput, ProDate, ProDateTime, ProRate]
|
||||
});
|
||||
app.use(proNaive);
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
export * from './loading';
|
||||
export * from './nprogress';
|
||||
export * from './components';
|
||||
export * from './iconify';
|
||||
export * from './dayjs';
|
||||
export * from './app';
|
||||
|
@ -58,5 +58,10 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro
|
||||
plugin_tables_vtable: () => import("@/views/plugin/tables/vtable/index.vue"),
|
||||
plugin_typeit: () => import("@/views/plugin/typeit/index.vue"),
|
||||
plugin_video: () => import("@/views/plugin/video/index.vue"),
|
||||
"pro-naive_form_basic": () => import("@/views/pro-naive/form/basic/index.vue"),
|
||||
"pro-naive_form_query": () => import("@/views/pro-naive/form/query/index.vue"),
|
||||
"pro-naive_form_step": () => import("@/views/pro-naive/form/step/index.vue"),
|
||||
"pro-naive_table_remote": () => import("@/views/pro-naive/table/remote/index.vue"),
|
||||
"pro-naive_table_row-edit": () => import("@/views/pro-naive/table/row-edit/index.vue"),
|
||||
"user-center": () => import("@/views/user-center/index.vue"),
|
||||
};
|
||||
|
@ -622,6 +622,86 @@ export const generatedRoutes: GeneratedRoute[] = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'pro-naive',
|
||||
path: '/pro-naive',
|
||||
component: 'layout.base',
|
||||
meta: {
|
||||
title: 'pro-naive',
|
||||
i18nKey: 'route.pro-naive',
|
||||
order: 7,
|
||||
icon: 'material-symbols-light:demography-outline-rounded'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'pro-naive_form',
|
||||
path: '/pro-naive/form',
|
||||
meta: {
|
||||
title: 'pro-naive_form',
|
||||
i18nKey: 'route.pro-naive_form',
|
||||
icon: 'fluent:form-28-regular'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'pro-naive_form_basic',
|
||||
path: '/pro-naive/form/basic',
|
||||
component: 'view.pro-naive_form_basic',
|
||||
meta: {
|
||||
title: 'pro-naive_form_basic',
|
||||
i18nKey: 'route.pro-naive_form_basic'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'pro-naive_form_query',
|
||||
path: '/pro-naive/form/query',
|
||||
component: 'view.pro-naive_form_query',
|
||||
meta: {
|
||||
title: 'pro-naive_form_query',
|
||||
i18nKey: 'route.pro-naive_form_query'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'pro-naive_form_step',
|
||||
path: '/pro-naive/form/step',
|
||||
component: 'view.pro-naive_form_step',
|
||||
meta: {
|
||||
title: 'pro-naive_form_step',
|
||||
i18nKey: 'route.pro-naive_form_step'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'pro-naive_table',
|
||||
path: '/pro-naive/table',
|
||||
meta: {
|
||||
title: 'pro-naive_table',
|
||||
i18nKey: 'route.pro-naive_table',
|
||||
icon: 'mynaui:table'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'pro-naive_table_remote',
|
||||
path: '/pro-naive/table/remote',
|
||||
component: 'view.pro-naive_table_remote',
|
||||
meta: {
|
||||
title: 'pro-naive_table_remote',
|
||||
i18nKey: 'route.pro-naive_table_remote'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'pro-naive_table_row-edit',
|
||||
path: '/pro-naive/table/row-edit',
|
||||
component: 'view.pro-naive_table_row-edit',
|
||||
meta: {
|
||||
title: 'pro-naive_table_row-edit',
|
||||
i18nKey: 'route.pro-naive_table_row-edit'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'user-center',
|
||||
path: '/user-center',
|
||||
|
@ -174,6 +174,7 @@ const routeMap: RouteMap = {
|
||||
"document_vite": "/document/vite",
|
||||
"document_unocss": "/document/unocss",
|
||||
"document_naive": "/document/naive",
|
||||
"document_pro-naive": "/document/pro-naive",
|
||||
"document_antd": "/document/antd",
|
||||
"document_alova": "/document/alova",
|
||||
"403": "/403",
|
||||
@ -232,6 +233,14 @@ const routeMap: RouteMap = {
|
||||
"plugin_tables_vtable": "/plugin/tables/vtable",
|
||||
"plugin_typeit": "/plugin/typeit",
|
||||
"plugin_video": "/plugin/video",
|
||||
"pro-naive": "/pro-naive",
|
||||
"pro-naive_form": "/pro-naive/form",
|
||||
"pro-naive_form_basic": "/pro-naive/form/basic",
|
||||
"pro-naive_form_query": "/pro-naive/form/query",
|
||||
"pro-naive_form_step": "/pro-naive/form/step",
|
||||
"pro-naive_table": "/pro-naive/table",
|
||||
"pro-naive_table_remote": "/pro-naive/table/remote",
|
||||
"pro-naive_table_row-edit": "/pro-naive/table/row-edit",
|
||||
"user-center": "/user-center"
|
||||
};
|
||||
|
||||
|
@ -91,6 +91,20 @@ const customRoutes: CustomRoute[] = [
|
||||
icon: 'logos:naiveui'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'document_pro-naive',
|
||||
path: '/document/pro-naive',
|
||||
component: 'view.iframe-page',
|
||||
props: {
|
||||
url: 'https://naive-ui.pro-components.cn/'
|
||||
},
|
||||
meta: {
|
||||
title: 'document_pro-naive',
|
||||
i18nKey: 'route.document_pro-naive',
|
||||
order: 6,
|
||||
icon: 'logos:naiveui'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'document_alova',
|
||||
path: '/document/alova',
|
||||
|
76
src/typings/app.d.ts
vendored
76
src/typings/app.d.ts
vendored
@ -554,6 +554,82 @@ declare namespace App {
|
||||
triggerAllRequest: string;
|
||||
};
|
||||
};
|
||||
proNaive: {
|
||||
form: {
|
||||
basic: {
|
||||
title: string;
|
||||
appName: string;
|
||||
appStatus: string;
|
||||
createTime: string;
|
||||
responseDate: string;
|
||||
specificationInfo: string;
|
||||
specificate: string;
|
||||
specificationName: string;
|
||||
specificationValue: string;
|
||||
specificationColorRed: string;
|
||||
specificationColorOrange: string;
|
||||
addSpecificateItem: string;
|
||||
fillValue: string;
|
||||
reset: string;
|
||||
submit: string;
|
||||
add: string;
|
||||
delete: string;
|
||||
color: string;
|
||||
normal: string;
|
||||
anomaly: string;
|
||||
};
|
||||
query: {
|
||||
title1: string;
|
||||
title2: string;
|
||||
appName: string;
|
||||
appStatus: string;
|
||||
createTime: string;
|
||||
responseDate: string;
|
||||
endDate: string;
|
||||
field: string;
|
||||
};
|
||||
step: {
|
||||
title: string;
|
||||
step1: {
|
||||
title: string;
|
||||
field: string;
|
||||
nextStep: string;
|
||||
};
|
||||
step2: {
|
||||
title: string;
|
||||
field: string;
|
||||
prevStep: string;
|
||||
submit: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
table: {
|
||||
remote: {
|
||||
filterCondition: string;
|
||||
name: string;
|
||||
createTime: string;
|
||||
responseTime: string;
|
||||
title: string;
|
||||
replicableText: string;
|
||||
tags: string;
|
||||
dateFormatting: string;
|
||||
image: string;
|
||||
};
|
||||
rowEdit: {
|
||||
title: string;
|
||||
reset: string;
|
||||
submit: string;
|
||||
edit: string;
|
||||
delete: string;
|
||||
save: string;
|
||||
task: string;
|
||||
score: string;
|
||||
time: string;
|
||||
name: string;
|
||||
action: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
manage: {
|
||||
common: {
|
||||
status: {
|
||||
|
12
src/typings/components.d.ts
vendored
12
src/typings/components.d.ts
vendored
@ -102,6 +102,8 @@ declare module 'vue' {
|
||||
NSpace: typeof import('naive-ui')['NSpace']
|
||||
NSpin: typeof import('naive-ui')['NSpin']
|
||||
NStatistic: typeof import('naive-ui')['NStatistic']
|
||||
NStep: typeof import('naive-ui')['NStep']
|
||||
NSteps: typeof import('naive-ui')['NSteps']
|
||||
NSwitch: typeof import('naive-ui')['NSwitch']
|
||||
NTab: typeof import('naive-ui')['NTab']
|
||||
NTabPane: typeof import('naive-ui')['NTabPane']
|
||||
@ -112,6 +114,16 @@ declare module 'vue' {
|
||||
NTree: typeof import('naive-ui')['NTree']
|
||||
NWatermark: typeof import('naive-ui')['NWatermark']
|
||||
PinToggler: typeof import('./../components/common/pin-toggler.vue')['default']
|
||||
ProCard: typeof import('pro-naive-ui')['ProCard']
|
||||
ProConfigProvider: typeof import('pro-naive-ui')['ProConfigProvider']
|
||||
ProDataTable: typeof import('pro-naive-ui')['ProDataTable']
|
||||
ProDate: typeof import('pro-naive-ui')['ProDate']
|
||||
ProEditDataTable: typeof import('pro-naive-ui')['ProEditDataTable']
|
||||
ProForm: typeof import('pro-naive-ui')['ProForm']
|
||||
ProFormList: typeof import('pro-naive-ui')['ProFormList']
|
||||
ProInput: typeof import('pro-naive-ui')['ProInput']
|
||||
ProSearchForm: typeof import('pro-naive-ui')['ProSearchForm']
|
||||
ProSelect: typeof import('pro-naive-ui')['ProSelect']
|
||||
ReloadButton: typeof import('./../components/common/reload-button.vue')['default']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
|
17
src/typings/elegant-router.d.ts
vendored
17
src/typings/elegant-router.d.ts
vendored
@ -28,6 +28,7 @@ declare module "@elegant-router/types" {
|
||||
"document_vite": "/document/vite";
|
||||
"document_unocss": "/document/unocss";
|
||||
"document_naive": "/document/naive";
|
||||
"document_pro-naive": "/document/pro-naive";
|
||||
"document_antd": "/document/antd";
|
||||
"document_alova": "/document/alova";
|
||||
"403": "/403";
|
||||
@ -86,6 +87,14 @@ declare module "@elegant-router/types" {
|
||||
"plugin_tables_vtable": "/plugin/tables/vtable";
|
||||
"plugin_typeit": "/plugin/typeit";
|
||||
"plugin_video": "/plugin/video";
|
||||
"pro-naive": "/pro-naive";
|
||||
"pro-naive_form": "/pro-naive/form";
|
||||
"pro-naive_form_basic": "/pro-naive/form/basic";
|
||||
"pro-naive_form_query": "/pro-naive/form/query";
|
||||
"pro-naive_form_step": "/pro-naive/form/step";
|
||||
"pro-naive_table": "/pro-naive/table";
|
||||
"pro-naive_table_remote": "/pro-naive/table/remote";
|
||||
"pro-naive_table_row-edit": "/pro-naive/table/row-edit";
|
||||
"user-center": "/user-center";
|
||||
};
|
||||
|
||||
@ -117,6 +126,7 @@ declare module "@elegant-router/types" {
|
||||
| "document_vite"
|
||||
| "document_unocss"
|
||||
| "document_naive"
|
||||
| "document_pro-naive"
|
||||
| "document_antd"
|
||||
| "document_alova"
|
||||
>;
|
||||
@ -143,6 +153,7 @@ declare module "@elegant-router/types" {
|
||||
| "manage"
|
||||
| "multi-menu"
|
||||
| "plugin"
|
||||
| "pro-naive"
|
||||
| "user-center"
|
||||
>;
|
||||
|
||||
@ -205,6 +216,11 @@ declare module "@elegant-router/types" {
|
||||
| "plugin_tables_vtable"
|
||||
| "plugin_typeit"
|
||||
| "plugin_video"
|
||||
| "pro-naive_form_basic"
|
||||
| "pro-naive_form_query"
|
||||
| "pro-naive_form_step"
|
||||
| "pro-naive_table_remote"
|
||||
| "pro-naive_table_row-edit"
|
||||
| "user-center"
|
||||
>;
|
||||
|
||||
@ -224,6 +240,7 @@ declare module "@elegant-router/types" {
|
||||
| "document_vite"
|
||||
| "document_unocss"
|
||||
| "document_naive"
|
||||
| "document_pro-naive"
|
||||
| "document_antd"
|
||||
| "document_alova"
|
||||
>;
|
||||
|
17
src/views/pro-naive/ConfigProvider.vue
Normal file
17
src/views/pro-naive/ConfigProvider.vue
Normal file
@ -0,0 +1,17 @@
|
||||
<script setup lang="tsx">
|
||||
import { computed } from 'vue';
|
||||
import { zhCN } from 'pro-naive-ui';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
|
||||
const appStore = useAppStore();
|
||||
|
||||
const locale = computed(() => {
|
||||
return appStore.locale === 'zh-CN' ? zhCN : undefined;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ProConfigProvider :locale="locale" class="h-full">
|
||||
<slot></slot>
|
||||
</ProConfigProvider>
|
||||
</template>
|
184
src/views/pro-naive/form/basic/index.vue
Normal file
184
src/views/pro-naive/form/basic/index.vue
Normal file
@ -0,0 +1,184 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { useMessage } from 'naive-ui';
|
||||
import { createProForm, zhCN } from 'pro-naive-ui';
|
||||
import { $t } from '@/locales';
|
||||
import ConfigProvider from '../../ConfigProvider.vue';
|
||||
|
||||
const submiting = ref(false);
|
||||
const message = useMessage();
|
||||
|
||||
const form = createProForm({
|
||||
initialValues: {
|
||||
attributes: [
|
||||
{
|
||||
name: $t('page.proNaive.form.basic.color'),
|
||||
items: [
|
||||
{ name: $t('page.proNaive.form.basic.specificationColorRed') },
|
||||
{ name: $t('page.proNaive.form.basic.specificationColorOrange') }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
onReset: () => {
|
||||
message.success('reset success');
|
||||
},
|
||||
onSubmit: async values => {
|
||||
submiting.value = true;
|
||||
await delay(1000);
|
||||
message.success(JSON.stringify(values));
|
||||
submiting.value = false;
|
||||
}
|
||||
});
|
||||
|
||||
function delay(time: number) {
|
||||
return new Promise<void>(resolve => {
|
||||
setTimeout(resolve, time);
|
||||
});
|
||||
}
|
||||
|
||||
function fillValues() {
|
||||
const values = {
|
||||
appName: $t('page.proNaive.form.basic.appName'),
|
||||
appStatus: 0,
|
||||
responseDate: Date.now()
|
||||
};
|
||||
// 方式一:直接修改 form.values.value
|
||||
// form.values.value.appName = '应用名称';
|
||||
// form.values.value.appStatus = 0;
|
||||
// form.values.value.responseDate = Date.now();
|
||||
|
||||
// 方式二:使用 Object.assign
|
||||
Object.assign(form.values.value, values);
|
||||
|
||||
// 方式三:直接重写 form.values.value
|
||||
// form.values.value = {...}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigProvider :locale="zhCN">
|
||||
<ProForm
|
||||
:form="form"
|
||||
:loading="submiting"
|
||||
:rules="{
|
||||
appName: {
|
||||
required: true
|
||||
}
|
||||
}"
|
||||
>
|
||||
<ProCard :title="$t('page.proNaive.form.basic.title')" :show-collapse="false">
|
||||
<template #header-extra>
|
||||
<NFlex>
|
||||
<NButton @click="fillValues">{{ $t('page.proNaive.form.basic.fillValue') }}</NButton>
|
||||
<NButton attr-type="reset">{{ $t('page.proNaive.form.basic.reset') }}</NButton>
|
||||
<NButton type="primary" attr-type="submit" :loading="submiting">
|
||||
{{ $t('page.proNaive.form.basic.submit') }}
|
||||
</NButton>
|
||||
</NFlex>
|
||||
</template>
|
||||
<NGrid cols="1 s:2 l:3" :x-gap="16" responsive="screen">
|
||||
<NGi>
|
||||
<ProInput
|
||||
:title="$t('page.proNaive.form.basic.appName')"
|
||||
:tooltip="$t('page.proNaive.form.basic.appName')"
|
||||
path="appName"
|
||||
/>
|
||||
</NGi>
|
||||
<NGi>
|
||||
<ProSelect
|
||||
:title="$t('page.proNaive.form.basic.appStatus')"
|
||||
path="appStatus"
|
||||
:field-props="{
|
||||
options: [
|
||||
{ label: $t('page.proNaive.form.basic.normal'), value: 0 },
|
||||
{ label: $t('page.proNaive.form.basic.anomaly'), value: 1 }
|
||||
]
|
||||
}"
|
||||
/>
|
||||
</NGi>
|
||||
<NGi>
|
||||
<ProDate :title="$t('page.proNaive.form.basic.createTime')" path="createTime" />
|
||||
</NGi>
|
||||
<NGi>
|
||||
<ProDate :title="$t('page.proNaive.form.basic.responseDate')" path="responseDate" required />
|
||||
</NGi>
|
||||
<NGi :span="3">
|
||||
<ProFormList
|
||||
:title="$t('page.proNaive.form.basic.specificationInfo')"
|
||||
path="attributes"
|
||||
:min="1"
|
||||
:creator-initial-value="
|
||||
() => ({
|
||||
name: $t('page.proNaive.form.basic.color'),
|
||||
items: [
|
||||
{ name: $t('page.proNaive.form.basic.specificationColorRed') },
|
||||
{ name: $t('page.proNaive.form.basic.specificationColorOrange') }
|
||||
]
|
||||
})
|
||||
"
|
||||
:copy-button-props="false"
|
||||
:creator-button-props="{
|
||||
content: $t('page.proNaive.form.basic.addSpecificateItem')
|
||||
}"
|
||||
>
|
||||
<template #item="{ index, itemDom, actionDom }">
|
||||
<NCard
|
||||
size="small"
|
||||
embedded
|
||||
:title="`${$t('page.proNaive.form.basic.specificate')}${index + 1}`"
|
||||
class="mb-8px"
|
||||
>
|
||||
<template #header-extra>
|
||||
<component :is="actionDom" />
|
||||
</template>
|
||||
<component :is="itemDom" />
|
||||
</NCard>
|
||||
</template>
|
||||
<ProInput
|
||||
:title="$t('page.proNaive.form.basic.specificationName')"
|
||||
path="name"
|
||||
:field-props="{
|
||||
class: 'w-230px!'
|
||||
}"
|
||||
/>
|
||||
<ProFormList
|
||||
:title="$t('page.proNaive.form.basic.specificationValue')"
|
||||
path="items"
|
||||
:min="1"
|
||||
:creator-button-props="{
|
||||
dashed: false,
|
||||
block: false,
|
||||
renderIcon: undefined,
|
||||
ghost: true,
|
||||
text: true,
|
||||
type: 'info',
|
||||
content: $t('page.proNaive.form.basic.add')
|
||||
}"
|
||||
:copy-button-props="false"
|
||||
:remove-button-props="{
|
||||
tooltip: $t('page.proNaive.form.basic.delete')
|
||||
}"
|
||||
>
|
||||
<template #item="{ itemDom, actionDom }">
|
||||
<div class="me-25px inline-flex">
|
||||
<component :is="itemDom" />
|
||||
<div class="ml-8px">
|
||||
<component :is="actionDom" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<ProInput
|
||||
path="name"
|
||||
:field-props="{
|
||||
class: 'w-104px!'
|
||||
}"
|
||||
/>
|
||||
</ProFormList>
|
||||
</ProFormList>
|
||||
</NGi>
|
||||
</NGrid>
|
||||
</ProCard>
|
||||
</ProForm>
|
||||
</ConfigProvider>
|
||||
</template>
|
99
src/views/pro-naive/form/query/index.vue
Normal file
99
src/views/pro-naive/form/query/index.vue
Normal file
@ -0,0 +1,99 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { useMessage } from 'naive-ui';
|
||||
import type { ProSearchFormColumns } from 'pro-naive-ui';
|
||||
import { createProSearchForm } from 'pro-naive-ui';
|
||||
import { $t } from '@/locales';
|
||||
import ConfigProvider from '../../ConfigProvider.vue';
|
||||
|
||||
interface Info {
|
||||
appName: string;
|
||||
appStatus: string;
|
||||
createTime: number;
|
||||
responseDate: number;
|
||||
endTime: number;
|
||||
}
|
||||
|
||||
const loading = ref(false);
|
||||
const loading2 = ref(false);
|
||||
const message = useMessage();
|
||||
|
||||
const form = createProSearchForm<Partial<Info>>({
|
||||
onReset: () => {
|
||||
message.success('reset success');
|
||||
},
|
||||
onSubmit: async values => {
|
||||
message.success(JSON.stringify(values));
|
||||
loading.value = true;
|
||||
await delay(1500);
|
||||
loading.value = false;
|
||||
}
|
||||
});
|
||||
|
||||
const form2 = createProSearchForm<Partial<Info>>({
|
||||
defaultCollapsed: true,
|
||||
onReset: () => {
|
||||
message.success('reset success');
|
||||
},
|
||||
onSubmit: async values => {
|
||||
message.success(JSON.stringify(values));
|
||||
loading2.value = true;
|
||||
await delay(1500);
|
||||
loading2.value = false;
|
||||
}
|
||||
});
|
||||
|
||||
const columns = computed<ProSearchFormColumns<Info>>(() => {
|
||||
return [
|
||||
{
|
||||
title: $t('page.proNaive.form.query.appName'),
|
||||
path: 'appName'
|
||||
},
|
||||
{
|
||||
title: $t('page.proNaive.form.query.createTime'),
|
||||
path: 'createTime',
|
||||
field: 'date'
|
||||
},
|
||||
{
|
||||
title: $t('page.proNaive.form.query.appStatus'),
|
||||
path: 'appStatus'
|
||||
},
|
||||
{
|
||||
title: $t('page.proNaive.form.query.responseDate'),
|
||||
path: 'responseDate',
|
||||
field: 'date-time'
|
||||
},
|
||||
{
|
||||
title: $t('page.proNaive.form.query.endDate'),
|
||||
path: 'endTime',
|
||||
field: 'date'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
const columns2 = computed(() => {
|
||||
return Array.from({ length: 20 }, (_, i) => ({
|
||||
title: `${$t('page.proNaive.form.query.field')}${i}`,
|
||||
path: `field${i}`
|
||||
}));
|
||||
});
|
||||
|
||||
function delay(time: number) {
|
||||
return new Promise<void>(resolve => {
|
||||
setTimeout(resolve, time);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigProvider>
|
||||
<div class="bg-#fff">
|
||||
<ProCard :title="$t('page.proNaive.form.query.title1')" :show-collapse="false">
|
||||
<ProSearchForm :form="form" :loading="loading" :columns="columns" />
|
||||
</ProCard>
|
||||
<ProCard class="mt-12px" :title="$t('page.proNaive.form.query.title2')" :show-collapse="false">
|
||||
<ProSearchForm :form="form2" :loading="loading2" :columns="columns2" :collapsed-rows="2" />
|
||||
</ProCard>
|
||||
</div>
|
||||
</ConfigProvider>
|
||||
</template>
|
72
src/views/pro-naive/form/step/index.vue
Normal file
72
src/views/pro-naive/form/step/index.vue
Normal file
@ -0,0 +1,72 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { useMessage } from 'naive-ui';
|
||||
import { createProForm } from 'pro-naive-ui';
|
||||
import { $t } from '@/locales';
|
||||
import ConfigProvider from '../../ConfigProvider.vue';
|
||||
|
||||
const step = ref(1);
|
||||
const submiting = ref(false);
|
||||
const message = useMessage();
|
||||
const form = createProForm();
|
||||
|
||||
const form2 = createProForm({
|
||||
onSubmit: async values => {
|
||||
submiting.value = true;
|
||||
await delay(1000);
|
||||
message.success(
|
||||
JSON.stringify({
|
||||
...form.values.value,
|
||||
...values
|
||||
})
|
||||
);
|
||||
submiting.value = false;
|
||||
}
|
||||
});
|
||||
|
||||
function toNextStepAfterValidated() {
|
||||
form.validate()?.then(() => {
|
||||
step.value += 1;
|
||||
});
|
||||
}
|
||||
|
||||
function delay(time: number) {
|
||||
return new Promise<void>(resolve => {
|
||||
setTimeout(resolve, time);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigProvider>
|
||||
<div class="color-#fff">
|
||||
<ProCard :title="$t('page.proNaive.form.step.title')" :segmented="{ content: true }" :show-collapse="false">
|
||||
<div class="flex flex-col items-center justify-center">
|
||||
<NSteps :current="step" class="mb-50px ml-200px w-60%">
|
||||
<NStep :title="$t('page.proNaive.form.step.step1.title')" />
|
||||
<NStep :title="$t('page.proNaive.form.step.step2.title')" />
|
||||
</NSteps>
|
||||
<template v-if="step === 1">
|
||||
<ProForm :form="form" label-placement="left">
|
||||
<ProInput :title="$t('page.proNaive.form.step.step1.field')" path="form1Field" required />
|
||||
<NButton @click="toNextStepAfterValidated">{{ $t('page.proNaive.form.step.step1.nextStep') }}</NButton>
|
||||
</ProForm>
|
||||
</template>
|
||||
<template v-if="step === 2">
|
||||
<ProForm :form="form2" :loading="submiting" label-placement="left">
|
||||
<ProInput :title="$t('page.proNaive.form.step.step2.field')" path="form2Field" required />
|
||||
<NFlex>
|
||||
<NButton :disabled="submiting" @click="step -= 1">
|
||||
{{ $t('page.proNaive.form.step.step2.prevStep') }}
|
||||
</NButton>
|
||||
<NButton type="primary" attr-type="submit" :loading="submiting">
|
||||
{{ $t('page.proNaive.form.step.step2.submit') }}
|
||||
</NButton>
|
||||
</NFlex>
|
||||
</ProForm>
|
||||
</template>
|
||||
</div>
|
||||
</ProCard>
|
||||
</div>
|
||||
</ConfigProvider>
|
||||
</template>
|
142
src/views/pro-naive/table/remote/index.vue
Normal file
142
src/views/pro-naive/table/remote/index.vue
Normal file
@ -0,0 +1,142 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import type { ProDataTableColumns, ProSearchFormColumns } from 'pro-naive-ui';
|
||||
import {
|
||||
createProSearchForm,
|
||||
renderProCopyableText,
|
||||
renderProDateText,
|
||||
renderProImages,
|
||||
renderProTags,
|
||||
useNDataTable
|
||||
} from 'pro-naive-ui';
|
||||
import { $t } from '@/locales';
|
||||
import ConfigProvider from '../../ConfigProvider.vue';
|
||||
|
||||
function fetchList(params: any, values: any) {
|
||||
console.log(params, values);
|
||||
return new Promise<{ total: number; list: any[] }>(resolve => {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
total: 987,
|
||||
list: [
|
||||
{
|
||||
now: Date.now(),
|
||||
src: 'https://07akioni.oss-cn-beijing.aliyuncs.com/07akioni.jpeg',
|
||||
no: '3',
|
||||
title: 'Wonderwall',
|
||||
length: '4:18'
|
||||
},
|
||||
{ now: Date.now(), src: '', no: '', title: "Don't Look Back in Anger", length: '4:48' },
|
||||
{ now: Date.now(), src: undefined, no: '12', title: 'Champagne Supernova', length: '7:27' },
|
||||
{ now: Date.now(), src: null, no: '33', title: 'Wonderwall', length: '4:18' },
|
||||
{ now: Date.now(), src: [], no: '44', title: "Don't Look Back in Anger", length: '4:48' },
|
||||
{
|
||||
now: Date.now(),
|
||||
src: [
|
||||
'https://07akioni.oss-cn-beijing.aliyuncs.com/07akioni.jpeg',
|
||||
'https://gw.alipayobjects.com/zos/antfincdn/aPkFc8Sj7n/method-draw-image.svg'
|
||||
],
|
||||
no: '122',
|
||||
title: 'Champagne Supernova',
|
||||
length: '7:27'
|
||||
},
|
||||
{ now: Date.now(), src: '', no: '333', title: 'Wonderwall', length: '4:18' },
|
||||
{ now: Date.now(), src: '', no: '4444', title: "Don't Look Back in Anger", length: '4:48' },
|
||||
{ now: Date.now(), src: '', no: '1222', title: 'Champagne Supernova', length: '7:27' },
|
||||
{ now: Date.now(), src: '', no: '33333', title: 'Wonderwall', length: '4:18' }
|
||||
]
|
||||
});
|
||||
}, 1500);
|
||||
});
|
||||
}
|
||||
|
||||
const columns = computed<ProDataTableColumns<{ src: any; title: string; now: number }>>(() => {
|
||||
return [
|
||||
{
|
||||
title: $t('page.proNaive.table.remote.replicableText'),
|
||||
render: row => renderProCopyableText(row.title)
|
||||
},
|
||||
{
|
||||
title: $t('page.proNaive.table.remote.tags'),
|
||||
render: row => renderProTags(row.title)
|
||||
},
|
||||
{
|
||||
title: $t('page.proNaive.table.remote.dateFormatting'),
|
||||
render: row =>
|
||||
renderProDateText(row.now, {
|
||||
pattern: 'quarter'
|
||||
})
|
||||
},
|
||||
{
|
||||
title: $t('page.proNaive.table.remote.image'),
|
||||
width: 200,
|
||||
render: row => renderProImages(row.src)
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
const searchColumns = computed<
|
||||
ProSearchFormColumns<{
|
||||
name: string;
|
||||
endTime: number;
|
||||
createTime: number;
|
||||
responseTime: number;
|
||||
}>
|
||||
>(() => {
|
||||
return [
|
||||
{
|
||||
title: $t('page.proNaive.table.remote.name'),
|
||||
path: 'name'
|
||||
},
|
||||
{
|
||||
title: $t('page.proNaive.table.remote.createTime'),
|
||||
path: 'createTime',
|
||||
field: 'date'
|
||||
},
|
||||
{
|
||||
title: $t('page.proNaive.table.remote.responseTime'),
|
||||
path: 'responseTime',
|
||||
field: 'date'
|
||||
},
|
||||
{
|
||||
title: $t('page.proNaive.table.remote.responseTime'),
|
||||
path: 'responseTime',
|
||||
field: 'date'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
const searchForm = createProSearchForm({
|
||||
initialValues: {
|
||||
responseTime: Date.now()
|
||||
}
|
||||
});
|
||||
|
||||
const {
|
||||
table: { tableProps },
|
||||
search: { proSearchFormProps }
|
||||
} = useNDataTable(
|
||||
({ current, pageSize, filters, sorter }, values) => fetchList({ current, pageSize, filters, sorter }, values),
|
||||
{
|
||||
form: searchForm
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigProvider>
|
||||
<div class="h-full flex flex-col">
|
||||
<ProCard :title="$t('page.proNaive.table.remote.filterCondition')" class="mb-24px" :show-collapse="false">
|
||||
<ProSearchForm :form="searchForm" label-placement="left" :columns="searchColumns" v-bind="proSearchFormProps" />
|
||||
</ProCard>
|
||||
<ProDataTable
|
||||
:title="$t('page.proNaive.table.remote.title')"
|
||||
size="small"
|
||||
flex-height
|
||||
:columns="columns"
|
||||
row-key="no"
|
||||
v-bind="tableProps"
|
||||
/>
|
||||
</div>
|
||||
</ConfigProvider>
|
||||
</template>
|
138
src/views/pro-naive/table/row-edit/index.vue
Normal file
138
src/views/pro-naive/table/row-edit/index.vue
Normal file
@ -0,0 +1,138 @@
|
||||
<script setup lang="tsx">
|
||||
import { computed, ref } from 'vue';
|
||||
import { NButton, NFlex, useMessage } from 'naive-ui';
|
||||
import type { ProEditDataTableColumns } from 'pro-naive-ui';
|
||||
import { createProForm } from 'pro-naive-ui';
|
||||
import { $t } from '@/locales';
|
||||
import ConfigProvider from '../../ConfigProvider.vue';
|
||||
|
||||
interface DataSourceType {
|
||||
id: string;
|
||||
title?: string;
|
||||
now?: number;
|
||||
rate?: number;
|
||||
}
|
||||
|
||||
const message = useMessage();
|
||||
const editableKeys = ref<string[]>([]);
|
||||
|
||||
const form = createProForm({
|
||||
initialValues: {
|
||||
list: [
|
||||
{
|
||||
id: '1',
|
||||
now: Date.now(),
|
||||
rate: 4,
|
||||
title: `${$t('page.proNaive.table.rowEdit.task')}1`
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
now: Date.now(),
|
||||
rate: 3,
|
||||
title: `${$t('page.proNaive.table.rowEdit.task')}2`
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
now: Date.now(),
|
||||
rate: 5,
|
||||
title: `${$t('page.proNaive.table.rowEdit.task')}3`
|
||||
}
|
||||
]
|
||||
},
|
||||
onSubmit: values => {
|
||||
message.success(JSON.stringify(values));
|
||||
}
|
||||
});
|
||||
|
||||
function cancelEditable(id: string) {
|
||||
editableKeys.value = editableKeys.value.filter(key => key !== id);
|
||||
}
|
||||
|
||||
const columns = computed<ProEditDataTableColumns<DataSourceType>>(() => {
|
||||
return [
|
||||
{
|
||||
title: $t('page.proNaive.table.rowEdit.name'),
|
||||
path: 'title',
|
||||
field: 'input',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
title: $t('page.proNaive.table.rowEdit.time'),
|
||||
path: 'now',
|
||||
field: 'date-time',
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
title: $t('page.proNaive.table.rowEdit.score'),
|
||||
path: 'rate',
|
||||
field: 'rate'
|
||||
},
|
||||
{
|
||||
title: $t('page.proNaive.table.rowEdit.action'),
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
render: (row, rowIndex, { remove, editable }) => {
|
||||
return (
|
||||
<NFlex>
|
||||
{editable ? (
|
||||
<NButton text={true} type="primary" onClick={() => cancelEditable(row.id)}>
|
||||
{$t('page.proNaive.table.rowEdit.save')}
|
||||
</NButton>
|
||||
) : (
|
||||
[
|
||||
<NButton text={true} type="primary" onClick={() => editableKeys.value.push(row.id)}>
|
||||
{$t('page.proNaive.table.rowEdit.edit')}
|
||||
</NButton>,
|
||||
<NButton
|
||||
text={true}
|
||||
type="error"
|
||||
onClick={() => {
|
||||
remove(rowIndex);
|
||||
cancelEditable(row.id);
|
||||
}}
|
||||
>
|
||||
{$t('page.proNaive.table.rowEdit.delete')}
|
||||
</NButton>
|
||||
]
|
||||
)}
|
||||
</NFlex>
|
||||
);
|
||||
}
|
||||
}
|
||||
];
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigProvider>
|
||||
<ProForm :form="form" label-placement="left">
|
||||
<ProConfigProvider
|
||||
:prop-overrides="{
|
||||
ProFormItem: {
|
||||
showFeedback: false
|
||||
}
|
||||
}"
|
||||
>
|
||||
<ProEditDataTable
|
||||
v-model:editable-keys="editableKeys"
|
||||
path="list"
|
||||
:columns="columns"
|
||||
:record-creator-props="{
|
||||
record: () => ({ id: Date.now() })
|
||||
}"
|
||||
row-key="id"
|
||||
:field-props="{
|
||||
title: $t('page.proNaive.table.rowEdit.title')
|
||||
}"
|
||||
>
|
||||
<template #toolbar>
|
||||
<NFlex>
|
||||
<NButton attr-type="reset">{{ $t('page.proNaive.table.rowEdit.reset') }}</NButton>
|
||||
<NButton type="primary" attr-type="submit">{{ $t('page.proNaive.table.rowEdit.submit') }}</NButton>
|
||||
</NFlex>
|
||||
</template>
|
||||
</ProEditDataTable>
|
||||
</ProConfigProvider>
|
||||
</ProForm>
|
||||
</ConfigProvider>
|
||||
</template>
|
Loading…
Reference in New Issue
Block a user