diff --git a/docs/src/examples/QCircularProgress/Border.vue b/docs/src/examples/QCircularProgress/Border.vue new file mode 100644 index 00000000000..c318e5b636f --- /dev/null +++ b/docs/src/examples/QCircularProgress/Border.vue @@ -0,0 +1,61 @@ + + + diff --git a/docs/src/pages/vue-components/circular-progress.md b/docs/src/pages/vue-components/circular-progress.md index fca2436534e..a7150cea6af 100644 --- a/docs/src/pages/vue-components/circular-progress.md +++ b/docs/src/pages/vue-components/circular-progress.md @@ -35,4 +35,6 @@ In the example below, `show-value` property also enables the default slot, so yo + + diff --git a/ui/dev/src/pages/components/circular-progress.vue b/ui/dev/src/pages/components/circular-progress.vue index 8d8b190a303..ff1ec7b0b7b 100644 --- a/ui/dev/src/pages/components/circular-progress.vue +++ b/ui/dev/src/pages/components/circular-progress.vue @@ -11,6 +11,11 @@
Min/Max
+ +
Border Width
+ +
Border Color
+
@@ -31,6 +36,8 @@ :show-value="showValue" :indeterminate="indeterminate" :rounded="rounded" + :borderWidth="borderWidth" + :borderColor="borderColor" /> @@ -92,6 +105,8 @@ :reverse="reverse" :show-value="showValue" :indeterminate="indeterminate" + :borderWidth="borderWidth" + :borderColor="borderColor" track-color="grey-4" :rounded="rounded" color="orange" @@ -110,6 +125,8 @@ :show-value="showValue" :indeterminate="indeterminate" :rounded="rounded" + :borderWidth="borderWidth" + :borderColor="borderColor" color="orange" text-color="white" center-color="grey-8" @@ -134,7 +151,9 @@ export default { showValue: true, reverse: false, indeterminate: false, - rounded: false + rounded: false, + borderWidth: 0, + borderColor: 'secondary' } }, methods: { diff --git a/ui/src/components/circular-progress/QCircularProgress.js b/ui/src/components/circular-progress/QCircularProgress.js index 34298130739..7182337434a 100644 --- a/ui/src/components/circular-progress/QCircularProgress.js +++ b/ui/src/components/circular-progress/QCircularProgress.js @@ -65,6 +65,7 @@ export default createComponent({ )) const strokeWidth = computed(() => props.thickness / 2 * viewBox.value) + const borderWidth = computed(() => ((props.borderWidth > 0 && props.rounded === true) ? props.borderWidth : 0)) function getCircle ({ thickness, offset, color, cls, rounded }) { return h('circle', { @@ -104,10 +105,22 @@ export default createComponent({ }) ) + if (borderWidth.value > 0) { + svgChild.push( + getCircle({ + cls: 'circle', + thickness: strokeWidth.value, + offset: strokeDashOffset.value, + color: props.borderColor, + rounded: props.rounded === true ? 'round' : void 0 + }) + ) + } + svgChild.push( getCircle({ cls: 'circle', - thickness: strokeWidth.value, + thickness: strokeWidth.value - borderWidth.value, offset: strokeDashOffset.value, color: props.color, rounded: props.rounded === true ? 'round' : void 0 diff --git a/ui/src/components/circular-progress/QCircularProgress.json b/ui/src/components/circular-progress/QCircularProgress.json index b5af68df5a3..08e7e931082 100644 --- a/ui/src/components/circular-progress/QCircularProgress.json +++ b/ui/src/components/circular-progress/QCircularProgress.json @@ -57,6 +57,18 @@ "addedIn": "v2.8.4" }, + "borderWidth": { + "type": "Number", + "desc": "(Only works if rounded === true) Width of progress arc boundary", + "default": 0, + "category": "style" + }, + + "borderColor": { + "extends": "color", + "desc": "Color name for the the arc progress boundary from the Quasar Color Palette" + }, + "thickness": { "type": "Number", "default": 0.2, diff --git a/ui/src/components/circular-progress/use-circular-progress.js b/ui/src/components/circular-progress/use-circular-progress.js index fde698f5f2a..a3792e5cdce 100644 --- a/ui/src/components/circular-progress/use-circular-progress.js +++ b/ui/src/components/circular-progress/use-circular-progress.js @@ -19,6 +19,11 @@ export const useCircularCommonProps = { fontSize: String, rounded: Boolean, + borderWidth: { + type: Number, + default: 0 + }, + borderColor: String, // ratio thickness: {