@starasia/admin 14.10.0 → 14.11.0
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.
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TextFilterField } from '../../types';
|
|
3
|
+
|
|
4
|
+
interface TextPillProps {
|
|
5
|
+
field: TextFilterField;
|
|
6
|
+
value: string;
|
|
7
|
+
/** Tulis nilai baru (string kosong = hapus nilai). */
|
|
8
|
+
onChange: (v: string) => void;
|
|
9
|
+
/** Kosongkan nilai tanpa menghapus pill. */
|
|
10
|
+
onClear: () => void;
|
|
11
|
+
/** Hapus pill sepenuhnya. Kosong untuk field `locked`. */
|
|
12
|
+
onRemove?: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Text pill — filter teks bebas ("contains"). Debounced (default 300ms) supaya
|
|
16
|
+
* tak refetch tiap ketikan; nilai kosong menghapus filter.
|
|
17
|
+
*/
|
|
18
|
+
export declare const TextPill: React.FC<TextPillProps>;
|
|
19
|
+
export {};
|
|
@@ -8,7 +8,7 @@ import { Pagination } from '../TableSection/types';
|
|
|
8
8
|
* (`handleChangeFilter`, `getValuesFilter`, …) so the JSON-blob URL encoding
|
|
9
9
|
* (`?filter={...}`) is reused as-is. `key` is the param name inside that blob.
|
|
10
10
|
*/
|
|
11
|
-
export type FilterFieldType = 'date' | 'date-compact' | 'dropdown' | 'dropdown-multiple' | 'checkbox-multiple' | 'radio';
|
|
11
|
+
export type FilterFieldType = 'date' | 'date-compact' | 'dropdown' | 'dropdown-multiple' | 'checkbox-multiple' | 'radio' | 'text';
|
|
12
12
|
interface BaseFilterField {
|
|
13
13
|
/** Stable key — used as the field name inside the `?filter` blob. */
|
|
14
14
|
key: string;
|
|
@@ -49,6 +49,18 @@ export interface CheckboxMultipleFilterField extends BaseFilterField {
|
|
|
49
49
|
value: string;
|
|
50
50
|
}[];
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Filter teks bebas ("contains") — untuk kolom high-cardinality/teks bebas
|
|
54
|
+
* (deskripsi, nama, no. seri) yang tak muat di select/date. Menghasilkan
|
|
55
|
+
* string; backend biasanya `LIKE %value%`. Nilai kosong = filter dihapus.
|
|
56
|
+
*/
|
|
57
|
+
export interface TextFilterField extends BaseFilterField {
|
|
58
|
+
type: 'text';
|
|
59
|
+
/** Placeholder input. Default "Cari…". */
|
|
60
|
+
placeholder?: string;
|
|
61
|
+
/** Debounce sebelum tulis ke URL (ms). Default 300. */
|
|
62
|
+
debounceMs?: number;
|
|
63
|
+
}
|
|
52
64
|
export interface DateFilterField extends BaseFilterField {
|
|
53
65
|
type: 'date';
|
|
54
66
|
mode?: 'days' | 'months' | 'years';
|
|
@@ -94,7 +106,7 @@ export interface DateCompactFilterField extends BaseFilterField {
|
|
|
94
106
|
*/
|
|
95
107
|
mode?: 'days' | 'months' | 'years';
|
|
96
108
|
}
|
|
97
|
-
export type FilterFieldConfig = SelectFilterField | CheckboxMultipleFilterField | DateFilterField | DateCompactFilterField;
|
|
109
|
+
export type FilterFieldConfig = SelectFilterField | CheckboxMultipleFilterField | TextFilterField | DateFilterField | DateCompactFilterField;
|
|
98
110
|
/** A single column entry fed to the Customize Column panel. */
|
|
99
111
|
export interface ColumnConfig {
|
|
100
112
|
key: string;
|