namirasoft-account-react 1.5.0 → 1.5.1
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/NSARouterMaker.js +4 -2
- package/dist/NSARouterMaker.js.map +1 -1
- package/dist/components/NSATable.d.ts +5 -0
- package/dist/components/NSATable.js +45 -11
- package/dist/components/NSATable.js.map +1 -1
- package/dist/components/quickfilter/NSAFilterBoxBase.d.ts +9 -0
- package/dist/components/quickfilter/NSAFilterBoxBase.js +25 -0
- package/dist/components/quickfilter/NSAFilterBoxBase.js.map +1 -1
- package/dist/components/quickfilter/NSAFilterBoxBoolean.d.ts +1 -0
- package/dist/components/quickfilter/NSAFilterBoxBoolean.js +12 -2
- package/dist/components/quickfilter/NSAFilterBoxBoolean.js.map +1 -1
- package/dist/components/quickfilter/NSAFilterBoxDate.js +7 -5
- package/dist/components/quickfilter/NSAFilterBoxDate.js.map +1 -1
- package/dist/components/quickfilter/NSAFilterBoxDateTime.js +7 -5
- package/dist/components/quickfilter/NSAFilterBoxDateTime.js.map +1 -1
- package/dist/components/quickfilter/NSAFilterBoxEnum.js +2 -2
- package/dist/components/quickfilter/NSAFilterBoxEnum.js.map +1 -1
- package/dist/components/quickfilter/NSAFilterBoxNumber.js +11 -5
- package/dist/components/quickfilter/NSAFilterBoxNumber.js.map +1 -1
- package/dist/components/quickfilter/NSAFilterBoxString.js +3 -3
- package/dist/components/quickfilter/NSAFilterBoxString.js.map +1 -1
- package/dist/components/quickfilter/NSAFilterBoxTime.js +6 -5
- package/dist/components/quickfilter/NSAFilterBoxTime.js.map +1 -1
- package/dist/components/quickfilter/NSAQuickFilterBar.d.ts +2 -0
- package/dist/components/quickfilter/NSAQuickFilterBar.js +26 -2
- package/dist/components/quickfilter/NSAQuickFilterBar.js.map +1 -1
- package/dist/layouts/NSALayout.js +1 -4
- package/dist/layouts/NSALayout.js.map +1 -1
- package/dist/pages/NSAHomePage.d.ts +6 -2
- package/dist/pages/NSAHomePage.js +4 -4
- package/dist/pages/NSAHomePage.js.map +1 -1
- package/package.json +4 -4
- package/src/NSARouterMaker.tsx +4 -2
- package/src/components/NSATable.tsx +503 -455
- package/src/components/quickfilter/NSAFilterBoxBase.tsx +34 -0
- package/src/components/quickfilter/NSAFilterBoxBoolean.tsx +13 -1
- package/src/components/quickfilter/NSAFilterBoxDate.tsx +8 -2
- package/src/components/quickfilter/NSAFilterBoxDateTime.tsx +8 -3
- package/src/components/quickfilter/NSAFilterBoxEnum.tsx +2 -2
- package/src/components/quickfilter/NSAFilterBoxNumber.tsx +11 -2
- package/src/components/quickfilter/NSAFilterBoxString.tsx +3 -1
- package/src/components/quickfilter/NSAFilterBoxTime.tsx +7 -2
- package/src/components/quickfilter/NSAQuickFilterBar.tsx +30 -2
- package/src/layouts/NSALayout.tsx +1 -4
- package/src/pages/NSAHomePage.tsx +26 -5
|
@@ -5,6 +5,7 @@ import { QuickFilterConfig } from "./NSAQuickFilterDialog";
|
|
|
5
5
|
export interface NSAFilterBoxBaseProps
|
|
6
6
|
{
|
|
7
7
|
config: QuickFilterConfig;
|
|
8
|
+
initial?: FilterItem | FilterItem[] | null;
|
|
8
9
|
onChanged: (items: FilterItem | FilterItem[] | null) => void;
|
|
9
10
|
}
|
|
10
11
|
|
|
@@ -53,4 +54,37 @@ export abstract class NSAFilterBoxBase<P extends NSAFilterBoxBaseProps = NSAFilt
|
|
|
53
54
|
const sign = FilterItemOperator.getByName(config.operatorName).sign;
|
|
54
55
|
return `${config.column.text} ${sign}`;
|
|
55
56
|
}
|
|
57
|
+
|
|
58
|
+
protected getInitialItems(): FilterItem[]
|
|
59
|
+
{
|
|
60
|
+
const initial = this.props.initial;
|
|
61
|
+
if (!initial)
|
|
62
|
+
return [];
|
|
63
|
+
return Array.isArray(initial) ? initial : [initial];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
protected getInitialValue(): string | undefined
|
|
67
|
+
{
|
|
68
|
+
return this.getInitialItems()[0]?.values[0];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
protected getInitialValues(): string[]
|
|
72
|
+
{
|
|
73
|
+
return this.getInitialItems().flatMap(i => i.values);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
protected getInitialBetween(): { from: string; to: string } | undefined
|
|
77
|
+
{
|
|
78
|
+
const items = this.getInitialItems();
|
|
79
|
+
if (items.length < 2)
|
|
80
|
+
return undefined;
|
|
81
|
+
const from = items.find(i => i.operator?.name === "morethanequal")?.values[0] ?? items[0].values[0];
|
|
82
|
+
const to = items.find(i => i.operator?.name === "lessthanequal")?.values[0] ?? items[1].values[0];
|
|
83
|
+
return { from, to };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
protected parseDBDate(value: string): Date
|
|
87
|
+
{
|
|
88
|
+
return new Date(value.replace(" ", "T") + "Z");
|
|
89
|
+
}
|
|
56
90
|
}
|
|
@@ -15,10 +15,21 @@ export class NSAFilterBoxBoolean extends NSAFilterBoxBase<NSAFilterBoxBaseProps,
|
|
|
15
15
|
constructor(props: NSAFilterBoxBaseProps)
|
|
16
16
|
{
|
|
17
17
|
super(props);
|
|
18
|
-
this.state = { value: this.
|
|
18
|
+
this.state = { value: this.resolveInitialValue() };
|
|
19
19
|
this.handleChange = this.handleChange.bind(this);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
private resolveInitialValue(): boolean | null
|
|
23
|
+
{
|
|
24
|
+
const hasInitial = this.getInitialItems().length > 0;
|
|
25
|
+
if (this.isValueless())
|
|
26
|
+
return hasInitial;
|
|
27
|
+
const value = this.getInitialValue();
|
|
28
|
+
if (value !== undefined)
|
|
29
|
+
return value === "1";
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
22
33
|
private isValueless(): boolean
|
|
23
34
|
{
|
|
24
35
|
const name = this.props.config.operatorName;
|
|
@@ -47,6 +58,7 @@ export class NSAFilterBoxBoolean extends NSAFilterBoxBase<NSAFilterBoxBaseProps,
|
|
|
47
58
|
required={false}
|
|
48
59
|
hideHeader={true}
|
|
49
60
|
triState={!this.isValueless()}
|
|
61
|
+
defaultValue={this.state.value ?? undefined}
|
|
50
62
|
onChanged={e => this.handleChange(e.getValue())}
|
|
51
63
|
/>
|
|
52
64
|
</div>
|
|
@@ -14,7 +14,7 @@ const ENTITY_OPERATORS = ["equals"];
|
|
|
14
14
|
|
|
15
15
|
export class NSAFilterBoxDate extends NSAFilterBoxBase<NSAFilterBoxDateProps>
|
|
16
16
|
{
|
|
17
|
-
private betweenActive =
|
|
17
|
+
private betweenActive = this.getInitialBetween() !== undefined;
|
|
18
18
|
|
|
19
19
|
private list = async (
|
|
20
20
|
filters: FilterItem[] | null,
|
|
@@ -37,7 +37,9 @@ export class NSAFilterBoxDate extends NSAFilterBoxBase<NSAFilterBoxDateProps>
|
|
|
37
37
|
: null;
|
|
38
38
|
|
|
39
39
|
if (op && op.count === 0)
|
|
40
|
-
return <NSAFilterBoxBoolean config={config} onChanged={onChanged} />;
|
|
40
|
+
return <NSAFilterBoxBoolean config={config} initial={this.props.initial} onChanged={onChanged} />;
|
|
41
|
+
|
|
42
|
+
const between = this.getInitialBetween();
|
|
41
43
|
|
|
42
44
|
if (config.operatorName === "between")
|
|
43
45
|
return (
|
|
@@ -47,6 +49,7 @@ export class NSAFilterBoxDate extends NSAFilterBoxBase<NSAFilterBoxDateProps>
|
|
|
47
49
|
required={false}
|
|
48
50
|
hideHeader={true}
|
|
49
51
|
preset={true}
|
|
52
|
+
defaultValue={between ? { from: this.parseDBDate(between.from), to: this.parseDBDate(between.to) } : undefined}
|
|
50
53
|
onChanged={e =>
|
|
51
54
|
{
|
|
52
55
|
const val = e.getValue();
|
|
@@ -75,6 +78,7 @@ export class NSAFilterBoxDate extends NSAFilterBoxBase<NSAFilterBoxDateProps>
|
|
|
75
78
|
required={false}
|
|
76
79
|
hideHeader={true}
|
|
77
80
|
multiple={false}
|
|
81
|
+
defaultValue={this.getInitialValue()}
|
|
78
82
|
list={this.list}
|
|
79
83
|
table_name={config.column.table.name}
|
|
80
84
|
getValue={item => item.value}
|
|
@@ -88,12 +92,14 @@ export class NSAFilterBoxDate extends NSAFilterBoxBase<NSAFilterBoxDateProps>
|
|
|
88
92
|
/>
|
|
89
93
|
);
|
|
90
94
|
|
|
95
|
+
const single = this.getInitialValue();
|
|
91
96
|
return (
|
|
92
97
|
<NSBoxDate
|
|
93
98
|
title={this.getLabel()}
|
|
94
99
|
placeholder={this.getLabel()}
|
|
95
100
|
required={false}
|
|
96
101
|
hideHeader={true}
|
|
102
|
+
defaultValue={single !== undefined ? this.parseDBDate(single) : undefined}
|
|
97
103
|
onChanged={e =>
|
|
98
104
|
{
|
|
99
105
|
const val = e.getValue();
|
|
@@ -14,7 +14,7 @@ const ENTITY_OPERATORS = ["equals"];
|
|
|
14
14
|
|
|
15
15
|
export class NSAFilterBoxDateTime extends NSAFilterBoxBase<NSAFilterBoxDateTimeProps>
|
|
16
16
|
{
|
|
17
|
-
private betweenActive =
|
|
17
|
+
private betweenActive = this.getInitialBetween() !== undefined;
|
|
18
18
|
|
|
19
19
|
private list = async (
|
|
20
20
|
filters: FilterItem[] | null,
|
|
@@ -37,7 +37,9 @@ export class NSAFilterBoxDateTime extends NSAFilterBoxBase<NSAFilterBoxDateTimeP
|
|
|
37
37
|
: null;
|
|
38
38
|
|
|
39
39
|
if (op && op.count === 0)
|
|
40
|
-
return <NSAFilterBoxBoolean config={config} onChanged={onChanged} />;
|
|
40
|
+
return <NSAFilterBoxBoolean config={config} initial={this.props.initial} onChanged={onChanged} />;
|
|
41
|
+
|
|
42
|
+
const between = this.getInitialBetween();
|
|
41
43
|
|
|
42
44
|
if (config.operatorName === "between")
|
|
43
45
|
return (
|
|
@@ -47,6 +49,7 @@ export class NSAFilterBoxDateTime extends NSAFilterBoxBase<NSAFilterBoxDateTimeP
|
|
|
47
49
|
required={false}
|
|
48
50
|
hideHeader={true}
|
|
49
51
|
preset={true}
|
|
52
|
+
defaultValue={between ? { from: this.parseDBDate(between.from), to: this.parseDBDate(between.to) } : undefined}
|
|
50
53
|
onChanged={e =>
|
|
51
54
|
{
|
|
52
55
|
const val = e.getValue();
|
|
@@ -75,6 +78,7 @@ export class NSAFilterBoxDateTime extends NSAFilterBoxBase<NSAFilterBoxDateTimeP
|
|
|
75
78
|
required={false}
|
|
76
79
|
hideHeader={true}
|
|
77
80
|
multiple={false}
|
|
81
|
+
defaultValue={this.getInitialValue()}
|
|
78
82
|
list={this.list}
|
|
79
83
|
table_name={config.column.table.name}
|
|
80
84
|
getValue={item => item.value}
|
|
@@ -88,13 +92,14 @@ export class NSAFilterBoxDateTime extends NSAFilterBoxBase<NSAFilterBoxDateTimeP
|
|
|
88
92
|
/>
|
|
89
93
|
);
|
|
90
94
|
|
|
95
|
+
const single = this.getInitialValue();
|
|
91
96
|
return (
|
|
92
97
|
<NSBoxDateTime
|
|
93
98
|
title={this.getLabel()}
|
|
94
99
|
placeholder={this.getLabel()}
|
|
95
100
|
required={false}
|
|
96
101
|
hideHeader={true}
|
|
97
|
-
defaultValue={undefined}
|
|
102
|
+
defaultValue={single !== undefined ? this.parseDBDate(single) : undefined}
|
|
98
103
|
onChanged={e =>
|
|
99
104
|
{
|
|
100
105
|
const val = e.getValue();
|
|
@@ -22,7 +22,7 @@ export class NSAFilterBoxEnum extends NSAFilterBoxBase<NSAFilterBoxEnumProps, St
|
|
|
22
22
|
constructor(props: NSAFilterBoxEnumProps)
|
|
23
23
|
{
|
|
24
24
|
super(props);
|
|
25
|
-
this.state = { loading: false, values: [], selectedValues:
|
|
25
|
+
this.state = { loading: false, values: [], selectedValues: this.getInitialValues() };
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
override async componentDidMount()
|
|
@@ -40,7 +40,7 @@ export class NSAFilterBoxEnum extends NSAFilterBoxBase<NSAFilterBoxEnumProps, St
|
|
|
40
40
|
: null;
|
|
41
41
|
|
|
42
42
|
if (op && op.count === 0)
|
|
43
|
-
return <NSAFilterBoxBoolean config={config} onChanged={onChanged} />;
|
|
43
|
+
return <NSAFilterBoxBoolean config={config} initial={this.props.initial} onChanged={onChanged} />;
|
|
44
44
|
|
|
45
45
|
if (config.operatorName === "equals")
|
|
46
46
|
{
|
|
@@ -28,7 +28,12 @@ export class NSAFilterBoxNumber extends NSAFilterBoxBase<NSAFilterBoxNumberProps
|
|
|
28
28
|
constructor(props: NSAFilterBoxNumberProps)
|
|
29
29
|
{
|
|
30
30
|
super(props);
|
|
31
|
-
|
|
31
|
+
const between = this.getInitialBetween();
|
|
32
|
+
this.betweenActive = between !== undefined;
|
|
33
|
+
this.state = {
|
|
34
|
+
valueFrom: between ? Number(between.from) : null,
|
|
35
|
+
valueTo: between ? Number(between.to) : null,
|
|
36
|
+
};
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
private emitDebounced(value: number | null): void
|
|
@@ -81,7 +86,7 @@ export class NSAFilterBoxNumber extends NSAFilterBoxBase<NSAFilterBoxNumberProps
|
|
|
81
86
|
: null;
|
|
82
87
|
|
|
83
88
|
if (op && op.count === 0)
|
|
84
|
-
return <NSAFilterBoxBoolean config={config} onChanged={onChanged} />;
|
|
89
|
+
return <NSAFilterBoxBoolean config={config} initial={this.props.initial} onChanged={onChanged} />;
|
|
85
90
|
|
|
86
91
|
if (config.operatorName === "between")
|
|
87
92
|
return (
|
|
@@ -91,6 +96,7 @@ export class NSAFilterBoxNumber extends NSAFilterBoxBase<NSAFilterBoxNumberProps
|
|
|
91
96
|
placeholder={`${this.getLabel()} From`}
|
|
92
97
|
required={false}
|
|
93
98
|
hideHeader={true}
|
|
99
|
+
defaultValue={this.state.valueFrom ?? undefined}
|
|
94
100
|
onChanged={e => this.handleBetweenChange({ valueFrom: e.getValue() })}
|
|
95
101
|
/>
|
|
96
102
|
<NSBoxDouble
|
|
@@ -98,6 +104,7 @@ export class NSAFilterBoxNumber extends NSAFilterBoxBase<NSAFilterBoxNumberProps
|
|
|
98
104
|
placeholder={`${this.getLabel()} To`}
|
|
99
105
|
required={false}
|
|
100
106
|
hideHeader={true}
|
|
107
|
+
defaultValue={this.state.valueTo ?? undefined}
|
|
101
108
|
onChanged={e => this.handleBetweenChange({ valueTo: e.getValue() })}
|
|
102
109
|
/>
|
|
103
110
|
</NSRow>
|
|
@@ -111,6 +118,7 @@ export class NSAFilterBoxNumber extends NSAFilterBoxBase<NSAFilterBoxNumberProps
|
|
|
111
118
|
required={false}
|
|
112
119
|
hideHeader={true}
|
|
113
120
|
multiple={false}
|
|
121
|
+
defaultValue={this.getInitialValue()}
|
|
114
122
|
list={this.list}
|
|
115
123
|
table_name={config.column.table.name}
|
|
116
124
|
getValue={item => item.value}
|
|
@@ -130,6 +138,7 @@ export class NSAFilterBoxNumber extends NSAFilterBoxBase<NSAFilterBoxNumberProps
|
|
|
130
138
|
placeholder={this.getLabel()}
|
|
131
139
|
required={false}
|
|
132
140
|
hideHeader={true}
|
|
141
|
+
defaultValue={this.getInitialValue() !== undefined ? Number(this.getInitialValue()) : undefined}
|
|
133
142
|
onChanged={e => this.emitDebounced(e.getValue())}
|
|
134
143
|
/>
|
|
135
144
|
);
|
|
@@ -46,7 +46,7 @@ export class NSAFilterBoxString extends NSAFilterBoxBase<NSAFilterBoxStringProps
|
|
|
46
46
|
: null;
|
|
47
47
|
|
|
48
48
|
if (op && op.count === 0)
|
|
49
|
-
return <NSAFilterBoxBoolean config={config} onChanged={onChanged} />;
|
|
49
|
+
return <NSAFilterBoxBoolean config={config} initial={this.props.initial} onChanged={onChanged} />;
|
|
50
50
|
|
|
51
51
|
if (config.operatorName && ENTITY_OPERATORS.includes(config.operatorName))
|
|
52
52
|
return (
|
|
@@ -56,6 +56,7 @@ export class NSAFilterBoxString extends NSAFilterBoxBase<NSAFilterBoxStringProps
|
|
|
56
56
|
required={false}
|
|
57
57
|
hideHeader={true}
|
|
58
58
|
multiple={false}
|
|
59
|
+
defaultValue={this.getInitialValue()}
|
|
59
60
|
list={this.list}
|
|
60
61
|
table_name={config.column.table.name}
|
|
61
62
|
getValue={item => item.value}
|
|
@@ -75,6 +76,7 @@ export class NSAFilterBoxString extends NSAFilterBoxBase<NSAFilterBoxStringProps
|
|
|
75
76
|
placeholder={this.getLabel()}
|
|
76
77
|
required={false}
|
|
77
78
|
hideHeader={true}
|
|
79
|
+
defaultValue={this.getInitialValue()}
|
|
78
80
|
onChanged={e => this.emitDebounced(e.getValue())}
|
|
79
81
|
/>
|
|
80
82
|
);
|
|
@@ -14,7 +14,7 @@ const ENTITY_OPERATORS = ["equals"];
|
|
|
14
14
|
|
|
15
15
|
export class NSAFilterBoxTime extends NSAFilterBoxBase<NSAFilterBoxTimeProps>
|
|
16
16
|
{
|
|
17
|
-
private betweenActive =
|
|
17
|
+
private betweenActive = this.getInitialBetween() !== undefined;
|
|
18
18
|
|
|
19
19
|
private list = async (
|
|
20
20
|
filters: FilterItem[] | null,
|
|
@@ -37,7 +37,9 @@ export class NSAFilterBoxTime extends NSAFilterBoxBase<NSAFilterBoxTimeProps>
|
|
|
37
37
|
: null;
|
|
38
38
|
|
|
39
39
|
if (op && op.count === 0)
|
|
40
|
-
return <NSAFilterBoxBoolean config={config} onChanged={onChanged} />;
|
|
40
|
+
return <NSAFilterBoxBoolean config={config} initial={this.props.initial} onChanged={onChanged} />;
|
|
41
|
+
|
|
42
|
+
const between = this.getInitialBetween();
|
|
41
43
|
|
|
42
44
|
if (config.operatorName === "between")
|
|
43
45
|
return (
|
|
@@ -47,6 +49,7 @@ export class NSAFilterBoxTime extends NSAFilterBoxBase<NSAFilterBoxTimeProps>
|
|
|
47
49
|
required={false}
|
|
48
50
|
hideHeader={true}
|
|
49
51
|
preset={true}
|
|
52
|
+
defaultValue={between ? { from: between.from, to: between.to } : undefined}
|
|
50
53
|
onChanged={e =>
|
|
51
54
|
{
|
|
52
55
|
const val = e.getValue();
|
|
@@ -72,6 +75,7 @@ export class NSAFilterBoxTime extends NSAFilterBoxBase<NSAFilterBoxTimeProps>
|
|
|
72
75
|
required={false}
|
|
73
76
|
hideHeader={true}
|
|
74
77
|
multiple={false}
|
|
78
|
+
defaultValue={this.getInitialValue()}
|
|
75
79
|
list={this.list}
|
|
76
80
|
table_name={config.column.table.name}
|
|
77
81
|
getValue={item => item.value}
|
|
@@ -91,6 +95,7 @@ export class NSAFilterBoxTime extends NSAFilterBoxBase<NSAFilterBoxTimeProps>
|
|
|
91
95
|
placeholder={this.getLabel()}
|
|
92
96
|
required={false}
|
|
93
97
|
hideHeader={true}
|
|
98
|
+
defaultValue={this.getInitialValue()}
|
|
94
99
|
onChanged={e =>
|
|
95
100
|
{
|
|
96
101
|
const val = e.getValue();
|
|
@@ -15,6 +15,7 @@ interface NSAQuickFilterBarProps
|
|
|
15
15
|
{
|
|
16
16
|
configs: QuickFilterConfig[];
|
|
17
17
|
getValues: (tableName: string, columnName: string, search: string) => Promise<{ value: string; title: string }[]>;
|
|
18
|
+
initialItems?: FilterItem[];
|
|
18
19
|
onChanged?: () => void;
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -41,7 +42,33 @@ export class NSAQuickFilterBar extends Component<NSAQuickFilterBarProps, NSAQuic
|
|
|
41
42
|
constructor(props: NSAQuickFilterBarProps)
|
|
42
43
|
{
|
|
43
44
|
super(props);
|
|
44
|
-
this.state = { filterValues:
|
|
45
|
+
this.state = { filterValues: this.buildInitialValues(props), clearKeys: {} };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private buildInitialValues(props: NSAQuickFilterBarProps): { [id: string]: FilterItem | FilterItem[] | null }
|
|
49
|
+
{
|
|
50
|
+
const values: { [id: string]: FilterItem | FilterItem[] | null } = {};
|
|
51
|
+
const items = props.initialItems ?? [];
|
|
52
|
+
const consumed = new Set<number>();
|
|
53
|
+
for (const config of props.configs)
|
|
54
|
+
{
|
|
55
|
+
const matched: FilterItem[] = [];
|
|
56
|
+
items.forEach((item, index) =>
|
|
57
|
+
{
|
|
58
|
+
if (consumed.has(index))
|
|
59
|
+
return;
|
|
60
|
+
if (item.table.name === config.column.table.name && item.column.name === config.column.name)
|
|
61
|
+
{
|
|
62
|
+
matched.push(item);
|
|
63
|
+
consumed.add(index);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
if (matched.length === 1)
|
|
67
|
+
values[config.id] = matched[0];
|
|
68
|
+
else if (matched.length > 1)
|
|
69
|
+
values[config.id] = matched;
|
|
70
|
+
}
|
|
71
|
+
return values;
|
|
45
72
|
}
|
|
46
73
|
|
|
47
74
|
getFilterItems(): FilterItem[]
|
|
@@ -65,7 +92,8 @@ export class NSAQuickFilterBar extends Component<NSAQuickFilterBarProps, NSAQuic
|
|
|
65
92
|
{
|
|
66
93
|
const { columnType } = config.column;
|
|
67
94
|
const onChanged = (items: FilterItem | FilterItem[] | null) => this.handleFilterChange(config.id, items);
|
|
68
|
-
const
|
|
95
|
+
const initial = this.state.filterValues[config.id] ?? null;
|
|
96
|
+
const commonProps = { key: clearKey, config, initial, onChanged };
|
|
69
97
|
|
|
70
98
|
if (columnType === VariableType.Boolean)
|
|
71
99
|
return <NSAFilterBoxBoolean {...commonProps} />;
|
|
@@ -4,7 +4,7 @@ import { CacheService, CookieService, EnvService, FilterItem, FilterItemOperator
|
|
|
4
4
|
import { CategoryRow, FieldRow, NamirasoftFieldMetaDatabase, NamirasoftFieldServer } from 'namirasoft-field';
|
|
5
5
|
import { NamirasoftMessageServer } from 'namirasoft-message';
|
|
6
6
|
import { NamirasoftMap } from 'namirasoft-site-map';
|
|
7
|
-
import { IBackgroundProps, IBaseComponentProps, IHeaderIconProps, IHeaderRightProps,
|
|
7
|
+
import { IBackgroundProps, IBaseComponentProps, IHeaderIconProps, IHeaderRightProps, NSBarActionProps, NSBarAlertProps, NSBarTitleProps, NSDialogDelete, NSLayout, NSLoading, ProductCacheService } from 'namirasoft-site-react';
|
|
8
8
|
import { IHeaderLeftProps } from 'namirasoft-site-react/dist/props/IHeaderLeftProps';
|
|
9
9
|
import { Component, createRef } from 'react';
|
|
10
10
|
import { Helmet } from 'react-helmet';
|
|
@@ -309,8 +309,6 @@ export class NSALayout<RowType extends { id: string }, RowTypeInput = RowType> e
|
|
|
309
309
|
this.reloadMessageCount(false);
|
|
310
310
|
|
|
311
311
|
client.start();
|
|
312
|
-
KeyOperation.start();
|
|
313
|
-
LinkOperation.setNavigate(this.props.url.navigate);
|
|
314
312
|
}
|
|
315
313
|
override componentDidUpdate(): void
|
|
316
314
|
{
|
|
@@ -324,7 +322,6 @@ export class NSALayout<RowType extends { id: string }, RowTypeInput = RowType> e
|
|
|
324
322
|
override componentWillUnmount(): void
|
|
325
323
|
{
|
|
326
324
|
client.stop();
|
|
327
|
-
KeyOperation.stop();
|
|
328
325
|
}
|
|
329
326
|
override render()
|
|
330
327
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode, useEffect, useState } from 'react';
|
|
2
2
|
import { SetTimeouService } from 'namirasoft-core';
|
|
3
3
|
import { ProductFullRow } from 'namirasoft-api-product';
|
|
4
|
-
import { IBaseComponentProps, NSBox, NSBoxSearch, NSListProduct, NSListProductCardProps, NSLoading, NSSpace, NSSpaceSizeType, ProductCacheService } from 'namirasoft-site-react';
|
|
4
|
+
import { IBaseComponentProps, NSBox, NSBoxSearch, NSLine, NSListMenu, NSListProduct, NSListProductCardProps, NSLoading, NSSpace, NSSpaceSizeType, NSTitle, ProductCacheService } from 'namirasoft-site-react';
|
|
5
5
|
import { NSARouterMakerProps } from '../NSARouterMakerProps';
|
|
6
6
|
import Styles from './NSAHomePage.module.css';
|
|
7
7
|
|
|
@@ -14,8 +14,12 @@ export interface NSAHomePageProps extends IBaseComponentProps, NSARouterMakerPro
|
|
|
14
14
|
description?: string;
|
|
15
15
|
};
|
|
16
16
|
show_image?: boolean;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
getChildren?: {
|
|
18
|
+
getChildrenBeforeTitle?: () => ReactNode;
|
|
19
|
+
getChildrenAfterTitle?: () => ReactNode;
|
|
20
|
+
getChildrenBeforeMenuList?: () => ReactNode;
|
|
21
|
+
getChildrenAfterMenuList?: () => ReactNode;
|
|
22
|
+
};
|
|
19
23
|
product?: {
|
|
20
24
|
search?: boolean;
|
|
21
25
|
getChildrenBefore?: () => NSListProductCardProps[];
|
|
@@ -63,9 +67,13 @@ export function NSAHomePage(props: NSAHomePageProps)
|
|
|
63
67
|
/>
|
|
64
68
|
}
|
|
65
69
|
<NSSpace size={NSSpaceSizeType.MICRO} />
|
|
70
|
+
|
|
71
|
+
{props.getChildren?.getChildrenBeforeTitle?.()}
|
|
66
72
|
<h2>{headline}</h2>
|
|
67
73
|
<NSSpace size={NSSpaceSizeType.MICRO} />
|
|
68
74
|
<p>{description}</p>
|
|
75
|
+
{props.getChildren?.getChildrenAfterTitle?.()}
|
|
76
|
+
|
|
69
77
|
{
|
|
70
78
|
props.product?.search &&
|
|
71
79
|
<>
|
|
@@ -89,7 +97,21 @@ export function NSAHomePage(props: NSAHomePageProps)
|
|
|
89
97
|
</>
|
|
90
98
|
}
|
|
91
99
|
<NSSpace size={NSSpaceSizeType.SMALL} />
|
|
92
|
-
|
|
100
|
+
|
|
101
|
+
{props.getChildren?.getChildrenBeforeMenuList?.()}
|
|
102
|
+
<NSListMenu
|
|
103
|
+
scope={scope}
|
|
104
|
+
name="Header"
|
|
105
|
+
isLoggedIn={() => props.account.token_manager.exists()}
|
|
106
|
+
onError={props.notifier.onError}
|
|
107
|
+
/>
|
|
108
|
+
{props.getChildren?.getChildrenAfterMenuList?.()}
|
|
109
|
+
|
|
110
|
+
<NSSpace size={NSSpaceSizeType.NORMAL} />
|
|
111
|
+
<NSLine />
|
|
112
|
+
<NSSpace size={NSSpaceSizeType.SMALL} />
|
|
113
|
+
|
|
114
|
+
<NSTitle title="Related Products" style={{ marginBottom: 32, fontSize: 32 }} />
|
|
93
115
|
<NSListProduct
|
|
94
116
|
scope={scope}
|
|
95
117
|
name="Home"
|
|
@@ -97,7 +119,6 @@ export function NSAHomePage(props: NSAHomePageProps)
|
|
|
97
119
|
getChildrenBefore={props.product?.getChildrenBefore}
|
|
98
120
|
getChildrenAfter={props.product?.getChildrenAfter}
|
|
99
121
|
/>
|
|
100
|
-
{props.getChildrenAfter && props.getChildrenAfter()}
|
|
101
122
|
</div>
|
|
102
123
|
);
|
|
103
124
|
}
|