feat(plugin-multi-tenant): allow tenant field overrides (#13316)

Allows user to override more of the tenant field config. Now you can
override most of the field config with:

### At the root level
```ts
/**
 * Field configuration for the field added to all tenant enabled collections
 */
tenantField?: RootTenantFieldConfigOverrides
```

### At the collection level
Setting collection level overrides will replace the root level overrides
shown above.

```ts
collections: {
  [key in CollectionSlug]?: {
    // ... rest of the types
    /**
     * Overrides for the tenant field, will override the entire tenantField configuration
     */
    tenantFieldOverrides?: CollectionTenantFieldConfigOverrides
  }
}
```
This commit is contained in:
Jarrod Flesch
2025-08-12 11:33:29 -04:00
committed by GitHub
parent 306b7f6943
commit 995f96bc70
52 changed files with 478 additions and 303 deletions

View File

@@ -92,7 +92,9 @@ export const TenantSelector = ({ label, viewType }: { label: string; viewType?:
<div className="tenant-selector">
<SelectInput
isClearable={viewType === 'list'}
label={getTranslation(label, i18n)}
label={
label ? getTranslation(label, i18n) : t('plugin-multi-tenant:nav-tenantSelector-label')
}
name="setTenant"
onChange={onChange}
options={options}
@@ -110,7 +112,7 @@ export const TenantSelector = ({ label, viewType }: { label: string; viewType?:
}}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
i18nKey="plugin-multi-tenant:confirm-tenant-switch--body"
i18nKey="plugin-multi-tenant:confirm-modal-tenant-switch--body"
t={t}
variables={{
fromTenant: selectedValue?.label,
@@ -118,8 +120,10 @@ export const TenantSelector = ({ label, viewType }: { label: string; viewType?:
}}
/>
}
heading={t('plugin-multi-tenant:confirm-tenant-switch--heading', {
tenantLabel: getTranslation(label, i18n),
heading={t('plugin-multi-tenant:confirm-modal-tenant-switch--heading', {
tenantLabel: label
? getTranslation(label, i18n)
: t('plugin-multi-tenant:nav-tenantSelector-label'),
})}
modalSlug={confirmSwitchTenantSlug}
onConfirm={() => {

View File

@@ -1,2 +1 @@
export { tenantField } from '../fields/tenantField/index.js'
export { tenantsArrayField } from '../fields/tenantsArrayField/index.js'

View File

@@ -1,65 +1,83 @@
import { type RelationshipField } from 'payload'
import type { RelationshipFieldSingleValidation, SingleRelationshipField } from 'payload'
import { APIError } from 'payload'
import type { RootTenantFieldConfigOverrides } from '../../types.js'
import { defaults } from '../../defaults.js'
import { getCollectionIDType } from '../../utilities/getCollectionIDType.js'
import { getTenantFromCookie } from '../../utilities/getTenantFromCookie.js'
type Args = {
access?: RelationshipField['access']
debug?: boolean
name: string
overrides?: RootTenantFieldConfigOverrides
tenantsCollectionSlug: string
unique: boolean
}
export const tenantField = ({
name = defaults.tenantFieldName,
access = undefined,
debug,
overrides: _overrides = {},
tenantsCollectionSlug = defaults.tenantCollectionSlug,
unique,
}: Args): RelationshipField => ({
name,
type: 'relationship',
access,
admin: {
allowCreate: false,
allowEdit: false,
components: {
Field: {
clientProps: {
debug,
unique,
}: Args): SingleRelationshipField => {
const { validate, ...overrides } = _overrides || {}
return {
...(overrides || {}),
name,
type: 'relationship',
access: overrides?.access || {},
admin: {
allowCreate: false,
allowEdit: false,
disableListColumn: true,
disableListFilter: true,
...(overrides?.admin || {}),
components: {
...(overrides?.admin?.components || {}),
Field: {
path: '@payloadcms/plugin-multi-tenant/client#TenantField',
...(typeof overrides?.admin?.components?.Field !== 'string'
? overrides?.admin?.components?.Field || {}
: {}),
clientProps: {
...(typeof overrides?.admin?.components?.Field !== 'string'
? (overrides?.admin?.components?.Field || {})?.clientProps
: {}),
debug,
unique,
},
},
path: '@payloadcms/plugin-multi-tenant/client#TenantField',
},
},
disableListColumn: true,
disableListFilter: true,
},
hasMany: false,
hooks: {
beforeChange: [
({ req, value }) => {
const idType = getCollectionIDType({
collectionSlug: tenantsCollectionSlug,
payload: req.payload,
})
if (!value) {
const tenantFromCookie = getTenantFromCookie(req.headers, idType)
if (tenantFromCookie) {
return tenantFromCookie
hasMany: false,
hooks: {
...(overrides.hooks || []),
beforeChange: [
({ req, value }) => {
const idType = getCollectionIDType({
collectionSlug: tenantsCollectionSlug,
payload: req.payload,
})
if (!value) {
const tenantFromCookie = getTenantFromCookie(req.headers, idType)
if (tenantFromCookie) {
return tenantFromCookie
}
throw new APIError('You must select a tenant', 400, null, true)
}
throw new APIError('You must select a tenant', 400, null, true)
}
return idType === 'number' ? parseFloat(value) : value
},
],
},
index: true,
// @ts-expect-error translations are not typed for this plugin
label: ({ t }) => t('plugin-multi-tenant:field-assignedTentant-label'),
relationTo: tenantsCollectionSlug,
unique,
})
return idType === 'number' ? parseFloat(value) : value
},
...(overrides?.hooks?.beforeChange || []),
],
},
index: true,
validate: (validate as RelationshipFieldSingleValidation) || undefined,
// @ts-expect-error translations are not typed for this plugin
label: overrides?.label || (({ t }) => t('plugin-multi-tenant:field-assignedTenant-label')),
relationTo: tenantsCollectionSlug,
unique,
}
}

View File

@@ -40,7 +40,6 @@ export const multiTenantPlugin =
pluginConfig?.tenantsArrayField?.arrayFieldName || defaults.tenantsArrayFieldName
const tenantsArrayTenantFieldName =
pluginConfig?.tenantsArrayField?.arrayTenantFieldName || defaults.tenantsArrayTenantFieldName
const tenantSelectorLabel = pluginConfig.tenantSelectorLabel || defaults.tenantSelectorLabel
const basePath = pluginConfig.basePath || defaults.basePath
/**
@@ -69,37 +68,6 @@ export const multiTenantPlugin =
incomingConfig.collections = []
}
/**
* Add tenant selector localized labels
*/
if (typeof tenantSelectorLabel === 'object') {
if (!incomingConfig.i18n) {
incomingConfig.i18n = {}
}
Object.entries(tenantSelectorLabel).forEach(([_locale, label]) => {
const locale = _locale as AcceptedLanguages
if (!incomingConfig.i18n) {
incomingConfig.i18n = {}
}
if (!incomingConfig.i18n.translations) {
incomingConfig.i18n.translations = {}
}
if (!(locale in incomingConfig.i18n.translations)) {
incomingConfig.i18n.translations[locale] = {}
}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
if (!('multiTenant' in incomingConfig.i18n.translations[locale])) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
incomingConfig.i18n.translations[locale].multiTenant = {}
}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
incomingConfig.i18n.translations[locale].multiTenant.selectorLabel = label
})
}
/**
* Add tenants array field to users collection
*/
@@ -284,6 +252,10 @@ export const multiTenantPlugin =
tenantsCollectionSlug,
})
const overrides = pluginConfig.collections[collection.slug]?.tenantFieldOverrides
? pluginConfig.collections[collection.slug]?.tenantFieldOverrides
: pluginConfig.tenantField || {}
/**
* Add tenant field to enabled collections
*/
@@ -291,9 +263,9 @@ export const multiTenantPlugin =
0,
0,
tenantField({
...(pluginConfig?.tenantField || {}),
name: tenantFieldName,
debug: pluginConfig.debug,
overrides,
tenantsCollectionSlug,
unique: isGlobal,
}),
@@ -382,7 +354,7 @@ export const multiTenantPlugin =
*/
incomingConfig.admin.components.beforeNavLinks.push({
clientProps: {
label: tenantSelectorLabel,
label: pluginConfig.tenantSelectorLabel || undefined,
},
path: '@payloadcms/plugin-multi-tenant/client#TenantSelector',
})
@@ -390,22 +362,30 @@ export const multiTenantPlugin =
/**
* Merge plugin translations
*/
const simplifiedTranslations = Object.entries(translations).reduce(
(acc, [key, value]) => {
acc[key] = value.translations
return acc
},
{} as Record<string, PluginDefaultTranslationsObject>,
)
incomingConfig.i18n = {
...incomingConfig.i18n,
translations: deepMergeSimple(
simplifiedTranslations,
incomingConfig.i18n?.translations ?? {},
),
if (!incomingConfig.i18n) {
incomingConfig.i18n = {}
}
Object.entries(translations).forEach(([locale, pluginI18nObject]) => {
const typedLocale = locale as AcceptedLanguages
if (!incomingConfig.i18n!.translations) {
incomingConfig.i18n!.translations = {}
}
if (!(typedLocale in incomingConfig.i18n!.translations)) {
incomingConfig.i18n!.translations[typedLocale] = {}
}
if (!('plugin-multi-tenant' in incomingConfig.i18n!.translations[typedLocale]!)) {
;(incomingConfig.i18n!.translations[typedLocale] as PluginDefaultTranslationsObject)[
'plugin-multi-tenant'
] = {} as PluginDefaultTranslationsObject['plugin-multi-tenant']
}
;(incomingConfig.i18n!.translations[typedLocale] as PluginDefaultTranslationsObject)[
'plugin-multi-tenant'
] = {
...pluginI18nObject.translations['plugin-multi-tenant'],
...(pluginConfig.i18n?.translations?.[typedLocale] || {}),
}
})
return incomingConfig
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const arTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'confirm-modal-tenant-switch--body':
'أنت على وشك تغيير الملكية من <0>{{fromTenant}}</0> إلى <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'تأكيد تغيير {{tenantLabel}}',
'field-assignedTentant-label': 'المستأجر المعين',
'confirm-modal-tenant-switch--heading': 'تأكيد تغيير {{tenantLabel}}',
'field-assignedTenant-label': 'المستأجر المعين',
'nav-tenantSelector-label': 'المستأجر',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const azTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Siz <0>{{fromTenant}}</0> mülkiyyətini <0>{{toTenant}}</0> mülkiyyəti dəyişdirəcəksiniz.',
'confirm-tenant-switch--heading': '{{tenantLabel}} dəyişikliyini təsdiqləyin',
'field-assignedTentant-label': 'Təyin edilmiş İcarəçi',
'confirm-modal-tenant-switch--body':
'Siz <0>{{fromTenant}}</0>-dən <0>{{toTenant}}</0>-a mülkiyyəti dəyişməyə hazırlaşırsınız',
'confirm-modal-tenant-switch--heading': '{{tenantLabel}} dəyişikliyini təsdiqləyin',
'field-assignedTenant-label': 'Təyin edilmiş İcarəçi',
'nav-tenantSelector-label': 'Kirayəçi',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const bgTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'confirm-modal-tenant-switch--body':
'Предстои да промените собствеността от <0>{{fromTenant}}</0> на <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Потвърдете промяната на {{tenantLabel}}',
'field-assignedTentant-label': 'Назначен наемател',
'confirm-modal-tenant-switch--heading': 'Потвърждаване на промяна в {{tenantLabel}}',
'field-assignedTenant-label': 'Назначен наемател',
'nav-tenantSelector-label': 'Потребител',
},
}

View File

@@ -0,0 +1,16 @@
import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.js'
export const bnBdTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-modal-tenant-switch--body':
'আপনি <0>{{fromTenant}}</0> থেকে <0>{{toTenant}}</0> তে মালিকানা পরিবর্তন করতে চলেছেন।',
'confirm-modal-tenant-switch--heading': '{{tenantLabel}} পরিবর্তন নিশ্চিত করুন',
'field-assignedTenant-label': 'নির্ধারিত টেনেন্ট',
'nav-tenantSelector-label': 'ভাড়াটিয়া',
},
}
export const bnBd: PluginLanguage = {
dateFNSKey: 'bn-BD',
translations: bnBdTranslations,
}

View File

@@ -0,0 +1,16 @@
import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.js'
export const bnInTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-modal-tenant-switch--body':
'আপনি স্বত্বাধিকার পরিবর্তন করতে চলেছেন <0>{{fromTenant}}</0> থেকে <0>{{toTenant}}</0> এ।',
'confirm-modal-tenant-switch--heading': '{{tenantLabel}} পরিবর্তন নিশ্চিত করুন',
'field-assignedTenant-label': 'নির্ধারিত টেনেন্ট',
'nav-tenantSelector-label': 'ভাড়াটিয়া',
},
}
export const bnIn: PluginLanguage = {
dateFNSKey: 'bn-IN',
translations: bnInTranslations,
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const caTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Estàs a punt de canviar la propietat de <0>{{fromTenant}}</0> a <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Confirmeu el canvi de {{tenantLabel}}',
'field-assignedTentant-label': 'Llogater Assignat',
'confirm-modal-tenant-switch--body':
'Està a punt de canviar la propietat de <0>{{fromTenant}}</0> a <0>{{toTenant}}</0>',
'confirm-modal-tenant-switch--heading': 'Confirmeu el canvi de {{tenantLabel}}',
'field-assignedTenant-label': 'Llogater Assignat',
'nav-tenantSelector-label': 'Inquilí',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const csTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'confirm-modal-tenant-switch--body':
'Chystáte se změnit vlastnictví z <0>{{fromTenant}}</0> na <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Potvrďte změnu {{tenantLabel}}',
'field-assignedTentant-label': 'Přiřazený nájemce',
'confirm-modal-tenant-switch--heading': 'Potvrďte změnu {{tenantLabel}}',
'field-assignedTenant-label': 'Přiřazený nájemce',
'nav-tenantSelector-label': 'Nájemce',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const daTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Du er ved at ændre ejerskab fra <0>{{fromTenant}}</0> til <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Bekræft {{tenantLabel}} ændring',
'field-assignedTentant-label': 'Tildelt Lejer',
'confirm-modal-tenant-switch--body':
'Du er ved at skifte ejerskab fra <0>{{fromTenant}}</0> til <0>{{toTenant}}</0>',
'confirm-modal-tenant-switch--heading': 'Bekræft ændring af {{tenantLabel}}',
'field-assignedTenant-label': 'Tildelt Lejer',
'nav-tenantSelector-label': 'Lejer',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const deTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Sie sind dabei, den Besitz von <0>{{fromTenant}}</0> auf <0>{{toTenant}}</0> zu übertragen.',
'confirm-tenant-switch--heading': 'Bestätigen Sie die Änderung von {{tenantLabel}}.',
'field-assignedTentant-label': 'Zugewiesener Mandant',
'confirm-modal-tenant-switch--body':
'Sie sind dabei, den Besitz von <0>{{fromTenant}}</0> zu <0>{{toTenant}}</0> zu ändern.',
'confirm-modal-tenant-switch--heading': 'Bestätigung der Änderung von {{tenantLabel}}',
'field-assignedTenant-label': 'Zugewiesener Mandant',
'nav-tenantSelector-label': 'Mieter',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginLanguage } from '../types.js'
export const enTranslations = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'confirm-modal-tenant-switch--body':
'You are about to change ownership from <0>{{fromTenant}}</0> to <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Confirm {{tenantLabel}} change',
'field-assignedTentant-label': 'Assigned Tenant',
'confirm-modal-tenant-switch--heading': 'Confirm {{tenantLabel}} change',
'field-assignedTenant-label': 'Assigned Tenant',
'nav-tenantSelector-label': 'Tenant',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const esTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'confirm-modal-tenant-switch--body':
'Está a punto de cambiar la propiedad de <0>{{fromTenant}}</0> a <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Confirme el cambio de {{tenantLabel}}',
'field-assignedTentant-label': 'Inquilino Asignado',
'confirm-modal-tenant-switch--heading': 'Confirme el cambio de {{tenantLabel}}',
'field-assignedTenant-label': 'Inquilino Asignado',
'nav-tenantSelector-label': 'Inquilino',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const etTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Te olete tegemas omandiõiguse muudatust <0>{{fromTenant}}</0>lt <0>{{toTenant}}</0>le.',
'confirm-tenant-switch--heading': 'Kinnita {{tenantLabel}} muutus',
'field-assignedTentant-label': 'Määratud üürnik',
'confirm-modal-tenant-switch--body':
'Te olete just muutmas omandiõigust <0>{{fromTenant}}</0> -lt <0>{{toTenant}}</0> -le.',
'confirm-modal-tenant-switch--heading': 'Kinnita {{tenantLabel}} muutus',
'field-assignedTenant-label': 'Määratud üürnik',
'nav-tenantSelector-label': 'Üürnik',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const faTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'شما در حال تغییر مالکیت از <0>{{fromTenant}}</0> به <0>{{toTenant}}</0> هستید',
'confirm-tenant-switch--heading': ایید تغییر {{tenantLabel}}',
'field-assignedTentant-label': 'مستاجر اختصاص یافته',
'confirm-modal-tenant-switch--body':
'شما در حال تغییر مالکیت از <0>{{fromTenant}}</0> به <0>{{toTenant}}</0> هستید.',
'confirm-modal-tenant-switch--heading': أیید تغییر {{tenantLabel}}',
'field-assignedTenant-label': 'مستاجر اختصاص یافته',
'nav-tenantSelector-label': 'مستاجر',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const frTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'confirm-modal-tenant-switch--body':
'Vous êtes sur le point de changer la propriété de <0>{{fromTenant}}</0> à <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Confirmer le changement de {{tenantLabel}}',
'field-assignedTentant-label': 'Locataire Attribué',
'confirm-modal-tenant-switch--heading': 'Confirmer le changement de {{tenantLabel}}',
'field-assignedTenant-label': 'Locataire Attribué',
'nav-tenantSelector-label': 'Locataire',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const heTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'confirm-modal-tenant-switch--body':
'אתה עומד לשנות בעלות מ- <0>{{fromTenant}}</0> ל- <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'אשר שינוי {{tenantLabel}}',
'field-assignedTentant-label': 'דייר מוקצה',
'confirm-modal-tenant-switch--heading': 'אשר שינוי {{tenantLabel}}',
'field-assignedTenant-label': 'דייר מוקצה',
'nav-tenantSelector-label': 'דייר',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const hrTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Upravo ćete promijeniti vlasništvo sa <0>{{fromTenant}}</0> na <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Potvrdi promjenu {{tenantLabel}}',
'field-assignedTentant-label': 'Dodijeljeni stanar',
'confirm-modal-tenant-switch--body':
'Na rubu ste promjene vlasništva iz <0>{{fromTenant}}</0> u <0>{{toTenant}}</0>',
'confirm-modal-tenant-switch--heading': 'Potvrdite promjenu {{tenantLabel}}',
'field-assignedTenant-label': 'Dodijeljeni stanar',
'nav-tenantSelector-label': 'Podstanar',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const huTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Ön azon van, hogy megváltoztassa a tulajdonjogot <0>{{fromTenant}}</0>-ről <0>{{toTenant}}</0>-re.',
'confirm-tenant-switch--heading': 'Erősítse meg a(z) {{tenantLabel}} változtatást',
'field-assignedTentant-label': 'Kijelölt Bérlő',
'confirm-modal-tenant-switch--body':
'Közel áll ahhoz, hogy megváltoztassa a tulajdongot <0>{{fromTenant}}</0> -ból <0>{{toTenant}}</0> -ba.',
'confirm-modal-tenant-switch--heading': 'Erősítse meg a {{tenantLabel}} változást',
'field-assignedTenant-label': 'Kijelölt Bérlő',
'nav-tenantSelector-label': 'Bérlő',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const hyTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Դուք պատրաստ եք փոխել գերեցդիմատնին ընկերությունը <0>{{fromTenant}}</0>-ից <0>{{toTenant}}</0>-ին',
'confirm-tenant-switch--heading': 'Հաստատեք {{tenantLabel}} փոփոխությունը',
'field-assignedTentant-label': 'Հանձնարարված վարձակալ',
'confirm-modal-tenant-switch--body':
'Դուք պատրաստվում եք փոխել սեփականությունը <0>{{fromTenant}}</0>-ից <0>{{toTenant}}</0>-ին:',
'confirm-modal-tenant-switch--heading': 'Հաստատեք {{tenantLabel}}֊ի փոփոխությունը',
'field-assignedTenant-label': 'Հանձնարարված վարձակալ',
'nav-tenantSelector-label': 'Տենանտ',
},
}

View File

@@ -0,0 +1,16 @@
import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.js'
export const idTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-modal-tenant-switch--body':
'Anda akan mengubah kepemilikan dari <0>{{fromTenant}}</0> ke <0>{{toTenant}}</0>',
'confirm-modal-tenant-switch--heading': 'Konfirmasi perubahan {{tenantLabel}}',
'field-assignedTenant-label': 'Penyewa yang Ditugaskan',
'nav-tenantSelector-label': 'Penyewa',
},
}
export const id: PluginLanguage = {
dateFNSKey: 'id',
translations: idTranslations,
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const itTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Stai per cambiare proprietà da <0>{{fromTenant}}</0> a <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Conferma il cambiamento di {{tenantLabel}}',
'field-assignedTentant-label': 'Inquilino Assegnato',
'confirm-modal-tenant-switch--body':
'Stai per cambiare il possesso da <0>{{fromTenant}}</0> a <0>{{toTenant}}</0>',
'confirm-modal-tenant-switch--heading': 'Conferma il cambiamento di {{tenantLabel}}',
'field-assignedTenant-label': 'Inquilino Assegnato',
'nav-tenantSelector-label': 'Inquilino',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const jaTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'あなたは所有権を<0>{{fromTenant}}</0>から<0>{{toTenant}}</0>へ変更しようとしています',
'confirm-tenant-switch--heading': '{{tenantLabel}}の変更を確認してください',
'field-assignedTentant-label': '割り当てられたテナント',
'confirm-modal-tenant-switch--body':
'あなたは<0>{{fromTenant}}</0>から<0>{{toTenant}}</0>への所有権を変更しようとしています',
'confirm-modal-tenant-switch--heading': '{{tenantLabel}}の変更を確認します',
'field-assignedTenant-label': '割り当てられたテナント',
'nav-tenantSelector-label': 'テナント',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const koTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'<0>{{fromTenant}}</0>에서 <0>{{toTenant}}</0>로 소유권을 변경하려고 합니다.',
'confirm-tenant-switch--heading': '{{tenantLabel}} 변경 확인하세요',
'field-assignedTentant-label': '지정된 세입자',
'confirm-modal-tenant-switch--body':
'<0>{{fromTenant}}</0>에서 <0>{{toTenant}}</0>로 소유권을 변경하려고 합니다.',
'confirm-modal-tenant-switch--heading': '{{tenantLabel}} 변경 확인',
'field-assignedTenant-label': '지정된 세입자',
'nav-tenantSelector-label': '세입자',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const ltTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Jūs ketinate pakeisti nuosavybės teisę iš <0>{{fromTenant}}</0> į <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Patvirtinkite {{tenantLabel}} pakeitimą',
'field-assignedTentant-label': 'Paskirtas nuomininkas',
'confirm-modal-tenant-switch--body':
'Jūs ketinate pakeisti nuosavybę iš <0>{{fromTenant}}</0> į <0>{{toTenant}}</0>',
'confirm-modal-tenant-switch--heading': 'Patvirtinkite {{tenantLabel}} pakeitimą',
'field-assignedTenant-label': 'Paskirtas nuomininkas',
'nav-tenantSelector-label': 'Nuomininkas',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const lvTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'confirm-modal-tenant-switch--body':
'Jūs gatavojaties mainīt īpašumtiesības no <0>{{fromTenant}}</0> uz <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Apstipriniet {{tenantLabel}} izmaiņu',
'field-assignedTentant-label': 'Piešķirts īrnieks',
'confirm-modal-tenant-switch--heading': 'Apstipriniet {{tenantLabel}} izmaiņu',
'field-assignedTenant-label': 'Piešķirts nomnieks',
'nav-tenantSelector-label': 'Nomnieks',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const myTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Anda akan mengubah pemilikan dari <0>{{fromTenant}}</0> ke <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Sahkan perubahan {{tenantLabel}}',
'field-assignedTentant-label': 'ခွဲစိုက်ထားသော အငှားယူသူ',
'confirm-modal-tenant-switch--body':
'Anda akan menukar pemilikan dari <0>{{fromTenant}}</0> kepada <0>{{toTenant}}</0>',
'confirm-modal-tenant-switch--heading': 'Sahkan perubahan {{tenantLabel}}',
'field-assignedTenant-label': 'ခွဲစိုက်ထားသော အငှားယူသူ',
'nav-tenantSelector-label': 'Penyewa',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const nbTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'confirm-modal-tenant-switch--body':
'Du er i ferd med å endre eierskap fra <0>{{fromTenant}}</0> til <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Bekreft {{tenantLabel}} endring',
'field-assignedTentant-label': 'Tildelt leietaker',
'confirm-modal-tenant-switch--heading': 'Bekreft endring av {{tenantLabel}}',
'field-assignedTenant-label': 'Tildelt leietaker',
'nav-tenantSelector-label': 'Leietaker',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const nlTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'U staat op het punt het eigendom te wijzigen van <0>{{fromTenant}}</0> naar <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Bevestig wijziging van {{tenantLabel}}',
'field-assignedTentant-label': 'Toegewezen Huurder',
'confirm-modal-tenant-switch--body':
'U staat op het punt om eigenaarschap te wijzigen van <0>{{fromTenant}}</0> naar <0>{{toTenant}}</0>',
'confirm-modal-tenant-switch--heading': 'Bevestig wijziging van {{tenantLabel}}',
'field-assignedTenant-label': 'Toegewezen Huurder',
'nav-tenantSelector-label': 'Huurder',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const plTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'confirm-modal-tenant-switch--body':
'Za chwilę nastąpi zmiana właściciela z <0>{{fromTenant}}</0> na <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Potwierdź zmianę {{tenantLabel}}',
'field-assignedTentant-label': 'Przypisany Najemca',
'confirm-modal-tenant-switch--heading': 'Potwierdź zmianę {{tenantLabel}}',
'field-assignedTenant-label': 'Przypisany Najemca',
'nav-tenantSelector-label': 'Najemca',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const ptTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Você está prestes a alterar a propriedade de <0>{{fromTenant}}</0> para <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Confirme a alteração de {{tenantLabel}}',
'field-assignedTentant-label': 'Inquilino Atribuído',
'confirm-modal-tenant-switch--body':
'Está prestes a mudar a propriedade de <0>{{fromTenant}}</0> para <0>{{toTenant}}</0>',
'confirm-modal-tenant-switch--heading': 'Confirme a alteração do {{tenantLabel}}',
'field-assignedTenant-label': 'Inquilino Atribuído',
'nav-tenantSelector-label': 'Inquilino',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const roTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Sunteți pe punctul de a schimba proprietatea de la <0>{{fromTenant}}</0> la <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Confirmați schimbarea {{tenantLabel}}',
'field-assignedTentant-label': 'Locatar Atribuit',
'confirm-modal-tenant-switch--body':
'Sunteți pe cale să schimbați proprietatea de la <0>{{fromTenant}}</0> la <0>{{toTenant}}</0>',
'confirm-modal-tenant-switch--heading': 'Confirmați modificarea {{tenantLabel}}',
'field-assignedTenant-label': 'Locatar Atribuit',
'nav-tenantSelector-label': 'Locatar',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const rsTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Upravo ćete promeniti vlasništvo sa <0>{{fromTenant}}</0> na <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Potvrdi promena {{tenantLabel}}',
'field-assignedTentant-label': 'Dodeljen stanar',
'confirm-modal-tenant-switch--body':
'Na putu ste da promenite vlasništvo od <0>{{fromTenant}}</0> do <0>{{toTenant}}</0>',
'confirm-modal-tenant-switch--heading': 'Potvrdite promenu {{tenantLabel}}',
'field-assignedTenant-label': 'Dodeljen stanar',
'nav-tenantSelector-label': 'Podstanar',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const rsLatinTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'confirm-modal-tenant-switch--body':
'Uskoro ćete promeniti vlasništvo sa <0>{{fromTenant}}</0> na <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Potvrdite promenu {{tenantLabel}}',
'field-assignedTentant-label': 'Dodeljen stanar',
'confirm-modal-tenant-switch--heading': 'Potvrdite promenu {{tenantLabel}}',
'field-assignedTenant-label': 'Dodeljen stanar',
'nav-tenantSelector-label': 'Podstanar',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const ruTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'confirm-modal-tenant-switch--body':
'Вы собираетесь изменить владельца с <0>{{fromTenant}}</0> на <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Подтвердите изменение {{tenantLabel}}',
'field-assignedTentant-label': 'Назначенный Арендатор',
'confirm-modal-tenant-switch--heading': 'Подтвердите изменение {{tenantLabel}}',
'field-assignedTenant-label': 'Назначенный Арендатор',
'nav-tenantSelector-label': 'Арендатор',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const skTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'confirm-modal-tenant-switch--body':
'Chystáte sa zmeniť vlastníctvo z <0>{{fromTenant}}</0> na <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Potvrďte zmenu {{tenantLabel}}',
'field-assignedTentant-label': 'Pridelený nájomca',
'confirm-modal-tenant-switch--heading': 'Potvrďte zmenu {{tenantLabel}}',
'field-assignedTenant-label': 'Pridelený nájomca',
'nav-tenantSelector-label': 'Nájomca',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const slTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Ravno ste pred spremembo lastništva iz <0>{{fromTenant}}</0> na <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Potrdi spremembo {{tenantLabel}}',
'field-assignedTentant-label': 'Dodeljen najemnik',
'confirm-modal-tenant-switch--body':
'Pravkar ste na točki, da spremenite lastništvo iz <0>{{fromTenant}}</0> v <0>{{toTenant}}</0>',
'confirm-modal-tenant-switch--heading': 'Potrdite spremembo {{tenantLabel}}',
'field-assignedTenant-label': 'Dodeljen najemnik',
'nav-tenantSelector-label': 'Najemnik',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const svTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Du är på väg att ändra ägare från <0>{{fromTenant}}</0> till <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Bekräfta ändring av {{tenantLabel}}',
'field-assignedTentant-label': 'Tilldelad hyresgäst',
'confirm-modal-tenant-switch--body':
'Du är på väg att ändra ägande från <0>{{fromTenant}}</0> till <0>{{toTenant}}</0>',
'confirm-modal-tenant-switch--heading': 'Bekräfta ändring av {{tenantLabel}}',
'field-assignedTenant-label': 'Tilldelad hyresgäst',
'nav-tenantSelector-label': 'Hyresgäst',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const thTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'คุณกำลังจะเปลี่ยนความเป็นเจ้าของจาก <0>{{fromTenant}}</0> เป็น <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'ยืนยันการเปลี่ยนแปลง {{tenantLabel}}',
'field-assignedTentant-label': 'ผู้เช่าที่ได้รับการกำหนด',
'confirm-modal-tenant-switch--body':
'คุณกำลังจะเปลี่ยนสิทธิ์การเป็นเจ้าของจาก <0>{{fromTenant}}</0> ไปยัง <0>{{toTenant}}</0>',
'confirm-modal-tenant-switch--heading': 'ยืนยันการเปลี่ยนแปลง {{tenantLabel}}',
'field-assignedTenant-label': 'ผู้เช่าที่ได้รับการกำหนด',
'nav-tenantSelector-label': 'ผู้เช่า',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const trTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
"Sahipliği <0>{{fromTenant}}</0>'den <0>{{toTenant}}</0>'e değiştirmek üzeresiniz.",
'confirm-tenant-switch--heading': '{{tenantLabel}} değişikliğini onayla',
'field-assignedTentant-label': 'Atanan Kiracı',
'confirm-modal-tenant-switch--body':
"<0>{{fromTenant}}</0>'den <0>{{toTenant}}</0>'ye sahipliği değiştirmek üzeresiniz.",
'confirm-modal-tenant-switch--heading': '{{tenantLabel}} değişikliğini onayla',
'field-assignedTenant-label': 'Atanan Kiracı',
'nav-tenantSelector-label': 'Kiracı',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const ukTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Ви збираєтесь змінити власність з <0>{{fromTenant}}</0> на <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Підтвердіть зміну {{tenantLabel}}',
'field-assignedTentant-label': 'Призначений орендар',
'confirm-modal-tenant-switch--body':
'Ви збираєтеся змінити власність з <0>{{fromTenant}}</0> на <0>{{toTenant}}</0>',
'confirm-modal-tenant-switch--heading': 'Підтвердіть зміну {{tenantLabel}}',
'field-assignedTenant-label': 'Призначений орендар',
'nav-tenantSelector-label': 'Орендар',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const viTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'Bạn đang chuẩn bị chuyển quyền sở hữu từ <0>{{fromTenant}}</0> sang <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': 'Xác nhận thay đổi {{tenantLabel}}',
'field-assignedTentant-label': 'Người thuê đã được chỉ định',
'confirm-modal-tenant-switch--body':
'Bạn sắp chuyển quyền sở hữu từ <0>{{fromTenant}}</0> đến <0>{{toTenant}}</0>',
'confirm-modal-tenant-switch--heading': 'Xác nhận thay đổi {{tenantLabel}}',
'field-assignedTenant-label': 'Người thuê đã được chỉ định',
'nav-tenantSelector-label': 'Người thuê',
},
}

