namirasoft-account-react 1.5.21 → 1.5.22
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/.env.template +15 -15
- package/SKILL.md +514 -514
- package/config-overrides.js +72 -72
- package/dist/App.d.ts +1 -1
- package/dist/Router.d.ts +1 -1
- package/dist/UseParams.d.ts +1 -1
- package/dist/components/NSAAccessListDialog.d.ts +2 -2
- package/dist/components/NSAAccessListDialog.module.css +71 -71
- package/dist/components/NSABoxSecret.d.ts +1 -1
- package/dist/components/NSABoxSecret.module.css +23 -23
- package/dist/components/NSAMasterMenu.d.ts +1 -1
- package/dist/components/NSAMasterMenu.module.css +250 -250
- package/dist/components/NSAMasterMenuItem.d.ts +1 -1
- package/dist/components/NSAMessageListDialog.d.ts +1 -1
- package/dist/components/NSAMessageListDialog.module.css +99 -99
- package/dist/components/NSANavigationGuard.d.ts +1 -1
- package/dist/components/NSAProductListDialog.d.ts +1 -1
- package/dist/components/NSAProductListDialog.module.css +44 -44
- package/dist/components/NSATaskBar.d.ts +1 -1
- package/dist/components/NSATaskBar.module.css +57 -57
- package/dist/components/NSAUserDialog.d.ts +1 -1
- package/dist/components/NSAUserDialog.module.css +67 -67
- package/dist/components/NSAWorkspaceListDialog.d.ts +1 -1
- package/dist/components/NSAWorkspaceListDialog.module.css +41 -41
- package/dist/components/NSFBoxCategoryScope.d.ts +1 -1
- package/dist/components/NSFBoxField.d.ts +1 -1
- package/dist/components/NSFBoxSlot.d.ts +1 -1
- package/dist/components/NSFBoxWrapper.d.ts +1 -1
- package/dist/components/NSLabelSecret.d.ts +1 -1
- package/dist/components/quickfilter/NSAFilterBoxEnum.module.css +44 -44
- package/dist/components/quickfilter/NSAQuickFilterBar.d.ts +1 -1
- package/dist/components/quickfilter/NSAQuickFilterBar.module.css +19 -19
- package/dist/components/quickfilter/NSAQuickFilterDialog.d.ts +1 -1
- package/dist/components/quickfilter/NSAQuickFilterDialog.module.css +74 -74
- package/dist/layouts/NSALayout.d.ts +1 -1
- package/dist/layouts/NSASectionEdit.d.ts +1 -1
- package/dist/layouts/NSASectionEditTabPage.d.ts +1 -1
- package/dist/layouts/NSASectionEditTabPage.module.css +4 -4
- package/dist/layouts/NSASectionList.d.ts +1 -1
- package/dist/layouts/NSASectionList.module.css +31 -31
- package/dist/layouts/NSASectionView.d.ts +1 -1
- package/dist/layouts/NSASectionViewTabMore.d.ts +1 -1
- package/dist/layouts/NSASectionViewTabPage.d.ts +1 -1
- package/dist/layouts/NSASectionViewTabPage.js +1 -0
- package/dist/layouts/NSASectionViewTabPage.js.map +1 -1
- package/dist/layouts/NSASectionViewTabPage.module.css +47 -47
- package/dist/pages/NSAConsentPage.module.css +26 -26
- package/dist/pages/NSAEmailVerificationPage.d.ts +1 -1
- package/dist/pages/NSAHomePage.d.ts +1 -1
- package/dist/pages/NSAHomePage.module.css +41 -41
- package/dist/pages/NSALoginPage.d.ts +1 -1
- package/dist/pages/NSALoginPage.module.css +26 -26
- package/dist/pages/NSAPhoneVerificationPage.d.ts +1 -1
- package/dist/pages/NSAVerificationPage.d.ts +1 -1
- package/dist/pages/NSAVerificationPage.module.css +31 -31
- package/package.json +95 -95
- package/public/index.html +21 -21
- package/src/App.tsx +19 -19
- package/src/CTFRow.ts +7 -7
- package/src/FieldCacheService.tsx +84 -84
- package/src/IEntityInfo.ts +33 -33
- package/src/NSACacheService.ts +120 -120
- package/src/NSAFilterOperators.ts +92 -92
- package/src/NSARouterMaker.tsx +140 -140
- package/src/NSARouterMakerProps.ts +23 -23
- package/src/NSARouterMakerResult.ts +24 -24
- package/src/NSFRouterMaker.tsx +35 -35
- package/src/NSFRouterProps.ts +7 -7
- package/src/NSFRoutes.ts +30 -30
- package/src/Router.tsx +48 -48
- package/src/UseParams.tsx +17 -17
- package/src/components/NSAAccessListDialog.module.css +71 -71
- package/src/components/NSAAccessListDialog.tsx +178 -178
- package/src/components/NSABoxSecret.module.css +23 -23
- package/src/components/NSABoxSecret.tsx +264 -264
- package/src/components/NSAMasterMenu.module.css +250 -250
- package/src/components/NSAMasterMenu.tsx +169 -169
- package/src/components/NSAMasterMenuItem.tsx +250 -250
- package/src/components/NSAMessageListDialog.module.css +99 -99
- package/src/components/NSAMessageListDialog.tsx +142 -142
- package/src/components/NSANavigationGuard.tsx +79 -79
- package/src/components/NSAProductListDialog.module.css +44 -44
- package/src/components/NSAProductListDialog.tsx +88 -88
- package/src/components/NSATable.tsx +494 -494
- package/src/components/NSATaskBar.module.css +57 -57
- package/src/components/NSATaskBar.tsx +193 -193
- package/src/components/NSAUserDialog.module.css +67 -67
- package/src/components/NSAUserDialog.tsx +122 -122
- package/src/components/NSAWorkspaceListDialog.module.css +41 -41
- package/src/components/NSAWorkspaceListDialog.tsx +147 -147
- package/src/components/NSFBoxCategoryScope.tsx +52 -52
- package/src/components/NSFBoxField.tsx +37 -37
- package/src/components/NSFBoxSlot.tsx +71 -71
- package/src/components/NSFBoxWrapper.tsx +69 -69
- package/src/components/NSLabelSecret.tsx +37 -37
- package/src/components/quickfilter/NSAFilterBoxBase.tsx +89 -89
- package/src/components/quickfilter/NSAFilterBoxBoolean.tsx +66 -66
- package/src/components/quickfilter/NSAFilterBoxDate.tsx +110 -110
- package/src/components/quickfilter/NSAFilterBoxDateTime.tsx +110 -110
- package/src/components/quickfilter/NSAFilterBoxEnum.module.css +44 -44
- package/src/components/quickfilter/NSAFilterBoxEnum.tsx +79 -79
- package/src/components/quickfilter/NSAFilterBoxNumber.tsx +145 -145
- package/src/components/quickfilter/NSAFilterBoxString.tsx +83 -83
- package/src/components/quickfilter/NSAFilterBoxTime.tsx +106 -106
- package/src/components/quickfilter/NSAQuickFilterBar.module.css +19 -19
- package/src/components/quickfilter/NSAQuickFilterBar.tsx +142 -142
- package/src/components/quickfilter/NSAQuickFilterDialog.module.css +74 -74
- package/src/components/quickfilter/NSAQuickFilterDialog.tsx +260 -260
- package/src/css.d.ts +13 -13
- package/src/formatters/SecretFormatter.tsx +24 -24
- package/src/index.tsx +26 -26
- package/src/layouts/Actions.ts +146 -146
- package/src/layouts/CFTUtil.ts +18 -18
- package/src/layouts/NSALayout.tsx +744 -744
- package/src/layouts/NSALayout_Field.ts +125 -125
- package/src/layouts/NSASectionEdit.tsx +281 -281
- package/src/layouts/NSASectionEditTabPage.module.css +4 -4
- package/src/layouts/NSASectionEditTabPage.tsx +256 -256
- package/src/layouts/NSASectionList.module.css +31 -31
- package/src/layouts/NSASectionList.tsx +147 -147
- package/src/layouts/NSASectionView.tsx +98 -98
- package/src/layouts/NSASectionViewTabMore.tsx +78 -78
- package/src/layouts/NSASectionViewTabPage.module.css +47 -47
- package/src/layouts/NSASectionViewTabPage.tsx +400 -399
- package/src/main.ts +52 -52
- package/src/pages/NSAConsentPage.module.css +26 -26
- package/src/pages/NSAConsentPage.tsx +120 -120
- package/src/pages/NSAEmailVerificationPage.tsx +30 -30
- package/src/pages/NSAHomePage.module.css +41 -41
- package/src/pages/NSAHomePage.tsx +124 -124
- package/src/pages/NSALoginPage.module.css +26 -26
- package/src/pages/NSALoginPage.tsx +87 -87
- package/src/pages/NSAPhoneVerificationPage.tsx +94 -94
- package/src/pages/NSAVerificationPage.module.css +31 -31
- package/src/pages/NSAVerificationPage.tsx +185 -185
- package/src/pages/NSFCategoryEditPage.tsx +87 -87
- package/src/pages/NSFCategoryListPage.tsx +23 -23
- package/src/pages/NSFCategoryViewPage.tsx +23 -23
- package/src/pages/NSFEntities.ts +58 -58
- package/src/pages/PaymentRequired.tsx +80 -80
- package/tsconfig.json +43 -43
|
@@ -1,261 +1,261 @@
|
|
|
1
|
-
import { FilterItemOperator } from "namirasoft-core";
|
|
2
|
-
import { VariableType } from "namirasoft-schema";
|
|
3
|
-
import { NSBoxBaseCombo, NSBoxCombo, NSButton, NSButtonBlue, NSColumn, NSDialog, NSNoData, NSTitle, TableColumnInfo } from "namirasoft-site-react";
|
|
4
|
-
import { Component, Fragment } from "react";
|
|
5
|
-
import { NSAFilterOperators } from "../../NSAFilterOperators";
|
|
6
|
-
import Styles from "./NSAQuickFilterDialog.module.css";
|
|
7
|
-
|
|
8
|
-
export interface QuickFilterConfig
|
|
9
|
-
{
|
|
10
|
-
id: string;
|
|
11
|
-
column: {
|
|
12
|
-
table: { name: string; text: string };
|
|
13
|
-
name: string;
|
|
14
|
-
text: string;
|
|
15
|
-
type: string;
|
|
16
|
-
columnType: VariableType;
|
|
17
|
-
};
|
|
18
|
-
operatorName?: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface NSAQuickFilterDialogProps
|
|
22
|
-
{
|
|
23
|
-
configs: QuickFilterConfig[];
|
|
24
|
-
getColumns: () => TableColumnInfo[];
|
|
25
|
-
typeConverter: (type: string) => VariableType;
|
|
26
|
-
onSave: (configs: QuickFilterConfig[]) => void;
|
|
27
|
-
onConfirm: (configs: QuickFilterConfig[]) => void;
|
|
28
|
-
onClose: () => void;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface NSAQuickFilterDialogState
|
|
32
|
-
{
|
|
33
|
-
configs: QuickFilterConfig[];
|
|
34
|
-
formMode: "add" | "edit" | null;
|
|
35
|
-
editingId: string | null;
|
|
36
|
-
formColumn: TableColumnInfo | null;
|
|
37
|
-
formOperatorName: string | null;
|
|
38
|
-
formKey: number;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export class NSAQuickFilterDialog extends Component<NSAQuickFilterDialogProps, NSAQuickFilterDialogState>
|
|
42
|
-
{
|
|
43
|
-
constructor(props: NSAQuickFilterDialogProps)
|
|
44
|
-
{
|
|
45
|
-
super(props);
|
|
46
|
-
this.state = {
|
|
47
|
-
configs: [...props.configs],
|
|
48
|
-
formMode: null,
|
|
49
|
-
editingId: null,
|
|
50
|
-
formColumn: null,
|
|
51
|
-
formOperatorName: null,
|
|
52
|
-
formKey: 0,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
private openAdd = () =>
|
|
57
|
-
{
|
|
58
|
-
this.setState(prev => ({
|
|
59
|
-
formMode: "add",
|
|
60
|
-
editingId: null,
|
|
61
|
-
formColumn: null,
|
|
62
|
-
formOperatorName: null,
|
|
63
|
-
formKey: prev.formKey + 1,
|
|
64
|
-
}));
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
private openEdit = (config: QuickFilterConfig) =>
|
|
68
|
-
{
|
|
69
|
-
const col = this.props.getColumns().find(
|
|
70
|
-
c => c.table.name === config.column.table.name && c.name === config.column.name
|
|
71
|
-
) ?? null;
|
|
72
|
-
this.setState(prev => ({
|
|
73
|
-
formMode: "edit",
|
|
74
|
-
editingId: config.id,
|
|
75
|
-
formColumn: col,
|
|
76
|
-
formOperatorName: config.operatorName ?? null,
|
|
77
|
-
formKey: prev.formKey + 1,
|
|
78
|
-
}));
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
private deleteConfig = (id: string) =>
|
|
82
|
-
{
|
|
83
|
-
this.setState(prev => ({ configs: prev.configs.filter(c => c.id !== id) }));
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
private hasChanges(): boolean
|
|
87
|
-
{
|
|
88
|
-
return JSON.stringify(this.state.configs) !== JSON.stringify(this.props.configs);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
private saveForm = () =>
|
|
92
|
-
{
|
|
93
|
-
const { formColumn, formOperatorName, formMode, editingId, configs } = this.state;
|
|
94
|
-
if (!formColumn) return;
|
|
95
|
-
|
|
96
|
-
const columnType = this.props.typeConverter(formColumn.type);
|
|
97
|
-
const isBoolean = columnType === VariableType.Boolean;
|
|
98
|
-
|
|
99
|
-
const newConfig: QuickFilterConfig = {
|
|
100
|
-
id: formMode === "edit" && editingId ? editingId : crypto.randomUUID(),
|
|
101
|
-
column: {
|
|
102
|
-
table: { name: formColumn.table.name, text: formColumn.table.text },
|
|
103
|
-
name: formColumn.name,
|
|
104
|
-
text: formColumn.text,
|
|
105
|
-
type: formColumn.type,
|
|
106
|
-
columnType,
|
|
107
|
-
},
|
|
108
|
-
operatorName: isBoolean ? undefined : (formOperatorName ?? undefined),
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const updatedConfigs = formMode === "edit" && editingId
|
|
112
|
-
? configs.map(c => c.id === editingId ? newConfig : c)
|
|
113
|
-
: [...configs, newConfig];
|
|
114
|
-
|
|
115
|
-
this.setState({ configs: updatedConfigs, formMode: null }, () =>
|
|
116
|
-
{
|
|
117
|
-
this.props.onSave(updatedConfigs);
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
override render()
|
|
122
|
-
{
|
|
123
|
-
const { onClose, onConfirm, getColumns, typeConverter } = this.props;
|
|
124
|
-
const { configs, formMode, formColumn, formOperatorName, formKey } = this.state;
|
|
125
|
-
|
|
126
|
-
const columns = getColumns();
|
|
127
|
-
const columnType = formColumn ? typeConverter(formColumn.type) : null;
|
|
128
|
-
const isBoolean = columnType === VariableType.Boolean;
|
|
129
|
-
const operators = columnType && !isBoolean ? NSAFilterOperators.getQuickFilterOperators(columnType) : [];
|
|
130
|
-
|
|
131
|
-
return (
|
|
132
|
-
<NSDialog
|
|
133
|
-
center_dialog
|
|
134
|
-
closeButton={{ show: true }}
|
|
135
|
-
onClose={onClose}
|
|
136
|
-
>
|
|
137
|
-
<NSColumn classList={["align-items-center"]}>
|
|
138
|
-
<NSTitle
|
|
139
|
-
title="Quick Filters"
|
|
140
|
-
style={{ marginBottom: 0, fontSize: 24 }}
|
|
141
|
-
/>
|
|
142
|
-
|
|
143
|
-
{
|
|
144
|
-
configs.length === 0 && !formMode &&
|
|
145
|
-
<NSNoData lable="No quick filters defined" style={{ marginBottom: 16, fontSize: 20 }} />
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
{
|
|
149
|
-
configs.length > 0 && !formMode && (
|
|
150
|
-
<NSColumn classList={["gap-2"]}>
|
|
151
|
-
{
|
|
152
|
-
configs.map(cfg =>
|
|
153
|
-
{
|
|
154
|
-
const opLabel = cfg.operatorName
|
|
155
|
-
? FilterItemOperator.getByName(cfg.operatorName).name
|
|
156
|
-
: "—";
|
|
157
|
-
return (
|
|
158
|
-
<div key={cfg.id} className={Styles.qf_item}>
|
|
159
|
-
<div className={Styles.qf_item_info}>
|
|
160
|
-
<span className={Styles.qf_item_label}>{cfg.column.text}</span>
|
|
161
|
-
<span className={Styles.qf_item_op}>{opLabel}</span>
|
|
162
|
-
</div>
|
|
163
|
-
<div className={Styles.qf_item_actions}>
|
|
164
|
-
<NSButton
|
|
165
|
-
title=""
|
|
166
|
-
icon={{ src: "https://static.namirasoft.com/image/concept/edit/blue.svg", alt: "edit" }}
|
|
167
|
-
classList={[Styles.qf_item_btn]}
|
|
168
|
-
onClick={{ action: () => this.openEdit(cfg), showLoading: false }}
|
|
169
|
-
/>
|
|
170
|
-
<NSButton
|
|
171
|
-
title=""
|
|
172
|
-
icon={{ src: "https://static.namirasoft.com/image/concept/delete/blue.svg", alt: "delete" }}
|
|
173
|
-
classList={[Styles.qf_item_btn]}
|
|
174
|
-
onClick={{ action: () => this.deleteConfig(cfg.id), showLoading: false }}
|
|
175
|
-
/>
|
|
176
|
-
</div>
|
|
177
|
-
</div>
|
|
178
|
-
);
|
|
179
|
-
})
|
|
180
|
-
}
|
|
181
|
-
</NSColumn>
|
|
182
|
-
)
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
{
|
|
186
|
-
formMode &&
|
|
187
|
-
<Fragment key={formKey}>
|
|
188
|
-
<NSBoxBaseCombo<TableColumnInfo>
|
|
189
|
-
title="Column"
|
|
190
|
-
required
|
|
191
|
-
defaultValue={formColumn?.name}
|
|
192
|
-
getItems={async () => ({ count: columns.length, rows: columns })}
|
|
193
|
-
getTitle={c => c.text}
|
|
194
|
-
getValue={c => c.name}
|
|
195
|
-
getSort={() => null}
|
|
196
|
-
multiple={false}
|
|
197
|
-
onChanged={e =>
|
|
198
|
-
{
|
|
199
|
-
const col = e.getDataOne();
|
|
200
|
-
this.setState({ formColumn: col ?? null, formOperatorName: null });
|
|
201
|
-
}}
|
|
202
|
-
menu={{
|
|
203
|
-
builtin: {
|
|
204
|
-
copy: { enabled: false, getValue: () => "" }
|
|
205
|
-
},
|
|
206
|
-
items: []
|
|
207
|
-
}}
|
|
208
|
-
/>
|
|
209
|
-
<NSBoxCombo
|
|
210
|
-
key={formColumn?.name}
|
|
211
|
-
title="Operator"
|
|
212
|
-
required
|
|
213
|
-
disabled={!formColumn || isBoolean}
|
|
214
|
-
defaultValue={formOperatorName ?? undefined}
|
|
215
|
-
getOptions={() => operators.map(op => ({ value: NSAFilterOperators.getOperatorKey(op), title: `${op.sign} (${op.name})` }))}
|
|
216
|
-
multiple={false}
|
|
217
|
-
searchable={false}
|
|
218
|
-
onChanged={e => this.setState({ formOperatorName: e.getValueOne(false) ?? null })}
|
|
219
|
-
menu={{
|
|
220
|
-
builtin: {
|
|
221
|
-
copy: { enabled: false, getValue: () => "" }
|
|
222
|
-
},
|
|
223
|
-
items: []
|
|
224
|
-
}}
|
|
225
|
-
/>
|
|
226
|
-
<NSButtonBlue
|
|
227
|
-
title="Save"
|
|
228
|
-
onClick={{ action: this.saveForm, showLoading: false }}
|
|
229
|
-
/>
|
|
230
|
-
<NSButton
|
|
231
|
-
title=""
|
|
232
|
-
icon={{ src: "https://static.namirasoft.com/image/concept/arrow/left/blue.svg", alt: "back" }}
|
|
233
|
-
classList={[Styles.qf_back_btn]}
|
|
234
|
-
onClick={{ action: () => this.setState({ formMode: null }), showLoading: false }}
|
|
235
|
-
style={{ width: 40, height: 40 }}
|
|
236
|
-
/>
|
|
237
|
-
</Fragment>
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
{
|
|
241
|
-
!formMode &&
|
|
242
|
-
<>
|
|
243
|
-
<NSButton
|
|
244
|
-
title="+ Add Filter"
|
|
245
|
-
onClick={{ action: this.openAdd, showLoading: false }}
|
|
246
|
-
style={{ border: "1px solid #000" }}
|
|
247
|
-
/>
|
|
248
|
-
{
|
|
249
|
-
this.hasChanges() &&
|
|
250
|
-
<NSButtonBlue
|
|
251
|
-
title="Save Changes"
|
|
252
|
-
onClick={{ action: () => onConfirm(this.state.configs), showLoading: false }}
|
|
253
|
-
/>
|
|
254
|
-
}
|
|
255
|
-
</>
|
|
256
|
-
}
|
|
257
|
-
</NSColumn>
|
|
258
|
-
</NSDialog>
|
|
259
|
-
);
|
|
260
|
-
}
|
|
1
|
+
import { FilterItemOperator } from "namirasoft-core";
|
|
2
|
+
import { VariableType } from "namirasoft-schema";
|
|
3
|
+
import { NSBoxBaseCombo, NSBoxCombo, NSButton, NSButtonBlue, NSColumn, NSDialog, NSNoData, NSTitle, TableColumnInfo } from "namirasoft-site-react";
|
|
4
|
+
import { Component, Fragment } from "react";
|
|
5
|
+
import { NSAFilterOperators } from "../../NSAFilterOperators";
|
|
6
|
+
import Styles from "./NSAQuickFilterDialog.module.css";
|
|
7
|
+
|
|
8
|
+
export interface QuickFilterConfig
|
|
9
|
+
{
|
|
10
|
+
id: string;
|
|
11
|
+
column: {
|
|
12
|
+
table: { name: string; text: string };
|
|
13
|
+
name: string;
|
|
14
|
+
text: string;
|
|
15
|
+
type: string;
|
|
16
|
+
columnType: VariableType;
|
|
17
|
+
};
|
|
18
|
+
operatorName?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface NSAQuickFilterDialogProps
|
|
22
|
+
{
|
|
23
|
+
configs: QuickFilterConfig[];
|
|
24
|
+
getColumns: () => TableColumnInfo[];
|
|
25
|
+
typeConverter: (type: string) => VariableType;
|
|
26
|
+
onSave: (configs: QuickFilterConfig[]) => void;
|
|
27
|
+
onConfirm: (configs: QuickFilterConfig[]) => void;
|
|
28
|
+
onClose: () => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface NSAQuickFilterDialogState
|
|
32
|
+
{
|
|
33
|
+
configs: QuickFilterConfig[];
|
|
34
|
+
formMode: "add" | "edit" | null;
|
|
35
|
+
editingId: string | null;
|
|
36
|
+
formColumn: TableColumnInfo | null;
|
|
37
|
+
formOperatorName: string | null;
|
|
38
|
+
formKey: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export class NSAQuickFilterDialog extends Component<NSAQuickFilterDialogProps, NSAQuickFilterDialogState>
|
|
42
|
+
{
|
|
43
|
+
constructor(props: NSAQuickFilterDialogProps)
|
|
44
|
+
{
|
|
45
|
+
super(props);
|
|
46
|
+
this.state = {
|
|
47
|
+
configs: [...props.configs],
|
|
48
|
+
formMode: null,
|
|
49
|
+
editingId: null,
|
|
50
|
+
formColumn: null,
|
|
51
|
+
formOperatorName: null,
|
|
52
|
+
formKey: 0,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private openAdd = () =>
|
|
57
|
+
{
|
|
58
|
+
this.setState(prev => ({
|
|
59
|
+
formMode: "add",
|
|
60
|
+
editingId: null,
|
|
61
|
+
formColumn: null,
|
|
62
|
+
formOperatorName: null,
|
|
63
|
+
formKey: prev.formKey + 1,
|
|
64
|
+
}));
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
private openEdit = (config: QuickFilterConfig) =>
|
|
68
|
+
{
|
|
69
|
+
const col = this.props.getColumns().find(
|
|
70
|
+
c => c.table.name === config.column.table.name && c.name === config.column.name
|
|
71
|
+
) ?? null;
|
|
72
|
+
this.setState(prev => ({
|
|
73
|
+
formMode: "edit",
|
|
74
|
+
editingId: config.id,
|
|
75
|
+
formColumn: col,
|
|
76
|
+
formOperatorName: config.operatorName ?? null,
|
|
77
|
+
formKey: prev.formKey + 1,
|
|
78
|
+
}));
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
private deleteConfig = (id: string) =>
|
|
82
|
+
{
|
|
83
|
+
this.setState(prev => ({ configs: prev.configs.filter(c => c.id !== id) }));
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
private hasChanges(): boolean
|
|
87
|
+
{
|
|
88
|
+
return JSON.stringify(this.state.configs) !== JSON.stringify(this.props.configs);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private saveForm = () =>
|
|
92
|
+
{
|
|
93
|
+
const { formColumn, formOperatorName, formMode, editingId, configs } = this.state;
|
|
94
|
+
if (!formColumn) return;
|
|
95
|
+
|
|
96
|
+
const columnType = this.props.typeConverter(formColumn.type);
|
|
97
|
+
const isBoolean = columnType === VariableType.Boolean;
|
|
98
|
+
|
|
99
|
+
const newConfig: QuickFilterConfig = {
|
|
100
|
+
id: formMode === "edit" && editingId ? editingId : crypto.randomUUID(),
|
|
101
|
+
column: {
|
|
102
|
+
table: { name: formColumn.table.name, text: formColumn.table.text },
|
|
103
|
+
name: formColumn.name,
|
|
104
|
+
text: formColumn.text,
|
|
105
|
+
type: formColumn.type,
|
|
106
|
+
columnType,
|
|
107
|
+
},
|
|
108
|
+
operatorName: isBoolean ? undefined : (formOperatorName ?? undefined),
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const updatedConfigs = formMode === "edit" && editingId
|
|
112
|
+
? configs.map(c => c.id === editingId ? newConfig : c)
|
|
113
|
+
: [...configs, newConfig];
|
|
114
|
+
|
|
115
|
+
this.setState({ configs: updatedConfigs, formMode: null }, () =>
|
|
116
|
+
{
|
|
117
|
+
this.props.onSave(updatedConfigs);
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
override render()
|
|
122
|
+
{
|
|
123
|
+
const { onClose, onConfirm, getColumns, typeConverter } = this.props;
|
|
124
|
+
const { configs, formMode, formColumn, formOperatorName, formKey } = this.state;
|
|
125
|
+
|
|
126
|
+
const columns = getColumns();
|
|
127
|
+
const columnType = formColumn ? typeConverter(formColumn.type) : null;
|
|
128
|
+
const isBoolean = columnType === VariableType.Boolean;
|
|
129
|
+
const operators = columnType && !isBoolean ? NSAFilterOperators.getQuickFilterOperators(columnType) : [];
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<NSDialog
|
|
133
|
+
center_dialog
|
|
134
|
+
closeButton={{ show: true }}
|
|
135
|
+
onClose={onClose}
|
|
136
|
+
>
|
|
137
|
+
<NSColumn classList={["align-items-center"]}>
|
|
138
|
+
<NSTitle
|
|
139
|
+
title="Quick Filters"
|
|
140
|
+
style={{ marginBottom: 0, fontSize: 24 }}
|
|
141
|
+
/>
|
|
142
|
+
|
|
143
|
+
{
|
|
144
|
+
configs.length === 0 && !formMode &&
|
|
145
|
+
<NSNoData lable="No quick filters defined" style={{ marginBottom: 16, fontSize: 20 }} />
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
{
|
|
149
|
+
configs.length > 0 && !formMode && (
|
|
150
|
+
<NSColumn classList={["gap-2"]}>
|
|
151
|
+
{
|
|
152
|
+
configs.map(cfg =>
|
|
153
|
+
{
|
|
154
|
+
const opLabel = cfg.operatorName
|
|
155
|
+
? FilterItemOperator.getByName(cfg.operatorName).name
|
|
156
|
+
: "—";
|
|
157
|
+
return (
|
|
158
|
+
<div key={cfg.id} className={Styles.qf_item}>
|
|
159
|
+
<div className={Styles.qf_item_info}>
|
|
160
|
+
<span className={Styles.qf_item_label}>{cfg.column.text}</span>
|
|
161
|
+
<span className={Styles.qf_item_op}>{opLabel}</span>
|
|
162
|
+
</div>
|
|
163
|
+
<div className={Styles.qf_item_actions}>
|
|
164
|
+
<NSButton
|
|
165
|
+
title=""
|
|
166
|
+
icon={{ src: "https://static.namirasoft.com/image/concept/edit/blue.svg", alt: "edit" }}
|
|
167
|
+
classList={[Styles.qf_item_btn]}
|
|
168
|
+
onClick={{ action: () => this.openEdit(cfg), showLoading: false }}
|
|
169
|
+
/>
|
|
170
|
+
<NSButton
|
|
171
|
+
title=""
|
|
172
|
+
icon={{ src: "https://static.namirasoft.com/image/concept/delete/blue.svg", alt: "delete" }}
|
|
173
|
+
classList={[Styles.qf_item_btn]}
|
|
174
|
+
onClick={{ action: () => this.deleteConfig(cfg.id), showLoading: false }}
|
|
175
|
+
/>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
);
|
|
179
|
+
})
|
|
180
|
+
}
|
|
181
|
+
</NSColumn>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
{
|
|
186
|
+
formMode &&
|
|
187
|
+
<Fragment key={formKey}>
|
|
188
|
+
<NSBoxBaseCombo<TableColumnInfo>
|
|
189
|
+
title="Column"
|
|
190
|
+
required
|
|
191
|
+
defaultValue={formColumn?.name}
|
|
192
|
+
getItems={async () => ({ count: columns.length, rows: columns })}
|
|
193
|
+
getTitle={c => c.text}
|
|
194
|
+
getValue={c => c.name}
|
|
195
|
+
getSort={() => null}
|
|
196
|
+
multiple={false}
|
|
197
|
+
onChanged={e =>
|
|
198
|
+
{
|
|
199
|
+
const col = e.getDataOne();
|
|
200
|
+
this.setState({ formColumn: col ?? null, formOperatorName: null });
|
|
201
|
+
}}
|
|
202
|
+
menu={{
|
|
203
|
+
builtin: {
|
|
204
|
+
copy: { enabled: false, getValue: () => "" }
|
|
205
|
+
},
|
|
206
|
+
items: []
|
|
207
|
+
}}
|
|
208
|
+
/>
|
|
209
|
+
<NSBoxCombo
|
|
210
|
+
key={formColumn?.name}
|
|
211
|
+
title="Operator"
|
|
212
|
+
required
|
|
213
|
+
disabled={!formColumn || isBoolean}
|
|
214
|
+
defaultValue={formOperatorName ?? undefined}
|
|
215
|
+
getOptions={() => operators.map(op => ({ value: NSAFilterOperators.getOperatorKey(op), title: `${op.sign} (${op.name})` }))}
|
|
216
|
+
multiple={false}
|
|
217
|
+
searchable={false}
|
|
218
|
+
onChanged={e => this.setState({ formOperatorName: e.getValueOne(false) ?? null })}
|
|
219
|
+
menu={{
|
|
220
|
+
builtin: {
|
|
221
|
+
copy: { enabled: false, getValue: () => "" }
|
|
222
|
+
},
|
|
223
|
+
items: []
|
|
224
|
+
}}
|
|
225
|
+
/>
|
|
226
|
+
<NSButtonBlue
|
|
227
|
+
title="Save"
|
|
228
|
+
onClick={{ action: this.saveForm, showLoading: false }}
|
|
229
|
+
/>
|
|
230
|
+
<NSButton
|
|
231
|
+
title=""
|
|
232
|
+
icon={{ src: "https://static.namirasoft.com/image/concept/arrow/left/blue.svg", alt: "back" }}
|
|
233
|
+
classList={[Styles.qf_back_btn]}
|
|
234
|
+
onClick={{ action: () => this.setState({ formMode: null }), showLoading: false }}
|
|
235
|
+
style={{ width: 40, height: 40 }}
|
|
236
|
+
/>
|
|
237
|
+
</Fragment>
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
{
|
|
241
|
+
!formMode &&
|
|
242
|
+
<>
|
|
243
|
+
<NSButton
|
|
244
|
+
title="+ Add Filter"
|
|
245
|
+
onClick={{ action: this.openAdd, showLoading: false }}
|
|
246
|
+
style={{ border: "1px solid #000" }}
|
|
247
|
+
/>
|
|
248
|
+
{
|
|
249
|
+
this.hasChanges() &&
|
|
250
|
+
<NSButtonBlue
|
|
251
|
+
title="Save Changes"
|
|
252
|
+
onClick={{ action: () => onConfirm(this.state.configs), showLoading: false }}
|
|
253
|
+
/>
|
|
254
|
+
}
|
|
255
|
+
</>
|
|
256
|
+
}
|
|
257
|
+
</NSColumn>
|
|
258
|
+
</NSDialog>
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
261
|
}
|
package/src/css.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
let css_d = "";
|
|
2
|
-
|
|
3
|
-
declare module "*.module.css" {
|
|
4
|
-
const classes: { readonly [key: string]: string };
|
|
5
|
-
export default classes;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
declare module "*.module.scss" {
|
|
9
|
-
const classes: { readonly [key: string]: string };
|
|
10
|
-
export default classes;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
declare module "*.css";
|
|
1
|
+
let css_d = "";
|
|
2
|
+
|
|
3
|
+
declare module "*.module.css" {
|
|
4
|
+
const classes: { readonly [key: string]: string };
|
|
5
|
+
export default classes;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
declare module "*.module.scss" {
|
|
9
|
+
const classes: { readonly [key: string]: string };
|
|
10
|
+
export default classes;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare module "*.css";
|
|
14
14
|
declare module "*.scss";
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { NamirasoftSecretServer } from "namirasoft-secret";
|
|
2
|
-
import { BaseColumnFormatter, SensitiveFormatter, TableColumnInfo, TableRowInfo } from "namirasoft-site-react";
|
|
3
|
-
|
|
4
|
-
export class SecretFormatter<RowType = any> extends BaseColumnFormatter
|
|
5
|
-
{
|
|
6
|
-
private sensitive_formatter;
|
|
7
|
-
public decryptor?: (value: string) => Promise<string>;
|
|
8
|
-
constructor(public server: NamirasoftSecretServer, public isSensitive: (col: TableColumnInfo, row: TableRowInfo<RowType>) => boolean, copy: boolean = true, width: string = "240px")
|
|
9
|
-
{
|
|
10
|
-
super();
|
|
11
|
-
this.width = width;
|
|
12
|
-
let decryptor_secret = async (value: string) =>
|
|
13
|
-
{
|
|
14
|
-
let decrypted = await this.server.secret.GetValue(value);
|
|
15
|
-
if (this.decryptor)
|
|
16
|
-
decrypted = await this.decryptor(decrypted);
|
|
17
|
-
return decrypted;
|
|
18
|
-
};
|
|
19
|
-
this.sensitive_formatter = new SensitiveFormatter(decryptor_secret, this.isSensitive, copy, this.width);
|
|
20
|
-
}
|
|
21
|
-
override format(value: any, col: TableColumnInfo, row: TableRowInfo<RowType>, printable: boolean): any
|
|
22
|
-
{
|
|
23
|
-
return this.sensitive_formatter.format(value, col, row, printable);
|
|
24
|
-
}
|
|
1
|
+
import { NamirasoftSecretServer } from "namirasoft-secret";
|
|
2
|
+
import { BaseColumnFormatter, SensitiveFormatter, TableColumnInfo, TableRowInfo } from "namirasoft-site-react";
|
|
3
|
+
|
|
4
|
+
export class SecretFormatter<RowType = any> extends BaseColumnFormatter
|
|
5
|
+
{
|
|
6
|
+
private sensitive_formatter;
|
|
7
|
+
public decryptor?: (value: string) => Promise<string>;
|
|
8
|
+
constructor(public server: NamirasoftSecretServer, public isSensitive: (col: TableColumnInfo, row: TableRowInfo<RowType>) => boolean, copy: boolean = true, width: string = "240px")
|
|
9
|
+
{
|
|
10
|
+
super();
|
|
11
|
+
this.width = width;
|
|
12
|
+
let decryptor_secret = async (value: string) =>
|
|
13
|
+
{
|
|
14
|
+
let decrypted = await this.server.secret.GetValue(value);
|
|
15
|
+
if (this.decryptor)
|
|
16
|
+
decrypted = await this.decryptor(decrypted);
|
|
17
|
+
return decrypted;
|
|
18
|
+
};
|
|
19
|
+
this.sensitive_formatter = new SensitiveFormatter(decryptor_secret, this.isSensitive, copy, this.width);
|
|
20
|
+
}
|
|
21
|
+
override format(value: any, col: TableColumnInfo, row: TableRowInfo<RowType>, printable: boolean): any
|
|
22
|
+
{
|
|
23
|
+
return this.sensitive_formatter.format(value, col, row, printable);
|
|
24
|
+
}
|
|
25
25
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import ReactDOM from "react-dom/client";
|
|
2
|
-
import Router from "./Router";
|
|
3
|
-
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
|
4
|
-
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
5
|
-
import "./index.css";
|
|
6
|
-
|
|
7
|
-
const root = ReactDOM.createRoot(
|
|
8
|
-
document.getElementById("root") as HTMLElement
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
// base
|
|
12
|
-
const REACT_APP_BASE_PATH = process.env.REACT_APP_BASE_PATH;
|
|
13
|
-
if (REACT_APP_BASE_PATH)
|
|
14
|
-
{
|
|
15
|
-
const baseElement = document.createElement('base');
|
|
16
|
-
baseElement.href = REACT_APP_BASE_PATH + "/";
|
|
17
|
-
const head = document.querySelector('head');
|
|
18
|
-
head?.appendChild(baseElement);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const router = createBrowserRouter([
|
|
22
|
-
{ path: "*", element: <Router /> }
|
|
23
|
-
]);
|
|
24
|
-
|
|
25
|
-
root.render(
|
|
26
|
-
<RouterProvider router={router} />
|
|
1
|
+
import ReactDOM from "react-dom/client";
|
|
2
|
+
import Router from "./Router";
|
|
3
|
+
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
|
4
|
+
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
5
|
+
import "./index.css";
|
|
6
|
+
|
|
7
|
+
const root = ReactDOM.createRoot(
|
|
8
|
+
document.getElementById("root") as HTMLElement
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
// base
|
|
12
|
+
const REACT_APP_BASE_PATH = process.env.REACT_APP_BASE_PATH;
|
|
13
|
+
if (REACT_APP_BASE_PATH)
|
|
14
|
+
{
|
|
15
|
+
const baseElement = document.createElement('base');
|
|
16
|
+
baseElement.href = REACT_APP_BASE_PATH + "/";
|
|
17
|
+
const head = document.querySelector('head');
|
|
18
|
+
head?.appendChild(baseElement);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const router = createBrowserRouter([
|
|
22
|
+
{ path: "*", element: <Router /> }
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
root.render(
|
|
26
|
+
<RouterProvider router={router} />
|
|
27
27
|
);
|