@affino/datagrid-vue-app 0.1.49 → 0.1.50

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
@@ -82,6 +82,7 @@ Use subpath imports when you want optional feature modules explicitly:
82
82
 
83
83
  - `@affino/datagrid-vue-app/gantt`
84
84
  - `@affino/datagrid-vue-app/advanced-filter`
85
+ - `@affino/datagrid-vue-app/quick-filter`
85
86
  - `@affino/datagrid-vue-app/find-replace`
86
87
  - `@affino/datagrid-vue-app/aggregations`
87
88
 
@@ -89,7 +90,7 @@ Practical implications:
89
90
 
90
91
  - ordinary `DataGrid` table usage no longer needs to pull `@affino/datagrid-gantt` through the root runtime graph
91
92
  - gantt stage code is loaded lazily only when the gantt view is rendered
92
- - advanced filter, find / replace, and aggregations remain available as optional package entrypoints instead of mandatory consumer-side chunking requirements
93
+ - advanced filter, quick filter, find / replace, and aggregations remain available as optional package entrypoints instead of mandatory consumer-side chunking requirements
93
94
 
94
95
  Consumer-side chunk tuning can still help, but it is now an optimization rather than a workaround for the package boundary.
95
96
 
@@ -470,6 +471,7 @@ const toolbarModules: readonly DataGridAppToolbarModule[] = [
470
471
  :columns="columns"
471
472
  :toolbar-modules="toolbarModules"
472
473
  column-layout
474
+ quick-filter
473
475
  advanced-filter
474
476
  />
475
477
  </template>
@@ -567,6 +569,7 @@ Enable the built-in header menu with one prop:
567
569
  :columns="columns"
568
570
  column-menu
569
571
  column-layout
572
+ quick-filter
570
573
  advanced-filter
571
574
  aggregations
572
575
  row-hover
@@ -1458,6 +1461,54 @@ The public component exposes full grid state round-tripping.
1458
1461
 
1459
1462
  When `state` is the only controlled input, the built-in app toolbar and filter affordances derive their effective sort, filter, grouping, and pivot state from that unified snapshot. You do not need to mirror the same payload back into separate `sort-model`, `filter-model`, `group-by`, or `pivot-model` props just to keep the default renderer synchronized.
1460
1463
 
1464
+ Quick filter can be enabled as a built-in toolbar control next to `advanced-filter`:
1465
+
1466
+ ```vue
1467
+ <DataGrid
1468
+ :rows="rows"
1469
+ :columns="columns"
1470
+ quick-filter
1471
+ advanced-filter
1472
+ />
1473
+ ```
1474
+
1475
+ The object form controls placeholder text, explicit searchable columns, and matching mode:
1476
+
1477
+ ```vue
1478
+ <DataGrid
1479
+ :rows="rows"
1480
+ :columns="columns"
1481
+ :quick-filter="{
1482
+ placeholder: 'Search accounts',
1483
+ columns: ['service', 'owner', 'region'],
1484
+ mode: 'tokens',
1485
+ }"
1486
+ />
1487
+ ```
1488
+
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.
1490
+
1491
+ Controlled consumers can still manage quick filter directly through the same `filter-model` contract:
1492
+
1493
+ ```vue
1494
+ <DataGrid
1495
+ :rows="rows"
1496
+ :columns="columns"
1497
+ :filter-model="{
1498
+ columnFilters: {},
1499
+ advancedFilters: {},
1500
+ advancedExpression: null,
1501
+ quickFilter: {
1502
+ query: 'platform eu',
1503
+ columns: ['service', 'owner', 'region'],
1504
+ mode: 'tokens',
1505
+ },
1506
+ }"
1507
+ />
1508
+ ```
1509
+
1510
+ The app facade remains `filterModel`-first. `quick-filter` only drives the existing filter snapshot, so quick filter stays serializable and aligned with the core projection/filter pipeline. See [DataGrid Quick Filter](https://github.com/affinio/affinio/blob/main/docs/datagrid-quick-filter.md).
1511
+
1461
1512
  Controlled state:
1462
1513
 
1463
1514
  ```vue
@@ -8,6 +8,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
10
  import { type DataGridAdvancedFilterProp } from "./config/dataGridAdvancedFilter";
11
+ import { type DataGridQuickFilterProp } from "./config/dataGridQuickFilter";
11
12
  import { type DataGridFindReplaceProp } from "./config/dataGridFindReplace";
12
13
  import { type DataGridGridLinesProp } from "./config/dataGridGridLines";
13
14
  import { type DataGridLayoutMode } from "./config/dataGridLayout";
@@ -140,6 +141,10 @@ declare const dataGridProps: {
140
141
  readonly type: PropType<DataGridAdvancedFilterProp | undefined>;
141
142
  readonly default: undefined;
142
143
  };
144
+ readonly quickFilter: {
145
+ readonly type: PropType<DataGridQuickFilterProp | undefined>;
146
+ readonly default: undefined;
147
+ };
143
148
  readonly findReplace: {
144
149
  readonly type: PropType<DataGridFindReplaceProp | undefined>;
145
150
  readonly default: undefined;
@@ -460,6 +465,10 @@ declare const DataGridRuntimeComponent: import("vue").DefineComponent<{
460
465
  readonly type: PropType<DataGridAdvancedFilterProp | undefined>;
461
466
  readonly default: undefined;
462
467
  };
468
+ readonly quickFilter: {
469
+ readonly type: PropType<DataGridQuickFilterProp | undefined>;
470
+ readonly default: undefined;
471
+ };
463
472
  readonly findReplace: {
464
473
  readonly type: PropType<DataGridFindReplaceProp | undefined>;
465
474
  readonly default: undefined;
@@ -757,6 +766,10 @@ declare const DataGridRuntimeComponent: import("vue").DefineComponent<{
757
766
  readonly type: PropType<DataGridAdvancedFilterProp | undefined>;
758
767
  readonly default: undefined;
759
768
  };
769
+ readonly quickFilter: {
770
+ readonly type: PropType<DataGridQuickFilterProp | undefined>;
771
+ readonly default: undefined;
772
+ };
760
773
  readonly findReplace: {
761
774
  readonly type: PropType<DataGridFindReplaceProp | undefined>;
762
775
  readonly default: undefined;
@@ -1000,6 +1013,7 @@ declare const DataGridRuntimeComponent: import("vue").DefineComponent<{
1000
1013
  readonly pagination: DataGridPaginationProp | undefined;
1001
1014
  readonly rowModel: DataGridRowModel<unknown> | undefined;
1002
1015
  readonly aggregations: DataGridAggregationsProp | undefined;
1016
+ readonly quickFilter: DataGridQuickFilterProp | undefined;
1003
1017
  readonly reportFillWarning: ((message: string) => void) | undefined;
1004
1018
  readonly sortModel: readonly DataGridSortState[] | undefined;
1005
1019
  readonly filterModel: DataGridFilterSnapshot | null | undefined;
@@ -3289,6 +3289,74 @@ const ci = "affino-datagrid-vue-app-styles", on = `
3289
3289
  color: var(--datagrid-accent-strong);
3290
3290
  }
3291
3291
 
3292
+ .datagrid-app-quick-filter {
3293
+ display: inline-flex;
3294
+ align-items: center;
3295
+ gap: 6px;
3296
+ min-width: 220px;
3297
+ height: var(--datagrid-app-toolbar-button-height, 32px);
3298
+ padding: 0 6px 0 var(--datagrid-app-toolbar-button-padding-inline, 12px);
3299
+ border: 1px solid var(--datagrid-filter-trigger-border);
3300
+ border-radius: 8px;
3301
+ background: var(--datagrid-editor-bg);
3302
+ color: var(--datagrid-text-primary);
3303
+ }
3304
+
3305
+ .datagrid-app-quick-filter--active {
3306
+ border-color: color-mix(in srgb, var(--datagrid-accent-strong) 46%, var(--datagrid-filter-trigger-border));
3307
+ background: color-mix(in srgb, var(--datagrid-accent-strong) 10%, var(--datagrid-editor-bg));
3308
+ }
3309
+
3310
+ .datagrid-app-quick-filter__label {
3311
+ flex: 0 0 auto;
3312
+ color: var(--datagrid-text-muted);
3313
+ font-size: var(--datagrid-app-toolbar-button-font-size, 12px);
3314
+ font-weight: 600;
3315
+ }
3316
+
3317
+ .datagrid-app-quick-filter__input {
3318
+ min-width: 0;
3319
+ width: 160px;
3320
+ border: 0;
3321
+ outline: 0;
3322
+ background: transparent;
3323
+ color: var(--datagrid-text-primary);
3324
+ font: inherit;
3325
+ font-size: var(--datagrid-app-toolbar-button-font-size, 12px);
3326
+ }
3327
+
3328
+ .datagrid-app-quick-filter__input::placeholder {
3329
+ color: var(--datagrid-text-muted);
3330
+ }
3331
+
3332
+ .datagrid-app-quick-filter:focus-within {
3333
+ box-shadow: 0 0 0 2px var(--datagrid-column-menu-focus-ring);
3334
+ }
3335
+
3336
+ .datagrid-app-quick-filter__clear {
3337
+ flex: 0 0 auto;
3338
+ height: calc(var(--datagrid-app-toolbar-button-height, 32px) - 10px);
3339
+ padding: 0 8px;
3340
+ border: 0;
3341
+ border-radius: 6px;
3342
+ background: transparent;
3343
+ color: var(--datagrid-text-muted);
3344
+ font: inherit;
3345
+ font-size: var(--datagrid-app-toolbar-button-font-size, 12px);
3346
+ font-weight: 600;
3347
+ cursor: pointer;
3348
+ }
3349
+
3350
+ .datagrid-app-quick-filter__clear:hover:not(:disabled) {
3351
+ background: color-mix(in srgb, var(--datagrid-column-menu-item-hover-bg) 72%, transparent);
3352
+ color: var(--datagrid-text-primary);
3353
+ }
3354
+
3355
+ .datagrid-app-quick-filter__clear:disabled {
3356
+ opacity: 0.45;
3357
+ cursor: not-allowed;
3358
+ }
3359
+
3292
3360
  .datagrid-overlay-drag-handle {
3293
3361
  display: flex;
3294
3362
  flex-direction: column;
@@ -0,0 +1,60 @@
1
+ import { defineComponent as i, h as a } from "vue";
2
+ const r = i({
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
+ onUpdateValue: {
18
+ type: Function,
19
+ required: !0
20
+ },
21
+ onClear: {
22
+ type: Function,
23
+ required: !0
24
+ }
25
+ },
26
+ setup(e) {
27
+ return () => a("label", {
28
+ class: [
29
+ "datagrid-app-quick-filter",
30
+ e.active ? "datagrid-app-quick-filter--active" : null
31
+ ]
32
+ }, [
33
+ a("span", {
34
+ class: "datagrid-app-quick-filter__label"
35
+ }, "Quick filter"),
36
+ a("input", {
37
+ class: "datagrid-app-quick-filter__input",
38
+ type: "search",
39
+ value: e.value,
40
+ placeholder: e.placeholder,
41
+ "aria-label": "Quick filter",
42
+ "data-datagrid-quick-filter-input": "true",
43
+ onInput: (t) => {
44
+ e.onUpdateValue(t.target?.value ?? "");
45
+ }
46
+ }),
47
+ a("button", {
48
+ type: "button",
49
+ class: "datagrid-app-quick-filter__clear",
50
+ disabled: !e.active,
51
+ "aria-label": "Clear quick filter",
52
+ "data-datagrid-quick-filter-clear": "true",
53
+ onClick: () => e.onClear()
54
+ }, "Clear")
55
+ ]);
56
+ }
57
+ });
58
+ export {
59
+ r as D
60
+ };