@rchemist/listgrid 0.2.13 → 0.2.14

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.
@@ -9,6 +9,13 @@ import { RenderType } from '../../config/Config';
9
9
  interface InlineMapFieldProps extends FormFieldProps {
10
10
  config?: InlineMapConfig | undefined;
11
11
  }
12
+ /**
13
+ * InlineMap 의 pendingRef.value 가 비어있는지 판정.
14
+ * - undefined / null → blank
15
+ * - Map / 객체 → entries 가 0개면 blank
16
+ * - 배열 (KeyValue[]) → 길이 0 이면 blank
17
+ */
18
+ export declare function isInlineMapValueBlank(value: unknown): boolean;
12
19
  export declare class InlineMapField extends FormField<InlineMapField> {
13
20
  config?: InlineMapConfig | undefined;
14
21
  pendingRef: {
@@ -17,6 +24,14 @@ export declare class InlineMapField extends FormField<InlineMapField> {
17
24
  constructor(name: string, order: number, config?: InlineMapConfig);
18
25
  isDirty(): boolean;
19
26
  getSaveValue(entityForm: EntityForm, renderType?: RenderType): Promise<any>;
27
+ /**
28
+ * 사용자가 InlineMap UI 에서 입력한 값은 `pendingRef.current.value` 에 누적되며,
29
+ * `getSaveValue`/`isDirty` 시점에서야 form value 로 반영됩니다.
30
+ * 따라서 검증 단계의 `isBlank` 도 pendingRef 가 modified 된 경우에는
31
+ * pendingRef 값을 우선해서 봐야 합니다. 그렇지 않으면 사용자가 값을 입력했음에도
32
+ * "필수 값입니다" 검증에 막혀 저장이 차단됩니다.
33
+ */
34
+ isBlank(renderType?: RenderType): Promise<boolean>;
20
35
  /**
21
36
  * InlineMapField 핵심 렌더링 로직
22
37
  */
@@ -2,6 +2,27 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { FormField } from './abstract';
3
3
  import { InlineMap } from '../../ui';
4
4
  import { getInputRendererParameters } from '../helper/FieldRendererHelper';
5
+ /**
6
+ * InlineMap 의 pendingRef.value 가 비어있는지 판정.
7
+ * - undefined / null → blank
8
+ * - Map / 객체 → entries 가 0개면 blank
9
+ * - 배열 (KeyValue[]) → 길이 0 이면 blank
10
+ */
11
+ export function isInlineMapValueBlank(value) {
12
+ if (value === undefined || value === null) {
13
+ return true;
14
+ }
15
+ if (Array.isArray(value)) {
16
+ return value.length === 0;
17
+ }
18
+ if (value instanceof Map) {
19
+ return value.size === 0;
20
+ }
21
+ if (typeof value === 'object') {
22
+ return Object.keys(value).length === 0;
23
+ }
24
+ return false;
25
+ }
5
26
  export class InlineMapField extends FormField {
6
27
  constructor(name, order, config) {
7
28
  super(name, order, 'inlineMap');
@@ -20,6 +41,20 @@ export class InlineMapField extends FormField {
20
41
  }
21
42
  return super.getSaveValue(entityForm, renderType);
22
43
  }
44
+ /**
45
+ * 사용자가 InlineMap UI 에서 입력한 값은 `pendingRef.current.value` 에 누적되며,
46
+ * `getSaveValue`/`isDirty` 시점에서야 form value 로 반영됩니다.
47
+ * 따라서 검증 단계의 `isBlank` 도 pendingRef 가 modified 된 경우에는
48
+ * pendingRef 값을 우선해서 봐야 합니다. 그렇지 않으면 사용자가 값을 입력했음에도
49
+ * "필수 값입니다" 검증에 막혀 저장이 차단됩니다.
50
+ */
51
+ async isBlank(renderType = 'create') {
52
+ if (this.pendingRef.current.modified) {
53
+ const pendingValue = this.pendingRef.current.value;
54
+ return isInlineMapValueBlank(pendingValue);
55
+ }
56
+ return super.isBlank(renderType);
57
+ }
23
58
  /**
24
59
  * InlineMapField 핵심 렌더링 로직
25
60
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rchemist/listgrid",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
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": [