@contember/create 2.0.0-rc.1 → 2.0.0
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.
- package/package.json +2 -2
- package/resources/templates/template-workspace/admin/lib/editor/common/editor-block-toolbar.tsx +1 -1
- package/resources/templates/template-workspace/admin/lib/repeater/repeater.tsx +2 -2
- package/resources/templates/template-workspace/admin/lib/select/multi-select.tsx +27 -19
- package/resources/templates/template-workspace/admin/lib/select/select.tsx +10 -10
- package/resources/templates/template-workspace/admin/lib/select/sortable-select.tsx +57 -55
- package/resources/templates/template-workspace/admin/lib/select/ui.tsx +19 -20
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/create",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"bin": "dist/production/run.js",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@contember/cli-common": "2.0.0
|
|
7
|
+
"@contember/cli-common": "2.0.0",
|
|
8
8
|
"chalk": "^5.3.0",
|
|
9
9
|
"fs-extra": "^11.2.0",
|
|
10
10
|
"js-yaml": "^4.1.0"
|
package/resources/templates/template-workspace/admin/lib/editor/common/editor-block-toolbar.tsx
CHANGED
|
@@ -11,7 +11,7 @@ export const EditorBlockToolbar = memo(({ children }: EditorBlockToolbarProps) =
|
|
|
11
11
|
|
|
12
12
|
return (
|
|
13
13
|
<div className="sticky bottom-0" contentEditable={false}>
|
|
14
|
-
<div className={cn('-mx-3 -mb-2 p-2 rounded-b-md border-t bg-gray-50 space-x-2', !selection && 'pointer-events-none
|
|
14
|
+
<div className={cn('-mx-3 -mb-2 p-2 rounded-b-md border-t bg-gray-50 space-x-2', !selection && 'pointer-events-none')}>{children}</div>
|
|
15
15
|
</div>
|
|
16
16
|
)
|
|
17
17
|
})
|
|
@@ -27,13 +27,13 @@ const RepeaterWrapperUI = uic('div', {
|
|
|
27
27
|
baseClass: 'flex flex-col gap-2 relative bg-white mb-4',
|
|
28
28
|
})
|
|
29
29
|
const RepeaterItemUI = uic('div', {
|
|
30
|
-
baseClass: 'rounded border bg-gray-50 border-gray-200 p-4 relative group',
|
|
30
|
+
baseClass: 'rounded border bg-gray-50 border-gray-200 p-4 relative group/repeater-item',
|
|
31
31
|
})
|
|
32
32
|
const RepeaterDragOverlayUI = uic('div', {
|
|
33
33
|
baseClass: 'rounded border border-gray-300 p-4 relative bg-opacity-60 bg-gray-100 backdrop-blur-sm',
|
|
34
34
|
})
|
|
35
35
|
const RepeaterHandleUI = uic('button', {
|
|
36
|
-
baseClass: 'absolute top-1/2 -left-7 h-6 w-6 flex justify-end align-center opacity-10 group-hover:opacity-30 hover:!opacity-100 transition-opacity -translate-y-1/2',
|
|
36
|
+
baseClass: 'absolute top-1/2 -left-7 h-6 w-6 flex justify-end align-center opacity-10 group-hover/repeater-item:opacity-30 hover:!opacity-100 transition-opacity -translate-y-1/2',
|
|
37
37
|
beforeChildren: <GripVerticalIcon size={16} />,
|
|
38
38
|
})
|
|
39
39
|
const RepeaterEmptyUI = uic('div', {
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
RecursionTerminatorPortal,
|
|
4
|
+
SugaredQualifiedEntityList,
|
|
5
|
+
SugaredRelativeEntityList,
|
|
6
|
+
} from '@contember/interface'
|
|
7
|
+
import { DataViewSortingDirections, DataViewUnionFilterFields } from '@contember/react-dataview'
|
|
8
|
+
import { useFormFieldId } from '@contember/react-form'
|
|
9
|
+
import { MultiSelect, SelectEachValue, SelectItemTrigger, SelectPlaceholder } from '@contember/react-select'
|
|
10
|
+
import { ChevronDownIcon } from 'lucide-react'
|
|
1
11
|
import * as React from 'react'
|
|
2
12
|
import { ReactNode } from 'react'
|
|
13
|
+
import { Popover, PopoverTrigger } from '../ui/popover'
|
|
14
|
+
import { CreateEntityDialog } from './create-new'
|
|
15
|
+
import { DefaultSelectDataView } from './list'
|
|
3
16
|
import {
|
|
4
17
|
MultiSelectItemContentUI,
|
|
5
18
|
MultiSelectItemRemoveButtonUI,
|
|
6
19
|
MultiSelectItemUI,
|
|
20
|
+
MultiSelectItemWrapperUI,
|
|
7
21
|
SelectCreateNewTrigger,
|
|
8
22
|
SelectDefaultPlaceholderUI,
|
|
9
23
|
SelectInputActionsUI,
|
|
@@ -11,14 +25,6 @@ import {
|
|
|
11
25
|
SelectInputWrapperUI,
|
|
12
26
|
SelectPopoverContent,
|
|
13
27
|
} from './ui'
|
|
14
|
-
import { ChevronDownIcon } from 'lucide-react'
|
|
15
|
-
import { Popover, PopoverTrigger } from '../ui/popover'
|
|
16
|
-
import { Component, RecursionTerminatorPortal, SugaredQualifiedEntityList, SugaredRelativeEntityList } from '@contember/interface'
|
|
17
|
-
import { DefaultSelectDataView } from './list'
|
|
18
|
-
import { MultiSelect, SelectEachValue, SelectItemTrigger, SelectPlaceholder } from '@contember/react-select'
|
|
19
|
-
import { CreateEntityDialog } from './create-new'
|
|
20
|
-
import { DataViewSortingDirections, DataViewUnionFilterFields } from '@contember/react-dataview'
|
|
21
|
-
import { useFormFieldId } from '@contember/react-form'
|
|
22
28
|
|
|
23
29
|
export type MultiSelectInputProps =
|
|
24
30
|
& {
|
|
@@ -45,19 +51,21 @@ export const MultiSelectInput = Component<MultiSelectInputProps>(({ field, query
|
|
|
45
51
|
{placeholder ?? <SelectDefaultPlaceholderUI />}
|
|
46
52
|
</SelectPlaceholder>
|
|
47
53
|
|
|
48
|
-
<
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
<MultiSelectItemWrapperUI>
|
|
55
|
+
<SelectEachValue>
|
|
56
|
+
<MultiSelectItemUI>
|
|
57
|
+
<MultiSelectItemContentUI>
|
|
58
|
+
{children}
|
|
59
|
+
</MultiSelectItemContentUI>
|
|
60
|
+
<SelectItemTrigger>
|
|
61
|
+
<MultiSelectItemRemoveButtonUI onClick={e => e.stopPropagation()} />
|
|
62
|
+
</SelectItemTrigger>
|
|
63
|
+
</MultiSelectItemUI>
|
|
64
|
+
</SelectEachValue>
|
|
65
|
+
</MultiSelectItemWrapperUI>
|
|
58
66
|
|
|
59
67
|
<SelectInputActionsUI>
|
|
60
|
-
<ChevronDownIcon className=
|
|
68
|
+
<ChevronDownIcon className="w-4 h-4" />
|
|
61
69
|
</SelectInputActionsUI>
|
|
62
70
|
</SelectInputUI>
|
|
63
71
|
</PopoverTrigger>
|
|
@@ -66,18 +66,18 @@ export const SelectInput = Component<SelectInputProps>(({ field, queryField, opt
|
|
|
66
66
|
<SelectEachValue>
|
|
67
67
|
{children}
|
|
68
68
|
</SelectEachValue>
|
|
69
|
+
<SelectInputActionsUI>
|
|
70
|
+
<SelectEachValue>
|
|
71
|
+
<SelectItemTrigger>
|
|
72
|
+
<Button size="xs" variant="ghost" onClick={event => event.stopPropagation()}>
|
|
73
|
+
<XIcon className="w-4 h-4" />
|
|
74
|
+
</Button>
|
|
75
|
+
</SelectItemTrigger>
|
|
76
|
+
</SelectEachValue>
|
|
77
|
+
<ChevronDownIcon className="w-4 h-4" />
|
|
78
|
+
</SelectInputActionsUI>
|
|
69
79
|
</SelectInputUI>
|
|
70
80
|
</PopoverTrigger>
|
|
71
|
-
<SelectInputActionsUI>
|
|
72
|
-
<SelectEachValue>
|
|
73
|
-
<SelectItemTrigger>
|
|
74
|
-
<Button size={'xs'} variant={'ghost'}>
|
|
75
|
-
<XIcon className={'w-4 h-4'} />
|
|
76
|
-
</Button>
|
|
77
|
-
</SelectItemTrigger>
|
|
78
|
-
</SelectEachValue>
|
|
79
|
-
<ChevronDownIcon className={'w-4 h-4'} />
|
|
80
|
-
</SelectInputActionsUI>
|
|
81
81
|
</SelectInputWrapperUI>
|
|
82
82
|
<SelectPopoverContent>
|
|
83
83
|
<DefaultSelectDataView initialSorting={initialSorting} queryField={queryField}>
|
|
@@ -1,11 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
HasOne,
|
|
4
|
+
SugaredQualifiedEntityList,
|
|
5
|
+
SugaredRelativeEntityList,
|
|
6
|
+
SugaredRelativeSingleEntity,
|
|
7
|
+
SugaredRelativeSingleField,
|
|
8
|
+
} from '@contember/interface'
|
|
9
|
+
import { DataViewSortingDirections, DataViewUnionFilterFields } from '@contember/react-dataview'
|
|
10
|
+
import { useFormFieldId } from '@contember/react-form'
|
|
11
|
+
import {
|
|
12
|
+
RepeaterSortable,
|
|
13
|
+
RepeaterSortableDragOverlay,
|
|
14
|
+
RepeaterSortableDropIndicator,
|
|
15
|
+
RepeaterSortableEachItem,
|
|
16
|
+
RepeaterSortableItemActivator,
|
|
17
|
+
RepeaterSortableItemNode,
|
|
18
|
+
} from '@contember/react-repeater-dnd-kit'
|
|
19
|
+
import { SelectItemTrigger, SelectPlaceholder, SortableMultiSelect } from '@contember/react-select'
|
|
20
|
+
import { ChevronDownIcon } from 'lucide-react'
|
|
4
21
|
import { ReactNode } from 'react'
|
|
22
|
+
import { Popover, PopoverTrigger } from '../ui/popover'
|
|
23
|
+
import { DropIndicator } from '../ui/sortable'
|
|
24
|
+
import { cn } from '../utils'
|
|
25
|
+
import { CreateEntityDialog } from './create-new'
|
|
26
|
+
import { DefaultSelectDataView } from './list'
|
|
5
27
|
import {
|
|
6
28
|
MultiSelectItemDragOverlayUI,
|
|
7
29
|
MultiSelectItemRemoveButtonUI,
|
|
8
30
|
MultiSelectItemUI,
|
|
31
|
+
MultiSelectItemWrapperUI,
|
|
9
32
|
MultiSelectSortableItemContentUI,
|
|
10
33
|
SelectCreateNewTrigger,
|
|
11
34
|
SelectDefaultPlaceholderUI,
|
|
@@ -14,29 +37,6 @@ import {
|
|
|
14
37
|
SelectInputWrapperUI,
|
|
15
38
|
SelectPopoverContent,
|
|
16
39
|
} from './ui'
|
|
17
|
-
import { Popover, PopoverTrigger } from '../ui/popover'
|
|
18
|
-
import { ChevronDownIcon } from 'lucide-react'
|
|
19
|
-
import { DefaultSelectDataView } from './list'
|
|
20
|
-
import {
|
|
21
|
-
RepeaterSortable,
|
|
22
|
-
RepeaterSortableDragOverlay,
|
|
23
|
-
RepeaterSortableDropIndicator,
|
|
24
|
-
RepeaterSortableEachItem,
|
|
25
|
-
RepeaterSortableItemActivator,
|
|
26
|
-
RepeaterSortableItemNode,
|
|
27
|
-
} from '@contember/react-repeater-dnd-kit'
|
|
28
|
-
import {
|
|
29
|
-
Component,
|
|
30
|
-
HasOne,
|
|
31
|
-
SugaredQualifiedEntityList,
|
|
32
|
-
SugaredRelativeEntityList,
|
|
33
|
-
SugaredRelativeSingleEntity,
|
|
34
|
-
SugaredRelativeSingleField,
|
|
35
|
-
} from '@contember/interface'
|
|
36
|
-
import { SelectItemTrigger, SelectPlaceholder, SortableMultiSelect } from '@contember/react-select'
|
|
37
|
-
import { CreateEntityDialog } from './create-new'
|
|
38
|
-
import { DataViewSortingDirections, DataViewUnionFilterFields } from '@contember/react-dataview'
|
|
39
|
-
import { useFormFieldId } from '@contember/react-form'
|
|
40
40
|
|
|
41
41
|
const MultiSortableSelectDropIndicator = ({ position }: { position: 'before' | 'after' }) => (
|
|
42
42
|
<div className={cn('relative', position === 'before' ? '-translate-x-0.5' : 'translate-x-1.5')}>
|
|
@@ -72,37 +72,39 @@ export const SortableMultiSelectInput = Component<SortableMultiSelectInputProps>
|
|
|
72
72
|
{placeholder ?? <SelectDefaultPlaceholderUI />}
|
|
73
73
|
</SelectPlaceholder>
|
|
74
74
|
|
|
75
|
-
<
|
|
76
|
-
<
|
|
77
|
-
<
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
<
|
|
81
|
-
<
|
|
82
|
-
<
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
75
|
+
<MultiSelectItemWrapperUI>
|
|
76
|
+
<RepeaterSortable>
|
|
77
|
+
<RepeaterSortableEachItem>
|
|
78
|
+
<div className={'flex'}>
|
|
79
|
+
<MultiSortableSelectDropIndicator position={'before'} />
|
|
80
|
+
<RepeaterSortableItemNode>
|
|
81
|
+
<MultiSelectItemUI>
|
|
82
|
+
<HasOne field={connectAt}>
|
|
83
|
+
<RepeaterSortableItemActivator>
|
|
84
|
+
<MultiSelectSortableItemContentUI>
|
|
85
|
+
{children}
|
|
86
|
+
</MultiSelectSortableItemContentUI>
|
|
87
|
+
</RepeaterSortableItemActivator>
|
|
87
88
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
89
|
+
<SelectItemTrigger>
|
|
90
|
+
<MultiSelectItemRemoveButtonUI onClick={e => e.stopPropagation()} />
|
|
91
|
+
</SelectItemTrigger>
|
|
92
|
+
</HasOne>
|
|
93
|
+
</MultiSelectItemUI>
|
|
94
|
+
</RepeaterSortableItemNode>
|
|
95
|
+
<MultiSortableSelectDropIndicator position={'after'} />
|
|
96
|
+
</div>
|
|
97
|
+
</RepeaterSortableEachItem>
|
|
97
98
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
<RepeaterSortableDragOverlay>
|
|
100
|
+
<MultiSelectItemDragOverlayUI>
|
|
101
|
+
<HasOne field={connectAt}>
|
|
102
|
+
{children}
|
|
103
|
+
</HasOne>
|
|
104
|
+
</MultiSelectItemDragOverlayUI>
|
|
105
|
+
</RepeaterSortableDragOverlay>
|
|
106
|
+
</RepeaterSortable>
|
|
107
|
+
</MultiSelectItemWrapperUI>
|
|
106
108
|
|
|
107
109
|
<SelectInputActionsUI>
|
|
108
110
|
<ChevronDownIcon className={'w-4 h-4'} />
|
|
@@ -8,33 +8,30 @@ import { dict } from '../dict'
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
export const SelectInputWrapperUI = uic('div', {
|
|
11
|
-
baseClass:
|
|
12
|
-
w-full max-w-md
|
|
13
|
-
relative
|
|
14
|
-
`,
|
|
11
|
+
baseClass: 'w-full max-w-md relative',
|
|
15
12
|
})
|
|
16
13
|
|
|
17
14
|
export const SelectInputUI = uic('button', {
|
|
18
|
-
baseClass:
|
|
19
|
-
flex gap-2
|
|
20
|
-
w-full min-h-10
|
|
21
|
-
|
|
22
|
-
bg-background
|
|
23
|
-
rounded-md border border-input ring-offset-background
|
|
24
|
-
text-sm
|
|
25
|
-
cursor-pointer
|
|
26
|
-
hover:border-gray-400
|
|
27
|
-
placeholder:text-muted-foreground
|
|
28
|
-
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
|
|
29
|
-
disabled:cursor-not-allowed disabled:opacity-50
|
|
30
|
-
|
|
15
|
+
baseClass: [
|
|
16
|
+
'flex gap-2 justify-between items-center',
|
|
17
|
+
'w-full min-h-10',
|
|
18
|
+
'px-2 py-1',
|
|
19
|
+
'bg-background',
|
|
20
|
+
'rounded-md border border-input ring-offset-background',
|
|
21
|
+
'text-sm text-left',
|
|
22
|
+
'cursor-pointer',
|
|
23
|
+
'hover:border-gray-400',
|
|
24
|
+
'placeholder:text-muted-foreground',
|
|
25
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
26
|
+
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
27
|
+
],
|
|
31
28
|
})
|
|
32
29
|
export const SelectInputActionsUI = uic('span', {
|
|
33
|
-
baseClass: '
|
|
30
|
+
baseClass: 'flex gap-1 items-center',
|
|
34
31
|
})
|
|
35
32
|
|
|
36
33
|
export const SelectListItemUI = uic(Button, {
|
|
37
|
-
baseClass: 'w-full text-left justify-start gap-1 data-[highlighted]:bg-gray-200 data-[selected]:bg-gray-100 group relative h-auto',
|
|
34
|
+
baseClass: 'w-full text-left justify-start gap-1 data-[highlighted]:bg-gray-200 data-[selected]:bg-gray-100 group relative min-h-8 h-auto',
|
|
38
35
|
defaultProps: {
|
|
39
36
|
variant: 'ghost',
|
|
40
37
|
size: 'sm',
|
|
@@ -43,7 +40,9 @@ export const SelectListItemUI = uic(Button, {
|
|
|
43
40
|
})
|
|
44
41
|
|
|
45
42
|
export const SelectDefaultPlaceholderUI = () => <span className={'text-gray-400'}>{dict.select.placeholder}</span>
|
|
46
|
-
|
|
43
|
+
export const MultiSelectItemWrapperUI = uic('div', {
|
|
44
|
+
baseClass: 'flex flex-wrap gap-1 items-center justify-start',
|
|
45
|
+
})
|
|
47
46
|
export const MultiSelectItemUI = uic('span', {
|
|
48
47
|
baseClass: 'flex items-stretch border rounded hover:shadow transition-all',
|
|
49
48
|
})
|