@likable-hair/svelte 4.0.13 → 4.0.14

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.
@@ -4,7 +4,7 @@
4
4
  <script lang="ts">import '../../../css/main.css';
5
5
  import MenuOrDrawer from "./MenuOrDrawer.svelte";
6
6
  import SelectableVerticalList from '../../simple/lists/SelectableVerticalList.svelte';
7
- let { open = $bindable(false), activator = $bindable(), drawerPosition = 'bottom', menuAnchor = 'bottom-center', elements = [], stayInViewport = true, flipOnOverflow = false, _boxShadow = "rgb(var(--global-color-grey-900), .5) 0px 2px 4px", _height = "300px", _maxHeight = undefined, _minWidth = "100px", _borderRadius = "5px", openingId = undefined, onselect, } = $props();
7
+ let { open = $bindable(false), activator = $bindable(), drawerPosition = 'bottom', menuAnchor = 'bottom-center', elements = [], stayInViewport = true, flipOnOverflow = false, _boxShadow = "rgb(var(--global-color-grey-900), .5) 0px 2px 4px", _height = "fit-content", _maxHeight = undefined, _minWidth = "100px", _borderRadius = "5px", openingId = undefined, onselect, } = $props();
8
8
  let selected = $state();
9
9
  let focused = $state();
10
10
  $effect(() => {
@@ -57,6 +57,5 @@ function handleOnSelect(e) {
57
57
  .selectable-list-wrapper {
58
58
  background-color: rgb(var(--global-color-background-100));
59
59
  overflow: auto;
60
- height: 100%
61
60
  }
62
61
  </style>
@@ -50,6 +50,8 @@ export default class Builder {
50
50
  private applyWhereNullClause;
51
51
  private applyWhereClause;
52
52
  private applyWhereColumnClause;
53
+ whereRaw(clause: string, bindings?: WhereFilterValue[]): Builder;
54
+ orWhereRaw(clause: string, bindings?: WhereFilterValue[]): Builder;
53
55
  private applyWhereJsonSupersetClause;
54
56
  join(table: string, onCallback: (onBuilder: OnClauseBuilder) => void): this;
55
57
  leftJoin(table: string, onCallback: (onBuilder: OnClauseBuilder) => void): this;
@@ -156,6 +156,26 @@ export default class Builder {
156
156
  }
157
157
  return this;
158
158
  }
159
+ whereRaw(clause, bindings) {
160
+ this._modifiers.push({
161
+ method: 'where',
162
+ kind: 'raw',
163
+ logicalOperator: 'and',
164
+ clause,
165
+ bindings
166
+ });
167
+ return this;
168
+ }
169
+ orWhereRaw(clause, bindings) {
170
+ this._modifiers.push({
171
+ method: 'where',
172
+ kind: 'raw',
173
+ logicalOperator: 'or',
174
+ clause,
175
+ bindings
176
+ });
177
+ return this;
178
+ }
159
179
  applyWhereJsonSupersetClause(logicalOperator, first, second) {
160
180
  this._modifiers.push({
161
181
  method: 'where',
@@ -74,6 +74,7 @@ type NumberFilter = {
74
74
  from?: number;
75
75
  to?: number;
76
76
  };
77
+ mode: 'between';
77
78
  }) => Builder;
78
79
  from?: number;
79
80
  to?: number;
@@ -82,6 +83,7 @@ type NumberFilter = {
82
83
  modify?: (params: {
83
84
  builder: Builder;
84
85
  value?: number;
86
+ mode: 'equal' | 'greater' | 'lower';
85
87
  }) => Builder;
86
88
  value?: number;
87
89
  });
@@ -25,7 +25,11 @@ export default class Converter {
25
25
  continue;
26
26
  if (!!filter.modify) {
27
27
  if ('value' in filter && filter.value !== undefined) {
28
- builder = filter.modify({ builder, value: filter.value });
28
+ builder = filter.modify({
29
+ builder,
30
+ value: filter.value,
31
+ mode: filter.type === 'number' ? filter.mode : 'equal'
32
+ });
29
33
  }
30
34
  else if ('values' in filter && filter.values !== undefined) {
31
35
  builder = filter.modify({ builder, values: filter.values });
@@ -34,7 +38,7 @@ export default class Converter {
34
38
  builder = filter.modify({ builder, value: { from: filter.from, to: filter.to } });
35
39
  }
36
40
  else if (filter.type === 'number' && ('from' in filter || 'to' in filter)) {
37
- builder = filter.modify({ builder, value: { from: filter.from, to: filter.to } });
41
+ builder = filter.modify({ builder, value: { from: filter.from, to: filter.to }, mode: 'between' });
38
42
  }
39
43
  }
40
44
  else if (filter.type == 'string') {
@@ -6,7 +6,7 @@ type GroupedWhere = {
6
6
  method: 'where';
7
7
  kind: 'grouped';
8
8
  logicalOperator?: 'and' | 'or' | 'andNot' | 'orNot';
9
- children: (ObjectWhere | SimpleWhere | GroupedWhere | InWhere | ColumnWhere | JsonSupersetWhere | InBuilderWhere | NullWhere)[];
9
+ children: (ObjectWhere | SimpleWhere | GroupedWhere | InWhere | ColumnWhere | JsonSupersetWhere | InBuilderWhere | NullWhere | RawWhere)[];
10
10
  };
11
11
  type ObjectWhere = {
12
12
  method: 'where';
@@ -30,6 +30,13 @@ type ColumnWhere = {
30
30
  operator?: string;
31
31
  column: string;
32
32
  };
33
+ type RawWhere = {
34
+ method: 'where';
35
+ kind: 'raw';
36
+ logicalOperator?: 'and' | 'or';
37
+ clause: string;
38
+ bindings?: WhereFilterValue[];
39
+ };
33
40
  type InWhere = {
34
41
  method: 'where';
35
42
  kind: 'in';
@@ -42,7 +49,7 @@ type InBuilderWhere = {
42
49
  kind: 'inBuilder';
43
50
  logicalOperator?: 'and' | 'or' | 'andNot' | 'orNot';
44
51
  key: string;
45
- children: (ObjectWhere | SimpleWhere | GroupedWhere | InWhere | ColumnWhere | JsonSupersetWhere | InBuilderWhere | NullWhere | SelectModifier | JoinModifier | FromModifier)[];
52
+ children: (ObjectWhere | SimpleWhere | GroupedWhere | InWhere | ColumnWhere | JsonSupersetWhere | InBuilderWhere | NullWhere | RawWhere | SelectModifier | JoinModifier | FromModifier)[];
46
53
  };
47
54
  type JsonSupersetWhere = {
48
55
  method: 'where';
@@ -57,5 +64,5 @@ type NullWhere = {
57
64
  logicalOperator?: 'and' | 'or' | 'andNot' | 'orNot';
58
65
  key: string;
59
66
  };
60
- export type WhereModifier = SimpleWhere | ObjectWhere | GroupedWhere | InWhere | ColumnWhere | JsonSupersetWhere | InBuilderWhere | NullWhere;
67
+ export type WhereModifier = SimpleWhere | ObjectWhere | GroupedWhere | InWhere | ColumnWhere | JsonSupersetWhere | InBuilderWhere | NullWhere | RawWhere;
61
68
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@likable-hair/svelte",
3
3
  "description": "A Svelte component for likablehair and others",
4
- "version": "4.0.13",
4
+ "version": "4.0.14",
5
5
  "scripts": {
6
6
  "host": "vite --host",
7
7
  "dev": "vite dev",