@affino/datagrid-vue-app 0.1.51 → 0.1.53

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
@@ -1482,11 +1482,13 @@ The object form controls placeholder text, explicit searchable columns, and matc
1482
1482
  placeholder: 'Search accounts',
1483
1483
  columns: ['service', 'owner', 'region'],
1484
1484
  mode: 'tokens',
1485
+ applyMode: 'debounce',
1486
+ debounceMs: 400,
1485
1487
  }"
1486
1488
  />
1487
1489
  ```
1488
1490
 
1489
- This prop is a shell convenience API. Typing in the input updates `filterModel.quickFilter`; clearing the input removes it from the snapshot. It does not add a separate `update:quickFilter` event or a second state channel.
1491
+ This prop is a shell convenience API. By default, typing in the input updates `filterModel.quickFilter` immediately. `applyMode: 'debounce'` commits after `debounceMs`, while `applyMode: 'manual'` keeps a local draft until Enter or the built-in Apply button. Clearing the input removes quick filter from the snapshot. It does not add a separate `update:quickFilter` event or a second state channel.
1490
1492
 
1491
1493
  Controlled consumers can still manage quick filter directly through the same `filter-model` contract:
1492
1494
 
@@ -7,6 +7,7 @@ import { type DataGridAppClientRowModelOptions, type DataGridAppColumnInput } fr
7
7
  import { type DataGridChromeProp } from "./config/dataGridChrome";
8
8
  import { type DataGridThemeProp } from "./theme/dataGridTheme";
9
9
  import { type DataGridGroupByProp, type DataGridPaginationProp } from "./config/dataGridPublicProps";
10
+ import { type DataGridStatePersistenceProp } from "./config/dataGridStatePersistence";
10
11
  import { type DataGridAdvancedFilterProp } from "./config/dataGridAdvancedFilter";
11
12
  import { type DataGridQuickFilterProp } from "./config/dataGridQuickFilter";
12
13
  import { type DataGridFindReplaceProp } from "./config/dataGridFindReplace";
@@ -59,7 +60,7 @@ export declare function defineDataGridFilterCellStyleReader<TRow = unknown>(): <
59
60
  export declare function defineDataGridCellClassResolver<TRow = unknown>(): <TResolver extends DataGridCellClassResolver<TRow>>(resolver: TResolver) => TResolver;
60
61
  export declare function defineDataGridCellStyleResolver<TRow = unknown>(): <TResolver extends DataGridCellStyleResolver<TRow>>(resolver: TResolver) => TResolver;
61
62
  export { defineDataGridStructuralRowActionHandler };
62
- export type DataGridExposedRuntime<TRow = unknown> = Pick<UseDataGridRuntimeResult<TRow>, "api" | "syncBodyRowsInRange" | "setViewportRange" | "setVirtualWindowRange" | "setRows" | "rowPartition" | "virtualWindow" | "columnSnapshot" | "getBodyRowAtIndex" | "resolveBodyRowIndexById">;
63
+ export type DataGridExposedRuntime<TRow = unknown> = Pick<UseDataGridRuntimeResult<TRow>, "api" | "syncBodyRowsInRange" | "setViewportRange" | "setVirtualWindowRange" | "setRows" | "rowPartition" | "virtualWindow" | "columnSnapshot" | "getBodyRowAtIndex" | "resolveBodyRowIndexById" | "getViewportPosition" | "setViewportPosition" | "scrollToRow" | "scrollToColumn" | "scrollToCell">;
63
64
  declare const dataGridProps: {
64
65
  readonly rows: {
65
66
  readonly type: PropType<readonly unknown[]>;
@@ -237,6 +238,10 @@ declare const dataGridProps: {
237
238
  readonly type: PropType<DataGridSetStateOptions | null | undefined>;
238
239
  readonly default: undefined;
239
240
  };
241
+ readonly statePersistence: {
242
+ readonly type: PropType<DataGridStatePersistenceProp>;
243
+ readonly default: undefined;
244
+ };
240
245
  readonly rowHeightMode: {
241
246
  readonly type: PropType<"fixed" | "auto">;
242
247
  readonly default: "fixed";
@@ -561,6 +566,10 @@ declare const DataGridRuntimeComponent: import("vue").DefineComponent<{
561
566
  readonly type: PropType<DataGridSetStateOptions | null | undefined>;
562
567
  readonly default: undefined;
563
568
  };
569
+ readonly statePersistence: {
570
+ readonly type: PropType<DataGridStatePersistenceProp>;
571
+ readonly default: undefined;
572
+ };
564
573
  readonly rowHeightMode: {
565
574
  readonly type: PropType<"fixed" | "auto">;
566
575
  readonly default: "fixed";
@@ -862,6 +871,10 @@ declare const DataGridRuntimeComponent: import("vue").DefineComponent<{
862
871
  readonly type: PropType<DataGridSetStateOptions | null | undefined>;
863
872
  readonly default: undefined;
864
873
  };
874
+ readonly statePersistence: {
875
+ readonly type: PropType<DataGridStatePersistenceProp>;
876
+ readonly default: undefined;
877
+ };
865
878
  readonly rowHeightMode: {
866
879
  readonly type: PropType<"fixed" | "auto">;
867
880
  readonly default: "fixed";
@@ -1057,6 +1070,7 @@ declare const DataGridRuntimeComponent: import("vue").DefineComponent<{
1057
1070
  readonly columnWidths: Readonly<Record<string, number | null>> | null | undefined;
1058
1071
  readonly columnPins: Readonly<Record<string, DataGridColumnPin>> | null | undefined;
1059
1072
  readonly stateOptions: DataGridSetStateOptions | null | undefined;
1073
+ readonly statePersistence: DataGridStatePersistenceProp;
1060
1074
  }, {}>;
1061
1075
  type DataGridRuntimeStatics = {
1062
1076
  [K in keyof typeof DataGridRuntimeComponent]: (typeof DataGridRuntimeComponent)[K];
@@ -3333,6 +3333,7 @@ const ci = "affino-datagrid-vue-app-styles", on = `
3333
3333
  box-shadow: 0 0 0 2px var(--datagrid-column-menu-focus-ring);
