namirasoft-account-react 1.3.204 → 1.3.205
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.
|
@@ -8,6 +8,7 @@ interface NSAProductListState {
|
|
|
8
8
|
search: string;
|
|
9
9
|
}
|
|
10
10
|
export declare class NSAProductListModal extends Component<NSAProductListProps, NSAProductListState> {
|
|
11
|
+
private cache;
|
|
11
12
|
private toastRef;
|
|
12
13
|
constructor(props: NSAProductListProps);
|
|
13
14
|
componentDidMount(): void;
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
11
|
import { Component, createRef } from 'react';
|
|
3
12
|
import Styles from './NSAProductListModal.module.css';
|
|
4
13
|
import { NamirasoftAPIProductServer } from 'namirasoft-api-product';
|
|
5
14
|
import { NSBoxSearch, NSLoading } from 'namirasoft-site-react';
|
|
15
|
+
import { CacheService, IStorageLocal } from 'namirasoft-core';
|
|
6
16
|
export class NSAProductListModal extends Component {
|
|
7
17
|
constructor(props) {
|
|
8
18
|
super(props);
|
|
@@ -10,10 +20,13 @@ export class NSAProductListModal extends Component {
|
|
|
10
20
|
this.state = { products: null, search: "" };
|
|
11
21
|
this.onClickOutside = this.onClickOutside.bind(this);
|
|
12
22
|
this.onSearchChange = this.onSearchChange.bind(this);
|
|
23
|
+
this.cache = new CacheService("ns-products", 24 * 60, new IStorageLocal(), () => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
let server = new NamirasoftAPIProductServer(console.error);
|
|
25
|
+
return server.filter.ListProducts("Namirasoft Console", "Header", null, null, null);
|
|
26
|
+
}));
|
|
13
27
|
}
|
|
14
28
|
componentDidMount() {
|
|
15
|
-
|
|
16
|
-
server.filter.ListProducts("Namirasoft Console", "Header", null, null, null).then((res) => {
|
|
29
|
+
this.cache.get().then((res) => {
|
|
17
30
|
this.setState({ products: res.rows });
|
|
18
31
|
}).catch(() => { });
|
|
19
32
|
document.addEventListener('mousedown', this.onClickOutside);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSAProductListModal.js","sourceRoot":"","sources":["../../src/components/NSAProductListModal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NSAProductListModal.js","sourceRoot":"","sources":["../../src/components/NSAProductListModal.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,MAAM,MAAM,kCAAkC,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAkB,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAa9D,MAAM,OAAO,mBAAoB,SAAQ,SAAmD;IAQxF,YAAY,KAA0B;QAElC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,QAAQ,GAAG,SAAS,EAAE,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;QAC5C,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,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,CACvB,YAAG,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,EAAE,EAAE,MAAM,EAAC,QAAQ,EAAC,SAAS,EAAE,MAAM,CAAC,gBAAgB,YAC3E,0BACI,cAAK,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAC,gBAAgB,GAAG,EACpG,yBAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,GAAQ,KAFnC,OAAO,CAAC,EAAE,CAGd,GACN,CACP,CAAC,GACA,CACT,CAAC;SACL;QACD,OAAO,CACH,8BACI,cAAK,SAAS,EAAE,MAAM,CAAC,qBAAqB,EAAE,GAAG,EAAE,IAAI,CAAC,QAAQ,YAC5D,eAAK,SAAS,EAAE,MAAM,CAAC,iBAAiB,aACpC,cAAK,SAAS,EAAC,4CAA4C,GACrD,EACN,KAAC,WAAW,IAAC,KAAK,EAAC,EAAE,EAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,cAAc,GAAI,EACtG,OAAO,IACN,GACJ,EACN,cAAK,SAAS,EAAE,MAAM,CAAC,oBAAoB,GAAQ,IACpD,CACN,CAAC;IACN,CAAC;CACJ;AAED,eAAe,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"framework": "npm",
|
|
9
9
|
"application": "package",
|
|
10
10
|
"private": false,
|
|
11
|
-
"version": "1.3.
|
|
11
|
+
"version": "1.3.205",
|
|
12
12
|
"author": "Amir Abolhasani, Sepideh Mazloumi, Hooman Shashaeh",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"main": "./dist/main.js",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"namirasoft-account": "^1.3.33",
|
|
29
29
|
"namirasoft-account-client": "^1.3.0",
|
|
30
30
|
"namirasoft-api-product": "^1.3.14",
|
|
31
|
-
"namirasoft-core": "^1.3.
|
|
31
|
+
"namirasoft-core": "^1.3.71",
|
|
32
32
|
"namirasoft-field": "^1.3.9",
|
|
33
33
|
"namirasoft-message": "^1.3.17",
|
|
34
34
|
"namirasoft-project": "^1.3.15",
|
|
35
|
-
"namirasoft-site-react": "^1.3.
|
|
35
|
+
"namirasoft-site-react": "^1.3.344",
|
|
36
36
|
"os-browserify": "^0.3.0",
|
|
37
37
|
"path-browserify": "^1.0.1",
|
|
38
38
|
"process": "^0.11.10",
|
|
@@ -2,6 +2,7 @@ import React, { Component, createRef } from 'react';
|
|
|
2
2
|
import Styles from './NSAProductListModal.module.css';
|
|
3
3
|
import { NamirasoftAPIProductServer, ProductFullRow } from 'namirasoft-api-product';
|
|
4
4
|
import { NSBoxSearch, NSLoading } from 'namirasoft-site-react';
|
|
5
|
+
import { CacheService, IStorageLocal } from 'namirasoft-core';
|
|
5
6
|
|
|
6
7
|
export interface NSAProductListProps
|
|
7
8
|
{
|
|
@@ -16,6 +17,10 @@ interface NSAProductListState
|
|
|
16
17
|
|
|
17
18
|
export class NSAProductListModal extends Component<NSAProductListProps, NSAProductListState>
|
|
18
19
|
{
|
|
20
|
+
private cache: CacheService<{
|
|
21
|
+
rows: ProductFullRow[];
|
|
22
|
+
count: number;
|
|
23
|
+
}>;
|
|
19
24
|
private toastRef: React.RefObject<HTMLDivElement>;
|
|
20
25
|
|
|
21
26
|
constructor(props: NSAProductListProps)
|
|
@@ -25,12 +30,20 @@ export class NSAProductListModal extends Component<NSAProductListProps, NSAProdu
|
|
|
25
30
|
this.state = { products: null, search: "" };
|
|
26
31
|
this.onClickOutside = this.onClickOutside.bind(this);
|
|
27
32
|
this.onSearchChange = this.onSearchChange.bind(this);
|
|
33
|
+
|
|
34
|
+
this.cache = new CacheService<{
|
|
35
|
+
rows: ProductFullRow[];
|
|
36
|
+
count: number;
|
|
37
|
+
}>("ns-products", 24 * 60, new IStorageLocal(), async () =>
|
|
38
|
+
{
|
|
39
|
+
let server = new NamirasoftAPIProductServer(console.error);
|
|
40
|
+
return server.filter.ListProducts("Namirasoft Console", "Header", null, null, null);
|
|
41
|
+
});
|
|
28
42
|
}
|
|
29
43
|
|
|
30
44
|
override componentDidMount(): void
|
|
31
45
|
{
|
|
32
|
-
|
|
33
|
-
server.filter.ListProducts("Namirasoft Console", "Header", null, null, null).then((res) =>
|
|
46
|
+
this.cache.get().then((res) =>
|
|
34
47
|
{
|
|
35
48
|
this.setState({ products: res.rows });
|
|
36
49
|
}).catch(() => { });
|