namirasoft-account-react 1.3.198 → 1.3.199
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/layouts/NSALayout.d.ts +13 -10
- package/dist/layouts/NSALayout.js +16 -9
- package/dist/layouts/NSALayout.js.map +1 -1
- package/dist/layouts/NSASectionEdit.d.ts +7 -7
- package/dist/layouts/NSASectionEdit.js +11 -4
- package/dist/layouts/NSASectionEdit.js.map +1 -1
- package/dist/layouts/NSASectionList.d.ts +3 -2
- package/dist/layouts/NSASectionList.js +11 -11
- package/dist/layouts/NSASectionList.js.map +1 -1
- package/dist/layouts/NSASectionTabs.d.ts +6 -6
- package/dist/layouts/NSASectionTabs.js +8 -4
- package/dist/layouts/NSASectionTabs.js.map +1 -1
- package/dist/layouts/NSASectionView.d.ts +5 -6
- package/dist/layouts/NSASectionView.js +8 -4
- package/dist/layouts/NSASectionView.js.map +1 -1
- package/package.json +2 -2
- package/src/layouts/NSALayout.tsx +29 -13
- package/src/layouts/NSASectionEdit.tsx +22 -5
- package/src/layouts/NSASectionList.tsx +11 -11
- package/src/layouts/NSASectionTabs.tsx +18 -4
- package/src/layouts/NSASectionView.tsx +24 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IBaseComponentProps, INSBarActionProps, INSBarHeroBannerProps, INSBarNotificationProps, INSBarTitleProps } from 'namirasoft-site-react';
|
|
2
|
-
import { NSASectionListProps } from './NSASectionList';
|
|
3
|
-
import { NSASectionEditProps } from './NSASectionEdit';
|
|
4
|
-
import { NSASectionViewProps } from './NSASectionView';
|
|
2
|
+
import { NSASectionList, NSASectionListProps } from './NSASectionList';
|
|
3
|
+
import { NSASectionEditProps, NSASectionEditRef } from './NSASectionEdit';
|
|
4
|
+
import { NSASectionViewProps, NSASectionViewRef } from './NSASectionView';
|
|
5
5
|
import { IHeaderProps } from 'namirasoft-site-react';
|
|
6
6
|
import { ReactNode } from 'react';
|
|
7
7
|
import { INSARouterProps } from '../INSARouterProps';
|
|
@@ -38,12 +38,15 @@ export interface NSALayoutProps<EntityType extends {
|
|
|
38
38
|
};
|
|
39
39
|
children: ReactNode;
|
|
40
40
|
}
|
|
41
|
-
export interface
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
export interface NSALayoutRef<EntityType extends {
|
|
42
|
+
id: string;
|
|
43
|
+
}, EntityTypeInput = EntityType> {
|
|
44
|
+
list: NSASectionList<EntityType, EntityTypeInput> | null;
|
|
45
|
+
edit: NSASectionEditRef | null;
|
|
46
|
+
view: NSASectionViewRef | null;
|
|
46
47
|
}
|
|
47
|
-
export declare
|
|
48
|
+
export declare const NSALayout: import("react").ForwardRefExoticComponent<NSALayoutProps<{
|
|
49
|
+
id: string;
|
|
50
|
+
}, unknown> & import("react").RefAttributes<NSALayoutRef<{
|
|
48
51
|
id: string;
|
|
49
|
-
},
|
|
52
|
+
}, unknown>>>;
|
|
@@ -13,16 +13,18 @@ import { NSLayout } from 'namirasoft-site-react';
|
|
|
13
13
|
import { NSASectionList } from './NSASectionList';
|
|
14
14
|
import { NSASectionEdit, onApply as NSASectionEdit_onApply } from './NSASectionEdit';
|
|
15
15
|
import { NSASectionView } from './NSASectionView';
|
|
16
|
-
import { useRef, useState } from 'react';
|
|
16
|
+
import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
|
17
17
|
import { Actions } from './Actions';
|
|
18
18
|
import { useParams } from 'react-router-dom';
|
|
19
19
|
import { NamingConvention } from 'namirasoft-core';
|
|
20
20
|
import { NSAMessageDialog } from '../main';
|
|
21
21
|
import NSAAccessModel from '../components/NSAAccessModal';
|
|
22
22
|
import NSAProductListModal from '../components/NSAProductListModal';
|
|
23
|
-
export
|
|
23
|
+
export const NSALayout = forwardRef((props, ref) => {
|
|
24
24
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
|
|
25
|
-
const
|
|
25
|
+
const NSASectionList_Ref = useRef(null);
|
|
26
|
+
const NSASectionEdit_Ref = useRef(null);
|
|
27
|
+
const NSASectionView_Ref = useRef(null);
|
|
26
28
|
const [state, setState] = useState({ showDeleteModal: false, showMessageModal: false, showAccessModal: false, showProductModal: false });
|
|
27
29
|
const hideDeleteModal = () => { setState(prevState => (Object.assign(Object.assign({}, prevState), { showDeleteModal: false }))); };
|
|
28
30
|
const showDeleteModal = () => { setState(prevState => (Object.assign(Object.assign({}, prevState), { showDeleteModal: true }))); };
|
|
@@ -68,7 +70,7 @@ export function NSALayout(props) {
|
|
|
68
70
|
let { id } = useParams();
|
|
69
71
|
let getIDs = null;
|
|
70
72
|
if ((_a = props.pages) === null || _a === void 0 ? void 0 : _a.list)
|
|
71
|
-
getIDs = () => { var _a, _b; return (_b = (_a =
|
|
73
|
+
getIDs = () => { var _a, _b; return (_b = (_a = NSASectionList_Ref.current) === null || _a === void 0 ? void 0 : _a.getSelectedIDs()) !== null && _b !== void 0 ? _b : []; };
|
|
72
74
|
if ((_b = props.pages) === null || _b === void 0 ? void 0 : _b.edit)
|
|
73
75
|
getIDs = () => [id].filter(id => id);
|
|
74
76
|
if ((_c = props.pages) === null || _c === void 0 ? void 0 : _c.view)
|
|
@@ -119,24 +121,29 @@ export function NSALayout(props) {
|
|
|
119
121
|
let content;
|
|
120
122
|
if ((_2 = props.pages) === null || _2 === void 0 ? void 0 : _2.list) {
|
|
121
123
|
action_name = "List";
|
|
122
|
-
content = _jsx(NSASectionList, Object.assign({ ref:
|
|
124
|
+
content = _jsx(NSASectionList, Object.assign({ ref: NSASectionList_Ref }, props, props.pages.list, { entity: props.pages.entity }));
|
|
123
125
|
}
|
|
124
126
|
else if ((_3 = props.pages) === null || _3 === void 0 ? void 0 : _3.edit) {
|
|
125
127
|
if (props.pages.edit.isEdit)
|
|
126
128
|
action_name = "Edit";
|
|
127
129
|
else
|
|
128
130
|
action_name = "New";
|
|
129
|
-
content = _jsx(NSASectionEdit, Object.assign({}, props.pages.edit, { entity: props.pages.entity, children: props.children }));
|
|
131
|
+
content = _jsx(NSASectionEdit, Object.assign({ ref: NSASectionEdit_Ref }, props.pages.edit, { entity: props.pages.entity, children: props.children }));
|
|
130
132
|
}
|
|
131
133
|
else if ((_4 = props.pages) === null || _4 === void 0 ? void 0 : _4.view) {
|
|
132
134
|
action_name = "View";
|
|
133
|
-
content = _jsx(NSASectionView, Object.assign({}, props.pages.view, { entity: props.pages.entity }));
|
|
135
|
+
content = _jsx(NSASectionView, Object.assign({ ref: NSASectionView_Ref }, props.pages.view, { entity: props.pages.entity }));
|
|
134
136
|
}
|
|
135
137
|
else
|
|
136
138
|
content = props.children;
|
|
137
139
|
let fullname = "";
|
|
138
140
|
if ((_5 = props.pages) === null || _5 === void 0 ? void 0 : _5.entity.name)
|
|
139
141
|
fullname = action_name + " " + props.pages.entity.name;
|
|
142
|
+
useImperativeHandle(ref, () => ({
|
|
143
|
+
list: NSASectionList_Ref.current,
|
|
144
|
+
edit: NSASectionEdit_Ref.current,
|
|
145
|
+
view: NSASectionView_Ref.current,
|
|
146
|
+
}));
|
|
140
147
|
return (_jsx(NSLayout, Object.assign({}, props, { header: {
|
|
141
148
|
title: (user_name + " " + ((_7 = (_6 = props.header) === null || _6 === void 0 ? void 0 : _6.title) !== null && _7 !== void 0 ? _7 : "")).trim(),
|
|
142
149
|
icons: [...icons, ...((_9 = (_8 = props.header) === null || _8 === void 0 ? void 0 : _8.icons) !== null && _9 !== void 0 ? _9 : [])]
|
|
@@ -144,7 +151,7 @@ export function NSALayout(props) {
|
|
|
144
151
|
title: (_11 = (_10 = action === null || action === void 0 ? void 0 : action.title) !== null && _10 !== void 0 ? _10 : (fullname)) !== null && _11 !== void 0 ? _11 : "",
|
|
145
152
|
description: action === null || action === void 0 ? void 0 : action.description,
|
|
146
153
|
menus: action.menus
|
|
147
|
-
}, children: _jsxs("div", { className: "container-fluid", children: [_jsx(NSModal, { title: `Are you sure you want to delete ${name}?`, description: "", show: state.showDeleteModal, onClose: hideDeleteModal, children: _jsx(NSButtonRed, { title: "Yes", onClick: () => __awaiter(
|
|
154
|
+
}, children: _jsxs("div", { className: "container-fluid", children: [_jsx(NSModal, { title: `Are you sure you want to delete ${name}?`, description: "", show: state.showDeleteModal, onClose: hideDeleteModal, children: _jsx(NSButtonRed, { title: "Yes", onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
148
155
|
try {
|
|
149
156
|
if (props.pages)
|
|
150
157
|
if (getIDs) {
|
|
@@ -163,5 +170,5 @@ export function NSALayout(props) {
|
|
|
163
170
|
props.notifier.onError(error);
|
|
164
171
|
}
|
|
165
172
|
}) }) }), content] }) })));
|
|
166
|
-
}
|
|
173
|
+
});
|
|
167
174
|
//# sourceMappingURL=NSALayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSALayout.js","sourceRoot":"","sources":["../../src/layouts/NSALayout.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAA4G,WAAW,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACvK,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"NSALayout.js","sourceRoot":"","sources":["../../src/layouts/NSALayout.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAA4G,WAAW,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACvK,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,cAAc,EAA0C,OAAO,IAAI,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC7H,OAAO,EAAE,cAAc,EAA0C,MAAM,kBAAkB,CAAC;AAE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AyC,CAAC,CAAC;qCAC5D;6BACF;4BAAC,OAAO,KAAU,EACnB;gCACC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;6BAC9B;wBACF,CAAC,CAAA,GAAI,GAAI,EACT,OAAO,IACH,IACI,CACX,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { IBaseComponentProps } from "namirasoft-site-react";
|
|
2
3
|
import { INSARouterProps } from "../INSARouterProps";
|
|
3
|
-
import { ReactNode } from "react";
|
|
4
4
|
import { IEntityInfo } from "../IEntityInfo";
|
|
5
|
+
import { NSASectionTabsRef } from "./NSASectionTabs";
|
|
5
6
|
export interface NSASectionEditProps<EntityType extends {
|
|
6
7
|
id: string;
|
|
7
8
|
}, EntityTypeInput = EntityType> extends IBaseComponentProps, INSARouterProps {
|
|
@@ -17,12 +18,11 @@ export interface NSASectionEditProps<EntityType extends {
|
|
|
17
18
|
tabs?: boolean;
|
|
18
19
|
};
|
|
19
20
|
}
|
|
21
|
+
export interface NSASectionEditRef {
|
|
22
|
+
NSASectionTabs: NSASectionTabsRef | null;
|
|
23
|
+
onApply: () => void;
|
|
24
|
+
}
|
|
20
25
|
export declare function onApply<EntityType extends {
|
|
21
26
|
id: string;
|
|
22
27
|
}, EntityTypeInput = EntityType>(props: NSASectionEditProps<EntityType, EntityTypeInput>, entity: IEntityInfo<EntityType, EntityTypeInput>, id: string | undefined): void;
|
|
23
|
-
export declare
|
|
24
|
-
id: string;
|
|
25
|
-
}, EntityTypeInput = EntityType>(props: NSASectionEditProps<EntityType, EntityTypeInput> & {
|
|
26
|
-
entity: IEntityInfo<EntityType, EntityTypeInput>;
|
|
27
|
-
children: ReactNode;
|
|
28
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare const NSASectionEdit: import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { NSSection, NSPanel, NSButtonBlue, NSLine, NSSpace, NSSpaceSizeType } from 'namirasoft-site-react';
|
|
3
|
-
import { useEffect } from "react";
|
|
3
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
|
|
4
4
|
import { useParams } from "react-router-dom";
|
|
5
5
|
import { NamingConvention } from "namirasoft-core";
|
|
6
6
|
import { NSASectionTabs } from "./NSASectionTabs";
|
|
@@ -51,15 +51,22 @@ export function onApply(props, entity, id) {
|
|
|
51
51
|
props.notifier.onError(error);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
export
|
|
54
|
+
export const NSASectionEdit = forwardRef((props, ref) => {
|
|
55
55
|
var _a, _b;
|
|
56
56
|
let { id } = useParams();
|
|
57
|
+
let NSASectionTabs_Ref = useRef(null);
|
|
57
58
|
useEffect(() => {
|
|
58
59
|
if (id)
|
|
59
60
|
props.entity.server.get(id).then((entity) => {
|
|
60
61
|
props.ui.setEntity(entity);
|
|
61
62
|
}).catch(() => { });
|
|
62
63
|
}, [id]);
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
useImperativeHandle(ref, () => ({
|
|
65
|
+
NSASectionTabs: NSASectionTabs_Ref.current,
|
|
66
|
+
onApply: () => {
|
|
67
|
+
onApply(props, props.entity, id);
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
return (_jsxs(NSSection, { id: props.id, classList: [`${(_a = props.classList) === null || _a === void 0 ? void 0 : _a.join(" ")}`], center_items: true, children: [_jsx(NSPanel, { grid: false, children: props.children }), _jsx(NSSpace, { size: NSSpaceSizeType.NORMAL }), _jsx(NSButtonBlue, { title: "Apply", onClick: () => { onApply(props, props.entity, id); } }), _jsx(NSSpace, { size: NSSpaceSizeType.NORMAL }), props.isEdit && _jsx(NSLine, {}), props.isEdit && _jsx(NSSpace, { size: NSSpaceSizeType.NORMAL }), props.isEdit && ((_b = props.ui.tabs) !== null && _b !== void 0 ? _b : true) && _jsx(NSASectionTabs, { ref: NSASectionTabs_Ref, entity: props.entity, id: id !== null && id !== void 0 ? id : "" })] }));
|
|
71
|
+
});
|
|
65
72
|
//# sourceMappingURL=NSASectionEdit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSASectionEdit.js","sourceRoot":"","sources":["../../src/layouts/NSASectionEdit.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE3G,OAAO,EAAa,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NSASectionEdit.js","sourceRoot":"","sources":["../../src/layouts/NSASectionEdit.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE3G,OAAO,EAAE,UAAU,EAAa,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAqB,MAAM,kBAAkB,CAAC;AAuBrE,MAAM,UAAU,OAAO,CAAkE,KAAuD,EAAE,MAAgD,EAAE,EAAsB;IAEzN,IACA;QACC,IAAI,SAAS,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;QAEhH,IAAI,SAAS,GAAG,CAAC,UAAsB,EAAE,OAAe,EAAE,EAAE;YAE3D,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CA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";
|
|
3
4
|
import { INSARouterProps } from "../INSARouterProps";
|
|
@@ -20,8 +21,8 @@ export declare class NSASectionList<EntityType extends {
|
|
|
20
21
|
}, EntityTypeInput = EntityType> extends Component<NSASectionListProps<EntityType> & INSARouterProps & {
|
|
21
22
|
entity: IEntityInfo<EntityType, EntityTypeInput>;
|
|
22
23
|
}, NSASectionListState> {
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
NSFilterBox_Top: import("react").RefObject<NSFilterBox>;
|
|
25
|
+
NSTable_Main: import("react").RefObject<NSTable<EntityType>>;
|
|
25
26
|
constructor(props: NSASectionListProps<EntityType> & INSARouterProps & {
|
|
26
27
|
entity: IEntityInfo<EntityType, EntityTypeInput>;
|
|
27
28
|
children: ReactNode;
|
|
@@ -16,17 +16,17 @@ import { FilterItem, FilterItemColumnType, FilterItemOperator, ObjectService } f
|
|
|
16
16
|
export class NSASectionList extends Component {
|
|
17
17
|
constructor(props) {
|
|
18
18
|
super(props);
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
19
|
+
this.NSFilterBox_Top = createRef();
|
|
20
|
+
this.NSTable_Main = createRef();
|
|
21
21
|
this.state = { totalItems: 0 };
|
|
22
22
|
}
|
|
23
23
|
getSelectedIDs() {
|
|
24
24
|
var _a, _b;
|
|
25
|
-
return (_b = (_a = this.
|
|
25
|
+
return (_b = (_a = this.NSTable_Main.current) === null || _a === void 0 ? void 0 : _a.getSelectedIDs()) !== null && _b !== void 0 ? _b : [];
|
|
26
26
|
}
|
|
27
27
|
componentDidMount() {
|
|
28
28
|
var _a;
|
|
29
|
-
(_a = this.
|
|
29
|
+
(_a = this.NSTable_Main.current) === null || _a === void 0 ? void 0 : _a.reload(null, null);
|
|
30
30
|
}
|
|
31
31
|
render() {
|
|
32
32
|
var _a;
|
|
@@ -48,7 +48,7 @@ export class NSASectionList extends Component {
|
|
|
48
48
|
let id = "";
|
|
49
49
|
if (ids.length === 1)
|
|
50
50
|
id = ids[0];
|
|
51
|
-
return (_jsxs(NSSection, { center_items: false, children: [_jsx(NSFilterBox, { ref: this.
|
|
51
|
+
return (_jsxs(NSSection, { center_items: false, children: [_jsx(NSFilterBox, { ref: this.NSFilterBox_Top, getTables: () => {
|
|
52
52
|
return this.props.entity.tables.map(table => {
|
|
53
53
|
let columns = table.table.getColumns().map(c => { return Object.assign(Object.assign({}, c), { type: new ObjectService(c.type).getEnum(FilterItemColumnType, FilterItemColumnType.Any) }); });
|
|
54
54
|
return { table: { name: table.table.name, text: table.table.text, columns }, required: table.required };
|
|
@@ -94,13 +94,13 @@ export class NSASectionList extends Component {
|
|
|
94
94
|
return yield this.props.entity.server.value_list(table.name, column.name);
|
|
95
95
|
}), onChanged: () => {
|
|
96
96
|
var _a, _b;
|
|
97
|
-
(_a = this.
|
|
98
|
-
(_b = this.
|
|
99
|
-
} }), _jsx(NSTable, { ref: this.
|
|
97
|
+
(_a = this.NSTable_Main.current) === null || _a === void 0 ? void 0 : _a.setSelectedIDs([]);
|
|
98
|
+
(_b = this.NSTable_Main.current) === null || _b === void 0 ? void 0 : _b.reload(null, null);
|
|
99
|
+
} }), _jsx(NSTable, { ref: this.NSTable_Main, columns: getColumns(), getRowKey: getRowKey, getColumnAttributes: getColumnAttributes, getCell: getCell, totalItems: this.state.totalItems, getRows: () => __awaiter(this, void 0, void 0, function* () {
|
|
100
100
|
var _b, _c;
|
|
101
|
-
if (this.
|
|
102
|
-
let items = (_c = (_b = this.
|
|
103
|
-
let NSPagination = this.
|
|
101
|
+
if (this.NSTable_Main.current) {
|
|
102
|
+
let items = (_c = (_b = this.NSFilterBox_Top.current) === null || _b === void 0 ? void 0 : _b.getFilterItems()) !== null && _c !== void 0 ? _c : [];
|
|
103
|
+
let NSPagination = this.NSTable_Main.current.NSPagination.current;
|
|
104
104
|
if (NSPagination) {
|
|
105
105
|
let res = yield this.props.entity.server.list(items, NSPagination.getCurrentPage(), NSPagination.getPageSize());
|
|
106
106
|
return res.rows;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSASectionList.js","sourceRoot":"","sources":["../../src/layouts/NSASectionList.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,EAAqD,MAAM,uBAAuB,CAAC;AAC7J,OAAO,EAAE,SAAS,EAAa,SAAS,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAiBtG,MAAM,OAAO,cAAgF,SAAQ,SAAwI;IAI5O,YAAY,KAAoI;QAE/I,KAAK,CAAC,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"NSASectionList.js","sourceRoot":"","sources":["../../src/layouts/NSASectionList.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,EAAqD,MAAM,uBAAuB,CAAC;AAC7J,OAAO,EAAE,SAAS,EAAa,SAAS,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAiBtG,MAAM,OAAO,cAAgF,SAAQ,SAAwI;IAI5O,YAAY,KAAoI;QAE/I,KAAK,CAAC,KAAK,CAAC,CAAC;QAJP,oBAAe,GAAG,SAAS,EAAe,CAAC;QAC3C,iBAAY,GAAG,SAAS,EAAuB,CAAC;QAItD,I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 -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NSTabPage } from "namirasoft-site-react";
|
|
2
3
|
export interface NSASectionTabsProps {
|
|
3
4
|
id: string;
|
|
4
5
|
}
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export interface NSASectionTabsRef {
|
|
7
|
+
NSTabPage: NSTabPage | null;
|
|
8
|
+
}
|
|
9
|
+
export declare const NSASectionTabs: import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { NSTabPage } from "namirasoft-site-react";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { forwardRef, useImperativeHandle, useRef } from "react";
|
|
4
|
+
export const NSASectionTabs = forwardRef((props, ref) => {
|
|
5
|
+
const NSTabPage_Ref = useRef(null);
|
|
5
6
|
let todo = () => _jsx("p", { children: "This is not impolemented yet." });
|
|
6
7
|
const tabs = [];
|
|
7
8
|
if (props.id) {
|
|
@@ -20,6 +21,9 @@ export function NSASectionTabs(props) {
|
|
|
20
21
|
tabs.push({ title: 'Tag', getContent: todo });
|
|
21
22
|
tabs.push({ title: 'Category', getContent: todo });
|
|
22
23
|
tabs.push({ title: 'Field', getContent: todo });
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
useImperativeHandle(ref, () => ({
|
|
25
|
+
NSTabPage: NSTabPage_Ref.current
|
|
26
|
+
}));
|
|
27
|
+
return (_jsx(NSTabPage, { ref: NSTabPage_Ref, tabs: tabs }));
|
|
28
|
+
});
|
|
25
29
|
//# sourceMappingURL=NSASectionTabs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSASectionTabs.js","sourceRoot":"","sources":["../../src/layouts/NSASectionTabs.tsx"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Ac,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IACnD,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAEhD,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC/B,SAAS,EAAE,aAAa,CAAC,OAAO;KAChC,CAAC,CAAC,CAAC;IAEJ,OAAO,CACN,KAAC,SAAS,IAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,GAAI,CAC7C,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NSASectionTabsRef } from "./NSASectionTabs";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
export interface NSASectionViewProps<EntityType> {
|
|
4
4
|
getChildren?: (id: string, entity: EntityType) => ReactNode;
|
|
5
5
|
}
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export interface NSASectionViewRef {
|
|
7
|
+
NSASectionTabs: NSASectionTabsRef | null;
|
|
8
|
+
}
|
|
9
|
+
export declare const NSASectionView: import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { NSASectionTabs } from "./NSASectionTabs";
|
|
3
3
|
import { useParams } from "react-router-dom";
|
|
4
|
-
import { useEffect, useState } from "react";
|
|
4
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
5
5
|
import { NSLoading } from "namirasoft-site-react";
|
|
6
|
-
export
|
|
6
|
+
export const NSASectionView = forwardRef((props, ref) => {
|
|
7
|
+
let NSASectionTabs_Ref = useRef(null);
|
|
7
8
|
let { id } = useParams();
|
|
8
9
|
let [state, setState] = useState({ entity: null });
|
|
9
10
|
useEffect(() => {
|
|
@@ -12,8 +13,11 @@ export function NSASectionView(props) {
|
|
|
12
13
|
setState({ entity });
|
|
13
14
|
}).catch(() => { });
|
|
14
15
|
}, [id]);
|
|
16
|
+
useImperativeHandle(ref, () => ({
|
|
17
|
+
NSASectionTabs: NSASectionTabs_Ref.current
|
|
18
|
+
}));
|
|
15
19
|
if (id && state.entity != null)
|
|
16
|
-
return (_jsxs(_Fragment, { children: [_jsx(NSASectionTabs, {
|
|
20
|
+
return (_jsxs(_Fragment, { children: [_jsx(NSASectionTabs, { ref: NSASectionTabs_Ref, id: id !== null && id !== void 0 ? id : "", entity: props.entity }), props.getChildren && props.getChildren(id, state.entity)] }));
|
|
17
21
|
return _jsx(NSLoading, {});
|
|
18
|
-
}
|
|
22
|
+
});
|
|
19
23
|
//# sourceMappingURL=NSASectionView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSASectionView.js","sourceRoot":"","sources":["../../src/layouts/NSASectionView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"NSASectionView.js","sourceRoot":"","sources":["../../src/layouts/NSASectionView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAqB,MAAM,kB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,WAAW,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,IACvD,CACH,CAAC;IAEH,OAAO,KAAC,SAAS,KAAa,CAAC;AAChC,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"framework": "npm",
|
|
9
9
|
"application": "package",
|
|
10
10
|
"private": false,
|
|
11
|
-
"version": "1.3.
|
|
11
|
+
"version": "1.3.199",
|
|
12
12
|
"author": "Amir Abolhasani, Sepideh Mazloumi, Hooman Shashaeh",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"main": "./dist/main.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"namirasoft-core": "^1.3.69",
|
|
32
32
|
"namirasoft-field": "^1.3.9",
|
|
33
33
|
"namirasoft-message": "^1.3.17",
|
|
34
|
-
"namirasoft-site-react": "^1.3.
|
|
34
|
+
"namirasoft-site-react": "^1.3.338",
|
|
35
35
|
"os-browserify": "^0.3.0",
|
|
36
36
|
"path-browserify": "^1.0.1",
|
|
37
37
|
"process": "^0.11.10",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { IBaseComponentProps, INSBarActionProps, INSBarHeroBannerProps, INSBarNotificationProps, INSBarTitleProps, NSButtonRed, NSModal } from 'namirasoft-site-react';
|
|
2
2
|
import { NSLayout } from 'namirasoft-site-react';
|
|
3
3
|
import { NSASectionList, NSASectionListProps } from './NSASectionList';
|
|
4
|
-
import { NSASectionEdit, NSASectionEditProps, onApply as NSASectionEdit_onApply } from './NSASectionEdit';
|
|
5
|
-
import { NSASectionView, NSASectionViewProps } from './NSASectionView';
|
|
4
|
+
import { NSASectionEdit, NSASectionEditProps, NSASectionEditRef, onApply as NSASectionEdit_onApply } from './NSASectionEdit';
|
|
5
|
+
import { NSASectionView, NSASectionViewProps, NSASectionViewRef } from './NSASectionView';
|
|
6
6
|
import { IHeaderProps } from 'namirasoft-site-react';
|
|
7
|
-
import { ReactNode, useRef, useState } from 'react';
|
|
7
|
+
import { forwardRef, ReactNode, useImperativeHandle, useRef, useState } from 'react';
|
|
8
8
|
import { Actions } from './Actions';
|
|
9
9
|
import { INSARouterProps } from '../INSARouterProps';
|
|
10
10
|
import { useParams } from 'react-router-dom';
|
|
@@ -46,7 +46,7 @@ export interface NSALayoutProps<EntityType extends { id: string }, EntityTypeInp
|
|
|
46
46
|
children: ReactNode;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
interface NSALayoutState
|
|
50
50
|
{
|
|
51
51
|
showDeleteModal: boolean;
|
|
52
52
|
showMessageModal: boolean;
|
|
@@ -54,9 +54,21 @@ export interface NSALayoutState
|
|
|
54
54
|
showProductModal: boolean;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
export
|
|
57
|
+
export interface NSALayoutRef<EntityType extends { id: string }, EntityTypeInput = EntityType>
|
|
58
58
|
{
|
|
59
|
-
|
|
59
|
+
list: NSASectionList<EntityType, EntityTypeInput> | null
|
|
60
|
+
edit: NSASectionEditRef | null
|
|
61
|
+
view: NSASectionViewRef | null
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const NSALayout = forwardRef(<EntityType extends { id: string }, EntityTypeInput = EntityType>(
|
|
65
|
+
props: NSALayoutProps<EntityType, EntityTypeInput>,
|
|
66
|
+
ref: React.Ref<NSALayoutRef<EntityType, EntityTypeInput>>
|
|
67
|
+
) =>
|
|
68
|
+
{
|
|
69
|
+
const NSASectionList_Ref = useRef<NSASectionList<EntityType, EntityTypeInput>>(null);
|
|
70
|
+
const NSASectionEdit_Ref = useRef<NSASectionEditRef>(null);
|
|
71
|
+
const NSASectionView_Ref = useRef<NSASectionViewRef>(null);
|
|
60
72
|
|
|
61
73
|
const [state, setState] = useState<NSALayoutState>({ showDeleteModal: false, showMessageModal: false, showAccessModal: false, showProductModal: false });
|
|
62
74
|
|
|
@@ -128,7 +140,7 @@ export function NSALayout<EntityType extends { id: string }, EntityTypeInput = E
|
|
|
128
140
|
|
|
129
141
|
let getIDs: (() => string[]) | null = null;
|
|
130
142
|
if (props.pages?.list)
|
|
131
|
-
getIDs = () => { return
|
|
143
|
+
getIDs = () => { return NSASectionList_Ref.current?.getSelectedIDs() ?? []; };
|
|
132
144
|
if (props.pages?.edit)
|
|
133
145
|
getIDs = () => [id].filter(id => id) as string[];
|
|
134
146
|
if (props.pages?.view)
|
|
@@ -192,7 +204,7 @@ export function NSALayout<EntityType extends { id: string }, EntityTypeInput = E
|
|
|
192
204
|
if (props.pages?.list)
|
|
193
205
|
{
|
|
194
206
|
action_name = "List";
|
|
195
|
-
content = <NSASectionList<EntityType, EntityTypeInput> ref={
|
|
207
|
+
content = <NSASectionList<EntityType, EntityTypeInput> ref={NSASectionList_Ref} {...props} {...props.pages.list} entity={props.pages.entity} />
|
|
196
208
|
}
|
|
197
209
|
else if (props.pages?.edit)
|
|
198
210
|
{
|
|
@@ -200,12 +212,12 @@ export function NSALayout<EntityType extends { id: string }, EntityTypeInput = E
|
|
|
200
212
|
action_name = "Edit";
|
|
201
213
|
else
|
|
202
214
|
action_name = "New";
|
|
203
|
-
content = <NSASectionEdit
|
|
215
|
+
content = <NSASectionEdit ref={NSASectionEdit_Ref} {...props.pages.edit} entity={props.pages.entity}>{props.children}</NSASectionEdit>;
|
|
204
216
|
}
|
|
205
217
|
else if (props.pages?.view)
|
|
206
218
|
{
|
|
207
219
|
action_name = "View";
|
|
208
|
-
content = <NSASectionView
|
|
220
|
+
content = <NSASectionView ref={NSASectionView_Ref}
|
|
209
221
|
{...props.pages.view}
|
|
210
222
|
entity={props.pages.entity}
|
|
211
223
|
/>;
|
|
@@ -217,6 +229,12 @@ export function NSALayout<EntityType extends { id: string }, EntityTypeInput = E
|
|
|
217
229
|
if (props.pages?.entity.name)
|
|
218
230
|
fullname = action_name + " " + props.pages.entity.name;
|
|
219
231
|
|
|
232
|
+
useImperativeHandle(ref, () => ({
|
|
233
|
+
list: NSASectionList_Ref.current,
|
|
234
|
+
edit: NSASectionEdit_Ref.current,
|
|
235
|
+
view: NSASectionView_Ref.current,
|
|
236
|
+
}));
|
|
237
|
+
|
|
220
238
|
return (
|
|
221
239
|
<NSLayout
|
|
222
240
|
{...props}
|
|
@@ -251,7 +269,6 @@ export function NSALayout<EntityType extends { id: string }, EntityTypeInput = E
|
|
|
251
269
|
// todo support multiple ids deletion
|
|
252
270
|
throw new Error("Multiple deletion is not supported yet.");
|
|
253
271
|
}
|
|
254
|
-
|
|
255
272
|
} catch (error: any)
|
|
256
273
|
{
|
|
257
274
|
props.notifier.onError(error);
|
|
@@ -259,7 +276,6 @@ export function NSALayout<EntityType extends { id: string }, EntityTypeInput = E
|
|
|
259
276
|
}} />} />
|
|
260
277
|
{content}
|
|
261
278
|
</div>
|
|
262
|
-
|
|
263
279
|
</NSLayout>
|
|
264
280
|
);
|
|
265
|
-
}
|
|
281
|
+
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { IBaseComponentProps } from "namirasoft-site-react";
|
|
2
2
|
import { NSSection, NSPanel, NSButtonBlue, NSLine, NSSpace, NSSpaceSizeType } from 'namirasoft-site-react';
|
|
3
3
|
import { INSARouterProps } from "../INSARouterProps";
|
|
4
|
-
import { ReactNode, useEffect } from "react";
|
|
4
|
+
import { forwardRef, ReactNode, useEffect, useImperativeHandle, useRef } from "react";
|
|
5
5
|
import { useParams } from "react-router-dom";
|
|
6
6
|
import { IEntityInfo } from "../IEntityInfo";
|
|
7
7
|
import { NamingConvention } from "namirasoft-core";
|
|
8
|
-
import { NSASectionTabs } from "./NSASectionTabs";
|
|
8
|
+
import { NSASectionTabs, NSASectionTabsRef } from "./NSASectionTabs";
|
|
9
9
|
|
|
10
10
|
export interface NSASectionEditProps<EntityType extends { id: string }, EntityTypeInput = EntityType> extends IBaseComponentProps, INSARouterProps
|
|
11
11
|
{
|
|
@@ -22,6 +22,12 @@ export interface NSASectionEditProps<EntityType extends { id: string }, EntityTy
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
export interface NSASectionEditRef
|
|
26
|
+
{
|
|
27
|
+
NSASectionTabs: NSASectionTabsRef | null;
|
|
28
|
+
onApply: () => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
25
31
|
export function onApply<EntityType extends { id: string }, EntityTypeInput = EntityType>(props: NSASectionEditProps<EntityType, EntityTypeInput>, entity: IEntityInfo<EntityType, EntityTypeInput>, id: string | undefined): void
|
|
26
32
|
{
|
|
27
33
|
try
|
|
@@ -82,9 +88,12 @@ export function onApply<EntityType extends { id: string }, EntityTypeInput = Ent
|
|
|
82
88
|
}
|
|
83
89
|
}
|
|
84
90
|
|
|
85
|
-
export
|
|
91
|
+
export const NSASectionEdit = forwardRef<any, any>(<EntityType extends { id: string }, EntityTypeInput = EntityType>(props: NSASectionEditProps<EntityType, EntityTypeInput> & { entity: IEntityInfo<EntityType, EntityTypeInput>, children: ReactNode; },
|
|
92
|
+
ref: React.Ref<NSASectionEditRef>
|
|
93
|
+
) =>
|
|
86
94
|
{
|
|
87
95
|
let { id } = useParams();
|
|
96
|
+
let NSASectionTabs_Ref = useRef<NSASectionTabsRef>(null);
|
|
88
97
|
|
|
89
98
|
useEffect(() =>
|
|
90
99
|
{
|
|
@@ -95,6 +104,14 @@ export function NSASectionEdit<EntityType extends { id: string }, EntityTypeInpu
|
|
|
95
104
|
}).catch(() => { });
|
|
96
105
|
}, [id]);
|
|
97
106
|
|
|
107
|
+
useImperativeHandle(ref, () => ({
|
|
108
|
+
NSASectionTabs: NSASectionTabs_Ref.current,
|
|
109
|
+
onApply: () =>
|
|
110
|
+
{
|
|
111
|
+
onApply(props, props.entity, id);
|
|
112
|
+
}
|
|
113
|
+
}));
|
|
114
|
+
|
|
98
115
|
return (
|
|
99
116
|
<NSSection
|
|
100
117
|
id={props.id}
|
|
@@ -109,7 +126,7 @@ export function NSASectionEdit<EntityType extends { id: string }, EntityTypeInpu
|
|
|
109
126
|
<NSSpace size={NSSpaceSizeType.NORMAL}></NSSpace>
|
|
110
127
|
{props.isEdit && <NSLine />}
|
|
111
128
|
{props.isEdit && <NSSpace size={NSSpaceSizeType.NORMAL}></NSSpace>}
|
|
112
|
-
{props.isEdit && (props.ui.tabs ?? true) && <NSASectionTabs entity={props.entity} id={id ?? ""} />}
|
|
129
|
+
{props.isEdit && (props.ui.tabs ?? true) && <NSASectionTabs ref={NSASectionTabs_Ref} entity={props.entity} id={id ?? ""} />}
|
|
113
130
|
</NSSection>
|
|
114
131
|
);
|
|
115
|
-
}
|
|
132
|
+
});
|
|
@@ -22,8 +22,8 @@ export interface NSASectionListState
|
|
|
22
22
|
|
|
23
23
|
export class NSASectionList<EntityType extends { id: string }, EntityTypeInput = EntityType> extends Component<NSASectionListProps<EntityType> & INSARouterProps & { entity: IEntityInfo<EntityType, EntityTypeInput> }, NSASectionListState>
|
|
24
24
|
{
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
public NSFilterBox_Top = createRef<NSFilterBox>();
|
|
26
|
+
public NSTable_Main = createRef<NSTable<EntityType>>();
|
|
27
27
|
constructor(props: NSASectionListProps<EntityType> & INSARouterProps & { entity: IEntityInfo<EntityType, EntityTypeInput>, children: ReactNode })
|
|
28
28
|
{
|
|
29
29
|
super(props);
|
|
@@ -31,11 +31,11 @@ export class NSASectionList<EntityType extends { id: string }, EntityTypeInput =
|
|
|
31
31
|
}
|
|
32
32
|
getSelectedIDs(): string[]
|
|
33
33
|
{
|
|
34
|
-
return this.
|
|
34
|
+
return this.NSTable_Main.current?.getSelectedIDs() ?? [];
|
|
35
35
|
}
|
|
36
36
|
override componentDidMount()
|
|
37
37
|
{
|
|
38
|
-
this.
|
|
38
|
+
this.NSTable_Main.current?.reload(null, null);
|
|
39
39
|
}
|
|
40
40
|
override render()
|
|
41
41
|
{
|
|
@@ -66,7 +66,7 @@ export class NSASectionList<EntityType extends { id: string }, EntityTypeInput =
|
|
|
66
66
|
|
|
67
67
|
return (
|
|
68
68
|
<NSSection center_items={false}>
|
|
69
|
-
<NSFilterBox ref={this.
|
|
69
|
+
<NSFilterBox ref={this.NSFilterBox_Top}
|
|
70
70
|
getTables={() =>
|
|
71
71
|
{
|
|
72
72
|
return this.props.entity.tables.map(table =>
|
|
@@ -124,11 +124,11 @@ export class NSASectionList<EntityType extends { id: string }, EntityTypeInput =
|
|
|
124
124
|
}}
|
|
125
125
|
onChanged={() =>
|
|
126
126
|
{
|
|
127
|
-
this.
|
|
128
|
-
this.
|
|
127
|
+
this.NSTable_Main.current?.setSelectedIDs([]);
|
|
128
|
+
this.NSTable_Main.current?.reload(null, null);
|
|
129
129
|
}} />
|
|
130
130
|
<NSTable<EntityType>
|
|
131
|
-
ref={this.
|
|
131
|
+
ref={this.NSTable_Main}
|
|
132
132
|
columns={getColumns()}
|
|
133
133
|
getRowKey={getRowKey}
|
|
134
134
|
getColumnAttributes={getColumnAttributes}
|
|
@@ -136,10 +136,10 @@ export class NSASectionList<EntityType extends { id: string }, EntityTypeInput =
|
|
|
136
136
|
totalItems={this.state.totalItems}
|
|
137
137
|
getRows={async () =>
|
|
138
138
|
{
|
|
139
|
-
if (this.
|
|
139
|
+
if (this.NSTable_Main.current)
|
|
140
140
|
{
|
|
141
|
-
let items = this.
|
|
142
|
-
let NSPagination = this.
|
|
141
|
+
let items = this.NSFilterBox_Top.current?.getFilterItems() ?? [];
|
|
142
|
+
let NSPagination = this.NSTable_Main.current.NSPagination.current;
|
|
143
143
|
if (NSPagination)
|
|
144
144
|
{
|
|
145
145
|
let res = await this.props.entity.server.list(items, NSPagination.getCurrentPage(), NSPagination.getPageSize());
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import { NSTabPage } from "namirasoft-site-react";
|
|
2
2
|
import { IEntityInfo } from "../IEntityInfo";
|
|
3
|
+
import { forwardRef, useImperativeHandle, useRef } from "react";
|
|
3
4
|
|
|
4
5
|
export interface NSASectionTabsProps
|
|
5
6
|
{
|
|
6
7
|
id: string;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
export
|
|
10
|
+
export interface NSASectionTabsRef
|
|
10
11
|
{
|
|
11
|
-
|
|
12
|
+
NSTabPage: NSTabPage | null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const NSASectionTabs = forwardRef<any, any>(<EntityType extends { id: string }, EntityTypeInput = EntityType>(
|
|
16
|
+
props: NSASectionTabsProps & { entity: IEntityInfo<EntityType, EntityTypeInput>; },
|
|
17
|
+
ref: React.Ref<NSASectionTabsRef>
|
|
18
|
+
) =>
|
|
19
|
+
{
|
|
20
|
+
const NSTabPage_Ref = useRef<NSTabPage>(null);
|
|
12
21
|
|
|
13
22
|
// tabs
|
|
14
23
|
let todo = () => <p>This is not impolemented yet.</p>;
|
|
@@ -31,7 +40,12 @@ export function NSASectionTabs<EntityType extends { id: string }, EntityTypeInpu
|
|
|
31
40
|
tabs.push({ title: 'Tag', getContent: todo });
|
|
32
41
|
tabs.push({ title: 'Category', getContent: todo });
|
|
33
42
|
tabs.push({ title: 'Field', getContent: todo });
|
|
43
|
+
|
|
44
|
+
useImperativeHandle(ref, () => ({
|
|
45
|
+
NSTabPage: NSTabPage_Ref.current
|
|
46
|
+
}));
|
|
47
|
+
|
|
34
48
|
return (
|
|
35
|
-
<NSTabPage tabs={tabs} />
|
|
49
|
+
<NSTabPage ref={NSTabPage_Ref} tabs={tabs} />
|
|
36
50
|
);
|
|
37
|
-
}
|
|
51
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { NSASectionTabs } from "./NSASectionTabs";
|
|
1
|
+
import { NSASectionTabs, NSASectionTabsRef } from "./NSASectionTabs";
|
|
2
2
|
import { IEntityInfo } from "../IEntityInfo";
|
|
3
3
|
import { useParams } from "react-router-dom";
|
|
4
|
-
import { ReactNode, useEffect, useState } from "react";
|
|
4
|
+
import { forwardRef, ReactNode, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
5
5
|
import { NSLoading } from "namirasoft-site-react";
|
|
6
6
|
|
|
7
7
|
export interface NSASectionViewProps<EntityType>
|
|
@@ -14,8 +14,18 @@ interface NSASectionViewState<EntityType>
|
|
|
14
14
|
entity: EntityType | null;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export
|
|
17
|
+
export interface NSASectionViewRef
|
|
18
18
|
{
|
|
19
|
+
NSASectionTabs: NSASectionTabsRef | null
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const NSASectionView = forwardRef<any, any>(<EntityType extends { id: string }, EntityTypeInput = EntityType>(
|
|
23
|
+
props: NSASectionViewProps<EntityType> & { entity: IEntityInfo<EntityType, EntityTypeInput>; },
|
|
24
|
+
ref: React.Ref<NSASectionViewRef>
|
|
25
|
+
) =>
|
|
26
|
+
{
|
|
27
|
+
let NSASectionTabs_Ref = useRef<NSASectionTabsRef>(null);
|
|
28
|
+
|
|
19
29
|
let { id } = useParams();
|
|
20
30
|
|
|
21
31
|
let [state, setState] = useState<NSASectionViewState<EntityType>>({ entity: null });
|
|
@@ -29,12 +39,21 @@ export function NSASectionView<EntityType extends { id: string }, EntityTypeInpu
|
|
|
29
39
|
}).catch(() => { });
|
|
30
40
|
}, [id]);
|
|
31
41
|
|
|
42
|
+
useImperativeHandle(ref, () => ({
|
|
43
|
+
NSASectionTabs: NSASectionTabs_Ref.current
|
|
44
|
+
}));
|
|
45
|
+
|
|
32
46
|
if (id && state.entity != null)
|
|
33
47
|
return (
|
|
34
48
|
<>
|
|
35
|
-
<NSASectionTabs
|
|
49
|
+
<NSASectionTabs
|
|
50
|
+
ref={NSASectionTabs_Ref}
|
|
51
|
+
id={id ?? ""}
|
|
52
|
+
entity={props.entity}
|
|
53
|
+
/>
|
|
36
54
|
{props.getChildren && props.getChildren(id, state.entity)}
|
|
37
55
|
</>
|
|
38
56
|
);
|
|
57
|
+
|
|
39
58
|
return <NSLoading></NSLoading>;
|
|
40
|
-
}
|
|
59
|
+
});
|