-
+
Select all
-
+
Clear all
diff --git a/packages/nc-gui/components/permissions/UserSelectorList.vue b/packages/nc-gui/components/permissions/UserSelectorList.vue
new file mode 100644
index 0000000000..70758e934a
--- /dev/null
+++ b/packages/nc-gui/components/permissions/UserSelectorList.vue
@@ -0,0 +1,160 @@
+
+
+
+
+
+
+
+
+
+
+ {{ option?.display_name || option?.email?.slice(0, option?.email.indexOf('@')) }}
+
+
+
+ {{ option?.email }}
+
+
+
+ {{ option.email ?? option.id }}
+
+
+
+
+
+
+
+
+ Clear all
+ Select all
+
+
+
+
diff --git a/packages/nc-gui/lib/types.ts b/packages/nc-gui/lib/types.ts
index ba0da20a98..0947b4275d 100644
--- a/packages/nc-gui/lib/types.ts
+++ b/packages/nc-gui/lib/types.ts
@@ -29,6 +29,7 @@ import type { BaseRoleLoader } from '../components/smartsheet/grid/canvas/loader
import type { AuditLogsDateRange, ImportSource, ImportType, PreFilledMode, TabType } from './enums'
import type { rolePermissions } from './acl'
import type Record from '~icons/*'
+import type { TooltipPlacement } from 'ant-design-vue/lib/tooltip'
interface User {
id: string
@@ -710,6 +711,105 @@ interface PermissionSelectorUser {
display_name?: string | null
}
+// NcList type starts here
+
+type MultiSelectRawValueType = Array
+
+type RawValueType = string | number | MultiSelectRawValueType
+
+interface NcListItemType {
+ value?: RawValueType
+ label?: string
+ ncItemDisabled?: boolean
+ ncItemTooltip?: string
+ [key: string]: any
+}
+
+/**
+ * Props interface for the List component
+ */
+interface NcListProps {
+ /** The currently selected value */
+ value: RawValueType
+ /** The list of items to display */
+ list: NcListItemType[]
+ /**
+ * The key to use for accessing the value from a list item
+ * @default 'value'
+ */
+ optionValueKey?: string
+ /**
+ * The key to use for accessing the label from a list item
+ * @default 'label'
+ */
+ optionLabelKey?: string
+ /** Whether the list is open or closed */
+ open?: boolean
+ /**
+ * Whether to close the list after an item is selected
+ * @default true
+ */
+ closeOnSelect?: boolean
+ /** Placeholder text for the search input */
+ searchInputPlaceholder?: string
+ /** Show search input box always */
+ showSearchAlways?: boolean
+ /** Whether to show the currently selected option */
+ showSelectedOption?: boolean
+ /**
+ * The height of each item in the list, used for virtual list rendering.
+ * @default 38
+ */
+ itemHeight?: number
+ variant?: 'default' | 'small' | 'medium'
+ /** Custom filter function for list items */
+ filterOption?: (input: string, option: NcListItemType, index: Number) => boolean
+ /**
+ * Indicates whether the component allows multiple selections.
+ */
+ isMultiSelect?: boolean
+ /**
+ * The minimum number of items required in the list to enable search functionality.
+ */
+ minItemsForSearch?: number
+ /**
+ * Whether the list is locked and cannot be interacted with
+ */
+ isLocked?: boolean
+
+ /**
+ * Whether input should have border
+ */
+ inputBordered?: boolean
+
+ listWrapperClassName?: string
+
+ containerClassName?: string
+
+ itemClassName?: string
+
+ itemTooltipPlacement?: TooltipPlacement
+
+ /**
+ * Whether to hide the top divider
+ */
+ hideTopDivider?: boolean
+
+ emptyDescription?: string
+
+ /**
+ * This will remove side padding and rounded corners from the list item
+ */
+ itemFullWidth?: boolean
+
+ /**
+ * Whether to stop propagation on item click
+ */
+ stopPropagationOnItemClick?: boolean
+}
+
+// NcList type ends here
+
export type {
User,
ProjectMetaInfo,
@@ -766,4 +866,8 @@ export type {
RowColouringEvaluatedResultType,
PermissionConfig,
PermissionSelectorUser,
+ NcListProps,
+ NcListItemType,
+ MultiSelectRawValueType,
+ RawValueType,
}
diff --git a/packages/nc-gui/utils/commonUtils.ts b/packages/nc-gui/utils/commonUtils.ts
index ba1653951b..f952f7d44c 100644
--- a/packages/nc-gui/utils/commonUtils.ts
+++ b/packages/nc-gui/utils/commonUtils.ts
@@ -130,8 +130,8 @@ export const searchCompare = (source?: NestedArray,
*/
export const antSelectFilterOption = (
inputValue: string,
- option?: DefaultOptionType,
- searchKey: keyof DefaultOptionType | (keyof DefaultOptionType)[] = 'key',
+ option?: DefaultOptionType | NcListItemType,
+ searchKey: keyof DefaultOptionType | keyof NcListItemType | (keyof NcListItemType)[] | (keyof DefaultOptionType)[] = 'key',
) => {
if (!option) return false