ranui 0.1.10-alpha.9 → 0.2.0-alpha.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 +397 -0
- package/README.zh-CN.md +216 -37
- package/dist/assets/image/failImage.d.ts +2 -0
- package/dist/bin/generate-component-api.d.ts +1 -0
- package/dist/bin/generate-style-docs.d.ts +1 -0
- package/dist/build/config.bundle.d.ts +2 -0
- package/dist/build/config.d.ts +3 -0
- package/dist/build/config.es.d.ts +2 -0
- package/dist/build/config.umd.d.ts +1 -0
- package/dist/builder.d.ts +11 -0
- package/dist/builder.js +39 -0
- package/dist/button-DukaD6uL.js +117 -0
- package/dist/button.js +3 -5
- package/dist/card-DQUJoDUQ.js +60 -0
- package/dist/card.js +5 -0
- package/dist/checkbox-iHZQb-yQ.js +94 -0
- package/dist/checkbox.js +3 -5
- package/dist/colorpicker-Ch67dWa_.js +302 -0
- package/dist/colorpicker.js +3 -9
- package/dist/components/button/index.d.ts +44 -0
- package/dist/components/card/index.d.ts +21 -0
- package/dist/components/checkbox/index.d.ts +35 -0
- package/dist/components/colorpicker/index.d.ts +88 -0
- package/dist/components/dropdown/index.d.ts +32 -0
- package/dist/components/form/index.d.ts +15 -0
- package/dist/components/icon/index.d.ts +58 -0
- package/dist/components/image/index.d.ts +25 -0
- package/dist/components/input/index.d.ts +229 -0
- package/dist/components/link/index.d.ts +21 -0
- package/dist/components/loading/index.d.ts +76 -0
- package/dist/components/math/index.d.ts +16 -0
- package/dist/components/message/container.d.ts +8 -0
- package/dist/components/message/index.d.ts +32 -0
- package/dist/components/modal/index.d.ts +100 -0
- package/dist/components/player/core/constants.d.ts +5 -0
- package/dist/components/player/core/controller.d.ts +33 -0
- package/dist/components/player/core/events.d.ts +10 -0
- package/dist/components/player/core/fullscreen.d.ts +5 -0
- package/dist/components/player/core/levels.d.ts +20 -0
- package/dist/components/player/core/media.d.ts +50 -0
- package/dist/components/player/core/playback.d.ts +14 -0
- package/dist/components/player/core/progress.d.ts +2 -0
- package/dist/components/player/core/state.d.ts +27 -0
- package/dist/components/player/core/view.d.ts +39 -0
- package/dist/components/player/index.d.ts +277 -0
- package/dist/components/popover/content/index.d.ts +12 -0
- package/dist/components/popover/index.d.ts +95 -0
- package/dist/components/progress/index.d.ts +40 -0
- package/dist/components/radar/index.d.ts +52 -0
- package/dist/components/route/index.d.ts +26 -0
- package/dist/components/router/index.d.ts +24 -0
- package/dist/components/scratch/index.d.ts +19 -0
- package/dist/components/section/index.d.ts +23 -0
- package/dist/components/select/dropdown-item/index.d.ts +21 -0
- package/dist/components/select/index.d.ts +135 -0
- package/dist/components/select/option/index.d.ts +19 -0
- package/dist/components/skeleton/index.d.ts +13 -0
- package/dist/components/tab/index.d.ts +58 -0
- package/dist/components/tabpane/index.d.ts +33 -0
- package/dist/demo/i18n.d.ts +4 -0
- package/dist/demo/index.d.ts +3 -0
- package/dist/demo/register-icons.d.ts +1 -0
- package/dist/dropdown-C5362qTy.js +82 -0
- package/dist/dropdown.js +6 -0
- package/dist/events-C59wGdni.js +30 -0
- package/dist/factory-BdsO0dEW.js +165 -0
- package/dist/form-05Lxxl3D.js +44 -0
- package/dist/form.js +5 -0
- package/dist/icon-DmoEnao5.js +165 -0
- package/dist/icon.js +4 -4
- package/dist/{index-KS2nvVcO.js → image-6GayFDqX.js} +58 -71
- package/dist/image.js +3 -2
- package/dist/index.cjs +35 -0
- package/dist/index.d.ts +277 -114
- package/dist/index.iife.js +306 -0
- package/dist/index.js +78 -38
- package/dist/input-DoraIb3x.js +198 -0
- package/dist/input.js +2 -3
- package/dist/katex-es-Bpesphgp.js +23682 -0
- package/dist/katex-es-Cnq5Pk8K.cjs +261 -0
- package/dist/link-BW-gvrpN.js +77 -0
- package/dist/link.js +6 -0
- package/dist/loading-Mko22ncl.js +206 -0
- package/dist/loading.js +4 -6
- package/dist/math-B5PpSnFR.js +52 -0
- package/dist/math.js +2 -4
- package/dist/message-CQENvkoi.js +137 -0
- package/dist/message.js +3 -4
- package/dist/mocks-CMGoftIc.js +179 -0
- package/dist/modal-DruDj3AB.js +350 -0
- package/dist/modal.js +3 -2
- package/dist/player-CvfmwWUa.js +13536 -0
- package/dist/player.js +3 -6
- package/dist/playwright.config.d.ts +2 -0
- package/dist/plugins/load-svg.d.ts +9 -0
- package/dist/popover-BCvHwLZb.js +213 -0
- package/dist/popover.js +3 -5
- package/dist/progress-BWkNf2J5.js +123 -0
- package/dist/progress.js +3 -5
- package/dist/radar-CWsawt2g.js +181 -0
- package/dist/radar.js +3 -4
- package/dist/ranui.css +1 -0
- package/dist/route-BY_E6-2C.js +88 -0
- package/dist/route.js +6 -0
- package/dist/router-BDcv4F-2.js +79 -0
- package/dist/router.js +6 -0
- package/dist/scratch-Dbd9G6Q6.js +60 -0
- package/dist/scratch.js +4 -0
- package/dist/section-CNTvgdQ-.js +63 -0
- package/dist/section.js +5 -0
- package/dist/select-BmhCUTLb.js +433 -0
- package/dist/select.js +3 -8
- package/dist/signal-XHfNsQNW.js +57 -0
- package/dist/skeleton-DPv9nFhL.js +32 -0
- package/dist/skeleton.js +3 -2
- package/dist/ssg.js +21 -0
- package/dist/ssr-DSGwPtEd.js +34 -0
- package/dist/ssr-stream.d.ts +1 -0
- package/dist/ssr-stream.js +87 -0
- package/dist/ssr.d.ts +1 -0
- package/dist/ssr.js +7 -0
- package/dist/style.d.ts +1 -0
- package/dist/style.js +0 -0
- package/dist/tab-C9swK-hm.js +185 -0
- package/dist/tab.js +3 -4
- package/dist/tabpane-B_M-Jokw.js +87 -0
- package/dist/tabpane.js +3 -2
- package/dist/test/e2e/button.spec.d.ts +1 -0
- package/dist/test/e2e/checkbox.spec.d.ts +1 -0
- package/dist/test/e2e/helpers.d.ts +13 -0
- package/dist/test/e2e/icon.spec.d.ts +1 -0
- package/dist/test/e2e/image.spec.d.ts +1 -0
- package/dist/test/e2e/input.spec.d.ts +1 -0
- package/dist/test/e2e/loading.spec.d.ts +1 -0
- package/dist/test/e2e/message.spec.d.ts +1 -0
- package/dist/test/e2e/modal.spec.d.ts +1 -0
- package/dist/test/e2e/popover.spec.d.ts +1 -0
- package/dist/test/e2e/progress.spec.d.ts +1 -0
- package/dist/test/e2e/radar.spec.d.ts +1 -0
- package/dist/test/e2e/select.spec.d.ts +1 -0
- package/dist/test/e2e/skeleton.spec.d.ts +1 -0
- package/dist/test/e2e/tab.spec.d.ts +1 -0
- package/dist/test/e2e/visual/colorpicker.spec.d.ts +1 -0
- package/dist/test/e2e/visual/components.spec.d.ts +1 -0
- package/dist/test/e2e/visual/player.spec.d.ts +1 -0
- package/dist/test/integration/composition.test.d.ts +23 -0
- package/dist/test/setup.d.ts +0 -0
- package/dist/test/ssr/builder.core.ssr.test.d.ts +1 -0
- package/dist/test/ssr/builder.factory.ssr.test.d.ts +1 -0
- package/dist/test/ssr/builder.mocks.test.d.ts +1 -0
- package/dist/test/ssr/components/button.test.d.ts +1 -0
- package/dist/test/ssr/css-vars.test.d.ts +1 -0
- package/dist/test/ssr/registry.test.d.ts +1 -0
- package/dist/test/ssr/router.ssg.test.d.ts +2 -0
- package/dist/test/ssr/snapshots/button.test.d.ts +1 -0
- package/dist/test/ssr/stream.test.d.ts +2 -0
- package/dist/test/ssr/theme.tokens.ssr.test.d.ts +1 -0
- package/dist/test/unit/builder.core.browser.test.d.ts +1 -0
- package/dist/test/unit/builder.escape.test.d.ts +1 -0
- package/dist/test/unit/builder.selectors.test.d.ts +1 -0
- package/dist/test/unit/button.contract.test.d.ts +1 -0
- package/dist/test/unit/card.contract.test.d.ts +1 -0
- package/dist/test/unit/checkbox.contract.test.d.ts +1 -0
- package/dist/test/unit/colorpicker.color.utils.test.d.ts +1 -0
- package/dist/test/unit/colorpicker.contract.test.d.ts +1 -0
- package/dist/test/unit/colorpicker.methods.test.d.ts +1 -0
- package/dist/test/unit/component.helpers.test.d.ts +1 -0
- package/dist/test/unit/dropdown-item.contract.test.d.ts +1 -0
- package/dist/test/unit/dropdown.contract.test.d.ts +1 -0
- package/dist/test/unit/form.contract.test.d.ts +1 -0
- package/dist/test/unit/helpers/component.d.ts +3 -0
- package/dist/test/unit/helpers/dom.d.ts +2 -0
- package/dist/test/unit/icon.contract.test.d.ts +1 -0
- package/dist/test/unit/image.contract.test.d.ts +1 -0
- package/dist/test/unit/input.contract.test.d.ts +1 -0
- package/dist/test/unit/link.contract.test.d.ts +1 -0
- package/dist/test/unit/loading.contract.test.d.ts +1 -0
- package/dist/test/unit/math.contract.test.d.ts +1 -0
- package/dist/test/unit/message.component.test.d.ts +1 -0
- package/dist/test/unit/message.container.test.d.ts +1 -0
- package/dist/test/unit/modal.contract.test.d.ts +1 -0
- package/dist/test/unit/option.contract.test.d.ts +1 -0
- package/dist/test/unit/package-exports.source.test.d.ts +1 -0
- package/dist/test/unit/player-controls.test.d.ts +1 -0
- package/dist/test/unit/player-core.test.d.ts +1 -0
- package/dist/test/unit/player-event-handlers.test.d.ts +1 -0
- package/dist/test/unit/player-events.test.d.ts +1 -0
- package/dist/test/unit/player-fullscreen.test.d.ts +1 -0
- package/dist/test/unit/player-interactions.test.d.ts +1 -0
- package/dist/test/unit/player-levels.test.d.ts +1 -0
- package/dist/test/unit/player-media.test.d.ts +1 -0
- package/dist/test/unit/player-playback.test.d.ts +1 -0
- package/dist/test/unit/player.contract.test.d.ts +1 -0
- package/dist/test/unit/popover-accessibility.test.d.ts +1 -0
- package/dist/test/unit/popover.contract.test.d.ts +2 -0
- package/dist/test/unit/progress.contract.test.d.ts +1 -0
- package/dist/test/unit/radar.contract.test.d.ts +1 -0
- package/dist/test/unit/route.contract.test.d.ts +1 -0
- package/dist/test/unit/router.contract.test.d.ts +2 -0
- package/dist/test/unit/scratch.contract.test.d.ts +1 -0
- package/dist/test/unit/select-accessibility.test.d.ts +1 -0
- package/dist/test/unit/select-option.contract.test.d.ts +1 -0
- package/dist/test/unit/select.contract.test.d.ts +1 -0
- package/dist/test/unit/skeleton.contract.test.d.ts +1 -0
- package/dist/test/unit/ssr.test.d.ts +1 -0
- package/dist/test/unit/tab.contract.test.d.ts +2 -0
- package/dist/test/unit/theme.semantic-tokens.test.d.ts +1 -0
- package/dist/test/unit/theme.skin-tokens.test.d.ts +1 -0
- package/dist/test/unit/utils.dom.test.d.ts +1 -0
- package/dist/test/unit/utils.error.test.d.ts +1 -0
- package/dist/test/unit/utils.i18n.test.d.ts +1 -0
- package/dist/test/unit/utils.image.test.d.ts +1 -0
- package/dist/test/unit/utils.math.test.d.ts +1 -0
- package/dist/test/unit/utils.router.test.d.ts +1 -0
- package/dist/test/unit/utils.signal.test.d.ts +1 -0
- package/dist/test/unit/utils.ssr-stream.test.d.ts +1 -0
- package/dist/test/unit/utils.style.test.d.ts +1 -0
- package/dist/test/unit/utils.theme.test.d.ts +1 -0
- package/dist/test/unit/utils.tween.test.d.ts +1 -0
- package/dist/tsconfig.json +8 -8
- package/dist/typings.d.ts +163 -114
- package/dist/utils/builder/core.d.ts +70 -0
- package/dist/utils/builder/env.d.ts +1 -0
- package/dist/utils/builder/escape.d.ts +2 -0
- package/dist/utils/builder/events.d.ts +55 -0
- package/dist/utils/builder/factory.d.ts +18 -0
- package/dist/utils/builder/index.d.ts +9 -0
- package/dist/utils/builder/mocks.d.ts +62 -0
- package/dist/utils/builder/selectors.d.ts +4 -0
- package/dist/utils/builder/signal.d.ts +87 -0
- package/dist/utils/color.d.ts +52 -0
- package/dist/utils/component.d.ts +16 -0
- package/dist/utils/dom.d.ts +39 -0
- package/dist/utils/error.d.ts +6 -0
- package/dist/utils/i18n/index.d.ts +53 -0
- package/dist/utils/i18n.js +88 -0
- package/dist/utils/image.d.ts +39 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/math.d.ts +26 -0
- package/dist/utils/router/index.d.ts +128 -0
- package/dist/utils/router.js +197 -0
- package/dist/utils/ssg.d.ts +49 -0
- package/dist/utils/ssr-registry.d.ts +8 -0
- package/dist/utils/ssr-stream.d.ts +23 -0
- package/dist/utils/ssr.d.ts +17 -0
- package/dist/utils/style.d.ts +12 -0
- package/dist/utils/theme.d.ts +9 -0
- package/dist/utils/tween.d.ts +21 -0
- package/dist/utils/video.d.ts +40 -0
- package/dist/utils-D4pPF77E.js +689 -0
- package/dist/vite.config.d.ts +6 -0
- package/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.ssr.d.ts +2 -0
- package/docs/COMPONENTS.md +326 -0
- package/docs/DESIGN.md +182 -0
- package/docs/style-tokens-public.md +880 -0
- package/package.json +136 -77
- package/typings.d.ts +163 -114
- package/dist/_commonjs-dynamic-modules-DLbDWi6a.js +0 -12
- package/dist/add-user-BN1JlY7e.js +0 -4
- package/dist/arrow-down-B_hCY3Wt.js +0 -662
- package/dist/book-nTEFXU2x.js +0 -4
- package/dist/check-circle-fill-B_pd8ZSs.js +0 -4
- package/dist/check-circle-szyAJiap.js +0 -4
- package/dist/close-CFnkhudp.js +0 -4
- package/dist/close-circle-CwmuN2C6.js +0 -4
- package/dist/close-circle-fill-jSqPPw9i.js +0 -4
- package/dist/colz-DJZvo_8B.js +0 -232
- package/dist/docx-CHkPTdGU.js +0 -3665
- package/dist/drop-4j4abxje.js +0 -36
- package/dist/eye-D_mEt17f.js +0 -4
- package/dist/eye-close-BVr3NJtg.js +0 -4
- package/dist/home-BUQ4USMk.js +0 -4
- package/dist/iconShadowless.js +0 -6
- package/dist/index-15M0olqa.js +0 -204
- package/dist/index-1v568_nq.js +0 -140
- package/dist/index-B897keW5.js +0 -279
- package/dist/index-BZR0HaP2.js +0 -40
- package/dist/index-B_GuEcTd.js +0 -9575
- package/dist/index-Bc2Bcl8D.js +0 -63701
- package/dist/index-C4Sv0T51.js +0 -495
- package/dist/index-C6RcMHoH.js +0 -187
- package/dist/index-C9z10IgG.js +0 -103
- package/dist/index-CFjEuvBW.js +0 -308
- package/dist/index-CGEx9VOA.js +0 -17106
- package/dist/index-CGYfjKUV.js +0 -72
- package/dist/index-CQTJoWhb.js +0 -19
- package/dist/index-CiWwvEMM.js +0 -511
- package/dist/index-CkM9ENTf.js +0 -496
- package/dist/index-CtVOgBDk.js +0 -659
- package/dist/index-D4qUro5V.js +0 -279
- package/dist/index-D4y9c1Dj.js +0 -310
- package/dist/index-DAxs7Dd2.js +0 -119
- package/dist/index-DC5EA657.js +0 -91
- package/dist/index-DJZmDHz-.js +0 -146
- package/dist/index-D_CA5VDZ.js +0 -158
- package/dist/index-WfFw4LJT.js +0 -490
- package/dist/index-mhFL9MJp.js +0 -320
- package/dist/info-circle-COnL5bTJ.js +0 -4
- package/dist/info-circle-fill-CFeVMdci.js +0 -4
- package/dist/inputShadowless.js +0 -6
- package/dist/jszip.min-Dhs3nUkD.js +0 -2346
- package/dist/katex-es-B5r5vt3m.js +0 -14628
- package/dist/loading-Dcc5RApI.js +0 -4
- package/dist/loading-scene-BMc2wqKm.js +0 -4
- package/dist/lock-Cr7BnmWN.js +0 -4
- package/dist/message-D36_Zo2l.js +0 -4
- package/dist/pdf-Cx0VWKFo.js +0 -118
- package/dist/power-off-lQRbiBak.js +0 -4
- package/dist/preview-CJbz9GjO.js +0 -4
- package/dist/preview.js +0 -7
- package/dist/selectShadowless.js +0 -564
- package/dist/setting-DemlgzVC.js +0 -4
- package/dist/shadowless.js +0 -8
- package/dist/sprite-CH2zLtZy.js +0 -141
- package/dist/style.css +0 -1
- package/dist/team-tl4NJXPC.js +0 -4
- package/dist/umd/index.umd.cjs +0 -60
- package/dist/umd/shadowless/shadowless.umd.cjs +0 -1
- package/dist/umd/shadowless/style.css +0 -1
- package/dist/umd/style.css +0 -1
- package/dist/unlock-CeU74z9n.js +0 -4
- package/dist/user-B-eVXwuk.js +0 -4
- package/dist/warning-circle-DDUgEDIv.js +0 -4
- package/dist/warning-circle-fill-lODUKz0i.js +0 -4
- package/readme.md +0 -195
package/dist/index-C4Sv0T51.js
DELETED
|
@@ -1,495 +0,0 @@
|
|
|
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 { H as HTMLElementSSR, i as isDisabled, f as falseList, c as createCustomError } from "./index-DC5EA657.js";
|
|
5
|
-
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}.ran-input{position:var(--ran-input-position, relative);display:var(--ran-input-display, flex);width:var(--ran-input-width, calc(100% - 16px) );height:var(--ran-input-height, calc(100% - 4px) );min-width:0;padding:var(--ran-input-padding, 2px 8px);color:#000000d9;font-size:var(--ran-input-font-size, 12px);line-height:var(--ran-input-line-height, 1.5715);background-color:var(--ran-input-background-color, #fff);background-image:var(--ran-input-background-image, none);border:var(--ran-input-border, 1px solid #d9d9d9);border-radius:var(--ran-input-border-radius, 2px);transition:var(--ran-input-transition, all .3s)}.ran-input .ran-icon{display:var(--ran-input-icon-display, flex);align-items:var(--ran-input-icon-align-items, center);justify-content:var(--ran-input-icon-justify-content, center)}.ran-input:active{border-color:var(--ran-input-active-border-color, #40a9ff);box-shadow:var(--ran-input-active-box-shadow, 0 0 0 2px rgba(24, 144, 255, .2));border-right-width:var(--ran-input-active-border-right-width, 1px);outline:var(--ran-input-active-outline, 0)}.ran-input:hover{border-color:var(--ran-input-hover-border-color, #40a9ff);border-right-width:var(--ran-input-hover-border-right-width, 1px)}.ran-input>.ran-input-content:hover~.ran-input-label{color:var(--ran-input-label-hover-color, #40a9ff)}.ran-input[value]>.ran-input-label{transform:var(--ran-input-label-value-transform, translateY( calc(-50% - .43em) ) scale(.8));color:var(--ran-input-label-value-color, #00000040)}.ran-input[status=error]{border-color:var(--ran-input-status-error-border-color, #ff4d4f)}.ran-input[status=error]>.ran-input-content~.ran-input-label{color:var(--ran-input-label-status-error-color, #ff4d4f)}.ran-input[status=warning]{border-color:var(--ran-input-status-warning-border-color, #ff7875)}.ran-input[status=warning]>.ran-input-content~.ran-input-label{color:var(--ran-input-label-status-warning-color, #ff7875)}.ran-input[disabled]{color:var(--ran-input-disabled-color, #00000040);background-color:var(--ran-input-disabled-background-color, #f5f5f5);border-color:var(--ran-input-disabled-border-color, #d9d9d9);box-shadow:var(--ran-input-disabled-box-shadow, none);cursor:var(--ran-input-disabled-cursor, not-allowed);opacity:var(--ran-input-disabled-opacity, 1)}.ran-input[disabled]>.ran-input-content{color:var(--ran-input-content-disabled-color, #00000040);background-color:var(--ran-input-content-disabled-background-color, #f5f5f5);border-color:var(--ran-input-content-disabled-border-color, #d9d9d9);box-shadow:var(--ran-input-content-disabled-box-shadow, none);cursor:var(--ran-input-content-disabled-cursor, not-allowed);opacity:var(--ran-input-content-disabled-opacity, 1)}.ran-input[disabled]>.ran-input-content~.ran-input-label{color:var(--ran-input-label-disabled-color, #00000040);background-color:var(--ran-input-label-disabled-background-color, #f5f5f5)}.ran-input[disabled]>.ran-input-label{color:#999;border-color:var(--ran-input-label-disabled-border-color, #d9d9d9);box-shadow:var(--ran-input-label-disabled-box-shadow, none);cursor:var(--ran-input-label-disabled-cursor, not-allowed)}.ran-input-content{writing-mode:var(--ran-input-content-writing-mode, horizontal-tb);text-rendering:var(--ran-input-content-text-rendering, auto);letter-spacing:var(--ran-input-content-letter-spacing, normal);word-spacing:var(--ran-input-content-word-spacing, normal);text-transform:var(--ran-input-content-text-transform, none);text-indent:var(--ran-input-content-text-indent, 0px);text-shadow:var(--ran-input-content-text-shadow, none);text-align:var(--ran-input-content-text-align, start);cursor:var(--ran-input-content-cursor, text);touch-action:var(--ran-input-content-touch-action, manipulation);-webkit-appearance:var(--ran-input-content--webkit-appearance, none);text-overflow:var(--ran-input-content-text-overflow, ellipsis);box-sizing:var(--ran-input-content-box-sizing, border-box);margin:var(--ran-input-content-margin, 0);font-variant:var(--ran-input-content-font-variant, tabular-nums);list-style:var(--ran-input-content-list-style, none);font-feature-settings:var(--ran-input-content-font-feature-settings, "tnum");position:var(--ran-input-content-position, relative);border:var(--ran-input-content-border, none);width:var(--ran-input-content-width, 100%);min-width:var(--ran-input-content-min-width, 0);color:var(--ran-input-content-color, #000000d9);font-size:var(--ran-input-content-font-size, 14px);line-height:var(--ran-input-content-line-height, 1.48);background-color:var(--ran-input-content-background-color, #fff);background-image:var(--ran-input-content-background-image, none);transition:var(--ran-input-content-transition, all .3s);outline:var(--ran-input-content-outline, none)}.ran-input-content:focus,.ran-input-content:hover{border:var(--ran-input-content-hover-border, none);outline:var(--ran-input-content-hover-outline, 0)}.ran-input-content::placeholder{color:var(--ran-input-content-placeholder-color, #999)}.ran-input-content:placeholder-shown~.ran-input-label{transform:var(--ran-input-content-placeholder-label-transform, translateY( calc(-50% - .43em) ) scale(.8))}.ran-input-content:focus~.ran-input-label{transform:var(--ran-input-content-focus-label-transform, translateY( calc(-50% - .43em) ) scale(.8))}.ran-input-content::-webkit-search-cancel-button{display:none;-webkit-appearance:none}.ran-input-label{pointer-events:var(--ran-input-label-pointer-events, none);position:var(--ran-input-label-position, absolute);font-size:var(--ran-input-label-font-size, 14px);left:var(--ran-input-label-left, 8px);transition:var(--ran-input-label-transition, transform .3s, color .3s, background-color .3s, backdrop-filter .3s);transform-origin:var(--ran-input-label-transform-origin, left);padding:var(--ran-input-label-padding, 0 .2em);color:var(--ran-input-label-color, #999);background:var(--ran-input-label-background, #fff);opacity:var(--ran-input-label-opacity, .9)}';
|
|
6
|
-
class Input extends HTMLElementSSR() {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
__publicField(this, "_input");
|
|
10
|
-
__publicField(this, "_label");
|
|
11
|
-
__publicField(this, "_inputContent");
|
|
12
|
-
__publicField(this, "_icon");
|
|
13
|
-
/**
|
|
14
|
-
* @description: 原生的 input 方法
|
|
15
|
-
* @param {Event} event
|
|
16
|
-
*/
|
|
17
|
-
__publicField(this, "customInput", (event) => {
|
|
18
|
-
event.stopPropagation();
|
|
19
|
-
event.preventDefault();
|
|
20
|
-
const { target, data = "" } = event;
|
|
21
|
-
this.value = (target == null ? void 0 : target.value) || data || "";
|
|
22
|
-
this.customChange();
|
|
23
|
-
this.dispatchEvent(
|
|
24
|
-
new CustomEvent("input", {
|
|
25
|
-
detail: {
|
|
26
|
-
value: this.value
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
);
|
|
30
|
-
});
|
|
31
|
-
/**
|
|
32
|
-
* @description: 增加 change 方法,同时兼容大小写的情况
|
|
33
|
-
*/
|
|
34
|
-
__publicField(this, "customChange", () => {
|
|
35
|
-
this.dispatchEvent(
|
|
36
|
-
new CustomEvent("change", {
|
|
37
|
-
detail: {
|
|
38
|
-
value: this.value
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
);
|
|
42
|
-
});
|
|
43
|
-
/**
|
|
44
|
-
* @description: 监听 placeholder 属性函数
|
|
45
|
-
* @param {string} name
|
|
46
|
-
* @param {string} value
|
|
47
|
-
*/
|
|
48
|
-
__publicField(this, "listenPlaceholder", (name, value) => {
|
|
49
|
-
if (name === "placeholder" && this._inputContent) {
|
|
50
|
-
if (value != null) {
|
|
51
|
-
this._inputContent.setAttribute("placeholder", value);
|
|
52
|
-
} else {
|
|
53
|
-
this._inputContent.removeAttribute("placeholder");
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
/**
|
|
58
|
-
* @description: 监听 label 属性函数
|
|
59
|
-
* @param {string} name
|
|
60
|
-
* @param {string} value
|
|
61
|
-
*/
|
|
62
|
-
__publicField(this, "listenLabel", (name, value) => {
|
|
63
|
-
if (name === "label" && this._inputContent) {
|
|
64
|
-
if (value != null) {
|
|
65
|
-
if (this._label) {
|
|
66
|
-
this._label.innerHTML = value;
|
|
67
|
-
} else {
|
|
68
|
-
this._label = document.createElement("label");
|
|
69
|
-
this._label.innerHTML = value;
|
|
70
|
-
this._label.setAttribute("class", "ran-input-label");
|
|
71
|
-
this._label.setAttribute("part", "ran-input-label");
|
|
72
|
-
this._input.appendChild(this._label);
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
this._input.removeAttribute("label");
|
|
76
|
-
if (this._label) {
|
|
77
|
-
this._input.removeChild(this._label);
|
|
78
|
-
this._label = void 0;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
/**
|
|
84
|
-
* @description: 监听 type 属性
|
|
85
|
-
* @param {string} name
|
|
86
|
-
* @param {string} value
|
|
87
|
-
*/
|
|
88
|
-
__publicField(this, "listenType", (name, value) => {
|
|
89
|
-
if (name === "type" && this._inputContent) {
|
|
90
|
-
if (value) {
|
|
91
|
-
this._inputContent.setAttribute("type", value);
|
|
92
|
-
} else {
|
|
93
|
-
this._inputContent.removeAttribute("type");
|
|
94
|
-
this._inputContent.removeAttribute("min");
|
|
95
|
-
this._inputContent.removeAttribute("max");
|
|
96
|
-
this._inputContent.removeAttribute("step");
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
/**
|
|
101
|
-
* @description: 监听 status 属性
|
|
102
|
-
* @param {string} name
|
|
103
|
-
* @param {string} value
|
|
104
|
-
*/
|
|
105
|
-
__publicField(this, "listenStatus", (name, value) => {
|
|
106
|
-
if (name === "status" && this._input) {
|
|
107
|
-
if (value) {
|
|
108
|
-
this._input.setAttribute("status", value);
|
|
109
|
-
} else {
|
|
110
|
-
this._input.removeAttribute("status");
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
/**
|
|
115
|
-
* @description: 监听 disabled 属性
|
|
116
|
-
* @param {string} name
|
|
117
|
-
* @param {string} value
|
|
118
|
-
*/
|
|
119
|
-
__publicField(this, "listenDisabled", (name, value) => {
|
|
120
|
-
if (name === "disabled" && this._input) {
|
|
121
|
-
if (falseList.includes(value)) {
|
|
122
|
-
this._input.removeAttribute("disabled");
|
|
123
|
-
} else {
|
|
124
|
-
this._input.setAttribute("disabled", "");
|
|
125
|
-
this._inputContent.setAttribute("disabled", "");
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
/**
|
|
130
|
-
* @description: 监听 icon 属性
|
|
131
|
-
* @param {string} name
|
|
132
|
-
* @param {string} value
|
|
133
|
-
*/
|
|
134
|
-
__publicField(this, "listenIcon", (name, value, oldValue) => {
|
|
135
|
-
if (name === "icon" && value && value !== oldValue) {
|
|
136
|
-
this.removeAttribute("label");
|
|
137
|
-
this.setAttribute("icon", value);
|
|
138
|
-
this.dealIcon();
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
/**
|
|
142
|
-
* @description: 处理 icon 属性的问题
|
|
143
|
-
*/
|
|
144
|
-
__publicField(this, "dealIcon", () => {
|
|
145
|
-
if (!this._icon) {
|
|
146
|
-
this._icon = document.createElement("ra-icon");
|
|
147
|
-
const { width, height } = this._inputContent.getBoundingClientRect();
|
|
148
|
-
const size = Math.min(width, height);
|
|
149
|
-
this._icon.setAttribute("size", `${size}`);
|
|
150
|
-
this._inputContent.insertAdjacentElement("beforebegin", this._icon);
|
|
151
|
-
}
|
|
152
|
-
this.icon && this._icon.setAttribute("name", this.icon);
|
|
153
|
-
});
|
|
154
|
-
/**
|
|
155
|
-
* @description: 聚合监听事件
|
|
156
|
-
* @param {string} name
|
|
157
|
-
* @param {string} oldValue
|
|
158
|
-
* @param {string} newValue
|
|
159
|
-
*/
|
|
160
|
-
__publicField(this, "listenEvent", (name, oldValue, newValue) => {
|
|
161
|
-
this.listenPlaceholder(name, newValue);
|
|
162
|
-
this.listenLabel(name, newValue);
|
|
163
|
-
this.listenStatus(name, newValue);
|
|
164
|
-
this.listenDisabled(name, newValue);
|
|
165
|
-
this.listenIcon(name, newValue, oldValue);
|
|
166
|
-
if (name === "value" && oldValue !== newValue) {
|
|
167
|
-
this._inputContent.value = newValue;
|
|
168
|
-
this._input.setAttribute("value", newValue);
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
172
|
-
const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
|
|
173
|
-
F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
|
|
174
|
-
shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
|
|
175
|
-
this._input = document.createElement("div");
|
|
176
|
-
this._input.setAttribute("class", "ran-input");
|
|
177
|
-
this._input.setAttribute("part", "ran-input");
|
|
178
|
-
this._inputContent = document.createElement("input");
|
|
179
|
-
this._inputContent.setAttribute("class", "ran-input-content");
|
|
180
|
-
this._inputContent.setAttribute("part", "ran-input-content");
|
|
181
|
-
this._input.appendChild(this._inputContent);
|
|
182
|
-
shadowRoot.appendChild(this._input);
|
|
183
|
-
}
|
|
184
|
-
static get observedAttributes() {
|
|
185
|
-
return [
|
|
186
|
-
"label",
|
|
187
|
-
"disabled",
|
|
188
|
-
"name",
|
|
189
|
-
"placeholder",
|
|
190
|
-
"type",
|
|
191
|
-
"icon",
|
|
192
|
-
"value",
|
|
193
|
-
"status",
|
|
194
|
-
// error warning normal
|
|
195
|
-
"prefix",
|
|
196
|
-
// 前缀
|
|
197
|
-
"suffix",
|
|
198
|
-
// 后缀
|
|
199
|
-
"allowclear",
|
|
200
|
-
// 清除 icon
|
|
201
|
-
"count",
|
|
202
|
-
// 计算输入的数量
|
|
203
|
-
"maxlength",
|
|
204
|
-
"showcount",
|
|
205
|
-
"onPressEnter",
|
|
206
|
-
// 按下回车的回调
|
|
207
|
-
"variant",
|
|
208
|
-
// filled borderless
|
|
209
|
-
"minrows",
|
|
210
|
-
// 当 type 等于 TextArea 时
|
|
211
|
-
"maxrows"
|
|
212
|
-
];
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* @description: 获取 input 的值
|
|
216
|
-
* @return {String}
|
|
217
|
-
*/
|
|
218
|
-
get value() {
|
|
219
|
-
return this.getAttribute("value") || "";
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* @description: 设置 input 的值
|
|
223
|
-
* @param {String} value
|
|
224
|
-
*/
|
|
225
|
-
set value(value) {
|
|
226
|
-
if (!isDisabled(this) && value) {
|
|
227
|
-
this.setAttribute("value", value);
|
|
228
|
-
this._input.setAttribute("value", value);
|
|
229
|
-
} else {
|
|
230
|
-
this.removeAttribute("value");
|
|
231
|
-
this._input.removeAttribute("value");
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* @description: 获取 input 的占位字符
|
|
236
|
-
* @return {String}
|
|
237
|
-
*/
|
|
238
|
-
get placeholder() {
|
|
239
|
-
return this.getAttribute("placeholder") || "";
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* @description: 设置 input 的占位字符
|
|
243
|
-
* @param {String} value
|
|
244
|
-
*/
|
|
245
|
-
set placeholder(value) {
|
|
246
|
-
if (value) {
|
|
247
|
-
this.setAttribute("placeholder", value);
|
|
248
|
-
} else {
|
|
249
|
-
this.removeAttribute("placeholder");
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* @description: input 是否为必选
|
|
254
|
-
* @return {String}
|
|
255
|
-
*/
|
|
256
|
-
get required() {
|
|
257
|
-
return this.getAttribute("required") || "";
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* @description: 设置 input 是否为必选,除非设置成 false,否则都是必填
|
|
261
|
-
* @param {*} value
|
|
262
|
-
*/
|
|
263
|
-
set required(value) {
|
|
264
|
-
if (!value || value === "false") {
|
|
265
|
-
this.removeAttribute("required");
|
|
266
|
-
} else {
|
|
267
|
-
this.setAttribute("required", "");
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* @description: 获取 input 上 disabled 属性
|
|
272
|
-
* @return {String | null}
|
|
273
|
-
*/
|
|
274
|
-
get disabled() {
|
|
275
|
-
return `${isDisabled(this)}`;
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* @description: 设置 input 的 disabled 属性
|
|
279
|
-
* @param {String} value
|
|
280
|
-
*/
|
|
281
|
-
set disabled(value) {
|
|
282
|
-
if (falseList.includes(value)) {
|
|
283
|
-
this.removeAttribute("disabled");
|
|
284
|
-
this._input.removeAttribute("disabled");
|
|
285
|
-
this._inputContent.removeAttribute("disabled");
|
|
286
|
-
} else {
|
|
287
|
-
this.setAttribute("disabled", "");
|
|
288
|
-
this._input.setAttribute("disabled", "");
|
|
289
|
-
this._inputContent.setAttribute("disabled", "");
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* @description: 获取类似于 Metiral Design 的输入体验。
|
|
294
|
-
*/
|
|
295
|
-
get label() {
|
|
296
|
-
return this.getAttribute("label") || "";
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* @description: 设置类似于 Metiral Design 的输入体验。
|
|
300
|
-
*/
|
|
301
|
-
set label(value) {
|
|
302
|
-
this.setAttribute("label", value);
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* @description: 获取 input 框的状态
|
|
306
|
-
*/
|
|
307
|
-
get status() {
|
|
308
|
-
return this.getAttribute("status") || "";
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* @description: 设置 input 框的状态
|
|
312
|
-
*/
|
|
313
|
-
set status(value) {
|
|
314
|
-
if (value) {
|
|
315
|
-
this.setAttribute("status", value);
|
|
316
|
-
this._input.setAttribute("status", value);
|
|
317
|
-
} else {
|
|
318
|
-
this.removeAttribute("status");
|
|
319
|
-
this._input.removeAttribute("status");
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* @description: 与 form 组件联动时,收集的属性名
|
|
324
|
-
* @return {String}
|
|
325
|
-
*/
|
|
326
|
-
get name() {
|
|
327
|
-
return this.getAttribute("name") || "";
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* @description: 设置 name 属性
|
|
331
|
-
* @param {string} value
|
|
332
|
-
*/
|
|
333
|
-
set name(value) {
|
|
334
|
-
this.setAttribute("name", value);
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* @description: 当 input 类型为 number 类型时,可以获取 min 属性
|
|
338
|
-
* @return {String}
|
|
339
|
-
*/
|
|
340
|
-
get min() {
|
|
341
|
-
return this.getAttribute("min") || "";
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* @description: 当 input 类型为 number 类型时,设置 min 属性
|
|
345
|
-
* @param {string} value
|
|
346
|
-
*/
|
|
347
|
-
set min(value) {
|
|
348
|
-
if (this.type === "number") this.setAttribute("min", value);
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* @description: 当 input 类型为 number 类型时,可以获取 max 属性
|
|
352
|
-
* @return {String}
|
|
353
|
-
*/
|
|
354
|
-
get max() {
|
|
355
|
-
return this.getAttribute("max") || "";
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* @description: 当 input 类型为 number 类型时,设置 max 属性
|
|
359
|
-
* @param {string} value
|
|
360
|
-
*/
|
|
361
|
-
set max(value) {
|
|
362
|
-
if (this.type === "number") this.setAttribute("max", value);
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* @description: 当 input 类型为 number 类型时,可以获取 step 属性
|
|
366
|
-
* @return {String}
|
|
367
|
-
*/
|
|
368
|
-
get step() {
|
|
369
|
-
return this.getAttribute("step") || "";
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* @description: 当 input 类型为 number 类型时,设置 step 属性
|
|
373
|
-
* @param {string} value
|
|
374
|
-
*/
|
|
375
|
-
set step(value) {
|
|
376
|
-
if (this.type === "number") this.setAttribute("step", value);
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* @description: 获取一个 icon
|
|
380
|
-
* @return {String}
|
|
381
|
-
*/
|
|
382
|
-
get icon() {
|
|
383
|
-
return this.getAttribute("icon") || "";
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* @description: 设置 icon 来表示标识
|
|
387
|
-
* @param {string|null} value
|
|
388
|
-
*/
|
|
389
|
-
set icon(value) {
|
|
390
|
-
if (value) {
|
|
391
|
-
this.setAttribute("icon", value);
|
|
392
|
-
} else {
|
|
393
|
-
this.removeAttribute("icon");
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* @description: 获取前面的 icon
|
|
398
|
-
* @return {String}
|
|
399
|
-
*/
|
|
400
|
-
get prefix() {
|
|
401
|
-
return this.getAttribute("prefix") || "";
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* @description: 设置前面的 icon 来表示标识
|
|
405
|
-
* @param {string|null} value
|
|
406
|
-
*/
|
|
407
|
-
set prefix(value) {
|
|
408
|
-
if (value) {
|
|
409
|
-
this.setAttribute("prefix", value);
|
|
410
|
-
} else {
|
|
411
|
-
this.removeAttribute("prefix");
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* @description: 获取后面的 icon
|
|
416
|
-
* @return {String}
|
|
417
|
-
*/
|
|
418
|
-
get suffix() {
|
|
419
|
-
return this.getAttribute("suffix") || "";
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* @description: 设置后面的 icon 来表示标识
|
|
423
|
-
* @param {string|null} value
|
|
424
|
-
*/
|
|
425
|
-
set suffix(value) {
|
|
426
|
-
if (value) {
|
|
427
|
-
this.setAttribute("suffix", value);
|
|
428
|
-
} else {
|
|
429
|
-
this.removeAttribute("suffix");
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* @description: 获取 input 的类型
|
|
434
|
-
* @return {string|null}
|
|
435
|
-
*/
|
|
436
|
-
get type() {
|
|
437
|
-
return this.getAttribute("type") || "";
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* @description: 设置 input 的类型
|
|
441
|
-
* @param {string|null} value
|
|
442
|
-
*/
|
|
443
|
-
set type(value) {
|
|
444
|
-
if (value) {
|
|
445
|
-
this.setAttribute("type", value);
|
|
446
|
-
} else {
|
|
447
|
-
this.removeAttribute("type");
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
connectedCallback() {
|
|
451
|
-
if (this.value) {
|
|
452
|
-
this._inputContent.value = this.value;
|
|
453
|
-
this._input.setAttribute("value", this.value);
|
|
454
|
-
}
|
|
455
|
-
if (this.status) {
|
|
456
|
-
this._input.setAttribute("status", this.status);
|
|
457
|
-
}
|
|
458
|
-
if (isDisabled(this)) {
|
|
459
|
-
this._input.setAttribute("disabled", "");
|
|
460
|
-
this._inputContent.setAttribute("disabled", "");
|
|
461
|
-
}
|
|
462
|
-
if (this.type) {
|
|
463
|
-
this._inputContent.setAttribute("type", this.type);
|
|
464
|
-
}
|
|
465
|
-
this._inputContent.addEventListener("input", this.customInput);
|
|
466
|
-
if (document.readyState === "complete") {
|
|
467
|
-
this.dealIcon();
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
disconnectCallback() {
|
|
471
|
-
this._inputContent.removeEventListener("input", this.customInput);
|
|
472
|
-
}
|
|
473
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
474
|
-
this.listenEvent(name, oldValue, newValue);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
function Custom() {
|
|
478
|
-
if (typeof window !== "undefined" && !customElements.get("r-input")) {
|
|
479
|
-
customElements.define("r-input", Input);
|
|
480
|
-
return Input;
|
|
481
|
-
} else {
|
|
482
|
-
return createCustomError("document is undefined or r-input is exist");
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
const index = Custom();
|
|
486
|
-
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
487
|
-
__proto__: null,
|
|
488
|
-
Input,
|
|
489
|
-
default: index
|
|
490
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
491
|
-
export {
|
|
492
|
-
Input as I,
|
|
493
|
-
index as a,
|
|
494
|
-
index$1 as i
|
|
495
|
-
};
|
package/dist/index-C6RcMHoH.js
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
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 { b as currentDevice } from "./arrow-down-B_hCY3Wt.js";
|
|
5
|
-
import { H as HTMLElementSSR, i as isDisabled, f as falseList, c as createCustomError } from "./index-DC5EA657.js";
|
|
6
|
-
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}:host{position:var(--ran-btn-position, relative);display:var(--ran-btn-display, inline-block);background-image:var(--ran-btn-background-image, none);box-shadow:var(--ran-btn-box-shadow, 0 2px #00000004);cursor:var(--ran-btn-cursor, pointer);-webkit-user-select:var(--ran-btn-user-select, none);user-select:var(--ran-btn-user-select, none);touch-action:var(--ran-btn-touch-action, manipulation);overflow:var(--ran-btn-overflow, hidden);pointer-events:var(--ran-btn-pointer-events, auto)}:host .ran-btn{position:var(--ran-btn-contain-position, relative);display:var(--ran-btn-contain-display, inline-block);background-image:var(--ran-btn-contain-background-image, none);cursor:var(--ran-btn-contain-cursor, pointer);transition:var(--ran-btn-contain-transition, all .3s cubic-bezier(.645, .045, .355, 1));-webkit-user-select:var(--ran-btn-contain-user-select, none);user-select:var(--ran-btn-contain-user-select, none);touch-action:var(--ran-btn-contain-touch-action, manipulation);background:var(--ran-btn-contain-background, #fff)}:host,:host(:active),:host(:focus){outline:0;-webkit-tap-highlight-color:transparent}:host .ran-btn,:host(:active) .ran-btn,:host(:focus) .ran-btn{outline:var(--ran-btn-contain-outline, 0)}:host([type="primary"]) .ran-btn-content{background-color:var(--ran-btn-content-background-color, #1890ff);border-color:var(--ran-btn-content-border-color, #1890ff);color:var(--ran-btn-content-color, #fff)}:host([type="primary"]:not([disabled])) .ran-btn:after{background-image:var(--ran-btn-after-background-image, radial-gradient(circle, #fff 10%, transparent 10.01%))}@media (min-width: 1024px){:host(:not([disabled]):hover) .ran-btn-content{border-color:var(--ran-btn-content-hover-border-color, #1890ff);color:var(--ran-btn-content-hover-color, #1890ff)}:host([type="primary"]:not([disabled]):hover) .ran-btn-content{background-color:var(--ran-btn-content-hover-background-color, #40a9ff);color:var(--ran-btn-content-hover-color, #fff)}:host([type="warning"]:not([disabled]):hover) .ran-btn-content{border-color:var(--ran-btn-content-warning-border-color, #ff4d4f);background-color:var(--ran-btn-content-warning-background-color, #ff4d4f);color:var(--ran-btn-content-warning-color, #fff)}}:host([type="warning"]) .ran-btn-content{border-color:var(--ran-btn-content-warning-border-color, #ff4d4f);background-color:var(--ran-btn-content-warning-background-color, #ff4d4f);color:var(--ran-btn-content-warning-color, #fff)}:host([type="warning"]:not([disabled])) .ran-btn:after{background-image:var(--ran-btn-after-background-image, radial-gradient(circle, #fff 10%, transparent 10.01%))}:host([type="text"]) .ran-btn-content{border:var(--ran-btn-content-text-border, none)}:host([disabled]){cursor:var(--ran-btn-disabled-cursor, not-allowed);pointer-events:var(--ran-btn-disabled-pointer-events, all);opacity:var(--ran-btn-disabled-opacity, .6)}:host([disabled]) .ran-btn{cursor:var(--ran-btn-disabled-container-cursor, not-allowed);pointer-events:var(--ran-btn-disabled-container-pointer-events, all);opacity:var(--ran-btn-disabled-container-opacity, .6)}:host(:not([disabled]):active) .ran-btn:after{transform:var(--ran-btn-after-transform, translate(-50%, -50%) scale(0));opacity:var(--ran-btn-after-opacity, .3);transition:var(--ran-btn-after-transition, 0s)}@media (min-width: 1024px){:host(:not([disabled],[effect])) .ran-btn:after{content:"";display:block;position:absolute;width:100%;height:100%;left:var(--ran-x, 0);top:var(--ran-y, 0);pointer-events:none;background-image:radial-gradient(circle,#1890ff 10%,transparent 10.01%);background-repeat:no-repeat;background-position:50%;transform:translate(-50%,-50%) scale(10);opacity:0;transition:transform .3s,opacity .8s}}:host .slot{display:var(--ran-btn-slot-display, block)}.ran-btn-content{display:var(--ran-btn-content-display, flex);justify-content:var(--ran-btn-content-display, space-between);align-items:var(--ran-btn-content-align-items, center);padding:var(--ran-btn-content-padding, 4px 15px);border:var(--ran-btn-content-border, 1px solid transparent);border-radius:var(--ran-btn-content-border-radius, 2px);border-color:var(--ran-btn-content-border-color, #d9d9d9);color:var(--ran-btn-content-color, #000000d9);line-height:var(--ran-btn-content-line-height, 22px);font-size:var(--ran-btn-content-font-size, 14px);font-weight:var(--ran-btn-content-font-weight, 400);white-space:var(--ran-btn-content-white-space, nowrap);text-align:var(--ran-btn-content-text-align, center)}.ran-btn-content .icon{margin-right:var(--ran-btn-icon-margin-right, 2px)}';
|
|
7
|
-
class Button extends HTMLElementSSR() {
|
|
8
|
-
constructor() {
|
|
9
|
-
super();
|
|
10
|
-
__publicField(this, "_btn");
|
|
11
|
-
__publicField(this, "_btnContent");
|
|
12
|
-
__publicField(this, "_iconElement");
|
|
13
|
-
__publicField(this, "_slot");
|
|
14
|
-
__publicField(this, "_shadowDom");
|
|
15
|
-
__publicField(this, "debounceTimeId");
|
|
16
|
-
/**
|
|
17
|
-
* @description: 设置 button 的 icon
|
|
18
|
-
* @return {*}
|
|
19
|
-
*/
|
|
20
|
-
__publicField(this, "setIcon", () => {
|
|
21
|
-
if (this.icon) {
|
|
22
|
-
const { width, height } = this._slot.getBoundingClientRect();
|
|
23
|
-
const size = Math.min(width, height);
|
|
24
|
-
if (this._iconElement) {
|
|
25
|
-
this._iconElement.setAttribute("name", this.icon);
|
|
26
|
-
} else {
|
|
27
|
-
this._iconElement = document.createElement("r-icon");
|
|
28
|
-
this._iconElement.setAttribute("name", this.icon);
|
|
29
|
-
this._iconElement.setAttribute("color", "currentColor");
|
|
30
|
-
this._iconElement.setAttribute("class", "icon");
|
|
31
|
-
this._slot.insertAdjacentElement("beforebegin", this._iconElement);
|
|
32
|
-
}
|
|
33
|
-
if (this.iconSize) {
|
|
34
|
-
this._iconElement.setAttribute("size", this.iconSize);
|
|
35
|
-
} else {
|
|
36
|
-
this._iconElement.setAttribute("size", `${size - 5}`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
__publicField(this, "mousedown", (event) => {
|
|
41
|
-
if (currentDevice() !== "pc") return;
|
|
42
|
-
if (!this.disabled || this.disabled === "false") {
|
|
43
|
-
this.debounceMouseEvent();
|
|
44
|
-
const { left, top } = this.getBoundingClientRect();
|
|
45
|
-
this._btn.style.setProperty("--ran-x", event.clientX - left + "px");
|
|
46
|
-
this._btn.style.setProperty("--ran-y", event.clientY - top + "px");
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
__publicField(this, "mouseup", (event) => {
|
|
50
|
-
if (currentDevice() !== "pc") return;
|
|
51
|
-
if (this.debounceTimeId) return;
|
|
52
|
-
this.debounceTimeId = setTimeout(() => {
|
|
53
|
-
this._btn.style.removeProperty("--ran-x");
|
|
54
|
-
this._btn.style.removeProperty("--ran-y");
|
|
55
|
-
this.debounceMouseEvent();
|
|
56
|
-
}, 600);
|
|
57
|
-
});
|
|
58
|
-
__publicField(this, "debounceMouseEvent", () => {
|
|
59
|
-
clearTimeout(this.debounceTimeId);
|
|
60
|
-
this.debounceTimeId = void 0;
|
|
61
|
-
});
|
|
62
|
-
__publicField(this, "handlerExternalCss", () => {
|
|
63
|
-
if (this.sheet) {
|
|
64
|
-
try {
|
|
65
|
-
const sheet = new CSSStyleSheet();
|
|
66
|
-
sheet.insertRule(this.sheet);
|
|
67
|
-
this._shadowDom.adoptedStyleSheets = [sheet];
|
|
68
|
-
} catch (error) {
|
|
69
|
-
console.error(`Failed to parse the rule in CSSStyleSheet: ${this.sheet}`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
this._slot = document.createElement("slot");
|
|
74
|
-
this._btnContent = document.createElement("div");
|
|
75
|
-
this._btn = document.createElement("div");
|
|
76
|
-
this._btn.setAttribute("class", "ran-btn");
|
|
77
|
-
this._btn.setAttribute("part", "ran-btn");
|
|
78
|
-
this._btnContent.setAttribute("class", "ran-btn-content");
|
|
79
|
-
this._btnContent.setAttribute("part", "ran-btn-content");
|
|
80
|
-
this._btnContent.appendChild(this._slot);
|
|
81
|
-
this._slot.setAttribute("class", "slot");
|
|
82
|
-
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
83
|
-
const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
|
|
84
|
-
F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
|
|
85
|
-
shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
|
|
86
|
-
this._shadowDom = shadowRoot;
|
|
87
|
-
this._btn.appendChild(this._btnContent);
|
|
88
|
-
shadowRoot.appendChild(this._btn);
|
|
89
|
-
}
|
|
90
|
-
static get observedAttributes() {
|
|
91
|
-
return ["disabled", "icon", "effect", "iconSize", "sheet"];
|
|
92
|
-
}
|
|
93
|
-
get sheet() {
|
|
94
|
-
return this.getAttribute("sheet") || "";
|
|
95
|
-
}
|
|
96
|
-
set sheet(value) {
|
|
97
|
-
this.setAttribute("sheet", value || "");
|
|
98
|
-
}
|
|
99
|
-
get disabled() {
|
|
100
|
-
return isDisabled(this);
|
|
101
|
-
}
|
|
102
|
-
set disabled(value) {
|
|
103
|
-
if (!value || value === "false") {
|
|
104
|
-
this.removeAttribute("disabled");
|
|
105
|
-
this.removeAttribute("aria-disabled");
|
|
106
|
-
} else {
|
|
107
|
-
this.setAttribute("disabled", "");
|
|
108
|
-
this.setAttribute("aria-disabled", "true");
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
get iconSize() {
|
|
112
|
-
return this.getAttribute("iconSize") || "";
|
|
113
|
-
}
|
|
114
|
-
set iconSize(value) {
|
|
115
|
-
if (!value || value === "false") {
|
|
116
|
-
this.removeAttribute("iconSize");
|
|
117
|
-
} else {
|
|
118
|
-
this.setAttribute("iconSize", value);
|
|
119
|
-
this.setIcon();
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
get icon() {
|
|
123
|
-
return this.getAttribute("icon") || "";
|
|
124
|
-
}
|
|
125
|
-
set icon(value) {
|
|
126
|
-
if (!value || value === "false") {
|
|
127
|
-
this.removeAttribute("icon");
|
|
128
|
-
} else {
|
|
129
|
-
this.setAttribute("icon", value);
|
|
130
|
-
this.setIcon();
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
get effect() {
|
|
134
|
-
return this.getAttribute("effect") || "";
|
|
135
|
-
}
|
|
136
|
-
set effect(value) {
|
|
137
|
-
if (falseList.includes(value) || !value) {
|
|
138
|
-
this.removeAttribute("effect");
|
|
139
|
-
} else {
|
|
140
|
-
this.setAttribute("effect", value);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
connectedCallback() {
|
|
144
|
-
this._btn.addEventListener("mousedown", this.mousedown);
|
|
145
|
-
this._btn.addEventListener("mouseup", this.mouseup);
|
|
146
|
-
this.handlerExternalCss();
|
|
147
|
-
this.setIcon();
|
|
148
|
-
this.setAttribute("role", "button");
|
|
149
|
-
this.setAttribute("tabindex", "0");
|
|
150
|
-
}
|
|
151
|
-
disconnectCallback() {
|
|
152
|
-
this._btn.removeEventListener("mousedown", this.mousedown);
|
|
153
|
-
this._btn.removeEventListener("mouseup", this.mouseup);
|
|
154
|
-
}
|
|
155
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
156
|
-
if (name === "disabled" && this._btnContent) {
|
|
157
|
-
if (!newValue || newValue === "false") {
|
|
158
|
-
this._btnContent.setAttribute("disabled", "");
|
|
159
|
-
} else {
|
|
160
|
-
this._btnContent.removeAttribute("disabled");
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
if (name === "icon" && this._btnContent && oldValue !== newValue) this.setIcon();
|
|
164
|
-
if (name === "iconSize" && this._btnContent && oldValue !== newValue)
|
|
165
|
-
this._btnContent.setAttribute("iconSize", newValue);
|
|
166
|
-
if (name === "sheet" && this._shadowDom && oldValue !== newValue) this.handlerExternalCss();
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
function Custom() {
|
|
170
|
-
if (typeof document !== "undefined" && !customElements.get("r-button")) {
|
|
171
|
-
customElements.define("r-button", Button);
|
|
172
|
-
return Button;
|
|
173
|
-
} else {
|
|
174
|
-
return createCustomError("document is undefined or r-button is exist");
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
const index = Custom();
|
|
178
|
-
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
179
|
-
__proto__: null,
|
|
180
|
-
Button,
|
|
181
|
-
default: index
|
|
182
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
183
|
-
export {
|
|
184
|
-
Button as B,
|
|
185
|
-
index as a,
|
|
186
|
-
index$1 as i
|
|
187
|
-
};
|