Skip to content

Conversation

@betterdancing
Copy link
Contributor

@betterdancing betterdancing commented Jan 21, 2026

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

What is the current behavior?

图表组件的option配置面板现在是作为一个整体交给用户配置,体验很不好

Issue Number: N/A

What is the new behavior?

将options里各个属性拆分成单独的配置属性由用户配置

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

Release Notes

  • New Features
    • Enhanced chart customization with expanded configuration options for histogram and bar chart components.
    • Added new event handlers for chart rendering lifecycle.
    • Introduced new configurator component for advanced object property configuration.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions bot added the enhancement New feature or request label Jan 21, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 21, 2026

Walkthrough

This pull request expands the chart component schema in a dashboard configuration file by adding comprehensive properties and event handlers to histogram and bar chart components, while introducing a new ObjectDepthConfigurator Vue component for rendering nested configuration items with support for property binding and updates.

Changes

Cohort / File(s) Change Summary
Chart Configuration Schema Updates
designer-demo/public/mock/bundle.json
Added extensive properties array to TinyChartsHistogram and TinyHuichartsBar components containing configuration fields (color, data, dataRules, dataZoom, direction, itemStyle, label, legend, lineDataName, markline, padding, theme, tooltip, type, xAxis, yAxis) with widget specifications. Added onReady and onReadyOnce event handlers to both components.
ObjectDepthConfigurator Component
packages/configurator/src/object-depth-configurator/ObjectDepthConfigurator.vue
New Vue SFC component that iterates over meta properties and renders ConfigItem components. Accepts meta prop, emits update:modelValue, provides itemChange function for property updates, and includes scoped styling for container layout.
Module Export Update
packages/configurator/src/index.ts
Exported ObjectDepthConfigurator component from the configurator module's public API.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 With chart configurations stacked so high,
And a new ObjectDepthConfigurator in the sky,
Properties nested like carrots in a row,
Events and widgets help configurations grow!
The dashboard now dances with customization's grace. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Feat/chart options configurator: The options configuration panel is added for chart components.' clearly and specifically summarizes the main change—adding a new options configuration panel for chart components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In
`@packages/configurator/src/object-depth-configurator/ObjectDepthConfigurator.vue`:
- Line 8: The template references an undefined variable via
:data-group-index="index" in ObjectDepthConfigurator.vue; add a prop named index
to the component's props (or define it in setup) or remove/replace the binding
with the correct existing value. Specifically, if ConfigItem consumers expect a
numeric group index, add an index prop (e.g., props: { index: { type: Number,
required: true } }) to the ObjectDepthConfigurator component and use that prop
in :data-group-index, otherwise change the attribute to use the correct existing
variable or omit it.
- Around line 27-30: The prop definition for meta in ObjectDepthConfigurator.vue
uses a default arrow function that returns undefined; update the meta prop's
default to return an empty object (e.g., change the default factory to return {}
instead of using a block with no return) so that accesses like
props.meta.properties or props.meta.widget won't throw; locate the meta prop in
the component options (meta: { type: Object, default: ... }) and replace the
default implementation with a function that returns an empty object.
- Around line 34-47: The computed property properties is mutating objects from
props.meta.properties[0].content (setting item.widget.props.modelValue) and also
accesses props.meta.widget.props?.modelValue without ensuring props.meta.widget
exists; change properties to produce a new array (use map) and deep-clone each
item before assigning modelValue so you don't mutate the original props, and
guard access to props.meta.widget (e.g., read
props.meta.widget?.props?.modelValue) when retrieving propsModelValue; update
references to the computed properties, props.meta.properties,
props.meta.widget.props.modelValue, and item.widget.props.modelValue while
making these changes.
- Around line 48-50: itemChange currently reads
props.meta.widget.props.modelValue without null checks which can throw if
meta/widget/props is undefined; update itemChange to safely access the nested
value (use optional chaining on props.meta?.widget?.props?.modelValue) and
default to an empty object before spreading, then emit the update as before
(reference itemChange and the emit('update:modelValue', ...) call).
🧹 Nitpick comments (4)
packages/configurator/src/object-depth-configurator/ObjectDepthConfigurator.vue (1)

