Skip to content

fix(table): Added placeholder properties to tables #1151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/core-interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,8 @@ export interface TableProps extends PositionProps, TextBaseProps, ObjectNameProp
* @deprecated v3.3.0 - use `autoPageSlideStartY`
*/
newSlideStartY?: number

placeholder?: string
}
export interface TableCell {
_type: SLIDE_OBJECT_TYPES.tablecell
Expand Down
9 changes: 9 additions & 0 deletions src/gen-objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,15 @@ export function addTableDefinition(
let opt: TableProps = options && typeof options === 'object' ? options : {}
opt.objectName = opt.objectName ? encodeXmlEntities(opt.objectName) : `Table ${target._slideObjects.filter(obj => obj._type === SLIDE_OBJECT_TYPES.table).length}`

if (opt.placeholder && target._slideLayout && target._slideLayout._slideObjects) {
// Placeholder
let placeHold = target._slideLayout._slideObjects.filter(
item => item._type == 'placeholder' && item.options && item.options.placeholder && item.options.placeholder == opt.placeholder
)[0]

if (placeHold && placeHold.options) opt = { ...opt, ...placeHold.options}
}

// STEP 1: REALITY-CHECK
{
// A: check for empty
Expand Down
2 changes: 2 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1715,6 +1715,8 @@ declare namespace PptxGenJS {
* @deprecated v3.3.0 - use `autoPageSlideStartY`
*/
newSlideStartY?: number

placeholder?: string
}
export interface TableCell {
text?: string | TableCell[]
Expand Down