@pequity/squirrel 5.4.5 → 5.4.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/cjs/chunks/p-action-bar.js +4 -2181
- package/dist/cjs/chunks/p-dropdown-select.js +30 -8
- package/dist/cjs/chunks/p-icon.js +2180 -0
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/p-select-pill.js +8 -0
- package/dist/es/chunks/p-action-bar.js +3 -2180
- package/dist/es/chunks/p-dropdown-select.js +31 -9
- package/dist/es/chunks/p-icon.js +2181 -0
- package/dist/es/index.js +25 -24
- package/dist/es/p-select-pill.js +8 -0
- package/dist/squirrel/components/p-dropdown-select/p-dropdown-select.vue.d.ts +9 -0
- package/package.json +1 -1
- package/squirrel/components/p-dropdown-select/p-dropdown-select.spec.js +37 -1
- package/squirrel/components/p-dropdown-select/p-dropdown-select.stories.js +23 -0
- package/squirrel/components/p-dropdown-select/p-dropdown-select.vue +21 -0
- package/squirrel/components/p-select-pill/p-select-pill.vue +8 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { defineComponent, ref, useAttrs, computed, watch, onMounted, onUnmounted, resolveDirective, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, toDisplayString, createCommentVNode, createVNode, mergeProps, withCtx, createElementVNode, isRef, Fragment, renderList, withDirectives, renderSlot, vShow } from "vue";
|
|
1
|
+
import { defineComponent, ref, useAttrs, computed, watch, onMounted, onUnmounted, resolveDirective, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, toDisplayString, createCommentVNode, createVNode, mergeProps, withCtx, createElementVNode, isRef, Fragment, renderList, withDirectives, renderSlot, withModifiers, vShow } from "vue";
|
|
2
2
|
import PDropdown from "../p-dropdown.js";
|
|
3
|
+
import { _ as _sfc_main$1 } from "./p-icon.js";
|
|
3
4
|
import PInputSearch from "../p-input-search.js";
|
|
4
5
|
import { SIZES } from "../p-select-list.js";
|
|
5
6
|
import { omit } from "lodash-es";
|
|
@@ -123,6 +124,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
123
124
|
type: Boolean,
|
|
124
125
|
default: false
|
|
125
126
|
},
|
|
127
|
+
clearable: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: false
|
|
130
|
+
},
|
|
126
131
|
/**
|
|
127
132
|
* Enables multiple selection
|
|
128
133
|
*/
|
|
@@ -173,6 +178,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
173
178
|
noAutoFocus: true,
|
|
174
179
|
enableArrowNavigation: false
|
|
175
180
|
};
|
|
181
|
+
const CLEAR_BUTTON_SPACING = {
|
|
182
|
+
sm: "right-8",
|
|
183
|
+
md: "right-9",
|
|
184
|
+
lg: "right-10"
|
|
185
|
+
};
|
|
176
186
|
const width = ref("auto");
|
|
177
187
|
const listItemStyle = ref({ paddingTop: 0, paddingBottom: 0 });
|
|
178
188
|
const dropdownShow = ref(false);
|
|
@@ -296,18 +306,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
296
306
|
class: normalizeClass([
|
|
297
307
|
unref(selectedItems).length !== unref(internalItems).length ? "cursor-pointer" : "pointer-events-none opacity-50"
|
|
298
308
|
]),
|
|
299
|
-
onClick: _cache[
|
|
309
|
+
onClick: _cache[2] || (_cache[2] = //@ts-ignore
|
|
300
310
|
(...args) => unref(selectAll) && unref(selectAll)(...args))
|
|
301
311
|
}, " Select all ", 2)) : (openBlock(), createElementBlock("a", {
|
|
302
312
|
key: 1,
|
|
303
313
|
class: normalizeClass([unref(computedInsideSelected) ? "pointer-events-none opacity-50" : "cursor-pointer"]),
|
|
304
|
-
onClick: _cache[
|
|
314
|
+
onClick: _cache[3] || (_cache[3] = //@ts-ignore
|
|
305
315
|
(...args) => unref(selectAll) && unref(selectAll)(...args))
|
|
306
316
|
}, " Select all filtered ", 2)),
|
|
307
|
-
_cache[
|
|
317
|
+
_cache[7] || (_cache[7] = createElementVNode("span", { class: "px-1 leading-none" }, ".", -1)),
|
|
308
318
|
createElementVNode("a", {
|
|
309
319
|
class: normalizeClass([unref(selectedItems).length ? "cursor-pointer" : "pointer-events-none opacity-50"]),
|
|
310
|
-
onClick: _cache[
|
|
320
|
+
onClick: _cache[4] || (_cache[4] = //@ts-ignore
|
|
311
321
|
(...args) => unref(clearAll) && unref(clearAll)(...args))
|
|
312
322
|
}, " Clear all ", 2)
|
|
313
323
|
])
|
|
@@ -320,7 +330,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
320
330
|
ref_key: "inputSearch",
|
|
321
331
|
ref: inputSearch,
|
|
322
332
|
modelValue: unref(search),
|
|
323
|
-
"onUpdate:modelValue": _cache[
|
|
333
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(search) ? search.value = $event : null),
|
|
324
334
|
size: __props.size,
|
|
325
335
|
placeholder: __props.placeholderSearch
|
|
326
336
|
}, null, 8, ["modelValue", "size", "placeholder"])
|
|
@@ -336,7 +346,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
336
346
|
class: "relative w-full",
|
|
337
347
|
"p-select-list-options": "",
|
|
338
348
|
style: normalizeStyle({ height: `${unref(rowVirtualizer).getTotalSize()}px` }),
|
|
339
|
-
onMousemove: _cache[
|
|
349
|
+
onMousemove: _cache[6] || (_cache[6] = //@ts-ignore
|
|
340
350
|
(...args) => unref(onMousemove) && unref(onMousemove)(...args))
|
|
341
351
|
}, [
|
|
342
352
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rowVirtualizer).getVirtualItems(), (row) => {
|
|
@@ -402,14 +412,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
402
412
|
class: ["w-full", unref(selectClasses), dropdownShow.value ? "border-primary" : ""],
|
|
403
413
|
role: "button",
|
|
404
414
|
"aria-haspopup": "listbox",
|
|
405
|
-
onClick: _cache[
|
|
415
|
+
onClick: _cache[1] || (_cache[1] = ($event) => dropdownShow.value = !dropdownShow.value)
|
|
406
416
|
}), [
|
|
407
417
|
!unref(internalValue).length || !unref(selectedItems).length ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(__props.placeholder || " "), 1)) : renderSlot(_ctx.$slots, "selected-item", {
|
|
408
418
|
key: 1,
|
|
409
419
|
item: __props.multiple ? unref(selectedItems) : unref(selectedItems)[0]
|
|
410
420
|
}, () => [
|
|
411
421
|
createElementVNode("div", _hoisted_3, toDisplayString(__props.multiple && unref(selectedItems).length > 1 ? `${unref(selectedItems).length} option${unref(selectedItems).length > 1 ? "s" : ""} selected` : unref(selectedItems)[0][__props.itemText]), 1)
|
|
412
|
-
])
|
|
422
|
+
]),
|
|
423
|
+
__props.clearable && unref(internalValue).length ? (openBlock(), createElementBlock("button", {
|
|
424
|
+
key: 2,
|
|
425
|
+
class: normalizeClass(["absolute top-1/2 flex -translate-y-1/2 items-center justify-center text-p-gray-40 hover:text-p-gray-60", [unref(SIZES)[__props.size], CLEAR_BUTTON_SPACING[__props.size]]]),
|
|
426
|
+
"aria-label": "Clear selection",
|
|
427
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(
|
|
428
|
+
//@ts-ignore
|
|
429
|
+
(...args) => unref(clearAll) && unref(clearAll)(...args),
|
|
430
|
+
["stop"]
|
|
431
|
+
))
|
|
432
|
+
}, [
|
|
433
|
+
createVNode(_sfc_main$1, { icon: "fe:close" })
|
|
434
|
+
], 2)) : createCommentVNode("", true)
|
|
413
435
|
], 16)
|
|
414
436
|
]),
|
|
415
437
|
_: 3
|