pub struct ViewSpec {
pub name: ViewName,
pub title: String,
pub fields: Vec<FieldRef>,
pub actions: Vec<ActionRef>,
pub data_action: Option<ActionRef>,
pub action_presentations: BTreeMap<ActionRef, ActionPresentationSpec>,
pub tree: Option<TreeViewSpec>,
pub default_sort: Vec<TableSortSpec>,
}Expand description
后台 Table/Select 等展示定义。
Fields§
§name: ViewNameView 局部名称。
title: String用户可见标题;默认使用 View 局部名称。
fields: Vec<FieldRef>有序字段引用。
actions: Vec<ActionRef>有序按钮/操作引用。
data_action: Option<ActionRef>为通用表格返回标准分页行数据的 Action。
action_presentations: BTreeMap<ActionRef, ActionPresentationSpec>显式 Action 展示声明;未声明的 Action 在构建期按静态契约安全推导。
tree: Option<TreeViewSpec>可选树拓扑;未声明时按普通表格投影。
default_sort: Vec<TableSortSpec>有序默认排序声明。
Implementations§
Source§impl ViewSpec
impl ViewSpec
Sourcepub fn data_action(self, action: ActionRef) -> Self
pub fn data_action(self, action: ActionRef) -> Self
设置通用表格的数据查询 Action。
该 Action 必须返回 JSON,且业务数据应符合 items/page/page_size/total
分页结构。它不会自动成为工具栏或行按钮。
Sourcepub fn present_action(
self,
action: ActionRef,
presentation: ActionPresentationSpec,
) -> Self
pub fn present_action( self, action: ActionRef, presentation: ActionPresentationSpec, ) -> Self
增加一个带显式展示语义的按钮或操作引用。
Sourcepub fn tree(self, tree: TreeViewSpec) -> Self
pub fn tree(self, tree: TreeViewSpec) -> Self
将当前 View 显式声明为树 View。
Sourcepub fn default_sort(self, sort: TableSortSpec) -> Self
pub fn default_sort(self, sort: TableSortSpec) -> Self
增加一个默认排序字段。
Trait Implementations§
impl Eq for ViewSpec
impl StructuralPartialEq for ViewSpec
Auto Trait Implementations§
impl Forget for ViewSpec
impl Freeze for ViewSpec
impl Move for ViewSpec
impl RefUnwindSafe for ViewSpec
impl Send for ViewSpec
impl Sync for ViewSpec
impl Unpin for ViewSpec
impl UnsafeUnpin for ViewSpec
impl UnwindSafe for ViewSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more