View File

@@ -2,9 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const zhTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body': '您即将将所有权从<0>{{fromTenant}}</0>更改为<0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': '确认更改{{tenantLabel}}',
'field-assignedTentant-label': '指定租户',
'confirm-modal-tenant-switch--body':
'您即将从<0>{{fromTenant}}</0>更改为<0>{{toTenant}}</0>的所有权',
'confirm-modal-tenant-switch--heading': '确认更改{{tenantLabel}}',
'field-assignedTenant-label': '指定租户',
'nav-tenantSelector-label': '租户',
},
}

View File

@@ -2,10 +2,11 @@ import type { PluginDefaultTranslationsObject, PluginLanguage } from '../types.j
export const zhTwTranslations: PluginDefaultTranslationsObject = {
'plugin-multi-tenant': {
'confirm-tenant-switch--body':
'您即將變更擁有者,從 <0>{{fromTenant}}</0> 切換為 <0>{{toTenant}}</0>',
'confirm-tenant-switch--heading': '確認變更 {{tenantLabel}}',
'field-assignedTentant-label': '指派的租用戶',
'confirm-modal-tenant-switch--body':
'您即將<0>{{fromTenant}}</0>變更所有權至<0>{{toTenant}}</0>',
'confirm-modal-tenant-switch--heading': '確認變更 {{tenantLabel}}',
'field-assignedTenant-label': '指派的租用戶',
'nav-tenantSelector-label': '租戶',
},
}

