@kws3/ui 1.6.2 → 1.6.6
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.
|
@@ -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
|
|
|
@@ -242,7 +242,6 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
242
242
|
* Tooltip text for the Clear All button
|
|
243
243
|
*/
|
|
244
244
|
export let remove_all_tip = "Remove all";
|
|
245
|
-
|
|
246
245
|
/**
|
|
247
246
|
* Where to render the dropdown list.
|
|
248
247
|
* Can be a DOM element or a `string` with the CSS selector of the element.
|
|
@@ -510,6 +509,7 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
510
509
|
}
|
|
511
510
|
|
|
512
511
|
if (event.key === `Enter`) {
|
|
512
|
+
event.preventDefault();
|
|
513
513
|
if (activeOption) {
|
|
514
514
|
handleOptionMouseDown(activeOption);
|
|
515
515
|
if (!single) {
|
|
@@ -20,6 +20,10 @@ this property of each object will be returned as the value, Default: `"id"`
|
|
|
20
20
|
@param {string} [selected_icon="check"] - Icon used to mark selected items in dropdown list, Default: `"check"`
|
|
21
21
|
@param {string} [no_options_msg="No matching options"] - Message to display when no matching options are found, Default: `"No matching options"`
|
|
22
22
|
@param {string} [remove_all_tip="Clear Selection"] - Tooltip text for the Clear selection button, Default: `"Clear Selection"`
|
|
23
|
+
@param {HTMLElement|string} [dropdown_portal=undefined] - Where to render the dropdown list.
|
|
24
|
+
Can be a DOM element or a `string` with the CSS selector of the element.
|
|
25
|
+
|
|
26
|
+
By default it renders in a custom container appended to `document.body`., Default: `undefined`
|
|
23
27
|
@param {string} [class=""] - CSS classes for input container, Default: `""`
|
|
24
28
|
|
|
25
29
|
### Events
|
|
@@ -48,6 +52,7 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
48
52
|
{selected_icon}
|
|
49
53
|
{remove_all_tip}
|
|
50
54
|
{no_options_msg}
|
|
55
|
+
{dropdown_portal}
|
|
51
56
|
on:change={change}
|
|
52
57
|
on:blur={blur}
|
|
53
58
|
let:option
|
|
@@ -67,6 +72,8 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
67
72
|
|
|
68
73
|
const fire = createEventDispatcher();
|
|
69
74
|
|
|
75
|
+
const rootContainerId = "kws-overlay-root";
|
|
76
|
+
|
|
70
77
|
/**
|
|
71
78
|
* Value of the Input
|
|
72
79
|
*
|
|
@@ -127,6 +134,15 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
127
134
|
* Tooltip text for the Clear selection button
|
|
128
135
|
*/
|
|
129
136
|
export let remove_all_tip = "Clear Selection";
|
|
137
|
+
/**
|
|
138
|
+
* Where to render the dropdown list.
|
|
139
|
+
* Can be a DOM element or a `string` with the CSS selector of the element.
|
|
140
|
+
*
|
|
141
|
+
* By default it renders in a custom container appended to `document.body`.
|
|
142
|
+
*
|
|
143
|
+
* @type { HTMLElement|string}
|
|
144
|
+
*/
|
|
145
|
+
export let dropdown_portal = "#" + rootContainerId;
|
|
130
146
|
|
|
131
147
|
/**
|
|
132
148
|
* CSS classes for input container
|
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,16 @@ 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
|
+
- `open` - Triggered when popoper is shown
|
|
34
|
+
- `close` - Triggered when popoper is hidden
|
|
35
|
+
- `trigger` - Triggered when popover is triggered either programatically or by user interaction
|
|
23
36
|
|
|
24
37
|
### Slots
|
|
25
38
|
- `<slot name="default" />` - Content of the Popover Trigger, by default it displays an Icon
|
|
@@ -28,11 +41,16 @@ It can be any CSS value associated with `max-width` property, including `"none"`
|
|
|
28
41
|
-->
|
|
29
42
|
<span
|
|
30
43
|
use:popover={{ content: targetNode }}
|
|
44
|
+
bind:this={popoverParent}
|
|
45
|
+
on:shown={popoverShown}
|
|
46
|
+
on:hidden={popoverHidden}
|
|
47
|
+
on:triggered={popoverTriggered}
|
|
31
48
|
data-tippy-trigger={trigger}
|
|
32
49
|
data-tippy-placement={placement}
|
|
33
50
|
data-tippy-offset="[0, 10]"
|
|
34
51
|
data-tippy-interactive={interactive ? "true" : "false"}
|
|
35
52
|
data-tippy-maxWidth={max_width}
|
|
53
|
+
data-tippy-hideOnClick={hide_on_click ? "true" : "false"}
|
|
36
54
|
style={_style}
|
|
37
55
|
class={klass}>
|
|
38
56
|
<!--Content of the Popover Trigger, by default it displays an Icon--><slot
|
|
@@ -51,8 +69,12 @@ It can be any CSS value associated with `max-width` property, including `"none"`
|
|
|
51
69
|
</style>
|
|
52
70
|
|
|
53
71
|
<script>
|
|
72
|
+
import { createEventDispatcher } from "svelte";
|
|
54
73
|
import { popover } from "./Tooltip";
|
|
55
74
|
import { Icon } from "@kws3/ui";
|
|
75
|
+
|
|
76
|
+
const fire = createEventDispatcher();
|
|
77
|
+
|
|
56
78
|
/**
|
|
57
79
|
* Icon used when default slot has no content
|
|
58
80
|
*/
|
|
@@ -71,6 +93,8 @@ It can be any CSS value associated with `max-width` property, including `"none"`
|
|
|
71
93
|
* Determines the events that cause the Popover to show. Multiple event names are separated by spaces.
|
|
72
94
|
*
|
|
73
95
|
* **Examples:** `click`, `mouseenter`, `mouseenter focus`
|
|
96
|
+
*
|
|
97
|
+
* If you would like to trigger the popover programatically only, you can use `manual`.
|
|
74
98
|
*/
|
|
75
99
|
export let trigger = "click";
|
|
76
100
|
/**
|
|
@@ -83,6 +107,10 @@ It can be any CSS value associated with `max-width` property, including `"none"`
|
|
|
83
107
|
* Allows you to interact with the Popover content, when turned on
|
|
84
108
|
*/
|
|
85
109
|
export let interactive = false;
|
|
110
|
+
/**
|
|
111
|
+
* Whether the popover should hide on clicking outside of it
|
|
112
|
+
*/
|
|
113
|
+
export let hide_on_click = true;
|
|
86
114
|
/**
|
|
87
115
|
* Specify a target node reference to use as the Popover content
|
|
88
116
|
*
|
|
@@ -106,7 +134,52 @@ It can be any CSS value associated with `max-width` property, including `"none"`
|
|
|
106
134
|
let klass = "";
|
|
107
135
|
export { klass as class };
|
|
108
136
|
|
|
109
|
-
let popoverNode;
|
|
137
|
+
let popoverNode, popoverParent;
|
|
138
|
+
|
|
139
|
+
const getInstance = () => {
|
|
140
|
+
return popoverParent._tippy;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export function open() {
|
|
144
|
+
getInstance().show();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function close() {
|
|
148
|
+
getInstance().hide();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function enable() {
|
|
152
|
+
getInstance().enable();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function disable() {
|
|
156
|
+
getInstance().disable();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function setProps(props) {
|
|
160
|
+
getInstance().setProps(props);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const popoverShown = ({ detail }) => {
|
|
164
|
+
/**
|
|
165
|
+
* Triggered when popoper is shown
|
|
166
|
+
*/
|
|
167
|
+
fire("open", detail);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const popoverHidden = ({ detail }) => {
|
|
171
|
+
/**
|
|
172
|
+
* Triggered when popoper is hidden
|
|
173
|
+
*/
|
|
174
|
+
fire("close", detail);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const popoverTriggered = ({ detail }) => {
|
|
178
|
+
/**
|
|
179
|
+
* Triggered when popover is triggered either programatically or by user interaction
|
|
180
|
+
*/
|
|
181
|
+
fire("trigger", detail);
|
|
182
|
+
};
|
|
110
183
|
|
|
111
184
|
$: _style = `cursor:pointer;${style}`;
|
|
112
185
|
$: targetNode = external_target ? external_target : popoverNode;
|
package/helpers/Tooltip.js
CHANGED
|
@@ -29,7 +29,17 @@ 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("shown", { instance });
|
|
35
|
+
},
|
|
36
|
+
onHide(instance) {
|
|
37
|
+
dispatch("hidden", { instance });
|
|
38
|
+
},
|
|
39
|
+
onTrigger(instance) {
|
|
40
|
+
dispatch("triggered", { instance });
|
|
41
|
+
},
|
|
42
|
+
});
|
|
33
43
|
}
|
|
34
44
|
|
|
35
45
|
function remakeInstance() {
|
|
@@ -51,6 +61,11 @@ function createTippyAction(defaultOpts) {
|
|
|
51
61
|
|
|
52
62
|
makeInstance();
|
|
53
63
|
|
|
64
|
+
function dispatch(type, detail) {
|
|
65
|
+
const e = new CustomEvent(type, { bubbles: false, detail });
|
|
66
|
+
node.dispatchEvent(e);
|
|
67
|
+
}
|
|
68
|
+
|
|
54
69
|
return {
|
|
55
70
|
update(_opts) {
|
|
56
71
|
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.6",
|
|
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": "0f6862d3aefc099de5ccc7df5eaca60c47bbcdab"
|
|
33
33
|
}
|