@likable-hair/svelte 3.1.11 → 3.1.13
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/dist/components/composed/forms/AsyncAutocomplete.svelte +2 -1
- package/dist/components/composed/forms/AsyncAutocomplete.svelte.d.ts +1 -0
- package/dist/components/simple/navigation/Chip.css +1 -0
- package/dist/components/simple/navigation/Chip.svelte +3 -1
- package/dist/utils/filters/builder.d.ts +19 -1
- package/dist/utils/filters/builder.js +71 -1
- package/dist/utils/filters/modifiers/from.d.ts +4 -0
- package/dist/utils/filters/modifiers/from.js +1 -0
- package/dist/utils/filters/modifiers/join.d.ts +2 -2
- package/dist/utils/filters/modifiers/select.d.ts +4 -0
- package/dist/utils/filters/modifiers/select.js +1 -0
- package/dist/utils/filters/modifiers/where.d.ts +18 -4
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<script>import Autocomplete from "../../../components/simple/forms/Autocomplete.svelte";
|
|
4
4
|
import debounceStore from "../../../stores/debounce";
|
|
5
5
|
import { writable } from "svelte/store";
|
|
6
|
-
export let items = [], values = [], multiple = false, searcher, placeholder = void 0, searchThreshold = 2, debounceTimeout = 500, searching = false, search = false, searchText = void 0, maxVisibleChips = void 0, menuOpened = false, mobileDrawer = false, closeOnSelect = false;
|
|
6
|
+
export let items = [], values = [], multiple = false, searcher, placeholder = void 0, searchThreshold = 2, debounceTimeout = 500, searching = false, search = false, searchText = void 0, maxVisibleChips = void 0, menuOpened = false, mobileDrawer = false, closeOnSelect = false, disabled = false;
|
|
7
7
|
const searchTextValue = writable(searchText);
|
|
8
8
|
$:
|
|
9
9
|
searchTextDebounce = debounceStore(searchTextValue, debounceTimeout);
|
|
@@ -40,6 +40,7 @@ $:
|
|
|
40
40
|
bind:mobileDrawer
|
|
41
41
|
bind:placeholder
|
|
42
42
|
bind:closeOnSelect
|
|
43
|
+
bind:disabled
|
|
43
44
|
searchFunction={() => true}
|
|
44
45
|
on:change
|
|
45
46
|
></Autocomplete>
|
|
@@ -155,7 +155,9 @@ function handleCloseClick(e) {
|
|
|
155
155
|
margin-left: 10px;
|
|
156
156
|
}
|
|
157
157
|
.text {
|
|
158
|
-
display:
|
|
158
|
+
display: flex;
|
|
159
|
+
align-items: center;
|
|
160
|
+
gap: var(--chip-gap, var(--chip-default-gap));
|
|
159
161
|
vertical-align: middle;
|
|
160
162
|
user-select: none;
|
|
161
163
|
font-size: var(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { JoinModifier } from "./modifiers/join";
|
|
2
2
|
import type { WhereModifier, WhereFilterValue } from "./modifiers/where";
|
|
3
|
-
|
|
3
|
+
import type { SelectModifier } from "./modifiers/select";
|
|
4
|
+
import type { FromModifier } from "./modifiers/from";
|
|
5
|
+
export type Modifier = WhereModifier | JoinModifier | SelectModifier | FromModifier;
|
|
4
6
|
export type JsonQuery = {
|
|
5
7
|
modifiers: Modifier[];
|
|
6
8
|
};
|
|
@@ -29,6 +31,20 @@ export default class Builder {
|
|
|
29
31
|
orWhereColumn(key: string, operator: string, compareColumn: string): Builder;
|
|
30
32
|
whereJsonSuperset(key: string, object: Object): Builder;
|
|
31
33
|
orWhereJsonSuperset(key: string, object: Object): Builder;
|
|
34
|
+
whereIn(key: string, callback: (builder: Builder) => void): Builder;
|
|
35
|
+
whereIn(key: string, values: WhereFilterValue[]): Builder;
|
|
36
|
+
orWhereIn(key: string, callback: (builder: Builder) => void): Builder;
|
|
37
|
+
orWhereIn(key: string, values: WhereFilterValue[]): Builder;
|
|
38
|
+
notWhereIn(key: string, callback: (builder: Builder) => void): Builder;
|
|
39
|
+
notWhereIn(key: string, values: WhereFilterValue[]): Builder;
|
|
40
|
+
orNotWhereIn(key: string, callback: (builder: Builder) => void): Builder;
|
|
41
|
+
orNotWhereIn(key: string, values: WhereFilterValue[]): Builder;
|
|
42
|
+
private applyWhereInClause;
|
|
43
|
+
whereNull(key: string): Builder;
|
|
44
|
+
orWhereNull(key: string): Builder;
|
|
45
|
+
notWhereNull(key: string): Builder;
|
|
46
|
+
orNotWhereNull(key: string): Builder;
|
|
47
|
+
private applyWhereNullClause;
|
|
32
48
|
private applyWhereClause;
|
|
33
49
|
private applyWhereColumnClause;
|
|
34
50
|
private applyWhereJsonSupersetClause;
|
|
@@ -37,6 +53,8 @@ export default class Builder {
|
|
|
37
53
|
rightJoin(table: string, onCallback: (onBuilder: OnClauseBuilder) => void): this;
|
|
38
54
|
private applyJoinClause;
|
|
39
55
|
toJson(): JsonQuery;
|
|
56
|
+
select(fields: string | string[]): this;
|
|
57
|
+
from(from: string): this;
|
|
40
58
|
}
|
|
41
59
|
import type { JoinModifierOnClause } from "./modifiers/join";
|
|
42
60
|
declare class OnClauseBuilder {
|
|
@@ -27,6 +27,62 @@ export default class Builder {
|
|
|
27
27
|
orWhereJsonSuperset(first, second) {
|
|
28
28
|
return this.applyWhereJsonSupersetClause('or', first, second);
|
|
29
29
|
}
|
|
30
|
+
whereIn(key, second) {
|
|
31
|
+
return this.applyWhereInClause('and', key, second);
|
|
32
|
+
}
|
|
33
|
+
orWhereIn(key, second) {
|
|
34
|
+
return this.applyWhereInClause('or', key, second);
|
|
35
|
+
}
|
|
36
|
+
notWhereIn(key, second) {
|
|
37
|
+
return this.applyWhereInClause('andNot', key, second);
|
|
38
|
+
}
|
|
39
|
+
orNotWhereIn(key, second) {
|
|
40
|
+
return this.applyWhereInClause('orNot', key, second);
|
|
41
|
+
}
|
|
42
|
+
applyWhereInClause(logicalOperator, key, second) {
|
|
43
|
+
if (typeof second == 'function') {
|
|
44
|
+
let inBuilder = new Builder();
|
|
45
|
+
second(inBuilder);
|
|
46
|
+
this.modifiers.push({
|
|
47
|
+
method: 'where',
|
|
48
|
+
kind: 'inBuilder',
|
|
49
|
+
logicalOperator: logicalOperator,
|
|
50
|
+
key: key,
|
|
51
|
+
modifiers: inBuilder.modifiers
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this.modifiers.push({
|
|
56
|
+
method: 'where',
|
|
57
|
+
kind: 'in',
|
|
58
|
+
logicalOperator: logicalOperator,
|
|
59
|
+
key: key,
|
|
60
|
+
value: second
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
whereNull(key) {
|
|
66
|
+
return this.applyWhereNullClause('and', key);
|
|
67
|
+
}
|
|
68
|
+
orWhereNull(key) {
|
|
69
|
+
return this.applyWhereNullClause('or', key);
|
|
70
|
+
}
|
|
71
|
+
notWhereNull(key) {
|
|
72
|
+
return this.applyWhereNullClause('andNot', key);
|
|
73
|
+
}
|
|
74
|
+
orNotWhereNull(key) {
|
|
75
|
+
return this.applyWhereNullClause('orNot', key);
|
|
76
|
+
}
|
|
77
|
+
applyWhereNullClause(logicalOperator, key) {
|
|
78
|
+
this.modifiers.push({
|
|
79
|
+
method: 'where',
|
|
80
|
+
kind: 'null',
|
|
81
|
+
logicalOperator: logicalOperator,
|
|
82
|
+
key: key
|
|
83
|
+
});
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
30
86
|
applyWhereClause(logicalOperator, first, second, third) {
|
|
31
87
|
if (third !== undefined) {
|
|
32
88
|
if (!!second && typeof first == 'string' && typeof second == 'string') {
|
|
@@ -48,7 +104,7 @@ export default class Builder {
|
|
|
48
104
|
});
|
|
49
105
|
}
|
|
50
106
|
}
|
|
51
|
-
else if (typeof first == 'string' &&
|
|
107
|
+
else if (typeof first == 'string' && second !== undefined) {
|
|
52
108
|
this.modifiers.push({
|
|
53
109
|
method: 'where',
|
|
54
110
|
kind: 'simple',
|
|
@@ -135,6 +191,20 @@ export default class Builder {
|
|
|
135
191
|
modifiers: this.modifiers
|
|
136
192
|
};
|
|
137
193
|
}
|
|
194
|
+
select(fields) {
|
|
195
|
+
this.modifiers.push({
|
|
196
|
+
method: 'select',
|
|
197
|
+
fields: fields
|
|
198
|
+
});
|
|
199
|
+
return this;
|
|
200
|
+
}
|
|
201
|
+
from(from) {
|
|
202
|
+
this.modifiers.push({
|
|
203
|
+
method: 'from',
|
|
204
|
+
from: from
|
|
205
|
+
});
|
|
206
|
+
return this;
|
|
207
|
+
}
|
|
138
208
|
}
|
|
139
209
|
class OnClauseBuilder {
|
|
140
210
|
onClauses;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -16,11 +16,11 @@ type InnerJoinModifier = {
|
|
|
16
16
|
table: string;
|
|
17
17
|
on: JoinModifierOnClause[];
|
|
18
18
|
};
|
|
19
|
-
type
|
|
19
|
+
type LeftJoinModifier = {
|
|
20
20
|
method: 'join';
|
|
21
21
|
kind: 'left';
|
|
22
22
|
table: string;
|
|
23
23
|
on: JoinModifierOnClause[];
|
|
24
24
|
};
|
|
25
|
-
export type JoinModifier =
|
|
25
|
+
export type JoinModifier = LeftJoinModifier | InnerJoinModifier | RightJoinModifier;
|
|
26
26
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { Modifier } from "../builder";
|
|
1
2
|
export type WhereFilterValue = string | number | Date | boolean;
|
|
2
3
|
type GroupedWhere = {
|
|
3
4
|
method: 'where';
|
|
4
5
|
kind: 'grouped';
|
|
5
6
|
logicalOperator?: 'and' | 'or' | 'andNot' | 'orNot';
|
|
6
|
-
children: (ObjectWhere | SimpleWhere | GroupedWhere | InWhere | ColumnWhere |
|
|
7
|
+
children: (ObjectWhere | SimpleWhere | GroupedWhere | InWhere | ColumnWhere | JsonSupersetWhere | InBuilderWhere | NullWhere)[];
|
|
7
8
|
};
|
|
8
9
|
type ObjectWhere = {
|
|
9
10
|
method: 'where';
|
|
@@ -17,7 +18,7 @@ type SimpleWhere = {
|
|
|
17
18
|
logicalOperator?: 'and' | 'or' | 'andNot' | 'orNot';
|
|
18
19
|
key: string;
|
|
19
20
|
operator?: string;
|
|
20
|
-
value: WhereFilterValue
|
|
21
|
+
value: WhereFilterValue;
|
|
21
22
|
};
|
|
22
23
|
type ColumnWhere = {
|
|
23
24
|
method: 'where';
|
|
@@ -34,12 +35,25 @@ type InWhere = {
|
|
|
34
35
|
key: string;
|
|
35
36
|
value: (WhereFilterValue)[];
|
|
36
37
|
};
|
|
37
|
-
type
|
|
38
|
+
type InBuilderWhere = {
|
|
39
|
+
method: 'where';
|
|
40
|
+
kind: 'inBuilder';
|
|
41
|
+
logicalOperator?: 'and' | 'or' | 'andNot' | 'orNot';
|
|
42
|
+
key: string;
|
|
43
|
+
modifiers: Modifier[];
|
|
44
|
+
};
|
|
45
|
+
type JsonSupersetWhere = {
|
|
38
46
|
method: 'where';
|
|
39
47
|
kind: 'jsonSuperset';
|
|
40
48
|
logicalOperator?: 'and' | 'or' | 'andNot' | 'orNot';
|
|
41
49
|
key: string;
|
|
42
50
|
value: Object;
|
|
43
51
|
};
|
|
44
|
-
|
|
52
|
+
type NullWhere = {
|
|
53
|
+
method: 'where';
|
|
54
|
+
kind: 'null';
|
|
55
|
+
logicalOperator?: 'and' | 'or' | 'andNot' | 'orNot';
|
|
56
|
+
key: string;
|
|
57
|
+
};
|
|
58
|
+
export type WhereModifier = SimpleWhere | ObjectWhere | GroupedWhere | InWhere | ColumnWhere | JsonSupersetWhere | InBuilderWhere | NullWhere;
|
|
45
59
|
export {};
|