@solidxai/core-ui 0.1.4-beta.0 → 0.1.4-beta.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/components/core/common/SolidAccountSettings/SolidAccountSettings.d.ts.map +1 -1
- package/dist/components/core/common/SolidAccountSettings/SolidAccountSettings.js +8 -0
- package/dist/components/core/common/SolidAccountSettings/SolidAccountSettings.js.map +1 -1
- package/dist/components/core/common/SolidAccountSettings/SolidAccountSettings.tsx +8 -0
- package/dist/components/core/common/SolidAccountSettings/SolidVersionInfo.d.ts +2 -0
- package/dist/components/core/common/SolidAccountSettings/SolidVersionInfo.d.ts.map +1 -0
- package/dist/components/core/common/SolidAccountSettings/SolidVersionInfo.js +34 -0
- package/dist/components/core/common/SolidAccountSettings/SolidVersionInfo.js.map +1 -0
- package/dist/components/core/common/SolidAccountSettings/SolidVersionInfo.tsx +83 -0
- package/dist/components/core/common/SolidGlobalSearchElement.d.ts.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.js +6 -8
- package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.tsx +21 -21
- package/dist/components/core/dashboard/SolidDashboard.d.ts +1 -1
- package/dist/components/core/dashboard/SolidDashboard.d.ts.map +1 -1
- package/dist/components/core/dashboard/SolidDashboard.js.map +1 -1
- package/dist/components/core/dashboard/SolidDashboard.tsx +1 -1
- package/dist/components/core/dashboard/SolidDashboardVariable.js +1 -1
- package/dist/components/core/dashboard/SolidDashboardVariable.js.map +1 -1
- package/dist/components/core/dashboard/SolidDashboardVariable.tsx +1 -1
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.d.ts.map +1 -1
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.js +15 -30
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.js.map +1 -1
- package/dist/components/core/extension/solid-core/roleMetadata/RolePermissionsManyToManyFieldWidget.tsx +46 -36
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts +40 -0
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +315 -160
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +459 -249
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js +46 -95
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.tsx +57 -113
- package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.d.ts +15 -5
- package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.js +203 -67
- package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.js.map +1 -1
- package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.ts +147 -67
- package/dist/components/core/kanban/SolidKanbanView.d.ts.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.js +8 -7
- package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.tsx +3 -2
- package/dist/components/core/list/SolidListView.d.ts +8 -5
- package/dist/components/core/list/SolidListView.d.ts.map +1 -1
- package/dist/components/core/list/SolidListView.js +95 -84
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/components/core/list/SolidListView.tsx +55 -62
- package/dist/components/core/list/SolidListViewConfigure.d.ts +7 -0
- package/dist/components/core/list/SolidListViewConfigure.d.ts.map +1 -1
- package/dist/components/core/list/SolidListViewConfigure.js +6 -5
- package/dist/components/core/list/SolidListViewConfigure.js.map +1 -1
- package/dist/components/core/list/SolidListViewConfigure.tsx +21 -12
- package/dist/components/core/list/columns/SolidBooleanColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidBooleanColumn.js +1 -24
- package/dist/components/core/list/columns/SolidBooleanColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidBooleanColumn.tsx +1 -35
- package/dist/components/core/list/columns/SolidDateColumn.d.ts +0 -5
- package/dist/components/core/list/columns/SolidDateColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidDateColumn.js +1 -31
- package/dist/components/core/list/columns/SolidDateColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidDateColumn.tsx +2 -49
- package/dist/components/core/list/columns/SolidDatetimeColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidDatetimeColumn.js +1 -20
- package/dist/components/core/list/columns/SolidDatetimeColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidDatetimeColumn.tsx +2 -37
- package/dist/components/core/list/columns/SolidExternalIdColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidExternalIdColumn.js +1 -21
- package/dist/components/core/list/columns/SolidExternalIdColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidExternalIdColumn.tsx +1 -38
- package/dist/components/core/list/columns/SolidIdColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidIdColumn.js +1 -21
- package/dist/components/core/list/columns/SolidIdColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidIdColumn.tsx +1 -36
- package/dist/components/core/list/columns/SolidIntColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidIntColumn.js +1 -30
- package/dist/components/core/list/columns/SolidIntColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidIntColumn.tsx +2 -46
- package/dist/components/core/list/columns/SolidMediaMultipleColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidMediaMultipleColumn.js +1 -5
- package/dist/components/core/list/columns/SolidMediaMultipleColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidMediaMultipleColumn.tsx +0 -7
- package/dist/components/core/list/columns/SolidMediaSingleColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidMediaSingleColumn.js +1 -1
- package/dist/components/core/list/columns/SolidMediaSingleColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidMediaSingleColumn.tsx +0 -1
- package/dist/components/core/list/columns/SolidSelectionDynamicColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidSelectionDynamicColumn.js +1 -21
- package/dist/components/core/list/columns/SolidSelectionDynamicColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidSelectionDynamicColumn.tsx +1 -37
- package/dist/components/core/list/columns/SolidSelectionStaticColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidSelectionStaticColumn.js +1 -21
- package/dist/components/core/list/columns/SolidSelectionStaticColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidSelectionStaticColumn.tsx +1 -38
- package/dist/components/core/list/columns/SolidShortTextColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidShortTextColumn.js +2 -66
- package/dist/components/core/list/columns/SolidShortTextColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidShortTextColumn.tsx +3 -86
- package/dist/components/core/list/columns/SolidTimeColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidTimeColumn.js +1 -20
- package/dist/components/core/list/columns/SolidTimeColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidTimeColumn.tsx +2 -37
- package/dist/components/core/list/columns/SolidUuidColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidUuidColumn.js +1 -21
- package/dist/components/core/list/columns/SolidUuidColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidUuidColumn.tsx +1 -37
- package/dist/components/core/list/columns/relations/SolidRelationManyToManyColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/relations/SolidRelationManyToManyColumn.js +1 -17
- package/dist/components/core/list/columns/relations/SolidRelationManyToManyColumn.js.map +1 -1
- package/dist/components/core/list/columns/relations/SolidRelationManyToManyColumn.tsx +2 -35
- package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.js +10 -20
- package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.js.map +1 -1
- package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.tsx +15 -36
- package/dist/components/core/list/columns/relations/SolidRelationOneToManyColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/relations/SolidRelationOneToManyColumn.js +1 -15
- package/dist/components/core/list/columns/relations/SolidRelationOneToManyColumn.js.map +1 -1
- package/dist/components/core/list/columns/relations/SolidRelationOneToManyColumn.tsx +1 -31
- package/dist/components/core/tree/SolidTreeView.d.ts.map +1 -1
- package/dist/components/core/tree/SolidTreeView.js +23 -14
- package/dist/components/core/tree/SolidTreeView.js.map +1 -1
- package/dist/components/core/tree/SolidTreeView.tsx +50 -16
- package/dist/helpers/registry.js +3 -1
- package/dist/helpers/registry.js.map +1 -1
- package/dist/helpers/registry.ts +4 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/index.ts +5 -2
- package/dist/redux/api/fetchBaseQuery.js +4 -5
- package/dist/redux/api/fetchBaseQuery.js.map +1 -1
- package/dist/redux/api/fetchBaseQuery.tsx +4 -4
- package/dist/redux/api/solidSettingsApi.d.ts +2 -1
- package/dist/redux/api/solidSettingsApi.d.ts.map +1 -1
- package/dist/redux/api/solidSettingsApi.js +4 -1
- package/dist/redux/api/solidSettingsApi.js.map +1 -1
- package/dist/redux/api/solidSettingsApi.tsx +6 -1
- package/dist/redux/store/defaultStoreConfig.d.ts +1 -0
- package/dist/redux/store/defaultStoreConfig.d.ts.map +1 -1
- package/dist/resources/globals.css +14 -0
- package/dist/routes/pages/admin/core/DashboardPage.d.ts +2 -0
- package/dist/routes/pages/admin/core/DashboardPage.d.ts.map +1 -0
- package/dist/routes/pages/admin/core/DashboardPage.js +14 -0
- package/dist/routes/pages/admin/core/DashboardPage.js.map +1 -0
- package/dist/routes/pages/admin/core/DashboardPage.tsx +17 -0
- package/dist/routes/pages/admin/core/ListPage.js +1 -1
- package/dist/routes/pages/admin/core/ListPage.js.map +1 -1
- package/dist/routes/pages/admin/core/ListPage.tsx +1 -1
- package/dist/routes/pages/admin/core/ModuleHomePage.d.ts.map +1 -1
- package/dist/routes/pages/admin/core/ModuleHomePage.js +4 -15
- package/dist/routes/pages/admin/core/ModuleHomePage.js.map +1 -1
- package/dist/routes/pages/admin/core/ModuleHomePage.tsx +4 -3
- package/dist/routes/solidRoutes.d.ts.map +1 -1
- package/dist/routes/solidRoutes.js +2 -0
- package/dist/routes/solidRoutes.js.map +1 -1
- package/dist/routes/solidRoutes.tsx +2 -0
- package/dist/routes/types.d.ts +1 -1
- package/dist/routes/types.d.ts.map +1 -1
- package/dist/routes/types.js.map +1 -1
- package/dist/routes/types.ts +1 -0
- package/dist/types/solid-core.d.ts +1 -1
- package/package.json +1 -1
package/dist/components/core/form/fields/relations/widgets/helpers/useRelationEntityHandler.ts
CHANGED
|
@@ -2,7 +2,13 @@ import { useState } from "react";
|
|
|
2
2
|
import qs from "qs";
|
|
3
3
|
import { createSolidEntityApi } from "../../../../../../../redux/api/solidEntityApi";
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export type RelationItem = {
|
|
6
|
+
label: string;
|
|
7
|
+
value: any;
|
|
8
|
+
original?: any;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const useRelationEntityHandler = ({ fieldContext, autoCompleteLimit = 1000 }: any) => {
|
|
6
12
|
const fieldMetadata = fieldContext.fieldMetadata;
|
|
7
13
|
const fieldLayoutInfo = fieldContext.field;
|
|
8
14
|
|
|
@@ -10,44 +16,55 @@ export const useRelationEntityHandler = ({ fieldContext, formik, autoCompleteLim
|
|
|
10
16
|
const { useLazyGetSolidEntitiesQuery } = entityApi;
|
|
11
17
|
const [triggerGetSolidEntities] = useLazyGetSolidEntitiesQuery();
|
|
12
18
|
|
|
13
|
-
const
|
|
19
|
+
const parentEntityApi = createSolidEntityApi(fieldContext.modelName);
|
|
20
|
+
const { usePatchUpdateSolidEntityMutation, useUpdateSolidEntityMutation } = parentEntityApi;
|
|
21
|
+
const [updateSolidEntity] = usePatchUpdateSolidEntityMutation();
|
|
14
22
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// '$containsi': query
|
|
22
|
-
// }
|
|
23
|
-
// }
|
|
24
|
-
// };
|
|
23
|
+
/**
|
|
24
|
+
* AUTOCOMPLETE & CHECKBOX:
|
|
25
|
+
* The currently linked items — drives what chips are shown in the autocomplete
|
|
26
|
+
* and which checkboxes are checked.
|
|
27
|
+
*/
|
|
28
|
+
const [currentValues, setCurrentValues] = useState<RelationItem[]>([]);
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
/**
|
|
31
|
+
* CHECKBOX ONLY:
|
|
32
|
+
* All possible options to render as checkboxes.
|
|
33
|
+
* For autocomplete this is not needed — options are fetched on user search input.
|
|
34
|
+
*/
|
|
35
|
+
const [allOptions, setAllOptions] = useState<RelationItem[]>([]);
|
|
27
36
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
/**
|
|
38
|
+
* AUTOCOMPLETE ONLY:
|
|
39
|
+
* The live suggestion list shown in the dropdown while the user is typing.
|
|
40
|
+
* Populated by `fetchSuggestions` on each keystroke.
|
|
41
|
+
*/
|
|
42
|
+
const [suggestions, setSuggestions] = useState<RelationItem[]>([]);
|
|
43
|
+
|
|
44
|
+
// ─── Internal ────────────────────────────────────────────────────────────────
|
|
45
|
+
|
|
46
|
+
const sendLinkCommand = async (item: RelationItem, command: "link" | "unlink") => {
|
|
47
|
+
const parentId = fieldContext.data?.id;
|
|
48
|
+
const fieldName = fieldLayoutInfo.attrs.name;
|
|
49
|
+
|
|
50
|
+
if (!parentId || parentId === "new") return;
|
|
51
|
+
|
|
52
|
+
const formData = new FormData();
|
|
53
|
+
formData.append(`${fieldName}Ids[0]`, item.value);
|
|
54
|
+
formData.append(`${fieldName}Command`, command);
|
|
40
55
|
|
|
41
|
-
|
|
56
|
+
await updateSolidEntity({ id: parentId, data: formData }).unwrap();
|
|
57
|
+
};
|
|
42
58
|
|
|
43
|
-
|
|
44
|
-
* Example:
|
|
45
|
-
* permissions filtered by roles.id = current role id
|
|
46
|
-
*/
|
|
59
|
+
// ─── Shared ──────────────────────────────────────────────────────────────────
|
|
47
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Fetch currently linked items and populate `currentValues`.
|
|
63
|
+
* Call on mount for both autocomplete and checkbox widgets.
|
|
64
|
+
*/
|
|
65
|
+
const fetchCurrentValues = async () => {
|
|
48
66
|
const relationFieldName =
|
|
49
|
-
fieldContext.fieldMetadata?.relationCoModelFieldName ??
|
|
50
|
-
fieldContext.modelName;
|
|
67
|
+
fieldContext.fieldMetadata?.relationCoModelFieldName ?? fieldContext.modelName;
|
|
51
68
|
|
|
52
69
|
const parentId = fieldContext.data?.id ?? -1;
|
|
53
70
|
|
|
@@ -55,61 +72,124 @@ export const useRelationEntityHandler = ({ fieldContext, formik, autoCompleteLim
|
|
|
55
72
|
offset: 0,
|
|
56
73
|
limit: autoCompleteLimit,
|
|
57
74
|
filters: {
|
|
58
|
-
$and: [
|
|
59
|
-
{
|
|
60
|
-
[relationFieldName]: {
|
|
61
|
-
id: { $eq: parentId },
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
],
|
|
75
|
+
$and: [{ [relationFieldName]: { id: { $eq: parentId } } }],
|
|
65
76
|
},
|
|
66
77
|
};
|
|
67
78
|
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
79
|
+
const response = await triggerGetSolidEntities(qs.stringify(queryData, { encodeValuesOnly: true }));
|
|
80
|
+
if (!response.data) return;
|
|
81
|
+
|
|
82
|
+
const mapped: RelationItem[] = response.data.records.map((item: any) => ({
|
|
83
|
+
label: item[fieldMetadata?.relationModel?.userKeyField?.name],
|
|
84
|
+
value: item.id,
|
|
85
|
+
original: item,
|
|
86
|
+
}));
|
|
87
|
+
|
|
88
|
+
setCurrentValues(mapped);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Link an item: fire the API call, and on success update `currentValues`.
|
|
93
|
+
* Used by both autocomplete (onSelect) and checkbox (onChange when unchecked).
|
|
94
|
+
*/
|
|
95
|
+
const linkItem = async (item: RelationItem) => {
|
|
96
|
+
try {
|
|
97
|
+
await sendLinkCommand(item, "link");
|
|
98
|
+
setCurrentValues((prev) =>
|
|
99
|
+
prev.some((s) => s.value === item.value) ? prev : [...prev, item]
|
|
100
|
+
);
|
|
101
|
+
} catch (error: any) {
|
|
102
|
+
console.error(error?.data?.message || error?.message || `Failed to link ${fieldMetadata.displayName}`);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
71
105
|
|
|
72
|
-
|
|
73
|
-
|
|
106
|
+
/**
|
|
107
|
+
* Unlink an item: fire the API call, and on success update `currentValues`.
|
|
108
|
+
* Used by both autocomplete (onUnselect) and checkbox (onChange when checked).
|
|
109
|
+
*/
|
|
110
|
+
const unlinkItem = async (item: RelationItem) => {
|
|
111
|
+
try {
|
|
112
|
+
await sendLinkCommand(item, "unlink");
|
|
113
|
+
setCurrentValues((prev) => prev.filter((s) => s.value !== item.value));
|
|
114
|
+
} catch (error: any) {
|
|
115
|
+
console.error(error?.data?.message || error?.message || `Failed to unlink ${fieldMetadata.displayName}`);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
74
118
|
|
|
75
|
-
|
|
119
|
+
// ─── Autocomplete-specific ───────────────────────────────────────────────────
|
|
76
120
|
|
|
77
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Fetch suggestions for the autocomplete dropdown based on the user's search query.
|
|
123
|
+
* Call this inside `completeMethod` of the AutoComplete component.
|
|
124
|
+
*/
|
|
125
|
+
const fetchSuggestions = async (autocompleteQs = "") => {
|
|
126
|
+
const response = await triggerGetSolidEntities(autocompleteQs);
|
|
127
|
+
if (!response.data) return;
|
|
128
|
+
|
|
129
|
+
const mapped: RelationItem[] = response.data.records.map((item: any) => ({
|
|
78
130
|
label: item[fieldMetadata?.relationModel?.userKeyField?.name],
|
|
79
|
-
value: item
|
|
131
|
+
value: item["id"],
|
|
132
|
+
original: item,
|
|
133
|
+
}));
|
|
134
|
+
|
|
135
|
+
setSuggestions(mapped);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// ─── Checkbox-specific ───────────────────────────────────────────────────────
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Fetch all possible options for the checkbox list.
|
|
142
|
+
* Call this on mount for the checkbox widget.
|
|
143
|
+
*/
|
|
144
|
+
const fetchAllOptions = async (autocompleteQs = "") => {
|
|
145
|
+
const response = await triggerGetSolidEntities(autocompleteQs);
|
|
146
|
+
if (!response.data) return;
|
|
147
|
+
|
|
148
|
+
const mapped: RelationItem[] = response.data.records.map((item: any) => ({
|
|
149
|
+
label: item[fieldMetadata?.relationModel?.userKeyField?.name],
|
|
150
|
+
value: item["id"],
|
|
80
151
|
original: item,
|
|
81
152
|
}));
|
|
82
153
|
|
|
83
|
-
|
|
84
|
-
* IMPORTANT:
|
|
85
|
-
* 1. Set checkbox options
|
|
86
|
-
* 2. Set formik selected values (checked state)
|
|
87
|
-
*/
|
|
88
|
-
formik.setFieldValue(fieldLayoutInfo.attrs.name, mappedItems);
|
|
154
|
+
setAllOptions(mapped);
|
|
89
155
|
};
|
|
90
156
|
|
|
91
|
-
|
|
92
|
-
|
|
157
|
+
// ─── Inline create ───────────────────────────────────────────────────────────
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Handle an inline-created entity: link it and add to both `currentValues`
|
|
161
|
+
* and `allOptions` (so it shows up in the checkbox list immediately).
|
|
162
|
+
*/
|
|
163
|
+
const addNewRelation = async (values: any) => {
|
|
93
164
|
const jsonValues = Object.fromEntries(values.entries());
|
|
94
|
-
const newItem = {
|
|
165
|
+
const newItem: RelationItem = {
|
|
95
166
|
label: jsonValues[fieldMetadata?.relationModel?.userKeyField?.name],
|
|
96
167
|
value: "new",
|
|
97
168
|
original: jsonValues,
|
|
98
169
|
};
|
|
99
170
|
|
|
100
|
-
|
|
171
|
+
await linkItem(newItem);
|
|
101
172
|
|
|
102
|
-
//
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
});
|
|
173
|
+
// Also add to allOptions so checkbox widget shows the new item
|
|
174
|
+
setAllOptions((prev) =>
|
|
175
|
+
prev.some((s) => s.value === newItem.value) ? prev : [...prev, newItem]
|
|
176
|
+
);
|
|
107
177
|
};
|
|
108
178
|
|
|
109
179
|
return {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
180
|
+
// State
|
|
181
|
+
currentValues,
|
|
182
|
+
allOptions,
|
|
183
|
+
suggestions,
|
|
184
|
+
// Shared
|
|
185
|
+
fetchCurrentValues,
|
|
186
|
+
linkItem,
|
|
187
|
+
unlinkItem,
|
|
188
|
+
// Autocomplete-specific
|
|
189
|
+
fetchSuggestions,
|
|
190
|
+
// Checkbox-specific
|
|
191
|
+
fetchAllOptions,
|
|
192
|
+
// Inline create
|
|
193
|
+
addNewRelation,
|
|
114
194
|
};
|
|
115
|
-
};
|
|
195
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolidKanbanView.d.ts","sourceRoot":"","sources":["../../../../src/components/core/kanban/SolidKanbanView.tsx"],"names":[],"mappings":"AAoBA,OAAO,uCAAuC,CAAC;AAC/C,OAAO,gDAAgD,CAAC;AAaxD,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAGF,eAAO,MAAM,eAAe,WAAY,qBAAqB,
|
|
1
|
+
{"version":3,"file":"SolidKanbanView.d.ts","sourceRoot":"","sources":["../../../../src/components/core/kanban/SolidKanbanView.tsx"],"names":[],"mappings":"AAoBA,OAAO,uCAAuC,CAAC;AAC/C,OAAO,gDAAgD,CAAC;AAaxD,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAGF,eAAO,MAAM,eAAe,WAAY,qBAAqB,4CAkzB5D,CAAC"}
|
|
@@ -222,13 +222,14 @@ export var SolidKanbanView = function (params) {
|
|
|
222
222
|
};
|
|
223
223
|
// Initial Filter data
|
|
224
224
|
useEffect(function () {
|
|
225
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
225
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
226
226
|
if (solidKanbanViewMetaData) {
|
|
227
227
|
setKanbanViewMetaData(solidKanbanViewMetaData);
|
|
228
|
-
|
|
229
|
-
setViewModes(
|
|
230
|
-
|
|
231
|
-
|
|
228
|
+
// const viewModes = solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.allowedViews && solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.allowedViews.length > 0 && solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.allowedViews.map((view: any) => { return { label: capitalize(view), value: view } });
|
|
229
|
+
setViewModes((_a = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _a === void 0 ? void 0 : _a.viewModes);
|
|
230
|
+
// setViewModes(viewModes);
|
|
231
|
+
if (((_e = (_d = (_c = (_b = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _b === void 0 ? void 0 : _b.solidView) === null || _c === void 0 ? void 0 : _c.layout) === null || _d === void 0 ? void 0 : _d.attrs) === null || _e === void 0 ? void 0 : _e.grouped) !== false) {
|
|
232
|
+
setGroupByFieldName((_j = (_h = (_g = (_f = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _f === void 0 ? void 0 : _f.solidView) === null || _g === void 0 ? void 0 : _g.layout) === null || _h === void 0 ? void 0 : _h.attrs) === null || _j === void 0 ? void 0 : _j.groupBy);
|
|
232
233
|
}
|
|
233
234
|
else {
|
|
234
235
|
setGroupByFieldName("deletedTracker");
|
|
@@ -699,8 +700,8 @@ export var SolidKanbanView = function (params) {
|
|
|
699
700
|
if (solidKanbanViewMetaData) {
|
|
700
701
|
var createActionUrl = ((_d = (_c = (_b = (_a = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _a === void 0 ? void 0 : _a.solidView) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.attrs) === null || _d === void 0 ? void 0 : _d.createAction) && ((_j = (_h = (_g = (_f = (_e = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _e === void 0 ? void 0 : _e.solidView) === null || _f === void 0 ? void 0 : _f.layout) === null || _g === void 0 ? void 0 : _g.attrs) === null || _h === void 0 ? void 0 : _h.createAction) === null || _j === void 0 ? void 0 : _j.type) === "custom" ? (_p = (_o = (_m = (_l = (_k = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _k === void 0 ? void 0 : _k.solidView) === null || _l === void 0 ? void 0 : _l.layout) === null || _m === void 0 ? void 0 : _m.attrs) === null || _o === void 0 ? void 0 : _o.createAction) === null || _p === void 0 ? void 0 : _p.customComponent : "form/new";
|
|
701
702
|
var editActionUrl = ((_t = (_s = (_r = (_q = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _q === void 0 ? void 0 : _q.solidView) === null || _r === void 0 ? void 0 : _r.layout) === null || _s === void 0 ? void 0 : _s.attrs) === null || _t === void 0 ? void 0 : _t.editAction) && ((_y = (_x = (_w = (_v = (_u = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _u === void 0 ? void 0 : _u.solidView) === null || _v === void 0 ? void 0 : _v.layout) === null || _w === void 0 ? void 0 : _w.attrs) === null || _x === void 0 ? void 0 : _x.editAction) === null || _y === void 0 ? void 0 : _y.type) === "custom" ? (_3 = (_2 = (_1 = (_0 = (_z = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _z === void 0 ? void 0 : _z.solidView) === null || _0 === void 0 ? void 0 : _0.layout) === null || _1 === void 0 ? void 0 : _1.attrs) === null || _2 === void 0 ? void 0 : _2.editAction) === null || _3 === void 0 ? void 0 : _3.customComponent : "form";
|
|
702
|
-
var
|
|
703
|
-
setViewModes(
|
|
703
|
+
var viewModes_1 = ((_7 = (_6 = (_5 = (_4 = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _4 === void 0 ? void 0 : _4.solidView) === null || _5 === void 0 ? void 0 : _5.layout) === null || _6 === void 0 ? void 0 : _6.attrs) === null || _7 === void 0 ? void 0 : _7.allowedViews) && ((_11 = (_10 = (_9 = (_8 = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _8 === void 0 ? void 0 : _8.solidView) === null || _9 === void 0 ? void 0 : _9.layout) === null || _10 === void 0 ? void 0 : _10.attrs) === null || _11 === void 0 ? void 0 : _11.allowedViews.length) > 0 && ((_15 = (_14 = (_13 = (_12 = solidKanbanViewMetaData === null || solidKanbanViewMetaData === void 0 ? void 0 : solidKanbanViewMetaData.data) === null || _12 === void 0 ? void 0 : _12.solidView) === null || _13 === void 0 ? void 0 : _13.layout) === null || _14 === void 0 ? void 0 : _14.attrs) === null || _15 === void 0 ? void 0 : _15.allowedViews.map(function (view) { return { label: capitalize(view), value: view }; }));
|
|
704
|
+
setViewModes(viewModes_1);
|
|
704
705
|
if (createActionUrl) {
|
|
705
706
|
setCreateButtonUrl(createActionUrl);
|
|
706
707
|
}
|