@volverjs/ui-vue 0.0.10-beta.23 → 0.0.10-beta.25
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/components/VvAccordion/VvAccordion.es.js +119 -79
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +18 -4
- package/dist/components/VvAccordion/index.d.ts +4 -8
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +282 -124
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +34 -7
- package/dist/components/VvAccordionGroup/index.d.ts +4 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +1 -1
- package/dist/components/VvButton/VvButton.es.js +92 -98
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +7 -7
- package/dist/components/VvButton/index.d.ts +11 -11
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +7 -13
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +3 -3
- package/dist/components/VvCheckbox/VvCheckbox.es.js +81 -87
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +6 -6
- package/dist/components/VvCheckbox/index.d.ts +2 -2
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +15 -29
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +5 -5
- package/dist/components/VvCombobox/VvCombobox.es.js +13 -16
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +11 -11
- package/dist/components/VvCombobox/index.d.ts +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +5 -5
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +1 -1
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +1 -1
- package/dist/components/VvDropdown/index.d.ts +1 -1
- package/dist/components/VvInputFile/VvInputFile.es.js +183 -168
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
- package/dist/components/VvInputFile/VvInputFile.vue.d.ts +16 -9
- package/dist/components/VvInputFile/index.d.ts +12 -3
- package/dist/components/VvInputText/VvInputClearAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +6 -6
- package/dist/components/VvProgress/VvProgress.vue.d.ts +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +64 -70
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +6 -6
- package/dist/components/VvRadio/index.d.ts +6 -6
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +15 -29
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +5 -5
- package/dist/components/VvSelect/VvSelect.vue.d.ts +8 -8
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +5 -5
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +3 -3
- package/dist/components/VvTooltip/index.d.ts +1 -1
- package/dist/components/index.es.js +494 -328
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/alert/useInjectAlert.d.ts +1 -6
- package/dist/composables/group/useInjectedGroupState.d.ts +4 -5
- package/dist/composables/group/useProvideGroupState.d.ts +3 -3
- package/dist/constants.d.ts +6 -10
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/index.es.js +3 -2
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +1 -1
- package/dist/resolvers/unplugin.es.js +3 -2
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +58 -15
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +381 -107
- package/dist/types/group.d.ts +37 -15
- package/package.json +37 -36
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAccordion/VvAccordion.vue +119 -56
- package/src/components/VvAccordion/index.ts +8 -23
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +164 -42
- package/src/components/VvAccordionGroup/index.ts +4 -1
- package/src/components/VvButton/index.ts +7 -12
- package/src/components/VvButtonGroup/VvButtonGroup.vue +1 -2
- package/src/components/VvCheckbox/index.ts +2 -2
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +1 -2
- package/src/components/VvInputFile/VvInputFile.vue +71 -47
- package/src/components/VvInputFile/index.ts +5 -4
- package/src/components/VvRadio/index.ts +5 -5
- package/src/components/VvRadioGroup/VvRadioGroup.vue +1 -2
- package/src/composables/group/useInjectedGroupState.ts +20 -16
- package/src/composables/group/useProvideGroupState.ts +10 -15
- package/src/constants.ts +19 -14
- package/src/stories/AccordionGroup/AccordionGroup.settings.ts +2 -2
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +16 -10
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.ts +1 -1
- package/src/types/group.ts +22 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { inject, computed, toRef, toRefs, isRef, defineComponent, h, unref, useSlots, ref, watchEffect, watch, onMounted, openBlock, createElementBlock, normalizeClass, withDirectives, createElementVNode, vModelCheckbox, renderSlot, createTextVNode, toDisplayString, createVNode, createSlots, withCtx, normalizeProps, guardReactiveProps } from "vue";
|
|
2
2
|
import { uid } from "uid";
|
|
3
3
|
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
4
4
|
Strategy2["absolute"] = "absolute";
|
|
@@ -49,7 +49,9 @@ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
|
49
49
|
return AnchorTarget2;
|
|
50
50
|
})(AnchorTarget || {});
|
|
51
51
|
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
52
|
-
const INJECTION_KEY_CHECK_GROUP = Symbol.for(
|
|
52
|
+
const INJECTION_KEY_CHECK_GROUP = Symbol.for(
|
|
53
|
+
"checkGroup"
|
|
54
|
+
);
|
|
53
55
|
const LinkProps = {
|
|
54
56
|
/**
|
|
55
57
|
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
@@ -375,6 +377,83 @@ const CheckboxRadioProps = {
|
|
|
375
377
|
default: ActionTag.button
|
|
376
378
|
}
|
|
377
379
|
});
|
|
380
|
+
function useInjectedGroupState(groupKey) {
|
|
381
|
+
const group = inject(groupKey, void 0);
|
|
382
|
+
const isInGroup = computed(() => group !== void 0);
|
|
383
|
+
function getGroupOrLocalRef(propName, props, emit) {
|
|
384
|
+
const groupPropValue = group == null ? void 0 : group[propName];
|
|
385
|
+
if (groupPropValue) {
|
|
386
|
+
return computed({
|
|
387
|
+
get() {
|
|
388
|
+
return groupPropValue.value;
|
|
389
|
+
},
|
|
390
|
+
set(value) {
|
|
391
|
+
groupPropValue.value = value;
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
const propRef = toRef(props, propName);
|
|
396
|
+
return computed({
|
|
397
|
+
get() {
|
|
398
|
+
return propRef.value;
|
|
399
|
+
},
|
|
400
|
+
set(value) {
|
|
401
|
+
if (emit) {
|
|
402
|
+
emit(`update:${propName}`, value);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
return {
|
|
408
|
+
group,
|
|
409
|
+
isInGroup,
|
|
410
|
+
getGroupOrLocalRef
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
const VvCheckboxProps = {
|
|
414
|
+
...CheckboxRadioProps,
|
|
415
|
+
...ModifiersProps,
|
|
416
|
+
/**
|
|
417
|
+
* If true, the input will be indeterminated
|
|
418
|
+
*/
|
|
419
|
+
indeterminate: Boolean,
|
|
420
|
+
/**
|
|
421
|
+
* Value associated with the unchecked state
|
|
422
|
+
*/
|
|
423
|
+
uncheckedValue: [String, Number, Boolean],
|
|
424
|
+
/**
|
|
425
|
+
* If true, the input will be displayed as a switch
|
|
426
|
+
*/
|
|
427
|
+
switch: Boolean
|
|
428
|
+
};
|
|
429
|
+
const VvCheckboxEvents = ["click", "update:modelValue", "change", "blur"];
|
|
430
|
+
function useGroupProps(props, emit) {
|
|
431
|
+
const { group, isInGroup, getGroupOrLocalRef } = useInjectedGroupState(INJECTION_KEY_CHECK_GROUP);
|
|
432
|
+
const { id, switch: propsSwitch, indeterminate } = toRefs(props);
|
|
433
|
+
const modelValue = getGroupOrLocalRef("modelValue", props, emit);
|
|
434
|
+
const valid = getGroupOrLocalRef("valid", props);
|
|
435
|
+
const invalid = getGroupOrLocalRef("invalid", props);
|
|
436
|
+
const readonly = computed(
|
|
437
|
+
() => Boolean(props.readonly || (group == null ? void 0 : group.readonly.value))
|
|
438
|
+
);
|
|
439
|
+
const disabled = computed(
|
|
440
|
+
() => Boolean(props.disabled || (group == null ? void 0 : group.disabled.value))
|
|
441
|
+
);
|
|
442
|
+
return {
|
|
443
|
+
// local props
|
|
444
|
+
id,
|
|
445
|
+
propsSwitch,
|
|
446
|
+
indeterminate,
|
|
447
|
+
// global props
|
|
448
|
+
group,
|
|
449
|
+
isInGroup,
|
|
450
|
+
modelValue,
|
|
451
|
+
valid,
|
|
452
|
+
invalid,
|
|
453
|
+
readonly,
|
|
454
|
+
disabled
|
|
455
|
+
};
|
|
456
|
+
}
|
|
378
457
|
function equals(obj1, obj2, field) {
|
|
379
458
|
if (field) {
|
|
380
459
|
return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
|
|
@@ -454,94 +533,9 @@ function contains(value, list) {
|
|
|
454
533
|
}
|
|
455
534
|
return false;
|
|
456
535
|
}
|
|
457
|
-
function isEmpty(value) {
|
|
458
|
-
return ((value2) => value2 === null || value2 === void 0 || value2 === "" || Array.isArray(value2) && value2.length === 0 || !(value2 instanceof Date) && typeof value2 === "object" && Object.keys(value2).length === 0)(unref(value));
|
|
459
|
-
}
|
|
460
536
|
function isString(value) {
|
|
461
537
|
return typeof value === "string" || value instanceof String;
|
|
462
538
|
}
|
|
463
|
-
function useInjectedGroupState(groupKey) {
|
|
464
|
-
const group = inject(groupKey, void 0);
|
|
465
|
-
const isInGroup = computed(() => !isEmpty(group));
|
|
466
|
-
function getGroupOrLocalRef(propName, props, emit) {
|
|
467
|
-
if (group == null ? void 0 : group.value) {
|
|
468
|
-
const groupPropValue = unref(group.value)[propName];
|
|
469
|
-
return computed({
|
|
470
|
-
get() {
|
|
471
|
-
return groupPropValue == null ? void 0 : groupPropValue.value;
|
|
472
|
-
},
|
|
473
|
-
set(value) {
|
|
474
|
-
groupPropValue.value = value;
|
|
475
|
-
}
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
const propRef = toRef(props, propName);
|
|
479
|
-
return computed({
|
|
480
|
-
get() {
|
|
481
|
-
return propRef.value;
|
|
482
|
-
},
|
|
483
|
-
set(value) {
|
|
484
|
-
if (emit)
|
|
485
|
-
emit(`update:${propName}`, value);
|
|
486
|
-
}
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
return {
|
|
490
|
-
group,
|
|
491
|
-
isInGroup,
|
|
492
|
-
getGroupOrLocalRef
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
const VvCheckboxProps = {
|
|
496
|
-
...CheckboxRadioProps,
|
|
497
|
-
...ModifiersProps,
|
|
498
|
-
/**
|
|
499
|
-
* If true, the input will be indeterminated
|
|
500
|
-
*/
|
|
501
|
-
indeterminate: Boolean,
|
|
502
|
-
/**
|
|
503
|
-
* Value associated with the unchecked state
|
|
504
|
-
*/
|
|
505
|
-
uncheckedValue: [String, Number, Boolean],
|
|
506
|
-
/**
|
|
507
|
-
* If true, the input will be displayed as a switch
|
|
508
|
-
*/
|
|
509
|
-
switch: Boolean
|
|
510
|
-
};
|
|
511
|
-
const VvCheckboxEvents = ["click", "update:modelValue", "change", "blur"];
|
|
512
|
-
function useGroupProps(props, emit) {
|
|
513
|
-
const { group, isInGroup, getGroupOrLocalRef } = useInjectedGroupState(INJECTION_KEY_CHECK_GROUP);
|
|
514
|
-
const { id, switch: propsSwitch, indeterminate } = toRefs(props);
|
|
515
|
-
const modelValue = getGroupOrLocalRef("modelValue", props, emit);
|
|
516
|
-
const valid = getGroupOrLocalRef("valid", props);
|
|
517
|
-
const invalid = getGroupOrLocalRef("invalid", props);
|
|
518
|
-
const readonly = computed(
|
|
519
|
-
() => {
|
|
520
|
-
var _a;
|
|
521
|
-
return Boolean(props.readonly || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.readonly.value));
|
|
522
|
-
}
|
|
523
|
-
);
|
|
524
|
-
const disabled = computed(
|
|
525
|
-
() => {
|
|
526
|
-
var _a;
|
|
527
|
-
return Boolean(props.disabled || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
|
|
528
|
-
}
|
|
529
|
-
);
|
|
530
|
-
return {
|
|
531
|
-
// local props
|
|
532
|
-
id,
|
|
533
|
-
propsSwitch,
|
|
534
|
-
indeterminate,
|
|
535
|
-
// global props
|
|
536
|
-
group,
|
|
537
|
-
isInGroup,
|
|
538
|
-
modelValue,
|
|
539
|
-
valid,
|
|
540
|
-
invalid,
|
|
541
|
-
readonly,
|
|
542
|
-
disabled
|
|
543
|
-
};
|
|
544
|
-
}
|
|
545
539
|
function joinLines(items) {
|
|
546
540
|
if (Array.isArray(items)) {
|
|
547
541
|
return items.filter((item) => isString(item)).join(" ");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("uid")):"function"==typeof define&&define.amd?define(["vue","uid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckbox=t(e.vue,e.uid)}(this,(function(e,t){"use strict";var l=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(l||{}),a=(e=>(e.before="before",e.after="after",e))(a||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{}),o=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(o||{});const i=Symbol.for("volver"),r=Symbol.for("checkGroup"),u={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},d={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},s={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},v={disabled:{type:Boolean,default:!1}},c=(Boolean,Boolean,Boolean,{label:{type:[String,Number],default:void 0}}),f={readonly:{type:Boolean,default:!1}},p={modifiers:{type:[String,Array],default:void 0}},b={hintLabel:{type:String,default:""}};a.before;const h={tabindex:{type:[String,Number],default:0}},m={id:[String,Number]};l.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const y={...{...m,name:{type:String,required:!0}},...h,...u,...d,...b,...v,...f,...p,...c,...s,value:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[Object,Number,Boolean,String],default:void 0}};function
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("uid")):"function"==typeof define&&define.amd?define(["vue","uid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckbox=t(e.vue,e.uid)}(this,(function(e,t){"use strict";var l=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(l||{}),a=(e=>(e.before="before",e.after="after",e))(a||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{}),o=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(o||{});const i=Symbol.for("volver"),r=Symbol.for("checkGroup"),u={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},d={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},s={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},v={disabled:{type:Boolean,default:!1}},c=(Boolean,Boolean,Boolean,{label:{type:[String,Number],default:void 0}}),f={readonly:{type:Boolean,default:!1}},p={modifiers:{type:[String,Array],default:void 0}},b={hintLabel:{type:String,default:""}};a.before;const h={tabindex:{type:[String,Number],default:0}},m={id:[String,Number]};l.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const y={...{...m,name:{type:String,required:!0}},...h,...u,...d,...b,...v,...f,...p,...c,...s,value:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[Object,Number,Boolean,String],default:void 0}};n.button,o.button;const g={...y,...p,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function S(t,l){const{group:a,isInGroup:n,getGroupOrLocalRef:o}=function(t){const l=e.inject(t,void 0),a=e.computed((()=>void 0!==l));return{group:l,isInGroup:a,getGroupOrLocalRef:function(t,a,n){const o=null==l?void 0:l[t];if(o)return e.computed({get:()=>o.value,set(e){o.value=e}});const i=e.toRef(a,t);return e.computed({get:()=>i.value,set(e){n&&n(`update:${t}`,e)}})}}}(r),{id:i,switch:u,indeterminate:d}=e.toRefs(t),s=o("modelValue",t,l),v=o("valid",t),c=o("invalid",t),f=e.computed((()=>Boolean(t.readonly||(null==a?void 0:a.readonly.value)))),p=e.computed((()=>Boolean(t.disabled||(null==a?void 0:a.disabled.value))));return{id:i,propsSwitch:u,indeterminate:d,group:a,isInGroup:n,modelValue:s,valid:v,invalid:c,readonly:f,disabled:p}}function L(e,t,l){return l?B(e,l)===B(t,l):k(e,t)}function k(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),a=Array.isArray(t);let n,o,i;if(l&&a){if(o=e.length,o!=t.length)return!1;for(n=o;0!=n--;)if(!k(e[n],t[n]))return!1;return!0}if(l!=a)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==t.getTime();const d=e instanceof RegExp,s=t instanceof RegExp;if(d!=s)return!1;if(d&&s)return e.toString()==t.toString();const v=Object.keys(e);if(o=v.length,o!==Object.keys(t).length)return!1;for(n=o;0!=n--;)if(!Object.prototype.hasOwnProperty.call(t,v[n]))return!1;for(n=o;0!=n--;)if(i=v[n],!k(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function B(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const l=t.split(".");let a=e;for(let t=0,n=l.length;t<n;++t){if(null==e)return null;a=a[l[t]]}return a}}return null}function O(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}function x(t,l,a){const n=e.inject(i),o=e.computed((()=>{var e;if(n&&(null==(e=n.defaults.value)?void 0:e[t]))return n.defaults.value[t]}));return e.computed((()=>{if(void 0===o.value)return a;const e=o.value,t=l,n=a;return Object.keys(t).reduce(((l,a)=>{const o=n[a];if(l[a]=o,a in e){if(Array.isArray(t[a])){const n=t[a];if(n.length){n[0]===o&&(l[a]=e[a])}}if("function"==typeof t[a]){(0,t[a])()===o&&(l[a]=e[a])}if("object"==typeof t[a]){let n=t[a].default;"function"==typeof n&&(n=n()),"object"==typeof n?JSON.stringify(n)===JSON.stringify(o)&&(l[a]=e[a]):n===o&&(l[a]=e[a])}}return l}),{})}))}const V=["for"],A=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"];return e.defineComponent({name:"VvCheckbox",props:g,emits:["click","update:modelValue","change","blur"],setup(l,{emit:a}){const n=l,o=a,i=e.useSlots(),r=x("VvCheckbox",g,n),{id:u,disabled:d,readonly:s,valid:v,invalid:c,propsSwitch:f,modelValue:p,indeterminate:b,isInGroup:h}=S(n,o),m=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.uid()))))(u),y=e.computed((()=>`${m.value}-hint`)),k=e.computed((()=>j.value?-1:n.tabindex)),B=e.ref(),$=e.computed((()=>void 0!==n.uncheckedValue&&!h.value)),j=e.computed((()=>d.value||s.value)),w=e.computed((()=>!0===c.value||!0!==v.value&&void 0)),R=e.computed((()=>$.value?p.value===n.value:Array.isArray(p.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(L(e,l))return!0;return!1}(n.value,p.value):L(n.value,p.value))),C=e.computed((()=>!!b.value||!(R.value||!$.value||n.uncheckedValue===p.value))),N=e.computed((()=>{if(!$.value)return!["string","number","boolean"].includes(typeof n.value)||n.value})),I=e.computed({get:()=>R.value,set(e){if($.value)p.value=e?n.value:n.uncheckedValue;else if(Array.isArray(p.value)||h.value){const t=new Set(Array.isArray(p.value)?p.value:void 0!==p.value?[p.value]:[]);e?t.add(n.value):t.delete(n.value),p.value=[...t]}else p.value=e?n.value:void 0;o("change",e)}}),{modifiers:P}=e.toRefs(n),E=function(t,l,a){return e.computed((()=>{const n={[t]:!0},o="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return o&&Array.isArray(o)&&o.forEach((e=>{e&&(n[`${t}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((l=>{n[`${t}--${l}`]=e.unref(a.value[l])})),n}))}("vv-checkbox",P,e.computed((()=>({switch:f.value,valid:v.value,invalid:c.value,disabled:d.value,readonly:s.value,indeterminate:b.value}))));e.watchEffect((()=>{$.value&&Array.isArray(p.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>C.value),(e=>{B.value.indeterminate=!!e})),e.onMounted((()=>{C.value&&(B.value.indeterminate=!0)}));const{HintSlot:G,hasHintLabelOrSlot:H,hasInvalidLabelOrSlot:T,hintSlotScope:_}=function(t,l){const a=e.computed((()=>e.isRef(t)?t.value:t)),n=e.computed((()=>O(a.value.invalidLabel))),o=e.computed((()=>O(a.value.validLabel))),i=e.computed((()=>a.value.loadingLabel)),r=e.computed((()=>a.value.hintLabel)),u=e.computed((()=>Boolean(a.value.loading&&(l.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(a.value.invalid&&(l.invalid||n.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(a.value.valid&&(l.valid||o.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),c=e.computed((()=>d.value||s.value||u.value||v.value)),f=e.computed((()=>({modelValue:a.value.modelValue,valid:a.value.valid,invalid:a.value.invalid,loading:a.value.loading}))),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:n,validLabel:o,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,a,n,o,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(n=(a=this.$slots).invalid)?void 0:n.call(a))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(o=this.$slots).valid)?void 0:i.call(o))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:f,HintSlot:p}}(r,i);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(E)),for:e.unref(m)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(m),ref_key:"input",ref:B,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(I)?I.value=t:null),type:"checkbox",class:"vv-checkbox__input",name:t.name,disabled:e.unref(j),value:e.unref(N),tabindex:e.unref(k),"aria-invalid":e.unref(w),"aria-describedby":e.unref(H)?e.unref(y):void 0,"aria-errormessage":e.unref(T)?e.unref(y):void 0},null,8,A),[[e.vModelCheckbox,e.unref(I)]]),e.renderSlot(t.$slots,"default",{value:e.unref(p)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(G),{id:e.unref(y),class:"vv-checkbox__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(_))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(_))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(_))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(_))))])),key:"3"}:void 0]),1032,["id"])],10,V))}})}));
|
|
@@ -131,25 +131,25 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
131
131
|
};
|
|
132
132
|
id: (StringConstructor | NumberConstructor)[];
|
|
133
133
|
}>>, {
|
|
134
|
-
|
|
134
|
+
label: string | number;
|
|
135
|
+
value: string | number | boolean;
|
|
135
136
|
disabled: boolean;
|
|
136
|
-
valid: boolean;
|
|
137
|
-
invalid: boolean;
|
|
138
137
|
modelValue: string | number | boolean | Record<string, any>;
|
|
139
138
|
modifiers: string | string[];
|
|
140
|
-
label: string | number;
|
|
141
|
-
value: string | number | boolean;
|
|
142
139
|
switch: boolean;
|
|
143
140
|
loading: boolean;
|
|
144
141
|
loadingLabel: string;
|
|
145
142
|
indeterminate: boolean;
|
|
143
|
+
readonly: boolean;
|
|
146
144
|
hintLabel: string;
|
|
145
|
+
invalid: boolean;
|
|
147
146
|
invalidLabel: string | unknown[];
|
|
147
|
+
valid: boolean;
|
|
148
148
|
validLabel: string | unknown[];
|
|
149
149
|
tabindex: string | number;
|
|
150
150
|
}, {}>, {
|
|
151
151
|
default?(_: {
|
|
152
|
-
value:
|
|
152
|
+
value: unknown;
|
|
153
153
|
}): any;
|
|
154
154
|
hint?(_: {
|
|
155
155
|
modelValue: unknown;
|
|
@@ -84,9 +84,9 @@ export declare function useGroupProps(props: VvCheckboxPropsTypes, emit: (event:
|
|
|
84
84
|
id: Ref<string | number | undefined> | undefined;
|
|
85
85
|
propsSwitch: Ref<boolean>;
|
|
86
86
|
indeterminate: Ref<boolean>;
|
|
87
|
-
group:
|
|
87
|
+
group: InputGroupState | undefined;
|
|
88
88
|
isInGroup: globalThis.ComputedRef<boolean>;
|
|
89
|
-
modelValue:
|
|
89
|
+
modelValue: Ref<unknown>;
|
|
90
90
|
valid: Ref<boolean>;
|
|
91
91
|
invalid: Ref<boolean>;
|
|
92
92
|
readonly: globalThis.ComputedRef<boolean>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { computed, isRef, defineComponent, h, inject, toRef, toRefs, unref, useSlots, ref, watchEffect, watch, onMounted, openBlock, createElementBlock, normalizeClass, withDirectives, createElementVNode, vModelCheckbox, renderSlot, createTextVNode, toDisplayString, createVNode, createSlots, withCtx, normalizeProps, guardReactiveProps, provide, createCommentVNode, Fragment, renderList, createBlock, mergeProps } from "vue";
|
|
2
2
|
import { uid } from "uid";
|
|
3
3
|
import { useVModel } from "@vueuse/core";
|
|
4
4
|
import { get } from "ts-dot-prop";
|
|
@@ -51,7 +51,9 @@ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
|
51
51
|
return AnchorTarget2;
|
|
52
52
|
})(AnchorTarget || {});
|
|
53
53
|
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
54
|
-
const INJECTION_KEY_CHECK_GROUP = Symbol.for(
|
|
54
|
+
const INJECTION_KEY_CHECK_GROUP = Symbol.for(
|
|
55
|
+
"checkGroup"
|
|
56
|
+
);
|
|
55
57
|
function equals(obj1, obj2, field) {
|
|
56
58
|
if (field) {
|
|
57
59
|
return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
|
|
@@ -131,9 +133,6 @@ function contains(value, list) {
|
|
|
131
133
|
}
|
|
132
134
|
return false;
|
|
133
135
|
}
|
|
134
|
-
function isEmpty(value) {
|
|
135
|
-
return ((value2) => value2 === null || value2 === void 0 || value2 === "" || Array.isArray(value2) && value2.length === 0 || !(value2 instanceof Date) && typeof value2 === "object" && Object.keys(value2).length === 0)(unref(value));
|
|
136
|
-
}
|
|
137
136
|
function isString(value) {
|
|
138
137
|
return typeof value === "string" || value instanceof String;
|
|
139
138
|
}
|
|
@@ -632,13 +631,13 @@ const CheckboxRadioGroupProps = {
|
|
|
632
631
|
});
|
|
633
632
|
function useInjectedGroupState(groupKey) {
|
|
634
633
|
const group = inject(groupKey, void 0);
|
|
635
|
-
const isInGroup = computed(() =>
|
|
634
|
+
const isInGroup = computed(() => group !== void 0);
|
|
636
635
|
function getGroupOrLocalRef(propName, props, emit) {
|
|
637
|
-
|
|
638
|
-
|
|
636
|
+
const groupPropValue = group == null ? void 0 : group[propName];
|
|
637
|
+
if (groupPropValue) {
|
|
639
638
|
return computed({
|
|
640
639
|
get() {
|
|
641
|
-
return groupPropValue
|
|
640
|
+
return groupPropValue.value;
|
|
642
641
|
},
|
|
643
642
|
set(value) {
|
|
644
643
|
groupPropValue.value = value;
|
|
@@ -651,8 +650,9 @@ function useInjectedGroupState(groupKey) {
|
|
|
651
650
|
return propRef.value;
|
|
652
651
|
},
|
|
653
652
|
set(value) {
|
|
654
|
-
if (emit)
|
|
653
|
+
if (emit) {
|
|
655
654
|
emit(`update:${propName}`, value);
|
|
655
|
+
}
|
|
656
656
|
}
|
|
657
657
|
});
|
|
658
658
|
}
|
|
@@ -686,16 +686,10 @@ function useGroupProps(props, emit) {
|
|
|
686
686
|
const valid = getGroupOrLocalRef("valid", props);
|
|
687
687
|
const invalid = getGroupOrLocalRef("invalid", props);
|
|
688
688
|
const readonly = computed(
|
|
689
|
-
() =>
|
|
690
|
-
var _a;
|
|
691
|
-
return Boolean(props.readonly || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.readonly.value));
|
|
692
|
-
}
|
|
689
|
+
() => Boolean(props.readonly || (group == null ? void 0 : group.readonly.value))
|
|
693
690
|
);
|
|
694
691
|
const disabled = computed(
|
|
695
|
-
() =>
|
|
696
|
-
var _a;
|
|
697
|
-
return Boolean(props.disabled || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
|
|
698
|
-
}
|
|
692
|
+
() => Boolean(props.disabled || (group == null ? void 0 : group.disabled.value))
|
|
699
693
|
);
|
|
700
694
|
return {
|
|
701
695
|
// local props
|
|
@@ -994,15 +988,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
994
988
|
});
|
|
995
989
|
const VvCheckboxGroupProps = CheckboxRadioGroupProps;
|
|
996
990
|
const VvCheckboxGroupEvents = ["update:modelValue", "change"];
|
|
997
|
-
function useProvideGroupState(groupState) {
|
|
998
|
-
|
|
999
|
-
(k) => k !== "key" && !isRef(groupState[k])
|
|
1000
|
-
))
|
|
1001
|
-
throw Error("One or more groupState props aren't ref.");
|
|
1002
|
-
provide(
|
|
1003
|
-
groupState.key,
|
|
1004
|
-
computed(() => groupState)
|
|
1005
|
-
);
|
|
991
|
+
function useProvideGroupState(key, groupState) {
|
|
992
|
+
provide(key, groupState);
|
|
1006
993
|
}
|
|
1007
994
|
function useOptions(props) {
|
|
1008
995
|
const { options, labelKey, valueKey, disabledKey } = toRefs(props);
|
|
@@ -1056,8 +1043,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1056
1043
|
);
|
|
1057
1044
|
const modelValue = useVModel(props, "modelValue", emit);
|
|
1058
1045
|
const { disabled, readonly, vertical, valid, invalid, modifiers } = toRefs(props);
|
|
1059
|
-
useProvideGroupState({
|
|
1060
|
-
key: INJECTION_KEY_CHECK_GROUP,
|
|
1046
|
+
useProvideGroupState(INJECTION_KEY_CHECK_GROUP, {
|
|
1061
1047
|
modelValue,
|
|
1062
1048
|
disabled,
|
|
1063
1049
|
readonly,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("uid"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","uid","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=t(e.vue,e.uid,e.core,e.tsDotProp)}(this,(function(e,t,l,a){"use strict";var o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{}),r=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(r||{});const u=Symbol.for("volver"),d=Symbol.for("checkGroup");function s(e,t,l){return l?c(e,l)===c(t,l):v(e,t)}function v(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),a=Array.isArray(t);let o,n,i;if(l&&a){if(n=e.length,n!=t.length)return!1;for(o=n;0!=o--;)if(!v(e[o],t[o]))return!1;return!0}if(l!=a)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==t.getTime();const d=e instanceof RegExp,s=t instanceof RegExp;if(d!=s)return!1;if(d&&s)return e.toString()==t.toString();const c=Object.keys(e);if(n=c.length,n!==Object.keys(t).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,c[o]))return!1;for(o=n;0!=o--;)if(i=c[o],!v(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function c(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const l=t.split(".");let a=e;for(let t=0,o=l.length;t<o;++t){if(null==e)return null;a=a[l[t]]}return a}}return null}function f(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}function p(t,l){const a=e.computed((()=>e.isRef(t)?t.value:t)),o=e.computed((()=>f(a.value.invalidLabel))),n=e.computed((()=>f(a.value.validLabel))),i=e.computed((()=>a.value.loadingLabel)),r=e.computed((()=>a.value.hintLabel)),u=e.computed((()=>Boolean(a.value.loading&&(l.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(a.value.invalid&&(l.invalid||o.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(a.value.valid&&(l.valid||n.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),c=e.computed((()=>d.value||s.value||u.value||v.value)),p=e.computed((()=>({modelValue:a.value.modelValue,valid:a.value.valid,invalid:a.value.invalid,loading:a.value.loading}))),b=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:o,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,a,o,n,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(o=(a=this.$slots).invalid)?void 0:o.call(a))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:p,HintSlot:b}}const b={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},m={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},y={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},h={disabled:{type:Boolean,default:!1}},g=(Boolean,Boolean,Boolean,{label:{type:[String,Number],default:void 0}}),S={readonly:{type:Boolean,default:!1}},k={modifiers:{type:[String,Array],default:void 0}},L={hintLabel:{type:String,default:""}},B={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};n.before;const O={tabindex:{type:[String,Number],default:0}},V={id:[String,Number]};o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const x={...{...V,name:{type:String,required:!0}},...O,...b,...m,...L,...h,...S,...k,...g,...y,value:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[Object,Number,Boolean,String],default:void 0}},$={...b,...m,...B,...L,...h,...S,...k,...g,...y,modelValue:{type:[String,Array,Boolean,Number,Symbol],default:void 0},name:{type:String,required:!0},vertical:{type:Boolean,default:!1}};function A(t){const l=e.inject(t,void 0),a=e.computed((()=>{return t=l,!(null==(a=e.unref(t))||""===a||Array.isArray(a)&&0===a.length||!(a instanceof Date)&&"object"==typeof a&&0===Object.keys(a).length);var t,a}));return{group:l,isInGroup:a,getGroupOrLocalRef:function(t,a,o){if(null==l?void 0:l.value){const a=e.unref(l.value)[t];return e.computed({get:()=>null==a?void 0:a.value,set(e){a.value=e}})}const n=e.toRef(a,t);return e.computed({get:()=>n.value,set(e){o&&o(`update:${t}`,e)}})}}}i.button,r.button;const C={...x,...k,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function j(t,l,a){const o=e.inject(u),n=e.computed((()=>{var e;if(o&&(null==(e=o.defaults.value)?void 0:e[t]))return o.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return a;const e=n.value,t=l,o=a;return Object.keys(t).reduce(((l,a)=>{const n=o[a];if(l[a]=n,a in e){if(Array.isArray(t[a])){const o=t[a];if(o.length){o[0]===n&&(l[a]=e[a])}}if("function"==typeof t[a]){(0,t[a])()===n&&(l[a]=e[a])}if("object"==typeof t[a]){let o=t[a].default;"function"==typeof o&&(o=o()),"object"==typeof o?JSON.stringify(o)===JSON.stringify(n)&&(l[a]=e[a]):o===n&&(l[a]=e[a])}}return l}),{})}))}function w(t,l,a){return e.computed((()=>{const o={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(o[`${t}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((l=>{o[`${t}--${l}`]=e.unref(a.value[l])})),o}))}const R=["for"],P=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],N=e.defineComponent({name:"VvCheckbox",props:C,emits:["click","update:modelValue","change","blur"],setup(l,{emit:a}){const o=l,n=a,i=e.useSlots(),r=j("VvCheckbox",C,o),{id:u,disabled:v,readonly:c,valid:f,invalid:b,propsSwitch:m,modelValue:y,indeterminate:h,isInGroup:g}=function(t,l){const{group:a,isInGroup:o,getGroupOrLocalRef:n}=A(d),{id:i,switch:r,indeterminate:u}=e.toRefs(t),s=n("modelValue",t,l),v=n("valid",t),c=n("invalid",t),f=e.computed((()=>{var e;return Boolean(t.readonly||(null==(e=null==a?void 0:a.value)?void 0:e.readonly.value))})),p=e.computed((()=>{var e;return Boolean(t.disabled||(null==(e=null==a?void 0:a.value)?void 0:e.disabled.value))}));return{id:i,propsSwitch:r,indeterminate:u,group:a,isInGroup:o,modelValue:s,valid:v,invalid:c,readonly:f,disabled:p}}(o,n),S=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.uid()))))(u),k=e.computed((()=>`${S.value}-hint`)),L=e.computed((()=>V.value?-1:o.tabindex)),B=e.ref(),O=e.computed((()=>void 0!==o.uncheckedValue&&!g.value)),V=e.computed((()=>v.value||c.value)),x=e.computed((()=>!0===b.value||!0!==f.value&&void 0)),$=e.computed((()=>O.value?y.value===o.value:Array.isArray(y.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(s(e,l))return!0;return!1}(o.value,y.value):s(o.value,y.value))),N=e.computed((()=>!!h.value||!($.value||!O.value||o.uncheckedValue===y.value))),E=e.computed((()=>{if(!O.value)return!["string","number","boolean"].includes(typeof o.value)||o.value})),_=e.computed({get:()=>$.value,set(e){if(O.value)y.value=e?o.value:o.uncheckedValue;else if(Array.isArray(y.value)||g.value){const t=new Set(Array.isArray(y.value)?y.value:void 0!==y.value?[y.value]:[]);e?t.add(o.value):t.delete(o.value),y.value=[...t]}else y.value=e?o.value:void 0;n("change",e)}}),{modifiers:z}=e.toRefs(o),G=w("vv-checkbox",z,e.computed((()=>({switch:m.value,valid:f.value,invalid:b.value,disabled:v.value,readonly:c.value,indeterminate:h.value}))));e.watchEffect((()=>{O.value&&Array.isArray(y.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>N.value),(e=>{B.value.indeterminate=!!e})),e.onMounted((()=>{N.value&&(B.value.indeterminate=!0)}));const{HintSlot:I,hasHintLabelOrSlot:D,hasInvalidLabelOrSlot:H,hintSlotScope:q}=p(r,i);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(G)),for:e.unref(S)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(S),ref_key:"input",ref:B,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(_)?_.value=t:null),type:"checkbox",class:"vv-checkbox__input",name:t.name,disabled:e.unref(V),value:e.unref(E),tabindex:e.unref(L),"aria-invalid":e.unref(x),"aria-describedby":e.unref(D)?e.unref(k):void 0,"aria-errormessage":e.unref(H)?e.unref(k):void 0},null,8,P),[[e.vModelCheckbox,e.unref(_)]]),e.renderSlot(t.$slots,"default",{value:e.unref(y)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(I),{id:e.unref(k),class:"vv-checkbox__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(q))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(q))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(q))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(q))))])),key:"3"}:void 0]),1032,["id"])],10,R))}}),E=$;const _=["textContent"],z={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:E,emits:["update:modelValue","change"],setup(t,{emit:o}){const n=t,i=o,r=e.useSlots(),u=j("VvCheckboxGroup",E,n),s=l.useVModel(n,"modelValue",i),{disabled:v,readonly:c,vertical:f,valid:b,invalid:m,modifiers:y}=e.toRefs(n);!function(t){if(Object.keys(t).some((l=>"key"!==l&&!e.isRef(t[l]))))throw Error("One or more groupState props aren't ref.");e.provide(t.key,e.computed((()=>t)))}({key:d,modelValue:s,disabled:v,readonly:c,valid:b,invalid:m});const{getOptionLabel:h,getOptionValue:g}=function(t){const{options:l,labelKey:o,valueKey:n,disabledKey:i}=e.toRefs(t);return{options:l,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:String("function"==typeof o.value?o.value(e):a.get(e,o.value)),getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof n.value?n.value(e):a.get(e,n.value),isOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof i.value?i.value(e):a.get(e,i.value)),getOptionGrouped:e=>"object"!=typeof e&&null!==e?[]:e.options||[]}}(n),S=w("vv-checkbox-group",y,e.computed((()=>({disabled:v.value,readonly:c.value,horizontal:!f.value,valid:b.value,invalid:m.value})))),{HintSlot:k,hintSlotScope:L}=p(u,r);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(S))},[t.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(t.label)},null,8,_)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",z,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,((t,l)=>(e.openBlock(),e.createBlock(N,e.mergeProps({key:l},((e,t)=>({id:`${n.name}_opt${t}`,name:n.name,label:h(e),value:g(e)}))(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(k),{class:"vv-checkbox-group__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(L))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(L))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(L))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(L))))])),key:"3"}:void 0]),1024)],2))}})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("uid"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","uid","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=t(e.vue,e.uid,e.core,e.tsDotProp)}(this,(function(e,t,l,a){"use strict";var o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{}),r=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(r||{});const u=Symbol.for("volver"),d=Symbol.for("checkGroup");function s(e,t,l){return l?c(e,l)===c(t,l):v(e,t)}function v(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),a=Array.isArray(t);let o,n,i;if(l&&a){if(n=e.length,n!=t.length)return!1;for(o=n;0!=o--;)if(!v(e[o],t[o]))return!1;return!0}if(l!=a)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==t.getTime();const d=e instanceof RegExp,s=t instanceof RegExp;if(d!=s)return!1;if(d&&s)return e.toString()==t.toString();const c=Object.keys(e);if(n=c.length,n!==Object.keys(t).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,c[o]))return!1;for(o=n;0!=o--;)if(i=c[o],!v(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function c(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const l=t.split(".");let a=e;for(let t=0,o=l.length;t<o;++t){if(null==e)return null;a=a[l[t]]}return a}}return null}function f(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}function p(t,l){const a=e.computed((()=>e.isRef(t)?t.value:t)),o=e.computed((()=>f(a.value.invalidLabel))),n=e.computed((()=>f(a.value.validLabel))),i=e.computed((()=>a.value.loadingLabel)),r=e.computed((()=>a.value.hintLabel)),u=e.computed((()=>Boolean(a.value.loading&&(l.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(a.value.invalid&&(l.invalid||o.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(a.value.valid&&(l.valid||n.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),c=e.computed((()=>d.value||s.value||u.value||v.value)),p=e.computed((()=>({modelValue:a.value.modelValue,valid:a.value.valid,invalid:a.value.invalid,loading:a.value.loading}))),b=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:o,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,a,o,n,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(o=(a=this.$slots).invalid)?void 0:o.call(a))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:p,HintSlot:b}}const b={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},m={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},h={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},y={disabled:{type:Boolean,default:!1}},g=(Boolean,Boolean,Boolean,{label:{type:[String,Number],default:void 0}}),S={readonly:{type:Boolean,default:!1}},k={modifiers:{type:[String,Array],default:void 0}},L={hintLabel:{type:String,default:""}},B={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};n.before;const V={tabindex:{type:[String,Number],default:0}},x={id:[String,Number]};o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const O={...{...x,name:{type:String,required:!0}},...V,...b,...m,...L,...y,...S,...k,...g,...h,value:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[Object,Number,Boolean,String],default:void 0}},$={...b,...m,...B,...L,...y,...S,...k,...g,...h,modelValue:{type:[String,Array,Boolean,Number,Symbol],default:void 0},name:{type:String,required:!0},vertical:{type:Boolean,default:!1}};i.button,r.button;const A={...O,...k,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function C(t,l){const{group:a,isInGroup:o,getGroupOrLocalRef:n}=function(t){const l=e.inject(t,void 0),a=e.computed((()=>void 0!==l));return{group:l,isInGroup:a,getGroupOrLocalRef:function(t,a,o){const n=null==l?void 0:l[t];if(n)return e.computed({get:()=>n.value,set(e){n.value=e}});const i=e.toRef(a,t);return e.computed({get:()=>i.value,set(e){o&&o(`update:${t}`,e)}})}}}(d),{id:i,switch:r,indeterminate:u}=e.toRefs(t),s=n("modelValue",t,l),v=n("valid",t),c=n("invalid",t),f=e.computed((()=>Boolean(t.readonly||(null==a?void 0:a.readonly.value)))),p=e.computed((()=>Boolean(t.disabled||(null==a?void 0:a.disabled.value))));return{id:i,propsSwitch:r,indeterminate:u,group:a,isInGroup:o,modelValue:s,valid:v,invalid:c,readonly:f,disabled:p}}function w(t,l,a){const o=e.inject(u),n=e.computed((()=>{var e;if(o&&(null==(e=o.defaults.value)?void 0:e[t]))return o.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return a;const e=n.value,t=l,o=a;return Object.keys(t).reduce(((l,a)=>{const n=o[a];if(l[a]=n,a in e){if(Array.isArray(t[a])){const o=t[a];if(o.length){o[0]===n&&(l[a]=e[a])}}if("function"==typeof t[a]){(0,t[a])()===n&&(l[a]=e[a])}if("object"==typeof t[a]){let o=t[a].default;"function"==typeof o&&(o=o()),"object"==typeof o?JSON.stringify(o)===JSON.stringify(n)&&(l[a]=e[a]):o===n&&(l[a]=e[a])}}return l}),{})}))}function j(t,l,a){return e.computed((()=>{const o={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(o[`${t}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((l=>{o[`${t}--${l}`]=e.unref(a.value[l])})),o}))}const P=["for"],R=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],N=e.defineComponent({name:"VvCheckbox",props:A,emits:["click","update:modelValue","change","blur"],setup(l,{emit:a}){const o=l,n=a,i=e.useSlots(),r=w("VvCheckbox",A,o),{id:u,disabled:d,readonly:v,valid:c,invalid:f,propsSwitch:b,modelValue:m,indeterminate:h,isInGroup:y}=C(o,n),g=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.uid()))))(u),S=e.computed((()=>`${g.value}-hint`)),k=e.computed((()=>V.value?-1:o.tabindex)),L=e.ref(),B=e.computed((()=>void 0!==o.uncheckedValue&&!y.value)),V=e.computed((()=>d.value||v.value)),x=e.computed((()=>!0===f.value||!0!==c.value&&void 0)),O=e.computed((()=>B.value?m.value===o.value:Array.isArray(m.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(s(e,l))return!0;return!1}(o.value,m.value):s(o.value,m.value))),$=e.computed((()=>!!h.value||!(O.value||!B.value||o.uncheckedValue===m.value))),N=e.computed((()=>{if(!B.value)return!["string","number","boolean"].includes(typeof o.value)||o.value})),_=e.computed({get:()=>O.value,set(e){if(B.value)m.value=e?o.value:o.uncheckedValue;else if(Array.isArray(m.value)||y.value){const t=new Set(Array.isArray(m.value)?m.value:void 0!==m.value?[m.value]:[]);e?t.add(o.value):t.delete(o.value),m.value=[...t]}else m.value=e?o.value:void 0;n("change",e)}}),{modifiers:z}=e.toRefs(o),E=j("vv-checkbox",z,e.computed((()=>({switch:b.value,valid:c.value,invalid:f.value,disabled:d.value,readonly:v.value,indeterminate:h.value}))));e.watchEffect((()=>{B.value&&Array.isArray(m.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>$.value),(e=>{L.value.indeterminate=!!e})),e.onMounted((()=>{$.value&&(L.value.indeterminate=!0)}));const{HintSlot:G,hasHintLabelOrSlot:I,hasInvalidLabelOrSlot:D,hintSlotScope:H}=p(r,i);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(E)),for:e.unref(g)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(g),ref_key:"input",ref:L,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(_)?_.value=t:null),type:"checkbox",class:"vv-checkbox__input",name:t.name,disabled:e.unref(V),value:e.unref(N),tabindex:e.unref(k),"aria-invalid":e.unref(x),"aria-describedby":e.unref(I)?e.unref(S):void 0,"aria-errormessage":e.unref(D)?e.unref(S):void 0},null,8,R),[[e.vModelCheckbox,e.unref(_)]]),e.renderSlot(t.$slots,"default",{value:e.unref(m)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(G),{id:e.unref(S),class:"vv-checkbox__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"3"}:void 0]),1032,["id"])],10,P))}}),_=$;const z=["textContent"],E={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:_,emits:["update:modelValue","change"],setup(t,{emit:o}){const n=t,i=o,r=e.useSlots(),u=w("VvCheckboxGroup",_,n),s=l.useVModel(n,"modelValue",i),{disabled:v,readonly:c,vertical:f,valid:b,invalid:m,modifiers:h}=e.toRefs(n);var y,g;y=d,g={modelValue:s,disabled:v,readonly:c,valid:b,invalid:m},e.provide(y,g);const{getOptionLabel:S,getOptionValue:k}=function(t){const{options:l,labelKey:o,valueKey:n,disabledKey:i}=e.toRefs(t);return{options:l,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:String("function"==typeof o.value?o.value(e):a.get(e,o.value)),getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof n.value?n.value(e):a.get(e,n.value),isOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof i.value?i.value(e):a.get(e,i.value)),getOptionGrouped:e=>"object"!=typeof e&&null!==e?[]:e.options||[]}}(n),L=j("vv-checkbox-group",h,e.computed((()=>({disabled:v.value,readonly:c.value,horizontal:!f.value,valid:b.value,invalid:m.value})))),{HintSlot:B,hintSlotScope:V}=p(u,r);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(L))},[t.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(t.label)},null,8,z)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",E,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,((t,l)=>(e.openBlock(),e.createBlock(N,e.mergeProps({key:l},((e,t)=>({id:`${n.name}_opt${t}`,name:n.name,label:S(e),value:k(e)}))(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(B),{class:"vv-checkbox-group__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(V))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(V))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(V))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(V))))])),key:"3"}:void 0]),1024)],2))}})}));
|
|
@@ -148,18 +148,18 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
148
148
|
default: undefined;
|
|
149
149
|
};
|
|
150
150
|
}>>, {
|
|
151
|
-
|
|
151
|
+
options: (string | Option)[];
|
|
152
|
+
label: string | number;
|
|
152
153
|
disabled: boolean;
|
|
153
|
-
valid: boolean;
|
|
154
|
-
invalid: boolean;
|
|
155
154
|
modelValue: string | number | boolean | symbol | unknown[];
|
|
156
155
|
modifiers: string | string[];
|
|
157
|
-
options: (string | Option)[];
|
|
158
|
-
label: string | number;
|
|
159
156
|
loading: boolean;
|
|
160
157
|
loadingLabel: string;
|
|
158
|
+
readonly: boolean;
|
|
161
159
|
hintLabel: string;
|
|
160
|
+
invalid: boolean;
|
|
162
161
|
invalidLabel: string | unknown[];
|
|
162
|
+
valid: boolean;
|
|
163
163
|
validLabel: string | unknown[];
|
|
164
164
|
vertical: boolean;
|
|
165
165
|
labelKey: string | Function;
|
|
@@ -70,7 +70,9 @@ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
|
70
70
|
return AnchorTarget2;
|
|
71
71
|
})(AnchorTarget || {});
|
|
72
72
|
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
73
|
-
const INJECTION_KEY_BUTTON_GROUP = Symbol.for(
|
|
73
|
+
const INJECTION_KEY_BUTTON_GROUP = Symbol.for(
|
|
74
|
+
"buttonGroup"
|
|
75
|
+
);
|
|
74
76
|
const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for(
|
|
75
77
|
"dropdownTrigger"
|
|
76
78
|
);
|
|
@@ -2206,13 +2208,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
2206
2208
|
});
|
|
2207
2209
|
function useInjectedGroupState(groupKey) {
|
|
2208
2210
|
const group = inject(groupKey, void 0);
|
|
2209
|
-
const isInGroup = computed(() =>
|
|
2211
|
+
const isInGroup = computed(() => group !== void 0);
|
|
2210
2212
|
function getGroupOrLocalRef(propName, props, emit) {
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
+
const groupPropValue = group == null ? void 0 : group[propName];
|
|
2214
|
+
if (groupPropValue) {
|
|
2213
2215
|
return computed({
|
|
2214
2216
|
get() {
|
|
2215
|
-
return groupPropValue
|
|
2217
|
+
return groupPropValue.value;
|
|
2216
2218
|
},
|
|
2217
2219
|
set(value) {
|
|
2218
2220
|
groupPropValue.value = value;
|
|
@@ -2225,8 +2227,9 @@ function useInjectedGroupState(groupKey) {
|
|
|
2225
2227
|
return propRef.value;
|
|
2226
2228
|
},
|
|
2227
2229
|
set(value) {
|
|
2228
|
-
if (emit)
|
|
2230
|
+
if (emit) {
|
|
2229
2231
|
emit(`update:${propName}`, value);
|
|
2232
|
+
}
|
|
2230
2233
|
}
|
|
2231
2234
|
});
|
|
2232
2235
|
}
|
|
@@ -2290,14 +2293,11 @@ function useGroupProps(props, emit) {
|
|
|
2290
2293
|
const { id, iconPosition, icon, label, pressed } = toRefs(props);
|
|
2291
2294
|
const modelValue = getGroupOrLocalRef("modelValue", props, emit);
|
|
2292
2295
|
const toggle = getGroupOrLocalRef("toggle", props);
|
|
2293
|
-
const unselectable = getGroupOrLocalRef(
|
|
2294
|
-
|
|
2295
|
-
props
|
|
2296
|
-
);
|
|
2297
|
-
const multiple = computed(() => (group == null ? void 0 : group.value.multiple.value) ?? false);
|
|
2296
|
+
const unselectable = getGroupOrLocalRef("unselectable", props);
|
|
2297
|
+
const multiple = computed(() => (group == null ? void 0 : group.multiple.value) ?? false);
|
|
2298
2298
|
const modifiers = computed(() => {
|
|
2299
2299
|
let localModifiers = props.modifiers;
|
|
2300
|
-
let groupModifiers = group == null ? void 0 : group.
|
|
2300
|
+
let groupModifiers = group == null ? void 0 : group.modifiers.value;
|
|
2301
2301
|
const toReturn = /* @__PURE__ */ new Set();
|
|
2302
2302
|
if (localModifiers) {
|
|
2303
2303
|
if (!Array.isArray(localModifiers)) {
|
|
@@ -2314,10 +2314,7 @@ function useGroupProps(props, emit) {
|
|
|
2314
2314
|
return Array.from(toReturn);
|
|
2315
2315
|
});
|
|
2316
2316
|
const disabled = computed(
|
|
2317
|
-
() =>
|
|
2318
|
-
var _a;
|
|
2319
|
-
return Boolean(props.disabled || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
|
|
2320
|
-
}
|
|
2317
|
+
() => Boolean(props.disabled || (group == null ? void 0 : group.disabled.value))
|
|
2321
2318
|
);
|
|
2322
2319
|
return {
|
|
2323
2320
|
// group props
|