@creopse/react 0.0.24 → 0.0.25
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/{content-Cgzd1E-Q.cjs → content-DeoXIM_L.cjs} +24 -12
- package/dist/{content-DP8wQsOf.js → content-SRtqarhC.js} +24 -12
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
- package/types/hooks/content.d.ts +3 -5
- package/types/types/content.d.ts +11 -0
|
@@ -6791,6 +6791,9 @@ var ProfileType;
|
|
|
6791
6791
|
var ResponseErrorCode;
|
|
6792
6792
|
(function(ResponseErrorCode2) {
|
|
6793
6793
|
ResponseErrorCode2["FORM_INVALID_DATA"] = "form/invalid_data";
|
|
6794
|
+
ResponseErrorCode2["REQUEST_PARAMS_MISSING"] = "request/params_missing";
|
|
6795
|
+
ResponseErrorCode2["REQUEST_DATA_RETRIEVAL_FAILED"] = "request/data_retrieval_failed";
|
|
6796
|
+
ResponseErrorCode2["REQUEST_DATA_ALREADY_EXISTS"] = "request/data_already_exists";
|
|
6794
6797
|
ResponseErrorCode2["AUTH_LOGIN_FAILED"] = "auth/login_failed";
|
|
6795
6798
|
ResponseErrorCode2["AUTH_REGISTRATION_FAILED"] = "auth/registration_failed";
|
|
6796
6799
|
ResponseErrorCode2["AUTH_MISSING_DATA"] = "auth/missing_data";
|
|
@@ -7943,9 +7946,25 @@ const useContent = () => {
|
|
|
7943
7946
|
[request, formatContentModelItemData]
|
|
7944
7947
|
);
|
|
7945
7948
|
const getPaginatedContentModelItems = React.useCallback(
|
|
7946
|
-
async (name, pageSize, filterByIsActive = true) => {
|
|
7949
|
+
async (name, page2, pageSize, filterByIsActive = true, query, dataFilters) => {
|
|
7950
|
+
const params = new URLSearchParams({
|
|
7951
|
+
page: String(page2),
|
|
7952
|
+
pageSize: String(pageSize),
|
|
7953
|
+
contentModelName: name
|
|
7954
|
+
});
|
|
7955
|
+
if (filterByIsActive) params.append("isActive", "true");
|
|
7956
|
+
if (query) params.append("query", query);
|
|
7957
|
+
if (dataFilters?.length) {
|
|
7958
|
+
dataFilters.forEach((filter2, index) => {
|
|
7959
|
+
params.append(`dataFilters[${index}][key]`, filter2.key);
|
|
7960
|
+
params.append(`dataFilters[${index}][value]`, filter2.value);
|
|
7961
|
+
if (filter2.operator) {
|
|
7962
|
+
params.append(`dataFilters[${index}][operator]`, filter2.operator);
|
|
7963
|
+
}
|
|
7964
|
+
});
|
|
7965
|
+
}
|
|
7947
7966
|
const task = await request({
|
|
7948
|
-
url: `content-model/items
|
|
7967
|
+
url: `content-model/items?${params.toString()}`
|
|
7949
7968
|
});
|
|
7950
7969
|
if (task.success && task.result) {
|
|
7951
7970
|
const items = (task.result.data?.items || []).map(
|
|
@@ -7953,17 +7972,9 @@ const useContent = () => {
|
|
|
7953
7972
|
);
|
|
7954
7973
|
const total = task.result.data?.meta?.total || 0;
|
|
7955
7974
|
const currentPage = task.result.data?.meta?.currentPage || 1;
|
|
7956
|
-
return {
|
|
7957
|
-
items,
|
|
7958
|
-
total,
|
|
7959
|
-
currentPage
|
|
7960
|
-
};
|
|
7975
|
+
return { items, total, currentPage };
|
|
7961
7976
|
}
|
|
7962
|
-
return {
|
|
7963
|
-
items: [],
|
|
7964
|
-
total: 0,
|
|
7965
|
-
currentPage: 1
|
|
7966
|
-
};
|
|
7977
|
+
return { items: [], total: 0, currentPage: 1 };
|
|
7967
7978
|
},
|
|
7968
7979
|
[request, formatContentModelItemData]
|
|
7969
7980
|
);
|
|
@@ -8168,6 +8179,7 @@ const useContent = () => {
|
|
|
8168
8179
|
getPaginatedContentModelItems,
|
|
8169
8180
|
getAppInformationValue,
|
|
8170
8181
|
submitUserContentModelItem,
|
|
8182
|
+
formatContentModelItemData,
|
|
8171
8183
|
appAccentColor,
|
|
8172
8184
|
appPrimaryColor,
|
|
8173
8185
|
appSecondaryColor
|
|
@@ -6790,6 +6790,9 @@ var ProfileType;
|
|
|
6790
6790
|
var ResponseErrorCode;
|
|
6791
6791
|
(function(ResponseErrorCode2) {
|
|
6792
6792
|
ResponseErrorCode2["FORM_INVALID_DATA"] = "form/invalid_data";
|
|
6793
|
+
ResponseErrorCode2["REQUEST_PARAMS_MISSING"] = "request/params_missing";
|
|
6794
|
+
ResponseErrorCode2["REQUEST_DATA_RETRIEVAL_FAILED"] = "request/data_retrieval_failed";
|
|
6795
|
+
ResponseErrorCode2["REQUEST_DATA_ALREADY_EXISTS"] = "request/data_already_exists";
|
|
6793
6796
|
ResponseErrorCode2["AUTH_LOGIN_FAILED"] = "auth/login_failed";
|
|
6794
6797
|
ResponseErrorCode2["AUTH_REGISTRATION_FAILED"] = "auth/registration_failed";
|
|
6795
6798
|
ResponseErrorCode2["AUTH_MISSING_DATA"] = "auth/missing_data";
|
|
@@ -7942,9 +7945,25 @@ const useContent = () => {
|
|
|
7942
7945
|
[request, formatContentModelItemData]
|
|
7943
7946
|
);
|
|
7944
7947
|
const getPaginatedContentModelItems = useCallback(
|
|
7945
|
-
async (name, pageSize, filterByIsActive = true) => {
|
|
7948
|
+
async (name, page2, pageSize, filterByIsActive = true, query, dataFilters) => {
|
|
7949
|
+
const params = new URLSearchParams({
|
|
7950
|
+
page: String(page2),
|
|
7951
|
+
pageSize: String(pageSize),
|
|
7952
|
+
contentModelName: name
|
|
7953
|
+
});
|
|
7954
|
+
if (filterByIsActive) params.append("isActive", "true");
|
|
7955
|
+
if (query) params.append("query", query);
|
|
7956
|
+
if (dataFilters?.length) {
|
|
7957
|
+
dataFilters.forEach((filter2, index) => {
|
|
7958
|
+
params.append(`dataFilters[${index}][key]`, filter2.key);
|
|
7959
|
+
params.append(`dataFilters[${index}][value]`, filter2.value);
|
|
7960
|
+
if (filter2.operator) {
|
|
7961
|
+
params.append(`dataFilters[${index}][operator]`, filter2.operator);
|
|
7962
|
+
}
|
|
7963
|
+
});
|
|
7964
|
+
}
|
|
7946
7965
|
const task = await request({
|
|
7947
|
-
url: `content-model/items
|
|
7966
|
+
url: `content-model/items?${params.toString()}`
|
|
7948
7967
|
});
|
|
7949
7968
|
if (task.success && task.result) {
|
|
7950
7969
|
const items = (task.result.data?.items || []).map(
|
|
@@ -7952,17 +7971,9 @@ const useContent = () => {
|
|
|
7952
7971
|
);
|
|
7953
7972
|
const total = task.result.data?.meta?.total || 0;
|
|
7954
7973
|
const currentPage = task.result.data?.meta?.currentPage || 1;
|
|
7955
|
-
return {
|
|
7956
|
-
items,
|
|
7957
|
-
total,
|
|
7958
|
-
currentPage
|
|
7959
|
-
};
|
|
7974
|
+
return { items, total, currentPage };
|
|
7960
7975
|
}
|
|
7961
|
-
return {
|
|
7962
|
-
items: [],
|
|
7963
|
-
total: 0,
|
|
7964
|
-
currentPage: 1
|
|
7965
|
-
};
|
|
7976
|
+
return { items: [], total: 0, currentPage: 1 };
|
|
7966
7977
|
},
|
|
7967
7978
|
[request, formatContentModelItemData]
|
|
7968
7979
|
);
|
|
@@ -8167,6 +8178,7 @@ const useContent = () => {
|
|
|
8167
8178
|
getPaginatedContentModelItems,
|
|
8168
8179
|
getAppInformationValue,
|
|
8169
8180
|
submitUserContentModelItem,
|
|
8181
|
+
formatContentModelItemData,
|
|
8170
8182
|
appAccentColor,
|
|
8171
8183
|
appPrimaryColor,
|
|
8172
8184
|
appSecondaryColor
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const content = require("../content-
|
|
3
|
+
const content = require("../content-DeoXIM_L.cjs");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const articlesUrlBuilder = (p) => {
|
|
6
6
|
const searchParams = new URLSearchParams();
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as useApi } from "../content-
|
|
2
|
-
import { f, a, u, b } from "../content-
|
|
1
|
+
import { e as useApi } from "../content-SRtqarhC.js";
|
|
2
|
+
import { f, a, u, b } from "../content-SRtqarhC.js";
|
|
3
3
|
import { useState, useCallback } from "react";
|
|
4
4
|
const articlesUrlBuilder = (p) => {
|
|
5
5
|
const searchParams = new URLSearchParams();
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
|
-
const content = require("./content-
|
|
4
|
+
const content = require("./content-DeoXIM_L.cjs");
|
|
5
5
|
const react = require("@inertiajs/react");
|
|
6
6
|
const reactDom = require("react-dom");
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import React__default, { useState, useEffect, createContext, useRef, useLayoutEffect, useId, useContext, useInsertionEffect, useMemo, useCallback, Children, isValidElement, Fragment, createElement, forwardRef, Component } from "react";
|
|
3
|
-
import { u as useHelper, a as useContent, b as useProps, P as PropsContext, R as ResolveSectionsContext, c as cloneDeep, s as slideToId, E as EditorMessageType, d as RouterContext, C as ConfigContext } from "./content-
|
|
3
|
+
import { u as useHelper, a as useContent, b as useProps, P as PropsContext, R as ResolveSectionsContext, c as cloneDeep, s as slideToId, E as EditorMessageType, d as RouterContext, C as ConfigContext } from "./content-SRtqarhC.js";
|
|
4
4
|
import { router } from "@inertiajs/react";
|
|
5
5
|
import { createPortal } from "react-dom";
|
|
6
6
|
var jsxRuntime = { exports: {} };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@creopse/react",
|
|
3
3
|
"description": "Creopse React Toolkit",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.25",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Noé Gnanih <noegnanih@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"react-dom": "^19.1.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@creopse/utils": "^0.0.
|
|
46
|
+
"@creopse/utils": "^0.0.14",
|
|
47
47
|
"@vueuse/core": "^14.1.0",
|
|
48
48
|
"axios": "^1.13.2",
|
|
49
49
|
"framer-motion": "^12.23.9",
|
package/types/hooks/content.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Response } from '@/types/api';
|
|
2
|
+
import type { DataFilter, PaginatedContentModelItems } from '@/types/content';
|
|
2
3
|
import type { AppInformationKey, ContentModelItemModel, ContentModelModel, MenuItemGroupModel, MenuItemModel, MenuModel, NewsArticleModel, NewsCategoryModel, NewsTagModel, PageModel, SettingType, SharedProps } from '@creopse/utils';
|
|
3
4
|
/**
|
|
4
5
|
* A hook that provides a set of functions and properties for
|
|
@@ -36,13 +37,10 @@ export declare const useContent: () => {
|
|
|
36
37
|
getSectionRootData: (key?: string) => any;
|
|
37
38
|
getContentModel: (name: string) => ContentModelModel | undefined;
|
|
38
39
|
getContentModelItems: (name: string, filterByIsActive?: boolean) => Promise<ContentModelItemModel[]>;
|
|
39
|
-
getPaginatedContentModelItems: (name: string, pageSize: number, filterByIsActive?: boolean) => Promise<
|
|
40
|
-
items: ContentModelItemModel[];
|
|
41
|
-
total: number;
|
|
42
|
-
currentPage: number;
|
|
43
|
-
}>;
|
|
40
|
+
getPaginatedContentModelItems: (name: string, page: number, pageSize: number, filterByIsActive?: boolean, query?: string, dataFilters?: DataFilter[]) => Promise<PaginatedContentModelItems>;
|
|
44
41
|
getAppInformationValue: (key: AppInformationKey, type?: SettingType) => any;
|
|
45
42
|
submitUserContentModelItem: (title: string, contentModelId: string, singletonsData?: any, collectionsData?: any, successCallback?: () => void, errorCallback?: (errorData: any) => void) => Promise<Response<any>>;
|
|
43
|
+
formatContentModelItemData: (item: ContentModelItemModel) => object;
|
|
46
44
|
appAccentColor: string;
|
|
47
45
|
appPrimaryColor: string;
|
|
48
46
|
appSecondaryColor: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ContentModelItemModel } from '@creopse/utils';
|
|
2
|
+
export type DataFilter = {
|
|
3
|
+
key: string;
|
|
4
|
+
value: string;
|
|
5
|
+
operator?: '=' | '!=' | '>' | '>=' | '<' | '<=' | 'like';
|
|
6
|
+
};
|
|
7
|
+
export interface PaginatedContentModelItems {
|
|
8
|
+
items: ContentModelItemModel[];
|
|
9
|
+
total: number;
|
|
10
|
+
currentPage: number;
|
|
11
|
+
}
|