namirasoft-site-react 1.4.389 → 1.4.391
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/NSButton.d.ts +1 -0
- package/dist/components/NSButton.js +16 -12
- package/dist/components/NSButton.js.map +1 -1
- package/dist/components/NSButtonBlue.d.ts +7 -1
- package/dist/components/NSButtonBlue.js +18 -6
- package/dist/components/NSButtonBlue.js.map +1 -1
- package/dist/components/NSButtonGreen.d.ts +7 -1
- package/dist/components/NSButtonGreen.js +18 -6
- package/dist/components/NSButtonGreen.js.map +1 -1
- package/dist/components/NSButtonRed.d.ts +7 -1
- package/dist/components/NSButtonRed.js +18 -6
- package/dist/components/NSButtonRed.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 +1 -1
- package/src/components/NSButton.tsx +18 -13
- package/src/components/NSButtonBlue.tsx +24 -9
- package/src/components/NSButtonGreen.tsx +24 -9
- package/src/components/NSButtonRed.tsx +24 -9
- package/src/components/NSID.tsx +67 -42
- package/src/formatter/IDFormatter.tsx +1 -1
|
@@ -6,24 +6,28 @@ export class NSButton extends React.Component {
|
|
|
6
6
|
constructor(props) {
|
|
7
7
|
super(props);
|
|
8
8
|
this.state = { clicked: false };
|
|
9
|
+
this.performClick = this.performClick.bind(this);
|
|
10
|
+
}
|
|
11
|
+
performClick() {
|
|
12
|
+
var _a;
|
|
13
|
+
if (this.props.onClick.showLoading !== false)
|
|
14
|
+
this.setState({ clicked: true });
|
|
15
|
+
try {
|
|
16
|
+
this.props.onClick.action(() => {
|
|
17
|
+
this.setState({ clicked: false });
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
this.setState({ clicked: false });
|
|
22
|
+
alert((_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : error);
|
|
23
|
+
}
|
|
9
24
|
}
|
|
10
25
|
render() {
|
|
11
26
|
var _a, _b;
|
|
12
27
|
if (this.state.clicked)
|
|
13
28
|
return _jsx(NSLoading, Object.assign({ small: true, hideTitle: true, hideDesciption: true }, this.props.loading));
|
|
14
29
|
return (_jsxs("button", { id: this.props.id, className: `${this.props.disabled ? Styles.ns_button_disabled : Styles.ns_button} ${(_b = (_a = this.props.classList) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : ""}`, style: this.props.style, onClick: () => {
|
|
15
|
-
|
|
16
|
-
if (this.props.onClick.showLoading !== false)
|
|
17
|
-
this.setState({ clicked: true });
|
|
18
|
-
try {
|
|
19
|
-
this.props.onClick.action(() => {
|
|
20
|
-
this.setState({ clicked: false });
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
this.setState({ clicked: false });
|
|
25
|
-
alert((_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : error);
|
|
26
|
-
}
|
|
30
|
+
this.performClick();
|
|
27
31
|
}, disabled: this.props.disabled, children: [this.props.icon && _jsx("img", Object.assign({}, this.props.icon, { alt: "Icon", width: 24, height: 24 })), this.props.title] }));
|
|
28
32
|
}
|
|
29
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSButton.js","sourceRoot":"","sources":["../../src/components/NSButton.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAG3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAkB,MAAM,aAAa,CAAC;AAsBxD,MAAM,OAAO,QAAS,SAAQ,KAAK,CAAC,SAAuC;IAEvE,YAAY,KAAoB;QAE5B,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;
|
|
1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AAI,CAAC,KAAK,CAAC,EAAE,EACrB,SAAS,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,IAAI,MAAA,MAAA,IAAI,CAAC,KAAK,CAAC,SAAS,0CAAE,IAAI,CAAC,GAAG,CAAC,mCAAI,EAAE,EAAE,EAC3H,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,OAAO,EAAE,GAAG,EAAE;gBAEV,IAAI,CAAC,YAAY,EAAE,CAAC;YACxB,CAAC,EACD,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,aAE5B,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,8BAAS,IAAI,CAAC,KAAK,CAAC,IAAI,IAAE,GAAG,EAAC,MAAM,EAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EACjF,IAAI,CAAC,KAAK,CAAC,KAAK,IACX,CACb,CAAC;IACN,CAAC;CACJ;AAAA,CAAC"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { NSButtonProps } from "./NSButton";
|
|
2
|
-
export declare
|
|
3
|
+
export declare class NSButtonBlue extends React.Component<NSButtonProps> {
|
|
4
|
+
private NSButton_Base;
|
|
5
|
+
constructor(props: NSButtonProps);
|
|
6
|
+
performClick(): void;
|
|
7
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
}
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { createRef } from "react";
|
|
2
3
|
import { NSButton } from "./NSButton";
|
|
3
4
|
import Style from "./NSButtonBlue.module.css";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export class NSButtonBlue extends React.Component {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
|
+
this.NSButton_Base = createRef();
|
|
9
|
+
this.performClick = this.performClick.bind(this);
|
|
10
|
+
}
|
|
11
|
+
performClick() {
|
|
12
|
+
var _a;
|
|
13
|
+
(_a = this.NSButton_Base.current) === null || _a === void 0 ? void 0 : _a.performClick();
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
let classList = [];
|
|
17
|
+
if (this.props.classList)
|
|
18
|
+
classList.push(...this.props.classList);
|
|
19
|
+
classList.push(Style.ns_button_blue);
|
|
20
|
+
return _jsx(NSButton, Object.assign({ ref: this.NSButton_Base }, this.props, { classList: classList }));
|
|
21
|
+
}
|
|
10
22
|
}
|
|
11
23
|
//# sourceMappingURL=NSButtonBlue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSButtonBlue.js","sourceRoot":"","sources":["../../src/components/NSButtonBlue.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,MAAM,2BAA2B,CAAC;AAE9C,MAAM,
|
|
1
|
+
{"version":3,"file":"NSButtonBlue.js","sourceRoot":"","sources":["../../src/components/NSButtonBlue.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,MAAM,2BAA2B,CAAC;AAE9C,MAAM,OAAO,YAAa,SAAQ,KAAK,CAAC,SAAwB;IAG/D,YAAY,KAAoB;QAE/B,KAAK,CAAC,KAAK,CAAC,CAAC;QAHN,kBAAa,GAAG,SAAS,EAAY,CAAC;QAI7C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;IACD,YAAY;;QAEX,MAAA,IAAI,CAAC,aAAa,CAAC,OAAO,0CAAE,YAAY,EAAE,CAAC;IAC5C,CAAC;IACQ,MAAM;QAEd,IAAI,SAAS,GAAG,EAAE,CAAA;QAClB,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS;YACvB,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACzC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAErC,OAAO,KAAC,QAAQ,kBACf,GAAG,EAAE,IAAI,CAAC,aAAa,IACnB,IAAI,CAAC,KAAK,IACd,SAAS,EAAE,SAAS,IACnB,CAAC;IACJ,CAAC;CACD"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { NSButtonProps } from "./NSButton";
|
|
2
|
-
export declare
|
|
3
|
+
export declare class NSButtonGreen extends React.Component<NSButtonProps> {
|
|
4
|
+
private NSButton_Base;
|
|
5
|
+
constructor(props: NSButtonProps);
|
|
6
|
+
performClick(): void;
|
|
7
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
}
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { createRef } from "react";
|
|
2
3
|
import { NSButton } from "./NSButton";
|
|
3
4
|
import Style from "./NSButtonGreen.module.css";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export class NSButtonGreen extends React.Component {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
|
+
this.NSButton_Base = createRef();
|
|
9
|
+
this.performClick = this.performClick.bind(this);
|
|
10
|
+
}
|
|
11
|
+
performClick() {
|
|
12
|
+
var _a;
|
|
13
|
+
(_a = this.NSButton_Base.current) === null || _a === void 0 ? void 0 : _a.performClick();
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
let classList = [];
|
|
17
|
+
if (this.props.classList)
|
|
18
|
+
classList.push(...this.props.classList);
|
|
19
|
+
classList.push(Style.ns_button_green);
|
|
20
|
+
return _jsx(NSButton, Object.assign({ ref: this.NSButton_Base }, this.props, { classList: classList }));
|
|
21
|
+
}
|
|
10
22
|
}
|
|
11
23
|
//# sourceMappingURL=NSButtonGreen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSButtonGreen.js","sourceRoot":"","sources":["../../src/components/NSButtonGreen.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,MAAM,4BAA4B,CAAC;AAE/C,MAAM,
|
|
1
|
+
{"version":3,"file":"NSButtonGreen.js","sourceRoot":"","sources":["../../src/components/NSButtonGreen.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,MAAM,4BAA4B,CAAC;AAE/C,MAAM,OAAO,aAAc,SAAQ,KAAK,CAAC,SAAwB;IAGhE,YAAY,KAAoB;QAE/B,KAAK,CAAC,KAAK,CAAC,CAAC;QAHN,kBAAa,GAAG,SAAS,EAAY,CAAC;QAI7C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;IACD,YAAY;;QAEX,MAAA,IAAI,CAAC,aAAa,CAAC,OAAO,0CAAE,YAAY,EAAE,CAAC;IAC5C,CAAC;IACQ,MAAM;QAEd,IAAI,SAAS,GAAG,EAAE,CAAA;QAClB,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS;YACvB,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACzC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAEtC,OAAO,KAAC,QAAQ,kBACf,GAAG,EAAE,IAAI,CAAC,aAAa,IACnB,IAAI,CAAC,KAAK,IACd,SAAS,EAAE,SAAS,IACnB,CAAC;IACJ,CAAC;CACD"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { NSButtonProps } from "./NSButton";
|
|
2
|
-
export declare
|
|
3
|
+
export declare class NSButtonRed extends React.Component<NSButtonProps> {
|
|
4
|
+
private NSButton_Base;
|
|
5
|
+
constructor(props: NSButtonProps);
|
|
6
|
+
performClick(): void;
|
|
7
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
}
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { createRef } from "react";
|
|
2
3
|
import { NSButton } from "./NSButton";
|
|
3
4
|
import Style from "./NSButtonRed.module.css";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export class NSButtonRed extends React.Component {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
|
+
this.NSButton_Base = createRef();
|
|
9
|
+
this.performClick = this.performClick.bind(this);
|
|
10
|
+
}
|
|
11
|
+
performClick() {
|
|
12
|
+
var _a;
|
|
13
|
+
(_a = this.NSButton_Base.current) === null || _a === void 0 ? void 0 : _a.performClick();
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
let classList = [];
|
|
17
|
+
if (this.props.classList)
|
|
18
|
+
classList.push(...this.props.classList);
|
|
19
|
+
classList.push(Style.ns_button_red);
|
|
20
|
+
return _jsx(NSButton, Object.assign({ ref: this.NSButton_Base }, this.props, { classList: classList }));
|
|
21
|
+
}
|
|
10
22
|
}
|
|
11
23
|
//# sourceMappingURL=NSButtonRed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSButtonRed.js","sourceRoot":"","sources":["../../src/components/NSButtonRed.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,MAAM,0BAA0B,CAAC;AAE7C,MAAM,
|
|
1
|
+
{"version":3,"file":"NSButtonRed.js","sourceRoot":"","sources":["../../src/components/NSButtonRed.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,MAAM,0BAA0B,CAAC;AAE7C,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,SAAwB;IAG9D,YAAY,KAAoB;QAE/B,KAAK,CAAC,KAAK,CAAC,CAAC;QAHN,kBAAa,GAAG,SAAS,EAAY,CAAC;QAI7C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;IACD,YAAY;;QAEX,MAAA,IAAI,CAAC,aAAa,CAAC,OAAO,0CAAE,YAAY,EAAE,CAAC;IAC5C,CAAC;IACQ,MAAM;QAEd,IAAI,SAAS,GAAG,EAAE,CAAA;QAClB,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS;YACvB,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACzC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAEpC,OAAO,KAAC,QAAQ,kBACf,GAAG,EAAE,IAAI,CAAC,aAAa,IACnB,IAAI,CAAC,KAAK,IACd,SAAS,EAAE,SAAS,IACnB,CAAC;IACJ,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,C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,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,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,
|
|
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,GAAG,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,GAAS,CAAC;QACrF,CAAC;QAAC,OAAO,KAAK,EACd,CAAC;QACD,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -30,6 +30,23 @@ export class NSButton extends React.Component<NSButtonProps, NSButtonState>
|
|
|
30
30
|
{
|
|
31
31
|
super(props);
|
|
32
32
|
this.state = { clicked: false };
|
|
33
|
+
this.performClick = this.performClick.bind(this);
|
|
34
|
+
}
|
|
35
|
+
performClick()
|
|
36
|
+
{
|
|
37
|
+
if (this.props.onClick.showLoading !== false)
|
|
38
|
+
this.setState({ clicked: true });
|
|
39
|
+
try
|
|
40
|
+
{
|
|
41
|
+
this.props.onClick.action(() =>
|
|
42
|
+
{
|
|
43
|
+
this.setState({ clicked: false });
|
|
44
|
+
});
|
|
45
|
+
} catch (error: any)
|
|
46
|
+
{
|
|
47
|
+
this.setState({ clicked: false });
|
|
48
|
+
alert(error?.message ?? error);
|
|
49
|
+
}
|
|
33
50
|
}
|
|
34
51
|
override render(): React.ReactNode
|
|
35
52
|
{
|
|
@@ -47,19 +64,7 @@ export class NSButton extends React.Component<NSButtonProps, NSButtonState>
|
|
|
47
64
|
style={this.props.style}
|
|
48
65
|
onClick={() =>
|
|
49
66
|
{
|
|
50
|
-
|
|
51
|
-
this.setState({ clicked: true });
|
|
52
|
-
try
|
|
53
|
-
{
|
|
54
|
-
this.props.onClick.action(() =>
|
|
55
|
-
{
|
|
56
|
-
this.setState({ clicked: false });
|
|
57
|
-
});
|
|
58
|
-
} catch (error: any)
|
|
59
|
-
{
|
|
60
|
-
this.setState({ clicked: false });
|
|
61
|
-
alert(error?.message ?? error);
|
|
62
|
-
}
|
|
67
|
+
this.performClick();
|
|
63
68
|
}}
|
|
64
69
|
disabled={this.props.disabled}
|
|
65
70
|
>
|
|
@@ -1,15 +1,30 @@
|
|
|
1
|
+
import React, { createRef } from "react";
|
|
1
2
|
import { NSButton, NSButtonProps } from "./NSButton";
|
|
2
3
|
import Style from "./NSButtonBlue.module.css";
|
|
3
4
|
|
|
4
|
-
export
|
|
5
|
+
export class NSButtonBlue extends React.Component<NSButtonProps>
|
|
5
6
|
{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
private NSButton_Base = createRef<NSButton>();
|
|
8
|
+
constructor(props: NSButtonProps)
|
|
9
|
+
{
|
|
10
|
+
super(props);
|
|
11
|
+
this.performClick = this.performClick.bind(this);
|
|
12
|
+
}
|
|
13
|
+
performClick()
|
|
14
|
+
{
|
|
15
|
+
this.NSButton_Base.current?.performClick();
|
|
16
|
+
}
|
|
17
|
+
override render()
|
|
18
|
+
{
|
|
19
|
+
let classList = []
|
|
20
|
+
if (this.props.classList)
|
|
21
|
+
classList.push(...this.props.classList);
|
|
22
|
+
classList.push(Style.ns_button_blue);
|
|
10
23
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
24
|
+
return <NSButton
|
|
25
|
+
ref={this.NSButton_Base}
|
|
26
|
+
{...this.props}
|
|
27
|
+
classList={classList}
|
|
28
|
+
/>;
|
|
29
|
+
}
|
|
15
30
|
}
|
|
@@ -1,15 +1,30 @@
|
|
|
1
|
+
import React, { createRef } from "react";
|
|
1
2
|
import { NSButton, NSButtonProps } from "./NSButton";
|
|
2
3
|
import Style from "./NSButtonGreen.module.css";
|
|
3
4
|
|
|
4
|
-
export
|
|
5
|
+
export class NSButtonGreen extends React.Component<NSButtonProps>
|
|
5
6
|
{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
private NSButton_Base = createRef<NSButton>();
|
|
8
|
+
constructor(props: NSButtonProps)
|
|
9
|
+
{
|
|
10
|
+
super(props);
|
|
11
|
+
this.performClick = this.performClick.bind(this);
|
|
12
|
+
}
|
|
13
|
+
performClick()
|
|
14
|
+
{
|
|
15
|
+
this.NSButton_Base.current?.performClick();
|
|
16
|
+
}
|
|
17
|
+
override render()
|
|
18
|
+
{
|
|
19
|
+
let classList = []
|
|
20
|
+
if (this.props.classList)
|
|
21
|
+
classList.push(...this.props.classList);
|
|
22
|
+
classList.push(Style.ns_button_green);
|
|
10
23
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
24
|
+
return <NSButton
|
|
25
|
+
ref={this.NSButton_Base}
|
|
26
|
+
{...this.props}
|
|
27
|
+
classList={classList}
|
|
28
|
+
/>;
|
|
29
|
+
}
|
|
15
30
|
}
|
|
@@ -1,15 +1,30 @@
|
|
|
1
|
+
import React, { createRef } from "react";
|
|
1
2
|
import { NSButton, NSButtonProps } from "./NSButton";
|
|
2
3
|
import Style from "./NSButtonRed.module.css";
|
|
3
4
|
|
|
4
|
-
export
|
|
5
|
+
export class NSButtonRed extends React.Component<NSButtonProps>
|
|
5
6
|
{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
private NSButton_Base = createRef<NSButton>();
|
|
8
|
+
constructor(props: NSButtonProps)
|
|
9
|
+
{
|
|
10
|
+
super(props);
|
|
11
|
+
this.performClick = this.performClick.bind(this);
|
|
12
|
+
}
|
|
13
|
+
performClick()
|
|
14
|
+
{
|
|
15
|
+
this.NSButton_Base.current?.performClick();
|
|
16
|
+
}
|
|
17
|
+
override render()
|
|
18
|
+
{
|
|
19
|
+
let classList = []
|
|
20
|
+
if (this.props.classList)
|
|
21
|
+
classList.push(...this.props.classList);
|
|
22
|
+
classList.push(Style.ns_button_red);
|
|
10
23
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
24
|
+
return <NSButton
|
|
25
|
+
ref={this.NSButton_Base}
|
|
26
|
+
{...this.props}
|
|
27
|
+
classList={classList}
|
|
28
|
+
/>;
|
|
29
|
+
}
|
|
15
30
|
}
|
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
|
}
|