namirasoft-site-react 1.4.501 → 1.4.502

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.
@@ -1,8 +1,15 @@
1
- import { ReactNode } from "react";
1
+ import { IImageProps, ILinkProps } from "../main";
2
+ export interface NSListProductCartProps {
3
+ title: string;
4
+ description?: string;
5
+ link: ILinkProps;
6
+ image?: IImageProps;
7
+ }
2
8
  export interface NSListProductProps {
3
9
  scope: string;
4
10
  name: string;
5
- getChildrenBefore?: () => ReactNode;
6
- getChildrenAfter?: () => ReactNode;
11
+ getChildrenBefore?: () => NSListProductCartProps[];
12
+ getChildrenAfter?: () => NSListProductCartProps[];
13
+ search?: string;
7
14
  }
8
15
  export declare function NSListProduct(props: NSListProductProps): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState, useEffect } from "react";
3
2
  import { NamirasoftAPIProductServer } from "namirasoft-api-product";
3
+ import { EnvService, SearchOperation } from 'namirasoft-core';
4
+ import { useEffect, useState } from "react";
4
5
  import { NSCard } from "./NSCard";
5
- import { EnvService } from 'namirasoft-core';
6
6
  import { NSSection } from "./NSSection";
7
7
  export function NSListProduct(props) {
8
+ var _a, _b, _c, _d, _e, _f, _g;
8
9
  const [state, setState] = useState({ products: [] });
9
10
  useEffect(() => {
10
11
  let REACT_APP_BASE_URL_API_PRODUCT = new EnvService("REACT_APP_BASE_URL_API_PRODUCT", true).getString();
@@ -13,9 +14,14 @@ export function NSListProduct(props) {
13
14
  setState({ products: products.rows });
14
15
  }).catch(() => { });
15
16
  }, []);
16
- return (_jsxs(NSSection, { style: { gap: "16px" }, children: [props.getChildrenBefore && props.getChildrenBefore(), state.products.map((product) => {
17
+ let items_before = (_b = (_a = props.getChildrenBefore) === null || _a === void 0 ? void 0 : _a.call(props)) !== null && _b !== void 0 ? _b : [];
18
+ let items_after = (_d = (_c = props.getChildrenAfter) === null || _c === void 0 ? void 0 : _c.call(props)) !== null && _d !== void 0 ? _d : [];
19
+ return (_jsxs(NSSection, { style: { gap: "16px" }, children: [SearchOperation.filter(items_before, item => { var _a; return item.title + " " + ((_a = item.description) !== null && _a !== void 0 ? _a : ""); }, (_e = props.search) !== null && _e !== void 0 ? _e : "")
20
+ .map((item, index) => _jsx(NSCard, Object.assign({}, item), "nslistproduct_nscard_before_" + index)), SearchOperation.filter(state.products, item => { var _a; return item.name + " " + ((_a = item.description) !== null && _a !== void 0 ? _a : ""); }, (_f = props.search) !== null && _f !== void 0 ? _f : "")
21
+ .map((product) => {
17
22
  var _a, _b, _c;
18
23
  return (_jsx(NSCard, { link: { href: (_a = product.link) !== null && _a !== void 0 ? _a : "" }, title: product.name, description: (_b = product.description) !== null && _b !== void 0 ? _b : "", image: { src: (_c = product.logo) !== null && _c !== void 0 ? _c : '', alt: product.name } }, product.id));
19
- }), props.getChildrenAfter && props.getChildrenAfter()] }));
24
+ }), SearchOperation.filter(items_after, item => { var _a; return item.title + " " + ((_a = item.description) !== null && _a !== void 0 ? _a : ""); }, (_g = props.search) !== null && _g !== void 0 ? _g : "")
25
+ .map((item, index) => _jsx(NSCard, Object.assign({}, item), "nslistproduct_nscard_after_" + index))] }));
20
26
  }
