diff --git a/scss/components/form/_tree.scss b/scss/components/form/_tree.scss index 8949898e0..3e5def7b2 100644 --- a/scss/components/form/_tree.scss +++ b/scss/components/form/_tree.scss @@ -32,8 +32,6 @@ position: relative; >div { - color: inherit; - &:hover { text-decoration: none; @@ -230,11 +228,13 @@ - &-item &-item>&-itemLabel { + &-item &-item>&-itemLabel, + &-item>&-placeholder { padding-left: $Tree-indent; } - &-item &-item &-item>&-itemLabel { + &-item &-item &-item>&-itemLabel, + &-item &-item>&-placeholder { padding-left: $Tree-indent * 2; } diff --git a/src/components/Tree.tsx b/src/components/Tree.tsx index 7982fabf0..f90f61c0d 100644 --- a/src/components/Tree.tsx +++ b/src/components/Tree.tsx @@ -646,6 +646,8 @@ export class TreeSelector extends React.Component< ) : null} {childrenItems} + ) : !childrenItems && item.placeholder ? ( +
{item.placeholder}
) : null} ); @@ -674,7 +676,7 @@ export class TreeSelector extends React.Component< let addBtn = null; - if (creatable && hideRoot) { + if (creatable && rootCreatable !== false && hideRoot) { addBtn = ( = []; -export function normalizeApi(api: Api): ApiObject { +export function normalizeApi(api: Api, defaultMethod?: string): ApiObject { if (typeof api === 'string') { let method = rSchema.test(api) ? RegExp.$1 : ''; method && (api = api.replace(method + ':', '')); api = { - method: method as any, + method: (method || defaultMethod) as any, url: api }; } else { @@ -46,7 +46,7 @@ export function buildApi( [propName: string]: any; } = {} ): ApiObject { - api = normalizeApi(api); + api = normalizeApi(api, options.method); const {autoAppend, ignoreData, ...rest} = options; api.config = {