Skip to content

Commit 6b31a26

Browse files
committed
fix: update query selector for bar elements and improve data handling in DataTableEditor
1 parent c4c1a5e commit 6b31a26

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

packages/chart/src/_stories/ChartBar.Editor.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2809,7 +2809,7 @@ export const BarVisualTests: Story = {
28092809

28102810
// Find bar elements in the chart
28112811
const barElements =
2812-
chartSvg?.querySelectorAll('rect[class*="bar"], path[class*="bar"], g[class*="bar"] rect') || []
2812+
chartSvg?.querySelectorAll('rect[class*="bar"], path[class*="bar"], g[class*="bar"] path') || []
28132813

28142814
// Check for border-related styles and attributes
28152815
const barsWithStroke = Array.from(barElements).filter(bar => {

packages/core/components/EditorPanel/DataTableEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const DataTableEditor: React.FC<DataTableProps> = ({ config, updateField, isDash
2727
}, [config.columns])
2828

2929
const groupPivotColumns = useMemo(() => {
30-
const columns: string[] = config.data.flatMap(Object.keys)
30+
const columns: string[] = (config.data ?? []).flatMap(Object.keys)
3131
const cols = _.uniq(columns).filter(key => {
3232
return true
3333
})

packages/dashboard/src/_stories/Dashboard.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,13 @@ export const Footnotes: Story = {
223223
}
224224
}
225225

226-
const EqualHeightMixedVizConfig = _.cloneDeep(Dashboard_Filter) as Config
226+
const EqualHeightMixedVizConfig = cloneDeep(Dashboard_Filter) as Config
227227
const equalHeightDataBiteKey = 'equal-height-data-bite-story'
228228
const equalHeightDataBiteTemplate = Object.values(ExampleConfig_1.visualizations).find(v => v?.type === 'data-bite')
229229

230230
if (equalHeightDataBiteTemplate) {
231231
EqualHeightMixedVizConfig.visualizations[equalHeightDataBiteKey] = {
232-
..._.cloneDeep(equalHeightDataBiteTemplate),
232+
...cloneDeep(equalHeightDataBiteTemplate),
233233
uid: equalHeightDataBiteKey,
234234
theme: 'theme-blue',
235235
bitePosition: 'Top',

packages/markup-include/src/CdcMarkupInclude.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,9 @@ const CdcMarkupInclude: React.FC<CdcMarkupIncludeProps> = ({
275275
titleStyle={contentEditor.titleStyle}
276276
config={config}
277277
classes={[`${theme}`, 'mb-0']}
278-
noContent={!markup}
278+
noContent={!sanitizedHTML}
279279
/>
280280
<div className={`markup-include-component ${contentClasses.join(' ')}`}>
281-
{/* Filters */}
282281
{config.filters && config.filters.length > 0 && (
283282
<Filters
284283
config={config}
@@ -298,7 +297,12 @@ const CdcMarkupInclude: React.FC<CdcMarkupIncludeProps> = ({
298297
<p>{`${noDataMessageText}`}</p>
299298
</div>
300299
)}
301-
{!markupError && !_showNoDataMessage && <Markup allowElements={!!urlMarkup} content={markup} />}
300+
{!markupError && !_showNoDataMessage && (
301+
<div id={scopeId}>
302+
{scopedCSS && <style>{scopedCSS}</style>}
303+
<div dangerouslySetInnerHTML={{ __html: sanitizedHTML }} />
304+
</div>
305+
)}
302306
{markupError && srcUrl && !_showNoDataMessage && <div className='warning'>{errorMessage}</div>}
303307
</div>
304308
</div>

packages/markup-include/src/_stories/MarkupInclude.Editor.stories.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,21 +306,16 @@ export const VisualSectionTests: Story = {
306306
// Expectation: Theme class changes on component
307307
// ============================================================================
308308
const getThemeState = () => {
309-
// Use the contentContainer like other tests, and check its parent for theme classes
310309
const content = contentContainer()
311310
if (!content) return { theme: '', classes: '', element: 'content not found' }
312311

313-
// Check content itself and its parent for theme classes
312+
// Theme is applied to the outer cove-visualization wrapper — traverse up to find it
313+
const themeWrapper = content.closest('[class*="theme-"]') as HTMLElement
314+
const theme = themeWrapper ? Array.from(themeWrapper.classList).find(cls => cls.startsWith('theme-')) || '' : ''
315+
314316
const contentClasses = Array.from(content.classList).join(' ')
315317
const parentClasses = content.parentElement ? Array.from(content.parentElement.classList).join(' ') : ''
316318

317-
const contentTheme = Array.from(content.classList).find(cls => cls.startsWith('theme-')) || ''
318-
const parentTheme = content.parentElement
319-
? Array.from(content.parentElement.classList).find(cls => cls.startsWith('theme-')) || ''
320-
: ''
321-
322-
const theme = contentTheme || parentTheme || ''
323-
324319
return {
325320
theme,
326321
classes: contentClasses + ' | parent: ' + parentClasses,

packages/waffle-chart/src/_stories/WaffleChart.Editor.stories.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,8 @@ export const VisualSectionTests: Story = {
671671
async () => {
672672
await userEvent.click(borderColorThemeCheckbox)
673673
},
674-
(before, after) => before !== after && (after.includes('borderColorTheme') || before.includes('borderColorTheme'))
674+
(before, after) =>
675+
before !== after && (after.includes('border-color-theme') || before.includes('border-color-theme'))
675676
)
676677

677678
// ============================================================================

0 commit comments

Comments
 (0)