KeystoneJS 5 AdminUI 中是否可以 show/hide 字段?
Is it possible to show/hide fields in the KeystoneJS 5 AdminUI?
基本上如标题所说 -- 我们正在开展一个项目,我们希望能够根据其他字段的值显示和隐藏各种字段。这似乎是 possible in KeystoneJS 4 但我在 KeystoneJS 5 中没有看到它的提及。
dependsOn
keystoneJs v4 的功能尚未进入最新的 KeystoneJs 迭代。 v5(我们这样称呼它)是完全重写的,没有 v4 的许多功能。
然而,有一个 Pull Request 可能会添加此功能,但不幸的是,这不是核心团队的优先事项,他们尚未对 PR 作出回应。
一旦 PR 被合并,你就可以做这样的事情
keystone.createList('Test field', {
fields: {
price: { type: Decimal, symbol: '$' },
currency: { type: Text, dependsOn: { $lt: { price: 3 } } },
hero: { type: File, adapter: fileAdapter, dependsOn: { $gt: { price: 3 } } },
markdownValue: { type: Markdown, dependsOn: { $gt: { price: 6 } } },
fortyTwo: {
type: Virtual,
graphQLReturnType: `Int`,
resolver: () => 42,
},
}});
基本上如标题所说 -- 我们正在开展一个项目,我们希望能够根据其他字段的值显示和隐藏各种字段。这似乎是 possible in KeystoneJS 4 但我在 KeystoneJS 5 中没有看到它的提及。
dependsOn
keystoneJs v4 的功能尚未进入最新的 KeystoneJs 迭代。 v5(我们这样称呼它)是完全重写的,没有 v4 的许多功能。
然而,有一个 Pull Request 可能会添加此功能,但不幸的是,这不是核心团队的优先事项,他们尚未对 PR 作出回应。
一旦 PR 被合并,你就可以做这样的事情
keystone.createList('Test field', {
fields: {
price: { type: Decimal, symbol: '$' },
currency: { type: Text, dependsOn: { $lt: { price: 3 } } },
hero: { type: File, adapter: fileAdapter, dependsOn: { $gt: { price: 3 } } },
markdownValue: { type: Markdown, dependsOn: { $gt: { price: 6 } } },
fortyTwo: {
type: Virtual,
graphQLReturnType: `Int`,
resolver: () => 42,
},
}});