@leav/ui 1.7.0-bba65313 → 1.7.0-e1ab594d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ import { PlusOutlined, SearchOutlined } from '@ant-design/icons';
6
6
  import { useApolloClient } from '@apollo/client';
7
7
  import { localizedTranslation } from '@leav/utils';
8
8
  import { Table } from 'antd';
9
- import { KitButton, KitInput, KitTag } from 'aristid-ds';
9
+ import { KitButton, KitIdCard, KitInput, KitTag } from 'aristid-ds';
10
10
  import { useEffect, useRef, useState } from 'react';
11
11
  import styled from 'styled-components';
12
12
  import { defaultPaginationPageSize, PreviewSize, tagColorByAttributeFormat, tagColorByAttributeType, } from '../../../constants';
@@ -153,9 +153,7 @@ function AttributesList({ onSelect, selected = [], multiple = true, showCreateBu
153
153
  render: (type) => (_jsx(KitTag, { style: {
154
154
  borderColor: tagColorByAttributeType[type][0],
155
155
  backgroundColor: tagColorByAttributeType[type][1],
156
- }, idCardProps: {
157
- description: t(`attributes.type_${type}`),
158
- } })),
156
+ }, children: _jsx(KitIdCard, { description: t(`attributes.type_${type}`) }) })),
159
157
  filters: Object.values(AttributeType).map(type => ({
160
158
  text: t(`attributes.type_${type}`),
161
159
  value: type,
@@ -175,9 +173,7 @@ function AttributesList({ onSelect, selected = [], multiple = true, showCreateBu
175
173
  render: (format) => format ? (_jsx(KitTag, { style: {
176
174
  borderColor: tagColorByAttributeFormat[format][0],
177
175
  backgroundColor: tagColorByAttributeFormat[format][1],
178
- }, idCardProps: {
179
- description: t(`attributes.format_${format}`),
180
- } })) : null,
176
+ }, children: _jsx(KitIdCard, { description: t(`attributes.format_${format}`) }) })) : null,
181
177
  filters: Object.values(AttributeFormat).map(format => ({
182
178
  text: t(`attributes.format_${format}`),
183
179
  value: format,
@@ -1 +1 @@
1
- {"version":3,"file":"AttributesList.js","sourceRoot":"","sources":["../../../../src/components/AttributePicker/AttributesList/AttributesList.tsx"],"names":[],"mappings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CAAC,CAAC,CAAC,oBAAoB,EAAE,EAAC,KAAK,EAAC,CAAC;iBACvD,EACD,MAAM,EAAE,EAAC,CAAC,EAAE,oBAAoB,EAAC,EACjC,KAAK,EAAE,GAAG,EAAE,CAAC,WAAW,EACxB,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;oBACd,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC;iBACzC,CAAC,EACF,QAAQ,EAAE,aAAa,GACzB,EACD,uBAAuB,IAAI,CACxB,KAAC,kBAAkB,IACf,IAAI,EAAE,uBAAuB,EAC7B,OAAO,EAAE,wBAAwB,EACjC,YAAY,EAAE,iBAAiB,EAC/B,KAAK,EAAE,GAAG,GACZ,CACL,IACF,CACN,CAAC;AACN,CAAC;AAED,eAAe,cAAc,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {PlusOutlined, SearchOutlined} from '@ant-design/icons';\nimport {useApolloClient} from '@apollo/client';\nimport {localizedTranslation, type Override} from '@leav/utils';\nimport {Table, type TableColumnsType, type TablePaginationConfig} from 'antd';\nimport {type FilterValue, type SorterResult} from 'antd/lib/table/interface';\nimport {KitButton, KitInput, KitTag} from 'aristid-ds';\nimport {type Key, useEffect, useRef, useState} from 'react';\nimport styled from 'styled-components';\nimport {\n defaultPaginationPageSize,\n PreviewSize,\n tagColorByAttributeFormat,\n tagColorByAttributeType,\n} from '../../../constants';\nimport {useLang} from '../../../hooks';\nimport {useSharedTranslation} from '../../../hooks/useSharedTranslation';\nimport {\n type AttributeDetailsFragment,\n AttributeFormat,\n AttributesSortableFields,\n AttributeType,\n type GetAttributesQuery,\n type GetAttributesQueryVariables,\n PermissionsActions,\n PermissionTypes,\n SortOrder,\n useGetAttributesQuery,\n useIsAllowedQuery,\n} from '../../../_gqlTypes';\nimport {getAttributesQuery} from '../../../_queries/attributes/getAttributesQuery';\nimport {extractPermissionFromQuery} from '../../../_utils';\nimport {EditAttributeModal} from '../../EditAttributeModal';\nimport {EntityCard, type IEntityData} from '../../EntityCard';\nimport {ErrorDisplay} from '../../ErrorDisplay';\n\nconst HeaderWrapper = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 0.5rem;\n\n .kit-input-wrapper {\n flex-grow: 1;\n }\n`;\n\ntype ListAttributeType = Override<GetAttributesQuery['attributes']['list'][number], {label: string}> & {key: string};\n\ninterface IAttributesListProps {\n onSelect: (selectedAttributes: string[]) => void;\n selected?: string[];\n multiple?: boolean;\n showCreateButton?: boolean;\n baseFilters?: GetAttributesQueryVariables['filters'];\n}\n\nfunction AttributesList({\n onSelect,\n selected = [],\n multiple = true,\n showCreateButton = true,\n baseFilters,\n}: IAttributesListProps): JSX.Element {\n const {t} = useSharedTranslation();\n const {lang} = useLang();\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [pageSize, setPageSize] = useState(defaultPaginationPageSize);\n const [currentPage, setCurrentPage] = useState(1);\n const [sort, setSort] = useState<GetAttributesQueryVariables['sort']>();\n const [filters, setFilters] = useState<GetAttributesQueryVariables['filters']>({});\n const [tableData, setTableData] = useState<ListAttributeType[]>([]);\n\n const {loading, error, data} = useGetAttributesQuery({\n variables: {\n pagination: {\n limit: pageSize,\n offset: (currentPage - 1) * pageSize,\n },\n sort,\n filters: {\n ...filters,\n ...baseFilters,\n },\n },\n });\n\n const isAllowedQueryResult = useIsAllowedQuery({\n fetchPolicy: 'cache-and-network',\n variables: {\n type: PermissionTypes.admin,\n actions: [PermissionsActions.admin_create_attribute],\n },\n });\n const canCreate =\n showCreateButton && extractPermissionFromQuery(isAllowedQueryResult, PermissionsActions.admin_create_attribute);\n\n const [selectedRowKeys, setSelectedRowKeys] = useState<Key[]>(selected);\n const [isNewAttributeModalOpen, setIsNewAttributeModalOpen] = useState(false);\n const client = useApolloClient();\n\n const _handleSelectionChange = (selection: Key[]) => {\n setSelectedRowKeys(selection);\n onSelect(selection as string[]);\n };\n\n const _handleRowClick = (record: ListAttributeType) => {\n let newSelection;\n\n if (selectedRowKeys.indexOf(record.key) === -1) {\n newSelection = multiple ? [...selectedRowKeys, record.key] : [record.key]; // Add to selection\n } else {\n newSelection = multiple ? selectedRowKeys.filter(key => key !== record.key) : []; // Remove from selection\n }\n\n setSelectedRowKeys(newSelection);\n onSelect(newSelection as string[]);\n };\n\n const _handleSearchSubmit = (e: React.SyntheticEvent<HTMLInputElement>) => {\n setFilters({\n ...filters,\n label: `%${e.currentTarget.value}%`,\n });\n };\n\n const _handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n // Handle clearing input only. Submitting input is otherwise handled by \"onPressEnter\"\n if (!e.currentTarget.value) {\n _handleSearchSubmit(e);\n }\n };\n\n const _handleClickNewAttribute = () => {\n setIsNewAttributeModalOpen(true);\n };\n const _handleCloseNewAttribute = () => setIsNewAttributeModalOpen(false);\n\n const _handlePostCreate = async (newAttribute: AttributeDetailsFragment) => {\n const allAttributesData = client.readQuery<GetAttributesQuery>({query: getAttributesQuery});\n\n if (allAttributesData) {\n client.writeQuery({\n query: getAttributesQuery,\n data: {\n attributes: {\n ...allAttributesData.attributes,\n list: [newAttribute, ...allAttributesData.attributes.list],\n },\n },\n });\n }\n const newSelection = [...selectedRowKeys, newAttribute.id];\n onSelect(newSelection as string[]);\n setSelectedRowKeys(newSelection);\n };\n\n const _handleChange = (\n pagination: TablePaginationConfig,\n filter: Record<string, FilterValue | null>,\n sorter: SorterResult<ListAttributeType> | Array<SorterResult<ListAttributeType>>,\n ) => {\n setCurrentPage(pagination.current);\n setPageSize(pagination.pageSize);\n\n const relevantSorter = Array.isArray(sorter) ? sorter[0] : sorter;\n if (relevantSorter.column && relevantSorter.order) {\n const newSort = {\n field: AttributesSortableFields[relevantSorter.columnKey],\n order: relevantSorter.order === 'ascend' ? SortOrder.asc : SortOrder.desc,\n };\n setSort(newSort);\n }\n\n const newFilters: GetAttributesQueryVariables['filters'] = {};\n for (const [field, filterValue] of Object.entries(filter)) {\n if (filterValue) {\n newFilters[field] = filterValue;\n }\n }\n setFilters(newFilters);\n };\n\n if (error || isAllowedQueryResult.error) {\n return <ErrorDisplay message={error?.message || isAllowedQueryResult?.error?.message} />;\n }\n\n const columns: TableColumnsType<ListAttributeType> = [\n {\n title: t('attributes.attribute'),\n key: 'attribute',\n render: (_, attribute) => {\n const attributeIdentity: IEntityData = {\n label: attribute.label,\n subLabel: attribute.id,\n preview: null,\n color: null,\n };\n return <EntityCard entity={attributeIdentity} size={PreviewSize.SMALL} />;\n },\n },\n {\n title: t('attributes.type'),\n dataIndex: 'type',\n key: 'type',\n width: '150px',\n render: (type: AttributeType) => (\n <KitTag\n style={{\n borderColor: tagColorByAttributeType[type][0],\n backgroundColor: tagColorByAttributeType[type][1],\n }}\n idCardProps={{\n description: t(`attributes.type_${type}`),\n }}\n />\n ),\n filters: Object.values(AttributeType).map(type => ({\n text: t(`attributes.type_${type}`),\n value: type,\n })),\n onFilter: (value, record) => record.type === value,\n sorter: (a, b) => {\n const aTypeLabel = t(`attributes.type_${a.type}`);\n const bTypeLabel = t(`attributes.type_${b.type}`);\n\n return aTypeLabel.localeCompare(bTypeLabel);\n },\n },\n {\n title: t('attributes.format'),\n dataIndex: 'format',\n key: 'format',\n width: '150px',\n render: (format: AttributeFormat) =>\n format ? (\n <KitTag\n style={{\n borderColor: tagColorByAttributeFormat[format][0],\n backgroundColor: tagColorByAttributeFormat[format][1],\n }}\n idCardProps={{\n description: t(`attributes.format_${format}`),\n }}\n />\n ) : null,\n filters: Object.values(AttributeFormat).map(format => ({\n text: t(`attributes.format_${format}`),\n value: format,\n })),\n onFilter: (value, record) => record.format === value,\n sorter: (a, b) => {\n const aFormatLabel = t(`attributes.format_${a.format}`);\n const bFormatLabel = t(`attributes.format_${b.format}`);\n\n return aFormatLabel.localeCompare(bFormatLabel);\n },\n },\n ];\n\n useEffect(() => {\n // To avoid temporary display of \"no data\" when pagination changes\n if (loading || !data) {\n return;\n }\n\n const newTableData = data?.attributes?.list\n ? [...data.attributes.list].map(attribute => ({\n ...attribute,\n key: attribute.id,\n label: localizedTranslation(attribute.label, lang),\n }))\n : [];\n\n setTableData(newTableData);\n }, [loading, data]);\n\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n }\n }, [inputRef]);\n\n const tableHeader = (\n <HeaderWrapper>\n <KitInput\n onPressEnter={_handleSearchSubmit}\n onChange={_handleSearchChange}\n placeholder={t('global.search') + '...'}\n allowClear\n suffix={<SearchOutlined />}\n // @ts-ignore - ref is a valid prop\n ref={inputRef}\n />\n {canCreate && (\n <KitButton type=\"primary\" icon={<PlusOutlined />} onClick={_handleClickNewAttribute}>\n {t('attributes.new_attribute')}\n </KitButton>\n )}\n </HeaderWrapper>\n );\n\n return (\n <>\n <Table\n loading={loading}\n size=\"middle\"\n rowSelection={{\n type: multiple ? 'checkbox' : 'radio',\n selectedRowKeys,\n onChange: _handleSelectionChange,\n }}\n columns={columns}\n dataSource={tableData}\n bordered\n pagination={{\n position: ['bottomCenter'],\n pageSize,\n current: currentPage,\n total: data?.attributes?.totalCount ?? 0,\n showTotal: total => t('global.total_count', {total}),\n }}\n scroll={{y: 'calc(95vh - 20rem)'}}\n title={() => tableHeader}\n onRow={record => ({\n onClick: () => _handleRowClick(record),\n })}\n onChange={_handleChange}\n />\n {isNewAttributeModalOpen && (\n <EditAttributeModal\n open={isNewAttributeModalOpen}\n onClose={_handleCloseNewAttribute}\n onPostCreate={_handlePostCreate}\n width={790}\n />\n )}\n </>\n );\n}\n\nexport default AttributesList;\n"]}
1
+ {"version":3,"file":"AttributesList.js","sourceRoot":"","sources":["../../../../src/components/AttributePicker/AttributesList/AttributesList.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAC,eAAe,EAA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,EAAE,GAAG,EAAE,CAAC,WAAW,EACxB,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;oBACd,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC;iBACzC,CAAC,EACF,QAAQ,EAAE,aAAa,GACzB,EACD,uBAAuB,IAAI,CACxB,KAAC,kBAAkB,IACf,IAAI,EAAE,uBAAuB,EAC7B,OAAO,EAAE,wBAAwB,EACjC,YAAY,EAAE,iBAAiB,EAC/B,KAAK,EAAE,GAAG,GACZ,CACL,IACF,CACN,CAAC;AACN,CAAC;AAED,eAAe,cAAc,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {PlusOutlined, SearchOutlined} from '@ant-design/icons';\nimport {useApolloClient} from '@apollo/client';\nimport {localizedTranslation, type Override} from '@leav/utils';\nimport {Table, type TableColumnsType, type TablePaginationConfig} from 'antd';\nimport {type FilterValue, type SorterResult} from 'antd/lib/table/interface';\nimport {KitButton, KitIdCard, KitInput, KitTag} from 'aristid-ds';\nimport {type Key, useEffect, useRef, useState} from 'react';\nimport styled from 'styled-components';\nimport {\n defaultPaginationPageSize,\n PreviewSize,\n tagColorByAttributeFormat,\n tagColorByAttributeType,\n} from '../../../constants';\nimport {useLang} from '../../../hooks';\nimport {useSharedTranslation} from '../../../hooks/useSharedTranslation';\nimport {\n type AttributeDetailsFragment,\n AttributeFormat,\n AttributesSortableFields,\n AttributeType,\n type GetAttributesQuery,\n type GetAttributesQueryVariables,\n PermissionsActions,\n PermissionTypes,\n SortOrder,\n useGetAttributesQuery,\n useIsAllowedQuery,\n} from '../../../_gqlTypes';\nimport {getAttributesQuery} from '../../../_queries/attributes/getAttributesQuery';\nimport {extractPermissionFromQuery} from '../../../_utils';\nimport {EditAttributeModal} from '../../EditAttributeModal';\nimport {EntityCard, type IEntityData} from '../../EntityCard';\nimport {ErrorDisplay} from '../../ErrorDisplay';\n\nconst HeaderWrapper = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 0.5rem;\n\n .kit-input-wrapper {\n flex-grow: 1;\n }\n`;\n\ntype ListAttributeType = Override<GetAttributesQuery['attributes']['list'][number], {label: string}> & {key: string};\n\ninterface IAttributesListProps {\n onSelect: (selectedAttributes: string[]) => void;\n selected?: string[];\n multiple?: boolean;\n showCreateButton?: boolean;\n baseFilters?: GetAttributesQueryVariables['filters'];\n}\n\nfunction AttributesList({\n onSelect,\n selected = [],\n multiple = true,\n showCreateButton = true,\n baseFilters,\n}: IAttributesListProps): JSX.Element {\n const {t} = useSharedTranslation();\n const {lang} = useLang();\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [pageSize, setPageSize] = useState(defaultPaginationPageSize);\n const [currentPage, setCurrentPage] = useState(1);\n const [sort, setSort] = useState<GetAttributesQueryVariables['sort']>();\n const [filters, setFilters] = useState<GetAttributesQueryVariables['filters']>({});\n const [tableData, setTableData] = useState<ListAttributeType[]>([]);\n\n const {loading, error, data} = useGetAttributesQuery({\n variables: {\n pagination: {\n limit: pageSize,\n offset: (currentPage - 1) * pageSize,\n },\n sort,\n filters: {\n ...filters,\n ...baseFilters,\n },\n },\n });\n\n const isAllowedQueryResult = useIsAllowedQuery({\n fetchPolicy: 'cache-and-network',\n variables: {\n type: PermissionTypes.admin,\n actions: [PermissionsActions.admin_create_attribute],\n },\n });\n const canCreate =\n showCreateButton && extractPermissionFromQuery(isAllowedQueryResult, PermissionsActions.admin_create_attribute);\n\n const [selectedRowKeys, setSelectedRowKeys] = useState<Key[]>(selected);\n const [isNewAttributeModalOpen, setIsNewAttributeModalOpen] = useState(false);\n const client = useApolloClient();\n\n const _handleSelectionChange = (selection: Key[]) => {\n setSelectedRowKeys(selection);\n onSelect(selection as string[]);\n };\n\n const _handleRowClick = (record: ListAttributeType) => {\n let newSelection;\n\n if (selectedRowKeys.indexOf(record.key) === -1) {\n newSelection = multiple ? [...selectedRowKeys, record.key] : [record.key]; // Add to selection\n } else {\n newSelection = multiple ? selectedRowKeys.filter(key => key !== record.key) : []; // Remove from selection\n }\n\n setSelectedRowKeys(newSelection);\n onSelect(newSelection as string[]);\n };\n\n const _handleSearchSubmit = (e: React.SyntheticEvent<HTMLInputElement>) => {\n setFilters({\n ...filters,\n label: `%${e.currentTarget.value}%`,\n });\n };\n\n const _handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n // Handle clearing input only. Submitting input is otherwise handled by \"onPressEnter\"\n if (!e.currentTarget.value) {\n _handleSearchSubmit(e);\n }\n };\n\n const _handleClickNewAttribute = () => {\n setIsNewAttributeModalOpen(true);\n };\n const _handleCloseNewAttribute = () => setIsNewAttributeModalOpen(false);\n\n const _handlePostCreate = async (newAttribute: AttributeDetailsFragment) => {\n const allAttributesData = client.readQuery<GetAttributesQuery>({query: getAttributesQuery});\n\n if (allAttributesData) {\n client.writeQuery({\n query: getAttributesQuery,\n data: {\n attributes: {\n ...allAttributesData.attributes,\n list: [newAttribute, ...allAttributesData.attributes.list],\n },\n },\n });\n }\n const newSelection = [...selectedRowKeys, newAttribute.id];\n onSelect(newSelection as string[]);\n setSelectedRowKeys(newSelection);\n };\n\n const _handleChange = (\n pagination: TablePaginationConfig,\n filter: Record<string, FilterValue | null>,\n sorter: SorterResult<ListAttributeType> | Array<SorterResult<ListAttributeType>>,\n ) => {\n setCurrentPage(pagination.current);\n setPageSize(pagination.pageSize);\n\n const relevantSorter = Array.isArray(sorter) ? sorter[0] : sorter;\n if (relevantSorter.column && relevantSorter.order) {\n const newSort = {\n field: AttributesSortableFields[relevantSorter.columnKey],\n order: relevantSorter.order === 'ascend' ? SortOrder.asc : SortOrder.desc,\n };\n setSort(newSort);\n }\n\n const newFilters: GetAttributesQueryVariables['filters'] = {};\n for (const [field, filterValue] of Object.entries(filter)) {\n if (filterValue) {\n newFilters[field] = filterValue;\n }\n }\n setFilters(newFilters);\n };\n\n if (error || isAllowedQueryResult.error) {\n return <ErrorDisplay message={error?.message || isAllowedQueryResult?.error?.message} />;\n }\n\n const columns: TableColumnsType<ListAttributeType> = [\n {\n title: t('attributes.attribute'),\n key: 'attribute',\n render: (_, attribute) => {\n const attributeIdentity: IEntityData = {\n label: attribute.label,\n subLabel: attribute.id,\n preview: null,\n color: null,\n };\n return <EntityCard entity={attributeIdentity} size={PreviewSize.SMALL} />;\n },\n },\n {\n title: t('attributes.type'),\n dataIndex: 'type',\n key: 'type',\n width: '150px',\n render: (type: AttributeType) => (\n <KitTag\n style={{\n borderColor: tagColorByAttributeType[type][0],\n backgroundColor: tagColorByAttributeType[type][1],\n }}\n >\n <KitIdCard description={t(`attributes.type_${type}`)} />\n </KitTag>\n ),\n filters: Object.values(AttributeType).map(type => ({\n text: t(`attributes.type_${type}`),\n value: type,\n })),\n onFilter: (value, record) => record.type === value,\n sorter: (a, b) => {\n const aTypeLabel = t(`attributes.type_${a.type}`);\n const bTypeLabel = t(`attributes.type_${b.type}`);\n\n return aTypeLabel.localeCompare(bTypeLabel);\n },\n },\n {\n title: t('attributes.format'),\n dataIndex: 'format',\n key: 'format',\n width: '150px',\n render: (format: AttributeFormat) =>\n format ? (\n <KitTag\n style={{\n borderColor: tagColorByAttributeFormat[format][0],\n backgroundColor: tagColorByAttributeFormat[format][1],\n }}\n >\n <KitIdCard description={t(`attributes.format_${format}`)} />\n </KitTag>\n ) : null,\n filters: Object.values(AttributeFormat).map(format => ({\n text: t(`attributes.format_${format}`),\n value: format,\n })),\n onFilter: (value, record) => record.format === value,\n sorter: (a, b) => {\n const aFormatLabel = t(`attributes.format_${a.format}`);\n const bFormatLabel = t(`attributes.format_${b.format}`);\n\n return aFormatLabel.localeCompare(bFormatLabel);\n },\n },\n ];\n\n useEffect(() => {\n // To avoid temporary display of \"no data\" when pagination changes\n if (loading || !data) {\n return;\n }\n\n const newTableData = data?.attributes?.list\n ? [...data.attributes.list].map(attribute => ({\n ...attribute,\n key: attribute.id,\n label: localizedTranslation(attribute.label, lang),\n }))\n : [];\n\n setTableData(newTableData);\n }, [loading, data]);\n\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n }\n }, [inputRef]);\n\n const tableHeader = (\n <HeaderWrapper>\n <KitInput\n onPressEnter={_handleSearchSubmit}\n onChange={_handleSearchChange}\n placeholder={t('global.search') + '...'}\n allowClear\n suffix={<SearchOutlined />}\n // @ts-ignore - ref is a valid prop\n ref={inputRef}\n />\n {canCreate && (\n <KitButton type=\"primary\" icon={<PlusOutlined />} onClick={_handleClickNewAttribute}>\n {t('attributes.new_attribute')}\n </KitButton>\n )}\n </HeaderWrapper>\n );\n\n return (\n <>\n <Table\n loading={loading}\n size=\"middle\"\n rowSelection={{\n type: multiple ? 'checkbox' : 'radio',\n selectedRowKeys,\n onChange: _handleSelectionChange,\n }}\n columns={columns}\n dataSource={tableData}\n bordered\n pagination={{\n position: ['bottomCenter'],\n pageSize,\n current: currentPage,\n total: data?.attributes?.totalCount ?? 0,\n showTotal: total => t('global.total_count', {total}),\n }}\n scroll={{y: 'calc(95vh - 20rem)'}}\n title={() => tableHeader}\n onRow={record => ({\n onClick: () => _handleRowClick(record),\n })}\n onChange={_handleChange}\n />\n {isNewAttributeModalOpen && (\n <EditAttributeModal\n open={isNewAttributeModalOpen}\n onClose={_handleCloseNewAttribute}\n onPostCreate={_handlePostCreate}\n width={790}\n />\n )}\n </>\n );\n}\n\nexport default AttributesList;\n"]}
@@ -5,7 +5,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  import { PlusOutlined, SearchOutlined } from '@ant-design/icons';
6
6
  import { localizedTranslation } from '@leav/utils';
7
7
  import { Table } from 'antd';
8
- import { KitButton, KitInput, KitTag } from 'aristid-ds';
8
+ import { KitButton, KitIdCard, KitInput, KitTag } from 'aristid-ds';
9
9
  import { useEffect, useRef, useState } from 'react';
10
10
  import styled from 'styled-components';
11
11
  import { defaultPaginationPageSize, tagColorByAttributeFormat, tagColorByAttributeType } from '../../../../../constants';
@@ -111,9 +111,7 @@ function AttributesList({ library, readOnly, onDeleteAttribute, onAddAttributes
111
111
  render: (type) => (_jsx(KitTag, { style: {
112
112
  borderColor: tagColorByAttributeType[type][0],
113
113
  backgroundColor: tagColorByAttributeType[type][1],
114
- }, idCardProps: {
115
- description: t(`attributes.type_${type}`),
116
- } })),
114
+ }, children: _jsx(KitIdCard, { description: t(`attributes.type_${type}`) }) })),
117
115
  filters: Object.values(AttributeType).map(type => ({
118
116
  text: t(`attributes.type_${type}`),
119
117
  value: type,
@@ -133,9 +131,7 @@ function AttributesList({ library, readOnly, onDeleteAttribute, onAddAttributes
133
131
  render: (format) => format ? (_jsx(KitTag, { style: {
134
132
  borderColor: tagColorByAttributeFormat[format][0],
135
133
  backgroundColor: tagColorByAttributeFormat[format][1],
136
- }, idCardProps: {
137
- description: t(`attributes.format_${format}`),
138
- } })) : null,
134
+ }, children: _jsx(KitIdCard, { description: t(`attributes.format_${format}`) }) })) : null,
139
135
  filters: Object.values(AttributeFormat).map(format => ({
140
136
  text: t(`attributes.format_${format}`),
141
137
  value: format,
@@ -1 +1 @@
1
- {"version":3,"file":"AttributesList.js","sourceRoot":"","sources":["../../../../../../src/components/EditLibraryModal/EditLibrary/EditLibraryAttributes/AttributesList/AttributesList.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAC,oBAAoB,EAAgB,MAAM,aAAa,CAAC;AAChE,OAAO,EAAC,KAAK,EAAoD,MAAM,MAAM,CAAC;AAE9E,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AACvD,OAAO,EAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC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oBACR,QAAQ,EAAE,CAAC,cAAc,CAAC;oBAC1B,QAAQ;oBACR,OAAO,EAAE,WAAW;oBACpB,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,IAAI,CAAC;oBACxC,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,oBAAoB,EAAE,EAAC,KAAK,EAAC,CAAC;iBACvD,EACD,MAAM,EAAE,EAAC,CAAC,EAAE,oBAAoB,EAAC,EACjC,KAAK,EAAE,GAAG,EAAE,CAAC,WAAW,EACxB,QAAQ,EAAE,aAAa,GACzB,EACD,uBAAuB,IAAI,CACxB,KAAC,eAAe,IACZ,QAAQ,QACR,OAAO,EAAE,6BAA6B,EACtC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,uBAAuB,EAC7B,WAAW,EAAE,EAAC,iBAAiB,EAAE,CAAC,OAAO,CAAC,EAAC,GAC7C,CACL,IACK,CACb,CAAC;AACN,CAAC;AAED,eAAe,cAAc,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {PlusOutlined, SearchOutlined} from '@ant-design/icons';\nimport {localizedTranslation, type Override} from '@leav/utils';\nimport {Table, type TableColumnsType, type TablePaginationConfig} from 'antd';\nimport {type FilterValue, type SorterResult} from 'antd/es/table/interface';\nimport {KitButton, KitInput, KitTag} from 'aristid-ds';\nimport {useEffect, useRef, useState} from 'react';\nimport styled from 'styled-components';\nimport {defaultPaginationPageSize, tagColorByAttributeFormat, tagColorByAttributeType} from '../../../../../constants';\nimport {useLang} from '../../../../../hooks';\nimport {useSharedTranslation} from '../../../../../hooks/useSharedTranslation';\nimport {\n AttributeFormat,\n AttributesSortableFields,\n AttributeType,\n type GetAttributesQuery,\n type GetAttributesQueryVariables,\n type LibraryAttributesFragment,\n SortOrder,\n useGetAttributesQuery,\n} from '../../../../../_gqlTypes';\nimport {AttributePicker} from '../../../../AttributePicker';\nimport {AttributeCell} from './AttributeCell';\nimport {DeleteButton} from './DeleteButton';\n\ninterface IAttributesListProps {\n readOnly: boolean;\n library: string;\n onDeleteAttribute: (attribute: LibraryAttributesFragment) => Promise<void>;\n onAddAttributes: (attributes: string[]) => Promise<void>;\n}\n\nconst HeaderWrapper = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 0.5rem;\n\n .kit-input-wrapper {\n flex-grow: 1;\n }\n`;\n\n// To fix a cosmetic issue with the table header (see https://github.com/ant-design/ant-design/issues/41975)\nconst Wrapper = styled.div`\n && .ant-table-header {\n border-radius: 0;\n }\n`;\n\nexport type AttributeListType = Override<GetAttributesQuery['attributes']['list'][number], {label: string}> & {\n key: string;\n};\n\nfunction AttributesList({library, readOnly, onDeleteAttribute, onAddAttributes}: IAttributesListProps): JSX.Element {\n const {t} = useSharedTranslation();\n const {lang} = useLang();\n const [isAddAttributeModalOpen, setIsAddAttributeModalOpen] = useState(false);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [pageSize, setPageSize] = useState(defaultPaginationPageSize);\n const [currentPage, setCurrentPage] = useState(1);\n const [sort, setSort] = useState<GetAttributesQueryVariables['sort']>();\n const [filters, setFilters] = useState<GetAttributesQueryVariables['filters']>({});\n const [tableData, setTableData] = useState<AttributeListType[]>([]);\n\n const {loading, error, data, refetch} = useGetAttributesQuery({\n variables: {\n pagination: {\n limit: pageSize,\n offset: (currentPage - 1) * pageSize,\n },\n sort,\n filters: {\n ...filters,\n libraries: [library],\n },\n },\n });\n\n const _handleSubmitAddAttribute = async (selectedAttributes: string[]) => {\n await onAddAttributes(selectedAttributes);\n refetch();\n };\n\n const _handleDeleteAttribute = (attribute: LibraryAttributesFragment) => async () => {\n await onDeleteAttribute(attribute);\n refetch();\n };\n\n const _handleClickNewAttribute = () => {\n setIsAddAttributeModalOpen(true);\n };\n\n const _handleCloseAddAttributeModal = () => setIsAddAttributeModalOpen(false);\n\n const _handleChange = (\n pagination: TablePaginationConfig,\n filter: Record<string, FilterValue | null>,\n sorter: SorterResult<AttributeListType> | Array<SorterResult<AttributeListType>>,\n ) => {\n setCurrentPage(pagination.current);\n setPageSize(pagination.pageSize);\n\n const relevantSorter = Array.isArray(sorter) ? sorter[0] : sorter;\n if (relevantSorter.column && relevantSorter.order) {\n const newSort = {\n field: AttributesSortableFields[relevantSorter.columnKey],\n order: relevantSorter.order === 'ascend' ? SortOrder.asc : SortOrder.desc,\n };\n setSort(newSort);\n }\n\n const newFilters: GetAttributesQueryVariables['filters'] = {};\n for (const [field, filterValue] of Object.entries(filter)) {\n if (filterValue) {\n newFilters[field] = filterValue;\n }\n }\n setFilters(newFilters);\n };\n\n const _handleSearchSubmit = (e: React.SyntheticEvent<HTMLInputElement>) => {\n setFilters({\n ...filters,\n label: `%${e.currentTarget.value}%`,\n });\n };\n\n const _handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n // Handle clearing input only. Submitting input is otherwise handled by \"onPressEnter\"\n if (!e.currentTarget.value) {\n _handleSearchSubmit(e);\n }\n };\n\n const columns: TableColumnsType<AttributeListType> = [\n {\n title: t('attributes.attribute'),\n key: 'label',\n render: (_, attribute) => <AttributeCell attribute={attribute} />,\n },\n {\n title: t('attributes.type'),\n dataIndex: 'type',\n key: 'type',\n width: '150px',\n render: (type: AttributeType) => (\n <KitTag\n style={{\n borderColor: tagColorByAttributeType[type][0],\n backgroundColor: tagColorByAttributeType[type][1],\n }}\n idCardProps={{\n description: t(`attributes.type_${type}`),\n }}\n />\n ),\n filters: Object.values(AttributeType).map(type => ({\n text: t(`attributes.type_${type}`),\n value: type,\n })),\n onFilter: (value, record) => record.type === value,\n sorter: (a, b) => {\n const aTypeLabel = t(`attributes.type_${a.type}`);\n const bTypeLabel = t(`attributes.type_${b.type}`);\n\n return aTypeLabel.localeCompare(bTypeLabel);\n },\n },\n {\n title: t('attributes.format'),\n dataIndex: 'format',\n key: 'format',\n width: '150px',\n render: (format: AttributeFormat) =>\n format ? (\n <KitTag\n style={{\n borderColor: tagColorByAttributeFormat[format][0],\n backgroundColor: tagColorByAttributeFormat[format][1],\n }}\n idCardProps={{\n description: t(`attributes.format_${format}`),\n }}\n />\n ) : null,\n filters: Object.values(AttributeFormat).map(format => ({\n text: t(`attributes.format_${format}`),\n value: format,\n })),\n onFilter: (value, record) => record.format === value,\n sorter: (a, b) => {\n const aFormatLabel = t(`attributes.format_${a.format}`);\n const bFormatLabel = t(`attributes.format_${b.format}`);\n\n return aFormatLabel.localeCompare(bFormatLabel);\n },\n },\n {\n key: 'delete',\n title: <span></span>,\n dataIndex: 'id',\n width: '50px',\n align: 'center',\n render: (_, attribute) => (\n <DeleteButton readOnly={readOnly} attribute={attribute} onDelete={_handleDeleteAttribute(attribute)} />\n ),\n },\n ];\n\n useEffect(() => {\n // To avoid temporary display of \"no data\" when pagination changes\n if (loading || !data) {\n return;\n }\n\n const newTableData = data?.attributes?.list\n ? [...data.attributes.list].map(attribute => ({\n ...attribute,\n key: attribute.id,\n label: localizedTranslation(attribute.label, lang),\n }))\n : [];\n\n setTableData(newTableData);\n }, [loading, data]);\n\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n }\n }, [inputRef]);\n\n const tableHeader = (\n <HeaderWrapper>\n <KitInput\n onPressEnter={_handleSearchSubmit}\n onChange={_handleSearchChange}\n placeholder={t('global.search') + '...'}\n allowClear\n suffix={<SearchOutlined />}\n // @ts-ignore - ref is a valid prop\n ref={inputRef}\n />\n {!readOnly && (\n <KitButton type=\"primary\" icon={<PlusOutlined />} onClick={_handleClickNewAttribute}>\n {t('attributes.add_attribute')}\n </KitButton>\n )}\n </HeaderWrapper>\n );\n\n return (\n <Wrapper>\n <Table\n loading={loading}\n size=\"middle\"\n columns={columns}\n dataSource={tableData}\n bordered\n pagination={{\n position: ['bottomCenter'],\n pageSize,\n current: currentPage,\n total: data?.attributes?.totalCount ?? 0,\n showTotal: total => t('global.total_count', {total}),\n }}\n scroll={{y: 'calc(95vh - 26rem)'}}\n title={() => tableHeader}\n onChange={_handleChange}\n />\n {isAddAttributeModalOpen && (\n <AttributePicker\n multiple\n onClose={_handleCloseAddAttributeModal}\n onSubmit={_handleSubmitAddAttribute}\n open={isAddAttributeModalOpen}\n baseFilters={{librariesExcluded: [library]}}\n />\n )}\n </Wrapper>\n );\n}\n\nexport default AttributesList;\n"]}
1
+ {"version":3,"file":"AttributesList.js","sourceRoot":"","sources":["../../../../../../src/components/EditLibraryModal/EditLibrary/EditLibraryAttributes/AttributesList/AttributesList.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAC,oBAAoB,EAAgB,MAAM,aAAa,CAAC;AAChE,OAAO,EAAC,KAAK,EAAoD,MAAM,MAAM,CAAC;AAE9E,OAAO,EAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AAClE,OAAO,EAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,yBAAyB,EAAE,yBAAyB,EAAE,uBAAuB,EAAC,MAAM,0BAA0B,CAAC;AACvH,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAC,oBAAoB,EAAC,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EACH,eAAe,EACf,wBAAwB,EACxB,aAAa,EAIb,SAAS,EACT,qBAAqB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAS5C,MAAM,aAAa,GAAG,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,EAAE,yBAAyB,EACnC,IAAI,EAAE,uBAAuB,EAC7B,WAAW,EAAE,EAAC,iBAAiB,EAAE,CAAC,OAAO,CAAC,EAAC,GAC7C,CACL,IACK,CACb,CAAC;AACN,CAAC;AAED,eAAe,cAAc,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {PlusOutlined, SearchOutlined} from '@ant-design/icons';\nimport {localizedTranslation, type Override} from '@leav/utils';\nimport {Table, type TableColumnsType, type TablePaginationConfig} from 'antd';\nimport {type FilterValue, type SorterResult} from 'antd/es/table/interface';\nimport {KitButton, KitIdCard, KitInput, KitTag} from 'aristid-ds';\nimport {useEffect, useRef, useState} from 'react';\nimport styled from 'styled-components';\nimport {defaultPaginationPageSize, tagColorByAttributeFormat, tagColorByAttributeType} from '../../../../../constants';\nimport {useLang} from '../../../../../hooks';\nimport {useSharedTranslation} from '../../../../../hooks/useSharedTranslation';\nimport {\n AttributeFormat,\n AttributesSortableFields,\n AttributeType,\n type GetAttributesQuery,\n type GetAttributesQueryVariables,\n type LibraryAttributesFragment,\n SortOrder,\n useGetAttributesQuery,\n} from '../../../../../_gqlTypes';\nimport {AttributePicker} from '../../../../AttributePicker';\nimport {AttributeCell} from './AttributeCell';\nimport {DeleteButton} from './DeleteButton';\n\ninterface IAttributesListProps {\n readOnly: boolean;\n library: string;\n onDeleteAttribute: (attribute: LibraryAttributesFragment) => Promise<void>;\n onAddAttributes: (attributes: string[]) => Promise<void>;\n}\n\nconst HeaderWrapper = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 0.5rem;\n\n .kit-input-wrapper {\n flex-grow: 1;\n }\n`;\n\n// To fix a cosmetic issue with the table header (see https://github.com/ant-design/ant-design/issues/41975)\nconst Wrapper = styled.div`\n && .ant-table-header {\n border-radius: 0;\n }\n`;\n\nexport type AttributeListType = Override<GetAttributesQuery['attributes']['list'][number], {label: string}> & {\n key: string;\n};\n\nfunction AttributesList({library, readOnly, onDeleteAttribute, onAddAttributes}: IAttributesListProps): JSX.Element {\n const {t} = useSharedTranslation();\n const {lang} = useLang();\n const [isAddAttributeModalOpen, setIsAddAttributeModalOpen] = useState(false);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n const [pageSize, setPageSize] = useState(defaultPaginationPageSize);\n const [currentPage, setCurrentPage] = useState(1);\n const [sort, setSort] = useState<GetAttributesQueryVariables['sort']>();\n const [filters, setFilters] = useState<GetAttributesQueryVariables['filters']>({});\n const [tableData, setTableData] = useState<AttributeListType[]>([]);\n\n const {loading, error, data, refetch} = useGetAttributesQuery({\n variables: {\n pagination: {\n limit: pageSize,\n offset: (currentPage - 1) * pageSize,\n },\n sort,\n filters: {\n ...filters,\n libraries: [library],\n },\n },\n });\n\n const _handleSubmitAddAttribute = async (selectedAttributes: string[]) => {\n await onAddAttributes(selectedAttributes);\n refetch();\n };\n\n const _handleDeleteAttribute = (attribute: LibraryAttributesFragment) => async () => {\n await onDeleteAttribute(attribute);\n refetch();\n };\n\n const _handleClickNewAttribute = () => {\n setIsAddAttributeModalOpen(true);\n };\n\n const _handleCloseAddAttributeModal = () => setIsAddAttributeModalOpen(false);\n\n const _handleChange = (\n pagination: TablePaginationConfig,\n filter: Record<string, FilterValue | null>,\n sorter: SorterResult<AttributeListType> | Array<SorterResult<AttributeListType>>,\n ) => {\n setCurrentPage(pagination.current);\n setPageSize(pagination.pageSize);\n\n const relevantSorter = Array.isArray(sorter) ? sorter[0] : sorter;\n if (relevantSorter.column && relevantSorter.order) {\n const newSort = {\n field: AttributesSortableFields[relevantSorter.columnKey],\n order: relevantSorter.order === 'ascend' ? SortOrder.asc : SortOrder.desc,\n };\n setSort(newSort);\n }\n\n const newFilters: GetAttributesQueryVariables['filters'] = {};\n for (const [field, filterValue] of Object.entries(filter)) {\n if (filterValue) {\n newFilters[field] = filterValue;\n }\n }\n setFilters(newFilters);\n };\n\n const _handleSearchSubmit = (e: React.SyntheticEvent<HTMLInputElement>) => {\n setFilters({\n ...filters,\n label: `%${e.currentTarget.value}%`,\n });\n };\n\n const _handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n // Handle clearing input only. Submitting input is otherwise handled by \"onPressEnter\"\n if (!e.currentTarget.value) {\n _handleSearchSubmit(e);\n }\n };\n\n const columns: TableColumnsType<AttributeListType> = [\n {\n title: t('attributes.attribute'),\n key: 'label',\n render: (_, attribute) => <AttributeCell attribute={attribute} />,\n },\n {\n title: t('attributes.type'),\n dataIndex: 'type',\n key: 'type',\n width: '150px',\n render: (type: AttributeType) => (\n <KitTag\n style={{\n borderColor: tagColorByAttributeType[type][0],\n backgroundColor: tagColorByAttributeType[type][1],\n }}\n >\n <KitIdCard description={t(`attributes.type_${type}`)} />\n </KitTag>\n ),\n filters: Object.values(AttributeType).map(type => ({\n text: t(`attributes.type_${type}`),\n value: type,\n })),\n onFilter: (value, record) => record.type === value,\n sorter: (a, b) => {\n const aTypeLabel = t(`attributes.type_${a.type}`);\n const bTypeLabel = t(`attributes.type_${b.type}`);\n\n return aTypeLabel.localeCompare(bTypeLabel);\n },\n },\n {\n title: t('attributes.format'),\n dataIndex: 'format',\n key: 'format',\n width: '150px',\n render: (format: AttributeFormat) =>\n format ? (\n <KitTag\n style={{\n borderColor: tagColorByAttributeFormat[format][0],\n backgroundColor: tagColorByAttributeFormat[format][1],\n }}\n >\n <KitIdCard description={t(`attributes.format_${format}`)} />\n </KitTag>\n ) : null,\n filters: Object.values(AttributeFormat).map(format => ({\n text: t(`attributes.format_${format}`),\n value: format,\n })),\n onFilter: (value, record) => record.format === value,\n sorter: (a, b) => {\n const aFormatLabel = t(`attributes.format_${a.format}`);\n const bFormatLabel = t(`attributes.format_${b.format}`);\n\n return aFormatLabel.localeCompare(bFormatLabel);\n },\n },\n {\n key: 'delete',\n title: <span></span>,\n dataIndex: 'id',\n width: '50px',\n align: 'center',\n render: (_, attribute) => (\n <DeleteButton readOnly={readOnly} attribute={attribute} onDelete={_handleDeleteAttribute(attribute)} />\n ),\n },\n ];\n\n useEffect(() => {\n // To avoid temporary display of \"no data\" when pagination changes\n if (loading || !data) {\n return;\n }\n\n const newTableData = data?.attributes?.list\n ? [...data.attributes.list].map(attribute => ({\n ...attribute,\n key: attribute.id,\n label: localizedTranslation(attribute.label, lang),\n }))\n : [];\n\n setTableData(newTableData);\n }, [loading, data]);\n\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n }\n }, [inputRef]);\n\n const tableHeader = (\n <HeaderWrapper>\n <KitInput\n onPressEnter={_handleSearchSubmit}\n onChange={_handleSearchChange}\n placeholder={t('global.search') + '...'}\n allowClear\n suffix={<SearchOutlined />}\n // @ts-ignore - ref is a valid prop\n ref={inputRef}\n />\n {!readOnly && (\n <KitButton type=\"primary\" icon={<PlusOutlined />} onClick={_handleClickNewAttribute}>\n {t('attributes.add_attribute')}\n </KitButton>\n )}\n </HeaderWrapper>\n );\n\n return (\n <Wrapper>\n <Table\n loading={loading}\n size=\"middle\"\n columns={columns}\n dataSource={tableData}\n bordered\n pagination={{\n position: ['bottomCenter'],\n pageSize,\n current: currentPage,\n total: data?.attributes?.totalCount ?? 0,\n showTotal: total => t('global.total_count', {total}),\n }}\n scroll={{y: 'calc(95vh - 26rem)'}}\n title={() => tableHeader}\n onChange={_handleChange}\n />\n {isAddAttributeModalOpen && (\n <AttributePicker\n multiple\n onClose={_handleCloseAddAttributeModal}\n onSubmit={_handleSubmitAddAttribute}\n open={isAddAttributeModalOpen}\n baseFilters={{librariesExcluded: [library]}}\n />\n )}\n </Wrapper>\n );\n}\n\nexport default AttributesList;\n"]}
@@ -6,7 +6,7 @@ import { useCallback } from 'react';
6
6
  import { AttributeFormat, AttributeType, MultiDisplayOption, } from '../../_gqlTypes';
7
7
  import { useSharedTranslation } from '../../hooks/useSharedTranslation';
8
8
  import DOMPurify from 'dompurify';
9
- import { KitAvatar, KitBadge, KitSpace, KitTag, KitTypography } from 'aristid-ds';
9
+ import { KitAvatar, KitBadge, KitIdCard, KitSpace, KitTag, KitTypography } from 'aristid-ds';
10
10
  import styled from 'styled-components';
11
11
  import { IdCard } from './IdCard';
12
12
  import { multiColorTagAvatarClassName, TableTagGroup } from './TableTagGroup';
@@ -56,28 +56,21 @@ export const TableCell = ({ values, attributeProperties }) => {
56
56
  switch (attributeProperties.format) {
57
57
  case AttributeFormat.boolean:
58
58
  return {
59
- idCardProps: {
60
- description: value.valuePayload ? String(t('global.yes')) : String(t('global.no')),
61
- },
59
+ children: (_jsx(KitIdCard, { description: value.valuePayload ? String(t('global.yes')) : String(t('global.no')) })),
62
60
  type: value.valuePayload ? 'primary' : 'neutral',
63
61
  };
64
62
  case AttributeFormat.color:
65
63
  const color = new AggregationColor(value.valueRawPayload);
66
64
  return {
67
- idCardProps: {
68
- description: value.valuePayload,
69
- avatarProps: {
65
+ children: (_jsx(KitIdCard, { description: value.valuePayload, avatarProps: {
70
66
  color: color.toHexString(),
71
67
  shape: 'square',
72
68
  className: multiColorTagAvatarClassName,
73
- },
74
- },
69
+ } })),
75
70
  };
76
71
  case AttributeFormat.date_range:
77
72
  return {
78
- idCardProps: {
79
- description: _getDateRangeValueContent(value.valuePayload),
80
- },
73
+ children: _jsx(KitIdCard, { description: _getDateRangeValueContent(value.valuePayload) }),
81
74
  type: 'primary',
82
75
  };
83
76
  default:
@@ -85,7 +78,7 @@ export const TableCell = ({ values, attributeProperties }) => {
85
78
  ? '●●●●●●●●●●●●'
86
79
  : value.valuePayload;
87
80
  return {
88
- idCardProps: { description: valueContent },
81
+ children: _jsx(KitIdCard, { description: valueContent }),
89
82
  type: 'primary',
90
83
  };
91
84
  }
@@ -97,7 +90,7 @@ export const TableCell = ({ values, attributeProperties }) => {
97
90
  case MultiDisplayOption.tag:
98
91
  return (_jsx(TableTagGroup, { tags: values.map(value => ({
99
92
  type: 'primary',
100
- idCardProps: { description: value.linkPayload?.whoAmI.label ?? undefined },
93
+ children: _jsx(KitIdCard, { description: value.linkPayload?.whoAmI.label ?? undefined }),
101
94
  })) }));
102
95
  case MultiDisplayOption.badge_qty:
103
96
  return _jsx(KitBadge, { overflowCount: Infinity, count: values.length, color: "primary" });
@@ -116,7 +109,7 @@ export const TableCell = ({ values, attributeProperties }) => {
116
109
  case MultiDisplayOption.tag:
117
110
  return (_jsx(TableTagGroup, { tags: values.map(value => ({
118
111
  type: 'primary',
119
- idCardProps: { description: value.treePayload?.record.whoAmI.label ?? undefined },
112
+ children: (_jsx(KitIdCard, { description: value.treePayload?.record.whoAmI.label ?? undefined })),
120
113
  })) }));
121
114
  case MultiDisplayOption.badge_qty:
122
115
  return _jsx(KitBadge, { overflowCount: Infinity, count: values.length, color: "primary" });
@@ -144,7 +137,7 @@ export const TableCell = ({ values, attributeProperties }) => {
144
137
  switch (attributeProperties.format) {
145
138
  case AttributeFormat.boolean:
146
139
  const valueToDisplay = value.valuePayload ? t('global.yes') : t('global.no');
147
- content = (_jsx(KitTag, { type: !!value.valuePayload ? 'primary' : 'neutral', idCardProps: { description: valueToDisplay } }, attributeProperties.id));
140
+ content = (_jsx(KitTag, { type: !!value.valuePayload ? 'primary' : 'neutral', children: _jsx(KitIdCard, { description: valueToDisplay }) }, attributeProperties.id));
148
141
  break;
149
142
  case AttributeFormat.rich_text:
150
143
  const tmp = document.createElement('div');
@@ -1 +1 @@
1
- {"version":3,"file":"TableCell.js","sourceRoot":"","sources":["../../../src/components/Explorer/TableCell.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyC,WAAW,EAAC,MAAM,OAAO,CAAC;AAC1E,OAAO,EACH,eAAe,EAEf,aAAa,EAKb,kBAAkB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,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mB,CAAC,EAAE,CAAC;YAC1C,OAAO,GAAG,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAC/C,KAAC,MAAM,IAA8B,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,IAA7D,mBAAmB,CAAC,EAAE,CAA2C,CACjF,CAAC,CAAC,CAAC,IAAI,CAAC;QACb,CAAC;QAED,IAAI,WAAW,CAAC,KAAK,EAAE,mBAAmB,CAAC,EAAE,CAAC;YAC1C,OAAO,GAAG,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAClC,KAAC,MAAM,IAA8B,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,IAAtD,mBAAmB,CAAC,EAAE,CAAoC,CAC1E,CAAC,CAAC,CAAC,IAAI,CAAC;QACb,CAAC;QAED,OAAO,KAAC,sBAAsB,cAAE,OAAO,GAA0B,CAAC;IACtE,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent, type ReactNode, useCallback} from 'react';\nimport {\n AttributeFormat,\n type AttributePropertiesFragment,\n AttributeType,\n type PropertyValueFragment,\n type PropertyValueLinkValueFragment,\n type PropertyValueTreeValueFragment,\n type PropertyValueValueFragment,\n MultiDisplayOption,\n} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport DOMPurify from 'dompurify';\nimport {KitAvatar, KitBadge, KitSpace, KitTag, KitTypography} from 'aristid-ds';\nimport {type IKitTag} from 'aristid-ds/dist/Kit/DataDisplay/Tag/types';\nimport styled from 'styled-components';\nimport {IdCard} from './IdCard';\nimport {multiColorTagAvatarClassName, TableTagGroup} from './TableTagGroup';\nimport {AggregationColor} from 'antd/es/color-picker/color';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faArrowRight, faCalendar, faListAlt} from '@fortawesome/free-solid-svg-icons';\n\nconst isStandardValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueValueFragment => [AttributeType.simple, AttributeType.advanced].includes(attribute.type);\nconst isStandardValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueValueFragment[] => values.every(value => isStandardValue(value, attribute));\n\nconst isLinkValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueLinkValueFragment =>\n [AttributeType.simple_link, AttributeType.advanced_link].includes(attribute.type);\nconst isLinkValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueLinkValueFragment[] => values.every(value => isLinkValue(value, attribute));\n\nconst isTreeValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueTreeValueFragment => [AttributeType.tree].includes(attribute.type);\nconst isTreeValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueTreeValueFragment[] => values.every(value => isTreeValue(value, attribute));\n\nconst isDateRangeValue = (v: PropertyValueValueFragment['valuePayload']): v is {from: string; to: string} =>\n 'from' in v && 'to' in v;\n\nconst StyledCenteringWrapper = styled.div`\n display: flex;\n align-items: center;\n gap: calc(var(--general-spacing-xs) * 1px);\n`;\n\nconst StyledColorChip = styled.div<{$colorTextContent: string}>`\n height: calc(var(--general-spacing-s) * 1px);\n width: calc(var(--general-spacing-s) * 1px);\n border-radius: calc(var(--general-border-radius-xs) * 1px);\n background-color: ${props => props.$colorTextContent};\n`;\n\nconst RightIcon = styled(FontAwesomeIcon)`\n flex-shrink: 0;\n`;\n\ninterface ITableCellProps {\n values: PropertyValueFragment[];\n attributeProperties: AttributePropertiesFragment;\n}\n\nexport const TableCell: FunctionComponent<ITableCellProps> = ({values, attributeProperties}) => {\n const {t} = useSharedTranslation();\n\n const _getDateRangeValueContent = useCallback((value: PropertyValueValueFragment['valuePayload']) => {\n if (!isDateRangeValue(value)) {\n return t('explorer.invalid-value');\n }\n\n return (\n <KitSpace size=\"xxs\">\n <RightIcon icon={faCalendar} />\n {value.from} <FontAwesomeIcon icon={faArrowRight} /> {value.to}\n </KitSpace>\n );\n }, []);\n\n const _getFirstValue = useCallback(\n (value: PropertyValueValueFragment['valuePayload'], attribute: AttributePropertiesFragment) => {\n if (isStandardValue(value, attribute) && attribute.format === AttributeFormat.boolean) {\n if (!value || value.valuePayload === null) {\n return {valuePayload: false};\n }\n }\n return value;\n },\n [],\n );\n\n if (attributeProperties.multiple_values) {\n if (isStandardValues(values, attributeProperties)) {\n const tags = values.map<IKitTag>(value => {\n switch (attributeProperties.format) {\n case AttributeFormat.boolean:\n return {\n idCardProps: {\n description: value.valuePayload ? String(t('global.yes')) : String(t('global.no')),\n },\n type: value.valuePayload ? 'primary' : ('neutral' as IKitTag['type']),\n };\n case AttributeFormat.color:\n const color = new AggregationColor(value.valueRawPayload);\n return {\n idCardProps: {\n description: value.valuePayload,\n avatarProps: {\n color: color.toHexString(),\n shape: 'square',\n className: multiColorTagAvatarClassName,\n },\n },\n };\n case AttributeFormat.date_range:\n return {\n idCardProps: {\n description: _getDateRangeValueContent(value.valuePayload),\n },\n type: 'primary',\n };\n default:\n const valueContent =\n attributeProperties.format === AttributeFormat.encrypted\n ? '●●●●●●●●●●●●'\n : value.valuePayload;\n return {\n idCardProps: {description: valueContent},\n type: 'primary',\n };\n }\n });\n return <TableTagGroup tags={tags} />;\n } else if (isLinkValues(values, attributeProperties)) {\n switch (attributeProperties.multi_link_display_option) {\n case MultiDisplayOption.tag:\n return (\n <TableTagGroup\n tags={values.map(value => ({\n type: 'primary',\n idCardProps: {description: value.linkPayload?.whoAmI.label ?? undefined},\n }))}\n />\n );\n\n case MultiDisplayOption.badge_qty:\n return <KitBadge overflowCount={Infinity} count={values.length} color=\"primary\" />;\n\n case MultiDisplayOption.avatar:\n default:\n return (\n <KitAvatar.Group max={{count: 5}}>\n {values.map((value, index) => {\n if (!isLinkValue(value, attributeProperties)) {\n return null;\n }\n\n return (\n <KitAvatar\n key={index}\n label={String(value.linkPayload?.whoAmI.label)}\n src={value.linkPayload?.whoAmI.preview?.small}\n color=\"primary\"\n secondaryColorInvert\n />\n );\n })}\n </KitAvatar.Group>\n );\n }\n } else if (isTreeValues(values, attributeProperties)) {\n switch (attributeProperties.multi_tree_display_option) {\n case MultiDisplayOption.tag:\n return (\n <TableTagGroup\n tags={values.map(value => ({\n type: 'primary',\n idCardProps: {description: value.treePayload?.record.whoAmI.label ?? undefined},\n }))}\n />\n );\n case MultiDisplayOption.badge_qty:\n return <KitBadge overflowCount={Infinity} count={values.length} color=\"primary\" />;\n case MultiDisplayOption.avatar:\n default:\n return (\n <KitAvatar.Group max={{count: 5}}>\n {values.map((value, index) => {\n if (!isTreeValue(value, attributeProperties)) {\n return null;\n }\n\n return (\n <KitAvatar\n key={index}\n label={String(value.treePayload?.record.whoAmI.label)}\n src={value.treePayload?.record.whoAmI.preview?.small}\n color=\"primary\"\n secondaryColorInvert\n />\n );\n })}\n </KitAvatar.Group>\n );\n }\n }\n } else {\n const value = _getFirstValue(values[0], attributeProperties); // Not multiple_values attribute should not have more than one value\n if (!value) {\n return null;\n }\n\n let content: ReactNode = null;\n if (isStandardValue(value, attributeProperties)) {\n if (value.valuePayload === null) {\n return null;\n }\n\n switch (attributeProperties.format) {\n case AttributeFormat.boolean:\n const valueToDisplay = value.valuePayload ? t('global.yes') : t('global.no');\n content = (\n <KitTag\n key={attributeProperties.id}\n type={!!value.valuePayload ? 'primary' : 'neutral'}\n idCardProps={{description: valueToDisplay}}\n />\n );\n break;\n case AttributeFormat.rich_text:\n const tmp = document.createElement('div');\n tmp.innerHTML = DOMPurify.sanitize(value.valuePayload);\n const textContent = tmp.textContent;\n content = (\n <>\n <RightIcon icon={faListAlt} />\n <KitTypography.AdvancedText key={attributeProperties.id} ellipsis={{tooltip: textContent}}>\n {textContent}\n </KitTypography.AdvancedText>\n </>\n );\n break;\n case AttributeFormat.color:\n const color = new AggregationColor(value.valueRawPayload);\n content = (\n <>\n <StyledColorChip $colorTextContent={color.toHexString()} />\n <KitTypography.AdvancedText\n key={attributeProperties.id}\n ellipsis={{tooltip: value.valuePayload}}\n >\n {value.valuePayload}\n </KitTypography.AdvancedText>\n </>\n );\n break;\n case AttributeFormat.date_range:\n content = _getDateRangeValueContent(value.valuePayload);\n break;\n default:\n const valueContent =\n attributeProperties.format === AttributeFormat.encrypted ? '●●●●●●●●●●●●' : value.valuePayload;\n content = (\n <KitTypography.AdvancedText key={attributeProperties.id} ellipsis={{tooltip: valueContent}}>\n {valueContent}\n </KitTypography.AdvancedText>\n );\n break;\n }\n }\n\n if (isTreeValue(value, attributeProperties)) {\n content = value.treePayload?.record.whoAmI.label ? (\n <IdCard key={attributeProperties.id} item={value.treePayload.record.whoAmI} />\n ) : null;\n }\n\n if (isLinkValue(value, attributeProperties)) {\n content = value.linkPayload?.whoAmI ? (\n <IdCard key={attributeProperties.id} item={value.linkPayload.whoAmI} />\n ) : null;\n }\n\n return <StyledCenteringWrapper>{content}</StyledCenteringWrapper>;\n }\n\n return null;\n};\n"]}
1
+ {"version":3,"file":"TableCell.js","sourceRoot":"","sources":["../../../src/components/Explorer/TableCell.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAyC,WAAW,EAAC,MAAM,OAAO,CAAC;AAC1E,OAAO,EACH,eAAe,EAEf,aAAa,EAKb,kBAAkB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAC,MAAM,YAAY,C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,CAAC;QACL,CAAC;QAED,IAAI,WAAW,CAAC,KAAK,EAAE,mBAAmB,CAAC,EAAE,CAAC;YAC1C,OAAO,GAAG,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAC/C,KAAC,MAAM,IAA8B,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,IAA7D,mBAAmB,CAAC,EAAE,CAA2C,CACjF,CAAC,CAAC,CAAC,IAAI,CAAC;QACb,CAAC;QAED,IAAI,WAAW,CAAC,KAAK,EAAE,mBAAmB,CAAC,EAAE,CAAC;YAC1C,OAAO,GAAG,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAClC,KAAC,MAAM,IAA8B,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,IAAtD,mBAAmB,CAAC,EAAE,CAAoC,CAC1E,CAAC,CAAC,CAAC,IAAI,CAAC;QACb,CAAC;QAED,OAAO,KAAC,sBAAsB,cAAE,OAAO,GAA0B,CAAC;IACtE,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {type FunctionComponent, type ReactNode, useCallback} from 'react';\nimport {\n AttributeFormat,\n type AttributePropertiesFragment,\n AttributeType,\n type PropertyValueFragment,\n type PropertyValueLinkValueFragment,\n type PropertyValueTreeValueFragment,\n type PropertyValueValueFragment,\n MultiDisplayOption,\n} from '_ui/_gqlTypes';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport DOMPurify from 'dompurify';\nimport {KitAvatar, KitBadge, KitIdCard, KitSpace, KitTag, KitTypography} from 'aristid-ds';\nimport {type IKitTag} from 'aristid-ds/dist/Kit/DataDisplay/Tag/types';\nimport styled from 'styled-components';\nimport {IdCard} from './IdCard';\nimport {multiColorTagAvatarClassName, TableTagGroup} from './TableTagGroup';\nimport {AggregationColor} from 'antd/es/color-picker/color';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faArrowRight, faCalendar, faListAlt} from '@fortawesome/free-solid-svg-icons';\n\nconst isStandardValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueValueFragment => [AttributeType.simple, AttributeType.advanced].includes(attribute.type);\nconst isStandardValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueValueFragment[] => values.every(value => isStandardValue(value, attribute));\n\nconst isLinkValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueLinkValueFragment =>\n [AttributeType.simple_link, AttributeType.advanced_link].includes(attribute.type);\nconst isLinkValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueLinkValueFragment[] => values.every(value => isLinkValue(value, attribute));\n\nconst isTreeValue = (\n v: PropertyValueFragment,\n attribute: AttributePropertiesFragment,\n): v is PropertyValueTreeValueFragment => [AttributeType.tree].includes(attribute.type);\nconst isTreeValues = (\n values: PropertyValueFragment[],\n attribute: AttributePropertiesFragment,\n): values is PropertyValueTreeValueFragment[] => values.every(value => isTreeValue(value, attribute));\n\nconst isDateRangeValue = (v: PropertyValueValueFragment['valuePayload']): v is {from: string; to: string} =>\n 'from' in v && 'to' in v;\n\nconst StyledCenteringWrapper = styled.div`\n display: flex;\n align-items: center;\n gap: calc(var(--general-spacing-xs) * 1px);\n`;\n\nconst StyledColorChip = styled.div<{$colorTextContent: string}>`\n height: calc(var(--general-spacing-s) * 1px);\n width: calc(var(--general-spacing-s) * 1px);\n border-radius: calc(var(--general-border-radius-xs) * 1px);\n background-color: ${props => props.$colorTextContent};\n`;\n\nconst RightIcon = styled(FontAwesomeIcon)`\n flex-shrink: 0;\n`;\n\ninterface ITableCellProps {\n values: PropertyValueFragment[];\n attributeProperties: AttributePropertiesFragment;\n}\n\nexport const TableCell: FunctionComponent<ITableCellProps> = ({values, attributeProperties}) => {\n const {t} = useSharedTranslation();\n\n const _getDateRangeValueContent = useCallback((value: PropertyValueValueFragment['valuePayload']) => {\n if (!isDateRangeValue(value)) {\n return t('explorer.invalid-value');\n }\n\n return (\n <KitSpace size=\"xxs\">\n <RightIcon icon={faCalendar} />\n {value.from} <FontAwesomeIcon icon={faArrowRight} /> {value.to}\n </KitSpace>\n );\n }, []);\n\n const _getFirstValue = useCallback(\n (value: PropertyValueValueFragment['valuePayload'], attribute: AttributePropertiesFragment) => {\n if (isStandardValue(value, attribute) && attribute.format === AttributeFormat.boolean) {\n if (!value || value.valuePayload === null) {\n return {valuePayload: false};\n }\n }\n return value;\n },\n [],\n );\n\n if (attributeProperties.multiple_values) {\n if (isStandardValues(values, attributeProperties)) {\n const tags = values.map<IKitTag>(value => {\n switch (attributeProperties.format) {\n case AttributeFormat.boolean:\n return {\n children: (\n <KitIdCard\n description={value.valuePayload ? String(t('global.yes')) : String(t('global.no'))}\n />\n ),\n type: value.valuePayload ? 'primary' : ('neutral' as IKitTag['type']),\n };\n case AttributeFormat.color:\n const color = new AggregationColor(value.valueRawPayload);\n return {\n children: (\n <KitIdCard\n description={value.valuePayload}\n avatarProps={{\n color: color.toHexString(),\n shape: 'square',\n className: multiColorTagAvatarClassName,\n }}\n />\n ),\n };\n case AttributeFormat.date_range:\n return {\n children: <KitIdCard description={_getDateRangeValueContent(value.valuePayload)} />,\n type: 'primary',\n };\n default:\n const valueContent =\n attributeProperties.format === AttributeFormat.encrypted\n ? '●●●●●●●●●●●●'\n : value.valuePayload;\n return {\n children: <KitIdCard description={valueContent} />,\n type: 'primary',\n };\n }\n });\n return <TableTagGroup tags={tags} />;\n } else if (isLinkValues(values, attributeProperties)) {\n switch (attributeProperties.multi_link_display_option) {\n case MultiDisplayOption.tag:\n return (\n <TableTagGroup\n tags={values.map(value => ({\n type: 'primary',\n children: <KitIdCard description={value.linkPayload?.whoAmI.label ?? undefined} />,\n }))}\n />\n );\n\n case MultiDisplayOption.badge_qty:\n return <KitBadge overflowCount={Infinity} count={values.length} color=\"primary\" />;\n\n case MultiDisplayOption.avatar:\n default:\n return (\n <KitAvatar.Group max={{count: 5}}>\n {values.map((value, index) => {\n if (!isLinkValue(value, attributeProperties)) {\n return null;\n }\n\n return (\n <KitAvatar\n key={index}\n label={String(value.linkPayload?.whoAmI.label)}\n src={value.linkPayload?.whoAmI.preview?.small}\n color=\"primary\"\n secondaryColorInvert\n />\n );\n })}\n </KitAvatar.Group>\n );\n }\n } else if (isTreeValues(values, attributeProperties)) {\n switch (attributeProperties.multi_tree_display_option) {\n case MultiDisplayOption.tag:\n return (\n <TableTagGroup\n tags={values.map(value => ({\n type: 'primary',\n children: (\n <KitIdCard description={value.treePayload?.record.whoAmI.label ?? undefined} />\n ),\n }))}\n />\n );\n case MultiDisplayOption.badge_qty:\n return <KitBadge overflowCount={Infinity} count={values.length} color=\"primary\" />;\n case MultiDisplayOption.avatar:\n default:\n return (\n <KitAvatar.Group max={{count: 5}}>\n {values.map((value, index) => {\n if (!isTreeValue(value, attributeProperties)) {\n return null;\n }\n\n return (\n <KitAvatar\n key={index}\n label={String(value.treePayload?.record.whoAmI.label)}\n src={value.treePayload?.record.whoAmI.preview?.small}\n color=\"primary\"\n secondaryColorInvert\n />\n );\n })}\n </KitAvatar.Group>\n );\n }\n }\n } else {\n const value = _getFirstValue(values[0], attributeProperties); // Not multiple_values attribute should not have more than one value\n if (!value) {\n return null;\n }\n\n let content: ReactNode = null;\n if (isStandardValue(value, attributeProperties)) {\n if (value.valuePayload === null) {\n return null;\n }\n\n switch (attributeProperties.format) {\n case AttributeFormat.boolean:\n const valueToDisplay = value.valuePayload ? t('global.yes') : t('global.no');\n content = (\n <KitTag key={attributeProperties.id} type={!!value.valuePayload ? 'primary' : 'neutral'}>\n <KitIdCard description={valueToDisplay} />\n </KitTag>\n );\n break;\n case AttributeFormat.rich_text:\n const tmp = document.createElement('div');\n tmp.innerHTML = DOMPurify.sanitize(value.valuePayload);\n const textContent = tmp.textContent;\n content = (\n <>\n <RightIcon icon={faListAlt} />\n <KitTypography.AdvancedText key={attributeProperties.id} ellipsis={{tooltip: textContent}}>\n {textContent}\n </KitTypography.AdvancedText>\n </>\n );\n break;\n case AttributeFormat.color:\n const color = new AggregationColor(value.valueRawPayload);\n content = (\n <>\n <StyledColorChip $colorTextContent={color.toHexString()} />\n <KitTypography.AdvancedText\n key={attributeProperties.id}\n ellipsis={{tooltip: value.valuePayload}}\n >\n {value.valuePayload}\n </KitTypography.AdvancedText>\n </>\n );\n break;\n case AttributeFormat.date_range:\n content = _getDateRangeValueContent(value.valuePayload);\n break;\n default:\n const valueContent =\n attributeProperties.format === AttributeFormat.encrypted ? '●●●●●●●●●●●●' : value.valuePayload;\n content = (\n <KitTypography.AdvancedText key={attributeProperties.id} ellipsis={{tooltip: valueContent}}>\n {valueContent}\n </KitTypography.AdvancedText>\n );\n break;\n }\n }\n\n if (isTreeValue(value, attributeProperties)) {\n content = value.treePayload?.record.whoAmI.label ? (\n <IdCard key={attributeProperties.id} item={value.treePayload.record.whoAmI} />\n ) : null;\n }\n\n if (isLinkValue(value, attributeProperties)) {\n content = value.linkPayload?.whoAmI ? (\n <IdCard key={attributeProperties.id} item={value.linkPayload.whoAmI} />\n ) : null;\n }\n\n return <StyledCenteringWrapper>{content}</StyledCenteringWrapper>;\n }\n\n return null;\n};\n"]}
@@ -3,10 +3,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  // This file is released under LGPL V3
4
4
  // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
5
5
  import { useSharedTranslation } from '../../../../../hooks/useSharedTranslation';
6
- import { KitRadio, KitSpace, KitTag } from 'aristid-ds';
6
+ import { KitIdCard, KitRadio, KitSpace, KitTag } from 'aristid-ds';
7
7
  export const SelectViewType = ({ value, onChange }) => {
8
8
  const { t } = useSharedTranslation();
9
- const comingSoonTag = _jsx(KitTag, { type: "secondary", idCardProps: { description: String(t('explorer.coming-soon')) } });
9
+ const comingSoonTag = (_jsx(KitTag, { type: "secondary", children: _jsx(KitIdCard, { description: String(t('explorer.coming-soon')) }) }));
10
10
  return (_jsx(KitRadio.Group, { value: value, onChange: onChange, children: _jsxs(KitSpace, { direction: "vertical", size: 0, children: [_jsx(KitRadio, { value: "list", disabled: true, children: _jsxs(KitSpace, { children: [t('explorer.view-type-list'), " ", comingSoonTag] }) }), _jsx(KitRadio, { value: "table", children: t('explorer.view-type-table') }), _jsx(KitRadio, { value: "mosaic", disabled: true, children: _jsxs(KitSpace, { children: [t('explorer.view-type-mosaic'), " ", comingSoonTag] }) }), _jsx(KitRadio, { value: "planning", disabled: true, children: _jsxs(KitSpace, { children: [t('explorer.view-type-planning'), " ", comingSoonTag] }) })] }) }));
11
11
  };
12
12
  //# sourceMappingURL=SelectViewType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectViewType.js","sourceRoot":"","sources":["../../../../../../src/components/Explorer/manage-view-settings/configure-display/view-type/SelectViewType.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AAStD,MAAM,CAAC,MAAM,cAAc,GAA4C,CAAC,EAAC,KAAK,EAAE,QAAQ,EAAC,EAAE,EAAE;IACzF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,aAAa,GAAG,KAAC,MAAM,IAAC,IAAI,EAAC,WAAW,EAAC,WAAW,EAAE,EAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,EAAC,GAAI,CAAC;IAEjH,OAAO,CACH,KAAC,QAAQ,CAAC,KAAK,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,YAC5C,MAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAE,CAAC,aAClC,KAAC,QAAQ,IAAC,KAAK,EAAC,MAAM,EAAC,QAAQ,kBAC3B,MAAC,QAAQ,eACJ,CAAC,CAAC,yBAAyB,CAAC,OAAG,aAAa,IACtC,GACJ,EACX,KAAC,QAAQ,IAAC,KAAK,EAAC,OAAO,YAAE,CAAC,CAAC,0BAA0B,CAAC,GAAY,EAClE,KAAC,QAAQ,IAAC,KAAK,EAAC,QAAQ,EAAC,QAAQ,kBAC7B,MAAC,QAAQ,eACJ,CAAC,CAAC,2BAA2B,CAAC,OAAG,aAAa,IACxC,GACJ,EACX,KAAC,QAAQ,IAAC,KAAK,EAAC,UAAU,EAAC,QAAQ,kBAC/B,MAAC,QAAQ,eACJ,CAAC,CAAC,6BAA6B,CAAC,OAAG,aAAa,IAC1C,GACJ,IACJ,GACE,CACpB,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {KitRadio, KitSpace, KitTag} from 'aristid-ds';\nimport {type RadioGroupProps} from 'aristid-ds/dist/Kit/DataEntry/Radio';\nimport {type FunctionComponent} from 'react';\n\ninterface ISelectViewTypeProps {\n value: string;\n onChange: RadioGroupProps['onChange'];\n}\n\nexport const SelectViewType: FunctionComponent<ISelectViewTypeProps> = ({value, onChange}) => {\n const {t} = useSharedTranslation();\n\n const comingSoonTag = <KitTag type=\"secondary\" idCardProps={{description: String(t('explorer.coming-soon'))}} />;\n\n return (\n <KitRadio.Group value={value} onChange={onChange}>\n <KitSpace direction=\"vertical\" size={0}>\n <KitRadio value=\"list\" disabled>\n <KitSpace>\n {t('explorer.view-type-list')} {comingSoonTag}\n </KitSpace>\n </KitRadio>\n <KitRadio value=\"table\">{t('explorer.view-type-table')}</KitRadio>\n <KitRadio value=\"mosaic\" disabled>\n <KitSpace>\n {t('explorer.view-type-mosaic')} {comingSoonTag}\n </KitSpace>\n </KitRadio>\n <KitRadio value=\"planning\" disabled>\n <KitSpace>\n {t('explorer.view-type-planning')} {comingSoonTag}\n </KitSpace>\n </KitRadio>\n </KitSpace>\n </KitRadio.Group>\n );\n};\n"]}
1
+ {"version":3,"file":"SelectViewType.js","sourceRoot":"","sources":["../../../../../../src/components/Explorer/manage-view-settings/configure-display/view-type/SelectViewType.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AASjE,MAAM,CAAC,MAAM,cAAc,GAA4C,CAAC,EAAC,KAAK,EAAE,QAAQ,EAAC,EAAE,EAAE;IACzF,MAAM,EAAC,CAAC,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAEnC,MAAM,aAAa,GAAG,CAClB,KAAC,MAAM,IAAC,IAAI,EAAC,WAAW,YACpB,KAAC,SAAS,IAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,GAAI,GACxD,CACZ,CAAC;IAEF,OAAO,CACH,KAAC,QAAQ,CAAC,KAAK,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,YAC5C,MAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAE,CAAC,aAClC,KAAC,QAAQ,IAAC,KAAK,EAAC,MAAM,EAAC,QAAQ,kBAC3B,MAAC,QAAQ,eACJ,CAAC,CAAC,yBAAyB,CAAC,OAAG,aAAa,IACtC,GACJ,EACX,KAAC,QAAQ,IAAC,KAAK,EAAC,OAAO,YAAE,CAAC,CAAC,0BAA0B,CAAC,GAAY,EAClE,KAAC,QAAQ,IAAC,KAAK,EAAC,QAAQ,EAAC,QAAQ,kBAC7B,MAAC,QAAQ,eACJ,CAAC,CAAC,2BAA2B,CAAC,OAAG,aAAa,IACxC,GACJ,EACX,KAAC,QAAQ,IAAC,KAAK,EAAC,UAAU,EAAC,QAAQ,kBAC/B,MAAC,QAAQ,eACJ,CAAC,CAAC,6BAA6B,CAAC,OAAG,aAAa,IAC1C,GACJ,IACJ,GACE,CACpB,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {KitIdCard, KitRadio, KitSpace, KitTag} from 'aristid-ds';\nimport {type RadioGroupProps} from 'aristid-ds/dist/Kit/DataEntry/Radio';\nimport {type FunctionComponent} from 'react';\n\ninterface ISelectViewTypeProps {\n value: string;\n onChange: RadioGroupProps['onChange'];\n}\n\nexport const SelectViewType: FunctionComponent<ISelectViewTypeProps> = ({value, onChange}) => {\n const {t} = useSharedTranslation();\n\n const comingSoonTag = (\n <KitTag type=\"secondary\">\n <KitIdCard description={String(t('explorer.coming-soon'))} />\n </KitTag>\n );\n\n return (\n <KitRadio.Group value={value} onChange={onChange}>\n <KitSpace direction=\"vertical\" size={0}>\n <KitRadio value=\"list\" disabled>\n <KitSpace>\n {t('explorer.view-type-list')} {comingSoonTag}\n </KitSpace>\n </KitRadio>\n <KitRadio value=\"table\">{t('explorer.view-type-table')}</KitRadio>\n <KitRadio value=\"mosaic\" disabled>\n <KitSpace>\n {t('explorer.view-type-mosaic')} {comingSoonTag}\n </KitSpace>\n </KitRadio>\n <KitRadio value=\"planning\" disabled>\n <KitSpace>\n {t('explorer.view-type-planning')} {comingSoonTag}\n </KitSpace>\n </KitRadio>\n </KitSpace>\n </KitRadio.Group>\n );\n};\n"]}
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06
3
3
  // This file is released under LGPL V3
4
4
  // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
5
- import { KitButton, KitTag } from 'aristid-ds';
5
+ import { KitButton, KitIdCard, KitTag } from 'aristid-ds';
6
6
  import { useSharedTranslation } from '../../../../hooks/useSharedTranslation';
7
7
  import { SettingsPanel } from '../router-menu/SettingsPanel';
8
8
  import { useEditSettings } from './useEditSettings';
@@ -55,7 +55,7 @@ export const useOpenViewSettings = ({ view, isEnabled = true }) => {
55
55
  const isMassSelectionAll = view.massSelection === MASS_SELECTION_ALL;
56
56
  useEffect(() => {
57
57
  setButton(_jsx(KitButton, { type: "secondary", size: "m", icon: _jsx(FontAwesomeIcon, { icon: faSlidersH }), onClick: () => _openSettingsPanel(), disabled: isMassSelectionAll, title: String(t('explorer.settings')) /* TODO: avoid transform null to 'null' */ }));
58
- setViewListButton(_jsxs(KitButton, { type: "secondary", size: "m", icon: _jsx(FontAwesomeIcon, { icon: faBars }), onClick: () => _openSettingsPanel('viewList.my-views'), disabled: isMassSelectionAll, title: String(t('explorer.viewList.manage-views')) /* TODO: avoid transform null to 'null' */, children: [viewName === '' ? t('explorer.viewList.manage-views') : viewName, view.viewModified && (_jsx(ModifiedStyledKitTag, { type: "error", idCardProps: { description: String(t('explorer.modified')) } }))] }));
58
+ setViewListButton(_jsxs(KitButton, { type: "secondary", size: "m", icon: _jsx(FontAwesomeIcon, { icon: faBars }), onClick: () => _openSettingsPanel('viewList.my-views'), disabled: isMassSelectionAll, title: String(t('explorer.viewList.manage-views')) /* TODO: avoid transform null to 'null' */, children: [viewName === '' ? t('explorer.viewList.manage-views') : viewName, view.viewModified && (_jsx(ModifiedStyledKitTag, { type: "error", children: _jsx(KitIdCard, { description: String(t('explorer.modified')) }) }))] }));
59
59
  }, [view.viewModified, viewName, isMassSelectionAll]);
60
60
  return {
61
61
  openSettingsPanel: _openSettingsPanel,
@@ -1 +1 @@
1
- {"version":3,"file":"useOpenViewSettings.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,SAAS,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,aAAa,EAAC,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAoB,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE7D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,mCAAmC,CAAC;AAErE,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;;CAE1C,CAAC;AAQF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAAC,IAAI,EAAE,SAAS,GAAG,IAAI,EAA0C,EAAE,EAAE;IACrG,MAAM,EAAC,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,EAAC,GAAG,eAAe,EAAE,CAAC;IAClF,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAsB,IAAI,CAAC,CAAC;IAChE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAsB,IAAI,CAAC,CAAC;IAEhF,MA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AAQ;KAC7E,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {KitButton, KitTag} from 'aristid-ds';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {SettingsPanel} from '../router-menu/SettingsPanel';\nimport {useEditSettings} from './useEditSettings';\nimport {type SettingsPanelPages} from './EditSettingsContext';\nimport {localizedTranslation} from '@leav/utils';\nimport {useLang} from '_ui/hooks';\nimport {type ReactElement, useEffect, useState} from 'react';\nimport {type IViewSettingsState} from '../store-view-settings/viewSettingsReducer';\nimport styled from 'styled-components';\nimport {type FeatureHook} from '../../_types';\nimport {MASS_SELECTION_ALL} from '../../_constants';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faBars, faSlidersH} from '@fortawesome/free-solid-svg-icons';\n\nconst ModifiedStyledKitTag = styled(KitTag)`\n margin: 0;\n`;\n\ninterface IChangePanelPage {\n pageName: SettingsPanelPages;\n title: string;\n onClickLeftButton?: () => void;\n}\n\nexport const useOpenViewSettings = ({view, isEnabled = true}: FeatureHook<{view: IViewSettingsState}>) => {\n const {activeSettings, setActiveSettings, closeSettingsPanel} = useEditSettings();\n const [button, setButton] = useState<ReactElement | null>(null);\n const [viewListButton, setViewListButton] = useState<ReactElement | null>(null);\n\n const {t} = useSharedTranslation();\n const {lang} = useLang();\n\n useEffect(() => {\n if (!isEnabled) {\n closeSettingsPanel();\n }\n return () => {\n closeSettingsPanel();\n };\n }, [isEnabled]);\n\n const rootPanel = {pageName: 'router-menu', title: t('explorer.settings')} as const;\n\n const _changePanelPage = ({pageName, title, onClickLeftButton}: IChangePanelPage) => {\n setActiveSettings({\n ...activeSettings!,\n content: <SettingsPanel library={view.libraryId} page={pageName} />,\n title,\n onClickLeftButton,\n });\n };\n\n const _openSettingsPanel = (pageName: SettingsPanelPages = 'router-menu') => {\n const chanelPageParams: IChangePanelPage = {\n pageName,\n title: t(`explorer.${pageName}`),\n };\n if (pageName !== rootPanel.pageName) {\n chanelPageParams.onClickLeftButton = () => {\n _changePanelPage(rootPanel);\n };\n }\n\n _changePanelPage(chanelPageParams);\n };\n\n const viewName = localizedTranslation(view?.viewLabels ?? {}, lang);\n const isMassSelectionAll = view.massSelection === MASS_SELECTION_ALL;\n\n useEffect(() => {\n setButton(\n <KitButton\n type=\"secondary\"\n size=\"m\"\n icon={<FontAwesomeIcon icon={faSlidersH} />}\n onClick={() => _openSettingsPanel()}\n disabled={isMassSelectionAll}\n title={String(t('explorer.settings')) /* TODO: avoid transform null to 'null' */}\n />,\n );\n setViewListButton(\n <KitButton\n type=\"secondary\"\n size=\"m\"\n icon={<FontAwesomeIcon icon={faBars} />}\n onClick={() => _openSettingsPanel('viewList.my-views')}\n disabled={isMassSelectionAll}\n title={String(t('explorer.viewList.manage-views')) /* TODO: avoid transform null to 'null' */}\n >\n {viewName === '' ? t('explorer.viewList.manage-views') : viewName}\n {view.viewModified && (\n <ModifiedStyledKitTag type=\"error\" idCardProps={{description: String(t('explorer.modified'))}} />\n )}\n </KitButton>,\n );\n }, [view.viewModified, viewName, isMassSelectionAll]);\n\n return {\n openSettingsPanel: _openSettingsPanel,\n viewSettingsButton: button,\n viewListButton,\n viewName: viewName === '' ? t('explorer.viewList.default-view') : viewName,\n };\n};\n"]}
1
+ {"version":3,"file":"useOpenViewSettings.js","sourceRoot":"","sources":["../../../../../src/components/Explorer/manage-view-settings/open-view-settings/useOpenViewSettings.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AACxD,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,aAAa,EAAC,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAC,eAAe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AAI,EAAC,WAAW,EAChB,IAAI,EAAC,GAAG,EACR,IAAI,EAAE,KAAC,eAAe,IAAC,IAAI,EAAE,MAAM,GAAI,EACvC,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,EACtD,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,0CAA0C,aAE5F,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAChE,IAAI,CAAC,YAAY,IAAI,CAClB,KAAC,oBAAoB,IAAC,IAAI,EAAC,OAAO,YAC9B,KAAC,SAAS,IAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,GAAI,GACvC,CAC1B,IACO,CACf,CAAC;IACN,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEtD,OAAO;QACH,iBAAiB,EAAE,kBAAkB;QACrC,kBAAkB,EAAE,MAAM;QAC1B,cAAc;QACd,QAAQ,EAAE,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC,QAAQ;KAC7E,CAAC;AACN,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {KitButton, KitIdCard, KitTag} from 'aristid-ds';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport {SettingsPanel} from '../router-menu/SettingsPanel';\nimport {useEditSettings} from './useEditSettings';\nimport {type SettingsPanelPages} from './EditSettingsContext';\nimport {localizedTranslation} from '@leav/utils';\nimport {useLang} from '_ui/hooks';\nimport {type ReactElement, useEffect, useState} from 'react';\nimport {type IViewSettingsState} from '../store-view-settings/viewSettingsReducer';\nimport styled from 'styled-components';\nimport {type FeatureHook} from '../../_types';\nimport {MASS_SELECTION_ALL} from '../../_constants';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faBars, faSlidersH} from '@fortawesome/free-solid-svg-icons';\n\nconst ModifiedStyledKitTag = styled(KitTag)`\n margin: 0;\n`;\n\ninterface IChangePanelPage {\n pageName: SettingsPanelPages;\n title: string;\n onClickLeftButton?: () => void;\n}\n\nexport const useOpenViewSettings = ({view, isEnabled = true}: FeatureHook<{view: IViewSettingsState}>) => {\n const {activeSettings, setActiveSettings, closeSettingsPanel} = useEditSettings();\n const [button, setButton] = useState<ReactElement | null>(null);\n const [viewListButton, setViewListButton] = useState<ReactElement | null>(null);\n\n const {t} = useSharedTranslation();\n const {lang} = useLang();\n\n useEffect(() => {\n if (!isEnabled) {\n closeSettingsPanel();\n }\n return () => {\n closeSettingsPanel();\n };\n }, [isEnabled]);\n\n const rootPanel = {pageName: 'router-menu', title: t('explorer.settings')} as const;\n\n const _changePanelPage = ({pageName, title, onClickLeftButton}: IChangePanelPage) => {\n setActiveSettings({\n ...activeSettings!,\n content: <SettingsPanel library={view.libraryId} page={pageName} />,\n title,\n onClickLeftButton,\n });\n };\n\n const _openSettingsPanel = (pageName: SettingsPanelPages = 'router-menu') => {\n const chanelPageParams: IChangePanelPage = {\n pageName,\n title: t(`explorer.${pageName}`),\n };\n if (pageName !== rootPanel.pageName) {\n chanelPageParams.onClickLeftButton = () => {\n _changePanelPage(rootPanel);\n };\n }\n\n _changePanelPage(chanelPageParams);\n };\n\n const viewName = localizedTranslation(view?.viewLabels ?? {}, lang);\n const isMassSelectionAll = view.massSelection === MASS_SELECTION_ALL;\n\n useEffect(() => {\n setButton(\n <KitButton\n type=\"secondary\"\n size=\"m\"\n icon={<FontAwesomeIcon icon={faSlidersH} />}\n onClick={() => _openSettingsPanel()}\n disabled={isMassSelectionAll}\n title={String(t('explorer.settings')) /* TODO: avoid transform null to 'null' */}\n />,\n );\n setViewListButton(\n <KitButton\n type=\"secondary\"\n size=\"m\"\n icon={<FontAwesomeIcon icon={faBars} />}\n onClick={() => _openSettingsPanel('viewList.my-views')}\n disabled={isMassSelectionAll}\n title={String(t('explorer.viewList.manage-views')) /* TODO: avoid transform null to 'null' */}\n >\n {viewName === '' ? t('explorer.viewList.manage-views') : viewName}\n {view.viewModified && (\n <ModifiedStyledKitTag type=\"error\">\n <KitIdCard description={String(t('explorer.modified'))} />\n </ModifiedStyledKitTag>\n )}\n </KitButton>,\n );\n }, [view.viewModified, viewName, isMassSelectionAll]);\n\n return {\n openSettingsPanel: _openSettingsPanel,\n viewSettingsButton: button,\n viewListButton,\n viewName: viewName === '' ? t('explorer.viewList.default-view') : viewName,\n };\n};\n"]}
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  // This file is released under LGPL V3
4
4
  // License text available at https://www.gnu.org/licenses/lgpl-3.0.txt
5
5
  import { useState } from 'react';
6
- import { KitButton, KitTag, KitTypography } from 'aristid-ds';
6
+ import { KitButton, KitIdCard, KitTag, KitTypography } from 'aristid-ds';
7
7
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
8
  import { faCheck } from '@fortawesome/free-solid-svg-icons';
9
9
  import { useSharedTranslation } from '../../hooks/useSharedTranslation';
@@ -43,7 +43,7 @@ const SelectedChildrenCount = ({ node, selectedNodes, loadRecursively }) => {
43
43
  return null;
44
44
  }
45
45
  const selectedChildrenCount = countSelectedNodes(node, selectedNodes);
46
- return selectedChildrenCount > 0 ? _jsx(KitTag, { idCardProps: { description: selectedChildrenCount } }) : null;
46
+ return selectedChildrenCount > 0 ? (_jsx(KitTag, { children: _jsx(KitIdCard, { description: selectedChildrenCount }) })) : null;
47
47
  };
48
48
  const countSelectedNodes = (node, selectedNodes) => node.children?.reduce((count, child) => {
49
49
  if (selectedNodes.includes(child.id) && !child.isShowMore) {
@@ -1 +1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I,EAAE,OAAO,EACb,KAAK,EACD,UAAU,CAAC,CAAC,CAAC,wCAAwC,CAAC,CAAC,CAAC,oCAAoC,GAElG,CACL,IACiB,IACX,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAItB,CAAC,EAAC,IAAI,EAAE,aAAa,EAAE,eAAe,EAAC,EAAE,EAAE;IAC5C,8CAA8C;IAC9C,IAAI,CAAC,eAAe,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAEtE,OAAO,qBAAqB,GAAG,CAAC,CAAC,CAAC,CAAC,KAAC,MAAM,IAAC,WAAW,EAAE,EAAC,WAAW,EAAE,qBAAqB,EAAC,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5G,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,IAAqB,EAAE,aAAuB,EAAU,EAAE,CAClF,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;IACnC,IAAI,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QACxD,KAAK,IAAI,CAAC,CAAC;IACf,CAAC;IACD,KAAK,IAAI,kBAAkB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IAClD,OAAO,KAAK,CAAC;AACjB,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {useState, type FunctionComponent} from 'react';\nimport {type ITreeMapElement} from './_types';\nimport {KitButton, KitTag, KitTypography} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faCheck} from '@fortawesome/free-solid-svg-icons';\nimport {type ITreeNodeWithRecord} from '_ui/types';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport styled from 'styled-components';\n\nconst TreeNodeLine = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n`;\nconst TreeNodeLineSection = styled.div`\n display: flex;\n align-items: center;\n gap: calc(var(--general-spacing-xs) * 1px);\n`;\ninterface ITreeNodeTitleProps {\n checkable: boolean;\n disabledNodes: string[];\n loadRecursively: boolean;\n node: ITreeMapElement;\n onSelect: (node: ITreeNodeWithRecord, selected: boolean) => void;\n selectedNodes: string[];\n showSelectChildrenButton: boolean;\n}\n\nexport const TreeNodeTitle: FunctionComponent<ITreeNodeTitleProps> = ({\n checkable,\n disabledNodes,\n loadRecursively,\n node,\n onSelect,\n selectedNodes,\n showSelectChildrenButton,\n}) => {\n const {t} = useSharedTranslation();\n\n const [hover, setHover] = useState(false);\n\n const isSelected = selectedNodes.includes(node.id) && !node.isShowMore;\n const isDisabled = disabledNodes.includes(node.id);\n\n const buttonInSelectMode = node.children\n .filter(child => !child.isShowMore && !disabledNodes.includes(child.id))\n .every(child => !selectedNodes.includes(child.id));\n\n const handleChildrenSelection = (event: React.MouseEvent) => {\n event.stopPropagation();\n node.children.forEach(child => {\n if (node.disabled || child.isShowMore) {\n return;\n }\n onSelect(child, buttonInSelectMode);\n });\n };\n\n return (\n <TreeNodeLine onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}>\n <TreeNodeLineSection>\n <KitTypography.Text size=\"fontSize5\" disabled={isDisabled}>\n {node.title}\n </KitTypography.Text>\n <SelectedChildrenCount node={node} selectedNodes={selectedNodes} loadRecursively={loadRecursively} />\n </TreeNodeLineSection>\n <TreeNodeLineSection>\n {showSelectChildrenButton && node.children.length > 0 && hover && (\n <KitButton size=\"s\" onClick={e => handleChildrenSelection(e)}>\n {t(`tree-node-selection.${buttonInSelectMode ? 'select_children' : 'unselect_children'}`)}\n </KitButton>\n )}\n {!checkable && isSelected && (\n <FontAwesomeIcon\n icon={faCheck}\n color={\n isDisabled ? 'var(--general-utilities-text-disabled)' : 'var(--general-utilities-text-blue)'\n }\n />\n )}\n </TreeNodeLineSection>\n </TreeNodeLine>\n );\n};\n\nconst SelectedChildrenCount: FunctionComponent<{\n node: ITreeMapElement;\n selectedNodes: string[];\n loadRecursively: boolean;\n}> = ({node, selectedNodes, loadRecursively}) => {\n // it can work only if all children are loaded\n if (!loadRecursively) {\n return null;\n }\n\n const selectedChildrenCount = countSelectedNodes(node, selectedNodes);\n\n return selectedChildrenCount > 0 ? <KitTag idCardProps={{description: selectedChildrenCount}} /> : null;\n};\n\nconst countSelectedNodes = (node: ITreeMapElement, selectedNodes: string[]): number =>\n node.children?.reduce((count, child) => {\n if (selectedNodes.includes(child.id) && !child.isShowMore) {\n count += 1;\n }\n count += countSelectedNodes(child, selectedNodes);\n return count;\n }, 0) ?? 0;\n"]}
1
+ {"version":3,"file":"TreeNodeTitle.js","sourceRoot":"","sources":["../../../src/components/SelectTreeNode/TreeNodeTitle.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,sCAAsC;AACtC,sEAAsE;AACtE,OAAO,EAAC,QAAQ,EAAyB,MAAM,OAAO,CAAC;AAEvD,OAAO,EAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACvE,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,OAAO,EAAC,MAAM,mCAAmC,CAAC;AAE1D,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAI9B,CAAC;AACF,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIrC,CAAC;AAWF,MAAM,CAAC,MAAM,aAAa,GAA2C,CAAC,EAClE,S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,QAAQ,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;IACnC,IAAI,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QACxD,KAAK,IAAI,CAAC,CAAC;IACf,CAAC;IACD,KAAK,IAAI,kBAAkB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IAClD,OAAO,KAAK,CAAC;AACjB,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC","sourcesContent":["// Copyright LEAV Solutions 2017 until 2023/11/05, Copyright Aristid from 2023/11/06\n// This file is released under LGPL V3\n// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt\nimport {useState, type FunctionComponent} from 'react';\nimport {type ITreeMapElement} from './_types';\nimport {KitButton, KitIdCard, KitTag, KitTypography} from 'aristid-ds';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {faCheck} from '@fortawesome/free-solid-svg-icons';\nimport {type ITreeNodeWithRecord} from '_ui/types';\nimport {useSharedTranslation} from '_ui/hooks/useSharedTranslation';\nimport styled from 'styled-components';\n\nconst TreeNodeLine = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n`;\nconst TreeNodeLineSection = styled.div`\n display: flex;\n align-items: center;\n gap: calc(var(--general-spacing-xs) * 1px);\n`;\ninterface ITreeNodeTitleProps {\n checkable: boolean;\n disabledNodes: string[];\n loadRecursively: boolean;\n node: ITreeMapElement;\n onSelect: (node: ITreeNodeWithRecord, selected: boolean) => void;\n selectedNodes: string[];\n showSelectChildrenButton: boolean;\n}\n\nexport const TreeNodeTitle: FunctionComponent<ITreeNodeTitleProps> = ({\n checkable,\n disabledNodes,\n loadRecursively,\n node,\n onSelect,\n selectedNodes,\n showSelectChildrenButton,\n}) => {\n const {t} = useSharedTranslation();\n\n const [hover, setHover] = useState(false);\n\n const isSelected = selectedNodes.includes(node.id) && !node.isShowMore;\n const isDisabled = disabledNodes.includes(node.id);\n\n const buttonInSelectMode = node.children\n .filter(child => !child.isShowMore && !disabledNodes.includes(child.id))\n .every(child => !selectedNodes.includes(child.id));\n\n const handleChildrenSelection = (event: React.MouseEvent) => {\n event.stopPropagation();\n node.children.forEach(child => {\n if (node.disabled || child.isShowMore) {\n return;\n }\n onSelect(child, buttonInSelectMode);\n });\n };\n\n return (\n <TreeNodeLine onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}>\n <TreeNodeLineSection>\n <KitTypography.Text size=\"fontSize5\" disabled={isDisabled}>\n {node.title}\n </KitTypography.Text>\n <SelectedChildrenCount node={node} selectedNodes={selectedNodes} loadRecursively={loadRecursively} />\n </TreeNodeLineSection>\n <TreeNodeLineSection>\n {showSelectChildrenButton && node.children.length > 0 && hover && (\n <KitButton size=\"s\" onClick={e => handleChildrenSelection(e)}>\n {t(`tree-node-selection.${buttonInSelectMode ? 'select_children' : 'unselect_children'}`)}\n </KitButton>\n )}\n {!checkable && isSelected && (\n <FontAwesomeIcon\n icon={faCheck}\n color={\n isDisabled ? 'var(--general-utilities-text-disabled)' : 'var(--general-utilities-text-blue)'\n }\n />\n )}\n </TreeNodeLineSection>\n </TreeNodeLine>\n );\n};\n\nconst SelectedChildrenCount: FunctionComponent<{\n node: ITreeMapElement;\n selectedNodes: string[];\n loadRecursively: boolean;\n}> = ({node, selectedNodes, loadRecursively}) => {\n // it can work only if all children are loaded\n if (!loadRecursively) {\n return null;\n }\n\n const selectedChildrenCount = countSelectedNodes(node, selectedNodes);\n\n return selectedChildrenCount > 0 ? (\n <KitTag>\n <KitIdCard description={selectedChildrenCount} />\n </KitTag>\n ) : null;\n};\n\nconst countSelectedNodes = (node: ITreeMapElement, selectedNodes: string[]): number =>\n node.children?.reduce((count, child) => {\n if (selectedNodes.includes(child.id) && !child.isShowMore) {\n count += 1;\n }\n count += countSelectedNodes(child, selectedNodes);\n return count;\n }, 0) ?? 0;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leav/ui",
3
- "version": "1.7.0-bba65313",
3
+ "version": "1.7.0-e1ab594d",
4
4
  "description": "Shared React components and hooks",
5
5
  "scripts": {
6
6
  "prepublishOnly": "yarn build",
@@ -70,7 +70,7 @@
70
70
  "react-router-dom": "^6.22.0"
71
71
  },
72
72
  "dependencies": {
73
- "@ant-design/icons": "5.2.6",
73
+ "@ant-design/icons": "5.6.1",
74
74
  "@ckeditor/ckeditor5-build-inline": "39.0.2",
75
75
  "@ckeditor/ckeditor5-react": "6.1.0",
76
76
  "@dnd-kit/core": "6.1.0",