3-6: Redundant :key on nested element.

The :key="idx" on line 5 is redundant since the parent div already has :key="idx". The key is only needed on the element with v-for.

Proposed fix
     <div v-for="(data, idx) in properties" :key="idx" class="meta-config-item">
       <config-item
-        :key="idx"
         :property="data"
         :data-prop-index="idx"
designer-demo/public/mock/bundle.json (3)

4115-4130: Extraneous language prop in SelectConfigurator.

The language: "json" prop on Line 4118 appears to be copy-paste residue from CodeConfigurator. SelectConfigurator does not use a language prop.

🧹 Suggested cleanup
                            "widget": {
                              "component": "SelectConfigurator",
                              "props": {
-                               "language": "json",
                                "options": [
                                  {
                                    "label": "vertical",
                                    "value": "vertical"
                                  },
                                  {
                                    "label": "horizontal",
                                    "value": "horizontal"
                                  }
                                ]
                              }
                            },

4143-4155: Mixed line endings in defaultValue.

The defaultValue on Line 4146 uses \r\n initially but ends with just \n, creating inconsistent line endings. This could cause display or parsing inconsistencies.

🧹 Suggested fix for consistent line endings
-                           "defaultValue": "{ \r\n\"barWidth\": 8, \r\n\"barGap\": \"60%\"\n}",
+                           "defaultValue": "{\n  \"barWidth\": 8,\n  \"barGap\": \"60%\"\n}",

4066-4103: Consider relaxing required: true for optional chart features.

Properties like dataRules, dataZoom, markline, legend, label, tooltip, and lineDataName are typically optional chart enhancements. Marking all of them as required: true may force users to provide values for features they don't intend to use, reducing configuration flexibility.

Consider setting "required": false for genuinely optional properties.

Comment on lines +27 to +30
meta: {
type: Object,
default: () => {}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Default function returns undefined instead of an empty object.

The arrow function () => {} is a function body with no return statement, so it returns undefined. This can cause null reference errors when accessing props.meta.properties or props.meta.widget.

Proposed fix
   meta: {
     type: Object,
-    default: () => {}
+    default: () => ({})
   }
🤖 Prompt for AI Agents
In
`@packages/configurator/src/object-depth-configurator/ObjectDepthConfigurator.vue`
around lines 27 - 30, The prop definition for meta in
ObjectDepthConfigurator.vue uses a default arrow function that returns
undefined; update the meta prop's default to return an empty object (e.g.,
change the default factory to return {} instead of using a block with no return)
so that accesses like props.meta.properties or props.meta.widget won't throw;
locate the meta prop in the component options (meta: { type: Object, default:
... }) and replace the default implementation with a function that returns an
empty object.

