Skip to content

Commit

Permalink
fix(components): [schema-form] placeholder typo
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Mar 8, 2022
1 parent 3fc4ae8 commit 3d9ea50
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 73 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"@types/lodash-es": "^4.17.6",
"@types/node": "^17.0.21",
"@types/webpack-env": "^1.16.3",
"@typescript-eslint/eslint-plugin": "^5.13.0",
"@typescript-eslint/parser": "^5.13.0",
"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"@vue/cli-plugin-babel": "^5.0.1",
"@vue/cli-plugin-eslint": "^5.0.1",
"@vue/cli-plugin-router": "^5.0.1",
Expand Down
5 changes: 1 addition & 4 deletions src/components/core/schema-form/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ export function createPlaceholderMessage(component: ComponentMapType, label = ''
'Switch',
'TreeSelect',
];
if (component.includes('Picker')) {
return `${t('common.inputText')}${label}`;
}
if (chooseTypes.includes(component)) {
if (component.includes('Picker') || chooseTypes.includes(component)) {
return `${t('common.chooseText')}${label}`;
}
return '';
Expand Down
29 changes: 10 additions & 19 deletions src/components/core/schema-form/schema-form-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import { useItemLabelWidth } from './hooks/useLabelWidth';
import { componentMap, ComponentMapType } from './componentMap';
import { createPlaceholderMessage } from './helper';
import { AllComponentProps } from './types';
import { useFormContext } from './hooks/useFormContext';
import type { Ref } from 'vue';
import type { FormItemSchema, FormSchema } from './types/form';
Expand Down Expand Up @@ -131,26 +130,18 @@
const { formModel, schemaItem } = props;
const { componentProps = {}, component, label = '' } = schemaItem;
if (isFunction(componentProps)) {
const compProps = componentProps({
formModel,
schemaFormRef,
schemaItem,
}) as AllComponentProps;
compProps.placeholder ??= isString(component)
? createPlaceholderMessage(component, label)
: undefined;
return compProps;
}
const _componentProps = isFunction(componentProps)
? componentProps({
formModel,
schemaFormRef,
schemaItem,
})
: { ...componentProps };
if (component !== 'RangePicker' && isString(component)) {
(componentProps as AllComponentProps).placeholder ??= createPlaceholderMessage(
component,
label,
);
_componentProps.placeholder ??= createPlaceholderMessage(component, label);
}
return componentProps as AllComponentProps;
return _componentProps;
});
/**
Expand Down
96 changes: 48 additions & 48 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1559,14 +1559,14 @@
semver "^7.3.5"
tsutils "^3.21.0"

"@typescript-eslint/eslint-plugin@^5.13.0":
version "5.13.0"
resolved "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.13.0.tgz#2809052b85911ced9c54a60dac10e515e9114497"
integrity sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==
dependencies:
"@typescript-eslint/scope-manager" "5.13.0"
"@typescript-eslint/type-utils" "5.13.0"
"@typescript-eslint/utils" "5.13.0"
"@typescript-eslint/eslint-plugin@^5.14.0":
version "5.14.0"
resolved "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.14.0.tgz#5119b67152356231a0e24b998035288a9cd21335"
integrity sha512-ir0wYI4FfFUDfLcuwKzIH7sMVA+db7WYen47iRSaCGl+HMAZI9fpBwfDo45ZALD3A45ZGyHWDNLhbg8tZrMX4w==
dependencies:
"@typescript-eslint/scope-manager" "5.14.0"
"@typescript-eslint/type-utils" "5.14.0"
"@typescript-eslint/utils" "5.14.0"
debug "^4.3.2"
functional-red-black-tree "^1.0.1"
ignore "^5.1.8"
Expand All @@ -1584,14 +1584,14 @@
"@typescript-eslint/typescript-estree" "5.12.0"
debug "^4.3.2"

"@typescript-eslint/parser@^5.13.0":
version "5.13.0"
resolved "https://registry.npmmirror.com/@typescript-eslint/parser/-/parser-5.13.0.tgz#0394ed8f2f849273c0bf4b811994d177112ced5c"
integrity sha512-GdrU4GvBE29tm2RqWOM0P5QfCtgCyN4hXICj/X9ibKED16136l9ZpoJvCL5pSKtmJzA+NRDzQ312wWMejCVVfg==
"@typescript-eslint/parser@^5.14.0":
version "5.14.0"
resolved "https://registry.npmmirror.com/@typescript-eslint/parser/-/parser-5.14.0.tgz#7c79f898aa3cff0ceee6f1d34eeed0f034fb9ef3"
integrity sha512-aHJN8/FuIy1Zvqk4U/gcO/fxeMKyoSv/rS46UXMXOJKVsLQ+iYPuXNbpbH7cBLcpSbmyyFbwrniLx5+kutu1pw==
dependencies:
"@typescript-eslint/scope-manager" "5.13.0"
"@typescript-eslint/types" "5.13.0"
"@typescript-eslint/typescript-estree" "5.13.0"
"@typescript-eslint/scope-manager" "5.14.0"
"@typescript-eslint/types" "5.14.0"
"@typescript-eslint/typescript-estree" "5.14.0"
debug "^4.3.2"

"@typescript-eslint/scope-manager@5.12.0":
Expand All @@ -1602,13 +1602,13 @@
"@typescript-eslint/types" "5.12.0"
"@typescript-eslint/visitor-keys" "5.12.0"

"@typescript-eslint/scope-manager@5.13.0":
version "5.13.0"
resolved "https://registry.npmmirror.com/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz#cf6aff61ca497cb19f0397eea8444a58f46156b6"
integrity sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==
"@typescript-eslint/scope-manager@5.14.0":
version "5.14.0"
resolved "https://registry.npmmirror.com/@typescript-eslint/scope-manager/-/scope-manager-5.14.0.tgz#ea518962b42db8ed0a55152ea959c218cb53ca7b"
integrity sha512-LazdcMlGnv+xUc5R4qIlqH0OWARyl2kaP8pVCS39qSL3Pd1F7mI10DbdXeARcE62sVQE4fHNvEqMWsypWO+yEw==
dependencies:
"@typescript-eslint/types" "5.13.0"
"@typescript-eslint/visitor-keys" "5.13.0"
"@typescript-eslint/types" "5.14.0"
"@typescript-eslint/visitor-keys" "5.14.0"

"@typescript-eslint/type-utils@5.12.0":
version "5.12.0"
Expand All @@ -1619,12 +1619,12 @@
debug "^4.3.2"
tsutils "^3.21.0"

"@typescript-eslint/type-utils@5.13.0":
version "5.13.0"
resolved "https://registry.npmmirror.com/@typescript-eslint/type-utils/-/type-utils-5.13.0.tgz#b0efd45c85b7bab1125c97b752cab3a86c7b615d"
integrity sha512-/nz7qFizaBM1SuqAKb7GLkcNn2buRdDgZraXlkhz+vUGiN1NZ9LzkA595tHHeduAiS2MsHqMNhE2zNzGdw43Yg==
"@typescript-eslint/type-utils@5.14.0":
version "5.14.0"
resolved "https://registry.npmmirror.com/@typescript-eslint/type-utils/-/type-utils-5.14.0.tgz#711f08105860b12988454e91df433567205a8f0b"
integrity sha512-d4PTJxsqaUpv8iERTDSQBKUCV7Q5yyXjqXUl3XF7Sd9ogNLuKLkxz82qxokqQ4jXdTPZudWpmNtr/JjbbvUixw==
dependencies:
"@typescript-eslint/utils" "5.13.0"
"@typescript-eslint/utils" "5.14.0"
debug "^4.3.2"
tsutils "^3.21.0"

Expand All @@ -1633,10 +1633,10 @@
resolved "https://registry.npmmirror.com/@typescript-eslint/types/-/types-5.12.0.tgz#5b4030a28222ee01e851836562c07769eecda0b8"
integrity sha512-JowqbwPf93nvf8fZn5XrPGFBdIK8+yx5UEGs2QFAYFI8IWYfrzz+6zqlurGr2ctShMaJxqwsqmra3WXWjH1nRQ==

"@typescript-eslint/types@5.13.0":
version "5.13.0"
resolved "https://registry.npmmirror.com/@typescript-eslint/types/-/types-5.13.0.tgz#da1de4ae905b1b9ff682cab0bed6b2e3be9c04e5"
integrity sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==
"@typescript-eslint/types@5.14.0":
version "5.14.0"
resolved "https://registry.npmmirror.com/@typescript-eslint/types/-/types-5.14.0.tgz#96317cf116cea4befabc0defef371a1013f8ab11"
integrity sha512-BR6Y9eE9360LNnW3eEUqAg6HxS9Q35kSIs4rp4vNHRdfg0s+/PgHgskvu5DFTM7G5VKAVjuyaN476LCPrdA7Mw==

"@typescript-eslint/typescript-estree@5.12.0":
version "5.12.0"
Expand All @@ -1651,13 +1651,13 @@
semver "^7.3.5"
tsutils "^3.21.0"

"@typescript-eslint/typescript-estree@5.13.0":
version "5.13.0"
resolved "https://registry.npmmirror.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz#b37c07b748ff030a3e93d87c842714e020b78141"
integrity sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==
"@typescript-eslint/typescript-estree@5.14.0":
version "5.14.0"
resolved "https://registry.npmmirror.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.14.0.tgz#78b7f7385d5b6f2748aacea5c9b7f6ae62058314"
integrity sha512-QGnxvROrCVtLQ1724GLTHBTR0lZVu13izOp9njRvMkCBgWX26PKvmMP8k82nmXBRD3DQcFFq2oj3cKDwr0FaUA==
dependencies:
"@typescript-eslint/types" "5.13.0"
"@typescript-eslint/visitor-keys" "5.13.0"
"@typescript-eslint/types" "5.14.0"
"@typescript-eslint/visitor-keys" "5.14.0"
debug "^4.3.2"
globby "^11.0.4"
is-glob "^4.0.3"
Expand All @@ -1676,15 +1676,15 @@
eslint-scope "^5.1.1"
eslint-utils "^3.0.0"

"@typescript-eslint/utils@5.13.0":
version "5.13.0"
resolved "https://registry.npmmirror.com/@typescript-eslint/utils/-/utils-5.13.0.tgz#2328feca700eb02837298339a2e49c46b41bd0af"
integrity sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==
"@typescript-eslint/utils@5.14.0":
version "5.14.0"
resolved "https://registry.npmmirror.com/@typescript-eslint/utils/-/utils-5.14.0.tgz#6c8bc4f384298cbbb32b3629ba7415f9f80dc8c4"
integrity sha512-EHwlII5mvUA0UsKYnVzySb/5EE/t03duUTweVy8Zqt3UQXBrpEVY144OTceFKaOe4xQXZJrkptCf7PjEBeGK4w==
dependencies:
"@types/json-schema" "^7.0.9"
"@typescript-eslint/scope-manager" "5.13.0"
"@typescript-eslint/types" "5.13.0"
"@typescript-eslint/typescript-estree" "5.13.0"
"@typescript-eslint/scope-manager" "5.14.0"
"@typescript-eslint/types" "5.14.0"
"@typescript-eslint/typescript-estree" "5.14.0"
eslint-scope "^5.1.1"
eslint-utils "^3.0.0"

Expand All @@ -1696,12 +1696,12 @@
"@typescript-eslint/types" "5.12.0"
eslint-visitor-keys "^3.0.0"

"@typescript-eslint/visitor-keys@5.13.0":
version "5.13.0"
resolved "https://registry.npmmirror.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz#f45ff55bcce16403b221ac9240fbeeae4764f0fd"
integrity sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==
"@typescript-eslint/visitor-keys@5.14.0":
version "5.14.0"
resolved "https://registry.npmmirror.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.14.0.tgz#1927005b3434ccd0d3ae1b2ecf60e65943c36986"
integrity sha512-yL0XxfzR94UEkjBqyymMLgCBdojzEuy/eim7N9/RIcTNxpJudAcqsU8eRyfzBbcEzGoPWfdM3AGak3cN08WOIw==
dependencies:
"@typescript-eslint/types" "5.13.0"
"@typescript-eslint/types" "5.14.0"
eslint-visitor-keys "^3.0.0"

"@vue/babel-helper-vue-jsx-merge-props@^1.2.1":
Expand Down

0 comments on commit 3d9ea50

Please sign in to comment.