21
27
  //# sourceMappingURL=NSListProduct.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NSListProduct.js","sourceRoot":"","sources":["../../src/components/NSListProduct.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAkB,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAexC,MAAM,UAAU,aAAa,CAAC,KAAyB;IAEnD,MAAM,CAAC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EAGN,eAAe,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,WAAC,OAAA,IAAI,CAAC,KAAK,GAAG,GAAG,GAAG,CAAC,MAAA,IAAI,CAAC,WAAW,mCAAI,EAAE,CAAC,CAAA,EAAA,EAAE,MAAA,KAAK,CAAC,MAAM,mCAAI,EAAE,CAAC;iBACvG,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,KAAC,MAAM,oBAErB,IAAI,GADH,6BAA6B,GAAG,KAAK,CAE5C,CAAC,IAEF,CAChB,CAAC;AACN,CAAC"}
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "framework": "npm",
9
9
  "application": "package",
10
10
  "private": false,
11
- "version": "1.4.501",
11
+ "version": "1.4.502",
12
12
  "author": "Amir Abolhasani",
13
13
  "license": "MIT",
14
14
  "main": "./dist/main.js",
@@ -1,15 +1,24 @@
1
- import { useState, useEffect, ReactNode } from "react";
2
1
  import { NamirasoftAPIProductServer, ProductFullRow } from "namirasoft-api-product";
2
+ import { EnvService, SearchOperation } from 'namirasoft-core';
3
+ import { useEffect, useState } from "react";
4
+ import { IImageProps, ILinkProps } from "../main";
3
5
  import { NSCard } from "./NSCard";
4
- import { EnvService } from 'namirasoft-core'
5
6
  import { NSSection } from "./NSSection";
6
7
 
8
+ export interface NSListProductCartProps
9
+ {
10
+ title: string;
11
+ description?: string;
12
+ link: ILinkProps;
13
+ image?: IImageProps;
14
+ }
7
15
  export interface NSListProductProps
8
16
  {
9
17
  scope: string;
10
18
  name: string;
11
- getChildrenBefore?: () => ReactNode;
12
- getChildrenAfter?: () => ReactNode;
19
+ getChildrenBefore?: () => NSListProductCartProps[];
20
+ getChildrenAfter?: () => NSListProductCartProps[];
21
+ search?: string;
13
22
  }
14
23
 
15
24
  interface NSListProductState
@@ -31,25 +40,40 @@ export function NSListProduct(props: NSListProductProps)
31
40
  }).catch(() => { });
32
41
  // eslint-disable-next-line
33
42
  }, []);
43
+ let items_before: NSListProductCartProps[] = props.getChildrenBefore?.() ?? [];
44
+ let items_after: NSListProductCartProps[] = props.getChildrenAfter?.() ?? [];
34
45
 
35
46
  return (
36
47
  <NSSection style={{ gap: "16px" }}>
37
- {props.getChildrenBefore && props.getChildrenBefore()}
38
48
  {
39
- state.products.map((product: ProductFullRow) =>
40
- {
41
- return (
42
- <NSCard
43
- key={product.id}
44
- link={{ href: product.link ?? "" }}
45
- title={product.name}
46
- description={product.description ?? ""}
47
- image={{ src: product.logo ?? '', alt: product.name }}
48
- />
49
- );
50
- })
49
+ SearchOperation.filter(items_before, item => item.title + " " + (item.description ?? ""), props.search ?? "")
50
+ .map((item, index) => <NSCard
51
+ key={"nslistproduct_nscard_before_" + index}
52
+ {...item}
53
+ />)
54
+ }
55
+ {
56
+ SearchOperation.filter(state.products, item => item.name + " " + (item.description ?? ""), props.search ?? "")
57
+ .map((product: ProductFullRow) =>
58
+ {
59
+ return (
60
+ <NSCard
61
+ key={product.id}
62
+ link={{ href: product.link ?? "" }}
63
+ title={product.name}
64
+ description={product.description ?? ""}
65
+ image={{ src: product.logo ?? '', alt: product.name }}
66
+ />
67
+ );
68
+ })
69
+ }
70
+ {
71
+ SearchOperation.filter(items_after, item => item.title + " " + (item.description ?? ""), props.search ?? "")
72
+ .map((item, index) => <NSCard
73
+ key={"nslistproduct_nscard_after_" + index}
74
+ {...item}
75
+ />)
51
76
  }
52
- {props.getChildrenAfter && props.getChildrenAfter()}
53
77
  </NSSection >
54
78
  );
55
79
  }