vendor: amis 6.13.0 base (fork root)
This commit is contained in:
347
examples/components/CRUD/Aside.jsx
Normal file
347
examples/components/CRUD/Aside.jsx
Normal file
@@ -0,0 +1,347 @@
|
||||
export default {
|
||||
title: '带边栏联动',
|
||||
aside: {
|
||||
type: 'form',
|
||||
wrapWithPanel: false,
|
||||
target: 'window', // 直接修改location,当然也可以直接指向某个组件。
|
||||
submitOnInit: true,
|
||||
body: [
|
||||
{
|
||||
type: 'input-tree',
|
||||
name: 'cat',
|
||||
inputClassName: 'no-border no-padder mt-1',
|
||||
heightAuto: true,
|
||||
submitOnChange: true,
|
||||
selectFirst: true,
|
||||
inputOnly: true,
|
||||
options: [
|
||||
{
|
||||
label: '分类1',
|
||||
value: 'cat1'
|
||||
},
|
||||
|
||||
{
|
||||
label: '分类2',
|
||||
value: 'cat2',
|
||||
children: [
|
||||
{
|
||||
label: '分类 2.1',
|
||||
value: 'cat2.1'
|
||||
},
|
||||
{
|
||||
label: '分类 2.2',
|
||||
value: 'cat2.2'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
label: '分类3',
|
||||
value: 'cat3'
|
||||
},
|
||||
|
||||
{
|
||||
label: '分类4',
|
||||
value: 'cat4'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
toolbar: [
|
||||
{
|
||||
type: 'button',
|
||||
actionType: 'dialog',
|
||||
label: '新增',
|
||||
primary: true,
|
||||
dialog: {
|
||||
title: '新增',
|
||||
body: {
|
||||
type: 'form',
|
||||
name: 'sample-edit-form',
|
||||
api: 'post:/api/sample',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
body: {
|
||||
type: 'crud',
|
||||
draggable: true,
|
||||
api: {
|
||||
url: '/api/sample',
|
||||
sendOn: 'this.cat'
|
||||
},
|
||||
filter: {
|
||||
title: '条件搜索',
|
||||
submitText: '',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'keywords',
|
||||
placeholder: '通过关键字搜索',
|
||||
addOn: {
|
||||
label: '搜索',
|
||||
type: 'submit'
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'plain',
|
||||
text: '这里的表单项可以配置多个'
|
||||
}
|
||||
]
|
||||
},
|
||||
bulkActions: [
|
||||
{
|
||||
label: '批量删除',
|
||||
actionType: 'ajax',
|
||||
api: 'delete:/api/sample/$ids',
|
||||
confirmText: '确定要批量删除?'
|
||||
},
|
||||
{
|
||||
label: '批量修改',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '批量编辑',
|
||||
name: 'sample-bulk-edit',
|
||||
body: {
|
||||
type: 'form',
|
||||
api: '/api/sample/bulkUpdate2',
|
||||
body: [
|
||||
{
|
||||
type: 'hidden',
|
||||
name: 'ids'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
quickSaveApi: '/api/sample/bulkUpdate',
|
||||
quickSaveItemApi: '/api/sample/$id',
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
width: 30,
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
sortable: true,
|
||||
searchable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version',
|
||||
quickEdit: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
label: 'CSS grade',
|
||||
quickEdit: {
|
||||
mode: 'inline',
|
||||
type: 'select',
|
||||
options: ['A', 'B', 'C', 'D', 'X'],
|
||||
saveImmediately: true
|
||||
},
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
type: 'operation',
|
||||
label: '操作',
|
||||
width: 130,
|
||||
buttons: [
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-eye',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '查看',
|
||||
body: {
|
||||
type: 'form',
|
||||
body: [
|
||||
{
|
||||
type: 'static',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'browser',
|
||||
label: 'Browser'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'html',
|
||||
html: '<p>添加其他 <span>Html 片段</span> 需要支持变量替换(todo).</p>'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-pencil',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '编辑',
|
||||
body: {
|
||||
type: 'form',
|
||||
name: 'sample-edit-form',
|
||||
api: '/api/sample/$id',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-times text-danger',
|
||||
actionType: 'ajax',
|
||||
confirmText: '您确认要删除?',
|
||||
api: 'delete:/api/sample/$id'
|
||||
}
|
||||
],
|
||||
toggled: true
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
256
examples/components/CRUD/Aside2.jsx
Normal file
256
examples/components/CRUD/Aside2.jsx
Normal file
@@ -0,0 +1,256 @@
|
||||
export default {
|
||||
title: '带边栏联动',
|
||||
aside: {
|
||||
type: 'nav',
|
||||
name: 'nav',
|
||||
stacked: true,
|
||||
source: '/api/mock2/options/nav?parentId=${value}&waitSeconds=2'
|
||||
},
|
||||
toolbar: [
|
||||
{
|
||||
type: 'button',
|
||||
actionType: 'reload',
|
||||
label: 'Reload Nav',
|
||||
primary: true,
|
||||
target: 'nav'
|
||||
}
|
||||
],
|
||||
body: {
|
||||
type: 'crud',
|
||||
draggable: true,
|
||||
api: {
|
||||
url: '/api/sample',
|
||||
sendOn: 'this.cat'
|
||||
},
|
||||
filter: {
|
||||
title: '条件搜索',
|
||||
submitText: '',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'keywords',
|
||||
placeholder: '通过关键字搜索',
|
||||
addOn: {
|
||||
label: '搜索',
|
||||
type: 'submit'
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'plain',
|
||||
text: '这里的表单项可以配置多个'
|
||||
}
|
||||
]
|
||||
},
|
||||
bulkActions: [
|
||||
{
|
||||
label: '批量删除',
|
||||
actionType: 'ajax',
|
||||
api: 'delete:/api/sample/$ids',
|
||||
confirmText: '确定要批量删除?'
|
||||
},
|
||||
{
|
||||
label: '批量修改',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '批量编辑',
|
||||
name: 'sample-bulk-edit',
|
||||
body: {
|
||||
type: 'form',
|
||||
api: '/api/sample/bulkUpdate2',
|
||||
body: [
|
||||
{
|
||||
type: 'hidden',
|
||||
name: 'ids'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
quickSaveApi: '/api/sample/bulkUpdate',
|
||||
quickSaveItemApi: '/api/sample/$id',
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
width: 30,
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
sortable: true,
|
||||
searchable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version',
|
||||
quickEdit: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
label: 'CSS grade',
|
||||
quickEdit: {
|
||||
mode: 'inline',
|
||||
type: 'select',
|
||||
options: ['A', 'B', 'C', 'D', 'X'],
|
||||
saveImmediately: true
|
||||
},
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
type: 'operation',
|
||||
label: '操作',
|
||||
width: 130,
|
||||
buttons: [
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-eye',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '查看',
|
||||
body: {
|
||||
type: 'form',
|
||||
body: [
|
||||
{
|
||||
type: 'static',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'browser',
|
||||
label: 'Browser'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'html',
|
||||
html: '<p>添加其他 <span>Html 片段</span> 需要支持变量替换(todo).</p>'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-pencil',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '编辑',
|
||||
body: {
|
||||
type: 'form',
|
||||
name: 'sample-edit-form',
|
||||
api: '/api/sample/$id',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-times text-danger',
|
||||
actionType: 'ajax',
|
||||
confirmText: '您确认要删除?',
|
||||
api: 'delete:/api/sample/$id'
|
||||
}
|
||||
],
|
||||
toggled: true
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
8
examples/components/CRUD/Dynamic.jsx
Normal file
8
examples/components/CRUD/Dynamic.jsx
Normal file
@@ -0,0 +1,8 @@
|
||||
export default {
|
||||
title: '动态表格',
|
||||
subTitle: '返回表格数据的同时返回列信息',
|
||||
body: {
|
||||
type: 'crud',
|
||||
api: '/api/crud/dynamic?waitSeconds=1'
|
||||
}
|
||||
};
|
||||
291
examples/components/CRUD/ExportCSVExcel.jsx
Normal file
291
examples/components/CRUD/ExportCSVExcel.jsx
Normal file
@@ -0,0 +1,291 @@
|
||||
export default {
|
||||
title: 'CSV 导出的是原始数据,而 Excel 是尽可能还原展现效果',
|
||||
body: {
|
||||
type: 'crud',
|
||||
headerToolbar: ['export-excel', 'export-excel-template', 'export-csv'],
|
||||
data: {
|
||||
mapping_type: {
|
||||
'*': '其他'
|
||||
},
|
||||
items: [
|
||||
{
|
||||
link: 'https://www.microsoft1.com/',
|
||||
icon: __uri('../../static/ie.png'),
|
||||
browser: 'Internet Explorer 4.2 2',
|
||||
platform: 'Win 95+',
|
||||
notExport: '1',
|
||||
grade: 'A',
|
||||
engine: {
|
||||
name: 'Trident1',
|
||||
version: '4/2'
|
||||
},
|
||||
date: '1591326307',
|
||||
num: '12312334234234523',
|
||||
children: [
|
||||
{
|
||||
link: 'https://www.microsoft2.com/',
|
||||
engine: {
|
||||
name: 'Trident2',
|
||||
version: '4/2'
|
||||
},
|
||||
browser: 'Internet Explorer 4.0',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'X',
|
||||
id: 1001
|
||||
},
|
||||
{
|
||||
link: 'https://www.microsoft3.com/',
|
||||
engine: {
|
||||
name: 'Trident3',
|
||||
version: '3/2'
|
||||
},
|
||||
browser: 'Internet Explorer 5.0',
|
||||
platform: 'Win 95+',
|
||||
version: '5',
|
||||
grade: 'C',
|
||||
id: 1002
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
link: 'https://www.microsoft.com/',
|
||||
icon: __uri('../../static/ie.png'),
|
||||
browser: 'Internet Explorer 4.2',
|
||||
platform: 'Win 95+',
|
||||
notExport: '1',
|
||||
grade: 'A',
|
||||
engine: {
|
||||
name: 'Trident',
|
||||
version: '4/2'
|
||||
},
|
||||
date: '1591326307',
|
||||
city: '310100',
|
||||
num: '12312334234234523'
|
||||
},
|
||||
{
|
||||
link: 'https://www.microsoft.com/',
|
||||
icon: __uri('../../static/ie.png'),
|
||||
browser: 'Internet Explorer 4.2',
|
||||
platform: 'Win 95+',
|
||||
engine: {
|
||||
name: 'Trident',
|
||||
version: '4'
|
||||
},
|
||||
notExport: '1',
|
||||
grade: 'B',
|
||||
date: '1591322307',
|
||||
num: 1231233423232
|
||||
},
|
||||
{
|
||||
link: 'https://www.microsoft.com/',
|
||||
icon: __uri('../../static/ie.png'),
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 95+',
|
||||
engine: {
|
||||
name: 'Trident',
|
||||
version: '4'
|
||||
},
|
||||
notExport: '1',
|
||||
grade: 'C',
|
||||
date: '1591322307'
|
||||
},
|
||||
{
|
||||
link: 'https://www.microsoft.com/',
|
||||
icon: __uri('../../static/ie.png'),
|
||||
engine: {
|
||||
name: 'Trident',
|
||||
version: '3'
|
||||
},
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 98',
|
||||
notExport: '1',
|
||||
grade: 'A',
|
||||
date: '1591322307'
|
||||
},
|
||||
{
|
||||
link: 'https://www.microsoft.com/',
|
||||
icon: __uri('../../static/ie.png'),
|
||||
engine: {
|
||||
name: 'Trident',
|
||||
version: '4'
|
||||
},
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 98',
|
||||
notExport: '1',
|
||||
grade: 'A',
|
||||
date: '1591322307'
|
||||
},
|
||||
{
|
||||
icon: __uri('../../static/firefox.png'),
|
||||
link: 'https://www.mozilla.org/',
|
||||
browser: 'Firefox 1.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
engine: {
|
||||
name: 'Gecko',
|
||||
version: '4'
|
||||
},
|
||||
notExport: '1',
|
||||
grade: 'A',
|
||||
date: '1591322307'
|
||||
},
|
||||
{
|
||||
icon: __uri('../../static/firefox.png'),
|
||||
link: 'https://www.mozilla.org/',
|
||||
browser: 'Firefox 1.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
engine: {
|
||||
name: 'Gecko',
|
||||
version: '5'
|
||||
},
|
||||
notExport: '1',
|
||||
grade: 'A',
|
||||
date: '1591322307'
|
||||
},
|
||||
{
|
||||
icon: __uri('../../static/firefox.png'),
|
||||
link: 'https://www.mozilla.org/',
|
||||
engine: {
|
||||
name: 'Gecko',
|
||||
version: '5'
|
||||
},
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
notExport: '1',
|
||||
grade: 'B',
|
||||
date: '1591322307'
|
||||
},
|
||||
{
|
||||
icon: __uri('../../static/firefox.png'),
|
||||
link: 'https://www.mozilla.org/',
|
||||
engine: {
|
||||
name: 'Gecko',
|
||||
version: '5'
|
||||
},
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
notExport: '1',
|
||||
grade: 'C',
|
||||
date: '1591322307'
|
||||
},
|
||||
{
|
||||
icon: __uri('../../static/firefox.png'),
|
||||
link: 'https://www.mozilla.org/',
|
||||
engine: {
|
||||
name: 'Gecko',
|
||||
version: '5'
|
||||
},
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
notExport: '1',
|
||||
grade: 'D'
|
||||
}
|
||||
]
|
||||
},
|
||||
combineNum: 3,
|
||||
columns: [
|
||||
{
|
||||
name: 'icon',
|
||||
label: '<%= "图标" %>',
|
||||
type: 'image'
|
||||
},
|
||||
{
|
||||
name: 'link',
|
||||
label: '官网',
|
||||
type: 'link'
|
||||
},
|
||||
{
|
||||
name: 'link',
|
||||
label: '浏览器地址',
|
||||
type: 'link',
|
||||
href: 'http://www.browser.com/?q=${browser}',
|
||||
body: '${browser}'
|
||||
},
|
||||
{
|
||||
name: 'engine.name',
|
||||
label: '引擎',
|
||||
className: 'text-primary'
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: '浏览器'
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: '操作系统'
|
||||
},
|
||||
{
|
||||
name: 'engine.version',
|
||||
label: '引擎版本',
|
||||
type: 'tpl',
|
||||
tpl: '<b>${engine.version}</b>',
|
||||
classNameExpr:
|
||||
"<%= data.engine.version > 4 ? 'bg-green-100' : 'bg-red-50' %>"
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
label: 'CSS等级',
|
||||
type: 'mapping',
|
||||
map: {
|
||||
A: '优',
|
||||
B: '中',
|
||||
C: '差',
|
||||
D: '极差'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
label: 'CSS grade',
|
||||
type: 'mapping',
|
||||
source: '${mapping_type}'
|
||||
},
|
||||
{
|
||||
name: 'date',
|
||||
label: 'Date',
|
||||
type: 'date'
|
||||
},
|
||||
{
|
||||
name: 'city',
|
||||
label: 'city',
|
||||
type: 'input-city'
|
||||
},
|
||||
{
|
||||
name: 'num',
|
||||
label: 'num'
|
||||
}
|
||||
],
|
||||
prefixRow: [
|
||||
{
|
||||
type: 'text',
|
||||
text: '前置总计',
|
||||
colSpan: 2
|
||||
},
|
||||
{
|
||||
type: 'tpl',
|
||||
tpl: '${items|pick:engine.version|sum}'
|
||||
}
|
||||
],
|
||||
affixRow: [
|
||||
[
|
||||
{
|
||||
type: 'text',
|
||||
text: '总计1'
|
||||
},
|
||||
{
|
||||
type: 'tpl',
|
||||
tpl: '${items|pick:engine.version|sum}'
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
type: 'text',
|
||||
text: '总计2'
|
||||
},
|
||||
{
|
||||
type: 'tpl',
|
||||
tpl: '${items|pick:engine.version|sum}'
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
};
|
||||
95
examples/components/CRUD/Fields.jsx
Normal file
95
examples/components/CRUD/Fields.jsx
Normal file
@@ -0,0 +1,95 @@
|
||||
export default {
|
||||
title: '增删改查列类型汇总',
|
||||
body: {
|
||||
type: 'crud',
|
||||
api: '/api/mock2/crud/list',
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
type: 'text'
|
||||
},
|
||||
{
|
||||
name: 'audio',
|
||||
label: '音频',
|
||||
type: 'audio'
|
||||
},
|
||||
{
|
||||
name: 'carousel',
|
||||
label: '轮播图',
|
||||
type: 'carousel',
|
||||
width: '300'
|
||||
},
|
||||
{
|
||||
name: 'text',
|
||||
label: '文本',
|
||||
type: 'text'
|
||||
},
|
||||
{
|
||||
type: 'image',
|
||||
label: '图片',
|
||||
name: 'image',
|
||||
enlargeAble: true,
|
||||
title: '233',
|
||||
thumbMode: 'cover'
|
||||
// popOver: {
|
||||
// title: '查看大图',
|
||||
// body: '<div class="w-xxl"><img class="w-full" src="${image}"/></div>'
|
||||
// }
|
||||
},
|
||||
{
|
||||
name: 'date',
|
||||
type: 'date',
|
||||
label: '日期'
|
||||
},
|
||||
{
|
||||
name: 'progress',
|
||||
label: '进度',
|
||||
type: 'progress'
|
||||
},
|
||||
{
|
||||
name: 'boolean',
|
||||
label: '状态',
|
||||
type: 'status'
|
||||
},
|
||||
{
|
||||
name: 'boolean',
|
||||
label: '开关',
|
||||
type: 'switch'
|
||||
// readOnly: false // 可以开启修改模式
|
||||
},
|
||||
{
|
||||
name: 'type',
|
||||
label: '映射',
|
||||
type: 'mapping',
|
||||
map: {
|
||||
'*': '其他:${type}',
|
||||
'1': "<span class='label label-info'>漂亮</span>",
|
||||
'2': "<span class='label label-success'>开心</span>",
|
||||
'3': "<span class='label label-danger'>惊吓</span>",
|
||||
'4': "<span class='label label-warning'>紧张</span>"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
name: 'list',
|
||||
type: 'list',
|
||||
label: 'List',
|
||||
placeholder: '-',
|
||||
width: 400,
|
||||
size: 'sm',
|
||||
listItem: {
|
||||
title: '${title}',
|
||||
subTitle: '${description}'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
name: 'json',
|
||||
width: 200,
|
||||
type: 'json',
|
||||
label: 'Json'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
309
examples/components/CRUD/Fix.jsx
Normal file
309
examples/components/CRUD/Fix.jsx
Normal file
@@ -0,0 +1,309 @@
|
||||
const data = [
|
||||
{
|
||||
engine: 'Other browsers',
|
||||
browser: 'All others',
|
||||
platform: '-',
|
||||
version: '-',
|
||||
grade: 'U',
|
||||
progress: 50,
|
||||
status: true,
|
||||
weight: 56,
|
||||
others: null,
|
||||
createdAt: '2017-11-17T08:47:50.000Z',
|
||||
updatedAt: '2017-11-17T08:47:50.000Z'
|
||||
},
|
||||
{
|
||||
engine: 'Misc',
|
||||
browser: 'PSP browser',
|
||||
platform: 'PSP',
|
||||
version: '-',
|
||||
grade: 'C',
|
||||
progress: 50,
|
||||
status: true,
|
||||
weight: 55,
|
||||
others: null,
|
||||
createdAt: '2017-11-17T08:47:50.000Z',
|
||||
updatedAt: '2017-11-17T08:47:50.000Z'
|
||||
},
|
||||
{
|
||||
engine: 'Misc',
|
||||
browser: 'PSP browser',
|
||||
platform: 'PSP',
|
||||
version: '-',
|
||||
grade: 'C',
|
||||
progress: 50,
|
||||
status: true,
|
||||
weight: 55,
|
||||
others: null,
|
||||
createdAt: '2017-11-17T08:47:50.000Z',
|
||||
updatedAt: '2017-11-17T08:47:50.000Z'
|
||||
},
|
||||
{
|
||||
engine: 'Other browsers',
|
||||
browser: 'All others',
|
||||
platform: '-',
|
||||
version: '-',
|
||||
grade: 'U',
|
||||
progress: 50,
|
||||
status: true,
|
||||
weight: 56,
|
||||
others: null,
|
||||
createdAt: '2017-11-17T08:47:50.000Z',
|
||||
updatedAt: '2017-11-17T08:47:50.000Z'
|
||||
},
|
||||
{
|
||||
engine: 'Misc',
|
||||
browser: 'PSP browser',
|
||||
platform: 'PSP',
|
||||
version: '-',
|
||||
grade: 'C',
|
||||
progress: 50,
|
||||
status: true,
|
||||
weight: 55,
|
||||
others: null,
|
||||
createdAt: '2017-11-17T08:47:50.000Z',
|
||||
updatedAt: '2017-11-17T08:47:50.000Z'
|
||||
},
|
||||
{
|
||||
engine: 'Misc',
|
||||
browser: 'PSP browser',
|
||||
platform: 'PSP',
|
||||
version: '-',
|
||||
grade: 'C',
|
||||
progress: 50,
|
||||
status: true,
|
||||
weight: 55,
|
||||
others: null,
|
||||
createdAt: '2017-11-17T08:47:50.000Z',
|
||||
updatedAt: '2017-11-17T08:47:50.000Z'
|
||||
},
|
||||
{
|
||||
engine: 'Other browsers',
|
||||
browser: 'All others',
|
||||
platform: '-',
|
||||
version: '-',
|
||||
grade: 'U',
|
||||
progress: 50,
|
||||
status: true,
|
||||
weight: 56,
|
||||
others: null,
|
||||
createdAt: '2017-11-17T08:47:50.000Z',
|
||||
updatedAt: '2017-11-17T08:47:50.000Z'
|
||||
},
|
||||
{
|
||||
engine: 'Misc',
|
||||
browser: 'PSP browser',
|
||||
platform: 'PSP',
|
||||
version: '-',
|
||||
grade: 'C',
|
||||
progress: 50,
|
||||
status: true,
|
||||
weight: 55,
|
||||
others: null,
|
||||
createdAt: '2017-11-17T08:47:50.000Z',
|
||||
updatedAt: '2017-11-17T08:47:50.000Z'
|
||||
},
|
||||
{
|
||||
engine: 'Misc',
|
||||
browser: 'PSP browser',
|
||||
platform: 'PSP',
|
||||
version: '-',
|
||||
grade: 'C',
|
||||
progress: 50,
|
||||
status: true,
|
||||
weight: 55,
|
||||
others: null,
|
||||
createdAt: '2017-11-17T08:47:50.000Z',
|
||||
updatedAt: '2017-11-17T08:47:50.000Z'
|
||||
},
|
||||
{
|
||||
engine: 'Other browsers',
|
||||
browser: 'All others',
|
||||
platform: '-',
|
||||
version: '-',
|
||||
grade: 'U',
|
||||
progress: 50,
|
||||
status: true,
|
||||
weight: 56,
|
||||
others: null,
|
||||
createdAt: '2017-11-17T08:47:50.000Z',
|
||||
updatedAt: '2017-11-17T08:47:50.000Z'
|
||||
}
|
||||
].map((item, key) => ({
|
||||
...item,
|
||||
id: key + 1
|
||||
}));
|
||||
|
||||
const table = {
|
||||
type: 'table',
|
||||
data,
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
width: 30,
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true,
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
sortable: true,
|
||||
searchable: true,
|
||||
type: 'text',
|
||||
toggled: true,
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version',
|
||||
quickEdit: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
label: 'CSS grade',
|
||||
quickEdit: {
|
||||
mode: 'inline',
|
||||
type: 'select',
|
||||
options: ['A', 'B', 'C', 'D', 'X'],
|
||||
saveImmediately: true
|
||||
},
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version',
|
||||
quickEdit: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version',
|
||||
quickEdit: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true,
|
||||
fixed: 'right'
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version',
|
||||
quickEdit: true,
|
||||
type: 'text',
|
||||
toggled: true,
|
||||
fixed: 'right'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export default {
|
||||
title: '固顶和列固定示例',
|
||||
remark: 'bla bla bla',
|
||||
body: [
|
||||
table,
|
||||
{
|
||||
label: '点击弹框',
|
||||
type: 'button',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '弹框标题',
|
||||
size: 'lg',
|
||||
body: [
|
||||
{...table, data},
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>'
|
||||
]
|
||||
}
|
||||
},
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
'<div>分割</div>',
|
||||
table
|
||||
]
|
||||
};
|
||||
196
examples/components/CRUD/Footable.jsx
Normal file
196
examples/components/CRUD/Footable.jsx
Normal file
@@ -0,0 +1,196 @@
|
||||
export default {
|
||||
title: '开启单条底部展示功能',
|
||||
body: {
|
||||
type: 'crud',
|
||||
draggable: true,
|
||||
api: '/api/sample',
|
||||
footable: {
|
||||
expand: 'first',
|
||||
accordion: true
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
width: 30,
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
sortable: true,
|
||||
searchable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version',
|
||||
quickEdit: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
label: 'CSS grade',
|
||||
breakpoint: '*',
|
||||
quickEdit: {
|
||||
mode: 'inline',
|
||||
type: 'select',
|
||||
options: ['A', 'B', 'C', 'D', 'X'],
|
||||
inputClassName: 'w-xs',
|
||||
saveImmediately: true
|
||||
},
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
type: 'operation',
|
||||
label: '操作',
|
||||
width: 100,
|
||||
breakpoint: '*',
|
||||
buttons: [
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-eye',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '查看',
|
||||
body: {
|
||||
type: 'form',
|
||||
body: [
|
||||
{
|
||||
type: 'static',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'browser',
|
||||
label: 'Browser'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'html',
|
||||
html: '<p>添加其他 <span>Html 片段</span> 需要支持变量替换(todo).</p>'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-pencil',
|
||||
actionType: 'drawer',
|
||||
drawer: {
|
||||
position: 'left',
|
||||
size: 'lg',
|
||||
title: '编辑',
|
||||
body: {
|
||||
type: 'form',
|
||||
name: 'sample-edit-form',
|
||||
api: '/api/sample/$id',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
name: 'grade',
|
||||
label: 'CSS grade',
|
||||
options: ['A', 'B', 'C', 'D', 'X']
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-times text-danger',
|
||||
actionType: 'ajax',
|
||||
confirmText: '您确认要删除?',
|
||||
api: 'delete:/api/sample/$id'
|
||||
}
|
||||
],
|
||||
toggled: true
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
220
examples/components/CRUD/Grid.jsx
Normal file
220
examples/components/CRUD/Grid.jsx
Normal file
@@ -0,0 +1,220 @@
|
||||
export default {
|
||||
title: '增删改查示例',
|
||||
remark: 'bla bla bla',
|
||||
body: {
|
||||
type: 'crud',
|
||||
api: '/api/sample',
|
||||
// api: "/api/mock2/crud/table?waitSeconds=100000",
|
||||
mode: 'cards',
|
||||
defaultParams: {
|
||||
perPage: 12
|
||||
},
|
||||
// fixAlignment: true,
|
||||
// masonryLayout: true,
|
||||
filter: {
|
||||
title: '条件搜索',
|
||||
submitText: '',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'keywords',
|
||||
placeholder: '通过关键字搜索',
|
||||
addOn: {
|
||||
label: '搜索',
|
||||
type: 'submit'
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'plain',
|
||||
text: '这只是个示例, 目前搜索对查询结果无效.'
|
||||
}
|
||||
]
|
||||
},
|
||||
bulkActions: [
|
||||
{
|
||||
label: '批量删除',
|
||||
actionType: 'ajax',
|
||||
api: 'delete:/api/sample/${ids|raw}',
|
||||
confirmText: '确定要批量删除?'
|
||||
},
|
||||
{
|
||||
label: '批量修改',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '批量编辑',
|
||||
name: 'sample-bulk-edit',
|
||||
body: {
|
||||
type: 'form',
|
||||
api: '/api/sample/bulkUpdate2',
|
||||
body: [
|
||||
{
|
||||
type: 'hidden',
|
||||
name: 'ids'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
quickSaveApi: '/api/sample/bulkUpdate',
|
||||
quickSaveItemApi: '/api/sample/$id',
|
||||
draggable: true,
|
||||
card: {
|
||||
header: {
|
||||
title: '$engine',
|
||||
subTitle: '$platform',
|
||||
subTitlePlaceholder: '暂无说明',
|
||||
avatar:
|
||||
'<%= data.avatar || "https://internal-amis-res.cdn.bcebos.com/images/2019-12/1575350573496/4873dbfaf6a5.png" %>',
|
||||
avatarClassName: 'pull-left thumb b-3x m-r'
|
||||
},
|
||||
actions: [
|
||||
{
|
||||
type: 'button',
|
||||
label: '查看',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '查看',
|
||||
body: {
|
||||
type: 'form',
|
||||
body: [
|
||||
{
|
||||
type: 'static',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'browser',
|
||||
label: 'Browser'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'html',
|
||||
html:
|
||||
'<p>添加其他 <span>Html 片段</span> 需要支持变量替换(todo).</p>'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
label: '编辑',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '编辑',
|
||||
body: {
|
||||
type: 'form',
|
||||
name: 'sample-edit-form',
|
||||
api: '/api/sample/$id',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
label: '删除',
|
||||
actionType: 'ajax',
|
||||
confirmText: '您确认要删除?',
|
||||
api: 'delete:/api/sample/$id'
|
||||
}
|
||||
],
|
||||
body: [
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'engine',
|
||||
sortable: true,
|
||||
quickEdit: true
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser'
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform'
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'version'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
216
examples/components/CRUD/HeaderGroup.jsx
Normal file
216
examples/components/CRUD/HeaderGroup.jsx
Normal file
@@ -0,0 +1,216 @@
|
||||
export default {
|
||||
type: 'page',
|
||||
title: '支持表头分组,通过在 cloumn 上设置 groupName 实现。',
|
||||
body: [
|
||||
{
|
||||
type: 'crud',
|
||||
draggable: true,
|
||||
bulkActions: [
|
||||
{
|
||||
label: '批量删除',
|
||||
actionType: 'ajax',
|
||||
api: 'delete:/amis/api/mock2/sample/${ids|raw}',
|
||||
confirmText: '确定要批量删除?'
|
||||
},
|
||||
{
|
||||
label: '批量修改',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '批量编辑',
|
||||
body: {
|
||||
type: 'form',
|
||||
api: '/amis/api/mock2/sample/bulkUpdate2',
|
||||
body: [
|
||||
{
|
||||
type: 'hidden',
|
||||
name: 'ids'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
remark: 'ID',
|
||||
groupName: 'A',
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
label: 'CSS grade',
|
||||
remark: 'CSS grade',
|
||||
groupName: 'A',
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
remark: 'Rendering engine',
|
||||
groupName: 'A',
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
remark: 'Browser'
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
remark: 'Platform(s)',
|
||||
groupName: 'B',
|
||||
fixed: 'right'
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version',
|
||||
remark: 'Engine version',
|
||||
groupName: 'B',
|
||||
fixed: 'right'
|
||||
}
|
||||
],
|
||||
data: {
|
||||
items: [
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 4.0',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'X',
|
||||
id: 1,
|
||||
children: [
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 4.0',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'X',
|
||||
id: 1001
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 5.0',
|
||||
platform: 'Win 95+',
|
||||
version: '5',
|
||||
grade: 'C',
|
||||
id: 1002
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 5.0',
|
||||
platform: 'Win 95+',
|
||||
version: '5',
|
||||
grade: 'C',
|
||||
id: 2,
|
||||
children: [
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 4.0',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'X',
|
||||
id: 2001
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 5.0',
|
||||
platform: 'Win 95+',
|
||||
version: '5',
|
||||
grade: 'C',
|
||||
id: 2002
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 5.5',
|
||||
platform: 'Win 95+',
|
||||
version: '5.5',
|
||||
grade: 'A',
|
||||
id: 3,
|
||||
children: [
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 4.0',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'X',
|
||||
id: 3001
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 5.0',
|
||||
platform: 'Win 95+',
|
||||
version: '5',
|
||||
grade: 'C',
|
||||
id: 3002
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 6',
|
||||
platform: 'Win 98+',
|
||||
version: '6',
|
||||
grade: 'A',
|
||||
id: 4,
|
||||
children: [
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 4.0',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'X',
|
||||
id: 4001
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 5.0',
|
||||
platform: 'Win 95+',
|
||||
version: '5',
|
||||
grade: 'C',
|
||||
id: 4002
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 7',
|
||||
platform: 'Win XP SP2+',
|
||||
version: '7',
|
||||
grade: 'A',
|
||||
id: 5,
|
||||
children: [
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 4.0',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'X',
|
||||
id: 5001
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 5.0',
|
||||
platform: 'Win 95+',
|
||||
version: '5',
|
||||
grade: 'C',
|
||||
id: 5002
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
717
examples/components/CRUD/HeaderHide.jsx
Normal file
717
examples/components/CRUD/HeaderHide.jsx
Normal file
@@ -0,0 +1,717 @@
|
||||
export default {
|
||||
title: '当 column 每一项的 label 值都为空字符时,可以隐藏表头',
|
||||
body: [
|
||||
{
|
||||
type: 'table',
|
||||
data: {
|
||||
items: [
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 4.2',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 4.2',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'B'
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'C'
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 98',
|
||||
version: '3',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 98',
|
||||
version: '4',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 1.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '4',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 1.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'B'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'C'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
}
|
||||
]
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
name: 'engine',
|
||||
label: ''
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: ''
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: ''
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: ''
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
label: ''
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
'<h4>搭配合并单元格和列上配置 isHead 可以实现超级表头放在左侧</h4>',
|
||||
{
|
||||
type: 'table',
|
||||
data: {
|
||||
items: [
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 4.2',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 4.2',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'B'
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'C'
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 98',
|
||||
version: '3',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 98',
|
||||
version: '4',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 1.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '4',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 1.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'B'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'C'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
}
|
||||
]
|
||||
},
|
||||
combineNum: 1,
|
||||
columns: [
|
||||
{
|
||||
name: 'engine',
|
||||
label: '',
|
||||
isHead: true
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: ''
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: ''
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: ''
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
label: ''
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
'<h4>还可以继续使用超级表头</h4>',
|
||||
{
|
||||
type: 'table',
|
||||
data: {
|
||||
items: [
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 4.2',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 4.2',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'B'
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'C'
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 98',
|
||||
version: '3',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 98',
|
||||
version: '4',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 1.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '4',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 1.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'B'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'C'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
}
|
||||
]
|
||||
},
|
||||
combineNum: 1,
|
||||
columns: [
|
||||
{
|
||||
name: 'engine',
|
||||
label: '',
|
||||
groupName: 'A',
|
||||
isHead: true
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: '',
|
||||
groupName: 'A'
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: '',
|
||||
groupName: 'B'
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: '',
|
||||
groupName: 'B'
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
label: ''
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
62
examples/components/CRUD/ItemAction.jsx
Normal file
62
examples/components/CRUD/ItemAction.jsx
Normal file
@@ -0,0 +1,62 @@
|
||||
export default {
|
||||
title: '点击左侧 crud 会触发右侧 crud 刷新',
|
||||
subTitle: '需要配置 syncLocation: false 避免左侧也刷新',
|
||||
body: {
|
||||
type: 'grid',
|
||||
columns: [
|
||||
{
|
||||
md: 6,
|
||||
body: [
|
||||
{
|
||||
type: 'crud',
|
||||
api: '/api/sample',
|
||||
headerToolbar: [],
|
||||
perPage: 10,
|
||||
syncLocation: false,
|
||||
itemAction: {
|
||||
actionType: 'reload',
|
||||
target: 'detailCRUD?id=${id}'
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
width: 30,
|
||||
type: 'text'
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
type: 'text'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
md: 6,
|
||||
body: [
|
||||
{
|
||||
type: 'crud',
|
||||
name: 'detailCRUD',
|
||||
headerToolbar: [],
|
||||
syncLocation: false,
|
||||
api: '/api/sample?perPage=10&id=${id}&waitSeconds=1',
|
||||
columns: [
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
type: 'text'
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version',
|
||||
type: 'text'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
233
examples/components/CRUD/ItemActions.jsx
Normal file
233
examples/components/CRUD/ItemActions.jsx
Normal file
@@ -0,0 +1,233 @@
|
||||
export default {
|
||||
title: '增删改查示例',
|
||||
remark: 'bla bla bla',
|
||||
body: {
|
||||
type: 'crud',
|
||||
api: '/api/sample',
|
||||
headerToolbar: [
|
||||
'bulkActions',
|
||||
{
|
||||
type: 'columns-toggler',
|
||||
className: 'pull-right',
|
||||
align: 'right'
|
||||
},
|
||||
{
|
||||
type: 'search-box',
|
||||
align: 'right',
|
||||
name: 'keywords',
|
||||
placeholder: '请输入关键字',
|
||||
mini: true
|
||||
},
|
||||
|
||||
{
|
||||
type: 'drag-toggler',
|
||||
align: 'right'
|
||||
},
|
||||
{
|
||||
type: 'pagination',
|
||||
align: 'right'
|
||||
}
|
||||
],
|
||||
itemActions: [
|
||||
{
|
||||
type: 'button',
|
||||
label: '查看',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '查看',
|
||||
body: {
|
||||
type: 'form',
|
||||
body: [
|
||||
{
|
||||
type: 'static',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'browser',
|
||||
label: 'Browser'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'html',
|
||||
html: '<p>添加其他 <span>Html 片段</span> 需要支持变量替换(todo).</p>'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
label: '编辑',
|
||||
actionType: 'drawer',
|
||||
drawer: {
|
||||
position: 'left',
|
||||
size: 'lg',
|
||||
title: '编辑',
|
||||
body: {
|
||||
type: 'form',
|
||||
name: 'sample-edit-form',
|
||||
api: '/api/sample/$id',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
name: 'grade',
|
||||
label: 'CSS grade',
|
||||
options: ['A', 'B', 'C', 'D', 'X']
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
label: '删除',
|
||||
actionType: 'ajax',
|
||||
confirmText: '您确认要删除?',
|
||||
api: 'delete:/api/sample/$id'
|
||||
}
|
||||
],
|
||||
bulkActions: [
|
||||
{
|
||||
label: '批量删除',
|
||||
actionType: 'ajax',
|
||||
api: 'delete:/api/sample/${ids|raw}',
|
||||
confirmText: '确定要批量删除?',
|
||||
type: 'button'
|
||||
},
|
||||
{
|
||||
label: '批量修改',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '批量编辑',
|
||||
name: 'sample-bulk-edit',
|
||||
body: {
|
||||
type: 'form',
|
||||
api: '/api/sample/bulkUpdate2',
|
||||
body: [
|
||||
{
|
||||
type: 'hidden',
|
||||
name: 'ids'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
type: 'button'
|
||||
}
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true,
|
||||
remark: 'Bla bla Bla'
|
||||
},
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
sortable: true,
|
||||
searchable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: false
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version',
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
label: 'CSS grade',
|
||||
type: 'text',
|
||||
toggled: true
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
130
examples/components/CRUD/JumpNext.jsx
Normal file
130
examples/components/CRUD/JumpNext.jsx
Normal file
@@ -0,0 +1,130 @@
|
||||
export default {
|
||||
title: '操作并下一个',
|
||||
remark: '当存在下一条时,支持直接打开下一条操作。',
|
||||
body: {
|
||||
type: 'crud',
|
||||
title: '',
|
||||
api: '/api/sample/list',
|
||||
columnsTogglable: false,
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
width: 30,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
type: 'operation',
|
||||
label: '操作',
|
||||
width: 130,
|
||||
buttons: [
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-pencil',
|
||||
actionType: 'dialog',
|
||||
nextCondition: 'true',
|
||||
_nextCondition: '可以设置条件比如: data.grade == "B"',
|
||||
dialog: {
|
||||
title: '编辑',
|
||||
actions: [
|
||||
{
|
||||
type: 'button',
|
||||
actionType: 'prev',
|
||||
level: 'info',
|
||||
visibleOn: 'data.hasPrev',
|
||||
label: '上一个'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
actionType: 'cancel',
|
||||
label: '关闭'
|
||||
},
|
||||
{
|
||||
type: 'submit',
|
||||
actionType: 'next',
|
||||
visibleOn: 'data.hasNext',
|
||||
label: '保存并下一个',
|
||||
level: 'primary'
|
||||
},
|
||||
{
|
||||
type: 'submit',
|
||||
visibleOn: '!data.hasNext',
|
||||
label: '保存',
|
||||
level: 'primary'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
actionType: 'next',
|
||||
level: 'info',
|
||||
visibleOn: 'data.hasNext',
|
||||
label: '下一个'
|
||||
}
|
||||
],
|
||||
body: {
|
||||
type: 'form',
|
||||
name: 'sample-edit-form',
|
||||
api: '/api/sample/$id',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
toggled: true
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
76
examples/components/CRUD/Keyboards.jsx
Normal file
76
examples/components/CRUD/Keyboards.jsx
Normal file
@@ -0,0 +1,76 @@
|
||||
export default {
|
||||
title: 'Table 全键盘操作示例',
|
||||
remark: 'bla bla bla',
|
||||
body: [
|
||||
{
|
||||
type: 'plain',
|
||||
className: 'text-danger',
|
||||
text: '请通过上下左右键切换单元格,按 `Space` 键进入编辑模式,按 `Enter` 提交编辑,并最后点左上角的全部保存完成操作。'
|
||||
},
|
||||
{
|
||||
type: 'crud',
|
||||
className: 'm-t',
|
||||
api: '/api/sample',
|
||||
quickSaveApi: '/api/sample/bulkUpdate',
|
||||
quickSaveItemApi: '/api/sample/$id',
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
width: 30,
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
sortable: true,
|
||||
quickEdit: {
|
||||
type: 'input-text',
|
||||
required: true,
|
||||
mode: 'inline'
|
||||
},
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
sortable: true,
|
||||
quickEdit: {
|
||||
type: 'input-text',
|
||||
required: true
|
||||
},
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
sortable: true,
|
||||
quickEdit: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version',
|
||||
quickEdit: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
label: 'CSS grade',
|
||||
quickEdit: {
|
||||
type: 'select',
|
||||
options: ['A', 'B', 'C', 'D', 'X']
|
||||
},
|
||||
type: 'text',
|
||||
toggled: true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
239
examples/components/CRUD/List.jsx
Normal file
239
examples/components/CRUD/List.jsx
Normal file
@@ -0,0 +1,239 @@
|
||||
export default {
|
||||
title: '增删改查示例',
|
||||
remark: 'bla bla bla',
|
||||
body: {
|
||||
type: 'crud',
|
||||
name: 'thelist',
|
||||
api: {
|
||||
method: 'get',
|
||||
url: '/api/sample',
|
||||
sendOn: '${mode}'
|
||||
},
|
||||
mode: 'list',
|
||||
draggable: true,
|
||||
saveOrderApi: {
|
||||
url: '/api/sample/saveOrder'
|
||||
},
|
||||
orderField: 'weight',
|
||||
affixHeader: true,
|
||||
bulkActions: [
|
||||
{
|
||||
label: '批量删除',
|
||||
actionType: 'ajax',
|
||||
api: 'delete:/api/sample/${ids|raw}',
|
||||
confirmText: '确定要批量删除?',
|
||||
type: 'button',
|
||||
level: 'danger'
|
||||
},
|
||||
{
|
||||
label: '批量修改',
|
||||
actionType: 'dialog',
|
||||
level: 'info',
|
||||
type: 'button',
|
||||
dialog: {
|
||||
title: '批量编辑',
|
||||
body: {
|
||||
type: 'form',
|
||||
api: '/api/sample/bulkUpdate2',
|
||||
body: [
|
||||
{type: 'hidden', name: 'ids'},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
quickSaveApi: '/api/sample/bulkUpdate',
|
||||
quickSaveItemApi: '/api/sample/$id',
|
||||
headerToolbar: [
|
||||
{
|
||||
type: 'form',
|
||||
mode: 'inline',
|
||||
wrapWithPanel: false,
|
||||
submitOnChange: true,
|
||||
submitOnInit: true,
|
||||
target: 'thelist',
|
||||
body: [
|
||||
{
|
||||
type: 'select',
|
||||
name: 'mode',
|
||||
className: 'mb-0',
|
||||
selectFirst: true,
|
||||
options: [
|
||||
{
|
||||
label: '模式 1',
|
||||
value: 'mode1'
|
||||
},
|
||||
{
|
||||
label: '模式 2',
|
||||
value: 'mode2'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'keywords',
|
||||
placeholder: '通过关键字搜索',
|
||||
className: 'mb-0',
|
||||
addOn: {
|
||||
label: '搜索',
|
||||
type: 'submit'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
listItem: {
|
||||
actions: [
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-eye',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '查看',
|
||||
body: {
|
||||
type: 'form',
|
||||
body: [
|
||||
{
|
||||
type: 'static',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'browser',
|
||||
label: 'Browser'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'html',
|
||||
html: '<p>添加其他 <span>Html 片段</span> 需要支持变量替换(todo).</p>'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-pencil',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '编辑',
|
||||
body: {
|
||||
type: 'form',
|
||||
name: 'sample-edit-form',
|
||||
api: '/api/sample/$id',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-times text-danger',
|
||||
actionType: 'ajax',
|
||||
confirmText: '您确认要删除?',
|
||||
api: 'delete:/api/sample/$id'
|
||||
}
|
||||
],
|
||||
body: [
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
sortable: true,
|
||||
quickEdit: true
|
||||
},
|
||||
{
|
||||
type: 'hbox',
|
||||
columns: [
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser'
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
221
examples/components/CRUD/LoadMore.jsx
Normal file
221
examples/components/CRUD/LoadMore.jsx
Normal file
@@ -0,0 +1,221 @@
|
||||
export default {
|
||||
title: '增删改查示例',
|
||||
remark: 'bla bla bla',
|
||||
body: {
|
||||
type: 'crud',
|
||||
api: '/api/sample',
|
||||
mode: 'list',
|
||||
draggable: true,
|
||||
saveOrderApi: {
|
||||
url: '/api/sample/saveOrder'
|
||||
},
|
||||
orderField: 'weight',
|
||||
filter: {
|
||||
title: '条件搜索',
|
||||
submitText: '',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'keywords',
|
||||
placeholder: '通过关键字搜索',
|
||||
addOn: {
|
||||
label: '搜索',
|
||||
type: 'submit'
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'plain',
|
||||
text: '这只是个示例, 目前搜索对查询结果无效.'
|
||||
}
|
||||
]
|
||||
},
|
||||
bulkActions: [
|
||||
{
|
||||
label: '批量删除',
|
||||
actionType: 'ajax',
|
||||
api: 'delete:/api/sample/${ids|raw}',
|
||||
confirmText: '确定要批量删除?',
|
||||
type: 'button',
|
||||
level: 'danger'
|
||||
},
|
||||
{
|
||||
label: '批量修改',
|
||||
actionType: 'dialog',
|
||||
level: 'info',
|
||||
type: 'button',
|
||||
dialog: {
|
||||
title: '批量编辑',
|
||||
body: {
|
||||
type: 'form',
|
||||
api: '/api/sample/bulkUpdate2',
|
||||
body: [
|
||||
{type: 'hidden', name: 'ids'},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
quickSaveApi: '/api/sample/bulkUpdate',
|
||||
quickSaveItemApi: '/api/sample/$id',
|
||||
headerToolbar: ['bulkActions'],
|
||||
footerToolbar: ['load-more'],
|
||||
listItem: {
|
||||
actions: [
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-eye',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '查看',
|
||||
body: {
|
||||
type: 'form',
|
||||
body: [
|
||||
{
|
||||
type: 'static',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'browser',
|
||||
label: 'Browser'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'html',
|
||||
html:
|
||||
'<p>添加其他 <span>Html 片段</span> 需要支持变量替换(todo).</p>'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-pencil',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '编辑',
|
||||
body: {
|
||||
type: 'form',
|
||||
name: 'sample-edit-form',
|
||||
api: '/api/sample/$id',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-times text-danger',
|
||||
actionType: 'ajax',
|
||||
confirmText: '您确认要删除?',
|
||||
api: 'delete:/api/sample/$id'
|
||||
}
|
||||
],
|
||||
body: [
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
sortable: true,
|
||||
quickEdit: true,
|
||||
labelClassName: 'w-sm pull-left text-muted'
|
||||
},
|
||||
{
|
||||
type: 'hbox',
|
||||
columns: [
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
labelClassName: 'w-sm pull-left text-muted'
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
labelClassName: 'w-sm pull-left text-muted'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version',
|
||||
labelClassName: 'w-sm pull-left text-muted'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
199
examples/components/CRUD/LoadOnce.jsx
Normal file
199
examples/components/CRUD/LoadOnce.jsx
Normal file
@@ -0,0 +1,199 @@
|
||||
export default {
|
||||
title: '一次性加载,前端分页,前端排序',
|
||||
body: {
|
||||
type: 'crud',
|
||||
loadDataOnce: true,
|
||||
api: '/api/sample?waitSeconds=1&loadDataOnce=1',
|
||||
filter: {
|
||||
title: '条件搜索',
|
||||
submitText: '',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'keywords',
|
||||
placeholder: '通过关键字搜索',
|
||||
addOn: {
|
||||
label: '搜索',
|
||||
type: 'submit'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true,
|
||||
remark: 'Bla bla Bla'
|
||||
},
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: false
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version',
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
label: 'CSS grade',
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
type: 'operation',
|
||||
label: '操作',
|
||||
width: 100,
|
||||
buttons: [
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-eye',
|
||||
actionType: 'dialog',
|
||||
tooltip: '查看',
|
||||
dialog: {
|
||||
title: '查看',
|
||||
body: {
|
||||
type: 'form',
|
||||
body: [
|
||||
{
|
||||
type: 'static',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'browser',
|
||||
label: 'Browser'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'html',
|
||||
html: '<p>添加其他 <span>Html 片段</span> 需要支持变量替换(todo).</p>'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-pencil',
|
||||
tooltip: '编辑',
|
||||
actionType: 'drawer',
|
||||
drawer: {
|
||||
position: 'left',
|
||||
size: 'lg',
|
||||
title: '编辑',
|
||||
body: {
|
||||
type: 'form',
|
||||
name: 'sample-edit-form',
|
||||
api: '/api/sample/$id',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
name: 'grade',
|
||||
label: 'CSS grade',
|
||||
options: ['A', 'B', 'C', 'D', 'X']
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-times text-danger',
|
||||
actionType: 'ajax',
|
||||
tooltip: '删除',
|
||||
confirmText: '您确认要删除?',
|
||||
api: 'delete:/api/sample/$id'
|
||||
}
|
||||
],
|
||||
toggled: true
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
300
examples/components/CRUD/MatchFunc.jsx
Normal file
300
examples/components/CRUD/MatchFunc.jsx
Normal file
@@ -0,0 +1,300 @@
|
||||
export default {
|
||||
type: 'page',
|
||||
title: '匹配函数',
|
||||
remark: '使用前端分页处理列字段类型较为复杂或者字段值格式和后端返回不一致的场景',
|
||||
body: [
|
||||
{
|
||||
type: 'container',
|
||||
style: {
|
||||
padding: '8px',
|
||||
marginBottom: '8px',
|
||||
backgroundColor: '#f5f5f5',
|
||||
borderRadius: '4px'
|
||||
},
|
||||
body: [
|
||||
{
|
||||
"type": "tpl",
|
||||
tpl: '<h4>匹配函数签名:</h4>',
|
||||
"inline": false
|
||||
},
|
||||
{
|
||||
"type": "code",
|
||||
"language": "typescript",
|
||||
"value": `interface CRUDMatchFunc {
|
||||
(
|
||||
/* 当前列表的全量数据 */
|
||||
items: any,
|
||||
/* 最近一次接口返回的全量数据 */
|
||||
itemsRaw: any,
|
||||
/** 相关配置 */
|
||||
options?: {
|
||||
/* 查询参数 */
|
||||
query: Record<string, any>,
|
||||
/* 列配置 */
|
||||
columns: any;
|
||||
/** match-sorter 匹配函数 */
|
||||
matchSorter: (items: any[], value: string, options?: MatchSorterOptions<any>) => any[]
|
||||
}
|
||||
): boolean;
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "crud",
|
||||
"syncLocation": false,
|
||||
"api": "/api/mock2/crud/loadDataOnce",
|
||||
"loadDataOnce": true,
|
||||
"loadDataOnceFetchOnFilter": false,
|
||||
"perPage": 5,
|
||||
"matchFunc": `
|
||||
const {query = {}, columns} = options;
|
||||
let result = items.concat();
|
||||
|
||||
Object.keys(query).forEach(key => {
|
||||
const value = query[key];
|
||||
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (key === 'status') {
|
||||
result = result.filter(item => item.status === Boolean(value));
|
||||
} else if (key === 'time') {
|
||||
if (typeof value === 'string') {
|
||||
const [start, end] = value.split(",");
|
||||
result = result.filter(item => {
|
||||
const time = Number(item.time);
|
||||
|
||||
return time >= Number(start) && time <= Number(end);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return result;`,
|
||||
"filter": {
|
||||
"debug": true,
|
||||
"body": [
|
||||
{
|
||||
"type": "switch",
|
||||
"name": "status",
|
||||
"label": "已核验",
|
||||
"size": "sm"
|
||||
},
|
||||
{
|
||||
"type": "input-datetime-range",
|
||||
"name": "time",
|
||||
"label": "时间",
|
||||
"size": "full"
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"type": "reset",
|
||||
"label": "重置"
|
||||
},
|
||||
{
|
||||
"type": "submit",
|
||||
"level": "primary",
|
||||
"label": "查询"
|
||||
}
|
||||
]
|
||||
},
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"label": "ID"
|
||||
},
|
||||
{
|
||||
"name": "browser",
|
||||
"label": "Browser"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"label": "Engine version",
|
||||
"searchable": {
|
||||
"type": "select",
|
||||
"name": "version",
|
||||
"label": "Engine version",
|
||||
"clearable": true,
|
||||
"multiple": true,
|
||||
"searchable": true,
|
||||
"checkAll": true,
|
||||
"options": [
|
||||
"1.7",
|
||||
"3.3",
|
||||
"5.6"
|
||||
],
|
||||
"maxTagCount": 10,
|
||||
"extractValue": true,
|
||||
"joinValues": false,
|
||||
"delimiter": ",",
|
||||
"defaultCheckAll": false,
|
||||
"checkAllLabel": "全选"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "grade",
|
||||
"label": "CSS grade"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"label": "已核验",
|
||||
"type": "tpl",
|
||||
"tpl": "${status === true ? '是' : '否'}",
|
||||
"filterable": {
|
||||
"options": [
|
||||
{"label": "是", "value": true},
|
||||
{"label": "否", "value": false}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "time",
|
||||
"type": "date",
|
||||
"label": "时间",
|
||||
"format": "YYYY-MM-DD HH:mm:ss"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "divider",
|
||||
},
|
||||
{
|
||||
"type": "tpl",
|
||||
tpl: '<h2>使用数据域变量作为数据源:</h2>',
|
||||
"inline": false
|
||||
},
|
||||
{
|
||||
"type": "service",
|
||||
"api": {
|
||||
"url": "/api/mock2/crud/loadDataOnce",
|
||||
"method": "get",
|
||||
"responseData": {
|
||||
"table": "${rows}"
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "crud",
|
||||
"syncLocation": false,
|
||||
"source": "${table}",
|
||||
"loadDataOnce": true,
|
||||
"loadDataOnceFetchOnFilter": false,
|
||||
"perPage": 5,
|
||||
"matchFunc": `
|
||||
const {query = {}, columns} = options;
|
||||
let result = itemsRaw.concat();
|
||||
|
||||
Object.keys(query).forEach(key => {
|
||||
const value = query[key];
|
||||
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (key === 'status') {
|
||||
result = result.filter(item => item.status === Boolean(value));
|
||||
} else if (key === 'time') {
|
||||
if (typeof value === 'string') {
|
||||
const [start, end] = value.split(",");
|
||||
result = result.filter(item => {
|
||||
const time = Number(item.time);
|
||||
|
||||
return time >= Number(start) && time <= Number(end);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return result;`,
|
||||
"filter": {
|
||||
"debug": true,
|
||||
"body": [
|
||||
{
|
||||
"type": "switch",
|
||||
"name": "status",
|
||||
"label": "已核验",
|
||||
"size": "sm"
|
||||
},
|
||||
{
|
||||
"type": "input-datetime-range",
|
||||
"name": "time",
|
||||
"label": "时间",
|
||||
"size": "full"
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"type": "reset",
|
||||
"label": "重置"
|
||||
},
|
||||
{
|
||||
"type": "submit",
|
||||
"level": "primary",
|
||||
"label": "查询"
|
||||
}
|
||||
]
|
||||
},
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"label": "ID"
|
||||
},
|
||||
{
|
||||
"name": "browser",
|
||||
"label": "Browser"
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"label": "Engine version",
|
||||
"searchable": {
|
||||
"type": "select",
|
||||
"name": "version",
|
||||
"label": "Engine version",
|
||||
"clearable": true,
|
||||
"multiple": true,
|
||||
"searchable": true,
|
||||
"checkAll": true,
|
||||
"options": [
|
||||
"1.7",
|
||||
"3.3",
|
||||
"5.6"
|
||||
],
|
||||
"maxTagCount": 10,
|
||||
"extractValue": true,
|
||||
"joinValues": false,
|
||||
"delimiter": ",",
|
||||
"defaultCheckAll": false,
|
||||
"checkAllLabel": "全选"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "grade",
|
||||
"label": "CSS grade"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"label": "已核验",
|
||||
"type": "tpl",
|
||||
"tpl": "${status === true ? '是' : '否'}",
|
||||
"filterable": {
|
||||
"options": [
|
||||
{"label": "是", "value": true},
|
||||
{"label": "否", "value": false}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "time",
|
||||
"type": "date",
|
||||
"label": "时间",
|
||||
"format": "YYYY-MM-DD HH:mm:ss"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
105
examples/components/CRUD/MergeCell.jsx
Normal file
105
examples/components/CRUD/MergeCell.jsx
Normal file
@@ -0,0 +1,105 @@
|
||||
export default {
|
||||
title:
|
||||
'支持自动合并单元格,从左到右,可配置从左侧起多少列内启动自动合并单元格,当前配置 3',
|
||||
body: {
|
||||
type: 'table',
|
||||
data: {
|
||||
items: [
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 4.2',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'Internet Explorer 4.2',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'B'
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 95+',
|
||||
version: '4',
|
||||
grade: 'C'
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 98',
|
||||
version: '3',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Trident',
|
||||
browser: 'AOL browser (AOL desktop)',
|
||||
platform: 'Win 98',
|
||||
version: '4',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 1.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '4',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 1.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'A'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'B'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'C'
|
||||
},
|
||||
{
|
||||
engine: 'Gecko',
|
||||
browser: 'Firefox 2.0',
|
||||
platform: 'Win 98+ / OSX.2+',
|
||||
version: '5',
|
||||
grade: 'D'
|
||||
}
|
||||
]
|
||||
},
|
||||
combineNum: 1, // 配置自动合并单元格的列数。
|
||||
combineFromIndex: 1,
|
||||
columns: [
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine'
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser'
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)'
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
192
examples/components/CRUD/Nested.jsx
Normal file
192
examples/components/CRUD/Nested.jsx
Normal file
@@ -0,0 +1,192 @@
|
||||
export default {
|
||||
title: '支持多层嵌套,列数据中有 children 字段即可。(建议不超过10层)',
|
||||
body: {
|
||||
type: 'crud',
|
||||
api: '/api/mock2/crud/table6',
|
||||
deferApi: '/api/mock2/crud/table6?parentId=${id}',
|
||||
saveOrderApi: '/api/mock2/form/saveData',
|
||||
draggable: true,
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true,
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
sortable: true,
|
||||
searchable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version',
|
||||
quickEdit: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
label: 'CSS grade',
|
||||
quickEdit: {
|
||||
mode: 'inline',
|
||||
type: 'select',
|
||||
options: ['A', 'B', 'C', 'D', 'X'],
|
||||
inputClassName: 'w-xs',
|
||||
saveImmediately: true
|
||||
},
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
type: 'operation',
|
||||
label: '操作',
|
||||
width: 100,
|
||||
buttons: [
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-eye',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '查看',
|
||||
body: {
|
||||
type: 'form',
|
||||
body: [
|
||||
{
|
||||
type: 'static',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'browser',
|
||||
label: 'Browser'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'html',
|
||||
html: '<p>添加其他 <span>Html 片段</span> 需要支持变量替换(todo).</p>'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-pencil',
|
||||
actionType: 'drawer',
|
||||
drawer: {
|
||||
position: 'left',
|
||||
size: 'lg',
|
||||
title: '编辑',
|
||||
body: {
|
||||
type: 'form',
|
||||
name: 'sample-edit-form',
|
||||
api: '/api/sample/$id',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
name: 'grade',
|
||||
label: 'CSS grade',
|
||||
options: ['A', 'B', 'C', 'D', 'X']
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-times text-danger',
|
||||
actionType: 'ajax',
|
||||
confirmText: '您确认要删除?',
|
||||
api: 'delete:/api/sample/$id'
|
||||
}
|
||||
],
|
||||
toggled: true
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
91
examples/components/CRUD/ParsePrimitiveQuery.jsx
Normal file
91
examples/components/CRUD/ParsePrimitiveQuery.jsx
Normal file
@@ -0,0 +1,91 @@
|
||||
export default {
|
||||
"title": "解析Query参数",
|
||||
"body": [
|
||||
{
|
||||
"type": "alert",
|
||||
"body": {
|
||||
"type": "html",
|
||||
"html": "<code>parsePrimitiveQuery</code>默认开启,开启后会对url中的Query进行转换,将原始类型的字符串格式的转化为同位类型"
|
||||
},
|
||||
"level": "info",
|
||||
"showCloseButton": true,
|
||||
"showIcon": true,
|
||||
"className": "mb-2"
|
||||
},
|
||||
{
|
||||
"type": "crud",
|
||||
"name": "crud",
|
||||
"syncLocation": true,
|
||||
"api": "/api/mock2/crud/table5",
|
||||
"parsePrimitiveQuery": {
|
||||
"enable": true,
|
||||
"types": ["boolean", "number"]
|
||||
},
|
||||
"filter": {
|
||||
"debug": true,
|
||||
"title": "条件搜索",
|
||||
"body": [
|
||||
{
|
||||
"type": "group",
|
||||
"body": [
|
||||
{
|
||||
"type": "switch",
|
||||
"name": "status",
|
||||
"label": "已核验",
|
||||
"size": "sm",
|
||||
"value": false
|
||||
},
|
||||
{
|
||||
"type": "select",
|
||||
"name": "version",
|
||||
"label": "版本",
|
||||
"options": [
|
||||
{"label": "5.5", value: 5.5},
|
||||
{"label": "6", value: 6},
|
||||
{"label": "7", value: 7}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"actions": [
|
||||
{
|
||||
"type": "reset",
|
||||
"label": "重置"
|
||||
},
|
||||
{
|
||||
"type": "submit",
|
||||
"level": "primary",
|
||||
"label": "查询"
|
||||
}
|
||||
]
|
||||
},
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"label": "ID"
|
||||
},
|
||||
{
|
||||
"name": "browser",
|
||||
"label": "Browser"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"label": "已核验",
|
||||
"type": "tpl",
|
||||
"tpl": "${status === true ? '是' : '否'}",
|
||||
"filterable": {
|
||||
"options": [
|
||||
{"label": "是", "value": true},
|
||||
{"label": "否", "value": false}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "version",
|
||||
"label": "版本"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
34
examples/components/CRUD/PopOver.tsx
Normal file
34
examples/components/CRUD/PopOver.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
export default {
|
||||
title: '列展示详情',
|
||||
body: {
|
||||
type: 'crud',
|
||||
title: '',
|
||||
api: '/api/sample/list',
|
||||
columnsTogglable: false,
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
width: 30,
|
||||
type: 'text'
|
||||
},
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
type: 'text',
|
||||
popOver: {
|
||||
trigger: 'hover',
|
||||
showIcon: false,
|
||||
body: 'Popover 内容:${platform}',
|
||||
popOverClassName: 'min-w-0',
|
||||
position: 'left-center-right-center right-center-left-center'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
type: 'text'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
48
examples/components/CRUD/SimplePager.tsx
Normal file
48
examples/components/CRUD/SimplePager.tsx
Normal file
@@ -0,0 +1,48 @@
|
||||
export default {
|
||||
title: '简单分页,返回 hasNext 属性指示是否有下一页',
|
||||
body: {
|
||||
type: 'crud',
|
||||
draggable: true,
|
||||
api: {
|
||||
method: 'get',
|
||||
url: '/api/sample/simpleList?page=${page}&pageDir=${pageDir}&after=${items[items.length - 1].id}&before=${items[0].id}',
|
||||
// 因为 before 和 after 的值每次请求完后都会变
|
||||
// 触发了接口的自动刷新,所以这里需要通过 trackExpression 自定义刷新条件
|
||||
trackExpression: '${page}-${pageDir}'
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
type: 'text',
|
||||
remark: 'Bla bla Bla'
|
||||
},
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
type: 'text'
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
type: 'text'
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
type: 'text'
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version',
|
||||
type: 'text',
|
||||
classNameExpr: "<%= data.version < 5 ? 'bg-danger' : '' %>"
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
375
examples/components/CRUD/Table.jsx
Normal file
375
examples/components/CRUD/Table.jsx
Normal file
@@ -0,0 +1,375 @@
|
||||
export default {
|
||||
title: '增删改查示例',
|
||||
remark: 'bla bla bla',
|
||||
toolbar: [
|
||||
{
|
||||
type: 'button',
|
||||
actionType: 'dialog',
|
||||
label: '新增',
|
||||
icon: 'fa fa-plus pull-left',
|
||||
primary: true,
|
||||
dialog: {
|
||||
title: '新增',
|
||||
body: {
|
||||
type: 'form',
|
||||
name: 'sample-edit-form',
|
||||
api: 'post:/api/sample',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
body: {
|
||||
type: 'crud',
|
||||
draggable: true,
|
||||
api: '/api/sample?waitSeconds=1',
|
||||
perPage: 15,
|
||||
keepItemSelectionOnPageChange: true,
|
||||
maxKeepItemSelectionLength: 11,
|
||||
labelTpl: '${id} ${engine}',
|
||||
orderBy: 'id',
|
||||
orderDir: 'asc',
|
||||
// affixHeader: false,
|
||||
filter: {
|
||||
title: '条件搜索',
|
||||
submitText: '',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'keywords',
|
||||
placeholder: '通过关键字搜索',
|
||||
addOn: {
|
||||
label: '搜索',
|
||||
type: 'submit'
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'plain',
|
||||
text: '这里的表单项可以配置多个'
|
||||
}
|
||||
]
|
||||
},
|
||||
bulkActions: [
|
||||
{
|
||||
label: '批量删除',
|
||||
actionType: 'ajax',
|
||||
api: 'delete:/api/sample/${ids|raw}',
|
||||
confirmText: '确定要批量删除?'
|
||||
},
|
||||
{
|
||||
label: '批量修改',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '批量编辑',
|
||||
name: 'sample-bulk-edit',
|
||||
body: {
|
||||
type: 'form',
|
||||
api: '/api/sample/bulkUpdate2',
|
||||
body: [
|
||||
{
|
||||
type: 'hidden',
|
||||
name: 'ids'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
quickSaveApi: '/api/sample/bulkUpdate',
|
||||
quickSaveItemApi: '/api/sample/$id',
|
||||
filterTogglable: true,
|
||||
headerToolbar: [
|
||||
'filter-toggler',
|
||||
'bulkActions',
|
||||
{
|
||||
type: 'tpl',
|
||||
tpl: '定制内容示例:当前有 ${count} 条数据。',
|
||||
className: 'v-middle'
|
||||
},
|
||||
{
|
||||
type: 'link',
|
||||
href: 'https://www.baidu.com',
|
||||
body: '百度一下',
|
||||
htmlTarget: '_parent',
|
||||
className: 'v-middle'
|
||||
},
|
||||
{
|
||||
type: 'columns-toggler',
|
||||
align: 'right'
|
||||
},
|
||||
{
|
||||
type: 'drag-toggler',
|
||||
align: 'right'
|
||||
},
|
||||
{
|
||||
type: 'pagination',
|
||||
align: 'right'
|
||||
}
|
||||
],
|
||||
footerToolbar: ['statistics', 'switch-per-page', 'pagination'],
|
||||
// rowClassNameExpr: '<%= data.id == 1 ? "bg-success" : "" %>',
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true,
|
||||
remark: 'Bla bla Bla'
|
||||
},
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
sortable: true,
|
||||
searchable: true,
|
||||
popOver: {
|
||||
body: 'Popover 内容:${platform}',
|
||||
trigger: 'hover'
|
||||
},
|
||||
popOverEnableOn: 'this.id === 1',
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: false
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
popOver: {
|
||||
body: 'Popover 内容:${platform}'
|
||||
},
|
||||
sortable: true,
|
||||
type: 'text',
|
||||
toggled: true
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version',
|
||||
quickEdit: true,
|
||||
type: 'text',
|
||||
toggled: true,
|
||||
filterable: {
|
||||
options: [
|
||||
{
|
||||
label: '4',
|
||||
value: '4'
|
||||
},
|
||||
{
|
||||
label: '5',
|
||||
value: '5'
|
||||
},
|
||||
{
|
||||
label: '6',
|
||||
value: '6'
|
||||
}
|
||||
]
|
||||
},
|
||||
classNameExpr: "<%= data.version < 5 ? 'bg-danger' : '' %>"
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
name: 'grade',
|
||||
label: 'CSS grade',
|
||||
quickEdit: {
|
||||
saveImmediately: true,
|
||||
mode: 'inline',
|
||||
type: 'select',
|
||||
options: ['A', 'B', 'C', 'D', 'X']
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'operation',
|
||||
label: '操作',
|
||||
width: 100,
|
||||
buttons: [
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-eye',
|
||||
actionType: 'dialog',
|
||||
tooltip: '查看',
|
||||
dialog: {
|
||||
title: '查看',
|
||||
body: {
|
||||
type: 'form',
|
||||
body: [
|
||||
{
|
||||
type: 'static',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'browser',
|
||||
label: 'Browser'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'html',
|
||||
html: '<p>添加其他 <span>Html 片段</span> 需要支持变量替换(todo).</p>'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-pencil',
|
||||
tooltip: '编辑',
|
||||
actionType: 'drawer',
|
||||
drawer: {
|
||||
position: 'left',
|
||||
size: 'lg',
|
||||
title: '编辑',
|
||||
body: {
|
||||
type: 'form',
|
||||
name: 'sample-edit-form',
|
||||
data:{
|
||||
env: 'test'
|
||||
},
|
||||
api: {
|
||||
method:'post',
|
||||
url:'/api/sample/$id',
|
||||
messages:{
|
||||
success: '成功了-${env}'
|
||||
}
|
||||
},
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
name: 'grade',
|
||||
label: 'CSS grade',
|
||||
options: ['A', 'B', 'C', 'D', 'X']
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-times text-danger',
|
||||
actionType: 'ajax',
|
||||
tooltip: '删除',
|
||||
confirmText: '您确认要删除?',
|
||||
api: 'delete:/api/sample/$id'
|
||||
}
|
||||
],
|
||||
toggled: true
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
340
examples/components/CRUD/TableAutoFill.jsx
Normal file
340
examples/components/CRUD/TableAutoFill.jsx
Normal file
@@ -0,0 +1,340 @@
|
||||
export default {
|
||||
title: '表格内容区域自适应屏幕高度,内容超出时在内容区出现滚动条',
|
||||
remark: 'bla bla bla',
|
||||
toolbar: [
|
||||
{
|
||||
type: 'button',
|
||||
actionType: 'dialog',
|
||||
label: '新增',
|
||||
icon: 'fa fa-plus pull-left',
|
||||
primary: true,
|
||||
dialog: {
|
||||
title: '新增',
|
||||
body: {
|
||||
type: 'form',
|
||||
name: 'sample-edit-form',
|
||||
api: 'post:/api/sample',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
body: {
|
||||
type: 'crud',
|
||||
draggable: true,
|
||||
api: '/api/sample',
|
||||
perPage: 50,
|
||||
keepItemSelectionOnPageChange: true,
|
||||
maxKeepItemSelectionLength: 11,
|
||||
autoFillHeight: true,
|
||||
labelTpl: '${id} ${engine}',
|
||||
autoGenerateFilter: true,
|
||||
bulkActions: [
|
||||
{
|
||||
label: '批量删除',
|
||||
actionType: 'ajax',
|
||||
api: 'delete:/api/sample/${ids|raw}',
|
||||
confirmText: '确定要批量删除?'
|
||||
},
|
||||
{
|
||||
label: '批量修改',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '批量编辑',
|
||||
name: 'sample-bulk-edit',
|
||||
body: {
|
||||
type: 'form',
|
||||
api: '/api/sample/bulkUpdate2',
|
||||
body: [
|
||||
{
|
||||
type: 'hidden',
|
||||
name: 'ids'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
quickSaveApi: '/api/sample/bulkUpdate',
|
||||
quickSaveItemApi: '/api/sample/$id',
|
||||
filterTogglable: true,
|
||||
headerToolbar: [
|
||||
'bulkActions',
|
||||
{
|
||||
type: 'tpl',
|
||||
tpl: '定制内容示例:当前有 ${count} 条数据。',
|
||||
className: 'v-middle'
|
||||
},
|
||||
{
|
||||
type: 'link',
|
||||
href: 'https://www.baidu.com',
|
||||
body: '百度一下',
|
||||
htmlTarget: '_parent',
|
||||
className: 'v-middle'
|
||||
},
|
||||
{
|
||||
type: 'columns-toggler',
|
||||
align: 'right'
|
||||
},
|
||||
{
|
||||
type: 'drag-toggler',
|
||||
align: 'right'
|
||||
},
|
||||
{
|
||||
type: 'pagination',
|
||||
align: 'right'
|
||||
}
|
||||
],
|
||||
footerToolbar: [
|
||||
'statistics',
|
||||
{
|
||||
type: 'pagination',
|
||||
layout: 'perPage,pager,go'
|
||||
}
|
||||
],
|
||||
// rowClassNameExpr: '<%= data.id == 1 ? "bg-success" : "" %>',
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
searchable: {
|
||||
type: 'input-text',
|
||||
name: 'id',
|
||||
label: '主键',
|
||||
placeholder: '输入id'
|
||||
},
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
fixed: 'left',
|
||||
searchable: true
|
||||
},
|
||||
{
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
width: 500,
|
||||
searchable: {
|
||||
type: 'select',
|
||||
name: 'browser',
|
||||
label: '浏览器',
|
||||
placeholder: '选择浏览器',
|
||||
options: [
|
||||
{
|
||||
label: 'Internet Explorer ',
|
||||
value: 'ie'
|
||||
},
|
||||
{
|
||||
label: 'AOL browser',
|
||||
value: 'aol'
|
||||
},
|
||||
{
|
||||
label: 'Firefox',
|
||||
value: 'firefox'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
width: 500
|
||||
},
|
||||
{
|
||||
name: 'version',
|
||||
label: 'Engine version',
|
||||
searchable: {
|
||||
type: 'input-number',
|
||||
name: 'version',
|
||||
label: '版本号',
|
||||
placeholder: '输入版本号',
|
||||
mode: 'horizontal'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
},
|
||||
{
|
||||
type: 'operation',
|
||||
label: '操作',
|
||||
width: 100,
|
||||
buttons: [
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-eye',
|
||||
actionType: 'dialog',
|
||||
tooltip: '查看',
|
||||
dialog: {
|
||||
title: '查看',
|
||||
body: {
|
||||
type: 'form',
|
||||
body: [
|
||||
{
|
||||
type: 'static',
|
||||
name: 'engine',
|
||||
label: 'Engine'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'browser',
|
||||
label: 'Browser'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'static',
|
||||
name: 'grade',
|
||||
label: 'CSS grade'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'html',
|
||||
html: '<p>添加其他 <span>Html 片段</span> 需要支持变量替换(todo).</p>'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-pencil',
|
||||
tooltip: '编辑',
|
||||
actionType: 'drawer',
|
||||
drawer: {
|
||||
position: 'left',
|
||||
size: 'lg',
|
||||
title: '编辑',
|
||||
body: {
|
||||
type: 'form',
|
||||
name: 'sample-edit-form',
|
||||
api: '/api/sample/$id',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'engine',
|
||||
label: 'Engine',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'browser',
|
||||
label: 'Browser',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'platform',
|
||||
label: 'Platform(s)',
|
||||
required: true
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'version',
|
||||
label: 'Engine version'
|
||||
},
|
||||
{
|
||||
type: 'divider'
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
name: 'grade',
|
||||
label: 'CSS grade',
|
||||
options: ['A', 'B', 'C', 'D', 'X']
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
icon: 'fa fa-times text-danger',
|
||||
actionType: 'ajax',
|
||||
tooltip: '删除',
|
||||
confirmText: '您确认要删除?',
|
||||
api: 'delete:/api/sample/$id'
|
||||
}
|
||||
],
|
||||
toggled: true
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
91
examples/components/CRUD/test.jsx
Normal file
91
examples/components/CRUD/test.jsx
Normal file
@@ -0,0 +1,91 @@
|
||||
export default {
|
||||
title: 'Test 信息:${page}',
|
||||
body: {
|
||||
type: 'crud',
|
||||
api: '/api/sample',
|
||||
syncLocation: false,
|
||||
title: null,
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: 'ID',
|
||||
width: 20
|
||||
},
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
name: 'grade',
|
||||
type: 'map',
|
||||
label: 'Rendering engine',
|
||||
map: {
|
||||
'A': "<span class='label label-info'>A</span>",
|
||||
'B': "<span class='label label-success'>B</span>",
|
||||
'C': "<span class='label label-primary'>C</span>",
|
||||
'X': "<span class='label label-danger'>X</span>",
|
||||
'*': 'Unkown'
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'operation',
|
||||
label: '操作',
|
||||
width: 200,
|
||||
buttons: [
|
||||
{
|
||||
type: 'button-group',
|
||||
buttons: [
|
||||
{
|
||||
type: 'button',
|
||||
label: '查看',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
disabled: true,
|
||||
body: {
|
||||
type: 'form',
|
||||
body: [
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
type: 'static'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
type: 'button',
|
||||
label: '编辑',
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
body: {
|
||||
api: '/api/sample/$id',
|
||||
type: 'form',
|
||||
body: [
|
||||
{
|
||||
name: 'engine',
|
||||
label: 'Rendering engine',
|
||||
type: 'text'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
type: 'button',
|
||||
label: '删除',
|
||||
level: 'danger',
|
||||
actionType: 'ajax',
|
||||
confirmText: '确定?',
|
||||
api: 'delete:/api/sample/$id'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user