@xleddyl/443-components-vue 0.10.0 → 0.10.2

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/README.md CHANGED
@@ -697,7 +697,7 @@ Accessibility related props and defaults:
697
697
  - Paste: Cmd/Ctrl+V reads TSV from Excel, Google Sheets or text (quoted multi line cells, CRLF, trailing newline) and starts at the top left cell of the range. One value fills the whole range; a smaller block that divides the range evenly is tiled; otherwise the block keeps its size and the pasted area becomes the range. Read only cells (`editable` false or a function that returns false) are skipped. Text goes through the column `valueParser` (also the one of `cellDataType`) and then `valueSetter` or `field`; `gridOptions.processCellFromClipboard` replaces the parser. A non empty text that parses to `null`, `undefined`, `NaN` or an invalid date, or a value missing from `cellEditorParams.values` of a select editor, is not written: it is listed in `cellsInvalid` and counted in the toast.
698
698
  - Fill: Cmd/Ctrl+D copies the first row of the range down, Cmd/Ctrl+R the first column to the right (a one row or one column range copies from the row above or the column on the left). Drag the small square on the range corner down to repeat the range rows below it. Delete or Backspace clears the editable cells (`null`, or what the column `valueParser` returns for an empty string).
699
699
  - Changes: every edit, paste, fill, clear, bulk set, undo and redo is one batch, emitted as `cellsChange` with `{ changes: GridCellChange[], source }` (`GridCellChange` is `{ rowId, colId, field, oldValue, newValue }`, `source` is `'edit' | 'paste' | 'fill' | 'clear' | 'bulk' | 'undo' | 'redo'`). Cmd/Ctrl+Z undoes a batch, Shift+Cmd/Ctrl+Z and Ctrl+Y redo it (100 batches; AG Grid `undoRedoCellEditing` is turned off). The grid writes into the row objects like AG Grid editing does; persist the batch yourself.
700
- - Dirty cells: a changed cell gets a tint and a corner marker until you clear it; a cell edited back to its first value is clean again. `dirtyChange(count)` fires when the count changes; `getDirtyCells()` returns `{ rowId, colId, field, originalValue }[]` and `clearDirty(rowIds?)` clears all of them or the given rows (after a save).
700
+ - Dirty cells: a changed cell gets a tint and a corner marker until you clear it; a cell edited back to its first value is clean again. `dirtyChange(count)` fires when the count changes; `getDirtyCells()` returns `{ rowId, colId, field, originalValue, value }[]` (`value` is the current value, ready to save) and `clearDirty(rowIds?)` clears all of them or the given rows (after a save).
701
701
  - Events: `cellsChange`, `cellsInvalid` (`{ cells: { rowId, colId, field, text }[], source }`), `dirtyChange`, `rangeChange` (`GridCellRange | null`, `{ startRowIndex, endRowIndex, columns, active: { rowIndex, colId } }`), and `copy(text)` for a copied range.
702
702
  - Methods (template ref, typed as `GridSpreadsheetMethods<T>`): `getRange()`, `getSelectedCells()` (`{ rowId, rowIndex, colId, field, value, data, editable }[]`), `selectRange({ startRowIndex, endRowIndex?, startColumn, endColumn? })`, `selectAll()`, `clearRange()`, `setRangeValue(value, { parse? })` (writes the value in every editable cell of the range; `parse: true` runs a string through the paste pipeline), `copyRange()`, `paste(text)`, `fillDown()`, `fillRight()`, `clearCells()`, `undo()`, `redo()`, `clearHistory()`, `getDirtyCells()`, `clearDirty(rowIds?)`. Write methods return the number of changed cells.
703
703
  - The `actions` slot also gets every method plus `range`, `selectedCellCount`, `dirtyCount`, `canUndo` and `canRedo` (`GridSpreadsheetSlotProps<T>`), for a "set this value on the selected cells" action:
@@ -626,9 +626,19 @@ export function createGridSpreadsheet(options) {
626
626
  }
627
627
  function getDirtyCells() {
628
628
  const cells = [];
629
- for (const [rowId, row] of dirty)
630
- for (const [colId, entry] of row)
631
- cells.push({ rowId, colId, field: entry.field, originalValue: entry.original });
629
+ for (const [rowId, row] of dirty) {
630
+ const node = api?.getRowNode(rowId);
631
+ for (const [colId, entry] of row) {
632
+ const column = api?.getColumn(colId);
633
+ cells.push({
634
+ rowId,
635
+ colId,
636
+ field: entry.field,
637
+ originalValue: entry.original,
638
+ value: node && column ? readValue(node, column) : void 0
639
+ });
640
+ }
641
+ }
632
642
  return cells;
633
643
  }
634
644
  function clearDirty(rowIds) {
@@ -92,6 +92,7 @@ export interface GridDirtyCell {
92
92
  colId: string;
93
93
  field: string;
94
94
  originalValue: unknown;
95
+ value: unknown;
95
96
  }
96
97
  export interface GridCellPosition {
97
98
  rowIndex: number;
@@ -228,6 +228,7 @@ export default defineNuxtModule({
228
228
  if (options.css && options.cssLayers) {
229
229
  const layers = addTemplate({
230
230
  filename: "k-layers.css",
231
+ write: true,
231
232
  getContents: () => `@layer ${options.cssLayers};
232
233
  `
233
234
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xleddyl/443-components-vue",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "description": "Compact, scoped dashboard components for Vue and Nuxt",
5
5
  "license": "MIT",
6
6
  "author": "Edoardo Alberti (https://github.com/xleddyl)",