Comment on lines +34 to +47
const properties = computed(() => {
const result = props.meta?.properties?.[0]?.content || []
const propsModelValue = props.meta.widget.props?.modelValue

if (result.length && propsModelValue) {
result.forEach((item) => {
const modelValue = propsModelValue
const model_value_property = modelValue[item.property]
item.widget.props.modelValue =
typeof model_value_property === 'boolean' ? model_value_property : model_value_property || null
})
}
return result
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Computed property has side effects by mutating source data.

The forEach loop mutates item.widget.props.modelValue directly on the objects from props.meta.properties[0].content. Mutating data inside a computed property is a Vue anti-pattern that can cause unpredictable reactivity behavior and affect the parent component's state.

Additionally, line 36 accesses props.meta.widget.props?.modelValue without checking if props.meta.widget exists, which can throw if meta uses the default value.

Proposed fix: deep clone items before mutation
 const properties = computed(() => {
-  const result = props.meta?.properties?.[0]?.content || []
-  const propsModelValue = props.meta.widget.props?.modelValue
+  const content = props.meta?.properties?.[0]?.content || []
+  const propsModelValue = props.meta?.widget?.props?.modelValue

-  if (result.length && propsModelValue) {
-    result.forEach((item) => {
-      const modelValue = propsModelValue
-      const model_value_property = modelValue[item.property]
-      item.widget.props.modelValue =
-        typeof model_value_property === 'boolean' ? model_value_property : model_value_property || null
+  if (!content.length || !propsModelValue) {
+    return content
+  }
+
+  return content.map((item) => {
+    const model_value_property = propsModelValue[item.property]
+    return {
+      ...item,
+      widget: {
+        ...item.widget,
+        props: {
+          ...item.widget?.props,
+          modelValue:
+            typeof model_value_property === 'boolean' ? model_value_property : model_value_property || null
+        }
+      }
+    }
   })
- }
- return result
 })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const properties = computed(() => {
const result = props.meta?.properties?.[0]?.content || []
const propsModelValue = props.meta.widget.props?.modelValue
if (result.length && propsModelValue) {
result.forEach((item) => {
const modelValue = propsModelValue
const model_value_property = modelValue[item.property]
item.widget.props.modelValue =
typeof model_value_property === 'boolean' ? model_value_property : model_value_property || null
})
}
return result
})
const properties = computed(() => {
const content = props.meta?.properties?.[0]?.content || []
const propsModelValue = props.meta?.widget?.props?.modelValue
if (!content.length || !propsModelValue) {
return content
}
return content.map((item) => {
const model_value_property = propsModelValue[item.property]
return {
...item,
widget: {
...item.widget,
props: {
...item.widget?.props,
modelValue:
typeof model_value_property === 'boolean' ? model_value_property : model_value_property || null
}
}
}
})
})
🤖 Prompt for AI Agents
In
`@packages/configurator/src/object-depth-configurator/ObjectDepthConfigurator.vue`
around lines 34 - 47, The computed property properties is mutating objects from
props.meta.properties[0].content (setting item.widget.props.modelValue) and also
accesses props.meta.widget.props?.modelValue without ensuring props.meta.widget
exists; change properties to produce a new array (use map) and deep-clone each
item before assigning modelValue so you don't mutate the original props, and
guard access to props.meta.widget (e.g., read
props.meta.widget?.props?.modelValue) when retrieving propsModelValue; update
references to the computed properties, props.meta.properties,
props.meta.widget.props.modelValue, and item.widget.props.modelValue while
making these changes.

Comment on lines +48 to +50
const itemChange = (property, value) => {
emit('update:modelValue', { ...props.meta.widget.props.modelValue, [property]: value })
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Missing null check can cause runtime error.

props.meta.widget.props.modelValue is accessed without null checks. If meta, widget, or props is undefined, this will throw a runtime error when itemChange is called.

Proposed fix
 const itemChange = (property, value) => {
-  emit('update:modelValue', { ...props.meta.widget.props.modelValue, [property]: value })
+  const currentModelValue = props.meta?.widget?.props?.modelValue || {}
+  emit('update:modelValue', { ...currentModelValue, [property]: value })
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const itemChange = (property, value) => {
emit('update:modelValue', { ...props.meta.widget.props.modelValue, [property]: value })
}
const itemChange = (property, value) => {
const currentModelValue = props.meta?.widget?.props?.modelValue || {}
emit('update:modelValue', { ...currentModelValue, [property]: value })
}
🤖 Prompt for AI Agents
In
`@packages/configurator/src/object-depth-configurator/ObjectDepthConfigurator.vue`
around lines 48 - 50, itemChange currently reads
props.meta.widget.props.modelValue without null checks which can throw if
meta/widget/props is undefined; update itemChange to safely access the nested
value (use optional chaining on props.meta?.widget?.props?.modelValue) and
default to an empty object before spreading, then emit the update as before
(reference itemChange and the emit('update:modelValue', ...) call).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant