@likable-hair/svelte 3.2.1 → 3.2.3
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/search/FilterEditor.svelte +15 -0
- package/dist/components/composed/search/FilterEditor.svelte.d.ts +1 -0
- package/dist/components/simple/forms/RadioButton.css +10 -0
- package/dist/components/simple/forms/RadioButton.svelte +101 -0
- package/dist/components/simple/forms/RadioButton.svelte.d.ts +31 -0
- package/dist/components/simple/lists/SimpleTable.svelte +0 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ import Autocomplete from "../../simple/forms/Autocomplete.svelte";
|
|
|
7
7
|
import Checkbox from "../../simple/forms/Checkbox.svelte";
|
|
8
8
|
import Icon from "../../simple/media/Icon.svelte";
|
|
9
9
|
import ToggleList from "../forms/ToggleList.svelte";
|
|
10
|
+
import { createEventDispatcher } from "svelte";
|
|
10
11
|
export let filter = void 0, lang = "en", betweenFromLabel = lang == "en" ? "From" : "Da", betweenToLabel = lang == "en" ? "To" : "A", labelsMapper, forceApplyValid = false, editFilterMode = "one-edit", tmpFilter = void 0, mobile = false;
|
|
11
12
|
let advancedModeOptions, advancedModeSelectedOptions;
|
|
12
13
|
function initTmpFilter() {
|
|
@@ -69,6 +70,7 @@ function handleAdvancedModeSelection() {
|
|
|
69
70
|
tmpFilter.mode = advancedModeSelectedOptions[0].value;
|
|
70
71
|
}
|
|
71
72
|
dropdownOpened = false;
|
|
73
|
+
handleChangeValue();
|
|
72
74
|
}
|
|
73
75
|
$:
|
|
74
76
|
applyFilterDisabled = !Validator.isValid(tmpFilter) && !forceApplyValid;
|
|
@@ -84,6 +86,10 @@ $:
|
|
|
84
86
|
tmpFilter.values = [];
|
|
85
87
|
}
|
|
86
88
|
}
|
|
89
|
+
const dispatch = createEventDispatcher();
|
|
90
|
+
function handleChangeValue() {
|
|
91
|
+
dispatch("change", tmpFilter);
|
|
92
|
+
}
|
|
87
93
|
</script>
|
|
88
94
|
|
|
89
95
|
|
|
@@ -115,6 +121,7 @@ $:
|
|
|
115
121
|
type="text"
|
|
116
122
|
placeholder={editFilterMode == 'one-edit' ? tmpFilter?.label : undefined}
|
|
117
123
|
--simple-textfield-width="100%"
|
|
124
|
+
on:change={handleChangeValue}
|
|
118
125
|
></SimpleTextField>
|
|
119
126
|
{:else if tmpFilter.type === "date" && tmpFilter.mode !== 'between'}
|
|
120
127
|
<div>
|
|
@@ -125,6 +132,7 @@ $:
|
|
|
125
132
|
on:day-click={() => {calendarOpened = false}}
|
|
126
133
|
--simple-textfield-width="100%"
|
|
127
134
|
flipOnOverflow
|
|
135
|
+
on:change={handleChangeValue}
|
|
128
136
|
>
|
|
129
137
|
<svelte:fragment slot="append-inner">
|
|
130
138
|
<Icon
|
|
@@ -146,6 +154,7 @@ $:
|
|
|
146
154
|
type="number"
|
|
147
155
|
placeholder={editFilterMode == 'one-edit' ? tmpFilter?.label : undefined}
|
|
148
156
|
--simple-textfield-width="100%"
|
|
157
|
+
on:change={handleChangeValue}
|
|
149
158
|
></SimpleTextField>
|
|
150
159
|
</div>
|
|
151
160
|
{:else if tmpFilter.type === "select" && (tmpFilter.view === undefined || tmpFilter.view === 'autocomplete')}
|
|
@@ -160,6 +169,7 @@ $:
|
|
|
160
169
|
--simple-textfield-width="0px"
|
|
161
170
|
--simple-text-field-margin-left="0px"
|
|
162
171
|
mobileDrawer={mobile}
|
|
172
|
+
on:change={handleChangeValue}
|
|
163
173
|
></Autocomplete>
|
|
164
174
|
</div>
|
|
165
175
|
{:else if tmpFilter.type === "select" && (tmpFilter.view === 'toggle')}
|
|
@@ -181,6 +191,7 @@ $:
|
|
|
181
191
|
bind:menuOpened={calendarOpened}
|
|
182
192
|
on:day-click={() => {calendarOpened = false}}
|
|
183
193
|
--simple-textfield-width="100%"
|
|
194
|
+
on:change={handleChangeValue}
|
|
184
195
|
>
|
|
185
196
|
<svelte:fragment slot="append-inner">
|
|
186
197
|
<Icon
|
|
@@ -204,6 +215,7 @@ $:
|
|
|
204
215
|
on:day-click={() => {calendarOpened2 = false}}
|
|
205
216
|
--simple-textfield-width="100%"
|
|
206
217
|
flipOnOverflow
|
|
218
|
+
on:change={handleChangeValue}
|
|
207
219
|
>
|
|
208
220
|
<svelte:fragment slot="append-inner">
|
|
209
221
|
<Icon
|
|
@@ -225,6 +237,7 @@ $:
|
|
|
225
237
|
type="number"
|
|
226
238
|
placeholder={betweenFromLabel}
|
|
227
239
|
--simple-textfield-width="100%"
|
|
240
|
+
on:change={handleChangeValue}
|
|
228
241
|
></SimpleTextField>
|
|
229
242
|
</div>
|
|
230
243
|
<div>
|
|
@@ -233,12 +246,14 @@ $:
|
|
|
233
246
|
type="number"
|
|
234
247
|
placeholder={betweenToLabel}
|
|
235
248
|
--simple-textfield-width="100%"
|
|
249
|
+
on:change={handleChangeValue}
|
|
236
250
|
></SimpleTextField>
|
|
237
251
|
</div>
|
|
238
252
|
{:else if tmpFilter.type == 'bool'}
|
|
239
253
|
<div class="bool-filter">
|
|
240
254
|
<Checkbox
|
|
241
255
|
bind:value={tmpFilter.value}
|
|
256
|
+
on:change={handleChangeValue}
|
|
242
257
|
></Checkbox>
|
|
243
258
|
<span style:margin-left="10px">
|
|
244
259
|
{tmpFilter.description}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--radio-button-default-active-color: rgb(var(--global-color-primary-500));
|
|
3
|
+
--radio-button-default-active-inner-color: rgb(var(--global-color-grey-50));
|
|
4
|
+
--radio-button-default-focus-shadow: 2px rgb(var(--global-color-primary-500), .3);
|
|
5
|
+
--radio-button-default-border-color: rgb(var(--global-color-contrast-300), .2);
|
|
6
|
+
--radio-button-default-border-hover-color: rgb(var(--global-color-primary-500));
|
|
7
|
+
--radio-button-default-background-color: rgb(var(--global-color-background-200));
|
|
8
|
+
--radio-button-default-disabled-color: rgb(var(--global-color-background-200), .5);
|
|
9
|
+
--radio-button-default-disabled-active-color: rgb(var(--global-color-primary-400));
|
|
10
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<script>import "./RadioButton.css";
|
|
2
|
+
import "../../../css/main.css";
|
|
3
|
+
export let name, value, id = void 0, checked = false, label = void 0, disabled = false;
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<input
|
|
7
|
+
type="radio"
|
|
8
|
+
{name}
|
|
9
|
+
{value}
|
|
10
|
+
{id}
|
|
11
|
+
{disabled}
|
|
12
|
+
{checked}
|
|
13
|
+
on:change
|
|
14
|
+
on:input
|
|
15
|
+
on:focus
|
|
16
|
+
on:blur
|
|
17
|
+
on:keydown
|
|
18
|
+
on:keypress
|
|
19
|
+
on:keyup
|
|
20
|
+
/>
|
|
21
|
+
{#if label}
|
|
22
|
+
<label for={id}>
|
|
23
|
+
{label}
|
|
24
|
+
</label>
|
|
25
|
+
{/if}
|
|
26
|
+
|
|
27
|
+
<style>
|
|
28
|
+
@supports (-webkit-appearance: none) or (-moz-appearance: none) {
|
|
29
|
+
input[type="radio"] {
|
|
30
|
+
-webkit-appearance: none;
|
|
31
|
+
-moz-appearance: none;
|
|
32
|
+
height: 21px;
|
|
33
|
+
width: 21px;
|
|
34
|
+
outline: none;
|
|
35
|
+
display: inline-block;
|
|
36
|
+
vertical-align: top;
|
|
37
|
+
position: relative;
|
|
38
|
+
margin: 0;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
border: 1px solid var(--bc, var(--radio-button-border-color, var(--radio-button-default-border-color)));
|
|
42
|
+
background: var(--b, var(--radio-button-background-color, var(--radio-button-default-background-color)));
|
|
43
|
+
transition: background 0.3s, border-color 0.3s, box-shadow 0.2s;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
input[type="radio"]:after {
|
|
47
|
+
content: "";
|
|
48
|
+
display: block;
|
|
49
|
+
position: absolute;
|
|
50
|
+
width: 19px;
|
|
51
|
+
height: 19px;
|
|
52
|
+
border-radius: 50%;
|
|
53
|
+
background: var(--radio-button-active-inner-color, var(--radio-button-default-active-inner-color));
|
|
54
|
+
opacity: var(--o, 0);
|
|
55
|
+
transform: scale(var(--s, 0.7));
|
|
56
|
+
transition: transform 0.3s ease, opacity 0.2s;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
input[type="radio"]:checked:not(:disabled) {
|
|
60
|
+
--b: var(--radio-button-active-color, var(--radio-button-default-active-color));
|
|
61
|
+
--bc: var(--radio-button-active-color, var(--radio-button-default-active-color));
|
|
62
|
+
--o: 1;
|
|
63
|
+
--s: 0.5;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
input[type="radio"]:disabled {
|
|
67
|
+
--b: var(--radio-button-disabled-color, var(--radio-button-default-disabled-color));
|
|
68
|
+
--bc: var(--radio-button-disabled-active-color, var(--radio-button-default-disabled-active-color));
|
|
69
|
+
cursor: not-allowed;
|
|
70
|
+
opacity: 0.9;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
input[type="radio"]:disabled:checked {
|
|
74
|
+
--b: var(--radio-button-disabled-active-color, var(--radio-button-default-disabled-active-color));
|
|
75
|
+
--bc: var(--radio-button-border-color, var(--radio-button-default-border-color));
|
|
76
|
+
--o: 1;
|
|
77
|
+
--s: 0.5;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
input[type="radio"]:hover:not(:checked):not(:disabled) {
|
|
81
|
+
--bc: var(--radio-button-border-hover-color, var(--radio-button-default-border-hover-color));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
input[type="radio"]:focus {
|
|
85
|
+
box-shadow: 0 0 0 var(--radio-button-focus-shadow, var(--radio-button-default-focus-shadow));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
input[type="radio"] + label {
|
|
89
|
+
font-size: 14px;
|
|
90
|
+
line-height: 21px;
|
|
91
|
+
display: inline-block;
|
|
92
|
+
vertical-align: top;
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
margin-left: 4px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
input[type="radio"]:disabled + label {
|
|
98
|
+
cursor: not-allowed;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
</style>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import './RadioButton.css';
|
|
3
|
+
import "../../../css/main.css";
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
name: string;
|
|
7
|
+
value: string;
|
|
8
|
+
id?: string | undefined;
|
|
9
|
+
checked?: boolean | undefined;
|
|
10
|
+
label?: string | undefined;
|
|
11
|
+
disabled?: boolean | undefined;
|
|
12
|
+
};
|
|
13
|
+
events: {
|
|
14
|
+
change: Event;
|
|
15
|
+
input: Event;
|
|
16
|
+
focus: FocusEvent;
|
|
17
|
+
blur: FocusEvent;
|
|
18
|
+
keydown: KeyboardEvent;
|
|
19
|
+
keypress: KeyboardEvent;
|
|
20
|
+
keyup: KeyboardEvent;
|
|
21
|
+
} & {
|
|
22
|
+
[evt: string]: CustomEvent<any>;
|
|
23
|
+
};
|
|
24
|
+
slots: {};
|
|
25
|
+
};
|
|
26
|
+
export type RadioButtonProps = typeof __propDef.props;
|
|
27
|
+
export type RadioButtonEvents = typeof __propDef.events;
|
|
28
|
+
export type RadioButtonSlots = typeof __propDef.slots;
|
|
29
|
+
export default class RadioButton extends SvelteComponent<RadioButtonProps, RadioButtonEvents, RadioButtonSlots> {
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -39,7 +39,6 @@ onMount(() => {
|
|
|
39
39
|
if (!!th) {
|
|
40
40
|
let { paddingLeft, paddingRight } = getComputedStyle(th);
|
|
41
41
|
let width = resizedColumnSizeWithPadding[head.value] - parseFloat(paddingLeft) - parseFloat(paddingRight);
|
|
42
|
-
console.log(resizedColumnSizeWithPadding[head.value], paddingLeft, paddingRight, width);
|
|
43
42
|
th.style.width = `${width}px`;
|
|
44
43
|
}
|
|
45
44
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -69,6 +69,7 @@ export { default as FilterBuilder } from './utils/filters/builder';
|
|
|
69
69
|
export { default as FilterConverter } from './utils/filters/filters';
|
|
70
70
|
export { default as FilterValidator } from './utils/filters/validator';
|
|
71
71
|
export { countriesList, countriesOptions, getCountryInfoByAlpha2 } from './utils/countries';
|
|
72
|
+
export { default as FilterEditor } from './components/composed/search/FilterEditor.svelte';
|
|
72
73
|
export { default as GanymedeLineChart } from './components/simple/charts/GanymedeLineChart.svelte';
|
|
73
74
|
export { default as GanymedeBarChart } from './components/simple/charts/GanymedeBarChart.svelte';
|
|
74
75
|
export { default as GanymedePieChart } from './components/simple/charts/GanymedePieChart.svelte';
|
package/dist/index.js
CHANGED
|
@@ -69,6 +69,7 @@ export { default as FilterBuilder } from './utils/filters/builder';
|
|
|
69
69
|
export { default as FilterConverter } from './utils/filters/filters';
|
|
70
70
|
export { default as FilterValidator } from './utils/filters/validator';
|
|
71
71
|
export { countriesList, countriesOptions, getCountryInfoByAlpha2 } from './utils/countries';
|
|
72
|
+
export { default as FilterEditor } from './components/composed/search/FilterEditor.svelte';
|
|
72
73
|
export { default as GanymedeLineChart } from './components/simple/charts/GanymedeLineChart.svelte';
|
|
73
74
|
export { default as GanymedeBarChart } from './components/simple/charts/GanymedeBarChart.svelte';
|
|
74
75
|
export { default as GanymedePieChart } from './components/simple/charts/GanymedePieChart.svelte';
|