@nubitio/crud 0.5.24 → 0.5.27
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/index.cjs +925 -230
- package/dist/index.d.cts +27 -1
- package/dist/index.d.mts +27 -1
- package/dist/index.mjs +866 -174
- package/dist/style.css +258 -2
- package/package.json +17 -3
package/dist/index.d.cts
CHANGED
|
@@ -23,6 +23,8 @@ interface GridHandle {
|
|
|
23
23
|
getSelectedRows: () => DataRecord$1[];
|
|
24
24
|
getFilter: () => unknown[];
|
|
25
25
|
filter: (filterRule: FilterRule | null) => void;
|
|
26
|
+
hasEditData: () => boolean;
|
|
27
|
+
saveChanges: () => Promise<boolean>;
|
|
26
28
|
}
|
|
27
29
|
//#endregion
|
|
28
30
|
//#region packages/crud/field/FieldType.d.ts
|
|
@@ -974,6 +976,13 @@ interface ResourceConfig<T extends DataRecord$1 = DataRecord$1> {
|
|
|
974
976
|
* - `'row'` | `'cell'` | `'batch'` enable inline editing when supported.
|
|
975
977
|
*/
|
|
976
978
|
editMode?: 'popup' | 'row' | 'cell' | 'batch';
|
|
979
|
+
/** Toolbar save/revert for inline edit. `false` hides them (use GridHandle instead). */
|
|
980
|
+
inlineEditToolbar?: boolean | {
|
|
981
|
+
save?: boolean;
|
|
982
|
+
revert?: boolean;
|
|
983
|
+
};
|
|
984
|
+
/** Per-row save/cancel in the actions column. Defaults by edit mode. */
|
|
985
|
+
inlineRowActions?: boolean;
|
|
977
986
|
/** Optional layout descriptor for the dialog form: tabs or collapsible sections. */
|
|
978
987
|
formLayout?: FormLayout;
|
|
979
988
|
/** Named column visibility presets. When defined, a preset selector is shown in the toolbar. */
|
|
@@ -1543,6 +1552,8 @@ interface DataGridViewOptions {
|
|
|
1543
1552
|
id: string;
|
|
1544
1553
|
title: string;
|
|
1545
1554
|
url: string;
|
|
1555
|
+
/** Controlled rows. When provided, the grid renders this data instead of loading from url. */
|
|
1556
|
+
data?: DataRecord$1[];
|
|
1546
1557
|
detailUrl?: string;
|
|
1547
1558
|
fields: Field[];
|
|
1548
1559
|
detailFields?: Field[] | ((parentRow: DataRecord$1) => Field[]);
|
|
@@ -1581,7 +1592,20 @@ interface DataGridViewOptions {
|
|
|
1581
1592
|
stateStoringEnabled?: boolean;
|
|
1582
1593
|
toolbarVisible?: boolean;
|
|
1583
1594
|
selectionMode?: 'single' | 'multiple';
|
|
1584
|
-
|
|
1595
|
+
/**
|
|
1596
|
+
* Save / revert buttons shown in the toolbar when inline edits are pending.
|
|
1597
|
+
* Set to `false` to hide and handle persistence via `GridHandle.saveChanges()`.
|
|
1598
|
+
* Defaults to `true` for `cell` and `batch` edit modes.
|
|
1599
|
+
*/
|
|
1600
|
+
inlineEditToolbar?: boolean | {
|
|
1601
|
+
save?: boolean;
|
|
1602
|
+
revert?: boolean;
|
|
1603
|
+
};
|
|
1604
|
+
/**
|
|
1605
|
+
* Per-row save / cancel icons in the actions column while a row is being edited.
|
|
1606
|
+
* Defaults to `true` for `row` mode and `false` for `cell` / `batch`.
|
|
1607
|
+
*/
|
|
1608
|
+
inlineRowActions?: boolean;
|
|
1585
1609
|
onBack?: () => void;
|
|
1586
1610
|
onAdd?: () => void;
|
|
1587
1611
|
onEdit?: (row: DataRecord$1) => void;
|
|
@@ -1591,6 +1615,8 @@ interface DataGridViewOptions {
|
|
|
1591
1615
|
onRowPrepared?: (event: unknown) => void;
|
|
1592
1616
|
onContentReady?: () => void;
|
|
1593
1617
|
onFilterChange?: (filters: Record<string, string>) => void;
|
|
1618
|
+
/** Custom batch persistence. Defaults to PATCHing each row to url/id when omitted. */
|
|
1619
|
+
onBatchSave?: (rows: DataRecord$1[]) => void | Promise<void>;
|
|
1594
1620
|
filterRow?: boolean;
|
|
1595
1621
|
headerFilter?: boolean;
|
|
1596
1622
|
manualLoad?: boolean;
|
package/dist/index.d.mts
CHANGED
|
@@ -23,6 +23,8 @@ interface GridHandle {
|
|
|
23
23
|
getSelectedRows: () => DataRecord$1[];
|
|
24
24
|
getFilter: () => unknown[];
|
|
25
25
|
filter: (filterRule: FilterRule | null) => void;
|
|
26
|
+
hasEditData: () => boolean;
|
|
27
|
+
saveChanges: () => Promise<boolean>;
|
|
26
28
|
}
|
|
27
29
|
//#endregion
|
|
28
30
|
//#region packages/crud/field/FieldType.d.ts
|
|
@@ -974,6 +976,13 @@ interface ResourceConfig<T extends DataRecord$1 = DataRecord$1> {
|
|
|
974
976
|
* - `'row'` | `'cell'` | `'batch'` enable inline editing when supported.
|
|
975
977
|
*/
|
|
976
978
|
editMode?: 'popup' | 'row' | 'cell' | 'batch';
|
|
979
|
+
/** Toolbar save/revert for inline edit. `false` hides them (use GridHandle instead). */
|
|
980
|
+
inlineEditToolbar?: boolean | {
|
|
981
|
+
save?: boolean;
|
|
982
|
+
revert?: boolean;
|
|
983
|
+
};
|
|
984
|
+
/** Per-row save/cancel in the actions column. Defaults by edit mode. */
|
|
985
|
+
inlineRowActions?: boolean;
|
|
977
986
|
/** Optional layout descriptor for the dialog form: tabs or collapsible sections. */
|
|
978
987
|
formLayout?: FormLayout;
|
|
979
988
|
/** Named column visibility presets. When defined, a preset selector is shown in the toolbar. */
|
|
@@ -1543,6 +1552,8 @@ interface DataGridViewOptions {
|
|
|
1543
1552
|
id: string;
|
|
1544
1553
|
title: string;
|
|
1545
1554
|
url: string;
|
|
1555
|
+
/** Controlled rows. When provided, the grid renders this data instead of loading from url. */
|
|
1556
|
+
data?: DataRecord$1[];
|
|
1546
1557
|
detailUrl?: string;
|
|
1547
1558
|
fields: Field[];
|
|
1548
1559
|
detailFields?: Field[] | ((parentRow: DataRecord$1) => Field[]);
|
|
@@ -1581,7 +1592,20 @@ interface DataGridViewOptions {
|
|
|
1581
1592
|
stateStoringEnabled?: boolean;
|
|
1582
1593
|
toolbarVisible?: boolean;
|
|
1583
1594
|
selectionMode?: 'single' | 'multiple';
|
|
1584
|
-
|
|
1595
|
+
/**
|
|
1596
|
+
* Save / revert buttons shown in the toolbar when inline edits are pending.
|
|
1597
|
+
* Set to `false` to hide and handle persistence via `GridHandle.saveChanges()`.
|
|
1598
|
+
* Defaults to `true` for `cell` and `batch` edit modes.
|
|
1599
|
+
*/
|
|
1600
|
+
inlineEditToolbar?: boolean | {
|
|
1601
|
+
save?: boolean;
|
|
1602
|
+
revert?: boolean;
|
|
1603
|
+
};
|
|
1604
|
+
/**
|
|
1605
|
+
* Per-row save / cancel icons in the actions column while a row is being edited.
|
|
1606
|
+
* Defaults to `true` for `row` mode and `false` for `cell` / `batch`.
|
|
1607
|
+
*/
|
|
1608
|
+
inlineRowActions?: boolean;
|
|
1585
1609
|
onBack?: () => void;
|
|
1586
1610
|
onAdd?: () => void;
|
|
1587
1611
|
onEdit?: (row: DataRecord$1) => void;
|
|
@@ -1591,6 +1615,8 @@ interface DataGridViewOptions {
|
|
|
1591
1615
|
onRowPrepared?: (event: unknown) => void;
|
|
1592
1616
|
onContentReady?: () => void;
|
|
1593
1617
|
onFilterChange?: (filters: Record<string, string>) => void;
|
|
1618
|
+
/** Custom batch persistence. Defaults to PATCHing each row to url/id when omitted. */
|
|
1619
|
+
onBatchSave?: (rows: DataRecord$1[]) => void | Promise<void>;
|
|
1594
1620
|
filterRow?: boolean;
|
|
1595
1621
|
headerFilter?: boolean;
|
|
1596
1622
|
manualLoad?: boolean;
|