@starasia/admin 14.10.0 → 14.12.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.
- package/dist/components/FilterBar/components/pills/TextPill.d.ts +19 -0
- package/dist/components/FilterBar/types.d.ts +14 -2
- package/dist/components/Highlight/index.d.ts +24 -0
- package/dist/components/TableLayout/TableLayout.d.ts +1 -1
- package/dist/components/TableLayout/types.d.ts +9 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.cjs.js +5 -5
- package/dist/index.es.js +2731 -2595
- package/dist/index.umd.js +16 -16
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface HighlightProps {
|
|
4
|
+
/** Teks yang dirender; substring yang cocok dengan `query` di-`<mark>`. */
|
|
5
|
+
text: string;
|
|
6
|
+
/** Kata kunci — bisa multi-kata (dipisah spasi) untuk global search. Kosong → teks polos. */
|
|
7
|
+
query?: string;
|
|
8
|
+
/** Override style `<mark>` (default: bg warning-subtlest, warna teks inherit). */
|
|
9
|
+
markStyle?: React.CSSProperties;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Menyorot (highlight) substring yang cocok dengan `query` di dalam `text`.
|
|
13
|
+
* Pakai `<mark>` **inline** → aman berdampingan dengan ellipsis cell (beda dari
|
|
14
|
+
* membungkus `<Text>` yang block). Case-insensitive; mendukung beberapa kata
|
|
15
|
+
* (dipisah spasi) untuk global search.
|
|
16
|
+
*
|
|
17
|
+
* Dipakai manual di `render` kolom, atau otomatis via prop `highlight` di
|
|
18
|
+
* `<TableLayout>` (menyorot string-cell kolom yang key-nya ada di map itu).
|
|
19
|
+
*
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <Highlight text={row.description} query={filter.getRaw('description') ?? ''} />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const Highlight: ({ text, query, markStyle }: HighlightProps) => React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { TableLayoutProps } from './types';
|
|
3
3
|
|
|
4
|
-
export declare const TableLayout: <T>({ columns, data, getRowKey, rowBg, size, resizable, layout, widthStorageKey, columnState, onColumnStateChange, columnMenu, sort, defaultSort, onSortChange, height, mobileLayout, mobileBreakpoint, groupSeparator, summary, footer, stickyFooter, emptyState, loading, loadingRows, rowActions, selectable, selectedKeys, defaultSelectedKeys, onSelectionChange, isRowSelectable, }: TableLayoutProps<T>) => React.JSX.Element;
|
|
4
|
+
export declare const TableLayout: <T>({ columns, data, getRowKey, rowBg, size, resizable, layout, widthStorageKey, columnState, onColumnStateChange, columnMenu, highlight, sort, defaultSort, onSortChange, height, mobileLayout, mobileBreakpoint, groupSeparator, summary, footer, stickyFooter, emptyState, loading, loadingRows, rowActions, selectable, selectedKeys, defaultSelectedKeys, onSelectionChange, isRowSelectable, }: TableLayoutProps<T>) => React.JSX.Element;
|
|
@@ -262,6 +262,15 @@ export interface TableLayoutProps<T> {
|
|
|
262
262
|
* Muncul saat hover / saat salah satu item aktif.
|
|
263
263
|
*/
|
|
264
264
|
columnMenu?: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Sorot (highlight) hasil pencarian: map `{ [columnKey]: query }`. Untuk kolom
|
|
267
|
+
* yang key-nya ada di map & sel-nya berupa **string accessor** (bukan custom
|
|
268
|
+
* `render`), substring yang cocok dibungkus `<mark>` inline (ellipsis tetap
|
|
269
|
+
* jalan). Query kosong = tak menyorot. Isi dari filter `text` per-kolom
|
|
270
|
+
* (`controls.getRaw(key)`) dan/atau global search (`params.search`). Untuk sel
|
|
271
|
+
* `render`, sorot manual via komponen `<Highlight>`.
|
|
272
|
+
*/
|
|
273
|
+
highlight?: Record<string, string>;
|
|
265
274
|
/**
|
|
266
275
|
* Sort aktif (controlled). Kalau `onSortChange` diisi → mode server (TableLayout
|
|
267
276
|
* tidak mengurutkan data sendiri, hanya emit). Tanpa `onSortChange` → client-side.
|