@isi-ui7/bos7-shared 0.2.12 → 0.2.13
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/crud-components.d.ts +10 -2
- package/dist/crud-types.d.ts +19 -0
- package/dist/export.d.ts +22 -1
- package/dist/i18n.d.ts +1 -0
- package/dist/index-CPY3DDQN.js +28761 -0
- package/dist/{index.es-Bylk5fh-.js → index.es-Dy3lNA6h.js} +4 -7
- package/dist/index.js +72 -21147
- package/dist/{jspdf.es.min-Dzm5j8wC.js → jspdf.es.min-Ds3Fsl60.js} +1 -1
- package/package.json +46 -95
- package/src/crud-components.tsx +45 -5
- package/src/crud-types.ts +19 -0
- package/src/export.ts +144 -19
- package/src/i18n.tsx +2 -0
|
@@ -5,19 +5,27 @@ import { Ui7FormDensity } from './style-contract';
|
|
|
5
5
|
|
|
6
6
|
export { buildValueSections, buildXRulesValidator, } from './form-value-schema';
|
|
7
7
|
export type { JSONSchema, XUi, XUiRoot, XUiNumeric, XUiOption, XUiWidget, XRule, XRuleOp, ValueValidatorFn, } from './form-value-schema';
|
|
8
|
-
export declare function SharedCrudListPage({ schema, tableKey, onAdd, onPopupClick }: {
|
|
8
|
+
export declare function SharedCrudListPage({ schema, tableKey, onAdd, onPopupClick, toolbarExtra, }: {
|
|
9
9
|
schema: CrudListSchema;
|
|
10
10
|
tableKey?: number;
|
|
11
11
|
onAdd: () => void;
|
|
12
12
|
onPopupClick: (row: Record<string, unknown>, actionId: string) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Optional extra toolbar action(s) rendered to the LEFT of the built-in Add
|
|
15
|
+
* button (e.g. a secondary "Bulk Create" button). Additive + backward-compatible:
|
|
16
|
+
* omit it and the toolbar renders exactly as before.
|
|
17
|
+
*/
|
|
18
|
+
toolbarExtra?: ReactNode;
|
|
13
19
|
}): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export declare function CrudSchemaListPage<TData extends Record<string, unknown>>({ listSchema, deleteSchema, onAdd, onView, onEdit, deleteApiPath, onCustomAction, }: {
|
|
20
|
+
export declare function CrudSchemaListPage<TData extends Record<string, unknown>>({ listSchema, deleteSchema, onAdd, onView, onEdit, deleteApiPath, onCustomAction, toolbarExtra, }: {
|
|
15
21
|
listSchema: CrudListSchema;
|
|
16
22
|
deleteSchema?: CrudDeleteSchema<TData>;
|
|
17
23
|
onAdd: () => void;
|
|
18
24
|
onView?: (id: string) => void;
|
|
19
25
|
onEdit?: (id: string) => void;
|
|
20
26
|
deleteApiPath?: (id: string) => string;
|
|
27
|
+
/** Optional extra toolbar action(s) rendered beside the built-in Add button. */
|
|
28
|
+
toolbarExtra?: ReactNode;
|
|
21
29
|
/**
|
|
22
30
|
* Level 1: called for any popup action id not handled by built-in logic
|
|
23
31
|
* (view / edit / delete) and not in listSchema.customActionSchemas (Level 2).
|
package/dist/crud-types.d.ts
CHANGED
|
@@ -76,6 +76,25 @@ export type CrudListSchema = {
|
|
|
76
76
|
* Keyed by popup menu item id. Actions not listed here fall through to onCustomAction (Level 1).
|
|
77
77
|
*/
|
|
78
78
|
customActionSchemas?: Record<string, CrudCustomActionSchema>;
|
|
79
|
+
/**
|
|
80
|
+
* Show a "Show Inactive" toolbar toggle. When on, the list request carries
|
|
81
|
+
* `?<includeInactiveParam>=true` so the backend surfaces soft-deleted /
|
|
82
|
+
* deactivated rows too. Default off keeps the list active-only. Pair with
|
|
83
|
+
* `popupMenuItemsForRow` so inactive rows expose "Reactivate".
|
|
84
|
+
*/
|
|
85
|
+
showInactiveToggle?: boolean;
|
|
86
|
+
/** Query param name toggled by the Show-Inactive control. Default "include_inactive". */
|
|
87
|
+
includeInactiveParam?: string;
|
|
88
|
+
/** Label for the Show-Inactive toggle (i18n'd by the caller). Default "Tampilkan Nonaktif". */
|
|
89
|
+
showInactiveLabel?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Per-row popup items. When provided, overrides `popupMenuItems` for each row
|
|
92
|
+
* so the menu can depend on row state — e.g. active rows show "Deactivate",
|
|
93
|
+
* inactive rows show "Reactivate". Returned item ids route the same way as
|
|
94
|
+
* `popupMenuItems` (view/edit/delete built-in; others via customActionSchemas
|
|
95
|
+
* or onCustomAction).
|
|
96
|
+
*/
|
|
97
|
+
popupMenuItemsForRow?: (row: Record<string, unknown>) => CrudPopupMenuItem[];
|
|
79
98
|
};
|
|
80
99
|
export type CrudDeleteSchema<TData extends Record<string, unknown>> = {
|
|
81
100
|
/** Omit to use i18n default ("Konfirmasi Hapus"). */
|
package/dist/export.d.ts
CHANGED
|
@@ -2,6 +2,27 @@ export interface ExportColumn {
|
|
|
2
2
|
field: string;
|
|
3
3
|
title: string;
|
|
4
4
|
displayFormat?: string;
|
|
5
|
+
/** Cell alignment. Default: 'right' for displayFormat="currency", else 'left'. */
|
|
6
|
+
align?: 'left' | 'center' | 'right';
|
|
5
7
|
}
|
|
6
|
-
|
|
8
|
+
/** Header block rendered above the column headers (report title/period/applied filters). */
|
|
9
|
+
export interface ExportMeta {
|
|
10
|
+
title?: string;
|
|
11
|
+
/** e.g. "01 Jul 2026 – 24 Jul 2026" or "Per 24 Jul 2026". */
|
|
12
|
+
period?: string;
|
|
13
|
+
/** Applied filter values, e.g. [{label:"Cabang", value:"001 — Pusat"}]. Omitted/empty filters should not be passed in. */
|
|
14
|
+
filters?: Array<{
|
|
15
|
+
label: string;
|
|
16
|
+
value: string;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
19
|
+
/** Values for a highlighted total/subtotal row, keyed by column `field`. Fields absent here render blank in the total row. */
|
|
20
|
+
export type ExportTotals = Record<string, unknown>;
|
|
21
|
+
export interface ExportOptions {
|
|
22
|
+
meta?: ExportMeta;
|
|
23
|
+
totals?: ExportTotals;
|
|
24
|
+
/** Label shown in the total row's leading cell(s). Default: "Total". */
|
|
25
|
+
totalsLabel?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function exportToExcel<T extends Record<string, unknown>>(data: T[], columns: ExportColumn[], sheetName: string, options?: ExportOptions): Promise<void>;
|
|
7
28
|
export declare function exportToPDF<T extends Record<string, unknown>>(data: T[], columns: ExportColumn[], title: string): Promise<void>;
|