ranui 0.1.9 → 0.1.10-alpha-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/README.zh-CN.md +192 -0
- package/dist/assets/image/failImage.d.ts +2 -0
- package/dist/button.js +7 -0
- package/dist/checkbox.js +7 -0
- package/dist/colorpicker.js +11 -0
- package/dist/components/button/index.d.ts +8 -5
- package/dist/components/checkbox/index.d.ts +30 -0
- package/dist/components/colorpicker/index.d.ts +120 -0
- package/dist/components/dropdown/index.d.ts +34 -0
- package/dist/components/input/index.d.ts +66 -41
- package/dist/components/loading/index.d.ts +76 -0
- package/dist/components/math/index.d.ts +16 -0
- package/dist/components/message/index.d.ts +10 -7
- package/dist/components/player/index.d.ts +46 -9
- package/dist/components/popover/content/index.d.ts +16 -0
- package/dist/components/popover/index.d.ts +91 -0
- package/dist/components/preview/constant.d.ts +5 -0
- package/dist/components/preview/index.d.ts +1 -4
- package/dist/components/preview/pdf.d.ts +51 -1
- package/dist/components/preview/types.d.ts +11 -0
- package/dist/components/progress/index.d.ts +12 -7
- package/dist/components/radar/index.d.ts +1 -1
- package/dist/components/scratch/index.d.ts +7 -5
- package/dist/components/select/dropdown-item/index.d.ts +23 -0
- package/dist/components/select/index.d.ts +22 -13
- package/dist/components/select/option/index.d.ts +2 -0
- package/dist/components/tab/index.d.ts +80 -64
- package/dist/components/tabpane/index.d.ts +73 -57
- package/dist/icon.js +6 -0
- package/dist/iconShadowless.js +6 -0
- package/dist/image.js +4 -0
- package/dist/{index-01b17e26.js → index-BEm1a2pr.js} +3 -6
- package/dist/{index-e2e5d725.js → index-BSyn-jmY.js} +4734 -2976
- package/dist/index-BVD0qcjJ.js +656 -0
- package/dist/{index-e03d23e7.js → index-Bb55l8nf.js} +2 -11
- package/dist/{index-0d5b9435.js → index-BbW0dxzy.js} +12 -16
- package/dist/index-BgUpm4LA.js +103 -0
- package/dist/{index-458debf7.js → index-C841uRgZ.js} +16 -51
- package/dist/{index-4443363f.js → index-CUZna268.js} +41 -69
- package/dist/index-CiA5qRK3.js +381 -0
- package/dist/index-CoJMn8Jm.js +511 -0
- package/dist/{index-b7790662.js → index-DAxs7Dd2.js} +6 -13
- package/dist/index-DHI8URkB.js +309 -0
- package/dist/index-D_cD4u43.js +70 -0
- package/dist/index-DghvN1MU.js +710 -0
- package/dist/index-DvSe_Ms7.js +494 -0
- package/dist/{index-7216d6b0.js → index-W52VzrXL.js} +20 -49
- package/dist/index-gBy2cXLV.js +140 -0
- package/dist/index-hdtEL8P_.js +101 -0
- package/dist/{index-1048a998.js → index-jVKJoKXA.js} +105 -62
- package/dist/{index-2d16a084.js → index-ltt3w4zP.js} +13 -23
- package/dist/index-n4X6wdwJ.js +156 -0
- package/dist/{index-3cf72afd.js → index-s0ioL3L2.js} +23 -45
- package/dist/index.d.ts +276 -14
- package/dist/index.js +24 -24
- package/dist/input.js +7 -0
- package/dist/inputShadowless.js +6 -0
- package/dist/katex-es-CGqSCDjs.js +14634 -0
- package/dist/loading-scene-BMc2wqKm.js +4 -0
- package/dist/loading.js +8 -0
- package/dist/math.js +7 -0
- package/dist/message.js +6 -0
- package/dist/modal.js +4 -0
- package/dist/more-2vsTDpcc.js +31 -0
- package/dist/pdf-BKWcQYL4.js +136 -0
- package/dist/player.js +8 -0
- package/dist/plus-DgJxWGlo.js +56799 -0
- package/dist/popover.js +9 -0
- package/dist/preview.js +7 -0
- package/dist/progress.js +7 -0
- package/dist/radar.js +6 -0
- package/dist/ranui.css +1 -0
- package/dist/search-BWdfjyP8.js +4 -0
- package/dist/select.js +10 -0
- package/dist/{index-1b73beee.js → selectShadowless.js} +159 -167
- package/dist/{umd/components → shadowless}/icon/index.d.ts +1 -0
- package/dist/{umd/components → shadowless}/input/index.d.ts +66 -41
- package/dist/{umd/components → shadowless}/select/index.d.ts +19 -16
- package/dist/shadowless/select/option/index.d.ts +2 -0
- package/dist/shadowless.d.ts +3 -0
- package/dist/shadowless.js +8 -0
- package/dist/skeleton.js +4 -0
- package/dist/sort-DWqiUONr.js +4 -0
- package/dist/sprite-CH2zLtZy.js +141 -0
- package/dist/tab.js +6 -0
- package/dist/tabpane.js +4 -0
- package/dist/tsconfig.json +31 -0
- package/dist/typings.d.ts +257 -0
- package/dist/umd/index.css +1 -0
- package/dist/umd/index.umd.cjs +1 -71
- package/dist/umd/shadowless/shadowless.css +1 -0
- package/dist/umd/shadowless/shadowless.umd.cjs +1 -0
- package/dist/utils/color.d.ts +52 -0
- package/dist/utils/image.d.ts +8 -1
- package/dist/utils/index.d.ts +20 -5
- package/dist/utils/math.d.ts +3 -3
- package/dist/vite.config.d.ts +1 -0
- package/dist/without-content-CdJw7vHM.js +4 -0
- package/package.json +115 -64
- package/readme.md +41 -57
- package/typings.d.ts +257 -0
- package/dist/colz-746223ab.js +0 -241
- package/dist/components/button/index.js +0 -8
- package/dist/components/icon/index.js +0 -6
- package/dist/components/image/index.js +0 -4
- package/dist/components/input/index.js +0 -6
- package/dist/components/message/index.js +0 -4
- package/dist/components/modal/index.js +0 -4
- package/dist/components/option/index.d.ts +0 -2
- package/dist/components/option/index.js +0 -95
- package/dist/components/player/index.js +0 -12
- package/dist/components/preview/colz.d.ts +0 -72
- package/dist/components/preview/docx.d.ts +0 -8
- package/dist/components/preview/excel/excel.d.ts +0 -2
- package/dist/components/preview/excel/index.d.ts +0 -1
- package/dist/components/preview/excel/media.d.ts +0 -37
- package/dist/components/preview/index.js +0 -8
- package/dist/components/preview/pptx/index.d.ts +0 -16
- package/dist/components/preview/pptx/process_pptx.d.ts +0 -23
- package/dist/components/preview/pptx/t_xml.d.ts +0 -1
- package/dist/components/preview/pptx/worker.d.ts +0 -1
- package/dist/components/progress/index.js +0 -8
- package/dist/components/radar/index.js +0 -7
- package/dist/components/select/index.js +0 -11
- package/dist/components/skeleton/index.js +0 -4
- package/dist/components/tab/index.js +0 -7
- package/dist/components/tabpane/index.js +0 -4
- package/dist/docx-c5d02d8c.js +0 -21
- package/dist/index-57492b9b.js +0 -48
- package/dist/index-73ce455b.js +0 -264
- package/dist/index-7913ec46.js +0 -239
- package/dist/index-7b8840f9.js +0 -18690
- package/dist/index-c14450a9.js +0 -662
- package/dist/pdf-bdb7818a.js +0 -113
- package/dist/style.css +0 -1
- package/dist/umd/build/config.d.ts +0 -3
- package/dist/umd/build/config.umd.d.ts +0 -2
- package/dist/umd/components/button/index.d.ts +0 -35
- package/dist/umd/components/form/index.d.ts +0 -2
- package/dist/umd/components/image/index.d.ts +0 -2
- package/dist/umd/components/message/index.d.ts +0 -14
- package/dist/umd/components/modal/index.d.ts +0 -2
- package/dist/umd/components/option/index.d.ts +0 -2
- package/dist/umd/components/player/index.d.ts +0 -213
- package/dist/umd/components/preview/colz.d.ts +0 -72
- package/dist/umd/components/preview/docx.d.ts +0 -8
- package/dist/umd/components/preview/excel/excel.d.ts +0 -2
- package/dist/umd/components/preview/excel/index.d.ts +0 -1
- package/dist/umd/components/preview/excel/media.d.ts +0 -37
- package/dist/umd/components/preview/index.d.ts +0 -6
- package/dist/umd/components/preview/pdf.d.ts +0 -1
- package/dist/umd/components/preview/pptx/index.d.ts +0 -16
- package/dist/umd/components/preview/pptx/process_pptx.d.ts +0 -23
- package/dist/umd/components/preview/pptx/t_xml.d.ts +0 -1
- package/dist/umd/components/preview/pptx/worker.d.ts +0 -1
- package/dist/umd/components/progress/index.d.ts +0 -36
- package/dist/umd/components/radar/index.d.ts +0 -2
- package/dist/umd/components/scratch/index.d.ts +0 -19
- package/dist/umd/components/skeleton/index.d.ts +0 -2
- package/dist/umd/components/tab/index.d.ts +0 -408
- package/dist/umd/components/tabpane/index.d.ts +0 -352
- package/dist/umd/index.d.ts +0 -14
- package/dist/umd/playwright.config.d.ts +0 -9
- package/dist/umd/plugins/auto-import-file.d.ts +0 -0
- package/dist/umd/plugins/load-style.d.ts +0 -6
- package/dist/umd/plugins/load-svg.d.ts +0 -9
- package/dist/umd/style.css +0 -1
- package/dist/umd/tests/button.spec.d.ts +0 -1
- package/dist/umd/utils/image.d.ts +0 -32
- package/dist/umd/utils/index.d.ts +0 -64
- package/dist/umd/utils/math.d.ts +0 -26
- package/dist/umd/utils/tween.d.ts +0 -21
- package/dist/umd/vite.config.d.ts +0 -6
- package/dist/vendor-f71e6f68.js +0 -92126
- /package/dist/{add-user-b2bed3e7.js → add-user-BN1JlY7e.js} +0 -0
- /package/dist/{book-b11a68eb.js → book-nTEFXU2x.js} +0 -0
- /package/dist/{umd/build/config.es.d.ts → build/config.sha.d.ts} +0 -0
- /package/dist/{check-circle-fill-dc284144.js → check-circle-fill-B_pd8ZSs.js} +0 -0
- /package/dist/{check-circle-74bd09c3.js → check-circle-szyAJiap.js} +0 -0
- /package/dist/{close-20925345.js → close-CFnkhudp.js} +0 -0
- /package/dist/{close-circle-720c18be.js → close-circle-CwmuN2C6.js} +0 -0
- /package/dist/{close-circle-fill-238a66b1.js → close-circle-fill-jSqPPw9i.js} +0 -0
- /package/dist/{eye-5e742329.js → eye-D_mEt17f.js} +0 -0
- /package/dist/{eye-close-3874f1ae.js → eye-close-BVr3NJtg.js} +0 -0
- /package/dist/{home-c4a05e8b.js → home-BUQ4USMk.js} +0 -0
- /package/dist/{index-8e1e2573.js → index-CQTJoWhb.js} +0 -0
- /package/dist/{info-circle-5826decc.js → info-circle-COnL5bTJ.js} +0 -0
- /package/dist/{info-circle-fill-90ec9aa9.js → info-circle-fill-DjI8gXS3.js} +0 -0
- /package/dist/{loading-09ca52df.js → loading-Dcc5RApI.js} +0 -0
- /package/dist/{lock-1d2487c9.js → lock-Cr7BnmWN.js} +0 -0
- /package/dist/{message-b2bfdea7.js → message-D36_Zo2l.js} +0 -0
- /package/dist/{power-off-6ade5a91.js → power-off-lQRbiBak.js} +0 -0
- /package/dist/{preview-b291aea8.js → preview-CJbz9GjO.js} +0 -0
- /package/dist/{setting-1e5ccb6d.js → setting-DemlgzVC.js} +0 -0
- /package/dist/{team-ca6a12e1.js → team-tl4NJXPC.js} +0 -0
- /package/dist/{unlock-f56086fd.js → unlock-CeU74z9n.js} +0 -0
- /package/dist/{user-5c01e665.js → user-B-eVXwuk.js} +0 -0
- /package/dist/{warning-circle-035e025c.js → warning-circle-DDUgEDIv.js} +0 -0
- /package/dist/{warning-circle-fill-d17c37c9.js → warning-circle-fill-lODUKz0i.js} +0 -0
|
@@ -0,0 +1,656 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { c as create, a as addClassToElement, r as removeClassToElement, i as isMobile, h as generateThrottle } from "./plus-DgJxWGlo.js";
|
|
5
|
+
import { c as createCustomError, i as isDisabled, H as HTMLElementSSR } from "./index-hdtEL8P_.js";
|
|
6
|
+
import "./index-BgUpm4LA.js";
|
|
7
|
+
import "./index-n4X6wdwJ.js";
|
|
8
|
+
import "./index-DvSe_Ms7.js";
|
|
9
|
+
const f7170ee498e0dd32cbdcb63fba8f75cc = '.remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}r-select{position:var(--ran-select, relative);width:var(--ran-select, 120px);height:var(--ran-select, 40px)}:host{position:var(--ran-select-host, relative);display:var(--ran-select-host, inline-block);cursor:var(--ran-select-host, pointer);height:var(--ran-select-host, 32px);outline:var(--ran-select-host, 0);-webkit-tap-highlight-color:var(--ran-select-host-highlight-color, transparent)}:host,:host(:focus),:host(:active){outline:var(--ran-select-host-focus-outline, 0);-webkit-tap-highlight-color:transparent}:host ::slotted(r-option){display:var(--ran-select-host-option-display, none)}:host([disabled]){cursor:var(--ran-select-host-disabled-cursor, not-allowed);pointer-events:var(--ran-select-host-disabled-pointer-events, all);opacity:var(--ran-select-host-disabled-opacity, .6)}:host(:not([disabled]):hover) .select{cursor:var(--ran-select-host-hover-cursor, pointer)}:host(:not([disabled],[type="text"]):hover) .selection{border:var(--ran-select-host-selection-border, 1px solid #1890ff)}:host(:not([disabled],[type="text"]):hover) .selection-search{cursor:var(--ran-select-host-selection-search-cursor, pointer)}:host(:not([disabled],[type="text"]):hover) .selection-item{cursor:var(--ran-select-host-selection-item-cursor, pointer);color:var(--ran-select-host-selection-item-color, #bfbfbf)}:host([type="text"])::part(selection){border:var(--ran-select-host-type-text-selection-border, none)}:host([type="text"])::part(icon){display:var(--ran-select-host-type-text-icon-display, none)}:host(:not([disabled]):focus) .selection{border:var(--ran-select-host-selection-focus-border, 1px solid #1890ff)}:host(:not([disabled]):focus) .selection-search{cursor:var(--ran-select-host-selection-focus-search-cursor, pointer)}:host(:not([disabled]):focus) .selection-item{cursor:var(--ran-select-host-selection-focus-item-cursor, pointer);color:var(--ran-select-host-selection-focus-item-color, #bfbfbf)}:host .selection-search{display:var(--ran-select-host-selection-search-display, none)}:host([showSearch]:not([disabled])) .selection-search{cursor:var(--ran-select-host-showSearch-selection-search-cursor, text);display:var(--ran-select-host-showSearch-selection-search-display, block)}:host([showSearch]:not([disabled])) .selection-item{cursor:var(--ran-select-host-showSearch-selection-item-cursor, pointer)}:host([showSearch]:not([disabled]):focus) .selection-search{display:var(--ran-select-host-showSearch-selection-search-display, block);cursor:var(--ran-select-host-showSearch-selection-search-cursor, text);opacity:var(--ran-select-host-showSearch-selection-search-opacity, 1)}.ran-select{width:var(--ran-select-width, 100%);height:var(--ran-select-width, 100%);font-size:var(--ran-select-font-size, 14px);box-sizing:var(--ran-select-box-sizing, border-box);margin:var(--ran-select-margin, 0);padding:var(--ran-select-padding, 0);color:var(--ran-select-color, rgba(0, 0, 0, .88));line-height:var(--ran-select-line-height, 1.57142857);list-style:var(--ran-select-list-style, none);font-family:var(--ran-select-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");position:var(--ran-select-position, relative);display:var(--ran-select-display, inline-block)}.ran-select .selection{position:var(--ran-select-selection-position, relative);background-color:var(--ran-select-selection-background-color, #ffffff);border:var(--ran-select-selection-border, 1px solid #d9d9d9);transition:var(--ran-select-selection-transition, all .2s cubic-bezier(.645, .045, .355, 1));width:var(--ran-select-selection-width, 100%);height:var(--ran-select-selection-height, 100%);padding:var(--ran-select-selection-padding, 0 11px);box-sizing:var(--ran-select-selection-box-sizing, border-box);margin:var(--ran-select-selection-margin, 0);color:var(--ran-select-selection-color, rgba(0, 0, 0, .88));font-size:var(--ran-select-selection-font-size, 14px);line-height:var(--ran-select-selection-line-height, 1.57142857);list-style:var(--ran-select-selection-list-style, none);font-family:var(--ran-select-selection-font-family, inherit);display:var(--ran-select-selection-display, flex);border-radius:var(--ran-select-selection-border-radius, 6px)}.ran-select .selection-search{position:var(--ran-select-selection-search-position, absolute);opacity:var(--ran-select-selection-search-opacity, 0);top:var(--ran-select-selection-search-top, 0);left:var(--ran-select-selection-search-left, 0);height:var(--ran-select-selection-search-height, 100%);inset-inline-start:var(--ran-select-selection-search-inset-inline-start, 11px);inset-inline-end:var(--ran-select-selection-search-inset-inline-end, 11px);margin:var(--ran-select-selection-search-margin, 0);padding:var(--ran-select-selection-search-padding, 0);background:var(--ran-select-selection-search-background, transparent);border:var(--ran-select-selection-search-border, none);outline:var(--ran-select-selection-search-outline, none);-webkit-appearance:var(--ran-select-selection-search-appearance, none);-moz-appearance:var(--ran-select-selection-search-appearance, none);appearance:var(--ran-select-selection-search-appearance, none);font-family:var(--ran-select-selection-search-font-family, inherit);cursor:var(--ran-select-selection-search-cursor, not-allowed)}.ran-select .selection-search::-webkit-search-cancel-button{display:var(--ran-select-host-selection-search-cancel-button-display, none);-webkit-appearance:var(--ran-select-host-selection-search-cancel-button-webkit-appearance, none)}.ran-select .selection-search::part(ran-input){border:var(--ran-select-host-selection-search-ran-input-border, none);padding:var(--ran-select-host-selection-search-ran-input-padding, 0);height:var(--ran-select-host-selection-search-ran-input-height, 100%);outline:var(--ran-select-host-selection-search-ran-input-outline, none)}.ran-select .selection-search::part(ran-input):active{border:var(--ran-select-host-selection-search-ran-input-active-border, none);padding:var(--ran-select-host-selection-search-ran-input-active-padding, 0);height:var(--ran-select-host-selection-search-ran-input-active-height, 100%);outline:var(--ran-select-host-selection-search-ran-input-active-outline, none);border-color:var(--ran-select-host-selection-search-ran-input-active-border-color, transparent);box-shadow:var(--ran-select-host-selection-search-ran-input-active-box-shadow, none);border-right-width:var(--ran-select-host-selection-search-ran-input-active-border-right-width, 0px)}.ran-select .selection-item{position:var(--ran-select-selection-item-position, absolute);top:var(--ran-select-selection-item-top, 0);left:var(--ran-select-selection-item-left, 12px);margin:var(--ran-select-selection-item-margin, 0);padding:var(--ran-select-selection-item-padding, 0);background:var(--ran-select-selection-item-background, transparent);border:var(--ran-select-selection-item-border, none);outline:var(--ran-select-selection-item-outline, none);-webkit-appearance:var(--ran-select-selection-item-appearance, none);-moz-appearance:var(--ran-select-selection-item-appearance, none);appearance:var(--ran-select-selection-item-appearance, none);font-family:var(--ran-select-selection-item-font-family, inherit);height:var(--ran-select-selection-item-height, 100%);-webkit-user-select:var(--ran-select-selection-item-user-select, none);user-select:var(--ran-select-selection-item-user-select, none);overflow:var(--ran-select-selection-item-overflow, hidden);white-space:var(--ran-select-selection-item-white-space, nowrap);text-overflow:var(--ran-select-selection-item-text-overflow, ellipsis);cursor:var(--ran-select-selection-item-cursor, pointer)}.ran-select .selection-select{color:var(--ran-select-selection-select-color, rgba(0, 0, 0, .25))}.ran-select .selection .icon{display:var(--ran-select-selection-icon-display, flex);align-items:var(--ran-select-selection-icon-align-items, center);color:var(--ran-select-selection-icon-color, rgba(0, 0, 0, .25));font-style:var(--ran-select-selection-icon-font-style, normal);text-align:var(--ran-select-selection-icon-text-align, center);text-transform:var(--ran-select-selection-icon-text-transform, none);text-rendering:var(--ran-select-selection-icon-text-rendering, optimizeLegibility);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:var(--ran-select-selection-icon-position, absolute);top:var(--ran-select-selection-icon-top, 50%);inset-inline-start:var(--ran-select-selection-icon-inset-inline-start, auto);inset-inline-end:var(--ran-select-selection-icon-inset-inline-end, 8px);height:var(--ran-select-selection-icon-height, 12px);margin-top:var(--ran-select-selection-icon-margin-top, -3px);font-size:var(--ran-select-selection-icon-font-size, 12px);pointer-events:var(--ran-select-selection-icon-color, pointer-events)}';
|
|
10
|
+
function Custom$2() {
|
|
11
|
+
if (typeof document !== "undefined" && !customElements.get("r-option")) {
|
|
12
|
+
class Option extends HTMLElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
__publicField(this, "_option");
|
|
16
|
+
__publicField(this, "_optionContent");
|
|
17
|
+
__publicField(this, "_shadowDom");
|
|
18
|
+
__publicField(this, "_slot");
|
|
19
|
+
this._slot = document.createElement("slot");
|
|
20
|
+
this._option = document.createElement("div");
|
|
21
|
+
this._option.setAttribute("class", "ran-option");
|
|
22
|
+
this._optionContent = document.createElement("div");
|
|
23
|
+
this._optionContent.setAttribute("class", "ran-option-content");
|
|
24
|
+
this._optionContent.appendChild(this._slot);
|
|
25
|
+
this._option.appendChild(this._optionContent);
|
|
26
|
+
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
27
|
+
this._shadowDom = shadowRoot;
|
|
28
|
+
shadowRoot.appendChild(this._option);
|
|
29
|
+
}
|
|
30
|
+
static get observedAttributes() {
|
|
31
|
+
return ["disabled", "sheet", "value"];
|
|
32
|
+
}
|
|
33
|
+
get value() {
|
|
34
|
+
return this.getAttribute("value");
|
|
35
|
+
}
|
|
36
|
+
set value(value) {
|
|
37
|
+
this.setAttribute("value", value || "");
|
|
38
|
+
}
|
|
39
|
+
get sheet() {
|
|
40
|
+
return this.getAttribute("sheet");
|
|
41
|
+
}
|
|
42
|
+
set sheet(value) {
|
|
43
|
+
this.setAttribute("sheet", value || "");
|
|
44
|
+
}
|
|
45
|
+
get disabled() {
|
|
46
|
+
return isDisabled(this);
|
|
47
|
+
}
|
|
48
|
+
set disabled(value) {
|
|
49
|
+
if (!value || value === "false") {
|
|
50
|
+
this.removeAttribute("disabled");
|
|
51
|
+
} else {
|
|
52
|
+
this.setAttribute("disabled", "");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
handlerExternalCss() {
|
|
56
|
+
if (this.sheet) {
|
|
57
|
+
try {
|
|
58
|
+
const sheet = new CSSStyleSheet();
|
|
59
|
+
sheet.insertRule(this.sheet);
|
|
60
|
+
this._shadowDom.adoptedStyleSheets = [sheet];
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.error(`Failed to parse the rule in CSSStyleSheet: ${this.sheet}, error: ${error}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
67
|
+
if (name === "disabled" && this._option) {
|
|
68
|
+
if (!newValue || newValue === "false") {
|
|
69
|
+
this._option.setAttribute("disabled", "");
|
|
70
|
+
} else {
|
|
71
|
+
this._option.removeAttribute("disabled");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (name === "sheet" && this._shadowDom && oldValue !== newValue) this.handlerExternalCss();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return Option;
|
|
78
|
+
} else {
|
|
79
|
+
return createCustomError("document is undefined or r-option is exist");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
Custom$2();
|
|
83
|
+
const less = '.remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}.ranui-dropdown-option-item{position:var(--ran-dropdown-option-item-position, relative);display:var(--ran-dropdown-option-item-display, block);padding:var(--ran-dropdown-option-item-padding, 5px 12px);color:var(--ran-dropdown-option-item-color, rgba(0, 0, 0, .88));font-weight:var(--ran-dropdown-option-item-font-weight, normal);font-size:var(--ran-dropdown-option-item-font-size, 14px);transition:var(--ran-dropdown-option-item-transition, background .3s ease);border-radius:var(--ran-dropdown-option-item-border-radius, 4px);cursor:var(--ran-dropdown-option-item-cursor, pointer)}.ranui-dropdown-option-item:hover{background-color:var(--ran-dropdown-option-item-hover-background-color, rgba(0, 0, 0, .04))}.ranui-dropdown-option-item-content{text-align:var(--ran-dropdown-content-text-align, left);overflow:var(--ran-dropdown-content-overflow, hidden);white-space:var(--ran-dropdown-content-white-space, nowrap);text-overflow:var(--ran-dropdown-content-text-overflow, ellipsis);color:var(--ran-dropdown-content-color, rgba(0, 0, 0, .88));font-size:var(--ran-dropdown-content-font-size, 14px);line-height:var(--ran-dropdown-content-line-height, 1.57142857);box-sizing:var(--ran-dropdown-content-box-sizing, border-box);list-style:var(--ran-dropdown-content-list-style, none);font-family:var(--ran-dropdown-content-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-variant:var(--ran-dropdown-content-font-variant, initial)}.ranui-dropdown-option-active{background-color:var(--ran-dropdown-option-active-background-color, #e6f7ff);font-weight:var(--ran-dropdown-option-active-font-weight, bold)}.ranui-dropdown-option-active:hover{background-color:var(--ran-dropdown-option-active-hover-background-color, #e6f7ff)}';
|
|
84
|
+
class DropdownItem extends HTMLElementSSR() {
|
|
85
|
+
constructor() {
|
|
86
|
+
super();
|
|
87
|
+
__publicField(this, "ionDropdownItem");
|
|
88
|
+
__publicField(this, "_slot");
|
|
89
|
+
__publicField(this, "_shadowDom");
|
|
90
|
+
__publicField(this, "ionDropdownItemContent");
|
|
91
|
+
this._slot = create("slot").setAttribute("class", "slot");
|
|
92
|
+
this.ionDropdownItemContent = create("div").setAttribute("class", "ranui-dropdown-option-item-content").setAttribute("part", "ranui-dropdown-option-item-content").addChild(this._slot);
|
|
93
|
+
this.ionDropdownItem = create("div").setAttribute("class", "ranui-dropdown-option-item").setAttribute("part", "ranui-dropdown-option-item").addChild([this.ionDropdownItemContent]);
|
|
94
|
+
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
95
|
+
this._shadowDom = shadowRoot;
|
|
96
|
+
const style = create("style").setTextContent(less);
|
|
97
|
+
shadowRoot.appendChild(style.element);
|
|
98
|
+
shadowRoot.appendChild(this.ionDropdownItem.element);
|
|
99
|
+
}
|
|
100
|
+
static get observedAttributes() {
|
|
101
|
+
return ["active", "value", "title"];
|
|
102
|
+
}
|
|
103
|
+
get value() {
|
|
104
|
+
return this.getAttribute("value") || "";
|
|
105
|
+
}
|
|
106
|
+
set value(value) {
|
|
107
|
+
if (!isDisabled(this) && value) {
|
|
108
|
+
this.setAttribute("value", value);
|
|
109
|
+
} else {
|
|
110
|
+
this.removeAttribute("value");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
get active() {
|
|
114
|
+
return this.getAttribute("active") || "";
|
|
115
|
+
}
|
|
116
|
+
set active(value) {
|
|
117
|
+
if (value) {
|
|
118
|
+
this.setAttribute("active", value);
|
|
119
|
+
} else {
|
|
120
|
+
this.removeAttribute("active");
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
get title() {
|
|
124
|
+
return this.getAttribute("title") || "";
|
|
125
|
+
}
|
|
126
|
+
set title(value) {
|
|
127
|
+
if (value) {
|
|
128
|
+
this.setAttribute("title", value);
|
|
129
|
+
} else {
|
|
130
|
+
this.removeAttribute("title");
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
connectedCallback() {
|
|
134
|
+
if (this.active) {
|
|
135
|
+
addClassToElement(this.ionDropdownItem.element, "ranui-dropdown-option-active");
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
attributeChangedCallback(name, _, newValue) {
|
|
139
|
+
if (name === "active" && newValue) {
|
|
140
|
+
addClassToElement(this.ionDropdownItem.element, "ranui-dropdown-option-active");
|
|
141
|
+
} else {
|
|
142
|
+
removeClassToElement(this.ionDropdownItem.element, "ranui-dropdown-option-active");
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function Custom$1() {
|
|
147
|
+
if (typeof document !== "undefined" && !customElements.get("r-dropdown-item")) {
|
|
148
|
+
customElements.define("r-dropdown-item", DropdownItem);
|
|
149
|
+
return DropdownItem;
|
|
150
|
+
} else {
|
|
151
|
+
return createCustomError("document is undefined or r-dropdown-item is exist");
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
Custom$1();
|
|
155
|
+
const placementDirection = {
|
|
156
|
+
bottom: {
|
|
157
|
+
add: "ran-dropdown-down-in",
|
|
158
|
+
remove: "ran-dropdown-down-out"
|
|
159
|
+
},
|
|
160
|
+
top: {
|
|
161
|
+
add: "ran-dropdown-up-in",
|
|
162
|
+
remove: "ran-dropdown-up-out"
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
const searchThrottle = generateThrottle();
|
|
166
|
+
const animationTime = 300;
|
|
167
|
+
class Select extends HTMLElementSSR() {
|
|
168
|
+
constructor() {
|
|
169
|
+
super();
|
|
170
|
+
__publicField(this, "removeTimeId");
|
|
171
|
+
__publicField(this, "_slot");
|
|
172
|
+
__publicField(this, "_shadowDom");
|
|
173
|
+
__publicField(this, "_select");
|
|
174
|
+
__publicField(this, "_selection");
|
|
175
|
+
__publicField(this, "_search");
|
|
176
|
+
__publicField(this, "_icon");
|
|
177
|
+
__publicField(this, "_selectDropdown");
|
|
178
|
+
__publicField(this, "_selectionDropdown");
|
|
179
|
+
__publicField(this, "_selectDropDownInTimeId");
|
|
180
|
+
__publicField(this, "_selectDropDownOutTimeId");
|
|
181
|
+
__publicField(this, "_optionList");
|
|
182
|
+
__publicField(this, "_optionLabelMapValue");
|
|
183
|
+
__publicField(this, "_optionValueMapLabel");
|
|
184
|
+
__publicField(this, "_activeOption");
|
|
185
|
+
__publicField(this, "_text");
|
|
186
|
+
__publicField(this, "_selector");
|
|
187
|
+
__publicField(this, "onSearch");
|
|
188
|
+
/**
|
|
189
|
+
* @description: 移除 select dropdown
|
|
190
|
+
* @return {*}
|
|
191
|
+
*/
|
|
192
|
+
__publicField(this, "setSelectDropdownDisplayNone", () => {
|
|
193
|
+
if (this._selectDropDownOutTimeId) return;
|
|
194
|
+
if (this._selectionDropdown && this._selectionDropdown.style.display !== "none") {
|
|
195
|
+
this._selectionDropdown.setAttribute("transit", placementDirection[this.placement].remove);
|
|
196
|
+
this._selectDropDownOutTimeId = setTimeout(() => {
|
|
197
|
+
var _a;
|
|
198
|
+
(_a = this._selectionDropdown) == null ? void 0 : _a.style.setProperty("display", "none");
|
|
199
|
+
this._selectionDropdown && this._selectionDropdown.removeAttribute("transit");
|
|
200
|
+
clearTimeout(this._selectDropDownOutTimeId);
|
|
201
|
+
this._selectDropDownOutTimeId = void 0;
|
|
202
|
+
}, animationTime);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
/**
|
|
206
|
+
* @description: 添加 select dropdown
|
|
207
|
+
* @return {*}
|
|
208
|
+
*/
|
|
209
|
+
__publicField(this, "setSelectDropdownDisplayBlock", () => {
|
|
210
|
+
var _a;
|
|
211
|
+
if (this._selectDropDownInTimeId) return;
|
|
212
|
+
if (this._selectionDropdown && this._selectionDropdown.style.display !== "block") {
|
|
213
|
+
this._selectionDropdown.setAttribute("transit", placementDirection[this.placement].add);
|
|
214
|
+
(_a = this._selectionDropdown) == null ? void 0 : _a.style.setProperty("display", "block");
|
|
215
|
+
this._selectDropDownInTimeId = setTimeout(() => {
|
|
216
|
+
this._selectionDropdown && this._selectionDropdown.removeAttribute("transit");
|
|
217
|
+
clearTimeout(this._selectDropDownInTimeId);
|
|
218
|
+
this._selectDropDownInTimeId = void 0;
|
|
219
|
+
}, animationTime);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
__publicField(this, "placementPosition", () => {
|
|
223
|
+
if (!this._selectionDropdown || !this._selectDropdown) return;
|
|
224
|
+
const rect = this.getBoundingClientRect();
|
|
225
|
+
const { top, left, bottom, width } = rect;
|
|
226
|
+
const root = document.getElementById(this.getPopupContainerId);
|
|
227
|
+
this._selectionDropdown.style.setProperty("position", `absolute`);
|
|
228
|
+
this._selectionDropdown.style.setProperty("--ran-x", `${top + window.scrollX}`);
|
|
229
|
+
this._selectionDropdown.style.setProperty("--ran-y", `${left + window.scrollY}`);
|
|
230
|
+
let selectTop = bottom + window.scrollY;
|
|
231
|
+
let selectLeft = left + window.scrollX;
|
|
232
|
+
this._selectionDropdown.style.setProperty("width", `${width}px`);
|
|
233
|
+
if (this.placement === "top") {
|
|
234
|
+
selectTop = top + window.scrollY - this._selectionDropdown.clientHeight;
|
|
235
|
+
}
|
|
236
|
+
if (this.getPopupContainerId && root) {
|
|
237
|
+
const rootRect = root.getBoundingClientRect();
|
|
238
|
+
selectLeft = left - rootRect.left;
|
|
239
|
+
if (this.placement === "top") {
|
|
240
|
+
selectTop = top - root.getBoundingClientRect().top - this._selectionDropdown.clientHeight;
|
|
241
|
+
} else {
|
|
242
|
+
selectTop = root.getBoundingClientRect().height;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
this._selectionDropdown.style.setProperty("inset", `${selectTop}px auto auto ${selectLeft}px`);
|
|
246
|
+
});
|
|
247
|
+
/**
|
|
248
|
+
* @description: 设置下拉框
|
|
249
|
+
* @return {*}
|
|
250
|
+
*/
|
|
251
|
+
__publicField(this, "selectMouseDown", (e) => {
|
|
252
|
+
e.stopPropagation();
|
|
253
|
+
if (isDisabled(this)) return;
|
|
254
|
+
this.removeDropDownTimeId(e);
|
|
255
|
+
this.setSelectDropdownDisplayNone();
|
|
256
|
+
this.setSelectDropdownDisplayBlock();
|
|
257
|
+
this.placementPosition();
|
|
258
|
+
});
|
|
259
|
+
__publicField(this, "removeDropDownTimeId", (e) => {
|
|
260
|
+
e.stopPropagation();
|
|
261
|
+
this._search.setAttribute("value", "");
|
|
262
|
+
if (this.trigger.includes("hover") && !isMobile()) {
|
|
263
|
+
clearTimeout(this.removeTimeId);
|
|
264
|
+
this.removeTimeId = void 0;
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
/**
|
|
268
|
+
* @description: 焦点移除的情况,需要移除 select 下拉框
|
|
269
|
+
* @return {*}
|
|
270
|
+
*/
|
|
271
|
+
__publicField(this, "selectBlur", (e) => {
|
|
272
|
+
e.stopPropagation();
|
|
273
|
+
if (this.removeTimeId) {
|
|
274
|
+
this.removeDropDownTimeId(e);
|
|
275
|
+
}
|
|
276
|
+
this.removeTimeId = setTimeout(() => {
|
|
277
|
+
this.removeDropDownTimeId(e);
|
|
278
|
+
this.setSelectDropdownDisplayNone();
|
|
279
|
+
}, 300);
|
|
280
|
+
});
|
|
281
|
+
/**
|
|
282
|
+
* @description: 选中一个选项的情况
|
|
283
|
+
* @param {MouseEvent} e
|
|
284
|
+
* @return {*}
|
|
285
|
+
*/
|
|
286
|
+
__publicField(this, "clickOption", (e) => {
|
|
287
|
+
e.stopPropagation();
|
|
288
|
+
const element = e.target;
|
|
289
|
+
const label = element.innerHTML;
|
|
290
|
+
const value = this._optionLabelMapValue.get(label);
|
|
291
|
+
if (value) {
|
|
292
|
+
this.setAttribute("value", value);
|
|
293
|
+
this._text.innerHTML = label;
|
|
294
|
+
this._text.setAttribute("title", label);
|
|
295
|
+
this._search.setAttribute("placeholder", label);
|
|
296
|
+
}
|
|
297
|
+
const rect = this.getBoundingClientRect();
|
|
298
|
+
const { height } = rect;
|
|
299
|
+
this._text.style.setProperty("line-height", `${height}px`);
|
|
300
|
+
if (this._activeOption) {
|
|
301
|
+
this._activeOption.removeAttribute("active");
|
|
302
|
+
}
|
|
303
|
+
this._activeOption = element;
|
|
304
|
+
if (this._activeOption) {
|
|
305
|
+
this._activeOption.setAttribute("active", value || "");
|
|
306
|
+
}
|
|
307
|
+
this.setSelectDropdownDisplayNone();
|
|
308
|
+
this.dispatchEvent(new CustomEvent("change", { detail: { value, label } }));
|
|
309
|
+
this.removeDropDownTimeId(e);
|
|
310
|
+
});
|
|
311
|
+
/**
|
|
312
|
+
* @description: 初始化创建选项下拉框
|
|
313
|
+
* @return {*}
|
|
314
|
+
*/
|
|
315
|
+
__publicField(this, "createOption", () => {
|
|
316
|
+
if (!this._selectDropdown) {
|
|
317
|
+
const container = document.getElementById(this.getPopupContainerId) || document.body;
|
|
318
|
+
this._selectDropdown = document.createElement("div");
|
|
319
|
+
this._selectDropdown.style.setProperty("-webkit-tap-highlight-color", "transparent");
|
|
320
|
+
this._selectDropdown.style.setProperty("outline", "0");
|
|
321
|
+
this._selectDropdown.addEventListener("click", this.clickOption);
|
|
322
|
+
this._selectionDropdown = document.createElement("r-dropdown");
|
|
323
|
+
if (this.dropdownclass) {
|
|
324
|
+
this._selectionDropdown.setAttribute("class", this.dropdownclass);
|
|
325
|
+
}
|
|
326
|
+
if (this.trigger.includes("hover") && !isMobile()) {
|
|
327
|
+
this._selectDropdown.addEventListener("mouseleave", this.selectBlur);
|
|
328
|
+
this._selectDropdown.addEventListener("mouseenter", this.removeDropDownTimeId);
|
|
329
|
+
}
|
|
330
|
+
this._selectDropdown.appendChild(this._selectionDropdown);
|
|
331
|
+
this._selectionDropdown.style.setProperty("display", "none");
|
|
332
|
+
container.appendChild(this._selectDropdown);
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
/**
|
|
336
|
+
* @description: 移除选项下拉框
|
|
337
|
+
* @return {*}
|
|
338
|
+
*/
|
|
339
|
+
__publicField(this, "removeSelectDropdown", () => {
|
|
340
|
+
try {
|
|
341
|
+
if (this._selectDropdown) {
|
|
342
|
+
const container = document.getElementById(this.getPopupContainerId) || document.body;
|
|
343
|
+
container.removeChild(this._selectDropdown);
|
|
344
|
+
}
|
|
345
|
+
} catch (error) {
|
|
346
|
+
console.error("removeSelectDropdown error", error);
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
/**
|
|
350
|
+
* @description: 当 select 中有 option 元素的时候,给 dropdown 添加元素
|
|
351
|
+
* @return {*}
|
|
352
|
+
*/
|
|
353
|
+
__publicField(this, "addOptionToSlot", () => {
|
|
354
|
+
const slots = this._slot.assignedElements();
|
|
355
|
+
slots.forEach((item) => {
|
|
356
|
+
var _a;
|
|
357
|
+
if (item.tagName !== "R-OPTION") return;
|
|
358
|
+
const label = item.innerHTML;
|
|
359
|
+
const value = item.getAttribute("value") || "";
|
|
360
|
+
(_a = this._optionList) == null ? void 0 : _a.push({ label, value });
|
|
361
|
+
if (this._optionLabelMapValue.get(label)) {
|
|
362
|
+
console.warn(`${label} is repeat option`);
|
|
363
|
+
}
|
|
364
|
+
if (this._optionValueMapLabel.get(value)) {
|
|
365
|
+
console.warn(`${value} is repeat option`);
|
|
366
|
+
}
|
|
367
|
+
this._optionLabelMapValue.set(label, value);
|
|
368
|
+
this._optionValueMapLabel.set(value, label);
|
|
369
|
+
});
|
|
370
|
+
this.createSelectDropdownContent(this._optionList);
|
|
371
|
+
});
|
|
372
|
+
__publicField(this, "createSelectDropdownContent", (options = []) => {
|
|
373
|
+
var _a, _b;
|
|
374
|
+
if (options.length === 0) {
|
|
375
|
+
(_a = this._selectDropdown) == null ? void 0 : _a.style.setProperty("display", "none");
|
|
376
|
+
} else {
|
|
377
|
+
(_b = this._selectDropdown) == null ? void 0 : _b.style.setProperty("display", "block");
|
|
378
|
+
}
|
|
379
|
+
options.forEach((item) => {
|
|
380
|
+
if (this._selectionDropdown) {
|
|
381
|
+
const { label, value } = item;
|
|
382
|
+
const selectOptionItem = document.createElement("r-dropdown-item");
|
|
383
|
+
const defaultValue = this.getAttribute("defaultValue") || this.getAttribute("value");
|
|
384
|
+
if (defaultValue === value) {
|
|
385
|
+
selectOptionItem.setAttribute("active", value);
|
|
386
|
+
this._activeOption = selectOptionItem;
|
|
387
|
+
} else {
|
|
388
|
+
selectOptionItem.removeAttribute("active");
|
|
389
|
+
}
|
|
390
|
+
selectOptionItem.innerHTML = `${label}`;
|
|
391
|
+
selectOptionItem.setAttribute("value", `${value}`);
|
|
392
|
+
selectOptionItem.setAttribute("title", `${label}`);
|
|
393
|
+
this._selectionDropdown.appendChild(selectOptionItem);
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
this.setDefaultValue();
|
|
397
|
+
});
|
|
398
|
+
__publicField(this, "setDefaultValue", () => {
|
|
399
|
+
const defaultValue = this.getAttribute("defaultValue") || this.getAttribute("value");
|
|
400
|
+
if (!defaultValue) return;
|
|
401
|
+
const label = this._optionValueMapLabel.get(defaultValue);
|
|
402
|
+
if (!label) return;
|
|
403
|
+
this.setAttribute("value", defaultValue);
|
|
404
|
+
const rect = this.getBoundingClientRect();
|
|
405
|
+
const { height } = rect;
|
|
406
|
+
this._text.style.setProperty("line-height", `${height}px`);
|
|
407
|
+
this._text.innerHTML = label;
|
|
408
|
+
this._text.setAttribute("title", label);
|
|
409
|
+
});
|
|
410
|
+
__publicField(this, "changeSearch", (e) => {
|
|
411
|
+
const value = e.detail.value || "";
|
|
412
|
+
this.dispatchEvent(
|
|
413
|
+
new CustomEvent("search", {
|
|
414
|
+
detail: { value }
|
|
415
|
+
})
|
|
416
|
+
);
|
|
417
|
+
if (this._selectionDropdown) {
|
|
418
|
+
this._selectionDropdown.innerHTML = "";
|
|
419
|
+
}
|
|
420
|
+
if (value.length > 0) {
|
|
421
|
+
const options = this._optionList.map((item) => {
|
|
422
|
+
const { label } = item;
|
|
423
|
+
if (`${label}`.toLowerCase().includes(value)) {
|
|
424
|
+
return { label, value: item.value };
|
|
425
|
+
}
|
|
426
|
+
return void 0;
|
|
427
|
+
}).filter((item) => item);
|
|
428
|
+
this.createSelectDropdownContent(options);
|
|
429
|
+
} else {
|
|
430
|
+
this.createSelectDropdownContent(this._optionList);
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
__publicField(this, "setShowSearch", () => {
|
|
434
|
+
this.onSearch = searchThrottle(this.changeSearch);
|
|
435
|
+
this.onSearch && this._search.addEventListener("change", this.onSearch);
|
|
436
|
+
this.onSearch && this._search.addEventListener("click", this.onSearch);
|
|
437
|
+
});
|
|
438
|
+
__publicField(this, "removeShowSearch", () => {
|
|
439
|
+
this.onSearch && this._search.removeEventListener("change", this.onSearch);
|
|
440
|
+
this.onSearch && this._search.removeEventListener("click", this.onSearch);
|
|
441
|
+
});
|
|
442
|
+
__publicField(this, "listenSlotChange", () => {
|
|
443
|
+
this._slot.addEventListener("slotchange", this.addOptionToSlot);
|
|
444
|
+
});
|
|
445
|
+
__publicField(this, "removeListenSlotChange", () => {
|
|
446
|
+
this._slot.removeEventListener("slotchange", this.addOptionToSlot);
|
|
447
|
+
});
|
|
448
|
+
__publicField(this, "listenActionEvent", () => {
|
|
449
|
+
this.removeEventListener("mouseenter", this.selectMouseDown);
|
|
450
|
+
this.removeEventListener("mouseleave", this.selectBlur);
|
|
451
|
+
this.removeEventListener("click", this.selectMouseDown);
|
|
452
|
+
this.removeEventListener("blur", this.selectBlur);
|
|
453
|
+
if (this.trigger.includes("hover") && !isMobile()) {
|
|
454
|
+
this.addEventListener("mouseenter", this.selectMouseDown);
|
|
455
|
+
this.addEventListener("mouseleave", this.selectBlur);
|
|
456
|
+
}
|
|
457
|
+
if (this.trigger.includes("click")) {
|
|
458
|
+
this.addEventListener("click", this.selectMouseDown);
|
|
459
|
+
this.addEventListener("blur", this.selectBlur);
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
__publicField(this, "clickRemoveSelect", (e) => {
|
|
463
|
+
e.stopPropagation();
|
|
464
|
+
this.setSelectDropdownDisplayNone();
|
|
465
|
+
});
|
|
466
|
+
this._slot = document.createElement("slot");
|
|
467
|
+
this._select = document.createElement("div");
|
|
468
|
+
this._select.setAttribute("class", "ran-select");
|
|
469
|
+
this._select.setAttribute("part", "select");
|
|
470
|
+
this._selection = document.createElement("div");
|
|
471
|
+
this._selection.setAttribute("class", "selection");
|
|
472
|
+
this._selection.setAttribute("part", "selection");
|
|
473
|
+
this._selector = document.createElement("div");
|
|
474
|
+
this._search = document.createElement("r-input");
|
|
475
|
+
this._search.setAttribute("class", "selection-search");
|
|
476
|
+
this._search.setAttribute("part", "search");
|
|
477
|
+
this._search.setAttribute("type", "search");
|
|
478
|
+
this._search.setAttribute("autocomplete", "off");
|
|
479
|
+
this._text = document.createElement("span");
|
|
480
|
+
this._text.setAttribute("class", "selection-item");
|
|
481
|
+
this._text.setAttribute("part", "selection-item");
|
|
482
|
+
this._icon = document.createElement("r-icon");
|
|
483
|
+
this._icon.setAttribute("class", "icon");
|
|
484
|
+
this._icon.setAttribute("part", "icon");
|
|
485
|
+
this._icon.setAttribute("name", "arrow-down");
|
|
486
|
+
this._icon.setAttribute("color", "#d9d9d9");
|
|
487
|
+
this._icon.setAttribute("size", "16");
|
|
488
|
+
this._selector.appendChild(this._text);
|
|
489
|
+
this._selector.appendChild(this._search);
|
|
490
|
+
this._selection.appendChild(this._icon);
|
|
491
|
+
this._selection.appendChild(this._selector);
|
|
492
|
+
this._slot.setAttribute("class", "slot");
|
|
493
|
+
this._select.appendChild(this._selection);
|
|
494
|
+
this._select.appendChild(this._slot);
|
|
495
|
+
this._optionList = [];
|
|
496
|
+
this._optionLabelMapValue = /* @__PURE__ */ new Map();
|
|
497
|
+
this._optionValueMapLabel = /* @__PURE__ */ new Map();
|
|
498
|
+
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
499
|
+
const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
|
|
500
|
+
F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
|
|
501
|
+
shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
|
|
502
|
+
this._shadowDom = shadowRoot;
|
|
503
|
+
this._shadowDom.appendChild(this._select);
|
|
504
|
+
}
|
|
505
|
+
static get observedAttributes() {
|
|
506
|
+
return [
|
|
507
|
+
"disabled",
|
|
508
|
+
"sheet",
|
|
509
|
+
"clear",
|
|
510
|
+
"type",
|
|
511
|
+
"defaultValue",
|
|
512
|
+
"showSearch",
|
|
513
|
+
"placement",
|
|
514
|
+
// 弹窗的方向
|
|
515
|
+
"getPopupContainerId",
|
|
516
|
+
// 挂载的节点
|
|
517
|
+
"dropdownclass",
|
|
518
|
+
// 弹窗的类名
|
|
519
|
+
"trigger"
|
|
520
|
+
// 触发下拉框的行为,click 还是 hover,hover 在 isMobile 移动端无效
|
|
521
|
+
];
|
|
522
|
+
}
|
|
523
|
+
get value() {
|
|
524
|
+
return this.getAttribute("value") || "";
|
|
525
|
+
}
|
|
526
|
+
set value(value) {
|
|
527
|
+
if (!isDisabled(this) && value) {
|
|
528
|
+
this.setAttribute("value", value);
|
|
529
|
+
} else {
|
|
530
|
+
this.removeAttribute("value");
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
get defaultValue() {
|
|
534
|
+
return this.getAttribute("defaultValue") || "";
|
|
535
|
+
}
|
|
536
|
+
set defaultValue(value) {
|
|
537
|
+
this.setAttribute("defaultValue", value || "");
|
|
538
|
+
}
|
|
539
|
+
get showSearch() {
|
|
540
|
+
return this.getAttribute("showSearch") || "";
|
|
541
|
+
}
|
|
542
|
+
set showSearch(value) {
|
|
543
|
+
this.setAttribute("showSearch", value || "");
|
|
544
|
+
}
|
|
545
|
+
get type() {
|
|
546
|
+
return this.getAttribute("type") || "";
|
|
547
|
+
}
|
|
548
|
+
set type(value) {
|
|
549
|
+
this.setAttribute("type", value || "");
|
|
550
|
+
}
|
|
551
|
+
get placement() {
|
|
552
|
+
return this.getAttribute("placement") || "bottom";
|
|
553
|
+
}
|
|
554
|
+
set placement(value) {
|
|
555
|
+
this.setAttribute("placement", value || "");
|
|
556
|
+
}
|
|
557
|
+
get sheet() {
|
|
558
|
+
return this.getAttribute("sheet") || "";
|
|
559
|
+
}
|
|
560
|
+
set sheet(value) {
|
|
561
|
+
this.setAttribute("sheet", value || "");
|
|
562
|
+
}
|
|
563
|
+
get getPopupContainerId() {
|
|
564
|
+
return this.getAttribute("getPopupContainerId") || "";
|
|
565
|
+
}
|
|
566
|
+
set getPopupContainerId(value) {
|
|
567
|
+
this.setAttribute("getPopupContainerId", value || "");
|
|
568
|
+
}
|
|
569
|
+
get dropdownclass() {
|
|
570
|
+
return this.getAttribute("dropdownclass") || "";
|
|
571
|
+
}
|
|
572
|
+
set dropdownclass(value) {
|
|
573
|
+
this.setAttribute("dropdownclass", value || "");
|
|
574
|
+
}
|
|
575
|
+
get trigger() {
|
|
576
|
+
return this.getAttribute("trigger") || "click";
|
|
577
|
+
}
|
|
578
|
+
set trigger(value) {
|
|
579
|
+
this.setAttribute("trigger", value || "");
|
|
580
|
+
}
|
|
581
|
+
get disabled() {
|
|
582
|
+
return isDisabled(this);
|
|
583
|
+
}
|
|
584
|
+
set disabled(value) {
|
|
585
|
+
if (!value || value === "false") {
|
|
586
|
+
this.removeAttribute("disabled");
|
|
587
|
+
this._selection.removeAttribute("disabled");
|
|
588
|
+
} else {
|
|
589
|
+
this.setAttribute("disabled", "");
|
|
590
|
+
this._selection.setAttribute("disabled", "");
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
handlerExternalCss() {
|
|
594
|
+
if (this.sheet) {
|
|
595
|
+
try {
|
|
596
|
+
const sheet = new CSSStyleSheet();
|
|
597
|
+
sheet.insertRule(this.sheet);
|
|
598
|
+
this._shadowDom.adoptedStyleSheets = [sheet];
|
|
599
|
+
} catch (error) {
|
|
600
|
+
console.error(`Failed to parse the rule in CSSStyleSheet: ${this.sheet}, error: ${error}`);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
connectedCallback() {
|
|
605
|
+
this.handlerExternalCss();
|
|
606
|
+
this.createOption();
|
|
607
|
+
this.listenActionEvent();
|
|
608
|
+
this.listenSlotChange();
|
|
609
|
+
this.setShowSearch();
|
|
610
|
+
document.addEventListener("click", this.clickRemoveSelect);
|
|
611
|
+
}
|
|
612
|
+
disconnectCallback() {
|
|
613
|
+
var _a;
|
|
614
|
+
this.removeEventListener("mouseenter", this.selectMouseDown);
|
|
615
|
+
this.removeEventListener("mouseleave", this.selectBlur);
|
|
616
|
+
this.removeEventListener("click", this.selectMouseDown);
|
|
617
|
+
this.removeEventListener("blur", this.selectBlur);
|
|
618
|
+
this.removeSelectDropdown();
|
|
619
|
+
(_a = this._selectDropdown) == null ? void 0 : _a.removeEventListener("click", this.clickOption);
|
|
620
|
+
this.removeListenSlotChange();
|
|
621
|
+
document.removeEventListener("click", this.clickRemoveSelect);
|
|
622
|
+
}
|
|
623
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
624
|
+
if (name === "disabled" && this._select) {
|
|
625
|
+
if (!newValue || newValue === "false") {
|
|
626
|
+
this._select.setAttribute("disabled", "");
|
|
627
|
+
this._selection.setAttribute("disabled", "");
|
|
628
|
+
} else {
|
|
629
|
+
this._select.removeAttribute("disabled");
|
|
630
|
+
this._selection.removeAttribute("disabled");
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
if (name === "sheet" && this._shadowDom && oldValue !== newValue) {
|
|
634
|
+
this.handlerExternalCss();
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
function Custom() {
|
|
639
|
+
if (typeof document !== "undefined" && !customElements.get("r-select")) {
|
|
640
|
+
customElements.define("r-select", Select);
|
|
641
|
+
return Select;
|
|
642
|
+
} else {
|
|
643
|
+
return createCustomError("document is undefined or r-select is exist");
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
const index = Custom();
|
|
647
|
+
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
648
|
+
__proto__: null,
|
|
649
|
+
Select,
|
|
650
|
+
default: index
|
|
651
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
652
|
+
export {
|
|
653
|
+
Select as S,
|
|
654
|
+
index as a,
|
|
655
|
+
index$1 as i
|
|
656
|
+
};
|