@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
package/dist/cjs/index.js
CHANGED
|
@@ -20,6 +20,7 @@ const useInputClasses = require("./useInputClasses.js");
|
|
|
20
20
|
const vueToastification = require("vue-toastification");
|
|
21
21
|
const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
|
|
22
22
|
const pTableFilterIcon = require("./p-table-filter-icon.js");
|
|
23
|
+
const pIcon_vue_vue_type_script_setup_true_lang = require("./chunks/p-icon.js");
|
|
23
24
|
const pInfoIcon = require("./p-info-icon.js");
|
|
24
25
|
const pInlineDatePicker_vue_vue_type_script_setup_true_lang = require("./chunks/p-inline-date-picker.js");
|
|
25
26
|
const pInput = require("./p-input.js");
|
|
@@ -452,6 +453,13 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
452
453
|
focusSearchOnMount: {
|
|
453
454
|
type: Boolean,
|
|
454
455
|
default: true
|
|
456
|
+
},
|
|
457
|
+
/**
|
|
458
|
+
* Specify the key in the object to be used as item disabled prop.
|
|
459
|
+
*/
|
|
460
|
+
disabledBy: {
|
|
461
|
+
type: String,
|
|
462
|
+
default: "disabled"
|
|
455
463
|
}
|
|
456
464
|
},
|
|
457
465
|
emits: ["update:modelValue", "select"],
|
|
@@ -468,6 +476,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
468
476
|
const {
|
|
469
477
|
LIST_ITEM_CLASS,
|
|
470
478
|
LIST_ITEM_ACTIVE_CLASS,
|
|
479
|
+
LIST_ITEM_DISABLED_CLASS,
|
|
471
480
|
selectedItems,
|
|
472
481
|
computedItems,
|
|
473
482
|
computedItemSize,
|
|
@@ -478,6 +487,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
478
487
|
getValue,
|
|
479
488
|
getText,
|
|
480
489
|
isSelected,
|
|
490
|
+
isDisabled,
|
|
481
491
|
setupNavigationSvc,
|
|
482
492
|
select,
|
|
483
493
|
onFocus,
|
|
@@ -591,7 +601,13 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
591
601
|
style: vue.normalizeStyle({ height: `${row.size}px`, transform: `translateY(${row.start}px)` })
|
|
592
602
|
}, [
|
|
593
603
|
vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
594
|
-
class: vue.normalizeClass([
|
|
604
|
+
class: vue.normalizeClass([
|
|
605
|
+
vue.unref(LIST_ITEM_CLASS),
|
|
606
|
+
{
|
|
607
|
+
[vue.unref(LIST_ITEM_ACTIVE_CLASS)]: vue.unref(isSelected)(vue.unref(getValue)(row.index)),
|
|
608
|
+
[vue.unref(LIST_ITEM_DISABLED_CLASS)]: vue.unref(isDisabled)(vue.unref(computedItems)[row.index])
|
|
609
|
+
}
|
|
610
|
+
]),
|
|
595
611
|
"p-select-list-option-item": "",
|
|
596
612
|
style: vue.normalizeStyle(listItemStyle.value),
|
|
597
613
|
onClick: ($event) => vue.unref(select)($event, vue.unref(getValue)(row.index))
|
|
@@ -939,7 +955,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
939
955
|
const pTableSort = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
940
956
|
exports.config = config.config;
|
|
941
957
|
exports.PActionBar = pActionBar_vue_vue_type_script_setup_true_lang._sfc_main;
|
|
942
|
-
exports.PIcon = pActionBar_vue_vue_type_script_setup_true_lang._sfc_main$1;
|
|
943
958
|
exports.PAlert = pAlert;
|
|
944
959
|
exports.PAvatar = pAvatar;
|
|
945
960
|
exports.PBtn = pBtn;
|
|
@@ -953,6 +968,7 @@ exports.PDropdown = pDropdown;
|
|
|
953
968
|
exports.PDropdownSelect = pDropdownSelect_vue_vue_type_script_setup_true_lang._sfc_main;
|
|
954
969
|
exports.useInputClasses = useInputClasses.useInputClasses;
|
|
955
970
|
exports.PFilterIcon = pTableFilterIcon;
|
|
971
|
+
exports.PIcon = pIcon_vue_vue_type_script_setup_true_lang._sfc_main;
|
|
956
972
|
exports.PInfoIcon = pInfoIcon;
|
|
957
973
|
exports.PInlineDatePicker = pInlineDatePicker_vue_vue_type_script_setup_true_lang._sfc_main;
|
|
958
974
|
exports.PInput = pInput;
|
|
@@ -30,6 +30,7 @@ const nextLoop = (ms) => new Promise((resolve) => setTimeout(resolve, ms || 0));
|
|
|
30
30
|
const LIST_ITEM_SIZES = { sm: 32, md: 40, lg: 48 };
|
|
31
31
|
const LIST_ITEM_CLASS = "clear-both block w-full cursor-pointer whitespace-nowrap py-1 px-3 text-left text-sm font-medium hover:bg-p-blue-10";
|
|
32
32
|
const LIST_ITEM_ACTIVE_CLASS = "selected";
|
|
33
|
+
const LIST_ITEM_DISABLED_CLASS = "opacity-30 pointer-events-none";
|
|
33
34
|
const useSelectList = (props, inputSearch, virtualizerRef, emit) => {
|
|
34
35
|
let navigationSvc = null;
|
|
35
36
|
const internalItems = vue.ref([]);
|
|
@@ -151,6 +152,13 @@ const useSelectList = (props, inputSearch, virtualizerRef, emit) => {
|
|
|
151
152
|
const isSelected = (val) => {
|
|
152
153
|
return internalValue.value.includes(val);
|
|
153
154
|
};
|
|
155
|
+
const isDisabled = (val) => {
|
|
156
|
+
const disabledProp = props.disabledBy;
|
|
157
|
+
if (val && typeof val === "object" && disabledProp in val) {
|
|
158
|
+
return val[disabledProp];
|
|
159
|
+
}
|
|
160
|
+
return false;
|
|
161
|
+
};
|
|
154
162
|
const setupNavigationSvc = () => {
|
|
155
163
|
if (navigationSvc) {
|
|
156
164
|
navigationSvc.init();
|
|
@@ -231,6 +239,7 @@ const useSelectList = (props, inputSearch, virtualizerRef, emit) => {
|
|
|
231
239
|
LIST_ITEM_SIZES,
|
|
232
240
|
LIST_ITEM_CLASS,
|
|
233
241
|
LIST_ITEM_ACTIVE_CLASS,
|
|
242
|
+
LIST_ITEM_DISABLED_CLASS,
|
|
234
243
|
selectedItems,
|
|
235
244
|
computedItems,
|
|
236
245
|
computedItemSize,
|
|
@@ -242,6 +251,7 @@ const useSelectList = (props, inputSearch, virtualizerRef, emit) => {
|
|
|
242
251
|
getValue,
|
|
243
252
|
getText,
|
|
244
253
|
isSelected,
|
|
254
|
+
isDisabled,
|
|
245
255
|
setupNavigationSvc,
|
|
246
256
|
destroyNavigationSvc,
|
|
247
257
|
select,
|