mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 21:08:55 +08:00
Merge branch 'master' into feat-comp-context
This commit is contained in:
commit
c2d7a27b62
@ -844,6 +844,27 @@ export function findTree<T extends TreeItem>(
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 在树中查找节点。
|
||||
* @param tree
|
||||
* @param iterator
|
||||
*/
|
||||
export function findTreeAll<T extends TreeItem>(
|
||||
tree: Array<T>,
|
||||
iterator: (item: T, key: number, level: number, paths: Array<T>) => any
|
||||
): Array<T> {
|
||||
let result: Array<T> = [];
|
||||
|
||||
everyTree(tree, (item, key, level, paths) => {
|
||||
if (iterator(item, key, level, paths)) {
|
||||
result.push(item);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 在树中查找节点, 返回下标数组。
|
||||
* @param tree
|
||||
|
@ -109,7 +109,4 @@
|
||||
--link-onClick-fontSize: #{$Editor-right-panel-font-size};
|
||||
--radio-default-default-fontSize: #{$Editor-right-panel-font-size};
|
||||
--select-base-default-option-fontSize: #{$Editor-right-panel-font-size};
|
||||
--Tabs--line-fontSize: #{$Editor-right-panel-font-size};
|
||||
--Tabs--line-active-fontSize: #{$Editor-right-panel-font-size};
|
||||
--Tabs--line-hover-fontSize: #{$Editor-right-panel-font-size};
|
||||
}
|
||||
|
@ -5,8 +5,6 @@ $category-2-height: px2rem(32px);
|
||||
$tooltip-bottom: '[data-tooltip][data-position=' bottom ']:hover:after';
|
||||
|
||||
.editor-right-panel {
|
||||
@include panel-sm-content();
|
||||
|
||||
position: relative;
|
||||
flex: 0 0 auto;
|
||||
width: $right-panel-width;
|
||||
|
@ -83,6 +83,9 @@
|
||||
|
||||
.ae-ApiControl-form {
|
||||
@include panel-sm-content();
|
||||
--Tabs--line-fontSize: #{$Editor-right-panel-font-size};
|
||||
--Tabs--line-active-fontSize: #{$Editor-right-panel-font-size};
|
||||
--Tabs--line-hover-fontSize: #{$Editor-right-panel-font-size};
|
||||
.ae-ApiControl-tabContent {
|
||||
max-height: 560px;
|
||||
overflow-x: hidden;
|
||||
|
@ -25,6 +25,7 @@ div.ae-editor-FormulaControl {
|
||||
|
||||
& &-input {
|
||||
flex: 1;
|
||||
height: 32px;
|
||||
border-radius: var(--input-default-default-top-left-border-radius) 0 0
|
||||
var(--input-default-default-bottom-left-border-radius);
|
||||
max-width: calc(100% - 29px); // 避免表达式内容太长撑开面板
|
||||
@ -32,6 +33,11 @@ div.ae-editor-FormulaControl {
|
||||
&.is-clearable {
|
||||
padding-right: 30px; // 避免间隙过大
|
||||
}
|
||||
|
||||
svg {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
&-select-style {
|
||||
|
@ -1646,19 +1646,15 @@ export const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
|
||||
rootLabel: '页面变量',
|
||||
options: pageVariableOptions
|
||||
}),
|
||||
{
|
||||
type: 'input-formula',
|
||||
getSchemaTpl('formulaControl', {
|
||||
name: 'value',
|
||||
label: '数据设置',
|
||||
variables: '${variables}',
|
||||
evalMode: false,
|
||||
variableMode: 'tabs',
|
||||
inputMode: 'input-group',
|
||||
size: 'lg',
|
||||
mode: 'horizontal',
|
||||
required: true,
|
||||
placeholder: '请输入变量值'
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
])
|
||||
@ -1677,19 +1673,15 @@ export const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
|
||||
getCustomNodeTreeSelectSchema({
|
||||
options: variableOptions
|
||||
}),
|
||||
{
|
||||
type: 'input-formula',
|
||||
getSchemaTpl('formulaControl', {
|
||||
name: 'value',
|
||||
label: '数据设置',
|
||||
variables: '${variables}',
|
||||
evalMode: false,
|
||||
variableMode: 'tabs',
|
||||
inputMode: 'input-group',
|
||||
size: 'lg',
|
||||
mode: 'horizontal',
|
||||
required: true,
|
||||
placeholder: '请输入变量值'
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
])
|
||||
|
@ -731,6 +731,7 @@ export class EventControl extends React.Component<
|
||||
onSubmit(type: string, config: any) {
|
||||
const {actionConfigSubmitFormatter} = this.props;
|
||||
const action = actionConfigSubmitFormatter?.(config) ?? config;
|
||||
delete action.__actionSchema;
|
||||
if (type === 'add') {
|
||||
this.addAction?.(config.eventKey, action);
|
||||
} else if (type === 'update') {
|
||||
|
@ -1,6 +1,10 @@
|
||||
@import './functions';
|
||||
@import './variables';
|
||||
$remFactor: 16px;
|
||||
|
||||
/* 此处放置需要override的变量,因为部分变量已经在variables.scss中定义 */
|
||||
$Table-strip-bg: transparent;
|
||||
|
||||
:root {
|
||||
--white: var(--colors-neutral-text-11);
|
||||
--primary: var(--colors-brand-5);
|
||||
|
@ -463,11 +463,16 @@
|
||||
border-color: var(--Checkbox-color);
|
||||
&:hover {
|
||||
border-color: var(--Checkbox-color) !important;
|
||||
box-shadow: -1px 0 0 0 var(--Checkbox-color) !important;
|
||||
&:first-child {
|
||||
box-shadow: none !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
&--button--disabled--checked.#{$ns}Checkbox--checkbox {
|
||||
background: var(--Checkbox-onDisabled-bg);
|
||||
border-color: var(--Checkbox-color) !important;
|
||||
box-shadow: none !important;
|
||||
&:hover {
|
||||
border-color: var(--Checkbox-color) !important;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
|
||||
import {themeable, ThemeProps, findTree} from 'amis-core';
|
||||
import {themeable, ThemeProps, findTreeAll} from 'amis-core';
|
||||
import GroupedSelection from '../GroupedSelection';
|
||||
import Tabs, {Tab} from '../Tabs';
|
||||
import TreeSelection from '../TreeSelection';
|
||||
@ -75,8 +75,8 @@ function VariableList(props: VariableListProps) {
|
||||
};
|
||||
|
||||
function onSearch(term: string) {
|
||||
const tree = findTree(list, i => ~i.label.indexOf(term));
|
||||
setFilterVars(!term ? list : tree ? [tree] : []);
|
||||
const tree = findTreeAll(list, i => ~i.label.indexOf(term));
|
||||
setFilterVars(!term ? list : tree);
|
||||
}
|
||||
|
||||
function renderSearchBox() {
|
||||
|
@ -69,7 +69,23 @@ test('Renderer:crud basic interval headerToolbar footerToolbar', async () => {
|
||||
interval: 1000,
|
||||
perPage: 2,
|
||||
headerToolbar: ['export-excel', 'statistics'],
|
||||
footerToolbar: ['pagination', 'export-excel'],
|
||||
footerToolbar: [
|
||||
'pagination',
|
||||
{
|
||||
type: 'pagination',
|
||||
total: '${count}',
|
||||
layout: 'total,perPage,pager,go',
|
||||
mode: 'normal',
|
||||
activePage: 2,
|
||||
perPage: 10,
|
||||
maxButtons: 7,
|
||||
showPerPage: true,
|
||||
perPageAvailable: [10, 20, 50, 100],
|
||||
showPageInput: true,
|
||||
disabled: false
|
||||
},
|
||||
'export-excel'
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
name: '__id',
|
||||
|
@ -2940,6 +2940,155 @@ exports[`Renderer:crud basic interval headerToolbar footerToolbar 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="cxd-Crud-toolbar-item cxd-Crud-toolbar-item--right"
|
||||
>
|
||||
<div
|
||||
class="cxd-Crud-pager"
|
||||
>
|
||||
<div
|
||||
class="cxd-Pagination-wrap"
|
||||
>
|
||||
<div
|
||||
class="cxd-Pagination-total cxd-Pagination-item"
|
||||
>
|
||||
共 144 条
|
||||
</div>
|
||||
<div
|
||||
aria-expanded="false"
|
||||
aria-haspopup="listbox"
|
||||
aria-labelledby="downshift-0-label"
|
||||
class="cxd-Select cxd-Pagination-perpage cxd-Pagination-item"
|
||||
role="combobox"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="cxd-Select-valueWrap"
|
||||
>
|
||||
<div
|
||||
class="cxd-Select-placeholder"
|
||||
>
|
||||
请选择
|
||||
</div>
|
||||
</div>
|
||||
<span
|
||||
class="cxd-Select-arrow"
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon icon-right-arrow-bold"
|
||||
icon="right-arrow-bold"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<ul
|
||||
class="cxd-Pagination cxd-Pagination--sm cxd-Pagination-item"
|
||||
>
|
||||
<li
|
||||
class="cxd-Pagination-prev is-disabled"
|
||||
>
|
||||
<span>
|
||||
<icon-mock
|
||||
classname="icon icon-left-arrow"
|
||||
icon="left-arrow"
|
||||
/>
|
||||
</span>
|
||||
</li>
|
||||
<li
|
||||
class="cxd-Pagination-pager-item is-active"
|
||||
>
|
||||
<a
|
||||
role="button"
|
||||
>
|
||||
1
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
class="cxd-Pagination-pager-item"
|
||||
>
|
||||
<a
|
||||
role="button"
|
||||
>
|
||||
2
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
class="cxd-Pagination-pager-item"
|
||||
>
|
||||
<a
|
||||
role="button"
|
||||
>
|
||||
3
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
class="cxd-Pagination-pager-item"
|
||||
>
|
||||
<a
|
||||
role="button"
|
||||
>
|
||||
4
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
class="cxd-Pagination-pager-item"
|
||||
>
|
||||
<a
|
||||
role="button"
|
||||
>
|
||||
5
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
class="ellipsis"
|
||||
>
|
||||
<a
|
||||
role="button"
|
||||
>
|
||||
...
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
class="cxd-Pagination-pager-item"
|
||||
>
|
||||
<a
|
||||
role="button"
|
||||
>
|
||||
72
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
class="cxd-Pagination-next"
|
||||
>
|
||||
<span>
|
||||
<icon-mock
|
||||
classname="icon icon-right-arrow"
|
||||
icon="right-arrow"
|
||||
/>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
<div
|
||||
class="cxd-Pagination-inputGroup cxd-Pagination-item"
|
||||
>
|
||||
<span
|
||||
class="cxd-Pagination-inputGroup-left"
|
||||
>
|
||||
跳转至
|
||||
</span>
|
||||
<input
|
||||
class="cxd-Pagination-inputGroup-input"
|
||||
type="text"
|
||||
value=""
|
||||
/>
|
||||
<span
|
||||
class="cxd-Pagination-inputGroup-right"
|
||||
>
|
||||
GO
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="cxd-Crud-toolbar-item cxd-Crud-toolbar-item--left"
|
||||
>
|
||||
|
@ -1688,7 +1688,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
let itemBtns: Array<ActionSchema> = [];
|
||||
|
||||
const ctx = createObject(store.mergedData, {
|
||||
currentPageData: store.mergedData.items.concat(),
|
||||
currentPageData: (store.mergedData?.items || []).concat(),
|
||||
rows: selectedItems.concat(),
|
||||
items: selectedItems.concat(),
|
||||
selectedItems: selectedItems.concat(),
|
||||
@ -1795,7 +1795,12 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
|
||||
const extraProps: Pick<
|
||||
PaginationProps,
|
||||
'showPageInput' | 'maxButtons' | 'layout' | 'popOverContainerSelector'
|
||||
| 'showPageInput'
|
||||
| 'maxButtons'
|
||||
| 'layout'
|
||||
| 'popOverContainerSelector'
|
||||
| 'total'
|
||||
| 'perPageAvailable'
|
||||
> = {};
|
||||
|
||||
/** 优先级:showPageInput显性配置 > (lastPage > 9) */
|
||||
@ -1809,6 +1814,11 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
extraProps.popOverContainerSelector = (
|
||||
toolbar as Schema
|
||||
).popOverContainerSelector;
|
||||
extraProps.perPageAvailable = (toolbar as Schema).perPageAvailable;
|
||||
extraProps.total = resolveVariableAndFilter(
|
||||
(toolbar as Schema).total,
|
||||
store.data
|
||||
);
|
||||
} else {
|
||||
extraProps.showPageInput = lastPage > 9;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user