@toolbox-web/grid-vue 0.3.0 → 0.4.0
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/features/filtering.d.ts.map +1 -1
- package/features/filtering.js +42 -24
- package/features/filtering.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +572 -318
- package/index.js.map +1 -1
- package/lib/TbwGrid.vue.d.ts +10 -10
- package/lib/TbwGrid.vue.d.ts.map +1 -1
- package/lib/TbwGridColumn.vue.d.ts.map +1 -1
- package/lib/feature-props.d.ts +19 -1
- package/lib/feature-props.d.ts.map +1 -1
- package/lib/grid-type-registry.d.ts +23 -0
- package/lib/grid-type-registry.d.ts.map +1 -1
- package/lib/slot-types.d.ts +14 -0
- package/lib/slot-types.d.ts.map +1 -1
- package/lib/vue-grid-adapter.d.ts +91 -3
- package/lib/vue-grid-adapter.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/slot-types.d.ts
CHANGED
|
@@ -42,9 +42,23 @@ export interface EditorSlotProps<TRow = unknown, TValue = unknown> {
|
|
|
42
42
|
row: TRow;
|
|
43
43
|
/** The column configuration */
|
|
44
44
|
column: ColumnConfig<TRow>;
|
|
45
|
+
/** Field name being edited */
|
|
46
|
+
field: string;
|
|
47
|
+
/** Stable row identifier (from `getRowId`). Empty string if no `getRowId` is configured. */
|
|
48
|
+
rowId: string;
|
|
45
49
|
/** Commit the edit with new value */
|
|
46
50
|
commit: (newValue: TValue) => void;
|
|
47
51
|
/** Cancel the edit */
|
|
48
52
|
cancel: () => void;
|
|
53
|
+
/**
|
|
54
|
+
* Update other fields in this row while the editor is open.
|
|
55
|
+
* Changes trigger `cell-change` events with source `'cascade'`.
|
|
56
|
+
*/
|
|
57
|
+
updateRow: (changes: Partial<TRow>) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Register a callback to receive value updates when the cell is modified
|
|
60
|
+
* externally (e.g., via `updateRow()` from another cell's commit).
|
|
61
|
+
*/
|
|
62
|
+
onValueChange?: (callback: (newValue: TValue) => void) => void;
|
|
49
63
|
}
|
|
50
64
|
//# sourceMappingURL=slot-types.d.ts.map
|
package/lib/slot-types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot-types.d.ts","sourceRoot":"","sources":["../../../../libs/grid-vue/src/lib/slot-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa,CAAC,IAAI,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO;IAC7D,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,GAAG,EAAE,IAAI,CAAC;IACV,+BAA+B;IAC/B,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,eAAe,CAAC,IAAI,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO;IAC/D,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,GAAG,EAAE,IAAI,CAAC;IACV,+BAA+B;IAC/B,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,qCAAqC;IACrC,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,sBAAsB;IACtB,MAAM,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"slot-types.d.ts","sourceRoot":"","sources":["../../../../libs/grid-vue/src/lib/slot-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa,CAAC,IAAI,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO;IAC7D,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,GAAG,EAAE,IAAI,CAAC;IACV,+BAA+B;IAC/B,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,eAAe,CAAC,IAAI,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO;IAC/D,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,GAAG,EAAE,IAAI,CAAC;IACV,+BAA+B;IAC/B,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,4FAA4F;IAC5F,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,sBAAsB;IACtB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB;;;OAGG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IAC5C;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;CAChE"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { TypeDefault as BaseTypeDefault, CellRenderContext, ColumnEditorContext, ColumnEditorSpec, ColumnViewRenderer, FrameworkAdapter } from '@toolbox-web/grid';
|
|
2
|
-
import { VNode } from 'vue';
|
|
3
|
-
import { TypeDefaultsMap } from './grid-type-registry';
|
|
1
|
+
import { ColumnConfig as BaseColumnConfig, GridConfig as BaseGridConfig, TypeDefault as BaseTypeDefault, CellRenderContext, ColumnEditorContext, ColumnEditorSpec, ColumnViewRenderer, FrameworkAdapter } from '@toolbox-web/grid';
|
|
2
|
+
import { Component, VNode } from 'vue';
|
|
3
|
+
import { TypeDefault, TypeDefaultsMap } from './grid-type-registry';
|
|
4
|
+
import { ColumnConfig, GridConfig } from './vue-column-config';
|
|
5
|
+
export type { GridConfig };
|
|
4
6
|
/**
|
|
5
7
|
* Register a Vue cell renderer for a column element.
|
|
6
8
|
* Called by TbwGridColumn when it has a #cell slot.
|
|
@@ -31,6 +33,19 @@ export declare function getRegisteredFields(): string[];
|
|
|
31
33
|
* @internal - for testing only
|
|
32
34
|
*/
|
|
33
35
|
export declare function clearFieldRegistries(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Checks if a value is a Vue component (SFC or defineComponent result).
|
|
38
|
+
*
|
|
39
|
+
* Vue components are identified by:
|
|
40
|
+
* - Having `__name` (SFC compiled marker)
|
|
41
|
+
* - Having `setup` function (Composition API component)
|
|
42
|
+
* - Having `render` function (Options API component)
|
|
43
|
+
* - Being an ES6 class (class-based component)
|
|
44
|
+
*
|
|
45
|
+
* Regular functions `(ctx) => HTMLElement` that are already processed
|
|
46
|
+
* will not match these checks, making this idempotent.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isVueComponent(value: unknown): value is Component;
|
|
34
49
|
/**
|
|
35
50
|
* Framework adapter that enables Vue 3 component integration
|
|
36
51
|
* with the grid's light DOM configuration API.
|
|
@@ -63,6 +78,71 @@ export declare function clearFieldRegistries(): void;
|
|
|
63
78
|
export declare class GridAdapter implements FrameworkAdapter {
|
|
64
79
|
private mountedViews;
|
|
65
80
|
private typeDefaults;
|
|
81
|
+
/**
|
|
82
|
+
* Processes a Vue grid configuration, converting Vue component references
|
|
83
|
+
* and VNode-returning render functions to DOM-returning functions.
|
|
84
|
+
*
|
|
85
|
+
* This is idempotent — already-processed configs pass through safely.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* import { GridAdapter, type GridConfig } from '@toolbox-web/grid-vue';
|
|
90
|
+
* import StatusBadge from './StatusBadge.vue';
|
|
91
|
+
*
|
|
92
|
+
* const config: GridConfig<Employee> = {
|
|
93
|
+
* columns: [
|
|
94
|
+
* { field: 'status', renderer: StatusBadge },
|
|
95
|
+
* ],
|
|
96
|
+
* };
|
|
97
|
+
*
|
|
98
|
+
* const adapter = new GridAdapter();
|
|
99
|
+
* const processedConfig = adapter.processGridConfig(config);
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @param config - Vue grid config with possible component/VNode references
|
|
103
|
+
* @returns Processed config with DOM-returning functions
|
|
104
|
+
*/
|
|
105
|
+
processGridConfig<TRow = unknown>(config: GridConfig<TRow>): BaseGridConfig<TRow>;
|
|
106
|
+
/**
|
|
107
|
+
* Processes typeDefaults, converting Vue component/VNode references
|
|
108
|
+
* to DOM-returning functions.
|
|
109
|
+
*
|
|
110
|
+
* @param typeDefaults - Vue type defaults with possible component references
|
|
111
|
+
* @returns Processed TypeDefault record
|
|
112
|
+
*/
|
|
113
|
+
processTypeDefaults<TRow = unknown>(typeDefaults: Record<string, TypeDefault<TRow>>): Record<string, BaseTypeDefault<TRow>>;
|
|
114
|
+
/**
|
|
115
|
+
* Processes a single column configuration, converting Vue component references
|
|
116
|
+
* and VNode-returning render functions to DOM-returning functions.
|
|
117
|
+
*
|
|
118
|
+
* @param column - Vue column config
|
|
119
|
+
* @returns Processed ColumnConfig with DOM-returning functions
|
|
120
|
+
*/
|
|
121
|
+
processColumn<TRow = unknown>(column: ColumnConfig<TRow>): BaseColumnConfig<TRow>;
|
|
122
|
+
/**
|
|
123
|
+
* Creates a DOM-returning renderer from a Vue component class.
|
|
124
|
+
* Used for config-based renderers (not slot-based).
|
|
125
|
+
* @internal
|
|
126
|
+
*/
|
|
127
|
+
private createConfigComponentRenderer;
|
|
128
|
+
/**
|
|
129
|
+
* Creates a DOM-returning renderer from a VNode-returning render function.
|
|
130
|
+
* Used for config-based renderers (not slot-based).
|
|
131
|
+
* @internal
|
|
132
|
+
*/
|
|
133
|
+
private createConfigVNodeRenderer;
|
|
134
|
+
/**
|
|
135
|
+
* Creates a DOM-returning editor from a Vue component class.
|
|
136
|
+
* Used for config-based editors (not slot-based).
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
private createConfigComponentEditor;
|
|
140
|
+
/**
|
|
141
|
+
* Creates a DOM-returning editor from a VNode-returning render function.
|
|
142
|
+
* Used for config-based editors (not slot-based).
|
|
143
|
+
* @internal
|
|
144
|
+
*/
|
|
145
|
+
private createConfigVNodeEditor;
|
|
66
146
|
/**
|
|
67
147
|
* Sets the type defaults map for this adapter.
|
|
68
148
|
* Called by TbwGrid when it receives type defaults from context.
|
|
@@ -134,6 +214,14 @@ export declare class GridAdapter implements FrameworkAdapter {
|
|
|
134
214
|
* @internal
|
|
135
215
|
*/
|
|
136
216
|
private createTypeEditor;
|
|
217
|
+
/**
|
|
218
|
+
* Creates a filter panel renderer function from a Vue render function.
|
|
219
|
+
*
|
|
220
|
+
* Wraps a Vue `(params: FilterPanelParams) => VNode` function into the
|
|
221
|
+
* imperative `(container, params) => void` signature expected by the core grid.
|
|
222
|
+
* @internal
|
|
223
|
+
*/
|
|
224
|
+
private createFilterPanelRenderer;
|
|
137
225
|
/**
|
|
138
226
|
* Cleanup all mounted Vue apps.
|
|
139
227
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue-grid-adapter.d.ts","sourceRoot":"","sources":["../../../../libs/grid-vue/src/lib/vue-grid-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,IAAI,eAAe,EAC9B,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"vue-grid-adapter.d.ts","sourceRoot":"","sources":["../../../../libs/grid-vue/src/lib/vue-grid-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,IAAI,gBAAgB,EAChC,UAAU,IAAI,cAAc,EAC5B,WAAW,IAAI,eAAe,EAC9B,iBAAiB,EACjB,mBAAmB,EACnB,gBA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