mirror of
https://github.com/wassname/talk.git
synced 2026-08-08 11:28:12 +08:00
Rename slotSize to size
This commit is contained in:
@@ -94,7 +94,7 @@ class UserDetailComment extends React.Component {
|
||||
'talk-admin-user-detail-comment'
|
||||
)}
|
||||
queryData={queryData}
|
||||
slotSize={1}
|
||||
size={1}
|
||||
defaultComponent={CommentFormatter}
|
||||
{...formatterSettings}
|
||||
/>
|
||||
|
||||
@@ -138,7 +138,7 @@ class Comment extends React.Component {
|
||||
className={cn(styles.commentContent, 'talk-admin-comment')}
|
||||
clearHeightCache={clearHeightCache}
|
||||
queryData={queryData}
|
||||
slotSize={1}
|
||||
size={1}
|
||||
defaultComponent={CommentFormatter}
|
||||
{...formatterSettings}
|
||||
/>
|
||||
|
||||
@@ -667,7 +667,7 @@ export default class Comment extends React.Component {
|
||||
defaultComponent={CommentContent}
|
||||
{...slotProps}
|
||||
queryData={queryData}
|
||||
slotSize={1}
|
||||
size={1}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -38,7 +38,7 @@ class Slot extends React.Component {
|
||||
'inline',
|
||||
'className',
|
||||
'reduxState',
|
||||
'slotSize',
|
||||
'size',
|
||||
'defaultComponent',
|
||||
'queryData',
|
||||
'childFactory',
|
||||
@@ -47,7 +47,7 @@ class Slot extends React.Component {
|
||||
}
|
||||
|
||||
getChildren(props = this.props) {
|
||||
const { slotSize = 0 } = props;
|
||||
const { size = 0 } = props;
|
||||
const { plugins } = this.context;
|
||||
|
||||
return plugins.getSlotElements(
|
||||
@@ -55,7 +55,7 @@ class Slot extends React.Component {
|
||||
props.reduxState,
|
||||
this.getSlotProps(props),
|
||||
props.queryData,
|
||||
{ slotSize }
|
||||
{ size }
|
||||
);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ Slot.propTypes = {
|
||||
/**
|
||||
* Specifies the number of children that can fill the slot.
|
||||
*/
|
||||
slotSize: PropTypes.number,
|
||||
size: PropTypes.number,
|
||||
|
||||
/**
|
||||
* You may specify the component to use as the root wrapper.
|
||||
|
||||
@@ -99,7 +99,7 @@ class PluginsService {
|
||||
*/
|
||||
getSlotElements(slot, reduxState, props = {}, queryData = {}, options = {}) {
|
||||
const pluginConfig = get(reduxState, 'config.plugin_config') || emptyConfig;
|
||||
const { slotSize = 0 } = options;
|
||||
const { size = 0 } = options;
|
||||
|
||||
const isDisabled = component => {
|
||||
if (
|
||||
@@ -136,15 +136,15 @@ class PluginsService {
|
||||
.map(o => o.module.slots[slot])
|
||||
);
|
||||
|
||||
if (slotSize > 0 && slots.length > slotSize) {
|
||||
if (size > 0 && slots.length > size) {
|
||||
console.warn(
|
||||
`Slot[${slot}] supports a maximum of ${slotSize} plugins providing slots, got ${
|
||||
`Slot[${slot}] supports a maximum of ${size} plugins providing slots, got ${
|
||||
slots.length
|
||||
}, will only use the first ${slotSize}`
|
||||
}, will only use the first ${size}`
|
||||
);
|
||||
}
|
||||
|
||||
return (slotSize > 0 ? slots.slice(0, slotSize) : slots)
|
||||
return (size > 0 ? slots.slice(0, size) : slots)
|
||||
.map((component, i) => ({
|
||||
component,
|
||||
disabled: isDisabled(component),
|
||||
|
||||
@@ -24,7 +24,7 @@ export default {
|
||||
createComment: {
|
||||
comment: {
|
||||
user: {
|
||||
created_at: new Date(),
|
||||
created_at: new Date().toISOString(),
|
||||
__typename: 'User',
|
||||
},
|
||||
__typename: 'Comment',
|
||||
|
||||
Reference in New Issue
Block a user