@creopse/react 0.0.25 → 0.0.26
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-DeoXIM_L.cjs → content-DKqcW0Dp.cjs} +27 -0
- package/dist/{content-SRtqarhC.js → content-YRSMxojU.js} +27 -0
- 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 +1 -0
- package/types/types/content.d.ts +1 -1
|
@@ -8001,6 +8001,32 @@ const useContent = () => {
|
|
|
8001
8001
|
},
|
|
8002
8002
|
[request]
|
|
8003
8003
|
);
|
|
8004
|
+
const getContentPath = React.useCallback(
|
|
8005
|
+
(name, item) => {
|
|
8006
|
+
const permalinks = props?.permalinks || [];
|
|
8007
|
+
switch (name) {
|
|
8008
|
+
case "news-article":
|
|
8009
|
+
case "news-category":
|
|
8010
|
+
case "news-tag": {
|
|
8011
|
+
const permalink = permalinks?.find((p) => p.contentType === name);
|
|
8012
|
+
if (!permalink) {
|
|
8013
|
+
return "";
|
|
8014
|
+
}
|
|
8015
|
+
return `${permalink.pathPrefix}/${permalink.contentParam ? item[permalink.contentParam] : item.id}`;
|
|
8016
|
+
}
|
|
8017
|
+
default: {
|
|
8018
|
+
const permalink = permalinks?.find(
|
|
8019
|
+
(p) => p.content?.name === name
|
|
8020
|
+
);
|
|
8021
|
+
if (!permalink) {
|
|
8022
|
+
return "";
|
|
8023
|
+
}
|
|
8024
|
+
return `${permalink.pathPrefix}/${permalink.contentParam ? item?.data[permalink.contentParam] : item.id}`;
|
|
8025
|
+
}
|
|
8026
|
+
}
|
|
8027
|
+
},
|
|
8028
|
+
[props?.permalinks]
|
|
8029
|
+
);
|
|
8004
8030
|
const getMenu = React.useCallback(
|
|
8005
8031
|
(name, filterByIsActive = true) => {
|
|
8006
8032
|
const menu = cloneDeep(props?.menus?.find((menu2) => menu2.name === name));
|
|
@@ -8174,6 +8200,7 @@ const useContent = () => {
|
|
|
8174
8200
|
getSectionSetting,
|
|
8175
8201
|
getAnySectionData,
|
|
8176
8202
|
getSectionRootData,
|
|
8203
|
+
getContentPath,
|
|
8177
8204
|
getContentModel,
|
|
8178
8205
|
getContentModelItems,
|
|
8179
8206
|
getPaginatedContentModelItems,
|
|
@@ -8000,6 +8000,32 @@ const useContent = () => {
|
|
|
8000
8000
|
},
|
|
8001
8001
|
[request]
|
|
8002
8002
|
);
|
|
8003
|
+
const getContentPath = useCallback(
|
|
8004
|
+
(name, item) => {
|
|
8005
|
+
const permalinks = props?.permalinks || [];
|
|
8006
|
+
switch (name) {
|
|
8007
|
+
case "news-article":
|
|
8008
|
+
case "news-category":
|
|
8009
|
+
case "news-tag": {
|
|
8010
|
+
const permalink = permalinks?.find((p) => p.contentType === name);
|
|
8011
|
+
if (!permalink) {
|
|
8012
|
+
return "";
|
|
8013
|
+
}
|
|
8014
|
+
return `${permalink.pathPrefix}/${permalink.contentParam ? item[permalink.contentParam] : item.id}`;
|
|
8015
|
+
}
|
|
8016
|
+
default: {
|
|
8017
|
+
const permalink = permalinks?.find(
|
|
8018
|
+
(p) => p.content?.name === name
|
|
8019
|
+
);
|
|
8020
|
+
if (!permalink) {
|
|
8021
|
+
return "";
|
|
8022
|
+
}
|
|
8023
|
+
return `${permalink.pathPrefix}/${permalink.contentParam ? item?.data[permalink.contentParam] : item.id}`;
|
|
8024
|
+
}
|
|
8025
|
+
}
|
|
8026
|
+
},
|
|
8027
|
+
[props?.permalinks]
|
|
8028
|
+
);
|
|
8003
8029
|
const getMenu = useCallback(
|
|
8004
8030
|
(name, filterByIsActive = true) => {
|
|
8005
8031
|
const menu = cloneDeep(props?.menus?.find((menu2) => menu2.name === name));
|
|
@@ -8173,6 +8199,7 @@ const useContent = () => {
|
|
|
8173
8199
|
getSectionSetting,
|
|
8174
8200
|
getAnySectionData,
|
|
8175
8201
|
getSectionRootData,
|
|
8202
|
+
getContentPath,
|
|
8176
8203
|
getContentModel,
|
|
8177
8204
|
getContentModelItems,
|
|
8178
8205
|
getPaginatedContentModelItems,
|
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-DKqcW0Dp.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-YRSMxojU.js";
|
|
2
|
+
import { f, a, u, b } from "../content-YRSMxojU.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-DKqcW0Dp.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-YRSMxojU.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.26",
|
|
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.15",
|
|
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
|
@@ -35,6 +35,7 @@ export declare const useContent: () => {
|
|
|
35
35
|
getSectionSetting: (key: string | null | undefined, group: string, name: string) => object | any | null;
|
|
36
36
|
getAnySectionData: (sectionSlug: string, pageSlug: string, linkId?: string) => Promise<any>;
|
|
37
37
|
getSectionRootData: (key?: string) => any;
|
|
38
|
+
getContentPath: (name: "news-article" | "news-category" | "news-tag" | string, item: ContentModelItemModel | any) => string;
|
|
38
39
|
getContentModel: (name: string) => ContentModelModel | undefined;
|
|
39
40
|
getContentModelItems: (name: string, filterByIsActive?: boolean) => Promise<ContentModelItemModel[]>;
|
|
40
41
|
getPaginatedContentModelItems: (name: string, page: number, pageSize: number, filterByIsActive?: boolean, query?: string, dataFilters?: DataFilter[]) => Promise<PaginatedContentModelItems>;
|
package/types/types/content.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ContentModelItemModel } from '@creopse/utils';
|
|
|
2
2
|
export type DataFilter = {
|
|
3
3
|
key: string;
|
|
4
4
|
value: string;
|
|
5
|
-
operator?: '=' | '!=' | '>' | '>=' | '<' | '<=' | 'like';
|
|
5
|
+
operator?: '=' | '!=' | '>' | '>=' | '<' | '<=' | 'like' | 'json_contains';
|
|
6
6
|
};
|
|
7
7
|
export interface PaginatedContentModelItems {
|
|
8
8
|
items: ContentModelItemModel[];
|