2023-01-12 12:02:26 +00:00
|
|
|
<template>
|
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkInput v-model="role.name" :readonly="readonly">
|
2023-01-12 12:02:26 +00:00
|
|
|
<template #label>{{ i18n.ts._role.name }}</template>
|
|
|
|
</MkInput>
|
|
|
|
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkTextarea v-model="role.description" :readonly="readonly">
|
2023-01-12 12:02:26 +00:00
|
|
|
<template #label>{{ i18n.ts._role.description }}</template>
|
|
|
|
</MkTextarea>
|
|
|
|
|
2023-05-02 03:32:21 +00:00
|
|
|
<MkColorInput v-model="role.color">
|
2023-01-12 12:02:26 +00:00
|
|
|
<template #label>{{ i18n.ts.color }}</template>
|
2023-05-02 03:32:21 +00:00
|
|
|
</MkColorInput>
|
2023-01-12 12:02:26 +00:00
|
|
|
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkInput v-model="role.iconUrl">
|
2023-02-05 01:37:03 +00:00
|
|
|
<template #label>{{ i18n.ts._role.iconUrl }}</template>
|
|
|
|
</MkInput>
|
|
|
|
|
2023-03-12 07:38:08 +00:00
|
|
|
<MkInput v-model="role.displayOrder" type="number">
|
|
|
|
<template #label>{{ i18n.ts._role.displayOrder }}</template>
|
|
|
|
<template #caption>{{ i18n.ts._role.descriptionOfDisplayOrder }}</template>
|
|
|
|
</MkInput>
|
|
|
|
|
2023-01-12 23:23:52 +00:00
|
|
|
<MkSelect v-model="rolePermission" :readonly="readonly">
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #label><i class="ti ti-shield-lock"></i> {{ i18n.ts._role.permission }}</template>
|
2023-01-13 02:03:54 +00:00
|
|
|
<template #caption><div v-html="i18n.ts._role.descriptionOfPermission.replaceAll('\n', '<br>')"></div></template>
|
2023-01-12 23:22:23 +00:00
|
|
|
<option value="normal">{{ i18n.ts.normalUser }}</option>
|
2023-01-12 12:02:26 +00:00
|
|
|
<option value="moderator">{{ i18n.ts.moderator }}</option>
|
|
|
|
<option value="administrator">{{ i18n.ts.administrator }}</option>
|
|
|
|
</MkSelect>
|
|
|
|
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSelect v-model="role.target" :readonly="readonly">
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #label><i class="ti ti-users"></i> {{ i18n.ts._role.assignTarget }}</template>
|
2023-01-13 02:03:54 +00:00
|
|
|
<template #caption><div v-html="i18n.ts._role.descriptionOfAssignTarget.replaceAll('\n', '<br>')"></div></template>
|
|
|
|
<option value="manual">{{ i18n.ts._role.manual }}</option>
|
|
|
|
<option value="conditional">{{ i18n.ts._role.conditional }}</option>
|
|
|
|
</MkSelect>
|
|
|
|
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkFolder v-if="role.target === 'conditional'" defaultOpen>
|
2023-01-13 02:03:54 +00:00
|
|
|
<template #label>{{ i18n.ts._role.condition }}</template>
|
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<RolesEditorFormula v-model="role.condFormula"/>
|
2023-01-13 02:03:54 +00:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.canEditMembersByModerator" :readonly="readonly">
|
2023-02-05 01:37:03 +00:00
|
|
|
<template #label>{{ i18n.ts._role.canEditMembersByModerator }}</template>
|
|
|
|
<template #caption>{{ i18n.ts._role.descriptionOfCanEditMembersByModerator }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.isPublic" :readonly="readonly">
|
2023-02-05 01:37:03 +00:00
|
|
|
<template #label>{{ i18n.ts._role.isPublic }}</template>
|
|
|
|
<template #caption>{{ i18n.ts._role.descriptionOfIsPublic }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.asBadge" :readonly="readonly">
|
2023-02-05 01:37:03 +00:00
|
|
|
<template #label>{{ i18n.ts._role.asBadge }}</template>
|
|
|
|
<template #caption>{{ i18n.ts._role.descriptionOfAsBadge }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
|
2023-04-20 11:02:50 +00:00
|
|
|
<MkSwitch v-model="role.isExplorable" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.isExplorable }}</template>
|
|
|
|
<template #caption>{{ i18n.ts._role.descriptionOfIsExplorable }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
|
2023-01-12 12:02:26 +00:00
|
|
|
<FormSlot>
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #label><i class="ti ti-license"></i> {{ i18n.ts._role.policies }}</template>
|
2023-01-12 12:02:26 +00:00
|
|
|
<div class="_gaps_s">
|
2023-01-15 20:19:26 +00:00
|
|
|
<MkInput v-model="q" type="search">
|
|
|
|
<template #prefix><i class="ti ti-search"></i></template>
|
|
|
|
</MkInput>
|
|
|
|
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.rateLimitFactor, 'rateLimitFactor'])">
|
2023-01-15 07:52:12 +00:00
|
|
|
<template #label>{{ i18n.ts._role._options.rateLimitFactor }}</template>
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #suffix>
|
2023-03-02 11:47:24 +00:00
|
|
|
<span v-if="role.policies.rateLimitFactor.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ `${Math.floor(role.policies.rateLimitFactor.value * 100)}%` }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.rateLimitFactor)"></i></span>
|
2023-01-15 21:35:16 +00:00
|
|
|
</template>
|
2023-01-15 07:52:12 +00:00
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.rateLimitFactor.useDefault" :readonly="readonly">
|
2023-01-15 07:52:12 +00:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange :modelValue="role.policies.rateLimitFactor.value * 100" :min="0" :max="400" :step="10" :textConverter="(v) => `${v}%`" @update:modelValue="v => role.policies.rateLimitFactor.value = (v / 100)">
|
2023-01-15 10:10:39 +00:00
|
|
|
<template #label>{{ i18n.ts._role._options.rateLimitFactor }}</template>
|
2023-01-15 07:52:12 +00:00
|
|
|
<template #caption>{{ i18n.ts._role._options.descriptionOfRateLimitFactor }}</template>
|
|
|
|
</MkRange>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.rateLimitFactor.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-01-15 10:10:39 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-15 07:52:12 +00:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-15 20:19:26 +00:00
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.gtlAvailable, 'gtlAvailable'])">
|
2023-01-12 12:02:26 +00:00
|
|
|
<template #label>{{ i18n.ts._role._options.gtlAvailable }}</template>
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #suffix>
|
2023-03-02 11:47:24 +00:00
|
|
|
<span v-if="role.policies.gtlAvailable.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ role.policies.gtlAvailable.value ? i18n.ts.yes : i18n.ts.no }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.gtlAvailable)"></i></span>
|
2023-01-15 21:35:16 +00:00
|
|
|
</template>
|
2023-01-12 12:02:26 +00:00
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.gtlAvailable.useDefault" :readonly="readonly">
|
2023-01-12 12:02:26 +00:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.gtlAvailable.value" :disabled="role.policies.gtlAvailable.useDefault" :readonly="readonly">
|
2023-01-12 12:02:26 +00:00
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.gtlAvailable.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-01-15 10:10:39 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-12 12:02:26 +00:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-15 20:19:26 +00:00
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.ltlAvailable, 'ltlAvailable'])">
|
2023-01-12 12:02:26 +00:00
|
|
|
<template #label>{{ i18n.ts._role._options.ltlAvailable }}</template>
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #suffix>
|
2023-03-02 11:47:24 +00:00
|
|
|
<span v-if="role.policies.ltlAvailable.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ role.policies.ltlAvailable.value ? i18n.ts.yes : i18n.ts.no }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.ltlAvailable)"></i></span>
|
2023-01-15 21:35:16 +00:00
|
|
|
</template>
|
2023-01-12 12:02:26 +00:00
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.ltlAvailable.useDefault" :readonly="readonly">
|
2023-01-12 12:02:26 +00:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.ltlAvailable.value" :disabled="role.policies.ltlAvailable.useDefault" :readonly="readonly">
|
2023-01-12 12:02:26 +00:00
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.ltlAvailable.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-01-15 10:10:39 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-12 12:02:26 +00:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-15 20:19:26 +00:00
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canPublicNote, 'canPublicNote'])">
|
2023-01-12 12:02:26 +00:00
|
|
|
<template #label>{{ i18n.ts._role._options.canPublicNote }}</template>
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #suffix>
|
2023-03-02 11:47:24 +00:00
|
|
|
<span v-if="role.policies.canPublicNote.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ role.policies.canPublicNote.value ? i18n.ts.yes : i18n.ts.no }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.canPublicNote)"></i></span>
|
2023-01-15 21:35:16 +00:00
|
|
|
</template>
|
2023-01-12 12:02:26 +00:00
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.canPublicNote.useDefault" :readonly="readonly">
|
2023-01-12 12:02:26 +00:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.canPublicNote.value" :disabled="role.policies.canPublicNote.useDefault" :readonly="readonly">
|
2023-01-12 12:02:26 +00:00
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.canPublicNote.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-01-15 10:10:39 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-12 12:02:26 +00:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-15 20:19:26 +00:00
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canInvite, 'canInvite'])">
|
2023-01-13 05:22:53 +00:00
|
|
|
<template #label>{{ i18n.ts._role._options.canInvite }}</template>
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #suffix>
|
2023-03-02 11:47:24 +00:00
|
|
|
<span v-if="role.policies.canInvite.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ role.policies.canInvite.value ? i18n.ts.yes : i18n.ts.no }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.canInvite)"></i></span>
|
2023-01-15 21:35:16 +00:00
|
|
|
</template>
|
2023-01-13 05:22:53 +00:00
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.canInvite.useDefault" :readonly="readonly">
|
2023-01-13 05:22:53 +00:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.canInvite.value" :disabled="role.policies.canInvite.useDefault" :readonly="readonly">
|
2023-01-13 05:22:53 +00:00
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.canInvite.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-01-15 10:10:39 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-13 05:22:53 +00:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-15 20:19:26 +00:00
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canManageCustomEmojis, 'canManageCustomEmojis'])">
|
2023-01-13 05:58:27 +00:00
|
|
|
<template #label>{{ i18n.ts._role._options.canManageCustomEmojis }}</template>
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #suffix>
|
2023-03-02 11:47:24 +00:00
|
|
|
<span v-if="role.policies.canManageCustomEmojis.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ role.policies.canManageCustomEmojis.value ? i18n.ts.yes : i18n.ts.no }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.canManageCustomEmojis)"></i></span>
|
2023-01-15 21:35:16 +00:00
|
|
|
</template>
|
2023-01-13 05:58:27 +00:00
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.canManageCustomEmojis.useDefault" :readonly="readonly">
|
2023-01-13 05:58:27 +00:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.canManageCustomEmojis.value" :disabled="role.policies.canManageCustomEmojis.useDefault" :readonly="readonly">
|
2023-01-13 05:58:27 +00:00
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.canManageCustomEmojis.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-01-15 10:10:39 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-13 05:58:27 +00:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-03-13 08:52:24 +00:00
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canSearchNotes, 'canSearchNotes'])">
|
|
|
|
<template #label>{{ i18n.ts._role._options.canSearchNotes }}</template>
|
|
|
|
<template #suffix>
|
|
|
|
<span v-if="role.policies.canSearchNotes.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ role.policies.canSearchNotes.value ? i18n.ts.yes : i18n.ts.no }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.canSearchNotes)"></i></span>
|
|
|
|
</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkSwitch v-model="role.policies.canSearchNotes.useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
<MkSwitch v-model="role.policies.canSearchNotes.value" :disabled="role.policies.canSearchNotes.useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.canSearchNotes.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-03-13 08:52:24 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2023-05-05 05:18:06 +00:00
|
|
|
|
2023-01-15 20:19:26 +00:00
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.driveCapacity, 'driveCapacityMb'])">
|
2023-01-12 12:02:26 +00:00
|
|
|
<template #label>{{ i18n.ts._role._options.driveCapacity }}</template>
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #suffix>
|
2023-03-02 11:47:24 +00:00
|
|
|
<span v-if="role.policies.driveCapacityMb.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ role.policies.driveCapacityMb.value + 'MB' }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.driveCapacityMb)"></i></span>
|
2023-01-15 21:35:16 +00:00
|
|
|
</template>
|
2023-01-12 12:02:26 +00:00
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.driveCapacityMb.useDefault" :readonly="readonly">
|
2023-01-12 12:02:26 +00:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkInput v-model="role.policies.driveCapacityMb.value" :disabled="role.policies.driveCapacityMb.useDefault" type="number" :readonly="readonly">
|
2023-01-12 12:02:26 +00:00
|
|
|
<template #suffix>MB</template>
|
|
|
|
</MkInput>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.driveCapacityMb.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-01-15 10:10:39 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-12 12:02:26 +00:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-05-05 05:18:06 +00:00
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.alwaysMarkNsfw, 'alwaysMarkNsfw'])">
|
|
|
|
<template #label>{{ i18n.ts._role._options.alwaysMarkNsfw }}</template>
|
|
|
|
<template #suffix>
|
|
|
|
<span v-if="role.policies.alwaysMarkNsfw.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ role.policies.alwaysMarkNsfw.value ? i18n.ts.yes : i18n.ts.no }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.alwaysMarkNsfw)"></i></span>
|
|
|
|
</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkSwitch v-model="role.policies.alwaysMarkNsfw.useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
<MkSwitch v-model="role.policies.alwaysMarkNsfw.value" :disabled="role.policies.alwaysMarkNsfw.useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.alwaysMarkNsfw.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-05-05 05:18:06 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-15 20:19:26 +00:00
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.pinMax, 'pinLimit'])">
|
2023-01-14 09:04:56 +00:00
|
|
|
<template #label>{{ i18n.ts._role._options.pinMax }}</template>
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #suffix>
|
2023-03-02 11:47:24 +00:00
|
|
|
<span v-if="role.policies.pinLimit.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ role.policies.pinLimit.value }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.pinLimit)"></i></span>
|
2023-01-15 21:35:16 +00:00
|
|
|
</template>
|
2023-01-14 09:04:56 +00:00
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.pinLimit.useDefault" :readonly="readonly">
|
2023-01-14 09:04:56 +00:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkInput v-model="role.policies.pinLimit.value" :disabled="role.policies.pinLimit.useDefault" type="number" :readonly="readonly">
|
2023-01-14 09:04:56 +00:00
|
|
|
</MkInput>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.pinLimit.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-01-15 10:10:39 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-14 09:04:56 +00:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-15 20:19:26 +00:00
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.antennaMax, 'antennaLimit'])">
|
2023-01-12 12:02:26 +00:00
|
|
|
<template #label>{{ i18n.ts._role._options.antennaMax }}</template>
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #suffix>
|
2023-03-02 11:47:24 +00:00
|
|
|
<span v-if="role.policies.antennaLimit.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ role.policies.antennaLimit.value }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.antennaLimit)"></i></span>
|
2023-01-15 21:35:16 +00:00
|
|
|
</template>
|
2023-01-12 12:02:26 +00:00
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.antennaLimit.useDefault" :readonly="readonly">
|
2023-01-12 12:02:26 +00:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkInput v-model="role.policies.antennaLimit.value" :disabled="role.policies.antennaLimit.useDefault" type="number" :readonly="readonly">
|
2023-01-12 12:02:26 +00:00
|
|
|
</MkInput>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.antennaLimit.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-01-15 10:10:39 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-12 12:02:26 +00:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2023-01-13 23:04:38 +00:00
|
|
|
|
2023-01-15 20:19:26 +00:00
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.wordMuteMax, 'wordMuteLimit'])">
|
2023-01-13 23:04:38 +00:00
|
|
|
<template #label>{{ i18n.ts._role._options.wordMuteMax }}</template>
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #suffix>
|
2023-03-02 11:47:24 +00:00
|
|
|
<span v-if="role.policies.wordMuteLimit.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ role.policies.wordMuteLimit.value }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.wordMuteLimit)"></i></span>
|
2023-01-15 21:35:16 +00:00
|
|
|
</template>
|
2023-01-13 23:04:38 +00:00
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.wordMuteLimit.useDefault" :readonly="readonly">
|
2023-01-13 23:04:38 +00:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkInput v-model="role.policies.wordMuteLimit.value" :disabled="role.policies.wordMuteLimit.useDefault" type="number" :readonly="readonly">
|
2023-01-13 23:04:38 +00:00
|
|
|
<template #suffix>chars</template>
|
|
|
|
</MkInput>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.wordMuteLimit.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-01-15 10:10:39 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-13 23:04:38 +00:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2023-01-14 01:48:11 +00:00
|
|
|
|
2023-01-15 20:19:26 +00:00
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.webhookMax, 'webhookLimit'])">
|
2023-01-14 01:48:11 +00:00
|
|
|
<template #label>{{ i18n.ts._role._options.webhookMax }}</template>
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #suffix>
|
2023-03-02 11:47:24 +00:00
|
|
|
<span v-if="role.policies.webhookLimit.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ role.policies.webhookLimit.value }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.webhookLimit)"></i></span>
|
2023-01-15 21:35:16 +00:00
|
|
|
</template>
|
2023-01-14 01:48:11 +00:00
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.webhookLimit.useDefault" :readonly="readonly">
|
2023-01-14 01:48:11 +00:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkInput v-model="role.policies.webhookLimit.value" :disabled="role.policies.webhookLimit.useDefault" type="number" :readonly="readonly">
|
2023-01-14 01:48:11 +00:00
|
|
|
</MkInput>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.webhookLimit.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-01-15 10:10:39 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-14 01:48:11 +00:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2023-01-14 07:14:24 +00:00
|
|
|
|
2023-01-15 20:19:26 +00:00
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.clipMax, 'clipLimit'])">
|
2023-01-14 07:14:24 +00:00
|
|
|
<template #label>{{ i18n.ts._role._options.clipMax }}</template>
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #suffix>
|
2023-03-02 11:47:24 +00:00
|
|
|
<span v-if="role.policies.clipLimit.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ role.policies.clipLimit.value }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.clipLimit)"></i></span>
|
2023-01-15 21:35:16 +00:00
|
|
|
</template>
|
2023-01-14 07:14:24 +00:00
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.clipLimit.useDefault" :readonly="readonly">
|
2023-01-14 07:14:24 +00:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkInput v-model="role.policies.clipLimit.value" :disabled="role.policies.clipLimit.useDefault" type="number" :readonly="readonly">
|
2023-01-14 07:14:24 +00:00
|
|
|
</MkInput>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.clipLimit.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-01-15 10:10:39 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-14 07:14:24 +00:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-15 20:19:26 +00:00
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.noteEachClipsMax, 'noteEachClipsLimit'])">
|
2023-01-14 07:14:24 +00:00
|
|
|
<template #label>{{ i18n.ts._role._options.noteEachClipsMax }}</template>
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #suffix>
|
2023-03-02 11:47:24 +00:00
|
|
|
<span v-if="role.policies.noteEachClipsLimit.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ role.policies.noteEachClipsLimit.value }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.noteEachClipsLimit)"></i></span>
|
2023-01-15 21:35:16 +00:00
|
|
|
</template>
|
2023-01-14 07:14:24 +00:00
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.noteEachClipsLimit.useDefault" :readonly="readonly">
|
2023-01-14 07:14:24 +00:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkInput v-model="role.policies.noteEachClipsLimit.value" :disabled="role.policies.noteEachClipsLimit.useDefault" type="number" :readonly="readonly">
|
2023-01-14 07:14:24 +00:00
|
|
|
</MkInput>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.noteEachClipsLimit.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-01-15 10:10:39 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-14 07:14:24 +00:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2023-01-14 08:38:16 +00:00
|
|
|
|
2023-01-15 20:19:26 +00:00
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.userListMax, 'userListLimit'])">
|
2023-01-14 08:38:16 +00:00
|
|
|
<template #label>{{ i18n.ts._role._options.userListMax }}</template>
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #suffix>
|
2023-03-02 11:47:24 +00:00
|
|
|
<span v-if="role.policies.userListLimit.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ role.policies.userListLimit.value }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.userListLimit)"></i></span>
|
2023-01-15 21:35:16 +00:00
|
|
|
</template>
|
2023-01-14 08:38:16 +00:00
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.userListLimit.useDefault" :readonly="readonly">
|
2023-01-14 08:38:16 +00:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkInput v-model="role.policies.userListLimit.value" :disabled="role.policies.userListLimit.useDefault" type="number" :readonly="readonly">
|
2023-01-14 08:38:16 +00:00
|
|
|
</MkInput>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.userListLimit.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-01-15 10:10:39 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-14 08:38:16 +00:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-15 20:19:26 +00:00
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.userEachUserListsMax, 'userEachUserListsLimit'])">
|
2023-01-14 08:38:16 +00:00
|
|
|
<template #label>{{ i18n.ts._role._options.userEachUserListsMax }}</template>
|
2023-01-15 21:35:16 +00:00
|
|
|
<template #suffix>
|
2023-03-02 11:47:24 +00:00
|
|
|
<span v-if="role.policies.userEachUserListsLimit.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ role.policies.userEachUserListsLimit.value }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.userEachUserListsLimit)"></i></span>
|
2023-01-15 21:35:16 +00:00
|
|
|
</template>
|
2023-01-14 08:38:16 +00:00
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.userEachUserListsLimit.useDefault" :readonly="readonly">
|
2023-01-14 08:38:16 +00:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkInput v-model="role.policies.userEachUserListsLimit.value" :disabled="role.policies.userEachUserListsLimit.useDefault" type="number" :readonly="readonly">
|
2023-01-14 08:38:16 +00:00
|
|
|
</MkInput>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.userEachUserListsLimit.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-01-15 10:10:39 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-14 08:38:16 +00:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2023-01-16 02:21:04 +00:00
|
|
|
|
|
|
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canHideAds, 'canHideAds'])">
|
|
|
|
<template #label>{{ i18n.ts._role._options.canHideAds }}</template>
|
|
|
|
<template #suffix>
|
2023-03-02 11:47:24 +00:00
|
|
|
<span v-if="role.policies.canHideAds.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
|
|
|
<span v-else>{{ role.policies.canHideAds.value ? i18n.ts.yes : i18n.ts.no }}</span>
|
|
|
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.canHideAds)"></i></span>
|
2023-01-16 02:21:04 +00:00
|
|
|
</template>
|
|
|
|
<div class="_gaps">
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.canHideAds.useDefault" :readonly="readonly">
|
2023-01-16 02:21:04 +00:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-03-02 11:47:24 +00:00
|
|
|
<MkSwitch v-model="role.policies.canHideAds.value" :disabled="role.policies.canHideAds.useDefault" :readonly="readonly">
|
2023-01-16 02:21:04 +00:00
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
2023-05-19 11:52:15 +00:00
|
|
|
<MkRange v-model="role.policies.canHideAds.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
2023-01-16 02:21:04 +00:00
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2023-01-12 12:02:26 +00:00
|
|
|
</div>
|
|
|
|
</FormSlot>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-03-02 11:47:24 +00:00
|
|
|
import { watch } from 'vue';
|
|
|
|
import { throttle } from 'throttle-debounce';
|
2023-01-13 02:03:54 +00:00
|
|
|
import RolesEditorFormula from './RolesEditorFormula.vue';
|
2023-01-12 12:02:26 +00:00
|
|
|
import MkInput from '@/components/MkInput.vue';
|
2023-05-02 03:32:21 +00:00
|
|
|
import MkColorInput from '@/components/MkColorInput.vue';
|
2023-01-12 12:02:26 +00:00
|
|
|
import MkSelect from '@/components/MkSelect.vue';
|
|
|
|
import MkTextarea from '@/components/MkTextarea.vue';
|
|
|
|
import MkFolder from '@/components/MkFolder.vue';
|
|
|
|
import MkSwitch from '@/components/MkSwitch.vue';
|
2023-01-15 07:52:12 +00:00
|
|
|
import MkRange from '@/components/MkRange.vue';
|
2023-01-12 12:02:26 +00:00
|
|
|
import FormSlot from '@/components/form/slot.vue';
|
|
|
|
import { i18n } from '@/i18n';
|
2023-03-02 11:47:24 +00:00
|
|
|
import { ROLE_POLICIES } from '@/const';
|
2023-01-15 07:52:12 +00:00
|
|
|
import { instance } from '@/instance';
|
2023-03-02 11:47:24 +00:00
|
|
|
import { deepClone } from '@/scripts/clone';
|
2023-01-15 10:10:39 +00:00
|
|
|
|
2023-01-12 12:02:26 +00:00
|
|
|
const emit = defineEmits<{
|
2023-03-02 11:47:24 +00:00
|
|
|
(ev: 'update:modelValue', v: any): void;
|
2023-01-12 12:02:26 +00:00
|
|
|
}>();
|
|
|
|
|
|
|
|
const props = defineProps<{
|
2023-03-02 11:47:24 +00:00
|
|
|
modelValue: any;
|
2023-01-12 12:02:26 +00:00
|
|
|
readonly?: boolean;
|
|
|
|
}>();
|
|
|
|
|
2023-03-02 11:47:24 +00:00
|
|
|
let role = $ref(deepClone(props.modelValue));
|
2023-01-12 12:02:26 +00:00
|
|
|
|
2023-03-02 11:47:24 +00:00
|
|
|
// fill missing policy
|
2023-01-15 11:52:53 +00:00
|
|
|
for (const ROLE_POLICY of ROLE_POLICIES) {
|
2023-03-02 11:47:24 +00:00
|
|
|
if (role.policies[ROLE_POLICY] == null) {
|
|
|
|
role.policies[ROLE_POLICY] = {
|
|
|
|
useDefault: true,
|
|
|
|
priority: 0,
|
|
|
|
value: instance.policies[ROLE_POLICY],
|
|
|
|
};
|
|
|
|
}
|
2023-01-15 10:10:39 +00:00
|
|
|
}
|
2023-01-12 12:02:26 +00:00
|
|
|
|
2023-03-02 11:47:24 +00:00
|
|
|
let rolePermission = $computed({
|
|
|
|
get: () => role.isAdministrator ? 'administrator' : role.isModerator ? 'moderator' : 'normal',
|
|
|
|
set: (val) => {
|
|
|
|
role.isAdministrator = val === 'administrator';
|
|
|
|
role.isModerator = val === 'moderator';
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
let q = $ref('');
|
2023-01-13 02:03:54 +00:00
|
|
|
|
2023-01-15 10:10:39 +00:00
|
|
|
function getPriorityIcon(option) {
|
|
|
|
if (option.priority === 2) return 'ti ti-arrows-up';
|
|
|
|
if (option.priority === 1) return 'ti ti-arrow-narrow-up';
|
|
|
|
return 'ti ti-point';
|
2023-01-12 12:02:26 +00:00
|
|
|
}
|
|
|
|
|
2023-01-15 20:19:26 +00:00
|
|
|
function matchQuery(keywords: string[]): boolean {
|
|
|
|
if (q.trim().length === 0) return true;
|
|
|
|
return keywords.some(keyword => keyword.toLowerCase().includes(q.toLowerCase()));
|
|
|
|
}
|
|
|
|
|
2023-03-02 11:47:24 +00:00
|
|
|
const save = throttle(100, () => {
|
|
|
|
const data = {
|
|
|
|
name: role.name,
|
|
|
|
description: role.description,
|
|
|
|
color: role.color === '' ? null : role.color,
|
|
|
|
iconUrl: role.iconUrl === '' ? null : role.iconUrl,
|
2023-03-12 07:38:08 +00:00
|
|
|
displayOrder: role.displayOrder,
|
2023-03-02 11:47:24 +00:00
|
|
|
target: role.target,
|
|
|
|
condFormula: role.condFormula,
|
|
|
|
isAdministrator: role.isAdministrator,
|
|
|
|
isModerator: role.isModerator,
|
|
|
|
isPublic: role.isPublic,
|
2023-04-20 11:02:50 +00:00
|
|
|
isExplorable: role.isExplorable,
|
2023-03-02 11:47:24 +00:00
|
|
|
asBadge: role.asBadge,
|
|
|
|
canEditMembersByModerator: role.canEditMembersByModerator,
|
|
|
|
policies: role.policies,
|
|
|
|
};
|
|
|
|
|
|
|
|
emit('update:modelValue', data);
|
|
|
|
});
|
|
|
|
|
|
|
|
watch($$(role), save, { deep: true });
|
2023-01-12 12:02:26 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
2023-01-15 21:35:16 +00:00
|
|
|
.useDefaultLabel {
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
2023-01-12 12:02:26 +00:00
|
|
|
|
2023-01-15 21:35:16 +00:00
|
|
|
.priorityIndicator {
|
|
|
|
margin-left: 8px;
|
|
|
|
}
|
2023-01-12 12:02:26 +00:00
|
|
|
</style>
|