namirasoft-account-react 1.4.392 → 1.4.394
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.
|
@@ -17,6 +17,7 @@ export interface NSASectionEditCustomProps<RowType extends {
|
|
|
17
17
|
};
|
|
18
18
|
tab_page_view?: NSASectionViewTabPageUIProps<RowType>;
|
|
19
19
|
};
|
|
20
|
+
onLoaded?: () => void;
|
|
20
21
|
onRowLoaded?: (item: RowType) => void;
|
|
21
22
|
children?: React.ReactNode;
|
|
22
23
|
}
|
|
@@ -38,7 +39,7 @@ export interface NSASectionEditProps<RowType extends {
|
|
|
38
39
|
}
|
|
39
40
|
interface NSASectionEditState<RowType> {
|
|
40
41
|
row: RowType | null;
|
|
41
|
-
|
|
42
|
+
loading: boolean;
|
|
42
43
|
}
|
|
43
44
|
export declare class NSASectionEdit<RowType extends {
|
|
44
45
|
id: string;
|
|
@@ -21,7 +21,7 @@ export class NSASectionEdit extends Component {
|
|
|
21
21
|
this.NSASectionEditTabPage_Ref = createRef();
|
|
22
22
|
this.state = {
|
|
23
23
|
row: this.props.model.row,
|
|
24
|
-
|
|
24
|
+
loading: !this.props.model.row,
|
|
25
25
|
};
|
|
26
26
|
this.reload = this.reload.bind(this);
|
|
27
27
|
this.getRow = this.getRow.bind(this);
|
|
@@ -29,10 +29,14 @@ export class NSASectionEdit extends Component {
|
|
|
29
29
|
}
|
|
30
30
|
reload() {
|
|
31
31
|
var _a, _b;
|
|
32
|
-
this.setState(() => ({ row: null,
|
|
32
|
+
this.setState(() => ({ row: null, loading: true }));
|
|
33
33
|
if (this.props.model.id)
|
|
34
34
|
(_b = (_a = this.props.entity.server).get) === null || _b === void 0 ? void 0 : _b.call(_a, this.props.model.id).then(row => {
|
|
35
|
-
this.setState(() => ({ row,
|
|
35
|
+
this.setState(() => ({ row, loading: false }), () => {
|
|
36
|
+
var _a, _b, _c, _d;
|
|
37
|
+
(_b = (_a = this.props).onLoaded) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
38
|
+
(_d = (_c = this.props).onRowLoaded) === null || _d === void 0 ? void 0 : _d.call(_c, row);
|
|
39
|
+
});
|
|
36
40
|
}).catch(() => { });
|
|
37
41
|
}
|
|
38
42
|
getRow() {
|
|
@@ -114,13 +118,15 @@ export class NSASectionEdit extends Component {
|
|
|
114
118
|
});
|
|
115
119
|
}
|
|
116
120
|
componentDidMount() {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
let { id, row } = this.props.model;
|
|
122
|
+
if ((id && !row) || (id && id !== (row === null || row === void 0 ? void 0 : row.id)))
|
|
123
|
+
this.reload();
|
|
124
|
+
else
|
|
125
|
+
this.setState(() => ({ loading: false }), () => { var _a, _b; return (_b = (_a = this.props).onLoaded) === null || _b === void 0 ? void 0 : _b.call(_a); });
|
|
120
126
|
}
|
|
121
127
|
render() {
|
|
122
128
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
123
|
-
return (_jsxs(_Fragment, { children: [_jsxs(NSSection, { id: this.props.id, classList: [`${(_b = (_a = this.props.classList) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : ""}`], style: Object.assign({}, this.props.style), children: [this.state.
|
|
129
|
+
return (_jsxs(_Fragment, { children: [_jsxs(NSSection, { id: this.props.id, classList: [`${(_b = (_a = this.props.classList) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : ""}`], style: Object.assign({}, this.props.style), children: [!this.state.loading
|
|
124
130
|
?
|
|
125
131
|
_jsx(NSPanel, { id: (_c = this.props.ui.panel) === null || _c === void 0 ? void 0 : _c.id, classList: [`${(_f = (_e = (_d = this.props.ui.panel) === null || _d === void 0 ? void 0 : _d.classList) === null || _e === void 0 ? void 0 : _e.join(" ")) !== null && _f !== void 0 ? _f : ""}`], style: Object.assign({}, (_g = this.props.ui.panel) === null || _g === void 0 ? void 0 : _g.style), children: _jsx(NSASectionEditTabPage, Object.assign({ ref: this.NSASectionEditTabPage_Ref }, this.props, { model: {
|
|
126
132
|
id: this.props.model.id,
|
|
@@ -131,7 +137,7 @@ export class NSASectionEdit extends Component {
|
|
|
131
137
|
action: (onFinished) => {
|
|
132
138
|
this.onApply(onFinished);
|
|
133
139
|
}
|
|
134
|
-
} })] }), this.props.isEdit && ((_j = (_h = this.props.ui.tab_page_view) === null || _h === void 0 ? void 0 : _h.enabled) !== null && _j !== void 0 ? _j : true) && this.state.
|
|
140
|
+
} })] }), this.props.isEdit && ((_j = (_h = this.props.ui.tab_page_view) === null || _h === void 0 ? void 0 : _h.enabled) !== null && _j !== void 0 ? _j : true) && !this.state.loading &&
|
|
135
141
|
_jsxs(_Fragment, { children: [_jsx(NSSpace, { size: NSSpaceSizeType.SMALL }), _jsx(NSLine, {}), _jsx(NSSpace, { size: NSSpaceSizeType.SMALL }), _jsx(NSASectionViewTabPage, Object.assign({ ref: this.NSASectionViewTabPage_Ref }, this.props, { model: {
|
|
136
142
|
id: this.props.model.id,
|
|
137
143
|
row: this.state.row
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSASectionEdit.js","sourceRoot":"","sources":["../../src/layouts/NSASectionEdit.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAuB,IAAI,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE3G,OAAO,EAAE,SAAS,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAgC,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAkE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"NSASectionEdit.js","sourceRoot":"","sources":["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AAA,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,aAAa,0CAAE,OAAO,mCAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO;oBAC1F,8BACI,KAAC,OAAO,IAAC,IAAI,EAAE,eAAe,CAAC,KAAK,GAAI,EACxC,KAAC,MAAM,KAAG,EACV,KAAC,OAAO,IAAC,IAAI,EAAE,eAAe,CAAC,KAAK,GAAI,EACxC,KAAC,qBAAqB,kBAClB,GAAG,EAAE,IAAI,CAAC,yBAAyB,IAC/B,IAAI,CAAC,KAAK,IACd,KAAK,EAAE;oCACH,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;oCACvB,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG;iCACtB,EACD,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,aAAa,IACjC,IACH,IAER,CACN,CAAC;IACN,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"framework": "npm",
|
|
9
9
|
"application": "package",
|
|
10
10
|
"private": false,
|
|
11
|
-
"version": "1.4.
|
|
11
|
+
"version": "1.4.394",
|
|
12
12
|
"author": "Amir Abolhasani",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"main": "./dist/main.js",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"namirasoft-message": "^1.4.22",
|
|
37
37
|
"namirasoft-payment": "^1.4.133",
|
|
38
38
|
"namirasoft-schema": "^1.4.26",
|
|
39
|
-
"namirasoft-secret": "^1.4.
|
|
39
|
+
"namirasoft-secret": "^1.4.43",
|
|
40
40
|
"namirasoft-site": "^1.4.44",
|
|
41
|
-
"namirasoft-site-map": "^1.4.
|
|
41
|
+
"namirasoft-site-map": "^1.4.41",
|
|
42
42
|
"namirasoft-site-react": "^1.4.504",
|
|
43
43
|
"namirasoft-workspace": "^1.4.25",
|
|
44
44
|
"os-browserify": "^0.3.0",
|
|
@@ -19,6 +19,7 @@ export interface NSASectionEditCustomProps<RowType extends { id: string }, RowTy
|
|
|
19
19
|
};
|
|
20
20
|
tab_page_view?: NSASectionViewTabPageUIProps<RowType>;
|
|
21
21
|
}
|
|
22
|
+
onLoaded?: () => void;
|
|
22
23
|
onRowLoaded?: (item: RowType) => void;
|
|
23
24
|
children?: React.ReactNode;
|
|
24
25
|
}
|
|
@@ -42,7 +43,7 @@ export interface NSASectionEditProps<RowType extends { id: string }, RowTypeInpu
|
|
|
42
43
|
interface NSASectionEditState<RowType>
|
|
43
44
|
{
|
|
44
45
|
row: RowType | null;
|
|
45
|
-
|
|
46
|
+
loading: boolean;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
export class NSASectionEdit<RowType extends { id: string }, RowTypeInput = RowType> extends Component<NSASectionEditProps<RowType, RowTypeInput>, NSASectionEditState<RowType>>
|
|
@@ -56,7 +57,7 @@ export class NSASectionEdit<RowType extends { id: string }, RowTypeInput = RowTy
|
|
|
56
57
|
|
|
57
58
|
this.state = {
|
|
58
59
|
row: this.props.model.row,
|
|
59
|
-
|
|
60
|
+
loading: !this.props.model.row,
|
|
60
61
|
};
|
|
61
62
|
|
|
62
63
|
this.reload = this.reload.bind(this);
|
|
@@ -65,13 +66,17 @@ export class NSASectionEdit<RowType extends { id: string }, RowTypeInput = RowTy
|
|
|
65
66
|
}
|
|
66
67
|
reload()
|
|
67
68
|
{
|
|
68
|
-
this.setState(() => ({ row: null,
|
|
69
|
+
this.setState(() => ({ row: null, loading: true }));
|
|
69
70
|
if (this.props.model.id)
|
|
70
71
|
this.props.entity.server.get?.(this.props.model.id).then(row =>
|
|
71
72
|
{
|
|
72
73
|
this.setState(
|
|
73
|
-
() => ({ row,
|
|
74
|
-
() =>
|
|
74
|
+
() => ({ row, loading: false }),
|
|
75
|
+
() =>
|
|
76
|
+
{
|
|
77
|
+
this.props.onLoaded?.();
|
|
78
|
+
this.props.onRowLoaded?.(row);
|
|
79
|
+
}
|
|
75
80
|
);
|
|
76
81
|
}).catch(() => { });
|
|
77
82
|
}
|
|
@@ -169,9 +174,15 @@ export class NSASectionEdit<RowType extends { id: string }, RowTypeInput = RowTy
|
|
|
169
174
|
}
|
|
170
175
|
override componentDidMount()
|
|
171
176
|
{
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
177
|
+
let { id, row } = this.props.model;
|
|
178
|
+
|
|
179
|
+
if ((id && !row) || (id && id !== row?.id))
|
|
180
|
+
this.reload();
|
|
181
|
+
else
|
|
182
|
+
this.setState(
|
|
183
|
+
() => ({ loading: false }),
|
|
184
|
+
() => this.props.onLoaded?.()
|
|
185
|
+
);
|
|
175
186
|
}
|
|
176
187
|
override render()
|
|
177
188
|
{
|
|
@@ -183,7 +194,7 @@ export class NSASectionEdit<RowType extends { id: string }, RowTypeInput = RowTy
|
|
|
183
194
|
style={{ ...this.props.style }}
|
|
184
195
|
>
|
|
185
196
|
{
|
|
186
|
-
this.state.
|
|
197
|
+
!this.state.loading
|
|
187
198
|
?
|
|
188
199
|
<NSPanel
|
|
189
200
|
id={this.props.ui.panel?.id}
|
|
@@ -218,7 +229,7 @@ export class NSASectionEdit<RowType extends { id: string }, RowTypeInput = RowTy
|
|
|
218
229
|
/>
|
|
219
230
|
</NSSection>
|
|
220
231
|
{
|
|
221
|
-
this.props.isEdit && (this.props.ui.tab_page_view?.enabled ?? true) && this.state.
|
|
232
|
+
this.props.isEdit && (this.props.ui.tab_page_view?.enabled ?? true) && !this.state.loading &&
|
|
222
233
|
<>
|
|
223
234
|
<NSSpace size={NSSpaceSizeType.SMALL} />
|
|
224
235
|
<NSLine />
|