namirasoft-site-react 1.4.306 → 1.4.309
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/NSID.d.ts +13 -4
- package/dist/components/NSID.js +64 -51
- package/dist/components/NSID.js.map +1 -1
- package/dist/formatter/IDFormatter.d.ts +3 -3
- package/dist/formatter/IDFormatter.js +2 -2
- package/dist/formatter/IDFormatter.js.map +1 -1
- package/package.json +4 -3
- package/src/NSBoxBuilder.tsx +1 -1
- package/src/components/NSID.tsx +85 -63
- package/src/formatter/IDFormatter.tsx +5 -5
- package/dist/components/NSID.module.css +0 -18
- package/src/components/NSID.module.css +0 -18
|
@@ -1,13 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { IBaseComponentProps } from '../main';
|
|
2
3
|
import { IStorage } from 'namirasoft-core';
|
|
3
|
-
import {
|
|
4
|
+
import { NamirasoftMap } from 'namirasoft-site-map';
|
|
4
5
|
export interface NSIDProps extends IBaseComponentProps {
|
|
5
6
|
id: string;
|
|
6
|
-
globe:
|
|
7
|
+
globe: NamirasoftMap | null;
|
|
7
8
|
storage: IStorage | null;
|
|
8
9
|
}
|
|
9
10
|
export interface NSIDState {
|
|
10
|
-
tried: boolean;
|
|
11
11
|
text?: string;
|
|
12
12
|
}
|
|
13
|
-
export declare
|
|
13
|
+
export declare class NSID extends React.Component<NSIDProps, NSIDState> {
|
|
14
|
+
private static mutex;
|
|
15
|
+
private static mutexes;
|
|
16
|
+
private namriasoft;
|
|
17
|
+
private info;
|
|
18
|
+
constructor(props: NSIDProps);
|
|
19
|
+
componentDidMount(): void;
|
|
20
|
+
reload(): Promise<void>;
|
|
21
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
}
|
package/dist/components/NSID.js
CHANGED
|
@@ -7,60 +7,73 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { jsx as _jsx
|
|
11
|
-
import
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import React from 'react';
|
|
12
12
|
import { BaseURLImageFormatter, NSCopy } from '../main';
|
|
13
13
|
import { BaseUUID, CacheService } from 'namirasoft-core';
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
14
|
+
import { NamirasoftMap } from 'namirasoft-site-map';
|
|
15
|
+
import { Mutex } from 'async-mutex';
|
|
16
|
+
export class NSID extends React.Component {
|
|
17
|
+
constructor(props) {
|
|
18
|
+
var _a;
|
|
19
|
+
super(props);
|
|
20
|
+
this.state = {};
|
|
21
|
+
let short = BaseUUID.getShort(this.props.id);
|
|
22
|
+
this.namriasoft = (_a = this.props.globe) !== null && _a !== void 0 ? _a : new NamirasoftMap();
|
|
23
|
+
this.info = this.namriasoft.getByShortName(short);
|
|
24
|
+
}
|
|
25
|
+
componentDidMount() {
|
|
26
|
+
this.reload();
|
|
27
|
+
}
|
|
28
|
+
reload() {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
let cache = null;
|
|
31
|
+
if (this.props.storage) {
|
|
32
|
+
cache = new CacheService(this.info.product.id + ":" + this.info.table.name + ":" + this.props.id, this.props.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 (this.info.table.back_end.get) {
|
|
35
|
+
try {
|
|
36
|
+
let columns = [];
|
|
37
|
+
this.info.table.forEachColumn(column => {
|
|
38
|
+
if (column.name.includes("name"))
|
|
39
|
+
columns.push(column.name);
|
|
40
|
+
});
|
|
41
|
+
let row = yield this.info.table.back_end.get(this.props.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
|
+
cache.runGetOn = yield NSID.mutex.runExclusive(() => __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
if (!NSID.mutexes[this.info.product.id])
|
|
55
|
+
NSID.mutexes[this.info.product.id] = new Mutex();
|
|
56
|
+
return NSID.mutexes[this.info.product.id];
|
|
57
|
+
}));
|
|
44
58
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
text = props.id;
|
|
58
|
-
let formatter = new BaseURLImageFormatter();
|
|
59
|
-
return (_jsxs(NSCopy, { value: props.id, children: [!state.tried &&
|
|
60
|
-
_jsx("div", { className: Styles.ns_loader }), formatter.format({
|
|
59
|
+
if (cache)
|
|
60
|
+
cache.get().then(text => {
|
|
61
|
+
this.setState({ text });
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
render() {
|
|
66
|
+
let text = this.state.text;
|
|
67
|
+
if (!text)
|
|
68
|
+
text = this.props.id;
|
|
69
|
+
let formatter = new BaseURLImageFormatter();
|
|
70
|
+
return (_jsx(NSCopy, { value: this.props.id, children: formatter.format({
|
|
61
71
|
text,
|
|
62
|
-
href: info.table.front_end.getViewLink(props.id + ""),
|
|
63
|
-
image: { url: info.product.logo, alt: info.product.logo }
|
|
64
|
-
})
|
|
72
|
+
href: this.info.table.front_end.getViewLink(this.props.id + ""),
|
|
73
|
+
image: { url: this.info.product.logo, alt: this.info.product.logo }
|
|
74
|
+
}) }));
|
|
75
|
+
}
|
|
65
76
|
}
|
|
77
|
+
NSID.mutex = new Mutex();
|
|
78
|
+
NSID.mutexes = {};
|
|
66
79
|
//# sourceMappingURL=NSID.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSID.js","sourceRoot":"","sources":["../../src/components/NSID.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,
|
|
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;AAcpC,MAAM,OAAO,IAAK,SAAQ,KAAK,CAAC,SAA+B;IAgB9D,YAAY,KAAgB;;QAE3B,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,UAAU,GAAG,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,mCAAI,IAAI,aAAa,EAAE,CAAC;QAC1D,IA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AAE,YAGnB,SAAS,CAAC,MAAM,CAAC;gBAChB,IAAI;gBACJ,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;gBAC/D,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;aACnE,CAAC,GAEK,CACT,CAAC;IACH,CAAC;;AAzFc,UAAK,GAAU,IAAI,KAAK,EAAE,CAAC;AAC3B,YAAO,GAAoC,EAAE,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { IStorage } from "namirasoft-core";
|
|
2
2
|
import { BaseColumnFormatter } from "./BaseColumnFormatter";
|
|
3
3
|
import { TableColumnInfo, TableRowInfo } from "../components/NSTable";
|
|
4
|
-
import {
|
|
4
|
+
import { NamirasoftMap } from "namirasoft-site-map";
|
|
5
5
|
export declare class IDFormatter extends BaseColumnFormatter {
|
|
6
|
-
private
|
|
6
|
+
private namirasoft;
|
|
7
7
|
private storage;
|
|
8
|
-
constructor(globe:
|
|
8
|
+
constructor(globe: NamirasoftMap | null, storage: IStorage | null, width?: string);
|
|
9
9
|
format(value: any, _: TableColumnInfo, __: TableRowInfo<any>, printable: boolean): any;
|
|
10
10
|
}
|
|
@@ -4,7 +4,7 @@ import { NSID } from "../components/NSID";
|
|
|
4
4
|
export class IDFormatter extends BaseColumnFormatter {
|
|
5
5
|
constructor(globe, storage, width = "224px") {
|
|
6
6
|
super();
|
|
7
|
-
this.
|
|
7
|
+
this.namirasoft = globe;
|
|
8
8
|
this.storage = storage;
|
|
9
9
|
this.onclick_overrided = true;
|
|
10
10
|
this.width = width;
|
|
@@ -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, globe: this.
|
|
15
|
+
return _jsx(NSID, { id: value, globe: 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,
|
|
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,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IACQ,MAAM,CAAC,KAAU,EAAE,CAAkB,EAAE,EAAqB,EAAE,SAAkB;QAErF,IACA,CAAC;YACG,IAAI,CAAC,SAAS;gBACV,OAAO,KAAC,IAAI,IAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,GAAS,CAAC;QACvF,CAAC;QAAC,OAAO,KAAK,EACd,CAAC;QACD,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"framework": "npm",
|
|
9
9
|
"application": "package",
|
|
10
10
|
"private": false,
|
|
11
|
-
"version": "1.4.
|
|
11
|
+
"version": "1.4.309",
|
|
12
12
|
"author": "Amir Abolhasani",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"main": "./dist/main.js",
|
|
@@ -28,16 +28,17 @@
|
|
|
28
28
|
"@types/react-bootstrap": "^0.32.37",
|
|
29
29
|
"@types/react-dom": "^18.3.1",
|
|
30
30
|
"antd": "^5.24.3",
|
|
31
|
+
"async-mutex": "^0.5.0",
|
|
31
32
|
"bootstrap": "^5.3.3",
|
|
32
33
|
"chart.js": "^4.4.8",
|
|
33
34
|
"copyfiles": "^2.4.1",
|
|
34
35
|
"link-react": "^3.0.0",
|
|
35
36
|
"namirasoft-api-link": "^1.4.13",
|
|
36
37
|
"namirasoft-api-product": "^1.4.19",
|
|
37
|
-
"namirasoft-core": "^1.4.
|
|
38
|
+
"namirasoft-core": "^1.4.54",
|
|
38
39
|
"namirasoft-schema": "^1.4.25",
|
|
39
40
|
"namirasoft-site": "^1.4.24",
|
|
40
|
-
"namirasoft-site-map": "^1.4.
|
|
41
|
+
"namirasoft-site-map": "^1.4.16",
|
|
41
42
|
"os-browserify": "^0.3.0",
|
|
42
43
|
"path-browserify": "^1.0.1",
|
|
43
44
|
"react": "^18.3.1",
|
package/src/NSBoxBuilder.tsx
CHANGED
|
@@ -760,7 +760,7 @@ export class NSBoxBuilder extends BaseTypeBuilder<React.JSX.Element | null>
|
|
|
760
760
|
|
|
761
761
|
getItems={async () =>
|
|
762
762
|
{
|
|
763
|
-
// let product =
|
|
763
|
+
// let product = NamirasoftMap.namirasoft.getByProductID(schema.product);
|
|
764
764
|
// product.meta.tables[schema.table];
|
|
765
765
|
// product.server.List;
|
|
766
766
|
// todo
|
package/src/components/NSID.tsx
CHANGED
|
@@ -1,90 +1,112 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { BaseURLImageFormatter, IBaseComponentProps, NSCopy } from '../main';
|
|
3
3
|
import { BaseUUID, CacheService, IStorage } from 'namirasoft-core';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
4
|
+
import { NamirasoftMap } from 'namirasoft-site-map';
|
|
5
|
+
import { NSBaseMetaTable, NSBaseServer } from 'namirasoft-site';
|
|
6
|
+
import { Mutex } from 'async-mutex';
|
|
6
7
|
|
|
7
8
|
export interface NSIDProps extends IBaseComponentProps
|
|
8
9
|
{
|
|
9
10
|
id: string;
|
|
10
|
-
globe:
|
|
11
|
+
globe: NamirasoftMap | null;
|
|
11
12
|
storage: IStorage | null;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export interface NSIDState
|
|
15
16
|
{
|
|
16
|
-
tried: boolean;
|
|
17
17
|
text?: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export
|
|
20
|
+
export class NSID extends React.Component<NSIDProps, NSIDState>
|
|
21
21
|
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
private static mutex: Mutex = new Mutex();
|
|
23
|
+
private static mutexes: { [product_id: string]: Mutex } = {};
|
|
24
|
+
private namriasoft: NamirasoftMap;
|
|
25
|
+
private info: {
|
|
26
|
+
product: {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
headline: string;
|
|
30
|
+
description: string;
|
|
31
|
+
logo: string;
|
|
32
|
+
link: string;
|
|
33
|
+
};
|
|
34
|
+
table: NSBaseMetaTable<NSBaseServer, any>;
|
|
35
|
+
};
|
|
36
|
+
constructor(props: NSIDProps)
|
|
37
|
+
{
|
|
38
|
+
super(props);
|
|
39
|
+
this.state = {};
|
|
40
|
+
let short = BaseUUID.getShort(this.props.id);
|
|
41
|
+
this.namriasoft = this.props.globe ?? new NamirasoftMap();
|
|
42
|
+
this.info = this.namriasoft.getByShortName(short);
|
|
43
|
+
}
|
|
44
|
+
override componentDidMount(): void
|
|
45
|
+
{
|
|
46
|
+
this.reload();
|
|
47
|
+
}
|
|
48
|
+
async reload()
|
|
49
|
+
{
|
|
50
|
+
let cache = null;
|
|
51
|
+
if (this.props.storage)
|
|
32
52
|
{
|
|
33
|
-
|
|
53
|
+
cache = new CacheService<string>(this.info.product.id + ":" + this.info.table.name + ":" + this.props.id, this.props.storage, 60, async () => "0.0.0", async () =>
|
|
34
54
|
{
|
|
35
|
-
|
|
55
|
+
if (this.info.table.back_end.get)
|
|
36
56
|
{
|
|
37
|
-
|
|
38
|
-
info.table.forEachColumn(column =>
|
|
57
|
+
try
|
|
39
58
|
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
59
|
+
let columns: string[] = [];
|
|
60
|
+
this.info.table.forEachColumn(column =>
|
|
61
|
+
{
|
|
62
|
+
if (column.name.includes("name"))
|
|
63
|
+
columns.push(column.name);
|
|
64
|
+
});
|
|
65
|
+
let row = await this.info.table.back_end.get(this.props.id);
|
|
66
|
+
let values = columns.map(column => row[column]).filter(x => x);
|
|
67
|
+
if (values.length > 0)
|
|
68
|
+
return values.join(" ");
|
|
69
|
+
return row.name ?? row.description ?? "";
|
|
70
|
+
} catch (error)
|
|
71
|
+
{
|
|
72
|
+
console.error(error);
|
|
73
|
+
}
|
|
51
74
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
75
|
+
return "";
|
|
76
|
+
});
|
|
77
|
+
cache.runGetOn = await NSID.mutex.runExclusive(async () =>
|
|
78
|
+
{
|
|
79
|
+
if (!NSID.mutexes[this.info.product.id])
|
|
80
|
+
NSID.mutexes[this.info.product.id] = new Mutex();
|
|
81
|
+
return NSID.mutexes[this.info.product.id];
|
|
82
|
+
});
|
|
83
|
+
}
|
|
58
84
|
if (cache)
|
|
59
85
|
cache.get().then(text =>
|
|
60
86
|
{
|
|
61
|
-
setState({
|
|
87
|
+
this.setState({ text });
|
|
62
88
|
});
|
|
63
|
-
|
|
64
|
-
setState({ tried: true });
|
|
65
|
-
}, [props.id]);
|
|
89
|
+
}
|
|
66
90
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
text =
|
|
91
|
+
override render()
|
|
92
|
+
{
|
|
93
|
+
let text = this.state.text;
|
|
94
|
+
if (!text)
|
|
95
|
+
text = this.props.id;
|
|
70
96
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
})
|
|
87
|
-
}
|
|
88
|
-
</NSCopy>
|
|
89
|
-
);
|
|
97
|
+
let formatter = new BaseURLImageFormatter();
|
|
98
|
+
return (
|
|
99
|
+
<NSCopy
|
|
100
|
+
value={this.props.id}
|
|
101
|
+
>
|
|
102
|
+
{
|
|
103
|
+
formatter.format({
|
|
104
|
+
text,
|
|
105
|
+
href: this.info.table.front_end.getViewLink(this.props.id + ""),
|
|
106
|
+
image: { url: this.info.product.logo, alt: this.info.product.logo }
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
</NSCopy>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
90
112
|
}
|
|
@@ -2,17 +2,17 @@ import { IStorage } from "namirasoft-core";
|
|
|
2
2
|
import { BaseColumnFormatter } from "./BaseColumnFormatter";
|
|
3
3
|
import { TableColumnInfo, TableRowInfo } from "../components/NSTable";
|
|
4
4
|
import { NSID } from "../components/NSID";
|
|
5
|
-
import {
|
|
5
|
+
import { NamirasoftMap } from "namirasoft-site-map";
|
|
6
6
|
|
|
7
7
|
export class IDFormatter extends BaseColumnFormatter
|
|
8
8
|
{
|
|
9
|
-
private
|
|
9
|
+
private namirasoft: NamirasoftMap | null;
|
|
10
10
|
private storage: IStorage | null;
|
|
11
11
|
|
|
12
|
-
constructor(globe:
|
|
12
|
+
constructor(globe: NamirasoftMap | null, storage: IStorage | null, width: string = "224px")
|
|
13
13
|
{
|
|
14
14
|
super();
|
|
15
|
-
this.
|
|
15
|
+
this.namirasoft = globe;
|
|
16
16
|
this.storage = storage;
|
|
17
17
|
this.onclick_overrided = true;
|
|
18
18
|
this.width = width;
|
|
@@ -22,7 +22,7 @@ export class IDFormatter extends BaseColumnFormatter
|
|
|
22
22
|
try
|
|
23
23
|
{
|
|
24
24
|
if (!printable)
|
|
25
|
-
return <NSID id={value} globe={this.
|
|
25
|
+
return <NSID id={value} globe={this.namirasoft} storage={this.storage}></NSID>;
|
|
26
26
|
} catch (error)
|
|
27
27
|
{
|
|
28
28
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
.ns_id_loader {
|
|
2
|
-
margin: 0;
|
|
3
|
-
width: 24px;
|
|
4
|
-
height: 24px;
|
|
5
|
-
border-radius: 50%;
|
|
6
|
-
background: conic-gradient(#0000 10%, #001664) content-box;
|
|
7
|
-
-webkit-mask:
|
|
8
|
-
repeating-conic-gradient(#0000 0deg, #000 1deg 20deg, #0000 21deg 36deg),
|
|
9
|
-
radial-gradient(farthest-side, #0000 calc(100% - 9px), #000 calc(100% - 8px));
|
|
10
|
-
-webkit-mask-composite: destination-in;
|
|
11
|
-
animation: rotate 1s infinite steps(10);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
@keyframes rotate {
|
|
15
|
-
to {
|
|
16
|
-
transform: rotate(1turn)
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
.ns_id_loader {
|
|
2
|
-
margin: 0;
|
|
3
|
-
width: 24px;
|
|
4
|
-
height: 24px;
|
|
5
|
-
border-radius: 50%;
|
|
6
|
-
background: conic-gradient(#0000 10%, #001664) content-box;
|
|
7
|
-
-webkit-mask:
|
|
8
|
-
repeating-conic-gradient(#0000 0deg, #000 1deg 20deg, #0000 21deg 36deg),
|
|
9
|
-
radial-gradient(farthest-side, #0000 calc(100% - 9px), #000 calc(100% - 8px));
|
|
10
|
-
-webkit-mask-composite: destination-in;
|
|
11
|
-
animation: rotate 1s infinite steps(10);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
@keyframes rotate {
|
|
15
|
-
to {
|
|
16
|
-
transform: rotate(1turn)
|
|
17
|
-
}
|
|
18
|
-
}
|