diff --git a/packages/amis-core/src/utils/helper.ts b/packages/amis-core/src/utils/helper.ts index d6a79cde7..6fa0146cc 100644 --- a/packages/amis-core/src/utils/helper.ts +++ b/packages/amis-core/src/utils/helper.ts @@ -844,6 +844,27 @@ export function findTree( return result; } +/** + * 在树中查找节点。 + * @param tree + * @param iterator + */ +export function findTreeAll( + tree: Array, + iterator: (item: T, key: number, level: number, paths: Array) => any +): Array { + let result: Array = []; + + everyTree(tree, (item, key, level, paths) => { + if (iterator(item, key, level, paths)) { + result.push(item); + } + return true; + }); + + return result; +} + /** * 在树中查找节点, 返回下标数组。 * @param tree diff --git a/packages/amis-editor-core/scss/_mixin.scss b/packages/amis-editor-core/scss/_mixin.scss index 119649d67..a41f4b6fd 100644 --- a/packages/amis-editor-core/scss/_mixin.scss +++ b/packages/amis-editor-core/scss/_mixin.scss @@ -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}; } diff --git a/packages/amis-editor-core/scss/_rightPanel.scss b/packages/amis-editor-core/scss/_rightPanel.scss index b58c581b9..4228e2ded 100644 --- a/packages/amis-editor-core/scss/_rightPanel.scss +++ b/packages/amis-editor-core/scss/_rightPanel.scss @@ -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; diff --git a/packages/amis-editor-core/scss/control/_api-control.scss b/packages/amis-editor-core/scss/control/_api-control.scss index c029fd465..63c587d14 100644 --- a/packages/amis-editor-core/scss/control/_api-control.scss +++ b/packages/amis-editor-core/scss/control/_api-control.scss @@ -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; diff --git a/packages/amis-editor-core/scss/control/_formula-control.scss b/packages/amis-editor-core/scss/control/_formula-control.scss index b16dbb321..0b1cf92bf 100644 --- a/packages/amis-editor-core/scss/control/_formula-control.scss +++ b/packages/amis-editor-core/scss/control/_formula-control.scss @@ -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 { diff --git a/packages/amis-editor/src/renderer/event-control/helper.tsx b/packages/amis-editor/src/renderer/event-control/helper.tsx index 9037c52bf..de6ca92ad 100644 --- a/packages/amis-editor/src/renderer/event-control/helper.tsx +++ b/packages/amis-editor/src/renderer/event-control/helper.tsx @@ -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: '请输入变量值' - } + }) ] } ]) diff --git a/packages/amis-editor/src/renderer/event-control/index.tsx b/packages/amis-editor/src/renderer/event-control/index.tsx index 50004a1f4..16256ae20 100644 --- a/packages/amis-editor/src/renderer/event-control/index.tsx +++ b/packages/amis-editor/src/renderer/event-control/index.tsx @@ -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') { diff --git a/packages/amis-ui/scss/_properties.scss b/packages/amis-ui/scss/_properties.scss index b79552ea0..b404ecb26 100644 --- a/packages/amis-ui/scss/_properties.scss +++ b/packages/amis-ui/scss/_properties.scss @@ -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); diff --git a/packages/amis-ui/scss/components/form/_checks.scss b/packages/amis-ui/scss/components/form/_checks.scss index baaf1551c..539c9d66c 100644 --- a/packages/amis-ui/scss/components/form/_checks.scss +++ b/packages/amis-ui/scss/components/form/_checks.scss @@ -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; } diff --git a/packages/amis-ui/src/components/formula/VariableList.tsx b/packages/amis-ui/src/components/formula/VariableList.tsx index be46669bd..df0721a4d 100644 --- a/packages/amis-ui/src/components/formula/VariableList.tsx +++ b/packages/amis-ui/src/components/formula/VariableList.tsx @@ -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() { diff --git a/packages/amis/__tests__/renderers/CRUD.test.tsx b/packages/amis/__tests__/renderers/CRUD.test.tsx index ce8364e9d..86f43c547 100644 --- a/packages/amis/__tests__/renderers/CRUD.test.tsx +++ b/packages/amis/__tests__/renderers/CRUD.test.tsx @@ -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', diff --git a/packages/amis/__tests__/renderers/__snapshots__/CRUD.test.tsx.snap b/packages/amis/__tests__/renderers/__snapshots__/CRUD.test.tsx.snap index f7233c332..546877f1f 100644 --- a/packages/amis/__tests__/renderers/__snapshots__/CRUD.test.tsx.snap +++ b/packages/amis/__tests__/renderers/__snapshots__/CRUD.test.tsx.snap @@ -2940,6 +2940,155 @@ exports[`Renderer:crud basic interval headerToolbar footerToolbar 1`] = ` +
+
+
+
+ 共 144 条 +
+ + +
+ + 跳转至 + + + + GO + +
+
+
+
diff --git a/packages/amis/src/renderers/CRUD.tsx b/packages/amis/src/renderers/CRUD.tsx index 5966412c7..0c2e6d33e 100644 --- a/packages/amis/src/renderers/CRUD.tsx +++ b/packages/amis/src/renderers/CRUD.tsx @@ -1688,7 +1688,7 @@ export default class CRUD extends React.Component { let itemBtns: Array = []; 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 { 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 { 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; }