@likable-hair/svelte 3.1.6 → 3.1.7
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/list/PaginatedTable.svelte +8 -2
- package/dist/components/composed/list/PaginatedTable.svelte.d.ts +9 -14
- package/dist/components/composed/search/Filters.svelte +9 -1
- package/dist/components/simple/charts/GanymedeBarChart.svelte +142 -0
- package/dist/components/simple/charts/GanymedeBarChart.svelte.d.ts +36 -0
- package/dist/components/simple/lists/SimpleTable.svelte +15 -8
- package/dist/components/simple/lists/SimpleTable.svelte.d.ts +16 -15
- package/dist/utils/filters/builder.d.ts +3 -0
- package/dist/utils/filters/builder.js +16 -0
- package/dist/utils/filters/filters.js +4 -4
- package/dist/utils/filters/modifiers/where.d.ts +9 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script context="module">import SimpleTable from "../../simple/lists/SimpleTable.svelte";
|
|
1
|
+
<script context="module">import SimpleTable, {} from "../../simple/lists/SimpleTable.svelte";
|
|
2
2
|
import Icon from "../../simple/media/Icon.svelte";
|
|
3
3
|
import Paginator from "../../simple/lists/Paginator.svelte";
|
|
4
4
|
import Dropdown from "../forms/Dropdown.svelte";
|
|
@@ -14,7 +14,9 @@ export let headers = [], items = [], sortedBy = void 0, sortDirection = void 0,
|
|
|
14
14
|
{ label: "20", value: 20 },
|
|
15
15
|
{ label: "50", value: 50 },
|
|
16
16
|
{ label: "100", value: 100 }
|
|
17
|
-
], hideRowsPerPage = false, totalElements = void 0, rowsPerPage = 20, filters = [], searchBarColumns = void 0, searchBarVisible = true, searchBarPlaceholder = "Type something to search...", lang = "en", editFilterMode = "one-edit";
|
|
17
|
+
], hideRowsPerPage = false, totalElements = void 0, rowsPerPage = 20, filters = [], searchBarColumns = void 0, searchBarVisible = true, searchBarPlaceholder = "Type something to search...", lang = "en", editFilterMode = "one-edit", showActiveFilters = true;
|
|
18
|
+
export let calculateRowStyles = void 0;
|
|
19
|
+
export let calculateRowClasses = void 0;
|
|
18
20
|
let searchBarInput, searchText = void 0;
|
|
19
21
|
let dispatch = createEventDispatcher();
|
|
20
22
|
let rowsPerPageSelection = [];
|
|
@@ -78,9 +80,11 @@ function handleFiltersChange() {
|
|
|
78
80
|
bind:filters
|
|
79
81
|
on:applyFilter={handleFiltersChange}
|
|
80
82
|
on:removeFilter={handleFiltersChange}
|
|
83
|
+
on:removeAllFilters={handleFiltersChange}
|
|
81
84
|
--filters-default-wrapper-width="100%"
|
|
82
85
|
{lang}
|
|
83
86
|
{editFilterMode}
|
|
87
|
+
{showActiveFilters}
|
|
84
88
|
>
|
|
85
89
|
<svelte:fragment slot="append">
|
|
86
90
|
<slot name="filter-append"></slot>
|
|
@@ -101,6 +105,8 @@ function handleFiltersChange() {
|
|
|
101
105
|
bind:sortDirection
|
|
102
106
|
on:sort
|
|
103
107
|
on:rowClick
|
|
108
|
+
{calculateRowStyles}
|
|
109
|
+
{calculateRowClasses}
|
|
104
110
|
>
|
|
105
111
|
<svelte:fragment slot="header" let:head>
|
|
106
112
|
<slot name="header" {head} >
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import SimpleTable from "../../simple/lists/SimpleTable.svelte";
|
|
2
|
+
import SimpleTable, { type CalculateRowClasses, type CalculateRowStyles } from "../../simple/lists/SimpleTable.svelte";
|
|
3
3
|
import Paginator from "../../simple/lists/Paginator.svelte";
|
|
4
4
|
import Dropdown from "../forms/Dropdown.svelte";
|
|
5
5
|
import { type ComponentProps } from "svelte";
|
|
6
6
|
type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
|
|
7
|
-
export type Header = ArrayElement<NonNullable<ComponentProps<SimpleTable>[
|
|
7
|
+
export type Header = ArrayElement<NonNullable<ComponentProps<SimpleTable>["headers"]>>;
|
|
8
8
|
import Filters from "../search/Filters.svelte";
|
|
9
9
|
declare const __propDef: {
|
|
10
10
|
props: {
|
|
@@ -27,6 +27,9 @@ declare const __propDef: {
|
|
|
27
27
|
searchBarPlaceholder?: string | undefined;
|
|
28
28
|
lang?: "it" | "en" | undefined;
|
|
29
29
|
editFilterMode?: "one-edit" | "multi-edit" | undefined;
|
|
30
|
+
showActiveFilters?: boolean | undefined;
|
|
31
|
+
calculateRowStyles?: CalculateRowStyles | undefined;
|
|
32
|
+
calculateRowClasses?: CalculateRowClasses | undefined;
|
|
30
33
|
};
|
|
31
34
|
events: {
|
|
32
35
|
sort: CustomEvent<{
|
|
@@ -34,9 +37,7 @@ declare const __propDef: {
|
|
|
34
37
|
sortDirection: string;
|
|
35
38
|
}>;
|
|
36
39
|
rowClick: CustomEvent<{
|
|
37
|
-
item:
|
|
38
|
-
[key: string]: any;
|
|
39
|
-
};
|
|
40
|
+
item: import("../../simple/lists/SimpleTable.svelte").Item;
|
|
40
41
|
}>;
|
|
41
42
|
} & {
|
|
42
43
|
[evt: string]: CustomEvent<any>;
|
|
@@ -62,21 +63,15 @@ declare const __propDef: {
|
|
|
62
63
|
index: any;
|
|
63
64
|
columnIndex: any;
|
|
64
65
|
header: import("../../simple/lists/SimpleTable.svelte").Header;
|
|
65
|
-
item:
|
|
66
|
-
[key: string]: any;
|
|
67
|
-
};
|
|
66
|
+
item: import("../../simple/lists/SimpleTable.svelte").Item;
|
|
68
67
|
};
|
|
69
68
|
rowActions: {
|
|
70
69
|
index: any;
|
|
71
|
-
item:
|
|
72
|
-
[key: string]: any;
|
|
73
|
-
};
|
|
70
|
+
item: import("../../simple/lists/SimpleTable.svelte").Item;
|
|
74
71
|
};
|
|
75
72
|
append: {
|
|
76
73
|
index: any;
|
|
77
|
-
item:
|
|
78
|
-
[key: string]: any;
|
|
79
|
-
};
|
|
74
|
+
item: import("../../simple/lists/SimpleTable.svelte").Item;
|
|
80
75
|
};
|
|
81
76
|
footer: {
|
|
82
77
|
hideRowsPerPage: boolean;
|
|
@@ -681,7 +681,7 @@ let moreItemsActivator;
|
|
|
681
681
|
<slot name="content" {mAndDown} {updateMultiFilterValues} {filters}>
|
|
682
682
|
<div class="multi-filters-container" style:grid-template-columns={mAndDown ? '1fr' : '1fr 1fr'}>
|
|
683
683
|
{#each filters as filter, i}
|
|
684
|
-
<div class="filter"
|
|
684
|
+
<div class="filter" class:wide={filter.type === 'select' || filter.type === 'custom'}>
|
|
685
685
|
<div class="input">
|
|
686
686
|
{#if !filter.advanced && filter.type !== 'custom'}
|
|
687
687
|
<div class="label">
|
|
@@ -909,4 +909,12 @@ let moreItemsActivator;
|
|
|
909
909
|
margin-right: 20px;
|
|
910
910
|
}
|
|
911
911
|
|
|
912
|
+
.multi-filters-container .filter {
|
|
913
|
+
grid-column: auto;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
.multi-filters-container .filter.wide {
|
|
917
|
+
grid-column: span 2;
|
|
918
|
+
}
|
|
919
|
+
|
|
912
920
|
</style>
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<script>import { Bar } from "svelte-chartjs";
|
|
2
|
+
import { theme } from "../../..";
|
|
3
|
+
import {
|
|
4
|
+
Chart as ChartJS,
|
|
5
|
+
Title,
|
|
6
|
+
Tooltip,
|
|
7
|
+
Legend,
|
|
8
|
+
LineElement,
|
|
9
|
+
LinearScale,
|
|
10
|
+
PointElement,
|
|
11
|
+
CategoryScale,
|
|
12
|
+
BarElement
|
|
13
|
+
} from "chart.js";
|
|
14
|
+
import { onMount } from "svelte";
|
|
15
|
+
ChartJS.register(
|
|
16
|
+
Title,
|
|
17
|
+
Tooltip,
|
|
18
|
+
Legend,
|
|
19
|
+
LineElement,
|
|
20
|
+
BarElement,
|
|
21
|
+
LinearScale,
|
|
22
|
+
PointElement,
|
|
23
|
+
CategoryScale
|
|
24
|
+
);
|
|
25
|
+
export let data = {
|
|
26
|
+
labels: [],
|
|
27
|
+
datasets: []
|
|
28
|
+
}, horizontal = false, responsive = true, maintainAspectRatio = true, showLegend = true, showYTicks = false, showXTicks = false, displayYGrid = true, lineWidth = 1, enableZoom = true, resetZoom = false;
|
|
29
|
+
let mounted = false, zoomMounted = false;
|
|
30
|
+
onMount(() => {
|
|
31
|
+
mounted = true;
|
|
32
|
+
});
|
|
33
|
+
let rgbTooltipColor = void 0;
|
|
34
|
+
let rgbTooltipBackgroundColor = void 0;
|
|
35
|
+
let rgbBackgroundColor = void 0;
|
|
36
|
+
$:
|
|
37
|
+
rgbTooltipColor = $theme.colors?.[$theme.active]["dark"]["primary"]["300"];
|
|
38
|
+
$:
|
|
39
|
+
rgbTooltipBackgroundColor = $theme.colors?.[$theme.active]["dark"]["primary"]["900"];
|
|
40
|
+
$:
|
|
41
|
+
rgbBackgroundColor = $theme.colors?.[$theme.active]["dark"]["background"]["200"];
|
|
42
|
+
$:
|
|
43
|
+
finalTooltipColor = !!rgbTooltipColor ? `rgb(${rgbTooltipColor}, .8)` : void 0;
|
|
44
|
+
$:
|
|
45
|
+
finalTooltipBackgroundColor = !!rgbTooltipBackgroundColor ? `rgb(${rgbTooltipBackgroundColor})` : void 0;
|
|
46
|
+
$:
|
|
47
|
+
finalBackgroundColor = !!rgbBackgroundColor ? `rgb(${rgbBackgroundColor}, .3)` : void 0;
|
|
48
|
+
let chart;
|
|
49
|
+
$:
|
|
50
|
+
if (!!chart && !!enableZoom && !!resetZoom) {
|
|
51
|
+
chart.resetZoom();
|
|
52
|
+
resetZoom = false;
|
|
53
|
+
}
|
|
54
|
+
$:
|
|
55
|
+
if (enableZoom && mounted) {
|
|
56
|
+
import("chartjs-plugin-zoom").then(({ default: zoomPlugin }) => {
|
|
57
|
+
ChartJS.register(zoomPlugin);
|
|
58
|
+
zoomMounted = true;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
let chartOptions;
|
|
62
|
+
$:
|
|
63
|
+
chartOptions = {
|
|
64
|
+
barPercentage: 0.9,
|
|
65
|
+
borderRadius: 2,
|
|
66
|
+
categoryPercentage: 0.3,
|
|
67
|
+
indexAxis: horizontal ? "y" : "x",
|
|
68
|
+
responsive,
|
|
69
|
+
maintainAspectRatio,
|
|
70
|
+
plugins: {
|
|
71
|
+
tooltip: {
|
|
72
|
+
displayColors: false,
|
|
73
|
+
titleColor: finalTooltipColor,
|
|
74
|
+
backgroundColor: finalTooltipBackgroundColor,
|
|
75
|
+
titleFont: {
|
|
76
|
+
size: 14
|
|
77
|
+
},
|
|
78
|
+
bodyFont: {
|
|
79
|
+
size: 14,
|
|
80
|
+
weight: "bold"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
legend: {
|
|
84
|
+
display: showLegend
|
|
85
|
+
},
|
|
86
|
+
zoom: {
|
|
87
|
+
pan: {
|
|
88
|
+
enabled: true,
|
|
89
|
+
mode: "x",
|
|
90
|
+
modifierKey: "ctrl"
|
|
91
|
+
},
|
|
92
|
+
zoom: {
|
|
93
|
+
drag: {
|
|
94
|
+
enabled: true
|
|
95
|
+
},
|
|
96
|
+
mode: "x"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
interaction: {
|
|
101
|
+
intersect: false
|
|
102
|
+
},
|
|
103
|
+
scales: {
|
|
104
|
+
x: {
|
|
105
|
+
display: true,
|
|
106
|
+
title: {
|
|
107
|
+
display: true
|
|
108
|
+
},
|
|
109
|
+
grid: {
|
|
110
|
+
display: false
|
|
111
|
+
},
|
|
112
|
+
border: {
|
|
113
|
+
display: false
|
|
114
|
+
},
|
|
115
|
+
ticks: {
|
|
116
|
+
display: showYTicks
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
y: {
|
|
120
|
+
display: displayYGrid,
|
|
121
|
+
title: {},
|
|
122
|
+
grid: {
|
|
123
|
+
lineWidth,
|
|
124
|
+
color: finalBackgroundColor
|
|
125
|
+
},
|
|
126
|
+
border: {
|
|
127
|
+
dash: [10, 10],
|
|
128
|
+
display: false
|
|
129
|
+
},
|
|
130
|
+
ticks: {
|
|
131
|
+
display: showXTicks
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
</script>
|
|
137
|
+
|
|
138
|
+
<Bar
|
|
139
|
+
bind:data={data}
|
|
140
|
+
options={chartOptions}
|
|
141
|
+
bind:chart={chart}
|
|
142
|
+
></Bar>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
data?: {
|
|
5
|
+
labels: string[];
|
|
6
|
+
datasets: {
|
|
7
|
+
label: string;
|
|
8
|
+
data: number[];
|
|
9
|
+
backgroundColor?: string | undefined;
|
|
10
|
+
borderColor?: string | undefined;
|
|
11
|
+
hoverBackgroundColor?: string[] | undefined;
|
|
12
|
+
tension?: number | undefined;
|
|
13
|
+
}[];
|
|
14
|
+
} | undefined;
|
|
15
|
+
horizontal?: boolean | undefined;
|
|
16
|
+
responsive?: boolean | undefined;
|
|
17
|
+
maintainAspectRatio?: boolean | undefined;
|
|
18
|
+
showLegend?: boolean | undefined;
|
|
19
|
+
showYTicks?: boolean | undefined;
|
|
20
|
+
showXTicks?: boolean | undefined;
|
|
21
|
+
displayYGrid?: boolean | undefined;
|
|
22
|
+
lineWidth?: number | undefined;
|
|
23
|
+
enableZoom?: boolean | undefined;
|
|
24
|
+
resetZoom?: boolean | undefined;
|
|
25
|
+
};
|
|
26
|
+
events: {
|
|
27
|
+
[evt: string]: CustomEvent<any>;
|
|
28
|
+
};
|
|
29
|
+
slots: {};
|
|
30
|
+
};
|
|
31
|
+
export type GanymedeBarChartProps = typeof __propDef.props;
|
|
32
|
+
export type GanymedeBarChartEvents = typeof __propDef.events;
|
|
33
|
+
export type GanymedeBarChartSlots = typeof __propDef.slots;
|
|
34
|
+
export default class GanymedeBarChart extends SvelteComponent<GanymedeBarChartProps, GanymedeBarChartEvents, GanymedeBarChartSlots> {
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -8,6 +8,8 @@ let clazz = {};
|
|
|
8
8
|
export { clazz as class };
|
|
9
9
|
const dispatch = createEventDispatcher();
|
|
10
10
|
export let headers = [], items = [], sortedBy = void 0, sortDirection = "asc";
|
|
11
|
+
export let calculateRowStyles = void 0;
|
|
12
|
+
export let calculateRowClasses = void 0;
|
|
11
13
|
function handleHeaderClick(header) {
|
|
12
14
|
if (!!sortedBy && header.value == sortedBy) {
|
|
13
15
|
if (sortDirection == "asc")
|
|
@@ -35,7 +37,7 @@ function formatDate(dateTime, dateFormat) {
|
|
|
35
37
|
</script>
|
|
36
38
|
|
|
37
39
|
{#if !!items && Array.isArray(items)}
|
|
38
|
-
<div class="simple-table-container {clazz.container || ''}"
|
|
40
|
+
<div class="simple-table-container {clazz.container || ''}">
|
|
39
41
|
<table class="table">
|
|
40
42
|
<thead class="thead {clazz.header || ''}">
|
|
41
43
|
<tr>
|
|
@@ -78,9 +80,14 @@ function formatDate(dateTime, dateFormat) {
|
|
|
78
80
|
</thead>
|
|
79
81
|
<tbody>
|
|
80
82
|
{#each items as item, i}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
{@const styles = !!calculateRowStyles ? calculateRowStyles(item) : {}}
|
|
84
|
+
{@const classes = !!calculateRowClasses ? calculateRowClasses(item) : ""}
|
|
85
|
+
<tr
|
|
86
|
+
class="item-tr {clazz.row || ''} {classes}"
|
|
83
87
|
on:click={() => handleRowClick(item)}
|
|
88
|
+
style:background-color={styles.backgroundColor}
|
|
89
|
+
style:color={styles.color}
|
|
90
|
+
style:font-weight={styles.fontWeight}
|
|
84
91
|
>
|
|
85
92
|
{#each headers as header, j}
|
|
86
93
|
<td class="{clazz.cell || ''}">
|
|
@@ -95,11 +102,11 @@ function formatDate(dateTime, dateFormat) {
|
|
|
95
102
|
{:else if header.type.key == "date"}
|
|
96
103
|
{formatDate(item[header.value], header.type.params)}
|
|
97
104
|
{:else if header.type.key == "icon"}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
<Icon
|
|
106
|
+
--icon-color={header.type.params?.color}
|
|
107
|
+
--icon-size={header.type.params?.size}
|
|
108
|
+
name={header.type.params?.name || ""}
|
|
109
|
+
/>
|
|
103
110
|
{:else if header.type.key == 'string'}
|
|
104
111
|
{#if item[header.value] !== undefined && item[header.value] !== null}
|
|
105
112
|
{item[header.value]}
|
|
@@ -11,6 +11,15 @@ export type Header = {
|
|
|
11
11
|
[key: string]: any;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
+
export interface Item {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
export type CalculateRowStyles = (item: Item) => {
|
|
18
|
+
backgroundColor?: string;
|
|
19
|
+
color?: string;
|
|
20
|
+
fontWeight?: string;
|
|
21
|
+
};
|
|
22
|
+
export type CalculateRowClasses = (item: Item) => string | undefined;
|
|
14
23
|
import '../../../css/main.css';
|
|
15
24
|
import './SimpleTable.css';
|
|
16
25
|
import type { ColumnBoolean, ColumnCheckBox, ColumnCustom, ColumnDate, ColumnIcon, ColumnNumber, ColumnString } from './columnTypes';
|
|
@@ -23,11 +32,11 @@ declare const __propDef: {
|
|
|
23
32
|
cell?: string | undefined;
|
|
24
33
|
} | undefined;
|
|
25
34
|
headers?: Header[] | undefined;
|
|
26
|
-
items?:
|
|
27
|
-
[key: string]: any;
|
|
28
|
-
}[] | undefined;
|
|
35
|
+
items?: Item[] | undefined;
|
|
29
36
|
sortedBy?: string | undefined;
|
|
30
37
|
sortDirection?: "desc" | "asc" | undefined;
|
|
38
|
+
calculateRowStyles?: CalculateRowStyles | undefined;
|
|
39
|
+
calculateRowClasses?: CalculateRowClasses | undefined;
|
|
31
40
|
};
|
|
32
41
|
events: {
|
|
33
42
|
sort: CustomEvent<{
|
|
@@ -35,9 +44,7 @@ declare const __propDef: {
|
|
|
35
44
|
sortDirection: string;
|
|
36
45
|
}>;
|
|
37
46
|
rowClick: CustomEvent<{
|
|
38
|
-
item:
|
|
39
|
-
[key: string]: any;
|
|
40
|
-
};
|
|
47
|
+
item: Item;
|
|
41
48
|
}>;
|
|
42
49
|
} & {
|
|
43
50
|
[evt: string]: CustomEvent<any>;
|
|
@@ -49,23 +56,17 @@ declare const __propDef: {
|
|
|
49
56
|
headerLabel: {};
|
|
50
57
|
append: {
|
|
51
58
|
index: any;
|
|
52
|
-
item:
|
|
53
|
-
[key: string]: any;
|
|
54
|
-
};
|
|
59
|
+
item: Item;
|
|
55
60
|
};
|
|
56
61
|
custom: {
|
|
57
62
|
index: any;
|
|
58
63
|
columnIndex: any;
|
|
59
64
|
header: Header;
|
|
60
|
-
item:
|
|
61
|
-
[key: string]: any;
|
|
62
|
-
};
|
|
65
|
+
item: Item;
|
|
63
66
|
};
|
|
64
67
|
rowActions: {
|
|
65
68
|
index: any;
|
|
66
|
-
item:
|
|
67
|
-
[key: string]: any;
|
|
68
|
-
};
|
|
69
|
+
item: Item;
|
|
69
70
|
};
|
|
70
71
|
};
|
|
71
72
|
};
|
|
@@ -27,8 +27,11 @@ export default class Builder {
|
|
|
27
27
|
whereColumn(key: string, operator: string, compareColumn: string): Builder;
|
|
28
28
|
orWhereColumn(key: string, compareColumn: string): Builder;
|
|
29
29
|
orWhereColumn(key: string, operator: string, compareColumn: string): Builder;
|
|
30
|
+
whereJsonSuperset(key: string, object: Object): Builder;
|
|
31
|
+
orWhereJsonSuperset(key: string, object: Object): Builder;
|
|
30
32
|
private applyWhereClause;
|
|
31
33
|
private applyWhereColumnClause;
|
|
34
|
+
private applyWhereJsonSupersetClause;
|
|
32
35
|
join(table: string, onCallback: (onBuilder: OnClauseBuilder) => void): this;
|
|
33
36
|
leftJoin(table: string, onCallback: (onBuilder: OnClauseBuilder) => void): this;
|
|
34
37
|
rightJoin(table: string, onCallback: (onBuilder: OnClauseBuilder) => void): this;
|
|
@@ -21,6 +21,12 @@ export default class Builder {
|
|
|
21
21
|
orWhereColumn(first, second, third) {
|
|
22
22
|
return this.applyWhereColumnClause('or', first, second, third);
|
|
23
23
|
}
|
|
24
|
+
whereJsonSuperset(first, second) {
|
|
25
|
+
return this.applyWhereJsonSupersetClause('and', first, second);
|
|
26
|
+
}
|
|
27
|
+
orWhereJsonSuperset(first, second) {
|
|
28
|
+
return this.applyWhereJsonSupersetClause('or', first, second);
|
|
29
|
+
}
|
|
24
30
|
applyWhereClause(logicalOperator, first, second, third) {
|
|
25
31
|
if (third !== undefined) {
|
|
26
32
|
if (!!second && typeof first == 'string' && typeof second == 'string') {
|
|
@@ -87,6 +93,16 @@ export default class Builder {
|
|
|
87
93
|
}
|
|
88
94
|
return this;
|
|
89
95
|
}
|
|
96
|
+
applyWhereJsonSupersetClause(logicalOperator, first, second) {
|
|
97
|
+
this.modifiers.push({
|
|
98
|
+
method: 'where',
|
|
99
|
+
kind: 'jsonSuperset',
|
|
100
|
+
key: first,
|
|
101
|
+
value: second,
|
|
102
|
+
logicalOperator: logicalOperator
|
|
103
|
+
});
|
|
104
|
+
return this;
|
|
105
|
+
}
|
|
90
106
|
join(table, onCallback) {
|
|
91
107
|
let onBuilder = new OnClauseBuilder();
|
|
92
108
|
onCallback(onBuilder);
|
|
@@ -72,10 +72,10 @@ export default class Converter {
|
|
|
72
72
|
}
|
|
73
73
|
else if (params.filter.mode == 'between') {
|
|
74
74
|
if (!!params.filter.from) {
|
|
75
|
-
params.builder.where(params.filter.column, '
|
|
75
|
+
params.builder.where(params.filter.column, '>=', params.filter.from);
|
|
76
76
|
}
|
|
77
77
|
if (!!params.filter.to) {
|
|
78
|
-
params.builder.where(params.filter.column, '
|
|
78
|
+
params.builder.where(params.filter.column, '<=', params.filter.to);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
return params.builder;
|
|
@@ -92,10 +92,10 @@ export default class Converter {
|
|
|
92
92
|
}
|
|
93
93
|
else if (params.filter.mode == 'between') {
|
|
94
94
|
if (!!params.filter.from) {
|
|
95
|
-
params.builder.where(params.filter.column, '
|
|
95
|
+
params.builder.where(params.filter.column, '>=', params.filter.from);
|
|
96
96
|
}
|
|
97
97
|
if (!!params.filter.to) {
|
|
98
|
-
params.builder.where(params.filter.column, '
|
|
98
|
+
params.builder.where(params.filter.column, '<=', params.filter.to);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
return params.builder;
|
|
@@ -3,7 +3,7 @@ type GroupedWhere = {
|
|
|
3
3
|
method: 'where';
|
|
4
4
|
kind: 'grouped';
|
|
5
5
|
logicalOperator?: 'and' | 'or' | 'andNot' | 'orNot';
|
|
6
|
-
children: (ObjectWhere | SimpleWhere | GroupedWhere | InWhere | ColumnWhere)[];
|
|
6
|
+
children: (ObjectWhere | SimpleWhere | GroupedWhere | InWhere | ColumnWhere | WhereJsonSuperset)[];
|
|
7
7
|
};
|
|
8
8
|
type ObjectWhere = {
|
|
9
9
|
method: 'where';
|
|
@@ -34,5 +34,12 @@ type InWhere = {
|
|
|
34
34
|
key: string;
|
|
35
35
|
value: (WhereFilterValue)[];
|
|
36
36
|
};
|
|
37
|
-
|
|
37
|
+
type WhereJsonSuperset = {
|
|
38
|
+
method: 'where';
|
|
39
|
+
kind: 'jsonSuperset';
|
|
40
|
+
logicalOperator?: 'and' | 'or' | 'andNot' | 'orNot';
|
|
41
|
+
key: string;
|
|
42
|
+
value: Object;
|
|
43
|
+
};
|
|
44
|
+
export type WhereModifier = SimpleWhere | ObjectWhere | GroupedWhere | InWhere | ColumnWhere | WhereJsonSuperset;
|
|
38
45
|
export {};
|