@pequity/squirrel 5.4.4 → 5.4.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.
- package/dist/cjs/chunks/p-action-bar.js +4 -2181
- package/dist/cjs/chunks/p-dropdown-select.js +46 -9
- package/dist/cjs/chunks/p-icon.js +2180 -0
- package/dist/cjs/index.js +18 -2
- package/dist/cjs/useSelectList.js +10 -0
- package/dist/es/chunks/p-action-bar.js +3 -2180
- package/dist/es/chunks/p-dropdown-select.js +47 -10
- package/dist/es/chunks/p-icon.js +2181 -0
- package/dist/es/index.js +41 -25
- package/dist/es/useSelectList.js +10 -0
- package/dist/squirrel/components/p-dropdown-select/p-dropdown-select.vue.d.ts +24 -0
- package/dist/squirrel/components/p-select-list/p-select-list.vue.d.ts +15 -0
- package/dist/squirrel/components/p-select-list/useSelectList.d.ts +3 -0
- package/package.json +2 -2
- package/squirrel/components/p-dropdown-select/p-dropdown-select.spec.js +87 -0
- package/squirrel/components/p-dropdown-select/p-dropdown-select.stories.js +23 -0
- package/squirrel/components/p-dropdown-select/p-dropdown-select.vue +37 -1
- package/squirrel/components/p-select-list/p-select-list.spec.js +43 -0
- package/squirrel/components/p-select-list/p-select-list.vue +16 -1
- package/squirrel/components/p-select-list/useSelectList.ts +14 -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
|
*/
|
|
@@ -150,6 +155,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
150
155
|
selectedTopShown: {
|
|
151
156
|
type: Boolean,
|
|
152
157
|
default: false
|
|
158
|
+
},
|
|
159
|
+
/**
|
|
160
|
+
* Specify the key in the object to be used as item disabled prop.
|
|
161
|
+
*/
|
|
162
|
+
disabledBy: {
|
|
163
|
+
type: String,
|
|
164
|
+
default: "disabled"
|
|
153
165
|
}
|
|
154
166
|
},
|
|
155
167
|
emits: ["update:modelValue", "select"],
|
|
@@ -166,6 +178,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
166
178
|
noAutoFocus: true,
|
|
167
179
|
enableArrowNavigation: false
|
|
168
180
|
};
|
|
181
|
+
const CLEAR_BUTTON_SPACING = {
|
|
182
|
+
sm: "right-8",
|
|
183
|
+
md: "right-9",
|
|
184
|
+
lg: "right-10"
|
|
185
|
+
};
|
|
169
186
|
const width = ref("auto");
|
|
170
187
|
const listItemStyle = ref({ paddingTop: 0, paddingBottom: 0 });
|
|
171
188
|
const dropdownShow = ref(false);
|
|
@@ -180,6 +197,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
180
197
|
const {
|
|
181
198
|
LIST_ITEM_CLASS,
|
|
182
199
|
LIST_ITEM_ACTIVE_CLASS,
|
|
200
|
+
LIST_ITEM_DISABLED_CLASS,
|
|
183
201
|
selectedItems,
|
|
184
202
|
computedItems,
|
|
185
203
|
computedItemSize,
|
|
@@ -191,6 +209,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
191
209
|
getValue,
|
|
192
210
|
getText,
|
|
193
211
|
isSelected,
|
|
212
|
+
isDisabled,
|
|
194
213
|
setupNavigationSvc,
|
|
195
214
|
destroyNavigationSvc,
|
|
196
215
|
select,
|
|
@@ -287,18 +306,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
287
306
|
class: normalizeClass([
|
|
288
307
|
unref(selectedItems).length !== unref(internalItems).length ? "cursor-pointer" : "pointer-events-none opacity-50"
|
|
289
308
|
]),
|
|
290
|
-
onClick: _cache[
|
|
309
|
+
onClick: _cache[2] || (_cache[2] = //@ts-ignore
|
|
291
310
|
(...args) => unref(selectAll) && unref(selectAll)(...args))
|
|
292
311
|
}, " Select all ", 2)) : (openBlock(), createElementBlock("a", {
|
|
293
312
|
key: 1,
|
|
294
313
|
class: normalizeClass([unref(computedInsideSelected) ? "pointer-events-none opacity-50" : "cursor-pointer"]),
|
|
295
|
-
onClick: _cache[
|
|
314
|
+
onClick: _cache[3] || (_cache[3] = //@ts-ignore
|
|
296
315
|
(...args) => unref(selectAll) && unref(selectAll)(...args))
|
|
297
316
|
}, " Select all filtered ", 2)),
|
|
298
|
-
_cache[
|
|
317
|
+
_cache[7] || (_cache[7] = createElementVNode("span", { class: "px-1 leading-none" }, ".", -1)),
|
|
299
318
|
createElementVNode("a", {
|
|
300
319
|
class: normalizeClass([unref(selectedItems).length ? "cursor-pointer" : "pointer-events-none opacity-50"]),
|
|
301
|
-
onClick: _cache[
|
|
320
|
+
onClick: _cache[4] || (_cache[4] = //@ts-ignore
|
|
302
321
|
(...args) => unref(clearAll) && unref(clearAll)(...args))
|
|
303
322
|
}, " Clear all ", 2)
|
|
304
323
|
])
|
|
@@ -311,7 +330,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
311
330
|
ref_key: "inputSearch",
|
|
312
331
|
ref: inputSearch,
|
|
313
332
|
modelValue: unref(search),
|
|
314
|
-
"onUpdate:modelValue": _cache[
|
|
333
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(search) ? search.value = $event : null),
|
|
315
334
|
size: __props.size,
|
|
316
335
|
placeholder: __props.placeholderSearch
|
|
317
336
|
}, null, 8, ["modelValue", "size", "placeholder"])
|
|
@@ -327,7 +346,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
327
346
|
class: "relative w-full",
|
|
328
347
|
"p-select-list-options": "",
|
|
329
348
|
style: normalizeStyle({ height: `${unref(rowVirtualizer).getTotalSize()}px` }),
|
|
330
|
-
onMousemove: _cache[
|
|
349
|
+
onMousemove: _cache[6] || (_cache[6] = //@ts-ignore
|
|
331
350
|
(...args) => unref(onMousemove) && unref(onMousemove)(...args))
|
|
332
351
|
}, [
|
|
333
352
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rowVirtualizer).getVirtualItems(), (row) => {
|
|
@@ -339,7 +358,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
339
358
|
style: normalizeStyle({ height: `${row.size}px`, transform: `translateY(${row.start}px)` })
|
|
340
359
|
}, [
|
|
341
360
|
withDirectives((openBlock(), createElementBlock("div", {
|
|
342
|
-
class: normalizeClass([
|
|
361
|
+
class: normalizeClass([
|
|
362
|
+
unref(LIST_ITEM_CLASS),
|
|
363
|
+
{
|
|
364
|
+
[unref(LIST_ITEM_ACTIVE_CLASS)]: unref(isSelected)(unref(getValue)(row.index)),
|
|
365
|
+
[unref(LIST_ITEM_DISABLED_CLASS)]: unref(isDisabled)(unref(computedItems)[row.index])
|
|
366
|
+
}
|
|
367
|
+
]),
|
|
343
368
|
"p-select-list-option-item": "",
|
|
344
369
|
style: normalizeStyle(listItemStyle.value),
|
|
345
370
|
onClick: ($event) => unref(select)($event, unref(getValue)(row.index))
|
|
@@ -387,14 +412,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
387
412
|
class: ["w-full", unref(selectClasses), dropdownShow.value ? "border-primary" : ""],
|
|
388
413
|
role: "button",
|
|
389
414
|
"aria-haspopup": "listbox",
|
|
390
|
-
onClick: _cache[
|
|
415
|
+
onClick: _cache[1] || (_cache[1] = ($event) => dropdownShow.value = !dropdownShow.value)
|
|
391
416
|
}), [
|
|
392
417
|
!unref(internalValue).length || !unref(selectedItems).length ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(__props.placeholder || " "), 1)) : renderSlot(_ctx.$slots, "selected-item", {
|
|
393
418
|
key: 1,
|
|
394
419
|
item: __props.multiple ? unref(selectedItems) : unref(selectedItems)[0]
|
|
395
420
|
}, () => [
|
|
396
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)
|
|
397
|
-
])
|
|
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)
|
|
398
435
|
], 16)
|
|
399
436
|
]),
|
|
400
437
|
_: 3
|