@raclettejs/core 0.1.36 → 0.1.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raclettejs/core",
3
- "version": "0.1.36",
3
+ "version": "0.1.37",
4
4
  "description": "racletteJS core package",
5
5
  "repository": "https://gitlab.com/raclettejs/core",
6
6
  "author": "Pacifico Digital Explorations GmbH <info@raclettejs.com>",
@@ -83,7 +83,7 @@
83
83
  "@emnapi/core": "1.9.2",
84
84
  "@emnapi/runtime": "1.9.2",
85
85
  "@eslint/js": "9.35.0",
86
- "@raclettejs/types": "0.1.36",
86
+ "@raclettejs/types": "0.1.37",
87
87
  "@types/fs-extra": "11.0.4",
88
88
  "@types/js-yaml": "4.0.9",
89
89
  "@types/node": "25.5.0",
@@ -66,10 +66,16 @@ export const compositionSchema = Type.Object(
66
66
  /**
67
67
  * Composition Create Schema - For POST operations
68
68
  */
69
- export const compositionCreateSchema = Type.Object(baseCompositionSchema, {
70
- $id: "#composition/create",
71
- title: "core/composition-create",
72
- })
69
+ export const compositionCreateSchema = Type.Object(
70
+ {
71
+ _id: Type.Optional(Type.String({ format: "uuid" })),
72
+ ...baseCompositionSchema,
73
+ },
74
+ {
75
+ $id: "#composition/create",
76
+ title: "core/composition-create",
77
+ },
78
+ )
73
79
 
74
80
  /**
75
81
  * Composition Update Schema - For PATCH operations
@@ -53,7 +53,10 @@ export const interactionLinkSchema = Type.Object(
53
53
  * InteractionLink Create Schema - For POST operations
54
54
  */
55
55
  export const interactionLinkCreateSchema = Type.Object(
56
- baseInteractionLinkSchema,
56
+ {
57
+ _id: Type.Optional(Type.String({ format: "uuid" })),
58
+ ...baseInteractionLinkSchema,
59
+ },
57
60
  {
58
61
  $id: "#interactionLink/create",
59
62
  title: "core/interactionLink-create",
@@ -20,6 +20,10 @@ export const CompositionCreateSchema = {
20
20
  "widgetsLayout",
21
21
  ],
22
22
  properties: {
23
+ _id: {
24
+ format: "uuid",
25
+ type: "string",
26
+ },
23
27
  title: {
24
28
  minLength: 1,
25
29
  maxLength: 200,
@@ -19,6 +19,10 @@ export const InteractionLinkCreateSchema = {
19
19
  "tags",
20
20
  ],
21
21
  properties: {
22
+ _id: {
23
+ format: "uuid",
24
+ type: "string",
25
+ },
22
26
  composition: {
23
27
  type: "string",
24
28
  },
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  export type CompositionCreate = {
10
+ _id?: string
10
11
  title: string
11
12
  description?: string
12
13
  tags: string[]
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  export type InteractionLinkCreate = {
10
+ _id?: string
10
11
  composition: string
11
12
  slotType: string
12
13
  triggers: {
@@ -142,6 +142,7 @@
142
142
  :disabled="!selected.length"
143
143
  :formats="exportFormats"
144
144
  :default-format="exportDefaultFormat"
145
+ :show-data-scope-switch="exportShowDataScopeSwitch"
145
146
  :button-label="$t('core.export')"
146
147
  />
147
148
  </slot>
@@ -364,6 +365,13 @@ export interface BaseDataTableProps<T> {
364
365
  */
365
366
  exportableItems?: Record<string, unknown>[]
366
367
  exportMeta?: Record<string, unknown>
368
+ /**
369
+ * `visible-columns` (default): export only keys present in `headers`.
370
+ * `full-records`: export matched rows as-is (for round-trip import of canonical records).
371
+ */
372
+ exportRowShape?: "visible-columns" | "full-records"
373
+ /** When false, hides the DataExporter items/meta/combined scope toggle. */
374
+ exportShowDataScopeSwitch?: boolean
367
375
 
368
376
  /** Formats offered in the export menu (workbench list tables default to JSON only). */
369
377
  exportFormats?: FormatEntry[]
@@ -406,6 +414,8 @@ const props = withDefaults(defineProps<BaseDataTableProps<T>>(), {
406
414
  actionsHeaderTitle: "",
407
415
  exportableItems: undefined,
408
416
  exportMeta: undefined,
417
+ exportRowShape: "visible-columns",
418
+ exportShowDataScopeSwitch: true,
409
419
  exportFormats: () => ["json"] as FormatEntry[],
410
420
  exportDefaultFormat: "json",
411
421
  onFileLoaded: undefined,
@@ -676,6 +686,11 @@ const projectRowsToVisibleColumns = <TRow extends Record<string, unknown>>(
676
686
  })
677
687
  }
678
688
 
689
+ const shapeExportRows = <TRow extends Record<string, unknown>>(rows: TRow[]) =>
690
+ props.exportRowShape === "full-records"
691
+ ? rows
692
+ : projectRowsToVisibleColumns(rows)
693
+
679
694
  /** Rows passed to DataExporter when something is selected. */
680
695
  const exportPayloadData = computed<ExportPayload>(() => {
681
696
  const idKey = props.itemValue as keyof T
@@ -709,7 +724,7 @@ const exportPayloadData = computed<ExportPayload>(() => {
709
724
  .filter((row): row is Record<string, unknown> => row !== undefined)
710
725
 
711
726
  return {
712
- items: projectRowsToVisibleColumns(selectedExportRows),
727
+ items: shapeExportRows(selectedExportRows),
713
728
  ...(props.exportMeta ? { meta: props.exportMeta } : {}),
714
729
  }
715
730
  }
@@ -728,7 +743,7 @@ const exportPayloadData = computed<ExportPayload>(() => {
728
743
  }) as Record<string, unknown>[]
729
744
 
730
745
  return {
731
- items: projectRowsToVisibleColumns(selectedRows),
746
+ items: shapeExportRows(selectedRows),
732
747
  ...(props.exportMeta ? { meta: props.exportMeta } : {}),
733
748
  }
734
749
  })
@@ -816,8 +831,14 @@ const notifyFilterStateChange = () => {
816
831
  }
817
832
  }
818
833
 
834
+ /** Selection is tied to visible rows; clear when applied filters change. */
835
+ const clearExportSelection = () => {
836
+ selected.value = []
837
+ }
838
+
819
839
  const applyFilters = () => {
820
840
  appliedColumnFilters.value = { ...columnFilters.value }
841
+ clearExportSelection()
821
842
  if (props.onFilterApply) {
822
843
  props.onFilterApply(appliedFilterPayload.value, actionContext())
823
844
  } else {
@@ -828,6 +849,7 @@ const applyFilters = () => {
828
849
  const resetFilters = () => {
829
850
  columnFilters.value = {}
830
851
  appliedColumnFilters.value = {}
852
+ clearExportSelection()
831
853
  if (props.onFilterReset) {
832
854
  props.onFilterReset({}, actionContext())
833
855
  } else {
@@ -876,6 +898,7 @@ const exporterSlotProps = computed(() => ({
876
898
  disabled: !selected.value.length,
877
899
  formats: props.exportFormats,
878
900
  defaultFormat: props.exportDefaultFormat,
901
+ showDataScopeSwitch: props.exportShowDataScopeSwitch,
879
902
  isExportMode: isExportMode.value,
880
903
  selectedCount: selected.value.length,
881
904
  }))
@@ -87,10 +87,22 @@ export const useVueWriteOperationHelper = (
87
87
  return data.value ? Object.values(data.value) : []
88
88
  }),
89
89
  response: responseRef,
90
- execute: (executeParams?: VueQueryParamsInput) =>
91
- executeParams === undefined
92
- ? writeOperation.execute()
93
- : writeOperation.execute(toQueryParamsSource(executeParams)),
90
+ execute: (executeParams?: VueQueryParamsInput) => {
91
+ if (executeParams === undefined) {
92
+ return writeOperation.execute()
93
+ }
94
+ // Bulk POST bodies (e.g. createBulk) must reach core dataApi as arrays.
95
+ if (Array.isArray(executeParams)) {
96
+ return writeOperation.execute(executeParams)
97
+ }
98
+ if (
99
+ typeof FormData !== "undefined" &&
100
+ executeParams instanceof FormData
101
+ ) {
102
+ return writeOperation.execute(executeParams)
103
+ }
104
+ return writeOperation.execute(toQueryParamsSource(executeParams))
105
+ },
94
106
  remove: writeOperation.remove,
95
107
  clear: writeOperation.clear,
96
108
  error: computed(() => {
@@ -4,10 +4,11 @@ import type {
4
4
  CustomStoreActionsPayload,
5
5
  } from "@racletteCore/types"
6
6
 
7
- /** Params accepted by Vue plugin `$data` methods (refs/computed/getters allowed). */
7
+ /** Params accepted by Vue plugin `$data` write `execute()` (refs/computed/getters, or bulk body arrays). */
8
8
  export type VueQueryParamsInput =
9
9
  | MaybeRefOrGetter<CustomStoreActionParams | undefined>
10
10
  | CustomStoreActionParams
11
+ | unknown[]
11
12
  | undefined
12
13
 
13
14
  /** Vue orchestrator payload — extends core with reactive `params`. */