View File

@@ -4,9 +4,10 @@ import type { enTranslations } from './languages/en.js'
export type PluginLanguage = Language<{
'plugin-multi-tenant': {
'confirm-tenant-switch--body': string
'confirm-tenant-switch--heading': string
'field-assignedTentant-label': string
'confirm-modal-tenant-switch--body': string
'confirm-modal-tenant-switch--heading': string
'field-assignedTenant-label': string
'nav-tenantSelector-label': string
}
}>

View File

@@ -1,5 +1,12 @@
import type { AcceptedLanguages } from '@payloadcms/translations'
import type { ArrayField, CollectionSlug, Field, RelationshipField, TypedUser } from 'payload'
import type {
ArrayField,
CollectionSlug,
Field,
RelationshipField,
SingleRelationshipField,
TypedUser,
} from 'payload'
export type MultiTenantPluginConfig<ConfigTypes = unknown> = {
/**
@@ -30,6 +37,11 @@ export type MultiTenantPluginConfig<ConfigTypes = unknown> = {
*/
isGlobal?: boolean
/**
* Overrides for the tenant field, will override the entire tenantField configuration
*/
tenantFieldOverrides?: CollectionTenantFieldConfigOverrides
/**
* Set to `false` if you want to manually apply the baseListFilter
* Set to `false` if you want to manually apply the baseFilter
*
* @default true
@@ -68,18 +80,37 @@ export type MultiTenantPluginConfig<ConfigTypes = unknown> = {
* @default true
*/
enabled?: boolean
/**
* Localization for the plugin
*/
i18n?: {
translations: {
[key in AcceptedLanguages]?: {
/**
* @default 'You are about to change ownership from <0>{{fromTenant}}</0> to <0>{{toTenant}}</0>'
*/
'confirm-modal-tenant-switch--body'?: string
/**
* `tenantLabel` defaults to the value of the `nav-tenantSelector-label` translation
*
* @default 'Confirm {{tenantLabel}} change'
*/
'confirm-modal-tenant-switch--heading'?: string
/**
* @default 'Assigned Tenant'
*/
'field-assignedTenant-label'?: string
/**
* @default 'Tenant'
*/
'nav-tenantSelector-label'?: string
}
}
}
/**
* Field configuration for the field added to all tenant enabled collections
*/
tenantField?: {
access?: RelationshipField['access']
/**
* The name of the field added to all tenant enabled collections
*
* @default 'tenant'
*/
name?: string
}
tenantField?: RootTenantFieldConfigOverrides
/**
* Field configuration for the field added to the users collection
*
@@ -132,6 +163,8 @@ export type MultiTenantPluginConfig<ConfigTypes = unknown> = {
* Customize tenant selector label
*
* Either a string or an object where the keys are i18n codes and the values are the string labels
*
* @deprecated Use `i18n.translations` instead.
*/
tenantSelectorLabel?:
| Partial<{
@@ -166,6 +199,30 @@ export type MultiTenantPluginConfig<ConfigTypes = unknown> = {
useUsersTenantFilter?: boolean
}
export type RootTenantFieldConfigOverrides = Partial<
Omit<
SingleRelationshipField,
| '_sanitized'
| 'hasMany'
| 'hidden'
| 'index'
| 'localized'
| 'max'
| 'maxRows'
| 'min'
| 'minRows'
| 'relationTo'
| 'required'
| 'type'
| 'unique'
| 'virtual'
>
>
export type CollectionTenantFieldConfigOverrides = Partial<
Omit<RootTenantFieldConfigOverrides, 'name'>
>
export type Tenant<IDType = number | string> = {
id: IDType
name: string

View File

@@ -124,7 +124,7 @@ export function convertTextNode(node: SlateNode): SerializedTextNode {
format: convertNodeToFormat(node),
mode: 'normal',
style: '',
text: node.text ?? "",
text: node.text ?? '',
version: 1,
}
}

View File

@@ -25,14 +25,14 @@ export const zhTwTranslations: DefaultTranslationsObject = {
failedToUnlock: '解除鎖定失敗',
forceUnlock: '強制解除鎖定',
forgotPassword: '忘記密碼',
forgotPasswordEmailInstructions:
'請輸入您的電子郵件。您將會收到一封包含密碼重設指示的郵件。',
forgotPasswordEmailInstructions: '請輸入您的電子郵件。您將會收到一封包含密碼重設指示的郵件。',
forgotPasswordQuestion: '忘記密碼?',
forgotPasswordUsernameInstructions:
'請輸入您的使用者名稱。重設密碼的指示將會寄送至該帳號所綁定的電子郵件。',
generate: '產生',
generateNewAPIKey: '產生新的 API 金鑰',
generatingNewAPIKeyWillInvalidate: '產生新的 API 金鑰將會使原本的金鑰<1>失效</1>。確定要繼續嗎?',
generatingNewAPIKeyWillInvalidate:
'產生新的 API 金鑰將會使原本的金鑰<1>失效</1>。確定要繼續嗎?',
lockUntil: '鎖定至',
logBackIn: '重新登入',
loggedIn: '若要使用其他使用者登入,請先<0>登出</0>。',
@@ -187,8 +187,10 @@ export const zhTwTranslations: DefaultTranslationsObject = {
moveFolder: '移動資料夾',
moveItemsToFolderConfirmation:
'您即將移動 <1>{{count}} 個 {{label}}</1> 到 <2>{{toFolder}}</2>。確定要繼續?',
moveItemsToRootConfirmation: '您即將移動 <1>{{count}} 個 {{label}}</1> 到根資料夾。確定要繼續?',
moveItemToFolderConfirmation: '您即將移動 <1>{{title}}</1> 到 <2>{{toFolder}}</2>。確定要繼續?',
moveItemsToRootConfirmation:
'您即將移動 <1>{{count}} 個 {{label}}</1> 到根資料夾。確定要繼續?',
moveItemToFolderConfirmation:
'您即將移動 <1>{{title}}</1> 到 <2>{{toFolder}}</2>。確定要繼續?',
moveItemToRootConfirmation: '您即將移動 <1>{{title}}</1> 到根資料夾。確定要繼續?',
movingFromFolder: '正在從 {{fromFolder}} 移動 {{title}}',
newFolder: '新增資料夾',
@@ -390,8 +392,7 @@ export const zhTwTranslations: DefaultTranslationsObject = {
success: '成功',
successfullyCreated: '已成功建立 {{label}}。',
successfullyDuplicated: '已成功複製 {{label}}。',
successfullyReindexed:
'已成功重新索引 {{collections}} 中 {{total}} 筆文件中的 {{count}} 筆。',
successfullyReindexed: '已成功重新索引 {{collections}} 中 {{total}} 筆文件中的 {{count}} 筆。',
takeOver: '接手編輯',
thisLanguage: '中文(繁體)',
time: '時間',