@kws3/ui 1.6.4 → 1.6.8
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/README.md +1 -1
- package/datagrid/DataSearch/DataSearch.svelte +10 -1
- package/datagrid/GridView/GridRow.svelte +6 -2
- package/helpers/Popover.svelte +93 -2
- package/helpers/Tooltip.js +22 -1
- package/package.json +2 -2
- package/styles/Grid.scss +10 -0
- package/styles/Pagination.scss +1 -1
package/README.md
CHANGED
|
@@ -166,6 +166,15 @@
|
|
|
166
166
|
qfilters[qqp[0]] = qqp[1];
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
if (hasFilters) {
|
|
170
|
+
for (let i in _filters) {
|
|
171
|
+
let filter = _filters[i];
|
|
172
|
+
if (typeof qfilters[filter.name] == "undefined") {
|
|
173
|
+
qfilters[filter.name] = "";
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
169
178
|
filterVals = qfilters;
|
|
170
179
|
}
|
|
171
180
|
|
|
@@ -186,7 +195,7 @@
|
|
|
186
195
|
let ret = [];
|
|
187
196
|
ret.push(query);
|
|
188
197
|
for (var i in filterVals) {
|
|
189
|
-
ret.push(i + ":" + filterVals[i]);
|
|
198
|
+
filterVals[i] && ret.push(i + ":" + filterVals[i]);
|
|
190
199
|
}
|
|
191
200
|
/**
|
|
192
201
|
* Event triggered on search
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
<tr
|
|
30
30
|
in:fly={{ x: 20, delay: 25 * row_index }}
|
|
31
31
|
on:click|stopPropagation={rowClick}
|
|
32
|
-
class:is-selected={rowActive}
|
|
32
|
+
class:is-selected={rowActive}
|
|
33
|
+
class:is-checked={checked}>
|
|
33
34
|
{#if bulk_actions}
|
|
34
35
|
<td style="vertical-align:middle;">
|
|
35
36
|
<Checkbox
|
|
@@ -55,7 +56,10 @@
|
|
|
55
56
|
{/each}
|
|
56
57
|
</tr>
|
|
57
58
|
{:else}
|
|
58
|
-
<tr
|
|
59
|
+
<tr
|
|
60
|
+
on:click|stopPropagation={rowClick}
|
|
61
|
+
class:is-selected={rowActive}
|
|
62
|
+
class:is-checked={checked}>
|
|
59
63
|
{#if bulk_actions}
|
|
60
64
|
<td style="vertical-align:middle;">
|
|
61
65
|
<Checkbox
|
package/helpers/Popover.svelte
CHANGED
|
@@ -7,11 +7,14 @@
|
|
|
7
7
|
@param {''|'small'|'medium'|'large'} [icon_size="small"] - Size of the trigger icon displayed when default slot has no content, Default: `"small"`
|
|
8
8
|
@param {string} [trigger="click"] - Determines the events that cause the Popover to show. Multiple event names are separated by spaces.
|
|
9
9
|
|
|
10
|
-
**Examples:** `click`, `mouseenter`, `mouseenter focus
|
|
10
|
+
**Examples:** `click`, `mouseenter`, `mouseenter focus`
|
|
11
|
+
|
|
12
|
+
If you would like to trigger the popover programatically only, you can use `manual`., Default: `"click"`
|
|
11
13
|
@param {string} [placement="auto"] - Preferred placement of the Popover
|
|
12
14
|
|
|
13
15
|
Available options: <a target="_blank" href="https://atomiks.github.io/tippyjs/v6/all-props/#placement">https://atomiks.github.io/tippyjs/v6/all-props/#placement</a>, Default: `"auto"`
|
|
14
16
|
@param {boolean} [interactive=false] - Allows you to interact with the Popover content, when turned on, Default: `false`
|
|
17
|
+
@param {boolean} [hide_on_click=true] - Whether the popover should hide on clicking outside of it, Default: `true`
|
|
15
18
|
@param {object} [external_target=null] - Specify a target node reference to use as the Popover content
|
|
16
19
|
|
|
17
20
|
When set to `null`, it will use the content of the `popover` slot, Default: `null`
|
|
@@ -20,6 +23,18 @@ When set to `null`, it will use the content of the `popover` slot, Default: `nul
|
|
|
20
23
|
It can be any CSS value associated with `max-width` property, including `"none"`, Default: `"none"`
|
|
21
24
|
@param {string} [style=""] - Inline CSS for Popover trigger, Default: `""`
|
|
22
25
|
@param {string} [class=""] - CSS classes for Popover trigger, Default: `""`
|
|
26
|
+
@param {function} [open()] - Open function
|
|
27
|
+
@param {function} [close()] - Close function
|
|
28
|
+
@param {function} [enable()] - Enable function
|
|
29
|
+
@param {function} [disable()] - Disable function
|
|
30
|
+
@param {function} [setProps(props)] - SetProps function
|
|
31
|
+
|
|
32
|
+
### Events
|
|
33
|
+
- `opening` - Triggered when popover is opening
|
|
34
|
+
- `open` - Triggered when popover is opened
|
|
35
|
+
- `closing` - Triggered when popover is closing
|
|
36
|
+
- `close` - Triggered when popover is closed
|
|
37
|
+
- `trigger` - Triggered when popover is triggered either programatically or by user interaction
|
|
23
38
|
|
|
24
39
|
### Slots
|
|
25
40
|
- `<slot name="default" />` - Content of the Popover Trigger, by default it displays an Icon
|
|
@@ -28,11 +43,18 @@ It can be any CSS value associated with `max-width` property, including `"none"`
|
|
|
28
43
|
-->
|
|
29
44
|
<span
|
|
30
45
|
use:popover={{ content: targetNode }}
|
|
46
|
+
bind:this={popoverParent}
|
|
47
|
+
on:showing={popoverShowing}
|
|
48
|
+
on:shown={popoverShown}
|
|
49
|
+
on:hiding={popoverHiding}
|
|
50
|
+
on:hidden={popoverHidden}
|
|
51
|
+
on:triggered={popoverTriggered}
|
|
31
52
|
data-tippy-trigger={trigger}
|
|
32
53
|
data-tippy-placement={placement}
|
|
33
54
|
data-tippy-offset="[0, 10]"
|
|
34
55
|
data-tippy-interactive={interactive ? "true" : "false"}
|
|
35
56
|
data-tippy-maxWidth={max_width}
|
|
57
|
+
data-tippy-hideOnClick={hide_on_click ? "true" : "false"}
|
|
36
58
|
style={_style}
|
|
37
59
|
class={klass}>
|
|
38
60
|
<!--Content of the Popover Trigger, by default it displays an Icon--><slot
|
|
@@ -51,8 +73,12 @@ It can be any CSS value associated with `max-width` property, including `"none"`
|
|
|
51
73
|
</style>
|
|
52
74
|
|
|
53
75
|
<script>
|
|
76
|
+
import { createEventDispatcher } from "svelte";
|
|
54
77
|
import { popover } from "./Tooltip";
|
|
55
78
|
import { Icon } from "@kws3/ui";
|
|
79
|
+
|
|
80
|
+
const fire = createEventDispatcher();
|
|
81
|
+
|
|
56
82
|
/**
|
|
57
83
|
* Icon used when default slot has no content
|
|
58
84
|
*/
|
|
@@ -71,6 +97,8 @@ It can be any CSS value associated with `max-width` property, including `"none"`
|
|
|
71
97
|
* Determines the events that cause the Popover to show. Multiple event names are separated by spaces.
|
|
72
98
|
*
|
|
73
99
|
* **Examples:** `click`, `mouseenter`, `mouseenter focus`
|
|
100
|
+
*
|
|
101
|
+
* If you would like to trigger the popover programatically only, you can use `manual`.
|
|
74
102
|
*/
|
|
75
103
|
export let trigger = "click";
|
|
76
104
|
/**
|
|
@@ -83,6 +111,10 @@ It can be any CSS value associated with `max-width` property, including `"none"`
|
|
|
83
111
|
* Allows you to interact with the Popover content, when turned on
|
|
84
112
|
*/
|
|
85
113
|
export let interactive = false;
|
|
114
|
+
/**
|
|
115
|
+
* Whether the popover should hide on clicking outside of it
|
|
116
|
+
*/
|
|
117
|
+
export let hide_on_click = true;
|
|
86
118
|
/**
|
|
87
119
|
* Specify a target node reference to use as the Popover content
|
|
88
120
|
*
|
|
@@ -106,7 +138,66 @@ It can be any CSS value associated with `max-width` property, including `"none"`
|
|
|
106
138
|
let klass = "";
|
|
107
139
|
export { klass as class };
|
|
108
140
|
|
|
109
|
-
let popoverNode;
|
|
141
|
+
let popoverNode, popoverParent;
|
|
142
|
+
|
|
143
|
+
const getInstance = () => {
|
|
144
|
+
return popoverParent._tippy;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export function open() {
|
|
148
|
+
getInstance().show();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function close() {
|
|
152
|
+
getInstance().hide();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function enable() {
|
|
156
|
+
getInstance().enable();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function disable() {
|
|
160
|
+
getInstance().disable();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export function setProps(props) {
|
|
164
|
+
getInstance().setProps(props);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const popoverShowing = ({ detail }) => {
|
|
168
|
+
/**
|
|
169
|
+
* Triggered when popover is opening
|
|
170
|
+
*/
|
|
171
|
+
fire("opening", detail);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const popoverShown = ({ detail }) => {
|
|
175
|
+
/**
|
|
176
|
+
* Triggered when popover is opened
|
|
177
|
+
*/
|
|
178
|
+
fire("open", detail);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const popoverHiding = ({ detail }) => {
|
|
182
|
+
/**
|
|
183
|
+
* Triggered when popover is closing
|
|
184
|
+
*/
|
|
185
|
+
fire("closing", detail);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const popoverHidden = ({ detail }) => {
|
|
189
|
+
/**
|
|
190
|
+
* Triggered when popover is closed
|
|
191
|
+
*/
|
|
192
|
+
fire("close", detail);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const popoverTriggered = ({ detail }) => {
|
|
196
|
+
/**
|
|
197
|
+
* Triggered when popover is triggered either programatically or by user interaction
|
|
198
|
+
*/
|
|
199
|
+
fire("trigger", detail);
|
|
200
|
+
};
|
|
110
201
|
|
|
111
202
|
$: _style = `cursor:pointer;${style}`;
|
|
112
203
|
$: targetNode = external_target ? external_target : popoverNode;
|
package/helpers/Tooltip.js
CHANGED
|
@@ -29,7 +29,23 @@ function createTippyAction(defaultOpts) {
|
|
|
29
29
|
let instance;
|
|
30
30
|
|
|
31
31
|
function makeOptions() {
|
|
32
|
-
return Object.assign({}, defaultOpts, opts
|
|
32
|
+
return Object.assign({}, defaultOpts, opts, {
|
|
33
|
+
onShow(instance) {
|
|
34
|
+
dispatch("showing", { instance });
|
|
35
|
+
},
|
|
36
|
+
onShown(instance) {
|
|
37
|
+
dispatch("shown", { instance });
|
|
38
|
+
},
|
|
39
|
+
onHide(instance) {
|
|
40
|
+
dispatch("hiding", { instance });
|
|
41
|
+
},
|
|
42
|
+
onHidden(instance) {
|
|
43
|
+
dispatch("hidden", { instance });
|
|
44
|
+
},
|
|
45
|
+
onTrigger(instance) {
|
|
46
|
+
dispatch("triggered", { instance });
|
|
47
|
+
},
|
|
48
|
+
});
|
|
33
49
|
}
|
|
34
50
|
|
|
35
51
|
function remakeInstance() {
|
|
@@ -51,6 +67,11 @@ function createTippyAction(defaultOpts) {
|
|
|
51
67
|
|
|
52
68
|
makeInstance();
|
|
53
69
|
|
|
70
|
+
function dispatch(type, detail) {
|
|
71
|
+
const e = new CustomEvent(type, { bubbles: false, detail });
|
|
72
|
+
node.dispatchEvent(e);
|
|
73
|
+
}
|
|
74
|
+
|
|
54
75
|
return {
|
|
55
76
|
update(_opts) {
|
|
56
77
|
opts = _opts;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kws3/ui",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.8",
|
|
4
4
|
"description": "UI components for use with Svelte v3 applications.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"text-mask-core": "^5.1.2",
|
|
30
30
|
"tippy.js": "^6.3.1"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "f35ff4c73bff73bddc8c3af2dd88d5f4282ae6df"
|
|
33
33
|
}
|
package/styles/Grid.scss
CHANGED
|
@@ -4,12 +4,14 @@ $kws-gridview-th-background: $table-background-color !default;
|
|
|
4
4
|
$kws-gridview-th-color: $text !default;
|
|
5
5
|
$kws-gridview-tag-margin: 0 0.125rem 0.125rem 0 !default;
|
|
6
6
|
$kws-gridview-icon-size: 1.5em !default;
|
|
7
|
+
$kws-gridview-checked-row-background: $primary-light !default;
|
|
7
8
|
|
|
8
9
|
.data-table .table {
|
|
9
10
|
box-shadow: $kws-gridview-box-shadow;
|
|
10
11
|
th {
|
|
11
12
|
background: $kws-gridview-th-background;
|
|
12
13
|
color: $kws-gridview-th-color;
|
|
14
|
+
vertical-align: middle;
|
|
13
15
|
}
|
|
14
16
|
&.is-bordered {
|
|
15
17
|
tr {
|
|
@@ -34,6 +36,7 @@ $kws-gridview-icon-size: 1.5em !default;
|
|
|
34
36
|
}
|
|
35
37
|
td.is-icon {
|
|
36
38
|
width: 25px;
|
|
39
|
+
vertical-align: middle;
|
|
37
40
|
.icon {
|
|
38
41
|
font-size: $kws-gridview-icon-size;
|
|
39
42
|
}
|
|
@@ -43,4 +46,11 @@ $kws-gridview-icon-size: 1.5em !default;
|
|
|
43
46
|
cursor: pointer;
|
|
44
47
|
}
|
|
45
48
|
}
|
|
49
|
+
|
|
50
|
+
tr.is-checked {
|
|
51
|
+
background-color: $kws-gridview-checked-row-background !important;
|
|
52
|
+
td {
|
|
53
|
+
background-color: $kws-gridview-checked-row-background !important;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
46
56
|
}
|
package/styles/Pagination.scss
CHANGED
|
@@ -14,7 +14,7 @@ $kws-pagination-item-active-color: findColorInvert(
|
|
|
14
14
|
|
|
15
15
|
$kws-pagination-frame-box-shadow: 0 0.125rem 0.1875rem rgba(0, 0, 0, 0.1),
|
|
16
16
|
0 0 0 0.0625rem rgba(0, 0, 0, 0.1) !default;
|
|
17
|
-
$kws-pagination-frame-background: linear-gradient(#fff, #fafafa);
|
|
17
|
+
$kws-pagination-frame-background: linear-gradient(#fff, #fafafa) !default;
|
|
18
18
|
|
|
19
19
|
.pagination {
|
|
20
20
|
&.is-small {
|