3334
3334
  }
3335
3335
 
3336
+ .datagrid-app-quick-filter__apply,
3336
3337
  .datagrid-app-quick-filter__clear {
3337
3338
  flex: 0 0 auto;
3338
3339
  height: calc(var(--datagrid-app-toolbar-button-height, 32px) - 10px);
@@ -3347,11 +3348,17 @@ const ci = "affino-datagrid-vue-app-styles", on = `
3347
3348
  cursor: pointer;
3348
3349
  }
3349
3350
 
3351
+ .datagrid-app-quick-filter__apply {
3352
+ color: var(--datagrid-text-primary);
3353
+ }
3354
+
3355
+ .datagrid-app-quick-filter__apply:hover:not(:disabled),
3350
3356
  .datagrid-app-quick-filter__clear:hover:not(:disabled) {
3351
3357
  background: color-mix(in srgb, var(--datagrid-column-menu-item-hover-bg) 72%, transparent);
3352
3358
  color: var(--datagrid-text-primary);
3353
3359
  }
3354
3360
 
3361
+ .datagrid-app-quick-filter__apply:disabled,
3355
3362
  .datagrid-app-quick-filter__clear:disabled {
3356
3363
  opacity: 0.45;
3357
3364
  cursor: not-allowed;
@@ -0,0 +1,83 @@
1
+ import { defineComponent as l, h as e } from "vue";
2
+ const u = l({
3
+ name: "DataGridQuickFilterInput",
4
+ props: {
5
+ value: {
6
+ type: String,
7
+ default: ""
8
+ },
9
+ placeholder: {
10
+ type: String,
11
+ required: !0
12
+ },
13
+ active: {
14
+ type: Boolean,
15
+ default: !1
16
+ },
17
+ dirty: {
18
+ type: Boolean,
19
+ default: !1
20
+ },
21
+ manual: {
22
+ type: Boolean,
23
+ default: !1
24
+ },
25
+ onUpdateValue: {
26
+ type: Function,
27
+ required: !0
28
+ },
29
+ onApply: {
30
+ type: Function,
31
+ default: void 0
32
+ },
33
+ onClear: {
34
+ type: Function,
35
+ required: !0
36
+ }
37
+ },
38
+ setup(a) {
39
+ return () => e("label", {
40
+ class: [
41
+ "datagrid-app-quick-filter",
42
+ a.active ? "datagrid-app-quick-filter--active" : null
43
+ ]
44
+ }, [
45
+ e("span", {
46
+ class: "datagrid-app-quick-filter__label"
47
+ }, "Quick filter"),
48
+ e("input", {
49
+ class: "datagrid-app-quick-filter__input",
50
+ type: "search",
51
+ value: a.value,
52
+ placeholder: a.placeholder,
53
+ "aria-label": "Quick filter",
54
+ "data-datagrid-quick-filter-input": "true",
55
+ onInput: (t) => {
56
+ a.onUpdateValue(t.target?.value ?? "");
57
+ },
58
+ onKeydown: (t) => {
59
+ t.key !== "Enter" || !a.manual || (t.preventDefault(), a.onApply?.());
60
+ }
61
+ }),
62
+ a.manual ? e("button", {
63
+ type: "button",
64
+ class: "datagrid-app-quick-filter__apply",
65
+ disabled: !a.dirty,
66
+ "aria-label": "Apply quick filter",
67
+ "data-datagrid-quick-filter-apply": "true",
68
+ onClick: () => a.onApply?.()
69
+ }, "Apply") : null,
70
+ e("button", {
71
+ type: "button",
72
+ class: "datagrid-app-quick-filter__clear",
73
+ disabled: !a.active,
74
+ "aria-label": "Clear quick filter",
75
+ "data-datagrid-quick-filter-clear": "true",
76
+ onClick: () => a.onClear()
77
+ }, "Clear")
78
+ ]);
79
+ }
80
+ });
81
+ export {
82
+ u as D
83
+ };