namirasoft-site-react 1.4.390 → 1.4.392
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/NSBoxBoolean.d.ts +2 -1
- package/dist/components/NSBoxBoolean.js +1 -1
- package/dist/components/NSBoxBoolean.js.map +1 -1
- package/dist/components/NSID.d.ts +29 -3
- package/dist/components/NSID.js +45 -28
- package/dist/components/NSID.js.map +1 -1
- package/dist/formatter/IDFormatter.js +1 -1
- package/dist/formatter/IDFormatter.js.map +1 -1
- package/package.json +3 -3
- package/src/components/NSBoxBoolean.tsx +5 -2
- package/src/components/NSID.tsx +67 -42
- package/src/formatter/IDFormatter.tsx +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
2
|
import { IBaseComponentProps } from "../props/IBaseComponentProps";
|
|
3
3
|
import { IValidationProps } from "../props/IValidationProps";
|
|
4
4
|
import { INSBoxBaseLayoutProps, NSBoxBaseLayout } from "./NSBoxBaseLayout";
|
|
@@ -7,6 +7,7 @@ export interface NSBoxBooleanProps extends IBaseComponentProps, IValidationProps
|
|
|
7
7
|
checked?: (boolean | null);
|
|
8
8
|
label?: IBaseComponentProps;
|
|
9
9
|
input?: IBaseComponentProps;
|
|
10
|
+
children?: ReactNode;
|
|
10
11
|
}
|
|
11
12
|
export interface NSBoxBooleanState {
|
|
12
13
|
value: boolean | null;
|
|
@@ -66,7 +66,7 @@ export class NSBoxBoolean extends React.Component {
|
|
|
66
66
|
render() {
|
|
67
67
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
68
68
|
let menu = safeMenuMenuItem(this.props, () => { });
|
|
69
|
-
return (_jsx(NSBoxBaseLayout, Object.assign({ ref: this.NSBoxBaseLayout_Main }, this.props, { title: "", menu: menu, children: _jsxs("label", { id: (_a = this.props.label) === null || _a === void 0 ? void 0 : _a.id, className: `ns-font-16-normal ${Styles.ns_box_boolean_label} ${(_d = (_c = (_b = this.props.label) === null || _b === void 0 ? void 0 : _b.classList) === null || _c === void 0 ? void 0 : _c.join(" ")) !== null && _d !== void 0 ? _d : ""}`, style: (_e = this.props.label) === null || _e === void 0 ? void 0 : _e.style, htmlFor: this.props.name, children: [_jsx("input", { id: (_f = this.props.input) === null || _f === void 0 ? void 0 : _f.id, name: (_g = this.props.input) === null || _g === void 0 ? void 0 : _g.name, type: "checkbox", className: `${Styles.ns_box_boolean_input} ${this.state.value == null ? Styles.ns_box_boolean_indeterminate : ""} ${(_k = (_j = (_h = this.props.input) === null || _h === void 0 ? void 0 : _h.classList) === null || _j === void 0 ? void 0 : _j.join(" ")) !== null && _k !== void 0 ? _k : ""}`, checked: (_l = this.state.value) !== null && _l !== void 0 ? _l : false, onChange: e => this.setValue(e.target.checked), onClick: () => { var _a, _b; (_b = (_a = this.props).onClicked) === null || _b === void 0 ? void 0 : _b.call(_a, this); }, style: (_m = this.props.input) === null || _m === void 0 ? void 0 : _m.style }), _jsx("span", { style: { width: "0px" } }), this.props.hideHeader && this.props.required && _jsx("span", { style: { color: "red" }, children: "*" }), this.props.title] }) })));
|
|
69
|
+
return (_jsx(NSBoxBaseLayout, Object.assign({ ref: this.NSBoxBaseLayout_Main }, this.props, { title: "", menu: menu, children: _jsxs("label", { id: (_a = this.props.label) === null || _a === void 0 ? void 0 : _a.id, className: `ns-font-16-normal ${Styles.ns_box_boolean_label} ${(_d = (_c = (_b = this.props.label) === null || _b === void 0 ? void 0 : _b.classList) === null || _c === void 0 ? void 0 : _c.join(" ")) !== null && _d !== void 0 ? _d : ""}`, style: (_e = this.props.label) === null || _e === void 0 ? void 0 : _e.style, htmlFor: this.props.name, children: [_jsx("input", { id: (_f = this.props.input) === null || _f === void 0 ? void 0 : _f.id, name: (_g = this.props.input) === null || _g === void 0 ? void 0 : _g.name, type: "checkbox", className: `${Styles.ns_box_boolean_input} ${this.state.value == null ? Styles.ns_box_boolean_indeterminate : ""} ${(_k = (_j = (_h = this.props.input) === null || _h === void 0 ? void 0 : _h.classList) === null || _j === void 0 ? void 0 : _j.join(" ")) !== null && _k !== void 0 ? _k : ""}`, checked: (_l = this.state.value) !== null && _l !== void 0 ? _l : false, onChange: e => this.setValue(e.target.checked), onClick: () => { var _a, _b; (_b = (_a = this.props).onClicked) === null || _b === void 0 ? void 0 : _b.call(_a, this); }, style: (_m = this.props.input) === null || _m === void 0 ? void 0 : _m.style, children: this.props.children }), _jsx("span", { style: { width: "0px" } }), this.props.hideHeader && this.props.required && _jsx("span", { style: { color: "red" }, children: "*" }), this.props.title] }) })));
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
//# sourceMappingURL=NSBoxBoolean.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSBoxBoolean.js","sourceRoot":"","sources":["../../src/components/NSBoxBoolean.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,EAAE,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"NSBoxBoolean.js","sourceRoot":"","sources":["../../src/components/NSBoxBoolean.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,EAAE,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AACpD,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAG/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAyB,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAgBzC,MAAM,OAAO,YAAa,SAAQ,KAAK,CAAC,SAA+C;IAItF,YAAY,KAAwB;;QAEnC,KAAK,CAAC,KAAK,CAAC,CAAC;QAJN,eAAU,GAAY,KAAK,CAAC;QACpC,yBAAoB,GAAG,SAAS,EAAmB,CAAC;QAInD,IAAI,CAAC,KAAK,GAAG,EAAE,KAAK,EAAE,MAAA,MAAA,KAAK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AG,IAAI,CAAC,CAAC,CAAC,CAAC,EAChD,KAAK,EAAE,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,0CAAE,KAAK,YAE7B,IAAI,CAAC,KAAK,CAAC,QAAQ,GACb,EACR,eAAM,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAS,EACrC,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,eAAM,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,kBAAU,EACvF,IAAI,CAAC,KAAK,CAAC,KAAK,IACV,IACS,CAClB,CAAC;IACH,CAAC;CACD"}
|
|
@@ -1,19 +1,45 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IBaseComponentProps } from '../main';
|
|
3
|
-
import { IStorage } from 'namirasoft-core';
|
|
3
|
+
import { CacheService, IStorage } from 'namirasoft-core';
|
|
4
4
|
import { NamirasoftMap } from 'namirasoft-site-map';
|
|
5
|
+
import { NSBaseMetaTable, NSBaseServer } from 'namirasoft-site';
|
|
5
6
|
export interface NSIDProps extends IBaseComponentProps {
|
|
6
7
|
id: string;
|
|
7
|
-
|
|
8
|
+
map: NamirasoftMap | null;
|
|
8
9
|
storage: IStorage | null;
|
|
9
10
|
}
|
|
10
11
|
export interface NSIDState {
|
|
11
12
|
text?: string;
|
|
12
13
|
}
|
|
14
|
+
export interface NSIDInfo {
|
|
15
|
+
product: {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
headline: string;
|
|
19
|
+
description: string;
|
|
20
|
+
logo: string;
|
|
21
|
+
link: string;
|
|
22
|
+
};
|
|
23
|
+
table: NSBaseMetaTable<NSBaseServer, any>;
|
|
24
|
+
}
|
|
13
25
|
export declare class NSID extends React.Component<NSIDProps, NSIDState> {
|
|
14
26
|
private static mutex;
|
|
15
27
|
private static mutexes;
|
|
16
|
-
private info
|
|
28
|
+
private info;
|
|
29
|
+
static getKey(info: NSIDInfo, id: string): string;
|
|
30
|
+
static getInfo(id: string, map?: NamirasoftMap | null): {
|
|
31
|
+
product: {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
headline: string;
|
|
35
|
+
description: string;
|
|
36
|
+
logo: string;
|
|
37
|
+
link: string;
|
|
38
|
+
};
|
|
39
|
+
table: NSBaseMetaTable<NSBaseServer, any>;
|
|
40
|
+
} | null;
|
|
41
|
+
static getCache(info: NSIDInfo, storage: IStorage, id: string): CacheService<string>;
|
|
42
|
+
static clearID(storage: IStorage, id: string, map?: NamirasoftMap | null): void;
|
|
17
43
|
constructor(props: NSIDProps);
|
|
18
44
|
componentDidMount(): void;
|
|
19
45
|
reload(): Promise<void>;
|
package/dist/components/NSID.js
CHANGED
|
@@ -14,17 +14,54 @@ import { BaseUUID, CacheService } from 'namirasoft-core';
|
|
|
14
14
|
import { NamirasoftMap } from 'namirasoft-site-map';
|
|
15
15
|
import { Mutex } from 'async-mutex';
|
|
16
16
|
export class NSID extends React.Component {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
static getKey(info, id) {
|
|
18
|
+
return `${info.product.id}:${info.table.name}:${id}`;
|
|
19
|
+
}
|
|
20
|
+
static getInfo(id, map) {
|
|
21
21
|
try {
|
|
22
|
-
let short = BaseUUID.getShort(
|
|
23
|
-
let namriasoft =
|
|
24
|
-
|
|
22
|
+
let short = BaseUUID.getShort(id);
|
|
23
|
+
let namriasoft = map !== null && map !== void 0 ? map : new NamirasoftMap();
|
|
24
|
+
return namriasoft.getByShortName(short);
|
|
25
25
|
}
|
|
26
26
|
catch (error) {
|
|
27
27
|
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
static getCache(info, storage, id) {
|
|
31
|
+
let key = NSID.getKey(info, id);
|
|
32
|
+
return new CacheService(key, storage, 60, () => __awaiter(this, void 0, void 0, function* () { return "0.0.0"; }), () => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
if (info.table.back_end.get) {
|
|
35
|
+
try {
|
|
36
|
+
let columns = [];
|
|
37
|
+
info.table.forEachColumn(column => {
|
|
38
|
+
if (column.name.includes("name"))
|
|
39
|
+
columns.push(column.name);
|
|
40
|
+
});
|
|
41
|
+
let row = yield info.table.back_end.get(id);
|
|
42
|
+
let values = columns.map(column => row[column]).filter(x => x);
|
|
43
|
+
if (values.length > 0)
|
|
44
|
+
return values.join(" ");
|
|
45
|
+
return (_b = (_a = row.name) !== null && _a !== void 0 ? _a : row.description) !== null && _b !== void 0 ? _b : "";
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
console.error(error);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return "";
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
static clearID(storage, id, map) {
|
|
55
|
+
let info = NSID.getInfo(id, map);
|
|
56
|
+
if (info) {
|
|
57
|
+
let cache = NSID.getCache(info, storage, id);
|
|
58
|
+
cache.del();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
constructor(props) {
|
|
62
|
+
super(props);
|
|
63
|
+
this.state = {};
|
|
64
|
+
this.info = NSID.getInfo(this.props.id, this.props.map);
|
|
28
65
|
}
|
|
29
66
|
componentDidMount() {
|
|
30
67
|
this.reload();
|
|
@@ -38,27 +75,7 @@ export class NSID extends React.Component {
|
|
|
38
75
|
let info = this.info;
|
|
39
76
|
let cache = null;
|
|
40
77
|
if (this.props.storage) {
|
|
41
|
-
cache =
|
|
42
|
-
var _a, _b;
|
|
43
|
-
if (info.table.back_end.get) {
|
|
44
|
-
try {
|
|
45
|
-
let columns = [];
|
|
46
|
-
info.table.forEachColumn(column => {
|
|
47
|
-
if (column.name.includes("name"))
|
|
48
|
-
columns.push(column.name);
|
|
49
|
-
});
|
|
50
|
-
let row = yield info.table.back_end.get(this.props.id);
|
|
51
|
-
let values = columns.map(column => row[column]).filter(x => x);
|
|
52
|
-
if (values.length > 0)
|
|
53
|
-
return values.join(" ");
|
|
54
|
-
return (_b = (_a = row.name) !== null && _a !== void 0 ? _a : row.description) !== null && _b !== void 0 ? _b : "";
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
console.error(error);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return "";
|
|
61
|
-
}));
|
|
78
|
+
cache = NSID.getCache(info, this.props.storage, this.props.id);
|
|
62
79
|
cache.runGetOn = yield NSID.mutex.runExclusive(() => __awaiter(this, void 0, void 0, function* () {
|
|
63
80
|
if (!NSID.mutexes[info.product.id])
|
|
64
81
|
NSID.mutexes[info.product.id] = new Mutex();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSID.js","sourceRoot":"","sources":["../../src/components/NSID.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAuB,MAAM,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAY,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"NSID.js","sourceRoot":"","sources":["../../src/components/NSID.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAuB,MAAM,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAY,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AA0BpC,MAAM,OAAO,IAAK,SAAQ,KAAK,CAAC,SAA+B;IAKvD,MAAM,CAAC,MAAM,CAAC,IAAc,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AAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAClE,CAAC;QAAC,OAAO,KAAK,EACd,CAAC;QACD,CAAC;QACD,IAAI,SAAS,GAAG,IAAI,qBAAqB,EAAE,CAAC;QAC5C,OAAO,CACN,KAAC,MAAM,IACN,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,EACpB,SAAS,EAAE,CAAC,uBAAuB,CAAC,YAGnC,SAAS,CAAC,MAAM,CAAC;gBAChB,IAAI;gBACJ,IAAI;gBACJ,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,MAAA,IAAI,CAAC,IAAI,0CAAE,OAAO,CAAC,IAAI,EAAE;aACpE,CAAC,GAEK,CACT,CAAC;IACH,CAAC;;AA5Hc,UAAK,GAAU,IAAI,KAAK,EAAE,CAAC;AAC3B,YAAO,GAAoC,EAAE,CAAC"}
|
|
@@ -12,7 +12,7 @@ export class IDFormatter extends BaseColumnFormatter {
|
|
|
12
12
|
format(value, _, __, printable) {
|
|
13
13
|
try {
|
|
14
14
|
if (!printable)
|
|
15
|
-
return _jsx(NSID, { id: value,
|
|
15
|
+
return _jsx(NSID, { id: value, map: this.namirasoft, storage: this.storage });
|
|
16
16
|
}
|
|
17
17
|
catch (error) {
|
|
18
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IDFormatter.js","sourceRoot":"","sources":["../../src/formatter/IDFormatter.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG1C,MAAM,OAAO,WAAY,SAAQ,mBAAmB;IAKhD,YAAY,KAA2B,EAAE,OAAwB,EAAE,QAAgB,OAAO;QAEtF,K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
|
"framework": "npm",
|
|
9
9
|
"application": "package",
|
|
10
10
|
"private": false,
|
|
11
|
-
"version": "1.4.
|
|
11
|
+
"version": "1.4.392",
|
|
12
12
|
"author": "Amir Abolhasani",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"main": "./dist/main.js",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"copyfiles": "^2.4.1",
|
|
35
35
|
"link-react": "^3.0.0",
|
|
36
36
|
"namirasoft-api-link": "^1.4.15",
|
|
37
|
-
"namirasoft-api-product": "^1.4.
|
|
38
|
-
"namirasoft-core": "^1.4.
|
|
37
|
+
"namirasoft-api-product": "^1.4.27",
|
|
38
|
+
"namirasoft-core": "^1.4.76",
|
|
39
39
|
"namirasoft-schema": "^1.4.25",
|
|
40
40
|
"namirasoft-site": "^1.4.38",
|
|
41
41
|
"namirasoft-site-map": "^1.4.26",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import React, { createRef } from "react";
|
|
3
|
+
import React, { createRef, ReactNode } from "react";
|
|
4
4
|
import Styles from "./NSBoxBoolean.module.css";
|
|
5
5
|
import { IBaseComponentProps } from "../props/IBaseComponentProps";
|
|
6
6
|
import { IValidationProps } from "../props/IValidationProps";
|
|
@@ -14,6 +14,7 @@ export interface NSBoxBooleanProps extends IBaseComponentProps, IValidationProps
|
|
|
14
14
|
checked?: (boolean | null);
|
|
15
15
|
label?: IBaseComponentProps;
|
|
16
16
|
input?: IBaseComponentProps;
|
|
17
|
+
children?: ReactNode;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export interface NSBoxBooleanState
|
|
@@ -116,7 +117,9 @@ export class NSBoxBoolean extends React.Component<NSBoxBooleanProps, NSBoxBoolea
|
|
|
116
117
|
onChange={e => this.setValue(e.target.checked)}
|
|
117
118
|
onClick={() => { this.props.onClicked?.(this); }}
|
|
118
119
|
style={this.props.input?.style}
|
|
119
|
-
|
|
120
|
+
>
|
|
121
|
+
{this.props.children}
|
|
122
|
+
</input>
|
|
120
123
|
<span style={{ width: "0px" }}></span>
|
|
121
124
|
{this.props.hideHeader && this.props.required && <span style={{ color: "red" }}>*</span>}
|
|
122
125
|
{this.props.title}
|
package/src/components/NSID.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import { Mutex } from 'async-mutex';
|
|
|
8
8
|
export interface NSIDProps extends IBaseComponentProps
|
|
9
9
|
{
|
|
10
10
|
id: string;
|
|
11
|
-
|
|
11
|
+
map: NamirasoftMap | null;
|
|
12
12
|
storage: IStorage | null;
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -16,34 +16,82 @@ export interface NSIDState
|
|
|
16
16
|
{
|
|
17
17
|
text?: string;
|
|
18
18
|
}
|
|
19
|
+
export interface NSIDInfo
|
|
20
|
+
{
|
|
21
|
+
product: {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
headline: string;
|
|
25
|
+
description: string;
|
|
26
|
+
logo: string;
|
|
27
|
+
link: string;
|
|
28
|
+
};
|
|
29
|
+
table: NSBaseMetaTable<NSBaseServer, any>;
|
|
30
|
+
}
|
|
19
31
|
|
|
20
32
|
export class NSID extends React.Component<NSIDProps, NSIDState>
|
|
21
33
|
{
|
|
22
34
|
private static mutex: Mutex = new Mutex();
|
|
23
35
|
private static mutexes: { [product_id: string]: Mutex } = {};
|
|
24
|
-
private info
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
logo: string;
|
|
31
|
-
link: string;
|
|
32
|
-
};
|
|
33
|
-
table: NSBaseMetaTable<NSBaseServer, any>;
|
|
34
|
-
};
|
|
35
|
-
constructor(props: NSIDProps)
|
|
36
|
+
private info: NSIDInfo | null;
|
|
37
|
+
public static getKey(info: NSIDInfo, id: string)
|
|
38
|
+
{
|
|
39
|
+
return `${info.product.id}:${info.table.name}:${id}`
|
|
40
|
+
}
|
|
41
|
+
public static getInfo(id: string, map?: NamirasoftMap | null)
|
|
36
42
|
{
|
|
37
|
-
super(props);
|
|
38
|
-
this.state = {};
|
|
39
43
|
try
|
|
40
44
|
{
|
|
41
|
-
let short = BaseUUID.getShort(
|
|
42
|
-
let namriasoft =
|
|
43
|
-
|
|
45
|
+
let short = BaseUUID.getShort(id);
|
|
46
|
+
let namriasoft = map ?? new NamirasoftMap();
|
|
47
|
+
return namriasoft.getByShortName(short);
|
|
44
48
|
} catch (error)
|
|
45
49
|
{
|
|
46
50
|
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
public static getCache(info: NSIDInfo, storage: IStorage, id: string)
|
|
54
|
+
{
|
|
55
|
+
let key = NSID.getKey(info, id);
|
|
56
|
+
return new CacheService<string>(key, storage, 60, async () => "0.0.0", async () =>
|
|
57
|
+
{
|
|
58
|
+
if (info.table.back_end.get)
|
|
59
|
+
{
|
|
60
|
+
try
|
|
61
|
+
{
|
|
62
|
+
let columns: string[] = [];
|
|
63
|
+
info.table.forEachColumn(column =>
|
|
64
|
+
{
|
|
65
|
+
if (column.name.includes("name"))
|
|
66
|
+
columns.push(column.name);
|
|
67
|
+
});
|
|
68
|
+
let row = await info.table.back_end.get(id);
|
|
69
|
+
let values = columns.map(column => row[column]).filter(x => x);
|
|
70
|
+
if (values.length > 0)
|
|
71
|
+
return values.join(" ");
|
|
72
|
+
return row.name ?? row.description ?? "";
|
|
73
|
+
} catch (error)
|
|
74
|
+
{
|
|
75
|
+
console.error(error);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return "";
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
public static clearID(storage: IStorage, id: string, map?: NamirasoftMap | null)
|
|
82
|
+
{
|
|
83
|
+
let info = NSID.getInfo(id, map);
|
|
84
|
+
if (info)
|
|
85
|
+
{
|
|
86
|
+
let cache = NSID.getCache(info, storage, id);
|
|
87
|
+
cache.del();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
constructor(props: NSIDProps)
|
|
91
|
+
{
|
|
92
|
+
super(props);
|
|
93
|
+
this.state = {};
|
|
94
|
+
this.info = NSID.getInfo(this.props.id, this.props.map);
|
|
47
95
|
}
|
|
48
96
|
override componentDidMount(): void
|
|
49
97
|
{
|
|
@@ -59,30 +107,7 @@ export class NSID extends React.Component<NSIDProps, NSIDState>
|
|
|
59
107
|
let cache = null;
|
|
60
108
|
if (this.props.storage)
|
|
61
109
|
{
|
|
62
|
-
cache =
|
|
63
|
-
{
|
|
64
|
-
if (info.table.back_end.get)
|
|
65
|
-
{
|
|
66
|
-
try
|
|
67
|
-
{
|
|
68
|
-
let columns: string[] = [];
|
|
69
|
-
info.table.forEachColumn(column =>
|
|
70
|
-
{
|
|
71
|
-
if (column.name.includes("name"))
|
|
72
|
-
columns.push(column.name);
|
|
73
|
-
});
|
|
74
|
-
let row = await info.table.back_end.get(this.props.id);
|
|
75
|
-
let values = columns.map(column => row[column]).filter(x => x);
|
|
76
|
-
if (values.length > 0)
|
|
77
|
-
return values.join(" ");
|
|
78
|
-
return row.name ?? row.description ?? "";
|
|
79
|
-
} catch (error)
|
|
80
|
-
{
|
|
81
|
-
console.error(error);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return "";
|
|
85
|
-
});
|
|
110
|
+
cache = NSID.getCache(info, this.props.storage, this.props.id);
|
|
86
111
|
cache.runGetOn = await NSID.mutex.runExclusive(async () =>
|
|
87
112
|
{
|
|
88
113
|
if (!NSID.mutexes[info.product.id])
|
|
@@ -22,7 +22,7 @@ export class IDFormatter extends BaseColumnFormatter
|
|
|
22
22
|
try
|
|
23
23
|
{
|
|
24
24
|
if (!printable)
|
|
25
|
-
return <NSID id={value}
|
|
25
|
+
return <NSID id={value} map={this.namirasoft} storage={this.storage}></NSID>;
|
|
26
26
|
} catch (error)
|
|
27
27
|
{
|
|
28
28
|
}
|