@globalbrain/sefirot 4.46.0 → 4.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/blocks/lens/FieldData.ts +27 -0
- package/lib/blocks/lens/ResourceFetcher.ts +5 -1
- package/lib/blocks/lens/Rule.ts +10 -0
- package/lib/blocks/lens/components/LensCatalog.vue +826 -39
- package/lib/blocks/lens/components/LensSheet.vue +465 -0
- package/lib/blocks/lens/components/LensSheetField.vue +210 -0
- package/lib/blocks/lens/components/LensTable.vue +79 -5
- package/lib/blocks/lens/components/LensTableEditableCell.vue +285 -0
- package/lib/blocks/lens/composables/CatalogUrlQuerySync.ts +146 -0
- package/lib/blocks/lens/composables/LensEdit.ts +59 -0
- package/lib/blocks/lens/composables/LensInlineEdit.ts +36 -0
- package/lib/blocks/lens/composables/ResourceFetcher.ts +20 -7
- package/lib/blocks/lens/composables/SetupLens.ts +2 -0
- package/lib/blocks/lens/fields/AvatarField.ts +43 -0
- package/lib/blocks/lens/fields/ContentField.ts +21 -10
- package/lib/blocks/lens/fields/Field.ts +26 -1
- package/lib/blocks/lens/fields/FileUploadField.ts +8 -0
- package/lib/blocks/lens/fields/RelatedManyField.ts +44 -7
- package/lib/blocks/lens/fields/RelatedOneField.ts +42 -7
- package/lib/blocks/lens/validation/RuleMapper.ts +22 -3
- package/lib/blocks/lens/validation/ServerErrors.ts +25 -0
- package/lib/components/SInputSwitches.vue +2 -2
- package/lib/components/SSheet.vue +104 -0
- package/lib/composables/Api.ts +18 -10
- package/lib/composables/Url.ts +19 -2
- package/lib/styles/variables.css +1 -0
- package/lib/validation/rules/index.ts +1 -0
- package/lib/validation/rules/slackChannelLink.ts +15 -0
- package/lib/validation/validators/index.ts +1 -0
- package/lib/validation/validators/slackChannelLink.ts +52 -0
- package/package.json +17 -17
|
@@ -17,6 +17,7 @@ import { type Rule } from './Rule'
|
|
|
17
17
|
* }
|
|
18
18
|
*/
|
|
19
19
|
export interface FieldDataRegistry {
|
|
20
|
+
avatar: AvatarFieldData
|
|
20
21
|
boolean: BooleanFieldData
|
|
21
22
|
content: ContentFieldData
|
|
22
23
|
date: DateFieldData
|
|
@@ -48,6 +49,30 @@ export interface FieldDataBase {
|
|
|
48
49
|
width: number
|
|
49
50
|
required: boolean
|
|
50
51
|
rules: Rule[]
|
|
52
|
+
/**
|
|
53
|
+
* Per-context visibility, mirroring the backend field definition. The
|
|
54
|
+
* catalog renders `showOnIndex` columns; the record sheet shows
|
|
55
|
+
* `showOnDetail` rows; the create form shows `showOnCreate` fields; and
|
|
56
|
+
* `showOnUpdate` marks a field editable (inline in the table and in the
|
|
57
|
+
* sheet) for an existing record. Optional so read-only catalogs whose
|
|
58
|
+
* backend predates these flags keep working (treated as index+detail only).
|
|
59
|
+
*/
|
|
60
|
+
showOnIndex?: boolean
|
|
61
|
+
showOnDetail?: boolean
|
|
62
|
+
showOnCreate?: boolean
|
|
63
|
+
showOnUpdate?: boolean
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface AvatarFieldData extends FieldDataBase {
|
|
67
|
+
type: 'avatar'
|
|
68
|
+
/**
|
|
69
|
+
* Optional keys on the record that hold the display name, per language. The
|
|
70
|
+
* avatar uses the name (resolved against the active language) for the
|
|
71
|
+
* initials fallback / tooltip when the image is unavailable. The field
|
|
72
|
+
* value itself is the image URL.
|
|
73
|
+
*/
|
|
74
|
+
nameEn?: string | null
|
|
75
|
+
nameJa?: string | null
|
|
51
76
|
}
|
|
52
77
|
|
|
53
78
|
export interface BooleanFieldData extends FieldDataBase {
|
|
@@ -144,6 +169,7 @@ export interface RelatedManyFieldData extends FieldDataBase {
|
|
|
144
169
|
image?: string | null
|
|
145
170
|
resourceEndpointMethod: 'get' | 'post'
|
|
146
171
|
resourceEndpointPath: string
|
|
172
|
+
resourceEndpointBody?: Record<string, any> | null
|
|
147
173
|
resourceEndpointDataKey: string | null
|
|
148
174
|
resourceTitle: string
|
|
149
175
|
resourceImage?: string | null
|
|
@@ -156,6 +182,7 @@ export interface RelatedOneFieldData extends FieldDataBase {
|
|
|
156
182
|
image?: string | null
|
|
157
183
|
resourceEndpointMethod: 'get' | 'post'
|
|
158
184
|
resourceEndpointPath: string
|
|
185
|
+
resourceEndpointBody?: Record<string, any> | null
|
|
159
186
|
resourceEndpointDataKey: string | null
|
|
160
187
|
resourceTitle: string
|
|
161
188
|
resourceImage?: string | null
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
export type ResourceFetcher = (
|
|
1
|
+
export type ResourceFetcher = (
|
|
2
|
+
method: ResourceFetchMethod,
|
|
3
|
+
url: string,
|
|
4
|
+
body?: Record<string, any> | null
|
|
5
|
+
) => Promise<any>
|
|
2
6
|
|
|
3
7
|
export type ResourceFetchMethod = 'get' | 'post'
|
package/lib/blocks/lens/Rule.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export type Rule =
|
|
2
2
|
| MaxLengthRule
|
|
3
3
|
| RequiredRule
|
|
4
|
+
| UniqueRule
|
|
5
|
+
| SlackChannelLinkRule
|
|
4
6
|
| SlackChannelNameRule
|
|
5
7
|
| BeforeRule
|
|
6
8
|
| BeforeOrEqualRule
|
|
@@ -16,6 +18,14 @@ export interface RequiredRule {
|
|
|
16
18
|
type: 'required'
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
export interface UniqueRule {
|
|
22
|
+
type: 'unique'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface SlackChannelLinkRule {
|
|
26
|
+
type: 'slack_channel_link'
|
|
27
|
+
}
|
|
28
|
+
|
|
19
29
|
export interface SlackChannelNameRule {
|
|
20
30
|
type: 'slack_channel_name'
|
|
21
31
|
offset: number
|