@byline/admin 4.11.0 → 4.11.2
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/fields/array/array-field.js +10 -10
- package/dist/fields/blocks/blocks-field.js +15 -15
- package/dist/fields/code/code-field.js +3 -3
- package/dist/fields/datetime/datetime-field.js +2 -2
- package/dist/fields/draggable-context-menu.js +9 -9
- package/dist/fields/field-renderer.js +3 -3
- package/dist/fields/file/file-field.js +21 -21
- package/dist/fields/file/file-upload-field.js +8 -8
- package/dist/fields/group/group-field.js +6 -6
- package/dist/fields/image/image-field.js +23 -23
- package/dist/fields/image/image-upload-field.js +11 -11
- package/dist/fields/locale-badge.js +2 -2
- package/dist/fields/relation/relation-display.js +2 -2
- package/dist/fields/relation/relation-field.js +7 -7
- package/dist/fields/relation/relation-many-field.js +12 -12
- package/dist/fields/relation/relation-picker.js +19 -19
- package/dist/fields/relation/relation-summary.js +9 -9
- package/dist/fields/select/select-field.js +3 -3
- package/dist/fields/sortable-item.js +9 -9
- package/dist/fields/text/text-field.js +2 -2
- package/dist/fields/text-area/text-area-field.js +2 -2
- package/dist/forms/available-locales-widget.js +4 -4
- package/dist/forms/document-actions.js +40 -40
- package/dist/forms/form-modals.js +12 -12
- package/dist/forms/form-renderer.js +17 -17
- package/dist/forms/form-status-display.js +15 -15
- package/dist/forms/path-widget.js +4 -4
- package/dist/forms/tree-placement-widget.js +10 -10
- package/dist/modules/admin-account/components/change-password.js +6 -6
- package/dist/modules/admin-account/components/container.js +28 -28
- package/dist/modules/admin-account/components/preferences.js +9 -9
- package/dist/modules/admin-account/components/theme-switch.js +4 -4
- package/dist/modules/admin-account/components/update.js +6 -6
- package/dist/modules/admin-permissions/components/inspector.js +31 -31
- package/dist/modules/admin-roles/components/create.js +6 -6
- package/dist/modules/admin-roles/components/permissions.js +25 -25
- package/dist/modules/admin-roles/components/update.js +6 -6
- package/dist/modules/admin-users/components/create.js +8 -8
- package/dist/modules/admin-users/components/roles.js +15 -15
- package/dist/modules/admin-users/components/set-password.js +6 -6
- package/dist/modules/admin-users/components/update.js +7 -7
- package/dist/modules/auth/components/sign-in-form.js +8 -8
- package/dist/presentation/group.js +3 -3
- package/dist/presentation/row.js +2 -2
- package/dist/presentation/tabs.js +5 -5
- package/dist/widgets/diff-viewer/diff-modal.js +10 -10
- package/dist/widgets/source-locale-badge/source-locale-badge.js +2 -2
- package/dist/widgets/status-badge/status-badge.js +4 -4
- package/package.json +15 -15
- package/src/fields/array/array-field.tsx +1 -1
- package/src/fields/blocks/blocks-field.tsx +1 -1
- package/src/fields/code/code-field.tsx +1 -1
- package/src/fields/datetime/datetime-field.tsx +1 -1
- package/src/fields/draggable-context-menu.tsx +1 -1
- package/src/fields/field-renderer.tsx +1 -1
- package/src/fields/file/file-field.tsx +1 -1
- package/src/fields/file/file-upload-field.tsx +1 -1
- package/src/fields/group/group-field.tsx +1 -1
- package/src/fields/image/image-field.tsx +1 -1
- package/src/fields/image/image-upload-field.tsx +1 -1
- package/src/fields/locale-badge.tsx +1 -1
- package/src/fields/relation/relation-display.tsx +1 -1
- package/src/fields/relation/relation-field.tsx +1 -1
- package/src/fields/relation/relation-many-field.tsx +1 -1
- package/src/fields/relation/relation-picker.tsx +1 -1
- package/src/fields/relation/relation-summary.tsx +1 -1
- package/src/fields/select/select-field.tsx +1 -1
- package/src/fields/sortable-item.tsx +1 -1
- package/src/fields/text/text-field.tsx +1 -1
- package/src/fields/text-area/text-area-field.tsx +1 -1
- package/src/forms/available-locales-widget.tsx +1 -1
- package/src/forms/document-actions.tsx +1 -1
- package/src/forms/form-modals.tsx +1 -1
- package/src/forms/form-renderer.tsx +1 -1
- package/src/forms/form-status-display.tsx +1 -1
- package/src/forms/path-widget.tsx +1 -1
- package/src/forms/tree-placement-widget.tsx +1 -1
- package/src/modules/admin-account/components/change-password.tsx +1 -1
- package/src/modules/admin-account/components/container.tsx +1 -1
- package/src/modules/admin-account/components/preferences.tsx +1 -1
- package/src/modules/admin-account/components/theme-switch.tsx +1 -1
- package/src/modules/admin-account/components/update.tsx +1 -1
- package/src/modules/admin-permissions/components/inspector.tsx +1 -1
- package/src/modules/admin-roles/components/create.tsx +1 -1
- package/src/modules/admin-roles/components/permissions.tsx +1 -1
- package/src/modules/admin-roles/components/update.tsx +1 -1
- package/src/modules/admin-users/components/create.tsx +1 -1
- package/src/modules/admin-users/components/roles.tsx +1 -1
- package/src/modules/admin-users/components/set-password.tsx +1 -1
- package/src/modules/admin-users/components/update.tsx +1 -1
- package/src/modules/auth/components/sign-in-form.tsx +1 -1
- package/src/presentation/group.tsx +1 -1
- package/src/presentation/row.tsx +1 -1
- package/src/presentation/tabs.tsx +1 -1
- package/src/widgets/diff-viewer/diff-modal.tsx +1 -1
- package/src/widgets/source-locale-badge/source-locale-badge.tsx +1 -1
- package/src/widgets/status-badge/status-badge.tsx +1 -1
|
@@ -3,7 +3,7 @@ import { useState } from "react";
|
|
|
3
3
|
import { isPendingStoredFileValue } from "@byline/core";
|
|
4
4
|
import { useTranslation } from "@byline/i18n/react";
|
|
5
5
|
import { CloseIcon, ErrorText, HelpText, IconButton, ImageLightbox, Label, LoaderRing } from "@byline/ui/react";
|
|
6
|
-
import
|
|
6
|
+
import clsx from "clsx";
|
|
7
7
|
import { useFieldError, useFieldValue, useFormContext, useIsDirty, useIsFieldUploading } from "../../forms/form-context.js";
|
|
8
8
|
import { useFieldChangeHandler } from "../use-field-change-handler.js";
|
|
9
9
|
import image_field_module from "./image-field.module.js";
|
|
@@ -39,7 +39,7 @@ const ImageField = ({ field, value, defaultValue, onChange: _onChange, path })=>
|
|
|
39
39
|
className: `byline-field-image ${field.name}`,
|
|
40
40
|
children: [
|
|
41
41
|
/*#__PURE__*/ jsx("div", {
|
|
42
|
-
className:
|
|
42
|
+
className: clsx('byline-field-image-header', image_field_module.header),
|
|
43
43
|
children: /*#__PURE__*/ jsx(Label, {
|
|
44
44
|
id: htmlId,
|
|
45
45
|
htmlFor: htmlId,
|
|
@@ -48,7 +48,7 @@ const ImageField = ({ field, value, defaultValue, onChange: _onChange, path })=>
|
|
|
48
48
|
})
|
|
49
49
|
}),
|
|
50
50
|
showUploadWidget ? uploadGated ? /*#__PURE__*/ jsx("div", {
|
|
51
|
-
className:
|
|
51
|
+
className: clsx('byline-field-image-empty', image_field_module.empty),
|
|
52
52
|
role: "note",
|
|
53
53
|
"data-testid": "upload-require-saved-document",
|
|
54
54
|
children: t('fields.upload.requireSavedDocument')
|
|
@@ -60,19 +60,19 @@ const ImageField = ({ field, value, defaultValue, onChange: _onChange, path })=>
|
|
|
60
60
|
handleChange(uploaded);
|
|
61
61
|
}
|
|
62
62
|
}) : /*#__PURE__*/ jsx("div", {
|
|
63
|
-
className:
|
|
63
|
+
className: clsx('byline-field-image-empty', image_field_module.empty),
|
|
64
64
|
children: t('fields.image.empty')
|
|
65
65
|
}) : /*#__PURE__*/ jsxs("div", {
|
|
66
|
-
className:
|
|
66
|
+
className: clsx('byline-field-image-tile', image_field_module.tile),
|
|
67
67
|
children: [
|
|
68
68
|
isUploading && /*#__PURE__*/ jsx("div", {
|
|
69
|
-
className:
|
|
69
|
+
className: clsx('byline-field-image-uploading', image_field_module.uploading),
|
|
70
70
|
"aria-live": "polite",
|
|
71
71
|
"aria-busy": "true",
|
|
72
72
|
children: /*#__PURE__*/ jsx(LoaderRing, {})
|
|
73
73
|
}),
|
|
74
74
|
collectionPath && /*#__PURE__*/ jsx("div", {
|
|
75
|
-
className:
|
|
75
|
+
className: clsx('byline-field-image-remove', image_field_module.remove),
|
|
76
76
|
children: /*#__PURE__*/ jsx(IconButton, {
|
|
77
77
|
type: "button",
|
|
78
78
|
intent: "noeffect",
|
|
@@ -87,17 +87,17 @@ const ImageField = ({ field, value, defaultValue, onChange: _onChange, path })=>
|
|
|
87
87
|
})
|
|
88
88
|
}),
|
|
89
89
|
previewUrl && /*#__PURE__*/ jsxs("div", {
|
|
90
|
-
className:
|
|
90
|
+
className: clsx('byline-field-image-preview-wrap', image_field_module["preview-wrap"]),
|
|
91
91
|
children: [
|
|
92
92
|
canOpenLightbox ? /*#__PURE__*/ jsx("button", {
|
|
93
93
|
type: "button",
|
|
94
94
|
onClick: ()=>setLightboxOpen(true),
|
|
95
95
|
"aria-label": t('fields.image.openLightboxAriaLabel'),
|
|
96
|
-
className:
|
|
96
|
+
className: clsx('byline-field-image-preview-button', image_field_module["preview-button"]),
|
|
97
97
|
children: /*#__PURE__*/ jsx("img", {
|
|
98
98
|
src: previewUrl,
|
|
99
99
|
alt: incomingValue.originalFilename ?? incomingValue.filename,
|
|
100
|
-
className:
|
|
100
|
+
className: clsx('byline-field-image-preview', image_field_module.preview, 'image/svg+xml' === incomingValue.mimeType && [
|
|
101
101
|
'byline-field-image-preview-svg',
|
|
102
102
|
image_field_module["preview-svg"]
|
|
103
103
|
])
|
|
@@ -105,24 +105,24 @@ const ImageField = ({ field, value, defaultValue, onChange: _onChange, path })=>
|
|
|
105
105
|
}) : /*#__PURE__*/ jsx("img", {
|
|
106
106
|
src: previewUrl,
|
|
107
107
|
alt: incomingValue.originalFilename ?? incomingValue.filename,
|
|
108
|
-
className:
|
|
108
|
+
className: clsx('byline-field-image-preview', image_field_module.preview, 'image/svg+xml' === incomingValue.mimeType && [
|
|
109
109
|
'byline-field-image-preview-svg',
|
|
110
110
|
image_field_module["preview-svg"]
|
|
111
111
|
])
|
|
112
112
|
}),
|
|
113
113
|
isPending && /*#__PURE__*/ jsx("div", {
|
|
114
|
-
className:
|
|
114
|
+
className: clsx('byline-field-image-pending', image_field_module.pending),
|
|
115
115
|
children: t('fields.fileMeta.pendingUpload')
|
|
116
116
|
})
|
|
117
117
|
]
|
|
118
118
|
}),
|
|
119
119
|
/*#__PURE__*/ jsxs("div", {
|
|
120
|
-
className:
|
|
120
|
+
className: clsx('byline-field-image-meta', image_field_module.meta),
|
|
121
121
|
children: [
|
|
122
122
|
/*#__PURE__*/ jsxs("div", {
|
|
123
123
|
children: [
|
|
124
124
|
/*#__PURE__*/ jsx("span", {
|
|
125
|
-
className:
|
|
125
|
+
className: clsx('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
126
126
|
children: t('fields.fileMeta.filename')
|
|
127
127
|
}),
|
|
128
128
|
' ',
|
|
@@ -132,7 +132,7 @@ const ImageField = ({ field, value, defaultValue, onChange: _onChange, path })=>
|
|
|
132
132
|
/*#__PURE__*/ jsxs("div", {
|
|
133
133
|
children: [
|
|
134
134
|
/*#__PURE__*/ jsx("span", {
|
|
135
|
-
className:
|
|
135
|
+
className: clsx('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
136
136
|
children: t('fields.fileMeta.original')
|
|
137
137
|
}),
|
|
138
138
|
' ',
|
|
@@ -142,7 +142,7 @@ const ImageField = ({ field, value, defaultValue, onChange: _onChange, path })=>
|
|
|
142
142
|
/*#__PURE__*/ jsxs("div", {
|
|
143
143
|
children: [
|
|
144
144
|
/*#__PURE__*/ jsx("span", {
|
|
145
|
-
className:
|
|
145
|
+
className: clsx('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
146
146
|
children: t('fields.fileMeta.type')
|
|
147
147
|
}),
|
|
148
148
|
' ',
|
|
@@ -152,7 +152,7 @@ const ImageField = ({ field, value, defaultValue, onChange: _onChange, path })=>
|
|
|
152
152
|
/*#__PURE__*/ jsxs("div", {
|
|
153
153
|
children: [
|
|
154
154
|
/*#__PURE__*/ jsx("span", {
|
|
155
|
-
className:
|
|
155
|
+
className: clsx('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
156
156
|
children: t('fields.fileMeta.size')
|
|
157
157
|
}),
|
|
158
158
|
' ',
|
|
@@ -162,12 +162,12 @@ const ImageField = ({ field, value, defaultValue, onChange: _onChange, path })=>
|
|
|
162
162
|
isPending ? /*#__PURE__*/ jsxs("div", {
|
|
163
163
|
children: [
|
|
164
164
|
/*#__PURE__*/ jsx("span", {
|
|
165
|
-
className:
|
|
165
|
+
className: clsx('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
166
166
|
children: t('fields.fileMeta.status')
|
|
167
167
|
}),
|
|
168
168
|
' ',
|
|
169
169
|
/*#__PURE__*/ jsx("span", {
|
|
170
|
-
className:
|
|
170
|
+
className: clsx('byline-field-image-meta-pending', image_field_module["meta-pending"]),
|
|
171
171
|
children: t('fields.fileMeta.willUploadOnSave')
|
|
172
172
|
})
|
|
173
173
|
]
|
|
@@ -176,7 +176,7 @@ const ImageField = ({ field, value, defaultValue, onChange: _onChange, path })=>
|
|
|
176
176
|
/*#__PURE__*/ jsxs("div", {
|
|
177
177
|
children: [
|
|
178
178
|
/*#__PURE__*/ jsx("span", {
|
|
179
|
-
className:
|
|
179
|
+
className: clsx('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
180
180
|
children: t('fields.fileMeta.storage')
|
|
181
181
|
}),
|
|
182
182
|
' ',
|
|
@@ -186,7 +186,7 @@ const ImageField = ({ field, value, defaultValue, onChange: _onChange, path })=>
|
|
|
186
186
|
incomingValue?.imageWidth != null && /*#__PURE__*/ jsxs("div", {
|
|
187
187
|
children: [
|
|
188
188
|
/*#__PURE__*/ jsx("span", {
|
|
189
|
-
className:
|
|
189
|
+
className: clsx('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
190
190
|
children: t('fields.imageMeta.dimensions')
|
|
191
191
|
}),
|
|
192
192
|
' ',
|
|
@@ -197,7 +197,7 @@ const ImageField = ({ field, value, defaultValue, onChange: _onChange, path })=>
|
|
|
197
197
|
incomingValue?.imageFormat != null && /*#__PURE__*/ jsxs("div", {
|
|
198
198
|
children: [
|
|
199
199
|
/*#__PURE__*/ jsx("span", {
|
|
200
|
-
className:
|
|
200
|
+
className: clsx('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
201
201
|
children: t('fields.imageMeta.format')
|
|
202
202
|
}),
|
|
203
203
|
' ',
|
|
@@ -207,7 +207,7 @@ const ImageField = ({ field, value, defaultValue, onChange: _onChange, path })=>
|
|
|
207
207
|
/*#__PURE__*/ jsxs("div", {
|
|
208
208
|
children: [
|
|
209
209
|
/*#__PURE__*/ jsx("span", {
|
|
210
|
-
className:
|
|
210
|
+
className: clsx('byline-field-image-meta-key', image_field_module["meta-key"]),
|
|
211
211
|
children: t('fields.imageMeta.thumbnail')
|
|
212
212
|
}),
|
|
213
213
|
' ',
|
|
@@ -2,7 +2,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { createPendingStoredFileValue } from "@byline/core";
|
|
4
4
|
import { useTranslation } from "@byline/i18n/react";
|
|
5
|
-
import
|
|
5
|
+
import clsx from "clsx";
|
|
6
6
|
import { useFormContext } from "../../forms/form-context.js";
|
|
7
7
|
import image_upload_field_module from "./image-upload-field.module.js";
|
|
8
8
|
const ImageUploadField = ({ field: _field, collectionPath, fieldPath, onUploaded, accept = 'image/*' })=>{
|
|
@@ -88,13 +88,13 @@ const ImageUploadField = ({ field: _field, collectionPath, fieldPath, onUploaded
|
|
|
88
88
|
]);
|
|
89
89
|
const isProcessing = 'processing' === status;
|
|
90
90
|
return /*#__PURE__*/ jsxs("div", {
|
|
91
|
-
className:
|
|
91
|
+
className: clsx('byline-field-image-upload', image_upload_field_module.root),
|
|
92
92
|
children: [
|
|
93
93
|
/*#__PURE__*/ jsx("input", {
|
|
94
94
|
ref: inputRef,
|
|
95
95
|
type: "file",
|
|
96
96
|
accept: accept,
|
|
97
|
-
className:
|
|
97
|
+
className: clsx('byline-field-image-upload-input', image_upload_field_module.input),
|
|
98
98
|
onChange: handleFileChange,
|
|
99
99
|
disabled: isProcessing,
|
|
100
100
|
"aria-hidden": "true",
|
|
@@ -114,7 +114,7 @@ const ImageUploadField = ({ field: _field, collectionPath, fieldPath, onUploaded
|
|
|
114
114
|
handleBrowseClick();
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
|
-
className:
|
|
117
|
+
className: clsx('byline-field-image-upload-zone', image_upload_field_module.zone, isDragOver && !isProcessing && [
|
|
118
118
|
'byline-field-image-upload-zone-active',
|
|
119
119
|
image_upload_field_module["zone-active"]
|
|
120
120
|
], isProcessing && [
|
|
@@ -124,7 +124,7 @@ const ImageUploadField = ({ field: _field, collectionPath, fieldPath, onUploaded
|
|
|
124
124
|
children: isProcessing ? /*#__PURE__*/ jsxs(Fragment, {
|
|
125
125
|
children: [
|
|
126
126
|
/*#__PURE__*/ jsxs("svg", {
|
|
127
|
-
className:
|
|
127
|
+
className: clsx('byline-field-image-upload-spinner', image_upload_field_module.spinner),
|
|
128
128
|
xmlns: "http://www.w3.org/2000/svg",
|
|
129
129
|
fill: "none",
|
|
130
130
|
viewBox: "0 0 24 24",
|
|
@@ -150,7 +150,7 @@ const ImageUploadField = ({ field: _field, collectionPath, fieldPath, onUploaded
|
|
|
150
150
|
]
|
|
151
151
|
}),
|
|
152
152
|
/*#__PURE__*/ jsx("span", {
|
|
153
|
-
className:
|
|
153
|
+
className: clsx('byline-field-image-upload-label', image_upload_field_module.label),
|
|
154
154
|
children: t('fields.image.upload.processing')
|
|
155
155
|
})
|
|
156
156
|
]
|
|
@@ -158,7 +158,7 @@ const ImageUploadField = ({ field: _field, collectionPath, fieldPath, onUploaded
|
|
|
158
158
|
children: [
|
|
159
159
|
/*#__PURE__*/ jsx("svg", {
|
|
160
160
|
xmlns: "http://www.w3.org/2000/svg",
|
|
161
|
-
className:
|
|
161
|
+
className: clsx('byline-field-image-upload-icon', image_upload_field_module.icon),
|
|
162
162
|
fill: "none",
|
|
163
163
|
viewBox: "0 0 24 24",
|
|
164
164
|
stroke: "currentColor",
|
|
@@ -171,25 +171,25 @@ const ImageUploadField = ({ field: _field, collectionPath, fieldPath, onUploaded
|
|
|
171
171
|
})
|
|
172
172
|
}),
|
|
173
173
|
/*#__PURE__*/ jsxs("span", {
|
|
174
|
-
className:
|
|
174
|
+
className: clsx('byline-field-image-upload-label', image_upload_field_module.label),
|
|
175
175
|
children: [
|
|
176
176
|
t('fields.image.upload.label'),
|
|
177
177
|
' ',
|
|
178
178
|
/*#__PURE__*/ jsx("span", {
|
|
179
|
-
className:
|
|
179
|
+
className: clsx('byline-field-image-upload-action', image_upload_field_module.action),
|
|
180
180
|
children: t('fields.image.upload.browse')
|
|
181
181
|
})
|
|
182
182
|
]
|
|
183
183
|
}),
|
|
184
184
|
/*#__PURE__*/ jsx("span", {
|
|
185
|
-
className:
|
|
185
|
+
className: clsx('byline-field-image-upload-hint', image_upload_field_module.hint),
|
|
186
186
|
children: t('fields.image.upload.hint')
|
|
187
187
|
})
|
|
188
188
|
]
|
|
189
189
|
})
|
|
190
190
|
}),
|
|
191
191
|
'error' === status && errorMessage && /*#__PURE__*/ jsx("p", {
|
|
192
|
-
className:
|
|
192
|
+
className: clsx('byline-field-image-upload-error', image_upload_field_module.error),
|
|
193
193
|
role: "alert",
|
|
194
194
|
children: errorMessage
|
|
195
195
|
})
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import clsx from "clsx";
|
|
3
3
|
import locale_badge_module from "./locale-badge.module.js";
|
|
4
4
|
const LocaleBadge = ({ locale })=>/*#__PURE__*/ jsx("span", {
|
|
5
5
|
"aria-hidden": "true",
|
|
6
6
|
title: `Localised — editing ${locale.toUpperCase()} content`,
|
|
7
|
-
className:
|
|
7
|
+
className: clsx('byline-locale-badge', locale_badge_module.badge),
|
|
8
8
|
children: locale
|
|
9
9
|
});
|
|
10
10
|
export { LocaleBadge };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import clsx from "clsx";
|
|
3
3
|
import relation_display_module from "./relation-display.module.js";
|
|
4
4
|
function PickerCell({ column, record }) {
|
|
5
5
|
const name = String(column.fieldName);
|
|
@@ -15,7 +15,7 @@ function PickerCell({ column, record }) {
|
|
|
15
15
|
}
|
|
16
16
|
else content = null == value ? null : 'string' == typeof value || 'number' == typeof value || 'boolean' == typeof value ? String(value) : null;
|
|
17
17
|
return /*#__PURE__*/ jsx("div", {
|
|
18
|
-
className:
|
|
18
|
+
className: clsx('byline-relation-cell', relation_display_module.cell, 'center' === column.align && [
|
|
19
19
|
'byline-relation-cell-center',
|
|
20
20
|
relation_display_module["cell-center"]
|
|
21
21
|
], 'right' === column.align && [
|
|
@@ -3,7 +3,7 @@ import { useState } from "react";
|
|
|
3
3
|
import { getCollectionAdminConfig, getCollectionDefinition } from "@byline/core";
|
|
4
4
|
import { useTranslation } from "@byline/i18n/react";
|
|
5
5
|
import { Button, CloseIcon, EditIcon, ErrorText, HelpText, IconButton, Label } from "@byline/ui/react";
|
|
6
|
-
import
|
|
6
|
+
import clsx from "clsx";
|
|
7
7
|
import { useFieldError, useFieldValue } from "../../forms/form-context.js";
|
|
8
8
|
import relation_field_module from "./relation-field.module.js";
|
|
9
9
|
import { RelationPicker } from "./relation-picker.js";
|
|
@@ -40,7 +40,7 @@ const RelationField = ({ field, value, defaultValue, onChange, id, path })=>{
|
|
|
40
40
|
className: `byline-field-relation ${field.name}`,
|
|
41
41
|
children: [
|
|
42
42
|
/*#__PURE__*/ jsx("div", {
|
|
43
|
-
className:
|
|
43
|
+
className: clsx('byline-field-relation-header', relation_field_module.header),
|
|
44
44
|
children: /*#__PURE__*/ jsx(Label, {
|
|
45
45
|
id: `${htmlId}-label`,
|
|
46
46
|
htmlFor: htmlId,
|
|
@@ -49,7 +49,7 @@ const RelationField = ({ field, value, defaultValue, onChange, id, path })=>{
|
|
|
49
49
|
})
|
|
50
50
|
}),
|
|
51
51
|
isUnknown ? /*#__PURE__*/ jsxs("div", {
|
|
52
|
-
className:
|
|
52
|
+
className: clsx('byline-field-relation-error-tile', relation_field_module["error-tile"]),
|
|
53
53
|
children: [
|
|
54
54
|
/*#__PURE__*/ jsx("span", {
|
|
55
55
|
children: t('fields.relation.unknownError', {
|
|
@@ -58,14 +58,14 @@ const RelationField = ({ field, value, defaultValue, onChange, id, path })=>{
|
|
|
58
58
|
})
|
|
59
59
|
}),
|
|
60
60
|
/*#__PURE__*/ jsx("span", {
|
|
61
|
-
className:
|
|
61
|
+
className: clsx('byline-field-relation-error-text', relation_field_module["error-text"]),
|
|
62
62
|
children: t('fields.relation.unknownHint')
|
|
63
63
|
})
|
|
64
64
|
]
|
|
65
65
|
}) : /*#__PURE__*/ jsx("div", {
|
|
66
|
-
className:
|
|
66
|
+
className: clsx('byline-field-relation-frame', relation_field_module.frame),
|
|
67
67
|
children: incomingValue ? /*#__PURE__*/ jsxs("div", {
|
|
68
|
-
className:
|
|
68
|
+
className: clsx('byline-field-relation-tile', relation_field_module.tile),
|
|
69
69
|
children: [
|
|
70
70
|
/*#__PURE__*/ jsx(RelationSummary, {
|
|
71
71
|
targetDefinition: targetDef,
|
|
@@ -75,7 +75,7 @@ const RelationField = ({ field, value, defaultValue, onChange, id, path })=>{
|
|
|
75
75
|
cachedRecord: cachedRecord
|
|
76
76
|
}),
|
|
77
77
|
/*#__PURE__*/ jsxs("div", {
|
|
78
|
-
className:
|
|
78
|
+
className: clsx('byline-field-relation-actions', relation_field_module.actions),
|
|
79
79
|
children: [
|
|
80
80
|
/*#__PURE__*/ jsx(IconButton, {
|
|
81
81
|
id: htmlId,
|
|
@@ -3,7 +3,7 @@ import { useState } from "react";
|
|
|
3
3
|
import { getCollectionAdminConfig, getCollectionDefinition } from "@byline/core";
|
|
4
4
|
import { useTranslation } from "@byline/i18n/react";
|
|
5
5
|
import { Button, CloseIcon, DraggableSortable, ErrorText, GripperVerticalIcon, HelpText, IconButton, Label, PlusIcon, moveItem, useSortable } from "@byline/ui/react";
|
|
6
|
-
import
|
|
6
|
+
import clsx from "clsx";
|
|
7
7
|
import { useFieldError, useFieldValue, useFormContext } from "../../forms/form-context.js";
|
|
8
8
|
import relation_field_module from "./relation-field.module.js";
|
|
9
9
|
import { RelationPicker } from "./relation-picker.js";
|
|
@@ -24,20 +24,20 @@ const RelationManyTile = ({ id, children, onRemove, removeAriaLabel })=>{
|
|
|
24
24
|
return /*#__PURE__*/ jsxs("div", {
|
|
25
25
|
ref: setNodeRef,
|
|
26
26
|
style: style,
|
|
27
|
-
className:
|
|
27
|
+
className: clsx('byline-field-relation-many-tile', relation_field_module["many-tile"], isDragging && [
|
|
28
28
|
'byline-field-relation-many-tile-dragging',
|
|
29
29
|
relation_field_module["many-tile-dragging"]
|
|
30
30
|
]),
|
|
31
31
|
children: [
|
|
32
32
|
/*#__PURE__*/ jsx("button", {
|
|
33
33
|
type: "button",
|
|
34
|
-
className:
|
|
34
|
+
className: clsx('byline-field-relation-many-grip', relation_field_module["many-grip"]),
|
|
35
35
|
...attributes,
|
|
36
36
|
...listeners,
|
|
37
37
|
children: /*#__PURE__*/ jsx(GripperVerticalIcon, {})
|
|
38
38
|
}),
|
|
39
39
|
/*#__PURE__*/ jsx("div", {
|
|
40
|
-
className:
|
|
40
|
+
className: clsx('byline-field-relation-many-body', relation_field_module["many-body"]),
|
|
41
41
|
children: children
|
|
42
42
|
}),
|
|
43
43
|
/*#__PURE__*/ jsx(IconButton, {
|
|
@@ -45,7 +45,7 @@ const RelationManyTile = ({ id, children, onRemove, removeAriaLabel })=>{
|
|
|
45
45
|
size: "xs",
|
|
46
46
|
intent: "noeffect",
|
|
47
47
|
"aria-label": removeAriaLabel,
|
|
48
|
-
className:
|
|
48
|
+
className: clsx('byline-field-relation-many-remove', relation_field_module["many-remove"]),
|
|
49
49
|
onClick: onRemove,
|
|
50
50
|
children: /*#__PURE__*/ jsx(CloseIcon, {
|
|
51
51
|
width: "14px",
|
|
@@ -107,7 +107,7 @@ const RelationManyField = ({ field, defaultValue, id, path })=>{
|
|
|
107
107
|
className: `byline-field-relation ${field.name}`,
|
|
108
108
|
children: [
|
|
109
109
|
/*#__PURE__*/ jsx("div", {
|
|
110
|
-
className:
|
|
110
|
+
className: clsx('byline-field-relation-header', relation_field_module.header),
|
|
111
111
|
children: /*#__PURE__*/ jsx(Label, {
|
|
112
112
|
id: `${htmlId}-label`,
|
|
113
113
|
htmlFor: htmlId,
|
|
@@ -116,7 +116,7 @@ const RelationManyField = ({ field, defaultValue, id, path })=>{
|
|
|
116
116
|
})
|
|
117
117
|
}),
|
|
118
118
|
isUnknown ? /*#__PURE__*/ jsxs("div", {
|
|
119
|
-
className:
|
|
119
|
+
className: clsx('byline-field-relation-error-tile', relation_field_module["error-tile"]),
|
|
120
120
|
children: [
|
|
121
121
|
/*#__PURE__*/ jsx("span", {
|
|
122
122
|
children: t('fields.relation.unknownError', {
|
|
@@ -125,24 +125,24 @@ const RelationManyField = ({ field, defaultValue, id, path })=>{
|
|
|
125
125
|
})
|
|
126
126
|
}),
|
|
127
127
|
/*#__PURE__*/ jsx("span", {
|
|
128
|
-
className:
|
|
128
|
+
className: clsx('byline-field-relation-error-text', relation_field_module["error-text"]),
|
|
129
129
|
children: t('fields.relation.unknownHint')
|
|
130
130
|
})
|
|
131
131
|
]
|
|
132
132
|
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
133
133
|
children: [
|
|
134
134
|
/*#__PURE__*/ jsxs("div", {
|
|
135
|
-
className:
|
|
135
|
+
className: clsx('byline-field-relation-frame', relation_field_module.frame),
|
|
136
136
|
children: [
|
|
137
137
|
0 === items.length ? /*#__PURE__*/ jsx("p", {
|
|
138
|
-
className:
|
|
138
|
+
className: clsx('byline-field-relation-many-empty', relation_field_module["many-empty"]),
|
|
139
139
|
children: t('fields.relation.manyEmpty', {
|
|
140
140
|
label: targetDef.labels.plural
|
|
141
141
|
})
|
|
142
142
|
}) : /*#__PURE__*/ jsx(DraggableSortable, {
|
|
143
143
|
ids: items.map((v)=>v.targetDocumentId),
|
|
144
144
|
onDragEnd: handleDragEnd,
|
|
145
|
-
className:
|
|
145
|
+
className: clsx('byline-field-relation-many', relation_field_module.many),
|
|
146
146
|
children: items.map((value)=>/*#__PURE__*/ jsx(RelationManyTile, {
|
|
147
147
|
id: value.targetDocumentId,
|
|
148
148
|
onRemove: ()=>handleRemove(value.targetDocumentId),
|
|
@@ -159,7 +159,7 @@ const RelationManyField = ({ field, defaultValue, id, path })=>{
|
|
|
159
159
|
}, value.targetDocumentId))
|
|
160
160
|
}),
|
|
161
161
|
/*#__PURE__*/ jsx("div", {
|
|
162
|
-
className:
|
|
162
|
+
className: clsx('byline-field-relation-many-add', relation_field_module["many-add"]),
|
|
163
163
|
children: /*#__PURE__*/ jsxs(Button, {
|
|
164
164
|
id: htmlId,
|
|
165
165
|
size: "xs",
|
|
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useState } from "react";
|
|
|
3
3
|
import { getCollectionAdminConfig, resolveItemViewColumns } from "@byline/core";
|
|
4
4
|
import { useTranslation } from "@byline/i18n/react";
|
|
5
5
|
import { Button, CheckIcon, LoaderRing, Modal, Search } from "@byline/ui/react";
|
|
6
|
-
import
|
|
6
|
+
import clsx from "clsx";
|
|
7
7
|
import { useBylineFieldServices } from "../field-services-context.js";
|
|
8
8
|
import { PickerCell, resolveFallbackDisplayField, resolveRowLabel, resolveSelectFields } from "./relation-display.js";
|
|
9
9
|
import relation_picker_module from "./relation-picker.module.js";
|
|
@@ -128,15 +128,15 @@ const RelationPicker = ({ targetCollectionPath, targetDefinition, displayField,
|
|
|
128
128
|
},
|
|
129
129
|
children: [
|
|
130
130
|
/*#__PURE__*/ jsx(Modal.Header, {
|
|
131
|
-
className:
|
|
131
|
+
className: clsx('byline-field-relation-picker-header', relation_picker_module.header),
|
|
132
132
|
children: /*#__PURE__*/ jsx("h3", {
|
|
133
|
-
className:
|
|
133
|
+
className: clsx('byline-field-relation-picker-title', relation_picker_module.title),
|
|
134
134
|
children: title
|
|
135
135
|
})
|
|
136
136
|
}),
|
|
137
137
|
/*#__PURE__*/ jsx(Modal.Content, {
|
|
138
138
|
children: /*#__PURE__*/ jsxs("div", {
|
|
139
|
-
className:
|
|
139
|
+
className: clsx('byline-field-relation-picker-body', relation_picker_module.body),
|
|
140
140
|
children: [
|
|
141
141
|
/*#__PURE__*/ jsx(Search, {
|
|
142
142
|
onSearch: (q)=>{
|
|
@@ -151,25 +151,25 @@ const RelationPicker = ({ targetCollectionPath, targetDefinition, displayField,
|
|
|
151
151
|
placeholder: t('fields.relation.picker.searchPlaceholder')
|
|
152
152
|
}),
|
|
153
153
|
/*#__PURE__*/ jsxs("div", {
|
|
154
|
-
className:
|
|
154
|
+
className: clsx('byline-field-relation-picker-list', relation_picker_module.list),
|
|
155
155
|
children: [
|
|
156
156
|
loading && 0 === documents.length && /*#__PURE__*/ jsx("div", {
|
|
157
|
-
className:
|
|
157
|
+
className: clsx('byline-field-relation-picker-loading', relation_picker_module.loading),
|
|
158
158
|
children: /*#__PURE__*/ jsx(LoaderRing, {
|
|
159
159
|
size: 24,
|
|
160
160
|
color: "#888888"
|
|
161
161
|
})
|
|
162
162
|
}),
|
|
163
163
|
!loading && error && /*#__PURE__*/ jsx("div", {
|
|
164
|
-
className:
|
|
164
|
+
className: clsx('byline-field-relation-picker-error', relation_picker_module.error),
|
|
165
165
|
children: error
|
|
166
166
|
}),
|
|
167
167
|
!loading && !error && 0 === documents.length && /*#__PURE__*/ jsx("div", {
|
|
168
|
-
className:
|
|
168
|
+
className: clsx('byline-field-relation-picker-empty', relation_picker_module.empty),
|
|
169
169
|
children: t('fields.relation.picker.empty')
|
|
170
170
|
}),
|
|
171
171
|
documents.length > 0 && /*#__PURE__*/ jsx("ul", {
|
|
172
|
-
className:
|
|
172
|
+
className: clsx('byline-field-relation-picker-rows', relation_picker_module.rows),
|
|
173
173
|
children: documents.map((doc)=>{
|
|
174
174
|
const id = doc.id;
|
|
175
175
|
const selected = multiple ? selectedMap.has(id) : selectedDocumentId === id;
|
|
@@ -180,7 +180,7 @@ const RelationPicker = ({ targetCollectionPath, targetDefinition, displayField,
|
|
|
180
180
|
disabled: excluded,
|
|
181
181
|
"aria-pressed": multiple ? selected : void 0,
|
|
182
182
|
title: excluded ? t('fields.relation.picker.alreadyAdded') : void 0,
|
|
183
|
-
className:
|
|
183
|
+
className: clsx('byline-field-relation-picker-row-button', relation_picker_module["row-button"], multiple && [
|
|
184
184
|
'byline-field-relation-picker-row-multi',
|
|
185
185
|
relation_picker_module["row-multi"]
|
|
186
186
|
], selected && [
|
|
@@ -198,7 +198,7 @@ const RelationPicker = ({ targetCollectionPath, targetDefinition, displayField,
|
|
|
198
198
|
children: [
|
|
199
199
|
multiple && /*#__PURE__*/ jsx("span", {
|
|
200
200
|
"aria-hidden": "true",
|
|
201
|
-
className:
|
|
201
|
+
className: clsx('byline-field-relation-picker-check', relation_picker_module.check, (selected || excluded) && [
|
|
202
202
|
'byline-field-relation-picker-check-checked',
|
|
203
203
|
relation_picker_module["check-checked"]
|
|
204
204
|
]),
|
|
@@ -208,26 +208,26 @@ const RelationPicker = ({ targetCollectionPath, targetDefinition, displayField,
|
|
|
208
208
|
})
|
|
209
209
|
}),
|
|
210
210
|
pickerColumns && pickerColumns.length > 0 ? /*#__PURE__*/ jsx("div", {
|
|
211
|
-
className:
|
|
211
|
+
className: clsx('byline-field-relation-picker-row-cells', relation_picker_module["row-cells"]),
|
|
212
212
|
children: pickerColumns.map((col)=>/*#__PURE__*/ jsx(PickerCell, {
|
|
213
213
|
column: col,
|
|
214
214
|
record: doc
|
|
215
215
|
}, String(col.fieldName)))
|
|
216
216
|
}) : /*#__PURE__*/ jsxs("div", {
|
|
217
|
-
className:
|
|
217
|
+
className: clsx('byline-field-relation-picker-row-stack', relation_picker_module["row-stack"]),
|
|
218
218
|
children: [
|
|
219
219
|
/*#__PURE__*/ jsx("span", {
|
|
220
|
-
className:
|
|
220
|
+
className: clsx('byline-field-relation-picker-row-label', relation_picker_module["row-label"]),
|
|
221
221
|
children: resolveRowLabel(doc, resolvedDisplayField) || id
|
|
222
222
|
}),
|
|
223
223
|
'string' == typeof doc.path && doc.path.length > 0 && /*#__PURE__*/ jsx("span", {
|
|
224
|
-
className:
|
|
224
|
+
className: clsx('byline-field-relation-picker-row-path', relation_picker_module["row-path"]),
|
|
225
225
|
children: doc.path
|
|
226
226
|
})
|
|
227
227
|
]
|
|
228
228
|
}),
|
|
229
229
|
excluded && /*#__PURE__*/ jsx("span", {
|
|
230
|
-
className:
|
|
230
|
+
className: clsx('byline-field-relation-picker-added-hint', relation_picker_module["added-hint"]),
|
|
231
231
|
children: t('fields.relation.picker.alreadyAdded')
|
|
232
232
|
})
|
|
233
233
|
]
|
|
@@ -238,7 +238,7 @@ const RelationPicker = ({ targetCollectionPath, targetDefinition, displayField,
|
|
|
238
238
|
]
|
|
239
239
|
}),
|
|
240
240
|
totalPages > 1 && /*#__PURE__*/ jsxs("div", {
|
|
241
|
-
className:
|
|
241
|
+
className: clsx('byline-field-relation-picker-pager', relation_picker_module.pager),
|
|
242
242
|
children: [
|
|
243
243
|
/*#__PURE__*/ jsx(Button, {
|
|
244
244
|
size: "xs",
|
|
@@ -276,12 +276,12 @@ const RelationPicker = ({ targetCollectionPath, targetDefinition, displayField,
|
|
|
276
276
|
intent: "noeffect",
|
|
277
277
|
type: "button",
|
|
278
278
|
onClick: onDismiss,
|
|
279
|
-
className:
|
|
279
|
+
className: clsx('byline-field-relation-picker-action', relation_picker_module.action),
|
|
280
280
|
children: t('common.actions.cancel')
|
|
281
281
|
}),
|
|
282
282
|
/*#__PURE__*/ jsx(Button, {
|
|
283
283
|
size: "sm",
|
|
284
|
-
className:
|
|
284
|
+
className: clsx('byline-field-relation-picker-action', relation_picker_module.action),
|
|
285
285
|
intent: "primary",
|
|
286
286
|
type: "button",
|
|
287
287
|
disabled: multiple ? 0 === selectedMap.size : !selectedDocumentId,
|