@wfrog/vc-ui 1.0.0
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/README.md +95 -0
- package/dist/es/chunk/-EkpfdcW.mjs +1100 -0
- package/dist/es/chunk/8rLUmOVR.mjs +29 -0
- package/dist/es/chunk/B-rxnVJv.mjs +3 -0
- package/dist/es/chunk/BAGoDD49.mjs +36 -0
- package/dist/es/chunk/BAtns-Mc.mjs +96 -0
- package/dist/es/chunk/BJS5Pdfp.mjs +55 -0
- package/dist/es/chunk/BMzd-IS6.mjs +900 -0
- package/dist/es/chunk/BWcCXRRK.mjs +229 -0
- package/dist/es/chunk/BX-Ogf7p.mjs +3743 -0
- package/dist/es/chunk/B_tU9Nax.mjs +49 -0
- package/dist/es/chunk/BdDihk0t.mjs +3420 -0
- package/dist/es/chunk/C2LgraHx.mjs +489 -0
- package/dist/es/chunk/C5hWsUfD.mjs +64 -0
- package/dist/es/chunk/C7iSSBUr.mjs +303 -0
- package/dist/es/chunk/CD98REcR.mjs +666 -0
- package/dist/es/chunk/CEClY-_T.mjs +445 -0
- package/dist/es/chunk/CEm0brzD.mjs +35 -0
- package/dist/es/chunk/CMABHk8B.mjs +1942 -0
- package/dist/es/chunk/CS4VKsqy.mjs +19 -0
- package/dist/es/chunk/CVlj9F0I.mjs +291 -0
- package/dist/es/chunk/CZ4ggqDE.mjs +140 -0
- package/dist/es/chunk/CaTfZePA.mjs +533 -0
- package/dist/es/chunk/Ce9ApjrT.mjs +201 -0
- package/dist/es/chunk/ClZGuAIb.mjs +10 -0
- package/dist/es/chunk/Coex0GxM.mjs +450 -0
- package/dist/es/chunk/Ct6q2FXg.mjs +5 -0
- package/dist/es/chunk/CyxEcbcy.mjs +29 -0
- package/dist/es/chunk/D389hx_T.mjs +35 -0
- package/dist/es/chunk/D3DXeVfC.mjs +1171 -0
- package/dist/es/chunk/D3uV7vm-.mjs +45 -0
- package/dist/es/chunk/D5259bwd.mjs +50 -0
- package/dist/es/chunk/DMHNh_tw.mjs +49 -0
- package/dist/es/chunk/DVNTpOBR.mjs +4 -0
- package/dist/es/chunk/DZACQ9LT.mjs +95 -0
- package/dist/es/chunk/De_EXLIy.mjs +22 -0
- package/dist/es/chunk/Dh4jaUSg.mjs +89 -0
- package/dist/es/chunk/DhhdKtyu.mjs +439 -0
- package/dist/es/chunk/DqUIKX7f.mjs +2039 -0
- package/dist/es/chunk/Dqz1zvKN.mjs +59 -0
- package/dist/es/chunk/Dvi7RsXg.mjs +727 -0
- package/dist/es/chunk/DyDMGLoF.mjs +123 -0
- package/dist/es/chunk/E_WRn0OP.mjs +449 -0
- package/dist/es/chunk/Fo0dZYnz.mjs +128 -0
- package/dist/es/chunk/HSv8BL8o.mjs +72 -0
- package/dist/es/chunk/JCIyOUEY.mjs +105 -0
- package/dist/es/chunk/O-uhUKF4.mjs +43 -0
- package/dist/es/chunk/Spa-JKB4.mjs +1046 -0
- package/dist/es/chunk/VAdRxe-1.mjs +16 -0
- package/dist/es/chunk/VCrtRnxt.mjs +1477 -0
- package/dist/es/chunk/ViP2SEY4.mjs +211 -0
- package/dist/es/chunk/aibQ9WSZ.mjs +249 -0
- package/dist/es/chunk/nWBcrYxV.mjs +690 -0
- package/dist/es/chunk/pcqpp-6-.mjs +9 -0
- package/dist/es/chunk/qY9OvNHY.mjs +283 -0
- package/dist/es/chunk/su2Zrql0.mjs +53 -0
- package/dist/es/chunk/zfg5SOj1.mjs +138 -0
- package/dist/es/components/awesome-icon/awesome-icon.d.ts +6 -0
- package/dist/es/components/awesome-icon/awesome-icon.mjs +41 -0
- package/dist/es/components/awesome-icon/awesome-icon.vue.d.ts +5 -0
- package/dist/es/components/awesome-icon/index.d.ts +4 -0
- package/dist/es/components/awesome-icon/index.mjs +6 -0
- package/dist/es/components/backbottom/backbottom.d.ts +7 -0
- package/dist/es/components/backbottom/backbottom.mjs +172 -0
- package/dist/es/components/backbottom/backbottom.vue.d.ts +7 -0
- package/dist/es/components/backbottom/components/child.vue.d.ts +30 -0
- package/dist/es/components/backbottom/index.d.ts +4 -0
- package/dist/es/components/backbottom/index.mjs +6 -0
- package/dist/es/components/button/button.d.ts +18 -0
- package/dist/es/components/button/button.mjs +313 -0
- package/dist/es/components/button/button.vue.d.ts +33 -0
- package/dist/es/components/button/index.css +9 -0
- package/dist/es/components/button/index.d.ts +4 -0
- package/dist/es/components/button/index.mjs +6 -0
- package/dist/es/components/cdn-tag.vue.d.ts +5 -0
- package/dist/es/components/chat-container/chat-container.d.ts +9 -0
- package/dist/es/components/chat-container/chat-container.mjs +77 -0
- package/dist/es/components/chat-container/chat-container.vue.d.ts +29 -0
- package/dist/es/components/chat-container/index.css +9 -0
- package/dist/es/components/chat-container/index.d.ts +4 -0
- package/dist/es/components/chat-container/index.mjs +6 -0
- package/dist/es/components/choice/choice.d.ts +6 -0
- package/dist/es/components/choice/choice.mjs +53 -0
- package/dist/es/components/choice/choice.vue.d.ts +5 -0
- package/dist/es/components/choice/index.css +7 -0
- package/dist/es/components/choice/index.d.ts +4 -0
- package/dist/es/components/choice/index.mjs +6 -0
- package/dist/es/components/choice-boolean/choice-boolean.d.ts +5 -0
- package/dist/es/components/choice-boolean/choice-boolean.mjs +32 -0
- package/dist/es/components/choice-boolean/choice-boolean.vue.d.ts +10 -0
- package/dist/es/components/choice-boolean/index.d.ts +4 -0
- package/dist/es/components/choice-boolean/index.mjs +6 -0
- package/dist/es/components/config-provider/config-provider.d.ts +16 -0
- package/dist/es/components/config-provider/config-provider.mjs +29 -0
- package/dist/es/components/config-provider/config-provider.vue.d.ts +18 -0
- package/dist/es/components/config-provider/config-provider2.mjs +6 -0
- package/dist/es/components/config-provider/index.d.ts +4 -0
- package/dist/es/components/config-provider/index.mjs +6 -0
- package/dist/es/components/cropper/cropper.d.ts +12 -0
- package/dist/es/components/cropper/cropper.mjs +333 -0
- package/dist/es/components/cropper/cropper.vue.d.ts +32 -0
- package/dist/es/components/cropper/index.css +4 -0
- package/dist/es/components/cropper/index.d.ts +4 -0
- package/dist/es/components/cropper/index.mjs +6 -0
- package/dist/es/components/currency/currency.d.ts +21 -0
- package/dist/es/components/currency/currency.mjs +185 -0
- package/dist/es/components/currency/currency.vue.d.ts +14 -0
- package/dist/es/components/currency/index.css +8 -0
- package/dist/es/components/currency/index.d.ts +4 -0
- package/dist/es/components/currency/index.mjs +6 -0
- package/dist/es/components/daterange-picker/daterange-picker.d.ts +6 -0
- package/dist/es/components/daterange-picker/daterange-picker.mjs +5550 -0
- package/dist/es/components/daterange-picker/daterange-picker.vue.d.ts +13 -0
- package/dist/es/components/daterange-picker/index.d.ts +4 -0
- package/dist/es/components/daterange-picker/index.mjs +6 -0
- package/dist/es/components/dialog/dialog.d.ts +13 -0
- package/dist/es/components/dialog/dialog.mjs +537 -0
- package/dist/es/components/dialog/dialog.vue.d.ts +38 -0
- package/dist/es/components/dialog/index.css +87 -0
- package/dist/es/components/dialog/index.d.ts +4 -0
- package/dist/es/components/dialog/index.mjs +6 -0
- package/dist/es/components/dialog-camera-upload/dialog-camera-upload.d.ts +33 -0
- package/dist/es/components/dialog-camera-upload/dialog-camera-upload.mjs +412 -0
- package/dist/es/components/dialog-camera-upload/dialog-camera-upload.vue.d.ts +23 -0
- package/dist/es/components/dialog-camera-upload/index.css +66 -0
- package/dist/es/components/dialog-camera-upload/index.d.ts +4 -0
- package/dist/es/components/dialog-camera-upload/index.mjs +6 -0
- package/dist/es/components/dialog-map-point/dialog-map-point.d.ts +9 -0
- package/dist/es/components/dialog-map-point/dialog-map-point.mjs +183 -0
- package/dist/es/components/dialog-map-point/dialog-map-point.vue.d.ts +22 -0
- package/dist/es/components/dialog-map-point/index.css +11 -0
- package/dist/es/components/dialog-map-point/index.d.ts +4 -0
- package/dist/es/components/dialog-map-point/index.mjs +6 -0
- package/dist/es/components/dialog-upload-images/dialog-upload-images.d.ts +16 -0
- package/dist/es/components/dialog-upload-images/dialog-upload-images.mjs +1391 -0
- package/dist/es/components/dialog-upload-images/dialog-upload-images.vue.d.ts +19 -0
- package/dist/es/components/dialog-upload-images/index.css +62 -0
- package/dist/es/components/dialog-upload-images/index.d.ts +4 -0
- package/dist/es/components/dialog-upload-images/index.mjs +6 -0
- package/dist/es/components/document.vue.d.ts +14 -0
- package/dist/es/components/drawer/drawer.d.ts +7 -0
- package/dist/es/components/drawer/drawer.mjs +412 -0
- package/dist/es/components/drawer/drawer.vue.d.ts +31 -0
- package/dist/es/components/drawer/index.css +56 -0
- package/dist/es/components/drawer/index.d.ts +4 -0
- package/dist/es/components/drawer/index.mjs +6 -0
- package/dist/es/components/easy-pagination/easy-pagination.d.ts +8 -0
- package/dist/es/components/easy-pagination/easy-pagination.mjs +74 -0
- package/dist/es/components/easy-pagination/easy-pagination.vue.d.ts +19 -0
- package/dist/es/components/easy-pagination/index.css +10 -0
- package/dist/es/components/easy-pagination/index.d.ts +4 -0
- package/dist/es/components/easy-pagination/index.mjs +6 -0
- package/dist/es/components/el-icon/el-icon.d.ts +6 -0
- package/dist/es/components/el-icon/el-icon.mjs +46 -0
- package/dist/es/components/el-icon/el-icon.vue.d.ts +6 -0
- package/dist/es/components/el-icon/index.css +7 -0
- package/dist/es/components/el-icon/index.d.ts +4 -0
- package/dist/es/components/el-icon/index.mjs +6 -0
- package/dist/es/components/example-wrapper.vue.d.ts +19 -0
- package/dist/es/components/flag/flag.mjs +44 -0
- package/dist/es/components/flag/flag.vue.d.ts +5 -0
- package/dist/es/components/flag/flags.d.ts +8 -0
- package/dist/es/components/flag/index.d.ts +4 -0
- package/dist/es/components/flag/index.mjs +6 -0
- package/dist/es/components/icon/icon.d.ts +6 -0
- package/dist/es/components/icon/icon.mjs +54 -0
- package/dist/es/components/icon/icon.vue.d.ts +3 -0
- package/dist/es/components/icon/icon2.mjs +27 -0
- package/dist/es/components/icon/index.css +9 -0
- package/dist/es/components/icon/index.d.ts +4 -0
- package/dist/es/components/icon/index.mjs +6 -0
- package/dist/es/components/image/image.d.ts +16 -0
- package/dist/es/components/image/image.mjs +167 -0
- package/dist/es/components/image/image.vue.d.ts +206 -0
- package/dist/es/components/image/index.css +20 -0
- package/dist/es/components/image/index.d.ts +4 -0
- package/dist/es/components/image/index.mjs +6 -0
- package/dist/es/components/input/index.css +9 -0
- package/dist/es/components/input/index.d.ts +4 -0
- package/dist/es/components/input/index.mjs +6 -0
- package/dist/es/components/input/input.d.ts +4 -0
- package/dist/es/components/input/input.mjs +85 -0
- package/dist/es/components/input/input.vue.d.ts +1232 -0
- package/dist/es/components/input-number/index.css +24 -0
- package/dist/es/components/input-number/index.d.ts +4 -0
- package/dist/es/components/input-number/index.mjs +6 -0
- package/dist/es/components/input-number/input-number.d.ts +8 -0
- package/dist/es/components/input-number/input-number.mjs +137 -0
- package/dist/es/components/input-number/input-number.vue.d.ts +35 -0
- package/dist/es/components/pca-picker/components/c.vue.d.ts +123 -0
- package/dist/es/components/pca-picker/components/elevator-item.vue.d.ts +7 -0
- package/dist/es/components/pca-picker/components/filter.vue.d.ts +2 -0
- package/dist/es/components/pca-picker/components/history.vue.d.ts +2 -0
- package/dist/es/components/pca-picker/components/hot.vue.d.ts +2 -0
- package/dist/es/components/pca-picker/components/p.vue.d.ts +2 -0
- package/dist/es/components/pca-picker/components/pca.vue.d.ts +9 -0
- package/dist/es/components/pca-picker/index.css +107 -0
- package/dist/es/components/pca-picker/index.d.ts +4 -0
- package/dist/es/components/pca-picker/index.mjs +6 -0
- package/dist/es/components/pca-picker/pca-picker.d.ts +78 -0
- package/dist/es/components/pca-picker/pca-picker.mjs +1667 -0
- package/dist/es/components/pca-picker/pca-picker.vue.d.ts +583 -0
- package/dist/es/components/qr-code/index.d.ts +4 -0
- package/dist/es/components/qr-code/index.mjs +6 -0
- package/dist/es/components/qr-code/qr-code.d.ts +9 -0
- package/dist/es/components/qr-code/qr-code.mjs +69 -0
- package/dist/es/components/qr-code/qr-code.vue.d.ts +13 -0
- package/dist/es/components/screenfull/index.css +14 -0
- package/dist/es/components/screenfull/index.d.ts +4 -0
- package/dist/es/components/screenfull/index.mjs +6 -0
- package/dist/es/components/screenfull/screenfull.d.ts +4 -0
- package/dist/es/components/screenfull/screenfull.mjs +91 -0
- package/dist/es/components/screenfull/screenfull.vue.d.ts +20 -0
- package/dist/es/components/select/index.css +9 -0
- package/dist/es/components/select/index.d.ts +4 -0
- package/dist/es/components/select/index.mjs +6 -0
- package/dist/es/components/select/select.d.ts +6 -0
- package/dist/es/components/select/select.mjs +63 -0
- package/dist/es/components/select/select.vue.d.ts +6 -0
- package/dist/es/components/single-player/index.css +45 -0
- package/dist/es/components/single-player/index.d.ts +4 -0
- package/dist/es/components/single-player/index.mjs +6 -0
- package/dist/es/components/single-player/single-player.d.ts +4 -0
- package/dist/es/components/single-player/single-player.mjs +1172 -0
- package/dist/es/components/single-player/single-player.vue.d.ts +13 -0
- package/dist/es/components/svg-icon/index.css +9 -0
- package/dist/es/components/svg-icon/index.d.ts +4 -0
- package/dist/es/components/svg-icon/index.mjs +6 -0
- package/dist/es/components/svg-icon/svg-icon.d.ts +5 -0
- package/dist/es/components/svg-icon/svg-icon.mjs +46 -0
- package/dist/es/components/svg-icon/svg-icon.vue.d.ts +18 -0
- package/dist/es/components/switch/index.css +15 -0
- package/dist/es/components/switch/index.d.ts +4 -0
- package/dist/es/components/switch/index.mjs +6 -0
- package/dist/es/components/switch/switch.d.ts +9 -0
- package/dist/es/components/switch/switch.mjs +82 -0
- package/dist/es/components/switch/switch.vue.d.ts +14 -0
- package/dist/es/components/sync-scroll-container/index.css +82 -0
- package/dist/es/components/sync-scroll-container/index.d.ts +4 -0
- package/dist/es/components/sync-scroll-container/index.mjs +6 -0
- package/dist/es/components/sync-scroll-container/sync-scroll-container.d.ts +6 -0
- package/dist/es/components/sync-scroll-container/sync-scroll-container.mjs +157 -0
- package/dist/es/components/sync-scroll-container/sync-scroll-container.vue.d.ts +36 -0
- package/dist/es/components/tags/index.css +17 -0
- package/dist/es/components/tags/index.d.ts +4 -0
- package/dist/es/components/tags/index.mjs +6 -0
- package/dist/es/components/tags/tags.d.ts +9 -0
- package/dist/es/components/tags/tags.mjs +296 -0
- package/dist/es/components/tags/tags.vue.d.ts +20 -0
- package/dist/es/components/text-ellipsis/index.css +15 -0
- package/dist/es/components/text-ellipsis/index.d.ts +4 -0
- package/dist/es/components/text-ellipsis/index.mjs +6 -0
- package/dist/es/components/text-ellipsis/text-ellipsis.d.ts +12 -0
- package/dist/es/components/text-ellipsis/text-ellipsis.mjs +137 -0
- package/dist/es/components/text-ellipsis/text-ellipsis.vue.d.ts +41 -0
- package/dist/es/components/thousand-input/index.css +4 -0
- package/dist/es/components/thousand-input/index.d.ts +4 -0
- package/dist/es/components/thousand-input/index.mjs +6 -0
- package/dist/es/components/thousand-input/thousand-input.d.ts +11 -0
- package/dist/es/components/thousand-input/thousand-input.mjs +159 -0
- package/dist/es/components/thousand-input/thousand-input.vue.d.ts +2558 -0
- package/dist/es/components/tinymce/config.d.ts +25 -0
- package/dist/es/components/tinymce/index.css +9 -0
- package/dist/es/components/tinymce/index.d.ts +4 -0
- package/dist/es/components/tinymce/index.mjs +6 -0
- package/dist/es/components/tinymce/tinymce.d.ts +9 -0
- package/dist/es/components/tinymce/tinymce.mjs +176 -0
- package/dist/es/components/tinymce/tinymce.vue.d.ts +20 -0
- package/dist/es/components/tree-picker/components/popover-cascader.d.ts +8 -0
- package/dist/es/components/tree-picker/components/popover-cascader.vue.d.ts +1361 -0
- package/dist/es/components/tree-picker/docs/data.d.ts +2 -0
- package/dist/es/components/tree-picker/index.css +41 -0
- package/dist/es/components/tree-picker/index.d.ts +4 -0
- package/dist/es/components/tree-picker/index.mjs +6 -0
- package/dist/es/components/tree-picker/popover-cascader.css +23 -0
- package/dist/es/components/tree-picker/tree-picker.d.ts +14 -0
- package/dist/es/components/tree-picker/tree-picker.mjs +173 -0
- package/dist/es/components/tree-picker/tree-picker.vue.d.ts +575 -0
- package/dist/es/components/upload-file/index.css +30 -0
- package/dist/es/components/upload-file/index.d.ts +4 -0
- package/dist/es/components/upload-file/index.mjs +6 -0
- package/dist/es/components/upload-file/upload-file.d.ts +39 -0
- package/dist/es/components/upload-file/upload-file.mjs +202 -0
- package/dist/es/components/upload-file/upload-file.vue.d.ts +30 -0
- package/dist/es/directives/cleave/index.d.ts +3 -0
- package/dist/es/directives/focus/index.d.ts +4 -0
- package/dist/es/directives/index.d.ts +3 -0
- package/dist/es/directives/thousand/index.d.ts +3 -0
- package/dist/es/index.d.ts +42 -0
- package/dist/es/index.mjs +122 -0
- package/dist/es/use/useSmallScreen/index.d.ts +4 -0
- package/dist/es/use/useSmallScreen/index.mjs +10 -0
- package/dist/es/use/useStore/index.d.ts +3 -0
- package/dist/es/use/useStore/index.mjs +22 -0
- package/dist/es/utils/index.d.ts +6 -0
- package/dist/es/utils/resolver.d.ts +3 -0
- package/dist/es/utils/resolver.mjs +24 -0
- package/dist/es/utils/typescript.d.ts +6 -0
- package/dist/global.d.ts +42 -0
- package/dist/index.css +869 -0
- package/package.json +58 -0
|
@@ -0,0 +1,1171 @@
|
|
|
1
|
+
import { inject, computed, getCurrentInstance, watch, nextTick, ref, toRaw, defineComponent, useSlots, createBlock, openBlock, resolveDynamicComponent, unref, normalizeClass, withCtx, createElementVNode, createElementBlock, createCommentVNode, withDirectives, mergeProps, isRef, withModifiers, vModelCheckbox, renderSlot, Fragment, createTextVNode, toDisplayString, normalizeStyle, provide, toRefs, renderList, vModelRadio, onMounted, reactive } from 'vue';
|
|
2
|
+
import { u as useSizeProp } from './CS4VKsqy.mjs';
|
|
3
|
+
import { a as flatRest, u as useAriaProps, p as pick } from './C2LgraHx.mjs';
|
|
4
|
+
import { U as UPDATE_MODEL_EVENT, C as CHANGE_EVENT } from './Ct6q2FXg.mjs';
|
|
5
|
+
import { h as isString, f as isNumber, x as isBoolean, g as isUndefined, e as debugWarn, i as isArray, C as isPropAbsent, s as isObject, u as useNamespace, c as buildProps, d as definePropType } from './E_WRn0OP.mjs';
|
|
6
|
+
import { _ as _export_sfc, a as withNoopInstall, w as withInstall } from './D389hx_T.mjs';
|
|
7
|
+
import { b as formContextKey, u as useId } from './8rLUmOVR.mjs';
|
|
8
|
+
import { b as useFormDisabled, u as useFormItem, c as useFormSize, a as useFormItemInputId } from './DZACQ9LT.mjs';
|
|
9
|
+
import { i as isEqual } from './-EkpfdcW.mjs';
|
|
10
|
+
import { u as useDeprecated } from './VAdRxe-1.mjs';
|
|
11
|
+
import { d as baseGet, e as castPath, t as toKey, a as arrayMap } from './Spa-JKB4.mjs';
|
|
12
|
+
import { g as getPrototype, c as copyObject, a as getAllKeysIn, b as baseClone } from './nWBcrYxV.mjs';
|
|
13
|
+
import { i as isObjectLike, b as baseGetTag } from './Fo0dZYnz.mjs';
|
|
14
|
+
|
|
15
|
+
/** `Object#toString` result references. */
|
|
16
|
+
var objectTag = '[object Object]';
|
|
17
|
+
|
|
18
|
+
/** Used for built-in method references. */
|
|
19
|
+
var funcProto = Function.prototype,
|
|
20
|
+
objectProto = Object.prototype;
|
|
21
|
+
|
|
22
|
+
/** Used to resolve the decompiled source of functions. */
|
|
23
|
+
var funcToString = funcProto.toString;
|
|
24
|
+
|
|
25
|
+
/** Used to check objects for own properties. */
|
|
26
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
27
|
+
|
|
28
|
+
/** Used to infer the `Object` constructor. */
|
|
29
|
+
var objectCtorString = funcToString.call(Object);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
|
33
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
34
|
+
*
|
|
35
|
+
* @static
|
|
36
|
+
* @memberOf _
|
|
37
|
+
* @since 0.8.0
|
|
38
|
+
* @category Lang
|
|
39
|
+
* @param {*} value The value to check.
|
|
40
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
41
|
+
* @example
|
|
42
|
+
*
|
|
43
|
+
* function Foo() {
|
|
44
|
+
* this.a = 1;
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* _.isPlainObject(new Foo);
|
|
48
|
+
* // => false
|
|
49
|
+
*
|
|
50
|
+
* _.isPlainObject([1, 2, 3]);
|
|
51
|
+
* // => false
|
|
52
|
+
*
|
|
53
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
54
|
+
* // => true
|
|
55
|
+
*
|
|
56
|
+
* _.isPlainObject(Object.create(null));
|
|
57
|
+
* // => true
|
|
58
|
+
*/
|
|
59
|
+
function isPlainObject(value) {
|
|
60
|
+
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
var proto = getPrototype(value);
|
|
64
|
+
if (proto === null) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
68
|
+
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
|
69
|
+
funcToString.call(Ctor) == objectCtorString;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The base implementation of `_.slice` without an iteratee call guard.
|
|
74
|
+
*
|
|
75
|
+
* @private
|
|
76
|
+
* @param {Array} array The array to slice.
|
|
77
|
+
* @param {number} [start=0] The start position.
|
|
78
|
+
* @param {number} [end=array.length] The end position.
|
|
79
|
+
* @returns {Array} Returns the slice of `array`.
|
|
80
|
+
*/
|
|
81
|
+
function baseSlice(array, start, end) {
|
|
82
|
+
var index = -1,
|
|
83
|
+
length = array.length;
|
|
84
|
+
|
|
85
|
+
if (start < 0) {
|
|
86
|
+
start = -start > length ? 0 : (length + start);
|
|
87
|
+
}
|
|
88
|
+
end = end > length ? length : end;
|
|
89
|
+
if (end < 0) {
|
|
90
|
+
end += length;
|
|
91
|
+
}
|
|
92
|
+
length = start > end ? 0 : ((end - start) >>> 0);
|
|
93
|
+
start >>>= 0;
|
|
94
|
+
|
|
95
|
+
var result = Array(length);
|
|
96
|
+
while (++index < length) {
|
|
97
|
+
result[index] = array[index + start];
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Gets the last element of `array`.
|
|
104
|
+
*
|
|
105
|
+
* @static
|
|
106
|
+
* @memberOf _
|
|
107
|
+
* @since 0.1.0
|
|
108
|
+
* @category Array
|
|
109
|
+
* @param {Array} array The array to query.
|
|
110
|
+
* @returns {*} Returns the last element of `array`.
|
|
111
|
+
* @example
|
|
112
|
+
*
|
|
113
|
+
* _.last([1, 2, 3]);
|
|
114
|
+
* // => 3
|
|
115
|
+
*/
|
|
116
|
+
function last(array) {
|
|
117
|
+
var length = array == null ? 0 : array.length;
|
|
118
|
+
return length ? array[length - 1] : undefined;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Gets the parent value at `path` of `object`.
|
|
123
|
+
*
|
|
124
|
+
* @private
|
|
125
|
+
* @param {Object} object The object to query.
|
|
126
|
+
* @param {Array} path The path to get the parent value of.
|
|
127
|
+
* @returns {*} Returns the parent value.
|
|
128
|
+
*/
|
|
129
|
+
function parent(object, path) {
|
|
130
|
+
return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* The base implementation of `_.unset`.
|
|
135
|
+
*
|
|
136
|
+
* @private
|
|
137
|
+
* @param {Object} object The object to modify.
|
|
138
|
+
* @param {Array|string} path The property path to unset.
|
|
139
|
+
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
|
|
140
|
+
*/
|
|
141
|
+
function baseUnset(object, path) {
|
|
142
|
+
path = castPath(path, object);
|
|
143
|
+
object = parent(object, path);
|
|
144
|
+
return object == null || delete object[toKey(last(path))];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
|
|
149
|
+
* objects.
|
|
150
|
+
*
|
|
151
|
+
* @private
|
|
152
|
+
* @param {*} value The value to inspect.
|
|
153
|
+
* @param {string} key The key of the property to inspect.
|
|
154
|
+
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
|
|
155
|
+
*/
|
|
156
|
+
function customOmitClone(value) {
|
|
157
|
+
return isPlainObject(value) ? undefined : value;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Used to compose bitmasks for cloning. */
|
|
161
|
+
var CLONE_DEEP_FLAG = 1,
|
|
162
|
+
CLONE_FLAT_FLAG = 2,
|
|
163
|
+
CLONE_SYMBOLS_FLAG = 4;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* The opposite of `_.pick`; this method creates an object composed of the
|
|
167
|
+
* own and inherited enumerable property paths of `object` that are not omitted.
|
|
168
|
+
*
|
|
169
|
+
* **Note:** This method is considerably slower than `_.pick`.
|
|
170
|
+
*
|
|
171
|
+
* @static
|
|
172
|
+
* @since 0.1.0
|
|
173
|
+
* @memberOf _
|
|
174
|
+
* @category Object
|
|
175
|
+
* @param {Object} object The source object.
|
|
176
|
+
* @param {...(string|string[])} [paths] The property paths to omit.
|
|
177
|
+
* @returns {Object} Returns the new object.
|
|
178
|
+
* @example
|
|
179
|
+
*
|
|
180
|
+
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
181
|
+
*
|
|
182
|
+
* _.omit(object, ['a', 'c']);
|
|
183
|
+
* // => { 'b': '2' }
|
|
184
|
+
*/
|
|
185
|
+
var omit = flatRest(function(object, paths) {
|
|
186
|
+
var result = {};
|
|
187
|
+
if (object == null) {
|
|
188
|
+
return result;
|
|
189
|
+
}
|
|
190
|
+
var isDeep = false;
|
|
191
|
+
paths = arrayMap(paths, function(path) {
|
|
192
|
+
path = castPath(path, object);
|
|
193
|
+
isDeep || (isDeep = path.length > 1);
|
|
194
|
+
return path;
|
|
195
|
+
});
|
|
196
|
+
copyObject(object, getAllKeysIn(object), result);
|
|
197
|
+
if (isDeep) {
|
|
198
|
+
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
|
|
199
|
+
}
|
|
200
|
+
var length = paths.length;
|
|
201
|
+
while (length--) {
|
|
202
|
+
baseUnset(result, paths[length]);
|
|
203
|
+
}
|
|
204
|
+
return result;
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
const checkboxProps = {
|
|
208
|
+
modelValue: {
|
|
209
|
+
type: [Number, String, Boolean],
|
|
210
|
+
default: void 0
|
|
211
|
+
},
|
|
212
|
+
label: {
|
|
213
|
+
type: [String, Boolean, Number, Object],
|
|
214
|
+
default: void 0
|
|
215
|
+
},
|
|
216
|
+
value: {
|
|
217
|
+
type: [String, Boolean, Number, Object],
|
|
218
|
+
default: void 0
|
|
219
|
+
},
|
|
220
|
+
indeterminate: Boolean,
|
|
221
|
+
disabled: {
|
|
222
|
+
type: Boolean,
|
|
223
|
+
default: void 0
|
|
224
|
+
},
|
|
225
|
+
checked: Boolean,
|
|
226
|
+
name: {
|
|
227
|
+
type: String,
|
|
228
|
+
default: void 0
|
|
229
|
+
},
|
|
230
|
+
trueValue: {
|
|
231
|
+
type: [String, Number],
|
|
232
|
+
default: void 0
|
|
233
|
+
},
|
|
234
|
+
falseValue: {
|
|
235
|
+
type: [String, Number],
|
|
236
|
+
default: void 0
|
|
237
|
+
},
|
|
238
|
+
trueLabel: {
|
|
239
|
+
type: [String, Number],
|
|
240
|
+
default: void 0
|
|
241
|
+
},
|
|
242
|
+
falseLabel: {
|
|
243
|
+
type: [String, Number],
|
|
244
|
+
default: void 0
|
|
245
|
+
},
|
|
246
|
+
id: {
|
|
247
|
+
type: String,
|
|
248
|
+
default: void 0
|
|
249
|
+
},
|
|
250
|
+
border: Boolean,
|
|
251
|
+
size: useSizeProp,
|
|
252
|
+
tabindex: [String, Number],
|
|
253
|
+
validateEvent: {
|
|
254
|
+
type: Boolean,
|
|
255
|
+
default: true
|
|
256
|
+
},
|
|
257
|
+
ariaLabel: String,
|
|
258
|
+
...useAriaProps(["ariaControls"])
|
|
259
|
+
};
|
|
260
|
+
const checkboxEmits = {
|
|
261
|
+
[UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
|
|
262
|
+
change: (val) => isString(val) || isNumber(val) || isBoolean(val)
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
|
|
266
|
+
|
|
267
|
+
const useCheckboxDisabled = ({
|
|
268
|
+
model,
|
|
269
|
+
isChecked
|
|
270
|
+
}) => {
|
|
271
|
+
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
272
|
+
const formContext = inject(formContextKey, void 0);
|
|
273
|
+
const isLimitDisabled = computed(() => {
|
|
274
|
+
var _a, _b;
|
|
275
|
+
const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value;
|
|
276
|
+
const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
|
|
277
|
+
return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
|
|
278
|
+
});
|
|
279
|
+
const isDisabled = useFormDisabled(computed(() => {
|
|
280
|
+
var _a, _b;
|
|
281
|
+
if (checkboxGroup === void 0) {
|
|
282
|
+
return (_a = formContext == null ? void 0 : formContext.disabled) != null ? _a : isLimitDisabled.value;
|
|
283
|
+
} else {
|
|
284
|
+
return ((_b = checkboxGroup.disabled) == null ? void 0 : _b.value) || isLimitDisabled.value;
|
|
285
|
+
}
|
|
286
|
+
}));
|
|
287
|
+
return {
|
|
288
|
+
isDisabled,
|
|
289
|
+
isLimitDisabled
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
const useCheckboxEvent = (props, {
|
|
294
|
+
model,
|
|
295
|
+
isLimitExceeded,
|
|
296
|
+
hasOwnLabel,
|
|
297
|
+
isDisabled,
|
|
298
|
+
isLabeledByFormItem
|
|
299
|
+
}) => {
|
|
300
|
+
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
301
|
+
const { formItem } = useFormItem();
|
|
302
|
+
const { emit } = getCurrentInstance();
|
|
303
|
+
function getLabeledValue(value) {
|
|
304
|
+
var _a, _b, _c, _d;
|
|
305
|
+
return [true, props.trueValue, props.trueLabel].includes(value) ? (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true : (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false;
|
|
306
|
+
}
|
|
307
|
+
function emitChangeEvent(checked, e) {
|
|
308
|
+
emit(CHANGE_EVENT, getLabeledValue(checked), e);
|
|
309
|
+
}
|
|
310
|
+
function handleChange(e) {
|
|
311
|
+
if (isLimitExceeded.value)
|
|
312
|
+
return;
|
|
313
|
+
const target = e.target;
|
|
314
|
+
emit(CHANGE_EVENT, getLabeledValue(target.checked), e);
|
|
315
|
+
}
|
|
316
|
+
async function onClickRoot(e) {
|
|
317
|
+
if (isLimitExceeded.value)
|
|
318
|
+
return;
|
|
319
|
+
if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
|
|
320
|
+
const eventTargets = e.composedPath();
|
|
321
|
+
const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
|
|
322
|
+
if (!hasLabel) {
|
|
323
|
+
model.value = getLabeledValue([false, props.falseValue, props.falseLabel].includes(model.value));
|
|
324
|
+
await nextTick();
|
|
325
|
+
emitChangeEvent(model.value, e);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
const validateEvent = computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
|
|
330
|
+
watch(() => props.modelValue, () => {
|
|
331
|
+
if (validateEvent.value) {
|
|
332
|
+
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
return {
|
|
336
|
+
handleChange,
|
|
337
|
+
onClickRoot
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
const useCheckboxModel = (props) => {
|
|
342
|
+
const selfModel = ref(false);
|
|
343
|
+
const { emit } = getCurrentInstance();
|
|
344
|
+
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
345
|
+
const isGroup = computed(() => isUndefined(checkboxGroup) === false);
|
|
346
|
+
const isLimitExceeded = ref(false);
|
|
347
|
+
const model = computed({
|
|
348
|
+
get() {
|
|
349
|
+
var _a, _b;
|
|
350
|
+
return isGroup.value ? (_a = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a.value : (_b = props.modelValue) != null ? _b : selfModel.value;
|
|
351
|
+
},
|
|
352
|
+
set(val) {
|
|
353
|
+
var _a, _b;
|
|
354
|
+
if (isGroup.value && isArray(val)) {
|
|
355
|
+
isLimitExceeded.value = ((_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value) !== void 0 && val.length > (checkboxGroup == null ? void 0 : checkboxGroup.max.value) && val.length > model.value.length;
|
|
356
|
+
isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
|
|
357
|
+
} else {
|
|
358
|
+
emit(UPDATE_MODEL_EVENT, val);
|
|
359
|
+
selfModel.value = val;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
return {
|
|
364
|
+
model,
|
|
365
|
+
isGroup,
|
|
366
|
+
isLimitExceeded
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
const useCheckboxStatus = (props, slots, { model }) => {
|
|
371
|
+
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
372
|
+
const isFocused = ref(false);
|
|
373
|
+
const actualValue = computed(() => {
|
|
374
|
+
if (!isPropAbsent(props.value)) {
|
|
375
|
+
return props.value;
|
|
376
|
+
}
|
|
377
|
+
return props.label;
|
|
378
|
+
});
|
|
379
|
+
const isChecked = computed(() => {
|
|
380
|
+
const value = model.value;
|
|
381
|
+
if (isBoolean(value)) {
|
|
382
|
+
return value;
|
|
383
|
+
} else if (isArray(value)) {
|
|
384
|
+
if (isObject(actualValue.value)) {
|
|
385
|
+
return value.map(toRaw).some((o) => isEqual(o, actualValue.value));
|
|
386
|
+
} else {
|
|
387
|
+
return value.map(toRaw).includes(actualValue.value);
|
|
388
|
+
}
|
|
389
|
+
} else if (value !== null && value !== void 0) {
|
|
390
|
+
return value === props.trueValue || value === props.trueLabel;
|
|
391
|
+
} else {
|
|
392
|
+
return !!value;
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
const checkboxButtonSize = useFormSize(computed(() => {
|
|
396
|
+
var _a;
|
|
397
|
+
return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
|
|
398
|
+
}), {
|
|
399
|
+
prop: true
|
|
400
|
+
});
|
|
401
|
+
const checkboxSize = useFormSize(computed(() => {
|
|
402
|
+
var _a;
|
|
403
|
+
return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
|
|
404
|
+
}));
|
|
405
|
+
const hasOwnLabel = computed(() => {
|
|
406
|
+
return !!slots.default || !isPropAbsent(actualValue.value);
|
|
407
|
+
});
|
|
408
|
+
return {
|
|
409
|
+
checkboxButtonSize,
|
|
410
|
+
isChecked,
|
|
411
|
+
isFocused,
|
|
412
|
+
checkboxSize,
|
|
413
|
+
hasOwnLabel,
|
|
414
|
+
actualValue
|
|
415
|
+
};
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
const useCheckbox = (props, slots) => {
|
|
419
|
+
const { formItem: elFormItem } = useFormItem();
|
|
420
|
+
const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
|
|
421
|
+
const {
|
|
422
|
+
isFocused,
|
|
423
|
+
isChecked,
|
|
424
|
+
checkboxButtonSize,
|
|
425
|
+
checkboxSize,
|
|
426
|
+
hasOwnLabel,
|
|
427
|
+
actualValue
|
|
428
|
+
} = useCheckboxStatus(props, slots, { model });
|
|
429
|
+
const { isDisabled } = useCheckboxDisabled({ model, isChecked });
|
|
430
|
+
const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
|
|
431
|
+
formItemContext: elFormItem,
|
|
432
|
+
disableIdGeneration: hasOwnLabel,
|
|
433
|
+
disableIdManagement: isGroup
|
|
434
|
+
});
|
|
435
|
+
const { handleChange, onClickRoot } = useCheckboxEvent(props, {
|
|
436
|
+
model,
|
|
437
|
+
isLimitExceeded,
|
|
438
|
+
hasOwnLabel,
|
|
439
|
+
isDisabled,
|
|
440
|
+
isLabeledByFormItem
|
|
441
|
+
});
|
|
442
|
+
const setStoreValue = () => {
|
|
443
|
+
function addToStore() {
|
|
444
|
+
var _a, _b;
|
|
445
|
+
if (isArray(model.value) && !model.value.includes(actualValue.value)) {
|
|
446
|
+
model.value.push(actualValue.value);
|
|
447
|
+
} else {
|
|
448
|
+
model.value = (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
props.checked && addToStore();
|
|
452
|
+
};
|
|
453
|
+
setStoreValue();
|
|
454
|
+
useDeprecated({
|
|
455
|
+
from: "label act as value",
|
|
456
|
+
replacement: "value",
|
|
457
|
+
version: "3.0.0",
|
|
458
|
+
scope: "el-checkbox",
|
|
459
|
+
ref: "https://element-plus.org/en-US/component/checkbox.html"
|
|
460
|
+
}, computed(() => isGroup.value && isPropAbsent(props.value)));
|
|
461
|
+
useDeprecated({
|
|
462
|
+
from: "true-label",
|
|
463
|
+
replacement: "true-value",
|
|
464
|
+
version: "3.0.0",
|
|
465
|
+
scope: "el-checkbox",
|
|
466
|
+
ref: "https://element-plus.org/en-US/component/checkbox.html"
|
|
467
|
+
}, computed(() => !!props.trueLabel));
|
|
468
|
+
useDeprecated({
|
|
469
|
+
from: "false-label",
|
|
470
|
+
replacement: "false-value",
|
|
471
|
+
version: "3.0.0",
|
|
472
|
+
scope: "el-checkbox",
|
|
473
|
+
ref: "https://element-plus.org/en-US/component/checkbox.html"
|
|
474
|
+
}, computed(() => !!props.falseLabel));
|
|
475
|
+
return {
|
|
476
|
+
inputId,
|
|
477
|
+
isLabeledByFormItem,
|
|
478
|
+
isChecked,
|
|
479
|
+
isDisabled,
|
|
480
|
+
isFocused,
|
|
481
|
+
checkboxButtonSize,
|
|
482
|
+
checkboxSize,
|
|
483
|
+
hasOwnLabel,
|
|
484
|
+
model,
|
|
485
|
+
actualValue,
|
|
486
|
+
handleChange,
|
|
487
|
+
onClickRoot
|
|
488
|
+
};
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
const __default__$5 = defineComponent({
|
|
492
|
+
name: "ElCheckbox"
|
|
493
|
+
});
|
|
494
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
495
|
+
...__default__$5,
|
|
496
|
+
props: checkboxProps,
|
|
497
|
+
emits: checkboxEmits,
|
|
498
|
+
setup(__props) {
|
|
499
|
+
const props = __props;
|
|
500
|
+
const slots = useSlots();
|
|
501
|
+
const {
|
|
502
|
+
inputId,
|
|
503
|
+
isLabeledByFormItem,
|
|
504
|
+
isChecked,
|
|
505
|
+
isDisabled,
|
|
506
|
+
isFocused,
|
|
507
|
+
checkboxSize,
|
|
508
|
+
hasOwnLabel,
|
|
509
|
+
model,
|
|
510
|
+
actualValue,
|
|
511
|
+
handleChange,
|
|
512
|
+
onClickRoot
|
|
513
|
+
} = useCheckbox(props, slots);
|
|
514
|
+
const inputBindings = computed(() => {
|
|
515
|
+
var _a, _b, _c, _d;
|
|
516
|
+
if (props.trueValue || props.falseValue || props.trueLabel || props.falseLabel) {
|
|
517
|
+
return {
|
|
518
|
+
"true-value": (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true,
|
|
519
|
+
"false-value": (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
return {
|
|
523
|
+
value: actualValue.value
|
|
524
|
+
};
|
|
525
|
+
});
|
|
526
|
+
const ns = useNamespace("checkbox");
|
|
527
|
+
const compKls = computed(() => {
|
|
528
|
+
return [
|
|
529
|
+
ns.b(),
|
|
530
|
+
ns.m(checkboxSize.value),
|
|
531
|
+
ns.is("disabled", isDisabled.value),
|
|
532
|
+
ns.is("bordered", props.border),
|
|
533
|
+
ns.is("checked", isChecked.value)
|
|
534
|
+
];
|
|
535
|
+
});
|
|
536
|
+
const spanKls = computed(() => {
|
|
537
|
+
return [
|
|
538
|
+
ns.e("input"),
|
|
539
|
+
ns.is("disabled", isDisabled.value),
|
|
540
|
+
ns.is("checked", isChecked.value),
|
|
541
|
+
ns.is("indeterminate", props.indeterminate),
|
|
542
|
+
ns.is("focus", isFocused.value)
|
|
543
|
+
];
|
|
544
|
+
});
|
|
545
|
+
return (_ctx, _cache) => {
|
|
546
|
+
return openBlock(), createBlock(resolveDynamicComponent(!unref(hasOwnLabel) && unref(isLabeledByFormItem) ? "span" : "label"), {
|
|
547
|
+
for: !unref(hasOwnLabel) && unref(isLabeledByFormItem) ? null : unref(inputId),
|
|
548
|
+
class: normalizeClass(unref(compKls)),
|
|
549
|
+
"aria-controls": _ctx.indeterminate ? _ctx.ariaControls : null,
|
|
550
|
+
"aria-checked": _ctx.indeterminate ? "mixed" : void 0,
|
|
551
|
+
"aria-label": _ctx.ariaLabel,
|
|
552
|
+
onClick: unref(onClickRoot)
|
|
553
|
+
}, {
|
|
554
|
+
default: withCtx(() => [
|
|
555
|
+
createElementVNode("span", {
|
|
556
|
+
class: normalizeClass(unref(spanKls))
|
|
557
|
+
}, [
|
|
558
|
+
withDirectives(createElementVNode("input", mergeProps({
|
|
559
|
+
id: unref(inputId),
|
|
560
|
+
"onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
|
|
561
|
+
class: unref(ns).e("original"),
|
|
562
|
+
type: "checkbox",
|
|
563
|
+
indeterminate: _ctx.indeterminate,
|
|
564
|
+
name: _ctx.name,
|
|
565
|
+
tabindex: _ctx.tabindex,
|
|
566
|
+
disabled: unref(isDisabled)
|
|
567
|
+
}, unref(inputBindings), {
|
|
568
|
+
onChange: unref(handleChange),
|
|
569
|
+
onFocus: ($event) => isFocused.value = true,
|
|
570
|
+
onBlur: ($event) => isFocused.value = false,
|
|
571
|
+
onClick: withModifiers(() => {
|
|
572
|
+
}, ["stop"])
|
|
573
|
+
}), null, 16, ["id", "onUpdate:modelValue", "indeterminate", "name", "tabindex", "disabled", "onChange", "onFocus", "onBlur", "onClick"]), [
|
|
574
|
+
[vModelCheckbox, unref(model)]
|
|
575
|
+
]),
|
|
576
|
+
createElementVNode("span", {
|
|
577
|
+
class: normalizeClass(unref(ns).e("inner"))
|
|
578
|
+
}, null, 2)
|
|
579
|
+
], 2),
|
|
580
|
+
unref(hasOwnLabel) ? (openBlock(), createElementBlock("span", {
|
|
581
|
+
key: 0,
|
|
582
|
+
class: normalizeClass(unref(ns).e("label"))
|
|
583
|
+
}, [
|
|
584
|
+
renderSlot(_ctx.$slots, "default"),
|
|
585
|
+
!_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
586
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
587
|
+
], 64)) : createCommentVNode("v-if", true)
|
|
588
|
+
], 2)) : createCommentVNode("v-if", true)
|
|
589
|
+
]),
|
|
590
|
+
_: 3
|
|
591
|
+
}, 8, ["for", "class", "aria-controls", "aria-checked", "aria-label", "onClick"]);
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "checkbox.vue"]]);
|
|
596
|
+
|
|
597
|
+
const __default__$4 = defineComponent({
|
|
598
|
+
name: "ElCheckboxButton"
|
|
599
|
+
});
|
|
600
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
601
|
+
...__default__$4,
|
|
602
|
+
props: checkboxProps,
|
|
603
|
+
emits: checkboxEmits,
|
|
604
|
+
setup(__props) {
|
|
605
|
+
const props = __props;
|
|
606
|
+
const slots = useSlots();
|
|
607
|
+
const {
|
|
608
|
+
isFocused,
|
|
609
|
+
isChecked,
|
|
610
|
+
isDisabled,
|
|
611
|
+
checkboxButtonSize,
|
|
612
|
+
model,
|
|
613
|
+
actualValue,
|
|
614
|
+
handleChange
|
|
615
|
+
} = useCheckbox(props, slots);
|
|
616
|
+
const inputBindings = computed(() => {
|
|
617
|
+
var _a, _b, _c, _d;
|
|
618
|
+
if (props.trueValue || props.falseValue || props.trueLabel || props.falseLabel) {
|
|
619
|
+
return {
|
|
620
|
+
"true-value": (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true,
|
|
621
|
+
"false-value": (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
return {
|
|
625
|
+
value: actualValue.value
|
|
626
|
+
};
|
|
627
|
+
});
|
|
628
|
+
const checkboxGroup = inject(checkboxGroupContextKey, void 0);
|
|
629
|
+
const ns = useNamespace("checkbox");
|
|
630
|
+
const activeStyle = computed(() => {
|
|
631
|
+
var _a, _b, _c, _d;
|
|
632
|
+
const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : "";
|
|
633
|
+
return {
|
|
634
|
+
backgroundColor: fillValue,
|
|
635
|
+
borderColor: fillValue,
|
|
636
|
+
color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
|
|
637
|
+
boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
|
|
638
|
+
};
|
|
639
|
+
});
|
|
640
|
+
const labelKls = computed(() => {
|
|
641
|
+
return [
|
|
642
|
+
ns.b("button"),
|
|
643
|
+
ns.bm("button", checkboxButtonSize.value),
|
|
644
|
+
ns.is("disabled", isDisabled.value),
|
|
645
|
+
ns.is("checked", isChecked.value),
|
|
646
|
+
ns.is("focus", isFocused.value)
|
|
647
|
+
];
|
|
648
|
+
});
|
|
649
|
+
return (_ctx, _cache) => {
|
|
650
|
+
return openBlock(), createElementBlock("label", {
|
|
651
|
+
class: normalizeClass(unref(labelKls))
|
|
652
|
+
}, [
|
|
653
|
+
withDirectives(createElementVNode("input", mergeProps({
|
|
654
|
+
"onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
|
|
655
|
+
class: unref(ns).be("button", "original"),
|
|
656
|
+
type: "checkbox",
|
|
657
|
+
name: _ctx.name,
|
|
658
|
+
tabindex: _ctx.tabindex,
|
|
659
|
+
disabled: unref(isDisabled)
|
|
660
|
+
}, unref(inputBindings), {
|
|
661
|
+
onChange: unref(handleChange),
|
|
662
|
+
onFocus: ($event) => isFocused.value = true,
|
|
663
|
+
onBlur: ($event) => isFocused.value = false,
|
|
664
|
+
onClick: withModifiers(() => {
|
|
665
|
+
}, ["stop"])
|
|
666
|
+
}), null, 16, ["onUpdate:modelValue", "name", "tabindex", "disabled", "onChange", "onFocus", "onBlur", "onClick"]), [
|
|
667
|
+
[vModelCheckbox, unref(model)]
|
|
668
|
+
]),
|
|
669
|
+
_ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
|
|
670
|
+
key: 0,
|
|
671
|
+
class: normalizeClass(unref(ns).be("button", "inner")),
|
|
672
|
+
style: normalizeStyle(unref(isChecked) ? unref(activeStyle) : void 0)
|
|
673
|
+
}, [
|
|
674
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
675
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
676
|
+
])
|
|
677
|
+
], 6)) : createCommentVNode("v-if", true)
|
|
678
|
+
], 2);
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
});
|
|
682
|
+
var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "checkbox-button.vue"]]);
|
|
683
|
+
|
|
684
|
+
const checkboxGroupProps = buildProps({
|
|
685
|
+
modelValue: {
|
|
686
|
+
type: definePropType(Array),
|
|
687
|
+
default: () => []
|
|
688
|
+
},
|
|
689
|
+
disabled: {
|
|
690
|
+
type: Boolean,
|
|
691
|
+
default: void 0
|
|
692
|
+
},
|
|
693
|
+
min: Number,
|
|
694
|
+
max: Number,
|
|
695
|
+
size: useSizeProp,
|
|
696
|
+
fill: String,
|
|
697
|
+
textColor: String,
|
|
698
|
+
tag: {
|
|
699
|
+
type: String,
|
|
700
|
+
default: "div"
|
|
701
|
+
},
|
|
702
|
+
validateEvent: {
|
|
703
|
+
type: Boolean,
|
|
704
|
+
default: true
|
|
705
|
+
},
|
|
706
|
+
options: {
|
|
707
|
+
type: definePropType(Array)
|
|
708
|
+
},
|
|
709
|
+
props: {
|
|
710
|
+
type: definePropType(Object),
|
|
711
|
+
default: () => checkboxDefaultProps
|
|
712
|
+
},
|
|
713
|
+
type: {
|
|
714
|
+
type: String,
|
|
715
|
+
values: ["checkbox", "button"],
|
|
716
|
+
default: "checkbox"
|
|
717
|
+
},
|
|
718
|
+
...useAriaProps(["ariaLabel"])
|
|
719
|
+
});
|
|
720
|
+
const checkboxGroupEmits = {
|
|
721
|
+
[UPDATE_MODEL_EVENT]: (val) => isArray(val),
|
|
722
|
+
change: (val) => isArray(val)
|
|
723
|
+
};
|
|
724
|
+
const checkboxDefaultProps = {
|
|
725
|
+
label: "label",
|
|
726
|
+
value: "value",
|
|
727
|
+
disabled: "disabled"
|
|
728
|
+
};
|
|
729
|
+
|
|
730
|
+
const __default__$3 = defineComponent({
|
|
731
|
+
name: "ElCheckboxGroup"
|
|
732
|
+
});
|
|
733
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
734
|
+
...__default__$3,
|
|
735
|
+
props: checkboxGroupProps,
|
|
736
|
+
emits: checkboxGroupEmits,
|
|
737
|
+
setup(__props, { emit }) {
|
|
738
|
+
const props = __props;
|
|
739
|
+
const ns = useNamespace("checkbox");
|
|
740
|
+
const checkboxDisabled = useFormDisabled();
|
|
741
|
+
const { formItem } = useFormItem();
|
|
742
|
+
const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
|
|
743
|
+
formItemContext: formItem
|
|
744
|
+
});
|
|
745
|
+
const changeEvent = async (value) => {
|
|
746
|
+
emit(UPDATE_MODEL_EVENT, value);
|
|
747
|
+
await nextTick();
|
|
748
|
+
emit(CHANGE_EVENT, value);
|
|
749
|
+
};
|
|
750
|
+
const modelValue = computed({
|
|
751
|
+
get() {
|
|
752
|
+
return props.modelValue;
|
|
753
|
+
},
|
|
754
|
+
set(val) {
|
|
755
|
+
changeEvent(val);
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
const aliasProps = computed(() => ({
|
|
759
|
+
...checkboxDefaultProps,
|
|
760
|
+
...props.props
|
|
761
|
+
}));
|
|
762
|
+
const getOptionProps = (option) => {
|
|
763
|
+
const { label, value, disabled } = aliasProps.value;
|
|
764
|
+
const base = {
|
|
765
|
+
label: option[label],
|
|
766
|
+
value: option[value],
|
|
767
|
+
disabled: option[disabled]
|
|
768
|
+
};
|
|
769
|
+
return { ...omit(option, [label, value, disabled]), ...base };
|
|
770
|
+
};
|
|
771
|
+
const optionComponent = computed(() => props.type === "button" ? CheckboxButton : Checkbox);
|
|
772
|
+
provide(checkboxGroupContextKey, {
|
|
773
|
+
...pick(toRefs(props), [
|
|
774
|
+
"size",
|
|
775
|
+
"min",
|
|
776
|
+
"max",
|
|
777
|
+
"validateEvent",
|
|
778
|
+
"fill",
|
|
779
|
+
"textColor"
|
|
780
|
+
]),
|
|
781
|
+
disabled: checkboxDisabled,
|
|
782
|
+
modelValue,
|
|
783
|
+
changeEvent
|
|
784
|
+
});
|
|
785
|
+
watch(() => props.modelValue, (newVal, oldValue) => {
|
|
786
|
+
if (props.validateEvent && !isEqual(newVal, oldValue)) {
|
|
787
|
+
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
return (_ctx, _cache) => {
|
|
791
|
+
var _a;
|
|
792
|
+
return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
|
|
793
|
+
id: unref(groupId),
|
|
794
|
+
class: normalizeClass(unref(ns).b("group")),
|
|
795
|
+
role: "group",
|
|
796
|
+
"aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "checkbox-group" : void 0,
|
|
797
|
+
"aria-labelledby": unref(isLabeledByFormItem) ? (_a = unref(formItem)) == null ? void 0 : _a.labelId : void 0
|
|
798
|
+
}, {
|
|
799
|
+
default: withCtx(() => [
|
|
800
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
801
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item, index) => {
|
|
802
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(optionComponent)), mergeProps({ key: index }, getOptionProps(item)), null, 16);
|
|
803
|
+
}), 128))
|
|
804
|
+
])
|
|
805
|
+
]),
|
|
806
|
+
_: 3
|
|
807
|
+
}, 8, ["id", "class", "aria-label", "aria-labelledby"]);
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "checkbox-group.vue"]]);
|
|
812
|
+
|
|
813
|
+
const ElCheckbox = withInstall(Checkbox, {
|
|
814
|
+
CheckboxButton,
|
|
815
|
+
CheckboxGroup
|
|
816
|
+
});
|
|
817
|
+
withNoopInstall(CheckboxButton);
|
|
818
|
+
const ElCheckboxGroup = withNoopInstall(CheckboxGroup);
|
|
819
|
+
|
|
820
|
+
const radioPropsBase = buildProps({
|
|
821
|
+
modelValue: {
|
|
822
|
+
type: [String, Number, Boolean],
|
|
823
|
+
default: void 0
|
|
824
|
+
},
|
|
825
|
+
size: useSizeProp,
|
|
826
|
+
disabled: {
|
|
827
|
+
type: Boolean,
|
|
828
|
+
default: void 0
|
|
829
|
+
},
|
|
830
|
+
label: {
|
|
831
|
+
type: [String, Number, Boolean],
|
|
832
|
+
default: void 0
|
|
833
|
+
},
|
|
834
|
+
value: {
|
|
835
|
+
type: [String, Number, Boolean],
|
|
836
|
+
default: void 0
|
|
837
|
+
},
|
|
838
|
+
name: {
|
|
839
|
+
type: String,
|
|
840
|
+
default: void 0
|
|
841
|
+
}
|
|
842
|
+
});
|
|
843
|
+
const radioProps = buildProps({
|
|
844
|
+
...radioPropsBase,
|
|
845
|
+
border: Boolean
|
|
846
|
+
});
|
|
847
|
+
const radioEmits = {
|
|
848
|
+
[UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
|
|
849
|
+
[CHANGE_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val)
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
const radioGroupKey = Symbol("radioGroupKey");
|
|
853
|
+
|
|
854
|
+
const useRadio = (props, emit) => {
|
|
855
|
+
const radioRef = ref();
|
|
856
|
+
const radioGroup = inject(radioGroupKey, void 0);
|
|
857
|
+
const isGroup = computed(() => !!radioGroup);
|
|
858
|
+
const actualValue = computed(() => {
|
|
859
|
+
if (!isPropAbsent(props.value)) {
|
|
860
|
+
return props.value;
|
|
861
|
+
}
|
|
862
|
+
return props.label;
|
|
863
|
+
});
|
|
864
|
+
const modelValue = computed({
|
|
865
|
+
get() {
|
|
866
|
+
return isGroup.value ? radioGroup.modelValue : props.modelValue;
|
|
867
|
+
},
|
|
868
|
+
set(val) {
|
|
869
|
+
if (isGroup.value) {
|
|
870
|
+
radioGroup.changeEvent(val);
|
|
871
|
+
} else {
|
|
872
|
+
emit && emit(UPDATE_MODEL_EVENT, val);
|
|
873
|
+
}
|
|
874
|
+
radioRef.value.checked = props.modelValue === actualValue.value;
|
|
875
|
+
}
|
|
876
|
+
});
|
|
877
|
+
const size = useFormSize(computed(() => radioGroup == null ? void 0 : radioGroup.size));
|
|
878
|
+
const disabled = useFormDisabled(computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
|
|
879
|
+
const focus = ref(false);
|
|
880
|
+
const tabIndex = computed(() => {
|
|
881
|
+
return disabled.value || isGroup.value && modelValue.value !== actualValue.value ? -1 : 0;
|
|
882
|
+
});
|
|
883
|
+
useDeprecated({
|
|
884
|
+
from: "label act as value",
|
|
885
|
+
replacement: "value",
|
|
886
|
+
version: "3.0.0",
|
|
887
|
+
scope: "el-radio",
|
|
888
|
+
ref: "https://element-plus.org/en-US/component/radio.html"
|
|
889
|
+
}, computed(() => isGroup.value && isPropAbsent(props.value)));
|
|
890
|
+
return {
|
|
891
|
+
radioRef,
|
|
892
|
+
isGroup,
|
|
893
|
+
radioGroup,
|
|
894
|
+
focus,
|
|
895
|
+
size,
|
|
896
|
+
disabled,
|
|
897
|
+
tabIndex,
|
|
898
|
+
modelValue,
|
|
899
|
+
actualValue
|
|
900
|
+
};
|
|
901
|
+
};
|
|
902
|
+
|
|
903
|
+
const __default__$2 = defineComponent({
|
|
904
|
+
name: "ElRadio"
|
|
905
|
+
});
|
|
906
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
907
|
+
...__default__$2,
|
|
908
|
+
props: radioProps,
|
|
909
|
+
emits: radioEmits,
|
|
910
|
+
setup(__props, { emit }) {
|
|
911
|
+
const props = __props;
|
|
912
|
+
const ns = useNamespace("radio");
|
|
913
|
+
const { radioRef, radioGroup, focus, size, disabled, modelValue, actualValue } = useRadio(props, emit);
|
|
914
|
+
function handleChange() {
|
|
915
|
+
nextTick(() => emit(CHANGE_EVENT, modelValue.value));
|
|
916
|
+
}
|
|
917
|
+
return (_ctx, _cache) => {
|
|
918
|
+
var _a;
|
|
919
|
+
return openBlock(), createElementBlock("label", {
|
|
920
|
+
class: normalizeClass([
|
|
921
|
+
unref(ns).b(),
|
|
922
|
+
unref(ns).is("disabled", unref(disabled)),
|
|
923
|
+
unref(ns).is("focus", unref(focus)),
|
|
924
|
+
unref(ns).is("bordered", _ctx.border),
|
|
925
|
+
unref(ns).is("checked", unref(modelValue) === unref(actualValue)),
|
|
926
|
+
unref(ns).m(unref(size))
|
|
927
|
+
])
|
|
928
|
+
}, [
|
|
929
|
+
createElementVNode("span", {
|
|
930
|
+
class: normalizeClass([
|
|
931
|
+
unref(ns).e("input"),
|
|
932
|
+
unref(ns).is("disabled", unref(disabled)),
|
|
933
|
+
unref(ns).is("checked", unref(modelValue) === unref(actualValue))
|
|
934
|
+
])
|
|
935
|
+
}, [
|
|
936
|
+
withDirectives(createElementVNode("input", {
|
|
937
|
+
ref_key: "radioRef",
|
|
938
|
+
ref: radioRef,
|
|
939
|
+
"onUpdate:modelValue": ($event) => isRef(modelValue) ? modelValue.value = $event : null,
|
|
940
|
+
class: normalizeClass(unref(ns).e("original")),
|
|
941
|
+
value: unref(actualValue),
|
|
942
|
+
name: _ctx.name || ((_a = unref(radioGroup)) == null ? void 0 : _a.name),
|
|
943
|
+
disabled: unref(disabled),
|
|
944
|
+
checked: unref(modelValue) === unref(actualValue),
|
|
945
|
+
type: "radio",
|
|
946
|
+
onFocus: ($event) => focus.value = true,
|
|
947
|
+
onBlur: ($event) => focus.value = false,
|
|
948
|
+
onChange: handleChange,
|
|
949
|
+
onClick: withModifiers(() => {
|
|
950
|
+
}, ["stop"])
|
|
951
|
+
}, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "checked", "onFocus", "onBlur", "onClick"]), [
|
|
952
|
+
[vModelRadio, unref(modelValue)]
|
|
953
|
+
]),
|
|
954
|
+
createElementVNode("span", {
|
|
955
|
+
class: normalizeClass(unref(ns).e("inner"))
|
|
956
|
+
}, null, 2)
|
|
957
|
+
], 2),
|
|
958
|
+
createElementVNode("span", {
|
|
959
|
+
class: normalizeClass(unref(ns).e("label")),
|
|
960
|
+
onKeydown: withModifiers(() => {
|
|
961
|
+
}, ["stop"])
|
|
962
|
+
}, [
|
|
963
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
964
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
965
|
+
])
|
|
966
|
+
], 42, ["onKeydown"])
|
|
967
|
+
], 2);
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
var Radio = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "radio.vue"]]);
|
|
972
|
+
|
|
973
|
+
const radioButtonProps = buildProps({
|
|
974
|
+
...radioPropsBase
|
|
975
|
+
});
|
|
976
|
+
|
|
977
|
+
const __default__$1 = defineComponent({
|
|
978
|
+
name: "ElRadioButton"
|
|
979
|
+
});
|
|
980
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
981
|
+
...__default__$1,
|
|
982
|
+
props: radioButtonProps,
|
|
983
|
+
setup(__props) {
|
|
984
|
+
const props = __props;
|
|
985
|
+
const ns = useNamespace("radio");
|
|
986
|
+
const { radioRef, focus, size, disabled, modelValue, radioGroup, actualValue } = useRadio(props);
|
|
987
|
+
const activeStyle = computed(() => {
|
|
988
|
+
return {
|
|
989
|
+
backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
|
|
990
|
+
borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
|
|
991
|
+
boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
|
|
992
|
+
color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
|
|
993
|
+
};
|
|
994
|
+
});
|
|
995
|
+
return (_ctx, _cache) => {
|
|
996
|
+
var _a;
|
|
997
|
+
return openBlock(), createElementBlock("label", {
|
|
998
|
+
class: normalizeClass([
|
|
999
|
+
unref(ns).b("button"),
|
|
1000
|
+
unref(ns).is("active", unref(modelValue) === unref(actualValue)),
|
|
1001
|
+
unref(ns).is("disabled", unref(disabled)),
|
|
1002
|
+
unref(ns).is("focus", unref(focus)),
|
|
1003
|
+
unref(ns).bm("button", unref(size))
|
|
1004
|
+
])
|
|
1005
|
+
}, [
|
|
1006
|
+
withDirectives(createElementVNode("input", {
|
|
1007
|
+
ref_key: "radioRef",
|
|
1008
|
+
ref: radioRef,
|
|
1009
|
+
"onUpdate:modelValue": ($event) => isRef(modelValue) ? modelValue.value = $event : null,
|
|
1010
|
+
class: normalizeClass(unref(ns).be("button", "original-radio")),
|
|
1011
|
+
value: unref(actualValue),
|
|
1012
|
+
type: "radio",
|
|
1013
|
+
name: _ctx.name || ((_a = unref(radioGroup)) == null ? void 0 : _a.name),
|
|
1014
|
+
disabled: unref(disabled),
|
|
1015
|
+
onFocus: ($event) => focus.value = true,
|
|
1016
|
+
onBlur: ($event) => focus.value = false,
|
|
1017
|
+
onClick: withModifiers(() => {
|
|
1018
|
+
}, ["stop"])
|
|
1019
|
+
}, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "onFocus", "onBlur", "onClick"]), [
|
|
1020
|
+
[vModelRadio, unref(modelValue)]
|
|
1021
|
+
]),
|
|
1022
|
+
createElementVNode("span", {
|
|
1023
|
+
class: normalizeClass(unref(ns).be("button", "inner")),
|
|
1024
|
+
style: normalizeStyle(unref(modelValue) === unref(actualValue) ? unref(activeStyle) : {}),
|
|
1025
|
+
onKeydown: withModifiers(() => {
|
|
1026
|
+
}, ["stop"])
|
|
1027
|
+
}, [
|
|
1028
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
1029
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
1030
|
+
])
|
|
1031
|
+
], 46, ["onKeydown"])
|
|
1032
|
+
], 2);
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
var RadioButton = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "radio-button.vue"]]);
|
|
1037
|
+
|
|
1038
|
+
const radioGroupProps = buildProps({
|
|
1039
|
+
id: {
|
|
1040
|
+
type: String,
|
|
1041
|
+
default: void 0
|
|
1042
|
+
},
|
|
1043
|
+
size: useSizeProp,
|
|
1044
|
+
disabled: {
|
|
1045
|
+
type: Boolean,
|
|
1046
|
+
default: void 0
|
|
1047
|
+
},
|
|
1048
|
+
modelValue: {
|
|
1049
|
+
type: [String, Number, Boolean],
|
|
1050
|
+
default: void 0
|
|
1051
|
+
},
|
|
1052
|
+
fill: {
|
|
1053
|
+
type: String,
|
|
1054
|
+
default: ""
|
|
1055
|
+
},
|
|
1056
|
+
textColor: {
|
|
1057
|
+
type: String,
|
|
1058
|
+
default: ""
|
|
1059
|
+
},
|
|
1060
|
+
name: {
|
|
1061
|
+
type: String,
|
|
1062
|
+
default: void 0
|
|
1063
|
+
},
|
|
1064
|
+
validateEvent: {
|
|
1065
|
+
type: Boolean,
|
|
1066
|
+
default: true
|
|
1067
|
+
},
|
|
1068
|
+
options: {
|
|
1069
|
+
type: definePropType(Array)
|
|
1070
|
+
},
|
|
1071
|
+
props: {
|
|
1072
|
+
type: definePropType(Object),
|
|
1073
|
+
default: () => radioDefaultProps
|
|
1074
|
+
},
|
|
1075
|
+
type: {
|
|
1076
|
+
type: String,
|
|
1077
|
+
values: ["radio", "button"],
|
|
1078
|
+
default: "radio"
|
|
1079
|
+
},
|
|
1080
|
+
...useAriaProps(["ariaLabel"])
|
|
1081
|
+
});
|
|
1082
|
+
const radioGroupEmits = radioEmits;
|
|
1083
|
+
const radioDefaultProps = {
|
|
1084
|
+
label: "label",
|
|
1085
|
+
value: "value",
|
|
1086
|
+
disabled: "disabled"
|
|
1087
|
+
};
|
|
1088
|
+
|
|
1089
|
+
const __default__ = defineComponent({
|
|
1090
|
+
name: "ElRadioGroup"
|
|
1091
|
+
});
|
|
1092
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1093
|
+
...__default__,
|
|
1094
|
+
props: radioGroupProps,
|
|
1095
|
+
emits: radioGroupEmits,
|
|
1096
|
+
setup(__props, { emit }) {
|
|
1097
|
+
const props = __props;
|
|
1098
|
+
const ns = useNamespace("radio");
|
|
1099
|
+
const radioId = useId();
|
|
1100
|
+
const radioGroupRef = ref();
|
|
1101
|
+
const { formItem } = useFormItem();
|
|
1102
|
+
const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
|
|
1103
|
+
formItemContext: formItem
|
|
1104
|
+
});
|
|
1105
|
+
const changeEvent = (value) => {
|
|
1106
|
+
emit(UPDATE_MODEL_EVENT, value);
|
|
1107
|
+
nextTick(() => emit(CHANGE_EVENT, value));
|
|
1108
|
+
};
|
|
1109
|
+
onMounted(() => {
|
|
1110
|
+
const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
|
|
1111
|
+
const firstLabel = radios[0];
|
|
1112
|
+
if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
|
|
1113
|
+
firstLabel.tabIndex = 0;
|
|
1114
|
+
}
|
|
1115
|
+
});
|
|
1116
|
+
const name = computed(() => {
|
|
1117
|
+
return props.name || radioId.value;
|
|
1118
|
+
});
|
|
1119
|
+
const aliasProps = computed(() => ({
|
|
1120
|
+
...radioDefaultProps,
|
|
1121
|
+
...props.props
|
|
1122
|
+
}));
|
|
1123
|
+
const getOptionProps = (option) => {
|
|
1124
|
+
const { label, value, disabled } = aliasProps.value;
|
|
1125
|
+
const base = {
|
|
1126
|
+
label: option[label],
|
|
1127
|
+
value: option[value],
|
|
1128
|
+
disabled: option[disabled]
|
|
1129
|
+
};
|
|
1130
|
+
return { ...omit(option, [label, value, disabled]), ...base };
|
|
1131
|
+
};
|
|
1132
|
+
const optionComponent = computed(() => props.type === "button" ? RadioButton : Radio);
|
|
1133
|
+
provide(radioGroupKey, reactive({
|
|
1134
|
+
...toRefs(props),
|
|
1135
|
+
changeEvent,
|
|
1136
|
+
name
|
|
1137
|
+
}));
|
|
1138
|
+
watch(() => props.modelValue, (newVal, oldValue) => {
|
|
1139
|
+
if (props.validateEvent && !isEqual(newVal, oldValue)) {
|
|
1140
|
+
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
return (_ctx, _cache) => {
|
|
1144
|
+
return openBlock(), createElementBlock("div", {
|
|
1145
|
+
id: unref(groupId),
|
|
1146
|
+
ref_key: "radioGroupRef",
|
|
1147
|
+
ref: radioGroupRef,
|
|
1148
|
+
class: normalizeClass(unref(ns).b("group")),
|
|
1149
|
+
role: "radiogroup",
|
|
1150
|
+
"aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "radio-group" : void 0,
|
|
1151
|
+
"aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem).labelId : void 0
|
|
1152
|
+
}, [
|
|
1153
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
1154
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item, index) => {
|
|
1155
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(optionComponent)), mergeProps({ key: index }, getOptionProps(item)), null, 16);
|
|
1156
|
+
}), 128))
|
|
1157
|
+
])
|
|
1158
|
+
], 10, ["id", "aria-label", "aria-labelledby"]);
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
});
|
|
1162
|
+
var RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "radio-group.vue"]]);
|
|
1163
|
+
|
|
1164
|
+
const ElRadio = withInstall(Radio, {
|
|
1165
|
+
RadioButton,
|
|
1166
|
+
RadioGroup
|
|
1167
|
+
});
|
|
1168
|
+
const ElRadioGroup = withNoopInstall(RadioGroup);
|
|
1169
|
+
withNoopInstall(RadioButton);
|
|
1170
|
+
|
|
1171
|
+
export { ElRadioGroup as E, ElCheckboxGroup as a, ElCheckbox as b, ElRadio as c };
|