selectic 3.2.0 → 3.2.1
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/selectic.common.js +11 -0
- package/dist/selectic.esm.js +11 -0
- package/doc/params.md +17 -3
- package/package.json +1 -1
- package/src/Store.tsx +9 -2
- package/src/index.tsx +25 -3
- package/types/Store.d.ts +9 -2
- package/types/index.d.ts +9 -2
package/dist/selectic.common.js
CHANGED
|
@@ -2921,6 +2921,17 @@ let Selectic = class Selectic extends vtyx.Vue {
|
|
|
2921
2921
|
}
|
|
2922
2922
|
const target = evt.target;
|
|
2923
2923
|
if (!extendedListEl.contains(target) && !this.$el.contains(target)) {
|
|
2924
|
+
if (keepOpenWithOtherSelectic) {
|
|
2925
|
+
let classSelector = '.selectic';
|
|
2926
|
+
if (typeof keepOpenWithOtherSelectic === 'string') {
|
|
2927
|
+
classSelector += keepOpenWithOtherSelectic;
|
|
2928
|
+
}
|
|
2929
|
+
const parentIsSelectic = target === null || target === void 0 ? void 0 : target.closest(classSelector);
|
|
2930
|
+
if (parentIsSelectic) {
|
|
2931
|
+
/* Do not close current Selectic */
|
|
2932
|
+
return;
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2924
2935
|
store.commit('isOpen', false);
|
|
2925
2936
|
}
|
|
2926
2937
|
};
|
package/dist/selectic.esm.js
CHANGED
|
@@ -2917,6 +2917,17 @@ let Selectic = class Selectic extends Vue {
|
|
|
2917
2917
|
}
|
|
2918
2918
|
const target = evt.target;
|
|
2919
2919
|
if (!extendedListEl.contains(target) && !this.$el.contains(target)) {
|
|
2920
|
+
if (keepOpenWithOtherSelectic) {
|
|
2921
|
+
let classSelector = '.selectic';
|
|
2922
|
+
if (typeof keepOpenWithOtherSelectic === 'string') {
|
|
2923
|
+
classSelector += keepOpenWithOtherSelectic;
|
|
2924
|
+
}
|
|
2925
|
+
const parentIsSelectic = target === null || target === void 0 ? void 0 : target.closest(classSelector);
|
|
2926
|
+
if (parentIsSelectic) {
|
|
2927
|
+
/* Do not close current Selectic */
|
|
2928
|
+
return;
|
|
2929
|
+
}
|
|
2930
|
+
}
|
|
2920
2931
|
store.commit('isOpen', false);
|
|
2921
2932
|
}
|
|
2922
2933
|
};
|
package/doc/params.md
CHANGED
|
@@ -312,12 +312,17 @@ will not be displayed and the filter panel is always open.
|
|
|
312
312
|
|
|
313
313
|
## keepOpenWithOtherSelectic
|
|
314
314
|
|
|
315
|
-
Type: `boolean`
|
|
315
|
+
Type: `boolean | string`
|
|
316
316
|
|
|
317
317
|
Default value: `false`
|
|
318
318
|
|
|
319
|
-
By default, only one selectic component can be open at the same time. So if another Selectic component is open
|
|
320
|
-
|
|
319
|
+
By default, only one selectic component can be open at the same time. So if another Selectic component is open then any previously open component is closed.
|
|
320
|
+
|
|
321
|
+
When `keepOpenWithOtherSelectic` is set to `true`, this component stays open when any other Selectic component opens.
|
|
322
|
+
|
|
323
|
+
When it is set to a `non-empty string`, this component stays open only when another Selectic component that matches the given CSS selector opens.
|
|
324
|
+
|
|
325
|
+
For falsy values, the component always closes when another Selectic opens.
|
|
321
326
|
|
|
322
327
|
Note: This attribute does not prevent closing when user clicks outside the component.
|
|
323
328
|
|
|
@@ -330,6 +335,15 @@ Note: This attribute does not prevent closing when user clicks outside the compo
|
|
|
330
335
|
/>
|
|
331
336
|
```
|
|
332
337
|
|
|
338
|
+
```html
|
|
339
|
+
<selectic
|
|
340
|
+
:params="{
|
|
341
|
+
keepOpenWithOtherSelectic: '.class-name',
|
|
342
|
+
}"
|
|
343
|
+
:options="optionList"
|
|
344
|
+
/>
|
|
345
|
+
```
|
|
346
|
+
|
|
333
347
|
## listPosition
|
|
334
348
|
|
|
335
349
|
Type: `'auto' | 'bottom' | 'top'`
|
package/package.json
CHANGED
package/src/Store.tsx
CHANGED
|
@@ -208,8 +208,15 @@ export interface Props {
|
|
|
208
208
|
/** Overwrite default icon family */
|
|
209
209
|
iconFamily?: IconFamily | null;
|
|
210
210
|
|
|
211
|
-
/** Keep this component open if another Selectic component opens
|
|
212
|
-
|
|
211
|
+
/** Keep this component open if another Selectic component opens.
|
|
212
|
+
*
|
|
213
|
+
* - `true` → Keep open for **any** Selectic component.
|
|
214
|
+
* - `string` → Keep open only when the other Selectic matches the given CSS selector.
|
|
215
|
+
* - `false` (default) → Always close when another Selectic opens.
|
|
216
|
+
*
|
|
217
|
+
* An empty string is treated the same as `false`.
|
|
218
|
+
*/
|
|
219
|
+
keepOpenWithOtherSelectic?: boolean | string;
|
|
213
220
|
|
|
214
221
|
/** Selectic configuration */
|
|
215
222
|
params?: SelecticStoreStateParams;
|
package/src/index.tsx
CHANGED
|
@@ -146,8 +146,15 @@ export interface ParamProps {
|
|
|
146
146
|
*/
|
|
147
147
|
optionBehavior?: string;
|
|
148
148
|
|
|
149
|
-
/** Keep this component open if another Selectic component opens
|
|
150
|
-
|
|
149
|
+
/** Keep this component open if another Selectic component opens.
|
|
150
|
+
*
|
|
151
|
+
* - `true` → Keep open for **any** Selectic component.
|
|
152
|
+
* - `string` → Keep open only when the other Selectic matches the given CSS selector.
|
|
153
|
+
* - `false` (default) → Always close when another Selectic opens.
|
|
154
|
+
*
|
|
155
|
+
* An empty string is treated the same as `false`.
|
|
156
|
+
*/
|
|
157
|
+
keepOpenWithOtherSelectic?: boolean | string;
|
|
151
158
|
|
|
152
159
|
/** Avoid click on group name to select all items in this group. */
|
|
153
160
|
disableGroupSelection?: boolean;
|
|
@@ -361,9 +368,24 @@ export default class Selectic extends Vue<Props> {
|
|
|
361
368
|
return;
|
|
362
369
|
}
|
|
363
370
|
|
|
364
|
-
const target = evt.target as
|
|
371
|
+
const target = evt.target as Element | null;
|
|
365
372
|
|
|
366
373
|
if (!extendedListEl.contains(target) && !this.$el.contains(target)) {
|
|
374
|
+
if (keepOpenWithOtherSelectic) {
|
|
375
|
+
let classSelector = '.selectic';
|
|
376
|
+
|
|
377
|
+
if (typeof keepOpenWithOtherSelectic === 'string') {
|
|
378
|
+
classSelector += keepOpenWithOtherSelectic;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
const parentIsSelectic = target?.closest(classSelector);
|
|
382
|
+
|
|
383
|
+
if (parentIsSelectic) {
|
|
384
|
+
/* Do not close current Selectic */
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
367
389
|
store.commit('isOpen', false);
|
|
368
390
|
}
|
|
369
391
|
};
|
package/types/Store.d.ts
CHANGED
|
@@ -135,8 +135,15 @@ export interface Props {
|
|
|
135
135
|
icons?: PartialIcons | null;
|
|
136
136
|
/** Overwrite default icon family */
|
|
137
137
|
iconFamily?: IconFamily | null;
|
|
138
|
-
/** Keep this component open if another Selectic component opens
|
|
139
|
-
|
|
138
|
+
/** Keep this component open if another Selectic component opens.
|
|
139
|
+
*
|
|
140
|
+
* - `true` → Keep open for **any** Selectic component.
|
|
141
|
+
* - `string` → Keep open only when the other Selectic matches the given CSS selector.
|
|
142
|
+
* - `false` (default) → Always close when another Selectic opens.
|
|
143
|
+
*
|
|
144
|
+
* An empty string is treated the same as `false`.
|
|
145
|
+
*/
|
|
146
|
+
keepOpenWithOtherSelectic?: boolean | string;
|
|
140
147
|
/** Selectic configuration */
|
|
141
148
|
params?: SelecticStoreStateParams;
|
|
142
149
|
/** Method to call to fetch extra data */
|
package/types/index.d.ts
CHANGED
|
@@ -65,8 +65,15 @@ export interface ParamProps {
|
|
|
65
65
|
* Example: "sort-ODE"
|
|
66
66
|
*/
|
|
67
67
|
optionBehavior?: string;
|
|
68
|
-
/** Keep this component open if another Selectic component opens
|
|
69
|
-
|
|
68
|
+
/** Keep this component open if another Selectic component opens.
|
|
69
|
+
*
|
|
70
|
+
* - `true` → Keep open for **any** Selectic component.
|
|
71
|
+
* - `string` → Keep open only when the other Selectic matches the given CSS selector.
|
|
72
|
+
* - `false` (default) → Always close when another Selectic opens.
|
|
73
|
+
*
|
|
74
|
+
* An empty string is treated the same as `false`.
|
|
75
|
+
*/
|
|
76
|
+
keepOpenWithOtherSelectic?: boolean | string;
|
|
70
77
|
/** Avoid click on group name to select all items in this group. */
|
|
71
78
|
disableGroupSelection?: boolean;
|
|
72
79
|
}
|