-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
267 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
148 changes: 148 additions & 0 deletions
148
judo-ui-react/src/main/resources/actor/src/containers/components/tag/index.tsx.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
{{> fragment.header.hbs }} | ||
|
||
import { useState, useEffect, useMemo, useRef, useCallback } from 'react'; | ||
import type { ElementType, MouseEvent, Dispatch, SetStateAction, FC } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import type { JudoIdentifiable } from '~/services/data-api/common/JudoIdentifiable'; | ||
import type { JudoRestResponse } from '~/services/data-api/rest/requestResponse'; | ||
import Box from '@mui/material/Box'; | ||
import IconButton from '@mui/material/IconButton'; | ||
import Button from '@mui/material/Button'; | ||
import ButtonGroup from '@mui/material/ButtonGroup'; | ||
import Typography from '@mui/material/Typography'; | ||
import { GridLogicOperator, useGridApiRef } from '@mui/x-data-grid{{ getMUIDataGridPlanSuffix }}'; | ||
{{# if isMUILicensePlanPro }} | ||
import { gridColumnDefinitionsSelector } from '@mui/x-data-grid{{ getMUIDataGridPlanSuffix }}'; | ||
{{/ if }} | ||
import type { | ||
GridColDef, | ||
GridFilterModel, | ||
GridRowModel, | ||
GridRowId, | ||
GridRenderCellParams, | ||
GridRowSelectionModel, | ||
GridSortItem, | ||
GridSortModel, | ||
GridRowClassNameParams, | ||
GridRowParams, | ||
GridValidRowModel, | ||
} from '@mui/x-data-grid{{ getMUIDataGridPlanSuffix }}'; | ||
import { baseColumnConfig, baseTableConfig, basePageSizeOptions{{# unless table.isEager }}, filterDebounceMs{{/ unless }} } from '~/config'; | ||
import { MdiIcon{{# unless table.isEager }}, CustomTablePagination{{/ unless }} } from '~/components'; | ||
import { | ||
{{# if (tableHasBooleanColumn table) }}booleanColumnOperators,{{/ if }} | ||
{{# if (tableHasDateColumn table) }}dateColumnOperators,{{/ if }} | ||
{{# if (tableHasDateTimeColumn table) }}dateTimeColumnOperators,{{/ if }} | ||
{{# if (tableHasNumericColumn table) }}numericColumnOperators,{{/ if }} | ||
{{# if (tableHasEnumerationColumn table) }}singleSelectColumnOperators,{{/ if }} | ||
{{# if isUseInlineColumnFilters }}stringColumnOperators,{{/ if }} | ||
columnsActionCalculator, | ||
ContextMenu, | ||
StripedDataGrid, | ||
EagerTable, | ||
LazyTable, | ||
} from '~/components/table'; | ||
import { Tags } from '~/components/widgets'; | ||
import { useConfirmDialog } from '~/components/dialog'; | ||
import type { ContextMenuApi } from '~/components/table/ContextMenu'; | ||
import type { Filter, FilterOption } from '~/components-api'; | ||
import { FilterType } from '~/components-api'; | ||
import { CUSTOM_VISUAL_ELEMENT_INTERFACE_KEY } from '~/custom'; | ||
{{# each (getTableAPIImports table container) as |imp| }} | ||
import type { | ||
{{ imp }}, | ||
{{ imp }}Stored, | ||
} from '~/services/data-api/model/{{ imp }}'; | ||
import type { | ||
{{ imp }}QueryCustomizer, | ||
} from '~/services/data-api/rest/{{ imp }}QueryCustomizer'; | ||
{{/ each }} | ||
{{# or (tableHasNumericColumn table) (tableHasDateColumn table) (tableHasDateTimeColumn table) }} | ||
import { useL10N } from '~/l10n/l10n-context'; | ||
{{/ or }} | ||
import { | ||
TABLE_COLUMN_CUSTOMIZER_HOOK_INTERFACE_KEY, | ||
randomUtils, | ||
{{# if container.isSelector }} | ||
isRowSelectable, | ||
{{ else }} | ||
getUpdatedRowsSelected, | ||
{{/ if }} | ||
{{# if table.isEager }} | ||
applyInMemoryFilters, | ||
{{/ if }} | ||
{{# if (tableHasBinaryColumn table) }} | ||
fileHandling, | ||
{{/ if }} | ||
{{# if isUseInlineColumnFilters }} | ||
mapFilterModelToFilters, | ||
mapFilterToFilterModel, | ||
{{/ if }} | ||
mapAllFiltersToQueryCustomizerProperties, | ||
processQueryCustomizer, | ||
serializeFilters, | ||
deserializeFilters, | ||
{{# unless table.isEager }} | ||
useErrorHandler, | ||
{{/ unless }} | ||
} from '~/utilities'; | ||
import type { SidekickComponentProps, DialogResult, TableRowAction, ToolBarActionProps, ColumnCustomizerHook, FiltersSerializer{{# if isMUILicensePlanPro }}, PersistedColumnInfo{{/ if }} } from '~/utilities'; | ||
import { OBJECTCLASS } from '@pandino/pandino-api'; | ||
import { useTrackComponent, ComponentProxy } from '@pandino/react-hooks'; | ||
{{# if (stringValueIsTrue useTableRowHighlighting) }} | ||
import { useTrackService } from '@pandino/react-hooks'; | ||
import { RowHighlightLegend } from '~/components/table'; | ||
import { TABLE_ROW_HIGHLIGHTING_HOOK_INTERFACE_KEY, transformRowStylings } from '~/theme/table-row-highlighting'; | ||
import type { RowStylerConfigured, TableRowHighlightingHook } from '~/theme/table-row-highlighting'; | ||
{{/ if }} | ||
import type { {{ componentName table }}ActionDefinitions, {{ componentName table }}Props } from './types'; | ||
import { {{ classDataName (getReferenceClassType table) 'StoredSerializer' }} } from '~/services/data-api/rest/{{ classDataName (getReferenceClassType table) 'Serializer' }}'; | ||
|
||
|
||
export const filtersSerializer: FiltersSerializer = { | ||
serialize: (filters: Filter[]) => serializeFilters<{{ classDataName (getReferenceClassType table) 'Stored' }}>(filters, {{ classDataName (getReferenceClassType table) 'StoredSerializer' }}.getInstance()), | ||
deserialize: (filters: Filter[]) => deserializeFilters<{{ classDataName (getReferenceClassType table) 'Stored' }}>(filters, {{ classDataName (getReferenceClassType table) 'StoredSerializer' }}.getInstance()), | ||
}; | ||
|
||
// XMIID: {{ getXMIID table }} | ||
// Name: {{ table.name }} | ||
export function {{ componentName table }}(props: {{ componentName table }}Props) { | ||
const { | ||
uniqueId, | ||
actions, | ||
dataPath, | ||
isOwnerLoading, | ||
isDraft, | ||
validationError, | ||
ownerData, | ||
editMode, | ||
isFormUpdateable, | ||
} = props; | ||
|
||
return ( | ||
<div id="{{ getXMIID table }}" data-table-name="{{ table.name }}"> | ||
<Tags<{{ classDataName container.dataElement '' }}, {{ classDataName (getReferenceClassType table) 'Stored' }}> | ||
id="{{ getXMIID table }}" | ||
label={'KUKAC'} | ||
helperText={validationError} | ||
error={!!validationError} | ||
editMode={editMode} | ||
ownerData={ownerData} | ||
name="{{ table.relationName }}" | ||
disabled={!isFormUpdateable()} | ||
autoCompleteAttribute="{{ table.columns.[0].attributeType.name }}" | ||
onAutoCompleteSearch={ async (searchText, preparedQueryCustomizer) => { | ||
alert('lol'); | ||
return Promise.resolve([]); | ||
} } | ||
onValueChange={ async (values) => { | ||
console.log(values); | ||
} } | ||
onItemClick={(target) => alert('A')} | ||
onSearchDialogsClick={() => alert('B')} | ||
onClearDialogsClick={() => alert('C')} | ||
identifierAttribute="__identifier" | ||
/> | ||
</div> | ||
); | ||
} |
72 changes: 72 additions & 0 deletions
72
judo-ui-react/src/main/resources/actor/src/containers/components/tag/types.ts.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import type { ElementType, Dispatch, SetStateAction } from 'react'; | ||
import type { | ||
GridFilterModel, | ||
} from '@mui/x-data-grid{{ getMUIDataGridPlanSuffix }}'; | ||
{{# each (getTableAPIImports table container) as |imp| }} | ||
import type { | ||
{{ imp }}, | ||
{{ imp }}Stored, | ||
} from '~/services/data-api/model/{{ imp }}'; | ||
import type { | ||
{{ imp }}QueryCustomizer, | ||
} from '~/services/data-api/rest/{{ imp }}QueryCustomizer'; | ||
{{/ each }} | ||
import type { JudoRestResponse } from '~/services/data-api/rest/requestResponse'; | ||
import type { Filter, FilterOption } from '~/components-api'; | ||
import type { DialogResult } from '~/utilities'; | ||
|
||
export interface {{ componentName table }}ActionDefinitions { | ||
get{{ firstToUpper table.relationName }}Mask?: () => string; | ||
get{{ firstToUpper table.relationName }}RowRepresentation?: (row: {{ classDataName (getReferenceClassType table) 'Stored' }}) => string; | ||
{{# each table.tableActionDefinitions as |actionDefinition| }} | ||
{{# if actionDefinition.isFilterAction }} | ||
{{ simpleActionDefinitionName actionDefinition }}?: (id: string, filterOptions: FilterOption[], model?: GridFilterModel, filters?: Filter[]) => Promise<{ model?: GridFilterModel; filters?: Filter[] }>; | ||
{{ else }} | ||
{{# if actionDefinition.isRefreshAction }} | ||
{{ simpleActionDefinitionName actionDefinition }}?: (queryCustomizer: {{ classDataName (getReferenceClassType table) 'QueryCustomizer' }}) => Promise<JudoRestResponse<{{ classDataName (getReferenceClassType table) 'Stored' }}[]>>; | ||
{{ else }} | ||
{{# if actionDefinition.isExportAction }} | ||
{{ simpleActionDefinitionName actionDefinition }}?: (queryCustomizer: {{ classDataName (getReferenceClassType table) 'QueryCustomizer' }}) => Promise<void>; | ||
{{ else }} | ||
{{# if actionDefinition.isSelectorRangeAction }} | ||
{{ simpleActionDefinitionName actionDefinition }}?: (queryCustomizer: {{ classDataName (getReferenceClassType table) 'QueryCustomizer' }}) => Promise<JudoRestResponse<{{ classDataName (getReferenceClassType table) 'Stored' }}[]>>; | ||
{{ else }} | ||
{{# if actionDefinition.isBulk }} | ||
{{ simpleActionDefinitionName actionDefinition }}?: (selectedRows: {{ classDataName (getReferenceClassType table) 'Stored' }}[]) => Promise<DialogResult<{{ classDataName (getReferenceClassType table) 'Stored' }}[]>>; | ||
{{ else }} | ||
{{ simpleActionDefinitionName actionDefinition }}?: ({{# if actionDefinition.targetType }}target: {{ classDataName actionDefinition.targetType 'Stored' }}{{/ if }}) => Promise<void>; | ||
{{/ if }} | ||
{{/ if }} | ||
{{/ if }} | ||
{{/ if }} | ||
{{/ if }} | ||
{{/ each }} | ||
{{# each table.rowActionDefinitions as |actionDefinition| }} | ||
{{ simpleActionDefinitionName actionDefinition }}?: (row: {{ classDataName (getReferenceClassType table) 'Stored' }}{{# if actionDefinition.isOpenPageAction }}, isDraft?: boolean{{/ if }}) => Promise<void>; | ||
{{/ each }} | ||
{{ table.relationType.name }}AdditionalToolbarButtons?: ( | ||
{{# with (getReferenceClassType table) as |classType| }} | ||
data: {{# if classType.isMapped }}{{ classDataName classType 'Stored' }}{{ else }}{{ classDataName classType '' }}{{/ if }}[], | ||
{{/ with }} | ||
isLoading: boolean, | ||
selectedRows: {{ classDataName (getReferenceClassType table) 'Stored' }}[], | ||
clearSelections: () => void | ||
{{# unless container.table }} | ||
, ownerData: {{ classDataName container.dataElement 'Stored' }} | ||
, editMode: boolean | ||
, isFormUpdateable: () => boolean | ||
{{/ unless }} | ||
) => Record<string, ElementType>; | ||
} | ||
|
||
export interface {{ componentName table }}Props { | ||
uniqueId: string; | ||
actions: {{ componentName table }}ActionDefinitions; | ||
dataPath?: string; | ||
isOwnerLoading?: boolean; | ||
isDraft?: boolean; | ||
validationError?: string; | ||
ownerData: {{ classDataName container.dataElement 'Stored' }}; | ||
editMode: boolean; | ||
isFormUpdateable: () => boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.