@rchemist/listgrid 0.2.16 → 0.3.2
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.
|
@@ -368,10 +368,17 @@ export class EntityForm extends EntityFormExtensions {
|
|
|
368
368
|
result.errors = ['삭제할 대상이 없습니다.'];
|
|
369
369
|
return result;
|
|
370
370
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
371
|
+
// v0.3.0+ — rcm-framework 0.1.0 endpoint 표준 (Decision #31).
|
|
372
|
+
// bulk delete = DELETE {url} + RequestBody BulkDeleteRequest{ids,revisionEntityName?}.
|
|
373
|
+
// RFC 9110 *서버 명시 지원* 영역. 0.1.0 baseline (axios 최신) 자연 지원.
|
|
374
|
+
const url = this.getUrl();
|
|
375
|
+
const formData = {
|
|
376
|
+
ids: idList,
|
|
377
|
+
};
|
|
378
|
+
const revisionEntityName = this.getRevisionEntityName();
|
|
379
|
+
if (revisionEntityName) {
|
|
380
|
+
formData['revisionEntityName'] = revisionEntityName;
|
|
381
|
+
}
|
|
375
382
|
const response = await getExternalApiDataWithError({
|
|
376
383
|
url: url,
|
|
377
384
|
method: 'DELETE',
|
|
@@ -525,7 +532,10 @@ export class EntityForm extends EntityFormExtensions {
|
|
|
525
532
|
return { actionType: renderType, entityForm: form.withErrors(submitFormData.errors), errors };
|
|
526
533
|
}
|
|
527
534
|
else {
|
|
528
|
-
|
|
535
|
+
// v0.3.0+ — rcm-framework 0.1.0 endpoint 표준 (Decision #31).
|
|
536
|
+
// create = POST {url} (was POST {url}/add in 0.0.5 line)
|
|
537
|
+
// update = PUT {url}/{id} (unchanged)
|
|
538
|
+
const targetUrl = renderType === 'create' ? this.getUrl() : `${this.getUrl()}/${this.id}`;
|
|
529
539
|
const method = renderType === 'create' ? 'POST' : 'PUT';
|
|
530
540
|
// 서버 extension 처리를 위한 헤더 추가
|
|
531
541
|
const extensionPoint = renderType === 'create' ? ExtensionPoint.PRE_CREATE : ExtensionPoint.PRE_UPDATE;
|
|
@@ -30,8 +30,10 @@ export class PageResult {
|
|
|
30
30
|
/**
|
|
31
31
|
* 만약 serverSide가 true 라면 넘어 온 url 을 파라미터로 포함해 내부 프록시 api 를 호출하고 그 결과를 response 로 받는다.
|
|
32
32
|
*/
|
|
33
|
+
// v0.3.0+ — rcm-framework 0.1.0 endpoint 표준 (Decision #31).
|
|
34
|
+
// 검색은 POST {url}/search (RequestBody SearchRequest). underscore prefix 거부.
|
|
33
35
|
const response = await callExternalHttpRequest({
|
|
34
|
-
url: url
|
|
36
|
+
url: `${url}/search`,
|
|
35
37
|
method: 'POST',
|
|
36
38
|
formData: searchForm,
|
|
37
39
|
...(extensionOptions?.entityFormName !== undefined
|
|
@@ -61,7 +63,12 @@ export class PageResult {
|
|
|
61
63
|
}
|
|
62
64
|
return PageResult.createEmptyResult(searchForm).withErrors(response.error ?? '데이터 로딩 중 오류가 발생했습니다.');
|
|
63
65
|
}
|
|
64
|
-
|
|
66
|
+
// v0.3.0+ — server echo 호환:
|
|
67
|
+
// 0.0.5 line: response.data.searchForm (deserialize)
|
|
68
|
+
// 0.1.0 line (Decision #31 SearchResponse): response.data.searchRequest (echo only)
|
|
69
|
+
// 둘 다 없으면 client 가 보낸 원본 searchForm 보존 (page/pageSize/sorts/filters 유지).
|
|
70
|
+
const echoForm = response.data.searchForm ?? response.data.searchRequest;
|
|
71
|
+
const newSearchForm = echoForm ? SearchForm.deserialize(echoForm) : searchForm;
|
|
65
72
|
if (searchForm.hasPreservedFilters()) {
|
|
66
73
|
searchForm.getPreservedFilters().forEach((filter) => {
|
|
67
74
|
if (isTrue(filter.remove)) {
|
|
@@ -75,16 +82,19 @@ export class PageResult {
|
|
|
75
82
|
}
|
|
76
83
|
});
|
|
77
84
|
}
|
|
78
|
-
// list 또는 content
|
|
85
|
+
// list (0.0.5) 또는 content (Spring Data Page<T> / SearchResponse 0.1.0) 흡수.
|
|
79
86
|
const listData = response.data.list || response.data.content || [];
|
|
80
87
|
const responseList = listData.map((item) => ({
|
|
81
88
|
...item,
|
|
82
89
|
id: String(item.id), // id를 문자열로 강제 변환
|
|
83
90
|
}));
|
|
91
|
+
// pagination 메타: totalCount/totalPage (0.0.5) 또는 totalElements/totalPages (0.1.0).
|
|
92
|
+
const totalCount = response.data.totalCount ?? response.data.totalElements ?? 0;
|
|
93
|
+
const totalPage = response.data.totalPage ?? response.data.totalPages ?? 0;
|
|
84
94
|
return new PageResult({
|
|
85
95
|
list: responseList,
|
|
86
|
-
totalCount
|
|
87
|
-
totalPage
|
|
96
|
+
totalCount,
|
|
97
|
+
totalPage,
|
|
88
98
|
searchForm: newSearchForm,
|
|
89
99
|
});
|
|
90
100
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rchemist/listgrid",
|
|
3
|
-
"version": "0.2
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Framework-free React CRUD UI engine — primitive-based design system, data-attr theming, and a full list/form renderer for RCM-framework-style entity backends.",
|
|
6
6
|
"keywords": [
|