@contember/create 1.4.0-rc.8 → 2.0.0-alpha.12
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/dist/development/run.cjs +27 -0
- package/dist/development/run.cjs.map +1 -0
- package/dist/development/run.js +26 -0
- package/dist/development/run.js.map +1 -0
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs +50 -0
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -0
- package/dist/development/src/commands/WorkspaceCreateCommand.js +50 -0
- package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -0
- package/dist/development/src/lib/FileSystem.cjs +48 -0
- package/dist/development/src/lib/FileSystem.cjs.map +1 -0
- package/dist/development/src/lib/FileSystem.js +32 -0
- package/dist/development/src/lib/FileSystem.js.map +1 -0
- package/dist/development/src/lib/PackageDownloader.cjs +33 -0
- package/dist/development/src/lib/PackageDownloader.cjs.map +1 -0
- package/dist/development/src/lib/PackageDownloader.js +33 -0
- package/dist/development/src/lib/PackageDownloader.js.map +1 -0
- package/dist/development/src/lib/TemplateInstaller.cjs +87 -0
- package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -0
- package/dist/development/src/lib/TemplateInstaller.js +87 -0
- package/dist/development/src/lib/TemplateInstaller.js.map +1 -0
- package/dist/development/src/lib/version.cjs +10 -0
- package/dist/development/src/lib/version.cjs.map +1 -0
- package/dist/development/src/lib/version.js +10 -0
- package/dist/development/src/lib/version.js.map +1 -0
- package/dist/development/src/paths.cjs +10 -0
- package/dist/development/src/paths.cjs.map +1 -0
- package/dist/development/src/paths.js +9 -0
- package/dist/development/src/paths.js.map +1 -0
- package/dist/production/run.cjs +27 -0
- package/dist/production/run.cjs.map +1 -0
- package/dist/production/run.js +26 -0
- package/dist/production/run.js.map +1 -0
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs +50 -0
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -0
- package/dist/production/src/commands/WorkspaceCreateCommand.js +50 -0
- package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -0
- package/dist/production/src/lib/FileSystem.cjs +48 -0
- package/dist/production/src/lib/FileSystem.cjs.map +1 -0
- package/dist/production/src/lib/FileSystem.js +32 -0
- package/dist/production/src/lib/FileSystem.js.map +1 -0
- package/dist/production/src/lib/PackageDownloader.cjs +33 -0
- package/dist/production/src/lib/PackageDownloader.cjs.map +1 -0
- package/dist/production/src/lib/PackageDownloader.js +33 -0
- package/dist/production/src/lib/PackageDownloader.js.map +1 -0
- package/dist/production/src/lib/TemplateInstaller.cjs +87 -0
- package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -0
- package/dist/production/src/lib/TemplateInstaller.js +87 -0
- package/dist/production/src/lib/TemplateInstaller.js.map +1 -0
- package/dist/production/src/lib/version.cjs +10 -0
- package/dist/production/src/lib/version.cjs.map +1 -0
- package/dist/production/src/lib/version.js +10 -0
- package/dist/production/src/lib/version.js.map +1 -0
- package/dist/production/src/paths.cjs +10 -0
- package/dist/production/src/paths.cjs.map +1 -0
- package/dist/production/src/paths.js +9 -0
- package/dist/production/src/paths.js.map +1 -0
- package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -0
- package/dist/{src → types}/lib/FileSystem.d.ts +0 -1
- package/dist/types/lib/FileSystem.d.ts.map +1 -0
- package/dist/{src → types}/lib/PackageDownloader.d.ts.map +1 -1
- package/dist/{src → types}/lib/TemplateInstaller.d.ts.map +1 -1
- package/dist/types/lib/version.d.ts +2 -0
- package/dist/types/lib/version.d.ts.map +1 -0
- package/dist/{src/lib/pathUtils.d.ts → types/paths.d.ts} +1 -1
- package/dist/types/paths.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +27 -6
- package/resources/templates/template-workspace/admin/app/index.html +1 -1
- package/resources/templates/template-workspace/admin/lib/binding/delete.tsx +1 -1
- package/resources/templates/template-workspace/admin/lib/block-repeater/block-repeater.tsx +2 -2
- package/resources/templates/template-workspace/admin/lib/datagrid/column-header.tsx +64 -40
- package/resources/templates/template-workspace/admin/lib/datagrid/columns.tsx +166 -33
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/boolean.tsx +23 -17
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/date.tsx +44 -35
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/enum.tsx +22 -14
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/mobile.tsx +4 -4
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/number.tsx +31 -24
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/relation.tsx +51 -32
- package/resources/templates/template-workspace/admin/lib/datagrid/grid.tsx +2 -10
- package/resources/templates/template-workspace/admin/lib/datagrid/table.tsx +17 -10
- package/resources/templates/template-workspace/admin/lib/datagrid/tiles.tsx +4 -2
- package/resources/templates/template-workspace/admin/lib/datagrid/toolbar.tsx +8 -2
- package/resources/templates/template-workspace/admin/lib/datagrid/ui.tsx +4 -4
- package/resources/templates/template-workspace/admin/lib/dict.ts +65 -72
- package/resources/templates/template-workspace/admin/lib/dimensions/dimensions.tsx +2 -2
- package/resources/templates/template-workspace/admin/lib/editor/common/editor-canvas.tsx +2 -2
- package/resources/templates/template-workspace/admin/lib/editor/common/editor-editable-canvas.tsx +1 -1
- package/resources/templates/template-workspace/admin/lib/editor/common/editor-inline-toolbar.tsx +2 -5
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/TableElementRenderer.tsx +2 -2
- package/resources/templates/template-workspace/admin/lib/editor/editor-block.tsx +1 -1
- package/resources/templates/template-workspace/admin/lib/editor/rich-text.tsx +5 -5
- package/resources/templates/template-workspace/admin/lib/editor/sortable-block.tsx +3 -3
- package/resources/templates/template-workspace/admin/lib/form/container.tsx +5 -4
- package/resources/templates/template-workspace/admin/lib/form/inputs.tsx +15 -12
- package/resources/templates/template-workspace/admin/lib/form/select.tsx +23 -10
- package/resources/templates/template-workspace/admin/lib/form/ui.tsx +9 -0
- package/resources/templates/template-workspace/admin/lib/form/upload.tsx +119 -36
- package/resources/templates/template-workspace/admin/lib/formatting/formatting.ts +6 -8
- package/resources/templates/template-workspace/admin/lib/layout/layout.tsx +3 -2
- package/resources/templates/template-workspace/admin/lib/repeater/repeater.tsx +16 -8
- package/resources/templates/template-workspace/admin/lib/select/create-new.tsx +1 -1
- package/resources/templates/template-workspace/admin/lib/select/highlight.tsx +9 -9
- package/resources/templates/template-workspace/admin/lib/select/select.tsx +15 -3
- package/resources/templates/template-workspace/admin/lib/tenant/forms/common.tsx +1 -1
- package/resources/templates/template-workspace/admin/lib/tenant/hooks/useInvite.ts +3 -3
- package/resources/templates/template-workspace/admin/lib/tenant/hooks/useInviteUser.tsx +19 -19
- package/resources/templates/template-workspace/admin/lib/tenant/listing/member-list.tsx +1 -1
- package/resources/templates/template-workspace/admin/lib/ui/dropdown.tsx +7 -7
- package/resources/templates/template-workspace/admin/lib/ui/input.tsx +4 -6
- package/resources/templates/template-workspace/admin/lib/ui/scroll-area.tsx +24 -24
- package/resources/templates/template-workspace/admin/lib/ui/select.tsx +79 -0
- package/resources/templates/template-workspace/admin/lib/ui/sheet.tsx +0 -2
- package/resources/templates/template-workspace/admin/lib/upload/dropzone.tsx +13 -2
- package/resources/templates/template-workspace/admin/lib/upload/ui.tsx +1 -11
- package/resources/templates/template-workspace/admin/lib/upload/upload-progress.tsx +1 -1
- package/resources/templates/template-workspace/admin/lib/upload/view.tsx +39 -26
- package/resources/templates/template-workspace/admin/lib/utils/uic.tsx +6 -6
- package/resources/templates/template-workspace/admin/package.json +18 -18
- package/resources/templates/template-workspace/api/package.json +0 -3
- package/resources/templates/template-workspace/client/package.json +0 -3
- package/resources/templates/template-workspace/package.json +1 -1
- package/src/commands/WorkspaceCreateCommand.ts +3 -2
- package/src/lib/version.ts +7 -0
- package/src/{lib/pathUtils.ts → paths.ts} +3 -1
- package/src/run.ts +1 -1
- package/src/tsconfig.json +1 -1
- package/dist/src/commands/WorkspaceCreateCommand.d.ts.map +0 -1
- package/dist/src/commands/WorkspaceCreateCommand.js +0 -54
- package/dist/src/commands/WorkspaceCreateCommand.js.map +0 -1
- package/dist/src/commands/index.js +0 -18
- package/dist/src/commands/index.js.map +0 -1
- package/dist/src/lib/FileSystem.d.ts.map +0 -1
- package/dist/src/lib/FileSystem.js +0 -54
- package/dist/src/lib/FileSystem.js.map +0 -1
- package/dist/src/lib/PackageDownloader.js +0 -32
- package/dist/src/lib/PackageDownloader.js.map +0 -1
- package/dist/src/lib/TemplateInstaller.js +0 -75
- package/dist/src/lib/TemplateInstaller.js.map +0 -1
- package/dist/src/lib/pathUtils.d.ts.map +0 -1
- package/dist/src/lib/pathUtils.js +0 -7
- package/dist/src/lib/pathUtils.js.map +0 -1
- package/dist/src/run.js +0 -25
- package/dist/src/run.js.map +0 -1
- package/dist/src/tsconfig.tsbuildinfo +0 -1
- package/resources/templates/template-workspace/admin/lib/utils/dict-format.tsx +0 -3
- package/resources/templates/template-workspace/admin/lib/utils/format-image-resize-url.ts +0 -17
- package/resources/templates/template-workspace/admin/lib/utils/formatting.ts +0 -60
- package/resources/templates/template-workspace/admin/vite.config.ts +0 -39
- /package/dist/{src → types}/commands/WorkspaceCreateCommand.d.ts +0 -0
- /package/dist/{src → types}/commands/index.d.ts +0 -0
- /package/dist/{src → types}/commands/index.d.ts.map +0 -0
- /package/dist/{src → types}/lib/PackageDownloader.d.ts +0 -0
- /package/dist/{src → types}/lib/TemplateInstaller.d.ts +0 -0
- /package/dist/{src → types}/run.d.ts +0 -0
- /package/dist/{src → types}/run.d.ts.map +0 -0
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
useDataViewRelationFilterFactory,
|
|
15
15
|
UseDataViewRelationFilterResult,
|
|
16
16
|
} from '@contember/react-dataview'
|
|
17
|
-
import { Component, EntityId, useEntity } from '@contember/interface'
|
|
17
|
+
import { Component, EntityId, StaticRender, useEntity } from '@contember/interface'
|
|
18
18
|
import { Popover, PopoverTrigger } from '../../ui/popover'
|
|
19
19
|
import { DataGridActiveFilterUI, DataGridExcludeActionButtonUI, DataGridFilterActionButtonUI, DataGridFilterSelectItemUI, DataGridFilterSelectTriggerUI, DataGridSingleFilterUI } from '../ui'
|
|
20
20
|
import { DataGridNullFilter } from './common'
|
|
@@ -70,25 +70,31 @@ const DataGridRelationFilterInner = Component(({ children, label }: DataGridRela
|
|
|
70
70
|
)
|
|
71
71
|
}, () => null)
|
|
72
72
|
|
|
73
|
-
export const DataGridHasOneTooltip = Component(({ children, actions, ...props }: DataViewHasOneFilterProps & { children: ReactNode
|
|
73
|
+
export const DataGridHasOneTooltip = Component(({ children, actions, ...props }: DataViewHasOneFilterProps & { children: ReactNode; actions?: ReactNode }) => (<>
|
|
74
74
|
<DataViewHasOneFilter {...props}>
|
|
75
75
|
<DataGridRelationFieldTooltipInner actions={actions}>
|
|
76
76
|
{children}
|
|
77
77
|
</DataGridRelationFieldTooltipInner>
|
|
78
78
|
</DataViewHasOneFilter>
|
|
79
|
-
|
|
79
|
+
<StaticRender>
|
|
80
|
+
{children}
|
|
81
|
+
</StaticRender>
|
|
82
|
+
</>))
|
|
80
83
|
|
|
81
|
-
export const DataGridHasManyTooltip = Component<DataViewHasManyFilterProps & { children: ReactNode
|
|
82
|
-
return (
|
|
84
|
+
export const DataGridHasManyTooltip = Component<DataViewHasManyFilterProps & { children: ReactNode; actions?: ReactNode }>(({ children, actions, ...props }, env) => {
|
|
85
|
+
return (<>
|
|
83
86
|
<DataViewHasManyFilter {...props}>
|
|
84
87
|
<DataGridRelationFieldTooltipInner actions={actions}>
|
|
85
88
|
{children}
|
|
86
89
|
</DataGridRelationFieldTooltipInner>
|
|
87
90
|
</DataViewHasManyFilter>
|
|
88
|
-
|
|
91
|
+
<StaticRender>
|
|
92
|
+
{children}
|
|
93
|
+
</StaticRender>
|
|
94
|
+
</>)
|
|
89
95
|
})
|
|
90
96
|
|
|
91
|
-
const DataGridRelationFieldTooltipInner = Component(({ children, actions }: { children: ReactNode
|
|
97
|
+
const DataGridRelationFieldTooltipInner = Component(({ children, actions }: { children: ReactNode; actions?: ReactNode }) => (
|
|
92
98
|
<TooltipProvider>
|
|
93
99
|
<Tooltip>
|
|
94
100
|
<TooltipTrigger asChild>
|
|
@@ -109,7 +115,7 @@ const DataGridRelationFieldTooltipInner = Component(({ children, actions }: { ch
|
|
|
109
115
|
</TooltipProvider>
|
|
110
116
|
))
|
|
111
117
|
|
|
112
|
-
const DataGridRelationFilteredItemsList = ({ children }: {
|
|
118
|
+
export const DataGridRelationFilteredItemsList = ({ children }: {
|
|
113
119
|
children: ReactNode
|
|
114
120
|
}) => (
|
|
115
121
|
<>
|
|
@@ -132,29 +138,28 @@ const DataGridRelationFilterSelectItem = forwardRef<HTMLButtonElement, {
|
|
|
132
138
|
children: ReactNode
|
|
133
139
|
filterFactory: (value: EntityId) => UseDataViewRelationFilterResult
|
|
134
140
|
}>(({ children, filterFactory, ...props }, ref) => {
|
|
135
|
-
|
|
136
|
-
|
|
141
|
+
const entity = useEntity()
|
|
142
|
+
const [current, setFilter] = filterFactory(entity.id)
|
|
137
143
|
|
|
138
|
-
|
|
139
|
-
|
|
144
|
+
const include = useCallback(() => setFilter('toggleInclude'), [setFilter])
|
|
145
|
+
const exclude = useCallback(() => setFilter('toggleExclude'), [setFilter])
|
|
140
146
|
|
|
141
|
-
|
|
142
|
-
|
|
147
|
+
const isIncluded = current === 'include'
|
|
148
|
+
const isExcluded = current === 'exclude'
|
|
143
149
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
})
|
|
150
|
+
return (
|
|
151
|
+
<DataGridFilterSelectItemUI ref={ref} onExclude={exclude} onInclude={include} isExcluded={isExcluded} isIncluded={isIncluded} {...props}>
|
|
152
|
+
{children}
|
|
153
|
+
</DataGridFilterSelectItemUI>
|
|
154
|
+
)
|
|
155
|
+
})
|
|
150
156
|
|
|
151
157
|
|
|
152
|
-
const DataGridRelationFilterSelect = ({ children, queryField, label }: {
|
|
158
|
+
export const DataGridRelationFilterSelect = ({ children, queryField, label }: {
|
|
153
159
|
queryField?: DataViewUnionFilterFields
|
|
154
160
|
children: ReactNode
|
|
155
161
|
label?: ReactNode
|
|
156
162
|
}) => {
|
|
157
|
-
const filterFactory = useDataViewRelationFilterFactory(useDataViewFilterName())
|
|
158
163
|
return (
|
|
159
164
|
<Popover>
|
|
160
165
|
<PopoverTrigger asChild>
|
|
@@ -163,18 +168,32 @@ const DataGridRelationFilterSelect = ({ children, queryField, label }: {
|
|
|
163
168
|
</DataGridFilterSelectTriggerUI>
|
|
164
169
|
</PopoverTrigger>
|
|
165
170
|
<SelectPopoverContent>
|
|
166
|
-
<
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
{children}
|
|
170
|
-
</DataGridRelationFilterSelectItem>
|
|
171
|
-
</SelectListInner>
|
|
172
|
-
</DataViewRelationFilterOptions>
|
|
173
|
-
<div>
|
|
174
|
-
<DataGridNullFilter />
|
|
175
|
-
</div>
|
|
171
|
+
<DataGridRelationFilterControls queryField={queryField}>
|
|
172
|
+
{children}
|
|
173
|
+
</DataGridRelationFilterControls>
|
|
176
174
|
</SelectPopoverContent>
|
|
177
175
|
</Popover>
|
|
178
176
|
)
|
|
179
177
|
}
|
|
180
178
|
|
|
179
|
+
|
|
180
|
+
export const DataGridRelationFilterControls = ({ children, queryField }: {
|
|
181
|
+
queryField?: DataViewUnionFilterFields
|
|
182
|
+
children: ReactNode
|
|
183
|
+
}) => {
|
|
184
|
+
const filterFactory = useDataViewRelationFilterFactory(useDataViewFilterName())
|
|
185
|
+
return (
|
|
186
|
+
<>
|
|
187
|
+
<DataViewRelationFilterOptions queryField={queryField}>
|
|
188
|
+
<SelectListInner filterToolbar={<SelectDefaultFilter />}>
|
|
189
|
+
<DataGridRelationFilterSelectItem filterFactory={filterFactory}>
|
|
190
|
+
{children}
|
|
191
|
+
</DataGridRelationFilterSelectItem>
|
|
192
|
+
</SelectListInner>
|
|
193
|
+
</DataViewRelationFilterOptions>
|
|
194
|
+
<div>
|
|
195
|
+
<DataGridNullFilter />
|
|
196
|
+
</div>
|
|
197
|
+
</>
|
|
198
|
+
)
|
|
199
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { DataView,
|
|
1
|
+
import { DataView, DataViewLoaderState, DataViewProps } from '@contember/react-dataview'
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
import { Fragment, ReactNode } from 'react'
|
|
4
|
-
import { DataGridNoResults } from './empty'
|
|
5
4
|
import { DataGridInitialLoader, DataGridOverlayLoader } from './loader'
|
|
6
5
|
import { Component } from '@contember/interface'
|
|
7
6
|
|
|
@@ -42,14 +41,7 @@ export const DataGridLoader = ({ children }: DataViewBodyProps) => (
|
|
|
42
41
|
<DataViewLoaderState refreshing>
|
|
43
42
|
<DataGridOverlayLoader />
|
|
44
43
|
</DataViewLoaderState>
|
|
45
|
-
|
|
46
|
-
<DataViewNonEmpty>
|
|
47
|
-
{children}
|
|
48
|
-
</DataViewNonEmpty>
|
|
49
|
-
|
|
50
|
-
<DataViewEmpty>
|
|
51
|
-
<DataGridNoResults />
|
|
52
|
-
</DataViewEmpty>
|
|
44
|
+
{children}
|
|
53
45
|
</div>
|
|
54
46
|
</DataViewLoaderState>
|
|
55
47
|
<DataViewLoaderState initial>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Component, Environment } from '@contember/interface'
|
|
2
2
|
import { Table, TableBody, TableHeader, TableRow } from '../ui/table'
|
|
3
3
|
import * as React from 'react'
|
|
4
|
-
import { Fragment, ReactNode,
|
|
5
|
-
import { DataViewEachRow, DataViewLayout } from '@contember/react-dataview'
|
|
4
|
+
import { Fragment, ReactNode, useMemo } from 'react'
|
|
5
|
+
import { DataViewEachRow, DataViewEmpty, DataViewLayout, DataViewNonEmpty } from '@contember/react-dataview'
|
|
6
6
|
import { SheetIcon } from 'lucide-react'
|
|
7
7
|
import { dict } from '../dict'
|
|
8
8
|
import { ChildrenAnalyzer, Leaf } from '@contember/react-multipass-rendering'
|
|
@@ -28,7 +28,7 @@ export const DataGridTable = Component<DataViewTableProps>(({ children }) => {
|
|
|
28
28
|
})
|
|
29
29
|
|
|
30
30
|
const DataGridTableRenderer = Component< DataViewTableProps>(({ children }, env) => {
|
|
31
|
-
const
|
|
31
|
+
const columns = useMemo(() => datagridColumnsAnalyzer.processChildren(children, env), [children, env])
|
|
32
32
|
return (
|
|
33
33
|
<Table>
|
|
34
34
|
<TableHeader>
|
|
@@ -41,15 +41,22 @@ const DataGridTableRenderer = Component< DataViewTableProps>(({ children }, env)
|
|
|
41
41
|
</TableRow>
|
|
42
42
|
</TableHeader>
|
|
43
43
|
<TableBody>
|
|
44
|
-
<
|
|
44
|
+
<DataViewNonEmpty>
|
|
45
|
+
<DataViewEachRow>
|
|
46
|
+
<TableRow>
|
|
47
|
+
{columns.map(({ cell, name }, i) => (
|
|
48
|
+
<Fragment key={name ?? `_${i}`}>
|
|
49
|
+
{cell}
|
|
50
|
+
</Fragment>
|
|
51
|
+
))}
|
|
52
|
+
</TableRow>
|
|
53
|
+
</DataViewEachRow>
|
|
54
|
+
</DataViewNonEmpty>
|
|
55
|
+
<DataViewEmpty>
|
|
45
56
|
<TableRow>
|
|
46
|
-
{columns.
|
|
47
|
-
<Fragment key={name ?? `_${i}`}>
|
|
48
|
-
{cell}
|
|
49
|
-
</Fragment>
|
|
50
|
-
))}
|
|
57
|
+
<td className="text-lg p-4 text-center text-gray-400" colSpan={columns.length}>{dict.datagrid.empty}</td>
|
|
51
58
|
</TableRow>
|
|
52
|
-
</
|
|
59
|
+
</DataViewEmpty>
|
|
53
60
|
</TableBody>
|
|
54
61
|
</Table>
|
|
55
62
|
)
|
|
@@ -3,18 +3,20 @@ import { DataViewEachRow, DataViewLayout } from '@contember/react-dataview'
|
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { dict } from '../dict'
|
|
5
5
|
import { LayoutGridIcon } from 'lucide-react'
|
|
6
|
+
import { cn } from '../utils'
|
|
6
7
|
|
|
7
8
|
export interface DataGridTilesProps {
|
|
8
9
|
children: React.ReactNode
|
|
10
|
+
className?: string
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
export const DataGridTiles = Component< DataGridTilesProps>(({ children }) => {
|
|
13
|
+
export const DataGridTiles = Component< DataGridTilesProps>(({ children, className }) => {
|
|
12
14
|
return (
|
|
13
15
|
<DataViewLayout name={'grid'} label={<>
|
|
14
16
|
<LayoutGridIcon className={'w-3 h-3'} />
|
|
15
17
|
<span>{dict.datagrid.showGrid}</span>
|
|
16
18
|
</>}>
|
|
17
|
-
<div className=
|
|
19
|
+
<div className={cn('grid grid-cols-2 md:grid-cols-4 gap-4', className)}>
|
|
18
20
|
<DataViewEachRow>
|
|
19
21
|
{children}
|
|
20
22
|
</DataViewEachRow>
|
|
@@ -4,7 +4,7 @@ import { ReactNode } from 'react'
|
|
|
4
4
|
import { DataGridShowFiltersContext } from './filters/mobile'
|
|
5
5
|
import { DataGridToolbarUI } from './ui'
|
|
6
6
|
import { Button } from '../ui/button'
|
|
7
|
-
import { FilterIcon, SettingsIcon } from 'lucide-react'
|
|
7
|
+
import { FilterIcon, RefreshCcwIcon, SettingsIcon } from 'lucide-react'
|
|
8
8
|
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover'
|
|
9
9
|
import { DataGridLayoutSwitcher } from './layout-switcher'
|
|
10
10
|
import { DataGridPerPageSelector } from './pagination'
|
|
@@ -13,6 +13,7 @@ import { dataAttribute } from '@contember/utilities'
|
|
|
13
13
|
import { dict } from '../dict'
|
|
14
14
|
import { DataGridAutoExport } from './export'
|
|
15
15
|
import { DataGridToolbarVisibleElements } from './elements'
|
|
16
|
+
import { DataViewReloadTrigger } from '@contember/react-dataview'
|
|
16
17
|
|
|
17
18
|
export interface DataGridToolbarProps {
|
|
18
19
|
children?: ReactNode
|
|
@@ -51,9 +52,14 @@ export const DataGridToolbar = Component<DataGridToolbarProps>(({ children }) =>
|
|
|
51
52
|
</Popover>
|
|
52
53
|
|
|
53
54
|
<DataGridAutoExport />
|
|
55
|
+
<DataViewReloadTrigger>
|
|
56
|
+
<Button variant={'outline'} size={'sm'} className={'group gap-2'}>
|
|
57
|
+
<RefreshCcwIcon className={'w-4 h-4 group-data-[state=refreshing]:animate-spin '} />
|
|
58
|
+
</Button>
|
|
59
|
+
</DataViewReloadTrigger>
|
|
54
60
|
</div>
|
|
55
61
|
|
|
56
|
-
<div className="flex flex-wrap gap-2">
|
|
62
|
+
<div className="flex flex-1 flex-wrap gap-2">
|
|
57
63
|
{children ?? <>
|
|
58
64
|
<DataGridQueryFilter />
|
|
59
65
|
</>}
|
|
@@ -50,7 +50,7 @@ export const DataGridExcludeActionButtonUI = forwardRef<HTMLButtonElement, {}>((
|
|
|
50
50
|
* Button in a filter list that removes the filter
|
|
51
51
|
*/
|
|
52
52
|
export const DataGridActiveFilterUI = forwardRef<HTMLButtonElement, {
|
|
53
|
-
children: ReactNode
|
|
53
|
+
children: ReactNode
|
|
54
54
|
className?: string
|
|
55
55
|
}>(({ children, className, ...props }, ref) => {
|
|
56
56
|
return (
|
|
@@ -82,11 +82,11 @@ export const DataGridFilterSelectTriggerUI = forwardRef<HTMLButtonElement, { chi
|
|
|
82
82
|
}, ref) => {
|
|
83
83
|
return (
|
|
84
84
|
<button className={'hover:underline inline-flex items-center gap-2 group px-1'} ref={ref} {...props}>
|
|
85
|
-
<span className={'text-xs font-medium'}>
|
|
85
|
+
{children && <span className={'text-xs font-medium'}>
|
|
86
86
|
{children}
|
|
87
|
-
</span>
|
|
87
|
+
</span>}
|
|
88
88
|
<span
|
|
89
|
-
className={'bg-gray-100 rounded-full border group-data-[state=open]:bg-white group-data-[state=open]:shadow-inner
|
|
89
|
+
className={'bg-gray-100 rounded-full border group-data-[state=open]:bg-white group-data-[state=open]:shadow-inner h-5 w-5 inline-flex items-center justify-center'}
|
|
90
90
|
>
|
|
91
91
|
<PlusIcon className={'w-3 h-3'} />
|
|
92
92
|
</span>
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
import { ChangeMyPasswordFormErrorCode, CreateApiKeyFormErrorCode } from '@contember/interface'
|
|
2
1
|
import { TextFilterArtifactsMatchMode } from '@contember/react-dataview'
|
|
3
|
-
import {
|
|
4
|
-
InviteFormErrorCode,
|
|
5
|
-
LoginFormErrorCode,
|
|
6
|
-
OtpConfirmFormErrorCode,
|
|
7
|
-
OtpPrepareFormErrorCode,
|
|
8
|
-
PasswordResetFormErrorCode,
|
|
9
|
-
PasswordResetRequestFormErrorCode,
|
|
10
|
-
UpdateProjectMemberFormErrorCode,
|
|
11
|
-
} from '@contember/react-identity'
|
|
12
|
-
import { UploaderErrorType } from '@contember/react-uploader'
|
|
13
2
|
import { InviteErrorCodes } from './tenant/hooks/useInvite'
|
|
3
|
+
import { UploaderErrorType } from '@contember/react-uploader'
|
|
4
|
+
import { ChangeMyPasswordFormErrorCode, CreateApiKeyFormErrorCode } from '@contember/interface'
|
|
5
|
+
import { InviteFormErrorCode, LoginFormErrorCode, OtpPrepareFormErrorCode, OtpConfirmFormErrorCode, PasswordResetFormErrorCode, PasswordResetRequestFormErrorCode, UpdateProjectMemberFormErrorCode } from '@contember/react-identity'
|
|
14
6
|
|
|
15
7
|
export const dict = {
|
|
16
8
|
deleteEntityDialog: {
|
|
@@ -43,11 +35,11 @@ export const dict = {
|
|
|
43
35
|
textReset: 'Reset filter',
|
|
44
36
|
textPlaceholder: 'Search',
|
|
45
37
|
textMatchMode: {
|
|
46
|
-
matches: 'contains',
|
|
47
|
-
matchesExactly: 'equals',
|
|
48
|
-
startsWith: 'starts with',
|
|
49
|
-
endsWith: 'ends with',
|
|
50
|
-
doesNotMatch: 'does not contain',
|
|
38
|
+
'matches': 'contains',
|
|
39
|
+
'matchesExactly': 'equals',
|
|
40
|
+
'startsWith': 'starts with',
|
|
41
|
+
'endsWith': 'ends with',
|
|
42
|
+
'doesNotMatch': 'does not contain',
|
|
51
43
|
} satisfies Record<TextFilterArtifactsMatchMode, string>,
|
|
52
44
|
visibleFields: 'Fields',
|
|
53
45
|
columnAsc: 'asc',
|
|
@@ -71,6 +63,7 @@ export const dict = {
|
|
|
71
63
|
filters: 'Filters',
|
|
72
64
|
exclude: 'Exclude',
|
|
73
65
|
export: 'Export',
|
|
66
|
+
|
|
74
67
|
},
|
|
75
68
|
select: {
|
|
76
69
|
confirmNew: 'Confirm',
|
|
@@ -85,6 +78,7 @@ export const dict = {
|
|
|
85
78
|
},
|
|
86
79
|
|
|
87
80
|
errors: {
|
|
81
|
+
required: 'This field is required',
|
|
88
82
|
unique: 'This value is already taken',
|
|
89
83
|
unknown: 'An unknown error has occurred',
|
|
90
84
|
},
|
|
@@ -103,7 +97,7 @@ export const dict = {
|
|
|
103
97
|
VARIABLE_EMPTY: 'Variable is empty',
|
|
104
98
|
VARIABLE_NOT_FOUND: 'Variable not found',
|
|
105
99
|
fallback: 'Failed to invite user',
|
|
106
|
-
} satisfies Record<InviteErrorCodes | 'fallback',
|
|
100
|
+
} satisfies Record<InviteErrorCodes | 'fallback', string>,
|
|
107
101
|
uploader: {
|
|
108
102
|
uploadErrors: {
|
|
109
103
|
httpError: 'HTTP error',
|
|
@@ -155,13 +149,13 @@ export const dict = {
|
|
|
155
149
|
roles: 'Roles',
|
|
156
150
|
submit: 'Create API key',
|
|
157
151
|
errorMessages: {
|
|
158
|
-
FIELD_REQUIRED: 'This field is required',
|
|
159
|
-
UNKNOWN_ERROR: 'Something went wrong. Please try again later',
|
|
160
|
-
INVALID_MEMBERSHIP: 'Invalid membership',
|
|
161
|
-
PROJECT_NOT_FOUND: 'Project not found',
|
|
162
|
-
ROLE_NOT_FOUND: 'Role not found',
|
|
163
|
-
VARIABLE_EMPTY: 'Variable empty',
|
|
164
|
-
VARIABLE_NOT_FOUND: 'Variable not found',
|
|
152
|
+
'FIELD_REQUIRED': 'This field is required',
|
|
153
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
154
|
+
'INVALID_MEMBERSHIP': 'Invalid membership',
|
|
155
|
+
'PROJECT_NOT_FOUND': 'Project not found',
|
|
156
|
+
'ROLE_NOT_FOUND': 'Role not found',
|
|
157
|
+
'VARIABLE_EMPTY': 'Variable empty',
|
|
158
|
+
'VARIABLE_NOT_FOUND': 'Variable not found',
|
|
165
159
|
} satisfies Record<CreateApiKeyFormErrorCode, string>,
|
|
166
160
|
},
|
|
167
161
|
invite: {
|
|
@@ -170,15 +164,15 @@ export const dict = {
|
|
|
170
164
|
roles: 'Roles',
|
|
171
165
|
submit: 'Invite',
|
|
172
166
|
errorMessages: {
|
|
173
|
-
FIELD_REQUIRED: 'This field is required',
|
|
174
|
-
UNKNOWN_ERROR: 'Something went wrong. Please try again later',
|
|
175
|
-
ALREADY_MEMBER: 'This person is already a member',
|
|
176
|
-
INVALID_EMAIL_FORMAT: 'Invalid email format',
|
|
177
|
-
INVALID_MEMBERSHIP: 'Invalid membership',
|
|
178
|
-
PROJECT_NOT_FOUND: 'Project not found',
|
|
179
|
-
ROLE_NOT_FOUND: 'Role not found',
|
|
180
|
-
VARIABLE_EMPTY: 'Variable empty',
|
|
181
|
-
VARIABLE_NOT_FOUND: 'Variable not found',
|
|
167
|
+
'FIELD_REQUIRED': 'This field is required',
|
|
168
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
169
|
+
'ALREADY_MEMBER': 'This person is already a member',
|
|
170
|
+
'INVALID_EMAIL_FORMAT': 'Invalid email format',
|
|
171
|
+
'INVALID_MEMBERSHIP': 'Invalid membership',
|
|
172
|
+
'PROJECT_NOT_FOUND': 'Project not found',
|
|
173
|
+
'ROLE_NOT_FOUND': 'Role not found',
|
|
174
|
+
'VARIABLE_EMPTY': 'Variable empty',
|
|
175
|
+
'VARIABLE_NOT_FOUND': 'Variable not found',
|
|
182
176
|
} satisfies Record<InviteFormErrorCode, string>,
|
|
183
177
|
},
|
|
184
178
|
changePassword: {
|
|
@@ -187,14 +181,14 @@ export const dict = {
|
|
|
187
181
|
confirmPassword: 'Confirm password',
|
|
188
182
|
submit: 'Change password',
|
|
189
183
|
errorMessages: {
|
|
190
|
-
FIELD_REQUIRED: 'This field is required',
|
|
191
|
-
INVALID_VALUE: 'Invalid value',
|
|
192
|
-
UNKNOWN_ERROR: 'Something went wrong. Please try again later',
|
|
193
|
-
PASSWORD_MISMATCH: 'Passwords do not match',
|
|
194
|
-
TOO_WEAK: 'Password is too weak',
|
|
195
|
-
NO_PASSWORD_SET: 'Your account has no password set',
|
|
196
|
-
INVALID_PASSWORD: 'Invalid password',
|
|
197
|
-
NOT_A_PERSON: 'Invalid user',
|
|
184
|
+
'FIELD_REQUIRED': 'This field is required',
|
|
185
|
+
'INVALID_VALUE': 'Invalid value',
|
|
186
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
187
|
+
'PASSWORD_MISMATCH': 'Passwords do not match',
|
|
188
|
+
'TOO_WEAK': 'Password is too weak',
|
|
189
|
+
'NO_PASSWORD_SET': 'Your account has no password set',
|
|
190
|
+
'INVALID_PASSWORD': 'Invalid password',
|
|
191
|
+
'NOT_A_PERSON': 'Invalid user',
|
|
198
192
|
} satisfies Record<ChangeMyPasswordFormErrorCode, string>,
|
|
199
193
|
},
|
|
200
194
|
login: {
|
|
@@ -204,15 +198,15 @@ export const dict = {
|
|
|
204
198
|
forgotPassword: 'Forgot password?',
|
|
205
199
|
login: 'Login',
|
|
206
200
|
errorMessages: {
|
|
207
|
-
FIELD_REQUIRED: 'This field is required',
|
|
208
|
-
INVALID_VALUE: 'Invalid value',
|
|
209
|
-
UNKNOWN_ERROR: 'Something went wrong. Please try again later',
|
|
210
|
-
INVALID_PASSWORD: 'Invalid password',
|
|
211
|
-
INVALID_OTP_TOKEN: 'Invalid OTP token',
|
|
212
|
-
NO_PASSWORD_SET: 'No password set',
|
|
213
|
-
PERSON_DISABLED: 'Person disabled',
|
|
214
|
-
UNKNOWN_EMAIL: 'Unknown email',
|
|
215
|
-
OTP_REQUIRED: undefined,
|
|
201
|
+
'FIELD_REQUIRED': 'This field is required',
|
|
202
|
+
'INVALID_VALUE': 'Invalid value',
|
|
203
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
204
|
+
'INVALID_PASSWORD': 'Invalid password',
|
|
205
|
+
'INVALID_OTP_TOKEN': 'Invalid OTP token',
|
|
206
|
+
'NO_PASSWORD_SET': 'No password set',
|
|
207
|
+
'PERSON_DISABLED': 'Person disabled',
|
|
208
|
+
'UNKNOWN_EMAIL': 'Unknown email',
|
|
209
|
+
'OTP_REQUIRED': undefined,
|
|
216
210
|
} satisfies Record<LoginFormErrorCode, string | undefined>,
|
|
217
211
|
idpInitError: 'Failed to initialize IdP login:',
|
|
218
212
|
idpResponseError: 'Failed to process IdP response:',
|
|
@@ -259,8 +253,7 @@ export const dict = {
|
|
|
259
253
|
disable: 'Disable',
|
|
260
254
|
disabledSuccess: 'Two-factor authentication was disabled.',
|
|
261
255
|
setupAgain: 'Setup again',
|
|
262
|
-
description:
|
|
263
|
-
'2-Step Verification provides stronger security for your account by requiring a second step of verification when you sign in. In addition to your password, you’ll also need a code generated by an application on your phone.',
|
|
256
|
+
description: '2-Step Verification provides stronger security for your account by requiring a second step of verification when you sign in. In addition to your password, you’ll also need a code generated by an application on your phone.',
|
|
264
257
|
setupTwoFactor: 'Setup two-factor authentication',
|
|
265
258
|
enabledSuccess: 'Two-factor authentication was enabled.',
|
|
266
259
|
otpToken: 'OTP token',
|
|
@@ -274,14 +267,14 @@ export const dict = {
|
|
|
274
267
|
passwordConfirmation: 'Confirm password',
|
|
275
268
|
submit: 'Reset password',
|
|
276
269
|
errorMessages: {
|
|
277
|
-
FIELD_REQUIRED: 'This field is required',
|
|
278
|
-
INVALID_VALUE: 'Invalid value',
|
|
279
|
-
UNKNOWN_ERROR: 'Something went wrong. Please try again later',
|
|
280
|
-
PASSWORD_MISMATCH: 'Passwords do not match',
|
|
281
|
-
PASSWORD_TOO_WEAK: 'Password is too weak',
|
|
282
|
-
TOKEN_EXPIRED: 'Token expired',
|
|
283
|
-
TOKEN_NOT_FOUND: 'Token not found',
|
|
284
|
-
TOKEN_USED: 'Token already used',
|
|
270
|
+
'FIELD_REQUIRED': 'This field is required',
|
|
271
|
+
'INVALID_VALUE': 'Invalid value',
|
|
272
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
273
|
+
'PASSWORD_MISMATCH': 'Passwords do not match',
|
|
274
|
+
'PASSWORD_TOO_WEAK': 'Password is too weak',
|
|
275
|
+
'TOKEN_EXPIRED': 'Token expired',
|
|
276
|
+
'TOKEN_NOT_FOUND': 'Token not found',
|
|
277
|
+
'TOKEN_USED': 'Token already used',
|
|
285
278
|
} satisfies Record<PasswordResetFormErrorCode, string>,
|
|
286
279
|
title: 'Reset password',
|
|
287
280
|
description: 'Enter new password below',
|
|
@@ -291,10 +284,10 @@ export const dict = {
|
|
|
291
284
|
email: 'Email',
|
|
292
285
|
submit: 'Request reset code',
|
|
293
286
|
errorMessages: {
|
|
294
|
-
FIELD_REQUIRED: 'This field is required',
|
|
295
|
-
INVALID_VALUE: 'Invalid value',
|
|
296
|
-
UNKNOWN_ERROR: 'Something went wrong. Please try again later',
|
|
297
|
-
PERSON_NOT_FOUND: 'Unknown email',
|
|
287
|
+
'FIELD_REQUIRED': 'This field is required',
|
|
288
|
+
'INVALID_VALUE': 'Invalid value',
|
|
289
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
290
|
+
'PERSON_NOT_FOUND': 'Unknown email',
|
|
298
291
|
} satisfies Record<PasswordResetRequestFormErrorCode, string>,
|
|
299
292
|
title: 'Reset password',
|
|
300
293
|
description: 'Enter your email below to reset your password',
|
|
@@ -307,14 +300,14 @@ export const dict = {
|
|
|
307
300
|
roles: 'Roles',
|
|
308
301
|
submit: 'Update role',
|
|
309
302
|
errorMessages: {
|
|
310
|
-
FIELD_REQUIRED: 'This field is required',
|
|
311
|
-
UNKNOWN_ERROR: 'Something went wrong. Please try again later',
|
|
312
|
-
INVALID_MEMBERSHIP: 'Invalid membership',
|
|
313
|
-
PROJECT_NOT_FOUND: 'Project not found',
|
|
314
|
-
ROLE_NOT_FOUND: 'Role not found',
|
|
315
|
-
VARIABLE_EMPTY: 'Variable empty',
|
|
316
|
-
VARIABLE_NOT_FOUND: 'Variable not found',
|
|
317
|
-
NOT_MEMBER: 'Not a member',
|
|
303
|
+
'FIELD_REQUIRED': 'This field is required',
|
|
304
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
305
|
+
'INVALID_MEMBERSHIP': 'Invalid membership',
|
|
306
|
+
'PROJECT_NOT_FOUND': 'Project not found',
|
|
307
|
+
'ROLE_NOT_FOUND': 'Role not found',
|
|
308
|
+
'VARIABLE_EMPTY': 'Variable empty',
|
|
309
|
+
'VARIABLE_NOT_FOUND': 'Variable not found',
|
|
310
|
+
'NOT_MEMBER': 'Not a member',
|
|
318
311
|
} satisfies Record<UpdateProjectMemberFormErrorCode, string>,
|
|
319
312
|
},
|
|
320
313
|
},
|
|
@@ -64,7 +64,7 @@ export const DimensionsSwitcher = Component(({ options, dimension, children, slu
|
|
|
64
64
|
)
|
|
65
65
|
})
|
|
66
66
|
|
|
67
|
-
const DimensionSwitcherCurrentValues = ({ children, dimension, slugField }: { children: ReactNode
|
|
67
|
+
const DimensionSwitcherCurrentValues = ({ children, dimension, slugField }: { children: ReactNode; dimension: string; slugField: SugaredRelativeSingleField['field'] }) => {
|
|
68
68
|
const entitiesBySlug = useDimensionEntitiesBySlug(slugField)
|
|
69
69
|
|
|
70
70
|
const currentDimensionValue = useDimensionState({
|
|
@@ -89,7 +89,7 @@ const DimensionSwitcherCurrentValues = ({ children, dimension, slugField }: { ch
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
const DimensionSwitcherItem = ({ children, dimension, slugField, isMulti }: { children: ReactNode
|
|
92
|
+
const DimensionSwitcherItem = ({ children, dimension, slugField, isMulti }: { children: ReactNode; dimension: string; slugField: SugaredRelativeSingleField['field']; isMulti?: boolean }) => {
|
|
93
93
|
const entity = useEntity()
|
|
94
94
|
const slugValue = entity.getField<string>(slugField).value
|
|
95
95
|
if (!slugValue) {
|
|
@@ -18,8 +18,8 @@ export const EditorCanvas = memo(<P extends HTMLTextAreaDivTargetProps>({
|
|
|
18
18
|
}: EditorCanvasProps<P>) => {
|
|
19
19
|
|
|
20
20
|
return (
|
|
21
|
-
<div data-focus-ring={dataAttribute(focusRing)} className={'relative w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-
|
|
22
|
-
<Component className="
|
|
21
|
+
<div data-focus-ring={dataAttribute(focusRing)} className={'relative w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-within:outline-none focus-within:ring-1 focus-within:ring-ring disabled:cursor-not-allowed disabled:opacity-50'}>
|
|
22
|
+
<Component className="outline-none" {...props} />
|
|
23
23
|
{children}
|
|
24
24
|
</div>
|
|
25
25
|
)
|
package/resources/templates/template-workspace/admin/lib/editor/common/editor-editable-canvas.tsx
CHANGED
|
@@ -8,7 +8,7 @@ export interface EditorEditableCanvasProps extends EditableProps {
|
|
|
8
8
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const EditorEditableCanvas = (
|
|
11
|
+
export const EditorEditableCanvas = (editableProps: EditorEditableCanvasProps) => {
|
|
12
12
|
const editor = useSlate()
|
|
13
13
|
const pathRef = useRef<Path | undefined>(undefined)
|
|
14
14
|
|
package/resources/templates/template-workspace/admin/lib/editor/common/editor-inline-toolbar.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { memo, ReactNode, useLayoutEffect, useRef } from 'react'
|
|
2
2
|
import { ReactEditor, useSlateSelection, useSlateStatic } from 'slate-react'
|
|
3
3
|
|
|
4
4
|
export interface EditorInlineToolbarProps {
|
|
@@ -36,10 +36,7 @@ export const EditorInlineToolbar = memo(({ children }: EditorInlineToolbarProps)
|
|
|
36
36
|
Math.max(0, document.documentElement.clientWidth - toolbar.offsetWidth),
|
|
37
37
|
Math.max(
|
|
38
38
|
0,
|
|
39
|
-
Math.min(
|
|
40
|
-
parentRect.width - toolbar.offsetWidth - borderWidth * 2,
|
|
41
|
-
rangeRect.left - parentRect.left - toolbar.offsetWidth / 2 + rangeRect.width / 2,
|
|
42
|
-
),
|
|
39
|
+
Math.min(parentRect.width - toolbar.offsetWidth - borderWidth * 2, rangeRect.left - parentRect.left - toolbar.offsetWidth / 2 + rangeRect.width / 2),
|
|
43
40
|
),
|
|
44
41
|
)
|
|
45
42
|
toolbar.style.top = `${top}px`
|
|
@@ -64,11 +64,11 @@ export const TableElementRenderer = memo(function TableElementRenderer(props: Ta
|
|
|
64
64
|
// Slate also has an onClick handler somewhere that attempts to update the caret position but if our handler
|
|
65
65
|
// deletes the table before that gets to run, it operates on stale props (I think) and ends up throwing.
|
|
66
66
|
// So as a hacky workaround, we just let it do its thing and actually remove the table later.
|
|
67
|
-
Transforms.removeNodes(editor, {
|
|
67
|
+
return Transforms.removeNodes(editor, {
|
|
68
68
|
at: ReactEditor.findPath(editor, props.element),
|
|
69
69
|
match: node => isTableElement(node),
|
|
70
70
|
})
|
|
71
|
-
})
|
|
71
|
+
}).catch(() => {})
|
|
72
72
|
}, [editor, props.element])
|
|
73
73
|
return (
|
|
74
74
|
<BlockElement element={props.element} attributes={props.attributes} withBoundaries>
|
|
@@ -47,7 +47,7 @@ export const EditorBlockContent = Component(() => {
|
|
|
47
47
|
}, () => <BlockContent />)
|
|
48
48
|
|
|
49
49
|
const EditorBlockUi = ({ blockProps, renderBlockProps }: {
|
|
50
|
-
blockProps: EditorBlockProps
|
|
50
|
+
blockProps: EditorBlockProps
|
|
51
51
|
renderBlockProps: BlockRendererProps }) => {
|
|
52
52
|
const {
|
|
53
53
|
children,
|
|
@@ -9,10 +9,10 @@ import { FormFieldScope } from '@contember/react-form'
|
|
|
9
9
|
import { richTextFieldPlugins } from './plugins'
|
|
10
10
|
|
|
11
11
|
export type RichTextFieldProps = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
field: SugaredRelativeSingleField['field']
|
|
13
|
+
children: ReactNode
|
|
14
|
+
}
|
|
15
|
+
& Omit<FormContainerProps, 'children'>
|
|
16
16
|
|
|
17
17
|
export const RichTextField = Component<RichTextFieldProps>(({ field, description, label, children }) => {
|
|
18
18
|
return (
|
|
@@ -28,7 +28,7 @@ export const RichTextField = Component<RichTextFieldProps>(({ field, description
|
|
|
28
28
|
)
|
|
29
29
|
})
|
|
30
30
|
|
|
31
|
-
const RichTextAreaInner = ({ placeholder, children }: { placeholder?: string
|
|
31
|
+
const RichTextAreaInner = ({ placeholder, children }: { placeholder?: string; children: ReactNode }) => {
|
|
32
32
|
const editor = useSlateStatic()
|
|
33
33
|
const isMutating = useMutationState()
|
|
34
34
|
|
|
@@ -7,12 +7,12 @@ import { DropIndicator } from '../ui/sortable'
|
|
|
7
7
|
import { Portal } from '@radix-ui/react-portal'
|
|
8
8
|
import { DragOverlay } from '@dnd-kit/core'
|
|
9
9
|
|
|
10
|
-
export const BlockEditorHandle = uic('
|
|
11
|
-
baseClass: 'absolute top-1/2 -left-3 h-6 w-6 flex justify-end items-center opacity-10 hover:opacity-100 transition-opacity -translate-y-1/2',
|
|
10
|
+
export const BlockEditorHandle = uic('span', {
|
|
11
|
+
baseClass: 'absolute top-1/2 -left-3 h-6 w-6 flex justify-end items-center opacity-10 hover:opacity-100 transition-opacity -translate-y-1/2 cursor-grab',
|
|
12
12
|
beforeChildren: <GripVerticalIcon size={16} />,
|
|
13
13
|
})
|
|
14
14
|
|
|
15
|
-
export const SortableBlock = ({ children, element }: { children: ReactNode
|
|
15
|
+
export const SortableBlock = ({ children, element }: { children: ReactNode; element: Element }) => {
|
|
16
16
|
const sortable = useSortable({
|
|
17
17
|
id: element.key as string,
|
|
18
18
|
})
|