namirasoft-site-react 1.4.240 → 1.4.242
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/NSBarTitle.js +3 -7
- package/dist/components/NSBarTitle.js.map +1 -1
- package/dist/formatter/StringFormatter.d.ts +1 -0
- package/dist/formatter/StringFormatter.js +15 -0
- package/dist/formatter/StringFormatter.js.map +1 -1
- package/package.json +3 -3
- package/src/components/NSBarTitle.tsx +5 -11
- package/src/formatter/{StringFormatter.ts → StringFormatter.tsx} +15 -0
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment } from 'react/jsx-runtime';
|
|
3
2
|
import Styles from './NSBarTitle.module.css';
|
|
3
|
+
import { StringFormatter } from '../main';
|
|
4
4
|
export function NSBarTitle(props) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return (_jsxs("div", { className: "container", children: [_jsx("h1", { className: Styles.title, children: props.title }), props.description && lines &&
|
|
8
|
-
_jsx("p", { className: Styles.description, children: lines.map((line, index) => {
|
|
9
|
-
return _jsxs(Fragment, { children: [line.trim(), index !== lines.length - 1 && _jsx("br", {})] }, `NSBarTitle_fragment_key_${index}`);
|
|
10
|
-
}) })] }));
|
|
5
|
+
return (_jsxs("div", { className: "container", children: [_jsx("h1", { className: Styles.title, children: props.title }), props.description &&
|
|
6
|
+
_jsx("p", { className: Styles.description, children: StringFormatter.toHTML(props.description) })] }));
|
|
11
7
|
}
|
|
12
8
|
//# sourceMappingURL=NSBarTitle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSBarTitle.js","sourceRoot":"","sources":["../../src/components/NSBarTitle.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"NSBarTitle.js","sourceRoot":"","sources":["../../src/components/NSBarTitle.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,yBAAyB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAQ1C,MAAM,UAAU,UAAU,CAAC,KAAsB;IAEhD,OAAO,CACN,eAAK,SAAS,EAAC,WAAW,aACzB,aAAI,SAAS,EAAE,MAAM,CAAC,KAAK,YAAG,KAAK,CAAC,KAAK,GAAM,EAE9C,KAAK,CAAC,WAAW;gBACjB,YAAG,SAAS,EAAE,MAAM,CAAC,WAAW,YAC/B,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,GAEtC,IAEA,CACN,CAAC;AACH,CAAC"}
|
|
@@ -8,6 +8,7 @@ export declare enum StringFormatterSizeType {
|
|
|
8
8
|
Description = "500px"
|
|
9
9
|
}
|
|
10
10
|
export declare class StringFormatter extends BaseColumnFormatter {
|
|
11
|
+
static toHTML(value: string | null | undefined): string | (string | import("react/jsx-runtime").JSX.Element)[];
|
|
11
12
|
private naming;
|
|
12
13
|
constructor(width?: string, naming?: NamingConvention | null);
|
|
13
14
|
format(value: any): any;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { NamingConvention } from "namirasoft-core";
|
|
2
3
|
import { BaseColumnFormatter } from "./BaseColumnFormatter";
|
|
3
4
|
export var StringFormatterSizeType;
|
|
@@ -9,6 +10,20 @@ export var StringFormatterSizeType;
|
|
|
9
10
|
StringFormatterSizeType["Description"] = "500px";
|
|
10
11
|
})(StringFormatterSizeType || (StringFormatterSizeType = {}));
|
|
11
12
|
export class StringFormatter extends BaseColumnFormatter {
|
|
13
|
+
static toHTML(value) {
|
|
14
|
+
var _a;
|
|
15
|
+
value = (_a = value === null || value === void 0 ? void 0 : value.trim()) !== null && _a !== void 0 ? _a : "";
|
|
16
|
+
let toks = value.split(/(\n|\\n|<br>|<br\s*\/>)/gm);
|
|
17
|
+
if (toks.length === 1)
|
|
18
|
+
return value;
|
|
19
|
+
let ans = [];
|
|
20
|
+
for (let i = 0; i < toks.length; i++) {
|
|
21
|
+
if (i > 0)
|
|
22
|
+
ans.push(_jsx("br", {}, i));
|
|
23
|
+
ans.push(toks[i].trim());
|
|
24
|
+
}
|
|
25
|
+
return ans;
|
|
26
|
+
}
|
|
12
27
|
constructor(width = StringFormatterSizeType.Sentence, naming = null) {
|
|
13
28
|
super();
|
|
14
29
|
this.width = width;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringFormatter.js","sourceRoot":"","sources":["../../src/formatter/StringFormatter.
|
|
1
|
+
{"version":3,"file":"StringFormatter.js","sourceRoot":"","sources":["../../src/formatter/StringFormatter.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,CAAN,IAAY,uBAOX;AAPD,WAAY,uBAAuB;IAE/B,wCAAa,CAAA;IACb,6CAAkB,CAAA;IAClB,6CAAkB,CAAA;IAClB,6CAAkB,CAAA;IAClB,gDAAqB,CAAA;AACzB,CAAC,EAPW,uBAAuB,KAAvB,uBAAuB,QAOlC;AAED,MAAM,OAAO,eAAgB,SAAQ,mBAAmB;IAEpD,MAAM,CAAC,MAAM,CAAC,KAAgC;;QAE1C,KAAK,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,EAAE,mCAAI,EAAE,CAAC;QAC5B,IAAI,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QACpD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YACjB,OAAO,KAAK,CAAC;QACjB,IAAI,GAAG,GAAG,EAAE,CAAC;QACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EACpC,CAAC;YACG,IAAI,CAAC,GAAG,CAAC;gBACL,GAAG,CAAC,IAAI,CAAC,eAAS,CAAC,CAAI,CAAC,CAAC;YAC7B,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAED,YAAY,QAAgB,uBAAuB,CAAC,QAAQ,EAAE,SAAkC,IAAI;QAEhG,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IACQ,MAAM,CAAC,KAAU;QAEtB,IAAI,IAAI,CAAC,MAAM;YACX,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9D,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.242",
|
|
12
12
|
"author": "Amir Abolhasani",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"main": "./dist/main.js",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"link-react": "^3.0.0",
|
|
35
35
|
"namirasoft-api-link": "^1.4.9",
|
|
36
36
|
"namirasoft-api-product": "^1.4.13",
|
|
37
|
-
"namirasoft-core": "^1.4.
|
|
37
|
+
"namirasoft-core": "^1.4.45",
|
|
38
38
|
"namirasoft-schema": "^1.4.22",
|
|
39
|
-
"namirasoft-site-map": "^1.4.
|
|
39
|
+
"namirasoft-site-map": "^1.4.12",
|
|
40
40
|
"os-browserify": "^0.3.0",
|
|
41
41
|
"path-browserify": "^1.0.1",
|
|
42
42
|
"react": "^18.3.1",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Fragment } from 'react/jsx-runtime';
|
|
2
1
|
import Styles from './NSBarTitle.module.css';
|
|
2
|
+
import { StringFormatter } from '../main';
|
|
3
3
|
|
|
4
4
|
export interface NSBarTitleProps
|
|
5
5
|
{
|
|
@@ -9,21 +9,15 @@ export interface NSBarTitleProps
|
|
|
9
9
|
|
|
10
10
|
export function NSBarTitle(props: NSBarTitleProps)
|
|
11
11
|
{
|
|
12
|
-
let lines = (props.description ?? "").split(/(\n|\\n|<br>|<br\s*\/>)/gm);
|
|
13
12
|
return (
|
|
14
13
|
<div className="container">
|
|
15
14
|
<h1 className={Styles.title}>{props.title}</h1>
|
|
16
15
|
{
|
|
17
|
-
props.description &&
|
|
16
|
+
props.description &&
|
|
18
17
|
<p className={Styles.description}>{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
{line.trim()}
|
|
23
|
-
{index !== lines.length - 1 && <br />}
|
|
24
|
-
</Fragment>;
|
|
25
|
-
})
|
|
26
|
-
}</p>
|
|
18
|
+
StringFormatter.toHTML(props.description)
|
|
19
|
+
}
|
|
20
|
+
</p>
|
|
27
21
|
}
|
|
28
22
|
</div>
|
|
29
23
|
);
|
|
@@ -12,6 +12,21 @@ export enum StringFormatterSizeType
|
|
|
12
12
|
|
|
13
13
|
export class StringFormatter extends BaseColumnFormatter
|
|
14
14
|
{
|
|
15
|
+
static toHTML(value: string | null | undefined)
|
|
16
|
+
{
|
|
17
|
+
value = value?.trim() ?? "";
|
|
18
|
+
let toks = value.split(/(\n|\\n|<br>|<br\s*\/>)/gm);
|
|
19
|
+
if (toks.length === 1)
|
|
20
|
+
return value;
|
|
21
|
+
let ans = [];
|
|
22
|
+
for (let i = 0; i < toks.length; i++)
|
|
23
|
+
{
|
|
24
|
+
if (i > 0)
|
|
25
|
+
ans.push(<br key={i} />);
|
|
26
|
+
ans.push(toks[i].trim());
|
|
27
|
+
}
|
|
28
|
+
return ans;
|
|
29
|
+
}
|
|
15
30
|
private naming: NamingConvention | null;
|
|
16
31
|
constructor(width: string = StringFormatterSizeType.Sentence, naming: NamingConvention | null = null)
|
|
17
32
|
{
|