Skip to content

Commit

Permalink
fix(vue) all props have defaults - potentially solves #14
Browse files Browse the repository at this point in the history
  • Loading branch information
stared committed Feb 21, 2020
1 parent 5c8689d commit 307e954
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/lib-components/coordinate-legend.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { Vue, Component, Prop } from 'vue-property-decorator';
export default class CoordinateLegend extends Vue {
@Prop({ default: 'polar' }) readonly complexStyle!: string
@Prop({ default: [] }) readonly dimensionNames!: string[]
@Prop({ default: () => [] }) readonly dimensionNames!: string[]
dimensionNameToColor(dimName: string): string {
switch (dimName) {
Expand Down
4 changes: 2 additions & 2 deletions src/lib-components/ket-viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<script lang="ts">
import { Vue, Component, Prop } from 'vue-property-decorator';
import {
Complex, Vector, VectorEntry, Basis,
Dimension, Complex, Vector, VectorEntry, Basis,
} from 'quantum-tensors';
import { coordPrettier } from '@/lib-components/utils';
import { hslToHex, TAU } from '@/lib-components/colors';
Expand Down Expand Up @@ -94,7 +94,7 @@ const allBasesDefault: IBasisSelector[] = [
})
export default class KetViewer extends Vue {
@Prop() readonly vector!: Vector
@Prop({ default: Vector.indicator([Dimension.qubit()], '0') }) readonly vector!: Vector
@Prop({ default: true }) readonly showLegend!: boolean
Expand Down
2 changes: 1 addition & 1 deletion src/lib-components/matrix-dimensions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { range } from '@/lib-components/utils';
export default class MatrixDimensions extends Vue {
@Prop({ default: () => 40 }) private size!: number
@Prop({ required: true }) private location!: string
@Prop({ required: true, default: 'top' }) private location!: string
@Prop({ default: () => [] }) private dimensionNames!: string[]
Expand Down
4 changes: 2 additions & 2 deletions src/lib-components/matrix-labels.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ export default class MatrixLabels extends Vue {
@Prop({ default: () => '' }) private axisLabel!: string
@Prop({ required: true }) private location!: string
@Prop({ required: true, default: 'top' }) private location!: string
@Prop({ required: true }) private coordNames!: string[][]
@Prop({ required: true, default: [[]] }) private coordNames!: string[][]
@Prop({ default: () => [] }) private selected!: number[]
Expand Down
4 changes: 2 additions & 2 deletions src/lib-components/matrix-viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Operator, Basis } from 'quantum-tensors';
import { Dimension, Operator, Basis } from 'quantum-tensors';
import { colorComplexPhaseToHue } from '@/lib-components/colors';
import { range } from '@/lib-components/utils';
import MatrixLabels from '@/lib-components/matrix-labels.vue';
Expand All @@ -131,7 +131,7 @@ interface IMatrixElement {
export default class MatrixViewer extends Vue {
@Prop({ default: () => 40 }) private size!: number
@Prop({ default: () => [[]] }) private operatorRaw!: Operator
@Prop({ default: () => Operator.identity([Dimension.qubit()]) }) private operatorRaw!: Operator
operator = this.operatorRaw; // copy?
Expand Down
2 changes: 1 addition & 1 deletion src/lib-components/view-button-group.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { Vue, Component, Prop } from 'vue-property-decorator';
export default class ViewButtonGroup extends Vue {
@Prop({ default: 'polar' }) readonly selectedOption!: string
@Prop({ default: () => ['polar', 'cartesian', 'color'] }) readonly options!: string[]
@Prop({ default: () => ['a', 'b', 'c'] }) readonly options!: string[]
}
</script>

Expand Down

0 comments on commit 307e954

Please sign in to comment.