Skip to content

Commit

Permalink
fix: by comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shamilfrontend committed May 20, 2022
1 parent 645de30 commit 4dca612
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
7 changes: 7 additions & 0 deletions src/qComponents/QFormItem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ export const QFormItem = withInstall(FormItem);

export type {
QFormItemProps,
QFormItemPropFor,
QFormItemPropProp,
QFormItemPropLabel,
QFormItemPropSublabel,
QFormItemPropError,
QFormItemPropRules,
QFormItemPropShowErrorMessage,
QFormItemPropLabelSize,
QFormItemContext,
QFormItemProvider,
QFormItemInstance
Expand Down
7 changes: 2 additions & 5 deletions src/qComponents/QFormItem/src/QFormItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import type { PropType } from 'vue';
import { validateArray } from '@/qComponents/helpers';
import type { QFormProvider } from '@/qComponents/QForm';
import type { Nullable, Optional, ClassValue } from '#/helpers';
import type { Nullable, ClassValue } from '#/helpers';
import type {
QFormItemProps,
Expand Down Expand Up @@ -155,10 +155,7 @@ export default defineComponent({
)
);
const labelFor = computed<Optional<string>>(() => {
if (!props.for || !props.prop) return undefined;
return props.for ?? props.prop;
});
const labelFor = computed<string>(() => props.for ?? props.prop ?? '');
const propRules = computed<FilteredRuleItem[]>(() => {
const rules =
Expand Down
6 changes: 3 additions & 3 deletions src/qComponents/QFormItem/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
} from 'async-validator';
import type { Ref, ComputedRef } from 'vue';

import type { Nullable, Optional, Enumerable, ClassValue } from '#/helpers';
import type { Nullable, Enumerable, ClassValue } from '#/helpers';

export interface FilteredRuleItem extends RuleItem {
trigger?: Nullable<string>;
Expand Down Expand Up @@ -45,7 +45,7 @@ export interface QFormItemContext {
isErrorSlotShown: ComputedRef<boolean>;
isHeaderShown: ComputedRef<boolean>;
isRequired: ComputedRef<boolean>;
labelFor: ComputedRef<Optional<string>>;
labelFor: ComputedRef<string>;
resetField: () => void;
rootClasses: ComputedRef<ClassValue>;
rules: Nullable<FilteredRuleItem | FilteredRuleItem[]>;
Expand All @@ -69,7 +69,7 @@ export interface QFormItemProvider {
export interface QFormItemInstance {
errorMessage: Ref<Nullable<string>>;
isErrorSlotShown: ComputedRef<boolean>;
labelFor: ComputedRef<Optional<string>>;
labelFor: ComputedRef<string>;
isRequired: ComputedRef<boolean>;
isHeaderShown: ComputedRef<boolean>;
rootClasses: ComputedRef<ClassValue>;
Expand Down

0 comments on commit 4dca612

Please sign in to comment.