rimecms 0.26.7 → 0.26.9
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/adapter-sqlite/where.js +7 -1
- package/dist/core/areas/api/get.server.js +6 -2
- package/dist/core/collections/nested/hooks/index.server.js +3 -1
- package/dist/core/collections/upload/upload.d.ts +8 -8
- package/dist/core/collections/upload/util/path.js +2 -1
- package/dist/core/config/types.d.ts +1 -1
- package/dist/core/dev/generate/sanitize/index.js +707 -707
- package/dist/core/errors/handler.server.js +3 -3
- package/dist/core/fields/util.js +2 -1
- package/dist/core/i18n/en/common.js +60 -60
- package/dist/core/i18n/en/errors.js +13 -12
- package/dist/core/i18n/en/fields.js +11 -11
- package/dist/core/i18n/en/mail.js +2 -2
- package/dist/core/i18n/fr/common.js +64 -64
- package/dist/core/i18n/fr/errors.js +11 -11
- package/dist/core/i18n/fr/fields.js +11 -11
- package/dist/core/i18n/fr/mail.js +2 -2
- package/dist/core/logger/index.server.js +136 -136
- package/dist/core/operations/hooks/before-upsert/validate-fields.server.js +5 -5
- package/dist/core/plugins/cache/HeaderButton.svelte +11 -11
- package/dist/fields/blocks/component/AddBlockButton.svelte +161 -161
- package/dist/fields/blocks/component/Block.svelte +157 -157
- package/dist/fields/blocks/component/BlockActions.svelte +36 -36
- package/dist/fields/blocks/component/Blocks.svelte +154 -154
- package/dist/fields/blocks/component/Cell.svelte +12 -12
- package/dist/fields/blocks/component/ToggleBlockButton.svelte +11 -11
- package/dist/fields/checkbox/component/Checkbox.svelte +51 -51
- package/dist/fields/combobox/component/ComboBox.svelte +88 -88
- package/dist/fields/combobox/component/combobox.css +24 -24
- package/dist/fields/date/component/Cell.svelte +5 -5
- package/dist/fields/date/component/Date.svelte +92 -92
- package/dist/fields/email/component/Email.svelte +58 -58
- package/dist/fields/group/component/Group.svelte +131 -131
- package/dist/fields/link/component/Cell.svelte +9 -9
- package/dist/fields/link/component/Link.svelte +269 -269
- package/dist/fields/link/component/RessourceInput.svelte +183 -183
- package/dist/fields/number/component/Number.svelte +118 -118
- package/dist/fields/number/component/number.css +52 -52
- package/dist/fields/radio/component/Radio.svelte +56 -53
- package/dist/fields/relation/component/Cell.svelte +51 -51
- package/dist/fields/relation/component/Relation.svelte +226 -226
- package/dist/fields/relation/component/default/Default.svelte +218 -218
- package/dist/fields/relation/component/upload/Browse.svelte +227 -227
- package/dist/fields/relation/component/upload/Upload.svelte +112 -112
- package/dist/fields/relation/component/upload/upload.css +72 -72
- package/dist/fields/rich-text/component/Cell.svelte +5 -5
- package/dist/fields/rich-text/component/RichText.svelte +95 -95
- package/dist/fields/rich-text/component/bubble-menu/bubble-menu.css +15 -15
- package/dist/fields/rich-text/component/bubble-menu/bubble-menu.svelte +148 -148
- package/dist/fields/rich-text/component/bubble-menu/icon-button/icon-button.css +10 -10
- package/dist/fields/rich-text/component/bubble-menu/icon-button/icon-button.svelte +23 -17
- package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.css +37 -37
- package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.svelte +93 -89
- package/dist/fields/rich-text/component/drag-handle/drag-handle.css +12 -12
- package/dist/fields/rich-text/component/drag-handle/drag-handle.svelte +27 -27
- package/dist/fields/rich-text/component/styles/rich-text.css +142 -142
- package/dist/fields/rich-text/component/suggestion/suggestion.svelte +79 -79
- package/dist/fields/rich-text/core/extensions/current-node/current-node.css +3 -3
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.js +10 -7
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/cloneElement.js +4 -1
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/dragHandler.js +4 -4
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/findNextElementFromCursor.js +4 -4
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getInnerCoords.js +1 -1
- package/dist/fields/rich-text/core/features/fields/fields.css +16 -16
- package/dist/fields/rich-text/core/features/fields/fields.svelte +50 -50
- package/dist/fields/rich-text/core/features/hr/hr.css +15 -15
- package/dist/fields/rich-text/core/features/link/component/link-selector.css +2 -2
- package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +266 -266
- package/dist/fields/rich-text/core/features/resource/resource.svelte +134 -134
- package/dist/fields/rich-text/core/features/upload/upload.svelte +230 -230
- package/dist/fields/rich-text/core/render-rich-text.svelte +162 -162
- package/dist/fields/rich-text/core/svelte/node-view-wrapper.svelte +25 -18
- package/dist/fields/rich-text/util.js +2 -1
- package/dist/fields/select/component/Select.svelte +194 -194
- package/dist/fields/separator/component/Separator.svelte +5 -5
- package/dist/fields/slug/component/Cell.svelte +4 -4
- package/dist/fields/slug/component/Slug.svelte +99 -99
- package/dist/fields/tabs/component/Tabs.svelte +96 -96
- package/dist/fields/text/component/Text.svelte +54 -54
- package/dist/fields/textarea/component/TextArea.svelte +51 -51
- package/dist/fields/time/component/Time.svelte +44 -44
- package/dist/fields/toggle/component/Cell.svelte +10 -10
- package/dist/fields/toggle/component/Toggle.svelte +36 -36
- package/dist/fields/tree/component/AddItemButton.svelte +35 -29
- package/dist/fields/tree/component/Cell.svelte +12 -12
- package/dist/fields/tree/component/ToggleBlockButton.svelte +11 -11
- package/dist/fields/tree/component/Tree.svelte +150 -150
- package/dist/fields/tree/component/TreeBlock.svelte +174 -174
- package/dist/fields/tree/component/TreeBlockActions.svelte +13 -13
- package/dist/fields/tree/index.js +3 -2
- package/dist/live.d.ts +2 -2
- package/dist/live.js +2 -2
- package/dist/panel/components/Root.svelte +70 -70
- package/dist/panel/components/fields/Error.svelte +35 -35
- package/dist/panel/components/fields/FieldsPreview.svelte +71 -71
- package/dist/panel/components/fields/FieldsPreviewTrigger.svelte +11 -11
- package/dist/panel/components/fields/Hint.svelte +12 -12
- package/dist/panel/components/fields/Label.svelte +31 -26
- package/dist/panel/components/fields/LabelFor.svelte +26 -26
- package/dist/panel/components/fields/RenderFields.svelte +102 -102
- package/dist/panel/components/sections/auth/AuthForm.svelte +102 -102
- package/dist/panel/components/sections/collection/Empty.svelte +18 -18
- package/dist/panel/components/sections/collection/StatusDot.svelte +13 -13
- package/dist/panel/components/sections/collection/bulk-upload/BulkUploadDialog.svelte +30 -28
- package/dist/panel/components/sections/collection/bulk-upload/DropZone.svelte +176 -169
- package/dist/panel/components/sections/collection/folder/Folder.svelte +38 -38
- package/dist/panel/components/sections/collection/folder/FolderEdit.svelte +57 -57
- package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +223 -223
- package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +102 -102
- package/dist/panel/components/sections/collection/grid/create-directory-dialog/CreateDirectoryDialog.svelte +50 -50
- package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte +56 -56
- package/dist/panel/components/sections/collection/header/ButtonCreate.svelte +29 -29
- package/dist/panel/components/sections/collection/header/DisplayMode.svelte +59 -59
- package/dist/panel/components/sections/collection/header/Header.svelte +11 -11
- package/dist/panel/components/sections/collection/header/SearchInput.svelte +41 -41
- package/dist/panel/components/sections/collection/header/SelectUI.svelte +51 -51
- package/dist/panel/components/sections/collection/header/Separator.svelte +4 -4
- package/dist/panel/components/sections/collection/list/CollectionList.svelte +46 -46
- package/dist/panel/components/sections/collection/list/header/Header.svelte +56 -56
- package/dist/panel/components/sections/collection/list/row/Row.svelte +115 -115
- package/dist/panel/components/sections/collection/tree/CollectionTree.svelte +139 -139
- package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte +56 -56
- package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte +64 -64
- package/dist/panel/components/sections/document/AuthAPIKeyDialog.svelte +66 -66
- package/dist/panel/components/sections/document/AuthFooter.svelte +81 -81
- package/dist/panel/components/sections/document/ButtonSave.svelte +34 -27
- package/dist/panel/components/sections/document/ButtonStatus.svelte +79 -79
- package/dist/panel/components/sections/document/CurrentlyEdited.svelte +36 -36
- package/dist/panel/components/sections/document/Document.svelte +223 -223
- package/dist/panel/components/sections/document/FloatingUI.svelte +69 -69
- package/dist/panel/components/sections/document/Header.svelte +105 -105
- package/dist/panel/components/sections/document/Settings.svelte +167 -167
- package/dist/panel/components/sections/document/Versions.svelte +89 -89
- package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +205 -205
- package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte +141 -141
- package/dist/panel/components/sections/live/Consumer.svelte +14 -14
- package/dist/panel/components/sections/live/Provider.svelte +10 -10
- package/dist/panel/components/sections/live/SidePanel.svelte +56 -56
- package/dist/panel/components/sections/live/side-panel.css +10 -8
- package/dist/panel/components/sections/page-layout/Page.svelte +23 -23
- package/dist/panel/components/sections/unauthorized/Unauthorized.svelte +22 -22
- package/dist/panel/components/ui/breadcrumb/BreadCrumb.svelte +40 -40
- package/dist/panel/components/ui/button/button.svelte +226 -226
- package/dist/panel/components/ui/calendar/calendar-cell.svelte +6 -2
- package/dist/panel/components/ui/calendar/calendar-day.svelte +6 -2
- package/dist/panel/components/ui/calendar/calendar-grid-body.svelte +6 -2
- package/dist/panel/components/ui/calendar/calendar-grid-head.svelte +6 -2
- package/dist/panel/components/ui/calendar/calendar-grid-row.svelte +6 -2
- package/dist/panel/components/ui/calendar/calendar-grid.svelte +6 -2
- package/dist/panel/components/ui/calendar/calendar-head-cell.svelte +6 -2
- package/dist/panel/components/ui/calendar/calendar-header.svelte +6 -2
- package/dist/panel/components/ui/calendar/calendar-heading.svelte +6 -2
- package/dist/panel/components/ui/calendar/calendar-months.svelte +21 -16
- package/dist/panel/components/ui/calendar/calendar-next-button.svelte +13 -8
- package/dist/panel/components/ui/calendar/calendar-prev-button.svelte +13 -8
- package/dist/panel/components/ui/calendar/calendar.css +88 -88
- package/dist/panel/components/ui/calendar/calendar.svelte +50 -50
- package/dist/panel/components/ui/card/card-content.svelte +17 -12
- package/dist/panel/components/ui/card/card-description.svelte +14 -9
- package/dist/panel/components/ui/card/card-footer.svelte +17 -12
- package/dist/panel/components/ui/card/card-header.svelte +15 -10
- package/dist/panel/components/ui/card/card-title.svelte +25 -19
- package/dist/panel/components/ui/card/card.svelte +19 -14
- package/dist/panel/components/ui/card-document/card-document.svelte +73 -73
- package/dist/panel/components/ui/card-resource/card-resource.svelte +108 -108
- package/dist/panel/components/ui/checkbox/checkbox.css +28 -28
- package/dist/panel/components/ui/checkbox/checkbox.svelte +13 -13
- package/dist/panel/components/ui/command/command-dialog.css +24 -24
- package/dist/panel/components/ui/command/command-dialog.svelte +28 -18
- package/dist/panel/components/ui/command/command-empty.css +2 -2
- package/dist/panel/components/ui/command/command-empty.svelte +7 -3
- package/dist/panel/components/ui/command/command-group.css +20 -20
- package/dist/panel/components/ui/command/command-group.svelte +17 -17
- package/dist/panel/components/ui/command/command-input-select.svelte +50 -45
- package/dist/panel/components/ui/command/command-input.svelte +57 -57
- package/dist/panel/components/ui/command/command-item.css +18 -18
- package/dist/panel/components/ui/command/command-item.svelte +7 -3
- package/dist/panel/components/ui/command/command-list.css +4 -4
- package/dist/panel/components/ui/command/command-list.svelte +7 -3
- package/dist/panel/components/ui/command/command-separator.css +4 -4
- package/dist/panel/components/ui/command/command-separator.svelte +7 -3
- package/dist/panel/components/ui/command/command.css +5 -5
- package/dist/panel/components/ui/command/command.svelte +8 -8
- package/dist/panel/components/ui/context-menu/ContextMenu.svelte +10 -5
- package/dist/panel/components/ui/context-menu/ContextMenu.svelte.d.ts +2 -2
- package/dist/panel/components/ui/context-menu/ContextMenuItem.svelte +8 -8
- package/dist/panel/components/ui/context-menu/context-menu-item.css +20 -20
- package/dist/panel/components/ui/context-menu/context-menu.css +12 -12
- package/dist/panel/components/ui/dialog/dialog-content.css +45 -45
- package/dist/panel/components/ui/dialog/dialog-content.svelte +33 -33
- package/dist/panel/components/ui/dialog/dialog-description.css +2 -2
- package/dist/panel/components/ui/dialog/dialog-description.svelte +7 -3
- package/dist/panel/components/ui/dialog/dialog-footer.svelte +20 -20
- package/dist/panel/components/ui/dialog/dialog-header.svelte +22 -22
- package/dist/panel/components/ui/dialog/dialog-overlay.css +6 -6
- package/dist/panel/components/ui/dialog/dialog-overlay.svelte +7 -3
- package/dist/panel/components/ui/dialog/dialog-title.css +3 -3
- package/dist/panel/components/ui/dialog/dialog-title.svelte +7 -3
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +55 -55
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-content.css +8 -8
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-content.svelte +14 -9
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-group-heading.css +5 -5
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte +10 -10
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-item.css +19 -19
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-item.svelte +9 -9
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-radio-item.css +17 -17
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +17 -17
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-separator.css +3 -3
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-separator.svelte +12 -4
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-trigger.svelte +6 -2
- package/dist/panel/components/ui/input/input.svelte +93 -93
- package/dist/panel/components/ui/label/label.css +7 -7
- package/dist/panel/components/ui/label/label.svelte +8 -8
- package/dist/panel/components/ui/language-switcher/LanguageSwitcher.svelte +48 -48
- package/dist/panel/components/ui/nav/Nav.svelte +151 -151
- package/dist/panel/components/ui/nav/NavGroup.svelte +85 -85
- package/dist/panel/components/ui/nav/NavItem.svelte +42 -42
- package/dist/panel/components/ui/nav/NavItemButton.svelte +39 -38
- package/dist/panel/components/ui/nav/NavItemButtonCaret.svelte +8 -8
- package/dist/panel/components/ui/nav/UserButton.svelte +90 -90
- package/dist/panel/components/ui/page-header/PageHeader.svelte +80 -80
- package/dist/panel/components/ui/pane/pane-resizer.svelte +12 -12
- package/dist/panel/components/ui/popover/popover-content.css +7 -7
- package/dist/panel/components/ui/popover/popover-content.svelte +16 -10
- package/dist/panel/components/ui/radio-group/radio-group-item.svelte +8 -7
- package/dist/panel/components/ui/radio-group/radio-group.css +23 -23
- package/dist/panel/components/ui/radio-group/radio-group.svelte +8 -8
- package/dist/panel/components/ui/radio-row-group/radio-row-group-item.svelte +9 -9
- package/dist/panel/components/ui/radio-row-group/radio-row-group.css +27 -27
- package/dist/panel/components/ui/radio-row-group/radio-row-group.svelte +14 -9
- package/dist/panel/components/ui/scroll-area/scroll-area-scrollbar.svelte +14 -14
- package/dist/panel/components/ui/scroll-area/scroll-area.css +21 -21
- package/dist/panel/components/ui/scroll-area/scroll-area.svelte +26 -26
- package/dist/panel/components/ui/separator/separator.svelte +25 -25
- package/dist/panel/components/ui/sheet/sheet-content.svelte +33 -33
- package/dist/panel/components/ui/sheet/sheet-description.svelte +6 -2
- package/dist/panel/components/ui/sheet/sheet-footer.svelte +10 -5
- package/dist/panel/components/ui/sheet/sheet-header.svelte +10 -5
- package/dist/panel/components/ui/sheet/sheet-overlay.svelte +7 -3
- package/dist/panel/components/ui/sheet/sheet-title.svelte +6 -2
- package/dist/panel/components/ui/sheet/sheet.css +81 -81
- package/dist/panel/components/ui/sheet/sheet.svelte +5 -5
- package/dist/panel/components/ui/sonner/sonner.css +12 -12
- package/dist/panel/components/ui/sonner/sonner.svelte +15 -15
- package/dist/panel/components/ui/spin-loader/SpinLoader.svelte +2 -2
- package/dist/panel/components/ui/spin-loader/spin-loader.css +10 -10
- package/dist/panel/components/ui/switch/switch.css +36 -36
- package/dist/panel/components/ui/switch/switch.svelte +9 -9
- package/dist/panel/components/ui/tabs/tabs-content.svelte +6 -2
- package/dist/panel/components/ui/tabs/tabs-list.svelte +2 -2
- package/dist/panel/components/ui/tabs/tabs-trigger.svelte +6 -2
- package/dist/panel/components/ui/tabs/tabs.css +47 -49
- package/dist/panel/components/ui/tabs/tabs.svelte +5 -5
- package/dist/panel/components/ui/tag/tag.svelte +49 -45
- package/dist/panel/components/ui/tooltip/tooltip-content.svelte +31 -31
- package/dist/panel/pages/area/Area.svelte +17 -17
- package/dist/panel/pages/area/AreaVersionsDoc.svelte +19 -19
- package/dist/panel/pages/area/load.server.js +10 -2
- package/dist/panel/pages/auth/forgot-password/ForgotPassword.svelte +46 -46
- package/dist/panel/pages/auth/reset-password/ResetPassword.svelte +54 -54
- package/dist/panel/pages/auth/sign-in/SignIn.svelte +41 -41
- package/dist/panel/pages/collection/Collection.svelte +121 -121
- package/dist/panel/pages/collection/load.server.js +8 -2
- package/dist/panel/pages/collection-document/CollectionDocVersions.svelte +26 -26
- package/dist/panel/pages/collection-document/CollectionDocument.svelte +20 -20
- package/dist/panel/pages/collection-document/actions.server.js +3 -1
- package/dist/panel/pages/collection-document/load.server.js +4 -1
- package/dist/panel/pages/dashboard/Dashboard.svelte +109 -109
- package/dist/panel/pages/index.actions.server.js +1 -1
- package/dist/panel/pages/index.load.server.js +1 -1
- package/dist/panel/pages/live/Live.svelte +199 -192
- package/dist/panel/style/font.css +32 -32
- package/dist/panel/style/index.css +81 -81
- package/dist/panel/style/palette.css +27 -28
- package/dist/panel/style/radius.css +8 -8
- package/dist/panel/style/shadow.css +8 -8
- package/dist/panel/style/size.css +41 -41
- package/dist/panel/style/util.css +1 -1
- package/dist/util/cases.d.ts +1 -1
- package/package.json +233 -233
|
@@ -1,154 +1,154 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
2
|
+
import { t__ } from '../../../core/i18n/index.js';
|
|
3
|
+
import { Field } from '../../../panel/components/fields/index.js';
|
|
4
|
+
import { root } from '../../../panel/components/fields/root.svelte.js';
|
|
5
|
+
import * as Command from '../../../panel/components/ui/command/index.js';
|
|
6
|
+
import Tag from '../../../panel/components/ui/tag/tag.svelte';
|
|
7
|
+
import { useSortable } from '../../../panel/util/Sortable.js';
|
|
8
|
+
import { moveItem } from '../../../util/array';
|
|
9
|
+
import type { SelectFieldProps } from './props.js';
|
|
10
|
+
|
|
11
|
+
const { path, config, form }: SelectFieldProps = $props();
|
|
12
|
+
|
|
13
|
+
let listHTMLElement: HTMLElement;
|
|
14
|
+
let initialized = false;
|
|
15
|
+
let options = $derived(config.options);
|
|
16
|
+
const validValues = $derived(config.options.map((o) => o.value));
|
|
17
|
+
const field = $derived(form.useField<string | string[]>(path, config));
|
|
18
|
+
|
|
19
|
+
let isFull = $derived.by(() => {
|
|
20
|
+
if (!field.value) return false;
|
|
21
|
+
const notManyAndOneSelected = !config.many && typeof field.value === 'string';
|
|
22
|
+
const manyAndAllSelected = config.many && field.value.length === config.options.length;
|
|
23
|
+
return notManyAndOneSelected || manyAndAllSelected;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
let search = $state('');
|
|
27
|
+
let inputFocused = $state(false);
|
|
28
|
+
|
|
29
|
+
const { sortable } = useSortable({
|
|
30
|
+
animation: 150,
|
|
31
|
+
draggable: '.rz-select__option',
|
|
32
|
+
onEnd: function (e) {
|
|
33
|
+
if (e.oldIndex !== undefined && e.newIndex !== undefined) {
|
|
34
|
+
onOrderChange(e.oldIndex, e.newIndex);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
$effect(() => {
|
|
40
|
+
if (config.many) {
|
|
41
|
+
sortable(listHTMLElement);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
$effect(() => {
|
|
46
|
+
if (config.many) {
|
|
47
|
+
if (field.value && Array.isArray(field.value) && !initialized) {
|
|
48
|
+
field.value = field.value.filter((val: string) => validValues.includes(val));
|
|
49
|
+
}
|
|
50
|
+
} else if (typeof field.value === 'string') {
|
|
51
|
+
if (field.value && !initialized) {
|
|
52
|
+
field.value = validValues.includes(field.value) ? field.value : null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
initialized = true;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
$effect(() => {
|
|
59
|
+
if (config.many) {
|
|
60
|
+
const currentValue = $state.snapshot(field.value);
|
|
61
|
+
if (!currentValue) {
|
|
62
|
+
options = config.options;
|
|
63
|
+
} else {
|
|
64
|
+
options = config.options.filter((option) => !currentValue.includes(option.value));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const onOrderChange = (oldIndex: number, newIndex: number) => {
|
|
70
|
+
if (!Array.isArray(field.value)) return;
|
|
71
|
+
field.value = moveItem(field.value, oldIndex, newIndex);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const addValue = (val: string) => {
|
|
75
|
+
if (isFull) return;
|
|
76
|
+
if (config.many) {
|
|
77
|
+
field.value = [...(field.value || []), val];
|
|
78
|
+
} else {
|
|
79
|
+
field.value = val;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const removeValue = (val?: string) => {
|
|
84
|
+
if (config.many) {
|
|
85
|
+
field.value = [...(field.value || [])].filter((v) => v !== val);
|
|
86
|
+
} else {
|
|
87
|
+
field.value = null;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
90
|
</script>
|
|
91
91
|
|
|
92
92
|
<fieldset class="rz-field-select {config.className || ''}" use:root={field}>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
93
|
+
<Field.Label for={path || config.name} {config} />
|
|
94
|
+
<Field.Error error={field.error} />
|
|
95
|
+
|
|
96
|
+
<div class="rz-select">
|
|
97
|
+
<Command.Root>
|
|
98
|
+
<div
|
|
99
|
+
bind:this={listHTMLElement}
|
|
100
|
+
class="rz-select__list"
|
|
101
|
+
class:rz-select__list--readonly={form.readOnly}
|
|
102
|
+
data-focused={inputFocused ? '' : null}
|
|
103
|
+
data-error={field.error ? '' : null}
|
|
104
|
+
>
|
|
105
|
+
{#if config.many}
|
|
106
|
+
{#each field.value || [] as val (val)}
|
|
107
|
+
{@const option = config.options.find((o) => o.value === val)}
|
|
108
|
+
{#if option}
|
|
109
|
+
<Tag onRemove={() => removeValue(option.value)} readOnly={form.readOnly}>
|
|
110
|
+
{option.label}
|
|
111
|
+
</Tag>
|
|
112
|
+
{/if}
|
|
113
|
+
{/each}
|
|
114
|
+
{:else if field.value}
|
|
115
|
+
{@const option = config.options.filter((o) => o.value === field.value)[0]}
|
|
116
|
+
{#if option}
|
|
117
|
+
<Tag onRemove={() => removeValue()} readOnly={form.readOnly}>
|
|
118
|
+
{option.label}
|
|
119
|
+
</Tag>
|
|
120
|
+
{/if}
|
|
121
|
+
{/if}
|
|
122
|
+
|
|
123
|
+
{#if !form.readOnly && !isFull}
|
|
124
|
+
<Command.InputSelect
|
|
125
|
+
name={path || config.name}
|
|
126
|
+
autocomplete="off"
|
|
127
|
+
onfocus={() => (inputFocused = true)}
|
|
128
|
+
onblur={() => setTimeout(() => (inputFocused = false), 200)}
|
|
129
|
+
bind:value={search}
|
|
130
|
+
placeholder={t__('common.search')}
|
|
131
|
+
/>
|
|
132
|
+
{#if inputFocused}
|
|
133
|
+
<Command.List>
|
|
134
|
+
{#each options as option, index (index)}
|
|
135
|
+
<Command.Item
|
|
136
|
+
value={option.value}
|
|
137
|
+
onSelect={() => {
|
|
138
|
+
addValue(option.value);
|
|
139
|
+
search = '';
|
|
140
|
+
}}
|
|
141
|
+
>
|
|
142
|
+
<span>{option.label}</span>
|
|
143
|
+
</Command.Item>
|
|
144
|
+
{/each}
|
|
145
|
+
</Command.List>
|
|
146
|
+
{/if}
|
|
147
|
+
{/if}
|
|
148
|
+
</div>
|
|
149
|
+
</Command.Root>
|
|
150
|
+
</div>
|
|
151
|
+
<Field.Hint {config} />
|
|
152
152
|
</fieldset>
|
|
153
153
|
|
|
154
154
|
<style>/**************************************/
|
|
@@ -158,59 +158,59 @@
|
|
|
158
158
|
/**************************************/
|
|
159
159
|
|
|
160
160
|
.rz-select {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
161
|
+
margin-bottom: var(--rz-size-2);
|
|
162
|
+
position: relative;
|
|
163
|
+
|
|
164
|
+
:global(.rz-command) {
|
|
165
|
+
width: 100%;
|
|
166
|
+
border-radius: var(--rz-radius-md);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
:global(.rz-command-input-select) {
|
|
170
|
+
cursor: text;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
:global(.rz-command-list) {
|
|
174
|
+
background-color: hsl(var(--rz-input-bg));
|
|
175
|
+
border: var(--rz-border);
|
|
176
|
+
border-radius: var(--rz-radius-md);
|
|
177
|
+
position: absolute;
|
|
178
|
+
left: 0;
|
|
179
|
+
right: 0;
|
|
180
|
+
top: var(--rz-size-12);
|
|
181
|
+
z-index: 20;
|
|
182
|
+
box-shadow: var(--rz-shadow-md);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
:global(.rz-command-item) {
|
|
186
|
+
height: var(--rz-size-10);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
189
|
|
|
190
190
|
.rz-select__list {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
191
|
+
background-color: hsl(var(--rz-input-bg));
|
|
192
|
+
border: var(--rz-border);
|
|
193
|
+
border-radius: var(--rz-radius-md);
|
|
194
|
+
display: flex;
|
|
195
|
+
flex-wrap: wrap;
|
|
196
|
+
gap: var(--rz-size-2);
|
|
197
|
+
min-height: var(--rz-size-10);
|
|
198
|
+
padding: var(--rz-size-2) var(--rz-size-3);
|
|
199
|
+
}
|
|
200
200
|
|
|
201
201
|
.rz-select__list[data-focused] {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
box-shadow:
|
|
203
|
+
0 0 0 var(--rz-ring-offset, 0px) hsl(var(--rz-ring-offset-bg, var(--rz-gray-6)) / 1),
|
|
204
|
+
0 0 0 calc(var(--rz-ring-offset, 0px) + 1px) hsl(var(--rz-color-ring) / var(--rz-ring-opacity, 1));
|
|
205
|
+
}
|
|
206
206
|
|
|
207
207
|
.rz-select__list[data-error] {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
208
|
+
box-shadow:
|
|
209
|
+
0 0 0 var(--rz-ring-offset, 0px) hsl(var(--rz-ring-offset-bg, var(--rz-gray-6)) / 1),
|
|
210
|
+
0 0 0 calc(var(--rz-ring-offset, 0px) + 1px) hsl(var(--rz-color-alert) / var(--rz-ring-opacity, 1));
|
|
211
|
+
}
|
|
212
212
|
|
|
213
213
|
.rz-select__list--readonly {
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
cursor: no-drop;
|
|
215
|
+
}
|
|
216
216
|
</style>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type Props = { class?: string };
|
|
3
|
+
const { class: className }: Props = $props();
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
6
|
<hr class="rz-separator {className}" />
|
|
7
7
|
|
|
8
8
|
<style>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
.rz-separator {
|
|
10
|
+
margin-bottom: var(--rz-size-4);
|
|
11
|
+
}
|
|
12
12
|
</style>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
2
|
+
let { value }: { value: string } = $props();
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<span class="rz-slug-cell">{value}</span>
|
|
6
6
|
|
|
7
7
|
<style>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
.rz-slug-cell {
|
|
9
|
+
font-family: var(--rz-font-mono);
|
|
10
|
+
}
|
|
11
11
|
</style>
|
|
@@ -1,119 +1,119 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import { t__ } from '../../../core/i18n/index.js';
|
|
3
|
+
import { Field } from '../../../panel/components/fields/index.js';
|
|
4
|
+
import { root } from '../../../panel/components/fields/root.svelte.js';
|
|
5
|
+
import Button from '../../../panel/components/ui/button/button.svelte';
|
|
6
|
+
import { Input } from '../../../panel/components/ui/input/index.js';
|
|
7
|
+
import type { DocumentFormContext } from '../../../panel/context/documentForm.svelte.js';
|
|
8
|
+
import { slugify } from '../../../util/string.js';
|
|
9
|
+
import { Hash } from '@lucide/svelte';
|
|
10
|
+
import type { SlugField } from '../index';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
type Props = { path: string; config: SlugField; form: DocumentFormContext };
|
|
13
|
+
const { path, config, form }: Props = $props();
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
const field = $derived(form.useField(path, config));
|
|
16
|
+
let isFocused = false;
|
|
17
|
+
// svelte-ignore state_referenced_locally
|
|
18
|
+
const initialValue = form.getRawValue(path);
|
|
19
|
+
const initialEmpty = !initialValue;
|
|
20
|
+
const slugifySource = $derived(config.slugify ? form.useField<string>(config.slugify) : null);
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
const slugifiedValue = $derived.by(() => {
|
|
23
|
+
if (slugifySource && slugifySource.value) {
|
|
24
|
+
return slugify(slugifySource.value);
|
|
25
|
+
}
|
|
26
|
+
return '';
|
|
27
|
+
});
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
$effect(() => {
|
|
30
|
+
if (!isFocused && initialEmpty && slugifiedValue && field.value !== slugifiedValue) {
|
|
31
|
+
field.value = slugifiedValue;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
const onInput = (event: Event) => {
|
|
36
|
+
const inputElement = event.target as HTMLInputElement;
|
|
37
|
+
const inputValue = inputElement.value;
|
|
38
|
+
const slugifiedValue = slugify(inputValue.replace(' ', '-'));
|
|
39
|
+
if (inputValue !== slugifiedValue) {
|
|
40
|
+
inputElement.value = slugifiedValue;
|
|
41
|
+
}
|
|
42
|
+
field.value = inputElement.value;
|
|
43
|
+
};
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const classNameCompact = $derived(config.layout === 'compact' ? 'rz-slug-field--compact' : '');
|
|
46
|
+
const classNames = $derived(`rz-slug-field ${classNameCompact || ''} ${config.className}`);
|
|
47
47
|
</script>
|
|
48
48
|
|
|
49
49
|
<fieldset class={classNames} use:root={field}>
|
|
50
|
-
|
|
50
|
+
<Field.Label {config} for={path || config.name} />
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
<div class="rz-slug">
|
|
53
|
+
<Input
|
|
54
|
+
id={path || config.name}
|
|
55
|
+
placeholder={config.placeholder}
|
|
56
|
+
data-error={field.error ? '' : null}
|
|
57
|
+
type="text"
|
|
58
|
+
icon={Hash}
|
|
59
|
+
value={field.value}
|
|
60
|
+
name={path || config.name}
|
|
61
|
+
oninput={onInput}
|
|
62
|
+
onfocus={() => (isFocused = true)}
|
|
63
|
+
onblur={() => (isFocused = false)}
|
|
64
|
+
/>
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
66
|
+
{#if config.slugify}
|
|
67
|
+
<Button
|
|
68
|
+
disabled={!field.editable}
|
|
69
|
+
onclick={() => (field.value = slugifiedValue)}
|
|
70
|
+
type="button"
|
|
71
|
+
size="sm"
|
|
72
|
+
variant="secondary"
|
|
73
|
+
>
|
|
74
|
+
{t__('fields.generate_from', config.slugify)}
|
|
75
|
+
</Button>
|
|
76
|
+
{/if}
|
|
77
|
+
</div>
|
|
78
|
+
<Field.Hint {config} />
|
|
79
|
+
<Field.Error error={field.error} />
|
|
80
80
|
</fieldset>
|
|
81
81
|
|
|
82
82
|
<style>
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
.rz-slug {
|
|
84
|
+
position: relative;
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
:global(.rz-input) {
|
|
87
|
+
font-family: var(--rz-font-mono);
|
|
88
|
+
}
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
:global(.rz-button) {
|
|
91
|
+
position: absolute;
|
|
92
|
+
right: var(--rz-size-1-5);
|
|
93
|
+
top: var(--rz-size-1-5);
|
|
94
|
+
}
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
:global(.rz-slug__icon) {
|
|
97
|
+
opacity: 0.37;
|
|
98
|
+
position: absolute;
|
|
99
|
+
left: 0.75rem;
|
|
100
|
+
top: 1rem;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
104
|
+
.rz-slug-field--compact {
|
|
105
|
+
:global(label) {
|
|
106
|
+
display: none;
|
|
107
|
+
}
|
|
108
|
+
:global(.rz-field-error) {
|
|
109
|
+
position: absolute;
|
|
110
|
+
top: var(--rz-size-3);
|
|
111
|
+
right: calc(var(--rz-fields-padding) + var(--rz-size-40));
|
|
112
|
+
}
|
|
113
|
+
:global(.rz-input) {
|
|
114
|
+
font-size: var(--rz-text-md);
|
|
115
|
+
padding: var(--rz-size-5) 0 var(--rz-size-5) var(--rz-size-8);
|
|
116
|
+
height: var(--rz-size-11);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
119
|
</style>
|