@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,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const vue = require("vue");
|
|
3
3
|
const pDropdown = require("../p-dropdown.js");
|
|
4
|
+
const pIcon_vue_vue_type_script_setup_true_lang = require("./p-icon.js");
|
|
4
5
|
const pInputSearch = require("../p-input-search.js");
|
|
5
6
|
const pSelectList = require("../p-select-list.js");
|
|
6
7
|
const lodashEs = require("lodash-es");
|
|
@@ -124,6 +125,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
124
125
|
type: Boolean,
|
|
125
126
|
default: false
|
|
126
127
|
},
|
|
128
|
+
clearable: {
|
|
129
|
+
type: Boolean,
|
|
130
|
+
default: false
|
|
131
|
+
},
|
|
127
132
|
/**
|
|
128
133
|
* Enables multiple selection
|
|
129
134
|
*/
|
|
@@ -151,6 +156,13 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
151
156
|
selectedTopShown: {
|
|
152
157
|
type: Boolean,
|
|
153
158
|
default: false
|
|
159
|
+
},
|
|
160
|
+
/**
|
|
161
|
+
* Specify the key in the object to be used as item disabled prop.
|
|
162
|
+
*/
|
|
163
|
+
disabledBy: {
|
|
164
|
+
type: String,
|
|
165
|
+
default: "disabled"
|
|
154
166
|
}
|
|
155
167
|
},
|
|
156
168
|
emits: ["update:modelValue", "select"],
|
|
@@ -167,6 +179,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
167
179
|
noAutoFocus: true,
|
|
168
180
|
enableArrowNavigation: false
|
|
169
181
|
};
|
|
182
|
+
const CLEAR_BUTTON_SPACING = {
|
|
183
|
+
sm: "right-8",
|
|
184
|
+
md: "right-9",
|
|
185
|
+
lg: "right-10"
|
|
186
|
+
};
|
|
170
187
|
const width = vue.ref("auto");
|
|
171
188
|
const listItemStyle = vue.ref({ paddingTop: 0, paddingBottom: 0 });
|
|
172
189
|
const dropdownShow = vue.ref(false);
|
|
@@ -181,6 +198,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
181
198
|
const {
|
|
182
199
|
LIST_ITEM_CLASS,
|
|
183
200
|
LIST_ITEM_ACTIVE_CLASS,
|
|
201
|
+
LIST_ITEM_DISABLED_CLASS,
|
|
184
202
|
selectedItems,
|
|
185
203
|
computedItems,
|
|
186
204
|
computedItemSize,
|
|
@@ -192,6 +210,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
192
210
|
getValue,
|
|
193
211
|
getText,
|
|
194
212
|
isSelected,
|
|
213
|
+
isDisabled,
|
|
195
214
|
setupNavigationSvc,
|
|
196
215
|
destroyNavigationSvc,
|
|
197
216
|
select,
|
|
@@ -288,18 +307,18 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
288
307
|
class: vue.normalizeClass([
|
|
289
308
|
vue.unref(selectedItems).length !== vue.unref(internalItems).length ? "cursor-pointer" : "pointer-events-none opacity-50"
|
|
290
309
|
]),
|
|
291
|
-
onClick: _cache[
|
|
310
|
+
onClick: _cache[2] || (_cache[2] = //@ts-ignore
|
|
292
311
|
(...args) => vue.unref(selectAll) && vue.unref(selectAll)(...args))
|
|
293
312
|
}, " Select all ", 2)) : (vue.openBlock(), vue.createElementBlock("a", {
|
|
294
313
|
key: 1,
|
|
295
314
|
class: vue.normalizeClass([vue.unref(computedInsideSelected) ? "pointer-events-none opacity-50" : "cursor-pointer"]),
|
|
296
|
-
onClick: _cache[
|
|
315
|
+
onClick: _cache[3] || (_cache[3] = //@ts-ignore
|
|
297
316
|
(...args) => vue.unref(selectAll) && vue.unref(selectAll)(...args))
|
|
298
317
|
}, " Select all filtered ", 2)),
|
|
299
|
-
_cache[
|
|
318
|
+
_cache[7] || (_cache[7] = vue.createElementVNode("span", { class: "px-1 leading-none" }, ".", -1)),
|
|
300
319
|
vue.createElementVNode("a", {
|
|
301
320
|
class: vue.normalizeClass([vue.unref(selectedItems).length ? "cursor-pointer" : "pointer-events-none opacity-50"]),
|
|
302
|
-
onClick: _cache[
|
|
321
|
+
onClick: _cache[4] || (_cache[4] = //@ts-ignore
|
|
303
322
|
(...args) => vue.unref(clearAll) && vue.unref(clearAll)(...args))
|
|
304
323
|
}, " Clear all ", 2)
|
|
305
324
|
])
|
|
@@ -312,7 +331,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
312
331
|
ref_key: "inputSearch",
|
|
313
332
|
ref: inputSearch,
|
|
314
333
|
modelValue: vue.unref(search),
|
|
315
|
-
"onUpdate:modelValue": _cache[
|
|
334
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vue.isRef(search) ? search.value = $event : null),
|
|
316
335
|
size: __props.size,
|
|
317
336
|
placeholder: __props.placeholderSearch
|
|
318
337
|
}, null, 8, ["modelValue", "size", "placeholder"])
|
|
@@ -328,7 +347,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
328
347
|
class: "relative w-full",
|
|
329
348
|
"p-select-list-options": "",
|
|
330
349
|
style: vue.normalizeStyle({ height: `${vue.unref(rowVirtualizer).getTotalSize()}px` }),
|
|
331
|
-
onMousemove: _cache[
|
|
350
|
+
onMousemove: _cache[6] || (_cache[6] = //@ts-ignore
|
|
332
351
|
(...args) => vue.unref(onMousemove) && vue.unref(onMousemove)(...args))
|
|
333
352
|
}, [
|
|
334
353
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rowVirtualizer).getVirtualItems(), (row) => {
|
|
@@ -340,7 +359,13 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
340
359
|
style: vue.normalizeStyle({ height: `${row.size}px`, transform: `translateY(${row.start}px)` })
|
|
341
360
|
}, [
|
|
342
361
|
vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
343
|
-
class: vue.normalizeClass([
|
|
362
|
+
class: vue.normalizeClass([
|
|
363
|
+
vue.unref(LIST_ITEM_CLASS),
|
|
364
|
+
{
|
|
365
|
+
[vue.unref(LIST_ITEM_ACTIVE_CLASS)]: vue.unref(isSelected)(vue.unref(getValue)(row.index)),
|
|
366
|
+
[vue.unref(LIST_ITEM_DISABLED_CLASS)]: vue.unref(isDisabled)(vue.unref(computedItems)[row.index])
|
|
367
|
+
}
|
|
368
|
+
]),
|
|
344
369
|
"p-select-list-option-item": "",
|
|
345
370
|
style: vue.normalizeStyle(listItemStyle.value),
|
|
346
371
|
onClick: ($event) => vue.unref(select)($event, vue.unref(getValue)(row.index))
|
|
@@ -388,14 +413,26 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
388
413
|
class: ["w-full", vue.unref(selectClasses), dropdownShow.value ? "border-primary" : ""],
|
|
389
414
|
role: "button",
|
|
390
415
|
"aria-haspopup": "listbox",
|
|
391
|
-
onClick: _cache[
|
|
416
|
+
onClick: _cache[1] || (_cache[1] = ($event) => dropdownShow.value = !dropdownShow.value)
|
|
392
417
|
}), [
|
|
393
418
|
!vue.unref(internalValue).length || !vue.unref(selectedItems).length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, vue.toDisplayString(__props.placeholder || " "), 1)) : vue.renderSlot(_ctx.$slots, "selected-item", {
|
|
394
419
|
key: 1,
|
|
395
420
|
item: __props.multiple ? vue.unref(selectedItems) : vue.unref(selectedItems)[0]
|
|
396
421
|
}, () => [
|
|
397
422
|
vue.createElementVNode("div", _hoisted_3, vue.toDisplayString(__props.multiple && vue.unref(selectedItems).length > 1 ? `${vue.unref(selectedItems).length} option${vue.unref(selectedItems).length > 1 ? "s" : ""} selected` : vue.unref(selectedItems)[0][__props.itemText]), 1)
|
|
398
|
-
])
|
|
423
|
+
]),
|
|
424
|
+
__props.clearable && vue.unref(internalValue).length ? (vue.openBlock(), vue.createElementBlock("button", {
|
|
425
|
+
key: 2,
|
|
426
|
+
class: vue.normalizeClass(["absolute top-1/2 flex -translate-y-1/2 items-center justify-center text-p-gray-40 hover:text-p-gray-60", [vue.unref(pSelectList.SIZES)[__props.size], CLEAR_BUTTON_SPACING[__props.size]]]),
|
|
427
|
+
"aria-label": "Clear selection",
|
|
428
|
+
onClick: _cache[0] || (_cache[0] = vue.withModifiers(
|
|
429
|
+
//@ts-ignore
|
|
430
|
+
(...args) => vue.unref(clearAll) && vue.unref(clearAll)(...args),
|
|
431
|
+
["stop"]
|
|
432
|
+
))
|
|
433
|
+
}, [
|
|
434
|
+
vue.createVNode(pIcon_vue_vue_type_script_setup_true_lang._sfc_main, { icon: "fe:close" })
|
|
435
|
+
], 2)) : vue.createCommentVNode("", true)
|
|
399
436
|
], 16)
|
|
400
437
|
]),
|
|
401
438
|
_: 3
|