namirasoft-site-react 1.4.301 → 1.4.303
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/App.js.map +1 -1
- package/dist/components/NSCopy.d.ts +1 -0
- package/dist/components/NSCopy.js +4 -3
- package/dist/components/NSCopy.js.map +1 -1
- package/dist/components/NSID.d.ts +11 -0
- package/dist/components/NSID.js +56 -0
- package/dist/components/NSID.js.map +1 -0
- package/dist/components/NSID.module.css +18 -0
- package/dist/components/NSLoading.js.map +1 -1
- package/dist/formatter/BaseURLImageFormatter.d.ts +1 -1
- package/dist/formatter/BaseURLImageFormatter.js.map +1 -1
- package/dist/formatter/IDFormatter.d.ts +4 -3
- package/dist/formatter/IDFormatter.js +5 -16
- package/dist/formatter/IDFormatter.js.map +1 -1
- package/dist/main.d.ts +1 -0
- package/dist/main.js +8 -0
- package/dist/main.js.map +1 -1
- package/package.json +14 -11
- package/src/App.tsx +0 -1
- package/src/components/NSCopy.tsx +3 -1
- package/src/components/NSID.module.css +18 -0
- package/src/components/NSID.tsx +79 -0
- package/src/components/NSLoading.tsx +1 -1
- package/src/formatter/BaseURLImageFormatter.tsx +1 -1
- package/src/formatter/IDFormatter.tsx +7 -23
- package/src/main.ts +14 -7
- package/tsconfig.json +43 -43
package/dist/App.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.js","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,WAAW,CAAC;AACnB,OAAO,sCAAsC,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1E,OAA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AC,CAAC,CAAA;oCACH,CAAC,CAAA,GACA,EACF,KAAC,WAAW,IACX,QAAQ,QACR,KAAK,EAAC,EAAE,GACM,IACN,EAEV,KAAC,QAAQ,cACR,KAAC,eAAe,IACf,IAAI,EAAC,EAAE,GACN,GACQ,IACA,IACD,GACV,CACH,CAAC;AACH,CAAC"}
|
|
@@ -7,12 +7,13 @@ export function NSCopy(props) {
|
|
|
7
7
|
const service = useRef(new SetTimeouService());
|
|
8
8
|
let [state, setState] = useState({ copied: false });
|
|
9
9
|
function onCopy(e) {
|
|
10
|
-
var _a, _b;
|
|
10
|
+
var _a, _b, _c;
|
|
11
11
|
e.stopPropagation();
|
|
12
12
|
if (NSCopyParent_ref.current) {
|
|
13
|
-
|
|
13
|
+
let value = (_a = props.value) !== null && _a !== void 0 ? _a : (_b = NSCopyParent_ref.current) === null || _b === void 0 ? void 0 : _b.innerText;
|
|
14
|
+
navigator.clipboard.writeText(value);
|
|
14
15
|
setState({ copied: true });
|
|
15
|
-
(
|
|
16
|
+
(_c = service.current) === null || _c === void 0 ? void 0 : _c.setTimeoutIfNotCalledAgain(() => { setState({ copied: false }); }, 3000);
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
return (_jsxs("div", { ref: NSCopyParent_ref, id: props.id, className: `d-flex align-items-center justify-content-center ${(_b = (_a = props.classList) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : ""}`, style: props.style, children: [_jsx("div", { children: props.children }), _jsx("img", { src: state.copied ? "https://static.namirasoft.com/image/concept/check/on/blue.svg" : "https://static.namirasoft.com/image/concept/copy/blue.svg", alt: 'Copy', width: 16, height: 16, onClick: onCopy, style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSCopy.js","sourceRoot":"","sources":["../../src/components/NSCopy.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAE,gBAAg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AK,CAAC,KAAK,aAElB,wBACE,KAAK,CAAC,QAAQ,GACV,EACN,cAAK,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,+DAA+D,CAAC,CAAC,CAAC,2DAA2D,EACrJ,GAAG,EAAC,MAAM,EACV,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,OAAO,EAAE,MAAM,EACf,KAAK,EAAE;oBACN,MAAM,EAAE,SAAS;oBACjB,UAAU,EAAE,KAAK;iBACjB,GACA,IACG,CACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IBaseComponentProps } from '../main';
|
|
2
|
+
import { IStorage } from 'namirasoft-core';
|
|
3
|
+
export interface NSIDProps extends IBaseComponentProps {
|
|
4
|
+
id: string;
|
|
5
|
+
storage: IStorage | null;
|
|
6
|
+
}
|
|
7
|
+
export interface NSIDState {
|
|
8
|
+
tried: boolean;
|
|
9
|
+
text?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function NSID(props: NSIDProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
};
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { useEffect, useState } from 'react';
|
|
12
|
+
import { BaseURLImageFormatter, NSCopy } from '../main';
|
|
13
|
+
import { BaseUUID, CacheService } from 'namirasoft-core';
|
|
14
|
+
import { Globe } from 'namirasoft-site-map';
|
|
15
|
+
import Styles from './NSID.module.css';
|
|
16
|
+
export function NSID(props) {
|
|
17
|
+
const [state, setState] = useState({
|
|
18
|
+
tried: false,
|
|
19
|
+
});
|
|
20
|
+
let short = BaseUUID.getShort(props.id);
|
|
21
|
+
let namirasoft = new Globe();
|
|
22
|
+
let info = namirasoft.getByShortName(short);
|
|
23
|
+
let cache = null;
|
|
24
|
+
if (props.storage)
|
|
25
|
+
cache = new CacheService(info.product.id + "-" + info.table.name, props.storage, 30, () => __awaiter(this, void 0, void 0, function* () { return "0.0.0"; }), () => __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
if (info.table.back_end.get) {
|
|
28
|
+
try {
|
|
29
|
+
let row = yield info.table.back_end.get(props.id);
|
|
30
|
+
return (_b = (_a = row.name) !== null && _a !== void 0 ? _a : row.description) !== null && _b !== void 0 ? _b : "";
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return "";
|
|
36
|
+
}));
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (cache)
|
|
39
|
+
cache.get().then(text => {
|
|
40
|
+
setState({ tried: true, text });
|
|
41
|
+
});
|
|
42
|
+
else
|
|
43
|
+
setState({ tried: true });
|
|
44
|
+
}, [props.id]);
|
|
45
|
+
let text = state.text;
|
|
46
|
+
if (!text)
|
|
47
|
+
text = props.id;
|
|
48
|
+
let formatter = new BaseURLImageFormatter();
|
|
49
|
+
return (_jsxs(NSCopy, { value: props.id, children: [!state.tried &&
|
|
50
|
+
_jsx("div", { className: Styles.ns_loader }), formatter.format({
|
|
51
|
+
text,
|
|
52
|
+
href: info.table.front_end.getViewLink(props.id + ""),
|
|
53
|
+
image: { url: info.product.logo, alt: info.product.logo }
|
|
54
|
+
})] }));
|
|
55
|
+
}
|
|
56
|
+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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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSLoading.js","sourceRoot":"","sources":["../../src/components/NSLoading.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"NSLoading.js","sourceRoot":"","sources":["../../src/components/NSLoading.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAO5C,MAAM,UAAU,SAAS,CAAC,KAAqB;;IAE9C,OAAO,CACN,eACC,EAAE,EAAE,KAAK,CAAC,EAAE,EACZ,SAAS,EAAE,GAAG,MAAM,CAAC,iBAAiB,IAAI,MAAA,MAAA,KAAK,CAAC,SAAS,0CAAE,IAAI,CAAC,GAAG,CAAC,mCAAI,EAAE,GAAG,EAC7E,KAAK,EAAE,KAAK,CAAC,KAAK,aAElB,uBAAK,MAAA,KAAK,CAAC,KAAK,mCAAI,SAAS,GAAM,EACnC,eAAM,SAAS,EAAE,MAAM,CAAC,SAAS,GAAS,EAC1C,0CAAsB,IACjB,CACN,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseURLImageFormatter.js","sourceRoot":"","sources":["../../src/formatter/BaseURLImageFormatter.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,OAAO,qBAAsB,SAAQ,mBAAmB;IAE1D,YAAY,QAAgB,OAAO;QAE/B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IACQ,MAAM,CAAC,KAIf,EAAE,
|
|
1
|
+
{"version":3,"file":"BaseURLImageFormatter.js","sourceRoot":"","sources":["../../src/formatter/BaseURLImageFormatter.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,OAAO,qBAAsB,SAAQ,mBAAmB;IAE1D,YAAY,QAAgB,OAAO;QAE/B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IACQ,MAAM,CAAC,KAIf,EAAE,CAAmB,EAAE,EAAsB,EAAE,SAAmB;QAE/D,IAAI,CAAC,SAAS,EACd,CAAC;YACG,OAAO,CACH,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,aACjD,cAAK,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAI,YAE7F,YAAG,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAC,QAAQ,EAAC,GAAG,EAAC,YAAY,YAAE,KAAK,CAAC,IAAI,GAAK,IACnE,CACV,CAAC;QACN,CAAC;QACD,OAAO,KAAK,CAAC,IAAI,CAAC;IACtB,CAAC;CACJ"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { IStorage } from "namirasoft-core";
|
|
1
2
|
import { BaseColumnFormatter } from "./BaseColumnFormatter";
|
|
2
3
|
import { TableColumnInfo, TableRowInfo } from "../components/NSTable";
|
|
3
4
|
export declare class IDFormatter extends BaseColumnFormatter {
|
|
4
|
-
private
|
|
5
|
-
constructor(width?: string);
|
|
6
|
-
format(value: any,
|
|
5
|
+
private storage;
|
|
6
|
+
constructor(storage: IStorage | null, width?: string);
|
|
7
|
+
format(value: any, _: TableColumnInfo, __: TableRowInfo<any>, printable: boolean): any;
|
|
7
8
|
}
|
|
@@ -1,28 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { BaseUUID } from "namirasoft-core";
|
|
3
2
|
import { BaseColumnFormatter } from "./BaseColumnFormatter";
|
|
4
|
-
import {
|
|
5
|
-
import { BaseURLImageFormatter } from "./BaseURLImageFormatter";
|
|
6
|
-
import { NSCopy } from "../main";
|
|
3
|
+
import { NSID } from "../components/NSID";
|
|
7
4
|
export class IDFormatter extends BaseColumnFormatter {
|
|
8
|
-
constructor(width = "224px") {
|
|
5
|
+
constructor(storage, width = "224px") {
|
|
9
6
|
super();
|
|
10
|
-
this.
|
|
7
|
+
this.storage = storage;
|
|
11
8
|
this.onclick_overrided = true;
|
|
12
9
|
this.width = width;
|
|
13
10
|
}
|
|
14
|
-
format(value,
|
|
11
|
+
format(value, _, __, printable) {
|
|
15
12
|
try {
|
|
16
13
|
if (!printable)
|
|
17
|
-
|
|
18
|
-
let short = BaseUUID.getShort(value);
|
|
19
|
-
let info = Globe.namirasoft.getByShortName(short);
|
|
20
|
-
return (_jsx(NSCopy, { children: this.formatter.format({
|
|
21
|
-
text: value,
|
|
22
|
-
href: info.table.front_end.getViewLink(value + ""),
|
|
23
|
-
image: { url: info.product.logo, alt: info.product.logo }
|
|
24
|
-
}, column, row, printable) }));
|
|
25
|
-
}
|
|
14
|
+
return _jsx(NSID, { id: value, storage: this.storage });
|
|
26
15
|
}
|
|
27
16
|
catch (error) {
|
|
28
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IDFormatter.js","sourceRoot":"","sources":["../../src/formatter/IDFormatter.tsx"],"names":[],"mappings":";
|
|
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;AAE1C,MAAM,OAAO,WAAY,SAAQ,mBAAmB;IAIhD,YAAY,OAAwB,EAAE,QAAgB,OAAO;QAEzD,KAAK,EAAE,CAAC;QACR,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,OAAO,EAAE,IAAI,CAAC,OAAO,GAAS,CAAC;QAC/D,CAAC;QAAC,OAAO,KAAK,EACd,CAAC;QACD,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ"}
|
package/dist/main.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export * from "./components/NSFilterBox";
|
|
|
59
59
|
export * from "./components/NSFilterItem";
|
|
60
60
|
export * from "./components/NSFooter";
|
|
61
61
|
export * from "./components/NSHeader";
|
|
62
|
+
export * from "./components/NSID";
|
|
62
63
|
export * from "./components/NSLabel";
|
|
63
64
|
export * from "./components/NSLabelErrorNotifier";
|
|
64
65
|
export * from "./components/NSLayout";
|
package/dist/main.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NSBaseMetaDatabase } from "namirasoft-site";
|
|
1
2
|
export * from "./components/NSBarAction";
|
|
2
3
|
export * from "./components/NSBarAlert";
|
|
3
4
|
export * from "./components/NSBarNotification";
|
|
@@ -59,6 +60,7 @@ export * from "./components/NSFilterBox";
|
|
|
59
60
|
export * from "./components/NSFilterItem";
|
|
60
61
|
export * from "./components/NSFooter";
|
|
61
62
|
export * from "./components/NSHeader";
|
|
63
|
+
export * from "./components/NSID";
|
|
62
64
|
export * from "./components/NSLabel";
|
|
63
65
|
export * from "./components/NSLabelErrorNotifier";
|
|
64
66
|
export * from "./components/NSLayout";
|
|
@@ -131,4 +133,10 @@ export * from "./routing/NSRouterMaker";
|
|
|
131
133
|
export * from "./Validator";
|
|
132
134
|
export * from "./NSBoxBuilder";
|
|
133
135
|
export * from "./CopyToClipboard";
|
|
136
|
+
function main() {
|
|
137
|
+
NSBaseMetaDatabase.getServerBaseURL = function (name) {
|
|
138
|
+
return `REACT_APP_BASE_URL_${name.toUpperCase()}`;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
main();
|
|
134
142
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AAGxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,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AAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AAGzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAG/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AAExC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAElC,SAAS,IAAI;IAET,kBAAkB,CAAC,gBAAgB,GAAG,UAAU,IAAY;QAExD,OAAO,sBAAsB,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;IACtD,CAAC,CAAA;AACL,CAAC;AAED,IAAI,EAAE,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.
|
|
11
|
+
"version": "1.4.303",
|
|
12
12
|
"author": "Amir Abolhasani",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"main": "./dist/main.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@ant-design/charts": "^2.2.6",
|
|
25
25
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
|
26
|
-
"@types/node": "^22.13.
|
|
26
|
+
"@types/node": "^22.13.10",
|
|
27
27
|
"@types/react": "^18.3.12",
|
|
28
28
|
"@types/react-bootstrap": "^0.32.37",
|
|
29
29
|
"@types/react-dom": "^18.3.1",
|
|
@@ -32,11 +32,12 @@
|
|
|
32
32
|
"chart.js": "^4.4.8",
|
|
33
33
|
"copyfiles": "^2.4.1",
|
|
34
34
|
"link-react": "^3.0.0",
|
|
35
|
-
"namirasoft-api-link": "^1.4.
|
|
36
|
-
"namirasoft-api-product": "^1.4.
|
|
37
|
-
"namirasoft-core": "^1.4.
|
|
35
|
+
"namirasoft-api-link": "^1.4.13",
|
|
36
|
+
"namirasoft-api-product": "^1.4.19",
|
|
37
|
+
"namirasoft-core": "^1.4.53",
|
|
38
38
|
"namirasoft-schema": "^1.4.25",
|
|
39
|
-
"namirasoft-site
|
|
39
|
+
"namirasoft-site": "^1.4.24",
|
|
40
|
+
"namirasoft-site-map": "^1.4.15",
|
|
40
41
|
"os-browserify": "^0.3.0",
|
|
41
42
|
"path-browserify": "^1.0.1",
|
|
42
43
|
"react": "^18.3.1",
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
"react-dom": "^18.3.1",
|
|
47
48
|
"react-phone-input-2": "^2.15.1",
|
|
48
49
|
"react-phone-number-input": "^3.4.12",
|
|
49
|
-
"react-router-dom": "^7.
|
|
50
|
+
"react-router-dom": "^7.3.0",
|
|
50
51
|
"react-scripts": "^5.0.1",
|
|
51
52
|
"styled-components": "^6.1.15",
|
|
52
53
|
"xlsx": "^0.18.5"
|
|
@@ -57,10 +58,12 @@
|
|
|
57
58
|
"react-app/jest"
|
|
58
59
|
]
|
|
59
60
|
},
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
|
|
61
|
+
"ns-psc": {
|
|
62
|
+
"skip": {
|
|
63
|
+
"download": {
|
|
64
|
+
"tsconfig": true
|
|
65
|
+
}
|
|
66
|
+
}
|
|
64
67
|
},
|
|
65
68
|
"browserslist": {
|
|
66
69
|
"production": [
|
package/src/App.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import { SetTimeouService } from "namirasoft-core";
|
|
|
5
5
|
export interface NSCopyProps extends IBaseComponentProps
|
|
6
6
|
{
|
|
7
7
|
children: React.ReactNode;
|
|
8
|
+
value?: string;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export interface NSCopyState
|
|
@@ -25,7 +26,8 @@ export function NSCopy(props: NSCopyProps)
|
|
|
25
26
|
|
|
26
27
|
if (NSCopyParent_ref.current)
|
|
27
28
|
{
|
|
28
|
-
|
|
29
|
+
let value = props.value ?? NSCopyParent_ref.current?.innerText;
|
|
30
|
+
navigator.clipboard.writeText(value);
|
|
29
31
|
|
|
30
32
|
setState({ copied: true });
|
|
31
33
|
service.current?.setTimeoutIfNotCalledAgain(() => { setState({ copied: false }) }, 3000);
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { BaseURLImageFormatter, IBaseComponentProps, NSCopy } from '../main';
|
|
3
|
+
import { BaseUUID, CacheService, IStorage } from 'namirasoft-core';
|
|
4
|
+
import { Globe } from 'namirasoft-site-map';
|
|
5
|
+
import Styles from './NSID.module.css';
|
|
6
|
+
|
|
7
|
+
export interface NSIDProps extends IBaseComponentProps
|
|
8
|
+
{
|
|
9
|
+
id: string;
|
|
10
|
+
storage: IStorage | null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface NSIDState
|
|
14
|
+
{
|
|
15
|
+
tried: boolean;
|
|
16
|
+
text?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function NSID(props: NSIDProps)
|
|
20
|
+
{
|
|
21
|
+
const [state, setState] = useState<NSIDState>({
|
|
22
|
+
tried: false,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
let short = BaseUUID.getShort(props.id);
|
|
26
|
+
let namirasoft = new Globe();
|
|
27
|
+
let info = namirasoft.getByShortName(short);
|
|
28
|
+
let cache = null;
|
|
29
|
+
if (props.storage)
|
|
30
|
+
cache = new CacheService<string>(info.product.id + "-" + info.table.name, props.storage, 30, async () => "0.0.0", async () =>
|
|
31
|
+
{
|
|
32
|
+
if (info.table.back_end.get)
|
|
33
|
+
{
|
|
34
|
+
try
|
|
35
|
+
{
|
|
36
|
+
let row = await info.table.back_end.get(props.id);
|
|
37
|
+
return row.name ?? row.description ?? "";
|
|
38
|
+
} catch (error)
|
|
39
|
+
{
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return "";
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
useEffect(() =>
|
|
46
|
+
{
|
|
47
|
+
if (cache)
|
|
48
|
+
cache.get().then(text =>
|
|
49
|
+
{
|
|
50
|
+
setState({ tried: true, text });
|
|
51
|
+
});
|
|
52
|
+
else
|
|
53
|
+
setState({ tried: true });
|
|
54
|
+
}, [props.id]);
|
|
55
|
+
|
|
56
|
+
let text = state.text;
|
|
57
|
+
if (!text)
|
|
58
|
+
text = props.id;
|
|
59
|
+
|
|
60
|
+
let formatter = new BaseURLImageFormatter();
|
|
61
|
+
return (
|
|
62
|
+
<NSCopy
|
|
63
|
+
value={props.id}
|
|
64
|
+
>
|
|
65
|
+
{
|
|
66
|
+
!state.tried &&
|
|
67
|
+
<div className={Styles.ns_loader}>
|
|
68
|
+
</div>
|
|
69
|
+
}
|
|
70
|
+
{
|
|
71
|
+
formatter.format({
|
|
72
|
+
text,
|
|
73
|
+
href: info.table.front_end.getViewLink(props.id + ""),
|
|
74
|
+
image: { url: info.product.logo, alt: info.product.logo }
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
</NSCopy>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
@@ -12,7 +12,7 @@ export class BaseURLImageFormatter extends BaseColumnFormatter
|
|
|
12
12
|
text: any,
|
|
13
13
|
image: { url: string, alt: string },
|
|
14
14
|
href: string
|
|
15
|
-
}, _
|
|
15
|
+
}, _?: TableColumnInfo, __?: TableRowInfo<any>, printable?: boolean): any
|
|
16
16
|
{
|
|
17
17
|
if (!printable)
|
|
18
18
|
{
|
|
@@ -1,41 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IStorage } from "namirasoft-core";
|
|
2
2
|
import { BaseColumnFormatter } from "./BaseColumnFormatter";
|
|
3
|
-
import { Globe } from "namirasoft-site-map";
|
|
4
3
|
import { TableColumnInfo, TableRowInfo } from "../components/NSTable";
|
|
5
|
-
import {
|
|
6
|
-
import { NSCopy } from "../main";
|
|
4
|
+
import { NSID } from "../components/NSID";
|
|
7
5
|
|
|
8
6
|
export class IDFormatter extends BaseColumnFormatter
|
|
9
7
|
{
|
|
10
|
-
private
|
|
8
|
+
private storage: IStorage | null;
|
|
11
9
|
|
|
12
|
-
constructor(width: string = "224px")
|
|
10
|
+
constructor(storage: IStorage | null, width: string = "224px")
|
|
13
11
|
{
|
|
14
12
|
super();
|
|
13
|
+
this.storage = storage;
|
|
15
14
|
this.onclick_overrided = true;
|
|
16
15
|
this.width = width;
|
|
17
16
|
}
|
|
18
|
-
override format(value: any,
|
|
17
|
+
override format(value: any, _: TableColumnInfo, __: TableRowInfo<any>, printable: boolean): any
|
|
19
18
|
{
|
|
20
19
|
try
|
|
21
20
|
{
|
|
22
21
|
if (!printable)
|
|
23
|
-
|
|
24
|
-
{
|
|
25
|
-
let short = BaseUUID.getShort(value);
|
|
26
|
-
let info = Globe.namirasoft.getByShortName(short);
|
|
27
|
-
return (
|
|
28
|
-
<NSCopy>
|
|
29
|
-
{
|
|
30
|
-
this.formatter.format({
|
|
31
|
-
text: value,
|
|
32
|
-
href: info.table.front_end.getViewLink(value + ""),
|
|
33
|
-
image: { url: info.product.logo, alt: info.product.logo }
|
|
34
|
-
}, column, row, printable)
|
|
35
|
-
}
|
|
36
|
-
</NSCopy>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
22
|
+
return <NSID id={value} storage={this.storage}></NSID>;
|
|
39
23
|
} catch (error)
|
|
40
24
|
{
|
|
41
25
|
}
|
package/src/main.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { NSBaseMetaDatabase } from "namirasoft-site";
|
|
2
|
+
|
|
1
3
|
// Bar
|
|
2
4
|
export * from "./components/NSBarAction";
|
|
3
5
|
export * from "./components/NSBarAlert";
|
|
@@ -85,6 +87,9 @@ export * from "./components/NSFooter";
|
|
|
85
87
|
// Header
|
|
86
88
|
export * from "./components/NSHeader";
|
|
87
89
|
|
|
90
|
+
// ID
|
|
91
|
+
export * from "./components/NSID";
|
|
92
|
+
|
|
88
93
|
// Label
|
|
89
94
|
export * from "./components/NSLabel";
|
|
90
95
|
export * from "./components/NSLabelErrorNotifier";
|
|
@@ -202,10 +207,12 @@ export * from "./Validator";
|
|
|
202
207
|
export * from "./NSBoxBuilder";
|
|
203
208
|
export * from "./CopyToClipboard";
|
|
204
209
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
function main()
|
|
211
|
+
{
|
|
212
|
+
NSBaseMetaDatabase.getServerBaseURL = function (name: string): string
|
|
213
|
+
{
|
|
214
|
+
return `REACT_APP_BASE_URL_${name.toUpperCase()}`;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
main();
|
package/tsconfig.json
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES6",
|
|
4
|
-
"jsx": "react-jsx",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"rootDir": "./src",
|
|
7
|
-
"outDir": "./dist",
|
|
8
|
-
"lib": [
|
|
9
|
-
"dom",
|
|
10
|
-
"dom.iterable",
|
|
11
|
-
"esnext"
|
|
12
|
-
],
|
|
13
|
-
"allowJs": false,
|
|
14
|
-
"checkJs": false,
|
|
15
|
-
"strict": true,
|
|
16
|
-
"esModuleInterop": true,
|
|
17
|
-
"sourceMap": true,
|
|
18
|
-
"resolveJsonModule": true,
|
|
19
|
-
"declaration": true,
|
|
20
|
-
"noUnusedLocals": true,
|
|
21
|
-
"noUnusedParameters": true,
|
|
22
|
-
"noImplicitAny": true,
|
|
23
|
-
"noImplicitOverride": true,
|
|
24
|
-
"noImplicitReturns": true,
|
|
25
|
-
"noImplicitThis": true,
|
|
26
|
-
"skipLibCheck": true,
|
|
27
|
-
"allowSyntheticDefaultImports": true,
|
|
28
|
-
"forceConsistentCasingInFileNames": true,
|
|
29
|
-
"noFallthroughCasesInSwitch": true,
|
|
30
|
-
"isolatedModules": false,
|
|
31
|
-
"removeComments": true
|
|
32
|
-
},
|
|
33
|
-
"include": [
|
|
34
|
-
"src",
|
|
35
|
-
"build/types/**/*.ts"
|
|
36
|
-
],
|
|
37
|
-
"exclude": [
|
|
38
|
-
"node_modules",
|
|
39
|
-
"build",
|
|
40
|
-
"dist",
|
|
41
|
-
"static",
|
|
42
|
-
"public"
|
|
43
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES6",
|
|
4
|
+
"jsx": "react-jsx",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"rootDir": "./src",
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"lib": [
|
|
9
|
+
"dom",
|
|
10
|
+
"dom.iterable",
|
|
11
|
+
"esnext"
|
|
12
|
+
],
|
|
13
|
+
"allowJs": false,
|
|
14
|
+
"checkJs": false,
|
|
15
|
+
"strict": true,
|
|
16
|
+
"esModuleInterop": true,
|
|
17
|
+
"sourceMap": true,
|
|
18
|
+
"resolveJsonModule": true,
|
|
19
|
+
"declaration": true,
|
|
20
|
+
"noUnusedLocals": true,
|
|
21
|
+
"noUnusedParameters": true,
|
|
22
|
+
"noImplicitAny": true,
|
|
23
|
+
"noImplicitOverride": true,
|
|
24
|
+
"noImplicitReturns": true,
|
|
25
|
+
"noImplicitThis": true,
|
|
26
|
+
"skipLibCheck": true,
|
|
27
|
+
"allowSyntheticDefaultImports": true,
|
|
28
|
+
"forceConsistentCasingInFileNames": true,
|
|
29
|
+
"noFallthroughCasesInSwitch": true,
|
|
30
|
+
"isolatedModules": false,
|
|
31
|
+
"removeComments": true
|
|
32
|
+
},
|
|
33
|
+
"include": [
|
|
34
|
+
"src",
|
|
35
|
+
"build/types/**/*.ts"
|
|
36
|
+
],
|
|
37
|
+
"exclude": [
|
|
38
|
+
"node_modules",
|
|
39
|
+
"build",
|
|
40
|
+
"dist",
|
|
41
|
+
"static",
|
|
42
|
+
"public"
|
|
43
|
+
]
|
|
44
44
|
}
|