Skip to content

Commit d7d8fe9

Browse files
committed
fix TS support, unit test and documentation
1 parent b0cc996 commit d7d8fe9

File tree

4 files changed

+4
-0
lines changed

4 files changed

+4
-0
lines changed

docs/styling.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ The `rule` slot allows for customizing markup around each rule component.
9090

9191
The slot receives an object with the shape of the [RuleSlotProps
9292
object](https://github.com/rtucek/vue-query-builder/blob/master/types/index.d.ts#L47).
93+
An exact ruel can be identified based on the `ruleCtrl.ruleIdentifier` for dynamic content.
9394

9495
You'll have to use Vue's [Dynamic
9596
Component](https://vuejs.org/v2/guide/components.html#Dynamic-Components) feature for displaying the

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export interface GroupCtrlSlotProps {
4747
export interface RuleSlotProps {
4848
ruleComponent: Component | string,
4949
ruleData: any,
50+
identifier: string,
5051
updateRuleData: (newData: any) => void,
5152
}
5253

tests/unit/slots.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ describe('Testing slot related features', () => {
197197
// Verify rule slot is properly rendered
198198
expect(ruleComponent.is(Component)).toBeTruthy();
199199
expect(ruleComponent.vm.$props.value).toBe('A');
200+
expect(ruleComponent.vm.$props.ruleIdentifier).toBe('txt');
200201
ruleComponent.vm.$emit('input', 'a');
201202
expect((rule.emitted('query-update') as any)[0][0]).toStrictEqual({ identifier: 'txt', value: 'a' });
202203

types/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,6 @@ export interface GroupCtrlSlotProps {
4747
export interface RuleSlotProps {
4848
ruleComponent: Component | string,
4949
ruleData: any,
50+
identifier: string,
5051
updateRuleData: (newData: any) => void,
5152
}

0 commit comments

Comments
 (0)