@solidxai/core-ui 0.1.9-beta.3 → 0.1.9-beta.5
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/form/SolidFormFooter.d.ts.map +1 -1
- package/dist/components/core/form/SolidFormFooter.js +7 -6
- package/dist/components/core/form/SolidFormFooter.js.map +1 -1
- package/dist/components/core/form/SolidFormFooter.tsx +6 -5
- package/dist/components/core/form/SolidFormView.js +2 -2
- package/dist/components/core/form/SolidFormView.js.map +1 -1
- package/dist/components/core/form/SolidFormView.tsx +1 -1
- package/dist/components/core/form/fields/SolidBooleanField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidBooleanField.js +10 -1
- package/dist/components/core/form/fields/SolidBooleanField.js.map +1 -1
- package/dist/components/core/form/fields/SolidBooleanField.tsx +13 -1
- package/dist/components/core/form/fields/SolidDecimalField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidDecimalField.js +7 -1
- package/dist/components/core/form/fields/SolidDecimalField.js.map +1 -1
- package/dist/components/core/form/fields/SolidDecimalField.tsx +10 -1
- package/dist/components/core/form/fields/SolidIntegerField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidIntegerField.js +14 -2
- package/dist/components/core/form/fields/SolidIntegerField.js.map +1 -1
- package/dist/components/core/form/fields/SolidIntegerField.tsx +20 -2
- package/dist/components/core/form/fields/SolidJsonField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidJsonField.js +9 -1
- package/dist/components/core/form/fields/SolidJsonField.js.map +1 -1
- package/dist/components/core/form/fields/SolidJsonField.tsx +12 -1
- package/dist/components/core/form/fields/SolidLongTextField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidLongTextField.js +23 -3
- package/dist/components/core/form/fields/SolidLongTextField.js.map +1 -1
- package/dist/components/core/form/fields/SolidLongTextField.tsx +32 -3
- package/dist/components/core/form/fields/SolidMediaMultipleField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidMediaMultipleField.js +15 -2
- package/dist/components/core/form/fields/SolidMediaMultipleField.js.map +1 -1
- package/dist/components/core/form/fields/SolidMediaMultipleField.tsx +20 -4
- package/dist/components/core/form/fields/SolidMediaSingleField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidMediaSingleField.js +21 -3
- package/dist/components/core/form/fields/SolidMediaSingleField.js.map +1 -1
- package/dist/components/core/form/fields/SolidMediaSingleField.tsx +30 -3
- package/dist/components/core/form/fields/SolidPasswordField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidPasswordField.js +2 -1
- package/dist/components/core/form/fields/SolidPasswordField.js.map +1 -1
- package/dist/components/core/form/fields/SolidPasswordField.tsx +13 -1
- package/dist/components/core/form/fields/SolidRichTextField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidRichTextField.js +9 -1
- package/dist/components/core/form/fields/SolidRichTextField.js.map +1 -1
- package/dist/components/core/form/fields/SolidRichTextField.tsx +12 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +2 -2
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +8 -2
- package/dist/components/core/form/fields/widgets/SolidIconEditWidget.d.ts.map +1 -1
- package/dist/components/core/form/fields/widgets/SolidIconEditWidget.js +14 -3
- package/dist/components/core/form/fields/widgets/SolidIconEditWidget.js.map +1 -1
- package/dist/components/core/form/fields/widgets/SolidIconEditWidget.tsx +20 -3
- package/dist/components/core/list/SolidListView.d.ts.map +1 -1
- package/dist/components/core/list/SolidListView.js +66 -2
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/components/core/list/SolidListView.tsx +67 -2
- package/dist/routes/SolidRouteMetadataBoundary.js +1 -1
- package/dist/routes/SolidRouteMetadataBoundary.js.map +1 -1
- package/dist/routes/SolidRouteMetadataBoundary.tsx +1 -1
- package/package.json +1 -1
|
@@ -244,6 +244,7 @@ export const SolidListView = forwardRef<SolidListViewHandle, SolidListViewParams
|
|
|
244
244
|
const [filterPredicates, setFilterPredicates] = useState<any>(null);
|
|
245
245
|
const [showSaveFilterPopup, setShowSaveFilterPopup] = useState<boolean>(false);
|
|
246
246
|
const [showGlobalSearchElement, setShowGlobalSearchElement] = useState(false);
|
|
247
|
+
const suppressNextFilterPaginationResetRef = useRef(false);
|
|
247
248
|
|
|
248
249
|
const [triggerCheckIfPermissionExists] = useLazyCheckIfPermissionExistsQuery();
|
|
249
250
|
|
|
@@ -564,6 +565,7 @@ export const SolidListView = forwardRef<SolidListViewHandle, SolidListViewParams
|
|
|
564
565
|
const queryObject = getFilterObjectFromLocalStorage();
|
|
565
566
|
|
|
566
567
|
if (queryObject) {
|
|
568
|
+
suppressNextFilterPaginationResetRef.current = true;
|
|
567
569
|
const queryData = {
|
|
568
570
|
offset: queryObject.offset || 0,
|
|
569
571
|
limit: queryObject.limit || 25,
|
|
@@ -822,8 +824,9 @@ export const SolidListView = forwardRef<SolidListViewHandle, SolidListViewParams
|
|
|
822
824
|
|
|
823
825
|
const queryString = qs.stringify(queryData, { encodeValuesOnly: true });
|
|
824
826
|
|
|
825
|
-
if (latestFilterPredicatesRef.current
|
|
827
|
+
if (latestFilterPredicatesRef.current) {
|
|
826
828
|
const fileterTobeStored = structuredClone(queryData);
|
|
829
|
+
fileterTobeStored.finalFullFilter = fileterTobeStored.filters;
|
|
827
830
|
delete fileterTobeStored.filters;
|
|
828
831
|
fileterTobeStored.custom_filter_predicate = latestFilterPredicatesRef.current.custom_filter_predicate || null;
|
|
829
832
|
fileterTobeStored.search_predicate = latestFilterPredicatesRef.current.search_predicate || null;
|
|
@@ -853,6 +856,22 @@ export const SolidListView = forwardRef<SolidListViewHandle, SolidListViewParams
|
|
|
853
856
|
}
|
|
854
857
|
const updatedFilter = queryfilter;
|
|
855
858
|
|
|
859
|
+
const previousPredicates = latestFilterPredicatesRef.current;
|
|
860
|
+
const nextPredicatesComparable = {
|
|
861
|
+
custom_filter_predicate: filterPredicates?.custom_filter_predicate || null,
|
|
862
|
+
search_predicate: filterPredicates?.search_predicate || null,
|
|
863
|
+
saved_filter_predicate: filterPredicates?.saved_filter_predicate || null,
|
|
864
|
+
predefined_search_predicate: filterPredicates?.predefined_search_predicate || null,
|
|
865
|
+
};
|
|
866
|
+
const previousPredicatesComparable = {
|
|
867
|
+
custom_filter_predicate: previousPredicates?.custom_filter_predicate || null,
|
|
868
|
+
search_predicate: previousPredicates?.search_predicate || null,
|
|
869
|
+
saved_filter_predicate: previousPredicates?.saved_filter_predicate || null,
|
|
870
|
+
predefined_search_predicate: previousPredicates?.predefined_search_predicate || null,
|
|
871
|
+
};
|
|
872
|
+
const hasPredicateChanged =
|
|
873
|
+
JSON.stringify(previousPredicatesComparable) !== JSON.stringify(nextPredicatesComparable);
|
|
874
|
+
|
|
856
875
|
// Update refs IMMEDIATELY (synchronously)
|
|
857
876
|
latestFiltersRef.current = updatedFilter;
|
|
858
877
|
const updatedFilterPredicates = structuredClone(filterPredicates);
|
|
@@ -862,7 +881,53 @@ export const SolidListView = forwardRef<SolidListViewHandle, SolidListViewParams
|
|
|
862
881
|
// Then update state
|
|
863
882
|
setFilters(updatedFilter);
|
|
864
883
|
setFilterPredicates(updatedFilterPredicates);
|
|
865
|
-
|
|
884
|
+
const hasMeaningfulFilterValueLocal = (value: any): boolean => {
|
|
885
|
+
if (value === null || value === undefined) return false;
|
|
886
|
+
if (typeof value === "string") return value.trim().length > 0;
|
|
887
|
+
if (typeof value === "number" || typeof value === "boolean") return true;
|
|
888
|
+
if (Array.isArray(value)) return value.some((item) => hasMeaningfulFilterValueLocal(item));
|
|
889
|
+
if (typeof value === "object") return hasAppliedFiltersLocal(value);
|
|
890
|
+
return false;
|
|
891
|
+
};
|
|
892
|
+
|
|
893
|
+
const hasAppliedFiltersLocal = (filterObject: any): boolean => {
|
|
894
|
+
if (!filterObject || typeof filterObject !== "object") return false;
|
|
895
|
+
|
|
896
|
+
if (Array.isArray(filterObject)) {
|
|
897
|
+
return filterObject.some((item) => hasAppliedFiltersLocal(item) || hasMeaningfulFilterValueLocal(item));
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
return Object.entries(filterObject).some(([key, val]) => {
|
|
901
|
+
if (key === "matchMode" || key === "operator") return false;
|
|
902
|
+
if (key === "value") return hasMeaningfulFilterValueLocal(val);
|
|
903
|
+
if ((key === "$and" || key === "$or") && Array.isArray(val)) {
|
|
904
|
+
return val.some((item) => hasAppliedFiltersLocal(item) || hasMeaningfulFilterValueLocal(item));
|
|
905
|
+
}
|
|
906
|
+
if (typeof val === "object") return hasAppliedFiltersLocal(val);
|
|
907
|
+
return hasMeaningfulFilterValueLocal(val);
|
|
908
|
+
});
|
|
909
|
+
};
|
|
910
|
+
|
|
911
|
+
const hasCurrentMeaningfulPredicates =
|
|
912
|
+
hasAppliedFiltersLocal(updatedFilterPredicates?.custom_filter_predicate) ||
|
|
913
|
+
hasAppliedFiltersLocal(updatedFilterPredicates?.search_predicate) ||
|
|
914
|
+
hasAppliedFiltersLocal(updatedFilterPredicates?.saved_filter_predicate) ||
|
|
915
|
+
hasAppliedFiltersLocal(updatedFilterPredicates?.predefined_search_predicate);
|
|
916
|
+
|
|
917
|
+
const hasPreviousMeaningfulPredicates =
|
|
918
|
+
hasAppliedFiltersLocal(previousPredicates?.custom_filter_predicate) ||
|
|
919
|
+
hasAppliedFiltersLocal(previousPredicates?.search_predicate) ||
|
|
920
|
+
hasAppliedFiltersLocal(previousPredicates?.saved_filter_predicate) ||
|
|
921
|
+
hasAppliedFiltersLocal(previousPredicates?.predefined_search_predicate);
|
|
922
|
+
|
|
923
|
+
const shouldResetPagination =
|
|
924
|
+
hasPredicateChanged && (hasCurrentMeaningfulPredicates || hasPreviousMeaningfulPredicates);
|
|
925
|
+
|
|
926
|
+
if (suppressNextFilterPaginationResetRef.current) {
|
|
927
|
+
suppressNextFilterPaginationResetRef.current = false;
|
|
928
|
+
} else if (shouldResetPagination) {
|
|
929
|
+
setFirst(0);
|
|
930
|
+
}
|
|
866
931
|
// Force synchronous state updates
|
|
867
932
|
};
|
|
868
933
|
|
|
@@ -13,7 +13,7 @@ import { matchRoutes, Outlet, useLocation } from "react-router-dom";
|
|
|
13
13
|
import { getSettingsMap } from "../helpers/settingsPayload";
|
|
14
14
|
import { useGetAuthSettingsQuery } from "../redux/api/solidSettingsApi";
|
|
15
15
|
function normalizePart(value) {
|
|
16
|
-
var trimmed = value
|
|
16
|
+
var trimmed = value;
|
|
17
17
|
return trimmed ? trimmed : undefined;
|
|
18
18
|
}
|
|
19
19
|
function uniqueParts(parts) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolidRouteMetadataBoundary.js","sourceRoot":"","sources":["../../src/routes/SolidRouteMetadataBoundary.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAoB,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAGxE,SAAS,aAAa,CAAC,KAAc;IACnC,IAAM,OAAO,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"SolidRouteMetadataBoundary.js","sourceRoot":"","sources":["../../src/routes/SolidRouteMetadataBoundary.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAoB,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAGxE,SAAS,aAA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AAC,EAAjC,CAAiC,CAAC,CAAC;QAEjF,IAAM,cAAc,GAAG,WAAW,6DAAK,aAAa,UAAE,aAAa,WAAK,aAAa,UAAE,gBAAgB,UAAE,CAAC;QAC1G,QAAQ,CAAC,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAE5C,IAAM,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC,0BAA0B,CAAC,CAAC;QAC3E,IAAI,eAAe,EAAE;YACnB,eAAe,CAAC,YAAY,CAC1B,SAAS,EACT,MAAA,mBAAmB,aAAnB,mBAAmB,cAAnB,mBAAmB,GAAI,aAAa,CAAC,qBAAqB,CAAC,OAAO,CAAC,mCAAI,gBAAgB,CACxF,CAAC;SACH;IACH,CAAC,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IAErC,OAAO,KAAC,MAAM,KAAG,CAAC;AACpB,CAAC","sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { matchRoutes, Outlet, useLocation, type RouteObject } from \"react-router-dom\";\nimport { getSettingsMap } from \"../helpers/settingsPayload\";\nimport { useGetAuthSettingsQuery } from \"../redux/api/solidSettingsApi\";\nimport type { SolidPageMeta } from \"./types\";\n\nfunction normalizePart(value?: string): string | undefined {\n const trimmed = value;\n return trimmed ? trimmed : undefined;\n}\n\nfunction uniqueParts(parts: Array<string | undefined>): string[] {\n const seen = new Set<string>();\n const result: string[] = [];\n\n for (const part of parts) {\n if (!part || seen.has(part)) continue;\n seen.add(part);\n result.push(part);\n }\n\n return result;\n}\n\nexport function SolidRouteMetadataBoundary({ routes }: { routes: RouteObject[] }) {\n const location = useLocation();\n const { data: authSettings } = useGetAuthSettingsQuery(undefined);\n const initialDescriptionRef = useRef(\n typeof document !== \"undefined\"\n ? document.querySelector('meta[name=\"description\"]')?.getAttribute(\"content\") ?? \"\"\n : \"\",\n );\n\n useEffect(() => {\n const matches = matchRoutes(routes, location) ?? [];\n const handles = matches\n .map((match) => match.route.handle as SolidPageMeta | undefined)\n .filter((handle): handle is SolidPageMeta => Boolean(handle));\n\n const hasExplicitOptOut = handles.some((handle) => handle.manageDocumentMeta === false);\n const hasAutoManagedMeta = handles.some(\n (handle) =>\n handle.manageDocumentMeta === true ||\n Boolean(handle.title || handle.description || handle.titlePrefix || handle.titleSuffix),\n );\n\n if (hasExplicitOptOut || !hasAutoManagedMeta) {\n return;\n }\n\n const settingsMap = getSettingsMap(authSettings);\n const resolvedAppTitle = normalizePart(settingsMap.appTitle) ?? \"SolidX\";\n const resolvedTitle = [...handles]\n .reverse()\n .map((handle) => normalizePart(handle.title))\n .find(Boolean);\n const resolvedDescription = [...handles]\n .reverse()\n .map((handle) => normalizePart(handle.description))\n .find(Boolean);\n const titlePrefixes = handles.map((handle) => normalizePart(handle.titlePrefix));\n const titleSuffixes = handles.map((handle) => normalizePart(handle.titleSuffix));\n\n const nextTitleParts = uniqueParts([...titlePrefixes, resolvedTitle, ...titleSuffixes, resolvedAppTitle]);\n document.title = nextTitleParts.join(\" | \");\n\n const metaDescription = document.querySelector('meta[name=\"description\"]');\n if (metaDescription) {\n metaDescription.setAttribute(\n \"content\",\n resolvedDescription ?? normalizePart(initialDescriptionRef.current) ?? resolvedAppTitle,\n );\n }\n }, [authSettings, location, routes]);\n\n return <Outlet />;\n}\n"]}
|
|
@@ -5,7 +5,7 @@ import { useGetAuthSettingsQuery } from "../redux/api/solidSettingsApi";
|
|
|
5
5
|
import type { SolidPageMeta } from "./types";
|
|
6
6
|
|
|
7
7
|
function normalizePart(value?: string): string | undefined {
|
|
8
|
-
const trimmed = value
|
|
8
|
+
const trimmed = value;
|
|
9
9
|
return trimmed ? trimmed : undefined;
|
|
10
10
|
}
|
|
11
11
|
|