rimecms 1.4.3 → 1.5.1
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/core/auth/better-auth/config.server.d.ts +1 -1
- package/dist/core/auth/better-auth/instance.server.d.ts +2 -2
- package/dist/core/boot.server.d.ts +2 -2
- package/dist/core/i18n/en/common.d.ts +10 -4
- package/dist/core/i18n/en/common.js +12 -6
- package/dist/core/i18n/fr/common.d.ts +10 -4
- package/dist/core/i18n/fr/common.js +12 -7
- package/dist/core/prototype/shared/title/find-title.d.ts +9 -0
- package/dist/core/prototype/shared/title/find-title.js +20 -4
- package/dist/fields/group/component/Group.svelte +4 -3
- package/dist/fields/radio/component/Radio.svelte +19 -1
- package/dist/fields/radio/index.d.ts +23 -6
- package/dist/fields/radio/index.js +13 -1
- package/dist/fields/text/index.d.ts +11 -3
- package/dist/fields/text/index.js +11 -3
- package/dist/panel/components/fields/RenderFields.svelte +3 -2
- package/dist/panel/components/sections/collection/DropHint.svelte +41 -0
- package/dist/panel/components/sections/collection/DropHint.svelte.d.ts +7 -0
- package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +23 -3
- package/dist/panel/components/sections/collection/header/ButtonCreate.svelte +3 -3
- package/dist/panel/components/sections/collection/header/ButtonCreate.svelte.d.ts +1 -1
- package/dist/panel/components/sections/collection/list/CollectionList.svelte +8 -0
- package/dist/panel/components/sections/document/AutoSaveBanner.svelte +1 -1
- package/dist/panel/components/sections/document/ButtonPublish.svelte +39 -0
- package/dist/panel/components/sections/document/ButtonPublish.svelte.d.ts +7 -0
- package/dist/panel/components/sections/document/ButtonSave.svelte +6 -3
- package/dist/panel/components/sections/document/ButtonSave.svelte.d.ts +3 -1
- package/dist/panel/components/sections/document/Document.svelte +4 -13
- package/dist/panel/components/sections/document/DocumentChildren.svelte +1 -1
- package/dist/panel/components/sections/document/Header.svelte +116 -65
- package/dist/panel/components/sections/document/Settings.svelte +42 -125
- package/dist/panel/components/sections/document/VersionMenu.svelte +383 -0
- package/dist/panel/components/sections/document/VersionMenu.svelte.d.ts +8 -0
- package/dist/panel/components/sections/document/Versions.svelte +1 -1
- package/dist/panel/components/sections/document/Versions.svelte.d.ts +1 -1
- package/dist/panel/components/sections/document/version-status.d.ts +12 -0
- package/dist/panel/components/sections/document/version-status.js +33 -0
- package/dist/panel/components/sections/document/versions-list.d.ts +1 -1
- package/dist/panel/components/sections/document/versions-list.js +1 -1
- package/dist/panel/components/ui/calendar/calendar.svelte.d.ts +1 -1
- package/dist/panel/components/ui/checkbox/checkbox.svelte.d.ts +1 -1
- package/dist/panel/components/ui/page-header/PageHeader.svelte +39 -13
- package/dist/panel/components/ui/page-header/PageHeader.svelte.d.ts +4 -0
- package/dist/panel/components/ui/radio-card-group/index.d.ts +3 -0
- package/dist/panel/components/ui/radio-card-group/index.js +3 -0
- package/dist/panel/components/ui/radio-card-group/radio-card-group-item.svelte +30 -0
- package/dist/panel/components/ui/radio-card-group/radio-card-group-item.svelte.d.ts +9 -0
- package/dist/panel/components/ui/radio-card-group/radio-card-group.css +80 -0
- package/dist/panel/components/ui/radio-card-group/radio-card-group.svelte +18 -0
- package/dist/panel/components/ui/radio-card-group/radio-card-group.svelte.d.ts +5 -0
- package/dist/panel/components/ui/radio-row-group/radio-row-group.css +5 -3
- package/dist/panel/components/ui/switch/switch.svelte.d.ts +1 -1
- package/dist/panel/context/collection.svelte.d.ts +2 -2
- package/dist/panel/context/documentForm.svelte.d.ts +2 -0
- package/dist/panel/context/documentForm.svelte.js +12 -0
- package/dist/panel/context/versions.svelte.js +1 -1
- package/dist/panel/pages/collection/CollectionPage.svelte +37 -27
- package/dist/panel/pages/collection/CollectionPage.svelte.d.ts +1 -1
- package/dist/panel/style/index.css +0 -12
- package/dist/panel/style/scheme.css +0 -12
- package/package.json +1 -1
- package/dist/panel/components/sections/document/ButtonStatus.svelte +0 -158
- package/dist/panel/components/sections/document/ButtonStatus.svelte.d.ts +0 -7
|
@@ -1973,7 +1973,7 @@ export declare function getBaseAuthConfig<const C extends Config>(ctx: {
|
|
|
1973
1973
|
$Infer: {
|
|
1974
1974
|
body: {
|
|
1975
1975
|
permissions: {
|
|
1976
|
-
readonly user?: ("create" | "update" | "delete" | "
|
|
1976
|
+
readonly user?: ("create" | "update" | "delete" | "list" | "get" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "set-phone")[] | undefined;
|
|
1977
1977
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
1978
1978
|
};
|
|
1979
1979
|
} & {
|
|
@@ -1973,7 +1973,7 @@ export declare const createAuthInstance: <const C extends Config>(args: {
|
|
|
1973
1973
|
$Infer: {
|
|
1974
1974
|
body: {
|
|
1975
1975
|
permissions: {
|
|
1976
|
-
readonly user?: ("create" | "update" | "delete" | "
|
|
1976
|
+
readonly user?: ("create" | "update" | "delete" | "list" | "get" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "set-phone")[] | undefined;
|
|
1977
1977
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
1978
1978
|
};
|
|
1979
1979
|
} & {
|
|
@@ -4048,7 +4048,7 @@ export declare const createAuthInstance: <const C extends Config>(args: {
|
|
|
4048
4048
|
$Infer: {
|
|
4049
4049
|
body: {
|
|
4050
4050
|
permissions: {
|
|
4051
|
-
readonly user?: ("create" | "update" | "delete" | "
|
|
4051
|
+
readonly user?: ("create" | "update" | "delete" | "list" | "get" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "set-phone")[] | undefined;
|
|
4052
4052
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
4053
4053
|
};
|
|
4054
4054
|
} & {
|
|
@@ -1995,7 +1995,7 @@ export declare const bootRime: <const C extends Config>(config: BuildConfig<C>)
|
|
|
1995
1995
|
$Infer: {
|
|
1996
1996
|
body: {
|
|
1997
1997
|
permissions: {
|
|
1998
|
-
readonly user?: ("create" | "update" | "delete" | "
|
|
1998
|
+
readonly user?: ("create" | "update" | "delete" | "list" | "get" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "set-phone")[] | undefined;
|
|
1999
1999
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
2000
2000
|
};
|
|
2001
2001
|
} & {
|
|
@@ -4070,7 +4070,7 @@ export declare const bootRime: <const C extends Config>(config: BuildConfig<C>)
|
|
|
4070
4070
|
$Infer: {
|
|
4071
4071
|
body: {
|
|
4072
4072
|
permissions: {
|
|
4073
|
-
readonly user?: ("create" | "update" | "delete" | "
|
|
4073
|
+
readonly user?: ("create" | "update" | "delete" | "list" | "get" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "set-password" | "set-email" | "set-phone")[] | undefined;
|
|
4074
4074
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
4075
4075
|
};
|
|
4076
4076
|
} & {
|
|
@@ -41,7 +41,6 @@ declare namespace _default {
|
|
|
41
41
|
export let docs_not_deleted: string;
|
|
42
42
|
export let doc_created: string;
|
|
43
43
|
export let doc_updated: string;
|
|
44
|
-
export let draft_infos: string;
|
|
45
44
|
export let draft: string;
|
|
46
45
|
export let drop_file: string;
|
|
47
46
|
export let drop_files: string;
|
|
@@ -71,7 +70,6 @@ declare namespace _default {
|
|
|
71
70
|
export let passwordResetLinkSent: string;
|
|
72
71
|
export let preview_desktop: string;
|
|
73
72
|
export let preview_mobile: string;
|
|
74
|
-
export let published_infos: string;
|
|
75
73
|
export let published: string;
|
|
76
74
|
export let requestPasswordReset: string;
|
|
77
75
|
export let resetPassword: string;
|
|
@@ -113,12 +111,10 @@ declare namespace _default {
|
|
|
113
111
|
export let take_control: string;
|
|
114
112
|
export let unsaved_dialog_title: string;
|
|
115
113
|
export let unsaved_dialog_text: string;
|
|
116
|
-
export let validate: string;
|
|
117
114
|
export let version_created: string;
|
|
118
115
|
export let version_deleted: string;
|
|
119
116
|
export let versions_history: string;
|
|
120
117
|
export let view_all: string;
|
|
121
|
-
export let view_page: string;
|
|
122
118
|
export let view_site: string;
|
|
123
119
|
export let good_morning: string;
|
|
124
120
|
export let good_afternoon: string;
|
|
@@ -165,5 +161,15 @@ declare namespace _default {
|
|
|
165
161
|
export let url_slug_required: string;
|
|
166
162
|
export let url_slug_taken: string;
|
|
167
163
|
export let under_this_page: string;
|
|
164
|
+
export let publish: string;
|
|
165
|
+
export let unpublish: string;
|
|
166
|
+
export let versions: string;
|
|
167
|
+
export let all_versions: string;
|
|
168
|
+
export let history: string;
|
|
169
|
+
export let live: string;
|
|
170
|
+
export let preview_draft: string;
|
|
171
|
+
export let preview_version: string;
|
|
172
|
+
export let delete_draft: string;
|
|
173
|
+
export let publish_replaces: string;
|
|
168
174
|
}
|
|
169
175
|
export default _default;
|
|
@@ -42,7 +42,6 @@ export default {
|
|
|
42
42
|
docs_not_deleted: '$1 of $2 could not be deleted',
|
|
43
43
|
doc_created: 'Document created',
|
|
44
44
|
doc_updated: 'Document updated',
|
|
45
|
-
draft_infos: 'The document is in draft mode, only panel users can read it',
|
|
46
45
|
draft: 'Draft',
|
|
47
46
|
drop_file: 'Drop your file here',
|
|
48
47
|
drop_files: 'Drop your files here',
|
|
@@ -72,7 +71,6 @@ export default {
|
|
|
72
71
|
passwordResetLinkSent: 'An email has been sent to $1 with instructions to reset the password',
|
|
73
72
|
preview_desktop: 'Desktop preview',
|
|
74
73
|
preview_mobile: 'Mobile preview',
|
|
75
|
-
published_infos: 'The document is published and available for everyone',
|
|
76
74
|
published: 'Published',
|
|
77
75
|
requestPasswordReset: 'Request a password reset link',
|
|
78
76
|
resetPassword: 'Reset password',
|
|
@@ -114,12 +112,10 @@ export default {
|
|
|
114
112
|
take_control: 'Take control',
|
|
115
113
|
unsaved_dialog_title: 'Changes unsaved',
|
|
116
114
|
unsaved_dialog_text: 'There are unsaved modifications in the document.',
|
|
117
|
-
validate: 'Validate',
|
|
118
115
|
version_created: 'New version created',
|
|
119
116
|
version_deleted: 'Version deleted',
|
|
120
117
|
versions_history: 'Versions history',
|
|
121
118
|
view_all: 'View all',
|
|
122
|
-
view_page: 'View page',
|
|
123
119
|
view_site: 'View website',
|
|
124
120
|
good_morning: 'Good morning, $1',
|
|
125
121
|
good_afternoon: 'Good afternoon, $1',
|
|
@@ -134,7 +130,7 @@ export default {
|
|
|
134
130
|
sort_by: 'Sort by $1',
|
|
135
131
|
collection_count_drafts: '$1 {draft|draft|drafts}',
|
|
136
132
|
drafts_waiting: '$1 {draft|draft|drafts} waiting',
|
|
137
|
-
drop_anywhere: '
|
|
133
|
+
drop_anywhere: 'Drop files anywhere to upload them',
|
|
138
134
|
drop_to_upload_into: 'Drop to upload into $1',
|
|
139
135
|
media_kind_image: 'Images',
|
|
140
136
|
media_kind_video: 'Videos',
|
|
@@ -165,5 +161,15 @@ export default {
|
|
|
165
161
|
url_on_published: 'The url changes on the published version.',
|
|
166
162
|
url_slug_required: 'The address needs at least one letter or digit.',
|
|
167
163
|
url_slug_taken: 'Another page at this level already uses this address.',
|
|
168
|
-
under_this_page: 'Under this page'
|
|
164
|
+
under_this_page: 'Under this page',
|
|
165
|
+
publish: 'Publish',
|
|
166
|
+
unpublish: 'Unpublish',
|
|
167
|
+
versions: 'Versions',
|
|
168
|
+
all_versions: 'All versions',
|
|
169
|
+
history: 'History',
|
|
170
|
+
live: 'Live',
|
|
171
|
+
preview_draft: 'Preview this draft',
|
|
172
|
+
preview_version: 'Preview this version',
|
|
173
|
+
delete_draft: 'Delete this draft',
|
|
174
|
+
publish_replaces: 'Publish replaces the live version of $1.'
|
|
169
175
|
};
|
|
@@ -40,7 +40,6 @@ declare namespace _default {
|
|
|
40
40
|
export let docs_not_deleted: string;
|
|
41
41
|
export let doc_created: string;
|
|
42
42
|
export let doc_updated: string;
|
|
43
|
-
export let draft_infos: string;
|
|
44
43
|
export let draft: string;
|
|
45
44
|
export let drop_file: string;
|
|
46
45
|
export let drop_files: string;
|
|
@@ -70,7 +69,6 @@ declare namespace _default {
|
|
|
70
69
|
export let passwordResetLinkSent: string;
|
|
71
70
|
export let preview_desktop: string;
|
|
72
71
|
export let preview_mobile: string;
|
|
73
|
-
export let published_infos: string;
|
|
74
72
|
export let published: string;
|
|
75
73
|
export let requestPasswordReset: string;
|
|
76
74
|
export let resetPassword: string;
|
|
@@ -112,12 +110,10 @@ declare namespace _default {
|
|
|
112
110
|
export let take_control: string;
|
|
113
111
|
export let unsaved_dialog_title: string;
|
|
114
112
|
export let unsaved_dialog_text: string;
|
|
115
|
-
export let validate: string;
|
|
116
113
|
export let version_created: string;
|
|
117
114
|
export let version_deleted: string;
|
|
118
115
|
export let versions_history: string;
|
|
119
116
|
export let view_all: string;
|
|
120
|
-
export let view_page: string;
|
|
121
117
|
export let view_site: string;
|
|
122
118
|
export let good_morning: string;
|
|
123
119
|
export let good_afternoon: string;
|
|
@@ -165,5 +161,15 @@ declare namespace _default {
|
|
|
165
161
|
export let url_slug_required: string;
|
|
166
162
|
export let url_slug_taken: string;
|
|
167
163
|
export let under_this_page: string;
|
|
164
|
+
export let publish: string;
|
|
165
|
+
export let unpublish: string;
|
|
166
|
+
export let versions: string;
|
|
167
|
+
export let all_versions: string;
|
|
168
|
+
export let history: string;
|
|
169
|
+
export let live: string;
|
|
170
|
+
export let preview_draft: string;
|
|
171
|
+
export let preview_version: string;
|
|
172
|
+
export let delete_draft: string;
|
|
173
|
+
export let publish_replaces: string;
|
|
168
174
|
}
|
|
169
175
|
export default _default;
|
|
@@ -43,8 +43,6 @@ export default {
|
|
|
43
43
|
'$1 sur $2 {n’a pas pu être supprimé|n’a pas pu être supprimée|n’ont pas pu être supprimés|n’ont pas pu être supprimées}',
|
|
44
44
|
doc_created: 'Document enregistré',
|
|
45
45
|
doc_updated: 'Document mis à jour',
|
|
46
|
-
draft_infos:
|
|
47
|
-
'Le document est en mode brouillon, seuls les utilisateurs du panel peuvent le consulter',
|
|
48
46
|
draft: 'Brouillon',
|
|
49
47
|
drop_file: 'Déposez votre fichier ici',
|
|
50
48
|
drop_files: 'Déposez vos fichiers ici',
|
|
@@ -75,7 +73,6 @@ export default {
|
|
|
75
73
|
'Un email a été envoyé à $1 avec les instructions pour réinitialiser le mot de passe',
|
|
76
74
|
preview_desktop: 'Aperçu ordinateur',
|
|
77
75
|
preview_mobile: 'Aperçu mobile',
|
|
78
|
-
published_infos: 'Le document est publié et accessible à tous',
|
|
79
76
|
published: 'Publié',
|
|
80
77
|
requestPasswordReset: 'Demander un lien de réinitialisation',
|
|
81
78
|
resetPassword: 'Réinitialiser le mot de passe',
|
|
@@ -117,12 +114,10 @@ export default {
|
|
|
117
114
|
take_control: 'Prendre la main',
|
|
118
115
|
unsaved_dialog_title: 'Modification(s) non-enregistrée(s)',
|
|
119
116
|
unsaved_dialog_text: 'Il y a des modifications non-enregistrées pour ce document.',
|
|
120
|
-
validate: 'Valider',
|
|
121
117
|
version_created: 'Nouvelle version créée',
|
|
122
118
|
version_deleted: 'Version supprimée',
|
|
123
119
|
versions_history: 'Historique des versions',
|
|
124
120
|
view_all: 'Voir tout',
|
|
125
|
-
view_page: 'Voir la page',
|
|
126
121
|
view_site: 'Voir le site',
|
|
127
122
|
good_morning: 'Bonjour, $1',
|
|
128
123
|
good_afternoon: 'Bon après-midi, $1',
|
|
@@ -137,7 +132,7 @@ export default {
|
|
|
137
132
|
sort_by: 'Trier par $1',
|
|
138
133
|
collection_count_drafts: '$1 {brouillon|brouillon|brouillons}',
|
|
139
134
|
drafts_waiting: '$1 {brouillon|brouillon|brouillons} en attente',
|
|
140
|
-
drop_anywhere: '
|
|
135
|
+
drop_anywhere: 'Déposez des fichiers n’importe où pour les importer',
|
|
141
136
|
drop_to_upload_into: 'Déposez pour importer dans $1',
|
|
142
137
|
media_kind_image: 'Images',
|
|
143
138
|
media_kind_video: 'Vidéos',
|
|
@@ -169,5 +164,15 @@ export default {
|
|
|
169
164
|
url_on_published: 'L’url se change sur la version publiée.',
|
|
170
165
|
url_slug_required: 'L’adresse doit contenir au moins une lettre ou un chiffre.',
|
|
171
166
|
url_slug_taken: 'Une autre page à ce niveau utilise déjà cette adresse.',
|
|
172
|
-
under_this_page: 'Sous cette page'
|
|
167
|
+
under_this_page: 'Sous cette page',
|
|
168
|
+
publish: 'Publier',
|
|
169
|
+
unpublish: 'Dépublier',
|
|
170
|
+
versions: 'Versions',
|
|
171
|
+
all_versions: 'Toutes les versions',
|
|
172
|
+
history: 'Historique',
|
|
173
|
+
live: 'En ligne',
|
|
174
|
+
preview_draft: 'Prévisualiser ce brouillon',
|
|
175
|
+
preview_version: 'Prévisualiser cette version',
|
|
176
|
+
delete_draft: 'Supprimer ce brouillon',
|
|
177
|
+
publish_replaces: 'Publier remplace la version en ligne du $1.'
|
|
173
178
|
};
|
|
@@ -2,3 +2,12 @@ import type { FieldBuilder } from '../../../fields/builders/field-builder.js';
|
|
|
2
2
|
import type { Field } from '../../../../fields/types.js';
|
|
3
3
|
/** The path of the first field marked `isTitle()`, a path a config alone can name. */
|
|
4
4
|
export declare function findTitleField(fields?: FieldBuilder<Field>[]): string | null;
|
|
5
|
+
/**
|
|
6
|
+
* The path of the title the document's heading edits, `isTitle('inline')`, or `null`.
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* [tabs(tab('attributes').fields(text('title').isTitle('inline')))] // 'attributes.title'
|
|
10
|
+
* [text('title').isTitle()] // null
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function findInlineTitle(fields?: FieldBuilder<Field>[]): string | null;
|
|
@@ -2,12 +2,28 @@ import { isFormField } from '../../../fields/util.js';
|
|
|
2
2
|
import { walkFields } from '../../../fields/walk.js';
|
|
3
3
|
/** The field types a title can be read from: text, date, slug, email and rich text. */
|
|
4
4
|
const hasMaybeTitle = (field) => ['text', 'date', 'slug', 'email', 'richText'].includes(field.type);
|
|
5
|
-
/** The
|
|
6
|
-
|
|
5
|
+
/** The first field marked `isTitle()`: its path, a path a config alone can name, and its mark. */
|
|
6
|
+
function findTitle(fields) {
|
|
7
7
|
for (const { field, path } of walkFields(fields, { determinate: true })) {
|
|
8
|
-
if (isFormField(field) && hasMaybeTitle(field.get) && field.get.isTitle
|
|
9
|
-
return path;
|
|
8
|
+
if (isFormField(field) && hasMaybeTitle(field.get) && field.get.isTitle) {
|
|
9
|
+
return { path, isTitle: field.get.isTitle };
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
14
|
+
/** The path of the first field marked `isTitle()`, a path a config alone can name. */
|
|
15
|
+
export function findTitleField(fields = []) {
|
|
16
|
+
return findTitle(fields)?.path ?? null;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The path of the title the document's heading edits, `isTitle('inline')`, or `null`.
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* [tabs(tab('attributes').fields(text('title').isTitle('inline')))] // 'attributes.title'
|
|
23
|
+
* [text('title').isTitle()] // null
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export function findInlineTitle(fields = []) {
|
|
27
|
+
const title = findTitle(fields);
|
|
28
|
+
return title?.isTitle === 'inline' ? title.path : null;
|
|
29
|
+
}
|
|
@@ -36,16 +36,17 @@
|
|
|
36
36
|
|
|
37
37
|
const user = getUserContext();
|
|
38
38
|
|
|
39
|
+
const basePath = $derived(path ? `${path}.` : '');
|
|
40
|
+
|
|
39
41
|
// The preview shows the values of the form fields the user can read, and in live mode the
|
|
40
|
-
// live ones.
|
|
42
|
+
// live ones. The title the heading edits, `isTitle('inline')`, is left out, as in the form.
|
|
41
43
|
const previewFields = $derived.by(() => {
|
|
42
44
|
return config.get.fields
|
|
43
45
|
.filter((field) => field instanceof FormFieldBuilder)
|
|
46
|
+
.filter((field) => basePath + field.name !== form.inlineTitle)
|
|
44
47
|
.filter((field) => !form.isLive || (form.isLive && field.get.live))
|
|
45
48
|
.filter((field) => field.use.accessRead(user.attributes, { id: form.values.id }));
|
|
46
49
|
});
|
|
47
|
-
|
|
48
|
-
const basePath = $derived(path ? `${path}.` : '');
|
|
49
50
|
</script>
|
|
50
51
|
|
|
51
52
|
<!-- A card: its name and a chevron, then its fields, or a preview of their values when folded. -->
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { fieldset } from '../../../panel/components/fields/fieldset.svelte.js';
|
|
3
3
|
import { Field } from '../../../panel/components/fields/index.js';
|
|
4
4
|
import { Label } from '../../../panel/components/ui/label/index.js';
|
|
5
|
+
import * as RadioCardGroup from '../../../panel/components/ui/radio-card-group/index.js';
|
|
5
6
|
import * as RadioGroup from '../../../panel/components/ui/radio-group/index.js';
|
|
6
7
|
import * as RadioRowGroup from '../../../panel/components/ui/radio-row-group/index.js';
|
|
7
8
|
import { capitalize, slugify } from '../../../util/string.js';
|
|
@@ -33,6 +34,23 @@
|
|
|
33
34
|
</div>
|
|
34
35
|
{/each}
|
|
35
36
|
</RadioRowGroup.Root>
|
|
37
|
+
{:else if config.get.layout === 'cards'}
|
|
38
|
+
<RadioCardGroup.Root
|
|
39
|
+
aria-label={config.get.label}
|
|
40
|
+
bind:value={field.value}
|
|
41
|
+
disabled={!field.editable}
|
|
42
|
+
>
|
|
43
|
+
{#each config.get.options as option, index (index)}
|
|
44
|
+
<RadioCardGroup.Item
|
|
45
|
+
value={option.value}
|
|
46
|
+
id="{fieldId}-{index}"
|
|
47
|
+
thumbnail={option.thumbnail}
|
|
48
|
+
class="rz-radio__input"
|
|
49
|
+
>
|
|
50
|
+
{option.label || capitalize(option.value)}
|
|
51
|
+
</RadioCardGroup.Item>
|
|
52
|
+
{/each}
|
|
53
|
+
</RadioCardGroup.Root>
|
|
36
54
|
{:else}
|
|
37
55
|
<RadioGroup.Root
|
|
38
56
|
aria-label={config.get.label}
|
|
@@ -56,7 +74,7 @@
|
|
|
56
74
|
</fieldset>
|
|
57
75
|
|
|
58
76
|
<style>
|
|
59
|
-
.rz-field-radio
|
|
77
|
+
.rz-field-radio--default {
|
|
60
78
|
display: flex;
|
|
61
79
|
flex-direction: column;
|
|
62
80
|
|
|
@@ -1,19 +1,36 @@
|
|
|
1
1
|
import type { DefaultValueFn, FormField, Option } from '../types.js';
|
|
2
|
+
import type { Component } from 'svelte';
|
|
2
3
|
import { PickOneFieldBuilder } from '../../core/fields/builders/select-builder.js';
|
|
3
4
|
export declare class RadioFieldBuilder extends PickOneFieldBuilder<RadioField> {
|
|
4
5
|
constructor(name: string);
|
|
5
|
-
get component():
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
get component(): Component<import("./component/props.js").RadioFieldProps, {}, "">;
|
|
7
|
+
/**
|
|
8
|
+
* `row` shows the options as one segmented row, `default` as a list of radios, `cards` as a grid
|
|
9
|
+
* of cards, each option's thumbnail above its label.
|
|
10
|
+
*/
|
|
11
|
+
layout(value: 'default' | 'row' | 'cards'): this;
|
|
12
|
+
/**
|
|
13
|
+
* The options to pick from. With the `cards` layout, an option may carry a thumbnail: a Svelte
|
|
14
|
+
* component drawn above its label.
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* import HeroSplit from './thumbnails/HeroSplit.svelte'
|
|
18
|
+
* radio('layout').layout('cards').options({ value: 'split', label: 'Côte à côte', thumbnail: HeroSplit })
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
options(...options: (RadioOption | string)[]): this;
|
|
9
22
|
protected generateType(): string;
|
|
10
23
|
}
|
|
11
24
|
export declare const radio: (name: string) => RadioFieldBuilder;
|
|
12
25
|
/****************************************************/
|
|
26
|
+
/** An option, with the thumbnail its card shows in the `cards` layout. */
|
|
27
|
+
export type RadioOption = Option & {
|
|
28
|
+
thumbnail?: Component;
|
|
29
|
+
};
|
|
13
30
|
export type RadioField = FormField & {
|
|
14
31
|
type: 'radio';
|
|
15
|
-
options:
|
|
16
|
-
layout: 'row' | 'default';
|
|
32
|
+
options: RadioOption[];
|
|
33
|
+
layout: 'row' | 'default' | 'cards';
|
|
17
34
|
defaultValue: string | DefaultValueFn<string>;
|
|
18
35
|
many: false;
|
|
19
36
|
};
|
|
@@ -9,11 +9,23 @@ export class RadioFieldBuilder extends PickOneFieldBuilder {
|
|
|
9
9
|
get component() {
|
|
10
10
|
return Radio;
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* `row` shows the options as one segmented row, `default` as a list of radios, `cards` as a grid
|
|
14
|
+
* of cards, each option's thumbnail above its label.
|
|
15
|
+
*/
|
|
13
16
|
layout(value) {
|
|
14
17
|
this.field.layout = value;
|
|
15
18
|
return this;
|
|
16
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* The options to pick from. With the `cards` layout, an option may carry a thumbnail: a Svelte
|
|
22
|
+
* component drawn above its label.
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* import HeroSplit from './thumbnails/HeroSplit.svelte'
|
|
26
|
+
* radio('layout').layout('cards').options({ value: 'split', label: 'Côte à côte', thumbnail: HeroSplit })
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
17
29
|
options(...options) {
|
|
18
30
|
super.options(...options);
|
|
19
31
|
// A radio starts on one of its options: its first, unless its default is one of them
|
|
@@ -12,8 +12,16 @@ export declare class TextFieldBuilder extends FormFieldBuilder<TextField> {
|
|
|
12
12
|
get component(): import("svelte").Component<import("./component/props").TextFieldProps, {}, "">;
|
|
13
13
|
get cell(): null;
|
|
14
14
|
get dataType(): DataType;
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* The document's title in the panel and its lists; a duplicate gets ` (copy)`. `'inline'` makes
|
|
17
|
+
* the document's heading the field: it is edited there, and the form leaves it out.
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* text('title').isTitle() // a field in the form, the heading shows its text
|
|
21
|
+
* text('title').isTitle('inline') // edited in the heading
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
isTitle(mode?: 'inline'): this;
|
|
17
25
|
placeholder(str: string): this;
|
|
18
26
|
/** `compact` hides the label: the placeholder names the field. */
|
|
19
27
|
layout(layout: 'compact'): this;
|
|
@@ -26,7 +34,7 @@ export type TextField = {
|
|
|
26
34
|
type: 'text';
|
|
27
35
|
defaultValue?: string | DefaultValueFn<string>;
|
|
28
36
|
unique?: boolean;
|
|
29
|
-
isTitle?: true;
|
|
37
|
+
isTitle?: true | 'inline';
|
|
30
38
|
placeholder?: string;
|
|
31
39
|
layout?: 'compact';
|
|
32
40
|
} & FormField;
|
|
@@ -26,9 +26,17 @@ export class TextFieldBuilder extends FormFieldBuilder {
|
|
|
26
26
|
get dataType() {
|
|
27
27
|
return 'text';
|
|
28
28
|
}
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
/**
|
|
30
|
+
* The document's title in the panel and its lists; a duplicate gets ` (copy)`. `'inline'` makes
|
|
31
|
+
* the document's heading the field: it is edited there, and the form leaves it out.
|
|
32
|
+
*
|
|
33
|
+
* ```ts
|
|
34
|
+
* text('title').isTitle() // a field in the form, the heading shows its text
|
|
35
|
+
* text('title').isTitle('inline') // edited in the heading
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
isTitle(mode) {
|
|
39
|
+
this.field.isTitle = mode ?? true;
|
|
32
40
|
return this;
|
|
33
41
|
}
|
|
34
42
|
placeholder(str) {
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
|
|
33
33
|
<!--
|
|
34
34
|
A list of fields on a 12-column grid, each in the width its config asks. Only the fields the
|
|
35
|
-
user may read render; in live edit, only the `live` ones.
|
|
35
|
+
user may read render; in live edit, only the `live` ones. The title the heading edits,
|
|
36
|
+
`isTitle('inline')`, is left out.
|
|
36
37
|
|
|
37
38
|
`path` is where the list sits in the document: `''` at the root, `meta` inside the group
|
|
38
39
|
`meta`. A form field gets its full path (`meta.title`); a component field gets the prefix
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
<div data-type="tabs" class="rz-render-fields__field rz-render-fields__field--full">
|
|
59
60
|
<Tabs config={field} {path} {form} />
|
|
60
61
|
</div>
|
|
61
|
-
{:else if isFormField(field) && isNotHidden(field)}
|
|
62
|
+
{:else if isFormField(field) && isNotHidden(field) && prefix + field.name !== form.inlineTitle}
|
|
62
63
|
{@const isCompact = 'layout' in field.get && field.get.layout === 'compact'}
|
|
63
64
|
{@const FieldComponent = field.component}
|
|
64
65
|
<div
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { t__ } from '../../../../core/i18n/index.js';
|
|
3
|
+
import Upload from '@lucide/svelte/icons/upload';
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
/** `tile`: a grid cell, as tall as a thumbnail. `row`: a strip under the list. */
|
|
7
|
+
shape: 'tile' | 'row';
|
|
8
|
+
};
|
|
9
|
+
const { shape }: Props = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<!-- A dashed box that says a file dropped on the page is uploaded. -->
|
|
13
|
+
<div class="rz-drop-hint rz-drop-hint--{shape}">
|
|
14
|
+
<Upload size={15} />
|
|
15
|
+
<span>{t__('common.drop_anywhere')}</span>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
.rz-drop-hint {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
gap: var(--rz-size-2);
|
|
24
|
+
padding-inline: var(--rz-size-3);
|
|
25
|
+
border: 1px dashed var(--rz-border-strong);
|
|
26
|
+
border-radius: var(--rz-radius-md);
|
|
27
|
+
color: var(--rz-fg-subtle);
|
|
28
|
+
font-size: var(--rz-text-sm);
|
|
29
|
+
text-align: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.rz-drop-hint--tile {
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
align-self: start;
|
|
35
|
+
aspect-ratio: 4 / 3;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.rz-drop-hint--row {
|
|
39
|
+
height: var(--rz-row-height);
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
/** `tile`: a grid cell, as tall as a thumbnail. `row`: a strip under the list. */
|
|
3
|
+
shape: 'tile' | 'row';
|
|
4
|
+
};
|
|
5
|
+
declare const DropHint: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type DropHint = ReturnType<typeof DropHint>;
|
|
7
|
+
export default DropHint;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import ContextMenuItem from '../../../ui/context-menu/ContextMenuItem.svelte';
|
|
5
5
|
import type { CollectionContext } from '../../../../context/collection.svelte.js';
|
|
6
6
|
import FolderPlus from '@lucide/svelte/icons/folder-plus';
|
|
7
|
+
import DropHint from '../DropHint.svelte';
|
|
7
8
|
import Empty from '../Empty.svelte';
|
|
8
9
|
import Folders from '../folder/Folders.svelte';
|
|
9
10
|
import GridItem from './grid-item/GridItem.svelte';
|
|
@@ -24,6 +25,11 @@
|
|
|
24
25
|
|
|
25
26
|
const hasDocsFiltered = $derived(collection.isFiltered && collection.docs.length);
|
|
26
27
|
|
|
28
|
+
const filtersOn = $derived(collection.statusFilter !== 'all' || collection.kindFilter !== 'all');
|
|
29
|
+
|
|
30
|
+
// The last cell says files dropped on the page upload; a search hides it.
|
|
31
|
+
const dropHint = $derived(collection.isUpload && collection.canCreate && !collection.isFiltered);
|
|
32
|
+
|
|
27
33
|
// An item is dragged onto a folder only when there is one to drop it on.
|
|
28
34
|
const dragEnabled = $derived(
|
|
29
35
|
collection.isUpload &&
|
|
@@ -35,7 +41,7 @@
|
|
|
35
41
|
<div class="rz-page-collection__grid">
|
|
36
42
|
<Folders {collection} />
|
|
37
43
|
|
|
38
|
-
{#if collection.shown.length}
|
|
44
|
+
{#if collection.shown.length || (dropHint && !filtersOn)}
|
|
39
45
|
<div class="rz-page-collection__grid-inner">
|
|
40
46
|
{#each collection.shown as doc (doc.id)}
|
|
41
47
|
<GridItem
|
|
@@ -47,8 +53,11 @@
|
|
|
47
53
|
checked={collection.selected.includes(doc.id)}
|
|
48
54
|
/>
|
|
49
55
|
{/each}
|
|
56
|
+
{#if dropHint}
|
|
57
|
+
<DropHint shape="tile" />
|
|
58
|
+
{/if}
|
|
50
59
|
</div>
|
|
51
|
-
{:else if
|
|
60
|
+
{:else if filtersOn}
|
|
52
61
|
<Empty config={collection.config} />
|
|
53
62
|
{/if}
|
|
54
63
|
|
|
@@ -69,7 +78,12 @@
|
|
|
69
78
|
{/if}
|
|
70
79
|
</div>
|
|
71
80
|
{:else}
|
|
72
|
-
<
|
|
81
|
+
<div class="rz-page-collection__grid-empty">
|
|
82
|
+
<Empty config={collection.config} />
|
|
83
|
+
{#if dropHint}
|
|
84
|
+
<DropHint shape="row" />
|
|
85
|
+
{/if}
|
|
86
|
+
</div>
|
|
73
87
|
{/if}
|
|
74
88
|
|
|
75
89
|
<style>
|
|
@@ -88,6 +102,12 @@
|
|
|
88
102
|
gap: calc(4.5 * var(--rz-unit)) var(--rz-size-3-5);
|
|
89
103
|
}
|
|
90
104
|
|
|
105
|
+
.rz-page-collection__grid-empty {
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-direction: column;
|
|
108
|
+
gap: var(--rz-size-5);
|
|
109
|
+
}
|
|
110
|
+
|
|
91
111
|
.rz-collection-grid__context-menu-trigger {
|
|
92
112
|
position: absolute;
|
|
93
113
|
inset: 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { createPath } from '../../../../util/url.js';
|
|
3
2
|
import { t__ } from '../../../../../core/i18n/index.js';
|
|
4
3
|
import Button from '../../../ui/button/button.svelte';
|
|
4
|
+
import { createPath } from '../../../../util/url.js';
|
|
5
5
|
import type { BuiltCollection } from '../../../../../types.js';
|
|
6
6
|
import Plus from '@lucide/svelte/icons/plus';
|
|
7
7
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
/** `sm`: an icon alone. `default`: an icon and the label. */
|
|
11
11
|
size?: 'sm' | 'default';
|
|
12
12
|
/** The labelled button's look; `default` is the primary one. */
|
|
13
|
-
variant?: 'default' | 'secondary' | 'ghost';
|
|
13
|
+
variant?: 'default' | 'outline' | 'secondary' | 'ghost';
|
|
14
14
|
};
|
|
15
15
|
const { config, size = 'default', variant = 'default' }: Props = $props();
|
|
16
16
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
{#if size === 'sm'}
|
|
25
25
|
<Button
|
|
26
|
-
variant
|
|
26
|
+
{variant}
|
|
27
27
|
size="icon-sm"
|
|
28
28
|
class="rz-button-create--icon"
|
|
29
29
|
href={createPathname}
|
|
@@ -4,7 +4,7 @@ type Props = {
|
|
|
4
4
|
/** `sm`: an icon alone. `default`: an icon and the label. */
|
|
5
5
|
size?: 'sm' | 'default';
|
|
6
6
|
/** The labelled button's look; `default` is the primary one. */
|
|
7
|
-
variant?: 'default' | 'secondary' | 'ghost';
|
|
7
|
+
variant?: 'default' | 'outline' | 'secondary' | 'ghost';
|
|
8
8
|
};
|
|
9
9
|
declare const ButtonCreate: import("svelte").Component<Props, {}, "">;
|
|
10
10
|
type ButtonCreate = ReturnType<typeof ButtonCreate>;
|